aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpandan Das <spandandas@google.com>2023-06-15 02:30:50 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2023-06-15 02:30:50 +0000
commit9bb1b549b6a84214c53be0924760be030e66b93a (patch)
treed9fac15bb5a835ae6ba757dc5eaf6ef597ea44cf
parent9803cf8403d7105bddc1d5304d6e694b781a6605 (diff)
parent780ccd3956961690db3e36d8fa1ed7649cb0057b (diff)
downloadbazelbuild-rules_go-9bb1b549b6a84214c53be0924760be030e66b93a.tar.gz
Merge remote-tracking branch 'aosp/upstream-master' into merge_rules_go am: 49dcd02124 am: 711a453236 am: 6cf433ad1b am: de80525bba am: 96939a977e am: 780ccd3956HEADandroid-14.0.0_r33android-14.0.0_r32android-14.0.0_r31android-14.0.0_r30android-14.0.0_r29android-14.0.0_r28mastermainandroid14-qpr2-s3-releaseandroid14-qpr2-s2-releaseandroid14-qpr2-s1-releaseandroid14-qpr2-release
Original change: https://android-review.googlesource.com/c/platform/external/bazelbuild-rules_go/+/2625353 Change-Id: Id4ca3195d832eca77b29b2896b89027d847bb72d Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
-rw-r--r--.bazelci/presubmit.yml377
-rw-r--r--.bazelignore2
-rw-r--r--.bazelrc34
-rw-r--r--.bcr/config.yml3
-rw-r--r--.bcr/metadata.template.json15
-rw-r--r--.bcr/presubmit.yml31
-rw-r--r--.bcr/source.template.json5
-rw-r--r--.github/ISSUE_TEMPLATE37
-rw-r--r--.github/PULL_REQUEST_TEMPLATE.md30
-rw-r--r--.gitignore7
-rw-r--r--.vscode/extensions.json8
-rw-r--r--.vscode/settings.json32
-rw-r--r--AUTHORS14
-rw-r--r--BUILD.bazel178
-rw-r--r--CODEOWNERS1
-rw-r--r--CONTRIBUTING.md39
-rw-r--r--CONTRIBUTORS26
l---------LICENSE1
-rw-r--r--LICENSE.txt202
-rw-r--r--METADATA17
-rw-r--r--MODULE.bazel47
-rw-r--r--OWNERS1
-rw-r--r--README.rst832
-rw-r--r--WORKSPACE181
-rw-r--r--docs/BUILD.bazel19
-rw-r--r--docs/doc_helpers.bzl84
-rw-r--r--docs/go/core/BUILD.bazel22
-rw-r--r--docs/go/core/buildgraph.excalidraw2260
-rw-r--r--docs/go/core/buildgraph.svg16
-rw-r--r--docs/go/core/bzlmod.md186
-rw-r--r--docs/go/core/cross_compilation.md29
-rw-r--r--docs/go/core/defines_and_stamping.md94
-rw-r--r--docs/go/core/embedding.md86
-rw-r--r--docs/go/core/examples.md70
-rw-r--r--docs/go/core/platform-specific_dependencies.md53
-rw-r--r--docs/go/core/rules.bzl129
-rw-r--r--docs/go/core/rules.md403
-rw-r--r--docs/go/editors/vim.md66
-rw-r--r--docs/go/extras/BUILD.bazel16
-rw-r--r--docs/go/extras/extras.bzl35
-rw-r--r--docs/go/extras/extras.md109
-rw-r--r--docs/rule_body.vm37
-rw-r--r--examples/basic-gazelle/.bazelrc1
-rw-r--r--examples/basic-gazelle/.gitignore5
-rw-r--r--examples/basic-gazelle/BUILD.bazel33
-rw-r--r--examples/basic-gazelle/CONTRIBUTING.md9
-rw-r--r--examples/basic-gazelle/README.md4
-rw-r--r--examples/basic-gazelle/WORKSPACE65
-rw-r--r--examples/basic-gazelle/cmd/BUILD.bazel16
-rw-r--r--examples/basic-gazelle/cmd/roll.go44
-rw-r--r--examples/basic-gazelle/cmd/root.go49
-rw-r--r--examples/basic-gazelle/deps.bzl61
-rw-r--r--examples/basic-gazelle/go.mod14
-rw-r--r--examples/basic-gazelle/go.sum14
-rw-r--r--examples/basic-gazelle/main.go25
-rw-r--r--examples/basic-gazelle/pkg/roll/BUILD.bazel15
-rw-r--r--examples/basic-gazelle/pkg/roll/roll_dice.go34
-rw-r--r--examples/basic-gazelle/pkg/roll/roll_dice_test.go27
-rw-r--r--extras/BUILD.bazel51
-rw-r--r--extras/bindata.bzl87
-rw-r--r--extras/embed_data.bzl146
-rw-r--r--extras/embed_data_deps.bzl35
-rw-r--r--extras/gomock.bzl386
-rw-r--r--extras/gomock/BUILD.bazel17
-rw-r--r--go.mod17
-rw-r--r--go.sum108
-rw-r--r--go/BUILD.bazel71
-rw-r--r--go/config/BUILD.bazel81
-rw-r--r--go/constraints/amd64/BUILD.bazel38
-rw-r--r--go/core.rst95
-rw-r--r--go/crosstool.rst346
-rw-r--r--go/def.bzl198
-rw-r--r--go/dependencies.rst267
-rw-r--r--go/deps.bzl39
-rw-r--r--go/extensions.bzl3
-rw-r--r--go/extras.rst3
-rw-r--r--go/modes.rst171
-rw-r--r--go/nogo.rst406
-rw-r--r--go/nogo_logo.pngbin0 -> 9209 bytes
-rw-r--r--go/platform/BUILD.bazel38
-rw-r--r--go/platform/apple.bzl48
-rw-r--r--go/platform/list.bzl67
-rw-r--r--go/private/BUILD.bazel205
-rw-r--r--go/private/BUILD.nogo.bazel6
-rw-r--r--go/private/BUILD.sdk.bazel92
-rw-r--r--go/private/actions/BUILD.bazel77
-rw-r--r--go/private/actions/archive.bzl201
-rw-r--r--go/private/actions/binary.bzl68
-rw-r--r--go/private/actions/compilepkg.bzl161
-rw-r--r--go/private/actions/link.bzl276
-rw-r--r--go/private/actions/stdlib.bzl149
-rw-r--r--go/private/actions/utils.bzl7
-rw-r--r--go/private/common.bzl254
-rw-r--r--go/private/context.bzl912
-rw-r--r--go/private/extensions.bzl190
-rw-r--r--go/private/go_toolchain.bzl219
-rw-r--r--go/private/mode.bzl251
-rw-r--r--go/private/nogo.bzl36
-rw-r--r--go/private/platforms.bzl180
-rw-r--r--go/private/providers.bzl117
-rw-r--r--go/private/repositories.bzl300
-rw-r--r--go/private/rpath.bzl59
-rw-r--r--go/private/rules/BUILD.bazel181
-rw-r--r--go/private/rules/binary.bzl498
-rw-r--r--go/private/rules/cgo.bzl208
-rw-r--r--go/private/rules/cross.bzl141
-rw-r--r--go/private/rules/go_bin_for_host.bzl48
-rw-r--r--go/private/rules/info.bzl60
-rw-r--r--go/private/rules/library.bzl226
-rw-r--r--go/private/rules/nogo.bzl150
-rw-r--r--go/private/rules/sdk.bzl140
-rw-r--r--go/private/rules/source.bzl96
-rw-r--r--go/private/rules/stdlib.bzl53
-rw-r--r--go/private/rules/test.bzl707
-rw-r--r--go/private/rules/transition.bzl459
-rw-r--r--go/private/rules/wrappers.bzl81
-rw-r--r--go/private/sdk.bzl704
-rw-r--r--go/private/skylib/README.rst7
-rw-r--r--go/private/skylib/lib/BUILD.bazel20
-rw-r--r--go/private/skylib/lib/versions.bzl127
-rw-r--r--go/private/tools/BUILD.bazel27
-rw-r--r--go/private/tools/files_equal_test.bzl122
-rw-r--r--go/private/tools/lines_sorted_test.bzl45
-rw-r--r--go/private/tools/path.bzl278
-rw-r--r--go/private/tools/single_output_test.bzl56
-rw-r--r--go/providers.rst436
-rw-r--r--go/runfiles/BUILD.bazel41
-rw-r--r--go/runfiles/directory.go36
-rw-r--r--go/runfiles/fs.go99
-rw-r--r--go/runfiles/global.go97
-rw-r--r--go/runfiles/manifest.go91
-rw-r--r--go/runfiles/runfiles.go305
-rw-r--r--go/toolchain/BUILD.bazel37
-rw-r--r--go/toolchain/toolchains.bzl78
-rw-r--r--go/toolchains.rst847
-rw-r--r--go/tools/BUILD.bazel13
-rw-r--r--go/tools/bazel/BUILD.bazel34
-rw-r--r--go/tools/bazel/bazel.go73
-rw-r--r--go/tools/bazel/bazel_test.go267
-rw-r--r--go/tools/bazel/empty.txt0
-rw-r--r--go/tools/bazel/runfiles.go442
-rw-r--r--go/tools/bazel_benchmark/BUILD.bazel14
-rw-r--r--go/tools/bazel_benchmark/BUILD.bazel.in6
-rw-r--r--go/tools/bazel_benchmark/WORKSPACE.in26
-rw-r--r--go/tools/bazel_benchmark/bazel_benchmark.go400
-rwxr-xr-xgo/tools/bazel_benchmark/bazel_benchmark.sh29
-rw-r--r--go/tools/bazel_benchmark/hello.go.in9
-rw-r--r--go/tools/bazel_testing/BUILD.bazel33
-rw-r--r--go/tools/bazel_testing/bazel_testing.go535
-rw-r--r--go/tools/bazel_testing/def.bzl62
-rw-r--r--go/tools/builders/BUILD.bazel173
-rw-r--r--go/tools/builders/ar.go104
-rw-r--r--go/tools/builders/asm.go138
-rw-r--r--go/tools/builders/builder.go64
-rw-r--r--go/tools/builders/cgo2.go397
-rw-r--r--go/tools/builders/compilepkg.go615
-rw-r--r--go/tools/builders/cover.go110
-rw-r--r--go/tools/builders/cover_test.go130
-rw-r--r--go/tools/builders/edit.go95
-rw-r--r--go/tools/builders/embed.go340
-rw-r--r--go/tools/builders/embedcfg.go439
-rw-r--r--go/tools/builders/env.go474
-rw-r--r--go/tools/builders/filter.go168
-rw-r--r--go/tools/builders/filter_buildid.go44
-rw-r--r--go/tools/builders/filter_test.go136
-rw-r--r--go/tools/builders/flags.go135
-rw-r--r--go/tools/builders/generate_nogo_main.go196
-rw-r--r--go/tools/builders/generate_test_main.go416
-rw-r--r--go/tools/builders/go_path.go203
-rw-r--r--go/tools/builders/importcfg.go261
-rw-r--r--go/tools/builders/info.go64
-rw-r--r--go/tools/builders/link.go163
-rw-r--r--go/tools/builders/md5sum.go89
-rw-r--r--go/tools/builders/nogo_main.go654
-rw-r--r--go/tools/builders/nogo_typeparams_go117.go23
-rw-r--r--go/tools/builders/nogo_typeparams_go118.go28
-rw-r--r--go/tools/builders/nolint.go39
-rw-r--r--go/tools/builders/nolint_test.go79
-rw-r--r--go/tools/builders/pack.go388
-rw-r--r--go/tools/builders/path.go7
-rw-r--r--go/tools/builders/path_windows.go25
-rw-r--r--go/tools/builders/protoc.go219
-rw-r--r--go/tools/builders/read.go551
-rw-r--r--go/tools/builders/replicate.go167
-rw-r--r--go/tools/builders/stdlib.go169
-rw-r--r--go/tools/builders/stdliblist.go293
-rw-r--r--go/tools/builders/stdliblist_test.go48
-rw-r--r--go/tools/bzltestutil/BUILD.bazel45
-rw-r--r--go/tools/bzltestutil/init.go60
-rw-r--r--go/tools/bzltestutil/lcov.go178
-rw-r--r--go/tools/bzltestutil/lcov_test.go71
-rw-r--r--go/tools/bzltestutil/test2json.go482
-rw-r--r--go/tools/bzltestutil/testdata/empty.json1
-rw-r--r--go/tools/bzltestutil/testdata/empty.xml3
-rw-r--r--go/tools/bzltestutil/testdata/report.json47
-rw-r--r--go/tools/bzltestutil/testdata/report.xml19
-rw-r--r--go/tools/bzltestutil/wrap.go154
-rw-r--r--go/tools/bzltestutil/wrap_test.go63
-rw-r--r--go/tools/bzltestutil/xml.go181
-rw-r--r--go/tools/bzltestutil/xml_test.go55
-rw-r--r--go/tools/coverdata/BUILD.bazel15
-rw-r--r--go/tools/coverdata/coverdata.go58
-rw-r--r--go/tools/fetch_repo/BUILD.bazel23
-rw-r--r--go/tools/fetch_repo/fetch_repo_test.go96
-rw-r--r--go/tools/fetch_repo/main.go75
-rw-r--r--go/tools/gazelle/README.rst2
-rw-r--r--go/tools/go_bin_runner/BUILD.bazel39
-rw-r--r--go/tools/go_bin_runner/main.go41
-rw-r--r--go/tools/go_bin_runner/process.go20
-rw-r--r--go/tools/gopackagesdriver/BUILD.bazel39
-rw-r--r--go/tools/gopackagesdriver/aspect.bzl169
-rw-r--r--go/tools/gopackagesdriver/bazel.go164
-rw-r--r--go/tools/gopackagesdriver/bazel_json_builder.go250
-rw-r--r--go/tools/gopackagesdriver/build_context.go34
-rw-r--r--go/tools/gopackagesdriver/driver_request.go91
-rw-r--r--go/tools/gopackagesdriver/flatpackage.go159
-rw-r--r--go/tools/gopackagesdriver/json_packages_driver.go59
-rw-r--r--go/tools/gopackagesdriver/main.go126
-rw-r--r--go/tools/gopackagesdriver/packageregistry.go111
-rw-r--r--go/tools/gopackagesdriver/utils.go77
-rw-r--r--go/tools/internal/stdlib_tags/BUILD.bazel14
-rw-r--r--go/tools/internal/stdlib_tags/stdlib_tags.go174
-rw-r--r--go/tools/internal/txtar/BUILD.bazel20
-rw-r--r--go/tools/internal/txtar/archive.go140
-rw-r--r--go/tools/internal/txtar/archive_test.go67
-rw-r--r--go/tools/releaser/BUILD.bazel37
-rw-r--r--go/tools/releaser/boilerplate.go78
-rw-r--r--go/tools/releaser/file.go301
-rw-r--r--go/tools/releaser/git.go52
-rw-r--r--go/tools/releaser/github.go132
-rw-r--r--go/tools/releaser/prepare.go253
-rw-r--r--go/tools/releaser/releaser.go127
-rw-r--r--go/tools/releaser/run.go92
-rw-r--r--go/tools/releaser/upgradedep.go561
-rw-r--r--go/tools/releaser/upgradedep_test.go102
-rw-r--r--go/tools/windows-testrunner/windows-testrunner.go105
-rw-r--r--proto/BUILD.bazel166
-rw-r--r--proto/compiler.bzl229
-rw-r--r--proto/core.rst500
-rw-r--r--proto/def.bzl195
-rw-r--r--proto/gogo.bzl41
-rw-r--r--proto/wkt/BUILD.bazel204
-rw-r--r--proto/wkt/well_known_types.bzl96
-rw-r--r--tests/BUILD.bazel10
-rw-r--r--tests/README.rst55
-rw-r--r--tests/bcr/.bazelrc1
-rw-r--r--tests/bcr/.bazelversion1
-rw-r--r--tests/bcr/BUILD.bazel55
-rw-r--r--tests/bcr/MODULE.bazel42
-rw-r--r--tests/bcr/WORKSPACE0
-rwxr-xr-xtests/bcr/go_version_test.sh19
-rw-r--r--tests/bcr/lib.go5
-rw-r--r--tests/bcr/main.go11
-rw-r--r--tests/bcr/mockable.go7
-rw-r--r--tests/bcr/mockable_test.go3
-rw-r--r--tests/bcr/other_module/BUILD.bazel1
-rw-r--r--tests/bcr/other_module/MODULE.bazel9
-rw-r--r--tests/bcr/other_module/WORKSPACE0
-rw-r--r--tests/bcr/other_module/bar.txt1
-rw-r--r--tests/bcr/proto/BUILD.bazel51
-rw-r--r--tests/bcr/proto/foo.proto15
-rw-r--r--tests/bcr/proto/foo_grpc_test.go62
-rw-r--r--tests/bcr/proto/foo_proto_test.go16
-rw-r--r--tests/bcr/runfiles/BUILD.bazel9
-rw-r--r--tests/bcr/runfiles/runfiles_test.go67
-rw-r--r--tests/bcr/test.go11
-rw-r--r--tests/buildifier_test.bzl83
-rw-r--r--tests/core/README.rst35
-rw-r--r--tests/core/boringcrypto/BUILD.bazel6
-rw-r--r--tests/core/boringcrypto/README.rst11
-rw-r--r--tests/core/boringcrypto/boringcrypto_test.go115
-rw-r--r--tests/core/build_stdlib/BUILD.bazel6
-rw-r--r--tests/core/build_stdlib/README.rst11
-rw-r--r--tests/core/build_stdlib/build_stdlib_test.go97
-rw-r--r--tests/core/c_linkmodes/BUILD.bazel139
-rw-r--r--tests/core/c_linkmodes/README.rst35
-rw-r--r--tests/core/c_linkmodes/add.go11
-rw-r--r--tests/core/c_linkmodes/add_sandwich.c5
-rw-r--r--tests/core/c_linkmodes/add_sandwich.go14
-rw-r--r--tests/core/c_linkmodes/add_sandwich.h1
-rw-r--r--tests/core/c_linkmodes/add_test_archive.c11
-rw-r--r--tests/core/c_linkmodes/add_test_sandwich.c11
-rw-r--r--tests/core/c_linkmodes/add_test_shared.c11
-rw-r--r--tests/core/c_linkmodes/c-archive_empty_hdr_test.c17
-rw-r--r--tests/core/c_linkmodes/crypto.go18
-rw-r--r--tests/core/c_linkmodes/crypto_test_dl.c30
-rw-r--r--tests/core/c_linkmodes/empty.go3
-rw-r--r--tests/core/c_linkmodes/go_with_cgo_dep.go29
-rw-r--r--tests/core/c_linkmodes/go_with_cgo_dep_caller.cc20
-rw-r--r--tests/core/c_linkmodes/skip.c3
-rw-r--r--tests/core/cgo/BUILD.bazel474
-rw-r--r--tests/core/cgo/README.rst67
-rw-r--r--tests/core/cgo/add.c19
-rw-r--r--tests/core/cgo/add.cpp19
-rw-r--r--tests/core/cgo/add.h10
-rw-r--r--tests/core/cgo/add.m11
-rw-r--r--tests/core/cgo/add.mm11
-rw-r--r--tests/core/cgo/adder.go14
-rw-r--r--tests/core/cgo/adder_test.go19
-rw-r--r--tests/core/cgo/bar.cc9
-rw-r--r--tests/core/cgo/bar.go8
-rw-r--r--tests/core/cgo/cc_libs_common.go34
-rw-r--r--tests/core/cgo/cc_libs_darwin_test.go96
-rw-r--r--tests/core/cgo/cc_libs_linux_test.go93
-rw-r--r--tests/core/cgo/cgo_link_dep.c15
-rw-r--r--tests/core/cgo/cgo_link_test.go24
-rw-r--r--tests/core/cgo/cgo_ref.go20
-rw-r--r--tests/core/cgo/direct_dep.go9
-rw-r--r--tests/core/cgo/dylib_client.go10
-rw-r--r--tests/core/cgo/dylib_test.go10
-rw-r--r--tests/core/cgo/external_includes_test.go85
-rw-r--r--tests/core/cgo/foo.c7
-rw-r--r--tests/core/cgo/foo.go8
-rwxr-xr-xtests/core/cgo/generate_imported_dylib.sh26
-rw-r--r--tests/core/cgo/imported.c1
-rw-r--r--tests/core/cgo/native_dep.c5
-rw-r--r--tests/core/cgo/native_dep.h1
-rw-r--r--tests/core/cgo/objc/BUILD.bazel32
-rw-r--r--tests/core/cgo/objc/README.rst8
-rw-r--r--tests/core/cgo/objc/add_darwin.go10
-rw-r--r--tests/core/cgo/objc/add_darwin.h1
-rw-r--r--tests/core/cgo/objc/add_darwin.m22
-rw-r--r--tests/core/cgo/objc/objc_darwin_test.go16
-rw-r--r--tests/core/cgo/objc/sub.m20
-rw-r--r--tests/core/cgo/objc/sub_darwin.go10
-rw-r--r--tests/core/cgo/provide_external_symbol.go12
-rw-r--r--tests/core/cgo/pure.go3
-rw-r--r--tests/core/cgo/race_off.c3
-rw-r--r--tests/core/cgo/race_off.go5
-rw-r--r--tests/core/cgo/race_on.c3
-rw-r--r--tests/core/cgo/race_on.go5
-rw-r--r--tests/core/cgo/race_test.go31
-rw-r--r--tests/core/cgo/split_import_a.go3
-rw-r--r--tests/core/cgo/split_import_b.go10
-rw-r--r--tests/core/cgo/split_import_c.c2
-rw-r--r--tests/core/cgo/split_import_c.h6
-rw-r--r--tests/core/cgo/split_import_cgo.go10
-rw-r--r--tests/core/cgo/split_import_i_test.go9
-rw-r--r--tests/core/cgo/split_import_x_test.go13
-rw-r--r--tests/core/cgo/tag_cgo.go10
-rw-r--r--tests/core/cgo/tag_cgo_err.go6
-rw-r--r--tests/core/cgo/tag_pure.go9
-rw-r--r--tests/core/cgo/tag_pure_err.c1
-rw-r--r--tests/core/cgo/tag_pure_err.go6
-rw-r--r--tests/core/cgo/tag_test.go38
-rw-r--r--tests/core/cgo/transitive_dep.go10
-rw-r--r--tests/core/cgo/use_c_symbol_through_go.c5
-rw-r--r--tests/core/cgo/use_external_symbol.go10
-rw-r--r--tests/core/cgo/use_transitive_symbol.go14
-rw-r--r--tests/core/coverage/BUILD.bazel34
-rw-r--r--tests/core/coverage/README.rst23
-rw-r--r--tests/core/coverage/binary_coverage_test.go75
-rw-r--r--tests/core/coverage/coverage_test.go265
-rw-r--r--tests/core/coverage/issue3017_test.go80
-rw-r--r--tests/core/coverage/lcov_coverage_test.go290
-rw-r--r--tests/core/coverage/lcov_test_main_coverage_test.go122
-rw-r--r--tests/core/cross/BUILD.bazel143
-rw-r--r--tests/core/cross/README.rst62
-rw-r--r--tests/core/cross/asm.s15
-rw-r--r--tests/core/cross/cross_test.go91
-rw-r--r--tests/core/cross/def.bzl24
-rw-r--r--tests/core/cross/ios_select_test.go66
-rw-r--r--tests/core/cross/lib_darwin.go3
-rw-r--r--tests/core/cross/lib_linux.go3
-rw-r--r--tests/core/cross/lib_windows.go3
-rw-r--r--tests/core/cross/main.go26
-rw-r--r--tests/core/cross/non_executable_test.go106
-rw-r--r--tests/core/cross/proto_test.go126
-rw-r--r--tests/core/cross/sdk_version_test.go135
-rw-r--r--tests/core/go_bazel_test/BUILD.bazel9
-rw-r--r--tests/core/go_bazel_test/README.rst10
-rw-r--r--tests/core/go_bazel_test/dataargtest_test.go69
-rw-r--r--tests/core/go_binary/BUILD.bazel193
-rw-r--r--tests/core/go_binary/README.rst70
-rw-r--r--tests/core/go_binary/broken_cgo.go7
-rw-r--r--tests/core/go_binary/configurable_attribute_bad_test.go69
-rw-r--r--tests/core/go_binary/configurable_attribute_good_test.go92
-rw-r--r--tests/core/go_binary/custom_bin.go4
-rw-r--r--tests/core/go_binary/hello.go7
-rw-r--r--tests/core/go_binary/many_deps.bzl92
-rw-r--r--tests/core/go_binary/non_executable_test.go87
-rw-r--r--tests/core/go_binary/out_test.go13
-rw-r--r--tests/core/go_binary/package_conflict_test.go120
-rw-r--r--tests/core/go_binary/pie_darwin_amd64_test.go31
-rw-r--r--tests/core/go_binary/pie_darwin_test.go35
-rw-r--r--tests/core/go_binary/pie_linux_test.go48
-rw-r--r--tests/core/go_binary/prefix/BUILD.bazel8
-rw-r--r--tests/core/go_binary/prefix/prefix.go3
-rw-r--r--tests/core/go_binary/stamp_bin.go16
-rw-r--r--tests/core/go_binary/stamp_dep.go6
-rw-r--r--tests/core/go_binary/stamp_embed.go3
-rw-r--r--tests/core/go_binary/stamp_test.go29
-rw-r--r--tests/core/go_binary/static_bin.go7
-rw-r--r--tests/core/go_binary/static_cgo_bin.go14
-rw-r--r--tests/core/go_binary/static_pure_bin.go8
-rw-r--r--tests/core/go_binary/static_test.go45
-rw-r--r--tests/core/go_binary/tags_lib_bad.go5
-rw-r--r--tests/core/go_binary/tags_lib_good.go1
-rw-r--r--tests/core/go_binary/tags_main_bad.go5
-rw-r--r--tests/core/go_binary/tags_main_good.go8
-rw-r--r--tests/core/go_download_sdk/BUILD.bazel6
-rw-r--r--tests/core/go_download_sdk/README.rst7
-rw-r--r--tests/core/go_download_sdk/go_download_sdk_test.go187
-rw-r--r--tests/core/go_library/BUILD.bazel168
-rw-r--r--tests/core/go_library/README.rst57
-rw-r--r--tests/core/go_library/def.bzl22
-rw-r--r--tests/core/go_library/embedsrcs_error_test.go138
-rw-r--r--tests/core/go_library/embedsrcs_gen_test.go.in20
-rw-r--r--tests/core/go_library/embedsrcs_simple_test.go6
-rw-r--r--tests/core/go_library/embedsrcs_static/contains_hidden/.hidden0
-rw-r--r--tests/core/go_library/embedsrcs_static/contains_hidden/.hidden_dir/.env0
-rw-r--r--tests/core/go_library/embedsrcs_static/contains_hidden/.hidden_dir/visible_file0
-rw-r--r--tests/core/go_library/embedsrcs_static/contains_hidden/_hidden_dir/.bashrc0
-rw-r--r--tests/core/go_library/embedsrcs_static/contains_hidden/_hidden_dir/_hidden_file0
-rw-r--r--tests/core/go_library/embedsrcs_static/contains_hidden/_hidden_dir/visible_file0
-rw-r--r--tests/core/go_library/embedsrcs_static/contains_hidden/visible/.bzr/file-under-version-control0
-rw-r--r--tests/core/go_library/embedsrcs_static/contains_hidden/visible/visible_file0
-rw-r--r--tests/core/go_library/embedsrcs_static/dir/_no0
-rw-r--r--tests/core/go_library/embedsrcs_static/dir/f0
-rw-r--r--tests/core/go_library/embedsrcs_static/file0
-rw-r--r--tests/core/go_library/embedsrcs_static/glob/_hidden0
-rw-r--r--tests/core/go_library/embedsrcs_static/glob/f0
-rw-r--r--tests/core/go_library/embedsrcs_static/no0
-rw-r--r--tests/core/go_library/embedsrcs_test.go199
-rw-r--r--tests/core/go_library/empty_bar.go3
-rw-r--r--tests/core/go_library/empty_baz.s1
-rw-r--r--tests/core/go_library/empty_foo.go3
-rw-r--r--tests/core/go_library/empty_main.go3
-rw-r--r--tests/core/go_library/gen_embedsrcs_files.go51
-rw-r--r--tests/core/go_library/import_alias_a_v2.go17
-rw-r--r--tests/core/go_library/import_alias_b.go17
-rw-r--r--tests/core/go_library/import_alias_test.go33
-rw-r--r--tests/core/go_library/inc.go1
-rw-r--r--tests/core/go_library/inc_asmhdr.s1
-rw-r--r--tests/core/go_library/inc_bar.s1
-rw-r--r--tests/core/go_library/inc_foo.s0
-rw-r--r--tests/core/go_library/no_srcs_test.go78
-rw-r--r--tests/core/go_library/package_height.go6
-rw-r--r--tests/core/go_library/package_height_dep_deep.go7
-rw-r--r--tests/core/go_library/package_height_dep_shallow.go3
-rw-r--r--tests/core/go_library/package_height_embeddee.go7
-rw-r--r--tests/core/go_library/package_height_embedder.go3
-rw-r--r--tests/core/go_path/BUILD.bazel81
-rw-r--r--tests/core/go_path/README.rst12
-rw-r--r--tests/core/go_path/cmd/bin/BUILD.bazel30
-rw-r--r--tests/core/go_path/cmd/bin/bin.go4
-rw-r--r--tests/core/go_path/extra.txt0
-rw-r--r--tests/core/go_path/go_path_test.go205
-rw-r--r--tests/core/go_path/pkg/lib/BUILD.bazel80
-rw-r--r--tests/core/go_path/pkg/lib/data.txt0
-rw-r--r--tests/core/go_path/pkg/lib/embed_test.go1
-rw-r--r--tests/core/go_path/pkg/lib/embedded_src.txt1
-rw-r--r--tests/core/go_path/pkg/lib/external_test.go1
-rw-r--r--tests/core/go_path/pkg/lib/generated_embeded.bzl71
-rw-r--r--tests/core/go_path/pkg/lib/internal_test.go1
-rw-r--r--tests/core/go_path/pkg/lib/lib.go15
-rw-r--r--tests/core/go_path/pkg/lib/template/index.html.tmpl1
-rw-r--r--tests/core/go_path/pkg/lib/testdata/testdata.txt0
-rw-r--r--tests/core/go_path/pkg/lib/transitive.go5
-rw-r--r--tests/core/go_path/pkg/lib/vendored.go1
-rw-r--r--tests/core/go_plugin/BUILD.bazel16
-rw-r--r--tests/core/go_plugin/README.rst16
-rw-r--r--tests/core/go_plugin/all_test.go33
-rw-r--r--tests/core/go_plugin/plugin.go7
-rw-r--r--tests/core/go_plugin_with_proto_library/BUILD.bazel31
-rw-r--r--tests/core/go_plugin_with_proto_library/README.rst16
-rw-r--r--tests/core/go_plugin_with_proto_library/all_test.go36
-rw-r--r--tests/core/go_plugin_with_proto_library/plugin.go7
-rw-r--r--tests/core/go_plugin_with_proto_library/validate.proto6
-rw-r--r--tests/core/go_proto_library/BUILD.bazel314
-rw-r--r--tests/core/go_proto_library/README.rst65
-rw-r--r--tests/core/go_proto_library/adjusted_a.proto11
-rw-r--r--tests/core/go_proto_library/adjusted_b.proto9
-rw-r--r--tests/core/go_proto_library/adjusted_c.proto7
-rw-r--r--tests/core/go_proto_library/adjusted_import_test.go31
-rw-r--r--tests/core/go_proto_library/bar.proto10
-rw-r--r--tests/core/go_proto_library/embed_test.go45
-rw-r--r--tests/core/go_proto_library/extra.go5
-rw-r--r--tests/core/go_proto_library/foo.proto8
-rw-r--r--tests/core/go_proto_library/gofast_grpc_test.go32
-rw-r--r--tests/core/go_proto_library/gofast_test.go30
-rw-r--r--tests/core/go_proto_library/gogofast_grpc_test.go32
-rw-r--r--tests/core/go_proto_library/gogofast_test.go30
-rw-r--r--tests/core/go_proto_library/grpc.proto14
-rw-r--r--tests/core/go_proto_library/no_go_package.proto7
-rw-r--r--tests/core/go_proto_library/proto_package_test.go28
-rw-r--r--tests/core/go_proto_library/protos_a.proto7
-rw-r--r--tests/core/go_proto_library/protos_alias_test.go29
-rw-r--r--tests/core/go_proto_library/protos_b.proto7
-rw-r--r--tests/core/go_proto_library/protos_test.go30
-rw-r--r--tests/core/go_proto_library/proxy_a.proto7
-rw-r--r--tests/core/go_proto_library/proxy_b.proto7
-rw-r--r--tests/core/go_proto_library/proxy_test.go30
-rw-r--r--tests/core/go_proto_library/transitive_test.go30
-rw-r--r--tests/core/go_proto_library/wkt_wrapper_test.go67
-rw-r--r--tests/core/go_proto_library_importmap/BUILD.bazel21
-rw-r--r--tests/core/go_proto_library_importmap/README.rst8
-rw-r--r--tests/core/go_proto_library_importmap/foo.proto6
-rw-r--r--tests/core/go_proto_library_importmap/importmap_test.go16
-rw-r--r--tests/core/go_test/BUILD.bazel261
-rw-r--r--tests/core/go_test/README.rst126
-rw-r--r--tests/core/go_test/binary_env_test.go55
-rw-r--r--tests/core/go_test/data_test.go45
-rw-r--r--tests/core/go_test/data_test_dep.go15
-rw-r--r--tests/core/go_test/data_test_embed.go15
-rw-r--r--tests/core/go_test/env_inherit_test.go61
-rw-r--r--tests/core/go_test/env_test.go39
-rw-r--r--tests/core/go_test/example_test.go32
-rw-r--r--tests/core/go_test/external_importmap_dep.go11
-rw-r--r--tests/core/go_test/external_importmap_lib.go5
-rw-r--r--tests/core/go_test/external_importmap_test.go10
-rw-r--r--tests/core/go_test/external_test.go29
-rw-r--r--tests/core/go_test/flag_test.go30
-rw-r--r--tests/core/go_test/fuzz_test.go29
-rw-r--r--tests/core/go_test/indirect_import_dep.go7
-rw-r--r--tests/core/go_test/indirect_import_i_test.go7
-rw-r--r--tests/core/go_test/indirect_import_lib.go3
-rw-r--r--tests/core/go_test/indirect_import_x_test.go15
-rw-r--r--tests/core/go_test/internal_test.go28
-rw-r--r--tests/core/go_test/lib.go20
-rw-r--r--tests/core/go_test/only_testmain_test.go10
-rw-r--r--tests/core/go_test/pwd_test.go16
-rw-r--r--tests/core/go_test/same_package_test.go7
-rw-r--r--tests/core/go_test/sharding_test.go13
-rw-r--r--tests/core/go_test/tags_bad_test.go9
-rw-r--r--tests/core/go_test/tags_good_test.go7
-rw-r--r--tests/core/go_test/test_fail_fast_test.go75
-rw-r--r--tests/core/go_test/test_filter_test.go54
-rw-r--r--tests/core/go_test/testmain_import_indirect_test.go7
-rw-r--r--tests/core/go_test/testmain_import_main_test.go11
-rw-r--r--tests/core/go_test/testmain_without_exit_test.go59
-rw-r--r--tests/core/go_test/wrapped_test.go19
-rw-r--r--tests/core/go_test/wrapper_test.go46
-rw-r--r--tests/core/go_test/x0
-rw-r--r--tests/core/go_test/x_defs/BUILD.bazel73
-rw-r--r--tests/core/go_test/x_defs/bar.go10
-rw-r--r--tests/core/go_test/x_defs/baz.go6
-rw-r--r--tests/core/go_test/x_defs/foo.go1
-rw-r--r--tests/core/go_test/x_defs/foo_test.go28
-rw-r--r--tests/core/go_test/x_defs/qux.go3
-rw-r--r--tests/core/go_test/x_defs/x_defs_lib.go3
-rw-r--r--tests/core/go_test/x_defs/x_defs_test.go34
-rw-r--r--tests/core/go_test/xmlreport_test.go163
-rw-r--r--tests/core/go_test/y0
-rw-r--r--tests/core/go_test/z0
-rw-r--r--tests/core/importmap/BUILD.bazel45
-rw-r--r--tests/core/importmap/README.rst16
-rw-r--r--tests/core/importmap/import.go24
-rw-r--r--tests/core/importmap/importmap_test.go31
-rw-r--r--tests/core/importmap/lib.go18
-rw-r--r--tests/core/nogo/BUILD.bazel5
-rw-r--r--tests/core/nogo/README.rst18
-rw-r--r--tests/core/nogo/common.bzl38
-rw-r--r--tests/core/nogo/config/BUILD.bazel6
-rw-r--r--tests/core/nogo/config/README.rst17
-rw-r--r--tests/core/nogo/config/config_test.go62
-rw-r--r--tests/core/nogo/coverage/BUILD.bazel11
-rw-r--r--tests/core/nogo/coverage/README.rst23
-rw-r--r--tests/core/nogo/coverage/coverage_test.go65
-rw-r--r--tests/core/nogo/coverage/gen_code_test.go130
-rw-r--r--tests/core/nogo/custom/BUILD.bazel6
-rw-r--r--tests/core/nogo/custom/README.rst16
-rw-r--r--tests/core/nogo/custom/custom_test.go510
-rw-r--r--tests/core/nogo/custom/flags/BUILD.bazel6
-rw-r--r--tests/core/nogo/custom/flags/README.rst19
-rw-r--r--tests/core/nogo/custom/flags/flags_test.go262
-rw-r--r--tests/core/nogo/deps/BUILD.bazel6
-rw-r--r--tests/core/nogo/deps/README.rst26
-rw-r--r--tests/core/nogo/deps/deps_test.go211
-rw-r--r--tests/core/nogo/generate/BUILD.bazel6
-rw-r--r--tests/core/nogo/generate/README.rst12
-rw-r--r--tests/core/nogo/generate/empty_test.go102
-rw-r--r--tests/core/nogo/generics/BUILD.bazel6
-rw-r--r--tests/core/nogo/generics/README.rst18
-rw-r--r--tests/core/nogo/generics/generics_test.go85
-rw-r--r--tests/core/nogo/nolint/BUILD.bazel6
-rw-r--r--tests/core/nogo/nolint/README.rst14
-rw-r--r--tests/core/nogo/nolint/nolint_test.go227
-rw-r--r--tests/core/nogo/vet/BUILD.bazel6
-rw-r--r--tests/core/nogo/vet/README.rst14
-rw-r--r--tests/core/nogo/vet/vet_test.go179
-rw-r--r--tests/core/output_groups/BUILD.bazel36
-rw-r--r--tests/core/output_groups/README.rst10
-rw-r--r--tests/core/output_groups/bin.go3
-rw-r--r--tests/core/output_groups/compilation_outputs_test.go59
-rw-r--r--tests/core/output_groups/lib.go1
-rw-r--r--tests/core/output_groups/lib_test.go1
-rw-r--r--tests/core/race/BUILD.bazel6
-rw-r--r--tests/core/race/README.rst10
-rw-r--r--tests/core/race/race_test.go302
-rw-r--r--tests/core/runfiles/BUILD.bazel48
-rw-r--r--tests/core/runfiles/README.rst23
-rw-r--r--tests/core/runfiles/bin.go17
-rw-r--r--tests/core/runfiles/check_runfiles.go121
-rw-r--r--tests/core/runfiles/empty_bin.go3
-rw-r--r--tests/core/runfiles/local_file.txt0
-rw-r--r--tests/core/runfiles/local_group.txt0
-rw-r--r--tests/core/runfiles/runfiles_cmd.go28
-rw-r--r--tests/core/runfiles/runfiles_remote_test/BUILD.bazel27
-rw-r--r--tests/core/runfiles/runfiles_remote_test/WORKSPACE1
-rw-r--r--tests/core/runfiles/runfiles_remote_test/remote_file.txt0
-rw-r--r--tests/core/runfiles/runfiles_remote_test/remote_group.txt0
-rw-r--r--tests/core/runfiles/runfiles_test.go27
-rw-r--r--tests/core/starlark/BUILD.bazel6
-rw-r--r--tests/core/starlark/README.rst9
-rw-r--r--tests/core/starlark/common_tests.bzl53
-rw-r--r--tests/core/starlark/packagedriver/BUILD.bazel5
-rw-r--r--tests/core/starlark/packagedriver/fixtures/a/BUILD.bazel8
-rw-r--r--tests/core/starlark/packagedriver/fixtures/a/a.go5
-rw-r--r--tests/core/starlark/packagedriver/fixtures/b/BUILD.bazel8
-rw-r--r--tests/core/starlark/packagedriver/fixtures/b/b.go5
-rw-r--r--tests/core/starlark/packagedriver/fixtures/c/BUILD.bazel20
-rw-r--r--tests/core/starlark/packagedriver/fixtures/c/c.go11
-rw-r--r--tests/core/starlark/packagedriver/fixtures/c/c_test.go9
-rw-r--r--tests/core/starlark/packagedriver/go_pkg_info_aspect_test.bzl32
-rw-r--r--tests/core/starlark/sdk_tests.bzl86
-rw-r--r--tests/core/stdlib/BUILD.bazel11
-rw-r--r--tests/core/stdlib/README.rst13
-rw-r--r--tests/core/stdlib/buildid_test.go93
-rwxr-xr-xtests/core/stdlib/reproduce_test.sh23
-rw-r--r--tests/core/stdlib/stdlib_files.bzl49
-rw-r--r--tests/core/strip/BUILD.bazel6
-rw-r--r--tests/core/strip/README.rst13
-rw-r--r--tests/core/strip/strip_test.go270
-rw-r--r--tests/core/transition/BUILD.bazel13
-rw-r--r--tests/core/transition/README.rst18
-rw-r--r--tests/core/transition/cmdline_test.go84
-rw-r--r--tests/core/transition/hermeticity_test.go289
-rw-r--r--tests/examples/README.rst14
-rw-r--r--tests/examples/executable_name/BUILD.bazel20
-rw-r--r--tests/examples/executable_name/README.rst10
-rw-r--r--tests/examples/executable_name/main.go24
-rwxr-xr-xtests/examples/executable_name/name_test.sh6
-rw-r--r--tests/extras/go_embed_data/BUILD.bazel107
-rw-r--r--tests/extras/go_embed_data/README.rst11
-rw-r--r--tests/extras/go_embed_data/embed_test.go131
-rw-r--r--tests/extras/go_embed_data/error.c1
-rw-r--r--tests/extras/gomock/BUILD.bazel33
-rw-r--r--tests/extras/gomock/client.go10
-rw-r--r--tests/extras/gomock/client_test.go3
-rw-r--r--tests/grpc_repos.bzl38
-rw-r--r--tests/integration/README.rst23
-rw-r--r--tests/integration/gazelle/BUILD.bazel11
-rw-r--r--tests/integration/gazelle/README.rst9
-rw-r--r--tests/integration/gazelle/gazelle_test.go74
-rw-r--r--tests/integration/go_bin_runner/BUILD.bazel6
-rw-r--r--tests/integration/go_bin_runner/go_bin_runner_test.go107
-rw-r--r--tests/integration/googleapis/BUILD.bazel46
-rw-r--r--tests/integration/googleapis/README.rst8
-rw-r--r--tests/integration/googleapis/color_service.go49
-rw-r--r--tests/integration/googleapis/color_service.proto45
-rw-r--r--tests/integration/googleapis/color_service_test.go63
-rw-r--r--tests/integration/popular_repos/BUILD.bazel345
-rw-r--r--tests/integration/popular_repos/README.rst234
-rw-r--r--tests/integration/popular_repos/popular_repos.bzl75
-rwxr-xr-xtests/integration/popular_repos/popular_repos.py336
-rw-r--r--tests/integration/reproducibility/BUILD.bazel6
-rw-r--r--tests/integration/reproducibility/README.rst14
-rw-r--r--tests/integration/reproducibility/reproducibility_test.go384
-rw-r--r--tests/legacy/README.rst10
-rw-r--r--tests/legacy/asm_include/BUILD.bazel42
-rw-r--r--tests/legacy/asm_include/foo_amd64.go3
-rw-r--r--tests/legacy/asm_include/foo_amd64.h1
-rw-r--r--tests/legacy/asm_include/foo_amd64.s5
-rw-r--r--tests/legacy/asm_include/foo_other.go7
-rw-r--r--tests/legacy/asm_include/foo_test.go10
-rw-r--r--tests/legacy/binary_test_outputs/BUILD.bazel30
-rw-r--r--tests/legacy/binary_test_outputs/bin.go3
-rw-r--r--tests/legacy/binary_test_outputs/test.go1
-rw-r--r--tests/legacy/build_constraints/BUILD.bazel40
-rw-r--r--tests/legacy/build_constraints/asm_arm64.s20
-rw-r--r--tests/legacy/build_constraints/asm_linux_amd64.s3
-rw-r--r--tests/legacy/build_constraints/asm_unknown.s5
-rw-r--r--tests/legacy/build_constraints/build_constraints_test.go55
-rw-r--r--tests/legacy/build_constraints/cgo_group_linux.c1
-rw-r--r--tests/legacy/build_constraints/cgo_group_unknown.c3
-rw-r--r--tests/legacy/build_constraints/cgo_linux.c1
-rw-r--r--tests/legacy/build_constraints/cgo_linux.go12
-rw-r--r--tests/legacy/build_constraints/cgo_unknown.c3
-rw-r--r--tests/legacy/build_constraints/cgo_unknown.go14
-rw-r--r--tests/legacy/build_constraints/suffix_linux.go3
-rw-r--r--tests/legacy/build_constraints/suffix_unknown.go5
-rw-r--r--tests/legacy/build_constraints/tag_l.go5
-rw-r--r--tests/legacy/build_constraints/tag_unknown.go5
-rw-r--r--tests/legacy/cgo_filtered/BUILD.bazel15
-rw-r--r--tests/legacy/cgo_filtered/pure.go3
-rw-r--r--tests/legacy/cgo_filtered/pure_test.go9
-rw-r--r--tests/legacy/cgo_multi_dir/BUILD.bazel22
-rw-r--r--tests/legacy/cgo_multi_dir/bar/bar.go6
-rw-r--r--tests/legacy/cgo_multi_dir/cgo_multi_dir_test.go9
-rw-r--r--tests/legacy/cgo_multi_dir/foo/foo.go6
-rw-r--r--tests/legacy/cgo_opts/BUILD.bazel16
-rw-r--r--tests/legacy/cgo_opts/cgo_opts.go9
-rw-r--r--tests/legacy/cgo_opts/cgo_opts_test.go9
-rw-r--r--tests/legacy/cgo_pthread_flag/BUILD.bazel15
-rw-r--r--tests/legacy/cgo_pthread_flag/cgo_pthread_flag.go25
-rw-r--r--tests/legacy/cgo_pthread_flag/cgo_pthread_flag_test.go12
-rw-r--r--tests/legacy/cgo_pure/BUILD.bazel34
-rw-r--r--tests/legacy/cgo_pure/cgo.c1
-rw-r--r--tests/legacy/cgo_pure/cgo.go10
-rw-r--r--tests/legacy/cgo_pure/cgo_no_tag.go8
-rw-r--r--tests/legacy/cgo_pure/cgo_pure_test.go17
-rw-r--r--tests/legacy/cgo_pure/pure.go5
-rw-r--r--tests/legacy/cgo_select/BUILD.bazel57
-rw-r--r--tests/legacy/cgo_select/cgo_darwin.go8
-rw-r--r--tests/legacy/cgo_select/cgo_linux.go8
-rw-r--r--tests/legacy/cgo_select/cgo_select_test.go12
-rw-r--r--tests/legacy/cgo_select/cgo_windows.go8
-rw-r--r--tests/legacy/cgo_select/darwin.c1
-rw-r--r--tests/legacy/cgo_select/linux.c1
-rw-r--r--tests/legacy/cgo_select/windows.c1
-rw-r--r--tests/legacy/cgo_sys_hdr/BUILD.bazel18
-rw-r--r--tests/legacy/cgo_sys_hdr/foo.go8
-rw-r--r--tests/legacy/cgo_sys_hdr/foo_test.go9
-rw-r--r--tests/legacy/cgo_sys_hdr/sub/foo.h1
-rw-r--r--tests/legacy/cgo_trans_deps/BUILD.bazel16
-rw-r--r--tests/legacy/cgo_trans_deps/cgo_lib.go5
-rw-r--r--tests/legacy/cgo_trans_deps/cgo_test.go13
-rw-r--r--tests/legacy/cgo_trans_deps/dep/BUILD.bazel8
-rw-r--r--tests/legacy/cgo_trans_deps/dep/dep.go3
-rw-r--r--tests/legacy/empty_package/BUILD.bazel43
-rw-r--r--tests/legacy/empty_package/cgo.c1
-rw-r--r--tests/legacy/empty_package/cgo.go8
-rw-r--r--tests/legacy/empty_package/empty_package_test.go17
-rw-r--r--tests/legacy/empty_package/mixed_cgo.go10
-rw-r--r--tests/legacy/empty_package/mixed_pure.go5
-rw-r--r--tests/legacy/examples/bin/BUILD.bazel17
-rw-r--r--tests/legacy/examples/bin/bin.go34
-rw-r--r--tests/legacy/examples/bindata/BUILD.bazel22
-rw-r--r--tests/legacy/examples/bindata/bindata_test.go33
-rw-r--r--tests/legacy/examples/bindata/data/message.txt1
-rw-r--r--tests/legacy/examples/cgo/BUILD.bazel51
-rw-r--r--tests/legacy/examples/cgo/cc_dependency/BUILD.bazel29
-rw-r--r--tests/legacy/examples/cgo/cc_dependency/c_version.c15
-rw-r--r--tests/legacy/examples/cgo/cc_dependency/c_version.h5
-rw-r--r--tests/legacy/examples/cgo/cc_dependency/cxx_version.cc30
-rw-r--r--tests/legacy/examples/cgo/cc_dependency/version.h10
-rw-r--r--tests/legacy/examples/cgo/cgo_lib_test.go15
-rw-r--r--tests/legacy/examples/cgo/example_command/BUILD.bazel26
-rw-r--r--tests/legacy/examples/cgo/example_command/generate_test.bzl17
-rw-r--r--tests/legacy/examples/cgo/example_command/main.go13
-rw-r--r--tests/legacy/examples/cgo/export_example.go11
-rw-r--r--tests/legacy/examples/cgo/generated.go.tpl13
-rw-r--r--tests/legacy/examples/cgo/import_example.go29
-rw-r--r--tests/legacy/examples/cgo/pure_go.go5
-rw-r--r--tests/legacy/examples/cgo/skip_go_library/BUILD.bazel13
-rw-r--r--tests/legacy/examples/cgo/skip_go_library/cgo_foo.go8
-rw-r--r--tests/legacy/examples/cgo/skip_go_library/types.go3
-rw-r--r--tests/legacy/examples/cgo/sub/floor.go13
-rw-r--r--tests/legacy/examples/cgo/use_exported.c8
-rw-r--r--tests/legacy/examples/cgo/use_exported.h6
-rw-r--r--tests/legacy/examples/external/BUILD.bazel11
-rw-r--r--tests/legacy/examples/external/main.go31
-rw-r--r--tests/legacy/examples/lib/BUILD.bazel46
-rw-r--r--tests/legacy/examples/lib/add_amd64.s8
-rw-r--r--tests/legacy/examples/lib/add_arm64.s20
-rw-r--r--tests/legacy/examples/lib/asm.go14
-rw-r--r--tests/legacy/examples/lib/deep/BUILD.bazel12
-rw-r--r--tests/legacy/examples/lib/deep/doc.go3
-rw-r--r--tests/legacy/examples/lib/deep/thought.go6
-rw-r--r--tests/legacy/examples/lib/lib.go41
-rw-r--r--tests/legacy/examples/lib/lib_test.go30
-rw-r--r--tests/legacy/examples/lib/lib_x_test.go52
-rw-r--r--tests/legacy/examples/lib/sub_amd64.s8
-rw-r--r--tests/legacy/examples/lib/sub_arm64.s20
-rw-r--r--tests/legacy/examples/monobuild/cmd/BUILD.bazel14
-rw-r--r--tests/legacy/examples/monobuild/cmd/mycmd.go28
-rw-r--r--tests/legacy/examples/monobuild/lib1/BUILD.bazel11
-rw-r--r--tests/legacy/examples/monobuild/lib1/lib1.go20
-rw-r--r--tests/legacy/examples/monobuild/lib2/BUILD.bazel11
-rw-r--r--tests/legacy/examples/monobuild/lib2/lib2.go20
-rw-r--r--tests/legacy/examples/proto/BUILD.bazel34
-rw-r--r--tests/legacy/examples/proto/dep/BUILD.bazel18
-rw-r--r--tests/legacy/examples/proto/dep/useful.proto11
-rw-r--r--tests/legacy/examples/proto/embed/BUILD.bazel28
-rw-r--r--tests/legacy/examples/proto/embed/embed.go7
-rw-r--r--tests/legacy/examples/proto/embed/embed.proto9
-rw-r--r--tests/legacy/examples/proto/gogo/BUILD.bazel29
-rw-r--r--tests/legacy/examples/proto/gogo/gogo_test.go25
-rw-r--r--tests/legacy/examples/proto/gogo/values.proto14
-rw-r--r--tests/legacy/examples/proto/gostyle/BUILD.bazel25
-rw-r--r--tests/legacy/examples/proto/gostyle/gostyle.proto12
-rw-r--r--tests/legacy/examples/proto/grpc/BUILD.bazel44
-rw-r--r--tests/legacy/examples/proto/grpc/main.go33
-rw-r--r--tests/legacy/examples/proto/grpc/my_svc.proto18
-rw-r--r--tests/legacy/examples/proto/gs.go22
-rw-r--r--tests/legacy/examples/proto/lib/BUILD.bazel24
-rw-r--r--tests/legacy/examples/proto/lib/lib.proto12
-rw-r--r--tests/legacy/examples/proto/lib/lib2.proto14
-rw-r--r--tests/legacy/examples/proto/proto_test.go43
-rw-r--r--tests/legacy/examples/stamped_bin/BUILD.bazel6
-rw-r--r--tests/legacy/examples/stamped_bin/stamped_test.go122
-rw-r--r--tests/legacy/examples/vendor/github.com/user/vendored/BUILD.bazel13
-rw-r--r--tests/legacy/examples/vendor/github.com/user/vendored/vendored.go21
-rw-r--r--tests/legacy/extldflags_rpath/BUILD.bazel22
-rw-r--r--tests/legacy/extldflags_rpath/README.md15
-rwxr-xr-xtests/legacy/extldflags_rpath/extldflags_rpath_test.sh27
-rw-r--r--tests/legacy/extldflags_rpath/main.go3
-rw-r--r--tests/legacy/info/BUILD.bazel6
-rwxr-xr-xtests/legacy/info/info_test.sh9
-rw-r--r--tests/legacy/no_prefix/BUILD.bazel6
-rw-r--r--tests/legacy/no_prefix/no_prefix_test.go70
-rw-r--r--tests/legacy/package_named_build/build/BUILD.bazel16
-rw-r--r--tests/legacy/package_named_build/build/build.go3
-rw-r--r--tests/legacy/package_named_build/build/build_test.go13
-rw-r--r--tests/legacy/proto_ignore_go_package_option/BUILD.bazel34
-rw-r--r--tests/legacy/proto_ignore_go_package_option/a.proto15
-rw-r--r--tests/legacy/proto_ignore_go_package_option/b.proto16
-rw-r--r--tests/legacy/providers/BUILD.bazel22
-rw-r--r--tests/legacy/providers/test.bzl14
-rw-r--r--tests/legacy/providers/test.go0
-rwxr-xr-xtests/legacy/providers/test.sh3
-rw-r--r--tests/legacy/slash_names/BUILD.bazel27
-rw-r--r--tests/legacy/slash_names/a/pkg/pkg.go5
-rw-r--r--tests/legacy/slash_names/b/pkg/pkg.go5
-rw-r--r--tests/legacy/slash_names/slash_test.go17
-rw-r--r--tests/legacy/test_build_constraints/BUILD.bazel25
-rw-r--r--tests/legacy/test_build_constraints/bar_l_test.go14
-rw-r--r--tests/legacy/test_build_constraints/bar_unknown_test.go14
-rw-r--r--tests/legacy/test_build_constraints/baz_linux_test.go12
-rw-r--r--tests/legacy/test_build_constraints/baz_unknown_test.go14
-rw-r--r--tests/legacy/test_build_constraints/foo_linux_test.go12
-rw-r--r--tests/legacy/test_build_constraints/foo_unknown_test.go14
-rw-r--r--tests/legacy/test_chdir/BUILD.bazel13
-rw-r--r--tests/legacy/test_chdir/data.txt0
-rw-r--r--tests/legacy/test_chdir/data_test.go31
-rw-r--r--tests/legacy/test_chdir/remote.bzl14
-rw-r--r--tests/legacy/test_rundir/BUILD.bazel9
-rw-r--r--tests/legacy/test_rundir/rundir_test.go12
-rw-r--r--tests/legacy/transitive_data/BUILD.bazel34
-rw-r--r--tests/legacy/transitive_data/c_data.txt0
-rw-r--r--tests/legacy/transitive_data/cgo_data.txt0
-rw-r--r--tests/legacy/transitive_data/empty.go1
-rw-r--r--tests/legacy/transitive_data/empty_cgo.go3
-rw-r--r--tests/legacy/transitive_data/go_data.txt0
-rw-r--r--tests/legacy/transitive_data/transitive_data_test.go20
-rw-r--r--tests/legacy/visibility/BUILD.bazel15
-rw-r--r--tests/legacy/visibility/foo.go3
-rw-r--r--tests/runfiles/BUILD.bazel42
-rw-r--r--tests/runfiles/fs_test.go121
-rw-r--r--tests/runfiles/runfiles_bazel_test.go168
-rw-r--r--tests/runfiles/runfiles_test.go149
-rw-r--r--tests/runfiles/test.txt1
-rw-r--r--tests/runfiles/testprog/BUILD.bazel30
-rw-r--r--tests/runfiles/testprog/main.go34
-rwxr-xr-xtests/update.py75
-rw-r--r--third_party/BUILD.bazel8
-rw-r--r--third_party/README.txt11
-rw-r--r--third_party/com_github_gogo_protobuf-gazelle.patch6449
-rw-r--r--third_party/com_github_golang_mock-gazelle.patch1155
-rw-r--r--third_party/com_github_golang_protobuf-gazelle.patch653
-rw-r--r--third_party/com_github_kevinburke_go_bindata-gazelle.patch95
-rw-r--r--third_party/go_googleapis-deletebuild.patch137372
-rw-r--r--third_party/go_googleapis-directives.patch15
-rw-r--r--third_party/go_googleapis-gazelle.patch17342
-rw-r--r--third_party/org_golang_google_genproto-gazelle.patch12231
-rw-r--r--third_party/org_golang_google_protobuf-gazelle.patch3731
-rw-r--r--third_party/org_golang_x_sys-gazelle.patch802
-rw-r--r--third_party/org_golang_x_tools-deletegopls.patch127069
-rw-r--r--third_party/org_golang_x_tools-gazelle.patch10622
-rw-r--r--third_party/org_golang_x_xerrors-gazelle.patch62
-rw-r--r--third_party/sanitize_patch_dates.go84
-rwxr-xr-xtools/gopackagesdriver.sh2
-rw-r--r--windows.rst136
864 files changed, 372712 insertions, 0 deletions
diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml
new file mode 100644
index 00000000..80a461bd
--- /dev/null
+++ b/.bazelci/presubmit.yml
@@ -0,0 +1,377 @@
+---
+matrix:
+ platform:
+ - ubuntu2004
+ - macos
+ - windows
+
+tasks:
+ ubuntu1804_bazel400:
+ platform: ubuntu1804
+ bazel: 5.4.0 # test minimum supported version of bazel
+ shell_commands:
+ - tests/core/cgo/generate_imported_dylib.sh
+ build_targets:
+ - "//..."
+ test_targets:
+ - "//..."
+ ubuntu2004:
+ # enable some unflipped incompatible flags on this platform to ensure we don't regress.
+ shell_commands:
+ - tests/core/cgo/generate_imported_dylib.sh
+ build_flags:
+ - "--config=incompatible"
+ test_flags:
+ - "--config=incompatible"
+ build_targets:
+ - "//..."
+ test_targets:
+ - "//..."
+ bcr_tests:
+ name: BCR test module
+ platform: ${{ platform }}
+ working_directory: tests/bcr
+ build_flags:
+ - "--allow_yanked_versions=all"
+ test_flags:
+ - "--allow_yanked_versions=all"
+ build_targets:
+ - "//..."
+ - "@go_default_sdk//..."
+ test_targets:
+ - "//..."
+ macos:
+ shell_commands:
+ - tests/core/cgo/generate_imported_dylib.sh
+ build_flags:
+ - "--apple_crosstool_top=@local_config_apple_cc//:toolchain"
+ - "--crosstool_top=@local_config_apple_cc//:toolchain"
+ - "--host_crosstool_top=@local_config_apple_cc//:toolchain"
+ build_targets:
+ - "//..."
+ test_flags:
+ - "--apple_crosstool_top=@local_config_apple_cc//:toolchain"
+ - "--crosstool_top=@local_config_apple_cc//:toolchain"
+ - "--host_crosstool_top=@local_config_apple_cc//:toolchain"
+ test_targets:
+ - "//..."
+ rbe_ubuntu1604:
+ shell_commands:
+ - tests/core/cgo/generate_imported_dylib.sh
+ build_targets:
+ - "//..."
+ test_flags:
+ # Some tests depend on this feature being disabled. However, because it's
+ # enabled by default in the rbe_ubuntu1604 platform, we cannot simply remove
+ # this flag here, we have to explicitly override it with 0.
+ - "--action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=0"
+ # go_bazel_test rules are marked local, since the executors don't have bazel
+ # installed. It appears bazel is no longer in PATH on the host machines
+ # in this configuration either.
+ - "--test_tag_filters=-local"
+ test_targets:
+ - "--"
+ - "//..."
+ - "-//tests/core/stdlib:buildid_test"
+ windows:
+ build_flags:
+ - '--action_env=PATH=C:\tools\msys64\usr\bin;C:\tools\msys64\bin;C:\tools\msys64\mingw64\bin;C:\python3\Scripts\;C:\python3;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\ProgramData\GooGet;C:\Program Files\Google\Compute Engine\metadata_scripts;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files\Google\Compute Engine\sysprep;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\tools\msys64\usr\bin;c:\openjdk\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\CMake\bin;c:\ninja;c:\bazel;c:\buildkite'
+ build_targets:
+ # BUG(bazelbuild/bazel#6485): Bazel 0.18.0 crashes when loading
+ # @com_google_protobuf//:protobuf. We have to exclude everything that
+ # transitively depends on it.
+ # TODO(#1787): There is a cc_import target in //tests/core/cgo that
+ # doesn't set the interface_library attribute. This causes an
+ # analysis failure.
+ # TODO(#1790): Tests that require data should use bazel.Runfile.
+ # TODO(#2516): Tests that require protoc fail when protoc is built with mingw-gcc.
+ - "--"
+ - "//..."
+ - "-@com_github_golang_protobuf//ptypes:go_default_library_gen"
+ - "-@com_google_protobuf//:any_proto"
+ - "-@com_google_protobuf//:api_proto"
+ - "-@com_google_protobuf//:compiler_plugin_proto"
+ - "-@com_google_protobuf//:descriptor_proto"
+ - "-@com_google_protobuf//:duration_proto"
+ - "-@com_google_protobuf//:empty_proto"
+ - "-@com_google_protobuf//:field_mask_proto"
+ - "-@com_google_protobuf//:protobuf"
+ - "-@com_google_protobuf//:protoc"
+ - "-@com_google_protobuf//:protoc_lib"
+ - "-@com_google_protobuf//:source_context_proto"
+ - "-@com_google_protobuf//:struct_proto"
+ - "-@com_google_protobuf//:timestamp_proto"
+ - "-@com_google_protobuf//:type_proto"
+ - "-@com_google_protobuf//:wrappers_proto"
+ - "-@go_googleapis//google/rpc:code_go_proto"
+ - "-@go_googleapis//google/rpc:code_proto"
+ - "-@go_googleapis//google/rpc:errdetails_go_proto"
+ - "-@go_googleapis//google/rpc:errdetails_proto"
+ - "-@go_googleapis//google/rpc:status_go_proto"
+ - "-@go_googleapis//google/rpc:status_proto"
+ - "-@go_googleapis//google/type:color_go_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"
+ - "-@io_bazel_rules_go//proto:go_proto_validate"
+ - "-@io_bazel_rules_go//proto/wkt:any_go_proto"
+ - "-@io_bazel_rules_go//proto/wkt:api_go_proto"
+ - "-@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto"
+ - "-@io_bazel_rules_go//proto/wkt:descriptor_go_proto"
+ - "-@io_bazel_rules_go//proto/wkt:duration_go_proto"
+ - "-@io_bazel_rules_go//proto/wkt:empty_go_proto"
+ - "-@io_bazel_rules_go//proto/wkt:field_mask_go_proto"
+ - "-@io_bazel_rules_go//proto/wkt:source_context_go_proto"
+ - "-@io_bazel_rules_go//proto/wkt:struct_go_proto"
+ - "-@io_bazel_rules_go//proto/wkt:timestamp_go_proto"
+ - "-@io_bazel_rules_go//proto/wkt:type_go_proto"
+ - "-@io_bazel_rules_go//proto/wkt:wrappers_go_proto"
+ - "-@org_golang_x_crypto//ed25519:ed25519_test"
+ - "-@org_golang_x_crypto//sha3:sha3_test"
+ - "-@org_golang_x_sys//windows/registry:registry_test"
+ - "-@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:go_proto_validate"
+ - "-//proto:gostring_grpc"
+ - "-//proto:gostring_proto"
+ - "-//proto/wkt:any_go_proto"
+ - "-//proto/wkt:api_go_proto"
+ - "-//proto/wkt:compiler_plugin_go_proto"
+ - "-//proto/wkt:descriptor_go_proto"
+ - "-//proto/wkt:duration_go_proto"
+ - "-//proto/wkt:empty_go_proto"
+ - "-//proto/wkt:field_mask_go_proto"
+ - "-//proto/wkt:source_context_go_proto"
+ - "-//proto/wkt:struct_go_proto"
+ - "-//proto/wkt:timestamp_go_proto"
+ - "-//proto/wkt:type_go_proto"
+ - "-//proto/wkt:wrappers_go_proto"
+ - "-//tests:buildifier_test" # transitively requires proto, doesn't build in CI
+ - "-@test_chdir_remote//sub:go_default_test"
+ - "-//tests/core/cgo:dylib_client"
+ - "-//tests/core/cgo:dylib_test"
+ - "-//tests/core/cgo:generated_dylib_client"
+ - "-//tests/core/cgo:generated_dylib_test"
+ - "-//tests/core/cgo:versioned_dylib_client"
+ - "-//tests/core/cgo:versioned_dylib_test"
+ - "-//tests/core/cgo:generated_versioned_dylib_client"
+ - "-//tests/core/cgo:generated_versioned_dylib_test"
+ - "-//tests/core/cross:proto_test"
+ - "-//tests/core/go_path:go_path"
+ - "-//tests/core/go_path:go_path_test"
+ - "-//tests/core/go_path:nodata_path"
+ - "-//tests/core/go_path:copy_path"
+ - "-//tests/core/go_path:archive_path"
+ - "-//tests/core/go_path/pkg/lib:vendored"
+ - "-//tests/core/go_path/pkg/lib:go_default_test"
+ - "-//tests/core/go_path/pkg/lib:go_default_library"
+ - "-//tests/core/go_path/pkg/lib:embed_test"
+ - "-//tests/core/go_path/pkg/lib:embed_lib"
+ - "-//tests/core/go_path/cmd/bin:cross"
+ - "-//tests/core/go_path/cmd/bin:bin"
+ - "-//tests/core/go_plugin:go_plugin"
+ - "-//tests/core/go_plugin:go_default_test"
+ - "-//tests/core/go_plugin:plugin"
+ - "-//tests/core/go_plugin_with_proto_library:go_plugin_with_proto_library"
+ - "-//tests/core/go_plugin_with_proto_library:go_default_test"
+ - "-//tests/core/go_plugin_with_proto_library:plugin"
+ - "-//tests/core/go_proto_library:all"
+ - "-//tests/core/go_proto_library_importmap:foo_go_proto"
+ - "-//tests/core/go_proto_library_importmap:foo_proto"
+ - "-//tests/core/go_proto_library_importmap:importmap_test"
+ - "-//tests/core/go_test:data_test"
+ - "-//tests/core/go_test:pwd_test"
+ - "-//tests/core/race:race_test"
+ - "-//tests/core/stdlib:buildid_test"
+ - "-//tests/examples/executable_name:executable_name"
+ - "-//tests/integration/googleapis:color_service"
+ - "-//tests/integration/googleapis:color_service_go_proto"
+ - "-//tests/integration/googleapis:color_service_proto"
+ - "-//tests/integration/googleapis:color_service_test"
+ - "-//tests/legacy/examples/cgo/example_command:example_command_test"
+ - "-//tests/legacy/examples/cgo/example_command:example_command_script"
+ - "-//tests/legacy/examples/cgo/example_command:example_command"
+ - "-//tests/legacy/examples/cgo:generate_go_src"
+ - "-//tests/legacy/examples/cgo:cgo_lib_test"
+ - "-//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/cgo:sub"
+ - "-//tests/legacy/examples/proto/dep:useful_go_proto"
+ - "-//tests/legacy/examples/proto/dep:useful_proto"
+ - "-//tests/legacy/examples/proto/embed:embed_go_proto"
+ - "-//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"
+ - "-//tests/legacy/examples/proto/grpc:my_svc_proto"
+ - "-//tests/legacy/examples/proto/grpc:not_grpc"
+ - "-//tests/legacy/examples/proto/grpc:test_grpc"
+ - "-//tests/legacy/examples/proto/lib:lib_go_proto"
+ - "-//tests/legacy/examples/proto/lib:lib_proto"
+ - "-//tests/legacy/examples/proto:proto_pure_test"
+ - "-//tests/legacy/examples/proto:proto_test"
+ - "-//tests/legacy/extldflags_rpath:extldflags_rpath_test"
+ - "-//tests/legacy/info:info"
+ - "-//tests/legacy/proto_ignore_go_package_option:a_go_proto"
+ - "-//tests/legacy/proto_ignore_go_package_option:a_proto"
+ - "-//tests/legacy/proto_ignore_go_package_option:b_go_proto"
+ - "-//tests/legacy/proto_ignore_go_package_option:b_proto"
+ - "-//tests/legacy/test_chdir:go_default_test"
+ - "-//tests/legacy/test_rundir:go_default_test"
+ - "-//tests/legacy/transitive_data:go_default_test"
+ test_flags:
+ - '--action_env=PATH=C:\tools\msys64\usr\bin;C:\tools\msys64\bin;C:\tools\msys64\mingw64\bin;C:\python3\Scripts\;C:\python3;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\ProgramData\GooGet;C:\Program Files\Google\Compute Engine\metadata_scripts;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files\Google\Compute Engine\sysprep;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\tools\msys64\usr\bin;c:\openjdk\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\CMake\bin;c:\ninja;c:\bazel;c:\buildkite'
+ # On Windows CI, bazel (bazelisk) needs %LocalAppData% to find the cache directory.
+ # We invoke bazel in tests, so the tests need this, too.
+ - "--test_env=LOCALAPPDATA"
+ # go_bazel_test runs bazel in a test workspace. It needs the same flags as above.
+ - "--test_env=GO_BAZEL_TEST_BAZELFLAGS=--cpu=x64_windows --compiler=mingw-gcc --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows_mingw --action_env=PATH --host_platform=@io_bazel_rules_go//go/toolchain:windows_amd64_cgo --incompatible_enable_cc_toolchain_resolution"
+ - "--test_env=PATH"
+ test_targets:
+ - "--"
+ - "//..."
+ - "-//go/tools/bazel:bazel_test"
+ - "-@org_golang_x_crypto//ed25519:ed25519_test"
+ - "-@org_golang_x_crypto//sha3:sha3_test"
+ - "-@org_golang_x_net//ipv4:ipv4_test"
+ - "-@org_golang_x_sys//windows/registry:registry_test"
+ - "-@org_golang_x_sys//windows/svc/eventlog:eventlog_test"
+ - "-@org_golang_x_sys//windows/svc:svc_test"
+ - "-@org_golang_x_text//language:language_test"
+ - "-@org_golang_x_tools//cmd/splitdwarf/internal/macho:macho_test"
+ - "-@test_chdir_remote//sub:go_default_test"
+ - "-//go/tools/builders:stdliblist_test" # fails on Windows due to #2491
+ - "-//tests:buildifier_test" # requires bash
+ - "-//tests/core/cgo:dylib_client"
+ - "-//tests/core/cgo:dylib_test"
+ - "-//tests/core/cgo:generated_dylib_client"
+ - "-//tests/core/cgo:generated_dylib_test"
+ - "-//tests/core/cgo:race_test" # fails on Windows due to upstream bug, see issue #2911
+ - "-//tests/core/cgo:versioned_dylib_client"
+ - "-//tests/core/cgo:versioned_dylib_test"
+ - "-//tests/core/cgo:generated_versioned_dylib_client"
+ - "-//tests/core/cgo:generated_versioned_dylib_test"
+ - "-//tests/core/coverage:coverage_test"
+ - "-//tests/core/coverage:issue3017_test"
+ - "-//tests/core/cross:proto_test"
+ - "-//tests/core/go_binary:go_default_test"
+ - "-//tests/extras/go_embed_data:go_default_test"
+ - "-//tests/core/go_path:go_path"
+ - "-//tests/core/go_path:go_path_test"
+ - "-//tests/core/go_path/pkg/lib:embed_test"
+ - "-//tests/core/go_path/pkg/lib:go_default_test"
+ - "-//tests/core/go_plugin:go_plugin"
+ - "-//tests/core/go_plugin:go_default_test"
+ - "-//tests/core/go_plugin:plugin"
+ - "-//tests/core/go_plugin_with_proto_library:go_plugin_with_proto_library"
+ - "-//tests/core/go_plugin_with_proto_library:go_default_test"
+ - "-//tests/core/go_plugin_with_proto_library:plugin"
+ - "-//tests/core/go_proto_library:all"
+ - "-//tests/core/go_proto_library_importmap:importmap_test"
+ - "-//tests/core/go_test:data_test"
+ - "-//tests/core/go_test:pwd_test"
+ - "-//tests/core/nogo/coverage:coverage_test"
+ - "-//tests/core/nogo/coverage:gen_code_test"
+ - "-//tests/core/race:race_test" # fails on Windows due to upstream bug, see issue #2911
+ - "-//tests/core/stdlib:buildid_test"
+ - "-//tests/examples/executable_name:executable_name"
+ - "-//tests/integration/gazelle:gazelle_test" # exceeds command line length limit
+ - "-//tests/integration/googleapis:color_service_test"
+ - "-//tests/integration/reproducibility:reproducibility_test"
+ - "-//tests/legacy/cgo_pthread_flag:go_default_test" # fails without error, passes locally. Problem with CI msys2?
+ - "-//tests/legacy/examples/cgo/example_command:example_command_test"
+ - "-//tests/legacy/examples/cgo/example_command:example_command_script"
+ - "-//tests/legacy/examples/cgo/example_command:example_command"
+ - "-//tests/legacy/examples/cgo:generate_go_src"
+ - "-//tests/legacy/examples/cgo:cgo_lib_test"
+ - "-//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"
+ - "-//tests/legacy/info:info"
+ - "-//tests/legacy/test_chdir:go_default_test"
+ - "-//tests/legacy/test_rundir:go_default_test"
+ - "-//tests/legacy/transitive_data:go_default_test"
+ # Stardoc produces different line-endings on windows,
+ # so the documentation it generates doesn't match the checked in files.
+ # - Tracking issue https://github.com/bazelbuild/stardoc/issues/42.
+ - "-//docs:all"
+# The following configurations test a seperate WORKSPACE under the examples folder
+ ubuntu2004_examples:
+ name: Examples test on Ubuntu
+ platform: ubuntu2004
+ working_directory: examples/basic-gazelle
+ build_flags:
+ - "--config=incompatible"
+ test_flags:
+ - "--config=incompatible"
+ build_targets:
+ - "//..."
+ test_targets:
+ - "//..."
+ macos_examples:
+ name: Examples test on MacOS
+ platform: macos
+ working_directory: examples/basic-gazelle
+ build_flags:
+ - "--config=incompatible"
+ test_flags:
+ - "--config=incompatible"
+ build_targets:
+ - "//..."
+ test_targets:
+ - "//..."
+ windows_examples:
+ name: Examples test on Windows
+ platform: windows
+ working_directory: examples/basic-gazelle
+ build_flags:
+ - "--config=incompatible"
+ # Go requires a C toolchain that accepts options and emits errors like
+ # gcc or clang. The Go SDK does not support MSVC.
+ - '--action_env=PATH=C:\tools\msys64\usr\bin;C:\tools\msys64\bin;C:\tools\msys64\mingw64\bin;C:\python3\Scripts\;C:\python3;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\ProgramData\GooGet;C:\Program Files\Google\Compute Engine\metadata_scripts;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files\Google\Compute Engine\sysprep;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\tools\msys64\usr\bin;c:\openjdk\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\CMake\bin;c:\ninja;c:\bazel;c:\buildkite'
+ # NOTE(bazelbuild/bazel#10529): bazel doesn't register the mingw toolchain automatically.
+ # We also need the host and target platforms to have the mingw constraint value.
+ build_targets:
+ - "//..."
+ test_targets:
+ - "//..."
+ test_flags:
+ - "--config=incompatible"
+ - '--action_env=PATH=C:\tools\msys64\usr\bin;C:\tools\msys64\bin;C:\tools\msys64\mingw64\bin;C:\python3\Scripts\;C:\python3;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\ProgramData\GooGet;C:\Program Files\Google\Compute Engine\metadata_scripts;C:\Program Files (x86)\Google\Cloud SDK\google-cloud-sdk\bin;C:\Program Files\Google\Compute Engine\sysprep;C:\ProgramData\chocolatey\bin;C:\Program Files\Git\cmd;C:\tools\msys64\usr\bin;c:\openjdk\bin;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\CMake\bin;c:\ninja;c:\bazel;c:\buildkite'
+ # On Windows CI, bazel (bazelisk) needs %LocalAppData% to find the cache directory.
+ # We invoke bazel in tests, so the tests need this, too.
+ - "--test_env=LOCALAPPDATA"
+ # go_bazel_test runs bazel in a test workspace. It needs the same flags as above.
+ - "--test_env=GO_BAZEL_TEST_BAZELFLAGS=--cpu=x64_windows --compiler=mingw-gcc --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows_mingw --action_env=PATH --host_platform=@io_bazel_rules_go//go/toolchain:windows_amd64_cgo --incompatible_enable_cc_toolchain_resolution"
+ - "--test_env=PATH"
diff --git a/.bazelignore b/.bazelignore
new file mode 100644
index 00000000..397609d1
--- /dev/null
+++ b/.bazelignore
@@ -0,0 +1,2 @@
+tests/bcr
+examples
diff --git a/.bazelrc b/.bazelrc
new file mode 100644
index 00000000..d8b82d91
--- /dev/null
+++ b/.bazelrc
@@ -0,0 +1,34 @@
+common --enable_platform_specific_config
+
+# Go requires a C toolchain that accepts options and emits errors like
+# gcc or clang. The Go SDK does not support MSVC.
+build:windows --cpu=x64_windows
+build:windows --compiler=mingw-gcc
+# NOTE(bazelbuild/bazel#10529): bazel doesn't register the mingw toolchain automatically.
+# We also need the host and target platforms to have the mingw constraint value.
+build:windows --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows_mingw
+build:windows --host_platform=@io_bazel_rules_go//go/toolchain:windows_amd64_cgo
+build:windows --platforms=@io_bazel_rules_go//go/toolchain:windows_amd64_cgo
+build:windows --incompatible_enable_cc_toolchain_resolution
+
+build:check --all_incompatible_changes
+
+common:ci --color=no
+build:ci --verbose_failures
+build:ci --sandbox_debug
+build:ci --spawn_strategy=standalone
+build:ci --genrule_strategy=standalone
+test:ci --test_strategy=standalone
+test:ci --test_output=errors
+
+# Incompatible flags to test in a dedicated CI pipeline.
+build:incompatible --incompatible_load_proto_rules_from_bzl
+build:incompatible --incompatible_enable_cc_toolchain_resolution
+build:incompatible --incompatible_config_setting_private_default_visibility
+build:incompatible --incompatible_enforce_config_setting_visibility
+build:incompatible --incompatible_disallow_empty_glob
+build:incompatible --incompatible_disable_starlark_host_transitions
+# Also enable all incompatible flags in go_bazel_test by default.
+# TODO: Add --incompatible_disallow_empty_glob once
+# https://github.com/bazelbuild/bazel-gazelle/pull/1405 has been released.
+test:incompatible --test_env=GO_BAZEL_TEST_BAZELFLAGS='--incompatible_load_proto_rules_from_bzl --incompatible_enable_cc_toolchain_resolution --incompatible_config_setting_private_default_visibility --incompatible_enforce_config_setting_visibility --incompatible_disable_starlark_host_transitions'
diff --git a/.bcr/config.yml b/.bcr/config.yml
new file mode 100644
index 00000000..4225f4fe
--- /dev/null
+++ b/.bcr/config.yml
@@ -0,0 +1,3 @@
+fixedReleaser:
+ login: fmeum
+ email: fabian@meumertzhe.im
diff --git a/.bcr/metadata.template.json b/.bcr/metadata.template.json
new file mode 100644
index 00000000..5108d528
--- /dev/null
+++ b/.bcr/metadata.template.json
@@ -0,0 +1,15 @@
+{
+ "homepage": "https://github.com/bazelbuild/rules_go",
+ "maintainers": [
+ {
+ "email": "fabian@meumertzhe.im",
+ "github": "fmeum",
+ "name": "Fabian Meumertzheim"
+ }
+ ],
+ "repository": [
+ "github:bazelbuild/rules_go"
+ ],
+ "versions": [],
+ "yanked_versions": {}
+}
diff --git a/.bcr/presubmit.yml b/.bcr/presubmit.yml
new file mode 100644
index 00000000..def6f3aa
--- /dev/null
+++ b/.bcr/presubmit.yml
@@ -0,0 +1,31 @@
+matrix:
+ platform:
+ - centos7
+ - debian10
+ - ubuntu2004
+ - macos
+ - windows
+tasks:
+ verify_targets:
+ name: Verify build targets
+ platform: ${{ platform }}
+ build_targets:
+ - '@rules_go//go/tools/bzltestutil/...'
+bcr_test_module:
+ module_path: tests/bcr
+ matrix:
+ platform:
+ - centos7
+ - debian10
+ - ubuntu2004
+ - macos
+ - windows
+ tasks:
+ run_test_module:
+ name: Run test module
+ platform: ${{ platform }}
+ build_targets:
+ - //...
+ - '@go_default_sdk//...'
+ test_targets:
+ - //...
diff --git a/.bcr/source.template.json b/.bcr/source.template.json
new file mode 100644
index 00000000..cfd7e71e
--- /dev/null
+++ b/.bcr/source.template.json
@@ -0,0 +1,5 @@
+{
+ "integrity": "",
+ "strip_prefix": "",
+ "url": "https://github.com/{OWNER}/{REPO}/releases/download/{TAG}/{REPO}-{TAG}.zip"
+}
diff --git a/.github/ISSUE_TEMPLATE b/.github/ISSUE_TEMPLATE
new file mode 100644
index 00000000..0d8cdd85
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE
@@ -0,0 +1,37 @@
+<!-- Please answer these questions before submitting your issue. Thanks! -->
+
+### What version of rules_go are you using?
+
+<!-- Check io_bazel_rules_go in WORKSPACE if you're not sure -->
+
+### What version of gazelle are you using?
+
+<!-- Check bazel_gazelle in WORKSPACE if you're not sure -->
+
+### What version of Bazel are you using?
+
+<!-- Run "bazel version" to find out -->
+
+### Does this issue reproduce with the latest releases of all the above?
+
+
+
+### What operating system and processor architecture are you using?
+
+
+
+### Any other potentially useful information about your toolchain?
+
+<!-- C/C++ compiler, custom CROSSTOOL, remote execution? -->
+
+### What did you do?
+
+<!--
+If possible, provide a minimal recipe for reproducing the error.
+-->
+
+### What did you expect to see?
+
+
+
+### What did you see instead?
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
new file mode 100644
index 00000000..9241c611
--- /dev/null
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,30 @@
+<!-- Thanks for sending a PR! Before submitting:
+
+1. If this is your first PR, please read CONTRIBUTING.md and sign the CLA
+ first. We cannot review code without a signed CLA.
+2. Please file an issue *first*. All features and most bug fixes should have
+ an associated issue with a design discussed and decided upon. Small bug
+ fixes and documentation improvements don't need issues.
+3. New features and bug fixes must have tests. Documentation may need to
+ be updated. If you're unsure what to update, send the PR, and we'll discuss
+ in review.
+4. Note that PRs updating dependencies and new Go versions are not accepted.
+ Please file an issue instead.
+-->
+
+**What type of PR is this?**
+
+> Uncomment one line below and remove others.
+>
+> Bug fix
+> Feature
+> Documentation
+> Other
+
+**What does this PR do? Why is it needed?**
+
+**Which issues(s) does this PR fix?**
+
+Fixes #
+
+**Other notes for review**
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..c3d41a3a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,7 @@
+/bazel-*
+/tests/core/cgo/libimported.*
+/tests/core/cgo/libversioned.*
+/tests/bcr/bazel-*
+/examples/*/bazel-*
+/.ijwb/
+/tests/bcr/.ijwb/
diff --git a/.vscode/extensions.json b/.vscode/extensions.json
new file mode 100644
index 00000000..7b308439
--- /dev/null
+++ b/.vscode/extensions.json
@@ -0,0 +1,8 @@
+{
+ // See http://go.microsoft.com/fwlink/?LinkId=827846
+ // for the documentation about the extensions.json format
+ "recommendations": [
+ "bazelbuild.vscode-bazel",
+ "golang.go",
+ ]
+}
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 00000000..d81fc004
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,32 @@
+{
+ "editor.formatOnSave": true,
+ "files.trimTrailingWhitespace": true,
+ "files.insertFinalNewline": true,
+ "go.goroot": "${workspaceFolder}/bazel-${workspaceFolderBasename}/external/go_sdk",
+ "go.toolsEnvVars": {
+ "GOPACKAGESDRIVER": "${workspaceFolder}/tools/gopackagesdriver.sh"
+ },
+ "go.enableCodeLens": {
+ "references": false,
+ "runtest": false
+ },
+ "gopls": {
+ "formatting.gofumpt": true,
+ "formatting.local": "github.com/bazelbuild/rules_go",
+ "ui.completion.usePlaceholders": true,
+ "ui.semanticTokens": true,
+ "ui.codelenses": {
+ "gc_details": false,
+ "regenerate_cgo": false,
+ "generate": false,
+ "test": false,
+ "tidy": false,
+ "upgrade_dependency": false,
+ "vendor": false
+ },
+ },
+ "go.useLanguageServer": true,
+ "go.buildOnSave": "off",
+ "go.lintOnSave": "off",
+ "go.vetOnSave": "off",
+}
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 00000000..6a776e77
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1,14 @@
+# This the official list of Bazel authors for copyright purposes.
+# This file is distinct from the CONTRIBUTORS files.
+# See the latter for an explanation.
+
+# Names should be added to this file as:
+# Name or Organization <email address>
+# The email address is not required for organizations.
+
+Benjamin Staffin <benley@gmail.com>
+Brian Silverman <bsilver16384@gmail.com>
+David Santiago <david.santiago@gmail.com>
+Google Inc.
+Jake Voytko <jake@reviewninja.com>
+Yuki Yugui Sonoda <yugui@yugui.jp>
diff --git a/BUILD.bazel b/BUILD.bazel
new file mode 100644
index 00000000..60bf72eb
--- /dev/null
+++ b/BUILD.bazel
@@ -0,0 +1,178 @@
+load(
+ "//go/private/tools:lines_sorted_test.bzl",
+ "lines_sorted_test",
+)
+load(
+ "//go/private/rules:nogo.bzl",
+ "nogo",
+)
+load(
+ "//go/private/rules:info.bzl",
+ "go_info",
+)
+load(
+ "//go:def.bzl",
+ "TOOLS_NOGO",
+)
+load(
+ "//go/private:context.bzl",
+ "cgo_context_data",
+ "cgo_context_data_proxy",
+ "go_config",
+ "go_context_data",
+)
+load(
+ "//go/private/rules:stdlib.bzl",
+ "stdlib",
+)
+
+# gazelle:prefix github.com/bazelbuild/rules_go
+# gazelle:exclude tests
+# gazelle:exclude third_party
+# gazelle:exclude go/tools/builders
+# gazelle:exclude go/tools/coverdata
+# gazelle:exclude go/tools/fetch_repo
+# gazelle:exclude go/tools/windows-testrunner
+# gazelle:go_naming_convention import_alias
+
+# TODO(jayconrod): add a gazelle rule so gazelle can be run automatically.
+# It can't go here though, because it would break anything that depends on
+# rules_go but not Gazelle, including our own go_bazel_tests.
+
+stdlib(
+ name = "stdlib",
+ cgo_context_data = select({
+ "//go/platform:internal_cgo_off": None,
+ "//conditions:default": ":cgo_context_data",
+ }),
+ visibility = ["//visibility:public"],
+)
+
+# default_nogo is the nogo target that nogo references by default. It
+# does not analyze anything, which means no binary is built or run
+# at compile time.
+filegroup(
+ name = "default_nogo",
+ visibility = ["//visibility:public"],
+)
+
+# tools_nogo includes all of the analysis passes in
+# golang.org/x/tools/go/analysis/passes.
+# This is not backward compatible, so use caution when depending on this --
+# new analyses may discover issues in existing builds.
+nogo(
+ name = "tools_nogo",
+ visibility = ["//visibility:public"],
+ deps = TOOLS_NOGO,
+)
+
+# go_context_data collects build options and is depended on by all Go targets.
+# It may depend on cgo_context_data if CGo isn't disabled.
+go_context_data(
+ name = "go_context_data",
+ cgo_context_data = select({
+ "//go/platform:internal_cgo_off": None,
+ "//conditions:default": ":cgo_context_data",
+ }),
+ coverdata = "//go/tools/coverdata",
+ go_config = ":go_config",
+ nogo = "@io_bazel_rules_nogo//:nogo",
+ stdlib = ":stdlib",
+ visibility = ["//visibility:public"],
+)
+
+# cgo_context_data collects information about the C/C++ toolchain.
+# go_context_data depends if cgo is enabled in the target configuration.
+cgo_context_data(
+ name = "cgo_context_data",
+ visibility = ["//visibility:private"],
+)
+
+# cgo_context_data_proxy depends on cgo_context_data if cgo is enabled and
+# forwards its provider. Rule attributes may depend on this, since they cannot
+# use select.
+cgo_context_data_proxy(
+ name = "cgo_context_data_proxy",
+ actual = select({
+ "//go/platform:internal_cgo_off": None,
+ "//conditions:default": ":cgo_context_data",
+ }),
+ visibility = ["//visibility:public"],
+)
+
+# go_config collects information about build settings in the current
+# configuration. go_context_data depends on this so that rules don't need
+# to depend on all build settings directly.
+go_config(
+ name = "go_config",
+ amd64 = select({
+ "//go/constraints/amd64:v2": "v2",
+ "//go/constraints/amd64:v3": "v3",
+ "//go/constraints/amd64:v4": "v4",
+ # The default is v1.
+ "//conditions:default": None,
+ }),
+ cover_format = "//go/config:cover_format",
+ # Always include debug symbols with -c dbg.
+ debug = select({
+ "//go/private:is_compilation_mode_dbg": "//go/private:always_true",
+ "//conditions:default": "//go/config:debug",
+ }),
+ gc_goopts = "//go/config:gc_goopts",
+ gc_linkopts = "//go/config:gc_linkopts",
+ gotags = "//go/config:tags",
+ linkmode = "//go/config:linkmode",
+ msan = "//go/config:msan",
+ pure = "//go/config:pure",
+ race = "//go/config:race",
+ stamp = select({
+ "//go/private:stamp": True,
+ "//conditions:default": False,
+ }),
+ static = "//go/config:static",
+ strip = select({
+ "//go/private:is_strip_always": True,
+ "//go/private:is_strip_sometimes_fastbuild": True,
+ "//conditions:default": False,
+ }),
+ visibility = ["//visibility:public"],
+)
+
+lines_sorted_test(
+ name = "contributors_sorted_test",
+ size = "small",
+ cmd = "grep -v '^#' $< | grep -v '^$$' >$@",
+ error_message = "Contributors must be sorted by first name",
+ file = "CONTRIBUTORS",
+)
+
+lines_sorted_test(
+ name = "authors_sorted_test",
+ size = "small",
+ cmd = "grep -v '^#' $< | grep -v '^$$' >$@",
+ error_message = "Authors must be sorted by first name",
+ file = "AUTHORS",
+)
+
+# AUTHORS is used as an anchor point for the directory in tests and the
+# license can be consumed by depending projects.
+exports_files([
+ "AUTHORS",
+ "LICENSE.txt",
+])
+
+go_info()
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = [
+ "BUILD.bazel",
+ "WORKSPACE",
+ "//extras:all_files",
+ "//go:all_files",
+ "//proto:all_files",
+ "//third_party:all_files",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/CODEOWNERS b/CODEOWNERS
new file mode 100644
index 00000000..1950b862
--- /dev/null
+++ b/CODEOWNERS
@@ -0,0 +1 @@
+* @go-maintainers
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 00000000..7669bb7d
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,39 @@
+Want to contribute? Great! First, read this page (including the small print at
+the end).
+
+### Before you contribute
+**Before we can use your code, you must sign the
+[Google Individual Contributor License Agreement](https://developers.google.com/open-source/cla/individual?csw=1)
+(CLA)**, which you can do online.
+
+The CLA is necessary mainly because you own the copyright to your changes,
+even after your contribution becomes part of our codebase, so we need your
+permission to use and distribute your code. We also need to be sure of
+various other things — for instance that you'll tell us if you know that
+your code infringes on other people's patents. You don't have to sign
+the CLA until after you've submitted your code for review and a member has
+approved it, but you must do it before we can put your code into our codebase.
+
+### The small print
+Contributions made by corporations are covered by a different agreement than
+the one above, the
+[Software Grant and Corporate Contributor License Agreement](https://cla.developers.google.com/about/google-corporate).
+
+### Contribution process
+
+1. Explain your idea and discuss your plan with members of the team. The best
+ way to do this is to create
+ an [issue](https://github.com/bazelbuild/rules_go/issues) or comment on an
+ existing issue.
+1. Prepare a git commit with your change. Don't forget to
+ add [tests](https://github.com/bazelbuild/rules_go/tree/master/tests).
+ Run the existing tests with `bazel test //...`. Update
+ [README.md](https://github.com/bazelbuild/rules_go/blob/master/README.md)
+ if appropriate.
+1. [Create a pull request](https://help.github.com/articles/creating-a-pull-request/).
+ This will start the code review process. **All submissions, including
+ submissions by project members, require review.**
+1. You may be asked to make some changes. You'll also need to sign the CLA at
+ this point, if you haven't done so already. Our continuous integration bots
+ will test your change automatically on supported platforms. Once everything
+ looks good, your change will be merged.
diff --git a/CONTRIBUTORS b/CONTRIBUTORS
new file mode 100644
index 00000000..4315c06f
--- /dev/null
+++ b/CONTRIBUTORS
@@ -0,0 +1,26 @@
+# People who have agreed to one of the CLAs and can contribute patches.
+# The AUTHORS file lists the copyright holders; this file
+# lists people. For example, Google employees are listed here
+# but not in AUTHORS, because Google holds the copyright.
+#
+# https://developers.google.com/open-source/cla/individual
+# https://developers.google.com/open-source/cla/corporate
+#
+# Names should be added to this file as:
+# Name <email address>
+
+Benjamin Staffin <benley@gmail.com>
+Brian Silverman <bsilver16384@gmail.com>
+Damien Martin-Guillerez <dmarting@google.com>
+David Chen <dzc@google.com>
+David Santiago <david.santiago@gmail.com>
+Fabian Meumertzheim <fabian@meumertzhe.im>
+Han-Wen Nienhuys <hanwen@google.com>
+Ian Cottrell <iancottrell@google.com>
+Jake Voytko <jake@reviewninja.com>
+Jay Conrod <jayconrod@google.com>
+Josh Powell <powelljo@us.ibm.com>
+Justine Alexandra Roberts Tunney <jart@google.com>
+Kristina Chodorow <kchodorow@google.com>
+Lukacs Berki <lberki@google.com>
+Yuki Yugui Sonoda <yugui@yugui.jp>
diff --git a/LICENSE b/LICENSE
new file mode 120000
index 00000000..85de3d45
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1 @@
+LICENSE.txt \ No newline at end of file
diff --git a/LICENSE.txt b/LICENSE.txt
new file mode 100644
index 00000000..d6456956
--- /dev/null
+++ b/LICENSE.txt
@@ -0,0 +1,202 @@
+
+ Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
+
+ END OF TERMS AND CONDITIONS
+
+ APPENDIX: How to apply the Apache License to your work.
+
+ To apply the Apache License to your work, attach the following
+ boilerplate notice, with the fields enclosed by brackets "[]"
+ replaced with your own identifying information. (Don't include
+ the brackets!) The text should be enclosed in the appropriate
+ comment syntax for the file format. We also recommend that a
+ file or class name and description of purpose be included on the
+ same "printed page" as the copyright notice for easier
+ identification within third-party archives.
+
+ Copyright [yyyy] [name of copyright owner]
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
diff --git a/METADATA b/METADATA
new file mode 100644
index 00000000..c649fb68
--- /dev/null
+++ b/METADATA
@@ -0,0 +1,17 @@
+name: "rules_go"
+description:
+ "Bazel build rules for building Go code"
+
+third_party {
+ url {
+ type: HOMEPAGE
+ value: "https://github.com/bazelbuild/rules_go"
+ }
+ url {
+ type: GIT
+ value: "https://github.com/bazelbuild/rules_go"
+ }
+ version: "v0.39.1"
+ last_upgrade_date { year: 2023 month: 6 day: 13 }
+ license_type: NOTICE
+}
diff --git a/MODULE.bazel b/MODULE.bazel
new file mode 100644
index 00000000..08e73c05
--- /dev/null
+++ b/MODULE.bazel
@@ -0,0 +1,47 @@
+module(
+ name = "rules_go",
+ version = "0.39.1",
+ compatibility_level = 0,
+ repo_name = "io_bazel_rules_go",
+)
+
+bazel_dep(name = "bazel_skylib", version = "1.2.0")
+bazel_dep(name = "platforms", version = "0.0.4")
+bazel_dep(name = "rules_proto", version = "4.0.0")
+bazel_dep(name = "protobuf", version = "3.19.2", repo_name = "com_google_protobuf")
+
+non_module_dependencies = use_extension("//go/private:extensions.bzl", "non_module_dependencies")
+use_repo(
+ non_module_dependencies,
+ "go_googleapis",
+ "io_bazel_rules_nogo",
+)
+
+go_sdk = use_extension("//go:extensions.bzl", "go_sdk")
+go_sdk.download(
+ name = "go_default_sdk",
+ version = "1.19.8",
+)
+use_repo(go_sdk, "go_toolchains")
+
+register_toolchains("@go_toolchains//:all")
+
+bazel_dep(name = "gazelle", version = "0.30.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",
+ "org_golang_google_grpc",
+ "org_golang_google_protobuf",
+ "org_golang_x_net",
+)
diff --git a/OWNERS b/OWNERS
new file mode 100644
index 00000000..1d8c1952
--- /dev/null
+++ b/OWNERS
@@ -0,0 +1 @@
+include platform/build/bazel:/OWNERS
diff --git a/README.rst b/README.rst
new file mode 100644
index 00000000..db8e46e4
--- /dev/null
+++ b/README.rst
@@ -0,0 +1,832 @@
+Go rules for Bazel_
+=====================
+
+.. Links to external sites and pages
+.. _//tests/core/cross: https://github.com/bazelbuild/rules_go/blob/master/tests/core/cross/BUILD.bazel
+.. _Avoiding conflicts: proto/core.rst#avoiding-conflicts
+.. _Bazel labels: https://docs.bazel.build/versions/master/build-ref.html#labels
+.. _Bazel: https://bazel.build/
+.. _Build modes: go/modes.rst
+.. _Bzlmod: https://bazel.build/external/overview#bzlmod
+.. _Go with Bzlmod: docs/go/core/bzlmod.md
+.. _Core rules: docs/go/core/rules.md
+.. _Coverage: https://bazel.google.cn/docs/coverage
+.. _Dependencies: go/dependencies.rst
+.. _Deprecation schedule: https://github.com/bazelbuild/rules_go/wiki/Deprecation-schedule
+.. _Gopher Slack: https://invite.slack.golangbridge.org/
+.. _gopls integration: https://github.com/bazelbuild/rules_go/wiki/Editor-setup
+.. _Overriding dependencies: go/dependencies.rst#overriding-dependencies
+.. _Proto dependencies: go/dependencies.rst#proto-dependencies
+.. _Proto rules: proto/core.rst
+.. _Protocol buffers: proto/core.rst
+.. _Running Bazel Tests on Travis CI: https://kev.inburke.com/kevin/bazel-tests-on-travis-ci/
+.. _Toolchains: go/toolchains.rst
+.. _Using rules_go on Windows: windows.rst
+.. _bazel-go-discuss: https://groups.google.com/forum/#!forum/bazel-go-discuss
+.. _configuration transition: https://docs.bazel.build/versions/master/skylark/lib/transition.html
+.. _gRPC dependencies: go/dependencies.rst#grpc-dependencies
+.. _gazelle update-repos: https://github.com/bazelbuild/bazel-gazelle#update-repos
+.. _gazelle: https://github.com/bazelbuild/bazel-gazelle
+.. _github.com/bazelbuild/bazel-gazelle: https://github.com/bazelbuild/bazel-gazelle
+.. _github.com/bazelbuild/rules_go/go/tools/bazel: https://pkg.go.dev/github.com/bazelbuild/rules_go/go/tools/bazel?tab=doc
+.. _korfuri/bazel-travis Use Bazel with Travis CI: https://github.com/korfuri/bazel-travis
+.. _nogo build-time static analysis: go/nogo.rst
+.. _nogo: go/nogo.rst
+.. _rules_go and Gazelle roadmap: https://github.com/bazelbuild/rules_go/wiki/Roadmap
+.. _#bazel on Go Slack: https://gophers.slack.com/archives/C1SCQE54N
+.. _#go on Bazel Slack: https://bazelbuild.slack.com/archives/CDBP88Z0D
+
+.. Go rules
+.. _go_binary: docs/go/core/rules.md#go_binary
+.. _go_context: go/toolchains.rst#go_context
+.. _go_download_sdk: go/toolchains.rst#go_download_sdk
+.. _go_embed_data: docs/go/extras/extras.md#go_embed_data
+.. _go_host_sdk: go/toolchains.rst#go_host_sdk
+.. _go_library: docs/go/core/rules.md#go_library
+.. _go_local_sdk: go/toolchains.rst#go_local_sdk
+.. _go_path: docs/go/core/rules.md#go_path
+.. _go_proto_compiler: proto/core.rst#go_proto_compiler
+.. _go_proto_library: proto/core.rst#go_proto_library
+.. _go_register_toolchains: go/toolchains.rst#go_register_toolchains
+.. _go_repository: https://github.com/bazelbuild/bazel-gazelle/blob/master/repository.md#go_repository
+.. _go_rules_dependencies: go/dependencies.rst#go_rules_dependencies
+.. _go_source: docs/go/core/rules.md#go_source
+.. _go_test: docs/go/core/rules.md#go_test
+.. _go_toolchain: go/toolchains.rst#go_toolchain
+.. _go_wrap_sdk: go/toolchains.rst#go_wrap_sdk
+
+.. External rules
+.. _git_repository: https://docs.bazel.build/versions/master/repo/git.html
+.. _http_archive: https://docs.bazel.build/versions/master/repo/http.html#http_archive
+.. _proto_library: https://github.com/bazelbuild/rules_proto
+
+.. Issues
+.. _#265: https://github.com/bazelbuild/rules_go/issues/265
+.. _#721: https://github.com/bazelbuild/rules_go/issues/721
+.. _#889: https://github.com/bazelbuild/rules_go/issues/889
+.. _#1199: https://github.com/bazelbuild/rules_go/issues/1199
+.. _#2775: https://github.com/bazelbuild/rules_go/issues/2775
+
+
+Mailing list: `bazel-go-discuss`_
+
+Slack: `#go on Bazel Slack`_, `#bazel on Go Slack`_
+
+Announcements
+-------------
+2023-03-27
+ Release
+ `v0.39.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.39.0>`_
+ is now available. This release includes a simpler interface for Bzlmod
+ `go_sdk` registration, makes the `//go` tool available to users, and
+ fixes various bugs.
+
+2022-12-06
+ Release
+ `v0.37.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.37.0>`_
+ is now available. This release includes support for generated code in
+ the packages driver as well as various bugfixes.
+
+2022-11-22
+ Release
+ `v0.36.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.36.0>`_
+ is now available. This release adds a Go library to look up runfiles, and
+ two command line flags to pass additional compiler and linker options.
+
+2022-09-11
+ Release
+ `v0.35.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.35.0>`_
+ is now available. This release supports switching Go SDK version from a
+ build flag. Starting this release, rules_go requires Bazel 5.1.0, because
+ it needs to read CPU architecture from Bazel to better support Apple M1
+ with Rosetta translation.
+
+2022-07-19
+ Release
+ `v0.34.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.34.0>`_
+ is now available. This release brings very experimental support for bzlmod,
+ several improvements to nogo and gopackagesdriver.
+
+2022-06-06
+ Release
+ `v0.33.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.33.0>`_
+ is now available. This release consists mostly of bug fixes and deprecates
+ the `asm`, `compile`, `cover`, and `pack` actions on `go_context`.
+2022-05-11
+ Release
+ `v0.32.0 <https://github.com/bazelbuild/rules_go/releases/tag/v0.32.0>`_
+ is now available. This adds `gomock` to rules_go and supports lcov format
+ for code coverage report, as well as a long list of other changes listed
+ in the release notes.
+
+Contents
+--------
+
+* `Overview`_
+* `Setup`_
+* `protobuf and gRPC`_
+* `FAQ`_
+
+Documentation
+~~~~~~~~~~~~~
+
+* `Core rules`_
+
+ * `go_binary`_
+ * `go_library`_
+ * `go_test`_
+ * `go_source`_
+ * `go_path`_
+
+* `Proto rules`_
+
+ * `go_proto_library`_
+ * `go_proto_compiler`_
+
+* `Dependencies`_
+
+ * `go_rules_dependencies`_
+ * `go_repository`_ (Gazelle)
+
+* `Toolchains`_
+
+ * `go_register_toolchains`_
+ * `go_download_sdk`_
+ * `go_host_sdk`_
+ * `go_local_sdk`_
+ * `go_wrap_sdk`_
+ * `go_toolchain`_
+ * `go_context`_
+
+* `Extra rules <docs/go/extras/extras.md>`_
+
+ * `go_embed_data`_
+
+* `nogo build-time static analysis`_
+* `Build modes <go/modes.rst>`_
+
+Quick links
+~~~~~~~~~~~
+
+* `rules_go and Gazelle roadmap`_
+* `Deprecation schedule`_
+* `Using rules_go on Windows`_
+
+Overview
+--------
+
+The rules are in the beta stage of development. They support:
+
+* Building libraries, binaries, and tests (`go_library`_, `go_binary`_,
+ `go_test`_)
+* Vendoring
+* cgo
+* Cross-compilation
+* Generating BUILD files via gazelle_
+* Build-time code analysis via nogo_
+* `Protocol buffers`_
+* Remote execution
+* `Coverage`_
+* `gopls integration`_ for editor support
+* Debugging
+
+They currently do not support or have limited support for:
+
+* C/C++ integration other than cgo (SWIG)
+
+The Go rules are tested and supported on the following host platforms:
+
+* Linux, macOS, Windows
+* amd64
+
+Users have reported success on several other platforms, but the rules are
+only tested on those listed above.
+
+Note: Since version v0.38.0, rules_go requires Bazel ≥ 5.4.0 to work.
+
+The ``master`` branch is only guaranteed to work with the latest version of Bazel.
+
+
+Setup
+-----
+
+System setup
+~~~~~~~~~~~~
+
+To build Go code with Bazel, you will need:
+
+* A recent version of Bazel.
+* A C/C++ toolchain (if using cgo). Bazel will attempt to configure the
+ toolchain automatically.
+* Bash, ``patch``, ``cat``, and a handful of other Unix tools in ``PATH``.
+
+You normally won't need a Go toolchain installed. Bazel will download one.
+
+See `Using rules_go on Windows`_ for Windows-specific setup instructions.
+Several additional tools need to be installed and configured.
+
+Initial project setup
+~~~~~~~~~~~~~~~~~~~~~
+
+If you are using Bazel's new external dependency management system `Bzlmod`_,
+refer to the dedicated `Go with Bzlmod`_ guide instead.
+
+Create a file at the top of your repository named ``WORKSPACE``, and add the
+snippet below (or add to your existing ``WORKSPACE``). This tells Bazel to
+fetch rules_go and its dependencies. Bazel will download a recent supported
+Go toolchain and register it for use.
+
+.. code:: bzl
+
+ 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",
+ ],
+ )
+
+ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
+
+ go_rules_dependencies()
+
+ go_register_toolchains(version = "1.19.3")
+
+You can use rules_go at ``master`` by using `git_repository`_ instead of
+`http_archive`_ and pointing to a recent commit.
+
+Add a file named ``BUILD.bazel`` in the root directory of your project.
+You'll need a build file in each directory with Go code, but you'll also need
+one in the root directory, even if your project doesn't have Go code there.
+For a "Hello, world" binary, the file should look like this:
+
+.. code:: bzl
+
+ load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+ go_binary(
+ name = "hello",
+ srcs = ["hello.go"],
+ )
+
+You can build this target with ``bazel build //:hello``.
+
+Generating build files
+~~~~~~~~~~~~~~~~~~~~~~
+
+If your project can be built with ``go build``, you can generate and update your
+build files automatically using gazelle_.
+
+Add the ``bazel_gazelle`` repository and its dependencies to your
+``WORKSPACE``. It should look like this:
+
+ .. code:: bzl
+
+ 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 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405",
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
+ "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.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.19.3")
+
+ gazelle_dependencies()
+
+Add the code below to the ``BUILD.bazel`` file in your project's root directory.
+Replace the string after ``prefix`` with an import path prefix that matches your
+project. It should be the same as your module path, if you have a ``go.mod``
+file.
+
+.. code:: bzl
+
+ load("@bazel_gazelle//:def.bzl", "gazelle")
+
+ # gazelle:prefix github.com/example/project
+ gazelle(name = "gazelle")
+
+This declares a ``gazelle`` binary rule, which you can run using the command
+below:
+
+.. code:: bash
+
+ bazel run //:gazelle
+
+This will generate a ``BUILD.bazel`` file with `go_library`_, `go_binary`_, and
+`go_test`_ targets for each package in your project. You can run the same
+command in the future to update existing build files with new source files,
+dependencies, and options.
+
+Writing build files by hand
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+If your project doesn't follow ``go build`` conventions or you prefer not to use
+gazelle_, you can write build files by hand.
+
+In each directory that contains Go code, create a file named ``BUILD.bazel``
+Add a ``load`` statement at the top of the file for the rules you use.
+
+.. code:: bzl
+
+ load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
+
+For each library, add a `go_library`_ rule like the one below. Source files are
+listed in the ``srcs`` attribute. Imported packages outside the standard library
+are listed in the ``deps`` attribute using `Bazel labels`_ that refer to
+corresponding `go_library`_ rules. The library's import path must be specified
+with the ``importpath`` attribute.
+
+.. code:: bzl
+
+ go_library(
+ name = "foo_library",
+ srcs = [
+ "a.go",
+ "b.go",
+ ],
+ importpath = "github.com/example/project/foo",
+ deps = [
+ "//tools",
+ "@org_golang_x_utils//stuff",
+ ],
+ visibility = ["//visibility:public"],
+ )
+
+For tests, add a `go_test`_ rule like the one below. The library being tested
+should be listed in an ``embed`` attribute.
+
+.. code:: bzl
+
+ go_test(
+ name = "foo_test",
+ srcs = [
+ "a_test.go",
+ "b_test.go",
+ ],
+ embed = [":foo_lib"],
+ deps = [
+ "//testtools",
+ "@org_golang_x_utils//morestuff",
+ ],
+ )
+
+For binaries, add a `go_binary`_ rule like the one below.
+
+.. code:: bzl
+
+ go_binary(
+ name = "foo",
+ srcs = ["main.go"],
+ )
+
+Adding external repositories
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+For each Go repository, add a `go_repository`_ rule to ``WORKSPACE`` like the
+one below. This rule comes from the Gazelle repository, so you will need to
+load it. `gazelle update-repos`_ can generate or update these rules
+automatically from a go.mod or Gopkg.lock file.
+
+.. code:: bzl
+
+ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+ # Download the Go rules.
+ 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",
+ ],
+ )
+
+ # Download Gazelle.
+ http_archive(
+ name = "bazel_gazelle",
+ sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405",
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
+ "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
+ ],
+ )
+
+ # Load macros and repository rules.
+ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
+ load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
+
+ # Declare Go direct dependencies.
+ go_repository(
+ name = "org_golang_x_net",
+ importpath = "golang.org/x/net",
+ sum = "h1:zK/HqS5bZxDptfPJNq8v7vJfXtkU7r9TLIoSr1bXaP4=",
+ version = "v0.0.0-20200813134508-3edf25e44fcc",
+ )
+
+ # Declare indirect dependencies and register toolchains.
+ go_rules_dependencies()
+
+ go_register_toolchains(version = "1.19.3")
+
+ gazelle_dependencies()
+
+
+protobuf and gRPC
+-----------------
+
+To generate code from protocol buffers, you'll need to add a dependency on
+``com_google_protobuf`` to your ``WORKSPACE``.
+
+.. code:: bzl
+
+ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+ http_archive(
+ name = "com_google_protobuf",
+ sha256 = "d0f5f605d0d656007ce6c8b5a82df3037e1d8fe8b121ed42e536f569dec16113",
+ strip_prefix = "protobuf-3.14.0",
+ urls = [
+ "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz",
+ "https://github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz",
+ ],
+ )
+
+ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
+
+ protobuf_deps()
+
+You'll need a C/C++ toolchain registered for the execution platform (the
+platform where Bazel runs actions) to build protoc.
+
+The `proto_library`_ rule is provided by the ``rules_proto`` repository.
+``protoc-gen-go``, the Go proto compiler plugin, is provided by the
+``com_github_golang_protobuf`` repository. Both are declared by
+`go_rules_dependencies`_. You won't need to declare an explicit dependency
+unless you specifically want to use a different version. See `Overriding
+dependencies`_ for instructions on using a different version.
+
+gRPC dependencies are not declared by default (there are too many). You can
+declare them in WORKSPACE using `go_repository`_. You may want to use
+`gazelle update-repos`_ to import them from ``go.mod``.
+
+See `Proto dependencies`_, `gRPC dependencies`_ for more information. See also
+`Avoiding conflicts`_.
+
+Once all dependencies have been registered, you can declare `proto_library`_
+and `go_proto_library`_ rules to generate and compile Go code from .proto
+files.
+
+.. code:: bzl
+
+ load("@rules_proto//proto:defs.bzl", "proto_library")
+ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+
+ proto_library(
+ name = "foo_proto",
+ srcs = ["foo.proto"],
+ deps = ["//bar:bar_proto"],
+ visibility = ["//visibility:public"],
+ )
+
+ go_proto_library(
+ name = "foo_go_proto",
+ importpath = "github.com/example/protos/foo_proto",
+ protos = [":foo_proto"],
+ visibility = ["//visibility:public"],
+ )
+
+A ``go_proto_library`` target may be imported and depended on like a normal
+``go_library``.
+
+Note that recent versions of rules_go support both APIv1
+(``github.com/golang/protobuf``) and APIv2 (``google.golang.org/protobuf``).
+By default, code is generated with
+``github.com/golang/protobuf/cmd/protoc-gen-gen`` for compatibility with both
+interfaces. Client code may import use either runtime library or both.
+
+FAQ
+---
+
+**Go**
+
+* `Can I still use the go command?`_
+* `Does this work with Go modules?`_
+* `What's up with the go_default_library name?`_
+* `How do I cross-compile?`_
+* `How do I access testdata?`_
+* `How do I access go_binary executables from go_test?`_
+
+**Protocol buffers**
+
+* `How do I avoid conflicts with protocol buffers?`_
+* `Can I use a vendored gRPC with go_proto_library?`_
+
+**Dependencies and testing**
+
+* `How do I use different versions of dependencies?`_
+* `How do I run Bazel on Travis CI?`_
+* `How do I test a beta version of the Go SDK?`_
+
+Can I still use the go command?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Yes, but not directly.
+
+rules_go invokes the Go compiler and linker directly, based on the targets
+described with `go_binary`_ and other rules. Bazel and rules_go together
+fill the same role as the ``go`` command, so it's not necessary to use the
+``go`` command in a Bazel workspace.
+
+That said, it's usually still a good idea to follow conventions required by
+the ``go`` command (e.g., one package per directory, package paths match
+directory paths). Tools that aren't compatible with Bazel will still work,
+and your project can be depended on by non-Bazel projects.
+
+If you need to use the ``go`` command to perform tasks that Bazel doesn't cover
+(such as adding a new dependency to ``go.mod``), you can use the following Bazel
+invocation to run the ``go`` binary of the Bazel-configured Go SDK:
+
+.. code:: bash
+
+ bazel run @io_bazel_rules_go//go -- <args>
+
+Prefer this to running ``go`` directly since it ensures that the version of Go
+is identical to the one used by rules_go.
+
+Does this work with Go modules?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Yes, but not directly. Bazel ignores ``go.mod`` files, and all package
+dependencies must be expressed through ``deps`` attributes in targets
+described with `go_library`_ and other rules.
+
+You can download a Go module at a specific version as an external repository
+using `go_repository`_, a workspace rule provided by gazelle_. This will also
+generate build files using gazelle_.
+
+You can import `go_repository`_ rules from a ``go.mod`` file using
+`gazelle update-repos`_.
+
+What's up with the go_default_library name?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This was used to keep import paths consistent in libraries that can be built
+with ``go build`` before the ``importpath`` attribute was available.
+
+In order to compile and link correctly, rules_go must know the Go import path
+(the string by which a package can be imported) for each library. This is now
+set explicitly with the ``importpath`` attribute. Before that attribute existed,
+the import path was inferred by concatenating a string from a special
+``go_prefix`` rule and the library's package and label name. For example, if
+``go_prefix`` was ``github.com/example/project``, for a library
+``//foo/bar:bar``, rules_go would infer the import path as
+``github.com/example/project/foo/bar/bar``. The stutter at the end is
+incompatible with ``go build``, so if the label name was ``go_default_library``,
+the import path would not include it. So for the library
+``//foo/bar:go_default_library``, the import path would be
+``github.com/example/project/foo/bar``.
+
+Since ``go_prefix`` was removed and the ``importpath`` attribute became
+mandatory (see `#721`_), the ``go_default_library`` name no longer serves any
+purpose. We may decide to stop using it in the future (see `#265`_).
+
+How do I cross-compile?
+~~~~~~~~~~~~~~~~~~~~~~~
+
+You can cross-compile by setting the ``--platforms`` flag on the command line.
+For example:
+
+.. code::
+
+ $ bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //cmd
+
+By default, cgo is disabled when cross-compiling. To cross-compile with cgo,
+add a ``_cgo`` suffix to the target platform. You must register a
+cross-compiling C/C++ toolchain with Bazel for this to work.
+
+.. code::
+
+ $ bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64_cgo //cmd
+
+Platform-specific sources with build tags or filename suffixes are filtered
+automatically at compile time. You can selectively include platform-specific
+dependencies with ``select`` expressions (Gazelle does this automatically).
+
+.. code:: bzl
+
+ go_library(
+ name = "foo",
+ srcs = [
+ "foo_linux.go",
+ "foo_windows.go",
+ ],
+ deps = select({
+ "@io_bazel_rules_go//go/platform:linux_amd64": [
+ "//bar_linux",
+ ],
+ "@io_bazel_rules_go//go/platform:windows_amd64": [
+ "//bar_windows",
+ ],
+ "//conditions:default": [],
+ }),
+ )
+
+To build a specific `go_binary`_ or `go_test`_ target for a target platform,
+set the ``goos`` and ``goarch`` attributes on that rule. This is useful for
+producing multiple binaries for different platforms in a single build.
+You can equivalently depend on a `go_binary`_ or `go_test`_ rule through
+a Bazel `configuration transition`_ on ``//command_line_option:platforms``
+(there are problems with this approach prior to rules_go 0.23.0).
+
+How do I access testdata?
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Bazel executes tests in a sandbox, which means tests don't automatically have
+access to files. You must include test files using the ``data`` attribute.
+For example, if you want to include everything in the ``testdata`` directory:
+
+.. code:: bzl
+
+ go_test(
+ name = "foo_test",
+ srcs = ["foo_test.go"],
+ data = glob(["testdata/**"]),
+ importpath = "github.com/example/project/foo",
+ )
+
+By default, tests are run in the directory of the build file that defined them.
+Note that this follows the Go testing convention, not the Bazel convention
+followed by other languages, which run in the repository root. This means
+that you can access test files using relative paths. You can change the test
+directory using the ``rundir`` attribute. See go_test_.
+
+Gazelle will automatically add a ``data`` attribute like the one above if you
+have a ``testdata`` directory *unless* it contains buildable .go files or
+build files, in which case, ``testdata`` is treated as a normal package.
+
+Note that on Windows, data files are not directly available to tests, since test
+data files rely on symbolic links, and by default, Windows doesn't let
+unprivileged users create symbolic links. You can use the
+`github.com/bazelbuild/rules_go/go/tools/bazel`_ library to access data files.
+
+How do I access go_binary executables from go_test?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The location where ``go_binary`` writes its executable file is not stable across
+rules_go versions and should not be depended upon. The parent directory includes
+some configuration data in its name. This prevents Bazel's cache from being
+poisoned when the same binary is built in different configurations. The binary
+basename may also be platform-dependent: on Windows, we add an .exe extension.
+
+To depend on an executable in a ``go_test`` rule, reference the executable
+in the ``data`` attribute (to make it visible), then expand the location
+in ``args``. The real location will be passed to the test on the command line.
+For example:
+
+.. code:: bzl
+
+ go_binary(
+ name = "cmd",
+ srcs = ["cmd.go"],
+ )
+
+ go_test(
+ name = "cmd_test",
+ srcs = ["cmd_test.go"],
+ args = ["$(location :cmd)"],
+ data = [":cmd"],
+ )
+
+See `//tests/core/cross`_ for a full example of a test that
+accesses a binary.
+
+Alternatively, you can set the ``out`` attribute of `go_binary`_ to a specific
+filename. Note that when ``out`` is set, the binary won't be cached when
+changing configurations.
+
+.. code:: bzl
+
+ go_binary(
+ name = "cmd",
+ srcs = ["cmd.go"],
+ out = "cmd",
+ )
+
+ go_test(
+ name = "cmd_test",
+ srcs = ["cmd_test.go"],
+ data = [":cmd"],
+ )
+
+How do I avoid conflicts with protocol buffers?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+See `Avoiding conflicts`_ in the proto documentation.
+
+Can I use a vendored gRPC with go_proto_library?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This is not supported. When using `go_proto_library`_ with the
+``@io_bazel_rules_go//proto:go_grpc`` compiler, an implicit dependency is added
+on ``@org_golang_google_grpc//:go_default_library``. If you link another copy of
+the same package from ``//vendor/google.golang.org/grpc:go_default_library``
+or anywhere else, you may experience conflicts at compile or run-time.
+
+If you're using Gazelle with proto rule generation enabled, imports of
+``google.golang.org/grpc`` will be automatically resolved to
+``@org_golang_google_grpc//:go_default_library`` to avoid conflicts. The
+vendored gRPC should be ignored in this case.
+
+If you specifically need to use a vendored gRPC package, it's best to avoid
+using ``go_proto_library`` altogether. You can check in pre-generated .pb.go
+files and build them with ``go_library`` rules. Gazelle will generate these
+rules when proto rule generation is disabled (add ``# gazelle:proto
+disable_global`` to your root build file).
+
+How do I use different versions of dependencies?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+See `Overriding dependencies`_ for instructions on overriding repositories
+declared in `go_rules_dependencies`_.
+
+
+How do I run Bazel on Travis CI?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+References:
+
+* `Running Bazel Tests on Travis CI`_ by Kevin Burke
+* `korfuri/bazel-travis Use Bazel with Travis CI`_
+
+In order to run Bazel tests on Travis CI, you'll need to install Bazel in the
+``before_install`` script. See our configuration file linked above.
+
+You'll want to run Bazel with a number of flags to prevent it from consuming
+a huge amount of memory in the test environment.
+
+* ``--host_jvm_args=-Xmx500m --host_jvm_args=-Xms500m``: Set the maximum and
+ initial JVM heap size. Keeping the same means the JVM won't spend time
+ growing the heap. The choice of heap size is somewhat arbitrary; other
+ configuration files recommend limits as high as 2500m. Higher values mean
+ a faster build, but higher risk of OOM kill.
+* ``--bazelrc=.test-bazelrc``: Use a Bazel configuration file specific to
+ Travis CI. You can put most of the remaining options in here.
+* ``build --spawn_strategy=standalone --genrule_strategy=standalone``: Disable
+ sandboxing for the build. Sandboxing may fail inside of Travis's containers
+ because the ``mount`` system call is not permitted.
+* ``test --test_strategy=standalone``: Disable sandboxing for tests as well.
+* ``--local_resources=1536,1.5,0.5``: Set Bazel limits on available RAM in MB,
+ available cores for compute, and available cores for I/O. Higher values
+ mean a faster build, but higher contention and risk of OOM kill.
+* ``--noshow_progress``: Suppress progress messages in output for cleaner logs.
+* ``--verbose_failures``: Get more detailed failure messages.
+* ``--test_output=errors``: Show test stderr in the Travis log. Normally,
+ test output is written log files which Travis does not save or report.
+
+Downloads on Travis are relatively slow (the network is heavily
+contended), so you'll want to minimize the amount of network I/O in
+your build. Downloading Bazel and a Go SDK is a huge part of that. To
+avoid downloading a Go SDK, you may request a container with a
+preinstalled version of Go in your ``.travis.yml`` file, then call
+``go_register_toolchains(go_version = "host")`` in a Travis-specific
+``WORKSPACE`` file.
+
+You may be tempted to put Bazel's cache in your Travis cache. Although this
+can speed up your build significantly, Travis stores its cache on Amazon, and
+it takes a very long time to transfer. Clean builds seem faster in practice.
+
+How do I test a beta version of the Go SDK?
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+rules_go only supports official releases of the Go SDK. However, you can still
+test beta and RC versions by passing a ``version`` like ``"1.16beta1"`` to
+`go_register_toolchains`_. See also `go_download_sdk`_.
+
+.. code:: bzl
+
+ load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
+
+ go_rules_dependencies()
+
+ go_register_toolchains(version = "1.17beta1")
diff --git a/WORKSPACE b/WORKSPACE
new file mode 100644
index 00000000..3e894e07
--- /dev/null
+++ b/WORKSPACE
@@ -0,0 +1,181 @@
+workspace(name = "io_bazel_rules_go")
+
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
+
+go_rules_dependencies()
+
+go_register_toolchains(version = "1.20.2")
+
+http_archive(
+ name = "com_google_protobuf",
+ sha256 = "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae",
+ strip_prefix = "protobuf-21.7",
+ # latest available in BCR, as of 2022-09-30
+ urls = [
+ "https://github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz",
+ "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz",
+ ],
+)
+
+load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
+
+protobuf_deps()
+
+load("@io_bazel_rules_go//extras:embed_data_deps.bzl", "go_embed_data_dependencies")
+
+go_embed_data_dependencies()
+
+# Used by //tests:buildifier_test.
+http_archive(
+ name = "com_github_bazelbuild_buildtools",
+ sha256 = "ca524d4df8c91838b9e80543832cf54d945e8045f6a2b9db1a1d02eec20e8b8c",
+ strip_prefix = "buildtools-6.0.1",
+ # latest, as of 2023-03-27
+ urls = ["https://github.com/bazelbuild/buildtools/archive/refs/tags/6.0.1.tar.gz"],
+)
+
+# For manual testing against an LLVM toolchain.
+# Use --crosstool_top=@llvm_toolchain//:toolchain
+http_archive(
+ name = "com_grail_bazel_toolchain",
+ sha256 = "d312c8e3a19ff843fce3065bb9ff40964401e8525674c842a5724b939cb6e1ac",
+ strip_prefix = "bazel-toolchain-0.4.4",
+ urls = ["https://github.com/grailbio/bazel-toolchain/archive/0.4.4.tar.gz"],
+)
+
+load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
+
+llvm_toolchain(
+ name = "llvm_toolchain",
+ llvm_version = "8.0.0",
+)
+
+http_archive(
+ name = "bazelci_rules",
+ sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e",
+ strip_prefix = "bazelci_rules-1.0.0",
+ url = "https://github.com/bazelbuild/continuous-integration/releases/download/rules-1.0.0/bazelci_rules-1.0.0.tar.gz",
+)
+
+load("@bazelci_rules//:rbe_repo.bzl", "rbe_preconfig")
+
+# Creates a default toolchain config for RBE.
+# Use this as is if you are using the rbe_ubuntu16_04 container,
+# otherwise refer to RBE docs.
+rbe_preconfig(
+ name = "buildkite_config",
+ toolchain = "ubuntu1804-bazel-java11",
+)
+
+# Needed for tests and tools
+load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
+
+bazel_skylib_workspace()
+
+http_archive(
+ name = "bazel_gazelle",
+ sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405",
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
+ "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
+ ],
+)
+
+load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
+
+go_repository(
+ name = "com_github_google_go_github_v36",
+ importpath = "github.com/google/go-github/v36",
+ sum = "h1:ndCzM616/oijwufI7nBRa+5eZHLldT+4yIB68ib5ogs=",
+ version = "v36.0.0",
+)
+
+go_repository(
+ name = "com_github_google_go_querystring",
+ importpath = "github.com/google/go-querystring",
+ sum = "h1:AnCroh3fv4ZBgVIf1Iwtovgjaw/GiKJo8M8yD/fhyJ8=",
+ version = "v1.1.0",
+)
+
+go_repository(
+ name = "org_golang_x_mod",
+ importpath = "golang.org/x/mod",
+ sum = "h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=",
+ version = "v0.9.0",
+)
+
+go_repository(
+ name = "org_golang_x_sync",
+ importpath = "golang.org/x/sync",
+ sum = "h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=",
+ version = "v0.1.0",
+)
+
+go_repository(
+ name = "org_golang_x_oauth2",
+ importpath = "golang.org/x/oauth2",
+ sum = "h1:Lh8GPgSKBfWSwFvtuWOfeI3aAAnbXTSutYxJiOJFgIw=",
+ version = "v0.6.0",
+)
+
+# TODO(sluongng): Gazelle v0.25.0 switched to static dependency resolution which cause
+# build files generation in external dependencies to wrongly resolve these repositories.
+# We should investigate in Gazelle why this happen and fix it.
+# For now, use manual mapping as a workaround.
+#
+# gazelle:repository go_repository name=org_golang_x_tools importpath=golang.org/x/tools
+# gazelle:repository go_repository name=org_golang_x_text importpath=golang.org/x/text
+# gazelle:repository go_repository name=org_golang_x_xerrors importpath=golang.org/x/xerrors
+# gazelle:repository go_repository name=org_golang_x_net importpath=golang.org/x/net
+# gazelle:repository go_repository name=org_golang_x_sys importpath=golang.org/x/sys
+# gazelle:repository go_repository name=org_golang_x_crypto importpath=golang.org/x/crypto
+
+load("@io_bazel_rules_go//tests/legacy/test_chdir:remote.bzl", "test_chdir_remote")
+
+test_chdir_remote()
+
+load("@io_bazel_rules_go//tests/integration/popular_repos:popular_repos.bzl", "popular_repos")
+
+popular_repos()
+
+load("@io_bazel_rules_go//tests:grpc_repos.bzl", "grpc_dependencies")
+
+grpc_dependencies()
+
+gazelle_dependencies()
+
+local_repository(
+ name = "runfiles_remote_test",
+ path = "tests/core/runfiles/runfiles_remote_test",
+)
+
+# For API doc generation
+# This is a dev dependency, users should not need to install it
+# so we declare it in the WORKSPACE
+http_archive(
+ name = "io_bazel_stardoc",
+ sha256 = "3fd8fec4ddec3c670bd810904e2e33170bedfe12f90adf943508184be458c8bb",
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz",
+ "https://github.com/bazelbuild/stardoc/releases/download/0.5.3/stardoc-0.5.3.tar.gz",
+ ],
+)
+
+load("@io_bazel_stardoc//:setup.bzl", "stardoc_repositories")
+
+stardoc_repositories()
+
+# For testing objc_library interop, users should not need to install it
+http_archive(
+ name = "build_bazel_apple_support",
+ sha256 = "77a121a0f5d4cd88824429464ad2bfb54bdc8a3bccdb4d31a6c846003a3f5e44",
+ url = "https://github.com/bazelbuild/apple_support/releases/download/1.4.1/apple_support.1.4.1.tar.gz",
+)
+
+load(
+ "@build_bazel_apple_support//lib:repositories.bzl",
+ "apple_support_dependencies",
+)
+
+apple_support_dependencies()
diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel
new file mode 100644
index 00000000..caf61b51
--- /dev/null
+++ b/docs/BUILD.bazel
@@ -0,0 +1,19 @@
+load("//docs:doc_helpers.bzl", "stardoc_with_diff_test", "update_docs")
+
+# For each doc file, generate MD from bzl_library, then perform diff test
+stardoc_with_diff_test(
+ bzl_library_target = "//docs/go/extras:extras",
+ out_label = "//docs/go/extras:extras.md",
+ rule_template = "rule_body.vm",
+)
+
+stardoc_with_diff_test(
+ bzl_library_target = "//docs/go/core:rules",
+ out_label = "//docs/go/core:rules.md",
+ rule_template = "rule_body.vm",
+)
+
+# Update MD in local source tree
+update_docs(
+ name = "update",
+)
diff --git a/docs/doc_helpers.bzl b/docs/doc_helpers.bzl
new file mode 100644
index 00000000..dbec0d5f
--- /dev/null
+++ b/docs/doc_helpers.bzl
@@ -0,0 +1,84 @@
+load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
+load("@bazel_skylib//rules:write_file.bzl", "write_file")
+load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
+
+def stardoc_with_diff_test(
+ bzl_library_target,
+ out_label,
+ rule_template = "@io_bazel_stardoc//stardoc:templates/markdown_tables/rule.vm"):
+ """Creates a stardoc target coupled with a diff_test for a given bzl_library.
+
+ This is helpful for minimizing boilerplate when lots of stardoc targets are to be generated.
+
+ Args:
+ bzl_library_target: the label of the bzl_library target to generate documentation for
+ out_label: the label of the output MD file
+ rule_template: the label or path to the Velocity rule template to use with stardoc
+ """
+
+ out_file = out_label.replace("//", "").replace(":", "/")
+
+ # Generate MD from .bzl
+ stardoc(
+ name = out_file.replace("/", "_").replace(".md", "-docgen"),
+ out = out_file.replace(".md", "-docgen.md"),
+ input = bzl_library_target + ".bzl",
+ rule_template = rule_template,
+ deps = [bzl_library_target],
+ )
+
+ # Ensure that the generated MD has been updated in the local source tree
+ diff_test(
+ name = out_file.replace("/", "_").replace(".md", "-difftest"),
+ failure_message = "Please run \"bazel run //docs:update\"",
+ # Source file
+ file1 = out_label,
+ # Output from stardoc rule above
+ file2 = out_file.replace(".md", "-docgen.md"),
+ )
+
+def update_docs(
+ name = "update",
+ docs_folder = "docs"):
+ """Creates a sh_binary target which copies over generated doc files to the local source tree.
+
+ This is to be used in tandem with `stardoc_with_diff_test()` to produce a convenient workflow
+ for generating, testing, and updating all doc files as follows:
+
+ ``` bash
+ bazel build //{docs_folder}/... && bazel test //{docs_folder}/... && bazel run //{docs_folder}:update
+ ```
+
+ eg.
+
+ ``` bash
+ bazel build //docs/... && bazel test //docs/... && bazel run //docs:update
+ ```
+
+ Args:
+ name: the name of the sh_binary target
+ docs_folder: the name of the folder containing the doc files in the local source tree
+ """
+ content = ["#!/usr/bin/env bash", "cd ${BUILD_WORKSPACE_DIRECTORY}"]
+ data = []
+ for r in native.existing_rules().values():
+ if r["kind"] == "stardoc":
+ doc_gen = r["out"]
+ if doc_gen.startswith(":"):
+ doc_gen = doc_gen[1:]
+ doc_dest = doc_gen.replace("-docgen.md", ".md")
+ data.append(doc_gen)
+ content.append("cp -fv bazel-bin/{0}/{1} {2}".format(docs_folder, doc_gen, doc_dest))
+
+ update_script = name + ".sh"
+ write_file(
+ name = "gen_" + name,
+ out = update_script,
+ content = content,
+ )
+
+ native.sh_binary(
+ name = name,
+ srcs = [update_script],
+ data = data,
+ )
diff --git a/docs/go/core/BUILD.bazel b/docs/go/core/BUILD.bazel
new file mode 100644
index 00000000..b43a6d9e
--- /dev/null
+++ b/docs/go/core/BUILD.bazel
@@ -0,0 +1,22 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+
+exports_files([
+ "rules.md",
+ "rules.bzl",
+])
+
+bzl_library(
+ name = "rules",
+ srcs = ["rules.bzl"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "//go/private:rpath",
+ "//go/private/rules:binary",
+ "//go/private/rules:cross",
+ "//go/private/rules:library",
+ "//go/private/rules:library.bzl",
+ "//go/private/rules:source",
+ "//go/private/rules:test",
+ "//go/private/tools:path",
+ ],
+)
diff --git a/docs/go/core/buildgraph.excalidraw b/docs/go/core/buildgraph.excalidraw
new file mode 100644
index 00000000..60250523
--- /dev/null
+++ b/docs/go/core/buildgraph.excalidraw
@@ -0,0 +1,2260 @@
+{
+ "type": "excalidraw",
+ "version": 2,
+ "source": "https://excalidraw.com",
+ "elements": [
+ {
+ "type": "line",
+ "version": 715,
+ "versionNonce": 1588502918,
+ "isDeleted": false,
+ "id": "y8btfe8aNxR4U0rku_mYn",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "dashed",
+ "roughness": 1,
+ "opacity": 40,
+ "angle": 0,
+ "x": 1132.107421875,
+ "y": 236.83398437500003,
+ "strokeColor": "#000000",
+ "backgroundColor": "#fd7e14",
+ "width": 856.15234375,
+ "height": 307.21875,
+ "seed": 661091153,
+ "groupIds": [],
+ "strokeSharpness": "round",
+ "boundElements": [],
+ "updated": 1648705107325,
+ "link": null,
+ "startBinding": null,
+ "endBinding": null,
+ "lastCommittedPoint": null,
+ "startArrowhead": null,
+ "endArrowhead": null,
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ -100.4296875,
+ 127.29296875
+ ],
+ [
+ -183.92578125,
+ 159.54296875
+ ],
+ [
+ -667.21484375,
+ 167.625
+ ],
+ [
+ -628.08203125,
+ 301.1796875
+ ],
+ [
+ -78.0703125,
+ 307.21875
+ ],
+ [
+ 188.9375,
+ 73.36328125
+ ],
+ [
+ 0,
+ 0
+ ]
+ ]
+ },
+ {
+ "type": "rectangle",
+ "version": 423,
+ "versionNonce": 1905005330,
+ "isDeleted": false,
+ "id": "_Yn448UDpyk8bgZY0fA9l",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 526.61328125,
+ "y": 160.484375,
+ "strokeColor": "#000000",
+ "backgroundColor": "#82c91e",
+ "width": 135.75390625,
+ "height": 68.09375,
+ "seed": 860180077,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "id": "aFKsLgjkb7lO7X9odAH4Z",
+ "type": "arrow"
+ }
+ ],
+ "updated": 1645713106334,
+ "link": null
+ },
+ {
+ "type": "rectangle",
+ "version": 400,
+ "versionNonce": 2122489170,
+ "isDeleted": false,
+ "id": "HzjwDEtdpACOtsMXQz4qR",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 515.8046875,
+ "y": -23.1875,
+ "strokeColor": "#000000",
+ "backgroundColor": "#82c91e",
+ "width": 188,
+ "height": 69,
+ "seed": 1527037778,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "id": "aFKsLgjkb7lO7X9odAH4Z",
+ "type": "arrow"
+ },
+ {
+ "type": "text",
+ "id": "XdeK36TNlGK4oDnK0QljI"
+ },
+ {
+ "id": "gg8sTvMlfTEUCsO1BcBVQ",
+ "type": "arrow"
+ }
+ ],
+ "updated": 1645713058816,
+ "link": null
+ },
+ {
+ "type": "rectangle",
+ "version": 450,
+ "versionNonce": 377362638,
+ "isDeleted": false,
+ "id": "nG82Pemyxdap8-2WgkNKA",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 517,
+ "y": -110.83984375,
+ "strokeColor": "#000000",
+ "backgroundColor": "#82c91e",
+ "width": 188,
+ "height": 69,
+ "seed": 1392990674,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "id": "aFKsLgjkb7lO7X9odAH4Z",
+ "type": "arrow"
+ },
+ {
+ "id": "iI9z1qPn6RQpZWPzVundB",
+ "type": "text"
+ },
+ {
+ "id": "gg8sTvMlfTEUCsO1BcBVQ",
+ "type": "arrow"
+ },
+ {
+ "type": "text",
+ "id": "iI9z1qPn6RQpZWPzVundB"
+ }
+ ],
+ "updated": 1645713058816,
+ "link": null
+ },
+ {
+ "type": "text",
+ "version": 272,
+ "versionNonce": 1262477070,
+ "isDeleted": false,
+ "id": "DbWhovpUmSW3P2ULquXGH",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 547.859375,
+ "y": 182.69140625,
+ "strokeColor": "#000000",
+ "backgroundColor": "#82c91e",
+ "width": 101,
+ "height": 25,
+ "seed": 906895950,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713106334,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "foo/foo.go",
+ "baseline": 18,
+ "textAlign": "left",
+ "verticalAlign": "top",
+ "containerId": null,
+ "originalText": "foo/foo.go"
+ },
+ {
+ "type": "rectangle",
+ "version": 463,
+ "versionNonce": 1887166674,
+ "isDeleted": false,
+ "id": "_xbH0JhODNrj71g2D9gkP",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 523.83203125,
+ "y": 278.546875,
+ "strokeColor": "#000000",
+ "backgroundColor": "#82c91e",
+ "width": 135.75390625,
+ "height": 68.09375,
+ "seed": 2061882962,
+ "groupIds": [
+ "4kSMwuKzk3B7ostEFiZq2"
+ ],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "id": "RenCmXsoXx0fGBRKi5_26",
+ "type": "arrow"
+ }
+ ],
+ "updated": 1645713106334,
+ "link": null
+ },
+ {
+ "type": "text",
+ "version": 300,
+ "versionNonce": 1313656142,
+ "isDeleted": false,
+ "id": "iqePQyDoLs8KfvrRwplFb",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 542.70703125,
+ "y": 299.05859375,
+ "strokeColor": "#000000",
+ "backgroundColor": "#82c91e",
+ "width": 102,
+ "height": 25,
+ "seed": 1875308494,
+ "groupIds": [
+ "4kSMwuKzk3B7ostEFiZq2"
+ ],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713106334,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "bar/bar.go",
+ "baseline": 18,
+ "textAlign": "left",
+ "verticalAlign": "top",
+ "containerId": null,
+ "originalText": "bar/bar.go"
+ },
+ {
+ "type": "rectangle",
+ "version": 589,
+ "versionNonce": 2132796058,
+ "isDeleted": false,
+ "id": "0pqTrsCrwG6n6wgsz7SgC",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 526.15234375,
+ "y": 416.25,
+ "strokeColor": "#000000",
+ "backgroundColor": "#82c91e",
+ "width": 135.75390625,
+ "height": 68.09375,
+ "seed": 377700942,
+ "groupIds": [
+ "eCCem_f9xwDhl8kXZowGD"
+ ],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "id": "4LKhA3K_w1H2L003EIMw2",
+ "type": "arrow"
+ }
+ ],
+ "updated": 1648705120553,
+ "link": null
+ },
+ {
+ "type": "text",
+ "version": 381,
+ "versionNonce": 1832430598,
+ "isDeleted": false,
+ "id": "dJOSRocJhisFxXPfh3dF7",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 559.0859375,
+ "y": 436.62890625,
+ "strokeColor": "#000000",
+ "backgroundColor": "#82c91e",
+ "width": 67,
+ "height": 25,
+ "seed": 2013483410,
+ "groupIds": [
+ "eCCem_f9xwDhl8kXZowGD"
+ ],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1648705120554,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "main.go",
+ "baseline": 18,
+ "textAlign": "left",
+ "verticalAlign": "top",
+ "containerId": null,
+ "originalText": "main.go"
+ },
+ {
+ "type": "rectangle",
+ "version": 327,
+ "versionNonce": 598472338,
+ "isDeleted": false,
+ "id": "ktywT8Qylp8edNPAyJ97P",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 826.0078125,
+ "y": 159.49609375,
+ "strokeColor": "#000000",
+ "backgroundColor": "#fab005",
+ "width": 158,
+ "height": 75.1640625,
+ "seed": 205846418,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "type": "text",
+ "id": "Dzp14kB83qtIZDUQDD5SD"
+ },
+ {
+ "id": "aFKsLgjkb7lO7X9odAH4Z",
+ "type": "arrow"
+ },
+ {
+ "id": "gfz01PbwrOcATNOv4UJYH",
+ "type": "arrow"
+ },
+ {
+ "id": "JzL3QRbsha0aBVxbGukeT",
+ "type": "arrow"
+ }
+ ],
+ "updated": 1645713106334,
+ "link": null
+ },
+ {
+ "type": "rectangle",
+ "version": 803,
+ "versionNonce": 1314669006,
+ "isDeleted": false,
+ "id": "96rPjdc8UZN-YzZFtZKgl",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 834.0000000000002,
+ "y": 31.3125,
+ "strokeColor": "#000000",
+ "backgroundColor": "#fab005",
+ "width": 158,
+ "height": 75.1640625,
+ "seed": 523095310,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "id": "E-9hQ7N5qrOcGvUNiQiKh",
+ "type": "text"
+ },
+ {
+ "id": "02WhVqVlyTmahvSW4ProQ",
+ "type": "arrow"
+ },
+ {
+ "id": "gfz01PbwrOcATNOv4UJYH",
+ "type": "arrow"
+ },
+ {
+ "id": "JzL3QRbsha0aBVxbGukeT",
+ "type": "arrow"
+ },
+ {
+ "type": "text",
+ "id": "E-9hQ7N5qrOcGvUNiQiKh"
+ }
+ ],
+ "updated": 1645713058816,
+ "link": null
+ },
+ {
+ "type": "rectangle",
+ "version": 403,
+ "versionNonce": 98306578,
+ "isDeleted": false,
+ "id": "-UZKzAkD5QFkhlYnkmn_1",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 869.734375,
+ "y": -103.796875,
+ "strokeColor": "#000000",
+ "backgroundColor": "#82c91e",
+ "width": 190,
+ "height": 76,
+ "seed": 5847762,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "id": "SozLW7ytDBjhY_zbGCVlc",
+ "type": "text"
+ },
+ {
+ "id": "aFKsLgjkb7lO7X9odAH4Z",
+ "type": "arrow"
+ },
+ {
+ "id": "gfz01PbwrOcATNOv4UJYH",
+ "type": "arrow"
+ },
+ {
+ "id": "JzL3QRbsha0aBVxbGukeT",
+ "type": "arrow"
+ },
+ {
+ "type": "text",
+ "id": "SozLW7ytDBjhY_zbGCVlc"
+ },
+ {
+ "id": "gg8sTvMlfTEUCsO1BcBVQ",
+ "type": "arrow"
+ },
+ {
+ "id": "02WhVqVlyTmahvSW4ProQ",
+ "type": "arrow"
+ }
+ ],
+ "updated": 1645713058816,
+ "link": null
+ },
+ {
+ "type": "rectangle",
+ "version": 325,
+ "versionNonce": 754471374,
+ "isDeleted": false,
+ "id": "1hsA_FOvShESw1vZOfRki",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 823.0390625,
+ "y": 280.15625,
+ "strokeColor": "#000000",
+ "backgroundColor": "#fab005",
+ "width": 158,
+ "height": 75.1640625,
+ "seed": 1605551566,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "id": "mk113WrHJaj6g3-UUKDH7",
+ "type": "text"
+ },
+ {
+ "id": "RenCmXsoXx0fGBRKi5_26",
+ "type": "arrow"
+ },
+ {
+ "type": "text",
+ "id": "mk113WrHJaj6g3-UUKDH7"
+ }
+ ],
+ "updated": 1645713106334,
+ "link": null
+ },
+ {
+ "type": "rectangle",
+ "version": 265,
+ "versionNonce": 1793939098,
+ "isDeleted": false,
+ "id": "IssDOZSbCLaPJjJ4_ILh0",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 823.2265625,
+ "y": 413.234375,
+ "strokeColor": "#000000",
+ "backgroundColor": "#fab005",
+ "width": 158,
+ "height": 75.1640625,
+ "seed": 261187278,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "id": "HTOlHr-Ui1zDseI3sfY9K",
+ "type": "text"
+ },
+ {
+ "id": "4LKhA3K_w1H2L003EIMw2",
+ "type": "arrow"
+ },
+ {
+ "id": "HTOlHr-Ui1zDseI3sfY9K",
+ "type": "text"
+ },
+ {
+ "type": "text",
+ "id": "HTOlHr-Ui1zDseI3sfY9K"
+ }
+ ],
+ "updated": 1648705117196,
+ "link": null
+ },
+ {
+ "type": "text",
+ "version": 276,
+ "versionNonce": 908194702,
+ "isDeleted": false,
+ "id": "Dzp14kB83qtIZDUQDD5SD",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 831.0078125,
+ "y": 184.578125,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 148,
+ "height": 25,
+ "seed": 173132430,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713106334,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "foo_archive",
+ "baseline": 18,
+ "textAlign": "center",
+ "verticalAlign": "middle",
+ "containerId": "ktywT8Qylp8edNPAyJ97P",
+ "originalText": "foo_archive"
+ },
+ {
+ "type": "text",
+ "version": 758,
+ "versionNonce": 2141859218,
+ "isDeleted": false,
+ "id": "E-9hQ7N5qrOcGvUNiQiKh",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 839.0000000000002,
+ "y": 56.39453125,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 148,
+ "height": 25,
+ "seed": 220975826,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713058816,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "test_archive",
+ "baseline": 18,
+ "textAlign": "center",
+ "verticalAlign": "middle",
+ "containerId": "96rPjdc8UZN-YzZFtZKgl",
+ "originalText": "test_archive"
+ },
+ {
+ "type": "text",
+ "version": 363,
+ "versionNonce": 1233562766,
+ "isDeleted": false,
+ "id": "SozLW7ytDBjhY_zbGCVlc",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 874.734375,
+ "y": -78.296875,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 180,
+ "height": 25,
+ "seed": 956961614,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713058816,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "test_source.go",
+ "baseline": 18,
+ "textAlign": "center",
+ "verticalAlign": "middle",
+ "containerId": "-UZKzAkD5QFkhlYnkmn_1",
+ "originalText": "test_source.go"
+ },
+ {
+ "type": "text",
+ "version": 288,
+ "versionNonce": 2059991570,
+ "isDeleted": false,
+ "id": "mk113WrHJaj6g3-UUKDH7",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 828.0390625,
+ "y": 305.23828125,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 148,
+ "height": 25,
+ "seed": 1042269714,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713106334,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "bar_archive",
+ "baseline": 18,
+ "textAlign": "center",
+ "verticalAlign": "middle",
+ "containerId": "1hsA_FOvShESw1vZOfRki",
+ "originalText": "bar_archive"
+ },
+ {
+ "type": "text",
+ "version": 186,
+ "versionNonce": 1163782862,
+ "isDeleted": false,
+ "id": "HTOlHr-Ui1zDseI3sfY9K",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 828.2265625,
+ "y": 438.31640625,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 148,
+ "height": 25,
+ "seed": 2042082578,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713058816,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "main_archive",
+ "baseline": 18,
+ "textAlign": "center",
+ "verticalAlign": "middle",
+ "containerId": "IssDOZSbCLaPJjJ4_ILh0",
+ "originalText": "main_archive"
+ },
+ {
+ "type": "arrow",
+ "version": 768,
+ "versionNonce": 383410450,
+ "isDeleted": false,
+ "id": "aFKsLgjkb7lO7X9odAH4Z",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 671.875,
+ "y": 192.01815773762468,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 146.4375,
+ "height": 4.775870872813329,
+ "seed": 1274321422,
+ "groupIds": [],
+ "strokeSharpness": "round",
+ "boundElements": [],
+ "updated": 1645713106864,
+ "link": null,
+ "startBinding": {
+ "elementId": "y92Fllrdc8UjAmzlSayru",
+ "focus": 1.5333143038068908,
+ "gap": 7.619720237624676
+ },
+ "endBinding": {
+ "elementId": "ktywT8Qylp8edNPAyJ97P",
+ "focus": -0.06333301495760145,
+ "gap": 7.6953125
+ },
+ "lastCommittedPoint": null,
+ "startArrowhead": null,
+ "endArrowhead": "arrow",
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 146.4375,
+ 4.775870872813329
+ ]
+ ]
+ },
+ {
+ "type": "arrow",
+ "version": 1836,
+ "versionNonce": 942891278,
+ "isDeleted": false,
+ "id": "02WhVqVlyTmahvSW4ProQ",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 953.1035887473417,
+ "y": -13.566406249999774,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 20.944314879108333,
+ "height": 37.18359374999977,
+ "seed": 172817230,
+ "groupIds": [],
+ "strokeSharpness": "round",
+ "boundElements": [],
+ "updated": 1645713058816,
+ "link": null,
+ "startBinding": {
+ "elementId": "-UZKzAkD5QFkhlYnkmn_1",
+ "focus": -0.15324622745821068,
+ "gap": 14.230468750000227
+ },
+ "endBinding": {
+ "elementId": "96rPjdc8UZN-YzZFtZKgl",
+ "focus": -0.06333301495760137,
+ "gap": 7.6953125
+ },
+ "lastCommittedPoint": null,
+ "startArrowhead": null,
+ "endArrowhead": "arrow",
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ -20.944314879108333,
+ 37.18359374999977
+ ]
+ ]
+ },
+ {
+ "type": "arrow",
+ "version": 781,
+ "versionNonce": 591753486,
+ "isDeleted": false,
+ "id": "RenCmXsoXx0fGBRKi5_26",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 668.7734375,
+ "y": 312.67688026346684,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 146.5703125,
+ "height": 4.778341675082629,
+ "seed": 154459150,
+ "groupIds": [],
+ "strokeSharpness": "round",
+ "boundElements": [],
+ "updated": 1645713106864,
+ "link": null,
+ "startBinding": {
+ "elementId": "OWV5oGIX-s5xyq6g_m2zZ",
+ "focus": 1.4490929667636174,
+ "gap": 7.15234375
+ },
+ "endBinding": {
+ "elementId": "1hsA_FOvShESw1vZOfRki",
+ "focus": -0.06333301495760026,
+ "gap": 7.6953125
+ },
+ "lastCommittedPoint": null,
+ "startArrowhead": null,
+ "endArrowhead": "arrow",
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 146.5703125,
+ 4.778341675082629
+ ]
+ ]
+ },
+ {
+ "type": "arrow",
+ "version": 385,
+ "versionNonce": 78116890,
+ "isDeleted": false,
+ "id": "4LKhA3K_w1H2L003EIMw2",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 669.2109375,
+ "y": 445.7575776527482,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 146.3203125,
+ "height": 4.7737708541606025,
+ "seed": 1721195790,
+ "groupIds": [],
+ "strokeSharpness": "round",
+ "boundElements": [],
+ "updated": 1648705118191,
+ "link": null,
+ "startBinding": {
+ "elementId": "0pqTrsCrwG6n6wgsz7SgC",
+ "focus": -0.19283711924306857,
+ "gap": 7.3046875
+ },
+ "endBinding": {
+ "elementId": "IssDOZSbCLaPJjJ4_ILh0",
+ "focus": -0.06333301495760026,
+ "gap": 7.6953125
+ },
+ "lastCommittedPoint": null,
+ "startArrowhead": null,
+ "endArrowhead": "arrow",
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 146.3203125,
+ 4.7737708541606025
+ ]
+ ]
+ },
+ {
+ "type": "text",
+ "version": 350,
+ "versionNonce": 13085330,
+ "isDeleted": false,
+ "id": "y92Fllrdc8UjAmzlSayru",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 676.77734375,
+ "y": 159.3984375,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 128,
+ "height": 25,
+ "seed": 1522598802,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "id": "aFKsLgjkb7lO7X9odAH4Z",
+ "type": "arrow"
+ },
+ {
+ "id": "D1sm8V-f_lwosorRMX2Pj",
+ "type": "arrow"
+ }
+ ],
+ "updated": 1645713127078,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "GoCompilePkg",
+ "baseline": 18,
+ "textAlign": "left",
+ "verticalAlign": "top",
+ "containerId": null,
+ "originalText": "GoCompilePkg"
+ },
+ {
+ "type": "text",
+ "version": 430,
+ "versionNonce": 2040329614,
+ "isDeleted": false,
+ "id": "AVQpPcZ2l6tF482laHpQm",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 958.4257812500002,
+ "y": -14.23046875,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 128,
+ "height": 25,
+ "seed": 1234020498,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713058816,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "GoCompilePkg",
+ "baseline": 18,
+ "textAlign": "left",
+ "verticalAlign": "top",
+ "containerId": null,
+ "originalText": "GoCompilePkg"
+ },
+ {
+ "type": "text",
+ "version": 373,
+ "versionNonce": 1338350418,
+ "isDeleted": false,
+ "id": "OWV5oGIX-s5xyq6g_m2zZ",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 675.92578125,
+ "y": 281.359375,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 128,
+ "height": 25,
+ "seed": 1981887442,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "id": "RenCmXsoXx0fGBRKi5_26",
+ "type": "arrow"
+ }
+ ],
+ "updated": 1645713106334,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "GoCompilePkg",
+ "baseline": 18,
+ "textAlign": "left",
+ "verticalAlign": "top",
+ "containerId": null,
+ "originalText": "GoCompilePkg"
+ },
+ {
+ "type": "text",
+ "version": 263,
+ "versionNonce": 230888398,
+ "isDeleted": false,
+ "id": "XFDzOG61LR012x-J2LGIJ",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 675.609375,
+ "y": 418.51953125,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 128,
+ "height": 25,
+ "seed": 1994605266,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713058817,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "GoCompilePkg",
+ "baseline": 18,
+ "textAlign": "left",
+ "verticalAlign": "top",
+ "containerId": null,
+ "originalText": "GoCompilePkg"
+ },
+ {
+ "type": "line",
+ "version": 1696,
+ "versionNonce": 1947902610,
+ "isDeleted": false,
+ "id": "CCr_7bBDw6qxEnXcYPkhb",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 984.40625,
+ "y": 176.43359375,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 106.10546875,
+ "height": 313.45703125,
+ "seed": 1367735442,
+ "groupIds": [],
+ "strokeSharpness": "round",
+ "boundElements": [],
+ "updated": 1645713058817,
+ "link": null,
+ "startBinding": null,
+ "endBinding": null,
+ "lastCommittedPoint": null,
+ "startArrowhead": null,
+ "endArrowhead": null,
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 34.70703125,
+ 59.4140625
+ ],
+ [
+ 7.453125,
+ 145.83984375
+ ],
+ [
+ 106.10546875,
+ 141.45703125
+ ],
+ [
+ 3.32421875,
+ 148.296875
+ ],
+ [
+ 35.30859375,
+ 220.953125
+ ],
+ [
+ 7.41796875,
+ 313.45703125
+ ]
+ ]
+ },
+ {
+ "type": "line",
+ "version": 1423,
+ "versionNonce": 164157838,
+ "isDeleted": false,
+ "id": "rSS_NGIY9mXlKvJ6zEKcS",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 698.2108315925065,
+ "y": -124.59268454085958,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 163.09322505611044,
+ "height": 177.3724073101255,
+ "seed": 1859243538,
+ "groupIds": [],
+ "strokeSharpness": "round",
+ "boundElements": [],
+ "updated": 1645713136400,
+ "link": null,
+ "startBinding": null,
+ "endBinding": null,
+ "lastCommittedPoint": null,
+ "startArrowhead": null,
+ "endArrowhead": null,
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 32.08840700592511,
+ 30.81405958552382
+ ],
+ [
+ 18.23841960974691,
+ 71.9505372729384
+ ],
+ [
+ 163.09322505611044,
+ 62.79260616948538
+ ],
+ [
+ 19.635544337568465,
+ 76.75792430959316
+ ],
+ [
+ 31.990871883416816,
+ 131.85248366531474
+ ],
+ [
+ 2.2395418237075546,
+ 177.3724073101255
+ ]
+ ]
+ },
+ {
+ "type": "line",
+ "version": 2422,
+ "versionNonce": 1368162386,
+ "isDeleted": false,
+ "id": "Adp4I3kUZ5DVOnLF_mvH-",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1004.0975503425063,
+ "y": 42.05965920914046,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 135.13493323240277,
+ "height": 110.7669385601255,
+ "seed": 830365522,
+ "groupIds": [],
+ "strokeSharpness": "round",
+ "boundElements": [],
+ "updated": 1645713058817,
+ "link": null,
+ "startBinding": null,
+ "endBinding": null,
+ "lastCommittedPoint": null,
+ "startArrowhead": null,
+ "endArrowhead": null,
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 6.061063255925092,
+ 30.10702833552382
+ ],
+ [
+ 47.98060710974687,
+ 63.634131022938405
+ ],
+ [
+ 118.47213130611044,
+ 61.53479366948538
+ ],
+ [
+ 61.26445058756849,
+ 63.09386180959315
+ ],
+ [
+ 7.69009063341673,
+ 78.96576491531472
+ ],
+ [
+ -16.66280192629233,
+ 110.7669385601255
+ ]
+ ]
+ },
+ {
+ "type": "text",
+ "version": 211,
+ "versionNonce": 1752999442,
+ "isDeleted": false,
+ "id": "jqwxeTyV2H4FXh6iMTzld",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1014.41015625,
+ "y": 282.78125,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 63,
+ "height": 25,
+ "seed": 417199122,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713058817,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "GoLink",
+ "baseline": 18,
+ "textAlign": "left",
+ "verticalAlign": "top",
+ "containerId": null,
+ "originalText": "GoLink"
+ },
+ {
+ "type": "text",
+ "version": 239,
+ "versionNonce": 1737882638,
+ "isDeleted": false,
+ "id": "QU_adpXt889Ir2oimAKco",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1048.234375,
+ "y": 120.48828125,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 63,
+ "height": 25,
+ "seed": 1994591822,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713058817,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "GoLink",
+ "baseline": 18,
+ "textAlign": "left",
+ "verticalAlign": "top",
+ "containerId": null,
+ "originalText": "GoLink"
+ },
+ {
+ "type": "rectangle",
+ "version": 311,
+ "versionNonce": 31593426,
+ "isDeleted": false,
+ "id": "3Fs-7jrpoFZjkiFhKyXwJ",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1104.68359375,
+ "y": 278.453125,
+ "strokeColor": "#000000",
+ "backgroundColor": "#15aabf",
+ "width": 145,
+ "height": 87,
+ "seed": 459479182,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "type": "text",
+ "id": "U_khjX5LJoOf7oHa3yvmX"
+ }
+ ],
+ "updated": 1645713058817,
+ "link": null
+ },
+ {
+ "type": "rectangle",
+ "version": 433,
+ "versionNonce": 332876366,
+ "isDeleted": false,
+ "id": "lAKw58pfZT2qHbLfCcLdZ",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1132.86328125,
+ "y": 62.6171875,
+ "strokeColor": "#000000",
+ "backgroundColor": "#15aabf",
+ "width": 145,
+ "height": 87,
+ "seed": 766158926,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "id": "XAa15ht9hRV0nmyVPWns_",
+ "type": "text"
+ },
+ {
+ "type": "text",
+ "id": "XAa15ht9hRV0nmyVPWns_"
+ },
+ {
+ "id": "FCxo6QVHjz9QekO1fdHyI",
+ "type": "arrow"
+ }
+ ],
+ "updated": 1645713058817,
+ "link": null
+ },
+ {
+ "type": "rectangle",
+ "version": 642,
+ "versionNonce": 802408850,
+ "isDeleted": false,
+ "id": "CIn87cWj794-yqk1m35z0",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1320.8125,
+ "y": 185.6171875,
+ "strokeColor": "#000000",
+ "backgroundColor": "#15aabf",
+ "width": 145,
+ "height": 87,
+ "seed": 494767758,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "id": "8UX-ttDyvCivRUrnxdAX9",
+ "type": "text"
+ },
+ {
+ "id": "8UX-ttDyvCivRUrnxdAX9",
+ "type": "text"
+ },
+ {
+ "id": "FCxo6QVHjz9QekO1fdHyI",
+ "type": "arrow"
+ },
+ {
+ "type": "text",
+ "id": "8UX-ttDyvCivRUrnxdAX9"
+ }
+ ],
+ "updated": 1645713058817,
+ "link": null
+ },
+ {
+ "type": "text",
+ "version": 206,
+ "versionNonce": 1062523022,
+ "isDeleted": false,
+ "id": "U_khjX5LJoOf7oHa3yvmX",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1109.68359375,
+ "y": 309.453125,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 135,
+ "height": 25,
+ "seed": 606262286,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713058817,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "go binary",
+ "baseline": 18,
+ "textAlign": "center",
+ "verticalAlign": "middle",
+ "containerId": "3Fs-7jrpoFZjkiFhKyXwJ",
+ "originalText": "go binary"
+ },
+ {
+ "type": "text",
+ "version": 332,
+ "versionNonce": 696829778,
+ "isDeleted": false,
+ "id": "XAa15ht9hRV0nmyVPWns_",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1137.86328125,
+ "y": 93.6171875,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 135,
+ "height": 25,
+ "seed": 1441614738,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713058817,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "test binary",
+ "baseline": 18,
+ "textAlign": "center",
+ "verticalAlign": "middle",
+ "containerId": "lAKw58pfZT2qHbLfCcLdZ",
+ "originalText": "test binary"
+ },
+ {
+ "type": "text",
+ "version": 554,
+ "versionNonce": 633835214,
+ "isDeleted": false,
+ "id": "8UX-ttDyvCivRUrnxdAX9",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1325.8125,
+ "y": 216.6171875,
+ "strokeColor": "#000000",
+ "backgroundColor": "transparent",
+ "width": 135,
+ "height": 25,
+ "seed": 768797010,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713058817,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "test result",
+ "baseline": 18,
+ "textAlign": "center",
+ "verticalAlign": "middle",
+ "containerId": "CIn87cWj794-yqk1m35z0",
+ "originalText": "test result"
+ },
+ {
+ "type": "text",
+ "version": 125,
+ "versionNonce": 660081938,
+ "isDeleted": false,
+ "id": "XdeK36TNlGK4oDnK0QljI",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 520.8046875,
+ "y": -1.1875,
+ "strokeColor": "#000000",
+ "backgroundColor": "#15aabf",
+ "width": 178,
+ "height": 25,
+ "seed": 1057364558,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713058817,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "foo/foo2_test.go",
+ "baseline": 18,
+ "textAlign": "center",
+ "verticalAlign": "middle",
+ "containerId": "HzjwDEtdpACOtsMXQz4qR",
+ "originalText": "foo/foo2_test.go"
+ },
+ {
+ "type": "text",
+ "version": 173,
+ "versionNonce": 600343822,
+ "isDeleted": false,
+ "id": "iI9z1qPn6RQpZWPzVundB",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 522,
+ "y": -88.83984375,
+ "strokeColor": "#000000",
+ "backgroundColor": "#15aabf",
+ "width": 178,
+ "height": 25,
+ "seed": 1192322126,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713058817,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "foo/foo_test.go",
+ "baseline": 18,
+ "textAlign": "center",
+ "verticalAlign": "middle",
+ "containerId": "nG82Pemyxdap8-2WgkNKA",
+ "originalText": "foo/foo_test.go"
+ },
+ {
+ "type": "text",
+ "version": 268,
+ "versionNonce": 449885006,
+ "isDeleted": false,
+ "id": "YXVK7QXRiUHU6OoO9Za9x",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 726.36328125,
+ "y": -42.26171875,
+ "strokeColor": "#000000",
+ "backgroundColor": "#15aabf",
+ "width": 130,
+ "height": 20,
+ "seed": 1377802510,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713058817,
+ "link": null,
+ "fontSize": 16,
+ "fontFamily": 1,
+ "text": "GoTestGenTest",
+ "baseline": 14,
+ "textAlign": "left",
+ "verticalAlign": "top",
+ "containerId": null,
+ "originalText": "GoTestGenTest"
+ },
+ {
+ "type": "arrow",
+ "version": 1022,
+ "versionNonce": 1044476050,
+ "isDeleted": false,
+ "id": "FCxo6QVHjz9QekO1fdHyI",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1289.5767145302918,
+ "y": 137.09954174565226,
+ "strokeColor": "#000000",
+ "backgroundColor": "#82c91e",
+ "width": 43.02415574638144,
+ "height": 37.753945950207225,
+ "seed": 789481298,
+ "groupIds": [],
+ "strokeSharpness": "round",
+ "boundElements": [],
+ "updated": 1645713058817,
+ "link": null,
+ "startBinding": {
+ "elementId": "lAKw58pfZT2qHbLfCcLdZ",
+ "focus": -0.4006325045780303,
+ "gap": 11.713433280291838
+ },
+ "endBinding": {
+ "elementId": "CIn87cWj794-yqk1m35z0",
+ "focus": 0.009231708544778436,
+ "gap": 10.763699804140515
+ },
+ "lastCommittedPoint": null,
+ "startArrowhead": null,
+ "endArrowhead": "arrow",
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 43.02415574638144,
+ 37.753945950207225
+ ]
+ ]
+ },
+ {
+ "type": "text",
+ "version": 76,
+ "versionNonce": 1792110098,
+ "isDeleted": false,
+ "id": "vfq9_DBY27vVxH1CzgHiN",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1297.51171875,
+ "y": 122.25390625,
+ "strokeColor": "#000000",
+ "backgroundColor": "#82c91e",
+ "width": 113,
+ "height": 25,
+ "seed": 1564226382,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "id": "T25vTTdMzWQ99VJDhDnIr",
+ "type": "arrow"
+ }
+ ],
+ "updated": 1645713173348,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "TestRunner",
+ "baseline": 18,
+ "textAlign": "left",
+ "verticalAlign": "top",
+ "containerId": null,
+ "originalText": "TestRunner"
+ },
+ {
+ "type": "rectangle",
+ "version": 85,
+ "versionNonce": 451071506,
+ "isDeleted": false,
+ "id": "1LuXAqePsPIRHC1KSeWe6",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 679.86328125,
+ "y": -263.30078125,
+ "strokeColor": "#000000",
+ "backgroundColor": "#ced4da",
+ "width": 128.14453125,
+ "height": 71.30859375,
+ "seed": 2134387474,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "type": "text",
+ "id": "dwSuTduGarUxTROMpgTP0"
+ },
+ {
+ "id": "w_ofYLqxsnoxd7X07Ob-e",
+ "type": "arrow"
+ },
+ {
+ "id": "vKbHoIFobYKpPbfLap6ot",
+ "type": "arrow"
+ },
+ {
+ "id": "D1sm8V-f_lwosorRMX2Pj",
+ "type": "arrow"
+ }
+ ],
+ "updated": 1645713113412,
+ "link": null
+ },
+ {
+ "type": "rectangle",
+ "version": 188,
+ "versionNonce": 1893353554,
+ "isDeleted": false,
+ "id": "r9bJymnryIHCkuEfO52Bs",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1405.390625,
+ "y": -51.140625,
+ "strokeColor": "#000000",
+ "backgroundColor": "#ced4da",
+ "width": 128.14453125,
+ "height": 71.30859375,
+ "seed": 1928682574,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [
+ {
+ "id": "yboxncedTfOgppKE1YKqS",
+ "type": "text"
+ },
+ {
+ "id": "w_ofYLqxsnoxd7X07Ob-e",
+ "type": "arrow"
+ },
+ {
+ "id": "vKbHoIFobYKpPbfLap6ot",
+ "type": "arrow"
+ },
+ {
+ "id": "D1sm8V-f_lwosorRMX2Pj",
+ "type": "arrow"
+ },
+ {
+ "type": "text",
+ "id": "yboxncedTfOgppKE1YKqS"
+ },
+ {
+ "id": "T25vTTdMzWQ99VJDhDnIr",
+ "type": "arrow"
+ }
+ ],
+ "updated": 1645713173348,
+ "link": null
+ },
+ {
+ "type": "text",
+ "version": 15,
+ "versionNonce": 613654994,
+ "isDeleted": false,
+ "id": "dwSuTduGarUxTROMpgTP0",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 684.86328125,
+ "y": -240.146484375,
+ "strokeColor": "#000000",
+ "backgroundColor": "#ced4da",
+ "width": 118,
+ "height": 25,
+ "seed": 346104078,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713058817,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "rules_go",
+ "baseline": 18,
+ "textAlign": "center",
+ "verticalAlign": "middle",
+ "containerId": "1LuXAqePsPIRHC1KSeWe6",
+ "originalText": "rules_go"
+ },
+ {
+ "type": "text",
+ "version": 121,
+ "versionNonce": 1757596366,
+ "isDeleted": false,
+ "id": "yboxncedTfOgppKE1YKqS",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1410.390625,
+ "y": -27.986328125,
+ "strokeColor": "#000000",
+ "backgroundColor": "#ced4da",
+ "width": 118,
+ "height": 25,
+ "seed": 1725421458,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713148919,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "bazel",
+ "baseline": 18,
+ "textAlign": "center",
+ "verticalAlign": "middle",
+ "containerId": "r9bJymnryIHCkuEfO52Bs",
+ "originalText": "bazel"
+ },
+ {
+ "type": "arrow",
+ "version": 258,
+ "versionNonce": 1238989906,
+ "isDeleted": false,
+ "id": "w_ofYLqxsnoxd7X07Ob-e",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 755.69140625,
+ "y": -178.3203125,
+ "strokeColor": "#000000",
+ "backgroundColor": "#ced4da",
+ "width": 59.74609375,
+ "height": 105.75,
+ "seed": 1707389710,
+ "groupIds": [],
+ "strokeSharpness": "round",
+ "boundElements": [],
+ "updated": 1645713086452,
+ "link": null,
+ "startBinding": {
+ "elementId": "1LuXAqePsPIRHC1KSeWe6",
+ "focus": -0.010816189231700723,
+ "gap": 13.671875
+ },
+ "endBinding": null,
+ "lastCommittedPoint": null,
+ "startArrowhead": null,
+ "endArrowhead": "arrow",
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 34.55078125,
+ 35.0859375
+ ],
+ [
+ 59.74609375,
+ 105.75
+ ]
+ ]
+ },
+ {
+ "type": "arrow",
+ "version": 317,
+ "versionNonce": 2104161234,
+ "isDeleted": false,
+ "id": "vKbHoIFobYKpPbfLap6ot",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 823.015625,
+ "y": -236.16796875,
+ "strokeColor": "#000000",
+ "backgroundColor": "#ced4da",
+ "width": 336.3125,
+ "height": 212.578125,
+ "seed": 569428686,
+ "groupIds": [],
+ "strokeSharpness": "round",
+ "boundElements": [],
+ "updated": 1645713082596,
+ "link": null,
+ "startBinding": {
+ "elementId": "1LuXAqePsPIRHC1KSeWe6",
+ "focus": -0.43784332036864043,
+ "gap": 15.0078125
+ },
+ "endBinding": {
+ "elementId": "AVQpPcZ2l6tF482laHpQm",
+ "focus": 0.6528077547726024,
+ "gap": 9.359375
+ },
+ "lastCommittedPoint": null,
+ "startArrowhead": null,
+ "endArrowhead": "arrow",
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 336.3125,
+ 46.7265625
+ ],
+ [
+ 261.6328125,
+ 212.578125
+ ]
+ ]
+ },
+ {
+ "type": "arrow",
+ "version": 378,
+ "versionNonce": 11265870,
+ "isDeleted": false,
+ "id": "EhfI59NuUjCxo0OQ-WWmc",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 827.53125,
+ "y": -236.5078125,
+ "strokeColor": "#000000",
+ "backgroundColor": "#ced4da",
+ "width": 356.58984375,
+ "height": 335.14453125,
+ "seed": 831391054,
+ "groupIds": [],
+ "strokeSharpness": "round",
+ "boundElements": [],
+ "updated": 1645713068336,
+ "link": null,
+ "startBinding": null,
+ "endBinding": null,
+ "lastCommittedPoint": null,
+ "startArrowhead": null,
+ "endArrowhead": "arrow",
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ 356.58984375,
+ 64.0078125
+ ],
+ [
+ 257.359375,
+ 335.14453125
+ ]
+ ]
+ },
+ {
+ "type": "arrow",
+ "version": 332,
+ "versionNonce": 1017082894,
+ "isDeleted": false,
+ "id": "D1sm8V-f_lwosorRMX2Pj",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 674.66015625,
+ "y": -215.19140625,
+ "strokeColor": "#000000",
+ "backgroundColor": "#ced4da",
+ "width": 321.421875,
+ "height": 365.08203125,
+ "seed": 138331282,
+ "groupIds": [],
+ "strokeSharpness": "round",
+ "boundElements": [],
+ "updated": 1645713128638,
+ "link": null,
+ "startBinding": {
+ "elementId": "1LuXAqePsPIRHC1KSeWe6",
+ "focus": 0.32892188879970596,
+ "gap": 5.203125
+ },
+ "endBinding": {
+ "elementId": "y92Fllrdc8UjAmzlSayru",
+ "focus": -0.15040918803524012,
+ "gap": 9.5078125
+ },
+ "lastCommittedPoint": null,
+ "startArrowhead": null,
+ "endArrowhead": "arrow",
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ -282.72265625,
+ 141.84375
+ ],
+ [
+ -206.94921875,
+ 313.4375
+ ],
+ [
+ -1.6015625,
+ 310.97265625
+ ],
+ [
+ 38.69921875,
+ 365.08203125
+ ]
+ ]
+ },
+ {
+ "type": "text",
+ "version": 8,
+ "versionNonce": 711435730,
+ "isDeleted": false,
+ "id": "KXmw08eClY3U80eoCvnKG",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1014.6796875,
+ "y": -247.97265625,
+ "strokeColor": "#000000",
+ "backgroundColor": "#ced4da",
+ "width": 58,
+ "height": 25,
+ "seed": 221048654,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713156598,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "define",
+ "baseline": 18,
+ "textAlign": "left",
+ "verticalAlign": "top",
+ "containerId": null,
+ "originalText": "define"
+ },
+ {
+ "type": "text",
+ "version": 54,
+ "versionNonce": 1449559442,
+ "isDeleted": false,
+ "id": "eAX_6DUdXn9173u5Un7rK",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 807.55078125,
+ "y": -153.86328125,
+ "strokeColor": "#000000",
+ "backgroundColor": "#ced4da",
+ "width": 58,
+ "height": 25,
+ "seed": 728211086,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713162666,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "define",
+ "baseline": 18,
+ "textAlign": "left",
+ "verticalAlign": "top",
+ "containerId": null,
+ "originalText": "define"
+ },
+ {
+ "type": "text",
+ "version": 148,
+ "versionNonce": 1772837266,
+ "isDeleted": false,
+ "id": "dOH_fQDVLWiPkKb9Xa7dh",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 493.55859375,
+ "y": -193.875,
+ "strokeColor": "#000000",
+ "backgroundColor": "#ced4da",
+ "width": 58,
+ "height": 25,
+ "seed": 224121998,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713166649,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "define",
+ "baseline": 18,
+ "textAlign": "left",
+ "verticalAlign": "top",
+ "containerId": null,
+ "originalText": "define"
+ },
+ {
+ "type": "arrow",
+ "version": 60,
+ "versionNonce": 697733522,
+ "isDeleted": false,
+ "id": "T25vTTdMzWQ99VJDhDnIr",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1418.390625,
+ "y": 29.76953125,
+ "strokeColor": "#000000",
+ "backgroundColor": "#ced4da",
+ "width": 65,
+ "height": 86.36328125,
+ "seed": 1643009874,
+ "groupIds": [],
+ "strokeSharpness": "round",
+ "boundElements": [],
+ "updated": 1645713175795,
+ "link": null,
+ "startBinding": {
+ "elementId": "r9bJymnryIHCkuEfO52Bs",
+ "focus": 0.18712696022442354,
+ "gap": 9.6015625
+ },
+ "endBinding": {
+ "elementId": "vfq9_DBY27vVxH1CzgHiN",
+ "focus": -0.22206696232341916,
+ "gap": 6.12109375
+ },
+ "lastCommittedPoint": null,
+ "startArrowhead": null,
+ "endArrowhead": "arrow",
+ "points": [
+ [
+ 0,
+ 0
+ ],
+ [
+ -65,
+ 86.36328125
+ ]
+ ]
+ },
+ {
+ "type": "text",
+ "version": 8,
+ "versionNonce": 592105870,
+ "isDeleted": false,
+ "id": "_CGSnNAmoyvhmYlw0czhG",
+ "fillStyle": "hachure",
+ "strokeWidth": 1,
+ "strokeStyle": "solid",
+ "roughness": 1,
+ "opacity": 100,
+ "angle": 0,
+ "x": 1403.6796875,
+ "y": 61.02734375,
+ "strokeColor": "#000000",
+ "backgroundColor": "#ced4da",
+ "width": 58,
+ "height": 25,
+ "seed": 1873973074,
+ "groupIds": [],
+ "strokeSharpness": "sharp",
+ "boundElements": [],
+ "updated": 1645713178113,
+ "link": null,
+ "fontSize": 20,
+ "fontFamily": 1,
+ "text": "define",
+ "baseline": 18,
+ "textAlign": "left",
+ "verticalAlign": "top",
+ "containerId": null,
+ "originalText": "define"
+ }
+ ],
+ "appState": {
+ "gridSize": null,
+ "viewBackgroundColor": "#ffffff"
+ },
+ "files": {}
+} \ No newline at end of file
diff --git a/docs/go/core/buildgraph.svg b/docs/go/core/buildgraph.svg
new file mode 100644
index 00000000..94f421cb
--- /dev/null
+++ b/docs/go/core/buildgraph.svg
@@ -0,0 +1,16 @@
+<svg version="1.1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1170.8339597452318 847.7899602480144" width="3512.5018792356955" height="2543.3698807440433">
+ <!-- svg-source:excalidraw -->
+
+ <defs>
+ <style>
+ @font-face {
+ font-family: "Virgil";
+ src: url("https://excalidraw.com/Virgil.woff2");
+ }
+ @font-face {
+ font-family: "Cascadia";
+ src: url("https://excalidraw.com/Cascadia.woff2");
+ }
+ </style>
+ </defs>
+ <rect x="0" y="0" width="1170.8339597452318" height="847.7899602480144" fill="#ffffff"></rect><g stroke-linecap="round"><g stroke-opacity="0.4" fill-opacity="0.4" transform="translate(759.4062253702319 510.134765625) rotate(0 -261.53375054819287 164.1503600487441)" fill-rule="evenodd"><path d="M-699.61 186.84 C-699.61 186.84, -699.61 186.84, -699.61 186.84 M-699.61 186.84 C-699.61 186.84, -699.61 186.84, -699.61 186.84 M-709.65 205.92 C-706.5 199.12, -700.95 192.94, -688.44 181.04 M-710.85 206.3 C-705.48 199.52, -700.64 194.55, -687.79 179.88 M-713.5 213.61 C-704.2 202.48, -696.03 190.85, -680.21 172.8 M-712.72 214.96 C-700.86 201.21, -688.38 185.4, -679 173.77 M-715.23 221.48 C-704.12 209.85, -692.86 197.64, -665.59 166.06 M-713.3 220.5 C-697.8 203.76, -682.05 186.53, -667.06 168.32 M-712.23 226.14 C-694.67 206.85, -678.21 186.88, -662.09 166.98 M-711.4 225.21 C-694.8 205.22, -679.01 187.2, -660.36 166.85 M-712.94 230.97 C-690.9 206.15, -671.82 182.62, -655.4 164.31 M-711.89 231.03 C-693.6 210.09, -675.35 189.35, -652.74 164.82 M-709.7 234.68 C-695.42 218.91, -683.17 205.28, -647.06 165.19 M-710.07 236.09 C-686.74 210.36, -663.71 182.28, -649.59 164.64 M-708.61 239.35 C-693.98 220.93, -674.95 200.41, -641.34 165.02 M-707.99 239.69 C-695.41 223.33, -681.46 206.61, -642.28 163.53 M-708.94 242.59 C-687.21 223.31, -666.99 198.41, -636.48 164.91 M-707.32 244.47 C-687.31 223.32, -669.7 200.57, -637.8 163.93 M-704.46 247.74 C-685.89 222.25, -663.04 198.55, -633.44 164.89 M-705.16 247.51 C-687.98 228.48, -670.41 209.19, -631.02 162.67 M-704.85 254.26 C-684.18 228.58, -660.37 203.96, -626.58 163.58 M-702.91 252.79 C-673.83 219.1, -645.71 187.27, -625.81 161.59 M-702.32 257.48 C-673.77 224.89, -643.66 192.19, -618.98 162.89 M-701.37 255.8 C-684.12 236.18, -666.8 215.54, -619.85 162.24 M-699.04 260.75 C-668.16 222.86, -635.12 184.51, -613.2 163.17 M-699.62 259.72 C-672.15 225.21, -642.65 193.33, -613.83 162 M-698.38 264.39 C-677.5 237.58, -654 216.44, -605.9 159.19 M-696.74 263.35 C-663.99 226.42, -632.25 187.25, -607.59 159.99 M-695.71 264.62 C-661.24 228.81, -632.57 191.89, -600.52 162.07 M-694.1 265.97 C-673.65 241.14, -651.66 216.01, -603.22 160.04 M-691.72 268.25 C-664.59 238.53, -641.92 208.64, -596.06 160.44 M-691.1 269.02 C-660.17 232, -626.31 195.11, -597.31 159.72 M-686.4 271.88 C-656.7 235.35, -621.58 195.57, -592.32 159.16 M-688.65 271.25 C-667.39 245.26, -644.72 221.05, -590.71 160.13 M-683.77 275.31 C-651.31 237.65, -620.83 200.03, -586.01 160.24 M-684.39 273.15 C-650.73 233.69, -614.71 195.58, -586.04 158.71 M-681.24 276.02 C-656.71 248.61, -632.02 221.89, -582.03 159.29 M-681.45 277.3 C-651.5 241.46, -621.93 207.14, -579.5 158.7 M-680.25 280.81 C-641.79 236.61, -604.19 193.05, -575.57 160.18 M-679.66 279.1 C-654.59 251.45, -629.44 222.51, -574.39 159.76 M-675.02 283.5 C-640.79 240.84, -605.42 199.15, -570.73 159.26 M-675.65 282.36 C-643.24 246.27, -611.39 210.15, -568.24 159.18 M-671.18 284.67 C-637.82 246.14, -607.4 207.99, -562.57 160.05 M-672.05 284 C-648.01 258.24, -625.35 230.86, -564.27 158.45 M-669.85 284.49 C-641.12 254.61, -615.53 224.16, -557.11 158.38 M-668.98 286.93 C-635.98 246.32, -601.77 207.65, -557.96 159.53 M-664.24 288.79 C-627.71 243.79, -588.91 196.16, -553.42 157.12 M-665.17 286.99 C-626.58 244.54, -588.16 198.73, -552.48 157.38 M-662.44 288.38 C-635.53 257.26, -608.48 227.28, -546.19 158.37 M-662.14 290.3 C-626.18 248.91, -591.41 209.87, -547.84 157.22 M-658.71 291.57 C-624.46 256.47, -593.62 218.8, -539.22 157.36 M-658.01 290.73 C-629.31 260.72, -600.78 227.47, -541.78 156.38 M-654.17 293.79 C-621.51 254.89, -588.31 216.25, -535.94 158.71 M-653.69 293.51 C-624.15 259.49, -592.62 225.35, -536.81 157.49 M-651.52 297.34 C-613.36 250.4, -576.07 209.98, -530.29 159.26 M-650.01 295.9 C-606.71 245.18, -564.02 196.55, -530.49 157.35 M-647.03 296.28 C-599.4 242.46, -552.96 190.44, -525.28 156.35 M-647.21 296.11 C-617.45 263.57, -588.73 230.71, -524.53 156.1 M-643.9 299.16 C-606.03 255.1, -565.97 211.13, -519.02 158.97 M-642.73 298.94 C-602.35 254.52, -564.32 208.83, -520.25 156.4 M-640.32 301.42 C-610.51 266.5, -584.03 232.56, -514.8 158.19 M-638.8 300.18 C-596.16 252.78, -555.31 204.16, -515.14 156.8 M-632.74 302.33 C-591.41 251.77, -551.84 200.13, -511.04 158.89 M-634.14 300.55 C-586.97 244.47, -540.13 191.58, -510.26 157.44 M-629.98 303.71 C-580.19 245.4, -531.67 190.55, -503.38 158.12 M-629.54 302.31 C-590.39 256.5, -553.24 210.6, -504.84 157.4 M-624.52 302.34 C-590.86 261.66, -555.13 219.5, -499.31 157.11 M-625.64 302.71 C-579.98 249.43, -532.14 196.43, -498.35 156.65 M-621.24 303.65 C-580.16 256.7, -537.46 208.43, -494.87 159.21 M-621.1 303.61 C-574.37 250.24, -528.52 196.49, -493.65 156.93 M-616.06 305.41 C-582.33 264.71, -544.96 224.46, -486.73 158.24 M-617.74 304.15 C-570.85 253.15, -525.9 200.6, -488.58 156.19 M-612.64 307.44 C-570.64 254.85, -526.82 207.2, -484.09 156.28 M-612.73 306.44 C-565.02 250.82, -517.34 196.8, -484.32 157.21 M-607.8 305.73 C-578.62 275.15, -547.17 242.78, -476.84 156.06 M-606.39 306.63 C-563.66 254.75, -519.56 203.57, -478.96 158.03 M-600.73 307.48 C-572.81 274.03, -547.66 242.2, -472.16 158.88 M-600.99 305.93 C-573.53 275.46, -546.6 243.46, -472.67 156.83 M-598.47 308.71 C-557.75 261.03, -513.4 211.06, -469.19 156.59 M-598.61 307.17 C-570.17 273.9, -541.8 240.9, -467.78 157.87 M-593.25 308.71 C-567.4 276.53, -540.41 245.42, -461.15 157.99 M-591.98 307.25 C-558.03 267.42, -522.81 225.1, -461.35 156.87 M-588.46 309.48 C-544.96 256.27, -503.93 205.76, -457.25 156.56 M-586.89 307.55 C-560.38 276.61, -533.35 245.7, -456.57 158.69 M-581.35 307.21 C-548.27 270.47, -512.51 226.15, -452.79 156.85 M-582.42 309.31 C-537.06 256.51, -491.19 205.03, -451.37 158.71 M-579.63 309.62 C-542.3 265.95, -504.84 222.08, -447.68 158.37 M-578.12 310.01 C-527.58 252.06, -477.39 194.09, -446.48 158.65 M-575.3 311.02 C-519.17 248.88, -466.53 187.33, -439.97 157.92 M-574.59 310.56 C-531.45 260.71, -489.15 210.73, -440.68 157.99 M-569.36 310.09 C-516.16 252.84, -464.88 191.81, -435.67 157.21 M-569.83 311.27 C-520.04 255.87, -471.42 198.97, -435.89 157.34 M-565.13 311.99 C-527.58 267.4, -487.64 222.51, -431.7 157.35 M-563.66 311.62 C-525.95 268.43, -488.07 225.64, -430.59 158.05 M-558.14 311.66 C-517.15 262.94, -472.19 211.19, -426.11 158.78 M-560.39 312.12 C-527.91 275.86, -495.48 238.92, -426.14 158.37 M-556.26 314.54 C-519.71 267.66, -480.81 228.21, -418.93 159.65 M-554.51 313.51 C-526.55 279.08, -495.84 244.46, -420.88 158.09 M-550.3 312.24 C-499.79 257.52, -450.46 200.85, -414.71 159.66 M-549.93 313 C-518.72 276.38, -487.02 240.54, -415.83 158.69 M-544.77 313.89 C-514.36 281.05, -488.26 246.86, -409.64 157.99 M-545.68 314.13 C-501.51 263.72, -455.44 213.17, -409.29 158.7 M-540.5 315.08 C-512.26 282.55, -481.38 248.18, -404.52 157.34 M-540.31 314.42 C-509.41 278.54, -477.32 242.19, -404.04 157.57 M-535.6 314.59 C-485.12 255.24, -433.09 197.38, -399.05 158.32 M-535.98 314.94 C-492.64 267.02, -450.48 219.73, -400.21 158.14 M-529.47 315.38 C-477.77 257.87, -428.9 198.93, -394.32 159.65 M-530.36 316.83 C-495.29 275.14, -459.07 233.94, -393.85 157.94 M-524.96 316.74 C-476.51 258.2, -425.79 199.3, -390.17 160.23 M-525.52 317.01 C-492.22 275.76, -457.57 237.29, -388.77 159.1 M-521.18 319.27 C-490.38 281.39, -457.02 243.28, -384.64 158.83 M-521.09 317.5 C-491.48 285.76, -462.8 251.96, -383.24 159.23 M-517.25 318.35 C-488.19 283.88, -455.55 248.78, -378.19 159.85 M-517.56 318.91 C-466.89 261.71, -417.17 204.35, -378.04 158.08 M-514.02 320.74 C-466.65 266.62, -420.75 213.65, -373.12 158.95 M-513.1 320.18 C-470.06 269.96, -425.26 219.62, -373.75 158.96 M-509.35 320.37 C-472.14 275.92, -437.74 234.04, -367.38 159.15 M-508.97 320.86 C-477.19 284.8, -445.32 248.93, -368.46 159.26 M-502.91 320.95 C-461.32 271.28, -420.94 224.22, -364.19 160.44 M-502.4 319.91 C-465.86 277.35, -428.87 235.96, -363.42 159.47 M-498.1 321.39 C-460.99 276.18, -419.66 232.75, -355.77 157.85 M-498.59 320.37 C-448.38 262.41, -398.58 206.09, -357.65 158.47 M-493.88 322.55 C-448.41 271.58, -402.18 216.54, -353.7 159.37 M-492.44 321.21 C-453.78 275.95, -413.18 229.15, -351.62 159.24 M-488.88 321.69 C-437.83 260.91, -387.23 203.41, -348.17 159.47 M-487.95 322.3 C-451.91 282.23, -416.56 242.8, -347.16 158.91 M-483.76 322.72 C-442.48 278.51, -406.85 231.12, -342.06 160.26 M-483.44 321.42 C-443.25 273.16, -402.52 226.07, -340.81 159.48 M-478.3 323.67 C-445.97 284.4, -415.51 247.4, -337.76 159.55 M-478.77 322.79 C-432.64 271.54, -389.62 220.24, -337.28 160.17 M-473.73 323.43 C-415.95 258.57, -358.8 193.59, -329.67 157.51 M-472.76 321.83 C-428.27 270.73, -384.01 219.51, -331.03 158.81 M-469.89 323.18 C-424.2 270.12, -377.74 219.16, -325.8 158.92 M-468.64 322.39 C-419.15 264.5, -369.31 207.23, -326.51 158.47 M-464.04 322.69 C-434.35 290.14, -403.69 257.81, -319.3 158.93 M-462.81 323.3 C-428.8 284.11, -393.36 245.24, -321.47 160.11 M-458.46 325.2 C-414.66 274.85, -375.05 226.57, -313.74 158.96 M-458.9 323.37 C-419.24 279.14, -380.48 232.66, -315.17 158.46 M-452.33 323.28 C-399.19 260.65, -342.51 194.75, -311.69 160.01 M-453.17 323.65 C-405.12 270.71, -358.99 217.06, -310.48 159.64 M-449.26 324.64 C-397.19 264, -344.93 204.98, -305.58 160.56 M-448.49 323.67 C-390.59 260.43, -334.7 196.28, -305.08 159.1 M-442.94 324.79 C-398.82 273.09, -353.36 223.69, -300.86 160.63 M-443.88 326.26 C-406.71 282.73, -367.96 238.77, -300.32 159.45 M-439.43 326.31 C-394.12 273.29, -349.95 222.88, -292.94 159.69 M-438.95 325.49 C-394.84 275.07, -350.57 223.7, -294.17 160.59 M-435.61 325.81 C-390.42 276.2, -345.59 223.4, -290.55 160.36 M-433.67 325.74 C-388.27 276.52, -345.78 225.83, -288.51 159.93 M-427.63 326.19 C-387.96 277.92, -346.46 232.25, -285.4 160.03 M-429.27 326.16 C-394.94 285.87, -361.35 247.54, -283.42 160.43 M-424.22 326.75 C-367.09 262.67, -311.13 197.93, -279.3 160.89 M-424.77 327.23 C-375.03 268.63, -323.56 211.97, -277.97 159.79 M-418.96 327.37 C-383.56 287.56, -346.47 246.32, -274.53 158.38 M-418.19 326.26 C-375.31 278.18, -333.59 229.86, -272.96 160.56 M-412.56 327.78 C-365.38 273.28, -316.61 214.91, -269.72 161.61 M-413.59 327.87 C-378.14 285.91, -343.13 246.47, -268.2 161.09 M-409.46 327.95 C-369.1 280.91, -327.81 237.39, -264.22 160.72 M-408.63 327.06 C-352.64 259.63, -293.9 193.98, -262.06 160.04 M-402.07 327.4 C-372.04 291.31, -342.02 258.83, -257.22 161.78 M-403.45 328.36 C-360.75 278.19, -317.16 227.65, -256.96 160.17 M-398.35 329.34 C-359.98 279.49, -319.04 234.27, -252.3 160.46 M-398.31 327.54 C-346.72 267.05, -295.23 207.59, -252.39 160.09 M-393.02 330.04 C-362.37 290.04, -329.47 253.36, -246.09 159.89 M-392.94 327.62 C-341.18 267.76, -289.67 207.25, -246.79 160.01 M-388.26 326.46 C-348.52 281.61, -308.81 236.85, -243.22 161.67 M-387.73 327.58 C-330.59 262.17, -273.1 195.89, -242.61 160.52 M-381.34 329.32 C-337.7 278.8, -295.01 227.06, -238.2 159.22 M-382.17 327.57 C-332.15 271.91, -280.85 214.4, -236.35 159.34 M-378.59 328.99 C-328.68 276.24, -280.28 220.94, -230 160.52 M-377.92 329.33 C-345.11 291.41, -310.28 252.06, -231.82 161.07 M-372.69 329.29 C-328.57 279.23, -281.48 225.79, -225.04 160.05 M-372.15 329.4 C-328.61 279.22, -283.68 226.29, -225.4 159.52 M-365.46 329.42 C-335.13 291.39, -303.51 257.35, -220.5 161.9 M-365.96 328.61 C-309.63 261.86, -254.13 196.95, -220.86 159.87 M-360.99 328.99 C-303.1 262.98, -245.38 195.02, -214.24 162.07 M-361.46 327.62 C-310.93 270.1, -259.68 211.37, -216.31 160.96 M-357.5 326.88 C-309.71 273.44, -260.84 219.6, -208.98 160.85 M-356.55 327.47 C-313.63 278.6, -271.9 231.7, -210.58 159.92 M-350.34 328.64 C-305.8 278.73, -262.74 230.07, -204.57 159.64 M-350.09 327.44 C-301.62 269.32, -251.03 210.54, -205.39 160.95 M-346.89 328.29 C-289.39 263.76, -234.22 199.16, -201.12 161.1 M-345.96 327.58 C-292.9 269.92, -244.25 212.21, -201.9 162.6 M-340.03 326.92 C-282.74 262.35, -227 197.64, -196.31 163.42 M-340.8 329.13 C-309.96 295.07, -280.81 261.81, -195.91 162.27 M-335.04 329.6 C-282.33 271.78, -235.43 212.37, -189.97 160.15 M-334.79 327.9 C-289.26 277.18, -244.54 226.31, -189.78 162.21 M-329.53 329.95 C-290.02 280.78, -253.78 239.28, -184.44 161.14 M-329.42 327.44 C-272.24 261.92, -215.87 197.22, -185.29 160.85 M-323.39 327.19 C-285.52 282.83, -243.91 238.42, -178.38 159.85 M-324.75 328.29 C-284.02 280.17, -243.27 233.94, -179.72 160.91 M-319.38 328.34 C-265.88 268.89, -212.94 207.36, -174.38 159.08 M-318.76 327.64 C-288.27 294.92, -258.53 259.79, -172.91 160.37 M-315.05 326.47 C-273.76 284.14, -237.62 240.36, -167.38 160.3 M-312.59 328.6 C-269.86 274.76, -222.97 222.49, -168.28 160.03 M-306.85 327.08 C-267.28 281.14, -227.12 232.75, -162.62 158.2 M-308.16 327.76 C-258.06 270.92, -207.54 212.83, -162.53 159.69 M-302.73 326.35 C-254.61 272.8, -207.91 218.36, -157.14 161.14 M-303.04 327.85 C-269.94 291.81, -237.36 254.13, -157.05 158.76 M-298.67 327.2 C-250.22 274.73, -200.41 216.74, -151.48 158.88 M-298.48 328.85 C-251.85 278.56, -209.04 228.51, -151.82 160.14 M-291.23 327.86 C-246.82 275.5, -201.62 226.19, -145.85 160.62 M-292.47 328.51 C-244.12 270.49, -194.67 213.14, -145.46 159.19 M-288.6 327.58 C-232.67 265.45, -178.28 204.44, -140.6 158.9 M-287.8 327.26 C-234.17 268.05, -180.49 207.9, -138.7 157.49 M-281.83 328.99 C-228.44 263.53, -174.13 200.83, -135.08 156.92 M-281.74 327.04 C-249.65 292.92, -219.66 258.14, -133.58 158.27 M1.94 1.69 C1.94 1.69, 1.94 1.69, 1.94 1.69 M1.94 1.69 C1.94 1.69, 1.94 1.69, 1.94 1.69 M-276.29 326.85 C-232.69 275.3, -186.42 225.9, -125.87 157.12 M-275.92 328.9 C-239.42 282.86, -201.05 239.69, -127.59 157.55 M-30.92 44.41 C-18.71 29.59, -6.83 19.03, 5.63 4.65 M-30.61 44.73 C-24.18 37.09, -15.6 27.94, 6.11 3.56 M-271.1 327.67 C-213.2 262.02, -156.76 196.51, 9.62 3.67 M-270.87 327.2 C-178.7 221.27, -87.27 115.08, 10.83 4.08 M-265.3 328.85 C-166.2 212.82, -66.46 97.67, 14.73 5.88 M-265.82 327.64 C-208.53 263.5, -151.52 198.09, 15.11 4.64 M-260.88 328.81 C-200.26 260.91, -140.4 191.37, 20.26 5.68 M-260.49 328.63 C-163.13 215.05, -63.88 101.73, 19.31 6.27 M-255.22 328.8 C-152.83 212.8, -53.08 97.86, 23.63 6.12 M-254.86 327.92 C-173.64 233.96, -92.47 141.36, 24.31 6.93 M-250.08 328.65 C-137.73 202.37, -28.06 75.36, 29.32 8.44 M-249.78 327.86 C-171.93 239.25, -95.25 150.83, 28.33 7.53 M-244.88 328.32 C-141.84 209.32, -39.02 90.72, 33.55 8.3 M-245.71 329.17 C-188.33 262.98, -132.1 197.68, 32.89 8.34 M-239.04 329 C-173.61 255.71, -110.06 183.32, 37.71 8.45 M-239.57 328.77 C-143.58 219.41, -48.85 110.22, 38.17 9.49 M-234.72 328.06 C-178.23 262.3, -121.23 197.7, 41.77 9.26 M-233.97 327.98 C-171.75 258.44, -110.97 188.08, 41.94 9.86 M-228.85 328.31 C-144.24 228.2, -57.11 128.9, 46.92 10.31 M-227.96 327.96 C-122.42 205.21, -15.88 82.4, 46.11 11.41 M-223.7 327.95 C-132.01 222.87, -41.87 117.23, 50.96 11.52 M-222.58 327.64 C-146.12 238.73, -70.77 151.52, 51.5 11.64 M-216.59 325.69 C-141.15 241.4, -66.28 153.94, 55.67 12.99 M-216.61 326.69 C-116.93 213.3, -17.1 98.8, 56.28 12.67 M-212.09 327.13 C-103.49 203.26, 5.25 77.5, 59.61 13.6 M-211.52 325.94 C-142.32 249.73, -74.57 171.27, 59.84 14.34 M-205.08 326.21 C-133.26 240.43, -59.79 158.61, 65.52 15.26 M-206.15 326.06 C-147.13 258.44, -88.9 191.93, 65.62 14.69 M-199.59 326.64 C-107.96 218.29, -15.98 112.11, 69.25 15.22 M-200.6 325.8 C-123.1 239.26, -47.7 152.47, 69.24 15.26 M-193.91 325.5 C-123.66 243.42, -51.89 159.56, 73.17 16.62 M-194.09 324.99 C-91.74 206.02, 11.4 86.86, 73.87 16.99 M-188.64 323.93 C-123.59 246.09, -54.47 169.59, 79.47 16.42 M-188.96 324.99 C-122 248.97, -55.19 172.15, 79.34 16.73 M-182.64 323.73 C-86.52 211.21, 11.65 99.91, 82.24 18.42 M-182.99 324.05 C-95.09 224.95, -8.23 123.91, 82.88 17.62 M-176.74 324.99 C-94.67 229.86, -13.63 138.07, 86.54 18.63 M-177.8 324.31 C-98.25 235.04, -19.78 144.83, 87.38 18.86 M-171.93 324.7 C-94.3 236.22, -16.76 146.7, 91.65 18.46 M-172.28 323.84 C-67.95 203.5, 36.45 83.69, 92.13 19.42 M-168.31 325.6 C-103.79 249.44, -37.4 174.76, 97.61 21.28 M-168.52 325.97 C-84.38 229.65, -2.69 133.78, 96.33 20.1 M-161.47 325.07 C-89.09 238.54, -12.81 154.23, 100.9 20.94 M-162.28 324.79 C-72.45 223.66, 16.93 121.42, 101.24 21.63 M-156.17 324.83 C-79.06 236.3, -3.32 149.11, 105.6 22.98 M-155.8 324.39 C-93.8 252.28, -31.73 181.39, 105.92 22.26 M-150.4 322.77 C-95.64 259.13, -40.35 195.89, 111.56 23.43 M-150.62 323.93 C-96.83 259.22, -42.43 196.44, 110.86 21.85 M-145.39 321.88 C-83.4 250.25, -21.35 182.21, 115.31 24.05 M-144.24 322.57 C-50.74 215.09, 42.42 107.1, 115.85 23.61 M-136.21 319.09 C-65.87 239.03, 1.97 160.39, 118.88 23.84 M-136.35 318.47 C-67.09 240.54, 1.01 163.23, 119.46 25 M-130.69 318.72 C-43.92 219.6, 42.17 119.19, 123 24.66 M-129.67 318.35 C-69.19 249.91, -10.75 182.11, 123.84 25.42 M-122.43 315.89 C-55.72 240.18, 13.06 163.6, 127.77 28.69 M-123.55 316.23 C-57.53 239.63, 8.44 162.19, 127.21 27.91 M-116.72 314.93 C-55.33 244.62, 7.36 174.69, 132.55 29.27 M-116.66 315.84 C-30.43 216.88, 55 118.96, 132.15 28.83 M-110.03 313.92 C-24.15 215.2, 60.4 116.2, 137.48 29.42 M-111.02 313.9 C-21.59 211.09, 68.87 106.91, 136.27 29.83 M-103.45 313.98 C-36 235.31, 30.99 159.21, 140.94 30.46 M-104.33 313.68 C-45.67 245.81, 14.3 178.03, 140.71 31.14 M-97.79 312.28 C-32.57 237.09, 30.87 160.55, 144.53 32.47 M-97.83 310.79 C-39.98 246.76, 16.69 181.2, 145.18 32.64 M-90.38 309.74 C-20.05 225.76, 52.03 144.61, 149.64 33.61 M-91.15 309.92 C-35.56 247.79, 18.84 184.82, 148.41 34.44 M-83.91 310.1 C-9.16 221.92, 66.58 133.72, 153.41 34.3 M-84.55 309.15 C-10.13 220.33, 66.25 132.7, 152.55 35.48 M-78.37 307.77 C-11.92 229.4, 54.28 151.63, 156.69 35.37 M-78.63 308.26 C-18.82 240.24, 40.99 171.56, 157.9 36.61 M-75.91 308.66 C-26.65 254, 22.31 197.23, 162.02 38.16 M-75.07 309.49 C19.99 201.76, 113.35 94.13, 161.61 37.49 M-68.17 306.36 C16.96 209.02, 100.99 113.09, 163.67 39.63 M-66.83 306.99 C-17.95 250.46, 32.08 193.2, 164.57 40.66 M-59.54 304.1 C21 211.59, 104.52 115.66, 166.79 41.71 M-59.86 304.87 C-9.24 244.79, 41.66 186.16, 167.47 42.32 M-50.04 300.24 C24.88 212.21, 102.16 123.45, 171.18 43.3 M-51.03 300.88 C10.65 231.56, 70.57 161.89, 171.38 44.87 M-43.1 296.43 C9.3 234.25, 64.19 173.83, 174.5 47.51 M-43.24 296.97 C15.69 228.08, 75.02 159.68, 175.69 46.43 M-34.54 293.52 C10.42 243.13, 53.65 194.03, 179.14 47.41 M-34.98 293.37 C32.86 213.76, 102.7 135.17, 178.53 48.04 M-25.09 289.6 C21.39 235.47, 66.67 180.64, 181.69 50.97 M-25.7 290.59 C18.7 238.76, 63.77 188.43, 182.2 50.91 M-16.46 284.19 C63.21 192.54, 144.31 101.44, 184.78 53.43 M-16.23 284.64 C49.91 210.24, 115.1 134.57, 184.83 54.54 M-6.35 277.82 C57.58 208.35, 118.02 136.99, 187.43 55.62 M-6.25 279.15 C33.29 232.09, 72.72 185.79, 186.97 56.43 M4.29 273.69 C70.01 198.68, 134.1 124.87, 188.51 62.32 M5.22 273.43 C77.99 188.14, 151.65 103.62, 188.56 61.53 M18.9 260.97 C60.47 214.85, 103.02 167.58, 191.57 65.1 M19.05 262 C59.77 215.46, 98.74 169.85, 190.26 64.8 M35.88 251.84 C92.58 188.52, 146.3 122.57, 191.48 72.48 M33.52 251.1 C79.17 198.4, 124.19 146.59, 189.58 72.09 M48.09 239.33 C97.27 183.53, 149.13 127.38, 190.43 74.21 M48.39 240.02 C99.33 180.83, 150.51 121.5, 192.61 76.14 M61.56 228.56 C101.27 187.97, 137.43 142.26, 186.55 86.66 M63.02 230.86 C102.76 186.51, 142.25 142.34, 186.94 86.78 M88.43 209.78 C113.53 174.43, 144.07 141.41, 182.14 97.18 M86.79 207.52 C112.09 178.25, 137.05 150.13, 182.05 98.83" stroke="#fd7e14" stroke-width="0.5" fill="none"></path><path d="M0.4 0.65 C-16.37 21.85, -68.87 100.93, -99.47 127.26 C-130.07 153.59, -88.64 151.74, -183.2 158.62 C-277.77 165.5, -592.87 144.97, -666.85 168.53 C-740.83 192.09, -725.31 276.89, -627.08 300 C-528.86 323.1, -213.69 345.04, -77.51 307.16 C58.68 269.28, 177.05 123.74, 190.03 72.73 C203.01 21.72, 32.18 13.31, 0.35 1.08" stroke="#000000" stroke-width="1.5" fill="none" stroke-dasharray="8 9"></path></g></g><g stroke-linecap="round" transform="translate(153.91208474523194 433.78515625) rotate(0 67.876953125 34.046875)"><path d="M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0 M-0.77 6.55 C1.38 5, 3.28 2.85, 4.87 0.16 M-0.37 6.04 C1.7 3.99, 3.62 1.6, 4.69 0.38 M0.12 11.13 C2.17 8.74, 5.2 7.7, 10.81 0.61 M-0.6 11.55 C3.01 9.32, 5.78 5.7, 11.22 0.33 M-0.08 20.17 C3.66 11.87, 12.55 6.4, 16.48 -0.47 M0.76 17.45 C3.19 14.37, 6.46 9.74, 14.82 0.22 M-0.28 23.08 C7.54 17.72, 11.72 6.89, 20.14 -0.72 M-0.61 23.61 C4.18 18.41, 9.27 13.54, 21.48 0.3 M-0.43 29.46 C9.59 20.76, 16.34 11.43, 25.23 -1.08 M-0.05 30.94 C8.71 22.07, 16.85 11.71, 25.99 -0.56 M-1.58 38.07 C11.23 24.91, 23.02 13.27, 31.23 -2 M-1.12 36.27 C11.55 22.58, 23.61 9.29, 32.51 -0.32 M-1.78 41.85 C8.39 32.05, 20.83 21.26, 36.58 -0.33 M0.74 43.46 C8.54 32.02, 15.38 23.12, 36.9 0.45 M-1.98 47.1 C17.23 31.27, 30.3 12.96, 41.95 -0.4 M-0.29 49.74 C11.19 36.34, 20.7 23.93, 42.42 -0.46 M0.6 55.13 C10.21 44.79, 22.17 32.45, 49.08 0.97 M0.62 55.44 C17.2 35.84, 34.7 15.49, 48.01 1.12 M-0.7 61.26 C10.68 47.79, 23.72 37.06, 52.06 -0.66 M-0.76 60.06 C18.72 37.8, 39.31 17.61, 53.94 -1.17 M0.67 68.44 C23.37 41.09, 43.54 14.35, 56.18 1.65 M-0.76 68.03 C13.98 50.75, 27.8 35.67, 58.08 -0.25 M1.2 71.47 C24.63 44.43, 47.21 16.5, 65.21 -0.91 M2.41 69.95 C15 54.73, 26.9 41.43, 63.58 -0.54 M6.14 72.2 C29.9 46.68, 49.99 20.94, 68.24 2.1 M7.87 70 C30.16 44.33, 51.96 19.92, 69.15 0.09 M14.19 71.22 C36.32 41.52, 60.64 17.16, 74.96 1.27 M14.1 70.58 C33.53 48.61, 52.13 25.55, 74.69 -0.7 M19.54 70.77 C35.46 52.92, 49.37 35.83, 78.52 -1.69 M17.49 69.44 C36.63 48.02, 56.19 26.97, 79.58 0.35 M22.56 68.68 C43.76 45.96, 64.94 21.02, 86.78 -1.05 M24.34 70.64 C45.85 43.52, 68.86 18.39, 84.37 -0.86 M30.59 71.33 C46.1 49.58, 63.7 30.91, 89.18 -0.11 M28.16 69.62 C44.28 51.3, 61.86 34.1, 91.02 0.2 M34.67 69.33 C51.31 52.28, 67.47 31.8, 96.03 -2.25 M33.69 69.98 C51.9 50.55, 70.15 30.69, 96.56 -0.25 M41.54 70.66 C59.97 45.25, 80.54 22.01, 101.3 0 M39.38 70.74 C60.1 47.43, 79.91 23.99, 101.4 -0.26 M43.8 71.96 C64.99 45.45, 84.88 21.56, 105.99 -2.1 M44.95 70.66 C65.67 46.58, 88.15 20.88, 106.96 -1.15 M50.53 72.1 C72.77 45.58, 89.87 24.91, 112.87 1.44 M50.41 69.96 C72.56 44.52, 96.79 15.97, 111.97 0.56 M54.14 71.23 C76.02 44.11, 100.55 18.35, 117.19 0.99 M54.28 70.42 C69.96 53.33, 86.71 34.39, 115.44 0.87 M61.63 71.61 C82.63 46.03, 98.98 25.12, 120.76 -1.44 M61.33 70.37 C85.84 41.46, 108.97 15.04, 122.26 0.66 M65.45 68.63 C82.52 51.95, 97.19 33.99, 128.04 0.92 M66.77 70.74 C81.29 50.45, 99.79 31.12, 127.62 0.92 M70.8 71.71 C85.48 55.9, 97.58 38.94, 130.78 -0.67 M72.01 70.05 C91.03 47.17, 112.02 24.01, 133.11 -0.47 M78.42 71.26 C91.94 54.32, 104.17 37.25, 136.22 -0.79 M76.83 70.52 C94.85 49.01, 113.91 25.83, 137.29 1.08 M83.91 71.57 C93.01 55.1, 104.83 44.78, 137.06 6.86 M83.13 71.01 C95.44 54.86, 110.4 38.73, 137.09 6.64 M88.6 69.8 C101.07 54.24, 117.1 33.09, 135.44 13.03 M87.15 71.13 C97.86 56.91, 109.41 45.09, 136.17 13.45 M94.75 68.89 C109.91 50.81, 124.84 30.04, 135.84 19.28 M93.15 70.21 C103.13 57.7, 114.15 45.78, 137.25 20.35 M96.48 68.52 C113.59 53.11, 125.3 37.32, 136.36 26.27 M97.71 71.38 C109.75 56.93, 120.82 43.93, 137.8 24.19 M102.99 70.01 C111.06 59.43, 119.84 50.23, 135.55 32.8 M103.34 70.57 C112.06 62.05, 119.2 52, 136.25 31.96 M109.44 71.3 C119.73 57.34, 130.45 44.66, 135.03 37.46 M108.8 70.56 C119.58 57.67, 128.3 45.46, 137.03 38.5 M112.23 71.84 C121.83 60.69, 125.54 55.86, 137.62 41.78 M114.75 69.97 C122.76 60.43, 131.57 50.05, 136.11 42.78 M119.79 71.59 C122.85 67.72, 127.01 60.97, 135.4 51.48 M120.01 69.38 C125.04 63.44, 131.36 56.56, 137.46 49.24 M123.99 71.8 C127.14 65.46, 130.7 62.79, 138.32 56.11 M125.22 70.22 C129.65 64.67, 133.06 59.97, 137.15 56.48 M130.25 70.4 C132.57 68.02, 133.05 65.35, 136.03 62.05 M129.42 70.7 C131.39 68.73, 132.9 66.27, 136.69 62.3" stroke="#82c91e" stroke-width="0.5" fill="none"></path><path d="M-1.53 1.19 C28.35 0.63, 59.92 1.95, 135.01 -1.31 M-0.1 -0.18 C51.11 0.4, 102.47 1.13, 135.29 -0.08 M134.76 1.55 C135.89 27.84, 135.08 54.18, 134.07 68.85 M135.02 0.78 C135.47 15.39, 135.32 30.8, 136.66 68.36 M134.49 69.81 C102.25 66.87, 70.42 67.6, -1.51 68.75 M136.2 68.33 C87.26 66.85, 38.05 67.59, 0.85 68.93 M0.72 68.42 C0.48 44.36, -0.6 19.03, 0.81 1.49 M-0.45 67.32 C0.08 54.72, -0.32 38.86, -1 -0.32" stroke="#000000" stroke-width="1" fill="none"></path></g><g stroke-linecap="round" transform="translate(143.10349099523194 250.11328125) rotate(0 94 34.5)"><path d="M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0 M0.16 7.11 C1.22 4.62, 2.72 2.61, 4.84 -0.15 M-0.21 6.68 C1.27 4.38, 2.92 3.41, 5.26 0.25 M0.11 12.45 C4.33 9.62, 5.84 4.29, 10.04 -0.37 M0.5 12.41 C4.3 7.5, 6.75 3, 10.48 -0.09 M0.02 19.75 C4.35 12.1, 8.52 5.89, 13.83 -1.6 M0.18 17.96 C3.01 14.95, 7.82 10.67, 15.63 0.42 M2.03 22.82 C6.42 16.85, 11.75 13.15, 20.79 0.41 M-0.59 24.78 C4.39 18.42, 10.47 12.08, 21.15 -0.03 M1.74 29.17 C7.02 23.87, 15.09 13.72, 27.88 0.01 M0.89 30.23 C8.9 21.12, 16.31 11.23, 26.46 0.23 M-0.93 35.65 C10.51 25.85, 18.09 15.41, 31.81 -0.25 M-0.12 37.13 C9.52 26.97, 17.94 16.43, 32.02 -1.07 M1.9 43.2 C14.88 28.3, 27.48 11.2, 37.24 0.65 M0.49 42.91 C13.92 25.88, 26.69 11.49, 36.17 0.78 M1.75 47.5 C16.29 29.89, 34.77 10.96, 43.7 0.53 M-0.06 48.68 C10.63 36.06, 22.07 24.8, 42.65 0.18 M-0.02 54.05 C16.47 34.95, 36.4 12.51, 45.93 0.47 M1.25 54.78 C14.27 38.37, 28.54 23.58, 47.47 0.11 M0.2 60.56 C16.55 40.3, 37.17 19.14, 52.78 -0.88 M0.28 61.6 C18.05 40.63, 34.89 20.41, 52.38 -1.1 M-1.58 68.09 C13.39 51.54, 26.64 36.51, 59.56 -0.9 M0.45 67.16 C15.25 49.63, 31.03 32.72, 57.8 1.06 M0.74 69.4 C25.38 43.24, 48.65 16.91, 62.94 1.36 M2.94 69.84 C14.55 56.09, 28.84 40.77, 64.27 0.07 M8.35 70.59 C28.56 43.83, 50.16 18.11, 69.29 -0.43 M6.3 70.58 C26.34 48.87, 45.9 25.17, 69.34 -0.77 M11.84 70.77 C29.62 48.29, 52.2 25.27, 73.61 -1.5 M13.27 70.84 C27.89 51.38, 45.76 33.14, 75.08 0.44 M19.39 71.36 C36.68 52.08, 51.55 33.22, 79.84 0.36 M17.61 70.47 C30.84 58.19, 42.14 42.44, 78.95 1.03 M24.44 70.22 C42.79 46.89, 62.63 25.83, 83.8 -0.77 M24.25 70.18 C44.24 47.77, 65.22 23.71, 85.3 0.55 M30.01 72.1 C52.58 45.34, 72.8 17.58, 89.5 -0.61 M28.21 70.49 C47.25 50.92, 63.95 29.95, 90.25 -0.38 M35.59 70.91 C53.38 48.93, 70.76 28.19, 96.08 -2.3 M34.09 70.41 C54.01 47.09, 74.04 23.86, 95.15 -1.29 M37.53 72.2 C58.05 51.75, 75.15 28.58, 102.12 2.01 M38.94 70.34 C56.93 49.42, 76.16 28.32, 101.54 0.96 M43.88 71.45 C57.31 56.82, 71.08 38.49, 104.57 1.48 M43.74 70.85 C60.56 52.31, 75.86 33.58, 106.55 -0.99 M50.82 72.49 C71.85 45.89, 96.32 20.34, 111.11 1.01 M50.34 71.49 C72.48 43.82, 97.14 18.11, 111.86 -0.21 M53.47 69.87 C78.32 43.85, 98.61 21.59, 114.32 0.33 M54.87 69.62 C78.68 42.14, 103.58 14.16, 116.48 0.1 M58.33 71.23 C83.8 40.93, 106.45 13.07, 123.43 0.63 M60.69 71.2 C83.88 43.52, 107.97 17.87, 120.97 -0.37 M66.09 71.66 C87 47.75, 107.2 24.6, 127.89 -0.8 M65.85 69.61 C83.96 50.2, 102.28 29.03, 127.64 0.11 M72.06 72.12 C86.83 56.25, 101.26 38.09, 131.64 0.53 M69.98 70.49 C94.03 44.06, 118.64 16.68, 133.34 0.77 M77.02 69.74 C89.38 55.14, 102.4 39.85, 137.45 -1.28 M75.78 70.5 C100.44 43.36, 123.56 16.8, 138.44 1.24 M79.58 72.28 C98.28 55.22, 111.98 35.21, 141.82 -0.19 M81.91 70.19 C98.33 53.78, 112.93 35.13, 144.17 0.29 M87.11 72.45 C111.45 41.82, 134.57 16.56, 147.36 0.21 M86.48 70.74 C111.41 44.01, 133.43 15.05, 147.68 0.72 M92.03 70.31 C105.63 55.21, 121.4 41.71, 153.64 1.02 M91.92 70.88 C116.61 43.06, 139.76 15.88, 153.37 0.07 M98.77 71.6 C113.35 55.53, 127.52 38.06, 157.58 -1.56 M98.49 69.58 C113.83 49.8, 131.51 30.1, 157.89 -0.46 M104.08 70.2 C119.28 50.21, 134.01 34.22, 164.32 -1.86 M103.15 70.95 C115.34 56.04, 128.59 40.79, 163.56 0.73 M107.31 71.16 C124.59 51.28, 144.09 30.5, 167.6 1.61 M108.4 71.77 C129.72 47.62, 150.71 22.73, 169.31 0.49 M114.01 69.4 C133.6 46.61, 152.33 24.86, 176.65 0.58 M112.46 70.55 C132.67 49.84, 150.29 28.18, 174.1 -0.3 M119.6 72.3 C134.89 49.29, 154.22 30, 180.51 -0.65 M117.5 70.61 C137.05 48.66, 156.32 26.45, 179.9 0.14 M123.62 70.8 C136.03 55.8, 150.11 41.84, 186.97 1.19 M124.44 71.62 C137.11 54.88, 150.03 41.1, 185.06 -0.8 M130.06 69.86 C147.53 51.02, 166.32 29.62, 189.61 0.24 M129.84 70.44 C141.91 57.52, 154.14 43.21, 190.01 2.33 M134.29 70.73 C149.09 54.53, 161.54 37.16, 190.64 7.83 M135.39 69.89 C149.54 51.99, 166.48 35.02, 190.65 7.75 M139.37 69.4 C148.69 59.17, 162.6 47.01, 189.22 13.85 M138.81 71.62 C156.12 52.11, 174.72 33.12, 189.18 14.26 M146.97 70.94 C154.8 61.05, 164.81 48.34, 189.76 21.19 M145.33 70.86 C155.61 58.22, 167.2 46.7, 189.02 20.1 M149.74 71.89 C157.46 59.17, 169.47 51.45, 190.28 27.57 M150.56 71.29 C160.98 57.03, 172.61 43.92, 189.7 25.27 M154.17 70.63 C165.79 57.08, 178.94 46.46, 188.63 32.67 M156 69.81 C168.48 58.06, 178.71 44.34, 189.66 33.04 M160.96 69.76 C171.14 59.81, 182.51 47.47, 190.12 36.77 M159.92 71.38 C170.46 61.42, 178.42 51.4, 190.41 37.04 M167.94 70.44 C174.56 60.94, 181.93 51.54, 191.18 43.37 M166.86 69.81 C174.18 62.24, 180.23 54.64, 188.83 44.37 M170.38 70.84 C174.97 66.15, 179.17 63.18, 189.61 50.29 M172.48 70.59 C178.26 63.18, 184.73 56.33, 189.86 49.06 M175.98 72.35 C178.62 67.33, 181.67 64.81, 188.94 56.09 M177.09 69.74 C181.25 65.71, 187 59.88, 189.54 56.93 M181.48 70.65 C184.92 68.89, 186.98 65.78, 188.92 62.9 M182.35 70.63 C185.3 67.78, 187.69 64.57, 189.54 62.99" stroke="#82c91e" stroke-width="0.5" fill="none"></path><path d="M0.36 0.4 C63.71 0.5, 122.68 -1.05, 189.09 -0.14 M0.7 0.87 C53.35 0.36, 107.72 -0.82, 188.12 -0.5 M188.34 0.43 C188.71 22.17, 189.74 45.84, 186.84 70.21 M187.41 0.18 C187.76 15.85, 186.42 30.31, 188.17 69.19 M186.59 67.73 C133.18 67.52, 80.72 68.03, 1.89 69.63 M187.07 68.23 C147.22 68.13, 106.41 68.09, 0.24 68.62 M0.05 67.79 C1.5 43.13, 0.37 18.16, 0.95 0.4 M-0.48 69.07 C0.48 43.45, 0.65 16.05, 0.92 0.32" stroke="#000000" stroke-width="1" fill="none"></path></g><g stroke-linecap="round" transform="translate(144.29880349523194 162.4609375) rotate(0 94 34.5)"><path d="M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0 M-0.45 5.9 C1.51 3.26, 4.3 2.12, 5.42 1.01 M-0.15 6.74 C1.41 4.57, 2.99 2.1, 4.66 0.7 M1.45 10.66 C4.46 9.72, 6.82 4, 10.92 0.12 M-0.5 12.75 C3.31 7.67, 6.19 4.41, 10.7 -0.27 M1.74 17.3 C4.26 12.91, 5.77 10.65, 17.59 1.66 M-0.18 17.92 C4.52 11.74, 10.96 5.74, 16.58 0.42 M1.03 25.87 C7.61 16.31, 14.07 10.19, 21.91 -1.29 M0.24 24.96 C6.72 17.18, 12.11 9.93, 22.03 0.87 M0.89 28.93 C5.55 22.66, 11.26 17.3, 25.92 -0.01 M0.58 31.38 C9.35 19.04, 19.76 7.24, 26.28 0.36 M0.12 35.58 C4.39 27.8, 14 22.68, 32.47 1.05 M-1.15 36.71 C10.34 24.99, 21.02 12.52, 30.91 -1.02 M-1.26 41.74 C10.3 33.91, 19.74 21.6, 37.6 -1.37 M-0.72 41.67 C10.56 30.6, 19.97 20.11, 36.77 0.35 M1.65 48.84 C13.31 35.22, 24.18 20.8, 41.47 1.07 M0.58 49.33 C12.68 34.03, 26.51 19.63, 43.45 0.45 M0.84 54.87 C20.01 34.24, 37.74 10.93, 48.72 -1.32 M0.66 54.59 C16.04 35.99, 30.31 18.63, 48.23 0.45 M-0.2 60.78 C13.17 43.24, 29.78 29.79, 51.31 -1.9 M-0.4 61.04 C15.72 44.37, 28.68 26.47, 53.46 -0.51 M-0.32 65.63 C21.23 44.12, 41.87 19.16, 56.95 0.7 M0.46 66.49 C15.17 47.88, 32.91 29.55, 57.57 -0.46 M0.96 70.92 C15.88 54.67, 29.61 38.9, 63.92 0.9 M1.41 69.8 C21.45 47.58, 41.29 25.43, 64.45 0.12 M8.48 70.24 C29.36 47.77, 48.54 22.34, 69.5 0.65 M7.37 70.95 C23.58 52.44, 39 34.41, 68.42 -0.75 M13.67 68.93 C36 41.41, 59.88 13.79, 72.81 -0.33 M12.83 71.1 C36.24 42.81, 59.82 16.3, 73.66 0.11 M18.89 69.42 C41.05 44.77, 66.83 16.3, 79.18 1.95 M18.66 70.4 C36.11 50.2, 55.13 28.21, 79.14 0 M24.93 69.31 C46.78 41.92, 70.4 17.07, 83.04 -1.96 M24.29 70.54 C43.36 46.77, 65.69 21.94, 84.05 -0.97 M27.45 71.83 C42.25 53.4, 55.97 37.87, 88.31 -0.53 M28.63 71.57 C46.51 49.33, 65.18 27.44, 90.78 1.02 M35.83 72.14 C47.79 55.85, 59.94 38.78, 95.25 1.09 M33.51 70.7 C52.1 48.52, 70.18 27.56, 96.3 0.23 M37.55 71.79 C55.12 51.96, 73.69 31.57, 100.83 -0.52 M38.59 71.16 C57.52 50.99, 75.04 28.99, 101.14 0.27 M45.04 68.99 C57.23 52.89, 70.87 38.62, 105.63 -0.68 M44.87 70.94 C60.78 50.43, 79 31.34, 106.81 -1.17 M48.12 69.07 C74.82 43.79, 96.09 18.47, 110.19 -0.27 M49.56 71.68 C66.52 51.91, 82.88 31.89, 110.73 0.53 M56.79 70.81 C78.42 45.41, 97.95 19.62, 117.27 1.44 M55.53 71.41 C76.19 47.52, 96.02 23.77, 117.03 0.49 M61.67 72.86 C78.49 50.5, 99.42 28.97, 123.44 1.37 M60.27 71.42 C75.37 51.71, 91.05 34.6, 122.76 -0.64 M64.86 72.04 C86.2 49.83, 104.23 26.18, 126.81 -0.68 M65.32 71.03 C80.51 54.72, 94.31 38.32, 126.11 0.4 M72.28 69.8 C87.08 54.28, 102.77 34.58, 133.18 1.02 M71.19 70.44 C96.33 41.85, 120.23 15.82, 133.18 -0.93 M76.59 70.53 C97.8 43.92, 123.52 18.46, 136.46 0.55 M76.81 69.5 C91.32 54.71, 104.01 40.21, 136.94 -0.21 M81.56 71.97 C101.19 47.56, 123.05 24.14, 141.56 -1.29 M82.49 70.58 C96.92 52.53, 113.04 34.04, 142.65 0.78 M88.9 71.56 C113.39 43.11, 136.63 14.17, 148.68 1.39 M87.3 71.32 C112.62 42.06, 135.43 13.91, 148.8 0.89 M90.71 68.86 C107.66 50.89, 125.11 31.89, 152.3 -2.08 M92.06 71.49 C114.03 45.29, 136.77 18.76, 154.55 0.39 M96.27 71.87 C121.94 46.24, 141.64 20.29, 157.47 -0.48 M98.78 69.75 C119.91 45.05, 141.52 19.23, 158.67 -0.24 M104.49 71.44 C123.4 46.97, 143.01 22.74, 162.71 1.58 M103.53 70.55 C115.47 55.25, 129.64 38.52, 164.98 0.56 M106.07 72.38 C127.36 50.38, 144.07 25.86, 168.39 2.1 M107.32 71.59 C132.37 43.13, 155.55 16.26, 169.27 0.2 M115.21 72.09 C136.7 42.9, 163.93 15.29, 175.62 0.03 M114.23 70.96 C131.87 48.13, 151.98 26.11, 174.76 0.76 M117.21 71.19 C144 42.39, 167.78 16.25, 178.58 1.68 M117.68 70.17 C133.57 55.86, 147.48 37.82, 181.02 -0.19 M122.75 72.62 C141.19 51.42, 154.52 36.85, 187.44 -0.93 M123.2 71.7 C142.76 47.8, 161.37 27.71, 185.42 -0.78 M128.2 72.08 C148.16 47.97, 170.5 27.73, 187.41 1.8 M129.37 71.86 C146.28 49.72, 165.57 30.23, 188.76 1.48 M134.56 72.31 C153.24 48.47, 173.31 26.88, 189.59 7.47 M135.23 71.52 C147.34 54.67, 161.78 40.08, 190.67 6.5 M139.77 69.55 C153.03 58.8, 162.34 43.75, 191.26 14.95 M139.26 71.03 C155.36 52.94, 170.33 36.4, 190.47 13.42 M145.64 71.85 C163.84 48.7, 180.94 30.48, 188.23 18.88 M144.79 70.95 C160.96 53.19, 175.97 37.62, 190.09 19.39 M150.19 69.5 C158.75 61.8, 168.86 50.22, 191.15 27.46 M150.95 70.88 C159.9 60.18, 169.54 49.07, 188.93 26 M154.55 69.37 C170.41 57.59, 181.51 39.64, 187.74 33.64 M156.1 70.3 C168.72 57.07, 181.88 42.06, 188.66 32.7 M159.32 69.29 C169.33 60.6, 177.71 52.63, 190.44 37.65 M160.77 71.35 C170.36 58.4, 181.96 46.62, 189.43 37.95 M167.43 72.45 C175.41 61.39, 184.04 51.03, 188.08 45.77 M167.08 69.67 C174.75 61.98, 183.82 51.99, 190.1 44.27 M172.56 69.72 C178.56 63.82, 181.95 58.83, 188.09 49.28 M171.74 71.19 C178.9 62, 186.51 53.58, 189.01 49.77 M177.94 70.12 C179.65 64.33, 184.78 59.12, 188.88 55.07 M177.38 70.92 C178.87 68.08, 182.74 63.48, 188.94 56.96 M181.47 70.97 C184.43 68.78, 185.69 66.14, 189.68 63.54 M181.87 70.35 C184.87 68.1, 187.35 65.15, 189.58 62.55" stroke="#82c91e" stroke-width="0.5" fill="none"></path><path d="M1.83 -1.48 C57.94 -2.64, 116.2 -0.8, 186.54 1.97 M0.91 -0.38 C41.98 0.88, 81.15 1.88, 188.46 -0.17 M186.72 1.35 C187.33 16.88, 188.98 37.6, 187.41 69.64 M188.5 0.72 C187.44 25.01, 189.12 50.35, 187.25 68.3 M187.56 69.97 C111.47 71.22, 36.5 69.38, 1.21 67.09 M187.98 69.98 C129.98 66.6, 69.96 66.22, -0.28 68.14 M-0.56 70.85 C2.58 47.31, -1.27 22.82, 0.04 -1.68 M0.32 69.75 C-0.17 54.53, 1.03 38.33, -0.04 -0.17" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(175.15817849523194 455.9921875) rotate(0 50.5 12.5)"><text x="0" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="start" style="white-space: pre;" direction="ltr">foo/foo.go</text></g><g stroke-linecap="round" transform="translate(151.13083474523194 551.84765625) rotate(0 67.876953125 34.046875)"><path d="M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0 M-0.64 7.16 C1.72 4.42, 4.03 1.6, 4.84 0.95 M-0.5 6.4 C1.78 4.1, 3.08 2.43, 4.96 0.06 M1.13 12.13 C3.86 6.99, 9.5 3.48, 11.1 -1.34 M0.36 12.15 C3.44 7.87, 8.52 3.6, 10.57 -0.01 M-1.22 16.53 C2.75 16.13, 4.99 9.56, 15.22 1.16 M0.51 19.44 C5.33 12.02, 11.73 4.46, 15.41 0.28 M-0.83 24.58 C9.14 15.88, 17.78 5.85, 23.19 1.61 M0.96 24.29 C6.39 17.1, 13.93 9.61, 20.42 -0.64 M0.32 30.27 C10.93 18.57, 20.3 6.48, 25.91 1.25 M-0.56 30.6 C8.41 20.47, 17.74 11.94, 26.35 1.25 M-0.18 37.54 C8.92 27.58, 16.2 18.11, 33.23 -1.84 M0.49 37.53 C8.3 28.67, 13.95 20.17, 31.18 -0.24 M-1.27 42.9 C7.38 34.19, 15.56 21.45, 38.52 1.46 M-0.24 42.58 C6.99 34.49, 14.35 26.04, 37.05 -0.56 M1.23 50.12 C14.62 33.92, 28.24 16.47, 41.46 1.55 M0.24 48.72 C10.49 37.89, 19.76 25.88, 41.74 0.29 M0.87 53.25 C13.37 40.6, 21.66 30.35, 48.47 0.58 M1.03 53.85 C10.49 42.68, 21.75 30.65, 47.55 0.61 M0.91 59.11 C10.41 44.73, 25.94 30.47, 51.56 -1.21 M0.24 61.71 C14.02 43.11, 29.19 27.34, 52.77 -0.18 M0.55 66.34 C15.18 50.82, 28.06 32.79, 56.72 0.86 M-0.15 67.4 C20.74 41.88, 43.86 15.1, 58.61 -0.73 M1.21 68.99 C23.96 44.17, 45.41 22.86, 62.79 -1.68 M2.48 69.4 C18.84 52.07, 34.38 34.57, 64.63 -0.97 M8.95 69.29 C22.78 51.56, 39.92 34.29, 69.83 -0.06 M8.4 70.72 C22.65 52.96, 38.73 34.57, 69.69 0.72 M12.66 68.63 C36.89 44.06, 57.91 15.74, 73.98 -1.96 M14.31 70.41 C29.26 50.4, 44.55 32.7, 75.4 0.34 M17.73 72.03 C39.88 46.06, 57.48 26.53, 79.88 -1.06 M17.49 70.4 C40.86 44.46, 62.27 18.5, 79 1.04 M22.25 69.44 C39.89 55.53, 49.88 38.6, 83.5 1.27 M24.67 69.26 C43.11 47.24, 64.8 24.4, 84.87 -0.03 M29.4 70.16 C48.67 48.16, 69.14 23.38, 88.54 -1.6 M28.92 71.07 C44.32 52.19, 60.32 33.3, 89.44 -0.91 M33.71 69.96 C57.12 42.97, 80.5 17.94, 97.29 0.77 M34.45 70.94 C54.3 46.48, 75.85 23.01, 96.59 -0.06 M40.66 69.69 C54.95 53.59, 72.58 34.26, 99.02 -1.71 M38.83 70.09 C53.67 54.14, 69.85 37.1, 100.64 0.52 M46.35 69.92 C61.69 50.28, 76.34 34.86, 104.86 -1.27 M45.21 70.95 C61.51 52.69, 76.2 34.88, 105.77 0.02 M51.75 70.06 C75.27 42.56, 98.89 16.03, 112.13 -1.95 M51.1 70.64 C73.07 44.28, 96.82 18.55, 110.95 -0.26 M55.03 70.74 C75.16 49.03, 94.51 27.01, 114.61 -0.45 M55.28 69.85 C75.57 46.67, 95.17 23.3, 116.73 0.54 M62.49 72.17 C76.2 52.47, 90.71 35.81, 122.19 0.5 M61.29 69.64 C80.53 46.81, 102.3 23.19, 121.44 -0.03 M64.87 72.52 C85.14 48.31, 105.91 27.59, 128.5 -1.21 M66.34 70.23 C83.58 50.53, 101.6 30.37, 127.45 1.32 M72.27 70.33 C83.91 55.44, 97.51 36.3, 133.14 -0.03 M70.73 69.82 C93.55 46.13, 115.12 21.12, 131.9 -0.81 M78.51 70.81 C90.08 54.8, 104.15 38.01, 137.4 0.47 M76.81 71.43 C96.23 47.83, 117.44 23.87, 137.02 1.02 M84.02 68.3 C103 43.75, 126.53 20.3, 135.87 5.7 M82.41 69.68 C95.1 55.55, 109.26 39.85, 136.27 7.71 M88.19 68.59 C104.95 48.5, 124.64 28.85, 135.88 11.11 M87.81 69.62 C103.26 50.95, 120.34 33.07, 136.38 13.09 M92.25 71.29 C105.22 56.09, 119.2 38.16, 136.05 19.87 M93.1 69.51 C101.24 60.49, 110.73 50.13, 136.41 20.07 M99.68 72.26 C109.2 59.74, 120.56 45.84, 137.1 24.76 M97.2 69.7 C108.21 57.75, 117.57 46.99, 137.18 24.92 M103.04 69.92 C113.72 57.01, 126.57 40.53, 138.22 30.54 M103.24 69.37 C109.27 62.42, 116.9 52.84, 136.18 32.07 M108.35 71.69 C115.47 61.76, 120.12 57.76, 135.29 37.02 M107.54 69.39 C117.88 58.79, 127.36 48.65, 136.33 37.72 M114 68.28 C121.77 63.74, 124.73 57.14, 136.53 41.75 M115.01 69.11 C118.6 64.99, 123.57 58.9, 136.25 42.83 M119.09 72.17 C123.92 65.61, 125.65 62.95, 138.19 50.62 M118.12 71.17 C124.85 64.41, 129.91 57.48, 136.42 50.24 M126.25 71.78 C131.14 65.71, 133.85 59.26, 138.64 56.91 M124.33 70.33 C127.95 65.13, 133.11 60.48, 137.96 56.19 M130.06 70.38 C131.16 68.24, 134.43 64.04, 135.94 60.92 M129.27 70.32 C132.22 68.1, 134.15 65.69, 137.37 61.61" stroke="#82c91e" stroke-width="0.5" fill="none"></path><path d="M-1.21 -0.9 C51.53 1.06, 102.99 -0.27, 136.76 1.85 M0.19 0.56 C28.41 -0.54, 57.63 0.05, 135.82 -0.19 M136.28 -0.29 C134.85 27.1, 136.27 49.14, 136.07 68.94 M136.59 0.51 C136.15 18.07, 136.45 35.92, 135.6 68.82 M137.64 69.52 C100.59 67.73, 64.18 69.41, 1.34 68.52 M135.93 67.78 C104.68 66.06, 75.71 67.01, -0.99 68.96 M0.99 67.38 C-1.02 49.29, 0.65 33.51, -0.56 -1.03 M-0.41 68.31 C-0.56 47.5, -1.02 25.2, -0.1 0.62" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(170.00583474523194 572.359375) rotate(0 51 12.5)"><text x="0" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="start" style="white-space: pre;" direction="ltr">bar/bar.go</text></g><g stroke-linecap="round" transform="translate(153.45114724523194 689.55078125) rotate(0 67.876953125 34.046875)"><path d="M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0 M-0.34 7.13 C1.95 3.85, 3.27 1.06, 5.48 0.29 M-0.51 6.22 C1.21 5.37, 1.9 4, 4.61 0.73 M-1.28 12.26 C1.72 8.32, 6.08 7.32, 11.64 0.44 M0.2 12.82 C3.54 7.73, 6.57 5.41, 10.65 -0.79 M0.04 18.76 C4.98 12.07, 8.37 7.32, 16.76 2.06 M-0.35 17.71 C3.71 15.64, 7.14 10.29, 15.41 0.77 M0.27 22.42 C6.69 14.8, 16.65 5.35, 19.98 -1.42 M0.67 24.33 C5.57 19.23, 10.6 12.64, 20.74 -1.06 M1.22 29.06 C8.03 19.53, 19.4 5.43, 26.52 1.5 M0.01 30.14 C8.85 20.03, 18.41 10.48, 25.87 0.57 M0.51 35.65 C10.53 23.79, 20.24 15.98, 32.83 -0.72 M-0.71 36.23 C11.76 22.51, 25.3 7.28, 30.91 -0.56 M1.55 42.23 C9.74 34.21, 15.61 25.53, 37.93 1.13 M-0.13 41.97 C14.51 27.76, 26.86 11.22, 36.37 0.36 M0.05 47.87 C13.2 37.08, 24.15 20.62, 41.08 0.58 M-0.31 49.49 C17.06 28.59, 31.91 10.58, 43.24 -0.71 M0.91 54.93 C7.78 43.14, 20.98 32.73, 48.85 -0.84 M0.66 54.59 C16.61 37.97, 31.81 19.28, 46.59 -0.45 M1.36 60.79 C15.97 41.3, 33.44 24.24, 52.8 -2.05 M0.28 60.91 C12.08 48.42, 22.33 35.77, 53.57 0 M-0.04 66.14 C20.91 40.96, 41.68 20.12, 56.57 1.32 M-1.04 66.89 C16.93 46.87, 34.87 27.28, 59.03 -0.75 M1.6 71.89 C26.4 43.61, 51.37 16.85, 65.51 0.43 M3.55 69.19 C15.97 55.05, 30.33 39.51, 63.54 -0.2 M6.65 69.07 C28 47.46, 51.58 22.2, 69.81 0.94 M6.94 71.16 C23.59 50.87, 39.63 33.52, 68.96 0.29 M11.98 71.2 C27.84 49.44, 46.68 31.4, 74.14 -1.4 M13.41 69.76 C35.51 45.26, 55.44 20.93, 74.53 -0.37 M19.28 71.88 C35.12 52.58, 51.44 31.52, 80.75 -1.1 M17.49 69.75 C33.16 51.73, 49.69 32.77, 78.42 -0.77 M22.07 71.41 C40.87 50.55, 59.28 27.28, 83.1 0.64 M23.38 70.85 C42.89 50.03, 59.29 28.78, 85.76 -0.85 M28.85 68.47 C51.74 43.47, 73.24 17.13, 88.99 -0.36 M28.54 69.97 C41.29 57.03, 53.61 41.13, 90.25 0.34 M32.05 72.46 C48.7 56.5, 61.4 38.02, 94.19 0.27 M33.04 70.12 C52.8 46.6, 72.43 24.65, 96.19 -1.25 M38.44 71.35 C55.58 48.44, 74.41 29.01, 101.57 -0.84 M40.45 70.83 C57.47 51.38, 72.59 30.57, 100.05 -0.4 M43.54 71.6 C66.96 44.76, 86.63 22.89, 106.69 0.77 M44.67 70.66 C62.47 50.71, 80.16 30.43, 106.56 -0.49 M48.57 70.52 C66.39 51.18, 81.56 32.91, 112.97 1.04 M49.34 70.05 C71.62 45.98, 91.24 23.66, 112.23 0.73 M55.6 71.9 C75.11 47.46, 92.42 25.46, 116.63 -0.25 M55.39 69.57 C69.29 55.52, 81.93 41.81, 116.77 0.02 M61.17 69.61 C77.5 50.4, 97.45 32.21, 121.11 0.41 M61.11 70.07 C79.49 49.64, 97.35 28.55, 121.95 -0.86 M67.4 71.25 C79.18 56.8, 92.63 40.01, 127.46 2.11 M65.74 70.9 C82.01 52.56, 98.35 33.42, 126.43 1.3 M71.63 69.76 C90.22 50.27, 107.42 30.28, 131.34 -0.06 M71.47 70.06 C95.23 43.55, 120.76 15.67, 133.17 0 M77.54 71.08 C92.3 51.48, 112.12 29.87, 137.44 1.33 M77.06 70.42 C90.71 52.5, 105.52 36.9, 136.34 0.11 M80.78 69.7 C98.08 54.08, 113.87 36.26, 137.89 9.46 M81.88 69.89 C96.3 54.31, 111.61 36.97, 136.07 7.71 M88.08 72.39 C105.29 50.98, 118.94 29.96, 138.4 13.52 M87.46 69.62 C98.59 56.86, 110.44 41.84, 137.17 13 M90.88 69.73 C109.39 52.61, 122.28 33.61, 135.62 19.75 M93.59 70.17 C105.91 55.41, 116.13 42.41, 136.79 19.83 M96.48 71.77 C110.57 52.28, 125.62 35.28, 138.63 26.45 M97.83 69.71 C113.17 52.19, 129.13 34.19, 136.44 25.33 M101.63 71.67 C112.53 58.95, 118.56 49.76, 136.13 31.67 M103.63 70.21 C110.12 61.8, 118.03 53.34, 137.56 32.14 M107.67 69.33 C119.56 57.83, 127 47.44, 137.36 37.53 M107.85 69.61 C119.1 57.77, 128.1 46.23, 136.92 37.28 M114.15 70.95 C123.81 58.04, 131.15 49.67, 138.53 42.15 M114.83 70.04 C119.27 63.73, 124.75 59.13, 137.47 42.66 M117.99 68.76 C121.93 65.62, 127.64 59.77, 137.22 51.49 M119.97 69.98 C122.84 65.81, 125.85 61.82, 137.16 49.47 M123.12 68.62 C129.45 66.91, 134.54 58.9, 137.34 55.71 M123.83 70.41 C126.35 67.55, 130 64.37, 136.41 55.15 M130.54 69.78 C131.18 67.18, 133.79 64.55, 136.57 61.38 M129.54 70.79 C131.72 67.3, 134.35 64.69, 137.22 61.73" stroke="#82c91e" stroke-width="0.5" fill="none"></path><path d="M1.74 -0.02 C54.15 -1.9, 105.58 0.06, 136.42 -1.15 M0.74 0.85 C36.39 0.59, 72.3 1.52, 136.03 -0.48 M134.32 -0.44 C138.33 24.41, 135.45 52.42, 134.43 68.07 M136.13 -0.95 C137.06 15.18, 136.21 29.49, 134.85 68.86 M133.93 67.67 C91.26 69.65, 44.93 69.07, 1.28 68.79 M136.34 67.38 C96.11 66.97, 56.08 67.82, 0.03 67.39 M-0.87 69.65 C1.3 52.3, -1.78 31.65, 1.6 0.4 M0.95 68.67 C0.31 47.88, -0.32 28.1, -0.72 -0.21" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(186.38474099523194 709.9296875) rotate(0 33.5 12.5)"><text x="0" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="start" style="white-space: pre;" direction="ltr">main.go</text></g><g stroke-linecap="round" transform="translate(453.30661599523194 432.796875) rotate(0 79 37.58203125)"><path d="M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0 M0.48 5.8 C0.78 4.53, 1.72 3.12, 5.75 0.81 M0.05 6.51 C0.84 5.08, 2.19 3.65, 4.63 0.42 M0.53 12.43 C4.69 7.27, 8.47 2.7, 10.74 0.43 M-0.54 11.74 C3.61 7.2, 7.32 4.51, 9.94 -0.27 M-2.11 19.87 C4.23 16.15, 6.49 10.08, 16.11 -0.49 M0.41 18.8 C5.28 12.52, 11.21 6.04, 15.18 0.32 M0.77 23.38 C7.11 14.05, 15.43 6.96, 20.34 1.37 M-0.61 23.45 C6.52 16.36, 13.13 8.28, 20.46 0.46 M0.94 29.7 C11.84 19.35, 22.36 6.03, 27.75 -1.27 M-0.46 30.04 C7.54 21.37, 16.23 12.76, 27.2 0.47 M0.48 38.83 C7.85 26.44, 19.23 15.95, 32.33 0.14 M-1.24 37.61 C8.73 25.52, 18.87 15.78, 31.9 -0.14 M-0.41 42.73 C15.57 25.78, 28.9 9.26, 38.19 0.5 M-0.28 42.86 C14.47 27.15, 28.52 9.49, 36.94 0.18 M0.2 47.95 C9.51 36.06, 21.06 28.2, 42.4 -0.6 M0.14 49.24 C10.57 36.42, 21.58 23.66, 41.98 -0.28 M0.24 54.75 C17.96 32.58, 37.14 13.49, 47.37 -0.44 M-0.51 54.48 C17.8 32.73, 37.19 11.82, 46.92 0.45 M1.97 59.5 C13.88 44.79, 28.34 28.72, 51.76 1.13 M0.02 61.45 C11.44 48.06, 22.91 33.88, 53.34 0.7 M-1.77 65.75 C20.62 45.87, 41.59 21.91, 58.8 0.12 M-0.55 67.68 C21.53 41.24, 44.12 18.03, 57.4 0.07 M0.05 74.92 C23.04 49.79, 45.99 21.33, 63.21 -1.25 M-0.73 72.43 C23.24 45.78, 47.27 18.76, 63.33 0.2 M2.35 78.63 C24.18 50.94, 49.84 21.56, 67.54 -0.18 M0.85 77.49 C20.98 54.63, 40.68 32.09, 68.32 -0.4 M7.47 76.81 C24.61 54.75, 45.06 33.82, 73.09 1.11 M7.68 75.79 C26.08 56.29, 43.87 35.48, 74.01 0.45 M13.63 76.68 C34.34 51.81, 55.12 31.69, 80.23 1.72 M12.29 76.69 C35.93 49.9, 59.98 20.93, 79.37 -0.6 M17.67 78.01 C33.09 58.84, 45.9 43.94, 83.32 0.49 M17.62 75.79 C35.89 58.2, 51.43 37.8, 84.18 0.41 M24.18 75.27 C41.85 56.47, 61.05 35.87, 91.05 -1.66 M22.65 77.47 C42.01 55.64, 60.23 32.33, 89.94 -0.42 M28.32 76.05 C48.34 56.31, 65.86 32.06, 97.36 0.65 M27.84 75.71 C42.4 58.77, 59.09 41.5, 95.33 -0.12 M32.23 75.38 C54.8 53.54, 73.79 33.81, 101.77 -0.37 M34.06 76.95 C49.14 57.39, 65.71 38.94, 101.14 0.06 M39.91 78.14 C63.95 49.16, 86.95 26.81, 108.26 0.73 M40.06 76.83 C60.1 53.39, 78.47 31.13, 105.7 -0.62 M45.57 77.42 C67.71 46.79, 94.06 20.5, 109.69 0.97 M43.37 77.06 C65.02 53.39, 85.34 30.42, 111.81 0.52 M48.52 76.9 C70.48 53.71, 90.79 31.86, 117.96 0.09 M49.76 76.21 C72 50.37, 93.61 26.54, 115.56 1.02 M53.55 77.25 C74.05 58.48, 92.27 37.05, 123.7 -0.82 M54.16 76.52 C80.52 46.48, 108.04 17.44, 122.5 0.44 M61.78 78.43 C83.4 50.99, 108.61 20, 127.93 -0.72 M60.11 76.7 C85.32 47.21, 110.34 19.31, 127.9 -0.62 M67.08 78.15 C87.76 51.81, 111.54 23.44, 132.24 0.53 M64.69 76.8 C88.44 52.8, 109.51 26.4, 133.48 -0.93 M70.22 78.97 C95.13 47.96, 120.42 21.51, 139.23 0.53 M71.34 77.69 C90.26 57.16, 107.3 35.22, 138.43 0.13 M74.62 78.87 C95.53 53.97, 115.73 30, 143.32 0.71 M75.99 76.18 C101.34 47.66, 128.22 16.98, 142.75 -0.56 M81.92 77.97 C96.81 57.45, 115.14 37.7, 147.16 0.74 M81.38 78.07 C97.22 59.12, 111 42.3, 148.26 0.92 M86.23 77.56 C104.07 56.47, 123.6 36.77, 152.5 0.86 M87.78 77.7 C110.97 49.77, 135.89 19.48, 154 0.37 M90.52 78.56 C108.03 56.41, 127.04 38.22, 160.56 0.29 M91.92 76.79 C117.66 45.94, 145.33 16.32, 159.2 0.23 M97.49 75.83 C116.83 57.29, 133.07 36.36, 157.01 6.35 M98.49 77.2 C115.69 55.74, 134.68 33.75, 158.77 7.24 M101.92 76.58 C113.56 64.86, 125.18 49.96, 158.69 11.78 M103.01 77.81 C122.45 53.63, 144.56 28.18, 158.64 12.11 M109.57 78.73 C126.85 53, 148.02 31.82, 156.85 19.67 M107.29 77.29 C123.87 59.14, 140.94 39.31, 159.51 18.93 M113.55 77.28 C125.84 61.53, 137.72 47.75, 157.34 24.86 M112.4 76.9 C126.38 61.95, 139 47.01, 157.64 25 M117.19 78.72 C127.43 65.35, 136.27 58.53, 158.87 28.99 M118.06 77.35 C128.14 66.75, 136.89 57.93, 159.67 30.31 M122.42 75.36 C132.62 67.67, 141.27 54.98, 157.38 38.96 M123.61 77.58 C132.31 66.59, 142.17 56.2, 159.52 36.45 M128.63 75.74 C137.83 65.9, 145.29 57.36, 160.23 41.96 M129.41 77.57 C138.64 66.33, 145.7 57.82, 159.19 44.08 M133.09 78.96 C139.46 68.46, 146.61 60.45, 157.91 48.18 M133.82 77.17 C142.95 66.11, 153.18 55.09, 158.98 50.04 M141.76 77.12 C145.31 70.97, 149.26 65.73, 159.63 57.38 M140.63 76.9 C144.91 70.81, 151.69 63.82, 157.68 56.44 M145.7 77.65 C147.21 73.9, 152.22 66.24, 159.6 62.06 M145.98 76.77 C149.73 71.44, 154.93 65.78, 159.41 62.14 M151.45 77.27 C154.12 72.99, 154.99 70.64, 157.83 66.5 M150.14 76.91 C153.09 74.56, 154.88 71.77, 158.52 67.63 M155.71 77.3 C156.28 76.25, 157.6 74.84, 158.63 74.06 M155.47 77.06 C156.83 76.01, 157.74 74.75, 158.29 74.12" stroke="#fab005" stroke-width="0.5" fill="none"></path><path d="M-0.01 -1.07 C30.41 -0.08, 64.17 -0.43, 158.61 -0.17 M0.33 0.86 C41.08 0.26, 80.58 1.16, 157.02 -0.05 M156.17 0.92 C157.87 19.9, 155.76 38.15, 158.27 73.75 M157.26 -0.47 C158.17 24.27, 158.3 48.96, 158.36 74.69 M156.47 74.44 C102.25 76.44, 49.23 75.45, -1.34 74.89 M157.89 74.67 C112.38 76.13, 68.6 76.38, -0.84 75.48 M1.14 76.65 C1.04 53.35, -0.38 29.9, 0.91 0.42 M-0.86 74.79 C1.55 56.56, 1.53 37.34, 0.5 -0.78" stroke="#000000" stroke-width="1" fill="none"></path></g><g stroke-linecap="round" transform="translate(461.29880349523216 304.61328125) rotate(0 79 37.58203125)"><path d="M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0 M0.05 6.69 C1 3.91, 2.55 2.97, 4.8 -0.4 M-0.21 6.7 C1.35 3.86, 3.37 1.83, 4.63 0.02 M0.68 11.09 C4.8 9.8, 7.36 6.07, 11.05 1.16 M0.33 11.42 C2.73 8.11, 6.57 4.91, 9.88 -0.11 M1.05 19.6 C1.73 12.95, 7.92 10.79, 13.88 0.42 M-0.91 18.02 C5.86 12.52, 11.85 5.07, 16.57 0.52 M0.61 23.01 C5.25 17.44, 9.17 9.8, 21.87 -0.37 M0.34 23.94 C4.66 18.13, 10.51 12.3, 22.04 -0.74 M0.72 32.22 C8.97 21.33, 16.45 10.14, 25.54 -0.54 M-0.78 30.17 C5.66 22.44, 11.89 15.77, 25.53 0.22 M1.41 36.2 C10.35 25.99, 19.63 16.35, 30.13 0.02 M-0.96 37.39 C6.47 29.59, 13.26 22.6, 32.62 -0.02 M-0.06 41.63 C10.68 31.55, 19.55 17.11, 38.87 0.76 M0.17 42.27 C7.89 32.17, 15.52 24.03, 36.66 -0.2 M1.18 48.82 C8.13 39.29, 19.24 28.04, 42.55 0.09 M0.85 49.9 C11.16 34.89, 23.39 21.12, 42.77 -0.21 M-1.42 56.02 C20.66 34.77, 36.16 10.44, 46.7 -0.96 M0.64 54.72 C15.56 36.86, 31.24 17.55, 47.44 1.13 M1.32 59.1 C12.6 44.09, 26.04 29.26, 53.17 0.84 M-0.05 60.73 C11.75 47.92, 23.93 34.02, 52.59 0.19 M-0.73 67.9 C13.4 51.68, 28.44 36.72, 59.29 -1.42 M-0.53 66.39 C22.61 42.06, 43.55 17.16, 59.11 0.81 M1.36 74.08 C25.09 48.56, 45.34 18.21, 63.47 -1.17 M0.99 73.1 C13.18 57.82, 25.6 42.17, 62.97 0.39 M0.01 76.81 C27.44 51.69, 47.45 23.27, 68.35 1.24 M2.21 77.34 C22.93 52.94, 43.71 28.3, 68.72 0.16 M9.45 78.06 C23.86 55.8, 44.34 34.8, 74.37 -1.81 M7.57 76.64 C29.25 52.82, 49.82 28.15, 73.59 -0.69 M12.88 78.84 C27.88 61.47, 42.76 43.48, 78.99 -1.58 M11.81 76.32 C30.61 54.23, 50.01 31.25, 79.07 -0.79 M20.04 77.72 C40.48 51.96, 60.21 30.34, 86.22 -1.38 M17.96 76.56 C39.16 51.89, 61.52 28.28, 84.91 -0.41 M22.96 78.25 C48.92 50.6, 72.91 19.88, 89.8 -0.9 M23.58 76.43 C38.73 60.9, 51.76 43.97, 90.76 0.72 M29.68 76.56 C52.28 50.14, 80.22 19.8, 94.81 -0.63 M28.84 76.01 C43.28 59.13, 59.67 42.51, 96.17 -0.39 M35.29 77.04 C51.23 57.01, 66.46 42.37, 100.8 1.81 M34.11 76.64 C57.46 49.36, 81.97 19.87, 100.17 0.17 M39.62 75.87 C62.96 50.7, 88.04 22.79, 107.38 -0.74 M39.98 77.07 C62.49 51.31, 84.28 26.28, 105.37 -0.56 M46.34 76.77 C63.32 56.34, 79.32 33.26, 109.41 -1.34 M44.82 77.67 C57.63 61.99, 71.97 45.09, 111.46 -0.26 M48.57 78.5 C71.03 54.62, 93.16 31.73, 117.93 1.42 M50.89 76.58 C63.46 60.62, 77.25 45.66, 116.67 -0.36 M56.04 78.58 C74.54 54.52, 96.56 31, 122.55 -0.7 M55.87 77.95 C78.32 50.54, 102.71 21.94, 122.57 0.36 M60.67 76.86 C80.84 53.19, 98.79 32.64, 125.88 2.29 M60.9 76.07 C78.81 55, 98.17 33.93, 126.95 0.23 M63.73 75.16 C89.49 54.1, 108.47 26.97, 132.51 -1.04 M66.21 77.62 C80.95 58.2, 96.31 41.71, 133.21 -0.36 M68.82 77.67 C87.7 58.73, 104.44 40.5, 136.12 0.12 M70.45 76.54 C89.89 55.81, 107.56 34.96, 137.93 1.2 M76.22 78.77 C99.28 51.04, 120.37 29.65, 145.08 -1.58 M75.59 76.54 C100.71 47.53, 126.1 17.85, 142.9 -0.06 M81.35 78.96 C97.47 58.02, 115.13 37.06, 149.62 -0.02 M81.73 77.47 C105.21 49.75, 129.06 21.25, 148.74 -0.49 M87.72 77.21 C102.42 57.37, 117.51 39.25, 155.43 0.03 M86.52 76.3 C110.58 49.15, 135.36 23.99, 152.91 0.33 M90.06 78.59 C107.02 57.92, 125.25 38.94, 158.8 -1.49 M92.73 77.3 C118.12 46.89, 144.88 16.27, 159.31 -0.17 M95.91 77.88 C111.44 60.6, 123.81 45.25, 158.32 6.5 M98.3 76.21 C113.96 57.68, 129.51 38.59, 158.41 7.38 M100.82 75.22 C123.98 53.01, 144.31 31.94, 156.37 12.72 M101.91 76.44 C120.63 57.14, 136.03 36.87, 159.19 13.39 M109.9 75.71 C128.44 54.59, 144.27 32.28, 157.11 17.79 M109.02 77.27 C118 65.47, 129.68 51.7, 159.55 18.1 M112.97 77.06 C130.02 59.34, 144.07 43, 157.43 24.79 M113.47 78.03 C126.67 62.63, 138.08 47.77, 157.69 24.73 M118.21 77.2 C134.04 57.38, 150.41 40.54, 159.92 31.65 M119.53 76.24 C129.2 65.6, 137.39 53.68, 159.55 30.41 M123.26 77.92 C135.76 64.31, 142.24 53.39, 160.04 38.79 M123.43 77.9 C130.67 68.56, 137.77 59.62, 158.4 36.42 M128.84 76.44 C140.6 64.48, 150.27 51.44, 159.04 45.44 M129.47 77.58 C139.7 63.16, 151.62 51.8, 158.17 43.03 M133.9 77.13 C140.12 69.2, 145.49 62.94, 158.38 49.59 M133.56 76.64 C139.58 71.3, 145.76 65.07, 158.38 50.02 M141.2 75.04 C147.28 72.36, 150.13 64.31, 158.16 55.81 M139.28 77.44 C144.4 70.34, 148.62 65.3, 158.91 55.1 M144.51 75.6 C149.85 70.16, 154.03 64.74, 158.05 59.64 M145.44 77.52 C148.7 71.84, 154.33 67.24, 159.46 60.81 M150.35 77.58 C152.23 75.53, 154.22 71.3, 159.69 67.38 M150.36 76.11 C151.61 74.93, 153.25 72.65, 158.87 67.09 M155.76 76.77 C156.13 76.2, 156.55 76.09, 158.51 74.33 M155.81 76.92 C156.32 76.36, 156.69 75.68, 158.15 74.1" stroke="#fab005" stroke-width="0.5" fill="none"></path><path d="M-1.06 0.46 C35.27 0.43, 69.59 0.88, 157.14 -0.73 M-0.87 0.37 C44.35 1.17, 90.54 2.37, 157.68 -0.35 M158.94 -0.34 C159.5 24.45, 160.3 52.84, 156.58 75.75 M158.85 0.79 C157.54 27.17, 157.42 53.04, 157 75.34 M157.02 74.75 C102.61 74.54, 46.43 78.24, -0.19 74.98 M157.38 75.63 C106.68 74.43, 56.77 75.66, 0.88 75.7 M-1.45 74.57 C-1.75 48.82, -1.03 22.43, 1.14 1.62 M0.79 75.39 C-1.06 50.28, 0.5 26.08, -0.17 0.4" stroke="#000000" stroke-width="1" fill="none"></path></g><g stroke-linecap="round" transform="translate(497.03317849523194 169.50390625) rotate(0 95 38)"><path d="M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0 M-0.18 6.53 C1.37 4.43, 2.19 2.97, 5.28 0.46 M-0.33 6.59 C1.34 4.94, 2.95 2.94, 5.02 0.21 M1.13 11.8 C1.52 10.01, 5.45 6.34, 11.04 -0.12 M0.87 11.26 C4.65 7.43, 8.31 2.95, 10.98 0.76 M-0.17 19 C2.54 12.14, 7.62 8.64, 14.64 1.31 M0.04 17.44 C4.62 13.01, 7.26 9.1, 16.17 -0.01 M0.88 25.85 C8.77 15.04, 14.47 5.76, 20.45 -1.79 M0.3 25.07 C6.39 15.66, 13.97 8.92, 21.42 -0.9 M1.96 30.23 C8.75 19.72, 17.03 8.9, 27.25 -0.18 M0.61 29.89 C7.55 22.86, 12.85 14.25, 26.57 0.48 M-1.42 37.79 C12.94 23.69, 24.48 10.83, 31.07 1.72 M-0.5 36.28 C9.94 24.69, 21.01 14.33, 31.44 -0.7 M-0.04 44.5 C10.22 31.23, 18.69 19.79, 37.68 0.19 M-0.53 42.06 C9.86 31.85, 17.46 22.88, 36.93 0.56 M0.7 47.33 C15.03 33.69, 28.89 16.8, 41.43 -1.36 M-0.75 49.67 C11.57 35.01, 24.2 22.77, 42.39 -0.17 M-0.99 55.31 C17.32 37.3, 30.79 20.01, 45.67 1.9 M0.52 53.58 C16.03 36.77, 30.7 19.09, 46.62 0.13 M1.06 59.96 C12.32 47.06, 28.31 31.94, 53.56 -1.33 M0.9 61.26 C19.19 37.47, 38.79 15.61, 53.26 0.71 M-0.78 66.36 C21.03 42.58, 42.97 17.65, 56.5 -0.14 M0.71 66.61 C10.72 53.48, 24.54 38.71, 57.75 -0.13 M-0.31 71.84 C22.47 50.35, 41.33 25.7, 65 0.96 M-0.82 73.11 C19.01 51.79, 36.04 29.26, 64.76 -0.25 M0.18 78.28 C24.13 48.63, 51.03 19.91, 69.03 0.43 M2.65 76.57 C15.02 59.96, 28.68 44.46, 69.14 -0.78 M8.77 79.04 C26.81 52.24, 50.45 25.31, 72.9 -1.93 M6.08 78.49 C32.42 48.06, 57.32 18.41, 75.32 0.56 M11.68 78.09 C26.68 62.2, 40.66 46.24, 79.65 1.4 M13.31 77.63 C36.26 49.32, 60.31 24.07, 80.31 0.42 M16.81 75.62 C44.05 50.1, 69.18 21.48, 85.93 0.01 M17.15 78.04 C33.54 56.71, 50.82 38.17, 85.08 0.51 M24.64 78.87 C48.38 47.66, 73.64 19.39, 90.35 0 M22.92 76.37 C42.75 53.73, 63.36 30.68, 89.53 0.5 M28.62 76.58 C51.8 48.92, 82.06 18.51, 96.37 -1.76 M27.34 76.68 C44.22 59.07, 60.46 41.79, 95.92 -1.24 M34.05 77.3 C60.14 47.67, 87.57 13.69, 100.67 0.89 M33.98 77.3 C50.47 56.73, 69.29 37.39, 99.78 -0.75 M38.47 75.84 C55.26 57.85, 72.04 38.52, 108.03 1.64 M38.23 77.59 C57.76 54.18, 77.72 31.53, 105.4 0.25 M41.83 76.29 C61.86 59.45, 78.76 39.51, 111.7 0.18 M44.04 77.51 C61.27 58.43, 75.75 39.77, 110.73 -0.75 M50.21 78.75 C65.24 60.89, 78.68 43.71, 115.62 1.28 M50.15 76.72 C70.07 55.45, 89.26 32.75, 116.18 0.45 M55.43 77.9 C67.58 61.24, 81.33 45.91, 122.09 1.42 M54.33 77.59 C68.56 61.82, 82.97 45.53, 122.81 -0.13 M61.26 78.11 C79.69 53.65, 99.6 31.25, 127.41 -0.58 M60.14 76.8 C84.11 47.93, 111.13 19.19, 126.59 0.37 M63.87 75.88 C80.02 63.1, 90.72 44.37, 132.09 -0.42 M65.86 78.15 C86.21 52.05, 109.21 27.13, 133.15 -0.76 M70.59 78.15 C89.24 56.09, 107.46 34.65, 137.24 2.02 M69.94 77.35 C94.82 50.78, 118.17 21.22, 136.72 1.02 M76.41 76.7 C93.05 58.02, 108.08 42.01, 143.46 1.07 M75.97 76.86 C98.03 53.41, 118.94 30.15, 143.59 0.29 M82.74 78.53 C104.69 49.58, 130.14 22.03, 147.19 -0.31 M82.04 76.68 C104.77 50.1, 126.7 23.52, 149.02 0.5 M85.87 76.23 C111.85 46.36, 136.79 17.71, 155.57 -0.24 M85.76 77.17 C104.63 55.72, 124.02 33.29, 154.7 0.74 M91.8 78.35 C111.01 57.47, 127 38.43, 158.87 0.53 M91.63 77.86 C110.79 55.33, 130.09 32.45, 159.67 0.62 M96.63 75.8 C110.04 62.46, 122.88 43.43, 165.32 0.94 M96.02 78.29 C118.88 52.12, 140.06 25.32, 163.77 -0.95 M101.43 76.17 C121.61 53.35, 142.15 29.12, 169.49 2.04 M102.61 76.76 C119.96 55.79, 138.22 37.29, 168.57 1.04 M108.63 78.17 C129.01 50.32, 150.7 27.43, 175.18 1.33 M107.29 77.22 C128.34 53.23, 151.41 28.69, 174.81 0.51 M112.87 77.95 C139.45 48.71, 162.6 20.25, 179.79 -0.83 M113.62 78.02 C139.42 46.74, 165.26 18.2, 179.33 1.15 M117.38 75.54 C132.46 59.95, 148.59 41.7, 185.2 1.11 M117.79 76.75 C138.14 54.76, 156.98 32.12, 186.53 -0.84 M124.89 77.12 C142.88 56.88, 162.83 31.92, 190.11 0.3 M124.01 77.06 C141.32 55.52, 158.47 36.63, 191.29 0.14 M129.94 77.54 C144.77 56.46, 164.82 37.49, 191.06 6.66 M129.49 77.45 C144.78 58.19, 161.08 40.53, 190.48 6.62 M133.84 78.54 C153.75 57.1, 172.1 35.79, 189.15 12.09 M133.85 76.09 C155.77 51.52, 178.47 26.43, 190.34 13.82 M140.95 79.24 C157.18 57.62, 174.12 36.31, 189.24 19.52 M140.07 77.65 C151.95 63.59, 162.95 49.6, 190.14 19 M145.63 78.48 C156.89 63.72, 168.94 51.16, 192.18 24.22 M145.92 76.09 C159.92 61.46, 174.62 42.86, 191.06 25.35 M148.59 77.17 C163.03 64.68, 172.31 50.74, 189.05 28.9 M150.91 77.49 C166.26 60.19, 181.44 40.29, 190.96 31.41 M155.09 77.44 C166.16 66.23, 172.13 54.79, 189.53 38.13 M155.07 77.6 C165.93 64.78, 175.85 53.67, 191.29 36.02 M162.63 77.26 C171.48 64.36, 179.81 56.53, 192.13 41.45 M161.14 76.88 C168.35 66.37, 178.69 57.65, 189.9 43.78 M164.56 77.07 C172.4 69.62, 178.39 59.85, 191.79 47.96 M164.84 77.64 C171.92 68.98, 179.63 62.85, 191.24 48.15 M172.37 78.9 C175.34 72.25, 181.19 63.74, 191.63 57.02 M171.59 77.5 C175.76 71.62, 181.22 65.15, 190.59 54.54 M175.99 76.74 C178.47 72.01, 180.95 71.84, 189.08 61.29 M175.51 78.3 C181.72 70.63, 188.06 65.35, 190.83 61.83 M182.42 78.35 C183.56 73.64, 186.84 72.13, 191.66 68.58 M182.49 77 C183.79 75.38, 185.81 72.7, 191.06 67.3 M186.55 77.87 C188.48 76.52, 189.54 74.77, 190.24 74.39 M186.86 77.67 C188.24 76.32, 189.22 75.09, 190.39 73.84" stroke="#82c91e" stroke-width="0.5" fill="none"></path><path d="M-1.39 -1.45 C56.67 -0.51, 109.89 1.79, 191.32 -1.36 M-0.83 0.69 C73.42 -0.25, 145.85 -0.12, 190.3 -0.94 M188.68 -0.33 C189.28 23.23, 190.58 49.21, 188.32 77.24 M189.4 0.55 C190.08 22.74, 190.49 45.59, 189.96 76.45 M189.25 74.79 C132.38 78.24, 71.8 79.26, -0.89 76.75 M190.98 76.41 C129.94 77.79, 69.61 76.72, -0.52 76.74 M0.61 76.44 C1.48 57.17, -0.6 41.53, 1.5 0.73 M-0.84 75.75 C-0.19 48.49, -0.32 20.47, 0.95 -0.26" stroke="#000000" stroke-width="1" fill="none"></path></g><g stroke-linecap="round" transform="translate(450.33786599523194 553.45703125) rotate(0 79 37.58203125)"><path d="M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0 M-0.58 7.14 C1.83 3.44, 3.24 1.19, 4.37 -0.16 M-0.08 6.63 C1.12 4.32, 3.54 2.58, 4.64 0.72 M-0.71 13.34 C4.42 8.5, 5.41 5.28, 10.58 -0.52 M-0.63 12.31 C3.12 8.84, 6.33 5.85, 10.63 0.27 M0.45 18.93 C4.72 11.73, 9.84 4.79, 16.93 2.01 M-1.01 19.13 C4.69 12.48, 9.29 8.19, 15.5 -0.23 M0.49 23.59 C6.13 15.86, 14.9 9.42, 23.14 1.84 M0.09 24.14 C5.16 18.13, 10.06 12.61, 20.5 0.38 M0.8 32.33 C7.41 22.79, 10.42 16.35, 25.38 1.39 M-0.47 30.14 C8.84 20.81, 16.97 11.79, 25.33 0.57 M0.21 35.27 C5.26 29.98, 14.85 21.34, 33.05 -1.46 M0.4 36.57 C8.98 27.92, 16.71 17.54, 31.66 0.36 M1.12 43.89 C12.91 26.9, 27.45 14.6, 35.9 2.16 M0.63 42.04 C11.26 31.05, 20.31 19.61, 36.71 -0.33 M-0.08 50.89 C17.69 30.91, 33.29 9.34, 41.63 -0.31 M-0.13 48.79 C14.35 32.05, 29.77 13.29, 43.32 0.43 M-0.02 54.57 C14.78 38.85, 31.8 21.52, 47.04 0.81 M0.88 53.59 C17.22 36.65, 32.84 16.74, 47.49 0.82 M-1.25 62.45 C17.49 42.15, 34.6 23.71, 51.64 1.05 M-0.91 61.94 C19.03 39.3, 38.05 19.36, 52.48 -0.57 M0.74 67.66 C14.37 48.54, 31.01 30.5, 56.78 1.42 M0 67.01 C20.05 44.27, 41.14 20.25, 58.32 -0.53 M-0.07 72.77 C18.79 51.74, 38.73 27.36, 63.27 -0.01 M0.07 72.09 C14.57 56.83, 28.4 40.89, 63.92 -1.07 M0.13 75.49 C25.06 49.62, 45.25 26.26, 70.52 -0.39 M1.44 76.73 C27.07 47.32, 52.87 15.39, 68.62 0.79 M9.34 75.94 C27.49 56.41, 43.06 37.22, 74.15 -0.58 M6.83 76.74 C31.9 46.8, 56.65 18.74, 74.22 -0.79 M10.93 76.93 C27.38 59.09, 41.78 44.28, 81.13 -1.42 M13.04 76.87 C29.23 57.22, 45.25 38.63, 78.59 -0.3 M17.14 78.42 C34.45 60.38, 49.6 40.1, 83.37 -0.19 M19.01 75.95 C39.44 53.8, 59.65 30.12, 85.71 -0.71 M24.94 77.01 C47.85 50.13, 72.77 21.93, 88.9 1.08 M23.99 76.86 C48.88 49.47, 73.96 19.94, 89.23 0.79 M29.61 77.49 C46.42 54.28, 68.5 33.12, 95.43 -0.81 M29.7 76.72 C51.52 49.32, 75.03 24.73, 96.53 -1.12 M31.92 76.52 C51.58 58.15, 66.85 38.57, 101.55 1.43 M33.8 77.06 C53.44 54.55, 71.66 34.14, 100.3 0.4 M39.72 78.21 C67.79 46.13, 91.07 15.71, 108.28 1.16 M40.03 76.02 C62.75 49.1, 86.31 21.38, 106.58 0.44 M43.08 77.8 C63.6 53.36, 85.34 30.77, 110.26 1.5 M43.74 76.53 C69.94 47.76, 93.99 20.74, 110.34 0.59 M51.89 77.23 C76.75 46.4, 101.33 17.09, 116.65 -0.35 M49.94 76.52 C63.21 62.13, 77.46 45.42, 116.9 -0.13 M55.03 76.78 C77.71 48.51, 101.41 23.81, 121.62 -1.25 M54.89 77.07 C73.77 56.36, 93.22 34.27, 122.7 -0.87 M61.97 74.72 C77.75 57.2, 92.35 41.4, 126.68 -0.15 M60.13 76.62 C81.51 51.22, 102.59 28.62, 126.26 -0.46 M65.87 78.92 C87.01 51.38, 110.76 21.99, 133.69 -1.82 M66.08 77.17 C90.11 48.43, 115.35 19.36, 133.49 -0.5 M72.6 79.2 C91.27 55.74, 107.6 33.84, 135.97 -1.17 M71.42 77.18 C89.14 55.91, 108.26 34.21, 137.28 0.82 M75.1 75.25 C97.52 54.11, 117.22 29.94, 143.94 0.35 M75.95 76.05 C92.49 57.37, 109.03 39, 143.59 -1.08 M79.82 76.48 C99.73 57.75, 120.98 31.91, 148.22 -1.59 M81.41 76.54 C99.62 57.16, 117.67 36.62, 148.97 1.02 M87.66 78.39 C109.66 51.87, 130.28 27.33, 153.28 1.39 M86.9 77.68 C111.59 48.03, 137.38 19.54, 154.67 0.31 M93.13 78.2 C113.51 51.4, 134.01 26, 160.56 2.02 M92.47 77 C105.76 59.86, 121.71 44, 158.16 0.17 M97.95 78.48 C120.64 52.69, 139.88 24.52, 160.17 7.79 M97.13 76.69 C115.79 54.74, 134.32 33.3, 159.3 7.11 M102.16 78.78 C120.39 56.93, 137.29 37.68, 156.41 11.46 M102.45 77.82 C116.2 61.74, 128.79 46.31, 158.29 13.86 M109.78 75.25 C120.96 59.99, 138.9 42.31, 157.71 17.3 M108.61 76.48 C121.34 60.11, 136.37 45, 158.03 18.17 M111.93 76.25 C126.58 62.96, 137.15 48.67, 159.6 23.68 M113.95 78.01 C121.54 67.39, 130.9 56.19, 157.55 25.98 M120.42 77.99 C130.6 67.84, 138.3 56.72, 157.72 31.44 M119.08 77.15 C134.27 60.55, 147.48 43.19, 159.45 30.3 M122.93 76.16 C135.23 66.77, 143.66 51.63, 158.92 35.53 M124.37 76.26 C137.21 61.61, 150.52 44.63, 159.43 37.48 M128.57 77.55 C134.35 71.07, 141.23 62.8, 158.22 45.36 M130.08 77.5 C140.18 64.89, 148.64 53.74, 157.71 44.05 M135.07 75.66 C143.38 67.9, 152.65 53.95, 157.25 48.67 M133.88 77.01 C139.5 71.28, 145.28 65, 157.88 49.26 M138.36 78.33 C144.75 69.38, 150.06 64.71, 158.62 55.48 M140.93 77.09 C145.34 71.87, 150.17 65.36, 157.71 55.44 M143.71 75.41 C151.39 71.74, 153.27 67.45, 158.91 62.34 M145.44 76.4 C149.6 71.69, 152.94 67.81, 158.62 60.97 M151.08 77.65 C152.88 74.1, 153.71 71.97, 159.3 67.88 M150.71 76.35 C152.71 74.23, 154.35 73.23, 158.91 68.11 M155.65 76.75 C156.34 75.95, 157.55 75.02, 158.03 74 M155.48 76.87 C156.46 75.89, 157.51 74.78, 158.32 73.93" stroke="#fab005" stroke-width="0.5" fill="none"></path><path d="M0.96 -1.53 C48.4 -1.82, 92.04 -3.26, 156.47 -1.67 M0.19 -0.04 C61.97 -0.23, 124.23 -0.29, 158.43 -0.61 M157.58 -1.01 C160.02 24.16, 159.32 45.29, 156.42 75.28 M158.01 0.38 C157.63 15.27, 158.88 31.98, 158.61 74.3 M159.07 75.06 C97.56 78.28, 38.61 77.09, 1.96 75.08 M157.73 75.8 C116.17 75.06, 75.66 74.42, -0.64 74.35 M0.95 75.29 C-1.87 48.2, -2.03 24.84, -1.1 -1.21 M0.5 75.17 C0.76 58.94, -0.74 41.12, 0.55 0.32" stroke="#000000" stroke-width="1" fill="none"></path></g><g stroke-linecap="round" transform="translate(450.52536599523194 686.53515625) rotate(0 79 37.58203125)"><path d="M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0 M0.06 5.64 C2.21 4.84, 4.4 2.58, 5.74 0.61 M-0.14 6.47 C1.57 3.75, 4.01 1.61, 4.96 0.33 M0.17 13.03 C2.43 9.1, 6.43 3.38, 10.66 -0.18 M0.32 11.92 C2.47 8.82, 5.88 5.06, 10.54 0.05 M0.48 20.01 C2.79 11.69, 10.14 5.9, 16.94 -1.52 M0.2 18.33 C5.81 11.64, 12.28 4.86, 15.1 0.38 M1.53 22.8 C5.2 17.75, 12.89 9.93, 21.5 1.92 M-0.51 24.65 C3.59 19.95, 8.82 14.23, 21.71 0.17 M0.17 32.36 C5.38 23.11, 14.07 14.37, 28.23 2.21 M0.57 29.7 C9.17 19.03, 20.8 6.8, 27.05 0.19 M-1.08 36.36 C11.82 24.15, 22.28 11.41, 30.73 -1.74 M-0.44 37.26 C11.47 22.87, 23.72 10.74, 31.58 -0.94 M0.39 43.34 C11.37 26.88, 24.8 10.48, 35.45 -0.51 M-0.85 42.55 C7.55 31.97, 16.51 22.86, 37.04 -0.45 M1.66 50.53 C13.52 34.74, 23.19 19.79, 43.29 1.39 M-0.47 48.65 C15.65 32.45, 29.64 14.12, 42.53 0.68 M-0.68 56.29 C14.43 39.81, 26.71 24.6, 48.76 1.2 M-0.28 55.44 C15.4 37.86, 28 23.29, 48.1 0 M0.51 59.7 C11.44 48.79, 24.44 33.13, 53.58 1.48 M-0.82 61.78 C20.12 38.61, 40.16 16.6, 52.76 -0.3 M-0.06 68.9 C18.73 46.67, 36.66 25.53, 57.79 1.79 M-0.81 66.43 C21 41.31, 42.79 16.86, 58.08 0.83 M-1.69 73.04 C22.53 49.62, 41.82 24.46, 65.41 -1.75 M-0.3 72.52 C12.79 57.07, 26.87 42.97, 64.24 -0.51 M2.62 75.85 C17.72 57.09, 35.07 40.16, 67.56 -0.74 M2.17 77.73 C23.98 50.08, 48.32 23.53, 69.58 1.01 M8.58 75.02 C23.29 59.35, 34.41 43.55, 76.05 1 M8.31 76.2 C33.87 46.52, 59.54 14.37, 74.71 0.15 M11.76 78.39 C35.52 49.87, 62.13 23.43, 78.56 -0.83 M11.72 77.29 C36.04 49.43, 62.59 20, 80 -0.73 M17.11 78.48 C37.76 52.91, 57.26 33.05, 84.2 0.55 M17.84 76.68 C36.39 56.61, 53.53 35.22, 85.71 0.51 M22.79 75.93 C50.62 49.24, 76.59 15.95, 90.7 -1.34 M22.2 76.35 C41.64 54.2, 62.17 33, 89.51 0.02 M29.79 75.08 C48.12 53.43, 69.16 32.22, 93.99 1.34 M28.54 76.77 C49 53.49, 68.88 32.05, 96.56 0.09 M33.09 75.64 C57.06 49.61, 82.73 20.18, 99.34 -1.58 M34.31 77.08 C60.3 47.35, 86.11 17.67, 101.07 -0.59 M39.23 76.26 C64.03 46.73, 90.63 21.14, 106.99 1.32 M38.76 77.27 C63.34 48.99, 86.86 23.17, 106.36 -0.84 M45.48 78.22 C71.91 48.44, 95.1 17.54, 111.27 -1.3 M44.52 76.36 C60.99 58.46, 77.18 38.84, 110.42 -0.7 M49.45 77.01 C64.57 58.98, 81.24 42.85, 117.56 0.8 M49.61 76.64 C68 57.49, 84.68 36.83, 115.32 -0.56 M56.22 77.98 C70.67 60.96, 83.11 42.09, 120.72 -0.67 M55.07 77.79 C74.73 54.59, 95.58 30.69, 122.06 -0.71 M59.95 75.92 C86.73 50.41, 108.93 20.18, 127.46 -0.64 M60.98 77.11 C77.42 57.74, 93.78 39.37, 127.41 1.12 M67.02 78.76 C86.49 51.28, 109.23 26.5, 133.36 -0.33 M66.01 77.68 C85.57 54.73, 104.77 32.41, 133.31 0.67 M68.99 75.87 C87.45 57.66, 107.22 36.9, 137.93 0.41 M70.88 77.34 C88.11 57.5, 105.03 37.22, 138.43 -0.64 M77 77.97 C94.48 55.5, 114.19 36.42, 142.29 -1.32 M77.15 77.08 C101.75 48.13, 126.99 20.08, 142.24 0.46 M80.22 77.03 C104.02 51.12, 128.62 22.28, 148.27 0.19 M82.09 77.49 C97.45 56.95, 117 36.65, 148.58 -0.71 M86.75 78.58 C103.69 55.89, 120.03 37.47, 152.05 -1.14 M86.08 77.73 C101.89 60.62, 116.54 42.04, 153.71 -0.6 M90.79 77.41 C111.1 54.84, 130.81 35.52, 159.26 0.47 M92.19 77.67 C117.2 46.38, 143.63 17.28, 157.88 0.76 M98.27 77.13 C118.2 54.12, 139.71 28.32, 156.72 5.07 M98.19 76.11 C119.03 50.61, 141.26 25.63, 159.47 6.74 M101.93 77.84 C116.5 60.08, 130.37 43.97, 157.93 13.44 M102.18 76.96 C120.36 57.93, 136.87 38.65, 158.95 13.18 M107.01 75.73 C126.84 58.67, 141.97 38.23, 157.02 17.42 M108.62 77.42 C120.34 64.83, 129.78 50.41, 159.24 19.16 M114.31 78.7 C121.42 64.01, 134.31 53.14, 159.74 26.42 M113.89 76.17 C126.71 61.14, 139.96 46.37, 159.17 24.23 M117.85 78.02 C129.91 63.75, 138.14 51.95, 160.41 31.83 M118.33 77.56 C128.08 65.48, 139.22 54.07, 158.84 31.26 M124.02 75.92 C128.74 68.35, 137 60.12, 157.1 38.65 M123.87 77.81 C137.96 61.43, 150.39 44.99, 159.22 36.69 M129.13 77.23 C135.44 69.77, 144.24 59.58, 156.53 41.81 M130.03 77.17 C135.29 69.44, 141.87 62.95, 157.57 43.42 M134.61 77.02 C141.15 69.46, 148.67 59.61, 160.52 50.14 M133.5 76.13 C144.29 65.15, 154.34 54.8, 158.24 49.27 M140.59 76.16 C146.74 68.05, 150.42 64.39, 160.4 54.17 M140.22 77.59 C145.77 69.74, 151.7 63.66, 157.54 55.45 M145.06 77.05 C149.29 71.46, 149.81 69.58, 157.95 62.52 M144.92 77.08 C149.11 71.45, 152.6 67.97, 159.14 61.42 M149.94 75.75 C153.53 73.02, 157.13 69.04, 157.34 68.76 M150.98 76.8 C152.21 74.03, 154.42 72.2, 158 67.34 M155.28 77.34 C156.7 76.15, 157.48 75.39, 158.25 74.33 M155.54 76.88 C156.48 76.11, 157.07 75.67, 158.21 74.01" stroke="#fab005" stroke-width="0.5" fill="none"></path><path d="M0.44 1.34 C60.78 -0.19, 121.93 -0.13, 159.83 -0.06 M0.21 -0.57 C49.83 -0.18, 98.45 -1.67, 158.89 -0.2 M158.61 -1.6 C160.06 25.37, 156.84 52.42, 158.86 75.98 M157.72 -0.12 C157.46 16.91, 157.2 33.66, 158.94 75.21 M159.03 76.88 C112.84 75.35, 69.97 74.99, -1.82 74.65 M158.42 75.61 C109.52 73.6, 59.85 73.73, 0.06 75.2 M1.43 74.44 C1.22 47.87, -1.28 18.49, 0.34 1.58 M0.24 76.15 C0.57 48.34, -0.02 20.44, 0.65 -0.62" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(458.30661599523194 457.87890625) rotate(0 74 12.5)"><text x="74" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="middle" style="white-space: pre;" direction="ltr">foo_archive</text></g><g transform="translate(466.29880349523216 329.6953125) rotate(0 74 12.5)"><text x="74" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="middle" style="white-space: pre;" direction="ltr">test_archive</text></g><g transform="translate(502.03317849523194 195.00390625) rotate(0 90 12.5)"><text x="90" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="middle" style="white-space: pre;" direction="ltr">test_source.go</text></g><g transform="translate(455.33786599523194 578.5390625) rotate(0 74 12.5)"><text x="74" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="middle" style="white-space: pre;" direction="ltr">bar_archive</text></g><g transform="translate(455.52536599523194 711.6171875) rotate(0 74 12.5)"><text x="74" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="middle" style="white-space: pre;" direction="ltr">main_archive</text></g><g stroke-linecap="round"><g transform="translate(299.17380349523194 465.3189389876247) rotate(0 73.47540276870131 2.7646880106362772)"><path d="M-0.39 1.03 C24.32 1.54, 122.9 3.15, 147.34 3.91 M1.6 0.53 C26.32 1.09, 122.91 4.47, 146.87 5" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(299.17380349523194 465.3189389876247) rotate(0 73.47540276870131 2.7646880106362772)"><path d="M120.11 15.94 C123.24 12.09, 132.43 10.8, 145.69 6.36 M118.49 15.04 C129.65 10.64, 140.44 7.05, 147.79 4.25" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(299.17380349523194 465.3189389876247) rotate(0 73.47540276870131 2.7646880106362772)"><path d="M120.71 -4.58 C123.85 -3.85, 132.91 -0.57, 145.69 6.36 M119.09 -5.47 C130.16 -2.01, 140.72 2.27, 147.79 4.25" stroke="#000000" stroke-width="1" fill="none"></path></g></g><g stroke-linecap="round"><g transform="translate(580.4023922425737 259.7343750000002) rotate(0 -10.502589330903334 18.976478547239566)"><path d="M0.28 0.25 C-3.18 6.54, -17.12 31.05, -20.54 37.12 M-1.04 -0.67 C-4.63 5.88, -18.01 32.22, -21.28 38.62" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(580.4023922425737 259.7343750000002) rotate(0 -10.502589330903334 18.976478547239566)"><path d="M-18.25 18.11 C-19.71 25.23, -21.29 30.05, -21.56 39.38 M-19.5 17.1 C-19.2 22.65, -20.24 25.77, -20.84 39.55" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(580.4023922425737 259.7343750000002) rotate(0 -10.502589330903334 18.976478547239566)"><path d="M-5.25 24.74 C-10.77 29.81, -16.44 32.54, -21.56 39.38 M-6.5 23.74 C-8.8 27.98, -12.5 29.74, -20.84 39.55" stroke="#000000" stroke-width="1" fill="none"></path></g></g><g stroke-linecap="round"><g transform="translate(296.07224099523194 585.9776615134668) rotate(0 72.6821832023561 2.464307691975705)"><path d="M-0.92 0.88 C23.3 1.39, 121.89 3.18, 146.28 3.68 M0.81 0.29 C24.74 0.87, 120.7 3.9, 145.18 4.64" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(296.07224099523194 585.9776615134668) rotate(0 72.6821832023561 2.464307691975705)"><path d="M118.15 13.54 C125.77 8.71, 137.02 5.35, 147.09 2.86 M116.16 13.25 C123.49 10.72, 132.25 8.43, 145.2 5.54" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(296.07224099523194 585.9776615134668) rotate(0 72.6821832023561 2.464307691975705)"><path d="M118.78 -6.97 C126.25 -3.92, 137.27 0.61, 147.09 2.86 M116.79 -7.26 C123.99 -4.34, 132.58 -1.17, 145.2 5.54" stroke="#000000" stroke-width="1" fill="none"></path></g></g><g stroke-linecap="round"><g transform="translate(296.50974099523194 719.0583589027482) rotate(0 73.39266086805145 2.270810463165134)"><path d="M0.8 -0.52 C25.13 0.09, 122.64 2.89, 147.02 3.96 M-0.23 1.82 C23.91 2.54, 121.95 4.68, 146.44 5.06" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(296.50974099523194 719.0583589027482) rotate(0 73.39266086805145 2.270810463165134)"><path d="M117.19 15.94 C127.62 12.06, 141.76 7.04, 146.68 6.11 M118.55 15.54 C128.02 10.72, 139.32 7.75, 146.87 5.94" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(296.50974099523194 719.0583589027482) rotate(0 73.39266086805145 2.270810463165134)"><path d="M117.58 -4.57 C127.91 -0.54, 141.9 2.35, 146.68 6.11 M118.95 -4.98 C128.32 -2.43, 139.47 1.98, 146.87 5.94" stroke="#000000" stroke-width="1" fill="none"></path></g></g><g transform="translate(304.07614724523194 432.69921875) rotate(0 64 12.5)"><text x="0" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="start" style="white-space: pre;" direction="ltr">GoCompilePkg</text></g><g transform="translate(585.7245847452322 259.0703125) rotate(0 64 12.5)"><text x="0" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="start" style="white-space: pre;" direction="ltr">GoCompilePkg</text></g><g transform="translate(303.22458474523194 554.66015625) rotate(0 64 12.5)"><text x="0" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="start" style="white-space: pre;" direction="ltr">GoCompilePkg</text></g><g transform="translate(302.90817849523194 691.8203125) rotate(0 64 12.5)"><text x="0" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="start" style="white-space: pre;" direction="ltr">GoCompilePkg</text></g><g stroke-linecap="round"><g transform="translate(611.7050534952319 449.734375) rotate(0 52.476153901964494 156.51802825555208)"><path d="M-0.4 -0.86 C5.42 9, 34.59 35.17, 35.8 59.7 C37 84.22, -4.75 132.69, 6.85 146.29 C18.44 159.88, 105.75 141.07, 105.35 141.28 C104.94 141.49, 15.99 134.34, 4.42 147.53 C-7.14 160.71, 35.41 192.65, 35.95 220.38 C36.49 248.1, 12.61 298.23, 7.66 313.89 M1.6 1.31 C7.28 10.74, 34.72 33.91, 35.42 57.72 C36.11 81.53, -5.87 130.08, 5.76 144.18 C17.39 158.27, 105.57 141.74, 105.2 142.29 C104.82 142.85, 15.39 134.11, 3.53 147.51 C-8.33 160.91, 33.22 195.15, 34.04 222.7 C34.86 250.24, 12.72 297.48, 8.43 312.77" stroke="#000000" stroke-width="1" fill="none"></path></g></g><g stroke-linecap="round"><g transform="translate(325.5096350877384 148.70809670914042) rotate(0 82.1724531485562 88.45942824580477)"><path d="M0.88 -0.28 C5.92 4.73, 28.63 18.26, 31.33 30.42 C34.04 42.58, -4.95 67.16, 17.13 72.66 C39.22 78.16, 163.25 62.67, 163.83 63.45 C164.41 64.22, 42.55 65.98, 20.61 77.29 C-1.34 88.6, 35.17 114.46, 32.16 131.31 C29.16 148.16, 7.64 170.6, 2.59 178.39 M-0.12 -1.47 C5.21 3.67, 30.39 19.73, 33.65 31.75 C36.91 43.78, -2.35 65.78, 19.45 70.69 C41.25 75.6, 164.43 60.02, 164.46 61.23 C164.5 62.45, 41.45 65.9, 19.65 77.97 C-2.15 90.03, 36.37 117.04, 33.67 133.64 C30.96 150.24, 8.92 170.17, 3.41 177.58" stroke="#000000" stroke-width="1" fill="none"></path></g></g><g stroke-linecap="round"><g transform="translate(631.3963538377383 315.3604404591405) rotate(0 51.47933810786469 55.25583120997302)"><path d="M1.19 0.15 C2.1 5.05, -1.39 18.85, 6.43 29.62 C14.25 40.39, 29.25 59.4, 48.12 64.8 C66.98 70.2, 117.39 62.45, 119.61 62.01 C121.83 61.57, 80.22 59.44, 61.43 62.15 C42.64 64.85, 19.88 70.34, 6.87 78.25 C-6.15 86.16, -12.57 104.25, -16.65 109.61 M0.35 -0.81 C1.05 4.22, -2.17 20.25, 5.68 30.9 C13.52 41.55, 28.9 57.66, 47.42 63.07 C65.94 68.48, 114.69 63.53, 116.8 63.36 C118.9 63.19, 78.2 59.18, 60.05 62.04 C41.89 64.9, 20.52 72.28, 7.85 80.49 C-4.83 88.71, -12.12 106.43, -16.01 111.32" stroke="#000000" stroke-width="1" fill="none"></path></g></g><g transform="translate(641.7089597452319 556.08203125) rotate(0 31.5 12.5)"><text x="0" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="start" style="white-space: pre;" direction="ltr">GoLink</text></g><g transform="translate(675.5331784952319 393.7890625) rotate(0 31.5 12.5)"><text x="0" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="start" style="white-space: pre;" direction="ltr">GoLink</text></g><g stroke-linecap="round" transform="translate(731.9823972452319 551.75390625) rotate(0 72.5 43.5)"><path d="M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0 M-1.04 6.14 C0.25 5.57, 2.55 3.3, 4.78 0.09 M-0.24 6.55 C2.14 3.92, 3.81 1.97, 5.17 0.2 M1.14 11.32 C1.88 8.06, 7.34 5.17, 11.76 1.23 M-0.4 12.83 C1.97 10.15, 4.8 6.7, 10.38 0.66 M-1.12 17.08 C7.99 11.15, 13.1 5.72, 16.91 -1.01 M-0.85 19.03 C5.21 12.21, 11.85 3.62, 16.2 0.51 M-0.01 23.23 C6.37 17.75, 13.63 7.11, 22.35 -1.42 M1.06 24.24 C7.63 16.47, 15.34 7.69, 20.42 -0.41 M-1.98 29.02 C9.2 19.36, 19.47 7.43, 26.63 1.24 M-0.69 29.6 C7.55 21.11, 13.81 13.64, 25.54 -0.14 M-1.16 37.95 C5.15 30.26, 13.3 19.05, 32.56 1.86 M-0.63 36.46 C10.82 23.66, 22.57 8.9, 31.43 0.43 M-0.7 41.51 C15.43 25.63, 29.37 10.37, 38.71 0.93 M0.85 43.01 C12.85 29.21, 23.49 14.48, 36.82 0.01 M1.6 47.03 C12.68 34.67, 24.9 19.91, 40.96 0.14 M0.42 48.79 C10.97 37, 23.12 23.92, 43.34 -1.02 M-1.72 54.06 C15.09 34.89, 31.91 17.76, 47.67 2.07 M1.13 55.5 C14.44 36.54, 29.66 20.13, 47.15 -0.31 M-0.64 62.01 C17.38 40.22, 33 21.93, 53.28 1.74 M0.05 61.34 C13.9 45.65, 25.85 30.46, 52.92 0.57 M1.27 66.49 C18.17 45, 35.76 22.51, 57.45 -1.71 M-0.37 67.79 C14.42 51.14, 28.9 33.29, 57.45 0.35 M1.32 71.23 C17.23 54.45, 30.34 37.61, 62.68 -1.46 M0.56 72.18 C12.82 57.87, 26.16 44, 63.71 0.25 M0.01 79.93 C16.43 58.38, 34.55 36.51, 69.44 0.72 M0.6 80.04 C18.12 57.4, 36.43 37.98, 68.41 0.15 M2.11 84.61 C29.85 50.47, 57.79 19.89, 73.77 -2.02 M0.01 84.09 C23.66 60.17, 44.7 35.37, 74.05 -1.21 M1.66 91.04 C17.5 69.73, 37.79 50.5, 78.45 2.1 M1.05 90.14 C22.86 64.9, 44.81 37.87, 78.5 -0.04 M9.03 89.32 C22.41 69.61, 39.46 49.94, 86.59 -0.94 M7.45 88.29 C35.26 54.85, 64.51 23.24, 85.04 0.68 M14.08 90.06 C32.93 66.5, 56.18 38.69, 88.76 0.72 M12.02 89.66 C30.32 69.69, 47.57 49.41, 89.97 -0.61 M19.66 86.92 C36.51 71.43, 49.19 51.62, 96.63 0.36 M18.59 89.52 C41.5 60.05, 65.54 33.56, 96.59 0.13 M21.46 88.09 C42.75 68.71, 60.6 46.43, 102.06 0.41 M22.26 89.24 C47.95 59.81, 72.05 32.06, 100.85 0.75 M29.65 87.79 C59.37 52.69, 89.8 20.45, 106.79 0 M29.54 88.49 C53.07 61.07, 77.69 30.93, 105.36 -0.93 M31.97 90.02 C58.47 60.43, 82.44 29.93, 109.49 -1.4 M33.82 89.43 C53.67 68.24, 70.2 47.71, 110.96 -0.92 M39.4 88.09 C57.14 68.4, 75.21 48.34, 114.78 0.42 M39.5 88.88 C57.87 67.84, 76.57 46.09, 116.15 -0.11 M45.22 88.3 C69.93 61.76, 92.78 33.06, 123.61 -1.74 M43.53 88.51 C74.21 55.81, 101.51 22.37, 121.9 0.14 M50.72 89.53 C69.78 62.65, 91.01 41.76, 127.7 1.39 M49.45 89.05 C80.14 53.36, 110.01 19.42, 126.52 0.47 M56.25 90.92 C85.06 56.1, 112.02 23.29, 134.45 -0.08 M54.99 88.47 C79.29 59.27, 105.39 30.73, 133.04 0.4 M58.88 87.42 C86.39 58.17, 113.66 28.6, 138.12 0.46 M60.13 88.12 C88.15 55.56, 116.35 24.24, 136.82 0.62 M67.54 89.46 C85.69 66.3, 103.85 43.1, 141.44 1.68 M66.61 89.01 C83.34 68.8, 101.19 46.97, 143.55 -0.95 M72.58 86.58 C99.75 56.63, 127.05 23.04, 145.4 3.52 M72.07 87.89 C89.91 67.7, 106.79 46.64, 147.54 2.66 M77 87.05 C95.7 66.46, 114.93 42.83, 146.91 6.75 M75.55 89.56 C93 69.3, 109.76 49.32, 147.79 7.56 M81.3 90.2 C102.56 62.39, 125.3 39.02, 145.78 15.58 M80.94 89.67 C103.28 63.71, 125.76 39.28, 147.4 14.18 M85.99 90.37 C105.52 67.08, 129.02 43.39, 147.16 22.09 M87.78 89.26 C101.37 73.38, 113.91 56.46, 146.47 20.28 M93.92 88.74 C107.52 72.93, 124.15 56.2, 147.97 25.58 M92.14 89.18 C106.82 71.6, 122.62 53.95, 146.93 26.84 M99.3 89.69 C113.26 70.71, 130.02 52.94, 147.2 32.45 M98.02 88.99 C111.7 72.57, 125.92 56.92, 147.33 32.53 M102.79 88.48 C117.05 68.72, 133.43 53.13, 146.96 36.57 M102.9 89.17 C118.2 71.52, 132.2 55.71, 146.28 38.6 M109.16 90.81 C118.27 78.18, 131.48 63.94, 147.56 42.93 M107.8 89.32 C116.99 79.24, 125.57 68.24, 146 45.13 M114.37 88.52 C121.52 81.67, 128.76 73.62, 148.5 51.95 M112.87 88.33 C122.8 78.55, 131.87 68.29, 147.72 49.9 M119.24 87.13 C127.09 78.71, 133.31 74.44, 146.88 55.44 M119.41 88.56 C127.4 78.31, 136.05 69.7, 146.54 56.87 M124.54 89.53 C132.71 82.36, 138.15 71.53, 147.77 64.41 M123.49 90.06 C131.16 80.85, 137.17 72.17, 146.26 62.62 M128.65 87.58 C132.79 85.52, 138.17 78.61, 149.23 69.46 M129.94 88.73 C133.83 82.95, 139.72 76.87, 146.8 69.26 M134.62 89.7 C138.2 87.01, 142.2 82.61, 145.48 76.35 M134.02 88.54 C138.57 83.71, 143.09 78.38, 147.71 74.64 M140.04 88.69 C141.95 86.36, 143.44 84.34, 147.11 81.97 M139.71 89.15 C142.34 85.84, 144.46 84.1, 146.24 81.22" stroke="#15aabf" stroke-width="0.5" fill="none"></path><path d="M1.72 1.51 C33.76 0.02, 65.95 0.83, 143.39 1.73 M0.63 -0.6 C29.1 0.76, 59.13 -0.09, 145.58 0.69 M144.05 0.66 C146.3 33.14, 147.41 65.49, 143.65 86.43 M144.56 -0.55 C144.79 23.81, 143.87 45.19, 144.47 87.44 M145.99 86.61 C102.53 86.4, 63.75 89.88, 1.76 87.96 M145.51 87.44 C97.63 86.72, 50.09 86.54, -0.57 86.71 M-1.52 87.3 C0.01 61.6, 0.3 38.48, -0.66 -1.97 M-0.18 86.71 C-0.11 65.18, -0.02 43.5, -0.65 0.55" stroke="#000000" stroke-width="1" fill="none"></path></g><g stroke-linecap="round" transform="translate(760.1620847452319 335.91796875) rotate(0 72.5 43.5)"><path d="M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0 M-0.58 6.02 C1.82 4.5, 2.43 2.18, 4.39 0.06 M0.14 6.03 C1.48 4.69, 3.01 2.71, 4.68 0.68 M-1.4 10.55 C2.71 8.37, 5.16 7.35, 9.8 -0.19 M-0.08 12.7 C4.14 8.17, 7.43 4.65, 9.89 0.72 M-0.42 18.28 C4.52 12.5, 9.77 8.27, 17.61 2.16 M-0.27 18.46 C3.21 13.23, 7.79 8.43, 15.22 0.02 M-0.53 23.44 C4.04 18.43, 10.71 10.46, 22.41 0.42 M0.45 23.96 C6.28 17.81, 10.83 13.15, 20.61 -0.26 M-0.23 31.19 C4.78 23.2, 11.89 17.7, 27.69 -1.26 M0.16 31.44 C6.08 24.72, 11.05 16.12, 26.99 -0.55 M0.8 35.29 C11.9 25.16, 23.5 11.42, 31.61 -0.66 M0.36 36.37 C6.08 29.59, 12.77 21.23, 32.84 0.82 M-0.29 41.56 C10.72 29.91, 17.27 19.27, 37.91 2.22 M0.81 41.98 C9.02 32.97, 17.92 21.6, 37.57 0 M0.91 47.84 C8.15 36.65, 19.13 29.02, 41.56 0.68 M0.34 49.77 C12.82 34.67, 25.65 18.97, 41.58 -0.19 M1.03 56.29 C16.03 35.9, 35.24 14.66, 47.86 1.04 M0.26 54.37 C11.13 41.36, 22.45 28.36, 47.8 -0.07 M0.02 61.05 C20.97 34.57, 40.81 13.19, 54.09 -1.83 M-0.07 61.81 C11.27 47.8, 22.34 35.7, 53.79 -0.91 M-1.85 68.6 C13.37 51.53, 30.15 35.29, 56.59 -0.79 M0.18 66.37 C21.31 41.48, 43.82 16.98, 57.29 -0.76 M-1.59 73.66 C24.7 45.85, 48.74 14.78, 64.45 -0.9 M0.12 73.09 C25.43 44.66, 49.2 18.08, 64.24 -0.25 M0.9 79.03 C18.39 57.33, 40.09 35.06, 70.58 0.3 M0.02 80.19 C20.68 54.7, 41.4 30.25, 68.43 -0.37 M-0.19 83.99 C21.55 60.9, 43 36.82, 73.36 0.32 M0.68 85.97 C17.25 66.39, 34.1 47.4, 73.46 -0.37 M0.53 89.67 C26.85 62.8, 51.44 32.58, 79.75 -0.57 M0.99 88.77 C31.02 52.96, 62.81 18.08, 80.39 0.53 M6.61 89.63 C33.67 58.56, 57.73 30.16, 86.93 0.23 M7.37 88.18 C33.34 60.6, 58.83 29.21, 85.76 -0.75 M10.98 90.12 C33.66 65.05, 51.41 44.38, 89.44 -0.7 M13.36 89.73 C28.73 71.44, 43.95 51.67, 89.14 -0.92 M17.47 88.54 C45.47 56.48, 77.07 24.74, 96.75 -1.19 M17.59 88.03 C39.01 65.23, 60.71 40.82, 95.23 -0.13 M24.57 88.93 C48.72 62.33, 70.59 35.85, 100.45 -1.84 M24.06 88.75 C41.56 69.47, 60.25 47.57, 101.41 0.16 M27.15 89.51 C46.85 70.12, 61.22 50.21, 107.83 1.6 M28.18 88.77 C56.41 56.61, 84.38 22.86, 105.76 -0.54 M35.54 90.38 C61.06 58.29, 89.35 27.17, 113.02 1.84 M34.34 88.43 C49.6 70.05, 67.41 48.87, 110.71 0.35 M41.14 89.09 C59.02 62.8, 79.39 39.86, 117.96 0.44 M40.01 89.62 C64.32 60.01, 88.48 30.93, 116.35 -0.53 M43.59 88.31 C70.76 58.91, 99.21 23.9, 122.8 -0.3 M45.24 88.09 C72.45 57.18, 100.19 24.64, 121.35 -0.06 M48.35 87.42 C72.79 62.23, 96.73 36.13, 128.33 -1.5 M50.78 89.51 C67.84 68.94, 84.51 47.94, 127.75 -0.19 M53.86 90.15 C84.54 58.29, 110.32 26.76, 132.91 0.69 M55.58 89.76 C83.33 55.63, 113.08 22.78, 132.4 -1.04 M61.14 88.19 C78.9 64.17, 101.67 44.2, 135.62 -1.25 M60.92 89.07 C86.02 59.74, 111.3 30.34, 138.52 -0.65 M64.93 88.85 C86.92 64.21, 107.23 43.01, 141.88 1.33 M65.94 88.22 C82.62 71.01, 97.78 52.77, 143.74 -0.85 M71.3 86.66 C92.12 65.85, 110.16 41.21, 145.27 2.48 M71.69 88.69 C88.08 68.59, 104.59 48.96, 146.36 2.46 M76.8 86.97 C94.41 68.48, 112.28 47.13, 149.13 9.21 M76.71 88.91 C97.23 66.89, 116.2 43.2, 147.43 7.51 M81.4 90.39 C95.37 70.31, 113.98 53.11, 145.61 12.1 M80.44 89.18 C104.37 62.38, 126.92 37.19, 146.17 13.77 M86.92 88.6 C99.78 72.47, 115.93 58.69, 146.06 21.71 M86.04 88.05 C105.86 68.1, 122.57 45.57, 146.88 20.96 M91.42 88.26 C106.5 73.27, 118.55 57.4, 147.45 23.96 M91.28 88.85 C105.43 74.59, 117 61.23, 147.71 24.98 M98.18 87.39 C112.62 69.67, 130.1 53.85, 146.75 31.99 M97.88 88.54 C110.63 74.57, 123.9 59.42, 147.53 32.35 M102.81 90.97 C119.44 69.08, 137 51.5, 145.88 38.52 M103.14 89.97 C111.75 77.72, 120.66 67.62, 147.32 37.11 M106.9 90.58 C121.22 72.9, 135.17 57.44, 146.85 43.54 M107.95 88.01 C115.5 79.12, 124.49 71.42, 147.73 45.06 M113.11 88.02 C123.39 78.92, 130.34 69.64, 144.75 50.59 M112.38 89.79 C119.95 81.04, 127.83 74.07, 146.48 50.64 M118.84 86.94 C127.09 81.76, 132.41 71.96, 146.09 54.7 M119.75 88.82 C125.61 80.76, 130.99 73.19, 147.22 55.42 M123.3 88.48 C132.22 82.43, 136.22 75.48, 147.31 62.25 M124.15 89.25 C130.4 80.38, 137.46 72.31, 146.39 62.5 M129.2 86.83 C136.85 80.48, 142.62 76.21, 147.64 67.33 M128.55 88.02 C134.99 81.57, 142.69 74.78, 146.58 67.47 M133.84 88.98 C139.77 83.63, 140.22 81.07, 148.23 75.38 M134.37 89.05 C139.55 84.53, 143.02 79.67, 146.16 74.61 M139.39 89.45 C142.51 85.37, 144.65 83.27, 146.08 80.41 M139.81 89.06 C141.86 87.4, 142.61 85.61, 146.6 81.47" stroke="#15aabf" stroke-width="0.5" fill="none"></path><path d="M0.4 -1.42 C48.24 2.05, 97.72 2.55, 145.29 1.17 M-0.24 -0.95 C46.76 -0.72, 94.53 -1.09, 145.97 0.01 M144.23 0.23 C143.49 19.25, 146.34 36.02, 144.94 85.41 M144.37 0.51 C145.02 19.93, 144.29 39.29, 145.51 86.06 M146.5 87.47 C94.11 88.47, 38.6 89.45, 1.32 87.4 M146 87.29 C111.25 86.21, 76.77 86.19, 0.62 87.91 M-0.51 85.6 C-2.06 53.42, 1.15 19.62, -1.75 1.35 M0.58 86.29 C-0.56 53.23, -1.06 16.9, 0.37 -0.38" stroke="#000000" stroke-width="1" fill="none"></path></g><g stroke-linecap="round" transform="translate(948.1113034952319 458.91796875) rotate(0 72.5 43.5)"><path d="M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0 M0.41 6.77 C1.63 4.06, 3.52 2.36, 5.39 0.21 M-0.13 6.76 C1.08 4.89, 2.68 3.57, 5.04 0.68 M1.43 11.5 C2.25 8.35, 6.93 4.22, 10.26 -0.87 M-0.22 11.62 C4.04 7.16, 7.29 3.99, 10.95 0.71 M1.78 16.54 C4.48 12.7, 9 8.75, 14.16 0.82 M-0.87 18.61 C4.82 12.98, 11.23 6.55, 14.63 -0.07 M-0.79 26.07 C5.81 19.24, 8.18 12.36, 20.24 0.78 M-0.16 25.03 C7.14 17.12, 13.87 8.76, 21.01 -0.67 M-1.68 31.91 C7.87 18.82, 16.55 11.41, 24.62 1.27 M-0.28 30.18 C9.77 18.13, 20.81 7.09, 26.99 0.88 M-1.05 35.1 C8.69 25.56, 20.48 11.61, 31.1 -0.31 M0.48 37.42 C5.93 28.6, 12.2 20.67, 31.23 -0.82 M-1.1 41.65 C8.67 33.05, 14.67 25.48, 38.2 0.08 M0.52 42.42 C12.84 26.02, 26.68 10.12, 37.69 -0.1 M0.35 50.41 C8.82 36.91, 19.25 26.92, 40.79 0.66 M-0.24 49.68 C17.41 30.54, 33.72 11.3, 41.81 -0.08 M-1.19 53.49 C13.55 39.53, 29.54 24.3, 49.17 1.53 M1.02 55.43 C16.52 35.29, 31.94 18.64, 47.98 -0.42 M-1.74 59.8 C12.9 45.54, 25.92 32.17, 54.78 0.24 M-0.35 61.8 C14.2 45.85, 27.92 30.85, 53.65 0.77 M0.11 67.51 C15.25 48.52, 34.56 25.3, 57.23 -0.54 M-1.16 67.8 C11.91 53.71, 25.64 37.66, 58.88 -0.76 M1.63 71.86 C19.85 50.3, 40.34 28.05, 61.99 -1.43 M0.56 73.71 C17.32 51.07, 36.79 30.53, 64.41 0.66 M-1.69 81.08 C22.93 52.85, 47.51 22.48, 67.5 1.3 M0.34 79.58 C25.57 50.95, 50.97 19.83, 69.21 0.92 M0.85 84.75 C14.81 65.87, 33.15 48.5, 74.78 -0.66 M0.69 84.08 C17.41 64.86, 35.06 45.67, 74.56 0.23 M0.29 91.15 C25.38 58.48, 50.78 31.91, 78.56 0.01 M2.65 88.53 C26.49 61.16, 49.12 34.51, 79.58 -0.63 M6.96 89.9 C36.94 52.64, 68.06 19.39, 84.94 -2.19 M7.21 87.99 C31.84 60.88, 56.39 34.31, 85.32 -0.16 M13.69 88.15 C36.94 62.24, 60.22 35.11, 90.43 -1.88 M12.95 90.08 C36.31 62.73, 58.25 35.8, 90.34 0.07 M17.29 89.11 C47.56 53.63, 76.86 20.89, 95.69 0.79 M17.95 88.06 C35.38 68.45, 52.97 48.41, 94.73 -0.42 M22.43 87.48 C47.99 59.87, 70.3 33.28, 100.55 -0.25 M24.11 88.77 C40.49 70.31, 56.68 51.46, 99.68 -0.8 M27.24 89.02 C59.46 54.57, 87.81 23.24, 105.71 -1.34 M29.16 88.88 C53.67 58.54, 79.99 29.75, 105.57 -0.75 M34.44 90.25 C62.06 55.36, 93.89 19.29, 111.81 -1.46 M34.29 89.02 C55.1 64.52, 76 40.7, 111.52 -0.31 M40.96 90.03 C60.76 65.31, 80.72 40.46, 116.44 2.12 M40.16 87.99 C61.52 62.9, 83.46 39.9, 116.78 1.12 M45.07 89.17 C67.59 62.31, 93.64 33.38, 120.53 1.73 M44.47 88.97 C65.02 64.26, 86.44 42.16, 121.59 -0.84 M52.02 90.11 C71.18 65.07, 87.04 44.56, 126.74 -0.83 M50.03 87.65 C78.76 55.06, 107.93 22.73, 126.02 0.94 M57.12 88.49 C77.33 61.62, 99.77 39.4, 132.47 -1.91 M54.36 88.49 C83.71 53.95, 114.6 19.86, 133.38 -0.03 M59.43 88.81 C84.46 60.44, 112.2 32.48, 136.94 -0.37 M61.67 88.83 C89.82 54.83, 120.28 20.91, 137.78 0.4 M64.82 88.03 C85.45 67.54, 104.73 44.32, 142.83 -2.01 M66.49 89.16 C93.43 57.35, 121.75 24.32, 142.19 -0.83 M71.64 87.22 C87.04 68.05, 107.54 49.75, 146.12 1.63 M71.72 89.22 C101.31 56.29, 129.17 22.7, 146.68 1.7 M77.82 87.16 C100.62 61.42, 124.95 31.01, 145.69 8.86 M76.16 88.28 C97.62 63.59, 120.16 39.54, 146.51 8.1 M81.87 88.75 C105.73 61.51, 128 36.17, 146.29 14.43 M81.97 89.99 C101.05 67.51, 118.42 44.03, 147.55 14.29 M85.25 88.84 C104.84 69.84, 123.56 46.49, 145.08 21.94 M87.46 88.88 C106.08 68.14, 123.76 46.53, 147.17 21.01 M90.77 88.13 C111.2 64.13, 136.71 40.48, 145.91 27.21 M91.96 88.77 C108.11 70.54, 124.38 51.84, 147.05 25.72 M99.63 87.55 C117.46 67.21, 132.37 48.14, 145.76 34.2 M97.23 89.7 C109.62 75.17, 120.25 62.37, 146.03 33.08 M102.44 87.89 C114.75 75.03, 126.77 58.28, 147.71 39.3 M103.02 90.14 C114.7 74.66, 127.87 60.93, 147.47 37.82 M108.94 89.38 C118.14 78.08, 127.4 65.19, 148.04 43.02 M109.13 89.18 C118.51 75.27, 130.15 62.46, 146.85 45 M115.08 87.38 C120.89 79.73, 129.57 68.92, 145.21 50.32 M112.95 88.69 C124.78 74.44, 138.68 59.95, 147.18 50.9 M120.62 87.94 C131.38 75.51, 139.62 63.93, 146.28 54.54 M119.57 89.52 C127.44 79.6, 135.87 68.52, 147.82 55.45 M124.31 87.51 C131.76 83.52, 135.27 76.82, 145.32 61.22 M123.31 89.7 C132.57 78.13, 142.93 69.15, 147.34 62.71 M129.5 88.44 C138.01 82.38, 145 72.77, 148.33 68.49 M129.77 88.61 C133.85 83, 138.91 77.9, 146.92 67.79 M135.19 90.67 C138.29 85.35, 141.05 81.32, 148.35 74.74 M135.4 89.17 C137.72 85.62, 139.42 81.98, 147.86 75 M141.03 88.18 C142.94 85.7, 144.28 84.46, 146.75 82.05 M139.94 88.39 C141.45 86.99, 143.66 85.11, 146.98 81.03" stroke="#15aabf" stroke-width="0.5" fill="none"></path><path d="M0.04 1.39 C38.87 -1, 79.33 0.14, 146.04 -1.08 M0.6 -0.48 C38.01 -0.65, 74.23 -0.84, 145.46 0.85 M144.56 -1.89 C145.4 23.21, 147.32 45.77, 145.76 88.72 M145.05 0.18 C146.09 21.35, 145.12 44.64, 144.98 86.81 M143.64 87.58 C106.93 88.81, 68.83 88.22, 0.01 87.09 M145.47 87.47 C103.75 84.98, 63.92 85.47, -0.08 87.85 M1.23 88.29 C-1.21 61.7, 0.13 39.83, -1.6 1.24 M0.96 86.23 C-1.09 66.03, -0.74 43.99, 0.43 -0.99" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(736.9823972452319 582.75390625) rotate(0 67.5 12.5)"><text x="67.5" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="middle" style="white-space: pre;" direction="ltr">go binary</text></g><g transform="translate(765.1620847452319 366.91796875) rotate(0 67.5 12.5)"><text x="67.5" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="middle" style="white-space: pre;" direction="ltr">test binary</text></g><g transform="translate(953.1113034952319 489.91796875) rotate(0 67.5 12.5)"><text x="67.5" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="middle" style="white-space: pre;" direction="ltr">test result</text></g><g transform="translate(148.10349099523194 272.11328125) rotate(0 89 12.5)"><text x="89" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="middle" style="white-space: pre;" direction="ltr">foo/foo2_test.go</text></g><g transform="translate(149.29880349523194 184.4609375) rotate(0 89 12.5)"><text x="89" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="middle" style="white-space: pre;" direction="ltr">foo/foo_test.go</text></g><g transform="translate(353.66208474523194 231.0390625) rotate(0 65 10)"><text x="0" y="14" font-family="Virgil, Segoe UI Emoji" font-size="16px" fill="#000000" text-anchor="start" style="white-space: pre;" direction="ltr">GoTestGenTest</text></g><g stroke-linecap="round"><g transform="translate(916.8755180255238 410.40032299565223) rotate(0 21.11605615023973 18.928845127836297)"><path d="M0.03 0.86 C7.14 6.8, 36.29 30.5, 43.64 36.64 M-1.41 0.26 C5.51 6.83, 35.45 31.13, 43.02 37.59" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(916.8755180255238 410.40032299565223) rotate(0 21.11605615023973 18.928845127836297)"><path d="M17.51 28.95 C24.6 33.5, 36.69 33.67, 41.51 37.3 M16.28 28.16 C24.93 31.75, 31.42 33.57, 42.98 37.45" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(916.8755180255238 410.40032299565223) rotate(0 21.11605615023973 18.928845127836297)"><path d="M30.03 13.9 C32.46 24.2, 39.77 30.12, 41.51 37.3 M28.8 13.11 C33.78 21.05, 36.62 27.26, 42.98 37.45" stroke="#000000" stroke-width="1" fill="none"></path></g></g><g transform="translate(924.8105222452319 395.5546875) rotate(0 56.5 12.5)"><text x="0" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="start" style="white-space: pre;" direction="ltr">TestRunner</text></g><g stroke-linecap="round" transform="translate(307.16208474523194 10) rotate(0 64.072265625 35.654296875)"><path d="M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0 M0.4 6 C0.52 4.91, 2.25 4.41, 4.93 0.43 M-0.35 6.11 C1.28 4.42, 3.61 1.91, 5.12 0.37 M1.02 12.63 C4.39 8.52, 5.49 5.09, 10.64 -0.52 M-0.34 11.69 C3.52 8.32, 8.08 4.5, 9.97 -0.22 M-1.77 20.23 C4.38 11.82, 11.14 3.64, 16.21 0.42 M-0.31 19.39 C5.48 12.47, 10.65 5.41, 14.71 -0.24 M1.21 25.13 C5.92 15.77, 15.89 5.64, 20.19 -0.1 M0.83 24.91 C3.96 18.05, 10.4 13.68, 21.58 0.8 M1.05 29.29 C6.01 21.58, 12.06 15.09, 25.82 1.8 M0.71 29.93 C8.77 18.79, 18.33 8.23, 26.59 0.47 M0.82 38.12 C7.1 27.04, 17.33 17.68, 31.83 0.33 M-1.18 37.73 C8.8 27.05, 17.31 15.46, 31.97 0.4 M-0.6 43.24 C13.85 24.39, 27.18 9.21, 36.75 -1.69 M0.55 42.1 C9.83 30.96, 20.92 18.11, 36.92 1.1 M-0.8 49.12 C11.79 37.59, 22.34 24.2, 41.89 1.5 M-0.57 48.49 C11.32 35.71, 25.53 21.05, 43.06 0.74 M0.36 56.18 C14.5 39.47, 27.06 21.14, 47.63 1.02 M-0.1 55.47 C17.8 35.57, 34.29 14.95, 47.37 -0.01 M1.1 59.21 C11.85 46.04, 26.86 33.66, 52.31 -0.3 M0.28 61.66 C19.91 37.45, 40 13.69, 53.63 0.8 M-0.05 66.42 C23.88 39.98, 48.52 13.74, 56.64 -1.54 M-0.49 67.17 C17.85 46.53, 34.73 26.57, 57.35 -0.74 M0.09 73.38 C21.99 47.5, 44.35 22.45, 62.54 -1.34 M0.06 71.99 C18.3 53.48, 34.65 34.03, 63.19 0.36 M8.25 69.87 C28.13 45.89, 52.37 21.04, 69.54 0.56 M7.39 71.27 C23.41 52.3, 39.58 31.96, 67.96 0.83 M9.87 72.28 C27.39 55.35, 42.97 38.01, 73.63 1.56 M11.69 72.2 C28.1 53.06, 43.14 36.51, 73.97 -0.04 M17.78 70.72 C39.87 45.63, 61.46 20.85, 79.65 -1.29 M17.11 71.48 C37.93 48.26, 59.17 24.03, 80.03 0.39 M20.67 71.86 C37.01 55.79, 50.8 37.61, 84.17 -1.02 M22.8 72.68 C47.05 44.05, 71.3 14.92, 84.89 -1.07 M25.95 73.36 C40.38 57.56, 52.61 43.34, 91.85 1.73 M28.3 71.03 C42.47 55.14, 57.63 37.98, 90.13 -0.6 M32.12 70.2 C56.36 48.24, 75.42 20.2, 94.32 0.98 M32.55 72.27 C56.11 45.66, 76.89 20.22, 95.63 -0.61 M39.66 73.08 C52.93 56.1, 64.69 41.59, 102.58 -0.11 M39.24 71.41 C62.12 45.78, 85.2 18.87, 100.52 -0.87 M43.4 70.8 C67.18 45.01, 94.6 12.87, 105.82 1.04 M43.84 71.59 C65.38 46.78, 88.23 20.18, 106.57 0.23 M46.74 73.36 C67.97 49.1, 91.25 26.51, 111.84 0.89 M48.29 71.63 C64.24 53.62, 80.1 35.27, 111.19 0.59 M53.28 70.61 C75.76 46.53, 96.96 23.94, 117.28 0.82 M53.29 73.07 C66.81 58.53, 79.78 42.52, 116.15 -0.13 M58.53 70.86 C75.8 56.32, 88.81 36.12, 123.21 1.85 M58.48 73.25 C74.36 56.6, 89.94 38.86, 121.85 0.61 M64.07 72.02 C87.13 45.7, 109.61 19.7, 126.87 -0.82 M65.24 72.88 C82.4 50.83, 101.79 30.46, 127.5 1.27 M69.98 71.95 C95.64 43.72, 117.07 17.12, 129.84 3.62 M69.6 72.84 C91.95 45.57, 115.09 20.46, 129.96 2.05 M73.66 70.85 C93.84 50.37, 113.4 26.81, 129.12 8.95 M75.73 73 C95.64 47.71, 116.81 22.92, 131.28 8.72 M78.24 73.65 C94.14 59.19, 104.3 42.7, 131.87 13.75 M80.81 73.02 C91.51 61.4, 101.28 49.48, 130.1 14.84 M87.47 72.36 C97.6 59.1, 106.69 44.69, 131.95 20.85 M86.53 71.18 C95.7 61.72, 104.31 51.11, 130.69 19.7 M90.05 72.46 C107.53 55.54, 122.61 37.86, 132.08 27.89 M89.99 73.18 C103.04 58.65, 115.04 43.74, 131.68 25.31 M94.53 71.26 C106.1 58.52, 115.45 49.5, 132.18 33.76 M97.14 70.95 C105.36 60.27, 116.83 49.9, 130.98 33.25 M101.69 72.29 C106.19 63.13, 116.32 56.73, 131.63 37.67 M101.74 71.49 C112.26 58.62, 124.76 45.96, 130.6 38.17 M107.39 71.67 C114.36 60.99, 124.83 53.95, 128.9 45.79 M106.76 71.64 C115.66 63.29, 121.99 54.18, 130.84 44.93 M111 72.49 C115.95 65.61, 123.92 60.67, 129.22 49.9 M111.37 72.92 C116.89 67.66, 119.49 62.84, 130.5 51.63 M118.19 71.17 C121.94 65.64, 128.02 61.21, 130.77 58.48 M118.33 72.33 C122.54 65.85, 126.97 60.65, 131.68 57.13 M121.92 72 C125.79 69.25, 127.2 66.66, 129.71 63.13 M122.85 72.8 C125.52 68.04, 128.51 64.96, 130.67 63.63" stroke="#ced4da" stroke-width="0.5" fill="none"></path><path d="M-1.28 -0.26 C43.36 1.94, 82.47 0.73, 127.85 -0.01 M0.08 -0.42 C39.64 -1.06, 79.27 -1.38, 127.79 -0.67 M127.98 -1.4 C126.39 24.44, 128.05 49.02, 126.8 72.81 M128.06 -0.89 C127.86 21.14, 127.68 42.33, 127.17 71.23 M129.06 70.68 C88.05 68.93, 47.92 70.74, -1.16 70.97 M127.6 71.73 C102.06 72.21, 76.43 70.93, 0.11 71.56 M-1.06 70.51 C1.51 51.45, -1.51 34.41, 1.85 1.57 M-0.68 71.72 C0.05 53.4, 1.16 34.84, -0.19 -0.81" stroke="#000000" stroke-width="1" fill="none"></path></g><g stroke-linecap="round" transform="translate(1032.6894284952318 222.16015625) rotate(0 64.072265625 35.654296875)"><path d="M0 0 C0 0, 0 0, 0 0 M0 0 C0 0, 0 0, 0 0 M-0.57 5.67 C0.21 5.75, 1.28 3.57, 5.38 -0.13 M0.03 6.79 C0.81 5.06, 2.47 3.17, 5.32 0.69 M-0.79 10.92 C5.32 8.41, 8.65 1.06, 11.76 -1.54 M-0.25 11.32 C3.13 8.78, 5.96 5.47, 10.6 -0.43 M-1.7 17.29 C5.76 13.78, 11.06 6.06, 16.29 -1.6 M-0.55 17.77 C3.38 13.58, 9.06 8.95, 15.26 1.32 M1.9 22.64 C5.22 17, 13.04 10.77, 20.14 0.17 M1.21 23.23 C6.35 17.38, 12.06 10.83, 21.88 -0.76 M-1.77 30.67 C11.34 20.2, 20.41 8.35, 27.85 0.02 M-0.72 30.92 C6.6 21.22, 14.73 13.34, 26.78 0.91 M0.17 35.56 C5.57 29.93, 14.05 20.35, 32.14 -1.39 M0.39 36.55 C7.43 28.58, 14.38 19.02, 32.66 -0.73 M-0.56 41.59 C12.16 27.51, 26.42 12.24, 37.33 0.38 M0.5 42.65 C14.2 26.82, 26.93 11.78, 36.15 0.77 M1.02 47.02 C13.78 35.16, 24.42 21.24, 40.94 1.06 M-0.33 48.99 C11.46 36.44, 21.3 24.99, 41.87 -0.51 M0.08 56.45 C14.59 39.59, 26.13 25.75, 48.84 -0.59 M-0.57 55.5 C14.09 38.96, 27.13 23.5, 47.97 -0.6 M1.15 60.47 C12.21 46.01, 21.24 36.15, 52.85 0.75 M0.36 60.46 C12.17 45.56, 26.77 30.34, 52.22 0.51 M-0.94 67.99 C21.19 42.19, 46.49 14.7, 57.91 0.63 M-0.49 67.47 C13.6 53.71, 25.63 37.37, 57.58 1.05 M2.01 73.41 C16.79 53.84, 37.02 32.42, 63.64 0.46 M-0.15 73.08 C20.29 51.62, 39 29.44, 64.23 -0.31 M5.26 72.69 C23.5 54.47, 36.69 35.1, 67.53 -0.9 M6.48 71.5 C23.1 51.79, 40.64 32.38, 69.14 -0.31 M13.01 73.09 C31.44 48.91, 51.76 24.15, 74.51 0.54 M10.84 72.86 C26.55 55.79, 41.47 37.33, 74.17 -0.9 M17.85 73.41 C36.3 49.36, 55.83 30.25, 80.12 1.46 M16.72 72.03 C41.43 43.58, 64.15 16.66, 79.57 0.97 M23.98 72.2 C48.75 41.92, 74.03 15.94, 84.09 -1.1 M21.8 71.41 C38.67 52.88, 55.82 33.21, 84.11 -0.48 M28.78 71.34 C42.08 55.24, 53.82 42.2, 89.52 1.88 M27.75 71.03 C51.72 44.43, 76.71 16.43, 90.57 0.31 M34.02 71.7 C50.9 49.3, 71.85 26.64, 96.46 -0.98 M31.79 72.78 C45.86 56.72, 58.73 42.2, 95.89 0.46 M39.38 72.72 C62.52 43.29, 86.44 18.96, 101.04 -1.86 M38.77 72.6 C61.32 43.07, 86.17 17.73, 100.64 0.82 M41.67 72.09 C59.69 52.93, 74.69 39.15, 105.12 -2.07 M42.69 72.68 C67.28 43.71, 91.87 15.58, 107.15 0.14 M47.74 74.08 C62.07 55.07, 77.03 38.84, 111.39 -0.46 M48.14 72.36 C69.38 47.8, 89.42 24.16, 111.04 -0.68 M52.92 73.43 C74.42 44.38, 97.94 17.89, 116.37 -1.02 M53.13 72.59 C75.11 47.56, 96.52 21.17, 116.63 0.27 M59.39 71.25 C80.49 48.96, 100.95 26.13, 120.75 -1.03 M57.95 72.37 C75.05 52.96, 92.1 33.97, 121.81 0.38 M65.18 71.35 C80.18 53.65, 94.35 39.9, 127.9 0.83 M64.55 71.67 C89.3 44.77, 114 15.94, 126.84 0.99 M71.29 71.91 C85.14 54.28, 101.44 36.47, 130.76 3.13 M70.12 71.66 C89.24 50.41, 107.29 28.58, 129.83 2.52 M75.3 73.06 C96.56 49.29, 115.09 24.18, 129.67 10.26 M75.14 72.83 C97.36 47.84, 117.85 22.74, 130.88 7.73 M78.52 72.53 C97.6 54.08, 114.31 30.91, 129.89 15.57 M80.98 73.25 C92.65 57.4, 107.17 40.81, 130.13 13.29 M87.59 73.29 C98.32 59.38, 110.66 41.74, 128.87 22.03 M85.9 72.68 C102.2 52.48, 119.29 33.07, 131.43 21.08 M89.6 71.15 C102.23 57.97, 117.8 41.23, 129.15 26.06 M90.66 72.85 C105.35 55.75, 121.06 39.55, 131.66 26.58 M97.75 70.37 C104.05 62.14, 114.88 51.42, 129.49 33.2 M96.58 71.55 C104.07 63.3, 110.48 55.13, 130.31 33.07 M102.46 71.36 C106.93 64.86, 114.75 57.3, 129.81 38.47 M101.08 72.91 C111.93 59.99, 120.99 50.61, 130.91 38.57 M108.98 70.19 C113.25 62.03, 122.67 52.82, 129.65 46.2 M107.75 71.5 C112.21 66.36, 117.48 58.65, 129.84 44.25 M112.51 70.32 C116.63 66.78, 119.06 64.01, 130.53 49.98 M111.92 72.59 C114.84 67.73, 119.13 63.97, 131.17 50.9 M115.86 70.17 C122.35 66.07, 126.44 60.31, 128.93 56.99 M118.72 72.3 C120.07 68.73, 122.94 65.74, 130.1 55.86 M123.82 71.35 C125.15 68.91, 128.28 65.58, 131.1 63.44 M122.68 71.96 C124.93 70.79, 126.5 67.91, 130.54 63.18" stroke="#ced4da" stroke-width="0.5" fill="none"></path><path d="M-1.06 1.85 C44.28 1.12, 93.23 1.1, 129.31 0.7 M0.9 -0.82 C43.11 0.87, 83.97 0.72, 128.35 -0.62 M127.12 -0.64 C126.61 27.99, 127.15 55.01, 128.07 70.85 M128.55 0.92 C128.06 27.71, 127.87 55.53, 128.21 71.53 M126.97 71.78 C88.32 70.13, 48.64 70.41, 1.85 71.42 M128.87 70.55 C87.65 72.82, 47.5 72.2, 0.24 71.97 M1.35 70.24 C0.02 52.7, -0.09 36.03, 1.34 1.02 M0.01 71.62 C-0.19 52.35, 0.76 30.96, -0.96 -0.98" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(312.16208474523194 33.154296875) rotate(0 59 12.5)"><text x="59" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="middle" style="white-space: pre;" direction="ltr">rules_go</text></g><g transform="translate(1037.6894284952318 245.314453125) rotate(0 59 12.5)"><text x="59" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="middle" style="white-space: pre;" direction="ltr">bazel</text></g><g stroke-linecap="round"><g transform="translate(382.99020974523194 94.98046875) rotate(0 30.253458877652918 51.89430603110232)"><path d="M-0.29 -0.37 C5.36 5.5, 23.98 18.49, 34.16 35.99 C44.34 53.49, 56.53 93.07, 60.8 104.65 M1.75 -1.6 C7.2 3.87, 23.2 16.51, 33 34.34 C42.81 52.18, 56.09 93.37, 60.59 105.39" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(382.99020974523194 94.98046875) rotate(0 30.253458877652918 51.89430603110232)"><path d="M40.93 81.56 C49.28 91.42, 52.02 97.09, 60.15 107.11 M40.69 81.41 C46.73 87.26, 49.84 92.86, 60.85 106.09" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(382.99020974523194 94.98046875) rotate(0 30.253458877652918 51.89430603110232)"><path d="M60.28 74.74 C62.49 86.73, 59.06 94.58, 60.15 107.11 M60.05 74.59 C61.58 81.86, 60.19 89.04, 60.85 106.09" stroke="#000000" stroke-width="1" fill="none"></path></g></g><g stroke-linecap="round"><g transform="translate(450.31442849523194 37.1328125) rotate(0 173.79679264877763 106.14983864449897)"><path d="M0.98 0.35 C56.85 7.97, 291.97 10.44, 335.41 45.69 C378.86 80.94, 273.86 184.1, 261.63 211.86 M0.03 -0.51 C56.26 7.22, 294.18 11.13, 337.65 46.68 C381.12 82.23, 273.39 185.04, 260.86 212.81" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(450.31442849523194 37.1328125) rotate(0 173.79679264877763 106.14983864449897)"><path d="M269.83 182.5 C264.86 193.18, 262.75 202.99, 260.39 212.43 M268.93 183.21 C265.5 193.62, 264.12 202.59, 260.51 213.37" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(450.31442849523194 37.1328125) rotate(0 173.79679264877763 106.14983864449897)"><path d="M286.39 194.63 C276.18 201.6, 268.83 207.58, 260.39 212.43 M285.49 195.34 C276.83 201.8, 270.16 206.9, 260.51 213.37" stroke="#000000" stroke-width="1" fill="none"></path></g></g><g stroke-linecap="round"><g transform="translate(454.83005349523194 36.79296875) rotate(0 181.9551737461507 167.10801077578682)"><path d="M-0.42 -0.39 C58.75 10.58, 313.03 8.81, 356.15 64.85 C399.27 120.89, 274.93 290.8, 258.3 335.85 M1.55 -1.64 C60.44 9.09, 312.22 7.25, 354.97 63.17 C397.71 119.09, 274.51 288.36, 258.03 333.88" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(454.83005349523194 36.79296875) rotate(0 181.9551737461507 167.10801077578682)"><path d="M261.61 303.44 C261.77 317.35, 259.9 325.74, 258.11 334.77 M262.97 303.56 C260.74 312.7, 260.74 319.44, 257.26 333.31" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(454.83005349523194 36.79296875) rotate(0 181.9551737461507 167.10801077578682)"><path d="M279.71 313.11 C272.88 323.17, 263.92 327.79, 258.11 334.77 M281.07 313.23 C274.04 319.71, 269.16 323.84, 257.26 333.31" stroke="#000000" stroke-width="1" fill="none"></path></g></g><g stroke-linecap="round"><g transform="translate(301.95895974523194 58.109375) rotate(0 -125.98127196272736 183.67158354421147)"><path d="M-1.14 1.04 C-48.05 24.79, -247.57 90.83, -281.72 142.82 C-315.87 194.81, -252.58 284.98, -206.03 312.98 C-159.47 340.99, -43.08 302.01, -2.39 310.84 C38.3 319.67, 31.22 357.07, 38.11 365.95 M0.47 0.54 C-46.5 23.94, -247.68 88.96, -282.14 141.21 C-316.6 193.47, -252.91 285.62, -206.31 314.06 C-159.71 342.51, -43.6 303.08, -2.55 311.87 C38.5 320.66, 33.42 357.74, 40 366.8" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(301.95895974523194 58.109375) rotate(0 -125.98127196272736 183.67158354421147)"><path d="M23.69 344.5 C28.71 351.26, 31.38 355.13, 39.77 365.83 M22.01 342.62 C29.38 351.68, 35.84 361.55, 39.9 366.67" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(301.95895974523194 58.109375) rotate(0 -125.98127196272736 183.67158354421147)"><path d="M43.32 338.52 C42.85 346.77, 40.02 352.31, 39.77 365.83 M41.64 336.64 C41.71 347.77, 40.85 359.87, 39.9 366.67" stroke="#000000" stroke-width="1" fill="none"></path></g></g><g transform="translate(641.9784909952319 25.328125) rotate(0 29 12.5)"><text x="0" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="start" style="white-space: pre;" direction="ltr">define</text></g><g transform="translate(434.84958474523194 119.4375) rotate(0 29 12.5)"><text x="0" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="start" style="white-space: pre;" direction="ltr">define</text></g><g transform="translate(120.85739724523194 79.42578125) rotate(0 29 12.5)"><text x="0" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="start" style="white-space: pre;" direction="ltr">define</text></g><g stroke-linecap="round"><g transform="translate(1045.6894284952318 303.0703125) rotate(0 -32.16170214260467 43.18155396883376)"><path d="M-0.12 -0.47 C-10.76 13.86, -52.92 71.95, -63.85 86.51 M-1.65 -1.76 C-12.33 12.74, -53.94 73.7, -64.2 88.12" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(1045.6894284952318 303.0703125) rotate(0 -32.16170214260467 43.18155396883376)"><path d="M-57.31 61.03 C-58.41 66.46, -60.08 77.66, -62.8 86.54 M-56.8 59.27 C-59.12 68.88, -62.23 78.35, -64.55 88.36" stroke="#000000" stroke-width="1" fill="none"></path></g><g transform="translate(1045.6894284952318 303.0703125) rotate(0 -32.16170214260467 43.18155396883376)"><path d="M-40.46 72.75 C-46.57 74.71, -53.19 82.46, -62.8 86.54 M-39.95 70.98 C-47.87 76.56, -56.66 82.08, -64.55 88.36" stroke="#000000" stroke-width="1" fill="none"></path></g></g><g transform="translate(1030.9784909952318 334.328125) rotate(0 29 12.5)"><text x="0" y="18" font-family="Virgil, Segoe UI Emoji" font-size="20px" fill="#000000" text-anchor="start" style="white-space: pre;" direction="ltr">define</text></g></svg> \ No newline at end of file
diff --git a/docs/go/core/bzlmod.md b/docs/go/core/bzlmod.md
new file mode 100644
index 00000000..780f32d5
--- /dev/null
+++ b/docs/go/core/bzlmod.md
@@ -0,0 +1,186 @@
+# Go with Bzlmod
+
+This document describes how to use rules_go and Gazelle with Bazel's new external dependency subsystem [Bzlmod](https://bazel.build/external/overview#bzlmod), which is meant to replace `WORKSPACE` files eventually.
+Usages of rules_go and Gazelle in `BUILD` files are not affected by this; refer to the existing documentation on rules and configuration options for them.
+
+## Setup
+
+Add the following lines to your `MODULE.bazel` file:
+
+```starlark
+bazel_dep(name = "rules_go", version = "0.39.1")
+bazel_dep(name = "gazelle", version = "0.31.0")
+```
+
+The latest versions are always listed on https://registry.bazel.build/.
+
+If you have WORKSPACE dependencies that reference rules_go and/or Gazelle, you can still use the legacy repository names for the two repositories:
+
+```starlark
+bazel_dep(name = "rules_go", version = "0.39.1", repo_name = "io_bazel_rules_go")
+bazel_dep(name = "gazelle", version = "0.31.0", repo_name = "bazel_gazelle")
+```
+
+## Registering Go SDKs
+
+rules_go automatically downloads and registers a recent Go SDK, so unless a particular version is required, no manual steps are required.
+
+To register a particular version of the Go SDK, use the `go_sdk` module extension:
+
+```starlark
+go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
+
+# Download an SDK for the host OS & architecture.
+go_sdk.download(version = "1.20.3")
+
+# Alternately, download an SDK for a fixed OS/architecture, e.g. for remote execution.
+go_sdk.download(
+ version = "1.20.3",
+ goarch = "amd64",
+ goos = "linux",
+)
+
+# Register the Go SDK installed on the host.
+go_sdk.host()
+```
+
+You can register multiple Go SDKs and select which one to use on a per-target basis using [`go_cross_binary`](rules.md#go_cross_binary).
+The usual rules of [toolchain resolution](https://bazel.build/extending/toolchains#toolchain-resolution) apply, with SDKs registered in the root module taking precedence over those registered in dependencies.
+
+### Using a Go SDK
+
+By default, Go SDK repositories are created with mangled names and are not expected to be referenced directly.
+
+For build actions, toolchain resolution is used to select the appropriate SDK for a given target.
+[`go_cross_binary`](rules.md#go_cross_binary) can be used to influence the outcome of the resolution.
+
+The `go` tool of the SDK registered for the host is available via the `@rules_go//go` target.
+Prefer running it via this target over running `go` directly to ensure that all developers use the same version.
+The `@rules_go//go` target can be used in scripts executed via `bazel run`, but cannot be used in build actions.
+Note that `go` command arguments starting with `-` require the use of the double dash separator with `bazel run`:
+
+```sh
+bazel run @rules_go//go -- mod tidy -v
+```
+
+If you really do need direct access to a Go SDK, you can provide the `name` attribute on the `go_sdk.download` or `go_sdk.host` tag and then bring the repository with that name into scope via `use_repo`.
+Note that modules using this attribute cannot be added to registries such as the Bazel Central Registry (BCR).
+If you have a use case that would require this, please explain it in an issue.
+
+### Not yet supported
+
+* `go_local_sdk`
+* `go_wrap_sdk`
+* nogo ([#3529](https://github.com/bazelbuild/rules_go/issues/3529))
+
+## Generating BUILD files
+
+Add the following to your top-level BUILD file:
+
+```starlark
+load("@gazelle//:def.bzl", "gazelle")
+
+gazelle(name = "gazelle")
+```
+
+If there is no `go.mod` file in the same directory as your top-level BUILD file, also add the following [Gazelle directive](https://github.com/bazelbuild/bazel-gazelle#directives) to that BUILD file to supply Gazelle with your Go module's path:
+
+```starlark
+# gazelle:prefix github.com/example/project
+```
+
+Then, use `bazel run //:gazelle` to (re-)generate BUILD files.
+
+## External dependencies
+
+External Go dependencies are managed by the `go_deps` module extension provided by Gazelle.
+`go_deps` performs [Minimal Version Selection](https://go.dev/ref/mod#minimal-version-selection) on all transitive Go dependencies of all Bazel modules, so compared to the old WORKSPACE setup, every Bazel module only needs to declare its own Go dependencies.
+For every major version of a Go module, there will only ever be a single version in the entire build, just as in regular Go module builds.
+
+### Specifying external dependencies
+
+Even though this is not a strict requirement, for interoperability with Go tooling that isn't Bazel-aware, it is recommended to manage Go dependencies via `go.mod`.
+The `go_deps` extension parses this file directly, so external tooling such as `gazelle update-repos` is no longer needed.
+
+Register the `go.mod` file with the `go_deps` extension as follows:
+
+```starlark
+go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
+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",
+)
+```
+
+Bazel emits a warning if the `use_repo` statement is out of date or missing entirely (requires Bazel 6.2.0 or higher).
+The warning contains a `buildozer` command to automatically fix the `MODULE.bazel` file (requires buildozer 6.1.1 or higher).
+
+Alternatively, you can specify a module extension tag to add an individual dependency.
+This can be useful for dependencies of generated code that `go mod tidy` would remove. (There is [ongoing work](https://github.com/bazelbuild/bazel-gazelle/pull/1495) to provide a Bazel-aware version of `tidy`.)
+
+```starlark
+go_deps.module(
+ path = "google.golang.org/grpc",
+ sum = "h1:fPVVDxY9w++VjTZsYvXWqEf9Rqar/e+9zYfxKK+W+YU=",
+ version = "v1.50.0",
+)
+```
+
+### Managing `go.mod`
+
+An initial `go.mod` file can be created via
+
+```sh
+bazel run @rules_go//go mod init github.com/example/project
+```
+
+A dependency can be added via
+
+```sh
+bazel run @rules_go//go get golang.org/x/text@v0.3.2
+```
+
+### Overrides
+
+The root module can override certain aspects of the dependency resolution performed by the `go_deps` extension.
+
+#### `replace`
+
+[`replace` directives](https://go.dev/ref/mod#go-mod-file-replace) in `go.mod` can be used to replace particular versions of dependencies with other versions or entirely different modules.
+At the moment the only supported form is:
+
+```
+replace(
+ golang.org/x/net v1.2.3 => example.com/fork/net v1.4.5
+)
+```
+
+#### Gazelle directives
+
+Some external Go modules may require tweaking how Gazelle generates BUILD files for them via [Gazelle directives](https://github.com/bazelbuild/bazel-gazelle#directives).
+The `go_deps` extension provides a dedicated `go_deps.gazelle_override` tag for this purpose:
+
+```starlark
+go_deps.gazelle_override(
+ directives = [
+ "gazelle:go_naming_convention go_default_library",
+ ],
+ path = "github.com/stretchr/testify",
+)
+```
+
+If you need to use a `gazelle_override` to get a public Go module to build with Bazel, consider contributing the directives to the [public registry for default Gazelle overrides](https://github.com/bazelbuild/bazel-gazelle/blob/master/internal/bzlmod/default_gazelle_overrides.bzl) via a PR.
+This will allow you to drop the `gazelle_override` tag and also makes the Go module usable in non-root Bazel modules.
+
+### Not yet supported
+
+* Fetching dependencies from Git repositories or via HTTP
+* `go.mod` `replace` directives matching all versions of a module
+* `go.mod` `replace` directives referencing local files
+* `go.mod` `exclude` directices
diff --git a/docs/go/core/cross_compilation.md b/docs/go/core/cross_compilation.md
new file mode 100644
index 00000000..de8cd1f5
--- /dev/null
+++ b/docs/go/core/cross_compilation.md
@@ -0,0 +1,29 @@
+
+## Cross compilation
+
+rules_go can cross-compile Go projects to any platform the Go toolchain
+supports. The simplest way to do this is by setting the `--platforms` flag on
+the command line.
+
+``` bash
+$ bazel build --platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 //my/project
+```
+
+You can replace `linux_amd64` in the example above with any valid
+GOOS / GOARCH pair. To list all platforms, run this command:
+
+``` bash
+$ bazel query 'kind(platform, @io_bazel_rules_go//go/toolchain:all)'
+```
+
+By default, cross-compilation will cause Go targets to be built in "pure mode",
+which disables cgo; cgo files will not be compiled, and C/C++ dependencies will
+not be compiled or linked.
+
+Cross-compiling cgo code is possible, but not fully supported. You will need to
+[write a CROSSTOOL file] that describes your C/C++ toolchain. You'll need to
+ensure it works by building `cc_binary` and `cc_library` targets with the
+`--cpu` command line flag set. Then, to build a mixed Go / C / C++ project,
+add `pure = "off"` to your `go_binary` target and run Bazel with `--cpu`
+and `--platforms`.
+
diff --git a/docs/go/core/defines_and_stamping.md b/docs/go/core/defines_and_stamping.md
new file mode 100644
index 00000000..9d616c5f
--- /dev/null
+++ b/docs/go/core/defines_and_stamping.md
@@ -0,0 +1,94 @@
+## Defines and stamping
+
+In order to provide build time information to go code without data files, we
+support the concept of stamping.
+
+Stamping asks the linker to substitute the value of a global variable with a
+string determined at link time. Stamping only happens when linking a binary, not
+when compiling a package. This means that changing a value results only in
+re-linking, not re-compilation and thus does not cause cascading changes.
+
+Link values are set in the `x_defs` attribute of any Go rule. This is a
+map of string to string, where keys are the names of variables to substitute,
+and values are the string to use. Keys may be names of variables in the package
+being compiled, or they may be fully qualified names of variables in another
+package.
+
+These mappings are collected up across the entire transitive dependencies of a
+binary. This means you can set a value using `x_defs` in a
+`go_library`, and any binary that links that library will be stamped with that
+value. You can also override stamp values from libraries using `x_defs`
+on the `go_binary` rule if needed. The `--[no]stamp` option controls whether
+stamping of workspace variables is enabled.
+
+The values of the `x_defs` dictionary are subject to
+[location expansion](https://bazel.build/reference/be/make-variables#predefined_label_variables).
+
+**Example**
+
+Suppose we have a small library that contains the current version.
+
+``` go
+package version
+
+var Version = "redacted"
+```
+
+We can set the version in the `go_library` rule for this library.
+
+``` bzl
+go_library(
+ name = "version",
+ srcs = ["version.go"],
+ importpath = "example.com/repo/version",
+ x_defs = {"Version": "0.9"},
+)
+```
+
+Binaries that depend on this library may also set this value.
+
+``` bzl
+go_binary(
+ name = "cmd",
+ srcs = ["main.go"],
+ deps = ["//version"],
+ x_defs = {"example.com/repo/version.Version": "0.9"},
+)
+```
+
+### Stamping with the workspace status script
+
+You can use values produced by the workspace status command in your link stamp.
+To use this functionality, write a script that prints key-value pairs, separated
+by spaces, one per line. For example:
+
+``` bash
+#!/usr/bin/env bash
+
+echo STABLE_GIT_COMMIT $(git rev-parse HEAD)
+```
+
+***Note:*** stamping with keys that bazel designates as "stable" will trigger a
+re-link when any stable key changes. Currently, in bazel, stable keys are
+`BUILD_EMBED_LABEL`, `BUILD_USER`, `BUILD_HOST` and keys whose names start with
+`STABLE_`. Stamping only with keys that are not stable keys will not trigger a
+relink.
+
+You can reference these in `x_defs` using curly braces.
+
+``` bzl
+go_binary(
+ name = "cmd",
+ srcs = ["main.go"],
+ deps = ["//version"],
+ x_defs = {"example.com/repo/version.Version": "{STABLE_GIT_COMMIT}"},
+)
+```
+
+You can build using the status script using the `--workspace_status_command`
+argument on the command line:
+
+``` bash
+$ bazel build --stamp --workspace_status_command=./status.sh //:cmd
+```
+
diff --git a/docs/go/core/embedding.md b/docs/go/core/embedding.md
new file mode 100644
index 00000000..89b2d36b
--- /dev/null
+++ b/docs/go/core/embedding.md
@@ -0,0 +1,86 @@
+## Embedding
+
+The sources, dependencies, and data of a `go_library` may be *embedded*
+within another `go_library`, `go_binary`, or `go_test` using the `embed`
+attribute. The embedding package will be compiled into a single archive
+file. The embedded package may still be compiled as a separate target.
+
+A minimal example of embedding is below. In this example, the command `bazel
+build :foo_and_bar` will compile `foo.go` and `bar.go` into a single
+archive. `bazel build :bar` will compile only `bar.go`. Both libraries must
+have the same `importpath`.
+
+``` bzl
+go_library(
+ name = "foo_and_bar",
+ srcs = ["foo.go"],
+ embed = [":bar"],
+ importpath = "example.com/foo",
+)
+
+go_library(
+ name = "bar",
+ srcs = ["bar.go"],
+ importpath = "example.com/foo",
+)
+```
+
+Embedding is most frequently used for tests and binaries. Go supports two
+different kinds of tests. *Internal tests* (e.g., `package foo`) are compiled
+into the same archive as the library under test and can reference unexported
+definitions in that library. *External tests* (e.g., `package foo_test`) are
+compiled into separate archives and may depend on exported definitions from the
+internal test archive.
+
+In order to compile the internal test archive, we *embed* the `go_library`
+under test into a `go_test` that contains the test sources. The `go_test`
+rule can automatically distinguish internal and external test sources, so they
+can be listed together in `srcs`. The `go_library` under test does not
+contain test sources. Other `go_binary` and `go_library` targets can depend
+on it or embed it.
+
+``` bzl
+go_library(
+ name = "foo_lib",
+ srcs = ["foo.go"],
+ importpath = "example.com/foo",
+)
+
+go_binary(
+ name = "foo",
+ embed = [":foo_lib"],
+)
+
+go_test(
+ name = "go_default_test",
+ srcs = [
+ "foo_external_test.go",
+ "foo_internal_test.go",
+ ],
+ embed = [":foo_lib"],
+)
+```
+
+Embedding may also be used to add extra sources sources to a
+`go_proto_library`.
+
+``` bzl
+proto_library(
+ name = "foo_proto",
+ srcs = ["foo.proto"],
+)
+
+go_proto_library(
+ name = "foo_go_proto",
+ importpath = "example.com/foo",
+ proto = ":foo_proto",
+)
+
+go_library(
+ name = "foo",
+ srcs = ["extra.go"],
+ embed = [":foo_go_proto"],
+ importpath = "example.com/foo",
+)
+```
+
diff --git a/docs/go/core/examples.md b/docs/go/core/examples.md
new file mode 100644
index 00000000..99adb1a1
--- /dev/null
+++ b/docs/go/core/examples.md
@@ -0,0 +1,70 @@
+## Examples
+
+### go_library
+``` bzl
+go_library(
+ name = "foo",
+ srcs = [
+ "foo.go",
+ "bar.go",
+ ],
+ deps = [
+ "//tools",
+ "@org_golang_x_utils//stuff",
+ ],
+ importpath = "github.com/example/project/foo",
+ visibility = ["//visibility:public"],
+)
+```
+
+### go_test
+
+To write an internal test, reference the library being tested with the `embed`
+instead of `deps`. This will compile the test sources into the same package as the library
+sources.
+
+#### Internal test example
+
+This builds a test that can use the internal interface of the package being tested.
+
+In the normal go toolchain this would be the kind of tests formed by adding writing
+`<file>_test.go` files in the same package.
+
+It references the library being tested with `embed`.
+
+
+``` bzl
+go_library(
+ name = "lib",
+ srcs = ["lib.go"],
+)
+
+go_test(
+ name = "lib_test",
+ srcs = ["lib_test.go"],
+ embed = [":lib"],
+)
+```
+
+#### External test example
+
+This builds a test that can only use the public interface(s) of the packages being tested.
+
+In the normal go toolchain this would be the kind of tests formed by adding an `<name>_test`
+package.
+
+It references the library(s) being tested with `deps`.
+
+``` bzl
+go_library(
+ name = "lib",
+ srcs = ["lib.go"],
+)
+
+go_test(
+ name = "lib_xtest",
+ srcs = ["lib_x_test.go"],
+ deps = [":lib"],
+)
+```
+
diff --git a/docs/go/core/platform-specific_dependencies.md b/docs/go/core/platform-specific_dependencies.md
new file mode 100644
index 00000000..92957fa0
--- /dev/null
+++ b/docs/go/core/platform-specific_dependencies.md
@@ -0,0 +1,53 @@
+ [build constraints]: https://golang.org/pkg/go/build/#hdr-Build_Constraints
+ [select]: https://docs.bazel.build/versions/master/be/functions.html#select
+ [config_setting]: https://docs.bazel.build/versions/master/be/general.html#config_setting
+ [Gazelle]: https://github.com/bazelbuild/bazel-gazelle
+
+
+## Platform-specific dependencies
+
+When cross-compiling, you may have some platform-specific sources and
+dependencies. Source files from all platforms can be mixed freely in a single
+`srcs` list. Source files are filtered using [build constraints] (filename
+suffixes and `+build` tags) before being passed to the compiler.
+
+Platform-specific dependencies are another story. For example, if you are
+building a binary for Linux, and it has dependency that should only be built
+when targeting Windows, you will need to filter it out using Bazel [select]
+expressions:
+
+``` bzl
+go_binary(
+ name = "cmd",
+ srcs = [
+ "foo_linux.go",
+ "foo_windows.go",
+ ],
+ deps = [
+ # platform agnostic dependencies
+ "//bar",
+ ] + select({
+ # OS-specific dependencies
+ "@io_bazel_rules_go//go/platform:linux": [
+ "//baz_linux",
+ ],
+ "@io_bazel_rules_go//go/platform:windows": [
+ "//quux_windows",
+ ],
+ "//conditions:default": [],
+ }),
+)
+```
+
+`select` accepts a dictionary argument. The keys are labels that reference [config_setting] rules.
+The values are lists of labels. Exactly one of these
+lists will be selected, depending on the target configuration. rules_go has
+pre-declared `config_setting` rules for each OS, architecture, and
+OS-architecture pair. For a full list, run this command:
+
+``` bash
+$ bazel query 'kind(config_setting, @io_bazel_rules_go//go/platform:all)'
+```
+
+[Gazelle] will generate dependencies in this format automatically.
+
diff --git a/docs/go/core/rules.bzl b/docs/go/core/rules.bzl
new file mode 100644
index 00000000..9db8e66a
--- /dev/null
+++ b/docs/go/core/rules.bzl
@@ -0,0 +1,129 @@
+"""
+ ["Make variable"]: https://docs.bazel.build/versions/master/be/make-variables.html
+ [Bourne shell tokenization]: https://docs.bazel.build/versions/master/be/common-definitions.html#sh-tokenization
+ [Gazelle]: https://github.com/bazelbuild/bazel-gazelle
+ [GoArchive]: /go/providers.rst#GoArchive
+ [GoLibrary]: /go/providers.rst#GoLibrary
+ [GoPath]: /go/providers.rst#GoPath
+ [GoSource]: /go/providers.rst#GoSource
+ [build constraints]: https://golang.org/pkg/go/build/#hdr-Build_Constraints
+ [cc_library deps]: https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library.deps
+ [cgo]: http://golang.org/cmd/cgo/
+ [config_setting]: https://docs.bazel.build/versions/master/be/general.html#config_setting
+ [data dependencies]: https://docs.bazel.build/versions/master/build-ref.html#data
+ [goarch]: /go/modes.rst#goarch
+ [goos]: /go/modes.rst#goos
+ [mode attributes]: /go/modes.rst#mode-attributes
+ [nogo]: /go/nogo.rst#nogo
+ [pure]: /go/modes.rst#pure
+ [race]: /go/modes.rst#race
+ [msan]: /go/modes.rst#msan
+ [select]: https://docs.bazel.build/versions/master/be/functions.html#select
+ [shard_count]: https://docs.bazel.build/versions/master/be/common-definitions.html#test.shard_count
+ [static]: /go/modes.rst#static
+ [test_arg]: https://docs.bazel.build/versions/master/user-manual.html#flag--test_arg
+ [test_filter]: https://docs.bazel.build/versions/master/user-manual.html#flag--test_filter
+ [test_env]: https://docs.bazel.build/versions/master/user-manual.html#flag--test_env
+ [test_runner_fail_fast]: https://docs.bazel.build/versions/master/command-line-reference.html#flag--test_runner_fail_fast
+ [write a CROSSTOOL file]: https://github.com/bazelbuild/bazel/wiki/Yet-Another-CROSSTOOL-Writing-Tutorial
+ [bazel]: https://pkg.go.dev/github.com/bazelbuild/rules_go/go/tools/bazel?tab=doc
+ [go_library]: #go_library
+ [go_binary]: #go_binary
+ [go_test]: #go_test
+ [go_path]: #go_path
+ [go_source]: #go_source
+ [go_test]: #go_test
+ [Examples]: examples.md#examples
+ [Defines and stamping]: defines_and_stamping.md#defines-and-stamping
+ [Stamping with the workspace status script]: defines_and_stamping.md#stamping-with-the-workspace-status-script
+ [Embedding]: embedding.md#embedding
+ [Cross compilation]: cross_compilation.md#cross-compilation
+ [Platform-specific dependencies]: platform-specific_dependencies.md#platform-specific-dependencies
+
+# Core Go rules
+
+These are the core go rules, required for basic operation. The intent is that these rules are
+sufficient to match the capabilities of the normal go tools.
+
+## Additional resources
+- ["Make variable"]
+- [Bourne shell tokenization]
+- [Gazelle]
+- [GoArchive]
+- [GoLibrary]
+- [GoPath]
+- [GoSource]
+- [build constraints]:
+- [cc_library deps]
+- [cgo]
+- [config_setting]
+- [data dependencies]
+- [goarch]
+- [goos]
+- [mode attributes]
+- [nogo]
+- [pure]
+- [race]
+- [msan]
+- [select]:
+- [shard_count]
+- [static]
+- [test_arg]
+- [test_filter]
+- [test_env]
+- [test_runner_fail_fast]
+- [write a CROSSTOOL file]
+- [bazel]
+
+
+------------------------------------------------------------------------
+
+Introduction
+------------
+
+Three core rules may be used to build most projects: [go_library], [go_binary],
+and [go_test]. These rules reimplement the low level plumping commands of a normal
+'go build' invocation: compiling package's source files to archives, then linking
+archives into go binary.
+
+[go_library] builds a single package. It has a list of source files
+(specified with `srcs`) and may depend on other packages (with `deps`).
+Each [go_library] has an `importpath`, which is the name used to import it
+in Go source files.
+
+[go_binary] also builds a single `main` package and links it into an
+executable. It may embed the content of a [go_library] using the `embed`
+attribute. Embedded sources are compiled together in the same package.
+Binaries can be built for alternative platforms and configurations by setting
+`goos`, `goarch`, and other attributes.
+
+[go_test] builds a test executable. Like tests produced by `go test`, this
+consists of three packages: an internal test package compiled together with
+the library being tested (specified with `embed`), an external test package
+compiled separately, and a generated test main package.
+
+Here is an example of a Bazel build graph for a project using these core rules:
+
+![](./buildgraph.svg)
+
+By instrumenting the lower level go tooling, we can cache smaller, finer
+artifacts with Bazel and thus, speed up incremental builds.
+
+Rules
+-----
+
+"""
+
+load("//go/private/rules:library.bzl", _go_library = "go_library")
+load("//go/private/rules:binary.bzl", _go_binary = "go_binary")
+load("//go/private/rules:test.bzl", _go_test = "go_test")
+load("//go/private/rules:source.bzl", _go_source = "go_source")
+load("//go/private/tools:path.bzl", _go_path = "go_path")
+load("//go/private/rules:cross.bzl", _go_cross_binary = "go_cross_binary")
+
+go_library = _go_library
+go_binary = _go_binary
+go_test = _go_test
+go_source = _go_source
+go_path = _go_path
+go_cross_binary = _go_cross_binary
diff --git a/docs/go/core/rules.md b/docs/go/core/rules.md
new file mode 100644
index 00000000..d30a4737
--- /dev/null
+++ b/docs/go/core/rules.md
@@ -0,0 +1,403 @@
+<!-- Generated with Stardoc: http://skydoc.bazel.build -->
+
+
+ ["Make variable"]: https://docs.bazel.build/versions/master/be/make-variables.html
+ [Bourne shell tokenization]: https://docs.bazel.build/versions/master/be/common-definitions.html#sh-tokenization
+ [Gazelle]: https://github.com/bazelbuild/bazel-gazelle
+ [GoArchive]: /go/providers.rst#GoArchive
+ [GoLibrary]: /go/providers.rst#GoLibrary
+ [GoPath]: /go/providers.rst#GoPath
+ [GoSource]: /go/providers.rst#GoSource
+ [build constraints]: https://golang.org/pkg/go/build/#hdr-Build_Constraints
+ [cc_library deps]: https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library.deps
+ [cgo]: http://golang.org/cmd/cgo/
+ [config_setting]: https://docs.bazel.build/versions/master/be/general.html#config_setting
+ [data dependencies]: https://docs.bazel.build/versions/master/build-ref.html#data
+ [goarch]: /go/modes.rst#goarch
+ [goos]: /go/modes.rst#goos
+ [mode attributes]: /go/modes.rst#mode-attributes
+ [nogo]: /go/nogo.rst#nogo
+ [pure]: /go/modes.rst#pure
+ [race]: /go/modes.rst#race
+ [msan]: /go/modes.rst#msan
+ [select]: https://docs.bazel.build/versions/master/be/functions.html#select
+ [shard_count]: https://docs.bazel.build/versions/master/be/common-definitions.html#test.shard_count
+ [static]: /go/modes.rst#static
+ [test_arg]: https://docs.bazel.build/versions/master/user-manual.html#flag--test_arg
+ [test_filter]: https://docs.bazel.build/versions/master/user-manual.html#flag--test_filter
+ [test_env]: https://docs.bazel.build/versions/master/user-manual.html#flag--test_env
+ [test_runner_fail_fast]: https://docs.bazel.build/versions/master/command-line-reference.html#flag--test_runner_fail_fast
+ [write a CROSSTOOL file]: https://github.com/bazelbuild/bazel/wiki/Yet-Another-CROSSTOOL-Writing-Tutorial
+ [bazel]: https://pkg.go.dev/github.com/bazelbuild/rules_go/go/tools/bazel?tab=doc
+ [go_library]: #go_library
+ [go_binary]: #go_binary
+ [go_test]: #go_test
+ [go_path]: #go_path
+ [go_source]: #go_source
+ [go_test]: #go_test
+ [Examples]: examples.md#examples
+ [Defines and stamping]: defines_and_stamping.md#defines-and-stamping
+ [Stamping with the workspace status script]: defines_and_stamping.md#stamping-with-the-workspace-status-script
+ [Embedding]: embedding.md#embedding
+ [Cross compilation]: cross_compilation.md#cross-compilation
+ [Platform-specific dependencies]: platform-specific_dependencies.md#platform-specific-dependencies
+
+# Core Go rules
+
+These are the core go rules, required for basic operation. The intent is that these rules are
+sufficient to match the capabilities of the normal go tools.
+
+## Additional resources
+- ["Make variable"]
+- [Bourne shell tokenization]
+- [Gazelle]
+- [GoArchive]
+- [GoLibrary]
+- [GoPath]
+- [GoSource]
+- [build constraints]:
+- [cc_library deps]
+- [cgo]
+- [config_setting]
+- [data dependencies]
+- [goarch]
+- [goos]
+- [mode attributes]
+- [nogo]
+- [pure]
+- [race]
+- [msan]
+- [select]:
+- [shard_count]
+- [static]
+- [test_arg]
+- [test_filter]
+- [test_env]
+- [test_runner_fail_fast]
+- [write a CROSSTOOL file]
+- [bazel]
+
+
+------------------------------------------------------------------------
+
+Introduction
+------------
+
+Three core rules may be used to build most projects: [go_library], [go_binary],
+and [go_test]. These rules reimplement the low level plumping commands of a normal
+'go build' invocation: compiling package's source files to archives, then linking
+archives into go binary.
+
+[go_library] builds a single package. It has a list of source files
+(specified with `srcs`) and may depend on other packages (with `deps`).
+Each [go_library] has an `importpath`, which is the name used to import it
+in Go source files.
+
+[go_binary] also builds a single `main` package and links it into an
+executable. It may embed the content of a [go_library] using the `embed`
+attribute. Embedded sources are compiled together in the same package.
+Binaries can be built for alternative platforms and configurations by setting
+`goos`, `goarch`, and other attributes.
+
+[go_test] builds a test executable. Like tests produced by `go test`, this
+consists of three packages: an internal test package compiled together with
+the library being tested (specified with `embed`), an external test package
+compiled separately, and a generated test main package.
+
+Here is an example of a Bazel build graph for a project using these core rules:
+
+![](./buildgraph.svg)
+
+By instrumenting the lower level go tooling, we can cache smaller, finer
+artifacts with Bazel and thus, speed up incremental builds.
+
+Rules
+-----
+
+
+
+
+
+
+<a id="#go_binary"></a>
+
+## go_binary
+
+<pre>
+go_binary(<a href="#go_binary-name">name</a>, <a href="#go_binary-basename">basename</a>, <a href="#go_binary-cdeps">cdeps</a>, <a href="#go_binary-cgo">cgo</a>, <a href="#go_binary-clinkopts">clinkopts</a>, <a href="#go_binary-copts">copts</a>, <a href="#go_binary-cppopts">cppopts</a>, <a href="#go_binary-cxxopts">cxxopts</a>, <a href="#go_binary-data">data</a>, <a href="#go_binary-deps">deps</a>, <a href="#go_binary-embed">embed</a>,
+ <a href="#go_binary-embedsrcs">embedsrcs</a>, <a href="#go_binary-env">env</a>, <a href="#go_binary-gc_goopts">gc_goopts</a>, <a href="#go_binary-gc_linkopts">gc_linkopts</a>, <a href="#go_binary-goarch">goarch</a>, <a href="#go_binary-goos">goos</a>, <a href="#go_binary-gotags">gotags</a>, <a href="#go_binary-importpath">importpath</a>, <a href="#go_binary-linkmode">linkmode</a>, <a href="#go_binary-msan">msan</a>,
+ <a href="#go_binary-out">out</a>, <a href="#go_binary-pure">pure</a>, <a href="#go_binary-race">race</a>, <a href="#go_binary-srcs">srcs</a>, <a href="#go_binary-static">static</a>, <a href="#go_binary-x_defs">x_defs</a>)
+</pre>
+
+This builds an executable from a set of source files,
+ which must all be in the `main` package. You can run the binary with
+ `bazel run`, or you can build it with `bazel build` and run it directly.<br><br>
+ ***Note:*** `name` should be the same as the desired name of the generated binary.<br><br>
+ **Providers:**
+ <ul>
+ <li>[GoLibrary]</li>
+ <li>[GoSource]</li>
+ <li>[GoArchive]</li>
+ </ul>
+
+
+### **Attributes**
+
+
+| Name | Description | Type | Mandatory | Default |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="go_binary-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="go_binary-basename"></a>basename | The basename of this binary. The binary basename may also be platform-dependent: on Windows, we add an .exe extension. | String | optional | "" |
+| <a id="go_binary-cdeps"></a>cdeps | The list of other libraries that the c code depends on. This can be anything that would be allowed in [cc_library deps] Only valid if <code>cgo</code> = <code>True</code>. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_binary-cgo"></a>cgo | If <code>True</code>, the package may contain [cgo] code, and <code>srcs</code> may contain C, C++, Objective-C, and Objective-C++ files and non-Go assembly files. When cgo is enabled, these files will be compiled with the C/C++ toolchain and included in the package. Note that this attribute does not force cgo to be enabled. Cgo is enabled for non-cross-compiling builds when a C/C++ toolchain is configured. | Boolean | optional | False |
+| <a id="go_binary-clinkopts"></a>clinkopts | List of flags to add to the C link command. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. Only valid if <code>cgo</code> = <code>True</code>. | List of strings | optional | [] |
+| <a id="go_binary-copts"></a>copts | List of flags to add to the C compilation command. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. Only valid if <code>cgo</code> = <code>True</code>. | List of strings | optional | [] |
+| <a id="go_binary-cppopts"></a>cppopts | List of flags to add to the C/C++ preprocessor command. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. Only valid if <code>cgo</code> = <code>True</code>. | List of strings | optional | [] |
+| <a id="go_binary-cxxopts"></a>cxxopts | List of flags to add to the C++ compilation command. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. Only valid if <code>cgo</code> = <code>True</code>. | List of strings | optional | [] |
+| <a id="go_binary-data"></a>data | List of files needed by this rule at run-time. This may include data files needed or other programs that may be executed. The [bazel] package may be used to locate run files; they may appear in different places depending on the operating system and environment. See [data dependencies] for more information on data files. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_binary-deps"></a>deps | List of Go libraries this package imports directly. These may be <code>go_library</code> rules or compatible rules with the [GoLibrary] provider. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_binary-embed"></a>embed | List of Go libraries whose sources should be compiled together with this binary's sources. Labels listed here must name <code>go_library</code>, <code>go_proto_library</code>, or other compatible targets with the [GoLibrary] and [GoSource] providers. Embedded libraries must all have the same <code>importpath</code>, which must match the <code>importpath</code> for this <code>go_binary</code> if one is specified. At most one embedded library may have <code>cgo = True</code>, and the embedding binary may not also have <code>cgo = True</code>. See [Embedding] for more information. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_binary-embedsrcs"></a>embedsrcs | The list of files that may be embedded into the compiled package using <code>//go:embed</code> directives. All files must be in the same logical directory or a subdirectory as source files. All source files containing <code>//go:embed</code> directives must be in the same logical directory. It's okay to mix static and generated source files and static and generated embeddable files. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_binary-env"></a>env | Environment variables to set when the binary is executed with bazel run. The values (but not keys) are subject to [location expansion](https://docs.bazel.build/versions/main/skylark/macros.html) but not full [make variable expansion](https://docs.bazel.build/versions/main/be/make-variables.html). | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | {} |
+| <a id="go_binary-gc_goopts"></a>gc_goopts | List of flags to add to the Go compilation command when using the gc compiler. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. | List of strings | optional | [] |
+| <a id="go_binary-gc_linkopts"></a>gc_linkopts | List of flags to add to the Go link command when using the gc compiler. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. | List of strings | optional | [] |
+| <a id="go_binary-goarch"></a>goarch | Forces a binary to be cross-compiled for a specific architecture. It's usually better to control this on the command line with <code>--platforms</code>.<br><br> This disables cgo by default, since a cross-compiling C/C++ toolchain is rarely available. To force cgo, set <code>pure</code> = <code>off</code>.<br><br> See [Cross compilation] for more information. | String | optional | "auto" |
+| <a id="go_binary-goos"></a>goos | Forces a binary to be cross-compiled for a specific operating system. It's usually better to control this on the command line with <code>--platforms</code>.<br><br> This disables cgo by default, since a cross-compiling C/C++ toolchain is rarely available. To force cgo, set <code>pure</code> = <code>off</code>.<br><br> See [Cross compilation] for more information. | String | optional | "auto" |
+| <a id="go_binary-gotags"></a>gotags | Enables a list of build tags when evaluating [build constraints]. Useful for conditional compilation. | List of strings | optional | [] |
+| <a id="go_binary-importpath"></a>importpath | The import path of this binary. Binaries can't actually be imported, but this may be used by [go_path] and other tools to report the location of source files. This may be inferred from embedded libraries. | String | optional | "" |
+| <a id="go_binary-linkmode"></a>linkmode | Determines how the binary should be built and linked. This accepts some of the same values as `go build -buildmode` and works the same way. <br><br> <ul> <li>`normal`: Builds a normal executable with position-dependent code.</li> <li>`pie`: Builds a position-independent executable.</li> <li>`plugin`: Builds a shared library that can be loaded as a Go plugin. Only supported on platforms that support plugins.</li> <li>`c-shared`: Builds a shared library that can be linked into a C program.</li> <li>`c-archive`: Builds an archive that can be linked into a C program.</li> </ul> | String | optional | "normal" |
+| <a id="go_binary-msan"></a>msan | Controls whether code is instrumented for memory sanitization. May be one of <code>on</code>, <code>off</code>, or <code>auto</code>. Not available when cgo is disabled. In most cases, it's better to control this on the command line with <code>--@io_bazel_rules_go//go/config:msan</code>. See [mode attributes], specifically [msan]. | String | optional | "auto" |
+| <a id="go_binary-out"></a>out | Sets the output filename for the generated executable. When set, <code>go_binary</code> will write this file without mode-specific directory prefixes, without linkmode-specific prefixes like "lib", and without platform-specific suffixes like ".exe". Note that without a mode-specific directory prefix, the output file (but not its dependencies) will be invalidated in Bazel's cache when changing configurations. | String | optional | "" |
+| <a id="go_binary-pure"></a>pure | Controls whether cgo source code and dependencies are compiled and linked, similar to setting <code>CGO_ENABLED</code>. May be one of <code>on</code>, <code>off</code>, or <code>auto</code>. If <code>auto</code>, pure mode is enabled when no C/C++ toolchain is configured or when cross-compiling. It's usually better to control this on the command line with <code>--@io_bazel_rules_go//go/config:pure</code>. See [mode attributes], specifically [pure]. | String | optional | "auto" |
+| <a id="go_binary-race"></a>race | Controls whether code is instrumented for race detection. May be one of <code>on</code>, <code>off</code>, or <code>auto</code>. Not available when cgo is disabled. In most cases, it's better to control this on the command line with <code>--@io_bazel_rules_go//go/config:race</code>. See [mode attributes], specifically [race]. | String | optional | "auto" |
+| <a id="go_binary-srcs"></a>srcs | The list of Go source files that are compiled to create the package. Only <code>.go</code> and <code>.s</code> files are permitted, unless the <code>cgo</code> attribute is set, in which case, <code>.c .cc .cpp .cxx .h .hh .hpp .hxx .inc .m .mm</code> files are also permitted. Files may be filtered at build time using Go [build constraints]. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_binary-static"></a>static | Controls whether a binary is statically linked. May be one of <code>on</code>, <code>off</code>, or <code>auto</code>. Not available on all platforms or in all modes. It's usually better to control this on the command line with <code>--@io_bazel_rules_go//go/config:static</code>. See [mode attributes], specifically [static]. | String | optional | "auto" |
+| <a id="go_binary-x_defs"></a>x_defs | Map of defines to add to the go link command. See [Defines and stamping] for examples of how to use these. | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | {} |
+
+
+
+
+
+<a id="#go_cross_binary"></a>
+
+## go_cross_binary
+
+<pre>
+go_cross_binary(<a href="#go_cross_binary-name">name</a>, <a href="#go_cross_binary-platform">platform</a>, <a href="#go_cross_binary-sdk_version">sdk_version</a>, <a href="#go_cross_binary-target">target</a>)
+</pre>
+
+This wraps an executable built by `go_binary` to cross compile it
+ for a different platform, and/or compile it using a different version
+ of the golang SDK.<br><br>
+ **Providers:**
+ <ul>
+ <li>[GoLibrary]</li>
+ <li>[GoSource]</li>
+ <li>[GoArchive]</li>
+ </ul>
+
+
+### **Attributes**
+
+
+| Name | Description | Type | Mandatory | Default |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="go_cross_binary-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="go_cross_binary-platform"></a>platform | The platform to cross compile the <code>target</code> for. If unspecified, the <code>target</code> will be compiled with the same platform as it would've with the original <code>go_binary</code> rule. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | None |
+| <a id="go_cross_binary-sdk_version"></a>sdk_version | The golang SDK version to use for compiling the <code>target</code>. Supports specifying major, minor, and/or patch versions, eg. <code>"1"</code>, <code>"1.17"</code>, or <code>"1.17.1"</code>. The first Go SDK provider installed in the repo's workspace (via <code>go_download_sdk</code>, <code>go_wrap_sdk</code>, etc) that matches the specified version will be used for compiling the given <code>target</code>. If unspecified, the <code>target</code> will be compiled with the same SDK as it would've with the original <code>go_binary</code> rule. Transitions <code>target</code> by changing the <code>--@io_bazel_rules_go//go/toolchain:sdk_version</code> build flag to the value provided for <code>sdk_version</code> here. | String | optional | "" |
+| <a id="go_cross_binary-target"></a>target | Go binary target to transition to the given platform and/or sdk_version. | <a href="https://bazel.build/concepts/labels">Label</a> | required | |
+
+
+
+
+
+<a id="#go_library"></a>
+
+## go_library
+
+<pre>
+go_library(<a href="#go_library-name">name</a>, <a href="#go_library-cdeps">cdeps</a>, <a href="#go_library-cgo">cgo</a>, <a href="#go_library-clinkopts">clinkopts</a>, <a href="#go_library-copts">copts</a>, <a href="#go_library-cppopts">cppopts</a>, <a href="#go_library-cxxopts">cxxopts</a>, <a href="#go_library-data">data</a>, <a href="#go_library-deps">deps</a>, <a href="#go_library-embed">embed</a>, <a href="#go_library-embedsrcs">embedsrcs</a>,
+ <a href="#go_library-gc_goopts">gc_goopts</a>, <a href="#go_library-importmap">importmap</a>, <a href="#go_library-importpath">importpath</a>, <a href="#go_library-importpath_aliases">importpath_aliases</a>, <a href="#go_library-srcs">srcs</a>, <a href="#go_library-x_defs">x_defs</a>)
+</pre>
+
+This builds a Go library from a set of source files that are all part of
+ the same package.<br><br>
+ ***Note:*** For targets generated by Gazelle, `name` is typically the last component of the path,
+ or `go_default_library`, with the old naming convention.<br><br>
+ **Providers:**
+ <ul>
+ <li>[GoLibrary]</li>
+ <li>[GoSource]</li>
+ <li>[GoArchive]</li>
+ </ul>
+
+
+### **Attributes**
+
+
+| Name | Description | Type | Mandatory | Default |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="go_library-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="go_library-cdeps"></a>cdeps | List of other libraries that the c code depends on. This can be anything that would be allowed in [cc_library deps] Only valid if <code>cgo = True</code>. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_library-cgo"></a>cgo | If <code>True</code>, the package may contain [cgo] code, and <code>srcs</code> may contain C, C++, Objective-C, and Objective-C++ files and non-Go assembly files. When cgo is enabled, these files will be compiled with the C/C++ toolchain and included in the package. Note that this attribute does not force cgo to be enabled. Cgo is enabled for non-cross-compiling builds when a C/C++ toolchain is configured. | Boolean | optional | False |
+| <a id="go_library-clinkopts"></a>clinkopts | List of flags to add to the C link command. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. Only valid if <code>cgo = True</code>. | List of strings | optional | [] |
+| <a id="go_library-copts"></a>copts | List of flags to add to the C compilation command. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. Only valid if <code>cgo = True</code>. | List of strings | optional | [] |
+| <a id="go_library-cppopts"></a>cppopts | List of flags to add to the C/C++ preprocessor command. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. Only valid if <code>cgo = True</code>. | List of strings | optional | [] |
+| <a id="go_library-cxxopts"></a>cxxopts | List of flags to add to the C++ compilation command. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. Only valid if <code>cgo = True</code>. | List of strings | optional | [] |
+| <a id="go_library-data"></a>data | List of files needed by this rule at run-time. This may include data files needed or other programs that may be executed. The [bazel] package may be used to locate run files; they may appear in different places depending on the operating system and environment. See [data dependencies] for more information on data files. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_library-deps"></a>deps | List of Go libraries this package imports directly. These may be <code>go_library</code> rules or compatible rules with the [GoLibrary] provider. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_library-embed"></a>embed | List of Go libraries whose sources should be compiled together with this package's sources. Labels listed here must name <code>go_library</code>, <code>go_proto_library</code>, or other compatible targets with the [GoLibrary] and [GoSource] providers. Embedded libraries must have the same <code>importpath</code> as the embedding library. At most one embedded library may have <code>cgo = True</code>, and the embedding library may not also have <code>cgo = True</code>. See [Embedding] for more information. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_library-embedsrcs"></a>embedsrcs | The list of files that may be embedded into the compiled package using <code>//go:embed</code> directives. All files must be in the same logical directory or a subdirectory as source files. All source files containing <code>//go:embed</code> directives must be in the same logical directory. It's okay to mix static and generated source files and static and generated embeddable files. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_library-gc_goopts"></a>gc_goopts | List of flags to add to the Go compilation command when using the gc compiler. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. | List of strings | optional | [] |
+| <a id="go_library-importmap"></a>importmap | The actual import path of this library. By default, this is <code>importpath</code>. This is mostly only visible to the compiler and linker, but it may also be seen in stack traces. This must be unique among packages passed to the linker. It may be set to something different than <code>importpath</code> to prevent conflicts between multiple packages with the same path (for example, from different vendor directories). | String | optional | "" |
+| <a id="go_library-importpath"></a>importpath | The source import path of this library. Other libraries can import this library using this path. This must either be specified in <code>go_library</code> or inherited from one of the libraries in <code>embed</code>. | String | optional | "" |
+| <a id="go_library-importpath_aliases"></a>importpath_aliases | - | List of strings | optional | [] |
+| <a id="go_library-srcs"></a>srcs | The list of Go source files that are compiled to create the package. Only <code>.go</code> and <code>.s</code> files are permitted, unless the <code>cgo</code> attribute is set, in which case, <code>.c .cc .cpp .cxx .h .hh .hpp .hxx .inc .m .mm</code> files are also permitted. Files may be filtered at build time using Go [build constraints]. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_library-x_defs"></a>x_defs | Map of defines to add to the go link command. See [Defines and stamping] for examples of how to use these. | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | {} |
+
+
+
+
+
+<a id="#go_path"></a>
+
+## go_path
+
+<pre>
+go_path(<a href="#go_path-name">name</a>, <a href="#go_path-data">data</a>, <a href="#go_path-deps">deps</a>, <a href="#go_path-include_data">include_data</a>, <a href="#go_path-include_pkg">include_pkg</a>, <a href="#go_path-include_transitive">include_transitive</a>, <a href="#go_path-mode">mode</a>)
+</pre>
+
+`go_path` builds a directory structure that can be used with
+ tools that understand the GOPATH directory layout. This directory structure
+ can be built by zipping, copying, or linking files.
+ `go_path` can depend on one or more Go targets (i.e., [go_library], [go_binary], or [go_test]).
+ It will include packages from those targets, as well as their transitive dependencies.
+ Packages will be in subdirectories named after their `importpath` or `importmap` attributes under a `src/` directory.
+
+
+### **Attributes**
+
+
+| Name | Description | Type | Mandatory | Default |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="go_path-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="go_path-data"></a>data | A list of targets producing data files that will be stored next to the <code>src/</code> directory. Useful for including things like licenses and readmes. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_path-deps"></a>deps | A list of targets that build Go packages. A directory will be generated from files in these targets and their transitive dependencies. All targets must provide [GoArchive] ([go_library], [go_binary], [go_test], and similar rules have this).<br><br> Only targets with explicit <code>importpath</code> attributes will be included in the generated directory. Synthetic packages (like the main package produced by [go_test]) and packages with inferred import paths will not be included. The values of <code>importmap</code> attributes may influence the placement of packages within the generated directory (for example, in vendor directories).<br><br> The generated directory will contain original source files, including .go, .s, .h, and .c files compiled by cgo. It will not contain files generated by tools like cover and cgo, but it will contain generated files passed in <code>srcs</code> attributes like .pb.go files. The generated directory will also contain runfiles found in <code>data</code> attributes. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_path-include_data"></a>include_data | When true, data files referenced by libraries, binaries, and tests will be included in the output directory. Files listed in the <code>data</code> attribute for this rule will be included regardless of this attribute. | Boolean | optional | True |
+| <a id="go_path-include_pkg"></a>include_pkg | When true, a <code>pkg</code> subdirectory containing the compiled libraries will be created in the generated <code>GOPATH</code> containing compiled libraries. | Boolean | optional | False |
+| <a id="go_path-include_transitive"></a>include_transitive | When true, the transitive dependency graph will be included in the generated <code>GOPATH</code>. This is the default behaviour. When false, only the direct dependencies will be included in the generated <code>GOPATH</code>. | Boolean | optional | True |
+| <a id="go_path-mode"></a>mode | Determines how the generated directory is provided. May be one of: <ul> <li><code>"archive"</code>: The generated directory is packaged as a single .zip file.</li> <li><code>"copy"</code>: The generated directory is a single tree artifact. Source files are copied into the tree.</li> <li><code>"link"</code>: <b>Unmaintained due to correctness issues</b>. Source files are symlinked into the tree. All of the symlink files are provided as separate output files.</li> </ul> ***Note:*** In <code>"copy"</code> mode, when a <code>GoPath</code> is consumed as a set of input files or run files, Bazel may provide symbolic links instead of regular files. Any program that consumes these files should dereference links, e.g., if you run <code>tar</code>, use the <code>--dereference</code> flag. | String | optional | "copy" |
+
+
+
+
+
+<a id="#go_source"></a>
+
+## go_source
+
+<pre>
+go_source(<a href="#go_source-name">name</a>, <a href="#go_source-data">data</a>, <a href="#go_source-deps">deps</a>, <a href="#go_source-embed">embed</a>, <a href="#go_source-gc_goopts">gc_goopts</a>, <a href="#go_source-srcs">srcs</a>)
+</pre>
+
+This declares a set of source files and related dependencies that can be embedded into one of the
+ other rules.
+ This is used as a way of easily declaring a common set of sources re-used in multiple rules.<br><br>
+ **Providers:**
+ <ul>
+ <li>[GoLibrary]</li>
+ <li>[GoSource]</li>
+ </ul>
+
+
+### **Attributes**
+
+
+| Name | Description | Type | Mandatory | Default |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="go_source-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="go_source-data"></a>data | List of files needed by this rule at run-time. This may include data files needed or other programs that may be executed. The [bazel] package may be used to locate run files; they may appear in different places depending on the operating system and environment. See [data dependencies] for more information on data files. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_source-deps"></a>deps | List of Go libraries this source list imports directly. These may be go_library rules or compatible rules with the [GoLibrary] provider. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_source-embed"></a>embed | List of Go libraries whose sources should be compiled together with this package's sources. Labels listed here must name <code>go_library</code>, <code>go_proto_library</code>, or other compatible targets with the [GoLibrary] and [GoSource] providers. Embedded libraries must have the same <code>importpath</code> as the embedding library. At most one embedded library may have <code>cgo = True</code>, and the embedding library may not also have <code>cgo = True</code>. See [Embedding] for more information. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_source-gc_goopts"></a>gc_goopts | List of flags to add to the Go compilation command when using the gc compiler. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. | List of strings | optional | [] |
+| <a id="go_source-srcs"></a>srcs | The list of Go source files that are compiled to create the package. The following file types are permitted: <code>.go, .c, .s, .S .h</code>. The files may contain Go-style [build constraints]. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+
+
+
+
+
+<a id="#go_test"></a>
+
+## go_test
+
+<pre>
+go_test(<a href="#go_test-name">name</a>, <a href="#go_test-cdeps">cdeps</a>, <a href="#go_test-cgo">cgo</a>, <a href="#go_test-clinkopts">clinkopts</a>, <a href="#go_test-copts">copts</a>, <a href="#go_test-cppopts">cppopts</a>, <a href="#go_test-cxxopts">cxxopts</a>, <a href="#go_test-data">data</a>, <a href="#go_test-deps">deps</a>, <a href="#go_test-embed">embed</a>, <a href="#go_test-embedsrcs">embedsrcs</a>, <a href="#go_test-env">env</a>,
+ <a href="#go_test-env_inherit">env_inherit</a>, <a href="#go_test-gc_goopts">gc_goopts</a>, <a href="#go_test-gc_linkopts">gc_linkopts</a>, <a href="#go_test-goarch">goarch</a>, <a href="#go_test-goos">goos</a>, <a href="#go_test-gotags">gotags</a>, <a href="#go_test-importpath">importpath</a>, <a href="#go_test-linkmode">linkmode</a>, <a href="#go_test-msan">msan</a>, <a href="#go_test-pure">pure</a>,
+ <a href="#go_test-race">race</a>, <a href="#go_test-rundir">rundir</a>, <a href="#go_test-srcs">srcs</a>, <a href="#go_test-static">static</a>, <a href="#go_test-x_defs">x_defs</a>)
+</pre>
+
+This builds a set of tests that can be run with `bazel test`.<br><br>
+ To run all tests in the workspace, and print output on failure (the
+ equivalent of `go test ./...`), run<br>
+ ```
+ bazel test --test_output=errors //...
+ ```<br><br>
+ To run a Go benchmark test, run<br>
+ ```
+ bazel run //path/to:test -- -test.bench=.
+ ```<br><br>
+ You can run specific tests by passing the `--test_filter=pattern
+ <test_filter_>` argument to Bazel. You can pass arguments to tests by passing
+ `--test_arg=arg <test_arg_>` arguments to Bazel, and you can set environment
+ variables in the test environment by passing
+ `--test_env=VAR=value <test_env_>`. You can terminate test execution after the first
+ failure by passing the `--test_runner_fast_fast <test_runner_fail_fast_>` argument
+ to Bazel. This is equivalent to passing `--test_arg=-failfast <test_arg_>`.<br><br>
+ To write structured testlog information to Bazel's `XML_OUTPUT_FILE`, tests
+ ran with `bazel test` execute using a wrapper. This functionality can be
+ disabled by setting `GO_TEST_WRAP=0` in the test environment. Additionally,
+ the testbinary can be invoked with `-test.v` by setting
+ `GO_TEST_WRAP_TESTV=1` in the test environment; this will result in the
+ `XML_OUTPUT_FILE` containing more granular data.<br><br>
+ ***Note:*** To interoperate cleanly with old targets generated by [Gazelle], `name`
+ should be `go_default_test` for internal tests and
+ `go_default_xtest` for external tests. Gazelle now generates
+ the name based on the last component of the path. For example, a test
+ in `//foo/bar` is named `bar_test`, and uses internal and external
+ sources.
+
+
+### **Attributes**
+
+
+| Name | Description | Type | Mandatory | Default |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="go_test-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="go_test-cdeps"></a>cdeps | The list of other libraries that the c code depends on. This can be anything that would be allowed in [cc_library deps] Only valid if <code>cgo</code> = <code>True</code>. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_test-cgo"></a>cgo | If <code>True</code>, the package may contain [cgo] code, and <code>srcs</code> may contain C, C++, Objective-C, and Objective-C++ files and non-Go assembly files. When cgo is enabled, these files will be compiled with the C/C++ toolchain and included in the package. Note that this attribute does not force cgo to be enabled. Cgo is enabled for non-cross-compiling builds when a C/C++ toolchain is configured. | Boolean | optional | False |
+| <a id="go_test-clinkopts"></a>clinkopts | List of flags to add to the C link command. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. Only valid if <code>cgo</code> = <code>True</code>. | List of strings | optional | [] |
+| <a id="go_test-copts"></a>copts | List of flags to add to the C compilation command. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. Only valid if <code>cgo</code> = <code>True</code>. | List of strings | optional | [] |
+| <a id="go_test-cppopts"></a>cppopts | List of flags to add to the C/C++ preprocessor command. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. Only valid if <code>cgo</code> = <code>True</code>. | List of strings | optional | [] |
+| <a id="go_test-cxxopts"></a>cxxopts | List of flags to add to the C++ compilation command. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. Only valid if <code>cgo</code> = <code>True</code>. | List of strings | optional | [] |
+| <a id="go_test-data"></a>data | List of files needed by this rule at run-time. This may include data files needed or other programs that may be executed. The [bazel] package may be used to locate run files; they may appear in different places depending on the operating system and environment. See [data dependencies] for more information on data files. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_test-deps"></a>deps | List of Go libraries this test imports directly. These may be go_library rules or compatible rules with the [GoLibrary] provider. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_test-embed"></a>embed | List of Go libraries whose sources should be compiled together with this package's sources. Labels listed here must name <code>go_library</code>, <code>go_proto_library</code>, or other compatible targets with the [GoLibrary] and [GoSource] providers. Embedded libraries must have the same <code>importpath</code> as the embedding library. At most one embedded library may have <code>cgo = True</code>, and the embedding library may not also have <code>cgo = True</code>. See [Embedding] for more information. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_test-embedsrcs"></a>embedsrcs | The list of files that may be embedded into the compiled package using <code>//go:embed</code> directives. All files must be in the same logical directory or a subdirectory as source files. All source files containing <code>//go:embed</code> directives must be in the same logical directory. It's okay to mix static and generated source files and static and generated embeddable files. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_test-env"></a>env | Environment variables to set for the test execution. The values (but not keys) are subject to [location expansion](https://docs.bazel.build/versions/main/skylark/macros.html) but not full [make variable expansion](https://docs.bazel.build/versions/main/be/make-variables.html). | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | {} |
+| <a id="go_test-env_inherit"></a>env_inherit | Environment variables to inherit from the external environment. | List of strings | optional | [] |
+| <a id="go_test-gc_goopts"></a>gc_goopts | List of flags to add to the Go compilation command when using the gc compiler. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. | List of strings | optional | [] |
+| <a id="go_test-gc_linkopts"></a>gc_linkopts | List of flags to add to the Go link command when using the gc compiler. Subject to ["Make variable"] substitution and [Bourne shell tokenization]. | List of strings | optional | [] |
+| <a id="go_test-goarch"></a>goarch | Forces a binary to be cross-compiled for a specific architecture. It's usually better to control this on the command line with <code>--platforms</code>.<br><br> This disables cgo by default, since a cross-compiling C/C++ toolchain is rarely available. To force cgo, set <code>pure</code> = <code>off</code>.<br><br> See [Cross compilation] for more information. | String | optional | "auto" |
+| <a id="go_test-goos"></a>goos | Forces a binary to be cross-compiled for a specific operating system. It's usually better to control this on the command line with <code>--platforms</code>.<br><br> This disables cgo by default, since a cross-compiling C/C++ toolchain is rarely available. To force cgo, set <code>pure</code> = <code>off</code>.<br><br> See [Cross compilation] for more information. | String | optional | "auto" |
+| <a id="go_test-gotags"></a>gotags | Enables a list of build tags when evaluating [build constraints]. Useful for conditional compilation. | List of strings | optional | [] |
+| <a id="go_test-importpath"></a>importpath | The import path of this test. Tests can't actually be imported, but this may be used by [go_path] and other tools to report the location of source files. This may be inferred from embedded libraries. | String | optional | "" |
+| <a id="go_test-linkmode"></a>linkmode | Determines how the binary should be built and linked. This accepts some of the same values as `go build -buildmode` and works the same way. <br><br> <ul> <li>`normal`: Builds a normal executable with position-dependent code.</li> <li>`pie`: Builds a position-independent executable.</li> <li>`plugin`: Builds a shared library that can be loaded as a Go plugin. Only supported on platforms that support plugins.</li> <li>`c-shared`: Builds a shared library that can be linked into a C program.</li> <li>`c-archive`: Builds an archive that can be linked into a C program.</li> </ul> | String | optional | "normal" |
+| <a id="go_test-msan"></a>msan | Controls whether code is instrumented for memory sanitization. May be one of <code>on</code>, <code>off</code>, or <code>auto</code>. Not available when cgo is disabled. In most cases, it's better to control this on the command line with <code>--@io_bazel_rules_go//go/config:msan</code>. See [mode attributes], specifically [msan]. | String | optional | "auto" |
+| <a id="go_test-pure"></a>pure | Controls whether cgo source code and dependencies are compiled and linked, similar to setting <code>CGO_ENABLED</code>. May be one of <code>on</code>, <code>off</code>, or <code>auto</code>. If <code>auto</code>, pure mode is enabled when no C/C++ toolchain is configured or when cross-compiling. It's usually better to control this on the command line with <code>--@io_bazel_rules_go//go/config:pure</code>. See [mode attributes], specifically [pure]. | String | optional | "auto" |
+| <a id="go_test-race"></a>race | Controls whether code is instrumented for race detection. May be one of <code>on</code>, <code>off</code>, or <code>auto</code>. Not available when cgo is disabled. In most cases, it's better to control this on the command line with <code>--@io_bazel_rules_go//go/config:race</code>. See [mode attributes], specifically [race]. | String | optional | "auto" |
+| <a id="go_test-rundir"></a>rundir | A directory to cd to before the test is run. This should be a path relative to the root directory of the repository in which the test is defined, which can be the main or an external repository.<br><br> The default behaviour is to change to the relative path corresponding to the test's package, which replicates the normal behaviour of <code>go test</code> so it is easy to write compatible tests.<br><br> Setting it to <code>.</code> makes the test behave the normal way for a bazel test, except that the working directory is always that of the test's repository, which is not necessarily the main repository.<br><br> Note: If runfile symlinks are disabled (such as on Windows by default), the test will run in the working directory set by Bazel, which is the subdirectory of the runfiles directory corresponding to the main repository. | String | optional | "" |
+| <a id="go_test-srcs"></a>srcs | The list of Go source files that are compiled to create the package. Only <code>.go</code> and <code>.s</code> files are permitted, unless the <code>cgo</code> attribute is set, in which case, <code>.c .cc .cpp .cxx .h .hh .hpp .hxx .inc .m .mm</code> files are also permitted. Files may be filtered at build time using Go [build constraints]. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_test-static"></a>static | Controls whether a binary is statically linked. May be one of <code>on</code>, <code>off</code>, or <code>auto</code>. Not available on all platforms or in all modes. It's usually better to control this on the command line with <code>--@io_bazel_rules_go//go/config:static</code>. See [mode attributes], specifically [static]. | String | optional | "auto" |
+| <a id="go_test-x_defs"></a>x_defs | Map of defines to add to the go link command. See [Defines and stamping] for examples of how to use these. | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | {} |
+
+
diff --git a/docs/go/editors/vim.md b/docs/go/editors/vim.md
new file mode 100644
index 00000000..e791d66f
--- /dev/null
+++ b/docs/go/editors/vim.md
@@ -0,0 +1,66 @@
+# Vim + `rules_go`
+
+`rules_go` has support for integration with text editors, see [Editor and tool
+integration](https://github.com/bazelbuild/rules_go/wiki/Editor-and-tool-integration).
+This document describes integration with Vim, which will provide semantic
+autocompletion for Bazel-generated Go files, among other things.
+
+## Setup
+
+1. Install [vim-go](https://github.com/fatih/vim-go), a Vim plugin for Go
+ development with support for `gopls`.
+
+2. Follow the instructions from [Editor
+ setup](https://github.com/bazelbuild/rules_go/wiki/Editor-setup#3-editor-setup)
+ for installing `gopls` and adding a launcher script.
+ * Note that `gopls` should already be installed as part of installing `vim-go`.
+
+3. Add the following to your `.vimrc`:
+
+ ```vim
+ function! MaybeSetGoPackagesDriver()
+ " Start at the current directory and see if there's a WORKSPACE file in the
+ " current directory or any parent. If we find one, check if there's a
+ " gopackagesdriver.sh in a tools/ directory, and point our
+ " GOPACKAGESDRIVER env var at it.
+ let l:dir = getcwd()
+ while l:dir != "/"
+ if filereadable(simplify(join([l:dir, 'WORKSPACE'], '/')))
+ let l:maybe_driver_path = simplify(join([l:dir, 'tools/gopackagesdriver.sh'], '/'))
+ if filereadable(l:maybe_driver_path)
+ let $GOPACKAGESDRIVER = l:maybe_driver_path
+ break
+ end
+ end
+ let l:dir = fnamemodify(l:dir, ':h')
+ endwhile
+ endfunction
+
+ call MaybeSetGoPackagesDriver()
+
+ " See https://github.com/golang/tools/blob/master/gopls/doc/settings.md
+ let g:go_gopls_settings = {
+ \ 'build.directoryFilters': [
+ \ '-bazel-bin',
+ \ '-bazel-out',
+ \ '-bazel-testlogs',
+ \ '-bazel-mypkg',
+ \ ],
+ \ 'ui.completion.usePlaceholders': v:true,
+ \ 'ui.semanticTokens': v:true,
+ \ 'ui.codelenses': {
+ \ 'gc_details': v:false,
+ \ 'regenerate_cgo': v:false,
+ \ 'generate': v:false,
+ \ 'test': v:false,
+ \ 'tidy': v:false,
+ \ 'upgrade_dependency': v:false,
+ \ 'vendor': v:false,
+ \ },
+ \ }
+ ```
+
+ * You'll want to replace `-bazel-mypkg` with your package.
+ * If you've put your `gopackagesdriver.sh` script somewhere other than
+ `tools/gopackagesdriver.sh`, you'll need to update
+ `MaybeSetGoPackagesDriver` accordingly.
diff --git a/docs/go/extras/BUILD.bazel b/docs/go/extras/BUILD.bazel
new file mode 100644
index 00000000..3a7d8c05
--- /dev/null
+++ b/docs/go/extras/BUILD.bazel
@@ -0,0 +1,16 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+
+exports_files([
+ "extras.md",
+ "extras.bzl",
+])
+
+bzl_library(
+ name = "extras",
+ srcs = ["extras.bzl"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "//extras:embed_data",
+ "//extras:gomock",
+ ],
+)
diff --git a/docs/go/extras/extras.bzl b/docs/go/extras/extras.bzl
new file mode 100644
index 00000000..e58395ae
--- /dev/null
+++ b/docs/go/extras/extras.bzl
@@ -0,0 +1,35 @@
+"""
+ [gazelle rule]: https://github.com/bazelbuild/bazel-gazelle#bazel-rule
+ [golang/mock]: https://github.com/golang/mock
+ [core go rules]: /docs/go/core/rules.md
+
+# Extra rules
+
+This is a collection of helper rules. These are not core to building a go binary, but are supplied
+to make life a little easier.
+
+## Contents
+- [gazelle](#gazelle)
+- [gomock](#gomock)
+- [go_embed_data](#go_embed_data)
+
+## Additional resources
+- [gazelle rule]
+- [golang/mock]
+- [core go rules]
+
+------------------------------------------------------------------------
+
+gazelle
+-------
+
+This rule has moved. See [gazelle rule] in the Gazelle repository.
+
+"""
+
+load("//extras:gomock.bzl", _gomock = "gomock")
+load("//extras:embed_data.bzl", _go_embed_data = "go_embed_data")
+
+gomock = _gomock
+
+go_embed_data = _go_embed_data
diff --git a/docs/go/extras/extras.md b/docs/go/extras/extras.md
new file mode 100644
index 00000000..e3697f8f
--- /dev/null
+++ b/docs/go/extras/extras.md
@@ -0,0 +1,109 @@
+<!-- Generated with Stardoc: http://skydoc.bazel.build -->
+
+
+ [gazelle rule]: https://github.com/bazelbuild/bazel-gazelle#bazel-rule
+ [golang/mock]: https://github.com/golang/mock
+ [core go rules]: /docs/go/core/rules.md
+
+# Extra rules
+
+This is a collection of helper rules. These are not core to building a go binary, but are supplied
+to make life a little easier.
+
+## Contents
+- [gazelle](#gazelle)
+- [gomock](#gomock)
+- [go_embed_data](#go_embed_data)
+
+## Additional resources
+- [gazelle rule]
+- [golang/mock]
+- [core go rules]
+
+------------------------------------------------------------------------
+
+gazelle
+-------
+
+This rule has moved. See [gazelle rule] in the Gazelle repository.
+
+
+
+
+
+
+<a id="#go_embed_data"></a>
+
+## go_embed_data
+
+<pre>
+go_embed_data(<a href="#go_embed_data-name">name</a>, <a href="#go_embed_data-flatten">flatten</a>, <a href="#go_embed_data-package">package</a>, <a href="#go_embed_data-src">src</a>, <a href="#go_embed_data-srcs">srcs</a>, <a href="#go_embed_data-string">string</a>, <a href="#go_embed_data-unpack">unpack</a>, <a href="#go_embed_data-var">var</a>)
+</pre>
+
+**Deprecated**: Will be removed in rules_go 0.39.
+
+`go_embed_data` generates a .go file that contains data from a file or a
+list of files. It should be consumed in the srcs list of one of the
+[core go rules].
+
+Before using `go_embed_data`, you must add the following snippet to your
+WORKSPACE:
+
+``` bzl
+load("@io_bazel_rules_go//extras:embed_data_deps.bzl", "go_embed_data_dependencies")
+
+go_embed_data_dependencies()
+```
+
+`go_embed_data` accepts the attributes listed below.
+
+
+### **Attributes**
+
+
+| Name | Description | Type | Mandatory | Default |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+| <a id="go_embed_data-name"></a>name | A unique name for this target. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
+| <a id="go_embed_data-flatten"></a>flatten | If <code>True</code> and <code>srcs</code> is used, map keys are file base names instead of relative paths. | Boolean | optional | False |
+| <a id="go_embed_data-package"></a>package | Go package name for the generated .go file. | String | optional | "" |
+| <a id="go_embed_data-src"></a>src | A single file to embed. This cannot be used at the same time as <code>srcs</code>. The generated file will have a variable of type <code>[]byte</code> or <code>string</code> with the contents of this file. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | None |
+| <a id="go_embed_data-srcs"></a>srcs | A list of files to embed. This cannot be used at the same time as <code>src</code>. The generated file will have a variable of type <code>map[string][]byte</code> or <code>map[string]string</code> with the contents of each file. The map keys are relative paths of the files from the repository root. Keys for files in external repositories will be prefixed with <code>"external/repo/"</code> where "repo" is the name of the external repository. | <a href="https://bazel.build/concepts/labels">List of labels</a> | optional | [] |
+| <a id="go_embed_data-string"></a>string | If <code>True</code>, the embedded data will be stored as <code>string</code> instead of <code>[]byte</code>. | Boolean | optional | False |
+| <a id="go_embed_data-unpack"></a>unpack | If <code>True</code>, sources are treated as archives and their contents will be stored. Supported formats are <code>.zip</code> and <code>.tar</code> | Boolean | optional | False |
+| <a id="go_embed_data-var"></a>var | Name of the variable that will contain the embedded data. | String | optional | "Data" |
+
+
+<a id="gomock"></a>
+
+## gomock
+
+<pre>
+gomock(<a href="#gomock-name">name</a>, <a href="#gomock-library">library</a>, <a href="#gomock-out">out</a>, <a href="#gomock-source">source</a>, <a href="#gomock-interfaces">interfaces</a>, <a href="#gomock-package">package</a>, <a href="#gomock-self_package">self_package</a>, <a href="#gomock-aux_files">aux_files</a>, <a href="#gomock-mockgen_tool">mockgen_tool</a>,
+ <a href="#gomock-imports">imports</a>, <a href="#gomock-copyright_file">copyright_file</a>, <a href="#gomock-mock_names">mock_names</a>, <a href="#gomock-kwargs">kwargs</a>)
+</pre>
+
+Calls [mockgen](https://github.com/golang/mock) to generates a Go file containing mocks from the given library.
+
+If `source` is given, the mocks are generated in source mode; otherwise in reflective mode.
+
+
+**PARAMETERS**
+
+
+| Name | Description | Default Value |
+| :------------- | :------------- | :------------- |
+| <a id="gomock-name"></a>name | the target name. | none |
+| <a id="gomock-library"></a>library | the Go library to took for the interfaces (reflecitve mode) or source (source mode). | none |
+| <a id="gomock-out"></a>out | the output Go file name. | none |
+| <a id="gomock-source"></a>source | a Go file in the given <code>library</code>. If this is given, <code>gomock</code> will call mockgen in source mode to mock all interfaces in the file. | <code>None</code> |
+| <a id="gomock-interfaces"></a>interfaces | a list of interfaces in the given <code>library</code> to be mocked in reflective mode. | <code>[]</code> |
+| <a id="gomock-package"></a>package | the name of the package the generated mocks should be in. If not specified, uses mockgen's default. See [mockgen's -package](https://github.com/golang/mock#flags) for more information. | <code>""</code> |
+| <a id="gomock-self_package"></a>self_package | the full package import path for the generated code. The purpose of this flag is to prevent import cycles in the generated code by trying to include its own package. See [mockgen's -self_package](https://github.com/golang/mock#flags) for more information. | <code>""</code> |
+| <a id="gomock-aux_files"></a>aux_files | a map from source files to their package path. This only needed when <code>source</code> is provided. See [mockgen's -aux_files](https://github.com/golang/mock#flags) for more information. | <code>{}</code> |
+| <a id="gomock-mockgen_tool"></a>mockgen_tool | the mockgen tool to run. | <code>Label("//extras/gomock:mockgen")</code> |
+| <a id="gomock-imports"></a>imports | dictionary of name-path pairs of explicit imports to use. See [mockgen's -imports](https://github.com/golang/mock#flags) for more information. | <code>{}</code> |
+| <a id="gomock-copyright_file"></a>copyright_file | optional file containing copyright to prepend to the generated contents. See [mockgen's -copyright_file](https://github.com/golang/mock#flags) for more information. | <code>None</code> |
+| <a id="gomock-mock_names"></a>mock_names | dictionary of interface name to mock name pairs to change the output names of the mock objects. Mock names default to 'Mock' prepended to the name of the interface. See [mockgen's -mock_names](https://github.com/golang/mock#flags) for more information. | <code>{}</code> |
+| <a id="gomock-kwargs"></a>kwargs | <p align="center"> - </p> | none |
+
+
diff --git a/docs/rule_body.vm b/docs/rule_body.vm
new file mode 100644
index 00000000..8a88920b
--- /dev/null
+++ b/docs/rule_body.vm
@@ -0,0 +1,37 @@
+#**
+This template is used for including rule definitions as top-level sections in generated stardoc docstrings.
+*#
+#*
+Workaround for markdownCellFormat() not allowing HTML (specifically lists) to be rendered in attribute table cells.
+
+TODO: Once https://github.com/bazelbuild/bazel/pull/14230 is merged, remove this macro and replace with call to
+ util.markdownCellFormatWithHtml($attribute.docString, true)
+*#
+#macro( markdownCellFormatNoEscapeHtml $docString )#*
+ *##if ($docString.contains("<ul>"))#*
+ *#${docString.trim().replaceAll("\n(\\s*\n)+", "<br><br>").replaceAll("\n", " ")}#*
+ *##else#*
+ *#${util.markdownCellFormat($docString)}#*
+ *##end#*
+*##end
+
+<a id="#${ruleName}"></a>
+
+#[[##]]# ${ruleName}
+
+<pre>
+${util.ruleSummary($ruleName, $ruleInfo)}
+</pre>
+
+${ruleInfo.docString}
+
+#[[###]]# **Attributes**
+
+#if (!$ruleInfo.getAttributeList().isEmpty())
+
+| Name | Description | Type | Mandatory | Default |
+| :------------- | :------------- | :------------- | :------------- | :------------- |
+#foreach ($attribute in $ruleInfo.getAttributeList())
+| <a id="${ruleName}-${attribute.name}"></a>$attribute.name | #if(!$attribute.docString.isEmpty()) #markdownCellFormatNoEscapeHtml( $attribute.docString ) #else - #end | ${util.attributeTypeString($attribute)} | ${util.mandatoryString($attribute)} | $attribute.defaultValue |
+#end
+#end
diff --git a/examples/basic-gazelle/.bazelrc b/examples/basic-gazelle/.bazelrc
new file mode 100644
index 00000000..eaa91b9e
--- /dev/null
+++ b/examples/basic-gazelle/.bazelrc
@@ -0,0 +1 @@
+import %workspace%/../../.bazelrc
diff --git a/examples/basic-gazelle/.gitignore b/examples/basic-gazelle/.gitignore
new file mode 100644
index 00000000..a4aa06cc
--- /dev/null
+++ b/examples/basic-gazelle/.gitignore
@@ -0,0 +1,5 @@
+# We added this file as part of the tutorial
+/bazel-basic-gazelle
+/bazel-bin
+/bazel-out
+/bazel-testlogs
diff --git a/examples/basic-gazelle/BUILD.bazel b/examples/basic-gazelle/BUILD.bazel
new file mode 100644
index 00000000..0caa7062
--- /dev/null
+++ b/examples/basic-gazelle/BUILD.bazel
@@ -0,0 +1,33 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+load("@bazel_gazelle//:def.bzl", "gazelle")
+
+# gazelle:prefix github.com/bazelbuild/rules_go/examples/basic-gazelle
+gazelle(name = "gazelle")
+
+# adding rule to update deps
+gazelle(
+ name = "gazelle-update-repos",
+ args = [
+ "-from_file=go.mod",
+ "-to_macro=deps.bzl%go_dependencies",
+ "-prune",
+ ],
+ command = "update-repos",
+)
+
+go_library(
+ name = "basic-gazelle_lib",
+ srcs = ["main.go"],
+ importpath = "github.com/bazelbuild/rules_go/examples/basic-gazelle",
+ visibility = ["//visibility:private"],
+ deps = [
+ "//cmd",
+ "@io_k8s_klog_v2//:klog",
+ ],
+)
+
+go_binary(
+ name = "basic-gazelle",
+ embed = [":basic-gazelle_lib"],
+ visibility = ["//visibility:public"],
+)
diff --git a/examples/basic-gazelle/CONTRIBUTING.md b/examples/basic-gazelle/CONTRIBUTING.md
new file mode 100644
index 00000000..70c22d7a
--- /dev/null
+++ b/examples/basic-gazelle/CONTRIBUTING.md
@@ -0,0 +1,9 @@
+# Go Rules Tutorial
+
+## Updates
+
+Please update both the source code here and the tutorial that is on the gh-pages branch here:
+https://github.com/bazel-contrib/SIG-rules-authors/tree/gh-pages.
+
+Updates to this tutorial require two PRs, as there are code block in the gh-pages tutorial mentioned
+above.
diff --git a/examples/basic-gazelle/README.md b/examples/basic-gazelle/README.md
new file mode 100644
index 00000000..cd7fc54f
--- /dev/null
+++ b/examples/basic-gazelle/README.md
@@ -0,0 +1,4 @@
+# Go Rules Tutorial
+
+This is the source code for the Go Rules tutorial that is available here:
+https://bazel-contrib.github.io/SIG-rules-authors/go-tutorial.html
diff --git a/examples/basic-gazelle/WORKSPACE b/examples/basic-gazelle/WORKSPACE
new file mode 100644
index 00000000..7a7104c6
--- /dev/null
+++ b/examples/basic-gazelle/WORKSPACE
@@ -0,0 +1,65 @@
+# Load the http ruleset and expose the http_archive rule
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+# Download rules_go ruleset.
+# Bazel makes a https call and downloads the zip file, and then
+# checks the sha.
+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",
+ ],
+)
+
+# Download the bazel_gazelle ruleset.
+http_archive(
+ name = "bazel_gazelle",
+ sha256 = "727f3e4edd96ea20c29e8c2ca9e8d2af724d8c7778e7923a854b2c80952bc405",
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
+ "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.30.0/bazel-gazelle-v0.30.0.tar.gz",
+ ],
+)
+
+# Load rules_go ruleset and expose the toolchain and dep rules.
+load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
+
+# the line below instructs gazelle to save the go dependency definitions
+# in the deps.bzl file. Located under '//'.
+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".
+############################################################
+
+# The following line defines the symbol go_dependencies from the deps.bzl file.
+# Having the deps in that file, helps the WORKSPACE file stay less
+# cluttered. The library symbol go_dependencies is then added to
+# the envionment. The line below calls that function.
+load("//:deps.bzl", "go_dependencies")
+
+# The next comment line includes a macro that gazelle reads.
+# This macro tells Gazelle to look for repository rules in a macro in a .bzl file,
+# and allows Gazelle to find the correct file to maintain the Go dependencies.
+# Then the line after the comment calls go_dependencies(), and that funcation
+# contains calls to various go_repository rules.
+
+# gazelle:repository_macro deps.bzl%go_dependencies
+go_dependencies()
+
+# go_rules_dependencies is a function that registers external dependencies
+# needed by the Go rules.
+# https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#go_rules_dependencies
+go_rules_dependencies()
+
+# The next rule installs the Go toolchains. The Go version is specified
+# using the version parameter. This rule will download the Go SDK.
+# https://github.com/bazelbuild/rules_go/blob/master/go/toolchains.rst#go_register_toolchains
+go_register_toolchains(version = "1.20.2")
+
+# The following call configured the gazelle dependencies, Go environment and Go SDK.
+gazelle_dependencies()
diff --git a/examples/basic-gazelle/cmd/BUILD.bazel b/examples/basic-gazelle/cmd/BUILD.bazel
new file mode 100644
index 00000000..6d6f5608
--- /dev/null
+++ b/examples/basic-gazelle/cmd/BUILD.bazel
@@ -0,0 +1,16 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "cmd",
+ srcs = [
+ "roll.go",
+ "root.go",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/examples/basic-gazelle/cmd",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//pkg/roll",
+ "@com_github_spf13_cobra//:cobra",
+ "@io_k8s_klog_v2//:klog",
+ ],
+)
diff --git a/examples/basic-gazelle/cmd/roll.go b/examples/basic-gazelle/cmd/roll.go
new file mode 100644
index 00000000..c7ffdb93
--- /dev/null
+++ b/examples/basic-gazelle/cmd/roll.go
@@ -0,0 +1,44 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package cmd
+
+import (
+ "fmt"
+
+ "github.com/bazelbuild/rules_go/examples/basic-gazelle/pkg/roll"
+ "github.com/spf13/cobra"
+ "k8s.io/klog/v2"
+)
+
+// rollCmd represents the roll command
+var rollCmd = &cobra.Command{
+ Use: "roll",
+ Short: "A brief description of your command",
+ Long: `A longer description that spans multiple lines and likely contains examples
+and usage of using your command. For example:
+
+Cobra is a CLI library for Go that empowers applications.
+This application is a tool to generate the needed files
+to quickly create a Cobra application.`,
+ Run: func(cmd *cobra.Command, args []string) {
+ klog.Info("calling roll")
+ fmt.Printf("Number rolled: %s\n", roll.Roll())
+ },
+}
+
+func init() {
+ rootCmd.AddCommand(rollCmd)
+
+}
diff --git a/examples/basic-gazelle/cmd/root.go b/examples/basic-gazelle/cmd/root.go
new file mode 100644
index 00000000..569ce777
--- /dev/null
+++ b/examples/basic-gazelle/cmd/root.go
@@ -0,0 +1,49 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package cmd
+
+import (
+ "os"
+
+ "github.com/spf13/cobra"
+)
+
+// rootCmd represents the base command when called without any subcommands
+var rootCmd = &cobra.Command{
+ Use: "go-code-tutorial",
+ Short: "A brief description of your application",
+ Long: `A longer description that spans multiple lines and likely contains
+examples and usage of using your application. For example:
+
+Cobra is a CLI library for Go that empowers applications.
+This application is a tool to generate the needed files
+to quickly create a Cobra application.`,
+ // Uncomment the following line if your bare application
+ // has an action associated with it:
+ // Run: func(cmd *cobra.Command, args []string) { },
+}
+
+// Execute adds all child commands to the root command and sets flags appropriately.
+// This is called by main.main(). It only needs to happen once to the rootCmd.
+func Execute() {
+ err := rootCmd.Execute()
+ if err != nil {
+ os.Exit(1)
+ }
+}
+
+func init() {
+ rootCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
+}
diff --git a/examples/basic-gazelle/deps.bzl b/examples/basic-gazelle/deps.bzl
new file mode 100644
index 00000000..06566454
--- /dev/null
+++ b/examples/basic-gazelle/deps.bzl
@@ -0,0 +1,61 @@
+load("@bazel_gazelle//:deps.bzl", "go_repository")
+
+def go_dependencies():
+ go_repository(
+ name = "com_github_cpuguy83_go_md2man_v2",
+ importpath = "github.com/cpuguy83/go-md2man/v2",
+ sum = "h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w=",
+ version = "v2.0.2",
+ )
+ go_repository(
+ name = "com_github_go_logr_logr",
+ importpath = "github.com/go-logr/logr",
+ sum = "h1:QK40JKJyMdUDz+h+xvCsru/bJhvG0UxvePV0ufL/AcE=",
+ version = "v1.2.0",
+ )
+
+ go_repository(
+ name = "com_github_inconshreveable_mousetrap",
+ importpath = "github.com/inconshreveable/mousetrap",
+ sum = "h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=",
+ version = "v1.0.0",
+ )
+
+ go_repository(
+ name = "com_github_russross_blackfriday_v2",
+ importpath = "github.com/russross/blackfriday/v2",
+ sum = "h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=",
+ version = "v2.1.0",
+ )
+ go_repository(
+ name = "com_github_spf13_cobra",
+ importpath = "github.com/spf13/cobra",
+ sum = "h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=",
+ version = "v1.5.0",
+ )
+ go_repository(
+ name = "com_github_spf13_pflag",
+ importpath = "github.com/spf13/pflag",
+ sum = "h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=",
+ version = "v1.0.5",
+ )
+
+ go_repository(
+ name = "in_gopkg_check_v1",
+ importpath = "gopkg.in/check.v1",
+ sum = "h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=",
+ version = "v0.0.0-20161208181325-20d25e280405",
+ )
+
+ go_repository(
+ name = "in_gopkg_yaml_v2",
+ importpath = "gopkg.in/yaml.v2",
+ sum = "h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=",
+ version = "v2.4.0",
+ )
+ go_repository(
+ name = "io_k8s_klog_v2",
+ importpath = "k8s.io/klog/v2",
+ sum = "h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=",
+ version = "v2.80.1",
+ )
diff --git a/examples/basic-gazelle/go.mod b/examples/basic-gazelle/go.mod
new file mode 100644
index 00000000..f879d8b9
--- /dev/null
+++ b/examples/basic-gazelle/go.mod
@@ -0,0 +1,14 @@
+module github.com/bazelbuild/rules_go/examples/basic-gazelle
+
+go 1.19
+
+require (
+ github.com/spf13/cobra v1.5.0
+ k8s.io/klog/v2 v2.80.1
+)
+
+require (
+ github.com/go-logr/logr v1.2.0 // indirect
+ github.com/inconshreveable/mousetrap v1.0.0 // indirect
+ github.com/spf13/pflag v1.0.5 // indirect
+)
diff --git a/examples/basic-gazelle/go.sum b/examples/basic-gazelle/go.sum
new file mode 100644
index 00000000..1083e9e8
--- /dev/null
+++ b/examples/basic-gazelle/go.sum
@@ -0,0 +1,14 @@
+github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
+github.com/go-logr/logr v1.2.0 h1:QK40JKJyMdUDz+h+xvCsru/bJhvG0UxvePV0ufL/AcE=
+github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
+github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM=
+github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
+github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
+github.com/spf13/cobra v1.5.0 h1:X+jTBEBqF0bHN+9cSMgmfuvv2VHJ9ezmFNf9Y/XstYU=
+github.com/spf13/cobra v1.5.0/go.mod h1:dWXEIy2H428czQCjInthrTRUg7yKbok+2Qi/yBIJoUM=
+github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
+github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
+gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
+k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
+k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
diff --git a/examples/basic-gazelle/main.go b/examples/basic-gazelle/main.go
new file mode 100644
index 00000000..e2e22b9b
--- /dev/null
+++ b/examples/basic-gazelle/main.go
@@ -0,0 +1,25 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "github.com/bazelbuild/rules_go/examples/basic-gazelle/cmd"
+ "k8s.io/klog/v2"
+)
+
+func main() {
+ klog.InitFlags(nil)
+ cmd.Execute()
+}
diff --git a/examples/basic-gazelle/pkg/roll/BUILD.bazel b/examples/basic-gazelle/pkg/roll/BUILD.bazel
new file mode 100644
index 00000000..db6f2375
--- /dev/null
+++ b/examples/basic-gazelle/pkg/roll/BUILD.bazel
@@ -0,0 +1,15 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "roll",
+ srcs = ["roll_dice.go"],
+ importpath = "github.com/bazelbuild/rules_go/examples/basic-gazelle/pkg/roll",
+ visibility = ["//visibility:public"],
+ deps = ["@io_k8s_klog_v2//:klog"],
+)
+
+go_test(
+ name = "roll_test",
+ srcs = ["roll_dice_test.go"],
+ embed = [":roll"],
+)
diff --git a/examples/basic-gazelle/pkg/roll/roll_dice.go b/examples/basic-gazelle/pkg/roll/roll_dice.go
new file mode 100644
index 00000000..1fe268ac
--- /dev/null
+++ b/examples/basic-gazelle/pkg/roll/roll_dice.go
@@ -0,0 +1,34 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package roll
+
+import (
+ "math/rand"
+ "strconv"
+ "time"
+
+ "k8s.io/klog/v2"
+)
+
+func Roll() string {
+ klog.Info("rolling the dice")
+ return generateNumber()
+}
+
+func generateNumber() string {
+ source := rand.NewSource(time.Now().UnixNano())
+ random := rand.New(source)
+ return strconv.Itoa(random.Intn(100))
+}
diff --git a/examples/basic-gazelle/pkg/roll/roll_dice_test.go b/examples/basic-gazelle/pkg/roll/roll_dice_test.go
new file mode 100644
index 00000000..c69c685b
--- /dev/null
+++ b/examples/basic-gazelle/pkg/roll/roll_dice_test.go
@@ -0,0 +1,27 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package roll
+
+import (
+ "testing"
+)
+
+func TestGenerateNumber(t *testing.T) {
+ result := generateNumber()
+
+ if result == "" {
+ t.Error("got an empty string")
+ }
+}
diff --git a/extras/BUILD.bazel b/extras/BUILD.bazel
new file mode 100644
index 00000000..9bdca7f8
--- /dev/null
+++ b/extras/BUILD.bazel
@@ -0,0 +1,51 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+
+filegroup(
+ name = "all_rules",
+ srcs = glob(["*.bzl"]) + ["//go/private:all_rules"],
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+bzl_library(
+ name = "bindata",
+ srcs = ["bindata.bzl"],
+ visibility = ["//visibility:public"],
+ deps = ["@io_bazel_rules_go//go:def"],
+)
+
+bzl_library(
+ name = "embed_data",
+ srcs = ["embed_data.bzl"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "//go/private:context",
+ "//go/private:go_toolchain",
+ ],
+)
+
+bzl_library(
+ name = "embed_data_deps",
+ srcs = ["embed_data_deps.bzl"],
+ visibility = ["//visibility:public"],
+ # Don't list dependency on @bazel_tools//tools/build_defs/repo.bzl
+ deps = [], # keep
+)
+
+bzl_library(
+ name = "gomock",
+ srcs = ["gomock.bzl"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "//go/private:context",
+ "//go/private:go_toolchain",
+ "//go/private:providers",
+ "//go/private/rules:wrappers",
+ ],
+)
diff --git a/extras/bindata.bzl b/extras/bindata.bzl
new file mode 100644
index 00000000..40c119f9
--- /dev/null
+++ b/extras/bindata.bzl
@@ -0,0 +1,87 @@
+# Copyright 2018 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""bindata.bzl provides the bindata rule for embedding data in .go files"""
+
+load(
+ "//go:def.bzl",
+ "go_context",
+)
+load(
+ "//go/private:go_toolchain.bzl",
+ "GO_TOOLCHAIN",
+)
+
+def _bindata_impl(ctx):
+ print("Embedding is now better handled by using rules_go's built-in embedding functionality (https://github.com/bazelbuild/rules_go/blob/master/docs/go/core/rules.md#go_library-embedsrcs). The `bindata` rule is deprecated and will be removed in rules_go version 0.39.")
+ go = go_context(ctx)
+ out = go.declare_file(go, ext = ".go")
+ arguments = ctx.actions.args()
+ arguments.add_all([
+ "-o",
+ out,
+ "-pkg",
+ ctx.attr.package,
+ "-prefix",
+ ctx.label.package,
+ ])
+ if not ctx.attr.compress:
+ arguments.add("-nocompress")
+ if not ctx.attr.metadata:
+ arguments.add("-nometadata")
+ if not ctx.attr.memcopy:
+ arguments.add("-nomemcopy")
+ if not ctx.attr.modtime:
+ arguments.add_all(["-modtime", "0"])
+ if ctx.attr.extra_args:
+ arguments.add_all(ctx.attr.extra_args)
+ srcs = [f.path for f in ctx.files.srcs]
+ if ctx.attr.strip_external and any([f.startswith("external/") for f in srcs]):
+ arguments.add("-prefix", ctx.label.workspace_root + "/" + ctx.label.package)
+ arguments.add_all(srcs)
+ ctx.actions.run(
+ inputs = ctx.files.srcs,
+ outputs = [out],
+ mnemonic = "GoBindata",
+ executable = ctx.executable._bindata,
+ arguments = [arguments],
+ )
+ return [
+ DefaultInfo(
+ files = depset([out]),
+ ),
+ ]
+
+bindata = rule(
+ implementation = _bindata_impl,
+ attrs = {
+ "srcs": attr.label_list(allow_files = True),
+ "package": attr.string(mandatory = True),
+ "compress": attr.bool(default = True),
+ "metadata": attr.bool(default = False),
+ "memcopy": attr.bool(default = True),
+ "modtime": attr.bool(default = False),
+ "strip_external": attr.bool(default = False),
+ "extra_args": attr.string_list(),
+ "_bindata": attr.label(
+ executable = True,
+ cfg = "exec",
+ default = "@com_github_kevinburke_go_bindata//go-bindata:go-bindata",
+ ),
+ "_go_context_data": attr.label(
+ default = "//:go_context_data",
+ ),
+ },
+ toolchains = [GO_TOOLCHAIN],
+)
diff --git a/extras/embed_data.bzl b/extras/embed_data.bzl
new file mode 100644
index 00000000..fb3519e2
--- /dev/null
+++ b/extras/embed_data.bzl
@@ -0,0 +1,146 @@
+# Copyright 2017 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:context.bzl", #TODO: This ought to be def
+ "go_context",
+)
+load(
+ "//go/private:go_toolchain.bzl",
+ "GO_TOOLCHAIN",
+)
+
+_DOC = """**Deprecated**: Will be removed in rules_go 0.39.
+
+`go_embed_data` generates a .go file that contains data from a file or a
+list of files. It should be consumed in the srcs list of one of the
+[core go rules].
+
+Before using `go_embed_data`, you must add the following snippet to your
+WORKSPACE:
+
+``` bzl
+load("@io_bazel_rules_go//extras:embed_data_deps.bzl", "go_embed_data_dependencies")
+
+go_embed_data_dependencies()
+```
+
+`go_embed_data` accepts the attributes listed below.
+"""
+
+def _go_embed_data_impl(ctx):
+ print("Embedding is now better handled by using rules_go's built-in embedding functionality (https://github.com/bazelbuild/rules_go/blob/master/docs/go/core/rules.md#go_library-embedsrcs). The `go_embed_data` rule is deprecated and will be removed in rules_go version 0.39.")
+
+ go = go_context(ctx)
+ if ctx.attr.src and ctx.attr.srcs:
+ fail("%s: src and srcs attributes cannot both be specified" % ctx.label)
+ if ctx.attr.src and ctx.attr.flatten:
+ fail("%s: src and flatten attributes cannot both be specified" % ctx.label)
+
+ args = ctx.actions.args()
+ if ctx.attr.src:
+ srcs = [ctx.file.src]
+ else:
+ srcs = ctx.files.srcs
+ args.add("-multi")
+
+ if ctx.attr.package:
+ package = ctx.attr.package
+ else:
+ _, _, package = ctx.label.package.rpartition("/")
+ if package == "":
+ fail("%s: must provide package attribute for go_embed_data rules in the repository root directory" % ctx.label)
+
+ out = go.declare_file(go, ext = ".go")
+ args.add_all([
+ "-workspace",
+ ctx.workspace_name,
+ "-label",
+ str(ctx.label),
+ "-out",
+ out,
+ "-package",
+ package,
+ "-var",
+ ctx.attr.var,
+ ])
+ if ctx.attr.flatten:
+ args.add("-flatten")
+ if ctx.attr.string:
+ args.add("-string")
+ if ctx.attr.unpack:
+ args.add("-unpack")
+ args.add("-multi")
+ args.add_all(srcs)
+
+ library = go.new_library(go, srcs = [out])
+ source = go.library_to_source(go, {}, library, ctx.coverage_instrumented())
+
+ ctx.actions.run(
+ outputs = [out],
+ inputs = srcs,
+ executable = ctx.executable._embed,
+ arguments = [args],
+ mnemonic = "GoSourcesData",
+ )
+ return [
+ DefaultInfo(files = depset([out])),
+ library,
+ source,
+ ]
+
+go_embed_data = rule(
+ implementation = _go_embed_data_impl,
+ doc = _DOC,
+ attrs = {
+ "package": attr.string(
+ doc = "Go package name for the generated .go file.",
+ ),
+ "var": attr.string(
+ default = "Data",
+ doc = "Name of the variable that will contain the embedded data.",
+ ),
+ "src": attr.label(
+ allow_single_file = True,
+ doc = """A single file to embed. This cannot be used at the same time as `srcs`.
+ The generated file will have a variable of type `[]byte` or `string` with the contents of this file.""",
+ ),
+ "srcs": attr.label_list(
+ allow_files = True,
+ doc = """A list of files to embed. This cannot be used at the same time as `src`.
+ The generated file will have a variable of type `map[string][]byte` or `map[string]string` with the contents
+ of each file. The map keys are relative paths of the files from the repository root. Keys for files in external
+ repositories will be prefixed with `"external/repo/"` where "repo" is the name of the external repository.""",
+ ),
+ "flatten": attr.bool(
+ doc = "If `True` and `srcs` is used, map keys are file base names instead of relative paths.",
+ ),
+ "unpack": attr.bool(
+ doc = "If `True`, sources are treated as archives and their contents will be stored. Supported formats are `.zip` and `.tar`",
+ ),
+ "string": attr.bool(
+ doc = "If `True`, the embedded data will be stored as `string` instead of `[]byte`.",
+ ),
+ "_embed": attr.label(
+ default = "//go/tools/builders:embed",
+ executable = True,
+ cfg = "exec",
+ ),
+ "_go_context_data": attr.label(
+ default = "//:go_context_data",
+ ),
+ },
+ toolchains = [GO_TOOLCHAIN],
+)
+# See /docs/go/extras/extras.md#go_embed_data for full documentation.
diff --git a/extras/embed_data_deps.bzl b/extras/embed_data_deps.bzl
new file mode 100644
index 00000000..1e2d6e88
--- /dev/null
+++ b/extras/embed_data_deps.bzl
@@ -0,0 +1,35 @@
+# Copyright 2019 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Repository dependencies for embed_data.bzl"""
+
+load(
+ "@bazel_tools//tools/build_defs/repo:git.bzl",
+ "git_repository",
+)
+
+def go_embed_data_dependencies():
+ print("Embedding is now better handled by using rules_go's built-in embedding functionality (https://github.com/bazelbuild/rules_go/blob/master/docs/go/core/rules.md#go_library-embedsrcs). The `go_embed_data_dependencies` macro is deprecated and will be removed in rules_go version 0.39.")
+
+ if "com_github_kevinburke_go_bindata" not in native.existing_rules():
+ git_repository(
+ name = "com_github_kevinburke_go_bindata",
+ remote = "https://github.com/kevinburke/go-bindata",
+ # v3.13.0+incompatible, "latest" as of 2019-07-08
+ commit = "53d73b98acf3bd9f56d7f9136ed8e1be64756e1d",
+ patches = [Label("//third_party:com_github_kevinburke_go_bindata-gazelle.patch")],
+ patch_args = ["-p1"],
+ shallow_since = "1545009224 +0000",
+ # gazelle args: -go_prefix github.com/kevinburke/go-bindata
+ )
diff --git a/extras/gomock.bzl b/extras/gomock.bzl
new file mode 100644
index 00000000..7e960eae
--- /dev/null
+++ b/extras/gomock.bzl
@@ -0,0 +1,386 @@
+# The MIT License (MIT)
+# Copyright © 2018 Jeff Hodges <jeff@somethingsimilar.com>
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the “Software”), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+# THE SOFTWARE.
+
+# The rules in this files are still under development. Breaking changes are planned.
+# DO NOT USE IT.
+
+load("//go/private:context.bzl", "go_context")
+load("//go/private:go_toolchain.bzl", "GO_TOOLCHAIN")
+load("//go/private/rules:wrappers.bzl", go_binary = "go_binary_macro")
+load("//go/private:providers.bzl", "GoLibrary")
+load("@bazel_skylib//lib:paths.bzl", "paths")
+
+_MOCKGEN_TOOL = Label("//extras/gomock:mockgen")
+_MOCKGEN_MODEL_LIB = Label("//extras/gomock:mockgen_model")
+
+def _gomock_source_impl(ctx):
+ go_ctx = go_context(ctx)
+
+ # create GOPATH and copy source into GOPATH
+ source_relative_path = paths.join("src", ctx.attr.library[GoLibrary].importmap, ctx.file.source.basename)
+ source = ctx.actions.declare_file(paths.join("gopath", source_relative_path))
+
+ # trim the relative path of source to get GOPATH
+ gopath = source.path[:-len(source_relative_path)]
+ ctx.actions.run_shell(
+ outputs = [source],
+ inputs = [ctx.file.source],
+ command = "mkdir -p {0} && cp -L {1} {0}".format(source.dirname, ctx.file.source.path),
+ )
+
+ # passed in source needs to be in gopath to not trigger module mode
+ args = ["-source", source.path]
+
+ args, needed_files = _handle_shared_args(ctx, args)
+
+ if len(ctx.attr.aux_files) > 0:
+ aux_files = []
+ for target, pkg in ctx.attr.aux_files.items():
+ f = target.files.to_list()[0]
+ aux = ctx.actions.declare_file(paths.join(gopath, "src", pkg, f.basename))
+ ctx.actions.run_shell(
+ outputs = [aux],
+ inputs = [f],
+ command = "mkdir -p {0} && cp -L {1} {0}".format(aux.dirname, f.path),
+ )
+ aux_files.append("{0}={1}".format(pkg, aux.path))
+ needed_files.append(f)
+ args += ["-aux_files", ",".join(aux_files)]
+
+ inputs = (
+ needed_files +
+ go_ctx.sdk.headers + go_ctx.sdk.srcs + go_ctx.sdk.tools
+ ) + [source]
+
+ # We can use the go binary from the stdlib for most of the environment
+ # variables, but our GOPATH is specific to the library target we were given.
+ ctx.actions.run_shell(
+ outputs = [ctx.outputs.out],
+ inputs = inputs,
+ tools = [
+ ctx.file.mockgen_tool,
+ go_ctx.go,
+ ],
+ command = """
+ export GOPATH=$(pwd)/{gopath} &&
+ {cmd} {args} > {out}
+ """.format(
+ gopath = gopath,
+ cmd = "$(pwd)/" + ctx.file.mockgen_tool.path,
+ args = " ".join(args),
+ out = ctx.outputs.out.path,
+ mnemonic = "GoMockSourceGen",
+ ),
+ env = {
+ # GOCACHE is required starting in Go 1.12
+ "GOCACHE": "./.gocache",
+ },
+ )
+
+_gomock_source = rule(
+ _gomock_source_impl,
+ attrs = {
+ "library": attr.label(
+ doc = "The target the Go library where this source file belongs",
+ providers = [GoLibrary],
+ mandatory = True,
+ ),
+ "source": attr.label(
+ doc = "A Go source file to find all the interfaces to generate mocks for. See also the docs for library.",
+ mandatory = False,
+ allow_single_file = True,
+ ),
+ "out": attr.output(
+ doc = "The new Go file to emit the generated mocks into",
+ mandatory = True,
+ ),
+ "aux_files": attr.label_keyed_string_dict(
+ default = {},
+ doc = "A map from auxilliary Go source files to their packages.",
+ allow_files = True,
+ ),
+ "package": attr.string(
+ doc = "The name of the package the generated mocks should be in. If not specified, uses mockgen's default.",
+ ),
+ "self_package": attr.string(
+ doc = "The full package import path for the generated code. The purpose of this flag is to prevent import cycles in the generated code by trying to include its own package. This can happen if the mock's package is set to one of its inputs (usually the main one) and the output is stdio so mockgen cannot detect the final output package. Setting this flag will then tell mockgen which import to exclude.",
+ ),
+ "imports": attr.string_dict(
+ doc = "Dictionary of name-path pairs of explicit imports to use.",
+ ),
+ "mock_names": attr.string_dict(
+ doc = "Dictionary of interface name to mock name pairs to change the output names of the mock objects. Mock names default to 'Mock' prepended to the name of the interface.",
+ default = {},
+ ),
+ "copyright_file": attr.label(
+ doc = "Optional file containing copyright to prepend to the generated contents.",
+ allow_single_file = True,
+ mandatory = False,
+ ),
+ "mockgen_tool": attr.label(
+ doc = "The mockgen tool to run",
+ default = _MOCKGEN_TOOL,
+ allow_single_file = True,
+ executable = True,
+ cfg = "exec",
+ mandatory = False,
+ ),
+ "_go_context_data": attr.label(
+ default = "//:go_context_data",
+ ),
+ },
+ toolchains = [GO_TOOLCHAIN],
+)
+
+def gomock(name, library, out, source = None, interfaces = [], package = "", self_package = "", aux_files = {}, mockgen_tool = _MOCKGEN_TOOL, imports = {}, copyright_file = None, mock_names = {}, **kwargs):
+ """Calls [mockgen](https://github.com/golang/mock) to generates a Go file containing mocks from the given library.
+
+ If `source` is given, the mocks are generated in source mode; otherwise in reflective mode.
+
+ Args:
+ name: the target name.
+ library: the Go library to took for the interfaces (reflecitve mode) or source (source mode).
+ out: the output Go file name.
+ source: a Go file in the given `library`. If this is given, `gomock` will call mockgen in source mode to mock all interfaces in the file.
+ interfaces: a list of interfaces in the given `library` to be mocked in reflective mode.
+ package: the name of the package the generated mocks should be in. If not specified, uses mockgen's default. See [mockgen's -package](https://github.com/golang/mock#flags) for more information.
+ self_package: the full package import path for the generated code. The purpose of this flag is to prevent import cycles in the generated code by trying to include its own package. See [mockgen's -self_package](https://github.com/golang/mock#flags) for more information.
+ aux_files: a map from source files to their package path. This only needed when `source` is provided. See [mockgen's -aux_files](https://github.com/golang/mock#flags) for more information.
+ mockgen_tool: the mockgen tool to run.
+ imports: dictionary of name-path pairs of explicit imports to use. See [mockgen's -imports](https://github.com/golang/mock#flags) for more information.
+ copyright_file: optional file containing copyright to prepend to the generated contents. See [mockgen's -copyright_file](https://github.com/golang/mock#flags) for more information.
+ mock_names: dictionary of interface name to mock name pairs to change the output names of the mock objects. Mock names default to 'Mock' prepended to the name of the interface. See [mockgen's -mock_names](https://github.com/golang/mock#flags) for more information.
+ kwargs: common attributes](https://bazel.build/reference/be/common-definitions#common-attributes) to all Bazel rules.
+ """
+ if source:
+ _gomock_source(
+ name = name,
+ library = library,
+ out = out,
+ source = source,
+ package = package,
+ self_package = self_package,
+ aux_files = aux_files,
+ mockgen_tool = mockgen_tool,
+ imports = imports,
+ copyright_file = copyright_file,
+ mock_names = mock_names,
+ **kwargs
+ )
+ else:
+ _gomock_reflect(
+ name = name,
+ library = library,
+ out = out,
+ interfaces = interfaces,
+ package = package,
+ self_package = self_package,
+ mockgen_tool = mockgen_tool,
+ imports = imports,
+ copyright_file = copyright_file,
+ mock_names = mock_names,
+ **kwargs
+ )
+
+def _gomock_reflect(name, library, out, mockgen_tool, **kwargs):
+ interfaces = kwargs.pop("interfaces", None)
+
+ mockgen_model_lib = _MOCKGEN_MODEL_LIB
+ if kwargs.get("mockgen_model_library", None):
+ mockgen_model_lib = kwargs["mockgen_model_library"]
+
+ prog_src = name + "_gomock_prog"
+ prog_src_out = prog_src + ".go"
+ _gomock_prog_gen(
+ name = prog_src,
+ interfaces = interfaces,
+ library = library,
+ out = prog_src_out,
+ mockgen_tool = mockgen_tool,
+ )
+ prog_bin = name + "_gomock_prog_bin"
+ go_binary(
+ name = prog_bin,
+ srcs = [prog_src_out],
+ deps = [library, mockgen_model_lib],
+ )
+ _gomock_prog_exec(
+ name = name,
+ interfaces = interfaces,
+ library = library,
+ out = out,
+ prog_bin = prog_bin,
+ mockgen_tool = mockgen_tool,
+ **kwargs
+ )
+
+def _gomock_prog_gen_impl(ctx):
+ args = ["-prog_only"]
+ args.append(ctx.attr.library[GoLibrary].importpath)
+ args.append(",".join(ctx.attr.interfaces))
+
+ cmd = ctx.file.mockgen_tool
+ out = ctx.outputs.out
+ ctx.actions.run_shell(
+ outputs = [out],
+ tools = [cmd],
+ command = """
+ {cmd} {args} > {out}
+ """.format(
+ cmd = "$(pwd)/" + cmd.path,
+ args = " ".join(args),
+ out = out.path,
+ ),
+ mnemonic = "GoMockReflectProgOnlyGen",
+ )
+
+_gomock_prog_gen = rule(
+ _gomock_prog_gen_impl,
+ attrs = {
+ "library": attr.label(
+ doc = "The target the Go library is at to look for the interfaces in. When this is set and source is not set, mockgen will use its reflect code to generate the mocks. If source is set, its dependencies will be included in the GOPATH that mockgen will be run in.",
+ providers = [GoLibrary],
+ mandatory = True,
+ ),
+ "out": attr.output(
+ doc = "The new Go source file put the mock generator code",
+ mandatory = True,
+ ),
+ "interfaces": attr.string_list(
+ allow_empty = False,
+ doc = "The names of the Go interfaces to generate mocks for. If not set, all of the interfaces in the library or source file will have mocks generated for them.",
+ mandatory = True,
+ ),
+ "mockgen_tool": attr.label(
+ doc = "The mockgen tool to run",
+ default = _MOCKGEN_TOOL,
+ allow_single_file = True,
+ executable = True,
+ cfg = "exec",
+ mandatory = False,
+ ),
+ "_go_context_data": attr.label(
+ default = "//:go_context_data",
+ ),
+ },
+ toolchains = [GO_TOOLCHAIN],
+)
+
+def _gomock_prog_exec_impl(ctx):
+ args = ["-exec_only", ctx.file.prog_bin.path]
+ args, needed_files = _handle_shared_args(ctx, args)
+
+ # annoyingly, the interfaces join has to go after the importpath so we can't
+ # share those.
+ args.append(ctx.attr.library[GoLibrary].importpath)
+ args.append(",".join(ctx.attr.interfaces))
+
+ ctx.actions.run_shell(
+ outputs = [ctx.outputs.out],
+ inputs = [ctx.file.prog_bin] + needed_files,
+ tools = [ctx.file.mockgen_tool],
+ command = """{cmd} {args} > {out}""".format(
+ cmd = "$(pwd)/" + ctx.file.mockgen_tool.path,
+ args = " ".join(args),
+ out = ctx.outputs.out.path,
+ ),
+ env = {
+ # GOCACHE is required starting in Go 1.12
+ "GOCACHE": "./.gocache",
+ },
+ mnemonic = "GoMockReflectExecOnlyGen",
+ )
+
+_gomock_prog_exec = rule(
+ _gomock_prog_exec_impl,
+ attrs = {
+ "library": attr.label(
+ doc = "The target the Go library is at to look for the interfaces in. When this is set and source is not set, mockgen will use its reflect code to generate the mocks. If source is set, its dependencies will be included in the GOPATH that mockgen will be run in.",
+ providers = [GoLibrary],
+ mandatory = True,
+ ),
+ "out": attr.output(
+ doc = "The new Go source file to put the generated mock code",
+ mandatory = True,
+ ),
+ "interfaces": attr.string_list(
+ allow_empty = False,
+ doc = "The names of the Go interfaces to generate mocks for. If not set, all of the interfaces in the library or source file will have mocks generated for them.",
+ mandatory = True,
+ ),
+ "package": attr.string(
+ doc = "The name of the package the generated mocks should be in. If not specified, uses mockgen's default.",
+ ),
+ "self_package": attr.string(
+ doc = "The full package import path for the generated code. The purpose of this flag is to prevent import cycles in the generated code by trying to include its own package. This can happen if the mock's package is set to one of its inputs (usually the main one) and the output is stdio so mockgen cannot detect the final output package. Setting this flag will then tell mockgen which import to exclude.",
+ ),
+ "imports": attr.string_dict(
+ doc = "Dictionary of name-path pairs of explicit imports to use.",
+ ),
+ "mock_names": attr.string_dict(
+ doc = "Dictionary of interfaceName-mockName pairs of explicit mock names to use. Mock names default to 'Mock'+ interfaceName suffix.",
+ default = {},
+ ),
+ "copyright_file": attr.label(
+ doc = "Optional file containing copyright to prepend to the generated contents.",
+ allow_single_file = True,
+ mandatory = False,
+ ),
+ "prog_bin": attr.label(
+ doc = "The program binary generated by mockgen's -prog_only and compiled by bazel.",
+ allow_single_file = True,
+ executable = True,
+ cfg = "exec",
+ mandatory = True,
+ ),
+ "mockgen_tool": attr.label(
+ doc = "The mockgen tool to run",
+ default = _MOCKGEN_TOOL,
+ allow_single_file = True,
+ executable = True,
+ cfg = "exec",
+ mandatory = False,
+ ),
+ "_go_context_data": attr.label(
+ default = "//:go_context_data",
+ ),
+ },
+ toolchains = [GO_TOOLCHAIN],
+)
+
+def _handle_shared_args(ctx, args):
+ needed_files = []
+
+ if ctx.attr.package != "":
+ args += ["-package", ctx.attr.package]
+ if ctx.attr.self_package != "":
+ args += ["-self_package", ctx.attr.self_package]
+ if len(ctx.attr.imports) > 0:
+ imports = ",".join(["{0}={1}".format(name, pkg) for name, pkg in ctx.attr.imports.items()])
+ args += ["-imports", imports]
+ if ctx.file.copyright_file != None:
+ args += ["-copyright_file", ctx.file.copyright_file.path]
+ needed_files.append(ctx.file.copyright_file)
+ if len(ctx.attr.mock_names) > 0:
+ mock_names = ",".join(["{0}={1}".format(name, pkg) for name, pkg in ctx.attr.mock_names.items()])
+ args += ["-mock_names", mock_names]
+
+ return args, needed_files
diff --git a/extras/gomock/BUILD.bazel b/extras/gomock/BUILD.bazel
new file mode 100644
index 00000000..5eb1e087
--- /dev/null
+++ b/extras/gomock/BUILD.bazel
@@ -0,0 +1,17 @@
+alias(
+ name = "gomock",
+ actual = "@com_github_golang_mock//gomock",
+ visibility = ["//visibility:public"],
+)
+
+alias(
+ name = "mockgen",
+ actual = "@com_github_golang_mock//mockgen",
+ visibility = ["//visibility:public"],
+)
+
+alias(
+ name = "mockgen_model",
+ actual = "@com_github_golang_mock//mockgen/model",
+ visibility = ["//visibility:public"],
+)
diff --git a/go.mod b/go.mod
new file mode 100644
index 00000000..8b81c68b
--- /dev/null
+++ b/go.mod
@@ -0,0 +1,17 @@
+module github.com/bazelbuild/rules_go
+
+go 1.18
+
+require (
+ github.com/golang/mock v1.6.0
+ github.com/golang/protobuf v1.5.2
+ google.golang.org/protobuf v1.28.0
+)
+
+require (
+ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
+ golang.org/x/sys v0.0.0-20210510120138-977fb7262007 // indirect
+ golang.org/x/text v0.3.3 // indirect
+ google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
+ google.golang.org/grpc v1.50.0 // indirect
+)
diff --git a/go.sum b/go.sum
new file mode 100644
index 00000000..56a11be6
--- /dev/null
+++ b/go.sum
@@ -0,0 +1,108 @@
+cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
+github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
+github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=
+github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
+github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
+github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
+github.com/golang/mock v1.6.0 h1:ErTB+efbowRARo13NNdxyJji2egdxLGQhRaY+DUumQc=
+github.com/golang/mock v1.6.0/go.mod h1:p6yTPP+5HYm5mzsMV8JkE6ZKdX+/wYM6Hr+LicevLPs=
+github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
+github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
+github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
+github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
+github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
+github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
+github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
+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/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
+github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
+github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
+github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
+github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
+github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
+github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
+golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
+golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
+golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
+golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
+golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
+golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
+golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
+golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
+golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
+golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU=
+golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=
+golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
+golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
+golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
+golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
+golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
+golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k=
+golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
+golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
+golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
+golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
+golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=
+golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA=
+golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
+golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
+google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
+google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
+google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
+google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=
+google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
+google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
+google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
+google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
+google.golang.org/grpc v1.50.0 h1:fPVVDxY9w++VjTZsYvXWqEf9Rqar/e+9zYfxKK+W+YU=
+google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI=
+google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
+google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
+google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
+google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
+google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
+google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
+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.28.0 h1:w43yiav+6bVFTBQFZX0r7ipe9JQ1QsbMgHwbBziscLw=
+google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
+honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
+honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
diff --git a/go/BUILD.bazel b/go/BUILD.bazel
new file mode 100644
index 00000000..f88616c2
--- /dev/null
+++ b/go/BUILD.bazel
@@ -0,0 +1,71 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+
+# The 'go' binary of the current Go toolchain compatible with the host.
+# Use this with `bazel run` to perform utility actions such as `go mod tidy` in
+# a hermetic fashion.
+# Note: This is not meant to and cannot be used as a tool in e.g. a genrule. If
+# you need this functionality, please file an issue describing your use case.
+alias(
+ name = "go",
+ actual = "//go/tools/go_bin_runner",
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]) + [
+ "//go/config:all_files",
+ "//go/constraints/amd64:all_files",
+ "//go/platform:all_files",
+ "//go/runfiles:all_files",
+ "//go/toolchain:all_files",
+ "//go/tools:all_files",
+ "//go/private:all_files",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_rules",
+ srcs = glob(["*.bzl"]) + [
+ "//go/platform:all_rules",
+ "//go/private:all_rules",
+ "//go/toolchain:all_rules",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+toolchain_type(
+ name = "toolchain",
+ visibility = ["//visibility:public"],
+)
+
+bzl_library(
+ name = "def",
+ srcs = ["def.bzl"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "//extras:embed_data",
+ "//extras:gomock",
+ "//go/private:context",
+ "//go/private:go_toolchain",
+ "//go/private:providers",
+ "//go/private/rules:library",
+ "//go/private/rules:nogo",
+ "//go/private/rules:sdk",
+ "//go/private/rules:source",
+ "//go/private/rules:wrappers",
+ "//go/private/tools:path",
+ ],
+)
+
+bzl_library(
+ name = "deps",
+ srcs = ["deps.bzl"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "//go/private:repositories",
+ "//go/private:sdk",
+ ],
+)
diff --git a/go/config/BUILD.bazel b/go/config/BUILD.bazel
new file mode 100644
index 00000000..a292fc9d
--- /dev/null
+++ b/go/config/BUILD.bazel
@@ -0,0 +1,81 @@
+load(
+ "@bazel_skylib//rules:common_settings.bzl",
+ "bool_flag",
+ "string_flag",
+ "string_list_flag",
+)
+load(
+ "//go/private:mode.bzl",
+ "LINKMODE_NORMAL",
+)
+
+bool_flag(
+ name = "static",
+ build_setting_default = False,
+ visibility = ["//visibility:public"],
+)
+
+bool_flag(
+ name = "race",
+ build_setting_default = False,
+ visibility = ["//visibility:public"],
+)
+
+bool_flag(
+ name = "msan",
+ build_setting_default = False,
+ visibility = ["//visibility:public"],
+)
+
+bool_flag(
+ name = "pure",
+ build_setting_default = False,
+ visibility = ["//visibility:public"],
+)
+
+bool_flag(
+ name = "debug",
+ build_setting_default = False,
+ visibility = ["//visibility:public"],
+)
+
+string_flag(
+ name = "linkmode",
+ build_setting_default = LINKMODE_NORMAL,
+ visibility = ["//visibility:public"],
+)
+
+string_list_flag(
+ name = "gc_linkopts",
+ build_setting_default = [],
+ visibility = ["//visibility:public"],
+)
+
+string_list_flag(
+ name = "tags",
+ build_setting_default = [],
+ visibility = ["//visibility:public"],
+)
+
+string_flag(
+ name = "cover_format",
+ build_setting_default = "lcov",
+ values = [
+ "go_cover",
+ "lcov",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+string_list_flag(
+ name = "gc_goopts",
+ build_setting_default = [],
+ visibility = ["//visibility:public"],
+)
diff --git a/go/constraints/amd64/BUILD.bazel b/go/constraints/amd64/BUILD.bazel
new file mode 100644
index 00000000..0bc0ba3f
--- /dev/null
+++ b/go/constraints/amd64/BUILD.bazel
@@ -0,0 +1,38 @@
+package(
+ default_visibility = ["//visibility:public"],
+)
+
+# Represents the level of support for the particular microarchitecture of a
+# target platform based on the general amd64 architecture.
+# GOAMD64 is set based on the chosen constraint_value.
+# See https://github.com/golang/go/wiki/MinimumRequirements#amd64
+constraint_setting(
+ name = "amd64",
+)
+
+constraint_value(
+ name = "v1",
+ constraint_setting = ":amd64",
+)
+
+constraint_value(
+ name = "v2",
+ constraint_setting = ":amd64",
+)
+
+constraint_value(
+ name = "v3",
+ constraint_setting = ":amd64",
+)
+
+constraint_value(
+ name = "v4",
+ constraint_setting = ":amd64",
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
diff --git a/go/core.rst b/go/core.rst
new file mode 100644
index 00000000..f694681c
--- /dev/null
+++ b/go/core.rst
@@ -0,0 +1,95 @@
+Core Go rules
+=============
+
+.. _"Make variable": https://docs.bazel.build/versions/master/be/make-variables.html
+.. _Bourne shell tokenization: https://docs.bazel.build/versions/master/be/common-definitions.html#sh-tokenization
+.. _Gazelle: https://github.com/bazelbuild/bazel-gazelle
+.. _GoArchive: providers.rst#GoArchive
+.. _GoLibrary: providers.rst#GoLibrary
+.. _GoPath: providers.rst#GoPath
+.. _GoSource: providers.rst#GoSource
+.. _build constraints: https://golang.org/pkg/go/build/#hdr-Build_Constraints
+.. _cc_library deps: https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library.deps
+.. _cgo: http://golang.org/cmd/cgo/
+.. _config_setting: https://docs.bazel.build/versions/master/be/general.html#config_setting
+.. _data dependencies: https://docs.bazel.build/versions/master/build-ref.html#data
+.. _goarch: modes.rst#goarch
+.. _goos: modes.rst#goos
+.. _mode attributes: modes.rst#mode-attributes
+.. _nogo: nogo.rst#nogo
+.. _pure: modes.rst#pure
+.. _race: modes.rst#race
+.. _msan: modes.rst#msan
+.. _select: https://docs.bazel.build/versions/master/be/functions.html#select
+.. _shard_count: https://docs.bazel.build/versions/master/be/common-definitions.html#test.shard_count
+.. _static: modes.rst#static
+.. _test_arg: https://docs.bazel.build/versions/master/user-manual.html#flag--test_arg
+.. _test_filter: https://docs.bazel.build/versions/master/user-manual.html#flag--test_filter
+.. _test_env: https://docs.bazel.build/versions/master/user-manual.html#flag--test_env
+.. _test_runner_fail_fast: https://docs.bazel.build/versions/master/command-line-reference.html#flag--test_runner_fail_fast
+.. _write a CROSSTOOL file: https://github.com/bazelbuild/bazel/wiki/Yet-Another-CROSSTOOL-Writing-Tutorial
+.. _bazel: https://pkg.go.dev/github.com/bazelbuild/rules_go/go/tools/bazel?tab=doc
+.. _introduction: /docs/go/core/rules.md#introduction
+.. _rules: /docs/go/core/rules.md#rules
+.. _examples: /docs/go/core/examples.md
+.. _defines-and-stamping: /docs/go/core/defines_and_stamping.md#defines-and-stamping
+.. _stamping-with-the-workspace-status-script: /docs/go/core/defines_and_stamping.md#stamping-with-the-workspace-status-script
+.. _embedding: /docs/go/core/embedding.md#embedding
+.. _cross-compilation: /docs/go/core/cross_compilation.md#cross-compilation
+.. _platform-specific-dependencies: /docs/go/core/platform-specific_dependencies.md#platform-specific-dependencies
+
+
+
+.. role:: param(kbd)
+.. role:: type(emphasis)
+.. role:: value(code)
+.. |mandatory| replace:: **mandatory value**
+
+These are the core go rules, required for basic operation.
+The intent is that these rules are sufficient to match the capabilities of the normal go tools.
+
+.. contents:: :depth: 2
+
+-----
+
+Introduction
+------------
+
+This section has been moved to introduction_.
+
+
+Rules
+-----
+
+This section has been moved to rules_.
+
+The examples pertaining to each rule have been moved to examples_.
+
+
+Defines and stamping
+--------------------
+
+This section has been moved to defines-and-stamping_.
+
+
+Stamping with the workspace status script
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This section has been moved to stamping-with-the-workspace-status-script_.
+
+
+Embedding
+---------
+
+This section has been moved to embedding_.
+
+
+Cross compilation
+-----------------
+
+This section has been moved to cross-compilation_.
+
+Platform-specific dependencies
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This section has been moved to platform-specific-dependencies_.
diff --git a/go/crosstool.rst b/go/crosstool.rst
new file mode 100644
index 00000000..381d15d6
--- /dev/null
+++ b/go/crosstool.rst
@@ -0,0 +1,346 @@
+Configuring a custom C toolchain
+================================
+
+.. External links are here
+.. _Configuring CROSSTOOL: https://docs.bazel.build/versions/0.23.0/tutorial/crosstool.html
+.. _Understanding CROSSTOOL: https://docs.bazel.build/versions/0.23.0/crosstool-reference.html
+.. _Configuring C++ toolchains: https://docs.bazel.build/versions/master/tutorial/cc-toolchain-config.html
+.. _cc_library: https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library
+.. _crosstool_config.proto: https://github.com/bazelbuild/bazel/blob/master/src/main/protobuf/crosstool_config.proto
+.. _go_binary: docs/go/core/rules.md#go_binary
+.. _go_library: docs/go/core/rules.md#go_library
+.. _toolchain: https://docs.bazel.build/versions/master/be/platform.html#toolchain
+.. _#1642: https://github.com/bazelbuild/rules_go/issues/1642
+
+References
+----------
+
+* `Configuring CROSSTOOL`_
+* `Understanding CROSSTOOL`_
+* `Configuring C++ toolchains`_
+
+Introduction
+------------
+
+**WARNING:** This documentation is out of date. Some of the linked Bazel
+documentation has been deleted in later versions, and there are a number of
+TODOs. In particular, building and configuring a cross-compiling C++ toolchain
+and testing it with cgo should be covered. `#1642`_ tracks progress on this.
+
+The Go toolchain sometimes needs access to a working C/C++ toolchain in order to
+produce binaries that contain cgo code or require external linking. rules_go
+uses whatever C/C++ toolchain Bazel is configured to use. This means
+`go_library`_ and `cc_library`_ rules can be linked into the same binary (via
+the ``cdeps`` attribute in Go rules).
+
+Bazel uses a CROSSTOOL file to configure the C/C++ toolchain, plus a few build
+rules that declare constraints, dependencies, and file groups. By default, Bazel
+will attempt to detect the toolchain installed on the host machine. This works
+in most cases, but it's not hermetic (developers may have completely different
+toolchains installed), and it doesn't always work with remote execution. It also
+doesn't work with cross-compilation. Explicit configuration is required in these
+situations.
+
+This documented is intended to serve as a walk-through for configuring a custom
+C/C++ toolchain for use with rules_go.
+
+NOTE: The Go toolchain requires gcc, clang, or something that accepts the same
+command-line arguments and produce the same error messages. MSVC is not
+supported. This is a limitation of the Go toolchain, not rules_go. cgo infers
+the types of C definitions based on the text of error messages.
+
+TODO: Change the example to use a cross-compiling toolchain.
+
+TODO: Add instructions for building a C compiler from scratch.
+
+TODO: Build the standard C library and binutils for use with this toolchain.
+
+Tutorial
+--------
+
+In this tutorial, we'll download a binary Clang release and install it into
+a new workspace. This workspace can be uploaded into a new repository and
+referenced from other Bazel workspaces.
+
+You can find a copy of the example repository described here at
+`https://github.com/jayconrod/bazel_cc_toolchains <https://github.com/jayconrod/bazel_cc_toolchains>`_.
+
+Step 1: Create the repository
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Create a new repository and add a WORKSPACE file to the root directory. It
+may be empty, but it's probably a good idea to give it a name.
+
+.. code:: bash
+
+ $ cat >WORKSPACE <<EOF
+ workspace(name = "bazel_cc_toolchains")
+ EOF
+
+Step 2: Download a toolchain
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Download or compile a C toolchain, and install it in a subdirectory of your
+workspace. I put it in ``tools``.
+
+Note that this toolchain has Unixy subdirectories like ``bin``, ``lib``, and
+``include``.
+
+.. code:: bash
+
+ $ curl http://releases.llvm.org/7.0.0/clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz | tar xJ
+ $ mv clang+llvm-7.0.0-x86_64-linux-gnu-ubuntu-16.04 tools
+ $ ls tools
+ bin include lib libexec share
+
+Step 3: Write a CROSSTOOL
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+We'll create a file named ``tools/CROSSTOOL``, which describes our toolchain
+to Bazel. If you have more than one C/C++ toolchain (e.g., different tools for
+debug and optimized builds, or different compilers for different platforms),
+they should all be configured in the same ``CROSSTOOL`` file.
+
+The format for this file is defined in `crosstool_config.proto`_. Specifically,
+CROSSTOOL should contain a ``CrosstoolRelease`` message, formatted as text.
+Each ``toolchain`` field is a ``CToolchain`` message.
+
+Here's a short example:
+
+.. code:: proto
+
+ major_version: "local"
+ minor_version: ""
+
+ toolchain {
+ toolchain_identifier: "clang"
+ host_system_name: "linux"
+ target_system_name: "linux"
+ target_cpu: "x86_64"
+ target_libc: "x86_64"
+ compiler: "clang"
+ abi_version: "unknown"
+ abi_libc_version: "unknown"
+
+ tool_path { name: "ar" path: "bin/llvm-ar" }
+ tool_path { name: "cpp" path: "bin/clang-cpp" }
+ tool_path { name: "dwp" path: "bin/llvm-dwp" }
+ tool_path { name: "gcc" path: "bin/clang" }
+ tool_path { name: "gcov" path: "bin/llvm-profdata" }
+ tool_path { name: "ld" path: "bin/ld.lld" }
+ tool_path { name: "nm" path: "bin/llvm-nm" }
+ tool_path { name: "objcopy" path: "bin/llvm-objcopy" }
+ tool_path { name: "objdump" path: "bin/llvm-objdump" }
+ tool_path { name: "strip" path: "bin/llvm-strip" }
+
+ compiler_flag: "-no-canonical-prefixes"
+ linker_flag: "-no-canonical-prefixes"
+
+ compiler_flag: "-v"
+ cxx_builtin_include_directory: "/usr/include"
+ }
+
+ default_toolchain {
+ cpu: "x86_64"
+ toolchain_identifier: "clang"
+ }
+
+For a more complete example, build any ``cc_binary`` with Bazel without
+explicitly configuring ``CROSSTOOL``, then look at the ``CROSSTOOL`` that
+Bazel generates for the automatically detected host toolchain. This can
+be found in ``$(bazel info
+output_base)/external/bazel_tools/tools/cpp/CROSSTOOL``. (You have to build
+something with the host toolchain before this will show up).
+
+Some notes:
+
+* ``toolchain_identifier`` is the main name for the toolchain. You'll refer to
+ it using this identifier from other messages and from build files.
+* Most of the other fields at the top of ``toolchain`` are descriptive and
+ can have any value.
+* ``tool_path`` fields describe the various tools Bazel may invoke. The paths
+ are relative to the directory that contains the ``CROSSTOOL`` file.
+* ``compiler_flag`` and ``linker_flag`` are passed to the compiler and linker
+ on each invocation, respectively.
+* ``cxx_builtin_include_directory`` is a directory with include files that
+ the compiler may read. Without this declaration, these files won't be
+ visible in the sandbox. (TODO: make this hermetic).
+
+Step 4: Write a build file
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+We'll create a set of targets that will link the CROSSTOOL into Bazel's
+toolchain system. It's likely this API will change in the future. This will be
+in ``tools/BUILD.bazel``.
+
+First, we'll create some ``filegroups`` that we can reference from other rules.
+
+.. code:: bzl
+
+ package(default_visibility = ["//visibility:public"])
+
+ filegroup(
+ name = "empty",
+ srcs = [],
+ )
+
+ filegroup(
+ name = "all",
+ srcs = glob([
+ "bin/*",
+ "lib/**",
+ "libexec/**",
+ "share/**",
+ ]),
+ )
+
+Next, we'll create a ``cc_toolchain`` target that tells Bazel where to find some
+important files. This API is undocumented and will very likely change in the
+future. We need to create one of these for each ``toolchain`` in ``CROSSTOOL``.
+The ``toolchain_identifier`` and ``cpu`` fields should match, and the
+filegroups should cover the files referenced in ``CROSSTOOL``.
+
+.. code:: bzl
+
+ cc_toolchain(
+ name = "cc-compiler-clang",
+ all_files = ":all",
+ compiler_files = ":all",
+ cpu = "x86_64",
+ dwp_files = ":empty",
+ dynamic_runtime_libs = [":empty"],
+ linker_files = ":all",
+ objcopy_files = ":empty",
+ static_runtime_libs = [":empty"],
+ strip_files = ":empty",
+ supports_param_files = 1,
+ toolchain_identifier = "clang",
+ )
+
+Finally, we'll create a ``cc_toolchain_suite`` target. This should reference
+``cc_toolchain`` targets for all the toolchains in ``CROSSTOOL``. This API is
+also undocumented and will probably change.
+
+.. code:: bzl
+
+ cc_toolchain_suite(
+ name = "clang-toolchain",
+ toolchains = {
+ "x86_64": ":cc-compiler-clang",
+ "x86_64|clang": ":cc-compiler-clang",
+ },
+ )
+
+Step 5: Verify your toolchain works
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+At this point, you should be able to build a simple binary by passing a bunch
+of extra flags to Bazel.
+
+.. code:: bash
+
+ $ mkdir example
+ $ cat >example/hello.c <<EOF
+ #include <stdio.h>
+
+ int main() {
+ printf("Hello, world!\n");
+ return 0;
+ }
+ EOF
+
+ $ cat >example/BUILD.bazel <<EOF
+ cc_binary(
+ name = "hello",
+ srcs = ["hello.c"],
+ )
+ EOF
+
+ $ bazel build \
+ --crosstool_top=//tools:clang-toolchain \
+ --cpu=x86_64 \
+ --compiler=clang \
+ --host_cpu=x86_64 \
+ -s \
+ //example:hello
+
+You should see an invocation of ``tools/bin/clang`` in the output.
+
+* ``--crosstool_top`` should be the label for the ``cc_toolchain_suite`` target
+ defined earlier.
+* ``--cpu=x86_64`` should be the ``cpu`` attribute in ``cc_toolchain`` and in
+ the ``toolchain`` message in ``CROSSTOOL``.
+* ``--compiler=clang`` should be the ``toolchain_identifier`` attribute in
+ ``cc_toolchain`` and in the ``toolchain`` message in ``CROSSTOOL``.
+* ``--host_cpu`` should be the same as ``--cpu``. If we were cross-compiling,
+ it would be the ``cpu`` value for the execution platform (where actions are
+ performed), not the host platform (where Bazel is invoked).
+* ``-s`` prints commands.
+
+Step 6: Configure a Go workspace to use the toolchain
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+In the ``WORSKPACE`` file for your Go project, import the
+``bazel_cc_toolchains`` repository. The way you do this may vary depending on
+where you've put ``bazel_cc_toolchains``.
+
+.. code:: bzl
+
+ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
+
+ git_repository(
+ name = "bazel_cc_toolchains",
+ remote = "https://github.com/jayconrod/bazel_cc_toolchains",
+ tag = "v1.0.0",
+ )
+
+Create a file named ``.bazelrc`` in the root directory of your Go project
+(or add the code below to the end if already exists). Each line comprises a
+Bazel command (such as ``build``), an optional configuration name (``clang``)
+and a list of flags to be passed to Bazel when that configuration is used.
+If the configuration is omitted, the flags will be passed by default.
+
+.. code:: bash
+
+ $ cat >>.bazelrc <<EOF
+ build:clang --crosstool_top=@bazel_cc_toolchains//tools:clang-toolchain
+ build:clang --cpu=x86_64
+ build:clang --compiler=clang
+ build:clang --host_cpu=x86_64
+ EOF
+
+You can build with ``bazel build --config=clang ...``.
+
+Verify the toolchain is being used by compiling a "Hello world" cgo program.
+
+.. code:: bash
+
+ $ cat >hello.go <<EOF
+ package main
+
+ /*
+ #include <stdio.h>
+
+ void say_hello() {
+ printf("Hello, world!\n");
+ }
+ */
+ import "C"
+
+ func main() {
+ C.say_hello()
+ }
+ EOF
+
+ $ cat >BUILD.bazel <<EOF
+ load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+ go_binary(
+ name = "hello",
+ srcs = ["hello.go"],
+ cgo = True,
+ )
+
+ $ bazel build --config=clang -s //:hello
+
+You should see clang commands in Bazel's output.
diff --git a/go/def.bzl b/go/def.bzl
new file mode 100644
index 00000000..08f637a1
--- /dev/null
+++ b/go/def.bzl
@@ -0,0 +1,198 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Public definitions for Go rules.
+
+All public Go rules, providers, and other definitions are imported and
+re-exported in this file. This allows the real location of definitions
+to change for easier maintenance.
+
+Definitions outside this file are private unless otherwise noted, and
+may change without notice.
+"""
+
+load(
+ "//go/private:context.bzl",
+ _go_context = "go_context",
+)
+load(
+ "//go/private:providers.bzl",
+ _GoArchive = "GoArchive",
+ _GoArchiveData = "GoArchiveData",
+ _GoLibrary = "GoLibrary",
+ _GoPath = "GoPath",
+ _GoSDK = "GoSDK",
+ _GoSource = "GoSource",
+)
+load(
+ "//go/private/rules:sdk.bzl",
+ _go_sdk = "go_sdk",
+)
+load(
+ "//go/private:go_toolchain.bzl",
+ _go_toolchain = "go_toolchain",
+)
+load(
+ "//go/private/rules:wrappers.bzl",
+ _go_binary_macro = "go_binary_macro",
+ _go_library_macro = "go_library_macro",
+ _go_test_macro = "go_test_macro",
+)
+load(
+ "//go/private/rules:source.bzl",
+ _go_source = "go_source",
+)
+load(
+ "//extras:embed_data.bzl",
+ _go_embed_data = "go_embed_data",
+)
+load(
+ "//extras:gomock.bzl",
+ _gomock = "gomock",
+)
+load(
+ "//go/private/tools:path.bzl",
+ _go_path = "go_path",
+)
+load(
+ "//go/private/rules:library.bzl",
+ _go_tool_library = "go_tool_library",
+)
+load(
+ "//go/private/rules:nogo.bzl",
+ _nogo = "nogo_wrapper",
+)
+load(
+ "//go/private/rules:cross.bzl",
+ _go_cross_binary = "go_cross_binary",
+)
+
+# TOOLS_NOGO is a list of all analysis passes in
+# golang.org/x/tools/go/analysis/passes.
+# This is not backward compatible, so use caution when depending on this --
+# new analyses may discover issues in existing builds.
+TOOLS_NOGO = [
+ "@org_golang_x_tools//go/analysis/passes/asmdecl:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/assign:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/atomic:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/atomicalign:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/bools:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/buildssa:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/buildtag:go_default_library",
+ # TODO(#2396): pass raw cgo sources to cgocall and re-enable.
+ # "@org_golang_x_tools//go/analysis/passes/cgocall:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/composite:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/copylock:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/ctrlflow:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/deepequalerrors:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/errorsas:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/findcall:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/httpresponse:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/ifaceassert:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/inspect:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/loopclosure:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/lostcancel:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/nilfunc:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/nilness:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/pkgfact:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/printf:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/shadow:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/shift:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/sortslice:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/stdmethods:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/stringintconv:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/structtag:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/testinggoroutine:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/tests:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/unmarshal:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/unreachable:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/unsafeptr:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/unusedresult:go_default_library",
+]
+
+# Current version or next version to be tagged. Gazelle and other tools may
+# check this to determine compatibility.
+RULES_GO_VERSION = "0.39.1"
+
+go_context = _go_context
+go_embed_data = _go_embed_data
+gomock = _gomock
+go_sdk = _go_sdk
+go_tool_library = _go_tool_library
+go_toolchain = _go_toolchain
+nogo = _nogo
+
+# See go/providers.rst#GoLibrary for full documentation.
+GoLibrary = _GoLibrary
+
+# See go/providers.rst#GoSource for full documentation.
+GoSource = _GoSource
+
+# See go/providers.rst#GoPath for full documentation.
+GoPath = _GoPath
+
+# See go/providers.rst#GoArchive for full documentation.
+GoArchive = _GoArchive
+
+# See go/providers.rst#GoArchiveData for full documentation.
+GoArchiveData = _GoArchiveData
+
+# See go/providers.rst#GoSDK for full documentation.
+GoSDK = _GoSDK
+
+# See docs/go/core/rules.md#go_library for full documentation.
+go_library = _go_library_macro
+
+# See docs/go/core/rules.md#go_binary for full documentation.
+go_binary = _go_binary_macro
+
+# See docs/go/core/rules.md#go_test for full documentation.
+go_test = _go_test_macro
+
+# See docs/go/core/rules.md#go_test for full documentation.
+go_source = _go_source
+
+# See docs/go/core/rules.md#go_path for full documentation.
+go_path = _go_path
+
+# See docs/go/core/rules.md#go_cross_binary for full documentation.
+go_cross_binary = _go_cross_binary
+
+def go_vet_test(*_args, **_kwargs):
+ fail("The go_vet_test rule has been removed. Please migrate to nogo instead, which supports vet tests.")
+
+def go_rule(**_kwargs):
+ fail("The go_rule function has been removed. Use rule directly instead. See https://github.com/bazelbuild/rules_go/blob/master/go/toolchains.rst#writing-new-go-rules")
+
+def go_rules_dependencies():
+ _moved("go_rules_dependencies")
+
+def go_register_toolchains(**_kwargs):
+ _moved("go_register_toolchains")
+
+def go_download_sdk(**_kwargs):
+ _moved("go_download_sdk")
+
+def go_host_sdk(**_kwargs):
+ _moved("go_host_sdk")
+
+def go_local_sdk(**_kwargs):
+ _moved("go_local_sdk")
+
+def go_wrap_sdk(**_kwargs):
+ _moved("go_wrap_sdK")
+
+def _moved(name):
+ fail(name + " has moved. Please load from " +
+ " @io_bazel_rules_go//go:deps.bzl instead of def.bzl.")
diff --git a/go/dependencies.rst b/go/dependencies.rst
new file mode 100644
index 00000000..0162f1ec
--- /dev/null
+++ b/go/dependencies.rst
@@ -0,0 +1,267 @@
+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/googleapis/googleapis: https://github.com/googleapis/googleapis
+.. _github.com/mwitkow/go-proto-validators: https://github.com/mwitkow/go-proto-validators
+.. _golang.org/x/net: https://github.com/golang/net/
+.. _golang.org/x/sys: https://github.com/golang/sys/
+.. _golang.org/x/text: https://github.com/golang/text/
+.. _golang.org/x/tools: https://github.com/golang/tools/
+.. _google.golang.org/genproto: https://github.com/google/go-genproto
+.. _google.golang.org/grpc: https://github.com/grpc/grpc-go
+.. _http_archive: https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/repo/http.bzl
+.. _nested workspaces: https://bazel.build/designs/2016/09/19/recursive-ws-parsing.html
+.. _nogo: nogo.rst#nogo
+.. _normal go logic: https://golang.org/cmd/go/#hdr-Remote_import_paths
+.. _repositories.bzl: https://github.com/bazelbuild/rules_go/blob/master/go/private/repositories.bzl
+.. _rules_proto: https://github.com/bazelbuild/rules_proto
+.. _third_party: https://github.com/bazelbuild/rules_go/tree/master/third_party
+.. _toolchains: toolchains.rst
+
+.. Go rules
+.. _go_library: /docs/go/core/rules.md#go_library
+.. _go_proto_library: https://github.com/bazelbuild/rules_go/blob/master/proto/core.rst#go-proto-library
+.. _go_register_toolchains: toolchains.rst#go_register_toolchains
+.. _go_repository: https://github.com/bazelbuild/bazel-gazelle/blob/master/repository.md#go_repository
+.. _go_toolchain: toolchains.rst#go_toolchain
+
+.. Other rules
+.. _git_repository: https://github.com/bazelbuild/bazel/blob/master/tools/build_defs/repo/git.bzl
+.. _proto_library: https://github.com/bazelbuild/rules_proto
+
+.. Issues
+.. _#1986: https://github.com/bazelbuild/rules_go/issues/1986
+
+.. role:: param(kbd)
+.. role:: type(emphasis)
+.. role:: value(code)
+.. |mandatory| replace:: **mandatory value**
+
+This document describes workspace rules, functions, and dependencies intended
+to be used in the ``WORKSPACE`` file.a
+
+See also the `toolchains`_ for information on `go_register_toolchains`_ and
+other rules used to download and register toolchains.
+
+Contents
+--------
+
+* `go_rules_dependencies`_
+* `Proto dependencies`_
+* `gRPC dependencies`_
+* `Overriding dependencies`_
+
+
+go_rules_dependencies
+---------------------
+
+``go_rules_dependencies`` is a function that registers external dependencies
+needed by the Go rules. Projects that use rules_go should *always* call it from
+WORKSPACE. It may be called before or after other workspace rules.
+
+See `Overriding dependencies`_ for instructions on using a different version
+of one of the repositories below.
+
+``go_rules_dependencies`` declares the repositories in the table below.
+It also declares some internal repositories not described here.
+
++-------------------------------------------------+-------------------------------------------+
+| **Name** | **Path** |
++-------------------------------------------------+-------------------------------------------+
+| :value:`bazel_skylib` | `github.com/bazelbuild/bazel-skylib`_ |
++-------------------------------------------------+-------------------------------------------+
+| A library of useful Starlark functions, used in the implementation |
+| of rules_go. |
++-------------------------------------------------+-------------------------------------------+
+| :value:`org_golang_x_tools` | `golang.org/x/tools`_ |
++-------------------------------------------------+-------------------------------------------+
+| The Go tools module. Provides the analysis framework that nogo_ is based on. |
+| Also provides other package loading and testing infrastructure. |
++-------------------------------------------------+-------------------------------------------+
+| :value:`com_github_golang_protobuf` | `github.com/golang/protobuf`_ |
++-------------------------------------------------+-------------------------------------------+
+| The Go protobuf plugin and runtime. When overriding this, make sure to use |
+| ``@io_bazel_rules_go//third_party:com_github_golang_protobuf-extras.patch``. |
+| This is needed to support both pre-generated and dynamically generated |
+| proto libraries. |
++-------------------------------------------------+-------------------------------------------+
+| :value:`com_github_mwitkow_go_proto_validators` | `github.com/mwitkow/go-proto-validators`_ |
++-------------------------------------------------+-------------------------------------------+
+| 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, |
+| ``go_rules_dependencies`` should provide this, but it doesn't change often, |
+| and many things break without it. |
++-------------------------------------------------+-------------------------------------------+
+| :value:`go_googleapis` | `github.com/googleapis/googleapis`_ |
++-------------------------------------------------+-------------------------------------------+
+| Like :value:`org_golang_google_genproto` but provides ``go_proto_library`` |
+| targets instead of ``go_library``. Ideally we should use |
+| ``com_google_googleapis``, but Gazelle still resolves imports to this repo. |
+| See `#1986`_. |
++-------------------------------------------------+-------------------------------------------+
+
+Proto dependencies
+------------------
+
+In order to build `proto_library`_ and `go_proto_library`_ rules, you must
+add a dependency on ``com_google_protobuf`` in order to build the ``protoc``
+compiler. Version 3.14.0 is the minimum supported version, but higher minor
+versions shoudl work. You'll need a C/C++ toolchain for the execution platform
+to build ``protoc``.
+
+.. code:: bzl
+
+ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+ http_archive(
+ name = "com_google_protobuf",
+ sha256 = "d0f5f605d0d656007ce6c8b5a82df3037e1d8fe8b121ed42e536f569dec16113",
+ strip_prefix = "protobuf-3.14.0",
+ urls = [
+ "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz",
+ "https://github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz",
+ ],
+ )
+
+ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
+
+ protobuf_deps()
+
+The `proto_library`_ rule is provided by the `rules_proto`_
+repository. ``protoc-gen-go``, the Go proto compiler plugin, is provided by the
+repository ``com_github_golang_protobuf``. Both are declared by
+`go_rules_dependencies`_ by default. You won't need to declare an
+explicit dependency unless you specifically want to use a different version. See
+`Overriding dependencies`_ for instructions on using a different version.
+
+gRPC dependencies
+-----------------
+
+In order to build ``go_proto_library`` rules with the gRPC plugin,
+several additional dependencies are needed. At minimum, you'll need to
+declare ``org_golang_google_grpc``, ``org_golang_x_net``, and
+``org_golang_x_text``.
+
+If you're using Gazelle, and you already import ``google.golang.org/grpc``
+from a .go file somewhere in your repository, and you're also using Go modules
+to manage dependencies, you can generate these rules with
+``bazel run //:gazelle -- update-repos -from_file=go.mod``.
+
+Make sure you set ``build_file_proto_mode = "disable"`` on the
+`go_repository`_ rule for ``org_golang_google_grpc``.
+
+For example:
+
+.. code:: bzl
+
+ load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies", "go_repository")
+
+ gazelle_dependencies()
+
+ go_repository(
+ name = "org_golang_google_grpc",
+ build_file_proto_mode = "disable",
+ importpath = "google.golang.org/grpc",
+ sum = "h1:J0UbZOIrCAl+fpTOf8YLs4dJo8L/owV4LYVtAXQoPkw=",
+ version = "v1.22.0",
+ )
+
+ go_repository(
+ name = "org_golang_x_net",
+ importpath = "golang.org/x/net",
+ sum = "h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=",
+ version = "v0.0.0-20190311183353-d8887717615a",
+ )
+
+ go_repository(
+ name = "org_golang_x_text",
+ importpath = "golang.org/x/text",
+ sum = "h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=",
+ version = "v0.3.0",
+ )
+
+Overriding dependencies
+-----------------------
+
+You can override a dependency declared in ``go_rules_dependencies`` by
+declaring a repository rule in WORKSPACE with the same name *before* the call
+to ``go_rules_dependencies``.
+
+For example, this is how you would override ``com_github_golang_protobuf``:
+
+.. code:: bzl
+
+ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
+
+ http_archive(
+ name = "io_bazel_rules_go",
+ sha256 = "7b9bbe3ea1fccb46dcfa6c3f3e29ba7ec740d8733370e21cdc8937467b4a4349",
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.22.4/rules_go-v0.22.4.tar.gz",
+ "https://github.com/bazelbuild/rules_go/releases/download/v0.22.4/rules_go-v0.22.4.tar.gz",
+ ],
+ )
+
+ http_archive(
+ name = "bazel_gazelle",
+ sha256 = "d8c45ee70ec39a57e7a05e5027c32b1576cc7f16d9dd37135b0eddde45cf1b10",
+ urls = [
+ "https://storage.googleapis.com/bazel-mirror/github.com/bazelbuild/bazel-gazelle/releases/download/v0.20.0/bazel-gazelle-v0.20.0.tar.gz",
+ "https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.20.0/bazel-gazelle-v0.20.0.tar.gz",
+ ],
+ )
+
+ http_archive(
+ name = "com_google_protobuf",
+ sha256 = "d0f5f605d0d656007ce6c8b5a82df3037e1d8fe8b121ed42e536f569dec16113",
+ strip_prefix = "protobuf-3.14.0",
+ urls = [
+ "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.14.0.tar.gz",
+ "https://github.com/protocolbuffers/protobuf/archive/v3.14.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_repository")
+ load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
+
+ go_repository(
+ name = "com_github_golang_protobuf",
+ build_file_proto_mode = "disable_global",
+ importpath = "github.com/golang/protobuf",
+ patch_args = ["-p1"],
+ patches = ["@io_bazel_rules_go//third_party:com_github_golang_protobuf-extras.patch"],
+ sum = "h1:F768QJ1E9tib+q5Sc8MkdJi1RxLTbRcTf8LJV56aRls=",
+ version = "v1.3.5",
+ )
+
+ go_rules_dependencies()
+
+ go_register_toolchains()
+
+ gazelle_dependencies()
+
+ protobuf_deps()
+
+Some of the dependencies declared by ``go_rules_dependencies`` require
+additional patches and or adjustments compared to what `go_repository`_
+generates by default (as ``com_github_golang_protobuf`` does in the example
+above). Patches may be found in the `third_party`_ directory.
+See notes in `repositories.bzl`_. If you're generated build files with
+`go_repository`_, you do not need the ``*-gazelle.patch`` files.
diff --git a/go/deps.bzl b/go/deps.bzl
new file mode 100644
index 00000000..8e020f14
--- /dev/null
+++ b/go/deps.bzl
@@ -0,0 +1,39 @@
+# Copyright 2019 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# deps.bzl loads definitions for use in WORKSPACE files. It's important
+# to keep this file and the .bzl files it loads separate from the files
+# loaded by def.bzl. def.bzl and its dependencies may depend on repositories
+# declared here, but at the time this file is loaded, we can't assume
+# anything has been declared.
+
+load(
+ "//go/private:repositories.bzl",
+ _go_rules_dependencies = "go_rules_dependencies",
+)
+load(
+ "//go/private:sdk.bzl",
+ _go_download_sdk = "go_download_sdk",
+ _go_host_sdk = "go_host_sdk",
+ _go_local_sdk = "go_local_sdk",
+ _go_register_toolchains = "go_register_toolchains",
+ _go_wrap_sdk = "go_wrap_sdk",
+)
+
+go_rules_dependencies = _go_rules_dependencies
+go_register_toolchains = _go_register_toolchains
+go_download_sdk = _go_download_sdk
+go_host_sdk = _go_host_sdk
+go_local_sdk = _go_local_sdk
+go_wrap_sdk = _go_wrap_sdk
diff --git a/go/extensions.bzl b/go/extensions.bzl
new file mode 100644
index 00000000..f7c86ada
--- /dev/null
+++ b/go/extensions.bzl
@@ -0,0 +1,3 @@
+load("//go/private:extensions.bzl", _go_sdk = "go_sdk")
+
+go_sdk = _go_sdk
diff --git a/go/extras.rst b/go/extras.rst
new file mode 100644
index 00000000..63f82887
--- /dev/null
+++ b/go/extras.rst
@@ -0,0 +1,3 @@
+.. _extras.md: /docs/go/extras/extras.md
+
+This file has moved, please find it at extras.md_.
diff --git a/go/modes.rst b/go/modes.rst
new file mode 100644
index 00000000..431049d5
--- /dev/null
+++ b/go/modes.rst
@@ -0,0 +1,171 @@
+Build modes
+===========
+
+.. _Bazel build settings: https://docs.bazel.build/versions/master/skylark/config.html#using-build-settings
+.. _Bazel configuration transitions: https://docs.bazel.build/versions/master/skylark/lib/transition.html
+.. _Bazel platform: https://docs.bazel.build/versions/master/platforms.html
+
+.. _go_library: /docs/go/core/rules.md#go_library
+.. _go_binary: /docs/go/core/rules.md#go_binary
+.. _go_test: /docs/go/core/rules.md#go_test
+.. _toolchain: toolchains.rst#the-toolchain-object
+
+.. _config_setting: https://docs.bazel.build/versions/master/be/general.html#config_setting
+.. _platform: https://docs.bazel.build/versions/master/be/platform.html#platform
+.. _select: https://docs.bazel.build/versions/master/be/functions.html#select
+
+.. role:: param(kbd)
+.. role:: type(emphasis)
+.. role:: value(code)
+
+.. contents:: :depth: 2
+
+Overview
+--------
+
+The Go toolchain can be configured to build targets in different modes using
+`Bazel build settings`_ specified on the command line or by using attributes
+specified on individual `go_binary`_ or `go_test`_ targets. For example, tests
+may be run in race mode with the command line flag
+``--@io_bazel_rules_go//go/config:race`` or by setting ``race = "on"`` on the
+individual test targets.
+
+Similarly, the Go toolchain can be made to cross-compile binaries for a specific
+platform by setting the ``--platforms`` command line flag or by setting the
+``goos`` and ``goarch`` attributes of the binary target. For example, a binary
+could be built for ``linux`` / ``arm64`` using the command line flag
+``--platforms=@io_bazel_rules_go//go/toolchain:linux_arm64`` or by setting
+``goos = "linux"`` and ``goarch = "arm64"``.
+
+Build settings
+--------------
+
+The build settings below are defined in the package
+``@io_bazel_rules_go//go/config``. They can all be set on the command line
+or using `Bazel configuration transitions`_.
+
++-------------------+----------------+-----------------------------------------+
+| **Name** | **Type** | **Default value** |
++-------------------+---------------------+------------------------------------+
+| :param:`static` | :type:`bool` | :value:`false` |
++-------------------+---------------------+------------------------------------+
+| Statically links the target binary. May not always work since parts of the |
+| standard library and other C dependencies won't tolerate static linking. |
+| Works best with ``pure`` set as well. |
++-------------------+---------------------+------------------------------------+
+| :param:`race` | :type:`bool` | :value:`false` |
++-------------------+---------------------+------------------------------------+
+| Instruments the binary for race detection. Programs will panic when a data |
+| race is detected. Requires cgo. Mutually exclusive with ``msan``. |
++-------------------+---------------------+------------------------------------+
+| :param:`msan` | :type:`bool` | :value:`false` |
++-------------------+---------------------+------------------------------------+
+| Instruments the binary for memory sanitization. Requires cgo. Mutually |
+| exclusive with ``race``. |
++-------------------+---------------------+------------------------------------+
+| :param:`pure` | :type:`bool` | :value:`false` |
++-------------------+---------------------+------------------------------------+
+| Disables cgo, even when a C/C++ toolchain is configured (similar to setting |
+| ``CGO_ENABLED=0``). Packages that contain cgo code may still be built, but |
+| the cgo code will be filtered out, and the ``cgo`` build tag will be false. |
++-------------------+---------------------+------------------------------------+
+| :param:`debug` | :type:`bool` | :value:`false` |
++-------------------+---------------------+------------------------------------+
+| Includes debugging information in compiled packages (using the ``-N`` and |
+| ``-l`` flags). This is always true with ``-c dbg``. |
++-------------------+---------------------+------------------------------------+
+| :param:`gotags` | :type:`string_list` | :value:`[]` |
++-------------------+---------------------+------------------------------------+
+| Controls which build tags are enabled when evaluating build constraints in |
+| source files. Useful for conditional compilation. |
++-------------------+---------------------+------------------------------------+
+| :param:`linkmode` | :type:`string` | :value:`"normal"` |
++-------------------+---------------------+------------------------------------+
+| Determines how the Go binary is built and linked. Similar to ``-buildmode``. |
+| Must be one of ``"normal"``, ``"shared"``, ``"pie"``, ``"plugin"``, |
+| ``"c-shared"``, ``"c-archive"``. |
++-------------------+---------------------+------------------------------------+
+
+Platforms
+---------
+
+You can define a `Bazel platform`_ using the native `platform`_ rule. A platform
+is essentially a list of facts (constraint values) about a target platform.
+rules_go defines a ``platform`` for each configuration the Go toolchain supports
+in ``@io_bazel_rules_go//go/toolchain``. There are also `config_setting`_ targets
+in ``@io_bazel_rules_go//go/platform`` that can be used to pick platform-specific
+sources or dependencies using `select`_.
+
+You can specify a target platform using the ``--platforms`` command line flag.
+Bazel will automatically select a registered toolchain compatible with the
+target platform (rules_go registers toolchains for all supported platforms).
+For example, you could build for Linux / arm64 with the flag
+``--platforms=@io_bazel_rules_go//go/toolchain:linux_arm64``.
+
+You can set the ``goos`` and ``goarch`` attributes on an individual
+`go_binary`_ or `go_test`_ rule to build a binary for a specific platform.
+This sets the ``--platforms`` flag via `Bazel configuration transitions`_.
+
+
+Examples
+--------
+
+Building pure go binaries
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You can switch the default binaries to non cgo using
+
+.. code:: bash
+ bazel build --@io_bazel_rules_go//go/config:pure //:my_binary
+You can build pure go binaries by setting those attributes on a binary.
+
+.. code:: bzl
+
+ go_binary(
+ name = "foo",
+ srcs = ["foo.go"],
+ pure = "on",
+ )
+
+
+Building static binaries
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+| Note that static linking does not work on darwin.
+
+You can switch the default binaries to statically linked binaries using
+
+.. code:: bash
+ bazel build --@io_bazel_rules_go//go/config:static //:my_binary
+You can build static go binaries by setting those attributes on a binary.
+If you want it to be fully static (no libc), you should also specify pure.
+
+.. code:: bzl
+
+ go_binary(
+ name = "foo",
+ srcs = ["foo.go"],
+ static = "on",
+ )
+
+
+Using the race detector
+~~~~~~~~~~~~~~~~~~~~~~~
+
+You can switch the default binaries to race detection mode, and thus also switch
+the mode of tests by using
+
+.. code::
+
+ bazel test --@io_bazel_rules_go//go/config:race //...
+
+Alternatively, you can activate race detection for specific tests.
+
+.. code::
+
+ go_test(
+ name = "go_default_test",
+ srcs = ["lib_test.go"],
+ embed = [":go_default_library"],
+ race = "on",
+ )
diff --git a/go/nogo.rst b/go/nogo.rst
new file mode 100644
index 00000000..7e3183cd
--- /dev/null
+++ b/go/nogo.rst
@@ -0,0 +1,406 @@
+|logo| nogo build-time code analysis
+====================================
+
+.. _nogo: nogo.rst#nogo
+.. _configuring-analyzers: nogo.rst#configuring-analyzers
+.. _go_library: /docs/go/core/rules.md#go_library
+.. _analysis: https://godoc.org/golang.org/x/tools/go/analysis
+.. _Analyzer: https://godoc.org/golang.org/x/tools/go/analysis#Analyzer
+.. _GoLibrary: providers.rst#GoLibrary
+.. _GoSource: providers.rst#GoSource
+.. _GoArchive: providers.rst#GoArchive
+.. _vet: https://golang.org/cmd/vet/
+.. _golangci-lint: https://github.com/golangci/golangci-lint
+.. _staticcheck: https://staticcheck.io/
+.. _sluongng/nogo-analyzer: https://github.com/sluongng/nogo-analyzer
+
+.. role:: param(kbd)
+.. role:: type(emphasis)
+.. role:: value(code)
+.. |mandatory| replace:: **mandatory value**
+.. |logo| image:: nogo_logo.png
+.. footer:: The ``nogo`` logo was derived from the Go gopher, which was designed by Renee French. (http://reneefrench.blogspot.com/) The design is licensed under the Creative Commons 3.0 Attributions license. Read this article for more details: http://blog.golang.org/gopher
+
+
+**WARNING**: This functionality is experimental, so its API might change.
+Please do not rely on it for production use, but feel free to use it and file
+issues.
+
+``nogo`` is a tool that analyzes the source code of Go programs. It runs
+alongside the Go compiler in the Bazel Go rules and rejects programs that
+contain disallowed coding patterns. In addition, ``nogo`` may report
+compiler-like errors.
+
+``nogo`` is a powerful tool for preventing bugs and code anti-patterns early
+in the development process. It may be used to run the same analyses as `vet`_,
+and you can write new analyses for your own code base.
+
+.. contents:: .
+ :depth: 2
+
+-----
+
+Setup
+-----
+
+Create a `nogo`_ target in a ``BUILD`` file in your workspace. The ``deps``
+attribute of this target must contain labels all the analyzers targets that you
+want to run.
+
+.. code:: bzl
+
+ load("@io_bazel_rules_go//go:def.bzl", "nogo")
+
+ nogo(
+ name = "my_nogo",
+ deps = [
+ # analyzer from the local repository
+ ":importunsafe",
+ # analyzer from a remote repository
+ "@org_golang_x_tools//go/analysis/passes/printf:go_default_library",
+ ],
+ visibility = ["//visibility:public"], # must have public visibility
+ )
+
+ go_library(
+ name = "importunsafe",
+ srcs = ["importunsafe.go"],
+ importpath = "importunsafe",
+ deps = ["@org_golang_x_tools//go/analysis:go_default_library"],
+ visibility = ["//visibility:public"],
+ )
+
+Pass a label for your `nogo`_ target to ``go_register_toolchains`` in your
+``WORKSPACE`` file.
+
+.. code:: bzl
+
+ load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
+ go_rules_dependencies()
+ go_register_toolchains(nogo = "@//:my_nogo") # my_nogo is in the top-level BUILD file of this workspace
+
+**NOTE**: You must include ``"@//"`` prefix when referring to targets in the local
+workspace.
+
+The `nogo`_ rule will generate a program that executes all the supplied
+analyzers at build-time. The generated ``nogo`` program will run alongside the
+compiler when building any Go target (e.g. `go_library`_) within your workspace,
+even if the target is imported from an external repository. However, ``nogo``
+will not run when targets from the current repository are imported into other
+workspaces and built there.
+
+To run all the ``golang.org/x/tools`` analyzers, use ``@io_bazel_rules_go//:tools_nogo``.
+
+.. code:: bzl
+
+ load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
+ go_rules_dependencies()
+ go_register_toolchains(nogo = "@io_bazel_rules_go//:tools_nogo")
+
+To run the analyzers from ``tools_nogo`` together with your own analyzers, use
+the ``TOOLS_NOGO`` list of dependencies.
+
+.. code:: bzl
+
+ load("@io_bazel_rules_go//go:def.bzl", "nogo", "TOOLS_NOGO")
+
+ nogo(
+ name = "my_nogo",
+ deps = TOOLS_NOGO + [
+ # analyzer from the local repository
+ ":importunsafe",
+ ],
+ visibility = ["//visibility:public"], # must have public visibility
+ )
+
+ go_library(
+ name = "importunsafe",
+ srcs = ["importunsafe.go"],
+ importpath = "importunsafe",
+ deps = ["@org_golang_x_tools//go/analysis:go_library"],
+ visibility = ["//visibility:public"],
+ )
+
+Usage
+---------------------------------
+
+``nogo``, upon configured, will be invoked automatically when building any Go target in your
+workspace. If any of the analyzers reject the program, the build will fail.
+
+``nogo`` will run on all Go targets in your workspace, including tests and binary targets.
+It will also run on targets that are imported from other workspaces by default. You could
+exclude the external repositories from ``nogo`` by using the `exclude_files` regex in
+`configuring-analyzers`_.
+
+Relationship with other linters
+~~~~~~~~~~~~~~~~~~~~~
+
+In Golang, a linter is composed of multiple parts:
+
+- A collection of rules (checks) that define different validations against the source code
+
+- Optionally, each rules could be coupled with a fixer that can automatically fix the code.
+
+- A configuration framework that allows users to enable/disable rules, and configure the rules.
+
+- A runner binary that orchestrate the above components.
+
+To help with the above, Go provides a framework called `analysis`_ that allows
+you to write a linter in a modular way. In which, you could define each rules as a separate
+`Analyzer`_, and then compose them together in a runner binary.
+
+For example, `golangci-lint`_ or `staticcheck`_ are popular linters that are composed of multiple
+analyzers, each of which is a collection of rules.
+
+``nogo`` is a runner binary that runs a collection of analyzers while leveraging Bazel's
+action orchestration framework. In particular, ``nogo`` is run as part of rules_go GoCompilePkg
+action, and it is run in parallel with the Go compiler. This allows ``nogo`` to benefit from
+Bazel's incremental build and caching as well as the Remote Build Execution framework.
+
+There are examples of how to re-use the analyzers from `golangci-lint`_ and `staticcheck`_ in
+`nogo`_ here: `sluongng/nogo-analyzer`_.
+
+Should I use ``nogo`` or ``golangci-lint``?
+~~~~~~~~~~~~~~~~~~~~~
+
+Because ``nogo`` benefits from Bazel's incremental build and caching, it is more suitable for
+large code bases. If you have a smaller code base, you could use ``golangci-lint`` instead.
+
+If ``golangci-lint`` takes a really long time to run in your repository, you could try to use
+``nogo`` instead.
+
+As of the moment of this writing, there is no way for ``nogo`` to apply the fixers coupled
+with the analyzers. So separate linters such as ``golangci-lint`` or ``staticcheck`` are more
+ergonomic to apply the fixes to the code base.
+
+Writing and registering analyzers
+---------------------------------
+
+``nogo`` analyzers are Go packages that declare a variable named ``Analyzer``
+of type `Analyzer`_ from package `analysis`_. Each analyzer is invoked once per
+Go package, and is provided the abstract syntax trees (ASTs) and type
+information for that package, as well as relevant results of analyzers that have
+already been run. For example:
+
+.. code:: go
+
+ // package importunsafe checks whether a Go package imports package unsafe.
+ package importunsafe
+
+ import (
+ "strconv"
+
+ "golang.org/x/tools/go/analysis"
+ )
+
+ var Analyzer = &analysis.Analyzer{
+ Name: "importunsafe",
+ Doc: "reports imports of package unsafe",
+ Run: run,
+ }
+
+ func run(pass *analysis.Pass) (interface{}, error) {
+ for _, f := range pass.Files {
+ for _, imp := range f.Imports {
+ path, err := strconv.Unquote(imp.Path.Value)
+ if err == nil && path == "unsafe" {
+ pass.Reportf(imp.Pos(), "package unsafe must not be imported")
+ }
+ }
+ }
+ return nil, nil
+ }
+
+Any diagnostics reported by the analyzer will stop the build. Do not emit
+diagnostics unless they are severe enough to warrant stopping the build.
+
+Pass labels for these targets to the ``deps`` attribute of your `nogo`_ target,
+as described in the `Setup`_ section.
+
+Configuring analyzers
+~~~~~~~~~~~~~~~~~~~~~
+
+By default, ``nogo`` analyzers will emit diagnostics for all Go source files
+built by Bazel. This behavior can be changed with a JSON configuration file.
+
+The top-level JSON object in the file must be keyed by the name of the analyzer
+being configured. These names must match the ``Analyzer.Name`` of the registered
+analysis package. The JSON object's values are themselves objects which may
+contain the following key-value pairs:
+
++----------------------------+---------------------------------------------------------------------+
+| **Key** | **Type** |
++----------------------------+---------------------------------------------------------------------+
+| ``"description"`` | :type:`string` |
++----------------------------+---------------------------------------------------------------------+
+| Description of this analyzer configuration. |
++----------------------------+---------------------------------------------------------------------+
+| ``"only_files"`` | :type:`dictionary, string to string` |
++----------------------------+---------------------------------------------------------------------+
+| Specifies files that this analyzer will emit diagnostics for. |
+| Its keys are regular expression strings matching Go file names, and its values are strings |
+| containing a description of the entry. |
+| If both ``only_files`` and ``exclude_files`` are empty, this analyzer will emit diagnostics for |
+| all Go files built by Bazel. |
++----------------------------+---------------------------------------------------------------------+
+| ``"exclude_files"`` | :type:`dictionary, string to string` |
++----------------------------+---------------------------------------------------------------------+
+| Specifies files that this analyzer will not emit diagnostics for. |
+| Its keys and values are strings that have the same semantics as those in ``only_files``. |
+| Keys in ``exclude_files`` override keys in ``only_files``. If a .go file matches a key present |
+| in both ``only_files`` and ``exclude_files``, the analyzer will not emit diagnostics for that |
+| file. |
++----------------------------+---------------------------------------------------------------------+
+| ``"analyzer_flags"`` | :type:`dictionary, string to string` |
++----------------------------+---------------------------------------------------------------------+
+| Passes on a set of flags as defined by the Go ``flag`` package to the analyzer via the |
+| ``analysis.Analyzer.Flags`` field. Its keys are the flag names *without* a ``-`` prefix, and its |
+| values are the flag values. nogo will exit with an error upon receiving flags not recognized by |
+| the analyzer or upon receiving ill-formatted flag values as defined by the corresponding |
+| ``flag.Value`` specified by the analyzer. |
++----------------------------+---------------------------------------------------------------------+
+
+``nogo`` also supports a special key to specify the same config for all analyzers, even if they are
+not explicitly specified called ``_base``. See below for an example of its usage.
+
+Example
+^^^^^^^
+
+The following configuration file configures the analyzers named ``importunsafe``
+and ``unsafedom``. Since the ``loopclosure`` analyzer is not explicitly
+configured, it will emit diagnostics for all Go files built by Bazel.
+``unsafedom`` will receive a flag equivalent to ``-block-unescaped-html=false``
+on a command line driver.
+
+.. code:: json
+
+ {
+ "_base": {
+ "description": "Base config that all subsequent analyzers, even unspecified will inherit.",
+ "exclude_files": {
+ "third_party/": "exclude all third_party code for all analyzers"
+ }
+ },
+ "importunsafe": {
+ "exclude_files": {
+ "src/foo\\.go": "manually verified that behavior is working-as-intended",
+ "src/bar\\.go": "see issue #1337"
+ }
+ },
+ "unsafedom": {
+ "only_files": {
+ "src/js/.*": ""
+ },
+ "exclude_files": {
+ "src/(third_party|vendor)/.*": "enforce DOM safety requirements only on first-party code"
+ },
+ "analyzer_flags": {
+ "block-unescaped-html": "false",
+ },
+ }
+ }
+
+This label referencing this configuration file must be provided as the
+``config`` attribute value of the ``nogo`` rule.
+
+.. code:: bzl
+
+ nogo(
+ name = "my_nogo",
+ deps = [
+ ":importunsafe",
+ ":unsafedom",
+ "@analyzers//:loopclosure",
+ ],
+ config = "config.json",
+ visibility = ["//visibility:public"],
+ )
+
+Running vet
+-----------
+
+`vet`_ is a tool that examines Go source code and reports correctness issues not
+caught by Go compilers. It is included in the official Go distribution. Vet
+runs analyses built with the Go `analysis`_ framework. nogo uses the
+same framework, which means vet checks can be run with nogo.
+
+You can choose to run a safe subset of vet checks alongside the Go compiler by
+setting ``vet = True`` in your `nogo`_ target. This will only run vet checks
+that are believed to be 100% accurate (the same set run by ``go test`` by
+default).
+
+.. code:: bzl
+
+ nogo(
+ name = "my_nogo",
+ vet = True,
+ visibility = ["//visibility:public"],
+ )
+
+Setting ``vet = True`` is equivalent to adding the ``atomic``, ``bools``,
+``buildtag``, ``nilfunc``, and ``printf`` analyzers from
+``@org_golang_x_tools//go/analysis/passes`` to the ``deps`` list of your
+``nogo`` rule.
+
+
+See the full list of available nogo checks:
+
+.. code:: shell
+
+ bazel query 'kind(go_library, @org_golang_x_tools//go/analysis/passes/...)'
+
+
+API
+---
+
+nogo
+~~~~
+
+This generates a program that analyzes the source code of Go programs. It
+runs alongside the Go compiler in the Bazel Go rules and rejects programs that
+contain disallowed coding patterns.
+
+Attributes
+^^^^^^^^^^
+
++----------------------------+-----------------------------+---------------------------------------+
+| **Name** | **Type** | **Default value** |
++----------------------------+-----------------------------+---------------------------------------+
+| :param:`name` | :type:`string` | |mandatory| |
++----------------------------+-----------------------------+---------------------------------------+
+| A unique name for this rule. |
++----------------------------+-----------------------------+---------------------------------------+
+| :param:`deps` | :type:`label_list` | :value:`None` |
++----------------------------+-----------------------------+---------------------------------------+
+| List of Go libraries that will be linked to the generated nogo binary. |
+| |
+| These libraries must declare an ``analysis.Analyzer`` variable named `Analyzer` to ensure that |
+| the analyzers they implement are called by nogo. |
+| |
++----------------------------+-----------------------------+---------------------------------------+
+| :param:`config` | :type:`label` | :value:`None` |
++----------------------------+-----------------------------+---------------------------------------+
+| JSON configuration file that configures one or more of the analyzers in ``deps``. |
++----------------------------+-----------------------------+---------------------------------------+
+| :param:`vet` | :type:`bool` | :value:`False` |
++----------------------------+-----------------------------+---------------------------------------+
+| If true, a safe subset of vet checks will be run by nogo (the same subset run |
+| by ``go test ``). |
++----------------------------+-----------------------------+---------------------------------------+
+
+Example
+^^^^^^^
+
+.. code:: bzl
+
+ nogo(
+ name = "my_nogo",
+ deps = [
+ ":importunsafe",
+ ":otheranalyzer",
+ "@analyzers//:unsafedom",
+ ],
+ config = ":config.json",
+ vet = True,
+ visibility = ["//visibility:public"],
+ )
diff --git a/go/nogo_logo.png b/go/nogo_logo.png
new file mode 100644
index 00000000..fff25930
--- /dev/null
+++ b/go/nogo_logo.png
Binary files differ
diff --git a/go/platform/BUILD.bazel b/go/platform/BUILD.bazel
new file mode 100644
index 00000000..5f31f37d
--- /dev/null
+++ b/go/platform/BUILD.bazel
@@ -0,0 +1,38 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+
+# This file declares a config_setting for each platform supported by the
+# Go SDK. These rules follow a goos_goarch naming convention, for example,
+# //go/platform:linux_amd64
+#
+# These can be used in select expressions to choose platform-specifc
+# sources and dependencies.
+
+load(":list.bzl", "declare_config_settings")
+
+package(default_visibility = ["//visibility:public"])
+
+declare_config_settings()
+
+filegroup(
+ name = "all_rules",
+ srcs = glob(["*.bzl"]),
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+bzl_library(
+ name = "list",
+ srcs = ["list.bzl"],
+ deps = ["//go/private:platforms"],
+)
+
+bzl_library(
+ name = "apple",
+ srcs = ["apple.bzl"],
+)
diff --git a/go/platform/apple.bzl b/go/platform/apple.bzl
new file mode 100644
index 00000000..45c62d6c
--- /dev/null
+++ b/go/platform/apple.bzl
@@ -0,0 +1,48 @@
+# Copyright 2018 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+_PLATFORMS = {
+ "armv7-apple-ios": (apple_common.platform.ios_device, apple_common.platform_type.ios),
+ "armv7-apple-tvos": (apple_common.platform.tvos_device, apple_common.platform_type.tvos),
+ "armv7k-apple-watchos": (apple_common.platform.watchos_device, apple_common.platform_type.watchos),
+ "arm64-apple-ios": (apple_common.platform.ios_device, apple_common.platform_type.ios),
+ "arm64-apple-tvos": (apple_common.platform.tvos_device, apple_common.platform_type.tvos),
+ "i386-apple-ios": (apple_common.platform.ios_simulator, apple_common.platform_type.ios),
+ "i386-apple-tvos": (apple_common.platform.tvos_simulator, apple_common.platform_type.tvos),
+ "i386-apple-watchos": (apple_common.platform.watchos_simulator, apple_common.platform_type.watchos),
+ "x86_64-apple-ios": (apple_common.platform.ios_simulator, apple_common.platform_type.ios),
+ "x86_64-apple-tvos": (apple_common.platform.ios_simulator, apple_common.platform_type.tvos),
+ "x86_64-apple-watchos": (apple_common.platform.watchos_simulator, apple_common.platform_type.watchos),
+}
+
+def _apple_version_min(ctx, platform, platform_type):
+ xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig]
+ min_os = str(xcode_config.minimum_os_for_platform_type(platform_type))
+ return "-m{}-version-min={}".format(platform.name_in_plist.lower(), min_os)
+
+def _apple_env(ctx, platform):
+ xcode_config = ctx.attr._xcode_config[apple_common.XcodeVersionConfig]
+ return apple_common.target_apple_env(xcode_config, platform)
+
+def apple_ensure_options(ctx, env, _tags, compiler_option_lists, linker_option_lists, target_gnu_system_name):
+ """Returns environment, flags, and Go tags for Apple targets."""
+ platform, platform_type = _PLATFORMS.get(target_gnu_system_name, (None, None))
+ if not platform:
+ return
+ env.update(_apple_env(ctx, platform))
+ min_version = _apple_version_min(ctx, platform, platform_type)
+ for compiler_options in compiler_option_lists:
+ compiler_options.append(min_version)
+ for linker_options in linker_option_lists:
+ linker_options.append(min_version)
diff --git a/go/platform/list.bzl b/go/platform/list.bzl
new file mode 100644
index 00000000..8eb8675b
--- /dev/null
+++ b/go/platform/list.bzl
@@ -0,0 +1,67 @@
+# Copyright 2017 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:platforms.bzl",
+ _GOARCH = "GOARCH_CONSTRAINTS",
+ _GOOS = "GOOS_CONSTRAINTS",
+ _GOOS_GOARCH = "GOOS_GOARCH",
+ _MSAN_GOOS_GOARCH = "MSAN_GOOS_GOARCH",
+ _RACE_GOOS_GOARCH = "RACE_GOOS_GOARCH",
+)
+
+GOOS_GOARCH = _GOOS_GOARCH
+GOOS = _GOOS
+GOARCH = _GOARCH
+RACE_GOOS_GOARCH = _RACE_GOOS_GOARCH
+MSAN_GOOS_GOARCH = _MSAN_GOOS_GOARCH
+
+def declare_config_settings():
+ """Generates config_setting targets.
+
+ declare_config_settings declares a config_setting target for each goos,
+ goarch, and valid goos_goarch pair. These targets may be used in select
+ expressions. Each target refers to a corresponding constraint_value in
+ //go/toolchain.
+ """
+ for goos in GOOS:
+ native.config_setting(
+ name = goos,
+ constraint_values = [Label("//go/toolchain:" + goos)],
+ visibility = ["//visibility:public"],
+ )
+ for goarch in GOARCH:
+ native.config_setting(
+ name = goarch,
+ constraint_values = [Label("//go/toolchain:" + goarch)],
+ visibility = ["//visibility:public"],
+ )
+ for goos, goarch in GOOS_GOARCH:
+ native.config_setting(
+ name = goos + "_" + goarch,
+ constraint_values = [
+ Label("//go/toolchain:" + goos),
+ Label("//go/toolchain:" + goarch),
+ ],
+ visibility = ["//visibility:public"],
+ )
+
+ # Setting that determines whether cgo is enabled.
+ # This is experimental and may be changed or removed when we migrate
+ # to build settings.
+ native.config_setting(
+ name = "internal_cgo_off",
+ constraint_values = [Label("//go/toolchain:cgo_off")],
+ visibility = [Label("//:__pkg__")],
+ )
diff --git a/go/private/BUILD.bazel b/go/private/BUILD.bazel
new file mode 100644
index 00000000..16907b53
--- /dev/null
+++ b/go/private/BUILD.bazel
@@ -0,0 +1,205 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+load("@bazel_skylib//rules:common_settings.bzl", "bool_setting")
+
+filegroup(
+ name = "all_rules",
+ srcs = [
+ "//go/private/actions:all_rules",
+ "//go/private/rules:all_rules",
+ "//go/private/skylib/lib:all_rules",
+ "//go/private/tools:all_rules",
+ ] + glob(["**/*.bzl"]),
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = [
+ "//go/private/actions:all_files",
+ "//go/private/rules:all_files",
+ "//go/private/skylib/lib:all_files",
+ "//go/private/tools:all_files",
+ ] + glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+config_setting(
+ name = "stamp",
+ values = {"stamp": "true"},
+ visibility = ["//:__pkg__"],
+)
+
+config_setting(
+ name = "is_strip_always",
+ values = {"strip": "always"},
+ visibility = ["//:__pkg__"],
+)
+
+config_setting(
+ name = "is_strip_sometimes_fastbuild",
+ values = {
+ "strip": "sometimes",
+ "compilation_mode": "fastbuild",
+ },
+ visibility = ["//:__pkg__"],
+)
+
+bzl_library(
+ name = "context",
+ srcs = ["context.bzl"],
+ visibility = [
+ "//docs:__subpackages__",
+ "//extras:__pkg__", # Manually added
+ "//go:__subpackages__",
+ ],
+ deps = [
+ ":common",
+ ":mode",
+ ":providers",
+ "//go/platform:apple",
+ "//go/private:go_toolchain",
+ "//go/private/rules:transition",
+ "@bazel_skylib//lib:paths",
+ "@bazel_skylib//rules:common_settings",
+ "@bazel_tools//tools/build_defs/cc:action_names.bzl",
+ "@bazel_tools//tools/cpp:toolchain_utils.bzl",
+ ],
+)
+
+bzl_library(
+ name = "go_toolchain",
+ srcs = ["go_toolchain.bzl"],
+ visibility = [
+ "//extras:__pkg__", # Manually added
+ "//go:__subpackages__",
+ ],
+ deps = [
+ "//go/private:platforms",
+ "//go/private:providers",
+ "//go/private/actions:archive",
+ "//go/private/actions:binary",
+ "//go/private/actions:link",
+ "//go/private/actions:stdlib",
+ "@bazel_skylib//lib:selects",
+ ],
+)
+
+bzl_library(
+ name = "repositories",
+ srcs = ["repositories.bzl"],
+ visibility = ["//go:__subpackages__"],
+ # Don't list dependency on @bazel_tools//tools/build_defs/repo:http.bzl
+ deps = [
+ ":common",
+ ":nogo",
+ "//go/private/skylib/lib:versions",
+ "//proto:gogo",
+ ], # keep
+)
+
+bzl_library(
+ name = "sdk",
+ srcs = ["sdk.bzl"],
+ visibility = ["//go:__subpackages__"],
+ deps = [
+ "//go/private:common",
+ "//go/private:nogo",
+ "//go/private:platforms",
+ "//go/private/skylib/lib:versions",
+ ],
+)
+
+bzl_library(
+ name = "common",
+ srcs = ["common.bzl"],
+ visibility = ["//go:__subpackages__"],
+)
+
+bzl_library(
+ name = "mode",
+ srcs = ["mode.bzl"],
+ visibility = ["//go:__subpackages__"],
+)
+
+bzl_library(
+ name = "nogo",
+ srcs = ["nogo.bzl"],
+ visibility = ["//go:__subpackages__"],
+)
+
+bzl_library(
+ name = "platforms",
+ srcs = ["platforms.bzl"],
+ visibility = ["//go:__subpackages__"],
+)
+
+bzl_library(
+ name = "providers",
+ srcs = ["providers.bzl"],
+ visibility = [
+ "//extras:__pkg__",
+ "//go:__subpackages__",
+ "//proto:__pkg__", # keep
+ ],
+)
+
+bzl_library(
+ name = "rpath",
+ srcs = ["rpath.bzl"],
+ visibility = [
+ "//docs:__subpackages__",
+ "//go:__subpackages__",
+ ],
+)
+
+# Usually false. This is only true when we are building nogo itself in which
+# because that rule uses an incoming transition to switch this to true.
+bool_setting(
+ name = "bootstrap_nogo",
+ build_setting_default = False,
+ visibility = ["//visibility:public"],
+)
+
+# Usually true. The entire toolchain gets nogo to use in builds via the
+# go_context_data rule, which has an incoming transition that flips this flag
+# to true. This will only be false in host mode (which disallows any
+# transitions) or accessing nogo without going through go_context_data (which
+# does not happen in rules_go and does not seem to be useful).
+bool_setting(
+ name = "request_nogo",
+ build_setting_default = False,
+ visibility = ["//visibility:public"],
+)
+
+# Controls whether nogo alias will reference a noop or the configured nogo.
+# This *MUST* default to the noop to allow for tools to be built in the
+# deprecated "host" mode. Host mode cannot perform configuration transitions
+# so it cannot avoid circular dependencies. Therefore the default must work
+# without performing any transitions. The tradeoff is that nogo analysis is not
+# performed for any target built in host mode - this is not as bad as it seems
+# as most tools can (and should) use "exec" configuration instead of host which
+# does support transitions.
+config_setting(
+ name = "nogo_active",
+ flag_values = {
+ ":bootstrap_nogo": "False",
+ ":request_nogo": "True",
+ },
+ visibility = ["//visibility:public"],
+)
+
+bool_setting(
+ name = "always_true",
+ build_setting_default = True,
+ visibility = ["//visibility:public"],
+)
+
+# Only used by //:go_config.
+config_setting(
+ name = "is_compilation_mode_dbg",
+ values = {
+ "compilation_mode": "dbg",
+ },
+ visibility = ["//:__pkg__"],
+)
diff --git a/go/private/BUILD.nogo.bazel b/go/private/BUILD.nogo.bazel
new file mode 100644
index 00000000..57f1c572
--- /dev/null
+++ b/go/private/BUILD.nogo.bazel
@@ -0,0 +1,6 @@
+package(default_visibility = ["//visibility:public"])
+
+alias(
+ name = "nogo",
+ actual = "{{nogo}}",
+)
diff --git a/go/private/BUILD.sdk.bazel b/go/private/BUILD.sdk.bazel
new file mode 100644
index 00000000..8b5d6d1e
--- /dev/null
+++ b/go/private/BUILD.sdk.bazel
@@ -0,0 +1,92 @@
+load("@io_bazel_rules_go//go/private/rules:binary.bzl", "go_tool_binary")
+load("@io_bazel_rules_go//go/private/rules:sdk.bzl", "package_list")
+load("@io_bazel_rules_go//go/private/rules:transition.bzl", "non_go_reset_target")
+load("@io_bazel_rules_go//go/private:go_toolchain.bzl", "declare_go_toolchains")
+load("@io_bazel_rules_go//go:def.bzl", "go_sdk")
+
+package(default_visibility = ["//visibility:public"])
+
+filegroup(
+ name = "libs",
+ srcs = glob(
+ ["pkg/{goos}_{goarch}/**/*.a"],
+ allow_empty = True,
+ exclude = ["pkg/{goos}_{goarch}/**/cmd/**"],
+ ),
+)
+
+filegroup(
+ name = "headers",
+ srcs = glob(["pkg/include/*.h"]),
+)
+
+filegroup(
+ name = "srcs",
+ srcs = glob(["src/**"]),
+)
+
+filegroup(
+ name = "tools",
+ srcs = glob([
+ "pkg/tool/**",
+ "bin/gofmt*",
+ ]),
+)
+
+go_sdk(
+ name = "go_sdk",
+ srcs = [":srcs"],
+ experiments = {experiments},
+ go = "bin/go{exe}",
+ goarch = "{goarch}",
+ goos = "{goos}",
+ headers = [":headers"],
+ libs = [":libs"],
+ package_list = ":package_list",
+ root_file = "ROOT",
+ tools = [":tools"],
+ version = "{version}",
+)
+
+go_tool_binary(
+ name = "builder",
+ srcs = ["@io_bazel_rules_go//go/tools/builders:builder_srcs"],
+ sdk = ":go_sdk",
+)
+
+non_go_reset_target(
+ name = "builder_reset",
+ dep = ":builder",
+)
+
+# TODO(jayconrod): Gazelle depends on this file directly. This dependency
+# should be broken, and this rule should be folded into go_sdk.
+package_list(
+ name = "package_list",
+ srcs = [":srcs"],
+ out = "packages.txt",
+ root_file = "ROOT",
+)
+
+declare_go_toolchains(
+ builder = ":builder_reset",
+ host_goos = "{goos}",
+ sdk = ":go_sdk",
+)
+
+filegroup(
+ name = "files",
+ srcs = glob([
+ "bin/go*",
+ "src/**",
+ "pkg/**",
+ ]),
+)
+
+exports_files(
+ glob([
+ "lib/time/zoneinfo.zip",
+ "misc/wasm/**",
+ ]),
+ visibility = ["//visibility:public"],
+)
diff --git a/go/private/actions/BUILD.bazel b/go/private/actions/BUILD.bazel
new file mode 100644
index 00000000..3bd3d155
--- /dev/null
+++ b/go/private/actions/BUILD.bazel
@@ -0,0 +1,77 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+
+filegroup(
+ name = "all_rules",
+ srcs = glob(["**/*.bzl"]),
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+bzl_library(
+ name = "archive",
+ srcs = ["archive.bzl"],
+ visibility = ["//go:__subpackages__"],
+ deps = [
+ "//go/private:common",
+ "//go/private:mode",
+ "//go/private:providers",
+ "//go/private/actions:compilepkg",
+ "//go/private/rules:cgo",
+ ],
+)
+
+bzl_library(
+ name = "binary",
+ srcs = ["binary.bzl"],
+ visibility = ["//go:__subpackages__"],
+ deps = [
+ "//go/private:common",
+ "//go/private:mode",
+ ],
+)
+
+bzl_library(
+ name = "compilepkg",
+ srcs = ["compilepkg.bzl"],
+ visibility = ["//go:__subpackages__"],
+ deps = [
+ ":utils",
+ "//go/private:mode",
+ "@bazel_skylib//lib:shell",
+ ],
+)
+
+bzl_library(
+ name = "link",
+ srcs = ["link.bzl"],
+ visibility = ["//go:__subpackages__"],
+ deps = [
+ "//go/private:common",
+ "//go/private:mode",
+ "//go/private:rpath",
+ "@bazel_skylib//lib:collections",
+ ],
+)
+
+bzl_library(
+ name = "stdlib",
+ srcs = ["stdlib.bzl"],
+ visibility = ["//go:__subpackages__"],
+ deps = [
+ ":utils",
+ "//go/private:mode",
+ "//go/private:providers",
+ "//go/private:sdk",
+ ],
+)
+
+bzl_library(
+ name = "utils",
+ srcs = ["utils.bzl"],
+)
diff --git a/go/private/actions/archive.bzl b/go/private/actions/archive.bzl
new file mode 100644
index 00000000..a4e737ee
--- /dev/null
+++ b/go/private/actions/archive.bzl
@@ -0,0 +1,201 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:common.bzl",
+ "as_tuple",
+ "split_srcs",
+)
+load(
+ "//go/private:mode.bzl",
+ "LINKMODE_C_ARCHIVE",
+ "LINKMODE_C_SHARED",
+ "mode_string",
+)
+load(
+ "//go/private:providers.bzl",
+ "GoArchive",
+ "GoArchiveData",
+ "effective_importpath_pkgpath",
+ "get_archive",
+)
+load(
+ "//go/private/rules:cgo.bzl",
+ "cgo_configure",
+)
+load(
+ "//go/private/actions:compilepkg.bzl",
+ "emit_compilepkg",
+)
+
+def emit_archive(go, source = None, _recompile_suffix = "", recompile_internal_deps = None):
+ """See go/toolchains.rst#archive for full documentation."""
+
+ if source == None:
+ fail("source is a required parameter")
+
+ split = split_srcs(source.srcs)
+ testfilter = getattr(source.library, "testfilter", None)
+ pre_ext = ""
+ if go.mode.link == LINKMODE_C_ARCHIVE:
+ pre_ext = "_" # avoid collision with go_binary output file with .a extension
+ elif testfilter == "exclude":
+ pre_ext = ".internal"
+ elif testfilter == "only":
+ pre_ext = ".external"
+ if _recompile_suffix:
+ pre_ext += _recompile_suffix
+ out_lib = go.declare_file(go, name = source.library.name, ext = pre_ext + ".a")
+
+ # store __.PKGDEF and nogo facts in .x
+ out_export = go.declare_file(go, name = source.library.name, ext = pre_ext + ".x")
+ out_cgo_export_h = None # set if cgo used in c-shared or c-archive mode
+
+ direct = [get_archive(dep) for dep in source.deps]
+ runfiles = source.runfiles
+ data_files = runfiles.files
+
+ files = []
+ for a in direct:
+ files.append(a.runfiles)
+ if a.source.mode != go.mode:
+ fail("Archive mode does not match {} is {} expected {}".format(a.data.label, mode_string(a.source.mode), mode_string(go.mode)))
+ runfiles.merge_all(files)
+
+ importmap = "main" if source.library.is_main else source.library.importmap
+ importpath, _ = effective_importpath_pkgpath(source.library)
+
+ if source.cgo and not go.mode.pure:
+ # TODO(jayconrod): do we need to do full Bourne tokenization here?
+ cppopts = [f for fs in source.cppopts for f in fs.split(" ")]
+ copts = [f for fs in source.copts for f in fs.split(" ")]
+ cxxopts = [f for fs in source.cxxopts for f in fs.split(" ")]
+ clinkopts = [f for fs in source.clinkopts for f in fs.split(" ")]
+ cgo = cgo_configure(
+ go,
+ srcs = split.go + split.c + split.asm + split.cxx + split.objc + split.headers,
+ cdeps = source.cdeps,
+ cppopts = cppopts,
+ copts = copts,
+ cxxopts = cxxopts,
+ clinkopts = clinkopts,
+ )
+ if go.mode.link in (LINKMODE_C_SHARED, LINKMODE_C_ARCHIVE):
+ out_cgo_export_h = go.declare_file(go, path = "_cgo_install.h")
+ cgo_deps = cgo.deps
+ runfiles = runfiles.merge(cgo.runfiles)
+ emit_compilepkg(
+ go,
+ sources = split.go + split.c + split.asm + split.cxx + split.objc + split.headers,
+ cover = source.cover,
+ embedsrcs = source.embedsrcs,
+ importpath = importpath,
+ importmap = importmap,
+ archives = direct,
+ out_lib = out_lib,
+ out_export = out_export,
+ out_cgo_export_h = out_cgo_export_h,
+ gc_goopts = source.gc_goopts,
+ cgo = True,
+ cgo_inputs = cgo.inputs,
+ cppopts = cgo.cppopts,
+ copts = cgo.copts,
+ cxxopts = cgo.cxxopts,
+ objcopts = cgo.objcopts,
+ objcxxopts = cgo.objcxxopts,
+ clinkopts = cgo.clinkopts,
+ testfilter = testfilter,
+ )
+ else:
+ cgo_deps = depset()
+ emit_compilepkg(
+ go,
+ sources = split.go + split.c + split.asm + split.cxx + split.objc + split.headers,
+ cover = source.cover,
+ embedsrcs = source.embedsrcs,
+ importpath = importpath,
+ importmap = importmap,
+ archives = direct,
+ out_lib = out_lib,
+ out_export = out_export,
+ gc_goopts = source.gc_goopts,
+ cgo = False,
+ testfilter = testfilter,
+ recompile_internal_deps = recompile_internal_deps,
+ )
+
+ data = GoArchiveData(
+ # TODO(#2578): reconsider the provider API. There's a lot of redundant
+ # information here. Some fields are tuples instead of lists or dicts
+ # since GoArchiveData is stored in a depset, and no value in a depset
+ # may be mutable. For now, new copied fields are private (named with
+ # a leading underscore) since they may change in the future.
+
+ # GoLibrary fields
+ name = source.library.name,
+ label = source.library.label,
+ importpath = source.library.importpath,
+ importmap = source.library.importmap,
+ importpath_aliases = source.library.importpath_aliases,
+ pathtype = source.library.pathtype,
+
+ # GoSource fields
+ srcs = as_tuple(source.srcs),
+ orig_srcs = as_tuple(source.orig_srcs),
+ _orig_src_map = tuple([source.orig_src_map.get(src, src) for src in source.srcs]),
+ _cover = as_tuple(source.cover),
+ _embedsrcs = as_tuple(source.embedsrcs),
+ _x_defs = tuple(source.x_defs.items()),
+ _gc_goopts = as_tuple(source.gc_goopts),
+ _cgo = source.cgo,
+ _cdeps = as_tuple(source.cdeps),
+ _cppopts = as_tuple(source.cppopts),
+ _copts = as_tuple(source.copts),
+ _cxxopts = as_tuple(source.cxxopts),
+ _clinkopts = as_tuple(source.clinkopts),
+ _cgo_exports = as_tuple(source.cgo_exports),
+
+ # Information on dependencies
+ _dep_labels = tuple([d.data.label for d in direct]),
+ _dep_importmaps = tuple([d.data.importmap for d in direct]),
+
+ # Information needed by dependents
+ file = out_lib,
+ export_file = out_export,
+ data_files = as_tuple(data_files),
+ _cgo_deps = as_tuple(cgo_deps),
+ )
+ x_defs = dict(source.x_defs)
+ for a in direct:
+ x_defs.update(a.x_defs)
+ cgo_exports_direct = list(source.cgo_exports)
+
+ # Ensure that the _cgo_export.h of the current target comes first when cgo_exports is iterated
+ # by prepending it and specifying the order explicitly. This is required as the CcInfo attached
+ # to the archive only exposes a single header rather than combining all headers.
+ if out_cgo_export_h:
+ cgo_exports_direct.insert(0, out_cgo_export_h)
+ cgo_exports = depset(direct = cgo_exports_direct, transitive = [a.cgo_exports for a in direct], order = "preorder")
+ return GoArchive(
+ source = source,
+ data = data,
+ direct = direct,
+ libs = depset(direct = [out_lib], transitive = [a.libs for a in direct]),
+ transitive = depset([data], transitive = [a.transitive for a in direct]),
+ x_defs = x_defs,
+ cgo_deps = depset(transitive = [cgo_deps] + [a.cgo_deps for a in direct]),
+ cgo_exports = cgo_exports,
+ runfiles = runfiles,
+ mode = go.mode,
+ )
diff --git a/go/private/actions/binary.bzl b/go/private/actions/binary.bzl
new file mode 100644
index 00000000..8f2fc96a
--- /dev/null
+++ b/go/private/actions/binary.bzl
@@ -0,0 +1,68 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:mode.bzl",
+ "LINKMODE_C_ARCHIVE",
+ "LINKMODE_C_SHARED",
+ "LINKMODE_PLUGIN",
+)
+load(
+ "//go/private:common.bzl",
+ "ARCHIVE_EXTENSION",
+ "has_shared_lib_extension",
+)
+
+def emit_binary(
+ go,
+ name = "",
+ source = None,
+ test_archives = [],
+ gc_linkopts = [],
+ version_file = None,
+ info_file = None,
+ executable = None):
+ """See go/toolchains.rst#binary for full documentation."""
+
+ if name == "" and executable == None:
+ fail("either name or executable must be set")
+
+ archive = go.archive(go, source)
+ if not executable:
+ extension = go.exe_extension
+ if go.mode.link == LINKMODE_C_SHARED:
+ name = "lib" + name # shared libraries need a "lib" prefix in their name
+ extension = go.shared_extension
+ elif go.mode.link == LINKMODE_C_ARCHIVE:
+ extension = ARCHIVE_EXTENSION
+ elif go.mode.link == LINKMODE_PLUGIN:
+ extension = go.shared_extension
+ executable = go.declare_file(go, path = name, ext = extension)
+ go.link(
+ go,
+ archive = archive,
+ test_archives = test_archives,
+ executable = executable,
+ gc_linkopts = gc_linkopts,
+ version_file = version_file,
+ info_file = info_file,
+ )
+ cgo_dynamic_deps = [
+ d
+ for d in archive.cgo_deps.to_list()
+ if has_shared_lib_extension(d.basename)
+ ]
+ runfiles = go._ctx.runfiles(files = cgo_dynamic_deps).merge(archive.runfiles)
+
+ return archive, executable, runfiles
diff --git a/go/private/actions/compilepkg.bzl b/go/private/actions/compilepkg.bzl
new file mode 100644
index 00000000..fff807fa
--- /dev/null
+++ b/go/private/actions/compilepkg.bzl
@@ -0,0 +1,161 @@
+# Copyright 2019 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:mode.bzl",
+ "link_mode_args",
+)
+load("//go/private/actions:utils.bzl", "quote_opts")
+
+def _archive(v):
+ importpaths = [v.data.importpath]
+ importpaths.extend(v.data.importpath_aliases)
+ return "{}={}={}".format(
+ ":".join(importpaths),
+ v.data.importmap,
+ v.data.export_file.path if v.data.export_file else v.data.file.path,
+ )
+
+def _embedroot_arg(src):
+ return src.root.path
+
+def _embedlookupdir_arg(src):
+ root_relative = src.dirname[len(src.root.path):]
+ if root_relative.startswith("/"):
+ root_relative = root_relative[len("/"):]
+ return root_relative
+
+def emit_compilepkg(
+ go,
+ sources = None,
+ cover = None,
+ embedsrcs = [],
+ importpath = "",
+ importmap = "",
+ archives = [],
+ cgo = False,
+ cgo_inputs = depset(),
+ cppopts = [],
+ copts = [],
+ cxxopts = [],
+ objcopts = [],
+ objcxxopts = [],
+ clinkopts = [],
+ out_lib = None,
+ out_export = None,
+ out_cgo_export_h = None,
+ gc_goopts = [],
+ testfilter = None, # TODO: remove when test action compiles packages
+ recompile_internal_deps = []):
+ """Compiles a complete Go package."""
+ if sources == None:
+ fail("sources is a required parameter")
+ if out_lib == None:
+ fail("out_lib is a required parameter")
+
+ inputs = (sources + embedsrcs + [go.package_list] +
+ [archive.data.export_file for archive in archives] +
+ go.sdk.tools + go.sdk.headers + go.stdlib.libs)
+ outputs = [out_lib, out_export]
+ env = go.env
+
+ args = go.builder_args(go, "compilepkg")
+ args.add_all(sources, before_each = "-src")
+ args.add_all(embedsrcs, before_each = "-embedsrc", expand_directories = False)
+ args.add_all(
+ sources + [out_lib] + embedsrcs,
+ map_each = _embedroot_arg,
+ before_each = "-embedroot",
+ uniquify = True,
+ expand_directories = False,
+ )
+ args.add_all(
+ sources + [out_lib],
+ map_each = _embedlookupdir_arg,
+ before_each = "-embedlookupdir",
+ uniquify = True,
+ expand_directories = False,
+ )
+ if cover and go.coverdata:
+ inputs.append(go.coverdata.data.export_file)
+ args.add("-arc", _archive(go.coverdata))
+ if go.mode.race:
+ args.add("-cover_mode", "atomic")
+ else:
+ args.add("-cover_mode", "set")
+ args.add("-cover_format", go.cover_format)
+ args.add_all(cover, before_each = "-cover")
+ args.add_all(archives, before_each = "-arc", map_each = _archive)
+ if recompile_internal_deps:
+ args.add_all(recompile_internal_deps, before_each = "-recompile_internal_deps")
+ if importpath:
+ args.add("-importpath", importpath)
+ else:
+ args.add("-importpath", go.label.name)
+ if importmap:
+ args.add("-p", importmap)
+ args.add("-package_list", go.package_list)
+
+ args.add("-o", out_lib)
+ args.add("-x", out_export)
+ if go.nogo:
+ args.add("-nogo", go.nogo)
+ inputs.append(go.nogo)
+ if out_cgo_export_h:
+ args.add("-cgoexport", out_cgo_export_h)
+ outputs.append(out_cgo_export_h)
+ if testfilter:
+ args.add("-testfilter", testfilter)
+
+ gc_flags = list(gc_goopts)
+ gc_flags.extend(go.mode.gc_goopts)
+ asm_flags = []
+ if go.mode.race:
+ gc_flags.append("-race")
+ if go.mode.msan:
+ gc_flags.append("-msan")
+ if go.mode.debug:
+ gc_flags.extend(["-N", "-l"])
+ gc_flags.extend(go.toolchain.flags.compile)
+ gc_flags.extend(link_mode_args(go.mode))
+ asm_flags.extend(link_mode_args(go.mode))
+ args.add("-gcflags", quote_opts(gc_flags))
+ args.add("-asmflags", quote_opts(asm_flags))
+
+ env = go.env
+ if cgo:
+ inputs.extend(cgo_inputs.to_list()) # OPT: don't expand depset
+ inputs.extend(go.crosstool)
+ env["CC"] = go.cgo_tools.c_compiler_path
+ if cppopts:
+ args.add("-cppflags", quote_opts(cppopts))
+ if copts:
+ args.add("-cflags", quote_opts(copts))
+ if cxxopts:
+ args.add("-cxxflags", quote_opts(cxxopts))
+ if objcopts:
+ args.add("-objcflags", quote_opts(objcopts))
+ if objcxxopts:
+ args.add("-objcxxflags", quote_opts(objcxxopts))
+ if clinkopts:
+ args.add("-ldflags", quote_opts(clinkopts))
+
+ go.actions.run(
+ inputs = inputs,
+ outputs = outputs,
+ mnemonic = "GoCompilePkg",
+ executable = go.toolchain._builder,
+ arguments = [args],
+ env = go.env,
+ )
diff --git a/go/private/actions/link.bzl b/go/private/actions/link.bzl
new file mode 100644
index 00000000..e919e3db
--- /dev/null
+++ b/go/private/actions/link.bzl
@@ -0,0 +1,276 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:common.bzl",
+ "as_set",
+ "count_group_matches",
+ "has_shared_lib_extension",
+)
+load(
+ "//go/private:mode.bzl",
+ "LINKMODE_NORMAL",
+ "LINKMODE_PLUGIN",
+ "extld_from_cc_toolchain",
+ "extldflags_from_cc_toolchain",
+)
+load(
+ "//go/private:rpath.bzl",
+ "rpath",
+)
+load(
+ "@bazel_skylib//lib:collections.bzl",
+ "collections",
+)
+
+def _format_archive(d):
+ return "{}={}={}".format(d.label, d.importmap, d.file.path)
+
+def _transitive_archives_without_test_archives(archive, test_archives):
+ # Build the set of transitive dependencies. Currently, we tolerate multiple
+ # archives with the same importmap (though this will be an error in the
+ # future), but there is a special case which is difficult to avoid:
+ # If a go_test has internal and external archives, and the external test
+ # transitively depends on the library under test, we need to exclude the
+ # library under test and use the internal test archive instead.
+ deps = depset(transitive = [d.transitive for d in archive.direct])
+ result = {}
+
+ # Unfortunately, Starlark doesn't support set()
+ test_imports = {}
+ for t in test_archives:
+ test_imports[t.importmap] = True
+ for d in deps.to_list():
+ if d.importmap in test_imports:
+ continue
+ if d.importmap in result:
+ print("Multiple copies of {} passed to the linker. Ignoring {} in favor of {}".format(d.importmap, d.file.path, result[d.importmap].file.path))
+ continue
+ result[d.importmap] = d
+ return result.values()
+
+def emit_link(
+ go,
+ archive = None,
+ test_archives = [],
+ executable = None,
+ gc_linkopts = [],
+ version_file = None,
+ info_file = None):
+ """See go/toolchains.rst#link for full documentation."""
+
+ if archive == None:
+ fail("archive is a required parameter")
+ if executable == None:
+ fail("executable is a required parameter")
+
+ # Exclude -lstdc++ from link options. We don't want to link against it
+ # unless we actually have some C++ code. _cgo_codegen will include it
+ # in archives via CGO_LDFLAGS if it's needed.
+ extldflags = [f for f in extldflags_from_cc_toolchain(go) if f not in ("-lstdc++", "-lc++")]
+
+ if go.coverage_enabled:
+ extldflags.append("--coverage")
+ gc_linkopts = list(gc_linkopts)
+ gc_linkopts.extend(go.mode.gc_linkopts)
+ gc_linkopts, extldflags = _extract_extldflags(gc_linkopts, extldflags)
+ builder_args = go.builder_args(go, "link")
+ tool_args = go.tool_args(go)
+
+ # Add in any mode specific behaviours
+ if go.mode.race:
+ tool_args.add("-race")
+ if go.mode.msan:
+ tool_args.add("-msan")
+
+ if go.mode.pure:
+ tool_args.add("-linkmode", "internal")
+ else:
+ extld = extld_from_cc_toolchain(go)
+ tool_args.add_all(extld)
+ if extld and (go.mode.static or
+ go.mode.race or
+ go.mode.link != LINKMODE_NORMAL or
+ go.mode.goos == "windows" and go.mode.msan):
+ # Force external linking for the following conditions:
+ # * Mode is static but not pure: -static must be passed to the C
+ # linker if the binary contains cgo code. See #2168, #2216.
+ # * Non-normal build mode: may not be strictly necessary, especially
+ # for modes like "pie".
+ # * Race or msan build for Windows: Go linker has pairwise
+ # incompatibilities with mingw, and we get link errors in race mode.
+ # Using the C linker avoids that. Race and msan always require a
+ # a C toolchain. See #2614.
+ # * Linux race builds: we get linker errors during build with Go's
+ # internal linker. For example, when using zig cc v0.10
+ # (clang-15.0.3):
+ #
+ # runtime/cgo(.text): relocation target memset not defined
+ tool_args.add("-linkmode", "external")
+
+ if go.mode.static:
+ extldflags.append("-static")
+ if go.mode.link != LINKMODE_NORMAL:
+ builder_args.add("-buildmode", go.mode.link)
+ if go.mode.link == LINKMODE_PLUGIN:
+ tool_args.add("-pluginpath", archive.data.importpath)
+
+ arcs = _transitive_archives_without_test_archives(archive, test_archives)
+ arcs.extend(test_archives)
+ if (go.coverage_enabled and go.coverdata and
+ not any([arc.importmap == go.coverdata.data.importmap for arc in arcs])):
+ arcs.append(go.coverdata.data)
+ builder_args.add_all(arcs, before_each = "-arc", map_each = _format_archive)
+ builder_args.add("-package_list", go.package_list)
+
+ # Build a list of rpaths for dynamic libraries we need to find.
+ # rpaths are relative paths from the binary to directories where libraries
+ # are stored. Binaries that require these will only work when installed in
+ # the bazel execroot. Most binaries are only dynamically linked against
+ # system libraries though.
+ cgo_rpaths = sorted(collections.uniq([
+ f
+ for d in archive.cgo_deps.to_list()
+ if has_shared_lib_extension(d.basename)
+ for f in rpath.flags(go, d, executable = executable)
+ ]))
+ extldflags.extend(cgo_rpaths)
+
+ # Process x_defs, and record whether stamping is used.
+ stamp_x_defs_volatile = False
+ stamp_x_defs_stable = False
+ for k, v in archive.x_defs.items():
+ builder_args.add("-X", "%s=%s" % (k, v))
+ if go.stamp:
+ stable_vars_count = (count_group_matches(v, "{STABLE_", "}") +
+ v.count("{BUILD_EMBED_LABEL}") +
+ v.count("{BUILD_USER}") +
+ v.count("{BUILD_HOST}"))
+ if stable_vars_count > 0:
+ stamp_x_defs_stable = True
+ if count_group_matches(v, "{", "}") != stable_vars_count:
+ stamp_x_defs_volatile = True
+
+ # Stamping support
+ stamp_inputs = []
+ if stamp_x_defs_stable:
+ stamp_inputs.append(info_file)
+ if stamp_x_defs_volatile:
+ stamp_inputs.append(version_file)
+ if stamp_inputs:
+ builder_args.add_all(stamp_inputs, before_each = "-stamp")
+
+ builder_args.add("-o", executable)
+ builder_args.add("-main", archive.data.file)
+ builder_args.add("-p", archive.data.importmap)
+ tool_args.add_all(gc_linkopts)
+ tool_args.add_all(go.toolchain.flags.link)
+
+ # Do not remove, somehow this is needed when building for darwin/arm only.
+ tool_args.add("-buildid=redacted")
+ if go.mode.strip:
+ tool_args.add("-s", "-w")
+ tool_args.add_joined("-extldflags", extldflags, join_with = " ")
+
+ conflict_err = _check_conflicts(arcs)
+ if conflict_err:
+ # Report package conflict errors in execution instead of analysis.
+ # We could call fail() with this message, but Bazel prints a stack
+ # that doesn't give useful information.
+ builder_args.add("-conflict_err", conflict_err)
+
+ inputs_direct = stamp_inputs + [go.sdk.package_list]
+ if go.coverage_enabled and go.coverdata:
+ inputs_direct.append(go.coverdata.data.file)
+ inputs_transitive = [
+ archive.libs,
+ archive.cgo_deps,
+ as_set(go.crosstool),
+ as_set(go.sdk.tools),
+ as_set(go.stdlib.libs),
+ ]
+ inputs = depset(direct = inputs_direct, transitive = inputs_transitive)
+
+ go.actions.run(
+ inputs = inputs,
+ outputs = [executable],
+ mnemonic = "GoLink",
+ executable = go.toolchain._builder,
+ arguments = [builder_args, "--", tool_args],
+ env = go.env,
+ )
+
+def _extract_extldflags(gc_linkopts, extldflags):
+ """Extracts -extldflags from gc_linkopts and combines them into a single list.
+
+ Args:
+ gc_linkopts: a list of flags passed in through the gc_linkopts attributes.
+ ctx.expand_make_variables should have already been applied. -extldflags
+ may appear multiple times in this list.
+ extldflags: a list of flags to be passed to the external linker.
+
+ Return:
+ A tuple containing the filtered gc_linkopts with external flags removed,
+ and a combined list of external flags. Each string in the returned
+ extldflags list may contain multiple flags, separated by whitespace.
+ """
+ filtered_gc_linkopts = []
+ is_extldflags = False
+ for opt in gc_linkopts:
+ if is_extldflags:
+ is_extldflags = False
+ extldflags.append(opt)
+ elif opt == "-extldflags":
+ is_extldflags = True
+ else:
+ filtered_gc_linkopts.append(opt)
+ return filtered_gc_linkopts, extldflags
+
+def _check_conflicts(arcs):
+ importmap_to_label = {}
+ for arc in arcs:
+ if arc.importmap in importmap_to_label:
+ return """package conflict error: {}: multiple copies of package passed to linker:
+ {}
+ {}
+Set "importmap" to different paths or use 'bazel cquery' to ensure only one
+package with this path is linked.""".format(
+ arc.importmap,
+ importmap_to_label[arc.importmap],
+ arc.label,
+ )
+ importmap_to_label[arc.importmap] = arc.label
+ for arc in arcs:
+ for dep_importmap, dep_label in zip(arc._dep_importmaps, arc._dep_labels):
+ if dep_importmap not in importmap_to_label:
+ return "package conflict error: {}: package needed by {} was not passed to linker".format(
+ dep_importmap,
+ arc.label,
+ )
+ if importmap_to_label[dep_importmap] != dep_label:
+ err = """package conflict error: {}: package imports {}
+ was compiled with: {}
+ but was linked with: {}""".format(
+ arc.importmap,
+ dep_importmap,
+ dep_label,
+ importmap_to_label[dep_importmap],
+ )
+ if importmap_to_label[dep_importmap].name.endswith("_test"):
+ err += """
+This sometimes happens when an external test (package ending with _test)
+imports a package that imports the library being tested. This is not supported."""
+ err += "\nSee https://github.com/bazelbuild/rules_go/issues/1877."
+ return err
+ return None
diff --git a/go/private/actions/stdlib.bzl b/go/private/actions/stdlib.bzl
new file mode 100644
index 00000000..c80fbeb3
--- /dev/null
+++ b/go/private/actions/stdlib.bzl
@@ -0,0 +1,149 @@
+# Copyright 2019 The Bazel Go Rules Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:common.bzl",
+ "COVERAGE_OPTIONS_DENYLIST",
+)
+load(
+ "//go/private:providers.bzl",
+ "GoStdLib",
+)
+load(
+ "//go/private:mode.bzl",
+ "LINKMODE_NORMAL",
+ "extldflags_from_cc_toolchain",
+ "link_mode_args",
+)
+load("//go/private:sdk.bzl", "parse_version")
+load("//go/private/actions:utils.bzl", "quote_opts")
+
+def emit_stdlib(go):
+ """Returns a standard library for the target configuration.
+
+ If the precompiled standard library is suitable, it will be returned.
+ Otherwise, the standard library will be compiled for the target.
+
+ Returns:
+ A list of providers containing GoLibrary and GoSource. GoSource.stdlib
+ will point to a new GoStdLib.
+ """
+ library = go.new_library(go, resolver = _stdlib_library_to_source)
+ source = go.library_to_source(go, {}, library, False)
+ return [source, library]
+
+def _stdlib_library_to_source(go, _attr, source, _merge):
+ if _should_use_sdk_stdlib(go):
+ source["stdlib"] = _sdk_stdlib(go)
+ else:
+ source["stdlib"] = _build_stdlib(go)
+
+def _should_use_sdk_stdlib(go):
+ version = parse_version(go.sdk.version)
+ if version and version[0] <= 1 and version[1] <= 19 and go.sdk.experiments:
+ # The precompiled stdlib shipped with 1.19 or below doesn't have experiments
+ return False
+ return (go.sdk.libs and # go.sdk.libs is non-empty if sdk ships with precompiled .a files
+ go.mode.goos == go.sdk.goos and
+ go.mode.goarch == go.sdk.goarch and
+ not go.mode.race and # TODO(jayconrod): use precompiled race
+ not go.mode.msan and
+ not go.mode.pure and
+ not go.mode.gc_goopts and
+ go.mode.link == LINKMODE_NORMAL)
+
+def _build_stdlib_list_json(go):
+ out = go.declare_file(go, "stdlib.pkg.json")
+ args = go.builder_args(go, "stdliblist")
+ args.add("-sdk", go.sdk.root_file.dirname)
+ args.add("-out", out)
+
+ inputs = go.sdk_files
+ if not go.mode.pure:
+ inputs += go.crosstool
+
+ go.actions.run(
+ inputs = inputs,
+ outputs = [out],
+ mnemonic = "GoStdlibList",
+ executable = go.toolchain._builder,
+ arguments = [args],
+ env = _build_env(go),
+ )
+ return out
+
+def _build_env(go):
+ env = go.env
+
+ if go.mode.pure:
+ env.update({"CGO_ENABLED": "0"})
+ return env
+
+ # NOTE(#2545): avoid unnecessary dynamic link
+ # go std library doesn't use C++, so should not have -lstdc++
+ # Also drop coverage flags as nothing in the stdlib is compiled with
+ # coverage - we disable it for all CGo code anyway.
+ ldflags = [
+ option
+ for option in extldflags_from_cc_toolchain(go)
+ if option not in ("-lstdc++", "-lc++") and option not in COVERAGE_OPTIONS_DENYLIST
+ ]
+ env.update({
+ "CGO_ENABLED": "1",
+ "CC": go.cgo_tools.c_compiler_path,
+ "CGO_CFLAGS": " ".join(go.cgo_tools.c_compile_options),
+ "CGO_LDFLAGS": " ".join(ldflags),
+ })
+
+ return env
+
+def _sdk_stdlib(go):
+ return GoStdLib(
+ _list_json = _build_stdlib_list_json(go),
+ libs = go.sdk.libs,
+ root_file = go.sdk.root_file,
+ )
+
+def _build_stdlib(go):
+ pkg = go.declare_directory(go, path = "pkg")
+ args = go.builder_args(go, "stdlib")
+ args.add("-out", pkg.dirname)
+ if go.mode.race:
+ args.add("-race")
+ args.add("-package", "std")
+ if not go.mode.pure:
+ args.add("-package", "runtime/cgo")
+ args.add_all(link_mode_args(go.mode))
+
+ args.add("-gcflags", quote_opts(go.mode.gc_goopts))
+
+ inputs = (go.sdk.srcs +
+ go.sdk.headers +
+ go.sdk.tools +
+ [go.sdk.go, go.sdk.package_list, go.sdk.root_file] +
+ go.crosstool)
+ outputs = [pkg]
+ go.actions.run(
+ inputs = inputs,
+ outputs = outputs,
+ mnemonic = "GoStdlib",
+ executable = go.toolchain._builder,
+ arguments = [args],
+ env = _build_env(go),
+ )
+ return GoStdLib(
+ _list_json = _build_stdlib_list_json(go),
+ libs = [pkg],
+ root_file = pkg,
+ )
diff --git a/go/private/actions/utils.bzl b/go/private/actions/utils.bzl
new file mode 100644
index 00000000..b3a360e4
--- /dev/null
+++ b/go/private/actions/utils.bzl
@@ -0,0 +1,7 @@
+load(
+ "@bazel_skylib//lib:shell.bzl",
+ "shell",
+)
+
+def quote_opts(opts):
+ return " ".join([shell.quote(opt) if " " in opt else opt for opt in opts])
diff --git a/go/private/common.bzl b/go/private/common.bzl
new file mode 100644
index 00000000..5d331b72
--- /dev/null
+++ b/go/private/common.bzl
@@ -0,0 +1,254 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+go_exts = [
+ ".go",
+]
+
+asm_exts = [
+ ".s",
+ ".S",
+ ".h", # may be included by .s
+]
+
+# be consistent to cc_library.
+hdr_exts = [
+ ".h",
+ ".hh",
+ ".hpp",
+ ".hxx",
+ ".inc",
+]
+
+c_exts = [
+ ".c",
+ ".h",
+]
+
+cxx_exts = [
+ ".cc",
+ ".cxx",
+ ".cpp",
+ ".h",
+ ".hh",
+ ".hpp",
+ ".hxx",
+]
+
+objc_exts = [
+ ".m",
+ ".mm",
+ ".h",
+ ".hh",
+ ".hpp",
+ ".hxx",
+]
+
+cgo_exts = [
+ ".c",
+ ".cc",
+ ".cpp",
+ ".cxx",
+ ".h",
+ ".hh",
+ ".hpp",
+ ".hxx",
+ ".inc",
+ ".m",
+ ".mm",
+]
+
+def split_srcs(srcs):
+ """Returns a struct of sources, divided by extension."""
+ sources = struct(
+ go = [],
+ asm = [],
+ headers = [],
+ c = [],
+ cxx = [],
+ objc = [],
+ )
+ ext_pairs = (
+ (sources.go, go_exts),
+ (sources.headers, hdr_exts),
+ (sources.asm, asm_exts),
+ (sources.c, c_exts),
+ (sources.cxx, cxx_exts),
+ (sources.objc, objc_exts),
+ )
+ extmap = {}
+ for outs, exts in ext_pairs:
+ for ext in exts:
+ ext = ext[1:] # strip the dot
+ if ext in extmap:
+ break
+ extmap[ext] = outs
+ for src in as_iterable(srcs):
+ extouts = extmap.get(src.extension)
+ if extouts == None:
+ fail("Unknown source type {0}".format(src.basename))
+ extouts.append(src)
+ return sources
+
+def join_srcs(source):
+ """Combines source from a split_srcs struct into a single list."""
+ return source.go + source.headers + source.asm + source.c + source.cxx + source.objc
+
+def os_path(ctx, path):
+ path = str(path) # maybe convert from path type
+ if ctx.os.name.startswith("windows"):
+ path = path.replace("/", "\\")
+ return path
+
+def executable_path(ctx, path):
+ path = os_path(ctx, path)
+ if ctx.os.name.startswith("windows"):
+ path += ".exe"
+ return path
+
+def executable_extension(ctx):
+ extension = ""
+ if ctx.os.name.startswith("windows"):
+ extension = ".exe"
+ return extension
+
+def goos_to_extension(goos):
+ if goos == "windows":
+ return ".exe"
+ return ""
+
+ARCHIVE_EXTENSION = ".a"
+
+SHARED_LIB_EXTENSIONS = [".dll", ".dylib", ".so"]
+
+def goos_to_shared_extension(goos):
+ return {
+ "windows": ".dll",
+ "darwin": ".dylib",
+ }.get(goos, ".so")
+
+def has_shared_lib_extension(path):
+ """
+ Matches filenames of shared libraries, with or without a version number extension.
+ """
+ return (has_simple_shared_lib_extension(path) or
+ get_versioned_shared_lib_extension(path))
+
+def has_simple_shared_lib_extension(path):
+ """
+ Matches filenames of shared libraries, without a version number extension.
+ """
+ return any([path.endswith(ext) for ext in SHARED_LIB_EXTENSIONS])
+
+def get_versioned_shared_lib_extension(path):
+ """If appears to be an versioned .so or .dylib file, return the extension; otherwise empty"""
+ parts = path.split("/")[-1].split(".")
+ if not parts[-1].isdigit():
+ return ""
+
+ # only iterating to 1 because parts[0] has to be the lib name
+ for i in range(len(parts) - 1, 0, -1):
+ if not parts[i].isdigit():
+ if parts[i] == "dylib" or parts[i] == "so":
+ return ".".join(parts[i:])
+
+ # something like foo.bar.1.2 or dylib.1.2
+ return ""
+
+ # something like 1.2.3, or so.1.2, or dylib.1.2, or foo.1.2
+ return ""
+
+MINIMUM_BAZEL_VERSION = "5.4.0"
+
+def as_list(v):
+ """Returns a list, tuple, or depset as a list."""
+ if type(v) == "list":
+ return v
+ if type(v) == "tuple":
+ return list(v)
+ if type(v) == "depset":
+ return v.to_list()
+ fail("as_list failed on {}".format(v))
+
+def as_iterable(v):
+ """Returns a list, tuple, or depset as something iterable."""
+ if type(v) == "list":
+ return v
+ if type(v) == "tuple":
+ return v
+ if type(v) == "depset":
+ return v.to_list()
+ fail("as_iterator failed on {}".format(v))
+
+def as_tuple(v):
+ """Returns a list, tuple, or depset as a tuple."""
+ if type(v) == "tuple":
+ return v
+ if type(v) == "list":
+ return tuple(v)
+ if type(v) == "depset":
+ return tuple(v.to_list())
+ fail("as_tuple failed on {}".format(v))
+
+def as_set(v):
+ """Returns a list, tuple, or depset as a depset."""
+ if type(v) == "depset":
+ return v
+ if type(v) == "list":
+ return depset(v)
+ if type(v) == "tuple":
+ return depset(v)
+ fail("as_tuple failed on {}".format(v))
+
+_STRUCT_TYPE = type(struct())
+
+def is_struct(v):
+ """Returns true if v is a struct."""
+ return type(v) == _STRUCT_TYPE
+
+def count_group_matches(v, prefix, suffix):
+ """Counts reluctant substring matches between prefix and suffix.
+
+ Equivalent to the number of regular expression matches "prefix.+?suffix"
+ in the string v.
+ """
+
+ count = 0
+ idx = 0
+ for i in range(0, len(v)):
+ if idx > i:
+ continue
+
+ idx = v.find(prefix, idx)
+ if idx == -1:
+ break
+
+ # If there is another prefix before the next suffix, the previous prefix is discarded.
+ # This is OK; it does not affect our count.
+ idx = v.find(suffix, idx)
+ if idx == -1:
+ break
+
+ count = count + 1
+
+ return count
+
+# C/C++ compiler and linker options related to coverage instrumentation.
+COVERAGE_OPTIONS_DENYLIST = {
+ "--coverage": None,
+ "-ftest-coverage": None,
+ "-fprofile-arcs": None,
+ "-fprofile-instr-generate": None,
+ "-fcoverage-mapping": None,
+}
diff --git a/go/private/context.bzl b/go/private/context.bzl
new file mode 100644
index 00000000..db4fe09d
--- /dev/null
+++ b/go/private/context.bzl
@@ -0,0 +1,912 @@
+# Copyright 2017 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "@bazel_tools//tools/cpp:toolchain_utils.bzl",
+ "find_cpp_toolchain",
+)
+load(
+ "@bazel_tools//tools/build_defs/cc:action_names.bzl",
+ "CPP_COMPILE_ACTION_NAME",
+ "CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME",
+ "CPP_LINK_EXECUTABLE_ACTION_NAME",
+ "CPP_LINK_STATIC_LIBRARY_ACTION_NAME",
+ "C_COMPILE_ACTION_NAME",
+ "OBJCPP_COMPILE_ACTION_NAME",
+ "OBJC_COMPILE_ACTION_NAME",
+)
+load(
+ ":go_toolchain.bzl",
+ "GO_TOOLCHAIN",
+)
+load(
+ ":providers.bzl",
+ "CgoContextInfo",
+ "EXPLICIT_PATH",
+ "EXPORT_PATH",
+ "GoArchive",
+ "GoConfigInfo",
+ "GoContextInfo",
+ "GoLibrary",
+ "GoSource",
+ "GoStdLib",
+ "INFERRED_PATH",
+ "get_source",
+)
+load(
+ ":mode.bzl",
+ "get_mode",
+ "installsuffix",
+)
+load(
+ ":common.bzl",
+ "COVERAGE_OPTIONS_DENYLIST",
+ "as_iterable",
+ "goos_to_extension",
+ "goos_to_shared_extension",
+ "is_struct",
+)
+load(
+ "//go/platform:apple.bzl",
+ "apple_ensure_options",
+)
+load(
+ "@bazel_skylib//rules:common_settings.bzl",
+ "BuildSettingInfo",
+)
+load(
+ "//go/private/rules:transition.bzl",
+ "request_nogo_transition",
+)
+
+# cgo requires a gcc/clang style compiler.
+# We use a denylist instead of an allowlist:
+# - Bazel's auto-detected toolchains used to set the compiler name to "compiler"
+# for gcc (fixed in 6.0.0), which defeats the purpose of an allowlist.
+# - The compiler name field is free-form and user-defined, so we would have to
+# provide a way to override this list.
+# TODO: Convert to a denylist once we can assume Bazel 6.0.0 or later and have a
+# way for users to extend the list.
+_UNSUPPORTED_C_COMPILERS = {
+ "msvc-cl": None,
+ "clang-cl": None,
+}
+
+_COMPILER_OPTIONS_DENYLIST = dict({
+ # cgo parses the error messages from the compiler. It can't handle colors.
+ # Ignore both variants of the diagnostics color flag.
+ "-fcolor-diagnostics": None,
+ "-fdiagnostics-color": None,
+
+ # cgo also wants to see all the errors when it is testing the compiler.
+ # fmax-errors limits that and causes build failures.
+ "-fmax-errors=": None,
+ "-Wall": None,
+
+ # Symbols are needed by Go, so keep them
+ "-g0": None,
+
+ # Don't compile generated cgo code with coverage. If we do an internal
+ # link, we may have undefined references to coverage functions.
+ "--coverage": None,
+ "-ftest-coverage": None,
+ "-fprofile-arcs": None,
+ "-fprofile-instr-generate": None,
+ "-fcoverage-mapping": None,
+}, **COVERAGE_OPTIONS_DENYLIST)
+
+_LINKER_OPTIONS_DENYLIST = {
+ "-Wl,--gc-sections": None,
+}
+
+_UNSUPPORTED_FEATURES = [
+ # These toolchain features require special rule support and will thus break
+ # with CGo.
+ # Taken from https://github.com/bazelbuild/rules_rust/blob/521e649ff44e9711fe3c45b0ec1e792f7e1d361e/rust/private/utils.bzl#L20.
+ "thin_lto",
+ "module_maps",
+ "use_header_modules",
+ "fdo_instrument",
+ "fdo_optimize",
+]
+
+def _match_option(option, pattern):
+ if pattern.endswith("="):
+ return option.startswith(pattern)
+ else:
+ return option == pattern
+
+def _filter_options(options, denylist):
+ return [
+ option
+ for option in options
+ if not any([_match_option(option, pattern) for pattern in denylist])
+ ]
+
+def _child_name(go, path, ext, name):
+ if not name:
+ name = go.label.name
+ if path or not ext:
+ # The '_' avoids collisions with another file matching the label name.
+ # For example, hello and hello/testmain.go.
+ name += "_"
+ if path:
+ name += "/" + path
+ if ext:
+ name += ext
+ return name
+
+def _declare_file(go, path = "", ext = "", name = ""):
+ return go.actions.declare_file(_child_name(go, path, ext, name))
+
+def _declare_directory(go, path = "", ext = "", name = ""):
+ return go.actions.declare_directory(_child_name(go, path, ext, name))
+
+def _new_args(go):
+ # TODO(jayconrod): print warning.
+ return go.builder_args(go)
+
+def _builder_args(go, command = None):
+ args = go.actions.args()
+ args.use_param_file("-param=%s")
+ args.set_param_file_format("shell")
+ if command:
+ args.add(command)
+ args.add("-sdk", go.sdk.root_file.dirname)
+ args.add("-installsuffix", installsuffix(go.mode))
+ args.add_joined("-tags", go.tags, join_with = ",")
+ return args
+
+def _tool_args(go):
+ args = go.actions.args()
+ args.use_param_file("-param=%s")
+ args.set_param_file_format("shell")
+ return args
+
+def _new_library(go, name = None, importpath = None, resolver = None, importable = True, testfilter = None, is_main = False, **kwargs):
+ if not importpath:
+ importpath = go.importpath
+ importmap = go.importmap
+ else:
+ importmap = importpath
+ pathtype = go.pathtype
+ if not importable and pathtype == EXPLICIT_PATH:
+ pathtype = EXPORT_PATH
+
+ return GoLibrary(
+ name = go.label.name if not name else name,
+ label = go.label,
+ importpath = importpath,
+ importmap = importmap,
+ importpath_aliases = go.importpath_aliases,
+ pathtype = pathtype,
+ resolve = resolver,
+ testfilter = testfilter,
+ is_main = is_main,
+ **kwargs
+ )
+
+def _merge_embed(source, embed):
+ s = get_source(embed)
+ source["srcs"] = s.srcs + source["srcs"]
+ source["orig_srcs"] = s.orig_srcs + source["orig_srcs"]
+ source["orig_src_map"].update(s.orig_src_map)
+ source["embedsrcs"] = source["embedsrcs"] + s.embedsrcs
+ source["cover"] = source["cover"] + s.cover
+ source["deps"] = source["deps"] + s.deps
+ source["x_defs"].update(s.x_defs)
+ source["gc_goopts"] = source["gc_goopts"] + s.gc_goopts
+ source["runfiles"] = source["runfiles"].merge(s.runfiles)
+ if s.cgo and source["cgo"]:
+ fail("multiple libraries with cgo enabled")
+ source["cgo"] = source["cgo"] or s.cgo
+ source["cdeps"] = source["cdeps"] or s.cdeps
+ source["cppopts"] = source["cppopts"] or s.cppopts
+ source["copts"] = source["copts"] or s.copts
+ source["cxxopts"] = source["cxxopts"] or s.cxxopts
+ source["clinkopts"] = source["clinkopts"] or s.clinkopts
+ source["cgo_deps"] = source["cgo_deps"] + s.cgo_deps
+ source["cgo_exports"] = source["cgo_exports"] + s.cgo_exports
+
+def _dedup_deps(deps):
+ """Returns a list of deps without duplicate import paths.
+
+ Earlier targets take precedence over later targets. This is intended to
+ allow an embedding library to override the dependencies of its
+ embedded libraries.
+
+ Args:
+ deps: an iterable containing either Targets or GoArchives.
+ """
+ deduped_deps = []
+ importpaths = {}
+ for dep in deps:
+ if hasattr(dep, "data") and hasattr(dep.data, "importpath"):
+ importpath = dep.data.importpath
+ else:
+ importpath = dep[GoLibrary].importpath
+ if importpath in importpaths:
+ continue
+ importpaths[importpath] = None
+ deduped_deps.append(dep)
+ return deduped_deps
+
+def _library_to_source(go, attr, library, coverage_instrumented):
+ #TODO: stop collapsing a depset in this line...
+ attr_srcs = [f for t in getattr(attr, "srcs", []) for f in as_iterable(t.files)]
+ generated_srcs = getattr(library, "srcs", [])
+ srcs = attr_srcs + generated_srcs
+ embedsrcs = [f for t in getattr(attr, "embedsrcs", []) for f in as_iterable(t.files)]
+ source = {
+ "library": library,
+ "mode": go.mode,
+ "srcs": srcs,
+ "orig_srcs": srcs,
+ "orig_src_map": {},
+ "cover": [],
+ "embedsrcs": embedsrcs,
+ "x_defs": {},
+ "deps": getattr(attr, "deps", []),
+ "gc_goopts": _expand_opts(go, "gc_goopts", getattr(attr, "gc_goopts", [])),
+ "runfiles": _collect_runfiles(go, getattr(attr, "data", []), getattr(attr, "deps", [])),
+ "cgo": getattr(attr, "cgo", False),
+ "cdeps": getattr(attr, "cdeps", []),
+ "cppopts": _expand_opts(go, "cppopts", getattr(attr, "cppopts", [])),
+ "copts": _expand_opts(go, "copts", getattr(attr, "copts", [])),
+ "cxxopts": _expand_opts(go, "cxxopts", getattr(attr, "cxxopts", [])),
+ "clinkopts": _expand_opts(go, "clinkopts", getattr(attr, "clinkopts", [])),
+ "cgo_deps": [],
+ "cgo_exports": [],
+ "cc_info": None,
+ }
+ if coverage_instrumented:
+ source["cover"] = attr_srcs
+ for dep in source["deps"]:
+ _check_binary_dep(go, dep, "deps")
+ for e in getattr(attr, "embed", []):
+ _check_binary_dep(go, e, "embed")
+ _merge_embed(source, e)
+ source["deps"] = _dedup_deps(source["deps"])
+ x_defs = source["x_defs"]
+ for k, v in getattr(attr, "x_defs", {}).items():
+ v = _expand_location(go, attr, v)
+ if "." not in k:
+ k = "{}.{}".format(library.importmap, k)
+ x_defs[k] = v
+ source["x_defs"] = x_defs
+ if not source["cgo"]:
+ for k in ("cdeps", "cppopts", "copts", "cxxopts", "clinkopts"):
+ if getattr(attr, k, None):
+ fail(k + " set without cgo = True")
+ for f in source["srcs"]:
+ # This check won't report directory sources that contain C/C++
+ # sources. compilepkg will catch these instead.
+ if f.extension in ("c", "cc", "cxx", "cpp", "hh", "hpp", "hxx"):
+ fail("source {} has C/C++ extension, but cgo was not enabled (set 'cgo = True')".format(f.path))
+ if library.resolve:
+ library.resolve(go, attr, source, _merge_embed)
+ source["cc_info"] = _collect_cc_infos(source["deps"], source["cdeps"])
+ return GoSource(**source)
+
+def _collect_runfiles(go, data, deps):
+ """Builds a set of runfiles from the deps and data attributes.
+
+ srcs and their runfiles are not included."""
+ files = depset(transitive = [t[DefaultInfo].files for t in data])
+ runfiles = go._ctx.runfiles(transitive_files = files)
+ for t in data:
+ runfiles = runfiles.merge(t[DefaultInfo].data_runfiles)
+ for t in deps:
+ runfiles = runfiles.merge(get_source(t).runfiles)
+ return runfiles
+
+def _collect_cc_infos(deps, cdeps):
+ cc_infos = []
+ for dep in cdeps:
+ if CcInfo in dep:
+ cc_infos.append(dep[CcInfo])
+ for dep in deps:
+ # dep may be a struct, which doesn't support indexing by providers.
+ if is_struct(dep):
+ continue
+ if GoSource in dep:
+ cc_infos.append(dep[GoSource].cc_info)
+ return cc_common.merge_cc_infos(cc_infos = cc_infos)
+
+def _check_binary_dep(go, dep, edge):
+ """Checks that this rule doesn't depend on a go_binary or go_test.
+
+ go_binary and go_test may return provides with useful information for other
+ rules (like go_path), but go_binary and go_test may not depend on other
+ go_binary and go_binary targets. Their dependencies may be built in
+ different modes, resulting in conflicts and opaque errors.
+ """
+ if (type(dep) == "Target" and
+ DefaultInfo in dep and
+ getattr(dep[DefaultInfo], "files_to_run", None) and
+ dep[DefaultInfo].files_to_run.executable):
+ fail("rule {rule} depends on executable {dep} via {edge}. This is not safe for cross-compilation. Depend on go_library instead.".format(
+ rule = str(go.label),
+ dep = str(dep.label),
+ edge = edge,
+ ))
+
+def _check_importpaths(ctx):
+ paths = []
+ p = getattr(ctx.attr, "importpath", "")
+ if p:
+ paths.append(p)
+ p = getattr(ctx.attr, "importmap", "")
+ if p:
+ paths.append(p)
+ paths.extend(getattr(ctx.attr, "importpath_aliases", ()))
+
+ for p in paths:
+ if ":" in p:
+ fail("import path '%s' contains invalid character :" % p)
+
+def _infer_importpath(ctx):
+ DEFAULT_LIB = "go_default_library"
+ VENDOR_PREFIX = "/vendor/"
+
+ # Check if paths were explicitly set, either in this rule or in an
+ # embedded rule.
+ attr_importpath = getattr(ctx.attr, "importpath", "")
+ attr_importmap = getattr(ctx.attr, "importmap", "")
+ embed_importpath = ""
+ embed_importmap = ""
+ for embed in getattr(ctx.attr, "embed", []):
+ if GoLibrary not in embed:
+ continue
+ lib = embed[GoLibrary]
+ if lib.pathtype == EXPLICIT_PATH:
+ embed_importpath = lib.importpath
+ embed_importmap = lib.importmap
+ break
+
+ importpath = attr_importpath or embed_importpath
+ importmap = attr_importmap or embed_importmap or importpath
+ if importpath:
+ return importpath, importmap, EXPLICIT_PATH
+
+ # Guess an import path based on the directory structure
+ # This should only really be relied on for binaries
+ importpath = ctx.label.package
+ if ctx.label.name != DEFAULT_LIB and not importpath.endswith(ctx.label.name):
+ importpath += "/" + ctx.label.name
+ if importpath.rfind(VENDOR_PREFIX) != -1:
+ importpath = importpath[len(VENDOR_PREFIX) + importpath.rfind(VENDOR_PREFIX):]
+ if importpath.startswith("/"):
+ importpath = importpath[1:]
+ return importpath, importpath, INFERRED_PATH
+
+def go_context(ctx, attr = None):
+ """Returns an API used to build Go code.
+
+ See /go/toolchains.rst#go-context
+ """
+ if not attr:
+ attr = ctx.attr
+ toolchain = ctx.toolchains[GO_TOOLCHAIN]
+ cgo_context_info = None
+ go_config_info = None
+ stdlib = None
+ coverdata = None
+ nogo = None
+ if hasattr(attr, "_go_context_data"):
+ go_context_data = _flatten_possibly_transitioned_attr(attr._go_context_data)
+ if CgoContextInfo in go_context_data:
+ cgo_context_info = go_context_data[CgoContextInfo]
+ go_config_info = go_context_data[GoConfigInfo]
+ stdlib = go_context_data[GoStdLib]
+ coverdata = go_context_data[GoContextInfo].coverdata
+ nogo = go_context_data[GoContextInfo].nogo
+ if getattr(attr, "_cgo_context_data", None) and CgoContextInfo in attr._cgo_context_data:
+ cgo_context_info = attr._cgo_context_data[CgoContextInfo]
+ if getattr(attr, "cgo_context_data", None) and CgoContextInfo in attr.cgo_context_data:
+ cgo_context_info = attr.cgo_context_data[CgoContextInfo]
+ if hasattr(attr, "_go_config"):
+ go_config_info = attr._go_config[GoConfigInfo]
+ if hasattr(attr, "_stdlib"):
+ stdlib = _flatten_possibly_transitioned_attr(attr._stdlib)[GoStdLib]
+
+ mode = get_mode(ctx, toolchain, cgo_context_info, go_config_info)
+ tags = mode.tags
+ binary = toolchain.sdk.go
+
+ if stdlib:
+ goroot = stdlib.root_file.dirname
+ else:
+ goroot = toolchain.sdk.root_file.dirname
+
+ env = {
+ "GOARCH": mode.goarch,
+ "GOOS": mode.goos,
+ "GOEXPERIMENT": ",".join(toolchain.sdk.experiments),
+ "GOROOT": goroot,
+ "GOROOT_FINAL": "GOROOT",
+ "CGO_ENABLED": "0" if mode.pure else "1",
+
+ # If we use --action_env=GOPATH, or in other cases where environment
+ # variables are passed through to this builder, the SDK build will try
+ # to write to that GOPATH (e.g. for x/net/nettest). This will fail if
+ # the GOPATH is on a read-only mount, and is generally a bad idea.
+ # Explicitly clear this environment variable to ensure that doesn't
+ # happen. See #2291 for more information.
+ "GOPATH": "",
+ }
+
+ # The level of support is determined by the platform constraints in
+ # //go/constraints/amd64.
+ # See https://github.com/golang/go/wiki/MinimumRequirements#amd64
+ if mode.amd64:
+ env["GOAMD64"] = mode.amd64
+ if not cgo_context_info:
+ crosstool = []
+ cgo_tools = None
+ else:
+ env.update(cgo_context_info.env)
+ crosstool = cgo_context_info.crosstool
+
+ # Add C toolchain directories to PATH.
+ # On ARM, go tool link uses some features of gcc to complete its work,
+ # so PATH is needed on ARM.
+ path_set = {}
+ if "PATH" in env:
+ for p in env["PATH"].split(ctx.configuration.host_path_separator):
+ path_set[p] = None
+ cgo_tools = cgo_context_info.cgo_tools
+ tool_paths = [
+ cgo_tools.c_compiler_path,
+ cgo_tools.ld_executable_path,
+ cgo_tools.ld_static_lib_path,
+ cgo_tools.ld_dynamic_lib_path,
+ ]
+ for tool_path in tool_paths:
+ tool_dir, _, _ = tool_path.rpartition("/")
+ path_set[tool_dir] = None
+ paths = sorted(path_set.keys())
+ if ctx.configuration.host_path_separator == ":":
+ # HACK: ":" is a proxy for a UNIX-like host.
+ # The tools returned above may be bash scripts that reference commands
+ # in directories we might not otherwise include. For example,
+ # on macOS, wrapped_ar calls dirname.
+ if "/bin" not in path_set:
+ paths.append("/bin")
+ if "/usr/bin" not in path_set:
+ paths.append("/usr/bin")
+ env["PATH"] = ctx.configuration.host_path_separator.join(paths)
+
+ # TODO(jayconrod): remove this. It's way too broad. Everything should
+ # depend on more specific lists.
+ sdk_files = ([toolchain.sdk.go] +
+ toolchain.sdk.srcs +
+ toolchain.sdk.headers +
+ toolchain.sdk.libs +
+ toolchain.sdk.tools)
+
+ _check_importpaths(ctx)
+ importpath, importmap, pathtype = _infer_importpath(ctx)
+ importpath_aliases = tuple(getattr(attr, "importpath_aliases", ()))
+
+ return struct(
+ # Fields
+ toolchain = toolchain,
+ sdk = toolchain.sdk,
+ mode = mode,
+ root = goroot,
+ go = binary,
+ stdlib = stdlib,
+ sdk_root = toolchain.sdk.root_file,
+ sdk_files = sdk_files,
+ sdk_tools = toolchain.sdk.tools,
+ actions = ctx.actions,
+ exe_extension = goos_to_extension(mode.goos),
+ shared_extension = goos_to_shared_extension(mode.goos),
+ crosstool = crosstool,
+ package_list = toolchain.sdk.package_list,
+ importpath = importpath,
+ importmap = importmap,
+ importpath_aliases = importpath_aliases,
+ pathtype = pathtype,
+ cgo_tools = cgo_tools,
+ nogo = nogo,
+ coverdata = coverdata,
+ coverage_enabled = ctx.configuration.coverage_enabled,
+ coverage_instrumented = ctx.coverage_instrumented(),
+ env = env,
+ tags = tags,
+ stamp = mode.stamp,
+ label = ctx.label,
+ cover_format = mode.cover_format,
+ # Action generators
+ archive = toolchain.actions.archive,
+ binary = toolchain.actions.binary,
+ link = toolchain.actions.link,
+
+ # Helpers
+ args = _new_args, # deprecated
+ builder_args = _builder_args,
+ tool_args = _tool_args,
+ new_library = _new_library,
+ library_to_source = _library_to_source,
+ declare_file = _declare_file,
+ declare_directory = _declare_directory,
+
+ # Private
+ # TODO: All uses of this should be removed
+ _ctx = ctx,
+ )
+
+def _go_context_data_impl(ctx):
+ if "race" in ctx.features:
+ print("WARNING: --features=race is no longer supported. Use --@io_bazel_rules_go//go/config:race instead.")
+ if "msan" in ctx.features:
+ print("WARNING: --features=msan is no longer supported. Use --@io_bazel_rules_go//go/config:msan instead.")
+ nogo = ctx.files.nogo[0] if ctx.files.nogo else None
+ providers = [
+ GoContextInfo(
+ coverdata = ctx.attr.coverdata[GoArchive],
+ nogo = nogo,
+ ),
+ ctx.attr.stdlib[GoStdLib],
+ ctx.attr.go_config[GoConfigInfo],
+ ]
+ if ctx.attr.cgo_context_data and CgoContextInfo in ctx.attr.cgo_context_data:
+ providers.append(ctx.attr.cgo_context_data[CgoContextInfo])
+ return providers
+
+go_context_data = rule(
+ _go_context_data_impl,
+ attrs = {
+ "cgo_context_data": attr.label(),
+ "coverdata": attr.label(
+ mandatory = True,
+ providers = [GoArchive],
+ ),
+ "go_config": attr.label(
+ mandatory = True,
+ providers = [GoConfigInfo],
+ ),
+ "nogo": attr.label(
+ mandatory = True,
+ cfg = "exec",
+ ),
+ "stdlib": attr.label(
+ mandatory = True,
+ providers = [GoStdLib],
+ ),
+ "_allowlist_function_transition": attr.label(
+ default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
+ ),
+ },
+ doc = """go_context_data gathers information about the build configuration.
+ It is a common dependency of all Go targets.""",
+ toolchains = [GO_TOOLCHAIN],
+ cfg = request_nogo_transition,
+)
+
+def _cgo_context_data_impl(ctx):
+ # TODO(jayconrod): find a way to get a list of files that comprise the
+ # toolchain (to be inputs into actions that need it).
+ # ctx.files._cc_toolchain won't work when cc toolchain resolution
+ # is switched on.
+ cc_toolchain = find_cpp_toolchain(ctx)
+ if cc_toolchain.compiler in _UNSUPPORTED_C_COMPILERS:
+ return []
+
+ feature_configuration = cc_common.configure_features(
+ ctx = ctx,
+ cc_toolchain = cc_toolchain,
+ requested_features = ctx.features,
+ unsupported_features = ctx.disabled_features + _UNSUPPORTED_FEATURES,
+ )
+
+ # TODO(jayconrod): keep the environment separate for different actions.
+ env = {}
+
+ c_compile_variables = cc_common.create_compile_variables(
+ feature_configuration = feature_configuration,
+ cc_toolchain = cc_toolchain,
+ )
+ c_compiler_path = cc_common.get_tool_for_action(
+ feature_configuration = feature_configuration,
+ action_name = C_COMPILE_ACTION_NAME,
+ )
+ c_compile_options = _filter_options(
+ cc_common.get_memory_inefficient_command_line(
+ feature_configuration = feature_configuration,
+ action_name = C_COMPILE_ACTION_NAME,
+ variables = c_compile_variables,
+ ) + ctx.fragments.cpp.copts + ctx.fragments.cpp.conlyopts,
+ _COMPILER_OPTIONS_DENYLIST,
+ )
+ env.update(cc_common.get_environment_variables(
+ feature_configuration = feature_configuration,
+ action_name = C_COMPILE_ACTION_NAME,
+ variables = c_compile_variables,
+ ))
+
+ cxx_compile_variables = cc_common.create_compile_variables(
+ feature_configuration = feature_configuration,
+ cc_toolchain = cc_toolchain,
+ )
+ cxx_compile_options = _filter_options(
+ cc_common.get_memory_inefficient_command_line(
+ feature_configuration = feature_configuration,
+ action_name = CPP_COMPILE_ACTION_NAME,
+ variables = cxx_compile_variables,
+ ) + ctx.fragments.cpp.copts + ctx.fragments.cpp.cxxopts,
+ _COMPILER_OPTIONS_DENYLIST,
+ )
+ env.update(cc_common.get_environment_variables(
+ feature_configuration = feature_configuration,
+ action_name = CPP_COMPILE_ACTION_NAME,
+ variables = cxx_compile_variables,
+ ))
+
+ objc_compile_variables = cc_common.create_compile_variables(
+ feature_configuration = feature_configuration,
+ cc_toolchain = cc_toolchain,
+ )
+ objc_compile_options = _filter_options(
+ cc_common.get_memory_inefficient_command_line(
+ feature_configuration = feature_configuration,
+ action_name = OBJC_COMPILE_ACTION_NAME,
+ variables = objc_compile_variables,
+ ),
+ _COMPILER_OPTIONS_DENYLIST,
+ )
+ env.update(cc_common.get_environment_variables(
+ feature_configuration = feature_configuration,
+ action_name = OBJC_COMPILE_ACTION_NAME,
+ variables = objc_compile_variables,
+ ))
+
+ objcxx_compile_variables = cc_common.create_compile_variables(
+ feature_configuration = feature_configuration,
+ cc_toolchain = cc_toolchain,
+ )
+ objcxx_compile_options = _filter_options(
+ cc_common.get_memory_inefficient_command_line(
+ feature_configuration = feature_configuration,
+ action_name = OBJCPP_COMPILE_ACTION_NAME,
+ variables = objcxx_compile_variables,
+ ),
+ _COMPILER_OPTIONS_DENYLIST,
+ )
+ env.update(cc_common.get_environment_variables(
+ feature_configuration = feature_configuration,
+ action_name = OBJCPP_COMPILE_ACTION_NAME,
+ variables = objcxx_compile_variables,
+ ))
+
+ ld_executable_variables = cc_common.create_link_variables(
+ feature_configuration = feature_configuration,
+ cc_toolchain = cc_toolchain,
+ is_linking_dynamic_library = False,
+ )
+ ld_executable_path = cc_common.get_tool_for_action(
+ feature_configuration = feature_configuration,
+ action_name = CPP_LINK_EXECUTABLE_ACTION_NAME,
+ )
+ ld_executable_options = _filter_options(
+ cc_common.get_memory_inefficient_command_line(
+ feature_configuration = feature_configuration,
+ action_name = CPP_LINK_EXECUTABLE_ACTION_NAME,
+ variables = ld_executable_variables,
+ ) + ctx.fragments.cpp.linkopts,
+ _LINKER_OPTIONS_DENYLIST,
+ )
+ env.update(cc_common.get_environment_variables(
+ feature_configuration = feature_configuration,
+ action_name = CPP_LINK_EXECUTABLE_ACTION_NAME,
+ variables = ld_executable_variables,
+ ))
+
+ # We don't collect options for static libraries. Go always links with
+ # "ar" in "c-archive" mode. We can set the ar executable path with
+ # -extar, but the options are hard-coded to something like -q -c -s.
+ ld_static_lib_variables = cc_common.create_link_variables(
+ feature_configuration = feature_configuration,
+ cc_toolchain = cc_toolchain,
+ is_linking_dynamic_library = False,
+ )
+ ld_static_lib_path = cc_common.get_tool_for_action(
+ feature_configuration = feature_configuration,
+ action_name = CPP_LINK_STATIC_LIBRARY_ACTION_NAME,
+ )
+ env.update(cc_common.get_environment_variables(
+ feature_configuration = feature_configuration,
+ action_name = CPP_LINK_STATIC_LIBRARY_ACTION_NAME,
+ variables = ld_static_lib_variables,
+ ))
+
+ ld_dynamic_lib_variables = cc_common.create_link_variables(
+ feature_configuration = feature_configuration,
+ cc_toolchain = cc_toolchain,
+ is_linking_dynamic_library = True,
+ )
+ ld_dynamic_lib_path = cc_common.get_tool_for_action(
+ feature_configuration = feature_configuration,
+ action_name = CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME,
+ )
+ ld_dynamic_lib_options = _filter_options(
+ cc_common.get_memory_inefficient_command_line(
+ feature_configuration = feature_configuration,
+ action_name = CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME,
+ variables = ld_dynamic_lib_variables,
+ ) + ctx.fragments.cpp.linkopts,
+ _LINKER_OPTIONS_DENYLIST,
+ )
+
+ env.update(cc_common.get_environment_variables(
+ feature_configuration = feature_configuration,
+ action_name = CPP_LINK_DYNAMIC_LIBRARY_ACTION_NAME,
+ variables = ld_dynamic_lib_variables,
+ ))
+
+ tags = []
+ if "gotags" in ctx.var:
+ tags = ctx.var["gotags"].split(",")
+ apple_ensure_options(
+ ctx,
+ env,
+ tags,
+ (c_compile_options, cxx_compile_options, objc_compile_options, objcxx_compile_options),
+ (ld_executable_options, ld_dynamic_lib_options),
+ cc_toolchain.target_gnu_system_name,
+ )
+
+ return [CgoContextInfo(
+ crosstool = cc_toolchain.all_files.to_list(),
+ tags = tags,
+ env = env,
+ cgo_tools = struct(
+ cc_toolchain = cc_toolchain,
+ feature_configuration = feature_configuration,
+ c_compiler_path = c_compiler_path,
+ c_compile_options = c_compile_options,
+ cxx_compile_options = cxx_compile_options,
+ objc_compile_options = objc_compile_options,
+ objcxx_compile_options = objcxx_compile_options,
+ ld_executable_path = ld_executable_path,
+ ld_executable_options = ld_executable_options,
+ ld_static_lib_path = ld_static_lib_path,
+ ld_dynamic_lib_path = ld_dynamic_lib_path,
+ ld_dynamic_lib_options = ld_dynamic_lib_options,
+ ),
+ )]
+
+cgo_context_data = rule(
+ implementation = _cgo_context_data_impl,
+ attrs = {
+ "_cc_toolchain": attr.label(default = "@bazel_tools//tools/cpp:current_cc_toolchain"),
+ "_xcode_config": attr.label(
+ default = "@bazel_tools//tools/osx:current_xcode_config",
+ ),
+ },
+ toolchains = ["@bazel_tools//tools/cpp:toolchain_type"],
+ fragments = ["apple", "cpp"],
+ doc = """Collects information about the C/C++ toolchain. The C/C++ toolchain
+ is needed to build cgo code, but is generally optional. Rules can't have
+ optional toolchains, so instead, we have an optional dependency on this
+ rule.""",
+)
+
+def _cgo_context_data_proxy_impl(ctx):
+ if ctx.attr.actual and CgoContextInfo in ctx.attr.actual:
+ return [ctx.attr.actual[CgoContextInfo]]
+ return []
+
+cgo_context_data_proxy = rule(
+ implementation = _cgo_context_data_proxy_impl,
+ attrs = {
+ "actual": attr.label(),
+ },
+ doc = """Conditionally depends on cgo_context_data and forwards it provider.
+
+ Useful in situations where select cannot be used, like attribute defaults.
+ """,
+)
+
+def _go_config_impl(ctx):
+ return [GoConfigInfo(
+ static = ctx.attr.static[BuildSettingInfo].value,
+ race = ctx.attr.race[BuildSettingInfo].value,
+ msan = ctx.attr.msan[BuildSettingInfo].value,
+ pure = ctx.attr.pure[BuildSettingInfo].value,
+ strip = ctx.attr.strip,
+ debug = ctx.attr.debug[BuildSettingInfo].value,
+ linkmode = ctx.attr.linkmode[BuildSettingInfo].value,
+ gc_linkopts = ctx.attr.gc_linkopts[BuildSettingInfo].value,
+ tags = ctx.attr.gotags[BuildSettingInfo].value,
+ stamp = ctx.attr.stamp,
+ cover_format = ctx.attr.cover_format[BuildSettingInfo].value,
+ gc_goopts = ctx.attr.gc_goopts[BuildSettingInfo].value,
+ amd64 = ctx.attr.amd64,
+ )]
+
+go_config = rule(
+ implementation = _go_config_impl,
+ attrs = {
+ "static": attr.label(
+ mandatory = True,
+ providers = [BuildSettingInfo],
+ ),
+ "race": attr.label(
+ mandatory = True,
+ providers = [BuildSettingInfo],
+ ),
+ "msan": attr.label(
+ mandatory = True,
+ providers = [BuildSettingInfo],
+ ),
+ "pure": attr.label(
+ mandatory = True,
+ providers = [BuildSettingInfo],
+ ),
+ "strip": attr.bool(mandatory = True),
+ "debug": attr.label(
+ mandatory = True,
+ providers = [BuildSettingInfo],
+ ),
+ "linkmode": attr.label(
+ mandatory = True,
+ providers = [BuildSettingInfo],
+ ),
+ "gc_linkopts": attr.label(
+ mandatory = True,
+ providers = [BuildSettingInfo],
+ ),
+ "gotags": attr.label(
+ mandatory = True,
+ providers = [BuildSettingInfo],
+ ),
+ "stamp": attr.bool(mandatory = True),
+ "cover_format": attr.label(
+ mandatory = True,
+ providers = [BuildSettingInfo],
+ ),
+ "gc_goopts": attr.label(
+ mandatory = True,
+ providers = [BuildSettingInfo],
+ ),
+ "amd64": attr.string(),
+ },
+ provides = [GoConfigInfo],
+ doc = """Collects information about build settings in the current
+ configuration. Rules may depend on this instead of depending on all
+ the build settings directly.""",
+)
+
+def _expand_opts(go, attribute_name, opts):
+ return [go._ctx.expand_make_variables(attribute_name, opt, {}) for opt in opts]
+
+def _expand_location(go, attr, s):
+ return go._ctx.expand_location(s, getattr(attr, "data", []))
+
+_LIST_TYPE = type([])
+
+# Used to get attribute values which may have been transitioned.
+# Transitioned attributes end up as lists.
+# We never use split-transitions, so we always expect exactly one element in those lists.
+# But if the attribute wasn't transitioned, it won't be a list.
+def _flatten_possibly_transitioned_attr(maybe_list):
+ if type(maybe_list) == _LIST_TYPE:
+ if len(maybe_list) == 1:
+ return maybe_list[0]
+ else:
+ fail("Expected exactly one element in list but got {}".format(maybe_list))
+ return maybe_list
diff --git a/go/private/extensions.bzl b/go/private/extensions.bzl
new file mode 100644
index 00000000..03d3fea2
--- /dev/null
+++ b/go/private/extensions.bzl
@@ -0,0 +1,190 @@
+load("//go/private:sdk.bzl", "detect_host_platform", "go_download_sdk_rule", "go_host_sdk_rule", "go_multiple_toolchains")
+load("//go/private:repositories.bzl", "go_rules_dependencies")
+
+def host_compatible_toolchain_impl(ctx):
+ ctx.file("BUILD.bazel")
+ ctx.file("defs.bzl", content = """
+HOST_COMPATIBLE_SDK = Label({})
+""".format(repr(ctx.attr.toolchain)))
+
+host_compatible_toolchain = repository_rule(
+ implementation = host_compatible_toolchain_impl,
+ attrs = {
+ # We cannot use attr.label for the `toolchain` attribute since the module extension cannot
+ # refer to the repositories it creates by their apparent repository names.
+ "toolchain": attr.string(
+ doc = "The apparent label of a `ROOT` file in the repository of a host compatible toolchain created by the `go_sdk` extension",
+ mandatory = True,
+ ),
+ },
+ doc = "An external repository to expose the first host compatible toolchain",
+)
+
+_download_tag = tag_class(
+ attrs = {
+ "name": attr.string(),
+ "goos": attr.string(),
+ "goarch": attr.string(),
+ "sdks": attr.string_list_dict(),
+ "urls": attr.string_list(default = ["https://dl.google.com/go/{}"]),
+ "version": attr.string(),
+ "strip_prefix": attr.string(default = "go"),
+ },
+)
+
+_host_tag = tag_class(
+ attrs = {
+ "name": attr.string(),
+ "version": attr.string(),
+ },
+)
+
+# This limit can be increased essentially arbitrarily, but doing so will cause a rebuild of all
+# targets using any of these toolchains due to the changed repository name.
+_MAX_NUM_TOOLCHAINS = 9999
+_TOOLCHAIN_INDEX_PAD_LENGTH = len(str(_MAX_NUM_TOOLCHAINS))
+
+def _go_sdk_impl(ctx):
+ multi_version_module = {}
+ for module in ctx.modules:
+ if module.name in multi_version_module:
+ multi_version_module[module.name] = True
+ else:
+ multi_version_module[module.name] = False
+
+ # We remember the first host compatible toolchain declared by the download and host tags.
+ # The order follows bazel's iteration over modules (the toolchains declared by the root module are considered first).
+ # We know that at least `go_default_sdk` (which is declared by the `rules_go` module itself) is host compatible.
+ first_host_compatible_toolchain = None
+ host_detected_goos, host_detected_goarch = detect_host_platform(ctx)
+ toolchains = []
+ for module in ctx.modules:
+ for index, download_tag in enumerate(module.tags.download):
+ # SDKs without an explicit version are fetched even when not selected by toolchain
+ # resolution. This is acceptable if brought in by the root module, but transitive
+ # dependencies should not slow down the build in this way.
+ if not module.is_root and not download_tag.version:
+ fail("go_sdk.download: version must be specified in non-root module " + module.name)
+
+ # SDKs with an explicit name are at risk of colliding with those from other modules.
+ # This is acceptable if brought in by the root module as the user is responsible for any
+ # conflicts that arise. rules_go itself provides "go_default_sdk", which is used by
+ # Gazelle to bootstrap itself.
+ # TODO(https://github.com/bazelbuild/bazel-gazelle/issues/1469): Investigate whether
+ # Gazelle can use the first user-defined SDK instead to prevent unnecessary downloads.
+ if (not module.is_root and not module.name == "rules_go") and download_tag.name:
+ fail("go_sdk.download: name must not be specified in non-root module " + module.name)
+
+ name = download_tag.name or _default_go_sdk_name(
+ module = module,
+ multi_version = multi_version_module[module.name],
+ tag_type = "download",
+ index = index,
+ )
+ go_download_sdk_rule(
+ name = name,
+ goos = download_tag.goos,
+ goarch = download_tag.goarch,
+ sdks = download_tag.sdks,
+ urls = download_tag.urls,
+ version = download_tag.version,
+ )
+
+ if (not download_tag.goos or download_tag.goos == host_detected_goos) and (not download_tag.goarch or download_tag.goarch == host_detected_goarch):
+ first_host_compatible_toolchain = first_host_compatible_toolchain or "@{}//:ROOT".format(name)
+
+ toolchains.append(struct(
+ goos = download_tag.goos,
+ goarch = download_tag.goarch,
+ sdk_repo = name,
+ sdk_type = "remote",
+ sdk_version = download_tag.version,
+ ))
+
+ for index, host_tag in enumerate(module.tags.host):
+ # Dependencies can rely on rules_go providing a default remote SDK. They can also
+ # configure a specific version of the SDK to use. However, they should not add a
+ # dependency on the host's Go SDK.
+ if not module.is_root:
+ fail("go_sdk.host: cannot be used in non-root module " + module.name)
+
+ name = host_tag.name or _default_go_sdk_name(
+ module = module,
+ multi_version = multi_version_module[module.name],
+ tag_type = "host",
+ index = index,
+ )
+ go_host_sdk_rule(
+ name = name,
+ version = host_tag.version,
+ )
+
+ toolchains.append(struct(
+ goos = "",
+ goarch = "",
+ sdk_repo = name,
+ sdk_type = "host",
+ sdk_version = host_tag.version,
+ ))
+ first_host_compatible_toolchain = first_host_compatible_toolchain or "@{}//:ROOT".format(name)
+
+ host_compatible_toolchain(name = "go_host_compatible_sdk_label", toolchain = first_host_compatible_toolchain)
+ if len(toolchains) > _MAX_NUM_TOOLCHAINS:
+ fail("more than {} go_sdk tags are not supported".format(_MAX_NUM_TOOLCHAINS))
+
+ # Toolchains in a BUILD file are registered in the order given by name, not in the order they
+ # are declared:
+ # https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/packages/Package.java;drc=8e41dce65b97a3d466d6b1e65005abc52a07b90b;l=156
+ # We pad with an index that lexicographically sorts in the same order as if these toolchains
+ # were registered using register_toolchains in their MODULE.bazel files.
+ go_multiple_toolchains(
+ name = "go_toolchains",
+ prefixes = [
+ _toolchain_prefix(index, toolchain.sdk_repo)
+ for index, toolchain in enumerate(toolchains)
+ ],
+ geese = [toolchain.goos for toolchain in toolchains],
+ goarchs = [toolchain.goarch for toolchain in toolchains],
+ sdk_repos = [toolchain.sdk_repo for toolchain in toolchains],
+ sdk_types = [toolchain.sdk_type for toolchain in toolchains],
+ sdk_versions = [toolchain.sdk_version for toolchain in toolchains],
+ )
+
+def _default_go_sdk_name(*, module, multi_version, tag_type, index):
+ # Keep the version out of the repository name if possible to prevent unnecessary rebuilds when
+ # it changes.
+ return "{name}_{version}_{tag_type}_{index}".format(
+ name = module.name,
+ version = module.version if multi_version else "",
+ tag_type = tag_type,
+ index = index,
+ )
+
+def _toolchain_prefix(index, name):
+ """Prefixes the given name with the index, padded with zeros to ensure lexicographic sorting.
+
+ Examples:
+ _toolchain_prefix( 2, "foo") == "_0002_foo_"
+ _toolchain_prefix(2000, "foo") == "_2000_foo_"
+ """
+ return "_{}_{}_".format(_left_pad_zero(index, _TOOLCHAIN_INDEX_PAD_LENGTH), name)
+
+def _left_pad_zero(index, length):
+ if index < 0:
+ fail("index must be non-negative")
+ return ("0" * length + str(index))[-length:]
+
+go_sdk = module_extension(
+ implementation = _go_sdk_impl,
+ tag_classes = {
+ "download": _download_tag,
+ "host": _host_tag,
+ },
+)
+
+def _non_module_dependencies_impl(_ctx):
+ go_rules_dependencies(force = True)
+
+non_module_dependencies = module_extension(
+ implementation = _non_module_dependencies_impl,
+)
diff --git a/go/private/go_toolchain.bzl b/go/private/go_toolchain.bzl
new file mode 100644
index 00000000..2dc3bf4f
--- /dev/null
+++ b/go/private/go_toolchain.bzl
@@ -0,0 +1,219 @@
+# Copyright 2016 The Bazel Go Rules Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+"""
+Toolchain rules used by go.
+"""
+
+load("//go/private:platforms.bzl", "PLATFORMS")
+load("//go/private:providers.bzl", "GoSDK")
+load("//go/private/actions:archive.bzl", "emit_archive")
+load("//go/private/actions:binary.bzl", "emit_binary")
+load("//go/private/actions:link.bzl", "emit_link")
+load("//go/private/actions:stdlib.bzl", "emit_stdlib")
+load("@bazel_skylib//lib:selects.bzl", "selects")
+
+GO_TOOLCHAIN = "@io_bazel_rules_go//go:toolchain"
+
+def _go_toolchain_impl(ctx):
+ sdk = ctx.attr.sdk[GoSDK]
+ cross_compile = ctx.attr.goos != sdk.goos or ctx.attr.goarch != sdk.goarch
+ return [platform_common.ToolchainInfo(
+ # Public fields
+ name = ctx.label.name,
+ cross_compile = cross_compile,
+ default_goos = ctx.attr.goos,
+ default_goarch = ctx.attr.goarch,
+ actions = struct(
+ archive = emit_archive,
+ binary = emit_binary,
+ link = emit_link,
+ stdlib = emit_stdlib,
+ ),
+ flags = struct(
+ compile = (),
+ link = ctx.attr.link_flags,
+ link_cgo = ctx.attr.cgo_link_flags,
+ ),
+ sdk = sdk,
+
+ # Internal fields -- may be read by emit functions.
+ _builder = ctx.executable.builder,
+ )]
+
+go_toolchain = rule(
+ _go_toolchain_impl,
+ attrs = {
+ # Minimum requirements to specify a toolchain
+ "builder": attr.label(
+ mandatory = True,
+ cfg = "exec",
+ executable = True,
+ doc = "Tool used to execute most Go actions",
+ ),
+ "goos": attr.string(
+ mandatory = True,
+ doc = "Default target OS",
+ ),
+ "goarch": attr.string(
+ mandatory = True,
+ doc = "Default target architecture",
+ ),
+ "sdk": attr.label(
+ mandatory = True,
+ providers = [GoSDK],
+ cfg = "exec",
+ doc = "The SDK this toolchain is based on",
+ ),
+ # Optional extras to a toolchain
+ "link_flags": attr.string_list(
+ doc = "Flags passed to the Go internal linker",
+ ),
+ "cgo_link_flags": attr.string_list(
+ doc = "Flags passed to the external linker (if it is used)",
+ ),
+ },
+ doc = "Defines a Go toolchain based on an SDK",
+ provides = [platform_common.ToolchainInfo],
+)
+
+def declare_go_toolchains(host_goos, sdk, builder):
+ """Declares go_toolchain targets for each platform."""
+ for p in PLATFORMS:
+ if p.cgo:
+ # Don't declare separate toolchains for cgo_on / cgo_off.
+ # This is controlled by the cgo_context_data dependency of
+ # go_context_data, which is configured using constraint_values.
+ continue
+
+ link_flags = []
+ cgo_link_flags = []
+ if host_goos == "darwin":
+ cgo_link_flags.extend(["-shared", "-Wl,-all_load"])
+ if host_goos == "linux":
+ cgo_link_flags.append("-Wl,-whole-archive")
+
+ go_toolchain(
+ name = "go_" + p.name + "-impl",
+ goos = p.goos,
+ goarch = p.goarch,
+ sdk = sdk,
+ builder = builder,
+ link_flags = link_flags,
+ cgo_link_flags = cgo_link_flags,
+ tags = ["manual"],
+ visibility = ["//visibility:public"],
+ )
+
+def declare_bazel_toolchains(
+ *,
+ go_toolchain_repo,
+ host_goarch,
+ host_goos,
+ major,
+ minor,
+ patch,
+ prerelease,
+ sdk_type,
+ prefix = ""):
+ """Declares toolchain targets for each platform."""
+
+ sdk_version_label = Label("//go/toolchain:sdk_version")
+
+ native.config_setting(
+ name = prefix + "match_all_versions",
+ flag_values = {
+ sdk_version_label: "",
+ },
+ visibility = ["//visibility:private"],
+ )
+
+ native.config_setting(
+ name = prefix + "match_major_version",
+ flag_values = {
+ sdk_version_label: major,
+ },
+ visibility = ["//visibility:private"],
+ )
+
+ native.config_setting(
+ name = prefix + "match_major_minor_version",
+ flag_values = {
+ sdk_version_label: major + "." + minor,
+ },
+ visibility = ["//visibility:private"],
+ )
+
+ native.config_setting(
+ name = prefix + "match_patch_version",
+ flag_values = {
+ sdk_version_label: major + "." + minor + "." + patch,
+ },
+ visibility = ["//visibility:private"],
+ )
+
+ # If prerelease version is "", this will be the same as ":match_patch_version", but that's fine since we use match_any in config_setting_group.
+ native.config_setting(
+ name = prefix + "match_prerelease_version",
+ flag_values = {
+ sdk_version_label: major + "." + minor + "." + patch + prerelease,
+ },
+ visibility = ["//visibility:private"],
+ )
+
+ native.config_setting(
+ name = prefix + "match_sdk_type",
+ flag_values = {
+ sdk_version_label: sdk_type,
+ },
+ visibility = ["//visibility:private"],
+ )
+
+ selects.config_setting_group(
+ name = prefix + "sdk_version_setting",
+ match_any = [
+ ":" + prefix + "match_all_versions",
+ ":" + prefix + "match_major_version",
+ ":" + prefix + "match_major_minor_version",
+ ":" + prefix + "match_patch_version",
+ ":" + prefix + "match_prerelease_version",
+ ":" + prefix + "match_sdk_type",
+ ],
+ visibility = ["//visibility:private"],
+ )
+
+ for p in PLATFORMS:
+ if p.cgo:
+ # Don't declare separate toolchains for cgo_on / cgo_off.
+ # This is controlled by the cgo_context_data dependency of
+ # go_context_data, which is configured using constraint_values.
+ continue
+
+ cgo_constraints = (
+ "@io_bazel_rules_go//go/toolchain:cgo_off",
+ "@io_bazel_rules_go//go/toolchain:cgo_on",
+ )
+ constraints = [c for c in p.constraints if c not in cgo_constraints]
+
+ native.toolchain(
+ # keep in sync with generate_toolchain_names
+ name = prefix + "go_" + p.name,
+ toolchain_type = GO_TOOLCHAIN,
+ exec_compatible_with = [
+ "@io_bazel_rules_go//go/toolchain:" + host_goos,
+ "@io_bazel_rules_go//go/toolchain:" + host_goarch,
+ ],
+ target_compatible_with = constraints,
+ target_settings = [":" + prefix + "sdk_version_setting"],
+ toolchain = go_toolchain_repo + "//:go_" + p.name + "-impl",
+ )
diff --git a/go/private/mode.bzl b/go/private/mode.bzl
new file mode 100644
index 00000000..83ccd045
--- /dev/null
+++ b/go/private/mode.bzl
@@ -0,0 +1,251 @@
+# Copyright 2017 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Modes are documented in go/modes.rst#compilation-modes
+
+LINKMODE_NORMAL = "normal"
+
+LINKMODE_SHARED = "shared"
+
+LINKMODE_PIE = "pie"
+
+LINKMODE_PLUGIN = "plugin"
+
+LINKMODE_C_SHARED = "c-shared"
+
+LINKMODE_C_ARCHIVE = "c-archive"
+
+LINKMODES = [LINKMODE_NORMAL, LINKMODE_PLUGIN, LINKMODE_C_SHARED, LINKMODE_C_ARCHIVE, LINKMODE_PIE]
+
+# All link modes that produce executables to be run with bazel run.
+LINKMODES_EXECUTABLE = [LINKMODE_NORMAL, LINKMODE_PIE]
+
+# All link modes that require external linking and thus a cgo context.
+LINKMODES_REQUIRING_EXTERNAL_LINKING = [
+ LINKMODE_PLUGIN,
+ LINKMODE_C_ARCHIVE,
+ LINKMODE_C_SHARED,
+]
+
+def mode_string(mode):
+ result = [mode.goos, mode.goarch]
+ if mode.static:
+ result.append("static")
+ if mode.race:
+ result.append("race")
+ if mode.msan:
+ result.append("msan")
+ if mode.pure:
+ result.append("pure")
+ if mode.debug:
+ result.append("debug")
+ if mode.strip:
+ result.append("stripped")
+ if not result or not mode.link == LINKMODE_NORMAL:
+ result.append(mode.link)
+ if mode.gc_goopts:
+ result.extend(mode.gc_goopts)
+ return "_".join(result)
+
+def _ternary(*values):
+ for v in values:
+ if v == None:
+ continue
+ if type(v) == "bool":
+ return v
+ if type(v) != "string":
+ fail("Invalid value type {}".format(type(v)))
+ v = v.lower()
+ if v == "on":
+ return True
+ if v == "off":
+ return False
+ if v == "auto":
+ continue
+ fail("Invalid value {}".format(v))
+ fail("_ternary failed to produce a final result from {}".format(values))
+
+def get_mode(ctx, go_toolchain, cgo_context_info, go_config_info):
+ static = _ternary(go_config_info.static if go_config_info else "off")
+ pure = _ternary(
+ "on" if not cgo_context_info else "auto",
+ go_config_info.pure if go_config_info else "off",
+ )
+ race = _ternary(go_config_info.race if go_config_info else "off")
+ msan = _ternary(go_config_info.msan if go_config_info else "off")
+ strip = go_config_info.strip if go_config_info else False
+ stamp = go_config_info.stamp if go_config_info else False
+ debug = go_config_info.debug if go_config_info else False
+ linkmode = go_config_info.linkmode if go_config_info else LINKMODE_NORMAL
+ cover_format = go_config_info and go_config_info.cover_format
+ amd64 = go_config_info.amd64 if go_config_info else None
+ goos = go_toolchain.default_goos if getattr(ctx.attr, "goos", "auto") == "auto" else ctx.attr.goos
+ goarch = go_toolchain.default_goarch if getattr(ctx.attr, "goarch", "auto") == "auto" else ctx.attr.goarch
+ gc_goopts = go_config_info.gc_goopts if go_config_info else []
+
+ # TODO(jayconrod): check for more invalid and contradictory settings.
+ if pure and race:
+ fail("race instrumentation can't be enabled when cgo is disabled. Check that pure is not set to \"off\" and a C/C++ toolchain is configured.")
+ if pure and msan:
+ fail("msan instrumentation can't be enabled when cgo is disabled. Check that pure is not set to \"off\" and a C/C++ toolchain is configured.")
+ if pure and linkmode in LINKMODES_REQUIRING_EXTERNAL_LINKING:
+ fail(("linkmode '{}' can't be used when cgo is disabled. Check that pure is not set to \"off\" and that a C/C++ toolchain is configured for " +
+ "your current platform. If you defined a custom platform, make sure that it has the @io_bazel_rules_go//go/toolchain:cgo_on constraint value.").format(linkmode))
+
+ gc_linkopts = list(go_config_info.gc_linkopts) if go_config_info else []
+ tags = list(go_config_info.tags) if go_config_info else []
+ if "gotags" in ctx.var:
+ tags.extend(ctx.var["gotags"].split(","))
+ if cgo_context_info:
+ tags.extend(cgo_context_info.tags)
+ if race:
+ tags.append("race")
+ if msan:
+ tags.append("msan")
+
+ return struct(
+ static = static,
+ race = race,
+ msan = msan,
+ pure = pure,
+ link = linkmode,
+ gc_linkopts = gc_linkopts,
+ strip = strip,
+ stamp = stamp,
+ debug = debug,
+ goos = goos,
+ goarch = goarch,
+ tags = tags,
+ cover_format = cover_format,
+ amd64 = amd64,
+ gc_goopts = gc_goopts,
+ )
+
+def installsuffix(mode):
+ s = mode.goos + "_" + mode.goarch
+ if mode.race:
+ s += "_race"
+ elif mode.msan:
+ s += "_msan"
+ return s
+
+def mode_tags_equivalent(l, r):
+ # Returns whether two modes are equivalent for Go build tags. For example,
+ # goos and goarch must match, but static doesn't matter.
+ return (l.goos == r.goos and
+ l.goarch == r.goarch and
+ l.race == r.race and
+ l.msan == r.msan)
+
+# Ported from https://github.com/golang/go/blob/master/src/cmd/go/internal/work/init.go#L76
+_LINK_C_ARCHIVE_PLATFORMS = {
+ "darwin/arm64": None,
+ "ios/arm64": None,
+}
+
+_LINK_C_ARCHIVE_GOOS = {
+ "dragonfly": None,
+ "freebsd": None,
+ "linux": None,
+ "netbsd": None,
+ "openbsd": None,
+ "solaris": None,
+}
+
+_LINK_C_SHARED_GOOS = [
+ "android",
+ "freebsd",
+ "linux",
+]
+
+_LINK_PLUGIN_PLATFORMS = {
+ "linux/amd64": None,
+ "linux/arm": None,
+ "linux/arm64": None,
+ "linux/386": None,
+ "linux/s390x": None,
+ "linux/ppc64le": None,
+ "android/amd64": None,
+ "android/arm": None,
+ "android/arm64": None,
+ "android/386": None,
+ "darwin/amd64": None,
+ "darwin/arm64": None,
+ "ios/arm": None,
+ "ios/arm64": None,
+}
+
+_LINK_PIE_PLATFORMS = {
+ "linux/amd64": None,
+ "linux/arm": None,
+ "linux/arm64": None,
+ "linux/386": None,
+ "linux/s390x": None,
+ "linux/ppc64le": None,
+ "android/amd64": None,
+ "android/arm": None,
+ "android/arm64": None,
+ "android/386": None,
+ "freebsd/amd64": None,
+}
+
+def link_mode_args(mode):
+ # based on buildModeInit in cmd/go/internal/work/init.go
+ platform = mode.goos + "/" + mode.goarch
+ args = []
+ if mode.link == LINKMODE_C_ARCHIVE:
+ if (platform in _LINK_C_ARCHIVE_PLATFORMS or
+ mode.goos in _LINK_C_ARCHIVE_GOOS and platform != "linux/ppc64"):
+ args.append("-shared")
+ elif mode.link == LINKMODE_C_SHARED:
+ if mode.goos in _LINK_C_SHARED_GOOS:
+ args.append("-shared")
+ elif mode.link == LINKMODE_PLUGIN:
+ if platform in _LINK_PLUGIN_PLATFORMS:
+ args.append("-dynlink")
+ elif mode.link == LINKMODE_PIE:
+ if platform in _LINK_PIE_PLATFORMS:
+ args.append("-shared")
+ return args
+
+def extldflags_from_cc_toolchain(go):
+ if not go.cgo_tools:
+ return []
+ elif go.mode.link in (LINKMODE_SHARED, LINKMODE_PLUGIN, LINKMODE_C_SHARED):
+ return go.cgo_tools.ld_dynamic_lib_options
+ else:
+ # NOTE: in c-archive mode, -extldflags are ignored by the linker.
+ # However, we still need to set them for cgo, which links a binary
+ # in each package. We use the executable options for this.
+ return go.cgo_tools.ld_executable_options
+
+def extld_from_cc_toolchain(go):
+ if not go.cgo_tools:
+ return []
+ elif go.mode.link in (LINKMODE_SHARED, LINKMODE_PLUGIN, LINKMODE_C_SHARED, LINKMODE_PIE):
+ return ["-extld", go.cgo_tools.ld_dynamic_lib_path]
+ elif go.mode.link == LINKMODE_C_ARCHIVE:
+ if go.mode.goos in ["darwin", "ios"]:
+ # TODO(jayconrod): on macOS, set -extar. At this time, wrapped_ar is
+ # a bash script without a shebang line, so we can't execute it. We
+ # use /usr/bin/ar (the default) instead.
+ return []
+ else:
+ return ["-extar", go.cgo_tools.ld_static_lib_path]
+ else:
+ # NOTE: In c-archive mode, we should probably set -extar. However,
+ # on macOS, Bazel returns wrapped_ar, which is not executable.
+ # /usr/bin/ar (the default) should be visible though, and we have a
+ # hack in link.go to strip out non-reproducible stuff.
+ return ["-extld", go.cgo_tools.ld_executable_path]
diff --git a/go/private/nogo.bzl b/go/private/nogo.bzl
new file mode 100644
index 00000000..1d3491bb
--- /dev/null
+++ b/go/private/nogo.bzl
@@ -0,0 +1,36 @@
+# Copyright 2018 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+DEFAULT_NOGO = "@io_bazel_rules_go//:default_nogo"
+
+def _go_register_nogo_impl(ctx):
+ ctx.template(
+ "BUILD.bazel",
+ Label("//go/private:BUILD.nogo.bazel"),
+ substitutions = {
+ "{{nogo}}": ctx.attr.nogo,
+ },
+ executable = False,
+ )
+
+# go_register_nogo creates a repository with an alias that points
+# to the nogo rule that should be used globally by go rules in the workspace.
+# This may be called automatically by go_rules_dependencies or by
+# go_register_toolchains.
+go_register_nogo = repository_rule(
+ _go_register_nogo_impl,
+ attrs = {
+ "nogo": attr.string(mandatory = True),
+ },
+)
diff --git a/go/private/platforms.bzl b/go/private/platforms.bzl
new file mode 100644
index 00000000..4da43060
--- /dev/null
+++ b/go/private/platforms.bzl
@@ -0,0 +1,180 @@
+# Copyright 2019 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# platforms.bzl defines PLATFORMS, a table that describes each possible
+# target platform. This table is used to generate config_settings,
+# constraint_values, platforms, and toolchains.
+
+BAZEL_GOOS_CONSTRAINTS = {
+ "android": "@platforms//os:android",
+ "darwin": "@platforms//os:osx",
+ "freebsd": "@platforms//os:freebsd",
+ "ios": "@platforms//os:ios",
+ "linux": "@platforms//os:linux",
+ "windows": "@platforms//os:windows",
+}
+
+BAZEL_GOARCH_CONSTRAINTS = {
+ "386": "@platforms//cpu:x86_32",
+ "amd64": "@platforms//cpu:x86_64",
+ "arm": "@platforms//cpu:arm",
+ "arm64": "@platforms//cpu:aarch64",
+ "ppc64": "@platforms//cpu:ppc",
+ "ppc64le": "@platforms//cpu:ppc",
+ "s390x": "@platforms//cpu:s390x",
+}
+
+GOOS_GOARCH = (
+ ("aix", "ppc64"),
+ ("android", "386"),
+ ("android", "amd64"),
+ ("android", "arm"),
+ ("android", "arm64"),
+ ("darwin", "386"),
+ ("darwin", "amd64"),
+ ("darwin", "arm"),
+ ("darwin", "arm64"),
+ ("dragonfly", "amd64"),
+ ("freebsd", "386"),
+ ("freebsd", "amd64"),
+ ("freebsd", "arm"),
+ ("freebsd", "arm64"),
+ ("illumos", "amd64"),
+ ("ios", "amd64"),
+ ("ios", "arm64"),
+ ("js", "wasm"),
+ ("linux", "386"),
+ ("linux", "amd64"),
+ ("linux", "arm"),
+ ("linux", "arm64"),
+ ("linux", "mips"),
+ ("linux", "mips64"),
+ ("linux", "mips64le"),
+ ("linux", "mipsle"),
+ ("linux", "ppc64"),
+ ("linux", "ppc64le"),
+ ("linux", "riscv64"),
+ ("linux", "s390x"),
+ ("nacl", "386"),
+ ("nacl", "amd64p32"),
+ ("nacl", "arm"),
+ ("netbsd", "386"),
+ ("netbsd", "amd64"),
+ ("netbsd", "arm"),
+ ("netbsd", "arm64"),
+ ("openbsd", "386"),
+ ("openbsd", "amd64"),
+ ("openbsd", "arm"),
+ ("openbsd", "arm64"),
+ ("plan9", "386"),
+ ("plan9", "amd64"),
+ ("plan9", "arm"),
+ ("solaris", "amd64"),
+ ("windows", "386"),
+ ("windows", "amd64"),
+ ("windows", "arm"),
+ ("windows", "arm64"),
+)
+
+RACE_GOOS_GOARCH = {
+ ("darwin", "amd64"): None,
+ ("freebsd", "amd64"): None,
+ ("linux", "amd64"): None,
+ ("windows", "amd64"): None,
+}
+
+MSAN_GOOS_GOARCH = {
+ ("linux", "amd64"): None,
+}
+
+CGO_GOOS_GOARCH = {
+ ("aix", "ppc64"): None,
+ ("android", "386"): None,
+ ("android", "amd64"): None,
+ ("android", "arm"): None,
+ ("android", "arm64"): None,
+ ("darwin", "amd64"): None,
+ ("darwin", "arm"): None,
+ ("darwin", "arm64"): None,
+ ("dragonfly", "amd64"): None,
+ ("freebsd", "386"): None,
+ ("freebsd", "amd64"): None,
+ ("freebsd", "arm"): None,
+ ("illumos", "amd64"): None,
+ ("ios", "amd64"): None,
+ ("ios", "arm64"): None,
+ ("linux", "386"): None,
+ ("linux", "amd64"): None,
+ ("linux", "arm"): None,
+ ("linux", "arm64"): None,
+ ("linux", "mips"): None,
+ ("linux", "mips64"): None,
+ ("linux", "mips64le"): None,
+ ("linux", "mipsle"): None,
+ ("linux", "ppc64le"): None,
+ ("linux", "riscv64"): None,
+ ("linux", "s390x"): None,
+ ("linux", "sparc64"): None,
+ ("netbsd", "386"): None,
+ ("netbsd", "amd64"): None,
+ ("netbsd", "arm"): None,
+ ("netbsd", "arm64"): None,
+ ("openbsd", "386"): None,
+ ("openbsd", "amd64"): None,
+ ("openbsd", "arm"): None,
+ ("openbsd", "arm64"): None,
+ ("solaris", "amd64"): None,
+ ("windows", "386"): None,
+ ("windows", "amd64"): None,
+ ("windows", "arm64"): None,
+}
+
+def _generate_constraints(names, bazel_constraints):
+ return {
+ name: bazel_constraints.get(name, "@io_bazel_rules_go//go/toolchain:" + name)
+ for name in names
+ }
+
+GOOS_CONSTRAINTS = _generate_constraints([p[0] for p in GOOS_GOARCH], BAZEL_GOOS_CONSTRAINTS)
+GOARCH_CONSTRAINTS = _generate_constraints([p[1] for p in GOOS_GOARCH], BAZEL_GOARCH_CONSTRAINTS)
+
+def _generate_platforms():
+ platforms = []
+ for goos, goarch in GOOS_GOARCH:
+ constraints = [
+ GOOS_CONSTRAINTS[goos],
+ GOARCH_CONSTRAINTS[goarch],
+ ]
+ platforms.append(struct(
+ name = goos + "_" + goarch,
+ goos = goos,
+ goarch = goarch,
+ constraints = constraints + ["@io_bazel_rules_go//go/toolchain:cgo_off"],
+ cgo = False,
+ ))
+ if (goos, goarch) in CGO_GOOS_GOARCH:
+ # On Windows, Bazel will pick an MSVC toolchain unless we
+ # specifically request mingw or msys.
+ mingw = ["@bazel_tools//tools/cpp:mingw"] if goos == "windows" else []
+ platforms.append(struct(
+ name = goos + "_" + goarch + "_cgo",
+ goos = goos,
+ goarch = goarch,
+ constraints = constraints + ["@io_bazel_rules_go//go/toolchain:cgo_on"] + mingw,
+ cgo = True,
+ ))
+
+ return platforms
+
+PLATFORMS = _generate_platforms()
diff --git a/go/private/providers.bzl b/go/private/providers.bzl
new file mode 100644
index 00000000..16a106aa
--- /dev/null
+++ b/go/private/providers.bzl
@@ -0,0 +1,117 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# A represenatation of the inputs to a go package.
+# This is a configuration independent provider.
+# You must call resolve with a mode to produce a GoSource.
+# See go/providers.rst#GoLibrary for full documentation.
+GoLibrary = provider()
+
+# The filtered inputs and dependencies needed to build a GoArchive
+# This is a configuration specific provider.
+# It has no transitive information.
+# See go/providers.rst#GoSource for full documentation.
+GoSource = provider()
+
+# This compiled form of a package used in transitive dependencies.
+# This is a configuration specific provider.
+# See go/providers.rst#GoArchiveData for full documentation.
+GoArchiveData = provider()
+
+# The compiled form of a GoLibrary, with everything needed to link it into a binary.
+# This is a configuration specific provider.
+# See go/providers.rst#GoArchive for full documentation.
+GoArchive = provider()
+
+GoPath = provider()
+
+GoSDK = provider(
+ doc = "Contains information about the Go SDK used in the toolchain",
+ fields = {
+ "goos": "The host OS the SDK was built for.",
+ "goarch": "The host architecture the SDK was built for.",
+ "experiments": "Go experiments to enable via GOEXPERIMENT.",
+ "root_file": "A file in the SDK root directory",
+ "libs": ("List of pre-compiled .a files for the standard library " +
+ "built for the execution platform."),
+ "headers": ("List of .h files from pkg/include that may be included " +
+ "in assembly sources."),
+ "srcs": ("List of source files for importable packages in the " +
+ "standard library. Internal, vendored, and tool packages " +
+ "may not be included."),
+ "package_list": ("A file containing a list of importable packages " +
+ "in the standard library."),
+ "tools": ("List of executable files in the SDK built for " +
+ "the execution platform, excluding the go binary file"),
+ "go": "The go binary file",
+ "version": "The Go SDK version",
+ },
+)
+
+GoStdLib = provider()
+
+GoConfigInfo = provider()
+
+GoContextInfo = provider()
+
+CgoContextInfo = provider()
+
+EXPLICIT_PATH = "explicit"
+
+INFERRED_PATH = "inferred"
+
+EXPORT_PATH = "export"
+
+def get_source(dep):
+ if type(dep) == "struct":
+ return dep
+ return dep[GoSource]
+
+def get_archive(dep):
+ if type(dep) == "struct":
+ return dep
+ return dep[GoArchive]
+
+def effective_importpath_pkgpath(lib):
+ """Returns import and package paths for a given lib with modifications for display.
+
+ This is used when we need to represent sources in a manner compatible with Go
+ build (e.g., for packaging or coverage data listing). _test suffixes are
+ removed, and vendor directories from importmap may be modified.
+
+ Args:
+ lib: GoLibrary or GoArchiveData
+
+ Returns:
+ A tuple of effective import path and effective package path. Both are ""
+ for synthetic archives (e.g., generated testmain).
+ """
+ if lib.pathtype not in (EXPLICIT_PATH, EXPORT_PATH):
+ return "", ""
+ importpath = lib.importpath
+ importmap = lib.importmap
+ if importpath.endswith("_test"):
+ importpath = importpath[:-len("_test")]
+ if importmap.endswith("_test"):
+ importmap = importmap[:-len("_test")]
+ parts = importmap.split("/")
+ if "vendor" not in parts:
+ # Unusual case not handled by go build. Just return importpath.
+ return importpath, importpath
+ elif len(parts) > 2 and lib.label.workspace_root == "external/" + parts[0]:
+ # Common case for importmap set by Gazelle in external repos.
+ return importpath, importmap[len(parts[0]):]
+ else:
+ # Vendor directory somewhere in the main repo. Leave it alone.
+ return importpath, importmap
diff --git a/go/private/repositories.bzl b/go/private/repositories.bzl
new file mode 100644
index 00000000..910e5bea
--- /dev/null
+++ b/go/private/repositories.bzl
@@ -0,0 +1,300 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Once nested repositories work, this file should cease to exist.
+
+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):
+ """Declares workspaces the Go rules depend on. Workspaces that use
+ rules_go should call this.
+
+ See https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#overriding-dependencies
+ for information on each dependency.
+
+ Instructions for updating this file are in
+ https://github.com/bazelbuild/rules_go/wiki/Updating-dependencies.
+
+ PRs updating dependencies are NOT ACCEPTED. See
+ https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#overriding-dependencies
+ for information on choosing different versions of these repositories
+ in your own project.
+ """
+ if getattr(native, "bazel_version", None):
+ versions.check(MINIMUM_BAZEL_VERSION, bazel_version = native.bazel_version)
+
+ if force:
+ wrapper = _always
+ else:
+ wrapper = _maybe
+
+ # Needed by rules_go implementation and tests.
+ # We can't call bazel_skylib_workspace from here. At the moment, it's only
+ # used to register unittest toolchains, which rules_go does not need.
+ # releaser:upgrade-dep bazelbuild bazel-skylib
+ wrapper(
+ http_archive,
+ name = "bazel_skylib",
+ # 1.4.1, latest as of 2023-03-27
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz",
+ "https://github.com/bazelbuild/bazel-skylib/releases/download/1.4.1/bazel-skylib-1.4.1.tar.gz",
+ ],
+ sha256 = "b8a1527901774180afc798aeb28c4634bdccf19c4d98e7bdd1ce79d1fe9aaad7",
+ strip_prefix = "",
+ )
+
+ # Needed for nogo vet checks and go/packages.
+ # releaser:upgrade-dep golang tools
+ wrapper(
+ http_archive,
+ name = "org_golang_x_tools",
+ # v0.7.0, latest as of 2023-03-27
+ urls = [
+ "https://mirror.bazel.build/github.com/golang/tools/archive/refs/tags/v0.7.0.zip",
+ "https://github.com/golang/tools/archive/refs/tags/v0.7.0.zip",
+ ],
+ sha256 = "9f20a20f29f4008d797a8be882ef82b69cf8f7f2b96dbdfe3814c57d8280fa4b",
+ strip_prefix = "tools-0.7.0",
+ patches = [
+ # deletegopls removes the gopls subdirectory. It contains a nested
+ # module with additional dependencies. It's not needed by rules_go.
+ # releaser:patch-cmd rm -rf gopls
+ Label("//third_party:org_golang_x_tools-deletegopls.patch"),
+ # releaser:patch-cmd gazelle -repo_root . -go_prefix golang.org/x/tools -go_naming_convention import_alias
+ Label("//third_party:org_golang_x_tools-gazelle.patch"),
+ ],
+ patch_args = ["-p1"],
+ )
+
+ # releaser:upgrade-dep golang sys
+ wrapper(
+ http_archive,
+ name = "org_golang_x_sys",
+ # v0.6.0, latest as of 2023-03-27
+ urls = [
+ "https://mirror.bazel.build/github.com/golang/sys/archive/refs/tags/v0.6.0.zip",
+ "https://github.com/golang/sys/archive/refs/tags/v0.6.0.zip",
+ ],
+ sha256 = "7f2399398b2eb4f1f495cc754d6353566e0ad934ee0eb46505e55162e0def56d",
+ strip_prefix = "sys-0.6.0",
+ patches = [
+ # releaser:patch-cmd gazelle -repo_root . -go_prefix golang.org/x/sys -go_naming_convention import_alias
+ Label("//third_party:org_golang_x_sys-gazelle.patch"),
+ ],
+ patch_args = ["-p1"],
+ )
+
+ # Needed by golang.org/x/tools/go/packages
+ # releaser:upgrade-dep golang xerrors
+ wrapper(
+ http_archive,
+ name = "org_golang_x_xerrors",
+ # master, as of 2023-03-27
+ urls = [
+ "https://mirror.bazel.build/github.com/golang/xerrors/archive/04be3eba64a22a838cdb17b8dca15a52871c08b4.zip",
+ "https://github.com/golang/xerrors/archive/04be3eba64a22a838cdb17b8dca15a52871c08b4.zip",
+ ],
+ sha256 = "ffad2b06ef2e09d040da2ff08077865e99ab95d4d0451737fc8e33706bb01634",
+ strip_prefix = "xerrors-04be3eba64a22a838cdb17b8dca15a52871c08b4",
+ patches = [
+ # releaser:patch-cmd gazelle -repo_root . -go_prefix golang.org/x/xerrors -go_naming_convention import_alias
+ Label("//third_party:org_golang_x_xerrors-gazelle.patch"),
+ ],
+ patch_args = ["-p1"],
+ )
+
+ # Proto dependencies
+ # These are limited as much as possible. In most cases, users need to
+ # declare these on their own (probably via go_repository rules generated
+ # with 'gazelle update-repos -from_file=go.mod). There are several
+ # reasons for this:
+ #
+ # * 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.
+ # * 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.
+ # * Most proto repos are updated more frequently than rules_go, and
+ # we can't keep up.
+
+ # Go protobuf runtime library and utilities.
+ # releaser:upgrade-dep protocolbuffers protobuf-go
+ wrapper(
+ http_archive,
+ name = "org_golang_google_protobuf",
+ sha256 = "cb1a05581c33b3705ede6c08edf9b9c1dbc579559ba30f532704c324e42bf801",
+ # v1.30.0, latest as of 2023-03-27
+ urls = [
+ "https://mirror.bazel.build/github.com/protocolbuffers/protobuf-go/archive/refs/tags/v1.30.0.zip",
+ "https://github.com/protocolbuffers/protobuf-go/archive/refs/tags/v1.30.0.zip",
+ ],
+ strip_prefix = "protobuf-go-1.30.0",
+ patches = [
+ # releaser:patch-cmd gazelle -repo_root . -go_prefix google.golang.org/protobuf -go_naming_convention import_alias -proto disable_global
+ Label("//third_party:org_golang_google_protobuf-gazelle.patch"),
+ ],
+ patch_args = ["-p1"],
+ )
+
+ # Legacy protobuf compiler, runtime, and utilities.
+ # We still use protoc-gen-go because the new one doesn't support gRPC, and
+ # the gRPC compiler doesn't exist yet.
+ # We need to apply a patch to enable both go_proto_library and
+ # go_library with pre-generated sources.
+ # releaser:upgrade-dep golang protobuf
+ wrapper(
+ http_archive,
+ name = "com_github_golang_protobuf",
+ # v1.5.3, latest as of 2023-03-27
+ urls = [
+ "https://mirror.bazel.build/github.com/golang/protobuf/archive/refs/tags/v1.5.3.zip",
+ "https://github.com/golang/protobuf/archive/refs/tags/v1.5.3.zip",
+ ],
+ sha256 = "2dced4544ae5372281e20f1e48ca76368355a01b31353724718c4d6e3dcbb430",
+ strip_prefix = "protobuf-1.5.3",
+ patches = [
+ # releaser:patch-cmd gazelle -repo_root . -go_prefix github.com/golang/protobuf -go_naming_convention import_alias -proto disable_global
+ Label("//third_party:com_github_golang_protobuf-gazelle.patch"),
+ ],
+ patch_args = ["-p1"],
+ )
+
+ # Extra protoc plugins and libraries.
+ # Doesn't belong here, but low maintenance.
+ # releaser:upgrade-dep mwitkow go-proto-validators
+ wrapper(
+ http_archive,
+ name = "com_github_mwitkow_go_proto_validators",
+ # v0.3.2, latest as of 2023-03-27
+ urls = [
+ "https://mirror.bazel.build/github.com/mwitkow/go-proto-validators/archive/refs/tags/v0.3.2.zip",
+ "https://github.com/mwitkow/go-proto-validators/archive/refs/tags/v0.3.2.zip",
+ ],
+ sha256 = "d8697f05a2f0eaeb65261b480e1e6035301892d9fc07ed945622f41b12a68142",
+ strip_prefix = "go-proto-validators-0.3.2",
+ # 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-03-27
+ 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
+ # and Google APIs.
+ # Doesn't belong here, but it would be an annoying source of errors if
+ # this weren't generated with -proto disable_global.
+ # releaser:upgrade-dep googleapis go-genproto
+ wrapper(
+ http_archive,
+ name = "org_golang_google_genproto",
+ # main, as of 2023-03-27
+ urls = [
+ "https://mirror.bazel.build/github.com/googleapis/go-genproto/archive/6ac7f18bb9d5eeeb13a9f1ae4f21e4374a1952f8.zip",
+ "https://github.com/googleapis/go-genproto/archive/6ac7f18bb9d5eeeb13a9f1ae4f21e4374a1952f8.zip",
+ ],
+ sha256 = "3470e7a89b24971b20c4bb8900a668df25279e4b741f72bc09418c1f22543215",
+ strip_prefix = "go-genproto-6ac7f18bb9d5eeeb13a9f1ae4f21e4374a1952f8",
+ patches = [
+ # releaser:patch-cmd gazelle -repo_root . -go_prefix google.golang.org/genproto -go_naming_convention import_alias -proto disable_global
+ Label("//third_party:org_golang_google_genproto-gazelle.patch"),
+ ],
+ patch_args = ["-p1"],
+ )
+
+ # go_proto_library targets for gRPC and Google APIs.
+ # TODO(#1986): migrate to com_google_googleapis. This workspace was added
+ # before the real workspace supported Bazel. Gazelle resolves dependencies
+ # here. Gazelle should resolve dependencies to com_google_googleapis
+ # instead, and we should remove this.
+ # releaser:upgrade-dep googleapis googleapis
+ wrapper(
+ http_archive,
+ name = "go_googleapis",
+ # master, as of 2022-12-05
+ urls = [
+ "https://mirror.bazel.build/github.com/googleapis/googleapis/archive/83c3605afb5a39952bf0a0809875d41cf2a558ca.zip",
+ "https://github.com/googleapis/googleapis/archive/83c3605afb5a39952bf0a0809875d41cf2a558ca.zip",
+ ],
+ sha256 = "ba694861340e792fd31cb77274eacaf6e4ca8bda97707898f41d8bebfd8a4984",
+ strip_prefix = "googleapis-83c3605afb5a39952bf0a0809875d41cf2a558ca",
+ patches = [
+ # releaser:patch-cmd find . -name BUILD.bazel -delete
+ Label("//third_party:go_googleapis-deletebuild.patch"),
+ # set gazelle directives; change workspace name
+ Label("//third_party:go_googleapis-directives.patch"),
+ # releaser:patch-cmd gazelle -repo_root .
+ Label("//third_party:go_googleapis-gazelle.patch"),
+ ],
+ patch_args = ["-E", "-p1"],
+ )
+
+ # releaser:upgrade-dep golang mock
+ _maybe(
+ http_archive,
+ name = "com_github_golang_mock",
+ # v1.7.0-rc.1, latest as of 2023-03-27
+ urls = [
+ "https://mirror.bazel.build/github.com/golang/mock/archive/refs/tags/v1.7.0-rc.1.zip",
+ "https://github.com/golang/mock/archive/refs/tags/v1.7.0-rc.1.zip",
+ ],
+ patches = [
+ # releaser:patch-cmd gazelle -repo_root . -go_prefix github.com/golang/mock -go_naming_convention import_alias
+ Label("//third_party:com_github_golang_mock-gazelle.patch"),
+ ],
+ patch_args = ["-p1"],
+ sha256 = "5359c78b0c1649cf7beb3b48ff8b1d1aaf0243b22ea4789aba94805280075d8e",
+ strip_prefix = "mock-1.7.0-rc.1",
+ )
+
+ # This may be overridden by go_register_toolchains, but it's not mandatory
+ # for users to call that function (they may declare their own @go_sdk and
+ # register their own toolchains).
+ wrapper(
+ go_register_nogo,
+ name = "io_bazel_rules_nogo",
+ nogo = DEFAULT_NOGO,
+ )
+
+def _maybe(repo_rule, name, **kwargs):
+ if name not in native.existing_rules():
+ repo_rule(name = name, **kwargs)
+
+def _always(repo_rule, name, **kwargs):
+ repo_rule(name = name, **kwargs)
diff --git a/go/private/rpath.bzl b/go/private/rpath.bzl
new file mode 100644
index 00000000..53435e39
--- /dev/null
+++ b/go/private/rpath.bzl
@@ -0,0 +1,59 @@
+# Copyright 2021 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "@bazel_skylib//lib:paths.bzl",
+ "paths",
+)
+
+def _rpath(go, library, executable = None):
+ """Returns the potential rpaths of a library, possibly relative to another file."""
+ if not executable:
+ return [paths.dirname(library.short_path)]
+
+ origin = go.mode.goos == "darwin" and "@loader_path" or "$ORIGIN"
+
+ # Accomodate for two kinds of executable paths.
+ rpaths = []
+
+ # 1. Where the executable is inside its own .runfiles directory.
+ # This is the case for generated libraries as well as remote builds.
+ # a) go back to the workspace root from the executable file in .runfiles
+ depth = executable.short_path.count("/")
+ back_to_root = paths.join(*([".."] * depth))
+
+ # b) then walk back to the library's short path
+ rpaths.append(paths.join(origin, back_to_root, paths.dirname(library.short_path)))
+
+ # 2. Where the executable is outside the .runfiles directory:
+ # This is the case for local pre-built libraries, as well as local
+ # generated libraries.
+ runfiles_dir = paths.basename(executable.short_path) + ".runfiles"
+ rpaths.append(paths.join(origin, runfiles_dir, go._ctx.workspace_name, paths.dirname(library.short_path)))
+
+ return rpaths
+
+def _flags(go, *args, **kwargs):
+ """Returns the rpath linker flags for a library."""
+ return ["-Wl,-rpath," + p for p in _rpath(go, *args, **kwargs)]
+
+def _install_name(f):
+ """Returns the install name for a dylib on macOS."""
+ return f.short_path
+
+rpath = struct(
+ flags = _flags,
+ install_name = _install_name,
+ rpath = _rpath,
+)
diff --git a/go/private/rules/BUILD.bazel b/go/private/rules/BUILD.bazel
new file mode 100644
index 00000000..50d2c39b
--- /dev/null
+++ b/go/private/rules/BUILD.bazel
@@ -0,0 +1,181 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+load("@bazel_skylib//rules:common_settings.bzl", "string_setting")
+load(
+ ":transition.bzl",
+ "TRANSITIONED_GO_SETTING_KEYS",
+)
+
+exports_files(["library.bzl"])
+
+[
+ string_setting(
+ name = "original_" + setting.split(":")[1],
+ build_setting_default = "",
+ visibility = ["//visibility:private"],
+ )
+ for setting in TRANSITIONED_GO_SETTING_KEYS
+]
+
+filegroup(
+ name = "all_rules",
+ srcs = glob(["**/*.bzl"]),
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+bzl_library(
+ name = "binary",
+ srcs = ["binary.bzl"],
+ visibility = [
+ "//docs:__subpackages__",
+ "//go:__subpackages__",
+ ],
+ deps = [
+ "//go/private:common",
+ "//go/private:context",
+ "//go/private:mode",
+ "//go/private:providers",
+ "//go/private:rpath",
+ "//go/private/rules:transition",
+ ],
+)
+
+bzl_library(
+ name = "cgo",
+ srcs = ["cgo.bzl"],
+ visibility = ["//go:__subpackages__"],
+ deps = [
+ "//go/private:common",
+ "//go/private:mode",
+ ], # keep
+)
+
+bzl_library(
+ name = "info",
+ srcs = ["info.bzl"],
+ visibility = ["//go:__subpackages__"],
+ deps = ["//go/private:context"],
+)
+
+bzl_library(
+ name = "library",
+ srcs = ["library.bzl"],
+ visibility = [
+ "//docs:__subpackages__",
+ "//go:__subpackages__",
+ ],
+ deps = [
+ "//go/private:common",
+ "//go/private:context",
+ "//go/private:providers",
+ ],
+)
+
+bzl_library(
+ name = "nogo",
+ srcs = ["nogo.bzl"],
+ visibility = ["//go:__subpackages__"],
+ deps = [
+ "//go/private:context",
+ "//go/private:providers",
+ "//go/private/rules:transition",
+ ],
+)
+
+bzl_library(
+ name = "sdk",
+ srcs = ["sdk.bzl"],
+ visibility = ["//go:__subpackages__"],
+ deps = ["//go/private:providers"],
+)
+
+bzl_library(
+ name = "source",
+ srcs = ["source.bzl"],
+ visibility = [
+ "//docs:__subpackages__",
+ "//go:__subpackages__",
+ ],
+ deps = [
+ "//go/private:context",
+ "//go/private:providers",
+ ],
+)
+
+bzl_library(
+ name = "stdlib",
+ srcs = ["stdlib.bzl"],
+ visibility = ["//go:__subpackages__"],
+ deps = [
+ "//go/private:context",
+ "//go/private:providers",
+ ],
+)
+
+bzl_library(
+ name = "test",
+ srcs = ["test.bzl"],
+ visibility = [
+ "//docs:__subpackages__",
+ "//go:__subpackages__",
+ ],
+ deps = [
+ "//go/private:common",
+ "//go/private:context",
+ "//go/private:mode",
+ "//go/private:providers",
+ "//go/private/rules:binary",
+ "//go/private/rules:transition",
+ "@bazel_skylib//lib:structs",
+ ],
+)
+
+bzl_library(
+ name = "transition",
+ srcs = ["transition.bzl"],
+ visibility = [
+ "//go:__subpackages__",
+ "//proto:__pkg__",
+ ],
+ deps = [
+ "//go/private:mode",
+ "//go/private:platforms",
+ "//go/private:providers",
+ ],
+)
+
+bzl_library(
+ name = "cross",
+ srcs = ["cross.bzl"],
+ visibility = [
+ "//docs:__subpackages__",
+ "//go:__subpackages__",
+ ],
+ deps = [
+ "//go/private:providers",
+ "//go/private/rules:transition",
+ ],
+)
+
+bzl_library(
+ name = "wrappers",
+ srcs = ["wrappers.bzl"],
+ visibility = [
+ "//extras:__pkg__",
+ "//go:__subpackages__",
+ ],
+ deps = [
+ "//go/private/rules:binary",
+ "//go/private/rules:cgo",
+ "//go/private/rules:cross",
+ "//go/private/rules:library",
+ "//go/private/rules:test",
+ "//go/private/rules:transition",
+ ],
+)
diff --git a/go/private/rules/binary.bzl b/go/private/rules/binary.bzl
new file mode 100644
index 00000000..51530b04
--- /dev/null
+++ b/go/private/rules/binary.bzl
@@ -0,0 +1,498 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:context.bzl",
+ "go_context",
+)
+load(
+ "//go/private:common.bzl",
+ "asm_exts",
+ "cgo_exts",
+ "go_exts",
+)
+load(
+ "//go/private:go_toolchain.bzl",
+ "GO_TOOLCHAIN",
+)
+load(
+ "//go/private:providers.bzl",
+ "GoLibrary",
+ "GoSDK",
+)
+load(
+ "//go/private/rules:transition.bzl",
+ "go_transition",
+)
+load(
+ "//go/private:mode.bzl",
+ "LINKMODES_EXECUTABLE",
+ "LINKMODE_C_ARCHIVE",
+ "LINKMODE_C_SHARED",
+ "LINKMODE_NORMAL",
+ "LINKMODE_PLUGIN",
+ "LINKMODE_SHARED",
+)
+
+_EMPTY_DEPSET = depset([])
+
+def _include_path(hdr):
+ if not hdr.root.path:
+ fail("Expected hdr to be a generated file, got source file: " + hdr.path)
+
+ root_relative_path = hdr.path[len(hdr.root.path + "/"):]
+ if not root_relative_path.startswith("external/"):
+ return hdr.root.path
+
+ # All headers should be includeable via a path relative to their repository
+ # root, regardless of whether the repository is external or not. If it is,
+ # we thus need to append "external/<external repo name>" to the path.
+ return "/".join([hdr.root.path] + root_relative_path.split("/")[0:2])
+
+def new_cc_import(
+ go,
+ hdrs = _EMPTY_DEPSET,
+ defines = _EMPTY_DEPSET,
+ local_defines = _EMPTY_DEPSET,
+ dynamic_library = None,
+ static_library = None,
+ alwayslink = False,
+ linkopts = []):
+ return CcInfo(
+ compilation_context = cc_common.create_compilation_context(
+ defines = defines,
+ local_defines = local_defines,
+ headers = hdrs,
+ includes = depset([_include_path(hdr) for hdr in hdrs.to_list()]),
+ ),
+ linking_context = cc_common.create_linking_context(
+ linker_inputs = depset([
+ cc_common.create_linker_input(
+ owner = go.label,
+ libraries = depset([
+ cc_common.create_library_to_link(
+ actions = go.actions,
+ cc_toolchain = go.cgo_tools.cc_toolchain,
+ feature_configuration = go.cgo_tools.feature_configuration,
+ dynamic_library = dynamic_library,
+ static_library = static_library,
+ alwayslink = alwayslink,
+ ),
+ ]),
+ user_link_flags = depset(linkopts),
+ ),
+ ]),
+ ),
+ )
+
+def _go_binary_impl(ctx):
+ """go_binary_impl emits actions for compiling and linking a go executable."""
+ go = go_context(ctx)
+
+ is_main = go.mode.link not in (LINKMODE_SHARED, LINKMODE_PLUGIN)
+ library = go.new_library(go, importable = False, is_main = is_main)
+ source = go.library_to_source(go, ctx.attr, library, ctx.coverage_instrumented())
+ name = ctx.attr.basename
+ if not name:
+ name = ctx.label.name
+ executable = None
+ if ctx.attr.out:
+ # Use declare_file instead of attr.output(). When users set output files
+ # directly, Bazel warns them not to use the same name as the rule, which is
+ # the common case with go_binary.
+ executable = ctx.actions.declare_file(ctx.attr.out)
+ archive, executable, runfiles = go.binary(
+ go,
+ name = name,
+ source = source,
+ gc_linkopts = gc_linkopts(ctx),
+ version_file = ctx.version_file,
+ info_file = ctx.info_file,
+ executable = executable,
+ )
+
+ providers = [
+ library,
+ source,
+ archive,
+ OutputGroupInfo(
+ cgo_exports = archive.cgo_exports,
+ compilation_outputs = [archive.data.file],
+ ),
+ ]
+
+ if go.mode.link in LINKMODES_EXECUTABLE:
+ env = {}
+ for k, v in ctx.attr.env.items():
+ env[k] = ctx.expand_location(v, ctx.attr.data)
+ providers.append(RunEnvironmentInfo(environment = env))
+
+ # The executable is automatically added to the runfiles.
+ providers.append(DefaultInfo(
+ files = depset([executable]),
+ runfiles = runfiles,
+ executable = executable,
+ ))
+ else:
+ # Workaround for https://github.com/bazelbuild/bazel/issues/15043
+ # As of Bazel 5.1.1, native rules do not pick up the "files" of a data
+ # dependency's DefaultInfo, only the "data_runfiles". Since transitive
+ # non-data dependents should not pick up the executable as a runfile
+ # implicitly, the deprecated "default_runfiles" and "data_runfiles"
+ # constructor parameters have to be used.
+ providers.append(DefaultInfo(
+ files = depset([executable]),
+ default_runfiles = runfiles,
+ data_runfiles = runfiles.merge(ctx.runfiles([executable])),
+ ))
+
+ # If the binary's linkmode is c-archive or c-shared, expose CcInfo
+ if go.cgo_tools and go.mode.link in (LINKMODE_C_ARCHIVE, LINKMODE_C_SHARED):
+ cc_import_kwargs = {
+ "linkopts": {
+ "darwin": [],
+ "ios": [],
+ "windows": ["-mthreads"],
+ }.get(go.mode.goos, ["-pthread"]),
+ }
+ cgo_exports = archive.cgo_exports.to_list()
+ if cgo_exports:
+ header = ctx.actions.declare_file("{}.h".format(name))
+ ctx.actions.symlink(
+ output = header,
+ target_file = cgo_exports[0],
+ )
+ cc_import_kwargs["hdrs"] = depset([header])
+ if go.mode.link == LINKMODE_C_SHARED:
+ cc_import_kwargs["dynamic_library"] = executable
+ elif go.mode.link == LINKMODE_C_ARCHIVE:
+ cc_import_kwargs["static_library"] = executable
+ cc_import_kwargs["alwayslink"] = True
+ ccinfo = new_cc_import(go, **cc_import_kwargs)
+ ccinfo = cc_common.merge_cc_infos(
+ cc_infos = [ccinfo, source.cc_info],
+ )
+ providers.append(ccinfo)
+
+ return providers
+
+_go_binary_kwargs = {
+ "implementation": _go_binary_impl,
+ "attrs": {
+ "srcs": attr.label_list(
+ allow_files = go_exts + asm_exts + cgo_exts,
+ doc = """The list of Go source files that are compiled to create the package.
+ Only `.go` and `.s` files are permitted, unless the `cgo`
+ attribute is set, in which case,
+ `.c .cc .cpp .cxx .h .hh .hpp .hxx .inc .m .mm`
+ files are also permitted. Files may be filtered at build time
+ using Go [build constraints].
+ """,
+ ),
+ "data": attr.label_list(
+ allow_files = True,
+ doc = """List of files needed by this rule at run-time. This may include data files
+ needed or other programs that may be executed. The [bazel] package may be
+ used to locate run files; they may appear in different places depending on the
+ operating system and environment. See [data dependencies] for more
+ information on data files.
+ """,
+ ),
+ "deps": attr.label_list(
+ providers = [GoLibrary],
+ doc = """List of Go libraries this package imports directly.
+ These may be `go_library` rules or compatible rules with the [GoLibrary] provider.
+ """,
+ cfg = go_transition,
+ ),
+ "embed": attr.label_list(
+ providers = [GoLibrary],
+ doc = """List of Go libraries whose sources should be compiled together with this
+ binary's sources. Labels listed here must name `go_library`,
+ `go_proto_library`, or other compatible targets with the [GoLibrary] and
+ [GoSource] providers. Embedded libraries must all have the same `importpath`,
+ which must match the `importpath` for this `go_binary` if one is
+ specified. At most one embedded library may have `cgo = True`, and the
+ embedding binary may not also have `cgo = True`. See [Embedding] for
+ more information.
+ """,
+ cfg = go_transition,
+ ),
+ "embedsrcs": attr.label_list(
+ allow_files = True,
+ doc = """The list of files that may be embedded into the compiled package using
+ `//go:embed` directives. All files must be in the same logical directory
+ or a subdirectory as source files. All source files containing `//go:embed`
+ directives must be in the same logical directory. It's okay to mix static and
+ generated source files and static and generated embeddable files.
+ """,
+ ),
+ "env": attr.string_dict(
+ doc = """Environment variables to set when the binary is executed with bazel run.
+ The values (but not keys) are subject to
+ [location expansion](https://docs.bazel.build/versions/main/skylark/macros.html) but not full
+ [make variable expansion](https://docs.bazel.build/versions/main/be/make-variables.html).
+ """,
+ ),
+ "importpath": attr.string(
+ doc = """The import path of this binary. Binaries can't actually be imported, but this
+ may be used by [go_path] and other tools to report the location of source
+ files. This may be inferred from embedded libraries.
+ """,
+ ),
+ "gc_goopts": attr.string_list(
+ doc = """List of flags to add to the Go compilation command when using the gc compiler.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization].
+ """,
+ ),
+ "gc_linkopts": attr.string_list(
+ doc = """List of flags to add to the Go link command when using the gc compiler.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization].
+ """,
+ ),
+ "x_defs": attr.string_dict(
+ doc = """Map of defines to add to the go link command.
+ See [Defines and stamping] for examples of how to use these.
+ """,
+ ),
+ "basename": attr.string(
+ doc = """The basename of this binary. The binary
+ basename may also be platform-dependent: on Windows, we add an .exe extension.
+ """,
+ ),
+ "out": attr.string(
+ doc = """Sets the output filename for the generated executable. When set, `go_binary`
+ will write this file without mode-specific directory prefixes, without
+ linkmode-specific prefixes like "lib", and without platform-specific suffixes
+ like ".exe". Note that without a mode-specific directory prefix, the
+ output file (but not its dependencies) will be invalidated in Bazel's cache
+ when changing configurations.
+ """,
+ ),
+ "cgo": attr.bool(
+ doc = """If `True`, the package may contain [cgo] code, and `srcs` may contain
+ C, C++, Objective-C, and Objective-C++ files and non-Go assembly files.
+ When cgo is enabled, these files will be compiled with the C/C++ toolchain
+ and included in the package. Note that this attribute does not force cgo
+ to be enabled. Cgo is enabled for non-cross-compiling builds when a C/C++
+ toolchain is configured.
+ """,
+ ),
+ "cdeps": attr.label_list(
+ doc = """The list of other libraries that the c code depends on.
+ This can be anything that would be allowed in [cc_library deps]
+ Only valid if `cgo` = `True`.
+ """,
+ ),
+ "cppopts": attr.string_list(
+ doc = """List of flags to add to the C/C++ preprocessor command.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization].
+ Only valid if `cgo` = `True`.
+ """,
+ ),
+ "copts": attr.string_list(
+ doc = """List of flags to add to the C compilation command.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization].
+ Only valid if `cgo` = `True`.
+ """,
+ ),
+ "cxxopts": attr.string_list(
+ doc = """List of flags to add to the C++ compilation command.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization].
+ Only valid if `cgo` = `True`.
+ """,
+ ),
+ "clinkopts": attr.string_list(
+ doc = """List of flags to add to the C link command.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization].
+ Only valid if `cgo` = `True`.
+ """,
+ ),
+ "pure": attr.string(
+ default = "auto",
+ doc = """Controls whether cgo source code and dependencies are compiled and linked,
+ similar to setting `CGO_ENABLED`. May be one of `on`, `off`,
+ or `auto`. If `auto`, pure mode is enabled when no C/C++
+ toolchain is configured or when cross-compiling. It's usually better to
+ control this on the command line with
+ `--@io_bazel_rules_go//go/config:pure`. See [mode attributes], specifically
+ [pure].
+ """,
+ ),
+ "static": attr.string(
+ default = "auto",
+ doc = """Controls whether a binary is statically linked. May be one of `on`,
+ `off`, or `auto`. Not available on all platforms or in all
+ modes. It's usually better to control this on the command line with
+ `--@io_bazel_rules_go//go/config:static`. See [mode attributes],
+ specifically [static].
+ """,
+ ),
+ "race": attr.string(
+ default = "auto",
+ doc = """Controls whether code is instrumented for race detection. May be one of
+ `on`, `off`, or `auto`. Not available when cgo is
+ disabled. In most cases, it's better to control this on the command line with
+ `--@io_bazel_rules_go//go/config:race`. See [mode attributes], specifically
+ [race].
+ """,
+ ),
+ "msan": attr.string(
+ default = "auto",
+ doc = """Controls whether code is instrumented for memory sanitization. May be one of
+ `on`, `off`, or `auto`. Not available when cgo is
+ disabled. In most cases, it's better to control this on the command line with
+ `--@io_bazel_rules_go//go/config:msan`. See [mode attributes], specifically
+ [msan].
+ """,
+ ),
+ "gotags": attr.string_list(
+ doc = """Enables a list of build tags when evaluating [build constraints]. Useful for
+ conditional compilation.
+ """,
+ ),
+ "goos": attr.string(
+ default = "auto",
+ doc = """Forces a binary to be cross-compiled for a specific operating system. It's
+ usually better to control this on the command line with `--platforms`.
+
+ This disables cgo by default, since a cross-compiling C/C++ toolchain is
+ rarely available. To force cgo, set `pure` = `off`.
+
+ See [Cross compilation] for more information.
+ """,
+ ),
+ "goarch": attr.string(
+ default = "auto",
+ doc = """Forces a binary to be cross-compiled for a specific architecture. It's usually
+ better to control this on the command line with `--platforms`.
+
+ This disables cgo by default, since a cross-compiling C/C++ toolchain is
+ rarely available. To force cgo, set `pure` = `off`.
+
+ See [Cross compilation] for more information.
+ """,
+ ),
+ "linkmode": attr.string(
+ default = LINKMODE_NORMAL,
+ doc = """Determines how the binary should be built and linked. This accepts some of
+ the same values as `go build -buildmode` and works the same way.
+ <br><br>
+ <ul>
+ <li>`normal`: Builds a normal executable with position-dependent code.</li>
+ <li>`pie`: Builds a position-independent executable.</li>
+ <li>`plugin`: Builds a shared library that can be loaded as a Go plugin. Only supported on platforms that support plugins.</li>
+ <li>`c-shared`: Builds a shared library that can be linked into a C program.</li>
+ <li>`c-archive`: Builds an archive that can be linked into a C program.</li>
+ </ul>
+ """,
+ ),
+ "_go_context_data": attr.label(default = "//:go_context_data", cfg = go_transition),
+ "_allowlist_function_transition": attr.label(
+ default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
+ ),
+ },
+ "toolchains": [GO_TOOLCHAIN],
+ "doc": """This builds an executable from a set of source files,
+ which must all be in the `main` package. You can run the binary with
+ `bazel run`, or you can build it with `bazel build` and run it directly.<br><br>
+ ***Note:*** `name` should be the same as the desired name of the generated binary.<br><br>
+ **Providers:**
+ <ul>
+ <li>[GoLibrary]</li>
+ <li>[GoSource]</li>
+ <li>[GoArchive]</li>
+ </ul>
+ """,
+}
+
+go_binary = rule(executable = True, **_go_binary_kwargs)
+go_non_executable_binary = rule(executable = False, **_go_binary_kwargs)
+
+def _go_tool_binary_impl(ctx):
+ sdk = ctx.attr.sdk[GoSDK]
+ name = ctx.label.name
+ if sdk.goos == "windows":
+ name += ".exe"
+
+ out = ctx.actions.declare_file(name)
+ if sdk.goos == "windows":
+ gopath = ctx.actions.declare_directory("gopath")
+ gocache = ctx.actions.declare_directory("gocache")
+ cmd = "@echo off\nset GOMAXPROCS=1\nset GOCACHE=%cd%\\{gocache}\nset GOPATH=%cd%\\{gopath}\n{go} build -o {out} -trimpath {srcs}".format(
+ gopath = gopath.path,
+ gocache = gocache.path,
+ go = sdk.go.path.replace("/", "\\"),
+ out = out.path,
+ srcs = " ".join([f.path for f in ctx.files.srcs]),
+ )
+ bat = ctx.actions.declare_file(name + ".bat")
+ ctx.actions.write(
+ output = bat,
+ content = cmd,
+ )
+ ctx.actions.run(
+ executable = bat,
+ inputs = sdk.headers + sdk.tools + sdk.srcs + ctx.files.srcs + [sdk.go],
+ outputs = [out, gopath, gocache],
+ mnemonic = "GoToolchainBinaryBuild",
+ )
+ else:
+ # Note: GOPATH is needed for Go 1.16.
+ cmd = "GOMAXPROCS=1 GOCACHE=$(mktemp -d) GOPATH=$(mktemp -d) {go} build -o {out} -trimpath {srcs}".format(
+ go = sdk.go.path,
+ out = out.path,
+ srcs = " ".join([f.path for f in ctx.files.srcs]),
+ )
+ ctx.actions.run_shell(
+ command = cmd,
+ inputs = sdk.headers + sdk.tools + sdk.srcs + sdk.libs + ctx.files.srcs + [sdk.go],
+ outputs = [out],
+ mnemonic = "GoToolchainBinaryBuild",
+ )
+
+ return [DefaultInfo(
+ files = depset([out]),
+ executable = out,
+ )]
+
+go_tool_binary = rule(
+ implementation = _go_tool_binary_impl,
+ attrs = {
+ "srcs": attr.label_list(
+ allow_files = True,
+ doc = "Source files for the binary. Must be in 'package main'.",
+ ),
+ "sdk": attr.label(
+ mandatory = True,
+ providers = [GoSDK],
+ doc = "The SDK containing tools and libraries to build this binary",
+ ),
+ },
+ executable = True,
+ doc = """Used instead of go_binary for executables used in the toolchain.
+
+go_tool_binary depends on tools and libraries that are part of the Go SDK.
+It does not depend on other toolchains. It can only compile binaries that
+just have a main package and only depend on the standard library and don't
+require build constraints.
+""",
+)
+
+def gc_linkopts(ctx):
+ gc_linkopts = [
+ ctx.expand_make_variables("gc_linkopts", f, {})
+ for f in ctx.attr.gc_linkopts
+ ]
+ return gc_linkopts
diff --git a/go/private/rules/cgo.bzl b/go/private/rules/cgo.bzl
new file mode 100644
index 00000000..b8fc93a6
--- /dev/null
+++ b/go/private/rules/cgo.bzl
@@ -0,0 +1,208 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:common.bzl",
+ "get_versioned_shared_lib_extension",
+ "has_simple_shared_lib_extension",
+ "hdr_exts",
+)
+load(
+ "//go/private:mode.bzl",
+ "LINKMODE_NORMAL",
+ "extldflags_from_cc_toolchain",
+)
+
+def cgo_configure(go, srcs, cdeps, cppopts, copts, cxxopts, clinkopts):
+ """cgo_configure returns the inputs and compile / link options
+ that are required to build a cgo archive.
+
+ Args:
+ go: a GoContext.
+ srcs: list of source files being compiled. Include options are added
+ for the headers.
+ cdeps: list of Targets for C++ dependencies. Include and link options
+ may be added.
+ cppopts: list of C preprocessor options for the library.
+ copts: list of C compiler options for the library.
+ cxxopts: list of C++ compiler options for the library.
+ clinkopts: list of linker options for the library.
+
+ Returns: a struct containing:
+ inputs: depset of files that must be available for the build.
+ deps: depset of files for dynamic libraries.
+ runfiles: runfiles object for the C/C++ dependencies.
+ cppopts: complete list of preprocessor options
+ copts: complete list of C compiler options.
+ cxxopts: complete list of C++ compiler options.
+ objcopts: complete list of Objective-C compiler options.
+ objcxxopts: complete list of Objective-C++ compiler options.
+ clinkopts: complete list of linker options.
+ """
+ if not go.cgo_tools:
+ fail("Go toolchain does not support cgo")
+
+ cppopts = list(cppopts)
+ copts = go.cgo_tools.c_compile_options + copts
+ cxxopts = go.cgo_tools.cxx_compile_options + cxxopts
+ objcopts = go.cgo_tools.objc_compile_options + copts
+ objcxxopts = go.cgo_tools.objcxx_compile_options + cxxopts
+ clinkopts = extldflags_from_cc_toolchain(go) + clinkopts
+
+ # NOTE(#2545): avoid unnecessary dynamic link
+ if "-static-libstdc++" in clinkopts:
+ clinkopts = [
+ option
+ for option in clinkopts
+ if option not in ("-lstdc++", "-lc++")
+ ]
+
+ if go.mode != LINKMODE_NORMAL:
+ for opt_list in (copts, cxxopts, objcopts, objcxxopts):
+ if "-fPIC" not in opt_list:
+ opt_list.append("-fPIC")
+
+ seen_includes = {}
+ seen_quote_includes = {}
+ seen_system_includes = {}
+ have_hdrs = any([f.basename.endswith(ext) for f in srcs for ext in hdr_exts])
+ if have_hdrs:
+ # Add include paths for all sources so we can use include paths relative
+ # to any source file or any header file. The go command requires all
+ # sources to be in the same directory, but that's not necessarily the
+ # case here.
+ #
+ # Use -I so either <> or "" includes may be used (same as go command).
+ for f in srcs:
+ _include_unique(cppopts, "-I", f.dirname, seen_includes)
+
+ inputs_direct = []
+ inputs_transitive = []
+ deps_direct = []
+ lib_opts = []
+ runfiles = go._ctx.runfiles(collect_data = True)
+
+ # Always include the sandbox as part of the build. Bazel does this, but it
+ # doesn't appear in the CompilationContext.
+ _include_unique(cppopts, "-iquote", ".", seen_quote_includes)
+ for d in cdeps:
+ runfiles = runfiles.merge(d.data_runfiles)
+ if CcInfo in d:
+ cc_transitive_headers = d[CcInfo].compilation_context.headers
+ inputs_transitive.append(cc_transitive_headers)
+ cc_libs, cc_link_flags = _cc_libs_and_flags(d)
+ inputs_direct.extend(cc_libs)
+ deps_direct.extend(cc_libs)
+ cc_defines = d[CcInfo].compilation_context.defines.to_list()
+ cppopts.extend(["-D" + define for define in cc_defines])
+ cc_includes = d[CcInfo].compilation_context.includes.to_list()
+ for inc in cc_includes:
+ _include_unique(cppopts, "-I", inc, seen_includes)
+ cc_quote_includes = d[CcInfo].compilation_context.quote_includes.to_list()
+ for inc in cc_quote_includes:
+ _include_unique(cppopts, "-iquote", inc, seen_quote_includes)
+ cc_system_includes = d[CcInfo].compilation_context.system_includes.to_list()
+ for inc in cc_system_includes:
+ _include_unique(cppopts, "-isystem", inc, seen_system_includes)
+ for lib in cc_libs:
+ # If both static and dynamic variants are available, Bazel will only give
+ # us the static variant. We'll get one file for each transitive dependency,
+ # so the same file may appear more than once.
+ if lib.basename.startswith("lib"):
+ if has_simple_shared_lib_extension(lib.basename):
+ # If the loader would be able to find the library using rpaths,
+ # use -L and -l instead of hard coding the path to the library in
+ # the binary. This gives users more flexibility. The linker will add
+ # rpaths later. We can't add them here because they are relative to
+ # the binary location, and we don't know where that is.
+ libname = lib.basename[len("lib"):lib.basename.rindex(".")]
+ clinkopts.extend(["-L", lib.dirname, "-l", libname])
+ inputs_direct.append(lib)
+ continue
+ extension = get_versioned_shared_lib_extension(lib.basename)
+ if extension.startswith("so"):
+ # With a versioned .so file, we must use the full filename,
+ # otherwise the library will not be found by the linker.
+ libname = ":%s" % lib.basename
+ clinkopts.extend(["-L", lib.dirname, "-l", libname])
+ inputs_direct.append(lib)
+ continue
+ elif extension.startswith("dylib"):
+ # A standard versioned dylib is named as libMagick.2.dylib, which is
+ # treated as a simple shared library. Non-standard versioned dylibs such as
+ # libclntsh.dylib.12.1, users have to create a unversioned symbolic link,
+ # so it can be treated as a simple shared library too.
+ continue
+ lib_opts.append(lib.path)
+ clinkopts.extend(cc_link_flags)
+
+ elif hasattr(d, "objc"):
+ cppopts.extend(["-D" + define for define in d.objc.define.to_list()])
+ for inc in d.objc.include.to_list():
+ _include_unique(cppopts, "-I", inc, seen_includes)
+ for inc in d.objc.iquote.to_list():
+ _include_unique(cppopts, "-iquote", inc, seen_quote_includes)
+ for inc in d.objc.include_system.to_list():
+ _include_unique(cppopts, "-isystem", inc, seen_system_includes)
+
+ # TODO(jayconrod): do we need to link against dynamic libraries or
+ # frameworks? We link against *_fully_linked.a, so maybe not?
+
+ else:
+ fail("unknown library has neither cc nor objc providers: %s" % d.label)
+
+ inputs = depset(direct = inputs_direct, transitive = inputs_transitive)
+ deps = depset(direct = deps_direct)
+
+ # HACK: some C/C++ toolchains will ignore libraries (including dynamic libs
+ # specified with -l flags) unless they appear after .o or .a files with
+ # undefined symbols they provide. Put all the .a files from cdeps first,
+ # so that we actually link with -lstdc++ and others.
+ clinkopts = lib_opts + clinkopts
+
+ return struct(
+ inputs = inputs,
+ deps = deps,
+ runfiles = runfiles,
+ cppopts = cppopts,
+ copts = copts,
+ cxxopts = cxxopts,
+ objcopts = objcopts,
+ objcxxopts = objcxxopts,
+ clinkopts = clinkopts,
+ )
+
+def _cc_libs_and_flags(target):
+ # Copied from get_libs_for_static_executable in migration instructions
+ # from bazelbuild/bazel#7036.
+ libs = []
+ flags = []
+ for li in target[CcInfo].linking_context.linker_inputs.to_list():
+ flags.extend(li.user_link_flags)
+ for library_to_link in li.libraries:
+ if library_to_link.static_library != None:
+ libs.append(library_to_link.static_library)
+ elif library_to_link.pic_static_library != None:
+ libs.append(library_to_link.pic_static_library)
+ elif library_to_link.interface_library != None:
+ libs.append(library_to_link.interface_library)
+ elif library_to_link.dynamic_library != None:
+ libs.append(library_to_link.dynamic_library)
+ return libs, flags
+
+def _include_unique(opts, flag, include, seen):
+ if include in seen:
+ return
+ seen[include] = True
+ opts.extend([flag, include])
diff --git a/go/private/rules/cross.bzl b/go/private/rules/cross.bzl
new file mode 100644
index 00000000..961e3651
--- /dev/null
+++ b/go/private/rules/cross.bzl
@@ -0,0 +1,141 @@
+# Copyright 2022 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private/rules:transition.bzl",
+ "go_cross_transition",
+)
+load(
+ "//go/private:providers.bzl",
+ "GoArchive",
+ "GoLibrary",
+ "GoSource",
+)
+
+def _is_windows(ctx):
+ return ctx.configuration.host_path_separator == ";"
+
+WINDOWS_ERR_SCRIPT = """
+@echo off
+>&2 echo {}
+exit /b 1
+"""
+UNIX_ERR_SCRIPT = """
+>&2 echo '{}'
+exit 1
+"""
+
+def _error_script(ctx):
+ errmsg = 'cannot run go_cross target "{}": underlying target "{}" is not executable'.format(
+ ctx.attr.name,
+ ctx.attr.target.label,
+ )
+ if _is_windows(ctx):
+ error_script = ctx.actions.declare_file("fake_executable_for_bazel_run.bat")
+ ctx.actions.write(error_script, WINDOWS_ERR_SCRIPT.format(errmsg), is_executable = True)
+ return error_script
+
+ error_script = ctx.actions.declare_file("fake_executable_for_bazel_run")
+ ctx.actions.write(error_script, UNIX_ERR_SCRIPT.format(errmsg), is_executable = True)
+ return error_script
+
+def _go_cross_impl(ctx):
+ old_default_info = ctx.attr.target[DefaultInfo]
+ old_executable = old_default_info.files_to_run.executable
+
+ new_default_info = None
+ if old_executable:
+ # Bazel requires executable rules to created the executable themselves,
+ # so we create a symlink in this rule so that it appears this rule created its executable.
+ new_executable = ctx.actions.declare_file(ctx.attr.name)
+ ctx.actions.symlink(output = new_executable, target_file = old_executable)
+ new_default_info = DefaultInfo(
+ files = depset([new_executable]),
+ runfiles = old_default_info.default_runfiles,
+ executable = new_executable,
+ )
+ else:
+ # There's no way to determine if the underlying `go_binary` target is executable at loading time
+ # so we must set the `go_cross` rule to be always executable. If the `go_binary` target is not
+ # executable, we set the `go_cross` executable to a simple script that prints an error message
+ # when executed. This way users can still run a `go_cross` target using `bazel run` as long as
+ # the underlying `go_binary` target is executable.
+ error_script = _error_script(ctx)
+
+ # See the implementation of `go_binary` for an explanation of the need for default vs data runfiles here.
+ new_default_info = DefaultInfo(
+ files = depset([error_script] + old_default_info.files.to_list()),
+ default_runfiles = old_default_info.default_runfiles,
+ data_runfiles = old_default_info.data_runfiles.merge(ctx.runfiles([error_script])),
+ executable = error_script,
+ )
+
+ providers = [
+ ctx.attr.target[provider]
+ for provider in [
+ GoLibrary,
+ GoSource,
+ GoArchive,
+ OutputGroupInfo,
+ CcInfo,
+ ]
+ if provider in ctx.attr.target
+ ]
+ return [new_default_info] + providers
+
+_go_cross_kwargs = {
+ "implementation": _go_cross_impl,
+ "attrs": {
+ "target": attr.label(
+ doc = """Go binary target to transition to the given platform and/or sdk_version.
+ """,
+ providers = [GoLibrary, GoSource, GoArchive],
+ mandatory = True,
+ ),
+ "platform": attr.label(
+ doc = """The platform to cross compile the `target` for.
+ If unspecified, the `target` will be compiled with the
+ same platform as it would've with the original `go_binary` rule.
+ """,
+ ),
+ "sdk_version": attr.string(
+ doc = """The golang SDK version to use for compiling the `target`.
+ Supports specifying major, minor, and/or patch versions, eg. `"1"`,
+ `"1.17"`, or `"1.17.1"`. The first Go SDK provider installed in the
+ repo's workspace (via `go_download_sdk`, `go_wrap_sdk`, etc) that
+ matches the specified version will be used for compiling the given
+ `target`. If unspecified, the `target` will be compiled with the same
+ SDK as it would've with the original `go_binary` rule.
+ Transitions `target` by changing the `--@io_bazel_rules_go//go/toolchain:sdk_version`
+ build flag to the value provided for `sdk_version` here.
+ """,
+ ),
+ "_allowlist_function_transition": attr.label(
+ default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
+ ),
+ },
+ "cfg": go_cross_transition,
+ "doc": """This wraps an executable built by `go_binary` to cross compile it
+ for a different platform, and/or compile it using a different version
+ of the golang SDK.<br><br>
+ **Providers:**
+ <ul>
+ <li>[GoLibrary]</li>
+ <li>[GoSource]</li>
+ <li>[GoArchive]</li>
+ </ul>
+ """,
+}
+
+go_cross_binary = rule(executable = True, **_go_cross_kwargs)
diff --git a/go/private/rules/go_bin_for_host.bzl b/go/private/rules/go_bin_for_host.bzl
new file mode 100644
index 00000000..3f2dca99
--- /dev/null
+++ b/go/private/rules/go_bin_for_host.bzl
@@ -0,0 +1,48 @@
+# Copyright 2023 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("@local_config_platform//:constraints.bzl", "HOST_CONSTRAINTS")
+load("//go/private:go_toolchain.bzl", "GO_TOOLCHAIN")
+
+def _ensure_target_cfg(ctx):
+ # A target is assumed to be built in the target configuration if it is neither in the exec nor
+ # the host configuration (the latter has been removed in Bazel 6). Since there is no API for
+ # this, use the output directory to determine the configuration, which is a common pattern.
+ if "-exec-" in ctx.bin_dir.path or "/host/" in ctx.bin_dir.path:
+ fail("//go is only meant to be used with 'bazel run', not as a tool. " +
+ "If you need to use it as a tool (e.g. in a genrule), please " +
+ "open an issue at " +
+ "https://github.com/bazelbuild/rules_go/issues/new explaining " +
+ "your use case.")
+
+def _go_bin_for_host_impl(ctx):
+ """Exposes the go binary of the current Go toolchain for the host."""
+ _ensure_target_cfg(ctx)
+
+ sdk = ctx.toolchains[GO_TOOLCHAIN].sdk
+ sdk_files = ctx.runfiles([sdk.go] + sdk.headers + sdk.libs + sdk.srcs + sdk.tools)
+
+ return [
+ DefaultInfo(
+ files = depset([sdk.go]),
+ runfiles = sdk_files,
+ ),
+ ]
+
+go_bin_for_host = rule(
+ implementation = _go_bin_for_host_impl,
+ toolchains = [GO_TOOLCHAIN],
+ # Resolve a toolchain that runs on the host platform.
+ exec_compatible_with = HOST_CONSTRAINTS,
+)
diff --git a/go/private/rules/info.bzl b/go/private/rules/info.bzl
new file mode 100644
index 00000000..28cd1ba0
--- /dev/null
+++ b/go/private/rules/info.bzl
@@ -0,0 +1,60 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:context.bzl",
+ "go_context",
+)
+load(
+ "//go/private:go_toolchain.bzl",
+ "GO_TOOLCHAIN",
+)
+
+def _go_info_impl(ctx):
+ go = go_context(ctx)
+ report = go.declare_file(go, ext = ".txt")
+ args = go.builder_args(go)
+ args.add("-out", report)
+ go.actions.run(
+ inputs = go.sdk_files,
+ outputs = [report],
+ mnemonic = "GoInfo",
+ executable = ctx.executable._go_info,
+ arguments = [args],
+ )
+ return [DefaultInfo(
+ files = depset([report]),
+ runfiles = ctx.runfiles([report]),
+ )]
+
+_go_info = rule(
+ implementation = _go_info_impl,
+ attrs = {
+ "_go_info": attr.label(
+ executable = True,
+ cfg = "exec",
+ default = "//go/tools/builders:info",
+ ),
+ "_go_context_data": attr.label(
+ default = "//:go_context_data",
+ ),
+ },
+ toolchains = [GO_TOOLCHAIN],
+)
+
+def go_info():
+ _go_info(
+ name = "go_info",
+ visibility = ["//visibility:public"],
+ )
diff --git a/go/private/rules/library.bzl b/go/private/rules/library.bzl
new file mode 100644
index 00000000..6f96c084
--- /dev/null
+++ b/go/private/rules/library.bzl
@@ -0,0 +1,226 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:common.bzl",
+ "asm_exts",
+ "cgo_exts",
+ "go_exts",
+)
+load(
+ "//go/private:context.bzl",
+ "go_context",
+)
+load(
+ "//go/private:go_toolchain.bzl",
+ "GO_TOOLCHAIN",
+)
+load(
+ "//go/private:providers.bzl",
+ "GoLibrary",
+ "INFERRED_PATH",
+)
+load(
+ "//go/private/rules:transition.bzl",
+ "non_go_transition",
+)
+
+def _go_library_impl(ctx):
+ """Implements the go_library() rule."""
+ go = go_context(ctx)
+ if go.pathtype == INFERRED_PATH:
+ fail("importpath must be specified in this library or one of its embedded libraries")
+ library = go.new_library(go)
+ source = go.library_to_source(go, ctx.attr, library, ctx.coverage_instrumented())
+ archive = go.archive(go, source)
+
+ return [
+ library,
+ source,
+ archive,
+ DefaultInfo(
+ files = depset([archive.data.file]),
+ ),
+ coverage_common.instrumented_files_info(
+ ctx,
+ source_attributes = ["srcs"],
+ dependency_attributes = ["data", "deps", "embed", "embedsrcs"],
+ extensions = ["go"],
+ ),
+ OutputGroupInfo(
+ cgo_exports = archive.cgo_exports,
+ compilation_outputs = [archive.data.file],
+ ),
+ ]
+
+go_library = rule(
+ _go_library_impl,
+ attrs = {
+ "data": attr.label_list(
+ allow_files = True,
+ cfg = non_go_transition,
+ doc = """
+ List of files needed by this rule at run-time.
+ This may include data files needed or other programs that may be executed.
+ The [bazel] package may be used to locate run files; they may appear in different places
+ depending on the operating system and environment. See [data dependencies] for more information on data files.
+ """,
+ ),
+ "srcs": attr.label_list(
+ allow_files = go_exts + asm_exts + cgo_exts,
+ cfg = non_go_transition,
+ doc = """
+ The list of Go source files that are compiled to create the package.
+ Only `.go` and `.s` files are permitted, unless the `cgo` attribute is set,
+ in which case, `.c .cc .cpp .cxx .h .hh .hpp .hxx .inc .m .mm` files are also permitted.
+ Files may be filtered at build time using Go [build constraints].
+ """,
+ ),
+ "deps": attr.label_list(
+ providers = [GoLibrary],
+ doc = """
+ List of Go libraries this package imports directly.
+ These may be `go_library` rules or compatible rules with the [GoLibrary] provider.
+ """,
+ ),
+ "importpath": attr.string(
+ doc = """
+ The source import path of this library. Other libraries can import this library using this path.
+ This must either be specified in `go_library` or inherited from one of the libraries in `embed`.
+ """,
+ ),
+ "importmap": attr.string(
+ doc = """
+ The actual import path of this library. By default, this is `importpath`. This is mostly only visible to the compiler and linker,
+ but it may also be seen in stack traces. This must be unique among packages passed to the linker.
+ It may be set to something different than `importpath` to prevent conflicts between multiple packages
+ with the same path (for example, from different vendor directories).
+ """,
+ ),
+ "importpath_aliases": attr.string_list(
+ ), # experimental, undocumented
+ "embed": attr.label_list(
+ providers = [GoLibrary],
+ doc = """
+ List of Go libraries whose sources should be compiled together with this package's sources.
+ Labels listed here must name `go_library`, `go_proto_library`, or other compatible targets with
+ the [GoLibrary] and [GoSource] providers. Embedded libraries must have the same `importpath` as the embedding library.
+ At most one embedded library may have `cgo = True`, and the embedding library may not also have `cgo = True`.
+ See [Embedding] for more information.
+ """,
+ ),
+ "embedsrcs": attr.label_list(
+ allow_files = True,
+ cfg = non_go_transition,
+ doc = """
+ The list of files that may be embedded into the compiled package using `//go:embed`
+ directives. All files must be in the same logical directory or a subdirectory as source files.
+ All source files containing `//go:embed` directives must be in the same logical directory.
+ It's okay to mix static and generated source files and static and generated embeddable files.
+ """,
+ ),
+ "gc_goopts": attr.string_list(
+ doc = """
+ List of flags to add to the Go compilation command when using the gc compiler.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization].
+ """,
+ ),
+ "x_defs": attr.string_dict(
+ doc = """
+ Map of defines to add to the go link command. See [Defines and stamping] for examples of how to use these.
+ """,
+ ),
+ "cgo": attr.bool(
+ doc = """
+ If `True`, the package may contain [cgo] code, and `srcs` may contain C, C++, Objective-C, and Objective-C++ files
+ and non-Go assembly files. When cgo is enabled, these files will be compiled with the C/C++ toolchain and
+ included in the package. Note that this attribute does not force cgo to be enabled. Cgo is enabled for
+ non-cross-compiling builds when a C/C++ toolchain is configured.
+ """,
+ ),
+ "cdeps": attr.label_list(
+ cfg = non_go_transition,
+ doc = """
+ List of other libraries that the c code depends on.
+ This can be anything that would be allowed in [cc_library deps] Only valid if `cgo = True`.
+ """,
+ ),
+ "cppopts": attr.string_list(
+ doc = """
+ List of flags to add to the C/C++ preprocessor command.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization].
+ Only valid if `cgo = True`.
+ """,
+ ),
+ "copts": attr.string_list(
+ doc = """
+ List of flags to add to the C compilation command.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization]. Only valid if `cgo = True`.
+ """,
+ ),
+ "cxxopts": attr.string_list(
+ doc = """
+ List of flags to add to the C++ compilation command.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization]. Only valid if `cgo = True`.
+ """,
+ ),
+ "clinkopts": attr.string_list(
+ doc = """
+ List of flags to add to the C link command.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization]. Only valid if `cgo = True`.
+ """,
+ ),
+ "_go_context_data": attr.label(default = "//:go_context_data"),
+ "_allowlist_function_transition": attr.label(
+ default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
+ ),
+ },
+ toolchains = [GO_TOOLCHAIN],
+ doc = """This builds a Go library from a set of source files that are all part of
+ the same package.<br><br>
+ ***Note:*** For targets generated by Gazelle, `name` is typically the last component of the path,
+ or `go_default_library`, with the old naming convention.<br><br>
+ **Providers:**
+ <ul>
+ <li>[GoLibrary]</li>
+ <li>[GoSource]</li>
+ <li>[GoArchive]</li>
+ </ul>
+ """,
+)
+
+# See docs/go/core/rules.md#go_library for full documentation.
+
+go_tool_library = rule(
+ _go_library_impl,
+ attrs = {
+ "data": attr.label_list(allow_files = True),
+ "srcs": attr.label_list(allow_files = True),
+ "deps": attr.label_list(providers = [GoLibrary]),
+ "importpath": attr.string(),
+ "importmap": attr.string(),
+ "embed": attr.label_list(providers = [GoLibrary]),
+ "gc_goopts": attr.string_list(),
+ "x_defs": attr.string_dict(),
+ "_go_config": attr.label(default = "//:go_config"),
+ "_cgo_context_data": attr.label(default = "//:cgo_context_data_proxy"),
+ "_stdlib": attr.label(default = "//:stdlib"),
+ },
+ toolchains = [GO_TOOLCHAIN],
+)
+# This is used instead of `go_library` for dependencies of the `nogo` rule and
+# packages that are depended on implicitly by code generated within the Go rules.
+# This avoids a bootstrapping problem.
+
+# See docs/go/core/rules.md#go_tool_library for full documentation.
diff --git a/go/private/rules/nogo.bzl b/go/private/rules/nogo.bzl
new file mode 100644
index 00000000..6fed164f
--- /dev/null
+++ b/go/private/rules/nogo.bzl
@@ -0,0 +1,150 @@
+# Copyright 2018 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:context.bzl",
+ "go_context",
+)
+load(
+ "//go/private:go_toolchain.bzl",
+ "GO_TOOLCHAIN",
+)
+load(
+ "//go/private:providers.bzl",
+ "EXPORT_PATH",
+ "GoArchive",
+ "GoLibrary",
+ "get_archive",
+)
+load(
+ "//go/private/rules:transition.bzl",
+ "go_tool_transition",
+)
+
+def _nogo_impl(ctx):
+ if not ctx.attr.deps:
+ # If there aren't any analyzers to run, don't generate a binary.
+ # go_context will check for this condition.
+ return None
+
+ # Generate the source for the nogo binary.
+ go = go_context(ctx)
+ nogo_main = go.declare_file(go, path = "nogo_main.go")
+ nogo_args = ctx.actions.args()
+ nogo_args.add("gennogomain")
+ nogo_args.add("-output", nogo_main)
+ nogo_inputs = []
+ analyzer_archives = [get_archive(dep) for dep in ctx.attr.deps]
+ analyzer_importpaths = [archive.data.importpath for archive in analyzer_archives]
+ nogo_args.add_all(analyzer_importpaths, before_each = "-analyzer_importpath")
+ if ctx.file.config:
+ nogo_args.add("-config", ctx.file.config)
+ nogo_inputs.append(ctx.file.config)
+ ctx.actions.run(
+ inputs = nogo_inputs,
+ outputs = [nogo_main],
+ mnemonic = "GoGenNogo",
+ executable = go.toolchain._builder,
+ arguments = [nogo_args],
+ )
+
+ # Compile the nogo binary itself.
+ nogo_library = GoLibrary(
+ name = go.label.name + "~nogo",
+ label = go.label,
+ importpath = "nogomain",
+ importmap = "nogomain",
+ importpath_aliases = (),
+ pathtype = EXPORT_PATH,
+ is_main = True,
+ resolve = None,
+ )
+
+ nogo_source = go.library_to_source(go, struct(
+ srcs = [struct(files = [nogo_main])],
+ embed = [ctx.attr._nogo_srcs],
+ deps = analyzer_archives,
+ ), nogo_library, False)
+ _, executable, runfiles = go.binary(
+ go,
+ name = ctx.label.name,
+ source = nogo_source,
+ )
+ return [DefaultInfo(
+ files = depset([executable]),
+ runfiles = runfiles,
+ executable = executable,
+ )]
+
+_nogo = rule(
+ implementation = _nogo_impl,
+ attrs = {
+ "deps": attr.label_list(
+ providers = [GoArchive],
+ ),
+ "config": attr.label(
+ allow_single_file = True,
+ ),
+ "_nogo_srcs": attr.label(
+ default = "//go/tools/builders:nogo_srcs",
+ ),
+ "_cgo_context_data": attr.label(default = "//:cgo_context_data_proxy"),
+ "_go_config": attr.label(default = "//:go_config"),
+ "_stdlib": attr.label(default = "//:stdlib"),
+ "_allowlist_function_transition": attr.label(
+ default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
+ ),
+ },
+ toolchains = [GO_TOOLCHAIN],
+ cfg = go_tool_transition,
+)
+
+def nogo(name, visibility = None, **kwargs):
+ actual_name = "%s_actual" % name
+ native.alias(
+ name = name,
+ actual = select({
+ "@io_bazel_rules_go//go/private:nogo_active": actual_name,
+ "//conditions:default": Label("//:default_nogo"),
+ }),
+ visibility = visibility,
+ )
+
+ # With --use_top_level_targets_for_symlinks, which is enabled by default in
+ # Bazel 6.0.0, self-transitioning top-level targets prevent the bazel-bin
+ # convenience symlink from being created. Since nogo targets are of this
+ # type, their presence would trigger this behavior. Work around this by
+ # excluding them from wildcards - they are still transitively built as a
+ # tool dependency of every Go target.
+ kwargs.setdefault("tags", [])
+ if "manual" not in kwargs["tags"]:
+ kwargs["tags"].append("manual")
+
+ _nogo(
+ name = actual_name,
+ visibility = visibility,
+ **kwargs
+ )
+
+def nogo_wrapper(**kwargs):
+ if kwargs.get("vet"):
+ kwargs["deps"] = kwargs.get("deps", []) + [
+ "@org_golang_x_tools//go/analysis/passes/atomic:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/bools:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/buildtag:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/nilfunc:go_default_library",
+ "@org_golang_x_tools//go/analysis/passes/printf:go_default_library",
+ ]
+ kwargs = {k: v for k, v in kwargs.items() if k != "vet"}
+ nogo(**kwargs)
diff --git a/go/private/rules/sdk.bzl b/go/private/rules/sdk.bzl
new file mode 100644
index 00000000..899cd0a7
--- /dev/null
+++ b/go/private/rules/sdk.bzl
@@ -0,0 +1,140 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:providers.bzl",
+ "GoSDK",
+)
+
+def _go_sdk_impl(ctx):
+ package_list = ctx.file.package_list
+ if package_list == None:
+ package_list = ctx.actions.declare_file("packages.txt")
+ _build_package_list(ctx, ctx.files.srcs, ctx.file.root_file, package_list)
+ return [GoSDK(
+ goos = ctx.attr.goos,
+ goarch = ctx.attr.goarch,
+ experiments = ctx.attr.experiments,
+ root_file = ctx.file.root_file,
+ package_list = package_list,
+ libs = ctx.files.libs,
+ headers = ctx.files.headers,
+ srcs = ctx.files.srcs,
+ tools = ctx.files.tools,
+ go = ctx.executable.go,
+ version = ctx.attr.version,
+ )]
+
+go_sdk = rule(
+ _go_sdk_impl,
+ attrs = {
+ "goos": attr.string(
+ mandatory = True,
+ doc = "The host OS the SDK was built for",
+ ),
+ "goarch": attr.string(
+ mandatory = True,
+ doc = "The host architecture the SDK was built for",
+ ),
+ "experiments": attr.string_list(
+ mandatory = False,
+ doc = "Go experiments to enable via GOEXPERIMENT",
+ ),
+ "root_file": attr.label(
+ mandatory = True,
+ allow_single_file = True,
+ doc = "A file in the SDK root directory. Used to determine GOROOT.",
+ ),
+ "package_list": attr.label(
+ allow_single_file = True,
+ doc = ("A text file containing a list of packages in the " +
+ "standard library that may be imported."),
+ ),
+ "libs": attr.label_list(
+ # allow_files is not set to [".a"] because that wouldn't allow
+ # for zero files to be present, as is the case in Go 1.20+.
+ # See also https://github.com/bazelbuild/bazel/issues/7516
+ allow_files = True,
+ doc = ("Pre-compiled .a files for the standard library, " +
+ "built for the execution platform"),
+ ),
+ "headers": attr.label_list(
+ allow_files = [".h"],
+ doc = (".h files from pkg/include that may be included in " +
+ "assembly sources"),
+ ),
+ "srcs": attr.label_list(
+ allow_files = True,
+ doc = "Source files for packages in the standard library",
+ ),
+ "tools": attr.label_list(
+ allow_files = True,
+ cfg = "exec",
+ doc = ("List of executable files in the SDK built for " +
+ "the execution platform, excluding the go binary"),
+ ),
+ "go": attr.label(
+ mandatory = True,
+ allow_single_file = True,
+ executable = True,
+ cfg = "exec",
+ doc = "The go binary",
+ ),
+ "version": attr.string(
+ doc = "The version of the Go SDK.",
+ ),
+ },
+ doc = ("Collects information about a Go SDK. The SDK must have a normal " +
+ "GOROOT directory structure."),
+ provides = [GoSDK],
+)
+
+def _package_list_impl(ctx):
+ _build_package_list(ctx, ctx.files.srcs, ctx.file.root_file, ctx.outputs.out)
+ return [DefaultInfo(files = depset([ctx.outputs.out]))]
+
+package_list = rule(
+ _package_list_impl,
+ attrs = {
+ "srcs": attr.label_list(
+ allow_files = True,
+ doc = "Source files for packages in the standard library",
+ ),
+ "root_file": attr.label(
+ mandatory = True,
+ allow_single_file = True,
+ doc = "A file in the SDK root directory. Used to determine GOROOT.",
+ ),
+ "out": attr.output(
+ mandatory = True,
+ doc = "File to write. Must be 'packages.txt'.",
+ # Gazelle depends on this file directly. It has to be an output
+ # attribute because Bazel has no other way of knowing what rule
+ # produces this file.
+ # TODO(jayconrod): Update Gazelle and simplify this.
+ ),
+ },
+)
+
+def _build_package_list(ctx, srcs, root_file, out):
+ packages = {}
+ src_dir = root_file.dirname + "/src/"
+ for src in srcs:
+ pkg_src_dir = src.dirname
+ if not pkg_src_dir.startswith(src_dir):
+ continue
+ pkg_name = pkg_src_dir[len(src_dir):]
+ packages[pkg_name] = None
+ content = "\n".join(sorted(packages.keys())) + "\n"
+ ctx.actions.write(out, content)
diff --git a/go/private/rules/source.bzl b/go/private/rules/source.bzl
new file mode 100644
index 00000000..f92f5f83
--- /dev/null
+++ b/go/private/rules/source.bzl
@@ -0,0 +1,96 @@
+# Copyright 2017 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:context.bzl",
+ "go_context",
+)
+load(
+ "//go/private:go_toolchain.bzl",
+ "GO_TOOLCHAIN",
+)
+load(
+ "//go/private:providers.bzl",
+ "GoLibrary",
+)
+
+def _go_source_impl(ctx):
+ """Implements the go_source() rule."""
+ go = go_context(ctx)
+ library = go.new_library(go)
+ source = go.library_to_source(go, ctx.attr, library, ctx.coverage_instrumented())
+ return [
+ library,
+ source,
+ DefaultInfo(
+ files = depset(source.srcs),
+ ),
+ ]
+
+go_source = rule(
+ implementation = _go_source_impl,
+ attrs = {
+ "data": attr.label_list(
+ allow_files = True,
+ doc = """List of files needed by this rule at run-time. This may include data files
+ needed or other programs that may be executed. The [bazel] package may be
+ used to locate run files; they may appear in different places depending on the
+ operating system and environment. See [data dependencies] for more
+ information on data files.
+ """,
+ ),
+ "srcs": attr.label_list(
+ allow_files = True,
+ doc = """The list of Go source files that are compiled to create the package.
+ The following file types are permitted: `.go, .c, .s, .S .h`.
+ The files may contain Go-style [build constraints].
+ """,
+ ),
+ "deps": attr.label_list(
+ providers = [GoLibrary],
+ doc = """List of Go libraries this source list imports directly.
+ These may be go_library rules or compatible rules with the [GoLibrary] provider.
+ """,
+ ),
+ "embed": attr.label_list(
+ providers = [GoLibrary],
+ doc = """List of Go libraries whose sources should be compiled together with this
+ package's sources. Labels listed here must name `go_library`,
+ `go_proto_library`, or other compatible targets with the [GoLibrary] and
+ [GoSource] providers. Embedded libraries must have the same `importpath` as
+ the embedding library. At most one embedded library may have `cgo = True`,
+ and the embedding library may not also have `cgo = True`. See [Embedding]
+ for more information.
+ """,
+ ),
+ "gc_goopts": attr.string_list(
+ doc = """List of flags to add to the Go compilation command when using the gc compiler.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization].
+ """,
+ ),
+ "_go_config": attr.label(default = "//:go_config"),
+ "_cgo_context_data": attr.label(default = "//:cgo_context_data_proxy"),
+ },
+ toolchains = [GO_TOOLCHAIN],
+ doc = """This declares a set of source files and related dependencies that can be embedded into one of the
+ other rules.
+ This is used as a way of easily declaring a common set of sources re-used in multiple rules.<br><br>
+ **Providers:**
+ <ul>
+ <li>[GoLibrary]</li>
+ <li>[GoSource]</li>
+ </ul>
+ """,
+)
+# See docs/go/core/rules.md#go_source for full documentation.
diff --git a/go/private/rules/stdlib.bzl b/go/private/rules/stdlib.bzl
new file mode 100644
index 00000000..b1e64f6e
--- /dev/null
+++ b/go/private/rules/stdlib.bzl
@@ -0,0 +1,53 @@
+# Copyright 2016 The Bazel Go Rules Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:context.bzl",
+ "go_context",
+)
+load(
+ "//go/private:go_toolchain.bzl",
+ "GO_TOOLCHAIN",
+)
+load(
+ "//go/private:providers.bzl",
+ "GoConfigInfo",
+)
+load(
+ "//go/private/rules:transition.bzl",
+ "go_stdlib_transition",
+)
+
+def _stdlib_impl(ctx):
+ go = go_context(ctx)
+ source, library = go.toolchain.actions.stdlib(go)
+ return [source, library, source.stdlib]
+
+stdlib = rule(
+ implementation = _stdlib_impl,
+ cfg = go_stdlib_transition,
+ attrs = {
+ "cgo_context_data": attr.label(),
+ "_go_config": attr.label(
+ default = "//:go_config",
+ providers = [GoConfigInfo],
+ ),
+ "_allowlist_function_transition": attr.label(
+ default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
+ ),
+ },
+ doc = """stdlib builds the standard library for the target configuration
+or uses the precompiled standard library from the SDK if it is suitable.""",
+ toolchains = [GO_TOOLCHAIN],
+)
diff --git a/go/private/rules/test.bzl b/go/private/rules/test.bzl
new file mode 100644
index 00000000..413a19da
--- /dev/null
+++ b/go/private/rules/test.bzl
@@ -0,0 +1,707 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:context.bzl",
+ "go_context",
+)
+load(
+ "//go/private:common.bzl",
+ "as_list",
+ "asm_exts",
+ "cgo_exts",
+ "go_exts",
+ "split_srcs",
+)
+load(
+ "//go/private:go_toolchain.bzl",
+ "GO_TOOLCHAIN",
+)
+load(
+ "//go/private/rules:binary.bzl",
+ "gc_linkopts",
+)
+load(
+ "//go/private:providers.bzl",
+ "GoArchive",
+ "GoLibrary",
+ "GoSource",
+ "INFERRED_PATH",
+ "get_archive",
+)
+load(
+ "//go/private/rules:transition.bzl",
+ "go_transition",
+)
+load(
+ "//go/private:mode.bzl",
+ "LINKMODE_NORMAL",
+)
+load(
+ "@bazel_skylib//lib:structs.bzl",
+ "structs",
+)
+
+def _go_test_impl(ctx):
+ """go_test_impl implements go testing.
+
+ It emits an action to run the test generator, and then compiles the
+ test into a binary."""
+
+ go = go_context(ctx)
+
+ # Compile the library to test with internal white box tests
+ internal_library = go.new_library(go, testfilter = "exclude")
+ internal_source = go.library_to_source(go, ctx.attr, internal_library, ctx.coverage_instrumented())
+ internal_archive = go.archive(go, internal_source)
+ go_srcs = split_srcs(internal_source.srcs).go
+
+ # Compile the library with the external black box tests
+ external_library = go.new_library(
+ go,
+ name = internal_library.name + "_test",
+ importpath = internal_library.importpath + "_test",
+ testfilter = "only",
+ )
+ external_source = go.library_to_source(go, struct(
+ srcs = [struct(files = go_srcs)],
+ embedsrcs = [struct(files = internal_source.embedsrcs)],
+ deps = internal_archive.direct + [internal_archive],
+ x_defs = ctx.attr.x_defs,
+ ), external_library, ctx.coverage_instrumented())
+ external_source, internal_archive = _recompile_external_deps(go, external_source, internal_archive, [t.label for t in ctx.attr.embed])
+ external_archive = go.archive(go, external_source)
+
+ # now generate the main function
+ repo_relative_rundir = ctx.attr.rundir or ctx.label.package or "."
+ if ctx.label.workspace_name:
+ # The test is contained in an external repository (Label.workspace_name is always the empty
+ # string for the main repository, which is the canonical repository name of this repo).
+ # The test runner cd's into the directory corresponding to the main repository, so walk up
+ # and then down.
+ run_dir = "../" + ctx.label.workspace_name + "/" + repo_relative_rundir
+ else:
+ run_dir = repo_relative_rundir
+
+ main_go = go.declare_file(go, path = "testmain.go")
+ arguments = go.builder_args(go, "gentestmain")
+ arguments.add("-output", main_go)
+ if go.coverage_enabled:
+ if go.mode.race:
+ arguments.add("-cover_mode", "atomic")
+ else:
+ arguments.add("-cover_mode", "set")
+ arguments.add("-cover_format", go.cover_format)
+ arguments.add(
+ # the l is the alias for the package under test, the l_test must be the
+ # same with the test suffix
+ "-import",
+ "l=" + internal_source.library.importpath,
+ )
+ arguments.add(
+ "-import",
+ "l_test=" + external_source.library.importpath,
+ )
+ arguments.add("-pkgname", internal_source.library.importpath)
+ arguments.add_all(go_srcs, before_each = "-src", format_each = "l=%s")
+ ctx.actions.run(
+ inputs = go_srcs,
+ outputs = [main_go],
+ mnemonic = "GoTestGenTest",
+ executable = go.toolchain._builder,
+ arguments = [arguments],
+ )
+
+ test_gc_linkopts = gc_linkopts(ctx)
+ if not go.mode.debug:
+ # Disable symbol table and DWARF generation for test binaries.
+ test_gc_linkopts.extend(["-s", "-w"])
+
+ # Link in the run_dir global for bzltestutil
+ test_gc_linkopts.extend(["-X", "github.com/bazelbuild/rules_go/go/tools/bzltestutil.RunDir=" + run_dir])
+
+ # Now compile the test binary itself
+ test_library = GoLibrary(
+ name = go.label.name + "~testmain",
+ label = go.label,
+ importpath = "testmain",
+ importmap = "testmain",
+ importpath_aliases = (),
+ pathtype = INFERRED_PATH,
+ is_main = True,
+ resolve = None,
+ )
+ test_deps = external_archive.direct + [external_archive] + ctx.attr._testmain_additional_deps
+ if ctx.configuration.coverage_enabled:
+ test_deps.append(go.coverdata)
+ test_source = go.library_to_source(go, struct(
+ srcs = [struct(files = [main_go])],
+ deps = test_deps,
+ ), test_library, False)
+ test_archive, executable, runfiles = go.binary(
+ go,
+ name = ctx.label.name,
+ source = test_source,
+ test_archives = [internal_archive.data],
+ gc_linkopts = test_gc_linkopts,
+ version_file = ctx.version_file,
+ info_file = ctx.info_file,
+ )
+
+ env = {}
+ for k, v in ctx.attr.env.items():
+ env[k] = ctx.expand_location(v, ctx.attr.data)
+
+ run_environment_info = RunEnvironmentInfo(env, ctx.attr.env_inherit)
+
+ # Bazel only looks for coverage data if the test target has an
+ # InstrumentedFilesProvider. If the provider is found and at least one
+ # source file is present, Bazel will set the COVERAGE_OUTPUT_FILE
+ # environment variable during tests and will save that file to the build
+ # events + test outputs.
+ return [
+ test_archive,
+ DefaultInfo(
+ files = depset([executable]),
+ runfiles = runfiles,
+ executable = executable,
+ ),
+ OutputGroupInfo(
+ compilation_outputs = [internal_archive.data.file],
+ ),
+ coverage_common.instrumented_files_info(
+ ctx,
+ source_attributes = ["srcs"],
+ dependency_attributes = ["data", "deps", "embed", "embedsrcs"],
+ extensions = ["go"],
+ ),
+ run_environment_info,
+ ]
+
+_go_test_kwargs = {
+ "implementation": _go_test_impl,
+ "attrs": {
+ "data": attr.label_list(
+ allow_files = True,
+ doc = """List of files needed by this rule at run-time. This may include data files
+ needed or other programs that may be executed. The [bazel] package may be
+ used to locate run files; they may appear in different places depending on the
+ operating system and environment. See [data dependencies] for more
+ information on data files.
+ """,
+ ),
+ "srcs": attr.label_list(
+ allow_files = go_exts + asm_exts + cgo_exts,
+ doc = """The list of Go source files that are compiled to create the package.
+ Only `.go` and `.s` files are permitted, unless the `cgo`
+ attribute is set, in which case,
+ `.c .cc .cpp .cxx .h .hh .hpp .hxx .inc .m .mm`
+ files are also permitted. Files may be filtered at build time
+ using Go [build constraints].
+ """,
+ ),
+ "deps": attr.label_list(
+ providers = [GoLibrary],
+ doc = """List of Go libraries this test imports directly.
+ These may be go_library rules or compatible rules with the [GoLibrary] provider.
+ """,
+ cfg = go_transition,
+ ),
+ "embed": attr.label_list(
+ providers = [GoLibrary],
+ doc = """List of Go libraries whose sources should be compiled together with this
+ package's sources. Labels listed here must name `go_library`,
+ `go_proto_library`, or other compatible targets with the [GoLibrary] and
+ [GoSource] providers. Embedded libraries must have the same `importpath` as
+ the embedding library. At most one embedded library may have `cgo = True`,
+ and the embedding library may not also have `cgo = True`. See [Embedding]
+ for more information.
+ """,
+ cfg = go_transition,
+ ),
+ "embedsrcs": attr.label_list(
+ allow_files = True,
+ doc = """The list of files that may be embedded into the compiled package using
+ `//go:embed` directives. All files must be in the same logical directory
+ or a subdirectory as source files. All source files containing `//go:embed`
+ directives must be in the same logical directory. It's okay to mix static and
+ generated source files and static and generated embeddable files.
+ """,
+ ),
+ "env": attr.string_dict(
+ doc = """Environment variables to set for the test execution.
+ The values (but not keys) are subject to
+ [location expansion](https://docs.bazel.build/versions/main/skylark/macros.html) but not full
+ [make variable expansion](https://docs.bazel.build/versions/main/be/make-variables.html).
+ """,
+ ),
+ "env_inherit": attr.string_list(
+ doc = """Environment variables to inherit from the external environment.
+ """,
+ ),
+ "importpath": attr.string(
+ doc = """The import path of this test. Tests can't actually be imported, but this
+ may be used by [go_path] and other tools to report the location of source
+ files. This may be inferred from embedded libraries.
+ """,
+ ),
+ "gc_goopts": attr.string_list(
+ doc = """List of flags to add to the Go compilation command when using the gc compiler.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization].
+ """,
+ ),
+ "gc_linkopts": attr.string_list(
+ doc = """List of flags to add to the Go link command when using the gc compiler.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization].
+ """,
+ ),
+ "rundir": attr.string(
+ doc = """ A directory to cd to before the test is run.
+ This should be a path relative to the root directory of the
+ repository in which the test is defined, which can be the main or an
+ external repository.
+
+ The default behaviour is to change to the relative path
+ corresponding to the test's package, which replicates the normal
+ behaviour of `go test` so it is easy to write compatible tests.
+
+ Setting it to `.` makes the test behave the normal way for a bazel
+ test, except that the working directory is always that of the test's
+ repository, which is not necessarily the main repository.
+
+ Note: If runfile symlinks are disabled (such as on Windows by
+ default), the test will run in the working directory set by Bazel,
+ which is the subdirectory of the runfiles directory corresponding to
+ the main repository.
+ """,
+ ),
+ "x_defs": attr.string_dict(
+ doc = """Map of defines to add to the go link command.
+ See [Defines and stamping] for examples of how to use these.
+ """,
+ ),
+ "linkmode": attr.string(
+ default = LINKMODE_NORMAL,
+ doc = """Determines how the binary should be built and linked. This accepts some of
+ the same values as `go build -buildmode` and works the same way.
+ <br><br>
+ <ul>
+ <li>`normal`: Builds a normal executable with position-dependent code.</li>
+ <li>`pie`: Builds a position-independent executable.</li>
+ <li>`plugin`: Builds a shared library that can be loaded as a Go plugin. Only supported on platforms that support plugins.</li>
+ <li>`c-shared`: Builds a shared library that can be linked into a C program.</li>
+ <li>`c-archive`: Builds an archive that can be linked into a C program.</li>
+ </ul>
+ """,
+ ),
+ "cgo": attr.bool(
+ doc = """
+ If `True`, the package may contain [cgo] code, and `srcs` may contain
+ C, C++, Objective-C, and Objective-C++ files and non-Go assembly files.
+ When cgo is enabled, these files will be compiled with the C/C++ toolchain
+ and included in the package. Note that this attribute does not force cgo
+ to be enabled. Cgo is enabled for non-cross-compiling builds when a C/C++
+ toolchain is configured.
+ """,
+ ),
+ "cdeps": attr.label_list(
+ doc = """The list of other libraries that the c code depends on.
+ This can be anything that would be allowed in [cc_library deps]
+ Only valid if `cgo` = `True`.
+ """,
+ ),
+ "cppopts": attr.string_list(
+ doc = """List of flags to add to the C/C++ preprocessor command.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization].
+ Only valid if `cgo` = `True`.
+ """,
+ ),
+ "copts": attr.string_list(
+ doc = """List of flags to add to the C compilation command.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization].
+ Only valid if `cgo` = `True`.
+ """,
+ ),
+ "cxxopts": attr.string_list(
+ doc = """List of flags to add to the C++ compilation command.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization].
+ Only valid if `cgo` = `True`.
+ """,
+ ),
+ "clinkopts": attr.string_list(
+ doc = """List of flags to add to the C link command.
+ Subject to ["Make variable"] substitution and [Bourne shell tokenization].
+ Only valid if `cgo` = `True`.
+ """,
+ ),
+ "pure": attr.string(
+ default = "auto",
+ doc = """Controls whether cgo source code and dependencies are compiled and linked,
+ similar to setting `CGO_ENABLED`. May be one of `on`, `off`,
+ or `auto`. If `auto`, pure mode is enabled when no C/C++
+ toolchain is configured or when cross-compiling. It's usually better to
+ control this on the command line with
+ `--@io_bazel_rules_go//go/config:pure`. See [mode attributes], specifically
+ [pure].
+ """,
+ ),
+ "static": attr.string(
+ default = "auto",
+ doc = """Controls whether a binary is statically linked. May be one of `on`,
+ `off`, or `auto`. Not available on all platforms or in all
+ modes. It's usually better to control this on the command line with
+ `--@io_bazel_rules_go//go/config:static`. See [mode attributes],
+ specifically [static].
+ """,
+ ),
+ "race": attr.string(
+ default = "auto",
+ doc = """Controls whether code is instrumented for race detection. May be one of
+ `on`, `off`, or `auto`. Not available when cgo is
+ disabled. In most cases, it's better to control this on the command line with
+ `--@io_bazel_rules_go//go/config:race`. See [mode attributes], specifically
+ [race].
+ """,
+ ),
+ "msan": attr.string(
+ default = "auto",
+ doc = """Controls whether code is instrumented for memory sanitization. May be one of
+ `on`, `off`, or `auto`. Not available when cgo is
+ disabled. In most cases, it's better to control this on the command line with
+ `--@io_bazel_rules_go//go/config:msan`. See [mode attributes], specifically
+ [msan].
+ """,
+ ),
+ "gotags": attr.string_list(
+ doc = """Enables a list of build tags when evaluating [build constraints]. Useful for
+ conditional compilation.
+ """,
+ ),
+ "goos": attr.string(
+ default = "auto",
+ doc = """Forces a binary to be cross-compiled for a specific operating system. It's
+ usually better to control this on the command line with `--platforms`.
+
+ This disables cgo by default, since a cross-compiling C/C++ toolchain is
+ rarely available. To force cgo, set `pure` = `off`.
+
+ See [Cross compilation] for more information.
+ """,
+ ),
+ "goarch": attr.string(
+ default = "auto",
+ doc = """Forces a binary to be cross-compiled for a specific architecture. It's usually
+ better to control this on the command line with `--platforms`.
+
+ This disables cgo by default, since a cross-compiling C/C++ toolchain is
+ rarely available. To force cgo, set `pure` = `off`.
+
+ See [Cross compilation] for more information.
+ """,
+ ),
+ "_go_context_data": attr.label(default = "//:go_context_data", cfg = go_transition),
+ "_testmain_additional_deps": attr.label_list(
+ providers = [GoLibrary],
+ default = ["//go/tools/bzltestutil"],
+ cfg = go_transition,
+ ),
+ # Required for Bazel to collect coverage of instrumented C/C++ binaries
+ # executed by go_test.
+ # This is just a shell script and thus cheap enough to depend on
+ # unconditionally.
+ "_collect_cc_coverage": attr.label(
+ default = "@bazel_tools//tools/test:collect_cc_coverage",
+ cfg = "exec",
+ ),
+ # Required for Bazel to merge coverage reports for Go and other
+ # languages into a single report per test.
+ # Using configuration_field ensures that the tool is only built when
+ # run with bazel coverage, not with bazel test.
+ "_lcov_merger": attr.label(
+ default = configuration_field(fragment = "coverage", name = "output_generator"),
+ cfg = "exec",
+ ),
+ "_allowlist_function_transition": attr.label(
+ default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
+ ),
+ },
+ "executable": True,
+ "test": True,
+ "toolchains": [GO_TOOLCHAIN],
+ "doc": """This builds a set of tests that can be run with `bazel test`.<br><br>
+ To run all tests in the workspace, and print output on failure (the
+ equivalent of `go test ./...`), run<br>
+ ```
+ bazel test --test_output=errors //...
+ ```<br><br>
+ To run a Go benchmark test, run<br>
+ ```
+ bazel run //path/to:test -- -test.bench=.
+ ```<br><br>
+ You can run specific tests by passing the `--test_filter=pattern
+ <test_filter_>` argument to Bazel. You can pass arguments to tests by passing
+ `--test_arg=arg <test_arg_>` arguments to Bazel, and you can set environment
+ variables in the test environment by passing
+ `--test_env=VAR=value <test_env_>`. You can terminate test execution after the first
+ failure by passing the `--test_runner_fast_fast <test_runner_fail_fast_>` argument
+ to Bazel. This is equivalent to passing `--test_arg=-failfast <test_arg_>`.<br><br>
+ To write structured testlog information to Bazel's `XML_OUTPUT_FILE`, tests
+ ran with `bazel test` execute using a wrapper. This functionality can be
+ disabled by setting `GO_TEST_WRAP=0` in the test environment. Additionally,
+ the testbinary can be invoked with `-test.v` by setting
+ `GO_TEST_WRAP_TESTV=1` in the test environment; this will result in the
+ `XML_OUTPUT_FILE` containing more granular data.<br><br>
+ ***Note:*** To interoperate cleanly with old targets generated by [Gazelle], `name`
+ should be `go_default_test` for internal tests and
+ `go_default_xtest` for external tests. Gazelle now generates
+ the name based on the last component of the path. For example, a test
+ in `//foo/bar` is named `bar_test`, and uses internal and external
+ sources.
+ """,
+}
+
+go_test = rule(**_go_test_kwargs)
+
+def _recompile_external_deps(go, external_source, internal_archive, library_labels):
+ """Recompiles some archives in order to split internal and external tests.
+
+ go_test, like 'go test', splits tests into two separate archives: an
+ internal archive ('package foo') and an external archive
+ ('package foo_test'). The library under test is embedded into the internal
+ archive. The external archive may import it and may depend on symbols
+ defined in the internal test files.
+
+ To avoid conflicts, the library under test must not be linked into the test
+ binary, since the internal test archive embeds the same sources.
+ Libraries imported by the external test that transitively import the
+ library under test must be recompiled too, or the linker will complain that
+ export data they were compiled with doesn't match the export data they
+ are linked with.
+
+ This function identifies which archives may need to be recompiled, then
+ declares new output files and actions to recompile them. This is an
+ unfortunately an expensive process requiring O(V+E) time and space in the
+ size of the test's dependency graph for each test.
+
+ Args:
+ go: go object returned by go_context.
+ external_source: GoSource for the external archive.
+ internal_archive: GoArchive for the internal archive.
+ library_labels: labels for embedded libraries under test.
+
+ Returns:
+ external_soruce: recompiled GoSource for the external archive. If no
+ recompilation is needed, the original GoSource is returned.
+ internal_archive: recompiled GoArchive for the internal archive. If no
+ recompilation is needed, the original GoSource is returned.
+ """
+
+ # If no libraries are embedded in the internal archive, then nothing needs
+ # to be recompiled.
+ if not library_labels:
+ return external_source, internal_archive
+
+ # Build a map from labels to GoArchiveData.
+ # If none of the librares embedded in the internal archive are in the
+ # dependency graph, then nothing needs to be recompiled.
+ arc_data_list = depset(transitive = [get_archive(dep).transitive for dep in external_source.deps]).to_list()
+ label_to_arc_data = {a.label: a for a in arc_data_list}
+ if all([l not in label_to_arc_data for l in library_labels]):
+ return external_source, internal_archive
+
+ # Build a depth-first post-order list of dependencies starting with the
+ # external archive. Each archive appears after its dependencies and before
+ # its dependents.
+ #
+ # This is tricky because Starlark doesn't support recursion or while loops.
+ # We simulate a while loop by iterating over a list of 2N elements where
+ # N is the number of archives. Each archive is pushed onto the stack
+ # twice: once before its dependencies are pushed, and once after.
+
+ # dep_list is the post-order list of dependencies we're building.
+ dep_list = []
+
+ # stack is a stack of targets to process. We're done when it's empty.
+ stack = [get_archive(dep).data.label for dep in external_source.deps]
+
+ # deps_pushed tracks the status of each target.
+ # DEPS_UNPROCESSED means the target is on the stack, but its dependencies
+ # are not.
+ # Non-negative integers are the number of dependencies on the stack that
+ # still need to be processed.
+ # A target is on the stack if its status is DEPS_UNPROCESSED or 0.
+ DEPS_UNPROCESSED = -1
+ deps_pushed = {l: DEPS_UNPROCESSED for l in stack}
+
+ # dependents maps labels to lists of known dependents. When a target is
+ # processed, its dependents' deps_pushed count is deprecated.
+ dependents = {l: [] for l in stack}
+
+ # step is a list to iterate over to simulate a while loop. i tracks
+ # iterations.
+ step = [None] * (2 * len(arc_data_list))
+ i = 0
+ for _ in step:
+ if len(stack) == 0:
+ break
+ i += 1
+
+ label = stack.pop()
+ if deps_pushed[label] == 0:
+ # All deps have been added to dep_list. Append this target to the
+ # list. If a dependent is not waiting for anything else, push
+ # it back onto the stack.
+ dep_list.append(label)
+ for p in dependents.get(label, []):
+ deps_pushed[p] -= 1
+ if deps_pushed[p] == 0:
+ stack.append(p)
+ continue
+
+ # deps_pushed[label] == None, indicating we don't know whether this
+ # targets dependencies have been processed. Other targets processed
+ # earlier may depend on them.
+ deps_pushed[label] = 0
+ arc_data = label_to_arc_data[label]
+ for c in arc_data._dep_labels:
+ if c not in deps_pushed:
+ # Dependency not seen yet; push it.
+ stack.append(c)
+ deps_pushed[c] = None
+ deps_pushed[label] += 1
+ dependents[c] = [label]
+ elif deps_pushed[c] != 0:
+ # Dependency pushed, not processed; wait for it.
+ deps_pushed[label] += 1
+ dependents[c].append(label)
+ if deps_pushed[label] == 0:
+ # No dependencies to wait for; push self.
+ stack.append(label)
+ if i != len(step):
+ fail("assertion failed: iterated %d times instead of %d" % (i, len(step)))
+
+ # Determine which dependencies need to be recompiled because they depend
+ # on embedded libraries.
+ need_recompile = {}
+ for label in dep_list:
+ arc_data = label_to_arc_data[label]
+ need_recompile[label] = any([
+ dep in library_labels or need_recompile[dep]
+ for dep in arc_data._dep_labels
+ ])
+
+ # Recompile the internal archive without dependencies that need
+ # recompilation. This breaks a cycle which occurs because the deps list
+ # is shared between the internal and external archive. The internal archive
+ # can't import anything that imports itself.
+ internal_source = internal_archive.source
+
+ internal_deps = []
+
+ # Pass internal dependencies that need to be recompiled down to the builder to check if the internal archive
+ # tries to import any of the dependencies. If there is, that means that there is a dependency cycle.
+ need_recompile_deps = []
+ for dep in internal_source.deps:
+ dep_data = get_archive(dep).data
+ if not need_recompile[dep_data.label]:
+ internal_deps.append(dep)
+ else:
+ need_recompile_deps.append(dep_data.importpath)
+
+ x_defs = dict(internal_source.x_defs)
+ x_defs.update(internal_archive.x_defs)
+ attrs = structs.to_dict(internal_source)
+ attrs["deps"] = internal_deps
+ attrs["x_defs"] = x_defs
+ internal_source = GoSource(**attrs)
+ internal_archive = go.archive(go, internal_source, _recompile_suffix = ".recompileinternal", recompile_internal_deps = need_recompile_deps)
+
+ # Build a map from labels to possibly recompiled GoArchives.
+ label_to_archive = {}
+ i = 0
+ for label in dep_list:
+ i += 1
+ recompile_suffix = ".recompile%d" % i
+
+ # If this library is the internal archive, use the recompiled version.
+ if label == internal_archive.data.label:
+ label_to_archive[label] = internal_archive
+ continue
+
+ # If this is a library embedded into the internal test archive,
+ # use the internal test archive instead.
+ if label in library_labels:
+ label_to_archive[label] = internal_archive
+ continue
+
+ # Create a stub GoLibrary and GoSource from the archive data.
+ arc_data = label_to_arc_data[label]
+ library = GoLibrary(
+ name = arc_data.name,
+ label = arc_data.label,
+ importpath = arc_data.importpath,
+ importmap = arc_data.importmap,
+ importpath_aliases = arc_data.importpath_aliases,
+ pathtype = arc_data.pathtype,
+ resolve = None,
+ testfilter = None,
+ is_main = False,
+ )
+ deps = [label_to_archive[d] for d in arc_data._dep_labels]
+ source = GoSource(
+ library = library,
+ mode = go.mode,
+ srcs = as_list(arc_data.srcs),
+ orig_srcs = as_list(arc_data.orig_srcs),
+ orig_src_map = dict(zip(arc_data.srcs, arc_data._orig_src_map)),
+ cover = arc_data._cover,
+ embedsrcs = as_list(arc_data._embedsrcs),
+ x_defs = dict(arc_data._x_defs),
+ deps = deps,
+ gc_goopts = as_list(arc_data._gc_goopts),
+ runfiles = go._ctx.runfiles(files = arc_data.data_files),
+ cgo = arc_data._cgo,
+ cdeps = as_list(arc_data._cdeps),
+ cppopts = as_list(arc_data._cppopts),
+ copts = as_list(arc_data._copts),
+ cxxopts = as_list(arc_data._cxxopts),
+ clinkopts = as_list(arc_data._clinkopts),
+ cgo_exports = as_list(arc_data._cgo_exports),
+ )
+
+ # If this archive needs to be recompiled, use go.archive.
+ # Otherwise, create a stub GoArchive, using the original file.
+ if need_recompile[label]:
+ recompile_suffix = ".recompile%d" % i
+ archive = go.archive(go, source, _recompile_suffix = recompile_suffix)
+ else:
+ archive = GoArchive(
+ source = source,
+ data = arc_data,
+ direct = deps,
+ libs = depset(direct = [arc_data.file], transitive = [a.libs for a in deps]),
+ transitive = depset(direct = [arc_data], transitive = [a.transitive for a in deps]),
+ x_defs = source.x_defs,
+ cgo_deps = depset(direct = arc_data._cgo_deps, transitive = [a.cgo_deps for a in deps]),
+ cgo_exports = depset(direct = list(source.cgo_exports), transitive = [a.cgo_exports for a in deps]),
+ runfiles = source.runfiles,
+ mode = go.mode,
+ )
+ label_to_archive[label] = archive
+
+ # Finally, we need to replace external_source.deps with the recompiled
+ # archives.
+ attrs = structs.to_dict(external_source)
+ attrs["deps"] = [label_to_archive[get_archive(dep).data.label] for dep in external_source.deps]
+ return GoSource(**attrs), internal_archive
diff --git a/go/private/rules/transition.bzl b/go/private/rules/transition.bzl
new file mode 100644
index 00000000..4e87e30e
--- /dev/null
+++ b/go/private/rules/transition.bzl
@@ -0,0 +1,459 @@
+# Copyright 2020 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "@bazel_skylib//lib:paths.bzl",
+ "paths",
+)
+load(
+ "//go/private:mode.bzl",
+ "LINKMODES",
+ "LINKMODE_NORMAL",
+)
+load(
+ "//go/private:platforms.bzl",
+ "CGO_GOOS_GOARCH",
+ "GOOS_GOARCH",
+)
+load(
+ "//go/private:providers.bzl",
+ "GoArchive",
+ "GoLibrary",
+ "GoSource",
+)
+
+# A list of rules_go settings that are possibly set by go_transition.
+# Keep their package name in sync with the implementation of
+# _original_setting_key.
+TRANSITIONED_GO_SETTING_KEYS = [
+ "//go/config:static",
+ "//go/config:msan",
+ "//go/config:race",
+ "//go/config:pure",
+ "//go/config:linkmode",
+ "//go/config:tags",
+]
+
+def _deduped_and_sorted(strs):
+ return sorted({s: None for s in strs}.keys())
+
+def _original_setting_key(key):
+ if not "//go/config:" in key:
+ fail("_original_setting_key currently assumes that all Go settings live under //go/config, got: " + key)
+ name = key.split(":")[1]
+ return "//go/private/rules:original_" + name
+
+_SETTING_KEY_TO_ORIGINAL_SETTING_KEY = {
+ setting: _original_setting_key(setting)
+ for setting in TRANSITIONED_GO_SETTING_KEYS
+}
+
+def _go_transition_impl(settings, attr):
+ # NOTE: Keep the list of rules_go settings set by this transition in sync
+ # with POTENTIALLY_TRANSITIONED_SETTINGS.
+ #
+ # NOTE(bazelbuild/bazel#11409): Calling fail here for invalid combinations
+ # of flags reports an error but does not stop the build.
+ # In any case, get_mode should mainly be responsible for reporting
+ # invalid modes, since it also takes --features flags into account.
+
+ original_settings = settings
+ settings = dict(settings)
+
+ _set_ternary(settings, attr, "static")
+ race = _set_ternary(settings, attr, "race")
+ msan = _set_ternary(settings, attr, "msan")
+ pure = _set_ternary(settings, attr, "pure")
+ if race == "on":
+ if pure == "on":
+ fail('race = "on" cannot be set when pure = "on" is set. race requires cgo.')
+ pure = "off"
+ settings["//go/config:pure"] = False
+ if msan == "on":
+ if pure == "on":
+ fail('msan = "on" cannot be set when msan = "on" is set. msan requires cgo.')
+ pure = "off"
+ settings["//go/config:pure"] = False
+ if pure == "on":
+ race = "off"
+ settings["//go/config:race"] = False
+ msan = "off"
+ settings["//go/config:msan"] = False
+ cgo = pure == "off"
+
+ goos = getattr(attr, "goos", "auto")
+ goarch = getattr(attr, "goarch", "auto")
+ _check_ternary("pure", pure)
+ if goos != "auto" or goarch != "auto":
+ if goos == "auto":
+ fail("goos must be set if goarch is set")
+ if goarch == "auto":
+ fail("goarch must be set if goos is set")
+ if (goos, goarch) not in GOOS_GOARCH:
+ fail("invalid goos, goarch pair: {}, {}".format(goos, goarch))
+ if cgo and (goos, goarch) not in CGO_GOOS_GOARCH:
+ fail('pure is "off" but cgo is not supported on {} {}'.format(goos, goarch))
+ platform = "@io_bazel_rules_go//go/toolchain:{}_{}{}".format(goos, goarch, "_cgo" if cgo else "")
+ settings["//command_line_option:platforms"] = platform
+
+ tags = getattr(attr, "gotags", [])
+ if tags:
+ settings["//go/config:tags"] = _deduped_and_sorted(tags)
+
+ linkmode = getattr(attr, "linkmode", "auto")
+ if linkmode != "auto":
+ if linkmode not in LINKMODES:
+ fail("linkmode: invalid mode {}; want one of {}".format(linkmode, ", ".join(LINKMODES)))
+ settings["//go/config:linkmode"] = linkmode
+
+ for key, original_key in _SETTING_KEY_TO_ORIGINAL_SETTING_KEY.items():
+ old_value = original_settings[key]
+ value = settings[key]
+
+ # If the outgoing configuration would differ from the incoming one in a
+ # value, record the old value in the special original_* key so that the
+ # real setting can be reset to this value before the new configuration
+ # would cross a non-deps dependency edge.
+ if value != old_value:
+ # Encoding as JSON makes it possible to embed settings of arbitrary
+ # types (currently bool, string and string_list) into a single type
+ # of setting (string) with the information preserved whether the
+ # original setting wasn't set explicitly (empty string) or was set
+ # explicitly to its default (always a non-empty string with JSON
+ # encoding, e.g. "\"\"" or "[]").
+ settings[original_key] = json.encode(old_value)
+ else:
+ settings[original_key] = ""
+
+ return settings
+
+def _request_nogo_transition(settings, _attr):
+ """Indicates that we want the project configured nogo instead of a noop.
+
+ This does not guarantee that the project configured nogo will be used (if
+ bootstrap is true we are currently building nogo so that is a cyclic
+ dependency).
+
+ The config setting nogo_active requires bootstrap to be false and
+ request_nogo to be true to provide the project configured nogo.
+ """
+ settings = dict(settings)
+ settings["//go/private:request_nogo"] = True
+ return settings
+
+request_nogo_transition = transition(
+ implementation = _request_nogo_transition,
+ inputs = [],
+ outputs = ["//go/private:request_nogo"],
+)
+
+go_transition = transition(
+ implementation = _go_transition_impl,
+ inputs = [
+ "//command_line_option:platforms",
+ ] + TRANSITIONED_GO_SETTING_KEYS,
+ outputs = [
+ "//command_line_option:platforms",
+ ] + TRANSITIONED_GO_SETTING_KEYS + _SETTING_KEY_TO_ORIGINAL_SETTING_KEY.values(),
+)
+
+_common_reset_transition_dict = dict({
+ "//go/private:request_nogo": False,
+ "//go/config:static": False,
+ "//go/config:msan": False,
+ "//go/config:race": False,
+ "//go/config:pure": False,
+ "//go/config:debug": False,
+ "//go/config:linkmode": LINKMODE_NORMAL,
+ "//go/config:tags": [],
+}, **{setting: "" for setting in _SETTING_KEY_TO_ORIGINAL_SETTING_KEY.values()})
+
+_reset_transition_dict = dict(_common_reset_transition_dict, **{
+ "//go/private:bootstrap_nogo": True,
+})
+
+_reset_transition_keys = sorted(_reset_transition_dict.keys())
+
+_stdlib_keep_keys = sorted([
+ "//go/config:msan",
+ "//go/config:race",
+ "//go/config:pure",
+ "//go/config:linkmode",
+ "//go/config:tags",
+])
+
+def _go_tool_transition_impl(settings, _attr):
+ """Sets most Go settings to default values (use for external Go tools).
+
+ go_tool_transition sets all of the //go/config settings to their default
+ values and disables nogo. This is used for Go tool binaries like nogo
+ itself. Tool binaries shouldn't depend on the link mode or tags of the
+ target configuration and neither the tools nor the code they potentially
+ generate should be subject to nogo's static analysis. This transition
+ doesn't change the platform (goos, goarch), but tool binaries should also
+ have `cfg = "exec"` so tool binaries should be built for the execution
+ platform.
+ """
+ return dict(settings, **_reset_transition_dict)
+
+go_tool_transition = transition(
+ implementation = _go_tool_transition_impl,
+ inputs = _reset_transition_keys,
+ outputs = _reset_transition_keys,
+)
+
+def _non_go_tool_transition_impl(settings, _attr):
+ """Sets all Go settings to default values (use for external non-Go tools).
+
+ non_go_tool_transition sets all of the //go/config settings as well as the
+ nogo settings to their default values. This is used for all tools that are
+ not themselves targets created from rules_go rules and thus do not read
+ these settings. Resetting all of them to defaults prevents unnecessary
+ configuration changes for these targets that could cause rebuilds.
+
+ Examples: This transition is applied to attributes referencing proto_library
+ targets or protoc directly.
+ """
+ settings = dict(settings, **_reset_transition_dict)
+ settings["//go/private:bootstrap_nogo"] = False
+ return settings
+
+non_go_tool_transition = transition(
+ implementation = _non_go_tool_transition_impl,
+ inputs = _reset_transition_keys,
+ outputs = _reset_transition_keys,
+)
+
+def _go_stdlib_transition_impl(settings, _attr):
+ """Sets all Go settings to their default values, except for those affecting the Go SDK.
+
+ This transition is similar to _non_go_tool_transition except that it keeps the
+ parts of the configuration that determine how to build the standard library.
+ It's used to consolidate the configurations used to build the standard library to limit
+ the number built.
+ """
+ settings = dict(settings)
+ for label, value in _reset_transition_dict.items():
+ if label not in _stdlib_keep_keys:
+ settings[label] = value
+ settings["//go/config:tags"] = [t for t in settings["//go/config:tags"] if t in _TAG_AFFECTS_STDLIB]
+ settings["//go/private:bootstrap_nogo"] = False
+ return settings
+
+go_stdlib_transition = transition(
+ implementation = _go_stdlib_transition_impl,
+ inputs = _reset_transition_keys,
+ outputs = _reset_transition_keys,
+)
+
+def _go_reset_target_impl(ctx):
+ t = ctx.attr.dep[0] # [0] seems to be necessary with the transition
+ providers = [t[p] for p in [GoLibrary, GoSource, GoArchive] if p in t]
+
+ # We can't pass DefaultInfo through as-is, since Bazel forbids executable
+ # if it's a file declared in a different target. To emulate that, symlink
+ # to the original executable, if there is one.
+ default_info = t[DefaultInfo]
+
+ new_executable = None
+ original_executable = default_info.files_to_run.executable
+ default_runfiles = default_info.default_runfiles
+ if original_executable:
+ # In order for the symlink to have the same basename as the original
+ # executable (important in the case of proto plugins), put it in a
+ # subdirectory named after the label to prevent collisions.
+ new_executable = ctx.actions.declare_file(paths.join(ctx.label.name, original_executable.basename))
+ ctx.actions.symlink(
+ output = new_executable,
+ target_file = original_executable,
+ is_executable = True,
+ )
+ default_runfiles = default_runfiles.merge(ctx.runfiles([new_executable]))
+
+ providers.append(
+ DefaultInfo(
+ files = default_info.files,
+ data_runfiles = default_info.data_runfiles,
+ default_runfiles = default_runfiles,
+ executable = new_executable,
+ ),
+ )
+ return providers
+
+go_reset_target = rule(
+ implementation = _go_reset_target_impl,
+ attrs = {
+ "dep": attr.label(
+ mandatory = True,
+ cfg = go_tool_transition,
+ ),
+ "_allowlist_function_transition": attr.label(
+ default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
+ ),
+ },
+ doc = """Forwards providers from a target and applies go_tool_transition.
+
+go_reset_target depends on a single target, built using go_tool_transition. It
+forwards Go providers and DefaultInfo.
+
+This is used to work around a problem with building tools: Go tools should be
+built with 'cfg = "exec"' so they work on the execution platform, but we also
+need to apply go_tool_transition so that e.g. a tool isn't built as a shared
+library with race instrumentation. This acts as an intermediate rule that allows
+to apply both both transitions.
+""",
+)
+
+non_go_reset_target = rule(
+ implementation = _go_reset_target_impl,
+ attrs = {
+ "dep": attr.label(
+ mandatory = True,
+ cfg = non_go_tool_transition,
+ ),
+ "_allowlist_function_transition": attr.label(
+ default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
+ ),
+ },
+ doc = """Forwards providers from a target and applies non_go_tool_transition.
+
+non_go_reset_target depends on a single target, built using
+non_go_tool_transition. It forwards Go providers and DefaultInfo.
+
+This is used to work around a problem with building tools: Non-Go tools should
+be built with 'cfg = "exec"' so they work on the execution platform, but they
+also shouldn't be affected by Go-specific config changes applied by
+go_transition.
+""",
+)
+
+def _non_go_transition_impl(settings, _attr):
+ """Sets all Go settings to the values they had before the last go_transition.
+
+ non_go_transition sets all of the //go/config settings to the value they had
+ before the last go_transition. This should be used on all attributes of
+ go_library/go_binary/go_test that are built in the target configuration and
+ do not constitute advertise any Go providers.
+
+ Examples: This transition is applied to the 'data' attribute of go_binary so
+ that other Go binaries used at runtime aren't affected by a non-standard
+ link mode set on the go_binary target, but still use the same top-level
+ settings such as e.g. race instrumentation.
+ """
+ new_settings = {}
+ for key, original_key in _SETTING_KEY_TO_ORIGINAL_SETTING_KEY.items():
+ original_value = settings[original_key]
+ if original_value:
+ # Reset to the original value of the setting before go_transition.
+ new_settings[key] = json.decode(original_value)
+ else:
+ new_settings[key] = settings[key]
+
+ # Reset the value of the helper setting to its default for two reasons:
+ # 1. Performance: This ensures that the Go settings of non-Go
+ # dependencies have the same values as before the go_transition,
+ # which can prevent unnecessary rebuilds caused by configuration
+ # changes.
+ # 2. Correctness in edge cases: If there is a path in the build graph
+ # from a go_binary's non-Go dependency to a go_library that does not
+ # pass through another go_binary (e.g., through a custom rule
+ # replacement for go_binary), this transition could be applied again
+ # and cause incorrect Go setting values.
+ new_settings[original_key] = ""
+
+ return new_settings
+
+non_go_transition = transition(
+ implementation = _non_go_transition_impl,
+ inputs = TRANSITIONED_GO_SETTING_KEYS + _SETTING_KEY_TO_ORIGINAL_SETTING_KEY.values(),
+ outputs = TRANSITIONED_GO_SETTING_KEYS + _SETTING_KEY_TO_ORIGINAL_SETTING_KEY.values(),
+)
+
+def _check_ternary(name, value):
+ if value not in ("on", "off", "auto"):
+ fail('{}: must be "on", "off", or "auto"'.format(name))
+
+def _set_ternary(settings, attr, name):
+ value = getattr(attr, name, "auto")
+ _check_ternary(name, value)
+ if value != "auto":
+ label = "//go/config:{}".format(name)
+ settings[label] = value == "on"
+ return value
+
+_SDK_VERSION_BUILD_SETTING = "//go/toolchain:sdk_version"
+TRANSITIONED_GO_CROSS_SETTING_KEYS = [
+ _SDK_VERSION_BUILD_SETTING,
+ "//command_line_option:platforms",
+]
+
+def _go_cross_transition_impl(settings, attr):
+ settings = dict(settings)
+ if attr.sdk_version != None:
+ settings[_SDK_VERSION_BUILD_SETTING] = attr.sdk_version
+
+ if attr.platform != None:
+ settings["//command_line_option:platforms"] = str(attr.platform)
+
+ return settings
+
+go_cross_transition = transition(
+ implementation = _go_cross_transition_impl,
+ inputs = TRANSITIONED_GO_CROSS_SETTING_KEYS,
+ outputs = TRANSITIONED_GO_CROSS_SETTING_KEYS,
+)
+
+# A list of Go build tags that potentially affect the build of the standard
+# library.
+#
+# This should be updated to contain the union of all tags relevant for all
+# versions of Go that are still relevant.
+#
+# Currently supported versions: 1.18, 1.19, 1.20
+#
+# To regenerate, run and paste the output of
+# bazel run //go/tools/internal/stdlib_tags:stdlib_tags -- path/to/go_sdk_1/src ...
+_TAG_AFFECTS_STDLIB = {
+ "alpha": None,
+ "appengine": None,
+ "asan": None,
+ "boringcrypto": None,
+ "cmd_go_bootstrap": None,
+ "compiler_bootstrap": None,
+ "debuglog": None,
+ "faketime": None,
+ "gc": None,
+ "gccgo": None,
+ "gen": None,
+ "generate": None,
+ "gofuzz": None,
+ "ignore": None,
+ "libfuzzer": None,
+ "m68k": None,
+ "math_big_pure_go": None,
+ "msan": None,
+ "netcgo": None,
+ "netgo": None,
+ "nethttpomithttp2": None,
+ "nios2": None,
+ "noopt": None,
+ "osusergo": None,
+ "purego": None,
+ "race": None,
+ "sh": None,
+ "shbe": None,
+ "tablegen": None,
+ "testgo": None,
+ "timetzdata": None,
+}
diff --git a/go/private/rules/wrappers.bzl b/go/private/rules/wrappers.bzl
new file mode 100644
index 00000000..85fc848d
--- /dev/null
+++ b/go/private/rules/wrappers.bzl
@@ -0,0 +1,81 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:mode.bzl",
+ "LINKMODES_EXECUTABLE",
+ "LINKMODE_C_ARCHIVE",
+ "LINKMODE_C_SHARED",
+ "LINKMODE_NORMAL",
+)
+load(
+ "//go/private/rules:library.bzl",
+ "go_library",
+)
+load(
+ "//go/private/rules:binary.bzl",
+ "go_binary",
+ "go_non_executable_binary",
+)
+load(
+ "//go/private/rules:test.bzl",
+ "go_test",
+)
+
+_SELECT_TYPE = type(select({"//conditions:default": ""}))
+
+def _cgo(name, kwargs):
+ if "objc" in kwargs:
+ fail("//{}:{}: the objc attribute has been removed. .m sources may be included in srcs or may be extracted into a separated objc_library listed in cdeps.".format(native.package_name(), name))
+
+def go_library_macro(name, **kwargs):
+ """See docs/go/core/rules.md#go_library for full documentation."""
+ _cgo(name, kwargs)
+ go_library(name = name, **kwargs)
+
+def go_binary_macro(name, **kwargs):
+ """See docs/go/core/rules.md#go_binary for full documentation."""
+ _cgo(name, kwargs)
+
+ if kwargs.get("goos") != None or kwargs.get("goarch") != None:
+ for key, value in kwargs.items():
+ if type(value) == _SELECT_TYPE:
+ # In the long term, we should replace goos/goarch with Bazel-native platform
+ # support, but while we have the mechanisms, we try to avoid people trying to use
+ # _both_ goos/goarch _and_ native platform support.
+ #
+ # It's unclear to users whether the select should happen before or after the
+ # goos/goarch is reconfigured, and we can't interpose code to force either
+ # behaviour, so we forbid this.
+ fail("Cannot use select for go_binary with goos/goarch set, but {} was a select".format(key))
+
+ if kwargs.get("linkmode", default = LINKMODE_NORMAL) in LINKMODES_EXECUTABLE:
+ go_binary(name = name, **kwargs)
+ else:
+ go_non_executable_binary(name = name, **kwargs)
+
+ if kwargs.get("linkmode") in (LINKMODE_C_ARCHIVE, LINKMODE_C_SHARED):
+ # Create an alias to tell users of the `.cc` rule that it is deprecated.
+ native.alias(
+ name = "{}.cc".format(name),
+ actual = name,
+ visibility = ["//visibility:public"],
+ tags = ["manual"],
+ deprecation = "This target is deprecated and will be removed in the near future. Please depend on ':{}' directly.".format(name),
+ )
+
+def go_test_macro(name, **kwargs):
+ """See docs/go/core/rules.md#go_test for full documentation."""
+ _cgo(name, kwargs)
+ go_test(name = name, **kwargs)
diff --git a/go/private/sdk.bzl b/go/private/sdk.bzl
new file mode 100644
index 00000000..a3fb6772
--- /dev/null
+++ b/go/private/sdk.bzl
@@ -0,0 +1,704 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:common.bzl",
+ "executable_path",
+)
+load(
+ "//go/private:nogo.bzl",
+ "go_register_nogo",
+)
+load(
+ "//go/private/skylib/lib:versions.bzl",
+ "versions",
+)
+
+MIN_SUPPORTED_VERSION = (1, 14, 0)
+
+def _go_host_sdk_impl(ctx):
+ goroot = _detect_host_sdk(ctx)
+ platform = _detect_sdk_platform(ctx, goroot)
+ version = _detect_sdk_version(ctx, goroot)
+ _sdk_build_file(ctx, platform, version, experiments = ctx.attr.experiments)
+ _local_sdk(ctx, goroot)
+
+go_host_sdk_rule = repository_rule(
+ implementation = _go_host_sdk_impl,
+ environ = ["GOROOT"],
+ attrs = {
+ "version": attr.string(),
+ "experiments": attr.string_list(
+ doc = "Go experiments to enable via GOEXPERIMENT",
+ ),
+ "_sdk_build_file": attr.label(
+ default = Label("//go/private:BUILD.sdk.bazel"),
+ ),
+ },
+)
+
+def go_host_sdk(name, register_toolchains = True, **kwargs):
+ go_host_sdk_rule(name = name, **kwargs)
+ _go_toolchains(
+ name = name + "_toolchains",
+ sdk_repo = name,
+ sdk_type = "host",
+ sdk_version = kwargs.get("version"),
+ goos = kwargs.get("goos"),
+ goarch = kwargs.get("goarch"),
+ )
+ if register_toolchains:
+ _register_toolchains(name)
+
+def _go_download_sdk_impl(ctx):
+ if not ctx.attr.goos and not ctx.attr.goarch:
+ goos, goarch = detect_host_platform(ctx)
+ else:
+ if not ctx.attr.goos:
+ fail("goarch set but goos not set")
+ if not ctx.attr.goarch:
+ fail("goos set but goarch not set")
+ goos, goarch = ctx.attr.goos, ctx.attr.goarch
+ platform = goos + "_" + goarch
+
+ version = ctx.attr.version
+ sdks = ctx.attr.sdks
+
+ if not sdks:
+ # If sdks was unspecified, download a full list of files.
+ # If version was unspecified, pick the latest version.
+ # Even if version was specified, we need to download the file list
+ # to find the SHA-256 sum. If we don't have it, Bazel won't cache
+ # the downloaded archive.
+ if not version:
+ ctx.report_progress("Finding latest Go version")
+ else:
+ ctx.report_progress("Finding Go SHA-256 sums")
+ ctx.download(
+ url = [
+ "https://go.dev/dl/?mode=json&include=all",
+ "https://golang.google.cn/dl/?mode=json&include=all",
+ ],
+ output = "versions.json",
+ )
+
+ data = ctx.read("versions.json")
+ sdks_by_version = _parse_versions_json(data)
+
+ if not version:
+ highest_version = None
+ for v in sdks_by_version.keys():
+ pv = parse_version(v)
+ if not pv or _version_is_prerelease(pv):
+ # skip parse errors and pre-release versions
+ continue
+ if not highest_version or _version_less(highest_version, pv):
+ highest_version = pv
+ if not highest_version:
+ fail("did not find any Go versions in https://go.dev/dl/?mode=json")
+ version = _version_string(highest_version)
+ if version not in sdks_by_version:
+ fail("did not find version {} in https://go.dev/dl/?mode=json".format(version))
+ sdks = sdks_by_version[version]
+
+ if platform not in sdks:
+ fail("unsupported platform {}".format(platform))
+ filename, sha256 = sdks[platform]
+ _remote_sdk(ctx, [url.format(filename) for url in ctx.attr.urls], ctx.attr.strip_prefix, sha256)
+
+ detected_version = _detect_sdk_version(ctx, ".")
+ _sdk_build_file(ctx, platform, detected_version, experiments = ctx.attr.experiments)
+
+ if not ctx.attr.sdks and not ctx.attr.version:
+ # Returning this makes Bazel print a message that 'version' must be
+ # specified for a reproducible build.
+ return {
+ "name": ctx.attr.name,
+ "goos": ctx.attr.goos,
+ "goarch": ctx.attr.goarch,
+ "sdks": ctx.attr.sdks,
+ "urls": ctx.attr.urls,
+ "version": version,
+ "strip_prefix": ctx.attr.strip_prefix,
+ }
+ return None
+
+go_download_sdk_rule = repository_rule(
+ implementation = _go_download_sdk_impl,
+ attrs = {
+ "goos": attr.string(),
+ "goarch": attr.string(),
+ "sdks": attr.string_list_dict(),
+ "experiments": attr.string_list(
+ doc = "Go experiments to enable via GOEXPERIMENT",
+ ),
+ "urls": attr.string_list(default = ["https://dl.google.com/go/{}"]),
+ "version": attr.string(),
+ "strip_prefix": attr.string(default = "go"),
+ "_sdk_build_file": attr.label(
+ default = Label("//go/private:BUILD.sdk.bazel"),
+ ),
+ },
+)
+
+def _define_version_constants(version, prefix = ""):
+ pv = parse_version(version)
+ if pv == None or len(pv) < 3:
+ fail("error parsing sdk version: " + version)
+ major, minor, patch = pv[0], pv[1], pv[2]
+ prerelease = pv[3] if len(pv) > 3 else ""
+ return """
+{prefix}MAJOR_VERSION = "{major}"
+{prefix}MINOR_VERSION = "{minor}"
+{prefix}PATCH_VERSION = "{patch}"
+{prefix}PRERELEASE_SUFFIX = "{prerelease}"
+""".format(
+ prefix = prefix,
+ major = major,
+ minor = minor,
+ patch = patch,
+ prerelease = prerelease,
+ )
+
+def _to_constant_name(s):
+ # Prefix with _ as identifiers are not allowed to start with numbers.
+ return "_" + "".join([c if c.isalnum() else "_" for c in s.elems()]).upper()
+
+def go_toolchains_single_definition(ctx, *, prefix, goos, goarch, sdk_repo, sdk_type, sdk_version):
+ if not goos and not goarch:
+ goos, goarch = detect_host_platform(ctx)
+ else:
+ if not goos:
+ fail("goarch set but goos not set")
+ if not goarch:
+ fail("goos set but goarch not set")
+
+ chunks = []
+ loads = []
+ identifier_prefix = _to_constant_name(prefix)
+
+ # If a sdk_version attribute is provided, use that version. This avoids
+ # eagerly fetching the SDK repository. But if it's not provided, we have
+ # no choice and must load version constants from the version.bzl file that
+ # _sdk_build_file creates. This will trigger an eager fetch.
+ if sdk_version:
+ chunks.append(_define_version_constants(sdk_version, prefix = identifier_prefix))
+ else:
+ loads.append("""load(
+ "@{sdk_repo}//:version.bzl",
+ {identifier_prefix}MAJOR_VERSION = "MAJOR_VERSION",
+ {identifier_prefix}MINOR_VERSION = "MINOR_VERSION",
+ {identifier_prefix}PATCH_VERSION = "PATCH_VERSION",
+ {identifier_prefix}PRERELEASE_SUFFIX = "PRERELEASE_SUFFIX",
+)
+""".format(
+ sdk_repo = sdk_repo,
+ identifier_prefix = identifier_prefix,
+ ))
+
+ chunks.append("""declare_bazel_toolchains(
+ prefix = "{prefix}",
+ go_toolchain_repo = "@{sdk_repo}",
+ host_goarch = "{goarch}",
+ host_goos = "{goos}",
+ major = {identifier_prefix}MAJOR_VERSION,
+ minor = {identifier_prefix}MINOR_VERSION,
+ patch = {identifier_prefix}PATCH_VERSION,
+ prerelease = {identifier_prefix}PRERELEASE_SUFFIX,
+ sdk_type = "{sdk_type}",
+)
+""".format(
+ prefix = prefix,
+ identifier_prefix = identifier_prefix,
+ sdk_repo = sdk_repo,
+ goarch = goarch,
+ goos = goos,
+ sdk_type = sdk_type,
+ ))
+
+ return struct(
+ loads = loads,
+ chunks = chunks,
+ )
+
+def go_toolchains_build_file_content(
+ ctx,
+ prefixes,
+ geese,
+ goarchs,
+ sdk_repos,
+ sdk_types,
+ sdk_versions):
+ if not _have_same_length(prefixes, geese, goarchs, sdk_repos, sdk_types, sdk_versions):
+ fail("all lists must have the same length")
+
+ loads = [
+ """load("@io_bazel_rules_go//go/private:go_toolchain.bzl", "declare_bazel_toolchains")""",
+ ]
+ chunks = [
+ """package(default_visibility = ["//visibility:public"])""",
+ ]
+
+ for i in range(len(geese)):
+ definition = go_toolchains_single_definition(
+ ctx,
+ prefix = prefixes[i],
+ goos = geese[i],
+ goarch = goarchs[i],
+ sdk_repo = sdk_repos[i],
+ sdk_type = sdk_types[i],
+ sdk_version = sdk_versions[i],
+ )
+ loads.extend(definition.loads)
+ chunks.extend(definition.chunks)
+
+ return "\n".join(loads + chunks)
+
+def _go_multiple_toolchains_impl(ctx):
+ ctx.file(
+ "BUILD.bazel",
+ go_toolchains_build_file_content(
+ ctx,
+ prefixes = ctx.attr.prefixes,
+ geese = ctx.attr.geese,
+ goarchs = ctx.attr.goarchs,
+ sdk_repos = ctx.attr.sdk_repos,
+ sdk_types = ctx.attr.sdk_types,
+ sdk_versions = ctx.attr.sdk_versions,
+ ),
+ executable = False,
+ )
+
+go_multiple_toolchains = repository_rule(
+ implementation = _go_multiple_toolchains_impl,
+ attrs = {
+ "prefixes": attr.string_list(mandatory = True),
+ "sdk_repos": attr.string_list(mandatory = True),
+ "sdk_types": attr.string_list(mandatory = True),
+ "sdk_versions": attr.string_list(mandatory = True),
+ "geese": attr.string_list(mandatory = True),
+ "goarchs": attr.string_list(mandatory = True),
+ },
+)
+
+def _go_toolchains(name, sdk_repo, sdk_type, sdk_version = None, goos = None, goarch = None):
+ go_multiple_toolchains(
+ name = name,
+ prefixes = [""],
+ geese = [goos or ""],
+ goarchs = [goarch or ""],
+ sdk_repos = [sdk_repo],
+ sdk_types = [sdk_type],
+ sdk_versions = [sdk_version or ""],
+ )
+
+def go_download_sdk(name, register_toolchains = True, **kwargs):
+ go_download_sdk_rule(name = name, **kwargs)
+ _go_toolchains(
+ name = name + "_toolchains",
+ sdk_repo = name,
+ sdk_type = "remote",
+ sdk_version = kwargs.get("version"),
+ goos = kwargs.get("goos"),
+ goarch = kwargs.get("goarch"),
+ )
+ if register_toolchains:
+ _register_toolchains(name)
+
+def _go_local_sdk_impl(ctx):
+ goroot = ctx.attr.path
+ platform = _detect_sdk_platform(ctx, goroot)
+ version = _detect_sdk_version(ctx, goroot)
+ _sdk_build_file(ctx, platform, version, ctx.attr.experiments)
+ _local_sdk(ctx, goroot)
+
+_go_local_sdk = repository_rule(
+ implementation = _go_local_sdk_impl,
+ attrs = {
+ "path": attr.string(),
+ "version": attr.string(),
+ "experiments": attr.string_list(
+ doc = "Go experiments to enable via GOEXPERIMENT",
+ ),
+ "_sdk_build_file": attr.label(
+ default = Label("//go/private:BUILD.sdk.bazel"),
+ ),
+ },
+)
+
+def go_local_sdk(name, register_toolchains = True, **kwargs):
+ _go_local_sdk(name = name, **kwargs)
+ _go_toolchains(
+ name = name + "_toolchains",
+ sdk_repo = name,
+ sdk_type = "remote",
+ sdk_version = kwargs.get("version"),
+ goos = kwargs.get("goos"),
+ goarch = kwargs.get("goarch"),
+ )
+ if register_toolchains:
+ _register_toolchains(name)
+
+def _go_wrap_sdk_impl(ctx):
+ if not ctx.attr.root_file and not ctx.attr.root_files:
+ fail("either root_file or root_files must be provided")
+ if ctx.attr.root_file and ctx.attr.root_files:
+ fail("root_file and root_files cannot be both provided")
+ if ctx.attr.root_file:
+ root_file = ctx.attr.root_file
+ else:
+ goos, goarch = detect_host_platform(ctx)
+ platform = goos + "_" + goarch
+ if platform not in ctx.attr.root_files:
+ fail("unsupported platform {}".format(platform))
+ root_file = Label(ctx.attr.root_files[platform])
+ goroot = str(ctx.path(root_file).dirname)
+ platform = _detect_sdk_platform(ctx, goroot)
+ version = _detect_sdk_version(ctx, goroot)
+ _sdk_build_file(ctx, platform, version, ctx.attr.experiments)
+ _local_sdk(ctx, goroot)
+
+_go_wrap_sdk = repository_rule(
+ implementation = _go_wrap_sdk_impl,
+ attrs = {
+ "root_file": attr.label(
+ mandatory = False,
+ doc = "A file in the SDK root direcotry. Used to determine GOROOT.",
+ ),
+ "root_files": attr.string_dict(
+ mandatory = False,
+ doc = "A set of mappings from the host platform to a file in the SDK's root directory",
+ ),
+ "version": attr.string(),
+ "experiments": attr.string_list(
+ doc = "Go experiments to enable via GOEXPERIMENT",
+ ),
+ "_sdk_build_file": attr.label(
+ default = Label("//go/private:BUILD.sdk.bazel"),
+ ),
+ },
+)
+
+def go_wrap_sdk(name, register_toolchains = True, **kwargs):
+ _go_wrap_sdk(name = name, **kwargs)
+ _go_toolchains(
+ name = name + "_toolchains",
+ sdk_repo = name,
+ sdk_type = "remote",
+ sdk_version = kwargs.get("version"),
+ goos = kwargs.get("goos"),
+ goarch = kwargs.get("goarch"),
+ )
+ if register_toolchains:
+ _register_toolchains(name)
+
+def _register_toolchains(repo):
+ native.register_toolchains("@{}_toolchains//:all".format(repo))
+
+def _remote_sdk(ctx, urls, strip_prefix, sha256):
+ if len(urls) == 0:
+ fail("no urls specified")
+ host_goos, _ = detect_host_platform(ctx)
+
+ ctx.report_progress("Downloading and extracting Go toolchain")
+
+ # TODO(#2771): After bazelbuild/bazel#18448 is merged and available in
+ # the minimum supported version of Bazel, remove the workarounds below.
+ #
+ # Go ships archives containing some non-ASCII file names, used in
+ # test cases for Go's build system. Bazel has a bug extracting these
+ # archives on certain file systems (macOS AFS at least, possibly also
+ # Docker on macOS with a bind mount).
+ #
+ # For .tar.gz files (available for most platforms), we work around this bug
+ # by using the system tar instead of ctx.download_and_extract.
+ #
+ # For .zip files, we use ctx.download_and_extract but with rename_files,
+ # changing certain paths that trigger the bug. This is only available
+ # in Bazel 6.0.0+ (bazelbuild/bazel#16052). The only situation where
+ # .zip files are needed seems to be a macOS host using a Windows toolchain
+ # for remote execution.
+ if urls[0].endswith(".tar.gz"):
+ if strip_prefix != "go":
+ fail("strip_prefix not supported")
+ ctx.download(
+ url = urls,
+ sha256 = sha256,
+ output = "go_sdk.tar.gz",
+ )
+ res = ctx.execute(["tar", "-xf", "go_sdk.tar.gz", "--strip-components=1"])
+ if res.return_code:
+ fail("error extracting Go SDK:\n" + res.stdout + res.stderr)
+ ctx.delete("go_sdk.tar.gz")
+ elif (urls[0].endswith(".zip") and
+ host_goos != "windows" and
+ # Development versions of Bazel have an empty version string. We assume that they are
+ # more recent than the version that introduced rename_files.
+ versions.is_at_least("6.0.0", versions.get() or "6.0.0")):
+ ctx.download_and_extract(
+ url = urls,
+ stripPrefix = strip_prefix,
+ sha256 = sha256,
+ rename_files = {
+ "go/test/fixedbugs/issue27836.dir/\336foo.go": "go/test/fixedbugs/issue27836.dir/thfoo.go",
+ "go/test/fixedbugs/issue27836.dir/\336main.go": "go/test/fixedbugs/issue27836.dir/thmain.go",
+ },
+ )
+ else:
+ ctx.download_and_extract(
+ url = urls,
+ stripPrefix = strip_prefix,
+ sha256 = sha256,
+ )
+
+def _local_sdk(ctx, path):
+ for entry in ["src", "pkg", "bin", "lib", "misc"]:
+ ctx.symlink(path + "/" + entry, entry)
+
+def _sdk_build_file(ctx, platform, version, experiments):
+ ctx.file("ROOT")
+ goos, _, goarch = platform.partition("_")
+
+ pv = parse_version(version)
+ if pv != None and pv[1] >= 20:
+ # Turn off coverageredesign GOEXPERIMENT on 1.20+
+ # until rules_go is updated to work with the
+ # coverage redesign.
+ if not "nocoverageredesign" in experiments and not "coverageredesign" in experiments:
+ experiments = experiments + ["nocoverageredesign"]
+
+ ctx.template(
+ "BUILD.bazel",
+ ctx.path(ctx.attr._sdk_build_file),
+ executable = False,
+ substitutions = {
+ "{goos}": goos,
+ "{goarch}": goarch,
+ "{exe}": ".exe" if goos == "windows" else "",
+ "{version}": version,
+ "{experiments}": repr(experiments),
+ },
+ )
+
+ ctx.file(
+ "version.bzl",
+ executable = False,
+ content = _define_version_constants(version),
+ )
+
+def detect_host_platform(ctx):
+ goos = ctx.os.name
+ if goos == "mac os x":
+ goos = "darwin"
+ elif goos.startswith("windows"):
+ goos = "windows"
+
+ goarch = ctx.os.arch
+ if goarch == "aarch64":
+ goarch = "arm64"
+ elif goarch == "x86_64":
+ goarch = "amd64"
+
+ return goos, goarch
+
+def _detect_host_sdk(ctx):
+ root = "@invalid@"
+ if "GOROOT" in ctx.os.environ:
+ return ctx.os.environ["GOROOT"]
+ res = ctx.execute([executable_path(ctx, "go"), "env", "GOROOT"])
+ if res.return_code:
+ fail("Could not detect host go version")
+ root = res.stdout.strip()
+ if not root:
+ fail("host go version failed to report it's GOROOT")
+ return root
+
+def _detect_sdk_platform(ctx, goroot):
+ path = ctx.path(goroot + "/pkg/tool")
+ if not path.exists:
+ fail("Could not detect SDK platform: failed to find " + str(path))
+ tool_entries = path.readdir()
+
+ platforms = []
+ for f in tool_entries:
+ if f.basename.find("_") >= 0:
+ platforms.append(f.basename)
+
+ if len(platforms) == 0:
+ fail("Could not detect SDK platform: found no platforms in %s" % path)
+ if len(platforms) > 1:
+ fail("Could not detect SDK platform: found multiple platforms %s in %s" % (platforms, path))
+ return platforms[0]
+
+def _detect_sdk_version(ctx, goroot):
+ version_file_path = goroot + "/VERSION"
+ if ctx.path(version_file_path).exists:
+ # VERSION file has version prefixed by go, eg. go1.18.3
+ version = ctx.read(version_file_path)[2:]
+ if ctx.attr.version and ctx.attr.version != version:
+ fail("SDK is version %s, but version %s was expected" % (version, ctx.attr.version))
+ return version
+
+ # The top-level VERSION file does not exist in all Go SDK distributions, e.g. those shipped by Debian or Fedora.
+ # Falling back to running "go version"
+ go_binary_path = goroot + "/bin/go"
+ result = ctx.execute([go_binary_path, "version"])
+ if result.return_code != 0:
+ fail("Could not detect SDK version: '%s version' exited with exit code %d" % (go_binary_path, result.return_code))
+
+ # go version output is of the form "go version go1.18.3 linux/amd64" or "go
+ # version devel go1.19-fd1b5904ae Tue Mar 22 21:38:10 2022 +0000
+ # linux/amd64". See the following links for how this output is generated:
+ # - https://github.com/golang/go/blob/2bdb5c57f1efcbddab536028d053798e35de6226/src/cmd/go/internal/version/version.go#L75
+ # - https://github.com/golang/go/blob/2bdb5c57f1efcbddab536028d053798e35de6226/src/cmd/dist/build.go#L333
+ #
+ # Read the third word, or the fourth word if the third word is "devel", to
+ # find the version number.
+ output_parts = result.stdout.split(" ")
+ if len(output_parts) > 2 and output_parts[2].startswith("go"):
+ version = output_parts[2][len("go"):]
+ elif len(output_parts) > 3 and output_parts[2] == "devel" and output_parts[3].startswith("go"):
+ version = output_parts[3][len("go"):]
+ else:
+ fail("Could not parse SDK version from '%s version' output: %s" % (go_binary_path, result.stdout))
+ if parse_version(version) == None:
+ fail("Could not parse SDK version from '%s version' output: %s" % (go_binary_path, result.stdout))
+ if ctx.attr.version and ctx.attr.version != version:
+ fail("SDK is version %s, but version %s was expected" % (version, ctx.attr.version))
+ return version
+
+def _parse_versions_json(data):
+ """Parses version metadata returned by go.dev.
+
+ Args:
+ data: the contents of the file downloaded from
+ https://go.dev/dl/?mode=json. We assume the file is valid
+ JSON, is spaced and indented, and is in a particular format.
+
+ Return:
+ A dict mapping version strings (like "1.15.5") to dicts mapping
+ platform names (like "linux_amd64") to pairs of filenames
+ (like "go1.15.5.linux-amd64.tar.gz") and hex-encoded SHA-256 sums.
+ """
+ sdks = json.decode(data)
+ return {
+ sdk["version"][len("go"):]: {
+ "%s_%s" % (file["os"], file["arch"]): (
+ file["filename"],
+ file["sha256"],
+ )
+ for file in sdk["files"]
+ if file["kind"] == "archive"
+ }
+ for sdk in sdks
+ }
+
+def parse_version(version):
+ """Parses a version string like "1.15.5" and returns a tuple of numbers or None"""
+ l, r = 0, 0
+ parsed = []
+ for c in version.elems():
+ if c == ".":
+ if l == r:
+ # empty component
+ return None
+ parsed.append(int(version[l:r]))
+ r += 1
+ l = r
+ continue
+
+ if c.isdigit():
+ r += 1
+ continue
+
+ # pre-release suffix
+ break
+
+ if l == r:
+ # empty component
+ return None
+ parsed.append(int(version[l:r]))
+ if len(parsed) == 2:
+ # first minor version, like (1, 15)
+ parsed.append(0)
+ if len(parsed) != 3:
+ # too many or too few components
+ return None
+ if r < len(version):
+ # pre-release suffix
+ parsed.append(version[r:])
+ return tuple(parsed)
+
+def _version_is_prerelease(v):
+ return len(v) > 3
+
+def _version_less(a, b):
+ if a[:3] < b[:3]:
+ return True
+ if a[:3] > b[:3]:
+ return False
+ if len(a) > len(b):
+ return True
+ if len(a) < len(b) or len(a) == 3:
+ return False
+ return a[3:] < b[3:]
+
+def _version_string(v):
+ suffix = v[3] if _version_is_prerelease(v) else ""
+ if v[-1] == 0:
+ v = v[:-1]
+ return ".".join([str(n) for n in v]) + suffix
+
+def _have_same_length(*lists):
+ if not lists:
+ fail("expected at least one list")
+ return len({len(l): None for l in lists}) == 1
+
+def go_register_toolchains(version = None, nogo = None, go_version = None, experiments = None):
+ """See /go/toolchains.rst#go-register-toolchains for full documentation."""
+ if not version:
+ version = go_version # old name
+
+ sdk_kinds = ("go_download_sdk_rule", "go_host_sdk_rule", "_go_local_sdk", "_go_wrap_sdk")
+ existing_rules = native.existing_rules()
+ sdk_rules = [r for r in existing_rules.values() if r["kind"] in sdk_kinds]
+ if len(sdk_rules) == 0 and "go_sdk" in existing_rules:
+ # may be local_repository in bazel_tests.
+ sdk_rules.append(existing_rules["go_sdk"])
+
+ if version and len(sdk_rules) > 0:
+ fail("go_register_toolchains: version set after go sdk rule declared ({})".format(", ".join([r["name"] for r in sdk_rules])))
+ if len(sdk_rules) == 0:
+ if not version:
+ fail('go_register_toolchains: version must be a string like "1.15.5" or "host"')
+ elif version == "host":
+ go_host_sdk(name = "go_sdk", experiments = experiments)
+ else:
+ pv = parse_version(version)
+ if not pv:
+ fail('go_register_toolchains: version must be a string like "1.15.5" or "host"')
+ if _version_less(pv, MIN_SUPPORTED_VERSION):
+ print("DEPRECATED: Go versions before {} are not supported and may not work".format(_version_string(MIN_SUPPORTED_VERSION)))
+ go_download_sdk(
+ name = "go_sdk",
+ version = version,
+ experiments = experiments,
+ )
+
+ if nogo:
+ # Override default definition in go_rules_dependencies().
+ go_register_nogo(
+ name = "io_bazel_rules_nogo",
+ nogo = nogo,
+ )
diff --git a/go/private/skylib/README.rst b/go/private/skylib/README.rst
new file mode 100644
index 00000000..2b47c8d0
--- /dev/null
+++ b/go/private/skylib/README.rst
@@ -0,0 +1,7 @@
+This directory is a partial copy of github.com/bazelbuild/bazel-skylib/lib.
+Version 0.5.0, retrieved on 2018-11-26.
+Only versions.bzl is included.
+
+versions.bzl is needed by repository rules imported from //go:deps.bzl.
+Uses of Skylib outside of files loaded by //go:deps.bzl should use
+the external Skylib repository, @bazel_skylib.
diff --git a/go/private/skylib/lib/BUILD.bazel b/go/private/skylib/lib/BUILD.bazel
new file mode 100644
index 00000000..c7cd85c7
--- /dev/null
+++ b/go/private/skylib/lib/BUILD.bazel
@@ -0,0 +1,20 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+
+filegroup(
+ name = "all_rules",
+ srcs = glob(["**/*.bzl"]),
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+bzl_library(
+ name = "versions",
+ srcs = ["versions.bzl"],
+ visibility = ["//go:__subpackages__"],
+)
diff --git a/go/private/skylib/lib/versions.bzl b/go/private/skylib/lib/versions.bzl
new file mode 100644
index 00000000..0298ef40
--- /dev/null
+++ b/go/private/skylib/lib/versions.bzl
@@ -0,0 +1,127 @@
+# Copyright 2018 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Skylib module containing functions for checking Bazel versions."""
+
+def _get_bazel_version():
+ """Returns the current Bazel version"""
+
+ return native.bazel_version
+
+def _extract_version_number(bazel_version):
+ """Extracts the semantic version number from a version string
+
+ Args:
+ bazel_version: the version string that begins with the semantic version
+ e.g. "1.2.3rc1 abc1234" where "abc1234" is a commit hash.
+
+ Returns:
+ The semantic version string, like "1.2.3".
+ """
+ for i in range(len(bazel_version)):
+ c = bazel_version[i]
+ if not (c.isdigit() or c == "."):
+ return bazel_version[:i]
+ return bazel_version
+
+# Parse the bazel version string from `native.bazel_version`.
+# e.g.
+# "0.10.0rc1 abc123d" => (0, 10, 0)
+# "0.3.0" => (0, 3, 0)
+def _parse_bazel_version(bazel_version):
+ """Parses a version string into a 3-tuple of ints
+
+ int tuples can be compared directly using binary operators (<, >).
+
+ Args:
+ bazel_version: the Bazel version string
+
+ Returns:
+ An int 3-tuple of a (major, minor, patch) version.
+ """
+
+ version = _extract_version_number(bazel_version)
+ return tuple([int(n) for n in version.split(".")])
+
+def _is_at_most(threshold, version):
+ """Check that a version is lower or equals to a threshold.
+
+ Args:
+ threshold: the maximum version string
+ version: the version string to be compared to the threshold
+
+ Returns:
+ True if version <= threshold.
+ """
+ return _parse_bazel_version(version) <= _parse_bazel_version(threshold)
+
+def _is_at_least(threshold, version):
+ """Check that a version is higher or equals to a threshold.
+
+ Args:
+ threshold: the minimum version string
+ version: the version string to be compared to the threshold
+
+ Returns:
+ True if version >= threshold.
+ """
+
+ return _parse_bazel_version(version) >= _parse_bazel_version(threshold)
+
+def _check_bazel_version(minimum_bazel_version, maximum_bazel_version = None, bazel_version = None):
+ """Check that the version of Bazel is valid within the specified range.
+
+ Args:
+ minimum_bazel_version: minimum version of Bazel expected
+ maximum_bazel_version: maximum version of Bazel expected
+ bazel_version: the version of Bazel to check. Used for testing, defaults to native.bazel_version
+ """
+ if not bazel_version:
+ if "bazel_version" not in dir(native):
+ fail("\nCurrent Bazel version is lower than 0.2.1, expected at least %s\n" % minimum_bazel_version)
+ elif not native.bazel_version:
+ print("\nCurrent Bazel is not a release version, cannot check for compatibility.")
+ print("Make sure that you are running at least Bazel %s.\n" % minimum_bazel_version)
+ return
+ else:
+ bazel_version = native.bazel_version
+
+ if not _is_at_least(
+ threshold = minimum_bazel_version,
+ version = bazel_version,
+ ):
+ fail("\nCurrent Bazel version is {}, expected at least {}\n".format(
+ bazel_version,
+ minimum_bazel_version,
+ ))
+
+ if maximum_bazel_version:
+ if not _is_at_most(
+ threshold = maximum_bazel_version,
+ version = bazel_version,
+ ):
+ fail("\nCurrent Bazel version is {}, expected at most {}\n".format(
+ bazel_version,
+ maximum_bazel_version,
+ ))
+
+ pass
+
+versions = struct(
+ get = _get_bazel_version,
+ parse = _parse_bazel_version,
+ check = _check_bazel_version,
+ is_at_most = _is_at_most,
+ is_at_least = _is_at_least,
+)
diff --git a/go/private/tools/BUILD.bazel b/go/private/tools/BUILD.bazel
new file mode 100644
index 00000000..1852c9c8
--- /dev/null
+++ b/go/private/tools/BUILD.bazel
@@ -0,0 +1,27 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+
+filegroup(
+ name = "all_rules",
+ srcs = glob(["**/*.bzl"]),
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+bzl_library(
+ name = "path",
+ srcs = ["path.bzl"],
+ visibility = [
+ "//docs:__subpackages__",
+ "//go:__subpackages__",
+ ],
+ deps = [
+ "//go/private:common",
+ "//go/private:providers",
+ ],
+)
diff --git a/go/private/tools/files_equal_test.bzl b/go/private/tools/files_equal_test.bzl
new file mode 100644
index 00000000..90377bf3
--- /dev/null
+++ b/go/private/tools/files_equal_test.bzl
@@ -0,0 +1,122 @@
+# Copyright 2016 The Bazel Go Rules Authors. All rights reserved.
+# Copyright 2016 The Closure Rules Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Tests that two files contain the same data."""
+
+def files_equal_test(name, golden, actual, error_message = None, **kwargs):
+ # This genrule creates a Bash script: the source of the actual test.
+ # The script:
+ # 1. Initializes the Bash runfiles library (see
+ # @bazel_tools//tools/bash/runfiles/runfiles.bash).
+ # 2. Stores command line arguments into variables.
+ # 3. Computes runfile paths for the GOLDEN and ACTUAL files.
+ # 4. Calls "rlocation" from runfiles.bash to locates the runfiles.
+ # 5. Computes and compares checksums.
+ native.genrule(
+ name = name + "_src",
+ outs = [name + "-src.sh"],
+ executable = True,
+ visibility = ["//visibility:private"],
+ cmd = r"""cat >$@ <<'eof'
+#!/usr/bin/env bash
+# sh_test() source, generated by @io_bazel_rules_go//go/private/tools/files_equal_test.bzl
+
+### 1. initialize the Bash runfiles library
+
+# --- begin runfiles.bash initialization ---
+# Copy-pasted from Bazel's Bash runfiles library (tools/bash/runfiles/runfiles.bash).
+set -euo pipefail
+if [[ ! -d "$${RUNFILES_DIR:-/dev/null}" && ! -f "$${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
+ if [[ -f "$$0.runfiles_manifest" ]]; then
+ export RUNFILES_MANIFEST_FILE="$$0.runfiles_manifest"
+ elif [[ -f "$$0.runfiles/MANIFEST" ]]; then
+ export RUNFILES_MANIFEST_FILE="$$0.runfiles/MANIFEST"
+ elif [[ -f "$$0.runfiles/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then
+ export RUNFILES_DIR="$$0.runfiles"
+ fi
+fi
+if [[ -f "$${RUNFILES_DIR:-/dev/null}/bazel_tools/tools/bash/runfiles/runfiles.bash" ]]; then
+ source "$${RUNFILES_DIR}/bazel_tools/tools/bash/runfiles/runfiles.bash"
+elif [[ -f "$${RUNFILES_MANIFEST_FILE:-/dev/null}" ]]; then
+ source "$$(grep -m1 "^bazel_tools/tools/bash/runfiles/runfiles.bash " \
+ "$$RUNFILES_MANIFEST_FILE" | cut -d ' ' -f 2-)"
+else
+ echo >&2 "ERROR: cannot find @bazel_tools//tools/bash/runfiles:runfiles.bash"
+ exit 1
+fi
+# --- end runfiles.bash initialization ---
+
+### 2. Store command line arguments into variables.
+
+declare -r GOLDEN="$${1}"
+declare -r ACTUAL="$${2}"
+declare -r ERROR_MSG="$${3:-FILES DO NOT HAVE EQUAL CONTENTS}"
+
+### 3. Compute runfile paths.
+
+# Strip "external/" prefix OR prepend workspace name and strip "./" prefix.
+[[ "$$GOLDEN" =~ external/* ]] && F1="$${GOLDEN#external/}" || F1="$$TEST_WORKSPACE/$${GOLDEN#./}"
+[[ "$$ACTUAL" =~ external/* ]] && F2="$${ACTUAL#external/}" || F2="$$TEST_WORKSPACE/$${ACTUAL#./}"
+
+### 4. Locate the runfiles.
+
+F1="$$(rlocation "$$F1")"
+F2="$$(rlocation "$$F2")"
+
+if [[ "$$F1" == "$$F2" ]]; then
+ echo >&2 "GOLDEN and ACTUAL should be different files"
+ exit 1
+fi
+
+### 5. Compute and compare checksums.
+
+function checksum() {
+ if command -v openssl >/dev/null; then
+ openssl sha1 $$1 | cut -f 2 -d ' '
+ elif command -v sha256sum >/dev/null; then
+ sha256sum $$1 | cut -f 1 -d ' '
+ elif command -v shasum >/dev/null; then
+ cat $$1 | shasum -a 256 | cut -f 1 -d ' '
+ else
+ echo please install openssl >&2
+ exit 1
+ fi
+}
+SUM1=$$(checksum "$$F1")
+SUM2=$$(checksum "$$F2")
+if [[ $${SUM1} != $${SUM2} ]]; then
+ echo "ERROR: $$ERROR_MSG" >&2
+ echo "$$GOLDEN $${SUM1}" >&2
+ echo "$$ACTUAL $${SUM2}" >&2
+ exit 1
+fi
+eof""",
+ )
+
+ native.sh_test(
+ name = name,
+ srcs = [name + "-src.sh"],
+ data = [
+ "@bazel_tools//tools/bash/runfiles",
+ actual,
+ golden,
+ ],
+ args = [
+ "$(location %s)" % golden,
+ "$(location %s)" % actual,
+ error_message,
+ ],
+ **kwargs
+ )
diff --git a/go/private/tools/lines_sorted_test.bzl b/go/private/tools/lines_sorted_test.bzl
new file mode 100644
index 00000000..33861d3b
--- /dev/null
+++ b/go/private/tools/lines_sorted_test.bzl
@@ -0,0 +1,45 @@
+# Copyright 2016 The Bazel Go Rules Authors. All rights reserved.
+# Copyright 2016 The Closure Rules Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("//go/private/tools:files_equal_test.bzl", "files_equal_test")
+
+def lines_sorted_test(name, file, cmd = "cat $< >$@", visibility = None, **kwargs):
+ """Tests that lines within a file are sorted."""
+
+ native.genrule(
+ name = name + "_lines",
+ testonly = True,
+ srcs = [file],
+ outs = [name + "_lines.txt"],
+ cmd = cmd,
+ visibility = visibility,
+ )
+
+ native.genrule(
+ name = name + "_lines_sorted",
+ testonly = True,
+ srcs = [name + "_lines.txt"],
+ outs = [name + "_lines_sorted.txt"],
+ cmd = "sort $< >$@",
+ visibility = visibility,
+ )
+
+ files_equal_test(
+ name = name,
+ actual = name + "_lines.txt",
+ golden = name + "_lines_sorted.txt",
+ visibility = visibility,
+ **kwargs
+ )
diff --git a/go/private/tools/path.bzl b/go/private/tools/path.bzl
new file mode 100644
index 00000000..f23677a2
--- /dev/null
+++ b/go/private/tools/path.bzl
@@ -0,0 +1,278 @@
+# Copyright 2014 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:providers.bzl",
+ "GoArchive",
+ "GoPath",
+ "effective_importpath_pkgpath",
+ "get_archive",
+)
+load(
+ "//go/private:common.bzl",
+ "as_iterable",
+ "as_list",
+)
+load(
+ "@bazel_skylib//lib:paths.bzl",
+ "paths",
+)
+
+def _go_path_impl(ctx):
+ # Gather all archives. Note that there may be multiple packages with the same
+ # importpath (e.g., multiple vendored libraries, internal tests). The same
+ # package may also appear in different modes.
+ mode_to_deps = {}
+ for dep in ctx.attr.deps:
+ archive = get_archive(dep)
+ if archive.mode not in mode_to_deps:
+ mode_to_deps[archive.mode] = []
+ mode_to_deps[archive.mode].append(archive)
+ mode_to_archive = {}
+ for mode, archives in mode_to_deps.items():
+ direct = [a.data for a in archives]
+ transitive = []
+ if ctx.attr.include_transitive:
+ transitive = [a.transitive for a in archives]
+ mode_to_archive[mode] = depset(direct = direct, transitive = transitive)
+
+ # Collect sources and data files from archives. Merge archives into packages.
+ pkg_map = {} # map from package path to structs
+ for mode, archives in mode_to_archive.items():
+ for archive in as_iterable(archives):
+ importpath, pkgpath = effective_importpath_pkgpath(archive)
+ if importpath == "":
+ continue # synthetic archive or inferred location
+ pkg = struct(
+ importpath = importpath,
+ dir = "src/" + pkgpath,
+ srcs = as_list(archive.orig_srcs),
+ data = as_list(archive.data_files),
+ embedsrcs = as_list(archive._embedsrcs),
+ pkgs = {mode: archive.file},
+ )
+ if pkgpath in pkg_map:
+ _merge_pkg(pkg_map[pkgpath], pkg)
+ else:
+ pkg_map[pkgpath] = pkg
+
+ # Build a manifest file that includes all files to copy/link/zip.
+ inputs = []
+ manifest_entries = []
+ manifest_entry_map = {}
+ for pkg in pkg_map.values():
+ # src_dir is the path to the directory holding the source.
+ # Paths to embedded sources will be relative to this path.
+ src_dir = None
+
+ for f in pkg.srcs:
+ src_dir = f.dirname
+ dst = pkg.dir + "/" + f.basename
+ _add_manifest_entry(manifest_entries, manifest_entry_map, inputs, f, dst)
+ for f in pkg.embedsrcs:
+ if src_dir == None:
+ fail("cannot relativize {}: src_dir is unset".format(f.path))
+ embedpath = paths.relativize(f.path, f.root.path)
+ dst = pkg.dir + "/" + paths.relativize(embedpath.lstrip(ctx.bin_dir.path + "/"), src_dir.lstrip(ctx.bin_dir.path + "/"))
+ _add_manifest_entry(manifest_entries, manifest_entry_map, inputs, f, dst)
+ if ctx.attr.include_pkg:
+ for pkg in pkg_map.values():
+ for mode, f in pkg.pkgs.items():
+ # TODO(jayconrod): include other mode attributes, e.g., race.
+ installsuffix = mode.goos + "_" + mode.goarch
+ dst = "pkg/" + installsuffix + "/" + pkg.dir[len("src/"):] + ".a"
+ _add_manifest_entry(manifest_entries, manifest_entry_map, inputs, f, dst)
+ if ctx.attr.include_data:
+ for pkg in pkg_map.values():
+ for f in pkg.data:
+ parts = f.path.split("/")
+ if "testdata" in parts:
+ i = parts.index("testdata")
+ dst = pkg.dir + "/" + "/".join(parts[i:])
+ else:
+ dst = pkg.dir + "/" + f.basename
+ _add_manifest_entry(manifest_entries, manifest_entry_map, inputs, f, dst)
+ for f in ctx.files.data:
+ _add_manifest_entry(
+ manifest_entries,
+ manifest_entry_map,
+ inputs,
+ f,
+ f.basename,
+ )
+ manifest_file = ctx.actions.declare_file(ctx.label.name + "~manifest")
+ manifest_entries_json = [e.to_json() for e in manifest_entries]
+ manifest_content = "[\n " + ",\n ".join(manifest_entries_json) + "\n]"
+ ctx.actions.write(manifest_file, manifest_content)
+ inputs.append(manifest_file)
+
+ # Execute the builder
+ if ctx.attr.mode == "archive":
+ out = ctx.actions.declare_file(ctx.label.name + ".zip")
+ out_path = out.path
+ out_short_path = out.short_path
+ outputs = [out]
+ out_file = out
+ elif ctx.attr.mode == "copy":
+ out = ctx.actions.declare_directory(ctx.label.name)
+ out_path = out.path
+ out_short_path = out.short_path
+ outputs = [out]
+ out_file = out
+ else: # link
+ # Declare individual outputs in link mode. Symlinks can't point outside
+ # tree artifacts.
+ outputs = [
+ ctx.actions.declare_file(ctx.label.name + "/" + e.dst)
+ for e in manifest_entries
+ ]
+ tag = ctx.actions.declare_file(ctx.label.name + "/.tag")
+ ctx.actions.write(tag, "")
+ out_path = tag.dirname
+ out_short_path = tag.short_path.rpartition("/")[0]
+ out_file = tag
+ args = ctx.actions.args()
+ args.add("-manifest", manifest_file)
+ args.add("-out", out_path)
+ args.add("-mode", ctx.attr.mode)
+ ctx.actions.run(
+ outputs = outputs,
+ inputs = inputs,
+ mnemonic = "GoPath",
+ executable = ctx.executable._go_path,
+ arguments = [args],
+ )
+
+ return [
+ DefaultInfo(
+ files = depset(outputs),
+ runfiles = ctx.runfiles(files = outputs),
+ ),
+ GoPath(
+ gopath = out_short_path,
+ gopath_file = out_file,
+ packages = pkg_map.values(),
+ ),
+ ]
+
+go_path = rule(
+ _go_path_impl,
+ attrs = {
+ "deps": attr.label_list(
+ providers = [GoArchive],
+ doc = """A list of targets that build Go packages. A directory will be generated from
+ files in these targets and their transitive dependencies. All targets must
+ provide [GoArchive] ([go_library], [go_binary], [go_test], and similar
+ rules have this).
+
+ Only targets with explicit `importpath` attributes will be included in the
+ generated directory. Synthetic packages (like the main package produced by
+ [go_test]) and packages with inferred import paths will not be
+ included. The values of `importmap` attributes may influence the placement
+ of packages within the generated directory (for example, in vendor
+ directories).
+
+ The generated directory will contain original source files, including .go,
+ .s, .h, and .c files compiled by cgo. It will not contain files generated by
+ tools like cover and cgo, but it will contain generated files passed in
+ `srcs` attributes like .pb.go files. The generated directory will also
+ contain runfiles found in `data` attributes.
+ """,
+ ),
+ "data": attr.label_list(
+ allow_files = True,
+ doc = """
+ A list of targets producing data files that will be stored next to the
+ `src/` directory. Useful for including things like licenses and readmes.
+ """,
+ ),
+ "mode": attr.string(
+ default = "copy",
+ values = [
+ "archive",
+ "copy",
+ "link",
+ ],
+ doc = """
+ Determines how the generated directory is provided. May be one of:
+ <ul>
+ <li><code>"archive"</code>: The generated directory is packaged as a single .zip file.</li>
+ <li><code>"copy"</code>: The generated directory is a single tree artifact. Source files
+ are copied into the tree.</li>
+ <li><code>"link"</code>: <b>Unmaintained due to correctness issues</b>. Source files
+ are symlinked into the tree. All of the symlink files are provided as separate output
+ files.</li>
+ </ul>
+
+ ***Note:*** In <code>"copy"</code> mode, when a <code>GoPath</code> is consumed as a set of input
+ files or run files, Bazel may provide symbolic links instead of regular files.
+ Any program that consumes these files should dereference links, e.g., if you
+ run <code>tar</code>, use the <code>--dereference</code> flag.
+ """,
+ ),
+ "include_data": attr.bool(
+ default = True,
+ doc = """
+ When true, data files referenced by libraries, binaries, and tests will be
+ included in the output directory. Files listed in the `data` attribute
+ for this rule will be included regardless of this attribute.
+ """,
+ ),
+ "include_pkg": attr.bool(
+ default = False,
+ doc = """
+ When true, a `pkg` subdirectory containing the compiled libraries will be created in the
+ generated `GOPATH` containing compiled libraries.
+ """,
+ ),
+ "include_transitive": attr.bool(
+ default = True,
+ doc = """
+ When true, the transitive dependency graph will be included in the generated `GOPATH`. This is
+ the default behaviour. When false, only the direct dependencies will be included in the
+ generated `GOPATH`.
+ """,
+ ),
+ "_go_path": attr.label(
+ default = "//go/tools/builders:go_path",
+ executable = True,
+ cfg = "exec",
+ ),
+ },
+ doc = """`go_path` builds a directory structure that can be used with
+ tools that understand the GOPATH directory layout. This directory structure
+ can be built by zipping, copying, or linking files.
+ `go_path` can depend on one or more Go targets (i.e., [go_library], [go_binary], or [go_test]).
+ It will include packages from those targets, as well as their transitive dependencies.
+ Packages will be in subdirectories named after their `importpath` or `importmap` attributes under a `src/` directory.
+ """,
+)
+
+def _merge_pkg(x, y):
+ x_srcs = {f.path: None for f in x.srcs}
+ x_data = {f.path: None for f in x.data}
+ x_embedsrcs = {f.path: None for f in x.embedsrcs}
+ x.srcs.extend([f for f in y.srcs if f.path not in x_srcs])
+ x.data.extend([f for f in y.data if f.path not in x_data])
+ x.embedsrcs.extend([f for f in y.embedsrcs if f.path not in x_embedsrcs])
+ x.pkgs.update(y.pkgs)
+
+def _add_manifest_entry(entries, entry_map, inputs, src, dst):
+ if dst in entry_map:
+ if entry_map[dst] != src.path:
+ fail("{}: references multiple files ({} and {})".format(dst, entry_map[dst], src.path))
+ return
+ entries.append(struct(src = src.path, dst = dst))
+ entry_map[dst] = src.path
+ inputs.append(src)
diff --git a/go/private/tools/single_output_test.bzl b/go/private/tools/single_output_test.bzl
new file mode 100644
index 00000000..68847c4b
--- /dev/null
+++ b/go/private/tools/single_output_test.bzl
@@ -0,0 +1,56 @@
+# Copyright 2017 The Bazel Go Rules Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+def _impl(ctx):
+ exe = ctx.outputs.out
+ ctx.actions.write(
+ output = exe,
+ # The file must not be empty because running an empty .bat file as a
+ # subprocess fails on Windows, so we write one space to it.
+ content = " ",
+ is_executable = True,
+ )
+ return [DefaultInfo(files = depset([exe]), executable = exe)]
+
+_single_output_test = rule(
+ implementation = _impl,
+ attrs = {
+ "dep": attr.label(allow_single_file = True),
+ "out": attr.output(),
+ },
+ test = True,
+)
+
+def single_output_test(name, dep, **kwargs):
+ """Checks that a dependency produces a single output file.
+
+ This test works by setting `allow_single_file = True` on the `dep` attribute.
+ If `dep` provides zero or multiple files in its `files` provider, Bazel will
+ fail to build this rule during analysis. The actual test does nothing.
+
+ Args:
+ name: The name of the test rule.
+ dep: a label for the rule to check.
+ **kwargs: The <a href="https://docs.bazel.build/versions/master/be/common-definitions.html#common-attributes-tests">common attributes for tests</a>.
+ """
+
+ _single_output_test(
+ name = name,
+ dep = dep,
+ # On Windows we need the ".bat" extension.
+ # On other platforms the extension doesn't matter.
+ # Therefore we can use ".bat" on every platform.
+ out = name + ".bat",
+ **kwargs
+ )
diff --git a/go/providers.rst b/go/providers.rst
new file mode 100644
index 00000000..dccc0e1e
--- /dev/null
+++ b/go/providers.rst
@@ -0,0 +1,436 @@
+Go providers
+============
+
+.. _providers: https://docs.bazel.build/versions/master/skylark/rules.html#providers
+
+.. _go_library: /docs/go/core/rules.md#go_library
+.. _go_binary: /docs/go/core/rules.md#go_binary
+.. _go_test: /docs/go/core/rules.md#go_test
+.. _go_path: /docs/go/core/rules.md#go_path
+.. _cc_library: https://docs.bazel.build/versions/master/be/c-cpp.html#cc_library
+.. _flatbuffers: http://google.github.io/flatbuffers/
+.. _static linking: modes.rst#building-static-binaries
+.. _race detector: modes.rst#using-the-race-detector
+.. _runfiles: https://docs.bazel.build/versions/master/skylark/lib/runfiles.html
+.. _File: https://docs.bazel.build/versions/master/skylark/lib/File.html
+.. _new_library: toolchains.rst#new_library
+.. _library_to_source: toolchains.rst#library_to_source
+.. _archive: toolchains.rst#archive
+
+.. role:: param(kbd)
+.. role:: type(emphasis)
+.. role:: value(code)
+.. |mandatory| replace:: **mandatory value**
+
+
+The providers_ are the outputs of the rules. You generaly get them by having a
+dependency on a rule, and then asking for a provider of a specific type.
+
+.. contents:: :depth: 2
+
+-----
+
+Design
+------
+
+The Go providers are designed primarily for the efficiency of the Go rules. The
+information they share is mostly there because it is required for the core rules
+to work.
+
+All the providers are designed to hold only immutable data. This is partly
+because its a cleaner design choice to be able to assume a provider will never
+change, but also because only immutable objects are allowed to be stored in a
+depset, and it's really useful to have depsets of providers. Specifically the
+:param:`direct` and :param:`transitive` fields on GoLibrary_ only work because
+it is immutable.
+
+API
+---
+
+GoLibrary
+~~~~~~~~~
+
+``GoLibrary`` contains metadata about an individual library. It is provided
+by the `go_library`_ rule and other compatible rules. In general, you should
+build ``GoLibrary`` with the `new_library`_ helper method. ``GoLibrary`` is
+an input to the `library_to_source`_ helper method, which produces GoSource_.
+
++--------------------------------+-----------------------------------------------------------------+
+| **Name** | **Type** |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`name` | :type:`string` |
++--------------------------------+-----------------------------------------------------------------+
+| The name of the library. Usually, this is the ``name`` attribute. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`label` | :type:`Label` |
++--------------------------------+-----------------------------------------------------------------+
+| The full label for the library. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`importpath` | :type:`string` |
++--------------------------------+-----------------------------------------------------------------+
+| The string used in ``import`` declarations in Go source code to import |
+| this library. Usually, this is the ``importpath`` attribute. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`importmap` | :type:`string` |
++--------------------------------+-----------------------------------------------------------------+
+| The package path for this library. The Go compiler and linker internally refer |
+| to the library using this string. It must be unique in any binary the library |
+| is linked into. This is usually the same as ``importpath``, but it may be |
+| different, especially for vendored libraries. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`pathtype` | :type:`string` |
++--------------------------------+-----------------------------------------------------------------+
+| Information about the source of the importpath. Possible values are: |
+| |
+| :value:`explicit` |
+| The importpath was explicitly supplied by the user and the library is importable. |
+| This is the normal case. |
+| :value:`inferred` |
+| The importpath was inferred from the directory structure and rule name. The library may be |
+| importable. |
+| This is normally true for rules that do not expect to be compiled directly to a library, |
+| embeded into another rule instead (source generators) |
+| :value:`export` |
+| The importpath was explicitly supplied by the user, but the library is |
+| not importable. This is the case for binaries and tests. The importpath |
+| may still be useful for `go_path`_ and other rules. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`resolve` | :type:`function (optional)` |
++--------------------------------+-----------------------------------------------------------------+
+| A function called by `library_to_source`_ that can be used to resolve this |
+| library to a mode-specific GoSource_. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`is_main` | :type:`bool` |
++--------------------------------+-----------------------------------------------------------------+
+| Indicates whether the library should be compiled as a `main` package. |
+| `main` packages may have arbitrary `importpath` and `importmap` values, |
+| but the compiler and linker must see them as `main`. |
++--------------------------------+-----------------------------------------------------------------+
+
+GoSource
+~~~~~~~~
+
+GoSource represents a GoLibrary_ after mode-specific processing, ready to build
+a GoArchive_. This is produced by calling the `library_to_source`_ helper
+method. In general, only rules_go should need to build or handle these.
+
++--------------------------------+-----------------------------------------------------------------+
+| **Name** | **Type** |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`library` | :type:`GoLibrary` |
++--------------------------------+-----------------------------------------------------------------+
+| The go library that this GoSource was generated from. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`mode` | :type:`Mode` |
++--------------------------------+-----------------------------------------------------------------+
+| The mode this library is being built for. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`srcs` | :type:`list of File` |
++--------------------------------+-----------------------------------------------------------------+
+| The sources to compile into the archive. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`orig_srcs` | :type:`list of File` |
++--------------------------------+-----------------------------------------------------------------+
+| The original source files this library is based on. This may differ from |
+| :param:`srcs` if processing tools such as cgo or cover are applied. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`orig_src_map` | :type:`dict of File to File` |
++--------------------------------+-----------------------------------------------------------------+
+| Maps generated files in :param:`srcs` back to :param:`orig_srcs`. Not all |
+| generated files may appear in here. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`embedsrcs` | :type:`list of File` |
++--------------------------------+-----------------------------------------------------------------+
+| Files that may be embedded into the compiled package using ``//go:embed`` |
+| directives. All files must be in the same logical directory or a subdirectory |
+| as source files. However, it's okay to mix static and generated source files |
+| and static and generated embeddable files. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`cover` | :type:`list of File` |
++--------------------------------+-----------------------------------------------------------------+
+| List of source files to instrument for code coverage. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`x_defs` | :type:`string_dict` |
++--------------------------------+-----------------------------------------------------------------+
+| Map of defines to add to the go link command. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`deps` | :type:`list of Target` |
++--------------------------------+-----------------------------------------------------------------+
+| The direct dependencies needed by this library. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`gc_goopts` | :type:`list of string` |
++--------------------------------+-----------------------------------------------------------------+
+| Go compilation options that should be used when compiling these sources. |
+| In general these will be used for *all* sources of any library this provider is embedded into. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`runfiles` | :type:`Runfiles` |
++--------------------------------+-----------------------------------------------------------------+
+| The set of files needed by code in these sources at runtime. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`cgo` | :type:`bool` |
++--------------------------------+-----------------------------------------------------------------+
+| True if the library may contain cgo sources or C/C++/ObjC sources. |
+| If true and cgo is enabled, cgo sources will be processed with cgo, and |
+| C/C++/ObjC will be compiled with the appropriate toolchain and packed into |
+| the final archive. If true and cgo is disabled, cgo sources are filtered |
+| out, and sources with ``// +build !cgo`` are included. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`cdeps` | :type:`list of Target` |
++--------------------------------+-----------------------------------------------------------------+
+| List of ``cc_library`` and ``objc_library`` targets this library depends on. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`cppopts` | :type:`list of string` |
++--------------------------------+-----------------------------------------------------------------+
+| List of additional flags to pass to the C preprocessor when invoking the |
+| C/C++/ObjC compilers. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`copts` | :type:`list of string` |
++--------------------------------+-----------------------------------------------------------------+
+| List of additional flags to pass to the C compiler. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`cxxopts` | :type:`list of string` |
++--------------------------------+-----------------------------------------------------------------+
+| List of additional flags to pass to the C++ compiler. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`clinkopts` | :type:`list of string` |
++--------------------------------+-----------------------------------------------------------------+
+| List of additional flags to pass to the external linker. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`cgo_deps` | :type:`list of File` |
++--------------------------------+-----------------------------------------------------------------+
+| Deprecated; use ``cdeps`` instead. The direct cgo dependencies of this library. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`cgo_exports` | :type:`list of File` |
++--------------------------------+-----------------------------------------------------------------+
+| The exposed cc headers for these sources. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`cc_info` | :type:`CcInfo` |
++--------------------------------+-----------------------------------------------------------------+
+| The result of merging the ``CcInfo``s of all `deps` and `cdeps` |
++--------------------------------+-----------------------------------------------------------------+
+
+GoArchiveData
+~~~~~~~~~~~~~
+
+GoArchiveData contains information about a compiled Go package. GoArchiveData
+only contains immutable information about a package itself. It does not contain
+any information about dependencies or references to other providers. This makes
+it suitable to include in depsets. GoArchiveData is not directly returned by any
+rule. Instead, it's referenced in the ``data`` field of GoArchive_.
+
++--------------------------------+-----------------------------------------------------------------+
+| **Name** | **Type** |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`name` | :type:`string` |
++--------------------------------+-----------------------------------------------------------------+
+| The name of the library. Usually the same as the ``name`` attribute. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`label` | :type:`Label` |
++--------------------------------+-----------------------------------------------------------------+
+| The full label for the library. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`importpath` | :type:`string` |
++--------------------------------+-----------------------------------------------------------------+
+| The string used in ``import`` declarations in Go source code to import this |
+| library. Usually, this is the ``importpath`` attribute. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`importmap` | :type:`string` |
++--------------------------------+-----------------------------------------------------------------+
+| The package path for this library. The Go compiler and linker internally refer |
+| to the library using this string. It must be unique in any binary the library |
+| is linked into. This is usually the same as ``importpath``, but it may be |
+| different, especially for vendored libraries. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`pathtype` | :type:`string` |
++--------------------------------+-----------------------------------------------------------------+
+| Information about the source of the importpath. Possible values are: |
+| |
+| :value:`explicit` |
+| The importpath was explicitly supplied by the user and the library is importable. |
+| This is the normal case. |
+| :value:`inferred` |
+| The importpath was inferred from the directory structure and rule name. The library may be |
+| importable. |
+| This is normally true for rules that do not expect to be compiled directly to a library, |
+| embeded into another rule instead (source generators) |
+| :value:`export` |
+| The importpath was explicitly supplied by the user, but the library is |
+| not importable. This is the case for binaries and tests. The importpath |
+| may still be useful for `go_path`_ and other rules. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`file` | :type:`File` |
++--------------------------------+-----------------------------------------------------------------+
+| The archive file produced when this library is compiled. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`srcs` | :type:`tuple of File` |
++--------------------------------+-----------------------------------------------------------------+
+| The .go sources compiled into the archive. May have been generated or |
+| transformed with tools like cgo and cover. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`orig_srcs` | :type:`tuple of File` |
++--------------------------------+-----------------------------------------------------------------+
+| The unmodified sources provided to the rule, including .go, .s, .h, .c files. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`data_files` | :type:`tuple of File` |
++--------------------------------+-----------------------------------------------------------------+
+| Data files that should be available at runtime to binaries and tests built |
+| from this archive. |
++--------------------------------+-----------------------------------------------------------------+
+
+GoArchive
+~~~~~~~~~
+
+``GoArchive`` contains information about a compiled archive and its dependencies
+(both direct and transitive). This is used when compiling and linking Go
+libraries and binaries. It is produced by the archive_ toolchain function.
+
+Most of the metadata about the archive itself is available in GoArchiveData_,
+which is available through the :param:`data` field.
+
++--------------------------------+-----------------------------------------------------------------+
+| **Name** | **Type** |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`source` | :type:`GoSource` |
++--------------------------------+-----------------------------------------------------------------+
+| The source provider this GoArchive was compiled from. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`data` | :type:`GoArchiveData` |
++--------------------------------+-----------------------------------------------------------------+
+| The non transitive data for this archive. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`direct` | :type:`list of GoArchive` |
++--------------------------------+-----------------------------------------------------------------+
+| The direct dependencies of this archive. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`libs` | :type:`depset of File` |
++--------------------------------+-----------------------------------------------------------------+
+| The transitive set of libraries needed to link with this archive. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`transitive` | :type:`depset of GoArchiveData` |
++--------------------------------+-----------------------------------------------------------------+
+| The full set of transitive dependencies. This includes ``data`` for this |
+| archive and all ``data`` members transitively reachable through ``direct``. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`x_defs` | :type:`string_dict` |
++--------------------------------+-----------------------------------------------------------------+
+| The full transitive set of defines to add to the go link command. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`cgo_deps` | :type:`depset(cc_library)` |
++--------------------------------+-----------------------------------------------------------------+
+| The direct cgo dependencies of this library. |
+| This has the same constraints as things that can appear in the deps of a cc_library_. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`cgo_exports` | :type:`depset of GoSource` |
++--------------------------------+-----------------------------------------------------------------+
+| The the transitive set of c headers needed to reference exports of this archive. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`runfiles` | runfiles_ |
++--------------------------------+-----------------------------------------------------------------+
+| The files needed to run anything that includes this library. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`mode` | :type:`Mode` |
++--------------------------------+-----------------------------------------------------------------+
+| The mode this archive was compiled in. |
++--------------------------------+-----------------------------------------------------------------+
+
+GoPath
+~~~~~~
+
+GoPath is produced by the `go_path`_ rule. It gives a list of packages used to
+build the ``go_path`` directory and provides a list of original files for each
+package.
+
++--------------------------------+-----------------------------------------------------------------+
+| **Name** | **Type** |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`gopath` | :type:`string` |
++--------------------------------+-----------------------------------------------------------------+
+| The short path to the output file or directory. Useful for constructing |
+| ``runfiles`` paths. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`gopath_file` | :type:`File` |
++--------------------------------+-----------------------------------------------------------------+
+| A Bazel File_ that points to the output directory. |
+| |
+| * In ``archive`` mode, this is the archive. |
+| * In ``copy`` mode, this is the output directory. |
+| * In ``link`` mode, this is an empty file inside the output directory, so |
+| you need to use .dirname to get the path to the directory. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`packages` | :type:`list of struct` |
++--------------------------------+-----------------------------------------------------------------+
+| A list of structs representing packages used to build the ``go_path`` |
+| directory. Each struct has the following fields: |
+| |
+| * ``importpath``: the import path of the package. |
+| * ``dir``: the subdirectory of the package within the ``go_path``, including |
+| the ``src/`` prefix. May different from ``importpath`` due to vendoring. |
+| * ``srcs``: list of source ``File``s. |
+| * ``data``: list of data ``File``s. |
++--------------------------------+-----------------------------------------------------------------+
+
+GoSDK
+~~~~~
+
+``GoSDK`` contains information about the Go SDK used in the toolchain.
+
++--------------------------------+-----------------------------------------------------------------+
+| **Name** | **Type** |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`goos` | :type:`string` |
++--------------------------------+-----------------------------------------------------------------+
+| The host operating system the SDK was built for. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`goarch` | :type:`string` |
++--------------------------------+-----------------------------------------------------------------+
+| The host architecture the SDK was built for. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`root_file` | :type:`File` |
++--------------------------------+-----------------------------------------------------------------+
+| A file in the SDK root directory. Used to determine ``GOROOT``. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`libs` | :type:`list of File` |
++--------------------------------+-----------------------------------------------------------------+
+| Pre-compiled .a files for the standard library, built for the |
+| execution platform. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`headers` | :type:`list of File` |
++--------------------------------+-----------------------------------------------------------------+
+| .h files from pkg/include that may be included in assembly sources. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`srcs` | :type:`list of File` |
++--------------------------------+-----------------------------------------------------------------+
+| Source files for importable packages in the standard library. |
+| Internal, vendored, and tool packages might not be included. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`package_list` | :type:`File` |
++--------------------------------+-----------------------------------------------------------------+
+| A file containing a list of importable packages in the standard library. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`tools` | :type:`list of File` |
++--------------------------------+-----------------------------------------------------------------+
+| Executable files from pkg/tool built for the execution platform. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`go` | :type:`File` |
++--------------------------------+-----------------------------------------------------------------+
+| The go binary file. |
++--------------------------------+-----------------------------------------------------------------+
+
+GoStdLib
+~~~~~~~~
+
+``GoStdLib`` contains information about the standard library being used for
+compiling and linking. The standard library may be the pre-compiled library
+from GoSDK_, or it may be another library compiled for the target mode.
+
++--------------------------------+-----------------------------------------------------------------+
+| **Name** | **Type** |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`root_file` | :type:`File` |
++--------------------------------+-----------------------------------------------------------------+
+| A file or directory in the standard library root directory. Used to determine ``GOROOT``. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`libs` | :type:`list of File` |
++--------------------------------+-----------------------------------------------------------------+
+| .a files for the standard library, built for the target platform. |
++--------------------------------+-----------------------------------------------------------------+
diff --git a/go/runfiles/BUILD.bazel b/go/runfiles/BUILD.bazel
new file mode 100644
index 00000000..62875bd4
--- /dev/null
+++ b/go/runfiles/BUILD.bazel
@@ -0,0 +1,41 @@
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "runfiles",
+ srcs = [
+ "directory.go",
+ "fs.go",
+ "global.go",
+ "manifest.go",
+ "runfiles.go",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/go/runfiles",
+ visibility = ["//visibility:public"],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":runfiles",
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
diff --git a/go/runfiles/directory.go b/go/runfiles/directory.go
new file mode 100644
index 00000000..3a67e7ea
--- /dev/null
+++ b/go/runfiles/directory.go
@@ -0,0 +1,36 @@
+// Copyright 2020, 2021, 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package runfiles
+
+import "path/filepath"
+
+// Directory specifies the location of the runfiles directory. You can pass
+// this as an option to New. If unset or empty, use the value of the
+// environmental variable RUNFILES_DIR.
+type Directory string
+
+func (d Directory) new(sourceRepo SourceRepo) (*Runfiles, error) {
+ r := &Runfiles{
+ impl: d,
+ env: directoryVar + "=" + string(d),
+ sourceRepo: string(sourceRepo),
+ }
+ err := r.loadRepoMapping()
+ return r, err
+}
+
+func (d Directory) path(s string) (string, error) {
+ return filepath.Join(string(d), filepath.FromSlash(s)), nil
+}
diff --git a/go/runfiles/fs.go b/go/runfiles/fs.go
new file mode 100644
index 00000000..5f70eb21
--- /dev/null
+++ b/go/runfiles/fs.go
@@ -0,0 +1,99 @@
+// Copyright 2021, 2022 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//go:build go1.16
+// +build go1.16
+
+package runfiles
+
+import (
+ "errors"
+ "io"
+ "io/fs"
+ "os"
+ "time"
+)
+
+// Open implements fs.FS.Open.
+func (r *Runfiles) Open(name string) (fs.File, error) {
+ if !fs.ValidPath(name) {
+ return nil, &fs.PathError{Op: "open", Path: name, Err: fs.ErrInvalid}
+ }
+ p, err := r.Rlocation(name)
+ if errors.Is(err, ErrEmpty) {
+ return emptyFile(name), nil
+ }
+ if err != nil {
+ return nil, pathError("open", name, err)
+ }
+ return os.Open(p)
+}
+
+// Stat implements fs.StatFS.Stat.
+func (r *Runfiles) Stat(name string) (fs.FileInfo, error) {
+ if !fs.ValidPath(name) {
+ return nil, &fs.PathError{Op: "stat", Path: name, Err: fs.ErrInvalid}
+ }
+ p, err := r.Rlocation(name)
+ if errors.Is(err, ErrEmpty) {
+ return emptyFileInfo(name), nil
+ }
+ if err != nil {
+ return nil, pathError("stat", name, err)
+ }
+ return os.Stat(p)
+}
+
+// ReadFile implements fs.ReadFileFS.ReadFile.
+func (r *Runfiles) ReadFile(name string) ([]byte, error) {
+ if !fs.ValidPath(name) {
+ return nil, &fs.PathError{Op: "open", Path: name, Err: fs.ErrInvalid}
+ }
+ p, err := r.Rlocation(name)
+ if errors.Is(err, ErrEmpty) {
+ return nil, nil
+ }
+ if err != nil {
+ return nil, pathError("open", name, err)
+ }
+ return os.ReadFile(p)
+}
+
+type emptyFile string
+
+func (f emptyFile) Stat() (fs.FileInfo, error) { return emptyFileInfo(f), nil }
+func (f emptyFile) Read([]byte) (int, error) { return 0, io.EOF }
+func (emptyFile) Close() error { return nil }
+
+type emptyFileInfo string
+
+func (i emptyFileInfo) Name() string { return string(i) }
+func (emptyFileInfo) Size() int64 { return 0 }
+func (emptyFileInfo) Mode() fs.FileMode { return 0444 }
+func (emptyFileInfo) ModTime() time.Time { return time.Time{} }
+func (emptyFileInfo) IsDir() bool { return false }
+func (emptyFileInfo) Sys() interface{} { return nil }
+
+func pathError(op, name string, err error) error {
+ if err == nil {
+ return nil
+ }
+ var rerr Error
+ if errors.As(err, &rerr) {
+ // Unwrap the error because we don’t need the failing name
+ // twice.
+ return &fs.PathError{Op: op, Path: rerr.Name, Err: rerr.Err}
+ }
+ return &fs.PathError{Op: op, Path: name, Err: err}
+}
diff --git a/go/runfiles/global.go b/go/runfiles/global.go
new file mode 100644
index 00000000..52ec3569
--- /dev/null
+++ b/go/runfiles/global.go
@@ -0,0 +1,97 @@
+// Copyright 2020, 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package runfiles
+
+import (
+ "regexp"
+ "runtime"
+ "sync"
+)
+
+// Rlocation returns the absolute path name of a runfile. The runfile name must be
+// a relative path, using the slash (not backslash) as directory separator. If
+// the runfiles manifest maps s to an empty name (indicating an empty runfile
+// not present in the filesystem), Rlocation returns an error that wraps ErrEmpty.
+func Rlocation(path string) (string, error) {
+ return RlocationFrom(path, CallerRepository())
+}
+
+func RlocationFrom(path string, sourceRepo string) (string, error) {
+ r, err := g.get()
+ if err != nil {
+ return "", err
+ }
+ return r.WithSourceRepo(sourceRepo).Rlocation(path)
+}
+
+// Env returns additional environmental variables to pass to subprocesses.
+// Each element is of the form “key=value”. Pass these variables to
+// Bazel-built binaries so they can find their runfiles as well. See the
+// Runfiles example for an illustration of this.
+//
+// The return value is a newly-allocated slice; you can modify it at will.
+func Env() ([]string, error) {
+ r, err := g.get()
+ if err != nil {
+ return nil, err
+ }
+ return r.Env(), nil
+}
+
+var legacyExternalGeneratedFile = regexp.MustCompile(`^bazel-out[/][^/]+/bin/external/([^/]+)/`)
+var legacyExternalFile = regexp.MustCompile(`^external/([^/]+)/`)
+
+// CurrentRepository returns the canonical name of the Bazel repository that
+// contains the source file of the caller of CurrentRepository.
+func CurrentRepository() string {
+ return callerRepository(1)
+}
+
+// CallerRepository returns the canonical name of the Bazel repository that
+// contains the source file of the caller of the function that itself calls
+// CallerRepository.
+func CallerRepository() string {
+ return callerRepository(2)
+}
+
+func callerRepository(skip int) string {
+ _, file, _, _ := runtime.Caller(skip + 1)
+ if match := legacyExternalGeneratedFile.FindStringSubmatch(file); match != nil {
+ return match[1]
+ }
+ if match := legacyExternalFile.FindStringSubmatch(file); match != nil {
+ return match[1]
+ }
+ // If a file is not in an external repository, it is in the main repository,
+ // which has the empty string as its canonical name.
+ return ""
+}
+
+type global struct {
+ once sync.Once
+ runfiles *Runfiles
+ err error
+}
+
+func (g *global) get() (*Runfiles, error) {
+ g.once.Do(g.init)
+ return g.runfiles, g.err
+}
+
+func (g *global) init() {
+ g.runfiles, g.err = New()
+}
+
+var g global
diff --git a/go/runfiles/manifest.go b/go/runfiles/manifest.go
new file mode 100644
index 00000000..4d8e8798
--- /dev/null
+++ b/go/runfiles/manifest.go
@@ -0,0 +1,91 @@
+// Copyright 2020, 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package runfiles
+
+import (
+ "bufio"
+ "fmt"
+ "os"
+ "path"
+ "path/filepath"
+ "strings"
+)
+
+// ManifestFile specifies the location of the runfile manifest file. You can
+// pass this as an option to New. If unset or empty, use the value of the
+// environmental variable RUNFILES_MANIFEST_FILE.
+type ManifestFile string
+
+func (f ManifestFile) new(sourceRepo SourceRepo) (*Runfiles, error) {
+ m, err := f.parse()
+ if err != nil {
+ return nil, err
+ }
+ r := &Runfiles{
+ impl: m,
+ env: manifestFileVar + "=" + string(f),
+ sourceRepo: string(sourceRepo),
+ }
+ err = r.loadRepoMapping()
+ return r, err
+}
+
+type manifest map[string]string
+
+func (f ManifestFile) parse() (manifest, error) {
+ r, err := os.Open(string(f))
+ if err != nil {
+ return nil, fmt.Errorf("runfiles: can’t open manifest file: %w", err)
+ }
+ defer r.Close()
+
+ s := bufio.NewScanner(r)
+ m := make(manifest)
+ for s.Scan() {
+ fields := strings.SplitN(s.Text(), " ", 2)
+ if len(fields) != 2 || fields[0] == "" {
+ return nil, fmt.Errorf("runfiles: bad manifest line %q in file %s", s.Text(), f)
+ }
+ m[fields[0]] = filepath.FromSlash(fields[1])
+ }
+
+ if err := s.Err(); err != nil {
+ return nil, fmt.Errorf("runfiles: error parsing manifest file %s: %w", f, err)
+ }
+
+ return m, nil
+}
+
+func (m manifest) path(s string) (string, error) {
+ r, ok := m[s]
+ if ok && r == "" {
+ return "", ErrEmpty
+ }
+ if ok {
+ return r, nil
+ }
+
+ // If path references a runfile that lies under a directory that itself is a
+ // runfile, then only the directory is listed in the manifest. Look up all
+ // prefixes of path in the manifest.
+ for prefix := s; prefix != ""; prefix, _ = path.Split(prefix) {
+ prefix = strings.TrimSuffix(prefix, "/")
+ if prefixMatch, ok := m[prefix]; ok {
+ return prefixMatch + filepath.FromSlash(strings.TrimPrefix(s, prefix)), nil
+ }
+ }
+
+ return "", os.ErrNotExist
+}
diff --git a/go/runfiles/runfiles.go b/go/runfiles/runfiles.go
new file mode 100644
index 00000000..bc57b17b
--- /dev/null
+++ b/go/runfiles/runfiles.go
@@ -0,0 +1,305 @@
+// Copyright 2020, 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package runfiles provides access to Bazel runfiles.
+//
+// Usage
+//
+// This package has two main entry points, the global functions Rlocation and Env,
+// and the Runfiles type.
+//
+// Global functions
+//
+// For simple use cases that don’t require hermetic behavior, use the Rlocation and
+// Env functions to access runfiles. Use Rlocation to find the filesystem location
+// of a runfile, and use Env to obtain environmental variables to pass on to
+// subprocesses.
+//
+// Runfiles type
+//
+// If you need hermetic behavior or want to change the runfiles discovery
+// process, use New to create a Runfiles object. New accepts a few options to
+// change the discovery process. Runfiles objects have methods Rlocation and Env,
+// which correspond to the package-level functions. On Go 1.16, *Runfiles
+// implements fs.FS, fs.StatFS, and fs.ReadFileFS.
+package runfiles
+
+import (
+ "bufio"
+ "errors"
+ "fmt"
+ "os"
+ "path/filepath"
+ "strings"
+)
+
+const (
+ directoryVar = "RUNFILES_DIR"
+ manifestFileVar = "RUNFILES_MANIFEST_FILE"
+)
+
+type repoMappingKey struct {
+ sourceRepo string
+ targetRepoApparentName string
+}
+
+// Runfiles allows access to Bazel runfiles. Use New to create Runfiles
+// objects; the zero Runfiles object always returns errors. See
+// https://docs.bazel.build/skylark/rules.html#runfiles for some information on
+// Bazel runfiles.
+type Runfiles struct {
+ // We don’t need concurrency control since Runfiles objects are
+ // immutable once created.
+ impl runfiles
+ env string
+ repoMapping map[repoMappingKey]string
+ sourceRepo string
+}
+
+const noSourceRepoSentinel = "_not_a_valid_repository_name"
+
+// New creates a given Runfiles object. By default, it uses os.Args and the
+// RUNFILES_MANIFEST_FILE and RUNFILES_DIR environmental variables to find the
+// runfiles location. This can be overwritten by passing some options.
+//
+// See section “Runfiles discovery” in
+// https://docs.google.com/document/d/e/2PACX-1vSDIrFnFvEYhKsCMdGdD40wZRBX3m3aZ5HhVj4CtHPmiXKDCxioTUbYsDydjKtFDAzER5eg7OjJWs3V/pub.
+func New(opts ...Option) (*Runfiles, error) {
+ var o options
+ o.sourceRepo = noSourceRepoSentinel
+ for _, a := range opts {
+ a.apply(&o)
+ }
+
+ if o.sourceRepo == noSourceRepoSentinel {
+ o.sourceRepo = SourceRepo(CallerRepository())
+ }
+
+ if o.manifest == "" {
+ o.manifest = ManifestFile(os.Getenv(manifestFileVar))
+ }
+ if o.manifest != "" {
+ return o.manifest.new(o.sourceRepo)
+ }
+
+ if o.directory == "" {
+ o.directory = Directory(os.Getenv(directoryVar))
+ }
+ if o.directory != "" {
+ return o.directory.new(o.sourceRepo)
+ }
+
+ if o.program == "" {
+ o.program = ProgramName(os.Args[0])
+ }
+ manifest := ManifestFile(o.program + ".runfiles_manifest")
+ if stat, err := os.Stat(string(manifest)); err == nil && stat.Mode().IsRegular() {
+ return manifest.new(o.sourceRepo)
+ }
+
+ dir := Directory(o.program + ".runfiles")
+ if stat, err := os.Stat(string(dir)); err == nil && stat.IsDir() {
+ return dir.new(o.sourceRepo)
+ }
+
+ return nil, errors.New("runfiles: no runfiles found")
+}
+
+// Rlocation returns the (relative or absolute) path name of a runfile.
+// The runfile name must be a runfile-root relative path, using the slash (not
+// backslash) as directory separator. It is typically of the form
+// "repo/path/to/pkg/file".
+//
+// If r is the zero Runfiles object, Rlocation always returns an error. If the
+// runfiles manifest maps s to an empty name (indicating an empty runfile not
+// present in the filesystem), Rlocation returns an error that wraps ErrEmpty.
+//
+// See section “Library interface” in
+// https://docs.google.com/document/d/e/2PACX-1vSDIrFnFvEYhKsCMdGdD40wZRBX3m3aZ5HhVj4CtHPmiXKDCxioTUbYsDydjKtFDAzER5eg7OjJWs3V/pub.
+func (r *Runfiles) Rlocation(path string) (string, error) {
+ if r.impl == nil {
+ return "", errors.New("runfiles: uninitialized Runfiles object")
+ }
+
+ if path == "" {
+ return "", errors.New("runfiles: path may not be empty")
+ }
+ if err := isNormalizedPath(path); err != nil {
+ return "", err
+ }
+
+ // See https://github.com/bazelbuild/bazel/commit/b961b0ad6cc2578b98d0a307581e23e73392ad02
+ if strings.HasPrefix(path, `\`) {
+ return "", fmt.Errorf("runfiles: path %q is absolute without a drive letter", path)
+ }
+ if filepath.IsAbs(path) {
+ return path, nil
+ }
+
+ mappedPath := path
+ split := strings.SplitN(path, "/", 2)
+ if len(split) == 2 {
+ key := repoMappingKey{r.sourceRepo, split[0]}
+ if targetRepoDirectory, exists := r.repoMapping[key]; exists {
+ mappedPath = targetRepoDirectory + "/" + split[1]
+ }
+ }
+
+ p, err := r.impl.path(mappedPath)
+ if err != nil {
+ return "", Error{path, err}
+ }
+ return p, nil
+}
+
+func isNormalizedPath(s string) error {
+ if strings.HasPrefix(s, "../") || strings.Contains(s, "/../") || strings.HasSuffix(s, "/..") {
+ return fmt.Errorf(`runfiles: path %q must not contain ".." segments`, s)
+ }
+ if strings.HasPrefix(s, "./") || strings.Contains(s, "/./") || strings.HasSuffix(s, "/.") {
+ return fmt.Errorf(`runfiles: path %q must not contain "." segments`, s)
+ }
+ if strings.Contains(s, "//") {
+ return fmt.Errorf(`runfiles: path %q must not contain "//"`, s)
+ }
+ return nil
+}
+
+// loadRepoMapping loads the repo mapping (if it exists) using the impl.
+// This mutates the Runfiles object, but is idempotent.
+func (r *Runfiles) loadRepoMapping() error {
+ repoMappingPath, err := r.impl.path(repoMappingRlocation)
+ // If Bzlmod is disabled, the repository mapping manifest isn't created, so
+ // it is not an error if it is missing.
+ if err != nil {
+ return nil
+ }
+ r.repoMapping, err = parseRepoMapping(repoMappingPath)
+ // If the repository mapping manifest exists, it must be valid.
+ return err
+}
+
+// Env returns additional environmental variables to pass to subprocesses.
+// Each element is of the form “key=value”. Pass these variables to
+// Bazel-built binaries so they can find their runfiles as well. See the
+// Runfiles example for an illustration of this.
+//
+// The return value is a newly-allocated slice; you can modify it at will. If
+// r is the zero Runfiles object, the return value is nil.
+func (r *Runfiles) Env() []string {
+ if r.env == "" {
+ return nil
+ }
+ return []string{r.env}
+}
+
+// WithSourceRepo returns a Runfiles instance identical to the current one,
+// except that it uses the given repository's repository mapping when resolving
+// runfiles paths.
+func (r *Runfiles) WithSourceRepo(sourceRepo string) *Runfiles {
+ if r.sourceRepo == sourceRepo {
+ return r
+ }
+ clone := *r
+ clone.sourceRepo = sourceRepo
+ return &clone
+}
+
+// Option is an option for the New function to override runfiles discovery.
+type Option interface {
+ apply(*options)
+}
+
+// ProgramName is an Option that sets the program name. If not set, New uses
+// os.Args[0].
+type ProgramName string
+
+// SourceRepo is an Option that sets the canonical name of the repository whose
+// repository mapping should be used to resolve runfiles paths. If not set, New
+// uses the repository containing the source file from which New is called.
+// Use CurrentRepository to get the name of the current repository.
+type SourceRepo string
+
+// Error represents a failure to look up a runfile.
+type Error struct {
+ // Runfile name that caused the failure.
+ Name string
+
+ // Underlying error.
+ Err error
+}
+
+// Error implements error.Error.
+func (e Error) Error() string {
+ return fmt.Sprintf("runfile %s: %s", e.Name, e.Err.Error())
+}
+
+// Unwrap returns the underlying error, for errors.Unwrap.
+func (e Error) Unwrap() error { return e.Err }
+
+// ErrEmpty indicates that a runfile isn’t present in the filesystem, but
+// should be created as an empty file if necessary.
+var ErrEmpty = errors.New("empty runfile")
+
+type options struct {
+ program ProgramName
+ manifest ManifestFile
+ directory Directory
+ sourceRepo SourceRepo
+}
+
+func (p ProgramName) apply(o *options) { o.program = p }
+func (m ManifestFile) apply(o *options) { o.manifest = m }
+func (d Directory) apply(o *options) { o.directory = d }
+func (sr SourceRepo) apply(o *options) { o.sourceRepo = sr }
+
+type runfiles interface {
+ path(string) (string, error)
+}
+
+// The runfiles root symlink under which the repository mapping can be found.
+// https://cs.opensource.google/bazel/bazel/+/1b073ac0a719a09c9b2d1a52680517ab22dc971e:src/main/java/com/google/devtools/build/lib/analysis/Runfiles.java;l=424
+const repoMappingRlocation = "_repo_mapping"
+
+// Parses a repository mapping manifest file emitted with Bzlmod enabled.
+func parseRepoMapping(path string) (map[repoMappingKey]string, error) {
+ r, err := os.Open(path)
+ if err != nil {
+ // The repo mapping manifest only exists with Bzlmod, so it's not an
+ // error if it's missing. Since any repository name not contained in the
+ // mapping is assumed to be already canonical, an empty map is
+ // equivalent to not applying any mapping.
+ return nil, nil
+ }
+ defer r.Close()
+
+ // Each line of the repository mapping manifest has the form:
+ // canonical name of source repo,apparent name of target repo,target repo runfiles directory
+ // https://cs.opensource.google/bazel/bazel/+/1b073ac0a719a09c9b2d1a52680517ab22dc971e:src/main/java/com/google/devtools/build/lib/analysis/RepoMappingManifestAction.java;l=117
+ s := bufio.NewScanner(r)
+ repoMapping := make(map[repoMappingKey]string)
+ for s.Scan() {
+ fields := strings.SplitN(s.Text(), ",", 3)
+ if len(fields) != 3 {
+ return nil, fmt.Errorf("runfiles: bad repo mapping line %q in file %s", s.Text(), path)
+ }
+ repoMapping[repoMappingKey{fields[0], fields[1]}] = fields[2]
+ }
+
+ if err = s.Err(); err != nil {
+ return nil, fmt.Errorf("runfiles: error parsing repo mapping file %s: %w", path, err)
+ }
+
+ return repoMapping, nil
+}
diff --git a/go/toolchain/BUILD.bazel b/go/toolchain/BUILD.bazel
new file mode 100644
index 00000000..ba47e905
--- /dev/null
+++ b/go/toolchain/BUILD.bazel
@@ -0,0 +1,37 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
+load(
+ ":toolchains.bzl",
+ "declare_constraints",
+)
+
+package(default_visibility = ["//visibility:public"])
+
+declare_constraints()
+
+string_flag(
+ name = "sdk_version",
+ build_setting_default = "",
+)
+
+filegroup(
+ name = "all_rules",
+ srcs = glob(["*.bzl"]),
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+bzl_library(
+ name = "toolchains",
+ srcs = ["toolchains.bzl"],
+ deps = [
+ "//go/private:platforms",
+ "//go/private:sdk",
+ ],
+)
diff --git a/go/toolchain/toolchains.bzl b/go/toolchain/toolchains.bzl
new file mode 100644
index 00000000..b4e070cf
--- /dev/null
+++ b/go/toolchain/toolchains.bzl
@@ -0,0 +1,78 @@
+# Copyright 2019 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:platforms.bzl",
+ "GOARCH_CONSTRAINTS",
+ "GOOS_CONSTRAINTS",
+ "PLATFORMS",
+)
+
+def declare_constraints():
+ """Generates constraint_values and platform targets for valid platforms.
+
+ Each constraint_value corresponds to a valid goos or goarch.
+ The goos and goarch values belong to the constraint_settings
+ @platforms//os:os and @platforms//cpu:cpu, respectively.
+ To avoid redundancy, if there is an equivalent value in @platforms,
+ we define an alias here instead of another constraint_value.
+
+ Each platform defined here selects a goos and goarch constraint value.
+ These platforms may be used with --platforms for cross-compilation,
+ though users may create their own platforms (and
+ @bazel_tools//platforms:default_platform will be used most of the time).
+ """
+ for goos, constraint in GOOS_CONSTRAINTS.items():
+ if constraint.startswith("@io_bazel_rules_go//go/toolchain:"):
+ native.constraint_value(
+ name = goos,
+ constraint_setting = "@platforms//os:os",
+ )
+ else:
+ native.alias(
+ name = goos,
+ actual = constraint,
+ )
+
+ for goarch, constraint in GOARCH_CONSTRAINTS.items():
+ if constraint.startswith("@io_bazel_rules_go//go/toolchain:"):
+ native.constraint_value(
+ name = goarch,
+ constraint_setting = "@platforms//cpu:cpu",
+ )
+ else:
+ native.alias(
+ name = goarch,
+ actual = constraint,
+ )
+
+ native.constraint_setting(
+ name = "cgo_constraint",
+ )
+
+ native.constraint_value(
+ name = "cgo_on",
+ constraint_setting = ":cgo_constraint",
+ )
+
+ native.constraint_value(
+ name = "cgo_off",
+ constraint_setting = ":cgo_constraint",
+ )
+
+ for p in PLATFORMS:
+ native.platform(
+ name = p.name,
+ constraint_values = p.constraints,
+ )
diff --git a/go/toolchains.rst b/go/toolchains.rst
new file mode 100644
index 00000000..57182aab
--- /dev/null
+++ b/go/toolchains.rst
@@ -0,0 +1,847 @@
+Go toolchains
+=============
+
+.. _Args: https://docs.bazel.build/versions/master/skylark/lib/Args.html
+.. _Bazel toolchains: https://docs.bazel.build/versions/master/toolchains.html
+.. _Go website: https://golang.org/
+.. _GoArchive: providers.rst#goarchive
+.. _GoLibrary: providers.rst#golibrary
+.. _GoSDK: providers.rst#gosdk
+.. _GoSource: providers.rst#gosource
+.. _binary distribution: https://golang.org/dl/
+.. _compilation modes: modes.rst#compilation-modes
+.. _control the version: `Forcing the Go version`_
+.. _core: core.bzl
+.. _forked version of Go: `Registering a custom SDK`_
+.. _go assembly: https://golang.org/doc/asm
+.. _go sdk rules: `The SDK`_
+.. _go/platform/list.bzl: platform/list.bzl
+.. _installed SDK: `Using the installed Go sdk`_
+.. _nogo: nogo.rst#nogo
+.. _register: Registration_
+.. _register_toolchains: https://docs.bazel.build/versions/master/skylark/lib/globals.html#register_toolchains
+.. _toolchain resolution: https://bazel.build/extending/toolchains#toolchain-resolution
+
+.. role:: param(kbd)
+.. role:: type(emphasis)
+.. role:: value(code)
+.. |mandatory| replace:: **mandatory value**
+
+The Go toolchain is at the heart of the Go rules, and is the mechanism used to
+customize the behavior of the core_ Go rules.
+
+.. contents:: :depth: 2
+
+-----
+
+Overview
+--------
+
+The Go toolchain consists of three main layers: `the SDK`_, `the toolchain`_,
+and `the context`_.
+
+The SDK
+~~~~~~~
+
+The Go SDK (more commonly known as the Go distribution) is a directory tree
+containing sources for the Go toolchain and standard library and pre-compiled
+binaries for the same. You can download this from by visiting the `Go website`_
+and downloading a `binary distribution`_.
+
+There are several Bazel rules for obtaining and configuring a Go SDK:
+
+* `go_download_sdk`_: downloads a toolchain for a specific version of Go for a
+ specific operating system and architecture.
+* `go_host_sdk`_: uses the toolchain installed on the system where Bazel is
+ run. The toolchain's location is specified with the ``GOROOT`` or by running
+ ``go env GOROOT``.
+* `go_local_sdk`_: like `go_host_sdk`_, but uses the toolchain in a specific
+ directory on the host system.
+* `go_wrap_sdk`_: configures a toolchain downloaded with another Bazel
+ repository rule.
+
+By default, if none of the above rules are used, the `go_register_toolchains`_
+function creates a repository named ``@go_sdk`` using `go_download_sdk`_, using
+a recent version of Go for the host operating system and architecture.
+
+SDKs are specific to a host platform (e.g., ``linux_amd64``) and a version of
+Go. They may target all platforms that Go supports. The Go SDK is naturally
+cross compiling.
+
+By default, all ``go_binary``, ``go_test``, etc. rules will use the first declared
+Go SDK. If you would like to build a target using a specific Go SDK version, first
+ensure that you have declared a Go SDK of that version using one of the above rules
+(`go_download_sdk`_, `go_host_sdk`_, `go_local_sdk`_, `go_wrap_sdk`_). Then you
+can specify the sdk version to build with when running a ``bazel build`` by passing
+the flag ``--@io_bazel_rules_go//go/toolchain:sdk_version="version"`` where
+``"version"`` is the SDK version you would like to build with, eg. ``"1.18.3"``.
+The SDK version can omit the patch, or include a prerelease part, eg. ``"1"``,
+``"1.18"``, ``"1.18.0"``, and ``"1.19.0beta1"`` are all valid values for ``sdk_version``.
+When ``go_host_sdk`` is used, ``"version"`` can be set to ``host`` to refer to the host Go SDK.
+It can also be set ``remote`` to match any non-host version.
+
+The toolchain
+~~~~~~~~~~~~~
+
+The workspace rules above declare `Bazel toolchains`_ with `go_toolchain`_
+implementations for each target platform that Go supports. Wrappers around
+the rules register these toolchains automatically. Bazel will select a
+registered toolchain automatically based on the execution and target platforms,
+specified with ``--host_platform`` and ``--platforms``, respectively.
+
+The workspace rules define the toolchains in a separate repository from the
+SDK. For example, if the SDK repository is `@go_sdk`, the toolchains will be
+defined in `@go_sdk_toolchains`. The `@go_sdk_toolchains` repository must be
+eagerly fetched in order to register the toolchain, but fetching the `@go_sdk`
+repository may be delayed until the toolchain is needed to build something. To
+activate lazily fetching the SDK, you must provide a `version` attribute to the
+workspace rule that defines the SDK (`go_download_sdk`, `go_host_sdk`, `go_local_sdk`,
+`go_wrap_sdk`, or `go_register_toolchains`). The value must match the actual
+version of the SDK; rules_go will validate this when the toolchain is used.
+
+The toolchain itself should be considered opaque. You should only access
+its contents through `the context`_.
+
+The context
+~~~~~~~~~~~
+
+The context is the type you need if you are writing custom rules that need
+to be compatible with rules_go. It provides information about the SDK, the
+toolchain, and the standard library. It also provides a convenient way to
+declare mode-specific files, and to create actions for compiling, linking,
+and more.
+
+Customizing
+-----------
+
+Normal usage
+~~~~~~~~~~~~
+
+This is an example of normal usage for the other examples to be compared
+against. This will download and use a specific version of Go for the host
+platform.
+
+.. code:: bzl
+
+ # WORKSPACE
+
+ load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
+
+ go_rules_dependencies()
+
+ go_register_toolchains(version = "1.15.5")
+
+
+Using the installed Go SDK
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You can use the Go SDK that's installed on the system where Bazel is running.
+This may result in faster builds, since there's no need to download an SDK,
+but builds won't be reproducible across systems with different SDKs installed.
+
+.. code:: bzl
+
+ # WORKSPACE
+
+ load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
+
+ go_rules_dependencies()
+
+ go_register_toolchains(version = "host")
+
+
+Registering a custom SDK
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+If you download the SDK through another repository rule, you can configure
+it with ``go_wrap_sdk``. It must still be named ``go_sdk``, but this is a
+temporary limitation that will be removed in the future.
+
+.. code:: bzl
+
+ # WORKSPACE
+
+ load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains", "go_wrap_sdk")
+
+ unknown_download_sdk(
+ name = "go",
+ ...,
+ )
+
+ go_wrap_sdk(
+ name = "go_sdk",
+ root_file = "@go//:README.md",
+ )
+
+ go_rules_dependencies()
+
+ go_register_toolchains()
+
+
+Writing new Go rules
+~~~~~~~~~~~~~~~~~~~~
+
+If you are writing a new Bazel rule that uses the Go toolchain, you need to
+do several things to ensure you have full access to the toolchain and common
+dependencies.
+
+* Declare a dependency on a toolchain of type
+ ``@io_bazel_rules_go//go:toolchain``. Bazel will select an appropriate,
+ registered toolchain automatically.
+* Declare an implicit attribute named ``_go_context_data`` that defaults to
+ ``@io_bazel_rules_go//:go_context_data``. This target gathers configuration
+ information and several common dependencies.
+* Use the ``go_context`` function to gain access to `the context`_. This is
+ your main interface to the Go toolchain.
+
+.. code:: bzl
+
+ load("@io_bazel_rules_go//go:def.bzl", "go_context")
+
+ def _my_rule_impl(ctx):
+ go = go_context(ctx)
+ ...
+
+ my_rule = rule(
+ implementation = _my_rule_impl,
+ attrs = {
+ ...
+ "_go_context_data": attr.label(
+ default = "@io_bazel_rules_go//:go_context_data",
+ ),
+ },
+ toolchains = ["@io_bazel_rules_go//go:toolchain"],
+ )
+
+
+Rules and functions
+-------------------
+
+go_register_toolchains
+~~~~~~~~~~~~~~~~~~~~~~
+
+Installs the Go toolchains. If :param:`version` is specified, it sets the
+SDK version to use (for example, :value:`"1.15.5"`).
+
++--------------------------------+-----------------------------+-----------------------------------+
+| **Name** | **Type** | **Default value** |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`version` | :type:`string` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| Specifies the version of Go to download if one has not been declared. |
+| |
+| If a toolchain was already declared with `go_download_sdk`_ or a similar rule, |
+| this parameter may not be set. |
+| |
+| Normally this is set to a Go version like :value:`"1.15.5"`. It may also be |
+| set to :value:`"host"`, which will cause rules_go to use the Go toolchain |
+| installed on the host system (found using ``GOROOT`` or ``PATH``). |
+| |
+| If ``version`` is specified and is not set to :value:`"host"`, the SDK will be fetched only when |
+| the build uses a Go toolchain and `toolchain resolution`_ results in this SDK being chosen. |
+| Otherwise it will be fetched unconditionally. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`nogo` | :type:`label` | :value:`None` |
++--------------------------------+-----------------------------+-----------------------------------+
+| The ``nogo`` attribute refers to a nogo_ rule that builds a binary |
+| used for static analysis. The ``nogo`` binary will be used alongside the |
+| Go compiler when building packages. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`experiments` | :type:`string_list` | :value:`[]` |
++--------------------------------+-----------------------------+-----------------------------------+
+| Go experiments to enable via `GOEXPERIMENT`. |
++--------------------------------+-----------------------------+-----------------------------------+
+
+go_download_sdk
+~~~~~~~~~~~~~~~
+
+This downloads a Go SDK for use in toolchains.
+
++--------------------------------+-----------------------------+---------------------------------------------+
+| **Name** | **Type** | **Default value** |
++--------------------------------+-----------------------------+---------------------------------------------+
+| :param:`name` | :type:`string` | |mandatory| |
++--------------------------------+-----------------------------+---------------------------------------------+
+| A unique name for this SDK. This should almost always be :value:`go_sdk` if |
+| you want the SDK to be used by toolchains. |
++--------------------------------+-----------------------------+---------------------------------------------+
+| :param:`goos` | :type:`string` | :value:`None` |
++--------------------------------+-----------------------------+---------------------------------------------+
+| The operating system the binaries in the SDK are intended to run on. |
+| By default, this is detected automatically, but if you're building on |
+| an unusual platform, or if you're using remote execution and the execution |
+| platform is different than the host, you may need to specify this explictly. |
++--------------------------------+-----------------------------+---------------------------------------------+
+| :param:`goarch` | :type:`string` | :value:`None` |
++--------------------------------+-----------------------------+---------------------------------------------+
+| The architecture the binaries in the SDK are intended to run on. |
+| By default, this is detected automatically, but if you're building on |
+| an unusual platform, or if you're using remote execution and the execution |
+| platform is different than the host, you may need to specify this explictly. |
++--------------------------------+-----------------------------+---------------------------------------------+
+| :param:`version` | :type:`string` | :value:`latest Go version` |
++--------------------------------+-----------------------------+---------------------------------------------+
+| The version of Go to download, for example ``1.12.5``. If unspecified, |
+| ``go_download_sdk`` will list available versions of Go from golang.org, then |
+| pick the highest version. If ``version`` is specified but ``sdks`` is |
+| unspecified, ``go_download_sdk`` will list available versions on golang.org |
+| to determine the correct file name and SHA-256 sum. |
+| If ``version`` is specified, the SDK will be fetched only when the build uses a Go toolchain and |
+| `toolchain resolution`_ results in this SDK being chosen. Otherwise it will be fetched unconditionally. |
++--------------------------------+-----------------------------+---------------------------------------------+
+| :param:`urls` | :type:`string_list` | :value:`[https://dl.google.com/go/{}]` |
++--------------------------------+-----------------------------+---------------------------------------------+
+| A list of mirror urls to the binary distribution of a Go SDK. These must contain the `{}` |
+| used to substitute the sdk filename being fetched (using `.format`. |
+| It defaults to the official repository :value:`"https://dl.google.com/go/{}"`. |
+| |
+| This attribute is seldom used. It is only needed for downloading Go from |
+| an alternative location (for example, an internal mirror). |
++--------------------------------+-----------------------------+---------------------------------------------+
+| :param:`strip_prefix` | :type:`string` | :value:`"go"` |
++--------------------------------+-----------------------------+---------------------------------------------+
+| A directory prefix to strip from the extracted files. |
+| Used with ``urls``. |
++--------------------------------+-----------------------------+---------------------------------------------+
+| :param:`sdks` | :type:`string_list_dict` | :value:`see description` |
++--------------------------------+-----------------------------+---------------------------------------------+
+| This consists of a set of mappings from the host platform tuple to a list of filename and |
+| sha256 for that file. The filename is combined the :param:`urls` to produce the final download |
+| urls to use. |
+| |
+| This option is seldom used. It is only needed for downloading a modified |
+| Go distribution (with a different SHA-256 sum) or a version of Go |
+| not supported by rules_go (for example, a beta or release candidate). |
++--------------------------------+-----------------------------+---------------------------------------------+
+
+**Example**:
+
+.. code:: bzl
+
+ load(
+ "@io_bazel_rules_go//go:deps.bzl",
+ "go_download_sdk",
+ "go_register_toolchains",
+ "go_rules_dependencies",
+ )
+
+ go_download_sdk(
+ name = "go_sdk",
+ goos = "linux",
+ goarch = "amd64",
+ version = "1.18.1",
+ sdks = {
+ # NOTE: In most cases the whole sdks attribute is not needed.
+ # There are 2 "common" reasons you might want it:
+ #
+ # 1. You need to use an modified GO SDK, or an unsupported version
+ # (for example, a beta or release candidate)
+ #
+ # 2. You want to avoid the dependency on the index file for the
+ # SHA-256 checksums. In this case, You can get the expected
+ # filenames and checksums from https://go.dev/dl/
+ "linux_amd64": ("go1.18.1.linux-amd64.tar.gz", "b3b815f47ababac13810fc6021eb73d65478e0b2db4b09d348eefad9581a2334"),
+ "darwin_amd64": ("go1.18.1.darwin-amd64.tar.gz", "3703e9a0db1000f18c0c7b524f3d378aac71219b4715a6a4c5683eb639f41a4d"),
+ },
+ )
+
+ go_rules_dependencies()
+
+ go_register_toolchains()
+
+go_host_sdk
+~~~~~~~~~~~
+
+This detects and configures the host Go SDK for use in toolchains.
+
+If the ``GOROOT`` environment variable is set, the SDK in that directory is
+used. Otherwise, ``go env GOROOT`` is used.
+
++--------------------------------+-----------------------------+-----------------------------------+
+| **Name** | **Type** | **Default value** |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`name` | :type:`string` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| A unique name for this SDK. This should almost always be :value:`go_sdk` if you want the SDK |
+| to be used by toolchains. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`version` | :type:`string` | :value:`None` |
++--------------------------------+-----------------------------+-----------------------------------+
+| The version of Go installed on the host. If specified, `go_host_sdk` will create its repository |
+| only when the build uses a Go toolchain and `toolchain resolution`_ results in this SDK being |
+| chosen. Otherwise it will be created unconditionally. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`experiments` | :type:`string_list` | :value:`[]` |
++--------------------------------+-----------------------------+-----------------------------------+
+| Go experiments to enable via `GOEXPERIMENT`. |
++--------------------------------+-----------------------------+-----------------------------------+
+
+go_local_sdk
+~~~~~~~~~~~~
+
+This prepares a local path to use as the Go SDK in toolchains.
+
++--------------------------------+-----------------------------+-----------------------------------+
+| **Name** | **Type** | **Default value** |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`name` | :type:`string` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| A unique name for this SDK. This should almost always be :value:`go_sdk` if you want the SDK |
+| to be used by toolchains. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`path` | :type:`string` | :value:`""` |
++--------------------------------+-----------------------------+-----------------------------------+
+| The local path to a pre-installed Go SDK. The path must contain the go binary, the tools it |
+| invokes and the standard library sources. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`version` | :type:`string` | :value:`None` |
++--------------------------------+-----------------------------+-----------------------------------+
+| The version of the Go SDK. If specified, `go_local_sdk` will create its repository only when the |
+| build uses a Go toolchain and `toolchain resolution`_ results in this SDK being chosen. |
+| Otherwise it will be created unconditionally. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`experiments` | :type:`string_list` | :value:`[]` |
++--------------------------------+-----------------------------+-----------------------------------+
+| Go experiments to enable via `GOEXPERIMENT`. |
++--------------------------------+-----------------------------+-----------------------------------+
+
+
+go_wrap_sdk
+~~~~~~~~~~~
+
+This configures an SDK that was downloaded or located with another repository
+rule.
+
++--------------------------------+-----------------------------+-----------------------------------+
+| **Name** | **Type** | **Default value** |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`name` | :type:`string` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| A unique name for this SDK. This should almost always be :value:`go_sdk` if you want the SDK |
+| to be used by toolchains. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`root_file` | :type:`label` | :value:`None` |
++--------------------------------+-----------------------------+-----------------------------------+
+| A Bazel label referencing a file in the root directory of the SDK. Used to |
+| determine the GOROOT for the SDK. This attribute and `root_files` cannot be both provided. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`root_files` | :type:`string_dict` | :value:`None` |
++--------------------------------+-----------------------------+-----------------------------------+
+| A set of mappings from the host platform to a Bazel label referencing a file in the SDK's root |
+| directory. This attribute and `root_file` cannot be both provided. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`version` | :type:`string` | :value:`None` |
++--------------------------------+-----------------------------+-----------------------------------+
+| The version of the Go SDK. If specified, `go_wrap_sdk` will create its repository only when the |
+| build uses a Go toolchain and `toolchain resolution`_ results in this SDK being chosen. |
+| Otherwise it will be created unconditionally. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`experiments` | :type:`string_list` | :value:`[]` |
++--------------------------------+-----------------------------+-----------------------------------+
+| Go experiments to enable via `GOEXPERIMENT`. |
++--------------------------------+-----------------------------+-----------------------------------+
+
+
+**Example:**
+
+.. code:: bzl
+
+ load(
+ "@io_bazel_rules_go//go:deps.bzl",
+ "go_register_toolchains",
+ "go_rules_dependencies",
+ "go_wrap_sdk",
+ )
+
+ go_wrap_sdk(
+ name = "go_sdk",
+ root_file = "@other_repo//go:README.md",
+ )
+
+ go_rules_dependencies()
+
+ go_register_toolchains()
+
+go_toolchain
+~~~~~~~~~~~~
+
+This declares a toolchain that may be used with toolchain type
+:value:`"@io_bazel_rules_go//go:toolchain"`.
+
+Normally, ``go_toolchain`` rules are declared and registered in repositories
+configured with `go_download_sdk`_, `go_host_sdk`_, `go_local_sdk`_, or
+`go_wrap_sdk`_. You usually won't need to declare these explicitly.
+
++--------------------------------+-----------------------------+-----------------------------------+
+| **Name** | **Type** | **Default value** |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`name` | :type:`string` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| A unique name for the toolchain. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`goos` | :type:`string` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| The target operating system. Must be a standard ``GOOS`` value. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`goarch` | :type:`string` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| The target architecture. Must be a standard ``GOARCH`` value. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`sdk` | :type:`label` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| The SDK this toolchain is based on. The target must provide `GoSDK`_. This is |
+| usually a `go_sdk`_ rule. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`link_flags` | :type:`string_list` | :value:`[]` |
++--------------------------------+-----------------------------+-----------------------------------+
+| Flags passed to the Go external linker. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`cgo_link_flags` | :type:`string_list` | :value:`[]` |
++--------------------------------+-----------------------------+-----------------------------------+
+| Flags passed to the external linker (if it is used). |
++--------------------------------+-----------------------------+-----------------------------------+
+
+go_context
+~~~~~~~~~~
+
+This collects the information needed to form and return a :type:`GoContext` from
+a rule ctx. It uses the attributes and the toolchains.
+
+.. code:: bzl
+
+ def _my_rule_impl(ctx):
+ go = go_context(ctx)
+ ...
+
+
++--------------------------------+-----------------------------+-----------------------------------+
+| **Name** | **Type** | **Default value** |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`ctx` | :type:`ctx` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| The Bazel ctx object for the current rule. |
++--------------------------------+-----------------------------+-----------------------------------+
+
+The context object
+~~~~~~~~~~~~~~~~~~
+
+``GoContext`` is never returned by a rule, instead you build one using
+``go_context(ctx)`` in the top of any custom starlark rule that wants to interact
+with the go rules. It provides all the information needed to create go actions,
+and create or interact with the other go providers.
+
+When you get a ``GoContext`` from a context it exposes a number of fields
+and methods.
+
+All methods take the ``GoContext`` as the only positional argument. All other
+arguments must be passed as keyword arguments. This allows us to re-order and
+deprecate individual parameters over time.
+
+Fields
+^^^^^^
+
++--------------------------------+-----------------------------------------------------------------+
+| **Name** | **Type** |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`toolchain` | :type:`ToolchainInfo` |
++--------------------------------+-----------------------------------------------------------------+
+| The underlying toolchain. This should be considered an opaque type subject to change. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`sdk` | :type:`GoSDK` |
++--------------------------------+-----------------------------------------------------------------+
+| The SDK in use. This may be used to access sources, packages, and tools. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`mode` | :type:`Mode` |
++--------------------------------+-----------------------------------------------------------------+
+| Controls the compilation setup affecting things like enabling profilers and sanitizers. |
+| See `compilation modes`_ for more information about the allowed values. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`root` | :type:`string` |
++--------------------------------+-----------------------------------------------------------------+
+| Path of the effective GOROOT. If :param:`stdlib` is set, this is the same |
+| as ``go.stdlib.root_file.dirname``. Otherwise, this is the same as |
+| ``go.sdk.root_file.dirname``. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`go` | :type:`File` |
++--------------------------------+-----------------------------------------------------------------+
+| The main "go" binary used to run go sdk tools. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`stdlib` | :type:`GoStdLib` |
++--------------------------------+-----------------------------------------------------------------+
+| The standard library and tools to use in this build mode. This may be the |
+| pre-compiled standard library that comes with the SDK, or it may be compiled |
+| in a different directory for this mode. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`actions` | :type:`ctx.actions` |
++--------------------------------+-----------------------------------------------------------------+
+| The actions structure from the Bazel context, which has all the methods for building new |
+| bazel actions. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`exe_extension` | :type:`string` |
++--------------------------------+-----------------------------------------------------------------+
+| The suffix to use for all executables in this build mode. Mostly used when generating the output |
+| filenames of binary rules. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`shared_extension` | :type:`string` |
++--------------------------------+-----------------------------------------------------------------+
+| The suffix to use for shared libraries in this build mode. Mostly used when |
+| generating output filenames of binary rules. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`crosstool` | :type:`list of File` |
++--------------------------------+-----------------------------------------------------------------+
+| The files you need to add to the inputs of an action in order to use the cc toolchain. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`package_list` | :type:`File` |
++--------------------------------+-----------------------------------------------------------------+
+| A file that contains the package list of the standard library. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`env` | :type:`dict of string to string` |
++--------------------------------+-----------------------------------------------------------------+
+| Environment variables to pass to actions. Includes ``GOARCH``, ``GOOS``, |
+| ``GOROOT``, ``GOROOT_FINAL``, ``CGO_ENABLED``, and ``PATH``. |
++--------------------------------+-----------------------------------------------------------------+
+| :param:`tags` | :type:`list of string` |
++--------------------------------+-----------------------------------------------------------------+
+| List of build tags used to filter source files. |
++--------------------------------+-----------------------------------------------------------------+
+
+Methods
+^^^^^^^
+
+* Action generators
+
+ * archive_
+ * binary_
+ * link_
+
+* Helpers
+
+ * args_
+ * `declare_file`_
+ * `library_to_source`_
+ * `new_library`_
+
+
+archive
++++++++
+
+This emits actions to compile Go code into an archive. It supports embedding,
+cgo dependencies, coverage, and assembling and packing .s files.
+
+It returns a GoArchive_.
+
++--------------------------------+-----------------------------+-----------------------------------+
+| **Name** | **Type** | **Default value** |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`go` | :type:`GoContext` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| This must be the same GoContext object you got this function from. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`source` | :type:`GoSource` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| The GoSource_ that should be compiled into an archive. |
++--------------------------------+-----------------------------+-----------------------------------+
+
+
+binary
+++++++
+
+This emits actions to compile and link Go code into a binary. It supports
+embedding, cgo dependencies, coverage, and assembling and packing .s files.
+
+It returns a tuple containing GoArchive_, the output executable file, and
+a ``runfiles`` object.
+
++--------------------------------+-----------------------------+-----------------------------------+
+| **Name** | **Type** | **Default value** |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`go` | :type:`GoContext` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| This must be the same GoContext object you got this function from. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`name` | :type:`string` | :value:`""` |
++--------------------------------+-----------------------------+-----------------------------------+
+| The base name of the generated binaries. Required if :param:`executable` is not given. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`source` | :type:`GoSource` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| The GoSource_ that should be compiled and linked. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`test_archives` | :type:`list GoArchiveData` | :value:`[]` |
++--------------------------------+-----------------------------+-----------------------------------+
+| List of archives for libraries under test. See link_. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`gc_linkopts` | :type:`string_list` | :value:`[]` |
++--------------------------------+-----------------------------+-----------------------------------+
+| Go link options. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`version_file` | :type:`File` | :value:`None` |
++--------------------------------+-----------------------------+-----------------------------------+
+| Version file used for link stamping. See link_. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`info_file` | :type:`File` | :value:`None` |
++--------------------------------+-----------------------------+-----------------------------------+
+| Info file used for link stamping. See link_. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`executable` | :type:`File` | :value:`None` |
++--------------------------------+-----------------------------+-----------------------------------+
+| Optional output file to write. If not set, ``binary`` will generate an output |
+| file name based on ``name``, the target platform, and the link mode. |
++--------------------------------+-----------------------------+-----------------------------------+
+
+
+link
+++++
+
+The link function adds an action that runs ``go tool link`` on a library.
+
+It does not return anything.
+
++--------------------------------+-----------------------------+-----------------------------------+
+| **Name** | **Type** | **Default value** |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`go` | :type:`GoContext` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| This must be the same GoContext object you got this function from. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`archive` | :type:`GoArchive` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| The library to link. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`test_archives` | :type:`GoArchiveData list` | :value:`[]` |
++--------------------------------+-----------------------------+-----------------------------------+
+| List of archives for libraries under test. These are excluded from linking |
+| if transitive dependencies of :param:`archive` have the same package paths. |
+| This is useful for linking external test archives that depend internal test |
+| archives. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`executable` | :type:`File` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| The binary to produce. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`gc_linkopts` | :type:`string_list` | :value:`[]` |
++--------------------------------+-----------------------------+-----------------------------------+
+| Basic link options, these may be adjusted by the :param:`mode`. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`version_file` | :type:`File` | :value:`None` |
++--------------------------------+-----------------------------+-----------------------------------+
+| Version file used for link stamping. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`info_file` | :type:`File` | :value:`None` |
++--------------------------------+-----------------------------+-----------------------------------+
+| Info file used for link stamping. |
++--------------------------------+-----------------------------+-----------------------------------+
+
+
+args
+++++
+
+This creates a new Args_ object, using the ``ctx.actions.args`` method. The
+object is pre-populated with standard arguments used by all the go toolchain
+builders.
+
++--------------------------------+-----------------------------+-----------------------------------+
+| **Name** | **Type** | **Default value** |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`go` | :type:`GoContext` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| This must be the same GoContext object you got this function from. |
++--------------------------------+-----------------------------+-----------------------------------+
+
+declare_file
+++++++++++++
+
+This is the equivalent of ``ctx.actions.declare_file``. It uses the
+current build mode to make the filename unique between configurations.
+
++--------------------------------+-----------------------------+-----------------------------------+
+| **Name** | **Type** | **Default value** |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`go` | :type:`GoContext` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| This must be the same GoContext object you got this function from. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`path` | :type:`string` | :value:`""` |
++--------------------------------+-----------------------------+-----------------------------------+
+| A path for this file, including the basename of the file. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`ext` | :type:`string` | :value:`""` |
++--------------------------------+-----------------------------+-----------------------------------+
+| The extension to use for the file. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`name` | :type:`string` | :value:`""` |
++--------------------------------+-----------------------------+-----------------------------------+
+| A name to use for this file. If path is not present, this becomes a prefix to the path. |
+| If this is not set, the current rule name is used in it's place. |
++--------------------------------+-----------------------------+-----------------------------------+
+
+library_to_source
++++++++++++++++++
+
+This is used to build a GoSource object for a given GoLibrary in the current
+build mode.
+
++--------------------------------+-----------------------------+-----------------------------------+
+| **Name** | **Type** | **Default value** |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`go` | :type:`GoContext` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| This must be the same GoContext object you got this function from. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`attr` | :type:`ctx.attr` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| The attributes of the target being analyzed. For most rules, this should be |
+| ``ctx.attr``. Rules can also pass in a ``struct`` with the same fields. |
+| |
+| ``library_to_source`` looks for fields corresponding to the attributes of |
+| ``go_library`` and ``go_binary``. This includes ``srcs``, ``deps``, ``embed``, |
+| and so on. All fields are optional (and may not be defined in the struct |
+| argument at all), but if they are present, they must have the same types and |
+| allowed values as in ``go_library`` and ``go_binary``. For example, ``srcs`` |
+| must be a list of ``Targets``; ``gc_goopts`` must be a list of strings. |
+| |
+| As an exception, ``deps``, if present, must be a list containing either |
+| ``Targets`` or ``GoArchives``. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`library` | :type:`GoLibrary` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| The GoLibrary_ that you want to build a GoSource_ object for in the current build mode. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`coverage_instrumented` | :type:`bool` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| This controls whether cover is enabled for this specific library in this mode. |
+| This should generally be the value of ctx.coverage_instrumented() |
++--------------------------------+-----------------------------+-----------------------------------+
+
+new_library
++++++++++++
+
+This creates a new GoLibrary. You can add extra fields to the go library by
+providing extra named parameters to this function, they will be visible to the
+resolver when it is invoked.
+
++--------------------------------+-----------------------------+-----------------------------------+
+| **Name** | **Type** | **Default value** |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`go` | :type:`GoContext` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| This must be the same GoContext object you got this function from. |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`resolver` | :type:`function` | :value:`None` |
++--------------------------------+-----------------------------+-----------------------------------+
+| This is the function that gets invoked when converting from a GoLibrary to a GoSource. |
+| The function's signature must be |
+| |
+| .. code:: bzl |
+| |
+| def _stdlib_library_to_source(go, attr, source, merge) |
+| |
+| attr is the attributes of the rule being processed |
+| source is the dictionary of GoSource fields being generated |
+| merge is a helper you can call to merge |
++--------------------------------+-----------------------------+-----------------------------------+
+| :param:`importable` | :type:`bool` | |mandatory| |
++--------------------------------+-----------------------------+-----------------------------------+
+| This controls whether the GoLibrary_ is supposed to be importable. This is generally only false |
+| for the "main" libraries that are built just before linking. |
++--------------------------------+-----------------------------+-----------------------------------+
diff --git a/go/tools/BUILD.bazel b/go/tools/BUILD.bazel
new file mode 100644
index 00000000..50b87d74
--- /dev/null
+++ b/go/tools/BUILD.bazel
@@ -0,0 +1,13 @@
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = [
+ "//go/tools/bazel:all_files",
+ "//go/tools/bazel_testing:all_files",
+ "//go/tools/builders:all_files",
+ "//go/tools/bzltestutil:all_files",
+ "//go/tools/coverdata:all_files",
+ "//go/tools/go_bin_runner:all_files",
+ ],
+ visibility = ["//visibility:public"],
+)
diff --git a/go/tools/bazel/BUILD.bazel b/go/tools/bazel/BUILD.bazel
new file mode 100644
index 00000000..674da86f
--- /dev/null
+++ b/go/tools/bazel/BUILD.bazel
@@ -0,0 +1,34 @@
+load("//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "bazel",
+ srcs = [
+ "bazel.go",
+ "runfiles.go",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/go/tools/bazel",
+ visibility = ["//visibility:public"],
+)
+
+go_test(
+ name = "bazel_test",
+ size = "small",
+ srcs = ["bazel_test.go"],
+ data = ["empty.txt"],
+ embed = [":bazel"],
+)
+
+# Runfiles functionality in this package is tested by //tests/core/runfiles.
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":bazel",
+ visibility = ["//visibility:public"],
+)
diff --git a/go/tools/bazel/bazel.go b/go/tools/bazel/bazel.go
new file mode 100644
index 00000000..d90b0298
--- /dev/null
+++ b/go/tools/bazel/bazel.go
@@ -0,0 +1,73 @@
+// Copyright 2017 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package bazel provides utilities for interacting with the surrounding Bazel environment.
+package bazel
+
+import (
+ "fmt"
+ "io/ioutil"
+ "os"
+)
+
+const TEST_SRCDIR = "TEST_SRCDIR"
+const TEST_TMPDIR = "TEST_TMPDIR"
+const TEST_WORKSPACE = "TEST_WORKSPACE"
+
+// NewTmpDir creates a new temporary directory in TestTmpDir().
+func NewTmpDir(prefix string) (string, error) {
+ return ioutil.TempDir(TestTmpDir(), prefix)
+}
+
+// TestTmpDir returns the path the Bazel test temp directory.
+// If TEST_TMPDIR is not defined, it returns the OS default temp dir.
+func TestTmpDir() string {
+ if tmp, ok := os.LookupEnv(TEST_TMPDIR); ok {
+ return tmp
+ }
+ return os.TempDir()
+}
+
+// SpliceDelimitedOSArgs is a utility function that scans the os.Args list for
+// entries delimited by the begin and end delimiters (typically the values
+// "-begin_files" and "-end_files" are used). Entries between these delimiters
+// are spliced out of from os.Args and returned to the caller. If the ordering
+// of -begin_files or -end_files is malformed, error is returned.
+func SpliceDelimitedOSArgs(begin, end string) ([]string, error) {
+ var files []string
+ beginFiles, endFiles := -1, -1
+ for i, arg := range os.Args {
+ if arg == begin {
+ beginFiles = i
+ } else if arg == end {
+ endFiles = i
+ break
+ } else if arg == "--" {
+ break
+ }
+ }
+
+ if beginFiles >= 0 && endFiles < 0 ||
+ beginFiles < 0 && endFiles >= 0 ||
+ beginFiles >= 0 && beginFiles >= endFiles {
+ return nil, fmt.Errorf("error: %s, %s not set together or in order", begin, end)
+ }
+
+ if beginFiles >= 0 {
+ files = os.Args[beginFiles+1 : endFiles]
+ os.Args = append(os.Args[:beginFiles:beginFiles], os.Args[endFiles+1:]...)
+ }
+
+ return files, nil
+}
diff --git a/go/tools/bazel/bazel_test.go b/go/tools/bazel/bazel_test.go
new file mode 100644
index 00000000..52903d9c
--- /dev/null
+++ b/go/tools/bazel/bazel_test.go
@@ -0,0 +1,267 @@
+// Copyright 2017 Google Inc.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+package bazel
+
+import (
+ "errors"
+ "fmt"
+ "io/ioutil"
+ "os"
+ "strings"
+ "testing"
+)
+
+// makeAndEnterTempdir creates a temporary directory and chdirs into it.
+func makeAndEnterTempdir() (func(), error) {
+ oldCwd, err := os.Getwd()
+ if err != nil {
+ return nil, fmt.Errorf("cannot get path to current directory: %v", err)
+ }
+
+ tempDir, err := ioutil.TempDir("", "test")
+ if err != nil {
+ return nil, fmt.Errorf("failed to create temporary directory: %v", err)
+ }
+
+ err = os.Chdir(tempDir)
+ if err != nil {
+ os.RemoveAll(tempDir)
+ return nil, fmt.Errorf("cannot enter temporary directory %s: %v", tempDir, err)
+ }
+
+ cleanup := func() {
+ defer os.RemoveAll(tempDir)
+ defer os.Chdir(oldCwd)
+ }
+ return cleanup, nil
+}
+
+// createPaths creates a collection of paths for testing purposes. Paths can end with a /, in
+// which case a directory is created; or they can end with a *, in which case an executable file
+// is created. (This matches the nomenclature of "ls -F".)
+func createPaths(paths []string) error {
+ for _, path := range paths {
+ if strings.HasSuffix(path, "/") {
+ if err := os.MkdirAll(path, 0755); err != nil {
+ return fmt.Errorf("failed to create directory %s: %v", path, err)
+ }
+ } else {
+ mode := os.FileMode(0644)
+ if strings.HasSuffix(path, "*") {
+ path = path[0 : len(path)-1]
+ mode |= 0111
+ }
+ if err := ioutil.WriteFile(path, []byte{}, mode); err != nil {
+ return fmt.Errorf("failed to create file %s with mode %v: %v", path, mode, err)
+ }
+ }
+ }
+ return nil
+}
+
+func TestRunfile(t *testing.T) {
+ file := "go/tools/bazel/empty.txt"
+ runfile, err := Runfile(file)
+ if err != nil {
+ t.Errorf("When reading file %s got error %s", file, err)
+ }
+
+ // Check that the file actually exist
+ if _, err := os.Stat(runfile); err != nil {
+ t.Errorf("File found by runfile doesn't exist")
+ }
+}
+
+func TestRunfilesPath(t *testing.T) {
+ path, err := RunfilesPath()
+ if err != nil {
+ t.Errorf("Error finding runfiles path: %s", err)
+ }
+
+ if path == "" {
+ t.Errorf("Runfiles path is empty: %s", path)
+ }
+}
+
+func TestNewTmpDir(t *testing.T) {
+ // prefix := "new/temp/dir"
+ prefix := "demodir"
+ tmpdir, err := NewTmpDir(prefix)
+ if err != nil {
+ t.Errorf("When creating temp dir %s got error %s", prefix, err)
+ }
+
+ // Check that the tempdir actually exist
+ if _, err := os.Stat(tmpdir); err != nil {
+ t.Errorf("New tempdir (%s) not created. Got error %s", tmpdir, err)
+ }
+}
+
+func TestTestTmpDir(t *testing.T) {
+ if TestTmpDir() == "" {
+ t.Errorf("TestTmpDir (TEST_TMPDIR) was left empty")
+ }
+}
+
+func TestTestWorkspace(t *testing.T) {
+ workspace, err := TestWorkspace()
+
+ if workspace == "" {
+ t.Errorf("Workspace is left empty")
+ }
+
+ if err != nil {
+ t.Errorf("Unable to get workspace with error %s", err)
+ }
+}
+
+func TestPythonManifest(t *testing.T) {
+ cleanup, err := makeAndEnterTempdir()
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer cleanup()
+
+ err = ioutil.WriteFile("MANIFEST",
+ // all on one line to make sure the whitespace stays exactly as in the source file
+ []byte("__init__.py \n__main__/external/__init__.py \n__main__/external/rules_python/__init__.py \n__main__/external/rules_python/python/__init__.py \n__main__/external/rules_python/python/runfiles/__init__.py \n__main__/external/rules_python/python/runfiles/runfiles.py C:/users/sam/_bazel_sam/pj4cl7d4/external/rules_python/python/runfiles/runfiles.py\n__main__/go_cat_/go_cat.exe C:/users/sam/_bazel_sam/pj4cl7d4/execroot/__main__/bazel-out/x64_windows-opt-exec-2B5CBBC6/bin/go_cat_/go_cat.exe\n__main__/important.txt C:/users/sam/dev/rules_go_runfiles_repro/important.txt\n__main__/parent.exe C:/users/sam/_bazel_sam/pj4cl7d4/execroot/__main__/bazel-out/x64_windows-opt-exec-2B5CBBC6/bin/parent.exe\n__main__/parent.py C:/users/sam/dev/rules_go_runfiles_repro/parent.py\n__main__/parent.zip C:/users/sam/_bazel_sam/pj4cl7d4/execroot/__main__/bazel-out/x64_windows-opt-exec-2B5CBBC6/bin/parent.zip\nrules_python/__init__.py \nrules_python/python/__init__.py \nrules_python/python/runfiles/__init__.py \nrules_python/python/runfiles/runfiles.py C:/users/sam/_bazel_sam/pj4cl7d4/external/rules_python/python/runfiles/runfiles.py"),
+ os.FileMode(0644),
+ )
+ if err != nil {
+ t.Fatalf("Failed to write sample manifest: %v", err)
+ }
+
+ originalEnvVar := os.Getenv(RUNFILES_MANIFEST_FILE)
+ defer func() {
+ if err = os.Setenv(RUNFILES_MANIFEST_FILE, originalEnvVar); err != nil {
+ t.Fatalf("Failed to reset environment: %v", err)
+ }
+ }()
+
+ if err = os.Setenv(RUNFILES_MANIFEST_FILE, "MANIFEST"); err != nil {
+ t.Fatalf("Failed to set manifest file environement variable: %v", err)
+ }
+
+ initRunfiles()
+
+ if runfiles.err != nil {
+ t.Errorf("failed to init runfiles: %v", runfiles.err)
+ }
+
+ entry, ok := runfiles.index.GetIgnoringWorkspace("important.txt")
+ if !ok {
+ t.Errorf("failed to locate runfile %s in index", "important.txt")
+ }
+
+ if entry.Workspace != "__main__" {
+ t.Errorf("incorrect workspace for runfile. Expected: %s, actual %s", "__main__", entry.Workspace)
+ }
+}
+
+func TestSpliceDelimitedOSArgs(t *testing.T) {
+ testData := map[string]struct {
+ initial []string
+ want []string
+ final []string
+ wantErr error
+ }{
+ "no args": {
+ []string{},
+ []string{},
+ []string{},
+ nil,
+ },
+ "empty splice": {
+ []string{"-begin_files", "-end_files"},
+ []string{},
+ []string{},
+ nil,
+ },
+ "removes inner args": {
+ []string{"-begin_files", "a", "-end_files"},
+ []string{"a"},
+ []string{},
+ nil,
+ },
+ "preserves outer args": {
+ []string{"a", "-begin_files", "b", "c", "-end_files", "d"},
+ []string{"b", "c"},
+ []string{"a", "d"},
+ nil,
+ },
+ "complains about missing end delimiter": {
+ []string{"-begin_files"},
+ []string{},
+ []string{},
+ errors.New("error: -begin_files, -end_files not set together or in order"),
+ },
+ "complains about missing begin delimiter": {
+ []string{"-end_files"},
+ []string{},
+ []string{},
+ errors.New("error: -begin_files, -end_files not set together or in order"),
+ },
+ "complains about out-of-order delimiter": {
+ []string{"-end_files", "-begin_files"},
+ []string{},
+ []string{},
+ errors.New("error: -begin_files, -end_files not set together or in order"),
+ },
+ "-- at middle": {
+ []string{"-begin_files", "a", "b", "--", "-end_files"},
+ []string{},
+ []string{},
+ errors.New("error: -begin_files, -end_files not set together or in order"),
+ },
+ "-- at beginning": {
+ []string{"--", "-begin_files", "a", "-end_files"},
+ []string{},
+ []string{"--", "-begin_files", "a", "-end_files"},
+ nil,
+ },
+ }
+ for name, tc := range testData {
+ t.Run(name, func(t *testing.T) {
+ os.Args = tc.initial
+ got, err := SpliceDelimitedOSArgs("-begin_files", "-end_files")
+ if err != nil {
+ if tc.wantErr == nil {
+ t.Fatalf("unexpected err: %v", err)
+ }
+ if tc.wantErr.Error() != err.Error() {
+ t.Fatalf("err: want %v, got %v", tc.wantErr, err)
+ }
+ return
+ }
+ if len(tc.want) != len(got) {
+ t.Fatalf("len(want: %d, got %d", len(tc.want), len(got))
+ }
+ for i, actual := range got {
+ expected := tc.want[i]
+ if expected != actual {
+ t.Errorf("%d: want %v, got %v", i, expected, actual)
+ }
+ }
+ if len(tc.final) != len(os.Args) {
+ t.Fatalf("len(want: %d, os.Args %d", len(tc.final), len(os.Args))
+ }
+ for i, actual := range os.Args {
+ expected := tc.final[i]
+ if expected != actual {
+ t.Errorf("%d: want %v, os.Args %v", i, expected, actual)
+ }
+ }
+ })
+ }
+}
diff --git a/go/tools/bazel/empty.txt b/go/tools/bazel/empty.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/go/tools/bazel/empty.txt
diff --git a/go/tools/bazel/runfiles.go b/go/tools/bazel/runfiles.go
new file mode 100644
index 00000000..a2ac11d8
--- /dev/null
+++ b/go/tools/bazel/runfiles.go
@@ -0,0 +1,442 @@
+// Copyright 2018 The Bazel Authors.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package bazel
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "io/ioutil"
+ "os"
+ "path"
+ "path/filepath"
+ "runtime"
+ "sort"
+ "strings"
+ "sync"
+)
+
+const (
+ RUNFILES_MANIFEST_FILE = "RUNFILES_MANIFEST_FILE"
+ RUNFILES_DIR = "RUNFILES_DIR"
+)
+
+// Runfile returns an absolute path to the file named by "path", which
+// should be a relative path from the workspace root to the file within
+// the bazel workspace.
+//
+// Runfile may be called from tests invoked with 'bazel test' and
+// binaries invoked with 'bazel run'. On Windows,
+// only tests invoked with 'bazel test' are supported.
+//
+// Deprecated: Use github.com/bazelbuild/rules_go/go/runfiles instead for
+// cross-platform support matching the behavior of the Bazel-provided runfiles
+// libraries.
+func Runfile(path string) (string, error) {
+ // Search in working directory
+ if _, err := os.Stat(path); err == nil {
+ return filepath.Abs(path)
+ }
+
+ if err := ensureRunfiles(); err != nil {
+ return "", err
+ }
+
+ // Search manifest if we have one.
+ if entry, ok := runfiles.index.GetIgnoringWorkspace(path); ok {
+ return entry.Path, nil
+ }
+
+ if strings.HasPrefix(path, "../") || strings.HasPrefix(path, "external/") {
+ pathParts := strings.Split(path, "/")
+ if len(pathParts) >= 3 {
+ workspace := pathParts[1]
+ pathInsideWorkspace := strings.Join(pathParts[2:], "/")
+ if path := runfiles.index.Get(workspace, pathInsideWorkspace); path != "" {
+ return path, nil
+ }
+ }
+ }
+
+ // Search the main workspace.
+ if runfiles.workspace != "" {
+ mainPath := filepath.Join(runfiles.dir, runfiles.workspace, path)
+ if _, err := os.Stat(mainPath); err == nil {
+ return mainPath, nil
+ }
+ }
+
+ // Search other workspaces.
+ for _, w := range runfiles.workspaces {
+ workPath := filepath.Join(runfiles.dir, w, path)
+ if _, err := os.Stat(workPath); err == nil {
+ return workPath, nil
+ }
+ }
+
+ return "", fmt.Errorf("Runfile %s: could not locate file", path)
+}
+
+// FindBinary returns an absolute path to the binary built from a go_binary
+// rule in the given package with the given name. FindBinary is similar to
+// Runfile, but it accounts for varying configurations and file extensions,
+// which may cause the binary to have different paths on different platforms.
+//
+// FindBinary may be called from tests invoked with 'bazel test' and
+// binaries invoked with 'bazel run'. On Windows,
+// only tests invoked with 'bazel test' are supported.
+func FindBinary(pkg, name string) (string, bool) {
+ if err := ensureRunfiles(); err != nil {
+ return "", false
+ }
+
+ // If we've gathered a list of runfiles, either by calling ListRunfiles or
+ // parsing the manifest on Windows, just use that instead of searching
+ // directories. Return the first match. The manifest on Windows may contain
+ // multiple entries for the same file.
+ if runfiles.list != nil {
+ if runtime.GOOS == "windows" {
+ name += ".exe"
+ }
+ for _, entry := range runfiles.list {
+ if path.Base(entry.ShortPath) != name {
+ continue
+ }
+ pkgDir := path.Dir(path.Dir(entry.ShortPath))
+ if pkgDir == "." {
+ pkgDir = ""
+ }
+ if pkgDir != pkg {
+ continue
+ }
+ return entry.Path, true
+ }
+ return "", false
+ }
+
+ dir, err := Runfile(pkg)
+ if err != nil {
+ return "", false
+ }
+ var found string
+ stopErr := errors.New("stop")
+ err = filepath.Walk(dir, func(path string, info os.FileInfo, err error) error {
+ if err != nil {
+ return err
+ }
+ if info.IsDir() {
+ return nil
+ }
+ base := filepath.Base(path)
+ stem := strings.TrimSuffix(base, ".exe")
+ if stem != name {
+ return nil
+ }
+ if runtime.GOOS != "windows" {
+ if st, err := os.Stat(path); err != nil {
+ return err
+ } else if st.Mode()&0111 == 0 {
+ return nil
+ }
+ }
+ if stem == name {
+ found = path
+ return stopErr
+ }
+ return nil
+ })
+ if err == stopErr {
+ return found, true
+ } else {
+ return "", false
+ }
+}
+
+// A RunfileEntry describes a runfile.
+type RunfileEntry struct {
+ // Workspace is the bazel workspace the file came from. For example,
+ // this would be "io_bazel_rules_go" for a file in rules_go.
+ Workspace string
+
+ // ShortPath is a relative, slash-separated path from the workspace root
+ // to the file. For non-binary files, this may be passed to Runfile
+ // to locate a file.
+ ShortPath string
+
+ // Path is an absolute path to the file.
+ Path string
+}
+
+// ListRunfiles returns a list of available runfiles.
+func ListRunfiles() ([]RunfileEntry, error) {
+ if err := ensureRunfiles(); err != nil {
+ return nil, err
+ }
+
+ if runfiles.list == nil && runfiles.dir != "" {
+ runfiles.listOnce.Do(func() {
+ var list []RunfileEntry
+ haveWorkspaces := strings.HasSuffix(runfiles.dir, ".runfiles") && runfiles.workspace != ""
+
+ err := filepath.Walk(runfiles.dir, func(path string, info os.FileInfo, err error) error {
+ if err != nil {
+ return err
+ }
+ rel, _ := filepath.Rel(runfiles.dir, path)
+ rel = filepath.ToSlash(rel)
+ if rel == "." {
+ return nil
+ }
+
+ var workspace, shortPath string
+ if haveWorkspaces {
+ if i := strings.IndexByte(rel, '/'); i < 0 {
+ return nil
+ } else {
+ workspace, shortPath = rel[:i], rel[i+1:]
+ }
+ } else {
+ workspace, shortPath = "", rel
+ }
+
+ list = append(list, RunfileEntry{Workspace: workspace, ShortPath: shortPath, Path: path})
+ return nil
+ })
+ if err != nil {
+ runfiles.err = err
+ return
+ }
+ runfiles.list = list
+ })
+ }
+ return runfiles.list, runfiles.err
+}
+
+// TestWorkspace returns the name of the Bazel workspace for this test.
+// TestWorkspace returns an error if the TEST_WORKSPACE environment variable
+// was not set or SetDefaultTestWorkspace was not called.
+func TestWorkspace() (string, error) {
+ if err := ensureRunfiles(); err != nil {
+ return "", err
+ }
+ if runfiles.workspace != "" {
+ return runfiles.workspace, nil
+ }
+ return "", errors.New("TEST_WORKSPACE not set and SetDefaultTestWorkspace not called")
+}
+
+// SetDefaultTestWorkspace allows you to set a fake value for the
+// environment variable TEST_WORKSPACE if it is not defined. This is useful
+// when running tests on the command line and not through Bazel.
+func SetDefaultTestWorkspace(w string) {
+ ensureRunfiles()
+ runfiles.workspace = w
+}
+
+// RunfilesPath return the path to the runfiles tree.
+// It will return an error if there is no runfiles tree, for example because
+// the executable is run on Windows or was not invoked with 'bazel test'
+// or 'bazel run'.
+func RunfilesPath() (string, error) {
+ if err := ensureRunfiles(); err != nil {
+ return "", err
+ }
+ if runfiles.dir == "" {
+ if runtime.GOOS == "windows" {
+ return "", errors.New("RunfilesPath: no runfiles directory on windows")
+ } else {
+ return "", errors.New("could not locate runfiles directory")
+ }
+ }
+ if runfiles.workspace == "" {
+ return "", errors.New("could not locate runfiles workspace")
+ }
+ return filepath.Join(runfiles.dir, runfiles.workspace), nil
+}
+
+var runfiles = struct {
+ once, listOnce sync.Once
+
+ // list is a list of known runfiles, either loaded from the manifest
+ // or discovered by walking the runfile directory.
+ list []RunfileEntry
+
+ // index maps runfile short paths to absolute paths.
+ index index
+
+ // dir is a path to the runfile directory. Typically this is a directory
+ // named <target>.runfiles, with a subdirectory for each workspace.
+ dir string
+
+ // workspace is workspace where the binary or test was built.
+ workspace string
+
+ // workspaces is a list of other workspace names.
+ workspaces []string
+
+ // err is set when there is an error loading runfiles, for example,
+ // parsing the manifest.
+ err error
+}{}
+
+type index struct {
+ indexWithWorkspace map[indexKey]*RunfileEntry
+ indexIgnoringWorksapce map[string]*RunfileEntry
+}
+
+func newIndex() index {
+ return index{
+ indexWithWorkspace: make(map[indexKey]*RunfileEntry),
+ indexIgnoringWorksapce: make(map[string]*RunfileEntry),
+ }
+}
+
+func (i *index) Put(entry *RunfileEntry) {
+ i.indexWithWorkspace[indexKey{
+ workspace: entry.Workspace,
+ shortPath: entry.ShortPath,
+ }] = entry
+ i.indexIgnoringWorksapce[entry.ShortPath] = entry
+}
+
+func (i *index) Get(workspace string, shortPath string) string {
+ entry := i.indexWithWorkspace[indexKey{
+ workspace: workspace,
+ shortPath: shortPath,
+ }]
+ if entry == nil {
+ return ""
+ }
+ return entry.Path
+}
+
+func (i *index) GetIgnoringWorkspace(shortPath string) (*RunfileEntry, bool) {
+ entry, ok := i.indexIgnoringWorksapce[shortPath]
+ return entry, ok
+}
+
+type indexKey struct {
+ workspace string
+ shortPath string
+}
+
+func ensureRunfiles() error {
+ runfiles.once.Do(initRunfiles)
+ return runfiles.err
+}
+
+func initRunfiles() {
+ manifest := os.Getenv("RUNFILES_MANIFEST_FILE")
+ if manifest != "" {
+ // On Windows, Bazel doesn't create a symlink tree of runfiles because
+ // Windows doesn't support symbolic links by default. Instead, runfile
+ // locations are written to a manifest file.
+ runfiles.index = newIndex()
+ data, err := ioutil.ReadFile(manifest)
+ if err != nil {
+ runfiles.err = err
+ return
+ }
+ lineno := 0
+ for len(data) > 0 {
+ i := bytes.IndexByte(data, '\n')
+ var line []byte
+ if i < 0 {
+ line = data
+ data = nil
+ } else {
+ line = data[:i]
+ data = data[i+1:]
+ }
+ lineno++
+
+ // Only TrimRight newlines. Do not TrimRight() completely, because that would remove spaces too.
+ // This is necessary in order to have at least one space in every manifest line.
+ // Some manifest entries don't have any path after this space, namely the "__init__.py" entries.
+ // original comment sourced from: https://github.com/bazelbuild/bazel/blob/09c621e4cf5b968f4c6cdf905ab142d5961f9ddc/src/test/py/bazel/runfiles_test.py#L225
+ line = bytes.TrimRight(line, "\r\n")
+ if len(line) == 0 {
+ continue
+ }
+
+ spaceIndex := bytes.IndexByte(line, ' ')
+ if spaceIndex < 0 {
+ runfiles.err = fmt.Errorf(
+ "error parsing runfiles manifest: %s:%d: no space: '%s'", manifest, lineno, line)
+ return
+ }
+ shortPath := string(line[0:spaceIndex])
+ abspath := ""
+ if len(line) > spaceIndex+1 {
+ abspath = string(line[spaceIndex+1:])
+ }
+
+ entry := RunfileEntry{ShortPath: shortPath, Path: abspath}
+ if i := strings.IndexByte(entry.ShortPath, '/'); i >= 0 {
+ entry.Workspace = entry.ShortPath[:i]
+ entry.ShortPath = entry.ShortPath[i+1:]
+ }
+ if strings.HasPrefix(entry.ShortPath, "external/") {
+ entry.ShortPath = entry.ShortPath[len("external/"):]
+ if i := strings.IndexByte(entry.ShortPath, '/'); i >= 0 {
+ entry.Workspace = entry.ShortPath[:i]
+ entry.ShortPath = entry.ShortPath[i+1:]
+ }
+ }
+
+ runfiles.list = append(runfiles.list, entry)
+ runfiles.index.Put(&entry)
+ }
+ }
+
+ runfiles.workspace = os.Getenv("TEST_WORKSPACE")
+
+ if dir := os.Getenv("RUNFILES_DIR"); dir != "" {
+ runfiles.dir = dir
+ } else if dir = os.Getenv("TEST_SRCDIR"); dir != "" {
+ runfiles.dir = dir
+ } else if runtime.GOOS != "windows" {
+ dir, err := os.Getwd()
+ if err != nil {
+ runfiles.err = fmt.Errorf("error locating runfiles dir: %v", err)
+ return
+ }
+
+ parent := filepath.Dir(dir)
+ if strings.HasSuffix(parent, ".runfiles") {
+ runfiles.dir = parent
+ if runfiles.workspace == "" {
+ runfiles.workspace = filepath.Base(dir)
+ }
+ } else {
+ runfiles.err = errors.New("could not locate runfiles directory")
+ return
+ }
+ }
+
+ if runfiles.dir != "" {
+ fis, err := ioutil.ReadDir(runfiles.dir)
+ if err != nil {
+ runfiles.err = fmt.Errorf("could not open runfiles directory: %v", err)
+ return
+ }
+ for _, fi := range fis {
+ if fi.IsDir() {
+ runfiles.workspaces = append(runfiles.workspaces, fi.Name())
+ }
+ }
+ sort.Strings(runfiles.workspaces)
+ }
+}
diff --git a/go/tools/bazel_benchmark/BUILD.bazel b/go/tools/bazel_benchmark/BUILD.bazel
new file mode 100644
index 00000000..8e1f9ec2
--- /dev/null
+++ b/go/tools/bazel_benchmark/BUILD.bazel
@@ -0,0 +1,14 @@
+load("//go:def.bzl", "go_binary", "go_library")
+
+go_binary(
+ name = "bazel_benchmark",
+ embed = [":bazel_benchmark_lib"],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "bazel_benchmark_lib",
+ srcs = ["bazel_benchmark.go"],
+ importpath = "github.com/bazelbuild/rules_go/go/tools/bazel_benchmark",
+ visibility = ["//visibility:private"],
+)
diff --git a/go/tools/bazel_benchmark/BUILD.bazel.in b/go/tools/bazel_benchmark/BUILD.bazel.in
new file mode 100644
index 00000000..6e95da13
--- /dev/null
+++ b/go/tools/bazel_benchmark/BUILD.bazel.in
@@ -0,0 +1,6 @@
+load("//go:def.bzl", "go_binary")
+
+go_binary(
+ name = "hello",
+ srcs = ["hello.go"],
+)
diff --git a/go/tools/bazel_benchmark/WORKSPACE.in b/go/tools/bazel_benchmark/WORKSPACE.in
new file mode 100644
index 00000000..62941aef
--- /dev/null
+++ b/go/tools/bazel_benchmark/WORKSPACE.in
@@ -0,0 +1,26 @@
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+local_repository(
+ name = "io_bazel_rules_go",
+ path = "{{.RulesGoDir}}",
+)
+
+http_archive(
+ name = "bazel_gazelle",
+ urls = ["https://github.com/bazelbuild/bazel-gazelle/releases/download/0.13.0/bazel-gazelle-0.13.0.tar.gz"],
+ sha256 = "bc653d3e058964a5a26dcad02b6c72d7d63e6bb88d94704990b908a1445b8758",
+)
+
+load("@io_bazel_rules_go//go:def.bzl", "go_register_toolchains", "go_rules_dependencies")
+
+go_rules_dependencies()
+
+go_register_toolchains(go_version = "host")
+
+load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
+
+gazelle_dependencies()
+
+load("@io_bazel_rules_go//tests/integration/popular_repos:popular_repos.bzl", "popular_repos")
+
+popular_repos()
diff --git a/go/tools/bazel_benchmark/bazel_benchmark.go b/go/tools/bazel_benchmark/bazel_benchmark.go
new file mode 100644
index 00000000..30a32ab8
--- /dev/null
+++ b/go/tools/bazel_benchmark/bazel_benchmark.go
@@ -0,0 +1,400 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "bytes"
+ "encoding/csv"
+ "errors"
+ "flag"
+ "fmt"
+ "io/ioutil"
+ "log"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "text/template"
+ "time"
+)
+
+var programName = filepath.Base(os.Args[0])
+
+type substitutions struct {
+ RulesGoDir string
+}
+
+type serverState int
+
+const (
+ asleep serverState = iota
+ awake
+)
+
+type cleanState int
+
+const (
+ clean cleanState = iota
+ incr
+)
+
+type benchmark struct {
+ desc string
+ serverState serverState
+ cleanState cleanState
+ incrFile string
+ targets []string
+ result time.Duration
+}
+
+var benchmarks = []benchmark{
+ {
+ desc: "hello_asleep_clean",
+ serverState: asleep,
+ cleanState: clean,
+ targets: []string{"//:hello"},
+ }, {
+ desc: "hello_awake_clean",
+ serverState: awake,
+ cleanState: clean,
+ targets: []string{"//:hello"},
+ }, {
+ desc: "hello_asleep_incr",
+ serverState: asleep,
+ cleanState: incr,
+ incrFile: "hello.go",
+ targets: []string{"//:hello"},
+ }, {
+ desc: "hello_awake_incr",
+ serverState: awake,
+ cleanState: incr,
+ incrFile: "hello.go",
+ targets: []string{"//:hello"},
+ }, {
+ desc: "popular_repos_awake_clean",
+ serverState: awake,
+ cleanState: clean,
+ targets: []string{"@io_bazel_rules_go//tests/integration/popular_repos:all"},
+ },
+ // TODO: more substantial Kubernetes targets
+}
+
+func main() {
+ log.SetFlags(0)
+ log.SetPrefix(programName + ": ")
+ if err := run(os.Args[1:]); err != nil {
+ log.Fatal(err)
+ }
+}
+
+func run(args []string) error {
+ fs := flag.NewFlagSet(programName, flag.ExitOnError)
+ var rulesGoDir, outPath string
+ fs.StringVar(&rulesGoDir, "rules_go_dir", "", "directory where rules_go is checked out")
+ fs.StringVar(&outPath, "out", "", "csv file to append results to")
+ var keep bool
+ fs.BoolVar(&keep, "keep", false, "if true, the workspace directory won't be deleted at the end")
+ if err := fs.Parse(args); err != nil {
+ return err
+ }
+ if rulesGoDir == "" {
+ return errors.New("-rules_go_dir not set")
+ }
+ if abs, err := filepath.Abs(rulesGoDir); err != nil {
+ return err
+ } else {
+ rulesGoDir = abs
+ }
+ if outPath == "" {
+ return errors.New("-out not set")
+ }
+ if abs, err := filepath.Abs(outPath); err != nil {
+ return err
+ } else {
+ outPath = abs
+ }
+
+ commit, err := getCommit(rulesGoDir)
+ if err != nil {
+ return err
+ }
+
+ dir, err := setupWorkspace(rulesGoDir)
+ if err != nil {
+ return err
+ }
+ if !keep {
+ defer cleanupWorkspace(dir)
+ }
+
+ bazelVersion, err := getBazelVersion()
+ if err != nil {
+ return err
+ }
+
+ log.Printf("running benchmarks in %s", dir)
+ targetSet := make(map[string]bool)
+ for _, b := range benchmarks {
+ for _, t := range b.targets {
+ targetSet[t] = true
+ }
+ }
+ allTargets := make([]string, 0, len(targetSet))
+ for t := range targetSet {
+ allTargets = append(allTargets, t)
+ }
+ fetch(allTargets)
+
+ for i := range benchmarks {
+ b := &benchmarks[i]
+ log.Printf("running benchmark %d/%d: %s", i+1, len(benchmarks), b.desc)
+ if err := runBenchmark(b); err != nil {
+ return fmt.Errorf("error running benchmark %s: %v", b.desc, err)
+ }
+ }
+
+ log.Printf("writing results to %s", outPath)
+ return recordResults(outPath, time.Now().UTC(), bazelVersion, commit, benchmarks)
+}
+
+func getCommit(rulesGoDir string) (commit string, err error) {
+ wd, err := os.Getwd()
+ if err != nil {
+ return "", err
+ }
+ if err := os.Chdir(rulesGoDir); err != nil {
+ return "", err
+ }
+ defer func() {
+ if cderr := os.Chdir(wd); cderr != nil {
+ if err != nil {
+ err = cderr
+ }
+ }
+ }()
+ out, err := exec.Command("git", "rev-parse", "HEAD").Output()
+ if err != nil {
+ return "", err
+ }
+ outStr := strings.TrimSpace(string(out))
+ if len(outStr) < 7 {
+ return "", errors.New("git output too short")
+ }
+ return outStr[:7], nil
+}
+
+func setupWorkspace(rulesGoDir string) (workspaceDir string, err error) {
+ workspaceDir, err = ioutil.TempDir("", "bazel_benchmark")
+ if err != nil {
+ return "", err
+ }
+ defer func() {
+ if err != nil {
+ os.RemoveAll(workspaceDir)
+ }
+ }()
+ benchmarkDir := filepath.Join(rulesGoDir, "go", "tools", "bazel_benchmark")
+ files, err := ioutil.ReadDir(benchmarkDir)
+ if err != nil {
+ return "", err
+ }
+ substitutions := substitutions{
+ RulesGoDir: filepath.Join(benchmarkDir, "..", "..", ".."),
+ }
+ for _, f := range files {
+ name := f.Name()
+ if filepath.Ext(name) != ".in" {
+ continue
+ }
+ srcPath := filepath.Join(benchmarkDir, name)
+ tpl, err := template.ParseFiles(srcPath)
+ if err != nil {
+ return "", err
+ }
+ dstPath := filepath.Join(workspaceDir, name[:len(name)-len(".in")])
+ out, err := os.Create(dstPath)
+ if err != nil {
+ return "", err
+ }
+ if err := tpl.Execute(out, substitutions); err != nil {
+ out.Close()
+ return "", err
+ }
+ if err := out.Close(); err != nil {
+ return "", err
+ }
+ }
+ if err := os.Chdir(workspaceDir); err != nil {
+ return "", err
+ }
+ return workspaceDir, nil
+}
+
+func cleanupWorkspace(dir string) error {
+ if err := logBazelCommand("clean", "--expunge"); err != nil {
+ return err
+ }
+ return os.RemoveAll(dir)
+}
+
+func getBazelVersion() (string, error) {
+ out, err := exec.Command("bazel", "version").Output()
+ if err != nil {
+ return "", err
+ }
+ prefix := []byte("Build label: ")
+ i := bytes.Index(out, prefix)
+ if i < 0 {
+ return "", errors.New("could not find bazel version in output")
+ }
+ out = out[i+len(prefix):]
+ i = bytes.IndexByte(out, '\n')
+ if i >= 0 {
+ out = out[:i]
+ }
+ return string(out), nil
+}
+
+func fetch(targets []string) error {
+ return logBazelCommand("fetch", targets...)
+}
+
+func runBenchmark(b *benchmark) error {
+ switch b.cleanState {
+ case clean:
+ if err := logBazelCommand("clean"); err != nil {
+ return err
+ }
+ case incr:
+ if err := logBazelCommand("build", b.targets...); err != nil {
+ return err
+ }
+ if b.incrFile == "" {
+ return errors.New("incrFile not set")
+ }
+ data, err := ioutil.ReadFile(b.incrFile)
+ if err != nil {
+ return err
+ }
+ data = bytes.Replace(data, []byte("INCR"), []byte("INCR."), -1)
+ if err := ioutil.WriteFile(b.incrFile, data, 0666); err != nil {
+ return err
+ }
+ }
+ if b.serverState == asleep {
+ if err := logBazelCommand("shutdown"); err != nil {
+ return err
+ }
+ }
+ start := time.Now()
+ if err := logBazelCommand("build", b.targets...); err != nil {
+ return err
+ }
+ b.result = time.Since(start)
+ return nil
+}
+
+func recordResults(outPath string, t time.Time, bazelVersion, commit string, benchmarks []benchmark) (err error) {
+ // TODO(jayconrod): update the header if new columns are added.
+ columnMap, outExists, err := buildColumnMap(outPath, benchmarks)
+ header := buildHeader(columnMap)
+ record := buildRecord(t, bazelVersion, commit, benchmarks, columnMap)
+ defer func() {
+ if err != nil {
+ log.Printf("error writing results: %s: %v", outPath, err)
+ log.Print("data are printed below")
+ log.Print(strings.Join(header, ","))
+ log.Print(strings.Join(record, ","))
+ }
+ }()
+ outFile, err := os.OpenFile(outPath, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666)
+ if err != nil {
+ return err
+ }
+ defer func() {
+ if cerr := outFile.Close(); err != nil {
+ err = cerr
+ }
+ }()
+ outCsv := csv.NewWriter(outFile)
+ if !outExists {
+ outCsv.Write(header)
+ }
+ outCsv.Write(record)
+ outCsv.Flush()
+ return outCsv.Error()
+}
+
+func logBazelCommand(command string, args ...string) error {
+ args = append([]string{command}, args...)
+ cmd := exec.Command("bazel", args...)
+ log.Printf("bazel %s\n", strings.Join(args, " "))
+ cmd.Stdout = os.Stderr
+ cmd.Stderr = os.Stderr
+ return cmd.Run()
+}
+
+func buildColumnMap(outPath string, benchmarks []benchmark) (columnMap map[string]int, outExists bool, err error) {
+ columnMap = make(map[string]int)
+ {
+ inFile, oerr := os.Open(outPath)
+ if oerr != nil {
+ goto doneReading
+ }
+ outExists = true
+ defer inFile.Close()
+ inCsv := csv.NewReader(inFile)
+ var header []string
+ header, err = inCsv.Read()
+ if err != nil {
+ goto doneReading
+ }
+ for i, column := range header {
+ columnMap[column] = i
+ }
+ }
+
+doneReading:
+ for _, s := range []string{"time", "bazel_version", "commit"} {
+ if _, ok := columnMap[s]; !ok {
+ columnMap[s] = len(columnMap)
+ }
+ }
+ for _, b := range benchmarks {
+ if _, ok := columnMap[b.desc]; !ok {
+ columnMap[b.desc] = len(columnMap)
+ }
+ }
+ return columnMap, outExists, err
+}
+
+func buildHeader(columnMap map[string]int) []string {
+ header := make([]string, len(columnMap))
+ for name, i := range columnMap {
+ header[i] = name
+ }
+ return header
+}
+
+func buildRecord(t time.Time, bazelVersion, commit string, benchmarks []benchmark, columnMap map[string]int) []string {
+ record := make([]string, len(columnMap))
+ record[columnMap["time"]] = t.Format("2006-01-02 15:04:05")
+ record[columnMap["bazel_version"]] = bazelVersion
+ record[columnMap["commit"]] = commit
+ for _, b := range benchmarks {
+ record[columnMap[b.desc]] = fmt.Sprintf("%.3f", b.result.Seconds())
+ }
+ return record
+}
diff --git a/go/tools/bazel_benchmark/bazel_benchmark.sh b/go/tools/bazel_benchmark/bazel_benchmark.sh
new file mode 100755
index 00000000..8abf0bd8
--- /dev/null
+++ b/go/tools/bazel_benchmark/bazel_benchmark.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+# Copyright 2018 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+set -euo pipefail
+
+rules_go_dir=$(mktemp --directory --tmpdir rules_go.XXXXXX)
+function cleanup {
+ rm -rf "$rules_go_dir"
+}
+trap cleanup EXIT
+
+git clone --depth=1 --single-branch --no-tags \
+ https://github.com/bazelbuild/rules_go "$rules_go_dir"
+cd "$rules_go_dir"
+bazel run //go/tools/bazel_benchmark -- -rules_go_dir "$rules_go_dir" "$@"
+
diff --git a/go/tools/bazel_benchmark/hello.go.in b/go/tools/bazel_benchmark/hello.go.in
new file mode 100644
index 00000000..27d1996d
--- /dev/null
+++ b/go/tools/bazel_benchmark/hello.go.in
@@ -0,0 +1,9 @@
+package main
+
+import "fmt"
+
+const incr = "INCR"
+
+func main() {
+ fmt.Println(incr)
+}
diff --git a/go/tools/bazel_testing/BUILD.bazel b/go/tools/bazel_testing/BUILD.bazel
new file mode 100644
index 00000000..9089774d
--- /dev/null
+++ b/go/tools/bazel_testing/BUILD.bazel
@@ -0,0 +1,33 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+load("//go:def.bzl", "go_library")
+
+go_library(
+ name = "bazel_testing",
+ srcs = ["bazel_testing.go"],
+ importpath = "github.com/bazelbuild/rules_go/go/tools/bazel_testing",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//go/tools/bazel",
+ "//go/tools/internal/txtar",
+ ],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":bazel_testing",
+ visibility = ["//visibility:public"],
+)
+
+bzl_library(
+ name = "def",
+ srcs = ["def.bzl"],
+ visibility = ["//visibility:public"],
+ deps = ["//go:def"],
+)
diff --git a/go/tools/bazel_testing/bazel_testing.go b/go/tools/bazel_testing/bazel_testing.go
new file mode 100644
index 00000000..45431405
--- /dev/null
+++ b/go/tools/bazel_testing/bazel_testing.go
@@ -0,0 +1,535 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package bazel_testing provides an integration testing framework for
+// testing rules_go with Bazel.
+//
+// Tests may be written by declaring a go_bazel_test target instead of
+// a go_test (go_bazel_test is defined in def.bzl here), then calling
+// TestMain. Tests are run in a synthetic test workspace. Tests may run
+// bazel commands with RunBazel.
+package bazel_testing
+
+import (
+ "bytes"
+ "flag"
+ "fmt"
+ "io"
+ "io/ioutil"
+ "os"
+ "os/exec"
+ "os/signal"
+ "path"
+ "path/filepath"
+ "regexp"
+ "runtime"
+ "sort"
+ "strings"
+ "testing"
+ "text/template"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+ "github.com/bazelbuild/rules_go/go/tools/internal/txtar"
+)
+
+const (
+ // Standard Bazel exit codes.
+ // A subset of codes in https://cs.opensource.google/bazel/bazel/+/master:src/main/java/com/google/devtools/build/lib/util/ExitCode.java.
+ SUCCESS = 0
+ BUILD_FAILURE = 1
+ COMMAND_LINE_ERROR = 2
+ TESTS_FAILED = 3
+ NO_TESTS_FOUND = 4
+ RUN_FAILURE = 6
+ ANALYSIS_FAILURE = 7
+ INTERRUPTED = 8
+ LOCK_HELD_NOBLOCK_FOR_LOCK = 9
+)
+
+// Args is a list of arguments to TestMain. It's defined as a struct so
+// that new optional arguments may be added without breaking compatibility.
+type Args struct {
+ // Main is a text archive containing files in the main workspace.
+ // The text archive format is parsed by
+ // //go/tools/internal/txtar:go_default_library, which is copied from
+ // cmd/go/internal/txtar. If this archive does not contain a WORKSPACE file,
+ // a default file will be synthesized.
+ Main string
+
+ // Nogo is the nogo target to pass to go_register_toolchains. By default,
+ // nogo is not used.
+ Nogo string
+
+ // WorkspaceSuffix is a string that should be appended to the end
+ // of the default generated WORKSPACE file.
+ WorkspaceSuffix string
+
+ // SetUp is a function that is executed inside the context of the testing
+ // workspace. It is executed once and only once before the beginning of
+ // all tests. If SetUp returns a non-nil error, execution is halted and
+ // tests cases are not executed.
+ SetUp func() error
+}
+
+// debug may be set to make the test print the test workspace path and stop
+// instead of running tests.
+const debug = false
+
+// outputUserRoot is set to the directory where Bazel should put its internal files.
+// Since Bazel 2.0.0, this needs to be set explicitly to avoid it defaulting to a
+// deeply nested directory within the test, which runs into Windows path length limits.
+// We try to detect the original value in setupWorkspace and set it to that.
+var outputUserRoot string
+
+// TestMain should be called by tests using this framework from a function named
+// "TestMain". For example:
+//
+// func TestMain(m *testing.M) {
+// os.Exit(bazel_testing.TestMain(m, bazel_testing.Args{...}))
+// }
+//
+// TestMain constructs a set of workspaces and changes the working directory to
+// the main workspace.
+func TestMain(m *testing.M, args Args) {
+ // Defer os.Exit with the correct code. This ensures other deferred cleanup
+ // functions are run first.
+ code := 1
+ defer func() {
+ if r := recover(); r != nil {
+ fmt.Fprintf(os.Stderr, "panic: %v\n", r)
+ code = 1
+ }
+ os.Exit(code)
+ }()
+
+ files, err := bazel.SpliceDelimitedOSArgs("-begin_files", "-end_files")
+ if err != nil {
+ fmt.Fprint(os.Stderr, err)
+ return
+ }
+
+ flag.Parse()
+
+ workspaceDir, cleanup, err := setupWorkspace(args, files)
+ defer func() {
+ if err := cleanup(); err != nil {
+ fmt.Fprintf(os.Stderr, "cleanup error: %v\n", err)
+ // Don't fail the test on a cleanup error.
+ // Some operating systems (windows, maybe also darwin) can't reliably
+ // delete executable files after they're run.
+ }
+ }()
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "error: %v\n", err)
+ return
+ }
+
+ if debug {
+ fmt.Fprintf(os.Stderr, "test setup in %s\n", workspaceDir)
+ interrupted := make(chan os.Signal)
+ signal.Notify(interrupted, os.Interrupt)
+ <-interrupted
+ return
+ }
+
+ if err := os.Chdir(workspaceDir); err != nil {
+ fmt.Fprintf(os.Stderr, "%v\n", err)
+ return
+ }
+ defer exec.Command("bazel", "shutdown").Run()
+
+ if args.SetUp != nil {
+ if err := args.SetUp(); err != nil {
+ fmt.Fprintf(os.Stderr, "test provided SetUp method returned error: %v\n", err)
+ return
+ }
+ }
+
+ code = m.Run()
+}
+
+// BazelCmd prepares a bazel command for execution. It chooses the correct
+// bazel binary based on the environment and sanitizes the environment to
+// hide that this code is executing inside a bazel test.
+func BazelCmd(args ...string) *exec.Cmd {
+ cmd := exec.Command("bazel")
+ if outputUserRoot != "" {
+ cmd.Args = append(cmd.Args,
+ "--output_user_root="+outputUserRoot,
+ "--nosystem_rc",
+ "--nohome_rc",
+ )
+ }
+ cmd.Args = append(cmd.Args, args...)
+ for _, e := range os.Environ() {
+ // Filter environment variables set by the bazel test wrapper script.
+ // These confuse recursive invocations of Bazel.
+ if strings.HasPrefix(e, "TEST_") || strings.HasPrefix(e, "RUNFILES_") {
+ continue
+ }
+ cmd.Env = append(cmd.Env, e)
+ }
+ return cmd
+}
+
+// RunBazel invokes a bazel command with a list of arguments.
+//
+// If the command starts but exits with a non-zero status, a *StderrExitError
+// will be returned which wraps the original *exec.ExitError.
+func RunBazel(args ...string) error {
+ cmd := BazelCmd(args...)
+
+ buf := &bytes.Buffer{}
+ cmd.Stderr = buf
+ err := cmd.Run()
+ if eErr, ok := err.(*exec.ExitError); ok {
+ eErr.Stderr = buf.Bytes()
+ err = &StderrExitError{Err: eErr}
+ }
+ return err
+}
+
+// BazelOutput invokes a bazel command with a list of arguments and returns
+// the content of stdout.
+//
+// If the command starts but exits with a non-zero status, a *StderrExitError
+// will be returned which wraps the original *exec.ExitError.
+func BazelOutput(args ...string) ([]byte, error) {
+ cmd := BazelCmd(args...)
+ stdout := &bytes.Buffer{}
+ stderr := &bytes.Buffer{}
+ cmd.Stdout = stdout
+ cmd.Stderr = stderr
+ err := cmd.Run()
+ if eErr, ok := err.(*exec.ExitError); ok {
+ eErr.Stderr = stderr.Bytes()
+ err = &StderrExitError{Err: eErr}
+ }
+ return stdout.Bytes(), err
+}
+
+// StderrExitError wraps *exec.ExitError and prints the complete stderr output
+// from a command.
+type StderrExitError struct {
+ Err *exec.ExitError
+}
+
+func (e *StderrExitError) Error() string {
+ sb := &strings.Builder{}
+ sb.Write(e.Err.Stderr)
+ sb.WriteString(e.Err.Error())
+ return sb.String()
+}
+
+func (e *StderrExitError) Unwrap() error {
+ return e.Err
+}
+
+func setupWorkspace(args Args, files []string) (dir string, cleanup func() error, err error) {
+ var cleanups []func() error
+ cleanup = func() error {
+ var firstErr error
+ for i := len(cleanups) - 1; i >= 0; i-- {
+ if err := cleanups[i](); err != nil && firstErr == nil {
+ firstErr = err
+ }
+ }
+ return firstErr
+ }
+ defer func() {
+ if err != nil {
+ cleanup()
+ cleanup = func() error { return nil }
+ }
+ }()
+
+ // Find a suitable cache directory. We want something persistent where we
+ // can store a bazel output base across test runs, even for multiple tests.
+ var cacheDir, outBaseDir string
+ if tmpDir := os.Getenv("TEST_TMPDIR"); tmpDir != "" {
+ // TEST_TMPDIR is set by Bazel's test wrapper. Bazel itself uses this to
+ // detect that it's run by a test. When invoked like this, Bazel sets
+ // its output base directory to a temporary directory. This wastes a lot
+ // of time (a simple test takes 45s instead of 3s). We use TEST_TMPDIR
+ // to find a persistent location in the execroot. We won't pass TEST_TMPDIR
+ // to bazel in RunBazel.
+ tmpDir = filepath.Clean(tmpDir)
+ if i := strings.Index(tmpDir, string(os.PathSeparator)+"execroot"+string(os.PathSeparator)); i >= 0 {
+ outBaseDir = tmpDir[:i]
+ outputUserRoot = filepath.Dir(outBaseDir)
+ cacheDir = filepath.Join(outBaseDir, "bazel_testing")
+ } else {
+ cacheDir = filepath.Join(tmpDir, "bazel_testing")
+ }
+ } else {
+ // The test is not invoked by Bazel, so just use the user's cache.
+ cacheDir, err = os.UserCacheDir()
+ if err != nil {
+ return "", cleanup, err
+ }
+ cacheDir = filepath.Join(cacheDir, "bazel_testing")
+ }
+
+ // TODO(jayconrod): any other directories needed for caches?
+ execDir := filepath.Join(cacheDir, "bazel_go_test")
+ if err := os.RemoveAll(execDir); err != nil {
+ return "", cleanup, err
+ }
+ cleanups = append(cleanups, func() error { return os.RemoveAll(execDir) })
+
+ // Create the workspace directory.
+ mainDir := filepath.Join(execDir, "main")
+ if err := os.MkdirAll(mainDir, 0777); err != nil {
+ return "", cleanup, err
+ }
+
+ // Create a .bazelrc file if GO_BAZEL_TEST_BAZELFLAGS is set.
+ // The test can override this with its own .bazelrc or with flags in commands.
+ if flags := os.Getenv("GO_BAZEL_TEST_BAZELFLAGS"); flags != "" {
+ bazelrcPath := filepath.Join(mainDir, ".bazelrc")
+ content := "build " + flags
+ if err := ioutil.WriteFile(bazelrcPath, []byte(content), 0666); err != nil {
+ return "", cleanup, err
+ }
+ }
+
+ // Extract test files for the main workspace.
+ if err := extractTxtar(mainDir, args.Main); err != nil {
+ return "", cleanup, fmt.Errorf("building main workspace: %v", err)
+ }
+
+ // If some of the path arguments are missing an explicit workspace,
+ // read the workspace name from WORKSPACE. We need this to map arguments
+ // to runfiles in specific workspaces.
+ haveDefaultWorkspace := false
+ var defaultWorkspaceName string
+ for _, argPath := range files {
+ workspace, _, err := parseLocationArg(argPath)
+ if err == nil && workspace == "" {
+ haveDefaultWorkspace = true
+ cleanPath := path.Clean(argPath)
+ if cleanPath == "WORKSPACE" {
+ defaultWorkspaceName, err = loadWorkspaceName(cleanPath)
+ if err != nil {
+ return "", cleanup, fmt.Errorf("could not load default workspace name: %v", err)
+ }
+ break
+ }
+ }
+ }
+ if haveDefaultWorkspace && defaultWorkspaceName == "" {
+ return "", cleanup, fmt.Errorf("found files from default workspace, but not WORKSPACE")
+ }
+
+ // Index runfiles by workspace and short path. We need this to determine
+ // destination paths when we copy or link files.
+ runfiles, err := bazel.ListRunfiles()
+ if err != nil {
+ return "", cleanup, err
+ }
+
+ type runfileKey struct{ workspace, short string }
+ runfileMap := make(map[runfileKey]string)
+ for _, rf := range runfiles {
+ runfileMap[runfileKey{rf.Workspace, rf.ShortPath}] = rf.Path
+ }
+
+ // Copy or link file arguments from runfiles into fake workspace dirctories.
+ // Keep track of the workspace names we see, since we'll generate a WORKSPACE
+ // with local_repository rules later.
+ workspaceNames := make(map[string]bool)
+ for _, argPath := range files {
+ workspace, shortPath, err := parseLocationArg(argPath)
+ if err != nil {
+ return "", cleanup, err
+ }
+ if workspace == "" {
+ workspace = defaultWorkspaceName
+ }
+ workspaceNames[workspace] = true
+
+ srcPath, ok := runfileMap[runfileKey{workspace, shortPath}]
+ if !ok {
+ return "", cleanup, fmt.Errorf("unknown runfile: %s", argPath)
+ }
+ dstPath := filepath.Join(execDir, workspace, shortPath)
+ if err := copyOrLink(dstPath, srcPath); err != nil {
+ return "", cleanup, err
+ }
+ }
+
+ // If there's no WORKSPACE file, create one.
+ workspacePath := filepath.Join(mainDir, "WORKSPACE")
+ if _, err := os.Stat(workspacePath); os.IsNotExist(err) {
+ w, err := os.Create(workspacePath)
+ if err != nil {
+ return "", cleanup, err
+ }
+ defer func() {
+ if cerr := w.Close(); err == nil && cerr != nil {
+ err = cerr
+ }
+ }()
+ info := workspaceTemplateInfo{
+ Suffix: args.WorkspaceSuffix,
+ Nogo: args.Nogo,
+ }
+ for name := range workspaceNames {
+ info.WorkspaceNames = append(info.WorkspaceNames, name)
+ }
+ sort.Strings(info.WorkspaceNames)
+ if outBaseDir != "" {
+ goSDKPath := filepath.Join(outBaseDir, "external", "go_sdk")
+ rel, err := filepath.Rel(mainDir, goSDKPath)
+ if err != nil {
+ return "", cleanup, fmt.Errorf("could not find relative path from %q to %q for go_sdk", mainDir, goSDKPath)
+ }
+ rel = filepath.ToSlash(rel)
+ info.GoSDKPath = rel
+ }
+ if err := defaultWorkspaceTpl.Execute(w, info); err != nil {
+ return "", cleanup, err
+ }
+ }
+
+ return mainDir, cleanup, nil
+}
+
+func extractTxtar(dir, txt string) error {
+ ar := txtar.Parse([]byte(txt))
+ for _, f := range ar.Files {
+ if parentDir := filepath.Dir(f.Name); parentDir != "." {
+ if err := os.MkdirAll(filepath.Join(dir, parentDir), 0777); err != nil {
+ return err
+ }
+ }
+ if err := ioutil.WriteFile(filepath.Join(dir, f.Name), f.Data, 0666); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func parseLocationArg(arg string) (workspace, shortPath string, err error) {
+ cleanPath := path.Clean(arg)
+ if !strings.HasPrefix(cleanPath, "external/") {
+ return "", cleanPath, nil
+ }
+ i := strings.IndexByte(arg[len("external/"):], '/')
+ if i < 0 {
+ return "", "", fmt.Errorf("unexpected file (missing / after external/): %s", arg)
+ }
+ i += len("external/")
+ workspace = cleanPath[len("external/"):i]
+ shortPath = cleanPath[i+1:]
+ return workspace, shortPath, nil
+}
+
+func loadWorkspaceName(workspacePath string) (string, error) {
+ runfilePath, err := bazel.Runfile(workspacePath)
+ if err == nil {
+ workspacePath = runfilePath
+ }
+ workspaceData, err := ioutil.ReadFile(workspacePath)
+ if err != nil {
+ return "", err
+ }
+ nameRe := regexp.MustCompile(`(?m)^workspace\(\s*name\s*=\s*("[^"]*"|'[^']*')\s*,?\s*\)\s*$`)
+ match := nameRe.FindSubmatchIndex(workspaceData)
+ if match == nil {
+ return "", fmt.Errorf("%s: workspace name not set", workspacePath)
+ }
+ name := string(workspaceData[match[2]+1 : match[3]-1])
+ if name == "" {
+ return "", fmt.Errorf("%s: workspace name is empty", workspacePath)
+ }
+ return name, nil
+}
+
+type workspaceTemplateInfo struct {
+ WorkspaceNames []string
+ GoSDKPath string
+ Nogo string
+ Suffix string
+}
+
+var defaultWorkspaceTpl = template.Must(template.New("").Parse(`
+{{range .WorkspaceNames}}
+local_repository(
+ name = "{{.}}",
+ path = "../{{.}}",
+)
+{{end}}
+
+{{if not .GoSDKPath}}
+load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains")
+
+go_rules_dependencies()
+
+go_register_toolchains(go_version = "host")
+{{else}}
+local_repository(
+ name = "local_go_sdk",
+ path = "{{.GoSDKPath}}",
+)
+
+load("@io_bazel_rules_go//go:deps.bzl", "go_rules_dependencies", "go_register_toolchains", "go_wrap_sdk")
+
+go_rules_dependencies()
+
+go_wrap_sdk(
+ name = "go_sdk",
+ root_file = "@local_go_sdk//:ROOT",
+)
+
+go_register_toolchains({{if .Nogo}}nogo = "{{.Nogo}}"{{end}})
+{{end}}
+{{.Suffix}}
+`))
+
+func copyOrLink(dstPath, srcPath string) error {
+ if err := os.MkdirAll(filepath.Dir(dstPath), 0777); err != nil {
+ return err
+ }
+
+ copy := func(dstPath, srcPath string) (err error) {
+ src, err := os.Open(srcPath)
+ if err != nil {
+ return err
+ }
+ defer src.Close()
+
+ dst, err := os.Create(dstPath)
+ if err != nil {
+ return err
+ }
+ defer func() {
+ if cerr := dst.Close(); err == nil && cerr != nil {
+ err = cerr
+ }
+ }()
+
+ _, err = io.Copy(dst, src)
+ return err
+ }
+
+ if runtime.GOOS == "windows" {
+ return copy(dstPath, srcPath)
+ }
+ absSrcPath, err := filepath.Abs(srcPath)
+ if err != nil {
+ return err
+ }
+ return os.Symlink(absSrcPath, dstPath)
+}
diff --git a/go/tools/bazel_testing/def.bzl b/go/tools/bazel_testing/def.bzl
new file mode 100644
index 00000000..d097027b
--- /dev/null
+++ b/go/tools/bazel_testing/def.bzl
@@ -0,0 +1,62 @@
+# Copyright 2019 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("//go:def.bzl", "go_test")
+
+def go_bazel_test(rule_files = None, **kwargs):
+ """go_bazel_test is a wrapper for go_test that simplifies the use of
+ //go/tools/bazel_testing. Tests may be written
+ that don't explicitly depend on bazel_testing or rules_go files.
+ """
+
+ if not rule_files:
+ rule_files = [Label("//:all_files")]
+
+ # Add dependency on bazel_testing library.
+ kwargs.setdefault("deps", [])
+
+ bazel_testing_library = "@io_bazel_rules_go//go/tools/bazel_testing"
+ if bazel_testing_library not in kwargs["deps"]:
+ kwargs["deps"].append(bazel_testing_library)
+
+ # Add data dependency on rules_go files. bazel_testing will copy or link
+ # these files in an external repo.
+ kwargs.setdefault("data", [])
+ kwargs["data"] += rule_files
+
+ # Add paths to rules_go files to arguments. bazel_testing will copy or link
+ # these files.
+ kwargs.setdefault("args", [])
+ kwargs["args"] = (["-begin_files"] +
+ ["$(locations {})".format(t) for t in rule_files] +
+ ["-end_files"] +
+ kwargs["args"])
+
+ # Set rundir to the workspace root directory to ensure relative paths
+ # are interpreted correctly.
+ kwargs.setdefault("rundir", ".")
+
+ # Set tags.
+ # local: don't run in sandbox or on remote executor.
+ # exclusive: run one test at a time, since they share a Bazel
+ # output directory. If we don't do this, tests must extract the bazel
+ # installation and start with a fresh cache every time, making them
+ # much slower.
+ kwargs.setdefault("tags", [])
+ if "local" not in kwargs["tags"]:
+ kwargs["tags"].append("local")
+ if "exclusive" not in kwargs["tags"]:
+ kwargs["tags"].append("exclusive")
+
+ go_test(**kwargs)
diff --git a/go/tools/builders/BUILD.bazel b/go/tools/builders/BUILD.bazel
new file mode 100644
index 00000000..28724714
--- /dev/null
+++ b/go/tools/builders/BUILD.bazel
@@ -0,0 +1,173 @@
+load("//go:def.bzl", "go_binary", "go_source", "go_test")
+load("//go/private/rules:transition.bzl", "go_reset_target")
+
+go_test(
+ name = "filter_test",
+ size = "small",
+ srcs = [
+ "filter.go",
+ "filter_test.go",
+ "read.go",
+ ],
+)
+
+go_test(
+ name = "cover_test",
+ size = "small",
+ srcs = [
+ "cover.go",
+ "cover_test.go",
+ "edit.go",
+ "env.go",
+ "flags.go",
+ ],
+)
+
+go_test(
+ name = "stdliblist_test",
+ size = "small",
+ srcs = [
+ "env.go",
+ "flags.go",
+ "replicate.go",
+ "stdliblist.go",
+ "stdliblist_test.go",
+ ],
+ data = ["@go_sdk//:files"],
+ rundir = ".",
+)
+
+go_test(
+ name = "nolint_test",
+ size = "small",
+ srcs = [
+ "nolint.go",
+ "nolint_test.go",
+ ],
+)
+
+filegroup(
+ name = "builder_srcs",
+ srcs = [
+ "ar.go",
+ "asm.go",
+ "builder.go",
+ "cgo2.go",
+ "compilepkg.go",
+ "cover.go",
+ "edit.go",
+ "embedcfg.go",
+ "env.go",
+ "filter.go",
+ "filter_buildid.go",
+ "flags.go",
+ "generate_nogo_main.go",
+ "generate_test_main.go",
+ "importcfg.go",
+ "link.go",
+ "pack.go",
+ "read.go",
+ "replicate.go",
+ "stdlib.go",
+ "stdliblist.go",
+ ] + select({
+ "@bazel_tools//src/conditions:windows": ["path_windows.go"],
+ "//conditions:default": ["path.go"],
+ }),
+ visibility = ["//visibility:public"],
+)
+
+go_binary(
+ name = "embed",
+ srcs = ["embed.go"],
+ visibility = ["//visibility:public"],
+)
+
+go_source(
+ name = "nogo_srcs",
+ srcs = [
+ "env.go",
+ "flags.go",
+ "nogo_main.go",
+ "nogo_typeparams_go117.go",
+ "nogo_typeparams_go118.go",
+ "nolint.go",
+ "pack.go",
+ ],
+ # //go/tools/builders:nogo_srcs is considered a different target by
+ # Bazel's visibility check than
+ # @io_bazel_rules_go//go/tools/builders:nogo_srcs. Only the latter is
+ # allowed to depend on
+ # @org_golang_x_tools//go/analysis/internal/facts:go_tool_library.
+ tags = ["manual"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@org_golang_x_tools//go/analysis",
+ "@org_golang_x_tools//go/gcexportdata",
+ "@org_golang_x_tools//internal/facts",
+ ],
+)
+
+go_binary(
+ name = "go_path-bin",
+ srcs = [
+ "env.go",
+ "flags.go",
+ "go_path.go",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+go_reset_target(
+ name = "go_path",
+ dep = ":go_path-bin",
+ visibility = ["//visibility:public"],
+)
+
+go_binary(
+ name = "info",
+ srcs = [
+ "env.go",
+ "flags.go",
+ "info.go",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+go_binary(
+ name = "md5sum",
+ srcs = [
+ "md5sum.go",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+go_binary(
+ name = "go-protoc-bin",
+ srcs = [
+ "env.go",
+ "flags.go",
+ "protoc.go",
+ ],
+ visibility = ["//visibility:private"],
+)
+
+go_reset_target(
+ name = "go-protoc",
+ dep = ":go-protoc-bin",
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_builder_srcs",
+ testonly = True,
+ srcs = glob(["*.go"]),
+ visibility = ["//:__subpackages__"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
diff --git a/go/tools/builders/ar.go b/go/tools/builders/ar.go
new file mode 100644
index 00000000..2f4b36c8
--- /dev/null
+++ b/go/tools/builders/ar.go
@@ -0,0 +1,104 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "encoding/binary"
+ "fmt"
+ "io"
+ "os"
+ "strconv"
+ "strings"
+)
+
+type header struct {
+ NameRaw [16]byte
+ ModTimeRaw [12]byte
+ OwnerIdRaw [6]byte
+ GroupIdRaw [6]byte
+ FileModeRaw [8]byte
+ FileSizeRaw [10]byte
+ EndRaw [2]byte
+}
+
+func (h *header) name() string {
+ return strings.TrimRight(string(h.NameRaw[:]), " ")
+}
+
+func (h *header) size() int64 {
+ s, err := strconv.Atoi(strings.TrimRight(string(h.FileSizeRaw[:]), " "))
+ if err != nil {
+ panic(err)
+ }
+ return int64(s)
+}
+
+func (h *header) next() int64 {
+ size := h.size()
+ return size + size%2
+}
+
+func (h *header) deterministic() *header {
+ h2 := *h
+ copy(h2.ModTimeRaw[:], zeroBytes)
+ copy(h2.OwnerIdRaw[:], zeroBytes)
+ copy(h2.GroupIdRaw[:], zeroBytes)
+ copy(h2.FileModeRaw[:], zeroBytes) // GNU ar also clears this
+ return &h2
+}
+
+// stripArMetadata strips the archive metadata of non-deterministic data:
+// - Timestamps
+// - User IDs
+// - Group IDs
+// - File Modes
+// The archive is modified in place.
+func stripArMetadata(archivePath string) error {
+ archive, err := os.OpenFile(archivePath, os.O_RDWR, 0)
+ if err != nil {
+ return err
+ }
+ defer archive.Close()
+
+ magic := make([]byte, len(arHeader))
+ if _, err := io.ReadFull(archive, magic); err != nil {
+ return err
+ }
+
+ if string(magic) != arHeader {
+ return fmt.Errorf("%s is not an archive", archivePath)
+ }
+
+ for {
+ hdr := &header{}
+ if err := binary.Read(archive, binary.BigEndian, hdr); err == io.EOF {
+ return nil
+ } else if err != nil {
+ return err
+ }
+
+ // Seek back at the beginning of the header and overwrite it.
+ archive.Seek(-entryLength, os.SEEK_CUR)
+ if err := binary.Write(archive, binary.BigEndian, hdr.deterministic()); err != nil {
+ return err
+ }
+
+ if _, err := archive.Seek(hdr.next(), os.SEEK_CUR); err == io.EOF {
+ return nil
+ } else if err != nil {
+ return err
+ }
+ }
+}
diff --git a/go/tools/builders/asm.go b/go/tools/builders/asm.go
new file mode 100644
index 00000000..3d64c9ba
--- /dev/null
+++ b/go/tools/builders/asm.go
@@ -0,0 +1,138 @@
+// Copyright 2017 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "go/build"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "regexp"
+ "runtime"
+ "strconv"
+ "strings"
+)
+
+var ASM_DEFINES = []string{
+ "-D", "GOOS_" + build.Default.GOOS,
+ "-D", "GOARCH_" + build.Default.GOARCH,
+ "-D", "GOOS_GOARCH_" + build.Default.GOOS + "_" + build.Default.GOARCH,
+}
+
+// buildSymabisFile generates a file from assembly files that is consumed
+// by the compiler. This is only needed in go1.12+ when there is at least one
+// .s file. If the symabis file is not needed, no file will be generated,
+// and "", nil will be returned.
+func buildSymabisFile(goenv *env, sFiles, hFiles []fileInfo, asmhdr string) (string, error) {
+ if len(sFiles) == 0 {
+ return "", nil
+ }
+
+ // Check version. The symabis file is only required and can only be built
+ // starting at go1.12.
+ version := runtime.Version()
+ if strings.HasPrefix(version, "go1.") {
+ minor := version[len("go1."):]
+ if i := strings.IndexByte(minor, '.'); i >= 0 {
+ minor = minor[:i]
+ }
+ n, err := strconv.Atoi(minor)
+ if err == nil && n <= 11 {
+ return "", nil
+ }
+ // Fall through if the version can't be parsed. It's probably a newer
+ // development version.
+ }
+
+ // Create an empty go_asm.h file. The compiler will write this later, but
+ // we need one to exist now.
+ asmhdrFile, err := os.Create(asmhdr)
+ if err != nil {
+ return "", err
+ }
+ if err := asmhdrFile.Close(); err != nil {
+ return "", err
+ }
+ asmhdrDir := filepath.Dir(asmhdr)
+
+ // Create a temporary output file. The caller is responsible for deleting it.
+ var symabisName string
+ symabisFile, err := ioutil.TempFile("", "symabis")
+ if err != nil {
+ return "", err
+ }
+ symabisName = symabisFile.Name()
+ symabisFile.Close()
+
+ // Run the assembler.
+ wd, err := os.Getwd()
+ if err != nil {
+ return symabisName, err
+ }
+ asmargs := goenv.goTool("asm")
+ asmargs = append(asmargs, "-trimpath", wd)
+ asmargs = append(asmargs, "-I", wd)
+ asmargs = append(asmargs, "-I", filepath.Join(os.Getenv("GOROOT"), "pkg", "include"))
+ asmargs = append(asmargs, "-I", asmhdrDir)
+ seenHdrDirs := map[string]bool{wd: true, asmhdrDir: true}
+ for _, hFile := range hFiles {
+ hdrDir := filepath.Dir(abs(hFile.filename))
+ if !seenHdrDirs[hdrDir] {
+ asmargs = append(asmargs, "-I", hdrDir)
+ seenHdrDirs[hdrDir] = true
+ }
+ }
+ asmargs = append(asmargs, ASM_DEFINES...)
+ asmargs = append(asmargs, "-gensymabis", "-o", symabisName, "--")
+ for _, sFile := range sFiles {
+ asmargs = append(asmargs, sFile.filename)
+ }
+
+ err = goenv.runCommand(asmargs)
+ return symabisName, err
+}
+
+func asmFile(goenv *env, srcPath, packagePath string, asmFlags []string, outPath string) error {
+ args := goenv.goTool("asm")
+ args = append(args, asmFlags...)
+ // The package path has to be specified as of Go 1.19 or the resulting
+ // object will be unlinkable, but the -p flag is also only available
+ // since Go 1.19.
+ if packagePath != "" && isGo119OrHigher() {
+ args = append(args, "-p", packagePath)
+ }
+ args = append(args, ASM_DEFINES...)
+ args = append(args, "-trimpath", ".")
+ args = append(args, "-o", outPath)
+ args = append(args, "--", srcPath)
+ absArgs(args, []string{"-I", "-o", "-trimpath"})
+ return goenv.runCommand(args)
+}
+
+var goMinorVersionRegexp = regexp.MustCompile(`^go1\.(\d+)`)
+
+func isGo119OrHigher() bool {
+ match := goMinorVersionRegexp.FindStringSubmatch(runtime.Version())
+ if match == nil {
+ // Developer version or something with an unparseable version string,
+ // assume Go 1.19 or higher.
+ return true
+ }
+ minorVersion, err := strconv.Atoi(match[1])
+ if err != nil {
+ return true
+ }
+ return minorVersion >= 19
+}
diff --git a/go/tools/builders/builder.go b/go/tools/builders/builder.go
new file mode 100644
index 00000000..5d691839
--- /dev/null
+++ b/go/tools/builders/builder.go
@@ -0,0 +1,64 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// builder implements most of the actions for Bazel to compile and link
+// go code. We use a single binary for most actions, since this reduces
+// the number of inputs needed for each action and allows us to build
+// multiple related files in a single action.
+
+package main
+
+import (
+ "log"
+ "os"
+)
+
+func main() {
+ log.SetFlags(0)
+ log.SetPrefix("builder: ")
+
+ args, _, err := expandParamsFiles(os.Args[1:])
+ if err != nil {
+ log.Fatal(err)
+ }
+ if len(args) == 0 {
+ log.Fatalf("usage: %s verb options...", os.Args[0])
+ }
+ verb, rest := args[0], args[1:]
+
+ var action func(args []string) error
+ switch verb {
+ case "compilepkg":
+ action = compilePkg
+ case "filterbuildid":
+ action = filterBuildID
+ case "gentestmain":
+ action = genTestMain
+ case "link":
+ action = link
+ case "gennogomain":
+ action = genNogoMain
+ case "stdlib":
+ action = stdlib
+ case "stdliblist":
+ action = stdliblist
+ default:
+ log.Fatalf("unknown action: %s", verb)
+ }
+ log.SetPrefix(verb + ": ")
+
+ if err := action(rest); err != nil {
+ log.Fatal(err)
+ }
+}
diff --git a/go/tools/builders/cgo2.go b/go/tools/builders/cgo2.go
new file mode 100644
index 00000000..fc2876a9
--- /dev/null
+++ b/go/tools/builders/cgo2.go
@@ -0,0 +1,397 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// cgo2.go provides new cgo functionality for use by the GoCompilePkg action.
+// We can't use the functionality in cgo.go, since it relies too heavily
+// on logic in cgo.bzl. Ideally, we'd be able to replace cgo.go with this
+// file eventually, but not until Bazel gives us enough toolchain information
+// to compile ObjC files.
+
+package main
+
+import (
+ "bytes"
+ "fmt"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "strings"
+)
+
+// cgo2 processes a set of mixed source files with cgo.
+func cgo2(goenv *env, goSrcs, cgoSrcs, cSrcs, cxxSrcs, objcSrcs, objcxxSrcs, sSrcs, hSrcs []string, packagePath, packageName string, cc string, cppFlags, cFlags, cxxFlags, objcFlags, objcxxFlags, ldFlags []string, cgoExportHPath string) (srcDir string, allGoSrcs, cObjs []string, err error) {
+ // Report an error if the C/C++ toolchain wasn't configured.
+ if cc == "" {
+ err := cgoError(cgoSrcs[:])
+ err = append(err, cSrcs...)
+ err = append(err, cxxSrcs...)
+ err = append(err, objcSrcs...)
+ err = append(err, objcxxSrcs...)
+ err = append(err, sSrcs...)
+ return "", nil, nil, err
+ }
+
+ // If we only have C/C++ sources without cgo, just compile and pack them
+ // without generating code. The Go command forbids this, but we've
+ // historically allowed it.
+ // TODO(jayconrod): this doesn't write CGO_LDFLAGS into the archive. We
+ // might miss dependencies like -lstdc++ if they aren't referenced in
+ // some other way.
+ if len(cgoSrcs) == 0 {
+ cObjs, err = compileCSources(goenv, cSrcs, cxxSrcs, objcSrcs, objcxxSrcs, sSrcs, hSrcs, cc, cppFlags, cFlags, cxxFlags, objcFlags, objcxxFlags)
+ return ".", nil, cObjs, err
+ }
+
+ workDir, cleanup, err := goenv.workDir()
+ if err != nil {
+ return "", nil, nil, err
+ }
+ defer cleanup()
+
+ // cgo2 will gather sources into a single temporary directory, since nogo
+ // scanners might want to include or exclude these sources we need to ensure
+ // that a fragment of the path is stable and human friendly enough to be
+ // referenced in nogo configuration.
+ workDir = filepath.Join(workDir, "cgo", packagePath)
+ if err := os.MkdirAll(workDir, 0700); err != nil {
+ return "", nil, nil, err
+ }
+
+ // Filter out -lstdc++ and -lc++ from ldflags if we don't have C++ sources,
+ // and set CGO_LDFLAGS. These flags get written as special comments into cgo
+ // generated sources. The compiler encodes those flags in the compiled .a
+ // file, and the linker passes them on to the external linker.
+ haveCxx := len(cxxSrcs)+len(objcxxSrcs) > 0
+ if !haveCxx {
+ for _, f := range ldFlags {
+ if strings.HasSuffix(f, ".a") {
+ // These flags come from cdeps options. Assume C++.
+ haveCxx = true
+ break
+ }
+ }
+ }
+ var combinedLdFlags []string
+ if haveCxx {
+ combinedLdFlags = append(combinedLdFlags, ldFlags...)
+ } else {
+ for _, f := range ldFlags {
+ if f != "-lc++" && f != "-lstdc++" {
+ combinedLdFlags = append(combinedLdFlags, f)
+ }
+ }
+ }
+ combinedLdFlags = append(combinedLdFlags, defaultLdFlags()...)
+ os.Setenv("CGO_LDFLAGS", strings.Join(combinedLdFlags, " "))
+
+ // If cgo sources are in different directories, gather them into a temporary
+ // directory so we can use -srcdir.
+ srcDir = filepath.Dir(cgoSrcs[0])
+ srcsInSingleDir := true
+ for _, src := range cgoSrcs[1:] {
+ if filepath.Dir(src) != srcDir {
+ srcsInSingleDir = false
+ break
+ }
+ }
+
+ if srcsInSingleDir {
+ for i := range cgoSrcs {
+ cgoSrcs[i] = filepath.Base(cgoSrcs[i])
+ }
+ } else {
+ srcDir = filepath.Join(workDir, "cgosrcs")
+ if err := os.Mkdir(srcDir, 0777); err != nil {
+ return "", nil, nil, err
+ }
+ copiedSrcs, err := gatherSrcs(srcDir, cgoSrcs)
+ if err != nil {
+ return "", nil, nil, err
+ }
+ cgoSrcs = copiedSrcs
+ }
+
+ // Generate Go and C code.
+ hdrDirs := map[string]bool{}
+ var hdrIncludes []string
+ for _, hdr := range hSrcs {
+ hdrDir := filepath.Dir(hdr)
+ if !hdrDirs[hdrDir] {
+ hdrDirs[hdrDir] = true
+ hdrIncludes = append(hdrIncludes, "-iquote", hdrDir)
+ }
+ }
+ hdrIncludes = append(hdrIncludes, "-iquote", workDir) // for _cgo_export.h
+
+ execRoot, err := bazelExecRoot()
+ if err != nil {
+ return "", nil, nil, err
+ }
+ // Trim the execroot from the //line comments emitted by cgo.
+ args := goenv.goTool("cgo", "-srcdir", srcDir, "-objdir", workDir, "-trimpath", execRoot)
+ if packagePath != "" {
+ args = append(args, "-importpath", packagePath)
+ }
+ args = append(args, "--")
+ args = append(args, cppFlags...)
+ args = append(args, hdrIncludes...)
+ args = append(args, cFlags...)
+ args = append(args, cgoSrcs...)
+ if err := goenv.runCommand(args); err != nil {
+ return "", nil, nil, err
+ }
+
+ if cgoExportHPath != "" {
+ if err := copyFile(filepath.Join(workDir, "_cgo_export.h"), cgoExportHPath); err != nil {
+ return "", nil, nil, err
+ }
+ }
+ genGoSrcs := make([]string, 1+len(cgoSrcs))
+ genGoSrcs[0] = filepath.Join(workDir, "_cgo_gotypes.go")
+ genCSrcs := make([]string, 1+len(cgoSrcs))
+ genCSrcs[0] = filepath.Join(workDir, "_cgo_export.c")
+ for i, src := range cgoSrcs {
+ stem := strings.TrimSuffix(filepath.Base(src), ".go")
+ genGoSrcs[i+1] = filepath.Join(workDir, stem+".cgo1.go")
+ genCSrcs[i+1] = filepath.Join(workDir, stem+".cgo2.c")
+ }
+ cgoMainC := filepath.Join(workDir, "_cgo_main.c")
+
+ // Compile C, C++, Objective-C/C++, and assembly code.
+ defaultCFlags := defaultCFlags(workDir)
+ combinedCFlags := combineFlags(cppFlags, hdrIncludes, cFlags, defaultCFlags)
+ for _, lang := range []struct{ srcs, flags []string }{
+ {genCSrcs, combinedCFlags},
+ {cSrcs, combinedCFlags},
+ {cxxSrcs, combineFlags(cppFlags, hdrIncludes, cxxFlags, defaultCFlags)},
+ {objcSrcs, combineFlags(cppFlags, hdrIncludes, objcFlags, defaultCFlags)},
+ {objcxxSrcs, combineFlags(cppFlags, hdrIncludes, objcxxFlags, defaultCFlags)},
+ {sSrcs, nil},
+ } {
+ for _, src := range lang.srcs {
+ obj := filepath.Join(workDir, fmt.Sprintf("_x%d.o", len(cObjs)))
+ cObjs = append(cObjs, obj)
+ if err := cCompile(goenv, src, cc, lang.flags, obj); err != nil {
+ return "", nil, nil, err
+ }
+ }
+ }
+
+ mainObj := filepath.Join(workDir, "_cgo_main.o")
+ if err := cCompile(goenv, cgoMainC, cc, combinedCFlags, mainObj); err != nil {
+ return "", nil, nil, err
+ }
+
+ // Link cgo binary and use the symbols to generate _cgo_import.go.
+ mainBin := filepath.Join(workDir, "_cgo_.o") // .o is a lie; it's an executable
+ args = append([]string{cc, "-o", mainBin, mainObj}, cObjs...)
+ args = append(args, combinedLdFlags...)
+ var originalErrBuf bytes.Buffer
+ if err := goenv.runCommandToFile(os.Stdout, &originalErrBuf, args); err != nil {
+ // If linking the binary for cgo fails, this is usually because the
+ // object files reference external symbols that can't be resolved yet.
+ // Since the binary is only produced to have its symbols read by the cgo
+ // command, there is no harm in trying to build it allowing unresolved
+ // symbols - the real link that happens at the end will fail if they
+ // rightfully can't be resolved.
+ var allowUnresolvedSymbolsLdFlag string
+ switch os.Getenv("GOOS") {
+ case "windows":
+ // MinGW's linker doesn't seem to support --unresolved-symbols
+ // and MSVC isn't supported at all.
+ return "", nil, nil, err
+ case "darwin", "ios":
+ allowUnresolvedSymbolsLdFlag = "-Wl,-undefined,dynamic_lookup"
+ default:
+ allowUnresolvedSymbolsLdFlag = "-Wl,--unresolved-symbols=ignore-all"
+ }
+ // Print and return the original error if we can't link the binary with
+ // the additional linker flags as they may simply be incorrect for the
+ // particular compiler/linker pair and would obscure the true reason for
+ // the failure of the original command.
+ if err2 := goenv.runCommandToFile(
+ os.Stdout,
+ ioutil.Discard,
+ append(args, allowUnresolvedSymbolsLdFlag),
+ ); err2 != nil {
+ os.Stderr.Write(relativizePaths(originalErrBuf.Bytes()))
+ return "", nil, nil, err
+ }
+ // Do not print the original error - rerunning the command with the
+ // additional linker flag fixed it.
+ }
+
+ cgoImportsGo := filepath.Join(workDir, "_cgo_imports.go")
+ args = goenv.goTool("cgo", "-dynpackage", packageName, "-dynimport", mainBin, "-dynout", cgoImportsGo)
+ if err := goenv.runCommand(args); err != nil {
+ return "", nil, nil, err
+ }
+ genGoSrcs = append(genGoSrcs, cgoImportsGo)
+
+ // Copy regular Go source files into the work directory so that we can
+ // use -trimpath=workDir.
+ goBases, err := gatherSrcs(workDir, goSrcs)
+ if err != nil {
+ return "", nil, nil, err
+ }
+
+ allGoSrcs = make([]string, len(goSrcs)+len(genGoSrcs))
+ for i := range goSrcs {
+ allGoSrcs[i] = filepath.Join(workDir, goBases[i])
+ }
+ copy(allGoSrcs[len(goSrcs):], genGoSrcs)
+ return workDir, allGoSrcs, cObjs, nil
+}
+
+// compileCSources compiles a list of C, C++, Objective-C, Objective-C++,
+// and assembly sources into .o files to be packed into the archive.
+// It does not run cgo. This is used for packages with "cgo = True" but
+// without any .go files that import "C". The Go command forbids this,
+// but we have historically allowed it.
+func compileCSources(goenv *env, cSrcs, cxxSrcs, objcSrcs, objcxxSrcs, sSrcs, hSrcs []string, cc string, cppFlags, cFlags, cxxFlags, objcFlags, objcxxFlags []string) (cObjs []string, err error) {
+ workDir, cleanup, err := goenv.workDir()
+ if err != nil {
+ return nil, err
+ }
+ defer cleanup()
+
+ hdrDirs := map[string]bool{}
+ var hdrIncludes []string
+ for _, hdr := range hSrcs {
+ hdrDir := filepath.Dir(hdr)
+ if !hdrDirs[hdrDir] {
+ hdrDirs[hdrDir] = true
+ hdrIncludes = append(hdrIncludes, "-iquote", hdrDir)
+ }
+ }
+
+ defaultCFlags := defaultCFlags(workDir)
+ for _, lang := range []struct{ srcs, flags []string }{
+ {cSrcs, combineFlags(cppFlags, hdrIncludes, cFlags, defaultCFlags)},
+ {cxxSrcs, combineFlags(cppFlags, hdrIncludes, cxxFlags, defaultCFlags)},
+ {objcSrcs, combineFlags(cppFlags, hdrIncludes, objcFlags, defaultCFlags)},
+ {objcxxSrcs, combineFlags(cppFlags, hdrIncludes, objcxxFlags, defaultCFlags)},
+ {sSrcs, nil},
+ } {
+ for _, src := range lang.srcs {
+ obj := filepath.Join(workDir, fmt.Sprintf("_x%d.o", len(cObjs)))
+ cObjs = append(cObjs, obj)
+ if err := cCompile(goenv, src, cc, lang.flags, obj); err != nil {
+ return nil, err
+ }
+ }
+ }
+ return cObjs, nil
+}
+
+func combineFlags(lists ...[]string) []string {
+ n := 0
+ for _, list := range lists {
+ n += len(list)
+ }
+ flags := make([]string, 0, n)
+ for _, list := range lists {
+ flags = append(flags, list...)
+ }
+ return flags
+}
+
+func cCompile(goenv *env, src, cc string, flags []string, out string) error {
+ args := []string{cc}
+ args = append(args, flags...)
+ args = append(args, "-c", src, "-o", out)
+ return goenv.runCommand(args)
+}
+
+func defaultCFlags(workDir string) []string {
+ flags := []string{
+ "-fdebug-prefix-map=" + abs(".") + "=.",
+ "-fdebug-prefix-map=" + workDir + "=.",
+ }
+ goos, goarch := os.Getenv("GOOS"), os.Getenv("GOARCH")
+ switch {
+ case goos == "darwin" || goos == "ios":
+ return flags
+ case goos == "windows" && goarch == "amd64":
+ return append(flags, "-mthreads")
+ default:
+ return append(flags, "-pthread")
+ }
+}
+
+func defaultLdFlags() []string {
+ goos, goarch := os.Getenv("GOOS"), os.Getenv("GOARCH")
+ switch {
+ case goos == "android":
+ return []string{"-llog", "-ldl"}
+ case goos == "darwin" || goos == "ios":
+ return nil
+ case goos == "windows" && goarch == "amd64":
+ return []string{"-mthreads"}
+ default:
+ return []string{"-pthread"}
+ }
+}
+
+// gatherSrcs copies or links files listed in srcs into dir. This is needed
+// to effectively use -trimpath with generated sources. It's also needed by cgo.
+//
+// gatherSrcs returns the basenames of copied files in the directory.
+func gatherSrcs(dir string, srcs []string) ([]string, error) {
+ copiedBases := make([]string, len(srcs))
+ for i, src := range srcs {
+ base := filepath.Base(src)
+ ext := filepath.Ext(base)
+ stem := base[:len(base)-len(ext)]
+ var err error
+ for j := 1; j < 10000; j++ {
+ if err = copyOrLinkFile(src, filepath.Join(dir, base)); err == nil {
+ break
+ } else if !os.IsExist(err) {
+ return nil, err
+ } else {
+ base = fmt.Sprintf("%s_%d%s", stem, j, ext)
+ }
+ }
+ if err != nil {
+ return nil, fmt.Errorf("could not find unique name for file %s", src)
+ }
+ copiedBases[i] = base
+ }
+ return copiedBases, nil
+}
+
+func bazelExecRoot() (string, error) {
+ // Bazel executes the builder with a working directory of the form
+ // .../execroot/<workspace name>. By stripping the last segment, we obtain a
+ // prefix of all possible source files, even when contained in external
+ // repositories.
+ cwd, err := os.Getwd()
+ if err != nil {
+ return "", err
+ }
+ return filepath.Dir(cwd), nil
+}
+
+type cgoError []string
+
+func (e cgoError) Error() string {
+ b := &bytes.Buffer{}
+ fmt.Fprint(b, "CC is not set and files need to be processed with cgo:\n")
+ for _, f := range e {
+ fmt.Fprintf(b, "\t%s\n", f)
+ }
+ fmt.Fprintf(b, "Ensure that 'cgo = True' is set and the C/C++ toolchain is configured.")
+ return b.String()
+}
diff --git a/go/tools/builders/compilepkg.go b/go/tools/builders/compilepkg.go
new file mode 100644
index 00000000..6e21ca24
--- /dev/null
+++ b/go/tools/builders/compilepkg.go
@@ -0,0 +1,615 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// compilepkg compiles a complete Go package from Go, C, and assembly files. It
+// supports cgo, coverage, and nogo. It is invoked by the Go rules as an action.
+package main
+
+import (
+ "bytes"
+ "context"
+ "errors"
+ "flag"
+ "fmt"
+ "io/ioutil"
+ "os"
+ "os/exec"
+ "path"
+ "path/filepath"
+ "sort"
+ "strings"
+)
+
+type nogoResult int
+
+const (
+ nogoNotRun nogoResult = iota
+ nogoError
+ nogoFailed
+ nogoSucceeded
+)
+
+func compilePkg(args []string) error {
+ // Parse arguments.
+ args, _, err := expandParamsFiles(args)
+ if err != nil {
+ return err
+ }
+
+ fs := flag.NewFlagSet("GoCompilePkg", flag.ExitOnError)
+ goenv := envFlags(fs)
+ var unfilteredSrcs, coverSrcs, embedSrcs, embedLookupDirs, embedRoots, recompileInternalDeps multiFlag
+ var deps archiveMultiFlag
+ var importPath, packagePath, nogoPath, packageListPath, coverMode string
+ var outPath, outFactsPath, cgoExportHPath string
+ var testFilter string
+ var gcFlags, asmFlags, cppFlags, cFlags, cxxFlags, objcFlags, objcxxFlags, ldFlags quoteMultiFlag
+ var coverFormat string
+ fs.Var(&unfilteredSrcs, "src", ".go, .c, .cc, .m, .mm, .s, or .S file to be filtered and compiled")
+ fs.Var(&coverSrcs, "cover", ".go file that should be instrumented for coverage (must also be a -src)")
+ fs.Var(&embedSrcs, "embedsrc", "file that may be compiled into the package with a //go:embed directive")
+ fs.Var(&embedLookupDirs, "embedlookupdir", "Root-relative paths to directories relative to which //go:embed directives are resolved")
+ fs.Var(&embedRoots, "embedroot", "Bazel output root under which a file passed via -embedsrc resides")
+ fs.Var(&deps, "arc", "Import path, package path, and file name of a direct dependency, separated by '='")
+ fs.StringVar(&importPath, "importpath", "", "The import path of the package being compiled. Not passed to the compiler, but may be displayed in debug data.")
+ fs.StringVar(&packagePath, "p", "", "The package path (importmap) of the package being compiled")
+ fs.Var(&gcFlags, "gcflags", "Go compiler flags")
+ fs.Var(&asmFlags, "asmflags", "Go assembler flags")
+ fs.Var(&cppFlags, "cppflags", "C preprocessor flags")
+ fs.Var(&cFlags, "cflags", "C compiler flags")
+ fs.Var(&cxxFlags, "cxxflags", "C++ compiler flags")
+ fs.Var(&objcFlags, "objcflags", "Objective-C compiler flags")
+ fs.Var(&objcxxFlags, "objcxxflags", "Objective-C++ compiler flags")
+ fs.Var(&ldFlags, "ldflags", "C linker flags")
+ fs.StringVar(&nogoPath, "nogo", "", "The nogo binary. If unset, nogo will not be run.")
+ fs.StringVar(&packageListPath, "package_list", "", "The file containing the list of standard library packages")
+ fs.StringVar(&coverMode, "cover_mode", "", "The coverage mode to use. Empty if coverage instrumentation should not be added.")
+ fs.StringVar(&outPath, "o", "", "The output archive file to write compiled code")
+ fs.StringVar(&outFactsPath, "x", "", "The output archive file to write export data and nogo facts")
+ fs.StringVar(&cgoExportHPath, "cgoexport", "", "The _cgo_exports.h file to write")
+ fs.StringVar(&testFilter, "testfilter", "off", "Controls test package filtering")
+ fs.StringVar(&coverFormat, "cover_format", "", "Emit source file paths in coverage instrumentation suitable for the specified coverage format")
+ fs.Var(&recompileInternalDeps, "recompile_internal_deps", "The import path of the direct dependencies that needs to be recompiled.")
+ if err := fs.Parse(args); err != nil {
+ return err
+ }
+ if err := goenv.checkFlags(); err != nil {
+ return err
+ }
+ if importPath == "" {
+ importPath = packagePath
+ }
+ cgoEnabled := os.Getenv("CGO_ENABLED") == "1"
+ cc := os.Getenv("CC")
+ outPath = abs(outPath)
+ for i := range unfilteredSrcs {
+ unfilteredSrcs[i] = abs(unfilteredSrcs[i])
+ }
+ for i := range embedSrcs {
+ embedSrcs[i] = abs(embedSrcs[i])
+ }
+
+ // Filter sources.
+ srcs, err := filterAndSplitFiles(unfilteredSrcs)
+ if err != nil {
+ return err
+ }
+
+ // TODO(jayconrod): remove -testfilter flag. The test action should compile
+ // the main, internal, and external packages by calling compileArchive
+ // with the correct sources for each.
+ switch testFilter {
+ case "off":
+ case "only":
+ testSrcs := make([]fileInfo, 0, len(srcs.goSrcs))
+ for _, f := range srcs.goSrcs {
+ if strings.HasSuffix(f.pkg, "_test") {
+ testSrcs = append(testSrcs, f)
+ }
+ }
+ srcs.goSrcs = testSrcs
+ case "exclude":
+ libSrcs := make([]fileInfo, 0, len(srcs.goSrcs))
+ for _, f := range srcs.goSrcs {
+ if !strings.HasSuffix(f.pkg, "_test") {
+ libSrcs = append(libSrcs, f)
+ }
+ }
+ srcs.goSrcs = libSrcs
+ default:
+ return fmt.Errorf("invalid test filter %q", testFilter)
+ }
+
+ return compileArchive(
+ goenv,
+ importPath,
+ packagePath,
+ srcs,
+ deps,
+ coverMode,
+ coverSrcs,
+ embedSrcs,
+ embedLookupDirs,
+ embedRoots,
+ cgoEnabled,
+ cc,
+ gcFlags,
+ asmFlags,
+ cppFlags,
+ cFlags,
+ cxxFlags,
+ objcFlags,
+ objcxxFlags,
+ ldFlags,
+ nogoPath,
+ packageListPath,
+ outPath,
+ outFactsPath,
+ cgoExportHPath,
+ coverFormat,
+ recompileInternalDeps)
+}
+
+func compileArchive(
+ goenv *env,
+ importPath string,
+ packagePath string,
+ srcs archiveSrcs,
+ deps []archive,
+ coverMode string,
+ coverSrcs []string,
+ embedSrcs []string,
+ embedLookupDirs []string,
+ embedRoots []string,
+ cgoEnabled bool,
+ cc string,
+ gcFlags []string,
+ asmFlags []string,
+ cppFlags []string,
+ cFlags []string,
+ cxxFlags []string,
+ objcFlags []string,
+ objcxxFlags []string,
+ ldFlags []string,
+ nogoPath string,
+ packageListPath string,
+ outPath string,
+ outXPath string,
+ cgoExportHPath string,
+ coverFormat string,
+ recompileInternalDeps []string,
+) error {
+ workDir, cleanup, err := goenv.workDir()
+ if err != nil {
+ return err
+ }
+ defer cleanup()
+
+ // As part of compilation process, rules_go does generate and/or rewrite code
+ // based on the original source files. We should only run static analysis
+ // over original source files and not the generated source as end users have
+ // little control over the generated source.
+ //
+ // nogoSrcsOrigin maps generated/rewritten source files back to original source.
+ // If the original source path is an empty string, exclude generated source from nogo run.
+ nogoSrcsOrigin := make(map[string]string)
+
+ if len(srcs.goSrcs) == 0 {
+ // We need to run the compiler to create a valid archive, even if there's nothing in it.
+ // Otherwise, GoPack will complain if we try to add assembly or cgo objects.
+ // A truly empty archive does not include any references to source file paths, which
+ // ensures hermeticity even though the temp file path is random.
+ emptyGoFile, err := os.CreateTemp(filepath.Dir(outPath), "*.go")
+ if err != nil {
+ return err
+ }
+ defer os.Remove(emptyGoFile.Name())
+ defer emptyGoFile.Close()
+ if _, err := emptyGoFile.WriteString("package empty\n"); err != nil {
+ return err
+ }
+ if err := emptyGoFile.Close(); err != nil {
+ return err
+ }
+
+ srcs.goSrcs = append(srcs.goSrcs, fileInfo{
+ filename: emptyGoFile.Name(),
+ ext: goExt,
+ matched: true,
+ pkg: "empty",
+ })
+
+ nogoSrcsOrigin[emptyGoFile.Name()] = ""
+ }
+ packageName := srcs.goSrcs[0].pkg
+ var goSrcs, cgoSrcs []string
+ for _, src := range srcs.goSrcs {
+ if src.isCgo {
+ cgoSrcs = append(cgoSrcs, src.filename)
+ } else {
+ goSrcs = append(goSrcs, src.filename)
+ }
+ }
+ cSrcs := make([]string, len(srcs.cSrcs))
+ for i, src := range srcs.cSrcs {
+ cSrcs[i] = src.filename
+ }
+ cxxSrcs := make([]string, len(srcs.cxxSrcs))
+ for i, src := range srcs.cxxSrcs {
+ cxxSrcs[i] = src.filename
+ }
+ objcSrcs := make([]string, len(srcs.objcSrcs))
+ for i, src := range srcs.objcSrcs {
+ objcSrcs[i] = src.filename
+ }
+ objcxxSrcs := make([]string, len(srcs.objcxxSrcs))
+ for i, src := range srcs.objcxxSrcs {
+ objcxxSrcs[i] = src.filename
+ }
+ sSrcs := make([]string, len(srcs.sSrcs))
+ for i, src := range srcs.sSrcs {
+ sSrcs[i] = src.filename
+ }
+ hSrcs := make([]string, len(srcs.hSrcs))
+ for i, src := range srcs.hSrcs {
+ hSrcs[i] = src.filename
+ }
+ haveCgo := len(cgoSrcs)+len(cSrcs)+len(cxxSrcs)+len(objcSrcs)+len(objcxxSrcs) > 0
+
+ // Instrument source files for coverage.
+ if coverMode != "" {
+ relCoverPath := make(map[string]string)
+ for _, s := range coverSrcs {
+ relCoverPath[abs(s)] = s
+ }
+
+ combined := append([]string{}, goSrcs...)
+ if cgoEnabled {
+ combined = append(combined, cgoSrcs...)
+ }
+ for i, origSrc := range combined {
+ if _, ok := relCoverPath[origSrc]; !ok {
+ continue
+ }
+
+ var srcName string
+ switch coverFormat {
+ case "go_cover":
+ srcName = origSrc
+ if importPath != "" {
+ srcName = path.Join(importPath, filepath.Base(origSrc))
+ }
+ case "lcov":
+ // Bazel merges lcov reports across languages and thus assumes
+ // that the source file paths are relative to the exec root.
+ srcName = relCoverPath[origSrc]
+ default:
+ return fmt.Errorf("invalid value for -cover_format: %q", coverFormat)
+ }
+
+ stem := filepath.Base(origSrc)
+ if ext := filepath.Ext(stem); ext != "" {
+ stem = stem[:len(stem)-len(ext)]
+ }
+ coverVar := fmt.Sprintf("Cover_%s_%d_%s", sanitizePathForIdentifier(importPath), i, sanitizePathForIdentifier(stem))
+ coverVar = strings.ReplaceAll(coverVar, "_", "Z")
+ coverSrc := filepath.Join(workDir, fmt.Sprintf("cover_%d.go", i))
+ if err := instrumentForCoverage(goenv, origSrc, srcName, coverVar, coverMode, coverSrc); err != nil {
+ return err
+ }
+
+ if i < len(goSrcs) {
+ goSrcs[i] = coverSrc
+ nogoSrcsOrigin[coverSrc] = origSrc
+ continue
+ }
+
+ cgoSrcs[i-len(goSrcs)] = coverSrc
+ }
+ }
+
+ // If we have cgo, generate separate C and go files, and compile the
+ // C files.
+ var objFiles []string
+ if cgoEnabled && haveCgo {
+ // TODO(#2006): Compile .s and .S files with cgo2, not the Go assembler.
+ // If cgo is not enabled or we don't have other cgo sources, don't
+ // compile .S files.
+ var srcDir string
+ srcDir, goSrcs, objFiles, err = cgo2(goenv, goSrcs, cgoSrcs, cSrcs, cxxSrcs, objcSrcs, objcxxSrcs, nil, hSrcs, packagePath, packageName, cc, cppFlags, cFlags, cxxFlags, objcFlags, objcxxFlags, ldFlags, cgoExportHPath)
+ if err != nil {
+ return err
+ }
+
+ gcFlags = append(gcFlags, createTrimPath(gcFlags, srcDir))
+ } else {
+ if cgoExportHPath != "" {
+ if err := ioutil.WriteFile(cgoExportHPath, nil, 0o666); err != nil {
+ return err
+ }
+ }
+ gcFlags = append(gcFlags, createTrimPath(gcFlags, "."))
+ }
+
+ // Check that the filtered sources don't import anything outside of
+ // the standard library and the direct dependencies.
+ imports, err := checkImports(srcs.goSrcs, deps, packageListPath, importPath, recompileInternalDeps)
+ if err != nil {
+ return err
+ }
+ if cgoEnabled && len(cgoSrcs) != 0 {
+ // cgo generated code imports some extra packages.
+ imports["runtime/cgo"] = nil
+ imports["syscall"] = nil
+ imports["unsafe"] = nil
+ }
+ if coverMode != "" {
+ if coverMode == "atomic" {
+ imports["sync/atomic"] = nil
+ }
+ const coverdataPath = "github.com/bazelbuild/rules_go/go/tools/coverdata"
+ var coverdata *archive
+ for i := range deps {
+ if deps[i].importPath == coverdataPath {
+ coverdata = &deps[i]
+ break
+ }
+ }
+ if coverdata == nil {
+ return errors.New("coverage requested but coverdata dependency not provided")
+ }
+ imports[coverdataPath] = coverdata
+ }
+
+ // Build an importcfg file for the compiler.
+ importcfgPath, err := buildImportcfgFileForCompile(imports, goenv.installSuffix, filepath.Dir(outPath))
+ if err != nil {
+ return err
+ }
+ if !goenv.shouldPreserveWorkDir {
+ defer os.Remove(importcfgPath)
+ }
+
+ // Build an embedcfg file mapping embed patterns to filenames.
+ // Embed patterns are relative to any one of a list of root directories
+ // that may contain embeddable files. Source files containing embed patterns
+ // must be in one of these root directories so the pattern appears to be
+ // relative to the source file. Due to transitions, source files can reside
+ // under Bazel roots different from both those of the go srcs and those of
+ // the compilation output. Thus, we have to consider all combinations of
+ // Bazel roots embedsrcs and root-relative paths of source files and the
+ // output binary.
+ var embedRootDirs []string
+ for _, root := range embedRoots {
+ for _, lookupDir := range embedLookupDirs {
+ embedRootDir := abs(filepath.Join(root, lookupDir))
+ // Since we are iterating over all combinations of roots and
+ // root-relative paths, some resulting paths may not exist and
+ // should be filtered out before being passed to buildEmbedcfgFile.
+ // Since Bazel uniquified both the roots and the root-relative
+ // paths, the combinations are automatically unique.
+ if _, err := os.Stat(embedRootDir); err == nil {
+ embedRootDirs = append(embedRootDirs, embedRootDir)
+ }
+ }
+ }
+ embedcfgPath, err := buildEmbedcfgFile(srcs.goSrcs, embedSrcs, embedRootDirs, workDir)
+ if err != nil {
+ return err
+ }
+ if embedcfgPath != "" {
+ if !goenv.shouldPreserveWorkDir {
+ defer os.Remove(embedcfgPath)
+ }
+ }
+
+ // Run nogo concurrently.
+ var nogoChan chan error
+ outFactsPath := filepath.Join(workDir, nogoFact)
+ nogoSrcs := make([]string, 0, len(goSrcs))
+ for _, goSrc := range goSrcs {
+ // If source is found in the origin map, that means it's likely to be a generated source file
+ // so feed the original source file to static analyzers instead of the generated one.
+ //
+ // If origin is empty, that means the generated source file is not based on a user-provided source file
+ // thus ignore that entry entirely.
+ if originSrc, ok := nogoSrcsOrigin[goSrc]; ok {
+ if originSrc != "" {
+ nogoSrcs = append(nogoSrcs, originSrc)
+ }
+ continue
+ }
+
+ // TODO(sluongng): most likely what remains here are CGO-generated source files as the result of calling cgo2()
+ // Need to determine whether we want to feed these CGO-generated files into static analyzers.
+ //
+ // Add unknown origin source files into the mix.
+ nogoSrcs = append(nogoSrcs, goSrc)
+ }
+ if nogoPath != "" && len(nogoSrcs) > 0 {
+ ctx, cancel := context.WithCancel(context.Background())
+ nogoChan = make(chan error)
+ go func() {
+ nogoChan <- runNogo(ctx, workDir, nogoPath, nogoSrcs, deps, packagePath, importcfgPath, outFactsPath)
+ }()
+ defer func() {
+ if nogoChan != nil {
+ cancel()
+ <-nogoChan
+ }
+ }()
+ }
+
+ // If there are assembly files, and this is go1.12+, generate symbol ABIs.
+ asmHdrPath := ""
+ if len(srcs.sSrcs) > 0 {
+ asmHdrPath = filepath.Join(workDir, "go_asm.h")
+ }
+ symabisPath, err := buildSymabisFile(goenv, srcs.sSrcs, srcs.hSrcs, asmHdrPath)
+ if symabisPath != "" {
+ if !goenv.shouldPreserveWorkDir {
+ defer os.Remove(symabisPath)
+ }
+ }
+ if err != nil {
+ return err
+ }
+
+ // Compile the filtered .go files.
+ if err := compileGo(goenv, goSrcs, packagePath, importcfgPath, embedcfgPath, asmHdrPath, symabisPath, gcFlags, outPath); err != nil {
+ return err
+ }
+
+ // Compile the .s files.
+ if len(srcs.sSrcs) > 0 {
+ includeSet := map[string]struct{}{
+ filepath.Join(os.Getenv("GOROOT"), "pkg", "include"): {},
+ workDir: {},
+ }
+ for _, hdr := range srcs.hSrcs {
+ includeSet[filepath.Dir(hdr.filename)] = struct{}{}
+ }
+ includes := make([]string, len(includeSet))
+ for inc := range includeSet {
+ includes = append(includes, inc)
+ }
+ sort.Strings(includes)
+ for _, inc := range includes {
+ asmFlags = append(asmFlags, "-I", inc)
+ }
+ for i, sSrc := range srcs.sSrcs {
+ obj := filepath.Join(workDir, fmt.Sprintf("s%d.o", i))
+ if err := asmFile(goenv, sSrc.filename, packagePath, asmFlags, obj); err != nil {
+ return err
+ }
+ objFiles = append(objFiles, obj)
+ }
+ }
+
+ // Pack .o files into the archive. These may come from cgo generated code,
+ // cgo dependencies (cdeps), or assembly.
+ if len(objFiles) > 0 {
+ if err := appendFiles(goenv, outPath, objFiles); err != nil {
+ return err
+ }
+ }
+
+ // Check results from nogo.
+ nogoStatus := nogoNotRun
+ if nogoChan != nil {
+ err := <-nogoChan
+ nogoChan = nil // no cancellation needed
+ if err != nil {
+ nogoStatus = nogoFailed
+ // TODO: should we still create the .x file without nogo facts in this case?
+ return err
+ }
+ nogoStatus = nogoSucceeded
+ }
+
+ // Extract the export data file and pack it in an .x archive together with the
+ // nogo facts file (if there is one). This allows compile actions to depend
+ // on .x files only, so we don't need to recompile a package when one of its
+ // imports changes in a way that doesn't affect export data.
+ // TODO(golang/go#33820): After Go 1.16 is the minimum supported version,
+ // use -linkobj to tell the compiler to create separate .a and .x files for
+ // compiled code and export data. Before that version, the linker needed
+ // export data in the .a file when building a plugin. To work around that,
+ // we copy the export data into .x ourselves.
+ if err = extractFileFromArchive(outPath, workDir, pkgDef); err != nil {
+ return err
+ }
+ pkgDefPath := filepath.Join(workDir, pkgDef)
+ if nogoStatus == nogoSucceeded {
+ return appendFiles(goenv, outXPath, []string{pkgDefPath, outFactsPath})
+ }
+ return appendFiles(goenv, outXPath, []string{pkgDefPath})
+}
+
+func compileGo(goenv *env, srcs []string, packagePath, importcfgPath, embedcfgPath, asmHdrPath, symabisPath string, gcFlags []string, outPath string) error {
+ args := goenv.goTool("compile")
+ args = append(args, "-p", packagePath, "-importcfg", importcfgPath, "-pack")
+ if embedcfgPath != "" {
+ args = append(args, "-embedcfg", embedcfgPath)
+ }
+ if asmHdrPath != "" {
+ args = append(args, "-asmhdr", asmHdrPath)
+ }
+ if symabisPath != "" {
+ args = append(args, "-symabis", symabisPath)
+ }
+ args = append(args, gcFlags...)
+ args = append(args, "-o", outPath)
+ args = append(args, "--")
+ args = append(args, srcs...)
+ absArgs(args, []string{"-I", "-o", "-trimpath", "-importcfg"})
+ return goenv.runCommand(args)
+}
+
+func runNogo(ctx context.Context, workDir string, nogoPath string, srcs []string, deps []archive, packagePath, importcfgPath, outFactsPath string) error {
+ args := []string{nogoPath}
+ args = append(args, "-p", packagePath)
+ args = append(args, "-importcfg", importcfgPath)
+ for _, dep := range deps {
+ args = append(args, "-fact", fmt.Sprintf("%s=%s", dep.importPath, dep.file))
+ }
+ args = append(args, "-x", outFactsPath)
+ args = append(args, srcs...)
+
+ paramsFile := filepath.Join(workDir, "nogo.param")
+ if err := writeParamsFile(paramsFile, args[1:]); err != nil {
+ return fmt.Errorf("error writing nogo params file: %v", err)
+ }
+
+ cmd := exec.CommandContext(ctx, args[0], "-param="+paramsFile)
+ out := &bytes.Buffer{}
+ cmd.Stdout, cmd.Stderr = out, out
+ if err := cmd.Run(); err != nil {
+ if exitErr, ok := err.(*exec.ExitError); ok {
+ if !exitErr.Exited() {
+ cmdLine := strings.Join(args, " ")
+ return fmt.Errorf("nogo command '%s' exited unexpectedly: %s", cmdLine, exitErr.String())
+ }
+ return errors.New(string(relativizePaths(out.Bytes())))
+ } else {
+ if out.Len() != 0 {
+ fmt.Fprintln(os.Stderr, out.String())
+ }
+ return fmt.Errorf("error running nogo: %v", err)
+ }
+ }
+ return nil
+}
+
+func createTrimPath(gcFlags []string, path string) string {
+ for _, flag := range gcFlags {
+ if strings.HasPrefix(flag, "-trimpath=") {
+ return flag + ":" + path
+ }
+ }
+
+ return "-trimpath=" + path
+}
+
+func sanitizePathForIdentifier(path string) string {
+ return strings.Map(func(r rune) rune {
+ if 'A' <= r && r <= 'Z' ||
+ 'a' <= r && r <= 'z' ||
+ '0' <= r && r <= '9' ||
+ r == '_' {
+ return r
+ }
+ return '_'
+ }, path)
+}
diff --git a/go/tools/builders/cover.go b/go/tools/builders/cover.go
new file mode 100644
index 00000000..fadc4fd7
--- /dev/null
+++ b/go/tools/builders/cover.go
@@ -0,0 +1,110 @@
+// Copyright 2017 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "bytes"
+ "fmt"
+ "go/parser"
+ "go/token"
+ "io/ioutil"
+ "os"
+ "strconv"
+)
+
+// instrumentForCoverage runs "go tool cover" on a source file to produce
+// a coverage-instrumented version of the file. It also registers the file
+// with the coverdata package.
+func instrumentForCoverage(goenv *env, srcPath, srcName, coverVar, mode, outPath string) error {
+ goargs := goenv.goTool("cover", "-var", coverVar, "-mode", mode, "-o", outPath, srcPath)
+ if err := goenv.runCommand(goargs); err != nil {
+ return err
+ }
+
+ return registerCoverage(outPath, coverVar, srcName)
+}
+
+// registerCoverage modifies coverSrcFilename, the output file from go tool cover.
+// It adds a call to coverdata.RegisterCoverage, which ensures the coverage
+// data from each file is reported. The name by which the file is registered
+// need not match its original name (it may use the importpath).
+func registerCoverage(coverSrcFilename, varName, srcName string) error {
+ coverSrc, err := os.ReadFile(coverSrcFilename)
+ if err != nil {
+ return fmt.Errorf("instrumentForCoverage: reading instrumented source: %w", err)
+ }
+
+ // Parse the file.
+ fset := token.NewFileSet()
+ f, err := parser.ParseFile(fset, coverSrcFilename, coverSrc, parser.ParseComments)
+ if err != nil {
+ return nil // parse error: proceed and let the compiler fail
+ }
+
+ // Perform edits using a byte buffer instead of the AST, because
+ // we can not use go/format to write the AST back out without
+ // changing line numbers.
+ editor := NewBuffer(coverSrc)
+
+ // Ensure coverdata is imported. Use an existing import if present
+ // or add a new one.
+ const coverdataPath = "github.com/bazelbuild/rules_go/go/tools/coverdata"
+ var coverdataName string
+ for _, imp := range f.Imports {
+ path, err := strconv.Unquote(imp.Path.Value)
+ if err != nil {
+ return nil // parse error: proceed and let the compiler fail
+ }
+ if path == coverdataPath {
+ if imp.Name != nil {
+ // renaming import
+ if imp.Name.Name == "_" {
+ // Change blank import to named import
+ editor.Replace(
+ fset.Position(imp.Name.Pos()).Offset,
+ fset.Position(imp.Name.End()).Offset,
+ "coverdata")
+ coverdataName = "coverdata"
+ } else {
+ coverdataName = imp.Name.Name
+ }
+ } else {
+ // default import
+ coverdataName = "coverdata"
+ }
+ break
+ }
+ }
+ if coverdataName == "" {
+ // No existing import. Add a new one.
+ coverdataName = "coverdata"
+ editor.Insert(fset.Position(f.Name.End()).Offset, fmt.Sprintf("; import %q", coverdataPath))
+ }
+
+ // Append an init function.
+ var buf = bytes.NewBuffer(editor.Bytes())
+ fmt.Fprintf(buf, `
+func init() {
+ %s.RegisterFile(%q,
+ %[3]s.Count[:],
+ %[3]s.Pos[:],
+ %[3]s.NumStmt[:])
+}
+`, coverdataName, srcName, varName)
+ if err := ioutil.WriteFile(coverSrcFilename, buf.Bytes(), 0666); err != nil {
+ return fmt.Errorf("registerCoverage: %v", err)
+ }
+ return nil
+}
diff --git a/go/tools/builders/cover_test.go b/go/tools/builders/cover_test.go
new file mode 100644
index 00000000..fc1ba818
--- /dev/null
+++ b/go/tools/builders/cover_test.go
@@ -0,0 +1,130 @@
+package main
+
+import (
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "testing"
+)
+
+type test struct {
+ name string
+ in string
+ out string
+}
+
+var tests = []test{
+ {
+ name: "no imports",
+ in: `package main
+`,
+ out: `package main; import "github.com/bazelbuild/rules_go/go/tools/coverdata"
+
+func init() {
+ coverdata.RegisterFile("srcName",
+ varName.Count[:],
+ varName.Pos[:],
+ varName.NumStmt[:])
+}
+`,
+ },
+ {
+ name: "other imports",
+ in: `package main
+
+import (
+ "os"
+)
+`,
+ out: `package main; import "github.com/bazelbuild/rules_go/go/tools/coverdata"
+
+import (
+ "os"
+)
+
+func init() {
+ coverdata.RegisterFile("srcName",
+ varName.Count[:],
+ varName.Pos[:],
+ varName.NumStmt[:])
+}
+`,
+ },
+ {
+ name: "existing import",
+ in: `package main
+
+import "github.com/bazelbuild/rules_go/go/tools/coverdata"
+`,
+ out: `package main
+
+import "github.com/bazelbuild/rules_go/go/tools/coverdata"
+
+func init() {
+ coverdata.RegisterFile("srcName",
+ varName.Count[:],
+ varName.Pos[:],
+ varName.NumStmt[:])
+}
+`,
+ },
+ {
+ name: "existing _ import",
+ in: `package main
+
+import _ "github.com/bazelbuild/rules_go/go/tools/coverdata"
+`,
+ out: `package main
+
+import coverdata "github.com/bazelbuild/rules_go/go/tools/coverdata"
+
+func init() {
+ coverdata.RegisterFile("srcName",
+ varName.Count[:],
+ varName.Pos[:],
+ varName.NumStmt[:])
+}
+`,
+ },
+ {
+ name: "existing renamed import",
+ in: `package main
+
+import cover0 "github.com/bazelbuild/rules_go/go/tools/coverdata"
+`,
+ out: `package main
+
+import cover0 "github.com/bazelbuild/rules_go/go/tools/coverdata"
+
+func init() {
+ cover0.RegisterFile("srcName",
+ varName.Count[:],
+ varName.Pos[:],
+ varName.NumStmt[:])
+}
+`,
+ },
+}
+
+func TestRegisterCoverage(t *testing.T) {
+ var filename = filepath.Join(t.TempDir(), "test_input.go")
+ for _, test := range tests {
+ if err := ioutil.WriteFile(filename, []byte(test.in), 0666); err != nil {
+ t.Errorf("writing input file: %v", err)
+ return
+ }
+ err := registerCoverage(filename, "varName", "srcName")
+ if err != nil {
+ t.Errorf("%q: %+v", test.name, err)
+ continue
+ }
+ coverSrc, err := os.ReadFile(filename)
+ if err != nil {
+ t.Errorf("%q: %+v", test.name, err)
+ continue
+ }
+ if got, want := string(coverSrc), test.out; got != want {
+ t.Errorf("%q: got %v, want %v", test.name, got, want)
+ }
+ }
+}
diff --git a/go/tools/builders/edit.go b/go/tools/builders/edit.go
new file mode 100644
index 00000000..f8ccd52b
--- /dev/null
+++ b/go/tools/builders/edit.go
@@ -0,0 +1,95 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Copied from go1.17 tree: //src/cmd/internal/edit/edit.go
+
+// Package edit implements buffered position-based editing of byte slices.
+package main
+
+import (
+ "fmt"
+ "sort"
+)
+
+// A Buffer is a queue of edits to apply to a given byte slice.
+type Buffer struct {
+ old []byte
+ q edits
+}
+
+// An edit records a single text modification: change the bytes in [start,end) to new.
+type edit struct {
+ start int
+ end int
+ new string
+}
+
+// An edits is a list of edits that is sortable by start offset, breaking ties by end offset.
+type edits []edit
+
+func (x edits) Len() int { return len(x) }
+func (x edits) Swap(i, j int) { x[i], x[j] = x[j], x[i] }
+func (x edits) Less(i, j int) bool {
+ if x[i].start != x[j].start {
+ return x[i].start < x[j].start
+ }
+ return x[i].end < x[j].end
+}
+
+// NewBuffer returns a new buffer to accumulate changes to an initial data slice.
+// The returned buffer maintains a reference to the data, so the caller must ensure
+// the data is not modified until after the Buffer is done being used.
+func NewBuffer(data []byte) *Buffer {
+ return &Buffer{old: data}
+}
+
+func (b *Buffer) Insert(pos int, new string) {
+ if pos < 0 || pos > len(b.old) {
+ panic("invalid edit position")
+ }
+ b.q = append(b.q, edit{pos, pos, new})
+}
+
+func (b *Buffer) Delete(start, end int) {
+ if end < start || start < 0 || end > len(b.old) {
+ panic("invalid edit position")
+ }
+ b.q = append(b.q, edit{start, end, ""})
+}
+
+func (b *Buffer) Replace(start, end int, new string) {
+ if end < start || start < 0 || end > len(b.old) {
+ panic("invalid edit position")
+ }
+ b.q = append(b.q, edit{start, end, new})
+}
+
+// Bytes returns a new byte slice containing the original data
+// with the queued edits applied.
+func (b *Buffer) Bytes() []byte {
+ // Sort edits by starting position and then by ending position.
+ // Breaking ties by ending position allows insertions at point x
+ // to be applied before a replacement of the text at [x, y).
+ sort.Stable(b.q)
+
+ var new []byte
+ offset := 0
+ for i, e := range b.q {
+ if e.start < offset {
+ e0 := b.q[i-1]
+ panic(fmt.Sprintf("overlapping edits: [%d,%d)->%q, [%d,%d)->%q", e0.start, e0.end, e0.new, e.start, e.end, e.new))
+ }
+ new = append(new, b.old[offset:e.start]...)
+ offset = e.end
+ new = append(new, e.new...)
+ }
+ new = append(new, b.old[offset:]...)
+ return new
+}
+
+// String returns a string containing the original data
+// with the queued edits applied.
+func (b *Buffer) String() string {
+ return string(b.Bytes())
+}
diff --git a/go/tools/builders/embed.go b/go/tools/builders/embed.go
new file mode 100644
index 00000000..e68da974
--- /dev/null
+++ b/go/tools/builders/embed.go
@@ -0,0 +1,340 @@
+// Copyright 2017 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// embed generates a .go file from the contents of a list of data files. It is
+// invoked by go_embed_data as an action.
+package main
+
+import (
+ "archive/tar"
+ "archive/zip"
+ "bufio"
+ "errors"
+ "flag"
+ "fmt"
+ "io"
+ "log"
+ "os"
+ "path"
+ "path/filepath"
+ "strconv"
+ "strings"
+ "text/template"
+ "unicode/utf8"
+)
+
+var headerTpl = template.Must(template.New("embed").Parse(`// Generated by go_embed_data for {{.Label}}. DO NOT EDIT.
+
+package {{.Package}}
+
+`))
+
+var multiFooterTpl = template.Must(template.New("embed").Parse(`
+var {{.Var}} = map[string]{{.Type}}{
+{{- range $i, $f := .FoundSources}}
+ {{$.Key $f}}: {{$.Var}}_{{$i}},
+{{- end}}
+}
+
+`))
+
+func main() {
+ log.SetPrefix("embed: ")
+ log.SetFlags(0) // don't print timestamps
+ if err := run(os.Args); err != nil {
+ log.Fatal(err)
+ }
+}
+
+type configuration struct {
+ Label, Package, Var string
+ Multi bool
+ sources []string
+ FoundSources []string
+ out, workspace string
+ flatten, unpack, strData bool
+}
+
+func (c *configuration) Type() string {
+ if c.strData {
+ return "string"
+ } else {
+ return "[]byte"
+ }
+}
+
+func (c *configuration) Key(filename string) string {
+ workspacePrefix := "external/" + c.workspace + "/"
+ key := filepath.FromSlash(strings.TrimPrefix(filename, workspacePrefix))
+ if c.flatten {
+ key = path.Base(filename)
+ }
+ return strconv.Quote(key)
+}
+
+func run(args []string) error {
+ c, err := newConfiguration(args)
+ if err != nil {
+ return err
+ }
+
+ f, err := os.Create(c.out)
+ if err != nil {
+ return err
+ }
+ defer f.Close()
+ w := bufio.NewWriter(f)
+ defer w.Flush()
+
+ if err := headerTpl.Execute(w, c); err != nil {
+ return err
+ }
+
+ if c.Multi {
+ return embedMultipleFiles(c, w)
+ }
+ return embedSingleFile(c, w)
+}
+
+func newConfiguration(args []string) (*configuration, error) {
+ var c configuration
+ flags := flag.NewFlagSet("embed", flag.ExitOnError)
+ flags.StringVar(&c.Label, "label", "", "Label of the rule being executed (required)")
+ flags.StringVar(&c.Package, "package", "", "Go package name (required)")
+ flags.StringVar(&c.Var, "var", "", "Variable name (required)")
+ flags.BoolVar(&c.Multi, "multi", false, "Whether the variable is a map or a single value")
+ flags.StringVar(&c.out, "out", "", "Go file to generate (required)")
+ flags.StringVar(&c.workspace, "workspace", "", "Name of the workspace (required)")
+ flags.BoolVar(&c.flatten, "flatten", false, "Whether to access files by base name")
+ flags.BoolVar(&c.strData, "string", false, "Whether to store contents as strings")
+ flags.BoolVar(&c.unpack, "unpack", false, "Whether to treat files as archives to unpack.")
+ flags.Parse(args[1:])
+ if c.Label == "" {
+ return nil, errors.New("error: -label option not provided")
+ }
+ if c.Package == "" {
+ return nil, errors.New("error: -package option not provided")
+ }
+ if c.Var == "" {
+ return nil, errors.New("error: -var option not provided")
+ }
+ if c.out == "" {
+ return nil, errors.New("error: -out option not provided")
+ }
+ if c.workspace == "" {
+ return nil, errors.New("error: -workspace option not provided")
+ }
+ c.sources = flags.Args()
+ if !c.Multi && len(c.sources) != 1 {
+ return nil, fmt.Errorf("error: -multi flag not given, so want exactly one source; got %d", len(c.sources))
+ }
+ if c.unpack {
+ if !c.Multi {
+ return nil, errors.New("error: -multi flag is required for -unpack mode.")
+ }
+ for _, src := range c.sources {
+ if ext := filepath.Ext(src); ext != ".zip" && ext != ".tar" {
+ return nil, fmt.Errorf("error: -unpack flag expects .zip or .tar extension (got %q)", ext)
+ }
+ }
+ }
+ return &c, nil
+}
+
+func embedSingleFile(c *configuration, w io.Writer) error {
+ dataBegin, dataEnd := "\"", "\"\n"
+ if !c.strData {
+ dataBegin, dataEnd = "[]byte(\"", "\")\n"
+ }
+
+ if _, err := fmt.Fprintf(w, "var %s = %s", c.Var, dataBegin); err != nil {
+ return err
+ }
+ if err := embedFileContents(w, c.sources[0]); err != nil {
+ return err
+ }
+ _, err := fmt.Fprint(w, dataEnd)
+ return err
+}
+
+func embedMultipleFiles(c *configuration, w io.Writer) error {
+ dataBegin, dataEnd := "\"", "\"\n"
+ if !c.strData {
+ dataBegin, dataEnd = "[]byte(\"", "\")\n"
+ }
+
+ if _, err := fmt.Fprint(w, "var (\n"); err != nil {
+ return err
+ }
+ if err := findSources(c, func(i int, f io.Reader) error {
+ if _, err := fmt.Fprintf(w, "\t%s_%d = %s", c.Var, i, dataBegin); err != nil {
+ return err
+ }
+ if _, err := io.Copy(&escapeWriter{w}, f); err != nil {
+ return err
+ }
+ if _, err := fmt.Fprint(w, dataEnd); err != nil {
+ return err
+ }
+ return nil
+ }); err != nil {
+ return err
+ }
+ if _, err := fmt.Fprint(w, ")\n"); err != nil {
+ return err
+ }
+ if err := multiFooterTpl.Execute(w, c); err != nil {
+ return err
+ }
+ return nil
+}
+
+func findSources(c *configuration, cb func(i int, f io.Reader) error) error {
+ if c.unpack {
+ for _, filename := range c.sources {
+ ext := filepath.Ext(filename)
+ if ext == ".zip" {
+ if err := findZipSources(c, filename, cb); err != nil {
+ return err
+ }
+ } else if ext == ".tar" {
+ if err := findTarSources(c, filename, cb); err != nil {
+ return err
+ }
+ } else {
+ panic("unknown archive extension: " + ext)
+ }
+ }
+ return nil
+ }
+ for _, filename := range c.sources {
+ f, err := os.Open(filename)
+ if err != nil {
+ return err
+ }
+ err = cb(len(c.FoundSources), bufio.NewReader(f))
+ f.Close()
+ if err != nil {
+ return err
+ }
+ c.FoundSources = append(c.FoundSources, filename)
+ }
+ return nil
+}
+
+func findZipSources(c *configuration, filename string, cb func(i int, f io.Reader) error) error {
+ r, err := zip.OpenReader(filename)
+ if err != nil {
+ return err
+ }
+ defer r.Close()
+ for _, file := range r.File {
+ f, err := file.Open()
+ if err != nil {
+ return err
+ }
+ err = cb(len(c.FoundSources), f)
+ f.Close()
+ if err != nil {
+ return err
+ }
+ c.FoundSources = append(c.FoundSources, file.Name)
+ }
+ return nil
+}
+
+func findTarSources(c *configuration, filename string, cb func(i int, f io.Reader) error) error {
+ tf, err := os.Open(filename)
+ if err != nil {
+ return err
+ }
+ defer tf.Close()
+ reader := tar.NewReader(bufio.NewReader(tf))
+ for {
+ h, err := reader.Next()
+ if err == io.EOF {
+ return nil
+ }
+ if err != nil {
+ return err
+ }
+ if h.Typeflag != tar.TypeReg {
+ continue
+ }
+ if err := cb(len(c.FoundSources), &io.LimitedReader{
+ R: reader,
+ N: h.Size,
+ }); err != nil {
+ return err
+ }
+ c.FoundSources = append(c.FoundSources, h.Name)
+ }
+}
+
+func embedFileContents(w io.Writer, filename string) error {
+ f, err := os.Open(filename)
+ if err != nil {
+ return err
+ }
+ defer f.Close()
+
+ _, err = io.Copy(&escapeWriter{w}, bufio.NewReader(f))
+ return err
+}
+
+type escapeWriter struct {
+ w io.Writer
+}
+
+func (w *escapeWriter) Write(data []byte) (n int, err error) {
+ n = len(data)
+
+ for err == nil && len(data) > 0 {
+ // https://golang.org/ref/spec#String_literals: "Within the quotes, any
+ // character may appear except newline and unescaped double quote. The
+ // text between the quotes forms the value of the literal, with backslash
+ // escapes interpreted as they are in rune literals […]."
+ switch b := data[0]; b {
+ case '\\':
+ _, err = w.w.Write([]byte(`\\`))
+ case '"':
+ _, err = w.w.Write([]byte(`\"`))
+ case '\n':
+ _, err = w.w.Write([]byte(`\n`))
+
+ case '\x00':
+ // https://golang.org/ref/spec#Source_code_representation: "Implementation
+ // restriction: For compatibility with other tools, a compiler may
+ // disallow the NUL character (U+0000) in the source text."
+ _, err = w.w.Write([]byte(`\x00`))
+
+ default:
+ // https://golang.org/ref/spec#Source_code_representation: "Implementation
+ // restriction: […] A byte order mark may be disallowed anywhere else in
+ // the source."
+ const byteOrderMark = '\uFEFF'
+
+ if r, size := utf8.DecodeRune(data); r != utf8.RuneError && r != byteOrderMark {
+ _, err = w.w.Write(data[:size])
+ data = data[size:]
+ continue
+ }
+
+ _, err = fmt.Fprintf(w.w, `\x%02x`, b)
+ }
+ data = data[1:]
+ }
+
+ return n - len(data), err
+}
diff --git a/go/tools/builders/embedcfg.go b/go/tools/builders/embedcfg.go
new file mode 100644
index 00000000..2de4f3b9
--- /dev/null
+++ b/go/tools/builders/embedcfg.go
@@ -0,0 +1,439 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "encoding/json"
+ "errors"
+ "fmt"
+ "io/ioutil"
+ "os"
+ "path"
+ "path/filepath"
+ "runtime"
+ "sort"
+ "strings"
+)
+
+// buildEmbedcfgFile writes an embedcfg file to be read by the compiler.
+// An embedcfg file can be used in Go 1.16 or higher if the "embed" package
+// is imported and there are one or more //go:embed comments in .go files.
+// The embedcfg file maps //go:embed patterns to actual file names.
+//
+// The embedcfg file will be created in workDir, and its name is returned.
+// The caller is responsible for deleting it. If no embedcfg file is needed,
+// "" is returned with no error.
+//
+// All source files listed in goSrcs with //go:embed comments must be in one
+// of the directories in embedRootDirs (not in a subdirectory). Embed patterns
+// are evaluated relative to the source directory. Embed sources (embedSrcs)
+// outside those directories are ignored, since they can't be matched by any
+// valid pattern.
+func buildEmbedcfgFile(goSrcs []fileInfo, embedSrcs, embedRootDirs []string, workDir string) (string, error) {
+ // Check whether this package uses embedding and whether the toolchain
+ // supports it (Go 1.16+). With Go 1.15 and lower, we'll try to compile
+ // without an embedcfg file, and the compiler will complain the "embed"
+ // package is missing.
+ var major, minor int
+ if n, err := fmt.Sscanf(runtime.Version(), "go%d.%d", &major, &minor); n != 2 || err != nil {
+ // Can't parse go version. Maybe it's a development version; fall through.
+ } else if major < 1 || (major == 1 && minor < 16) {
+ return "", nil
+ }
+ importEmbed := false
+ haveEmbed := false
+ for _, src := range goSrcs {
+ if len(src.embeds) > 0 {
+ haveEmbed = true
+ rootDir := findInRootDirs(src.filename, embedRootDirs)
+ if rootDir == "" || strings.Contains(src.filename[len(rootDir)+1:], string(filepath.Separator)) {
+ // Report an error if a source files appears in a subdirectory of
+ // another source directory. In this situation, the same file could be
+ // referenced with different paths.
+ return "", fmt.Errorf("%s: source files with //go:embed should be in same directory. Allowed directories are:\n\t%s",
+ src.filename,
+ strings.Join(embedRootDirs, "\n\t"))
+ }
+ }
+ for _, imp := range src.imports {
+ if imp.path == "embed" {
+ importEmbed = true
+ }
+ }
+ }
+ if !importEmbed || !haveEmbed {
+ return "", nil
+ }
+
+ // Build a tree of embeddable files. This includes paths listed with
+ // -embedsrc. If one of those paths is a directory, the tree includes
+ // its files and subdirectories. Paths in the tree are relative to the
+ // path in embedRootDirs that contains them.
+ root, err := buildEmbedTree(embedSrcs, embedRootDirs)
+ if err != nil {
+ return "", err
+ }
+
+ // Resolve patterns to sets of files.
+ var embedcfg struct {
+ Patterns map[string][]string
+ Files map[string]string
+ }
+ embedcfg.Patterns = make(map[string][]string)
+ embedcfg.Files = make(map[string]string)
+ for _, src := range goSrcs {
+ for _, embed := range src.embeds {
+ matchedPaths, matchedFiles, err := resolveEmbed(embed, root)
+ if err != nil {
+ return "", err
+ }
+ embedcfg.Patterns[embed.pattern] = matchedPaths
+ for i, rel := range matchedPaths {
+ embedcfg.Files[rel] = matchedFiles[i]
+ }
+ }
+ }
+
+ // Write the configuration to a JSON file.
+ embedcfgData, err := json.MarshalIndent(&embedcfg, "", "\t")
+ if err != nil {
+ return "", err
+ }
+ embedcfgName := filepath.Join(workDir, "embedcfg")
+ if err := ioutil.WriteFile(embedcfgName, embedcfgData, 0o666); err != nil {
+ return "", err
+ }
+ return embedcfgName, nil
+}
+
+// findInRootDirs returns a string from rootDirs which is a parent of the
+// file path p. If there is no such string, findInRootDirs returns "".
+func findInRootDirs(p string, rootDirs []string) string {
+ dir := filepath.Dir(p)
+ for _, rootDir := range rootDirs {
+ if rootDir == dir ||
+ (strings.HasPrefix(dir, rootDir) && len(dir) > len(rootDir)+1 && dir[len(rootDir)] == filepath.Separator) {
+ return rootDir
+ }
+ }
+ return ""
+}
+
+// embedNode represents an embeddable file or directory in a tree.
+type embedNode struct {
+ name string // base name
+ path string // absolute file path
+ children map[string]*embedNode // non-nil for directory
+ childNames []string // sorted
+}
+
+// add inserts file nodes into the tree rooted at f for the slash-separated
+// path src, relative to the absolute file path rootDir. If src points to a
+// directory, add recursively inserts nodes for its contents. If a node already
+// exists (for example, if a source file and a generated file have the same
+// name), add leaves the existing node in place.
+func (n *embedNode) add(rootDir, src string) error {
+ // Create nodes for parents of src.
+ parent := n
+ parts := strings.Split(src, "/")
+ for _, p := range parts[:len(parts)-1] {
+ if parent.children[p] == nil {
+ parent.children[p] = &embedNode{
+ name: p,
+ children: make(map[string]*embedNode),
+ }
+ }
+ parent = parent.children[p]
+ }
+
+ // Create a node for src. If src is a directory, recursively create nodes for
+ // its contents. Go embedding ignores symbolic links, but Bazel may use links
+ // for generated files and directories, so we follow them here.
+ var visit func(*embedNode, string, os.FileInfo) error
+ visit = func(parent *embedNode, path string, fi os.FileInfo) error {
+ base := filepath.Base(path)
+ if parent.children[base] == nil {
+ parent.children[base] = &embedNode{name: base, path: path}
+ }
+ if !fi.IsDir() {
+ return nil
+ }
+ node := parent.children[base]
+ node.children = make(map[string]*embedNode)
+ f, err := os.Open(path)
+ if err != nil {
+ return err
+ }
+ names, err := f.Readdirnames(0)
+ f.Close()
+ if err != nil {
+ return err
+ }
+ for _, name := range names {
+ cPath := filepath.Join(path, name)
+ cfi, err := os.Stat(cPath)
+ if err != nil {
+ return err
+ }
+ if err := visit(node, cPath, cfi); err != nil {
+ return err
+ }
+ }
+ return nil
+ }
+
+ path := filepath.Join(rootDir, src)
+ fi, err := os.Stat(path)
+ if err != nil {
+ return err
+ }
+ return visit(parent, path, fi)
+}
+
+func (n *embedNode) isDir() bool {
+ return n.children != nil
+}
+
+// get returns a tree node, given a slash-separated path relative to the
+// receiver. get returns nil if no node exists with that path.
+func (n *embedNode) get(path string) *embedNode {
+ if path == "." || path == "" {
+ return n
+ }
+ for _, part := range strings.Split(path, "/") {
+ n = n.children[part]
+ if n == nil {
+ return nil
+ }
+ }
+ return n
+}
+
+var errSkip = errors.New("skip")
+
+// walk calls fn on each node in the tree rooted at n in depth-first pre-order.
+func (n *embedNode) walk(fn func(rel string, n *embedNode) error) error {
+ var visit func(string, *embedNode) error
+ visit = func(rel string, node *embedNode) error {
+ err := fn(rel, node)
+ if err == errSkip {
+ return nil
+ } else if err != nil {
+ return err
+ }
+ for _, name := range node.childNames {
+ if err := visit(path.Join(rel, name), node.children[name]); err != nil && err != errSkip {
+ return err
+ }
+ }
+ return nil
+ }
+ err := visit("", n)
+ if err == errSkip {
+ return nil
+ }
+ return err
+}
+
+// buildEmbedTree constructs a logical directory tree of embeddable files.
+// The tree may contain a mix of static and generated files from multiple
+// root directories. Directory artifacts are recursively expanded.
+func buildEmbedTree(embedSrcs, embedRootDirs []string) (root *embedNode, err error) {
+ defer func() {
+ if err != nil {
+ err = fmt.Errorf("building tree of embeddable files in directories %s: %v", strings.Join(embedRootDirs, string(filepath.ListSeparator)), err)
+ }
+ }()
+
+ // Add each path to the tree.
+ root = &embedNode{name: "", children: make(map[string]*embedNode)}
+ for _, src := range embedSrcs {
+ rootDir := findInRootDirs(src, embedRootDirs)
+ if rootDir == "" {
+ // Embedded path cannot be matched by any valid pattern. Ignore.
+ continue
+ }
+ rel := filepath.ToSlash(src[len(rootDir)+1:])
+ if err := root.add(rootDir, rel); err != nil {
+ return nil, err
+ }
+ }
+
+ // Sort children in each directory node.
+ var visit func(*embedNode)
+ visit = func(node *embedNode) {
+ node.childNames = make([]string, 0, len(node.children))
+ for name, child := range node.children {
+ node.childNames = append(node.childNames, name)
+ visit(child)
+ }
+ sort.Strings(node.childNames)
+ }
+ visit(root)
+
+ return root, nil
+}
+
+// resolveEmbed matches a //go:embed pattern in a source file to a set of
+// embeddable files in the given tree.
+func resolveEmbed(embed fileEmbed, root *embedNode) (matchedPaths, matchedFiles []string, err error) {
+ defer func() {
+ if err != nil {
+ err = fmt.Errorf("%v: could not embed %s: %v", embed.pos, embed.pattern, err)
+ }
+ }()
+
+ // Remove optional "all:" prefix from pattern and set matchAll flag if present.
+ // See https://pkg.go.dev/embed#hdr-Directives for details.
+ pattern := embed.pattern
+ var matchAll bool
+ if strings.HasPrefix(pattern, "all:") {
+ matchAll = true
+ pattern = pattern[4:]
+ }
+
+ // Check that the pattern has valid syntax.
+ if _, err := path.Match(pattern, ""); err != nil || !validEmbedPattern(pattern) {
+ return nil, nil, fmt.Errorf("invalid pattern syntax")
+ }
+
+ // Search for matching files.
+ err = root.walk(func(matchRel string, matchNode *embedNode) error {
+ if ok, _ := path.Match(pattern, matchRel); !ok {
+ // Non-matching file or directory.
+ return nil
+ }
+
+ // TODO: Should check that directories along path do not begin a new module
+ // (do not contain a go.mod).
+ // https://cs.opensource.google/go/go/+/master:src/cmd/go/internal/load/pkg.go;l=2158;drc=261fe25c83a94fc3defe064baed3944cd3d16959
+ for dir := matchRel; len(dir) > 1; dir = filepath.Dir(dir) {
+ if base := path.Base(matchRel); isBadEmbedName(base) {
+ what := "file"
+ if matchNode.isDir() {
+ what = "directory"
+ }
+ if dir == matchRel {
+ return fmt.Errorf("cannot embed %s %s: invalid name %s", what, matchRel, base)
+ } else {
+ return fmt.Errorf("cannot embed %s %s: in invalid directory %s", what, matchRel, base)
+ }
+ }
+ }
+
+ if !matchNode.isDir() {
+ // Matching file. Add to list.
+ matchedPaths = append(matchedPaths, matchRel)
+ matchedFiles = append(matchedFiles, matchNode.path)
+ return nil
+ }
+
+ // Matching directory. Recursively add all files in subdirectories.
+ // Don't add hidden files or directories (starting with "." or "_"),
+ // unless "all:" prefix was set.
+ // See golang/go#42328.
+ matchTreeErr := matchNode.walk(func(childRel string, childNode *embedNode) error {
+ // TODO: Should check that directories along path do not begin a new module
+ // https://cs.opensource.google/go/go/+/master:src/cmd/go/internal/load/pkg.go;l=2158;drc=261fe25c83a94fc3defe064baed3944cd3d16959
+ if childRel != "" {
+ base := path.Base(childRel)
+ if isBadEmbedName(base) || (!matchAll && (strings.HasPrefix(base, ".") || strings.HasPrefix(base, "_"))) {
+ if childNode.isDir() {
+ return errSkip
+ }
+ return nil
+ }
+ }
+ if !childNode.isDir() {
+ matchedPaths = append(matchedPaths, path.Join(matchRel, childRel))
+ matchedFiles = append(matchedFiles, childNode.path)
+ }
+ return nil
+ })
+ if matchTreeErr != nil {
+ return matchTreeErr
+ }
+ return errSkip
+ })
+ if err != nil && err != errSkip {
+ return nil, nil, err
+ }
+ if len(matchedPaths) == 0 {
+ return nil, nil, fmt.Errorf("no matching files found")
+ }
+ return matchedPaths, matchedFiles, nil
+}
+
+func validEmbedPattern(pattern string) bool {
+ return pattern != "." && fsValidPath(pattern)
+}
+
+// validPath reports whether the given path name
+// is valid for use in a call to Open.
+// Path names passed to open are unrooted, slash-separated
+// sequences of path elements, like “x/y/z”.
+// Path names must not contain a “.” or “..” or empty element,
+// except for the special case that the root directory is named “.”.
+//
+// Paths are slash-separated on all systems, even Windows.
+// Backslashes must not appear in path names.
+//
+// Copied from io/fs.ValidPath in Go 1.16beta1.
+func fsValidPath(name string) bool {
+ if name == "." {
+ // special case
+ return true
+ }
+
+ // Iterate over elements in name, checking each.
+ for {
+ i := 0
+ for i < len(name) && name[i] != '/' {
+ if name[i] == '\\' {
+ return false
+ }
+ i++
+ }
+ elem := name[:i]
+ if elem == "" || elem == "." || elem == ".." {
+ return false
+ }
+ if i == len(name) {
+ return true // reached clean ending
+ }
+ name = name[i+1:]
+ }
+}
+
+// isBadEmbedName reports whether name is the base name of a file that
+// can't or won't be included in modules and therefore shouldn't be treated
+// as existing for embedding.
+//
+// TODO: This should use the equivalent of golang.org/x/mod/module.CheckFilePath instead of fsValidPath.
+// https://cs.opensource.google/go/go/+/master:src/cmd/go/internal/load/pkg.go;l=2200;drc=261fe25c83a94fc3defe064baed3944cd3d16959
+func isBadEmbedName(name string) bool {
+ if !fsValidPath(name) {
+ return true
+ }
+ switch name {
+ // Empty string should be impossible but make it bad.
+ case "":
+ return true
+ // Version control directories won't be present in module.
+ case ".bzr", ".hg", ".git", ".svn":
+ return true
+ }
+ return false
+}
diff --git a/go/tools/builders/env.go b/go/tools/builders/env.go
new file mode 100644
index 00000000..177617f8
--- /dev/null
+++ b/go/tools/builders/env.go
@@ -0,0 +1,474 @@
+// Copyright 2017 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "bytes"
+ "errors"
+ "flag"
+ "fmt"
+ "io"
+ "io/ioutil"
+ "log"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "runtime"
+ "strconv"
+ "strings"
+)
+
+var (
+ // cgoEnvVars is the list of all cgo environment variable
+ cgoEnvVars = []string{"CGO_CFLAGS", "CGO_CXXFLAGS", "CGO_CPPFLAGS", "CGO_LDFLAGS"}
+ // cgoAbsEnvFlags are all the flags that need absolute path in cgoEnvVars
+ cgoAbsEnvFlags = []string{"-I", "-L", "-isysroot", "-isystem", "-iquote", "-include", "-gcc-toolchain", "--sysroot", "-resource-dir", "-fsanitize-blacklist", "-fsanitize-ignorelist"}
+)
+
+// env holds a small amount of Go environment and toolchain information
+// which is common to multiple builders. Most Bazel-agnostic build information
+// is collected in go/build.Default though.
+//
+// See ./README.rst for more information about handling arguments and
+// environment variables.
+type env struct {
+ // sdk is the path to the Go SDK, which contains tools for the host
+ // platform. This may be different than GOROOT.
+ sdk string
+
+ // installSuffix is the name of the directory below GOROOT/pkg that contains
+ // the .a files for the standard library we should build against.
+ // For example, linux_amd64_race.
+ installSuffix string
+
+ // verbose indicates whether subprocess command lines should be printed.
+ verbose bool
+
+ // workDirPath is a temporary work directory. It is created lazily.
+ workDirPath string
+
+ shouldPreserveWorkDir bool
+}
+
+// envFlags registers flags common to multiple builders and returns an env
+// configured with those flags.
+func envFlags(flags *flag.FlagSet) *env {
+ env := &env{}
+ flags.StringVar(&env.sdk, "sdk", "", "Path to the Go SDK.")
+ flags.Var(&tagFlag{}, "tags", "List of build tags considered true.")
+ flags.StringVar(&env.installSuffix, "installsuffix", "", "Standard library under GOROOT/pkg")
+ flags.BoolVar(&env.verbose, "v", false, "Whether subprocess command lines should be printed")
+ flags.BoolVar(&env.shouldPreserveWorkDir, "work", false, "if true, the temporary work directory will be preserved")
+ return env
+}
+
+// checkFlags checks whether env flags were set to valid values. checkFlags
+// should be called after parsing flags.
+func (e *env) checkFlags() error {
+ if e.sdk == "" {
+ return errors.New("-sdk was not set")
+ }
+ return nil
+}
+
+// workDir returns a path to a temporary work directory. The same directory
+// is returned on multiple calls. The caller is responsible for cleaning
+// up the work directory by calling cleanup.
+func (e *env) workDir() (path string, cleanup func(), err error) {
+ if e.workDirPath != "" {
+ return e.workDirPath, func() {}, nil
+ }
+ // Keep the stem "rules_go_work" in sync with reproducible_binary_test.go.
+ e.workDirPath, err = ioutil.TempDir("", "rules_go_work-")
+ if err != nil {
+ return "", func() {}, err
+ }
+ if e.verbose {
+ log.Printf("WORK=%s\n", e.workDirPath)
+ }
+ if e.shouldPreserveWorkDir {
+ cleanup = func() {}
+ } else {
+ cleanup = func() { os.RemoveAll(e.workDirPath) }
+ }
+ return e.workDirPath, cleanup, nil
+}
+
+// goTool returns a slice containing the path to an executable at
+// $GOROOT/pkg/$GOOS_$GOARCH/$tool and additional arguments.
+func (e *env) goTool(tool string, args ...string) []string {
+ platform := fmt.Sprintf("%s_%s", runtime.GOOS, runtime.GOARCH)
+ toolPath := filepath.Join(e.sdk, "pkg", "tool", platform, tool)
+ if runtime.GOOS == "windows" {
+ toolPath += ".exe"
+ }
+ return append([]string{toolPath}, args...)
+}
+
+// goCmd returns a slice containing the path to the go executable
+// and additional arguments.
+func (e *env) goCmd(cmd string, args ...string) []string {
+ exe := filepath.Join(e.sdk, "bin", "go")
+ if runtime.GOOS == "windows" {
+ exe += ".exe"
+ }
+ return append([]string{exe, cmd}, args...)
+}
+
+// runCommand executes a subprocess that inherits stdout, stderr, and the
+// environment from this process.
+func (e *env) runCommand(args []string) error {
+ cmd := exec.Command(args[0], args[1:]...)
+ // Redirecting stdout to stderr. This mirrors behavior in the go command:
+ // https://go.googlesource.com/go/+/refs/tags/go1.15.2/src/cmd/go/internal/work/exec.go#1958
+ buf := &bytes.Buffer{}
+ cmd.Stdout = buf
+ cmd.Stderr = buf
+ err := runAndLogCommand(cmd, e.verbose)
+ os.Stderr.Write(relativizePaths(buf.Bytes()))
+ return err
+}
+
+// runCommandToFile executes a subprocess and writes stdout/stderr to the given
+// writers.
+func (e *env) runCommandToFile(out, err io.Writer, args []string) error {
+ cmd := exec.Command(args[0], args[1:]...)
+ cmd.Stdout = out
+ cmd.Stderr = err
+ return runAndLogCommand(cmd, e.verbose)
+}
+
+func absEnv(envNameList []string, argList []string) error {
+ for _, envName := range envNameList {
+ splitedEnv := strings.Fields(os.Getenv(envName))
+ absArgs(splitedEnv, argList)
+ if err := os.Setenv(envName, strings.Join(splitedEnv, " ")); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func runAndLogCommand(cmd *exec.Cmd, verbose bool) error {
+ if verbose {
+ fmt.Fprintln(os.Stderr, formatCommand(cmd))
+ }
+ cleanup := passLongArgsInResponseFiles(cmd)
+ defer cleanup()
+ if err := cmd.Run(); err != nil {
+ return fmt.Errorf("error running subcommand %s: %v", cmd.Path, err)
+ }
+ return nil
+}
+
+// expandParamsFiles looks for arguments in args of the form
+// "-param=filename". When it finds these arguments it reads the file "filename"
+// and replaces the argument with its content.
+// It returns the expanded arguments as well as a bool that is true if any param
+// files have been passed.
+func expandParamsFiles(args []string) ([]string, bool, error) {
+ var paramsIndices []int
+ for i, arg := range args {
+ if strings.HasPrefix(arg, "-param=") {
+ paramsIndices = append(paramsIndices, i)
+ }
+ }
+ if len(paramsIndices) == 0 {
+ return args, false, nil
+ }
+ var expandedArgs []string
+ last := 0
+ for _, pi := range paramsIndices {
+ expandedArgs = append(expandedArgs, args[last:pi]...)
+ last = pi + 1
+
+ fileName := args[pi][len("-param="):]
+ fileArgs, err := readParamsFile(fileName)
+ if err != nil {
+ return nil, true, err
+ }
+ expandedArgs = append(expandedArgs, fileArgs...)
+ }
+ expandedArgs = append(expandedArgs, args[last:]...)
+ return expandedArgs, true, nil
+}
+
+// readParamsFiles parses a Bazel params file in "shell" format. The file
+// should contain one argument per line. Arguments may be quoted with single
+// quotes. All characters within quoted strings are interpreted literally
+// including newlines and excepting single quotes. Characters outside quoted
+// strings may be escaped with a backslash.
+func readParamsFile(name string) ([]string, error) {
+ data, err := ioutil.ReadFile(name)
+ if err != nil {
+ return nil, err
+ }
+
+ var args []string
+ var arg []byte
+ quote := false
+ escape := false
+ for p := 0; p < len(data); p++ {
+ b := data[p]
+ switch {
+ case escape:
+ arg = append(arg, b)
+ escape = false
+
+ case b == '\'':
+ quote = !quote
+
+ case !quote && b == '\\':
+ escape = true
+
+ case !quote && b == '\n':
+ args = append(args, string(arg))
+ arg = arg[:0]
+
+ default:
+ arg = append(arg, b)
+ }
+ }
+ if quote {
+ return nil, fmt.Errorf("unterminated quote")
+ }
+ if escape {
+ return nil, fmt.Errorf("unterminated escape")
+ }
+ if len(arg) > 0 {
+ args = append(args, string(arg))
+ }
+ return args, nil
+}
+
+// writeParamsFile formats a list of arguments in Bazel's "shell" format and writes
+// it to a file.
+func writeParamsFile(path string, args []string) error {
+ buf := new(bytes.Buffer)
+ for _, arg := range args {
+ if !strings.ContainsAny(arg, "'\n\\") {
+ fmt.Fprintln(buf, arg)
+ continue
+ }
+ buf.WriteByte('\'')
+ for _, r := range arg {
+ if r == '\'' {
+ buf.WriteString(`'\''`)
+ } else {
+ buf.WriteRune(r)
+ }
+ }
+ buf.WriteString("'\n")
+ }
+ return ioutil.WriteFile(path, buf.Bytes(), 0666)
+}
+
+// splitArgs splits a list of command line arguments into two parts: arguments
+// that should be interpreted by the builder (before "--"), and arguments
+// that should be passed through to the underlying tool (after "--").
+func splitArgs(args []string) (builderArgs []string, toolArgs []string) {
+ for i, arg := range args {
+ if arg == "--" {
+ return args[:i], args[i+1:]
+ }
+ }
+ return args, nil
+}
+
+// abs returns the absolute representation of path. Some tools/APIs require
+// absolute paths to work correctly. Most notably, golang on Windows cannot
+// handle relative paths to files whose absolute path is > ~250 chars, while
+// it can handle absolute paths. See http://goo.gl/eqeWjm.
+//
+// Note that strings that begin with "__BAZEL_" are not absolutized. These are
+// used on macOS for paths that the compiler wrapper (wrapped_clang) is
+// supposed to know about.
+func abs(path string) string {
+ if strings.HasPrefix(path, "__BAZEL_") {
+ return path
+ }
+
+ if abs, err := filepath.Abs(path); err != nil {
+ return path
+ } else {
+ return abs
+ }
+}
+
+// absArgs applies abs to strings that appear in args. Only paths that are
+// part of options named by flags are modified.
+func absArgs(args []string, flags []string) {
+ absNext := false
+ for i := range args {
+ if absNext {
+ args[i] = abs(args[i])
+ absNext = false
+ continue
+ }
+ for _, f := range flags {
+ if !strings.HasPrefix(args[i], f) {
+ continue
+ }
+ possibleValue := args[i][len(f):]
+ if len(possibleValue) == 0 {
+ absNext = true
+ break
+ }
+ separator := ""
+ if possibleValue[0] == '=' {
+ possibleValue = possibleValue[1:]
+ separator = "="
+ }
+ args[i] = fmt.Sprintf("%s%s%s", f, separator, abs(possibleValue))
+ break
+ }
+ }
+}
+
+// relativizePaths converts absolute paths found in the given output string to
+// relative, if they are within the working directory.
+func relativizePaths(output []byte) []byte {
+ dir, err := os.Getwd()
+ if dir == "" || err != nil {
+ return output
+ }
+ dirBytes := make([]byte, len(dir), len(dir)+1)
+ copy(dirBytes, dir)
+ if bytes.HasSuffix(dirBytes, []byte{filepath.Separator}) {
+ return bytes.ReplaceAll(output, dirBytes, nil)
+ }
+
+ // This is the common case.
+ // Replace "$CWD/" with "" and "$CWD" with "."
+ dirBytes = append(dirBytes, filepath.Separator)
+ output = bytes.ReplaceAll(output, dirBytes, nil)
+ dirBytes = dirBytes[:len(dirBytes)-1]
+ return bytes.ReplaceAll(output, dirBytes, []byte{'.'})
+}
+
+// formatCommand formats cmd as a string that can be pasted into a shell.
+// Spaces in environment variables and arguments are escaped as needed.
+func formatCommand(cmd *exec.Cmd) string {
+ quoteIfNeeded := func(s string) string {
+ if strings.IndexByte(s, ' ') < 0 {
+ return s
+ }
+ return strconv.Quote(s)
+ }
+ quoteEnvIfNeeded := func(s string) string {
+ eq := strings.IndexByte(s, '=')
+ if eq < 0 {
+ return s
+ }
+ key, value := s[:eq], s[eq+1:]
+ if strings.IndexByte(value, ' ') < 0 {
+ return s
+ }
+ return fmt.Sprintf("%s=%s", key, strconv.Quote(value))
+ }
+ var w bytes.Buffer
+ environ := cmd.Env
+ if environ == nil {
+ environ = os.Environ()
+ }
+ for _, e := range environ {
+ fmt.Fprintf(&w, "%s \\\n", quoteEnvIfNeeded(e))
+ }
+
+ sep := ""
+ for _, arg := range cmd.Args {
+ fmt.Fprintf(&w, "%s%s", sep, quoteIfNeeded(arg))
+ sep = " "
+ }
+ return w.String()
+}
+
+// passLongArgsInResponseFiles modifies cmd such that, for
+// certain programs, long arguments are passed in "response files", a
+// file on disk with the arguments, with one arg per line. An actual
+// argument starting with '@' means that the rest of the argument is
+// a filename of arguments to expand.
+//
+// See https://github.com/golang/go/issues/18468 (Windows) and
+// https://github.com/golang/go/issues/37768 (Darwin).
+func passLongArgsInResponseFiles(cmd *exec.Cmd) (cleanup func()) {
+ cleanup = func() {} // no cleanup by default
+ var argLen int
+ for _, arg := range cmd.Args {
+ argLen += len(arg)
+ }
+ // If we're not approaching 32KB of args, just pass args normally.
+ // (use 30KB instead to be conservative; not sure how accounting is done)
+ if !useResponseFile(cmd.Path, argLen) {
+ return
+ }
+ tf, err := ioutil.TempFile("", "args")
+ if err != nil {
+ log.Fatalf("error writing long arguments to response file: %v", err)
+ }
+ cleanup = func() { os.Remove(tf.Name()) }
+ var buf bytes.Buffer
+ for _, arg := range cmd.Args[1:] {
+ fmt.Fprintf(&buf, "%s\n", arg)
+ }
+ if _, err := tf.Write(buf.Bytes()); err != nil {
+ tf.Close()
+ cleanup()
+ log.Fatalf("error writing long arguments to response file: %v", err)
+ }
+ if err := tf.Close(); err != nil {
+ cleanup()
+ log.Fatalf("error writing long arguments to response file: %v", err)
+ }
+ cmd.Args = []string{cmd.Args[0], "@" + tf.Name()}
+ return cleanup
+}
+
+// quotePathIfNeeded quotes path if it contains whitespace and isn't already quoted.
+// Use this for paths that will be passed through
+// https://github.com/golang/go/blob/06264b740e3bfe619f5e90359d8f0d521bd47806/src/cmd/internal/quoted/quoted.go#L25
+func quotePathIfNeeded(path string) string {
+ if strings.HasPrefix(path, "\"") || strings.HasPrefix(path, "'") {
+ // Assume already quoted
+ return path
+ }
+ // https://github.com/golang/go/blob/06264b740e3bfe619f5e90359d8f0d521bd47806/src/cmd/internal/quoted/quoted.go#L16
+ if strings.IndexAny(path, " \t\n\r") < 0 {
+ // Does not require quoting
+ return path
+ }
+ // Escaping quotes is not supported, so we can assume path doesn't contain any quotes.
+ return "'" + path + "'"
+}
+
+func useResponseFile(path string, argLen int) bool {
+ // Unless the program uses objabi.Flagparse, which understands
+ // response files, don't use response files.
+ // TODO: do we need more commands? asm? cgo? For now, no.
+ prog := strings.TrimSuffix(filepath.Base(path), ".exe")
+ switch prog {
+ case "compile", "link":
+ default:
+ return false
+ }
+ // Windows has a limit of 32 KB arguments. To be conservative and not
+ // worry about whether that includes spaces or not, just use 30 KB.
+ // Darwin's limit is less clear. The OS claims 256KB, but we've seen
+ // failures with arglen as small as 50KB.
+ if argLen > (30 << 10) {
+ return true
+ }
+ return false
+}
diff --git a/go/tools/builders/filter.go b/go/tools/builders/filter.go
new file mode 100644
index 00000000..fbb0f2ac
--- /dev/null
+++ b/go/tools/builders/filter.go
@@ -0,0 +1,168 @@
+// Copyright 2017 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "fmt"
+ "go/ast"
+ "go/build"
+ "go/token"
+ "os"
+ "path/filepath"
+ "strings"
+)
+
+type fileInfo struct {
+ filename string
+ ext ext
+ header []byte
+ fset *token.FileSet
+ parsed *ast.File
+ parseErr error
+ matched bool
+ isCgo bool
+ pkg string
+ imports []fileImport
+ embeds []fileEmbed
+}
+
+type ext int
+
+const (
+ goExt ext = iota
+ cExt
+ cxxExt
+ objcExt
+ objcxxExt
+ sExt
+ hExt
+)
+
+type fileImport struct {
+ path string
+ pos token.Pos
+ doc *ast.CommentGroup
+}
+
+type fileEmbed struct {
+ pattern string
+ pos token.Position
+}
+
+type archiveSrcs struct {
+ goSrcs, cSrcs, cxxSrcs, objcSrcs, objcxxSrcs, sSrcs, hSrcs []fileInfo
+}
+
+// filterAndSplitFiles filters files using build constraints and collates
+// them by extension.
+func filterAndSplitFiles(fileNames []string) (archiveSrcs, error) {
+ var res archiveSrcs
+ for _, s := range fileNames {
+ src, err := readFileInfo(build.Default, s)
+ if err != nil {
+ return archiveSrcs{}, err
+ }
+ if !src.matched {
+ continue
+ }
+ var srcs *[]fileInfo
+ switch src.ext {
+ case goExt:
+ srcs = &res.goSrcs
+ case cExt:
+ srcs = &res.cSrcs
+ case cxxExt:
+ srcs = &res.cxxSrcs
+ case objcExt:
+ srcs = &res.objcSrcs
+ case objcxxExt:
+ srcs = &res.objcxxSrcs
+ case sExt:
+ srcs = &res.sSrcs
+ case hExt:
+ srcs = &res.hSrcs
+ }
+ *srcs = append(*srcs, src)
+ }
+ return res, nil
+}
+
+// readFileInfo applies build constraints to an input file and returns whether
+// it should be compiled.
+func readFileInfo(bctx build.Context, input string) (fileInfo, error) {
+ fi := fileInfo{filename: input}
+ if ext := filepath.Ext(input); ext == ".C" {
+ fi.ext = cxxExt
+ } else {
+ switch strings.ToLower(ext) {
+ case ".go":
+ fi.ext = goExt
+ case ".c":
+ fi.ext = cExt
+ case ".cc", ".cxx", ".cpp":
+ fi.ext = cxxExt
+ case ".m":
+ fi.ext = objcExt
+ case ".mm":
+ fi.ext = objcxxExt
+ case ".s":
+ fi.ext = sExt
+ case ".h", ".hh", ".hpp", ".hxx":
+ fi.ext = hExt
+ default:
+ return fileInfo{}, fmt.Errorf("unrecognized file extension: %s", ext)
+ }
+ }
+
+ dir, base := filepath.Split(input)
+ // Check build constraints on non-cgo files.
+ // Skip cgo files, since they get rejected (due to leading '_') and won't
+ // have any build constraints anyway.
+ if strings.HasPrefix(base, "_cgo") {
+ fi.matched = true
+ } else {
+ match, err := bctx.MatchFile(dir, base)
+ if err != nil {
+ return fi, err
+ }
+ fi.matched = match
+ }
+ // If it's not a go file, there's nothing more to read.
+ if fi.ext != goExt {
+ return fi, nil
+ }
+
+ // Scan the file for imports and embeds.
+ f, err := os.Open(input)
+ if err != nil {
+ return fileInfo{}, err
+ }
+ defer f.Close()
+ fi.fset = token.NewFileSet()
+ if err := readGoInfo(f, &fi); err != nil {
+ return fileInfo{}, err
+ }
+
+ // Exclude cgo files if cgo is not enabled.
+ for _, imp := range fi.imports {
+ if imp.path == "C" {
+ fi.isCgo = true
+ break
+ }
+ }
+ fi.matched = fi.matched && (bctx.CgoEnabled || !fi.isCgo)
+
+ return fi, nil
+}
diff --git a/go/tools/builders/filter_buildid.go b/go/tools/builders/filter_buildid.go
new file mode 100644
index 00000000..893a0f6a
--- /dev/null
+++ b/go/tools/builders/filter_buildid.go
@@ -0,0 +1,44 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "os"
+ "os/exec"
+ "runtime"
+ "syscall"
+)
+
+// filterBuildID executes the tool on the command line, filtering out any
+// -buildid arguments. It is intended to be used with -toolexec.
+func filterBuildID(args []string) error {
+ newArgs := make([]string, 0, len(args))
+ for i := 0; i < len(args); i++ {
+ arg := args[i]
+ if arg == "-buildid" {
+ i++
+ continue
+ }
+ newArgs = append(newArgs, arg)
+ }
+ if runtime.GOOS == "windows" {
+ cmd := exec.Command(newArgs[0], newArgs[1:]...)
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+ return cmd.Run()
+ } else {
+ return syscall.Exec(newArgs[0], newArgs, os.Environ())
+ }
+}
diff --git a/go/tools/builders/filter_test.go b/go/tools/builders/filter_test.go
new file mode 100644
index 00000000..61ec385b
--- /dev/null
+++ b/go/tools/builders/filter_test.go
@@ -0,0 +1,136 @@
+/* Copyright 2016 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package main
+
+import (
+ "go/build"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "reflect"
+ "sort"
+ "testing"
+)
+
+var testfiles = map[string]string{
+ "cgo.go": `
+//+build cgo
+
+package tags
+
+/*
+#include <stdio.h>
+#include <stdlib.h>
+
+void myprint(char* s) {
+ printf("%s", s);
+}
+*/
+
+import "C"
+
+func main() {
+ C.myprint("hello")
+}
+`,
+ "extra.go": `
+//+build a,b b,c
+
+package tags
+`,
+ "ignore.go": `
+//+build ignore
+
+package tags
+`,
+ "normal.go": `
+package tags
+`,
+ "on_darwin.go": `
+package tags
+`,
+ "system.go": `
+//+build arm,darwin linux,amd64
+
+package tags
+`,
+}
+
+func TestTags(t *testing.T) {
+ tempdir, err := ioutil.TempDir("", "goruletest")
+ if err != nil {
+ t.Fatalf("Error creating temporary directory: %v", err)
+ }
+ defer os.RemoveAll(tempdir)
+
+ input := []string{}
+ for k, v := range testfiles {
+ p := filepath.Join(tempdir, k)
+ if err := ioutil.WriteFile(p, []byte(v), 0644); err != nil {
+ t.Fatalf("WriteFile(%s): %v", p, err)
+ }
+ input = append(input, k)
+ }
+ sort.Strings(input)
+
+ wd, err := os.Getwd()
+ if err != nil {
+ t.Fatalf("Getwd: %v", err)
+ }
+
+ err = os.Chdir(tempdir)
+ if err != nil {
+ t.Fatalf("Chdir(%s): %v", tempdir, err)
+ }
+ defer os.Chdir(wd)
+
+ bctx := build.Default
+ // Always fake the os and arch
+ bctx.GOOS = "darwin"
+ bctx.GOARCH = "amd64"
+ bctx.CgoEnabled = false
+ runTest(t, bctx, input, []string{"normal.go", "on_darwin.go"})
+ bctx.GOOS = "linux"
+ runTest(t, bctx, input, []string{"normal.go", "system.go"})
+ bctx.GOARCH = "arm"
+ runTest(t, bctx, input, []string{"normal.go"})
+ bctx.BuildTags = []string{"a", "b"}
+ runTest(t, bctx, input, []string{"extra.go", "normal.go"})
+ bctx.BuildTags = []string{"a", "c"}
+ runTest(t, bctx, input, []string{"normal.go"})
+ bctx.CgoEnabled = true
+ runTest(t, bctx, input, []string{"cgo.go", "normal.go"})
+}
+
+func runTest(t *testing.T, bctx build.Context, inputs []string, expect []string) {
+ build.Default = bctx
+ got, err := filterAndSplitFiles(inputs)
+ if err != nil {
+ t.Errorf("filter %v,%v,%v,%v failed: %v", bctx.GOOS, bctx.GOARCH, bctx.CgoEnabled, bctx.BuildTags, err)
+ }
+ gotGoFilenames := make([]string, len(got.goSrcs))
+ for i, src := range got.goSrcs {
+ gotGoFilenames[i] = src.filename
+ }
+ if !reflect.DeepEqual(expect, gotGoFilenames) {
+ t.Errorf("filter %v,%v,%v,%v: expect %v got %v", bctx.GOOS, bctx.GOARCH, bctx.CgoEnabled, bctx.BuildTags, expect, got)
+ }
+}
+
+// abs is a dummy env.go abs to avoid depending on env.go and flags.go.
+func abs(p string) string {
+ return p
+}
diff --git a/go/tools/builders/flags.go b/go/tools/builders/flags.go
new file mode 100644
index 00000000..e3604cbd
--- /dev/null
+++ b/go/tools/builders/flags.go
@@ -0,0 +1,135 @@
+// Copyright 2017 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "errors"
+ "fmt"
+ "go/build"
+ "strings"
+ "unicode"
+)
+
+// multiFlag allows repeated string flags to be collected into a slice
+type multiFlag []string
+
+func (m *multiFlag) String() string {
+ if m == nil || len(*m) == 0 {
+ return ""
+ }
+ return fmt.Sprint(*m)
+}
+
+func (m *multiFlag) Set(v string) error {
+ (*m) = append(*m, v)
+ return nil
+}
+
+// quoteMultiFlag allows repeated string flags to be collected into a slice.
+// Flags are split on spaces. Single quotes are removed, and spaces within
+// quotes are removed. Literal quotes may be escaped with a backslash.
+type quoteMultiFlag []string
+
+func (m *quoteMultiFlag) String() string {
+ if m == nil || len(*m) == 0 {
+ return ""
+ }
+ return fmt.Sprint(*m)
+}
+
+func (m *quoteMultiFlag) Set(v string) error {
+ fs, err := splitQuoted(v)
+ if err != nil {
+ return err
+ }
+ *m = append(*m, fs...)
+ return nil
+}
+
+// splitQuoted splits the string s around each instance of one or more consecutive
+// white space characters while taking into account quotes and escaping, and
+// returns an array of substrings of s or an empty list if s contains only white space.
+// Single quotes and double quotes are recognized to prevent splitting within the
+// quoted region, and are removed from the resulting substrings. If a quote in s
+// isn't closed err will be set and r will have the unclosed argument as the
+// last element. The backslash is used for escaping.
+//
+// For example, the following string:
+//
+// a b:"c d" 'e''f' "g\""
+//
+// Would be parsed as:
+//
+// []string{"a", "b:c d", "ef", `g"`}
+//
+// Copied from go/build.splitQuoted. Also in Gazelle (where tests are).
+func splitQuoted(s string) (r []string, err error) {
+ var args []string
+ arg := make([]rune, len(s))
+ escaped := false
+ quoted := false
+ quote := '\x00'
+ i := 0
+ for _, rune := range s {
+ switch {
+ case escaped:
+ escaped = false
+ case rune == '\\':
+ escaped = true
+ continue
+ case quote != '\x00':
+ if rune == quote {
+ quote = '\x00'
+ continue
+ }
+ case rune == '"' || rune == '\'':
+ quoted = true
+ quote = rune
+ continue
+ case unicode.IsSpace(rune):
+ if quoted || i > 0 {
+ quoted = false
+ args = append(args, string(arg[:i]))
+ i = 0
+ }
+ continue
+ }
+ arg[i] = rune
+ i++
+ }
+ if quoted || i > 0 {
+ args = append(args, string(arg[:i]))
+ }
+ if quote != 0 {
+ err = errors.New("unclosed quote")
+ } else if escaped {
+ err = errors.New("unfinished escaping")
+ }
+ return args, err
+}
+
+// tagFlag adds tags to the build.Default context. Tags are expected to be
+// formatted as a comma-separated list.
+type tagFlag struct{}
+
+func (f *tagFlag) String() string {
+ return strings.Join(build.Default.BuildTags, ",")
+}
+
+func (f *tagFlag) Set(opt string) error {
+ tags := strings.Split(opt, ",")
+ build.Default.BuildTags = append(build.Default.BuildTags, tags...)
+ return nil
+}
diff --git a/go/tools/builders/generate_nogo_main.go b/go/tools/builders/generate_nogo_main.go
new file mode 100644
index 00000000..872b9b0a
--- /dev/null
+++ b/go/tools/builders/generate_nogo_main.go
@@ -0,0 +1,196 @@
+/* Copyright 2018 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Generates the nogo binary to analyze Go source code at build time.
+
+package main
+
+import (
+ "encoding/json"
+ "errors"
+ "flag"
+ "fmt"
+ "io/ioutil"
+ "math"
+ "os"
+ "regexp"
+ "strconv"
+ "text/template"
+)
+
+const nogoMainTpl = `
+package main
+
+
+import (
+{{- if .NeedRegexp }}
+ "regexp"
+{{- end}}
+{{- range $import := .Imports}}
+ {{$import.Name}} "{{$import.Path}}"
+{{- end}}
+ "golang.org/x/tools/go/analysis"
+)
+
+var analyzers = []*analysis.Analyzer{
+{{- range $import := .Imports}}
+ {{$import.Name}}.Analyzer,
+{{- end}}
+}
+
+// configs maps analysis names to configurations.
+var configs = map[string]config{
+{{- range $name, $config := .Configs}}
+ {{printf "%q" $name}}: config{
+ {{- if $config.AnalyzerFlags }}
+ analyzerFlags: map[string]string {
+ {{- range $flagKey, $flagValue := $config.AnalyzerFlags}}
+ {{printf "%q: %q" $flagKey $flagValue}},
+ {{- end}}
+ },
+ {{- end -}}
+ {{- if $config.OnlyFiles}}
+ onlyFiles: []*regexp.Regexp{
+ {{- range $path, $comment := $config.OnlyFiles}}
+ {{- if $comment}}
+ // {{$comment}}
+ {{end -}}
+ {{printf "regexp.MustCompile(%q)" $path}},
+ {{- end}}
+ },
+ {{- end -}}
+ {{- if $config.ExcludeFiles}}
+ excludeFiles: []*regexp.Regexp{
+ {{- range $path, $comment := $config.ExcludeFiles}}
+ {{- if $comment}}
+ // {{$comment}}
+ {{end -}}
+ {{printf "regexp.MustCompile(%q)" $path}},
+ {{- end}}
+ },
+ {{- end}}
+ },
+{{- end}}
+}
+`
+
+func genNogoMain(args []string) error {
+ analyzerImportPaths := multiFlag{}
+ flags := flag.NewFlagSet("generate_nogo_main", flag.ExitOnError)
+ out := flags.String("output", "", "output file to write (defaults to stdout)")
+ flags.Var(&analyzerImportPaths, "analyzer_importpath", "import path of an analyzer library")
+ configFile := flags.String("config", "", "nogo config file")
+ if err := flags.Parse(args); err != nil {
+ return err
+ }
+ if *out == "" {
+ return errors.New("must provide output file")
+ }
+
+ outFile := os.Stdout
+ var cErr error
+ outFile, err := os.Create(*out)
+ if err != nil {
+ return fmt.Errorf("os.Create(%q): %v", *out, err)
+ }
+ defer func() {
+ if err := outFile.Close(); err != nil {
+ cErr = fmt.Errorf("error closing %s: %v", outFile.Name(), err)
+ }
+ }()
+
+ config, err := buildConfig(*configFile)
+ if err != nil {
+ return err
+ }
+
+ type Import struct {
+ Path, Name string
+ }
+ // Create unique name for each imported analyzer.
+ suffix := 1
+ imports := make([]Import, 0, len(analyzerImportPaths))
+ for _, path := range analyzerImportPaths {
+ imports = append(imports, Import{
+ Path: path,
+ Name: "analyzer" + strconv.Itoa(suffix)})
+ if suffix == math.MaxInt32 {
+ return fmt.Errorf("cannot generate more than %d analyzers", suffix)
+ }
+ suffix++
+ }
+ data := struct {
+ Imports []Import
+ Configs Configs
+ NeedRegexp bool
+ }{
+ Imports: imports,
+ Configs: config,
+ }
+ for _, c := range config {
+ if len(c.OnlyFiles) > 0 || len(c.ExcludeFiles) > 0 {
+ data.NeedRegexp = true
+ break
+ }
+ }
+
+ tpl := template.Must(template.New("source").Parse(nogoMainTpl))
+ if err := tpl.Execute(outFile, data); err != nil {
+ return fmt.Errorf("template.Execute failed: %v", err)
+ }
+ return cErr
+}
+
+func buildConfig(path string) (Configs, error) {
+ if path == "" {
+ return Configs{}, nil
+ }
+ b, err := ioutil.ReadFile(path)
+ if err != nil {
+ return Configs{}, fmt.Errorf("failed to read config file: %v", err)
+ }
+ configs := make(Configs)
+ if err = json.Unmarshal(b, &configs); err != nil {
+ return Configs{}, fmt.Errorf("failed to unmarshal config file: %v", err)
+ }
+ for name, config := range configs {
+ for pattern := range config.OnlyFiles {
+ if _, err := regexp.Compile(pattern); err != nil {
+ return Configs{}, fmt.Errorf("invalid pattern for analysis %q: %v", name, err)
+ }
+ }
+ for pattern := range config.ExcludeFiles {
+ if _, err := regexp.Compile(pattern); err != nil {
+ return Configs{}, fmt.Errorf("invalid pattern for analysis %q: %v", name, err)
+ }
+ }
+ configs[name] = Config{
+ // Description is currently unused.
+ OnlyFiles: config.OnlyFiles,
+ ExcludeFiles: config.ExcludeFiles,
+ AnalyzerFlags: config.AnalyzerFlags,
+ }
+ }
+ return configs, nil
+}
+
+type Configs map[string]Config
+
+type Config struct {
+ Description string
+ OnlyFiles map[string]string `json:"only_files"`
+ ExcludeFiles map[string]string `json:"exclude_files"`
+ AnalyzerFlags map[string]string `json:"analyzer_flags"`
+}
diff --git a/go/tools/builders/generate_test_main.go b/go/tools/builders/generate_test_main.go
new file mode 100644
index 00000000..6d545b9d
--- /dev/null
+++ b/go/tools/builders/generate_test_main.go
@@ -0,0 +1,416 @@
+/* Copyright 2016 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Go testing support for Bazel.
+//
+// A Go test comprises three packages:
+//
+// 1. An internal test package, compiled from the sources of the library being
+// tested and any _test.go files with the same package name.
+// 2. An external test package, compiled from _test.go files with a package
+// name ending with "_test".
+// 3. A generated main package that imports both packages and initializes the
+// test framework with a list of tests, benchmarks, examples, and fuzz
+// targets read from source files.
+//
+// This action generates the source code for (3). The equivalent code for
+// 'go test' is in $GOROOT/src/cmd/go/internal/load/test.go.
+
+package main
+
+import (
+ "flag"
+ "fmt"
+ "go/ast"
+ "go/build"
+ "go/doc"
+ "go/parser"
+ "go/token"
+ "os"
+ "sort"
+ "strings"
+ "text/template"
+)
+
+type Import struct {
+ Name string
+ Path string
+}
+
+type TestCase struct {
+ Package string
+ Name string
+}
+
+type Example struct {
+ Package string
+ Name string
+ Output string
+ Unordered bool
+}
+
+// Cases holds template data.
+type Cases struct {
+ Imports []*Import
+ Tests []TestCase
+ Benchmarks []TestCase
+ FuzzTargets []TestCase
+ Examples []Example
+ TestMain string
+ CoverMode string
+ CoverFormat string
+ Pkgname string
+}
+
+// Version returns whether v is a supported Go version (like "go1.18").
+func (c *Cases) Version(v string) bool {
+ for _, r := range build.Default.ReleaseTags {
+ if v == r {
+ return true
+ }
+ }
+ return false
+}
+
+const testMainTpl = `
+package main
+
+// This package must be initialized before packages being tested.
+// NOTE: this relies on the order of package initialization, which is the spec
+// is somewhat unclear about-- it only clearly guarantees that imported packages
+// are initialized before their importers, though in practice (and implied) it
+// also respects declaration order, which we're relying on here.
+import "github.com/bazelbuild/rules_go/go/tools/bzltestutil"
+
+import (
+ "flag"
+ "log"
+ "os"
+ "os/exec"
+{{if .TestMain}}
+ "reflect"
+{{end}}
+ "strconv"
+ "testing"
+ "testing/internal/testdeps"
+
+{{if ne .CoverMode ""}}
+ "github.com/bazelbuild/rules_go/go/tools/coverdata"
+{{end}}
+
+{{range $p := .Imports}}
+ {{$p.Name}} "{{$p.Path}}"
+{{end}}
+)
+
+var allTests = []testing.InternalTest{
+{{range .Tests}}
+ {"{{.Name}}", {{.Package}}.{{.Name}} },
+{{end}}
+}
+
+var benchmarks = []testing.InternalBenchmark{
+{{range .Benchmarks}}
+ {"{{.Name}}", {{.Package}}.{{.Name}} },
+{{end}}
+}
+
+{{if .Version "go1.18"}}
+var fuzzTargets = []testing.InternalFuzzTarget{
+{{range .FuzzTargets}}
+ {"{{.Name}}", {{.Package}}.{{.Name}} },
+{{end}}
+}
+{{end}}
+
+var examples = []testing.InternalExample{
+{{range .Examples}}
+ {Name: "{{.Name}}", F: {{.Package}}.{{.Name}}, Output: {{printf "%q" .Output}}, Unordered: {{.Unordered}} },
+{{end}}
+}
+
+func testsInShard() []testing.InternalTest {
+ totalShards, err := strconv.Atoi(os.Getenv("TEST_TOTAL_SHARDS"))
+ if err != nil || totalShards <= 1 {
+ return allTests
+ }
+ file, err := os.Create(os.Getenv("TEST_SHARD_STATUS_FILE"))
+ if err != nil {
+ log.Fatalf("Failed to touch TEST_SHARD_STATUS_FILE: %v", err)
+ }
+ _ = file.Close()
+ shardIndex, err := strconv.Atoi(os.Getenv("TEST_SHARD_INDEX"))
+ if err != nil || shardIndex < 0 {
+ return allTests
+ }
+ tests := []testing.InternalTest{}
+ for i, t := range allTests {
+ if i % totalShards == shardIndex {
+ tests = append(tests, t)
+ }
+ }
+ return tests
+}
+
+func main() {
+ if bzltestutil.ShouldWrap() {
+ err := bzltestutil.Wrap("{{.Pkgname}}")
+ if xerr, ok := err.(*exec.ExitError); ok {
+ os.Exit(xerr.ExitCode())
+ } else if err != nil {
+ log.Print(err)
+ os.Exit(bzltestutil.TestWrapperAbnormalExit)
+ } else {
+ os.Exit(0)
+ }
+ }
+
+ testDeps :=
+ {{if eq .CoverFormat "lcov"}}
+ bzltestutil.LcovTestDeps{TestDeps: testdeps.TestDeps{}}
+ {{else}}
+ testdeps.TestDeps{}
+ {{end}}
+ {{if .Version "go1.18"}}
+ m := testing.MainStart(testDeps, testsInShard(), benchmarks, fuzzTargets, examples)
+ {{else}}
+ m := testing.MainStart(testDeps, testsInShard(), benchmarks, examples)
+ {{end}}
+
+ if filter := os.Getenv("TESTBRIDGE_TEST_ONLY"); filter != "" {
+ flag.Lookup("test.run").Value.Set(filter)
+ }
+
+ if failfast := os.Getenv("TESTBRIDGE_TEST_RUNNER_FAIL_FAST"); failfast != "" {
+ flag.Lookup("test.failfast").Value.Set("true")
+ }
+{{if eq .CoverFormat "lcov"}}
+ panicOnExit0Flag := flag.Lookup("test.paniconexit0").Value
+ testDeps.OriginalPanicOnExit = panicOnExit0Flag.(flag.Getter).Get().(bool)
+ // Setting this flag provides a way to run hooks right before testing.M.Run() returns.
+ panicOnExit0Flag.Set("true")
+{{end}}
+{{if ne .CoverMode ""}}
+ if len(coverdata.Counters) > 0 {
+ testing.RegisterCover(testing.Cover{
+ Mode: "{{ .CoverMode }}",
+ Counters: coverdata.Counters,
+ Blocks: coverdata.Blocks,
+ })
+
+ if coverageDat, ok := os.LookupEnv("COVERAGE_OUTPUT_FILE"); ok {
+ {{if eq .CoverFormat "lcov"}}
+ flag.Lookup("test.coverprofile").Value.Set(coverageDat+".cover")
+ {{else}}
+ flag.Lookup("test.coverprofile").Value.Set(coverageDat)
+ {{end}}
+ }
+ }
+ {{end}}
+
+ {{if not .TestMain}}
+ res := m.Run()
+ {{else}}
+ {{.TestMain}}(m)
+ {{/* See golang.org/issue/34129 and golang.org/cl/219639 */}}
+ res := int(reflect.ValueOf(m).Elem().FieldByName("exitCode").Int())
+ {{end}}
+ os.Exit(res)
+}
+`
+
+func genTestMain(args []string) error {
+ // Prepare our flags
+ args, _, err := expandParamsFiles(args)
+ if err != nil {
+ return err
+ }
+ imports := multiFlag{}
+ sources := multiFlag{}
+ flags := flag.NewFlagSet("GoTestGenTest", flag.ExitOnError)
+ goenv := envFlags(flags)
+ out := flags.String("output", "", "output file to write. Defaults to stdout.")
+ coverMode := flags.String("cover_mode", "", "the coverage mode to use")
+ coverFormat := flags.String("cover_format", "", "the coverage report type to generate (go_cover or lcov)")
+ pkgname := flags.String("pkgname", "", "package name of test")
+ flags.Var(&imports, "import", "Packages to import")
+ flags.Var(&sources, "src", "Sources to process for tests")
+ if err := flags.Parse(args); err != nil {
+ return err
+ }
+ if err := goenv.checkFlags(); err != nil {
+ return err
+ }
+ // Process import args
+ importMap := map[string]*Import{}
+ for _, imp := range imports {
+ parts := strings.Split(imp, "=")
+ if len(parts) != 2 {
+ return fmt.Errorf("Invalid import %q specified", imp)
+ }
+ i := &Import{Name: parts[0], Path: parts[1]}
+ importMap[i.Name] = i
+ }
+ // Process source args
+ sourceList := []string{}
+ sourceMap := map[string]string{}
+ for _, s := range sources {
+ parts := strings.Split(s, "=")
+ if len(parts) != 2 {
+ return fmt.Errorf("Invalid source %q specified", s)
+ }
+ sourceList = append(sourceList, parts[1])
+ sourceMap[parts[1]] = parts[0]
+ }
+
+ // filter our input file list
+ filteredSrcs, err := filterAndSplitFiles(sourceList)
+ if err != nil {
+ return err
+ }
+ goSrcs := filteredSrcs.goSrcs
+
+ outFile := os.Stdout
+ if *out != "" {
+ var err error
+ outFile, err = os.Create(*out)
+ if err != nil {
+ return fmt.Errorf("os.Create(%q): %v", *out, err)
+ }
+ defer outFile.Close()
+ }
+
+ cases := Cases{
+ CoverFormat: *coverFormat,
+ CoverMode: *coverMode,
+ Pkgname: *pkgname,
+ }
+
+ testFileSet := token.NewFileSet()
+ pkgs := map[string]bool{}
+ for _, f := range goSrcs {
+ parse, err := parser.ParseFile(testFileSet, f.filename, nil, parser.ParseComments)
+ if err != nil {
+ return fmt.Errorf("ParseFile(%q): %v", f.filename, err)
+ }
+ pkg := sourceMap[f.filename]
+ if strings.HasSuffix(parse.Name.String(), "_test") {
+ pkg += "_test"
+ }
+ for _, e := range doc.Examples(parse) {
+ if e.Output == "" && !e.EmptyOutput {
+ continue
+ }
+ cases.Examples = append(cases.Examples, Example{
+ Name: "Example" + e.Name,
+ Package: pkg,
+ Output: e.Output,
+ Unordered: e.Unordered,
+ })
+ pkgs[pkg] = true
+ }
+ for _, d := range parse.Decls {
+ fn, ok := d.(*ast.FuncDecl)
+ if !ok {
+ continue
+ }
+ if fn.Recv != nil {
+ continue
+ }
+ if fn.Name.Name == "TestMain" {
+ // TestMain is not, itself, a test
+ pkgs[pkg] = true
+ cases.TestMain = fmt.Sprintf("%s.%s", pkg, fn.Name.Name)
+ continue
+ }
+
+ // Here we check the signature of the Test* function. To
+ // be considered a test:
+
+ // 1. The function should have a single argument.
+ if len(fn.Type.Params.List) != 1 {
+ continue
+ }
+
+ // 2. The function should return nothing.
+ if fn.Type.Results != nil {
+ continue
+ }
+
+ // 3. The only parameter should have a type identified as
+ // *<something>.T
+ starExpr, ok := fn.Type.Params.List[0].Type.(*ast.StarExpr)
+ if !ok {
+ continue
+ }
+ selExpr, ok := starExpr.X.(*ast.SelectorExpr)
+ if !ok {
+ continue
+ }
+
+ // We do not descriminate on the referenced type of the
+ // parameter being *testing.T. Instead we assert that it
+ // should be *<something>.T. This is because the import
+ // could have been aliased as a different identifier.
+
+ if strings.HasPrefix(fn.Name.Name, "Test") {
+ if selExpr.Sel.Name != "T" {
+ continue
+ }
+ pkgs[pkg] = true
+ cases.Tests = append(cases.Tests, TestCase{
+ Package: pkg,
+ Name: fn.Name.Name,
+ })
+ }
+ if strings.HasPrefix(fn.Name.Name, "Benchmark") {
+ if selExpr.Sel.Name != "B" {
+ continue
+ }
+ pkgs[pkg] = true
+ cases.Benchmarks = append(cases.Benchmarks, TestCase{
+ Package: pkg,
+ Name: fn.Name.Name,
+ })
+ }
+ if strings.HasPrefix(fn.Name.Name, "Fuzz") {
+ if selExpr.Sel.Name != "F" {
+ continue
+ }
+ pkgs[pkg] = true
+ cases.FuzzTargets = append(cases.FuzzTargets, TestCase{
+ Package: pkg,
+ Name: fn.Name.Name,
+ })
+ }
+ }
+ }
+
+ for name := range importMap {
+ // Set the names for all unused imports to "_"
+ if !pkgs[name] {
+ importMap[name].Name = "_"
+ }
+ cases.Imports = append(cases.Imports, importMap[name])
+ }
+ sort.Slice(cases.Imports, func(i, j int) bool {
+ return cases.Imports[i].Name < cases.Imports[j].Name
+ })
+ tpl := template.Must(template.New("source").Parse(testMainTpl))
+ if err := tpl.Execute(outFile, &cases); err != nil {
+ return fmt.Errorf("template.Execute(%v): %v", cases, err)
+ }
+ return nil
+}
diff --git a/go/tools/builders/go_path.go b/go/tools/builders/go_path.go
new file mode 100644
index 00000000..58a7b8a9
--- /dev/null
+++ b/go/tools/builders/go_path.go
@@ -0,0 +1,203 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "archive/zip"
+ "encoding/json"
+ "errors"
+ "flag"
+ "fmt"
+ "io"
+ "io/ioutil"
+ "log"
+ "os"
+ "path/filepath"
+)
+
+type mode int
+
+const (
+ invalidMode mode = iota
+ archiveMode
+ copyMode
+ linkMode
+)
+
+func modeFromString(s string) (mode, error) {
+ switch s {
+ case "archive":
+ return archiveMode, nil
+ case "copy":
+ return copyMode, nil
+ case "link":
+ return linkMode, nil
+ default:
+ return invalidMode, fmt.Errorf("invalid mode: %s", s)
+ }
+}
+
+type manifestEntry struct {
+ Src, Dst string
+}
+
+func main() {
+ log.SetPrefix("GoPath: ")
+ log.SetFlags(0)
+ if err := run(os.Args[1:]); err != nil {
+ log.Fatal(err)
+ }
+}
+
+func run(args []string) error {
+ var manifest, out string
+ flags := flag.NewFlagSet("go_path", flag.ContinueOnError)
+ flags.StringVar(&manifest, "manifest", "", "name of json file listing files to include")
+ flags.StringVar(&out, "out", "", "output file or directory")
+ modeFlag := flags.String("mode", "", "copy, link, or archive")
+ if err := flags.Parse(args); err != nil {
+ return err
+ }
+ if manifest == "" {
+ return errors.New("-manifest not set")
+ }
+ if out == "" {
+ return errors.New("-out not set")
+ }
+ if *modeFlag == "" {
+ return errors.New("-mode not set")
+ }
+ mode, err := modeFromString(*modeFlag)
+ if err != nil {
+ return err
+ }
+
+ entries, err := readManifest(manifest)
+ if err != nil {
+ return err
+ }
+
+ switch mode {
+ case archiveMode:
+ err = archivePath(out, entries)
+ case copyMode:
+ err = copyPath(out, entries)
+ case linkMode:
+ err = linkPath(out, entries)
+ }
+ return err
+}
+
+func readManifest(path string) ([]manifestEntry, error) {
+ data, err := ioutil.ReadFile(path)
+ if err != nil {
+ return nil, fmt.Errorf("error reading manifest: %v", err)
+ }
+ var entries []manifestEntry
+ if err := json.Unmarshal(data, &entries); err != nil {
+ return nil, fmt.Errorf("error unmarshalling manifest %s: %v", path, err)
+ }
+ return entries, nil
+}
+
+func archivePath(out string, manifest []manifestEntry) (err error) {
+ outFile, err := os.Create(out)
+ if err != nil {
+ return err
+ }
+ defer func() {
+ if e := outFile.Close(); err == nil && e != nil {
+ err = fmt.Errorf("error closing archive %s: %v", out, e)
+ }
+ }()
+ outZip := zip.NewWriter(outFile)
+
+ for _, entry := range manifest {
+ srcFile, err := os.Open(abs(filepath.FromSlash(entry.Src)))
+ if err != nil {
+ return err
+ }
+ w, err := outZip.Create(entry.Dst)
+ if err != nil {
+ srcFile.Close()
+ return err
+ }
+ if _, err := io.Copy(w, srcFile); err != nil {
+ srcFile.Close()
+ return err
+ }
+ if err := srcFile.Close(); err != nil {
+ return err
+ }
+ }
+
+ if err := outZip.Close(); err != nil {
+ return fmt.Errorf("error constructing archive %s: %v", out, err)
+ }
+ return nil
+}
+
+func copyPath(out string, manifest []manifestEntry) error {
+ if err := os.MkdirAll(out, 0777); err != nil {
+ return err
+ }
+ for _, entry := range manifest {
+ dst := abs(filepath.Join(out, filepath.FromSlash(entry.Dst)))
+ if err := os.MkdirAll(filepath.Dir(dst), 0777); err != nil {
+ return err
+ }
+ srcFile, err := os.Open(abs(filepath.FromSlash(entry.Src)))
+ if err != nil {
+ return err
+ }
+ dstFile, err := os.Create(dst)
+ if err != nil {
+ srcFile.Close()
+ return err
+ }
+ if _, err := io.Copy(dstFile, srcFile); err != nil {
+ dstFile.Close()
+ srcFile.Close()
+ return err
+ }
+ srcFile.Close()
+ if err := dstFile.Close(); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func linkPath(out string, manifest []manifestEntry) error {
+ // out directory may already exist and may contain old symlinks. Delete.
+ if err := os.RemoveAll(out); err != nil {
+ return err
+ }
+ if err := os.MkdirAll(out, 0777); err != nil {
+ return err
+ }
+ for _, entry := range manifest {
+ dst := filepath.Join(out, filepath.FromSlash(entry.Dst))
+ dstDir := filepath.Dir(dst)
+ src, _ := filepath.Rel(dstDir, entry.Src)
+ if err := os.MkdirAll(dstDir, 0777); err != nil {
+ return err
+ }
+ if err := os.Symlink(src, dst); err != nil {
+ return err
+ }
+ }
+ return nil
+}
diff --git a/go/tools/builders/importcfg.go b/go/tools/builders/importcfg.go
new file mode 100644
index 00000000..9fe55b42
--- /dev/null
+++ b/go/tools/builders/importcfg.go
@@ -0,0 +1,261 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "bufio"
+ "bytes"
+ "errors"
+ "fmt"
+ "io"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "sort"
+ "strings"
+)
+
+type archive struct {
+ label, importPath, packagePath, file string
+ importPathAliases []string
+}
+
+// checkImports verifies that each import in files refers to a
+// direct dependency in archives or to a standard library package
+// listed in the file at stdPackageListPath. checkImports returns
+// a map from source import paths to elements of archives or to nil
+// for standard library packages.
+func checkImports(files []fileInfo, archives []archive, stdPackageListPath string, importPath string, recompileInternalDeps []string) (map[string]*archive, error) {
+ // Read the standard package list.
+ packagesTxt, err := ioutil.ReadFile(stdPackageListPath)
+ if err != nil {
+ return nil, err
+ }
+ stdPkgs := make(map[string]bool)
+ for len(packagesTxt) > 0 {
+ n := bytes.IndexByte(packagesTxt, '\n')
+ var line string
+ if n < 0 {
+ line = string(packagesTxt)
+ packagesTxt = nil
+ } else {
+ line = string(packagesTxt[:n])
+ packagesTxt = packagesTxt[n+1:]
+ }
+ line = strings.TrimSpace(line)
+ if line == "" {
+ continue
+ }
+ stdPkgs[line] = true
+ }
+
+ // Index the archives.
+ importToArchive := make(map[string]*archive)
+ importAliasToArchive := make(map[string]*archive)
+ for i := range archives {
+ arc := &archives[i]
+ importToArchive[arc.importPath] = arc
+ for _, imp := range arc.importPathAliases {
+ importAliasToArchive[imp] = arc
+ }
+ }
+ // Construct recompileInternalDeps as a map to check if there are imports that are disallowed.
+ recompileInternalDepMap := make(map[string]struct{})
+ for _, dep := range recompileInternalDeps {
+ recompileInternalDepMap[dep] = struct{}{}
+ }
+ // Build the import map.
+ imports := make(map[string]*archive)
+ var derr depsError
+ for _, f := range files {
+ for _, imp := range f.imports {
+ path := imp.path
+ if _, ok := imports[path]; ok || path == "C" || isRelative(path) {
+ // TODO(#1645): Support local (relative) import paths. We don't emit
+ // errors for them here, but they will probably break something else.
+ continue
+ }
+ if _, ok := recompileInternalDepMap[path]; ok {
+ return nil, fmt.Errorf("dependency cycle detected between %q and %q in file %q", importPath, path, f.filename)
+ }
+ if stdPkgs[path] {
+ imports[path] = nil
+ } else if arc := importToArchive[path]; arc != nil {
+ imports[path] = arc
+ } else if arc := importAliasToArchive[path]; arc != nil {
+ imports[path] = arc
+ } else {
+ derr.missing = append(derr.missing, missingDep{f.filename, path})
+ }
+ }
+ }
+ if len(derr.missing) > 0 {
+ return nil, derr
+ }
+ return imports, nil
+}
+
+// buildImportcfgFileForCompile writes an importcfg file to be consumed by the
+// compiler. The file is constructed from direct dependencies and std imports.
+// The caller is responsible for deleting the importcfg file.
+func buildImportcfgFileForCompile(imports map[string]*archive, installSuffix, dir string) (string, error) {
+ buf := &bytes.Buffer{}
+ goroot, ok := os.LookupEnv("GOROOT")
+ if !ok {
+ return "", errors.New("GOROOT not set")
+ }
+ goroot = abs(goroot)
+
+ sortedImports := make([]string, 0, len(imports))
+ for imp := range imports {
+ sortedImports = append(sortedImports, imp)
+ }
+ sort.Strings(sortedImports)
+
+ for _, imp := range sortedImports {
+ if arc := imports[imp]; arc == nil {
+ // std package
+ path := filepath.Join(goroot, "pkg", installSuffix, filepath.FromSlash(imp))
+ fmt.Fprintf(buf, "packagefile %s=%s.a\n", imp, path)
+ } else {
+ if imp != arc.packagePath {
+ fmt.Fprintf(buf, "importmap %s=%s\n", imp, arc.packagePath)
+ }
+ fmt.Fprintf(buf, "packagefile %s=%s\n", arc.packagePath, arc.file)
+ }
+ }
+
+ f, err := ioutil.TempFile(dir, "importcfg")
+ if err != nil {
+ return "", err
+ }
+ filename := f.Name()
+ if _, err := io.Copy(f, buf); err != nil {
+ f.Close()
+ os.Remove(filename)
+ return "", err
+ }
+ if err := f.Close(); err != nil {
+ os.Remove(filename)
+ return "", err
+ }
+ return filename, nil
+}
+
+func buildImportcfgFileForLink(archives []archive, stdPackageListPath, installSuffix, dir string) (string, error) {
+ buf := &bytes.Buffer{}
+ goroot, ok := os.LookupEnv("GOROOT")
+ if !ok {
+ return "", errors.New("GOROOT not set")
+ }
+ prefix := abs(filepath.Join(goroot, "pkg", installSuffix))
+ stdPackageListFile, err := os.Open(stdPackageListPath)
+ if err != nil {
+ return "", err
+ }
+ defer stdPackageListFile.Close()
+ scanner := bufio.NewScanner(stdPackageListFile)
+ for scanner.Scan() {
+ line := strings.TrimSpace(scanner.Text())
+ if line == "" {
+ continue
+ }
+ fmt.Fprintf(buf, "packagefile %s=%s.a\n", line, filepath.Join(prefix, filepath.FromSlash(line)))
+ }
+ if err := scanner.Err(); err != nil {
+ return "", err
+ }
+ depsSeen := map[string]string{}
+ for _, arc := range archives {
+ if _, ok := depsSeen[arc.packagePath]; ok {
+ return "", fmt.Errorf("internal error: package %s provided multiple times. This should have been detected during analysis.", arc.packagePath)
+ }
+ depsSeen[arc.packagePath] = arc.label
+ fmt.Fprintf(buf, "packagefile %s=%s\n", arc.packagePath, arc.file)
+ }
+ f, err := ioutil.TempFile(dir, "importcfg")
+ if err != nil {
+ return "", err
+ }
+ filename := f.Name()
+ if _, err := io.Copy(f, buf); err != nil {
+ f.Close()
+ os.Remove(filename)
+ return "", err
+ }
+ if err := f.Close(); err != nil {
+ os.Remove(filename)
+ return "", err
+ }
+ return filename, nil
+}
+
+type depsError struct {
+ missing []missingDep
+ known []string
+}
+
+type missingDep struct {
+ filename, imp string
+}
+
+var _ error = depsError{}
+
+func (e depsError) Error() string {
+ buf := bytes.NewBuffer(nil)
+ fmt.Fprintf(buf, "missing strict dependencies:\n")
+ for _, dep := range e.missing {
+ fmt.Fprintf(buf, "\t%s: import of %q\n", dep.filename, dep.imp)
+ }
+ if len(e.known) == 0 {
+ fmt.Fprintln(buf, "No dependencies were provided.")
+ } else {
+ fmt.Fprintln(buf, "Known dependencies are:")
+ for _, imp := range e.known {
+ fmt.Fprintf(buf, "\t%s\n", imp)
+ }
+ }
+ fmt.Fprint(buf, "Check that imports in Go sources match importpath attributes in deps.")
+ return buf.String()
+}
+
+func isRelative(path string) bool {
+ return strings.HasPrefix(path, "./") || strings.HasPrefix(path, "../")
+}
+
+type archiveMultiFlag []archive
+
+func (m *archiveMultiFlag) String() string {
+ if m == nil || len(*m) == 0 {
+ return ""
+ }
+ return fmt.Sprint(*m)
+}
+
+func (m *archiveMultiFlag) Set(v string) error {
+ parts := strings.Split(v, "=")
+ if len(parts) != 3 {
+ return fmt.Errorf("badly formed -arc flag: %s", v)
+ }
+ importPaths := strings.Split(parts[0], ":")
+ a := archive{
+ importPath: importPaths[0],
+ importPathAliases: importPaths[1:],
+ packagePath: parts[1],
+ file: abs(parts[2]),
+ }
+ *m = append(*m, a)
+ return nil
+}
diff --git a/go/tools/builders/info.go b/go/tools/builders/info.go
new file mode 100644
index 00000000..f7f1fd03
--- /dev/null
+++ b/go/tools/builders/info.go
@@ -0,0 +1,64 @@
+// Copyright 2017 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// info prints debugging information about the go environment.
+// It is used to help examine the execution environment of rules_go
+package main
+
+import (
+ "flag"
+ "fmt"
+ "log"
+ "os"
+)
+
+func run(args []string) error {
+ args, _, err := expandParamsFiles(args)
+ if err != nil {
+ return err
+ }
+ filename := ""
+ flags := flag.NewFlagSet("info", flag.ExitOnError)
+ flags.StringVar(&filename, "out", filename, "The file to write the report to")
+ goenv := envFlags(flags)
+ if err := flags.Parse(args); err != nil {
+ return err
+ }
+ if err := goenv.checkFlags(); err != nil {
+ return err
+ }
+ os.Setenv("GO111MODULE", "off")
+ f := os.Stderr
+ if filename != "" {
+ var err error
+ f, err = os.Create(filename)
+ if err != nil {
+ return fmt.Errorf("Could not create report file: %v", err)
+ }
+ defer f.Close()
+ }
+ if err := goenv.runCommandToFile(f, os.Stderr, goenv.goCmd("version")); err != nil {
+ return err
+ }
+ if err := goenv.runCommandToFile(f, os.Stderr, goenv.goCmd("env")); err != nil {
+ return err
+ }
+ return nil
+}
+
+func main() {
+ if err := run(os.Args[1:]); err != nil {
+ log.Fatal(err)
+ }
+}
diff --git a/go/tools/builders/link.go b/go/tools/builders/link.go
new file mode 100644
index 00000000..723bb193
--- /dev/null
+++ b/go/tools/builders/link.go
@@ -0,0 +1,163 @@
+// Copyright 2017 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// link combines the results of a compile step using "go tool link". It is invoked by the
+// Go rules as an action.
+package main
+
+import (
+ "bufio"
+ "bytes"
+ "errors"
+ "flag"
+ "fmt"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "regexp"
+ "runtime"
+ "strings"
+)
+
+func link(args []string) error {
+ // Parse arguments.
+ args, _, err := expandParamsFiles(args)
+ if err != nil {
+ return err
+ }
+ builderArgs, toolArgs := splitArgs(args)
+ stamps := multiFlag{}
+ xdefs := multiFlag{}
+ archives := archiveMultiFlag{}
+ flags := flag.NewFlagSet("link", flag.ExitOnError)
+ goenv := envFlags(flags)
+ main := flags.String("main", "", "Path to the main archive.")
+ packagePath := flags.String("p", "", "Package path of the main archive.")
+ outFile := flags.String("o", "", "Path to output file.")
+ flags.Var(&archives, "arc", "Label, package path, and file name of a dependency, separated by '='")
+ packageList := flags.String("package_list", "", "The file containing the list of standard library packages")
+ buildmode := flags.String("buildmode", "", "Build mode used.")
+ flags.Var(&xdefs, "X", "A string variable to replace in the linked binary (repeated).")
+ flags.Var(&stamps, "stamp", "The name of a file with stamping values.")
+ conflictErrMsg := flags.String("conflict_err", "", "Error message about conflicts to report if there's a link error.")
+ if err := flags.Parse(builderArgs); err != nil {
+ return err
+ }
+ if err := goenv.checkFlags(); err != nil {
+ return err
+ }
+
+ if *conflictErrMsg != "" {
+ return errors.New(*conflictErrMsg)
+ }
+
+ // On Windows, take the absolute path of the output file and main file.
+ // This is needed on Windows because the relative path is frequently too long.
+ // os.Open on Windows converts absolute paths to some other path format with
+ // longer length limits. Absolute paths do not work on macOS for .dylib
+ // outputs because they get baked in as the "install path".
+ if runtime.GOOS != "darwin" && runtime.GOOS != "ios" {
+ *outFile = abs(*outFile)
+ }
+ *main = abs(*main)
+
+ // If we were given any stamp value files, read and parse them
+ stampMap := map[string]string{}
+ for _, stampfile := range stamps {
+ stampbuf, err := ioutil.ReadFile(stampfile)
+ if err != nil {
+ return fmt.Errorf("Failed reading stamp file %s: %v", stampfile, err)
+ }
+ scanner := bufio.NewScanner(bytes.NewReader(stampbuf))
+ for scanner.Scan() {
+ line := strings.SplitN(scanner.Text(), " ", 2)
+ switch len(line) {
+ case 0:
+ // Nothing to do here
+ case 1:
+ // Map to the empty string
+ stampMap[line[0]] = ""
+ case 2:
+ // Key and value
+ stampMap[line[0]] = line[1]
+ }
+ }
+ }
+
+ // Build an importcfg file.
+ importcfgName, err := buildImportcfgFileForLink(archives, *packageList, goenv.installSuffix, filepath.Dir(*outFile))
+ if err != nil {
+ return err
+ }
+ if !goenv.shouldPreserveWorkDir {
+ defer os.Remove(importcfgName)
+ }
+
+ // generate any additional link options we need
+ goargs := goenv.goTool("link")
+ goargs = append(goargs, "-importcfg", importcfgName)
+
+ parseXdef := func(xdef string) (pkg, name, value string, err error) {
+ eq := strings.IndexByte(xdef, '=')
+ if eq < 0 {
+ return "", "", "", fmt.Errorf("-X flag does not contain '=': %s", xdef)
+ }
+ dot := strings.LastIndexByte(xdef[:eq], '.')
+ if dot < 0 {
+ return "", "", "", fmt.Errorf("-X flag does not contain '.': %s", xdef)
+ }
+ pkg, name, value = xdef[:dot], xdef[dot+1:eq], xdef[eq+1:]
+ if pkg == *packagePath {
+ pkg = "main"
+ }
+ return pkg, name, value, nil
+ }
+ for _, xdef := range xdefs {
+ pkg, name, value, err := parseXdef(xdef)
+ if err != nil {
+ return err
+ }
+ var missingKey bool
+ value = regexp.MustCompile(`\{.+?\}`).ReplaceAllStringFunc(value, func(key string) string {
+ if value, ok := stampMap[key[1:len(key)-1]]; ok {
+ return value
+ }
+ missingKey = true
+ return key
+ })
+ if !missingKey {
+ goargs = append(goargs, "-X", fmt.Sprintf("%s.%s=%s", pkg, name, value))
+ }
+ }
+
+ if *buildmode != "" {
+ goargs = append(goargs, "-buildmode", *buildmode)
+ }
+ goargs = append(goargs, "-o", *outFile)
+
+ // add in the unprocess pass through options
+ goargs = append(goargs, toolArgs...)
+ goargs = append(goargs, *main)
+ if err := goenv.runCommand(goargs); err != nil {
+ return err
+ }
+
+ if *buildmode == "c-archive" {
+ if err := stripArMetadata(*outFile); err != nil {
+ return fmt.Errorf("error stripping archive metadata: %v", err)
+ }
+ }
+
+ return nil
+}
diff --git a/go/tools/builders/md5sum.go b/go/tools/builders/md5sum.go
new file mode 100644
index 00000000..834eb272
--- /dev/null
+++ b/go/tools/builders/md5sum.go
@@ -0,0 +1,89 @@
+// Copyright 2017 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// md5sum replicates the equivalent functionality of the unix tool of the same name.
+package main
+
+import (
+ "crypto/md5"
+ "flag"
+ "fmt"
+ "io"
+ "log"
+ "os"
+ "path/filepath"
+)
+
+func md5SumFile(filename string) ([]byte, error) {
+ var result []byte
+ f, err := os.Open(filename)
+ if err != nil {
+ return result, err
+ }
+ defer f.Close()
+ hash := md5.New()
+ if _, err := io.Copy(hash, f); err != nil {
+ return nil, err
+ }
+ return hash.Sum(result), nil
+}
+
+func run(args []string) error {
+ // Prepare our flags
+ flags := flag.NewFlagSet("md5sum", flag.ExitOnError)
+ output := flags.String("output", "", "If set, write the results to this file, instead of stdout.")
+ if err := flags.Parse(args); err != nil {
+ return err
+ }
+ // print the outputs if we need not
+ to := os.Stdout
+ if *output != "" {
+ f, err := os.Create(*output)
+ if err != nil {
+ return err
+ }
+ defer f.Close()
+ to = f
+ }
+ for _, path := range flags.Args() {
+ walkFn := func(path string, info os.FileInfo, err error) error {
+ if err != nil {
+ return err
+ }
+ if info.IsDir() {
+ return nil
+ }
+
+ if b, err := md5SumFile(path); err != nil {
+ return err
+ } else {
+ fmt.Fprintf(to, "%s %x\n", path, b)
+ }
+ return nil
+ }
+
+ if err := filepath.Walk(path, walkFn); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func main() {
+ log.SetFlags(0)
+ log.SetPrefix("GoMd5sum: ")
+ if err := run(os.Args[1:]); err != nil {
+ log.Fatal(err)
+ }
+}
diff --git a/go/tools/builders/nogo_main.go b/go/tools/builders/nogo_main.go
new file mode 100644
index 00000000..c6156e1d
--- /dev/null
+++ b/go/tools/builders/nogo_main.go
@@ -0,0 +1,654 @@
+/* Copyright 2018 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Loads and runs registered analyses on a well-typed Go package.
+// The code in this file is combined with the code generated by
+// generate_nogo_main.go.
+
+package main
+
+import (
+ "bytes"
+ "encoding/gob"
+ "errors"
+ "flag"
+ "fmt"
+ "go/ast"
+ "go/parser"
+ "go/token"
+ "go/types"
+ "io/ioutil"
+ "log"
+ "os"
+ "reflect"
+ "regexp"
+ "sort"
+ "strings"
+ "sync"
+
+ "golang.org/x/tools/go/analysis"
+ "golang.org/x/tools/go/gcexportdata"
+ "golang.org/x/tools/internal/facts"
+)
+
+const nogoBaseConfigName = "_base"
+
+func init() {
+ if err := analysis.Validate(analyzers); err != nil {
+ log.Fatal(err)
+ }
+}
+
+var typesSizes = types.SizesFor("gc", os.Getenv("GOARCH"))
+
+func main() {
+ log.SetFlags(0) // no timestamp
+ log.SetPrefix("nogo: ")
+ if err := run(os.Args[1:]); err != nil {
+ log.Fatal(err)
+ }
+}
+
+// run returns an error if there is a problem loading the package or if any
+// analysis fails.
+func run(args []string) error {
+ args, _, err := expandParamsFiles(args)
+ if err != nil {
+ return fmt.Errorf("error reading paramfiles: %v", err)
+ }
+
+ factMap := factMultiFlag{}
+ flags := flag.NewFlagSet("nogo", flag.ExitOnError)
+ flags.Var(&factMap, "fact", "Import path and file containing facts for that library, separated by '=' (may be repeated)'")
+ importcfg := flags.String("importcfg", "", "The import configuration file")
+ packagePath := flags.String("p", "", "The package path (importmap) of the package being compiled")
+ xPath := flags.String("x", "", "The archive file where serialized facts should be written")
+ flags.Parse(args)
+ srcs := flags.Args()
+
+ packageFile, importMap, err := readImportCfg(*importcfg)
+ if err != nil {
+ return fmt.Errorf("error parsing importcfg: %v", err)
+ }
+
+ diagnostics, facts, err := checkPackage(analyzers, *packagePath, packageFile, importMap, factMap, srcs)
+ if err != nil {
+ return fmt.Errorf("error running analyzers: %v", err)
+ }
+ if diagnostics != "" {
+ return fmt.Errorf("errors found by nogo during build-time code analysis:\n%s\n", diagnostics)
+ }
+ if *xPath != "" {
+ if err := ioutil.WriteFile(abs(*xPath), facts, 0o666); err != nil {
+ return fmt.Errorf("error writing facts: %v", err)
+ }
+ }
+
+ return nil
+}
+
+// Adapted from go/src/cmd/compile/internal/gc/main.go. Keep in sync.
+func readImportCfg(file string) (packageFile map[string]string, importMap map[string]string, err error) {
+ packageFile, importMap = make(map[string]string), make(map[string]string)
+ data, err := ioutil.ReadFile(file)
+ if err != nil {
+ return nil, nil, fmt.Errorf("-importcfg: %v", err)
+ }
+
+ for lineNum, line := range strings.Split(string(data), "\n") {
+ lineNum++ // 1-based
+ line = strings.TrimSpace(line)
+ if line == "" || strings.HasPrefix(line, "#") {
+ continue
+ }
+
+ var verb, args string
+ if i := strings.Index(line, " "); i < 0 {
+ verb = line
+ } else {
+ verb, args = line[:i], strings.TrimSpace(line[i+1:])
+ }
+ var before, after string
+ if i := strings.Index(args, "="); i >= 0 {
+ before, after = args[:i], args[i+1:]
+ }
+ switch verb {
+ default:
+ return nil, nil, fmt.Errorf("%s:%d: unknown directive %q", file, lineNum, verb)
+ case "importmap":
+ if before == "" || after == "" {
+ return nil, nil, fmt.Errorf(`%s:%d: invalid importmap: syntax is "importmap old=new"`, file, lineNum)
+ }
+ importMap[before] = after
+ case "packagefile":
+ if before == "" || after == "" {
+ return nil, nil, fmt.Errorf(`%s:%d: invalid packagefile: syntax is "packagefile path=filename"`, file, lineNum)
+ }
+ packageFile[before] = after
+ }
+ }
+ return packageFile, importMap, nil
+}
+
+// checkPackage runs all the given analyzers on the specified package and
+// returns the source code diagnostics that the must be printed in the build log.
+// It returns an empty string if no source code diagnostics need to be printed.
+//
+// This implementation was adapted from that of golang.org/x/tools/go/checker/internal/checker.
+func checkPackage(analyzers []*analysis.Analyzer, packagePath string, packageFile, importMap map[string]string, factMap map[string]string, filenames []string) (string, []byte, error) {
+ // Register fact types and establish dependencies between analyzers.
+ actions := make(map[*analysis.Analyzer]*action)
+ var visit func(a *analysis.Analyzer) *action
+ visit = func(a *analysis.Analyzer) *action {
+ act, ok := actions[a]
+ if !ok {
+ act = &action{a: a}
+ actions[a] = act
+ for _, f := range a.FactTypes {
+ act.usesFacts = true
+ gob.Register(f)
+ }
+ act.deps = make([]*action, len(a.Requires))
+ for i, req := range a.Requires {
+ dep := visit(req)
+ if dep.usesFacts {
+ act.usesFacts = true
+ }
+ act.deps[i] = dep
+ }
+ }
+ return act
+ }
+
+ roots := make([]*action, 0, len(analyzers))
+ for _, a := range analyzers {
+ if cfg, ok := configs[a.Name]; ok {
+ for flagKey, flagVal := range cfg.analyzerFlags {
+ if strings.HasPrefix(flagKey, "-") {
+ return "", nil, fmt.Errorf(
+ "%s: flag should not begin with '-': %s", a.Name, flagKey)
+ }
+ if flag := a.Flags.Lookup(flagKey); flag == nil {
+ return "", nil, fmt.Errorf("%s: unrecognized flag: %s", a.Name, flagKey)
+ }
+ if err := a.Flags.Set(flagKey, flagVal); err != nil {
+ return "", nil, fmt.Errorf(
+ "%s: invalid value for flag: %s=%s: %w", a.Name, flagKey, flagVal, err)
+ }
+ }
+ }
+ roots = append(roots, visit(a))
+ }
+
+ // Load the package, including AST, types, and facts.
+ imp := newImporter(importMap, packageFile, factMap)
+ pkg, err := load(packagePath, imp, filenames)
+ if err != nil {
+ return "", nil, fmt.Errorf("error loading package: %v", err)
+ }
+ for _, act := range actions {
+ act.pkg = pkg
+ }
+
+ // Process nolint directives similar to golangci-lint.
+ for _, f := range pkg.syntax {
+ // CommentMap will correctly associate comments to the largest node group
+ // applicable. This handles inline comments that might trail a large
+ // assignment and will apply the comment to the entire assignment.
+ commentMap := ast.NewCommentMap(pkg.fset, f, f.Comments)
+ for node, groups := range commentMap {
+ rng := &Range{
+ from: pkg.fset.Position(node.Pos()),
+ to: pkg.fset.Position(node.End()).Line,
+ }
+ for _, group := range groups {
+ for _, comm := range group.List {
+ linters, ok := parseNolint(comm.Text)
+ if !ok {
+ continue
+ }
+ for analyzer, act := range actions {
+ if linters == nil || linters[analyzer.Name] {
+ act.nolint = append(act.nolint, rng)
+ }
+ }
+ }
+ }
+ }
+ }
+
+ // Execute the analyzers.
+ execAll(roots)
+
+ // Process diagnostics and encode facts for importers of this package.
+ diagnostics := checkAnalysisResults(roots, pkg)
+ facts := pkg.facts.Encode()
+ return diagnostics, facts, nil
+}
+
+type Range struct {
+ from token.Position
+ to int
+}
+
+// An action represents one unit of analysis work: the application of
+// one analysis to one package. Actions form a DAG within a
+// package (as different analyzers are applied, either in sequence or
+// parallel).
+type action struct {
+ once sync.Once
+ a *analysis.Analyzer
+ pass *analysis.Pass
+ pkg *goPackage
+ deps []*action
+ inputs map[*analysis.Analyzer]interface{}
+ result interface{}
+ diagnostics []analysis.Diagnostic
+ usesFacts bool
+ err error
+ nolint []*Range
+}
+
+func (act *action) String() string {
+ return fmt.Sprintf("%s@%s", act.a, act.pkg)
+}
+
+func execAll(actions []*action) {
+ var wg sync.WaitGroup
+ wg.Add(len(actions))
+ for _, act := range actions {
+ go func(act *action) {
+ defer wg.Done()
+ act.exec()
+ }(act)
+ }
+ wg.Wait()
+}
+
+func (act *action) exec() { act.once.Do(act.execOnce) }
+
+func (act *action) execOnce() {
+ // Analyze dependencies.
+ execAll(act.deps)
+
+ // Report an error if any dependency failed.
+ var failed []string
+ for _, dep := range act.deps {
+ if dep.err != nil {
+ failed = append(failed, dep.String())
+ }
+ }
+ if failed != nil {
+ sort.Strings(failed)
+ act.err = fmt.Errorf("failed prerequisites: %s", strings.Join(failed, ", "))
+ return
+ }
+
+ // Plumb the output values of the dependencies
+ // into the inputs of this action.
+ inputs := make(map[*analysis.Analyzer]interface{})
+ for _, dep := range act.deps {
+ // Same package, different analysis (horizontal edge):
+ // in-memory outputs of prerequisite analyzers
+ // become inputs to this analysis pass.
+ inputs[dep.a] = dep.result
+ }
+
+ ignoreNolintReporter := func(d analysis.Diagnostic) {
+ pos := act.pkg.fset.Position(d.Pos)
+ for _, rng := range act.nolint {
+ // The list of nolint ranges is built for the entire package. Make sure we
+ // only apply ranges to the correct file.
+ if pos.Filename != rng.from.Filename {
+ continue
+ }
+ if pos.Line < rng.from.Line || pos.Line > rng.to {
+ continue
+ }
+ // Found a nolint range. Ignore the issue.
+ return
+ }
+ act.diagnostics = append(act.diagnostics, d)
+ }
+
+ // Run the analysis.
+ factFilter := make(map[reflect.Type]bool)
+ for _, f := range act.a.FactTypes {
+ factFilter[reflect.TypeOf(f)] = true
+ }
+ pass := &analysis.Pass{
+ Analyzer: act.a,
+ Fset: act.pkg.fset,
+ Files: act.pkg.syntax,
+ Pkg: act.pkg.types,
+ TypesInfo: act.pkg.typesInfo,
+ ResultOf: inputs,
+ Report: ignoreNolintReporter,
+ ImportPackageFact: act.pkg.facts.ImportPackageFact,
+ ExportPackageFact: act.pkg.facts.ExportPackageFact,
+ ImportObjectFact: act.pkg.facts.ImportObjectFact,
+ ExportObjectFact: act.pkg.facts.ExportObjectFact,
+ AllPackageFacts: func() []analysis.PackageFact { return act.pkg.facts.AllPackageFacts(factFilter) },
+ AllObjectFacts: func() []analysis.ObjectFact { return act.pkg.facts.AllObjectFacts(factFilter) },
+ TypesSizes: typesSizes,
+ }
+ act.pass = pass
+
+ var err error
+ if act.pkg.illTyped && !pass.Analyzer.RunDespiteErrors {
+ err = fmt.Errorf("analysis skipped due to type-checking error: %v", act.pkg.typeCheckError)
+ } else {
+ act.result, err = pass.Analyzer.Run(pass)
+ if err == nil {
+ if got, want := reflect.TypeOf(act.result), pass.Analyzer.ResultType; got != want {
+ err = fmt.Errorf(
+ "internal error: on package %s, analyzer %s returned a result of type %v, but declared ResultType %v",
+ pass.Pkg.Path(), pass.Analyzer, got, want)
+ }
+ }
+ }
+ act.err = err
+}
+
+// load parses and type checks the source code in each file in filenames.
+// load also deserializes facts stored for imported packages.
+func load(packagePath string, imp *importer, filenames []string) (*goPackage, error) {
+ if len(filenames) == 0 {
+ return nil, errors.New("no filenames")
+ }
+ var syntax []*ast.File
+ for _, file := range filenames {
+ s, err := parser.ParseFile(imp.fset, file, nil, parser.ParseComments)
+ if err != nil {
+ return nil, err
+ }
+ syntax = append(syntax, s)
+ }
+ pkg := &goPackage{fset: imp.fset, syntax: syntax}
+
+ config := types.Config{Importer: imp}
+ info := &types.Info{
+ Types: make(map[ast.Expr]types.TypeAndValue),
+ Uses: make(map[*ast.Ident]types.Object),
+ Defs: make(map[*ast.Ident]types.Object),
+ Implicits: make(map[ast.Node]types.Object),
+ Scopes: make(map[ast.Node]*types.Scope),
+ Selections: make(map[*ast.SelectorExpr]*types.Selection),
+ }
+
+ initInstanceInfo(info)
+
+ types, err := config.Check(packagePath, pkg.fset, syntax, info)
+ if err != nil {
+ pkg.illTyped, pkg.typeCheckError = true, err
+ }
+ pkg.types, pkg.typesInfo = types, info
+
+ pkg.facts, err = facts.NewDecoder(pkg.types).Decode(imp.readFacts)
+ if err != nil {
+ return nil, fmt.Errorf("internal error decoding facts: %v", err)
+ }
+
+ return pkg, nil
+}
+
+// A goPackage describes a loaded Go package.
+type goPackage struct {
+ // fset provides position information for types, typesInfo, and syntax.
+ // It is set only when types is set.
+ fset *token.FileSet
+ // syntax is the package's syntax trees.
+ syntax []*ast.File
+ // types provides type information for the package.
+ types *types.Package
+ // facts contains information saved by the analysis framework. Passes may
+ // import facts for imported packages and may also export facts for this
+ // package to be consumed by analyses in downstream packages.
+ facts *facts.Set
+ // illTyped indicates whether the package or any dependency contains errors.
+ // It is set only when types is set.
+ illTyped bool
+ // typeCheckError contains any error encountered during type-checking. It is
+ // only set when illTyped is true.
+ typeCheckError error
+ // typesInfo provides type information about the package's syntax trees.
+ // It is set only when syntax is set.
+ typesInfo *types.Info
+}
+
+func (g *goPackage) String() string {
+ return g.types.Path()
+}
+
+// checkAnalysisResults checks the analysis diagnostics in the given actions
+// and returns a string containing all the diagnostics that should be printed
+// to the build log.
+func checkAnalysisResults(actions []*action, pkg *goPackage) string {
+ type entry struct {
+ analysis.Diagnostic
+ *analysis.Analyzer
+ }
+ var diagnostics []entry
+ var errs []error
+ for _, act := range actions {
+ if act.err != nil {
+ // Analyzer failed.
+ errs = append(errs, fmt.Errorf("analyzer %q failed: %v", act.a.Name, act.err))
+ continue
+ }
+ if len(act.diagnostics) == 0 {
+ continue
+ }
+ var currentConfig config
+ // Use the base config if it exists.
+ if baseConfig, ok := configs[nogoBaseConfigName]; ok {
+ currentConfig = baseConfig
+ }
+ // Overwrite the config with the desired config. Any unset fields
+ // in the config will default to the base config.
+ if actionConfig, ok := configs[act.a.Name]; ok {
+ if actionConfig.analyzerFlags != nil {
+ currentConfig.analyzerFlags = actionConfig.analyzerFlags
+ }
+ if actionConfig.onlyFiles != nil {
+ currentConfig.onlyFiles = actionConfig.onlyFiles
+ }
+ if actionConfig.excludeFiles != nil {
+ currentConfig.excludeFiles = actionConfig.excludeFiles
+ }
+ }
+
+ if currentConfig.onlyFiles == nil && currentConfig.excludeFiles == nil {
+ for _, diag := range act.diagnostics {
+ diagnostics = append(diagnostics, entry{Diagnostic: diag, Analyzer: act.a})
+ }
+ continue
+ }
+ // Discard diagnostics based on the analyzer configuration.
+ for _, d := range act.diagnostics {
+ // NOTE(golang.org/issue/31008): nilness does not set positions,
+ // so don't assume the position is valid.
+ p := pkg.fset.Position(d.Pos)
+ filename := "-"
+ if p.IsValid() {
+ filename = p.Filename
+ }
+ include := true
+ if len(currentConfig.onlyFiles) > 0 {
+ // This analyzer emits diagnostics for only a set of files.
+ include = false
+ for _, pattern := range currentConfig.onlyFiles {
+ if pattern.MatchString(filename) {
+ include = true
+ break
+ }
+ }
+ }
+ if include {
+ for _, pattern := range currentConfig.excludeFiles {
+ if pattern.MatchString(filename) {
+ include = false
+ break
+ }
+ }
+ }
+ if include {
+ diagnostics = append(diagnostics, entry{Diagnostic: d, Analyzer: act.a})
+ }
+ }
+ }
+ if len(diagnostics) == 0 && len(errs) == 0 {
+ return ""
+ }
+
+ sort.Slice(diagnostics, func(i, j int) bool {
+ return diagnostics[i].Pos < diagnostics[j].Pos
+ })
+ errMsg := &bytes.Buffer{}
+ sep := ""
+ for _, err := range errs {
+ errMsg.WriteString(sep)
+ sep = "\n"
+ errMsg.WriteString(err.Error())
+ }
+ for _, d := range diagnostics {
+ errMsg.WriteString(sep)
+ sep = "\n"
+ fmt.Fprintf(errMsg, "%s: %s (%s)", pkg.fset.Position(d.Pos), d.Message, d.Name)
+ }
+ return errMsg.String()
+}
+
+// config determines which source files an analyzer will emit diagnostics for.
+// config values are generated in another file that is compiled with
+// nogo_main.go by the nogo rule.
+type config struct {
+ // onlyFiles is a list of regular expressions that match files an analyzer
+ // will emit diagnostics for. When empty, the analyzer will emit diagnostics
+ // for all files.
+ onlyFiles []*regexp.Regexp
+
+ // excludeFiles is a list of regular expressions that match files that an
+ // analyzer will not emit diagnostics for.
+ excludeFiles []*regexp.Regexp
+
+ // analyzerFlags is a map of flag names to flag values which will be passed
+ // to Analyzer.Flags. Note that no leading '-' should be present in a flag
+ // name
+ analyzerFlags map[string]string
+}
+
+// importer is an implementation of go/types.Importer that imports type
+// information from the export data in compiled .a files.
+type importer struct {
+ fset *token.FileSet
+ importMap map[string]string // map import path in source code to package path
+ packageCache map[string]*types.Package // cache of previously imported packages
+ packageFile map[string]string // map package path to .a file with export data
+ factMap map[string]string // map import path in source code to file containing serialized facts
+}
+
+func newImporter(importMap, packageFile map[string]string, factMap map[string]string) *importer {
+ return &importer{
+ fset: token.NewFileSet(),
+ importMap: importMap,
+ packageCache: make(map[string]*types.Package),
+ packageFile: packageFile,
+ factMap: factMap,
+ }
+}
+
+func (i *importer) Import(path string) (*types.Package, error) {
+ if imp, ok := i.importMap[path]; ok {
+ // Translate import path if necessary.
+ path = imp
+ }
+ if path == "unsafe" {
+ // Special case: go/types has pre-defined type information for unsafe.
+ // See https://github.com/golang/go/issues/13882.
+ return types.Unsafe, nil
+ }
+ if pkg, ok := i.packageCache[path]; ok && pkg.Complete() {
+ return pkg, nil // cache hit
+ }
+
+ archive, ok := i.packageFile[path]
+ if !ok {
+ return nil, fmt.Errorf("could not import %q", path)
+ }
+ // open file
+ f, err := os.Open(archive)
+ if err != nil {
+ return nil, err
+ }
+ defer func() {
+ f.Close()
+ if err != nil {
+ // add file name to error
+ err = fmt.Errorf("reading export data: %s: %v", archive, err)
+ }
+ }()
+
+ r, err := gcexportdata.NewReader(f)
+ if err != nil {
+ return nil, err
+ }
+
+ return gcexportdata.Read(r, i.fset, i.packageCache, path)
+}
+
+func (i *importer) readFacts(pkg *types.Package) ([]byte, error) {
+ archive := i.factMap[pkg.Path()]
+ if archive == "" {
+ // Packages that were not built with the nogo toolchain will not be
+ // analyzed, so there's no opportunity to store facts. This includes
+ // packages in the standard library and packages built with go_tool_library,
+ // such as coverdata. Analyzers are expected to hard code information
+ // about standard library definitions and must gracefully handle packages
+ // that don't have facts. For example, the "printf" analyzer must know
+ // fmt.Printf accepts a format string.
+ return nil, nil
+ }
+ factReader, err := readFileInArchive(nogoFact, archive)
+ if os.IsNotExist(err) {
+ // Packages that were not built with the nogo toolchain will not be
+ // analyzed, so there's no opportunity to store facts. This includes
+ // packages in the standard library and packages built with go_tool_library,
+ // such as coverdata.
+ return nil, nil
+ } else if err != nil {
+ return nil, err
+ }
+ defer factReader.Close()
+ return ioutil.ReadAll(factReader)
+}
+
+type factMultiFlag map[string]string
+
+func (m *factMultiFlag) String() string {
+ if m == nil || len(*m) == 0 {
+ return ""
+ }
+ return fmt.Sprintf("%v", *m)
+}
+
+func (m *factMultiFlag) Set(v string) error {
+ parts := strings.Split(v, "=")
+ if len(parts) != 2 {
+ return fmt.Errorf("badly formatted -fact flag: %s", v)
+ }
+ (*m)[parts[0]] = parts[1]
+ return nil
+}
diff --git a/go/tools/builders/nogo_typeparams_go117.go b/go/tools/builders/nogo_typeparams_go117.go
new file mode 100644
index 00000000..9b6fe9ac
--- /dev/null
+++ b/go/tools/builders/nogo_typeparams_go117.go
@@ -0,0 +1,23 @@
+/* Copyright 2022 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+//go:build !go1.18
+// +build !go1.18
+
+package main
+
+import "go/types"
+
+func initInstanceInfo(*types.Info) {}
diff --git a/go/tools/builders/nogo_typeparams_go118.go b/go/tools/builders/nogo_typeparams_go118.go
new file mode 100644
index 00000000..787b492a
--- /dev/null
+++ b/go/tools/builders/nogo_typeparams_go118.go
@@ -0,0 +1,28 @@
+/* Copyright 2022 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+//go:build go1.18
+// +build go1.18
+
+package main
+
+import (
+ "go/ast"
+ "go/types"
+)
+
+func initInstanceInfo(info *types.Info) {
+ info.Instances = make(map[*ast.Ident]types.Instance)
+}
diff --git a/go/tools/builders/nolint.go b/go/tools/builders/nolint.go
new file mode 100644
index 00000000..e6e3c043
--- /dev/null
+++ b/go/tools/builders/nolint.go
@@ -0,0 +1,39 @@
+// Copyright 2023 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import "strings"
+
+// Parse nolint directives and return the applicable linters. If all linters
+// apply, returns (nil, true).
+func parseNolint(text string) (map[string]bool, bool) {
+ text = strings.TrimLeft(text, "/ ")
+ if !strings.HasPrefix(text, "nolint") {
+ return nil, false
+ }
+ parts := strings.Split(text, ":")
+ if len(parts) == 1 {
+ return nil, true
+ }
+ linters := strings.Split(parts[1], ",")
+ result := map[string]bool{}
+ for _, linter := range linters {
+ if strings.EqualFold(linter, "all") {
+ return nil, true
+ }
+ result[linter] = true
+ }
+ return result, true
+}
diff --git a/go/tools/builders/nolint_test.go b/go/tools/builders/nolint_test.go
new file mode 100644
index 00000000..2870eaaf
--- /dev/null
+++ b/go/tools/builders/nolint_test.go
@@ -0,0 +1,79 @@
+// Copyright 2023 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "reflect"
+ "testing"
+)
+
+func TestParseNolint(t *testing.T) {
+ tests := []struct {
+ Name string
+ Comment string
+ Valid bool
+ Linters []string
+ }{
+ {
+ Name: "Invalid",
+ Comment: "not a comment",
+ },
+ {
+ Name: "No match",
+ Comment: "// comment",
+ },
+ {
+ Name: "All linters",
+ Comment: "//nolint",
+ Valid: true,
+ },
+ {
+ Name: "All linters (explicit)",
+ Comment: "//nolint:all",
+ Valid: true,
+ },
+ {
+ Name: "Single linter",
+ Comment: "// nolint:foo",
+ Valid: true,
+ Linters: []string{"foo"},
+ },
+ {
+ Name: "Multiple linters",
+ Comment: "// nolint:a,b,c",
+ Valid: true,
+ Linters: []string{"a", "b", "c"},
+ },
+ }
+
+ for _, tc := range tests {
+ t.Run(tc.Name, func(t *testing.T) {
+ result, ok := parseNolint(tc.Comment)
+ if tc.Valid != ok {
+ t.Fatalf("parseNolint expect %t got %t", tc.Valid, ok)
+ }
+ var linters map[string]bool
+ if len(tc.Linters) != 0 {
+ linters = make(map[string]bool)
+ for _, l := range tc.Linters {
+ linters[l] = true
+ }
+ }
+ if !reflect.DeepEqual(result, linters) {
+ t.Fatalf("parseNolint expect %v got %v", linters, result)
+ }
+ })
+ }
+}
diff --git a/go/tools/builders/pack.go b/go/tools/builders/pack.go
new file mode 100644
index 00000000..ddbb1930
--- /dev/null
+++ b/go/tools/builders/pack.go
@@ -0,0 +1,388 @@
+// Copyright 2017 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "bufio"
+ "bytes"
+ "errors"
+ "fmt"
+ "io"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "runtime"
+ "strconv"
+ "strings"
+)
+
+func copyFile(inPath, outPath string) error {
+ inFile, err := os.Open(inPath)
+ if err != nil {
+ return err
+ }
+ defer inFile.Close()
+ outFile, err := os.OpenFile(outPath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, 0666)
+ if err != nil {
+ return err
+ }
+ defer outFile.Close()
+ _, err = io.Copy(outFile, inFile)
+ return err
+}
+
+func linkFile(inPath, outPath string) error {
+ inPath, err := filepath.Abs(inPath)
+ if err != nil {
+ return err
+ }
+ return os.Symlink(inPath, outPath)
+}
+
+func copyOrLinkFile(inPath, outPath string) error {
+ if runtime.GOOS == "windows" {
+ return copyFile(inPath, outPath)
+ } else {
+ return linkFile(inPath, outPath)
+ }
+}
+
+const (
+ // arHeader appears at the beginning of archives created by "ar" and
+ // "go tool pack" on all platforms.
+ arHeader = "!<arch>\n"
+
+ // entryLength is the size in bytes of the metadata preceding each file
+ // in an archive.
+ entryLength = 60
+
+ // pkgDef is the name of the export data file within an archive
+ pkgDef = "__.PKGDEF"
+
+ // nogoFact is the name of the nogo fact file
+ nogoFact = "nogo.out"
+)
+
+var zeroBytes = []byte("0 ")
+
+type bufioReaderWithCloser struct {
+ // bufio.Reader is needed to skip bytes in archives
+ *bufio.Reader
+ io.Closer
+}
+
+func extractFiles(archive, dir string, names map[string]struct{}) (files []string, err error) {
+ rc, err := openArchive(archive)
+ if err != nil {
+ return nil, err
+ }
+ defer rc.Close()
+
+ var nameData []byte
+ bufReader := rc.Reader
+ for {
+ name, size, err := readMetadata(bufReader, &nameData)
+ if err == io.EOF {
+ return files, nil
+ }
+ if err != nil {
+ return nil, err
+ }
+ if !isObjectFile(name) {
+ if err := skipFile(bufReader, size); err != nil {
+ return nil, err
+ }
+ continue
+ }
+ name, err = simpleName(name, names)
+ if err != nil {
+ return nil, err
+ }
+ name = filepath.Join(dir, name)
+ if err := extractFile(bufReader, name, size); err != nil {
+ return nil, err
+ }
+ files = append(files, name)
+ }
+}
+
+func openArchive(archive string) (bufioReaderWithCloser, error) {
+ f, err := os.Open(archive)
+ if err != nil {
+ return bufioReaderWithCloser{}, err
+ }
+ r := bufio.NewReader(f)
+ header := make([]byte, len(arHeader))
+ if _, err := io.ReadFull(r, header); err != nil || string(header) != arHeader {
+ f.Close()
+ return bufioReaderWithCloser{}, fmt.Errorf("%s: bad header", archive)
+ }
+ return bufioReaderWithCloser{r, f}, nil
+}
+
+// readMetadata reads the relevant fields of an entry. Before calling,
+// r must be positioned at the beginning of an entry. Afterward, r will
+// be positioned at the beginning of the file data. io.EOF is returned if
+// there are no more files in the archive.
+//
+// Both BSD and GNU / SysV naming conventions are supported.
+func readMetadata(r *bufio.Reader, nameData *[]byte) (name string, size int64, err error) {
+retry:
+ // Each file is preceded by a 60-byte header that contains its metadata.
+ // We only care about two fields, name and size. Other fields (mtime,
+ // owner, group, mode) are ignored because they don't affect compilation.
+ var entry [entryLength]byte
+ if _, err := io.ReadFull(r, entry[:]); err != nil {
+ return "", 0, err
+ }
+
+ sizeField := strings.TrimSpace(string(entry[48:58]))
+ size, err = strconv.ParseInt(sizeField, 10, 64)
+ if err != nil {
+ return "", 0, err
+ }
+
+ nameField := strings.TrimRight(string(entry[:16]), " ")
+ switch {
+ case strings.HasPrefix(nameField, "#1/"):
+ // BSD-style name. The number of bytes in the name is written here in
+ // ASCII, right-padded with spaces. The actual name is stored at the
+ // beginning of the file data, left-padded with NUL bytes.
+ nameField = nameField[len("#1/"):]
+ nameLen, err := strconv.ParseInt(nameField, 10, 64)
+ if err != nil {
+ return "", 0, err
+ }
+ nameBuf := make([]byte, nameLen)
+ if _, err := io.ReadFull(r, nameBuf); err != nil {
+ return "", 0, err
+ }
+ name = strings.TrimRight(string(nameBuf), "\x00")
+ size -= nameLen
+
+ case nameField == "//":
+ // GNU / SysV-style name data. This is a fake file that contains names
+ // for files with long names. We read this into nameData, then read
+ // the next entry.
+ *nameData = make([]byte, size)
+ if _, err := io.ReadFull(r, *nameData); err != nil {
+ return "", 0, err
+ }
+ if size%2 != 0 {
+ // Files are aligned at 2-byte offsets. Discard the padding byte if the
+ // size was odd.
+ if _, err := r.ReadByte(); err != nil {
+ return "", 0, err
+ }
+ }
+ goto retry
+
+ case nameField == "/":
+ // GNU / SysV-style symbol lookup table. Skip.
+ if err := skipFile(r, size); err != nil {
+ return "", 0, err
+ }
+ goto retry
+
+ case strings.HasPrefix(nameField, "/"):
+ // GNU / SysV-style long file name. The number that follows the slash is
+ // an offset into the name data that should have been read earlier.
+ // The file name ends with a slash.
+ nameField = nameField[1:]
+ nameOffset, err := strconv.Atoi(nameField)
+ if err != nil {
+ return "", 0, err
+ }
+ if nameData == nil || nameOffset < 0 || nameOffset >= len(*nameData) {
+ return "", 0, fmt.Errorf("invalid name length: %d", nameOffset)
+ }
+ i := bytes.IndexByte((*nameData)[nameOffset:], '/')
+ if i < 0 {
+ return "", 0, errors.New("file name does not end with '/'")
+ }
+ name = string((*nameData)[nameOffset : nameOffset+i])
+
+ case strings.HasSuffix(nameField, "/"):
+ // GNU / SysV-style short file name.
+ name = nameField[:len(nameField)-1]
+
+ default:
+ // Common format name.
+ name = nameField
+ }
+
+ return name, size, err
+}
+
+// extractFile reads size bytes from r and writes them to a new file, name.
+func extractFile(r *bufio.Reader, name string, size int64) error {
+ w, err := os.Create(name)
+ if err != nil {
+ return err
+ }
+ defer w.Close()
+ _, err = io.CopyN(w, r, size)
+ if err != nil {
+ return err
+ }
+ if size%2 != 0 {
+ // Files are aligned at 2-byte offsets. Discard the padding byte if the
+ // size was odd.
+ if _, err := r.ReadByte(); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func skipFile(r *bufio.Reader, size int64) error {
+ if size%2 != 0 {
+ // Files are aligned at 2-byte offsets. Discard the padding byte if the
+ // size was odd.
+ size += 1
+ }
+ _, err := r.Discard(int(size))
+ return err
+}
+
+func isObjectFile(name string) bool {
+ return strings.HasSuffix(name, ".o")
+}
+
+// simpleName returns a file name which is at most 15 characters
+// and doesn't conflict with other names. If it is not possible to choose
+// such a name, simpleName will truncate the given name to 15 characters.
+// The original file extension will be preserved.
+func simpleName(name string, names map[string]struct{}) (string, error) {
+ if _, ok := names[name]; !ok && len(name) < 16 {
+ names[name] = struct{}{}
+ return name, nil
+ }
+ var stem, ext string
+ if i := strings.LastIndexByte(name, '.'); i < 0 {
+ stem = name
+ } else {
+ stem = strings.Replace(name[:i], ".", "_", -1)
+ ext = name[i:]
+ }
+ for n := 0; n < len(names)+1; n++ {
+ ns := strconv.Itoa(n)
+ stemLen := 15 - len(ext) - len(ns)
+ if stemLen < 0 {
+ break
+ }
+ if stemLen > len(stem) {
+ stemLen = len(stem)
+ }
+ candidate := stem[:stemLen] + ns + ext
+ if _, ok := names[candidate]; !ok {
+ names[candidate] = struct{}{}
+ return candidate, nil
+ }
+ }
+ return "", fmt.Errorf("cannot shorten file name: %q", name)
+}
+
+func appendFiles(goenv *env, archive string, files []string) error {
+ archive = abs(archive) // required for long filenames on Windows.
+
+ // Create an empty archive if one doesn't already exist.
+ // In Go 1.16, 'go tool pack r' reports an error if the archive doesn't exist.
+ // 'go tool pack c' copies export data in addition to creating the archive,
+ // so we don't want to use that directly.
+ _, err := os.Stat(archive)
+ if err != nil && !os.IsNotExist(err) {
+ return err
+ }
+ if os.IsNotExist(err) {
+ if err := ioutil.WriteFile(archive, []byte(arHeader), 0666); err != nil {
+ return err
+ }
+ }
+
+ // Append files to the archive.
+ // TODO(jayconrod): copy cmd/internal/archive and use that instead of
+ // shelling out to cmd/pack.
+ args := goenv.goTool("pack", "r", archive)
+ args = append(args, files...)
+ return goenv.runCommand(args)
+}
+
+type readWithCloser struct {
+ io.Reader
+ io.Closer
+}
+
+func readFileInArchive(fileName, archive string) (io.ReadCloser, error) {
+ rc, err := openArchive(archive)
+ if err != nil {
+ return nil, err
+ }
+ var nameData []byte
+ bufReader := rc.Reader
+ for err == nil {
+ // avoid shadowing err in the loop it can be returned correctly in the end
+ var (
+ name string
+ size int64
+ )
+ name, size, err = readMetadata(bufReader, &nameData)
+ if err != nil {
+ break
+ }
+ if name == fileName {
+ return readWithCloser{
+ Reader: io.LimitReader(rc, size),
+ Closer: rc,
+ }, nil
+ }
+ err = skipFile(bufReader, size)
+ }
+ if err == io.EOF {
+ err = os.ErrNotExist
+ }
+ rc.Close()
+ return nil, err
+}
+
+func extractFileFromArchive(archive, dir, name string) (err error) {
+ archiveReader, err := readFileInArchive(name, archive)
+ if err != nil {
+ return fmt.Errorf("error reading %s from %s: %v", name, archive, err)
+ }
+ defer func() {
+ e := archiveReader.Close()
+ if e != nil && err == nil {
+ err = fmt.Errorf("error closing %q: %v", archive, e)
+ }
+ }()
+ outPath := filepath.Join(dir, pkgDef)
+ outFile, err := os.Create(outPath)
+ if err != nil {
+ return fmt.Errorf("error creating %s: %v", outPath, err)
+ }
+ defer func() {
+ e := outFile.Close()
+ if e != nil && err == nil {
+ err = fmt.Errorf("error closing %q: %v", outPath, e)
+ }
+ }()
+ if size, err := io.Copy(outFile, archiveReader); err != nil {
+ return fmt.Errorf("error writing %s: %v", outPath, err)
+ } else if size == 0 {
+ return fmt.Errorf("%s is empty in %s", name, archive)
+ }
+ return err
+}
diff --git a/go/tools/builders/path.go b/go/tools/builders/path.go
new file mode 100644
index 00000000..f60e4deb
--- /dev/null
+++ b/go/tools/builders/path.go
@@ -0,0 +1,7 @@
+// +build !windows
+
+package main
+
+func processPath(path string) (string, error) {
+ return path, nil
+}
diff --git a/go/tools/builders/path_windows.go b/go/tools/builders/path_windows.go
new file mode 100644
index 00000000..23b1b65b
--- /dev/null
+++ b/go/tools/builders/path_windows.go
@@ -0,0 +1,25 @@
+// +build windows
+
+package main
+
+import (
+ "runtime"
+ "syscall"
+)
+
+func processPath(path string) (string, error) {
+ if runtime.GOOS != "windows" {
+ return path, nil
+ }
+
+ var buf [258]uint16
+ up, err := syscall.UTF16PtrFromString(path)
+ if err != nil {
+ return path, err
+ }
+ _, err = syscall.GetShortPathName(up, &buf[0], 258)
+ if err != nil {
+ return path, err
+ }
+ return syscall.UTF16ToString(buf[:]), nil
+}
diff --git a/go/tools/builders/protoc.go b/go/tools/builders/protoc.go
new file mode 100644
index 00000000..46a9f012
--- /dev/null
+++ b/go/tools/builders/protoc.go
@@ -0,0 +1,219 @@
+// Copyright 2017 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// protoc invokes the protobuf compiler and captures the resulting .pb.go file.
+package main
+
+import (
+ "bytes"
+ "errors"
+ "flag"
+ "fmt"
+ "io/ioutil"
+ "log"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "runtime"
+ "strings"
+)
+
+type genFileInfo struct {
+ base string // The basename of the path
+ path string // The full path to the final file
+ expected bool // Whether the file is expected by the rules
+ created bool // Whether the file was created by protoc
+ from *genFileInfo // The actual file protoc produced if not Path
+ unique bool // True if this base name is unique in expected results
+ ambiguious bool // True if there were more than one possible outputs that matched this file
+}
+
+func run(args []string) error {
+ // process the args
+ args, useParamFile, err := expandParamsFiles(args)
+ if err != nil {
+ return err
+ }
+ options := multiFlag{}
+ descriptors := multiFlag{}
+ expected := multiFlag{}
+ imports := multiFlag{}
+ flags := flag.NewFlagSet("protoc", flag.ExitOnError)
+ protoc := flags.String("protoc", "", "The path to the real protoc.")
+ outPath := flags.String("out_path", "", "The base output path to write to.")
+ plugin := flags.String("plugin", "", "The go plugin to use.")
+ importpath := flags.String("importpath", "", "The importpath for the generated sources.")
+ flags.Var(&options, "option", "The plugin options.")
+ flags.Var(&descriptors, "descriptor_set", "The descriptor set to read.")
+ flags.Var(&expected, "expected", "The expected output files.")
+ flags.Var(&imports, "import", "Map a proto file to an import path.")
+ if err := flags.Parse(args); err != nil {
+ return err
+ }
+
+ // Output to a temporary folder and then move the contents into place below.
+ // This is to work around long file paths on Windows.
+ tmpDir, err := ioutil.TempDir("", "go_proto")
+ if err != nil {
+ return err
+ }
+ tmpDir = abs(tmpDir) // required to work with long paths on Windows
+ absOutPath := abs(*outPath) // required to work with long paths on Windows
+ defer os.RemoveAll(tmpDir)
+
+ pluginBase := filepath.Base(*plugin)
+ pluginName := strings.TrimSuffix(
+ strings.TrimPrefix(filepath.Base(*plugin), "protoc-gen-"), ".exe")
+ for _, m := range imports {
+ options = append(options, fmt.Sprintf("M%v", m))
+ }
+ if runtime.GOOS == "windows" {
+ // Turn the plugin path into raw form, since we're handing it off to a non-go binary.
+ // This is required to work with long paths on Windows.
+ *plugin = "\\\\?\\" + abs(*plugin)
+ }
+ protoc_args := []string{
+ fmt.Sprintf("--%v_out=%v:%v", pluginName, strings.Join(options, ","), tmpDir),
+ "--plugin", fmt.Sprintf("%v=%v", strings.TrimSuffix(pluginBase, ".exe"), *plugin),
+ "--descriptor_set_in", strings.Join(descriptors, string(os.PathListSeparator)),
+ }
+ protoc_args = append(protoc_args, flags.Args()...)
+
+ var cmd *exec.Cmd
+ if useParamFile {
+ paramFile, err := ioutil.TempFile(tmpDir, "protoc-*.params")
+ if err != nil {
+ return fmt.Errorf("error creating param file for protoc: %v", err)
+ }
+ for _, arg := range protoc_args {
+ _, err := fmt.Fprintln(paramFile, arg)
+ if err != nil {
+ return fmt.Errorf("error writing param file for protoc: %v", err)
+ }
+ }
+ cmd = exec.Command(*protoc, "@"+paramFile.Name())
+ } else {
+ cmd = exec.Command(*protoc, protoc_args...)
+ }
+
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+ if err := cmd.Run(); err != nil {
+ return fmt.Errorf("error running protoc: %v", err)
+ }
+ // Build our file map, and test for existance
+ files := map[string]*genFileInfo{}
+ byBase := map[string]*genFileInfo{}
+ for _, path := range expected {
+ info := &genFileInfo{
+ path: path,
+ base: filepath.Base(path),
+ expected: true,
+ unique: true,
+ }
+ files[info.path] = info
+ if byBase[info.base] != nil {
+ info.unique = false
+ byBase[info.base].unique = false
+ } else {
+ byBase[info.base] = info
+ }
+ }
+ // Walk the generated files
+ filepath.Walk(tmpDir, func(path string, f os.FileInfo, err error) error {
+ relPath, err := filepath.Rel(tmpDir, path)
+ if err != nil {
+ return err
+ }
+ if relPath == "." {
+ return nil
+ }
+
+ if f.IsDir() {
+ if err := os.Mkdir(filepath.Join(absOutPath, relPath), f.Mode()); !os.IsExist(err) {
+ return err
+ }
+ return nil
+ }
+
+ if !strings.HasSuffix(path, ".go") {
+ return nil
+ }
+
+ info := &genFileInfo{
+ path: path,
+ base: filepath.Base(path),
+ created: true,
+ }
+
+ if foundInfo, ok := files[relPath]; ok {
+ foundInfo.created = true
+ foundInfo.from = info
+ return nil
+ }
+ files[relPath] = info
+ copyTo := byBase[info.base]
+ switch {
+ case copyTo == nil:
+ // Unwanted output
+ case !copyTo.unique:
+ // not unique, no copy allowed
+ case copyTo.from != nil:
+ copyTo.ambiguious = true
+ info.ambiguious = true
+ default:
+ copyTo.from = info
+ copyTo.created = true
+ info.expected = true
+ }
+ return nil
+ })
+ buf := &bytes.Buffer{}
+ for _, f := range files {
+ switch {
+ case f.expected && !f.created:
+ // Some plugins only create output files if the proto source files have
+ // have relevant definitions (e.g., services for grpc_gateway). Create
+ // trivial files that the compiler will ignore for missing outputs.
+ data := []byte("// +build ignore\n\npackage ignore")
+ if err := ioutil.WriteFile(abs(f.path), data, 0644); err != nil {
+ return err
+ }
+ case f.expected && f.ambiguious:
+ fmt.Fprintf(buf, "Ambiguious output %v.\n", f.path)
+ case f.from != nil:
+ data, err := ioutil.ReadFile(f.from.path)
+ if err != nil {
+ return err
+ }
+ if err := ioutil.WriteFile(abs(f.path), data, 0644); err != nil {
+ return err
+ }
+ case !f.expected:
+ //fmt.Fprintf(buf, "Unexpected output %v.\n", f.path)
+ }
+ if buf.Len() > 0 {
+ fmt.Fprintf(buf, "Check that the go_package option is %q.", *importpath)
+ return errors.New(buf.String())
+ }
+ }
+
+ return nil
+}
+
+func main() {
+ if err := run(os.Args[1:]); err != nil {
+ log.Fatal(err)
+ }
+}
diff --git a/go/tools/builders/read.go b/go/tools/builders/read.go
new file mode 100644
index 00000000..b03c02bf
--- /dev/null
+++ b/go/tools/builders/read.go
@@ -0,0 +1,551 @@
+// Copyright 2012 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// This file was adapted from Go src/go/build/read.go at commit 8634a234df2a
+// on 2021-01-26. It's used to extract metadata from .go files without requiring
+// them to be in the same directory.
+
+package main
+
+import (
+ "bufio"
+ "errors"
+ "fmt"
+ "go/ast"
+ "go/parser"
+ "go/token"
+ "io"
+ "strconv"
+ "strings"
+ "unicode"
+ "unicode/utf8"
+)
+
+type importReader struct {
+ b *bufio.Reader
+ buf []byte
+ peek byte
+ err error
+ eof bool
+ nerr int
+ pos token.Position
+}
+
+func newImportReader(name string, r io.Reader) *importReader {
+ return &importReader{
+ b: bufio.NewReader(r),
+ pos: token.Position{
+ Filename: name,
+ Line: 1,
+ Column: 1,
+ },
+ }
+}
+
+func isIdent(c byte) bool {
+ return 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' || c == '_' || c >= utf8.RuneSelf
+}
+
+var (
+ errSyntax = errors.New("syntax error")
+ errNUL = errors.New("unexpected NUL in input")
+)
+
+// syntaxError records a syntax error, but only if an I/O error has not already been recorded.
+func (r *importReader) syntaxError() {
+ if r.err == nil {
+ r.err = errSyntax
+ }
+}
+
+// readByte reads the next byte from the input, saves it in buf, and returns it.
+// If an error occurs, readByte records the error in r.err and returns 0.
+func (r *importReader) readByte() byte {
+ c, err := r.b.ReadByte()
+ if err == nil {
+ r.buf = append(r.buf, c)
+ if c == 0 {
+ err = errNUL
+ }
+ }
+ if err != nil {
+ if err == io.EOF {
+ r.eof = true
+ } else if r.err == nil {
+ r.err = err
+ }
+ c = 0
+ }
+ return c
+}
+
+// readByteNoBuf is like readByte but doesn't buffer the byte.
+// It exhausts r.buf before reading from r.b.
+func (r *importReader) readByteNoBuf() byte {
+ var c byte
+ var err error
+ if len(r.buf) > 0 {
+ c = r.buf[0]
+ r.buf = r.buf[1:]
+ } else {
+ c, err = r.b.ReadByte()
+ if err == nil && c == 0 {
+ err = errNUL
+ }
+ }
+
+ if err != nil {
+ if err == io.EOF {
+ r.eof = true
+ } else if r.err == nil {
+ r.err = err
+ }
+ return 0
+ }
+ r.pos.Offset++
+ if c == '\n' {
+ r.pos.Line++
+ r.pos.Column = 1
+ } else {
+ r.pos.Column++
+ }
+ return c
+}
+
+// peekByte returns the next byte from the input reader but does not advance beyond it.
+// If skipSpace is set, peekByte skips leading spaces and comments.
+func (r *importReader) peekByte(skipSpace bool) byte {
+ if r.err != nil {
+ if r.nerr++; r.nerr > 10000 {
+ panic("go/build: import reader looping")
+ }
+ return 0
+ }
+
+ // Use r.peek as first input byte.
+ // Don't just return r.peek here: it might have been left by peekByte(false)
+ // and this might be peekByte(true).
+ c := r.peek
+ if c == 0 {
+ c = r.readByte()
+ }
+ for r.err == nil && !r.eof {
+ if skipSpace {
+ // For the purposes of this reader, semicolons are never necessary to
+ // understand the input and are treated as spaces.
+ switch c {
+ case ' ', '\f', '\t', '\r', '\n', ';':
+ c = r.readByte()
+ continue
+
+ case '/':
+ c = r.readByte()
+ if c == '/' {
+ for c != '\n' && r.err == nil && !r.eof {
+ c = r.readByte()
+ }
+ } else if c == '*' {
+ var c1 byte
+ for (c != '*' || c1 != '/') && r.err == nil {
+ if r.eof {
+ r.syntaxError()
+ }
+ c, c1 = c1, r.readByte()
+ }
+ } else {
+ r.syntaxError()
+ }
+ c = r.readByte()
+ continue
+ }
+ }
+ break
+ }
+ r.peek = c
+ return r.peek
+}
+
+// nextByte is like peekByte but advances beyond the returned byte.
+func (r *importReader) nextByte(skipSpace bool) byte {
+ c := r.peekByte(skipSpace)
+ r.peek = 0
+ return c
+}
+
+var goEmbed = []byte("go:embed")
+
+// findEmbed advances the input reader to the next //go:embed comment.
+// It reports whether it found a comment.
+// (Otherwise it found an error or EOF.)
+func (r *importReader) findEmbed(first bool) bool {
+ // The import block scan stopped after a non-space character,
+ // so the reader is not at the start of a line on the first call.
+ // After that, each //go:embed extraction leaves the reader
+ // at the end of a line.
+ startLine := !first
+ var c byte
+ for r.err == nil && !r.eof {
+ c = r.readByteNoBuf()
+ Reswitch:
+ switch c {
+ default:
+ startLine = false
+
+ case '\n':
+ startLine = true
+
+ case ' ', '\t':
+ // leave startLine alone
+
+ case '"':
+ startLine = false
+ for r.err == nil {
+ if r.eof {
+ r.syntaxError()
+ }
+ c = r.readByteNoBuf()
+ if c == '\\' {
+ r.readByteNoBuf()
+ if r.err != nil {
+ r.syntaxError()
+ return false
+ }
+ continue
+ }
+ if c == '"' {
+ c = r.readByteNoBuf()
+ goto Reswitch
+ }
+ }
+ goto Reswitch
+
+ case '`':
+ startLine = false
+ for r.err == nil {
+ if r.eof {
+ r.syntaxError()
+ }
+ c = r.readByteNoBuf()
+ if c == '`' {
+ c = r.readByteNoBuf()
+ goto Reswitch
+ }
+ }
+
+ case '/':
+ c = r.readByteNoBuf()
+ switch c {
+ default:
+ startLine = false
+ goto Reswitch
+
+ case '*':
+ var c1 byte
+ for (c != '*' || c1 != '/') && r.err == nil {
+ if r.eof {
+ r.syntaxError()
+ }
+ c, c1 = c1, r.readByteNoBuf()
+ }
+ startLine = false
+
+ case '/':
+ if startLine {
+ // Try to read this as a //go:embed comment.
+ for i := range goEmbed {
+ c = r.readByteNoBuf()
+ if c != goEmbed[i] {
+ goto SkipSlashSlash
+ }
+ }
+ c = r.readByteNoBuf()
+ if c == ' ' || c == '\t' {
+ // Found one!
+ return true
+ }
+ }
+ SkipSlashSlash:
+ for c != '\n' && r.err == nil && !r.eof {
+ c = r.readByteNoBuf()
+ }
+ startLine = true
+ }
+ }
+ }
+ return false
+}
+
+// readKeyword reads the given keyword from the input.
+// If the keyword is not present, readKeyword records a syntax error.
+func (r *importReader) readKeyword(kw string) {
+ r.peekByte(true)
+ for i := 0; i < len(kw); i++ {
+ if r.nextByte(false) != kw[i] {
+ r.syntaxError()
+ return
+ }
+ }
+ if isIdent(r.peekByte(false)) {
+ r.syntaxError()
+ }
+}
+
+// readIdent reads an identifier from the input.
+// If an identifier is not present, readIdent records a syntax error.
+func (r *importReader) readIdent() {
+ c := r.peekByte(true)
+ if !isIdent(c) {
+ r.syntaxError()
+ return
+ }
+ for isIdent(r.peekByte(false)) {
+ r.peek = 0
+ }
+}
+
+// readString reads a quoted string literal from the input.
+// If an identifier is not present, readString records a syntax error.
+func (r *importReader) readString() {
+ switch r.nextByte(true) {
+ case '`':
+ for r.err == nil {
+ if r.nextByte(false) == '`' {
+ break
+ }
+ if r.eof {
+ r.syntaxError()
+ }
+ }
+ case '"':
+ for r.err == nil {
+ c := r.nextByte(false)
+ if c == '"' {
+ break
+ }
+ if r.eof || c == '\n' {
+ r.syntaxError()
+ }
+ if c == '\\' {
+ r.nextByte(false)
+ }
+ }
+ default:
+ r.syntaxError()
+ }
+}
+
+// readImport reads an import clause - optional identifier followed by quoted string -
+// from the input.
+func (r *importReader) readImport() {
+ c := r.peekByte(true)
+ if c == '.' {
+ r.peek = 0
+ } else if isIdent(c) {
+ r.readIdent()
+ }
+ r.readString()
+}
+
+// readComments is like io.ReadAll, except that it only reads the leading
+// block of comments in the file.
+func readComments(f io.Reader) ([]byte, error) {
+ r := newImportReader("", f)
+ r.peekByte(true)
+ if r.err == nil && !r.eof {
+ // Didn't reach EOF, so must have found a non-space byte. Remove it.
+ r.buf = r.buf[:len(r.buf)-1]
+ }
+ return r.buf, r.err
+}
+
+// readGoInfo expects a Go file as input and reads the file up to and including the import section.
+// It records what it learned in *info.
+// If info.fset is non-nil, readGoInfo parses the file and sets info.parsed, info.parseErr,
+// info.imports, info.embeds, and info.embedErr.
+//
+// It only returns an error if there are problems reading the file,
+// not for syntax errors in the file itself.
+func readGoInfo(f io.Reader, info *fileInfo) error {
+ r := newImportReader(info.filename, f)
+
+ r.readKeyword("package")
+ r.readIdent()
+ for r.peekByte(true) == 'i' {
+ r.readKeyword("import")
+ if r.peekByte(true) == '(' {
+ r.nextByte(false)
+ for r.peekByte(true) != ')' && r.err == nil {
+ r.readImport()
+ }
+ r.nextByte(false)
+ } else {
+ r.readImport()
+ }
+ }
+
+ info.header = r.buf
+
+ // If we stopped successfully before EOF, we read a byte that told us we were done.
+ // Return all but that last byte, which would cause a syntax error if we let it through.
+ if r.err == nil && !r.eof {
+ info.header = r.buf[:len(r.buf)-1]
+ }
+
+ // If we stopped for a syntax error, consume the whole file so that
+ // we are sure we don't change the errors that go/parser returns.
+ if r.err == errSyntax {
+ r.err = nil
+ for r.err == nil && !r.eof {
+ r.readByte()
+ }
+ info.header = r.buf
+ }
+ if r.err != nil {
+ return r.err
+ }
+
+ if info.fset == nil {
+ return nil
+ }
+
+ // Parse file header & record imports.
+ info.parsed, info.parseErr = parser.ParseFile(info.fset, info.filename, info.header, parser.ImportsOnly|parser.ParseComments)
+ if info.parseErr != nil {
+ return nil
+ }
+ info.pkg = info.parsed.Name.Name
+
+ hasEmbed := false
+ for _, decl := range info.parsed.Decls {
+ d, ok := decl.(*ast.GenDecl)
+ if !ok {
+ continue
+ }
+ for _, dspec := range d.Specs {
+ spec, ok := dspec.(*ast.ImportSpec)
+ if !ok {
+ continue
+ }
+ quoted := spec.Path.Value
+ path, err := strconv.Unquote(quoted)
+ if err != nil {
+ return fmt.Errorf("parser returned invalid quoted string: <%s>", quoted)
+ }
+ if path == "embed" {
+ hasEmbed = true
+ }
+
+ doc := spec.Doc
+ if doc == nil && len(d.Specs) == 1 {
+ doc = d.Doc
+ }
+ info.imports = append(info.imports, fileImport{path, spec.Pos(), doc})
+ }
+ }
+
+ // If the file imports "embed",
+ // we have to look for //go:embed comments
+ // in the remainder of the file.
+ // The compiler will enforce the mapping of comments to
+ // declared variables. We just need to know the patterns.
+ // If there were //go:embed comments earlier in the file
+ // (near the package statement or imports), the compiler
+ // will reject them. They can be (and have already been) ignored.
+ if hasEmbed {
+ var line []byte
+ for first := true; r.findEmbed(first); first = false {
+ line = line[:0]
+ pos := r.pos
+ for {
+ c := r.readByteNoBuf()
+ if c == '\n' || r.err != nil || r.eof {
+ break
+ }
+ line = append(line, c)
+ }
+ // Add args if line is well-formed.
+ // Ignore badly-formed lines - the compiler will report them when it finds them,
+ // and we can pretend they are not there to help go list succeed with what it knows.
+ embs, err := parseGoEmbed(string(line), pos)
+ if err == nil {
+ info.embeds = append(info.embeds, embs...)
+ }
+ }
+ }
+
+ return nil
+}
+
+// parseGoEmbed parses the text following "//go:embed" to extract the glob patterns.
+// It accepts unquoted space-separated patterns as well as double-quoted and back-quoted Go strings.
+// This is based on a similar function in cmd/compile/internal/gc/noder.go;
+// this version calculates position information as well.
+func parseGoEmbed(args string, pos token.Position) ([]fileEmbed, error) {
+ trimBytes := func(n int) {
+ pos.Offset += n
+ pos.Column += utf8.RuneCountInString(args[:n])
+ args = args[n:]
+ }
+ trimSpace := func() {
+ trim := strings.TrimLeftFunc(args, unicode.IsSpace)
+ trimBytes(len(args) - len(trim))
+ }
+
+ var list []fileEmbed
+ for trimSpace(); args != ""; trimSpace() {
+ var path string
+ pathPos := pos
+ Switch:
+ switch args[0] {
+ default:
+ i := len(args)
+ for j, c := range args {
+ if unicode.IsSpace(c) {
+ i = j
+ break
+ }
+ }
+ path = args[:i]
+ trimBytes(i)
+
+ case '`':
+ i := strings.Index(args[1:], "`")
+ if i < 0 {
+ return nil, fmt.Errorf("invalid quoted string in //go:embed: %s", args)
+ }
+ path = args[1 : 1+i]
+ trimBytes(1 + i + 1)
+
+ case '"':
+ i := 1
+ for ; i < len(args); i++ {
+ if args[i] == '\\' {
+ i++
+ continue
+ }
+ if args[i] == '"' {
+ q, err := strconv.Unquote(args[:i+1])
+ if err != nil {
+ return nil, fmt.Errorf("invalid quoted string in //go:embed: %s", args[:i+1])
+ }
+ path = q
+ trimBytes(i + 1)
+ break Switch
+ }
+ }
+ if i >= len(args) {
+ return nil, fmt.Errorf("invalid quoted string in //go:embed: %s", args)
+ }
+ }
+
+ if args != "" {
+ r, _ := utf8.DecodeRuneInString(args)
+ if !unicode.IsSpace(r) {
+ return nil, fmt.Errorf("invalid quoted string in //go:embed: %s", args)
+ }
+ }
+ list = append(list, fileEmbed{path, pathPos})
+ }
+ return list, nil
+}
diff --git a/go/tools/builders/replicate.go b/go/tools/builders/replicate.go
new file mode 100644
index 00000000..117f882c
--- /dev/null
+++ b/go/tools/builders/replicate.go
@@ -0,0 +1,167 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// stdlib builds the standard library in the appropriate mode into a new goroot.
+package main
+
+import (
+ "fmt"
+ "io"
+ "os"
+ "path/filepath"
+)
+
+type replicateMode int
+
+const (
+ copyMode replicateMode = iota
+ hardlinkMode
+ softlinkMode
+)
+
+type replicateOption func(*replicateConfig)
+type replicateConfig struct {
+ removeFirst bool
+ fileMode replicateMode
+ dirMode replicateMode
+ paths []string
+}
+
+func replicatePaths(paths ...string) replicateOption {
+ return func(config *replicateConfig) {
+ config.paths = append(config.paths, paths...)
+ }
+}
+
+// replicatePrepare is the common preparation steps for a replication entry
+func replicatePrepare(dst string, config *replicateConfig) error {
+ dir := filepath.Dir(dst)
+ if err := os.MkdirAll(dir, 0755); err != nil {
+ return fmt.Errorf("Failed to make %s: %v", dir, err)
+ }
+ if config.removeFirst {
+ _ = os.Remove(dst)
+ }
+ return nil
+}
+
+// replicateFile is called internally by replicate to map a single file from src into dst.
+func replicateFile(src, dst string, config *replicateConfig) error {
+ if err := replicatePrepare(dst, config); err != nil {
+ return err
+ }
+ switch config.fileMode {
+ case copyMode:
+ in, err := os.Open(src)
+ if err != nil {
+ return err
+ }
+ defer in.Close()
+ out, err := os.Create(dst)
+ if err != nil {
+ return err
+ }
+ _, err = io.Copy(out, in)
+ closeerr := out.Close()
+ if err != nil {
+ return err
+ }
+ if closeerr != nil {
+ return closeerr
+ }
+ s, err := os.Stat(src)
+ if err != nil {
+ return err
+ }
+ if err := os.Chmod(dst, s.Mode()); err != nil {
+ return err
+ }
+ return nil
+ case hardlinkMode:
+ return os.Link(src, dst)
+ case softlinkMode:
+ return os.Symlink(src, dst)
+ default:
+ return fmt.Errorf("Invalid replication mode %d", config.fileMode)
+ }
+}
+
+// replicateDir makes a tree of files visible in a new location.
+// It is allowed to take any efficient method of doing so.
+func replicateDir(src, dst string, config *replicateConfig) error {
+ if err := replicatePrepare(dst, config); err != nil {
+ return err
+ }
+ switch config.dirMode {
+ case copyMode:
+ return filepath.Walk(src, func(path string, f os.FileInfo, err error) error {
+ if f.IsDir() {
+ return nil
+ }
+ relative, err := filepath.Rel(src, path)
+ if err != nil {
+ return err
+ }
+ return replicateFile(path, filepath.Join(dst, relative), config)
+ })
+ case hardlinkMode:
+ return os.Link(src, dst)
+ case softlinkMode:
+ return os.Symlink(src, dst)
+ default:
+ return fmt.Errorf("Invalid replication mode %d", config.fileMode)
+ }
+}
+
+// replicateTree is called for each single src dst pair.
+func replicateTree(src, dst string, config *replicateConfig) error {
+ if err := os.RemoveAll(dst); err != nil {
+ return fmt.Errorf("Failed to remove file at destination %s: %v", dst, err)
+ }
+ if l, err := filepath.EvalSymlinks(src); err != nil {
+ return err
+ } else {
+ src = l
+ }
+ if s, err := os.Stat(src); err != nil {
+ return err
+ } else if s.IsDir() {
+ return replicateDir(src, dst, config)
+ }
+ return replicateFile(src, dst, config)
+}
+
+// replicate makes a tree of files visible in a new location.
+// You control how it does so using options, by default it presumes the entire tree
+// of files rooted at src must be visible at dst, and that it should do so by copying.
+// src is allowed to be a file, in which case just the one file is copied.
+func replicate(src, dst string, options ...replicateOption) error {
+ config := replicateConfig{
+ removeFirst: true,
+ }
+ for _, option := range options {
+ option(&config)
+ }
+ if len(config.paths) == 0 {
+ return replicateTree(src, dst, &config)
+ }
+ for _, base := range config.paths {
+ from := filepath.Join(src, base)
+ to := filepath.Join(dst, base)
+ if err := replicateTree(from, to, &config); err != nil {
+ return err
+ }
+ }
+ return nil
+}
diff --git a/go/tools/builders/stdlib.go b/go/tools/builders/stdlib.go
new file mode 100644
index 00000000..d7b2bf0b
--- /dev/null
+++ b/go/tools/builders/stdlib.go
@@ -0,0 +1,169 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "flag"
+ "fmt"
+ "go/build"
+ "os"
+ "path/filepath"
+ "regexp"
+ "strings"
+)
+
+// stdlib builds the standard library in the appropriate mode into a new goroot.
+func stdlib(args []string) error {
+ // process the args
+ flags := flag.NewFlagSet("stdlib", flag.ExitOnError)
+ goenv := envFlags(flags)
+ out := flags.String("out", "", "Path to output go root")
+ race := flags.Bool("race", false, "Build in race mode")
+ shared := flags.Bool("shared", false, "Build in shared mode")
+ dynlink := flags.Bool("dynlink", false, "Build in dynlink mode")
+ var packages multiFlag
+ flags.Var(&packages, "package", "Packages to build")
+ var gcflags quoteMultiFlag
+ flags.Var(&gcflags, "gcflags", "Go compiler flags")
+ if err := flags.Parse(args); err != nil {
+ return err
+ }
+ if err := goenv.checkFlags(); err != nil {
+ return err
+ }
+ goroot := os.Getenv("GOROOT")
+ if goroot == "" {
+ return fmt.Errorf("GOROOT not set")
+ }
+ output := abs(*out)
+
+ // Fail fast if cgo is required but a toolchain is not configured.
+ if os.Getenv("CGO_ENABLED") == "1" && filepath.Base(os.Getenv("CC")) == "vc_installation_error.bat" {
+ return fmt.Errorf(`cgo is required, but a C toolchain has not been configured.
+You may need to use the flags --cpu=x64_windows --compiler=mingw-gcc.`)
+ }
+
+ // Link in the bare minimum needed to the new GOROOT
+ if err := replicate(goroot, output, replicatePaths("src", "pkg/tool", "pkg/include")); err != nil {
+ return err
+ }
+
+ output, err := processPath(output)
+ if err != nil {
+ return err
+ }
+
+ // Now switch to the newly created GOROOT
+ os.Setenv("GOROOT", output)
+
+ // Create a temporary cache directory. "go build" requires this starting
+ // in Go 1.12.
+ cachePath := filepath.Join(output, ".gocache")
+ os.Setenv("GOCACHE", cachePath)
+ defer os.RemoveAll(cachePath)
+
+ // Disable modules for the 'go install' command. Depending on the sandboxing
+ // mode, there may be a go.mod file in a parent directory which will turn
+ // modules on in "auto" mode.
+ os.Setenv("GO111MODULE", "off")
+
+ // Make sure we have an absolute path to the C compiler.
+ // TODO(#1357): also take absolute paths of includes and other paths in flags.
+ os.Setenv("CC", quotePathIfNeeded(abs(os.Getenv("CC"))))
+
+ // Ensure paths are absolute.
+ absPaths := []string{}
+ for _, path := range filepath.SplitList(os.Getenv("PATH")) {
+ absPaths = append(absPaths, abs(path))
+ }
+ os.Setenv("PATH", strings.Join(absPaths, string(os.PathListSeparator)))
+
+ sandboxPath := abs(".")
+
+ // Strip path prefix from source files in debug information.
+ os.Setenv("CGO_CFLAGS", os.Getenv("CGO_CFLAGS")+" "+strings.Join(defaultCFlags(output), " "))
+ os.Setenv("CGO_LDFLAGS", os.Getenv("CGO_LDFLAGS")+" "+strings.Join(defaultLdFlags(), " "))
+
+ // Allow flags in CGO_LDFLAGS that wouldn't pass the security check.
+ // Workaround for golang.org/issue/42565.
+ var b strings.Builder
+ sep := ""
+ cgoLdflags, _ := splitQuoted(os.Getenv("CGO_LDFLAGS"))
+ for _, f := range cgoLdflags {
+ b.WriteString(sep)
+ sep = "|"
+ b.WriteString(regexp.QuoteMeta(f))
+ // If the flag if -framework, the flag value needs to be in the same
+ // condition.
+ if f == "-framework" {
+ sep = " "
+ }
+ }
+ os.Setenv("CGO_LDFLAGS_ALLOW", b.String())
+ os.Setenv("GODEBUG", "installgoroot=all")
+
+ // Build the commands needed to build the std library in the right mode
+ // NOTE: the go command stamps compiled .a files with build ids, which are
+ // cryptographic sums derived from the inputs. This prevents us from
+ // creating reproducible builds because the build ids are hashed from
+ // CGO_CFLAGS, which frequently contains absolute paths. As a workaround,
+ // we strip the build ids, since they won't be used after this.
+ installArgs := goenv.goCmd("install", "-toolexec", abs(os.Args[0])+" filterbuildid")
+ if len(build.Default.BuildTags) > 0 {
+ installArgs = append(installArgs, "-tags", strings.Join(build.Default.BuildTags, ","))
+ }
+
+ ldflags := []string{"-trimpath", sandboxPath}
+ asmflags := []string{"-trimpath", output}
+ if *race {
+ installArgs = append(installArgs, "-race")
+ }
+ if *shared {
+ gcflags = append(gcflags, "-shared")
+ ldflags = append(ldflags, "-shared")
+ asmflags = append(asmflags, "-shared")
+ }
+ if *dynlink {
+ gcflags = append(gcflags, "-dynlink")
+ ldflags = append(ldflags, "-dynlink")
+ asmflags = append(asmflags, "-dynlink")
+ }
+
+ // Since Go 1.10, an all= prefix indicates the flags should apply to the package
+ // and its dependencies, rather than just the package itself. This was the
+ // default behavior before Go 1.10.
+ allSlug := ""
+ for _, t := range build.Default.ReleaseTags {
+ if t == "go1.10" {
+ allSlug = "all="
+ break
+ }
+ }
+ installArgs = append(installArgs, "-gcflags="+allSlug+strings.Join(gcflags, " "))
+ installArgs = append(installArgs, "-ldflags="+allSlug+strings.Join(ldflags, " "))
+ installArgs = append(installArgs, "-asmflags="+allSlug+strings.Join(asmflags, " "))
+
+ // Modifying CGO flags to use only absolute path
+ // because go is having its own sandbox, all CGO flags must use absolute path
+ if err := absEnv(cgoEnvVars, cgoAbsEnvFlags); err != nil {
+ return fmt.Errorf("error modifying cgo environment to absolute path: %v", err)
+ }
+
+ installArgs = append(installArgs, packages...)
+ if err := goenv.runCommand(installArgs); err != nil {
+ return err
+ }
+ return nil
+}
diff --git a/go/tools/builders/stdliblist.go b/go/tools/builders/stdliblist.go
new file mode 100644
index 00000000..f6a61442
--- /dev/null
+++ b/go/tools/builders/stdliblist.go
@@ -0,0 +1,293 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "bytes"
+ "encoding/json"
+ "flag"
+ "fmt"
+ "go/build"
+ "os"
+ "path/filepath"
+ "strings"
+)
+
+// Copy and pasted from golang.org/x/tools/go/packages
+type flatPackagesError struct {
+ Pos string // "file:line:col" or "file:line" or "" or "-"
+ Msg string
+ Kind flatPackagesErrorKind
+}
+
+type flatPackagesErrorKind int
+
+const (
+ UnknownError flatPackagesErrorKind = iota
+ ListError
+ ParseError
+ TypeError
+)
+
+func (err flatPackagesError) Error() string {
+ pos := err.Pos
+ if pos == "" {
+ pos = "-" // like token.Position{}.String()
+ }
+ return pos + ": " + err.Msg
+}
+
+// flatPackage is the JSON form of Package
+// It drops all the type and syntax fields, and transforms the Imports
+type flatPackage struct {
+ ID string
+ Name string `json:",omitempty"`
+ PkgPath string `json:",omitempty"`
+ Standard bool `json:",omitempty"`
+ Errors []flatPackagesError `json:",omitempty"`
+ GoFiles []string `json:",omitempty"`
+ CompiledGoFiles []string `json:",omitempty"`
+ OtherFiles []string `json:",omitempty"`
+ ExportFile string `json:",omitempty"`
+ Imports map[string]string `json:",omitempty"`
+}
+
+type goListPackage struct {
+ Dir string // directory containing package sources
+ ImportPath string // import path of package in dir
+ Name string // package name
+ Target string // install path
+ Goroot bool // is this package in the Go root?
+ Standard bool // is this package part of the standard Go library?
+ Root string // Go root or Go path dir containing this package
+ Export string // file containing export data (when using -export)
+ // Source files
+ GoFiles []string // .go source files (excluding CgoFiles, TestGoFiles, XTestGoFiles)
+ CgoFiles []string // .go source files that import "C"
+ CompiledGoFiles []string // .go files presented to compiler (when using -compiled)
+ IgnoredGoFiles []string // .go source files ignored due to build constraints
+ IgnoredOtherFiles []string // non-.go source files ignored due to build constraints
+ CFiles []string // .c source files
+ CXXFiles []string // .cc, .cxx and .cpp source files
+ MFiles []string // .m source files
+ HFiles []string // .h, .hh, .hpp and .hxx source files
+ FFiles []string // .f, .F, .for and .f90 Fortran source files
+ SFiles []string // .s source files
+ SwigFiles []string // .swig files
+ SwigCXXFiles []string // .swigcxx files
+ SysoFiles []string // .syso object files to add to archive
+ TestGoFiles []string // _test.go files in package
+ XTestGoFiles []string // _test.go files outside package
+ // Embedded files
+ EmbedPatterns []string // //go:embed patterns
+ EmbedFiles []string // files matched by EmbedPatterns
+ TestEmbedPatterns []string // //go:embed patterns in TestGoFiles
+ TestEmbedFiles []string // files matched by TestEmbedPatterns
+ XTestEmbedPatterns []string // //go:embed patterns in XTestGoFiles
+ XTestEmbedFiles []string // files matched by XTestEmbedPatterns
+ // Dependency information
+ Imports []string // import paths used by this package
+ ImportMap map[string]string // map from source import to ImportPath (identity entries omitted)
+ // Error information
+ Incomplete bool // this package or a dependency has an error
+ Error *flatPackagesError // error loading package
+ DepsErrors []*flatPackagesError // errors loading dependencies
+}
+
+func stdlibPackageID(importPath string) string {
+ return "@io_bazel_rules_go//stdlib:" + importPath
+}
+
+// outputBasePath replace the cloneBase with output base label
+func outputBasePath(cloneBase, p string) string {
+ dir, _ := filepath.Rel(cloneBase, p)
+ return filepath.Join("__BAZEL_OUTPUT_BASE__", dir)
+}
+
+// absoluteSourcesPaths replace cloneBase of the absolution
+// paths with the label for all source files in a package
+func absoluteSourcesPaths(cloneBase, pkgDir string, srcs []string) []string {
+ ret := make([]string, 0, len(srcs))
+ pkgDir = outputBasePath(cloneBase, pkgDir)
+ for _, src := range srcs {
+ absPath := src
+
+ // Generated files will already have an absolute path. These come from
+ // the compiler's cache.
+ if !filepath.IsAbs(src) {
+ absPath = filepath.Join(pkgDir, src)
+ }
+
+ ret = append(ret, absPath)
+ }
+ return ret
+}
+
+// filterGoFiles keeps only files either ending in .go or those without an
+// extension (which are from the cache). This is a work around for
+// https://golang.org/issue/28749: cmd/go puts assembly, C, and C++ files in
+// CompiledGoFiles.
+func filterGoFiles(srcs []string) []string {
+ ret := make([]string, 0, len(srcs))
+ for _, f := range srcs {
+ if ext := filepath.Ext(f); ext == ".go" || ext == "" {
+ ret = append(ret, f)
+ }
+ }
+
+ return ret
+}
+
+func flatPackageForStd(cloneBase string, pkg *goListPackage) *flatPackage {
+ goFiles := absoluteSourcesPaths(cloneBase, pkg.Dir, pkg.GoFiles)
+ compiledGoFiles := absoluteSourcesPaths(cloneBase, pkg.Dir, pkg.CompiledGoFiles)
+
+ newPkg := &flatPackage{
+ ID: stdlibPackageID(pkg.ImportPath),
+ Name: pkg.Name,
+ PkgPath: pkg.ImportPath,
+ ExportFile: outputBasePath(cloneBase, pkg.Target),
+ Imports: map[string]string{},
+ Standard: pkg.Standard,
+ GoFiles: goFiles,
+ CompiledGoFiles: filterGoFiles(compiledGoFiles),
+ }
+
+ // imports
+ //
+ // Imports contains the IDs of all imported packages.
+ // ImportsMap records (path, ID) only where they differ.
+ ids := make(map[string]struct{})
+ for _, id := range pkg.Imports {
+ ids[id] = struct{}{}
+ }
+
+ for path, id := range pkg.ImportMap {
+ newPkg.Imports[path] = stdlibPackageID(id)
+ delete(ids, id)
+ }
+
+ for id := range ids {
+ if id != "C" {
+ newPkg.Imports[id] = stdlibPackageID(id)
+ }
+ }
+
+ return newPkg
+}
+
+// stdliblist runs `go list -json` on the standard library and saves it to a file.
+func stdliblist(args []string) error {
+ // process the args
+ flags := flag.NewFlagSet("stdliblist", flag.ExitOnError)
+ goenv := envFlags(flags)
+ out := flags.String("out", "", "Path to output go list json")
+ if err := flags.Parse(args); err != nil {
+ return err
+ }
+ if err := goenv.checkFlags(); err != nil {
+ return err
+ }
+
+ if filepath.IsAbs(goenv.sdk) {
+ return fmt.Errorf("-sdk needs to be a relative path, but got %s", goenv.sdk)
+ }
+
+ // In Go 1.18, the standard library started using go:embed directives.
+ // When Bazel runs this action, it does so inside a sandbox where GOROOT points
+ // to an external/go_sdk directory that contains a symlink farm of all files in
+ // the Go SDK.
+ // If we run "go list" with that GOROOT, this action will fail because those
+ // go:embed directives will refuse to include the symlinks in the sandbox.
+ //
+ // To work around this, cloneGoRoot creates a copy of a subset of external/go_sdk
+ // that is sufficient to call "go list" into a new cloneBase directory, e.g.
+ // "go list" needs to call "compile", which needs "pkg/tool".
+ // We also need to retain the same relative path to the root directory, e.g.
+ // "$OUTPUT_BASE/external/go_sdk" becomes
+ // {cloneBase}/external/go_sdk", which will be set at GOROOT later. This ensures
+ // that file paths in the generated JSON are still valid.
+ //
+ // Here we replicate goRoot(absolute path of goenv.sdk) to newGoRoot.
+ cloneBase, cleanup, err := goenv.workDir()
+ if err != nil {
+ return err
+ }
+ defer func() { cleanup() }()
+
+ newGoRoot := filepath.Join(cloneBase, goenv.sdk)
+ if err := replicate(abs(goenv.sdk), abs(newGoRoot), replicatePaths("src", "pkg/tool", "pkg/include")); err != nil {
+ return err
+ }
+
+ // Ensure paths are absolute.
+ absPaths := []string{}
+ for _, path := range filepath.SplitList(os.Getenv("PATH")) {
+ absPaths = append(absPaths, abs(path))
+ }
+ os.Setenv("PATH", strings.Join(absPaths, string(os.PathListSeparator)))
+ os.Setenv("GOROOT", newGoRoot)
+
+ cgoEnabled := os.Getenv("CGO_ENABLED") == "1"
+ // Make sure we have an absolute path to the C compiler.
+ // TODO(#1357): also take absolute paths of includes and other paths in flags.
+ ccEnv, ok := os.LookupEnv("CC")
+ if cgoEnabled && !ok {
+ return fmt.Errorf("CC must be set")
+ }
+ os.Setenv("CC", quotePathIfNeeded(abs(ccEnv)))
+
+ // We want to keep the cache around so that the processed files can be used by other tools.
+ cachePath := abs(*out + ".gocache")
+ os.Setenv("GOCACHE", cachePath)
+ os.Setenv("GOMODCACHE", cachePath)
+ os.Setenv("GOPATH", cachePath)
+
+ listArgs := goenv.goCmd("list")
+ if len(build.Default.BuildTags) > 0 {
+ listArgs = append(listArgs, "-tags", strings.Join(build.Default.BuildTags, ","))
+ }
+
+ if cgoEnabled {
+ listArgs = append(listArgs, "-compiled=true")
+ }
+
+ listArgs = append(listArgs, "-json", "builtin", "std", "runtime/cgo")
+
+ jsonFile, err := os.Create(*out)
+ if err != nil {
+ return err
+ }
+ defer jsonFile.Close()
+
+ jsonData := &bytes.Buffer{}
+ if err := goenv.runCommandToFile(jsonData, os.Stderr, listArgs); err != nil {
+ return err
+ }
+
+ encoder := json.NewEncoder(jsonFile)
+ decoder := json.NewDecoder(jsonData)
+ for decoder.More() {
+ var pkg *goListPackage
+ if err := decoder.Decode(&pkg); err != nil {
+ return err
+ }
+ if err := encoder.Encode(flatPackageForStd(cloneBase, pkg)); err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
diff --git a/go/tools/builders/stdliblist_test.go b/go/tools/builders/stdliblist_test.go
new file mode 100644
index 00000000..b456b0be
--- /dev/null
+++ b/go/tools/builders/stdliblist_test.go
@@ -0,0 +1,48 @@
+package main
+
+import (
+ "encoding/json"
+ "fmt"
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+func Test_stdliblist(t *testing.T) {
+ testDir := t.TempDir()
+ outJSON := filepath.Join(testDir, "out.json")
+
+ test_args := []string{
+ fmt.Sprintf("-out=%s", outJSON),
+ "-sdk=external/go_sdk",
+ }
+
+ if err := stdliblist(test_args); err != nil {
+ t.Errorf("calling stdliblist got err: %v", err)
+ }
+ f, err := os.Open(outJSON)
+ if err != nil {
+ t.Errorf("cannot open output json: %v", err)
+ }
+ defer func() { _ = f.Close() }()
+ decoder := json.NewDecoder(f)
+ for decoder.More() {
+ var result *flatPackage
+ if err := decoder.Decode(&result); err != nil {
+ t.Errorf("unable to decode output json: %v\n", err)
+ }
+
+ if !strings.HasPrefix(result.ID, "@io_bazel_rules_go//stdlib") {
+ t.Errorf("ID should be prefixed with @io_bazel_rules_go//stdlib :%v", result)
+ }
+ if !strings.HasPrefix(result.ExportFile, "__BAZEL_OUTPUT_BASE__") {
+ t.Errorf("export file should be prefixed with __BAZEL_OUTPUT_BASE__ :%v", result)
+ }
+ for _, gofile := range result.GoFiles {
+ if !strings.HasPrefix(gofile, "__BAZEL_OUTPUT_BASE__/external/go_sdk") {
+ t.Errorf("all go files should be prefixed with __BAZEL_OUTPUT_BASE__/external/go_sdk :%v", result)
+ }
+ }
+ }
+}
diff --git a/go/tools/bzltestutil/BUILD.bazel b/go/tools/bzltestutil/BUILD.bazel
new file mode 100644
index 00000000..cbb87e84
--- /dev/null
+++ b/go/tools/bzltestutil/BUILD.bazel
@@ -0,0 +1,45 @@
+load("//go:def.bzl", "go_test", "go_tool_library")
+
+go_tool_library(
+ name = "bzltestutil",
+ srcs = [
+ "init.go",
+ "lcov.go",
+ "test2json.go",
+ "wrap.go",
+ "xml.go",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/go/tools/bzltestutil",
+ visibility = ["//visibility:public"],
+)
+
+go_test(
+ name = "bzltestutil_test",
+ srcs = [
+ "lcov_test.go",
+ "wrap_test.go",
+ "xml_test.go",
+ ],
+ # Empty in integration tests or in distributions.
+ data = glob(
+ ["testdata/**"],
+ allow_empty = True,
+ ),
+ embed = [":bzltestutil"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(
+ ["**"],
+ exclude = ["testdata/*"],
+ ),
+ visibility = ["//visibility:public"],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":bzltestutil",
+ visibility = ["//visibility:public"],
+)
diff --git a/go/tools/bzltestutil/init.go b/go/tools/bzltestutil/init.go
new file mode 100644
index 00000000..ca9852ed
--- /dev/null
+++ b/go/tools/bzltestutil/init.go
@@ -0,0 +1,60 @@
+// Copyright 2020 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package bzltestutil
+
+// This package must have no deps beyond Go SDK.
+import (
+ "fmt"
+ "os"
+ "path/filepath"
+ "runtime"
+)
+
+var (
+ // Initialized by linker.
+ RunDir string
+
+ // Initial working directory.
+ testExecDir string
+)
+
+// This initializer runs before any user packages.
+func init() {
+ var err error
+ testExecDir, err = os.Getwd()
+ if err != nil {
+ panic(err)
+ }
+
+ // Check if we're being run by Bazel and change directories if so.
+ // TEST_SRCDIR and TEST_WORKSPACE are set by the Bazel test runner, so that makes a decent proxy.
+ testSrcDir, hasSrcDir := os.LookupEnv("TEST_SRCDIR")
+ testWorkspace, hasWorkspace := os.LookupEnv("TEST_WORKSPACE")
+ if hasSrcDir && hasWorkspace && RunDir != "" {
+ abs := RunDir
+ if !filepath.IsAbs(RunDir) {
+ abs = filepath.Join(testSrcDir, testWorkspace, RunDir)
+ }
+ err := os.Chdir(abs)
+ // Ignore the Chdir err when on Windows, since it might have have runfiles symlinks.
+ // https://github.com/bazelbuild/rules_go/pull/1721#issuecomment-422145904
+ if err != nil && runtime.GOOS != "windows" {
+ panic(fmt.Sprintf("could not change to test directory: %v", err))
+ }
+ if err == nil {
+ os.Setenv("PWD", abs)
+ }
+ }
+}
diff --git a/go/tools/bzltestutil/lcov.go b/go/tools/bzltestutil/lcov.go
new file mode 100644
index 00000000..8b94b162
--- /dev/null
+++ b/go/tools/bzltestutil/lcov.go
@@ -0,0 +1,178 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package bzltestutil
+
+import (
+ "bufio"
+ "flag"
+ "fmt"
+ "io"
+ "log"
+ "os"
+ "regexp"
+ "sort"
+ "strconv"
+ "strings"
+ "testing/internal/testdeps"
+)
+
+// ConvertCoverToLcov converts the go coverprofile file coverage.dat.cover to
+// the expectedLcov format and stores it in coverage.dat, where it is picked up by
+// Bazel.
+// The conversion emits line and branch coverage, but not function coverage.
+func ConvertCoverToLcov() error {
+ inPath := flag.Lookup("test.coverprofile").Value.String()
+ in, err := os.Open(inPath)
+ if err != nil {
+ // This can happen if there are no tests and should not be an error.
+ log.Printf("Not collecting coverage: %s has not been created: %s", inPath, err)
+ return nil
+ }
+ defer in.Close()
+
+ // All *.dat files in $COVERAGE_DIR will be merged by Bazel's lcov_merger tool.
+ out, err := os.CreateTemp(os.Getenv("COVERAGE_DIR"), "go_coverage.*.dat")
+ if err != nil {
+ return err
+ }
+ defer out.Close()
+
+ return convertCoverToLcov(in, out)
+}
+
+var _coverLinePattern = regexp.MustCompile(`^(?P<path>.+):(?P<startLine>\d+)\.(?P<startColumn>\d+),(?P<endLine>\d+)\.(?P<endColumn>\d+) (?P<numStmt>\d+) (?P<count>\d+)$`)
+
+const (
+ _pathIdx = 1
+ _startLineIdx = 2
+ _endLineIdx = 4
+ _countIdx = 7
+)
+
+func convertCoverToLcov(coverReader io.Reader, lcovWriter io.Writer) error {
+ cover := bufio.NewScanner(coverReader)
+ lcov := bufio.NewWriter(lcovWriter)
+ defer lcov.Flush()
+ currentPath := ""
+ var lineCounts map[uint32]uint32
+ for cover.Scan() {
+ l := cover.Text()
+ m := _coverLinePattern.FindStringSubmatch(l)
+ if m == nil {
+ if strings.HasPrefix(l, "mode: ") {
+ continue
+ }
+ return fmt.Errorf("invalid go cover line: %s", l)
+ }
+
+ if m[_pathIdx] != currentPath {
+ if currentPath != "" {
+ if err := emitLcovLines(lcov, currentPath, lineCounts); err != nil {
+ return err
+ }
+ }
+ currentPath = m[_pathIdx]
+ lineCounts = make(map[uint32]uint32)
+ }
+
+ startLine, err := strconv.ParseUint(m[_startLineIdx], 10, 32)
+ if err != nil {
+ return err
+ }
+ endLine, err := strconv.ParseUint(m[_endLineIdx], 10, 32)
+ if err != nil {
+ return err
+ }
+ count, err := strconv.ParseUint(m[_countIdx], 10, 32)
+ if err != nil {
+ return err
+ }
+ for line := uint32(startLine); line <= uint32(endLine); line++ {
+ prevCount, ok := lineCounts[line]
+ if !ok || uint32(count) > prevCount {
+ lineCounts[line] = uint32(count)
+ }
+ }
+ }
+ if currentPath != "" {
+ if err := emitLcovLines(lcov, currentPath, lineCounts); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+func emitLcovLines(lcov io.StringWriter, path string, lineCounts map[uint32]uint32) error {
+ _, err := lcov.WriteString(fmt.Sprintf("SF:%s\n", path))
+ if err != nil {
+ return err
+ }
+
+ // Emit the coverage counters for the individual source lines.
+ sortedLines := make([]uint32, 0, len(lineCounts))
+ for line := range lineCounts {
+ sortedLines = append(sortedLines, line)
+ }
+ sort.Slice(sortedLines, func(i, j int) bool { return sortedLines[i] < sortedLines[j] })
+ numCovered := 0
+ for _, line := range sortedLines {
+ count := lineCounts[line]
+ if count > 0 {
+ numCovered++
+ }
+ _, err := lcov.WriteString(fmt.Sprintf("DA:%d,%d\n", line, count))
+ if err != nil {
+ return err
+ }
+ }
+ // Emit a summary containing the number of all/covered lines and end the info for the current source file.
+ _, err = lcov.WriteString(fmt.Sprintf("LH:%d\nLF:%d\nend_of_record\n", numCovered, len(sortedLines)))
+ if err != nil {
+ return err
+ }
+ return nil
+}
+
+// LcovTestDeps is a patched version of testdeps.TestDeps that allows to
+// hook into the SetPanicOnExit0 call happening right before testing.M.Run
+// returns.
+// This trick relies on the testDeps interface defined in this package being
+// identical to the actual testing.testDeps interface, which differs between
+// major versions of Go.
+type LcovTestDeps struct {
+ testdeps.TestDeps
+ OriginalPanicOnExit bool
+}
+
+// SetPanicOnExit0 is called with true by m.Run() before running all tests,
+// and with false right before returning -- after writing all coverage
+// profiles.
+// https://cs.opensource.google/go/go/+/refs/tags/go1.18.1:src/testing/testing.go;l=1921-1931;drc=refs%2Ftags%2Fgo1.18.1
+//
+// This gives us a good place to intercept the os.Exit(m.Run()) with coverage
+// data already available.
+func (ltd LcovTestDeps) SetPanicOnExit0(panicOnExit bool) {
+ if !panicOnExit {
+ lcovAtExitHook()
+ }
+ ltd.TestDeps.SetPanicOnExit0(ltd.OriginalPanicOnExit)
+}
+
+func lcovAtExitHook() {
+ if err := ConvertCoverToLcov(); err != nil {
+ log.Printf("Failed to collect coverage: %s", err)
+ os.Exit(TestWrapperAbnormalExit)
+ }
+}
diff --git a/go/tools/bzltestutil/lcov_test.go b/go/tools/bzltestutil/lcov_test.go
new file mode 100644
index 00000000..3dc595b6
--- /dev/null
+++ b/go/tools/bzltestutil/lcov_test.go
@@ -0,0 +1,71 @@
+package bzltestutil
+
+import (
+ "strings"
+ "testing"
+)
+
+func TestConvertCoverToLcov(t *testing.T) {
+ var tests = []struct {
+ name string
+ goCover string
+ expectedLcov string
+ }{
+ {
+ "empty",
+ "",
+ "",
+ },
+ {
+ "mode only",
+ "mode: set\n",
+ "",
+ },
+ {
+ "single file",
+ `mode: count
+file.go:0.4,2.10 0 0
+`,
+ `SF:file.go
+DA:0,0
+DA:1,0
+DA:2,0
+LH:0
+LF:3
+end_of_record
+`,
+ },
+ {
+ "narrow ranges",
+ `mode: atomic
+path/to/pkg/file.go:0.1,0.2 5 1
+path/to/pkg/file2.go:1.2,1.2 4 2
+`,
+ `SF:path/to/pkg/file.go
+DA:0,1
+LH:1
+LF:1
+end_of_record
+SF:path/to/pkg/file2.go
+DA:1,2
+LH:1
+LF:1
+end_of_record
+`,
+ },
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ in := strings.NewReader(tt.goCover)
+ var out strings.Builder
+ err := convertCoverToLcov(in, &out)
+ if err != nil {
+ t.Errorf("convertCoverToLcov returned unexpected error: %+v", err)
+ }
+ actualLcov := out.String()
+ if actualLcov != tt.expectedLcov {
+ t.Errorf("covertCoverToLcov returned:\n%q\n, expected:\n%q\n", actualLcov, tt.expectedLcov)
+ }
+ })
+ }
+}
diff --git a/go/tools/bzltestutil/test2json.go b/go/tools/bzltestutil/test2json.go
new file mode 100644
index 00000000..331773d0
--- /dev/null
+++ b/go/tools/bzltestutil/test2json.go
@@ -0,0 +1,482 @@
+// Copyright 2017 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package test2json implements conversion of test binary output to JSON.
+// It is used by cmd/test2json and cmd/go.
+//
+// See the cmd/test2json documentation for details of the JSON encoding.
+//
+// The file test2json.go was copied from upstream go at
+// src/cmd/internal/test2json/test2json.go, revision
+// 1b86bdbdc3991c13c6ed156100a5f4918fdd9c6b. At the time of writing this was
+// deemed the best way of depending on this code that is otherwise not exposed
+// outside of the go toolchain. These files should be kept in sync.
+
+package bzltestutil
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "io"
+ "strconv"
+ "strings"
+ "time"
+ "unicode"
+ "unicode/utf8"
+)
+
+// Mode controls details of the conversion.
+type Mode int
+
+const (
+ Timestamp Mode = 1 << iota // include Time in events
+)
+
+// event is the JSON struct we emit.
+type event struct {
+ Time *time.Time `json:",omitempty"`
+ Action string
+ Package string `json:",omitempty"`
+ Test string `json:",omitempty"`
+ Elapsed *float64 `json:",omitempty"`
+ Output *textBytes `json:",omitempty"`
+}
+
+// textBytes is a hack to get JSON to emit a []byte as a string
+// without actually copying it to a string.
+// It implements encoding.TextMarshaler, which returns its text form as a []byte,
+// and then json encodes that text form as a string (which was our goal).
+type textBytes []byte
+
+func (b textBytes) MarshalText() ([]byte, error) { return b, nil }
+
+// A Converter holds the state of a test-to-JSON conversion.
+// It implements io.WriteCloser; the caller writes test output in,
+// and the converter writes JSON output to w.
+type Converter struct {
+ w io.Writer // JSON output stream
+ pkg string // package to name in events
+ mode Mode // mode bits
+ start time.Time // time converter started
+ testName string // name of current test, for output attribution
+ report []*event // pending test result reports (nested for subtests)
+ result string // overall test result if seen
+ input lineBuffer // input buffer
+ output lineBuffer // output buffer
+}
+
+// inBuffer and outBuffer are the input and output buffer sizes.
+// They're variables so that they can be reduced during testing.
+//
+// The input buffer needs to be able to hold any single test
+// directive line we want to recognize, like:
+//
+// <many spaces> --- PASS: very/nested/s/u/b/t/e/s/t
+//
+// If anyone reports a test directive line > 4k not working, it will
+// be defensible to suggest they restructure their test or test names.
+//
+// The output buffer must be >= utf8.UTFMax, so that it can
+// accumulate any single UTF8 sequence. Lines that fit entirely
+// within the output buffer are emitted in single output events.
+// Otherwise they are split into multiple events.
+// The output buffer size therefore limits the size of the encoding
+// of a single JSON output event. 1k seems like a reasonable balance
+// between wanting to avoid splitting an output line and not wanting to
+// generate enormous output events.
+var (
+ inBuffer = 4096
+ outBuffer = 1024
+)
+
+// NewConverter returns a "test to json" converter.
+// Writes on the returned writer are written as JSON to w,
+// with minimal delay.
+//
+// The writes to w are whole JSON events ending in \n,
+// so that it is safe to run multiple tests writing to multiple converters
+// writing to a single underlying output stream w.
+// As long as the underlying output w can handle concurrent writes
+// from multiple goroutines, the result will be a JSON stream
+// describing the relative ordering of execution in all the concurrent tests.
+//
+// The mode flag adjusts the behavior of the converter.
+// Passing ModeTime includes event timestamps and elapsed times.
+//
+// The pkg string, if present, specifies the import path to
+// report in the JSON stream.
+func NewConverter(w io.Writer, pkg string, mode Mode) *Converter {
+ c := new(Converter)
+ *c = Converter{
+ w: w,
+ pkg: pkg,
+ mode: mode,
+ start: time.Now(),
+ input: lineBuffer{
+ b: make([]byte, 0, inBuffer),
+ line: c.handleInputLine,
+ part: c.output.write,
+ },
+ output: lineBuffer{
+ b: make([]byte, 0, outBuffer),
+ line: c.writeOutputEvent,
+ part: c.writeOutputEvent,
+ },
+ }
+ return c
+}
+
+// Write writes the test input to the converter.
+func (c *Converter) Write(b []byte) (int, error) {
+ c.input.write(b)
+ return len(b), nil
+}
+
+// Exited marks the test process as having exited with the given error.
+func (c *Converter) Exited(err error) {
+ if err == nil {
+ c.result = "pass"
+ } else {
+ c.result = "fail"
+ }
+}
+
+var (
+ // printed by test on successful run.
+ bigPass = []byte("PASS\n")
+
+ // printed by test after a normal test failure.
+ bigFail = []byte("FAIL\n")
+
+ // printed by 'go test' along with an error if the test binary terminates
+ // with an error.
+ bigFailErrorPrefix = []byte("FAIL\t")
+
+ updates = [][]byte{
+ []byte("=== RUN "),
+ []byte("=== PAUSE "),
+ []byte("=== CONT "),
+ }
+
+ reports = [][]byte{
+ []byte("--- PASS: "),
+ []byte("--- FAIL: "),
+ []byte("--- SKIP: "),
+ []byte("--- BENCH: "),
+ }
+
+ fourSpace = []byte(" ")
+
+ skipLinePrefix = []byte("? \t")
+ skipLineSuffix = []byte("\t[no test files]\n")
+)
+
+// handleInputLine handles a single whole test output line.
+// It must write the line to c.output but may choose to do so
+// before or after emitting other events.
+func (c *Converter) handleInputLine(line []byte) {
+ // Final PASS or FAIL.
+ if bytes.Equal(line, bigPass) || bytes.Equal(line, bigFail) || bytes.HasPrefix(line, bigFailErrorPrefix) {
+ c.flushReport(0)
+ c.output.write(line)
+ if bytes.Equal(line, bigPass) {
+ c.result = "pass"
+ } else {
+ c.result = "fail"
+ }
+ return
+ }
+
+ // Special case for entirely skipped test binary: "? \tpkgname\t[no test files]\n" is only line.
+ // Report it as plain output but remember to say skip in the final summary.
+ if bytes.HasPrefix(line, skipLinePrefix) && bytes.HasSuffix(line, skipLineSuffix) && len(c.report) == 0 {
+ c.result = "skip"
+ }
+
+ // "=== RUN "
+ // "=== PAUSE "
+ // "=== CONT "
+ actionColon := false
+ origLine := line
+ ok := false
+ indent := 0
+ for _, magic := range updates {
+ if bytes.HasPrefix(line, magic) {
+ ok = true
+ break
+ }
+ }
+ if !ok {
+ // "--- PASS: "
+ // "--- FAIL: "
+ // "--- SKIP: "
+ // "--- BENCH: "
+ // but possibly indented.
+ for bytes.HasPrefix(line, fourSpace) {
+ line = line[4:]
+ indent++
+ }
+ for _, magic := range reports {
+ if bytes.HasPrefix(line, magic) {
+ actionColon = true
+ ok = true
+ break
+ }
+ }
+ }
+
+ // Not a special test output line.
+ if !ok {
+ // Lookup the name of the test which produced the output using the
+ // indentation of the output as an index into the stack of the current
+ // subtests.
+ // If the indentation is greater than the number of current subtests
+ // then the output must have included extra indentation. We can't
+ // determine which subtest produced this output, so we default to the
+ // old behaviour of assuming the most recently run subtest produced it.
+ if indent > 0 && indent <= len(c.report) {
+ c.testName = c.report[indent-1].Test
+ }
+ c.output.write(origLine)
+ return
+ }
+
+ // Parse out action and test name.
+ i := 0
+ if actionColon {
+ i = bytes.IndexByte(line, ':') + 1
+ }
+ if i == 0 {
+ i = len(updates[0])
+ }
+ action := strings.ToLower(strings.TrimSuffix(strings.TrimSpace(string(line[4:i])), ":"))
+ name := strings.TrimSpace(string(line[i:]))
+
+ e := &event{Action: action}
+ if line[0] == '-' { // PASS or FAIL report
+ // Parse out elapsed time.
+ if i := strings.Index(name, " ("); i >= 0 {
+ if strings.HasSuffix(name, "s)") {
+ t, err := strconv.ParseFloat(name[i+2:len(name)-2], 64)
+ if err == nil {
+ if c.mode&Timestamp != 0 {
+ e.Elapsed = &t
+ }
+ }
+ }
+ name = name[:i]
+ }
+ if len(c.report) < indent {
+ // Nested deeper than expected.
+ // Treat this line as plain output.
+ c.output.write(origLine)
+ return
+ }
+ // Flush reports at this indentation level or deeper.
+ c.flushReport(indent)
+ e.Test = name
+ c.testName = name
+ c.report = append(c.report, e)
+ c.output.write(origLine)
+ return
+ }
+ // === update.
+ // Finish any pending PASS/FAIL reports.
+ c.flushReport(0)
+ c.testName = name
+
+ if action == "pause" {
+ // For a pause, we want to write the pause notification before
+ // delivering the pause event, just so it doesn't look like the test
+ // is generating output immediately after being paused.
+ c.output.write(origLine)
+ }
+ c.writeEvent(e)
+ if action != "pause" {
+ c.output.write(origLine)
+ }
+
+ return
+}
+
+// flushReport flushes all pending PASS/FAIL reports at levels >= depth.
+func (c *Converter) flushReport(depth int) {
+ c.testName = ""
+ for len(c.report) > depth {
+ e := c.report[len(c.report)-1]
+ c.report = c.report[:len(c.report)-1]
+ c.writeEvent(e)
+ }
+}
+
+// Close marks the end of the go test output.
+// It flushes any pending input and then output (only partial lines at this point)
+// and then emits the final overall package-level pass/fail event.
+func (c *Converter) Close() error {
+ c.input.flush()
+ c.output.flush()
+ if c.result != "" {
+ e := &event{Action: c.result}
+ if c.mode&Timestamp != 0 {
+ dt := time.Since(c.start).Round(1 * time.Millisecond).Seconds()
+ e.Elapsed = &dt
+ }
+ c.writeEvent(e)
+ }
+ return nil
+}
+
+// writeOutputEvent writes a single output event with the given bytes.
+func (c *Converter) writeOutputEvent(out []byte) {
+ c.writeEvent(&event{
+ Action: "output",
+ Output: (*textBytes)(&out),
+ })
+}
+
+// writeEvent writes a single event.
+// It adds the package, time (if requested), and test name (if needed).
+func (c *Converter) writeEvent(e *event) {
+ e.Package = c.pkg
+ if c.mode&Timestamp != 0 {
+ t := time.Now()
+ e.Time = &t
+ }
+ if e.Test == "" {
+ e.Test = c.testName
+ }
+ js, err := json.Marshal(e)
+ if err != nil {
+ // Should not happen - event is valid for json.Marshal.
+ c.w.Write([]byte(fmt.Sprintf("testjson internal error: %v\n", err)))
+ return
+ }
+ js = append(js, '\n')
+ c.w.Write(js)
+}
+
+// A lineBuffer is an I/O buffer that reacts to writes by invoking
+// input-processing callbacks on whole lines or (for long lines that
+// have been split) line fragments.
+//
+// It should be initialized with b set to a buffer of length 0 but non-zero capacity,
+// and line and part set to the desired input processors.
+// The lineBuffer will call line(x) for any whole line x (including the final newline)
+// that fits entirely in cap(b). It will handle input lines longer than cap(b) by
+// calling part(x) for sections of the line. The line will be split at UTF8 boundaries,
+// and the final call to part for a long line includes the final newline.
+type lineBuffer struct {
+ b []byte // buffer
+ mid bool // whether we're in the middle of a long line
+ line func([]byte) // line callback
+ part func([]byte) // partial line callback
+}
+
+// write writes b to the buffer.
+func (l *lineBuffer) write(b []byte) {
+ for len(b) > 0 {
+ // Copy what we can into b.
+ m := copy(l.b[len(l.b):cap(l.b)], b)
+ l.b = l.b[:len(l.b)+m]
+ b = b[m:]
+
+ // Process lines in b.
+ i := 0
+ for i < len(l.b) {
+ j := bytes.IndexByte(l.b[i:], '\n')
+ if j < 0 {
+ if !l.mid {
+ if j := bytes.IndexByte(l.b[i:], '\t'); j >= 0 {
+ if isBenchmarkName(bytes.TrimRight(l.b[i:i+j], " ")) {
+ l.part(l.b[i : i+j+1])
+ l.mid = true
+ i += j + 1
+ }
+ }
+ }
+ break
+ }
+ e := i + j + 1
+ if l.mid {
+ // Found the end of a partial line.
+ l.part(l.b[i:e])
+ l.mid = false
+ } else {
+ // Found a whole line.
+ l.line(l.b[i:e])
+ }
+ i = e
+ }
+
+ // Whatever's left in l.b is a line fragment.
+ if i == 0 && len(l.b) == cap(l.b) {
+ // The whole buffer is a fragment.
+ // Emit it as the beginning (or continuation) of a partial line.
+ t := trimUTF8(l.b)
+ l.part(l.b[:t])
+ l.b = l.b[:copy(l.b, l.b[t:])]
+ l.mid = true
+ }
+
+ // There's room for more input.
+ // Slide it down in hope of completing the line.
+ if i > 0 {
+ l.b = l.b[:copy(l.b, l.b[i:])]
+ }
+ }
+}
+
+// flush flushes the line buffer.
+func (l *lineBuffer) flush() {
+ if len(l.b) > 0 {
+ // Must be a line without a \n, so a partial line.
+ l.part(l.b)
+ l.b = l.b[:0]
+ }
+}
+
+var benchmark = []byte("Benchmark")
+
+// isBenchmarkName reports whether b is a valid benchmark name
+// that might appear as the first field in a benchmark result line.
+func isBenchmarkName(b []byte) bool {
+ if !bytes.HasPrefix(b, benchmark) {
+ return false
+ }
+ if len(b) == len(benchmark) { // just "Benchmark"
+ return true
+ }
+ r, _ := utf8.DecodeRune(b[len(benchmark):])
+ return !unicode.IsLower(r)
+}
+
+// trimUTF8 returns a length t as close to len(b) as possible such that b[:t]
+// does not end in the middle of a possibly-valid UTF-8 sequence.
+//
+// If a large text buffer must be split before position i at the latest,
+// splitting at position trimUTF(b[:i]) avoids splitting a UTF-8 sequence.
+func trimUTF8(b []byte) int {
+ // Scan backward to find non-continuation byte.
+ for i := 1; i < utf8.UTFMax && i <= len(b); i++ {
+ if c := b[len(b)-i]; c&0xc0 != 0x80 {
+ switch {
+ case c&0xe0 == 0xc0:
+ if i < 2 {
+ return len(b) - i
+ }
+ case c&0xf0 == 0xe0:
+ if i < 3 {
+ return len(b) - i
+ }
+ case c&0xf8 == 0xf0:
+ if i < 4 {
+ return len(b) - i
+ }
+ }
+ break
+ }
+ }
+ return len(b)
+}
diff --git a/go/tools/bzltestutil/testdata/empty.json b/go/tools/bzltestutil/testdata/empty.json
new file mode 100644
index 00000000..ef3aac14
--- /dev/null
+++ b/go/tools/bzltestutil/testdata/empty.json
@@ -0,0 +1 @@
+{"Action":"fail"} \ No newline at end of file
diff --git a/go/tools/bzltestutil/testdata/empty.xml b/go/tools/bzltestutil/testdata/empty.xml
new file mode 100644
index 00000000..108da736
--- /dev/null
+++ b/go/tools/bzltestutil/testdata/empty.xml
@@ -0,0 +1,3 @@
+<testsuites>
+ <testsuite errors="0" failures="0" skipped="0" tests="0" time="" name="pkg/testing"></testsuite>
+</testsuites> \ No newline at end of file
diff --git a/go/tools/bzltestutil/testdata/report.json b/go/tools/bzltestutil/testdata/report.json
new file mode 100644
index 00000000..bad356bf
--- /dev/null
+++ b/go/tools/bzltestutil/testdata/report.json
@@ -0,0 +1,47 @@
+{"Action":"run","Test":"TestPass"}
+{"Action":"output","Test":"TestPass","Output":"=== RUN TestPass\n"}
+{"Action":"output","Test":"TestPass","Output":"=== PAUSE TestPass\n"}
+{"Action":"pause","Test":"TestPass"}
+{"Action":"run","Test":"TestPassLog"}
+{"Action":"output","Test":"TestPassLog","Output":"=== RUN TestPassLog\n"}
+{"Action":"output","Test":"TestPassLog","Output":"=== PAUSE TestPassLog\n"}
+{"Action":"pause","Test":"TestPassLog"}
+{"Action":"run","Test":"TestFail"}
+{"Action":"output","Test":"TestFail","Output":"=== RUN TestFail\n"}
+{"Action":"output","Test":"TestFail","Output":"--- FAIL: TestFail (0.00s)\n"}
+{"Action":"output","Test":"TestFail","Output":" test_test.go:23: Not working\n"}
+{"Action":"fail","Test":"TestFail","Elapsed":0}
+{"Action":"run","Test":"TestSubtests"}
+{"Action":"output","Test":"TestSubtests","Output":"=== RUN TestSubtests\n"}
+{"Action":"run","Test":"TestSubtests/subtest_a"}
+{"Action":"output","Test":"TestSubtests/subtest_a","Output":"=== RUN TestSubtests/subtest_a\n"}
+{"Action":"run","Test":"TestSubtests/testB"}
+{"Action":"output","Test":"TestSubtests/testB","Output":"=== RUN TestSubtests/testB\n"}
+{"Action":"run","Test":"TestSubtests/another_subtest"}
+{"Action":"output","Test":"TestSubtests/another_subtest","Output":"=== RUN TestSubtests/another_subtest\n"}
+{"Action":"output","Test":"TestSubtests","Output":"--- FAIL: TestSubtests (0.02s)\n"}
+{"Action":"output","Test":"TestSubtests/subtest_a","Output":" --- SKIP: TestSubtests/subtest_a (0.00s)\n"}
+{"Action":"output","Test":"TestSubtests/subtest_a","Output":" test_test.go:29: from subtest subtest a\n"}
+{"Action":"output","Test":"TestSubtests/subtest_a","Output":" test_test.go:31: from subtest subtest a\n"}
+{"Action":"output","Test":"TestSubtests/subtest_a","Output":" test_test.go:33: skipping this test\n"}
+{"Action":"skip","Test":"TestSubtests/subtest_a","Elapsed":0}
+{"Action":"output","Test":"TestSubtests/testB","Output":" --- PASS: TestSubtests/testB (0.01s)\n"}
+{"Action":"output","Test":"TestSubtests/testB","Output":" test_test.go:29: from subtest testB\n"}
+{"Action":"output","Test":"TestSubtests/testB","Output":" test_test.go:31: from subtest testB\n"}
+{"Action":"pass","Test":"TestSubtests/testB","Elapsed":0.01}
+{"Action":"output","Test":"TestSubtests/another_subtest","Output":" --- FAIL: TestSubtests/another_subtest (0.01s)\n"}
+{"Action":"output","Test":"TestSubtests/another_subtest","Output":" test_test.go:29: from subtest another subtest\n"}
+{"Action":"output","Test":"TestSubtests/another_subtest","Output":" test_test.go:31: from subtest another subtest\n"}
+{"Action":"fail","Test":"TestSubtests/another_subtest","Elapsed":0.01}
+{"Action":"fail","Test":"TestSubtests","Elapsed":0.02}
+{"Action":"cont","Test":"TestPass"}
+{"Action":"output","Test":"TestPass","Output":"=== CONT TestPass\n"}
+{"Action":"cont","Test":"TestPassLog"}
+{"Action":"output","Test":"TestPassLog","Output":"=== CONT TestPassLog\n"}
+{"Action":"output","Test":"TestPass","Output":"--- PASS: TestPass (0.00s)\n"}
+{"Action":"pass","Test":"TestPass","Elapsed":0}
+{"Action":"output","Test":"TestPassLog","Output":"--- PASS: TestPassLog (0.00s)\n"}
+{"Action":"output","Test":"TestPassLog","Output":" test_test.go:19: pass\n"}
+{"Action":"pass","Test":"TestPassLog","Elapsed":0}
+{"Action":"output","Output":"FAIL\n"}
+{"Action":"fail","Elapsed":0.03} \ No newline at end of file
diff --git a/go/tools/bzltestutil/testdata/report.xml b/go/tools/bzltestutil/testdata/report.xml
new file mode 100644
index 00000000..40348954
--- /dev/null
+++ b/go/tools/bzltestutil/testdata/report.xml
@@ -0,0 +1,19 @@
+<testsuites>
+ <testsuite errors="0" failures="3" skipped="1" tests="7" time="0.030" name="pkg/testing">
+ <testcase classname="testing" name="TestFail" time="0.000">
+ <failure message="Failed" type="">=== RUN TestFail&#xA;--- FAIL: TestFail (0.00s)&#xA; test_test.go:23: Not working&#xA;</failure>
+ </testcase>
+ <testcase classname="testing" name="TestPass" time="0.000"></testcase>
+ <testcase classname="testing" name="TestPassLog" time="0.000"></testcase>
+ <testcase classname="testing" name="TestSubtests" time="0.020">
+ <failure message="Failed" type="">=== RUN TestSubtests&#xA;--- FAIL: TestSubtests (0.02s)&#xA;</failure>
+ </testcase>
+ <testcase classname="testing" name="TestSubtests/another_subtest" time="0.010">
+ <failure message="Failed" type="">=== RUN TestSubtests/another_subtest&#xA; --- FAIL: TestSubtests/another_subtest (0.01s)&#xA; test_test.go:29: from subtest another subtest&#xA; test_test.go:31: from subtest another subtest&#xA;</failure>
+ </testcase>
+ <testcase classname="testing" name="TestSubtests/subtest_a" time="0.000">
+ <skipped message="Skipped" type="">=== RUN TestSubtests/subtest_a&#xA; --- SKIP: TestSubtests/subtest_a (0.00s)&#xA; test_test.go:29: from subtest subtest a&#xA; test_test.go:31: from subtest subtest a&#xA; test_test.go:33: skipping this test&#xA;</skipped>
+ </testcase>
+ <testcase classname="testing" name="TestSubtests/testB" time="0.010"></testcase>
+ </testsuite>
+</testsuites> \ No newline at end of file
diff --git a/go/tools/bzltestutil/wrap.go b/go/tools/bzltestutil/wrap.go
new file mode 100644
index 00000000..c8fb65e0
--- /dev/null
+++ b/go/tools/bzltestutil/wrap.go
@@ -0,0 +1,154 @@
+// Copyright 2020 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package bzltestutil
+
+import (
+ "bufio"
+ "bytes"
+ "fmt"
+ "io"
+ "io/ioutil"
+ "log"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strconv"
+ "strings"
+ "sync"
+)
+
+// TestWrapperAbnormalExit is used by Wrap to indicate the child
+// process exitted without an exit code (for example being killed by a signal).
+// We use 6, in line with Bazel's RUN_FAILURE.
+const TestWrapperAbnormalExit = 6
+
+func ShouldWrap() bool {
+ if wrapEnv, ok := os.LookupEnv("GO_TEST_WRAP"); ok {
+ wrap, err := strconv.ParseBool(wrapEnv)
+ if err != nil {
+ log.Fatalf("invalid value for GO_TEST_WRAP: %q", wrapEnv)
+ }
+ return wrap
+ }
+ _, ok := os.LookupEnv("XML_OUTPUT_FILE")
+ return ok
+}
+
+// shouldAddTestV indicates if the test wrapper should prepend a -test.v flag to
+// the test args. This is required to get information about passing tests from
+// test2json for complete XML reports.
+func shouldAddTestV() bool {
+ if wrapEnv, ok := os.LookupEnv("GO_TEST_WRAP_TESTV"); ok {
+ wrap, err := strconv.ParseBool(wrapEnv)
+ if err != nil {
+ log.Fatalf("invalid value for GO_TEST_WRAP_TESTV: %q", wrapEnv)
+ }
+ return wrap
+ }
+ return false
+}
+
+// streamMerger intelligently merges an input stdout and stderr stream and dumps
+// the output to the writer `inner`. Additional synchronization is applied to
+// ensure that one line at a time is written to the inner writer.
+type streamMerger struct {
+ OutW, ErrW *io.PipeWriter
+ mutex sync.Mutex
+ inner io.Writer
+ wg sync.WaitGroup
+ outR, errR *bufio.Reader
+}
+
+func NewStreamMerger(w io.Writer) *streamMerger {
+ outR, outW := io.Pipe()
+ errR, errW := io.Pipe()
+ return &streamMerger{
+ inner: w,
+ OutW: outW,
+ ErrW: errW,
+ outR: bufio.NewReader(outR),
+ errR: bufio.NewReader(errR),
+ }
+}
+
+func (m *streamMerger) Start() {
+ m.wg.Add(2)
+ process := func(r *bufio.Reader) {
+ for {
+ s, err := r.ReadString('\n')
+ if len(s) > 0 {
+ m.mutex.Lock()
+ io.WriteString(m.inner, s)
+ m.mutex.Unlock()
+ }
+ if err == io.EOF {
+ break
+ }
+ }
+ m.wg.Done()
+ }
+ go process(m.outR)
+ go process(m.errR)
+}
+
+func (m *streamMerger) Wait() {
+ m.wg.Wait()
+}
+
+func Wrap(pkg string) error {
+ var jsonBuffer bytes.Buffer
+ jsonConverter := NewConverter(&jsonBuffer, pkg, Timestamp)
+ streamMerger := NewStreamMerger(jsonConverter)
+
+ args := os.Args[1:]
+ if shouldAddTestV() {
+ args = append([]string{"-test.v"}, args...)
+ }
+ exePath := os.Args[0]
+ if !filepath.IsAbs(exePath) && strings.ContainsRune(exePath, filepath.Separator) && testExecDir != "" {
+ exePath = filepath.Join(testExecDir, exePath)
+ }
+ cmd := exec.Command(exePath, args...)
+ cmd.Env = append(os.Environ(), "GO_TEST_WRAP=0")
+ cmd.Stderr = io.MultiWriter(os.Stderr, streamMerger.ErrW)
+ cmd.Stdout = io.MultiWriter(os.Stdout, streamMerger.OutW)
+ streamMerger.Start()
+ err := cmd.Run()
+ streamMerger.ErrW.Close()
+ streamMerger.OutW.Close()
+ streamMerger.Wait()
+ jsonConverter.Close()
+ if out, ok := os.LookupEnv("XML_OUTPUT_FILE"); ok {
+ werr := writeReport(jsonBuffer, pkg, out)
+ if werr != nil {
+ if err != nil {
+ return fmt.Errorf("error while generating testreport: %s, (error wrapping test execution: %s)", werr, err)
+ }
+ return fmt.Errorf("error while generating testreport: %s", werr)
+ }
+ }
+ return err
+}
+
+func writeReport(jsonBuffer bytes.Buffer, pkg string, path string) error {
+ xml, cerr := json2xml(&jsonBuffer, pkg)
+ if cerr != nil {
+ return fmt.Errorf("error converting test output to xml: %s", cerr)
+ }
+ if err := ioutil.WriteFile(path, xml, 0664); err != nil {
+ return fmt.Errorf("error writing test xml: %s", err)
+ }
+ return nil
+}
diff --git a/go/tools/bzltestutil/wrap_test.go b/go/tools/bzltestutil/wrap_test.go
new file mode 100644
index 00000000..8444b7a5
--- /dev/null
+++ b/go/tools/bzltestutil/wrap_test.go
@@ -0,0 +1,63 @@
+// Copyright 2020 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package bzltestutil
+
+import (
+ "fmt"
+ "os"
+ "testing"
+)
+
+func TestShouldWrap(t *testing.T) {
+ var tests = []struct {
+ envs map[string]string
+ shouldWrap bool
+ }{
+ {
+ envs: map[string]string{
+ "GO_TEST_WRAP": "0",
+ "XML_OUTPUT_FILE": "",
+ },
+ shouldWrap: false,
+ }, {
+ envs: map[string]string{
+ "GO_TEST_WRAP": "1",
+ "XML_OUTPUT_FILE": "",
+ },
+ shouldWrap: true,
+ }, {
+ envs: map[string]string{
+ "GO_TEST_WRAP": "",
+ "XML_OUTPUT_FILE": "path",
+ },
+ shouldWrap: true,
+ },
+ }
+ for _, tt := range tests {
+ t.Run(fmt.Sprintf("%v", tt.envs), func(t *testing.T) {
+ for k, v := range tt.envs {
+ if v == "" {
+ os.Unsetenv(k)
+ } else {
+ os.Setenv(k, v)
+ }
+ }
+ got := ShouldWrap()
+ if tt.shouldWrap != got {
+ t.Errorf("shouldWrap returned %t, expected %t", got, tt.shouldWrap)
+ }
+ })
+ }
+}
diff --git a/go/tools/bzltestutil/xml.go b/go/tools/bzltestutil/xml.go
new file mode 100644
index 00000000..d8ecd1d9
--- /dev/null
+++ b/go/tools/bzltestutil/xml.go
@@ -0,0 +1,181 @@
+// Copyright 2020 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package bzltestutil
+
+import (
+ "encoding/json"
+ "encoding/xml"
+ "fmt"
+ "io"
+ "path"
+ "sort"
+ "strings"
+ "time"
+)
+
+type xmlTestSuites struct {
+ XMLName xml.Name `xml:"testsuites"`
+ Suites []xmlTestSuite `xml:"testsuite"`
+}
+
+type xmlTestSuite struct {
+ XMLName xml.Name `xml:"testsuite"`
+ TestCases []xmlTestCase `xml:"testcase"`
+ Errors int `xml:"errors,attr"`
+ Failures int `xml:"failures,attr"`
+ Skipped int `xml:"skipped,attr"`
+ Tests int `xml:"tests,attr"`
+ Time string `xml:"time,attr"`
+ Name string `xml:"name,attr"`
+}
+
+type xmlTestCase struct {
+ XMLName xml.Name `xml:"testcase"`
+ Classname string `xml:"classname,attr"`
+ Name string `xml:"name,attr"`
+ Time string `xml:"time,attr"`
+ Failure *xmlMessage `xml:"failure,omitempty"`
+ Error *xmlMessage `xml:"error,omitempty"`
+ Skipped *xmlMessage `xml:"skipped,omitempty"`
+}
+
+type xmlMessage struct {
+ Message string `xml:"message,attr"`
+ Type string `xml:"type,attr"`
+ Contents string `xml:",chardata"`
+}
+
+// jsonEvent as encoded by the test2json package.
+type jsonEvent struct {
+ Time *time.Time
+ Action string
+ Package string
+ Test string
+ Elapsed *float64
+ Output string
+}
+
+type testCase struct {
+ state string
+ output strings.Builder
+ duration *float64
+}
+
+// json2xml converts test2json's output into an xml output readable by Bazel.
+// http://windyroad.com.au/dl/Open%20Source/JUnit.xsd
+func json2xml(r io.Reader, pkgName string) ([]byte, error) {
+ var pkgDuration *float64
+ testcases := make(map[string]*testCase)
+ testCaseByName := func(name string) *testCase {
+ if name == "" {
+ return nil
+ }
+ if _, ok := testcases[name]; !ok {
+ testcases[name] = &testCase{}
+ }
+ return testcases[name]
+ }
+
+ dec := json.NewDecoder(r)
+ for {
+ var e jsonEvent
+ if err := dec.Decode(&e); err == io.EOF {
+ break
+ } else if err != nil {
+ return nil, fmt.Errorf("error decoding test2json output: %s", err)
+ }
+ switch s := e.Action; s {
+ case "run":
+ if c := testCaseByName(e.Test); c != nil {
+ c.state = s
+ }
+ case "output":
+ if c := testCaseByName(e.Test); c != nil {
+ c.output.WriteString(e.Output)
+ }
+ case "skip":
+ if c := testCaseByName(e.Test); c != nil {
+ c.output.WriteString(e.Output)
+ c.state = s
+ c.duration = e.Elapsed
+ }
+ case "fail":
+ if c := testCaseByName(e.Test); c != nil {
+ c.state = s
+ c.duration = e.Elapsed
+ } else {
+ pkgDuration = e.Elapsed
+ }
+ case "pass":
+ if c := testCaseByName(e.Test); c != nil {
+ c.duration = e.Elapsed
+ c.state = s
+ } else {
+ pkgDuration = e.Elapsed
+ }
+ }
+ }
+
+ return xml.MarshalIndent(toXML(pkgName, pkgDuration, testcases), "", "\t")
+}
+
+func toXML(pkgName string, pkgDuration *float64, testcases map[string]*testCase) *xmlTestSuites {
+ cases := make([]string, 0, len(testcases))
+ for k := range testcases {
+ cases = append(cases, k)
+ }
+ sort.Strings(cases)
+ suite := xmlTestSuite{
+ Name: pkgName,
+ }
+ if pkgDuration != nil {
+ suite.Time = fmt.Sprintf("%.3f", *pkgDuration)
+ }
+ for _, name := range cases {
+ c := testcases[name]
+ suite.Tests++
+ newCase := xmlTestCase{
+ Name: name,
+ Classname: path.Base(pkgName),
+ }
+ if c.duration != nil {
+ newCase.Time = fmt.Sprintf("%.3f", *c.duration)
+ }
+ switch c.state {
+ case "skip":
+ suite.Skipped++
+ newCase.Skipped = &xmlMessage{
+ Message: "Skipped",
+ Contents: c.output.String(),
+ }
+ case "fail":
+ suite.Failures++
+ newCase.Failure = &xmlMessage{
+ Message: "Failed",
+ Contents: c.output.String(),
+ }
+ case "pass":
+ break
+ default:
+ suite.Errors++
+ newCase.Error = &xmlMessage{
+ Message: "No pass/skip/fail event found for test",
+ Contents: c.output.String(),
+ }
+ }
+ suite.TestCases = append(suite.TestCases, newCase)
+ }
+ return &xmlTestSuites{Suites: []xmlTestSuite{suite}}
+}
diff --git a/go/tools/bzltestutil/xml_test.go b/go/tools/bzltestutil/xml_test.go
new file mode 100644
index 00000000..8221e70d
--- /dev/null
+++ b/go/tools/bzltestutil/xml_test.go
@@ -0,0 +1,55 @@
+// Copyright 2020 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package bzltestutil
+
+import (
+ "bytes"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+func TestJSON2XML(t *testing.T) {
+ files, err := filepath.Glob("testdata/*.json")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ for _, file := range files {
+ name := strings.TrimSuffix(filepath.Base(file), ".json")
+ t.Run(name, func(t *testing.T) {
+ orig, err := os.Open(file)
+ if err != nil {
+ t.Fatal(err)
+ }
+ got, err := json2xml(orig, "pkg/testing")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ target := strings.TrimSuffix(file, ".json") + ".xml"
+ want, err := ioutil.ReadFile(target)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if !bytes.Equal(got, want) {
+ t.Errorf("json2xml for %s does not match, got:\n%s\nwant:\n%s\n", name, string(got), string(want))
+ }
+ })
+ }
+}
diff --git a/go/tools/coverdata/BUILD.bazel b/go/tools/coverdata/BUILD.bazel
new file mode 100644
index 00000000..00b60185
--- /dev/null
+++ b/go/tools/coverdata/BUILD.bazel
@@ -0,0 +1,15 @@
+load("//go/private/rules:library.bzl", "go_tool_library")
+
+go_tool_library(
+ name = "coverdata",
+ srcs = ["coverdata.go"],
+ importpath = "github.com/bazelbuild/rules_go/go/tools/coverdata",
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
diff --git a/go/tools/coverdata/coverdata.go b/go/tools/coverdata/coverdata.go
new file mode 100644
index 00000000..1a80b014
--- /dev/null
+++ b/go/tools/coverdata/coverdata.go
@@ -0,0 +1,58 @@
+/* Copyright 2018 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Package coverdata provides a registration function for files with
+// coverage instrumentation.
+//
+// This package is part of the Bazel Go rules, and its interface
+// should not be considered public. It may change without notice.
+package coverdata
+
+import (
+ "fmt"
+ "testing"
+)
+
+// Contains all coverage data for the program.
+var (
+ Counters = make(map[string][]uint32)
+ Blocks = make(map[string][]testing.CoverBlock)
+)
+
+// RegisterFile causes the coverage data recorded for a file to be included
+// in program-wide coverage reports. This should be called from init functions
+// in packages with coverage instrumentation.
+func RegisterFile(fileName string, counter []uint32, pos []uint32, numStmts []uint16) {
+ if 3*len(counter) != len(pos) || len(counter) != len(numStmts) {
+ panic("coverage: mismatched sizes")
+ }
+ if Counters[fileName] != nil {
+ // Already registered.
+ fmt.Printf("Already covered %s\n", fileName)
+ return
+ }
+ Counters[fileName] = counter
+ block := make([]testing.CoverBlock, len(counter))
+ for i := range counter {
+ block[i] = testing.CoverBlock{
+ Line0: pos[3*i+0],
+ Col0: uint16(pos[3*i+2]),
+ Line1: pos[3*i+1],
+ Col1: uint16(pos[3*i+2] >> 16),
+ Stmts: numStmts[i],
+ }
+ }
+ Blocks[fileName] = block
+}
diff --git a/go/tools/fetch_repo/BUILD.bazel b/go/tools/fetch_repo/BUILD.bazel
new file mode 100644
index 00000000..e865f654
--- /dev/null
+++ b/go/tools/fetch_repo/BUILD.bazel
@@ -0,0 +1,23 @@
+load("//go:def.bzl", "go_binary", "go_library", "go_test")
+
+go_binary(
+ name = "fetch_repo",
+ embed = [":go_default_library"],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "go_default_library",
+ srcs = ["main.go"],
+ importpath = "github.com/bazelbuild/rules_go/go/tools/fetch_repo",
+ visibility = ["//visibility:private"],
+ deps = ["@org_golang_x_tools//go/vcs:go_default_library"],
+)
+
+go_test(
+ name = "go_default_test",
+ size = "small",
+ srcs = ["fetch_repo_test.go"],
+ embed = [":go_default_library"],
+ deps = ["@org_golang_x_tools//go/vcs:go_default_library"],
+)
diff --git a/go/tools/fetch_repo/fetch_repo_test.go b/go/tools/fetch_repo/fetch_repo_test.go
new file mode 100644
index 00000000..d0573490
--- /dev/null
+++ b/go/tools/fetch_repo/fetch_repo_test.go
@@ -0,0 +1,96 @@
+package main
+
+import (
+ "os"
+ "reflect"
+ "testing"
+
+ "golang.org/x/tools/go/vcs"
+)
+
+var (
+ root = &vcs.RepoRoot{
+ VCS: vcs.ByCmd("git"),
+ Repo: "https://github.com/bazeltest/rules_go",
+ Root: "github.com/bazeltest/rules_go",
+ }
+)
+
+func TestMain(m *testing.M) {
+ // Replace vcs.RepoRootForImportPath to disable any network calls.
+ repoRootForImportPath = func(_ string, _ bool) (*vcs.RepoRoot, error) {
+ return root, nil
+ }
+ os.Exit(m.Run())
+}
+
+func TestGetRepoRoot(t *testing.T) {
+ for _, tc := range []struct {
+ label string
+ remote string
+ cmd string
+ importpath string
+ r *vcs.RepoRoot
+ }{
+ {
+ label: "all",
+ remote: "https://github.com/bazeltest/rules_go",
+ cmd: "git",
+ importpath: "github.com/bazeltest/rules_go",
+ r: root,
+ },
+ {
+ label: "different remote",
+ remote: "https://example.com/rules_go",
+ cmd: "git",
+ importpath: "github.com/bazeltest/rules_go",
+ r: &vcs.RepoRoot{
+ VCS: vcs.ByCmd("git"),
+ Repo: "https://example.com/rules_go",
+ Root: "github.com/bazeltest/rules_go",
+ },
+ },
+ {
+ label: "only importpath",
+ importpath: "github.com/bazeltest/rules_go",
+ r: root,
+ },
+ } {
+ r, err := getRepoRoot(tc.remote, tc.cmd, tc.importpath)
+ if err != nil {
+ t.Errorf("[%s] %v", tc.label, err)
+ }
+ if !reflect.DeepEqual(r, tc.r) {
+ t.Errorf("[%s] Expected %+v, got %+v", tc.label, tc.r, r)
+ }
+ }
+}
+
+func TestGetRepoRoot_error(t *testing.T) {
+ for _, tc := range []struct {
+ label string
+ remote string
+ cmd string
+ importpath string
+ }{
+ {
+ label: "importpath as remote",
+ remote: "github.com/bazeltest/rules_go",
+ },
+ {
+ label: "missing vcs",
+ remote: "https://github.com/bazeltest/rules_go",
+ importpath: "github.com/bazeltest/rules_go",
+ },
+ {
+ label: "missing remote",
+ cmd: "git",
+ importpath: "github.com/bazeltest/rules_go",
+ },
+ } {
+ r, err := getRepoRoot(tc.remote, tc.cmd, tc.importpath)
+ if err == nil {
+ t.Errorf("[%s] expected error. Got %+v", tc.label, r)
+ }
+ }
+}
diff --git a/go/tools/fetch_repo/main.go b/go/tools/fetch_repo/main.go
new file mode 100644
index 00000000..d3993202
--- /dev/null
+++ b/go/tools/fetch_repo/main.go
@@ -0,0 +1,75 @@
+// Command fetch_repo is similar to "go get -d" but it works even if the given
+// repository path is not a buildable Go package and it checks out a specific
+// revision rather than the latest revision.
+//
+// The difference between fetch_repo and "git clone" or {new_,}git_repository is
+// that fetch_repo recognizes import redirection of Go and it supports other
+// version control systems than git.
+//
+// These differences help us to manage external Go repositories in the manner of
+// Bazel.
+package main
+
+import (
+ "flag"
+ "fmt"
+ "log"
+
+ "golang.org/x/tools/go/vcs"
+)
+
+var (
+ remote = flag.String("remote", "", "The URI of the remote repository. Must be used with the --vcs flag.")
+ cmd = flag.String("vcs", "", "Version control system to use to fetch the repository. Should be one of: git,hg,svn,bzr. Must be used with the --remote flag.")
+ rev = flag.String("rev", "", "target revision")
+ dest = flag.String("dest", "", "destination directory")
+ importpath = flag.String("importpath", "", "Go importpath to the repository fetch")
+
+ // Used for overriding in tests to disable network calls.
+ repoRootForImportPath = vcs.RepoRootForImportPath
+)
+
+func getRepoRoot(remote, cmd, importpath string) (*vcs.RepoRoot, error) {
+ if (cmd == "") != (remote == "") {
+ return nil, fmt.Errorf("--remote should be used with the --vcs flag. If this is an import path, use --importpath instead.")
+ }
+
+ if cmd != "" && remote != "" {
+ v := vcs.ByCmd(cmd)
+ if v == nil {
+ return nil, fmt.Errorf("invalid VCS type: %s", cmd)
+ }
+ return &vcs.RepoRoot{
+ VCS: v,
+ Repo: remote,
+ Root: importpath,
+ }, nil
+ }
+
+ // User did not give us complete information for VCS / Remote.
+ // Try to figure out the information from the import path.
+ r, err := repoRootForImportPath(importpath, true)
+ if err != nil {
+ return nil, err
+ }
+ if importpath != r.Root {
+ return nil, fmt.Errorf("not a root of a repository: %s", importpath)
+ }
+ return r, nil
+}
+
+func run() error {
+ r, err := getRepoRoot(*remote, *cmd, *importpath)
+ if err != nil {
+ return err
+ }
+ return r.VCS.CreateAtRev(*dest, r.Repo, *rev)
+}
+
+func main() {
+ flag.Parse()
+
+ if err := run(); err != nil {
+ log.Fatal(err)
+ }
+}
diff --git a/go/tools/gazelle/README.rst b/go/tools/gazelle/README.rst
new file mode 100644
index 00000000..aa6177bc
--- /dev/null
+++ b/go/tools/gazelle/README.rst
@@ -0,0 +1,2 @@
+Gazelle has moved to a new repository:
+`github.com/bazelbuild/bazel-gazelle <https://github.com/bazelbuild/bazel-gazelle>`_
diff --git a/go/tools/go_bin_runner/BUILD.bazel b/go/tools/go_bin_runner/BUILD.bazel
new file mode 100644
index 00000000..91be016e
--- /dev/null
+++ b/go/tools/go_bin_runner/BUILD.bazel
@@ -0,0 +1,39 @@
+# gazelle:exclude
+
+load("//go:def.bzl", "go_binary", "go_library")
+load("//go/private/rules:go_bin_for_host.bzl", "go_bin_for_host")
+
+go_bin_for_host(
+ name = "go_bin_for_host",
+ visibility = ["//visibility:private"],
+)
+
+go_library(
+ name = "go_bin_runner_lib",
+ srcs = [
+ "main.go",
+ "process.go",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/go/tools/go_bin_runner",
+ visibility = ["//visibility:private"],
+ deps = [
+ "//go/runfiles",
+ ],
+)
+
+go_binary(
+ name = "go_bin_runner",
+ data = [":go_bin_for_host"],
+ embed = [":go_bin_runner_lib"],
+ visibility = ["//go:__pkg__"],
+ x_defs = {
+ "GoBinRlocationPath": "$(rlocationpath :go_bin_for_host)",
+ },
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
diff --git a/go/tools/go_bin_runner/main.go b/go/tools/go_bin_runner/main.go
new file mode 100644
index 00000000..bca4f7fc
--- /dev/null
+++ b/go/tools/go_bin_runner/main.go
@@ -0,0 +1,41 @@
+package main
+
+import (
+ "log"
+ "os"
+ "path/filepath"
+ "strings"
+
+ "github.com/bazelbuild/rules_go/go/runfiles"
+)
+
+var GoBinRlocationPath = "not set"
+
+func main() {
+ goBin, err := runfiles.Rlocation(GoBinRlocationPath)
+ if err != nil {
+ log.Fatal(err)
+ }
+ // The go binary lies at $GOROOT/bin/go.
+ goRoot, err := filepath.Abs(filepath.Dir(filepath.Dir(goBin)))
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ env := os.Environ()
+ var filteredEnv []string
+ for i := 0; i < len(env); i++ {
+ if !strings.HasPrefix(env[i], "GOROOT=") {
+ filteredEnv = append(filteredEnv, env[i])
+ }
+ }
+ filteredEnv = append(filteredEnv, "GOROOT="+goRoot)
+
+ err = os.Chdir(os.Getenv("BUILD_WORKING_DIRECTORY"))
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ args := append([]string{goBin}, os.Args[1:]...)
+ log.Fatal(ReplaceWithProcess(args, filteredEnv))
+}
diff --git a/go/tools/go_bin_runner/process.go b/go/tools/go_bin_runner/process.go
new file mode 100644
index 00000000..af236549
--- /dev/null
+++ b/go/tools/go_bin_runner/process.go
@@ -0,0 +1,20 @@
+package main
+
+import (
+ "os"
+ "os/exec"
+)
+
+func ReplaceWithProcess(args, env []string) error {
+ cmd := exec.Command(args[0], args[1:]...)
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+ cmd.Env = env
+ err := cmd.Run()
+ if exitErr, ok := err.(*exec.ExitError); ok {
+ os.Exit(exitErr.ExitCode())
+ } else if err == nil {
+ os.Exit(0)
+ }
+ return err
+}
diff --git a/go/tools/gopackagesdriver/BUILD.bazel b/go/tools/gopackagesdriver/BUILD.bazel
new file mode 100644
index 00000000..542b75ad
--- /dev/null
+++ b/go/tools/gopackagesdriver/BUILD.bazel
@@ -0,0 +1,39 @@
+load("//go:def.bzl", "go_binary", "go_library")
+load(":aspect.bzl", "bazel_supports_canonical_label_literals")
+
+go_library(
+ name = "gopackagesdriver_lib",
+ srcs = [
+ "bazel.go",
+ "bazel_json_builder.go",
+ "build_context.go",
+ "driver_request.go",
+ "flatpackage.go",
+ "json_packages_driver.go",
+ "main.go",
+ "packageregistry.go",
+ "utils.go",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/go/tools/gopackagesdriver",
+ visibility = ["//visibility:private"],
+)
+
+go_binary(
+ name = "gopackagesdriver",
+ embed = [":gopackagesdriver_lib"],
+ x_defs = {
+ # Determine the name of the rules_go repository as we need to specify it when invoking the
+ # aspect.
+ # If canonical label literals are supported, we can use a canonical label literal (starting
+ # with @@) to pass the repository_name() through repo mapping unchanged.
+ # If canonical label literals are not supported, then bzlmod is certainly not enabled and
+ # we can assume that the repository name is not affected by repo mappings.
+ # If run in the rules_go repo itself, repository_name() returns "@", which is equivalent to
+ # "@io_bazel_rules_go" since Bazel 6:
+ # https://github.com/bazelbuild/bazel/commit/7694cf75e6366b92e3905c2ad60234cda57627ee
+ # TODO: Once we drop support for Bazel 5, we can remove the feature detection logic and
+ # use "@" + repository_name().
+ "rulesGoRepositoryName": "@" + repository_name() if bazel_supports_canonical_label_literals() else repository_name(),
+ },
+ visibility = ["//visibility:public"],
+)
diff --git a/go/tools/gopackagesdriver/aspect.bzl b/go/tools/gopackagesdriver/aspect.bzl
new file mode 100644
index 00000000..36703c75
--- /dev/null
+++ b/go/tools/gopackagesdriver/aspect.bzl
@@ -0,0 +1,169 @@
+# Copyright 2021 The Bazel Go Rules Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go/private:providers.bzl",
+ "GoArchive",
+ "GoStdLib",
+)
+load(
+ "@bazel_skylib//lib:paths.bzl",
+ "paths",
+)
+
+GoPkgInfo = provider()
+
+DEPS_ATTRS = [
+ "deps",
+ "embed",
+]
+
+PROTO_COMPILER_ATTRS = [
+ "compiler",
+ "compilers",
+ "library",
+]
+
+def bazel_supports_canonical_label_literals():
+ return str(Label("//:bogus")).startswith("@@")
+
+def is_file_external(f):
+ return f.owner.workspace_root != ""
+
+def file_path(f):
+ prefix = "__BAZEL_WORKSPACE__"
+ if not f.is_source:
+ prefix = "__BAZEL_EXECROOT__"
+ elif is_file_external(f):
+ prefix = "__BAZEL_OUTPUT_BASE__"
+ return paths.join(prefix, f.path)
+
+def _go_archive_to_pkg(archive):
+ return struct(
+ ID = str(archive.data.label),
+ PkgPath = archive.data.importpath,
+ ExportFile = file_path(archive.data.export_file),
+ GoFiles = [
+ file_path(src)
+ for src in archive.data.orig_srcs
+ if src.path.endswith(".go")
+ ],
+ CompiledGoFiles = [
+ file_path(src)
+ for src in archive.data.srcs
+ if src.path.endswith(".go")
+ ],
+ OtherFiles = [
+ file_path(src)
+ for src in archive.data.orig_srcs
+ if not src.path.endswith(".go")
+ ],
+ Imports = {
+ pkg.data.importpath: str(pkg.data.label)
+ for pkg in archive.direct
+ },
+ )
+
+def make_pkg_json(ctx, name, pkg_info):
+ pkg_json_file = ctx.actions.declare_file(name + ".pkg.json")
+ ctx.actions.write(pkg_json_file, content = pkg_info.to_json())
+ return pkg_json_file
+
+def _go_pkg_info_aspect_impl(target, ctx):
+ # Fetch the stdlib JSON file from the inner most target
+ stdlib_json_file = None
+
+ transitive_json_files = []
+ transitive_export_files = []
+ transitive_compiled_go_files = []
+
+ for attr in DEPS_ATTRS + PROTO_COMPILER_ATTRS:
+ deps = getattr(ctx.rule.attr, attr, []) or []
+
+ # Some attrs are not iterable, ensure that deps is always iterable.
+ if type(deps) != type([]):
+ deps = [deps]
+
+ for dep in deps:
+ if GoPkgInfo in dep:
+ pkg_info = dep[GoPkgInfo]
+ transitive_json_files.append(pkg_info.pkg_json_files)
+ transitive_compiled_go_files.append(pkg_info.compiled_go_files)
+ transitive_export_files.append(pkg_info.export_files)
+
+ # Fetch the stdlib json from the first dependency
+ if not stdlib_json_file:
+ stdlib_json_file = pkg_info.stdlib_json_file
+
+ pkg_json_files = []
+ compiled_go_files = []
+ export_files = []
+
+ if GoArchive in target:
+ archive = target[GoArchive]
+ compiled_go_files.extend(archive.source.srcs)
+ export_files.append(archive.data.export_file)
+ pkg = _go_archive_to_pkg(archive)
+ pkg_json_files.append(make_pkg_json(ctx, archive.data.name, pkg))
+
+ if ctx.rule.kind == "go_test":
+ for dep_archive in archive.direct:
+ # find the archive containing the test sources
+ if archive.data.label == dep_archive.data.label:
+ pkg = _go_archive_to_pkg(dep_archive)
+ pkg_json_files.append(make_pkg_json(ctx, dep_archive.data.name, pkg))
+ compiled_go_files.extend(dep_archive.source.srcs)
+ export_files.append(dep_archive.data.export_file)
+ break
+
+ # If there was no stdlib json in any dependencies, fetch it from the
+ # current go_ node.
+ if not stdlib_json_file:
+ stdlib_json_file = ctx.attr._go_stdlib[GoStdLib]._list_json
+
+ pkg_info = GoPkgInfo(
+ stdlib_json_file = stdlib_json_file,
+ pkg_json_files = depset(
+ direct = pkg_json_files,
+ transitive = transitive_json_files,
+ ),
+ compiled_go_files = depset(
+ direct = compiled_go_files,
+ transitive = transitive_compiled_go_files,
+ ),
+ export_files = depset(
+ direct = export_files,
+ transitive = transitive_export_files,
+ ),
+ )
+
+ return [
+ pkg_info,
+ OutputGroupInfo(
+ go_pkg_driver_json_file = pkg_info.pkg_json_files,
+ go_pkg_driver_srcs = pkg_info.compiled_go_files,
+ go_pkg_driver_export_file = pkg_info.export_files,
+ go_pkg_driver_stdlib_json_file = depset([pkg_info.stdlib_json_file] if pkg_info.stdlib_json_file else []),
+ ),
+ ]
+
+go_pkg_info_aspect = aspect(
+ implementation = _go_pkg_info_aspect_impl,
+ attr_aspects = DEPS_ATTRS + PROTO_COMPILER_ATTRS,
+ attrs = {
+ "_go_stdlib": attr.label(
+ default = "//:stdlib",
+ ),
+ },
+)
diff --git a/go/tools/gopackagesdriver/bazel.go b/go/tools/gopackagesdriver/bazel.go
new file mode 100644
index 00000000..08da745d
--- /dev/null
+++ b/go/tools/gopackagesdriver/bazel.go
@@ -0,0 +1,164 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "bufio"
+ "bytes"
+ "context"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "io/ioutil"
+ "net/url"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strings"
+)
+
+const (
+ toolTag = "gopackagesdriver"
+)
+
+type Bazel struct {
+ bazelBin string
+ workspaceRoot string
+ bazelStartupFlags []string
+ info map[string]string
+}
+
+// Minimal BEP structs to access the build outputs
+type BEPNamedSet struct {
+ NamedSetOfFiles *struct {
+ Files []struct {
+ Name string `json:"name"`
+ URI string `json:"uri"`
+ } `json:"files"`
+ } `json:"namedSetOfFiles"`
+}
+
+func NewBazel(ctx context.Context, bazelBin, workspaceRoot string, bazelStartupFlags []string) (*Bazel, error) {
+ b := &Bazel{
+ bazelBin: bazelBin,
+ workspaceRoot: workspaceRoot,
+ bazelStartupFlags: bazelStartupFlags,
+ }
+ if err := b.fillInfo(ctx); err != nil {
+ return nil, fmt.Errorf("unable to query bazel info: %w", err)
+ }
+ return b, nil
+}
+
+func (b *Bazel) fillInfo(ctx context.Context) error {
+ b.info = map[string]string{}
+ output, err := b.run(ctx, "info")
+ if err != nil {
+ return err
+ }
+ scanner := bufio.NewScanner(bytes.NewBufferString(output))
+ for scanner.Scan() {
+ parts := strings.SplitN(strings.TrimSpace(scanner.Text()), ":", 2)
+ b.info[strings.TrimSpace(parts[0])] = strings.TrimSpace(parts[1])
+ }
+ return nil
+}
+
+func (b *Bazel) run(ctx context.Context, command string, args ...string) (string, error) {
+ defaultArgs := []string{
+ command,
+ "--tool_tag=" + toolTag,
+ "--ui_actions_shown=0",
+ }
+ cmd := exec.CommandContext(ctx, b.bazelBin, concatStringsArrays(b.bazelStartupFlags, defaultArgs, args)...)
+ fmt.Fprintln(os.Stderr, "Running:", cmd.Args)
+ cmd.Dir = b.WorkspaceRoot()
+ cmd.Stderr = os.Stderr
+ output, err := cmd.Output()
+ return string(output), err
+}
+
+func (b *Bazel) Build(ctx context.Context, args ...string) ([]string, error) {
+ jsonFile, err := ioutil.TempFile("", "gopackagesdriver_bep_")
+ if err != nil {
+ return nil, fmt.Errorf("unable to create BEP JSON file: %w", err)
+ }
+ defer func() {
+ jsonFile.Close()
+ os.Remove(jsonFile.Name())
+ }()
+
+ args = append([]string{
+ "--show_result=0",
+ "--build_event_json_file=" + jsonFile.Name(),
+ "--build_event_json_file_path_conversion=no",
+ }, args...)
+ if _, err := b.run(ctx, "build", args...); err != nil {
+ // Ignore a regular build failure to get partial data.
+ // See https://docs.bazel.build/versions/main/guide.html#what-exit-code-will-i-get on
+ // exit codes.
+ var exerr *exec.ExitError
+ if !errors.As(err, &exerr) || exerr.ExitCode() != 1 {
+ return nil, fmt.Errorf("bazel build failed: %w", err)
+ }
+ }
+
+ files := make([]string, 0)
+ decoder := json.NewDecoder(jsonFile)
+ for decoder.More() {
+ var namedSet BEPNamedSet
+ if err := decoder.Decode(&namedSet); err != nil {
+ return nil, fmt.Errorf("unable to decode %s: %w", jsonFile.Name(), err)
+ }
+
+ if namedSet.NamedSetOfFiles != nil {
+ for _, f := range namedSet.NamedSetOfFiles.Files {
+ fileUrl, err := url.Parse(f.URI)
+ if err != nil {
+ return nil, fmt.Errorf("unable to parse file URI: %w", err)
+ }
+ files = append(files, filepath.FromSlash(fileUrl.Path))
+ }
+ }
+ }
+
+ return files, nil
+}
+
+func (b *Bazel) Query(ctx context.Context, args ...string) ([]string, error) {
+ output, err := b.run(ctx, "query", args...)
+ if err != nil {
+ return nil, fmt.Errorf("bazel query failed: %w", err)
+ }
+
+ trimmedOutput := strings.TrimSpace(output)
+ if len(trimmedOutput) == 0 {
+ return nil, nil
+ }
+
+ return strings.Split(trimmedOutput, "\n"), nil
+}
+
+func (b *Bazel) WorkspaceRoot() string {
+ return b.workspaceRoot
+}
+
+func (b *Bazel) ExecutionRoot() string {
+ return b.info["execution_root"]
+}
+
+func (b *Bazel) OutputBase() string {
+ return b.info["output_base"]
+}
diff --git a/go/tools/gopackagesdriver/bazel_json_builder.go b/go/tools/gopackagesdriver/bazel_json_builder.go
new file mode 100644
index 00000000..163be082
--- /dev/null
+++ b/go/tools/gopackagesdriver/bazel_json_builder.go
@@ -0,0 +1,250 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "bufio"
+ "context"
+ "errors"
+ "fmt"
+ "io/ioutil"
+ "os"
+ "path"
+ "path/filepath"
+ "regexp"
+ "strings"
+)
+
+type BazelJSONBuilder struct {
+ bazel *Bazel
+ includeTests bool
+}
+
+var RulesGoStdlibLabel = rulesGoRepositoryName + "//:stdlib"
+
+var _defaultKinds = []string{"go_library", "go_test", "go_binary"}
+
+var externalRe = regexp.MustCompile(".*\\/external\\/([^\\/]+)(\\/(.*))?\\/([^\\/]+.go)")
+
+func (b *BazelJSONBuilder) fileQuery(filename string) string {
+ label := filename
+
+ if filepath.IsAbs(filename) {
+ label, _ = filepath.Rel(b.bazel.WorkspaceRoot(), filename)
+ } else if strings.HasPrefix(filename, "./") {
+ label = strings.TrimPrefix(filename, "./")
+ }
+
+ if matches := externalRe.FindStringSubmatch(filename); len(matches) == 5 {
+ // if filepath is for a third party lib, we need to know, what external
+ // library this file is part of.
+ matches = append(matches[:2], matches[3:]...)
+ label = fmt.Sprintf("@%s//%s", matches[1], strings.Join(matches[2:], ":"))
+ }
+
+ relToBin, err := filepath.Rel(b.bazel.info["output_path"], filename)
+ if err == nil && !strings.HasPrefix(relToBin, "../") {
+ parts := strings.SplitN(relToBin, string(filepath.Separator), 3)
+ relToBin = parts[2]
+ // We've effectively converted filename from bazel-bin/some/path.go to some/path.go;
+ // Check if a BUILD.bazel files exists under this dir, if not walk up and repeat.
+ relToBin = filepath.Dir(relToBin)
+ _, err = os.Stat(filepath.Join(b.bazel.WorkspaceRoot(), relToBin, "BUILD.bazel"))
+ for errors.Is(err, os.ErrNotExist) && relToBin != "." {
+ relToBin = filepath.Dir(relToBin)
+ _, err = os.Stat(filepath.Join(b.bazel.WorkspaceRoot(), relToBin, "BUILD.bazel"))
+ }
+
+ if err == nil {
+ // return package path found and build all targets (codegen doesn't fall under go_library)
+ // Otherwise fallback to default
+ if relToBin == "." {
+ relToBin = ""
+ }
+ label = fmt.Sprintf("//%s:all", relToBin)
+ additionalKinds = append(additionalKinds, "go_.*")
+ }
+ }
+
+ kinds := append(_defaultKinds, additionalKinds...)
+ return fmt.Sprintf(`kind("%s", same_pkg_direct_rdeps("%s"))`, strings.Join(kinds, "|"), label)
+}
+
+func (b *BazelJSONBuilder) getKind() string {
+ kinds := []string{"go_library"}
+ if b.includeTests {
+ kinds = append(kinds, "go_test")
+ }
+
+ return strings.Join(kinds, "|")
+}
+
+func (b *BazelJSONBuilder) localQuery(request string) string {
+ request = path.Clean(request)
+ if filepath.IsAbs(request) {
+ if relPath, err := filepath.Rel(workspaceRoot, request); err == nil {
+ request = relPath
+ }
+ }
+
+ if !strings.HasSuffix(request, "...") {
+ request = fmt.Sprintf("%s:*", request)
+ }
+
+ return fmt.Sprintf(`kind("%s", %s)`, b.getKind(), request)
+}
+
+func (b *BazelJSONBuilder) packageQuery(importPath string) string {
+ if strings.HasSuffix(importPath, "/...") {
+ importPath = fmt.Sprintf(`^%s(/.+)?$`, strings.TrimSuffix(importPath, "/..."))
+ }
+
+ return fmt.Sprintf(
+ `kind("%s", attr(importpath, "%s", deps(%s)))`,
+ b.getKind(),
+ importPath,
+ bazelQueryScope)
+}
+
+func (b *BazelJSONBuilder) queryFromRequests(requests ...string) string {
+ ret := make([]string, 0, len(requests))
+ for _, request := range requests {
+ result := ""
+ if strings.HasSuffix(request, ".go") {
+ f := strings.TrimPrefix(request, "file=")
+ result = b.fileQuery(f)
+ } else if isLocalPattern(request) {
+ result = b.localQuery(request)
+ } else if request == "builtin" || request == "std" {
+ result = fmt.Sprintf(RulesGoStdlibLabel)
+ } else if bazelQueryScope != "" {
+ result = b.packageQuery(request)
+ }
+
+ if result != "" {
+ ret = append(ret, result)
+ }
+ }
+ if len(ret) == 0 {
+ return RulesGoStdlibLabel
+ }
+ return strings.Join(ret, " union ")
+}
+
+func NewBazelJSONBuilder(bazel *Bazel, includeTests bool) (*BazelJSONBuilder, error) {
+ return &BazelJSONBuilder{
+ bazel: bazel,
+ includeTests: includeTests,
+ }, nil
+}
+
+func (b *BazelJSONBuilder) outputGroupsForMode(mode LoadMode) string {
+ og := "go_pkg_driver_json_file,go_pkg_driver_stdlib_json_file,go_pkg_driver_srcs"
+ if mode&NeedExportsFile != 0 {
+ og += ",go_pkg_driver_export_file"
+ }
+ return og
+}
+
+func (b *BazelJSONBuilder) query(ctx context.Context, query string) ([]string, error) {
+ queryArgs := concatStringsArrays(bazelQueryFlags, []string{
+ "--ui_event_filters=-info,-stderr",
+ "--noshow_progress",
+ "--order_output=no",
+ "--output=label",
+ "--nodep_deps",
+ "--noimplicit_deps",
+ "--notool_deps",
+ query,
+ })
+ labels, err := b.bazel.Query(ctx, queryArgs...)
+ if err != nil {
+ return nil, fmt.Errorf("unable to query: %w", err)
+ }
+
+ return labels, nil
+}
+
+func (b *BazelJSONBuilder) Labels(ctx context.Context, requests []string) ([]string, error) {
+ labels, err := b.query(ctx, b.queryFromRequests(requests...))
+ if err != nil {
+ return nil, fmt.Errorf("query failed: %w", err)
+ }
+
+ if len(labels) == 0 {
+ return nil, fmt.Errorf("found no labels matching the requests")
+ }
+
+ return labels, nil
+}
+
+func (b *BazelJSONBuilder) Build(ctx context.Context, labels []string, mode LoadMode) ([]string, error) {
+ aspects := append(additionalAspects, goDefaultAspect)
+
+ buildArgs := concatStringsArrays([]string{
+ "--experimental_convenience_symlinks=ignore",
+ "--ui_event_filters=-info,-stderr",
+ "--noshow_progress",
+ "--aspects=" + strings.Join(aspects, ","),
+ "--output_groups=" + b.outputGroupsForMode(mode),
+ "--keep_going", // Build all possible packages
+ }, bazelBuildFlags)
+
+ if len(labels) < 100 {
+ buildArgs = append(buildArgs, labels...)
+ } else {
+ // To avoid hitting MAX_ARGS length, write labels to a file and use `--target_pattern_file`
+ targetsFile, err := ioutil.TempFile("", "gopackagesdriver_targets_")
+ if err != nil {
+ return nil, fmt.Errorf("unable to create target pattern file: %w", err)
+ }
+ writer := bufio.NewWriter(targetsFile)
+ defer writer.Flush()
+ for _, l := range labels {
+ writer.WriteString(l + "\n")
+ }
+ if err := writer.Flush(); err != nil {
+ return nil, fmt.Errorf("unable to flush data to target pattern file: %w", err)
+ }
+ defer func() {
+ targetsFile.Close()
+ os.Remove(targetsFile.Name())
+ }()
+
+ buildArgs = append(buildArgs, "--target_pattern_file="+targetsFile.Name())
+ }
+ files, err := b.bazel.Build(ctx, buildArgs...)
+ if err != nil {
+ return nil, fmt.Errorf("unable to bazel build %v: %w", buildArgs, err)
+ }
+
+ ret := []string{}
+ for _, f := range files {
+ if strings.HasSuffix(f, ".pkg.json") {
+ ret = append(ret, f)
+ }
+ }
+
+ return ret, nil
+}
+
+func (b *BazelJSONBuilder) PathResolver() PathResolverFunc {
+ return func(p string) string {
+ p = strings.Replace(p, "__BAZEL_EXECROOT__", b.bazel.ExecutionRoot(), 1)
+ p = strings.Replace(p, "__BAZEL_WORKSPACE__", b.bazel.WorkspaceRoot(), 1)
+ p = strings.Replace(p, "__BAZEL_OUTPUT_BASE__", b.bazel.OutputBase(), 1)
+ return p
+ }
+}
diff --git a/go/tools/gopackagesdriver/build_context.go b/go/tools/gopackagesdriver/build_context.go
new file mode 100644
index 00000000..dac786b9
--- /dev/null
+++ b/go/tools/gopackagesdriver/build_context.go
@@ -0,0 +1,34 @@
+package main
+
+import (
+ "go/build"
+ "path/filepath"
+ "strings"
+)
+
+var buildContext = makeBuildContext()
+
+func makeBuildContext() *build.Context {
+ bctx := build.Default
+ bctx.BuildTags = strings.Split(getenvDefault("GOTAGS", ""), ",")
+
+ return &bctx
+}
+
+func filterSourceFilesForTags(files []string) []string {
+ ret := make([]string, 0, len(files))
+
+ for _, f := range files {
+ dir, filename := filepath.Split(f)
+ ext := filepath.Ext(f)
+
+ match, _ := buildContext.MatchFile(dir, filename)
+ // MatchFile filters out anything without a file extension. In the
+ // case of CompiledGoFiles (in particular gco processed files from
+ // the cache), we want them.
+ if match || ext == "" {
+ ret = append(ret, f)
+ }
+ }
+ return ret
+}
diff --git a/go/tools/gopackagesdriver/driver_request.go b/go/tools/gopackagesdriver/driver_request.go
new file mode 100644
index 00000000..db572dcc
--- /dev/null
+++ b/go/tools/gopackagesdriver/driver_request.go
@@ -0,0 +1,91 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "encoding/json"
+ "fmt"
+ "io"
+)
+
+// From https://pkg.go.dev/golang.org/x/tools/go/packages#LoadMode
+type LoadMode int
+
+// Only NeedExportsFile is needed in our case
+const (
+ // NeedName adds Name and PkgPath.
+ NeedName LoadMode = 1 << iota
+
+ // NeedFiles adds GoFiles and OtherFiles.
+ NeedFiles
+
+ // NeedCompiledGoFiles adds CompiledGoFiles.
+ NeedCompiledGoFiles
+
+ // NeedImports adds Imports. If NeedDeps is not set, the Imports field will contain
+ // "placeholder" Packages with only the ID set.
+ NeedImports
+
+ // NeedDeps adds the fields requested by the LoadMode in the packages in Imports.
+ NeedDeps
+
+ // NeedExportsFile adds ExportFile.
+ NeedExportFile
+
+ // NeedTypes adds Types, Fset, and IllTyped.
+ NeedTypes
+
+ // NeedSyntax adds Syntax.
+ NeedSyntax
+
+ // NeedTypesInfo adds TypesInfo.
+ NeedTypesInfo
+
+ // NeedTypesSizes adds TypesSizes.
+ NeedTypesSizes
+
+ // typecheckCgo enables full support for type checking cgo. Requires Go 1.15+.
+ // Modifies CompiledGoFiles and Types, and has no effect on its own.
+ typecheckCgo
+
+ // NeedModule adds Module.
+ NeedModule
+)
+
+// Deprecated: NeedExportsFile is a historical misspelling of NeedExportFile.
+const NeedExportsFile = NeedExportFile
+
+// From https://github.com/golang/tools/blob/v0.1.0/go/packages/external.go#L32
+// Most fields are disabled since there is no need for them
+type DriverRequest struct {
+ Mode LoadMode `json:"mode"`
+ // Env specifies the environment the underlying build system should be run in.
+ // Env []string `json:"env"`
+ // BuildFlags are flags that should be passed to the underlying build system.
+ // BuildFlags []string `json:"build_flags"`
+ // Tests specifies whether the patterns should also return test packages.
+ Tests bool `json:"tests"`
+ // Overlay maps file paths (relative to the driver's working directory) to the byte contents
+ // of overlay files.
+ // Overlay map[string][]byte `json:"overlay"`
+}
+
+func ReadDriverRequest(r io.Reader) (*DriverRequest, error) {
+ req := &DriverRequest{}
+ if err := json.NewDecoder(r).Decode(&req); err != nil {
+ return nil, fmt.Errorf("unable to decode driver request: %w", err)
+ }
+ return req, nil
+}
diff --git a/go/tools/gopackagesdriver/flatpackage.go b/go/tools/gopackagesdriver/flatpackage.go
new file mode 100644
index 00000000..9c22132a
--- /dev/null
+++ b/go/tools/gopackagesdriver/flatpackage.go
@@ -0,0 +1,159 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "encoding/json"
+ "fmt"
+ "go/parser"
+ "go/token"
+ "os"
+ "strconv"
+ "strings"
+)
+
+type ResolvePkgFunc func(importPath string) string
+
+// Copy and pasted from golang.org/x/tools/go/packages
+type FlatPackagesError struct {
+ Pos string // "file:line:col" or "file:line" or "" or "-"
+ Msg string
+ Kind FlatPackagesErrorKind
+}
+
+type FlatPackagesErrorKind int
+
+const (
+ UnknownError FlatPackagesErrorKind = iota
+ ListError
+ ParseError
+ TypeError
+)
+
+func (err FlatPackagesError) Error() string {
+ pos := err.Pos
+ if pos == "" {
+ pos = "-" // like token.Position{}.String()
+ }
+ return pos + ": " + err.Msg
+}
+
+// FlatPackage is the JSON form of Package
+// It drops all the type and syntax fields, and transforms the Imports
+type FlatPackage struct {
+ ID string
+ Name string `json:",omitempty"`
+ PkgPath string `json:",omitempty"`
+ Errors []FlatPackagesError `json:",omitempty"`
+ GoFiles []string `json:",omitempty"`
+ CompiledGoFiles []string `json:",omitempty"`
+ OtherFiles []string `json:",omitempty"`
+ ExportFile string `json:",omitempty"`
+ Imports map[string]string `json:",omitempty"`
+ Standard bool `json:",omitempty"`
+}
+
+type (
+ PackageFunc func(pkg *FlatPackage)
+ PathResolverFunc func(path string) string
+)
+
+func resolvePathsInPlace(prf PathResolverFunc, paths []string) {
+ for i, path := range paths {
+ paths[i] = prf(path)
+ }
+}
+
+func WalkFlatPackagesFromJSON(jsonFile string, onPkg PackageFunc) error {
+ f, err := os.Open(jsonFile)
+ if err != nil {
+ return fmt.Errorf("unable to open package JSON file: %w", err)
+ }
+ defer f.Close()
+
+ decoder := json.NewDecoder(f)
+ for decoder.More() {
+ pkg := &FlatPackage{}
+ if err := decoder.Decode(&pkg); err != nil {
+ return fmt.Errorf("unable to decode package in %s: %w", f.Name(), err)
+ }
+
+ onPkg(pkg)
+ }
+ return nil
+}
+
+func (fp *FlatPackage) ResolvePaths(prf PathResolverFunc) error {
+ resolvePathsInPlace(prf, fp.CompiledGoFiles)
+ resolvePathsInPlace(prf, fp.GoFiles)
+ resolvePathsInPlace(prf, fp.OtherFiles)
+ fp.ExportFile = prf(fp.ExportFile)
+ return nil
+}
+
+// FilterFilesForBuildTags filters the source files given the current build
+// tags.
+func (fp *FlatPackage) FilterFilesForBuildTags() {
+ fp.GoFiles = filterSourceFilesForTags(fp.GoFiles)
+ fp.CompiledGoFiles = filterSourceFilesForTags(fp.CompiledGoFiles)
+}
+
+func (fp *FlatPackage) IsStdlib() bool {
+ return fp.Standard
+}
+
+func (fp *FlatPackage) ResolveImports(resolve ResolvePkgFunc) error {
+ // Stdlib packages are already complete import wise
+ if fp.IsStdlib() {
+ return nil
+ }
+
+ fset := token.NewFileSet()
+
+ for _, file := range fp.CompiledGoFiles {
+ f, err := parser.ParseFile(fset, file, nil, parser.ImportsOnly)
+ if err != nil {
+ return err
+ }
+ // If the name is not provided, fetch it from the sources
+ if fp.Name == "" {
+ fp.Name = f.Name.Name
+ }
+
+ for _, rawImport := range f.Imports {
+ imp, err := strconv.Unquote(rawImport.Path.Value)
+ if err != nil {
+ continue
+ }
+ // We don't handle CGo for now
+ if imp == "C" {
+ continue
+ }
+ if _, ok := fp.Imports[imp]; ok {
+ continue
+ }
+
+ if pkgID := resolve(imp); pkgID != "" {
+ fp.Imports[imp] = pkgID
+ }
+ }
+ }
+
+ return nil
+}
+
+func (fp *FlatPackage) IsRoot() bool {
+ return strings.HasPrefix(fp.ID, "//")
+}
diff --git a/go/tools/gopackagesdriver/json_packages_driver.go b/go/tools/gopackagesdriver/json_packages_driver.go
new file mode 100644
index 00000000..9bbf3408
--- /dev/null
+++ b/go/tools/gopackagesdriver/json_packages_driver.go
@@ -0,0 +1,59 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "fmt"
+ "go/types"
+)
+
+type JSONPackagesDriver struct {
+ registry *PackageRegistry
+}
+
+func NewJSONPackagesDriver(jsonFiles []string, prf PathResolverFunc) (*JSONPackagesDriver, error) {
+ jpd := &JSONPackagesDriver{
+ registry: NewPackageRegistry(),
+ }
+
+ for _, f := range jsonFiles {
+ if err := WalkFlatPackagesFromJSON(f, func(pkg *FlatPackage) {
+ jpd.registry.Add(pkg)
+ }); err != nil {
+ return nil, fmt.Errorf("unable to walk json: %w", err)
+ }
+ }
+
+ if err := jpd.registry.ResolvePaths(prf); err != nil {
+ return nil, fmt.Errorf("unable to resolve paths: %w", err)
+ }
+
+ if err := jpd.registry.ResolveImports(); err != nil {
+ return nil, fmt.Errorf("unable to resolve paths: %w", err)
+ }
+
+ return jpd, nil
+}
+
+func (b *JSONPackagesDriver) GetResponse(labels []string) *driverResponse {
+ rootPkgs, packages := b.registry.Match(labels)
+
+ return &driverResponse{
+ NotHandled: false,
+ Sizes: types.SizesFor("gc", "amd64").(*types.StdSizes),
+ Roots: rootPkgs,
+ Packages: packages,
+ }
+}
diff --git a/go/tools/gopackagesdriver/main.go b/go/tools/gopackagesdriver/main.go
new file mode 100644
index 00000000..fea2d2c1
--- /dev/null
+++ b/go/tools/gopackagesdriver/main.go
@@ -0,0 +1,126 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "go/types"
+ "os"
+ "strings"
+)
+
+type driverResponse struct {
+ // NotHandled is returned if the request can't be handled by the current
+ // driver. If an external driver returns a response with NotHandled, the
+ // rest of the driverResponse is ignored, and go/packages will fallback
+ // to the next driver. If go/packages is extended in the future to support
+ // lists of multiple drivers, go/packages will fall back to the next driver.
+ NotHandled bool
+
+ // Sizes, if not nil, is the types.Sizes to use when type checking.
+ Sizes *types.StdSizes
+
+ // Roots is the set of package IDs that make up the root packages.
+ // We have to encode this separately because when we encode a single package
+ // we cannot know if it is one of the roots as that requires knowledge of the
+ // graph it is part of.
+ Roots []string `json:",omitempty"`
+
+ // Packages is the full set of packages in the graph.
+ // The packages are not connected into a graph.
+ // The Imports if populated will be stubs that only have their ID set.
+ // Imports will be connected and then type and syntax information added in a
+ // later pass (see refine).
+ Packages []*FlatPackage
+}
+
+var (
+ // Injected via x_defs.
+
+ rulesGoRepositoryName string
+ goDefaultAspect = rulesGoRepositoryName + "//go/tools/gopackagesdriver:aspect.bzl%go_pkg_info_aspect"
+ bazelBin = getenvDefault("GOPACKAGESDRIVER_BAZEL", "bazel")
+ bazelStartupFlags = strings.Fields(os.Getenv("GOPACKAGESDRIVER_BAZEL_FLAGS"))
+ bazelQueryFlags = strings.Fields(os.Getenv("GOPACKAGESDRIVER_BAZEL_QUERY_FLAGS"))
+ bazelQueryScope = getenvDefault("GOPACKAGESDRIVER_BAZEL_QUERY_SCOPE", "")
+ bazelBuildFlags = strings.Fields(os.Getenv("GOPACKAGESDRIVER_BAZEL_BUILD_FLAGS"))
+ workspaceRoot = os.Getenv("BUILD_WORKSPACE_DIRECTORY")
+ additionalAspects = strings.Fields(os.Getenv("GOPACKAGESDRIVER_BAZEL_ADDTL_ASPECTS"))
+ additionalKinds = strings.Fields(os.Getenv("GOPACKAGESDRIVER_BAZEL_KINDS"))
+ emptyResponse = &driverResponse{
+ NotHandled: true,
+ Sizes: types.SizesFor("gc", "amd64").(*types.StdSizes),
+ Roots: []string{},
+ Packages: []*FlatPackage{},
+ }
+)
+
+func run() (*driverResponse, error) {
+ ctx, cancel := signalContext(context.Background(), os.Interrupt)
+ defer cancel()
+
+ queries := os.Args[1:]
+
+ request, err := ReadDriverRequest(os.Stdin)
+ if err != nil {
+ return emptyResponse, fmt.Errorf("unable to read request: %w", err)
+ }
+
+ bazel, err := NewBazel(ctx, bazelBin, workspaceRoot, bazelStartupFlags)
+ if err != nil {
+ return emptyResponse, fmt.Errorf("unable to create bazel instance: %w", err)
+ }
+
+ bazelJsonBuilder, err := NewBazelJSONBuilder(bazel, request.Tests)
+ if err != nil {
+ return emptyResponse, fmt.Errorf("unable to build JSON files: %w", err)
+ }
+
+ labels, err := bazelJsonBuilder.Labels(ctx, queries)
+ if err != nil {
+ return emptyResponse, fmt.Errorf("unable to lookup package: %w", err)
+ }
+
+ jsonFiles, err := bazelJsonBuilder.Build(ctx, labels, request.Mode)
+ if err != nil {
+ return emptyResponse, fmt.Errorf("unable to build JSON files: %w", err)
+ }
+
+ driver, err := NewJSONPackagesDriver(jsonFiles, bazelJsonBuilder.PathResolver())
+ if err != nil {
+ return emptyResponse, fmt.Errorf("unable to load JSON files: %w", err)
+ }
+
+ // Note: we are returning all files required to build a specific package.
+ // For file queries (`file=`), this means that the CompiledGoFiles will
+ // include more than the only file being specified.
+ return driver.GetResponse(labels), nil
+}
+
+func main() {
+ response, err := run()
+ if err := json.NewEncoder(os.Stdout).Encode(response); err != nil {
+ fmt.Fprintf(os.Stderr, "unable to encode response: %v", err)
+ }
+ if err != nil {
+ fmt.Fprintf(os.Stderr, "error: %v", err)
+ // gopls will check the packages driver exit code, and if there is an
+ // error, it will fall back to go list. Obviously we don't want that,
+ // so force a 0 exit code.
+ os.Exit(0)
+ }
+}
diff --git a/go/tools/gopackagesdriver/packageregistry.go b/go/tools/gopackagesdriver/packageregistry.go
new file mode 100644
index 00000000..05e620d5
--- /dev/null
+++ b/go/tools/gopackagesdriver/packageregistry.go
@@ -0,0 +1,111 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "fmt"
+ "strings"
+)
+
+type PackageRegistry struct {
+ packagesByID map[string]*FlatPackage
+ stdlib map[string]string
+}
+
+func NewPackageRegistry(pkgs ...*FlatPackage) *PackageRegistry {
+ pr := &PackageRegistry{
+ packagesByID: map[string]*FlatPackage{},
+ stdlib: map[string]string{},
+ }
+ pr.Add(pkgs...)
+ return pr
+}
+
+func (pr *PackageRegistry) Add(pkgs ...*FlatPackage) *PackageRegistry {
+ for _, pkg := range pkgs {
+ pr.packagesByID[pkg.ID] = pkg
+
+ if pkg.IsStdlib() {
+ pr.stdlib[pkg.PkgPath] = pkg.ID
+ }
+ }
+ return pr
+}
+
+func (pr *PackageRegistry) ResolvePaths(prf PathResolverFunc) error {
+ for _, pkg := range pr.packagesByID {
+ pkg.ResolvePaths(prf)
+ pkg.FilterFilesForBuildTags()
+ }
+ return nil
+}
+
+// ResolveImports adds stdlib imports to packages. This is required because
+// stdlib packages are not part of the JSON file exports as bazel is unaware of
+// them.
+func (pr *PackageRegistry) ResolveImports() error {
+ resolve := func(importPath string) string {
+ if pkgID, ok := pr.stdlib[importPath]; ok {
+ return pkgID
+ }
+
+ return ""
+ }
+
+ for _, pkg := range pr.packagesByID {
+ if err := pkg.ResolveImports(resolve); err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
+
+func (pr *PackageRegistry) walk(acc map[string]*FlatPackage, root string) {
+ pkg := pr.packagesByID[root]
+
+ acc[pkg.ID] = pkg
+ for _, pkgID := range pkg.Imports {
+ if _, ok := acc[pkgID]; !ok {
+ pr.walk(acc, pkgID)
+ }
+ }
+}
+
+func (pr *PackageRegistry) Match(labels []string) ([]string, []*FlatPackage) {
+ roots := map[string]struct{}{}
+
+ for _, label := range labels {
+ if !strings.HasPrefix(label, "@") {
+ label = fmt.Sprintf("@%s", label)
+ }
+
+ roots[label] = struct{}{}
+ }
+
+ walkedPackages := map[string]*FlatPackage{}
+ retRoots := make([]string, 0, len(roots))
+ for rootPkg := range roots {
+ retRoots = append(retRoots, rootPkg)
+ pr.walk(walkedPackages, rootPkg)
+ }
+
+ retPkgs := make([]*FlatPackage, 0, len(walkedPackages))
+ for _, pkg := range walkedPackages {
+ retPkgs = append(retPkgs, pkg)
+ }
+
+ return retRoots, retPkgs
+}
diff --git a/go/tools/gopackagesdriver/utils.go b/go/tools/gopackagesdriver/utils.go
new file mode 100644
index 00000000..d5524fdd
--- /dev/null
+++ b/go/tools/gopackagesdriver/utils.go
@@ -0,0 +1,77 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "context"
+ "fmt"
+ "go/build"
+ "os"
+ "os/signal"
+ "path"
+ "path/filepath"
+)
+
+func getenvDefault(key, defaultValue string) string {
+ if v, ok := os.LookupEnv(key); ok {
+ return v
+ }
+ return defaultValue
+}
+
+func concatStringsArrays(values ...[]string) []string {
+ ret := []string{}
+ for _, v := range values {
+ ret = append(ret, v...)
+ }
+ return ret
+}
+
+func ensureAbsolutePathFromWorkspace(path string) string {
+ if filepath.IsAbs(path) {
+ return path
+ }
+ return filepath.Join(workspaceRoot, path)
+}
+
+func signalContext(parentCtx context.Context, signals ...os.Signal) (ctx context.Context, stop context.CancelFunc) {
+ ctx, cancel := context.WithCancel(parentCtx)
+ ch := make(chan os.Signal, 1)
+ go func() {
+ select {
+ case <-ch:
+ cancel()
+ case <-ctx.Done():
+ }
+ }()
+ signal.Notify(ch, signals...)
+
+ return ctx, cancel
+}
+
+func isLocalPattern(pattern string) bool {
+ return build.IsLocalImport(pattern) || filepath.IsAbs(pattern)
+}
+
+func packageID(pattern string) string {
+ pattern = path.Clean(pattern)
+ if filepath.IsAbs(pattern) {
+ if relPath, err := filepath.Rel(workspaceRoot, pattern); err == nil {
+ pattern = relPath
+ }
+ }
+
+ return fmt.Sprintf("//%s", pattern)
+}
diff --git a/go/tools/internal/stdlib_tags/BUILD.bazel b/go/tools/internal/stdlib_tags/BUILD.bazel
new file mode 100644
index 00000000..37b8f2a4
--- /dev/null
+++ b/go/tools/internal/stdlib_tags/BUILD.bazel
@@ -0,0 +1,14 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+
+go_library(
+ name = "stdlib_tags_lib",
+ srcs = ["stdlib_tags.go"],
+ importpath = "github.com/bazelbuild/rules_go/go/tools/internal/stdlib_tags",
+ visibility = ["//visibility:private"],
+)
+
+go_binary(
+ name = "stdlib_tags",
+ embed = [":stdlib_tags_lib"],
+ visibility = ["//go/tools:__subpackages__"],
+)
diff --git a/go/tools/internal/stdlib_tags/stdlib_tags.go b/go/tools/internal/stdlib_tags/stdlib_tags.go
new file mode 100644
index 00000000..8bd507af
--- /dev/null
+++ b/go/tools/internal/stdlib_tags/stdlib_tags.go
@@ -0,0 +1,174 @@
+package main
+
+import (
+ "bufio"
+ "fmt"
+ "go/build/constraint"
+ "log"
+ "os"
+ "path/filepath"
+ "regexp"
+ "sort"
+ "strings"
+)
+
+var goVersionRegex = regexp.MustCompile(`^go1.(\d+)$`)
+
+// Used to update the list of tags affecting the standard library kept in
+// transitions.bzl.
+func main() {
+ if len(os.Args) < 2 {
+ log.Fatal("usage: stdlib_tags <go SDK src directory>...")
+ }
+
+ filteredTags, err := extractBuildTags(os.Args[1:]...)
+ if err != nil {
+ log.Fatal(err.Error())
+ }
+
+ fmt.Printf("_TAG_AFFECTS_STDLIB = {\n")
+ for _, tag := range filteredTags {
+ fmt.Printf(" %q: None,\n", tag)
+ }
+ fmt.Printf("}\n")
+}
+
+func extractBuildTags(sdkPaths ...string) ([]string, error) {
+ tags := make(map[string]struct{})
+ for _, dir := range sdkPaths {
+ err := filepath.WalkDir(dir, func(path string, d os.DirEntry, err error) error {
+ if d.IsDir() {
+ if d.Name() == "testdata" {
+ return filepath.SkipDir
+ }
+ return nil
+ }
+ if filepath.Ext(path) != ".go" {
+ return nil
+ }
+ if strings.HasSuffix(filepath.Base(path), "_test.go") {
+ return nil
+ }
+ return walkFile(path, tags)
+ })
+ if err != nil {
+ return nil, fmt.Errorf("%s: %w", dir, err)
+ }
+ }
+
+ filteredTags := make([]string, 0, len(tags))
+ for tag := range tags {
+ if !shouldExclude(tag) {
+ filteredTags = append(filteredTags, tag)
+ }
+ }
+ sort.Strings(filteredTags)
+
+ return filteredTags, nil
+}
+
+func shouldExclude(tag string) bool {
+ // Set via CGO_ENABLED
+ return tag == "cgo" ||
+ // Set via GOARCH and GOOS
+ knownOS[tag] || knownArch[tag] || tag == "unix" ||
+ // Set via GOEXPERIMENT and GOAMD64
+ strings.HasPrefix(tag, "goexperiment.") || strings.HasPrefix(tag, "amd64.") ||
+ // Set implicitly
+ goVersionRegex.MatchString(tag)
+}
+
+func walkFile(path string, tags map[string]struct{}) error {
+ file, err := os.Open(path)
+ if err != nil {
+ return err
+ }
+
+ scanner := bufio.NewScanner(file)
+ // The Go SDK contains some very long lines in vendored files (minified JS).
+ scanner.Buffer(make([]byte, 0, 128*1024), 1024*1024)
+ for scanner.Scan() {
+ line := scanner.Text()
+ if !isConstraint(line) {
+ continue
+ }
+ c, err := constraint.Parse(line)
+ if err != nil {
+ continue
+ }
+ walkConstraint(c, tags)
+ }
+
+ if err = scanner.Err(); err != nil {
+ return fmt.Errorf("%s: %w", path, err)
+ }
+ return nil
+}
+
+func walkConstraint(c constraint.Expr, tags map[string]struct{}) {
+ switch c.(type) {
+ case *constraint.AndExpr:
+ walkConstraint(c.(*constraint.AndExpr).X, tags)
+ walkConstraint(c.(*constraint.AndExpr).Y, tags)
+ case *constraint.OrExpr:
+ walkConstraint(c.(*constraint.OrExpr).X, tags)
+ walkConstraint(c.(*constraint.OrExpr).Y, tags)
+ case *constraint.NotExpr:
+ walkConstraint(c.(*constraint.NotExpr).X, tags)
+ case *constraint.TagExpr:
+ tags[c.(*constraint.TagExpr).Tag] = struct{}{}
+ }
+}
+
+func isConstraint(line string) bool {
+ return constraint.IsPlusBuild(line) || constraint.IsGoBuild(line)
+}
+
+// Taken from
+// https://github.com/golang/go/blob/3d5391ed87d813110e10b954c62bf7ed578b591f/src/go/build/syslist.go
+var knownOS = map[string]bool{
+ "aix": true,
+ "android": true,
+ "darwin": true,
+ "dragonfly": true,
+ "freebsd": true,
+ "hurd": true,
+ "illumos": true,
+ "ios": true,
+ "js": true,
+ "linux": true,
+ "nacl": true,
+ "netbsd": true,
+ "openbsd": true,
+ "plan9": true,
+ "solaris": true,
+ "windows": true,
+ "zos": true,
+}
+
+var knownArch = map[string]bool{
+ "386": true,
+ "amd64": true,
+ "amd64p32": true,
+ "arm": true,
+ "armbe": true,
+ "arm64": true,
+ "arm64be": true,
+ "loong64": true,
+ "mips": true,
+ "mipsle": true,
+ "mips64": true,
+ "mips64le": true,
+ "mips64p32": true,
+ "mips64p32le": true,
+ "ppc": true,
+ "ppc64": true,
+ "ppc64le": true,
+ "riscv": true,
+ "riscv64": true,
+ "s390": true,
+ "s390x": true,
+ "sparc": true,
+ "sparc64": true,
+ "wasm": true,
+}
diff --git a/go/tools/internal/txtar/BUILD.bazel b/go/tools/internal/txtar/BUILD.bazel
new file mode 100644
index 00000000..d53e0582
--- /dev/null
+++ b/go/tools/internal/txtar/BUILD.bazel
@@ -0,0 +1,20 @@
+load("//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "txtar",
+ srcs = ["archive.go"],
+ importpath = "github.com/bazelbuild/rules_go/go/tools/internal/txtar",
+ visibility = ["//go/tools:__subpackages__"],
+)
+
+go_test(
+ name = "txtar_test",
+ srcs = ["archive_test.go"],
+ embed = [":txtar"],
+)
+
+alias(
+ name = "go_default_library",
+ actual = ":txtar",
+ visibility = ["//go/tools:__subpackages__"],
+)
diff --git a/go/tools/internal/txtar/archive.go b/go/tools/internal/txtar/archive.go
new file mode 100644
index 00000000..c384f33b
--- /dev/null
+++ b/go/tools/internal/txtar/archive.go
@@ -0,0 +1,140 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+// Package txtar implements a trivial text-based file archive format.
+//
+// The goals for the format are:
+//
+// - be trivial enough to create and edit by hand.
+// - be able to store trees of text files describing go command test cases.
+// - diff nicely in git history and code reviews.
+//
+// Non-goals include being a completely general archive format,
+// storing binary data, storing file modes, storing special files like
+// symbolic links, and so on.
+//
+// Txtar format
+//
+// A txtar archive is zero or more comment lines and then a sequence of file entries.
+// Each file entry begins with a file marker line of the form "-- FILENAME --"
+// and is followed by zero or more file content lines making up the file data.
+// The comment or file content ends at the next file marker line.
+// The file marker line must begin with the three-byte sequence "-- "
+// and end with the three-byte sequence " --", but the enclosed
+// file name can be surrounding by additional white space,
+// all of which is stripped.
+//
+// If the txtar file is missing a trailing newline on the final line,
+// parsers should consider a final newline to be present anyway.
+//
+// There are no possible syntax errors in a txtar archive.
+package txtar
+
+import (
+ "bytes"
+ "fmt"
+ "io/ioutil"
+ "strings"
+)
+
+// An Archive is a collection of files.
+type Archive struct {
+ Comment []byte
+ Files []File
+}
+
+// A File is a single file in an archive.
+type File struct {
+ Name string // name of file ("foo/bar.txt")
+ Data []byte // text content of file
+}
+
+// Format returns the serialized form of an Archive.
+// It is assumed that the Archive data structure is well-formed:
+// a.Comment and all a.File[i].Data contain no file marker lines,
+// and all a.File[i].Name is non-empty.
+func Format(a *Archive) []byte {
+ var buf bytes.Buffer
+ buf.Write(fixNL(a.Comment))
+ for _, f := range a.Files {
+ fmt.Fprintf(&buf, "-- %s --\n", f.Name)
+ buf.Write(fixNL(f.Data))
+ }
+ return buf.Bytes()
+}
+
+// ParseFile parses the named file as an archive.
+func ParseFile(file string) (*Archive, error) {
+ data, err := ioutil.ReadFile(file)
+ if err != nil {
+ return nil, err
+ }
+ return Parse(data), nil
+}
+
+// Parse parses the serialized form of an Archive.
+// The returned Archive holds slices of data.
+func Parse(data []byte) *Archive {
+ a := new(Archive)
+ var name string
+ a.Comment, name, data = findFileMarker(data)
+ for name != "" {
+ f := File{name, nil}
+ f.Data, name, data = findFileMarker(data)
+ a.Files = append(a.Files, f)
+ }
+ return a
+}
+
+var (
+ newlineMarker = []byte("\n-- ")
+ marker = []byte("-- ")
+ markerEnd = []byte(" --")
+)
+
+// findFileMarker finds the next file marker in data,
+// extracts the file name, and returns the data before the marker,
+// the file name, and the data after the marker.
+// If there is no next marker, findFileMarker returns before = fixNL(data), name = "", after = nil.
+func findFileMarker(data []byte) (before []byte, name string, after []byte) {
+ var i int
+ for {
+ if name, after = isMarker(data[i:]); name != "" {
+ return data[:i], name, after
+ }
+ j := bytes.Index(data[i:], newlineMarker)
+ if j < 0 {
+ return fixNL(data), "", nil
+ }
+ i += j + 1 // positioned at start of new possible marker
+ }
+}
+
+// isMarker checks whether data begins with a file marker line.
+// If so, it returns the name from the line and the data after the line.
+// Otherwise it returns name == "" with an unspecified after.
+func isMarker(data []byte) (name string, after []byte) {
+ if !bytes.HasPrefix(data, marker) {
+ return "", nil
+ }
+ if i := bytes.IndexByte(data, '\n'); i >= 0 {
+ data, after = data[:i], data[i+1:]
+ }
+ if !bytes.HasSuffix(data, markerEnd) {
+ return "", nil
+ }
+ return strings.TrimSpace(string(data[len(marker) : len(data)-len(markerEnd)])), after
+}
+
+// If data is empty or ends in \n, fixNL returns data.
+// Otherwise fixNL returns a new slice consisting of data with a final \n added.
+func fixNL(data []byte) []byte {
+ if len(data) == 0 || data[len(data)-1] == '\n' {
+ return data
+ }
+ d := make([]byte, len(data)+1)
+ copy(d, data)
+ d[len(data)] = '\n'
+ return d
+}
diff --git a/go/tools/internal/txtar/archive_test.go b/go/tools/internal/txtar/archive_test.go
new file mode 100644
index 00000000..3f734f67
--- /dev/null
+++ b/go/tools/internal/txtar/archive_test.go
@@ -0,0 +1,67 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package txtar
+
+import (
+ "bytes"
+ "fmt"
+ "reflect"
+ "testing"
+)
+
+var tests = []struct {
+ name string
+ text string
+ parsed *Archive
+}{
+ {
+ name: "basic",
+ text: `comment1
+comment2
+-- file1 --
+File 1 text.
+-- foo ---
+More file 1 text.
+-- file 2 --
+File 2 text.
+-- empty --
+-- noNL --
+hello world`,
+ parsed: &Archive{
+ Comment: []byte("comment1\ncomment2\n"),
+ Files: []File{
+ {"file1", []byte("File 1 text.\n-- foo ---\nMore file 1 text.\n")},
+ {"file 2", []byte("File 2 text.\n")},
+ {"empty", []byte{}},
+ {"noNL", []byte("hello world\n")},
+ },
+ },
+ },
+}
+
+func Test(t *testing.T) {
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ a := Parse([]byte(tt.text))
+ if !reflect.DeepEqual(a, tt.parsed) {
+ t.Fatalf("Parse: wrong output:\nhave:\n%s\nwant:\n%s", shortArchive(a), shortArchive(tt.parsed))
+ }
+ text := Format(a)
+ a = Parse(text)
+ if !reflect.DeepEqual(a, tt.parsed) {
+ t.Fatalf("Parse after Format: wrong output:\nhave:\n%s\nwant:\n%s", shortArchive(a), shortArchive(tt.parsed))
+ }
+ })
+ }
+}
+
+func shortArchive(a *Archive) string {
+ var buf bytes.Buffer
+ fmt.Fprintf(&buf, "comment: %q\n", a.Comment)
+ for _, f := range a.Files {
+ fmt.Fprintf(&buf, "file %q: %q\n", f.Name, f.Data)
+ }
+ return buf.String()
+}
diff --git a/go/tools/releaser/BUILD.bazel b/go/tools/releaser/BUILD.bazel
new file mode 100644
index 00000000..e750c67b
--- /dev/null
+++ b/go/tools/releaser/BUILD.bazel
@@ -0,0 +1,37 @@
+load("//go:def.bzl", "go_binary", "go_library", "go_test")
+
+go_binary(
+ name = "releaser",
+ embed = [":releaser_lib"],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "releaser_lib",
+ srcs = [
+ "boilerplate.go",
+ "file.go",
+ "git.go",
+ "github.go",
+ "prepare.go",
+ "releaser.go",
+ "run.go",
+ "upgradedep.go",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/go/tools/releaser",
+ visibility = ["//visibility:private"],
+ deps = [
+ "@com_github_bazelbuild_buildtools//build:go_default_library",
+ "@com_github_google_go_github_v36//github",
+ "@org_golang_x_mod//semver",
+ "@org_golang_x_oauth2//:oauth2",
+ "@org_golang_x_sync//errgroup",
+ ],
+)
+
+go_test(
+ name = "releaser_test",
+ srcs = ["upgradedep_test.go"],
+ embed = [":releaser_lib"],
+ deps = ["@com_github_bazelbuild_buildtools//build:go_default_library"],
+)
diff --git a/go/tools/releaser/boilerplate.go b/go/tools/releaser/boilerplate.go
new file mode 100644
index 00000000..828934a5
--- /dev/null
+++ b/go/tools/releaser/boilerplate.go
@@ -0,0 +1,78 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "encoding/json"
+ "errors"
+ "fmt"
+ "io"
+ "net/http"
+ "sort"
+
+ "golang.org/x/mod/semver"
+)
+
+func genBoilerplate(version, shasum, goVersion string) string {
+ return fmt.Sprintf(`load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+http_archive(
+ name = "io_bazel_rules_go",
+ sha256 = "%[2]s",
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/%[1]s/rules_go-%[1]s.zip",
+ "https://github.com/bazelbuild/rules_go/releases/download/%[1]s/rules_go-%[1]s.zip",
+ ],
+)
+
+load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies")
+
+go_rules_dependencies()
+
+go_register_toolchains(version = "%[3]s")`, version, shasum, goVersion)
+}
+
+func findLatestGoVersion() (v string, err error) {
+ defer func() {
+ if err != nil {
+ err = fmt.Errorf("finding latest go version: %w", err)
+ }
+ }()
+ resp, err := http.Get("https://golang.org/dl/?mode=json")
+ if err != nil {
+ return "", err
+ }
+ defer resp.Body.Close()
+ data, err := io.ReadAll(resp.Body)
+ if err != nil {
+ return "", err
+ }
+ type version struct {
+ Version string
+ }
+ var versions []version
+ if err := json.Unmarshal(data, &versions); err != nil {
+ return "", err
+ }
+ if len(versions) == 0 {
+ return "", errors.New("no versions found")
+ }
+ sort.Slice(versions, func(i, j int) bool {
+ vi := "v" + versions[i].Version[len("go"):]
+ vj := "v" + versions[j].Version[len("go"):]
+ return semver.Compare(vi, vj) > 0
+ })
+ return versions[0].Version[len("go"):], nil
+}
diff --git a/go/tools/releaser/file.go b/go/tools/releaser/file.go
new file mode 100644
index 00000000..e98fc1c1
--- /dev/null
+++ b/go/tools/releaser/file.go
@@ -0,0 +1,301 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "archive/tar"
+ "archive/zip"
+ "compress/gzip"
+ "context"
+ "crypto/sha256"
+ "encoding/hex"
+ "errors"
+ "fmt"
+ "io"
+ "os"
+ "path"
+ "path/filepath"
+ "strings"
+ "sync"
+)
+
+var repoRootState = struct {
+ once sync.Once
+ dir string
+ err error
+}{}
+
+// repoRoot returns the workspace root directory. If this program was invoked
+// with 'bazel run', repoRoot returns the BUILD_WORKSPACE_DIRECTORY environment
+// variable. Otherwise, repoRoot walks up the directory tree and finds a
+// WORKSPACE file.
+func repoRoot() (string, error) {
+ repoRootState.once.Do(func() {
+ if wsDir := os.Getenv("BUILD_WORKSPACE_DIRECTORY"); wsDir != "" {
+ repoRootState.dir = wsDir
+ return
+ }
+ dir, err := os.Getwd()
+ if err != nil {
+ repoRootState.err = err
+ return
+ }
+ for {
+ _, err := os.Stat(filepath.Join(dir, "WORKSPACE"))
+ if err == nil {
+ repoRootState.dir = dir
+ return
+ }
+ if err != os.ErrNotExist {
+ repoRootState.err = err
+ return
+ }
+ parent := filepath.Dir(dir)
+ if parent == dir {
+ repoRootState.err = errors.New("could not find workspace directory")
+ return
+ }
+ dir = parent
+ }
+ })
+ return repoRootState.dir, repoRootState.err
+}
+
+// extractArchive extracts a zip or tar.gz archive opened in f, into the
+// directory dir, stripping stripPrefix from each entry before extraction.
+// name is the name of the archive, used for error reporting.
+func extractArchive(f *os.File, name, dir, stripPrefix string) (err error) {
+ if strings.HasSuffix(name, ".zip") {
+ return extractZip(f, name, dir, stripPrefix)
+ }
+ if strings.HasSuffix(name, ".tar.gz") {
+ zr, err := gzip.NewReader(f)
+ if err != nil {
+ return fmt.Errorf("extracting %s: %w", name, err)
+ }
+ defer func() {
+ if cerr := zr.Close(); err == nil && cerr != nil {
+ err = cerr
+ }
+ }()
+ return extractTar(zr, name, dir, stripPrefix)
+ }
+ return fmt.Errorf("could not determine archive format from extension: %s", name)
+}
+
+func extractZip(zf *os.File, name, dir, stripPrefix string) (err error) {
+ stripPrefix += "/"
+ fi, err := zf.Stat()
+ if err != nil {
+ return err
+ }
+ defer func() {
+ if err != nil {
+ err = fmt.Errorf("extracting zip %s: %w", name, err)
+ }
+ }()
+
+ zr, err := zip.NewReader(zf, fi.Size())
+ if err != nil {
+ return err
+ }
+
+ extractFile := func(f *zip.File) (err error) {
+ defer func() {
+ if err != nil {
+ err = fmt.Errorf("extracting %s: %w", f.Name, err)
+ }
+ }()
+ outPath, err := extractedPath(dir, stripPrefix, f.Name)
+ if err != nil {
+ return err
+ }
+ if strings.HasSuffix(f.Name, "/") {
+ return os.MkdirAll(outPath, 0777)
+ }
+ r, err := f.Open()
+ if err != nil {
+ return err
+ }
+ defer r.Close()
+ parent := filepath.Dir(outPath)
+ if err := os.MkdirAll(parent, 0777); err != nil {
+ return err
+ }
+ w, err := os.Create(outPath)
+ if err != nil {
+ return err
+ }
+ defer func() {
+ if cerr := w.Close(); err == nil && cerr != nil {
+ err = cerr
+ }
+ }()
+ _, err = io.Copy(w, r)
+ return err
+ }
+
+ for _, f := range zr.File {
+ if err := extractFile(f); err != nil {
+ return err
+ }
+ }
+
+ return nil
+}
+
+func extractTar(r io.Reader, name, dir, stripPrefix string) (err error) {
+ defer func() {
+ if err != nil {
+ err = fmt.Errorf("extracting tar %s: %w", name, err)
+ }
+ }()
+
+ tr := tar.NewReader(r)
+ extractFile := func(hdr *tar.Header) (err error) {
+ outPath, err := extractedPath(dir, stripPrefix, hdr.Name)
+ if err != nil {
+ return err
+ }
+ switch hdr.Typeflag {
+ case tar.TypeDir:
+ return os.MkdirAll(outPath, 0777)
+ case tar.TypeReg:
+ w, err := os.Create(outPath)
+ if err != nil {
+ return err
+ }
+ defer func() {
+ if cerr := w.Close(); err == nil && cerr != nil {
+ err = cerr
+ }
+ }()
+ _, err = io.Copy(w, tr)
+ return err
+ default:
+ return fmt.Errorf("unsupported file type %x: %q", hdr.Typeflag, hdr.Name)
+ }
+ }
+
+ stripPrefix += "/"
+ for {
+ hdr, err := tr.Next()
+ if err == io.EOF {
+ break
+ } else if err != nil {
+ return err
+ }
+ if err := extractFile(hdr); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+// extractedPath returns the file path that a file in an archive should be
+// extracted to. It verifies that entryName starts with stripPrefix and does not
+// point outside dir.
+func extractedPath(dir, stripPrefix, entryName string) (string, error) {
+ if !strings.HasPrefix(entryName, stripPrefix) {
+ return "", fmt.Errorf("entry does not start with prefix %s: %q", stripPrefix, entryName)
+ }
+ entryName = entryName[len(stripPrefix):]
+ if entryName == "" {
+ return dir, nil
+ }
+ if path.IsAbs(entryName) {
+ return "", fmt.Errorf("entry has an absolute path: %q", entryName)
+ }
+ if strings.HasPrefix(entryName, "../") {
+ return "", fmt.Errorf("entry refers to something outside the archive: %q", entryName)
+ }
+ entryName = strings.TrimSuffix(entryName, "/")
+ if path.Clean(entryName) != entryName {
+ return "", fmt.Errorf("entry does not have a clean path: %q", entryName)
+ }
+ return filepath.Join(dir, entryName), nil
+}
+
+// copyDir recursively copies a directory tree.
+func copyDir(toDir, fromDir string) error {
+ if err := os.MkdirAll(toDir, 0777); err != nil {
+ return err
+ }
+ return filepath.Walk(fromDir, func(path string, fi os.FileInfo, err error) error {
+ if err != nil {
+ return err
+ }
+ rel, _ := filepath.Rel(fromDir, path)
+ if rel == "." {
+ return nil
+ }
+ outPath := filepath.Join(toDir, rel)
+ if fi.IsDir() {
+ return os.Mkdir(outPath, 0777)
+ } else {
+ return copyFile(outPath, path)
+ }
+ })
+}
+
+func copyFile(toFile, fromFile string) (err error) {
+ r, err := os.Open(fromFile)
+ if err != nil {
+ return err
+ }
+ defer r.Close()
+ w, err := os.Create(toFile)
+ if err != nil {
+ return err
+ }
+ defer func() {
+ if cerr := w.Close(); err == nil && cerr != nil {
+ err = cerr
+ }
+ }()
+ _, err = io.Copy(w, r)
+ return err
+}
+
+func sha256SumFile(name string) (string, error) {
+ r, err := os.Open(name)
+ if err != nil {
+ return "", err
+ }
+ defer r.Close()
+ h := sha256.New()
+ if _, err := io.Copy(h, r); err != nil {
+ return "", err
+ }
+ sum := h.Sum(nil)
+ return hex.EncodeToString(sum), nil
+}
+
+// copyFileToMirror uploads a file to the GCS bucket backing mirror.bazel.build.
+// gsutil must be installed, and the user must be authenticated with
+// 'gcloud auth login' and be allowed to write files to the bucket.
+func copyFileToMirror(ctx context.Context, path, fileName string) (err error) {
+ dest := "gs://bazel-mirror/" + path
+ defer func() {
+ if err != nil {
+ err = fmt.Errorf("copying file %s to %s: %w", fileName, dest, err)
+ }
+ }()
+
+ // This function shells out to gsutil instead of using
+ // cloud.google.com/go/storage because that package has a million
+ // dependencies.
+ return runForError(ctx, ".", "gsutil", "cp", "-n", fileName, dest)
+}
diff --git a/go/tools/releaser/git.go b/go/tools/releaser/git.go
new file mode 100644
index 00000000..83e688c5
--- /dev/null
+++ b/go/tools/releaser/git.go
@@ -0,0 +1,52 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "context"
+ "errors"
+)
+
+func checkNoGitChanges(ctx context.Context, dir string) error {
+ out, err := runForOutput(ctx, dir, "git", "status", "--porcelain", "--untracked-files=no")
+ if err != nil {
+ return err
+ }
+ if len(out) > 0 {
+ return errors.New("Repository has pending changes. Commit them and try again.")
+ }
+ return nil
+}
+
+func gitBranchExists(ctx context.Context, dir, branchName string) bool {
+ err := runForError(ctx, dir, "git", "show-ref", "--verify", "--quiet", "refs/heads/"+branchName)
+ return err == nil
+}
+
+func gitCreateBranch(ctx context.Context, dir, branchName, refName string) error {
+ return runForError(ctx, dir, "git", "branch", branchName, refName)
+}
+
+func gitPushBranch(ctx context.Context, dir, branchName string) error {
+ return runForError(ctx, dir, "git", "push", "origin", branchName)
+}
+
+func gitCreateArchive(ctx context.Context, dir, branchName, arcName string) error {
+ return runForError(ctx, dir, "git", "archive", "--output="+arcName, branchName)
+}
+
+func gitCatFile(ctx context.Context, dir, refName, fileName string) ([]byte, error) {
+ return runForOutput(ctx, dir, "git", "cat-file", "blob", refName+":"+fileName)
+}
diff --git a/go/tools/releaser/github.go b/go/tools/releaser/github.go
new file mode 100644
index 00000000..4fecfc6c
--- /dev/null
+++ b/go/tools/releaser/github.go
@@ -0,0 +1,132 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "bytes"
+ "context"
+ "errors"
+ "fmt"
+ "os"
+ "strings"
+
+ "github.com/google/go-github/v36/github"
+)
+
+type githubClient struct {
+ *github.Client
+}
+
+func (gh *githubClient) listTags(ctx context.Context, org, repo string) (_ []*github.RepositoryTag, err error) {
+ defer func() {
+ if err != nil {
+ err = fmt.Errorf("listing tags in github.com/%s/%s: %w", org, repo, err)
+ }
+ }()
+
+ var allTags []*github.RepositoryTag
+ err = gh.listPages(func(opts *github.ListOptions) (*github.Response, error) {
+ tags, resp, err := gh.Repositories.ListTags(ctx, org, repo, opts)
+ if err != nil {
+ return nil, err
+ }
+ allTags = append(allTags, tags...)
+ return resp, nil
+ })
+ if err != nil {
+ return nil, err
+ }
+ return allTags, nil
+}
+
+func (gh *githubClient) listReleases(ctx context.Context, org, repo string) (_ []*github.RepositoryRelease, err error) {
+ defer func() {
+ if err != nil {
+ err = fmt.Errorf("listing releases in github.com/%s/%s: %w", org, repo, err)
+ }
+ }()
+
+ var allReleases []*github.RepositoryRelease
+ err = gh.listPages(func(opts *github.ListOptions) (*github.Response, error) {
+ releases, resp, err := gh.Repositories.ListReleases(ctx, org, repo, opts)
+ if err != nil {
+ return nil, err
+ }
+ allReleases = append(allReleases, releases...)
+ return resp, nil
+ })
+ if err != nil {
+ return nil, err
+ }
+ return allReleases, nil
+}
+
+// getReleaseByTagIncludingDraft is like
+// github.RepositoriesService.GetReleaseByTag, but it also considers draft
+// releases that aren't tagged yet.
+func (gh *githubClient) getReleaseByTagIncludingDraft(ctx context.Context, org, repo, tag string) (*github.RepositoryRelease, error) {
+ releases, err := gh.listReleases(ctx, org, repo)
+ if err != nil {
+ return nil, err
+ }
+ for _, release := range releases {
+ if release.GetTagName() == tag {
+ return release, nil
+ }
+ }
+ return nil, errReleaseNotFound
+}
+
+var errReleaseNotFound = errors.New("release not found")
+
+// githubListPages calls fn repeatedly to get all pages of a large result.
+// This is useful for fetching all tags or all comments or something similar.
+func (gh *githubClient) listPages(fn func(opt *github.ListOptions) (*github.Response, error)) error {
+ opt := &github.ListOptions{PerPage: 50}
+ for {
+ resp, err := fn(opt)
+ if err != nil {
+ return err
+ }
+ if resp.NextPage == 0 {
+ return nil
+ }
+ opt.Page = resp.NextPage
+ }
+}
+
+// githubTokenFlag is used to find a GitHub personal access token on the
+// command line. It accepts a raw token or a path to a file containing a token.
+type githubTokenFlag string
+
+func (f *githubTokenFlag) Set(v string) error {
+ if strings.HasPrefix(v, "ghp_") {
+ *(*string)(f) = v
+ return nil
+ }
+ data, err := os.ReadFile(v)
+ if err != nil {
+ return fmt.Errorf("reading GitHub token: %w", err)
+ }
+ *(*string)(f) = string(bytes.TrimSpace(data))
+ return nil
+}
+
+func (f *githubTokenFlag) String() string {
+ if f == nil {
+ return ""
+ }
+ return string(*f)
+}
diff --git a/go/tools/releaser/prepare.go b/go/tools/releaser/prepare.go
new file mode 100644
index 00000000..4c7b0413
--- /dev/null
+++ b/go/tools/releaser/prepare.go
@@ -0,0 +1,253 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "bytes"
+ "context"
+ "errors"
+ "flag"
+ "fmt"
+ "io"
+ "os"
+
+ "github.com/google/go-github/v36/github"
+ "golang.org/x/mod/semver"
+ "golang.org/x/oauth2"
+)
+
+var prepareCmd = command{
+ name: "prepare",
+ description: "prepares a GitHub release with notes and attached archive",
+ help: `prepare -rnotes=file -version=version -githubtoken=token [-mirror]
+
+'prepare' performs most tasks related to a rules_go release. It does everything
+except publishing and tagging the release, which must be done manually,
+with review. Specifically, prepare does the following:
+
+* Creates the release branch if it doesn't exist locally. Release branches
+ have names like "release-X.Y" where X and Y are the major and minor version
+ numbers.
+* Checks that RULES_GO_VERSION is set in go/def.bzl on the local release branch
+ for the minor version being released. RULES_GO_VERSION must be a sematic
+ version without the "v" prefix that Go uses, like "1.2.4". It must match
+ the -version flag, which does require the "v" prefix.
+* Creates an archive zip file from the tip of the local release branch.
+* Creates or updates a draft GitHub release with the given release notes.
+ http_archive boilerplate is generated and appended to the release notes.
+* Uploads and attaches the release archive to the GitHub release.
+* Uploads the release archive to mirror.bazel.build. If the file already exists,
+ it may be manually removed with 'gsutil rm gs://bazel-mirror/<github-url>'
+ or manually updated with 'gsutil cp <file> gs://bazel-mirror/<github-url>'.
+ This step may be skipped by setting -mirror=false.
+
+After these steps are completed successfully, 'prepare' prompts the user to
+check that CI passes, then review and publish the release.
+
+Note that 'prepare' does not update boilerplate in WORKSPACE or README.rst for
+either rules_go or Gazelle.
+`,
+}
+
+func init() {
+ // break init cycle
+ prepareCmd.run = runPrepare
+}
+
+func runPrepare(ctx context.Context, stderr io.Writer, args []string) error {
+ // Parse arguments.
+ flags := flag.NewFlagSet("releaser prepare", flag.ContinueOnError)
+ var rnotesPath, version string
+ var githubToken githubTokenFlag
+ var uploadToMirror bool
+ flags.Var(&githubToken, "githubtoken", "GitHub personal access token or path to a file containing it")
+ flags.BoolVar(&uploadToMirror, "mirror", true, "whether to upload dependency archives to mirror.bazel.build")
+ flags.StringVar(&rnotesPath, "rnotes", "", "Name of file containing release notes in Markdown")
+ flags.StringVar(&version, "version", "", "Version to release")
+ if err := flags.Parse(args); err != nil {
+ return err
+ }
+ if flags.NArg() > 0 {
+ return usageErrorf(&prepareCmd, "No arguments expected")
+ }
+ if githubToken == "" {
+ return usageErrorf(&prepareCmd, "-githubtoken must be set")
+ }
+ if rnotesPath == "" {
+ return usageErrorf(&prepareCmd, "-rnotes must be set")
+ }
+ if version == "" {
+ return usageErrorf(&prepareCmd, "-version must be set")
+ }
+ if semver.Canonical(version) != version || semver.Prerelease(version) != "" || semver.Build(version) != "" {
+ return usageErrorf(&prepareCmd, "-version must be a canonical version, like v1.2.3")
+ }
+
+ ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: string(githubToken)})
+ tc := oauth2.NewClient(ctx, ts)
+ gh := &githubClient{Client: github.NewClient(tc)}
+
+ // Get the GitHub release.
+ fmt.Fprintf(stderr, "checking if release %s exists...\n", version)
+ release, err := gh.getReleaseByTagIncludingDraft(ctx, "bazelbuild", "rules_go", version)
+ if err != nil && !errors.Is(err, errReleaseNotFound) {
+ return err
+ }
+ if release != nil && !release.GetDraft() {
+ return fmt.Errorf("release %s was already published", version)
+ }
+
+ // Check that RULES_GO_VERSION is set correctly on the release branch.
+ // If this is a minor release (x.y.0), create the release branch if it
+ // does not exist.
+ fmt.Fprintf(stderr, "checking RULES_GO_VERSION...\n")
+ rootDir, err := repoRoot()
+ if err != nil {
+ return err
+ }
+ if err := checkNoGitChanges(ctx, rootDir); err != nil {
+ return err
+ }
+ majorMinor := semver.MajorMinor(version)
+ isMinorRelease := semver.Canonical(majorMinor) == version
+ branchName := "release-" + majorMinor[len("v"):]
+ if !gitBranchExists(ctx, rootDir, branchName) {
+ if !isMinorRelease {
+ return fmt.Errorf("release branch %q does not exist locally. Fetch it, set RULES_GO_VERSION, add commits, and run this command again.")
+ }
+ if err := checkRulesGoVersion(ctx, rootDir, "HEAD", version); err != nil {
+ return err
+ }
+ fmt.Fprintf(stderr, "creating branch %s...\n", branchName)
+ if err := gitCreateBranch(ctx, rootDir, branchName, "HEAD"); err != nil {
+ return err
+ }
+ } else {
+ if err := checkRulesGoVersion(ctx, rootDir, branchName, version); err != nil {
+ return err
+ }
+ }
+
+ // Create an archive.
+ fmt.Fprintf(stderr, "creating archive...\n")
+ arcFile, err := os.CreateTemp("", "rules_go-%s-*.zip")
+ if err != nil {
+ return err
+ }
+ arcName := arcFile.Name()
+ arcFile.Close()
+ defer func() {
+ if rerr := os.Remove(arcName); err == nil && rerr != nil {
+ err = rerr
+ }
+ }()
+ if err := gitCreateArchive(ctx, rootDir, branchName, arcName); err != nil {
+ return err
+ }
+ arcSum, err := sha256SumFile(arcName)
+ if err != nil {
+ return err
+ }
+
+ // Read release notes, append boilerplate.
+ rnotesData, err := os.ReadFile(rnotesPath)
+ if err != nil {
+ return err
+ }
+ rnotesData = bytes.TrimSpace(rnotesData)
+ goVersion, err := findLatestGoVersion()
+ if err != nil {
+ return err
+ }
+ boilerplate := genBoilerplate(version, arcSum, goVersion)
+ rnotesStr := string(rnotesData) + "\n\n## `WORKSPACE` code\n\n```\n" + boilerplate + "\n```\n"
+
+ // Push the release branch.
+ fmt.Fprintf(stderr, "pushing branch %s to origin...\n", branchName)
+ if err := gitPushBranch(ctx, rootDir, branchName); err != nil {
+ return err
+ }
+
+ // Upload to mirror.bazel.build.
+ arcGHURLWithoutScheme := fmt.Sprintf("github.com/bazelbuild/rules_go/releases/download/%[1]s/rules_go-%[1]s.zip", version)
+ if uploadToMirror {
+ fmt.Fprintf(stderr, "uploading archive to mirror.bazel.build...\n")
+ if err := copyFileToMirror(ctx, arcGHURLWithoutScheme, arcName); err != nil {
+ return err
+ }
+ }
+
+ // Create or update the GitHub release.
+ if release == nil {
+ fmt.Fprintf(stderr, "creating draft release...\n")
+ draft := true
+ release = &github.RepositoryRelease{
+ TagName: &version,
+ TargetCommitish: &branchName,
+ Name: &version,
+ Body: &rnotesStr,
+ Draft: &draft,
+ }
+ if release, _, err = gh.Repositories.CreateRelease(ctx, "bazelbuild", "rules_go", release); err != nil {
+ return err
+ }
+ } else {
+ fmt.Fprintf(stderr, "updating release...\n")
+ release.Body = &rnotesStr
+ if release, _, err = gh.Repositories.EditRelease(ctx, "bazelbuild", "rules_go", release.GetID(), release); err != nil {
+ return err
+ }
+ for _, asset := range release.Assets {
+ if _, err := gh.Repositories.DeleteReleaseAsset(ctx, "bazelbuild", "rules_go", asset.GetID()); err != nil {
+ return err
+ }
+ }
+ }
+ arcFile, err = os.Open(arcName)
+ if err != nil {
+ return err
+ }
+ defer arcFile.Close()
+ uploadOpts := &github.UploadOptions{
+ Name: "rules_go-" + version + ".zip",
+ MediaType: "application/zip",
+ }
+ if _, _, err := gh.Repositories.UploadReleaseAsset(ctx, "bazelbuild", "rules_go", release.GetID(), uploadOpts, arcFile); err != nil {
+ return err
+ }
+
+ testURL := fmt.Sprintf("https://buildkite.com/bazel/rules-go-golang/builds?branch=%s", branchName)
+ fmt.Fprintf(stderr, `
+Release %s has been prepared and uploaded.
+
+* Ensure that all tests pass in CI at %s.
+* Review and publish the release at %s.
+* Update README.rst and WORKSPACE if necessary.
+`, version, testURL, release.GetHTMLURL())
+
+ return nil
+}
+
+func checkRulesGoVersion(ctx context.Context, dir, refName, version string) error {
+ data, err := gitCatFile(ctx, dir, refName, "go/def.bzl")
+ if err != nil {
+ return err
+ }
+ rulesGoVersionStr := []byte(fmt.Sprintf(`RULES_GO_VERSION = "%s"`, version[len("v"):]))
+ if !bytes.Contains(data, rulesGoVersionStr) {
+ return fmt.Errorf("RULES_GO_VERSION was not set to %q in go/def.bzl. Set it, add commits, and run this command again.")
+ }
+ return nil
+}
diff --git a/go/tools/releaser/releaser.go b/go/tools/releaser/releaser.go
new file mode 100644
index 00000000..e8ba95c1
--- /dev/null
+++ b/go/tools/releaser/releaser.go
@@ -0,0 +1,127 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// releaser is a tool for maintaining rules_go and Gazelle. It automates
+// multiple tasks related to preparing releases, like upgrading dependencies,
+// and uploading release artifacts.
+package main
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "io"
+ "os"
+ "os/signal"
+)
+
+func main() {
+ ctx, cancel := signal.NotifyContext(context.Background(), os.Interrupt)
+ defer cancel()
+ if err := run(ctx, os.Stderr, os.Args[1:]); err != nil {
+ fmt.Fprintln(os.Stderr, err)
+ os.Exit(1)
+ }
+}
+
+type command struct {
+ name, description, help string
+ run func(context.Context, io.Writer, []string) error
+}
+
+var commands = []*command{
+ &helpCmd,
+ &prepareCmd,
+ &upgradeDepCmd,
+}
+
+func run(ctx context.Context, stderr io.Writer, args []string) error {
+ if len(args) == 0 {
+ return errors.New("no command specified. For a list of commands, run:\n\treleaser help")
+ }
+ name, args := args[0], args[1:]
+ for _, arg := range args {
+ if arg == "-h" || name == "-help" || name == "--help" {
+ return helpCmd.run(ctx, stderr, args)
+ }
+ }
+ for _, cmd := range commands {
+ if cmd.name == name {
+ return cmd.run(ctx, stderr, args)
+ }
+ }
+ return fmt.Errorf("unknown command %q. For a list of commands, run:\n\treleaser help", name)
+}
+
+var helpCmd = command{
+ name: "help",
+ description: "prints information on how to use any subcommand",
+ help: `releaser help [subcommand]
+
+The help sub-command prints information on how to use any subcommand. Run help
+without arguments for a list of all subcommands.
+`,
+}
+
+func init() {
+ // break init cycle
+ helpCmd.run = runHelp
+}
+
+func runHelp(ctx context.Context, stderr io.Writer, args []string) error {
+ if len(args) > 1 {
+ return usageErrorf(&helpCmd, "help accepts at most one argument.")
+ }
+
+ if len(args) == 1 {
+ name := args[0]
+ for _, cmd := range commands {
+ if cmd.name == name {
+ fmt.Fprintf(stderr, "%s\n\n%s\n", cmd.description, cmd.help)
+ return nil
+ }
+ }
+ return fmt.Errorf("Unknown command %s. For a list of supported subcommands, run:\n\treleaser help", name)
+ }
+
+ fmt.Fprint(stderr, "releaser supports the following subcommands:\n\n")
+ maxNameLen := 0
+ for _, cmd := range commands {
+ if len(cmd.name) > maxNameLen {
+ maxNameLen = len(cmd.name)
+ }
+ }
+ for _, cmd := range commands {
+ fmt.Fprintf(stderr, "\t%-*s %s\n", maxNameLen, cmd.name, cmd.description)
+ }
+ fmt.Fprintf(stderr, "\nRun 'releaser help <subcommand>' for more information on any command.\n")
+ return nil
+}
+
+type usageError struct {
+ cmd *command
+ err error
+}
+
+func (e *usageError) Error() string {
+ return fmt.Sprintf("%v. For usage info, run:\n\treleaser help %s", e.err, e.cmd.name)
+}
+
+func (e *usageError) Unwrap() error {
+ return e.err
+}
+
+func usageErrorf(cmd *command, format string, args ...interface{}) error {
+ return &usageError{cmd: cmd, err: fmt.Errorf(format, args...)}
+}
diff --git a/go/tools/releaser/run.go b/go/tools/releaser/run.go
new file mode 100644
index 00000000..6ffe0d78
--- /dev/null
+++ b/go/tools/releaser/run.go
@@ -0,0 +1,92 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "bytes"
+ "context"
+ "fmt"
+ "os"
+ "os/exec"
+ "strings"
+)
+
+// runForError runs a command without showing its output. If the command fails,
+// runForError returns an error containing its stderr.
+func runForError(ctx context.Context, dir string, name string, args ...string) error {
+ stderr := &bytes.Buffer{}
+ cmd := exec.CommandContext(ctx, name, args...)
+ cmd.Env = envWithoutBazel()
+ cmd.Dir = dir
+ cmd.Stdout = nil
+ cmd.Stderr = stderr
+ err := cmd.Run()
+ return cleanCmdError(err, name, args, stderr.Bytes())
+}
+
+// runForOutput runs a command and returns its output. If the command fails,
+// runForOutput returns an error containing its stderr. The command's output
+// is returned whether it failed or not.
+func runForOutput(ctx context.Context, dir string, name string, args ...string) ([]byte, error) {
+ stdout := &bytes.Buffer{}
+ stderr := &bytes.Buffer{}
+ cmd := exec.CommandContext(ctx, name, args...)
+ cmd.Env = envWithoutBazel()
+ cmd.Dir = dir
+ cmd.Stdout = stdout
+ cmd.Stderr = stderr
+ err := cmd.Run()
+ return stdout.Bytes(), cleanCmdError(err, name, args, stderr.Bytes())
+}
+
+// envWithoutBazel runs the current process's environment without variables
+// starting with "BUILD_" added by 'bazel run'. These can confuse subprocesses.
+func envWithoutBazel() []string {
+ env := os.Environ()
+ filtered := make([]string, 0, len(env))
+ for _, e := range env {
+ if strings.HasPrefix(e, "BUILD_") {
+ continue
+ }
+ filtered = append(filtered, e)
+ }
+ return filtered
+}
+
+// cleanCmdError wraps an error returned by exec.Cmd.Run with the command that
+// was run and its stderr output.
+func cleanCmdError(err error, name string, args []string, stderr []byte) error {
+ if err == nil {
+ return nil
+ }
+ return &commandError{
+ argv: append([]string{name}, args...),
+ err: err,
+ }
+}
+
+type commandError struct {
+ argv []string
+ stderr []byte
+ err error
+}
+
+func (e *commandError) Error() string {
+ return fmt.Sprintf("running %s: %v\n%s", strings.Join(e.argv, " "), e.err, bytes.TrimSpace(e.stderr))
+}
+
+func (e *commandError) Unwrap() error {
+ return e.err
+}
diff --git a/go/tools/releaser/upgradedep.go b/go/tools/releaser/upgradedep.go
new file mode 100644
index 00000000..6e28c08e
--- /dev/null
+++ b/go/tools/releaser/upgradedep.go
@@ -0,0 +1,561 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "bytes"
+ "context"
+ "crypto/sha256"
+ "encoding/hex"
+ "errors"
+ "flag"
+ "fmt"
+ "io"
+ "net/http"
+ "os"
+ "os/exec"
+ "path"
+ "path/filepath"
+ "strings"
+ "time"
+
+ bzl "github.com/bazelbuild/buildtools/build"
+ "github.com/google/go-github/v36/github"
+ "golang.org/x/mod/semver"
+ "golang.org/x/oauth2"
+ "golang.org/x/sync/errgroup"
+)
+
+var upgradeDepCmd = command{
+ name: "upgrade-dep",
+ description: "upgrades a dependency in WORKSPACE or go_repositories.bzl",
+ help: `releaser upgrade-dep [-githubtoken=token] [-mirror] [-work] deps...
+
+upgrade-dep upgrades one or more rules_go dependencies in WORKSPACE or
+go/private/repositories.bzl. Dependency names (matching the name attributes)
+can be specified with positional arguments. "all" may be specified to upgrade
+all upgradeable dependencies.
+
+For each dependency, upgrade-dep finds the highest version available in the
+upstream repository. If no version is available, upgrade-dep uses the commit
+at the tip of the default branch. If a version is part of a release,
+upgrade-dep will try to use an archive attached to the release; if none is
+available, upgrade-dep uses an archive generated by GitHub.
+
+Once upgrade-dep has found the URL for the latest version, it will:
+
+* Download the archive.
+* Upload the archive to mirror.bazel.build.
+* Re-generate patches, either by running a command or by re-applying the
+ old patches.
+* Update dependency attributes in WORKSPACE and repositories.bzl, then format
+ and rewrite those files.
+
+Upgradeable dependencies need a comment like '# releaser:upgrade-dep org repo'
+where org and repo are the GitHub organization and repository. We could
+potentially fetch archives from proxy.golang.org instead, but it's not available
+in as many countries.
+
+Patches may have a comment like '# releaser:patch-cmd name args...'. If this
+comment is present, upgrade-dep will generate the patch by running the specified
+command in a temporary directory containing the extracted archive with the
+previous patches applied.
+`,
+}
+
+func init() {
+ // break init cycle
+ upgradeDepCmd.run = runUpgradeDep
+}
+
+func runUpgradeDep(ctx context.Context, stderr io.Writer, args []string) error {
+ // Parse arguments.
+ flags := flag.NewFlagSet("releaser upgrade-dep", flag.ContinueOnError)
+ var githubToken githubTokenFlag
+ var uploadToMirror, leaveWorkDir bool
+ flags.Var(&githubToken, "githubtoken", "GitHub personal access token or path to a file containing it")
+ flags.BoolVar(&uploadToMirror, "mirror", true, "whether to upload dependency archives to mirror.bazel.build")
+ flags.BoolVar(&leaveWorkDir, "work", false, "don't delete temporary work directory (for debugging)")
+ if err := flags.Parse(args); err != nil {
+ return err
+ }
+ if flags.NArg() == 0 {
+ return usageErrorf(&upgradeDepCmd, "No dependencies specified")
+ }
+ upgradeAll := false
+ for _, arg := range flags.Args() {
+ if arg == "all" {
+ upgradeAll = true
+ break
+ }
+ }
+ if upgradeAll && flags.NArg() != 1 {
+ return usageErrorf(&upgradeDepCmd, "When 'all' is specified, it must be the only argument")
+ }
+
+ httpClient := http.DefaultClient
+ if githubToken != "" {
+ ts := oauth2.StaticTokenSource(&oauth2.Token{AccessToken: string(githubToken)})
+ httpClient = oauth2.NewClient(ctx, ts)
+ }
+ gh := &githubClient{Client: github.NewClient(httpClient)}
+
+ workDir, err := os.MkdirTemp("", "releaser-upgrade-dep-*")
+ if leaveWorkDir {
+ fmt.Fprintf(stderr, "work dir: %s\n", workDir)
+ } else {
+ defer func() {
+ if rerr := os.RemoveAll(workDir); err == nil && rerr != nil {
+ err = rerr
+ }
+ }()
+ }
+
+ // Make sure we have everything we need.
+ // upgrade-dep must be run inside rules_go (though we just check for
+ // WORKSPACE), and a few tools must be available.
+ rootDir, err := repoRoot()
+ if err != nil {
+ return err
+ }
+ for _, tool := range []string{"diff", "gazelle", "gsutil", "patch"} {
+ if _, err := exec.LookPath(tool); err != nil {
+ return fmt.Errorf("%s must be installed in PATH", tool)
+ }
+ }
+
+ // Parse and index files we might want to update.
+ type file struct {
+ path string
+ funcName string
+ parsed *bzl.File
+ body []bzl.Expr
+ }
+ files := []file{
+ {path: filepath.Join(rootDir, "WORKSPACE")},
+ {path: filepath.Join(rootDir, "go/private/repositories.bzl"), funcName: "go_rules_dependencies"},
+ }
+ depIndex := make(map[string]*bzl.CallExpr)
+
+ for i := range files {
+ f := &files[i]
+ data, err := os.ReadFile(f.path)
+ if err != nil {
+ return err
+ }
+ f.parsed, err = bzl.Parse(f.path, data)
+ if err != nil {
+ return err
+ }
+
+ if f.funcName == "" {
+ f.body = f.parsed.Stmt
+ } else {
+ for _, expr := range f.parsed.Stmt {
+ def, ok := expr.(*bzl.DefStmt)
+ if !ok {
+ continue
+ }
+ if def.Name == f.funcName {
+ f.body = def.Body
+ break
+ }
+ }
+ if f.body == nil {
+ return fmt.Errorf("in file %s, could not find function %s", f.path, f.funcName)
+ }
+ }
+
+ for _, expr := range f.body {
+ call, ok := expr.(*bzl.CallExpr)
+ if !ok {
+ continue
+ }
+ for _, arg := range call.List {
+ kwarg, ok := arg.(*bzl.AssignExpr)
+ if !ok {
+ continue
+ }
+ key := kwarg.LHS.(*bzl.Ident) // required by parser
+ if key.Name != "name" {
+ continue
+ }
+ value, ok := kwarg.RHS.(*bzl.StringExpr)
+ if !ok {
+ continue
+ }
+ depIndex[value.Value] = call
+ }
+ }
+ }
+
+ // Update dependencies in those files.
+ eg, egctx := errgroup.WithContext(ctx)
+ if upgradeAll {
+ for name := range depIndex {
+ name := name
+ if _, _, err := parseUpgradeDepDirective(depIndex[name]); err != nil {
+ continue
+ }
+ eg.Go(func() error {
+ return upgradeDepDecl(egctx, gh, workDir, name, depIndex[name], uploadToMirror)
+ })
+ }
+ } else {
+ for _, arg := range flags.Args() {
+ if depIndex[arg] == nil {
+ return fmt.Errorf("could not find dependency %s", arg)
+ }
+ }
+ for _, arg := range flags.Args() {
+ arg := arg
+ eg.Go(func() error {
+ return upgradeDepDecl(egctx, gh, workDir, arg, depIndex[arg], uploadToMirror)
+ })
+ }
+ }
+ if err := eg.Wait(); err != nil {
+ return err
+ }
+
+ // Format and write files back to disk.
+ for _, f := range files {
+ if err := os.WriteFile(f.path, bzl.Format(f.parsed), 0666); err != nil {
+ return err
+ }
+ }
+ return nil
+}
+
+// upgradeDepDecl upgrades a specific dependency.
+func upgradeDepDecl(ctx context.Context, gh *githubClient, workDir, name string, call *bzl.CallExpr, uploadToMirror bool) (err error) {
+ defer func() {
+ if err != nil {
+ err = fmt.Errorf("upgrading %s: %w", name, err)
+ }
+ }()
+
+ // Find a '# releaser:upgrade-dep org repo' comment. We could probably
+ // figure this out from URLs but this also serves to mark a dependency as
+ // being automatically upgradeable.
+ orgName, repoName, err := parseUpgradeDepDirective(call)
+ if err != nil {
+ return err
+ }
+
+ // Find attributes we'll need to read or write. We'll modify these directly
+ // in the AST. Nothing else should read or write them while we're working.
+ attrs := map[string]*bzl.Expr{
+ "patches": nil,
+ "sha256": nil,
+ "strip_prefix": nil,
+ "urls": nil,
+ }
+ var urlsKwarg *bzl.AssignExpr
+ for _, arg := range call.List {
+ kwarg, ok := arg.(*bzl.AssignExpr)
+ if !ok {
+ continue
+ }
+ key := kwarg.LHS.(*bzl.Ident) // required by parser
+ if _, ok := attrs[key.Name]; ok {
+ attrs[key.Name] = &kwarg.RHS
+ }
+ if key.Name == "urls" {
+ urlsKwarg = kwarg
+ }
+ }
+ for key := range attrs {
+ if key == "patches" {
+ // Don't add optional attributes.
+ continue
+ }
+ if attrs[key] == nil {
+ kwarg := &bzl.AssignExpr{LHS: &bzl.Ident{Name: key}, Op: "="}
+ call.List = append(call.List, kwarg)
+ attrs[key] = &kwarg.RHS
+ }
+ }
+
+ // Find the highest tag in semver order, ignoring whether the version has a
+ // leading "v" or not. If there are no tags, find the commit at the tip of the
+ // default branch.
+ tags, err := gh.listTags(ctx, orgName, repoName)
+ if err != nil {
+ return err
+ }
+
+ vname := func(name string) string {
+ if !strings.HasPrefix(name, "v") {
+ return "v" + name
+ }
+ return name
+ }
+
+ w := 0
+ for r := range tags {
+ name := vname(*tags[r].Name)
+ if name != semver.Canonical(name) {
+ continue
+ }
+ tags[w] = tags[r]
+ w++
+ }
+ tags = tags[:w]
+
+ var highestTag *github.RepositoryTag
+ var highestVname string
+ for _, tag := range tags {
+ name := vname(*tag.Name)
+ if highestTag == nil || semver.Compare(name, highestVname) > 0 {
+ highestTag = tag
+ highestVname = name
+ }
+ }
+
+ var ghURL, stripPrefix, urlComment string
+ date := time.Now().Format("2006-01-02")
+ if highestTag != nil {
+ // If the tag is part of a release, check whether there is a release
+ // artifact we should use.
+ release, _, err := gh.Repositories.GetReleaseByTag(ctx, orgName, repoName, *highestTag.Name)
+ if err == nil {
+ wantNames := []string{
+ fmt.Sprintf("%s-%s.tar.gz", repoName, *highestTag.Name),
+ fmt.Sprintf("%s-%s.zip", repoName, *highestTag.Name),
+ }
+ AssetName:
+ for _, asset := range release.Assets {
+ for _, wantName := range wantNames {
+ if *asset.Name == wantName {
+ ghURL = asset.GetBrowserDownloadURL()
+ stripPrefix = "" // may not always be correct
+ break AssetName
+ }
+ }
+ }
+ }
+ if ghURL == "" {
+ ghURL = fmt.Sprintf("https://github.com/%s/%s/archive/refs/tags/%s.zip", orgName, repoName, *highestTag.Name)
+ stripPrefix = repoName + "-" + strings.TrimPrefix(*highestTag.Name, "v")
+ }
+ urlComment = fmt.Sprintf("%s, latest as of %s", *highestTag.Name, date)
+ } else {
+ repo, _, err := gh.Repositories.Get(ctx, orgName, repoName)
+ if err != nil {
+ return err
+ }
+ defaultBranchName := "main"
+ if repo.DefaultBranch != nil {
+ defaultBranchName = *repo.DefaultBranch
+ }
+ branch, _, err := gh.Repositories.GetBranch(ctx, orgName, repoName, defaultBranchName)
+ if err != nil {
+ return err
+ }
+ ghURL = fmt.Sprintf("https://github.com/%s/%s/archive/%s.zip", orgName, repoName, *branch.Commit.SHA)
+ stripPrefix = repoName + "-" + *branch.Commit.SHA
+ urlComment = fmt.Sprintf("%s, as of %s", defaultBranchName, date)
+ }
+ ghURLWithoutScheme := ghURL[len("https://"):]
+ mirrorURL := "https://mirror.bazel.build/" + ghURLWithoutScheme
+
+ // Download the archive and find the SHA.
+ archiveFile, err := os.CreateTemp("", "")
+ if err != nil {
+ return err
+ }
+ defer func() {
+ archiveFile.Close()
+ if rerr := os.Remove(archiveFile.Name()); err == nil && rerr != nil {
+ err = rerr
+ }
+ }()
+ resp, err := http.Get(ghURL)
+ if err != nil {
+ return err
+ }
+ hw := sha256.New()
+ mw := io.MultiWriter(hw, archiveFile)
+ if _, err := io.Copy(mw, resp.Body); err != nil {
+ resp.Body.Close()
+ return err
+ }
+ if err := resp.Body.Close(); err != nil {
+ return err
+ }
+ sha256Sum := hex.EncodeToString(hw.Sum(nil))
+ if _, err := archiveFile.Seek(0, io.SeekStart); err != nil {
+ return err
+ }
+
+ // Upload the archive to mirror.bazel.build.
+ if uploadToMirror {
+ if err := copyFileToMirror(ctx, ghURLWithoutScheme, archiveFile.Name()); err != nil {
+ return err
+ }
+ }
+
+ // If there are patches, re-apply or re-generate them.
+ // Patch labels may have "# releaser:patch-cmd name args..." directives
+ // that instruct this program to generate the patch by running a commnad
+ // in the directory. If there is no such directive, we apply the old patch
+ // using "patch". In either case, we'll generate a new patch with "diff".
+ // We'll scrub the timestamps to avoid excessive diffs in the PR that
+ // updates dependencies.
+ rootDir, err := repoRoot()
+ if err != nil {
+ return err
+ }
+ if attrs["patches"] != nil {
+ if err != nil {
+ return err
+ }
+ patchDir := filepath.Join(workDir, name, "a")
+ if err := extractArchive(archiveFile, path.Base(ghURL), patchDir, stripPrefix); err != nil {
+ return err
+ }
+
+ patchesList, ok := (*attrs["patches"]).(*bzl.ListExpr)
+ if !ok {
+ return fmt.Errorf("\"patches\" attribute is not a list")
+ }
+ for patchIndex, patchLabelExpr := range patchesList.List {
+ patchLabelValue, comments, err := parsePatchesItem(patchLabelExpr)
+ if err != nil {
+ return fmt.Errorf("parsing expr %#v : %w", patchLabelExpr, err)
+ }
+
+ if !strings.HasPrefix(patchLabelValue, "//third_party:") {
+ return fmt.Errorf("patch does not start with '//third_party:': %q", patchLabelValue)
+ }
+ patchName := patchLabelValue[len("//third_party:"):]
+ patchPath := filepath.Join(rootDir, "third_party", patchName)
+ prevDir := filepath.Join(workDir, name, string('a'+patchIndex))
+ patchDir := filepath.Join(workDir, name, string('a'+patchIndex+1))
+ var patchCmd []string
+ for _, c := range comments.Before {
+ words := strings.Fields(strings.TrimPrefix(c.Token, "#"))
+ if len(words) > 0 && words[0] == "releaser:patch-cmd" {
+ patchCmd = words[1:]
+ break
+ }
+ }
+
+ if err := copyDir(patchDir, prevDir); err != nil {
+ return err
+ }
+ if patchCmd == nil {
+ if err := runForError(ctx, patchDir, "patch", "-Np1", "-i", patchPath); err != nil {
+ return err
+ }
+ } else {
+ if err := runForError(ctx, patchDir, patchCmd[0], patchCmd[1:]...); err != nil {
+ return err
+ }
+ }
+ patch, _ := runForOutput(ctx, filepath.Join(workDir, name), "diff", "-urN", string('a'+patchIndex), string('a'+patchIndex+1))
+ patch = sanitizePatch(patch)
+ if err := os.WriteFile(patchPath, patch, 0666); err != nil {
+ return err
+ }
+ }
+ }
+
+ // Update the attributes.
+ *attrs["sha256"] = &bzl.StringExpr{Value: sha256Sum}
+ *attrs["strip_prefix"] = &bzl.StringExpr{Value: stripPrefix}
+ *attrs["urls"] = &bzl.ListExpr{
+ List: []bzl.Expr{
+ &bzl.StringExpr{Value: mirrorURL},
+ &bzl.StringExpr{Value: ghURL},
+ },
+ ForceMultiLine: true,
+ }
+ urlsKwarg.Before = []bzl.Comment{{Token: "# " + urlComment}}
+
+ return nil
+}
+
+func parsePatchesItem(patchLabelExpr bzl.Expr) (value string, comments *bzl.Comments, err error) {
+ switch patchLabel := patchLabelExpr.(type) {
+ case *bzl.CallExpr:
+ // Verify the identifier, should be Label
+ if ident, ok := patchLabel.X.(*bzl.Ident); !ok {
+ return "", nil, fmt.Errorf("invalid identifier while parsing patch label")
+ } else if ident.Name != "Label" {
+ return "", nil, fmt.Errorf("invalid patch function: %q", ident.Name)
+ }
+
+ // Expect 1 String argument with the patch
+ if len(patchLabel.List) != 1 {
+ return "", nil, fmt.Errorf("Label expr should have 1 argument, found %d", len(patchLabel.List))
+ }
+
+ // Parse patch as a string
+ patchLabelStr, ok := patchLabel.List[0].(*bzl.StringExpr)
+ if !ok {
+ return "", nil, fmt.Errorf("Label expr does not contain a string literal")
+ }
+ return patchLabelStr.Value, patchLabel.Comment(), nil
+ case *bzl.StringExpr:
+ return strings.TrimPrefix(patchLabel.Value, "@io_bazel_rules_go"), patchLabel.Comment(), nil
+ default:
+ return "", nil, fmt.Errorf("not all patches are string literals or Label()")
+ }
+}
+
+// parseUpgradeDepDirective parses a '# releaser:upgrade-dep org repo' directive
+// and returns the organization and repository name or an error if the directive
+// was not found or malformed.
+func parseUpgradeDepDirective(call *bzl.CallExpr) (orgName, repoName string, err error) {
+ // TODO: support other upgrade strategies. For example, support git_repository
+ // and go_repository (possibly wrapped in _maybe).
+ for _, c := range call.Comment().Before {
+ words := strings.Fields(strings.TrimPrefix(c.Token, "#"))
+ if len(words) == 0 || words[0] != "releaser:upgrade-dep" {
+ continue
+ }
+ if len(words) != 3 {
+ return "", "", errors.New("invalid upgrade-dep directive; expected org, and name fields")
+ }
+ return words[1], words[2], nil
+ }
+ return "", "", errors.New("releaser:upgrade-dep directive not found")
+}
+
+// sanitizePatch sets all of the non-zero patch dates to the same value. This
+// reduces churn in the PR that updates the patches.
+//
+// We avoid changing zero-valued patch dates, which are used in added or
+// deleted files. Since zero-valued dates can vary a bit by time zone, we assume
+// that any year starting with "19" is a zero-valeud date.
+func sanitizePatch(patch []byte) []byte {
+ lines := bytes.Split(patch, []byte{'\n'})
+
+ for i, line := range lines {
+ if !bytes.HasPrefix(line, []byte("+++ ")) && !bytes.HasPrefix(line, []byte("--- ")) {
+ continue
+ }
+
+ tab := bytes.LastIndexByte(line, '\t')
+ if tab < 0 || bytes.HasPrefix(line[tab+1:], []byte("19")) {
+ continue
+ }
+
+ lines[i] = append(line[:tab+1], []byte("2000-01-01 00:00:00.000000000 -0000")...)
+ }
+ return bytes.Join(lines, []byte{'\n'})
+}
diff --git a/go/tools/releaser/upgradedep_test.go b/go/tools/releaser/upgradedep_test.go
new file mode 100644
index 00000000..1371add1
--- /dev/null
+++ b/go/tools/releaser/upgradedep_test.go
@@ -0,0 +1,102 @@
+package main
+
+import (
+ "fmt"
+ "testing"
+
+ bzl "github.com/bazelbuild/buildtools/build"
+)
+
+func TestPatchItemParser_Success(t *testing.T) {
+ tests := []struct {
+ expression []byte
+ result string
+ }{
+ {
+ expression: []byte(`# releaser:patch-cmd gazelle -repo_root . -go_prefix golang.org/x/tools -go_naming_convention import_alias
+ Label("//third_party:org_golang_x_tools-gazelle.patch")`),
+ result: "//third_party:org_golang_x_tools-gazelle.patch",
+ },
+ {
+ expression: []byte(`# releaser:patch-cmd gazelle -repo_root . -go_prefix golang.org/x/tools -go_naming_convention import_alias
+ "@io_bazel_rules_go//third_party:org_golang_x_tools-gazelle.patch"`),
+ result: "//third_party:org_golang_x_tools-gazelle.patch",
+ },
+ {
+ expression: []byte(`# releaser:patch-cmd gazelle -repo_root . -go_prefix golang.org/x/tools -go_naming_convention import_alias
+ "//third_party:org_golang_x_tools-gazelle.patch"`),
+ result: "//third_party:org_golang_x_tools-gazelle.patch",
+ },
+ {
+ expression: []byte(`# releaser:patch-cmd gazelle -repo_root . -go_prefix golang.org/x/tools -go_naming_convention import_alias
+ Label("@io_bazel_rules_go//third_party:org_golang_x_tools-gazelle.patch")`),
+ result: "@io_bazel_rules_go//third_party:org_golang_x_tools-gazelle.patch",
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(fmt.Sprintf("%v", tt.expression), func(t *testing.T) {
+ patchExpr, err := bzl.Parse("repos.bzl", tt.expression)
+ if err != nil {
+ t.Fatalf(err.Error())
+ }
+
+ patchLabelStr, _, err := parsePatchesItem(patchExpr.Stmt[0])
+ if err != nil {
+ t.Errorf("unexpected error while parsing expression: %q", err.Error())
+ } else if patchLabelStr != tt.result {
+ t.Errorf("expected result %q, but got result %q instead", tt.result, patchLabelStr)
+ }
+ })
+ }
+}
+
+func TestPatchItemParser_Error(t *testing.T) {
+ tests := []struct {
+ expression []byte
+ error string
+ }{
+ {
+ expression: []byte(`# releaser:patch-cmd gazelle -repo_root . -go_prefix golang.org/x/tools -go_naming_convention import_alias
+ NotLabel("//third_party:org_golang_x_tools-gazelle.patch")`),
+ error: `invalid patch function: "NotLabel"`,
+ },
+ {
+ expression: []byte(`# releaser:patch-cmd gazelle -repo_root . -go_prefix golang.org/x/tools -go_naming_convention import_alias
+ NotLabel(True)`),
+ error: `invalid patch function: "NotLabel"`,
+ },
+ {
+ expression: []byte(`# releaser:patch-cmd gazelle -repo_root . -go_prefix golang.org/x/tools -go_naming_convention import_alias
+ True`),
+ error: "not all patches are string literals or Label()",
+ },
+ {
+ expression: []byte(`# releaser:patch-cmd gazelle -repo_root . -go_prefix golang.org/x/tools -go_naming_convention import_alias
+ Label("//third_party:org_golang_x_tools-gazelle.patch", True)`),
+ error: "Label expr should have 1 argument, found 2",
+ },
+ {
+ expression: []byte(`# releaser:patch-cmd gazelle -repo_root . -go_prefix golang.org/x/tools -go_naming_convention import_alias
+ Label(True)`),
+ error: "Label expr does not contain a string literal",
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(fmt.Sprintf("%v", tt.expression), func(t *testing.T) {
+ patchExpr, err := bzl.Parse("repos.bzl", tt.expression)
+ if err != nil {
+ t.Fatalf(err.Error())
+ }
+
+ patchLabelStr, _, err := parsePatchesItem(patchExpr.Stmt[0])
+
+ if err == nil {
+ t.Errorf("expected error %q, but got result %q instead", tt.error, patchLabelStr)
+ } else if err.Error() != tt.error {
+ t.Errorf("expected error %q, but got error %q instead", tt.error, err.Error())
+ }
+ })
+ }
+}
diff --git a/go/tools/windows-testrunner/windows-testrunner.go b/go/tools/windows-testrunner/windows-testrunner.go
new file mode 100644
index 00000000..a3f25603
--- /dev/null
+++ b/go/tools/windows-testrunner/windows-testrunner.go
@@ -0,0 +1,105 @@
+package main
+
+import (
+ "flag"
+ "fmt"
+ "io/ioutil"
+ "log"
+ "os"
+ "os/exec"
+ "path/filepath"
+
+ "gopkg.in/yaml.v2"
+)
+
+func main() {
+ log.SetFlags(0)
+ log.SetPrefix("testrunner: ")
+
+ var configPath string
+ flag.StringVar(&configPath, "config", "", "location of presubmit.yml")
+ flag.Parse()
+ if configPath == "" {
+ var err error
+ configPath, err = findConfigPath()
+ if err != nil {
+ log.Fatal(err)
+ }
+ }
+
+ if err := run(configPath, flag.Args()); err != nil {
+ log.Fatal(err)
+ }
+}
+
+func run(configPath string, args []string) error {
+ configData, err := ioutil.ReadFile(configPath)
+ if err != nil {
+ return err
+ }
+ var config interface{}
+ if err := yaml.Unmarshal(configData, &config); err != nil {
+ return err
+ }
+
+ platform := config.(map[interface{}]interface{})["platforms"].(map[interface{}]interface{})["windows"].(map[interface{}]interface{})
+ var buildFlags []string
+ for _, f := range platform["build_flags"].([]interface{}) {
+ buildFlags = append(buildFlags, f.(string))
+ }
+ testFlags := buildFlags
+ for _, f := range platform["test_flags"].([]interface{}) {
+ testFlags = append(testFlags, f.(string))
+ }
+ var buildTargets, testTargets []string
+ if len(args) == 0 {
+ for _, t := range platform["build_targets"].([]interface{}) {
+ buildTargets = append(buildTargets, t.(string))
+ }
+ for _, t := range platform["test_targets"].([]interface{}) {
+ testTargets = append(testTargets, t.(string))
+ }
+ } else {
+ buildTargets = args
+ testTargets = args
+ }
+
+ buildCmd := exec.Command("bazel", "build")
+ buildCmd.Args = append(buildCmd.Args, buildFlags...)
+ buildCmd.Args = append(buildCmd.Args, buildTargets...)
+ buildCmd.Stdout = os.Stdout
+ buildCmd.Stderr = os.Stderr
+ if err := buildCmd.Run(); err != nil {
+ return err
+ }
+
+ testCmd := exec.Command("bazel", "test")
+ testCmd.Args = append(testCmd.Args, testFlags...)
+ testCmd.Args = append(testCmd.Args, testTargets...)
+ testCmd.Stdout = os.Stdout
+ testCmd.Stderr = os.Stderr
+ if err := testCmd.Run(); err != nil {
+ return err
+ }
+
+ return nil
+}
+
+func findConfigPath() (string, error) {
+ d, err := os.Getwd()
+ if err != nil {
+ return "", err
+ }
+ for {
+ configPath := filepath.Join(d, ".bazelci/presubmit.yml")
+ _, err := os.Stat(configPath)
+ if !os.IsNotExist(err) {
+ return configPath, nil
+ }
+ parent := filepath.Dir(d)
+ if parent == d {
+ return "", fmt.Errorf("could not find presubmit.yml")
+ }
+ d = parent
+ }
+}
diff --git a/proto/BUILD.bazel b/proto/BUILD.bazel
new file mode 100644
index 00000000..2125a938
--- /dev/null
+++ b/proto/BUILD.bazel
@@ -0,0 +1,166 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+load(
+ "//proto:compiler.bzl",
+ "go_proto_compiler",
+)
+load(
+ "//go/private/rules:transition.bzl",
+ "non_go_reset_target",
+)
+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(
+ name = "go_proto_bootstrap",
+ visibility = ["//visibility:public"],
+ deps = PROTO_RUNTIME_DEPS,
+)
+
+go_proto_compiler(
+ name = "go_proto",
+ visibility = ["//visibility:public"],
+ deps = PROTO_RUNTIME_DEPS + WELL_KNOWN_TYPES_APIV2,
+)
+
+go_proto_compiler(
+ name = "go_grpc",
+ options = ["plugins=grpc"],
+ visibility = ["//visibility:public"],
+ deps = PROTO_RUNTIME_DEPS + WELL_KNOWN_TYPES_APIV2 + [
+ "@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",
+ ],
+)
+
+go_proto_compiler(
+ name = "go_proto_validate",
+ plugin = "@com_github_mwitkow_go_proto_validators//protoc-gen-govalidators",
+ suffix = ".validator.pb.go",
+ valid_archive = False,
+ visibility = ["//visibility:public"],
+ deps = [
+ "@com_github_golang_protobuf//proto:go_default_library",
+ "@com_github_mwitkow_go_proto_validators//:validators_golang",
+ ],
+)
+
+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",
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_rules",
+ testonly = True,
+ srcs = glob(["*.bzl"]) + ["//proto/wkt:all_rules"],
+ visibility = ["//:__subpackages__"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]) + ["//proto/wkt:all_files"],
+ visibility = ["//:__subpackages__"],
+)
+
+bzl_library(
+ name = "compiler",
+ srcs = ["compiler.bzl"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "//go:def",
+ "//go/private/rules:transition",
+ "@bazel_skylib//lib:paths",
+ ],
+)
+
+bzl_library(
+ name = "def",
+ srcs = ["def.bzl"],
+ visibility = ["//visibility:public"],
+ # Don't list dependency on @rules_proto//proto:defs
+ deps = [
+ "//go:def",
+ "//go/private:providers",
+ "//proto:compiler",
+ ], # keep
+)
+
+bzl_library(
+ name = "gogo",
+ srcs = ["gogo.bzl"],
+ visibility = ["//visibility:public"],
+)
diff --git a/proto/compiler.bzl b/proto/compiler.bzl
new file mode 100644
index 00000000..3601c7bf
--- /dev/null
+++ b/proto/compiler.bzl
@@ -0,0 +1,229 @@
+# Copyright 2017 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "@bazel_skylib//lib:paths.bzl",
+ "paths",
+)
+load(
+ "//go:def.bzl",
+ "GoLibrary",
+ "go_context",
+)
+load(
+ "//go/private:go_toolchain.bzl",
+ "GO_TOOLCHAIN",
+)
+load(
+ "//go/private/rules:transition.bzl",
+ "go_reset_target",
+)
+
+GoProtoCompiler = provider(
+ doc = "Information and dependencies needed to generate Go code from protos",
+ fields = {
+ "compile": """A function with the signature:
+
+ def compile(go, compiler, protos, imports, importpath)
+
+where go is the go_context object, compiler is this GoProtoCompiler, protos
+is a list of ProtoInfo providers for protos to compile, imports is a depset
+of strings mapping proto import paths to Go import paths, and importpath is
+the import path of the Go library being generated.
+
+The function should declare output .go files and actions to generate them.
+It should return a list of .go Files to be compiled by the Go compiler.
+""",
+ "deps": """List of targets providing GoLibrary, GoSource, and GoArchive.
+These are added as implicit dependencies for any go_proto_library using this
+compiler. Typically, these are Well Known Types and proto runtime libraries.""",
+ "valid_archive": """A Boolean indicating whether the .go files produced
+by this compiler are buildable on their own. Compilers that just add methods
+to structs produced by other compilers will set this to False.""",
+ "internal": "Opaque value containing data used by compile.",
+ },
+)
+
+def go_proto_compile(go, compiler, protos, imports, importpath):
+ """Invokes protoc to generate Go sources for a given set of protos
+
+ Args:
+ go: the go object, returned by go_context.
+ compiler: a GoProtoCompiler provider.
+ protos: list of ProtoInfo providers for protos to compile.
+ imports: depset of strings mapping proto import paths to Go import paths.
+ importpath: the import path of the Go library being generated.
+
+ Returns:
+ A list of .go Files generated by the compiler.
+ """
+
+ go_srcs = []
+ outpath = None
+ proto_paths = {}
+ desc_sets = []
+ for proto in protos:
+ desc_sets.append(proto.transitive_descriptor_sets)
+ for src in proto.check_deps_sources.to_list():
+ path = proto_path(src, proto)
+ if path in proto_paths:
+ if proto_paths[path] != src:
+ fail("proto files {} and {} have the same import path, {}".format(
+ src.path,
+ proto_paths[path].path,
+ path,
+ ))
+ continue
+ proto_paths[path] = src
+
+ out = go.declare_file(
+ go,
+ path = importpath + "/" + src.basename[:-len(".proto")],
+ ext = compiler.internal.suffix,
+ )
+ go_srcs.append(out)
+ if outpath == None:
+ outpath = out.dirname[:-len(importpath)]
+
+ transitive_descriptor_sets = depset(direct = [], transitive = desc_sets)
+
+ args = go.actions.args()
+ args.add("-protoc", compiler.internal.protoc)
+ args.add("-importpath", importpath)
+ args.add("-out_path", outpath)
+ args.add("-plugin", compiler.internal.plugin)
+
+ # TODO(jayconrod): can we just use go.env instead?
+ args.add_all(compiler.internal.options, before_each = "-option")
+ if compiler.internal.import_path_option:
+ args.add_all([importpath], before_each = "-option", format_each = "import_path=%s")
+ args.add_all(transitive_descriptor_sets, before_each = "-descriptor_set")
+ args.add_all(go_srcs, before_each = "-expected")
+ args.add_all(imports, before_each = "-import")
+ args.add_all(proto_paths.keys())
+ args.use_param_file("-param=%s")
+ go.actions.run(
+ inputs = depset(
+ direct = [
+ compiler.internal.go_protoc,
+ compiler.internal.protoc,
+ compiler.internal.plugin,
+ ],
+ transitive = [transitive_descriptor_sets],
+ ),
+ outputs = go_srcs,
+ progress_message = "Generating into %s" % go_srcs[0].dirname,
+ mnemonic = "GoProtocGen",
+ executable = compiler.internal.go_protoc,
+ arguments = [args],
+ env = go.env,
+ # We may need the shell environment (potentially augmented with --action_env)
+ # to invoke protoc on Windows. If protoc was built with mingw, it probably needs
+ # .dll files in non-default locations that must be in PATH. The target configuration
+ # may not have a C compiler, so we have no idea what PATH should be.
+ use_default_shell_env = "PATH" not in go.env,
+ )
+ return go_srcs
+
+def proto_path(src, proto):
+ """proto_path returns the string used to import the proto. This is the proto
+ source path within its repository, adjusted by import_prefix and
+ strip_import_prefix.
+
+ Args:
+ src: the proto source File.
+ proto: the ProtoInfo provider.
+
+ Returns:
+ An import path string.
+ """
+ if proto.proto_source_root == ".":
+ # true if proto sources were generated
+ prefix = src.root.path + "/"
+ elif proto.proto_source_root.startswith(src.root.path):
+ # sometimes true when import paths are adjusted with import_prefix
+ prefix = proto.proto_source_root + "/"
+ else:
+ # usually true when paths are not adjusted
+ prefix = paths.join(src.root.path, proto.proto_source_root) + "/"
+ if not src.path.startswith(prefix):
+ # sometimes true when importing multiple adjusted protos
+ return src.path
+ return src.path[len(prefix):]
+
+def _go_proto_compiler_impl(ctx):
+ go = go_context(ctx)
+ library = go.new_library(go)
+ source = go.library_to_source(go, ctx.attr, library, ctx.coverage_instrumented())
+ return [
+ GoProtoCompiler(
+ deps = ctx.attr.deps,
+ compile = go_proto_compile,
+ valid_archive = ctx.attr.valid_archive,
+ internal = struct(
+ options = ctx.attr.options,
+ suffix = ctx.attr.suffix,
+ protoc = ctx.executable._protoc,
+ go_protoc = ctx.executable._go_protoc,
+ plugin = ctx.executable.plugin,
+ import_path_option = ctx.attr.import_path_option,
+ ),
+ ),
+ library,
+ source,
+ ]
+
+_go_proto_compiler = rule(
+ implementation = _go_proto_compiler_impl,
+ attrs = {
+ "deps": attr.label_list(providers = [GoLibrary]),
+ "options": attr.string_list(),
+ "suffix": attr.string(default = ".pb.go"),
+ "valid_archive": attr.bool(default = True),
+ "import_path_option": attr.bool(default = False),
+ "plugin": attr.label(
+ executable = True,
+ cfg = "exec",
+ mandatory = True,
+ ),
+ "_go_protoc": attr.label(
+ executable = True,
+ cfg = "exec",
+ default = "//go/tools/builders:go-protoc",
+ ),
+ "_protoc": attr.label(
+ executable = True,
+ cfg = "exec",
+ default = "//proto:protoc",
+ ),
+ "_go_context_data": attr.label(
+ default = "//:go_context_data",
+ ),
+ },
+ toolchains = [GO_TOOLCHAIN],
+)
+
+def go_proto_compiler(name, **kwargs):
+ plugin = kwargs.pop("plugin", "@com_github_golang_protobuf//protoc-gen-go")
+ reset_plugin_name = name + "_reset_plugin_"
+ go_reset_target(
+ name = reset_plugin_name,
+ dep = plugin,
+ visibility = ["//visibility:private"],
+ )
+ _go_proto_compiler(
+ name = name,
+ plugin = reset_plugin_name,
+ **kwargs
+ )
diff --git a/proto/core.rst b/proto/core.rst
new file mode 100644
index 00000000..9c765729
--- /dev/null
+++ b/proto/core.rst
@@ -0,0 +1,500 @@
+Go Protocol buffers
+===================
+
+.. _proto_library: https://docs.bazel.build/versions/master/be/protocol-buffer.html#proto_library
+.. _default Go plugin: https://github.com/golang/protobuf
+.. _common plugins: #predefined-plugins
+.. _Go providers: /go/providers.rst
+.. _GoLibrary: /go/providers.rst#golibrary
+.. _GoSource: /go/providers.rst#gosource
+.. _GoArchive: /go/providers.rst#goarchive
+.. _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)
+.. role:: type(emphasis)
+.. role:: value(code)
+.. |mandatory| replace:: **mandatory value**
+
+rules_go provides rules that generate Go packages from .proto files. These
+packages can be imported like regular Go libraries.
+
+.. contents:: :depth: 2
+
+-----
+
+Overview
+--------
+
+Protocol buffers are built with the three rules below. ``go_proto_library`` and
+``go_proto_compiler`` may be loaded from ``@io_bazel_rules_go//proto:def.bzl``.
+
+* `proto_library`_: This is a Bazel built-in rule. It lists a set of .proto
+ files in its ``srcs`` attribute and lists other ``proto_library`` dependencies
+ in its ``deps`` attribute. ``proto_library`` rules may be referenced by
+ language-specific code generation rules like ``java_proto_library`` and
+ ``go_proto_library``.
+* `go_proto_library`_: Generates Go code from .proto files using one or more
+ proto plugins, then builds that code into a Go library. ``go_proto_library``
+ references ``proto_library`` sources via the ``proto`` attribute. They may
+ reference other ``go_proto_library`` and ``go_library`` dependencies via the
+ ``deps`` attributes. ``go_proto_library`` rules can be depended on or
+ embedded directly by ``go_library`` and ``go_binary``.
+* `go_proto_compiler`_: Defines a protoc plugin. By default,
+ ``go_proto_library`` generates Go code with the `default Go plugin`_, but
+ other plugins can be used by setting the ``compilers`` attribute. A few
+ `common plugins`_ are provided in ``@io_bazel_rules_go//proto``.
+
+The ``go_proto_compiler`` rule produces a `GoProtoCompiler`_ provider. If you
+need a greater degree of customization (for example, if you don't want to use
+protoc), you can implement a compatible rule that returns one of these.
+
+The ``go_proto_library`` rule produces the normal set of `Go providers`_. This
+makes it compatible with other Go rules for use in ``deps`` and ``embed``
+attributes.
+
+Avoiding conflicts
+------------------
+
+When linking programs that depend on protos, care must be taken to ensure that
+the same proto isn't registered by more than one package. This may happen if
+you depend on a ``go_proto_library`` and a vendored ``go_library`` generated
+from the same .proto files. You may see compile-time, link-time, or run-time
+errors as a result of this.
+
+There are two main ways to avoid conflicts.
+
+Option 1: Use go_proto_library exclusively
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You can avoid proto conflicts by using ``go_proto_library`` to generate code
+at build time and avoiding ``go_library`` rules based on pre-generated .pb.go
+files.
+
+Gazelle generates rules in this mode by default. When .proto files are present,
+it will generate ``go_proto_library`` rules and ``go_library`` rules that embed
+them (which are safe to use). Gazelle will automatically exclude .pb.go files
+that correspond to .proto files. If you have .proto files belonging to multiple
+packages in the same directory, add the following directives to your
+root build file:
+
+.. code:: bzl
+
+ # gazelle:proto package
+ # gazelle:proto_group go_package
+
+rules_go provides ``go_proto_library`` rules for commonly used proto libraries.
+The Well Known Types can be found in the ``@io_bazel_rules_go//proto/wkt``
+package. There are implicit dependencies of ``go_proto_library`` rules
+that use the default compiler, so they don't need to be written
+explicitly in ``deps``. You can also find rules for Google APIs and gRPC in
+``@go_googleapis//``. You can list these rules with the commands:
+
+.. code:: bash
+
+ $ bazel query 'kind(go_proto_library, @io_bazel_rules_go//proto/wkt:all)'
+ $ bazel query 'kind(go_proto_library, @go_googleapis//...)'
+
+Some commonly used Go libraries, such as ``github.com/golang/protobuf/ptypes``,
+depend on the Well Known Types. In order to avoid conflicts when using these
+libraries, separate versions of these libraries are provided with
+``go_proto_library`` dependencies. Gazelle resolves imports of these libraries
+automatically. For example, it will resolve ``ptypes`` as
+``@com_github_golang_protobuf//ptypes:go_default_library_gen``.
+
+Option 2: Use pre-generated .pb.go files
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+You can also avoid conflicts by generating .pb.go files ahead of time and using
+those exclusively instead of using ``go_proto_library``. This may be a better
+option for established Go projects that also need to build with ``go build``.
+
+Gazelle can generate rules for projects built in this mode. Add the following
+comment to your root build file:
+
+.. code:: bzl
+
+ # gazelle:proto disable_global
+
+This prevents Gazelle from generating ``go_proto_library`` rules. .pb.go files
+won't be excluded, and all special cases for imports (such as ``ptypes``) are
+disabled.
+
+If you have ``go_repository`` rules in your ``WORKSPACE`` file that may
+have protos, you'll also need to add
+``build_file_proto_mode = "disable_global"`` to those as well.
+
+.. code:: bzl
+
+ go_repository(
+ name = "com_example_some_project",
+ importpath = "example.com/some/project",
+ tag = "v0.1.2",
+ build_file_proto_mode = "disable_global",
+ )
+
+A note on vendored .proto files
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+By default, Bazel assumes imports in .proto files are relative to a repository
+root directory. This means, for example, if you import ``"foo/bar/baz.proto"``,
+that file must be in the directory ``foo/bar``, not
+``vendor/example.com/repo/foo/bar``.
+
+To deal with this, use the `strip_import_prefix` option in the proto_library_
+for the vendored file.
+
+API
+---
+
+go_proto_library
+~~~~~~~~~~~~~~~~
+
+``go_proto_library`` generates a set of .go files from a set of .proto files
+(specified in a ``proto_library`` rule), then builds a Go library from those
+files. ``go_proto_library`` can be imported like any ``go_library`` rule.
+
+Providers
+^^^^^^^^^
+
+* GoLibrary_
+* GoSource_
+* GoArchive_
+
+Attributes
+^^^^^^^^^^
+
++---------------------+----------------------+-------------------------------------------------+
+| **Name** | **Type** | **Default value** |
++---------------------+----------------------+-------------------------------------------------+
+| :param:`name` | :type:`string` | |mandatory| |
++---------------------+----------------------+-------------------------------------------------+
+| A unique name for this rule. |
+| |
+| By convention, and in order to interoperate cleanly with Gazelle_, this |
+| should be a name like ``foo_go_proto``, where ``foo`` is the Go package name |
+| or the last component of the proto package name (hopefully the same). The |
+| ``proto_library`` referenced by ``proto`` should be named ``foo_proto``. |
++---------------------+----------------------+-------------------------------------------------+
+| :param:`proto` | :type:`label` | |mandatory| |
++---------------------+----------------------+-------------------------------------------------+
+| Points to the ``proto_library`` containing the .proto sources this rule |
+| should generate code from. Avoid using this argument, use ``protos`` instead. |
++---------------------+----------------------+-------------------------------------------------+
+| :param:`protos` | :type:`label` | |mandatory| |
++---------------------+----------------------+-------------------------------------------------+
+| List of ``proto_library`` targets containing the .proto sources this rule should generate |
+| code from. This argument should be used instead of ``proto`` argument. |
++---------------------+----------------------+-------------------------------------------------+
+| :param:`deps` | :type:`label_list` | :value:`[]` |
++---------------------+----------------------+-------------------------------------------------+
+| List of Go libraries this library depends on directly. Usually, this will be |
+| a list of ``go_proto_library`` rules that correspond to the ``deps`` of the |
+| ``proto_library`` rule referenced by ``proto``. |
+| |
+| Additional dependencies may be added by the proto compiler. For example, the |
+| default compiler implicitly adds dependencies on the ``go_proto_library`` |
+| rules for the Well Known Types. |
++---------------------+----------------------+-------------------------------------------------+
+| :param:`importpath` | :type:`string` | |mandatory| |
++---------------------+----------------------+-------------------------------------------------+
+| The source import path of this library. Other libraries can import this |
+| library using this path. This must be specified in ``go_proto_library`` or |
+| inherited from one of the targets in ``embed``. |
+| |
+| ``importpath`` must match the import path specified in ``.proto`` files using |
+| ``option go_package``. The option determines how ``.pb.go`` files generated |
+| for protos importing this proto will import this package. |
++---------------------+----------------------+-------------------------------------------------+
+| :param:`importmap` | :type:`string` | :value:`""` |
++---------------------+----------------------+-------------------------------------------------+
+| The Go package path of this library. This is mostly only visible to the |
+| compiler and linker, but it may also be seen in stack traces. This may be |
+| set to prevent a binary from linking multiple packages with the same import |
+| path, e.g., from different vendor directories. |
++---------------------+----------------------+-------------------------------------------------+
+| :param:`embed` | :type:`label_list` | :value:`[]` |
++---------------------+----------------------+-------------------------------------------------+
+| List of Go libraries that should be combined with this library. The ``srcs`` |
+| and ``deps`` from these libraries will be incorporated into this library when it |
+| is compiled. Embedded libraries must have the same ``importpath`` and |
+| Go package name. |
++---------------------+----------------------+-------------------------------------------------+
+| :param:`gc_goopts` | :type:`string_list` | :value:`[]` |
++---------------------+----------------------+-------------------------------------------------+
+| List of flags to add to the Go compilation command when using the gc |
+| compiler. Subject to `Make variable substitution`_ and `Bourne shell tokenization`_. |
++---------------------+----------------------+-------------------------------------------------+
+| :param:`compiler` | :type:`label` | :value:`None` |
++---------------------+----------------------+-------------------------------------------------+
+| Equivalent to ``compilers`` with a single label. |
++---------------------+----------------------+-------------------------------------------------+
+| :param:`compilers` | :type:`label_list` | :value:`["@io_bazel_rules_go//proto:go_proto"]` |
++---------------------+----------------------+-------------------------------------------------+
+| List of rules producing `GoProtoCompiler`_ providers (normally |
+| `go_proto_compiler`_ rules). This is usually understood to be a list of |
+| protoc plugins used to generate Go code. See `Predefined plugins`_ for |
+| some options. |
++---------------------+----------------------+-------------------------------------------------+
+
+Example: Basic proto
+^^^^^^^^^^^^^^^^^^^^
+
+Suppose you have two .proto files in separate packages: foo/foo.proto and
+bar/bar.proto. foo/foo.proto looks like this:
+
+.. code:: proto
+
+ syntax = "proto3";
+
+ option go_package = "example.com/repo/foo";
+
+ import "google/protobuf/any.proto";
+ import "bar/bar.proto";
+
+ message Foo {
+ bar.Bar x = 1;
+ google.protobuf.Any y = 2;
+ };
+
+In foo/BUILD.bazel, we need to declare a ``proto_library`` rule that lists
+foo.proto in its ``srcs`` attribute. Since we import some other protos, we
+also need a label in ``deps`` for each imported package. We will need to
+create another ``proto_library`` in bar/BUILD.bazel, but we can use an
+existing library for any.proto, since it's one of the Well Known Types.
+
+.. code:: bzl
+
+ proto_library(
+ name = "foo_proto",
+ srcs = ["foo.proto"],
+ deps = [
+ "//bar:bar_proto",
+ "@com_google_protobuf//:any_proto",
+ ],
+ visibility = ["//visibility:public"],
+ )
+
+In order to these this proto in Go, we need to declare a ``go_proto_library``
+that references to ``proto_library`` to be built via the ``proto`` attribute.
+Like ``go_library``, an ``importpath`` attribute needs to be declared.
+Ideally, this should match the ``option go_package`` declaration in the .proto
+file, but this is not required. We also need to list Go packages that the
+generated Go code imports in the ``deps`` attributes. Generally, ``deps``
+in ``go_proto_library`` will correspond with ``deps`` in ``proto_library``,
+but the Well Known Types don't need to be listed (they are added automatically
+by the compiler in use).
+
+.. code:: bzl
+
+ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+
+ go_proto_library(
+ name = "foo_go_proto",
+ importpath = "example.com/repo/foo",
+ proto = ":foo_proto",
+ visibility = ["//visibility:public"],
+ deps = ["//bar:bar_go_proto"],
+ )
+
+This library can be imported like a regular Go library by other rules.
+
+.. code:: bzl
+
+ load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+ go_binary(
+ name = "main",
+ srcs = ["main.go"],
+ deps = ["//foo:foo_go_proto"],
+ )
+
+If you need to add additional source files to a package built from protos,
+you can do so with a separate ``go_library`` that embeds the
+``go_proto_library``.
+
+.. code:: bzl
+
+ load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+ go_library(
+ name = "foo",
+ srcs = ["extra.go"],
+ embed = [":foo_go_proto"],
+ importpath = "example.com/repo/foo",
+ visibility = ["//visibility:public"],
+ )
+
+For convenience, ``proto_library``, ``go_proto_library``, and ``go_binary``
+can all be generated by Gazelle_.
+
+Example: gRPC
+^^^^^^^^^^^^^
+
+To compile protos that contain service definitions, just use the ``go_grpc``
+plugin.
+
+.. code:: bzl
+
+ load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+
+ proto_library(
+ name = "foo_proto",
+ srcs = ["foo.proto"],
+ visibility = ["//visibility:public"],
+ )
+
+ go_proto_library(
+ name = "foo_go_proto",
+ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+ importpath = "example.com/repo/foo",
+ proto = ":foo_proto",
+ visibility = ["//visibility:public"],
+ deps = ["//bar:bar_go_proto"],
+ )
+
+go_proto_compiler
+~~~~~~~~~~~~~~~~~
+
+``go_proto_compiler`` describes a plugin for protoc, the proto compiler.
+Different plugins will generate different Go code from the same protos.
+Compilers may be chosen through the ``compilers`` attribute of
+``go_proto_library``.
+
+Several instances of this rule are listed in `Predefined plugins`_. You will
+only need to use this rule directly if you need a plugin which is not there.
+
+Providers
+^^^^^^^^^
+
+* GoProtoCompiler_
+* GoLibrary_
+* GoSource_
+
+Attributes
+^^^^^^^^^^
+
++-----------------------------+----------------------+-----------------------------------------------------+
+| **Name** | **Type** | **Default value** |
++-----------------------------+----------------------+-----------------------------------------------------+
+| :param:`name` | :type:`string` | |mandatory| |
++-----------------------------+----------------------+-----------------------------------------------------+
+| A unique name for this rule. |
++-----------------------------+----------------------+-----------------------------------------------------+
+| :param:`deps` | :type:`label_list` | :value:`[]` |
++-----------------------------+----------------------+-----------------------------------------------------+
+| List of Go libraries that Go code *generated by* this compiler depends on |
+| implicitly. Rules in this list must produce the `GoLibrary`_ provider. This |
+| should contain libraries for the Well Known Types at least. |
++-----------------------------+----------------------+-----------------------------------------------------+
+| :param:`options` | :type:`string_list` | :value:`[]` |
++-----------------------------+----------------------+-----------------------------------------------------+
+| List of command line options to be passed to the compiler. Each option will |
+| be preceded by ``--option``. |
++-----------------------------+----------------------+-----------------------------------------------------+
+| :param:`suffix` | :type:`string` | :value:`.pb.go` |
++-----------------------------+----------------------+-----------------------------------------------------+
+| File name suffix of generated Go files. ``go_proto_compiler`` assumes that |
+| one Go file will be generated for each input .proto file. Output file names |
+| will have the .proto suffix removed and this suffix appended. For example, |
+| ``foo.proto`` will become ``foo.pb.go``. |
++-----------------------------+----------------------+-----------------------------------------------------+
+| :param:`valid_archive` | :type:`bool` | :value:`True` |
++-----------------------------+----------------------+-----------------------------------------------------+
+| Whether code generated by this compiler can be compiled into a standalone |
+| archive file without additional sources. |
++-----------------------------+----------------------+-----------------------------------------------------+
+| :param:`import_path_option` | :type:`bool` | :value:`True` |
++-----------------------------+----------------------+-----------------------------------------------------+
+| When true, the ``importpath`` attribute from ``go_proto_library`` rules |
+| using this compiler will be passed to the compiler on the command line as |
+| ``--option import_path={}``. |
++-----------------------------+----------------------+-----------------------------------------------------+
+| :param:`plugin` | :type:`label` | :value:`@com_github_golang_protobuf//protoc-gen-go` |
++-----------------------------+----------------------+-----------------------------------------------------+
+| The plugin to use with protoc via the ``--plugin`` option. This rule must |
+| produce an executable file. |
++-----------------------------+----------------------+-----------------------------------------------------+
+
+Predefined plugins
+------------------
+
+Several ``go_proto_compiler`` rules are predefined in
+``@io_bazel_rules_go//proto``.
+
+* ``go_proto``: default plugin from github.com/golang/protobuf.
+* ``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
+---------
+
+Providers are objects produced by Bazel rules and consumed by other rules that
+depend on them. See `Go providers`_ for information about Go providers,
+specifically GoLibrary_, GoSource_, and GoArchive_.
+
+GoProtoCompiler
+~~~~~~~~~~~~~~~
+
+GoProtoCompiler is the provider returned by the ``go_proto_compiler`` rule and
+anything compatible with it. The ``go_proto_library`` rule expects any rule
+listed in its ``compilers`` attribute to provide ``GoProtoCompiler``. If the
+``go_proto_compiler`` rule doesn't do what you need (e.g., you don't want to
+use protoc), you can write a new rule that produces this.
+
+``GoProtoCompiler`` is loaded from ``@io_bazel_rules_go//proto:def.bzl``.
+
+``GoProtoCompiler`` has the fields described below. Additional fields may be
+added to pass information to the ``compile`` function. This interface is
+*not final* and may change in the future.
+
++-----------------------------+-------------------------------------------------+
+| **Name** | **Type** |
++-----------------------------+-------------------------------------------------+
+| :param:`deps` | :type:`Target list` |
++-----------------------------+-------------------------------------------------+
+| A list of Go libraries to be added as dependencies to any |
+| ``go_proto_library`` compiled with this compiler. Each target must provide |
+| GoLibrary_, GoSource_, and GoArchive_. This list should include libraries |
+| for the Well Known Types and anything else considered "standard". |
++-----------------------------+-------------------------------------------------+
+| :param:`compile` | :type:`Function` |
++-----------------------------+-------------------------------------------------+
+| A function which declares output files and actions when called. See |
+| `compiler.bzl`_ for details. |
++-----------------------------+-------------------------------------------------+
+| :param:`valid_archive` | :type:`bool` |
++-----------------------------+-------------------------------------------------+
+| Whether the compiler produces a complete Go library. Compilers that just add |
+| methods to structs produced by other compilers will set this to false. |
++-----------------------------+-------------------------------------------------+
+
+Dependencies
+------------
+
+In order to support protocol buffers, rules_go declares the external
+repositories listed below in ``go_rules_dependencies()``. These repositories
+will only be downloaded if proto rules are used.
+
+* ``@com_google_protobuf (github.com/google/protobuf)``: Well Known Types and
+ general proto support.
+* ``@com_github_golang_protobuf (github.com/golang/protobuf)``: standard
+ 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
+
+ * ``@org_golang_x_net (golang.org/x/net)``
+ * ``@org_golang_x_text (golang.org/x/text)``
+ * ``@org_golang_google_genproto (google.golang.org/genproto)``
diff --git a/proto/def.bzl b/proto/def.bzl
new file mode 100644
index 00000000..381078ec
--- /dev/null
+++ b/proto/def.bzl
@@ -0,0 +1,195 @@
+# Copyright 2017 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "//go:def.bzl",
+ "GoLibrary",
+ "GoSource",
+ "go_context",
+)
+load(
+ "@bazel_skylib//lib:types.bzl",
+ "types",
+)
+load(
+ "//proto:compiler.bzl",
+ "GoProtoCompiler",
+ "proto_path",
+)
+load(
+ "//go/private:go_toolchain.bzl",
+ "GO_TOOLCHAIN",
+)
+load(
+ "//go/private:providers.bzl",
+ "INFERRED_PATH",
+)
+load(
+ "//go/private/rules:transition.bzl",
+ "non_go_tool_transition",
+)
+load(
+ "@rules_proto//proto:defs.bzl",
+ "ProtoInfo",
+)
+
+GoProtoImports = provider()
+
+def get_imports(attr):
+ proto_deps = []
+
+ # ctx.attr.proto is a one-element array since there is a Starlark transition attached to it.
+ if hasattr(attr, "proto") and attr.proto and types.is_list(attr.proto) and ProtoInfo in attr.proto[0]:
+ proto_deps = [attr.proto[0]]
+ elif hasattr(attr, "protos"):
+ proto_deps = [d for d in attr.protos if ProtoInfo in d]
+ else:
+ proto_deps = []
+
+ direct = dict()
+ for dep in proto_deps:
+ for src in dep[ProtoInfo].check_deps_sources.to_list():
+ direct["{}={}".format(proto_path(src, dep[ProtoInfo]), attr.importpath)] = True
+
+ deps = getattr(attr, "deps", []) + getattr(attr, "embed", [])
+ transitive = [
+ dep[GoProtoImports].imports
+ for dep in deps
+ if GoProtoImports in dep
+ ]
+ return depset(direct = direct.keys(), transitive = transitive)
+
+def _go_proto_aspect_impl(_target, ctx):
+ imports = get_imports(ctx.rule.attr)
+ return [GoProtoImports(imports = imports)]
+
+_go_proto_aspect = aspect(
+ _go_proto_aspect_impl,
+ attr_aspects = [
+ "deps",
+ "embed",
+ ],
+)
+
+def _proto_library_to_source(_go, attr, source, merge):
+ if attr.compiler:
+ compilers = [attr.compiler]
+ else:
+ compilers = attr.compilers
+ for compiler in compilers:
+ if GoSource in compiler:
+ merge(source, compiler[GoSource])
+
+def _go_proto_library_impl(ctx):
+ go = go_context(ctx)
+ if go.pathtype == INFERRED_PATH:
+ fail("importpath must be specified in this library or one of its embedded libraries")
+ if ctx.attr.compiler:
+ #TODO: print("DEPRECATED: compiler attribute on {}, use compilers instead".format(ctx.label))
+ compilers = [ctx.attr.compiler]
+ else:
+ compilers = ctx.attr.compilers
+
+ if ctx.attr.proto:
+ #TODO: print("DEPRECATED: proto attribute on {}, use protos instead".format(ctx.label))
+ if ctx.attr.protos:
+ fail("Either proto or protos (non-empty) argument must be specified, but not both")
+
+ # ctx.attr.proto is a one-element array since there is a Starlark transition attached to it.
+ proto_deps = [ctx.attr.proto[0]]
+ else:
+ if not ctx.attr.protos:
+ fail("Either proto or protos (non-empty) argument must be specified")
+ proto_deps = ctx.attr.protos
+
+ go_srcs = []
+ valid_archive = False
+
+ for c in compilers:
+ compiler = c[GoProtoCompiler]
+ if compiler.valid_archive:
+ valid_archive = True
+ go_srcs.extend(compiler.compile(
+ go,
+ compiler = compiler,
+ protos = [d[ProtoInfo] for d in proto_deps],
+ imports = get_imports(ctx.attr),
+ importpath = go.importpath,
+ ))
+ library = go.new_library(
+ go,
+ resolver = _proto_library_to_source,
+ srcs = go_srcs,
+ )
+ source = go.library_to_source(go, ctx.attr, library, False)
+ providers = [library, source]
+ output_groups = {
+ "go_generated_srcs": go_srcs,
+ }
+ if valid_archive:
+ archive = go.archive(go, source)
+ output_groups["compilation_outputs"] = [archive.data.file]
+ providers.extend([
+ archive,
+ DefaultInfo(
+ files = depset([archive.data.file]),
+ runfiles = archive.runfiles,
+ ),
+ ])
+ return providers + [OutputGroupInfo(**output_groups)]
+
+go_proto_library = rule(
+ implementation = _go_proto_library_impl,
+ attrs = {
+ "proto": attr.label(
+ cfg = non_go_tool_transition,
+ providers = [ProtoInfo],
+ ),
+ "protos": attr.label_list(
+ cfg = non_go_tool_transition,
+ providers = [ProtoInfo],
+ default = [],
+ ),
+ "deps": attr.label_list(
+ providers = [GoLibrary],
+ aspects = [_go_proto_aspect],
+ ),
+ "importpath": attr.string(),
+ "importmap": attr.string(),
+ "importpath_aliases": attr.string_list(), # experimental, undocumented
+ "embed": attr.label_list(providers = [GoLibrary]),
+ "gc_goopts": attr.string_list(),
+ "compiler": attr.label(providers = [GoProtoCompiler]),
+ "compilers": attr.label_list(
+ providers = [GoProtoCompiler],
+ default = ["//proto:go_proto"],
+ ),
+ "_go_context_data": attr.label(
+ default = "//:go_context_data",
+ ),
+ "_allowlist_function_transition": attr.label(
+ default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
+ ),
+ },
+ toolchains = [GO_TOOLCHAIN],
+)
+# go_proto_library is a rule that takes a proto_library (in the proto
+# attribute) and produces a go library for it.
+
+def go_grpc_library(**kwargs):
+ # TODO: Deprecate once gazelle generates just go_proto_library
+ go_proto_library(compilers = [Label("//proto:go_grpc")], **kwargs)
+
+def proto_register_toolchains():
+ print("You no longer need to call proto_register_toolchains(), it does nothing")
diff --git a/proto/gogo.bzl b/proto/gogo.bzl
new file mode 100644
index 00000000..05a8f044
--- /dev/null
+++ b/proto/gogo.bzl
@@ -0,0 +1,41 @@
+# Copyright 2017 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+def _gogo_special_proto_impl(ctx):
+ ctx.file("WORKSPACE", 'workspace(name = "{}")'.format(ctx.name))
+ ctx.file("BUILD.bazel", "")
+ ctx.symlink(
+ ctx.path(Label("@com_github_gogo_protobuf//gogoproto:gogo.proto")),
+ "github.com/gogo/protobuf/gogoproto/gogo.proto",
+ )
+ ctx.file("github.com/gogo/protobuf/gogoproto/BUILD.bazel", """
+load("@rules_proto//proto:defs.bzl", "proto_library")
+
+proto_library(
+ name = "gogoproto",
+ srcs = [":gogo.proto"],
+ tags = ["manual"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@com_google_protobuf//:descriptor_proto",
+ ],
+)
+ """)
+
+gogo_special_proto = repository_rule(
+ _gogo_special_proto_impl,
+ attrs = {
+ "proto": attr.label(allow_single_file = True),
+ },
+)
diff --git a/proto/wkt/BUILD.bazel b/proto/wkt/BUILD.bazel
new file mode 100644
index 00000000..a26ce507
--- /dev/null
+++ b/proto/wkt/BUILD.bazel
@@ -0,0 +1,204 @@
+load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
+load(":well_known_types.bzl", "go_proto_wrapper")
+load("//proto:def.bzl", "go_proto_library")
+
+# Several of the well-known types have pre-generated code checked into to both
+# github.com/golang/protobuf (APIv1) and google.golang.org/protobuf (APIv2).
+# The APIv1 packages are just wrappers for the APIv2 packages. We're using
+# the APIv1 compiler, but it won't generate these wrappers for us automatically.
+# If we use it, and a program also imports the APIv2 packages, we'll end up
+# with a registration conflict. Instead, we'll use the pre-generated APIv1
+# code, but we'll wrap it up in a go_proto_library.
+go_proto_wrapper(
+ name = "any_wrapper",
+ library = "@com_github_golang_protobuf//ptypes/any:go_default_library",
+ visibility = ["//visibility:private"],
+)
+
+go_proto_library(
+ name = "any_go_proto",
+ compilers = [":any_wrapper"],
+ importpath = "github.com/golang/protobuf/ptypes/any",
+ protos = ["@com_google_protobuf//:any_proto"],
+ visibility = ["//visibility:public"],
+)
+
+go_proto_wrapper(
+ name = "compiler_plugin_wrapper",
+ library = "@com_github_golang_protobuf//protoc-gen-go/plugin:go_default_library",
+ visibility = ["//visibility:private"],
+)
+
+go_proto_library(
+ name = "compiler_plugin_go_proto",
+ compilers = [":compiler_plugin_wrapper"],
+ importpath = "github.com/golang/protobuf/protoc-gen-go/plugin",
+ protos = ["@com_google_protobuf//:compiler_plugin_proto"],
+ visibility = ["//visibility:public"],
+)
+
+go_proto_wrapper(
+ name = "descriptor_wrapper",
+ library = "@com_github_golang_protobuf//protoc-gen-go/descriptor:go_default_library",
+ visibility = ["//visibility:private"],
+)
+
+go_proto_library(
+ name = "descriptor_go_proto",
+ compilers = [":descriptor_wrapper"],
+ importpath = "github.com/golang/protobuf/protoc-gen-go/descriptor",
+ protos = ["@com_google_protobuf//:descriptor_proto"],
+ visibility = ["//visibility:public"],
+)
+
+go_proto_wrapper(
+ name = "duration_wrapper",
+ library = "@com_github_golang_protobuf//ptypes/duration:go_default_library",
+ visibility = ["//visibility:private"],
+)
+
+go_proto_library(
+ name = "duration_go_proto",
+ compilers = [":duration_wrapper"],
+ importpath = "github.com/golang/protobuf/ptypes/duration",
+ protos = ["@com_google_protobuf//:duration_proto"],
+ visibility = ["//visibility:public"],
+)
+
+go_proto_wrapper(
+ name = "empty_wrapper",
+ library = "@com_github_golang_protobuf//ptypes/empty:go_default_library",
+ visibility = ["//visibility:private"],
+)
+
+go_proto_library(
+ name = "empty_go_proto",
+ compilers = [":empty_wrapper"],
+ importpath = "github.com/golang/protobuf/ptypes/empty",
+ protos = ["@com_google_protobuf//:empty_proto"],
+ visibility = ["//visibility:public"],
+)
+
+go_proto_wrapper(
+ name = "field_mask_wrapper",
+ library = "@org_golang_google_genproto//protobuf/field_mask:go_default_library",
+ visibility = ["//visibility:private"],
+)
+
+go_proto_library(
+ name = "field_mask_go_proto",
+ compilers = [":field_mask_wrapper"],
+ importpath = "google.golang.org/genproto/protobuf/field_mask",
+ protos = ["@com_google_protobuf//:field_mask_proto"],
+ visibility = ["//visibility:public"],
+)
+
+go_proto_wrapper(
+ name = "source_context_wrapper",
+ library = "@org_golang_google_genproto//protobuf/source_context:go_default_library",
+ visibility = ["//visibility:private"],
+)
+
+go_proto_library(
+ name = "source_context_go_proto",
+ compilers = [":source_context_wrapper"],
+ importpath = "google.golang.org/genproto/protobuf/source_context",
+ protos = ["@com_google_protobuf//:source_context_proto"],
+ visibility = ["//visibility:public"],
+)
+
+go_proto_wrapper(
+ name = "struct_wrapper",
+ library = "@com_github_golang_protobuf//ptypes/struct:go_default_library",
+ visibility = ["//visibility:private"],
+)
+
+go_proto_library(
+ name = "struct_go_proto",
+ compilers = [":struct_wrapper"],
+ importpath = "github.com/golang/protobuf/ptypes/struct",
+ protos = ["@com_google_protobuf//:struct_proto"],
+ visibility = ["//visibility:public"],
+)
+
+go_proto_wrapper(
+ name = "timestamp_wrapper",
+ library = "@com_github_golang_protobuf//ptypes/timestamp:go_default_library",
+ visibility = ["//visibility:private"],
+)
+
+go_proto_library(
+ name = "timestamp_go_proto",
+ compilers = [":timestamp_wrapper"],
+ importpath = "github.com/golang/protobuf/ptypes/timestamp",
+ protos = ["@com_google_protobuf//:timestamp_proto"],
+ visibility = ["//visibility:public"],
+)
+
+go_proto_wrapper(
+ name = "type_wrapper",
+ library = "@org_golang_google_genproto//protobuf/ptype:go_default_library",
+ visibility = ["//visibility:private"],
+)
+
+go_proto_library(
+ name = "type_go_proto",
+ compilers = [":type_wrapper"],
+ importpath = "google.golang.org/genproto/protobuf/ptype",
+ protos = ["@com_google_protobuf//:type_proto"],
+ visibility = ["//visibility:public"],
+)
+
+go_proto_wrapper(
+ name = "wrappers_wrapper",
+ library = "@com_github_golang_protobuf//ptypes/wrappers:go_default_library",
+ visibility = ["//visibility:private"],
+)
+
+go_proto_library(
+ name = "wrappers_go_proto",
+ compilers = [":wrappers_wrapper"],
+ importpath = "github.com/golang/protobuf/ptypes/wrappers",
+ protos = ["@com_google_protobuf//:wrappers_proto"],
+ visibility = ["//visibility:public"],
+)
+
+# Protos below this point don't have duplicate libraries, so we generate .pb.go
+# files at build time as usual. The only difference is we use
+# go_proto_bootstrap, which has an empty set of implicit dependencies.
+go_proto_library(
+ name = "api_go_proto",
+ compilers = ["//proto:go_proto_bootstrap"],
+ importpath = "google.golang.org/genproto/protobuf/api",
+ protos = ["@com_google_protobuf//:api_proto"],
+ visibility = ["//visibility:public"],
+ deps = [
+ ":source_context_go_proto",
+ ":type_go_proto",
+ ],
+)
+
+filegroup(
+ name = "all_rules",
+ testonly = True,
+ srcs = glob(["*.bzl"]),
+ visibility = ["//visibility:public"],
+)
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
+
+bzl_library(
+ name = "well_known_types",
+ srcs = ["well_known_types.bzl"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "//go:def",
+ "//proto:compiler",
+ "//proto:def",
+ ],
+)
diff --git a/proto/wkt/well_known_types.bzl b/proto/wkt/well_known_types.bzl
new file mode 100644
index 00000000..c06a3ab9
--- /dev/null
+++ b/proto/wkt/well_known_types.bzl
@@ -0,0 +1,96 @@
+load("//go:def.bzl", "GoArchive", "GoLibrary", "GoSource")
+load("//proto:compiler.bzl", "GoProtoCompiler")
+
+_go_proto_library_suffix = "go_proto"
+
+# 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 = {
+ wkt: Label("//proto/wkt:{}_{}".format(wkt, _go_proto_library_suffix))
+ for wkt in WELL_KNOWN_TYPE_PACKAGES.keys()
+}
+
+PROTO_RUNTIME_DEPS = [
+ "@com_github_golang_protobuf//proto:go_default_library",
+ "@org_golang_google_protobuf//proto:go_default_library",
+ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
+ "@org_golang_google_protobuf//runtime/protoiface:go_default_library",
+ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
+]
+
+# In protobuf 3.14, the 'option go_package' declarations were changed in the
+# Well Known Types to point to the APIv2 packages below. Consequently, generated
+# proto code will import APIv2 packages instead of the APIv1 packages, even
+# when the APIv1 compiler is used (which is still the default).
+#
+# protobuf 3.14 is now the minimum supported version, so we no longer depend
+# on the APIv1 packages.
+WELL_KNOWN_TYPES_APIV2 = [
+ "@org_golang_google_protobuf//types/descriptorpb",
+ "@org_golang_google_protobuf//types/known/anypb",
+ "@org_golang_google_protobuf//types/known/apipb",
+ "@org_golang_google_protobuf//types/known/durationpb",
+ "@org_golang_google_protobuf//types/known/emptypb",
+ "@org_golang_google_protobuf//types/known/fieldmaskpb",
+ "@org_golang_google_protobuf//types/known/sourcecontextpb",
+ "@org_golang_google_protobuf//types/known/structpb",
+ "@org_golang_google_protobuf//types/known/timestamppb",
+ "@org_golang_google_protobuf//types/known/typepb",
+ "@org_golang_google_protobuf//types/known/wrapperspb",
+ "@org_golang_google_protobuf//types/pluginpb",
+]
+
+# buildifier: disable=unused-variable
+def _go_proto_wrapper_compile(go, compiler, protos, imports, importpath):
+ return []
+
+def _go_proto_wrapper_impl(ctx):
+ return [
+ ctx.attr.library[GoLibrary],
+ ctx.attr.library[GoSource],
+ GoProtoCompiler(
+ deps = ctx.attr._deps,
+ compile = _go_proto_wrapper_compile,
+ valid_archive = True,
+ ),
+ ]
+
+go_proto_wrapper = rule(
+ implementation = _go_proto_wrapper_impl,
+ attrs = {
+ "library": attr.label(
+ mandatory = True,
+ providers = [GoLibrary, GoSource],
+ ),
+ "_deps": attr.label_list(
+ default = PROTO_RUNTIME_DEPS,
+ providers = [GoLibrary, GoSource, GoArchive],
+ ),
+ },
+)
diff --git a/tests/BUILD.bazel b/tests/BUILD.bazel
new file mode 100644
index 00000000..bc6d1df2
--- /dev/null
+++ b/tests/BUILD.bazel
@@ -0,0 +1,10 @@
+load(":buildifier_test.bzl", "buildifier_test")
+
+buildifier_test(
+ name = "buildifier_test",
+ size = "small",
+ data = [
+ ":buildifier_test.bzl",
+ "//:all_files",
+ ],
+)
diff --git a/tests/README.rst b/tests/README.rst
new file mode 100644
index 00000000..707d9526
--- /dev/null
+++ b/tests/README.rst
@@ -0,0 +1,55 @@
+Go rules test suite
+===================
+
+Main test areas
+---------------
+
+.. Child list start
+
+* `Core Go rules tests <core/README.rst>`_
+* `Integration tests <integration/README.rst>`_
+* `Legacy tests <legacy/README.rst>`_
+* `Go rules examples <examples/README.rst>`_
+
+.. Child list end
+
+Adding a new test
+-----------------
+
+All tests in the test suite are expected to obey certain rules.
+
+They must be documented
+ Each test folder must contain a README.rst that documents the area of
+ reponsability for the folder. That README must have a section with
+ the same name as each of the test rules that documents exactly what the
+ test is supposed to be checking for.
+ If the test is in response to a previous issue, the documentation must
+ also link to the issue being addressed.
+
+Test one thing at a time
+ Each test should have a clear and specific responsability, and it should be
+ as tightly targeted as possible.
+ Prefer writing multiple tests in a single folder to a single test that
+ excercises multiple things.
+
+They must be turned on
+ Test that do not run by default on the CI machines are not much use,
+ especially as it's often the only way changes get tested in environments
+ that are not the one they are authored on, and the rules are very sensitive
+ to platform specific variations.
+
+They must not be flakey
+ We will generally just delete tests that flake, and if features cannot be
+ tested without flakes we will probably delete the feature as well.
+
+They must work on all platforms
+ We support mac, linux and windows, and all our code must work across all
+ hosts. There are some tests that need to be platform specific, but it's
+ very rare, and needs a really strong rationale to be accepted.
+
+They must be as fast as possible
+ Some tests need to be large and expensive, but most do not. In particular,
+ downloading large external dependancies to perform a small unit test is not
+ ok, prefer creating a small local replication of the problem instead.
+ Anything that requires external dependancies beyond those of the rules
+ belongs in the integration tests. \ No newline at end of file
diff --git a/tests/bcr/.bazelrc b/tests/bcr/.bazelrc
new file mode 100644
index 00000000..3ce91d27
--- /dev/null
+++ b/tests/bcr/.bazelrc
@@ -0,0 +1 @@
+common --enable_bzlmod
diff --git a/tests/bcr/.bazelversion b/tests/bcr/.bazelversion
new file mode 100644
index 00000000..09b254e9
--- /dev/null
+++ b/tests/bcr/.bazelversion
@@ -0,0 +1 @@
+6.0.0
diff --git a/tests/bcr/BUILD.bazel b/tests/bcr/BUILD.bazel
new file mode 100644
index 00000000..d5c5f6f1
--- /dev/null
+++ b/tests/bcr/BUILD.bazel
@@ -0,0 +1,55 @@
+load("@my_rules_go//extras:gomock.bzl", "gomock")
+load("@my_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
+
+go_library(
+ name = "lib",
+ srcs = ["lib.go"],
+ importpath = "example.com/lib",
+)
+
+go_binary(
+ name = "main",
+ srcs = ["main.go"],
+ deps = [":lib"],
+)
+
+go_test(
+ name = "test",
+ srcs = ["test.go"],
+ embed = [":lib"],
+)
+
+go_library(
+ name = "mockable",
+ srcs = [
+ "mockable.go",
+ ],
+ importpath = "example.com/mockable",
+)
+
+gomock(
+ name = "mocks",
+ out = "mockable_mock.go",
+ library = ":mockable",
+ package = "mockable",
+ source = "mockable.go",
+ visibility = ["//visibility:public"],
+)
+
+go_test(
+ name = "mockable_test",
+ srcs = [
+ "mockable_mock.go",
+ "mockable_test.go",
+ ],
+ embed = [":mockable"],
+ deps = ["@my_rules_go//extras/gomock"],
+)
+
+sh_test(
+ name = "go_version_test",
+ srcs = ["go_version_test.sh"],
+ data = ["@my_rules_go//go"],
+ env = {"GO_TOOL_RLOCATION": "$(rlocationpath @my_rules_go//go)"},
+ deps = ["@bazel_tools//tools/bash/runfiles"],
+)
diff --git a/tests/bcr/MODULE.bazel b/tests/bcr/MODULE.bazel
new file mode 100644
index 00000000..b774feb4
--- /dev/null
+++ b/tests/bcr/MODULE.bazel
@@ -0,0 +1,42 @@
+module(
+ name = "rules_go_bcr_tests",
+ # Test that the default SDK is registered by not registering one from the test module.
+ version = "1.2.3",
+)
+
+# Keep this dep first so that its toolchain takes precedence over the default SDK registered by
+# rules_go.
+bazel_dep(name = "other_module", version = "")
+local_path_override(
+ module_name = "other_module",
+ path = "other_module",
+)
+
+bazel_dep(name = "rules_go", version = "", repo_name = "my_rules_go")
+local_path_override(
+ module_name = "rules_go",
+ path = "../..",
+)
+
+bazel_dep(name = "gazelle", version = "0.26.0")
+bazel_dep(name = "protobuf", version = "3.19.6")
+
+go_sdk = use_extension("@my_rules_go//go:extensions.bzl", "go_sdk")
+go_sdk.download(version = "1.19.5")
+
+# Request an invalid SDK to verify that it isn't fetched since the first tag takes precedence.
+go_sdk.host(version = "3.0.0")
+
+# Bring the default SDK into scope to verify that it exists.
+use_repo(go_sdk, "go_default_sdk")
+
+# Bring the selected host compatible SDK into scope to verify that it exists.
+use_repo(go_sdk, "go_host_compatible_sdk_label")
+
+go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
+go_deps.module(
+ path = "google.golang.org/grpc",
+ sum = "h1:fPVVDxY9w++VjTZsYvXWqEf9Rqar/e+9zYfxKK+W+YU=",
+ version = "v1.50.0",
+)
+use_repo(go_deps, "org_golang_google_grpc")
diff --git a/tests/bcr/WORKSPACE b/tests/bcr/WORKSPACE
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/bcr/WORKSPACE
diff --git a/tests/bcr/go_version_test.sh b/tests/bcr/go_version_test.sh
new file mode 100755
index 00000000..986d91d7
--- /dev/null
+++ b/tests/bcr/go_version_test.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+
+# --- begin runfiles.bash initialization v3 ---
+# Copy-pasted from the Bazel Bash runfiles library v3.
+set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
+source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
+ source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
+ source "$0.runfiles/$f" 2>/dev/null || \
+ source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
+ source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
+ { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
+# --- end runfiles.bash initialization v3 ---
+
+GO_TOOL=$(rlocation "$GO_TOOL_RLOCATION")
+# Set runfiles variables for subprocess.
+runfiles_export_envvars
+# Simulate a bazel run environment.
+export BUILD_WORKING_DIRECTORY=$(pwd)
+[[ "$("$GO_TOOL" version)" =~ ^go ]]
diff --git a/tests/bcr/lib.go b/tests/bcr/lib.go
new file mode 100644
index 00000000..d162287c
--- /dev/null
+++ b/tests/bcr/lib.go
@@ -0,0 +1,5 @@
+package lib
+
+func Name() string {
+ return "bzlmod"
+}
diff --git a/tests/bcr/main.go b/tests/bcr/main.go
new file mode 100644
index 00000000..46c058ef
--- /dev/null
+++ b/tests/bcr/main.go
@@ -0,0 +1,11 @@
+package main
+
+import (
+ "fmt"
+
+ "example.com/lib"
+)
+
+func main() {
+ fmt.Printf("Hello %s!", lib.Name())
+}
diff --git a/tests/bcr/mockable.go b/tests/bcr/mockable.go
new file mode 100644
index 00000000..e310105b
--- /dev/null
+++ b/tests/bcr/mockable.go
@@ -0,0 +1,7 @@
+package mockable
+
+import "net/url"
+
+type Client interface {
+ Connect(addr string) url.URL
+}
diff --git a/tests/bcr/mockable_test.go b/tests/bcr/mockable_test.go
new file mode 100644
index 00000000..7e9cc8a0
--- /dev/null
+++ b/tests/bcr/mockable_test.go
@@ -0,0 +1,3 @@
+package mockable
+
+var _ Client = (*MockClient)(nil)
diff --git a/tests/bcr/other_module/BUILD.bazel b/tests/bcr/other_module/BUILD.bazel
new file mode 100644
index 00000000..65781709
--- /dev/null
+++ b/tests/bcr/other_module/BUILD.bazel
@@ -0,0 +1 @@
+exports_files(["bar.txt"])
diff --git a/tests/bcr/other_module/MODULE.bazel b/tests/bcr/other_module/MODULE.bazel
new file mode 100644
index 00000000..f517abae
--- /dev/null
+++ b/tests/bcr/other_module/MODULE.bazel
@@ -0,0 +1,9 @@
+module(name = "other_module")
+
+bazel_dep(name = "rules_go", version = "")
+
+go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
+
+# Request an invalid SDK to verify that it isn't fetched since the test module registers a toolchain
+# that takes precedence.
+go_sdk.download(version = "3.0.0")
diff --git a/tests/bcr/other_module/WORKSPACE b/tests/bcr/other_module/WORKSPACE
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/bcr/other_module/WORKSPACE
diff --git a/tests/bcr/other_module/bar.txt b/tests/bcr/other_module/bar.txt
new file mode 100644
index 00000000..ce013625
--- /dev/null
+++ b/tests/bcr/other_module/bar.txt
@@ -0,0 +1 @@
+hello
diff --git a/tests/bcr/proto/BUILD.bazel b/tests/bcr/proto/BUILD.bazel
new file mode 100644
index 00000000..49046ffa
--- /dev/null
+++ b/tests/bcr/proto/BUILD.bazel
@@ -0,0 +1,51 @@
+load("@my_rules_go//go:def.bzl", "go_test")
+load("@my_rules_go//proto:def.bzl", "go_grpc_library", "go_proto_library")
+
+proto_library(
+ name = "foo_proto",
+ srcs = ["foo.proto"],
+ deps = [
+ "@protobuf//:empty_proto",
+ ],
+)
+
+go_proto_library(
+ name = "foo_go_proto",
+ importpath = "example.com/foo_proto",
+ proto = ":foo_proto",
+)
+
+go_test(
+ name = "foo_proto_test",
+ srcs = ["foo_proto_test.go"],
+ deps = [":foo_go_proto"],
+)
+
+go_grpc_library(
+ name = "foo_go_grpc",
+ importpath = "example.com/foo_proto",
+ protos = [":foo_proto"],
+)
+
+go_test(
+ name = "foo_grpc_test",
+ srcs = ["foo_grpc_test.go"],
+ deps = [
+ ":foo_go_grpc",
+ "@org_golang_google_grpc//:grpc",
+ "@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"],
+)
diff --git a/tests/bcr/proto/foo.proto b/tests/bcr/proto/foo.proto
new file mode 100644
index 00000000..71980226
--- /dev/null
+++ b/tests/bcr/proto/foo.proto
@@ -0,0 +1,15 @@
+syntax = "proto3";
+
+package tests.bcr.proto;
+option go_package = "example.com/foo_proto";
+
+import "google/protobuf/empty.proto";
+
+message Foo {
+ int64 value = 1;
+ google.protobuf.Empty empty = 2;
+}
+
+service Fooer {
+ rpc RoundTripFoo (Foo) returns (Foo) {}
+}
diff --git a/tests/bcr/proto/foo_grpc_test.go b/tests/bcr/proto/foo_grpc_test.go
new file mode 100644
index 00000000..4879315f
--- /dev/null
+++ b/tests/bcr/proto/foo_grpc_test.go
@@ -0,0 +1,62 @@
+package grpc_test
+
+import (
+ "context"
+ "fmt"
+ "log"
+ "net"
+ "testing"
+
+ "example.com/foo_proto"
+
+ "google.golang.org/grpc"
+ "google.golang.org/grpc/credentials/insecure"
+)
+
+type fooerServer struct {
+}
+
+func newServer() *fooerServer {
+ return &fooerServer{}
+}
+
+func (*fooerServer) RoundTripFoo(ctx context.Context, foo *foo_proto.Foo) (*foo_proto.Foo, error) {
+ foo.Value += 1
+ return foo, nil
+}
+
+func TestRoundTripFoo(t *testing.T) {
+ // Start the server.
+ address := fmt.Sprintf("localhost:%d", 12345)
+ lis, err := net.Listen("tcp", address)
+ if err != nil {
+ log.Fatalf("failed to listen on %s: %v", address, err)
+ }
+ grpcServer := grpc.NewServer()
+ foo_proto.RegisterFooerServer(grpcServer, newServer())
+ go func() {
+ grpcServer.Serve(lis)
+ }()
+
+ // Start the client.
+ conn, err := grpc.Dial(address, grpc.WithTransportCredentials(insecure.NewCredentials()))
+ if err != nil {
+ log.Fatalf("fail to dial %s: %v", address, err)
+ }
+ defer conn.Close()
+ client := foo_proto.NewFooerClient(conn)
+
+ // Send a message and verify that it is returned correctly.
+ msgIn := &foo_proto.Foo{
+ Value: 42,
+ }
+ msgOut, err := client.RoundTripFoo(context.TODO(), msgIn)
+ if err != nil {
+ log.Fatalf("failed to round-trip message: %v", err)
+ }
+ if msgOut.Value != 43 {
+ log.Fatalf("message did not round-trip correctly: sent %v, got %v", msgIn, msgOut)
+ }
+
+ grpcServer.GracefulStop()
+}
diff --git a/tests/bcr/proto/foo_proto_test.go b/tests/bcr/proto/foo_proto_test.go
new file mode 100644
index 00000000..ff3f4754
--- /dev/null
+++ b/tests/bcr/proto/foo_proto_test.go
@@ -0,0 +1,16 @@
+package proto_test
+
+import (
+ "testing"
+
+ "example.com/foo_proto"
+)
+
+func TestFoo(t *testing.T) {
+ msg := &foo_proto.Foo{
+ Value: 1,
+ }
+ if msg.Value != 1 {
+ t.Fail()
+ }
+}
diff --git a/tests/bcr/runfiles/BUILD.bazel b/tests/bcr/runfiles/BUILD.bazel
new file mode 100644
index 00000000..d86ff26e
--- /dev/null
+++ b/tests/bcr/runfiles/BUILD.bazel
@@ -0,0 +1,9 @@
+load("@my_rules_go//go:def.bzl", "go_test")
+
+go_test(
+ name = "runfiles_test",
+ srcs = ["runfiles_test.go"],
+ args = ["$(rlocationpath @other_module//:bar.txt)"],
+ data = ["@other_module//:bar.txt"],
+ deps = ["@my_rules_go//go/runfiles"],
+)
diff --git a/tests/bcr/runfiles/runfiles_test.go b/tests/bcr/runfiles/runfiles_test.go
new file mode 100644
index 00000000..ea82e976
--- /dev/null
+++ b/tests/bcr/runfiles/runfiles_test.go
@@ -0,0 +1,67 @@
+package runfiles
+
+import (
+ "os"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/runfiles"
+)
+
+func TestRunfilesApparent(t *testing.T) {
+ path, err := runfiles.Rlocation("other_module/bar.txt")
+ if err != nil {
+ t.Fatalf("runfiles.Path: %v", err)
+ }
+ assertRunfile(t, path)
+}
+
+func TestRunfilesApparentSourceRepositoryOption(t *testing.T) {
+ r, err := runfiles.New(runfiles.SourceRepo(runfiles.CurrentRepository()))
+ if err != nil {
+ t.Fatalf("runfiles.New: %v", err)
+ }
+ path, err := r.Rlocation("other_module/bar.txt")
+ if err != nil {
+ t.Fatalf("runfiles.Path: %v", err)
+ }
+ assertRunfile(t, path)
+}
+
+func TestRunfilesApparentWithSourceRepository(t *testing.T) {
+ r, err := runfiles.New()
+ if err != nil {
+ t.Fatalf("runfiles.New: %v", err)
+ }
+ r = r.WithSourceRepo(runfiles.CurrentRepository())
+ path, err := r.Rlocation("other_module/bar.txt")
+ if err != nil {
+ t.Fatalf("runfiles.Path: %v", err)
+ }
+ assertRunfile(t, path)
+}
+
+func TestRunfilesFromApparent(t *testing.T) {
+ path, err := runfiles.RlocationFrom("other_module/bar.txt", runfiles.CurrentRepository())
+ if err != nil {
+ t.Fatalf("runfiles.Path: %v", err)
+ }
+ assertRunfile(t, path)
+}
+
+func TestRunfilesCanonical(t *testing.T) {
+ path, err := runfiles.Rlocation(os.Args[1])
+ if err != nil {
+ t.Fatalf("runfiles.Path: %v", err)
+ }
+ assertRunfile(t, path)
+}
+
+func assertRunfile(t *testing.T, path string) {
+ content, err := os.ReadFile(path)
+ if err != nil {
+ t.Fatalf("os.ReadFile: %v", err)
+ }
+ if string(content) != "hello\n" {
+ t.Fatalf("got %q; want %q", content, "hello\n")
+ }
+}
diff --git a/tests/bcr/test.go b/tests/bcr/test.go
new file mode 100644
index 00000000..910c06be
--- /dev/null
+++ b/tests/bcr/test.go
@@ -0,0 +1,11 @@
+package lib
+
+import (
+ "testing"
+)
+
+func TestName(t *testing.T) {
+ if Name() != "bzlmod" {
+ t.Fail()
+ }
+}
diff --git a/tests/buildifier_test.bzl b/tests/buildifier_test.bzl
new file mode 100644
index 00000000..74e03983
--- /dev/null
+++ b/tests/buildifier_test.bzl
@@ -0,0 +1,83 @@
+# Copyright 2020 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""buildifier_tests.bzl provides the buildifier_test rule"""
+
+load("@bazel_skylib//lib:shell.bzl", "shell")
+
+def _check_file(f):
+ base = f.basename
+ return base in ("WORKSPACE", "BUILD", "BUILD.bazel") or base.endswith(".bzl")
+
+def _buildifier_test_impl(ctx):
+ files = [f for f in ctx.files.data if _check_file(f)]
+
+ script = ctx.actions.declare_file(ctx.label.name + ".bash")
+ content = """#!/usr/bin/env bash
+
+set -uo pipefail
+
+files=(
+ {files}
+)
+buildifier={buildifier}
+
+# warnings is the default list of warnings with exclusions:
+# bzl-visibility: we reference symbols in //go/private outside of //go.
+# confusing-name: a good font makes these very clear.
+# function-docstring: too verbose. Many functions don't need docs.
+# function-docstring-header: too verbose for now.
+# function-docstring-args: too verbose.
+# function-docstring-return: too verbose.
+# module-docstring: doesn't seem useful for many private modules.
+# name-conventions: we have non-compliant providers. We might change them
+# eventually, but we'll need to keep the old symbols for compatibility.
+# print: used for warnings.
+warnings=attr-cfg,attr-license,attr-non-empty,attr-output-default,attr-single-file,build-args-kwargs,constant-glob,ctx-actions,ctx-args,depset-iteration,depset-union,dict-concatenation,duplicated-name,filetype,git-repository,http-archive,integer-division,keyword-positional-params,load,load-on-top,native-android,native-build,native-cc,native-java,native-package,native-proto,native-py,no-effect,output-group,overly-nested-depset,package-name,package-on-top,positional-args,redefined-variable,repository-name,return-value,rule-impl-return,same-origin-load,string-iteration,uninitialized,unreachable,unused-variable
+
+ok=0
+for file in "${{files[@]}}"; do
+ "$buildifier" -mode=check -lint=warn -warnings="$warnings" "$file"
+ if [ $? -ne 0 ]; then
+ ok=1
+ fi
+done
+exit $ok
+""".format(
+ buildifier = shell.quote(ctx.executable._buildifier.short_path),
+ files = "\n".join([shell.quote(f.path) for f in files]),
+ )
+ ctx.actions.write(script, content, is_executable = True)
+
+ return [DefaultInfo(
+ executable = script,
+ default_runfiles = ctx.runfiles(
+ files = [script, ctx.executable._buildifier] + files,
+ ),
+ )]
+
+buildifier_test = rule(
+ implementation = _buildifier_test_impl,
+ attrs = {
+ "data": attr.label_list(
+ allow_files = True,
+ ),
+ "_buildifier": attr.label(
+ default = "@com_github_bazelbuild_buildtools//buildifier",
+ executable = True,
+ cfg = "exec",
+ ),
+ },
+ test = True,
+)
diff --git a/tests/core/README.rst b/tests/core/README.rst
new file mode 100644
index 00000000..835b9ba7
--- /dev/null
+++ b/tests/core/README.rst
@@ -0,0 +1,35 @@
+Core Go rules tests
+===================
+
+This contains tests of the core go rules.
+
+Contents
+--------
+
+.. Child list start
+
+* `Misc configuration transition tests <transition/README.rst>`_
+* `Basic go_library functionality <go_library/README.rst>`_
+* `output_groups functionality <output_groups/README.rst>`_
+* `Basic -buildmode=plugin functionality <go_plugin/README.rst>`_
+* `go_bazel_test macro functionality <go_bazel_test/README.rst>`_
+* `Core Go rules tests <nogo/README.rst>`_
+* `go_proto_library importmap <go_proto_library_importmap/README.rst>`_
+* `Cross compilation <cross/README.rst>`_
+* `Basic go_proto_library functionality <go_proto_library/README.rst>`_
+* `c-archive / c-shared linkmodes <c_linkmodes/README.rst>`_
+* `Basic go_test functionality <go_test/README.rst>`_
+* `.. _#2067: https://github.com/bazelbuild/rules_go/issues/2067 <cgo/README.rst>`_
+* `Runfiles functionality <runfiles/README.rst>`_
+* `go_download_sdk <go_download_sdk/README.rst>`_
+* `go_embed_data <go_embed_data/README.rst>`_
+* `race instrumentation <race/README.rst>`_
+* `stdlib functionality <stdlib/README.rst>`_
+* `Basic go_binary functionality <go_binary/README.rst>`_
+* `Starlark unit tests <starlark/README.rst>`_
+* `.. _#2127: https://github.com/bazelbuild/rules_go/issues/2127 <coverage/README.rst>`_
+* `Import maps <importmap/README.rst>`_
+* `Basic go_path functionality <go_path/README.rst>`_
+
+.. Child list end
+
diff --git a/tests/core/boringcrypto/BUILD.bazel b/tests/core/boringcrypto/BUILD.bazel
new file mode 100644
index 00000000..9de03bb0
--- /dev/null
+++ b/tests/core/boringcrypto/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "boringcrypto_test",
+ srcs = ["boringcrypto_test.go"],
+)
diff --git a/tests/core/boringcrypto/README.rst b/tests/core/boringcrypto/README.rst
new file mode 100644
index 00000000..cd084f33
--- /dev/null
+++ b/tests/core/boringcrypto/README.rst
@@ -0,0 +1,11 @@
+Boringcrypto
+===========
+
+Tests to ensure that support for building with boringcrypto is working as expected.
+
+boringcrypto_test
+--------------
+
+Test that the build is failed if a non-local Go version less than 1.19 is requested to be built with
+boringcrypto. Test that binaries built with boringcrypto stdlib have X:boringcrypto in version
+information. \ No newline at end of file
diff --git a/tests/core/boringcrypto/boringcrypto_test.go b/tests/core/boringcrypto/boringcrypto_test.go
new file mode 100644
index 00000000..ec7bebfd
--- /dev/null
+++ b/tests/core/boringcrypto/boringcrypto_test.go
@@ -0,0 +1,115 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package boringcrypto_test
+
+import (
+ "bytes"
+ "os"
+ "os/exec"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+
+go_binary(
+ name = "program",
+ srcs = ["main.go"],
+ deps = [":library"],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "library",
+ srcs = ["library.go"],
+ importpath = "example.com/library"
+)
+-- main.go --
+//go:build goexperiment.boringcrypto
+
+package main
+
+import "example.com/library"
+
+func main() {
+ library.F()
+}
+-- library.go --
+package library
+
+func F() {}
+`,
+ })
+}
+
+const origWrapSDK = `go_wrap_sdk(
+ name = "go_sdk",
+ root_file = "@local_go_sdk//:ROOT",
+)`
+
+const wrapSDKBoringcrypto = `go_wrap_sdk(
+ name = "go_sdk",
+ root_file = "@local_go_sdk//:ROOT",
+ experiments = ["boringcrypto"],
+)`
+
+func TestBoringcryptoExperimentPresent(t *testing.T) {
+ mustReplaceInFile(t, "WORKSPACE", origWrapSDK, wrapSDKBoringcrypto)
+ defer mustReplaceInFile(t, "WORKSPACE", wrapSDKBoringcrypto, origWrapSDK)
+
+ if _, err := exec.LookPath("go"); err != nil {
+ t.Skip("go command is necessary to evaluate if boringcrypto experiment is present")
+ }
+
+ cmd := bazel_testing.BazelCmd("build", "//:program")
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stdout
+ if err := cmd.Run(); err != nil {
+ t.Fatal("failed to run bazel build: ", err)
+ }
+
+ out, err := exec.Command("go", "version", "bazel-bin/program_/program").CombinedOutput()
+ if err != nil {
+ t.Fatalf("failed to run go version command: %v\noutput was:\n%v", err, string(out))
+ }
+
+ if !strings.Contains(string(out), "X:boringcrypto") {
+ t.Fatalf(`version of binary: got %q, want string containing "X:boringcrypto"`, string(out))
+ }
+}
+
+func mustReplaceInFile(t *testing.T, path, old, new string) {
+ t.Helper()
+ if old == new {
+ return
+ }
+ data, err := os.ReadFile(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !bytes.Contains(data, []byte(old)) {
+ t.Fatalf("bytes to replace %q not found in file %q with contents, %q", old, path, data)
+ }
+ data = bytes.ReplaceAll(data, []byte(old), []byte(new))
+ if err := os.WriteFile(path, data, 0666); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/build_stdlib/BUILD.bazel b/tests/core/build_stdlib/BUILD.bazel
new file mode 100644
index 00000000..2d619fc3
--- /dev/null
+++ b/tests/core/build_stdlib/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "build_stdlib_test",
+ srcs = ["build_stdlib_test.go"],
+)
diff --git a/tests/core/build_stdlib/README.rst b/tests/core/build_stdlib/README.rst
new file mode 100644
index 00000000..38a0f100
--- /dev/null
+++ b/tests/core/build_stdlib/README.rst
@@ -0,0 +1,11 @@
+Building with standard libraries with missing .a files
+===========
+
+Tests to ensure that building with Go 1.20 and later versions of Go, which no longer
+include precompiled standard library .a files, continues to work
+
+build_stdlib_test
+--------------
+
+Test that a simple binary depending on a simple library can build when the WORKSPACE's
+go version is set to 1.20rc1. \ No newline at end of file
diff --git a/tests/core/build_stdlib/build_stdlib_test.go b/tests/core/build_stdlib/build_stdlib_test.go
new file mode 100644
index 00000000..31851b3a
--- /dev/null
+++ b/tests/core/build_stdlib/build_stdlib_test.go
@@ -0,0 +1,97 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package build_stdlib_test
+
+import (
+ "bytes"
+ "os"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+
+go_binary(
+ name = "program",
+ srcs = ["main.go"],
+ deps = [":library"],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "library",
+ srcs = ["library.go"],
+ importpath = "example.com/library"
+)
+-- main.go --
+package main
+
+import "example.com/library"
+
+func main() {
+ library.F()
+}
+-- library.go --
+package library
+
+func F() {}
+`,
+ })
+}
+
+const origWrapSDK = `go_wrap_sdk(
+ name = "go_sdk",
+ root_file = "@local_go_sdk//:ROOT",
+)
+
+go_register_toolchains()`
+
+const toolchain120 = `go_register_toolchains(version = "1.20rc1")`
+
+func TestBoringcryptoExperimentPresent(t *testing.T) {
+ mustReplaceInFile(t, "WORKSPACE", origWrapSDK, toolchain120)
+ defer mustReplaceInFile(t, "WORKSPACE", toolchain120, origWrapSDK)
+
+ cmd := bazel_testing.BazelCmd("build", "//:program")
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stdout
+ if err := cmd.Run(); err != nil {
+ t.Fatal("failed to run bazel build: ", err)
+ }
+
+}
+
+func mustReplaceInFile(t *testing.T, path, old, new string) {
+ t.Helper()
+ if old == new {
+ return
+ }
+ data, err := os.ReadFile(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !bytes.Contains(data, []byte(old)) {
+ t.Fatalf("bytes to replace %q not found in file %q with contents, %q", old, path, data)
+ }
+ data = bytes.ReplaceAll(data, []byte(old), []byte(new))
+ if err := os.WriteFile(path, data, 0666); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/c_linkmodes/BUILD.bazel b/tests/core/c_linkmodes/BUILD.bazel
new file mode 100644
index 00000000..ee7f68e6
--- /dev/null
+++ b/tests/core/c_linkmodes/BUILD.bazel
@@ -0,0 +1,139 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+go_binary(
+ name = "adder_archive",
+ srcs = ["add.go"],
+ cgo = True,
+ linkmode = "c-archive",
+ tags = ["manual"],
+)
+
+cc_test(
+ name = "c-archive_test",
+ srcs = select({
+ "@io_bazel_rules_go//go/platform:windows": ["skip.c"],
+ "//conditions:default": ["add_test_archive.c"],
+ }),
+ deps = select({
+ "@io_bazel_rules_go//go/platform:windows": [],
+ "//conditions:default": [":adder_archive"],
+ }),
+)
+
+go_binary(
+ name = "c-archive_empty_hdr",
+ srcs = ["empty.go"],
+ cgo = True,
+ linkmode = "c-archive",
+ tags = ["manual"],
+)
+
+cc_test(
+ name = "c-archive_empty_hdr_test",
+ srcs = select({
+ "@io_bazel_rules_go//go/platform:windows": ["skip.c"],
+ "//conditions:default": ["c-archive_empty_hdr_test.c"],
+ }),
+ deps = select({
+ "@io_bazel_rules_go//go/platform:windows": [],
+ "//conditions:default": [":c-archive_empty_hdr"],
+ }),
+)
+
+go_binary(
+ name = "adder_shared",
+ srcs = ["add.go"],
+ cgo = True,
+ linkmode = "c-shared",
+ tags = ["manual"],
+)
+
+cc_test(
+ name = "c-shared_test",
+ srcs = select({
+ "@io_bazel_rules_go//go/platform:windows": ["skip.c"],
+ "//conditions:default": ["add_test_shared.c"],
+ }),
+ deps = select({
+ "@io_bazel_rules_go//go/platform:windows": [],
+ "//conditions:default": [":adder_shared"],
+ }),
+)
+
+go_binary(
+ name = "crypto",
+ srcs = [":crypto.go"],
+ cgo = True,
+ linkmode = "c-shared",
+ tags = ["manual"],
+ deps = ["@org_golang_x_crypto//nacl/box:go_default_library"],
+)
+
+cc_test(
+ name = "c-shared_dl_test",
+ srcs = select({
+ "@io_bazel_rules_go//go/platform:windows": ["skip.c"],
+ "//conditions:default": ["crypto_test_dl.c"],
+ }),
+ copts = select({
+ "@io_bazel_rules_go//go/platform:windows": [],
+ "//conditions:default": ['-DSO=\\"$(rootpath :crypto)\\"'],
+ }),
+ data = select({
+ "@io_bazel_rules_go//go/platform:windows": [],
+ "//conditions:default": [":crypto"],
+ }),
+ linkopts = select({
+ "@io_bazel_rules_go//go/platform:windows": [],
+ "//conditions:default": ["-ldl"],
+ }),
+)
+
+cc_library(
+ name = "adder_sandwich_cc",
+ srcs = ["add_sandwich.c"],
+ hdrs = ["add_sandwich.h"],
+ linkstatic = True,
+ alwayslink = True,
+)
+
+go_binary(
+ name = "adder_sandwich_archive",
+ srcs = ["add_sandwich.go"],
+ cdeps = [":adder_sandwich_cc"],
+ cgo = True,
+ linkmode = "c-archive",
+ tags = ["manual"],
+)
+
+cc_test(
+ name = "c-archive_sandwich_test",
+ srcs = select({
+ "@io_bazel_rules_go//go/platform:windows": ["skip.c"],
+ "//conditions:default": ["add_test_sandwich.c"],
+ }),
+ deps = select({
+ "@io_bazel_rules_go//go/platform:windows": [],
+ "//conditions:default": [":adder_sandwich_archive"],
+ }),
+)
+
+go_binary(
+ name = "go_with_cgo_dep",
+ srcs = select({
+ "@io_bazel_rules_go//go/platform:windows": ["empty.go"],
+ "//conditions:default": ["go_with_cgo_dep.go"],
+ }),
+ cgo = True,
+ linkmode = "c-archive",
+ deps = ["@org_golang_x_sys//unix"],
+)
+
+cc_binary(
+ name = "go_with_cgo_dep_caller",
+ srcs = select({
+ "@io_bazel_rules_go//go/platform:windows": ["skip.c"],
+ "//conditions:default": ["go_with_cgo_dep_caller.cc"],
+ }),
+ deps = [":go_with_cgo_dep"],
+)
diff --git a/tests/core/c_linkmodes/README.rst b/tests/core/c_linkmodes/README.rst
new file mode 100644
index 00000000..dd517725
--- /dev/null
+++ b/tests/core/c_linkmodes/README.rst
@@ -0,0 +1,35 @@
+c-archive / c-shared linkmodes
+==============================
+
+.. _go_binary: /docs/go/core/rules.md#go_binary
+.. _#2132: https://github.com/bazelbuild/rules_go/issues/2132
+.. _#2138: https://github.com/bazelbuild/rules_go/issues/2138
+
+Tests to ensure that c-archive link mode is working as expected.
+
+.. contents::
+
+c-archive_test
+--------------
+
+Checks that a ``go_binary`` can be built in ``c-archive`` mode and linked into
+a C/C++ binary as a dependency.
+
+c-archive_empty_hdr_test
+------------------------
+
+Checks that a ``go_binary`` built with in ``c-archive`` mode without cgo code
+still produces an empty header file. Verifies `#2132`_.
+
+c-shared_test
+-------------
+
+Checks that a ``go_binary`` can be built in ``c-shared`` mode and linked into
+a C/C++ binary as a dependency.
+
+c-shared_dl_test
+----------------
+
+Checks that a ``go_binary`` can be built in ``c-shared`` mode and loaded
+dynamically from a C/C++ binary. The binary depends on a package in
+``org_golang_x_crypto`` with a fair amount of assembly code. Verifies `#2138`_.
diff --git a/tests/core/c_linkmodes/add.go b/tests/core/c_linkmodes/add.go
new file mode 100644
index 00000000..35084fea
--- /dev/null
+++ b/tests/core/c_linkmodes/add.go
@@ -0,0 +1,11 @@
+package main
+
+// #define CGO_EXPORT_H_EXISTS
+import "C"
+
+//export GoAdd
+func GoAdd(a, b int) int {
+ return a + b
+}
+
+func main() {}
diff --git a/tests/core/c_linkmodes/add_sandwich.c b/tests/core/c_linkmodes/add_sandwich.c
new file mode 100644
index 00000000..dcf6150f
--- /dev/null
+++ b/tests/core/c_linkmodes/add_sandwich.c
@@ -0,0 +1,5 @@
+#include "add_sandwich.h"
+
+int add(int a, int b) {
+ return a + b;
+}
diff --git a/tests/core/c_linkmodes/add_sandwich.go b/tests/core/c_linkmodes/add_sandwich.go
new file mode 100644
index 00000000..0073638f
--- /dev/null
+++ b/tests/core/c_linkmodes/add_sandwich.go
@@ -0,0 +1,14 @@
+package main
+
+/*
+#define CGO_EXPORT_H_EXISTS
+#include "tests/core/c_linkmodes/add_sandwich.h"
+*/
+import "C"
+
+//export GoAdd
+func GoAdd(a, b int) int {
+ return int(C.add(C.int(a), C.int(b)))
+}
+
+func main() {}
diff --git a/tests/core/c_linkmodes/add_sandwich.h b/tests/core/c_linkmodes/add_sandwich.h
new file mode 100644
index 00000000..6295ab95
--- /dev/null
+++ b/tests/core/c_linkmodes/add_sandwich.h
@@ -0,0 +1 @@
+int add(int a, int b);
diff --git a/tests/core/c_linkmodes/add_test_archive.c b/tests/core/c_linkmodes/add_test_archive.c
new file mode 100644
index 00000000..1e585a42
--- /dev/null
+++ b/tests/core/c_linkmodes/add_test_archive.c
@@ -0,0 +1,11 @@
+#include <assert.h>
+#include "tests/core/c_linkmodes/adder_archive.h"
+
+#ifndef CGO_EXPORT_H_EXISTS
+#error cgo header did not include define
+#endif
+
+int main(int argc, char** argv) {
+ assert(GoAdd(42, 42) == 84);
+ return 0;
+}
diff --git a/tests/core/c_linkmodes/add_test_sandwich.c b/tests/core/c_linkmodes/add_test_sandwich.c
new file mode 100644
index 00000000..26efff70
--- /dev/null
+++ b/tests/core/c_linkmodes/add_test_sandwich.c
@@ -0,0 +1,11 @@
+#include <assert.h>
+#include "tests/core/c_linkmodes/adder_sandwich_archive.h"
+
+#ifndef CGO_EXPORT_H_EXISTS
+#error cgo header did not include define
+#endif
+
+int main(int argc, char** argv) {
+ assert(GoAdd(42, 42) == 84);
+ return 0;
+}
diff --git a/tests/core/c_linkmodes/add_test_shared.c b/tests/core/c_linkmodes/add_test_shared.c
new file mode 100644
index 00000000..2f57712e
--- /dev/null
+++ b/tests/core/c_linkmodes/add_test_shared.c
@@ -0,0 +1,11 @@
+#include <assert.h>
+#include "tests/core/c_linkmodes/adder_shared.h"
+
+#ifndef CGO_EXPORT_H_EXISTS
+#error cgo header did not include define
+#endif
+
+int main(int argc, char** argv) {
+ assert(GoAdd(42, 42) == 84);
+ return 0;
+}
diff --git a/tests/core/c_linkmodes/c-archive_empty_hdr_test.c b/tests/core/c_linkmodes/c-archive_empty_hdr_test.c
new file mode 100644
index 00000000..63ff5dfc
--- /dev/null
+++ b/tests/core/c_linkmodes/c-archive_empty_hdr_test.c
@@ -0,0 +1,17 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "tests/core/c_linkmodes/c-archive_empty_hdr.h"
+
+int main() { return 0; }
diff --git a/tests/core/c_linkmodes/crypto.go b/tests/core/c_linkmodes/crypto.go
new file mode 100644
index 00000000..a362c7ee
--- /dev/null
+++ b/tests/core/c_linkmodes/crypto.go
@@ -0,0 +1,18 @@
+package main
+
+import "C"
+
+import (
+ "crypto/rand"
+
+ "golang.org/x/crypto/nacl/box"
+)
+
+//export GoFn
+func GoFn() {
+ box.GenerateKey(rand.Reader)
+ return
+}
+
+func main() {
+}
diff --git a/tests/core/c_linkmodes/crypto_test_dl.c b/tests/core/c_linkmodes/crypto_test_dl.c
new file mode 100644
index 00000000..36e21495
--- /dev/null
+++ b/tests/core/c_linkmodes/crypto_test_dl.c
@@ -0,0 +1,30 @@
+#include <dlfcn.h>
+#include <stdio.h>
+
+#ifndef SO
+#error No SO path defined
+#endif
+
+int main() {
+ void* handle = dlopen(SO, RTLD_NOW);
+ if (!handle) {
+ printf("dlopen: %s\n", dlerror());
+ return 1;
+ }
+
+ typedef void (*gofn_t)();
+ gofn_t gofn = (gofn_t)dlsym(handle, "GoFn");
+ const char* dlsym_error = dlerror();
+ if (dlsym_error) {
+ printf("dlsym: %s\n", dlerror());
+ dlclose(handle);
+ return 1;
+ }
+
+ gofn();
+
+ if (dlclose(handle)) {
+ printf("dlclose: %s\n", dlerror());
+ }
+ return 0;
+}
diff --git a/tests/core/c_linkmodes/empty.go b/tests/core/c_linkmodes/empty.go
new file mode 100644
index 00000000..38dd16da
--- /dev/null
+++ b/tests/core/c_linkmodes/empty.go
@@ -0,0 +1,3 @@
+package main
+
+func main() {}
diff --git a/tests/core/c_linkmodes/go_with_cgo_dep.go b/tests/core/c_linkmodes/go_with_cgo_dep.go
new file mode 100644
index 00000000..cfaeb31f
--- /dev/null
+++ b/tests/core/c_linkmodes/go_with_cgo_dep.go
@@ -0,0 +1,29 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import "C"
+import (
+ "fmt"
+
+ "golang.org/x/sys/unix"
+)
+
+//export UnixHello
+func UnixHello() {
+ fmt.Printf("Hello, %d\n", unix.Getuid())
+}
+
+func main() {}
diff --git a/tests/core/c_linkmodes/go_with_cgo_dep_caller.cc b/tests/core/c_linkmodes/go_with_cgo_dep_caller.cc
new file mode 100644
index 00000000..cc771076
--- /dev/null
+++ b/tests/core/c_linkmodes/go_with_cgo_dep_caller.cc
@@ -0,0 +1,20 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#include "tests/core/c_linkmodes/go_with_cgo_dep.h"
+
+int main() {
+ UnixHello();
+ return 0;
+}
diff --git a/tests/core/c_linkmodes/skip.c b/tests/core/c_linkmodes/skip.c
new file mode 100644
index 00000000..33c14ce1
--- /dev/null
+++ b/tests/core/c_linkmodes/skip.c
@@ -0,0 +1,3 @@
+int main() {
+ return 0;
+}
diff --git a/tests/core/cgo/BUILD.bazel b/tests/core/cgo/BUILD.bazel
new file mode 100644
index 00000000..cc12203f
--- /dev/null
+++ b/tests/core/cgo/BUILD.bazel
@@ -0,0 +1,474 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_test(
+ name = "opts_test",
+ srcs = ["adder_test.go"],
+ embed = [":opts"],
+)
+
+genrule(
+ name = "generate_header_copts",
+ outs = ["generated_copts/generated_copts.h"],
+ cmd = "echo '#define GENERATED_COPTS 1' >$@",
+)
+
+genrule(
+ name = "generate_header_cppopts",
+ outs = ["generated_cppopts/generated_cppopts.h"],
+ cmd = "echo '#define GENERATED_CPPOPTS 1' >$@",
+)
+
+genrule(
+ name = "generate_header_cxxopts",
+ outs = ["generated_cxxopts/generated_cxxopts.h"],
+ cmd = "echo '#define GENERATED_CXXOPTS 1' >$@",
+)
+
+cc_library(
+ name = "generated_headers",
+ hdrs = [
+ "generated_copts/generated_copts.h",
+ "generated_cppopts/generated_cppopts.h",
+ "generated_cxxopts/generated_cxxopts.h",
+ ],
+)
+
+COPTS_INCLUDE_PREFIX = (package_name() if repository_name() == "@" else "external/%s/%s" % (
+ repository_name()[1:],
+ package_name(),
+))
+
+go_library(
+ name = "opts",
+ srcs = [
+ "add.c",
+ "add.cpp",
+ "add.h",
+ "adder.go",
+ ] + select({
+ "@io_bazel_rules_go//go/platform:darwin": [
+ "add.m",
+ "add.mm",
+ ],
+ "//conditions:default": [],
+ }),
+ cdeps = [":generated_headers"],
+ cgo = True,
+ copts = [
+ "-DRULES_GO_C",
+ "-I$(GENDIR)/%s/generated_copts" % COPTS_INCLUDE_PREFIX,
+ "-DDOLLAR_SIGN_C=$$", # the dollar sign should be escaped
+ ],
+ cppopts = [
+ "-DRULES_GO_CPP",
+ "-I$(GENDIR)/%s/generated_cppopts" % COPTS_INCLUDE_PREFIX,
+ "-DDOLLAR_SIGN_CPP=$$", # the dollar sign should be escaped
+ ],
+ cxxopts = [
+ "-DRULES_GO_CXX",
+ "-I$(GENDIR)/%s/generated_cxxopts" % COPTS_INCLUDE_PREFIX,
+ "-DDOLLAR_SIGN_CXX=$$", # the dollar sign should be escaped
+ ],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cxx",
+)
+
+go_test(
+ name = "dylib_test",
+ srcs = ["dylib_test.go"],
+ embed = [":dylib_client"],
+ rundir = ".",
+ tags = ["manual"], # //tests/core/cgo:generate_imported_dylib.sh must be run first
+)
+
+go_library(
+ name = "dylib_client",
+ srcs = ["dylib_client.go"],
+ cdeps = select({
+ "@io_bazel_rules_go//go/platform:darwin": [":darwin_imported_dylib"],
+ "//conditions:default": [":linux_imported_dylib"],
+ # TODO(jayconrod): Support windows, skip others.
+ }),
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cgo/dylib",
+ tags = ["manual"],
+)
+
+cc_import(
+ name = "darwin_imported_dylib",
+ shared_library = "libimported.dylib",
+ tags = ["manual"],
+)
+
+cc_import(
+ name = "linux_imported_dylib",
+ shared_library = ":libimported.so",
+ tags = ["manual"],
+)
+
+go_test(
+ name = "generated_dylib_test",
+ srcs = ["dylib_test.go"],
+ embed = [":generated_dylib_client"],
+ rundir = ".",
+)
+
+go_library(
+ name = "generated_dylib_client",
+ srcs = ["dylib_client.go"],
+ cdeps = select({
+ "@io_bazel_rules_go//go/platform:darwin": [":darwin_imported_generated_dylib"],
+ "//conditions:default": [":linux_imported_generated_dylib"],
+ # TODO(jayconrod): Support windows, skip others.
+ }),
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cgo/dylib",
+)
+
+cc_import(
+ name = "darwin_imported_generated_dylib",
+ shared_library = ":libimported_generated.dylib",
+ tags = ["manual"],
+)
+
+cc_binary(
+ name = "libimported_generated.dylib",
+ srcs = ["imported.c"],
+ linkopts = ["-Wl,-install_name,@rpath/libimported_generated.dylib"],
+ linkshared = True,
+ tags = ["manual"],
+)
+
+cc_import(
+ name = "linux_imported_generated_dylib",
+ shared_library = ":libimported_generated.so",
+ tags = ["manual"],
+)
+
+cc_binary(
+ name = "libimported_generated.so",
+ srcs = ["imported.c"],
+ linkshared = True,
+ tags = ["manual"],
+)
+
+# //tests/core/cgo:generate_imported_dylib.sh must be run first
+go_test(
+ name = "versioned_dylib_test",
+ srcs = ["dylib_test.go"],
+ embed = [":versioned_dylib_client"],
+ rundir = ".",
+ target_compatible_with = select({
+ "@platforms//os:osx": [],
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+)
+
+go_library(
+ name = "versioned_dylib_client",
+ srcs = ["dylib_client.go"],
+ cdeps = select({
+ "@io_bazel_rules_go//go/platform:darwin": [":darwin_imported_versioned_dylib"],
+ "//conditions:default": [":linux_imported_versioned_dylib"],
+ # TODO(jayconrod): Support windows, skip others.
+ }),
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cgo/dylib",
+ tags = ["manual"],
+)
+
+cc_import(
+ name = "linux_imported_versioned_dylib",
+ shared_library = "libversioned.so.2",
+ tags = ["manual"],
+)
+
+cc_import(
+ name = "darwin_imported_versioned_dylib",
+ shared_library = "libversioned.2.dylib",
+ tags = ["manual"],
+)
+
+go_test(
+ name = "oracle_convention_darwin_dylib_test",
+ srcs = ["dylib_test.go"],
+ embed = [":oracle_convention_darwin_dylib_client"],
+ rundir = ".",
+ target_compatible_with = ["@platforms//os:macos"],
+)
+
+go_library(
+ name = "oracle_convention_darwin_dylib_client",
+ srcs = ["dylib_client.go"],
+ cdeps = [":oracle_convention_darwin_dylib"],
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cgo/dylib",
+ target_compatible_with = ["@platforms//os:macos"],
+)
+
+# //tests/core/cgo:generate_imported_dylib.sh must be run first
+cc_library(
+ name = "oracle_convention_darwin_dylib",
+ srcs = [
+ "libversioned.dylib",
+ "libversioned.dylib.2",
+ ],
+ target_compatible_with = ["@platforms//os:macos"],
+)
+
+go_test(
+ name = "generated_versioned_dylib_test",
+ srcs = ["dylib_test.go"],
+ embed = [":generated_versioned_dylib_client"],
+ rundir = ".",
+)
+
+go_library(
+ name = "generated_versioned_dylib_client",
+ srcs = ["dylib_client.go"],
+ cdeps = select({
+ # This test exists just for versioned `.so`s on Linux,
+ # but we can reuse the above test's dylib so it passes on darwin,
+ # where filename suffixes are not used for library version.
+ "@io_bazel_rules_go//go/platform:darwin": [":darwin_imported_generated_dylib"],
+ "//conditions:default": [":linux_imported_generated_versioned_dylib"],
+ # TODO(jayconrod): Support windows, skip others.
+ }),
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cgo/dylib",
+)
+
+cc_library(
+ name = "linux_imported_generated_versioned_dylib",
+ srcs = [":libimported_generated.so.2"],
+ linkstatic = False,
+ tags = ["manual"],
+)
+
+cc_binary(
+ name = "libimported_generated.so.2",
+ srcs = ["imported.c"],
+ linkshared = True,
+ tags = ["manual"],
+)
+
+go_test(
+ name = "cc_libs_test",
+ srcs = [
+ "cc_libs_common.go",
+ "cc_libs_darwin_test.go",
+ "cc_libs_linux_test.go",
+ ],
+ data = [
+ ":c_srcs",
+ ":cc_deps",
+ ":cc_srcs",
+ ":pure",
+ ],
+ deps = ["//go/tools/bazel:go_default_library"],
+)
+
+go_binary(
+ name = "pure",
+ srcs = ["pure.go"],
+ out = "pure_bin",
+ cgo = True,
+ pure = "on",
+)
+
+go_binary(
+ name = "c_srcs",
+ srcs = [
+ "foo.c",
+ "foo.go",
+ ],
+ out = "c_srcs_bin",
+ cgo = True,
+)
+
+go_binary(
+ name = "cc_srcs",
+ srcs = [
+ "bar.cc",
+ "bar.go",
+ ],
+ out = "cc_srcs_bin",
+ cgo = True,
+)
+
+go_binary(
+ name = "cc_deps",
+ srcs = ["bar.go"],
+ out = "cc_deps_bin",
+ cdeps = [":bar_dep"],
+ cgo = True,
+)
+
+cc_library(
+ name = "bar_dep",
+ srcs = ["bar.cc"],
+)
+
+go_test(
+ name = "race_test",
+ srcs = [
+ "race_off.c",
+ "race_off.go",
+ "race_on.c",
+ "race_on.go",
+ "race_test.go",
+ ],
+ cgo = True,
+ race = "on",
+)
+
+go_test(
+ name = "tag_test",
+ srcs = ["tag_test.go"],
+ data = [
+ ":tag_cgo_bin",
+ ":tag_pure_bin",
+ ],
+ rundir = ".",
+ deps = ["//go/tools/bazel:go_default_library"],
+)
+
+go_binary(
+ name = "tag_pure_bin",
+ srcs = [
+ "tag_pure.go",
+ "tag_pure_err.c",
+ "tag_pure_err.go",
+ ],
+ cgo = True,
+ pure = "on",
+)
+
+go_binary(
+ name = "tag_cgo_bin",
+ srcs = [
+ "tag_cgo.go",
+ "tag_cgo_err.go",
+ ],
+ cgo = True,
+ pure = "off",
+)
+
+go_test(
+ name = "cgo_link_test",
+ srcs = [
+ "cgo_link_test.go",
+ "cgo_ref.go",
+ ],
+ cdeps = [":cgo_link_dep"],
+ cgo = True,
+)
+
+cc_library(
+ name = "cgo_link_dep",
+ srcs = ["cgo_link_dep.c"],
+)
+
+go_test(
+ name = "split_import_test",
+ srcs = [
+ "split_import_i_test.go",
+ "split_import_x_test.go",
+ ],
+ embed = [":split_import_a"],
+ deps = [":split_import_b"],
+)
+
+go_library(
+ name = "split_import_a",
+ srcs = ["split_import_a.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cgo/split_import/a",
+)
+
+go_library(
+ name = "split_import_b",
+ srcs = ["split_import_b.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cgo/split_import/b",
+ deps = [
+ ":split_import_a",
+ ":split_import_cgo",
+ ],
+)
+
+go_library(
+ name = "split_import_cgo",
+ srcs = ["split_import_cgo.go"],
+ cdeps = [":split_import_c"],
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cgo/split_import/cgo",
+)
+
+cc_library(
+ name = "split_import_c",
+ srcs = ["split_import_c.c"],
+ hdrs = ["split_import_c.h"],
+)
+
+go_bazel_test(
+ name = "external_includes_test",
+ srcs = ["external_includes_test.go"],
+)
+
+go_library(
+ name = "use_external_symbol",
+ srcs = ["use_external_symbol.go"],
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cgo/use_external_symbol",
+ tags = ["manual"],
+)
+
+go_binary(
+ name = "provide_external_symbol",
+ srcs = ["provide_external_symbol.go"],
+ cgo = True,
+ target_compatible_with = select({
+ "@platforms//os:osx": [],
+ "@platforms//os:linux": [],
+ "//conditions:default": ["@platforms//:incompatible"],
+ }),
+ deps = [":use_external_symbol"],
+)
+
+cc_library(
+ name = "native_dep",
+ srcs = ["native_dep.c"],
+ hdrs = ["native_dep.h"],
+ # Force static linking to ensure that the build doesn't succeed by
+ # accidentally picking up the shared library in the search path.
+ linkstatic = True,
+)
+
+go_library(
+ name = "transitive_dep",
+ srcs = ["transitive_dep.go"],
+ cdeps = [":native_dep"],
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cgo/transitive_dep",
+)
+
+go_library(
+ name = "direct_dep",
+ srcs = ["direct_dep.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cgo/direct_dep",
+ deps = [":transitive_dep"],
+)
+
+go_binary(
+ name = "use_transitive_symbol",
+ srcs = ["use_transitive_symbol.go"],
+ cgo = True,
+ linkmode = "c-archive",
+ deps = [":direct_dep"],
+)
+
+cc_binary(
+ name = "use_c_symbol_through_go",
+ srcs = ["use_c_symbol_through_go.c"],
+ deps = [":use_transitive_symbol"],
+)
diff --git a/tests/core/cgo/README.rst b/tests/core/cgo/README.rst
new file mode 100644
index 00000000..a385cab3
--- /dev/null
+++ b/tests/core/cgo/README.rst
@@ -0,0 +1,67 @@
+.. _#2067: https://github.com/bazelbuild/rules_go/issues/2067
+.. _#2622: https://github.com/bazelbuild/rules_go/issues/2622
+
+Basic cgo functionality
+=======================
+
+opts_test
+---------
+
+Checks that different sets of options are passed to C and C++ sources in a
+``go_library`` with ``cgo = True``.
+
+(generated_)?(versioned_)?dylib_test
+------------------------------------
+
+Checks that Go binaries can link against dynamic C libraries. Some libraries
+(especially those provided with ``cc_import``) may only have dynamic versions,
+and we should be able to link against them and find them at run-time.
+
+The non ``generated_`` tests are manual. The ``generate_imported_dylib.sh``
+script must be run before running the tests themselves.
+
+The ``generated_`` variants check that Go binaries can link against dynamic C
+libraries that are generated by another rule, rather than being included in the
+source tree.
+
+The ``versioned_`` variants check that Go binaries can link against dynamic C
+libraries that are only available as a versioned shared library, like
+``libfoo.so.1``, as used on Linux.
+
+cc_libs_test
+------------
+
+Checks that Go binaries that include cgo code may or may not link against
+libstdc++, depending on how they're linked. This tests several binaries:
+
+* ``pure_bin`` - built in ``"pure"`` mode, should not depend on libstdc++.
+* ``c_srcs`` - has no C++ code in sources, should not depend on libstdc++.
+* ``cc_srcs`` - has some C++ code in sources, should depend on libstdc++.
+* ``cc_deps`` - depends on a ``cc_library``, should depend on libstdc++
+ because we don't know what's in it.
+
+race_test
+---------
+
+Checks that cgo code in a binary with ``race = "on"`` is compiled in race mode.
+Verifies #1592.
+
+tag_test
+--------
+
+Checks that sources with ``// +build cgo`` are built when cgo is enabled
+(whether or not ``cgo = True`` is set), and sources with ``// +build !cgo``
+are only built in pure mode.
+
+cdeps_link_test
+---------------
+
+Checks that libraries in ``cdeps`` are linked into the generated ``_cgo_.o``
+executable used to produce ``_cgo_imports.go``. Verifies `#2067`_.
+
+split_import_test
+-----------------
+
+Checks that when a package with ``cdeps`` is recompiled due to a split test,
+the input files from ``cdeps`` are included in the recompilation and are passed
+to the linker. Verifies `#2622`_.
diff --git a/tests/core/cgo/add.c b/tests/core/cgo/add.c
new file mode 100644
index 00000000..fba09af2
--- /dev/null
+++ b/tests/core/cgo/add.c
@@ -0,0 +1,19 @@
+#include <add.h>
+#include <generated_cppopts.h>
+#include <generated_copts.h>
+
+#if !defined(RULES_GO_C) || !defined(RULES_GO_CPP) || defined(RULES_GO_CXX)
+#error This is a C file, only RULES_GO_C and RULES_GO_CPP should be defined.
+#endif
+
+#if !defined(GENERATED_COPTS) || !defined(GENERATED_CPPOPTS) || defined(GENERATED_CXXOPTS)
+#error Generated headers should be correctly included
+#endif
+
+int add_c(int a, int b) {
+ int $ = 0;
+ int sum = a + b;
+ sum += DOLLAR_SIGN_C;
+ sum += DOLLAR_SIGN_CPP;
+ return sum;
+}
diff --git a/tests/core/cgo/add.cpp b/tests/core/cgo/add.cpp
new file mode 100644
index 00000000..e5dbc0a9
--- /dev/null
+++ b/tests/core/cgo/add.cpp
@@ -0,0 +1,19 @@
+#include "add.h"
+#include <generated_cppopts.h>
+#include <generated_cxxopts.h>
+
+#if !defined(RULES_GO_CPP) || !defined(RULES_GO_CXX) || defined(RULES_GO_C)
+#error This is a C++ file, only RULES_GO_CXX and RULES_GO_CPP should be defined.
+#endif
+
+#if !defined(GENERATED_CPPOPTS) || !defined(GENERATED_CXXOPTS) || defined(GENERATED_COPTS)
+#error Generated headers should be correctly included
+#endif
+
+int add_cpp(int a, int b) {
+ int $ = 0;
+ int sum = a + b;
+ sum += DOLLAR_SIGN_CXX;
+ sum += DOLLAR_SIGN_CPP;
+ return sum;
+}
diff --git a/tests/core/cgo/add.h b/tests/core/cgo/add.h
new file mode 100644
index 00000000..eb2c7c77
--- /dev/null
+++ b/tests/core/cgo/add.h
@@ -0,0 +1,10 @@
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int add_c(int a, int b);
+int add_cpp(int a, int b);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/tests/core/cgo/add.m b/tests/core/cgo/add.m
new file mode 100644
index 00000000..5a321b29
--- /dev/null
+++ b/tests/core/cgo/add.m
@@ -0,0 +1,11 @@
+#include "add.h"
+#include <generated_cppopts.h>
+#include <generated_copts.h>
+
+#if !defined(RULES_GO_C) || !defined(RULES_GO_CPP) || defined(RULES_GO_CXX)
+#error This is an Objective-C file, only RULES_GO_C and RULES_GO_CPP should be defined.
+#endif
+
+#if !defined(GENERATED_COPTS) || !defined(GENERATED_CPPOPTS) || defined(GENERATED_CXXOPTS)
+#error Generated headers should be correctly included
+#endif
diff --git a/tests/core/cgo/add.mm b/tests/core/cgo/add.mm
new file mode 100644
index 00000000..aed54ab5
--- /dev/null
+++ b/tests/core/cgo/add.mm
@@ -0,0 +1,11 @@
+#include "add.h"
+#include <generated_cppopts.h>
+#include <generated_cxxopts.h>
+
+#if !defined(RULES_GO_CPP) || !defined(RULES_GO_CXX) || defined(RULES_GO_C)
+#error This is an Objective-C++ file, only RULES_GO_CXX and RULES_GO_CPP should be defined.
+#endif
+
+#if !defined(GENERATED_CPPOPTS) || !defined(GENERATED_CXXOPTS) || defined(GENERATED_COPTS)
+#error Generated headers should be correctly included
+#endif
diff --git a/tests/core/cgo/adder.go b/tests/core/cgo/adder.go
new file mode 100644
index 00000000..e8e2f403
--- /dev/null
+++ b/tests/core/cgo/adder.go
@@ -0,0 +1,14 @@
+package objc
+
+/*
+#include "add.h"
+*/
+import "C"
+
+func AddC(a, b int32) int32 {
+ return int32(C.add_c(C.int(a), C.int(b)))
+}
+
+func AddCPP(a, b int32) int32 {
+ return int32(C.add_cpp(C.int(a), C.int(b)))
+}
diff --git a/tests/core/cgo/adder_test.go b/tests/core/cgo/adder_test.go
new file mode 100644
index 00000000..fc9bf451
--- /dev/null
+++ b/tests/core/cgo/adder_test.go
@@ -0,0 +1,19 @@
+package objc
+
+import (
+ "fmt"
+ "math/rand"
+ "testing"
+)
+
+func TestCPPAdder(t *testing.T) {
+ a := rand.Int31()
+ b := rand.Int31()
+ expected := a + b
+ if result := AddC(a, b); result != expected {
+ t.Error(fmt.Errorf("wrong result: got %d, expected %d", result, expected))
+ }
+ if result := AddCPP(a, b); result != expected {
+ t.Error(fmt.Errorf("wrong result: got %d, expected %d", result, expected))
+ }
+}
diff --git a/tests/core/cgo/bar.cc b/tests/core/cgo/bar.cc
new file mode 100644
index 00000000..d72f5123
--- /dev/null
+++ b/tests/core/cgo/bar.cc
@@ -0,0 +1,9 @@
+#include <iostream>
+
+extern "C" {
+
+void bar() {
+ std::cout << "bar" << std::endl;
+}
+
+}
diff --git a/tests/core/cgo/bar.go b/tests/core/cgo/bar.go
new file mode 100644
index 00000000..92562dd4
--- /dev/null
+++ b/tests/core/cgo/bar.go
@@ -0,0 +1,8 @@
+package main
+
+// void bar();
+import "C"
+
+func main() {
+ C.bar()
+}
diff --git a/tests/core/cgo/cc_libs_common.go b/tests/core/cgo/cc_libs_common.go
new file mode 100644
index 00000000..40a04ed5
--- /dev/null
+++ b/tests/core/cgo/cc_libs_common.go
@@ -0,0 +1,34 @@
+package cc_libs_test
+
+import (
+ "bytes"
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+ "io/ioutil"
+ "testing"
+)
+
+// A distinctive substring contained in every absolute path pointing into the
+// Bazel cache.
+const execPathIndicator = "/execroot/io_bazel_rules_go"
+
+func verifyNoCachePaths(t *testing.T, shortPath string) {
+ binPath, err := bazel.Runfile(shortPath)
+ if err != nil {
+ t.Error(err)
+ }
+ binBytes, err := ioutil.ReadFile(binPath)
+ if err != nil {
+ t.Error(err)
+ }
+ if pos := bytes.Index(binBytes, []byte(execPathIndicator)); pos != -1 {
+ begin := pos - 150
+ if begin < 0 {
+ begin = 0
+ }
+ end := pos + 150
+ if end > len(binBytes) {
+ end = len(binBytes)
+ }
+ t.Errorf("%s leaks an absolute path:\n%q", shortPath, binBytes[begin:end])
+ }
+}
diff --git a/tests/core/cgo/cc_libs_darwin_test.go b/tests/core/cgo/cc_libs_darwin_test.go
new file mode 100644
index 00000000..4201dbf2
--- /dev/null
+++ b/tests/core/cgo/cc_libs_darwin_test.go
@@ -0,0 +1,96 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package cc_libs_test
+
+import (
+ "debug/macho"
+ "path"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+)
+
+func TestBinaries(t *testing.T) {
+ for _, test := range []struct {
+ shortPath string
+ wantLibs map[string]bool
+ }{
+ {
+ shortPath: "tests/core/cgo/pure_bin",
+ // Since go1.11, pure binaries have a dependency on libSystem.
+ // This is true with go tool link -linkmode=internal
+ // and with CGO_ENABLED=0 go build ...
+ wantLibs: map[string]bool{"libc++": false},
+ }, {
+ shortPath: "tests/core/cgo/c_srcs_bin",
+ wantLibs: map[string]bool{"libSystem": true, "libc++": false},
+ }, {
+ shortPath: "tests/core/cgo/cc_srcs_bin",
+ wantLibs: map[string]bool{"libSystem": true, "libc++": true},
+ }, {
+ shortPath: "tests/core/cgo/cc_deps_bin",
+ wantLibs: map[string]bool{"libSystem": true, "libc++": true},
+ },
+ } {
+ t.Run(path.Base(test.shortPath), func(t *testing.T) {
+ libs, err := listLibs(test.shortPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ haveLibs := make(map[string]bool)
+ for _, lib := range libs {
+ haveLibs[lib] = true
+ }
+ for haveLib := range haveLibs {
+ if wantLib, ok := test.wantLibs[haveLib]; ok && !wantLib {
+ t.Errorf("unexpected dependency on library %q", haveLib)
+ }
+ }
+ for wantLib, want := range test.wantLibs {
+ if want && !haveLibs[wantLib] {
+ t.Errorf("wanted dependency on library %q", wantLib)
+ }
+ }
+
+ verifyNoCachePaths(t, test.shortPath)
+ })
+ }
+}
+
+func listLibs(shortPath string) ([]string, error) {
+ binPath, err := bazel.Runfile(shortPath)
+ if err != nil {
+ return nil, err
+ }
+ f, err := macho.Open(binPath)
+ if err != nil {
+ return nil, err
+ }
+ defer f.Close()
+ libs, err := f.ImportedLibraries()
+ if err != nil {
+ return nil, err
+ }
+ for i := range libs {
+ if pos := strings.LastIndexByte(libs[i], '/'); pos >= 0 {
+ libs[i] = libs[i][pos+1:]
+ }
+ if pos := strings.IndexByte(libs[i], '.'); pos >= 0 {
+ libs[i] = libs[i][:pos]
+ }
+ }
+ return libs, nil
+}
diff --git a/tests/core/cgo/cc_libs_linux_test.go b/tests/core/cgo/cc_libs_linux_test.go
new file mode 100644
index 00000000..204a8fcf
--- /dev/null
+++ b/tests/core/cgo/cc_libs_linux_test.go
@@ -0,0 +1,93 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package cc_libs_test
+
+import (
+ "debug/elf"
+ "path"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+)
+
+func TestBinaries(t *testing.T) {
+ for _, test := range []struct {
+ shortPath string
+ wantLibs map[string]bool
+ }{
+ {
+ shortPath: "tests/core/cgo/pure_bin",
+ wantLibs: map[string]bool{"libc": false, "libstdc++": false},
+ }, {
+ shortPath: "tests/core/cgo/c_srcs_bin",
+ wantLibs: map[string]bool{"libc": true, "libstdc++": false},
+ }, {
+ shortPath: "tests/core/cgo/cc_srcs_bin",
+ wantLibs: map[string]bool{"libc": true, "libstdc++": true},
+ }, {
+ shortPath: "tests/core/cgo/cc_deps_bin",
+ wantLibs: map[string]bool{"libc": true, "libstdc++": true},
+ },
+ } {
+ t.Run(path.Base(test.shortPath), func(t *testing.T) {
+ libs, err := listLibs(test.shortPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ haveLibs := make(map[string]bool)
+ for _, lib := range libs {
+ haveLibs[lib] = true
+ }
+ for haveLib := range haveLibs {
+ if wantLib, ok := test.wantLibs[haveLib]; ok && !wantLib {
+ t.Errorf("unexpected dependency on library %q", haveLib)
+ }
+ }
+ for wantLib, want := range test.wantLibs {
+ if want && !haveLibs[wantLib] {
+ t.Errorf("wanted dependency on library %q", wantLib)
+ }
+ }
+
+ verifyNoCachePaths(t, test.shortPath)
+ })
+ }
+}
+
+func listLibs(shortPath string) ([]string, error) {
+ binPath, err := bazel.Runfile(shortPath)
+ if err != nil {
+ return nil, err
+ }
+ f, err := elf.Open(binPath)
+ if err != nil {
+ return nil, err
+ }
+ defer f.Close()
+ libs, err := f.ImportedLibraries()
+ if err != nil {
+ return nil, err
+ }
+ for i := range libs {
+ if pos := strings.LastIndexByte(libs[i], '/'); pos >= 0 {
+ libs[i] = libs[i][pos+1:]
+ }
+ if pos := strings.IndexByte(libs[i], '.'); pos >= 0 {
+ libs[i] = libs[i][:pos]
+ }
+ }
+ return libs, nil
+}
diff --git a/tests/core/cgo/cgo_link_dep.c b/tests/core/cgo/cgo_link_dep.c
new file mode 100644
index 00000000..c102d587
--- /dev/null
+++ b/tests/core/cgo/cgo_link_dep.c
@@ -0,0 +1,15 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+int f() { return 42; }
diff --git a/tests/core/cgo/cgo_link_test.go b/tests/core/cgo/cgo_link_test.go
new file mode 100644
index 00000000..fcd3d00f
--- /dev/null
+++ b/tests/core/cgo/cgo_link_test.go
@@ -0,0 +1,24 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package cgo_link
+
+import "testing"
+
+func Test(t *testing.T) {
+ want := 42
+ if got := F(); got != want {
+ t.Errorf("got %d; want %d", got, want)
+ }
+}
diff --git a/tests/core/cgo/cgo_ref.go b/tests/core/cgo/cgo_ref.go
new file mode 100644
index 00000000..f425e188
--- /dev/null
+++ b/tests/core/cgo/cgo_ref.go
@@ -0,0 +1,20 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package cgo_link
+
+// int f();
+import "C"
+
+func F() int { return int(C.f()) }
diff --git a/tests/core/cgo/direct_dep.go b/tests/core/cgo/direct_dep.go
new file mode 100644
index 00000000..6f717863
--- /dev/null
+++ b/tests/core/cgo/direct_dep.go
@@ -0,0 +1,9 @@
+package direct_dep
+
+import (
+ "github.com/bazelbuild/rules_go/tests/core/cgo/transitive_dep"
+)
+
+func PrintGreeting() {
+ transitive_dep.PrintGreeting()
+}
diff --git a/tests/core/cgo/dylib_client.go b/tests/core/cgo/dylib_client.go
new file mode 100644
index 00000000..7356d127
--- /dev/null
+++ b/tests/core/cgo/dylib_client.go
@@ -0,0 +1,10 @@
+package dylib
+
+/*
+extern int foo();
+*/
+import "C"
+
+func Foo() int {
+ return int(C.foo())
+}
diff --git a/tests/core/cgo/dylib_test.go b/tests/core/cgo/dylib_test.go
new file mode 100644
index 00000000..03aa1f36
--- /dev/null
+++ b/tests/core/cgo/dylib_test.go
@@ -0,0 +1,10 @@
+package dylib
+
+import "testing"
+
+func TestFoo(t *testing.T) {
+ want := 42
+ if got := Foo(); got != want {
+ t.Errorf("got %d ; want %d", got, want)
+ }
+}
diff --git a/tests/core/cgo/external_includes_test.go b/tests/core/cgo/external_includes_test.go
new file mode 100644
index 00000000..0e1ba06a
--- /dev/null
+++ b/tests/core/cgo/external_includes_test.go
@@ -0,0 +1,85 @@
+// Copyright 2020 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package external_includes_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- other_repo/WORKSPACE --
+-- other_repo/cc/BUILD.bazel --
+cc_binary(
+ name = "main",
+ srcs = ["main.c"],
+ deps = ["//cgo"],
+)
+-- other_repo/cc/main.c --
+#include "cgo/cgo.h"
+
+int main() {}
+-- other_repo/cgo/BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+
+go_binary(
+ name = "cgo",
+ embed = [":cgo_lib"],
+ importpath = "example.com/rules_go/cgo",
+ linkmode = "c-archive",
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "cgo_lib",
+ srcs = ["cgo.go"],
+ cgo = True,
+ importpath = "example.com/rules_go/cgo",
+ visibility = ["//visibility:private"],
+)
+-- other_repo/cgo/cgo.go --
+package main
+
+import "C"
+
+//export HelloCgo
+func HelloCgo() {}
+
+func main() {}
+`,
+ WorkspaceSuffix: `
+local_repository(
+ name = "other_repo",
+ path = "other_repo",
+)
+`,
+ })
+}
+
+func TestExternalIncludes(t *testing.T) {
+ t.Run("default", func(t *testing.T) {
+ if err := bazel_testing.RunBazel("build", "@other_repo//cc:main"); err != nil {
+ t.Fatalf("Did not expect error:\n%+v", err)
+ }
+ })
+ t.Run("experimental_sibling_repository_layout", func(t *testing.T) {
+ if err := bazel_testing.RunBazel("build", "--experimental_sibling_repository_layout", "@other_repo//cc:main"); err != nil {
+ t.Fatalf("Did not expect error:\n%+v", err)
+ }
+ })
+}
diff --git a/tests/core/cgo/foo.c b/tests/core/cgo/foo.c
new file mode 100644
index 00000000..0992a7d1
--- /dev/null
+++ b/tests/core/cgo/foo.c
@@ -0,0 +1,7 @@
+#include <stdio.h>
+
+void foo() {
+ printf("foo\n");
+}
+
+
diff --git a/tests/core/cgo/foo.go b/tests/core/cgo/foo.go
new file mode 100644
index 00000000..4403a51c
--- /dev/null
+++ b/tests/core/cgo/foo.go
@@ -0,0 +1,8 @@
+package main
+
+// void foo();
+import "C"
+
+func main() {
+ C.foo()
+}
diff --git a/tests/core/cgo/generate_imported_dylib.sh b/tests/core/cgo/generate_imported_dylib.sh
new file mode 100755
index 00000000..41227b77
--- /dev/null
+++ b/tests/core/cgo/generate_imported_dylib.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+set -exo pipefail
+
+cd "$(dirname "$0")"
+
+case "$(uname -s)" in
+ Linux*)
+ cc -shared -o libimported.so imported.c
+ cc -shared -o libversioned.so.2 imported.c
+ ;;
+ Darwin*)
+ cc -shared -Wl,-install_name,@rpath/libimported.dylib -o libimported.dylib imported.c
+ # According to "Mac OS X For Unix Geeks", 4th Edition, Chapter 11, versioned dylib for macOS
+ # should be libversioned.2.dylib.
+ cc -shared -Wl,-install_name,@rpath/libversioned.2.dylib -o libversioned.2.dylib imported.c
+ # However, Oracle Instant Client was distributed as libclntsh.dylib.12.1 with a unversioed
+ # symlink (https://www.oracle.com/database/technologies/instant-client/macos-intel-x86-downloads.html).
+ # Let's cover this non-standard case as well.
+ cc -shared -Wl,-install_name,@rpath/libversioned.dylib.2 -o libversioned.dylib.2 imported.c
+ ln -fs libversioned.dylib.2 libversioned.dylib
+ ;;
+ *)
+ echo "Unsupported OS: $(uname -s)" >&2
+ exit 1
+esac
diff --git a/tests/core/cgo/imported.c b/tests/core/cgo/imported.c
new file mode 100644
index 00000000..bf7759e1
--- /dev/null
+++ b/tests/core/cgo/imported.c
@@ -0,0 +1 @@
+int foo() { return 42; }
diff --git a/tests/core/cgo/native_dep.c b/tests/core/cgo/native_dep.c
new file mode 100644
index 00000000..f6504a85
--- /dev/null
+++ b/tests/core/cgo/native_dep.c
@@ -0,0 +1,5 @@
+#include <stdio.h>
+
+void native_greeting(void) {
+ printf("Hello, world!\n");
+}
diff --git a/tests/core/cgo/native_dep.h b/tests/core/cgo/native_dep.h
new file mode 100644
index 00000000..5d750beb
--- /dev/null
+++ b/tests/core/cgo/native_dep.h
@@ -0,0 +1 @@
+extern void native_greeting(void);
diff --git a/tests/core/cgo/objc/BUILD.bazel b/tests/core/cgo/objc/BUILD.bazel
new file mode 100644
index 00000000..030408f1
--- /dev/null
+++ b/tests/core/cgo/objc/BUILD.bazel
@@ -0,0 +1,32 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_test(
+ name = "objc_test",
+ srcs = ["objc_darwin_test.go"],
+ embed = select({
+ "@io_bazel_rules_go//go/platform:darwin": [":objc_lib"],
+ "//conditions:default": [],
+ }),
+)
+
+go_library(
+ name = "objc_lib",
+ srcs = [
+ "add_darwin.go",
+ "add_darwin.h",
+ "add_darwin.m",
+ "sub_darwin.go",
+ ],
+ cdeps = [":sub"],
+ cgo = True,
+ copts = ["-fmodules"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cgo/objc",
+ tags = ["manual"],
+)
+
+objc_library(
+ name = "sub",
+ srcs = ["sub.m"],
+ enable_modules = True,
+ tags = ["manual"],
+)
diff --git a/tests/core/cgo/objc/README.rst b/tests/core/cgo/objc/README.rst
new file mode 100644
index 00000000..86faa182
--- /dev/null
+++ b/tests/core/cgo/objc/README.rst
@@ -0,0 +1,8 @@
+Objective C / cgo functionality
+===============================
+
+objc_test
+---------
+
+Checks that a Go target with Objective C code (both embedded and in an
+``objc_library`` ``cdeps`` dependency) compiles, links, and executes.
diff --git a/tests/core/cgo/objc/add_darwin.go b/tests/core/cgo/objc/add_darwin.go
new file mode 100644
index 00000000..76bdaf97
--- /dev/null
+++ b/tests/core/cgo/objc/add_darwin.go
@@ -0,0 +1,10 @@
+package objc
+
+/*
+#include "add_darwin.h"
+*/
+import "C"
+
+func Add(a, b int32) int32 {
+ return int32(C.add(C.int(a), C.int(b)))
+}
diff --git a/tests/core/cgo/objc/add_darwin.h b/tests/core/cgo/objc/add_darwin.h
new file mode 100644
index 00000000..6295ab95
--- /dev/null
+++ b/tests/core/cgo/objc/add_darwin.h
@@ -0,0 +1 @@
+int add(int a, int b);
diff --git a/tests/core/cgo/objc/add_darwin.m b/tests/core/cgo/objc/add_darwin.m
new file mode 100644
index 00000000..ffd02430
--- /dev/null
+++ b/tests/core/cgo/objc/add_darwin.m
@@ -0,0 +1,22 @@
+@import Foundation;
+
+#include "add_darwin.h"
+
+@interface Adder : NSObject
+
+- (int)add:(int)num1 andNum2:(int)num2;
+
+@end
+
+@implementation Adder
+
+- (int)add:(int)num1 andNum2:(int)num2{
+ return num1 + num2;
+}
+
+@end
+
+int add(int a, int b) {
+ Adder* adder = [[Adder alloc] init];
+ return [adder add:a andNum2:b];
+}
diff --git a/tests/core/cgo/objc/objc_darwin_test.go b/tests/core/cgo/objc/objc_darwin_test.go
new file mode 100644
index 00000000..5d475b4d
--- /dev/null
+++ b/tests/core/cgo/objc/objc_darwin_test.go
@@ -0,0 +1,16 @@
+package objc
+
+import (
+ "fmt"
+ "math/rand"
+ "testing"
+)
+
+func TestObjcMethod(t *testing.T) {
+ a := rand.Int31()
+ b := rand.Int31()
+ expected := a + b
+ if result := Add(a, b); result != expected {
+ t.Error(fmt.Errorf("wrong result: expected %d, got %d", expected, result))
+ }
+}
diff --git a/tests/core/cgo/objc/sub.m b/tests/core/cgo/objc/sub.m
new file mode 100644
index 00000000..3b408ea8
--- /dev/null
+++ b/tests/core/cgo/objc/sub.m
@@ -0,0 +1,20 @@
+@import Foundation;
+
+@interface Subber : NSObject
+
+- (int)sub:(int)num1 andNum2:(int)num2;
+
+@end
+
+@implementation Subber
+
+- (int)sub:(int)num1 andNum2:(int)num2{
+ return num1 - num2;
+}
+
+@end
+
+int sub(int a, int b) {
+ Subber* subber = [[Subber alloc] init];
+ return [subber sub:a andNum2:b];
+}
diff --git a/tests/core/cgo/objc/sub_darwin.go b/tests/core/cgo/objc/sub_darwin.go
new file mode 100644
index 00000000..5b780307
--- /dev/null
+++ b/tests/core/cgo/objc/sub_darwin.go
@@ -0,0 +1,10 @@
+package objc
+
+/*
+int sub(int a, int b);
+*/
+import "C"
+
+func Sub(a, b int32) int32 {
+ return int32(C.sub(C.int(a), C.int(b)))
+}
diff --git a/tests/core/cgo/provide_external_symbol.go b/tests/core/cgo/provide_external_symbol.go
new file mode 100644
index 00000000..68d9fce1
--- /dev/null
+++ b/tests/core/cgo/provide_external_symbol.go
@@ -0,0 +1,12 @@
+package main
+
+import "C"
+
+import "github.com/bazelbuild/rules_go/tests/core/cgo/use_external_symbol"
+
+//export external_symbol
+func external_symbol() {}
+
+func main() {
+ use_external_symbol.UseExternalSymbol()
+}
diff --git a/tests/core/cgo/pure.go b/tests/core/cgo/pure.go
new file mode 100644
index 00000000..38dd16da
--- /dev/null
+++ b/tests/core/cgo/pure.go
@@ -0,0 +1,3 @@
+package main
+
+func main() {}
diff --git a/tests/core/cgo/race_off.c b/tests/core/cgo/race_off.c
new file mode 100644
index 00000000..f752c63c
--- /dev/null
+++ b/tests/core/cgo/race_off.c
@@ -0,0 +1,3 @@
+// +build !race
+
+int race_enabled = 0;
diff --git a/tests/core/cgo/race_off.go b/tests/core/cgo/race_off.go
new file mode 100644
index 00000000..b572268e
--- /dev/null
+++ b/tests/core/cgo/race_off.go
@@ -0,0 +1,5 @@
+// +build !race
+
+package race
+
+const goRaceEnabled = false
diff --git a/tests/core/cgo/race_on.c b/tests/core/cgo/race_on.c
new file mode 100644
index 00000000..9b79ea31
--- /dev/null
+++ b/tests/core/cgo/race_on.c
@@ -0,0 +1,3 @@
+// +build race
+
+int race_enabled = 1;
diff --git a/tests/core/cgo/race_on.go b/tests/core/cgo/race_on.go
new file mode 100644
index 00000000..7f172dc5
--- /dev/null
+++ b/tests/core/cgo/race_on.go
@@ -0,0 +1,5 @@
+// +build race
+
+package race
+
+const goRaceEnabled = true
diff --git a/tests/core/cgo/race_test.go b/tests/core/cgo/race_test.go
new file mode 100644
index 00000000..c9344bac
--- /dev/null
+++ b/tests/core/cgo/race_test.go
@@ -0,0 +1,31 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package race
+
+// extern int race_enabled;
+import "C"
+import "testing"
+
+func TestGo(t *testing.T) {
+ if !goRaceEnabled {
+ t.Error("goRaceEnabled is false")
+ }
+}
+
+func TestC(t *testing.T) {
+ if C.race_enabled == 0 {
+ t.Error("C.race_enabled is false")
+ }
+}
diff --git a/tests/core/cgo/split_import_a.go b/tests/core/cgo/split_import_a.go
new file mode 100644
index 00000000..4b0e38a1
--- /dev/null
+++ b/tests/core/cgo/split_import_a.go
@@ -0,0 +1,3 @@
+package a
+
+func Answer() int { return 42 }
diff --git a/tests/core/cgo/split_import_b.go b/tests/core/cgo/split_import_b.go
new file mode 100644
index 00000000..2d8410fa
--- /dev/null
+++ b/tests/core/cgo/split_import_b.go
@@ -0,0 +1,10 @@
+package b
+
+import (
+ "github.com/bazelbuild/rules_go/tests/core/cgo/split_import/a"
+ "github.com/bazelbuild/rules_go/tests/core/cgo/split_import/cgo"
+)
+
+func HalfAnswer() int {
+ return cgo.Half(a.Answer())
+}
diff --git a/tests/core/cgo/split_import_c.c b/tests/core/cgo/split_import_c.c
new file mode 100644
index 00000000..b20e936e
--- /dev/null
+++ b/tests/core/cgo/split_import_c.c
@@ -0,0 +1,2 @@
+int half(int x) { return x/2; }
+
diff --git a/tests/core/cgo/split_import_c.h b/tests/core/cgo/split_import_c.h
new file mode 100644
index 00000000..35731ef1
--- /dev/null
+++ b/tests/core/cgo/split_import_c.h
@@ -0,0 +1,6 @@
+#ifndef split_import_c
+#define split_import_c
+
+int half(int);
+
+#endif
diff --git a/tests/core/cgo/split_import_cgo.go b/tests/core/cgo/split_import_cgo.go
new file mode 100644
index 00000000..b15bc16f
--- /dev/null
+++ b/tests/core/cgo/split_import_cgo.go
@@ -0,0 +1,10 @@
+package cgo
+
+/*
+#include "tests/core/cgo/split_import_c.h"
+*/
+import "C"
+
+func Half(x int) int {
+ return int(C.half(C.int(x)))
+}
diff --git a/tests/core/cgo/split_import_i_test.go b/tests/core/cgo/split_import_i_test.go
new file mode 100644
index 00000000..77429eff
--- /dev/null
+++ b/tests/core/cgo/split_import_i_test.go
@@ -0,0 +1,9 @@
+package a
+
+import "testing"
+
+func TestInternal(t *testing.T) {
+ if Answer() != 42 {
+ t.Error("wrong answer")
+ }
+}
diff --git a/tests/core/cgo/split_import_x_test.go b/tests/core/cgo/split_import_x_test.go
new file mode 100644
index 00000000..9202eaad
--- /dev/null
+++ b/tests/core/cgo/split_import_x_test.go
@@ -0,0 +1,13 @@
+package a_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/core/cgo/split_import/b"
+)
+
+func TestExternal(t *testing.T) {
+ if b.HalfAnswer() != 21 {
+ t.Error("wrong answer")
+ }
+}
diff --git a/tests/core/cgo/tag_cgo.go b/tests/core/cgo/tag_cgo.go
new file mode 100644
index 00000000..e8185f85
--- /dev/null
+++ b/tests/core/cgo/tag_cgo.go
@@ -0,0 +1,10 @@
+package main
+
+// const char *msg = "cgo";
+import "C"
+
+import "fmt"
+
+func main() {
+ fmt.Println(C.GoString(C.msg))
+}
diff --git a/tests/core/cgo/tag_cgo_err.go b/tests/core/cgo/tag_cgo_err.go
new file mode 100644
index 00000000..4e3a9fa4
--- /dev/null
+++ b/tests/core/cgo/tag_cgo_err.go
@@ -0,0 +1,6 @@
+// +build !cgo
+
+package main
+
+// this file should not be compiled
+!!!
diff --git a/tests/core/cgo/tag_pure.go b/tests/core/cgo/tag_pure.go
new file mode 100644
index 00000000..eca8e6fd
--- /dev/null
+++ b/tests/core/cgo/tag_pure.go
@@ -0,0 +1,9 @@
+// +build !cgo
+
+package main
+
+import "fmt"
+
+func main() {
+ fmt.Println("pure")
+}
diff --git a/tests/core/cgo/tag_pure_err.c b/tests/core/cgo/tag_pure_err.c
new file mode 100644
index 00000000..c92fa97c
--- /dev/null
+++ b/tests/core/cgo/tag_pure_err.c
@@ -0,0 +1 @@
+#error should not be compiled
diff --git a/tests/core/cgo/tag_pure_err.go b/tests/core/cgo/tag_pure_err.go
new file mode 100644
index 00000000..32b6e953
--- /dev/null
+++ b/tests/core/cgo/tag_pure_err.go
@@ -0,0 +1,6 @@
+// +build cgo
+
+package main
+
+// this file should not be compiled
+!!!
diff --git a/tests/core/cgo/tag_test.go b/tests/core/cgo/tag_test.go
new file mode 100644
index 00000000..b1ad4c99
--- /dev/null
+++ b/tests/core/cgo/tag_test.go
@@ -0,0 +1,38 @@
+package tag
+
+import (
+ "os/exec"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+)
+
+func Test(t *testing.T) {
+ for _, tc := range []struct {
+ name, path, want string
+ }{
+ {
+ name: "tag_pure_bin",
+ want: "pure",
+ }, {
+ name: "tag_cgo_bin",
+ want: "cgo",
+ },
+ } {
+ t.Run(tc.name, func(t *testing.T) {
+ path, ok := bazel.FindBinary("tests/core/cgo", tc.name)
+ if !ok {
+ t.Fatalf("could not find binary: %s", tc.name)
+ }
+ out, err := exec.Command(path).Output()
+ if err != nil {
+ t.Fatal(err)
+ }
+ got := strings.TrimSpace(string(out))
+ if got != tc.want {
+ t.Errorf("got %s; want %s", got, tc.want)
+ }
+ })
+ }
+}
diff --git a/tests/core/cgo/transitive_dep.go b/tests/core/cgo/transitive_dep.go
new file mode 100644
index 00000000..40632f50
--- /dev/null
+++ b/tests/core/cgo/transitive_dep.go
@@ -0,0 +1,10 @@
+package transitive_dep
+
+/*
+#include "tests/core/cgo/native_dep.h"
+ */
+import "C"
+
+func PrintGreeting() {
+ C.native_greeting();
+}
diff --git a/tests/core/cgo/use_c_symbol_through_go.c b/tests/core/cgo/use_c_symbol_through_go.c
new file mode 100644
index 00000000..bd5b7fec
--- /dev/null
+++ b/tests/core/cgo/use_c_symbol_through_go.c
@@ -0,0 +1,5 @@
+#include "tests/core/cgo/use_transitive_symbol.h"
+
+int main() {
+ PrintGreeting();
+}
diff --git a/tests/core/cgo/use_external_symbol.go b/tests/core/cgo/use_external_symbol.go
new file mode 100644
index 00000000..70980ea7
--- /dev/null
+++ b/tests/core/cgo/use_external_symbol.go
@@ -0,0 +1,10 @@
+package use_external_symbol
+
+/*
+void external_symbol();
+*/
+import "C"
+
+func UseExternalSymbol() {
+ C.external_symbol()
+}
diff --git a/tests/core/cgo/use_transitive_symbol.go b/tests/core/cgo/use_transitive_symbol.go
new file mode 100644
index 00000000..c229311e
--- /dev/null
+++ b/tests/core/cgo/use_transitive_symbol.go
@@ -0,0 +1,14 @@
+package main
+
+import "C"
+
+import (
+ "github.com/bazelbuild/rules_go/tests/core/cgo/direct_dep"
+)
+
+//export PrintGreeting
+func PrintGreeting() {
+ direct_dep.PrintGreeting()
+}
+
+func main() {}
diff --git a/tests/core/coverage/BUILD.bazel b/tests/core/coverage/BUILD.bazel
new file mode 100644
index 00000000..9a20440f
--- /dev/null
+++ b/tests/core/coverage/BUILD.bazel
@@ -0,0 +1,34 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "coverage_test",
+ srcs = ["coverage_test.go"],
+)
+
+go_bazel_test(
+ name = "binary_coverage_test",
+ srcs = ["binary_coverage_test.go"],
+)
+
+go_bazel_test(
+ name = "lcov_coverage_test",
+ srcs = ["lcov_coverage_test.go"],
+ target_compatible_with = select({
+ "@platforms//os:windows": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ }),
+)
+
+go_bazel_test(
+ name = "lcov_test_main_coverage_test",
+ srcs = ["lcov_test_main_coverage_test.go"],
+ target_compatible_with = select({
+ "@platforms//os:windows": ["@platforms//:incompatible"],
+ "//conditions:default": [],
+ }),
+)
+
+go_bazel_test(
+ name = "issue3017_test",
+ srcs = ["issue3017_test.go"],
+)
diff --git a/tests/core/coverage/README.rst b/tests/core/coverage/README.rst
new file mode 100644
index 00000000..aadc5fa9
--- /dev/null
+++ b/tests/core/coverage/README.rst
@@ -0,0 +1,23 @@
+.. _#2127: https://github.com/bazelbuild/rules_go/issues/2127
+
+coverage functionality
+======================
+
+coverage_test
+-------------
+
+Checks that ``bazel coverage`` on a ``go_test`` produces reasonable output.
+Libraries referenced by the test that pass ``--instrumentation_filter`` should
+have coverage data. Library excluded with ``--instrumentatiuon_filter`` should
+not have coverage data.
+
+binary_coverage_test
+--------------------
+
+Checks that ``bazel build --collect_code_coverage`` can instrument a
+``go_binary``. ``bazel coverage`` should also work, though it should fail
+with status 4 since the binary is not a test.
+
+This functionality isn't really complete. The generate test main package
+gathers and writes coverage data, and that's not present. This is just
+a regression test for a link error (`#2127`_).
diff --git a/tests/core/coverage/binary_coverage_test.go b/tests/core/coverage/binary_coverage_test.go
new file mode 100644
index 00000000..724528be
--- /dev/null
+++ b/tests/core/coverage/binary_coverage_test.go
@@ -0,0 +1,75 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package binary_coverage_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+go_binary(
+ name = "hello",
+ srcs = ["hello.go"],
+ out = "hello",
+)
+-- hello.go --
+package main
+
+import "fmt"
+
+func main() {
+ fmt.Println(A())
+}
+
+func A() int { return 12 }
+
+func B() int { return 34 }
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ // Check that we can build a binary with coverage instrumentation enabled.
+ args := []string{
+ "build",
+ "--collect_code_coverage",
+ "--instrumentation_filter=.*",
+ "//:hello",
+ }
+ if err := bazel_testing.RunBazel(args...); err != nil {
+ t.Fatal(err)
+ }
+
+ // Check that we can build with `bazel coverage`. It will fail because
+ // there are no tests.
+ args = []string{
+ "coverage",
+ "//:hello",
+ }
+ if err := bazel_testing.RunBazel(args...); err == nil {
+ t.Fatal("got success; want failure")
+ } else if bErr, ok := err.(*bazel_testing.StderrExitError); !ok {
+ t.Fatalf("got %v; want StderrExitError", err)
+ } else if code := bErr.Err.ExitCode(); code != 4 {
+ t.Fatalf("got code %d; want code 4 (no tests found)", code)
+ }
+}
diff --git a/tests/core/coverage/coverage_test.go b/tests/core/coverage/coverage_test.go
new file mode 100644
index 00000000..52bda780
--- /dev/null
+++ b/tests/core/coverage/coverage_test.go
@@ -0,0 +1,265 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package coverage_test
+
+import (
+ "bytes"
+ "fmt"
+ "io/ioutil"
+ "path/filepath"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_test(
+ name = "a_test",
+ srcs = ["a_test.go"],
+ embed = [":a"],
+)
+
+go_test(
+ name = "a_test_cross",
+ srcs = ["a_test.go"],
+ embed = [":a"],
+ goarch = "386",
+ goos = "linux",
+ pure = "on",
+ tags = ["manual"],
+)
+
+go_library(
+ name = "a",
+ srcs = ["a.go"],
+ importpath = "example.com/coverage/a",
+ deps = [":b"],
+)
+
+go_library(
+ name = "b",
+ srcs = ["b.go"],
+ importpath = "example.com/coverage/b",
+ deps = [":c"],
+)
+
+go_library(
+ name = "c",
+ srcs = ["c.go"],
+ importpath = "example.com/coverage/c",
+)
+
+go_library(
+ name = "d",
+ srcs = ["d.go"],
+ importpath = "example.com/coverage/d",
+)
+
+go_test(
+ name = "d_test",
+ embed = [":d"],
+)
+
+go_library(
+ name = "panicking",
+ srcs = ["panicking.go"],
+ importpath = "example.com/coverage/panicking",
+)
+
+go_test(
+ name = "panicking_test",
+ srcs = ["panicking_test.go"],
+ embed = [":panicking"],
+)
+-- a_test.go --
+package a
+
+import "testing"
+
+func TestA(t *testing.T) {
+ ALive()
+}
+-- a.go --
+package a
+
+import "example.com/coverage/b"
+
+func ALive() int {
+ return b.BLive()
+}
+
+func ADead() int {
+ return b.BDead()
+}
+
+-- b.go --
+package b
+
+import "example.com/coverage/c"
+
+func BLive() int {
+ return c.CLive()
+}
+
+func BDead() int {
+ return c.CDead()
+}
+
+-- c.go --
+package c
+
+func CLive() int {
+ return 12
+}
+
+func CDead() int {
+ return 34
+}
+
+-- d.go --
+package lzma
+
+/* Naming conventions follows the CodeReviewComments in the Go Wiki. */
+
+// ntz32Const is used by the functions NTZ and NLZ.
+const ntz32Const = 0x04d7651f
+-- panicking.go --
+package panicking
+
+func Panic() {
+ panic("from line 4")
+}
+-- panicking_test.go --
+package panicking
+
+import (
+ "regexp"
+ "runtime/debug"
+ "testing"
+)
+
+func TestPanic(t *testing.T) {
+ defer func() {
+ if err := recover(); err != nil {
+ got := regexp.MustCompile("panicking.go:[0-9]+").
+ FindString(string(debug.Stack()))
+ if want := "panicking.go:4"; want != got {
+ t.Errorf("want %q; got %q", want, got)
+ }
+ }
+ }()
+ Panic()
+}
+`,
+ })
+}
+
+func TestCoverage(t *testing.T) {
+ t.Run("without-race", func(t *testing.T) {
+ testCoverage(t, "set")
+ })
+
+ t.Run("with-race", func(t *testing.T) {
+ testCoverage(t, "atomic", "--@io_bazel_rules_go//go/config:race")
+ })
+}
+
+func testCoverage(t *testing.T, expectedCoverMode string, extraArgs ...string) {
+ args := append([]string{"coverage"}, append(
+ extraArgs,
+ "--instrumentation_filter=-//:b",
+ "--@io_bazel_rules_go//go/config:cover_format=go_cover",
+ ":a_test",
+ )...)
+
+ if err := bazel_testing.RunBazel(args...); err != nil {
+ t.Fatal(err)
+ }
+
+ coveragePath := filepath.FromSlash("bazel-testlogs/a_test/coverage.dat")
+ coverageData, err := ioutil.ReadFile(coveragePath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, include := range []string{
+ fmt.Sprintf("mode: %s", expectedCoverMode),
+ "example.com/coverage/a/a.go:",
+ "example.com/coverage/c/c.go:",
+ } {
+ if !bytes.Contains(coverageData, []byte(include)) {
+ t.Errorf("%s: does not contain %q\n", coveragePath, include)
+ }
+ }
+ for _, exclude := range []string{
+ "example.com/coverage/b/b.go:",
+ } {
+ if bytes.Contains(coverageData, []byte(exclude)) {
+ t.Errorf("%s: contains %q\n", coveragePath, exclude)
+ }
+ }
+}
+
+func TestCrossBuild(t *testing.T) {
+ t.Run("lcov", func(t *testing.T) {
+ testCrossBuild(t)
+ })
+ t.Run("cover", func(t *testing.T) {
+ testCrossBuild(t, "--@io_bazel_rules_go//go/config:cover_format=go_cover")
+ })
+}
+
+func testCrossBuild(t *testing.T, extraArgs ...string) {
+ if err := bazel_testing.RunBazel(append(
+ []string{"build", "--collect_code_coverage", "--instrumentation_filter=-//:b", "//:a_test_cross"},
+ extraArgs...,
+ )...); err != nil {
+ t.Fatal(err)
+ }
+}
+
+func TestCoverageWithComments(t *testing.T) {
+ t.Run("lcov", func(t *testing.T) {
+ testCoverageWithComments(t)
+ })
+ t.Run("go_cover", func(t *testing.T) {
+ testCoverageWithComments(t, "--@io_bazel_rules_go//go/config:cover_format=go_cover")
+ })
+}
+
+func testCoverageWithComments(t *testing.T, extraArgs ...string) {
+ if err := bazel_testing.RunBazel(append([]string{"coverage", ":d_test"}, extraArgs...)...); err != nil {
+ t.Fatal(err)
+ }
+}
+
+func TestCoverageWithCorrectLineNumbers(t *testing.T) {
+ t.Run("lcov", func(t *testing.T) {
+ testCoverageWithCorrectLineNumbers(t)
+ })
+ t.Run("go_cover", func(t *testing.T) {
+ testCoverageWithCorrectLineNumbers(t, "--@io_bazel_rules_go//go/config:cover_format=go_cover")
+ })
+}
+
+func testCoverageWithCorrectLineNumbers(t *testing.T, extraArgs ...string) {
+ if err := bazel_testing.RunBazel(append([]string{"coverage", ":panicking_test"}, extraArgs...)...); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/coverage/issue3017_test.go b/tests/core/coverage/issue3017_test.go
new file mode 100644
index 00000000..e2786e1f
--- /dev/null
+++ b/tests/core/coverage/issue3017_test.go
@@ -0,0 +1,80 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package coverage_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- fx.go --
+package fx
+
+import (
+ _ "uber.com/internal"
+)
+-- fx_test.go --
+package fx
+-- internal/BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "go_default_library",
+ srcs = ["lib.go"],
+ importpath = "uber.com/internal",
+ visibility = ["//visibility:public"],
+ deps = ["@io_bazel_rules_go//go/tools/coverdata"],
+)
+
+go_test(
+ name = "go_default_test",
+ srcs = ["lib_test.go"],
+ embed = [":go_default_library"],
+)
+-- internal/lib.go --
+package internal
+
+import _ "github.com/bazelbuild/rules_go/go/tools/coverdata"
+-- internal/lib_test.go --
+package internal
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "go_default_library",
+ srcs = ["fx.go"],
+ importpath = "code.uber.internal/devexp/code-coverage/cmd/fx",
+ visibility = ["//visibility:private"],
+ deps = ["//internal:go_default_library"],
+)
+
+go_test(
+ name = "go_default_test",
+ srcs = ["fx_test.go"],
+ embed = [":go_default_library"],
+)
+`,
+ })
+}
+
+func TestIssue3017(t *testing.T) {
+ if err := bazel_testing.RunBazel("coverage", "//:go_default_test"); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/coverage/lcov_coverage_test.go b/tests/core/coverage/lcov_coverage_test.go
new file mode 100644
index 00000000..a46567cc
--- /dev/null
+++ b/tests/core/coverage/lcov_coverage_test.go
@@ -0,0 +1,290 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package lcov_coverage_test
+
+import (
+ "io/ioutil"
+ "path/filepath"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- src/BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "lib",
+ srcs = ["lib.go"],
+ importpath = "example.com/lib",
+ deps = [":other_lib"],
+)
+
+go_library(
+ name = "other_lib",
+ srcs = ["other_lib.go"],
+ importpath = "example.com/other_lib",
+)
+
+go_test(
+ name = "lib_test",
+ srcs = ["lib_test.go"],
+ deps = [":lib"],
+)
+
+java_binary(
+ name = "Tool",
+ srcs = ["Tool.java"],
+)
+
+go_test(
+ name = "lib_with_tool_test",
+ srcs = ["lib_with_tool_test.go"],
+ data = [":Tool"],
+ deps = [":lib"],
+)
+-- src/lib.go --
+package lib
+
+import (
+ "strings"
+
+ "example.com/other_lib"
+)
+
+func HelloFromLib(informal bool) string {
+ var greetings []string
+ if informal {
+ greetings = []string{"Hey there, other_lib!"}
+ } else {
+ greetings = []string{"Good morning, other_lib!"}
+ }
+ greetings = append(greetings, other_lib.HelloOtherLib(informal))
+ return strings.Join(greetings, "\n")
+}
+-- src/other_lib.go --
+package other_lib
+
+func HelloOtherLib(informal bool) string {
+ if informal {
+ return "Hey there, other_lib!"
+ }
+ return "Good morning, other_lib!"
+}
+-- src/lib_test.go --
+package lib_test
+
+import (
+ "strings"
+ "testing"
+
+ "example.com/lib"
+)
+
+func TestLib(t *testing.T) {
+ if !strings.Contains(lib.HelloFromLib(false), "\n") {
+ t.Error("Expected a newline in the output")
+ }
+}
+-- src/Tool.java --
+public class Tool {
+ public static void main(String[] args) {
+ if (args.length != 0) {
+ System.err.println("Expected no arguments");
+ System.exit(1);
+ }
+ System.err.println("Hello, world!");
+ }
+}
+-- src/lib_with_tool_test.go --
+package lib_test
+
+import (
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "testing"
+
+ "example.com/lib"
+)
+
+func TestLib(t *testing.T) {
+ if !strings.Contains(lib.HelloFromLib(false), "\n") {
+ t.Error("Expected a newline in the output")
+ }
+}
+
+func TestTool(t *testing.T) {
+ err := exec.Command("." + string(filepath.Separator) + "Tool").Run()
+ if err != nil {
+ t.Error(err)
+ }
+}
+
+`,
+ })
+}
+
+func TestLcovCoverage(t *testing.T) {
+ t.Run("without-race", func(t *testing.T) {
+ testLcovCoverage(t)
+ })
+
+ t.Run("with-race", func(t *testing.T) {
+ testLcovCoverage(t, "--@io_bazel_rules_go//go/config:race")
+ })
+}
+
+func testLcovCoverage(t *testing.T, extraArgs ...string) {
+ args := append([]string{
+ "coverage",
+ "--combined_report=lcov",
+ "//src:lib_test",
+ }, extraArgs...)
+
+ if err := bazel_testing.RunBazel(args...); err != nil {
+ t.Fatal(err)
+ }
+
+ individualCoveragePath := filepath.FromSlash("bazel-testlogs/src/lib_test/coverage.dat")
+ individualCoverageData, err := ioutil.ReadFile(individualCoveragePath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, expectedIndividualCoverage := range expectedGoCoverage {
+ if !strings.Contains(string(individualCoverageData), expectedIndividualCoverage) {
+ t.Errorf(
+ "%s: does not contain:\n\n%s\nactual content:\n\n%s",
+ individualCoveragePath,
+ expectedIndividualCoverage,
+ string(individualCoverageData),
+ )
+ }
+ }
+
+ combinedCoveragePath := filepath.FromSlash("bazel-out/_coverage/_coverage_report.dat")
+ combinedCoverageData, err := ioutil.ReadFile(combinedCoveragePath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, include := range []string{
+ "SF:src/lib.go\n",
+ "SF:src/other_lib.go\n",
+ } {
+ if !strings.Contains(string(combinedCoverageData), include) {
+ t.Errorf("%s: does not contain %q\n", combinedCoverageData, include)
+ }
+ }
+}
+
+func TestLcovCoverageWithTool(t *testing.T) {
+ args := append([]string{
+ "coverage",
+ "--combined_report=lcov",
+ "//src:lib_with_tool_test",
+ })
+
+ if err := bazel_testing.RunBazel(args...); err != nil {
+ t.Fatal(err)
+ }
+
+ individualCoveragePath := filepath.FromSlash("bazel-testlogs/src/lib_with_tool_test/coverage.dat")
+ individualCoverageData, err := ioutil.ReadFile(individualCoveragePath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ expectedCoverage := append(expectedGoCoverage, expectedToolCoverage)
+ for _, expected := range expectedCoverage {
+ if !strings.Contains(string(individualCoverageData), expected) {
+ t.Errorf(
+ "%s: does not contain:\n\n%s\nactual content:\n\n%s",
+ individualCoveragePath,
+ expected,
+ string(individualCoverageData),
+ )
+ }
+ }
+
+ combinedCoveragePath := filepath.FromSlash("bazel-out/_coverage/_coverage_report.dat")
+ combinedCoverageData, err := ioutil.ReadFile(combinedCoveragePath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, include := range []string{
+ "SF:src/lib.go\n",
+ "SF:src/other_lib.go\n",
+ "SF:src/Tool.java\n",
+ } {
+ if !strings.Contains(string(combinedCoverageData), include) {
+ t.Errorf("%s: does not contain %q\n", combinedCoverageData, include)
+ }
+ }
+}
+
+var expectedGoCoverage = []string{
+ `SF:src/other_lib.go
+FNF:0
+FNH:0
+DA:3,1
+DA:4,1
+DA:5,0
+DA:6,0
+DA:7,1
+LH:3
+LF:5
+end_of_record
+`,
+ `SF:src/lib.go
+FNF:0
+FNH:0
+DA:9,1
+DA:10,1
+DA:11,1
+DA:12,0
+DA:13,1
+DA:14,1
+DA:15,1
+DA:16,1
+DA:17,1
+LH:8
+LF:9
+end_of_record
+`}
+
+const expectedToolCoverage = `SF:src/Tool.java
+FN:1,Tool::<init> ()V
+FN:3,Tool::main ([Ljava/lang/String;)V
+FNDA:0,Tool::<init> ()V
+FNDA:1,Tool::main ([Ljava/lang/String;)V
+FNF:2
+FNH:1
+BRDA:3,0,0,1
+BRDA:3,0,1,0
+BRF:2
+BRH:1
+DA:1,0
+DA:3,1
+DA:4,0
+DA:5,0
+DA:7,1
+DA:8,1
+LH:3
+LF:6
+end_of_record
+`
diff --git a/tests/core/coverage/lcov_test_main_coverage_test.go b/tests/core/coverage/lcov_test_main_coverage_test.go
new file mode 100644
index 00000000..57aafd28
--- /dev/null
+++ b/tests/core/coverage/lcov_test_main_coverage_test.go
@@ -0,0 +1,122 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package lcov_test_main_coverage_test
+
+import (
+ "io/ioutil"
+ "path/filepath"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- src/BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "lib",
+ srcs = ["lib.go"],
+ importpath = "example.com/lib",
+)
+
+go_test(
+ name = "lib_test",
+ srcs = ["lib_test.go"],
+ deps = [":lib"],
+)
+-- src/lib.go --
+package lib
+
+func HelloFromLib(informal bool) string {
+ if informal {
+ return "Hey there, lib!"
+ } else {
+ return "Good morning, lib!"
+ }
+}
+-- src/lib_test.go --
+package lib_test
+
+import (
+ "strings"
+ "testing"
+ "os"
+
+ "example.com/lib"
+)
+
+func TestMain(m *testing.M) {
+ os.Exit(m.Run())
+}
+
+func TestLib(t *testing.T) {
+ if !strings.Contains(lib.HelloFromLib(false), "lib!") {
+ t.Error("Expected 'lib!' in the output")
+ }
+}
+`,
+ })
+}
+
+func TestLcovCoverageWithTestMain(t *testing.T) {
+ if err := bazel_testing.RunBazel("coverage", "--combined_report=lcov", "//src:lib_test"); err != nil {
+ t.Fatal(err)
+ }
+
+ individualCoveragePath := filepath.FromSlash("bazel-testlogs/src/lib_test/coverage.dat")
+ individualCoverageData, err := ioutil.ReadFile(individualCoveragePath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if string(individualCoverageData) != string(expectedIndividualCoverage) {
+ t.Errorf(
+ "%s: expected content:\n\n%s\nactual content:\n\n%s",
+ individualCoveragePath,
+ expectedIndividualCoverage,
+ string(individualCoverageData),
+ )
+ }
+
+ combinedCoveragePath := filepath.FromSlash("bazel-out/_coverage/_coverage_report.dat")
+ combinedCoverageData, err := ioutil.ReadFile(combinedCoveragePath)
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, include := range []string{
+ "SF:src/lib.go\n",
+ } {
+ if !strings.Contains(string(combinedCoverageData), include) {
+ t.Errorf("%s: does not contain %q\n", combinedCoverageData, include)
+ }
+ }
+}
+
+const expectedIndividualCoverage = `SF:src/lib.go
+FNF:0
+FNH:0
+DA:3,1
+DA:4,1
+DA:5,0
+DA:6,1
+DA:7,1
+DA:8,1
+LH:5
+LF:6
+end_of_record
+`
diff --git a/tests/core/cross/BUILD.bazel b/tests/core/cross/BUILD.bazel
new file mode 100644
index 00000000..ec179984
--- /dev/null
+++ b/tests/core/cross/BUILD.bazel
@@ -0,0 +1,143 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_cross_binary", "go_library", "go_test")
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+load(":def.bzl", "no_context_info")
+
+test_suite(
+ name = "cross",
+)
+
+go_binary(
+ name = "windows_cross",
+ srcs = ["main.go"],
+ goarch = "amd64",
+ goos = "windows",
+ pure = "on",
+ deps = [":platform_lib"],
+)
+
+go_binary(
+ name = "linux_cross",
+ srcs = ["main.go"],
+ goarch = "amd64",
+ goos = "linux",
+ pure = "on",
+ deps = [":platform_lib"],
+)
+
+go_binary(
+ name = "darwin_cross",
+ srcs = ["main.go"],
+ goarch = "amd64",
+ goos = "darwin",
+ pure = "on",
+ deps = [":platform_lib"],
+)
+
+go_binary(
+ name = "asm_cross",
+ srcs = ["asm.s", "main.go"],
+ goarch = "386",
+ goos = "linux",
+ deps = [":platform_lib"],
+)
+
+go_binary(
+ name = "native_bin",
+ srcs = ["main.go"],
+ pure = "on",
+ deps = [":platform_lib"],
+)
+
+go_cross_binary(
+ name = "windows_go_cross",
+ platform = "@io_bazel_rules_go//go/toolchain:windows_amd64",
+ target = ":native_bin",
+)
+
+go_cross_binary(
+ name = "linux_go_cross",
+ platform = "@io_bazel_rules_go//go/toolchain:linux_amd64",
+ target = ":native_bin",
+)
+
+go_cross_binary(
+ name = "darwin_go_cross",
+ platform = "@io_bazel_rules_go//go/toolchain:darwin_amd64",
+ target = ":native_bin",
+)
+
+go_library(
+ name = "platform_lib",
+ srcs = select({
+ "//go/platform:darwin": ["lib_darwin.go"],
+ "//go/platform:linux": ["lib_linux.go"],
+ "//go/platform:windows": ["lib_windows.go"],
+ }),
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cross/platform_lib",
+)
+
+go_test(
+ name = "cross_test",
+ size = "small",
+ srcs = ["cross_test.go"],
+ args = [
+ "-darwin",
+ "$(location :darwin_cross)",
+ "-linux",
+ "$(location :linux_cross)",
+ "-windows",
+ "$(location :windows_cross)",
+ ],
+ data = [
+ ":darwin_cross",
+ ":linux_cross",
+ ":windows_cross",
+ ],
+ rundir = ".",
+ deps = ["//go/tools/bazel:go_default_library"],
+)
+
+go_test(
+ name = "go_cross_binary_test",
+ size = "small",
+ srcs = ["cross_test.go"],
+ args = [
+ "-darwin",
+ "$(location :darwin_go_cross)",
+ "-linux",
+ "$(location :linux_go_cross)",
+ "-windows",
+ "$(location :windows_go_cross)",
+ ],
+ data = [
+ ":darwin_go_cross",
+ ":linux_go_cross",
+ ":windows_go_cross",
+ ],
+ rundir = ".",
+ deps = ["//go/tools/bazel:go_default_library"],
+)
+
+go_bazel_test(
+ name = "ios_select_test",
+ srcs = ["ios_select_test.go"],
+)
+
+go_bazel_test(
+ name = "proto_test",
+ srcs = ["proto_test.go"],
+)
+
+go_bazel_test(
+ name = "sdk_version_test",
+ srcs = ["sdk_version_test.go"],
+)
+
+go_bazel_test(
+ name = "non_executable_test",
+ srcs = ["non_executable_test.go"],
+)
+
+no_context_info(
+ name = "no_context_info",
+)
diff --git a/tests/core/cross/README.rst b/tests/core/cross/README.rst
new file mode 100644
index 00000000..283eb264
--- /dev/null
+++ b/tests/core/cross/README.rst
@@ -0,0 +1,62 @@
+Cross compilation
+=================
+
+.. _go_binary: /docs/go/core/rules.md#go_binary
+.. _go_library: /docs/go/core/rules.md#go_library
+.. _go_cross_binary: /docs/go/core/rules.md#go_cross_binary
+.. _#2523: https://github.com/bazelbuild/rules_go/issues/2523
+
+Tests to ensure that cross compilation is working as expected.
+
+.. contents::
+
+cross_test
+----------
+
+
+Tests that cross compilation controlled by the ``goos`` and ``goarch``
+attributes on a `go_binary`_ produces executables for the correct platform.
+
+This builds binaries using `main.go <main.go>`_ in multiple configurations, and
+then passes them as data to a test `written in go <cross_test.go>`_.
+
+The test executes the unix command "file" on the binaries to determine their
+type, and checks they were built for the expected architecture.
+
+The test also checks that `go_library`_ packages imoprted by `go_binary`_ with
+``goos`` set are built in the correct configuration, and ``select`` is applied
+in that configuration. Each binary depends on ``platform_lib``, which has a
+different source file (determined by ``select``) for each platform. The source
+files have a ``goos`` suffix, so they will only be built on the right platform.
+If the wrong source file is used or if all files are filtered out, the
+`go_binary`_ will not build.
+
+go_cross_test
+-------------
+
+Indentical test to ``cross_test`` except tests using a `go_cross_binary`_ rule wrapping a `go_binary`_ instead of the ``goos`` and ``goarch`` attributes on a `go_binary`_.
+
+sdk_version_test
+----------------
+Tests that a `go_binary`_ wrapped in a `go_cross_binary`_ rule, with the ``sdk_version`` attribute set, produces an executable built with the correct Go SDK version.
+
+ios_select_test
+---------------
+
+Tests that we can cross-compile a library for iOS. We should be able to select
+a dependency using ``@io_bazel_rules_go//go/platform:darwin``, which is true
+when building for iOS (tested by ``ios_select_test``) and macOS
+(tested by ``use_ios_lib``).
+
+proto_test
+----------
+
+Tests that a ``go_proto_library`` can be cross-compiled, both with
+``--platforms`` and with mode attributes.
+
+no_context_info
+---------------
+
+Tests that a rule that uses ``@io_bazel_rules_go//go:toolchain`` but does not
+depend on any other target can call ``go_context`` without error. Verifies
+`#2523`_.
diff --git a/tests/core/cross/asm.s b/tests/core/cross/asm.s
new file mode 100644
index 00000000..7a5d5219
--- /dev/null
+++ b/tests/core/cross/asm.s
@@ -0,0 +1,15 @@
+// Example assembly copied from https://github.com/rpccloud/goid
+
+#include "go_asm.h"
+#include "textflag.h"
+
+#ifdef GOARCH_386
+#define get_tls(r) MOVL TLS, r
+#define g(r) 0(r)(TLS*1)
+#endif
+
+TEXT ·getg(SB), NOSPLIT, $0-4
+ get_tls(CX)
+ MOVL g(CX), AX
+ MOVL AX, ret+0(FP)
+ RET
diff --git a/tests/core/cross/cross_test.go b/tests/core/cross/cross_test.go
new file mode 100644
index 00000000..c8ff3b72
--- /dev/null
+++ b/tests/core/cross/cross_test.go
@@ -0,0 +1,91 @@
+/* Copyright 2017 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package cross_test
+
+import (
+ "flag"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+)
+
+type check struct {
+ file *string
+ info []string
+}
+
+var darwin = flag.String("darwin", "", "The darwin binary")
+var linux = flag.String("linux", "", "The linux binary")
+var windows = flag.String("windows", "", "The windows binary")
+
+var checks = []check{
+ {darwin, []string{
+ "Mach-O",
+ "64-bit",
+ "executable",
+ "x86_64",
+ }},
+ {linux, []string{
+ "ELF",
+ "64-bit",
+ "executable",
+ "x86-64",
+ }},
+ {windows, []string{
+ "PE32+",
+ "Windows",
+ "executable",
+ "console",
+ "x86-64",
+ }},
+}
+
+func TestCross(t *testing.T) {
+ for _, c := range checks {
+ path, err := bazel.Runfile(*c.file)
+ if err != nil {
+ t.Fatalf("Could not find runfile %s: %q", *c.file, err)
+ }
+
+ if _, err := os.Stat(path); os.IsNotExist(err) {
+ t.Fatalf("Missing binary %v", path)
+ }
+ file, err := filepath.EvalSymlinks(path)
+ if err != nil {
+ t.Fatalf("Invalid filename %v", path)
+ }
+ cmd := exec.Command("file", file)
+ cmd.Stderr = os.Stderr
+ res, err := cmd.Output()
+ if err != nil {
+ t.Fatalf("failed running 'file': %v", err)
+ }
+ output := string(res)
+ if index := strings.Index(output, ":"); index >= 0 {
+ output = output[index+1:]
+ }
+ output = strings.TrimSpace(output)
+ for _, info := range c.info {
+ if !strings.Contains(output, info) {
+ t.Errorf("incorrect type for %v\nExpected %v\nGot %v", file, info, output)
+ }
+ }
+ }
+}
diff --git a/tests/core/cross/def.bzl b/tests/core/cross/def.bzl
new file mode 100644
index 00000000..99ef7c40
--- /dev/null
+++ b/tests/core/cross/def.bzl
@@ -0,0 +1,24 @@
+# Copyright 2020 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("//go:def.bzl", "go_context")
+
+def _no_context_info_impl(ctx):
+ go_context(ctx)
+ # do nothing and pass if that succeeds
+
+no_context_info = rule(
+ implementation = _no_context_info_impl,
+ toolchains = ["@io_bazel_rules_go//go:toolchain"],
+)
diff --git a/tests/core/cross/ios_select_test.go b/tests/core/cross/ios_select_test.go
new file mode 100644
index 00000000..00bf0032
--- /dev/null
+++ b/tests/core/cross/ios_select_test.go
@@ -0,0 +1,66 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package ios_select_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "use_ios_lib",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cross/use_ios_lib",
+ deps = select({
+ ":is_osx": [":ios_lib"],
+ "//conditions:default": [],
+ }),
+)
+
+config_setting(
+ name = "is_osx",
+ constraint_values = ["@platforms//os:osx"],
+)
+
+go_library(
+ name = "ios_lib",
+ srcs = select({
+ "@io_bazel_rules_go//go/platform:darwin": ["ios_good.go"],
+ "@io_bazel_rules_go//go/platform:ios": ["ios_good.go"],
+ "//conditions:default": ["ios_bad.go"],
+ }),
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cross/ios_lib",
+)
+
+-- ios_good.go --
+package ios_lib
+
+-- ios_bad.go --
+donotbuild
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ if err := bazel_testing.RunBazel("build", "--platforms=@io_bazel_rules_go//go/toolchain:ios_amd64", ":ios_lib"); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/cross/lib_darwin.go b/tests/core/cross/lib_darwin.go
new file mode 100644
index 00000000..dfdc059f
--- /dev/null
+++ b/tests/core/cross/lib_darwin.go
@@ -0,0 +1,3 @@
+package platform_lib
+
+const Platform = "darwin"
diff --git a/tests/core/cross/lib_linux.go b/tests/core/cross/lib_linux.go
new file mode 100644
index 00000000..0759c9b5
--- /dev/null
+++ b/tests/core/cross/lib_linux.go
@@ -0,0 +1,3 @@
+package platform_lib
+
+const Platform = "linux"
diff --git a/tests/core/cross/lib_windows.go b/tests/core/cross/lib_windows.go
new file mode 100644
index 00000000..6ed0f7ab
--- /dev/null
+++ b/tests/core/cross/lib_windows.go
@@ -0,0 +1,3 @@
+package platform_lib
+
+const Platform = "windows"
diff --git a/tests/core/cross/main.go b/tests/core/cross/main.go
new file mode 100644
index 00000000..0d0c6794
--- /dev/null
+++ b/tests/core/cross/main.go
@@ -0,0 +1,26 @@
+/* Copyright 2016 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package main
+
+import (
+ "fmt"
+
+ "github.com/bazelbuild/rules_go/tests/core/cross/platform_lib"
+)
+
+func main() {
+ fmt.Println(platform_lib.Platform)
+}
diff --git a/tests/core/cross/non_executable_test.go b/tests/core/cross/non_executable_test.go
new file mode 100644
index 00000000..ed9521c3
--- /dev/null
+++ b/tests/core/cross/non_executable_test.go
@@ -0,0 +1,106 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package non_executable_test
+
+import (
+ "regexp"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+var errorRegexp = regexp.MustCompile(`cannot run go_cross target "host_archive": underlying target "@{0,2}//src:archive" is not executable`);
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- src/BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_cross_binary")
+load(":rules.bzl", "no_runfiles_check")
+
+go_binary(
+ name = "archive",
+ srcs = ["archive.go"],
+ cgo = True,
+ linkmode = "c-archive",
+)
+
+# We make a new platform here so that we can exercise the go_cross_binary rule.
+# However, the test needs to run on all hosts, so the platform needs
+# to inherit from the host platform.
+platform(
+ name = "host_cgo",
+ parents = ["@local_config_platform//:host"],
+ constraint_values = [
+ "@io_bazel_rules_go//go/toolchain:cgo_on",
+ ],
+)
+
+go_cross_binary(
+ name = "host_archive",
+ target = ":archive",
+ platform = ":host_cgo",
+)
+
+cc_binary(
+ name = "main",
+ srcs = ["main.c"],
+ deps = [":host_archive"],
+)
+
+no_runfiles_check(
+ name = "no_runfiles",
+ target = ":main",
+)
+-- src/archive.go --
+package main
+
+import "C"
+
+func main() {}
+-- src/main.c --
+int main() {}
+-- src/rules.bzl --
+def _no_runfiles_check_impl(ctx):
+ runfiles = ctx.attr.target[DefaultInfo].default_runfiles.files.to_list()
+ for runfile in runfiles:
+ if runfile.short_path not in ["src/main", "src/main.exe"]:
+ fail("Unexpected runfile: %s" % runfile.short_path)
+
+no_runfiles_check = rule(
+ implementation = _no_runfiles_check_impl,
+ attrs = {
+ "target": attr.label(),
+ }
+)
+`,
+ })
+}
+
+func TestNonExecutableGoBinaryCantBeRun(t *testing.T) {
+ if err := bazel_testing.RunBazel("build", "//src:host_archive"); err != nil {
+ t.Fatal(err)
+ }
+ err := bazel_testing.RunBazel("run", "//src:host_archive")
+ if err == nil || !errorRegexp.MatchString(err.Error()) {
+ t.Errorf("Expected bazel run to fail due to //src:host_archive not being executable")
+ }
+}
+
+func TestNonExecutableGoBinaryNotInRunfiles(t *testing.T) {
+ if err := bazel_testing.RunBazel("build", "//src:no_runfiles"); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/cross/proto_test.go b/tests/core/cross/proto_test.go
new file mode 100644
index 00000000..cd9e6c60
--- /dev/null
+++ b/tests/core/cross/proto_test.go
@@ -0,0 +1,126 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package proto_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+var testArgs = bazel_testing.Args{
+ WorkspaceSuffix: `
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+http_archive(
+ name = "com_google_protobuf",
+ sha256 = "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae",
+ strip_prefix = "protobuf-21.7",
+ # latest available in BCR, as of 2022-09-30
+ urls = [
+ "https://github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz",
+ "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz",
+ ],
+)
+
+load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
+
+protobuf_deps()
+
+http_archive(
+ name = "rules_proto",
+ sha256 = "4d421d51f9ecfe9bf96ab23b55c6f2b809cbaf0eea24952683e397decfbd0dd0",
+ strip_prefix = "rules_proto-f6b8d89b90a7956f6782a4a3609b2f0eee3ce965",
+ # master, as of 2020-01-06
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/f6b8d89b90a7956f6782a4a3609b2f0eee3ce965.tar.gz",
+ "https://github.com/bazelbuild/rules_proto/archive/f6b8d89b90a7956f6782a4a3609b2f0eee3ce965.tar.gz",
+ ],
+)
+`,
+ Main: `
+-- BUILD.bazel --
+load("@rules_proto//proto:defs.bzl", "proto_library")
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+proto_library(
+ name = "cross_proto",
+ srcs = ["cross.proto"],
+)
+
+go_proto_library(
+ name = "cross_go_proto",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/cross",
+ protos = [":cross_proto"],
+)
+
+go_binary(
+ name = "use_bin",
+ srcs = ["use.go"],
+ deps = [":cross_go_proto"],
+ goos = "linux",
+ goarch = "386",
+)
+
+go_binary(
+ name = "use_shared",
+ srcs = ["use.go"],
+ deps = [":cross_go_proto"],
+ linkmode = "c-shared",
+)
+
+-- cross.proto --
+syntax = "proto3";
+
+package cross;
+
+option go_package = "github.com/bazelbuild/rules_go/tests/core/cross";
+
+message Foo {
+ int64 x = 1;
+}
+
+-- use.go --
+package main
+
+import _ "github.com/bazelbuild/rules_go/tests/core/cross"
+
+func main() {}
+`,
+}
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, testArgs)
+}
+
+func TestCmdLine(t *testing.T) {
+ args := []string{
+ "build",
+ "--platforms=@io_bazel_rules_go//go/toolchain:linux_386",
+ ":cross_go_proto",
+ }
+ if err := bazel_testing.RunBazel(args...); err != nil {
+ t.Fatal(err)
+ }
+}
+
+func TestTargets(t *testing.T) {
+ for _, target := range []string{"//:use_bin", "//:use_shared"} {
+ if err := bazel_testing.RunBazel("build", target); err != nil {
+ t.Errorf("building target %s: %v", target, err)
+ }
+ }
+}
diff --git a/tests/core/cross/sdk_version_test.go b/tests/core/cross/sdk_version_test.go
new file mode 100644
index 00000000..9cb7ad51
--- /dev/null
+++ b/tests/core/cross/sdk_version_test.go
@@ -0,0 +1,135 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package go_download_sdk_test
+
+import (
+ "fmt"
+ "strings"
+ "testing"
+ "text/template"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+type testcase struct {
+ Name, SDKVersion, expectedVersion string
+}
+
+var testCases = []testcase{
+ {
+ Name: "major_version",
+ SDKVersion: "1",
+ expectedVersion: "go1.16",
+ },
+ {
+ Name: "minor_version",
+ SDKVersion: "1.16",
+ expectedVersion: "go1.16",
+ },
+ {
+ Name: "patch_version",
+ SDKVersion: "1.16.0",
+ expectedVersion: "go1.16",
+ },
+ {
+ Name: "1_17_minor_version",
+ SDKVersion: "1.17",
+ expectedVersion: "go1.17",
+ },
+ {
+ Name: "1_17_patch_version",
+ SDKVersion: "1.17.1",
+ expectedVersion: "go1.17.1",
+ },
+}
+
+func TestMain(m *testing.M) {
+ mainFilesTmpl := template.Must(template.New("").Parse(`
+-- WORKSPACE --
+local_repository(
+ name = "io_bazel_rules_go",
+ path = "../io_bazel_rules_go",
+)
+
+load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_rules_dependencies", "go_register_toolchains")
+
+go_rules_dependencies()
+
+go_download_sdk(
+ name = "go_sdk",
+ version = "1.16",
+)
+go_download_sdk(
+ name = "go_sdk_1_17",
+ version = "1.17",
+)
+go_download_sdk(
+ name = "go_sdk_1_17_1",
+ version = "1.17.1",
+)
+go_register_toolchains()
+-- main.go --
+package main
+
+import (
+ "fmt"
+ "runtime"
+)
+
+func main() {
+ fmt.Print(runtime.Version())
+}
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_cross_binary")
+
+go_binary(
+ name = "print_version",
+ srcs = ["main.go"],
+)
+{{range .TestCases}}
+go_cross_binary(
+ name = "{{.Name}}",
+ target = ":print_version",
+ sdk_version = "{{.SDKVersion}}",
+)
+{{end}}
+`))
+ tmplValues := struct{
+ TestCases []testcase
+ }{
+ TestCases: testCases,
+ }
+ mainFilesBuilder := &strings.Builder{}
+ if err := mainFilesTmpl.Execute(mainFilesBuilder, tmplValues); err != nil {
+ panic(err)
+ }
+
+ bazel_testing.TestMain(m, bazel_testing.Args{Main: mainFilesBuilder.String()})
+}
+
+func Test(t *testing.T) {
+ for _, test := range testCases {
+ t.Run(test.Name, func(t *testing.T) {
+ output, err := bazel_testing.BazelOutput("run", fmt.Sprintf("//:%s", test.Name))
+ if err != nil {
+ t.Fatal(err)
+ }
+ actualVersion := string(output)
+ if actualVersion != test.expectedVersion {
+ t.Fatal("actual", actualVersion, "vs expected", test.expectedVersion)
+ }
+ })
+ }
+}
diff --git a/tests/core/go_bazel_test/BUILD.bazel b/tests/core/go_bazel_test/BUILD.bazel
new file mode 100644
index 00000000..5a32ad75
--- /dev/null
+++ b/tests/core/go_bazel_test/BUILD.bazel
@@ -0,0 +1,9 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "dataargtest_test",
+ srcs = ["dataargtest_test.go"],
+ args = ["-binaryPath=$(location //tests/core/go_binary:hello)"],
+ data = ["//tests/core/go_binary:hello"],
+ deps = ["//go/tools/bazel:go_default_library"],
+)
diff --git a/tests/core/go_bazel_test/README.rst b/tests/core/go_bazel_test/README.rst
new file mode 100644
index 00000000..073f955f
--- /dev/null
+++ b/tests/core/go_bazel_test/README.rst
@@ -0,0 +1,10 @@
+go_bazel_test macro functionality
+=================================
+
+Tests to ensure the go_bazel_test is functioning correctly.
+
+dataargtest_test
+----------------
+
+Tests that `data` and `args` provided to `go_bazel_test` are provided to the go
+test framework correctly.
diff --git a/tests/core/go_bazel_test/dataargtest_test.go b/tests/core/go_bazel_test/dataargtest_test.go
new file mode 100644
index 00000000..9859fe84
--- /dev/null
+++ b/tests/core/go_bazel_test/dataargtest_test.go
@@ -0,0 +1,69 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "flag"
+ "os"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+var (
+ binaryPath = flag.String("binaryPath", "", "")
+ setUpRan = false
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- root.txt --
+Hello world!
+-- nested/file.txt --
+Hello world!`,
+ SetUp: func() error {
+ setUpRan = true
+ return nil
+ },
+ })
+}
+
+// Tests that go_bazel_test keeps includes data files correctly and doesn't mess
+// up on `args` that include `$(location ...)` calls.
+func TestGoldenPath(t *testing.T) {
+ bp, err := bazel.Runfile(*binaryPath)
+ if err != nil {
+ t.Fatalf("unable to get the runfile path %#v: %s", *binaryPath, err)
+ }
+
+ tests := map[string]string{
+ "Go binary file": bp,
+ "Text file in root": "root.txt",
+ "Text file in nested dir": "nested/file.txt",
+ }
+
+ for name, f := range tests {
+ _, err = os.Stat(f)
+ if err != nil {
+ t.Fatalf("unable to stat %s file (%q): %s", name, f, err)
+ }
+ }
+
+ if setUpRan == false {
+ t.Fatal("setUp should have been executed but was not")
+ }
+}
diff --git a/tests/core/go_binary/BUILD.bazel b/tests/core/go_binary/BUILD.bazel
new file mode 100644
index 00000000..99a2d784
--- /dev/null
+++ b/tests/core/go_binary/BUILD.bazel
@@ -0,0 +1,193 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+load(":many_deps.bzl", "many_deps")
+
+test_suite(name = "go_binary")
+
+go_bazel_test(
+ name = "configurable_attribute_bad_test",
+ srcs = ["configurable_attribute_bad_test.go"],
+)
+
+go_bazel_test(
+ name = "configurable_attribute_good_test",
+ srcs = ["configurable_attribute_good_test.go"],
+)
+
+go_binary(
+ name = "hello",
+ srcs = ["hello.go"],
+ visibility = ["//visibility:public"],
+)
+
+go_test(
+ name = "go_default_test",
+ srcs = ["out_test.go"],
+ data = [":custom_bin"],
+)
+
+go_bazel_test(
+ name = "package_conflict_test",
+ srcs = ["package_conflict_test.go"],
+)
+
+go_binary(
+ name = "custom_bin",
+ srcs = ["custom_bin.go"],
+ out = "alt_bin",
+)
+
+go_binary(
+ name = "goos_pure_bin",
+ srcs = [
+ "broken_cgo.go",
+ "hello.go",
+ ],
+ goarch = "amd64",
+ goos = "plan9",
+)
+
+many_deps(name = "many_deps")
+
+go_test(
+ name = "stamp_test",
+ srcs = ["stamp_test.go"],
+ data = [":stamp_bin"],
+ rundir = ".",
+ deps = ["@io_bazel_rules_go//go/tools/bazel:go_default_library"],
+)
+
+go_binary(
+ name = "stamp_bin",
+ srcs = ["stamp_bin.go"],
+ embed = [":stamp_embed"],
+ x_defs = {
+ "Bin": "Bin",
+ "example.com/stamp_dep.DepBin": "DepBin",
+ },
+ deps = [":stamp_dep"],
+)
+
+go_library(
+ name = "stamp_embed",
+ srcs = ["stamp_embed.go"],
+ importpath = "example.com/stamp_embed",
+ x_defs = {
+ "Embed": "Embed",
+ },
+)
+
+go_library(
+ name = "stamp_dep",
+ srcs = ["stamp_dep.go"],
+ importpath = "example.com/stamp_dep",
+ x_defs = {
+ "DepSelf": "DepSelf",
+ },
+)
+
+go_binary(
+ name = "hello_pie_bin",
+ srcs = ["hello.go"],
+ cgo = True,
+ linkmode = "pie",
+ tags = ["manual"],
+)
+
+go_binary(
+ name = "hello_nopie_bin",
+ srcs = ["hello.go"],
+ cgo = True,
+ tags = ["manual"],
+)
+
+go_test(
+ name = "pie_test",
+ srcs = [
+ "pie_darwin_amd64_test.go",
+ "pie_darwin_test.go",
+ "pie_linux_test.go",
+ ],
+ data = select({
+ "@io_bazel_rules_go//go/platform:darwin": [
+ ":hello_nopie_bin",
+ ":hello_pie_bin",
+ ],
+ "@io_bazel_rules_go//go/platform:linux": [
+ ":hello_nopie_bin",
+ ":hello_pie_bin",
+ ],
+ "//conditions:default": [],
+ }),
+ rundir = ".",
+ deps = ["@io_bazel_rules_go//go/tools/bazel:go_default_library"],
+)
+
+go_test(
+ name = "static_test",
+ srcs = ["static_test.go"],
+ data = select({
+ "@io_bazel_rules_go//go/platform:linux": [
+ ":static_bin",
+ ":static_cgo_bin",
+ ":static_pure_bin",
+ ],
+ "//conditions:default": [],
+ }),
+ rundir = ".",
+ deps = ["//go/tools/bazel:go_default_library"],
+)
+
+go_binary(
+ name = "static_bin",
+ srcs = ["static_bin.go"],
+ static = "on",
+ tags = ["manual"],
+ deps = ["@org_golang_x_sys//unix:go_default_library"],
+)
+
+go_binary(
+ name = "static_cgo_bin",
+ srcs = ["static_cgo_bin.go"],
+ cgo = True,
+ static = "on",
+ tags = ["manual"],
+)
+
+go_binary(
+ name = "static_pure_bin",
+ srcs = ["static_pure_bin.go"],
+ pure = "on",
+ static = "on",
+ tags = ["manual"],
+)
+
+go_binary(
+ name = "tags_bin",
+ srcs = [
+ "tags_main_bad.go",
+ "tags_main_good.go",
+ ],
+ gotags = ["good"],
+ deps = [":tags_lib"],
+)
+
+go_library(
+ name = "tags_lib",
+ srcs = [
+ "tags_lib_bad.go",
+ "tags_lib_good.go",
+ ],
+ importpath = "tags_lib",
+ tags = ["manual"],
+)
+
+go_binary(
+ name = "prefix",
+ embed = ["//tests/core/go_binary/prefix"],
+)
+
+go_bazel_test(
+ name = "non_executable_test",
+ srcs = ["non_executable_test.go"],
+)
diff --git a/tests/core/go_binary/README.rst b/tests/core/go_binary/README.rst
new file mode 100644
index 00000000..a01bdf60
--- /dev/null
+++ b/tests/core/go_binary/README.rst
@@ -0,0 +1,70 @@
+Basic go_binary functionality
+=============================
+
+.. _go_binary: /docs/go/core/rules.md#_go_binary
+.. _#2168: https://github.com/bazelbuild/rules_go/issues/2168
+.. _#2463: https://github.com/bazelbuild/rules_go/issues/2463
+
+Tests to ensure the basic features of go_binary are working as expected.
+
+hello
+-----
+
+Hello is a basic "hello world" program that doesn't do anything interesting.
+Useful as a primitive smoke test -- if this doesn't build, nothing will.
+
+out_test
+--------
+
+Tests that a `go_binary`_ rule can write its executable file with a custom name
+in the package directory (not the mode directory).
+
+package_conflict_test
+---------------------
+
+Tests that linking multiple packages with the same path (`importmap`) is an
+error.
+
+goos_pure_bin
+-------------
+
+Tests that specifying the `goos` attribute on a `go_binary`_ target to be
+different than the host os forces the pure mode to be on. This is achieved
+by including a broken cgo file in the sources for the build.
+
+many_deps
+---------
+
+Test that a `go_binary`_ with many imports with long names can be linked. This
+makes sure we don't exceed command-line length limits with -I and -L flags.
+Verifies #1637.
+
+stamp_test
+----------
+Test that the `go_binary`_ ``x_defs`` attribute works correctly, both in a
+binary and in an embedded library. Tests regular stamps and stamps that
+depend on values from the workspace status script. Verifies #2000.
+
+pie_test
+--------
+Tests that specifying the ``linkmode`` attribute on a `go_binary`_ target to be
+pie produces a position-independent executable and that no specifying it produces
+a position-dependent binary.
+
+static_test
+-----------
+Test that `go_binary`_ rules with ``static = "on"`` with and without cgo
+produce static binaries. Verifies `#2168`_.
+
+This test only runs on Linux. The darwin external linker cannot produce
+static binaries since there is no static version of C runtime libraries.
+
+tags_bin
+--------
+Checks that setting ``gotags`` affects source filtering. This binary won't build
+without a specific tag being set.
+
+prefix
+------
+This binary has a name that conflicts with a subdirectory. Its output file
+name should not have this conflict. Verifies `#2463`_.
diff --git a/tests/core/go_binary/broken_cgo.go b/tests/core/go_binary/broken_cgo.go
new file mode 100644
index 00000000..0f0b6051
--- /dev/null
+++ b/tests/core/go_binary/broken_cgo.go
@@ -0,0 +1,7 @@
+// +build cgo
+
+// This file will not compile and its inclusion in a build is used to ensure
+// that a binary was built in pure mode.
+package main
+
+import "non/existent/pkg"
diff --git a/tests/core/go_binary/configurable_attribute_bad_test.go b/tests/core/go_binary/configurable_attribute_bad_test.go
new file mode 100644
index 00000000..abd35ba2
--- /dev/null
+++ b/tests/core/go_binary/configurable_attribute_bad_test.go
@@ -0,0 +1,69 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package configurable_attribute_bad_test
+
+import (
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+go_binary(
+ name = "main",
+ srcs = [
+ "main.go",
+ ],
+ goos = "darwin",
+ goarch = "amd64",
+ gotags = select({
+ "@io_bazel_rules_go//go/platform:linux": ["penguins"],
+ "//conditions:default": ["nopenguins"],
+ }),
+)
+
+-- main.go --
+package main
+
+import "fmt"
+
+func main() {
+ fmt.Println("Howdy")
+}
+`,
+ })
+}
+
+func TestConfigurableGotagsAttribute(t *testing.T) {
+ _, err := bazel_testing.BazelOutput("build", "//:main")
+ if err == nil {
+ t.Fatal("Want error")
+ }
+ eErr, ok := err.(*bazel_testing.StderrExitError)
+ if !ok {
+ t.Fatalf("Want StderrExitError but got %v", err)
+ }
+ stderr := eErr.Error()
+ want := "Cannot use select for go_binary with goos/goarch set, but gotags was a select"
+ if !strings.Contains(stderr, want) {
+ t.Fatalf("Want error message containing %q but got %v", want, stderr)
+ }
+}
diff --git a/tests/core/go_binary/configurable_attribute_good_test.go b/tests/core/go_binary/configurable_attribute_good_test.go
new file mode 100644
index 00000000..a1fe1954
--- /dev/null
+++ b/tests/core/go_binary/configurable_attribute_good_test.go
@@ -0,0 +1,92 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package configurable_attribute_good_test
+
+import (
+ "runtime"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+go_binary(
+ name = "main",
+ srcs = [
+ "main.go",
+ "lib_nopenguins.go",
+ "lib_penguins.go",
+ ],
+ gotags = select({
+ "@io_bazel_rules_go//go/platform:linux": ["penguins"],
+ "//conditions:default": ["nopenguins"],
+ }),
+)
+
+-- main.go --
+package main
+
+import "fmt"
+
+func main() {
+ fmt.Println(message())
+}
+
+-- lib_penguins.go --
+// +build penguins
+
+package main
+
+func message() string {
+ return "Penguins are great"
+}
+
+
+-- lib_nopenguins.go --
+// +build !penguins
+
+package main
+
+func message() string {
+ return "Penguins smell fishy'"
+}
+`,
+ })
+}
+
+func TestConfigurableGotagsAttribute(t *testing.T) {
+ outBytes, err := bazel_testing.BazelOutput("run", "//:main")
+ if err != nil {
+ t.Fatalf("Unexpected error: %v", err)
+ }
+ out := string(outBytes)
+ os := runtime.GOOS
+ switch os {
+ case "linux":
+ if !strings.Contains(out, "Penguins are great") {
+ t.Fatalf("Wanted penguin executable, but output was: %s", out)
+ }
+ default:
+ if !strings.Contains(out, "Penguins smell fishy") {
+ t.Fatalf("Wanted nopenguin executable, but output was: %s", out)
+ }
+ }
+}
diff --git a/tests/core/go_binary/custom_bin.go b/tests/core/go_binary/custom_bin.go
new file mode 100644
index 00000000..da29a2ca
--- /dev/null
+++ b/tests/core/go_binary/custom_bin.go
@@ -0,0 +1,4 @@
+package main
+
+func main() {
+}
diff --git a/tests/core/go_binary/hello.go b/tests/core/go_binary/hello.go
new file mode 100644
index 00000000..f7b60bde
--- /dev/null
+++ b/tests/core/go_binary/hello.go
@@ -0,0 +1,7 @@
+package main
+
+import "fmt"
+
+func main() {
+ fmt.Println("Hello, world!")
+}
diff --git a/tests/core/go_binary/many_deps.bzl b/tests/core/go_binary/many_deps.bzl
new file mode 100644
index 00000000..621e286d
--- /dev/null
+++ b/tests/core/go_binary/many_deps.bzl
@@ -0,0 +1,92 @@
+# Copyright 2018 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "@io_bazel_rules_go//go:def.bzl",
+ "go_binary",
+ "go_context",
+)
+
+_PREFIX = "/".join(["abcdefgh"[i] * 100 for i in range(7)]) + "/"
+
+def _gen_library_impl(ctx):
+ go = go_context(ctx)
+ src = go.actions.declare_file(ctx.label.name + ".go")
+ go.actions.write(src, "package " + ctx.label.name + "\n")
+ library = go.new_library(go, srcs = [src])
+ source = go.library_to_source(go, ctx.attr, library, ctx.coverage_instrumented())
+ archive = go.archive(go, source)
+ return [
+ library,
+ source,
+ archive,
+ DefaultInfo(files = depset([archive.data.file])),
+ ]
+
+_gen_library = rule(
+ _gen_library_impl,
+ attrs = {
+ "importpath": attr.string(mandatory = True),
+ "_go_context_data": attr.label(
+ default = "//:go_context_data",
+ ),
+ },
+ toolchains = ["@io_bazel_rules_go//go:toolchain"],
+)
+
+def _gen_main_src_impl(ctx):
+ src = ctx.actions.declare_file(ctx.label.name + ".go")
+ lines = [
+ "package main",
+ "",
+ "import (",
+ ]
+ for i in range(ctx.attr.n):
+ lines.append('\t_ "{}many_deps{}"'.format(_PREFIX, i))
+ lines.extend([
+ ")",
+ "",
+ "func main() {}",
+ ])
+ ctx.actions.write(src, "\n".join(lines))
+ return [DefaultInfo(files = depset([src]))]
+
+_gen_main_src = rule(
+ _gen_main_src_impl,
+ attrs = {
+ "n": attr.int(mandatory = True),
+ },
+)
+
+def many_deps(name, **kwargs):
+ deps = []
+ n = 200
+ for i in range(n):
+ lib_name = "many_deps" + str(i)
+ _gen_library(
+ name = lib_name,
+ importpath = _PREFIX + lib_name,
+ visibility = ["//visibility:private"],
+ )
+ deps.append(lib_name)
+ _gen_main_src(
+ name = "many_deps_src",
+ n = n,
+ )
+ go_binary(
+ name = name,
+ srcs = [":many_deps_src"],
+ deps = deps,
+ **kwargs
+ )
diff --git a/tests/core/go_binary/non_executable_test.go b/tests/core/go_binary/non_executable_test.go
new file mode 100644
index 00000000..b2eb987c
--- /dev/null
+++ b/tests/core/go_binary/non_executable_test.go
@@ -0,0 +1,87 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package non_executable_test
+
+import (
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- src/BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+load(":rules.bzl", "no_runfiles_check")
+
+go_binary(
+ name = "archive",
+ srcs = ["archive.go"],
+ cgo = True,
+ linkmode = "c-archive",
+)
+
+cc_binary(
+ name = "main",
+ srcs = ["main.c"],
+ deps = [":archive"],
+)
+
+no_runfiles_check(
+ name = "no_runfiles",
+ target = ":main",
+)
+-- src/archive.go --
+package main
+
+import "C"
+
+func main() {}
+-- src/main.c --
+int main() {}
+-- src/rules.bzl --
+def _no_runfiles_check_impl(ctx):
+ runfiles = ctx.attr.target[DefaultInfo].default_runfiles.files.to_list()
+ for runfile in runfiles:
+ if runfile.short_path not in ["src/main", "src/main.exe"]:
+ fail("Unexpected runfile: %s" % runfile.short_path)
+
+no_runfiles_check = rule(
+ implementation = _no_runfiles_check_impl,
+ attrs = {
+ "target": attr.label(),
+ }
+)
+`,
+ })
+}
+
+func TestNonExecutableGoBinaryCantBeRun(t *testing.T) {
+ if err := bazel_testing.RunBazel("build", "//src:archive"); err != nil {
+ t.Fatal(err)
+ }
+ err := bazel_testing.RunBazel("run", "//src:archive")
+ if err == nil || !strings.Contains(err.Error(), "ERROR: Cannot run target //src:archive: Not executable") {
+ t.Errorf("Expected bazel run to fail due to //src:archive not being executable")
+ }
+}
+
+func TestNonExecutableGoBinaryNotInRunfiles(t *testing.T) {
+ if err := bazel_testing.RunBazel("build", "//src:no_runfiles"); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/go_binary/out_test.go b/tests/core/go_binary/out_test.go
new file mode 100644
index 00000000..7c6ba7f3
--- /dev/null
+++ b/tests/core/go_binary/out_test.go
@@ -0,0 +1,13 @@
+package main
+
+import (
+ "os"
+ "testing"
+)
+
+func TestCustomBinaryName(t *testing.T) {
+ _, err := os.Stat("alt_bin")
+ if err != nil {
+ t.Error(err)
+ }
+}
diff --git a/tests/core/go_binary/package_conflict_test.go b/tests/core/go_binary/package_conflict_test.go
new file mode 100644
index 00000000..9ec6340a
--- /dev/null
+++ b/tests/core/go_binary/package_conflict_test.go
@@ -0,0 +1,120 @@
+// Copyright 2020 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package package_conflict_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+
+go_library(
+ name = "foo_de",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/package_conflict/foo",
+ srcs = ["foo_de.go"],
+)
+
+go_library(
+ name = "de",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/package_conflict/de",
+ srcs = ["de.go"],
+ deps = [":foo_de"],
+)
+
+go_library(
+ name = "foo_en",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/package_conflict/foo",
+ srcs = ["foo_en.go"],
+)
+
+go_library(
+ name = "en",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/package_conflict/en",
+ srcs = ["en.go"],
+ deps = [":foo_en"],
+)
+
+go_binary(
+ name = "main",
+ srcs = ["main.go"],
+ deps = [
+ ":de",
+ ":en",
+ ],
+)
+
+-- foo_en.go --
+package foo
+
+import "fmt"
+
+func SayHello() {
+ fmt.Println("Hello, World!")
+}
+
+-- en.go --
+package en
+
+import "github.com/bazelbuild/rules_go/tests/core/package_conflict/foo"
+
+func SayHello() {
+ foo.SayHello()
+}
+
+-- foo_de.go --
+package foo
+
+import "fmt"
+
+func SayHello() {
+ fmt.Println("Hallo, Welt!")
+}
+
+-- de.go --
+package de
+
+import "github.com/bazelbuild/rules_go/tests/core/package_conflict/foo"
+
+func SayHello() {
+ foo.SayHello()
+}
+
+-- main.go --
+package main
+
+import (
+ "github.com/bazelbuild/rules_go/tests/core/package_conflict/de"
+ "github.com/bazelbuild/rules_go/tests/core/package_conflict/en"
+)
+
+func main() {
+ de.SayHello()
+ en.SayHello()
+}
+`,
+ })
+}
+
+func TestPackageConflict(t *testing.T) {
+ if err := bazel_testing.RunBazel("build", "//:main"); err == nil {
+ t.Fatal("Expected error")
+ }
+}
diff --git a/tests/core/go_binary/pie_darwin_amd64_test.go b/tests/core/go_binary/pie_darwin_amd64_test.go
new file mode 100644
index 00000000..9a07f955
--- /dev/null
+++ b/tests/core/go_binary/pie_darwin_amd64_test.go
@@ -0,0 +1,31 @@
+// Copyright 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package test
+
+import (
+ "debug/macho"
+ "testing"
+)
+
+func TestNoPIE(t *testing.T) {
+ m, err := openMachO("tests/core/go_binary", "hello_nopie_bin")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if m.Flags&macho.FlagPIE != 0 {
+ t.Error("ELF binary is not position-dependent.")
+ }
+}
diff --git a/tests/core/go_binary/pie_darwin_test.go b/tests/core/go_binary/pie_darwin_test.go
new file mode 100644
index 00000000..2f45b878
--- /dev/null
+++ b/tests/core/go_binary/pie_darwin_test.go
@@ -0,0 +1,35 @@
+package test
+
+import (
+ "debug/macho"
+ "fmt"
+ "os"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+)
+
+func openMachO(dir, bin string) (*macho.File, error) {
+ bin, ok := bazel.FindBinary(dir, bin)
+ if !ok {
+ return nil, fmt.Errorf("could not find binary: %s", bin)
+ }
+
+ f, err := os.Open(bin)
+ if err != nil {
+ return nil, err
+ }
+
+ return macho.NewFile(f)
+}
+
+func TestPIE(t *testing.T) {
+ m, err := openMachO("tests/core/go_binary", "hello_pie_bin")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if m.Flags&macho.FlagPIE == 0 {
+ t.Error("ELF binary is not position-independent.")
+ }
+}
diff --git a/tests/core/go_binary/pie_linux_test.go b/tests/core/go_binary/pie_linux_test.go
new file mode 100644
index 00000000..8b135500
--- /dev/null
+++ b/tests/core/go_binary/pie_linux_test.go
@@ -0,0 +1,48 @@
+package test
+
+import (
+ "debug/elf"
+ "fmt"
+ "os"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+)
+
+func openELF(dir, bin string) (*elf.File, error) {
+ bin, ok := bazel.FindBinary(dir, bin)
+ if !ok {
+ return nil, fmt.Errorf("could not find binary: %s", bin)
+ }
+
+ f, err := os.Open(bin)
+ if err != nil {
+ return nil, err
+ }
+
+ return elf.NewFile(f)
+}
+
+func TestPIE(t *testing.T) {
+ e, err := openELF("tests/core/go_binary", "hello_pie_bin")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // PIE binaries are implemented as shared libraries.
+ if e.Type != elf.ET_DYN {
+ t.Error("ELF binary is not position-independent.")
+ }
+}
+
+func TestNoPIE(t *testing.T) {
+ e, err := openELF("tests/core/go_binary", "hello_nopie_bin")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // PIE binaries are implemented as shared libraries.
+ if e.Type != elf.ET_EXEC {
+ t.Error("ELF binary is not position-dependent.")
+ }
+}
diff --git a/tests/core/go_binary/prefix/BUILD.bazel b/tests/core/go_binary/prefix/BUILD.bazel
new file mode 100644
index 00000000..aff7406b
--- /dev/null
+++ b/tests/core/go_binary/prefix/BUILD.bazel
@@ -0,0 +1,8 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "prefix",
+ srcs = ["prefix.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_binary/prefix",
+ visibility = ["//tests/core/go_binary:__pkg__"],
+)
diff --git a/tests/core/go_binary/prefix/prefix.go b/tests/core/go_binary/prefix/prefix.go
new file mode 100644
index 00000000..38dd16da
--- /dev/null
+++ b/tests/core/go_binary/prefix/prefix.go
@@ -0,0 +1,3 @@
+package main
+
+func main() {}
diff --git a/tests/core/go_binary/stamp_bin.go b/tests/core/go_binary/stamp_bin.go
new file mode 100644
index 00000000..e227be4c
--- /dev/null
+++ b/tests/core/go_binary/stamp_bin.go
@@ -0,0 +1,16 @@
+package main
+
+import (
+ "fmt"
+
+ "example.com/stamp_dep"
+)
+
+var Bin = "redacted"
+
+func main() {
+ fmt.Printf("Bin=%s\n", Bin)
+ fmt.Printf("Embed=%s\n", Embed)
+ fmt.Printf("DepSelf=%s\n", stamp_dep.DepSelf)
+ fmt.Printf("DepBin=%s\n", stamp_dep.DepBin)
+}
diff --git a/tests/core/go_binary/stamp_dep.go b/tests/core/go_binary/stamp_dep.go
new file mode 100644
index 00000000..37aa4635
--- /dev/null
+++ b/tests/core/go_binary/stamp_dep.go
@@ -0,0 +1,6 @@
+package stamp_dep
+
+var (
+ DepSelf = "redacted"
+ DepBin = "redacted"
+)
diff --git a/tests/core/go_binary/stamp_embed.go b/tests/core/go_binary/stamp_embed.go
new file mode 100644
index 00000000..8989e914
--- /dev/null
+++ b/tests/core/go_binary/stamp_embed.go
@@ -0,0 +1,3 @@
+package main
+
+var Embed = "redacted"
diff --git a/tests/core/go_binary/stamp_test.go b/tests/core/go_binary/stamp_test.go
new file mode 100644
index 00000000..506cce5c
--- /dev/null
+++ b/tests/core/go_binary/stamp_test.go
@@ -0,0 +1,29 @@
+package main
+
+import (
+ "os/exec"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+)
+
+func TestStamp(t *testing.T) {
+ bin, ok := bazel.FindBinary("tests/core/go_binary", "stamp_bin")
+ if !ok {
+ t.Error("could not find stamp_bin")
+ }
+ out, err := exec.Command(bin).Output()
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ got := strings.TrimSpace(string(out))
+ want := `Bin=Bin
+Embed=Embed
+DepSelf=DepSelf
+DepBin=DepBin`
+ if got != want {
+ t.Errorf("got:\n%s\nwant:\n%s", got, want)
+ }
+}
diff --git a/tests/core/go_binary/static_bin.go b/tests/core/go_binary/static_bin.go
new file mode 100644
index 00000000..7e0ab83b
--- /dev/null
+++ b/tests/core/go_binary/static_bin.go
@@ -0,0 +1,7 @@
+package main
+
+import (
+ _ "golang.org/x/sys/unix" // See https://github.com/bazelbuild/rules_go/issues/2168
+)
+
+func main() {}
diff --git a/tests/core/go_binary/static_cgo_bin.go b/tests/core/go_binary/static_cgo_bin.go
new file mode 100644
index 00000000..65676fd9
--- /dev/null
+++ b/tests/core/go_binary/static_cgo_bin.go
@@ -0,0 +1,14 @@
+package main
+
+/*
+#include <stdio.h>
+
+void say_hello() {
+ printf("hello\n");
+}
+*/
+import "C"
+
+func main() {
+ C.say_hello()
+}
diff --git a/tests/core/go_binary/static_pure_bin.go b/tests/core/go_binary/static_pure_bin.go
new file mode 100644
index 00000000..1dbaa12e
--- /dev/null
+++ b/tests/core/go_binary/static_pure_bin.go
@@ -0,0 +1,8 @@
+package main
+
+import (
+ _ "net"
+ _ "os"
+)
+
+func main() {}
diff --git a/tests/core/go_binary/static_test.go b/tests/core/go_binary/static_test.go
new file mode 100644
index 00000000..7c23cdae
--- /dev/null
+++ b/tests/core/go_binary/static_test.go
@@ -0,0 +1,45 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build linux
+
+package static_cgo_test
+
+import (
+ "debug/elf"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+)
+
+func TestStatic(t *testing.T) {
+ for _, name := range []string{"static_bin", "static_cgo_bin", "static_pure_bin"} {
+ t.Run(name, func(t *testing.T) {
+ path, ok := bazel.FindBinary("tests/core/go_binary", name)
+ if !ok {
+ t.Fatal("could not find static_cgo_bin")
+ }
+ f, err := elf.Open(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer f.Close()
+ for _, prog := range f.Progs {
+ if prog.Type == elf.PT_INTERP {
+ t.Fatalf("binary %s has PT_INTERP segment, indicating dynamic linkage", path)
+ }
+ }
+ })
+ }
+}
diff --git a/tests/core/go_binary/tags_lib_bad.go b/tests/core/go_binary/tags_lib_bad.go
new file mode 100644
index 00000000..30deb5ed
--- /dev/null
+++ b/tests/core/go_binary/tags_lib_bad.go
@@ -0,0 +1,5 @@
+// +build !good
+
+package lib
+
+var Does Not = Compile
diff --git a/tests/core/go_binary/tags_lib_good.go b/tests/core/go_binary/tags_lib_good.go
new file mode 100644
index 00000000..55c21f80
--- /dev/null
+++ b/tests/core/go_binary/tags_lib_good.go
@@ -0,0 +1 @@
+package lib
diff --git a/tests/core/go_binary/tags_main_bad.go b/tests/core/go_binary/tags_main_bad.go
new file mode 100644
index 00000000..444667ba
--- /dev/null
+++ b/tests/core/go_binary/tags_main_bad.go
@@ -0,0 +1,5 @@
+// +build !good
+
+package main
+
+var Does Not = Compile
diff --git a/tests/core/go_binary/tags_main_good.go b/tests/core/go_binary/tags_main_good.go
new file mode 100644
index 00000000..ee15bee7
--- /dev/null
+++ b/tests/core/go_binary/tags_main_good.go
@@ -0,0 +1,8 @@
+// +build good
+
+package main
+
+import _ "tags_lib"
+
+func main() {
+}
diff --git a/tests/core/go_download_sdk/BUILD.bazel b/tests/core/go_download_sdk/BUILD.bazel
new file mode 100644
index 00000000..f294f987
--- /dev/null
+++ b/tests/core/go_download_sdk/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "go_download_sdk_test",
+ srcs = ["go_download_sdk_test.go"],
+)
diff --git a/tests/core/go_download_sdk/README.rst b/tests/core/go_download_sdk/README.rst
new file mode 100644
index 00000000..78e93118
--- /dev/null
+++ b/tests/core/go_download_sdk/README.rst
@@ -0,0 +1,7 @@
+go_download_sdk
+===============
+
+go_download_sdk_test
+--------------------
+Verifies that ``go_downlaod_sdk`` can be used to download a specific version
+or a set of archives for various platforms.
diff --git a/tests/core/go_download_sdk/go_download_sdk_test.go b/tests/core/go_download_sdk/go_download_sdk_test.go
new file mode 100644
index 00000000..61bd05b8
--- /dev/null
+++ b/tests/core/go_download_sdk/go_download_sdk_test.go
@@ -0,0 +1,187 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package go_download_sdk_test
+
+import (
+ "bytes"
+ "io/ioutil"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_test")
+
+go_test(
+ name = "version_test",
+ srcs = ["version_test.go"],
+)
+
+-- version_test.go --
+package version_test
+
+import (
+ "flag"
+ "runtime"
+ "testing"
+)
+
+var want = flag.String("version", "", "")
+
+func Test(t *testing.T) {
+ if v := runtime.Version(); v != *want {
+ t.Errorf("got version %q; want %q", v, *want)
+ }
+}
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ for _, test := range []struct {
+ desc, rule string
+ optToWantVersion map[string]string
+ fetchOnly string
+ }{
+ {
+ desc: "version",
+ rule: `
+load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk")
+
+go_download_sdk(
+ name = "go_sdk",
+ version = "1.16",
+)
+
+`,
+ optToWantVersion: map[string]string{"": "go1.16"},
+ },
+ {
+ desc: "custom_archives",
+ rule: `
+load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk")
+
+go_download_sdk(
+ name = "go_sdk",
+ sdks = {
+ "darwin_amd64": ("go1.16.darwin-amd64.tar.gz", "6000a9522975d116bf76044967d7e69e04e982e9625330d9a539a8b45395f9a8"),
+ "darwin_arm64": ("go1.16.darwin-arm64.tar.gz", "4dac57c00168d30bbd02d95131d5de9ca88e04f2c5a29a404576f30ae9b54810"),
+ "linux_amd64": ("go1.16.linux-amd64.tar.gz", "013a489ebb3e24ef3d915abe5b94c3286c070dfe0818d5bca8108f1d6e8440d2"),
+ "windows_amd64": ("go1.16.windows-amd64.zip", "5cc88fa506b3d5c453c54c3ea218fc8dd05d7362ae1de15bb67986b72089ce93"),
+ },
+)
+`,
+ optToWantVersion: map[string]string{"": "go1.16"},
+ },
+ {
+ desc: "multiple_sdks",
+ rule: `
+load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk", "go_host_sdk")
+
+go_download_sdk(
+ name = "go_sdk",
+ version = "1.16",
+)
+go_download_sdk(
+ name = "go_sdk_1_17",
+ version = "1.17",
+)
+go_download_sdk(
+ name = "go_sdk_1_17_1",
+ version = "1.17.1",
+)
+`,
+ optToWantVersion: map[string]string{
+ "": "go1.16",
+ "--@io_bazel_rules_go//go/toolchain:sdk_version=remote": "go1.16",
+ "--@io_bazel_rules_go//go/toolchain:sdk_version=1": "go1.16",
+ "--@io_bazel_rules_go//go/toolchain:sdk_version=1.17": "go1.17",
+ "--@io_bazel_rules_go//go/toolchain:sdk_version=1.17.0": "go1.17",
+ "--@io_bazel_rules_go//go/toolchain:sdk_version=1.17.1": "go1.17.1",
+ },
+ },
+ {
+ // Cover workaround for #2771.
+ desc: "windows_zip",
+ rule: `
+load("@io_bazel_rules_go//go:deps.bzl", "go_download_sdk")
+
+go_download_sdk(
+ name = "go_sdk",
+ goarch = "amd64",
+ goos = "windows",
+ version = "1.20.4",
+)
+`,
+ fetchOnly: "@go_sdk//:BUILD.bazel",
+ },
+ } {
+ t.Run(test.desc, func(t *testing.T) {
+ origWorkspaceData, err := ioutil.ReadFile("WORKSPACE")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ i := bytes.Index(origWorkspaceData, []byte("go_rules_dependencies()"))
+ if i < 0 {
+ t.Fatal("could not find call to go_rules_dependencies()")
+ }
+
+ buf := &bytes.Buffer{}
+ buf.Write(origWorkspaceData[:i])
+ buf.WriteString(test.rule)
+ buf.WriteString(`
+go_rules_dependencies()
+
+go_register_toolchains()
+`)
+ if err := ioutil.WriteFile("WORKSPACE", buf.Bytes(), 0666); err != nil {
+ t.Fatal(err)
+ }
+ defer func() {
+ if err := ioutil.WriteFile("WORKSPACE", origWorkspaceData, 0666); err != nil {
+ t.Errorf("error restoring WORKSPACE: %v", err)
+ }
+ }()
+
+ if test.fetchOnly != "" {
+ if err := bazel_testing.RunBazel("fetch", test.fetchOnly); err != nil {
+ t.Fatal(err)
+ }
+ return
+ }
+
+ for opt, wantVersion := range test.optToWantVersion {
+ t.Run(wantVersion, func(t *testing.T) {
+ args := []string{
+ "test",
+ "//:version_test",
+ "--test_arg=-version=" + wantVersion,
+ }
+ if opt != "" {
+ args = append(args, opt)
+ }
+ if err := bazel_testing.RunBazel(args...); err != nil {
+ t.Fatal(err)
+ }
+ })
+ }
+ })
+ }
+}
diff --git a/tests/core/go_library/BUILD.bazel b/tests/core/go_library/BUILD.bazel
new file mode 100644
index 00000000..25293cbe
--- /dev/null
+++ b/tests/core/go_library/BUILD.bazel
@@ -0,0 +1,168 @@
+load("//go:def.bzl", "go_binary", "go_library", "go_test")
+load("//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+load(":def.bzl", "embedsrcs_files")
+
+go_library(
+ name = "empty",
+ srcs = [
+ # foo and bar have different package names
+ "empty_foo.go",
+ "empty_bar.go",
+ "empty_baz.s",
+ ],
+ importpath = "empty",
+)
+
+go_library(
+ name = "asm_include",
+ srcs = [
+ "inc.go",
+ "inc_bar.s",
+ "inc_foo.s",
+ ],
+ importpath = "asm_include",
+)
+
+go_library(
+ name = "asm_header",
+ srcs = [
+ "inc.go",
+ "inc_asmhdr.s",
+ ],
+ importpath = "asm_header",
+)
+
+go_library(
+ name = "package_height",
+ srcs = ["package_height.go"],
+ importpath = "package_height",
+ deps = [
+ ":package_height_dep_deep",
+ ":package_height_embedder",
+ ],
+)
+
+go_library(
+ name = "package_height_embedder",
+ srcs = ["package_height_embedder.go"],
+ embed = [":package_height_embeddee"],
+ importpath = "package_height/embed",
+ deps = [":package_height_dep_deep"],
+)
+
+go_library(
+ name = "package_height_embeddee",
+ srcs = ["package_height_embeddee.go"],
+ importpath = "package_height/embed",
+ deps = [":package_height_dep_shallow"],
+)
+
+go_library(
+ name = "package_height_dep_deep",
+ srcs = ["package_height_dep_deep.go"],
+ importpath = "package_height/dep",
+)
+
+go_library(
+ name = "package_height_dep_shallow",
+ srcs = ["package_height_dep_shallow.go"],
+ importpath = "package_height/dep",
+)
+
+go_test(
+ name = "import_alias_test",
+ srcs = ["import_alias_test.go"],
+ deps = [
+ ":import_alias_a_v2",
+ ":import_alias_b",
+ ":import_alias_b_v2",
+ ],
+)
+
+go_library(
+ name = "import_alias_a_v2",
+ srcs = ["import_alias_a_v2.go"],
+ importpath = "import_alias/a/v2",
+ importpath_aliases = ["import_alias/a"],
+)
+
+go_library(
+ name = "import_alias_b",
+ srcs = ["import_alias_b.go"],
+ importpath = "import_alias/b",
+)
+
+go_library(
+ name = "import_alias_b_v2",
+ importpath = "import_alias/b/v2",
+ importpath_aliases = ["import_alias/b"],
+)
+
+go_test(
+ name = "embedsrcs_test",
+ srcs = [
+ "embedsrcs_gen_test.go",
+ "embedsrcs_test.go",
+ ],
+ embedsrcs = [
+ ":embedsrcs_transitioned",
+ ":embedsrcs_dynamic",
+ "embedsrcs_test.go",
+ ] + glob(["embedsrcs_static/**"]),
+)
+
+genrule(
+ name = "embedsrcs_gen",
+ srcs = ["embedsrcs_gen_test.go.in"],
+ outs = ["embedsrcs_gen_test.go"],
+ cmd = "cp $< $@",
+)
+
+embedsrcs_files(
+ name = "embedsrcs_dynamic",
+ files = [
+ "dir/_no",
+ "dir/f",
+ "empty/",
+ "file",
+ "glob/_hidden",
+ "glob/f",
+ "no",
+ ],
+)
+
+go_binary(
+ name = "embedsrcs_transitioned",
+ srcs = ["empty_main.go"],
+ out = "embedsrcs_transitioned",
+ # Causes a transition on the incoming dependency edge.
+ race = "on",
+)
+
+go_binary(
+ name = "gen_embedsrcs_files",
+ srcs = ["gen_embedsrcs_files.go"],
+)
+
+go_bazel_test(
+ name = "embedsrcs_error_test",
+ size = "medium",
+ srcs = ["embedsrcs_error_test.go"],
+)
+
+go_test(
+ name = "embedsrcs_simple_test",
+ srcs = ["embedsrcs_simple_test.go"],
+ embedsrcs = ["embedsrcs_static/no"],
+)
+
+go_bazel_test(
+ name = "no_srcs_test",
+ size = "medium",
+ srcs = ["no_srcs_test.go"],
+)
+
+go_library(
+ name = "no_srcs_lib",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/no_srcs_lib",
+)
diff --git a/tests/core/go_library/README.rst b/tests/core/go_library/README.rst
new file mode 100644
index 00000000..4410902f
--- /dev/null
+++ b/tests/core/go_library/README.rst
@@ -0,0 +1,57 @@
+Basic go_library functionality
+==============================
+
+.. _go_library: /docs/go/core/rules.md#_go_library
+.. _#1262: https://github.com/bazelbuild/rules_go/issues/1262
+.. _#1520: https://github.com/bazelbuild/rules_go/issues/1520
+.. _#1772: https://github.com/bazelbuild/rules_go/issues/1772
+.. _#2058: https://github.com/bazelbuild/rules_go/issues/2058
+.. _#3558: https://github.com/bazelbuild/rules_go/issues/3558
+
+empty
+-----
+
+Checks that a `go_library`_ will compile and link even if all the sources
+(including assembly sources) are filtered out by build constraints.
+
+asm_include
+-----------
+
+Checks that assembly files in a `go_library`_ may include other assembly
+files in the same library. Verifies `#1520`_.
+
+asm_header
+----------
+
+Checks that assembly files in a `go_library`_ may include ``"go_asm.h"``,
+generated by the compiler. Verifies `#1262`_.
+
+package_height
+--------------
+
+Checks that when a library embeds another library, the embedder's dependencies
+may override the embeddee's dependencies. Verifies `#1772`_.
+
+import_alias_test
+-----------------
+
+Checks that a library may import another library using one of the strings
+listed in ``importpath_aliases``. This is the basic mechanism for minimal
+module compatibility. Verifies `#2058`_.
+
+embedsrcs_test
+--------------
+
+Checks that `go_library`_ can match ``//go:embed`` directives to files listed
+in the ``embedsrcs`` attribute and can pass those files to the compiler.
+
+embedsrcs_error_test
+--------------------
+
+Verifies common errors with ``//go:embed`` directives are correctly reported.
+
+no_srcs_test
+------------
+
+Verifies that `go_library`_ targets without Go source files build concurrently,
+even unsandboxed, and reproducibly. Verifies `#3558`_. \ No newline at end of file
diff --git a/tests/core/go_library/def.bzl b/tests/core/go_library/def.bzl
new file mode 100644
index 00000000..613ea84d
--- /dev/null
+++ b/tests/core/go_library/def.bzl
@@ -0,0 +1,22 @@
+def _embedsrcs_files_impl(ctx):
+ name = ctx.attr.name
+ dir = ctx.actions.declare_directory(name)
+ args = [dir.path] + ctx.attr.files
+ ctx.actions.run(
+ outputs = [dir],
+ executable = ctx.executable._gen,
+ arguments = args,
+ )
+ return [DefaultInfo(files = depset([dir]))]
+
+embedsrcs_files = rule(
+ implementation = _embedsrcs_files_impl,
+ attrs = {
+ "files": attr.string_list(),
+ "_gen": attr.label(
+ default = ":gen_embedsrcs_files",
+ executable = True,
+ cfg = "exec",
+ ),
+ },
+)
diff --git a/tests/core/go_library/embedsrcs_error_test.go b/tests/core/go_library/embedsrcs_error_test.go
new file mode 100644
index 00000000..73629ddf
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_error_test.go
@@ -0,0 +1,138 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package embedsrcs_errors
+
+import (
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "invalid",
+ srcs = ["invalid.go"],
+ importpath = "invalid",
+)
+
+go_library(
+ name = "none",
+ srcs = ["none.go"],
+ importpath = "none",
+)
+
+go_library(
+ name = "multi_dir",
+ srcs = [
+ "a.go",
+ "b/b.go",
+ ],
+ embedsrcs = [
+ "a.txt",
+ "b/b.txt",
+ ],
+ importpath = "multi_dir",
+)
+
+go_library(
+ name = "embeds_vcs_dir",
+ srcs = ["c/c.go"],
+ embedsrcs = ["c/.bzr/c.txt"],
+ importpath = "embeds_vcs_dir",
+)
+-- invalid.go --
+package invalid
+
+import _ "embed"
+
+//go:embed ..
+var x string
+-- none.go --
+package none
+
+import _ "embed"
+
+//go:embed none
+var x string
+-- a.go --
+package a
+
+import _ "embed"
+
+//go:embed a.txt
+var x string
+-- a.txt --
+-- b/b.go --
+package a
+
+import _ "embed"
+
+//go:embed b.txt
+var y string
+-- b/b.txt --
+-- c/c.go --
+package a
+
+import _ "embed"
+
+//go:embed .bzr
+var z string
+-- c/.bzr/c.txt --
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ for _, test := range []struct {
+ desc, target, want string
+ }{
+ {
+ desc: "invalid",
+ target: "//:invalid",
+ want: "invalid pattern syntax",
+ },
+ {
+ desc: "none",
+ target: "//:none",
+ want: "could not embed none: no matching files found",
+ },
+ {
+ desc: "multi_dir",
+ target: "//:multi_dir",
+ want: "source files with //go:embed should be in same directory",
+ },
+ {
+ desc: "embeds_vcs_dir",
+ target: "//:embeds_vcs_dir",
+ want: "could not embed .bzr: cannot embed directory .bzr: invalid name .bzr",
+ },
+ } {
+ t.Run(test.desc, func(t *testing.T) {
+ err := bazel_testing.RunBazel("build", test.target)
+ if err == nil {
+ t.Fatalf("expected error matching %q", test.want)
+ }
+ if errMsg := err.Error(); !strings.Contains(errMsg, test.want) {
+ t.Fatalf("expected error matching %q; got %v", test.want, errMsg)
+ }
+ })
+ }
+}
diff --git a/tests/core/go_library/embedsrcs_gen_test.go.in b/tests/core/go_library/embedsrcs_gen_test.go.in
new file mode 100644
index 00000000..a845b48e
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_gen_test.go.in
@@ -0,0 +1,20 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package embedsrcs
+
+import "embed"
+
+//go:embed embedsrcs_test.go
+var gen embed.FS
diff --git a/tests/core/go_library/embedsrcs_simple_test.go b/tests/core/go_library/embedsrcs_simple_test.go
new file mode 100644
index 00000000..32b3fdee
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_simple_test.go
@@ -0,0 +1,6 @@
+package embedsrcs_simple_test
+
+import _ "embed"
+
+//go:embed embedsrcs_static/no
+var no []byte
diff --git a/tests/core/go_library/embedsrcs_static/contains_hidden/.hidden b/tests/core/go_library/embedsrcs_static/contains_hidden/.hidden
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_static/contains_hidden/.hidden
diff --git a/tests/core/go_library/embedsrcs_static/contains_hidden/.hidden_dir/.env b/tests/core/go_library/embedsrcs_static/contains_hidden/.hidden_dir/.env
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_static/contains_hidden/.hidden_dir/.env
diff --git a/tests/core/go_library/embedsrcs_static/contains_hidden/.hidden_dir/visible_file b/tests/core/go_library/embedsrcs_static/contains_hidden/.hidden_dir/visible_file
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_static/contains_hidden/.hidden_dir/visible_file
diff --git a/tests/core/go_library/embedsrcs_static/contains_hidden/_hidden_dir/.bashrc b/tests/core/go_library/embedsrcs_static/contains_hidden/_hidden_dir/.bashrc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_static/contains_hidden/_hidden_dir/.bashrc
diff --git a/tests/core/go_library/embedsrcs_static/contains_hidden/_hidden_dir/_hidden_file b/tests/core/go_library/embedsrcs_static/contains_hidden/_hidden_dir/_hidden_file
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_static/contains_hidden/_hidden_dir/_hidden_file
diff --git a/tests/core/go_library/embedsrcs_static/contains_hidden/_hidden_dir/visible_file b/tests/core/go_library/embedsrcs_static/contains_hidden/_hidden_dir/visible_file
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_static/contains_hidden/_hidden_dir/visible_file
diff --git a/tests/core/go_library/embedsrcs_static/contains_hidden/visible/.bzr/file-under-version-control b/tests/core/go_library/embedsrcs_static/contains_hidden/visible/.bzr/file-under-version-control
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_static/contains_hidden/visible/.bzr/file-under-version-control
diff --git a/tests/core/go_library/embedsrcs_static/contains_hidden/visible/visible_file b/tests/core/go_library/embedsrcs_static/contains_hidden/visible/visible_file
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_static/contains_hidden/visible/visible_file
diff --git a/tests/core/go_library/embedsrcs_static/dir/_no b/tests/core/go_library/embedsrcs_static/dir/_no
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_static/dir/_no
diff --git a/tests/core/go_library/embedsrcs_static/dir/f b/tests/core/go_library/embedsrcs_static/dir/f
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_static/dir/f
diff --git a/tests/core/go_library/embedsrcs_static/file b/tests/core/go_library/embedsrcs_static/file
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_static/file
diff --git a/tests/core/go_library/embedsrcs_static/glob/_hidden b/tests/core/go_library/embedsrcs_static/glob/_hidden
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_static/glob/_hidden
diff --git a/tests/core/go_library/embedsrcs_static/glob/f b/tests/core/go_library/embedsrcs_static/glob/f
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_static/glob/f
diff --git a/tests/core/go_library/embedsrcs_static/no b/tests/core/go_library/embedsrcs_static/no
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_static/no
diff --git a/tests/core/go_library/embedsrcs_test.go b/tests/core/go_library/embedsrcs_test.go
new file mode 100644
index 00000000..0a4506e6
--- /dev/null
+++ b/tests/core/go_library/embedsrcs_test.go
@@ -0,0 +1,199 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package embedsrcs
+
+import (
+ "bytes"
+ "embed"
+ "io/fs"
+ "strings"
+ "testing"
+)
+
+//go:embed embedsrcs_test.go
+var self embed.FS
+
+//go:embed embedsrcs_static/file embedsrcs_static/dir embedsrcs_static/glob/*
+var static embed.FS
+
+//go:embed embedsrcs_dynamic/file embedsrcs_dynamic/dir embedsrcs_dynamic/glob/*
+var dynamic embed.FS
+
+//go:embed embedsrcs_transitioned
+var transitioned embed.FS
+
+//go:embed *
+var star embed.FS
+
+//go:embed all:embedsrcs_static/contains_hidden
+var all embed.FS
+
+//go:embed embedsrcs_static/contains_hidden
+var allButHidden embed.FS
+
+func TestFiles(t *testing.T) {
+ for _, test := range []struct {
+ desc string
+ fsys fs.FS
+ want []string
+ }{
+ {
+ desc: "self",
+ fsys: self,
+ want: []string{
+ ".",
+ "embedsrcs_test.go",
+ },
+ },
+ {
+ desc: "gen",
+ fsys: gen,
+ want: []string{
+ ".",
+ "embedsrcs_test.go",
+ },
+ },
+ {
+ desc: "static",
+ fsys: static,
+ want: []string{
+ ".",
+ "embedsrcs_static",
+ "embedsrcs_static/dir",
+ "embedsrcs_static/dir/f",
+ "embedsrcs_static/file",
+ "embedsrcs_static/glob",
+ "embedsrcs_static/glob/_hidden",
+ "embedsrcs_static/glob/f",
+ },
+ },
+ {
+ desc: "dynamic",
+ fsys: dynamic,
+ want: []string{
+ ".",
+ "embedsrcs_dynamic",
+ "embedsrcs_dynamic/dir",
+ "embedsrcs_dynamic/dir/f",
+ "embedsrcs_dynamic/file",
+ "embedsrcs_dynamic/glob",
+ "embedsrcs_dynamic/glob/_hidden",
+ "embedsrcs_dynamic/glob/f",
+ },
+ },
+ {
+ desc: "transitioned",
+ fsys: transitioned,
+ want: []string{
+ ".",
+ "embedsrcs_transitioned",
+ },
+ },
+ {
+ desc: "star",
+ fsys: star,
+ want: []string{
+ ".",
+ "embedsrcs_dynamic",
+ "embedsrcs_dynamic/dir",
+ "embedsrcs_dynamic/dir/f",
+ "embedsrcs_dynamic/empty",
+ "embedsrcs_dynamic/file",
+ "embedsrcs_dynamic/glob",
+ "embedsrcs_dynamic/glob/f",
+ "embedsrcs_dynamic/no",
+ "embedsrcs_static",
+ "embedsrcs_static/contains_hidden",
+ "embedsrcs_static/contains_hidden/visible",
+ "embedsrcs_static/contains_hidden/visible/visible_file",
+ "embedsrcs_static/dir",
+ "embedsrcs_static/dir/f",
+ "embedsrcs_static/file",
+ "embedsrcs_static/glob",
+ "embedsrcs_static/glob/f",
+ "embedsrcs_static/no",
+ "embedsrcs_test.go",
+ "embedsrcs_transitioned",
+ },
+ },
+ {
+ desc: "all",
+ fsys: all,
+ want: []string{
+ ".",
+ "embedsrcs_static",
+ "embedsrcs_static/contains_hidden",
+ "embedsrcs_static/contains_hidden/.hidden",
+ "embedsrcs_static/contains_hidden/.hidden_dir",
+ "embedsrcs_static/contains_hidden/.hidden_dir/.env",
+ "embedsrcs_static/contains_hidden/.hidden_dir/visible_file",
+ "embedsrcs_static/contains_hidden/_hidden_dir",
+ "embedsrcs_static/contains_hidden/_hidden_dir/.bashrc",
+ "embedsrcs_static/contains_hidden/_hidden_dir/_hidden_file",
+ "embedsrcs_static/contains_hidden/_hidden_dir/visible_file",
+ "embedsrcs_static/contains_hidden/visible",
+ "embedsrcs_static/contains_hidden/visible/visible_file",
+ },
+ },
+ {
+ desc: "allButHidden",
+ fsys: allButHidden,
+ want: []string{
+ ".",
+ "embedsrcs_static",
+ "embedsrcs_static/contains_hidden",
+ "embedsrcs_static/contains_hidden/visible",
+ "embedsrcs_static/contains_hidden/visible/visible_file",
+ },
+ },
+ } {
+ t.Run(test.desc, func(t *testing.T) {
+ got, err := listFiles(test.fsys)
+ if err != nil {
+ t.Fatal(err)
+ }
+ gotStr := strings.Join(got, "\n")
+ wantStr := strings.Join(test.want, "\n")
+ if gotStr != wantStr {
+ t.Errorf("got:\n%s\nwant:\n%s", gotStr, wantStr)
+ }
+ })
+ }
+}
+
+func listFiles(fsys fs.FS) ([]string, error) {
+ var files []string
+ err := fs.WalkDir(fsys, ".", func(path string, _ fs.DirEntry, err error) error {
+ if err != nil {
+ return err
+ }
+ files = append(files, path)
+ return nil
+ })
+ if err != nil {
+ return nil, err
+ }
+ return files, nil
+}
+
+func TestContent(t *testing.T) {
+ data, err := fs.ReadFile(self, "embedsrcs_test.go")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !bytes.Contains(data, []byte("package embedsrcs")) {
+ t.Error("embedded content did not contain package declaration")
+ }
+}
diff --git a/tests/core/go_library/empty_bar.go b/tests/core/go_library/empty_bar.go
new file mode 100644
index 00000000..d73206c4
--- /dev/null
+++ b/tests/core/go_library/empty_bar.go
@@ -0,0 +1,3 @@
+// +build ignore
+
+package bar
diff --git a/tests/core/go_library/empty_baz.s b/tests/core/go_library/empty_baz.s
new file mode 100644
index 00000000..15934b3b
--- /dev/null
+++ b/tests/core/go_library/empty_baz.s
@@ -0,0 +1 @@
+// +build ignore
diff --git a/tests/core/go_library/empty_foo.go b/tests/core/go_library/empty_foo.go
new file mode 100644
index 00000000..ce414ed6
--- /dev/null
+++ b/tests/core/go_library/empty_foo.go
@@ -0,0 +1,3 @@
+// +build ignore
+
+package foo
diff --git a/tests/core/go_library/empty_main.go b/tests/core/go_library/empty_main.go
new file mode 100644
index 00000000..38dd16da
--- /dev/null
+++ b/tests/core/go_library/empty_main.go
@@ -0,0 +1,3 @@
+package main
+
+func main() {}
diff --git a/tests/core/go_library/gen_embedsrcs_files.go b/tests/core/go_library/gen_embedsrcs_files.go
new file mode 100644
index 00000000..68ff2fef
--- /dev/null
+++ b/tests/core/go_library/gen_embedsrcs_files.go
@@ -0,0 +1,51 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "fmt"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "strings"
+)
+
+func main() {
+ dir := os.Args[1]
+ files := os.Args[2:]
+ if err := run(dir, files); err != nil {
+ fmt.Fprintf(os.Stderr, "%v\n", err)
+ os.Exit(1)
+ }
+}
+
+func run(dir string, files []string) error {
+ for _, file := range files {
+ path := filepath.Join(dir, file)
+ if strings.HasSuffix(path, "/") {
+ if err := os.MkdirAll(path, 0777); err != nil {
+ return err
+ }
+ } else {
+ if err := os.MkdirAll(filepath.Dir(path), 0777); err != nil {
+ return err
+ }
+ if err := ioutil.WriteFile(path, nil, 0666); err != nil {
+ return err
+ }
+ }
+ }
+ return nil
+}
diff --git a/tests/core/go_library/import_alias_a_v2.go b/tests/core/go_library/import_alias_a_v2.go
new file mode 100644
index 00000000..66326f94
--- /dev/null
+++ b/tests/core/go_library/import_alias_a_v2.go
@@ -0,0 +1,17 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package a
+
+const A = "import_alias/a/v2"
diff --git a/tests/core/go_library/import_alias_b.go b/tests/core/go_library/import_alias_b.go
new file mode 100644
index 00000000..1fa79977
--- /dev/null
+++ b/tests/core/go_library/import_alias_b.go
@@ -0,0 +1,17 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package b
+
+const B = "import_alias/b"
diff --git a/tests/core/go_library/import_alias_test.go b/tests/core/go_library/import_alias_test.go
new file mode 100644
index 00000000..aabec973
--- /dev/null
+++ b/tests/core/go_library/import_alias_test.go
@@ -0,0 +1,33 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package import_alias
+
+import (
+ "import_alias/a"
+ "import_alias/b"
+ "testing"
+)
+
+func TestA(t *testing.T) {
+ if a.A != "import_alias/a/v2" {
+ t.Errorf("got %q; want %q", a.A, "import_alias/a/v2")
+ }
+}
+
+func TestB(t *testing.T) {
+ if b.B != "import_alias/b" {
+ t.Errorf("got %q; want %q", b.B, "import_alias/b")
+ }
+}
diff --git a/tests/core/go_library/inc.go b/tests/core/go_library/inc.go
new file mode 100644
index 00000000..bb5e9272
--- /dev/null
+++ b/tests/core/go_library/inc.go
@@ -0,0 +1 @@
+package inc
diff --git a/tests/core/go_library/inc_asmhdr.s b/tests/core/go_library/inc_asmhdr.s
new file mode 100644
index 00000000..230bbe2f
--- /dev/null
+++ b/tests/core/go_library/inc_asmhdr.s
@@ -0,0 +1 @@
+#include "go_asm.h"
diff --git a/tests/core/go_library/inc_bar.s b/tests/core/go_library/inc_bar.s
new file mode 100644
index 00000000..47eaec6b
--- /dev/null
+++ b/tests/core/go_library/inc_bar.s
@@ -0,0 +1 @@
+#include "inc_foo.s"
diff --git a/tests/core/go_library/inc_foo.s b/tests/core/go_library/inc_foo.s
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_library/inc_foo.s
diff --git a/tests/core/go_library/no_srcs_test.go b/tests/core/go_library/no_srcs_test.go
new file mode 100644
index 00000000..8e6bebc0
--- /dev/null
+++ b/tests/core/go_library/no_srcs_test.go
@@ -0,0 +1,78 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package no_srcs
+
+import (
+ "bytes"
+ "os"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+[
+ go_library(
+ name = "lib_" + str(i),
+ srcs = [],
+ importpath = "example.com/some/path",
+ )
+ for i in range(1000)
+]
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ commonArgs := []string{
+ "--spawn_strategy=local",
+ "--compilation_mode=dbg",
+ }
+
+ if err := bazel_testing.RunBazel(append([]string{"build", "//..."}, commonArgs...)...); err != nil {
+ t.Fatal(err)
+ }
+
+ out, err := bazel_testing.BazelOutput(append([]string{"cquery", "--output=files", "//..."}, commonArgs...)...)
+ if err != nil {
+ t.Fatal(err)
+ }
+ archives := strings.Split(strings.TrimSpace(string(out)), "\n")
+
+ if len(archives) != 1000 {
+ t.Fatalf("expected 1000 archives, got %d", len(archives))
+ }
+
+ referenceContent, err := os.ReadFile(archives[0])
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ for _, archive := range archives {
+ content, err := os.ReadFile(archive)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !bytes.Equal(content, referenceContent) {
+ t.Fatalf("expected all archives to be identical, got:\n\n%s\n\n%s\n", string(content), string(referenceContent))
+ }
+ }
+}
diff --git a/tests/core/go_library/package_height.go b/tests/core/go_library/package_height.go
new file mode 100644
index 00000000..cafb5faf
--- /dev/null
+++ b/tests/core/go_library/package_height.go
@@ -0,0 +1,6 @@
+package height
+
+import "package_height/embed"
+import "package_height/dep"
+
+var X = embed.T{F: dep.T{}}
diff --git a/tests/core/go_library/package_height_dep_deep.go b/tests/core/go_library/package_height_dep_deep.go
new file mode 100644
index 00000000..139a805d
--- /dev/null
+++ b/tests/core/go_library/package_height_dep_deep.go
@@ -0,0 +1,7 @@
+package dep
+
+import "os"
+
+type T struct {
+ F *os.File
+}
diff --git a/tests/core/go_library/package_height_dep_shallow.go b/tests/core/go_library/package_height_dep_shallow.go
new file mode 100644
index 00000000..1902c035
--- /dev/null
+++ b/tests/core/go_library/package_height_dep_shallow.go
@@ -0,0 +1,3 @@
+package dep
+
+type T struct{}
diff --git a/tests/core/go_library/package_height_embeddee.go b/tests/core/go_library/package_height_embeddee.go
new file mode 100644
index 00000000..0c36a32a
--- /dev/null
+++ b/tests/core/go_library/package_height_embeddee.go
@@ -0,0 +1,7 @@
+package embed
+
+import "package_height/dep"
+
+type T struct {
+ F dep.T
+}
diff --git a/tests/core/go_library/package_height_embedder.go b/tests/core/go_library/package_height_embedder.go
new file mode 100644
index 00000000..81a00369
--- /dev/null
+++ b/tests/core/go_library/package_height_embedder.go
@@ -0,0 +1,3 @@
+package embed
+
+var X = T{}
diff --git a/tests/core/go_path/BUILD.bazel b/tests/core/go_path/BUILD.bazel
new file mode 100644
index 00000000..59aea97c
--- /dev/null
+++ b/tests/core/go_path/BUILD.bazel
@@ -0,0 +1,81 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_path", "go_test")
+
+test_suite(name = "go_path")
+
+[go_path(
+ name = mode + "_path",
+ testonly = True,
+ data = ["extra.txt"],
+ include_pkg = True,
+ mode = mode,
+ deps = [
+ "//tests/core/go_path/cmd/bin",
+ "//tests/core/go_path/cmd/bin:cross",
+ "//tests/core/go_path/pkg/lib:embed_test",
+ "//tests/core/go_path/pkg/lib:go_default_library",
+ "//tests/core/go_path/pkg/lib:go_default_test",
+ "//tests/core/go_path/pkg/lib:vendored",
+ ],
+) for mode in ("archive", "copy")]
+
+go_path(
+ name = "transition_path",
+ testonly = True,
+ data = ["extra.txt"],
+ include_pkg = True,
+ mode = "copy",
+ deps = ["//tests/core/go_path/cmd/bin:pie"],
+)
+
+go_path(
+ name = "nodata_path",
+ testonly = True,
+ data = ["extra.txt"],
+ include_data = False,
+ mode = "copy",
+ deps = ["//tests/core/go_path/pkg/lib:go_default_library"],
+)
+
+go_path(
+ name = "notransitive_path",
+ testonly = True,
+ include_transitive = False,
+ mode = "copy",
+ deps = ["//tests/core/go_path/pkg/lib:go_default_library"],
+)
+
+go_path(
+ name = "embed_path",
+ mode = "copy",
+ deps = ["//tests/core/go_path/pkg/lib:generated_embeded"],
+)
+
+go_path(
+ name = "embed_no_srcs_path",
+ mode = "copy",
+ deps = ["//tests/core/go_path/pkg/lib:generated_embeded_no_srcs"],
+)
+
+go_test(
+ name = "go_path_test",
+ srcs = ["go_path_test.go"],
+ args = [
+ "-archive_path=$(location :archive_path)",
+ "-copy_path=$(location :copy_path)",
+ "-nodata_path=$(location :nodata_path)",
+ "-embed_path=$(location :embed_path)",
+ "-embed_no_srcs_path=$(location :embed_no_srcs_path)",
+ "-notransitive_path=$(location :notransitive_path)",
+ ],
+ data = [
+ ":archive_path",
+ ":copy_path",
+ ":embed_no_srcs_path",
+ ":embed_path",
+ ":nodata_path",
+ ":notransitive_path",
+ ":transition_path",
+ ],
+ rundir = ".",
+ deps = ["//go/tools/bazel:go_default_library"],
+)
diff --git a/tests/core/go_path/README.rst b/tests/core/go_path/README.rst
new file mode 100644
index 00000000..6d086086
--- /dev/null
+++ b/tests/core/go_path/README.rst
@@ -0,0 +1,12 @@
+Basic go_path functionality
+===========================
+
+.. _go_path: /docs/go/core/rules.md#_go_path
+
+Tests to ensure the basic features of `go_path`_ are working as expected.
+
+go_path_test
+------------
+
+Consumes `go_path`_ rules built for the same set of packages in archive, copy,
+and link modes and verifies that expected files are present in each mode.
diff --git a/tests/core/go_path/cmd/bin/BUILD.bazel b/tests/core/go_path/cmd/bin/BUILD.bazel
new file mode 100644
index 00000000..08f4e6dd
--- /dev/null
+++ b/tests/core/go_path/cmd/bin/BUILD.bazel
@@ -0,0 +1,30 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+go_binary(
+ name = "bin",
+ srcs = ["bin.go"],
+ data = ["bin.go"], # test duplicate
+ importpath = "example.com/repo/cmd/bin",
+ visibility = ["//visibility:public"],
+)
+
+go_binary(
+ name = "pie",
+ srcs = ["bin.go"],
+ importpath = "example.com/repo/cmd/bin",
+ linkmode = "pie",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//tests/core/go_path/pkg/lib:go_default_library",
+ ],
+)
+
+go_binary(
+ name = "cross",
+ srcs = ["bin.go"],
+ goarch = "arm",
+ goos = "plan9",
+ importpath = "example.com/repo/cmd/bin",
+ pure = "on",
+ visibility = ["//visibility:public"],
+)
diff --git a/tests/core/go_path/cmd/bin/bin.go b/tests/core/go_path/cmd/bin/bin.go
new file mode 100644
index 00000000..da29a2ca
--- /dev/null
+++ b/tests/core/go_path/cmd/bin/bin.go
@@ -0,0 +1,4 @@
+package main
+
+func main() {
+}
diff --git a/tests/core/go_path/extra.txt b/tests/core/go_path/extra.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_path/extra.txt
diff --git a/tests/core/go_path/go_path_test.go b/tests/core/go_path/go_path_test.go
new file mode 100644
index 00000000..23e27cb8
--- /dev/null
+++ b/tests/core/go_path/go_path_test.go
@@ -0,0 +1,205 @@
+/* Copyright 2018 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package go_path
+
+import (
+ "archive/zip"
+ "flag"
+ "io"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "runtime"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+)
+
+var copyPath, embedPath, embedNoSrcsPath, archivePath, nodataPath, notransitivePath string
+
+var defaultMode = runtime.GOOS + "_" + runtime.GOARCH
+
+var files = []string{
+ "extra.txt",
+ "src/",
+ "-src/example.com/repo/cmd/bin/bin",
+ "-src/testmain/testmain.go",
+ "src/example.com/repo/cmd/bin/bin.go",
+ "src/example.com/repo/pkg/lib/lib.go",
+ "src/example.com/repo/pkg/lib/embedded_src.txt",
+ "src/example.com/repo/pkg/lib/template/index.html.tmpl",
+ "src/example.com/repo/pkg/lib/embed_test.go",
+ "src/example.com/repo/pkg/lib/internal_test.go",
+ "src/example.com/repo/pkg/lib/external_test.go",
+ "-src/example.com/repo/pkg/lib_test/embed_test.go",
+ "src/example.com/repo/pkg/lib/data.txt",
+ "src/example.com/repo/pkg/lib/testdata/testdata.txt",
+ "src/example.com/repo/vendor/example.com/repo2/vendored.go",
+ "pkg/" + defaultMode + "/example.com/repo/cmd/bin.a",
+ "pkg/" + defaultMode + "/example.com/repo/pkg/lib.a",
+ "pkg/" + defaultMode + "/example.com/repo/vendor/example.com/repo2.a",
+ "pkg/plan9_arm/example.com/repo/cmd/bin.a",
+}
+
+func TestMain(m *testing.M) {
+ flag.StringVar(&copyPath, "copy_path", "", "path to copied go_path")
+ flag.StringVar(&archivePath, "archive_path", "", "path to archive go_path")
+ flag.StringVar(&nodataPath, "nodata_path", "", "path to go_path without data")
+ flag.StringVar(&embedPath, "embed_path", "", "path to go_path with embedsrcs")
+ flag.StringVar(&embedNoSrcsPath, "embed_no_srcs_path", "", "path to go_path with embedsrcs")
+ flag.StringVar(&notransitivePath, "notransitive_path", "", "path to go_path without transitive dependencies")
+ flag.Parse()
+ os.Exit(m.Run())
+}
+
+func TestCopyPath(t *testing.T) {
+ if copyPath == "" {
+ t.Fatal("-copy_path not set")
+ }
+ checkPath(t, copyPath, files)
+}
+
+func TestEmbedPath(t *testing.T) {
+ if embedPath == "" {
+ t.Fatal("-embed_path not set")
+ }
+ files := []string{
+ "src/lib/embed_test.go",
+ "src/lib/embedded_src.txt",
+ "src/lib/generated_embeded.go",
+ }
+ checkPath(t, embedPath, files)
+}
+
+func TestEmbedNoSrcsPath(t *testing.T) {
+ if embedNoSrcsPath == "" {
+ t.Fatal("-embed_no_srcs_path not set")
+ }
+ files := []string{
+ "src/lib/embedded_src.txt",
+ "src/lib/generated_embeded_no_srcs.go",
+ }
+ checkPath(t, embedNoSrcsPath, files)
+}
+
+func TestArchivePath(t *testing.T) {
+ if archivePath == "" {
+ t.Fatal("-archive_path not set")
+ }
+ dir, err := ioutil.TempDir(os.Getenv("TEST_TEMPDIR"), "TestArchivePath")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer os.RemoveAll(dir)
+
+ path, err := bazel.Runfile(archivePath)
+ if err != nil {
+ t.Fatalf("Could not find runfile %s: %q", archivePath, err)
+ }
+
+ z, err := zip.OpenReader(path)
+ if err != nil {
+ t.Fatalf("error opening zip: %v", err)
+ }
+ defer z.Close()
+ for _, f := range z.File {
+ r, err := f.Open()
+ if err != nil {
+ t.Fatalf("error reading file %s: %v", f.Name, err)
+ }
+ dstPath := filepath.Join(dir, filepath.FromSlash(f.Name))
+ if err := os.MkdirAll(filepath.Dir(dstPath), 0777); err != nil {
+ t.Fatalf("error creating directory %s: %v", filepath.Dir(dstPath), err)
+ }
+ w, err := os.Create(dstPath)
+ if err != nil {
+ t.Fatalf("error creating file %s: %v", dstPath, err)
+ }
+ if _, err := io.Copy(w, r); err != nil {
+ w.Close()
+ t.Fatalf("error writing file %s: %v", dstPath, err)
+ }
+ if err := w.Close(); err != nil {
+ t.Fatalf("error closing file %s: %v", dstPath, err)
+ }
+ }
+
+ checkPath(t, dir, files)
+}
+
+func TestNoDataPath(t *testing.T) {
+ if nodataPath == "" {
+ t.Fatal("-nodata_path not set")
+ }
+ files := []string{
+ "extra.txt",
+ "src/example.com/repo/pkg/lib/lib.go",
+ "-src/example.com/repo/pkg/lib/data.txt",
+ }
+ checkPath(t, nodataPath, files)
+}
+
+func TestNoTransitivePath(t *testing.T) {
+ if notransitivePath == "" {
+ t.Fatal("-notransitive_path not set")
+ }
+ files := []string{
+ "-src/example.com/repo/pkg/lib/transitive/transitive.go",
+ }
+ checkPath(t, notransitivePath, files)
+}
+
+// checkPath checks that dir contains a list of files. files is a list of
+// slash-separated paths relative to dir. Files that start with "-" should be
+// absent. Files that end with "/" should be directories.
+func checkPath(t *testing.T, dir string, files []string) {
+ if strings.HasPrefix(dir, "external") {
+ dir = filepath.Join(os.Getenv("TEST_SRCDIR"), strings.TrimPrefix(dir, "external/"))
+ }
+
+ for _, f := range files {
+ wantDir := strings.HasSuffix(f, "/")
+ wantAbsent := false
+ if strings.HasPrefix(f, "-") {
+ f = f[1:]
+ wantAbsent = true
+ }
+ path := filepath.Join(dir, filepath.FromSlash(f))
+ st, err := os.Stat(path)
+ if wantAbsent {
+ if err == nil {
+ t.Errorf("found %s: should not be present", path)
+ } else if !os.IsNotExist(err) {
+ t.Error(err)
+ }
+ } else {
+ if err != nil {
+ if os.IsNotExist(err) {
+ t.Errorf("%s is missing", path)
+ } else {
+ t.Error(err)
+ }
+ continue
+ }
+ if st.IsDir() && !wantDir {
+ t.Errorf("%s: got directory; wanted file", path)
+ } else if !st.IsDir() && wantDir {
+ t.Errorf("%s: got file; wanted directory", path)
+ }
+ }
+ }
+}
diff --git a/tests/core/go_path/pkg/lib/BUILD.bazel b/tests/core/go_path/pkg/lib/BUILD.bazel
new file mode 100644
index 00000000..68f7c0b4
--- /dev/null
+++ b/tests/core/go_path/pkg/lib/BUILD.bazel
@@ -0,0 +1,80 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+load("@bazel_skylib//rules:copy_file.bzl", "copy_file")
+load(":generated_embeded.bzl", "generated_embeded")
+
+go_library(
+ name = "go_default_library",
+ srcs = ["lib.go"],
+ cgo = True,
+ data = [
+ "data.txt",
+ "testdata/testdata.txt",
+ ],
+ embedsrcs = [
+ "embedded_src.txt",
+ "renamed_embedded_src.txt",
+ "template/index.html.tmpl",
+ ],
+ importpath = "example.com/repo/pkg/lib",
+ visibility = ["//visibility:public"],
+ deps = [":transitive_lib"],
+)
+
+copy_file(
+ name = "rename_embedded_src.txt",
+ src = ":embedded_src.txt",
+ out = "renamed_embedded_src.txt",
+)
+
+generated_embeded(
+ name = "generated_embeded",
+ srcs = ["embed_test.go"],
+ embedsrcs = ["embedded_src.txt"],
+ importpath = "lib",
+ visibility = ["//visibility:public"],
+)
+
+generated_embeded(
+ name = "generated_embeded_no_srcs",
+ embedsrcs = ["embedded_src.txt"],
+ importpath = "lib",
+ visibility = ["//visibility:public"],
+)
+
+go_test(
+ name = "go_default_test",
+ srcs = [
+ "external_test.go",
+ "internal_test.go",
+ ],
+ importpath = "example.com/repo/pkg/lib",
+ visibility = ["//visibility:public"],
+)
+
+go_test(
+ name = "embed_test",
+ embed = [":embed_lib"],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "embed_lib",
+ srcs = ["embed_test.go"],
+ importpath = "example.com/repo/pkg/lib",
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "vendored",
+ srcs = ["vendored.go"],
+ importmap = "example.com/repo/vendor/example.com/repo2",
+ importpath = "example.com/repo2",
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "transitive_lib",
+ srcs = ["transitive.go"],
+ importpath = "example.com/repo/pkg/lib/transitive",
+ visibility = ["//visibility:public"],
+)
diff --git a/tests/core/go_path/pkg/lib/data.txt b/tests/core/go_path/pkg/lib/data.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_path/pkg/lib/data.txt
diff --git a/tests/core/go_path/pkg/lib/embed_test.go b/tests/core/go_path/pkg/lib/embed_test.go
new file mode 100644
index 00000000..55c21f80
--- /dev/null
+++ b/tests/core/go_path/pkg/lib/embed_test.go
@@ -0,0 +1 @@
+package lib
diff --git a/tests/core/go_path/pkg/lib/embedded_src.txt b/tests/core/go_path/pkg/lib/embedded_src.txt
new file mode 100644
index 00000000..257cc564
--- /dev/null
+++ b/tests/core/go_path/pkg/lib/embedded_src.txt
@@ -0,0 +1 @@
+foo
diff --git a/tests/core/go_path/pkg/lib/external_test.go b/tests/core/go_path/pkg/lib/external_test.go
new file mode 100644
index 00000000..df64f213
--- /dev/null
+++ b/tests/core/go_path/pkg/lib/external_test.go
@@ -0,0 +1 @@
+package lib_test
diff --git a/tests/core/go_path/pkg/lib/generated_embeded.bzl b/tests/core/go_path/pkg/lib/generated_embeded.bzl
new file mode 100644
index 00000000..42bcf595
--- /dev/null
+++ b/tests/core/go_path/pkg/lib/generated_embeded.bzl
@@ -0,0 +1,71 @@
+# Copyright 2018 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load(
+ "@io_bazel_rules_go//go:def.bzl",
+ "go_context",
+)
+
+def _gen_library_impl(ctx):
+ go = go_context(ctx)
+ libname = getattr(ctx.attr, "libname")
+ src = go.actions.declare_file(ctx.label.name + ".go")
+
+ embedsrcs = getattr(ctx.attr, "embedsrcs", [])
+
+ lines = [
+ "package " + libname,
+ "",
+ 'import _ "embed"',
+ "",
+ ]
+
+ i = 0
+ for e in embedsrcs:
+ for f in e.files.to_list():
+ lines.extend([
+ "//go:embed {}".format(f.basename),
+ "var embeddedSource{} string".format(i),
+ ])
+ i += 1
+
+ ctx.actions.write(src, "\n".join(lines))
+
+ library = go.new_library(go, srcs = [src])
+ source = go.library_to_source(go, ctx.attr, library, ctx.coverage_instrumented())
+ archive = go.archive(go, source)
+ return [
+ library,
+ source,
+ archive,
+ DefaultInfo(files = depset([archive.data.file])),
+ ]
+
+generated_embeded = rule(
+ _gen_library_impl,
+ attrs = {
+ "importpath": attr.string(mandatory = True),
+ "_go_context_data": attr.label(
+ default = "//:go_context_data",
+ ),
+ "srcs": attr.label_list(
+ allow_files = True,
+ ),
+ "embedsrcs": attr.label_list(
+ allow_files = True,
+ ),
+ "libname": attr.string(default = "lib"),
+ },
+ toolchains = ["@io_bazel_rules_go//go:toolchain"],
+)
diff --git a/tests/core/go_path/pkg/lib/internal_test.go b/tests/core/go_path/pkg/lib/internal_test.go
new file mode 100644
index 00000000..55c21f80
--- /dev/null
+++ b/tests/core/go_path/pkg/lib/internal_test.go
@@ -0,0 +1 @@
+package lib
diff --git a/tests/core/go_path/pkg/lib/lib.go b/tests/core/go_path/pkg/lib/lib.go
new file mode 100644
index 00000000..1434db9f
--- /dev/null
+++ b/tests/core/go_path/pkg/lib/lib.go
@@ -0,0 +1,15 @@
+package lib
+
+import (
+ "C"
+ _ "embed" // for go:embed
+)
+
+//go:embed embedded_src.txt
+var embeddedSource string
+
+//go:embed renamed_embedded_src.txt
+var renamedEmbeddedSource string
+
+//go:embed template/index.html.tmpl
+var indexTmpl string
diff --git a/tests/core/go_path/pkg/lib/template/index.html.tmpl b/tests/core/go_path/pkg/lib/template/index.html.tmpl
new file mode 100644
index 00000000..68a09ae6
--- /dev/null
+++ b/tests/core/go_path/pkg/lib/template/index.html.tmpl
@@ -0,0 +1 @@
+{{ .Content }}
diff --git a/tests/core/go_path/pkg/lib/testdata/testdata.txt b/tests/core/go_path/pkg/lib/testdata/testdata.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_path/pkg/lib/testdata/testdata.txt
diff --git a/tests/core/go_path/pkg/lib/transitive.go b/tests/core/go_path/pkg/lib/transitive.go
new file mode 100644
index 00000000..a505a296
--- /dev/null
+++ b/tests/core/go_path/pkg/lib/transitive.go
@@ -0,0 +1,5 @@
+package transitive
+
+var (
+ _ = ""
+)
diff --git a/tests/core/go_path/pkg/lib/vendored.go b/tests/core/go_path/pkg/lib/vendored.go
new file mode 100644
index 00000000..2355022f
--- /dev/null
+++ b/tests/core/go_path/pkg/lib/vendored.go
@@ -0,0 +1 @@
+package vendored
diff --git a/tests/core/go_plugin/BUILD.bazel b/tests/core/go_plugin/BUILD.bazel
new file mode 100644
index 00000000..ce07189d
--- /dev/null
+++ b/tests/core/go_plugin/BUILD.bazel
@@ -0,0 +1,16 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_test")
+
+test_suite(name = "go_plugin")
+
+go_test(
+ name = "go_default_test",
+ srcs = ["all_test.go"],
+ data = [":plugin"],
+)
+
+go_binary(
+ name = "plugin",
+ srcs = ["plugin.go"],
+ out = "plugin.so",
+ linkmode = "plugin",
+)
diff --git a/tests/core/go_plugin/README.rst b/tests/core/go_plugin/README.rst
new file mode 100644
index 00000000..55b0e295
--- /dev/null
+++ b/tests/core/go_plugin/README.rst
@@ -0,0 +1,16 @@
+Basic -buildmode=plugin functionality
+=====================================
+
+.. _go_binary: /docs/go/core/rules.md#_go_binary
+
+Tests to ensure the basic features of go_binary with linkmode="plugin" are
+working as expected.
+
+all_test
+--------
+
+1. Test that a go_binary_ rule can write its shared object file with a custom
+ name in the package directory (not the mode directory).
+
+2. Test that a plugin built using a go_binary_ rule can be loaded by a Go
+ program and that its symbols are working as expected.
diff --git a/tests/core/go_plugin/all_test.go b/tests/core/go_plugin/all_test.go
new file mode 100644
index 00000000..d74738b5
--- /dev/null
+++ b/tests/core/go_plugin/all_test.go
@@ -0,0 +1,33 @@
+package main_test
+
+import (
+ "os"
+ "plugin"
+ "testing"
+)
+
+const HelloWorld = "Hello, world!"
+
+func TestPluginCreated(t *testing.T) {
+ _, err := os.Stat("plugin.so")
+ if err != nil {
+ t.Error(err)
+ }
+}
+
+func TestPluginWorks(t *testing.T) {
+ p, err := plugin.Open("plugin.so")
+ if err != nil {
+ t.Error(err)
+ }
+
+ f, err := p.Lookup("Hi")
+ if err != nil {
+ t.Error(err)
+ }
+
+ helloWorld := f.(func() string)()
+ if helloWorld != HelloWorld {
+ t.Errorf("expected %#v, got %#v", HelloWorld, helloWorld)
+ }
+}
diff --git a/tests/core/go_plugin/plugin.go b/tests/core/go_plugin/plugin.go
new file mode 100644
index 00000000..b7db8d2a
--- /dev/null
+++ b/tests/core/go_plugin/plugin.go
@@ -0,0 +1,7 @@
+package main
+
+const HelloWorld = "Hello, world!"
+
+func Hi() string { return HelloWorld }
+
+func main() {}
diff --git a/tests/core/go_plugin_with_proto_library/BUILD.bazel b/tests/core/go_plugin_with_proto_library/BUILD.bazel
new file mode 100644
index 00000000..468d8b35
--- /dev/null
+++ b/tests/core/go_plugin_with_proto_library/BUILD.bazel
@@ -0,0 +1,31 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_test")
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+
+test_suite(name = "go_plugin_with_proto_library")
+
+go_test(
+ name = "go_default_test",
+ srcs = ["all_test.go"],
+ data = [":plugin"],
+ deps = [":validate"],
+)
+
+go_binary(
+ name = "plugin",
+ srcs = ["plugin.go"],
+ out = "plugin.so",
+ linkmode = "plugin",
+ deps = [":validate"],
+)
+
+proto_library(
+ name = "validate_proto",
+ srcs = ["validate.proto"],
+)
+
+go_proto_library(
+ name = "validate",
+ gc_goopts = ["-trimpath=$(BINDIR)=>."],
+ importpath = "go_plugin_with_proto_library/validate",
+ proto = ":validate_proto",
+)
diff --git a/tests/core/go_plugin_with_proto_library/README.rst b/tests/core/go_plugin_with_proto_library/README.rst
new file mode 100644
index 00000000..437a2cd9
--- /dev/null
+++ b/tests/core/go_plugin_with_proto_library/README.rst
@@ -0,0 +1,16 @@
+Go Plugin supporting protobufs
+==============================
+
+.. _go_binary: /go/core.rst#_go_binary
+
+Tests to ensure a protobuf can be included into a plugin and host.
+
+all_test
+--------
+
+1. Test that a go_binary_ rule can write its shared object file with a custom
+ name in the package directory (not the mode directory) when the plugin
+ depends on a protobuf.
+
+2. Test that a plugin with a protobuf dependency built using a go_binary_ rule
+ can be loaded by a Go program and that its symbols are working as expected.
diff --git a/tests/core/go_plugin_with_proto_library/all_test.go b/tests/core/go_plugin_with_proto_library/all_test.go
new file mode 100644
index 00000000..c09c6ef7
--- /dev/null
+++ b/tests/core/go_plugin_with_proto_library/all_test.go
@@ -0,0 +1,36 @@
+package main_test
+
+import (
+ "go_plugin_with_proto_library/validate"
+ "os"
+ "plugin"
+ "testing"
+)
+
+const RuleName = "test"
+
+func TestPluginCreated(t *testing.T) {
+ _, err := os.Stat("plugin.so")
+ if err != nil {
+ t.Error(err)
+ }
+}
+
+func TestPluginWorks(t *testing.T) {
+ p, err := plugin.Open("plugin.so")
+ if err != nil {
+ t.Error(err)
+ return
+ }
+
+ symProto, err := p.Lookup("SomeProto")
+ if err != nil {
+ t.Error(err)
+ return
+ }
+
+ proto := symProto.(*validate.MessageRules)
+ if *proto.Name != RuleName {
+ t.Errorf("expected %#v, got %#v", RuleName, proto.Name)
+ }
+}
diff --git a/tests/core/go_plugin_with_proto_library/plugin.go b/tests/core/go_plugin_with_proto_library/plugin.go
new file mode 100644
index 00000000..7197a140
--- /dev/null
+++ b/tests/core/go_plugin_with_proto_library/plugin.go
@@ -0,0 +1,7 @@
+package main
+
+import "go_plugin_with_proto_library/validate"
+
+var testValue = "test"
+
+var SomeProto = validate.MessageRules{Name: &testValue}
diff --git a/tests/core/go_plugin_with_proto_library/validate.proto b/tests/core/go_plugin_with_proto_library/validate.proto
new file mode 100644
index 00000000..759e8726
--- /dev/null
+++ b/tests/core/go_plugin_with_proto_library/validate.proto
@@ -0,0 +1,6 @@
+syntax = "proto2";
+package validate;
+
+message MessageRules {
+ required string name = 1;
+}
diff --git a/tests/core/go_proto_library/BUILD.bazel b/tests/core/go_proto_library/BUILD.bazel
new file mode 100644
index 00000000..0c1f8e23
--- /dev/null
+++ b/tests/core/go_proto_library/BUILD.bazel
@@ -0,0 +1,314 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
+
+# Common rules
+proto_library(
+ name = "foo_proto",
+ srcs = ["foo.proto"],
+)
+
+go_proto_library(
+ name = "foo_go_proto",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/foo",
+ proto = ":foo_proto",
+)
+
+proto_library(
+ name = "bar_proto",
+ srcs = ["bar.proto"],
+ deps = [":foo_proto"],
+)
+
+go_proto_library(
+ name = "bar_go_proto",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/bar",
+ proto = ":bar_proto",
+ deps = [":foo_go_proto"],
+)
+
+proto_library(
+ name = "grpc_proto",
+ srcs = ["grpc.proto"],
+)
+
+# embed_test
+go_proto_library(
+ name = "embed_go_proto",
+ embed = [":extra_lib"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/foo",
+ proto = ":foo_proto",
+)
+
+go_library(
+ name = "extra_lib",
+ srcs = ["extra.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/foo",
+)
+
+go_test(
+ name = "embed_test",
+ srcs = ["embed_test.go"],
+ deps = [
+ ":embed_go_proto",
+ "@com_github_golang_protobuf//proto:go_default_library",
+ ],
+)
+
+# transitive_test
+go_proto_library(
+ name = "transitive_go_proto",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/bar",
+ proto = ":bar_proto",
+ deps = [":wrap_lib"],
+)
+
+go_library(
+ name = "wrap_lib",
+ srcs = ["extra.go"],
+ embed = [":foo_go_proto"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/foo",
+)
+
+go_test(
+ name = "transitive_test",
+ srcs = ["transitive_test.go"],
+ deps = [
+ ":transitive_go_proto",
+ ":wrap_lib",
+ ],
+)
+
+# proxy_test
+go_test(
+ name = "proxy_test",
+ srcs = ["proxy_test.go"],
+ deps = [":proxy_go_proto"],
+)
+
+go_proto_library(
+ name = "proxy_go_proto",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/proxy",
+ proto = ":proxy_proto",
+)
+
+proto_library(
+ name = "proxy_proto",
+ deps = [
+ ":proxy_a_proto",
+ ":proxy_b_proto",
+ ],
+)
+
+proto_library(
+ name = "proxy_a_proto",
+ srcs = ["proxy_a.proto"],
+)
+
+proto_library(
+ name = "proxy_b_proto",
+ srcs = ["proxy_b.proto"],
+)
+
+# protos_test (multiple entries in protos argument)
+go_test(
+ name = "protos_test",
+ srcs = ["protos_test.go"],
+ deps = [":protos_go_proto"],
+)
+
+go_test(
+ name = "protos_alias_test",
+ srcs = ["protos_alias_test.go"],
+ deps = [":protos_go_proto"],
+)
+
+go_proto_library(
+ name = "protos_go_proto",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/protos",
+ importpath_aliases = ["myalias/protos"],
+ protos = [
+ ":protos_a_proto",
+ ":protos_b_proto",
+ ],
+)
+
+proto_library(
+ name = "protos_a_proto",
+ srcs = ["protos_a.proto"],
+)
+
+proto_library(
+ name = "protos_b_proto",
+ srcs = ["protos_b.proto"],
+)
+
+# gofast test
+go_test(
+ name = "gofast_test",
+ srcs = ["gofast_test.go"],
+ deps = [":gofast_proto"],
+)
+
+go_proto_library(
+ name = "gofast_proto",
+ compilers = ["@io_bazel_rules_go//proto:gofast_proto"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/foo",
+ protos = [":foo_proto"],
+)
+
+# gofast gRPC test
+go_test(
+ name = "gofast_grpc_test",
+ srcs = ["gofast_grpc_test.go"],
+ deps = [":gofast_grpc"],
+)
+
+go_proto_library(
+ name = "gofast_grpc",
+ compilers = ["@io_bazel_rules_go//proto:gofast_grpc"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/grpc",
+ protos = [":grpc_proto"],
+)
+
+# gogofast test
+go_test(
+ name = "gogofast_test",
+ srcs = ["gogofast_test.go"],
+ deps = [":gogofast_proto"],
+)
+
+go_proto_library(
+ name = "gogofast_proto",
+ compilers = ["@io_bazel_rules_go//proto:gogofast_proto"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/foo",
+ protos = [":foo_proto"],
+)
+
+# gogofast gRPC test
+go_test(
+ name = "gogofast_grpc_test",
+ srcs = ["gogofast_grpc_test.go"],
+ deps = [":gogofast_grpc"],
+)
+
+go_proto_library(
+ name = "gogofast_grpc",
+ compilers = ["@io_bazel_rules_go//proto:gogofast_grpc"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/grpc",
+ protos = [":grpc_proto"],
+)
+
+# adjusted_import_test
+# TODO(#1851): uncomment when Bazel 0.22.0 is the minimum version.
+# go_test(
+# name = "adjusted_import_test",
+# srcs = ["adjusted_import_test.go"],
+# deps = [
+# ":adjusted_a_go_proto",
+# ":adjusted_b_go_library",
+# ":adjusted_c_go_proto",
+# ],
+# )
+
+# go_proto_library(
+# name = "adjusted_a_go_proto",
+# importpath = "adjusted/a",
+# proto = "adjusted_a_proto",
+# deps = [
+# ":adjusted_b_go_library",
+# ":adjusted_c_go_proto",
+# ],
+# )
+
+# proto_library(
+# name = "adjusted_a_proto",
+# srcs = ["adjusted_a.proto"],
+# import_prefix = "adjusted",
+# strip_import_prefix = "",
+# deps = [
+# ":adjusted_b_proto",
+# ":adjusted_c_proto",
+# ],
+# )
+
+# go_library(
+# name = "adjusted_b_go_library",
+# embed = [":adjusted_b_go_proto"],
+# importpath = "adjusted/b",
+# )
+
+# go_proto_library(
+# name = "adjusted_b_go_proto",
+# importpath = "adjusted/b",
+# proto = "adjusted_b_proto",
+# deps = [":adjusted_c_go_proto"],
+# )
+
+# proto_library(
+# name = "adjusted_b_proto",
+# srcs = ["adjusted_b.proto"],
+# import_prefix = "adjusted",
+# strip_import_prefix = "",
+# deps = [":adjusted_c_proto"],
+# )
+
+# go_proto_library(
+# name = "adjusted_c_go_proto",
+# importpath = "adjusted/c",
+# proto = ":adjusted_c_proto",
+# )
+
+# proto_library(
+# name = "adjusted_c_proto",
+# srcs = ["adjusted_c.proto"],
+# import_prefix = "adjusted",
+# strip_import_prefix = "",
+# )
+
+# proto_package_test
+proto_library(
+ name = "no_go_package_proto",
+ srcs = ["no_go_package.proto"],
+)
+
+go_proto_library(
+ name = "no_go_package_go_proto",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/package_name_derived_from_importpath",
+ protos = [":no_go_package_proto"],
+)
+
+go_test(
+ name = "proto_package_test",
+ srcs = ["proto_package_test.go"],
+ deps = [":no_go_package_go_proto"],
+)
+
+go_test(
+ name = "wkt_wrapper_test",
+ srcs = ["wkt_wrapper_test.go"],
+ deps = [
+ "//proto/wkt:any_go_proto",
+ "//proto/wkt:compiler_plugin_go_proto",
+ "//proto/wkt:descriptor_go_proto",
+ "//proto/wkt:duration_go_proto",
+ "//proto/wkt:empty_go_proto",
+ "//proto/wkt:field_mask_go_proto",
+ "//proto/wkt:source_context_go_proto",
+ "//proto/wkt:struct_go_proto",
+ "//proto/wkt:timestamp_go_proto",
+ "//proto/wkt:type_go_proto",
+ "//proto/wkt:wrappers_go_proto",
+ "@org_golang_google_protobuf//types/descriptorpb:go_default_library",
+ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
+ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
+ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
+ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
+ "@org_golang_google_protobuf//types/known/sourcecontextpb:go_default_library",
+ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
+ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
+ "@org_golang_google_protobuf//types/known/typepb:go_default_library",
+ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
+ "@org_golang_google_protobuf//types/pluginpb:go_default_library",
+ ],
+)
diff --git a/tests/core/go_proto_library/README.rst b/tests/core/go_proto_library/README.rst
new file mode 100644
index 00000000..7696102a
--- /dev/null
+++ b/tests/core/go_proto_library/README.rst
@@ -0,0 +1,65 @@
+Basic go_proto_library functionality
+====================================
+
+.. _go_proto_library: /proto/core.rst#_go_proto_library
+.. _go_library: /docs/go/core/rules.md#_go_library
+.. _protobuf v1.26.0: https://github.com/protocolbuffers/protobuf-go/releases/tag/v1.26.0
+.. _#1422: https://github.com/bazelbuild/rules_go/issues/1422
+.. _#1596: https://github.com/bazelbuild/rules_go/issues/1596
+
+Tests to ensure the basic features of `go_proto_library`_ are working.
+
+.. contents::
+
+embed_test
+----------
+
+Checks that `go_proto_library`_ can embed rules that provide `GoLibrary`_.
+
+transitive_test
+---------------
+
+Checks that `go_proto_library`_ can import a proto dependency that is
+embedded in a `go_library`_. Verifies `#1422`_.
+
+adjusted_import_test
+--------------------
+
+Checks that `go_proto_library`_ can build ``proto_library`` with
+``import_prefix`` and ``strip_import_prefix``.
+
+gofast_test and gofast_grpc_test
+--------------------------------
+
+Checks that the gogo `gofast` compiler plugins build and link. In
+particular, these plugins only depoend on `github.com/golang/protobuf`.
+
+gogofast_test and gogofast_grpc_test
+------------------------------------
+
+Checks that the `gogofast` compiler plugins build and link. In
+particular, these plugins depend on both `github.com/gogo/protobuf`
+and `github.com/golang/protobuf`.
+
+proto_package_test
+------------------
+
+Checks that `go_proto_library`_ generates files with a package name based on
+``importpath``, not the proto package, when ``option go_package`` is not given.
+This changed in `protobuf v1.26.0`_: the import path must either be specified
+with an ``option go_package`` in each proto file or with an ``M`` flag passed
+in from ``go_proto_library``. Previously, the Go package name was derived from
+the proto package name. Previously verified `#1596`_.
+
+wkt_wrapper_test
+----------------
+
+Checks that most of the well known types in ``//proto/wkt`` are wrappers
+for packages in ``@org_golang_google_protobuf``. The proto types should be
+type aliases.
+
+protos_alias_test
+-----------------
+
+Checks that packages generated by `go_proto_library` can be imported using one of the strings
+listed in ``importpath_aliases``.
diff --git a/tests/core/go_proto_library/adjusted_a.proto b/tests/core/go_proto_library/adjusted_a.proto
new file mode 100644
index 00000000..d5538346
--- /dev/null
+++ b/tests/core/go_proto_library/adjusted_a.proto
@@ -0,0 +1,11 @@
+syntax = "proto3";
+
+import "adjusted/adjusted_b.proto";
+import "adjusted/adjusted_c.proto";
+
+package adjusted.a;
+
+message A {
+ adjusted.b.B x = 1;
+ adjusted.c.C y = 2;
+}
diff --git a/tests/core/go_proto_library/adjusted_b.proto b/tests/core/go_proto_library/adjusted_b.proto
new file mode 100644
index 00000000..e7828b84
--- /dev/null
+++ b/tests/core/go_proto_library/adjusted_b.proto
@@ -0,0 +1,9 @@
+syntax = "proto3";
+
+import "adjusted/adjusted_c.proto";
+
+package adjusted.b;
+
+message B {
+ adjusted.c.C b = 1;
+}
diff --git a/tests/core/go_proto_library/adjusted_c.proto b/tests/core/go_proto_library/adjusted_c.proto
new file mode 100644
index 00000000..500144c1
--- /dev/null
+++ b/tests/core/go_proto_library/adjusted_c.proto
@@ -0,0 +1,7 @@
+syntax = "proto3";
+
+package adjusted.c;
+
+message C {
+ int64 c = 1;
+}
diff --git a/tests/core/go_proto_library/adjusted_import_test.go b/tests/core/go_proto_library/adjusted_import_test.go
new file mode 100644
index 00000000..6c2856c5
--- /dev/null
+++ b/tests/core/go_proto_library/adjusted_import_test.go
@@ -0,0 +1,31 @@
+/* Copyright 2018 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package adjusted_import_test
+
+import (
+ "testing"
+
+ a "adjusted/a"
+ b "adjusted/b"
+ c "adjusted/c"
+)
+
+func use(interface{}) {}
+
+func TestAdjusted(t *testing.T) {
+ // just make sure types exist
+ use(a.A{X: &b.B{B: &c.C{C: 1}}, Y: &c.C{C: 1}})
+}
diff --git a/tests/core/go_proto_library/bar.proto b/tests/core/go_proto_library/bar.proto
new file mode 100644
index 00000000..6d945edf
--- /dev/null
+++ b/tests/core/go_proto_library/bar.proto
@@ -0,0 +1,10 @@
+syntax = "proto3";
+
+package tests.core.go_proto_library.bar;
+option go_package = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/bar";
+
+import "tests/core/go_proto_library/foo.proto";
+
+message Bar {
+ tests.core.go_proto_library.foo.Foo value = 1;
+}
diff --git a/tests/core/go_proto_library/embed_test.go b/tests/core/go_proto_library/embed_test.go
new file mode 100644
index 00000000..2ba1dad4
--- /dev/null
+++ b/tests/core/go_proto_library/embed_test.go
@@ -0,0 +1,45 @@
+/* Copyright 2018 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package embed_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/core/go_proto_library/foo"
+ "github.com/golang/protobuf/proto"
+)
+
+func TestProto(t *testing.T) {
+ x := foo.Foo{Value: 42}
+ data, err := proto.Marshal(&x)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var y foo.Foo
+ err = proto.Unmarshal(data, &y)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if y.Value != x.Value {
+ t.Errorf("got {x = %d}; want {x = %d}", y.Value, x.Value)
+ }
+}
+
+func TestExtra(t *testing.T) {
+ if got, want := foo.Extra(), 42; got != want {
+ t.Errorf("got %d; want %d", got, want)
+ }
+}
diff --git a/tests/core/go_proto_library/extra.go b/tests/core/go_proto_library/extra.go
new file mode 100644
index 00000000..d27cddc8
--- /dev/null
+++ b/tests/core/go_proto_library/extra.go
@@ -0,0 +1,5 @@
+package foo
+
+func Extra() int {
+ return 42
+}
diff --git a/tests/core/go_proto_library/foo.proto b/tests/core/go_proto_library/foo.proto
new file mode 100644
index 00000000..1f164661
--- /dev/null
+++ b/tests/core/go_proto_library/foo.proto
@@ -0,0 +1,8 @@
+syntax = "proto3";
+
+package tests.core.go_proto_library.foo;
+option go_package = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/foo";
+
+message Foo {
+ int64 value = 1;
+}
diff --git a/tests/core/go_proto_library/gofast_grpc_test.go b/tests/core/go_proto_library/gofast_grpc_test.go
new file mode 100644
index 00000000..aeb4d5e7
--- /dev/null
+++ b/tests/core/go_proto_library/gofast_grpc_test.go
@@ -0,0 +1,32 @@
+/* Copyright 2019 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package gofast_grpc_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/core/go_proto_library/grpc"
+)
+
+func use(interface{}) {}
+
+func TestGoFastGrpc(t *testing.T) {
+ // just make sure types and generated functions exist
+ use(grpc.RPCServer(nil))
+ use(grpc.RPCClient(nil))
+ (&grpc.HelloRequest{}).Marshal()
+ (&grpc.HelloReply{}).Marshal()
+}
diff --git a/tests/core/go_proto_library/gofast_test.go b/tests/core/go_proto_library/gofast_test.go
new file mode 100644
index 00000000..3fbfc54b
--- /dev/null
+++ b/tests/core/go_proto_library/gofast_test.go
@@ -0,0 +1,30 @@
+/* Copyright 2019 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package gofast_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/core/go_proto_library/foo"
+)
+
+func use(interface{}) {}
+
+func TestGoFast(t *testing.T) {
+ // just make sure types and generated functions exist
+ use(foo.Foo{Value: 42})
+ (&foo.Foo{}).Marshal()
+}
diff --git a/tests/core/go_proto_library/gogofast_grpc_test.go b/tests/core/go_proto_library/gogofast_grpc_test.go
new file mode 100644
index 00000000..0cf08e44
--- /dev/null
+++ b/tests/core/go_proto_library/gogofast_grpc_test.go
@@ -0,0 +1,32 @@
+/* Copyright 2019 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package gogofast_grpc_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/core/go_proto_library/grpc"
+)
+
+func use(interface{}) {}
+
+func TestGoGoFastGrpc(t *testing.T) {
+ // just make sure types and generated functions exist
+ use(grpc.RPCServer(nil))
+ use(grpc.RPCClient(nil))
+ (&grpc.HelloRequest{}).Marshal()
+ (&grpc.HelloReply{}).Marshal()
+}
diff --git a/tests/core/go_proto_library/gogofast_test.go b/tests/core/go_proto_library/gogofast_test.go
new file mode 100644
index 00000000..ee1d9fdf
--- /dev/null
+++ b/tests/core/go_proto_library/gogofast_test.go
@@ -0,0 +1,30 @@
+/* Copyright 2019 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package gogofast_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/core/go_proto_library/foo"
+)
+
+func use(interface{}) {}
+
+func TestGoGoFast(t *testing.T) {
+ // just make sure types and generated functions exist
+ use(foo.Foo{Value: 42})
+ (&foo.Foo{}).Marshal()
+}
diff --git a/tests/core/go_proto_library/grpc.proto b/tests/core/go_proto_library/grpc.proto
new file mode 100644
index 00000000..fd50d217
--- /dev/null
+++ b/tests/core/go_proto_library/grpc.proto
@@ -0,0 +1,14 @@
+syntax = "proto3";
+
+package tests.core.go_proto_library.grpc;
+option go_package = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/grpc";
+
+message HelloRequest {
+}
+
+message HelloReply {
+}
+
+service RPC {
+ rpc Hello (HelloRequest) returns (HelloReply) {}
+}
diff --git a/tests/core/go_proto_library/no_go_package.proto b/tests/core/go_proto_library/no_go_package.proto
new file mode 100644
index 00000000..e3112c56
--- /dev/null
+++ b/tests/core/go_proto_library/no_go_package.proto
@@ -0,0 +1,7 @@
+syntax = "proto3";
+
+package protopkg;
+
+message Foo {
+ int64 x = 1;
+}
diff --git a/tests/core/go_proto_library/proto_package_test.go b/tests/core/go_proto_library/proto_package_test.go
new file mode 100644
index 00000000..81d66174
--- /dev/null
+++ b/tests/core/go_proto_library/proto_package_test.go
@@ -0,0 +1,28 @@
+/* Copyright 2019 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package proto_package_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/core/go_proto_library/package_name_derived_from_importpath"
+)
+
+func use(interface{}) {}
+
+func TestNoGoPackage(t *testing.T) {
+ use(&package_name_derived_from_importpath.Foo{})
+}
diff --git a/tests/core/go_proto_library/protos_a.proto b/tests/core/go_proto_library/protos_a.proto
new file mode 100644
index 00000000..7b64d52b
--- /dev/null
+++ b/tests/core/go_proto_library/protos_a.proto
@@ -0,0 +1,7 @@
+syntax = "proto3";
+
+option go_package = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/protos";
+
+message A {
+ int64 a = 1;
+}
diff --git a/tests/core/go_proto_library/protos_alias_test.go b/tests/core/go_proto_library/protos_alias_test.go
new file mode 100644
index 00000000..17612765
--- /dev/null
+++ b/tests/core/go_proto_library/protos_alias_test.go
@@ -0,0 +1,29 @@
+/* Copyright 2020 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package protos_alias_test
+
+import (
+ "myalias/protos" // importing based on the alias import path
+ "testing"
+)
+
+func use(interface{}) {}
+
+func TestProtos(t *testing.T) {
+ // just make sure both types exist
+ use(protos.A{})
+ use(protos.B{})
+}
diff --git a/tests/core/go_proto_library/protos_b.proto b/tests/core/go_proto_library/protos_b.proto
new file mode 100644
index 00000000..21f81711
--- /dev/null
+++ b/tests/core/go_proto_library/protos_b.proto
@@ -0,0 +1,7 @@
+syntax = "proto3";
+
+option go_package = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/protos";
+
+message B {
+ int64 b = 1;
+}
diff --git a/tests/core/go_proto_library/protos_test.go b/tests/core/go_proto_library/protos_test.go
new file mode 100644
index 00000000..68083c27
--- /dev/null
+++ b/tests/core/go_proto_library/protos_test.go
@@ -0,0 +1,30 @@
+/* Copyright 2018 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package protos_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/core/go_proto_library/protos"
+)
+
+func use(interface{}) {}
+
+func TestProtos(t *testing.T) {
+ // just make sure both types exist
+ use(protos.A{})
+ use(protos.B{})
+}
diff --git a/tests/core/go_proto_library/proxy_a.proto b/tests/core/go_proto_library/proxy_a.proto
new file mode 100644
index 00000000..a3c88444
--- /dev/null
+++ b/tests/core/go_proto_library/proxy_a.proto
@@ -0,0 +1,7 @@
+syntax = "proto3";
+
+option go_package = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/proxy";
+
+message A {
+ int64 a = 1;
+}
diff --git a/tests/core/go_proto_library/proxy_b.proto b/tests/core/go_proto_library/proxy_b.proto
new file mode 100644
index 00000000..d65a239f
--- /dev/null
+++ b/tests/core/go_proto_library/proxy_b.proto
@@ -0,0 +1,7 @@
+syntax = "proto3";
+
+option go_package = "github.com/bazelbuild/rules_go/tests/core/go_proto_library/proxy";
+
+message B {
+ int64 b = 1;
+}
diff --git a/tests/core/go_proto_library/proxy_test.go b/tests/core/go_proto_library/proxy_test.go
new file mode 100644
index 00000000..2209462f
--- /dev/null
+++ b/tests/core/go_proto_library/proxy_test.go
@@ -0,0 +1,30 @@
+/* Copyright 2018 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package proxy_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/core/go_proto_library/proxy"
+)
+
+func use(interface{}) {}
+
+func TestProxy(t *testing.T) {
+ // just make sure both types exist
+ use(proxy.A{})
+ use(proxy.B{})
+}
diff --git a/tests/core/go_proto_library/transitive_test.go b/tests/core/go_proto_library/transitive_test.go
new file mode 100644
index 00000000..1b733afe
--- /dev/null
+++ b/tests/core/go_proto_library/transitive_test.go
@@ -0,0 +1,30 @@
+/* Copyright 2018 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package transitive_compiler_test
+
+import (
+ "testing"
+
+ bar "github.com/bazelbuild/rules_go/tests/core/go_proto_library/bar"
+ foo "github.com/bazelbuild/rules_go/tests/core/go_proto_library/foo"
+)
+
+func use(interface{}) {}
+
+func TestServices(t *testing.T) {
+ // just make sure both types exist
+ use(bar.Bar{Value: &foo.Foo{Value: 42}})
+}
diff --git a/tests/core/go_proto_library/wkt_wrapper_test.go b/tests/core/go_proto_library/wkt_wrapper_test.go
new file mode 100644
index 00000000..16228b04
--- /dev/null
+++ b/tests/core/go_proto_library/wkt_wrapper_test.go
@@ -0,0 +1,67 @@
+// Copyright 2020 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package wkt_wrapper_test
+
+import (
+ "testing"
+
+ descriptorpb1 "github.com/golang/protobuf/protoc-gen-go/descriptor"
+ pluginpb1 "github.com/golang/protobuf/protoc-gen-go/plugin"
+ anypb1 "github.com/golang/protobuf/ptypes/any"
+ durationpb1 "github.com/golang/protobuf/ptypes/duration"
+ emptypb1 "github.com/golang/protobuf/ptypes/empty"
+ structpb1 "github.com/golang/protobuf/ptypes/struct"
+ timestamppb1 "github.com/golang/protobuf/ptypes/timestamp"
+ wrapperspb1 "github.com/golang/protobuf/ptypes/wrappers"
+ field_mask1 "google.golang.org/genproto/protobuf/field_mask"
+ type1 "google.golang.org/genproto/protobuf/ptype"
+ source_context1 "google.golang.org/genproto/protobuf/source_context"
+ descriptorpb2 "google.golang.org/protobuf/types/descriptorpb"
+ anypb2 "google.golang.org/protobuf/types/known/anypb"
+ durationpb2 "google.golang.org/protobuf/types/known/durationpb"
+ emptypb2 "google.golang.org/protobuf/types/known/emptypb"
+ field_mask2 "google.golang.org/protobuf/types/known/fieldmaskpb"
+ source_context2 "google.golang.org/protobuf/types/known/sourcecontextpb"
+ structpb2 "google.golang.org/protobuf/types/known/structpb"
+ timestamppb2 "google.golang.org/protobuf/types/known/timestamppb"
+ type2 "google.golang.org/protobuf/types/known/typepb"
+ wrapperspb2 "google.golang.org/protobuf/types/known/wrapperspb"
+ pluginpb2 "google.golang.org/protobuf/types/pluginpb"
+)
+
+func Test(t *testing.T) {
+ var _ *anypb2.Any = (*anypb1.Any)(nil)
+ var _ *anypb1.Any = (*anypb2.Any)(nil)
+ var _ *pluginpb2.Version = (*pluginpb1.Version)(nil)
+ var _ *pluginpb1.Version = (*pluginpb2.Version)(nil)
+ var _ *descriptorpb2.DescriptorProto = (*descriptorpb1.DescriptorProto)(nil)
+ var _ *descriptorpb1.DescriptorProto = (*descriptorpb2.DescriptorProto)(nil)
+ var _ *durationpb2.Duration = (*durationpb1.Duration)(nil)
+ var _ *durationpb1.Duration = (*durationpb2.Duration)(nil)
+ var _ *emptypb2.Empty = (*emptypb1.Empty)(nil)
+ var _ *emptypb1.Empty = (*emptypb2.Empty)(nil)
+ var _ *field_mask1.FieldMask = (*field_mask2.FieldMask)(nil)
+ var _ *field_mask2.FieldMask = (*field_mask1.FieldMask)(nil)
+ var _ *source_context1.SourceContext = (*source_context2.SourceContext)(nil)
+ var _ *source_context2.SourceContext = (*source_context1.SourceContext)(nil)
+ var _ *structpb2.Struct = (*structpb1.Struct)(nil)
+ var _ *structpb1.Struct = (*structpb2.Struct)(nil)
+ var _ *timestamppb2.Timestamp = (*timestamppb1.Timestamp)(nil)
+ var _ *timestamppb1.Timestamp = (*timestamppb2.Timestamp)(nil)
+ var _ *type1.Type = (*type2.Type)(nil)
+ var _ *type2.Type = (*type1.Type)(nil)
+ var _ *wrapperspb2.BoolValue = (*wrapperspb1.BoolValue)(nil)
+ var _ *wrapperspb1.BoolValue = (*wrapperspb2.BoolValue)(nil)
+}
diff --git a/tests/core/go_proto_library_importmap/BUILD.bazel b/tests/core/go_proto_library_importmap/BUILD.bazel
new file mode 100644
index 00000000..e1695b9f
--- /dev/null
+++ b/tests/core/go_proto_library_importmap/BUILD.bazel
@@ -0,0 +1,21 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_test")
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
+
+proto_library(
+ name = "foo_proto",
+ srcs = ["foo.proto"],
+)
+
+go_proto_library(
+ name = "foo_go_proto",
+ importmap = "never/gonna/give/you/up",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_proto_library_importmap",
+ proto = ":foo_proto",
+)
+
+go_test(
+ name = "importmap_test",
+ srcs = ["importmap_test.go"],
+ deps = [":foo_go_proto"],
+)
diff --git a/tests/core/go_proto_library_importmap/README.rst b/tests/core/go_proto_library_importmap/README.rst
new file mode 100644
index 00000000..991f52f8
--- /dev/null
+++ b/tests/core/go_proto_library_importmap/README.rst
@@ -0,0 +1,8 @@
+go_proto_library importmap
+==========================
+
+importmap_test
+--------------
+
+Checks that the ``importmap`` attribute of ``go_proto_library`` works correctly.
+The test uses reflection information for a type in the generated file.
diff --git a/tests/core/go_proto_library_importmap/foo.proto b/tests/core/go_proto_library_importmap/foo.proto
new file mode 100644
index 00000000..b2bbe414
--- /dev/null
+++ b/tests/core/go_proto_library_importmap/foo.proto
@@ -0,0 +1,6 @@
+syntax = "proto3";
+
+option go_package = "github.com/bazelbuild/rules_go/tests/core/go_proto_library_importmap;foo";
+
+message Foo {
+};
diff --git a/tests/core/go_proto_library_importmap/importmap_test.go b/tests/core/go_proto_library_importmap/importmap_test.go
new file mode 100644
index 00000000..2ebbd815
--- /dev/null
+++ b/tests/core/go_proto_library_importmap/importmap_test.go
@@ -0,0 +1,16 @@
+package importmap_test
+
+import (
+ "reflect"
+ "testing"
+
+ foo "github.com/bazelbuild/rules_go/tests/core/go_proto_library_importmap"
+)
+
+func TestImportMap(t *testing.T) {
+ got := reflect.TypeOf(foo.Foo{}).PkgPath()
+ want := "never/gonna/give/you/up"
+ if got != want {
+ t.Errorf("got %q; want %q", got, want)
+ }
+}
diff --git a/tests/core/go_test/BUILD.bazel b/tests/core/go_test/BUILD.bazel
new file mode 100644
index 00000000..b77c851b
--- /dev/null
+++ b/tests/core/go_test/BUILD.bazel
@@ -0,0 +1,261 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+test_suite(
+ name = "go_test",
+)
+
+go_library(
+ name = "lib",
+ srcs = ["lib.go"],
+ cgo = True,
+ importpath = "lib",
+)
+
+go_test(
+ name = "internal_test",
+ size = "small",
+ srcs = ["internal_test.go"],
+ embed = [":lib"],
+ x_defs = {
+ "Got": "Internal",
+ "Expect": "Internal",
+ },
+)
+
+go_test(
+ name = "external_test",
+ size = "small",
+ srcs = ["external_test.go"],
+ embed = [":lib"],
+ x_defs = {
+ "Got": "External",
+ "Expect": "External",
+ },
+)
+
+go_test(
+ name = "combined_test",
+ size = "small",
+ srcs = [
+ "external_test.go",
+ "internal_test.go",
+ ],
+ embed = [":lib"],
+ x_defs = {
+ "Got": "Combined",
+ "Expect": "Combined",
+ },
+)
+
+go_test(
+ name = "flag_test",
+ size = "small",
+ srcs = [
+ "flag_test.go",
+ ],
+ args = [
+ "-aflag",
+ "somevalue",
+ ],
+)
+
+go_test(
+ name = "example_test",
+ size = "small",
+ srcs = ["example_test.go"],
+ embed = [":lib"],
+ x_defs = {
+ "Got": "Example",
+ "Expected": "Example",
+ },
+)
+
+go_test(
+ name = "only_testmain_test",
+ size = "small",
+ srcs = ["only_testmain_test.go"],
+)
+
+go_test(
+ name = "external_importmap_test",
+ size = "small",
+ srcs = ["external_importmap_test.go"],
+ embed = [":external_importmap_lib"],
+ deps = [":external_importmap_dep"],
+)
+
+go_library(
+ name = "external_importmap_lib",
+ srcs = ["external_importmap_lib.go"],
+ importmap = "x/github.com/bazelbuild/rules_go/tests/core/go_test/external_importmap",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/external_importmap",
+)
+
+go_library(
+ name = "external_importmap_dep",
+ srcs = ["external_importmap_dep.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/external_importmap_dep",
+ deps = [":external_importmap_lib"],
+)
+
+go_test(
+ name = "pwd_test",
+ size = "small",
+ srcs = ["pwd_test.go"],
+)
+
+go_test(
+ name = "data_test",
+ size = "small",
+ embed = [":data_test_lib"],
+)
+
+go_library(
+ name = "data_test_lib",
+ srcs = [":data_test_srcs"],
+ data = ["x"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/data_test",
+ deps = [":data_test_dep"],
+)
+
+filegroup(
+ name = "data_test_srcs",
+ srcs = ["data_test.go"],
+)
+
+go_library(
+ name = "data_test_dep",
+ srcs = ["data_test_dep.go"],
+ data = ["y"],
+ embed = [":data_test_embed"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/data_test_dep",
+)
+
+go_library(
+ name = "data_test_embed",
+ srcs = ["data_test_embed.go"],
+ data = ["z"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/data_test_dep",
+)
+
+go_bazel_test(
+ name = "test_fail_fast_test",
+ srcs = ["test_fail_fast_test.go"],
+)
+
+go_bazel_test(
+ name = "test_filter_test",
+ srcs = ["test_filter_test.go"],
+)
+
+go_bazel_test(
+ name = "xmlreport_test",
+ srcs = ["xmlreport_test.go"],
+)
+
+go_test(
+ name = "testmain_import_test",
+ srcs = [
+ "testmain_import_indirect_test.go",
+ "testmain_import_main_test.go",
+ ],
+ importpath = "example.com/imports/test_main",
+)
+
+go_test(
+ name = "tags_test",
+ srcs = [
+ "tags_bad_test.go",
+ "tags_good_test.go",
+ ],
+ gotags = ["good"],
+)
+
+go_test(
+ name = "indirect_import_test",
+ srcs = [
+ "indirect_import_i_test.go",
+ "indirect_import_x_test.go",
+ ],
+ embed = [":indirect_import_lib"],
+ deps = [":indirect_import_dep"],
+)
+
+go_library(
+ name = "indirect_import_lib",
+ srcs = ["indirect_import_lib.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/indirect_import",
+)
+
+go_library(
+ name = "indirect_import_dep",
+ srcs = ["indirect_import_dep.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/indirect_import_dep",
+ deps = [":indirect_import_lib"],
+)
+
+[
+ go_test(
+ name = "same_package_{}_test".format(i),
+ srcs = ["same_package_test.go"],
+ )
+ for i in range(1, 80)
+]
+
+test_suite(
+ name = "same_package_test",
+ tests = ["same_package_{}_test".format(i) for i in range(1, 80)],
+)
+
+go_bazel_test(
+ name = "testmain_without_exit_test",
+ srcs = ["testmain_without_exit_test.go"],
+)
+
+go_test(
+ name = "wrapper_test",
+ srcs = ["wrapper_test.go"],
+ args = ["$(location :wrapped_test)"],
+ data = [":wrapped_test"],
+ rundir = ".",
+)
+
+go_test(
+ name = "wrapped_test",
+ srcs = ["wrapped_test.go"],
+ tags = ["manual"],
+)
+
+go_test(
+ name = "fuzz_test",
+ srcs = ["fuzz_test.go"],
+)
+
+go_test(
+ name = "env_test",
+ srcs = ["env_test.go"],
+ data = ["@go_sdk//:lib/time/zoneinfo.zip"],
+ env = {
+ "ZONEINFO": "$(execpath @go_sdk//:lib/time/zoneinfo.zip)",
+ },
+ deps = [
+ "@io_bazel_rules_go//go/tools/bazel",
+ ],
+)
+
+go_test(
+ name = "sharding_test",
+ srcs = ["sharding_test.go"],
+ shard_count = 2,
+)
+
+go_bazel_test(
+ name = "env_inherit_test",
+ srcs = ["env_inherit_test.go"],
+)
+
+go_bazel_test(
+ name = "binary_env_test",
+ srcs = ["binary_env_test.go"],
+)
diff --git a/tests/core/go_test/README.rst b/tests/core/go_test/README.rst
new file mode 100644
index 00000000..176cf196
--- /dev/null
+++ b/tests/core/go_test/README.rst
@@ -0,0 +1,126 @@
+Basic go_test functionality
+===========================
+
+.. _go_test: /docs/go/core/rules.md#_go_test
+.. _#1877: https://github.com/bazelbuild/rules_go/issues/1877
+.. _#34129: https:////github.com/golang/go/issues/34129
+.. _#2749: https://github.com/bazelbuild/rules_go/issues/2749
+
+Tests to ensure that basic features of `go_test`_ are working as expected.
+
+.. contents::
+
+internal_test
+-------------
+
+Test that a `go_test`_ rule that adds white box tests to an embedded package works.
+This builds a library with `lib.go <lib.go>`_ and then a package with an
+`internal test <internal_test.go>`_ that contains the test case.
+It uses x_def stamped values to verify the library names are correct.
+
+external_test
+-------------
+
+Test that a `go_test`_ rule that adds black box tests for a dependant package works.
+This builds a library with `lib.go <lib.go>`_ and then a package with an
+`external test <external_test.go>`_ that contains the test case.
+It uses x_def stamped values to verify the library names are correct.
+
+combined_test
+-------------
+Test that a `go_test`_ rule that adds both white and black box tests for a
+package works.
+This builds a library with `lib.go <lib.go>`_ and then a one merged with the
+`internal test <internal_test.go>`_, and then another one that depends on it
+with the `external test <external_test.go>`_.
+It uses x_def stamped values to verify that all library names are correct.
+Verifies #413
+
+flag_test
+---------
+Test that a `go_test`_ rule that adds flags, even in the main package, can read
+the flag.
+This does not even build a library, it's a test in the main package with no
+dependancies that checks it can declare and then read a flag.
+Verifies #838
+
+only_testmain_test
+------------------
+Test that an `go_test`_ that contains a ``TestMain`` function but no tests
+still builds and passes.
+
+external_importmap_test
+----------------------
+
+Test that an external test package in `go_test`_ is compiled with the correct
+``importmap`` for the library under test. This is verified by defining an
+interface in the library under test and implementing it in a separate
+dependency.
+
+Verifies #1538.
+
+pwd_test
+--------
+
+Checks that the ``PWD`` environment variable is set to the current directory
+in the generated test main before running a test. This matches functionality
+in ``go test``.
+
+Verifies #1561.
+
+data_test
+---------
+
+Checks that data dependencies, including those inherited from ``deps`` and
+``embed``, are visible to tests at run-time. Source files should not be
+visible at run-time.
+
+test_fail_fast_test
+----------------
+
+Checks that ``--test_runner_fail_fast`` actually enables stopping test execution after
+the first failure.
+
+Verifies #3055.
+
+test_filter_test
+----------------
+
+Checks that ``--test_filter`` actually filters out test cases.
+
+testmain_import_test
+----------------
+
+Check if all packages in all source files are imported to test main, to ensure
+a consistent test behaviour. This ensures a consistent behaviour when thinking
+about global indirect depencencies.
+
+tags_test
+---------
+
+Checks that setting ``gotags`` affects source filtering. The test will fail
+unless a specific tag is set.
+
+indirect_import_test
+--------------------
+
+Checks that an external test can import another package that imports the library
+under test. The other package should be compiled against the internal test
+package, not the library under test. Verifies `#1877`_.
+
+testmain_without_exit
+---------------------
+
+Checks that TestMain without calling os.Exit directly works.
+Verifies `#34129`_ from Go 1.15.
+
+wrapper_test
+------------
+
+Checks that a ``go_test`` can be executed by another test in a subdirectory.
+Verifies `#2749`_.
+
+fuzz_test
+---------
+
+Checks that a ``go_test`` with a fuzz target builds correctly.
diff --git a/tests/core/go_test/binary_env_test.go b/tests/core/go_test/binary_env_test.go
new file mode 100644
index 00000000..25089034
--- /dev/null
+++ b/tests/core/go_test/binary_env_test.go
@@ -0,0 +1,55 @@
+// Copyright 2023 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package binary_env_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- src/BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+go_binary(
+ name = "main",
+ srcs = ["env.go"],
+ env = {"FOO": "bar"},
+)
+-- src/env.go --
+package main
+
+import (
+ "log"
+ "os"
+)
+
+func main() {
+ v := os.Getenv("FOO")
+ if v != "bar" {
+ log.Fatalf("FOO was not equal to bar")
+ }
+}
+`,
+ })
+}
+
+func TestBinaryEnv(t *testing.T) {
+ if err := bazel_testing.RunBazel("run", "//src:main"); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/go_test/data_test.go b/tests/core/go_test/data_test.go
new file mode 100644
index 00000000..fd8a3930
--- /dev/null
+++ b/tests/core/go_test/data_test.go
@@ -0,0 +1,45 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package data_test
+
+import (
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+func TestVisibleRunfiles(t *testing.T) {
+ var got []string
+ err := filepath.Walk(".", func(path string, info os.FileInfo, err error) error {
+ if err != nil {
+ return err
+ }
+ if base := filepath.Base(path); info.IsDir() || base == "data_test" || base == "data_test.exe" {
+ return nil
+ }
+ got = append(got, filepath.ToSlash(path))
+ return nil
+ })
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ gotStr := strings.Join(got, "\n")
+ wantStr := "x\ny\nz"
+ if gotStr != wantStr {
+ t.Errorf("got:\n%s\nwant:\n%s\n", gotStr, wantStr)
+ }
+}
diff --git a/tests/core/go_test/data_test_dep.go b/tests/core/go_test/data_test_dep.go
new file mode 100644
index 00000000..d8eb2672
--- /dev/null
+++ b/tests/core/go_test/data_test_dep.go
@@ -0,0 +1,15 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package data_test_dep
diff --git a/tests/core/go_test/data_test_embed.go b/tests/core/go_test/data_test_embed.go
new file mode 100644
index 00000000..d8eb2672
--- /dev/null
+++ b/tests/core/go_test/data_test_embed.go
@@ -0,0 +1,15 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package data_test_dep
diff --git a/tests/core/go_test/env_inherit_test.go b/tests/core/go_test/env_inherit_test.go
new file mode 100644
index 00000000..b425abe2
--- /dev/null
+++ b/tests/core/go_test/env_inherit_test.go
@@ -0,0 +1,61 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package env_inherit_test
+
+import (
+ "os"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- src/BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_test")
+go_test(
+ name = "main",
+ srcs = ["env_inherit.go"],
+ env_inherit = ["INHERITEDVAR"],
+)
+-- src/env_inherit.go --
+package env_inherit_test
+
+import (
+ "os"
+ "testing"
+)
+
+func TestInherit(t *testing.T) {
+ v := os.Getenv("INHERITEDVAR")
+ if v != "b" {
+ t.Fatalf("INHERITEDVAR was not equal to b")
+ }
+}
+`,
+
+ SetUp: func() error {
+ os.Setenv("INHERITEDVAR", "b")
+ return nil
+ },
+ })
+}
+
+func TestInheritedEnvVar(t *testing.T) {
+ if err := bazel_testing.RunBazel("test", "//src:main"); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/go_test/env_test.go b/tests/core/go_test/env_test.go
new file mode 100644
index 00000000..89dae3ca
--- /dev/null
+++ b/tests/core/go_test/env_test.go
@@ -0,0 +1,39 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package env_test
+
+import (
+ "os"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+)
+
+func TestEnv(t *testing.T) {
+ v := os.Getenv("ZONEINFO")
+ if v == "" {
+ t.Fatalf("ZONEINFO env var was empty")
+ }
+
+ path, err := bazel.Runfile(v)
+ if err != nil {
+ t.Fatalf("Could not find runfile %v: %v", v, err)
+ }
+
+ if _, err := os.Stat(path); err != nil {
+ t.Fatalf("Could not find file at env var $ZONEINFO (value: %v) at path %v: %v", v, path, err)
+ }
+}
+
diff --git a/tests/core/go_test/example_test.go b/tests/core/go_test/example_test.go
new file mode 100644
index 00000000..6314e69c
--- /dev/null
+++ b/tests/core/go_test/example_test.go
@@ -0,0 +1,32 @@
+package lib
+
+import "fmt"
+
+var Expected = "Expected"
+
+func ExampleHelloWorld() {
+ fmt.Println("Hello Example!")
+ fmt.Println("expected: " + Expected)
+ fmt.Println("got: " + Got)
+ // Output:
+ // Hello Example!
+ // expected: Example
+ // got: Example
+}
+
+func ExampleDontTestMe() {
+ panic("Dont Test Me!")
+}
+
+func ExampleTestEmptyOutput() {
+ if false {
+ fmt.Println("Say something!")
+ }
+ // Output:
+}
+
+func ExampleTestQuoting() {
+ fmt.Printf(`"quotes are handled"`)
+ // Output:
+ // "quotes are handled"
+}
diff --git a/tests/core/go_test/external_importmap_dep.go b/tests/core/go_test/external_importmap_dep.go
new file mode 100644
index 00000000..c9990774
--- /dev/null
+++ b/tests/core/go_test/external_importmap_dep.go
@@ -0,0 +1,11 @@
+package external_importmap_dep
+
+import (
+ "github.com/bazelbuild/rules_go/tests/core/go_test/external_importmap"
+)
+
+type Impl struct{}
+
+func (_ *Impl) DeepCopyObject() external_importmap.Object {
+ return nil
+}
diff --git a/tests/core/go_test/external_importmap_lib.go b/tests/core/go_test/external_importmap_lib.go
new file mode 100644
index 00000000..e9800a1c
--- /dev/null
+++ b/tests/core/go_test/external_importmap_lib.go
@@ -0,0 +1,5 @@
+package external_importmap
+
+type Object interface {
+ DeepCopyObject() Object
+}
diff --git a/tests/core/go_test/external_importmap_test.go b/tests/core/go_test/external_importmap_test.go
new file mode 100644
index 00000000..fbcc55ef
--- /dev/null
+++ b/tests/core/go_test/external_importmap_test.go
@@ -0,0 +1,10 @@
+package external_importmap_test
+
+import (
+ "github.com/bazelbuild/rules_go/tests/core/go_test/external_importmap"
+ "github.com/bazelbuild/rules_go/tests/core/go_test/external_importmap_dep"
+)
+
+var _ external_importmap.Object = &external_importmap_dep.Impl{}
+
+// Test passes if it compiles.
diff --git a/tests/core/go_test/external_test.go b/tests/core/go_test/external_test.go
new file mode 100644
index 00000000..957cce9e
--- /dev/null
+++ b/tests/core/go_test/external_test.go
@@ -0,0 +1,29 @@
+/* Copyright 2017 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package lib_test
+
+import (
+ "lib"
+ "testing"
+)
+
+var Expect = "Expect"
+
+func TestExternal(t *testing.T) {
+ if lib.Got != Expect {
+ t.Errorf("Got %q expected %q", lib.Got, Expect)
+ }
+}
diff --git a/tests/core/go_test/flag_test.go b/tests/core/go_test/flag_test.go
new file mode 100644
index 00000000..ec7c3576
--- /dev/null
+++ b/tests/core/go_test/flag_test.go
@@ -0,0 +1,30 @@
+/* Copyright 2018 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+package main
+
+import (
+ "flag"
+ "testing"
+)
+
+const flagDefault = "flag default"
+
+var aflag = flag.String("aflag", flagDefault, "A test flag")
+
+func TestAFlag(t *testing.T) {
+ if *aflag == flagDefault {
+ t.Error("aflag is still the default")
+ }
+}
diff --git a/tests/core/go_test/fuzz_test.go b/tests/core/go_test/fuzz_test.go
new file mode 100644
index 00000000..48c88194
--- /dev/null
+++ b/tests/core/go_test/fuzz_test.go
@@ -0,0 +1,29 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//go:build go1.18
+// +build go1.18
+
+package fuzz_test
+
+import "testing"
+
+func Fuzz(f *testing.F) {
+ f.Add("seed")
+ f.Fuzz(func(t *testing.T, s string) {
+ if s != "seed" {
+ t.Fail()
+ }
+ })
+}
diff --git a/tests/core/go_test/indirect_import_dep.go b/tests/core/go_test/indirect_import_dep.go
new file mode 100644
index 00000000..c47d28b5
--- /dev/null
+++ b/tests/core/go_test/indirect_import_dep.go
@@ -0,0 +1,7 @@
+package indirect_import_dep
+
+import "github.com/bazelbuild/rules_go/tests/core/go_test/indirect_import"
+
+func GetX() string {
+ return indirect_import.X
+}
diff --git a/tests/core/go_test/indirect_import_i_test.go b/tests/core/go_test/indirect_import_i_test.go
new file mode 100644
index 00000000..e6814143
--- /dev/null
+++ b/tests/core/go_test/indirect_import_i_test.go
@@ -0,0 +1,7 @@
+package indirect_import
+
+import "testing"
+
+func TestMain(m *testing.M) {
+ X = "set by TestMain"
+}
diff --git a/tests/core/go_test/indirect_import_lib.go b/tests/core/go_test/indirect_import_lib.go
new file mode 100644
index 00000000..915c0dfe
--- /dev/null
+++ b/tests/core/go_test/indirect_import_lib.go
@@ -0,0 +1,3 @@
+package indirect_import
+
+var X string = "not set"
diff --git a/tests/core/go_test/indirect_import_x_test.go b/tests/core/go_test/indirect_import_x_test.go
new file mode 100644
index 00000000..008063ce
--- /dev/null
+++ b/tests/core/go_test/indirect_import_x_test.go
@@ -0,0 +1,15 @@
+package indirect_import_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/core/go_test/indirect_import_dep"
+)
+
+func Test(t *testing.T) {
+ got := indirect_import_dep.GetX()
+ want := "set by TestMain"
+ if got != want {
+ t.Errorf("got %q; want %q", got, want)
+ }
+}
diff --git a/tests/core/go_test/internal_test.go b/tests/core/go_test/internal_test.go
new file mode 100644
index 00000000..fdb112e6
--- /dev/null
+++ b/tests/core/go_test/internal_test.go
@@ -0,0 +1,28 @@
+/* Copyright 2017 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package lib
+
+import (
+ "testing"
+)
+
+var Expect = "Expect"
+
+func TestInternal(t *testing.T) {
+ if Got != Expect {
+ t.Errorf("Got %q expected %q", Got, Expect)
+ }
+}
diff --git a/tests/core/go_test/lib.go b/tests/core/go_test/lib.go
new file mode 100644
index 00000000..f34c854f
--- /dev/null
+++ b/tests/core/go_test/lib.go
@@ -0,0 +1,20 @@
+/* Copyright 2017 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package lib
+
+import "C"
+
+var Got = "Got"
diff --git a/tests/core/go_test/only_testmain_test.go b/tests/core/go_test/only_testmain_test.go
new file mode 100644
index 00000000..474a3d6c
--- /dev/null
+++ b/tests/core/go_test/only_testmain_test.go
@@ -0,0 +1,10 @@
+package only_testmain
+
+import (
+ "os"
+ "testing"
+)
+
+func TestMain(m *testing.M) {
+ os.Exit(m.Run())
+}
diff --git a/tests/core/go_test/pwd_test.go b/tests/core/go_test/pwd_test.go
new file mode 100644
index 00000000..9de4abf0
--- /dev/null
+++ b/tests/core/go_test/pwd_test.go
@@ -0,0 +1,16 @@
+package pwd
+
+import (
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+)
+
+func TestPwd(t *testing.T) {
+ pwd := os.Getenv("PWD")
+ suffix := filepath.FromSlash("tests/core/go_test")
+ if !strings.HasSuffix(pwd, filepath.FromSlash(suffix)) {
+ t.Errorf("PWD not set. got %q; want something ending with %q", pwd, suffix)
+ }
+}
diff --git a/tests/core/go_test/same_package_test.go b/tests/core/go_test/same_package_test.go
new file mode 100644
index 00000000..cf991492
--- /dev/null
+++ b/tests/core/go_test/same_package_test.go
@@ -0,0 +1,7 @@
+package same_package
+
+import (
+ "testing"
+)
+
+func OkTest(t *testing.T) {}
diff --git a/tests/core/go_test/sharding_test.go b/tests/core/go_test/sharding_test.go
new file mode 100644
index 00000000..a83bb85c
--- /dev/null
+++ b/tests/core/go_test/sharding_test.go
@@ -0,0 +1,13 @@
+package sharding_test
+
+import (
+ "log"
+ "os"
+ "testing"
+)
+
+func TestShardStatusFile(t *testing.T) {
+ if _, err := os.Stat(os.Getenv("TEST_SHARD_STATUS_FILE")); err != nil {
+ log.Fatalf("Expected Go test runner to create TEST_SHARD_STATUS_FILE: %v", err)
+ }
+}
diff --git a/tests/core/go_test/tags_bad_test.go b/tests/core/go_test/tags_bad_test.go
new file mode 100644
index 00000000..76d32cd5
--- /dev/null
+++ b/tests/core/go_test/tags_bad_test.go
@@ -0,0 +1,9 @@
+// +build !good
+
+package tags_test
+
+import "testing"
+
+func Test(t *testing.T) {
+ t.Fail()
+}
diff --git a/tests/core/go_test/tags_good_test.go b/tests/core/go_test/tags_good_test.go
new file mode 100644
index 00000000..60071805
--- /dev/null
+++ b/tests/core/go_test/tags_good_test.go
@@ -0,0 +1,7 @@
+// +build good
+
+package tags_test
+
+import "testing"
+
+func Test(t *testing.T) {}
diff --git a/tests/core/go_test/test_fail_fast_test.go b/tests/core/go_test/test_fail_fast_test.go
new file mode 100644
index 00000000..b949b489
--- /dev/null
+++ b/tests/core/go_test/test_fail_fast_test.go
@@ -0,0 +1,75 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package test_fail_fast_test
+
+import (
+ "bytes"
+ "io/ioutil"
+ "path/filepath"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_test")
+
+go_test(
+ name = "fail_fast_test",
+ srcs = ["fail_fast_test.go"],
+)
+
+-- fail_fast_test.go --
+package test_fail_fast
+
+import "testing"
+
+func TestShouldFail(t *testing.T) {
+ t.Fail()
+}
+
+func TestShouldNotRun(t *testing.T) {
+ t.Fail()
+}
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ if err := bazel_testing.RunBazel("test", "//:fail_fast_test", "--test_runner_fail_fast"); err == nil {
+ t.Fatal("got success; want failure")
+ } else if bErr, ok := err.(*bazel_testing.StderrExitError); !ok {
+ t.Fatalf("got %v; want StderrExitError", err)
+ } else if code := bErr.Err.ExitCode(); code != 3 {
+ t.Fatalf("got code %d; want code 3", code)
+ }
+
+ logPath := filepath.FromSlash("bazel-testlogs/fail_fast_test/test.log")
+ logData, err := ioutil.ReadFile(logPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if !bytes.Contains(logData, []byte("TestShouldFail")) {
+ t.Fatalf("test log does not contain 'TestShouldFail': %q", logData)
+ }
+
+ if bytes.Contains(logData, []byte("TestShouldNotRun")) {
+ t.Fatalf("test log contains 'TestShouldNotRun' but should not: %q", logData)
+ }
+}
diff --git a/tests/core/go_test/test_filter_test.go b/tests/core/go_test/test_filter_test.go
new file mode 100644
index 00000000..49b1ce73
--- /dev/null
+++ b/tests/core/go_test/test_filter_test.go
@@ -0,0 +1,54 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package test_filter_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_test")
+
+go_test(
+ name = "filter_test",
+ srcs = ["filter_test.go"],
+)
+
+-- filter_test.go --
+package test_filter
+
+import "testing"
+
+func TestShouldPass(t *testing.T) {
+}
+
+func TestShouldFail(t *testing.T) {
+ t.Fail()
+}
+
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ if err := bazel_testing.RunBazel("test", "//:filter_test", "--test_filter=Pass"); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/go_test/testmain_import_indirect_test.go b/tests/core/go_test/testmain_import_indirect_test.go
new file mode 100644
index 00000000..bcb6fac8
--- /dev/null
+++ b/tests/core/go_test/testmain_import_indirect_test.go
@@ -0,0 +1,7 @@
+package test_main_test
+
+import "example.com/imports/test_main"
+
+func init() {
+ test_main.Updated = true
+}
diff --git a/tests/core/go_test/testmain_import_main_test.go b/tests/core/go_test/testmain_import_main_test.go
new file mode 100644
index 00000000..b723bf06
--- /dev/null
+++ b/tests/core/go_test/testmain_import_main_test.go
@@ -0,0 +1,11 @@
+package test_main
+
+import "testing"
+
+var Updated bool
+
+func TestShouldPass(t *testing.T) {
+ if !Updated {
+ t.Fail()
+ }
+}
diff --git a/tests/core/go_test/testmain_without_exit_test.go b/tests/core/go_test/testmain_without_exit_test.go
new file mode 100644
index 00000000..6944747d
--- /dev/null
+++ b/tests/core/go_test/testmain_without_exit_test.go
@@ -0,0 +1,59 @@
+// Copyright 2020 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package testmain_without_exit
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_test")
+
+go_test(
+ name = "main_without_exit_test",
+ srcs = ["main_without_exit_test.go"],
+)
+
+-- main_without_exit_test.go --
+package test_main_without_exit
+
+import "testing"
+
+func TestMain(m *testing.M) {
+ m.Run()
+}
+
+func TestShouldFail(t *testing.T) {
+ t.Fail()
+}
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ err := bazel_testing.RunBazel("test", "//:main_without_exit_test")
+ if err == nil {
+ t.Fatal("expected bazel test to have failed")
+ }
+
+ if xerr, ok := err.(*bazel_testing.StderrExitError); !ok || xerr.Err.ExitCode() != 3 {
+ t.Fatalf("expected bazel tests to fail with exit code 3 (TESTS_FAILED), got: %s", err)
+ }
+}
diff --git a/tests/core/go_test/wrapped_test.go b/tests/core/go_test/wrapped_test.go
new file mode 100644
index 00000000..ce8c1933
--- /dev/null
+++ b/tests/core/go_test/wrapped_test.go
@@ -0,0 +1,19 @@
+// Copyright 2020 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package wrapped_test
+
+import "testing"
+
+func Test(t *testing.T) {}
diff --git a/tests/core/go_test/wrapper_test.go b/tests/core/go_test/wrapper_test.go
new file mode 100644
index 00000000..c889ccac
--- /dev/null
+++ b/tests/core/go_test/wrapper_test.go
@@ -0,0 +1,46 @@
+// Copyright 2020 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package wrapper_test
+
+import (
+ "io/ioutil"
+ "os"
+ "os/exec"
+ "testing"
+)
+
+func Test(t *testing.T) {
+ if _, ok := os.LookupEnv("RUNFILES_MANIFEST_FILE"); ok {
+ t.Skipf("test only applicable with a runfiles directory")
+ }
+
+ tmpLog, err := ioutil.TempFile("", "tmp.xml")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer func() {
+ tmpLog.Close()
+ os.Remove(tmpLog.Name())
+ }()
+
+ arg := os.Args[1]
+ cmd := exec.Command(arg)
+ cmd.Stdout = os.Stdout
+ cmd.Stderr = os.Stderr
+ cmd.Env = append(os.Environ(), "GO_TEST_WRAP=1", "XML_OUTPUT_FILE="+tmpLog.Name())
+ if err := cmd.Run(); err != nil {
+ t.Fatalf("running wrapped_test: %v", err)
+ }
+}
diff --git a/tests/core/go_test/x b/tests/core/go_test/x
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_test/x
diff --git a/tests/core/go_test/x_defs/BUILD.bazel b/tests/core/go_test/x_defs/BUILD.bazel
new file mode 100644
index 00000000..7edc4885
--- /dev/null
+++ b/tests/core/go_test/x_defs/BUILD.bazel
@@ -0,0 +1,73 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+test_suite(
+ name = "x_defs",
+)
+
+go_test(
+ name = "foo_test",
+ srcs = ["foo_test.go"],
+ embed = [":foo"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/foo",
+ pure = "on",
+ deps = [":bar"],
+)
+
+go_library(
+ name = "bar",
+ srcs = ["bar.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/bar",
+ visibility = ["//visibility:public"],
+ x_defs = {"Bar": "Bar"},
+ deps = [
+ ":baz",
+ ":foo",
+ ],
+)
+
+go_library(
+ name = "baz",
+ srcs = ["baz.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/baz",
+ visibility = ["//visibility:public"],
+ x_defs = {"Baz": "Baz"},
+ deps = [":qux"],
+)
+
+go_library(
+ name = "foo",
+ srcs = ["foo.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/foo",
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "qux",
+ srcs = ["qux.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/qux",
+ visibility = ["//visibility:public"],
+ x_defs = {"Qux": "Qux"},
+)
+
+go_library(
+ name = "x_defs_lib",
+ srcs = ["x_defs_lib.go"],
+ data = ["x_defs_lib.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/x_defs_lib",
+ x_defs = {
+ "LibGo": "$(rlocationpath x_defs_lib.go)",
+ },
+)
+
+go_test(
+ name = "x_defs_test",
+ srcs = ["x_defs_test.go"],
+ data = ["x_defs_test.go"],
+ x_defs = {
+ "BinGo": "$(rlocationpath x_defs_test.go)",
+ },
+ deps = [
+ ":x_defs_lib",
+ "//go/runfiles",
+ ],
+)
diff --git a/tests/core/go_test/x_defs/bar.go b/tests/core/go_test/x_defs/bar.go
new file mode 100644
index 00000000..1d0081a4
--- /dev/null
+++ b/tests/core/go_test/x_defs/bar.go
@@ -0,0 +1,10 @@
+package bar
+
+import (
+ "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/baz"
+ _ "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/foo"
+)
+
+var Bar string
+var Qux = baz.Qux
+var Baz = baz.Baz
diff --git a/tests/core/go_test/x_defs/baz.go b/tests/core/go_test/x_defs/baz.go
new file mode 100644
index 00000000..9d4334f7
--- /dev/null
+++ b/tests/core/go_test/x_defs/baz.go
@@ -0,0 +1,6 @@
+package baz
+
+import "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/qux"
+
+var Baz string
+var Qux = qux.Qux
diff --git a/tests/core/go_test/x_defs/foo.go b/tests/core/go_test/x_defs/foo.go
new file mode 100644
index 00000000..f52652b1
--- /dev/null
+++ b/tests/core/go_test/x_defs/foo.go
@@ -0,0 +1 @@
+package foo
diff --git a/tests/core/go_test/x_defs/foo_test.go b/tests/core/go_test/x_defs/foo_test.go
new file mode 100644
index 00000000..dc940509
--- /dev/null
+++ b/tests/core/go_test/x_defs/foo_test.go
@@ -0,0 +1,28 @@
+package foo_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/bar"
+)
+
+func TestBar(t *testing.T) {
+ Equal(t, "Bar", bar.Bar)
+}
+
+func TestBaz(t *testing.T) {
+ Equal(t, "Baz", bar.Baz)
+}
+
+func TestQux(t *testing.T) {
+ Equal(t, "Qux", bar.Qux)
+}
+
+func Equal(t *testing.T, expected string, actual string) bool {
+ if expected != actual {
+ t.Errorf("Not equal: \n"+
+ "expected: %s\n"+
+ "actual : %s", expected, actual)
+ }
+ return true
+}
diff --git a/tests/core/go_test/x_defs/qux.go b/tests/core/go_test/x_defs/qux.go
new file mode 100644
index 00000000..4983170c
--- /dev/null
+++ b/tests/core/go_test/x_defs/qux.go
@@ -0,0 +1,3 @@
+package qux
+
+var Qux string
diff --git a/tests/core/go_test/x_defs/x_defs_lib.go b/tests/core/go_test/x_defs/x_defs_lib.go
new file mode 100644
index 00000000..e7794b33
--- /dev/null
+++ b/tests/core/go_test/x_defs/x_defs_lib.go
@@ -0,0 +1,3 @@
+package x_defs_lib
+
+var LibGo = "not set"
diff --git a/tests/core/go_test/x_defs/x_defs_test.go b/tests/core/go_test/x_defs/x_defs_test.go
new file mode 100644
index 00000000..0832c247
--- /dev/null
+++ b/tests/core/go_test/x_defs/x_defs_test.go
@@ -0,0 +1,34 @@
+package x_defs_lib_test
+
+import (
+ "os"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/runfiles"
+
+ "github.com/bazelbuild/rules_go/tests/core/go_test/x_defs/x_defs_lib"
+)
+
+var BinGo = "not set"
+
+func TestLibGoPath(t *testing.T) {
+ libGoPath, err := runfiles.Rlocation(x_defs_lib.LibGo)
+ if err != nil {
+ t.Fatal(err)
+ }
+ _, err = os.Stat(libGoPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+}
+
+func TestBinGoPath(t *testing.T) {
+ binGoPath, err := runfiles.Rlocation(BinGo)
+ if err != nil {
+ t.Fatal(err)
+ }
+ _, err = os.Stat(binGoPath)
+ if err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/go_test/xmlreport_test.go b/tests/core/go_test/xmlreport_test.go
new file mode 100644
index 00000000..09198356
--- /dev/null
+++ b/tests/core/go_test/xmlreport_test.go
@@ -0,0 +1,163 @@
+// Copyright 2020 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package test_filter_test
+
+import (
+ "encoding/xml"
+ "io/ioutil"
+ "path/filepath"
+ "reflect"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_test")
+
+go_test(
+ name = "xml_test",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/go_test/xml_test",
+ srcs = ["xml_test.go"],
+)
+
+-- xml_test.go --
+package test
+
+import (
+ "math/rand"
+ "testing"
+ "time"
+)
+
+func TestPass(t *testing.T) {
+ t.Parallel()
+}
+
+func TestPassLog(t *testing.T) {
+ t.Parallel()
+ t.Log("pass")
+}
+
+func TestFail(t *testing.T) {
+ t.Error("Not working")
+}
+
+func TestSubtests(t *testing.T) {
+ for i, subtest := range []string{"subtest a", "testB", "another subtest"} {
+ t.Run(subtest, func(t *testing.T) {
+ t.Logf("from subtest %s", subtest)
+ time.Sleep(time.Duration(rand.Intn(10)) * time.Millisecond)
+ t.Logf("from subtest %s", subtest)
+ if i%3 == 0 {
+ t.Skip("skipping this test")
+ }
+ if i%2 == 0 {
+ t.Fail()
+ }
+ })
+ }
+}
+`,
+ })
+}
+
+// test execution time attributes will vary per testrun, so we must parse the
+// xml to inspect a subset of testresults
+type xmlTestSuite struct {
+ XMLName xml.Name `xml:"testsuite"`
+ Errors int `xml:"errors,attr"`
+ Failures int `xml:"failures,attr"`
+ Skipped int `xml:"skipped,attr"`
+ Tests int `xml:"tests,attr"`
+ Name string `xml:"name,attr"`
+}
+type xmlTestSuites struct {
+ XMLName xml.Name `xml:"testsuites"`
+ Suites []xmlTestSuite `xml:"testsuite"`
+}
+
+func Test(t *testing.T) {
+ tests := []struct {
+ name string
+ args []string
+ expected xmlTestSuites
+ }{
+ {
+ name: "default",
+ args: []string{"test", "//:xml_test"},
+ expected: xmlTestSuites{
+ XMLName: xml.Name{Local: "testsuites"},
+ Suites: []xmlTestSuite{{
+ XMLName: xml.Name{Local: "testsuite"},
+ Name: "github.com/bazelbuild/rules_go/tests/core/go_test/xml_test",
+ Errors: 0,
+ Failures: 3,
+ Tests: 3,
+ }},
+ },
+ },
+ {
+ name: "verbose",
+ args: []string{"test", "--test_env=GO_TEST_WRAP_TESTV=1", "//:xml_test"},
+ expected: xmlTestSuites{
+ XMLName: xml.Name{Local: "testsuites"},
+ Suites: []xmlTestSuite{{
+ XMLName: xml.Name{Local: "testsuite"},
+ Name: "github.com/bazelbuild/rules_go/tests/core/go_test/xml_test",
+ Errors: 0,
+ Failures: 3,
+ Skipped: 1,
+ Tests: 7,
+ }},
+ },
+ },
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ err := bazel_testing.RunBazel(tt.args...)
+ if err == nil {
+ t.Fatal("expected bazel test to have failed")
+ }
+ if xerr, ok := err.(*bazel_testing.StderrExitError); !ok || xerr.Err.ExitCode() != 3 {
+ t.Fatalf("expected bazel tests to fail with exit code 3 (TESTS_FAILED), got: %s", err)
+ }
+
+ p, err := bazel_testing.BazelOutput("info", "bazel-testlogs")
+ if err != nil {
+ t.Fatal("could not find testlog root: %s", err)
+ }
+ path := filepath.Join(strings.TrimSpace(string(p)), "xml_test/test.xml")
+ b, err := ioutil.ReadFile(path)
+ if err != nil {
+ t.Fatalf("could not read generated xml file: %s", err)
+ }
+
+ var suites xmlTestSuites
+ if err := xml.Unmarshal(b, &suites); err != nil {
+ t.Fatalf("could not unmarshall generated xml: %s", err)
+ }
+
+ if !reflect.DeepEqual(suites, tt.expected) {
+ t.Fatalf("expected %#v, got: %#v", tt.expected, suites)
+ }
+ })
+ }
+}
diff --git a/tests/core/go_test/y b/tests/core/go_test/y
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_test/y
diff --git a/tests/core/go_test/z b/tests/core/go_test/z
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/go_test/z
diff --git a/tests/core/importmap/BUILD.bazel b/tests/core/importmap/BUILD.bazel
new file mode 100644
index 00000000..115ab878
--- /dev/null
+++ b/tests/core/importmap/BUILD.bazel
@@ -0,0 +1,45 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+test_suite(
+ name = "importmap",
+)
+
+go_library(
+ name = "lib_a",
+ srcs = ["lib.go"],
+ importmap = "a/lib",
+ importpath = "lib",
+ x_defs = {"Value": "ValueA"},
+)
+
+go_library(
+ name = "lib_b",
+ srcs = ["lib.go"],
+ importmap = "b/lib",
+ importpath = "lib",
+ x_defs = {"Value": "ValueB"},
+)
+
+go_library(
+ name = "a",
+ srcs = ["import.go"],
+ importpath = "a",
+ deps = [":lib_a"],
+)
+
+go_library(
+ name = "b",
+ srcs = ["import.go"],
+ importpath = "b",
+ deps = [":lib_b"],
+)
+
+go_test(
+ name = "importmap_test",
+ size = "small",
+ srcs = ["importmap_test.go"],
+ deps = [
+ ":a",
+ ":b",
+ ],
+)
diff --git a/tests/core/importmap/README.rst b/tests/core/importmap/README.rst
new file mode 100644
index 00000000..7abf58d5
--- /dev/null
+++ b/tests/core/importmap/README.rst
@@ -0,0 +1,16 @@
+Import maps
+===========
+
+.. _go_library: /docs/go/core/rules.md#_go_library
+
+Tests to ensure that importmap is working as expected.
+
+.. contents::
+
+importmap_test
+--------------
+
+Test that importmap declarations on go_library_ are propagated and obeyed.
+This builds libraries using `src.go <src.go>`_ as multiple outputs with the differing importpaths,
+adds identical importmap declarations and then checks that the libraries can be correctly imported
+without colliding through differing intermediate libraries into `the main test <importmap_test.go>`_.
diff --git a/tests/core/importmap/import.go b/tests/core/importmap/import.go
new file mode 100644
index 00000000..6d70cbfc
--- /dev/null
+++ b/tests/core/importmap/import.go
@@ -0,0 +1,24 @@
+/* Copyright 2017 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package importmap
+
+import (
+ "lib"
+)
+
+func Get() string {
+ return lib.Value
+}
diff --git a/tests/core/importmap/importmap_test.go b/tests/core/importmap/importmap_test.go
new file mode 100644
index 00000000..dc1d18b0
--- /dev/null
+++ b/tests/core/importmap/importmap_test.go
@@ -0,0 +1,31 @@
+/* Copyright 2017 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package importmap_test
+
+import (
+ a "a"
+ b "b"
+ "testing"
+)
+
+func TestImportmap(t *testing.T) {
+ if a.Get() != "ValueA" {
+ t.Errorf("Got %v from a instead of ValueA", a.Get())
+ }
+ if b.Get() != "ValueB" {
+ t.Errorf("Got %v from b instead of ValueB", b.Get())
+ }
+}
diff --git a/tests/core/importmap/lib.go b/tests/core/importmap/lib.go
new file mode 100644
index 00000000..a4ad9c47
--- /dev/null
+++ b/tests/core/importmap/lib.go
@@ -0,0 +1,18 @@
+/* Copyright 2017 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package lib
+
+var Value = "Unstamped"
diff --git a/tests/core/nogo/BUILD.bazel b/tests/core/nogo/BUILD.bazel
new file mode 100644
index 00000000..46c7ee89
--- /dev/null
+++ b/tests/core/nogo/BUILD.bazel
@@ -0,0 +1,5 @@
+filegroup(
+ name = "rules_go_deps",
+ srcs = [":common.bzl"],
+ visibility = ["//visibility:public"],
+)
diff --git a/tests/core/nogo/README.rst b/tests/core/nogo/README.rst
new file mode 100644
index 00000000..06b4e12a
--- /dev/null
+++ b/tests/core/nogo/README.rst
@@ -0,0 +1,18 @@
+Core Go rules tests
+===================
+
+This contains tests of the nogo build-time code analysis tool.
+
+Contents
+--------
+
+.. Child list start
+
+* `Vet check <vet/README.rst>`_
+* `Nogo configuration <config/README.rst>`_
+* `nogo analyzers with dependencies <deps/README.rst>`_
+* `Custom nogo analyzers <custom/README.rst>`_
+* `nogo test with coverage <coverage/README.rst>`_
+
+.. Child list end
+
diff --git a/tests/core/nogo/common.bzl b/tests/core/nogo/common.bzl
new file mode 100644
index 00000000..14089ce2
--- /dev/null
+++ b/tests/core/nogo/common.bzl
@@ -0,0 +1,38 @@
+# Macros used by all nogo integration tests.
+
+BUILD_FAILED_TMPL = """
+if [[ result -eq 0 ]]; then
+ echo "TEST FAILED: expected build error" >&2
+ result=1
+else
+ result=0
+ {check_err}
+fi
+"""
+
+BUILD_PASSED_TMPL = """
+if [[ result -ne 0 ]]; then
+ echo "TEST FAILED: unexpected build error" >&2
+ result=1
+else
+ {check_err}
+fi
+"""
+
+CONTAINS_ERR_TMPL = """
+ lines=$(grep '{err}' bazel-output.txt | wc -l)
+ if [ $lines -eq 0 ]; then
+ echo "TEST FAILED: expected error message containing: '{err}'" >&2
+ result=1
+ elif [ $lines -ne 1 ]; then
+ echo "TEST FAILED: expected error message '{err}' appears more than once" >&2
+ result=1
+ fi
+"""
+
+DOES_NOT_CONTAIN_ERR_TMPL = """
+ if grep -q '{err}' bazel-output.txt; then
+ echo "TEST FAILED: received error message containing: '{err}'" >&2
+ result=1
+ fi
+"""
diff --git a/tests/core/nogo/config/BUILD.bazel b/tests/core/nogo/config/BUILD.bazel
new file mode 100644
index 00000000..ce5ad406
--- /dev/null
+++ b/tests/core/nogo/config/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "config_test",
+ srcs = ["config_test.go"],
+)
diff --git a/tests/core/nogo/config/README.rst b/tests/core/nogo/config/README.rst
new file mode 100644
index 00000000..bcd4b730
--- /dev/null
+++ b/tests/core/nogo/config/README.rst
@@ -0,0 +1,17 @@
+Nogo configuration
+==================
+
+.. _nogo: /go/nogo.rst
+.. _go_binary: /docs/go/core/rules.md#_go_binary
+.. _#1850: https://github.com/bazelbuild/rules_go/issues/1850
+.. _#2470: https://github.com/bazelbuild/rules_go/issues/2470
+
+Tests that verify nogo_ works on targets compiled in non-default configurations.
+
+.. contents::
+
+config_test
+-----------
+
+Verifies that a `go_binary`_ can be built in non-default configurations with
+nogo. Verifies `#1850`_, `#2470`_.
diff --git a/tests/core/nogo/config/config_test.go b/tests/core/nogo/config/config_test.go
new file mode 100644
index 00000000..3758d438
--- /dev/null
+++ b/tests/core/nogo/config/config_test.go
@@ -0,0 +1,62 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package config_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Nogo: "@io_bazel_rules_go//:tools_nogo",
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+
+go_binary(
+ name = "shared_bin",
+ srcs = ["shared_bin.go"],
+ linkmode = "c-shared",
+ deps = [":shared_lib"],
+)
+
+go_library(
+ name = "shared_lib",
+ srcs = ["shared_lib.go"],
+ importpath = "example.com/nogo/config/shared_lib",
+)
+
+-- shared_bin.go --
+package main
+
+import _ "example.com/nogo/config/shared_lib"
+
+func main() {
+}
+
+-- shared_lib.go --
+package shared_lib
+
+`,
+ })
+}
+
+func TestShared(t *testing.T) {
+ if err := bazel_testing.RunBazel("build", "//:shared_bin"); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/nogo/coverage/BUILD.bazel b/tests/core/nogo/coverage/BUILD.bazel
new file mode 100644
index 00000000..b14fcaf4
--- /dev/null
+++ b/tests/core/nogo/coverage/BUILD.bazel
@@ -0,0 +1,11 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "coverage_test",
+ srcs = ["coverage_test.go"],
+)
+
+go_bazel_test(
+ name = "gen_code_test",
+ srcs = ["gen_code_test.go"],
+)
diff --git a/tests/core/nogo/coverage/README.rst b/tests/core/nogo/coverage/README.rst
new file mode 100644
index 00000000..2bb6de95
--- /dev/null
+++ b/tests/core/nogo/coverage/README.rst
@@ -0,0 +1,23 @@
+nogo test with coverage
+=======================
+
+.. _nogo: /go/nogo.rst
+.. _#1940: https://github.com/bazelbuild/rules_go/issues/1940
+.. _#2146: https://github.com/bazelbuild/rules_go/issues/2146
+
+Tests to ensure that `nogo`_ works with coverage.
+
+coverage_test
+-------------
+Checks that `nogo`_ works when coverage is enabled. All covered libraries gain
+an implicit dependencies on ``//go/tools/coverdata``, which is a
+`go_tool_library`_, which isn't built with `nogo`_. We should be able to
+handle libraries like this that do not have serialized facts. Verifies `#1940`_.
+
+Also checks that `nogo`_ itself can be built with coverage enabled.
+Verifies `#2146`_.
+
+gen_code_test
+-------------
+Checks how `nogo`_ should not run on source code that was generated as part of
+rules_go's coverage implementation.
diff --git a/tests/core/nogo/coverage/coverage_test.go b/tests/core/nogo/coverage/coverage_test.go
new file mode 100644
index 00000000..97dc63dc
--- /dev/null
+++ b/tests/core/nogo/coverage/coverage_test.go
@@ -0,0 +1,65 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package coverage_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_test", "go_tool_library", "nogo")
+
+go_test(
+ name = "coverage_target",
+ srcs = ["coverage_target_test.go"],
+ deps = [":coverage_target_dep"],
+)
+
+go_tool_library(
+ name = "coverage_target_dep",
+ importmap = "mapped/coverage_target/dep",
+ importpath = "coverage_target/dep",
+)
+
+nogo(
+ name = "nogo",
+ vet = True,
+ visibility = ["//visibility:public"],
+)
+-- coverage_target_test.go --
+package coverage_target_test
+`,
+ Nogo: `@//:nogo`,
+ })
+}
+
+func TestCoverageWithNogo(t *testing.T) {
+ if out, err := bazel_testing.BazelOutput("coverage", "//:coverage_target"); err != nil {
+ println(string(out))
+ t.Fatal(err)
+ }
+}
+
+func TestCoverageOfNogo(t *testing.T) {
+ if out, err := bazel_testing.BazelOutput("build", "--instrumentation_filter=.*", "--collect_code_coverage", "//:nogo"); err != nil {
+ println(string(out))
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/nogo/coverage/gen_code_test.go b/tests/core/nogo/coverage/gen_code_test.go
new file mode 100644
index 00000000..6f2c55b6
--- /dev/null
+++ b/tests/core/nogo/coverage/gen_code_test.go
@@ -0,0 +1,130 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package gen_code_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test", "nogo")
+
+go_library(
+ name = "simple",
+ srcs = ["simple.go"],
+ importpath = "simple"
+)
+
+go_test(
+ name = "simple_test",
+ srcs = ["simple_test.go"],
+ embed = [":simple"]
+)
+
+nogo(
+ name = "nogo",
+ deps = ["//nocover"],
+ visibility = ["//visibility:public"],
+)
+-- simple.go --
+package simple
+
+func Foo() string {
+ return "foo"
+}
+-- simple_test.go --
+package simple
+
+import "testing"
+
+func TestFoo(t *testing.T) {
+ if actual, expected := Foo(), "foo"; actual != expected {
+ t.Errorf("Foo() should return foo")
+ }
+}
+-- nocover/BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "nocover",
+ srcs = ["analyzer.go"],
+ importpath = "nocover",
+ visibility = ["//visibility:public"],
+ deps = [
+ "@org_golang_x_tools//go/analysis",
+ "@org_golang_x_tools//go/analysis/passes/inspect",
+ "@org_golang_x_tools//go/ast/inspector",
+ ],
+)
+-- nocover/analyzer.go --
+package nocover
+
+import (
+ "fmt"
+ "go/ast"
+ "strings"
+
+ "golang.org/x/tools/go/analysis"
+ "golang.org/x/tools/go/analysis/passes/inspect"
+ "golang.org/x/tools/go/ast/inspector"
+)
+
+var Analyzer = &analysis.Analyzer{
+ Name: "nocover",
+ Doc: "nocover ensure that source code was not a generated file created by rules_go's coverage implementation",
+ Run: run,
+ Requires: []*analysis.Analyzer{inspect.Analyzer},
+}
+
+func run(pass *analysis.Pass) (interface{}, error) {
+ inspector := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
+
+ inspector.Preorder([]ast.Node{(*ast.ValueSpec)(nil)}, func(node ast.Node) {
+ valueSpec := node.(*ast.ValueSpec)
+ if len(valueSpec.Names) != 1 {
+ return
+ }
+
+ varName := valueSpec.Names[0].Name
+
+ // check for coverage variable name that matches this pattern: CoverZ%sZ%dZ%s
+ // see go/tools/builders/compilepkg.go -> coverVar for more information
+ if strings.HasPrefix(varName, "CoverZ") && strings.Count(varName, "Z") >= 3 {
+ pass.Report(analysis.Diagnostic{
+ Pos: valueSpec.Pos(),
+ End: valueSpec.End(),
+ Message: fmt.Sprintf("variable %s was generated by rules_go", varName),
+ })
+ }
+ })
+
+ return nil, nil
+}
+`,
+ Nogo: `@//:nogo`,
+ })
+}
+
+func TestNogoCoverGenCode(t *testing.T) {
+ if out, err := bazel_testing.BazelOutput("coverage", "//:simple_test"); err != nil {
+ println(string(out))
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/nogo/custom/BUILD.bazel b/tests/core/nogo/custom/BUILD.bazel
new file mode 100644
index 00000000..06317a0b
--- /dev/null
+++ b/tests/core/nogo/custom/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "custom_test",
+ srcs = ["custom_test.go"],
+)
diff --git a/tests/core/nogo/custom/README.rst b/tests/core/nogo/custom/README.rst
new file mode 100644
index 00000000..285c8ff6
--- /dev/null
+++ b/tests/core/nogo/custom/README.rst
@@ -0,0 +1,16 @@
+Custom nogo analyzers
+=====================
+
+.. _nogo: /go/nogo.rst
+.. _go_library: /docs/go/core/rules.md#_go_library
+
+Tests to ensure that custom `nogo`_ analyzers run and detect errors.
+
+.. contents::
+
+custom_test
+-----------
+Verifies that custom analyzers print errors and fail a `go_library`_ build when
+a configuration file is not provided, and that analyzers with the same package
+name do not conflict. Also checks that custom analyzers can be configured to
+apply only to certain file paths using a custom configuration file.
diff --git a/tests/core/nogo/custom/custom_test.go b/tests/core/nogo/custom/custom_test.go
new file mode 100644
index 00000000..27624431
--- /dev/null
+++ b/tests/core/nogo/custom/custom_test.go
@@ -0,0 +1,510 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package custom_test
+
+import (
+ "bytes"
+ "fmt"
+ "io/ioutil"
+ "regexp"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+const origConfig = `# config = "",`
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Nogo: "@//:nogo",
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "nogo")
+
+nogo(
+ name = "nogo",
+ deps = [
+ ":foofuncname",
+ ":importfmt",
+ ":visibility",
+ ],
+ # config = "",
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "importfmt",
+ srcs = ["importfmt.go"],
+ importpath = "importfmtanalyzer",
+ deps = ["@org_golang_x_tools//go/analysis"],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "foofuncname",
+ srcs = ["foofuncname.go"],
+ importpath = "foofuncanalyzer",
+ deps = ["@org_golang_x_tools//go/analysis"],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "visibility",
+ srcs = ["visibility.go"],
+ importpath = "visibilityanalyzer",
+ deps = [
+ "@org_golang_x_tools//go/analysis",
+ "@org_golang_x_tools//go/ast/inspector",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "has_errors",
+ srcs = ["has_errors.go"],
+ importpath = "haserrors",
+ deps = [":dep"],
+)
+
+go_library(
+ name = "has_errors_linedirective",
+ srcs = ["has_errors_linedirective.go"],
+ importpath = "haserrors_linedirective",
+ deps = [":dep"],
+)
+
+go_library(
+ name = "uses_cgo_with_errors",
+ srcs = [
+ "examplepkg/uses_cgo_clean.go",
+ "examplepkg/pure_src_with_err_calling_native.go",
+ ],
+ importpath = "examplepkg",
+ cgo = True,
+)
+
+go_library(
+ name = "no_errors",
+ srcs = ["no_errors.go"],
+ importpath = "noerrors",
+ deps = [":dep"],
+)
+
+go_library(
+ name = "dep",
+ srcs = ["dep.go"],
+ importpath = "dep",
+)
+
+-- foofuncname.go --
+// importfmt checks for functions named "Foo".
+// It has the same package name as another check to test the checks with
+// the same package name do not conflict.
+package importfmt
+
+import (
+ "go/ast"
+
+ "golang.org/x/tools/go/analysis"
+)
+
+const doc = "report calls of functions named \"Foo\"\n\nThe foofuncname analyzer reports calls to functions that are\nnamed \"Foo\"."
+
+var Analyzer = &analysis.Analyzer{
+ Name: "foofuncname",
+ Run: run,
+ Doc: doc,
+}
+
+func run(pass *analysis.Pass) (interface{}, error) {
+ for _, f := range pass.Files {
+ // TODO(samueltan): use package inspector once the latest golang.org/x/tools
+ // changes are pulled into this branch (see #1755).
+ ast.Inspect(f, func(n ast.Node) bool {
+ switch n := n.(type) {
+ case *ast.FuncDecl:
+ if n.Name.Name == "Foo" {
+ pass.Reportf(n.Pos(), "function must not be named Foo")
+ }
+ return true
+ }
+ return true
+ })
+ }
+ return nil, nil
+}
+
+-- importfmt.go --
+// importfmt checks for the import of package fmt.
+package importfmt
+
+import (
+ "go/ast"
+ "strconv"
+
+ "golang.org/x/tools/go/analysis"
+)
+
+const doc = "report imports of package fmt\n\nThe importfmt analyzer reports imports of package fmt."
+
+var Analyzer = &analysis.Analyzer{
+ Name: "importfmt",
+ Run: run,
+ Doc: doc,
+}
+
+func run(pass *analysis.Pass) (interface{}, error) {
+ for _, f := range pass.Files {
+ // TODO(samueltan): use package inspector once the latest golang.org/x/tools
+ // changes are pulled into this branch (see #1755).
+ ast.Inspect(f, func(n ast.Node) bool {
+ switch n := n.(type) {
+ case *ast.ImportSpec:
+ if path, _ := strconv.Unquote(n.Path.Value); path == "fmt" {
+ pass.Reportf(n.Pos(), "package fmt must not be imported")
+ }
+ return true
+ }
+ return true
+ })
+ }
+ return nil, nil
+}
+
+-- visibility.go --
+// visibility looks for visibility annotations on functions and
+// checks they are only called from packages allowed to call them.
+package visibility
+
+import (
+ "encoding/gob"
+ "go/ast"
+ "regexp"
+
+ "golang.org/x/tools/go/analysis"
+ "golang.org/x/tools/go/ast/inspector"
+)
+
+var Analyzer = &analysis.Analyzer{
+ Name: "visibility",
+ Run: run,
+ Doc: "enforce visibility requirements for functions\n\nThe visibility analyzer reads visibility annotations on functions and\nchecks that packages that call those functions are allowed to do so.",
+ FactTypes: []analysis.Fact{(*VisibilityFact)(nil)},
+}
+
+type VisibilityFact struct {
+ Paths []string
+}
+
+func (_ *VisibilityFact) AFact() {} // dummy method to satisfy interface
+
+func init() { gob.Register((*VisibilityFact)(nil)) }
+
+var visibilityRegexp = regexp.MustCompile("visibility:([^\\s]+)")
+
+func run(pass *analysis.Pass) (interface{}, error) {
+ in := inspector.New(pass.Files)
+
+ // Find visibility annotations on function declarations.
+ in.Nodes([]ast.Node{(*ast.FuncDecl)(nil)}, func(n ast.Node, push bool) (prune bool) {
+ if !push {
+ return false
+ }
+
+ fn := n.(*ast.FuncDecl)
+
+ if fn.Doc == nil {
+ return true
+ }
+ obj := pass.TypesInfo.ObjectOf(fn.Name)
+ if obj == nil {
+ return true
+ }
+ doc := fn.Doc.Text()
+
+ if matches := visibilityRegexp.FindAllStringSubmatch(doc, -1); matches != nil {
+ fact := &VisibilityFact{Paths: make([]string, len(matches))}
+ for i, m := range matches {
+ fact.Paths[i] = m[1]
+ }
+ pass.ExportObjectFact(obj, fact)
+ }
+
+ return true
+ })
+
+ // Find calls that may be affected by visibility declarations.
+ in.Nodes([]ast.Node{(*ast.CallExpr)(nil)}, func(n ast.Node, push bool) (prune bool) {
+ if !push {
+ return false
+ }
+
+ callee, ok := n.(*ast.CallExpr).Fun.(*ast.SelectorExpr)
+ if !ok {
+ return false
+ }
+ obj := pass.TypesInfo.ObjectOf(callee.Sel)
+ if obj == nil {
+ return false
+ }
+ var fact VisibilityFact
+ if ok := pass.ImportObjectFact(obj, &fact); !ok {
+ return false
+ }
+ visible := false
+ for _, path := range fact.Paths {
+ if path == pass.Pkg.Path() {
+ visible = true
+ break
+ }
+ }
+ if !visible {
+ pass.Reportf(callee.Pos(), "function %s is not visible in this package", callee.Sel.Name)
+ }
+
+ return false
+ })
+
+ return nil, nil
+}
+
+-- config.json --
+{
+ "importfmt": {
+ "only_files": {
+ "has_errors\\.go": ""
+ }
+ },
+ "foofuncname": {
+ "description": "no exemptions since we know this check is 100% accurate"
+ },
+ "visibility": {
+ "exclude_files": {
+ "has_.*\\.go": "special exception to visibility rules"
+ }
+ }
+}
+
+-- baseconfig.json --
+{
+ "_base": {
+ "exclude_files": {
+ "has_.*\\.go": "Visibility analyzer not specified. Still inherits this special exception."
+ }
+ },
+ "importfmt": {
+ "only_files": {
+ "has_errors\\.go": ""
+ }
+ },
+ "foofuncname": {
+ "description": "no exemptions since we know this check is 100% accurate, so override base config",
+ "exclude_files": {}
+ }
+}
+
+-- has_errors.go --
+package haserrors
+
+import (
+ _ "fmt" // This should fail importfmt
+
+ "dep"
+)
+
+func Foo() bool { // This should fail foofuncname
+ dep.D() // This should fail visibility
+ return true
+}
+
+-- has_errors_linedirective.go --
+//line linedirective.go:1
+package haserrors_linedirective
+
+import (
+ /*line linedirective_importfmt.go:4*/ _ "fmt" // This should fail importfmt
+
+ "dep"
+)
+
+//line linedirective_foofuncname.go:9
+func Foo() bool { // This should fail foofuncname
+//line linedirective_visibility.go:10
+ dep.D() // This should fail visibility
+ return true
+}
+
+-- no_errors.go --
+// package noerrors contains no analyzer errors.
+package noerrors
+
+import "dep"
+
+func Baz() int {
+ dep.D()
+ return 1
+}
+
+-- dep.go --
+package dep
+
+// visibility:noerrors
+func D() {
+}
+
+-- examplepkg/uses_cgo_clean.go --
+package examplepkg
+
+// #include <stdlib.h>
+import "C"
+
+func Bar() bool {
+ if C.rand() > 10 {
+ return true
+ }
+ return false
+}
+
+-- examplepkg/pure_src_with_err_calling_native.go --
+package examplepkg
+
+func Foo() bool { // This should fail foofuncname
+ return Bar()
+}
+
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ for _, test := range []struct {
+ desc, config, target string
+ wantSuccess bool
+ includes, excludes []string
+ }{
+ {
+ desc: "default_config",
+ target: "//:has_errors",
+ wantSuccess: false,
+ includes: []string{
+ `has_errors.go:.*package fmt must not be imported \(importfmt\)`,
+ `has_errors.go:.*function must not be named Foo \(foofuncname\)`,
+ `has_errors.go:.*function D is not visible in this package \(visibility\)`,
+ },
+ }, {
+ desc: "default_config_linedirective",
+ target: "//:has_errors_linedirective",
+ wantSuccess: false,
+ includes: []string{
+ `linedirective_importfmt.go:.*package fmt must not be imported \(importfmt\)`,
+ `linedirective_foofuncname.go:.*function must not be named Foo \(foofuncname\)`,
+ `linedirective_visibility.go:.*function D is not visible in this package \(visibility\)`,
+ },
+ }, {
+ desc: "custom_config",
+ config: "config.json",
+ target: "//:has_errors",
+ wantSuccess: false,
+ includes: []string{
+ `has_errors.go:.*package fmt must not be imported \(importfmt\)`,
+ `has_errors.go:.*function must not be named Foo \(foofuncname\)`,
+ },
+ excludes: []string{
+ `visib`,
+ },
+ }, {
+ desc: "custom_config_linedirective",
+ config: "config.json",
+ target: "//:has_errors_linedirective",
+ wantSuccess: false,
+ includes: []string{
+ `linedirective_foofuncname.go:.*function must not be named Foo \(foofuncname\)`,
+ `linedirective_visibility.go:.*function D is not visible in this package \(visibility\)`,
+ },
+ excludes: []string{
+ `importfmt`,
+ },
+ }, {
+ desc: "custom_config_with_base_linedirective",
+ config: "baseconfig.json",
+ target: "//:has_errors_linedirective",
+ wantSuccess: false,
+ includes: []string{
+ `linedirective_foofuncname.go:.*function must not be named Foo \(foofuncname\)`,
+ `linedirective_visibility.go:.*function D is not visible in this package \(visibility\)`,
+ },
+ excludes: []string{
+ `importfmt`,
+ },
+ }, {
+ desc: "uses_cgo_with_errors",
+ config: "config.json",
+ target: "//:uses_cgo_with_errors",
+ wantSuccess: false,
+ includes: []string{
+ // note the cross platform regex :)
+ `.*[\\/]cgo[\\/]examplepkg[\\/]pure_src_with_err_calling_native.go:.*function must not be named Foo \(foofuncname\)`,
+ },
+ }, {
+ desc: "no_errors",
+ target: "//:no_errors",
+ wantSuccess: true,
+ excludes: []string{"no_errors.go"},
+ },
+ } {
+ t.Run(test.desc, func(t *testing.T) {
+ if test.config != "" {
+ customConfig := fmt.Sprintf("config = %q,", test.config)
+ if err := replaceInFile("BUILD.bazel", origConfig, customConfig); err != nil {
+ t.Fatal(err)
+ }
+ defer replaceInFile("BUILD.bazel", customConfig, origConfig)
+ }
+
+ cmd := bazel_testing.BazelCmd("build", test.target)
+ stderr := &bytes.Buffer{}
+ cmd.Stderr = stderr
+ if err := cmd.Run(); err == nil && !test.wantSuccess {
+ t.Fatal("unexpected success")
+ } else if err != nil && test.wantSuccess {
+ t.Fatalf("unexpected error: %v", err)
+ }
+
+ for _, pattern := range test.includes {
+ if matched, err := regexp.Match(pattern, stderr.Bytes()); err != nil {
+ t.Fatal(err)
+ } else if !matched {
+ t.Errorf("got output:\n %s\n which does not contain pattern: %s", string(stderr.Bytes()), pattern)
+ }
+ }
+ for _, pattern := range test.excludes {
+ if matched, err := regexp.Match(pattern, stderr.Bytes()); err != nil {
+ t.Fatal(err)
+ } else if matched {
+ t.Errorf("output contained pattern: %s", pattern)
+ }
+ }
+ })
+ }
+}
+
+func replaceInFile(path, old, new string) error {
+ data, err := ioutil.ReadFile(path)
+ if err != nil {
+ return err
+ }
+ data = bytes.ReplaceAll(data, []byte(old), []byte(new))
+ return ioutil.WriteFile(path, data, 0666)
+}
diff --git a/tests/core/nogo/custom/flags/BUILD.bazel b/tests/core/nogo/custom/flags/BUILD.bazel
new file mode 100644
index 00000000..cdf4c76a
--- /dev/null
+++ b/tests/core/nogo/custom/flags/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "flags_test",
+ srcs = ["flags_test.go"],
+)
diff --git a/tests/core/nogo/custom/flags/README.rst b/tests/core/nogo/custom/flags/README.rst
new file mode 100644
index 00000000..e525250b
--- /dev/null
+++ b/tests/core/nogo/custom/flags/README.rst
@@ -0,0 +1,19 @@
+Custom nogo analyzer flags
+=====================
+
+.. _nogo: /go/nogo.rst
+.. _go_library: /docs/go/core/rules.md#_go_library
+
+Tests to ensure that custom `nogo`_ analyzers that consume flags can be
+supplied those flags via nono config.
+
+.. contents::
+
+flags_test
+-----------
+Verifies that a simple custom analyzer's behavior can be modified by setting
+its analyzer flags in the nogo driver, and that these flags can be provided to
+the driver via the nogo config `analyzer_flags` field. Also checks that
+invalid flags as defined by the `flag` package cause the driver to immediately
+return an error.
+
diff --git a/tests/core/nogo/custom/flags/flags_test.go b/tests/core/nogo/custom/flags/flags_test.go
new file mode 100644
index 00000000..7381a3f0
--- /dev/null
+++ b/tests/core/nogo/custom/flags/flags_test.go
@@ -0,0 +1,262 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package flags_test
+
+import (
+ "bytes"
+ "fmt"
+ "io/ioutil"
+ "regexp"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+const origConfig = `# config = "",`
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Nogo: "@//:nogo",
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "nogo")
+
+nogo(
+ name = "nogo",
+ deps = [
+ ":flagger",
+ ],
+ # config = "",
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "flagger",
+ srcs = ["flagger.go"],
+ importpath = "flaggeranalyzer",
+ deps = [
+ "@org_golang_x_tools//go/analysis",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "some_file",
+ srcs = ["some_file.go"],
+ importpath = "somefile",
+ deps = [":dep"],
+)
+
+go_library(
+ name = "dep",
+ srcs = ["dep.go"],
+ importpath = "dep",
+)
+
+-- flagger.go --
+// flagger crashes when three flags are set in the config or else it no-ops
+package flagger
+
+import (
+ "errors"
+
+ "golang.org/x/tools/go/analysis"
+)
+
+var (
+ boolSwitch bool
+ stringSwitch string
+ intSwitch int
+)
+
+var Analyzer = &analysis.Analyzer{
+ Name: "flagger",
+ Run: run,
+ Doc: "Dummy analyzer that crashes when all its flags are set correctly",
+}
+
+func init() {
+ Analyzer.Flags.BoolVar(&boolSwitch, "bool-switch", false, "Bool must be set to true to run")
+ Analyzer.Flags.StringVar(&stringSwitch, "string-switch", "no", "String must be set to \"yes\" to run")
+ Analyzer.Flags.IntVar(&intSwitch, "int-switch", 0, "Int must be set to 1 to run")
+}
+
+func run(pass *analysis.Pass) (interface{}, error) {
+ if !boolSwitch {
+ return nil, nil
+ }
+ if stringSwitch != "yes" {
+ return nil, nil
+ }
+ if intSwitch != 1 {
+ return nil, nil
+ }
+ return nil, errors.New("all switches were set -> fail")
+}
+
+-- all_flags_set.json --
+{
+ "flagger": {
+ "description": "this will crash on every file",
+ "analyzer_flags": {
+ "bool-switch": "true",
+ "int-switch": "1",
+ "string-switch": "yes"
+ }
+ }
+}
+
+-- two_flags_set.json --
+{
+ "flagger": {
+ "description": "this will succeed on every file",
+ "analyzer_flags": {
+ "bool-switch": "true",
+ "int-switch": "1"
+ }
+ }
+}
+
+-- invalid_int.json --
+{
+ "flagger": {
+ "description": "this will crash immediately due to an invalid int flag",
+ "analyzer_flags": {
+ "int-switch": "one",
+ "string-switch": "yes"
+ }
+ }
+}
+
+-- nonexistent_flag.json --
+{
+ "flagger": {
+ "description": "this will crash immediately due to a nonexistent flag",
+ "analyzer_flags": {
+ "int-switch": "1",
+ "bool-switch": "true",
+ "string-switch": "yes",
+ "description": "This is a good analyzer"
+ }
+ }
+}
+
+-- hyphenated_flag.json --
+{
+ "flagger": {
+ "description": "this will crash immediately due to a hyphenated flag",
+ "analyzer_flags": {
+ "-int-switch": "1"
+ }
+ }
+}
+
+-- some_file.go --
+// package somefile contains a file and has a dep
+package somefile
+
+import "dep"
+
+func Baz() int {
+ dep.D()
+ return 1
+}
+
+-- dep.go --
+package dep
+
+func D() {
+}
+
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ for _, test := range []struct {
+ desc, config string
+ wantSuccess bool
+ includes, excludes []string
+ }{
+ {
+ desc: "config_flags_triggering_error",
+ wantSuccess: false,
+ config: "all_flags_set.json",
+ includes: []string{"all switches were set -> fail"},
+ }, {
+ desc: "config_flags_triggering_success",
+ wantSuccess: true,
+ config: "two_flags_set.json",
+ }, {
+ desc: "invalid_int_triggering_error",
+ wantSuccess: false,
+ config: "invalid_int.json",
+ includes: []string{"flagger: invalid value for flag: int-switch=one"},
+ }, {
+ desc: "nonexistent_flag_triggering_error",
+ wantSuccess: false,
+ config: "nonexistent_flag.json",
+ includes: []string{"flagger: unrecognized flag: description"},
+ }, {
+ desc: "hyphenated_flag_triggering_error",
+ wantSuccess: false,
+ config: "hyphenated_flag.json",
+ includes: []string{"flagger: flag should not begin with '-': -int-switch"},
+ },
+ } {
+ t.Run(test.desc, func(t *testing.T) {
+ if test.config != "" {
+ customConfig := fmt.Sprintf("config = %q,", test.config)
+ if err := replaceInFile("BUILD.bazel", origConfig, customConfig); err != nil {
+ t.Fatal(err)
+ }
+ defer replaceInFile("BUILD.bazel", customConfig, origConfig)
+ }
+
+ cmd := bazel_testing.BazelCmd("build", "//:some_file")
+ stderr := &bytes.Buffer{}
+ cmd.Stderr = stderr
+ if err := cmd.Run(); err == nil && !test.wantSuccess {
+ t.Fatal("unexpected success")
+ } else if err != nil && test.wantSuccess {
+ t.Fatalf("unexpected error: %v", err)
+ }
+
+ for _, pattern := range test.includes {
+ if matched, err := regexp.Match(pattern, stderr.Bytes()); err != nil {
+ t.Fatal(err)
+ } else if !matched {
+ t.Errorf("got output:\n %s\n which does not contain pattern: %s", string(stderr.Bytes()), pattern)
+ }
+ }
+ for _, pattern := range test.excludes {
+ if matched, err := regexp.Match(pattern, stderr.Bytes()); err != nil {
+ t.Fatal(err)
+ } else if matched {
+ t.Errorf("output contained pattern: %s", pattern)
+ }
+ }
+ })
+ }
+}
+
+func replaceInFile(path, old, new string) error {
+ data, err := ioutil.ReadFile(path)
+ if err != nil {
+ return err
+ }
+ data = bytes.ReplaceAll(data, []byte(old), []byte(new))
+ return ioutil.WriteFile(path, data, 0666)
+}
diff --git a/tests/core/nogo/deps/BUILD.bazel b/tests/core/nogo/deps/BUILD.bazel
new file mode 100644
index 00000000..a1d998fd
--- /dev/null
+++ b/tests/core/nogo/deps/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "deps_test",
+ srcs = ["deps_test.go"],
+)
diff --git a/tests/core/nogo/deps/README.rst b/tests/core/nogo/deps/README.rst
new file mode 100644
index 00000000..93affd23
--- /dev/null
+++ b/tests/core/nogo/deps/README.rst
@@ -0,0 +1,26 @@
+nogo analyzers with dependencies
+=============================
+
+.. _nogo: /go/nogo.rst
+.. _go_library: /docs/go/core/rules.md#_go_library
+
+Tests to ensure that custom `nogo`_ analyzers that depend on each other are
+run in the correct order.
+
+.. contents::
+
+deps_test
+---------
+Given the following dependency graph of analyzers:
+
+ a ----+
+ |
+ v
+ b --> c --> d
+
+Where analyzers a, b, c are explicitly depended on by the `nogo`_ rule and d
+isn't, verifies that a `go_library`_ build causes both paths in the graph
+(a->c->d and b->c->d) to be executed, and that each analyzer runs exactly once.
+
+Also verify that the diagnostics reported by d are not printed to the build log
+since d was not explicitly depended on by the declared `nogo`_ rule.
diff --git a/tests/core/nogo/deps/deps_test.go b/tests/core/nogo/deps/deps_test.go
new file mode 100644
index 00000000..f527effd
--- /dev/null
+++ b/tests/core/nogo/deps/deps_test.go
@@ -0,0 +1,211 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package deps_test
+
+import (
+ "bytes"
+ "regexp"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Nogo: "@//:nogo",
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "nogo")
+
+nogo(
+ name = "nogo",
+ deps = [
+ ":a",
+ ":b",
+ ":c",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "a",
+ srcs = ["a.go"],
+ importpath = "a",
+ deps = [
+ ":c",
+ "@org_golang_x_tools//go/analysis"
+ ],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "b",
+ srcs = ["b.go"],
+ importpath = "b",
+ deps = [
+ ":c",
+ "@org_golang_x_tools//go/analysis"
+ ],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "c",
+ srcs = ["c.go"],
+ importpath = "c",
+ deps = [
+ ":d",
+ "@org_golang_x_tools//go/analysis"
+ ],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "d",
+ srcs = ["d.go"],
+ importpath = "d",
+ deps = ["@org_golang_x_tools//go/analysis"],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "src",
+ srcs = ["src.go"],
+ importpath = "src",
+)
+
+-- a.go --
+package a
+
+import (
+ "c"
+ "go/token"
+
+ "golang.org/x/tools/go/analysis"
+)
+
+var Analyzer = &analysis.Analyzer{
+ Name: "a",
+ Doc: "an analyzer that depends on c.Analyzer",
+ Run: run,
+ Requires: []*analysis.Analyzer{c.Analyzer},
+}
+
+func run(pass *analysis.Pass) (interface{}, error) {
+ pass.Reportf(token.NoPos, "a %s", pass.ResultOf[c.Analyzer])
+ return nil, nil
+}
+
+-- b.go --
+package b
+
+import (
+ "c"
+ "go/token"
+
+ "golang.org/x/tools/go/analysis"
+)
+
+var Analyzer = &analysis.Analyzer{
+ Name: "b",
+ Doc: "an analyzer that depends on c.Analyzer",
+ Run: run,
+ Requires: []*analysis.Analyzer{c.Analyzer},
+}
+
+func run(pass *analysis.Pass) (interface{}, error) {
+ pass.Reportf(token.NoPos, "b %s", pass.ResultOf[c.Analyzer])
+ return nil, nil
+}
+
+-- c.go --
+package c
+
+import (
+ "d"
+ "fmt"
+ "go/token"
+ "reflect"
+
+ "golang.org/x/tools/go/analysis"
+)
+
+var Analyzer = &analysis.Analyzer{
+ Name: "c",
+ Doc: "an analyzer that depends on d.Analyzer",
+ Run: run,
+ Requires: []*analysis.Analyzer{d.Analyzer},
+ ResultType: reflect.TypeOf(""),
+}
+
+func run(pass *analysis.Pass) (interface{}, error) {
+ pass.Reportf(token.NoPos, "only printed once")
+ return fmt.Sprintf("c %s", pass.ResultOf[d.Analyzer]), nil
+}
+
+-- d.go --
+package d
+
+import (
+ "go/token"
+ "reflect"
+
+ "golang.org/x/tools/go/analysis"
+)
+
+var Analyzer = &analysis.Analyzer{
+ Name: "d",
+ Doc: "an analyzer that does not depend on other analyzers",
+ Run: run,
+ ResultType: reflect.TypeOf(""),
+}
+
+func run(pass *analysis.Pass) (interface{}, error) {
+ pass.Reportf(token.NoPos, "this should not be printed")
+ return "d", nil
+}
+
+-- src.go --
+package src
+
+func Foo() int {
+ return 1
+}
+
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ cmd := bazel_testing.BazelCmd("build", "//:src")
+ stderr := &bytes.Buffer{}
+ cmd.Stderr = stderr
+ if err := cmd.Run(); err == nil {
+ t.Fatal("unexpected success")
+ }
+
+ for _, pattern := range []string{
+ "a c d",
+ "b c d",
+ "only printed once",
+ } {
+ if matched, _ := regexp.Match(pattern, stderr.Bytes()); !matched {
+ t.Errorf("output does not contain pattern: %s", pattern)
+ }
+ }
+ if bytes.Contains(stderr.Bytes(), []byte("this should not be printed")) {
+ t.Errorf("%q was printed", "this should not be printed")
+ }
+}
diff --git a/tests/core/nogo/generate/BUILD.bazel b/tests/core/nogo/generate/BUILD.bazel
new file mode 100644
index 00000000..52567b61
--- /dev/null
+++ b/tests/core/nogo/generate/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "empty_test",
+ srcs = ["empty_test.go"],
+)
diff --git a/tests/core/nogo/generate/README.rst b/tests/core/nogo/generate/README.rst
new file mode 100644
index 00000000..d9604fab
--- /dev/null
+++ b/tests/core/nogo/generate/README.rst
@@ -0,0 +1,12 @@
+nogo test with generated code
+=======================
+
+.. _nogo: /go/nogo.rst
+
+Tests to ensure `nogo`_ interaction with generated code.
+
+empty_test
+-------------
+Checks that `nogo`_ is not running over the `_empty.go` file that was
+generated as part of GoCompilePkg.
+
diff --git a/tests/core/nogo/generate/empty_test.go b/tests/core/nogo/generate/empty_test.go
new file mode 100644
index 00000000..a4f8de12
--- /dev/null
+++ b/tests/core/nogo/generate/empty_test.go
@@ -0,0 +1,102 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package empty_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test", "nogo")
+
+go_test(
+ name = "simple_test",
+ size = "small",
+ srcs = ["simple_test.go"],
+)
+
+nogo(
+ name = "nogo",
+ deps = ["//noempty"],
+ visibility = ["//visibility:public"],
+)
+-- simple_test.go --
+package simple
+
+import (
+ "testing"
+)
+
+func TestFoo(t *testing.T) {
+}
+-- noempty/BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "noempty",
+ srcs = ["analyzer.go"],
+ importpath = "noempty",
+ visibility = ["//visibility:public"],
+ deps = [
+ "@org_golang_x_tools//go/analysis",
+ ],
+)
+-- noempty/analyzer.go --
+package noempty
+
+import (
+ "fmt"
+ "path/filepath"
+ "strings"
+
+ "golang.org/x/tools/go/analysis"
+)
+
+var Analyzer = &analysis.Analyzer{
+ Name: "noempty",
+ Doc: "noempty ensure that source code was not a generated file created by rules_go test rewrite",
+ Run: run,
+}
+
+func run(pass *analysis.Pass) (interface{}, error) {
+ for _, f := range pass.Files {
+ pos := pass.Fset.PositionFor(f.Pos(), false)
+
+ if strings.HasSuffix(pos.Filename, filepath.Join(".", "_empty.go")) {
+ pass.Report(analysis.Diagnostic{
+ Pos: 0,
+ Message: fmt.Sprintf("Detected generated source code from rules_go: %s", pos.Filename),
+ })
+ }
+ }
+
+ return nil, nil
+}
+`,
+ Nogo: `@//:nogo`,
+ })
+}
+
+func TestNogoGenEmptyCode(t *testing.T) {
+ if out, err := bazel_testing.BazelOutput("build", "-k", "//:simple_test"); err != nil {
+ println(string(out))
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/nogo/generics/BUILD.bazel b/tests/core/nogo/generics/BUILD.bazel
new file mode 100644
index 00000000..a40df345
--- /dev/null
+++ b/tests/core/nogo/generics/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "generics_test",
+ srcs = ["generics_test.go"],
+)
diff --git a/tests/core/nogo/generics/README.rst b/tests/core/nogo/generics/README.rst
new file mode 100644
index 00000000..c348a992
--- /dev/null
+++ b/tests/core/nogo/generics/README.rst
@@ -0,0 +1,18 @@
+nogo analyzers run against code using generics
+==============================================
+
+.. _nogo: /go/nogo.rst
+.. _buildssa: https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/buildssa
+.. _nilness: https://pkg.go.dev/golang.org/x/tools/go/analysis/passes/nilness
+
+Tests to ensure that `nogo`_ analyzers that run on code using generics get correct
+type instantiation information.
+
+.. contents::
+
+generics_test
+-------------
+
+Verifies that code using generic types gets loaded including all type instantiation
+information, so that analyzers based on the `buildssa`_ analyzer (such as `nilness`_) get
+a complete picture of all types in the code.
diff --git a/tests/core/nogo/generics/generics_test.go b/tests/core/nogo/generics/generics_test.go
new file mode 100644
index 00000000..562d52ed
--- /dev/null
+++ b/tests/core/nogo/generics/generics_test.go
@@ -0,0 +1,85 @@
+// Copyright 2022 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package generics_test
+
+import (
+ "bytes"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Nogo: "@//:nogo",
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "nogo")
+
+nogo(
+ name = "nogo",
+ visibility = ["//visibility:public"],
+ deps = ["@org_golang_x_tools//go/analysis/passes/buildssa"],
+)
+
+go_library(
+ name = "src",
+ srcs = ["src.go"],
+ importpath = "src",
+)
+
+-- src.go --
+package src
+
+type Set[T comparable] struct {
+ m map[T]struct{}
+}
+
+func New[T comparable](s ...T) *Set[T] {
+ set := &Set[T]{}
+ set.Add(s...)
+ return set
+}
+
+func (set *Set[T]) Add(s ...T) {
+ if set.m == nil {
+ set.m = make(map[T]struct{})
+ }
+ for _, s := range s {
+ set.m[s] = struct{}{}
+ }
+}
+
+func S(x ...string) *Set[string] {
+ return New[string](x...)
+}
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ cmd := bazel_testing.BazelCmd("build", "//:src")
+ var stderr bytes.Buffer
+ cmd.Stderr = &stderr
+
+ if err := cmd.Run(); err != nil {
+ t.Log("output:", stderr.String())
+ t.Fatal("unexpected error:", err)
+ }
+
+ if bytes.Contains(stderr.Bytes(), []byte("panic")) {
+ t.Errorf("found panic in Bazel output: \n%s", stderr.String())
+ }
+}
diff --git a/tests/core/nogo/nolint/BUILD.bazel b/tests/core/nogo/nolint/BUILD.bazel
new file mode 100644
index 00000000..c828045c
--- /dev/null
+++ b/tests/core/nogo/nolint/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "nolint_test",
+ srcs = ["nolint_test.go"],
+)
diff --git a/tests/core/nogo/nolint/README.rst b/tests/core/nogo/nolint/README.rst
new file mode 100644
index 00000000..83436898
--- /dev/null
+++ b/tests/core/nogo/nolint/README.rst
@@ -0,0 +1,14 @@
+Nolint check
+=========
+
+.. _go_library: /docs/go/core/rules.md#_go_library
+
+Tests to ensure that errors found by nogo and annotated with //nolint are
+ignored.
+
+.. contents::
+
+nolint_test
+--------
+Verified that errors emitted by ``nogo`` are ignored when `//nolint` appears as
+a comment.
diff --git a/tests/core/nogo/nolint/nolint_test.go b/tests/core/nogo/nolint/nolint_test.go
new file mode 100644
index 00000000..78ecbbcf
--- /dev/null
+++ b/tests/core/nogo/nolint/nolint_test.go
@@ -0,0 +1,227 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package nolint_test
+
+import (
+ "bytes"
+ "io/ioutil"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_tool_library", "nogo")
+
+nogo(
+ name = "nogo",
+ vet = True,
+ deps = ["@org_golang_x_tools//go/analysis/passes/nilness"],
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "inline",
+ srcs = ["inline.go"],
+ importpath = "test",
+)
+
+go_library(
+ name = "inline_filter",
+ srcs = ["inline_filter.go"],
+ importpath = "test",
+)
+
+go_library(
+ name = "block",
+ srcs = ["block.go"],
+ importpath = "test",
+)
+
+go_library(
+ name = "block_multiline",
+ srcs = ["block_multiline.go"],
+ importpath = "test",
+)
+
+go_library(
+ name = "inline_errors",
+ srcs = ["inline_errors.go"],
+ importpath = "test",
+)
+
+go_library(
+ name = "inline_column",
+ srcs = ["inline_column.go"],
+ importpath = "test",
+)
+
+go_library(
+ name = "large_block",
+ srcs = ["large_block.go"],
+ importpath = "test",
+)
+-- inline.go --
+package test
+
+import "fmt"
+
+func F() {
+ s := "hello"
+ fmt.Printf("%d", s) //nolint
+}
+
+-- inline_filter.go --
+package test
+
+func F() bool {
+ return true || true //nolint:bools
+}
+
+-- block.go --
+package test
+
+import "fmt"
+
+func F() {
+ //nolint
+ fmt.Printf("%d", "hello")
+}
+
+-- block_multiline.go --
+package test
+
+func F() bool {
+ var i *int
+ //nolint
+ return true &&
+ i != nil
+}
+
+-- inline_errors.go --
+package test
+
+import "fmt"
+
+func F() {
+ var i *int
+ if i == nil {
+ fmt.Printf("%d", "hello") //nolint
+ fmt.Println(*i) // Keep nil deref error
+ }
+}
+
+-- inline_column.go --
+package test
+
+import "fmt"
+
+func F() {
+ // Purposely used 'helo' to align the column
+ fmt.Printf("%d", "helo") //nolint
+ superLongVariableName := true || true
+ var _ = superLongVariableName
+}
+
+-- large_block.go --
+package test
+
+import "fmt"
+
+var V = struct {
+ S string
+ B bool
+} {
+ S: fmt.Sprintf("%d", "hello"), //nolint
+ B: true || true,
+}
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ customRegister := `go_register_toolchains(nogo = "@//:nogo")`
+ if err := replaceInFile("WORKSPACE", "go_register_toolchains()", customRegister); err != nil {
+ t.Fatal(err)
+ }
+
+ tests := []struct {
+ Name string
+ Target string
+ Expected string
+ }{
+ {
+ Name: "Inline comment",
+ Target: "//:inline",
+ },
+ {
+ Name: "Inline with lint filter",
+ Target: "//:inline_filter",
+ },
+ {
+ Name: "Block comment",
+ Target: "//:block",
+ },
+ {
+ Name: "Multiline block comment",
+ Target: "//:block_multiline",
+ },
+ {
+ Name: "Inline with errors",
+ Target: "//:inline_errors",
+ Expected: "inline_errors.go:9:15: nil dereference in load (nilness)",
+ },
+ {
+ Name: "Inline comment on same column does not apply",
+ Target: "//:inline_column",
+ Expected: "inline_column.go:8:27: redundant or: true || true (bools)",
+ },
+ {
+ Name: "Inline comment does not apply to larger block",
+ Target: "//:large_block",
+ Expected: "large_block.go:10:5: redundant or: true || true (bools)",
+ },
+ }
+
+ for _, tc := range tests {
+ t.Run(tc.Name, func(t *testing.T) {
+ cmd := bazel_testing.BazelCmd("build", tc.Target)
+ b, err := cmd.CombinedOutput()
+ output := string(b)
+ if tc.Expected != "" && err == nil {
+ t.Fatal("unexpected success", output)
+ }
+ if tc.Expected == "" && err != nil {
+ t.Fatal("unexpected failure", output)
+ }
+ if !strings.Contains(output, tc.Expected) {
+ t.Errorf("output did not contain expected: %s\n%s", tc.Expected, output)
+ }
+ })
+ }
+}
+
+func replaceInFile(path, old, new string) error {
+ data, err := ioutil.ReadFile(path)
+ if err != nil {
+ return err
+ }
+ data = bytes.ReplaceAll(data, []byte(old), []byte(new))
+ return ioutil.WriteFile(path, data, 0666)
+}
diff --git a/tests/core/nogo/vet/BUILD.bazel b/tests/core/nogo/vet/BUILD.bazel
new file mode 100644
index 00000000..b01e0482
--- /dev/null
+++ b/tests/core/nogo/vet/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "vet_test",
+ srcs = ["vet_test.go"],
+)
diff --git a/tests/core/nogo/vet/README.rst b/tests/core/nogo/vet/README.rst
new file mode 100644
index 00000000..28f95c0e
--- /dev/null
+++ b/tests/core/nogo/vet/README.rst
@@ -0,0 +1,14 @@
+Vet check
+=========
+
+.. _go_library: /docs/go/core/rules.md#_go_library
+
+Tests to ensure that vet runs and detects errors.
+
+.. contents::
+
+vet_test
+--------
+Verifies that vet errors are emitted on a `go_library`_ with problems when built
+with a ``nogo`` binary with ``vet = True``. No errors should be emitted when
+analyzing error-free source code. Vet should not be enabled by default.
diff --git a/tests/core/nogo/vet/vet_test.go b/tests/core/nogo/vet/vet_test.go
new file mode 100644
index 00000000..4bc2163f
--- /dev/null
+++ b/tests/core/nogo/vet/vet_test.go
@@ -0,0 +1,179 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package vet_test
+
+import (
+ "bytes"
+ "fmt"
+ "io/ioutil"
+ "regexp"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_tool_library", "nogo")
+
+nogo(
+ name = "nogo",
+ vet = True,
+ visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "has_errors",
+ srcs = ["has_errors.go"],
+ importpath = "haserrors",
+ deps = [":fmtwrap"],
+)
+
+go_library(
+ name = "no_errors",
+ srcs = ["no_errors.go"],
+ cgo = True,
+ importpath = "noerrors",
+)
+
+go_library(
+ name = "fmtwrap",
+ srcs = ["fmtwrap.go"],
+ importpath = "fmtwrap",
+)
+
+-- has_errors.go --
+package haserrors
+
+// +build build_tags_error
+
+import (
+ "fmtwrap"
+ "sync/atomic"
+)
+
+func F() {}
+
+func Foo() bool {
+ x := uint64(1)
+ _ = atomic.AddUint64(&x, 1)
+ if F == nil { // nilfunc error.
+ return false
+ }
+ fmtwrap.Printf("%b", "hi") // printf error.
+ return true || true // redundant boolean error.
+}
+
+-- no_errors.go --
+package noerrors
+
+// const int x = 1;
+import "C"
+
+func Foo() bool {
+ return bool(C.x == 1)
+}
+
+-- fmtwrap.go --
+package fmtwrap
+
+import "fmt"
+
+func Printf(format string, args ...interface{}) {
+ fmt.Printf(format, args...)
+}
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ for _, test := range []struct {
+ desc, nogo, target string
+ wantSuccess bool
+ includes, excludes []string
+ }{
+ {
+ desc: "default",
+ target: "//:has_errors",
+ wantSuccess: true,
+ excludes: []string{
+ "\\+build comment must appear before package clause and be followed by a blank line",
+ "comparison of function F == nil is always false",
+ "Printf format %b has arg \"hi\" of wrong type string",
+ "redundant or: true \\|\\| true",
+ },
+ }, {
+ desc: "enabled_no_errors",
+ target: "//:no_errors",
+ wantSuccess: true,
+ }, {
+ desc: "enabled_has_errors",
+ nogo: "@//:nogo",
+ target: "//:has_errors",
+ includes: []string{
+ "misplaced \\+build comment",
+ "comparison of function F == nil is always false",
+ "Printf format %b has arg \"hi\" of wrong type string",
+ "redundant or: true \\|\\| true",
+ },
+ },
+ } {
+ t.Run(test.desc, func(t *testing.T) {
+ if test.nogo != "" {
+ origRegister := "go_register_toolchains()"
+ customRegister := fmt.Sprintf("go_register_toolchains(nogo = %q)", test.nogo)
+ if err := replaceInFile("WORKSPACE", origRegister, customRegister); err != nil {
+ t.Fatal(err)
+ }
+ defer replaceInFile("WORKSPACE", customRegister, origRegister)
+ }
+
+ cmd := bazel_testing.BazelCmd("build", test.target)
+ stderr := &bytes.Buffer{}
+ cmd.Stderr = stderr
+ if err := cmd.Run(); err == nil && !test.wantSuccess {
+ t.Fatal("unexpected success")
+ } else if err != nil && test.wantSuccess {
+ t.Fatalf("unexpected error: %v", err)
+ }
+
+ for _, pattern := range test.includes {
+ if matched, err := regexp.Match(pattern, stderr.Bytes()); err != nil {
+ t.Fatal(err)
+ } else if !matched {
+ t.Errorf("output did not contain pattern: %s", pattern)
+ }
+ }
+ for _, pattern := range test.excludes {
+ if matched, err := regexp.Match(pattern, stderr.Bytes()); err != nil {
+ t.Fatal(err)
+ } else if matched {
+ t.Errorf("output contained pattern: %s", pattern)
+ }
+ }
+ })
+ }
+}
+
+func replaceInFile(path, old, new string) error {
+ data, err := ioutil.ReadFile(path)
+ if err != nil {
+ return err
+ }
+ data = bytes.ReplaceAll(data, []byte(old), []byte(new))
+ return ioutil.WriteFile(path, data, 0666)
+}
diff --git a/tests/core/output_groups/BUILD.bazel b/tests/core/output_groups/BUILD.bazel
new file mode 100644
index 00000000..ec8b86c9
--- /dev/null
+++ b/tests/core/output_groups/BUILD.bazel
@@ -0,0 +1,36 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
+
+go_library(
+ name = "lib",
+ srcs = ["lib.go"],
+ importpath = "lib",
+)
+
+go_test(
+ name = "lib_test",
+ srcs = ["lib_test.go"],
+ embed = [":lib"],
+)
+
+go_binary(
+ name = "bin",
+ srcs = ["bin.go"],
+)
+
+filegroup(
+ name = "compilation_outputs",
+ testonly = True,
+ srcs = [
+ ":bin",
+ ":lib",
+ ":lib_test",
+ ],
+ output_group = "compilation_outputs",
+)
+
+go_test(
+ name = "compilation_outputs_test",
+ srcs = ["compilation_outputs_test.go"],
+ data = [":compilation_outputs"],
+ deps = ["//go/tools/bazel:go_default_library"],
+)
diff --git a/tests/core/output_groups/README.rst b/tests/core/output_groups/README.rst
new file mode 100644
index 00000000..5d3d4e41
--- /dev/null
+++ b/tests/core/output_groups/README.rst
@@ -0,0 +1,10 @@
+output_groups functionality
+===========================
+
+Tests to ensure the supported `output_groups` are working as expected.
+
+compilation_outputs_test
+------------------------
+
+Checks that the `compilation_outputs` output group is populated with the
+compiled archives from `go_library`, `go_test`, and `go_binary` targets.
diff --git a/tests/core/output_groups/bin.go b/tests/core/output_groups/bin.go
new file mode 100644
index 00000000..38dd16da
--- /dev/null
+++ b/tests/core/output_groups/bin.go
@@ -0,0 +1,3 @@
+package main
+
+func main() {}
diff --git a/tests/core/output_groups/compilation_outputs_test.go b/tests/core/output_groups/compilation_outputs_test.go
new file mode 100644
index 00000000..25daced7
--- /dev/null
+++ b/tests/core/output_groups/compilation_outputs_test.go
@@ -0,0 +1,59 @@
+package output_groups
+
+import (
+ "os"
+ "path/filepath"
+ "runtime"
+ "sort"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+)
+
+func TestCompilationOutputs(t *testing.T) {
+ runfiles, err := bazel.ListRunfiles()
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ exe := ""
+ if runtime.GOOS == "windows" {
+ exe = ".exe"
+ }
+ expectedFiles := map[string]bool{
+ "compilation_outputs_test" + exe: true, // test binary; not relevant
+
+ "lib.a": false, // :lib archive
+ "lib_test.internal.a": false, // :lib_test archive
+ "bin.a": false, // :bin archive
+ }
+ for _, rf := range runfiles {
+ info, err := os.Stat(rf.Path)
+ if err != nil {
+ t.Error(err)
+ continue
+ }
+ if info.IsDir() {
+ continue
+ }
+
+ base := filepath.Base(rf.Path)
+ if seen, ok := expectedFiles[base]; !ok {
+ t.Errorf("unexpected runfile: %s %s", rf.Path, base)
+ } else if !seen {
+ expectedFiles[base] = true
+ }
+ }
+
+ missingFiles := make([]string, 0, len(expectedFiles))
+ for path, seen := range expectedFiles {
+ if !seen {
+ missingFiles = append(missingFiles, path)
+ }
+ }
+ sort.Strings(missingFiles)
+ if len(missingFiles) > 0 {
+ t.Errorf("did not find expected files: %s", strings.Join(missingFiles, " "))
+ }
+}
diff --git a/tests/core/output_groups/lib.go b/tests/core/output_groups/lib.go
new file mode 100644
index 00000000..55c21f80
--- /dev/null
+++ b/tests/core/output_groups/lib.go
@@ -0,0 +1 @@
+package lib
diff --git a/tests/core/output_groups/lib_test.go b/tests/core/output_groups/lib_test.go
new file mode 100644
index 00000000..55c21f80
--- /dev/null
+++ b/tests/core/output_groups/lib_test.go
@@ -0,0 +1 @@
+package lib
diff --git a/tests/core/race/BUILD.bazel b/tests/core/race/BUILD.bazel
new file mode 100644
index 00000000..842dff95
--- /dev/null
+++ b/tests/core/race/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "race_test",
+ srcs = ["race_test.go"],
+)
diff --git a/tests/core/race/README.rst b/tests/core/race/README.rst
new file mode 100644
index 00000000..a5152211
--- /dev/null
+++ b/tests/core/race/README.rst
@@ -0,0 +1,10 @@
+race instrumentation
+====================
+
+race_test
+---------
+
+Embeds a library that triggers a data race inside a binary and a test.
+Verifies that no race is reported by default and a race is reported when either
+target is build with the ``race = "on"`` attribute or the ``--features=race``
+flag.
diff --git a/tests/core/race/race_test.go b/tests/core/race/race_test.go
new file mode 100644
index 00000000..815b2b18
--- /dev/null
+++ b/tests/core/race/race_test.go
@@ -0,0 +1,302 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package race_test
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "os/exec"
+ "runtime"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
+
+go_library(
+ name = "racy",
+ srcs = [
+ "race_off.go",
+ "race_on.go",
+ "racy.go",
+ "empty.s", # verify #2143
+ ],
+ importpath = "example.com/racy",
+)
+
+go_binary(
+ name = "racy_cmd",
+ srcs = ["main.go"],
+ embed = [":racy"],
+)
+
+go_binary(
+ name = "racy_cmd_race_mode",
+ srcs = ["main.go"],
+ embed = [":racy"],
+ race = "on",
+)
+
+go_test(
+ name = "racy_test",
+ srcs = ["racy_test.go"],
+ embed = [":racy"],
+)
+
+go_test(
+ name = "racy_test_race_mode",
+ srcs = ["racy_test.go"],
+ embed = [":racy"],
+ race = "on",
+)
+
+go_binary(
+ name = "pure_bin",
+ srcs = ["pure_bin.go"],
+ pure = "on",
+)
+
+go_binary(
+ name = "pure_race_bin",
+ srcs = ["pure_bin.go"],
+ pure = "on",
+ race = "on",
+)
+
+go_library(
+ name = "coverrace",
+ srcs = ["coverrace.go"],
+ importpath = "example.com/coverrace",
+)
+
+go_test(
+ name = "coverrace_test",
+ srcs = ["coverrace_test.go"],
+ embed = [":coverrace"],
+ race = "on",
+)
+-- race_off.go --
+// +build !race
+
+package main
+
+const RaceEnabled = false
+
+-- race_on.go --
+// +build race
+
+package main
+
+const RaceEnabled = true
+
+-- racy.go --
+package main
+
+import (
+ "flag"
+ "fmt"
+ "os"
+)
+
+var wantRace = flag.Bool("wantrace", false, "")
+
+func Race() {
+ if *wantRace != RaceEnabled {
+ fmt.Fprintf(os.Stderr, "!!! -wantrace is %v, but RaceEnabled is %v\n", *wantRace, RaceEnabled)
+ os.Exit(1)
+ }
+
+ done := make(chan bool)
+ m := make(map[string]string)
+ m["name"] = "world"
+ go func() {
+ m["name"] = "data race"
+ done <- true
+ }()
+ fmt.Println("Hello,", m["name"])
+ <-done
+}
+
+-- main.go --
+package main
+
+import "flag"
+
+func main() {
+ flag.Parse()
+ Race()
+}
+
+-- racy_test.go --
+package main
+
+import "testing"
+
+func TestRace(t *testing.T) {
+ Race()
+}
+
+-- empty.s --
+-- pure_bin.go --
+// +build !race
+
+// pure_bin will not build in race mode, since its sources will be excluded.
+package main
+
+func main() {}
+
+-- coverrace.go --
+package coverrace
+// copied from https://hermanschaaf.com/running-the-go-race-detector-with-cover/
+func add100() int {
+ total := 0
+ c := make(chan int, 1)
+ for i := 0; i < 100; i++ {
+ go func(chan int) {
+ c <- 1
+ }(c)
+ }
+ for u := 0; u < 100; u++ {
+ total += <-c
+ }
+ return total
+}
+
+-- coverrace_test.go --
+package coverrace
+// copied from https://hermanschaaf.com/running-the-go-race-detector-with-cover/
+
+import "testing"
+
+func TestCoverRace(t *testing.T) {
+ got := add100()
+ if got != 100 {
+ t.Errorf("got %d, want %d", got, 100)
+ }
+}
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ for _, test := range []struct {
+ desc, cmd, target string
+ featureFlag, wantRace, wantBuildFail bool
+ }{
+ {
+ desc: "cmd_auto",
+ cmd: "run",
+ target: "//:racy_cmd",
+ }, {
+ desc: "cmd_attr",
+ cmd: "run",
+ target: "//:racy_cmd_race_mode",
+ wantRace: true,
+ }, {
+ desc: "cmd_feature",
+ cmd: "run",
+ target: "//:racy_cmd",
+ featureFlag: true,
+ wantRace: true,
+ }, {
+ desc: "test_auto",
+ cmd: "test",
+ target: "//:racy_test",
+ }, {
+ desc: "test_attr",
+ cmd: "test",
+ target: "//:racy_test_race_mode",
+ wantRace: true,
+ }, {
+ desc: "test_feature",
+ cmd: "test",
+ target: "//:racy_test",
+ featureFlag: true,
+ wantRace: true,
+ }, {
+ desc: "pure_bin",
+ cmd: "build",
+ target: "//:pure_bin",
+ featureFlag: true,
+ }, {
+ desc: "pure_race_bin",
+ cmd: "build",
+ target: "//:pure_race_bin",
+ wantBuildFail: true,
+ }, {
+ desc: "cover_race",
+ cmd: "coverage",
+ target: "//:coverrace_test",
+ featureFlag: true,
+ },
+ } {
+ t.Run(test.desc, func(t *testing.T) {
+ // TODO(#2518): fix coverage tests on Windows
+ if test.cmd == "coverage" && runtime.GOOS == "windows" {
+ t.Skip("TODO(#2518): fix and enable coverage tests on Windows")
+ }
+ args := []string{test.cmd}
+ if test.featureFlag {
+ args = append(args, "--@io_bazel_rules_go//go/config:race")
+ }
+ args = append(args, test.target)
+ if test.cmd == "test" {
+ args = append(args, fmt.Sprintf("--test_arg=-wantrace=%v", test.wantRace))
+ } else if test.cmd == "run" {
+ args = append(args, "--", fmt.Sprintf("-wantrace=%v", test.wantRace))
+ }
+ cmd := bazel_testing.BazelCmd(args...)
+ stderr := &bytes.Buffer{}
+ cmd.Stderr = stderr
+ t.Logf("running: bazel %s", strings.Join(args, " "))
+ if err := cmd.Run(); err != nil {
+ var xerr *exec.ExitError
+ if !errors.As(err, &xerr) {
+ t.Fatalf("unexpected error: %v", err)
+ }
+ if xerr.ExitCode() == bazel_testing.BUILD_FAILURE {
+ if !test.wantBuildFail {
+ t.Fatalf("unexpected build failure: %v\nstderr:\n%s", err, stderr.Bytes())
+ }
+ return
+ } else if xerr.ExitCode() == bazel_testing.TESTS_FAILED {
+ if bytes.Contains(stderr.Bytes(), []byte("!!!")) {
+ t.Fatalf("error running %s:\n%s", strings.Join(cmd.Args, " "), stderr.Bytes())
+ } else if !test.wantRace {
+ t.Fatalf("error running %s without race enabled\n%s", strings.Join(cmd.Args, " "), stderr.Bytes())
+ }
+ } else if test.wantRace {
+ if !bytes.Contains(stderr.Bytes(), []byte("WARNING: DATA RACE")) {
+ t.Fatalf("wanted data race; command failed with: %v\nstderr:\n%s", err, stderr.Bytes())
+ }
+ return
+ } else {
+ t.Fatalf("unexpected error: %v\nstderr:\n%s", err, stderr.Bytes())
+ }
+ } else if test.wantRace {
+ t.Fatalf("command %s with race enabled did not fail", strings.Join(cmd.Args, " "))
+ } else if test.wantBuildFail {
+ t.Fatalf("target %s did not fail to build", test.target)
+ }
+ })
+ }
+}
diff --git a/tests/core/runfiles/BUILD.bazel b/tests/core/runfiles/BUILD.bazel
new file mode 100644
index 00000000..c7db6d3d
--- /dev/null
+++ b/tests/core/runfiles/BUILD.bazel
@@ -0,0 +1,48 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
+
+package(default_visibility = ["//visibility:public"])
+
+test_suite(
+ name = "runfiles_tests",
+ tests = [
+ ":local_test",
+ "@runfiles_remote_test//:remote_test",
+ ],
+)
+
+go_test(
+ name = "local_test",
+ srcs = ["runfiles_test.go"],
+ deps = [":check_runfiles"],
+)
+
+go_binary(
+ name = "local_cmd",
+ srcs = ["runfiles_cmd.go"],
+ deps = [":check_runfiles"],
+)
+
+go_binary(
+ name = "local_bin",
+ srcs = ["empty_bin.go"],
+)
+
+go_library(
+ name = "check_runfiles",
+ srcs = ["check_runfiles.go"],
+ data = [
+ "local_file.txt",
+ ":local_bin",
+ ":local_group",
+ "@runfiles_remote_test//:remote_bin",
+ "@runfiles_remote_test//:remote_file.txt",
+ "@runfiles_remote_test//:remote_group",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/tests/core/runfiles/check",
+ deps = ["//go/tools/bazel:go_default_library"],
+)
+
+filegroup(
+ name = "local_group",
+ srcs = ["local_group.txt"],
+)
diff --git a/tests/core/runfiles/README.rst b/tests/core/runfiles/README.rst
new file mode 100644
index 00000000..ec357826
--- /dev/null
+++ b/tests/core/runfiles/README.rst
@@ -0,0 +1,23 @@
+Runfiles functionality
+=====================
+
+runfiles_tests
+--------------
+
+Checks that functions in ``//go/tools/bazel:go_default_library`` that
+provide access to runfiles behave correctly. In particular, this checks:
+
+* ``Runfile`` works for regular files.
+* ``FindBinary`` works for binaries.
+* ``ListRunfiles`` lists all expected files.
+* These functions work for runfiles in the local workspace and for files in
+ external repositories (``@runfiles_remote_test`` is a ``local_repository``
+ that points to a subdirectory here).
+* These functions work in tests invoked with ``bazel test`` and
+ binaries invoked with ``bazel run``.
+* These functions work on Windows and other platforms. Bazel doesn't
+ create a symlink tree for runfiles on Windows since symbolic links
+ can't be created without administrative privilege by default.
+
+TODO: Verify binary behavior in CI. The ``local_bin`` and ``remote_bin``
+targets verify behavior for binaries, but they are not tests.
diff --git a/tests/core/runfiles/bin.go b/tests/core/runfiles/bin.go
new file mode 100644
index 00000000..0ced7a9e
--- /dev/null
+++ b/tests/core/runfiles/bin.go
@@ -0,0 +1,17 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+func main() {}
diff --git a/tests/core/runfiles/check_runfiles.go b/tests/core/runfiles/check_runfiles.go
new file mode 100644
index 00000000..8858a573
--- /dev/null
+++ b/tests/core/runfiles/check_runfiles.go
@@ -0,0 +1,121 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package check
+
+import (
+ "fmt"
+ "os"
+ "path/filepath"
+ "runtime"
+ "sort"
+ "strings"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+)
+
+type TestFile struct {
+ Workspace, ShortPath, Path string
+ Binary bool
+}
+
+var DefaultTestFiles = []TestFile{
+ {Workspace: "io_bazel_rules_go", Path: "tests/core/runfiles/local_file.txt"},
+ {Workspace: "io_bazel_rules_go", Path: "tests/core/runfiles/local_group.txt"},
+ {Workspace: "io_bazel_rules_go", Path: "tests/core/runfiles/local_bin", Binary: true},
+ {Workspace: "runfiles_remote_test", Path: "remote_file.txt"},
+ {Workspace: "runfiles_remote_test", Path: "remote_group.txt"},
+ {Workspace: "runfiles_remote_test", Path: "remote_bin", Binary: true},
+}
+
+func CheckRunfiles(files []TestFile) error {
+ // Check that the runfiles directory matches the current workspace.
+ // There is no runfiles directory on Windows.
+ if runtime.GOOS != "windows" {
+ dir, err := bazel.RunfilesPath()
+ if err != nil {
+ return err
+ }
+ root, base := filepath.Dir(dir), filepath.Base(dir)
+ if !strings.HasSuffix(root, ".runfiles") {
+ return fmt.Errorf("RunfilesPath: %q is not a .runfiles directory", dir)
+ }
+ workspace := os.Getenv("TEST_WORKSPACE")
+ if workspace != "" && workspace != base {
+ return fmt.Errorf("RunfilesPath: %q does not match test workspace %s", dir, workspace)
+ }
+ if srcDir := os.Getenv("TEST_SRCDIR"); srcDir != "" && filepath.Join(srcDir, workspace) != dir {
+ return fmt.Errorf("RunfilesPath: %q does not match TEST_SRCDIR %q", dir, srcDir)
+ }
+ }
+
+ // Check that files can be found with Runfile or FindBinary.
+ // Make sure the paths returned are absolute paths to actual files.
+ seen := make(map[string]string)
+ for _, f := range files {
+ var got string
+ var err error
+ if !f.Binary {
+ if got, err = bazel.Runfile(f.Path); err != nil {
+ return err
+ }
+ if !filepath.IsAbs(got) {
+ return fmt.Errorf("Runfile %s: got a relative path %q; want absolute", f.Path, got)
+ }
+ seen[f.Path] = got
+ } else {
+ var pkg, name string
+ if i := strings.LastIndex(f.Path, "/"); i < 0 {
+ name = f.Path
+ } else {
+ pkg = f.Path[:i]
+ name = f.Path[i+1:]
+ }
+ var ok bool
+ if got, ok = bazel.FindBinary(pkg, name); !ok {
+ return fmt.Errorf("FindBinary %s %s: could not find binary", pkg, name)
+ }
+ if !filepath.IsAbs(got) {
+ return fmt.Errorf("FindBinary %s %s: got a relative path %q; want absolute", pkg, name, got)
+ }
+ }
+
+ if _, err := os.Stat(got); err != nil {
+ return fmt.Errorf("%s: could not stat: %v", f.Path, err)
+ }
+ }
+
+ // Check that the files can be listed.
+ entries, err := bazel.ListRunfiles()
+ if err != nil {
+ return err
+ }
+ for _, e := range entries {
+ if want, ok := seen[e.ShortPath]; ok && want != e.Path {
+ return err
+ }
+ delete(seen, e.ShortPath)
+ }
+
+ if len(seen) > 0 {
+ unseen := make([]string, 0, len(seen))
+ for short := range seen {
+ unseen = append(unseen, short)
+ }
+ sort.Strings(unseen)
+ return fmt.Errorf("ListRunfiles did not include files:\n\t%s", strings.Join(unseen, "\n\t"))
+ }
+
+ return nil
+}
diff --git a/tests/core/runfiles/empty_bin.go b/tests/core/runfiles/empty_bin.go
new file mode 100644
index 00000000..38dd16da
--- /dev/null
+++ b/tests/core/runfiles/empty_bin.go
@@ -0,0 +1,3 @@
+package main
+
+func main() {}
diff --git a/tests/core/runfiles/local_file.txt b/tests/core/runfiles/local_file.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/runfiles/local_file.txt
diff --git a/tests/core/runfiles/local_group.txt b/tests/core/runfiles/local_group.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/runfiles/local_group.txt
diff --git a/tests/core/runfiles/runfiles_cmd.go b/tests/core/runfiles/runfiles_cmd.go
new file mode 100644
index 00000000..0ab124b5
--- /dev/null
+++ b/tests/core/runfiles/runfiles_cmd.go
@@ -0,0 +1,28 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "fmt"
+ "os"
+
+ "github.com/bazelbuild/rules_go/tests/core/runfiles/check"
+)
+
+func main() {
+ if err := check.CheckRunfiles(check.DefaultTestFiles); err != nil {
+ fmt.Fprintln(os.Stderr, err.Error())
+ }
+}
diff --git a/tests/core/runfiles/runfiles_remote_test/BUILD.bazel b/tests/core/runfiles/runfiles_remote_test/BUILD.bazel
new file mode 100644
index 00000000..112dcd35
--- /dev/null
+++ b/tests/core/runfiles/runfiles_remote_test/BUILD.bazel
@@ -0,0 +1,27 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_test")
+
+package(default_visibility = ["//visibility:public"])
+
+go_test(
+ name = "remote_test",
+ srcs = ["@io_bazel_rules_go//tests/core/runfiles:runfiles_test.go"],
+ deps = ["@io_bazel_rules_go//tests/core/runfiles:check_runfiles"],
+)
+
+go_binary(
+ name = "remote_cmd",
+ srcs = ["@io_bazel_rules_go//tests/core/runfiles:runfiles_cmd.go"],
+ deps = ["@io_bazel_rules_go//tests/core/runfiles:check_runfiles"],
+)
+
+go_binary(
+ name = "remote_bin",
+ srcs = ["@io_bazel_rules_go//tests/core/runfiles:empty_bin.go"],
+)
+
+filegroup(
+ name = "remote_group",
+ srcs = ["remote_group.txt"],
+)
+
+exports_files(["remote_file.txt"])
diff --git a/tests/core/runfiles/runfiles_remote_test/WORKSPACE b/tests/core/runfiles/runfiles_remote_test/WORKSPACE
new file mode 100644
index 00000000..c9af3f85
--- /dev/null
+++ b/tests/core/runfiles/runfiles_remote_test/WORKSPACE
@@ -0,0 +1 @@
+workspace(name = "runfiles_remote_test")
diff --git a/tests/core/runfiles/runfiles_remote_test/remote_file.txt b/tests/core/runfiles/runfiles_remote_test/remote_file.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/runfiles/runfiles_remote_test/remote_file.txt
diff --git a/tests/core/runfiles/runfiles_remote_test/remote_group.txt b/tests/core/runfiles/runfiles_remote_test/remote_group.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/core/runfiles/runfiles_remote_test/remote_group.txt
diff --git a/tests/core/runfiles/runfiles_test.go b/tests/core/runfiles/runfiles_test.go
new file mode 100644
index 00000000..62aab3af
--- /dev/null
+++ b/tests/core/runfiles/runfiles_test.go
@@ -0,0 +1,27 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/core/runfiles/check"
+)
+
+func Test(t *testing.T) {
+ if err := check.CheckRunfiles(check.DefaultTestFiles); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/tests/core/starlark/BUILD.bazel b/tests/core/starlark/BUILD.bazel
new file mode 100644
index 00000000..c26a6bea
--- /dev/null
+++ b/tests/core/starlark/BUILD.bazel
@@ -0,0 +1,6 @@
+load(":common_tests.bzl", "common_test_suite")
+load(":sdk_tests.bzl", "sdk_test_suite")
+
+common_test_suite()
+
+sdk_test_suite()
diff --git a/tests/core/starlark/README.rst b/tests/core/starlark/README.rst
new file mode 100644
index 00000000..e1f8df76
--- /dev/null
+++ b/tests/core/starlark/README.rst
@@ -0,0 +1,9 @@
+Starlark unit tests
+=======================
+
+common_test_suite
+---------
+
+Checks that ``has_shared_lib_extension`` from ``//go/private:common.bzl``
+correctly matches shared library filenames, which may optionally have a version
+number at the end.
diff --git a/tests/core/starlark/common_tests.bzl b/tests/core/starlark/common_tests.bzl
new file mode 100644
index 00000000..e83d65f3
--- /dev/null
+++ b/tests/core/starlark/common_tests.bzl
@@ -0,0 +1,53 @@
+load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest")
+load("//go/private:common.bzl", "count_group_matches", "has_shared_lib_extension")
+
+def _versioned_shared_libraries_test(ctx):
+ env = unittest.begin(ctx)
+
+ # See //src/test/java/com/google/devtools/build/lib/rules/cpp:CppFileTypesTest.java
+ # for the corresponding native C++ rules tests.
+ asserts.true(env, has_shared_lib_extension("somelibrary.so"))
+ asserts.true(env, has_shared_lib_extension("somelibrary.so.2"))
+ asserts.true(env, has_shared_lib_extension("somelibrary.so.20"))
+ asserts.true(env, has_shared_lib_extension("somelibrary.so.20.2"))
+ asserts.true(env, has_shared_lib_extension("a/somelibrary.so.2"))
+ asserts.true(env, has_shared_lib_extension("somelibrary✅.so.2"))
+ asserts.true(env, has_shared_lib_extension("somelibrary✅.so.2.1"))
+ asserts.false(env, has_shared_lib_extension("somelibrary.so.e"))
+ asserts.false(env, has_shared_lib_extension("xx.1"))
+ asserts.false(env, has_shared_lib_extension("somelibrary.so.2e"))
+ asserts.false(env, has_shared_lib_extension("somelibrary.so.e2"))
+ asserts.false(env, has_shared_lib_extension("somelibrary.so.20.e2"))
+ asserts.false(env, has_shared_lib_extension("somelibrary.a.2"))
+ asserts.false(env, has_shared_lib_extension("somelibrary.a..2"))
+ asserts.false(env, has_shared_lib_extension("somelibrary.so.2."))
+ asserts.false(env, has_shared_lib_extension("somelibrary.so."))
+ asserts.false(env, has_shared_lib_extension("somelibrary.so.2🚫"))
+ asserts.false(env, has_shared_lib_extension("somelibrary.so.🚫2"))
+ asserts.false(env, has_shared_lib_extension("somelibrary.so🚫.2.0"))
+
+ return unittest.end(env)
+
+versioned_shared_libraries_test = unittest.make(_versioned_shared_libraries_test)
+
+def _count_group_matches_test(ctx):
+ env = unittest.begin(ctx)
+
+ asserts.equals(env, 1, count_group_matches("{foo_status}", "{foo_", "}"))
+ asserts.equals(env, 1, count_group_matches("{foo_status} {status}", "{foo_", "}"))
+ asserts.equals(env, 0, count_group_matches("{foo_status}", "{bar_", "}"))
+ asserts.equals(env, 1, count_group_matches("{foo_status}", "{", "}"))
+ asserts.equals(env, 2, count_group_matches("{foo} {bar}", "{", "}"))
+ asserts.equals(env, 2, count_group_matches("{foo{bar} {baz}", "{", "}"))
+
+ return unittest.end(env)
+
+count_group_matches_test = unittest.make(_count_group_matches_test)
+
+def common_test_suite():
+ """Creates the test targets and test suite for common.bzl tests."""
+ unittest.suite(
+ "common_tests",
+ versioned_shared_libraries_test,
+ count_group_matches_test,
+ )
diff --git a/tests/core/starlark/packagedriver/BUILD.bazel b/tests/core/starlark/packagedriver/BUILD.bazel
new file mode 100644
index 00000000..45dd6aba
--- /dev/null
+++ b/tests/core/starlark/packagedriver/BUILD.bazel
@@ -0,0 +1,5 @@
+load(":go_pkg_info_aspect_test.bzl", "package_driver_suite")
+
+package_driver_suite(
+ name = "package_driver_test",
+)
diff --git a/tests/core/starlark/packagedriver/fixtures/a/BUILD.bazel b/tests/core/starlark/packagedriver/fixtures/a/BUILD.bazel
new file mode 100644
index 00000000..0dad32d9
--- /dev/null
+++ b/tests/core/starlark/packagedriver/fixtures/a/BUILD.bazel
@@ -0,0 +1,8 @@
+load("//go:def.bzl", "go_library")
+
+go_library(
+ name = "go_default_library",
+ srcs = ["a.go"],
+ importpath = "example.com/a",
+ visibility = ["//tests/core/starlark/packagedriver:__subpackages__"],
+)
diff --git a/tests/core/starlark/packagedriver/fixtures/a/a.go b/tests/core/starlark/packagedriver/fixtures/a/a.go
new file mode 100644
index 00000000..af058f6d
--- /dev/null
+++ b/tests/core/starlark/packagedriver/fixtures/a/a.go
@@ -0,0 +1,5 @@
+package a
+
+func A() {
+ return
+}
diff --git a/tests/core/starlark/packagedriver/fixtures/b/BUILD.bazel b/tests/core/starlark/packagedriver/fixtures/b/BUILD.bazel
new file mode 100644
index 00000000..cdf5fd41
--- /dev/null
+++ b/tests/core/starlark/packagedriver/fixtures/b/BUILD.bazel
@@ -0,0 +1,8 @@
+load("//go:def.bzl", "go_library")
+
+go_library(
+ name = "go_default_library",
+ srcs = ["b.go"],
+ importpath = "example.com/b",
+ visibility = ["//tests/core/starlark/packagedriver:__subpackages__"],
+)
diff --git a/tests/core/starlark/packagedriver/fixtures/b/b.go b/tests/core/starlark/packagedriver/fixtures/b/b.go
new file mode 100644
index 00000000..869da65a
--- /dev/null
+++ b/tests/core/starlark/packagedriver/fixtures/b/b.go
@@ -0,0 +1,5 @@
+package b
+
+func B() {
+ return
+}
diff --git a/tests/core/starlark/packagedriver/fixtures/c/BUILD.bazel b/tests/core/starlark/packagedriver/fixtures/c/BUILD.bazel
new file mode 100644
index 00000000..28e8ef92
--- /dev/null
+++ b/tests/core/starlark/packagedriver/fixtures/c/BUILD.bazel
@@ -0,0 +1,20 @@
+load("//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "go_default_library",
+ srcs = ["c.go"],
+ importpath = "example.com/c",
+ visibility = ["//tests/core/starlark/packagedriver:__subpackages__"],
+ deps = [
+ "//tests/core/starlark/packagedriver/fixtures/a:go_default_library",
+ "//tests/core/starlark/packagedriver/fixtures/b:go_default_library",
+ ],
+)
+
+go_test(
+ name = "go_default_test",
+ srcs = ["c_test.go"],
+ embed = [":go_default_library"],
+ tags = ["manual"],
+ visibility = ["//tests/core/starlark/packagedriver:__subpackages__"],
+)
diff --git a/tests/core/starlark/packagedriver/fixtures/c/c.go b/tests/core/starlark/packagedriver/fixtures/c/c.go
new file mode 100644
index 00000000..f8a8dd3b
--- /dev/null
+++ b/tests/core/starlark/packagedriver/fixtures/c/c.go
@@ -0,0 +1,11 @@
+package c
+
+import (
+ "example.com/a"
+ "example.com/b"
+)
+
+func C() {
+ a.A()
+ b.B()
+}
diff --git a/tests/core/starlark/packagedriver/fixtures/c/c_test.go b/tests/core/starlark/packagedriver/fixtures/c/c_test.go
new file mode 100644
index 00000000..4b25df88
--- /dev/null
+++ b/tests/core/starlark/packagedriver/fixtures/c/c_test.go
@@ -0,0 +1,9 @@
+package c
+
+import (
+ "testing"
+)
+
+func TestC(t *testing.T) {
+ C()
+}
diff --git a/tests/core/starlark/packagedriver/go_pkg_info_aspect_test.bzl b/tests/core/starlark/packagedriver/go_pkg_info_aspect_test.bzl
new file mode 100644
index 00000000..80b8d8b6
--- /dev/null
+++ b/tests/core/starlark/packagedriver/go_pkg_info_aspect_test.bzl
@@ -0,0 +1,32 @@
+load("@bazel_skylib//lib:unittest.bzl", "analysistest", "asserts")
+load("//go/tools/gopackagesdriver:aspect.bzl", "go_pkg_info_aspect")
+
+def _package_driver_pkg_json_test_impl(ctx):
+ env = analysistest.begin(ctx)
+
+ target_under_test = analysistest.target_under_test(env)
+ json_files = [f.basename for f in target_under_test[OutputGroupInfo].go_pkg_driver_json_file.to_list()]
+ asserts.true(env, "go_default_test.pkg.json" in json_files, "{} does not contain go_default_test.pkg.json".format(json_files))
+
+ return analysistest.end(env)
+
+package_driver_pkg_json_test = analysistest.make(
+ _package_driver_pkg_json_test_impl,
+ extra_target_under_test_aspects = [go_pkg_info_aspect],
+)
+
+def _test_package_driver():
+ package_driver_pkg_json_test(
+ name = "package_driver_should_return_pkg_json_for_go_test",
+ target_under_test = "//tests/core/starlark/packagedriver/fixtures/c:go_default_test",
+ )
+
+def package_driver_suite(name):
+ _test_package_driver()
+
+ native.test_suite(
+ name = name,
+ tests = [
+ ":package_driver_should_return_pkg_json_for_go_test",
+ ],
+ )
diff --git a/tests/core/starlark/sdk_tests.bzl b/tests/core/starlark/sdk_tests.bzl
new file mode 100644
index 00000000..5339aec6
--- /dev/null
+++ b/tests/core/starlark/sdk_tests.bzl
@@ -0,0 +1,86 @@
+load("@bazel_skylib//lib:unittest.bzl", "asserts", "unittest")
+load("//go/private:sdk.bzl", "go_toolchains_single_definition")
+
+def _go_toolchains_single_definition_with_version_test(ctx):
+ env = unittest.begin(ctx)
+
+ result = go_toolchains_single_definition(
+ ctx = None,
+ prefix = "123_prefix_",
+ goos = "linux",
+ goarch = "amd64",
+ sdk_repo = "sdk_repo",
+ sdk_type = "download",
+ sdk_version = "1.20.2rc1",
+ )
+ asserts.equals(env, [], result.loads)
+ asserts.equals(env, [
+ """
+_123_PREFIX_MAJOR_VERSION = "1"
+_123_PREFIX_MINOR_VERSION = "20"
+_123_PREFIX_PATCH_VERSION = "2"
+_123_PREFIX_PRERELEASE_SUFFIX = "rc1"
+""",
+ """declare_bazel_toolchains(
+ prefix = "123_prefix_",
+ go_toolchain_repo = "@sdk_repo",
+ host_goarch = "amd64",
+ host_goos = "linux",
+ major = _123_PREFIX_MAJOR_VERSION,
+ minor = _123_PREFIX_MINOR_VERSION,
+ patch = _123_PREFIX_PATCH_VERSION,
+ prerelease = _123_PREFIX_PRERELEASE_SUFFIX,
+ sdk_type = "download",
+)
+""",
+ ], result.chunks)
+
+ return unittest.end(env)
+
+go_toolchains_single_definition_with_version_test = unittest.make(_go_toolchains_single_definition_with_version_test)
+
+def _go_toolchains_single_definition_without_version_test(ctx):
+ env = unittest.begin(ctx)
+
+ result = go_toolchains_single_definition(
+ ctx = None,
+ prefix = "123_prefix_",
+ goos = "linux",
+ goarch = "amd64",
+ sdk_repo = "sdk_repo",
+ sdk_type = "download",
+ sdk_version = None,
+ )
+ asserts.equals(env, ["""load(
+ "@sdk_repo//:version.bzl",
+ _123_PREFIX_MAJOR_VERSION = "MAJOR_VERSION",
+ _123_PREFIX_MINOR_VERSION = "MINOR_VERSION",
+ _123_PREFIX_PATCH_VERSION = "PATCH_VERSION",
+ _123_PREFIX_PRERELEASE_SUFFIX = "PRERELEASE_SUFFIX",
+)
+"""], result.loads)
+ asserts.equals(env, [
+ """declare_bazel_toolchains(
+ prefix = "123_prefix_",
+ go_toolchain_repo = "@sdk_repo",
+ host_goarch = "amd64",
+ host_goos = "linux",
+ major = _123_PREFIX_MAJOR_VERSION,
+ minor = _123_PREFIX_MINOR_VERSION,
+ patch = _123_PREFIX_PATCH_VERSION,
+ prerelease = _123_PREFIX_PRERELEASE_SUFFIX,
+ sdk_type = "download",
+)
+""",
+ ], result.chunks)
+
+ return unittest.end(env)
+
+go_toolchains_single_definition_without_version_test = unittest.make(_go_toolchains_single_definition_without_version_test)
+
+def sdk_test_suite():
+ unittest.suite(
+ "sdk_tests",
+ go_toolchains_single_definition_with_version_test,
+ go_toolchains_single_definition_without_version_test,
+ )
diff --git a/tests/core/stdlib/BUILD.bazel b/tests/core/stdlib/BUILD.bazel
new file mode 100644
index 00000000..eed94654
--- /dev/null
+++ b/tests/core/stdlib/BUILD.bazel
@@ -0,0 +1,11 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_test")
+load(":stdlib_files.bzl", "stdlib_files")
+
+go_test(
+ name = "buildid_test",
+ srcs = ["buildid_test.go"],
+ data = [":stdlib_files"],
+ deps = ["//go/runfiles"],
+)
+
+stdlib_files(name = "stdlib_files")
diff --git a/tests/core/stdlib/README.rst b/tests/core/stdlib/README.rst
new file mode 100644
index 00000000..4a942953
--- /dev/null
+++ b/tests/core/stdlib/README.rst
@@ -0,0 +1,13 @@
+stdlib functionality
+====================
+
+buildid_test
+------------
+
+Checks that the ``stdlib`` rule builds archives without Go build ids.
+
+Go build ids are used for caching within ``go build``; they are not needed by
+Bazel, which has its own caching mechanism. The build id is influenced by
+all inputs to the build, including cgo environment variables. Since these
+variables may include sandbox paths, they can make the build id
+non-reproducible, even though they don't affect the final binary.
diff --git a/tests/core/stdlib/buildid_test.go b/tests/core/stdlib/buildid_test.go
new file mode 100644
index 00000000..d95ba903
--- /dev/null
+++ b/tests/core/stdlib/buildid_test.go
@@ -0,0 +1,93 @@
+//go:build go1.10
+// +build go1.10
+
+/* Copyright 2018 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package buildid_test
+
+import (
+ "bytes"
+ "errors"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/runfiles"
+)
+
+func TestEmptyBuildID(t *testing.T) {
+ // Locate the buildid tool and several archive files to check.
+ // fmt.a - pure go
+ // crypto/aes.a - contains assembly
+ // runtime/cgo.a - contains cgo
+ // The path may vary depending on platform and architecture, so just
+ // do a search.
+ var buildidPath string
+ pkgPaths := map[string]string{
+ "fmt.a": "",
+ "aes.a": "",
+ "cgo.a": "",
+ }
+ stdlibPkgDir, err := runfiles.Rlocation("io_bazel_rules_go/stdlib_/pkg")
+ if err != nil {
+ t.Fatal(err)
+ }
+ n := len(pkgPaths)
+ done := errors.New("done")
+ var visit filepath.WalkFunc
+ visit = func(path string, info os.FileInfo, err error) error {
+ if err != nil {
+ return err
+ }
+ if filepath.Base(path) == "buildid" && (info.Mode()&0111) != 0 {
+ buildidPath = path
+ }
+ for pkg := range pkgPaths {
+ if filepath.Base(path) == pkg {
+ pkgPaths[pkg] = path
+ n--
+ }
+ }
+ if buildidPath != "" && n == 0 {
+ return done
+ }
+ return nil
+ }
+ if err = filepath.Walk(stdlibPkgDir, visit); err != nil && err != done {
+ t.Fatal(err)
+ }
+ if buildidPath == "" {
+ t.Fatal("buildid not found")
+ }
+
+ for pkg, path := range pkgPaths {
+ if path == "" {
+ t.Errorf("could not locate %s", pkg)
+ continue
+ }
+ // Equivalent to: go tool buildid pkg.a
+ // It's an error if this produces any output.
+ cmd := exec.Command(buildidPath, path)
+ out, err := cmd.Output()
+ if err != nil {
+ t.Error(err)
+ }
+ if len(bytes.TrimSpace(out)) > 0 {
+ t.Errorf("%s: unexpected buildid: %s", path, out)
+ }
+ }
+}
diff --git a/tests/core/stdlib/reproduce_test.sh b/tests/core/stdlib/reproduce_test.sh
new file mode 100755
index 00000000..b709ab56
--- /dev/null
+++ b/tests/core/stdlib/reproduce_test.sh
@@ -0,0 +1,23 @@
+#!/usr/bin/env bash
+set -eux -o pipefail
+
+function run_bazel() {
+ bazel clean --expunge
+ bazel test //tests/core/go_binary:all
+ find bazel-out/ -name '*.a' | sort | uniq | grep stdlib | xargs shasum > $1
+}
+
+FILE1=$(mktemp)
+FILE2=$(mktemp)
+
+echo First run
+run_bazel ${FILE1}
+
+echo Second run
+run_bazel ${FILE2}
+
+echo Diffing runs
+diff ${FILE1} ${FILE2}
+
+echo Removing files
+rm ${FILE1} ${FILE2}
diff --git a/tests/core/stdlib/stdlib_files.bzl b/tests/core/stdlib/stdlib_files.bzl
new file mode 100644
index 00000000..35d48f33
--- /dev/null
+++ b/tests/core/stdlib/stdlib_files.bzl
@@ -0,0 +1,49 @@
+# Copyright 2018 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("//go/private:providers.bzl", "GoStdLib")
+
+def _force_rebuild_transition_impl(settings, attr):
+ return {"//go/config:race": True}
+
+force_rebuild_transition = transition(
+ implementation = _force_rebuild_transition_impl,
+ inputs = ["//go/config:race"],
+ outputs = ["//go/config:race"],
+)
+
+def _stdlib_files_impl(ctx):
+ # When an outgoing transition (aka split transition) is used,
+ # ctx.attr._stdlib is a list of Target.
+ stdlib = ctx.attr._stdlib[0][GoStdLib]
+ libs = stdlib.libs
+ runfiles = ctx.runfiles(files = libs)
+ return [DefaultInfo(
+ files = depset(libs + [stdlib._list_json]),
+ runfiles = runfiles,
+ )]
+
+stdlib_files = rule(
+ implementation = _stdlib_files_impl,
+ attrs = {
+ "_stdlib": attr.label(
+ default = "@io_bazel_rules_go//:stdlib",
+ providers = [GoStdLib],
+ cfg = force_rebuild_transition,
+ ),
+ "_allowlist_function_transition": attr.label(
+ default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
+ ),
+ },
+)
diff --git a/tests/core/strip/BUILD.bazel b/tests/core/strip/BUILD.bazel
new file mode 100644
index 00000000..bc2f6bd8
--- /dev/null
+++ b/tests/core/strip/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "strip_test",
+ srcs = ["strip_test.go"],
+)
diff --git a/tests/core/strip/README.rst b/tests/core/strip/README.rst
new file mode 100644
index 00000000..1b5c1f96
--- /dev/null
+++ b/tests/core/strip/README.rst
@@ -0,0 +1,13 @@
+symbol stripping
+====================
+
+strip_test
+---------
+
+Tests that the global Bazel configuration for stripping are applied to go_binary
+targets.
+In particular, it tests that stripping is performed iff the bazel flag ``--strip``
+is set to ``always`` or ``--strip`` is set to ``sometimes`` and ``--compilation_mode``
+is ``fastbuild``.
+Additionally, it tests that stack traces still contain the same information when stripping
+is enabled.
diff --git a/tests/core/strip/strip_test.go b/tests/core/strip/strip_test.go
new file mode 100644
index 00000000..b7183033
--- /dev/null
+++ b/tests/core/strip/strip_test.go
@@ -0,0 +1,270 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package strip_test
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "os/exec"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+go_binary(
+ name = "strip",
+ srcs = ["strip.go"],
+)
+-- strip.go --
+package main
+
+import (
+ "debug/elf"
+ "debug/macho"
+ "debug/pe"
+ "errors"
+ "flag"
+ "fmt"
+ "io"
+ "os"
+ "regexp"
+ "runtime"
+ "runtime/debug"
+ "strings"
+)
+
+var wantStrip = flag.Bool("wantstrip", false, "")
+
+func main() {
+ flag.Parse()
+ stackTrace, err := panicAndRecover()
+ if err != nil {
+ panic(err)
+ }
+ gotStackTrace := strings.Split(stackTrace, "\n")
+ if len(gotStackTrace) != len(wantStackTrace) {
+ panic(fmt.Sprintf("got %d lines of stack trace, want %d", len(gotStackTrace), len(wantStackTrace)))
+ }
+ for i := range gotStackTrace {
+ expectedLine := regexp.MustCompile(wantStackTrace[i])
+ if !expectedLine.MatchString(gotStackTrace[i]) {
+ panic(fmt.Sprintf("got unexpected stack trace line %q at index %d", gotStackTrace[i], i))
+ }
+ }
+ stripped, err := isStripped()
+ if err != nil {
+ panic(err)
+ }
+ if stripped != *wantStrip {
+ panic(fmt.Sprintf("got stripped=%t, want stripped=%t", stripped, *wantStrip))
+ }
+}
+
+func panicAndRecover() (stackTrace string, err error) {
+ defer func() {
+ if r := recover(); r != nil {
+ stackTrace = string(debug.Stack())
+ }
+ }()
+ panic("test")
+ return "", errors.New("should not reach here")
+}
+
+func isStripped() (bool, error) {
+ ownLocation, err := os.Executable()
+ if err != nil {
+ return false, err
+ }
+ ownBinary, err := os.Open(ownLocation)
+ if err != nil {
+ return false, err
+ }
+ defer ownBinary.Close()
+ switch runtime.GOOS {
+ case "darwin":
+ return isStrippedMachO(ownBinary)
+ case "linux":
+ return isStrippedElf(ownBinary)
+ case "windows":
+ return isStrippedPE(ownBinary)
+ default:
+ return false, fmt.Errorf("unsupported OS: %s", runtime.GOOS)
+ }
+}
+
+func isStrippedMachO(f io.ReaderAt) (bool, error) {
+ macho, err := macho.NewFile(f)
+ if err != nil {
+ return false, err
+ }
+ gotDwarf := macho.Segment("__DWARF") != nil
+ gotDebugInfo := macho.Section("__zdebug_info") != nil
+ if gotDwarf != gotDebugInfo {
+ return false, fmt.Errorf("inconsistent stripping: gotDwarf=%v, gotDebugInfo=%v", gotDwarf, gotDebugInfo)
+ }
+ return !gotDwarf, nil
+}
+
+func isStrippedElf(f io.ReaderAt) (bool, error) {
+ elf, err := elf.NewFile(f)
+ if err != nil {
+ return false, err
+ }
+ var gotSymtab bool
+ for _, section := range elf.Sections {
+ if section.Name == ".symtab" {
+ gotSymtab = true
+ break
+ }
+ }
+ return !gotSymtab, nil
+}
+
+
+func isStrippedPE(f io.ReaderAt) (bool, error) {
+ pe, err := pe.NewFile(f)
+ if err != nil {
+ return false, err
+ }
+ symtab := pe.Section(".symtab")
+ if symtab == nil {
+ return false, fmt.Errorf("no .symtab section")
+ }
+ emptySymtab := (symtab.VirtualSize <= 4) && (symtab.Size <= 512)
+ return emptySymtab, nil
+}
+
+
+` + embedWantedStackTraces(),
+ })
+}
+
+func Test(t *testing.T) {
+ for _, test := range []struct {
+ desc, stripFlag, compilationMode string
+ wantStrip bool
+ }{
+ {
+ desc: "run_auto",
+ wantStrip: true,
+ },
+ {
+ desc: "run_fastbuild",
+ compilationMode: "fastbuild",
+ wantStrip: true,
+ },
+ {
+ desc: "run_dbg",
+ compilationMode: "dbg",
+ },
+ {
+ desc: "run_opt",
+ compilationMode: "opt",
+ },
+ {
+ desc: "run_always",
+ stripFlag: "always",
+ wantStrip: true,
+ },
+ {
+ desc: "run_always_opt",
+ stripFlag: "always",
+ compilationMode: "opt",
+ wantStrip: true,
+ },
+ {
+ desc: "run_never",
+ stripFlag: "never",
+ },
+ {
+ desc: "run_sometimes_fastbuild",
+ stripFlag: "sometimes",
+ compilationMode: "fastbuild",
+ wantStrip: true,
+ },
+ {
+ desc: "run_sometimes_dbg",
+ stripFlag: "sometimes",
+ compilationMode: "dbg",
+ },
+ {
+ desc: "run_sometimes_opt",
+ stripFlag: "sometimes",
+ compilationMode: "opt",
+ },
+ } {
+ t.Run(test.desc, func(t *testing.T) {
+ args := []string{"run"}
+ if len(test.stripFlag) > 0 {
+ args = append(args, "--strip", test.stripFlag)
+ }
+ if len(test.compilationMode) > 0 {
+ args = append(args, "--compilation_mode", test.compilationMode)
+ }
+ args = append(args, "//:strip", "--", fmt.Sprintf("-wantstrip=%v", test.wantStrip))
+ cmd := bazel_testing.BazelCmd(args...)
+ stderr := &bytes.Buffer{}
+ cmd.Stderr = stderr
+ t.Logf("running: bazel %s", strings.Join(args, " "))
+ if err := cmd.Run(); err != nil {
+ var xerr *exec.ExitError
+ if !errors.As(err, &xerr) {
+ t.Fatalf("unexpected error: %v", err)
+ }
+ if xerr.ExitCode() == bazel_testing.BUILD_FAILURE {
+ t.Fatalf("unexpected build failure: %v\nstderr:\n%s", err, stderr.Bytes())
+ return
+ } else if xerr.ExitCode() == bazel_testing.TESTS_FAILED {
+ t.Fatalf("error running %s:\n%s", strings.Join(cmd.Args, " "), stderr.Bytes())
+ } else {
+ t.Fatalf("unexpected error: %v\nstderr:\n%s", err, stderr.Bytes())
+ }
+ }
+ })
+ }
+}
+
+var wantStackTrace = []string{
+ `^goroutine \d+ \[running\]:$`,
+ `^runtime/debug\.Stack\(\)$`,
+ `^ GOROOT/src/runtime/debug/stack\.go:\d+ \+0x[0-9a-f]+$`,
+ `^main\.panicAndRecover\.func1\(\)$`,
+ `^ strip\.go:\d+ \+0x[0-9a-f]+$`,
+ `^panic\({0x[0-9a-f]+, 0x[0-9a-f]+}\)$`,
+ `^ GOROOT/src/runtime/panic\.go:\d+ \+0x[0-9a-f]+$`,
+ `^main\.panicAndRecover\(\)$`,
+ `^ strip\.go:\d+ \+0x[0-9a-f]+$`,
+ `^main\.main\(\)$`,
+ `^ strip\.go:\d+ \+0x[0-9a-f]+$`,
+ `^$`,
+}
+
+func embedWantedStackTraces() string {
+ buf := &bytes.Buffer{}
+ fmt.Fprintln(buf, "var wantStackTrace = []string{")
+ for _, s := range wantStackTrace {
+ fmt.Fprintf(buf, "`%s`,\n", s)
+ }
+ fmt.Fprintln(buf, "}")
+ return buf.String()
+}
diff --git a/tests/core/transition/BUILD.bazel b/tests/core/transition/BUILD.bazel
new file mode 100644
index 00000000..12fe1504
--- /dev/null
+++ b/tests/core/transition/BUILD.bazel
@@ -0,0 +1,13 @@
+load("//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "cmdline_test",
+ size = "medium",
+ srcs = ["cmdline_test.go"],
+)
+
+go_bazel_test(
+ name = "hermeticity_test",
+ size = "medium",
+ srcs = ["hermeticity_test.go"],
+)
diff --git a/tests/core/transition/README.rst b/tests/core/transition/README.rst
new file mode 100644
index 00000000..5033f7b3
--- /dev/null
+++ b/tests/core/transition/README.rst
@@ -0,0 +1,18 @@
+Misc configuration transition tests
+===================================
+
+.. _go_binary: /docs/go/core/rules.md#_go_binary
+.. _go_test: /docs/go/core/rules.md#_go_test
+
+Tests that check that configuration transitions for `go_binary`_ and `go_test`_
+are working correctly.
+
+Most tests for specific attributes are in other directories, for example,
+``c_linkmodes``, ``cross``, ``nogo``, ``race``. This directory covers
+transition-related stuff that doesn't fit anywhere else.
+
+cmdline_test
+------------
+Tests that build settings can be set with flags on the command line. The test
+builds a target with and without a command line flag and verifies the output
+is different.
diff --git a/tests/core/transition/cmdline_test.go b/tests/core/transition/cmdline_test.go
new file mode 100644
index 00000000..1de0b3f5
--- /dev/null
+++ b/tests/core/transition/cmdline_test.go
@@ -0,0 +1,84 @@
+// Copyright 2020 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package cmdline_test
+
+import (
+ "bytes"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+go_binary(
+ name = "maybe_pure",
+ srcs = [
+ "not_pure.go",
+ "pure.go",
+ ],
+)
+
+-- not_pure.go --
+// +build cgo
+
+package main
+
+import "fmt"
+
+func main() {
+ fmt.Println("not pure")
+}
+
+-- pure.go --
+// +build !cgo
+
+package main
+
+import "fmt"
+
+func main() {
+ fmt.Println("pure")
+}
+`,
+ })
+}
+
+// TestPure checks that the --@io_bazel_rules_go//go/config:pure flag controls
+// whether a target is built in pure mode. It doesn't actually require cgo,
+// since that doesn't work within go_bazel_test on Windows.
+func TestPure(t *testing.T) {
+ out, err := bazel_testing.BazelOutput("run", "//:maybe_pure")
+ if err != nil {
+ t.Fatalf("running //:maybe_pure without flag: %v", err)
+ }
+ got := string(bytes.TrimSpace(out))
+ if want := "not pure"; got != want {
+ t.Fatalf("got %q; want %q", got, want)
+ }
+
+ out, err = bazel_testing.BazelOutput("run", "--@io_bazel_rules_go//go/config:pure", "//:maybe_pure")
+ if err != nil {
+ t.Fatalf("running //:maybe_pure with flag: %v", err)
+ }
+ got = string(bytes.TrimSpace(out))
+ if want := "pure"; got != want {
+ t.Fatalf("got %q; want %q", got, want)
+ }
+}
diff --git a/tests/core/transition/hermeticity_test.go b/tests/core/transition/hermeticity_test.go
new file mode 100644
index 00000000..08eda7d6
--- /dev/null
+++ b/tests/core/transition/hermeticity_test.go
@@ -0,0 +1,289 @@
+// Copyright 2021 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package hermeticity_test
+
+import (
+ "bytes"
+ "encoding/json"
+ "fmt"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
+
+go_binary(
+ name = "main",
+ srcs = [
+ "main.go",
+ ":gen_go",
+ ],
+ data = [":helper"],
+ embedsrcs = [":helper"],
+ cdeps = [":helper"],
+ cgo = True,
+ linkmode = "c-archive",
+ gotags = ["foo"],
+ deps = [":lib"],
+)
+
+go_library(
+ name = "lib",
+ srcs = [
+ "lib.go",
+ ":gen_indirect_go",
+ ],
+ importpath = "example.com/lib",
+ data = [":indirect_helper"],
+ embedsrcs = [":indirect_helper"],
+ cdeps = [":indirect_helper"],
+ cgo = True,
+)
+
+go_test(
+ name = "main_test",
+ srcs = [
+ "main.go",
+ ":gen_go",
+ ],
+ data = [":helper"],
+ embedsrcs = [":helper"],
+ cdeps = [":helper"],
+ cgo = True,
+ linkmode = "c-archive",
+ gotags = ["foo"],
+)
+
+cc_library(
+ name = "helper",
+)
+
+cc_library(
+ name = "indirect_helper",
+)
+
+genrule(
+ name = "gen_go",
+ outs = ["gen.go"],
+ exec_tools = [":helper"],
+ cmd = "# Not needed for bazel cquery",
+)
+
+genrule(
+ name = "gen_indirect_go",
+ outs = ["gen_indirect.go"],
+ exec_tools = [":indirect_helper"],
+ cmd = "# Not needed for bazel cquery",
+)
+
+proto_library(
+ name = "foo_proto",
+ srcs = ["foo.proto"],
+)
+
+go_proto_library(
+ name = "foo_go_proto",
+ importpath = "github.com/bazelbuild/rules_go/tests/core/transition/foo",
+ proto = ":foo_proto",
+)
+-- main.go --
+package main
+
+func main() {}
+-- lib.go --
+-- foo.proto --
+syntax = "proto3";
+
+package tests.core.transition.foo;
+option go_package = "github.com/bazelbuild/rules_go/tests/core/transition/foo";
+
+message Foo {
+ int64 value = 1;
+}
+`,
+ WorkspaceSuffix: `
+load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
+
+http_archive(
+ name = "com_google_protobuf",
+ sha256 = "75be42bd736f4df6d702a0e4e4d30de9ee40eac024c4b845d17ae4cc831fe4ae",
+ strip_prefix = "protobuf-21.7",
+ # latest available in BCR, as of 2022-09-30
+ urls = [
+ "https://github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz",
+ "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v21.7.tar.gz",
+ ],
+)
+
+load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
+
+protobuf_deps()
+
+http_archive(
+ name = "rules_proto",
+ sha256 = "4d421d51f9ecfe9bf96ab23b55c6f2b809cbaf0eea24952683e397decfbd0dd0",
+ strip_prefix = "rules_proto-f6b8d89b90a7956f6782a4a3609b2f0eee3ce965",
+ # master, as of 2020-01-06
+ urls = [
+ "https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/f6b8d89b90a7956f6782a4a3609b2f0eee3ce965.tar.gz",
+ "https://github.com/bazelbuild/rules_proto/archive/f6b8d89b90a7956f6782a4a3609b2f0eee3ce965.tar.gz",
+ ],
+)
+`,
+ })
+}
+
+func TestGoBinaryNonGoAttrsAreReset(t *testing.T) {
+ assertDependsCleanlyOnWithFlags(
+ t,
+ "//:main",
+ "//:helper")
+}
+
+func TestGoLibraryNonGoAttrsAreReset(t *testing.T) {
+ assertDependsCleanlyOnWithFlags(
+ t,
+ "//:main",
+ "//:indirect_helper")
+}
+
+func TestGoTestNonGoAttrsAreReset(t *testing.T) {
+ assertDependsCleanlyOnWithFlags(
+ t,
+ "//:main_test",
+ "//:helper")
+}
+
+func TestGoProtoLibraryToolAttrsAreReset(t *testing.T) {
+ assertDependsCleanlyOnWithFlags(
+ t,
+ "//:foo_go_proto",
+ "@com_google_protobuf//:protoc",
+ "--@io_bazel_rules_go//go/config:static",
+ "--@io_bazel_rules_go//go/config:msan",
+ "--@io_bazel_rules_go//go/config:race",
+ "--@io_bazel_rules_go//go/config:debug",
+ "--@io_bazel_rules_go//go/config:linkmode=c-archive",
+ "--@io_bazel_rules_go//go/config:tags=fake_tag",
+ )
+ assertDependsCleanlyOnWithFlags(
+ t,
+ "//:foo_go_proto",
+ "@com_google_protobuf//:protoc",
+ "--@io_bazel_rules_go//go/config:pure",
+ )
+}
+
+func assertDependsCleanlyOnWithFlags(t *testing.T, targetA, targetB string, flags ...string) {
+ query := fmt.Sprintf("deps(%s) intersect %s", targetA, targetB)
+ out, err := bazel_testing.BazelOutput(append(
+ []string{
+ "cquery",
+ "--transitions=full",
+ "--output=jsonproto",
+ query,
+ },
+ flags...,
+ )...,
+ )
+ if err != nil {
+ t.Fatalf("bazel cquery '%s': %v", query, err)
+ }
+ cqueryOut := bytes.TrimSpace(out)
+ configHashes := extractConfigHashes(t, cqueryOut)
+ if len(configHashes) != 1 {
+ differingGoOptions := getGoOptions(t, configHashes...)
+ if len(differingGoOptions) != 0 {
+ t.Fatalf(
+ "%s depends on %s in multiple configs with these differences in rules_go options: %s",
+ targetA,
+ targetB,
+ strings.Join(differingGoOptions, "\n"),
+ )
+ }
+ }
+ goOptions := getGoOptions(t, configHashes[0])
+ if len(goOptions) != 0 {
+ t.Fatalf(
+ "%s depends on %s in a config with rules_go options: %s",
+ targetA,
+ targetB,
+ strings.Join(goOptions, "\n"),
+ )
+ }
+}
+
+func extractConfigHashes(t *testing.T, rawJsonOut []byte) []string {
+ var jsonOut bazelCqueryOutput
+ err := json.Unmarshal(rawJsonOut, &jsonOut)
+ if err != nil {
+ t.Fatalf("Failed to decode bazel config JSON output %v: %q", err, string(rawJsonOut))
+ }
+ var hashes []string
+ for _, result := range jsonOut.Results {
+ hashes = append(hashes, result.Configuration.Checksum)
+ }
+ return hashes
+}
+
+func getGoOptions(t *testing.T, hashes ...string) []string {
+ out, err := bazel_testing.BazelOutput(append([]string{"config", "--output=json"}, hashes...)...)
+ if err != nil {
+ t.Fatalf("bazel config %s: %v", strings.Join(hashes, " "), err)
+ }
+ rawJsonOut := bytes.TrimSpace(out)
+ var jsonOut bazelConfigOutput
+ err = json.Unmarshal(rawJsonOut, &jsonOut)
+ if err != nil {
+ t.Fatalf("Failed to decode bazel config JSON output %v: %q", err, string(rawJsonOut))
+ }
+ var differingGoOptions []string
+ for _, fragment := range jsonOut.Fragments {
+ if fragment.Name != starlarkOptionsFragment {
+ continue
+ }
+ for key, value := range fragment.Options {
+ if strings.HasPrefix(key, "@io_bazel_rules_go//") {
+ differingGoOptions = append(differingGoOptions, fmt.Sprintf("%s=%s", key, value))
+ }
+ }
+ }
+ return differingGoOptions
+}
+
+const starlarkOptionsFragment = "user-defined"
+
+type bazelConfigOutput struct {
+ Fragments []struct {
+ Name string `json:"name"`
+ Options map[string]string `json:"options"`
+ } `json:"fragmentOptions"`
+}
+
+type bazelCqueryOutput struct {
+ Results []struct {
+ Configuration struct {
+ Checksum string `json:"checksum"`
+ } `json:"configuration"`
+ } `json:"results"`
+}
diff --git a/tests/examples/README.rst b/tests/examples/README.rst
new file mode 100644
index 00000000..c70c6aef
--- /dev/null
+++ b/tests/examples/README.rst
@@ -0,0 +1,14 @@
+Go rules examples
+===================
+
+This contains examples of how to apply the go rules to common problems.
+
+Contents
+--------
+
+.. Child list start
+
+* `Executable name <executable_name/README.rst>`_
+
+.. Child list end
+
diff --git a/tests/examples/executable_name/BUILD.bazel b/tests/examples/executable_name/BUILD.bazel
new file mode 100644
index 00000000..f207138b
--- /dev/null
+++ b/tests/examples/executable_name/BUILD.bazel
@@ -0,0 +1,20 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+go_binary(
+ name = "some_binary",
+ srcs = ["main.go"],
+)
+
+genrule(
+ name = "normalised_binary",
+ srcs = [":some_binary"],
+ outs = ["the_binary"],
+ cmd = "cp $(SRCS) $@",
+)
+
+sh_test(
+ name = "executable_name",
+ size = "small",
+ srcs = ["name_test.sh"],
+ data = [":normalised_binary"],
+)
diff --git a/tests/examples/executable_name/README.rst b/tests/examples/executable_name/README.rst
new file mode 100644
index 00000000..4db0db04
--- /dev/null
+++ b/tests/examples/executable_name/README.rst
@@ -0,0 +1,10 @@
+Executable name
+===============
+
+.. _go_binary: /docs/go/core/rules.md#go_binary
+
+The filename of the executable produced by a go_binary_ rule is unpredictale, the full path includes
+the compilation mode amongst other things, and the rules offer no backwards compatibility guarantees
+about the filename.
+For the simple case where you know exactly what you want the output filename to be, you can use a
+genrule to copy it to a well known place.
diff --git a/tests/examples/executable_name/main.go b/tests/examples/executable_name/main.go
new file mode 100644
index 00000000..52d49842
--- /dev/null
+++ b/tests/examples/executable_name/main.go
@@ -0,0 +1,24 @@
+/* Copyright 2018 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package main
+
+import (
+ "fmt"
+)
+
+func main() {
+ fmt.Println("The executable ran!")
+}
diff --git a/tests/examples/executable_name/name_test.sh b/tests/examples/executable_name/name_test.sh
new file mode 100755
index 00000000..9aedc0f5
--- /dev/null
+++ b/tests/examples/executable_name/name_test.sh
@@ -0,0 +1,6 @@
+result="$(${TEST_SRCDIR}/io_bazel_rules_go/tests/examples/executable_name/the_binary)"
+expect="The executable ran!"
+if [ "$result" != "$expect" ]; then
+ echo "error: unexpected bazel exit code: want '$expect', got '$result'" >&2
+ exit 1
+fi
diff --git a/tests/extras/go_embed_data/BUILD.bazel b/tests/extras/go_embed_data/BUILD.bazel
new file mode 100644
index 00000000..e7b88ef7
--- /dev/null
+++ b/tests/extras/go_embed_data/BUILD.bazel
@@ -0,0 +1,107 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_embed_data", "go_library", "go_test")
+load("@bazel_tools//tools/build_defs/pkg:pkg.bzl", "pkg_tar")
+
+go_test(
+ name = "go_default_test",
+ srcs = ["embed_test.go"],
+ data = [
+ "BUILD.bazel",
+ "//:AUTHORS",
+ "@com_google_protobuf//:LICENSE",
+ ],
+ embed = [":go_default_library"],
+ deps = ["//go/tools/bazel:go_default_library"],
+)
+
+go_library(
+ name = "go_default_library",
+ srcs = [
+ ":cgo",
+ ":empty",
+ ":ext",
+ ":flat",
+ ":local",
+ ":single",
+ ":str",
+ ":unpack",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/tests/go_embed_data",
+)
+
+go_embed_data(
+ name = "cgo",
+ srcs = ["error.c"],
+ package = "go_embed_data",
+ var = "cgo",
+)
+
+go_embed_data(
+ name = "empty",
+ package = "go_embed_data",
+ var = "empty",
+)
+
+go_embed_data(
+ name = "single",
+ src = "//:AUTHORS",
+ package = "go_embed_data",
+ var = "single",
+)
+
+go_embed_data(
+ name = "local",
+ srcs = [
+ ":BUILD.bazel",
+ "@io_bazel_rules_go//:AUTHORS",
+ ],
+ package = "go_embed_data",
+ var = "local",
+)
+
+go_embed_data(
+ name = "ext",
+ srcs = ["@com_google_protobuf//:LICENSE"],
+ package = "go_embed_data",
+ var = "ext",
+)
+
+go_embed_data(
+ name = "flat",
+ srcs = [":BUILD.bazel"],
+ flatten = True,
+ package = "go_embed_data",
+ var = "flat",
+)
+
+go_embed_data(
+ name = "str",
+ srcs = [":BUILD.bazel"],
+ package = "go_embed_data",
+ string = True,
+ var = "str",
+)
+
+go_embed_data(
+ name = "unpack",
+ srcs = [
+ ":embedded_tar",
+ ":embedded_zip",
+ ],
+ package = "go_embed_data",
+ unpack = True,
+ var = "unpack",
+)
+
+pkg_tar(
+ name = "embedded_tar",
+ srcs = [":BUILD.bazel"],
+ package_dir = "/from-tar",
+)
+
+genrule(
+ name = "embedded_zip",
+ srcs = [":BUILD.bazel"],
+ outs = ["embedded_zip.zip"],
+ cmd = "$(location @bazel_tools//tools/zip:zipper) c $@ from-zip/BUILD.bazel=$(location :BUILD.bazel)",
+ tools = ["@bazel_tools//tools/zip:zipper"],
+)
diff --git a/tests/extras/go_embed_data/README.rst b/tests/extras/go_embed_data/README.rst
new file mode 100644
index 00000000..e3ebc4ec
--- /dev/null
+++ b/tests/extras/go_embed_data/README.rst
@@ -0,0 +1,11 @@
+go_embed_data
+=============
+
+.. _go_embed_data: /docs/go/extras/extras.md#go-embed-data
+
+Tests to ensure basic features of `go_embed_data`_ are working correctly.
+
+embed_test
+----------
+
+Depends on multiple ``go_embed_data`` targets and verifies their contents.
diff --git a/tests/extras/go_embed_data/embed_test.go b/tests/extras/go_embed_data/embed_test.go
new file mode 100644
index 00000000..fdcd0fe0
--- /dev/null
+++ b/tests/extras/go_embed_data/embed_test.go
@@ -0,0 +1,131 @@
+package go_embed_data
+
+import (
+ "io"
+ "log"
+ "os"
+ "path/filepath"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel"
+)
+
+func TestMain(m *testing.M) {
+ // This test must run from the workspace root since it accesses files using
+ // relative paths. We look at parent directories until we find AUTHORS,
+ // then change to that directory.
+ for {
+ if _, err := os.Stat("AUTHORS"); err == nil {
+ break
+ }
+ if err := os.Chdir(".."); err != nil {
+ log.Fatal(err)
+ }
+ if wd, err := os.Getwd(); err != nil {
+ log.Fatal(err)
+ } else if wd == "/" {
+ log.Fatal("could not locate workspace root")
+ }
+ }
+ os.Exit(m.Run())
+}
+
+func TestCgo(t *testing.T) {
+ if len(cgo) == 0 {
+ t.Fatalf("cgo is empty")
+ }
+}
+
+func TestEmpty(t *testing.T) {
+ if len(empty) != 0 {
+ t.Fatalf("empty is not empty")
+ }
+}
+
+func TestSingle(t *testing.T) {
+ checkFile(t, "AUTHORS", single)
+}
+
+func TestLocal(t *testing.T) {
+ for path, data := range local {
+ checkFile(t, path, data)
+ }
+}
+
+func TestExternal(t *testing.T) {
+ for path, data := range ext {
+ checkFile(t, path, data)
+ }
+}
+
+func TestFlat(t *testing.T) {
+ for key := range flat {
+ if filepath.Base(key) != key {
+ t.Errorf("filename %q is not flat", key)
+ }
+ }
+}
+
+func TestString(t *testing.T) {
+ for _, data := range str {
+ var _ string = data // just check the type; contents covered by other tests.
+ }
+}
+
+func TestUnpack(t *testing.T) {
+ for _, data := range unpack {
+ checkFile(t, "tests/extras/go_embed_data/BUILD.bazel", data)
+ }
+ for _, key := range []string{
+ "from-zip/BUILD.bazel",
+ // Note: Bazel's pkg_tar always adds a leading "./" to its outputs,
+ // but tars generated from other sources can match the original
+ // inputs more exactly.
+ "./from-tar/BUILD.bazel",
+ } {
+ if _, ok := unpack[key]; !ok {
+ t.Errorf("filename %q is not in unpacked set", key)
+ }
+ }
+}
+
+func checkFile(t *testing.T, rawPath string, data []byte) {
+ path, err := bazel.Runfile(rawPath)
+ if err != nil {
+ t.Error(err)
+ return
+ }
+
+ f, err := os.Open(path)
+ if err != nil {
+ t.Error(err)
+ return
+ }
+ defer f.Close()
+
+ count := 0
+ buffer := make([]byte, 8192)
+ for {
+ n, err := f.Read(buffer)
+ if err != nil && err != io.EOF {
+ t.Error(err)
+ return
+ }
+ if n == 0 {
+ return
+ }
+ if n > len(data) {
+ t.Errorf("%q: file on disk is longer than embedded data", path)
+ return
+ }
+
+ for i := 0; i < n; i++ {
+ if buffer[i] != data[i] {
+ t.Errorf("data mismatch on file %q at offset %d", path, count+i)
+ return
+ }
+ }
+ count += n
+ data = data[n:]
+ }
+}
diff --git a/tests/extras/go_embed_data/error.c b/tests/extras/go_embed_data/error.c
new file mode 100644
index 00000000..41c28ebf
--- /dev/null
+++ b/tests/extras/go_embed_data/error.c
@@ -0,0 +1 @@
+#error do not compile
diff --git a/tests/extras/gomock/BUILD.bazel b/tests/extras/gomock/BUILD.bazel
new file mode 100644
index 00000000..5b04496f
--- /dev/null
+++ b/tests/extras/gomock/BUILD.bazel
@@ -0,0 +1,33 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test", "gomock")
+
+go_library(
+ name = "client",
+ srcs = [
+ "client.go",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/gomock/client",
+ visibility = ["//visibility:public"],
+ deps = [
+ "@go_googleapis//google/bytestream:bytestream_go_proto",
+ "@org_golang_google_grpc//:grpc",
+ ],
+)
+
+gomock(
+ name = "mocks",
+ out = "client_mock.go",
+ library = ":client",
+ package = "client",
+ source = "client.go",
+ visibility = ["//visibility:public"],
+)
+
+go_test(
+ name = "client_test",
+ srcs = [
+ "client_mock.go",
+ "client_test.go",
+ ],
+ embed = [":client"],
+ deps = ["@com_github_golang_mock//gomock"],
+)
diff --git a/tests/extras/gomock/client.go b/tests/extras/gomock/client.go
new file mode 100644
index 00000000..b8cd7ea2
--- /dev/null
+++ b/tests/extras/gomock/client.go
@@ -0,0 +1,10 @@
+package client
+
+import (
+ "google.golang.org/genproto/googleapis/bytestream"
+ "google.golang.org/grpc"
+)
+
+type Client interface {
+ Connect(grpc.ClientConnInterface) *bytestream.ByteStreamClient
+}
diff --git a/tests/extras/gomock/client_test.go b/tests/extras/gomock/client_test.go
new file mode 100644
index 00000000..92180b87
--- /dev/null
+++ b/tests/extras/gomock/client_test.go
@@ -0,0 +1,3 @@
+package client
+
+var _ Client = (*MockClient)(nil)
diff --git a/tests/grpc_repos.bzl b/tests/grpc_repos.bzl
new file mode 100644
index 00000000..e3ca8ae3
--- /dev/null
+++ b/tests/grpc_repos.bzl
@@ -0,0 +1,38 @@
+# Copyright 2019 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("@bazel_gazelle//:deps.bzl", "go_repository")
+
+def grpc_dependencies():
+ go_repository(
+ name = "org_golang_google_grpc",
+ build_file_proto_mode = "disable",
+ importpath = "google.golang.org/grpc",
+ sum = "h1:zvIju4sqAGvwKspUQOhwnpcqSbzi7/H6QomNNjTL4sk=",
+ version = "v1.27.1",
+ )
+
+ go_repository(
+ name = "org_golang_x_net",
+ importpath = "golang.org/x/net",
+ sum = "h1:oWX7TPOiFAMXLq8o0ikBYfCJVlRHBcsciT5bXOrH628=",
+ version = "v0.0.0-20190311183353-d8887717615a",
+ )
+
+ go_repository(
+ name = "org_golang_x_text",
+ importpath = "golang.org/x/text",
+ sum = "h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=",
+ version = "v0.3.0",
+ )
diff --git a/tests/integration/README.rst b/tests/integration/README.rst
new file mode 100644
index 00000000..0624954b
--- /dev/null
+++ b/tests/integration/README.rst
@@ -0,0 +1,23 @@
+Integration tests
+=================
+
+This folder is intended to hold larger scale test that check that rules_go
+works correctly in the real world, rather than in isolated single feature
+tests.
+
+If the unit tests were correct and exhaustive this directory should in theory
+be redundant, but in practice it helps catch many issues and points to places
+where more unit tests are needed.
+
+Contents
+--------
+
+.. Child list start
+
+* `Gazelle functionality <gazelle/README.rst>`_
+* `Popular repository tests <popular_repos/README.rst>`_
+* `Reproducibility <reproducibility/README.rst>`_
+* `Functionality related to @go_googleapis <googleapis/README.rst>`_
+
+.. Child list end
+
diff --git a/tests/integration/gazelle/BUILD.bazel b/tests/integration/gazelle/BUILD.bazel
new file mode 100644
index 00000000..90bfe2c7
--- /dev/null
+++ b/tests/integration/gazelle/BUILD.bazel
@@ -0,0 +1,11 @@
+load("//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "gazelle_test",
+ size = "medium",
+ srcs = ["gazelle_test.go"],
+ rule_files = [
+ "//:all_files",
+ "@bazel_gazelle//:all_files",
+ ],
+)
diff --git a/tests/integration/gazelle/README.rst b/tests/integration/gazelle/README.rst
new file mode 100644
index 00000000..f14f9a7d
--- /dev/null
+++ b/tests/integration/gazelle/README.rst
@@ -0,0 +1,9 @@
+Gazelle functionality
+=====================
+
+Tests that ensure rules_go still works with Gazelle.
+
+gazelle_test
+------------
+Checks that Gazelle can be run in a test workspace.
+
diff --git a/tests/integration/gazelle/gazelle_test.go b/tests/integration/gazelle/gazelle_test.go
new file mode 100644
index 00000000..42ad91db
--- /dev/null
+++ b/tests/integration/gazelle/gazelle_test.go
@@ -0,0 +1,74 @@
+// Copyright 2020 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package gazelle_test
+
+import (
+ "io/ioutil"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@bazel_gazelle//:def.bzl", "gazelle")
+
+# gazelle:prefix example.com/hello
+gazelle(
+ name = "gazelle",
+)
+-- hello.go --
+package hello
+`,
+ WorkspaceSuffix: `
+load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies")
+
+gazelle_dependencies()
+`,
+ })
+}
+
+func TestUpdate(t *testing.T) {
+ if err := bazel_testing.RunBazel("run", "//:gazelle"); err != nil {
+ t.Fatal(err)
+ }
+ data, err := ioutil.ReadFile("BUILD.bazel")
+ if err != nil {
+ t.Fatal(err)
+ }
+ got := strings.TrimSpace(string(data))
+ want := strings.TrimSpace(`
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+load("@bazel_gazelle//:def.bzl", "gazelle")
+
+# gazelle:prefix example.com/hello
+gazelle(
+ name = "gazelle",
+)
+
+go_library(
+ name = "hello",
+ srcs = ["hello.go"],
+ importpath = "example.com/hello",
+ visibility = ["//visibility:public"],
+)
+`)
+ if got != want {
+ t.Errorf("got:\n%s\n\nwant:\n%s", got, want)
+ }
+}
diff --git a/tests/integration/go_bin_runner/BUILD.bazel b/tests/integration/go_bin_runner/BUILD.bazel
new file mode 100644
index 00000000..e7db9531
--- /dev/null
+++ b/tests/integration/go_bin_runner/BUILD.bazel
@@ -0,0 +1,6 @@
+load("//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "go_bin_runner_test",
+ srcs = ["go_bin_runner_test.go"],
+)
diff --git a/tests/integration/go_bin_runner/go_bin_runner_test.go b/tests/integration/go_bin_runner/go_bin_runner_test.go
new file mode 100644
index 00000000..2cd42660
--- /dev/null
+++ b/tests/integration/go_bin_runner/go_bin_runner_test.go
@@ -0,0 +1,107 @@
+// Copyright 2023 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package go_bin_runner_test
+
+import (
+ "os"
+ "path/filepath"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+sh_binary(
+ name = "go_version",
+ srcs = ["go_version.sh"],
+ env = {"GO": "$(rlocationpath @io_bazel_rules_go//go)"},
+ data = ["@io_bazel_rules_go//go"],
+ deps = ["@bazel_tools//tools/bash/runfiles"],
+)
+
+genrule(
+ name = "foo",
+ outs = ["bar"],
+ tools = ["@io_bazel_rules_go//go"],
+ cmd = "$(location @io_bazel_rules_go//go) > $@",
+)
+
+-- go_version.sh --
+# --- begin runfiles.bash initialization v2 ---
+# Copy-pasted from the Bazel Bash runfiles library v2.
+set -uo pipefail; f=bazel_tools/tools/bash/runfiles/runfiles.bash
+source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
+ source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
+ source "$0.runfiles/$f" 2>/dev/null || \
+ source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
+ source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
+ { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
+# --- end runfiles.bash initialization v2 ---
+
+$(rlocation "$GO") version
+`})
+}
+
+func TestGoEnv(t *testing.T) {
+ // Set an invalid GOROOT to test that the //go target still finds the expected hermetic GOROOT.
+ os.Setenv("GOROOT", "invalid")
+
+ bazelInfoOut, err := bazel_testing.BazelOutput("info", "output_base")
+ if err != nil {
+ t.Fatal(err)
+ }
+ outputBase := strings.TrimSpace(string(bazelInfoOut))
+
+ goEnvOut, err := bazel_testing.BazelOutput("run", "@io_bazel_rules_go//go", "--", "env", "GOROOT")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ goRoot := strings.TrimSpace(string(goEnvOut))
+ if goRoot != filepath.Join(outputBase, "external", "go_sdk") {
+ t.Fatalf("GOROOT was not equal to %s", filepath.Join(outputBase, "external", "go_sdk"))
+ }
+}
+
+func TestGoVersionFromScript(t *testing.T) {
+ err := os.Chmod("go_version.sh", 0755)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ goVersionOut, err := bazel_testing.BazelOutput("run", "//:go_version")
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ if !strings.HasPrefix(string(goVersionOut), "go version go1.") {
+ t.Fatalf("go version output did not start with \"go version go1.\": %s", string(goVersionOut))
+ }
+}
+
+func TestNoGoInExec(t *testing.T) {
+ _, err := bazel_testing.BazelOutput("build", "//:foo")
+ if err == nil {
+ t.Fatal("expected build to fail")
+ }
+ stderr := string(err.(*bazel_testing.StderrExitError).Err.Stderr)
+ if !strings.Contains(stderr, "//go is only meant to be used with 'bazel run'") {
+ t.Fatalf("expected \"//go is only meant to be used with 'bazel run'\" in stderr, got %s", stderr)
+ }
+}
diff --git a/tests/integration/googleapis/BUILD.bazel b/tests/integration/googleapis/BUILD.bazel
new file mode 100644
index 00000000..53c544c6
--- /dev/null
+++ b/tests/integration/googleapis/BUILD.bazel
@@ -0,0 +1,46 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
+
+proto_library(
+ name = "color_service_proto",
+ srcs = ["color_service.proto"],
+ deps = [
+ "@go_googleapis//google/rpc:status_proto",
+ "@go_googleapis//google/type:color_proto",
+ ],
+)
+
+go_proto_library(
+ name = "color_service_go_proto",
+ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+ importpath = "github.com/bazelbuild/rules_go/tests/integration/googleapis/color_service_proto",
+ proto = ":color_service_proto",
+ deps = [
+ "@go_googleapis//google/rpc:status_go_proto",
+ "@go_googleapis//google/type:color_go_proto",
+ ],
+)
+
+go_library(
+ name = "color_service",
+ srcs = ["color_service.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/integration/googleapis/color_service",
+ deps = [
+ ":color_service_go_proto",
+ "@go_googleapis//google/rpc:code_go_proto",
+ "@go_googleapis//google/rpc:status_go_proto",
+ "@go_googleapis//google/type:color_go_proto",
+ ],
+)
+
+go_test(
+ name = "color_service_test",
+ srcs = ["color_service_test.go"],
+ deps = [
+ ":color_service",
+ ":color_service_go_proto",
+ "@go_googleapis//google/type:color_go_proto",
+ "@org_golang_google_grpc//:go_default_library",
+ ],
+)
diff --git a/tests/integration/googleapis/README.rst b/tests/integration/googleapis/README.rst
new file mode 100644
index 00000000..317f997e
--- /dev/null
+++ b/tests/integration/googleapis/README.rst
@@ -0,0 +1,8 @@
+Functionality related to @go_googleapis
+=======================================
+
+color_service_test
+------------------
+
+Verifies that a simple gRPC client and server can be built and run. .proto
+files are compiled at build time and depend on libraries in ``@go_googleapis``.
diff --git a/tests/integration/googleapis/color_service.go b/tests/integration/googleapis/color_service.go
new file mode 100644
index 00000000..cde3cc72
--- /dev/null
+++ b/tests/integration/googleapis/color_service.go
@@ -0,0 +1,49 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package color_service
+
+import (
+ "context"
+ "sync"
+
+ cspb "github.com/bazelbuild/rules_go/tests/integration/googleapis/color_service_proto"
+ "google.golang.org/genproto/googleapis/rpc/code"
+ "google.golang.org/genproto/googleapis/rpc/status"
+ "google.golang.org/genproto/googleapis/type/color"
+)
+
+type colorServer struct {
+ colors sync.Map
+}
+
+func New() cspb.ColorServiceServer {
+ return &colorServer{}
+}
+
+func (s *colorServer) SetColor(ctx context.Context, r *cspb.SetColorRequest) (*cspb.SetColorResponse, error) {
+ _, loaded := s.colors.LoadOrStore(r.Name, r.Color)
+ if loaded {
+ return &cspb.SetColorResponse{Status: &status.Status{Code: int32(code.Code_ALREADY_EXISTS)}}, nil
+ }
+ return &cspb.SetColorResponse{}, nil
+}
+
+func (s *colorServer) GetColor(ctx context.Context, r *cspb.GetColorRequest) (*cspb.GetColorResponse, error) {
+ value, ok := s.colors.Load(r.Name)
+ if !ok {
+ return &cspb.GetColorResponse{Status: &status.Status{Code: int32(code.Code_NOT_FOUND)}}, nil
+ }
+ return &cspb.GetColorResponse{Color: value.(*color.Color)}, nil
+}
diff --git a/tests/integration/googleapis/color_service.proto b/tests/integration/googleapis/color_service.proto
new file mode 100644
index 00000000..6444c3bd
--- /dev/null
+++ b/tests/integration/googleapis/color_service.proto
@@ -0,0 +1,45 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+syntax = "proto3";
+
+import "google/rpc/status.proto";
+import "google/type/color.proto";
+
+package rules_go.tests.integration.color_service;
+
+option go_package = "github.com/bazelbuild/rules_go/tests/integration/googleapis/color_service_proto";
+
+message SetColorRequest {
+ string name = 1;
+ google.type.Color color = 2;
+}
+
+message SetColorResponse {
+ google.rpc.Status status = 1;
+}
+
+message GetColorRequest {
+ string name = 1;
+}
+
+message GetColorResponse {
+ google.rpc.Status status = 1;
+ google.type.Color color = 2;
+}
+
+service ColorService {
+ rpc SetColor(SetColorRequest) returns (SetColorResponse);
+ rpc GetColor(GetColorRequest) returns (GetColorResponse);
+}
diff --git a/tests/integration/googleapis/color_service_test.go b/tests/integration/googleapis/color_service_test.go
new file mode 100644
index 00000000..f1b9ee2b
--- /dev/null
+++ b/tests/integration/googleapis/color_service_test.go
@@ -0,0 +1,63 @@
+// Copyright 2018 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package color_service_test
+
+import (
+ "context"
+ "net"
+ "reflect"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/integration/googleapis/color_service"
+ cspb "github.com/bazelbuild/rules_go/tests/integration/googleapis/color_service_proto"
+ "google.golang.org/genproto/googleapis/type/color"
+ "google.golang.org/grpc"
+)
+
+func TestColorService(t *testing.T) {
+ lis, err := net.Listen("tcp", "127.0.0.1:")
+ if err != nil {
+ t.Fatal(err)
+ }
+ grpcServer := grpc.NewServer()
+ cspb.RegisterColorServiceServer(grpcServer, color_service.New())
+ go grpcServer.Serve(lis)
+ defer grpcServer.Stop()
+
+ conn, err := grpc.Dial(lis.Addr().String(), grpc.WithInsecure())
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer conn.Close()
+ client := cspb.NewColorServiceClient(conn)
+
+ _, err = client.SetColor(context.Background(), &cspb.SetColorRequest{
+ Name: "red",
+ Color: &color.Color{Red: 1.0},
+ })
+ if err != nil {
+ t.Errorf("SetColor: %v", err)
+ }
+ resp, err := client.GetColor(context.Background(), &cspb.GetColorRequest{
+ Name: "red",
+ })
+ if err != nil {
+ t.Errorf("GetColor: %v", err)
+ }
+ want := &color.Color{Red: 1.0}
+ if !reflect.DeepEqual(resp.Color, want) {
+ t.Errorf("got %#v; want %#v", resp.Color, want)
+ }
+}
diff --git a/tests/integration/popular_repos/BUILD.bazel b/tests/integration/popular_repos/BUILD.bazel
new file mode 100644
index 00000000..7b92e2c8
--- /dev/null
+++ b/tests/integration/popular_repos/BUILD.bazel
@@ -0,0 +1,345 @@
+# Copyright 2017 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+##############################
+# Generated file, do not edit!
+##############################
+
+load("@bazel_skylib//rules:build_test.bzl", "build_test")
+
+test_suite(
+ name = "org_golang_x_crypto",
+ tests = [
+ "@org_golang_x_crypto//acme:acme_test",
+ "@org_golang_x_crypto//acme/autocert:autocert_test",
+ "@org_golang_x_crypto//argon2:argon2_test",
+ "@org_golang_x_crypto//bcrypt:bcrypt_test",
+ "@org_golang_x_crypto//blake2b:blake2b_test",
+ "@org_golang_x_crypto//blake2s:blake2s_test",
+ "@org_golang_x_crypto//blowfish:blowfish_test",
+ "@org_golang_x_crypto//bn256:bn256_test",
+ "@org_golang_x_crypto//cast5:cast5_test",
+ "@org_golang_x_crypto//chacha20:chacha20_test",
+ "@org_golang_x_crypto//chacha20poly1305:chacha20poly1305_test",
+ "@org_golang_x_crypto//cryptobyte:cryptobyte_test",
+ "@org_golang_x_crypto//curve25519:curve25519_test",
+ "@org_golang_x_crypto//ed25519:ed25519_test",
+ "@org_golang_x_crypto//hkdf:hkdf_test",
+ "@org_golang_x_crypto//internal/subtle:subtle_test",
+ "@org_golang_x_crypto//md4:md4_test",
+ "@org_golang_x_crypto//nacl/auth:auth_test",
+ "@org_golang_x_crypto//nacl/box:box_test",
+ "@org_golang_x_crypto//nacl/secretbox:secretbox_test",
+ "@org_golang_x_crypto//nacl/sign:sign_test",
+ "@org_golang_x_crypto//ocsp:ocsp_test",
+ "@org_golang_x_crypto//openpgp:openpgp_test",
+ "@org_golang_x_crypto//openpgp/armor:armor_test",
+ "@org_golang_x_crypto//openpgp/clearsign:clearsign_test",
+ "@org_golang_x_crypto//openpgp/elgamal:elgamal_test",
+ "@org_golang_x_crypto//openpgp/packet:packet_test",
+ "@org_golang_x_crypto//openpgp/s2k:s2k_test",
+ "@org_golang_x_crypto//otr:otr_test",
+ "@org_golang_x_crypto//pbkdf2:pbkdf2_test",
+ "@org_golang_x_crypto//pkcs12:pkcs12_test",
+ "@org_golang_x_crypto//pkcs12/internal/rc2:rc2_test",
+ "@org_golang_x_crypto//poly1305:poly1305_test",
+ "@org_golang_x_crypto//ripemd160:ripemd160_test",
+ "@org_golang_x_crypto//salsa20:salsa20_test",
+ "@org_golang_x_crypto//salsa20/salsa:salsa_test",
+ "@org_golang_x_crypto//scrypt:scrypt_test",
+ "@org_golang_x_crypto//sha3:sha3_test",
+ "@org_golang_x_crypto//ssh/internal/bcrypt_pbkdf:bcrypt_pbkdf_test",
+ "@org_golang_x_crypto//ssh/knownhosts:knownhosts_test",
+ "@org_golang_x_crypto//tea:tea_test",
+ "@org_golang_x_crypto//twofish:twofish_test",
+ "@org_golang_x_crypto//xtea:xtea_test",
+ "@org_golang_x_crypto//xts:xts_test",
+ ],
+)
+
+test_suite(
+ name = "org_golang_x_net",
+ tests = [
+ "@org_golang_x_net//context:context_test",
+ "@org_golang_x_net//context/ctxhttp:ctxhttp_test",
+ "@org_golang_x_net//dns/dnsmessage:dnsmessage_test",
+ "@org_golang_x_net//html:html_test",
+ "@org_golang_x_net//html/atom:atom_test",
+ "@org_golang_x_net//http/httpguts:httpguts_test",
+ "@org_golang_x_net//http/httpproxy:httpproxy_test",
+ "@org_golang_x_net//http2/h2c:h2c_test",
+ "@org_golang_x_net//http2/hpack:hpack_test",
+ "@org_golang_x_net//idna:idna_test",
+ "@org_golang_x_net//internal/socks:socks_test",
+ "@org_golang_x_net//internal/sockstest:sockstest_test",
+ "@org_golang_x_net//internal/timeseries:timeseries_test",
+ "@org_golang_x_net//ipv4:ipv4_test",
+ "@org_golang_x_net//ipv6:ipv6_test",
+ "@org_golang_x_net//netutil:netutil_test",
+ "@org_golang_x_net//proxy:proxy_test",
+ "@org_golang_x_net//publicsuffix:publicsuffix_test",
+ "@org_golang_x_net//trace:trace_test",
+ "@org_golang_x_net//webdav:webdav_test",
+ "@org_golang_x_net//webdav/internal/xml:xml_test",
+ "@org_golang_x_net//websocket:websocket_test",
+ "@org_golang_x_net//xsrftoken:xsrftoken_test",
+ ],
+)
+
+test_suite(
+ name = "org_golang_x_sys",
+ tests = [
+ "@org_golang_x_sys//cpu:cpu_test",
+ "@org_golang_x_sys//execabs:execabs_test",
+ "@org_golang_x_sys//internal/unsafeheader:unsafeheader_test",
+ "@org_golang_x_sys//plan9:plan9_test",
+ "@org_golang_x_sys//unix/internal/mkmerge:mkmerge_test",
+ "@org_golang_x_sys//windows/registry:registry_test",
+ "@org_golang_x_sys//windows/svc:svc_test",
+ "@org_golang_x_sys//windows/svc/eventlog:eventlog_test",
+ "@org_golang_x_sys//windows/svc/mgr:mgr_test",
+ ],
+)
+
+test_suite(
+ name = "org_golang_x_text",
+ tests = [
+ "@org_golang_x_text//cases:cases_test",
+ "@org_golang_x_text//collate:collate_test",
+ "@org_golang_x_text//collate/build:build_test",
+ "@org_golang_x_text//currency:currency_test",
+ "@org_golang_x_text//date:date_test",
+ "@org_golang_x_text//encoding:encoding_test",
+ "@org_golang_x_text//encoding/htmlindex:htmlindex_test",
+ "@org_golang_x_text//encoding/ianaindex:ianaindex_test",
+ "@org_golang_x_text//feature/plural:plural_test",
+ "@org_golang_x_text//internal:internal_test",
+ "@org_golang_x_text//internal/catmsg:catmsg_test",
+ "@org_golang_x_text//internal/colltab:colltab_test",
+ "@org_golang_x_text//internal/export/idna:idna_test",
+ "@org_golang_x_text//internal/export/unicode:unicode_test",
+ "@org_golang_x_text//internal/format:format_test",
+ "@org_golang_x_text//internal/language:language_test",
+ "@org_golang_x_text//internal/language/compact:compact_test",
+ "@org_golang_x_text//internal/number:number_test",
+ "@org_golang_x_text//internal/stringset:stringset_test",
+ "@org_golang_x_text//internal/tag:tag_test",
+ "@org_golang_x_text//internal/triegen:triegen_test",
+ "@org_golang_x_text//internal/ucd:ucd_test",
+ "@org_golang_x_text//language:language_test",
+ "@org_golang_x_text//language/display:display_test",
+ "@org_golang_x_text//message:message_test",
+ "@org_golang_x_text//message/catalog:catalog_test",
+ "@org_golang_x_text//number:number_test",
+ "@org_golang_x_text//runes:runes_test",
+ "@org_golang_x_text//search:search_test",
+ "@org_golang_x_text//secure/bidirule:bidirule_test",
+ "@org_golang_x_text//secure/precis:precis_test",
+ "@org_golang_x_text//transform:transform_test",
+ "@org_golang_x_text//unicode/bidi:bidi_test",
+ "@org_golang_x_text//unicode/cldr:cldr_test",
+ "@org_golang_x_text//unicode/norm:norm_test",
+ "@org_golang_x_text//unicode/rangetable:rangetable_test",
+ "@org_golang_x_text//unicode/runenames:runenames_test",
+ "@org_golang_x_text//width:width_test",
+ ],
+)
+
+test_suite(
+ name = "org_golang_x_tools",
+ tests = [
+ "@org_golang_x_tools//benchmark/parse:parse_test",
+ "@org_golang_x_tools//cmd/benchcmp:benchcmp_test",
+ "@org_golang_x_tools//cmd/digraph:digraph_test",
+ "@org_golang_x_tools//cmd/getgo:getgo_test",
+ "@org_golang_x_tools//cmd/go-contrib-init:go-contrib-init_test",
+ "@org_golang_x_tools//cmd/splitdwarf/internal/macho:macho_test",
+ "@org_golang_x_tools//cover:cover_test",
+ "@org_golang_x_tools//go/analysis:analysis_test",
+ "@org_golang_x_tools//go/analysis/passes/internal/analysisutil:analysisutil_test",
+ "@org_golang_x_tools//go/ast/astutil:astutil_test",
+ "@org_golang_x_tools//go/callgraph/static:static_test",
+ "@org_golang_x_tools//go/callgraph/vta/internal/trie:trie_test",
+ "@org_golang_x_tools//go/cfg:cfg_test",
+ "@org_golang_x_tools//go/vcs:vcs_test",
+ "@org_golang_x_tools//godoc/redirect:redirect_test",
+ "@org_golang_x_tools//godoc/vfs:vfs_test",
+ "@org_golang_x_tools//godoc/vfs/gatefs:gatefs_test",
+ "@org_golang_x_tools//godoc/vfs/mapfs:mapfs_test",
+ "@org_golang_x_tools//internal/bug:bug_test",
+ "@org_golang_x_tools//internal/diff:diff_test",
+ "@org_golang_x_tools//internal/diff/lcs:lcs_test",
+ "@org_golang_x_tools//internal/diff/myers:myers_test",
+ "@org_golang_x_tools//internal/event:event_test",
+ "@org_golang_x_tools//internal/event/export:export_test",
+ "@org_golang_x_tools//internal/event/export/ocagent:ocagent_test",
+ "@org_golang_x_tools//internal/event/export/ocagent/wire:wire_test",
+ "@org_golang_x_tools//internal/event/label:label_test",
+ "@org_golang_x_tools//internal/fastwalk:fastwalk_test",
+ "@org_golang_x_tools//internal/fuzzy:fuzzy_test",
+ "@org_golang_x_tools//internal/gopathwalk:gopathwalk_test",
+ "@org_golang_x_tools//internal/jsonrpc2:jsonrpc2_test",
+ "@org_golang_x_tools//internal/jsonrpc2/servertest:servertest_test",
+ "@org_golang_x_tools//internal/jsonrpc2_v2:jsonrpc2_v2_test",
+ "@org_golang_x_tools//internal/memoize:memoize_test",
+ "@org_golang_x_tools//internal/persistent:persistent_test",
+ "@org_golang_x_tools//internal/proxydir:proxydir_test",
+ "@org_golang_x_tools//internal/robustio:robustio_test",
+ "@org_golang_x_tools//internal/stack:stack_test",
+ "@org_golang_x_tools//internal/typesinternal:typesinternal_test",
+ "@org_golang_x_tools//playground/socket:socket_test",
+ "@org_golang_x_tools//refactor/satisfy:satisfy_test",
+ "@org_golang_x_tools//txtar:txtar_test",
+ ],
+)
+
+test_suite(
+ name = "com_github_golang_glog",
+ tests = [
+ "@com_github_golang_glog//:glog_test",
+ ],
+)
+
+test_suite(
+ name = "org_golang_x_sync",
+ tests = [
+ "@org_golang_x_sync//errgroup:errgroup_test",
+ "@org_golang_x_sync//semaphore:semaphore_test",
+ "@org_golang_x_sync//singleflight:singleflight_test",
+ "@org_golang_x_sync//syncmap:syncmap_test",
+ ],
+)
+
+test_suite(
+ name = "org_golang_x_mod",
+ tests = [
+ "@org_golang_x_mod//modfile:modfile_test",
+ "@org_golang_x_mod//module:module_test",
+ "@org_golang_x_mod//semver:semver_test",
+ "@org_golang_x_mod//sumdb:sumdb_test",
+ "@org_golang_x_mod//sumdb/dirhash:dirhash_test",
+ "@org_golang_x_mod//sumdb/note:note_test",
+ "@org_golang_x_mod//sumdb/storage:storage_test",
+ ],
+)
+
+build_test(
+ name = "build_only",
+ targets = [
+ "@org_golang_x_crypto//ssh/agent:agent",
+ "@org_golang_x_crypto//ssh/test:test",
+ "@org_golang_x_crypto//ssh:ssh",
+ "@org_golang_x_net//bpf:bpf",
+ "@org_golang_x_net//html/charset:charset",
+ "@org_golang_x_net//http2:http2",
+ "@org_golang_x_net//icmp:icmp",
+ "@org_golang_x_net//nettest:nettest",
+ "@org_golang_x_net//lif:lif",
+ "@org_golang_x_net//route:route",
+ "@org_golang_x_sys//unix:unix",
+ "@org_golang_x_sys//windows:windows",
+ "@org_golang_x_text//encoding/charmap:charmap",
+ "@org_golang_x_text//encoding/japanese:japanese",
+ "@org_golang_x_text//encoding/korean:korean",
+ "@org_golang_x_text//encoding/simplifiedchinese:simplifiedchinese",
+ "@org_golang_x_text//encoding/traditionalchinese:traditionalchinese",
+ "@org_golang_x_text//encoding/unicode/utf32:utf32",
+ "@org_golang_x_text//encoding/unicode:unicode",
+ "@org_golang_x_text//message/pipeline:pipeline",
+ "@org_golang_x_tools//blog:blog",
+ "@org_golang_x_tools//cmd/bundle:bundle",
+ "@org_golang_x_tools//cmd/callgraph:callgraph",
+ "@org_golang_x_tools//cmd/file2fuzz:file2fuzz",
+ "@org_golang_x_tools//cmd/fiximports:fiximports",
+ "@org_golang_x_tools//cmd/godoc:godoc",
+ "@org_golang_x_tools//cmd/gorename:gorename",
+ "@org_golang_x_tools//cmd/guru:guru",
+ "@org_golang_x_tools//cmd/signature-fuzzer/fuzz-driver:fuzz-driver",
+ "@org_golang_x_tools//cmd/signature-fuzzer/fuzz-runner:fuzz-runner",
+ "@org_golang_x_tools//cmd/stringer:stringer",
+ "@org_golang_x_tools//container/intsets:intsets",
+ "@org_golang_x_tools//copyright:copyright",
+ "@org_golang_x_tools//go/analysis/analysistest:analysistest",
+ "@org_golang_x_tools//go/analysis/multichecker:multichecker",
+ "@org_golang_x_tools//go/analysis/passes/asmdecl:asmdecl",
+ "@org_golang_x_tools//go/analysis/passes/assign:assign",
+ "@org_golang_x_tools//go/analysis/passes/atomic:atomic",
+ "@org_golang_x_tools//go/analysis/passes/atomicalign:atomicalign",
+ "@org_golang_x_tools//go/analysis/passes/bools:bools",
+ "@org_golang_x_tools//go/analysis/passes/buildssa:buildssa",
+ "@org_golang_x_tools//go/analysis/passes/buildtag:buildtag",
+ "@org_golang_x_tools//go/analysis/passes/cgocall:cgocall",
+ "@org_golang_x_tools//go/analysis/passes/composite:composite",
+ "@org_golang_x_tools//go/analysis/passes/copylock:copylock",
+ "@org_golang_x_tools//go/analysis/passes/ctrlflow:ctrlflow",
+ "@org_golang_x_tools//go/analysis/passes/deepequalerrors:deepequalerrors",
+ "@org_golang_x_tools//go/analysis/passes/errorsas:errorsas",
+ "@org_golang_x_tools//go/analysis/passes/fieldalignment:fieldalignment",
+ "@org_golang_x_tools//go/analysis/passes/findcall:findcall",
+ "@org_golang_x_tools//go/analysis/passes/framepointer:framepointer",
+ "@org_golang_x_tools//go/analysis/passes/httpresponse:httpresponse",
+ "@org_golang_x_tools//go/analysis/passes/ifaceassert:ifaceassert",
+ "@org_golang_x_tools//go/analysis/passes/loopclosure:loopclosure",
+ "@org_golang_x_tools//go/analysis/passes/lostcancel:lostcancel",
+ "@org_golang_x_tools//go/analysis/passes/nilfunc:nilfunc",
+ "@org_golang_x_tools//go/analysis/passes/nilness:nilness",
+ "@org_golang_x_tools//go/analysis/passes/pkgfact:pkgfact",
+ "@org_golang_x_tools//go/analysis/passes/printf:printf",
+ "@org_golang_x_tools//go/analysis/passes/reflectvaluecompare:reflectvaluecompare",
+ "@org_golang_x_tools//go/analysis/passes/shadow:shadow",
+ "@org_golang_x_tools//go/analysis/passes/shift:shift",
+ "@org_golang_x_tools//go/analysis/passes/sigchanyzer:sigchanyzer",
+ "@org_golang_x_tools//go/analysis/passes/sortslice:sortslice",
+ "@org_golang_x_tools//go/analysis/passes/stdmethods:stdmethods",
+ "@org_golang_x_tools//go/analysis/passes/stringintconv:stringintconv",
+ "@org_golang_x_tools//go/analysis/passes/structtag:structtag",
+ "@org_golang_x_tools//go/analysis/passes/testinggoroutine:testinggoroutine",
+ "@org_golang_x_tools//go/analysis/passes/tests:tests",
+ "@org_golang_x_tools//go/analysis/passes/unmarshal:unmarshal",
+ "@org_golang_x_tools//go/analysis/passes/unreachable:unreachable",
+ "@org_golang_x_tools//go/analysis/passes/unsafeptr:unsafeptr",
+ "@org_golang_x_tools//go/analysis/passes/unusedresult:unusedresult",
+ "@org_golang_x_tools//go/analysis/passes/unusedwrite:unusedwrite",
+ "@org_golang_x_tools//go/analysis/passes/timeformat:timeformat",
+ "@org_golang_x_tools//go/analysis/passes/usesgenerics:usesgenerics",
+ "@org_golang_x_tools//go/analysis/unitchecker:unitchecker",
+ "@org_golang_x_tools//go/ast/inspector:inspector",
+ "@org_golang_x_tools//go/buildutil:buildutil",
+ "@org_golang_x_tools//go/callgraph/cha:cha",
+ "@org_golang_x_tools//go/callgraph/rta:rta",
+ "@org_golang_x_tools//go/callgraph/vta:vta",
+ "@org_golang_x_tools//go/expect:expect",
+ "@org_golang_x_tools//go/gccgoexportdata:gccgoexportdata",
+ "@org_golang_x_tools//go/gcexportdata:gcexportdata",
+ "@org_golang_x_tools//go/loader:loader",
+ "@org_golang_x_tools//go/packages/packagestest/testdata:testdata",
+ "@org_golang_x_tools//go/packages/packagestest:packagestest",
+ "@org_golang_x_tools//go/packages:packages",
+ "@org_golang_x_tools//go/pointer:pointer",
+ "@org_golang_x_tools//go/ssa/interp:interp",
+ "@org_golang_x_tools//go/ssa/ssautil:ssautil",
+ "@org_golang_x_tools//go/ssa:ssa",
+ "@org_golang_x_tools//go/types/typeutil:typeutil",
+ "@org_golang_x_tools//go/types/objectpath:objectpath",
+ "@org_golang_x_tools//godoc/static:static",
+ "@org_golang_x_tools//godoc/vfs/zipfs:zipfs",
+ "@org_golang_x_tools//godoc:godoc",
+ "@org_golang_x_tools//present:present",
+ "@org_golang_x_tools//refactor/eg:eg",
+ "@org_golang_x_tools//refactor/importgraph:importgraph",
+ "@org_golang_x_tools//refactor/rename:rename",
+ "@org_golang_x_mod//sumdb/tlog:tlog",
+ "@org_golang_x_mod//zip:zip",
+ ],
+)
diff --git a/tests/integration/popular_repos/README.rst b/tests/integration/popular_repos/README.rst
new file mode 100644
index 00000000..ad071a37
--- /dev/null
+++ b/tests/integration/popular_repos/README.rst
@@ -0,0 +1,234 @@
+Popular repository tests
+========================
+
+These tests are designed to check that gazelle and rules_go together can cope
+with a list of popluar repositories people depend on.
+
+It helps catch changes that might break a large number of users.
+
+.. contents::
+
+org_golang_x_crypto
+___________________
+
+This runs tests from the repository `golang.org/x/crypto <https://golang.org/x/crypto>`_
+
+* @org_golang_x_crypto//acme:acme_test
+* @org_golang_x_crypto//acme/autocert:autocert_test
+* @org_golang_x_crypto//argon2:argon2_test
+* @org_golang_x_crypto//bcrypt:bcrypt_test
+* @org_golang_x_crypto//blake2b:blake2b_test
+* @org_golang_x_crypto//blake2s:blake2s_test
+* @org_golang_x_crypto//blowfish:blowfish_test
+* @org_golang_x_crypto//bn256:bn256_test
+* @org_golang_x_crypto//cast5:cast5_test
+* @org_golang_x_crypto//chacha20:chacha20_test
+* @org_golang_x_crypto//chacha20poly1305:chacha20poly1305_test
+* @org_golang_x_crypto//cryptobyte:cryptobyte_test
+* @org_golang_x_crypto//curve25519:curve25519_test
+* @org_golang_x_crypto//ed25519:ed25519_test
+* @org_golang_x_crypto//hkdf:hkdf_test
+* @org_golang_x_crypto//internal/subtle:subtle_test
+* @org_golang_x_crypto//md4:md4_test
+* @org_golang_x_crypto//nacl/auth:auth_test
+* @org_golang_x_crypto//nacl/box:box_test
+* @org_golang_x_crypto//nacl/secretbox:secretbox_test
+* @org_golang_x_crypto//nacl/sign:sign_test
+* @org_golang_x_crypto//ocsp:ocsp_test
+* @org_golang_x_crypto//openpgp:openpgp_test
+* @org_golang_x_crypto//openpgp/armor:armor_test
+* @org_golang_x_crypto//openpgp/clearsign:clearsign_test
+* @org_golang_x_crypto//openpgp/elgamal:elgamal_test
+* @org_golang_x_crypto//openpgp/packet:packet_test
+* @org_golang_x_crypto//openpgp/s2k:s2k_test
+* @org_golang_x_crypto//otr:otr_test
+* @org_golang_x_crypto//pbkdf2:pbkdf2_test
+* @org_golang_x_crypto//pkcs12:pkcs12_test
+* @org_golang_x_crypto//pkcs12/internal/rc2:rc2_test
+* @org_golang_x_crypto//poly1305:poly1305_test
+* @org_golang_x_crypto//ripemd160:ripemd160_test
+* @org_golang_x_crypto//salsa20:salsa20_test
+* @org_golang_x_crypto//salsa20/salsa:salsa_test
+* @org_golang_x_crypto//scrypt:scrypt_test
+* @org_golang_x_crypto//sha3:sha3_test
+* @org_golang_x_crypto//ssh/internal/bcrypt_pbkdf:bcrypt_pbkdf_test
+* @org_golang_x_crypto//ssh/knownhosts:knownhosts_test
+* @org_golang_x_crypto//tea:tea_test
+* @org_golang_x_crypto//twofish:twofish_test
+* @org_golang_x_crypto//xtea:xtea_test
+* @org_golang_x_crypto//xts:xts_test
+
+
+org_golang_x_net
+________________
+
+This runs tests from the repository `golang.org/x/net <https://golang.org/x/net>`_
+
+* @org_golang_x_net//context:context_test
+* @org_golang_x_net//context/ctxhttp:ctxhttp_test
+* @org_golang_x_net//dns/dnsmessage:dnsmessage_test
+* @org_golang_x_net//html:html_test
+* @org_golang_x_net//html/atom:atom_test
+* @org_golang_x_net//http/httpguts:httpguts_test
+* @org_golang_x_net//http/httpproxy:httpproxy_test
+* @org_golang_x_net//http2/h2c:h2c_test
+* @org_golang_x_net//http2/hpack:hpack_test
+* @org_golang_x_net//idna:idna_test
+* @org_golang_x_net//internal/socks:socks_test
+* @org_golang_x_net//internal/sockstest:sockstest_test
+* @org_golang_x_net//internal/timeseries:timeseries_test
+* @org_golang_x_net//ipv4:ipv4_test
+* @org_golang_x_net//ipv6:ipv6_test
+* @org_golang_x_net//netutil:netutil_test
+* @org_golang_x_net//proxy:proxy_test
+* @org_golang_x_net//publicsuffix:publicsuffix_test
+* @org_golang_x_net//trace:trace_test
+* @org_golang_x_net//webdav:webdav_test
+* @org_golang_x_net//webdav/internal/xml:xml_test
+* @org_golang_x_net//websocket:websocket_test
+* @org_golang_x_net//xsrftoken:xsrftoken_test
+
+
+org_golang_x_sys
+________________
+
+This runs tests from the repository `golang.org/x/sys <https://golang.org/x/sys>`_
+
+* @org_golang_x_sys//cpu:cpu_test
+* @org_golang_x_sys//execabs:execabs_test
+* @org_golang_x_sys//internal/unsafeheader:unsafeheader_test
+* @org_golang_x_sys//plan9:plan9_test
+* @org_golang_x_sys//unix/internal/mkmerge:mkmerge_test
+* @org_golang_x_sys//windows/registry:registry_test
+* @org_golang_x_sys//windows/svc:svc_test
+* @org_golang_x_sys//windows/svc/eventlog:eventlog_test
+* @org_golang_x_sys//windows/svc/mgr:mgr_test
+
+
+org_golang_x_text
+_________________
+
+This runs tests from the repository `golang.org/x/text <https://golang.org/x/text>`_
+
+* @org_golang_x_text//cases:cases_test
+* @org_golang_x_text//collate:collate_test
+* @org_golang_x_text//collate/build:build_test
+* @org_golang_x_text//currency:currency_test
+* @org_golang_x_text//date:date_test
+* @org_golang_x_text//encoding:encoding_test
+* @org_golang_x_text//encoding/htmlindex:htmlindex_test
+* @org_golang_x_text//encoding/ianaindex:ianaindex_test
+* @org_golang_x_text//feature/plural:plural_test
+* @org_golang_x_text//internal:internal_test
+* @org_golang_x_text//internal/catmsg:catmsg_test
+* @org_golang_x_text//internal/colltab:colltab_test
+* @org_golang_x_text//internal/export/idna:idna_test
+* @org_golang_x_text//internal/export/unicode:unicode_test
+* @org_golang_x_text//internal/format:format_test
+* @org_golang_x_text//internal/language:language_test
+* @org_golang_x_text//internal/language/compact:compact_test
+* @org_golang_x_text//internal/number:number_test
+* @org_golang_x_text//internal/stringset:stringset_test
+* @org_golang_x_text//internal/tag:tag_test
+* @org_golang_x_text//internal/triegen:triegen_test
+* @org_golang_x_text//internal/ucd:ucd_test
+* @org_golang_x_text//language:language_test
+* @org_golang_x_text//language/display:display_test
+* @org_golang_x_text//message:message_test
+* @org_golang_x_text//message/catalog:catalog_test
+* @org_golang_x_text//number:number_test
+* @org_golang_x_text//runes:runes_test
+* @org_golang_x_text//search:search_test
+* @org_golang_x_text//secure/bidirule:bidirule_test
+* @org_golang_x_text//secure/precis:precis_test
+* @org_golang_x_text//transform:transform_test
+* @org_golang_x_text//unicode/bidi:bidi_test
+* @org_golang_x_text//unicode/cldr:cldr_test
+* @org_golang_x_text//unicode/norm:norm_test
+* @org_golang_x_text//unicode/rangetable:rangetable_test
+* @org_golang_x_text//unicode/runenames:runenames_test
+* @org_golang_x_text//width:width_test
+
+
+org_golang_x_tools
+__________________
+
+This runs tests from the repository `golang.org/x/tools <https://golang.org/x/tools>`_
+
+* @org_golang_x_tools//benchmark/parse:parse_test
+* @org_golang_x_tools//cmd/benchcmp:benchcmp_test
+* @org_golang_x_tools//cmd/digraph:digraph_test
+* @org_golang_x_tools//cmd/getgo:getgo_test
+* @org_golang_x_tools//cmd/go-contrib-init:go-contrib-init_test
+* @org_golang_x_tools//cmd/splitdwarf/internal/macho:macho_test
+* @org_golang_x_tools//cover:cover_test
+* @org_golang_x_tools//go/analysis:analysis_test
+* @org_golang_x_tools//go/analysis/passes/internal/analysisutil:analysisutil_test
+* @org_golang_x_tools//go/ast/astutil:astutil_test
+* @org_golang_x_tools//go/callgraph/static:static_test
+* @org_golang_x_tools//go/callgraph/vta/internal/trie:trie_test
+* @org_golang_x_tools//go/cfg:cfg_test
+* @org_golang_x_tools//go/vcs:vcs_test
+* @org_golang_x_tools//godoc/redirect:redirect_test
+* @org_golang_x_tools//godoc/vfs:vfs_test
+* @org_golang_x_tools//godoc/vfs/gatefs:gatefs_test
+* @org_golang_x_tools//godoc/vfs/mapfs:mapfs_test
+* @org_golang_x_tools//internal/bug:bug_test
+* @org_golang_x_tools//internal/diff:diff_test
+* @org_golang_x_tools//internal/diff/lcs:lcs_test
+* @org_golang_x_tools//internal/diff/myers:myers_test
+* @org_golang_x_tools//internal/event:event_test
+* @org_golang_x_tools//internal/event/export:export_test
+* @org_golang_x_tools//internal/event/export/ocagent:ocagent_test
+* @org_golang_x_tools//internal/event/export/ocagent/wire:wire_test
+* @org_golang_x_tools//internal/event/label:label_test
+* @org_golang_x_tools//internal/fastwalk:fastwalk_test
+* @org_golang_x_tools//internal/fuzzy:fuzzy_test
+* @org_golang_x_tools//internal/gopathwalk:gopathwalk_test
+* @org_golang_x_tools//internal/jsonrpc2:jsonrpc2_test
+* @org_golang_x_tools//internal/jsonrpc2/servertest:servertest_test
+* @org_golang_x_tools//internal/jsonrpc2_v2:jsonrpc2_v2_test
+* @org_golang_x_tools//internal/memoize:memoize_test
+* @org_golang_x_tools//internal/persistent:persistent_test
+* @org_golang_x_tools//internal/proxydir:proxydir_test
+* @org_golang_x_tools//internal/robustio:robustio_test
+* @org_golang_x_tools//internal/stack:stack_test
+* @org_golang_x_tools//internal/typesinternal:typesinternal_test
+* @org_golang_x_tools//playground/socket:socket_test
+* @org_golang_x_tools//refactor/satisfy:satisfy_test
+* @org_golang_x_tools//txtar:txtar_test
+
+
+com_github_golang_glog
+______________________
+
+This runs tests from the repository `github.com/golang/glog <https://github.com/golang/glog>`_
+
+* @com_github_golang_glog//:glog_test
+
+
+org_golang_x_sync
+_________________
+
+This runs tests from the repository `golang.org/x/sync <https://golang.org/x/sync>`_
+
+* @org_golang_x_sync//errgroup:errgroup_test
+* @org_golang_x_sync//semaphore:semaphore_test
+* @org_golang_x_sync//singleflight:singleflight_test
+* @org_golang_x_sync//syncmap:syncmap_test
+
+
+org_golang_x_mod
+________________
+
+This runs tests from the repository `golang.org/x/mod <https://golang.org/x/mod>`_
+
+* @org_golang_x_mod//modfile:modfile_test
+* @org_golang_x_mod//module:module_test
+* @org_golang_x_mod//semver:semver_test
+* @org_golang_x_mod//sumdb:sumdb_test
+* @org_golang_x_mod//sumdb/dirhash:dirhash_test
+* @org_golang_x_mod//sumdb/note:note_test
+* @org_golang_x_mod//sumdb/storage:storage_test
+
+
diff --git a/tests/integration/popular_repos/popular_repos.bzl b/tests/integration/popular_repos/popular_repos.bzl
new file mode 100644
index 00000000..752b654d
--- /dev/null
+++ b/tests/integration/popular_repos/popular_repos.bzl
@@ -0,0 +1,75 @@
+# Copyright 2017 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+##############################
+# Generated file, do not edit!
+##############################
+
+load("@bazel_gazelle//:def.bzl", "go_repository")
+
+def _maybe(repo_rule, name, **kwargs):
+ if name not in native.existing_rules():
+ repo_rule(name = name, **kwargs)
+
+def popular_repos():
+ _maybe(
+ go_repository,
+ name = "org_golang_x_crypto",
+ importpath = "golang.org/x/crypto",
+ strip_prefix = "crypto-5ea612d1eb830b38bc4e914e37f55311eb58adce",
+ type = "zip",
+ urls = ["https://codeload.github.com/golang/crypto/zip/5ea612d1eb830b38bc4e914e37f55311eb58adce"],
+ )
+ _maybe(
+ go_repository,
+ name = "org_golang_x_net",
+ importpath = "golang.org/x/net",
+ commit = "e18ecbb051101a46fc263334b127c89bc7bff7ea",
+ )
+ _maybe(
+ go_repository,
+ name = "org_golang_x_sys",
+ importpath = "golang.org/x/sys",
+ commit = "390168757d9c647283340d526204e3409d5903f3",
+ )
+ _maybe(
+ go_repository,
+ name = "org_golang_x_text",
+ importpath = "golang.org/x/text",
+ commit = "e3aa4adf54f644ca0cb35f1f1fb19b239c40ef04",
+ )
+ _maybe(
+ go_repository,
+ name = "org_golang_x_tools",
+ importpath = "golang.org/x/tools",
+ commit = "fe37c9e135b934191089b245ac29325091462508",
+ )
+ _maybe(
+ go_repository,
+ name = "com_github_golang_glog",
+ importpath = "github.com/golang/glog",
+ commit = "23def4e6c14b4da8ac2ed8007337bc5eb5007998",
+ )
+ _maybe(
+ go_repository,
+ name = "org_golang_x_sync",
+ importpath = "golang.org/x/sync",
+ commit = "036812b2e83c0ddf193dd5a34e034151da389d09",
+ )
+ _maybe(
+ go_repository,
+ name = "org_golang_x_mod",
+ importpath = "golang.org/x/mod",
+ commit = "86c51ed26bb44749b7d60a57bab0e7524656fe8a",
+ )
diff --git a/tests/integration/popular_repos/popular_repos.py b/tests/integration/popular_repos/popular_repos.py
new file mode 100755
index 00000000..dbe645bf
--- /dev/null
+++ b/tests/integration/popular_repos/popular_repos.py
@@ -0,0 +1,336 @@
+#!/usr/bin/env python3
+# Copyright 2017 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from subprocess import check_output, call
+from sys import exit
+from os import path
+
+POPULAR_REPOS = [
+ dict(
+ name = "org_golang_x_crypto",
+ importpath = "golang.org/x/crypto",
+ urls = "https://codeload.github.com/golang/crypto/zip/5ea612d1eb830b38bc4e914e37f55311eb58adce",
+ strip_prefix = "crypto-5ea612d1eb830b38bc4e914e37f55311eb58adce",
+ type = "zip",
+ excludes = [
+ "internal/wycheproof:wycheproof_test", # Needs GOROOT
+ "ssh/agent:agent_test",
+ "ssh/test:test_test",
+ "ssh:ssh_test",
+ ],
+ ),
+
+ dict(
+ name = "org_golang_x_net",
+ importpath = "golang.org/x/net",
+ commit = "e18ecbb051101a46fc263334b127c89bc7bff7ea",
+ excludes = [
+ "bpf:bpf_test", # Needs testdata directory
+ "html/charset:charset_test", # Needs testdata directory
+ "http2:http2_test", # Needs testdata directory
+ "icmp:icmp_test", # icmp requires adjusting kernel options.
+ "internal/socket:socket_test", # Needs GOROOT.
+ "nettest:nettest_test", #
+ "lif:lif_test",
+ ],
+ darwin_tests = [
+ "route:route_test", # Not supported on linux
+ ]
+ ),
+
+ dict(
+ name = "org_golang_x_sys",
+ importpath = "golang.org/x/sys",
+ commit = "390168757d9c647283340d526204e3409d5903f3",
+ excludes = [
+ "unix:unix_test", # TestOpenByHandleAt reads source file.
+ "windows:windows_test", # Needs testdata directory
+ ],
+ ),
+
+ dict(
+ name = "org_golang_x_text",
+ importpath = "golang.org/x/text",
+ commit = "e3aa4adf54f644ca0cb35f1f1fb19b239c40ef04",
+ excludes = [
+ "encoding/charmap:charmap_test", # Needs testdata directory
+ "encoding/japanese:japanese_test", # Needs testdata directory
+ "encoding/korean:korean_test", # Needs testdata directory
+ "encoding/simplifiedchinese:simplifiedchinese_test", # Needs testdata directory
+ "encoding/traditionalchinese:traditionalchinese_test", # Needs testdata directory
+ "encoding/unicode/utf32:utf32_test", # Needs testdata directory
+ "encoding/unicode:unicode_test", # Needs testdata directory
+ "internal/cldrtree:cldrtree_test", # Needs testdata directory
+ "internal/gen/bitfield:bitfield_test", # Needs runfiles
+ "message/pipeline/testdata/test1:test1_test", # Not a real test
+ "message/pipeline:pipeline_test", # Needs testdata directory
+ ],
+ ),
+
+ dict(
+ name = "org_golang_x_tools",
+ importpath = "golang.org/x/tools",
+ commit = "fe37c9e135b934191089b245ac29325091462508",
+ excludes = [
+ "blog:blog_test", # Needs goldmark
+ "cmd/bundle:bundle_test", # Needs testdata directory
+ "cmd/callgraph/testdata/src/pkg:pkg_test", # is testdata
+ "cmd/callgraph:callgraph_test", # Needs testdata directory
+ "cmd/cover:cover_test", # Needs testdata directory
+ "cmd/file2fuzz:file2fuzz_test", # Requires working GOROOT, uses go build
+ "cmd/fiximports:fiximports_test", # requires working GOROOT, not present in CI.
+ "cmd/godoc:godoc_test", # TODO(#417)
+ "cmd/gorename:gorename_test", # TODO(#417)
+ "cmd/guru/testdata/src/referrers:referrers_test", # Not a real test
+ "cmd/guru:guru_test", # Needs testdata directory
+ "cmd/signature-fuzzer/fuzz-driver:fuzz-driver_test", # requires working GOROOT
+ "cmd/signature-fuzzer/fuzz-runner:fuzz-runner_test", # requires working GOROOT
+ "cmd/signature-fuzzer/internal/fuzz-generator:fuzz-generator_test", # requires working GOROOT
+ "cmd/stringer:stringer_test", # Needs testdata directory
+ "container/intsets:intsets_test", # TODO(#413): External test depends on symbols defined in internal test.
+ "copyright:copyright_test", # # requires runfiles
+ "go/analysis/analysistest:analysistest_test", # requires build cache
+ "go/analysis/internal/analysisflags:analysisflags_test", # calls os.Exit(0) in a test
+ "go/analysis/internal/checker:checker_test", # loads test package with go/packages, which probably needs go list
+ "go/analysis/multichecker:multichecker_test", # requires go vet
+ "go/analysis/passes/asmdecl:asmdecl_test", # Needs testdata directory
+ "go/analysis/passes/assign:assign_test", # Needs testdata directory
+ "go/analysis/passes/atomic:atomic_test", # Needs testdata directory
+ "go/analysis/passes/atomicalign:atomicalign_test", # requires go list
+ "go/analysis/passes/bools:bools_test", # Needs testdata directory
+ "go/analysis/passes/buildssa:buildssa_test", # Needs testdata directory
+ "go/analysis/passes/buildtag:buildtag_test", # Needs testdata directory
+ "go/analysis/passes/cgocall:cgocall_test", # Needs testdata directory
+ "go/analysis/passes/composite:composite_test", # Needs testdata directory
+ "go/analysis/passes/composite/testdata/src/a:a_test", # Does not compile
+ "go/analysis/passes/copylock:copylock_test", # Needs testdata directory
+ "go/analysis/passes/ctrlflow:ctrlflow_test", # Needs testdata directory
+ "go/analysis/passes/deepequalerrors:deepequalerrors_test", # requires go list
+ "go/analysis/passes/errorsas:errorsas_test", # requires go list and testdata
+ "go/analysis/passes/fieldalignment:fieldalignment_test", # Needs GOROOT
+ "go/analysis/passes/findcall:findcall_test", # requires build cache
+ "go/analysis/passes/framepointer:framepointer_test", # Needs GOROOT
+ "go/analysis/passes/httpresponse:httpresponse_test", # Needs testdata directory
+ "go/analysis/passes/ifaceassert:ifaceassert_test", # Needs GOROOT
+ "go/analysis/passes/loopclosure:loopclosure_test", # Needs testdata directory
+ "go/analysis/passes/lostcancel:lostcancel_test", # Needs testdata directory
+ "go/analysis/passes/nilfunc:nilfunc_test", # Needs testdata directory
+ "go/analysis/passes/nilness:nilness_test", # Needs testdata directory
+ "go/analysis/passes/pkgfact:pkgfact_test", # requires go list
+ "go/analysis/passes/printf:printf_test", # Needs testdata directory
+ "go/analysis/passes/reflectvaluecompare:reflectvaluecompare_test", # Needs testdata directory
+ "go/analysis/passes/shadow:shadow_test", # Needs testdata directory
+ "go/analysis/passes/shift:shift_test", # Needs testdata director
+ "go/analysis/passes/sigchanyzer:sigchanyzer_test", # Needs testdata directory
+ "go/analysis/passes/sortslice:sortslice_test", # Needs 'go list'
+ "go/analysis/passes/stdmethods:stdmethods_test", # Needs testdata directory
+ "go/analysis/passes/stringintconv:stringintconv_test", # Needs 'go list'
+ "go/analysis/passes/structtag:structtag_test", # Needs testdata directory
+ "go/analysis/passes/testinggoroutine:testinggoroutine_test", # Need 'go env'
+ "go/analysis/passes/tests/testdata/src/a:a_test", # Not a real test
+ "go/analysis/passes/tests/testdata/src/b_x_test:b_x_test_test", # Not a real test
+ "go/analysis/passes/tests/testdata/src/divergent:divergent_test", # Not a real test
+ "go/analysis/passes/tests/testdata/src/typeparams:typeparams_test", # Not a real test
+ "go/analysis/passes/tests:tests_test", # Needs testdata directory
+ "go/analysis/passes/unmarshal:unmarshal_test", # Needs go list
+ "go/analysis/passes/unreachable:unreachable_test", # Needs testdata directory
+ "go/analysis/passes/unsafeptr:unsafeptr_test", # Needs testdata directory
+ "go/analysis/passes/unusedresult:unusedresult_test", # Needs testdata directory
+ "go/analysis/passes/unusedwrite:unusedwrite_test", # Needs testdata directory
+ "go/analysis/passes/timeformat:timeformat_test", # Needs go tool
+ "go/analysis/passes/usesgenerics:usesgenerics_test", # Needs go tool
+ "go/analysis/unitchecker:unitchecker_test", # requires go vet
+ "go/ast/inspector:inspector_test", # requires GOROOT and GOPATH
+ "go/buildutil:buildutil_test", # Needs testdata directory
+ "go/callgraph/cha:cha_test", # Needs testdata directory
+ "go/callgraph/rta:rta_test", # Needs testdata directory
+ "go/callgraph/vta:vta_test", # Needs testdata directory
+ "go/expect:expect_test", # Needs testdata directory
+ "go/gccgoexportdata:gccgoexportdata_test", # Needs testdata directory
+ "go/gcexportdata:gcexportdata_test", # Needs testdata directory
+ "go/internal/gccgoimporter:gccgoimporter_test", # Needs testdata directory
+ "go/loader:loader_test", # Needs testdata directory
+ "go/packages/packagestest/testdata/groups/two/primarymod/expect:expect_test", # Is testdata
+ "go/packages/packagestest/testdata:testdata_test", # Is testdata
+ "go/packages/packagestest:packagestest_test", # requires build cache
+ "go/packages:packages_test", # Hah!
+ "go/pointer:pointer_test", # Needs testdata directory
+ "go/ssa/interp:interp_test", # Needs testdata directory
+ "go/ssa/ssautil:ssautil_test", # Needs testdata directory
+ "go/ssa:ssa_test", # Needs testdata directory
+ "go/types/typeutil:typeutil_test", # requires GOROOT
+ "go/types/objectpath:objectpath_test", # Incomaptible with Go SDK 1.18.3. Fixed in master but not yet released. TODO: fixme
+ "godoc/static:static_test", # requires data files
+ "godoc/vfs/zipfs:zipfs_test", # requires GOROOT
+ "godoc:godoc_test", # requires GOROOT and GOPATH
+ "internal/apidiff:apidiff_test", # Needs testdata directory
+ "internal/diff/difftest:difftest_test", # Needs diff tool
+ "internal/facts:facts_test", # loads test package with go/packages, which probably needs go list
+ "internal/gcimporter:gcimporter_test", # Needs testdata directory
+ "internal/gocommand:gocommand_test", # Needs go tool
+ "internal/imports:imports_test", # Needs testdata directory
+ "internal/typeparams:typeparams_test", # Needs go tool
+ "present:present_test", # Needs goldmark
+ "refactor/eg:eg_test", # Needs testdata directory
+ "refactor/importgraph:importgraph_test", # TODO(#417)
+ "refactor/rename:rename_test", # TODO(#417)
+ ],
+ ),
+
+ dict(
+ name = "com_github_golang_glog",
+ importpath = "github.com/golang/glog",
+ commit = "23def4e6c14b4da8ac2ed8007337bc5eb5007998",
+ ),
+
+ dict(
+ name = "org_golang_x_sync",
+ importpath = "golang.org/x/sync",
+ commit = "036812b2e83c0ddf193dd5a34e034151da389d09",
+ ),
+
+ dict(
+ name = "org_golang_x_mod",
+ importpath = "golang.org/x/mod",
+ commit = "86c51ed26bb44749b7d60a57bab0e7524656fe8a",
+ excludes = [
+ "sumdb/tlog:tlog_test", # Needs network, not available on RBE
+ "zip:zip_test", # Needs vcs tools, not available on RBE
+ ],
+ ),
+ ]
+
+COPYRIGHT_HEADER = """
+# Copyright 2017 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+##############################
+# Generated file, do not edit!
+##############################
+""".strip()
+
+BZL_HEADER = COPYRIGHT_HEADER + """
+
+load("@bazel_gazelle//:def.bzl", "go_repository")
+
+def _maybe(repo_rule, name, **kwargs):
+ if name not in native.existing_rules():
+ repo_rule(name = name, **kwargs)
+
+def popular_repos():
+"""
+
+BUILD_HEADER = COPYRIGHT_HEADER
+
+DOCUMENTATION_HEADER = """
+Popular repository tests
+========================
+
+These tests are designed to check that gazelle and rules_go together can cope
+with a list of popluar repositories people depend on.
+
+It helps catch changes that might break a large number of users.
+
+.. contents::
+
+""".lstrip()
+
+LOAD_BAZEL_TEST_RULE = """
+load("@bazel_skylib//rules:build_test.bzl", "build_test")
+"""
+
+def popular_repos_bzl():
+ with open(path.join(path.dirname(__file__), "popular_repos.bzl"), "w") as f:
+ f.write(BZL_HEADER)
+ for repo in POPULAR_REPOS:
+ f.write(" _maybe(\n go_repository,\n")
+ for k in ["name", "importpath", "commit", "strip_prefix", "type", "build_file_proto_mode"]:
+ if k in repo: f.write(' {} = "{}",\n'.format(k, repo[k]))
+ for k in ["urls"]:
+ if k in repo: f.write(' {} = ["{}"],\n'.format(k, repo[k]))
+ f.write(" )\n")
+
+def build_bazel():
+ with open(path.join(path.dirname(__file__), "BUILD.bazel"), "w") as f:
+ f.write(BUILD_HEADER)
+ f.write("\n" + LOAD_BAZEL_TEST_RULE)
+ build_only = []
+ for repo in POPULAR_REPOS:
+ name = repo["name"]
+ tests = check_output(["bazel", "query", "kind(go_test, \"@{}//...\")".format(name)], text=True).split("\n")
+ excludes = ["@{}//{}".format(name, l) for l in repo.get("excludes", [])]
+ for k in repo:
+ if k.endswith("_excludes") or k.endswith("_tests"):
+ excludes.extend(["@{}//{}".format(name, l) for l in repo[k]])
+ invalid_excludes = [t for t in excludes if not t in tests]
+ if invalid_excludes:
+ exit("Invalid excludes found: {}".format(invalid_excludes))
+ build_only.extend(excludes)
+ f.write('\ntest_suite(\n')
+ f.write(' name = "{}",\n'.format(name))
+ f.write(' tests = [\n')
+ actual = []
+ for test in sorted(tests, key=lambda test: test.replace(":", "!")):
+ if test in excludes or not test: continue
+ f.write(' "{}",\n'.format(test))
+ actual.append(test)
+ f.write(' ],\n')
+ #TODO: add in the platform "select" tests
+ f.write(')\n')
+ repo["actual"] = actual
+
+ # add bazel test rule
+ f.write('\nbuild_test(\n')
+ f.write(' name = "{}",\n'.format("build_only"))
+ f.write(' targets = [\n')
+ for package in build_only:
+ if "/internal/" not in package and "/testdata/" not in package:
+ if package.endswith("_test"):
+ f.write(' "{}",\n'.format(package[:-5]))
+ else:
+ f.write(' "{}",\n'.format(package))
+ f.write(' ],\n')
+ f.write(')\n')
+
+def readme_rst():
+ with open(path.join(path.dirname(__file__), "README.rst"), "w") as f:
+ f.write(DOCUMENTATION_HEADER)
+ for repo in POPULAR_REPOS:
+ name = repo["name"]
+ f.write("{}\n{}\n\n".format(name, "_"*len(name)))
+ f.write("This runs tests from the repository `{0} <https://{0}>`_\n\n".format(repo["importpath"]))
+ for test in repo["actual"]:
+ f.write("* {}\n".format(test))
+ f.write("\n\n")
+
+
+def main():
+ popular_repos_bzl()
+ build_bazel()
+ readme_rst()
+
+if __name__ == "__main__":
+ main()
diff --git a/tests/integration/reproducibility/BUILD.bazel b/tests/integration/reproducibility/BUILD.bazel
new file mode 100644
index 00000000..db5fd9b6
--- /dev/null
+++ b/tests/integration/reproducibility/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "reproducibility_test",
+ srcs = ["reproducibility_test.go"],
+)
diff --git a/tests/integration/reproducibility/README.rst b/tests/integration/reproducibility/README.rst
new file mode 100644
index 00000000..1ac77510
--- /dev/null
+++ b/tests/integration/reproducibility/README.rst
@@ -0,0 +1,14 @@
+Reproducibility
+
+reproducibility_test
+--------------------
+Verifies that the files generated when building a set of targets are identical,
+even when built from multiple copies of the same workspace.
+
+Currently covers pure ``go_binary`` targets and a cgo ``go_binary`` with
+``linkmode = "c-archive"``.
+
+TODO: cover more modes. Currently, it seems like a cgo ``go_binary`` that
+produces an executable is not reproducible on macOS. This is most likely
+due to the external linker, since all the inputs to the linker are identical.
+Needs investigation.
diff --git a/tests/integration/reproducibility/reproducibility_test.go b/tests/integration/reproducibility/reproducibility_test.go
new file mode 100644
index 00000000..2e9bc591
--- /dev/null
+++ b/tests/integration/reproducibility/reproducibility_test.go
@@ -0,0 +1,384 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package reproducibility_test
+
+import (
+ "bytes"
+ "crypto/sha256"
+ "encoding/hex"
+ "errors"
+ "fmt"
+ "io"
+ "io/ioutil"
+ "os"
+ "path/filepath"
+ "strings"
+ "sync"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+
+go_library(
+ name = "empty_lib",
+ srcs = [],
+ importpath = "empty_lib",
+)
+
+go_binary(
+ name = "hello",
+ srcs = ["hello.go"],
+)
+
+go_binary(
+ name = "adder",
+ srcs = [
+ "adder_main.go",
+ "adder.go",
+ "add.c",
+ "add.cpp",
+ "add.h",
+ ],
+ cgo = True,
+ linkmode = "c-archive",
+)
+
+-- hello.go --
+package main
+
+import "fmt"
+
+func main() {
+ fmt.Println("hello")
+}
+
+-- add.h --
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int add_c(int a, int b);
+int add_cpp(int a, int b);
+
+#ifdef __cplusplus
+}
+#endif
+
+-- add.c --
+#include "add.h"
+#include "_cgo_export.h"
+
+int add_c(int a, int b) { return add(a, b); }
+
+-- add.cpp --
+#include "add.h"
+#include "_cgo_export.h"
+
+int add_cpp(int a, int b) { return add(a, b); }
+
+-- adder.go --
+package main
+
+/*
+#include "add.h"
+*/
+import "C"
+
+func AddC(a, b int32) int32 {
+ return int32(C.add_c(C.int(a), C.int(b)))
+}
+
+func AddCPP(a, b int32) int32 {
+ return int32(C.add_cpp(C.int(a), C.int(b)))
+}
+
+//export add
+func add(a, b int32) int32 {
+ return a + b
+}
+
+-- adder_main.go --
+package main
+
+import "fmt"
+
+func main() {
+ // Depend on some stdlib function.
+ fmt.Println("In C, 2 + 2 = ", AddC(2, 2))
+ fmt.Println("In C++, 2 + 2 = ", AddCPP(2, 2))
+}
+
+`,
+ })
+}
+
+func Test(t *testing.T) {
+ wd, err := os.Getwd()
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // Copy the workspace to three other directories.
+ // We'll run bazel commands in those directories, not here. We clean those
+ // workspaces at the end of the test, but we don't want to clean this
+ // directory because it's shared with other tests.
+ dirs := []string{wd + "0", wd + "1", wd + "2"}
+ for _, dir := range dirs {
+ if err := copyTree(dir, wd); err != nil {
+ t.Fatal(err)
+ }
+ defer func() {
+ cmd := bazel_testing.BazelCmd("clean", "--expunge")
+ cmd.Dir = dir
+ cmd.Run()
+ os.RemoveAll(dir)
+ }()
+ }
+ defer func() {
+ var wg sync.WaitGroup
+ wg.Add(len(dirs))
+ for _, dir := range dirs {
+ go func(dir string) {
+ defer wg.Done()
+ cmd := bazel_testing.BazelCmd("clean", "--expunge")
+ cmd.Dir = dir
+ cmd.Run()
+ os.RemoveAll(dir)
+ }(dir)
+ }
+ wg.Wait()
+ }()
+
+ // Change the source file in dir2. We should detect a difference here.
+ hello2Path := filepath.Join(dirs[2], "hello.go")
+ hello2File, err := os.OpenFile(hello2Path, os.O_WRONLY|os.O_APPEND, 0666)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer hello2File.Close()
+ if _, err := hello2File.WriteString(`func init() { fmt.Println("init") }`); err != nil {
+ t.Fatal(err)
+ }
+ if err := hello2File.Close(); err != nil {
+ t.Fatal(err)
+ }
+
+ // Build the targets in each directory.
+ var wg sync.WaitGroup
+ wg.Add(len(dirs))
+ for _, dir := range dirs {
+ go func(dir string) {
+ defer wg.Done()
+ cmd := bazel_testing.BazelCmd("build",
+ "//:all",
+ "@io_bazel_rules_go//go/tools/builders:go_path",
+ "@go_sdk//:builder",
+ )
+ cmd.Dir = dir
+ if err := cmd.Run(); err != nil {
+ t.Fatalf("in %s, error running %s: %v", dir, strings.Join(cmd.Args, " "), err)
+ }
+ }(dir)
+ }
+ wg.Wait()
+
+ // Hash files in each bazel-bin directory.
+ dirHashes := make([][]fileHash, len(dirs))
+ errs := make([]error, len(dirs))
+ wg.Add(len(dirs))
+ for i := range dirs {
+ go func(i int) {
+ defer wg.Done()
+ dirHashes[i], errs[i] = hashFiles(filepath.Join(dirs[i], "bazel-bin"))
+ }(i)
+ }
+ wg.Wait()
+ for _, err := range errs {
+ if err != nil {
+ t.Fatal(err)
+ }
+ }
+
+ // Compare dir0 and dir1. They should be identical.
+ if err := compareHashes(dirHashes[0], dirHashes[1]); err != nil {
+ t.Fatal(err)
+ }
+
+ // Compare dir0 and dir2. They should be different.
+ if err := compareHashes(dirHashes[0], dirHashes[2]); err == nil {
+ t.Fatalf("dir0 and dir2 are the same)", len(dirHashes[0]))
+ }
+
+ // Check that the go_sdk path doesn't appear in the builder binary. This path is different
+ // nominally different per workspace (but in these tests, the go_sdk paths are all set to the same
+ // path in WORKSPACE) -- so if this path is in the builder binary, then builds between workspaces
+ // would be partially non cacheable.
+ builder_file, err := os.Open(filepath.Join(dirs[0], "bazel-bin", "external", "go_sdk", "builder"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer builder_file.Close()
+ builder_data, err := ioutil.ReadAll(builder_file)
+ if err != nil {
+ t.Fatal(err)
+ }
+ if bytes.Index(builder_data, []byte("go_sdk")) != -1 {
+ t.Fatalf("Found go_sdk path in builder binary, builder tool won't be reproducible")
+ }
+}
+
+func copyTree(dstRoot, srcRoot string) error {
+ return filepath.Walk(srcRoot, func(srcPath string, info os.FileInfo, err error) error {
+ if err != nil {
+ return err
+ }
+
+ rel, err := filepath.Rel(srcRoot, srcPath)
+ if err != nil {
+ return err
+ }
+ var dstPath string
+ if rel == "." {
+ dstPath = dstRoot
+ } else {
+ dstPath = filepath.Join(dstRoot, rel)
+ }
+
+ if info.IsDir() {
+ return os.Mkdir(dstPath, 0777)
+ }
+ r, err := os.Open(srcPath)
+ if err != nil {
+ return nil
+ }
+ defer r.Close()
+ w, err := os.Create(dstPath)
+ if err != nil {
+ return err
+ }
+ defer w.Close()
+ if _, err := io.Copy(w, r); err != nil {
+ return err
+ }
+ return w.Close()
+ })
+}
+
+func compareHashes(lhs, rhs []fileHash) error {
+ buf := &bytes.Buffer{}
+ for li, ri := 0, 0; li < len(lhs) || ri < len(rhs); {
+ if li < len(lhs) && (ri == len(rhs) || lhs[li].rel < rhs[ri].rel) {
+ fmt.Fprintf(buf, "%s only in left\n", lhs[li].rel)
+ li++
+ continue
+ }
+ if ri < len(rhs) && (li == len(lhs) || rhs[ri].rel < lhs[li].rel) {
+ fmt.Fprintf(buf, "%s only in right\n", rhs[ri].rel)
+ ri++
+ continue
+ }
+ if lhs[li].hash != rhs[ri].hash {
+ fmt.Fprintf(buf, "%s is different: %s %s\n", lhs[li].rel, lhs[li].hash, rhs[ri].hash)
+ }
+ li++
+ ri++
+ }
+ if errStr := buf.String(); errStr != "" {
+ return errors.New(errStr)
+ }
+ return nil
+}
+
+type fileHash struct {
+ rel, hash string
+}
+
+func hashFiles(dir string) ([]fileHash, error) {
+ // Follow top-level symbolic link
+ root := dir
+ for {
+ info, err := os.Lstat(root)
+ if err != nil {
+ return nil, err
+ }
+ if info.Mode()&os.ModeType != os.ModeSymlink {
+ break
+ }
+ rel, err := os.Readlink(root)
+ if err != nil {
+ return nil, err
+ }
+ if filepath.IsAbs(rel) {
+ root = rel
+ } else {
+ root = filepath.Join(filepath.Dir(dir), rel)
+ }
+ }
+
+ // Gather hashes of files within the tree.
+ var hashes []fileHash
+ var sum [16]byte
+ err := filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
+ if err != nil {
+ return err
+ }
+
+ // Skip directories and symbolic links to directories.
+ if info.Mode()&os.ModeType == os.ModeSymlink {
+ info, err = os.Stat(path)
+ if err != nil {
+ return err
+ }
+ }
+ if info.IsDir() {
+ return nil
+ }
+
+ // Skip MANIFEST, runfiles_manifest, and .lo files.
+ // TODO(jayconrod): find out why .lo files are not reproducible.
+ base := filepath.Base(path)
+ if base == "MANIFEST" || strings.HasSuffix(base, ".runfiles_manifest") || strings.HasSuffix(base, ".lo") {
+ return nil
+ }
+
+ rel, err := filepath.Rel(root, path)
+ if err != nil {
+ return err
+ }
+
+ r, err := os.Open(path)
+ if err != nil {
+ return err
+ }
+ defer r.Close()
+ h := sha256.New()
+ if _, err := io.Copy(h, r); err != nil {
+ return err
+ }
+ hashes = append(hashes, fileHash{rel: rel, hash: hex.EncodeToString(h.Sum(sum[:0]))})
+
+ return nil
+ })
+ if err != nil {
+ return nil, err
+ }
+ return hashes, nil
+}
diff --git a/tests/legacy/README.rst b/tests/legacy/README.rst
new file mode 100644
index 00000000..7da76204
--- /dev/null
+++ b/tests/legacy/README.rst
@@ -0,0 +1,10 @@
+Legacy tests
+============
+
+This is all the tests that were written before we became structured about
+testing methodology.
+
+They are mostly useful, but need restructuring, breaking up and documenting
+before adding to the main test suite.
+
+Help in here is very welcome! \ No newline at end of file
diff --git a/tests/legacy/asm_include/BUILD.bazel b/tests/legacy/asm_include/BUILD.bazel
new file mode 100644
index 00000000..f1d44068
--- /dev/null
+++ b/tests/legacy/asm_include/BUILD.bazel
@@ -0,0 +1,42 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+config_setting(
+ name = "linux_amd64",
+ constraint_values = [
+ "@platforms//cpu:x86_64",
+ "@platforms//os:linux",
+ ],
+)
+
+config_setting(
+ name = "darwin_amd64",
+ constraint_values = [
+ "@platforms//cpu:x86_64",
+ "@platforms//os:macos",
+ ],
+)
+
+LIB_AMD64_SRCS = [
+ "foo_amd64.go",
+ "foo_amd64.s",
+ "foo_amd64.h",
+]
+
+LIB_OTHER_SRCS = ["foo_other.go"]
+
+go_library(
+ name = "go_default_library",
+ srcs = select({
+ ":linux_amd64": LIB_AMD64_SRCS,
+ ":darwin_amd64": LIB_AMD64_SRCS,
+ "//conditions:default": LIB_OTHER_SRCS,
+ }),
+ importpath = "github.com/bazelbuild/rules_go/tests/asm_include",
+)
+
+go_test(
+ name = "go_default_test",
+ size = "small",
+ srcs = ["foo_test.go"],
+ embed = [":go_default_library"],
+)
diff --git a/tests/legacy/asm_include/foo_amd64.go b/tests/legacy/asm_include/foo_amd64.go
new file mode 100644
index 00000000..97dd7f1e
--- /dev/null
+++ b/tests/legacy/asm_include/foo_amd64.go
@@ -0,0 +1,3 @@
+package foo
+
+func foo() int32
diff --git a/tests/legacy/asm_include/foo_amd64.h b/tests/legacy/asm_include/foo_amd64.h
new file mode 100644
index 00000000..b8a8ca33
--- /dev/null
+++ b/tests/legacy/asm_include/foo_amd64.h
@@ -0,0 +1 @@
+#define FOOVAL 42
diff --git a/tests/legacy/asm_include/foo_amd64.s b/tests/legacy/asm_include/foo_amd64.s
new file mode 100644
index 00000000..e306f027
--- /dev/null
+++ b/tests/legacy/asm_include/foo_amd64.s
@@ -0,0 +1,5 @@
+#include "foo_amd64.h"
+
+TEXT ·foo(SB),$0-0
+ MOVQ $FOOVAL,RET(FP)
+ RET
diff --git a/tests/legacy/asm_include/foo_other.go b/tests/legacy/asm_include/foo_other.go
new file mode 100644
index 00000000..b27cd1c8
--- /dev/null
+++ b/tests/legacy/asm_include/foo_other.go
@@ -0,0 +1,7 @@
+package foo
+
+// Other architectures are not supported for this test. This function just
+// returns what the assembly function was supposed to return.
+func foo() int32 {
+ return 42
+}
diff --git a/tests/legacy/asm_include/foo_test.go b/tests/legacy/asm_include/foo_test.go
new file mode 100644
index 00000000..5ca67b94
--- /dev/null
+++ b/tests/legacy/asm_include/foo_test.go
@@ -0,0 +1,10 @@
+package foo
+
+import "testing"
+
+func TestFoo(t *testing.T) {
+ x := foo()
+ if x != 42 {
+ t.Errorf("got %d; want %d", x, 42)
+ }
+}
diff --git a/tests/legacy/binary_test_outputs/BUILD.bazel b/tests/legacy/binary_test_outputs/BUILD.bazel
new file mode 100644
index 00000000..1d34c4ca
--- /dev/null
+++ b/tests/legacy/binary_test_outputs/BUILD.bazel
@@ -0,0 +1,30 @@
+# This test checks that go_binary and go_test produce a single output file.
+# See documentation in single_output_test.bzl.
+
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_test")
+load("@io_bazel_rules_go//go/private/tools:single_output_test.bzl", "single_output_test")
+
+single_output_test(
+ name = "binary_single_output_test",
+ size = "small",
+ dep = ":bin",
+)
+
+go_binary(
+ name = "bin",
+ srcs = ["bin.go"],
+ tags = ["manual"],
+)
+
+single_output_test(
+ name = "test_single_output_test",
+ size = "small",
+ dep = ":test",
+)
+
+go_test(
+ name = "test",
+ size = "small",
+ srcs = ["test.go"],
+ tags = ["manual"],
+)
diff --git a/tests/legacy/binary_test_outputs/bin.go b/tests/legacy/binary_test_outputs/bin.go
new file mode 100644
index 00000000..37148d1f
--- /dev/null
+++ b/tests/legacy/binary_test_outputs/bin.go
@@ -0,0 +1,3 @@
+package main
+
+func Main() {}
diff --git a/tests/legacy/binary_test_outputs/test.go b/tests/legacy/binary_test_outputs/test.go
new file mode 100644
index 00000000..d4635d6c
--- /dev/null
+++ b/tests/legacy/binary_test_outputs/test.go
@@ -0,0 +1 @@
+package binary_test_outputs
diff --git a/tests/legacy/build_constraints/BUILD.bazel b/tests/legacy/build_constraints/BUILD.bazel
new file mode 100644
index 00000000..bacd8e66
--- /dev/null
+++ b/tests/legacy/build_constraints/BUILD.bazel
@@ -0,0 +1,40 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_test(
+ name = "go_default_test",
+ size = "small",
+ srcs = ["build_constraints_test.go"],
+ embed = [":go_default_library"],
+)
+
+go_library(
+ name = "go_default_library",
+ srcs = [
+ # Check suffixes are filtered.
+ "suffix_linux.go",
+ "suffix_unknown.go",
+ # Check that tags are observed.
+ "tag_l.go",
+ "tag_unknown.go",
+ # Check that constraints apply to assembly files.
+ "asm_arm64.s",
+ "asm_linux_amd64.s",
+ "asm_unknown.s",
+ # Check that constraints apply to cgo files.
+ "cgo_linux.go",
+ "cgo_unknown.go",
+ "cgo_linux.c",
+ "cgo_unknown.c",
+ ":c_srcs_group",
+ ],
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/build_constraints",
+)
+
+filegroup(
+ name = "c_srcs_group",
+ srcs = [
+ "cgo_group_linux.c",
+ "cgo_group_unknown.c",
+ ],
+)
diff --git a/tests/legacy/build_constraints/asm_arm64.s b/tests/legacy/build_constraints/asm_arm64.s
new file mode 100644
index 00000000..1308af68
--- /dev/null
+++ b/tests/legacy/build_constraints/asm_arm64.s
@@ -0,0 +1,20 @@
+// Copyright 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// +build arm64
+
+TEXT ·asm(SB),$0-0
+ MOVD $75,R0
+ MOVD R0,RET(FP)
+ RET
diff --git a/tests/legacy/build_constraints/asm_linux_amd64.s b/tests/legacy/build_constraints/asm_linux_amd64.s
new file mode 100644
index 00000000..cfbaa911
--- /dev/null
+++ b/tests/legacy/build_constraints/asm_linux_amd64.s
@@ -0,0 +1,3 @@
+TEXT ·asm(SB),$0-0
+ MOVQ $12,RET(FP)
+ RET
diff --git a/tests/legacy/build_constraints/asm_unknown.s b/tests/legacy/build_constraints/asm_unknown.s
new file mode 100644
index 00000000..b44dc370
--- /dev/null
+++ b/tests/legacy/build_constraints/asm_unknown.s
@@ -0,0 +1,5 @@
+// +build !linux,amd64
+
+TEXT ·asm(SB),$0-0
+ MOVQ $34,RET(FP)
+ RET
diff --git a/tests/legacy/build_constraints/build_constraints_test.go b/tests/legacy/build_constraints/build_constraints_test.go
new file mode 100644
index 00000000..b2ac474e
--- /dev/null
+++ b/tests/legacy/build_constraints/build_constraints_test.go
@@ -0,0 +1,55 @@
+package build_constraints
+
+import (
+ "runtime"
+ "testing"
+)
+
+func check(value string, t *testing.T) {
+ var want string
+ if runtime.GOOS == "linux" {
+ want = "linux"
+ } else {
+ want = "unknown"
+ }
+ if value != want {
+ t.Errorf("got %s; want %s", value, want)
+ }
+}
+
+func TestSuffix(t *testing.T) {
+ check(suffix, t)
+}
+
+func TestTag(t *testing.T) {
+ check(tag, t)
+}
+
+func asm() int
+
+func TestAsm(t *testing.T) {
+ got := asm()
+ var want int
+ if runtime.GOOS == "linux" {
+ want = 12
+ } else if runtime.GOARCH == "arm64" {
+ want = 75
+ } else {
+ want = 34
+ }
+ if got != want {
+ t.Errorf("got %d; want %d", got, want)
+ }
+}
+
+func TestCgoGo(t *testing.T) {
+ check(cgoGo, t)
+}
+
+func TestCgoC(t *testing.T) {
+ check(cgoC, t)
+}
+
+func TestCgoCGroup(t *testing.T) {
+ check(cgoCGroup, t)
+}
diff --git a/tests/legacy/build_constraints/cgo_group_linux.c b/tests/legacy/build_constraints/cgo_group_linux.c
new file mode 100644
index 00000000..1c77b797
--- /dev/null
+++ b/tests/legacy/build_constraints/cgo_group_linux.c
@@ -0,0 +1 @@
+const char* cgoCGroup = "linux";
diff --git a/tests/legacy/build_constraints/cgo_group_unknown.c b/tests/legacy/build_constraints/cgo_group_unknown.c
new file mode 100644
index 00000000..de492e7b
--- /dev/null
+++ b/tests/legacy/build_constraints/cgo_group_unknown.c
@@ -0,0 +1,3 @@
+// +build !linux
+
+const char* cgoCGroup = "unknown";
diff --git a/tests/legacy/build_constraints/cgo_linux.c b/tests/legacy/build_constraints/cgo_linux.c
new file mode 100644
index 00000000..e1277b1c
--- /dev/null
+++ b/tests/legacy/build_constraints/cgo_linux.c
@@ -0,0 +1 @@
+const char* cgoC = "linux";
diff --git a/tests/legacy/build_constraints/cgo_linux.go b/tests/legacy/build_constraints/cgo_linux.go
new file mode 100644
index 00000000..5dd9eaa6
--- /dev/null
+++ b/tests/legacy/build_constraints/cgo_linux.go
@@ -0,0 +1,12 @@
+package build_constraints
+
+/*
+const char* cgoGo = "linux";
+extern const char* cgoC;
+extern const char* cgoCGroup;
+*/
+import "C"
+
+var cgoGo = C.GoString(C.cgoGo)
+var cgoC = C.GoString(C.cgoC)
+var cgoCGroup = C.GoString(C.cgoCGroup)
diff --git a/tests/legacy/build_constraints/cgo_unknown.c b/tests/legacy/build_constraints/cgo_unknown.c
new file mode 100644
index 00000000..2d9d8fcc
--- /dev/null
+++ b/tests/legacy/build_constraints/cgo_unknown.c
@@ -0,0 +1,3 @@
+// +build !linux
+
+const char* cgoC = "unknown";
diff --git a/tests/legacy/build_constraints/cgo_unknown.go b/tests/legacy/build_constraints/cgo_unknown.go
new file mode 100644
index 00000000..ea289017
--- /dev/null
+++ b/tests/legacy/build_constraints/cgo_unknown.go
@@ -0,0 +1,14 @@
+// +build !linux
+
+package build_constraints
+
+/*
+const char* cgoGo = "unknown";
+extern const char* cgoC;
+extern const char* cgoCGroup;
+*/
+import "C"
+
+var cgoGo = C.GoString(C.cgoGo)
+var cgoC = C.GoString(C.cgoC)
+var cgoCGroup = C.GoString(C.cgoCGroup)
diff --git a/tests/legacy/build_constraints/suffix_linux.go b/tests/legacy/build_constraints/suffix_linux.go
new file mode 100644
index 00000000..fdad5aff
--- /dev/null
+++ b/tests/legacy/build_constraints/suffix_linux.go
@@ -0,0 +1,3 @@
+package build_constraints
+
+var suffix = "linux"
diff --git a/tests/legacy/build_constraints/suffix_unknown.go b/tests/legacy/build_constraints/suffix_unknown.go
new file mode 100644
index 00000000..f1952589
--- /dev/null
+++ b/tests/legacy/build_constraints/suffix_unknown.go
@@ -0,0 +1,5 @@
+// +build !linux
+
+package build_constraints
+
+var suffix = "unknown"
diff --git a/tests/legacy/build_constraints/tag_l.go b/tests/legacy/build_constraints/tag_l.go
new file mode 100644
index 00000000..f8269c76
--- /dev/null
+++ b/tests/legacy/build_constraints/tag_l.go
@@ -0,0 +1,5 @@
+// +build linux
+
+package build_constraints
+
+var tag = "linux"
diff --git a/tests/legacy/build_constraints/tag_unknown.go b/tests/legacy/build_constraints/tag_unknown.go
new file mode 100644
index 00000000..ef73cafd
--- /dev/null
+++ b/tests/legacy/build_constraints/tag_unknown.go
@@ -0,0 +1,5 @@
+// +build !linux
+
+package build_constraints
+
+var tag = "unknown"
diff --git a/tests/legacy/cgo_filtered/BUILD.bazel b/tests/legacy/cgo_filtered/BUILD.bazel
new file mode 100644
index 00000000..2c4f8d41
--- /dev/null
+++ b/tests/legacy/cgo_filtered/BUILD.bazel
@@ -0,0 +1,15 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_test(
+ name = "go_default_test",
+ size = "small",
+ srcs = ["pure_test.go"],
+ embed = [":go_default_library"],
+)
+
+go_library(
+ name = "go_default_library",
+ srcs = ["pure.go"],
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/cgo_filtered",
+)
diff --git a/tests/legacy/cgo_filtered/pure.go b/tests/legacy/cgo_filtered/pure.go
new file mode 100644
index 00000000..d8f0c3b2
--- /dev/null
+++ b/tests/legacy/cgo_filtered/pure.go
@@ -0,0 +1,3 @@
+package cgo_filtered
+
+var Value = 42
diff --git a/tests/legacy/cgo_filtered/pure_test.go b/tests/legacy/cgo_filtered/pure_test.go
new file mode 100644
index 00000000..02be3d7a
--- /dev/null
+++ b/tests/legacy/cgo_filtered/pure_test.go
@@ -0,0 +1,9 @@
+package cgo_filtered
+
+import "testing"
+
+func TestFoo(t *testing.T) {
+ if got, want := Value, 42; got != want {
+ t.Errorf("got %d; want %d", got, want)
+ }
+}
diff --git a/tests/legacy/cgo_multi_dir/BUILD.bazel b/tests/legacy/cgo_multi_dir/BUILD.bazel
new file mode 100644
index 00000000..491dbcdd
--- /dev/null
+++ b/tests/legacy/cgo_multi_dir/BUILD.bazel
@@ -0,0 +1,22 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+# TODO(#746) exclude because gazelle does not recognise the rule below
+# gazelle:exclude bar
+# gazelle:exclude foo
+
+go_test(
+ name = "go_default_test",
+ size = "small",
+ srcs = ["cgo_multi_dir_test.go"],
+ embed = [":go_default_library"],
+)
+
+go_library(
+ name = "go_default_library",
+ srcs = [
+ "bar/bar.go",
+ "foo/foo.go",
+ ],
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/cgo_multi_dir",
+)
diff --git a/tests/legacy/cgo_multi_dir/bar/bar.go b/tests/legacy/cgo_multi_dir/bar/bar.go
new file mode 100644
index 00000000..87a326b5
--- /dev/null
+++ b/tests/legacy/cgo_multi_dir/bar/bar.go
@@ -0,0 +1,6 @@
+package cgo_multi_dir
+
+// int bar = 34;
+import "C"
+
+var bar = int(C.bar)
diff --git a/tests/legacy/cgo_multi_dir/cgo_multi_dir_test.go b/tests/legacy/cgo_multi_dir/cgo_multi_dir_test.go
new file mode 100644
index 00000000..4ec054d9
--- /dev/null
+++ b/tests/legacy/cgo_multi_dir/cgo_multi_dir_test.go
@@ -0,0 +1,9 @@
+package cgo_multi_dir
+
+import "testing"
+
+func TestMultiDir(t *testing.T) {
+ if got, want := foo+bar, 46; got != want {
+ t.Errorf("got %d; want %d", got, want)
+ }
+}
diff --git a/tests/legacy/cgo_multi_dir/foo/foo.go b/tests/legacy/cgo_multi_dir/foo/foo.go
new file mode 100644
index 00000000..a396c456
--- /dev/null
+++ b/tests/legacy/cgo_multi_dir/foo/foo.go
@@ -0,0 +1,6 @@
+package cgo_multi_dir
+
+// int foo = 12;
+import "C"
+
+var foo = int(C.foo)
diff --git a/tests/legacy/cgo_opts/BUILD.bazel b/tests/legacy/cgo_opts/BUILD.bazel
new file mode 100644
index 00000000..d8e51c34
--- /dev/null
+++ b/tests/legacy/cgo_opts/BUILD.bazel
@@ -0,0 +1,16 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "go_default_library",
+ srcs = ["cgo_opts.go"],
+ cgo = True,
+ copts = ["-DFOO=1 -DBAR=2 -g -O2"],
+ importpath = "github.com/bazelbuild/rules_go/tests/cgo_opts",
+ visibility = ["//visibility:public"],
+)
+
+go_test(
+ name = "go_default_test",
+ srcs = ["cgo_opts_test.go"],
+ embed = [":go_default_library"],
+)
diff --git a/tests/legacy/cgo_opts/cgo_opts.go b/tests/legacy/cgo_opts/cgo_opts.go
new file mode 100644
index 00000000..27f41ca8
--- /dev/null
+++ b/tests/legacy/cgo_opts/cgo_opts.go
@@ -0,0 +1,9 @@
+package cgo_opts
+
+/*
+#cgo CFLAGS: -DFOO=1 -DBAR=2 -g -O2
+int x = FOO + BAR;
+*/
+import "C"
+
+var x = int(C.x)
diff --git a/tests/legacy/cgo_opts/cgo_opts_test.go b/tests/legacy/cgo_opts/cgo_opts_test.go
new file mode 100644
index 00000000..ff1f7077
--- /dev/null
+++ b/tests/legacy/cgo_opts/cgo_opts_test.go
@@ -0,0 +1,9 @@
+package cgo_opts
+
+import "testing"
+
+func TestCOpts(t *testing.T) {
+ if x != 3 {
+ t.Errorf("got %d; want 3", x)
+ }
+}
diff --git a/tests/legacy/cgo_pthread_flag/BUILD.bazel b/tests/legacy/cgo_pthread_flag/BUILD.bazel
new file mode 100644
index 00000000..b843ea7d
--- /dev/null
+++ b/tests/legacy/cgo_pthread_flag/BUILD.bazel
@@ -0,0 +1,15 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "go_default_library",
+ srcs = ["cgo_pthread_flag.go"],
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/cgo_pthread_flag",
+)
+
+go_test(
+ name = "go_default_test",
+ size = "small",
+ srcs = ["cgo_pthread_flag_test.go"],
+ embed = [":go_default_library"],
+)
diff --git a/tests/legacy/cgo_pthread_flag/cgo_pthread_flag.go b/tests/legacy/cgo_pthread_flag/cgo_pthread_flag.go
new file mode 100644
index 00000000..91233342
--- /dev/null
+++ b/tests/legacy/cgo_pthread_flag/cgo_pthread_flag.go
@@ -0,0 +1,25 @@
+package cgo_pthread_flag
+
+/*
+#include <pthread.h>
+
+void* f(void* p) {
+ *(int*) p = 42;
+ return NULL;
+}
+
+int callFInBackground() {
+ int x;
+ pthread_t thread;
+ pthread_create(&thread, NULL, f, &x);
+ pthread_join(thread, NULL);
+ return x;
+}
+*/
+import "C"
+
+// Wrapper for callFInBackground. We don't support using Cgo directly from
+// tests yet.
+func callFFromGo() int {
+ return int(C.callFInBackground())
+}
diff --git a/tests/legacy/cgo_pthread_flag/cgo_pthread_flag_test.go b/tests/legacy/cgo_pthread_flag/cgo_pthread_flag_test.go
new file mode 100644
index 00000000..cc440617
--- /dev/null
+++ b/tests/legacy/cgo_pthread_flag/cgo_pthread_flag_test.go
@@ -0,0 +1,12 @@
+package cgo_pthread_flag
+
+import "testing"
+
+// Checks that we can build and run pthread code without explicitly giving
+// any flags to cgo. -pthread should be passed to the C compiler by default.
+func TestCgoPthread(t *testing.T) {
+ x := int(callFFromGo())
+ if x != 42 {
+ t.Errorf("got %d; want 42", x)
+ }
+}
diff --git a/tests/legacy/cgo_pure/BUILD.bazel b/tests/legacy/cgo_pure/BUILD.bazel
new file mode 100644
index 00000000..6de07e8d
--- /dev/null
+++ b/tests/legacy/cgo_pure/BUILD.bazel
@@ -0,0 +1,34 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "cgo_pure",
+ srcs = [
+ "cgo.c",
+ "cgo.go",
+ "cgo_no_tag.go",
+ "pure.go",
+ ],
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/cgo_pure",
+)
+
+go_test(
+ name = "cgo_test",
+ size = "small",
+ srcs = ["cgo_pure_test.go"],
+ x_defs = {
+ "Expect": "2",
+ },
+ deps = [":cgo_pure"],
+)
+
+go_test(
+ name = "pure_test",
+ size = "small",
+ srcs = ["cgo_pure_test.go"],
+ pure = "on",
+ x_defs = {
+ "Expect": "1",
+ },
+ deps = [":cgo_pure"],
+)
diff --git a/tests/legacy/cgo_pure/cgo.c b/tests/legacy/cgo_pure/cgo.c
new file mode 100644
index 00000000..9118bf3f
--- /dev/null
+++ b/tests/legacy/cgo_pure/cgo.c
@@ -0,0 +1 @@
+const int value = 2;
diff --git a/tests/legacy/cgo_pure/cgo.go b/tests/legacy/cgo_pure/cgo.go
new file mode 100644
index 00000000..a0702573
--- /dev/null
+++ b/tests/legacy/cgo_pure/cgo.go
@@ -0,0 +1,10 @@
+//+build cgo
+
+package cgo_pure
+
+/*
+extern const int value;
+*/
+import "C"
+
+var Value = int(C.value)
diff --git a/tests/legacy/cgo_pure/cgo_no_tag.go b/tests/legacy/cgo_pure/cgo_no_tag.go
new file mode 100644
index 00000000..9ff8540a
--- /dev/null
+++ b/tests/legacy/cgo_pure/cgo_no_tag.go
@@ -0,0 +1,8 @@
+package cgo_pure
+
+/*
+extern const int value;
+*/
+import "C"
+
+var AnotherValue = int(C.value)
diff --git a/tests/legacy/cgo_pure/cgo_pure_test.go b/tests/legacy/cgo_pure/cgo_pure_test.go
new file mode 100644
index 00000000..d8c3e5cb
--- /dev/null
+++ b/tests/legacy/cgo_pure/cgo_pure_test.go
@@ -0,0 +1,17 @@
+package cgo_pure_test
+
+import (
+ "fmt"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/cgo_pure"
+)
+
+var Expect = ""
+
+func TestValue(t *testing.T) {
+ got := fmt.Sprintf("%d", cgo_pure.Value)
+ if got != Expect {
+ t.Errorf("got %q; want %q", got, Expect)
+ }
+}
diff --git a/tests/legacy/cgo_pure/pure.go b/tests/legacy/cgo_pure/pure.go
new file mode 100644
index 00000000..a01e75ed
--- /dev/null
+++ b/tests/legacy/cgo_pure/pure.go
@@ -0,0 +1,5 @@
+//+build !cgo
+
+package cgo_pure
+
+var Value = 1
diff --git a/tests/legacy/cgo_select/BUILD.bazel b/tests/legacy/cgo_select/BUILD.bazel
new file mode 100644
index 00000000..76b87282
--- /dev/null
+++ b/tests/legacy/cgo_select/BUILD.bazel
@@ -0,0 +1,57 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "go_default_library",
+ srcs = select({
+ "@io_bazel_rules_go//go/platform:darwin_amd64": [
+ "cgo_darwin.go",
+ ],
+ "@io_bazel_rules_go//go/platform:darwin_arm64": [
+ "cgo_darwin.go",
+ ],
+ "@io_bazel_rules_go//go/platform:linux_amd64": [
+ "cgo_linux.go",
+ ],
+ "@io_bazel_rules_go//go/platform:windows_amd64": [
+ "cgo_windows.go",
+ ],
+ }),
+ cdeps = select({
+ "@io_bazel_rules_go//go/platform:darwin_amd64": [
+ ":darwin_lib",
+ ],
+ "@io_bazel_rules_go//go/platform:darwin_arm64": [
+ ":darwin_lib",
+ ],
+ "@io_bazel_rules_go//go/platform:linux_amd64": [
+ ":linux_lib",
+ ],
+ "@io_bazel_rules_go//go/platform:windows_amd64": [
+ ":windows_lib",
+ ],
+ }),
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/cgo_select",
+)
+
+cc_library(
+ name = "darwin_lib",
+ srcs = ["darwin.c"],
+)
+
+cc_library(
+ name = "linux_lib",
+ srcs = ["linux.c"],
+)
+
+cc_library(
+ name = "windows_lib",
+ srcs = ["windows.c"],
+)
+
+go_test(
+ name = "go_default_test",
+ size = "small",
+ srcs = ["cgo_select_test.go"],
+ embed = [":go_default_library"],
+)
diff --git a/tests/legacy/cgo_select/cgo_darwin.go b/tests/legacy/cgo_select/cgo_darwin.go
new file mode 100644
index 00000000..95a861f5
--- /dev/null
+++ b/tests/legacy/cgo_select/cgo_darwin.go
@@ -0,0 +1,8 @@
+package cgo_select
+
+/*
+extern const char* goos;
+*/
+import "C"
+
+var goos = C.GoString(C.goos)
diff --git a/tests/legacy/cgo_select/cgo_linux.go b/tests/legacy/cgo_select/cgo_linux.go
new file mode 100644
index 00000000..95a861f5
--- /dev/null
+++ b/tests/legacy/cgo_select/cgo_linux.go
@@ -0,0 +1,8 @@
+package cgo_select
+
+/*
+extern const char* goos;
+*/
+import "C"
+
+var goos = C.GoString(C.goos)
diff --git a/tests/legacy/cgo_select/cgo_select_test.go b/tests/legacy/cgo_select/cgo_select_test.go
new file mode 100644
index 00000000..343de23a
--- /dev/null
+++ b/tests/legacy/cgo_select/cgo_select_test.go
@@ -0,0 +1,12 @@
+package cgo_select
+
+import (
+ "runtime"
+ "testing"
+)
+
+func TestGoos(t *testing.T) {
+ if got, want := goos, runtime.GOOS; got != want {
+ t.Errorf("got %s; want %s\n", got, want)
+ }
+}
diff --git a/tests/legacy/cgo_select/cgo_windows.go b/tests/legacy/cgo_select/cgo_windows.go
new file mode 100644
index 00000000..95a861f5
--- /dev/null
+++ b/tests/legacy/cgo_select/cgo_windows.go
@@ -0,0 +1,8 @@
+package cgo_select
+
+/*
+extern const char* goos;
+*/
+import "C"
+
+var goos = C.GoString(C.goos)
diff --git a/tests/legacy/cgo_select/darwin.c b/tests/legacy/cgo_select/darwin.c
new file mode 100644
index 00000000..ca28a073
--- /dev/null
+++ b/tests/legacy/cgo_select/darwin.c
@@ -0,0 +1 @@
+const char* goos = "darwin";
diff --git a/tests/legacy/cgo_select/linux.c b/tests/legacy/cgo_select/linux.c
new file mode 100644
index 00000000..dbaeb236
--- /dev/null
+++ b/tests/legacy/cgo_select/linux.c
@@ -0,0 +1 @@
+const char* goos = "linux";
diff --git a/tests/legacy/cgo_select/windows.c b/tests/legacy/cgo_select/windows.c
new file mode 100644
index 00000000..25cc71b2
--- /dev/null
+++ b/tests/legacy/cgo_select/windows.c
@@ -0,0 +1 @@
+const char* goos = "windows";
diff --git a/tests/legacy/cgo_sys_hdr/BUILD.bazel b/tests/legacy/cgo_sys_hdr/BUILD.bazel
new file mode 100644
index 00000000..49daeee4
--- /dev/null
+++ b/tests/legacy/cgo_sys_hdr/BUILD.bazel
@@ -0,0 +1,18 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "go_default_library",
+ srcs = [
+ "foo.go",
+ "sub/foo.h",
+ ],
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/cgo_sys_hdr",
+)
+
+go_test(
+ name = "go_default_test",
+ size = "small",
+ srcs = ["foo_test.go"],
+ embed = [":go_default_library"],
+)
diff --git a/tests/legacy/cgo_sys_hdr/foo.go b/tests/legacy/cgo_sys_hdr/foo.go
new file mode 100644
index 00000000..0b13584f
--- /dev/null
+++ b/tests/legacy/cgo_sys_hdr/foo.go
@@ -0,0 +1,8 @@
+package cgo_sys_hdr
+
+/*
+#include <sub/foo.h>
+*/
+import "C"
+
+var x = int(C.x)
diff --git a/tests/legacy/cgo_sys_hdr/foo_test.go b/tests/legacy/cgo_sys_hdr/foo_test.go
new file mode 100644
index 00000000..2710fc3d
--- /dev/null
+++ b/tests/legacy/cgo_sys_hdr/foo_test.go
@@ -0,0 +1,9 @@
+package cgo_sys_hdr
+
+import "testing"
+
+func TestFoo(t *testing.T) {
+ if x != 42 {
+ t.Errorf("got %d; want %d", x, 42)
+ }
+}
diff --git a/tests/legacy/cgo_sys_hdr/sub/foo.h b/tests/legacy/cgo_sys_hdr/sub/foo.h
new file mode 100644
index 00000000..642ca52e
--- /dev/null
+++ b/tests/legacy/cgo_sys_hdr/sub/foo.h
@@ -0,0 +1 @@
+int x = 42;
diff --git a/tests/legacy/cgo_trans_deps/BUILD.bazel b/tests/legacy/cgo_trans_deps/BUILD.bazel
new file mode 100644
index 00000000..da7b4bae
--- /dev/null
+++ b/tests/legacy/cgo_trans_deps/BUILD.bazel
@@ -0,0 +1,16 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "go_default_library",
+ srcs = ["cgo_lib.go"],
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/cgo_trans_deps",
+ deps = ["//tests/legacy/cgo_trans_deps/dep:go_default_library"],
+)
+
+go_test(
+ name = "go_default_test",
+ size = "small",
+ srcs = ["cgo_test.go"],
+ embed = [":go_default_library"],
+)
diff --git a/tests/legacy/cgo_trans_deps/cgo_lib.go b/tests/legacy/cgo_trans_deps/cgo_lib.go
new file mode 100644
index 00000000..945ce143
--- /dev/null
+++ b/tests/legacy/cgo_trans_deps/cgo_lib.go
@@ -0,0 +1,5 @@
+package cgo_trans_deps
+
+import "C"
+
+import _ "github.com/bazelbuild/rules_go/tests/cgo_trans_deps/dep"
diff --git a/tests/legacy/cgo_trans_deps/cgo_test.go b/tests/legacy/cgo_trans_deps/cgo_test.go
new file mode 100644
index 00000000..98225ce0
--- /dev/null
+++ b/tests/legacy/cgo_trans_deps/cgo_test.go
@@ -0,0 +1,13 @@
+package cgo_trans_deps
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/cgo_trans_deps/dep"
+)
+
+func TestCgoTransDeps(t *testing.T) {
+ if dep.X != 42 {
+ t.Errorf("got %d; want %d", dep.X, 42)
+ }
+}
diff --git a/tests/legacy/cgo_trans_deps/dep/BUILD.bazel b/tests/legacy/cgo_trans_deps/dep/BUILD.bazel
new file mode 100644
index 00000000..9dfe5602
--- /dev/null
+++ b/tests/legacy/cgo_trans_deps/dep/BUILD.bazel
@@ -0,0 +1,8 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "go_default_library",
+ srcs = ["dep.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/cgo_trans_deps/dep",
+ visibility = ["//visibility:public"],
+)
diff --git a/tests/legacy/cgo_trans_deps/dep/dep.go b/tests/legacy/cgo_trans_deps/dep/dep.go
new file mode 100644
index 00000000..74c613cb
--- /dev/null
+++ b/tests/legacy/cgo_trans_deps/dep/dep.go
@@ -0,0 +1,3 @@
+package dep
+
+var X = 42
diff --git a/tests/legacy/empty_package/BUILD.bazel b/tests/legacy/empty_package/BUILD.bazel
new file mode 100644
index 00000000..d90e59f7
--- /dev/null
+++ b/tests/legacy/empty_package/BUILD.bazel
@@ -0,0 +1,43 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "cgo",
+ srcs = [
+ "cgo.c",
+ "cgo.go",
+ ],
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/tests/empty_package/cgo",
+)
+
+go_library(
+ name = "mixed",
+ srcs = [
+ "mixed_cgo.go",
+ "mixed_pure.go",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/tests/empty_package/mixed",
+ deps = [":cgo"],
+)
+
+go_test(
+ name = "empty_package_cgo",
+ size = "small",
+ srcs = ["empty_package_test.go"],
+ pure = "off",
+ x_defs = {
+ "Expect": "2",
+ },
+ deps = [":mixed"],
+)
+
+go_test(
+ name = "empty_package_pure",
+ size = "small",
+ srcs = ["empty_package_test.go"],
+ pure = "on",
+ x_defs = {
+ "Expect": "1",
+ },
+ deps = [":mixed"],
+)
diff --git a/tests/legacy/empty_package/cgo.c b/tests/legacy/empty_package/cgo.c
new file mode 100644
index 00000000..9118bf3f
--- /dev/null
+++ b/tests/legacy/empty_package/cgo.c
@@ -0,0 +1 @@
+const int value = 2;
diff --git a/tests/legacy/empty_package/cgo.go b/tests/legacy/empty_package/cgo.go
new file mode 100644
index 00000000..a4ece344
--- /dev/null
+++ b/tests/legacy/empty_package/cgo.go
@@ -0,0 +1,8 @@
+package cgo
+
+/*
+extern const int value;
+*/
+import "C"
+
+var Value = int(C.value)
diff --git a/tests/legacy/empty_package/empty_package_test.go b/tests/legacy/empty_package/empty_package_test.go
new file mode 100644
index 00000000..73ce4259
--- /dev/null
+++ b/tests/legacy/empty_package/empty_package_test.go
@@ -0,0 +1,17 @@
+package empty_package_test
+
+import (
+ "fmt"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/empty_package/mixed"
+)
+
+var Expect = ""
+
+func TestValue(t *testing.T) {
+ got := fmt.Sprintf("%d", mixed.Value)
+ if got != Expect {
+ t.Errorf("got %q; want %q", got, Expect)
+ }
+}
diff --git a/tests/legacy/empty_package/mixed_cgo.go b/tests/legacy/empty_package/mixed_cgo.go
new file mode 100644
index 00000000..48a1c726
--- /dev/null
+++ b/tests/legacy/empty_package/mixed_cgo.go
@@ -0,0 +1,10 @@
+//+build cgo
+
+package mixed
+
+import (
+ "github.com/bazelbuild/rules_go/tests/empty_package/cgo"
+)
+
+var Value = cgo.Value
+var Expect = ""
diff --git a/tests/legacy/empty_package/mixed_pure.go b/tests/legacy/empty_package/mixed_pure.go
new file mode 100644
index 00000000..0981f40f
--- /dev/null
+++ b/tests/legacy/empty_package/mixed_pure.go
@@ -0,0 +1,5 @@
+//+build !cgo
+
+package mixed
+
+var Value = 1
diff --git a/tests/legacy/examples/bin/BUILD.bazel b/tests/legacy/examples/bin/BUILD.bazel
new file mode 100644
index 00000000..67a791e7
--- /dev/null
+++ b/tests/legacy/examples/bin/BUILD.bazel
@@ -0,0 +1,17 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+package(
+ default_visibility = ["//visibility:public"],
+)
+
+go_binary(
+ name = "bin",
+ srcs = ["bin.go"],
+ x_defs = {
+ "main.buildTime": "2016/05/19 09:10am",
+ },
+ deps = [
+ "//tests/legacy/examples/lib:go_default_library",
+ "//tests/legacy/examples/vendor/github.com/user/vendored:go_default_library",
+ ],
+)
diff --git a/tests/legacy/examples/bin/bin.go b/tests/legacy/examples/bin/bin.go
new file mode 100644
index 00000000..6abac002
--- /dev/null
+++ b/tests/legacy/examples/bin/bin.go
@@ -0,0 +1,34 @@
+/* Copyright 2016 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package main
+
+import (
+ "fmt"
+
+ "github.com/bazelbuild/rules_go/examples/lib"
+ "github.com/user/vendored"
+)
+
+var buildTime string
+
+func main() {
+ fmt.Println("meaning: ", lib.Meaning())
+ fmt.Println("vendored: ", vendored.Vendored())
+ fmt.Println("build time: ", buildTime)
+
+ lib.AddTwoNumbers()
+ lib.SubTwoNumbers()
+}
diff --git a/tests/legacy/examples/bindata/BUILD.bazel b/tests/legacy/examples/bindata/BUILD.bazel
new file mode 100644
index 00000000..b4d58a26
--- /dev/null
+++ b/tests/legacy/examples/bindata/BUILD.bazel
@@ -0,0 +1,22 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+load("@io_bazel_rules_go//extras:bindata.bzl", "bindata")
+
+bindata(
+ name = "data",
+ srcs = glob(["data/*"]),
+ package = "bindata",
+ strip_external = True,
+)
+
+go_library(
+ name = "go_default_library",
+ srcs = [":data"],
+ importpath = "github.com/bazelbuild/rules_go/examples/bindata",
+)
+
+go_test(
+ name = "go_default_test",
+ size = "small",
+ srcs = ["bindata_test.go"],
+ embed = [":go_default_library"],
+)
diff --git a/tests/legacy/examples/bindata/bindata_test.go b/tests/legacy/examples/bindata/bindata_test.go
new file mode 100644
index 00000000..f3eeb1c4
--- /dev/null
+++ b/tests/legacy/examples/bindata/bindata_test.go
@@ -0,0 +1,33 @@
+/* Copyright 2016 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package bindata
+
+import (
+ "testing"
+)
+
+func TestMessage(t *testing.T) {
+ data, err := Asset("data/message.txt")
+ if err != nil {
+ // Asset was not found.
+ t.Errorf("Asset was not embeded: %s", err)
+ }
+ got := string(data)
+ const expected = "Some embedded data"
+ if got != expected {
+ t.Errorf("Got embedded asset %q\nexpected %q", got, expected)
+ }
+}
diff --git a/tests/legacy/examples/bindata/data/message.txt b/tests/legacy/examples/bindata/data/message.txt
new file mode 100644
index 00000000..44ae74f4
--- /dev/null
+++ b/tests/legacy/examples/bindata/data/message.txt
@@ -0,0 +1 @@
+Some embedded data \ No newline at end of file
diff --git a/tests/legacy/examples/cgo/BUILD.bazel b/tests/legacy/examples/cgo/BUILD.bazel
new file mode 100644
index 00000000..901f6d8d
--- /dev/null
+++ b/tests/legacy/examples/cgo/BUILD.bazel
@@ -0,0 +1,51 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+package(
+ default_visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "go_default_library",
+ srcs = [
+ "export_example.go",
+ "generated.go",
+ "import_example.go",
+ "pure_go.go",
+ "use_exported.c",
+ "use_exported.h",
+ ],
+ cdeps = ["//tests/legacy/examples/cgo/cc_dependency:version"],
+ cgo = True,
+ clinkopts = ["-lm"],
+ copts = ["-DDEFINED_IN_COPTS=1"],
+ importpath = "github.com/bazelbuild/rules_go/examples/cgo",
+ visibility = ["//visibility:public"],
+ deps = [":sub"],
+)
+
+# TODO(#746) exclude because gazelle does not recognise the rule below
+# gazelle:exclude sub
+
+go_library(
+ name = "sub",
+ srcs = ["sub/floor.go"],
+ cgo = True,
+ clinkopts = ["-lm"],
+ importpath = "github.com/bazelbuild/rules_go/examples/cgo/sub",
+ visibility = ["//visibility:private"],
+)
+
+go_test(
+ name = "cgo_lib_test",
+ size = "small",
+ srcs = ["cgo_lib_test.go"],
+ embed = [":go_default_library"],
+)
+
+genrule(
+ name = "generate_go_src",
+ srcs = ["generated.go.tpl"],
+ outs = ["generated.go"],
+ cmd = "cp -f $< $@",
+ visibility = ["//visibility:private"],
+)
diff --git a/tests/legacy/examples/cgo/cc_dependency/BUILD.bazel b/tests/legacy/examples/cgo/cc_dependency/BUILD.bazel
new file mode 100644
index 00000000..f0eee7dd
--- /dev/null
+++ b/tests/legacy/examples/cgo/cc_dependency/BUILD.bazel
@@ -0,0 +1,29 @@
+cc_library(
+ name = "version",
+ srcs = ["cxx_version.cc"],
+ hdrs = ["version.h"],
+ linkopts = ["-ldl"],
+ visibility = ["//tests/legacy/examples/cgo:__pkg__"],
+ # TODO(yugui) Support darwin too and remove this workaround.
+ # See also comments in cxx_version.cc.
+ deps = select({
+ "@platforms//os:macos": [],
+ "//conditions:default": [":c_version_import"],
+ }),
+)
+
+cc_binary(
+ name = "c_version_so",
+ srcs = [
+ "c_version.c",
+ "c_version.h",
+ ],
+ linkshared = True,
+)
+
+cc_import(
+ name = "c_version_import",
+ hdrs = ["c_version.h"],
+ shared_library = ":c_version_so",
+ tags = ["manual"],
+)
diff --git a/tests/legacy/examples/cgo/cc_dependency/c_version.c b/tests/legacy/examples/cgo/cc_dependency/c_version.c
new file mode 100644
index 00000000..5672898e
--- /dev/null
+++ b/tests/legacy/examples/cgo/cc_dependency/c_version.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+
+#include "tests/legacy/examples/cgo/cc_dependency/c_version.h"
+
+void PrintCVersion() {
+#ifdef __STDC__
+# ifdef __STDC_VERSION__
+ printf("C version: %ld\n", __STDC_VERSION__);
+# else
+ printf("C version: C89\n");
+# endif
+#else
+ printf("C version: maybe K&R\n");
+#endif
+}
diff --git a/tests/legacy/examples/cgo/cc_dependency/c_version.h b/tests/legacy/examples/cgo/cc_dependency/c_version.h
new file mode 100644
index 00000000..5ff655cf
--- /dev/null
+++ b/tests/legacy/examples/cgo/cc_dependency/c_version.h
@@ -0,0 +1,5 @@
+#ifdef __cplusplus
+extern "C" void PrintCVersion();
+#else
+void PrintCVersion();
+#endif
diff --git a/tests/legacy/examples/cgo/cc_dependency/cxx_version.cc b/tests/legacy/examples/cgo/cc_dependency/cxx_version.cc
new file mode 100644
index 00000000..43fb427e
--- /dev/null
+++ b/tests/legacy/examples/cgo/cc_dependency/cxx_version.cc
@@ -0,0 +1,30 @@
+#include <dlfcn.h>
+#include <iostream>
+
+#include "tests/legacy/examples/cgo/cc_dependency/version.h"
+
+// TODO(yugui) Support Darwin too once Bazel allows it.
+//
+// Bazel passes two or more -Wl,-rpath to $(CC) when it links a binary with
+// shared libraries prebuilt outside of Bazel (i.e. when "srcs" attribute of
+// the dependency cc_library contains ".so" files).
+// Unfortunately tools/cpp/osx_cc_wrapper.sh, which is $(CC) on Darwin, expects
+// only one -Wl,-rpath. So the binary fails to resolve the shared libraries
+// at runtime.
+#ifndef __APPLE_CC__
+# include "tests/legacy/examples/cgo/cc_dependency/c_version.h"
+#endif
+
+extern "C" void PrintCXXVersion() {
+#ifndef __APPLE_CC__
+ PrintCVersion();
+#endif
+ void* ptr = dlsym(RTLD_DEFAULT, "PrintCXXVersion");
+ if (ptr) {
+ std::cout
+ << "function ptr: " << std::hex << ptr << std::dec << std::endl;
+ } else {
+ std::cout << dlerror() << std::endl;
+ }
+ std::cout << "C++ version: " << __cplusplus << std::endl;
+}
diff --git a/tests/legacy/examples/cgo/cc_dependency/version.h b/tests/legacy/examples/cgo/cc_dependency/version.h
new file mode 100644
index 00000000..025656b3
--- /dev/null
+++ b/tests/legacy/examples/cgo/cc_dependency/version.h
@@ -0,0 +1,10 @@
+#ifndef BAZEL_RULES_GO_EXAMPLES_CGO_CC_DEPENDENCY_VERSION_H_
+#define BAZEL_RULES_GO_EXAMPLES_CGO_CC_DEPENDENCY_VERSION_H_
+
+#ifdef __cplusplus
+extern "C" void PrintCXXVersion();
+#else
+void PrintCXXVersion();
+#endif
+
+#endif // BAZEL_RULES_GO_EXAMPLES_CGO_CC_DEPENDENCY_VERSION_H_
diff --git a/tests/legacy/examples/cgo/cgo_lib_test.go b/tests/legacy/examples/cgo/cgo_lib_test.go
new file mode 100644
index 00000000..a486da6a
--- /dev/null
+++ b/tests/legacy/examples/cgo/cgo_lib_test.go
@@ -0,0 +1,15 @@
+package cgo
+
+import (
+ "math"
+ "testing"
+)
+
+func TestNsqrt(t *testing.T) {
+ for _, n := range []int{1, 2, 10, 100, 1000} {
+ got, want := Nsqrt(n), int(math.Floor(math.Sqrt(float64(n))))
+ if got != want {
+ t.Errorf("Nsqrt(n) = %d; want %d", got, want)
+ }
+ }
+}
diff --git a/tests/legacy/examples/cgo/example_command/BUILD.bazel b/tests/legacy/examples/cgo/example_command/BUILD.bazel
new file mode 100644
index 00000000..db480ab7
--- /dev/null
+++ b/tests/legacy/examples/cgo/example_command/BUILD.bazel
@@ -0,0 +1,26 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+load(":generate_test.bzl", "generate_script")
+
+package(
+ default_visibility = ["//visibility:public"],
+)
+
+go_binary(
+ name = "example_command",
+ srcs = ["main.go"],
+ deps = [
+ "//tests/legacy/examples/cgo:go_default_library",
+ ],
+)
+
+generate_script(
+ name = "example_command_script",
+ binary = ":example_command",
+)
+
+sh_test(
+ name = "example_command_test",
+ size = "small",
+ srcs = [":example_command_script"],
+ data = [":example_command"],
+)
diff --git a/tests/legacy/examples/cgo/example_command/generate_test.bzl b/tests/legacy/examples/cgo/example_command/generate_test.bzl
new file mode 100644
index 00000000..c3c991df
--- /dev/null
+++ b/tests/legacy/examples/cgo/example_command/generate_test.bzl
@@ -0,0 +1,17 @@
+def _generate_script_impl(ctx):
+ script_file = ctx.actions.declare_file(ctx.label.name + ".bash")
+ ctx.actions.write(output = script_file, is_executable = True, content = """
+{0}
+""".format(ctx.file.binary.short_path))
+ return struct(
+ files = depset([script_file]),
+ )
+
+generate_script = rule(
+ _generate_script_impl,
+ attrs = {
+ "binary": attr.label(
+ allow_single_file = True,
+ ),
+ },
+)
diff --git a/tests/legacy/examples/cgo/example_command/main.go b/tests/legacy/examples/cgo/example_command/main.go
new file mode 100644
index 00000000..8f0bfd6a
--- /dev/null
+++ b/tests/legacy/examples/cgo/example_command/main.go
@@ -0,0 +1,13 @@
+package main
+
+import (
+ "fmt"
+
+ "github.com/bazelbuild/rules_go/examples/cgo"
+)
+
+func main() {
+ fmt.Println("floor(sqrt(10)) = ", cgo.Nsqrt(10))
+ cgo.PrintGoVersion()
+ cgo.PrintCXXVersion()
+}
diff --git a/tests/legacy/examples/cgo/export_example.go b/tests/legacy/examples/cgo/export_example.go
new file mode 100644
index 00000000..874340c7
--- /dev/null
+++ b/tests/legacy/examples/cgo/export_example.go
@@ -0,0 +1,11 @@
+package cgo
+
+import (
+ "C"
+ "runtime"
+)
+
+//export goVersion
+func goVersion() string {
+ return runtime.Version()
+}
diff --git a/tests/legacy/examples/cgo/generated.go.tpl b/tests/legacy/examples/cgo/generated.go.tpl
new file mode 100644
index 00000000..ba80e040
--- /dev/null
+++ b/tests/legacy/examples/cgo/generated.go.tpl
@@ -0,0 +1,13 @@
+package cgo
+
+import (
+ //#cgo LDFLAGS: -lm
+ //#include <math.h>
+ "C"
+ "math"
+)
+
+// Ncbrt returns the cube root of n.
+func Ncbrt(n int) int {
+ return int(math.Floor(float64(C.cbrt(C.double(n)))))
+}
diff --git a/tests/legacy/examples/cgo/import_example.go b/tests/legacy/examples/cgo/import_example.go
new file mode 100644
index 00000000..a25a6971
--- /dev/null
+++ b/tests/legacy/examples/cgo/import_example.go
@@ -0,0 +1,29 @@
+package cgo
+
+import (
+ //#cgo LDFLAGS: -lm -lversion -lc_version -L${SRCDIR}/cc_dependency
+ //#cgo CPPFLAGS: -I${SRCDIR}/../..
+ //#include <math.h>
+ //#include "use_exported.h"
+ //#include "cc_dependency/version.h"
+ "C"
+
+ "github.com/bazelbuild/rules_go/examples/cgo/sub"
+)
+
+// Nsqrt returns the square root of n.
+func Nsqrt(n int) int {
+ return int(sub.Floor(float64(C.sqrt(C.double(n)))))
+}
+
+func PrintGoVersion() {
+ C.PrintGoVersion()
+}
+
+func printCXXVersion() {
+ C.PrintCXXVersion()
+}
+
+func ReturnDefined() int {
+ return int(C.DEFINED_IN_COPTS)
+}
diff --git a/tests/legacy/examples/cgo/pure_go.go b/tests/legacy/examples/cgo/pure_go.go
new file mode 100644
index 00000000..531517dd
--- /dev/null
+++ b/tests/legacy/examples/cgo/pure_go.go
@@ -0,0 +1,5 @@
+package cgo
+
+func PrintCXXVersion() {
+ printCXXVersion()
+}
diff --git a/tests/legacy/examples/cgo/skip_go_library/BUILD.bazel b/tests/legacy/examples/cgo/skip_go_library/BUILD.bazel
new file mode 100644
index 00000000..69a99596
--- /dev/null
+++ b/tests/legacy/examples/cgo/skip_go_library/BUILD.bazel
@@ -0,0 +1,13 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+package(default_visibility = ["//visibility:public"])
+
+go_library(
+ name = "go_default_library",
+ srcs = [
+ "cgo_foo.go",
+ "types.go",
+ ],
+ cgo = True,
+ importpath = "github.com/bazelbuild/rules_go/examples/cgo/skip_go_library",
+)
diff --git a/tests/legacy/examples/cgo/skip_go_library/cgo_foo.go b/tests/legacy/examples/cgo/skip_go_library/cgo_foo.go
new file mode 100644
index 00000000..42b1dbaa
--- /dev/null
+++ b/tests/legacy/examples/cgo/skip_go_library/cgo_foo.go
@@ -0,0 +1,8 @@
+package skip_go_library
+
+/*
+#include <stdio.h>
+*/
+import "C"
+
+var _ = Type{}
diff --git a/tests/legacy/examples/cgo/skip_go_library/types.go b/tests/legacy/examples/cgo/skip_go_library/types.go
new file mode 100644
index 00000000..1f3510ec
--- /dev/null
+++ b/tests/legacy/examples/cgo/skip_go_library/types.go
@@ -0,0 +1,3 @@
+package skip_go_library
+
+type Type struct{}
diff --git a/tests/legacy/examples/cgo/sub/floor.go b/tests/legacy/examples/cgo/sub/floor.go
new file mode 100644
index 00000000..315b5c8f
--- /dev/null
+++ b/tests/legacy/examples/cgo/sub/floor.go
@@ -0,0 +1,13 @@
+package sub
+
+import (
+ //#cgo LDFLAGS: -lm
+ //#include <math.h>
+ "C"
+)
+
+// Floor calculates floor of the given number
+// with the implementation in the standard C library.
+func Floor(f float64) float64 {
+ return float64(C.floor(C.double(f)))
+}
diff --git a/tests/legacy/examples/cgo/use_exported.c b/tests/legacy/examples/cgo/use_exported.c
new file mode 100644
index 00000000..0a6d01e7
--- /dev/null
+++ b/tests/legacy/examples/cgo/use_exported.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+#include "_cgo_export.h"
+
+void PrintGoVersion() {
+ GoString version = goVersion();
+ printf("Go version: %.*s\n", (int)version.n, version.p);
+}
diff --git a/tests/legacy/examples/cgo/use_exported.h b/tests/legacy/examples/cgo/use_exported.h
new file mode 100644
index 00000000..3c8f8414
--- /dev/null
+++ b/tests/legacy/examples/cgo/use_exported.h
@@ -0,0 +1,6 @@
+#ifndef BAZEL_RULES_GO_EXAMPLES_CGO_USE_EXPORTED_H_
+#define BAZEL_RULES_GO_EXAMPLES_CGO_USE_EXPORTED_H_
+
+void PrintGoVersion();
+
+#endif // BAZEL_RULES_GO_EXAMPLES_CGO_USE_EXPORTED_H_
diff --git a/tests/legacy/examples/external/BUILD.bazel b/tests/legacy/examples/external/BUILD.bazel
new file mode 100644
index 00000000..a56ec6e5
--- /dev/null
+++ b/tests/legacy/examples/external/BUILD.bazel
@@ -0,0 +1,11 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+go_binary(
+ name = "record_log",
+ srcs = [
+ "main.go",
+ ],
+ deps = [
+ "@com_github_golang_glog//:go_default_library",
+ ],
+)
diff --git a/tests/legacy/examples/external/main.go b/tests/legacy/examples/external/main.go
new file mode 100644
index 00000000..03ed27e7
--- /dev/null
+++ b/tests/legacy/examples/external/main.go
@@ -0,0 +1,31 @@
+/* Copyright 2016 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+// Command record_log just records a log with glog to
+// show an example of linking with a external dependency.
+package main
+
+import (
+ "flag"
+
+ "github.com/golang/glog"
+)
+
+func main() {
+ flag.Parse()
+ defer glog.Flush()
+
+ glog.Info("Hello")
+}
diff --git a/tests/legacy/examples/lib/BUILD.bazel b/tests/legacy/examples/lib/BUILD.bazel
new file mode 100644
index 00000000..9b9249d4
--- /dev/null
+++ b/tests/legacy/examples/lib/BUILD.bazel
@@ -0,0 +1,46 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+package(
+ default_visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "go_default_library",
+ srcs = [
+ "add_amd64.s",
+ "add_arm64.s",
+ "asm.go",
+ "lib.go",
+ "sub_amd64.s",
+ "sub_arm64.s",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/examples/lib",
+ deps = ["//tests/legacy/examples/lib/deep:go_default_library"],
+)
+
+go_test(
+ name = "lib_test",
+ size = "small",
+ srcs = [
+ "lib_test.go",
+ ],
+ embed = [":go_default_library"],
+)
+
+go_test(
+ name = "lib_external_test",
+ size = "small",
+ srcs = [
+ "lib_x_test.go",
+ ],
+ args = [
+ "-lib_test.buildtime",
+ "'05/19/2016 10:30am'",
+ ],
+ x_defs = {
+ "github.com/bazelbuild/rules_go/examples/lib.buildTime": "05/19/2016 10:30am",
+ },
+ deps = [
+ ":go_default_library",
+ ],
+)
diff --git a/tests/legacy/examples/lib/add_amd64.s b/tests/legacy/examples/lib/add_amd64.s
new file mode 100644
index 00000000..72f8298c
--- /dev/null
+++ b/tests/legacy/examples/lib/add_amd64.s
@@ -0,0 +1,8 @@
+#include "textflag.h"
+
+TEXT ·add(SB),NOSPLIT,$0
+ MOVQ x+0(FP), BX
+ MOVQ y+8(FP), BP
+ ADDQ BP, BX
+ MOVQ BX, ret+16(FP)
+ RET
diff --git a/tests/legacy/examples/lib/add_arm64.s b/tests/legacy/examples/lib/add_arm64.s
new file mode 100644
index 00000000..7ade97d3
--- /dev/null
+++ b/tests/legacy/examples/lib/add_arm64.s
@@ -0,0 +1,20 @@
+// Copyright 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+TEXT ·add(SB), $0
+ MOVD x+0(FP), R0
+ MOVD y+8(FP), R1
+ ADD R0, R1, R0
+ MOVD R0, ret+16(FP)
+ RET
diff --git a/tests/legacy/examples/lib/asm.go b/tests/legacy/examples/lib/asm.go
new file mode 100644
index 00000000..a65f29d5
--- /dev/null
+++ b/tests/legacy/examples/lib/asm.go
@@ -0,0 +1,14 @@
+package lib
+
+import "fmt"
+
+func add(x, y int64) int64
+func sub(x, y int64) int64
+
+func AddTwoNumbers() {
+ fmt.Println("2 + 3 =", add(2, 3))
+}
+
+func SubTwoNumbers() {
+ fmt.Println("2 - 3 =", sub(2, 3))
+} \ No newline at end of file
diff --git a/tests/legacy/examples/lib/deep/BUILD.bazel b/tests/legacy/examples/lib/deep/BUILD.bazel
new file mode 100644
index 00000000..e827a6a8
--- /dev/null
+++ b/tests/legacy/examples/lib/deep/BUILD.bazel
@@ -0,0 +1,12 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+package(default_visibility = ["//tests/legacy/examples/lib:__pkg__"])
+
+go_library(
+ name = "go_default_library",
+ srcs = [
+ "doc.go",
+ "thought.go",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/examples/lib/deep",
+)
diff --git a/tests/legacy/examples/lib/deep/doc.go b/tests/legacy/examples/lib/deep/doc.go
new file mode 100644
index 00000000..f4b4b2d2
--- /dev/null
+++ b/tests/legacy/examples/lib/deep/doc.go
@@ -0,0 +1,3 @@
+// Package deep provides an emulator of a computer which calculates
+// answer to the ultimate question of Life, the Universe, and Everything.
+package deep
diff --git a/tests/legacy/examples/lib/deep/thought.go b/tests/legacy/examples/lib/deep/thought.go
new file mode 100644
index 00000000..a4d0d728
--- /dev/null
+++ b/tests/legacy/examples/lib/deep/thought.go
@@ -0,0 +1,6 @@
+package deep
+
+// Thought emulates Deep Thought.
+func Thought() int {
+ return 42
+}
diff --git a/tests/legacy/examples/lib/lib.go b/tests/legacy/examples/lib/lib.go
new file mode 100644
index 00000000..03a932c2
--- /dev/null
+++ b/tests/legacy/examples/lib/lib.go
@@ -0,0 +1,41 @@
+/* Copyright 2016 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package lib
+
+import (
+ "reflect"
+
+ "github.com/bazelbuild/rules_go/examples/lib/deep"
+)
+
+var buildTime string
+
+// Meaning returns the meaning of Life, the Universe and Everything.
+func Meaning() int {
+ return deep.Thought()
+}
+
+type dummy struct{}
+
+// PkgPath returns the package importpath of this package.
+func PkgPath() string {
+ return reflect.TypeOf(dummy{}).PkgPath()
+}
+
+// BuildTime returns the buildTime which should be replaced with -X flag.
+func BuildTime() string {
+ return buildTime
+}
diff --git a/tests/legacy/examples/lib/lib_test.go b/tests/legacy/examples/lib/lib_test.go
new file mode 100644
index 00000000..494d854a
--- /dev/null
+++ b/tests/legacy/examples/lib/lib_test.go
@@ -0,0 +1,30 @@
+/* Copyright 2016 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package lib
+
+import (
+ "testing"
+)
+
+func TestMeaning(t *testing.T) {
+ if m := Meaning(); m != 42 {
+ t.Errorf("got %d, want 42", m)
+ }
+}
+
+func TestAddTwoNumbers(t *testing.T) {
+ AddTwoNumbers()
+}
diff --git a/tests/legacy/examples/lib/lib_x_test.go b/tests/legacy/examples/lib/lib_x_test.go
new file mode 100644
index 00000000..0256cb75
--- /dev/null
+++ b/tests/legacy/examples/lib/lib_x_test.go
@@ -0,0 +1,52 @@
+/* Copyright 2016 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package lib_test
+
+import (
+ "flag"
+ "os"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/examples/lib"
+)
+
+var (
+ buildTimeWant = flag.String("lib_test.buildtime", "", "expected value in TestBuildTime")
+ wasTestMainCalled = false
+)
+
+func TestLibraryPkgPath(t *testing.T) {
+ if got, want := lib.PkgPath(), "github.com/bazelbuild/rules_go/examples/lib"; got != want {
+ t.Errorf("lib.PkgPath() = %q; want %q", got, want)
+ }
+}
+
+func TestBuildTime(t *testing.T) {
+ if got, want := lib.BuildTime(), *buildTimeWant; got != want {
+ t.Errorf("buildTime = %q; want %q", got, want)
+ }
+}
+
+func TestMainCalled(t *testing.T) {
+ if !wasTestMainCalled {
+ t.Errorf("TestMain was not called")
+ }
+}
+
+func TestMain(m *testing.M) {
+ wasTestMainCalled = true
+ os.Exit(m.Run())
+}
diff --git a/tests/legacy/examples/lib/sub_amd64.s b/tests/legacy/examples/lib/sub_amd64.s
new file mode 100644
index 00000000..78694846
--- /dev/null
+++ b/tests/legacy/examples/lib/sub_amd64.s
@@ -0,0 +1,8 @@
+#include "textflag.h"
+
+TEXT ·sub(SB),NOSPLIT,$0
+ MOVQ x+0(FP), BX
+ MOVQ y+8(FP), BP
+ SUBQ BP, BX
+ MOVQ BX, ret+16(FP)
+ RET
diff --git a/tests/legacy/examples/lib/sub_arm64.s b/tests/legacy/examples/lib/sub_arm64.s
new file mode 100644
index 00000000..0af72ce8
--- /dev/null
+++ b/tests/legacy/examples/lib/sub_arm64.s
@@ -0,0 +1,20 @@
+// Copyright 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+TEXT ·sub(SB), $0
+ MOVD x+0(FP), R0
+ MOVD y+8(FP), R1
+ SUB R0, R1, R0
+ MOVD R0, ret+16(FP)
+ RET
diff --git a/tests/legacy/examples/monobuild/cmd/BUILD.bazel b/tests/legacy/examples/monobuild/cmd/BUILD.bazel
new file mode 100644
index 00000000..4d48d506
--- /dev/null
+++ b/tests/legacy/examples/monobuild/cmd/BUILD.bazel
@@ -0,0 +1,14 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+package(
+ default_visibility = ["//visibility:public"],
+)
+
+go_binary(
+ name = "mycmd",
+ srcs = ["mycmd.go"],
+ deps = [
+ "//tests/legacy/examples/monobuild/lib1:go_default_library",
+ "//tests/legacy/examples/monobuild/lib2:go_default_library",
+ ],
+)
diff --git a/tests/legacy/examples/monobuild/cmd/mycmd.go b/tests/legacy/examples/monobuild/cmd/mycmd.go
new file mode 100644
index 00000000..1e4ce255
--- /dev/null
+++ b/tests/legacy/examples/monobuild/cmd/mycmd.go
@@ -0,0 +1,28 @@
+/* Copyright 2017 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package main
+
+import (
+ "fmt"
+
+ "full/import/path/to/lib1"
+ "totally/different/import/for/lib2"
+)
+
+func main() {
+ fmt.Println("lib1: ", lib1.Name())
+ fmt.Println("lib2: ", lib2.Description())
+}
diff --git a/tests/legacy/examples/monobuild/lib1/BUILD.bazel b/tests/legacy/examples/monobuild/lib1/BUILD.bazel
new file mode 100644
index 00000000..e460ddd4
--- /dev/null
+++ b/tests/legacy/examples/monobuild/lib1/BUILD.bazel
@@ -0,0 +1,11 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+package(default_visibility = ["//tests/legacy/examples/monobuild/cmd:__pkg__"])
+
+go_library(
+ name = "go_default_library",
+ srcs = [
+ "lib1.go",
+ ],
+ importpath = "full/import/path/to/lib1",
+)
diff --git a/tests/legacy/examples/monobuild/lib1/lib1.go b/tests/legacy/examples/monobuild/lib1/lib1.go
new file mode 100644
index 00000000..a99ac29b
--- /dev/null
+++ b/tests/legacy/examples/monobuild/lib1/lib1.go
@@ -0,0 +1,20 @@
+/* Copyright 2017 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package lib1
+
+func Name() string {
+ return "I am lib 1"
+}
diff --git a/tests/legacy/examples/monobuild/lib2/BUILD.bazel b/tests/legacy/examples/monobuild/lib2/BUILD.bazel
new file mode 100644
index 00000000..f73f7da9
--- /dev/null
+++ b/tests/legacy/examples/monobuild/lib2/BUILD.bazel
@@ -0,0 +1,11 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+package(default_visibility = ["//tests/legacy/examples/monobuild/cmd:__pkg__"])
+
+go_library(
+ name = "go_default_library",
+ srcs = [
+ "lib2.go",
+ ],
+ importpath = "totally/different/import/for/lib2",
+)
diff --git a/tests/legacy/examples/monobuild/lib2/lib2.go b/tests/legacy/examples/monobuild/lib2/lib2.go
new file mode 100644
index 00000000..836b365f
--- /dev/null
+++ b/tests/legacy/examples/monobuild/lib2/lib2.go
@@ -0,0 +1,20 @@
+/* Copyright 2017 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package lib2
+
+func Description() string {
+ return "I am lib 2"
+}
diff --git a/tests/legacy/examples/proto/BUILD.bazel b/tests/legacy/examples/proto/BUILD.bazel
new file mode 100644
index 00000000..703a53a4
--- /dev/null
+++ b/tests/legacy/examples/proto/BUILD.bazel
@@ -0,0 +1,34 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "go_default_library",
+ srcs = ["gs.go"],
+ importpath = "github.com/bazelbuild/rules_go/examples/proto",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//tests/legacy/examples/proto/gostyle:gostyle_go_proto",
+ "//tests/legacy/examples/proto/lib:lib_go_proto",
+ ],
+)
+
+go_test(
+ name = "proto_test",
+ size = "small",
+ srcs = ["proto_test.go"],
+ pure = "off",
+ deps = [
+ "//tests/legacy/examples/proto/embed:go_default_library",
+ "//tests/legacy/examples/proto/lib:lib_go_proto",
+ ],
+)
+
+go_test(
+ name = "proto_pure_test",
+ size = "small",
+ srcs = ["proto_test.go"],
+ pure = "on",
+ deps = [
+ "//tests/legacy/examples/proto/embed:go_default_library",
+ "//tests/legacy/examples/proto/lib:lib_go_proto",
+ ],
+)
diff --git a/tests/legacy/examples/proto/dep/BUILD.bazel b/tests/legacy/examples/proto/dep/BUILD.bazel
new file mode 100644
index 00000000..13e00b87
--- /dev/null
+++ b/tests/legacy/examples/proto/dep/BUILD.bazel
@@ -0,0 +1,18 @@
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
+
+proto_library(
+ name = "useful_proto",
+ srcs = ["useful.proto"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@com_google_protobuf//:duration_proto",
+ ],
+)
+
+go_proto_library(
+ name = "useful_go_proto",
+ importpath = "github.com/bazelbuild/rules_go/examples/proto/dep",
+ proto = ":useful_proto",
+ visibility = ["//visibility:public"],
+)
diff --git a/tests/legacy/examples/proto/dep/useful.proto b/tests/legacy/examples/proto/dep/useful.proto
new file mode 100644
index 00000000..030046e3
--- /dev/null
+++ b/tests/legacy/examples/proto/dep/useful.proto
@@ -0,0 +1,11 @@
+syntax = "proto3";
+
+package very.useful;
+
+import "google/protobuf/duration.proto";
+
+message VeryUseful {
+ string very = 1;
+ int32 useful = 2;
+ google.protobuf.Duration timing = 3;
+}
diff --git a/tests/legacy/examples/proto/embed/BUILD.bazel b/tests/legacy/examples/proto/embed/BUILD.bazel
new file mode 100644
index 00000000..c273fa54
--- /dev/null
+++ b/tests/legacy/examples/proto/embed/BUILD.bazel
@@ -0,0 +1,28 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
+
+proto_library(
+ name = "embed_proto",
+ srcs = ["embed.proto"],
+ visibility = ["//visibility:public"],
+)
+
+go_proto_library(
+ name = "embed_go_proto",
+ compilers = [
+ "@io_bazel_rules_go//proto:go_proto",
+ "@io_bazel_rules_go//proto:go_proto_validate",
+ ],
+ # Note that if you forget the importpath everything will break horribly.
+ importpath = "github.com/bazelbuild/rules_go/examples/proto/embed",
+ proto = ":embed_proto",
+)
+
+go_library(
+ name = "go_default_library",
+ srcs = ["embed.go"],
+ embed = [":embed_go_proto"],
+ importpath = "github.com/bazelbuild/rules_go/examples/proto/embed",
+ visibility = ["//visibility:public"],
+)
diff --git a/tests/legacy/examples/proto/embed/embed.go b/tests/legacy/examples/proto/embed/embed.go
new file mode 100644
index 00000000..b063a06b
--- /dev/null
+++ b/tests/legacy/examples/proto/embed/embed.go
@@ -0,0 +1,7 @@
+package embed
+
+func OtherThing() *EmbedExample {
+ return &EmbedExample{
+ A: 42,
+ }
+}
diff --git a/tests/legacy/examples/proto/embed/embed.proto b/tests/legacy/examples/proto/embed/embed.proto
new file mode 100644
index 00000000..085fd8fe
--- /dev/null
+++ b/tests/legacy/examples/proto/embed/embed.proto
@@ -0,0 +1,9 @@
+syntax = "proto3";
+
+package embed;
+
+option go_package = "github.com/bazelbuild/rules_go/examples/proto/embed";
+
+message EmbedExample {
+ int32 a = 2;
+}
diff --git a/tests/legacy/examples/proto/gogo/BUILD.bazel b/tests/legacy/examples/proto/gogo/BUILD.bazel
new file mode 100644
index 00000000..b228ca5f
--- /dev/null
+++ b/tests/legacy/examples/proto/gogo/BUILD.bazel
@@ -0,0 +1,29 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_test")
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
+
+proto_library(
+ name = "values_proto",
+ srcs = ["values.proto"],
+ deps = [
+ "@com_google_protobuf//:duration_proto",
+ "@gogo_special_proto//github.com/gogo/protobuf/gogoproto",
+ ],
+)
+
+go_proto_library(
+ name = "values_go_proto",
+ compilers = [
+ "@io_bazel_rules_go//proto:gogofaster_proto",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/examples/proto/gogo",
+ proto = ":values_proto",
+)
+
+go_test(
+ name = "gogo_test",
+ srcs = ["gogo_test.go"],
+ deps = [
+ ":values_go_proto",
+ ],
+)
diff --git a/tests/legacy/examples/proto/gogo/gogo_test.go b/tests/legacy/examples/proto/gogo/gogo_test.go
new file mode 100644
index 00000000..b6fb3eec
--- /dev/null
+++ b/tests/legacy/examples/proto/gogo/gogo_test.go
@@ -0,0 +1,25 @@
+package gogo_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/examples/proto/gogo"
+)
+
+func TestGoString(t *testing.T) {
+ p := gogo.Value{Item: 20}
+ got := p.GoString()
+ expect := "&gogo.Value{Item: 20,\n}"
+ if got != expect {
+ t.Errorf("got %q, expect %q", got, expect)
+ }
+}
+
+func TestSize(t *testing.T) {
+ p := gogo.Value{Item: 20}
+ got := p.Size()
+ expect := 2
+ if got != expect {
+ t.Errorf("got %v, expect %v", got, expect)
+ }
+}
diff --git a/tests/legacy/examples/proto/gogo/values.proto b/tests/legacy/examples/proto/gogo/values.proto
new file mode 100644
index 00000000..df542977
--- /dev/null
+++ b/tests/legacy/examples/proto/gogo/values.proto
@@ -0,0 +1,14 @@
+syntax = "proto3";
+
+package gogo;
+
+import "google/protobuf/duration.proto";
+import "github.com/gogo/protobuf/gogoproto/gogo.proto";
+
+option go_package = "github.com/bazelbuild/rules_go/examples/proto/gogo";
+option (gogoproto.gostring_all) = true;
+
+message Value {
+ int32 item = 1;
+ google.protobuf.Duration timing = 3;
+}
diff --git a/tests/legacy/examples/proto/gostyle/BUILD.bazel b/tests/legacy/examples/proto/gostyle/BUILD.bazel
new file mode 100644
index 00000000..1b7d5ff3
--- /dev/null
+++ b/tests/legacy/examples/proto/gostyle/BUILD.bazel
@@ -0,0 +1,25 @@
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
+
+genrule(
+ name = "copy",
+ srcs = ["gostyle.proto"],
+ outs = ["gostyle.gen.proto"],
+ cmd = "sed -e 's/ano.proto/any.proto/' $< > $@",
+)
+
+proto_library(
+ name = "gostyle_proto",
+ srcs = [":copy"],
+ visibility = ["//visibility:public"],
+ deps = [
+ "@com_google_protobuf//:any_proto",
+ ],
+)
+
+go_proto_library(
+ name = "gostyle_go_proto",
+ importpath = "github.com/bazelbuild/rules_go/examples/proto/gostyle",
+ proto = ":gostyle_proto",
+ visibility = ["//visibility:public"],
+)
diff --git a/tests/legacy/examples/proto/gostyle/gostyle.proto b/tests/legacy/examples/proto/gostyle/gostyle.proto
new file mode 100644
index 00000000..8b95d399
--- /dev/null
+++ b/tests/legacy/examples/proto/gostyle/gostyle.proto
@@ -0,0 +1,12 @@
+syntax = "proto3";
+
+package gostyle;
+
+option go_package = "github.com/bazelbuild/rules_go/examples/proto/gostyle";
+
+import "google/protobuf/ano.proto";
+
+message GoStyleObject {
+ int32 go_not_bazel = 2;
+ google.protobuf.Any anything = 3;
+}
diff --git a/tests/legacy/examples/proto/grpc/BUILD.bazel b/tests/legacy/examples/proto/grpc/BUILD.bazel
new file mode 100644
index 00000000..671dec57
--- /dev/null
+++ b/tests/legacy/examples/proto/grpc/BUILD.bazel
@@ -0,0 +1,44 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+load("@io_bazel_rules_go//proto:def.bzl", "go_grpc_library", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
+
+proto_library(
+ name = "my_svc_proto",
+ srcs = ["my_svc.proto"],
+ deps = [
+ "//tests/legacy/examples/proto/lib:lib_proto",
+ "@com_google_protobuf//:any_proto",
+ "@com_google_protobuf//:empty_proto",
+ ],
+)
+
+go_proto_library(
+ name = "not_grpc",
+ importpath = "github.com/bazelbuild/rules_go/examples/proto/grpc/my_svc_proto",
+ proto = ":my_svc_proto",
+ deps = [
+ "//tests/legacy/examples/proto/lib:lib_go_proto",
+ ],
+)
+
+go_grpc_library(
+ name = "my_svc_go_proto",
+ importpath = "github.com/bazelbuild/rules_go/examples/proto/grpc/my_svc_proto",
+ proto = ":my_svc_proto",
+ deps = [
+ "//tests/legacy/examples/proto/lib:lib_go_proto",
+ ],
+)
+
+go_binary(
+ name = "test_grpc",
+ srcs = ["main.go"],
+ deps = [
+ ":my_svc_go_proto",
+ "//tests/legacy/examples/proto/lib:lib_go_proto",
+ "@io_bazel_rules_go//proto/wkt:any_go_proto",
+ "@io_bazel_rules_go//proto/wkt:empty_go_proto",
+ "@org_golang_google_grpc//:go_default_library",
+ "@org_golang_x_net//context:go_default_library",
+ ],
+)
diff --git a/tests/legacy/examples/proto/grpc/main.go b/tests/legacy/examples/proto/grpc/main.go
new file mode 100644
index 00000000..b62c2319
--- /dev/null
+++ b/tests/legacy/examples/proto/grpc/main.go
@@ -0,0 +1,33 @@
+package main
+
+import (
+ "log"
+ "net"
+
+ pb "github.com/bazelbuild/rules_go/examples/proto/grpc/my_svc_proto"
+ lpb "github.com/bazelbuild/rules_go/examples/proto/lib/lib_proto"
+ apb "github.com/golang/protobuf/ptypes/any"
+ epb "github.com/golang/protobuf/ptypes/empty"
+ "golang.org/x/net/context"
+ "google.golang.org/grpc"
+)
+
+type server struct{}
+
+func (s *server) Get(ctx context.Context, req *pb.GetRequest) (*epb.Empty, error) {
+ return &epb.Empty{}, nil
+}
+
+func (s *server) Put(ctx context.Context, req *apb.Any) (*lpb.LibObject, error) {
+ return &lpb.LibObject{}, nil
+}
+
+func main() {
+ lis, err := net.Listen("tcp", ":8080")
+ if err != nil {
+ log.Fatalf("failed to listen: %v", err)
+ }
+ s := grpc.NewServer()
+ pb.RegisterMyServiceServer(s, &server{})
+ s.Serve(lis)
+}
diff --git a/tests/legacy/examples/proto/grpc/my_svc.proto b/tests/legacy/examples/proto/grpc/my_svc.proto
new file mode 100644
index 00000000..16344c12
--- /dev/null
+++ b/tests/legacy/examples/proto/grpc/my_svc.proto
@@ -0,0 +1,18 @@
+syntax = "proto3";
+
+package examples.svc;
+
+option go_package = "github.com/bazelbuild/rules_go/examples/proto/grpc/my_svc_proto";
+
+import "tests/legacy/examples/proto/lib/lib.proto";
+import "google/protobuf/any.proto";
+import "google/protobuf/empty.proto";
+
+message GetRequest {
+ examples.lib.LibObject obj = 1;
+}
+
+service MyService {
+ rpc Get(GetRequest) returns (google.protobuf.Empty);
+ rpc Put(google.protobuf.Any) returns (examples.lib.LibObject);
+}
diff --git a/tests/legacy/examples/proto/gs.go b/tests/legacy/examples/proto/gs.go
new file mode 100644
index 00000000..c52dcba8
--- /dev/null
+++ b/tests/legacy/examples/proto/gs.go
@@ -0,0 +1,22 @@
+package proto
+
+import (
+ "fmt"
+
+ "github.com/bazelbuild/rules_go/examples/proto/gostyle"
+ lib_proto "github.com/bazelbuild/rules_go/examples/proto/lib/lib_proto"
+)
+
+func DoGoStyle(g *gostyle.GoStyleObject) error {
+ if g == nil {
+ return fmt.Errorf("got nil")
+ }
+ return nil
+}
+
+func DoMultiProtos(a *lib_proto.LibObject, b *lib_proto.LibObject2) error {
+ if a == nil || b == nil {
+ return fmt.Errorf("got nil")
+ }
+ return nil
+}
diff --git a/tests/legacy/examples/proto/lib/BUILD.bazel b/tests/legacy/examples/proto/lib/BUILD.bazel
new file mode 100644
index 00000000..61215267
--- /dev/null
+++ b/tests/legacy/examples/proto/lib/BUILD.bazel
@@ -0,0 +1,24 @@
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
+
+proto_library(
+ name = "lib_proto",
+ srcs = [
+ "lib.proto",
+ "lib2.proto",
+ ],
+ visibility = ["//visibility:public"],
+ deps = [
+ "//tests/legacy/examples/proto/dep:useful_proto",
+ ],
+)
+
+go_proto_library(
+ name = "lib_go_proto",
+ importpath = "github.com/bazelbuild/rules_go/examples/proto/lib/lib_proto",
+ proto = ":lib_proto",
+ visibility = ["//visibility:public"],
+ deps = [
+ "//tests/legacy/examples/proto/dep:useful_go_proto",
+ ],
+)
diff --git a/tests/legacy/examples/proto/lib/lib.proto b/tests/legacy/examples/proto/lib/lib.proto
new file mode 100644
index 00000000..b591f453
--- /dev/null
+++ b/tests/legacy/examples/proto/lib/lib.proto
@@ -0,0 +1,12 @@
+syntax = "proto3";
+
+package examples.lib;
+
+option go_package = "github.com/bazelbuild/rules_go/examples/proto/lib/lib_proto";
+
+import "tests/legacy/examples/proto/dep/useful.proto";
+
+message LibObject {
+ very.useful.VeryUseful very_useful = 1;
+ int32 are_you_sure = 2;
+}
diff --git a/tests/legacy/examples/proto/lib/lib2.proto b/tests/legacy/examples/proto/lib/lib2.proto
new file mode 100644
index 00000000..5c3d16d6
--- /dev/null
+++ b/tests/legacy/examples/proto/lib/lib2.proto
@@ -0,0 +1,14 @@
+syntax = "proto3";
+
+package examples.lib;
+
+option go_package = "github.com/bazelbuild/rules_go/examples/proto/lib/lib_proto";
+
+import "tests/legacy/examples/proto/dep/useful.proto";
+import "tests/legacy/examples/proto/lib/lib.proto";
+
+message LibObject2 {
+ very.useful.VeryUseful very_useful = 1;
+ int32 are_you_sure = 2;
+ LibObject lib_object = 4;
+}
diff --git a/tests/legacy/examples/proto/proto_test.go b/tests/legacy/examples/proto/proto_test.go
new file mode 100644
index 00000000..68ba8348
--- /dev/null
+++ b/tests/legacy/examples/proto/proto_test.go
@@ -0,0 +1,43 @@
+/* Copyright 2017 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package proto
+
+import (
+ "testing"
+
+ embed "github.com/bazelbuild/rules_go/examples/proto/embed"
+ lib_proto "github.com/bazelbuild/rules_go/examples/proto/lib/lib_proto"
+)
+
+func TestProto(t *testing.T) {
+ p := lib_proto.LibObject{AreYouSure: 20}
+ sure := p.GetAreYouSure()
+ if sure != 20 {
+ t.Errorf("got %d, want 20", sure)
+ }
+}
+
+func TestEmbed(t *testing.T) {
+ if embed.OtherThing().A != 42 {
+ t.Errorf("Unable to call method from embedded go files")
+ }
+}
+
+func TestValidate(t *testing.T) {
+ if err := embed.OtherThing().Validate(); err != nil {
+ t.Errorf("Proto did not pass validation")
+ }
+}
diff --git a/tests/legacy/examples/stamped_bin/BUILD.bazel b/tests/legacy/examples/stamped_bin/BUILD.bazel
new file mode 100644
index 00000000..4607f53d
--- /dev/null
+++ b/tests/legacy/examples/stamped_bin/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "stamped_test",
+ srcs = ["stamped_test.go"],
+)
diff --git a/tests/legacy/examples/stamped_bin/stamped_test.go b/tests/legacy/examples/stamped_bin/stamped_test.go
new file mode 100644
index 00000000..3c9fad92
--- /dev/null
+++ b/tests/legacy/examples/stamped_bin/stamped_test.go
@@ -0,0 +1,122 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package no_prefix_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+const mainFiles = `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_test", "go_library")
+
+go_library(
+ name = "stamp",
+ srcs = ["stamp.go"],
+ importpath = "github.com/bazelbuild/rules_go/examples/stamped_bin/stamp",
+ visibility = ["//visibility:public"],
+ x_defs = {
+ "XdefBuildTimestamp": "{BUILD_TIMESTAMP}",
+ },
+)
+
+go_test(
+ name = "stamp_with_x_defs",
+ size = "small",
+ srcs = ["stamped_bin_test.go"],
+ x_defs = {
+ "github.com/bazelbuild/rules_go/examples/stamped_bin/stamp.BUILD_TIMESTAMP": "{BUILD_TIMESTAMP}",
+ "github.com/bazelbuild/rules_go/examples/stamped_bin/stamp.PassIfEmpty": "",
+ "github.com/bazelbuild/rules_go/examples/stamped_bin/stamp.XdefInvalid": "{Undefined_Var}", # undefined should leave the var alone
+ "github.com/bazelbuild/rules_go/examples/stamped_bin/stamp.Multiple": "{BUILD_TIMESTAMP}{BUILD_TIMESTAMP}",
+ },
+ deps = [":stamp"],
+)
+
+-- stamp.go --
+package stamp
+
+var BUILD_TIMESTAMP = "fail"
+
+// an xdef should set this to ""
+var PassIfEmpty = "fail"
+
+// an xdef should set this to nonempty
+var XdefBuildTimestamp = ""
+
+// an xdef with a missing key should leave this alone
+var XdefInvalid = "pass"
+
+// an xdef with multiple keys
+var Multiple = "fail"
+
+-- stamped_bin_test.go --
+package stamped_bin_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/examples/stamped_bin/stamp"
+)
+
+func TestStampedBin(t *testing.T) {
+ // If we use an x_def when linking to override BUILD_TIMESTAMP but fail to
+ // pass through the workspace status value, it'll be set to empty string -
+ // overridden but still wrong. Check for that case too.
+ if stamp.BUILD_TIMESTAMP == "fail" || stamp.BUILD_TIMESTAMP == "" {
+ t.Errorf("Expected timestamp to have been modified, got %s.", stamp.BUILD_TIMESTAMP)
+ }
+ if stamp.XdefBuildTimestamp == "" {
+ t.Errorf("Expected XdefBuildTimestamp to have been modified, got %s.", stamp.XdefBuildTimestamp)
+ }
+ if stamp.PassIfEmpty != "" {
+ t.Errorf("Expected PassIfEmpty to have been set to '', got %s.", stamp.PassIfEmpty)
+ }
+ if stamp.XdefInvalid != "pass" {
+ t.Errorf("Expected XdefInvalid to have been left alone, got %s.", stamp.XdefInvalid)
+ }
+ if stamp.Multiple != stamp.BUILD_TIMESTAMP + stamp.BUILD_TIMESTAMP {
+ t.Errorf("Expected Multiple to have two BUILD_TIMESTAMP, got %s.", stamp.Multiple)
+ }
+}
+
+`
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: mainFiles,
+ })
+}
+
+func TestBuild(t *testing.T) {
+ if err := bazel_testing.RunBazel("test", "--stamp", ":all"); err != nil {
+ t.Fatal(err)
+ }
+}
+
+func TestBuildWithoutStamp(t *testing.T) {
+ if err := bazel_testing.RunBazel("test", "--nostamp", ":all"); err != nil {
+ if eErr, ok := err.(*bazel_testing.StderrExitError); ok {
+ if eErr.Err.ExitCode() == 3 { // 3 is TEST_FAILED bazel exit code
+ return
+ }
+ t.Fatalf("expected tests to have failed (instead got exit code %d)", eErr.Err.ExitCode())
+ }
+ t.Fatal("expected bazel_testing.StderrExitError")
+ }
+ t.Fatal("expected error")
+}
diff --git a/tests/legacy/examples/vendor/github.com/user/vendored/BUILD.bazel b/tests/legacy/examples/vendor/github.com/user/vendored/BUILD.bazel
new file mode 100644
index 00000000..f1c69c5f
--- /dev/null
+++ b/tests/legacy/examples/vendor/github.com/user/vendored/BUILD.bazel
@@ -0,0 +1,13 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+package(
+ default_visibility = ["//visibility:public"],
+)
+
+go_library(
+ name = "go_default_library",
+ srcs = [
+ "vendored.go",
+ ],
+ importpath = "github.com/user/vendored",
+)
diff --git a/tests/legacy/examples/vendor/github.com/user/vendored/vendored.go b/tests/legacy/examples/vendor/github.com/user/vendored/vendored.go
new file mode 100644
index 00000000..81341a9a
--- /dev/null
+++ b/tests/legacy/examples/vendor/github.com/user/vendored/vendored.go
@@ -0,0 +1,21 @@
+/* Copyright 2016 The Bazel Authors. All rights reserved.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package vendored
+
+// Vendored returns a string.
+func Vendored() string {
+ return "I was vendored"
+}
diff --git a/tests/legacy/extldflags_rpath/BUILD.bazel b/tests/legacy/extldflags_rpath/BUILD.bazel
new file mode 100644
index 00000000..13e21c21
--- /dev/null
+++ b/tests/legacy/extldflags_rpath/BUILD.bazel
@@ -0,0 +1,22 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+go_binary(
+ name = "extldflags_rpath",
+ srcs = ["main.go"],
+ gc_linkopts = [
+ "-linkmode",
+ "external",
+ "-extldflags",
+ "-Wl,-rpath -Wl,/foo",
+ "-extldflags",
+ "-Wl,-rpath -Wl,/bar",
+ ],
+)
+
+sh_test(
+ name = "extldflags_rpath_test",
+ size = "small",
+ srcs = ["extldflags_rpath_test.sh"],
+ args = ["$(location :extldflags_rpath)"],
+ data = [":extldflags_rpath"],
+)
diff --git a/tests/legacy/extldflags_rpath/README.md b/tests/legacy/extldflags_rpath/README.md
new file mode 100644
index 00000000..92de363e
--- /dev/null
+++ b/tests/legacy/extldflags_rpath/README.md
@@ -0,0 +1,15 @@
+This test checks that flags passed to the external linker with -extldflags
+through gc_linkopts are correctly combined with other flags passed through
+-extldflags.
+
+`go tool link` only uses the last set of flags passed with -extldflags. If more
+than one set of flags is passed, the last set is passed to the external linker,
+and the rest are silently ignored.
+
+`go_binary` and `go_test` should look for -extldflags in gc_linkopts and
+combine the flags into a single list passed to `go tool link`. This includes
+flags generated by the rules themselves.
+
+This test checks this behavior by adding extra rpaths, which has an observable
+effect on a `go_binary` linked with the external linker. The shell script checks
+that these paths are present.
diff --git a/tests/legacy/extldflags_rpath/extldflags_rpath_test.sh b/tests/legacy/extldflags_rpath/extldflags_rpath_test.sh
new file mode 100755
index 00000000..9b0d2634
--- /dev/null
+++ b/tests/legacy/extldflags_rpath/extldflags_rpath_test.sh
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+if [ $# -ne 1 ]; then
+ echo "usage: $0 binaryfile" >&1
+ exit 1
+fi
+
+binaryfile=$1
+os=$(uname)
+case $os in
+ Linux)
+ output=$(readelf --dynamic "$binaryfile")
+ ;;
+ Darwin)
+ output=$(otool -l "$binaryfile")
+ ;;
+ *)
+ echo "unsupported platform: $os" >&1
+ exit 1
+esac
+
+for path in /foo /bar ; do
+ if ! echo "$output" | grep --quiet "$path" ; then
+ echo "$binaryfile: could not find $path in rpaths" >&1
+ exit 1
+ fi
+done
diff --git a/tests/legacy/extldflags_rpath/main.go b/tests/legacy/extldflags_rpath/main.go
new file mode 100644
index 00000000..38dd16da
--- /dev/null
+++ b/tests/legacy/extldflags_rpath/main.go
@@ -0,0 +1,3 @@
+package main
+
+func main() {}
diff --git a/tests/legacy/info/BUILD.bazel b/tests/legacy/info/BUILD.bazel
new file mode 100644
index 00000000..4266fc2b
--- /dev/null
+++ b/tests/legacy/info/BUILD.bazel
@@ -0,0 +1,6 @@
+sh_test(
+ name = "info",
+ srcs = ["info_test.sh"],
+ args = ["$(location @io_bazel_rules_go//:go_info)"],
+ data = ["@io_bazel_rules_go//:go_info"],
+)
diff --git a/tests/legacy/info/info_test.sh b/tests/legacy/info/info_test.sh
new file mode 100755
index 00000000..cde164df
--- /dev/null
+++ b/tests/legacy/info/info_test.sh
@@ -0,0 +1,9 @@
+for t in "go version" "GOROOT=" "GOPATH=" "GOARCH=" "GOOS=" "GOBIN="; do
+ if ! grep -q "$t" $1; then
+ cat "$1"
+ echo
+ echo
+ echo "Failed to find $t in $1"
+ exit 1
+ fi
+done
diff --git a/tests/legacy/no_prefix/BUILD.bazel b/tests/legacy/no_prefix/BUILD.bazel
new file mode 100644
index 00000000..a1c2fd5e
--- /dev/null
+++ b/tests/legacy/no_prefix/BUILD.bazel
@@ -0,0 +1,6 @@
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_bazel_test(
+ name = "no_prefix_test",
+ srcs = ["no_prefix_test.go"],
+)
diff --git a/tests/legacy/no_prefix/no_prefix_test.go b/tests/legacy/no_prefix/no_prefix_test.go
new file mode 100644
index 00000000..c78cac75
--- /dev/null
+++ b/tests/legacy/no_prefix/no_prefix_test.go
@@ -0,0 +1,70 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package no_prefix_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+const mainFiles = `
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
+
+go_library(
+ name = "go_default_library",
+ srcs = ["no_prefix.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/no_prefix",
+)
+
+go_test(
+ name = "go_default_xtest",
+ srcs = ["no_prefix_test.go"],
+ deps = [":go_default_library"],
+)
+
+go_binary(
+ name = "cmd",
+ srcs = ["cmd.go"],
+ deps = [":go_default_library"],
+)
+
+-- no_prefix.go --
+package no_prefix
+
+-- no_prefix_test.go --
+package no_prefix_test
+
+-- cmd.go --
+package main
+
+import _ "github.com/bazelbuild/rules_go/tests/no_prefix"
+
+func main() {
+}
+`
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: mainFiles,
+ })
+}
+
+func TestBuild(t *testing.T) {
+ if err := bazel_testing.RunBazel("build", ":all"); err != nil {
+ t.Fatal(err)
+ }
+}
diff --git a/tests/legacy/package_named_build/build/BUILD.bazel b/tests/legacy/package_named_build/build/BUILD.bazel
new file mode 100644
index 00000000..bf5931be
--- /dev/null
+++ b/tests/legacy/package_named_build/build/BUILD.bazel
@@ -0,0 +1,16 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_library(
+ name = "go_default_library",
+ srcs = ["build.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/package_named_build/build",
+)
+
+go_test(
+ name = "go_default_xtest",
+ size = "small",
+ srcs = ["build_test.go"],
+ deps = [
+ ":go_default_library",
+ ],
+)
diff --git a/tests/legacy/package_named_build/build/build.go b/tests/legacy/package_named_build/build/build.go
new file mode 100644
index 00000000..4ed186e9
--- /dev/null
+++ b/tests/legacy/package_named_build/build/build.go
@@ -0,0 +1,3 @@
+package build
+
+const Foo = 42
diff --git a/tests/legacy/package_named_build/build/build_test.go b/tests/legacy/package_named_build/build/build_test.go
new file mode 100644
index 00000000..62dcad42
--- /dev/null
+++ b/tests/legacy/package_named_build/build/build_test.go
@@ -0,0 +1,13 @@
+package build_test
+
+import (
+ "testing"
+
+ "github.com/bazelbuild/rules_go/tests/package_named_build/build"
+)
+
+func TestBuildValue(t *testing.T) {
+ if got, want := build.Foo, 42; got != want {
+ t.Errorf("got %d; want %d", got, want)
+ }
+}
diff --git a/tests/legacy/proto_ignore_go_package_option/BUILD.bazel b/tests/legacy/proto_ignore_go_package_option/BUILD.bazel
new file mode 100644
index 00000000..23e0eba2
--- /dev/null
+++ b/tests/legacy/proto_ignore_go_package_option/BUILD.bazel
@@ -0,0 +1,34 @@
+load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
+load("@rules_proto//proto:defs.bzl", "proto_library")
+
+proto_library(
+ name = "a_proto",
+ srcs = ["a.proto"],
+ deps = [
+ "@com_google_protobuf//:struct_proto",
+ ],
+)
+
+proto_library(
+ name = "b_proto",
+ srcs = ["b.proto"],
+ deps = [
+ ":a_proto",
+ "@com_google_protobuf//:any_proto",
+ ],
+)
+
+go_proto_library(
+ name = "a_go_proto",
+ importpath = "github.com/bazelbuild/rules_go/test/proto_ignore_go_package_option/a",
+ proto = ":a_proto",
+)
+
+go_proto_library(
+ name = "b_go_proto",
+ importpath = "github.com/bazelbuild/rules_go/test/proto_ignore_go_package_option/b",
+ proto = ":b_proto",
+ deps = [
+ ":a_go_proto",
+ ],
+)
diff --git a/tests/legacy/proto_ignore_go_package_option/a.proto b/tests/legacy/proto_ignore_go_package_option/a.proto
new file mode 100644
index 00000000..45fed520
--- /dev/null
+++ b/tests/legacy/proto_ignore_go_package_option/a.proto
@@ -0,0 +1,15 @@
+syntax = "proto3";
+
+// This is a fake go_package that would be ignored by specifying
+// ignore_go_package_option = 1.
+option go_package = "foo.com/bar/bla;boo";
+
+// Importing google proto is not affected by ignore_go_package_option.
+import "google/protobuf/struct.proto";
+
+package foo;
+
+message Foo {
+ int32 a = 1;
+ google.protobuf.Struct s = 2;
+}
diff --git a/tests/legacy/proto_ignore_go_package_option/b.proto b/tests/legacy/proto_ignore_go_package_option/b.proto
new file mode 100644
index 00000000..840956e2
--- /dev/null
+++ b/tests/legacy/proto_ignore_go_package_option/b.proto
@@ -0,0 +1,16 @@
+syntax = "proto3";
+
+// This is a fake go_package that would be ignored when specifying
+// ignore_go_package_option.
+option go_package = "foo.com/bar/blabla;blu";
+
+// Mixing imports from google and local repository will work just fine.
+import "google/protobuf/any.proto";
+import "tests/legacy/proto_ignore_go_package_option/a.proto";
+
+package bar;
+
+message Bar {
+ foo.Foo foo = 1;
+ google.protobuf.Any a = 2;
+}
diff --git a/tests/legacy/providers/BUILD.bazel b/tests/legacy/providers/BUILD.bazel
new file mode 100644
index 00000000..34eb8897
--- /dev/null
+++ b/tests/legacy/providers/BUILD.bazel
@@ -0,0 +1,22 @@
+load("//go:def.bzl", "go_source")
+load("//tests/legacy/providers:test.bzl", "test_source")
+
+go_source(
+ name = "srcs",
+ srcs = [
+ "test.go",
+ ],
+)
+
+test_source(
+ name = "foo",
+ srcs = ":srcs",
+)
+
+sh_test(
+ name = "source_test",
+ srcs = ["test.sh"],
+ data = [
+ ":foo",
+ ],
+)
diff --git a/tests/legacy/providers/test.bzl b/tests/legacy/providers/test.bzl
new file mode 100644
index 00000000..a82ba5f5
--- /dev/null
+++ b/tests/legacy/providers/test.bzl
@@ -0,0 +1,14 @@
+load("//go:def.bzl", "GoLibrary")
+
+def _test_impl(ctx):
+ pass
+
+test_source = rule(
+ implementation = _test_impl,
+ attrs = {
+ "srcs": attr.label(
+ mandatory = True,
+ providers = [GoLibrary],
+ ),
+ },
+)
diff --git a/tests/legacy/providers/test.go b/tests/legacy/providers/test.go
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/legacy/providers/test.go
diff --git a/tests/legacy/providers/test.sh b/tests/legacy/providers/test.sh
new file mode 100755
index 00000000..92b94c40
--- /dev/null
+++ b/tests/legacy/providers/test.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+exit 0 \ No newline at end of file
diff --git a/tests/legacy/slash_names/BUILD.bazel b/tests/legacy/slash_names/BUILD.bazel
new file mode 100644
index 00000000..ce7d8fd9
--- /dev/null
+++ b/tests/legacy/slash_names/BUILD.bazel
@@ -0,0 +1,27 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+# TODO(#746) exclude because gazelle does not recognise the rule below
+# gazelle:exclude a
+# gazelle:exclude b
+
+go_library(
+ name = "a/pkg",
+ srcs = ["a/pkg/pkg.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/slash_names/a/pkg",
+)
+
+go_library(
+ name = "b/pkg",
+ srcs = ["b/pkg/pkg.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/slash_names/b/pkg",
+)
+
+go_test(
+ name = "go_default_test",
+ size = "small",
+ srcs = ["slash_test.go"],
+ deps = [
+ ":a/pkg",
+ ":b/pkg",
+ ],
+)
diff --git a/tests/legacy/slash_names/a/pkg/pkg.go b/tests/legacy/slash_names/a/pkg/pkg.go
new file mode 100644
index 00000000..185d7819
--- /dev/null
+++ b/tests/legacy/slash_names/a/pkg/pkg.go
@@ -0,0 +1,5 @@
+package pkg
+
+func Name() string {
+ return "A"
+}
diff --git a/tests/legacy/slash_names/b/pkg/pkg.go b/tests/legacy/slash_names/b/pkg/pkg.go
new file mode 100644
index 00000000..79cf739f
--- /dev/null
+++ b/tests/legacy/slash_names/b/pkg/pkg.go
@@ -0,0 +1,5 @@
+package pkg
+
+func Name() string {
+ return "B"
+}
diff --git a/tests/legacy/slash_names/slash_test.go b/tests/legacy/slash_names/slash_test.go
new file mode 100644
index 00000000..1408ec99
--- /dev/null
+++ b/tests/legacy/slash_names/slash_test.go
@@ -0,0 +1,17 @@
+package slash
+
+import (
+ "testing"
+
+ a "github.com/bazelbuild/rules_go/tests/slash_names/a/pkg"
+ b "github.com/bazelbuild/rules_go/tests/slash_names/b/pkg"
+)
+
+func TestSlash(t *testing.T) {
+ if name := a.Name(); name != "A" {
+ t.Errorf("got %s; want A", name)
+ }
+ if name := b.Name(); name != "B" {
+ t.Errorf("got %s; want B", name)
+ }
+}
diff --git a/tests/legacy/test_build_constraints/BUILD.bazel b/tests/legacy/test_build_constraints/BUILD.bazel
new file mode 100644
index 00000000..b66eb438
--- /dev/null
+++ b/tests/legacy/test_build_constraints/BUILD.bazel
@@ -0,0 +1,25 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_test(
+ name = "go_default_test",
+ size = "small",
+ srcs = [
+ # Filtered by filename suffix
+ "foo_linux_test.go",
+ # Filtered by tag
+ "foo_unknown_test.go",
+ "bar_unknown_test.go",
+ ],
+ embed = [":go_default_library"],
+)
+
+# Contains more test cases. Checks that build constraints are applied to
+# sources found through the library attribute.
+go_library(
+ name = "go_default_library",
+ srcs = [
+ "baz_linux_test.go",
+ "baz_unknown_test.go",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/tests/test_build_constraints",
+)
diff --git a/tests/legacy/test_build_constraints/bar_l_test.go b/tests/legacy/test_build_constraints/bar_l_test.go
new file mode 100644
index 00000000..686ff0f2
--- /dev/null
+++ b/tests/legacy/test_build_constraints/bar_l_test.go
@@ -0,0 +1,14 @@
+// +build linux
+
+package test_build_constraints
+
+import (
+ "runtime"
+ "testing"
+)
+
+func TestBarLinux(t *testing.T) {
+ if runtime.GOOS != "linux" {
+ t.Errorf("got %s; want linux", runtime.GOOS)
+ }
+}
diff --git a/tests/legacy/test_build_constraints/bar_unknown_test.go b/tests/legacy/test_build_constraints/bar_unknown_test.go
new file mode 100644
index 00000000..29d13727
--- /dev/null
+++ b/tests/legacy/test_build_constraints/bar_unknown_test.go
@@ -0,0 +1,14 @@
+// +build !linux
+
+package test_build_constraints
+
+import (
+ "runtime"
+ "testing"
+)
+
+func TestBarUnknown(t *testing.T) {
+ if runtime.GOOS == "linux" {
+ t.Errorf("got %s; want not linux", runtime.GOOS)
+ }
+}
diff --git a/tests/legacy/test_build_constraints/baz_linux_test.go b/tests/legacy/test_build_constraints/baz_linux_test.go
new file mode 100644
index 00000000..f057ec62
--- /dev/null
+++ b/tests/legacy/test_build_constraints/baz_linux_test.go
@@ -0,0 +1,12 @@
+package test_build_constraints
+
+import (
+ "runtime"
+ "testing"
+)
+
+func TestBazLinux(t *testing.T) {
+ if runtime.GOOS != "linux" {
+ t.Errorf("got %s; want linux", runtime.GOOS)
+ }
+}
diff --git a/tests/legacy/test_build_constraints/baz_unknown_test.go b/tests/legacy/test_build_constraints/baz_unknown_test.go
new file mode 100644
index 00000000..6f0df42a
--- /dev/null
+++ b/tests/legacy/test_build_constraints/baz_unknown_test.go
@@ -0,0 +1,14 @@
+// +build !linux
+
+package test_build_constraints
+
+import (
+ "runtime"
+ "testing"
+)
+
+func TestBazUnknown(t *testing.T) {
+ if runtime.GOOS == "linux" {
+ t.Errorf("got %s; want not linux", runtime.GOOS)
+ }
+}
diff --git a/tests/legacy/test_build_constraints/foo_linux_test.go b/tests/legacy/test_build_constraints/foo_linux_test.go
new file mode 100644
index 00000000..61b5bfcd
--- /dev/null
+++ b/tests/legacy/test_build_constraints/foo_linux_test.go
@@ -0,0 +1,12 @@
+package test_build_constraints
+
+import (
+ "runtime"
+ "testing"
+)
+
+func TestFooLinux(t *testing.T) {
+ if runtime.GOOS != "linux" {
+ t.Errorf("got %s; want linux", runtime.GOOS)
+ }
+}
diff --git a/tests/legacy/test_build_constraints/foo_unknown_test.go b/tests/legacy/test_build_constraints/foo_unknown_test.go
new file mode 100644
index 00000000..72216ea3
--- /dev/null
+++ b/tests/legacy/test_build_constraints/foo_unknown_test.go
@@ -0,0 +1,14 @@
+// +build !linux
+
+package test_build_constraints
+
+import (
+ "runtime"
+ "testing"
+)
+
+func TestFooUnknown(t *testing.T) {
+ if runtime.GOOS == "linux" {
+ t.Errorf("got %s; want not linux", runtime.GOOS)
+ }
+}
diff --git a/tests/legacy/test_chdir/BUILD.bazel b/tests/legacy/test_chdir/BUILD.bazel
new file mode 100644
index 00000000..7e06b0ed
--- /dev/null
+++ b/tests/legacy/test_chdir/BUILD.bazel
@@ -0,0 +1,13 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_test")
+
+go_test(
+ name = "go_default_test",
+ size = "small",
+ srcs = ["data_test.go"],
+ data = ["data.txt"],
+)
+
+test_suite(
+ name = "remote_test",
+ tests = ["@test_chdir_remote//sub:go_default_test"],
+)
diff --git a/tests/legacy/test_chdir/data.txt b/tests/legacy/test_chdir/data.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/legacy/test_chdir/data.txt
diff --git a/tests/legacy/test_chdir/data_test.go b/tests/legacy/test_chdir/data_test.go
new file mode 100644
index 00000000..f7e948df
--- /dev/null
+++ b/tests/legacy/test_chdir/data_test.go
@@ -0,0 +1,31 @@
+package test_chdir
+
+import (
+ "log"
+ "os"
+ "testing"
+)
+
+const file = "data.txt"
+
+func init() {
+ _, err := os.Stat(file)
+ if err != nil {
+ log.Fatalf("in init(), could not stat %s: %v", file, err)
+ }
+}
+
+func TestMain(m *testing.M) {
+ _, err := os.Stat(file)
+ if err != nil {
+ log.Fatalf("in TestMain(), could not stat %s: %v", file, err)
+ }
+ os.Exit(m.Run())
+}
+
+func TestLocal(t *testing.T) {
+ _, err := os.Stat(file)
+ if err != nil {
+ t.Errorf("could not stat %s: %v", file, err)
+ }
+}
diff --git a/tests/legacy/test_chdir/remote.bzl b/tests/legacy/test_chdir/remote.bzl
new file mode 100644
index 00000000..03642fe2
--- /dev/null
+++ b/tests/legacy/test_chdir/remote.bzl
@@ -0,0 +1,14 @@
+def _test_chdir_remote_impl(ctx):
+ ctx.file("WORKSPACE", """workspace("test_chdir_remote")""")
+ ctx.file("BUILD.bazel", "")
+ for f in ["BUILD.bazel", "data_test.go", "data.txt"]:
+ input = Label("@io_bazel_rules_go//tests/legacy/test_chdir:{}".format(f))
+ ctx.template("sub/" + f, input)
+
+_test_chdir_remote = repository_rule(
+ implementation = _test_chdir_remote_impl,
+ attrs = {},
+)
+
+def test_chdir_remote():
+ _test_chdir_remote(name = "test_chdir_remote")
diff --git a/tests/legacy/test_rundir/BUILD.bazel b/tests/legacy/test_rundir/BUILD.bazel
new file mode 100644
index 00000000..9cd61835
--- /dev/null
+++ b/tests/legacy/test_rundir/BUILD.bazel
@@ -0,0 +1,9 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_test")
+
+go_test(
+ name = "go_default_test",
+ size = "small",
+ srcs = ["rundir_test.go"],
+ data = ["//:AUTHORS"],
+ rundir = ".",
+)
diff --git a/tests/legacy/test_rundir/rundir_test.go b/tests/legacy/test_rundir/rundir_test.go
new file mode 100644
index 00000000..7b1497e3
--- /dev/null
+++ b/tests/legacy/test_rundir/rundir_test.go
@@ -0,0 +1,12 @@
+package test_rundir
+
+import (
+ "os"
+ "testing"
+)
+
+func TestRunDir(t *testing.T) {
+ if _, err := os.Stat("AUTHORS"); err != nil {
+ t.Error(err)
+ }
+}
diff --git a/tests/legacy/transitive_data/BUILD.bazel b/tests/legacy/transitive_data/BUILD.bazel
new file mode 100644
index 00000000..e678f4eb
--- /dev/null
+++ b/tests/legacy/transitive_data/BUILD.bazel
@@ -0,0 +1,34 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
+
+go_test(
+ name = "go_default_test",
+ size = "small",
+ srcs = ["transitive_data_test.go"],
+ args = [
+ "go_data.txt",
+ "cgo_data.txt",
+ "c_data.txt",
+ ],
+ deps = [":go_lib"],
+)
+
+go_library(
+ name = "go_lib",
+ srcs = [
+ "empty.go",
+ "empty_cgo.go",
+ ],
+ cdeps = [":c_lib"],
+ cgo = True,
+ data = [
+ "cgo_data.txt",
+ "go_data.txt",
+ ],
+ importpath = "github.com/bazelbuild/rules_go/tests/transitive_data",
+)
+
+cc_library(
+ name = "c_lib",
+ srcs = [],
+ data = ["c_data.txt"],
+)
diff --git a/tests/legacy/transitive_data/c_data.txt b/tests/legacy/transitive_data/c_data.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/legacy/transitive_data/c_data.txt
diff --git a/tests/legacy/transitive_data/cgo_data.txt b/tests/legacy/transitive_data/cgo_data.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/legacy/transitive_data/cgo_data.txt
diff --git a/tests/legacy/transitive_data/empty.go b/tests/legacy/transitive_data/empty.go
new file mode 100644
index 00000000..8f4e6aef
--- /dev/null
+++ b/tests/legacy/transitive_data/empty.go
@@ -0,0 +1 @@
+package go_lib
diff --git a/tests/legacy/transitive_data/empty_cgo.go b/tests/legacy/transitive_data/empty_cgo.go
new file mode 100644
index 00000000..ed84c972
--- /dev/null
+++ b/tests/legacy/transitive_data/empty_cgo.go
@@ -0,0 +1,3 @@
+package go_lib
+
+import "C"
diff --git a/tests/legacy/transitive_data/go_data.txt b/tests/legacy/transitive_data/go_data.txt
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/tests/legacy/transitive_data/go_data.txt
diff --git a/tests/legacy/transitive_data/transitive_data_test.go b/tests/legacy/transitive_data/transitive_data_test.go
new file mode 100644
index 00000000..edd7d7f8
--- /dev/null
+++ b/tests/legacy/transitive_data/transitive_data_test.go
@@ -0,0 +1,20 @@
+package transitive_data
+
+import (
+ "flag"
+ "os"
+ "testing"
+)
+
+func TestFiles(t *testing.T) {
+ filenames := flag.Args()
+ if len(filenames) == 0 {
+ t.Fatal("no filenames given")
+ }
+
+ for _, filename := range flag.Args() {
+ if _, err := os.Stat(filename); err != nil {
+ t.Error(err)
+ }
+ }
+}
diff --git a/tests/legacy/visibility/BUILD.bazel b/tests/legacy/visibility/BUILD.bazel
new file mode 100644
index 00000000..8aa0ba95
--- /dev/null
+++ b/tests/legacy/visibility/BUILD.bazel
@@ -0,0 +1,15 @@
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+package_group(
+ name = "vis",
+ packages = [
+ "//...",
+ ],
+)
+
+go_library(
+ name = "go_default_library",
+ srcs = ["foo.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/visibility",
+ visibility = [":vis"],
+)
diff --git a/tests/legacy/visibility/foo.go b/tests/legacy/visibility/foo.go
new file mode 100644
index 00000000..413e89c3
--- /dev/null
+++ b/tests/legacy/visibility/foo.go
@@ -0,0 +1,3 @@
+package foo
+
+const Foo = 1
diff --git a/tests/runfiles/BUILD.bazel b/tests/runfiles/BUILD.bazel
new file mode 100644
index 00000000..b657d307
--- /dev/null
+++ b/tests/runfiles/BUILD.bazel
@@ -0,0 +1,42 @@
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("@io_bazel_rules_go//go:def.bzl", "go_test")
+load("@io_bazel_rules_go//go/tools/bazel_testing:def.bzl", "go_bazel_test")
+
+go_test(
+ name = "runfiles_test",
+ srcs = [
+ "fs_test.go",
+ "runfiles_test.go",
+ ],
+ data = [
+ "test.txt",
+ "//tests/runfiles/testprog",
+ "@bazel_tools//tools/bash/runfiles",
+ ],
+ deps = [
+ "//go/runfiles",
+ ],
+)
+
+go_bazel_test(
+ name = "runfiles_bazel_test",
+ srcs = ["runfiles_bazel_test.go"],
+)
+
+exports_files(
+ ["test.txt"],
+ visibility = ["//tests/runfiles/testprog:__pkg__"],
+)
diff --git a/tests/runfiles/fs_test.go b/tests/runfiles/fs_test.go
new file mode 100644
index 00000000..3b66c480
--- /dev/null
+++ b/tests/runfiles/fs_test.go
@@ -0,0 +1,121 @@
+// Copyright 2021 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+//go:build go1.16
+// +build go1.16
+
+package runfiles_test
+
+import (
+ "io"
+ "io/fs"
+ "os"
+ "path/filepath"
+ "runtime"
+ "testing"
+ "testing/fstest"
+
+ "github.com/bazelbuild/rules_go/go/runfiles"
+)
+
+func TestFS(t *testing.T) {
+ fsys, err := runfiles.New()
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ // Ensure that the Runfiles object implements FS interfaces.
+ var _ fs.FS = fsys
+ var _ fs.StatFS = fsys
+ var _ fs.ReadFileFS = fsys
+
+ if runtime.GOOS == "windows" {
+ // Currently the result of
+ //
+ // fsys.Rlocation("io_bazel_rules_go/go/runfiles/test.txt")
+ // fsys.Rlocation("bazel_tools/tools/bash/runfiles/runfiles.bash")
+ // fsys.Rlocation("io_bazel_rules_go/go/runfiles/testprog/testprog")
+ //
+ // would be a full path like these
+ //
+ // C:\b\bk-windows-1z0z\bazel\rules-go-golang\go\tools\bazel\runfiles\test.txt
+ // C:\b\zslxztin\external\bazel_tools\tools\bash\runfiles\runfiles.bash
+ // C:\b\pm4ep4b2\execroot\io_bazel_rules_go\bazel-out\x64_windows-fastbuild\bin\go\tools\bazel\runfiles\testprog\testprog
+ //
+ // Which does not follow any particular patter / rules.
+ // This makes it very hard to define what we are looking for on Windows.
+ // So let's skip this for now.
+ return
+ }
+
+ expected1 := "io_bazel_rules_go/tests/runfiles/test.txt"
+ expected2 := "io_bazel_rules_go/tests/runfiles/testprog/testprog_/testprog"
+ expected3 := "bazel_tools/tools/bash/runfiles/runfiles.bash"
+ if err := fstest.TestFS(fsys, expected1, expected2, expected3); err != nil {
+ t.Error(err)
+ }
+}
+
+func TestFS_empty(t *testing.T) {
+ dir := t.TempDir()
+ manifest := filepath.Join(dir, "manifest")
+ if err := os.WriteFile(manifest, []byte("__init__.py \n"), 0o600); err != nil {
+ t.Fatal(err)
+ }
+ fsys, err := runfiles.New(runfiles.ManifestFile(manifest), runfiles.ProgramName("/invalid"), runfiles.Directory("/invalid"))
+ if err != nil {
+ t.Fatal(err)
+ }
+ t.Run("Open", func(t *testing.T) {
+ fd, err := fsys.Open("__init__.py")
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer fd.Close()
+ got, err := io.ReadAll(fd)
+ if err != nil {
+ t.Error(err)
+ }
+ if len(got) != 0 {
+ t.Errorf("got nonempty contents: %q", got)
+ }
+ })
+ t.Run("Stat", func(t *testing.T) {
+ got, err := fsys.Stat("__init__.py")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if got.Name() != "__init__.py" {
+ t.Errorf("Name: got %q, want %q", got.Name(), "__init__.py")
+ }
+ if got.Size() != 0 {
+ t.Errorf("Size: got %d, want %d", got.Size(), 0)
+ }
+ if !got.Mode().IsRegular() {
+ t.Errorf("IsRegular: got %v, want %v", got.Mode().IsRegular(), true)
+ }
+ if got.IsDir() {
+ t.Errorf("IsDir: got %v, want %v", got.IsDir(), false)
+ }
+ })
+ t.Run("ReadFile", func(t *testing.T) {
+ got, err := fsys.ReadFile("__init__.py")
+ if err != nil {
+ t.Error(err)
+ }
+ if len(got) != 0 {
+ t.Errorf("got nonempty contents: %q", got)
+ }
+ })
+}
diff --git a/tests/runfiles/runfiles_bazel_test.go b/tests/runfiles/runfiles_bazel_test.go
new file mode 100644
index 00000000..f73f17e4
--- /dev/null
+++ b/tests/runfiles/runfiles_bazel_test.go
@@ -0,0 +1,168 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package runfiles_test
+
+import (
+ "regexp"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/tools/bazel_testing"
+)
+
+func TestMain(m *testing.M) {
+ bazel_testing.TestMain(m, bazel_testing.Args{
+ Main: `
+-- other_repo/WORKSPACE --
+-- other_repo/pkg/BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "external_source_lib",
+ srcs = ["external_source_lib.go"],
+ importpath = "example.com/runfiles/external_source_lib",
+ deps = [
+ "@io_bazel_rules_go//go/runfiles",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+genrule(
+ name = "gen_source",
+ srcs = ["external_source_lib.go"],
+ outs = ["external_generated_lib.go"],
+ cmd = "cat $(location external_source_lib.go) | sed 's/external_source_lib/external_generated_lib/g' > $@",
+)
+
+go_library(
+ name = "external_generated_lib",
+ srcs = [":gen_source"],
+ importpath = "example.com/runfiles/external_generated_lib",
+ deps = [
+ "@io_bazel_rules_go//go/runfiles",
+ ],
+ visibility = ["//visibility:public"],
+)
+-- other_repo/pkg/external_source_lib.go --
+package external_source_lib
+
+import (
+ "fmt"
+ "runtime"
+
+ "github.com/bazelbuild/rules_go/go/runfiles"
+)
+
+func PrintRepo() {
+ _, file, _, _ := runtime.Caller(0)
+ fmt.Printf("%s: '%s'\n", file, runfiles.CurrentRepository())
+}
+-- pkg/BUILD.bazel --
+-- pkg/BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_library")
+
+go_library(
+ name = "internal_source_lib",
+ srcs = ["internal_source_lib.go"],
+ importpath = "example.com/runfiles/internal_source_lib",
+ deps = [
+ "@io_bazel_rules_go//go/runfiles",
+ ],
+ visibility = ["//visibility:public"],
+)
+
+genrule(
+ name = "gen_source",
+ srcs = ["internal_source_lib.go"],
+ outs = ["internal_generated_lib.go"],
+ cmd = "cat $(location internal_source_lib.go) | sed 's/internal_source_lib/internal_generated_lib/g' > $@",
+)
+
+go_library(
+ name = "internal_generated_lib",
+ srcs = [":gen_source"],
+ importpath = "example.com/runfiles/internal_generated_lib",
+ deps = [
+ "@io_bazel_rules_go//go/runfiles",
+ ],
+ visibility = ["//visibility:public"],
+)
+-- pkg/internal_source_lib.go --
+package internal_source_lib
+
+import (
+ "fmt"
+ "runtime"
+
+ "github.com/bazelbuild/rules_go/go/runfiles"
+)
+
+func PrintRepo() {
+ _, file, _, _ := runtime.Caller(0)
+ fmt.Printf("%s: '%s'\n", file, runfiles.CurrentRepository())
+}
+-- BUILD.bazel --
+load("@io_bazel_rules_go//go:def.bzl", "go_binary")
+
+go_binary(
+ name = "main",
+ srcs = ["main.go"],
+ deps = [
+ "//pkg:internal_source_lib",
+ "//pkg:internal_generated_lib",
+ "@other_repo//pkg:external_source_lib",
+ "@other_repo//pkg:external_generated_lib",
+ ],
+)
+-- main.go --
+package main
+
+import (
+ "example.com/runfiles/internal_generated_lib"
+ "example.com/runfiles/internal_source_lib"
+ "example.com/runfiles/external_generated_lib"
+ "example.com/runfiles/external_source_lib"
+)
+
+func main() {
+ internal_source_lib.PrintRepo()
+ internal_generated_lib.PrintRepo()
+ external_source_lib.PrintRepo()
+ external_generated_lib.PrintRepo()
+}
+`,
+ WorkspaceSuffix: `
+local_repository(
+ name = "other_repo",
+ path = "other_repo",
+)
+`,
+ })
+}
+
+var expectedOutputLegacy = regexp.MustCompile(`^pkg/internal_source_lib.go: ''
+bazel-out/[^/]+/bin/pkg/internal_generated_lib.go: ''
+external/other_repo/pkg/external_source_lib.go: 'other_repo'
+bazel-out/[^/]+/bin/external/other_repo/pkg/external_generated_lib.go: 'other_repo'
+$`)
+
+func TestCurrentRepository(t *testing.T) {
+ out, err := bazel_testing.BazelOutput("run", "//:main")
+ if err != nil {
+ t.Fatal(err)
+ }
+ if !expectedOutputLegacy.Match(out) {
+ t.Fatalf("got: %q, want: %q", string(out), expectedOutputLegacy.String())
+ }
+}
diff --git a/tests/runfiles/runfiles_test.go b/tests/runfiles/runfiles_test.go
new file mode 100644
index 00000000..093a683c
--- /dev/null
+++ b/tests/runfiles/runfiles_test.go
@@ -0,0 +1,149 @@
+// Copyright 2020, 2021, 2022 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package runfiles_test
+
+import (
+ "errors"
+ "os"
+ "os/exec"
+ "path/filepath"
+ "runtime"
+ "strings"
+ "testing"
+
+ "github.com/bazelbuild/rules_go/go/runfiles"
+)
+
+func TestPath_FileLookup(t *testing.T) {
+ path, err := runfiles.Rlocation("io_bazel_rules_go/tests/runfiles/test.txt")
+ if err != nil {
+ t.Fatal(err)
+ }
+ b, err := os.ReadFile(path)
+ if err != nil {
+ t.Fatal(err)
+ }
+ got := strings.TrimSpace(string(b))
+ want := "hi!"
+ if got != want {
+ t.Errorf("got %q, want %q", got, want)
+ }
+}
+
+func TestPath_SubprocessRunfilesLookup(t *testing.T) {
+ r, err := runfiles.New()
+ if err != nil {
+ panic(err)
+ }
+ // The binary “testprog” is itself built with Bazel, and needs
+ // runfiles.
+ testprogRpath := "io_bazel_rules_go/tests/runfiles/testprog/testprog_/testprog"
+ if runtime.GOOS == "windows" {
+ testprogRpath += ".exe"
+ }
+ prog, err := r.Rlocation(testprogRpath)
+ if err != nil {
+ panic(err)
+ }
+ cmd := exec.Command(prog)
+ // We add r.Env() after os.Environ() so that runfile environment
+ // variables override anything set in the process environment.
+ cmd.Env = append(os.Environ(), r.Env()...)
+ out, err := cmd.Output()
+ if err != nil {
+ t.Fatal(err)
+ }
+ got := strings.TrimSpace(string(out))
+ want := "hi!"
+ if got != want {
+ t.Errorf("got %q, want %q", got, want)
+ }
+}
+
+func TestPath_errors(t *testing.T) {
+ r, err := runfiles.New()
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, s := range []string{"", "/..", "../", "a/../b", "a//b", "a/./b", `\a`} {
+ t.Run(s, func(t *testing.T) {
+ if got, err := r.Rlocation(s); err == nil {
+ t.Errorf("got %q, want error", got)
+ }
+ })
+ }
+ for _, s := range []string{"foo/..bar", "foo/.bar"} {
+ t.Run(s, func(t *testing.T) {
+ if _, err := r.Rlocation(s); err != nil && !os.IsNotExist(err.(runfiles.Error).Err) {
+ t.Errorf("got %q, want none or 'file not found' error", err)
+ }
+ })
+ }
+}
+
+func TestRunfiles_zero(t *testing.T) {
+ var r runfiles.Runfiles
+ if got, err := r.Rlocation("a"); err == nil {
+ t.Errorf("Rlocation: got %q, want error", got)
+ }
+ if got := r.Env(); got != nil {
+ t.Errorf("Env: got %v, want nil", got)
+ }
+}
+
+func TestRunfiles_empty(t *testing.T) {
+ dir := t.TempDir()
+ manifest := filepath.Join(dir, "manifest")
+ if err := os.WriteFile(manifest, []byte("__init__.py \n"), 0o600); err != nil {
+ t.Fatal(err)
+ }
+ r, err := runfiles.New(runfiles.ManifestFile(manifest))
+ if err != nil {
+ t.Fatal(err)
+ }
+ _, got := r.Rlocation("__init__.py")
+ want := runfiles.ErrEmpty
+ if !errors.Is(got, want) {
+ t.Errorf("Rlocation for empty file: got error %q, want something that wraps %q", got, want)
+ }
+}
+
+func TestRunfiles_manifestWithDir(t *testing.T) {
+ dir := t.TempDir()
+ manifest := filepath.Join(dir, "manifest")
+ if err := os.WriteFile(manifest, []byte("foo/dir path/to/foo/dir\n"), 0o600); err != nil {
+ t.Fatal(err)
+ }
+ r, err := runfiles.New(runfiles.ManifestFile(manifest))
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ for rlocation, want := range map[string]string{
+ "foo/dir": filepath.FromSlash("path/to/foo/dir"),
+ "foo/dir/file": filepath.FromSlash("path/to/foo/dir/file"),
+ "foo/dir/deeply/nested/file": filepath.FromSlash("path/to/foo/dir/deeply/nested/file"),
+ } {
+ t.Run(rlocation, func(t *testing.T) {
+ got, err := r.Rlocation(rlocation)
+ if err != nil {
+ t.Fatalf("Rlocation failed: got unexpected error %q", err)
+ }
+ if got != want {
+ t.Errorf("Rlocation failed: got %q, want %q", got, want)
+ }
+ })
+ }
+}
diff --git a/tests/runfiles/test.txt b/tests/runfiles/test.txt
new file mode 100644
index 00000000..32aad8c3
--- /dev/null
+++ b/tests/runfiles/test.txt
@@ -0,0 +1 @@
+hi!
diff --git a/tests/runfiles/testprog/BUILD.bazel b/tests/runfiles/testprog/BUILD.bazel
new file mode 100644
index 00000000..2eee947a
--- /dev/null
+++ b/tests/runfiles/testprog/BUILD.bazel
@@ -0,0 +1,30 @@
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
+
+go_library(
+ name = "testprog_lib",
+ srcs = ["main.go"],
+ importpath = "github.com/bazelbuild/rules_go/tests/runfiles/testprog",
+ visibility = ["//visibility:private"],
+ deps = ["//go/runfiles"],
+)
+
+go_binary(
+ name = "testprog",
+ data = ["//tests/runfiles:test.txt"],
+ embed = [":testprog_lib"],
+ visibility = ["//tests/runfiles:__pkg__"],
+)
diff --git a/tests/runfiles/testprog/main.go b/tests/runfiles/testprog/main.go
new file mode 100644
index 00000000..9869da61
--- /dev/null
+++ b/tests/runfiles/testprog/main.go
@@ -0,0 +1,34 @@
+// Copyright 2020 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "fmt"
+ "io/ioutil"
+
+ "github.com/bazelbuild/rules_go/go/runfiles"
+)
+
+func main() {
+ path, err := runfiles.Rlocation("io_bazel_rules_go/tests/runfiles/test.txt")
+ if err != nil {
+ panic(err)
+ }
+ b, err := ioutil.ReadFile(path)
+ if err != nil {
+ panic(err)
+ }
+ fmt.Println(string(b))
+}
diff --git a/tests/update.py b/tests/update.py
new file mode 100755
index 00000000..57634723
--- /dev/null
+++ b/tests/update.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+# Copyright 2018 The Bazel Authors. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+This script should be run without any arguments to update the tests
+documentation cross linking.
+
+It updates sections bounded by
+.. Child list start
+.. Child list end
+
+With links to all the child documentation, picking the text for each item
+from the firts non blank line of the README.rst for that folder.
+"""
+
+import os
+
+README = "README.rst"
+START_MARKER = ".. Child list start\n"
+END_MARKER = ".. Child list end\n"
+
+def main():
+ for dirname, subdirs, files in os.walk("."):
+ if README not in files:
+ continue
+ readme = os.path.join(dirname, README)
+ out = []
+ lines = []
+ with open(readme) as f:
+ lines = f.readlines()
+ try:
+ start = lines.index(START_MARKER)
+ end = lines.index(END_MARKER)
+ except ValueError:
+ print('{}: No child markers'.format(readme))
+ continue
+ if end < start:
+ print('{}: Invalid child markers'.format(readme))
+ continue
+ print('{}: updating from {} to {}'.format(readme, start, end))
+ out = lines[:start+1]
+ out.append("\n")
+ for sub in subdirs:
+ child = os.path.join(dirname, sub, README)
+ try:
+ with open(child) as f:
+ for line in f.readlines():
+ childname = line.strip()
+ if childname:
+ break
+ if childname:
+ out.append("* `{} <{}/{}>`_\n".format(childname, sub, README))
+ except:
+ continue
+ out.append("\n")
+ out.extend(lines[end:])
+ if out:
+ with open(readme, "w") as f:
+ f.writelines(out)
+
+
+if __name__ == "__main__":
+ main() \ No newline at end of file
diff --git a/third_party/BUILD.bazel b/third_party/BUILD.bazel
new file mode 100644
index 00000000..b398c336
--- /dev/null
+++ b/third_party/BUILD.bazel
@@ -0,0 +1,8 @@
+exports_files(glob(["*.patch"]))
+
+filegroup(
+ name = "all_files",
+ testonly = True,
+ srcs = glob(["**"]),
+ visibility = ["//visibility:public"],
+)
diff --git a/third_party/README.txt b/third_party/README.txt
new file mode 100644
index 00000000..2d09913a
--- /dev/null
+++ b/third_party/README.txt
@@ -0,0 +1,11 @@
+This directory contains patches for repositories declared by
+go_rules_dependencies.
+
+If you declare dependencies on different versions of these repositories, you
+may need to update and apply these patches yourself.
+
+For details on overriding dependencies, see
+https://github.com/bazelbuild/rules_go/blob/master/go/dependencies.rst#overriding-dependencies
+
+For details on updating these patches, see
+https://github.com/bazelbuild/rules_go/wiki/Updating-dependencies
diff --git a/third_party/com_github_gogo_protobuf-gazelle.patch b/third_party/com_github_gogo_protobuf-gazelle.patch
new file mode 100644
index 00000000..ea516403
--- /dev/null
+++ b/third_party/com_github_gogo_protobuf-gazelle.patch
@@ -0,0 +1,6449 @@
+diff -urN a/codec/BUILD.bazel b/codec/BUILD.bazel
+--- a/codec/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/codec/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "codec",
++ srcs = ["codec.go"],
++ importpath = "github.com/gogo/protobuf/codec",
++ visibility = ["//visibility:public"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":codec",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "codec_test",
++ srcs = ["codec_test.go"],
++ embed = [":codec"],
++ deps = ["//test"],
++)
+diff -urN a/conformance/BUILD.bazel b/conformance/BUILD.bazel
+--- a/conformance/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/conformance/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "conformance_lib",
++ srcs = ["conformance.go"],
++ importpath = "github.com/gogo/protobuf/conformance",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//conformance/internal/conformance_proto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
++
++go_binary(
++ name = "conformance",
++ embed = [":conformance_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/conformance/internal/conformance_proto/BUILD.bazel b/conformance/internal/conformance_proto/BUILD.bazel
+--- a/conformance/internal/conformance_proto/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/conformance/internal/conformance_proto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["conformance.proto"],
++ visibility = ["//conformance:__subpackages__"],
++)
++
++go_library(
++ name = "conformance_proto",
++ srcs = ["conformance.pb.go"],
++ importpath = "github.com/gogo/protobuf/conformance/internal/conformance_proto",
++ visibility = ["//conformance:__subpackages__"],
++ deps = [
++ "//proto",
++ "//types",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":conformance_proto",
++ visibility = ["//conformance:__subpackages__"],
++)
+diff -urN a/gogoproto/BUILD.bazel b/gogoproto/BUILD.bazel
+--- a/gogoproto/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/gogoproto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["gogo.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "gogoproto",
++ srcs = [
++ "doc.go",
++ "gogo.pb.go",
++ "helper.go",
++ ],
++ importpath = "github.com/gogo/protobuf/gogoproto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gogoproto",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/gogoreplace/BUILD.bazel b/gogoreplace/BUILD.bazel
+--- a/gogoreplace/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/gogoreplace/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "gogoreplace_lib",
++ srcs = ["main.go"],
++ importpath = "github.com/gogo/protobuf/gogoreplace",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "gogoreplace",
++ embed = [":gogoreplace_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/io/BUILD.bazel b/io/BUILD.bazel
+--- a/io/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/io/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "io",
++ srcs = [
++ "full.go",
++ "io.go",
++ "uint32.go",
++ "varint.go",
++ ],
++ importpath = "github.com/gogo/protobuf/io",
++ visibility = ["//visibility:public"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":io",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "io_test",
++ srcs = [
++ "io_test.go",
++ "uint32_test.go",
++ ],
++ deps = [
++ ":io",
++ "//test",
++ "//test/example",
++ ],
++)
+diff -urN a/jsonpb/BUILD.bazel b/jsonpb/BUILD.bazel
+--- a/jsonpb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/jsonpb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "jsonpb",
++ srcs = ["jsonpb.go"],
++ importpath = "github.com/gogo/protobuf/jsonpb",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//types",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":jsonpb",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "jsonpb_test",
++ srcs = ["jsonpb_test.go"],
++ embed = [":jsonpb"],
++ deps = [
++ "//jsonpb/jsonpb_test_proto",
++ "//proto",
++ "//proto/proto3_proto",
++ "//types",
++ ],
++)
+diff -urN a/jsonpb/jsonpb_test_proto/BUILD.bazel b/jsonpb/jsonpb_test_proto/BUILD.bazel
+--- a/jsonpb/jsonpb_test_proto/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/jsonpb/jsonpb_test_proto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "more_test_objects.proto",
++ "test_objects.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "jsonpb_test_proto",
++ srcs = [
++ "bytes.go",
++ "more_test_objects.pb.go",
++ "test_objects.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/jsonpb/jsonpb_test_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//types",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":jsonpb_test_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/compare/BUILD.bazel b/plugin/compare/BUILD.bazel
+--- a/plugin/compare/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/compare/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "compare",
++ srcs = [
++ "compare.go",
++ "comparetest.go",
++ ],
++ importpath = "github.com/gogo/protobuf/plugin/compare",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//plugin/testgen",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//protoc-gen-gogo/generator",
++ "//vanity",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":compare",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/defaultcheck/BUILD.bazel b/plugin/defaultcheck/BUILD.bazel
+--- a/plugin/defaultcheck/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/defaultcheck/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "defaultcheck",
++ srcs = ["defaultcheck.go"],
++ importpath = "github.com/gogo/protobuf/plugin/defaultcheck",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//protoc-gen-gogo/generator",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":defaultcheck",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/description/BUILD.bazel b/plugin/description/BUILD.bazel
+--- a/plugin/description/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/description/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "description",
++ srcs = [
++ "description.go",
++ "descriptiontest.go",
++ ],
++ importpath = "github.com/gogo/protobuf/plugin/description",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//plugin/testgen",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//protoc-gen-gogo/generator",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":description",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/embedcheck/BUILD.bazel b/plugin/embedcheck/BUILD.bazel
+--- a/plugin/embedcheck/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/embedcheck/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "embedcheck",
++ srcs = ["embedcheck.go"],
++ importpath = "github.com/gogo/protobuf/plugin/embedcheck",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//protoc-gen-gogo/generator",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":embedcheck",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/enumstringer/BUILD.bazel b/plugin/enumstringer/BUILD.bazel
+--- a/plugin/enumstringer/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/enumstringer/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "enumstringer",
++ srcs = ["enumstringer.go"],
++ importpath = "github.com/gogo/protobuf/plugin/enumstringer",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//protoc-gen-gogo/generator",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":enumstringer",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/equal/BUILD.bazel b/plugin/equal/BUILD.bazel
+--- a/plugin/equal/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/equal/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "equal",
++ srcs = [
++ "equal.go",
++ "equaltest.go",
++ ],
++ importpath = "github.com/gogo/protobuf/plugin/equal",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//plugin/testgen",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//protoc-gen-gogo/generator",
++ "//vanity",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":equal",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/face/BUILD.bazel b/plugin/face/BUILD.bazel
+--- a/plugin/face/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/face/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "face",
++ srcs = [
++ "face.go",
++ "facetest.go",
++ ],
++ importpath = "github.com/gogo/protobuf/plugin/face",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//plugin/testgen",
++ "//protoc-gen-gogo/generator",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":face",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/gostring/BUILD.bazel b/plugin/gostring/BUILD.bazel
+--- a/plugin/gostring/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/gostring/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "gostring",
++ srcs = [
++ "gostring.go",
++ "gostringtest.go",
++ ],
++ importpath = "github.com/gogo/protobuf/plugin/gostring",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//plugin/testgen",
++ "//protoc-gen-gogo/generator",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gostring",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/marshalto/BUILD.bazel b/plugin/marshalto/BUILD.bazel
+--- a/plugin/marshalto/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/marshalto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "marshalto",
++ srcs = ["marshalto.go"],
++ importpath = "github.com/gogo/protobuf/plugin/marshalto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//protoc-gen-gogo/generator",
++ "//vanity",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":marshalto",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/oneofcheck/BUILD.bazel b/plugin/oneofcheck/BUILD.bazel
+--- a/plugin/oneofcheck/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/oneofcheck/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "oneofcheck",
++ srcs = ["oneofcheck.go"],
++ importpath = "github.com/gogo/protobuf/plugin/oneofcheck",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//protoc-gen-gogo/generator",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":oneofcheck",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/populate/BUILD.bazel b/plugin/populate/BUILD.bazel
+--- a/plugin/populate/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/populate/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "populate",
++ srcs = ["populate.go"],
++ importpath = "github.com/gogo/protobuf/plugin/populate",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//protoc-gen-gogo/generator",
++ "//vanity",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":populate",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/size/BUILD.bazel b/plugin/size/BUILD.bazel
+--- a/plugin/size/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/size/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "size",
++ srcs = [
++ "size.go",
++ "sizetest.go",
++ ],
++ importpath = "github.com/gogo/protobuf/plugin/size",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//plugin/testgen",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//protoc-gen-gogo/generator",
++ "//vanity",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":size",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/stringer/BUILD.bazel b/plugin/stringer/BUILD.bazel
+--- a/plugin/stringer/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/stringer/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "stringer",
++ srcs = [
++ "stringer.go",
++ "stringertest.go",
++ ],
++ importpath = "github.com/gogo/protobuf/plugin/stringer",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//plugin/testgen",
++ "//protoc-gen-gogo/generator",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":stringer",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/testgen/BUILD.bazel b/plugin/testgen/BUILD.bazel
+--- a/plugin/testgen/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/testgen/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "testgen",
++ srcs = ["testgen.go"],
++ importpath = "github.com/gogo/protobuf/plugin/testgen",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//protoc-gen-gogo/generator",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":testgen",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/union/BUILD.bazel b/plugin/union/BUILD.bazel
+--- a/plugin/union/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/union/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "union",
++ srcs = [
++ "union.go",
++ "uniontest.go",
++ ],
++ importpath = "github.com/gogo/protobuf/plugin/union",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//plugin/testgen",
++ "//protoc-gen-gogo/generator",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":union",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/plugin/unmarshal/BUILD.bazel b/plugin/unmarshal/BUILD.bazel
+--- a/plugin/unmarshal/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plugin/unmarshal/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "unmarshal",
++ srcs = ["unmarshal.go"],
++ importpath = "github.com/gogo/protobuf/plugin/unmarshal",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//protoc-gen-gogo/generator",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unmarshal",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/proto/BUILD.bazel b/proto/BUILD.bazel
+--- a/proto/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/proto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,78 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "proto",
++ srcs = [
++ "clone.go",
++ "custom_gogo.go",
++ "decode.go",
++ "deprecated.go",
++ "discard.go",
++ "duration.go",
++ "duration_gogo.go",
++ "encode.go",
++ "encode_gogo.go",
++ "equal.go",
++ "extensions.go",
++ "extensions_gogo.go",
++ "lib.go",
++ "lib_gogo.go",
++ "message_set.go",
++ "pointer_reflect.go",
++ "pointer_reflect_gogo.go",
++ "pointer_unsafe.go",
++ "pointer_unsafe_gogo.go",
++ "properties.go",
++ "properties_gogo.go",
++ "skip_gogo.go",
++ "table_marshal.go",
++ "table_marshal_gogo.go",
++ "table_merge.go",
++ "table_unmarshal.go",
++ "table_unmarshal_gogo.go",
++ "text.go",
++ "text_gogo.go",
++ "text_parser.go",
++ "timestamp.go",
++ "timestamp_gogo.go",
++ "wrappers.go",
++ "wrappers_gogo.go",
++ ],
++ importpath = "github.com/gogo/protobuf/proto",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "proto_test",
++ srcs = [
++ "all_test.go",
++ "any_test.go",
++ "clone_test.go",
++ "decode_test.go",
++ "discard_test.go",
++ "encode_test.go",
++ "equal_test.go",
++ "extensions_test.go",
++ "map_test.go",
++ "message_set_test.go",
++ "proto3_test.go",
++ "size2_test.go",
++ "size_test.go",
++ "text_parser_test.go",
++ "text_test.go",
++ ],
++ embed = [":proto"],
++ deps = [
++ "//jsonpb",
++ "//proto/proto3_proto",
++ "//proto/test_proto",
++ "//protoc-gen-gogo/descriptor",
++ "//types",
++ ],
++)
+diff -urN a/proto/proto3_proto/BUILD.bazel b/proto/proto3_proto/BUILD.bazel
+--- a/proto/proto3_proto/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/proto/proto3_proto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["proto3.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "proto3_proto",
++ srcs = ["proto3.pb.go"],
++ importpath = "github.com/gogo/protobuf/proto/proto3_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//proto/test_proto",
++ "//types",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto3_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/proto/test_proto/BUILD.bazel b/proto/test_proto/BUILD.bazel
+--- a/proto/test_proto/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/proto/test_proto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["test.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "test_proto",
++ srcs = ["test.pb.go"],
++ importpath = "github.com/gogo/protobuf/proto/test_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":test_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protobuf/google/protobuf/BUILD.bazel b/protobuf/google/protobuf/BUILD.bazel
+--- a/protobuf/google/protobuf/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protobuf/google/protobuf/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "any.proto",
++ "api.proto",
++ "descriptor.proto",
++ "duration.proto",
++ "empty.proto",
++ "field_mask.proto",
++ "source_context.proto",
++ "struct.proto",
++ "timestamp.proto",
++ "type.proto",
++ "wrappers.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protobuf/google/protobuf/compiler/BUILD.bazel b/protobuf/google/protobuf/compiler/BUILD.bazel
+--- a/protobuf/google/protobuf/compiler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protobuf/google/protobuf/compiler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,5 @@
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["plugin.proto"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-combo/BUILD.bazel b/protoc-gen-combo/BUILD.bazel
+--- a/protoc-gen-combo/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-combo/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "protoc-gen-combo_lib",
++ srcs = ["combo.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-combo",
++ visibility = ["//visibility:private"],
++ deps = ["//version"],
++)
++
++go_binary(
++ name = "protoc-gen-combo",
++ embed = [":protoc-gen-combo_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gofast/BUILD.bazel b/protoc-gen-gofast/BUILD.bazel
+--- a/protoc-gen-gofast/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gofast/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "protoc-gen-gofast_lib",
++ srcs = ["main.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gofast",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//vanity",
++ "//vanity/command",
++ ],
++)
++
++go_binary(
++ name = "protoc-gen-gofast",
++ embed = [":protoc-gen-gofast_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/BUILD.bazel b/protoc-gen-gogo/BUILD.bazel
+--- a/protoc-gen-gogo/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "protoc-gen-gogo_lib",
++ srcs = ["main.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo",
++ visibility = ["//visibility:private"],
++ deps = ["//vanity/command"],
++)
++
++go_binary(
++ name = "protoc-gen-gogo",
++ embed = [":protoc-gen-gogo_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "protoc-gen-gogo_test",
++ srcs = ["golden_test.go"],
++ embed = [":protoc-gen-gogo_lib"],
++)
+diff -urN a/protoc-gen-gogo/descriptor/BUILD.bazel b/protoc-gen-gogo/descriptor/BUILD.bazel
+--- a/protoc-gen-gogo/descriptor/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/descriptor/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "descriptor",
++ srcs = [
++ "descriptor.go",
++ "descriptor.pb.go",
++ "descriptor_gostring.gen.go",
++ "helper.go",
++ ],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/descriptor",
++ visibility = ["//visibility:public"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":descriptor",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "descriptor_test",
++ srcs = ["descriptor_test.go"],
++ deps = [
++ ":descriptor",
++ "//proto/test_proto",
++ ],
++)
+diff -urN a/protoc-gen-gogo/generator/BUILD.bazel b/protoc-gen-gogo/generator/BUILD.bazel
+--- a/protoc-gen-gogo/generator/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/generator/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "generator",
++ srcs = [
++ "generator.go",
++ "helper.go",
++ ],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/generator",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//protoc-gen-gogo/generator/internal/remap",
++ "//protoc-gen-gogo/plugin",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":generator",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "generator_test",
++ srcs = ["name_test.go"],
++ embed = [":generator"],
++ deps = ["//protoc-gen-gogo/descriptor"],
++)
+diff -urN a/protoc-gen-gogo/generator/internal/remap/BUILD.bazel b/protoc-gen-gogo/generator/internal/remap/BUILD.bazel
+--- a/protoc-gen-gogo/generator/internal/remap/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/generator/internal/remap/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "remap",
++ srcs = ["remap.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/generator/internal/remap",
++ visibility = ["//protoc-gen-gogo/generator:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":remap",
++ visibility = ["//protoc-gen-gogo/generator:__subpackages__"],
++)
++
++go_test(
++ name = "remap_test",
++ srcs = ["remap_test.go"],
++ embed = [":remap"],
++)
+diff -urN a/protoc-gen-gogo/grpc/BUILD.bazel b/protoc-gen-gogo/grpc/BUILD.bazel
+--- a/protoc-gen-gogo/grpc/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/grpc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "grpc",
++ srcs = ["grpc.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/grpc",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//protoc-gen-gogo/descriptor",
++ "//protoc-gen-gogo/generator",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":grpc",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/plugin/BUILD.bazel b/protoc-gen-gogo/plugin/BUILD.bazel
+--- a/protoc-gen-gogo/plugin/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/plugin/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "plugin",
++ srcs = ["plugin.pb.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/plugin",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":plugin",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/BUILD.bazel b/protoc-gen-gogo/testdata/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,16 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_test")
++
++go_test(
++ name = "testdata_test",
++ srcs = [
++ "extension_test.go",
++ "main_test.go",
++ ],
++ deps = [
++ "//proto",
++ "//protoc-gen-gogo/testdata/extension_base",
++ "//protoc-gen-gogo/testdata/extension_user",
++ "//protoc-gen-gogo/testdata/imports",
++ "//protoc-gen-gogo/testdata/my_test",
++ ],
++)
+diff -urN a/protoc-gen-gogo/testdata/deprecated/BUILD.bazel b/protoc-gen-gogo/testdata/deprecated/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/deprecated/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/deprecated/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["deprecated.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "deprecated",
++ srcs = ["deprecated.pb.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/testdata/deprecated",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "@org_golang_google_grpc//:go_default_library",
++ "@org_golang_google_grpc//codes:go_default_library",
++ "@org_golang_google_grpc//status:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":deprecated",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/extension_base/BUILD.bazel b/protoc-gen-gogo/testdata/extension_base/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/extension_base/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/extension_base/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["extension_base.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "extension_base",
++ srcs = ["extension_base.pb.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/testdata/extension_base",
++ visibility = ["//visibility:public"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":extension_base",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/extension_extra/BUILD.bazel b/protoc-gen-gogo/testdata/extension_extra/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/extension_extra/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/extension_extra/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["extension_extra.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "extension_extra",
++ srcs = ["extension_extra.pb.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/testdata/extension_extra",
++ visibility = ["//visibility:public"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":extension_extra",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/extension_user/BUILD.bazel b/protoc-gen-gogo/testdata/extension_user/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/extension_user/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/extension_user/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["extension_user.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "extension_user",
++ srcs = ["extension_user.pb.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/testdata/extension_user",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//protoc-gen-gogo/testdata/extension_base",
++ "//protoc-gen-gogo/testdata/extension_extra",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":extension_user",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/grpc/BUILD.bazel b/protoc-gen-gogo/testdata/grpc/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/grpc/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/grpc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "grpc.proto",
++ "grpc_empty.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "grpc",
++ srcs = [
++ "grpc.pb.go",
++ "grpc_empty.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/testdata/grpc",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "@org_golang_google_grpc//:go_default_library",
++ "@org_golang_google_grpc//codes:go_default_library",
++ "@org_golang_google_grpc//status:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":grpc",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/import_public/BUILD.bazel b/protoc-gen-gogo/testdata/import_public/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/import_public/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/import_public/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "a.proto",
++ "b.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "import_public",
++ srcs = [
++ "a.pb.go",
++ "b.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/testdata/import_public",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//protoc-gen-gogo/testdata/import_public/sub",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":import_public",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/import_public/importing/BUILD.bazel b/protoc-gen-gogo/testdata/import_public/importing/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/import_public/importing/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/import_public/importing/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["importing.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "importing",
++ srcs = ["importing.pb.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/testdata/import_public/importing",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//protoc-gen-gogo/testdata/import_public",
++ "//protoc-gen-gogo/testdata/import_public/sub",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":importing",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/import_public/sub/BUILD.bazel b/protoc-gen-gogo/testdata/import_public/sub/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/import_public/sub/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/import_public/sub/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "a.proto",
++ "b.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "sub",
++ srcs = [
++ "a.pb.go",
++ "b.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/testdata/import_public/sub",
++ visibility = ["//visibility:public"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sub",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/imports/BUILD.bazel b/protoc-gen-gogo/testdata/imports/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/imports/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/imports/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "test_import_a1m1.proto",
++ "test_import_a1m2.proto",
++ "test_import_all.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "imports",
++ srcs = [
++ "test_import_a1m1.pb.go",
++ "test_import_a1m2.pb.go",
++ "test_import_all.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/testdata/imports",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//protoc-gen-gogo/testdata/imports/fmt",
++ "//protoc-gen-gogo/testdata/imports/test_a_1",
++ "//protoc-gen-gogo/testdata/imports/test_a_2",
++ "//protoc-gen-gogo/testdata/imports/test_b_1",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":imports",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/imports/fmt/BUILD.bazel b/protoc-gen-gogo/testdata/imports/fmt/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/imports/fmt/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/imports/fmt/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["m.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "fmt",
++ srcs = ["m.pb.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/testdata/imports/fmt",
++ visibility = ["//visibility:public"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fmt",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/imports/test_a_1/BUILD.bazel b/protoc-gen-gogo/testdata/imports/test_a_1/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/imports/test_a_1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/imports/test_a_1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "m1.proto",
++ "m2.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "test_a_1",
++ srcs = [
++ "m1.pb.go",
++ "m2.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/testdata/imports/test_a_1",
++ visibility = ["//visibility:public"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":test_a_1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/imports/test_a_2/BUILD.bazel b/protoc-gen-gogo/testdata/imports/test_a_2/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/imports/test_a_2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/imports/test_a_2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "m3.proto",
++ "m4.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "test_a_2",
++ srcs = [
++ "m3.pb.go",
++ "m4.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/testdata/imports/test_a_2",
++ visibility = ["//visibility:public"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":test_a_2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/imports/test_b_1/BUILD.bazel b/protoc-gen-gogo/testdata/imports/test_b_1/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/imports/test_b_1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/imports/test_b_1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "m1.proto",
++ "m2.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "test_b_1",
++ srcs = [
++ "m1.pb.go",
++ "m2.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/testdata/imports/test_b_1",
++ visibility = ["//visibility:public"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":test_b_1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/multi/BUILD.bazel b/protoc-gen-gogo/testdata/multi/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/multi/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/multi/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,9 @@
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "multi1.proto",
++ "multi2.proto",
++ "multi3.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/my_test/BUILD.bazel b/protoc-gen-gogo/testdata/my_test/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/my_test/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/my_test/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["test.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "my_test",
++ srcs = ["test.pb.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/testdata/my_test",
++ visibility = ["//visibility:public"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":my_test",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogo/testdata/proto3/BUILD.bazel b/protoc-gen-gogo/testdata/proto3/BUILD.bazel
+--- a/protoc-gen-gogo/testdata/proto3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogo/testdata/proto3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["proto3.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "proto3",
++ srcs = ["proto3.pb.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogo/testdata/proto3",
++ visibility = ["//visibility:public"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto3",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogofast/BUILD.bazel b/protoc-gen-gogofast/BUILD.bazel
+--- a/protoc-gen-gogofast/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogofast/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "protoc-gen-gogofast_lib",
++ srcs = ["main.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogofast",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//vanity",
++ "//vanity/command",
++ ],
++)
++
++go_binary(
++ name = "protoc-gen-gogofast",
++ embed = [":protoc-gen-gogofast_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogofaster/BUILD.bazel b/protoc-gen-gogofaster/BUILD.bazel
+--- a/protoc-gen-gogofaster/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogofaster/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "protoc-gen-gogofaster_lib",
++ srcs = ["main.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogofaster",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//vanity",
++ "//vanity/command",
++ ],
++)
++
++go_binary(
++ name = "protoc-gen-gogofaster",
++ embed = [":protoc-gen-gogofaster_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogoslick/BUILD.bazel b/protoc-gen-gogoslick/BUILD.bazel
+--- a/protoc-gen-gogoslick/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogoslick/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "protoc-gen-gogoslick_lib",
++ srcs = ["main.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogoslick",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//vanity",
++ "//vanity/command",
++ ],
++)
++
++go_binary(
++ name = "protoc-gen-gogoslick",
++ embed = [":protoc-gen-gogoslick_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gogotypes/BUILD.bazel b/protoc-gen-gogotypes/BUILD.bazel
+--- a/protoc-gen-gogotypes/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gogotypes/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "protoc-gen-gogotypes_lib",
++ srcs = ["main.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gogotypes",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//vanity",
++ "//vanity/command",
++ ],
++)
++
++go_binary(
++ name = "protoc-gen-gogotypes",
++ embed = [":protoc-gen-gogotypes_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-gostring/BUILD.bazel b/protoc-gen-gostring/BUILD.bazel
+--- a/protoc-gen-gostring/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-gostring/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "protoc-gen-gostring_lib",
++ srcs = ["main.go"],
++ importpath = "github.com/gogo/protobuf/protoc-gen-gostring",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//plugin/gostring",
++ "//vanity/command",
++ ],
++)
++
++go_binary(
++ name = "protoc-gen-gostring",
++ embed = [":protoc-gen-gostring_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-min-version/BUILD.bazel b/protoc-min-version/BUILD.bazel
+--- a/protoc-min-version/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-min-version/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "protoc-min-version_lib",
++ srcs = ["minversion.go"],
++ importpath = "github.com/gogo/protobuf/protoc-min-version",
++ visibility = ["//visibility:private"],
++ deps = ["//version"],
++)
++
++go_binary(
++ name = "protoc-min-version",
++ embed = [":protoc-min-version_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/sortkeys/BUILD.bazel b/sortkeys/BUILD.bazel
+--- a/sortkeys/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/sortkeys/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "sortkeys",
++ srcs = ["sortkeys.go"],
++ importpath = "github.com/gogo/protobuf/sortkeys",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sortkeys",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/asymetric-issue125/BUILD.bazel b/test/asymetric-issue125/BUILD.bazel
+--- a/test/asymetric-issue125/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/asymetric-issue125/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["asym.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "asymetric-issue125",
++ srcs = [
++ "asym.pb.go",
++ "pop.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/asymetric-issue125",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":asymetric-issue125",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "asymetric-issue125_test",
++ srcs = ["asym_test.go"],
++ embed = [":asymetric-issue125"],
++)
+diff -urN a/test/BUILD.bazel b/test/BUILD.bazel
+--- a/test/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,48 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["thetest.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "test",
++ srcs = [
++ "t.go",
++ "thetest.pb.go",
++ "uuid.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test/custom",
++ "//test/custom-dash-type",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":test",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "test_test",
++ srcs = [
++ "bug_test.go",
++ "extension_test.go",
++ "thetestpb_test.go",
++ "uuid_test.go",
++ ],
++ embed = [":test"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/cachedsize/BUILD.bazel b/test/cachedsize/BUILD.bazel
+--- a/test/cachedsize/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/cachedsize/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["cachedsize.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "cachedsize",
++ srcs = ["cachedsize.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/cachedsize",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":cachedsize",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "cachedsize_test",
++ srcs = ["cachedsize_test.go"],
++ embed = [":cachedsize"],
++ deps = ["//proto"],
++)
+diff -urN a/test/casttype/BUILD.bazel b/test/casttype/BUILD.bazel
+--- a/test/casttype/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/casttype/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["casttype.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "casttype",
++ srcs = ["mytypes.go"],
++ importpath = "github.com/gogo/protobuf/test/casttype",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":casttype",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/casttype/combos/both/BUILD.bazel b/test/casttype/combos/both/BUILD.bazel
+--- a/test/casttype/combos/both/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/casttype/combos/both/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["casttype.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "both",
++ srcs = ["casttype.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/casttype/combos/both",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test/casttype",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":both",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "both_test",
++ srcs = ["casttypepb_test.go"],
++ embed = [":both"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/casttype/combos/marshaler/BUILD.bazel b/test/casttype/combos/marshaler/BUILD.bazel
+--- a/test/casttype/combos/marshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/casttype/combos/marshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["casttype.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "marshaler",
++ srcs = ["casttype.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/casttype/combos/marshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test/casttype",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":marshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "marshaler_test",
++ srcs = ["casttypepb_test.go"],
++ embed = [":marshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/casttype/combos/neither/BUILD.bazel b/test/casttype/combos/neither/BUILD.bazel
+--- a/test/casttype/combos/neither/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/casttype/combos/neither/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["casttype.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "neither",
++ srcs = ["casttype.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/casttype/combos/neither",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test/casttype",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":neither",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "neither_test",
++ srcs = ["casttypepb_test.go"],
++ embed = [":neither"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/casttype/combos/unmarshaler/BUILD.bazel b/test/casttype/combos/unmarshaler/BUILD.bazel
+--- a/test/casttype/combos/unmarshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/casttype/combos/unmarshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["casttype.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "unmarshaler",
++ srcs = ["casttype.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/casttype/combos/unmarshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test/casttype",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unmarshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unmarshaler_test",
++ srcs = ["casttypepb_test.go"],
++ embed = [":unmarshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/castvalue/BUILD.bazel b/test/castvalue/BUILD.bazel
+--- a/test/castvalue/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/castvalue/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["castvalue.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "castvalue",
++ srcs = [
++ "castvalue.pb.go",
++ "mytypes.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/castvalue",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":castvalue",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "castvalue_test",
++ srcs = ["castvaluepb_test.go"],
++ embed = [":castvalue"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/castvalue/combos/both/BUILD.bazel b/test/castvalue/combos/both/BUILD.bazel
+--- a/test/castvalue/combos/both/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/castvalue/combos/both/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["castvalue.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "both",
++ srcs = [
++ "castvalue.pb.go",
++ "mytypes.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/castvalue/combos/both",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":both",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "both_test",
++ srcs = ["castvaluepb_test.go"],
++ embed = [":both"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/castvalue/combos/marshaler/BUILD.bazel b/test/castvalue/combos/marshaler/BUILD.bazel
+--- a/test/castvalue/combos/marshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/castvalue/combos/marshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["castvalue.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "marshaler",
++ srcs = [
++ "castvalue.pb.go",
++ "mytypes.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/castvalue/combos/marshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":marshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "marshaler_test",
++ srcs = ["castvaluepb_test.go"],
++ embed = [":marshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/castvalue/combos/unmarshaler/BUILD.bazel b/test/castvalue/combos/unmarshaler/BUILD.bazel
+--- a/test/castvalue/combos/unmarshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/castvalue/combos/unmarshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["castvalue.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "unmarshaler",
++ srcs = [
++ "castvalue.pb.go",
++ "mytypes.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/castvalue/combos/unmarshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unmarshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unmarshaler_test",
++ srcs = ["castvaluepb_test.go"],
++ embed = [":unmarshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/combos/both/BUILD.bazel b/test/combos/both/BUILD.bazel
+--- a/test/combos/both/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/combos/both/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,46 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["thetest.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "both",
++ srcs = [
++ "t.go",
++ "thetest.pb.go",
++ "uuid.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/combos/both",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test/custom",
++ "//test/custom-dash-type",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":both",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "both_test",
++ srcs = [
++ "bug_test.go",
++ "thetestpb_test.go",
++ ],
++ embed = [":both"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/combos/marshaler/BUILD.bazel b/test/combos/marshaler/BUILD.bazel
+--- a/test/combos/marshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/combos/marshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,46 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["thetest.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "marshaler",
++ srcs = [
++ "t.go",
++ "thetest.pb.go",
++ "uuid.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/combos/marshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test/custom",
++ "//test/custom-dash-type",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":marshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "marshaler_test",
++ srcs = [
++ "bug_test.go",
++ "thetestpb_test.go",
++ ],
++ embed = [":marshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/combos/unmarshaler/BUILD.bazel b/test/combos/unmarshaler/BUILD.bazel
+--- a/test/combos/unmarshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/combos/unmarshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,46 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["thetest.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "unmarshaler",
++ srcs = [
++ "t.go",
++ "thetest.pb.go",
++ "uuid.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/combos/unmarshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test/custom",
++ "//test/custom-dash-type",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unmarshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unmarshaler_test",
++ srcs = [
++ "bug_test.go",
++ "thetestpb_test.go",
++ ],
++ embed = [":unmarshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/custom/BUILD.bazel b/test/custom/BUILD.bazel
+--- a/test/custom/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/custom/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "custom",
++ srcs = ["custom.go"],
++ importpath = "github.com/gogo/protobuf/test/custom",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":custom",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "custom_test",
++ srcs = ["custom_test.go"],
++ embed = [":custom"],
++)
+diff -urN a/test/custombytesnonstruct/BUILD.bazel b/test/custombytesnonstruct/BUILD.bazel
+--- a/test/custombytesnonstruct/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/custombytesnonstruct/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["proto.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "custombytesnonstruct",
++ srcs = [
++ "customtype.go",
++ "proto.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/custombytesnonstruct",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":custombytesnonstruct",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "custombytesnonstruct_test",
++ srcs = ["custombytesnonstruct_test.go"],
++ embed = [":custombytesnonstruct"],
++)
+diff -urN a/test/custom-dash-type/BUILD.bazel b/test/custom-dash-type/BUILD.bazel
+--- a/test/custom-dash-type/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/custom-dash-type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "custom-dash-type",
++ srcs = ["customdash.go"],
++ importpath = "github.com/gogo/protobuf/test/custom-dash-type",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":custom-dash-type",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/dashfilename/BUILD.bazel b/test/dashfilename/BUILD.bazel
+--- a/test/dashfilename/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/dashfilename/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["dash-filename.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "dashfilename",
++ srcs = ["doc.go"],
++ importpath = "github.com/gogo/protobuf/test/dashfilename",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":dashfilename",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "dashfilename_test",
++ srcs = ["df_test.go"],
++ embed = [":dashfilename"],
++)
+diff -urN a/test/data/BUILD.bazel b/test/data/BUILD.bazel
+--- a/test/data/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/data/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["data.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "data",
++ srcs = ["data.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/data",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":data",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "data_test",
++ srcs = ["datapb_test.go"],
++ embed = [":data"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/defaultconflict/BUILD.bazel b/test/defaultconflict/BUILD.bazel
+--- a/test/defaultconflict/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/defaultconflict/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "df.proto",
++ "dg.proto",
++ "nc.proto",
++ "ne.proto",
++ "nx.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "defaultconflict",
++ srcs = ["doc.go"],
++ importpath = "github.com/gogo/protobuf/test/defaultconflict",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":defaultconflict",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "defaultconflict_test",
++ srcs = ["nc_test.go"],
++ embed = [":defaultconflict"],
++)
+diff -urN a/test/deterministic/BUILD.bazel b/test/deterministic/BUILD.bazel
+--- a/test/deterministic/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/deterministic/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["deterministic.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "deterministic",
++ srcs = ["deterministic.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/deterministic",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//sortkeys",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":deterministic",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "deterministic_test",
++ srcs = ["deterministic_test.go"],
++ embed = [":deterministic"],
++ deps = ["//proto"],
++)
+diff -urN a/test/embedconflict/BUILD.bazel b/test/embedconflict/BUILD.bazel
+--- a/test/embedconflict/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/embedconflict/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "eb.proto",
++ "ec.proto",
++ "ee.proto",
++ "em.proto",
++ "en.proto",
++ "er.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "embedconflict",
++ srcs = ["doc.go"],
++ importpath = "github.com/gogo/protobuf/test/embedconflict",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":embedconflict",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "embedconflict_test",
++ srcs = ["ec_test.go"],
++ embed = [":embedconflict"],
++)
+diff -urN a/test/empty-issue70/BUILD.bazel b/test/empty-issue70/BUILD.bazel
+--- a/test/empty-issue70/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/empty-issue70/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["empty.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "empty-issue70",
++ srcs = ["empty.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/empty-issue70",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":empty-issue70",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "empty-issue70_test",
++ srcs = ["empty_test.go"],
++ embed = [":empty-issue70"],
++)
+diff -urN a/test/enumcustomname/BUILD.bazel b/test/enumcustomname/BUILD.bazel
+--- a/test/enumcustomname/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/enumcustomname/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["enumcustomname.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "enumcustomname",
++ srcs = ["enumcustomname.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/enumcustomname",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//test",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":enumcustomname",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/enumdecl/BUILD.bazel b/test/enumdecl/BUILD.bazel
+--- a/test/enumdecl/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/enumdecl/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["enumdecl.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "enumdecl",
++ srcs = [
++ "enumdecl.pb.go",
++ "models.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/enumdecl",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":enumdecl",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "enumdecl_test",
++ srcs = ["enumdeclpb_test.go"],
++ embed = [":enumdecl"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/enumdecl_all/BUILD.bazel b/test/enumdecl_all/BUILD.bazel
+--- a/test/enumdecl_all/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/enumdecl_all/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["enumdeclall.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "enumdecl_all",
++ srcs = [
++ "enumdeclall.pb.go",
++ "models.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/enumdecl_all",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":enumdecl_all",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "enumdecl_all_test",
++ srcs = ["enumdeclallpb_test.go"],
++ embed = [":enumdecl_all"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/enumprefix/BUILD.bazel b/test/enumprefix/BUILD.bazel
+--- a/test/enumprefix/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/enumprefix/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["enumprefix.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "enumprefix",
++ srcs = ["enumprefix.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/enumprefix",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//test",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":enumprefix",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/enumstringer/BUILD.bazel b/test/enumstringer/BUILD.bazel
+--- a/test/enumstringer/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/enumstringer/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["enumstringer.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "enumstringer",
++ srcs = [
++ "enumstringer.pb.go",
++ "string.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/enumstringer",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":enumstringer",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "enumstringer_test",
++ srcs = ["enumstringerpb_test.go"],
++ embed = [":enumstringer"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/example/BUILD.bazel b/test/example/BUILD.bazel
+--- a/test/example/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/example/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,41 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["example.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "example",
++ srcs = ["example.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/example",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//test",
++ "//test/custom",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":example",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "example_test",
++ srcs = [
++ "example_test.go",
++ "examplepb_test.go",
++ ],
++ embed = [":example"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/filedotname/BUILD.bazel b/test/filedotname/BUILD.bazel
+--- a/test/filedotname/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/filedotname/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["file.dot.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "filedotname",
++ srcs = ["file.dot.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/filedotname",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":filedotname",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "filedotname_test",
++ srcs = ["file.dotpb_test.go"],
++ embed = [":filedotname"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/fuzztests/BUILD.bazel b/test/fuzztests/BUILD.bazel
+--- a/test/fuzztests/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/fuzztests/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["fuzz.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "fuzztests",
++ srcs = ["fuzz.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/fuzztests",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fuzztests",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "fuzztests_test",
++ srcs = ["fuzz_test.go"],
++ embed = [":fuzztests"],
++ deps = ["//proto"],
++)
+diff -urN a/test/group/BUILD.bazel b/test/group/BUILD.bazel
+--- a/test/group/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/group/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["group.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "group",
++ srcs = ["group.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/group",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":group",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "group_test",
++ srcs = ["grouppb_test.go"],
++ embed = [":group"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/importcustom-issue389/imported/BUILD.bazel b/test/importcustom-issue389/imported/BUILD.bazel
+--- a/test/importcustom-issue389/imported/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/importcustom-issue389/imported/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["a.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "imported",
++ srcs = [
++ "a.pb.go",
++ "b.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/importcustom-issue389/imported",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":imported",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "imported_test",
++ srcs = ["apb_test.go"],
++ embed = [":imported"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/importcustom-issue389/importing/BUILD.bazel b/test/importcustom-issue389/importing/BUILD.bazel
+--- a/test/importcustom-issue389/importing/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/importcustom-issue389/importing/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["c.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "importing",
++ srcs = ["c.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/importcustom-issue389/importing",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//test/importcustom-issue389/imported",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":importing",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "importing_test",
++ srcs = ["cpb_test.go"],
++ embed = [":importing"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//test/importcustom-issue389/imported",
++ ],
++)
+diff -urN a/test/importdedup/BUILD.bazel b/test/importdedup/BUILD.bazel
+--- a/test/importdedup/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/importdedup/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["proto.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "importdedup",
++ srcs = ["proto.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/importdedup",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//test/importdedup/subpkg",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":importdedup",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "importdedup_test",
++ srcs = ["importdedup_test.go"],
++ embed = [":importdedup"],
++)
+diff -urN a/test/importdedup/subpkg/BUILD.bazel b/test/importdedup/subpkg/BUILD.bazel
+--- a/test/importdedup/subpkg/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/importdedup/subpkg/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["subproto.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "subpkg",
++ srcs = [
++ "customtype.go",
++ "subproto.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/importdedup/subpkg",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":subpkg",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/importduplicate/BUILD.bazel b/test/importduplicate/BUILD.bazel
+--- a/test/importduplicate/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/importduplicate/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,43 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["importduplicate.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "importduplicate",
++ srcs = ["importduplicate.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/importduplicate",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//sortkeys",
++ "//test/importduplicate/proto",
++ "//test/importduplicate/sortkeys",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":importduplicate",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "importduplicate_test",
++ srcs = [
++ "importduplicate_test.go",
++ "importduplicatepb_test.go",
++ ],
++ embed = [":importduplicate"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//test/importduplicate/proto",
++ "//test/importduplicate/sortkeys",
++ ],
++)
+diff -urN a/test/importduplicate/proto/BUILD.bazel b/test/importduplicate/proto/BUILD.bazel
+--- a/test/importduplicate/proto/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/importduplicate/proto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["proto.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "proto",
++ srcs = ["proto.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/importduplicate/proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "proto_test",
++ srcs = ["protopb_test.go"],
++ embed = [":proto"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/importduplicate/sortkeys/BUILD.bazel b/test/importduplicate/sortkeys/BUILD.bazel
+--- a/test/importduplicate/sortkeys/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/importduplicate/sortkeys/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["sortable.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "sortkeys",
++ srcs = ["sortable.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/importduplicate/sortkeys",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sortkeys",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "sortkeys_test",
++ srcs = ["sortablepb_test.go"],
++ embed = [":sortkeys"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/indeximport-issue72/BUILD.bazel b/test/indeximport-issue72/BUILD.bazel
+--- a/test/indeximport-issue72/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/indeximport-issue72/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["indeximport.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "indeximport-issue72",
++ srcs = ["indeximport.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/indeximport-issue72",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//test/indeximport-issue72/index",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":indeximport-issue72",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "indeximport-issue72_test",
++ srcs = ["indeximportpb_test.go"],
++ embed = [":indeximport-issue72"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//test/indeximport-issue72/index",
++ ],
++)
+diff -urN a/test/indeximport-issue72/index/BUILD.bazel b/test/indeximport-issue72/index/BUILD.bazel
+--- a/test/indeximport-issue72/index/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/indeximport-issue72/index/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["index.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "index",
++ srcs = ["index.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/indeximport-issue72/index",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":index",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "index_test",
++ srcs = ["indexpb_test.go"],
++ embed = [":index"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/int64support/BUILD.bazel b/test/int64support/BUILD.bazel
+--- a/test/int64support/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/int64support/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,41 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["object.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "int64support",
++ srcs = [
++ "object.pb.go",
++ "object_js.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/int64support",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":int64support",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "int64support_test",
++ srcs = [
++ "object_js_test.go",
++ "objectpb_test.go",
++ ],
++ embed = [":int64support"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/issue260/BUILD.bazel b/test/issue260/BUILD.bazel
+--- a/test/issue260/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue260/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,41 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue260.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue260",
++ srcs = [
++ "issue260.pb.go",
++ "models.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/issue260",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//types",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue260",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue260_test",
++ srcs = ["issue260pb_test.go"],
++ embed = [":issue260"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//types",
++ ],
++)
+diff -urN a/test/issue261/BUILD.bazel b/test/issue261/BUILD.bazel
+--- a/test/issue261/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue261/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue261.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue261",
++ srcs = ["issue261.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue261",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//sortkeys",
++ "//types",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue261",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/issue262/BUILD.bazel b/test/issue262/BUILD.bazel
+--- a/test/issue262/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue262/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["timefail.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue262",
++ srcs = ["timefail.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue262",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//types",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue262",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/issue270/a/BUILD.bazel b/test/issue270/a/BUILD.bazel
+--- a/test/issue270/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue270/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,8 @@
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "a1.proto",
++ "a2.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/issue270/b/BUILD.bazel b/test/issue270/b/BUILD.bazel
+--- a/test/issue270/b/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue270/b/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,5 @@
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["b.proto"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/issue270/BUILD.bazel b/test/issue270/BUILD.bazel
+--- a/test/issue270/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue270/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "issue270",
++ srcs = ["doc.go"],
++ importpath = "github.com/gogo/protobuf/test/issue270",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue270",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue270_test",
++ srcs = ["issue270_test.go"],
++ embed = [":issue270"],
++)
+diff -urN a/test/issue312/BUILD.bazel b/test/issue312/BUILD.bazel
+--- a/test/issue312/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue312/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue312.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue312",
++ srcs = ["issue312.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue312",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue312",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/issue312/events/BUILD.bazel b/test/issue312/events/BUILD.bazel
+--- a/test/issue312/events/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue312/events/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["events.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "events",
++ srcs = ["events.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue312/events",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//test/issue312",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":events",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "events_test",
++ srcs = ["eventspb_test.go"],
++ embed = [":events"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//test/issue312",
++ ],
++)
+diff -urN a/test/issue322/BUILD.bazel b/test/issue322/BUILD.bazel
+--- a/test/issue322/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue322/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue322.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue322",
++ srcs = ["issue322.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue322",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue322",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue322_test",
++ srcs = ["issue322pb_test.go"],
++ embed = [":issue322"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/issue330/BUILD.bazel b/test/issue330/BUILD.bazel
+--- a/test/issue330/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue330/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue330.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue330",
++ srcs = [
++ "issue330.pb.go",
++ "type.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/issue330",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue330",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue330_test",
++ srcs = ["issue330pb_test.go"],
++ embed = [":issue330"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/issue34/BUILD.bazel b/test/issue34/BUILD.bazel
+--- a/test/issue34/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue34/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["proto.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue34",
++ srcs = ["proto.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue34",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue34",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue34_test",
++ srcs = ["issue34_test.go"],
++ embed = [":issue34"],
++ deps = ["//proto"],
++)
+diff -urN a/test/issue411/BUILD.bazel b/test/issue411/BUILD.bazel
+--- a/test/issue411/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue411/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue411.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue411",
++ srcs = [
++ "ids.go",
++ "issue411.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/issue411",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue411",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue411_test",
++ srcs = ["ids_test.go"],
++ deps = [
++ ":issue411",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/issue427/BUILD.bazel b/test/issue427/BUILD.bazel
+--- a/test/issue427/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue427/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,5 @@
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue427.proto"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/issue42order/BUILD.bazel b/test/issue42order/BUILD.bazel
+--- a/test/issue42order/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue42order/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue42.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue42order",
++ srcs = ["issue42.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue42order",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue42order",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue42order_test",
++ srcs = ["order_test.go"],
++ embed = [":issue42order"],
++ deps = ["//proto"],
++)
+diff -urN a/test/issue435/BUILD.bazel b/test/issue435/BUILD.bazel
+--- a/test/issue435/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue435/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue435.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue435",
++ srcs = ["issue435.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue435",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue435",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue435_test",
++ srcs = ["issue435pb_test.go"],
++ embed = [":issue435"],
++ deps = ["//proto"],
++)
+diff -urN a/test/issue438/BUILD.bazel b/test/issue438/BUILD.bazel
+--- a/test/issue438/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue438/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue438.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue438",
++ srcs = ["issue438.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue438",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//types",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue438",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/issue444/BUILD.bazel b/test/issue444/BUILD.bazel
+--- a/test/issue444/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue444/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue444.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue444",
++ srcs = ["issue444.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue444",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue444",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue444_test",
++ srcs = ["issue444_test.go"],
++ embed = [":issue444"],
++)
+diff -urN a/test/issue449/BUILD.bazel b/test/issue449/BUILD.bazel
+--- a/test/issue449/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue449/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue449.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue449",
++ srcs = ["issue449.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue449",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue449",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue449_test",
++ srcs = ["issue449_test.go"],
++ embed = [":issue449"],
++ deps = ["//proto"],
++)
+diff -urN a/test/issue498/BUILD.bazel b/test/issue498/BUILD.bazel
+--- a/test/issue498/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue498/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue498.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue498",
++ srcs = ["issue498.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue498",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue498",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue498_test",
++ srcs = ["issue498pb_test.go"],
++ embed = [":issue498"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/issue503/BUILD.bazel b/test/issue503/BUILD.bazel
+--- a/test/issue503/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue503/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue503.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue503",
++ srcs = ["issue503.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue503",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue503",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue503_test",
++ srcs = ["issue503_test.go"],
++ embed = [":issue503"],
++ deps = ["//proto"],
++)
+diff -urN a/test/issue530/BUILD.bazel b/test/issue530/BUILD.bazel
+--- a/test/issue530/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue530/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,39 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue530.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue530",
++ srcs = ["issue530.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue530",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//sortkeys",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue530",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue530_test",
++ srcs = [
++ "issue530_test.go",
++ "issue530pb_test.go",
++ ],
++ embed = [":issue530"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/issue617/BUILD.bazel b/test/issue617/BUILD.bazel
+--- a/test/issue617/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue617/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue617.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue617",
++ srcs = ["issue617.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue617",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue617",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/issue620/BUILD.bazel b/test/issue620/BUILD.bazel
+--- a/test/issue620/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue620/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue620.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue620",
++ srcs = ["issue620.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue620",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue620",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue620_test",
++ srcs = ["issue620_test.go"],
++ embed = [":issue620"],
++ deps = ["//proto"],
++)
+diff -urN a/test/issue630/BUILD.bazel b/test/issue630/BUILD.bazel
+--- a/test/issue630/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue630/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["issue630.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue630",
++ srcs = ["issue630.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue630",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue630",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue630_test",
++ srcs = ["issue630_test.go"],
++ embed = [":issue630"],
++)
+diff -urN a/test/issue8/BUILD.bazel b/test/issue8/BUILD.bazel
+--- a/test/issue8/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/issue8/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["proto.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "issue8",
++ srcs = ["proto.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/issue8",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue8",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "issue8_test",
++ srcs = ["protopb_test.go"],
++ embed = [":issue8"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/jsonpb-gogo/BUILD.bazel b/test/jsonpb-gogo/BUILD.bazel
+--- a/test/jsonpb-gogo/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/jsonpb-gogo/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "jsonpb-gogo",
++ srcs = ["jsonpb_gogo.go"],
++ importpath = "github.com/gogo/protobuf/test/jsonpb-gogo",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":jsonpb-gogo",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "jsonpb-gogo_test",
++ srcs = ["jsonpb_gogo_test.go"],
++ embed = [":jsonpb-gogo"],
++ deps = ["//jsonpb"],
++)
+diff -urN a/test/mapdefaults/BUILD.bazel b/test/mapdefaults/BUILD.bazel
+--- a/test/mapdefaults/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/mapdefaults/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["map.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "mapdefaults",
++ srcs = ["map.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/mapdefaults",
++ visibility = ["//visibility:public"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":mapdefaults",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/mapdefaults/combos/both/BUILD.bazel b/test/mapdefaults/combos/both/BUILD.bazel
+--- a/test/mapdefaults/combos/both/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/mapdefaults/combos/both/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,41 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["map.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "both",
++ srcs = ["map.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/mapdefaults/combos/both",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":both",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "both_test",
++ srcs = [
++ "map_test.go",
++ "mappb_test.go",
++ "unknown_test.go",
++ ],
++ embed = [":both"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/mapdefaults/combos/marshaler/BUILD.bazel b/test/mapdefaults/combos/marshaler/BUILD.bazel
+--- a/test/mapdefaults/combos/marshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/mapdefaults/combos/marshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["map.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "marshaler",
++ srcs = ["map.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/mapdefaults/combos/marshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":marshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "marshaler_test",
++ srcs = [
++ "map_test.go",
++ "mappb_test.go",
++ ],
++ embed = [":marshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/mapdefaults/combos/neither/BUILD.bazel b/test/mapdefaults/combos/neither/BUILD.bazel
+--- a/test/mapdefaults/combos/neither/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/mapdefaults/combos/neither/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["map.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "neither",
++ srcs = ["map.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/mapdefaults/combos/neither",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":neither",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "neither_test",
++ srcs = [
++ "map_test.go",
++ "mappb_test.go",
++ ],
++ embed = [":neither"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/mapdefaults/combos/unmarshaler/BUILD.bazel b/test/mapdefaults/combos/unmarshaler/BUILD.bazel
+--- a/test/mapdefaults/combos/unmarshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/mapdefaults/combos/unmarshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,41 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["map.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "unmarshaler",
++ srcs = ["map.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/mapdefaults/combos/unmarshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unmarshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unmarshaler_test",
++ srcs = [
++ "map_test.go",
++ "mappb_test.go",
++ "unknown_test.go",
++ ],
++ embed = [":unmarshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/mapsproto2/BUILD.bazel b/test/mapsproto2/BUILD.bazel
+--- a/test/mapsproto2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/mapsproto2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "header.proto",
++ "mapsproto2.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "mapsproto2",
++ srcs = ["doc.go"],
++ importpath = "github.com/gogo/protobuf/test/mapsproto2",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":mapsproto2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/mapsproto2/combos/both/BUILD.bazel b/test/mapsproto2/combos/both/BUILD.bazel
+--- a/test/mapsproto2/combos/both/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/mapsproto2/combos/both/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,42 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["mapsproto2.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "both",
++ srcs = ["mapsproto2.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/mapsproto2/combos/both",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test",
++ "//test/custom",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":both",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "both_test",
++ srcs = [
++ "mapsproto2_test.go",
++ "mapsproto2pb_test.go",
++ ],
++ embed = [":both"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/mapsproto2/combos/marshaler/BUILD.bazel b/test/mapsproto2/combos/marshaler/BUILD.bazel
+--- a/test/mapsproto2/combos/marshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/mapsproto2/combos/marshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,42 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["mapsproto2.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "marshaler",
++ srcs = ["mapsproto2.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/mapsproto2/combos/marshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test",
++ "//test/custom",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":marshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "marshaler_test",
++ srcs = [
++ "mapsproto2_test.go",
++ "mapsproto2pb_test.go",
++ ],
++ embed = [":marshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/mapsproto2/combos/neither/BUILD.bazel b/test/mapsproto2/combos/neither/BUILD.bazel
+--- a/test/mapsproto2/combos/neither/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/mapsproto2/combos/neither/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,42 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["mapsproto2.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "neither",
++ srcs = ["mapsproto2.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/mapsproto2/combos/neither",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test",
++ "//test/custom",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":neither",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "neither_test",
++ srcs = [
++ "mapsproto2_test.go",
++ "mapsproto2pb_test.go",
++ ],
++ embed = [":neither"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/mapsproto2/combos/unmarshaler/BUILD.bazel b/test/mapsproto2/combos/unmarshaler/BUILD.bazel
+--- a/test/mapsproto2/combos/unmarshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/mapsproto2/combos/unmarshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,42 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["mapsproto2.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "unmarshaler",
++ srcs = ["mapsproto2.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/mapsproto2/combos/unmarshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test",
++ "//test/custom",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unmarshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unmarshaler_test",
++ srcs = [
++ "mapsproto2_test.go",
++ "mapsproto2pb_test.go",
++ ],
++ embed = [":unmarshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/merge/BUILD.bazel b/test/merge/BUILD.bazel
+--- a/test/merge/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/merge/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["merge.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "merge",
++ srcs = ["merge.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/merge",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":merge",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "merge_test",
++ srcs = ["merge_test.go"],
++ embed = [":merge"],
++ deps = ["//proto"],
++)
+diff -urN a/test/mixbench/BUILD.bazel b/test/mixbench/BUILD.bazel
+--- a/test/mixbench/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/mixbench/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "mixbench_lib",
++ srcs = ["mixbench.go"],
++ importpath = "github.com/gogo/protobuf/test/mixbench",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "mixbench",
++ embed = [":mixbench_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/moredefaults/BUILD.bazel b/test/moredefaults/BUILD.bazel
+--- a/test/moredefaults/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/moredefaults/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["md.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "moredefaults",
++ srcs = ["md.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/moredefaults",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//test/example",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":moredefaults",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "moredefaults_test",
++ srcs = [
++ "md_test.go",
++ "mdpb_test.go",
++ ],
++ embed = [":moredefaults"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//test/example",
++ ],
++)
+diff -urN a/test/nopackage/BUILD.bazel b/test/nopackage/BUILD.bazel
+--- a/test/nopackage/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/nopackage/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["nopackage.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "nopackage",
++ srcs = ["nopackage.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/nopackage",
++ visibility = ["//visibility:public"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":nopackage",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "nopackage_test",
++ srcs = ["nopackage_test.go"],
++ embed = [":nopackage"],
++)
+diff -urN a/test/oneof/BUILD.bazel b/test/oneof/BUILD.bazel
+--- a/test/oneof/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/oneof/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["one.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "oneof",
++ srcs = ["doc.go"],
++ importpath = "github.com/gogo/protobuf/test/oneof",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":oneof",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/oneof/combos/both/BUILD.bazel b/test/oneof/combos/both/BUILD.bazel
+--- a/test/oneof/combos/both/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/oneof/combos/both/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["one.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "both",
++ srcs = ["one.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/oneof/combos/both",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//test/casttype",
++ "//test/custom",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":both",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "both_test",
++ srcs = ["onepb_test.go"],
++ embed = [":both"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/oneof/combos/marshaler/BUILD.bazel b/test/oneof/combos/marshaler/BUILD.bazel
+--- a/test/oneof/combos/marshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/oneof/combos/marshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["one.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "marshaler",
++ srcs = ["one.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/oneof/combos/marshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//test/casttype",
++ "//test/custom",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":marshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "marshaler_test",
++ srcs = ["onepb_test.go"],
++ embed = [":marshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/oneof/combos/neither/BUILD.bazel b/test/oneof/combos/neither/BUILD.bazel
+--- a/test/oneof/combos/neither/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/oneof/combos/neither/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["one.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "neither",
++ srcs = ["one.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/oneof/combos/neither",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//test/casttype",
++ "//test/custom",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":neither",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "neither_test",
++ srcs = ["onepb_test.go"],
++ embed = [":neither"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/oneof/combos/unmarshaler/BUILD.bazel b/test/oneof/combos/unmarshaler/BUILD.bazel
+--- a/test/oneof/combos/unmarshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/oneof/combos/unmarshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["one.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "unmarshaler",
++ srcs = ["one.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/oneof/combos/unmarshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//test/casttype",
++ "//test/custom",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unmarshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unmarshaler_test",
++ srcs = ["onepb_test.go"],
++ embed = [":unmarshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/oneof3/BUILD.bazel b/test/oneof3/BUILD.bazel
+--- a/test/oneof3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/oneof3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["one.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "oneof3",
++ srcs = ["doc.go"],
++ importpath = "github.com/gogo/protobuf/test/oneof3",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":oneof3",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/oneof3/combos/both/BUILD.bazel b/test/oneof3/combos/both/BUILD.bazel
+--- a/test/oneof3/combos/both/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/oneof3/combos/both/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["one.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "both",
++ srcs = ["one.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/oneof3/combos/both",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":both",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "both_test",
++ srcs = ["onepb_test.go"],
++ embed = [":both"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/oneof3/combos/marshaler/BUILD.bazel b/test/oneof3/combos/marshaler/BUILD.bazel
+--- a/test/oneof3/combos/marshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/oneof3/combos/marshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["one.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "marshaler",
++ srcs = ["one.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/oneof3/combos/marshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":marshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "marshaler_test",
++ srcs = ["onepb_test.go"],
++ embed = [":marshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/oneof3/combos/neither/BUILD.bazel b/test/oneof3/combos/neither/BUILD.bazel
+--- a/test/oneof3/combos/neither/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/oneof3/combos/neither/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["one.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "neither",
++ srcs = ["one.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/oneof3/combos/neither",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":neither",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "neither_test",
++ srcs = ["onepb_test.go"],
++ embed = [":neither"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/oneof3/combos/unmarshaler/BUILD.bazel b/test/oneof3/combos/unmarshaler/BUILD.bazel
+--- a/test/oneof3/combos/unmarshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/oneof3/combos/unmarshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["one.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "unmarshaler",
++ srcs = ["one.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/oneof3/combos/unmarshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unmarshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unmarshaler_test",
++ srcs = ["onepb_test.go"],
++ embed = [":unmarshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/oneofembed/BUILD.bazel b/test/oneofembed/BUILD.bazel
+--- a/test/oneofembed/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/oneofembed/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["oneofembed.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "oneofembed",
++ srcs = ["oneofembed.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/oneofembed",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":oneofembed",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "oneofembed_test",
++ srcs = ["oneofembedpb_test.go"],
++ embed = [":oneofembed"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/packed/BUILD.bazel b/test/packed/BUILD.bazel
+--- a/test/packed/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/packed/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["packed.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "packed",
++ srcs = [
++ "doc.go",
++ "packed.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/packed",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":packed",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "packed_test",
++ srcs = ["packed_test.go"],
++ embed = [":packed"],
++ deps = ["//proto"],
++)
+diff -urN a/test/proto3extension/BUILD.bazel b/test/proto3extension/BUILD.bazel
+--- a/test/proto3extension/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/proto3extension/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["proto3ext.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "proto3extension",
++ srcs = ["proto3ext.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/proto3extension",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto3extension",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/protobuffer/BUILD.bazel b/test/protobuffer/BUILD.bazel
+--- a/test/protobuffer/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/protobuffer/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["protobuffer.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "protobuffer",
++ srcs = ["protobuffer.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/protobuffer",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protobuffer",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "protobuffer_test",
++ srcs = ["protobuffer_test.go"],
++ embed = [":protobuffer"],
++ deps = ["//proto"],
++)
+diff -urN a/test/protosize/BUILD.bazel b/test/protosize/BUILD.bazel
+--- a/test/protosize/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/protosize/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["protosize.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "protosize",
++ srcs = ["protosize.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/protosize",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protosize",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "protosize_test",
++ srcs = [
++ "protosize_test.go",
++ "protosizepb_test.go",
++ ],
++ embed = [":protosize"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/registration/BUILD.bazel b/test/registration/BUILD.bazel
+--- a/test/registration/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/registration/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,5 @@
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["registration.proto"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/required/BUILD.bazel b/test/required/BUILD.bazel
+--- a/test/required/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/required/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["requiredexample.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "required",
++ srcs = ["requiredexample.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/required",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":required",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "required_test",
++ srcs = ["requiredexamplepb_test.go"],
++ embed = [":required"],
++ deps = [
++ "//proto",
++ "//test",
++ ],
++)
+diff -urN a/test/setextensionbytes/BUILD.bazel b/test/setextensionbytes/BUILD.bazel
+--- a/test/setextensionbytes/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/setextensionbytes/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["setextensionbytes.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "setextensionbytes",
++ srcs = ["setextensionbytes.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/setextensionbytes",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":setextensionbytes",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "setextensionbytes_test",
++ srcs = ["setextensionbytes_test.go"],
++ embed = [":setextensionbytes"],
++ deps = ["//proto"],
++)
+diff -urN a/test/sizerconflict/BUILD.bazel b/test/sizerconflict/BUILD.bazel
+--- a/test/sizerconflict/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/sizerconflict/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["sizerconflict.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "sizerconflict",
++ srcs = ["doc.go"],
++ importpath = "github.com/gogo/protobuf/test/sizerconflict",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sizerconflict",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "sizerconflict_test",
++ srcs = ["sizerconflict_test.go"],
++ embed = [":sizerconflict"],
++)
+diff -urN a/test/sizeunderscore/BUILD.bazel b/test/sizeunderscore/BUILD.bazel
+--- a/test/sizeunderscore/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/sizeunderscore/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["sizeunderscore.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "sizeunderscore",
++ srcs = ["sizeunderscore.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/sizeunderscore",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sizeunderscore",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "sizeunderscore_test",
++ srcs = ["sizeunderscorepb_test.go"],
++ embed = [":sizeunderscore"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/stdtypes/BUILD.bazel b/test/stdtypes/BUILD.bazel
+--- a/test/stdtypes/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/stdtypes/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,41 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["stdtypes.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "stdtypes",
++ srcs = ["stdtypes.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/stdtypes",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//sortkeys",
++ "//types",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":stdtypes",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "stdtypes_test",
++ srcs = [
++ "concurrency_test.go",
++ "stdtypespb_test.go",
++ ],
++ embed = [":stdtypes"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//types",
++ ],
++)
+diff -urN a/test/tags/BUILD.bazel b/test/tags/BUILD.bazel
+--- a/test/tags/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/tags/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["tags.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "tags",
++ srcs = [
++ "doc.go",
++ "tags.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/tags",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":tags",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "tags_test",
++ srcs = ["tags_test.go"],
++ embed = [":tags"],
++)
+diff -urN a/test/theproto3/BUILD.bazel b/test/theproto3/BUILD.bazel
+--- a/test/theproto3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/theproto3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "footer.proto",
++ "header.proto",
++ "maps.proto",
++ "theproto3.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "theproto3",
++ srcs = ["doc.go"],
++ importpath = "github.com/gogo/protobuf/test/theproto3",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":theproto3",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/theproto3/combos/both/BUILD.bazel b/test/theproto3/combos/both/BUILD.bazel
+--- a/test/theproto3/combos/both/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/theproto3/combos/both/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,43 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["theproto3.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "both",
++ srcs = ["theproto3.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/theproto3/combos/both",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test/combos/both",
++ "//test/custom",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":both",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "both_test",
++ srcs = [
++ "proto3_test.go",
++ "theproto3pb_test.go",
++ ],
++ embed = [":both"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//test/combos/both",
++ ],
++)
+diff -urN a/test/theproto3/combos/marshaler/BUILD.bazel b/test/theproto3/combos/marshaler/BUILD.bazel
+--- a/test/theproto3/combos/marshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/theproto3/combos/marshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,43 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["theproto3.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "marshaler",
++ srcs = ["theproto3.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/theproto3/combos/marshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test/combos/both",
++ "//test/custom",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":marshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "marshaler_test",
++ srcs = [
++ "proto3_test.go",
++ "theproto3pb_test.go",
++ ],
++ embed = [":marshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//test/combos/both",
++ ],
++)
+diff -urN a/test/theproto3/combos/neither/BUILD.bazel b/test/theproto3/combos/neither/BUILD.bazel
+--- a/test/theproto3/combos/neither/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/theproto3/combos/neither/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,43 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["theproto3.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "neither",
++ srcs = ["theproto3.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/theproto3/combos/neither",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test/combos/both",
++ "//test/custom",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":neither",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "neither_test",
++ srcs = [
++ "proto3_test.go",
++ "theproto3pb_test.go",
++ ],
++ embed = [":neither"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//test/combos/both",
++ ],
++)
+diff -urN a/test/theproto3/combos/unmarshaler/BUILD.bazel b/test/theproto3/combos/unmarshaler/BUILD.bazel
+--- a/test/theproto3/combos/unmarshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/theproto3/combos/unmarshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,43 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["theproto3.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "unmarshaler",
++ srcs = ["theproto3.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/theproto3/combos/unmarshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ "//sortkeys",
++ "//test/combos/both",
++ "//test/custom",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unmarshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unmarshaler_test",
++ srcs = [
++ "proto3_test.go",
++ "theproto3pb_test.go",
++ ],
++ embed = [":unmarshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//test/combos/both",
++ ],
++)
+diff -urN a/test/typedecl/BUILD.bazel b/test/typedecl/BUILD.bazel
+--- a/test/typedecl/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/typedecl/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,39 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["typedecl.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "typedecl",
++ srcs = [
++ "models.go",
++ "typedecl.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/typedecl",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typedecl",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "typedecl_test",
++ srcs = ["typedeclpb_test.go"],
++ embed = [":typedecl"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/typedecl_all/BUILD.bazel b/test/typedecl_all/BUILD.bazel
+--- a/test/typedecl_all/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/typedecl_all/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,39 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["typedeclall.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "typedecl_all",
++ srcs = [
++ "models.go",
++ "typedeclall.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/typedecl_all",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typedecl_all",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "typedecl_all_test",
++ srcs = ["typedeclallpb_test.go"],
++ embed = [":typedecl_all"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/typedeclimport/BUILD.bazel b/test/typedeclimport/BUILD.bazel
+--- a/test/typedeclimport/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/typedeclimport/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["typedeclimport.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "typedeclimport",
++ srcs = [
++ "models.go",
++ "typedeclimport.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/test/typedeclimport",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//test/typedeclimport/subpkg",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typedeclimport",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "typedeclimport_test",
++ srcs = ["typedeclimport_test.go"],
++ embed = [":typedeclimport"],
++)
+diff -urN a/test/typedeclimport/subpkg/BUILD.bazel b/test/typedeclimport/subpkg/BUILD.bazel
+--- a/test/typedeclimport/subpkg/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/typedeclimport/subpkg/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["subpkg.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "subpkg",
++ srcs = ["subpkg.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/typedeclimport/subpkg",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":subpkg",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/types/BUILD.bazel b/test/types/BUILD.bazel
+--- a/test/types/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/types/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,5 @@
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["types.proto"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/test/types/combos/both/BUILD.bazel b/test/types/combos/both/BUILD.bazel
+--- a/test/types/combos/both/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/types/combos/both/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["types.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "both",
++ srcs = ["types.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/types/combos/both",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//types",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":both",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "both_test",
++ srcs = [
++ "types_test.go",
++ "typespb_test.go",
++ ],
++ embed = [":both"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//types",
++ ],
++)
+diff -urN a/test/types/combos/marshaler/BUILD.bazel b/test/types/combos/marshaler/BUILD.bazel
+--- a/test/types/combos/marshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/types/combos/marshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["types.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "marshaler",
++ srcs = ["types.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/types/combos/marshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//types",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":marshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "marshaler_test",
++ srcs = [
++ "types_test.go",
++ "typespb_test.go",
++ ],
++ embed = [":marshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//types",
++ ],
++)
+diff -urN a/test/types/combos/neither/BUILD.bazel b/test/types/combos/neither/BUILD.bazel
+--- a/test/types/combos/neither/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/types/combos/neither/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["types.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "neither",
++ srcs = ["types.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/types/combos/neither",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//types",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":neither",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "neither_test",
++ srcs = [
++ "types_test.go",
++ "typespb_test.go",
++ ],
++ embed = [":neither"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//types",
++ ],
++)
+diff -urN a/test/types/combos/unmarshaler/BUILD.bazel b/test/types/combos/unmarshaler/BUILD.bazel
+--- a/test/types/combos/unmarshaler/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/types/combos/unmarshaler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["types.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "unmarshaler",
++ srcs = ["types.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/types/combos/unmarshaler",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//types",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unmarshaler",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unmarshaler_test",
++ srcs = [
++ "types_test.go",
++ "typespb_test.go",
++ ],
++ embed = [":unmarshaler"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ "//types",
++ ],
++)
+diff -urN a/test/unmarshalmerge/BUILD.bazel b/test/unmarshalmerge/BUILD.bazel
+--- a/test/unmarshalmerge/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/unmarshalmerge/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["unmarshalmerge.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "unmarshalmerge",
++ srcs = ["unmarshalmerge.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/unmarshalmerge",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unmarshalmerge",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unmarshalmerge_test",
++ srcs = [
++ "unmarshalmerge_test.go",
++ "unmarshalmergepb_test.go",
++ ],
++ embed = [":unmarshalmerge"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/unrecognized/BUILD.bazel b/test/unrecognized/BUILD.bazel
+--- a/test/unrecognized/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/unrecognized/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,39 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["unrecognized.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "unrecognized",
++ srcs = ["unrecognized.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/unrecognized",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unrecognized",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unrecognized_test",
++ srcs = [
++ "oldnew_test.go",
++ "unrecognizedpb_test.go",
++ ],
++ embed = [":unrecognized"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/unrecognizedgroup/BUILD.bazel b/test/unrecognizedgroup/BUILD.bazel
+--- a/test/unrecognizedgroup/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/unrecognizedgroup/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,39 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["unrecognizedgroup.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "unrecognizedgroup",
++ srcs = ["unrecognizedgroup.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/unrecognizedgroup",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unrecognizedgroup",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unrecognizedgroup_test",
++ srcs = [
++ "oldnew_test.go",
++ "unrecognizedgrouppb_test.go",
++ ],
++ embed = [":unrecognizedgroup"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/test/xxxfields/BUILD.bazel b/test/xxxfields/BUILD.bazel
+--- a/test/xxxfields/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/test/xxxfields/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = ["xxxfields.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "xxxfields",
++ srcs = ["xxxfields.pb.go"],
++ importpath = "github.com/gogo/protobuf/test/xxxfields",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":xxxfields",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "xxxfields_test",
++ srcs = ["xxxfieldspb_test.go"],
++ embed = [":xxxfields"],
++ deps = [
++ "//gogoproto",
++ "//jsonpb",
++ "//proto",
++ ],
++)
+diff -urN a/types/BUILD.bazel b/types/BUILD.bazel
+--- a/types/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/types/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,51 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "types",
++ srcs = [
++ "any.go",
++ "any.pb.go",
++ "api.pb.go",
++ "doc.go",
++ "duration.go",
++ "duration.pb.go",
++ "duration_gogo.go",
++ "empty.pb.go",
++ "field_mask.pb.go",
++ "protosize.go",
++ "source_context.pb.go",
++ "struct.pb.go",
++ "timestamp.go",
++ "timestamp.pb.go",
++ "timestamp_gogo.go",
++ "type.pb.go",
++ "wrappers.pb.go",
++ "wrappers_gogo.go",
++ ],
++ importpath = "github.com/gogo/protobuf/types",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//sortkeys",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":types",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "types_test",
++ srcs = [
++ "any_test.go",
++ "duration_test.go",
++ "timestamp_test.go",
++ ],
++ embed = [":types"],
++ deps = [
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ ],
++)
+diff -urN a/vanity/BUILD.bazel b/vanity/BUILD.bazel
+--- a/vanity/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/vanity/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "vanity",
++ srcs = [
++ "enum.go",
++ "field.go",
++ "file.go",
++ "foreach.go",
++ "msg.go",
++ ],
++ importpath = "github.com/gogo/protobuf/vanity",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ "//protoc-gen-gogo/descriptor",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":vanity",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/vanity/command/BUILD.bazel b/vanity/command/BUILD.bazel
+--- a/vanity/command/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/vanity/command/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "command",
++ srcs = ["command.go"],
++ importpath = "github.com/gogo/protobuf/vanity/command",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//plugin/compare",
++ "//plugin/defaultcheck",
++ "//plugin/description",
++ "//plugin/embedcheck",
++ "//plugin/enumstringer",
++ "//plugin/equal",
++ "//plugin/face",
++ "//plugin/gostring",
++ "//plugin/marshalto",
++ "//plugin/oneofcheck",
++ "//plugin/populate",
++ "//plugin/size",
++ "//plugin/stringer",
++ "//plugin/testgen",
++ "//plugin/union",
++ "//plugin/unmarshal",
++ "//proto",
++ "//protoc-gen-gogo/generator",
++ "//protoc-gen-gogo/grpc",
++ "//protoc-gen-gogo/plugin",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":command",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/vanity/test/BUILD.bazel b/vanity/test/BUILD.bazel
+--- a/vanity/test/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/vanity/test/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++filegroup(
++ name = "go_default_library_protos",
++ srcs = [
++ "gogovanity.proto",
++ "proto3.proto",
++ "vanity.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_library(
++ name = "test",
++ srcs = ["doc.go"],
++ importpath = "github.com/gogo/protobuf/vanity/test",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":test",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "test_test",
++ srcs = ["vanity_test.go"],
++ embed = [":test"],
++ deps = [
++ "//vanity/test/fast",
++ "//vanity/test/faster",
++ "//vanity/test/slick",
++ ],
++)
+diff -urN a/vanity/test/fast/BUILD.bazel b/vanity/test/fast/BUILD.bazel
+--- a/vanity/test/fast/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/vanity/test/fast/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "fast",
++ srcs = [
++ "gogovanity.pb.go",
++ "proto3.pb.go",
++ "vanity.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/vanity/test/fast",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fast",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/vanity/test/faster/BUILD.bazel b/vanity/test/faster/BUILD.bazel
+--- a/vanity/test/faster/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/vanity/test/faster/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "faster",
++ srcs = [
++ "gogovanity.pb.go",
++ "proto3.pb.go",
++ "vanity.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/vanity/test/faster",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":faster",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/vanity/test/slick/BUILD.bazel b/vanity/test/slick/BUILD.bazel
+--- a/vanity/test/slick/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/vanity/test/slick/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "slick",
++ srcs = [
++ "gogovanity.pb.go",
++ "proto3.pb.go",
++ "vanity.pb.go",
++ ],
++ importpath = "github.com/gogo/protobuf/vanity/test/slick",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//gogoproto",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":slick",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/version/BUILD.bazel b/version/BUILD.bazel
+--- a/version/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/version/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "version",
++ srcs = ["version.go"],
++ importpath = "github.com/gogo/protobuf/version",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":version",
++ visibility = ["//visibility:public"],
++)
diff --git a/third_party/com_github_golang_mock-gazelle.patch b/third_party/com_github_golang_mock-gazelle.patch
new file mode 100644
index 00000000..6cf26157
--- /dev/null
+++ b/third_party/com_github_golang_mock-gazelle.patch
@@ -0,0 +1,1155 @@
+diff -urN a/gomock/BUILD.bazel b/gomock/BUILD.bazel
+--- a/gomock/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/gomock/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "gomock",
++ srcs = [
++ "call.go",
++ "callset.go",
++ "controller.go",
++ "doc.go",
++ "matchers.go",
++ ],
++ importpath = "github.com/golang/mock/gomock",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gomock",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "gomock_test",
++ srcs = [
++ "call_test.go",
++ "callset_test.go",
++ "controller_test.go",
++ "example_test.go",
++ "matchers_test.go",
++ "mock_test.go",
++ ],
++ embed = [":gomock"],
++ deps = ["//gomock/internal/mock_gomock"],
++)
+diff -urN a/gomock/internal/mock_gomock/BUILD.bazel b/gomock/internal/mock_gomock/BUILD.bazel
+--- a/gomock/internal/mock_gomock/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/gomock/internal/mock_gomock/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "mock_gomock",
++ srcs = ["mock_matcher.go"],
++ importpath = "github.com/golang/mock/gomock/internal/mock_gomock",
++ visibility = ["//gomock:__subpackages__"],
++ deps = ["//gomock"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":mock_gomock",
++ visibility = ["//gomock:__subpackages__"],
++)
+diff -urN a/mockgen/BUILD.bazel b/mockgen/BUILD.bazel
+--- a/mockgen/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "mockgen_lib",
++ srcs = [
++ "generic_go118.go",
++ "generic_notgo118.go",
++ "mockgen.go",
++ "parse.go",
++ "reflect.go",
++ "version.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//mockgen/model",
++ "@org_golang_x_mod//modfile:go_default_library",
++ "@org_golang_x_tools//imports:go_default_library",
++ ],
++)
++
++go_binary(
++ name = "mockgen",
++ embed = [":mockgen_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "mockgen_test",
++ srcs = [
++ "mockgen_test.go",
++ "parse_test.go",
++ ],
++ embed = [":mockgen_lib"],
++ deps = ["//mockgen/model"],
++)
+diff -urN a/mockgen/internal/tests/aux_imports_embedded_interface/BUILD.bazel b/mockgen/internal/tests/aux_imports_embedded_interface/BUILD.bazel
+--- a/mockgen/internal/tests/aux_imports_embedded_interface/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/aux_imports_embedded_interface/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "aux_imports_embedded_interface",
++ srcs = [
++ "bugreport.go",
++ "bugreport_mock.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/aux_imports_embedded_interface",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = [
++ "//gomock",
++ "//mockgen/internal/tests/aux_imports_embedded_interface/faux",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":aux_imports_embedded_interface",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++go_test(
++ name = "aux_imports_embedded_interface_test",
++ srcs = ["bugreport_test.go"],
++ embed = [":aux_imports_embedded_interface"],
++ deps = ["//gomock"],
++)
+diff -urN a/mockgen/internal/tests/aux_imports_embedded_interface/faux/BUILD.bazel b/mockgen/internal/tests/aux_imports_embedded_interface/faux/BUILD.bazel
+--- a/mockgen/internal/tests/aux_imports_embedded_interface/faux/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/aux_imports_embedded_interface/faux/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "faux",
++ srcs = ["faux.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/aux_imports_embedded_interface/faux",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":faux",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/const_array_length/BUILD.bazel b/mockgen/internal/tests/const_array_length/BUILD.bazel
+--- a/mockgen/internal/tests/const_array_length/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/const_array_length/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "const_array_length",
++ srcs = [
++ "input.go",
++ "mock.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/const_array_length",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = ["//gomock"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":const_array_length",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/copyright_file/BUILD.bazel b/mockgen/internal/tests/copyright_file/BUILD.bazel
+--- a/mockgen/internal/tests/copyright_file/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/copyright_file/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "copyright_file",
++ srcs = [
++ "input.go",
++ "mock.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/copyright_file",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = ["//gomock"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":copyright_file",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/custom_package_name/client/v1/BUILD.bazel b/mockgen/internal/tests/custom_package_name/client/v1/BUILD.bazel
+--- a/mockgen/internal/tests/custom_package_name/client/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/custom_package_name/client/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "client",
++ srcs = ["client.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/custom_package_name/client/v1",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":client",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/custom_package_name/greeter/BUILD.bazel b/mockgen/internal/tests/custom_package_name/greeter/BUILD.bazel
+--- a/mockgen/internal/tests/custom_package_name/greeter/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/custom_package_name/greeter/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "greeter",
++ srcs = ["greeter.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/custom_package_name/greeter",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = [
++ "//mockgen/internal/tests/custom_package_name/client/v1:client",
++ "//mockgen/internal/tests/custom_package_name/validator",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":greeter",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++go_test(
++ name = "greeter_test",
++ srcs = [
++ "greeter_mock_test.go",
++ "greeter_test.go",
++ ],
++ embed = [":greeter"],
++ deps = [
++ "//gomock",
++ "//mockgen/internal/tests/custom_package_name/client/v1:client",
++ ],
++)
+diff -urN a/mockgen/internal/tests/custom_package_name/validator/BUILD.bazel b/mockgen/internal/tests/custom_package_name/validator/BUILD.bazel
+--- a/mockgen/internal/tests/custom_package_name/validator/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/custom_package_name/validator/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "validator",
++ srcs = ["validate.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/custom_package_name/validator",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":validator",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/dot_imports/BUILD.bazel b/mockgen/internal/tests/dot_imports/BUILD.bazel
+--- a/mockgen/internal/tests/dot_imports/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/dot_imports/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "dot_imports",
++ srcs = [
++ "input.go",
++ "mock.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/dot_imports",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = ["//gomock"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":dot_imports",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/empty_interface/BUILD.bazel b/mockgen/internal/tests/empty_interface/BUILD.bazel
+--- a/mockgen/internal/tests/empty_interface/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/empty_interface/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "empty_interface",
++ srcs = [
++ "input.go",
++ "mock.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/empty_interface",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = ["//gomock"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":empty_interface",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/extra_import/BUILD.bazel b/mockgen/internal/tests/extra_import/BUILD.bazel
+--- a/mockgen/internal/tests/extra_import/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/extra_import/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "extra_import",
++ srcs = [
++ "import.go",
++ "mock.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/extra_import",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = ["//gomock"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":extra_import",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/generated_identifier_conflict/BUILD.bazel b/mockgen/internal/tests/generated_identifier_conflict/BUILD.bazel
+--- a/mockgen/internal/tests/generated_identifier_conflict/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/generated_identifier_conflict/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "generated_identifier_conflict",
++ srcs = [
++ "bugreport.go",
++ "bugreport_mock.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/generated_identifier_conflict",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = ["//gomock"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":generated_identifier_conflict",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++go_test(
++ name = "generated_identifier_conflict_test",
++ srcs = ["bugreport_test.go"],
++ embed = [":generated_identifier_conflict"],
++ deps = ["//gomock"],
++)
+diff -urN a/mockgen/internal/tests/generics/BUILD.bazel b/mockgen/internal/tests/generics/BUILD.bazel
+--- a/mockgen/internal/tests/generics/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/generics/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "generics",
++ srcs = [
++ "external.go",
++ "generics.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/generics",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = [
++ "//mockgen/internal/tests/generics/other",
++ "@org_golang_x_exp//constraints:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":generics",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/generics/other/BUILD.bazel b/mockgen/internal/tests/generics/other/BUILD.bazel
+--- a/mockgen/internal/tests/generics/other/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/generics/other/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "other",
++ srcs = ["other.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/generics/other",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":other",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/generics/source/BUILD.bazel b/mockgen/internal/tests/generics/source/BUILD.bazel
+--- a/mockgen/internal/tests/generics/source/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/generics/source/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_test")
++
++go_test(
++ name = "source_test",
++ srcs = [
++ "mock_external_test.go",
++ "mock_generics_test.go",
++ ],
++ deps = [
++ "//gomock",
++ "//mockgen/internal/tests/generics",
++ "//mockgen/internal/tests/generics/other",
++ "@org_golang_x_exp//constraints:go_default_library",
++ ],
++)
+diff -urN a/mockgen/internal/tests/import_embedded_interface/BUILD.bazel b/mockgen/internal/tests/import_embedded_interface/BUILD.bazel
+--- a/mockgen/internal/tests/import_embedded_interface/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/import_embedded_interface/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "import_embedded_interface",
++ srcs = [
++ "bugreport.go",
++ "bugreport_mock.go",
++ "foo.go",
++ "net.go",
++ "net_mock.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/import_embedded_interface",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = [
++ "//gomock",
++ "//mockgen/internal/tests/import_embedded_interface/ersatz",
++ "//mockgen/internal/tests/import_embedded_interface/faux",
++ "//mockgen/internal/tests/import_embedded_interface/other/ersatz",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":import_embedded_interface",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++go_test(
++ name = "import_embedded_interface_test",
++ srcs = [
++ "bugreport_test.go",
++ "net_test.go",
++ ],
++ embed = [":import_embedded_interface"],
++ deps = ["//gomock"],
++)
+diff -urN a/mockgen/internal/tests/import_embedded_interface/ersatz/BUILD.bazel b/mockgen/internal/tests/import_embedded_interface/ersatz/BUILD.bazel
+--- a/mockgen/internal/tests/import_embedded_interface/ersatz/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/import_embedded_interface/ersatz/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "ersatz",
++ srcs = ["ersatz.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/import_embedded_interface/ersatz",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":ersatz",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/import_embedded_interface/faux/BUILD.bazel b/mockgen/internal/tests/import_embedded_interface/faux/BUILD.bazel
+--- a/mockgen/internal/tests/import_embedded_interface/faux/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/import_embedded_interface/faux/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "faux",
++ srcs = [
++ "conflict.go",
++ "faux.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/import_embedded_interface/faux",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = [
++ "//mockgen/internal/tests/import_embedded_interface/other/ersatz",
++ "//mockgen/internal/tests/import_embedded_interface/other/log",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":faux",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/import_embedded_interface/other/ersatz/BUILD.bazel b/mockgen/internal/tests/import_embedded_interface/other/ersatz/BUILD.bazel
+--- a/mockgen/internal/tests/import_embedded_interface/other/ersatz/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/import_embedded_interface/other/ersatz/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "ersatz",
++ srcs = ["ersatz.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/import_embedded_interface/other/ersatz",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":ersatz",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/import_embedded_interface/other/log/BUILD.bazel b/mockgen/internal/tests/import_embedded_interface/other/log/BUILD.bazel
+--- a/mockgen/internal/tests/import_embedded_interface/other/log/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/import_embedded_interface/other/log/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "log",
++ srcs = ["log.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/import_embedded_interface/other/log",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":log",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/import_source/BUILD.bazel b/mockgen/internal/tests/import_source/BUILD.bazel
+--- a/mockgen/internal/tests/import_source/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/import_source/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "import_source",
++ srcs = ["source_mock.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/import_source",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = [
++ "//gomock",
++ "//mockgen/internal/tests/import_source/definition",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":import_source",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/import_source/definition/BUILD.bazel b/mockgen/internal/tests/import_source/definition/BUILD.bazel
+--- a/mockgen/internal/tests/import_source/definition/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/import_source/definition/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "definition",
++ srcs = [
++ "source.go",
++ "source_mock.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/import_source/definition",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = ["//gomock"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":definition",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/internal_pkg/BUILD.bazel b/mockgen/internal/tests/internal_pkg/BUILD.bazel
+--- a/mockgen/internal/tests/internal_pkg/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/internal_pkg/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "internal_pkg",
++ srcs = ["generate.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/internal_pkg",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":internal_pkg",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/BUILD.bazel b/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/BUILD.bazel
+--- a/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "pkg",
++ srcs = ["input.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/internal_pkg/subdir/internal/pkg",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":pkg",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/reflect_output/BUILD.bazel b/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/reflect_output/BUILD.bazel
+--- a/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/reflect_output/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/reflect_output/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "reflect_output",
++ srcs = ["mock.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/reflect_output",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = [
++ "//gomock",
++ "//mockgen/internal/tests/internal_pkg/subdir/internal/pkg",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":reflect_output",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/source_output/BUILD.bazel b/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/source_output/BUILD.bazel
+--- a/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/source_output/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/source_output/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "source_output",
++ srcs = ["mock.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/internal_pkg/subdir/internal/pkg/source_output",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = [
++ "//gomock",
++ "//mockgen/internal/tests/internal_pkg/subdir/internal/pkg",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":source_output",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/missing_import/output/BUILD.bazel b/mockgen/internal/tests/missing_import/output/BUILD.bazel
+--- a/mockgen/internal/tests/missing_import/output/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/missing_import/output/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "output",
++ srcs = ["source_mock.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/missing_import/output",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = [
++ "//gomock",
++ "//mockgen/internal/tests/missing_import/source",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":output",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/missing_import/source/BUILD.bazel b/mockgen/internal/tests/missing_import/source/BUILD.bazel
+--- a/mockgen/internal/tests/missing_import/source/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/missing_import/source/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "source",
++ srcs = ["source.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/missing_import/source",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":source",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/mock_in_test_package/BUILD.bazel b/mockgen/internal/tests/mock_in_test_package/BUILD.bazel
+--- a/mockgen/internal/tests/mock_in_test_package/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/mock_in_test_package/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "mock_in_test_package",
++ srcs = ["user.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/mock_in_test_package",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":mock_in_test_package",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++go_test(
++ name = "mock_in_test_package_test",
++ srcs = ["mock_test.go"],
++ deps = [
++ ":mock_in_test_package",
++ "//gomock",
++ ],
++)
+diff -urN a/mockgen/internal/tests/overlapping_methods/BUILD.bazel b/mockgen/internal/tests/overlapping_methods/BUILD.bazel
+--- a/mockgen/internal/tests/overlapping_methods/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/overlapping_methods/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "overlapping_methods",
++ srcs = [
++ "interfaces.go",
++ "mock.go",
++ "overlap.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/overlapping_methods",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = ["//gomock"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":overlapping_methods",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++go_test(
++ name = "overlapping_methods_test",
++ srcs = ["overlap_test.go"],
++ embed = [":overlapping_methods"],
++ deps = ["//gomock"],
++)
+diff -urN a/mockgen/internal/tests/panicing_test/BUILD.bazel b/mockgen/internal/tests/panicing_test/BUILD.bazel
+--- a/mockgen/internal/tests/panicing_test/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/panicing_test/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "panicing_test",
++ srcs = ["panic.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/panicing_test",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":panicing_test",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++go_test(
++ name = "panicing_test_test",
++ srcs = ["mock_test.go"],
++ embed = [":panicing_test"],
++ deps = ["//gomock"],
++)
+diff -urN a/mockgen/internal/tests/parenthesized_parameter_type/BUILD.bazel b/mockgen/internal/tests/parenthesized_parameter_type/BUILD.bazel
+--- a/mockgen/internal/tests/parenthesized_parameter_type/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/parenthesized_parameter_type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "parenthesized_parameter_type",
++ srcs = [
++ "input.go",
++ "mock.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/parenthesized_parameter_type",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = ["//gomock"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":parenthesized_parameter_type",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/performance/big_interface/BUILD.bazel b/mockgen/internal/tests/performance/big_interface/BUILD.bazel
+--- a/mockgen/internal/tests/performance/big_interface/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/performance/big_interface/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "big_interface",
++ srcs = ["big_interface.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/performance/big_interface",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":big_interface",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/self_package/BUILD.bazel b/mockgen/internal/tests/self_package/BUILD.bazel
+--- a/mockgen/internal/tests/self_package/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/self_package/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "self_package",
++ srcs = [
++ "mock.go",
++ "types.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/self_package",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = ["//gomock"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":self_package",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/test_package/BUILD.bazel b/mockgen/internal/tests/test_package/BUILD.bazel
+--- a/mockgen/internal/tests/test_package/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/test_package/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "test_package",
++ srcs = ["foo.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/test_package",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":test_package",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++go_test(
++ name = "test_package_test",
++ srcs = [
++ "mock_test.go",
++ "user_test.go",
++ ],
++ deps = ["//gomock"],
++)
+diff -urN a/mockgen/internal/tests/unexported_method/BUILD.bazel b/mockgen/internal/tests/unexported_method/BUILD.bazel
+--- a/mockgen/internal/tests/unexported_method/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/unexported_method/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "unexported_method",
++ srcs = [
++ "bugreport.go",
++ "bugreport_mock.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/unexported_method",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = ["//gomock"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unexported_method",
++ visibility = ["//mockgen:__subpackages__"],
++)
++
++go_test(
++ name = "unexported_method_test",
++ srcs = ["bugreport_test.go"],
++ embed = [":unexported_method"],
++ deps = ["//gomock"],
++)
+diff -urN a/mockgen/internal/tests/vendor_dep/BUILD.bazel b/mockgen/internal/tests/vendor_dep/BUILD.bazel
+--- a/mockgen/internal/tests/vendor_dep/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/vendor_dep/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "vendor_dep",
++ srcs = [
++ "doc.go",
++ "mock.go",
++ "vendor_dep.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/vendor_dep",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = [
++ "//gomock",
++ "@org_golang_x_tools//present:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":vendor_dep",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/vendor_dep/source_mock_package/BUILD.bazel b/mockgen/internal/tests/vendor_dep/source_mock_package/BUILD.bazel
+--- a/mockgen/internal/tests/vendor_dep/source_mock_package/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/vendor_dep/source_mock_package/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "source_mock_package",
++ srcs = ["mock.go"],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/vendor_dep/source_mock_package",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = [
++ "//gomock",
++ "@org_golang_x_tools//present:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":source_mock_package",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/internal/tests/vendor_pkg/BUILD.bazel b/mockgen/internal/tests/vendor_pkg/BUILD.bazel
+--- a/mockgen/internal/tests/vendor_pkg/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/internal/tests/vendor_pkg/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "vendor_pkg",
++ srcs = [
++ "doc.go",
++ "mock.go",
++ ],
++ importpath = "github.com/golang/mock/mockgen/internal/tests/vendor_pkg",
++ visibility = ["//mockgen:__subpackages__"],
++ deps = ["//gomock"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":vendor_pkg",
++ visibility = ["//mockgen:__subpackages__"],
++)
+diff -urN a/mockgen/model/BUILD.bazel b/mockgen/model/BUILD.bazel
+--- a/mockgen/model/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/mockgen/model/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "model",
++ srcs = ["model.go"],
++ importpath = "github.com/golang/mock/mockgen/model",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":model",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "model_test",
++ srcs = ["model_test.go"],
++ embed = [":model"],
++)
+diff -urN a/sample/BUILD.bazel b/sample/BUILD.bazel
+--- a/sample/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/sample/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "sample",
++ srcs = ["user.go"],
++ importpath = "github.com/golang/mock/sample",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//sample/imp1",
++ "//sample/imp2",
++ "//sample/imp3",
++ "//sample/imp4",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sample",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "sample_test",
++ srcs = [
++ "mock_user_test.go",
++ "user_test.go",
++ ],
++ deps = [
++ ":sample",
++ "//gomock",
++ "//sample/imp1",
++ "//sample/imp2",
++ "//sample/imp3",
++ "//sample/imp4",
++ ],
++)
+diff -urN a/sample/concurrent/BUILD.bazel b/sample/concurrent/BUILD.bazel
+--- a/sample/concurrent/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/sample/concurrent/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "concurrent",
++ srcs = ["concurrent.go"],
++ importpath = "github.com/golang/mock/sample/concurrent",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":concurrent",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "concurrent_test",
++ srcs = ["concurrent_test.go"],
++ embed = [":concurrent"],
++ deps = [
++ "//gomock",
++ "//sample/concurrent/mock",
++ ],
++)
+diff -urN a/sample/concurrent/mock/BUILD.bazel b/sample/concurrent/mock/BUILD.bazel
+--- a/sample/concurrent/mock/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/sample/concurrent/mock/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "mock",
++ srcs = ["concurrent_mock.go"],
++ importpath = "github.com/golang/mock/sample/concurrent/mock",
++ visibility = ["//visibility:public"],
++ deps = ["//gomock"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":mock",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/sample/imp1/BUILD.bazel b/sample/imp1/BUILD.bazel
+--- a/sample/imp1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/sample/imp1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "imp1",
++ srcs = ["imp1.go"],
++ importpath = "github.com/golang/mock/sample/imp1",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":imp1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/sample/imp2/BUILD.bazel b/sample/imp2/BUILD.bazel
+--- a/sample/imp2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/sample/imp2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "imp2",
++ srcs = ["imp2.go"],
++ importpath = "github.com/golang/mock/sample/imp2",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":imp2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/sample/imp3/BUILD.bazel b/sample/imp3/BUILD.bazel
+--- a/sample/imp3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/sample/imp3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "imp3",
++ srcs = ["imp3.go"],
++ importpath = "github.com/golang/mock/sample/imp3",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":imp3",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/sample/imp4/BUILD.bazel b/sample/imp4/BUILD.bazel
+--- a/sample/imp4/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/sample/imp4/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "imp4",
++ srcs = ["imp4.go"],
++ importpath = "github.com/golang/mock/sample/imp4",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":imp4",
++ visibility = ["//visibility:public"],
++)
diff --git a/third_party/com_github_golang_protobuf-gazelle.patch b/third_party/com_github_golang_protobuf-gazelle.patch
new file mode 100644
index 00000000..c5b3510b
--- /dev/null
+++ b/third_party/com_github_golang_protobuf-gazelle.patch
@@ -0,0 +1,653 @@
+diff -urN a/descriptor/BUILD.bazel b/descriptor/BUILD.bazel
+--- a/descriptor/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/descriptor/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,46 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "descriptor",
++ srcs = ["descriptor.go"],
++ importpath = "github.com/golang/protobuf/descriptor",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//protoc-gen-go/descriptor",
++ "@org_golang_google_protobuf//reflect/protodesc:go_default_library",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++go_library(
++ name = "go_default_library_gen",
++ srcs = ["descriptor.go"],
++ importpath = "github.com/golang/protobuf/descriptor",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto:go_default_library",
++ "@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
++ "@org_golang_google_protobuf//reflect/protodesc:go_default_library",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":descriptor",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "descriptor_test",
++ srcs = ["descriptor_test.go"],
++ embed = [":descriptor"],
++ deps = [
++ "//protoc-gen-go/descriptor",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ ],
++)
+diff -urN a/internal/cmd/generate-alias/BUILD.bazel b/internal/cmd/generate-alias/BUILD.bazel
+--- a/internal/cmd/generate-alias/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/cmd/generate-alias/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "generate-alias_lib",
++ srcs = ["main.go"],
++ importpath = "github.com/golang/protobuf/internal/cmd/generate-alias",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//proto",
++ "@org_golang_google_protobuf//cmd/protoc-gen-go/internal_gengo:go_default_library",
++ "@org_golang_google_protobuf//compiler/protogen:go_default_library",
++ "@org_golang_google_protobuf//reflect/protodesc:go_default_library",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//types/descriptorpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ "@org_golang_google_protobuf//types/pluginpb:go_default_library",
++ ],
++)
++
++go_binary(
++ name = "generate-alias",
++ embed = [":generate-alias_lib"],
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/gengogrpc/BUILD.bazel b/internal/gengogrpc/BUILD.bazel
+--- a/internal/gengogrpc/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/gengogrpc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "gengogrpc",
++ srcs = ["grpc.go"],
++ importpath = "github.com/golang/protobuf/internal/gengogrpc",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "@org_golang_google_protobuf//compiler/protogen:go_default_library",
++ "@org_golang_google_protobuf//types/descriptorpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gengogrpc",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/jsonpb_proto/BUILD.bazel b/internal/testprotos/jsonpb_proto/BUILD.bazel
+--- a/internal/testprotos/jsonpb_proto/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/jsonpb_proto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "jsonpb_proto",
++ srcs = [
++ "test2.pb.go",
++ "test3.pb.go",
++ ],
++ importpath = "github.com/golang/protobuf/internal/testprotos/jsonpb_proto",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//proto",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":jsonpb_proto",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/proto2_proto/BUILD.bazel b/internal/testprotos/proto2_proto/BUILD.bazel
+--- a/internal/testprotos/proto2_proto/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/proto2_proto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto2_proto",
++ srcs = ["test.pb.go"],
++ importpath = "github.com/golang/protobuf/internal/testprotos/proto2_proto",
++ visibility = ["//:__subpackages__"],
++ deps = ["//proto"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto2_proto",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/proto3_proto/BUILD.bazel b/internal/testprotos/proto3_proto/BUILD.bazel
+--- a/internal/testprotos/proto3_proto/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/proto3_proto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto3_proto",
++ srcs = ["test.pb.go"],
++ importpath = "github.com/golang/protobuf/internal/testprotos/proto3_proto",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/testprotos/proto2_proto",
++ "//proto",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto3_proto",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/jsonpb/BUILD.bazel b/jsonpb/BUILD.bazel
+--- a/jsonpb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/jsonpb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,50 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "jsonpb",
++ srcs = [
++ "decode.go",
++ "encode.go",
++ "json.go",
++ ],
++ importpath = "github.com/golang/protobuf/jsonpb",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "@org_golang_google_protobuf//encoding/protojson:go_default_library",
++ "@org_golang_google_protobuf//proto:go_default_library",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//reflect/protoregistry:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library_gen",
++ actual = ":go_default_library",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":jsonpb",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "jsonpb_test",
++ srcs = ["json_test.go"],
++ embed = [":jsonpb"],
++ deps = [
++ "//internal/testprotos/jsonpb_proto",
++ "//internal/testprotos/proto3_proto",
++ "//proto",
++ "//protoc-gen-go/descriptor",
++ "//ptypes",
++ "//ptypes/any",
++ "//ptypes/duration",
++ "//ptypes/struct",
++ "//ptypes/timestamp",
++ "//ptypes/wrappers",
++ ],
++)
+diff -urN a/proto/BUILD.bazel b/proto/BUILD.bazel
+--- a/proto/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/proto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,61 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "proto",
++ srcs = [
++ "buffer.go",
++ "defaults.go",
++ "deprecated.go",
++ "discard.go",
++ "extensions.go",
++ "properties.go",
++ "proto.go",
++ "registry.go",
++ "text_decode.go",
++ "text_encode.go",
++ "wire.go",
++ "wrappers.go",
++ ],
++ importpath = "github.com/golang/protobuf/proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//encoding/prototext:go_default_library",
++ "@org_golang_google_protobuf//encoding/protowire:go_default_library",
++ "@org_golang_google_protobuf//proto:go_default_library",
++ "@org_golang_google_protobuf//reflect/protodesc:go_default_library",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//reflect/protoregistry:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoiface:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "proto_test",
++ srcs = [
++ "discard_test.go",
++ "extensions_test.go",
++ "proto_clone_test.go",
++ "proto_equal_test.go",
++ "proto_test.go",
++ "registry_test.go",
++ "text_test.go",
++ ],
++ deps = [
++ ":proto",
++ "//internal/testprotos/proto2_proto",
++ "//internal/testprotos/proto3_proto",
++ "//protoc-gen-go/descriptor",
++ "//ptypes/any",
++ "//ptypes/timestamp",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//testing/protopack:go_default_library",
++ ],
++)
+diff -urN a/protoc-gen-go/BUILD.bazel b/protoc-gen-go/BUILD.bazel
+--- a/protoc-gen-go/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-go/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "protoc-gen-go_lib",
++ srcs = ["main.go"],
++ importpath = "github.com/golang/protobuf/protoc-gen-go",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//internal/gengogrpc",
++ "@org_golang_google_protobuf//cmd/protoc-gen-go/internal_gengo:go_default_library",
++ "@org_golang_google_protobuf//compiler/protogen:go_default_library",
++ ],
++)
++
++go_binary(
++ name = "protoc-gen-go",
++ embed = [":protoc-gen-go_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-go/descriptor/BUILD.bazel b/protoc-gen-go/descriptor/BUILD.bazel
+--- a/protoc-gen-go/descriptor/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-go/descriptor/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "descriptor",
++ srcs = ["descriptor.pb.go"],
++ importpath = "github.com/golang/protobuf/protoc-gen-go/descriptor",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/descriptorpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":descriptor",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-go/generator/BUILD.bazel b/protoc-gen-go/generator/BUILD.bazel
+--- a/protoc-gen-go/generator/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-go/generator/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "generator",
++ srcs = ["generator.go"],
++ importpath = "github.com/golang/protobuf/protoc-gen-go/generator",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//protoc-gen-go/descriptor",
++ "//protoc-gen-go/generator/internal/remap",
++ "//protoc-gen-go/plugin",
++ ],
++)
++
++go_library(
++ name = "go_default_library_gen",
++ srcs = ["generator.go"],
++ importpath = "github.com/golang/protobuf/protoc-gen-go/generator",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto:go_default_library",
++ "//protoc-gen-go/generator/internal/remap:go_default_library",
++ "@io_bazel_rules_go//proto/wkt:compiler_plugin_go_proto",
++ "@io_bazel_rules_go//proto/wkt:descriptor_go_proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":generator",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-go/generator/internal/remap/BUILD.bazel b/protoc-gen-go/generator/internal/remap/BUILD.bazel
+--- a/protoc-gen-go/generator/internal/remap/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-go/generator/internal/remap/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "remap",
++ srcs = ["remap.go"],
++ importpath = "github.com/golang/protobuf/protoc-gen-go/generator/internal/remap",
++ visibility = ["//protoc-gen-go/generator:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":remap",
++ visibility = ["//protoc-gen-go/generator:__subpackages__"],
++)
++
++go_test(
++ name = "remap_test",
++ srcs = ["remap_test.go"],
++ embed = [":remap"],
++)
+diff -urN a/protoc-gen-go/grpc/BUILD.bazel b/protoc-gen-go/grpc/BUILD.bazel
+--- a/protoc-gen-go/grpc/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-go/grpc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "grpc",
++ srcs = ["grpc.go"],
++ importpath = "github.com/golang/protobuf/protoc-gen-go/grpc",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//protoc-gen-go/descriptor",
++ "//protoc-gen-go/generator",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":grpc",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protoc-gen-go/plugin/BUILD.bazel b/protoc-gen-go/plugin/BUILD.bazel
+--- a/protoc-gen-go/plugin/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoc-gen-go/plugin/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "plugin",
++ srcs = ["plugin.pb.go"],
++ importpath = "github.com/golang/protobuf/protoc-gen-go/plugin",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/pluginpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":plugin",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/ptypes/any/BUILD.bazel b/ptypes/any/BUILD.bazel
+--- a/ptypes/any/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/ptypes/any/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "any",
++ srcs = ["any.pb.go"],
++ importpath = "github.com/golang/protobuf/ptypes/any",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":any",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/ptypes/BUILD.bazel b/ptypes/BUILD.bazel
+--- a/ptypes/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/ptypes/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,64 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "ptypes",
++ srcs = [
++ "any.go",
++ "doc.go",
++ "duration.go",
++ "timestamp.go",
++ ],
++ importpath = "github.com/golang/protobuf/ptypes",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//ptypes/any",
++ "//ptypes/duration",
++ "//ptypes/timestamp",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//reflect/protoregistry:go_default_library",
++ ],
++)
++
++go_library(
++ name = "go_default_library_gen",
++ srcs = [
++ "any.go",
++ "doc.go",
++ "duration.go",
++ "timestamp.go",
++ ],
++ importpath = "github.com/golang/protobuf/ptypes",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto:go_default_library",
++ "@io_bazel_rules_go//proto/wkt:any_go_proto",
++ "@io_bazel_rules_go//proto/wkt:duration_go_proto",
++ "@io_bazel_rules_go//proto/wkt:timestamp_go_proto",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//reflect/protoregistry:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":ptypes",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "ptypes_test",
++ srcs = [
++ "any_test.go",
++ "duration_test.go",
++ "timestamp_test.go",
++ ],
++ embed = [":ptypes"],
++ deps = [
++ "//proto",
++ "//protoc-gen-go/descriptor",
++ "//ptypes/any",
++ "//ptypes/duration",
++ "//ptypes/timestamp",
++ ],
++)
+diff -urN a/ptypes/duration/BUILD.bazel b/ptypes/duration/BUILD.bazel
+--- a/ptypes/duration/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/ptypes/duration/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "duration",
++ srcs = ["duration.pb.go"],
++ importpath = "github.com/golang/protobuf/ptypes/duration",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":duration",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/ptypes/empty/BUILD.bazel b/ptypes/empty/BUILD.bazel
+--- a/ptypes/empty/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/ptypes/empty/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "empty",
++ srcs = ["empty.pb.go"],
++ importpath = "github.com/golang/protobuf/ptypes/empty",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":empty",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/ptypes/struct/BUILD.bazel b/ptypes/struct/BUILD.bazel
+--- a/ptypes/struct/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/ptypes/struct/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "struct",
++ srcs = ["struct.pb.go"],
++ importpath = "github.com/golang/protobuf/ptypes/struct",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":struct",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/ptypes/timestamp/BUILD.bazel b/ptypes/timestamp/BUILD.bazel
+--- a/ptypes/timestamp/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/ptypes/timestamp/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "timestamp",
++ srcs = ["timestamp.pb.go"],
++ importpath = "github.com/golang/protobuf/ptypes/timestamp",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":timestamp",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/ptypes/wrappers/BUILD.bazel b/ptypes/wrappers/BUILD.bazel
+--- a/ptypes/wrappers/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/ptypes/wrappers/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "wrappers",
++ srcs = ["wrappers.pb.go"],
++ importpath = "github.com/golang/protobuf/ptypes/wrappers",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":wrappers",
++ visibility = ["//visibility:public"],
++)
diff --git a/third_party/com_github_kevinburke_go_bindata-gazelle.patch b/third_party/com_github_kevinburke_go_bindata-gazelle.patch
new file mode 100644
index 00000000..a9c0cba3
--- /dev/null
+++ b/third_party/com_github_kevinburke_go_bindata-gazelle.patch
@@ -0,0 +1,95 @@
+diff -urN a/BUILD.bazel b/BUILD.bazel
+--- a/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500
++++ b/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "go_default_library",
++ srcs = [
++ "asset.go",
++ "bits.go",
++ "bytewriter.go",
++ "config.go",
++ "convert.go",
++ "debug.go",
++ "doc.go",
++ "release.go",
++ "restore.go",
++ "safefile.go",
++ "stringwriter.go",
++ "toc.go",
++ ],
++ importpath = "github.com/kevinburke/go-bindata",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "go_default_test",
++ srcs = [
++ "benchmark_test.go",
++ "convert_test.go",
++ "release_test.go",
++ "safefile_test.go",
++ ],
++ embed = [":go_default_library"],
++)
+diff -urN a/go-bindata/BUILD.bazel b/go-bindata/BUILD.bazel
+--- a/go-bindata/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500
++++ b/go-bindata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "go_default_library",
++ srcs = [
++ "AppendSliceValue.go",
++ "main.go",
++ "version.go",
++ ],
++ importpath = "github.com/kevinburke/go-bindata/go-bindata",
++ visibility = ["//visibility:private"],
++ deps = ["//:go_default_library"],
++)
++
++go_binary(
++ name = "go-bindata",
++ embed = [":go_default_library"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/testdata/assets/BUILD.bazel b/testdata/assets/BUILD.bazel
+--- a/testdata/assets/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500
++++ b/testdata/assets/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,8 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "go_default_library",
++ srcs = ["bindata.go"],
++ importpath = "github.com/kevinburke/go-bindata/testdata/assets",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/testdata/out/BUILD.bazel b/testdata/out/BUILD.bazel
+--- a/testdata/out/BUILD.bazel 1969-12-31 19:00:00.000000000 -0500
++++ b/testdata/out/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "go_default_library",
++ srcs = [
++ "compress-memcopy.go",
++ "compress-nomemcopy.go",
++ "debug.go",
++ "nocompress-memcopy.go",
++ "nocompress-nomemcopy.go",
++ ],
++ importpath = "github.com/kevinburke/go-bindata/testdata/out",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "out",
++ embed = [":go_default_library"],
++ visibility = ["//visibility:public"],
++)
diff --git a/third_party/go_googleapis-deletebuild.patch b/third_party/go_googleapis-deletebuild.patch
new file mode 100644
index 00000000..cc6654dd
--- /dev/null
+++ b/third_party/go_googleapis-deletebuild.patch
@@ -0,0 +1,137372 @@
+diff -urN a/BUILD.bazel b/BUILD.bazel
+--- a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,5 +0,0 @@
+-alias(
+- name = "build_gen",
+- actual = "@rules_gapic//bazel:build_file_generator",
+-)
+-
+diff -urN a/gapic/metadata/BUILD.bazel b/gapic/metadata/BUILD.bazel
+--- a/gapic/metadata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/gapic/metadata/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,157 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "metadata_proto",
+- srcs = [
+- "gapic_metadata.proto",
+- ],
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "metadata_java_proto",
+- deps = [":metadata_proto"],
+-)
+-
+-java_grpc_library(
+- name = "metadata_java_grpc",
+- srcs = [":metadata_proto"],
+- deps = [":metadata_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "metadata_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/gapic/metadata",
+- protos = [":metadata_proto"],
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "metadata_moved_proto",
+- srcs = [":metadata_proto"],
+- deps = [
+- ],
+-)
+-
+-py_proto_library(
+- name = "metadata_py_proto",
+- deps = [":metadata_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "metadata_py_grpc",
+- srcs = [":metadata_moved_proto"],
+- deps = [":metadata_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "metadata_php_proto",
+- deps = [":metadata_proto"],
+-)
+-
+-php_grpc_library(
+- name = "metadata_php_grpc",
+- srcs = [":metadata_proto"],
+- deps = [":metadata_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "metadata_ruby_proto",
+- deps = [":metadata_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "metadata_ruby_grpc",
+- srcs = [":metadata_proto"],
+- deps = [":metadata_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "metadata_csharp_proto",
+- deps = [":metadata_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "metadata_csharp_grpc",
+- srcs = [":metadata_proto"],
+- deps = [":metadata_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/actions/sdk/v2/BUILD.bazel b/google/actions/sdk/v2/BUILD.bazel
+--- a/google/actions/sdk/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/actions/sdk/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,107 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "sdk_proto",
+- srcs = [
+- "account_linking.proto",
+- "account_linking_secret.proto",
+- "action.proto",
+- "actions_sdk.proto",
+- "actions_testing.proto",
+- "config_file.proto",
+- "data_file.proto",
+- "event_logs.proto",
+- "files.proto",
+- "localized_settings.proto",
+- "manifest.proto",
+- "release_channel.proto",
+- "settings.proto",
+- "surface.proto",
+- "theme_customization.proto",
+- "validation_results.proto",
+- "version.proto",
+- "webhook.proto",
+- ],
+- deps = [
+- "//google/actions/sdk/v2/conversation:conversation_proto",
+- "//google/actions/sdk/v2/conversation/prompt:prompt_proto",
+- "//google/actions/sdk/v2/conversation/prompt/content:content_proto",
+- "//google/actions/sdk/v2/interactionmodel:interactionmodel_proto",
+- "//google/actions/sdk/v2/interactionmodel/prompt:prompt_proto",
+- "//google/actions/sdk/v2/interactionmodel/prompt/content:content_proto",
+- "//google/actions/sdk/v2/interactionmodel/type:type_proto",
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "sdk_proto_with_info",
+- deps = [
+- ":sdk_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "sdk_nodejs_gapic",
+- package_name = "@assistant/actions",
+- src = ":sdk_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "actions_grpc_service_config.json",
+- package = "google.actions.sdk.v2",
+- rest_numeric_enums = False,
+- service_yaml = "actions_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "actions-v2-nodejs",
+- deps = [
+- ":sdk_nodejs_gapic",
+- ":sdk_proto",
+- "//google/actions/sdk/v2/conversation:conversation_proto",
+- "//google/actions/sdk/v2/conversation/prompt:prompt_proto",
+- "//google/actions/sdk/v2/conversation/prompt/content:content_proto",
+- "//google/actions/sdk/v2/interactionmodel:interactionmodel_proto",
+- "//google/actions/sdk/v2/interactionmodel/prompt:prompt_proto",
+- "//google/actions/sdk/v2/interactionmodel/prompt/content:content_proto",
+- "//google/actions/sdk/v2/interactionmodel/type:type_proto",
+- ],
+-)
+diff -urN a/google/actions/sdk/v2/conversation/BUILD.bazel b/google/actions/sdk/v2/conversation/BUILD.bazel
+--- a/google/actions/sdk/v2/conversation/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/actions/sdk/v2/conversation/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,30 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "conversation_proto",
+- srcs = [
+- "intent.proto",
+- "scene.proto",
+- ],
+- deps = [
+- "//google/actions/sdk/v2/conversation/prompt:prompt_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+diff -urN a/google/actions/sdk/v2/conversation/prompt/BUILD.bazel b/google/actions/sdk/v2/conversation/prompt/BUILD.bazel
+--- a/google/actions/sdk/v2/conversation/prompt/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/actions/sdk/v2/conversation/prompt/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,30 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "prompt_proto",
+- srcs = [
+- "prompt.proto",
+- "simple.proto",
+- "suggestion.proto",
+- ],
+- deps = [
+- "//google/actions/sdk/v2/conversation/prompt/content:content_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+diff -urN a/google/actions/sdk/v2/conversation/prompt/content/BUILD.bazel b/google/actions/sdk/v2/conversation/prompt/content/BUILD.bazel
+--- a/google/actions/sdk/v2/conversation/prompt/content/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/actions/sdk/v2/conversation/prompt/content/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,37 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "content_proto",
+- srcs = [
+- "canvas.proto",
+- "card.proto",
+- "collection.proto",
+- "content.proto",
+- "image.proto",
+- "link.proto",
+- "list.proto",
+- "media.proto",
+- "table.proto",
+- ],
+- deps = [
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+diff -urN a/google/actions/sdk/v2/interactionmodel/BUILD.bazel b/google/actions/sdk/v2/interactionmodel/BUILD.bazel
+--- a/google/actions/sdk/v2/interactionmodel/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/actions/sdk/v2/interactionmodel/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,38 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "interactionmodel_proto",
+- srcs = [
+- "conditional_event.proto",
+- "entity_set.proto",
+- "event_handler.proto",
+- "global_intent_event.proto",
+- "intent.proto",
+- "intent_event.proto",
+- "scene.proto",
+- "slot.proto",
+- ],
+- deps = [
+- "//google/actions/sdk/v2/interactionmodel/prompt:prompt_proto",
+- "//google/actions/sdk/v2/interactionmodel/type:type_proto",
+- "//google/api:field_behavior_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+diff -urN a/google/actions/sdk/v2/interactionmodel/prompt/BUILD.bazel b/google/actions/sdk/v2/interactionmodel/prompt/BUILD.bazel
+--- a/google/actions/sdk/v2/interactionmodel/prompt/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/actions/sdk/v2/interactionmodel/prompt/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,32 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "prompt_proto",
+- srcs = [
+- "static_prompt.proto",
+- "static_simple_prompt.proto",
+- "suggestion.proto",
+- "surface_capabilities.proto",
+- ],
+- deps = [
+- "//google/actions/sdk/v2/interactionmodel/prompt/content:content_proto",
+- "//google/api:field_behavior_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+diff -urN a/google/actions/sdk/v2/interactionmodel/prompt/content/BUILD.bazel b/google/actions/sdk/v2/interactionmodel/prompt/content/BUILD.bazel
+--- a/google/actions/sdk/v2/interactionmodel/prompt/content/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/actions/sdk/v2/interactionmodel/prompt/content/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "content_proto",
+- srcs = [
+- "static_canvas_prompt.proto",
+- "static_card_prompt.proto",
+- "static_collection_browse_prompt.proto",
+- "static_collection_prompt.proto",
+- "static_content_prompt.proto",
+- "static_image_prompt.proto",
+- "static_link_prompt.proto",
+- "static_list_prompt.proto",
+- "static_media_prompt.proto",
+- "static_table_prompt.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+diff -urN a/google/actions/sdk/v2/interactionmodel/type/BUILD.bazel b/google/actions/sdk/v2/interactionmodel/type/BUILD.bazel
+--- a/google/actions/sdk/v2/interactionmodel/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/actions/sdk/v2/interactionmodel/type/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,33 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "type_proto",
+- srcs = [
+- "class_reference.proto",
+- "entity_display.proto",
+- "free_text_type.proto",
+- "regular_expression_type.proto",
+- "synonym_type.proto",
+- "type.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+diff -urN a/google/actions/type/BUILD.bazel b/google/actions/type/BUILD.bazel
+--- a/google/actions/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/actions/type/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,167 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "date_range_proto",
+- srcs = ["date_range.proto"],
+- deps = [
+- "//google/type:date_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "datetime_range_proto",
+- srcs = ["datetime_range.proto"],
+- deps = [
+- "//google/type:datetime_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "type_java_proto",
+- deps = [
+- ":date_range_proto",
+- ":datetime_range_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "date_range_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/date_range",
+- protos = [
+- ":date_range_proto",
+- ],
+- deps = ["//google/type:date_go_proto"],
+-)
+-
+-
+-go_proto_library(
+- name = "datetime_range_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/datetime_range",
+- protos = [
+- ":datetime_range_proto",
+- ],
+- deps = ["//google/type:datetime_go_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "date_range_py_proto",
+- deps = [":date_range_proto"],
+-)
+-
+-py_proto_library(
+- name = "datetime_range_py_proto",
+- deps = [":datetime_range_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "date_range_php_proto",
+- deps = [":date_range_proto"],
+-)
+-
+-php_proto_library(
+- name = "datetime_range_php_proto",
+- deps = [":datetime_range_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "date_range_ruby_proto",
+- deps = [":date_range_proto"],
+-)
+-
+-ruby_proto_library(
+- name = "datetime_range_ruby_proto",
+- deps = [":datetime_range_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "date_range_csharp_proto",
+- deps = [":date_range_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "datetime_range_csharp_proto",
+- deps = [":datetime_range_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "date_range_cc_proto",
+- deps = [
+- ":date_range_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "datetime_range_cc_proto",
+- deps = [
+- ":datetime_range_proto",
+- ],
+-)
+diff -urN a/google/ads/admob/BUILD.bazel b/google/ads/admob/BUILD.bazel
+--- a/google/ads/admob/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/admob/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(["admob_grpc_service_config.json"] + glob(["*.yaml"]))
+diff -urN a/google/ads/admob/v1/BUILD.bazel b/google/ads/admob/v1/BUILD.bazel
+--- a/google/ads/admob/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/admob/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,373 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "admob_proto",
+- srcs = [
+- "admob_api.proto",
+- "admob_resources.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/type:date_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "admob_proto_with_info",
+- deps = [
+- ":admob_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "admob_java_proto",
+- deps = [":admob_proto"],
+-)
+-
+-java_grpc_library(
+- name = "admob_java_grpc",
+- srcs = [":admob_proto"],
+- deps = [":admob_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "admob_java_gapic",
+- srcs = [
+- ":admob_proto_with_info",
+- ],
+- gapic_yaml = "admob_gapic.yaml",
+- grpc_service_config = "//google/ads/admob:admob_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":admob_java_grpc",
+- ],
+- transport = "rest",
+- deps = [
+- ":admob_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "admob_java_gapic_test_suite",
+- test_classes = [
+- "com.google.ads.admob.v1.AdMobApiClientTest",
+- ],
+- runtime_deps = [":admob_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-ads-admob-v1-java",
+- transport = "rest",
+- deps = [
+- ":admob_java_gapic",
+- ":admob_java_grpc",
+- ":admob_java_proto",
+- ":admob_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "admob_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/ads/admob/v1",
+- protos = [":admob_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:date_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "admob_go_gapic",
+- srcs = [":admob_proto_with_info"],
+- grpc_service_config = None,
+- importpath = "google.golang.org/google/ads/admob/v1;admob",
+- rest_numeric_enums = False,
+- service_yaml = "//google/ads/admob:admob_v1.yaml",
+- transport = "rest",
+- deps = [
+- ":admob_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "admob_go_gapic_test",
+- srcs = [":admob_go_gapic_srcjar_test"],
+- embed = [":admob_go_gapic"],
+- importpath = "google.golang.org/google/ads/admob/v1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-ads-admob-v1-go",
+- deps = [
+- ":admob_go_gapic",
+- ":admob_go_gapic_srcjar-test.srcjar",
+- ":admob_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_grpc_library",
+- "py_proto_library",
+- "py_test",
+-)
+-
+-py_proto_library(
+- name = "admob_py_proto",
+- deps = [":admob_proto"],
+-)
+-
+-py_grpc_library(
+- name = "admob_py_grpc",
+- srcs = [":admob_proto"],
+- deps = [":admob_py_proto"],
+-)
+-
+-py_gapic_library(
+- name = "admob_py_gapic",
+- srcs = [
+- ":admob_proto_with_info",
+- ],
+- rest_numeric_enums = False,
+- transport = "rest",
+-)
+-
+-py_test(
+- name = "admob_py_gapic_test",
+- srcs = [
+- "admob_py_gapic_pytest.py",
+- "admob_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":admob_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "ads-admob-v1-py",
+- deps = [
+- ":admob_py_gapic",
+- ":admob_py_grpc",
+- ":admob_py_proto",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "admob_php_proto",
+- deps = [":admob_proto"],
+-)
+-
+-php_grpc_library(
+- name = "admob_php_grpc",
+- srcs = [":admob_proto"],
+- deps = [":admob_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "admob_php_gapic",
+- srcs = [":admob_proto"],
+- gapic_yaml = "admob_gapic.yaml",
+- grpc_service_config = None,
+- rest_numeric_enums = False,
+- service_yaml = "//google/ads/admob:admob_v1.yaml",
+- transport = "rest",
+- deps = [
+- ":admob_php_grpc",
+- ":admob_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-ads-admob-v1-php",
+- deps = [
+- ":admob_php_gapic",
+- ":admob_php_grpc",
+- ":admob_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "admob_nodejs_gapic",
+- src = ":admob_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = None,
+- package = "google.ads.admob.v1",
+- rest_numeric_enums = False,
+- service_yaml = "//google/ads/admob:admob_v1.yaml",
+- transport = "rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "ads-admob-v1-nodejs",
+- deps = [
+- ":admob_nodejs_gapic",
+- ":admob_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "admob_ruby_proto",
+- deps = [":admob_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "admob_ruby_grpc",
+- srcs = [":admob_proto"],
+- deps = [":admob_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "admob_ruby_gapic",
+- srcs = [":admob_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-admob-v1"],
+- grpc_service_config = None,
+- rest_numeric_enums = False,
+- deps = [
+- ":admob_ruby_grpc",
+- ":admob_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-ads-admob-v1-ruby",
+- deps = [
+- ":admob_ruby_gapic",
+- ":admob_ruby_grpc",
+- ":admob_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "admob_csharp_proto",
+- deps = [":admob_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "admob_csharp_grpc",
+- srcs = [":admob_proto"],
+- deps = [":admob_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "admob_csharp_gapic",
+- srcs = [":admob_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":admob_csharp_grpc",
+- ":admob_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-ads-admob-v1-csharp",
+- deps = [
+- ":admob_csharp_gapic",
+- ":admob_csharp_grpc",
+- ":admob_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/ads/googleads/v10/BUILD.bazel b/google/ads/googleads/v10/BUILD.bazel
+--- a/google/ads/googleads/v10/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v10/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,266 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-exports_files(["googleads_grpc_service_config.json"] + ["*.yaml"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "googleads_proto",
+- srcs = [],
+- deps = [
+- "//google/ads/googleads/v10/common:common_proto",
+- "//google/ads/googleads/v10/enums:enums_proto",
+- "//google/ads/googleads/v10/errors:errors_proto",
+- "//google/ads/googleads/v10/resources:resources_proto",
+- "//google/ads/googleads/v10/services:services_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "googleads_proto_with_info",
+- deps = [
+- ":googleads_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+-)
+-
+-java_gapic_library(
+- name = "googleads_java_gapic",
+- srcs = [
+- ":googleads_proto_with_info",
+- ],
+- gapic_yaml = "googleads_gapic.yaml",
+- grpc_service_config = ":googleads_grpc_service_config.json",
+- deps = [
+- "//google/ads/googleads/v10/common:common_java_proto",
+- "//google/ads/googleads/v10/enums:enums_java_proto",
+- "//google/ads/googleads/v10/resources:resources_java_proto",
+- "//google/ads/googleads/v10/services:services_java_grpc",
+- "//google/ads/googleads/v10/services:services_java_proto",
+- ],
+-)
+-
+-# TODO(ohren): Add more test classes when java_gapic_test is able to run more
+-# than a single test. Having at least one verifies proper compilation at least.
+-java_gapic_test(
+- name = "googleads_java_gapic_suite",
+- test_classes = [
+- "com.google.ads.googleads.v10.services.CampaignServiceClientTest",
+- ],
+- runtime_deps = [":googleads_java_gapic_test"],
+-)
+-
+-java_gapic_assembly_gradle_pkg(
+- name = "googleads-java",
+- deps = [
+- ":googleads_java_gapic",
+- "//google/ads/googleads/v10:googleads_proto",
+- "//google/ads/googleads/v10/common:common_java_proto",
+- "//google/ads/googleads/v10/enums:enums_java_proto",
+- "//google/ads/googleads/v10/errors:errors_java_proto",
+- "//google/ads/googleads/v10/resources:resources_java_proto",
+- "//google/ads/googleads/v10/services:services_java_grpc",
+- "//google/ads/googleads/v10/services:services_java_proto",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "googleads_php_proto",
+- plugin_args = ["aggregate_metadata=google.ads.googleads"],
+- deps = [":googleads_proto"],
+-)
+-
+-php_grpc_library(
+- name = "googleads_php_grpc",
+- srcs = [":googleads_proto"],
+- deps = [":googleads_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "googleads_php_gapic",
+- srcs = [":googleads_proto"],
+- gapic_yaml = "googleads_gapic.yaml",
+- grpc_service_config = "googleads_grpc_service_config.json",
+- service_yaml = "googleads_v10.yaml",
+- deps = [
+- ":googleads_php_grpc",
+- ":googleads_php_proto",
+- ],
+-)
+-
+-php_gapic_assembly_pkg(
+- name = "googleads-php",
+- deps = [
+- ":googleads_php_gapic",
+- ":googleads_php_grpc",
+- ":googleads_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+-)
+-
+-csharp_gapic_library(
+- name = "googleads_csharp_gapic",
+- srcs = [
+- ":googleads_proto_with_info",
+- ],
+- grpc_service_config = "googleads_grpc_service_config.json",
+- deps = [
+- "//google/ads/googleads/v10/services:services_csharp_grpc",
+- ],
+-)
+-
+-csharp_gapic_assembly_pkg(
+- name = "googleads-csharp",
+- deps = [
+- ":googleads_csharp_gapic",
+- "//google/ads/googleads/v10/common:common_csharp_proto",
+- "//google/ads/googleads/v10/enums:enums_csharp_proto",
+- "//google/ads/googleads/v10/errors:errors_csharp_proto",
+- "//google/ads/googleads/v10/resources:resources_csharp_proto",
+- "//google/ads/googleads/v10/services:services_csharp_grpc",
+- "//google/ads/googleads/v10/services:services_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_ads_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-ruby_ads_gapic_library(
+- name = "googleads_ruby_gapic",
+- srcs = ["googleads_proto_with_info"],
+- extra_protoc_parameters = [
+- ":gem.:name=google-ads-googleads",
+- ":defaults.:service.:default_host=googleads.googleapis.com",
+- ":overrides.:namespace.Googleads=GoogleAds",
+- ],
+- grpc_service_config = "googleads_grpc_service_config.json",
+-)
+-
+-ruby_gapic_assembly_pkg(
+- name = "googleads-ruby",
+- deps = [
+- ":googleads_ruby_gapic",
+- "//google/ads/googleads/v10/common:common_ruby_proto",
+- "//google/ads/googleads/v10/enums:enums_ruby_proto",
+- "//google/ads/googleads/v10/errors:errors_ruby_proto",
+- "//google/ads/googleads/v10/resources:resources_ruby_proto",
+- "//google/ads/googleads/v10/services:services_ruby_grpc",
+- "//google/ads/googleads/v10/services:services_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "googleads_py_gapic",
+- srcs = [":googleads_proto_with_info"],
+- grpc_service_config = "googleads_grpc_service_config.json",
+- opt_args = [
+- "old-naming",
+- "lazy-import",
+- "python-gapic-name=googleads",
+- "python-gapic-templates=ads-templates",
+- "warehouse-package-name=google-ads",
+- ],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "googleads-py",
+- deps = [
+- ":googleads_py_gapic",
+- "//google/ads/googleads/v10/common:common_py_proto",
+- "//google/ads/googleads/v10/enums:enums_py_proto",
+- "//google/ads/googleads/v10/errors:errors_py_proto",
+- "//google/ads/googleads/v10/resources:resources_py_proto",
+- "//google/ads/googleads/v10/services:services_py_grpc",
+- "//google/ads/googleads/v10/services:services_py_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "googleads_nodejs_gapic",
+- package_name = "google-ads",
+- src = ":googleads_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "googleads_grpc_service_config.json",
+- main_service = "GoogleAdsService",
+- package = "google.ads.googleads.v10",
+- service_yaml = "googleads_v10.yaml",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "googleads-nodejs",
+- deps = [
+- ":googleads_nodejs_gapic",
+- ":googleads_proto",
+- ],
+-)
+diff -urN a/google/ads/googleads/v10/common/BUILD.bazel b/google/ads/googleads/v10/common/BUILD.bazel
+--- a/google/ads/googleads/v10/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v10/common/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,94 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# TODO(ohren): Change srcs to use an enumeration of each individual proto
+-# instead of *.proto globbing once the build file generator supports
+-# subpackages.
+-proto_library(
+- name = "common_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/ads/googleads/v10/enums:enums_proto",
+- "//google/api:annotations_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "common_java_proto",
+- deps = [":common_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-# PHP targets are in the parent directory's BUILD.bazel file to facilitate
+-# aggregating metadata using a single underlying call to protoc.
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "common_csharp_proto",
+- deps = [":common_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "common_ruby_proto",
+- deps = [":common_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "common_py_proto",
+- deps = [":common_proto"],
+-)
+diff -urN a/google/ads/googleads/v10/enums/BUILD.bazel b/google/ads/googleads/v10/enums/BUILD.bazel
+--- a/google/ads/googleads/v10/enums/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v10/enums/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,89 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# TODO(ohren): Change srcs to use an enumeration of each individual proto
+-# instead of *.proto globbing once the build file generator supports subpackages.
+-proto_library(
+- name = "enums_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "enums_java_proto",
+- deps = [":enums_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-# PHP targets are in the parent directory's BUILD.bazel file to facilitate
+-# aggregating metadata using a single underlying call to protoc.
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "enums_csharp_proto",
+- deps = [":enums_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "enums_ruby_proto",
+- deps = [":enums_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "enums_py_proto",
+- deps = [":enums_proto"],
+-)
+diff -urN a/google/ads/googleads/v10/errors/BUILD.bazel b/google/ads/googleads/v10/errors/BUILD.bazel
+--- a/google/ads/googleads/v10/errors/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v10/errors/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,94 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# TODO(ohren): Change srcs to use an enumeration of each individual proto
+-# instead of *.proto globbing once the build file generator supports
+-# subpackages.
+-proto_library(
+- name = "errors_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/ads/googleads/v10/common:common_proto",
+- "//google/ads/googleads/v10/enums:enums_proto",
+- "//google/api:annotations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "errors_java_proto",
+- deps = [":errors_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-# PHP targets are in the parent directory's BUILD.bazel file to facilitate
+-# aggregating metadata using a single underlying call to protoc.
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "errors_csharp_proto",
+- deps = [":errors_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "errors_ruby_proto",
+- deps = [":errors_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "errors_py_proto",
+- deps = [":errors_proto"],
+-)
+diff -urN a/google/ads/googleads/v10/resources/BUILD.bazel b/google/ads/googleads/v10/resources/BUILD.bazel
+--- a/google/ads/googleads/v10/resources/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v10/resources/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,97 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# TODO(ohren): Change srcs to use an enumeration of each individual proto
+-# instead of *.proto globbing once the build file generator supports
+-# subpackages.
+-proto_library(
+- name = "resources_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/ads/googleads/v10/common:common_proto",
+- "//google/ads/googleads/v10/enums:enums_proto",
+- "//google/ads/googleads/v10/errors:errors_proto",
+- "//google/api:annotations_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "resources_java_proto",
+- deps = [":resources_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-# PHP targets are in the parent directory's BUILD.bazel file to facilitate
+-# aggregating metadata using a single underlying call to protoc.
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "resources_csharp_proto",
+- deps = [":resources_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "resources_ruby_proto",
+- deps = [":resources_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "resources_py_proto",
+- deps = [":resources_proto"],
+-)
+diff -urN a/google/ads/googleads/v10/services/BUILD.bazel b/google/ads/googleads/v10/services/BUILD.bazel
+--- a/google/ads/googleads/v10/services/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v10/services/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,138 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-# TODO(ohren): Change srcs to use an enumeration of each individual proto
+-# instead of *.proto globbing once the build file generator supports
+-# subpackages.
+-proto_library(
+- name = "services_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/ads/googleads/v10/common:common_proto",
+- "//google/ads/googleads/v10/enums:enums_proto",
+- "//google/ads/googleads/v10/errors:errors_proto",
+- "//google/ads/googleads/v10/resources:resources_proto",
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "services_proto_with_info",
+- deps = [
+- ":services_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "services_java_proto",
+- deps = [":services_proto"],
+-)
+-
+-java_grpc_library(
+- name = "services_java_grpc",
+- srcs = [":services_proto"],
+- deps = [":services_java_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-# PHP targets are in the parent directory's BUILD.bazel file to facilitate
+-# aggregating metadata using a single underlying call to protoc.
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "services_csharp_proto",
+- deps = [":services_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "services_csharp_grpc",
+- srcs = [":services_proto"],
+- deps = [":services_csharp_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "services_ruby_proto",
+- deps = [":services_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "services_ruby_grpc",
+- srcs = [":services_proto"],
+- deps = [":services_ruby_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "services_py_proto",
+- deps = [":services_proto"],
+-)
+-
+-py_grpc_library(
+- name = "services_py_grpc",
+- srcs = [":services_proto"],
+- deps = [":services_py_proto"],
+-)
+diff -urN a/google/ads/googleads/v11/BUILD.bazel b/google/ads/googleads/v11/BUILD.bazel
+--- a/google/ads/googleads/v11/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v11/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,266 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-exports_files(["googleads_grpc_service_config.json"] + ["*.yaml"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "googleads_proto",
+- srcs = [],
+- deps = [
+- "//google/ads/googleads/v11/common:common_proto",
+- "//google/ads/googleads/v11/enums:enums_proto",
+- "//google/ads/googleads/v11/errors:errors_proto",
+- "//google/ads/googleads/v11/resources:resources_proto",
+- "//google/ads/googleads/v11/services:services_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "googleads_proto_with_info",
+- deps = [
+- ":googleads_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+-)
+-
+-java_gapic_library(
+- name = "googleads_java_gapic",
+- srcs = [
+- ":googleads_proto_with_info",
+- ],
+- gapic_yaml = "googleads_gapic.yaml",
+- grpc_service_config = ":googleads_grpc_service_config.json",
+- deps = [
+- "//google/ads/googleads/v11/common:common_java_proto",
+- "//google/ads/googleads/v11/enums:enums_java_proto",
+- "//google/ads/googleads/v11/resources:resources_java_proto",
+- "//google/ads/googleads/v11/services:services_java_grpc",
+- "//google/ads/googleads/v11/services:services_java_proto",
+- ],
+-)
+-
+-# TODO(ohren): Add more test classes when java_gapic_test is able to run more
+-# than a single test. Having at least one verifies proper compilation at least.
+-java_gapic_test(
+- name = "googleads_java_gapic_suite",
+- test_classes = [
+- "com.google.ads.googleads.v11.services.CampaignServiceClientTest",
+- ],
+- runtime_deps = [":googleads_java_gapic_test"],
+-)
+-
+-java_gapic_assembly_gradle_pkg(
+- name = "googleads-java",
+- deps = [
+- ":googleads_java_gapic",
+- "//google/ads/googleads/v11:googleads_proto",
+- "//google/ads/googleads/v11/common:common_java_proto",
+- "//google/ads/googleads/v11/enums:enums_java_proto",
+- "//google/ads/googleads/v11/errors:errors_java_proto",
+- "//google/ads/googleads/v11/resources:resources_java_proto",
+- "//google/ads/googleads/v11/services:services_java_grpc",
+- "//google/ads/googleads/v11/services:services_java_proto",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "googleads_php_proto",
+- plugin_args = ["aggregate_metadata=google.ads.googleads"],
+- deps = [":googleads_proto"],
+-)
+-
+-php_grpc_library(
+- name = "googleads_php_grpc",
+- srcs = [":googleads_proto"],
+- deps = [":googleads_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "googleads_php_gapic",
+- srcs = [":googleads_proto"],
+- gapic_yaml = "googleads_gapic.yaml",
+- grpc_service_config = "googleads_grpc_service_config.json",
+- service_yaml = "googleads_v11.yaml",
+- deps = [
+- ":googleads_php_grpc",
+- ":googleads_php_proto",
+- ],
+-)
+-
+-php_gapic_assembly_pkg(
+- name = "googleads-php",
+- deps = [
+- ":googleads_php_gapic",
+- ":googleads_php_grpc",
+- ":googleads_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+-)
+-
+-csharp_gapic_library(
+- name = "googleads_csharp_gapic",
+- srcs = [
+- ":googleads_proto_with_info",
+- ],
+- grpc_service_config = "googleads_grpc_service_config.json",
+- deps = [
+- "//google/ads/googleads/v11/services:services_csharp_grpc",
+- ],
+-)
+-
+-csharp_gapic_assembly_pkg(
+- name = "googleads-csharp",
+- deps = [
+- ":googleads_csharp_gapic",
+- "//google/ads/googleads/v11/common:common_csharp_proto",
+- "//google/ads/googleads/v11/enums:enums_csharp_proto",
+- "//google/ads/googleads/v11/errors:errors_csharp_proto",
+- "//google/ads/googleads/v11/resources:resources_csharp_proto",
+- "//google/ads/googleads/v11/services:services_csharp_grpc",
+- "//google/ads/googleads/v11/services:services_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_ads_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-ruby_ads_gapic_library(
+- name = "googleads_ruby_gapic",
+- srcs = ["googleads_proto_with_info"],
+- extra_protoc_parameters = [
+- ":gem.:name=google-ads-googleads",
+- ":defaults.:service.:default_host=googleads.googleapis.com",
+- ":overrides.:namespace.Googleads=GoogleAds",
+- ],
+- grpc_service_config = "googleads_grpc_service_config.json",
+-)
+-
+-ruby_gapic_assembly_pkg(
+- name = "googleads-ruby",
+- deps = [
+- ":googleads_ruby_gapic",
+- "//google/ads/googleads/v11/common:common_ruby_proto",
+- "//google/ads/googleads/v11/enums:enums_ruby_proto",
+- "//google/ads/googleads/v11/errors:errors_ruby_proto",
+- "//google/ads/googleads/v11/resources:resources_ruby_proto",
+- "//google/ads/googleads/v11/services:services_ruby_grpc",
+- "//google/ads/googleads/v11/services:services_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "googleads_py_gapic",
+- srcs = [":googleads_proto_with_info"],
+- grpc_service_config = "googleads_grpc_service_config.json",
+- opt_args = [
+- "old-naming",
+- "lazy-import",
+- "python-gapic-name=googleads",
+- "python-gapic-templates=ads-templates",
+- "warehouse-package-name=google-ads",
+- ],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "googleads-py",
+- deps = [
+- ":googleads_py_gapic",
+- "//google/ads/googleads/v11/common:common_py_proto",
+- "//google/ads/googleads/v11/enums:enums_py_proto",
+- "//google/ads/googleads/v11/errors:errors_py_proto",
+- "//google/ads/googleads/v11/resources:resources_py_proto",
+- "//google/ads/googleads/v11/services:services_py_grpc",
+- "//google/ads/googleads/v11/services:services_py_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "googleads_nodejs_gapic",
+- package_name = "google-ads",
+- src = ":googleads_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "googleads_grpc_service_config.json",
+- main_service = "GoogleAdsService",
+- package = "google.ads.googleads.v11",
+- service_yaml = "googleads_v11.yaml",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "googleads-nodejs",
+- deps = [
+- ":googleads_nodejs_gapic",
+- ":googleads_proto",
+- ],
+-)
+diff -urN a/google/ads/googleads/v11/common/BUILD.bazel b/google/ads/googleads/v11/common/BUILD.bazel
+--- a/google/ads/googleads/v11/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v11/common/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,94 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# TODO(ohren): Change srcs to use an enumeration of each individual proto
+-# instead of *.proto globbing once the build file generator supports
+-# subpackages.
+-proto_library(
+- name = "common_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/ads/googleads/v11/enums:enums_proto",
+- "//google/api:annotations_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "common_java_proto",
+- deps = [":common_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-# PHP targets are in the parent directory's BUILD.bazel file to facilitate
+-# aggregating metadata using a single underlying call to protoc.
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "common_csharp_proto",
+- deps = [":common_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "common_ruby_proto",
+- deps = [":common_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "common_py_proto",
+- deps = [":common_proto"],
+-)
+diff -urN a/google/ads/googleads/v11/enums/BUILD.bazel b/google/ads/googleads/v11/enums/BUILD.bazel
+--- a/google/ads/googleads/v11/enums/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v11/enums/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,89 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# TODO(ohren): Change srcs to use an enumeration of each individual proto
+-# instead of *.proto globbing once the build file generator supports subpackages.
+-proto_library(
+- name = "enums_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "enums_java_proto",
+- deps = [":enums_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-# PHP targets are in the parent directory's BUILD.bazel file to facilitate
+-# aggregating metadata using a single underlying call to protoc.
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "enums_csharp_proto",
+- deps = [":enums_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "enums_ruby_proto",
+- deps = [":enums_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "enums_py_proto",
+- deps = [":enums_proto"],
+-)
+diff -urN a/google/ads/googleads/v11/errors/BUILD.bazel b/google/ads/googleads/v11/errors/BUILD.bazel
+--- a/google/ads/googleads/v11/errors/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v11/errors/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,94 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# TODO(ohren): Change srcs to use an enumeration of each individual proto
+-# instead of *.proto globbing once the build file generator supports
+-# subpackages.
+-proto_library(
+- name = "errors_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/ads/googleads/v11/common:common_proto",
+- "//google/ads/googleads/v11/enums:enums_proto",
+- "//google/api:annotations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "errors_java_proto",
+- deps = [":errors_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-# PHP targets are in the parent directory's BUILD.bazel file to facilitate
+-# aggregating metadata using a single underlying call to protoc.
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "errors_csharp_proto",
+- deps = [":errors_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "errors_ruby_proto",
+- deps = [":errors_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "errors_py_proto",
+- deps = [":errors_proto"],
+-)
+diff -urN a/google/ads/googleads/v11/resources/BUILD.bazel b/google/ads/googleads/v11/resources/BUILD.bazel
+--- a/google/ads/googleads/v11/resources/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v11/resources/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,97 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# TODO(ohren): Change srcs to use an enumeration of each individual proto
+-# instead of *.proto globbing once the build file generator supports
+-# subpackages.
+-proto_library(
+- name = "resources_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/ads/googleads/v11/common:common_proto",
+- "//google/ads/googleads/v11/enums:enums_proto",
+- "//google/ads/googleads/v11/errors:errors_proto",
+- "//google/api:annotations_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "resources_java_proto",
+- deps = [":resources_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-# PHP targets are in the parent directory's BUILD.bazel file to facilitate
+-# aggregating metadata using a single underlying call to protoc.
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "resources_csharp_proto",
+- deps = [":resources_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "resources_ruby_proto",
+- deps = [":resources_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "resources_py_proto",
+- deps = [":resources_proto"],
+-)
+diff -urN a/google/ads/googleads/v11/services/BUILD.bazel b/google/ads/googleads/v11/services/BUILD.bazel
+--- a/google/ads/googleads/v11/services/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v11/services/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,138 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-# TODO(ohren): Change srcs to use an enumeration of each individual proto
+-# instead of *.proto globbing once the build file generator supports
+-# subpackages.
+-proto_library(
+- name = "services_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/ads/googleads/v11/common:common_proto",
+- "//google/ads/googleads/v11/enums:enums_proto",
+- "//google/ads/googleads/v11/errors:errors_proto",
+- "//google/ads/googleads/v11/resources:resources_proto",
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "services_proto_with_info",
+- deps = [
+- ":services_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "services_java_proto",
+- deps = [":services_proto"],
+-)
+-
+-java_grpc_library(
+- name = "services_java_grpc",
+- srcs = [":services_proto"],
+- deps = [":services_java_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-# PHP targets are in the parent directory's BUILD.bazel file to facilitate
+-# aggregating metadata using a single underlying call to protoc.
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "services_csharp_proto",
+- deps = [":services_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "services_csharp_grpc",
+- srcs = [":services_proto"],
+- deps = [":services_csharp_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "services_ruby_proto",
+- deps = [":services_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "services_ruby_grpc",
+- srcs = [":services_proto"],
+- deps = [":services_ruby_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "services_py_proto",
+- deps = [":services_proto"],
+-)
+-
+-py_grpc_library(
+- name = "services_py_grpc",
+- srcs = [":services_proto"],
+- deps = [":services_py_proto"],
+-)
+diff -urN a/google/ads/googleads/v12/BUILD.bazel b/google/ads/googleads/v12/BUILD.bazel
+--- a/google/ads/googleads/v12/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v12/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,266 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-exports_files(["googleads_grpc_service_config.json"] + ["*.yaml"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "googleads_proto",
+- srcs = [],
+- deps = [
+- "//google/ads/googleads/v12/common:common_proto",
+- "//google/ads/googleads/v12/enums:enums_proto",
+- "//google/ads/googleads/v12/errors:errors_proto",
+- "//google/ads/googleads/v12/resources:resources_proto",
+- "//google/ads/googleads/v12/services:services_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "googleads_proto_with_info",
+- deps = [
+- ":googleads_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+-)
+-
+-java_gapic_library(
+- name = "googleads_java_gapic",
+- srcs = [
+- ":googleads_proto_with_info",
+- ],
+- gapic_yaml = "googleads_gapic.yaml",
+- grpc_service_config = ":googleads_grpc_service_config.json",
+- deps = [
+- "//google/ads/googleads/v12/common:common_java_proto",
+- "//google/ads/googleads/v12/enums:enums_java_proto",
+- "//google/ads/googleads/v12/resources:resources_java_proto",
+- "//google/ads/googleads/v12/services:services_java_grpc",
+- "//google/ads/googleads/v12/services:services_java_proto",
+- ],
+-)
+-
+-# TODO(ohren): Add more test classes when java_gapic_test is able to run more
+-# than a single test. Having at least one verifies proper compilation at least.
+-java_gapic_test(
+- name = "googleads_java_gapic_suite",
+- test_classes = [
+- "com.google.ads.googleads.v12.services.CampaignServiceClientTest",
+- ],
+- runtime_deps = [":googleads_java_gapic_test"],
+-)
+-
+-java_gapic_assembly_gradle_pkg(
+- name = "googleads-java",
+- deps = [
+- ":googleads_java_gapic",
+- "//google/ads/googleads/v12:googleads_proto",
+- "//google/ads/googleads/v12/common:common_java_proto",
+- "//google/ads/googleads/v12/enums:enums_java_proto",
+- "//google/ads/googleads/v12/errors:errors_java_proto",
+- "//google/ads/googleads/v12/resources:resources_java_proto",
+- "//google/ads/googleads/v12/services:services_java_grpc",
+- "//google/ads/googleads/v12/services:services_java_proto",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "googleads_php_proto",
+- plugin_args = ["aggregate_metadata=google.ads.googleads"],
+- deps = [":googleads_proto"],
+-)
+-
+-php_grpc_library(
+- name = "googleads_php_grpc",
+- srcs = [":googleads_proto"],
+- deps = [":googleads_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "googleads_php_gapic",
+- srcs = [":googleads_proto"],
+- gapic_yaml = "googleads_gapic.yaml",
+- grpc_service_config = "googleads_grpc_service_config.json",
+- service_yaml = "googleads_v12.yaml",
+- deps = [
+- ":googleads_php_grpc",
+- ":googleads_php_proto",
+- ],
+-)
+-
+-php_gapic_assembly_pkg(
+- name = "googleads-php",
+- deps = [
+- ":googleads_php_gapic",
+- ":googleads_php_grpc",
+- ":googleads_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+-)
+-
+-csharp_gapic_library(
+- name = "googleads_csharp_gapic",
+- srcs = [
+- ":googleads_proto_with_info",
+- ],
+- grpc_service_config = "googleads_grpc_service_config.json",
+- deps = [
+- "//google/ads/googleads/v12/services:services_csharp_grpc",
+- ],
+-)
+-
+-csharp_gapic_assembly_pkg(
+- name = "googleads-csharp",
+- deps = [
+- ":googleads_csharp_gapic",
+- "//google/ads/googleads/v12/common:common_csharp_proto",
+- "//google/ads/googleads/v12/enums:enums_csharp_proto",
+- "//google/ads/googleads/v12/errors:errors_csharp_proto",
+- "//google/ads/googleads/v12/resources:resources_csharp_proto",
+- "//google/ads/googleads/v12/services:services_csharp_grpc",
+- "//google/ads/googleads/v12/services:services_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_ads_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-ruby_ads_gapic_library(
+- name = "googleads_ruby_gapic",
+- srcs = ["googleads_proto_with_info"],
+- extra_protoc_parameters = [
+- ":gem.:name=google-ads-googleads",
+- ":defaults.:service.:default_host=googleads.googleapis.com",
+- ":overrides.:namespace.Googleads=GoogleAds",
+- ],
+- grpc_service_config = "googleads_grpc_service_config.json",
+-)
+-
+-ruby_gapic_assembly_pkg(
+- name = "googleads-ruby",
+- deps = [
+- ":googleads_ruby_gapic",
+- "//google/ads/googleads/v12/common:common_ruby_proto",
+- "//google/ads/googleads/v12/enums:enums_ruby_proto",
+- "//google/ads/googleads/v12/errors:errors_ruby_proto",
+- "//google/ads/googleads/v12/resources:resources_ruby_proto",
+- "//google/ads/googleads/v12/services:services_ruby_grpc",
+- "//google/ads/googleads/v12/services:services_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "googleads_py_gapic",
+- srcs = [":googleads_proto_with_info"],
+- grpc_service_config = "googleads_grpc_service_config.json",
+- opt_args = [
+- "old-naming",
+- "lazy-import",
+- "python-gapic-name=googleads",
+- "python-gapic-templates=ads-templates",
+- "warehouse-package-name=google-ads",
+- ],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "googleads-py",
+- deps = [
+- ":googleads_py_gapic",
+- "//google/ads/googleads/v12/common:common_py_proto",
+- "//google/ads/googleads/v12/enums:enums_py_proto",
+- "//google/ads/googleads/v12/errors:errors_py_proto",
+- "//google/ads/googleads/v12/resources:resources_py_proto",
+- "//google/ads/googleads/v12/services:services_py_grpc",
+- "//google/ads/googleads/v12/services:services_py_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "googleads_nodejs_gapic",
+- package_name = "google-ads",
+- src = ":googleads_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "googleads_grpc_service_config.json",
+- main_service = "GoogleAdsService",
+- package = "google.ads.googleads.v12",
+- service_yaml = "googleads_v12.yaml",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "googleads-nodejs",
+- deps = [
+- ":googleads_nodejs_gapic",
+- ":googleads_proto",
+- ],
+-)
+diff -urN a/google/ads/googleads/v12/common/BUILD.bazel b/google/ads/googleads/v12/common/BUILD.bazel
+--- a/google/ads/googleads/v12/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v12/common/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,94 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# TODO(ohren): Change srcs to use an enumeration of each individual proto
+-# instead of *.proto globbing once the build file generator supports
+-# subpackages.
+-proto_library(
+- name = "common_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/ads/googleads/v12/enums:enums_proto",
+- "//google/api:annotations_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "common_java_proto",
+- deps = [":common_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-# PHP targets are in the parent directory's BUILD.bazel file to facilitate
+-# aggregating metadata using a single underlying call to protoc.
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "common_csharp_proto",
+- deps = [":common_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "common_ruby_proto",
+- deps = [":common_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "common_py_proto",
+- deps = [":common_proto"],
+-)
+diff -urN a/google/ads/googleads/v12/enums/BUILD.bazel b/google/ads/googleads/v12/enums/BUILD.bazel
+--- a/google/ads/googleads/v12/enums/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v12/enums/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,89 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# TODO(ohren): Change srcs to use an enumeration of each individual proto
+-# instead of *.proto globbing once the build file generator supports subpackages.
+-proto_library(
+- name = "enums_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "enums_java_proto",
+- deps = [":enums_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-# PHP targets are in the parent directory's BUILD.bazel file to facilitate
+-# aggregating metadata using a single underlying call to protoc.
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "enums_csharp_proto",
+- deps = [":enums_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "enums_ruby_proto",
+- deps = [":enums_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "enums_py_proto",
+- deps = [":enums_proto"],
+-)
+diff -urN a/google/ads/googleads/v12/errors/BUILD.bazel b/google/ads/googleads/v12/errors/BUILD.bazel
+--- a/google/ads/googleads/v12/errors/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v12/errors/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,94 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# TODO(ohren): Change srcs to use an enumeration of each individual proto
+-# instead of *.proto globbing once the build file generator supports
+-# subpackages.
+-proto_library(
+- name = "errors_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/ads/googleads/v12/common:common_proto",
+- "//google/ads/googleads/v12/enums:enums_proto",
+- "//google/api:annotations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "errors_java_proto",
+- deps = [":errors_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-# PHP targets are in the parent directory's BUILD.bazel file to facilitate
+-# aggregating metadata using a single underlying call to protoc.
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "errors_csharp_proto",
+- deps = [":errors_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "errors_ruby_proto",
+- deps = [":errors_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "errors_py_proto",
+- deps = [":errors_proto"],
+-)
+diff -urN a/google/ads/googleads/v12/resources/BUILD.bazel b/google/ads/googleads/v12/resources/BUILD.bazel
+--- a/google/ads/googleads/v12/resources/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v12/resources/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,97 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# TODO(ohren): Change srcs to use an enumeration of each individual proto
+-# instead of *.proto globbing once the build file generator supports
+-# subpackages.
+-proto_library(
+- name = "resources_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/ads/googleads/v12/common:common_proto",
+- "//google/ads/googleads/v12/enums:enums_proto",
+- "//google/ads/googleads/v12/errors:errors_proto",
+- "//google/api:annotations_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "resources_java_proto",
+- deps = [":resources_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-# PHP targets are in the parent directory's BUILD.bazel file to facilitate
+-# aggregating metadata using a single underlying call to protoc.
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "resources_csharp_proto",
+- deps = [":resources_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "resources_ruby_proto",
+- deps = [":resources_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "resources_py_proto",
+- deps = [":resources_proto"],
+-)
+diff -urN a/google/ads/googleads/v12/services/BUILD.bazel b/google/ads/googleads/v12/services/BUILD.bazel
+--- a/google/ads/googleads/v12/services/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/googleads/v12/services/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,138 +0,0 @@
+-# Copyright 2020 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-# TODO(ohren): Change srcs to use an enumeration of each individual proto
+-# instead of *.proto globbing once the build file generator supports
+-# subpackages.
+-proto_library(
+- name = "services_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/ads/googleads/v12/common:common_proto",
+- "//google/ads/googleads/v12/enums:enums_proto",
+- "//google/ads/googleads/v12/errors:errors_proto",
+- "//google/ads/googleads/v12/resources:resources_proto",
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "services_proto_with_info",
+- deps = [
+- ":services_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "services_java_proto",
+- deps = [":services_proto"],
+-)
+-
+-java_grpc_library(
+- name = "services_java_grpc",
+- srcs = [":services_proto"],
+- deps = [":services_java_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-# PHP targets are in the parent directory's BUILD.bazel file to facilitate
+-# aggregating metadata using a single underlying call to protoc.
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "services_csharp_proto",
+- deps = [":services_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "services_csharp_grpc",
+- srcs = [":services_proto"],
+- deps = [":services_csharp_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "services_ruby_proto",
+- deps = [":services_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "services_ruby_grpc",
+- srcs = [":services_proto"],
+- deps = [":services_ruby_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "services_py_proto",
+- deps = [":services_proto"],
+-)
+-
+-py_grpc_library(
+- name = "services_py_grpc",
+- srcs = [":services_proto"],
+- deps = [":services_py_proto"],
+-)
+diff -urN a/google/ads/searchads360/v0/BUILD.bazel b/google/ads/searchads360/v0/BUILD.bazel
+--- a/google/ads/searchads360/v0/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/searchads360/v0/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,122 +0,0 @@
+-# Copyright 2022 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-exports_files(glob(["*.yaml"]) + ["searchads360_grpc_service_config.json"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-
+-proto_library(
+- name = "searchads360_proto",
+- srcs = [],
+- deps = [
+- "//google/ads/searchads360/v0/enums:enums_proto",
+- "//google/ads/searchads360/v0/common:common_proto",
+- "//google/ads/searchads360/v0/resources:resources_proto",
+- "//google/ads/searchads360/v0/services:services_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "searchads360_proto_with_info",
+- deps = [
+- ":searchads360_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+-)
+-
+-java_gapic_library(
+- name = "searchads360_java_gapic",
+- srcs = [
+- ":searchads360_proto_with_info",
+- ],
+- grpc_service_config = ":searchads360_grpc_service_config.json",
+- deps = [
+- "//google/ads/searchads360/v0/enums:enums_java_proto",
+- "//google/ads/searchads360/v0/common:common_java_proto",
+- "//google/ads/searchads360/v0/resources:resources_java_proto",
+- "//google/ads/searchads360/v0/services:services_java_proto",
+- "//google/ads/searchads360/v0/services:services_java_grpc",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "searchads360_java_gapic_suite",
+- test_classes = [
+- "com.google.ads.searchads360.v0.services.SearchAds360ServiceClientTest",
+- ],
+- runtime_deps = [":searchads360_java_gapic_test"],
+-)
+-
+-java_gapic_assembly_gradle_pkg(
+- name = "searchads360-java",
+- deps = [
+- ":searchads360_java_gapic",
+- "//google/ads/searchads360/v0:searchads360_proto",
+- "//google/ads/searchads360/v0/enums:enums_java_proto",
+- "//google/ads/searchads360/v0/common:common_java_proto",
+- "//google/ads/searchads360/v0/resources:resources_java_proto",
+- "//google/ads/searchads360/v0/services:services_java_proto",
+- "//google/ads/searchads360/v0/services:services_java_grpc",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "searchads360_py_gapic",
+- srcs = [":searchads360_proto_with_info"],
+- grpc_service_config = "searchads360_grpc_service_config.json",
+- opt_args = [
+- "old-naming",
+- "lazy-import",
+- "python-gapic-name=searchads360",
+- "python-gapic-templates=ads-templates"
+- ],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "searchads360-py",
+- deps = [
+- ":searchads360_py_gapic",
+- "//google/ads/searchads360/v0:searchads360_proto",
+- "//google/ads/searchads360/v0/enums:enums_py_proto",
+- "//google/ads/searchads360/v0/common:common_py_proto",
+- "//google/ads/searchads360/v0/resources:resources_py_proto",
+- "//google/ads/searchads360/v0/services:services_py_proto",
+- "//google/ads/searchads360/v0/services:services_py_grpc",
+- ],
+-)
+\ No newline at end of file
+diff -urN a/google/ads/searchads360/v0/common/BUILD.bazel b/google/ads/searchads360/v0/common/BUILD.bazel
+--- a/google/ads/searchads360/v0/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/searchads360/v0/common/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,101 +0,0 @@
+-# Copyright 2022 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "common_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/ads/searchads360/v0/enums:enums_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "common_java_proto",
+- deps = [":common_proto"],
+-)
+-
+-java_grpc_library(
+- name = "common_java_grpc",
+- srcs = [":common_proto"],
+- deps = [":common_java_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "common_moved_proto",
+- srcs = [":common_proto"],
+- deps = [
+- "//google/ads/searchads360/v0/enums:enums_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "common_py_proto",
+- deps = [":common_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "common_py_grpc",
+- srcs = [":common_moved_proto"],
+- deps = [":common_py_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "common_csharp_proto",
+- deps = [":common_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "common_csharp_grpc",
+- srcs = [":common_proto"],
+- deps = [":common_csharp_proto"],
+-)
+\ No newline at end of file
+diff -urN a/google/ads/searchads360/v0/enums/BUILD.bazel b/google/ads/searchads360/v0/enums/BUILD.bazel
+--- a/google/ads/searchads360/v0/enums/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/searchads360/v0/enums/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,95 +0,0 @@
+-# Copyright 2022 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "enums_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "enums_java_proto",
+- deps = [":enums_proto"],
+-)
+-
+-java_grpc_library(
+- name = "enums_java_grpc",
+- srcs = [":enums_proto"],
+- deps = [":enums_java_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "enums_moved_proto",
+- srcs = [":enums_proto"],
+- deps = [
+- ],
+-)
+-
+-py_proto_library(
+- name = "enums_py_proto",
+- deps = [":enums_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "enums_py_grpc",
+- srcs = [":enums_moved_proto"],
+- deps = [":enums_py_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "enums_csharp_proto",
+- deps = [":enums_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "enums_csharp_grpc",
+- srcs = [":enums_proto"],
+- deps = [":enums_csharp_proto"],
+-)
+\ No newline at end of file
+diff -urN a/google/ads/searchads360/v0/resources/BUILD.bazel b/google/ads/searchads360/v0/resources/BUILD.bazel
+--- a/google/ads/searchads360/v0/resources/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/searchads360/v0/resources/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,103 +0,0 @@
+-# Copyright 2022 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "resources_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/ads/searchads360/v0/common:common_proto",
+- "//google/ads/searchads360/v0/enums:enums_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "resources_java_proto",
+- deps = [":resources_proto"],
+-)
+-
+-java_grpc_library(
+- name = "resources_java_grpc",
+- srcs = [":resources_proto"],
+- deps = [":resources_java_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "resources_moved_proto",
+- srcs = [":resources_proto"],
+- deps = [
+- "//google/ads/searchads360/v0/common:common_proto",
+- "//google/ads/searchads360/v0/enums:enums_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "resources_py_proto",
+- deps = [":resources_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "resources_py_grpc",
+- srcs = [":resources_moved_proto"],
+- deps = [":resources_py_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "resources_csharp_proto",
+- deps = [":resources_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "resources_csharp_grpc",
+- srcs = [":resources_proto"],
+- deps = [":resources_csharp_proto"],
+-)
+\ No newline at end of file
+diff -urN a/google/ads/searchads360/v0/services/BUILD.bazel b/google/ads/searchads360/v0/services/BUILD.bazel
+--- a/google/ads/searchads360/v0/services/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/ads/searchads360/v0/services/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,111 +0,0 @@
+-# Copyright 2022 Google LLC
+-#
+-# Licensed under the Apache License, Version 2.0 (the "License");
+-# you may not use this file except in compliance with the License.
+-# You may obtain a copy of the License at
+-#
+-# https://www.apache.org/licenses/LICENSE-2.0
+-#
+-# Unless required by applicable law or agreed to in writing, software
+-# distributed under the License is distributed on an "AS IS" BASIS,
+-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-# See the License for the specific language governing permissions and
+-# limitations under the License.
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "services_proto",
+- srcs = glob(["*.proto"]),
+- deps = [
+- "//google/ads/searchads360/v0/common:common_proto",
+- "//google/ads/searchads360/v0/enums:enums_proto",
+- "//google/ads/searchads360/v0/resources:resources_proto",
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "services_java_proto",
+- deps = [":services_proto"],
+-)
+-
+-java_grpc_library(
+- name = "services_java_grpc",
+- srcs = [":services_proto"],
+- deps = [":services_java_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "services_moved_proto",
+- srcs = [":services_proto"],
+- deps = [
+- "//google/ads/searchads360/v0/common:common_proto",
+- "//google/ads/searchads360/v0/enums:enums_proto",
+- "//google/ads/searchads360/v0/resources:resources_proto",
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "services_py_proto",
+- deps = [":services_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "services_py_grpc",
+- srcs = [":services_moved_proto"],
+- deps = [":services_py_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "services_csharp_proto",
+- deps = [":services_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "services_csharp_grpc",
+- srcs = [":services_proto"],
+- deps = [":services_csharp_proto"],
+-)
+\ No newline at end of file
+diff -urN a/google/analytics/admin/BUILD.bazel b/google/analytics/admin/BUILD.bazel
+--- a/google/analytics/admin/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/analytics/admin/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-analytics-admin.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for analyticsadmin.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1alpha in this case.
+-ruby_cloud_gapic_library(
+- name = "analyticsadmin_ruby_wrapper",
+- srcs = ["//google/analytics/admin/v1alpha:admin_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-analytics-admin",
+- "ruby-cloud-env-prefix=ANALYTICS_ADMIN",
+- "ruby-cloud-wrapper-of=v1alpha:0.0",
+- "ruby-cloud-api-id=analyticsadmin.googleapis.com",
+- "ruby-cloud-api-shortname=analyticsadmin",
+- ],
+- ruby_cloud_description = "The Analytics Admin API allows for programmatic access to the Google Analytics App+Web configuration data. You can use the Google Analytics Admin API to manage accounts and App+Web properties.",
+- ruby_cloud_title = "Google Analytics Admin",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-analytics-admin-ruby",
+- deps = [
+- ":analyticsadmin_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/analytics/admin/v1alpha/BUILD.bazel b/google/analytics/admin/v1alpha/BUILD.bazel
+--- a/google/analytics/admin/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/analytics/admin/v1alpha/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,396 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "admin_proto",
+- srcs = [
+- "access_report.proto",
+- "analytics_admin.proto",
+- "audience.proto",
+- "resources.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "admin_proto_with_info",
+- deps = [
+- ":admin_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "admin_java_proto",
+- deps = [":admin_proto"],
+-)
+-
+-java_grpc_library(
+- name = "admin_java_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "admin_java_gapic",
+- srcs = [":admin_proto_with_info"],
+- gapic_yaml = "analyticsadmin_gapic.yaml",
+- grpc_service_config = "admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsadmin_v1alpha.yaml",
+- test_deps = [
+- ":admin_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":admin_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "admin_java_gapic_test_suite",
+- test_classes = [
+- "com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClientHttpJsonTest",
+- "com.google.analytics.admin.v1alpha.AnalyticsAdminServiceClientTest",
+- ],
+- runtime_deps = [":admin_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-analytics-admin-v1alpha-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":admin_java_gapic",
+- ":admin_java_grpc",
+- ":admin_java_proto",
+- ":admin_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "admin_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/analytics/admin/v1alpha",
+- protos = [":admin_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "admin_go_gapic",
+- srcs = [":admin_proto_with_info"],
+- grpc_service_config = "admin_grpc_service_config.json",
+- importpath = "google.golang.org/google/analytics/admin/v1alpha;admin",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "analyticsadmin_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":admin_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "admin_go_gapic_test",
+- srcs = [":admin_go_gapic_srcjar_test"],
+- embed = [":admin_go_gapic"],
+- importpath = "google.golang.org/google/analytics/admin/v1alpha",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-analytics-admin-v1alpha-go",
+- deps = [
+- ":admin_go_gapic",
+- ":admin_go_gapic_srcjar-metadata.srcjar",
+- ":admin_go_gapic_srcjar-test.srcjar",
+- ":admin_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "admin_py_gapic",
+- srcs = [":admin_proto"],
+- grpc_service_config = "admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsadmin_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "admin_py_gapic_test",
+- srcs = [
+- "admin_py_gapic_pytest.py",
+- "admin_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":admin_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "google-analytics-admin-v1alpha-py",
+- deps = [
+- ":admin_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "admin_php_proto",
+- deps = [":admin_proto"],
+-)
+-
+-php_grpc_library(
+- name = "admin_php_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "admin_php_gapic",
+- srcs = [":admin_proto_with_info"],
+- grpc_service_config = "admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsadmin_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":admin_php_grpc",
+- ":admin_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-analytics-admin-v1alpha-php",
+- deps = [
+- ":admin_php_gapic",
+- ":admin_php_grpc",
+- ":admin_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "admin_nodejs_gapic",
+- package_name = "@google-analytics/admin",
+- src = ":admin_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "admin_grpc_service_config.json",
+- package = "google.analytics.admin.v1alpha",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsadmin_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "google-analytics-admin-v1alpha-nodejs",
+- deps = [
+- ":admin_nodejs_gapic",
+- ":admin_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "admin_ruby_proto",
+- deps = [":admin_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "admin_ruby_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "admin_ruby_gapic",
+- srcs = [":admin_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=analyticsadmin.googleapis.com",
+- "ruby-cloud-api-shortname=analyticsadmin",
+- "ruby-cloud-env-prefix=ANALYTICS_ADMIN",
+- "ruby-cloud-gem-name=google-analytics-admin-v1alpha",
+- ],
+- grpc_service_config = "admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Analytics Admin API allows for programmatic access to the Google Analytics App+Web configuration data. You can use the Google Analytics Admin API to manage accounts and App+Web properties.",
+- ruby_cloud_title = "Google Analytics Admin V1alpha",
+- service_yaml = "analyticsadmin_v1alpha.yaml",
+- deps = [
+- ":admin_ruby_grpc",
+- ":admin_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-analytics-admin-v1alpha-ruby",
+- deps = [
+- ":admin_ruby_gapic",
+- ":admin_ruby_grpc",
+- ":admin_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "admin_csharp_proto",
+- deps = [":admin_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "admin_csharp_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "admin_csharp_gapic",
+- srcs = [":admin_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsadmin_v1alpha.yaml",
+- deps = [
+- ":admin_csharp_grpc",
+- ":admin_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-analytics-admin-v1alpha-csharp",
+- deps = [
+- ":admin_csharp_gapic",
+- ":admin_csharp_grpc",
+- ":admin_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "admin_cc_proto",
+- deps = [":admin_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "admin_cc_grpc",
+- srcs = [":admin_proto"],
+- grpc_only = True,
+- deps = [":admin_cc_proto"],
+-)
+diff -urN a/google/analytics/admin/v1beta/BUILD.bazel b/google/analytics/admin/v1beta/BUILD.bazel
+--- a/google/analytics/admin/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/analytics/admin/v1beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,385 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "admin_proto",
+- srcs = [
+- "analytics_admin.proto",
+- "resources.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "admin_proto_with_info",
+- deps = [
+- ":admin_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "admin_java_proto",
+- deps = [":admin_proto"],
+-)
+-
+-java_grpc_library(
+- name = "admin_java_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "admin_java_gapic",
+- srcs = [":admin_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsadmin.yaml",
+- test_deps = [
+- ":admin_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":admin_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "admin_java_gapic_test_suite",
+- test_classes = [
+- "com.google.analytics.admin.v1beta.AnalyticsAdminServiceClientHttpJsonTest",
+- "com.google.analytics.admin.v1beta.AnalyticsAdminServiceClientTest",
+- ],
+- runtime_deps = [":admin_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-analytics-admin-v1beta-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":admin_java_gapic",
+- ":admin_java_grpc",
+- ":admin_java_proto",
+- ":admin_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "admin_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/analytics/admin/v1beta",
+- protos = [":admin_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "admin_go_gapic",
+- srcs = [":admin_proto_with_info"],
+- grpc_service_config = "admin_grpc_service_config.json",
+- importpath = "google.golang.org/google/analytics/admin/v1beta;admin",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "analyticsadmin.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":admin_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "admin_go_gapic_test",
+- srcs = [":admin_go_gapic_srcjar_test"],
+- embed = [":admin_go_gapic"],
+- importpath = "google.golang.org/google/analytics/admin/v1beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-analytics-admin-v1beta-go",
+- deps = [
+- ":admin_go_gapic",
+- ":admin_go_gapic_srcjar-metadata.srcjar",
+- ":admin_go_gapic_srcjar-test.srcjar",
+- ":admin_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "admin_py_gapic",
+- srcs = [":admin_proto"],
+- grpc_service_config = "admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsadmin.yaml",
+- transport = "grpc+rest",
+-)
+-
+-py_test(
+- name = "admin_py_gapic_test",
+- srcs = [
+- "admin_py_gapic_pytest.py",
+- "admin_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":admin_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "analytics-admin-v1beta-py",
+- deps = [
+- ":admin_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "admin_php_proto",
+- deps = [":admin_proto"],
+-)
+-
+-php_grpc_library(
+- name = "admin_php_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "admin_php_gapic",
+- srcs = [":admin_proto_with_info"],
+- grpc_service_config = "admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsadmin.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":admin_php_grpc",
+- ":admin_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-analytics-admin-v1beta-php",
+- deps = [
+- ":admin_php_gapic",
+- ":admin_php_grpc",
+- ":admin_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "admin_nodejs_gapic",
+- package_name = "@google-cloud/admin",
+- src = ":admin_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "admin_grpc_service_config.json",
+- package = "google.analytics.admin.v1beta",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsadmin.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "analytics-admin-v1beta-nodejs",
+- deps = [
+- ":admin_nodejs_gapic",
+- ":admin_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "admin_ruby_proto",
+- deps = [":admin_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "admin_ruby_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "admin_ruby_gapic",
+- srcs = [":admin_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-analytics-admin-v1beta",
+- ],
+- grpc_service_config = "admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsadmin.yaml",
+- deps = [
+- ":admin_ruby_grpc",
+- ":admin_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-analytics-admin-v1beta-ruby",
+- deps = [
+- ":admin_ruby_gapic",
+- ":admin_ruby_grpc",
+- ":admin_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "admin_csharp_proto",
+- deps = [":admin_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "admin_csharp_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "admin_csharp_gapic",
+- srcs = [":admin_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsadmin.yaml",
+- deps = [
+- ":admin_csharp_grpc",
+- ":admin_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-analytics-admin-v1beta-csharp",
+- deps = [
+- ":admin_csharp_gapic",
+- ":admin_csharp_grpc",
+- ":admin_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "admin_cc_proto",
+- deps = [":admin_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "admin_cc_grpc",
+- srcs = [":admin_proto"],
+- grpc_only = True,
+- deps = [":admin_cc_proto"],
+-)
+diff -urN a/google/analytics/data/BUILD.bazel b/google/analytics/data/BUILD.bazel
+--- a/google/analytics/data/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/analytics/data/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-analytics-data.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for analyticsdata.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta in this case.
+-ruby_cloud_gapic_library(
+- name = "analyticsdata_ruby_wrapper",
+- srcs = ["//google/analytics/data/v1beta:data_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-analytics-data",
+- "ruby-cloud-env-prefix=ANALYTICS_DATA",
+- "ruby-cloud-wrapper-of=v1beta:0.0",
+- "ruby-cloud-product-url=https://developers.google.com/analytics/devguides/reporting/data/v1",
+- "ruby-cloud-api-id=analyticsdata.googleapis.com",
+- "ruby-cloud-api-shortname=analyticsdata",
+- "ruby-cloud-service-override=BetaAnalyticsData=AnalyticsData",
+- ],
+- ruby_cloud_description = "The Google Analytics Data API provides programmatic methods to access report data in Google Analytics 4 (GA4) properties. Google Analytics 4 helps you understand how people use your web, iOS, or Android app.",
+- ruby_cloud_title = "Google Analytics Data",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-analytics-data-ruby",
+- deps = [
+- ":analyticsdata_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/analytics/data/v1alpha/BUILD.bazel b/google/analytics/data/v1alpha/BUILD.bazel
+--- a/google/analytics/data/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/analytics/data/v1alpha/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,327 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "data_proto",
+- srcs = [
+- "analytics_data_api.proto",
+- "data.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "@com_google_protobuf//:duration_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "data_proto_with_info",
+- deps = [
+- ":data_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "data_java_proto",
+- deps = [":data_proto"],
+-)
+-
+-java_grpc_library(
+- name = "data_java_grpc",
+- srcs = [":data_proto"],
+- deps = [":data_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "data_java_gapic",
+- srcs = [":data_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "analytics_data_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsdata_v1alpha.yaml",
+- test_deps = [
+- ":data_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":data_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "data_java_gapic_test_suite",
+- test_classes = [
+- "com.google.analytics.data.v1alpha.AlphaAnalyticsDataClientHttpJsonTest",
+- "com.google.analytics.data.v1alpha.AlphaAnalyticsDataClientTest",
+- ],
+- runtime_deps = [":data_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-analytics-data-v1alpha-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":data_java_gapic",
+- ":data_java_grpc",
+- ":data_java_proto",
+- ":data_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "data_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/analytics/data/v1alpha",
+- protos = [":data_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "data_go_gapic",
+- srcs = [":data_proto_with_info"],
+- grpc_service_config = "analytics_data_grpc_service_config.json",
+- importpath = "google.golang.org/google/analytics/data/v1alpha;data",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "analyticsdata_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":data_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "data_go_gapic_test",
+- srcs = [":data_go_gapic_srcjar_test"],
+- embed = [":data_go_gapic"],
+- importpath = "google.golang.org/google/analytics/data/v1alpha",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-analytics-data-v1alpha-go",
+- deps = [
+- ":data_go_gapic",
+- ":data_go_gapic_srcjar-metadata.srcjar",
+- ":data_go_gapic_srcjar-test.srcjar",
+- ":data_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "data_py_gapic",
+- srcs = [":data_proto"],
+- grpc_service_config = "analytics_data_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsdata_v1alpha.yaml",
+- transport = "grpc+rest",
+-)
+-
+-py_test(
+- name = "data_py_gapic_test",
+- srcs = [
+- "data_py_gapic_pytest.py",
+- "data_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":data_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "analytics-data-v1alpha-py",
+- deps = [
+- ":data_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "data_php_proto",
+- deps = [":data_proto"],
+-)
+-
+-php_grpc_library(
+- name = "data_php_grpc",
+- srcs = [":data_proto"],
+- deps = [":data_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "data_php_gapic",
+- srcs = [":data_proto_with_info"],
+- grpc_service_config = "analytics_data_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsdata_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":data_php_grpc",
+- ":data_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-analytics-data-v1alpha-php",
+- deps = [
+- ":data_php_gapic",
+- ":data_php_grpc",
+- ":data_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "data_nodejs_gapic",
+- package_name = "@google-cloud/data",
+- src = ":data_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "analytics_data_grpc_service_config.json",
+- package = "google.analytics.data.v1alpha",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsdata_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "analytics-data-v1alpha-nodejs",
+- deps = [
+- ":data_nodejs_gapic",
+- ":data_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "data_ruby_proto",
+- deps = [":data_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "data_ruby_grpc",
+- srcs = [":data_proto"],
+- deps = [":data_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "data_ruby_gapic",
+- srcs = [":data_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-analytics-data-v1alpha",
+- ],
+- grpc_service_config = "analytics_data_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":data_ruby_grpc",
+- ":data_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-analytics-data-v1alpha-ruby",
+- deps = [
+- ":data_ruby_gapic",
+- ":data_ruby_grpc",
+- ":data_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "data_csharp_proto",
+- deps = [":data_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "data_csharp_grpc",
+- srcs = [":data_proto"],
+- deps = [":data_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "data_csharp_gapic",
+- srcs = [":data_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "analytics_data_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsdata_v1alpha.yaml",
+- deps = [
+- ":data_csharp_grpc",
+- ":data_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-analytics-data-v1alpha-csharp",
+- deps = [
+- ":data_csharp_gapic",
+- ":data_csharp_grpc",
+- ":data_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "data_cc_proto",
+- deps = [":data_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "data_cc_grpc",
+- srcs = [":data_proto"],
+- grpc_only = True,
+- deps = [":data_cc_proto"],
+-)
+diff -urN a/google/analytics/data/v1beta/BUILD.bazel b/google/analytics/data/v1beta/BUILD.bazel
+--- a/google/analytics/data/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/analytics/data/v1beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,390 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "data_proto",
+- srcs = [
+- "analytics_data_api.proto",
+- "data.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "data_proto_with_info",
+- deps = [
+- ":data_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "data_java_proto",
+- deps = [":data_proto"],
+-)
+-
+-java_grpc_library(
+- name = "data_java_grpc",
+- srcs = [":data_proto"],
+- deps = [":data_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "data_java_gapic",
+- srcs = [":data_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "analytics_data_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsdata_v1beta.yaml",
+- test_deps = [
+- ":data_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":data_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "data_java_gapic_test_suite",
+- test_classes = [
+- "com.google.analytics.data.v1beta.BetaAnalyticsDataClientHttpJsonTest",
+- "com.google.analytics.data.v1beta.BetaAnalyticsDataClientTest",
+- ],
+- runtime_deps = [":data_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-analytics-data-v1beta-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":data_java_gapic",
+- ":data_java_grpc",
+- ":data_java_proto",
+- ":data_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "data_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/analytics/data/v1beta",
+- protos = [":data_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "data_go_gapic",
+- srcs = [":data_proto_with_info"],
+- grpc_service_config = "analytics_data_grpc_service_config.json",
+- importpath = "google.golang.org/google/analytics/data/v1beta;data",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "analyticsdata_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":data_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "data_go_gapic_test",
+- srcs = [":data_go_gapic_srcjar_test"],
+- embed = [":data_go_gapic"],
+- importpath = "google.golang.org/google/analytics/data/v1beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-analytics-data-v1beta-go",
+- deps = [
+- ":data_go_gapic",
+- ":data_go_gapic_srcjar-metadata.srcjar",
+- ":data_go_gapic_srcjar-test.srcjar",
+- ":data_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "data_py_gapic",
+- srcs = [":data_proto"],
+- grpc_service_config = "analytics_data_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsdata_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "data_py_gapic_test",
+- srcs = [
+- "data_py_gapic_pytest.py",
+- "data_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":data_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "google-analytics-data-v1beta-py",
+- deps = [
+- ":data_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "data_php_proto",
+- deps = [":data_proto"],
+-)
+-
+-php_grpc_library(
+- name = "data_php_grpc",
+- srcs = [":data_proto"],
+- deps = [":data_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "data_php_gapic",
+- srcs = [":data_proto_with_info"],
+- grpc_service_config = "analytics_data_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsdata_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":data_php_grpc",
+- ":data_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-analytics-data-v1beta-php",
+- deps = [
+- ":data_php_gapic",
+- ":data_php_grpc",
+- ":data_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "data_nodejs_gapic",
+- package_name = "@google-analytics/data",
+- src = ":data_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "analytics_data_grpc_service_config.json",
+- package = "google.analytics.data.v1beta",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsdata_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "google-analytics-data-v1beta-nodejs",
+- deps = [
+- ":data_nodejs_gapic",
+- ":data_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "data_ruby_proto",
+- deps = [":data_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "data_ruby_grpc",
+- srcs = [":data_proto"],
+- deps = [":data_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "data_ruby_gapic",
+- srcs = [":data_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=analyticsdata.googleapis.com",
+- "ruby-cloud-api-shortname=analyticsdata",
+- "ruby-cloud-env-prefix=ANALYTICS_DATA",
+- "ruby-cloud-gem-name=google-analytics-data-v1beta",
+- "ruby-cloud-product-url=https://developers.google.com/analytics/devguides/reporting/data/v1",
+- "ruby-cloud-service-override=BetaAnalyticsData=AnalyticsData",
+- ],
+- grpc_service_config = "analytics_data_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Google Analytics Data API provides programmatic methods to access report data in Google Analytics 4 (GA4) properties. Google Analytics 4 helps you understand how people use your web, iOS, or Android app.",
+- ruby_cloud_title = "Google Analytics Data V1beta",
+- service_yaml = "analyticsdata_v1beta.yaml",
+- deps = [
+- ":data_ruby_grpc",
+- ":data_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-analytics-data-v1beta-ruby",
+- deps = [
+- ":data_ruby_gapic",
+- ":data_ruby_grpc",
+- ":data_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "data_csharp_proto",
+- deps = [":data_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "data_csharp_grpc",
+- srcs = [":data_proto"],
+- deps = [":data_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "data_csharp_gapic",
+- srcs = [":data_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "analytics_data_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticsdata_v1beta.yaml",
+- deps = [
+- ":data_csharp_grpc",
+- ":data_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-analytics-data-v1beta-csharp",
+- deps = [
+- ":data_csharp_gapic",
+- ":data_csharp_grpc",
+- ":data_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "data_cc_proto",
+- deps = [":data_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "data_cc_grpc",
+- srcs = [":data_proto"],
+- grpc_only = True,
+- deps = [":data_cc_proto"],
+-)
+diff -urN a/google/api/BUILD.bazel b/google/api/BUILD.bazel
+--- a/google/api/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/api/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,781 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-proto_library(
+- name = "annotations_proto",
+- srcs = ["annotations.proto"],
+- deps = [
+- ":http_proto",
+- "@com_google_protobuf//:descriptor_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "auth_proto",
+- srcs = ["auth.proto"],
+- deps = [":annotations_proto"],
+-)
+-
+-proto_library(
+- name = "backend_proto",
+- srcs = ["backend.proto"],
+- visibility = ["//visibility:public"],
+-)
+-
+-proto_library(
+- name = "billing_proto",
+- srcs = ["billing.proto"],
+- deps = [
+- ":annotations_proto",
+- ":metric_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "client_proto",
+- srcs = ["client.proto"],
+- deps = [
+- ":launch_stage_proto",
+- "@com_google_protobuf//:descriptor_proto",
+- "@com_google_protobuf//:duration_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "config_change_proto",
+- srcs = ["config_change.proto"],
+- visibility = ["//visibility:public"],
+-)
+-
+-proto_library(
+- name = "consumer_proto",
+- srcs = ["consumer.proto"],
+- visibility = ["//visibility:public"],
+-)
+-
+-proto_library(
+- name = "context_proto",
+- srcs = ["context.proto"],
+- visibility = ["//visibility:public"],
+-)
+-
+-proto_library(
+- name = "control_proto",
+- srcs = ["control.proto"],
+- visibility = ["//visibility:public"],
+-)
+-
+-proto_library(
+- name = "distribution_proto",
+- srcs = ["distribution.proto"],
+- deps = [
+- ":annotations_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "documentation_proto",
+- srcs = ["documentation.proto"],
+- visibility = ["//visibility:public"],
+-)
+-
+-proto_library(
+- name = "endpoint_proto",
+- srcs = ["endpoint.proto"],
+- deps = [":annotations_proto"],
+-)
+-
+-proto_library(
+- name = "error_reason_proto",
+- srcs = ["error_reason.proto"],
+-)
+-
+-proto_library(
+- name = "field_behavior_proto",
+- srcs = ["field_behavior.proto"],
+- deps = [
+- "@com_google_protobuf//:descriptor_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "http_proto",
+- srcs = ["http.proto"],
+- visibility = ["//visibility:public"],
+-)
+-
+-proto_library(
+- name = "httpbody_proto",
+- srcs = ["httpbody.proto"],
+- deps = ["@com_google_protobuf//:any_proto"],
+-)
+-
+-proto_library(
+- name = "label_proto",
+- srcs = ["label.proto"],
+- visibility = ["//visibility:public"],
+-)
+-
+-proto_library(
+- name = "launch_stage_proto",
+- srcs = ["launch_stage.proto"],
+-)
+-
+-proto_library(
+- name = "log_proto",
+- srcs = ["log.proto"],
+- deps = [":label_proto"],
+-)
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = ["logging.proto"],
+- deps = [
+- ":annotations_proto",
+- ":label_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "metric_proto",
+- srcs = ["metric.proto"],
+- deps = [
+- ":label_proto",
+- ":launch_stage_proto",
+- "@com_google_protobuf//:duration_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "monitored_resource_proto",
+- srcs = ["monitored_resource.proto"],
+- deps = [
+- ":label_proto",
+- ":launch_stage_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "monitoring_proto",
+- srcs = ["monitoring.proto"],
+- deps = [":annotations_proto"],
+-)
+-
+-proto_library(
+- name = "quota_proto",
+- srcs = ["quota.proto"],
+- deps = [":annotations_proto"],
+-)
+-
+-proto_library(
+- name = "resource_proto",
+- srcs = ["resource.proto"],
+- deps = [
+- "@com_google_protobuf//:descriptor_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "routing_proto",
+- srcs = ["routing.proto"],
+- deps = [
+- "@com_google_protobuf//:descriptor_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "service_proto",
+- srcs = ["service.proto"],
+- deps = [
+- ":annotations_proto",
+- ":auth_proto",
+- ":backend_proto",
+- ":billing_proto",
+- ":client_proto",
+- ":context_proto",
+- ":control_proto",
+- ":documentation_proto",
+- ":endpoint_proto",
+- ":http_proto",
+- ":label_proto",
+- ":log_proto",
+- ":logging_proto",
+- ":metric_proto",
+- ":monitored_resource_proto",
+- ":monitoring_proto",
+- ":quota_proto",
+- ":resource_proto",
+- ":source_info_proto",
+- ":system_parameter_proto",
+- ":usage_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:api_proto",
+- "@com_google_protobuf//:type_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "source_info_proto",
+- srcs = ["source_info.proto"],
+- deps = ["@com_google_protobuf//:any_proto"],
+-)
+-
+-proto_library(
+- name = "system_parameter_proto",
+- srcs = ["system_parameter.proto"],
+- visibility = ["//visibility:public"],
+-)
+-
+-proto_library(
+- name = "usage_proto",
+- srcs = ["usage.proto"],
+- deps = [
+- ":annotations_proto",
+- ":visibility_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "visibility_proto",
+- srcs = ["visibility.proto"],
+- visibility = ["//visibility:public"],
+- deps = ["@com_google_protobuf//:descriptor_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "api_java_proto",
+- deps = [
+- "annotations_proto",
+- "auth_proto",
+- "backend_proto",
+- "billing_proto",
+- "client_proto",
+- "config_change_proto",
+- "consumer_proto",
+- "context_proto",
+- "control_proto",
+- "distribution_proto",
+- "documentation_proto",
+- "endpoint_proto",
+- "error_reason_proto",
+- "field_behavior_proto",
+- "http_proto",
+- "httpbody_proto",
+- "label_proto",
+- "launch_stage_proto",
+- "log_proto",
+- "logging_proto",
+- "metric_proto",
+- "monitored_resource_proto",
+- "monitoring_proto",
+- "quota_proto",
+- "resource_proto",
+- "routing_proto",
+- "service_proto",
+- "source_info_proto",
+- "system_parameter_proto",
+- "usage_proto",
+- "visibility_proto",
+- ],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-api-java",
+- transport = "grpc+rest",
+- deps = [
+- "annotations_proto",
+- "auth_proto",
+- "backend_proto",
+- "billing_proto",
+- "client_proto",
+- "config_change_proto",
+- "consumer_proto",
+- "context_proto",
+- "control_proto",
+- "distribution_proto",
+- "documentation_proto",
+- "endpoint_proto",
+- "error_reason_proto",
+- "field_behavior_proto",
+- "http_proto",
+- "httpbody_proto",
+- "label_proto",
+- "launch_stage_proto",
+- "log_proto",
+- "logging_proto",
+- "metric_proto",
+- "monitored_resource_proto",
+- "monitoring_proto",
+- "quota_proto",
+- "resource_proto",
+- "routing_proto",
+- "service_proto",
+- "source_info_proto",
+- "system_parameter_proto",
+- "usage_proto",
+- "visibility_proto",
+- ":api_java_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "annotations_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/api/annotations",
+- protos = [
+- ":annotations_proto",
+- ":client_proto",
+- ":field_behavior_proto",
+- ":http_proto",
+- ":resource_proto",
+- ":routing_proto",
+- ],
+- deps = [":api_go_proto"],
+-)
+-
+-go_proto_library(
+- name = "client_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/api/annotations;annotations",
+- protos = [":client_proto"],
+- deps = [":api_go_proto"],
+-)
+-
+-go_proto_library(
+- name = "configchange_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/api/configchange",
+- protos = [":config_change_proto"],
+-)
+-
+-go_proto_library(
+- name = "distribution_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/api/distribution",
+- protos = [":distribution_proto"],
+-)
+-
+-go_proto_library(
+- name = "field_behavior_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/api/annotations;annotations",
+- protos = [":field_behavior_proto"],
+-)
+-
+-go_proto_library(
+- name = "httpbody_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/api/httpbody",
+- protos = [":httpbody_proto"],
+-)
+-
+-go_proto_library(
+- name = "label_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/api/label",
+- protos = [":label_proto"],
+-)
+-
+-go_proto_library(
+- name = "api_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/api",
+- protos = [
+- ":launch_stage_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "metric_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/api/metric",
+- protos = [":metric_proto"],
+- deps = [
+- ":api_go_proto",
+- ":label_go_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "monitoredres_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/api/monitoredres",
+- protos = [":monitored_resource_proto"],
+- deps = [
+- ":api_go_proto",
+- ":label_go_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "resource_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/api/annotations;annotations",
+- protos = [":resource_proto"],
+-)
+-
+-go_proto_library(
+- name = "routing_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/api/annotations;annotations",
+- protos = [":routing_proto"],
+-)
+-
+-go_proto_library(
+- name = "serviceconfig_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/api/serviceconfig",
+- protos = [
+- ":auth_proto",
+- ":backend_proto",
+- ":billing_proto",
+- ":context_proto",
+- ":control_proto",
+- ":documentation_proto",
+- ":endpoint_proto",
+- ":log_proto",
+- ":logging_proto",
+- ":monitoring_proto",
+- ":quota_proto",
+- ":service_proto",
+- ":source_info_proto",
+- ":system_parameter_proto",
+- ":usage_proto",
+- ],
+- deps = [
+- ":annotations_go_proto",
+- ":api_go_proto",
+- ":label_go_proto",
+- ":metric_go_proto",
+- ":monitoredres_go_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "visibility_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/api/visibility;visibility",
+- protos = [":visibility_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "cc_proto_library")
+-
+-cc_proto_library(
+- name = "annotations_cc_proto",
+- deps = [":annotations_proto"],
+-)
+-
+-cc_proto_library(
+- name = "auth_cc_proto",
+- deps = [":auth_proto"],
+-)
+-
+-cc_proto_library(
+- name = "backend_cc_proto",
+- deps = [":backend_proto"],
+-)
+-
+-cc_proto_library(
+- name = "billing_cc_proto",
+- deps = [":billing_proto"],
+-)
+-
+-cc_proto_library(
+- name = "client_cc_proto",
+- deps = [":client_proto"],
+-)
+-
+-cc_proto_library(
+- name = "config_change_cc_proto",
+- deps = [":config_change_proto"],
+-)
+-
+-cc_proto_library(
+- name = "consumer_cc_proto",
+- deps = [":consumer_proto"],
+-)
+-
+-cc_proto_library(
+- name = "context_cc_proto",
+- deps = [":context_proto"],
+-)
+-
+-cc_proto_library(
+- name = "control_cc_proto",
+- deps = [":control_proto"],
+-)
+-
+-cc_proto_library(
+- name = "distribution_cc_proto",
+- deps = [":distribution_proto"],
+-)
+-
+-cc_proto_library(
+- name = "documentation_cc_proto",
+- deps = [":documentation_proto"],
+-)
+-
+-cc_proto_library(
+- name = "endpoint_cc_proto",
+- deps = [":endpoint_proto"],
+-)
+-
+-cc_proto_library(
+- name = "field_behavior_cc_proto",
+- deps = [":field_behavior_proto"],
+-)
+-
+-cc_proto_library(
+- name = "http_cc_proto",
+- deps = [":http_proto"],
+-)
+-
+-cc_proto_library(
+- name = "httpbody_cc_proto",
+- deps = [":httpbody_proto"],
+-)
+-
+-cc_proto_library(
+- name = "label_cc_proto",
+- deps = [":label_proto"],
+-)
+-
+-cc_proto_library(
+- name = "launch_stage_cc_proto",
+- deps = [":launch_stage_proto"],
+-)
+-
+-cc_proto_library(
+- name = "log_cc_proto",
+- deps = [":log_proto"],
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_proto_library(
+- name = "metric_cc_proto",
+- deps = [":metric_proto"],
+-)
+-
+-cc_proto_library(
+- name = "monitored_resource_cc_proto",
+- deps = [":monitored_resource_proto"],
+-)
+-
+-cc_proto_library(
+- name = "monitoring_cc_proto",
+- deps = ["monitoring_proto"],
+-)
+-
+-cc_proto_library(
+- name = "quota_cc_proto",
+- deps = ["quota_proto"],
+-)
+-
+-cc_proto_library(
+- name = "resource_cc_proto",
+- deps = [":resource_proto"],
+-)
+-
+-cc_proto_library(
+- name = "routing_cc_proto",
+- deps = [":routing_proto"],
+-)
+-
+-cc_proto_library(
+- name = "service_cc_proto",
+- deps = [":service_proto"],
+-)
+-
+-cc_proto_library(
+- name = "source_info_cc_proto",
+- deps = [":source_info_proto"],
+-)
+-
+-cc_proto_library(
+- name = "system_parameter_cc_proto",
+- deps = [":system_parameter_proto"],
+-)
+-
+-cc_proto_library(
+- name = "usage_cc_proto",
+- deps = [":usage_proto"],
+-)
+-
+-cc_proto_library(
+- name = "visibility_cc_proto",
+- deps = [":visibility_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "py_proto_library")
+-
+-py_proto_library(
+- name = "annotations_py_proto",
+- deps = [":annotations_proto"],
+-)
+-
+-py_proto_library(
+- name = "auth_py_proto",
+- deps = [":auth_proto"],
+-)
+-
+-py_proto_library(
+- name = "backend_py_proto",
+- deps = [":backend_proto"],
+-)
+-
+-py_proto_library(
+- name = "billing_py_proto",
+- deps = [":billing_proto"],
+-)
+-
+-py_proto_library(
+- name = "client_py_proto",
+- deps = [":client_proto"],
+-)
+-
+-py_proto_library(
+- name = "config_change_py_proto",
+- deps = [":config_change_proto"],
+-)
+-
+-py_proto_library(
+- name = "consumer_py_proto",
+- deps = [":consumer_proto"],
+-)
+-
+-py_proto_library(
+- name = "context_py_proto",
+- deps = [":context_proto"],
+-)
+-
+-py_proto_library(
+- name = "control_py_proto",
+- deps = [":control_proto"],
+-)
+-
+-py_proto_library(
+- name = "distribution_py_proto",
+- deps = [":distribution_proto"],
+-)
+-
+-py_proto_library(
+- name = "documentation_py_proto",
+- deps = [":documentation_proto"],
+-)
+-
+-py_proto_library(
+- name = "endpoint_py_proto",
+- deps = [":endpoint_proto"],
+-)
+-
+-py_proto_library(
+- name = "field_behavior_py_proto",
+- deps = [":field_behavior_proto"],
+-)
+-
+-py_proto_library(
+- name = "http_py_proto",
+- deps = [":http_proto"],
+-)
+-
+-py_proto_library(
+- name = "httpbody_py_proto",
+- deps = [":httpbody_proto"],
+-)
+-
+-py_proto_library(
+- name = "label_py_proto",
+- deps = [":label_proto"],
+-)
+-
+-py_proto_library(
+- name = "launch_stage_py_proto",
+- deps = [":launch_stage_proto"],
+-)
+-
+-py_proto_library(
+- name = "log_py_proto",
+- deps = [":log_proto"],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_proto"],
+-)
+-
+-py_proto_library(
+- name = "metric_py_proto",
+- deps = [":metric_proto"],
+-)
+-
+-py_proto_library(
+- name = "monitored_resource_py_proto",
+- deps = [":monitored_resource_proto"],
+-)
+-
+-py_proto_library(
+- name = "monitoring_py_proto",
+- deps = ["monitoring_proto"],
+-)
+-
+-py_proto_library(
+- name = "quota_py_proto",
+- deps = ["quota_proto"],
+-)
+-
+-py_proto_library(
+- name = "resource_py_proto",
+- deps = [":resource_proto"],
+-)
+-
+-py_proto_library(
+- name = "routing_py_proto",
+- deps = [":routing_proto"],
+-)
+-
+-py_proto_library(
+- name = "service_py_proto",
+- deps = [":service_proto"],
+-)
+-
+-py_proto_library(
+- name = "source_info_py_proto",
+- deps = [":source_info_proto"],
+-)
+-
+-py_proto_library(
+- name = "system_parameter_py_proto",
+- deps = [":system_parameter_proto"],
+-)
+-
+-py_proto_library(
+- name = "usage_py_proto",
+- deps = [":usage_proto"],
+-)
+-
+-py_proto_library(
+- name = "visibility_py_proto",
+- deps = ["visibility_proto"],
+-)
+diff -urN a/google/api/apikeys/BUILD.bazel b/google/api/apikeys/BUILD.bazel
+--- a/google/api/apikeys/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/api/apikeys/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-api_keys.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for apikeys.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v2 in this case.
+-ruby_cloud_gapic_library(
+- name = "apikeys_ruby_wrapper",
+- srcs = ["//google/api/apikeys/v2:apikeys_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=apikeys.googleapis.com",
+- "ruby-cloud-api-shortname=apikeys",
+- "ruby-cloud-gem-name=google-cloud-api_keys",
+- "ruby-cloud-product-url=https://cloud.google.com/api-keys/",
+- "ruby-cloud-wrapper-of=v2:0.0",
+- ],
+- ruby_cloud_description = "An API key is a simple encrypted string that you can use when calling Google Cloud APIs. The API Keys service manages the API keys associated with developer projects.",
+- ruby_cloud_title = "API Keys",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-apikeys-ruby",
+- deps = [
+- ":apikeys_ruby_wrapper",
+- ],
+-)
+-
+diff -urN a/google/api/apikeys/v2/BUILD.bazel b/google/api/apikeys/v2/BUILD.bazel
+--- a/google/api/apikeys/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/api/apikeys/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,399 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "apikeys_proto",
+- srcs = [
+- "apikeys.proto",
+- "resources.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "apikeys_proto_with_info",
+- deps = [
+- ":apikeys_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "apikeys_java_proto",
+- deps = [":apikeys_proto"],
+-)
+-
+-java_grpc_library(
+- name = "apikeys_java_grpc",
+- srcs = [":apikeys_proto"],
+- deps = [":apikeys_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "apikeys_java_gapic",
+- srcs = [":apikeys_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "apikeys_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "apikeys_v2.yaml",
+- test_deps = [
+- ":apikeys_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":apikeys_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "apikeys_java_gapic_test_suite",
+- test_classes = [
+- "com.google.api.apikeys.v2.ApiKeysClientHttpJsonTest",
+- "com.google.api.apikeys.v2.ApiKeysClientTest",
+- ],
+- runtime_deps = [":apikeys_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-api-apikeys-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":apikeys_java_gapic",
+- ":apikeys_java_grpc",
+- ":apikeys_java_proto",
+- ":apikeys_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "apikeys_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/api/apikeys/v2",
+- protos = [":apikeys_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "apikeys_go_gapic",
+- srcs = [":apikeys_proto_with_info"],
+- grpc_service_config = "apikeys_grpc_service_config.json",
+- importpath = "cloud.google.com/go/api/apikeys/apiv2;apikeys",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "apikeys_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":apikeys_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "apikeys_go_gapic_test",
+- srcs = [":apikeys_go_gapic_srcjar_test"],
+- embed = [":apikeys_go_gapic"],
+- importpath = "cloud.google.com/go/api/apikeys/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-api-apikeys-v2-go",
+- deps = [
+- ":apikeys_go_gapic",
+- ":apikeys_go_gapic_srcjar-metadata.srcjar",
+- ":apikeys_go_gapic_srcjar-test.srcjar",
+- ":apikeys_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "apikeys_py_gapic",
+- srcs = [":apikeys_proto"],
+- grpc_service_config = "apikeys_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-api-keys",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=api_keys",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "apikeys_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-py_test(
+- name = "apikeys_py_gapic_test",
+- srcs = [
+- "apikeys_py_gapic_pytest.py",
+- "apikeys_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":apikeys_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "api-apikeys-v2-py",
+- deps = [
+- ":apikeys_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "apikeys_php_proto",
+- deps = [":apikeys_proto"],
+-)
+-
+-php_grpc_library(
+- name = "apikeys_php_grpc",
+- srcs = [":apikeys_proto"],
+- deps = [":apikeys_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "apikeys_php_gapic",
+- srcs = [":apikeys_proto_with_info"],
+- grpc_service_config = "apikeys_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "apikeys_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":apikeys_php_grpc",
+- ":apikeys_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-api-apikeys-v2-php",
+- deps = [
+- ":apikeys_php_gapic",
+- ":apikeys_php_grpc",
+- ":apikeys_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "apikeys_nodejs_gapic",
+- package_name = "@google-cloud/apikeys",
+- src = ":apikeys_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "apikeys_grpc_service_config.json",
+- package = "google.api.apikeys.v2",
+- rest_numeric_enums = False,
+- service_yaml = "apikeys_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "api-apikeys-v2-nodejs",
+- deps = [
+- ":apikeys_nodejs_gapic",
+- ":apikeys_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "apikeys_ruby_proto",
+- deps = [":apikeys_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "apikeys_ruby_grpc",
+- srcs = [":apikeys_proto"],
+- deps = [":apikeys_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "apikeys_ruby_gapic",
+- srcs = [":apikeys_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=apikeys.googleapis.com",
+- "ruby-cloud-api-shortname=apikeys",
+- "ruby-cloud-gem-name=google-cloud-api_keys-v2",
+- "ruby-cloud-product-url=https://cloud.google.com/api-keys/",
+- ],
+- grpc_service_config = "apikeys_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "An API key is a simple encrypted string that you can use when calling Google Cloud APIs. The API Keys service manages the API keys associated with developer projects.",
+- ruby_cloud_title = "API Keys V2",
+- service_yaml = "apikeys_v2.yaml",
+- deps = [
+- ":apikeys_ruby_grpc",
+- ":apikeys_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-api-apikeys-v2-ruby",
+- deps = [
+- ":apikeys_ruby_gapic",
+- ":apikeys_ruby_grpc",
+- ":apikeys_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "apikeys_csharp_proto",
+- deps = [":apikeys_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "apikeys_csharp_grpc",
+- srcs = [":apikeys_proto"],
+- deps = [":apikeys_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "apikeys_csharp_gapic",
+- srcs = [":apikeys_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "apikeys_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "apikeys_v2.yaml",
+- deps = [
+- ":apikeys_csharp_grpc",
+- ":apikeys_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-api-apikeys-v2-csharp",
+- deps = [
+- ":apikeys_csharp_gapic",
+- ":apikeys_csharp_grpc",
+- ":apikeys_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "apikeys_cc_proto",
+- deps = [":apikeys_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "apikeys_cc_grpc",
+- srcs = [":apikeys_proto"],
+- grpc_only = True,
+- deps = [":apikeys_cc_proto"],
+-)
+diff -urN a/google/api/expr/BUILD.bazel b/google/api/expr/BUILD.bazel
+--- a/google/api/expr/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/api/expr/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/api/expr/conformance/v1alpha1/BUILD.bazel b/google/api/expr/conformance/v1alpha1/BUILD.bazel
+--- a/google/api/expr/conformance/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/api/expr/conformance/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,178 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "conformance_proto",
+- srcs = [
+- "conformance_service.proto",
+- ],
+- deps = [
+- "//google/api/expr/v1alpha1:checked_proto",
+- "//google/api/expr/v1alpha1:eval_proto",
+- "//google/api/expr/v1alpha1:syntax_proto",
+- "//google/api:client_proto",
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "conformance_java_proto",
+- deps = [":conformance_proto"],
+-)
+-
+-java_grpc_library(
+- name = "conformance_java_grpc",
+- srcs = [":conformance_proto"],
+- deps = [":conformance_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "conformance_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/api/expr/conformance/v1alpha1",
+- protos = [":conformance_proto"],
+- deps = [
+- "//google/api/expr/v1alpha1:expr_go_proto",
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "conformance_moved_proto",
+- srcs = [":conformance_proto"],
+- deps = [
+- "//google/api/expr/v1alpha1:checked_proto",
+- "//google/api/expr/v1alpha1:eval_proto",
+- "//google/api/expr/v1alpha1:syntax_proto",
+- "//google/api:client_proto",
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "conformance_py_proto",
+- deps = [":conformance_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "conformance_py_grpc",
+- srcs = [":conformance_moved_proto"],
+- deps = [":conformance_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "conformance_php_proto",
+- deps = [":conformance_proto"],
+-)
+-
+-php_grpc_library(
+- name = "conformance_php_grpc",
+- srcs = [":conformance_proto"],
+- deps = [":conformance_php_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "conformance_ruby_proto",
+- deps = [":conformance_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "conformance_ruby_grpc",
+- srcs = [":conformance_proto"],
+- deps = [":conformance_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "conformance_csharp_proto",
+- deps = [":conformance_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "conformance_csharp_grpc",
+- srcs = [":conformance_proto"],
+- deps = [":conformance_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "conformance_cc_proto",
+- deps = [":conformance_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "conformance_cc_grpc",
+- srcs = [":conformance_proto"],
+- generate_mocks = True,
+- grpc_only = True,
+- deps = [":conformance_cc_proto"],
+-)
+diff -urN a/google/api/expr/v1alpha1/BUILD.bazel b/google/api/expr/v1alpha1/BUILD.bazel
+--- a/google/api/expr/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/api/expr/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,240 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "expr_proto",
+- srcs = [
+- "checked.proto",
+- "eval.proto",
+- "explain.proto",
+- "syntax.proto",
+- "value.proto",
+- ],
+- deps = [
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "checked_proto",
+- srcs = ["checked.proto"],
+- deps = [
+- ":syntax_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "eval_proto",
+- srcs = ["eval.proto"],
+- deps = [
+- ":value_proto",
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "explain_proto",
+- srcs = ["explain.proto"],
+- deps = [
+- ":value_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "syntax_proto",
+- srcs = ["syntax.proto"],
+- deps = [
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "value_proto",
+- srcs = ["value.proto"],
+- deps = [
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "expr_java_proto",
+- deps = [":expr_proto"],
+-)
+-
+-java_grpc_library(
+- name = "expr_java_grpc",
+- srcs = [":expr_proto"],
+- deps = [":expr_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "expr_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/api/expr/v1alpha1",
+- protos = [":expr_proto"],
+- deps = [
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "expr_moved_proto",
+- srcs = [":expr_proto"],
+- deps = [
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "expr_py_proto",
+- deps = [":expr_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "expr_py_grpc",
+- srcs = [":expr_moved_proto"],
+- deps = [":expr_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "expr_php_proto",
+- deps = [":expr_proto"],
+-)
+-
+-php_grpc_library(
+- name = "expr_php_grpc",
+- srcs = [":expr_proto"],
+- deps = [":expr_php_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "expr_ruby_proto",
+- deps = [":expr_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "expr_ruby_grpc",
+- srcs = [":expr_proto"],
+- deps = [":expr_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "expr_csharp_proto",
+- deps = [":expr_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "expr_csharp_grpc",
+- srcs = [":expr_proto"],
+- deps = [":expr_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "checked_cc_proto",
+- deps = [":checked_proto"],
+-)
+-
+-
+-cc_proto_library(
+- name = "eval_cc_proto",
+- deps = [":eval_proto"],
+-)
+-
+-cc_proto_library(
+- name = "explain_cc_proto",
+- deps = [":explain_proto"],
+-)
+-
+-cc_proto_library(
+- name = "syntax_cc_proto",
+- deps = [":syntax_proto"],
+-)
+-
+-cc_proto_library(
+- name = "value_cc_proto",
+- deps = [":value_proto"],
+-)
+diff -urN a/google/api/expr/v1beta1/BUILD.bazel b/google/api/expr/v1beta1/BUILD.bazel
+--- a/google/api/expr/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/api/expr/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,91 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "decl_proto",
+- srcs = ["decl.proto"],
+- deps = [
+- ":expr_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "eval_proto",
+- srcs = ["eval.proto"],
+- deps = [
+- ":value_proto",
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "expr_proto",
+- srcs = ["expr.proto"],
+- deps = [
+- ":source_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "source_proto",
+- srcs = ["source.proto"],
+-)
+-
+-proto_library(
+- name = "value_proto",
+- srcs = ["value.proto"],
+- deps = [
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "cel_proto",
+- deps = [
+- ":decl_proto",
+- ":eval_proto",
+- ":expr_proto",
+- ":source_proto",
+- ":value_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "decl_cc_proto",
+- deps = [":decl_proto"],
+-)
+-
+-cc_proto_library(
+- name = "eval_cc_proto",
+- deps = [":eval_proto"],
+-)
+-
+-cc_proto_library(
+- name = "expr_cc_proto",
+- deps = [":expr_proto"],
+-)
+-
+-cc_proto_library(
+- name = "source_cc_proto",
+- deps = [":source_proto"],
+-)
+-
+-cc_proto_library(
+- name = "value_cc_proto",
+- deps = [":value_proto"],
+-)
+diff -urN a/google/api/servicecontrol/BUILD.bazel b/google/api/servicecontrol/BUILD.bazel
+--- a/google/api/servicecontrol/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/api/servicecontrol/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-service_control.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for servicecontrol.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "servicecontrol_ruby_wrapper",
+- srcs = ["//google/api/servicecontrol/v1:servicecontrol_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-service_control",
+- "ruby-cloud-env-prefix=SERVICE_CONTROL",
+- "ruby-cloud-wrapper-of=v1:0.3",
+- "ruby-cloud-product-url=https://cloud.google.com/service-infrastructure/docs/overview/",
+- "ruby-cloud-api-id=servicecontrol.googleapis.com",
+- "ruby-cloud-api-shortname=servicecontrol",
+- ],
+- ruby_cloud_description = "The Service Control API provides control plane functionality to managed services, such as logging, monitoring, and status checks.",
+- ruby_cloud_title = "Service Control API",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-servicecontrol-ruby",
+- deps = [
+- ":servicecontrol_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/api/servicecontrol/v1/BUILD.bazel b/google/api/servicecontrol/v1/BUILD.bazel
+--- a/google/api/servicecontrol/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/api/servicecontrol/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,353 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "servicecontrol_proto",
+- srcs = [
+- "check_error.proto",
+- "distribution.proto",
+- "http_request.proto",
+- "log_entry.proto",
+- "metric_value.proto",
+- "operation.proto",
+- "quota_controller.proto",
+- "service_controller.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:distribution_proto",
+- "//google/logging/type:type_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "servicecontrol_proto_with_info",
+- deps = [
+- ":servicecontrol_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "servicecontrol_java_proto",
+- deps = [":servicecontrol_proto"],
+-)
+-
+-java_grpc_library(
+- name = "servicecontrol_java_grpc",
+- srcs = [":servicecontrol_proto"],
+- deps = [":servicecontrol_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "servicecontrol_java_gapic",
+- srcs = [":servicecontrol_proto_with_info"],
+- grpc_service_config = "servicecontrol_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":servicecontrol_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":servicecontrol_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "servicecontrol_java_gapic_test_suite",
+- test_classes = [
+- "com.google.api.servicecontrol.v1.QuotaControllerClientHttpJsonTest",
+- "com.google.api.servicecontrol.v1.QuotaControllerClientTest",
+- "com.google.api.servicecontrol.v1.ServiceControllerClientHttpJsonTest",
+- "com.google.api.servicecontrol.v1.ServiceControllerClientTest",
+- ],
+- runtime_deps = [":servicecontrol_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-api-servicecontrol-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":servicecontrol_java_gapic",
+- ":servicecontrol_java_grpc",
+- ":servicecontrol_java_proto",
+- ":servicecontrol_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "servicecontrol_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/api/servicecontrol/v1",
+- protos = [":servicecontrol_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:distribution_go_proto",
+- "//google/logging/type:type_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "servicecontrol_go_gapic",
+- srcs = [":servicecontrol_proto_with_info"],
+- grpc_service_config = "servicecontrol_grpc_service_config.json",
+- importpath = "cloud.google.com/go/api/servicecontrol/apiv1;servicecontrol",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "servicecontrol.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":servicecontrol_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "servicecontrol_go_gapic_test",
+- srcs = [":servicecontrol_go_gapic_srcjar_test"],
+- embed = [":servicecontrol_go_gapic"],
+- importpath = "cloud.google.com/go/api/servicecontrol/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-api-servicecontrol-v1-go",
+- deps = [
+- ":servicecontrol_go_gapic",
+- ":servicecontrol_go_gapic_srcjar-metadata.srcjar",
+- ":servicecontrol_go_gapic_srcjar-test.srcjar",
+- ":servicecontrol_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "servicecontrol_py_gapic",
+- srcs = [":servicecontrol_proto"],
+- grpc_service_config = "servicecontrol_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=servicecontrol",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-service-control",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "servicecontrol_py_gapic_test",
+- srcs = [
+- "servicecontrol_py_gapic_pytest.py",
+- "servicecontrol_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":servicecontrol_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "google-cloud-servicecontrol-v1-py",
+- deps = [
+- ":servicecontrol_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "servicecontrol_php_proto",
+- deps = [":servicecontrol_proto"],
+-)
+-
+-php_grpc_library(
+- name = "servicecontrol_php_grpc",
+- srcs = [":servicecontrol_proto"],
+- deps = [":servicecontrol_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "servicecontrol_php_gapic",
+- srcs = [":servicecontrol_proto_with_info"],
+- grpc_service_config = "servicecontrol_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "servicecontrol.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":servicecontrol_php_grpc",
+- ":servicecontrol_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-api-servicecontrol-v1-php",
+- deps = [
+- ":servicecontrol_php_gapic",
+- ":servicecontrol_php_grpc",
+- ":servicecontrol_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "servicecontrol_nodejs_gapic",
+- package_name = "@google-cloud/service-control",
+- src = ":servicecontrol_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "servicecontrol_grpc_service_config.json",
+- package = "google.api.servicecontrol.v1",
+- rest_numeric_enums = False,
+- service_yaml = "servicecontrol.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "api-servicecontrol-v1-nodejs",
+- deps = [
+- ":servicecontrol_nodejs_gapic",
+- ":servicecontrol_proto",
+- ## DO NOT CHANGE: Owlbot add dependency logging type protos.
+- "//google/logging/type:type_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "servicecontrol_ruby_proto",
+- deps = [":servicecontrol_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "servicecontrol_ruby_grpc",
+- srcs = [":servicecontrol_proto"],
+- deps = [":servicecontrol_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "servicecontrol_ruby_gapic",
+- srcs = [":servicecontrol_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=servicecontrol.googleapis.com",
+- "ruby-cloud-api-shortname=servicecontrol",
+- "ruby-cloud-env-prefix=SERVICE_CONTROL",
+- "ruby-cloud-gem-name=google-cloud-service_control-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/service-infrastructure/docs/overview/",
+- ],
+- grpc_service_config = "servicecontrol_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Service Control API provides control plane functionality to managed services, such as logging, monitoring, and status checks.",
+- ruby_cloud_title = "Service Control API V1",
+- deps = [
+- ":servicecontrol_ruby_grpc",
+- ":servicecontrol_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-api-servicecontrol-v1-ruby",
+- deps = [
+- ":servicecontrol_ruby_gapic",
+- ":servicecontrol_ruby_grpc",
+- ":servicecontrol_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "servicecontrol_csharp_proto",
+- deps = [":servicecontrol_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "servicecontrol_csharp_grpc",
+- srcs = [":servicecontrol_proto"],
+- deps = [":servicecontrol_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "servicecontrol_csharp_gapic",
+- srcs = [":servicecontrol_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "servicecontrol_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "servicecontrol.yaml",
+- deps = [
+- ":servicecontrol_csharp_grpc",
+- ":servicecontrol_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-api-servicecontrol-v1-csharp",
+- deps = [
+- ":servicecontrol_csharp_gapic",
+- ":servicecontrol_csharp_grpc",
+- ":servicecontrol_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "servicecontrol_cc_proto",
+- deps = [":servicecontrol_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "servicecontrol_cc_grpc",
+- srcs = [":servicecontrol_proto"],
+- grpc_only = True,
+- deps = [":servicecontrol_cc_proto"],
+-)
+diff -urN a/google/api/servicecontrol/v2/BUILD.bazel b/google/api/servicecontrol/v2/BUILD.bazel
+--- a/google/api/servicecontrol/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/api/servicecontrol/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,339 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "servicecontrol_proto",
+- srcs = [
+- "service_controller.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/rpc:status_proto",
+- "//google/rpc/context:attribute_context_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "servicecontrol_proto_with_info",
+- deps = [
+- ":servicecontrol_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "servicecontrol_java_proto",
+- deps = [":servicecontrol_proto"],
+-)
+-
+-java_grpc_library(
+- name = "servicecontrol_java_grpc",
+- srcs = [":servicecontrol_proto"],
+- deps = [":servicecontrol_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "servicecontrol_java_gapic",
+- srcs = [":servicecontrol_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "servicecontrol_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "servicecontrol.yaml",
+- test_deps = [
+- ":servicecontrol_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":servicecontrol_java_proto",
+- "//google/api:api_java_proto",
+- "//google/rpc/context:attribute_context_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "servicecontrol_java_gapic_test_suite",
+- test_classes = [
+- "com.google.api.servicecontrol.v2.ServiceControllerClientHttpJsonTest",
+- "com.google.api.servicecontrol.v2.ServiceControllerClientTest",
+- ],
+- runtime_deps = [":servicecontrol_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-api-servicecontrol-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":servicecontrol_java_gapic",
+- ":servicecontrol_java_grpc",
+- ":servicecontrol_java_proto",
+- ":servicecontrol_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "servicecontrol_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/api/servicecontrol/v2",
+- protos = [":servicecontrol_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/rpc/context:attribute_context_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "servicecontrol_go_gapic",
+- srcs = [":servicecontrol_proto_with_info"],
+- grpc_service_config = "servicecontrol_grpc_service_config.json",
+- importpath = "cloud.google.com/go/api/servicecontrol/apiv2;servicecontrol",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "servicecontrol.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":servicecontrol_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "servicecontrol_go_gapic_test",
+- srcs = [":servicecontrol_go_gapic_srcjar_test"],
+- embed = [":servicecontrol_go_gapic"],
+- importpath = "cloud.google.com/go/api/servicecontrol/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-api-servicecontrol-v2-go",
+- deps = [
+- ":servicecontrol_go_gapic",
+- ":servicecontrol_go_gapic_srcjar-metadata.srcjar",
+- ":servicecontrol_go_gapic_srcjar-test.srcjar",
+- ":servicecontrol_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "servicecontrol_py_gapic",
+- srcs = [":servicecontrol_proto"],
+- grpc_service_config = "servicecontrol_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=servicecontrol",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-service-control",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "servicecontrol_py_gapic_test",
+- srcs = [
+- "servicecontrol_py_gapic_pytest.py",
+- "servicecontrol_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":servicecontrol_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "api-servicecontrol-v2-py",
+- deps = [
+- ":servicecontrol_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "servicecontrol_php_proto",
+- deps = [":servicecontrol_proto"],
+-)
+-
+-php_grpc_library(
+- name = "servicecontrol_php_grpc",
+- srcs = [":servicecontrol_proto"],
+- deps = [":servicecontrol_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "servicecontrol_php_gapic",
+- srcs = [":servicecontrol_proto_with_info"],
+- grpc_service_config = "servicecontrol_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "servicecontrol.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":servicecontrol_php_grpc",
+- ":servicecontrol_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-api-servicecontrol-v2-php",
+- deps = [
+- ":servicecontrol_php_gapic",
+- ":servicecontrol_php_grpc",
+- ":servicecontrol_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "servicecontrol_nodejs_gapic",
+- package_name = "@google-cloud/servicecontrol",
+- src = ":servicecontrol_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "servicecontrol_grpc_service_config.json",
+- package = "google.api.servicecontrol.v2",
+- rest_numeric_enums = False,
+- service_yaml = "servicecontrol.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "api-servicecontrol-v2-nodejs",
+- deps = [
+- ":servicecontrol_nodejs_gapic",
+- ":servicecontrol_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "servicecontrol_ruby_proto",
+- deps = [":servicecontrol_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "servicecontrol_ruby_grpc",
+- srcs = [":servicecontrol_proto"],
+- deps = [":servicecontrol_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "servicecontrol_ruby_gapic",
+- srcs = [":servicecontrol_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=servicecontrol.googleapis.com",
+- "ruby-cloud-api-shortname=servicecontrol",
+- "ruby-cloud-env-prefix=SERVICE_CONTROL",
+- "ruby-cloud-gem-name=google-cloud-service_control-v2",
+- "ruby-cloud-product-url=https://cloud.google.com/service-infrastructure/docs/overview/",
+- ],
+- grpc_service_config = "servicecontrol_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Service Control API provides control plane functionality to managed services, such as logging, monitoring, and status checks.",
+- ruby_cloud_title = "Service Control API V2",
+- deps = [
+- ":servicecontrol_ruby_grpc",
+- ":servicecontrol_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-api-servicecontrol-v2-ruby",
+- deps = [
+- ":servicecontrol_ruby_gapic",
+- ":servicecontrol_ruby_grpc",
+- ":servicecontrol_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "servicecontrol_csharp_proto",
+- deps = [":servicecontrol_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "servicecontrol_csharp_grpc",
+- srcs = [":servicecontrol_proto"],
+- deps = [":servicecontrol_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "servicecontrol_csharp_gapic",
+- srcs = [":servicecontrol_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "servicecontrol_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "servicecontrol.yaml",
+- deps = [
+- ":servicecontrol_csharp_grpc",
+- ":servicecontrol_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-api-servicecontrol-v2-csharp",
+- deps = [
+- ":servicecontrol_csharp_gapic",
+- ":servicecontrol_csharp_grpc",
+- ":servicecontrol_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "servicecontrol_cc_proto",
+- deps = [":servicecontrol_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "servicecontrol_cc_grpc",
+- srcs = [":servicecontrol_proto"],
+- grpc_only = True,
+- deps = [":servicecontrol_cc_proto"],
+-)
+diff -urN a/google/api/servicemanagement/BUILD.bazel b/google/api/servicemanagement/BUILD.bazel
+--- a/google/api/servicemanagement/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/api/servicemanagement/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-service_management.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for servicemanagement.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "servicemanagement_ruby_wrapper",
+- srcs = ["//google/api/servicemanagement/v1:servicemanagement_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-service_management",
+- "ruby-cloud-env-prefix=SERVICE_MANAGEMENT",
+- "ruby-cloud-wrapper-of=v1:0.3",
+- "ruby-cloud-product-url=https://cloud.google.com/service-infrastructure/docs/overview/",
+- "ruby-cloud-api-id=servicemanagement.googleapis.com",
+- "ruby-cloud-api-shortname=servicemanagement",
+- ],
+- ruby_cloud_description = "Google Service Management allows service producers to publish their services on Google Cloud Platform so that they can be discovered and used by service consumers.",
+- ruby_cloud_title = "Service Management",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-servicemanagement-ruby",
+- deps = [
+- ":servicemanagement_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/api/servicemanagement/v1/BUILD.bazel b/google/api/servicemanagement/v1/BUILD.bazel
+--- a/google/api/servicemanagement/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/api/servicemanagement/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,349 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "servicemanagement_proto",
+- srcs = [
+- "resources.proto",
+- "servicemanager.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:config_change_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:service_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "servicemanagement_proto_with_info",
+- deps = [
+- ":servicemanagement_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "servicemanagement_java_proto",
+- deps = [":servicemanagement_proto"],
+-)
+-
+-java_grpc_library(
+- name = "servicemanagement_java_grpc",
+- srcs = [":servicemanagement_proto"],
+- deps = [":servicemanagement_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "servicemanagement_java_gapic",
+- srcs = [":servicemanagement_proto_with_info"],
+- gapic_yaml = "servicemanagement_gapic.yaml",
+- grpc_service_config = "servicemanagement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "servicemanagement_v1.yaml",
+- test_deps = [
+- ":servicemanagement_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":servicemanagement_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "servicemanagement_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.api.servicemanagement.v1.ServiceManagerClientHttpJsonTest",
+- "com.google.cloud.api.servicemanagement.v1.ServiceManagerClientTest",
+- ],
+- runtime_deps = [":servicemanagement_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-api-servicemanagement-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":servicemanagement_java_gapic",
+- ":servicemanagement_java_grpc",
+- ":servicemanagement_java_proto",
+- ":servicemanagement_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "servicemanagement_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/api/servicemanagement/v1",
+- protos = [":servicemanagement_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:configchange_go_proto",
+- "//google/api:serviceconfig_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "servicemanagement_go_gapic",
+- srcs = [":servicemanagement_proto_with_info"],
+- grpc_service_config = "servicemanagement_grpc_service_config.json",
+- importpath = "cloud.google.com/go/api/servicemanagement/apiv1;servicemanagement",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "servicemanagement_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":servicemanagement_go_proto",
+- "//google/api:serviceconfig_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "servicemanagement_go_gapic_test",
+- srcs = [":servicemanagement_go_gapic_srcjar_test"],
+- embed = [":servicemanagement_go_gapic"],
+- importpath = "cloud.google.com/go/api/servicemanagement/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-api-servicemanagement-v1-go",
+- deps = [
+- ":servicemanagement_go_gapic",
+- ":servicemanagement_go_gapic_srcjar-metadata.srcjar",
+- ":servicemanagement_go_gapic_srcjar-test.srcjar",
+- ":servicemanagement_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "servicemanagement_py_gapic",
+- srcs = [":servicemanagement_proto"],
+- grpc_service_config = "servicemanagement_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=servicemanagement",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-service-management",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "servicemanagement_py_gapic_test",
+- srcs = [
+- "servicemanagement_py_gapic_pytest.py",
+- "servicemanagement_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":servicemanagement_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "google-cloud-servicemanagement-v1-py",
+- deps = [
+- ":servicemanagement_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "servicemanagement_php_proto",
+- deps = [":servicemanagement_proto"],
+-)
+-
+-php_grpc_library(
+- name = "servicemanagement_php_grpc",
+- srcs = [":servicemanagement_proto"],
+- deps = [":servicemanagement_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "servicemanagement_php_gapic",
+- srcs = [":servicemanagement_proto_with_info"],
+- grpc_service_config = "servicemanagement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "servicemanagement_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":servicemanagement_php_grpc",
+- ":servicemanagement_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-api-servicemanagement-v1-php",
+- deps = [
+- ":servicemanagement_php_gapic",
+- ":servicemanagement_php_grpc",
+- ":servicemanagement_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "servicemanagement_nodejs_gapic",
+- package_name = "@google-cloud/service-management",
+- src = ":servicemanagement_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "servicemanagement_grpc_service_config.json",
+- package = "google.api.servicemanagement.v1",
+- rest_numeric_enums = False,
+- service_yaml = "servicemanagement_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "api-servicemanagement-v1-nodejs",
+- deps = [
+- ":servicemanagement_nodejs_gapic",
+- ":servicemanagement_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "servicemanagement_ruby_proto",
+- deps = [":servicemanagement_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "servicemanagement_ruby_grpc",
+- srcs = [":servicemanagement_proto"],
+- deps = [":servicemanagement_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "servicemanagement_ruby_gapic",
+- srcs = [":servicemanagement_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=servicemanagement.googleapis.com",
+- "ruby-cloud-api-shortname=servicemanagement",
+- "ruby-cloud-env-prefix=SERVICE_MANAGEMENT",
+- "ruby-cloud-gem-name=google-cloud-service_management-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/service-infrastructure/docs/overview/",
+- ],
+- grpc_service_config = "servicemanagement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Google Service Management allows service producers to publish their services on Google Cloud Platform so that they can be discovered and used by service consumers.",
+- ruby_cloud_title = "Service Management V1",
+- deps = [
+- ":servicemanagement_ruby_grpc",
+- ":servicemanagement_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-api-servicemanagement-v1-ruby",
+- deps = [
+- ":servicemanagement_ruby_gapic",
+- ":servicemanagement_ruby_grpc",
+- ":servicemanagement_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "servicemanagement_csharp_proto",
+- deps = [":servicemanagement_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "servicemanagement_csharp_grpc",
+- srcs = [":servicemanagement_proto"],
+- deps = [":servicemanagement_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "servicemanagement_csharp_gapic",
+- srcs = [":servicemanagement_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "servicemanagement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "servicemanagement_v1.yaml",
+- deps = [
+- ":servicemanagement_csharp_grpc",
+- ":servicemanagement_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-api-servicemanagement-v1-csharp",
+- deps = [
+- ":servicemanagement_csharp_gapic",
+- ":servicemanagement_csharp_grpc",
+- ":servicemanagement_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "servicemanagement_cc_proto",
+- deps = [":servicemanagement_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "servicemanagement_cc_grpc",
+- srcs = [":servicemanagement_proto"],
+- grpc_only = True,
+- deps = [":servicemanagement_cc_proto"],
+-)
+diff -urN a/google/api/serviceusage/BUILD.bazel b/google/api/serviceusage/BUILD.bazel
+--- a/google/api/serviceusage/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/api/serviceusage/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-service_usage.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for serviceusage.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "serviceusage_ruby_wrapper",
+- srcs = ["//google/api/serviceusage/v1:serviceusage_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-service_usage",
+- "ruby-cloud-env-prefix=SERVICE_USAGE",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/service-usage/",
+- "ruby-cloud-api-id=serviceusage.googleapis.com",
+- "ruby-cloud-api-shortname=serviceusage",
+- ],
+- ruby_cloud_description = "Service Usage is an infrastructure service of Google Cloud that lets you list and manage other APIs and services in your Cloud projects. You can list and manage Google Cloud services and their APIs, as well as services created using Cloud Endpoints.",
+- ruby_cloud_title = "Service Usage",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-serviceusage-ruby",
+- deps = [
+- ":serviceusage_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/api/serviceusage/v1/BUILD.bazel b/google/api/serviceusage/v1/BUILD.bazel
+--- a/google/api/serviceusage/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/api/serviceusage/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,357 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "serviceusage_proto",
+- srcs = [
+- "resources.proto",
+- "serviceusage.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:auth_proto",
+- "//google/api:client_proto",
+- "//google/api:documentation_proto",
+- "//google/api:endpoint_proto",
+- "//google/api:monitored_resource_proto",
+- "//google/api:monitoring_proto",
+- "//google/api:quota_proto",
+- "//google/api:usage_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:api_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "serviceusage_proto_with_info",
+- deps = [
+- ":serviceusage_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "serviceusage_java_proto",
+- deps = [":serviceusage_proto"],
+-)
+-
+-java_grpc_library(
+- name = "serviceusage_java_grpc",
+- srcs = [":serviceusage_proto"],
+- deps = [":serviceusage_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "serviceusage_java_gapic",
+- srcs = [":serviceusage_proto_with_info"],
+- grpc_service_config = "serviceusage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":serviceusage_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":serviceusage_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "serviceusage_java_gapic_test_suite",
+- test_classes = [
+- "com.google.api.serviceusage.v1.ServiceUsageClientHttpJsonTest",
+- "com.google.api.serviceusage.v1.ServiceUsageClientTest",
+- ],
+- runtime_deps = [":serviceusage_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-api-serviceusage-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":serviceusage_java_gapic",
+- ":serviceusage_java_grpc",
+- ":serviceusage_java_proto",
+- ":serviceusage_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-# load(
+-# "@com_google_googleapis_imports//:imports.bzl",
+-# "go_gapic_assembly_pkg",
+-# "go_gapic_library",
+-# "go_proto_library",
+-# "go_test",
+-# )
+-
+-# go_proto_library(
+-# name = "serviceusage_go_proto",
+-# compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+-# importpath = "google.golang.org/genproto/googleapis/api/serviceusage/v1",
+-# protos = [":serviceusage_proto"],
+-# deps = [
+-# "//google/api:annotations_go_proto",
+-# "//google/api:auth_go_proto",
+-# "//google/api:documentation_go_proto",
+-# "//google/api:endpoint_go_proto",
+-# "//google/api:monitoredres_go_proto",
+-# "//google/api:monitoring_go_proto",
+-# "//google/api:serviceconfig_go_proto",
+-# "//google/api:usage_go_proto",
+-# "//google/longrunning:longrunning_go_proto",
+-# ],
+-# )
+-
+-# go_gapic_library(
+-# name = "serviceusage_go_gapic",
+-# srcs = [":serviceusage_proto_with_info"],
+-# grpc_service_config = "serviceusage_grpc_service_config.json",
+-# importpath = "cloud.google.com/go/api/serviceusage/apiv1;serviceusage",
+-# service_yaml = "serviceusage_v1.yaml",
+-# metadata = True,
+-# deps = [
+-# ":serviceusage_go_proto",
+-# "//google/longrunning:longrunning_go_proto",
+-# "@com_google_cloud_go//longrunning/autogen:go_default_library",
+-# "@com_google_cloud_go//longrunning:go_default_library",
+-# ],
+-# )
+-
+-# go_test(
+-# name = "serviceusage_go_gapic_test",
+-# srcs = [":serviceusage_go_gapic_srcjar_test"],
+-# embed = [":serviceusage_go_gapic"],
+-# importpath = "cloud.google.com/go/api/serviceusage/apiv1",
+-# )
+-
+-# # Open Source Packages
+-# go_gapic_assembly_pkg(
+-# name = "gapi-cloud-api-serviceusage-v1-go",
+-# deps = [
+-# ":serviceusage_go_gapic",
+-# ":serviceusage_go_gapic_srcjar-test.srcjar",
+-# ":serviceusage_go_gapic_srcjar-metadata.srcjar",
+-# ":serviceusage_go_proto",
+-# ],
+-# )
+-
+-py_gapic_library(
+- name = "serviceusage_py_gapic",
+- srcs = [":serviceusage_proto"],
+- grpc_service_config = "serviceusage_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-service-usage",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=service_usage",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "serviceusage_py_gapic_test",
+- srcs = [
+- "serviceusage_py_gapic_pytest.py",
+- "serviceusage_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":serviceusage_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "api-serviceusage-v1-py",
+- deps = [
+- ":serviceusage_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "serviceusage_php_proto",
+- deps = [":serviceusage_proto"],
+-)
+-
+-php_grpc_library(
+- name = "serviceusage_php_grpc",
+- srcs = [":serviceusage_proto"],
+- deps = [":serviceusage_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "serviceusage_php_gapic",
+- srcs = [":serviceusage_proto_with_info"],
+- grpc_service_config = "serviceusage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "serviceusage_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":serviceusage_php_grpc",
+- ":serviceusage_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-api-serviceusage-v1-php",
+- deps = [
+- ":serviceusage_php_gapic",
+- ":serviceusage_php_grpc",
+- ":serviceusage_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "serviceusage_nodejs_gapic",
+- package_name = "@google-cloud/service-usage",
+- src = ":serviceusage_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "serviceusage_grpc_service_config.json",
+- package = "google.api.serviceusage.v1",
+- rest_numeric_enums = False,
+- service_yaml = "serviceusage_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "api-serviceusage-v1-nodejs",
+- deps = [
+- ":serviceusage_nodejs_gapic",
+- ":serviceusage_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "serviceusage_ruby_proto",
+- deps = [":serviceusage_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "serviceusage_ruby_grpc",
+- srcs = [":serviceusage_proto"],
+- deps = [":serviceusage_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "serviceusage_ruby_gapic",
+- srcs = [":serviceusage_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-service_usage-v1",
+- "ruby-cloud-env-prefix=SERVICE_USAGE",
+- "ruby-cloud-product-url=https://cloud.google.com/service-usage/",
+- "ruby-cloud-api-id=serviceusage.googleapis.com",
+- "ruby-cloud-api-shortname=serviceusage",
+- ],
+- grpc_service_config = "serviceusage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Service Usage is an infrastructure service of Google Cloud that lets you list and manage other APIs and services in your Cloud projects. You can list and manage Google Cloud services and their APIs, as well as services created using Cloud Endpoints.",
+- ruby_cloud_title = "Service Usage V1",
+- deps = [
+- ":serviceusage_ruby_grpc",
+- ":serviceusage_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-api-serviceusage-v1-ruby",
+- deps = [
+- ":serviceusage_ruby_gapic",
+- ":serviceusage_ruby_grpc",
+- ":serviceusage_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "serviceusage_csharp_proto",
+- deps = [":serviceusage_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "serviceusage_csharp_grpc",
+- srcs = [":serviceusage_proto"],
+- deps = [":serviceusage_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "serviceusage_csharp_gapic",
+- srcs = [":serviceusage_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "serviceusage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- # service_yaml = "serviceusage_v1.yaml",
+- deps = [
+- ":serviceusage_csharp_grpc",
+- ":serviceusage_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-api-serviceusage-v1-csharp",
+- deps = [
+- ":serviceusage_csharp_gapic",
+- ":serviceusage_csharp_grpc",
+- ":serviceusage_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "serviceusage_cc_proto",
+- deps = [":serviceusage_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "serviceusage_cc_grpc",
+- srcs = [":serviceusage_proto"],
+- grpc_only = True,
+- deps = [":serviceusage_cc_proto"],
+-)
+diff -urN a/google/api/serviceusage/v1beta1/BUILD.bazel b/google/api/serviceusage/v1beta1/BUILD.bazel
+--- a/google/api/serviceusage/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/api/serviceusage/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,335 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "serviceusage_proto",
+- srcs = [
+- "resources.proto",
+- "serviceusage.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:auth_proto",
+- "//google/api:client_proto",
+- "//google/api:documentation_proto",
+- "//google/api:endpoint_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:monitored_resource_proto",
+- "//google/api:monitoring_proto",
+- "//google/api:quota_proto",
+- "//google/api:usage_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:api_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "serviceusage_proto_with_info",
+- deps = [
+- ":serviceusage_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "serviceusage_java_proto",
+- deps = [":serviceusage_proto"],
+-)
+-
+-java_grpc_library(
+- name = "serviceusage_java_grpc",
+- srcs = [":serviceusage_proto"],
+- deps = [":serviceusage_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "serviceusage_java_gapic",
+- srcs = [":serviceusage_proto_with_info"],
+- grpc_service_config = "serviceusage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":serviceusage_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":serviceusage_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "serviceusage_java_gapic_test_suite",
+- test_classes = [
+- "com.google.api.serviceusage.v1beta1.ServiceUsageClientHttpJsonTest",
+- "com.google.api.serviceusage.v1beta1.ServiceUsageClientTest",
+- ],
+- runtime_deps = [":serviceusage_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-api-serviceusage-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":serviceusage_java_gapic",
+- ":serviceusage_java_grpc",
+- ":serviceusage_java_proto",
+- ":serviceusage_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "serviceusage_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/api/serviceusage/v1beta1",
+- protos = [":serviceusage_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:monitoredres_go_proto",
+- "//google/api:serviceconfig_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "serviceusage_go_gapic",
+- srcs = [":serviceusage_proto_with_info"],
+- grpc_service_config = "serviceusage_grpc_service_config.json",
+- importpath = "cloud.google.com/go/api/serviceusage/apiv1beta1;serviceusage",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "serviceusage_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":serviceusage_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "serviceusage_go_gapic_test",
+- srcs = [":serviceusage_go_gapic_srcjar_test"],
+- embed = [":serviceusage_go_gapic"],
+- importpath = "cloud.google.com/go/api/serviceusage/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-api-serviceusage-v1beta1-go",
+- deps = [
+- ":serviceusage_go_gapic",
+- ":serviceusage_go_gapic_srcjar-metadata.srcjar",
+- ":serviceusage_go_gapic_srcjar-test.srcjar",
+- ":serviceusage_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "serviceusage_py_gapic",
+- srcs = [":serviceusage_proto"],
+- grpc_service_config = "serviceusage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1376 is fixed
+-#py_test(
+-# name = "serviceusage_py_gapic_test",
+-# srcs = [
+-# "serviceusage_py_gapic_pytest.py",
+-# "serviceusage_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":serviceusage_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "api-serviceusage-v1beta1-py",
+- deps = [
+- ":serviceusage_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "serviceusage_php_proto",
+- deps = [":serviceusage_proto"],
+-)
+-
+-php_grpc_library(
+- name = "serviceusage_php_grpc",
+- srcs = [":serviceusage_proto"],
+- deps = [":serviceusage_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "serviceusage_php_gapic",
+- srcs = [":serviceusage_proto_with_info"],
+- grpc_service_config = "serviceusage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "serviceusage_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":serviceusage_php_grpc",
+- ":serviceusage_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-api-serviceusage-v1beta1-php",
+- deps = [
+- ":serviceusage_php_gapic",
+- ":serviceusage_php_grpc",
+- ":serviceusage_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "serviceusage_nodejs_gapic",
+- package_name = "@google-cloud/service-usage",
+- src = ":serviceusage_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "serviceusage_grpc_service_config.json",
+- package = "google.api.serviceusage.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "serviceusage_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "api-serviceusage-v1beta1-nodejs",
+- deps = [
+- ":serviceusage_nodejs_gapic",
+- ":serviceusage_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "serviceusage_ruby_proto",
+- deps = [":serviceusage_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "serviceusage_ruby_grpc",
+- srcs = [":serviceusage_proto"],
+- deps = [":serviceusage_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "serviceusage_ruby_gapic",
+- srcs = [":serviceusage_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-service_usage-v1beta1",
+- "ruby-cloud-env-prefix=SERVICE_USAGE",
+- "ruby-cloud-product-url=https://cloud.google.com/service-usage/",
+- "ruby-cloud-api-id=serviceusage.googleapis.com",
+- "ruby-cloud-api-shortname=serviceusage",
+- ],
+- grpc_service_config = "serviceusage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Service Usage is an infrastructure service of Google Cloud that lets you list and manage other APIs and services in your Cloud projects. You can list and manage Google Cloud services and their APIs, as well as services created using Cloud Endpoints.",
+- ruby_cloud_title = "Service Usage V1beta1",
+- deps = [
+- ":serviceusage_ruby_grpc",
+- ":serviceusage_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-api-serviceusage-v1beta1-ruby",
+- deps = [
+- ":serviceusage_ruby_gapic",
+- ":serviceusage_ruby_grpc",
+- ":serviceusage_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "serviceusage_csharp_proto",
+- deps = [":serviceusage_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "serviceusage_csharp_grpc",
+- srcs = [":serviceusage_proto"],
+- deps = [":serviceusage_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "serviceusage_csharp_gapic",
+- srcs = [":serviceusage_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "serviceusage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "serviceusage_v1beta1.yaml",
+- deps = [
+- ":serviceusage_csharp_grpc",
+- ":serviceusage_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-api-serviceusage-v1beta1-csharp",
+- deps = [
+- ":serviceusage_csharp_gapic",
+- ":serviceusage_csharp_grpc",
+- ":serviceusage_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/appengine/BUILD.bazel b/google/appengine/BUILD.bazel
+--- a/google/appengine/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/appengine/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-app_engine.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for appengine.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "appengine_ruby_wrapper",
+- srcs = ["//google/appengine/v1:appengine_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-app_engine",
+- "ruby-cloud-env-prefix=APP_ENGINE",
+- "ruby-cloud-wrapper-of=v1:0.3",
+- "ruby-cloud-product-url=https://cloud.google.com/appengine/docs/admin-api/",
+- "ruby-cloud-api-id=appengine.googleapis.com",
+- "ruby-cloud-api-shortname=appengine",
+- ],
+- ruby_cloud_description = "The App Engine Admin API provisions and manages your App Engine applications.",
+- ruby_cloud_title = "App Engine Admin",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-appengine-ruby",
+- deps = [
+- ":appengine_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/appengine/legacy/BUILD.bazel b/google/appengine/legacy/BUILD.bazel
+--- a/google/appengine/legacy/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/appengine/legacy/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,177 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "legacy_proto",
+- srcs = [
+- "audit_data.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "legacy_java_proto",
+- deps = [":legacy_proto"],
+-)
+-
+-java_grpc_library(
+- name = "legacy_java_grpc",
+- srcs = [":legacy_proto"],
+- deps = [":legacy_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "legacy_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/appengine/legacy",
+- protos = [":legacy_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "legacy_moved_proto",
+- srcs = [":legacy_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "legacy_py_proto",
+- deps = [":legacy_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "legacy_py_grpc",
+- srcs = [":legacy_moved_proto"],
+- deps = [":legacy_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "legacy_php_proto",
+- deps = [":legacy_proto"],
+-)
+-
+-php_grpc_library(
+- name = "legacy_php_grpc",
+- srcs = [":legacy_proto"],
+- deps = [":legacy_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "legacy_ruby_proto",
+- deps = [":legacy_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "legacy_ruby_grpc",
+- srcs = [":legacy_proto"],
+- deps = [":legacy_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "legacy_csharp_proto",
+- deps = [":legacy_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "legacy_csharp_grpc",
+- srcs = [":legacy_proto"],
+- deps = [":legacy_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "legacy_cc_proto",
+- deps = [":legacy_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "legacy_cc_grpc",
+- srcs = [":legacy_proto"],
+- grpc_only = True,
+- deps = [":legacy_cc_proto"],
+-)
+diff -urN a/google/appengine/logging/v1/BUILD.bazel b/google/appengine/logging/v1/BUILD.bazel
+--- a/google/appengine/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/appengine/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,178 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "request_log.proto",
+- ],
+- deps = [
+- "//google/logging/type:type_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/appengine/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/logging/type:type_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "logging_py_gapic",
+- srcs = [":logging_proto"],
+- opt_args = [
+- "warehouse-package-name=google-cloud-appengine-logging",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=appengine_logging",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "google-cloud-appengine-logging-v1-py",
+- deps = [
+- ":logging_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/appengine/v1/BUILD.bazel b/google/appengine/v1/BUILD.bazel
+--- a/google/appengine/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/appengine/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,371 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "appengine_proto",
+- srcs = [
+- "app_yaml.proto",
+- "appengine.proto",
+- "application.proto",
+- "audit_data.proto",
+- "certificate.proto",
+- "deploy.proto",
+- "deployed_files.proto",
+- "domain.proto",
+- "domain_mapping.proto",
+- "firewall.proto",
+- "instance.proto",
+- "location.proto",
+- "network_settings.proto",
+- "operation.proto",
+- "service.proto",
+- "version.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "appengine_proto_with_info",
+- deps = [
+- ":appengine_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "appengine_java_proto",
+- deps = [":appengine_proto"],
+-)
+-
+-java_grpc_library(
+- name = "appengine_java_grpc",
+- srcs = [":appengine_proto"],
+- deps = [":appengine_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "appengine_java_gapic",
+- srcs = [":appengine_proto_with_info"],
+- grpc_service_config = "appengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":appengine_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":appengine_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "appengine_java_gapic_test_suite",
+- test_classes = [
+- "com.google.appengine.v1.ApplicationsClientHttpJsonTest",
+- "com.google.appengine.v1.ApplicationsClientTest",
+- "com.google.appengine.v1.AuthorizedCertificatesClientHttpJsonTest",
+- "com.google.appengine.v1.AuthorizedCertificatesClientTest",
+- "com.google.appengine.v1.AuthorizedDomainsClientHttpJsonTest",
+- "com.google.appengine.v1.AuthorizedDomainsClientTest",
+- "com.google.appengine.v1.DomainMappingsClientHttpJsonTest",
+- "com.google.appengine.v1.DomainMappingsClientTest",
+- "com.google.appengine.v1.FirewallClientHttpJsonTest",
+- "com.google.appengine.v1.FirewallClientTest",
+- "com.google.appengine.v1.InstancesClientHttpJsonTest",
+- "com.google.appengine.v1.InstancesClientTest",
+- "com.google.appengine.v1.ServicesClientHttpJsonTest",
+- "com.google.appengine.v1.ServicesClientTest",
+- "com.google.appengine.v1.VersionsClientHttpJsonTest",
+- "com.google.appengine.v1.VersionsClientTest",
+- ],
+- runtime_deps = [":appengine_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-appengine-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":appengine_java_gapic",
+- ":appengine_java_grpc",
+- ":appengine_java_proto",
+- ":appengine_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "appengine_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/appengine/v1",
+- protos = [":appengine_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "appengine_go_gapic",
+- srcs = [":appengine_proto_with_info"],
+- grpc_service_config = "appengine_grpc_service_config.json",
+- importpath = "cloud.google.com/go/appengine/apiv1;appengine",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "appengine_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":appengine_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "appengine_go_gapic_test",
+- srcs = [":appengine_go_gapic_srcjar_test"],
+- embed = [":appengine_go_gapic"],
+- importpath = "cloud.google.com/go/appengine/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-appengine-v1-go",
+- deps = [
+- ":appengine_go_gapic",
+- ":appengine_go_gapic_srcjar-metadata.srcjar",
+- ":appengine_go_gapic_srcjar-test.srcjar",
+- ":appengine_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "appengine_py_gapic",
+- srcs = [":appengine_proto"],
+- grpc_service_config = "appengine_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-appengine-admin",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=appengine_admin",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "appengine_py_gapic_test",
+- srcs = [
+- "appengine_py_gapic_pytest.py",
+- "appengine_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":appengine_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "google-cloud-appengine-v1-py",
+- deps = [
+- ":appengine_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "appengine_php_proto",
+- deps = [":appengine_proto"],
+-)
+-
+-php_grpc_library(
+- name = "appengine_php_grpc",
+- srcs = [":appengine_proto"],
+- deps = [":appengine_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "appengine_php_gapic",
+- srcs = [":appengine_proto_with_info"],
+- grpc_service_config = "appengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "appengine_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":appengine_php_grpc",
+- ":appengine_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-appengine-v1-php",
+- deps = [
+- ":appengine_php_gapic",
+- ":appengine_php_grpc",
+- ":appengine_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "appengine_nodejs_gapic",
+- package_name = "@google-cloud/appengine-admin",
+- src = ":appengine_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "appengine_grpc_service_config.json",
+- package = "google.appengine.v1",
+- rest_numeric_enums = False,
+- service_yaml = "appengine_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "appengine-v1-nodejs",
+- deps = [
+- ":appengine_nodejs_gapic",
+- ":appengine_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "appengine_ruby_proto",
+- deps = [":appengine_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "appengine_ruby_grpc",
+- srcs = [":appengine_proto"],
+- deps = [":appengine_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "appengine_ruby_gapic",
+- srcs = [":appengine_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-app_engine-v1",
+- "ruby-cloud-env-prefix=APP_ENGINE",
+- "ruby-cloud-product-url=https://cloud.google.com/appengine/docs/admin-api/",
+- "ruby-cloud-api-id=appengine.googleapis.com",
+- "ruby-cloud-api-shortname=appengine",
+- ],
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The App Engine Admin API provisions and manages your App Engine applications.",
+- ruby_cloud_title = "App Engine Admin V1",
+- deps = [
+- ":appengine_ruby_grpc",
+- ":appengine_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-appengine-v1-ruby",
+- deps = [
+- ":appengine_ruby_gapic",
+- ":appengine_ruby_grpc",
+- ":appengine_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "appengine_csharp_proto",
+- deps = [":appengine_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "appengine_csharp_grpc",
+- srcs = [":appengine_proto"],
+- deps = [":appengine_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "appengine_csharp_gapic",
+- srcs = [":appengine_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "appengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "appengine_v1.yaml",
+- deps = [
+- ":appengine_csharp_grpc",
+- ":appengine_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-appengine-v1-csharp",
+- deps = [
+- ":appengine_csharp_gapic",
+- ":appengine_csharp_grpc",
+- ":appengine_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "appengine_cc_proto",
+- deps = [":appengine_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "appengine_cc_grpc",
+- srcs = [":appengine_proto"],
+- grpc_only = True,
+- deps = [":appengine_cc_proto"],
+-)
+diff -urN a/google/appengine/v1beta/BUILD.bazel b/google/appengine/v1beta/BUILD.bazel
+--- a/google/appengine/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/appengine/v1beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,192 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "appengine_proto",
+- srcs = [
+- "app_yaml.proto",
+- "appengine.proto",
+- "application.proto",
+- "audit_data.proto",
+- "certificate.proto",
+- "deploy.proto",
+- "domain.proto",
+- "domain_mapping.proto",
+- "firewall.proto",
+- "instance.proto",
+- "location.proto",
+- "network_settings.proto",
+- "operation.proto",
+- "service.proto",
+- "version.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "appengine_java_proto",
+- deps = [":appengine_proto"],
+-)
+-
+-java_grpc_library(
+- name = "appengine_java_grpc",
+- srcs = [":appengine_proto"],
+- deps = [":appengine_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "appengine_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/appengine/v1beta",
+- protos = [":appengine_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "appengine_moved_proto",
+- srcs = [":appengine_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "appengine_py_proto",
+- deps = [":appengine_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "appengine_py_grpc",
+- srcs = [":appengine_moved_proto"],
+- deps = [":appengine_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "appengine_php_proto",
+- deps = [":appengine_proto"],
+-)
+-
+-php_grpc_library(
+- name = "appengine_php_grpc",
+- srcs = [":appengine_proto"],
+- deps = [":appengine_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "appengine_ruby_proto",
+- deps = [":appengine_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "appengine_ruby_grpc",
+- srcs = [":appengine_proto"],
+- deps = [":appengine_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "appengine_csharp_proto",
+- deps = [":appengine_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "appengine_csharp_grpc",
+- srcs = [":appengine_proto"],
+- deps = [":appengine_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/apps/alertcenter/v1beta1/BUILD.bazel b/google/apps/alertcenter/v1beta1/BUILD.bazel
+--- a/google/apps/alertcenter/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/apps/alertcenter/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,317 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "alertcenter_proto",
+- srcs = [
+- "alertcenter.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "alertcenter_proto_with_info",
+- deps = [
+- ":alertcenter_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "alertcenter_java_proto",
+- deps = [":alertcenter_proto"],
+-)
+-
+-java_grpc_library(
+- name = "alertcenter_java_grpc",
+- srcs = [":alertcenter_proto"],
+- deps = [":alertcenter_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "alertcenter_java_gapic",
+- srcs = [":alertcenter_proto_with_info"],
+- grpc_service_config = "alertcenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":alertcenter_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":alertcenter_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "alertcenter_java_gapic_test_suite",
+- test_classes = [
+- "com.google.apps.alertcenter.v1beta1.AlertCenterServiceClientHttpJsonTest",
+- "com.google.apps.alertcenter.v1beta1.AlertCenterServiceClientTest",
+- ],
+- runtime_deps = [":alertcenter_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-apps-alertcenter-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":alertcenter_java_gapic",
+- ":alertcenter_java_grpc",
+- ":alertcenter_java_proto",
+- ":alertcenter_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "alertcenter_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/apps/alertcenter/v1beta1",
+- protos = [":alertcenter_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "alertcenter_go_gapic",
+- srcs = [":alertcenter_proto_with_info"],
+- grpc_service_config = "alertcenter_grpc_service_config.json",
+- importpath = "google.golang.org/google/apps/alertcenter/v1beta1;alertcenter",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "alertcenter.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":alertcenter_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "alertcenter_go_gapic_test",
+- srcs = [":alertcenter_go_gapic_srcjar_test"],
+- embed = [":alertcenter_go_gapic"],
+- importpath = "google.golang.org/google/apps/alertcenter/v1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-apps-alertcenter-v1beta1-go",
+- deps = [
+- ":alertcenter_go_gapic",
+- ":alertcenter_go_gapic_srcjar-metadata.srcjar",
+- ":alertcenter_go_gapic_srcjar-test.srcjar",
+- ":alertcenter_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "alertcenter_py_gapic",
+- srcs = [":alertcenter_proto"],
+- grpc_service_config = "alertcenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "alertcenter_py_gapic_test",
+- srcs = [
+- "alertcenter_py_gapic_pytest.py",
+- "alertcenter_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":alertcenter_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "apps-alertcenter-v1beta1-py",
+- deps = [
+- ":alertcenter_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "alertcenter_php_proto",
+- deps = [":alertcenter_proto"],
+-)
+-
+-php_grpc_library(
+- name = "alertcenter_php_grpc",
+- srcs = [":alertcenter_proto"],
+- deps = [":alertcenter_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "alertcenter_php_gapic",
+- srcs = [":alertcenter_proto_with_info"],
+- grpc_service_config = "alertcenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "alertcenter.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":alertcenter_php_grpc",
+- ":alertcenter_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-apps-alertcenter-v1beta1-php",
+- deps = [
+- ":alertcenter_php_gapic",
+- ":alertcenter_php_grpc",
+- ":alertcenter_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "alertcenter_nodejs_gapic",
+- package_name = "@google-cloud/alertcenter",
+- src = ":alertcenter_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "alertcenter_grpc_service_config.json",
+- package = "google.apps.alertcenter.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "alertcenter.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "apps-alertcenter-v1beta1-nodejs",
+- deps = [
+- ":alertcenter_nodejs_gapic",
+- ":alertcenter_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "alertcenter_ruby_proto",
+- deps = [":alertcenter_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "alertcenter_ruby_grpc",
+- srcs = [":alertcenter_proto"],
+- deps = [":alertcenter_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "alertcenter_ruby_gapic",
+- srcs = [":alertcenter_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-apps-alertcenter-v1beta1",
+- ],
+- grpc_service_config = "alertcenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":alertcenter_ruby_grpc",
+- ":alertcenter_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-apps-alertcenter-v1beta1-ruby",
+- deps = [
+- ":alertcenter_ruby_gapic",
+- ":alertcenter_ruby_grpc",
+- ":alertcenter_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "alertcenter_csharp_proto",
+- deps = [":alertcenter_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "alertcenter_csharp_grpc",
+- srcs = [":alertcenter_proto"],
+- deps = [":alertcenter_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "alertcenter_csharp_gapic",
+- srcs = [":alertcenter_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "alertcenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "alertcenter.yaml",
+- deps = [
+- ":alertcenter_csharp_grpc",
+- ":alertcenter_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-apps-alertcenter-v1beta1-csharp",
+- deps = [
+- ":alertcenter_csharp_gapic",
+- ":alertcenter_csharp_grpc",
+- ":alertcenter_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/apps/drive/activity/v2/BUILD.bazel b/google/apps/drive/activity/v2/BUILD.bazel
+--- a/google/apps/drive/activity/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/apps/drive/activity/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,369 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "activity_proto",
+- srcs = [
+- "action.proto",
+- "actor.proto",
+- "common.proto",
+- "drive_activity_service.proto",
+- "query_drive_activity_request.proto",
+- "query_drive_activity_response.proto",
+- "target.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "activity_proto_with_info",
+- deps = [
+- ":activity_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "activity_java_proto",
+- deps = [":activity_proto"],
+-)
+-
+-java_grpc_library(
+- name = "activity_java_grpc",
+- srcs = [":activity_proto"],
+- deps = [":activity_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "activity_java_gapic",
+- srcs = [":activity_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "driveactivity_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "driveactivity_v2.yaml",
+- test_deps = [
+- ":activity_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":activity_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "activity_java_gapic_test_suite",
+- test_classes = [
+- "com.google.apps.drive.activity.v2.DriveActivityServiceClientHttpJsonTest",
+- "com.google.apps.drive.activity.v2.DriveActivityServiceClientTest",
+- ],
+- runtime_deps = [":activity_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-apps-drive-activity-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":activity_java_gapic",
+- ":activity_java_grpc",
+- ":activity_java_proto",
+- ":activity_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "activity_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/apps/drive/activity/v2",
+- protos = [":activity_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "activity_go_gapic",
+- srcs = [":activity_proto_with_info"],
+- grpc_service_config = "driveactivity_grpc_service_config.json",
+- importpath = "google.golang.org/google/apps/drive/activity/v2;activity",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "driveactivity_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":activity_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "activity_go_gapic_test",
+- srcs = [":activity_go_gapic_srcjar_test"],
+- embed = [":activity_go_gapic"],
+- importpath = "google.golang.org/google/apps/drive/activity/v2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-apps-drive-activity-v2-go",
+- deps = [
+- ":activity_go_gapic",
+- ":activity_go_gapic_srcjar-metadata.srcjar",
+- ":activity_go_gapic_srcjar-test.srcjar",
+- ":activity_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "activity_py_gapic",
+- srcs = [":activity_proto"],
+- grpc_service_config = "driveactivity_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "driveactivity_v2.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "activity_py_gapic_test",
+- srcs = [
+- "activity_py_gapic_pytest.py",
+- "activity_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":activity_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "drive-activity-v2-py",
+- deps = [
+- ":activity_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "activity_php_proto",
+- deps = [":activity_proto"],
+-)
+-
+-php_grpc_library(
+- name = "activity_php_grpc",
+- srcs = [":activity_proto"],
+- deps = [":activity_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "activity_php_gapic",
+- srcs = [":activity_proto_with_info"],
+- grpc_service_config = "driveactivity_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "driveactivity_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":activity_php_grpc",
+- ":activity_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-apps-drive-activity-v2-php",
+- deps = [
+- ":activity_php_gapic",
+- ":activity_php_grpc",
+- ":activity_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "activity_nodejs_gapic",
+- package_name = "@google-cloud/drive-activity",
+- src = ":activity_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "driveactivity_grpc_service_config.json",
+- package = "google.apps.drive.activity.v2",
+- rest_numeric_enums = False,
+- service_yaml = "driveactivity_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "drive-activity-v2-nodejs",
+- deps = [
+- ":activity_nodejs_gapic",
+- ":activity_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "activity_ruby_proto",
+- deps = [":activity_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "activity_ruby_grpc",
+- srcs = [":activity_proto"],
+- deps = [":activity_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "activity_ruby_gapic",
+- srcs = [":activity_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-apps-drive-activity-v2"],
+- grpc_service_config = "driveactivity_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "driveactivity_v2.yaml",
+- deps = [
+- ":activity_ruby_grpc",
+- ":activity_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-apps-drive-activity-v2-ruby",
+- deps = [
+- ":activity_ruby_gapic",
+- ":activity_ruby_grpc",
+- ":activity_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "activity_csharp_proto",
+- deps = [":activity_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "activity_csharp_grpc",
+- srcs = [":activity_proto"],
+- deps = [":activity_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "activity_csharp_gapic",
+- srcs = [":activity_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "driveactivity_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "driveactivity_v2.yaml",
+- deps = [
+- ":activity_csharp_grpc",
+- ":activity_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-apps-drive-activity-v2-csharp",
+- deps = [
+- ":activity_csharp_gapic",
+- ":activity_csharp_grpc",
+- ":activity_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/apps/drive/labels/v2/BUILD.bazel b/google/apps/drive/labels/v2/BUILD.bazel
+--- a/google/apps/drive/labels/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/apps/drive/labels/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,393 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "labels_proto",
+- srcs = [
+- "common.proto",
+- "error_details.proto",
+- "exception_detail.proto",
+- "field.proto",
+- "label.proto",
+- "label_permission.proto",
+- "label_service.proto",
+- "requests.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/type:color_proto",
+- "//google/type:date_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "labels_proto_with_info",
+- deps = [
+- ":labels_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "labels_java_proto",
+- deps = [":labels_proto"],
+-)
+-
+-java_grpc_library(
+- name = "labels_java_grpc",
+- srcs = [":labels_proto"],
+- deps = [":labels_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "labels_java_gapic",
+- srcs = [":labels_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "drivelabels_v2_grpc_service_config.json",
+- rest_numeric_enums = True,
+- service_yaml = "drivelabels_v2.yaml",
+- test_deps = [
+- ":labels_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":labels_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "labels_java_gapic_test_suite",
+- test_classes = [
+- "com.google.apps.drive.labels.v2.LabelServiceClientHttpJsonTest",
+- "com.google.apps.drive.labels.v2.LabelServiceClientTest",
+- ],
+- runtime_deps = [":labels_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-drive-labels-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":labels_java_gapic",
+- ":labels_java_grpc",
+- ":labels_java_proto",
+- ":labels_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "labels_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/apps/drive/labels/v2",
+- protos = [":labels_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:color_go_proto",
+- "//google/type:date_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "labels_go_gapic",
+- srcs = [":labels_proto_with_info"],
+- grpc_service_config = "drivelabels_v2_grpc_service_config.json",
+- importpath = "google.golang.org/google/apps/drive/labels/v2;labels",
+- metadata = True,
+- rest_numeric_enums = True,
+- service_yaml = "drivelabels_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":labels_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "labels_go_gapic_test",
+- srcs = [":labels_go_gapic_srcjar_test"],
+- embed = [":labels_go_gapic"],
+- importpath = "google.golang.org/google/apps/drive/labels/v2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-drive-labels-v2-go",
+- deps = [
+- ":labels_go_gapic",
+- ":labels_go_gapic_srcjar-metadata.srcjar",
+- ":labels_go_gapic_srcjar-test.srcjar",
+- ":labels_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "labels_py_gapic",
+- srcs = [":labels_proto"],
+- grpc_service_config = "drivelabels_v2_grpc_service_config.json",
+- rest_numeric_enums = True,
+- service_yaml = "drivelabels_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-py_test(
+- name = "labels_py_gapic_test",
+- srcs = [
+- "labels_py_gapic_pytest.py",
+- "labels_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":labels_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "drive-labels-v2-py",
+- deps = [
+- ":labels_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "labels_php_proto",
+- deps = [":labels_proto"],
+-)
+-
+-php_grpc_library(
+- name = "labels_php_grpc",
+- srcs = [":labels_proto"],
+- deps = [":labels_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "labels_php_gapic",
+- srcs = [":labels_proto_with_info"],
+- grpc_service_config = "drivelabels_v2_grpc_service_config.json",
+- rest_numeric_enums = True,
+- service_yaml = "drivelabels_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":labels_php_grpc",
+- ":labels_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-drive-labels-v2-php",
+- deps = [
+- ":labels_php_gapic",
+- ":labels_php_grpc",
+- ":labels_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "labels_nodejs_gapic",
+- package_name = "@google-cloud/labels",
+- src = ":labels_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "drivelabels_v2_grpc_service_config.json",
+- package = "google.apps.drive.labels.v2",
+- rest_numeric_enums = True,
+- service_yaml = "drivelabels_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "drive-labels-v2-nodejs",
+- deps = [
+- ":labels_nodejs_gapic",
+- ":labels_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "labels_ruby_proto",
+- deps = [":labels_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "labels_ruby_grpc",
+- srcs = [":labels_proto"],
+- deps = [":labels_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "labels_ruby_gapic",
+- srcs = [":labels_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-drive-labels-v2",
+- ],
+- grpc_service_config = "drivelabels_v2_grpc_service_config.json",
+- rest_numeric_enums = True,
+- service_yaml = "drivelabels_v2.yaml",
+- deps = [
+- ":labels_ruby_grpc",
+- ":labels_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-drive-labels-v2-ruby",
+- deps = [
+- ":labels_ruby_gapic",
+- ":labels_ruby_grpc",
+- ":labels_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "labels_csharp_proto",
+- deps = [":labels_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "labels_csharp_grpc",
+- srcs = [":labels_proto"],
+- deps = [":labels_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "labels_csharp_gapic",
+- srcs = [":labels_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "drivelabels_v2_grpc_service_config.json",
+- rest_numeric_enums = True,
+- service_yaml = "drivelabels_v2.yaml",
+- deps = [
+- ":labels_csharp_grpc",
+- ":labels_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-drive-labels-v2-csharp",
+- deps = [
+- ":labels_csharp_gapic",
+- ":labels_csharp_grpc",
+- ":labels_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "labels_cc_proto",
+- deps = [":labels_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "labels_cc_grpc",
+- srcs = [":labels_proto"],
+- grpc_only = True,
+- deps = [":labels_cc_proto"],
+-)
+diff -urN a/google/apps/drive/labels/v2beta/BUILD.bazel b/google/apps/drive/labels/v2beta/BUILD.bazel
+--- a/google/apps/drive/labels/v2beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/apps/drive/labels/v2beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,398 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "labels_proto",
+- srcs = [
+- "common.proto",
+- "error_details.proto",
+- "exception_detail.proto",
+- "field.proto",
+- "label.proto",
+- "label_limits.proto",
+- "label_lock.proto",
+- "label_permission.proto",
+- "label_service.proto",
+- "requests.proto",
+- "user_capabilities.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/type:color_proto",
+- "//google/type:date_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "labels_proto_with_info",
+- deps = [
+- ":labels_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "labels_java_proto",
+- deps = [":labels_proto"],
+-)
+-
+-java_grpc_library(
+- name = "labels_java_grpc",
+- srcs = [":labels_proto"],
+- deps = [":labels_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "labels_java_gapic",
+- srcs = [":labels_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "drivelabels_v2beta_grpc_service_config.json",
+- rest_numeric_enums = True,
+- service_yaml = "drivelabels_v2beta.yaml",
+- test_deps = [
+- ":labels_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":labels_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "labels_java_gapic_test_suite",
+- test_classes = [
+- "com.google.apps.drive.labels.v2beta.LabelServiceClientHttpJsonTest",
+- "com.google.apps.drive.labels.v2beta.LabelServiceClientTest",
+- ],
+- runtime_deps = [":labels_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-drive-labels-v2beta-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":labels_java_gapic",
+- ":labels_java_grpc",
+- ":labels_java_proto",
+- ":labels_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "labels_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/apps/drive/labels/v2beta",
+- protos = [":labels_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:color_go_proto",
+- "//google/type:date_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "labels_go_gapic",
+- srcs = [":labels_proto_with_info"],
+- grpc_service_config = "drivelabels_v2beta_grpc_service_config.json",
+- importpath = "google.golang.org/google/apps/drive/labels/v2beta;labels",
+- metadata = True,
+- rest_numeric_enums = True,
+- service_yaml = "drivelabels_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":labels_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "labels_go_gapic_test",
+- srcs = [":labels_go_gapic_srcjar_test"],
+- embed = [":labels_go_gapic"],
+- importpath = "google.golang.org/google/apps/drive/labels/v2beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-drive-labels-v2beta-go",
+- deps = [
+- ":labels_go_gapic",
+- ":labels_go_gapic_srcjar-metadata.srcjar",
+- ":labels_go_gapic_srcjar-test.srcjar",
+- ":labels_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "labels_py_gapic",
+- srcs = [":labels_proto"],
+- grpc_service_config = "drivelabels_v2beta_grpc_service_config.json",
+- rest_numeric_enums = True,
+- service_yaml = "drivelabels_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-py_test(
+- name = "labels_py_gapic_test",
+- srcs = [
+- "labels_py_gapic_pytest.py",
+- "labels_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":labels_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "drive-labels-v2beta-py",
+- deps = [
+- ":labels_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "labels_php_proto",
+- deps = [":labels_proto"],
+-)
+-
+-php_grpc_library(
+- name = "labels_php_grpc",
+- srcs = [":labels_proto"],
+- deps = [":labels_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "labels_php_gapic",
+- srcs = [":labels_proto_with_info"],
+- grpc_service_config = "drivelabels_v2beta_grpc_service_config.json",
+- rest_numeric_enums = True,
+- service_yaml = "drivelabels_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":labels_php_grpc",
+- ":labels_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-drive-labels-v2beta-php",
+- deps = [
+- ":labels_php_gapic",
+- ":labels_php_grpc",
+- ":labels_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "labels_nodejs_gapic",
+- package_name = "@google-cloud/labels",
+- src = ":labels_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "drivelabels_v2beta_grpc_service_config.json",
+- package = "google.apps.drive.labels.v2beta",
+- rest_numeric_enums = True,
+- service_yaml = "drivelabels_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "drive-labels-v2beta-nodejs",
+- deps = [
+- ":labels_nodejs_gapic",
+- ":labels_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "labels_ruby_proto",
+- deps = [":labels_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "labels_ruby_grpc",
+- srcs = [":labels_proto"],
+- deps = [":labels_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "labels_ruby_gapic",
+- srcs = [":labels_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-drive-labels-v2beta",
+- ],
+- grpc_service_config = "drivelabels_v2beta_grpc_service_config.json",
+- rest_numeric_enums = True,
+- service_yaml = "drivelabels_v2beta.yaml",
+- deps = [
+- ":labels_ruby_grpc",
+- ":labels_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-drive-labels-v2beta-ruby",
+- deps = [
+- ":labels_ruby_gapic",
+- ":labels_ruby_grpc",
+- ":labels_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "labels_csharp_proto",
+- deps = [":labels_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "labels_csharp_grpc",
+- srcs = [":labels_proto"],
+- deps = [":labels_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "labels_csharp_gapic",
+- srcs = [":labels_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "drivelabels_v2beta_grpc_service_config.json",
+- rest_numeric_enums = True,
+- service_yaml = "drivelabels_v2beta.yaml",
+- deps = [
+- ":labels_csharp_grpc",
+- ":labels_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-drive-labels-v2beta-csharp",
+- deps = [
+- ":labels_csharp_gapic",
+- ":labels_csharp_grpc",
+- ":labels_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "labels_cc_proto",
+- deps = [":labels_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "labels_cc_grpc",
+- srcs = [":labels_proto"],
+- grpc_only = True,
+- deps = [":labels_cc_proto"],
+-)
+diff -urN a/google/apps/market/v2/BUILD.bazel b/google/apps/market/v2/BUILD.bazel
+--- a/google/apps/market/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/apps/market/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,314 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "marketplace_proto",
+- srcs = [
+- "resources.proto",
+- "services.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "marketplace_proto_with_info",
+- deps = [
+- ":marketplace_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "marketplace_java_proto",
+- deps = [":marketplace_proto"],
+-)
+-
+-java_grpc_library(
+- name = "marketplace_java_grpc",
+- srcs = [":marketplace_proto"],
+- deps = [":marketplace_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "marketplace_java_gapic",
+- srcs = [":marketplace_proto_with_info"],
+- grpc_service_config = "service_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":marketplace_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":marketplace_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "marketplace_java_gapic_test_suite",
+- test_classes = [
+- "com.google.ccc.hosted.marketplace.v2.CustomerLicenseServiceClientHttpJsonTest",
+- "com.google.ccc.hosted.marketplace.v2.CustomerLicenseServiceClientTest",
+- "com.google.ccc.hosted.marketplace.v2.LicenseNotificationServiceClientHttpJsonTest",
+- "com.google.ccc.hosted.marketplace.v2.LicenseNotificationServiceClientTest",
+- "com.google.ccc.hosted.marketplace.v2.UserLicenseServiceClientHttpJsonTest",
+- "com.google.ccc.hosted.marketplace.v2.UserLicenseServiceClientTest",
+- ],
+- runtime_deps = [":marketplace_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-hosted-marketplace-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":marketplace_java_gapic",
+- ":marketplace_java_grpc",
+- ":marketplace_java_proto",
+- ":marketplace_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "marketplace_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/ccc/hosted/marketplace/v2",
+- protos = [":marketplace_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "marketplace_go_gapic",
+- srcs = [":marketplace_proto_with_info"],
+- grpc_service_config = "service_grpc_service_config.json",
+- importpath = "google.golang.org/ccc/hosted/marketplace/v2;marketplace",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "appsmarket_v2.yaml",
+- deps = [
+- ":marketplace_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "marketplace_go_gapic_test",
+- srcs = [":marketplace_go_gapic_srcjar_test"],
+- embed = [":marketplace_go_gapic"],
+- importpath = "google.golang.org/ccc/hosted/marketplace/v2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-hosted-marketplace-v2-go",
+- deps = [
+- ":marketplace_go_gapic",
+- ":marketplace_go_gapic_srcjar-metadata.srcjar",
+- ":marketplace_go_gapic_srcjar-test.srcjar",
+- ":marketplace_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "marketplace_py_gapic",
+- srcs = [":marketplace_proto"],
+- grpc_service_config = "service_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "marketplace_py_gapic_test",
+- srcs = [
+- "marketplace_py_gapic_pytest.py",
+- "marketplace_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":marketplace_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "hosted-marketplace-v2-py",
+- deps = [
+- ":marketplace_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "marketplace_php_proto",
+- deps = [":marketplace_proto"],
+-)
+-
+-php_grpc_library(
+- name = "marketplace_php_grpc",
+- srcs = [":marketplace_proto"],
+- deps = [":marketplace_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "marketplace_php_gapic",
+- srcs = [":marketplace_proto_with_info"],
+- grpc_service_config = "service_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":marketplace_php_grpc",
+- ":marketplace_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-hosted-marketplace-v2-php",
+- deps = [
+- ":marketplace_php_gapic",
+- ":marketplace_php_grpc",
+- ":marketplace_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "marketplace_nodejs_gapic",
+- package_name = "@google-cloud/marketplace",
+- src = ":marketplace_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "service_grpc_service_config.json",
+- package = "ccc.hosted.marketplace.v2",
+- rest_numeric_enums = False,
+- service_yaml = "appsmarket_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "hosted-marketplace-v2-nodejs",
+- deps = [
+- ":marketplace_nodejs_gapic",
+- ":marketplace_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "marketplace_ruby_proto",
+- deps = [":marketplace_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "marketplace_ruby_grpc",
+- srcs = [":marketplace_proto"],
+- deps = [":marketplace_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "marketplace_ruby_gapic",
+- srcs = [":marketplace_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-hosted-marketplace-v2",
+- ],
+- grpc_service_config = "service_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":marketplace_ruby_grpc",
+- ":marketplace_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-hosted-marketplace-v2-ruby",
+- deps = [
+- ":marketplace_ruby_gapic",
+- ":marketplace_ruby_grpc",
+- ":marketplace_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "marketplace_csharp_proto",
+- deps = [":marketplace_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "marketplace_csharp_grpc",
+- srcs = [":marketplace_proto"],
+- deps = [":marketplace_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "marketplace_csharp_gapic",
+- srcs = [":marketplace_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "service_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "appsmarket_v2.yaml",
+- deps = [
+- ":marketplace_csharp_grpc",
+- ":marketplace_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-hosted-marketplace-v2-csharp",
+- deps = [
+- ":marketplace_csharp_gapic",
+- ":marketplace_csharp_grpc",
+- ":marketplace_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/apps/script/type/BUILD.bazel b/google/apps/script/type/BUILD.bazel
+--- a/google/apps/script/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/apps/script/type/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,159 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_proto_library",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "type_proto",
+- srcs = [
+- "addon_widget_set.proto",
+- "extension_point.proto",
+- "script_manifest.proto",
+- ],
+- deps = [
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "type_java_proto",
+- deps = [":type_proto"],
+-)
+-
+-java_grpc_library(
+- name = "type_java_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_java_proto"],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-apps-script-type-java",
+- transport = "grpc+rest",
+- deps = [
+- ":type_java_grpc",
+- ":type_java_proto",
+- ":type_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "type_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/apps/script/type",
+- protos = [":type_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "type_py_proto",
+- deps = [":type_proto"],
+-)
+-
+-py_gapic_library(
+- name = "type_py_gapic",
+- srcs = [":type_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "type-py",
+- deps = [
+- ":type_py_gapic",
+- "//google/apps/script/type/calendar:calendar_py_gapic",
+- "//google/apps/script/type/docs:docs_py_gapic",
+- "//google/apps/script/type/drive:drive_py_gapic",
+- "//google/apps/script/type/gmail:gmail_py_gapic",
+- "//google/apps/script/type/sheets:sheets_py_gapic",
+- "//google/apps/script/type/slides:slides_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-php_proto_library(
+- name = "type_php_proto",
+- deps = [":type_proto"],
+-)
+-
+-php_grpc_library(
+- name = "type_php_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_php_proto"],
+-)
+-
+-ruby_proto_library(
+- name = "type_ruby_proto",
+- deps = [":type_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "type_ruby_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_ruby_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "type_csharp_proto",
+- deps = [":type_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "type_csharp_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_csharp_proto"],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-apps-script-type-csharp",
+- package_name = "Google.Apps.Script.Type",
+- generate_nongapic_package = True,
+- deps = [
+- ":type_csharp_grpc",
+- ":type_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/apps/script/type/calendar/BUILD.bazel b/google/apps/script/type/calendar/BUILD.bazel
+--- a/google/apps/script/type/calendar/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/apps/script/type/calendar/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,143 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_proto_library",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "calendar_proto",
+- srcs = [
+- "calendar_addon_manifest.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/apps/script/type:type_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "calendar_java_proto",
+- deps = [":calendar_proto"],
+-)
+-
+-java_grpc_library(
+- name = "calendar_java_grpc",
+- srcs = [":calendar_proto"],
+- deps = [":calendar_java_proto"],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-apps-script-type-calendar-java",
+- transport = "grpc+rest",
+- deps = [
+- ":calendar_java_grpc",
+- ":calendar_java_proto",
+- ":calendar_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "calendar_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/apps/script/type/calendar",
+- protos = [":calendar_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/apps/script/type:type_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "calendar_py_proto",
+- deps = [":calendar_proto"],
+-)
+-
+-py_gapic_library(
+- name = "calendar_py_gapic",
+- srcs = [":calendar_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "calendar-gapic",
+- deps = [
+- ":calendar_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-php_proto_library(
+- name = "calendar_php_proto",
+- deps = [":calendar_proto"],
+-)
+-
+-php_grpc_library(
+- name = "calendar_php_grpc",
+- srcs = [":calendar_proto"],
+- deps = [":calendar_php_proto"],
+-)
+-
+-ruby_proto_library(
+- name = "calendar_ruby_proto",
+- deps = [":calendar_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "calendar_ruby_grpc",
+- srcs = [":calendar_proto"],
+- deps = [":calendar_ruby_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "calendar_csharp_proto",
+- deps = [":calendar_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "calendar_csharp_grpc",
+- srcs = [":calendar_proto"],
+- deps = [":calendar_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/apps/script/type/docs/BUILD.bazel b/google/apps/script/type/docs/BUILD.bazel
+--- a/google/apps/script/type/docs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/apps/script/type/docs/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,143 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_proto_library",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "docs_proto",
+- srcs = [
+- "docs_addon_manifest.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/apps/script/type:type_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "docs_java_proto",
+- deps = [":docs_proto"],
+-)
+-
+-java_grpc_library(
+- name = "docs_java_grpc",
+- srcs = [":docs_proto"],
+- deps = [":docs_java_proto"],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-apps-script-type-docs-java",
+- transport = "grpc+rest",
+- deps = [
+- ":docs_java_grpc",
+- ":docs_java_proto",
+- ":docs_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "docs_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/apps/script/type/docs",
+- protos = [":docs_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/apps/script/type:type_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "docs_py_proto",
+- deps = [":docs_proto"],
+-)
+-
+-py_gapic_library(
+- name = "docs_py_gapic",
+- srcs = [":docs_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "docs-gapic",
+- deps = [
+- ":docs_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-php_proto_library(
+- name = "docs_php_proto",
+- deps = [":docs_proto"],
+-)
+-
+-php_grpc_library(
+- name = "docs_php_grpc",
+- srcs = [":docs_proto"],
+- deps = [":docs_php_proto"],
+-)
+-
+-ruby_proto_library(
+- name = "docs_ruby_proto",
+- deps = [":docs_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "docs_ruby_grpc",
+- srcs = [":docs_proto"],
+- deps = [":docs_ruby_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "docs_csharp_proto",
+- deps = [":docs_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "docs_csharp_grpc",
+- srcs = [":docs_proto"],
+- deps = [":docs_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/apps/script/type/drive/BUILD.bazel b/google/apps/script/type/drive/BUILD.bazel
+--- a/google/apps/script/type/drive/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/apps/script/type/drive/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,141 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_proto_library",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "drive_proto",
+- srcs = [
+- "drive_addon_manifest.proto",
+- ],
+- deps = [
+- "//google/apps/script/type:type_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "drive_java_proto",
+- deps = [":drive_proto"],
+-)
+-
+-java_grpc_library(
+- name = "drive_java_grpc",
+- srcs = [":drive_proto"],
+- deps = [":drive_java_proto"],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-apps-script-type-drive-java",
+- transport = "grpc+rest",
+- deps = [
+- ":drive_java_grpc",
+- ":drive_java_proto",
+- ":drive_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "drive_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/apps/script/type/drive",
+- protos = [":drive_proto"],
+- deps = [
+- "//google/apps/script/type:type_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "drive_py_proto",
+- deps = [":drive_proto"],
+-)
+-
+-py_gapic_library(
+- name = "drive_py_gapic",
+- srcs = [":drive_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "drive-gapic",
+- deps = [
+- ":drive_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-php_proto_library(
+- name = "drive_php_proto",
+- deps = [":drive_proto"],
+-)
+-
+-php_grpc_library(
+- name = "drive_php_grpc",
+- srcs = [":drive_proto"],
+- deps = [":drive_php_proto"],
+-)
+-
+-ruby_proto_library(
+- name = "drive_ruby_proto",
+- deps = [":drive_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "drive_ruby_grpc",
+- srcs = [":drive_proto"],
+- deps = [":drive_ruby_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "drive_csharp_proto",
+- deps = [":drive_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "drive_csharp_grpc",
+- srcs = [":drive_proto"],
+- deps = [":drive_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/apps/script/type/gmail/BUILD.bazel b/google/apps/script/type/gmail/BUILD.bazel
+--- a/google/apps/script/type/gmail/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/apps/script/type/gmail/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,142 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_proto_library",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "gmail_proto",
+- srcs = [
+- "gmail_addon_manifest.proto",
+- ],
+- deps = [
+- "//google/apps/script/type:type_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "gmail_java_proto",
+- deps = [":gmail_proto"],
+-)
+-
+-java_grpc_library(
+- name = "gmail_java_grpc",
+- srcs = [":gmail_proto"],
+- deps = [":gmail_java_proto"],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-apps-script-type-gmail-java",
+- transport = "grpc+rest",
+- deps = [
+- ":gmail_java_grpc",
+- ":gmail_java_proto",
+- ":gmail_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "gmail_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/apps/script/type/gmail",
+- protos = [":gmail_proto"],
+- deps = [
+- "//google/apps/script/type:type_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "gmail_py_proto",
+- deps = [":gmail_proto"],
+-)
+-
+-py_gapic_library(
+- name = "gmail_py_gapic",
+- srcs = [":gmail_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "gmail-gapic",
+- deps = [
+- ":gmail_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-php_proto_library(
+- name = "gmail_php_proto",
+- deps = [":gmail_proto"],
+-)
+-
+-php_grpc_library(
+- name = "gmail_php_grpc",
+- srcs = [":gmail_proto"],
+- deps = [":gmail_php_proto"],
+-)
+-
+-ruby_proto_library(
+- name = "gmail_ruby_proto",
+- deps = [":gmail_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "gmail_ruby_grpc",
+- srcs = [":gmail_proto"],
+- deps = [":gmail_ruby_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "gmail_csharp_proto",
+- deps = [":gmail_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "gmail_csharp_grpc",
+- srcs = [":gmail_proto"],
+- deps = [":gmail_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/apps/script/type/sheets/BUILD.bazel b/google/apps/script/type/sheets/BUILD.bazel
+--- a/google/apps/script/type/sheets/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/apps/script/type/sheets/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,143 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_proto_library",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "sheets_proto",
+- srcs = [
+- "sheets_addon_manifest.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/apps/script/type:type_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "sheets_java_proto",
+- deps = [":sheets_proto"],
+-)
+-
+-java_grpc_library(
+- name = "sheets_java_grpc",
+- srcs = [":sheets_proto"],
+- deps = [":sheets_java_proto"],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-apps-script-type-sheets-java",
+- transport = "grpc+rest",
+- deps = [
+- ":sheets_java_grpc",
+- ":sheets_java_proto",
+- ":sheets_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "sheets_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/apps/script/type/sheets",
+- protos = [":sheets_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/apps/script/type:type_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "sheets_py_proto",
+- deps = [":sheets_proto"],
+-)
+-
+-py_gapic_library(
+- name = "sheets_py_gapic",
+- srcs = [":sheets_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "sheets-gapic",
+- deps = [
+- ":sheets_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-php_proto_library(
+- name = "sheets_php_proto",
+- deps = [":sheets_proto"],
+-)
+-
+-php_grpc_library(
+- name = "sheets_php_grpc",
+- srcs = [":sheets_proto"],
+- deps = [":sheets_php_proto"],
+-)
+-
+-ruby_proto_library(
+- name = "sheets_ruby_proto",
+- deps = [":sheets_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "sheets_ruby_grpc",
+- srcs = [":sheets_proto"],
+- deps = [":sheets_ruby_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "sheets_csharp_proto",
+- deps = [":sheets_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "sheets_csharp_grpc",
+- srcs = [":sheets_proto"],
+- deps = [":sheets_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/apps/script/type/slides/BUILD.bazel b/google/apps/script/type/slides/BUILD.bazel
+--- a/google/apps/script/type/slides/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/apps/script/type/slides/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,143 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_proto_library",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "slides_proto",
+- srcs = [
+- "slides_addon_manifest.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/apps/script/type:type_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "slides_java_proto",
+- deps = [":slides_proto"],
+-)
+-
+-java_grpc_library(
+- name = "slides_java_grpc",
+- srcs = [":slides_proto"],
+- deps = [":slides_java_proto"],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-apps-script-type-slides-java",
+- transport = "grpc+rest",
+- deps = [
+- ":slides_java_grpc",
+- ":slides_java_proto",
+- ":slides_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "slides_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/apps/script/type/slides",
+- protos = [":slides_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/apps/script/type:type_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "slides_py_proto",
+- deps = [":slides_proto"],
+-)
+-
+-py_gapic_library(
+- name = "slides_py_gapic",
+- srcs = [":slides_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "slides-gapic",
+- deps = [
+- ":slides_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-php_proto_library(
+- name = "slides_php_proto",
+- deps = [":slides_proto"],
+-)
+-
+-php_grpc_library(
+- name = "slides_php_grpc",
+- srcs = [":slides_proto"],
+- deps = [":slides_php_proto"],
+-)
+-
+-ruby_proto_library(
+- name = "slides_ruby_proto",
+- deps = [":slides_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "slides_ruby_grpc",
+- srcs = [":slides_proto"],
+- deps = [":slides_ruby_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "slides_csharp_proto",
+- deps = [":slides_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "slides_csharp_grpc",
+- srcs = [":slides_proto"],
+- deps = [":slides_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/area120/tables/BUILD.bazel b/google/area120/tables/BUILD.bazel
+--- a/google/area120/tables/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/area120/tables/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-area120-tables.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for area120tables.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1alpha1 in this case.
+-ruby_cloud_gapic_library(
+- name = "area120tables_ruby_wrapper",
+- srcs = ["//google/area120/tables/v1alpha1:tables_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-area120-tables",
+- "ruby-cloud-env-prefix=AREA120_TABLES",
+- "ruby-cloud-wrapper-of=v1alpha1:0.0",
+- "ruby-cloud-product-url=https://tables.area120.google.com/u/0/about#/",
+- "ruby-cloud-api-id=area120tables.googleapis.com",
+- "ruby-cloud-api-shortname=area120tables",
+- ],
+- ruby_cloud_description = "Using the Area 120 Tables API, you can query for tables, and update/create/delete rows within tables programmatically.",
+- ruby_cloud_title = "Area 120 Tables",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-area120-tables-ruby",
+- deps = [
+- ":area120tables_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/area120/tables/v1alpha1/BUILD.bazel b/google/area120/tables/v1alpha1/BUILD.bazel
+--- a/google/area120/tables/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/area120/tables/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,320 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "tables_proto",
+- srcs = [
+- "tables.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "tables_proto_with_info",
+- deps = [
+- ":tables_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "tables_java_proto",
+- deps = [":tables_proto"],
+-)
+-
+-java_grpc_library(
+- name = "tables_java_grpc",
+- srcs = [":tables_proto"],
+- deps = [":tables_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "tables_java_gapic",
+- srcs = [":tables_proto_with_info"],
+- gapic_yaml = "language_gapic.yaml",
+- grpc_service_config = "tables_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":tables_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":tables_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "tables_java_gapic_test_suite",
+- test_classes = [
+- "com.google.area120.tables.v1alpha.TablesServiceClientHttpJsonTest",
+- "com.google.area120.tables.v1alpha.TablesServiceClientTest",
+- ],
+- runtime_deps = [":tables_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-area120-tables-v1alpha1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":tables_java_gapic",
+- ":tables_java_grpc",
+- ":tables_java_proto",
+- ":tables_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "tables_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/area120/tables/v1alpha1",
+- protos = [":tables_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "tables_go_gapic",
+- srcs = [":tables_proto_with_info"],
+- grpc_service_config = "tables_grpc_service_config.json",
+- importpath = "google.golang.org/google/area120/tables/v1alpha1;tables",
+- rest_numeric_enums = False,
+- service_yaml = "area120tables_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":tables_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "tables_go_gapic_test",
+- srcs = [":tables_go_gapic_srcjar_test"],
+- embed = [":tables_go_gapic"],
+- importpath = "google.golang.org/google/area120/tables/v1alpha1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-area120-tables-v1alpha1-go",
+- deps = [
+- ":tables_go_gapic",
+- ":tables_go_gapic_srcjar-test.srcjar",
+- ":tables_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "tables_py_gapic",
+- srcs = [":tables_proto"],
+- grpc_service_config = "tables_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+-)
+-
+-py_test(
+- name = "tables_py_gapic_test",
+- srcs = [
+- "tables_py_gapic_pytest.py",
+- "tables_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":tables_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "area120-tables-v1alpha1-py",
+- deps = [
+- ":tables_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "tables_php_proto",
+- deps = [":tables_proto"],
+-)
+-
+-php_grpc_library(
+- name = "tables_php_grpc",
+- srcs = [":tables_proto"],
+- deps = [":tables_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "tables_php_gapic",
+- srcs = [":tables_proto_with_info"],
+- grpc_service_config = "tables_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":tables_php_grpc",
+- ":tables_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-area120-tables-v1alpha1-php",
+- deps = [
+- ":tables_php_gapic",
+- ":tables_php_grpc",
+- ":tables_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "tables_nodejs_gapic",
+- package_name = "@google/area120-tables",
+- src = ":tables_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "tables_grpc_service_config.json",
+- package = "google.area120.tables.v1alpha1",
+- rest_numeric_enums = False,
+- service_yaml = "area120tables_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "area120-tables-v1alpha1-nodejs",
+- deps = [
+- ":tables_nodejs_gapic",
+- ":tables_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "tables_ruby_proto",
+- deps = [":tables_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "tables_ruby_grpc",
+- srcs = [":tables_proto"],
+- deps = [":tables_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "tables_ruby_gapic",
+- srcs = [":tables_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-area120-tables-v1alpha1",
+- "ruby-cloud-env-prefix=AREA120_TABLES",
+- "ruby-cloud-product-url=https://tables.area120.google.com/u/0/about#/",
+- "ruby-cloud-api-id=area120tables.googleapis.com",
+- "ruby-cloud-api-shortname=area120tables",
+- ],
+- grpc_service_config = "tables_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Using the Area 120 Tables API, you can query for tables, and update/create/delete rows within tables programmatically.",
+- ruby_cloud_title = "Area 120 Tables V1alpha1",
+- deps = [
+- ":tables_ruby_grpc",
+- ":tables_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-area120-tables-v1alpha1-ruby",
+- deps = [
+- ":tables_ruby_gapic",
+- ":tables_ruby_grpc",
+- ":tables_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "tables_csharp_proto",
+- deps = [":tables_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "tables_csharp_grpc",
+- srcs = [":tables_proto"],
+- deps = [":tables_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "tables_csharp_gapic",
+- srcs = [":tables_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "tables_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "area120tables_v1alpha1.yaml",
+- deps = [
+- ":tables_csharp_grpc",
+- ":tables_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-area120-tables-v1alpha1-csharp",
+- deps = [
+- ":tables_csharp_gapic",
+- ":tables_csharp_grpc",
+- ":tables_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/bigtable/BUILD.bazel b/google/bigtable/BUILD.bazel
+--- a/google/bigtable/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/bigtable/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/bigtable/admin/BUILD.bazel b/google/bigtable/admin/BUILD.bazel
+--- a/google/bigtable/admin/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/bigtable/admin/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/bigtable/admin/v2/BUILD.bazel b/google/bigtable/admin/v2/BUILD.bazel
+--- a/google/bigtable/admin/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/bigtable/admin/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,350 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "admin_proto",
+- srcs = [
+- "bigtable_instance_admin.proto",
+- "bigtable_table_admin.proto",
+- "common.proto",
+- "instance.proto",
+- "table.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "admin_proto_with_info",
+- deps = [
+- ":admin_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "admin_java_proto",
+- deps = [":admin_proto"],
+-)
+-
+-java_grpc_library(
+- name = "admin_java_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "admin_java_gapic",
+- srcs = [":admin_proto_with_info"],
+- gapic_yaml = "bigtableadmin_gapic.yaml",
+- grpc_service_config = "bigtableadmin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":admin_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":admin_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "admin_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigtable.admin.v2.BaseBigtableInstanceAdminClientTest",
+- "com.google.cloud.bigtable.admin.v2.BaseBigtableTableAdminClientTest",
+- ],
+- runtime_deps = [":admin_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigtable-admin-v2-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":admin_java_gapic",
+- ":admin_java_grpc",
+- ":admin_java_proto",
+- ":admin_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "admin_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/bigtable/admin/v2",
+- protos = [":admin_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "admin_go_gapic",
+- srcs = [":admin_proto_with_info"],
+- grpc_service_config = "bigtableadmin_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigtable/admin/apiv2;admin",
+- rest_numeric_enums = False,
+- service_yaml = "bigtableadmin_v2.yaml",
+- transport = "grpc",
+- deps = [
+- ":admin_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "admin_go_gapic_test",
+- srcs = [":admin_go_gapic_srcjar_test"],
+- embed = [":admin_go_gapic"],
+- importpath = "cloud.google.com/go/bigtable/admin/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigtable-admin-v2-go",
+- deps = [
+- ":admin_go_gapic",
+- ":admin_go_gapic_srcjar-test.srcjar",
+- ":admin_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "bigtable_admin_py_gapic",
+- srcs = [":admin_proto"],
+- grpc_service_config = "bigtableadmin_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=bigtable_admin",
+- "autogen-snippets=False",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "bigtable_admin_py_gapic_test",
+- srcs = [
+- "bigtable_admin_py_gapic_pytest.py",
+- "bigtable_admin_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":bigtable_admin_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "bigtable-admin-v2-py",
+- deps = [
+- ":bigtable_admin_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "admin_php_proto",
+- deps = [":admin_proto"],
+-)
+-
+-php_grpc_library(
+- name = "admin_php_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "admin_php_gapic",
+- srcs = [":admin_proto_with_info"],
+- gapic_yaml = "bigtableadmin_gapic.yaml",
+- rest_numeric_enums = False,
+- service_yaml = "bigtableadmin_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":admin_php_grpc",
+- ":admin_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-bigtable-admin-v2-php",
+- deps = [
+- ":admin_php_gapic",
+- ":admin_php_grpc",
+- ":admin_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "admin_nodejs_gapic",
+- package_name = "@google-cloud/bigtable",
+- src = ":admin_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "bigtableadmin_grpc_service_config.json",
+- main_service = "bigtable",
+- package = "google.bigtable.admin.v2",
+- rest_numeric_enums = False,
+- service_yaml = "bigtableadmin_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigtable-admin-v2-nodejs",
+- deps = [
+- ":admin_nodejs_gapic",
+- ":admin_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "admin_ruby_proto",
+- deps = [":admin_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "admin_ruby_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "admin_ruby_gapic",
+- srcs = [":admin_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-bigtable-admin-v2",
+- "ruby-cloud-env-prefix=BIGTABLE",
+- "ruby-cloud-product-url=https://cloud.google.com/bigtable",
+- "ruby-cloud-api-id=bigtableadmin.googleapis.com",
+- "ruby-cloud-api-shortname=bigtableadmin",
+- "ruby-cloud-wrapper-gem-override=google-cloud-bigtable",
+- ],
+- grpc_service_config = "bigtableadmin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Bigtable is a fully managed, scalable NoSQL database service for large analytical and operational workloads.",
+- ruby_cloud_title = "Cloud Bigtable Admin V2",
+- deps = [
+- ":admin_ruby_grpc",
+- ":admin_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigtable-admin-v2-ruby",
+- deps = [
+- ":admin_ruby_gapic",
+- ":admin_ruby_grpc",
+- ":admin_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "admin_csharp_proto",
+- deps = [":admin_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "admin_csharp_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "admin_csharp_gapic",
+- srcs = [":admin_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "bigtableadmin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigtableadmin_v2.yaml",
+- deps = [
+- ":admin_csharp_grpc",
+- ":admin_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigtable-admin-v2-csharp",
+- deps = [
+- ":admin_csharp_gapic",
+- ":admin_csharp_grpc",
+- ":admin_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "admin_cc_proto",
+- deps = [":admin_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "admin_cc_grpc",
+- srcs = [":admin_proto"],
+- grpc_only = True,
+- deps = [":admin_cc_proto"],
+-)
+diff -urN a/google/bigtable/v2/BUILD.bazel b/google/bigtable/v2/BUILD.bazel
+--- a/google/bigtable/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/bigtable/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,329 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "bigtable_proto",
+- srcs = [
+- "bigtable.proto",
+- "data.proto",
+- "request_stats.proto",
+- "response_params.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/api:routing_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "bigtable_proto_with_info",
+- deps = [
+- ":bigtable_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "bigtable_java_proto",
+- deps = [":bigtable_proto"],
+-)
+-
+-java_grpc_library(
+- name = "bigtable_java_grpc",
+- srcs = [":bigtable_proto"],
+- deps = [":bigtable_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "bigtable_java_gapic",
+- srcs = [":bigtable_proto_with_info"],
+- gapic_yaml = "bigtable_gapic.yaml",
+- grpc_service_config = "bigtable_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":bigtable_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":bigtable_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "bigtable_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigtable.data.v2.BaseBigtableDataClientTest",
+- ],
+- runtime_deps = [":bigtable_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigtable-v2-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":bigtable_java_gapic",
+- ":bigtable_java_grpc",
+- ":bigtable_java_proto",
+- ":bigtable_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "bigtable_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/bigtable/v2",
+- protos = [":bigtable_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "bigtable_go_gapic",
+- srcs = [":bigtable_proto_with_info"],
+- grpc_service_config = "bigtable_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigtable/apiv2;bigtable",
+- rest_numeric_enums = False,
+- service_yaml = "bigtable_v2.yaml",
+- transport = "grpc",
+- deps = [
+- ":bigtable_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "bigtable_go_gapic_test",
+- srcs = [":bigtable_go_gapic_srcjar_test"],
+- embed = [":bigtable_go_gapic"],
+- importpath = "cloud.google.com/go/bigtable/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigtable-v2-go",
+- deps = [
+- ":bigtable_go_gapic",
+- ":bigtable_go_gapic_srcjar-test.srcjar",
+- ":bigtable_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "bigtable_py_gapic",
+- srcs = [":bigtable_proto"],
+- grpc_service_config = "bigtable_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=google.cloud",
+- "autogen-snippets=False",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "bigtable_py_gapic_test",
+- srcs = [
+- "bigtable_py_gapic_pytest.py",
+- "bigtable_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":bigtable_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "bigtable-v2-py",
+- deps = [
+- ":bigtable_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "bigtable_php_proto",
+- deps = [":bigtable_proto"],
+-)
+-
+-php_grpc_library(
+- name = "bigtable_php_grpc",
+- srcs = [":bigtable_proto"],
+- deps = [":bigtable_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "bigtable_php_gapic",
+- srcs = [":bigtable_proto_with_info"],
+- rest_numeric_enums = False,
+- service_yaml = "bigtable_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":bigtable_php_grpc",
+- ":bigtable_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-bigtable-v2-php",
+- deps = [
+- ":bigtable_php_gapic",
+- ":bigtable_php_grpc",
+- ":bigtable_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "bigtable_nodejs_gapic",
+- package_name = "@google-cloud/bigtable",
+- src = ":bigtable_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "bigtable_grpc_service_config.json",
+- handwritten_layer = True,
+- main_service = "bigtable",
+- package = "google.bigtable.v2",
+- rest_numeric_enums = False,
+- service_yaml = "bigtable_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigtable-v2-nodejs",
+- deps = [
+- ":bigtable_nodejs_gapic",
+- ":bigtable_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "bigtable_ruby_proto",
+- deps = [":bigtable_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "bigtable_ruby_grpc",
+- srcs = [":bigtable_proto"],
+- deps = [":bigtable_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "bigtable_ruby_gapic",
+- srcs = [":bigtable_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-bigtable-v2",
+- "ruby-cloud-env-prefix=BIGTABLE",
+- "ruby-cloud-product-url=https://cloud.google.com/bigtable",
+- "ruby-cloud-api-id=bigtable.googleapis.com",
+- "ruby-cloud-api-shortname=bigtable",
+- ],
+- grpc_service_config = "bigtable_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Bigtable is a fully managed, scalable NoSQL database service for large analytical and operational workloads.",
+- ruby_cloud_title = "Cloud Bigtable V2",
+- deps = [
+- ":bigtable_ruby_grpc",
+- ":bigtable_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigtable-v2-ruby",
+- deps = [
+- ":bigtable_ruby_gapic",
+- ":bigtable_ruby_grpc",
+- ":bigtable_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "bigtable_csharp_proto",
+- deps = [":bigtable_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "bigtable_csharp_grpc",
+- srcs = [":bigtable_proto"],
+- deps = [":bigtable_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "bigtable_csharp_gapic",
+- srcs = [":bigtable_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "bigtable_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigtable_v2.yaml",
+- deps = [
+- ":bigtable_csharp_grpc",
+- ":bigtable_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigtable-v2-csharp",
+- deps = [
+- ":bigtable_csharp_gapic",
+- ":bigtable_csharp_grpc",
+- ":bigtable_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "bigtable_cc_proto",
+- deps = [":bigtable_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "bigtable_cc_grpc",
+- srcs = [":bigtable_proto"],
+- grpc_only = True,
+- deps = [":bigtable_cc_proto"],
+-)
+diff -urN a/google/chat/logging/v1/BUILD.bazel b/google/chat/logging/v1/BUILD.bazel
+--- a/google/chat/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/chat/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,177 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "chat_app_log_entry.proto",
+- ],
+- deps = [
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/chat/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/chromeos/moblab/BUILD.bazel b/google/chromeos/moblab/BUILD.bazel
+--- a/google/chromeos/moblab/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/chromeos/moblab/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/chromeos/moblab/v1beta1/BUILD.bazel b/google/chromeos/moblab/v1beta1/BUILD.bazel
+--- a/google/chromeos/moblab/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/chromeos/moblab/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,322 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "moblab_proto",
+- srcs = [
+- "build_service.proto",
+- "resources.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "moblab_proto_with_info",
+- deps = [
+- ":moblab_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "moblab_java_proto",
+- deps = [":moblab_proto"],
+-)
+-
+-java_grpc_library(
+- name = "moblab_java_grpc",
+- srcs = [":moblab_proto"],
+- deps = [":moblab_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "moblab_java_gapic",
+- srcs = [":moblab_proto_with_info"],
+- gapic_yaml = "chromeosmoblab_gapic.yaml",
+- grpc_service_config = "moblab_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "chromeosmoblab_v1beta1.yaml",
+- test_deps = [
+- ":moblab_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":moblab_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "moblab_java_gapic_test_suite",
+- test_classes = [
+- "com.google.chromeos.moblab.v1beta1.BuildServiceClientHttpJsonTest",
+- "com.google.chromeos.moblab.v1beta1.BuildServiceClientTest",
+- ],
+- runtime_deps = [":moblab_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-chromeos-moblab-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":moblab_java_gapic",
+- ":moblab_java_grpc",
+- ":moblab_java_proto",
+- ":moblab_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "moblab_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/chromeos/moblab/v1beta1",
+- protos = [":moblab_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "moblab_go_gapic",
+- srcs = [":moblab_proto_with_info"],
+- grpc_service_config = "moblab_grpc_service_config.json",
+- importpath = "google.golang.org/google/chromeos/moblab/v1beta1;moblab",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "chromeosmoblab_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":moblab_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "moblab_go_gapic_test",
+- srcs = [":moblab_go_gapic_srcjar_test"],
+- embed = [":moblab_go_gapic"],
+- importpath = "google.golang.org/google/chromeos/moblab/v1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-chromeos-moblab-v1beta1-go",
+- deps = [
+- ":moblab_go_gapic",
+- ":moblab_go_gapic_srcjar-metadata.srcjar",
+- ":moblab_go_gapic_srcjar-test.srcjar",
+- ":moblab_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "moblab_py_gapic",
+- srcs = [":moblab_proto"],
+- grpc_service_config = "moblab_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "moblab_py_gapic_test",
+- srcs = [
+- "moblab_py_gapic_pytest.py",
+- "moblab_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":moblab_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "chromeos-moblab-v1beta1-py",
+- deps = [
+- ":moblab_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "moblab_php_proto",
+- deps = [":moblab_proto"],
+-)
+-
+-php_grpc_library(
+- name = "moblab_php_grpc",
+- srcs = [":moblab_proto"],
+- deps = [":moblab_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "moblab_php_gapic",
+- srcs = [":moblab_proto_with_info"],
+- grpc_service_config = "moblab_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "chromeosmoblab_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":moblab_php_grpc",
+- ":moblab_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-chromeos-moblab-v1beta1-php",
+- deps = [
+- ":moblab_php_gapic",
+- ":moblab_php_grpc",
+- ":moblab_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "moblab_nodejs_gapic",
+- package_name = "@google-cloud/moblab",
+- src = ":moblab_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "moblab_grpc_service_config.json",
+- package = "google.chromeos.moblab.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "chromeosmoblab_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "chromeos-moblab-v1beta1-nodejs",
+- deps = [
+- ":moblab_nodejs_gapic",
+- ":moblab_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "moblab_ruby_proto",
+- deps = [":moblab_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "moblab_ruby_grpc",
+- srcs = [":moblab_proto"],
+- deps = [":moblab_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "moblab_ruby_gapic",
+- srcs = [":moblab_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-chromeos-moblab-v1beta1"],
+- grpc_service_config = "moblab_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":moblab_ruby_grpc",
+- ":moblab_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-chromeos-moblab-v1beta1-ruby",
+- deps = [
+- ":moblab_ruby_gapic",
+- ":moblab_ruby_grpc",
+- ":moblab_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "moblab_csharp_proto",
+- deps = [":moblab_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "moblab_csharp_grpc",
+- srcs = [":moblab_proto"],
+- deps = [":moblab_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "moblab_csharp_gapic",
+- srcs = [":moblab_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "moblab_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "chromeosmoblab_v1beta1.yaml",
+- deps = [
+- ":moblab_csharp_grpc",
+- ":moblab_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-chromeos-moblab-v1beta1-csharp",
+- deps = [
+- ":moblab_csharp_gapic",
+- ":moblab_csharp_grpc",
+- ":moblab_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/chromeos/uidetection/v1/BUILD.bazel b/google/chromeos/uidetection/v1/BUILD.bazel
+--- a/google/chromeos/uidetection/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/chromeos/uidetection/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,324 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "uidetection_proto",
+- srcs = [
+- "ui_detection.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "uidetection_proto_with_info",
+- deps = [
+- ":uidetection_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "uidetection_java_proto",
+- deps = [":uidetection_proto"],
+-)
+-
+-java_grpc_library(
+- name = "uidetection_java_grpc",
+- srcs = [":uidetection_proto"],
+- deps = [":uidetection_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "uidetection_java_gapic",
+- srcs = [":uidetection_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "ui_detection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "chromeosuidetection_v1.yaml",
+- test_deps = [
+- ":uidetection_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":uidetection_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "uidetection_java_gapic_test_suite",
+- test_classes = [
+- "com.google.chromeos.uidetection.v1.UiDetectionServiceClientHttpJsonTest",
+- "com.google.chromeos.uidetection.v1.UiDetectionServiceClientTest",
+- ],
+- runtime_deps = [":uidetection_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-chromeos-uidetection-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":uidetection_java_gapic",
+- ":uidetection_java_grpc",
+- ":uidetection_java_proto",
+- ":uidetection_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "uidetection_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/chromeos/uidetection/v1",
+- protos = [":uidetection_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "uidetection_go_gapic",
+- srcs = [":uidetection_proto_with_info"],
+- grpc_service_config = "ui_detection_grpc_service_config.json",
+- importpath = "google.golang.org/google/chromeos/uidetection/v1;uidetection",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "chromeosuidetection_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":uidetection_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "uidetection_go_gapic_test",
+- srcs = [":uidetection_go_gapic_srcjar_test"],
+- embed = [":uidetection_go_gapic"],
+- importpath = "google.golang.org/google/chromeos/uidetection/v1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-chromeos-uidetection-v1-go",
+- deps = [
+- ":uidetection_go_gapic",
+- ":uidetection_go_gapic_srcjar-metadata.srcjar",
+- ":uidetection_go_gapic_srcjar-test.srcjar",
+- ":uidetection_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "uidetection_py_gapic",
+- srcs = [":uidetection_proto"],
+- grpc_service_config = "ui_detection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "uidetection_py_gapic_test",
+- srcs = [
+- "uidetection_py_gapic_pytest.py",
+- "uidetection_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":uidetection_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "chromeos-uidetection-v1-py",
+- deps = [
+- ":uidetection_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "uidetection_php_proto",
+- deps = [":uidetection_proto"],
+-)
+-
+-php_grpc_library(
+- name = "uidetection_php_grpc",
+- srcs = [":uidetection_proto"],
+- deps = [":uidetection_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "uidetection_php_gapic",
+- srcs = [":uidetection_proto_with_info"],
+- grpc_service_config = "ui_detection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "chromeosuidetection_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":uidetection_php_grpc",
+- ":uidetection_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-chromeos-uidetection-v1-php",
+- deps = [
+- ":uidetection_php_gapic",
+- ":uidetection_php_grpc",
+- ":uidetection_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "uidetection_nodejs_gapic",
+- package_name = "@google-cloud/uidetection",
+- src = ":uidetection_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "ui_detection_grpc_service_config.json",
+- package = "google.chromeos.uidetection.v1",
+- rest_numeric_enums = False,
+- service_yaml = "chromeosuidetection_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "chromeos-uidetection-v1-nodejs",
+- deps = [
+- ":uidetection_nodejs_gapic",
+- ":uidetection_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "uidetection_ruby_proto",
+- deps = [":uidetection_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "uidetection_ruby_grpc",
+- srcs = [":uidetection_proto"],
+- deps = [":uidetection_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "uidetection_ruby_gapic",
+- srcs = [":uidetection_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-chromeos-uidetection-v1",
+- ],
+- grpc_service_config = "ui_detection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":uidetection_ruby_grpc",
+- ":uidetection_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-chromeos-uidetection-v1-ruby",
+- deps = [
+- ":uidetection_ruby_gapic",
+- ":uidetection_ruby_grpc",
+- ":uidetection_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "uidetection_csharp_proto",
+- deps = [":uidetection_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "uidetection_csharp_grpc",
+- srcs = [":uidetection_proto"],
+- deps = [":uidetection_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "uidetection_csharp_gapic",
+- srcs = [":uidetection_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "ui_detection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "chromeosuidetection_v1.yaml",
+- deps = [
+- ":uidetection_csharp_grpc",
+- ":uidetection_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-chromeos-uidetection-v1-csharp",
+- deps = [
+- ":uidetection_csharp_gapic",
+- ":uidetection_csharp_grpc",
+- ":uidetection_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "uidetection_cc_proto",
+- deps = [":uidetection_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "uidetection_cc_grpc",
+- srcs = [":uidetection_proto"],
+- grpc_only = True,
+- deps = [":uidetection_cc_proto"],
+-)
+diff -urN a/google/cloud/BUILD.bazel b/google/cloud/BUILD.bazel
+--- a/google/cloud/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,115 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-proto_library(
+- name = "common_resources_proto",
+- srcs = ["common_resources.proto"],
+- deps = ["//google/api:resource_proto"],
+-)
+-
+-proto_library(
+- name = "extended_operations_proto",
+- srcs = ["extended_operations.proto"],
+- deps = ["@com_google_protobuf//:descriptor_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "extended_operations_java_proto",
+- deps = [
+- ":extended_operations_proto",
+- ],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-apps-script-type-java",
+- transport = "grpc+rest",
+- deps = [
+- "extended_operations_java_proto",
+- ":extended_operations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "extended_operations_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/cloud/extendedops",
+- protos = [
+- ":extended_operations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "py_proto_library")
+-
+-py_proto_library(
+- name = "extended_operations_py_proto",
+- deps = [":extended_operations_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "php_proto_library")
+-
+-php_proto_library(
+- name = "extended_operations_php_proto",
+- deps = [":extended_operations_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-# Node does not have langauge-specific proto_library targets
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "ruby_proto_library")
+-
+-ruby_proto_library(
+- name = "extended_operations_ruby_proto",
+- deps = [":extended_operations_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "csharp_proto_library")
+-
+-csharp_proto_library(
+- name = "extended_operations_csharp_proto",
+- deps = [":extended_operations_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "cc_proto_library")
+-
+-cc_proto_library(
+- name = "extended_operations_cc_proto",
+- deps = [":extended_operations_proto"],
+-)
+diff -urN a/google/cloud/accessapproval/BUILD.bazel b/google/cloud/accessapproval/BUILD.bazel
+--- a/google/cloud/accessapproval/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/accessapproval/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-access_approval.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for accessapproval.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "accessapproval_ruby_wrapper",
+- srcs = ["//google/cloud/accessapproval/v1:accessapproval_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-access_approval",
+- "ruby-cloud-env-prefix=ACCESS_APPROVAL",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/access-approval/",
+- "ruby-cloud-api-id=accessapproval.googleapis.com",
+- "ruby-cloud-api-shortname=accessapproval",
+- ],
+- ruby_cloud_description = "An API for controlling access to data by Google personnel.",
+- ruby_cloud_title = "Access Approval",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-accessapproval-ruby",
+- deps = [
+- ":accessapproval_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/accessapproval/v1/BUILD.bazel b/google/cloud/accessapproval/v1/BUILD.bazel
+--- a/google/cloud/accessapproval/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/accessapproval/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,385 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "accessapproval_proto",
+- srcs = [
+- "accessapproval.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "accessapproval_proto_with_info",
+- deps = [
+- ":accessapproval_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "accessapproval_java_proto",
+- deps = [":accessapproval_proto"],
+-)
+-
+-java_grpc_library(
+- name = "accessapproval_java_grpc",
+- srcs = [":accessapproval_proto"],
+- deps = [":accessapproval_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "accessapproval_java_gapic",
+- srcs = [":accessapproval_proto_with_info"],
+- gapic_yaml = "accessapproval_gapic.yaml",
+- grpc_service_config = "accessapproval_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":accessapproval_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":accessapproval_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "accessapproval_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.accessapproval.v1.AccessApprovalAdminClientHttpJsonTest",
+- "com.google.cloud.accessapproval.v1.AccessApprovalAdminClientTest",
+- ],
+- runtime_deps = [":accessapproval_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-accessapproval-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":accessapproval_java_gapic",
+- ":accessapproval_java_grpc",
+- ":accessapproval_java_proto",
+- ":accessapproval_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "accessapproval_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/accessapproval/v1",
+- protos = [":accessapproval_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "accessapproval_go_gapic",
+- srcs = [":accessapproval_proto_with_info"],
+- grpc_service_config = "accessapproval_grpc_service_config.json",
+- importpath = "cloud.google.com/go/accessapproval/apiv1;accessapproval",
+- rest_numeric_enums = False,
+- service_yaml = "accessapproval_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":accessapproval_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "accessapproval_go_gapic_test",
+- srcs = [":accessapproval_go_gapic_srcjar_test"],
+- embed = [":accessapproval_go_gapic"],
+- importpath = "cloud.google.com/go/accessapproval/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-accessapproval-v1-go",
+- deps = [
+- ":accessapproval_go_gapic",
+- ":accessapproval_go_gapic_srcjar-test.srcjar",
+- ":accessapproval_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "accessapproval_py_gapic",
+- srcs = [":accessapproval_proto"],
+- grpc_service_config = "accessapproval_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-access-approval",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "accessapproval_py_gapic_test",
+- srcs = [
+- "accessapproval_py_gapic_pytest.py",
+- "accessapproval_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":accessapproval_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "accessapproval-v1-py",
+- deps = [
+- ":accessapproval_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "accessapproval_php_proto",
+- deps = [":accessapproval_proto"],
+-)
+-
+-php_grpc_library(
+- name = "accessapproval_php_grpc",
+- srcs = [":accessapproval_proto"],
+- deps = [":accessapproval_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "accessapproval_php_gapic",
+- srcs = [":accessapproval_proto_with_info"],
+- grpc_service_config = "accessapproval_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":accessapproval_php_grpc",
+- ":accessapproval_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-accessapproval-v1-php",
+- deps = [
+- ":accessapproval_php_gapic",
+- ":accessapproval_php_grpc",
+- ":accessapproval_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "accessapproval_nodejs_gapic",
+- package_name = "@google-cloud/access-approval",
+- src = ":accessapproval_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "accessapproval_grpc_service_config.json",
+- package = "google.cloud.accessapproval.v1",
+- rest_numeric_enums = False,
+- service_yaml = "accessapproval_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "accessapproval-v1-nodejs",
+- deps = [
+- ":accessapproval_nodejs_gapic",
+- ":accessapproval_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "accessapproval_ruby_proto",
+- deps = [":accessapproval_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "accessapproval_ruby_grpc",
+- srcs = [":accessapproval_proto"],
+- deps = [":accessapproval_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "accessapproval_ruby_gapic",
+- srcs = [":accessapproval_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-access_approval-v1",
+- "ruby-cloud-env-prefix=ACCESS_APPROVAL",
+- "ruby-cloud-product-url=https://cloud.google.com/access-approval/",
+- "ruby-cloud-api-id=accessapproval.googleapis.com",
+- "ruby-cloud-api-shortname=accessapproval",
+- ],
+- grpc_service_config = "accessapproval_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "An API for controlling access to data by Google personnel.",
+- ruby_cloud_title = "Access Approval V1",
+- deps = [
+- ":accessapproval_ruby_grpc",
+- ":accessapproval_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-accessapproval-v1-ruby",
+- deps = [
+- ":accessapproval_ruby_gapic",
+- ":accessapproval_ruby_grpc",
+- ":accessapproval_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "accessapproval_csharp_proto",
+- deps = [":accessapproval_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "accessapproval_csharp_grpc",
+- srcs = [":accessapproval_proto"],
+- deps = [":accessapproval_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "accessapproval_csharp_gapic",
+- srcs = [":accessapproval_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "accessapproval_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "accessapproval_v1.yaml",
+- deps = [
+- ":accessapproval_csharp_grpc",
+- ":accessapproval_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-accessapproval-v1-csharp",
+- deps = [
+- ":accessapproval_csharp_gapic",
+- ":accessapproval_csharp_grpc",
+- ":accessapproval_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "accessapproval_cc_proto",
+- deps = [":accessapproval_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "accessapproval_cc_grpc",
+- srcs = [":accessapproval_proto"],
+- grpc_only = True,
+- deps = [":accessapproval_cc_proto"],
+-)
+diff -urN a/google/cloud/aiplatform/BUILD.bazel b/google/cloud/aiplatform/BUILD.bazel
+--- a/google/cloud/aiplatform/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/aiplatform/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-ai_platform.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for aiplatform.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "aiplatform_ruby_wrapper",
+- srcs = ["//google/cloud/aiplatform/v1:aiplatform_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-ai_platform",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/vertex-ai/docs/",
+- "ruby-cloud-api-id=aiplatform.googleapis.com",
+- "ruby-cloud-api-shortname=aiplatform",
+- "ruby-cloud-gem-namespace=Google::Cloud::AIPlatform",
+- "ruby-cloud-service-override=AiPlatform=AIPlatform",
+- ],
+- ruby_cloud_description = "Vertex AI enables data scientists, developers, and AI newcomers to create custom machine learning models specific to their business needs by leveraging Google's state-of-the-art transfer learning and innovative AI research.",
+- ruby_cloud_title = "Vertex AI",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-aiplatform-ruby",
+- deps = [
+- ":aiplatform_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/aiplatform/logging/BUILD.bazel b/google/cloud/aiplatform/logging/BUILD.bazel
+--- a/google/cloud/aiplatform/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/aiplatform/logging/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,177 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "prediction.proto",
+- ],
+- deps = [
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/logging",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/aiplatform/v1/BUILD.bazel b/google/cloud/aiplatform/v1/BUILD.bazel
+--- a/google/cloud/aiplatform/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/aiplatform/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,559 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-_PROTO_SUBPACKAGE_DEPS = [
+- "//google/cloud/aiplatform/v1/schema/predict/instance:instance_proto",
+- "//google/cloud/aiplatform/v1/schema/predict/params:params_proto",
+- "//google/cloud/aiplatform/v1/schema/predict/prediction:prediction_proto",
+- "//google/cloud/aiplatform/v1/schema/trainingjob/definition:definition_proto",
+-]
+-
+-proto_library(
+- name = "aiplatform_proto",
+- srcs = [
+- "accelerator_type.proto",
+- "annotation.proto",
+- "annotation_spec.proto",
+- "artifact.proto",
+- "batch_prediction_job.proto",
+- "completion_stats.proto",
+- "context.proto",
+- "custom_job.proto",
+- "data_item.proto",
+- "data_labeling_job.proto",
+- "dataset.proto",
+- "dataset_service.proto",
+- "deployed_index_ref.proto",
+- "deployed_model_ref.proto",
+- "encryption_spec.proto",
+- "endpoint.proto",
+- "endpoint_service.proto",
+- "entity_type.proto",
+- "env_var.proto",
+- "event.proto",
+- "execution.proto",
+- "explanation.proto",
+- "explanation_metadata.proto",
+- "feature.proto",
+- "feature_monitoring_stats.proto",
+- "feature_selector.proto",
+- "featurestore.proto",
+- "featurestore_monitoring.proto",
+- "featurestore_online_service.proto",
+- "featurestore_service.proto",
+- "hyperparameter_tuning_job.proto",
+- "index.proto",
+- "index_endpoint.proto",
+- "index_endpoint_service.proto",
+- "index_service.proto",
+- "io.proto",
+- "job_service.proto",
+- "job_state.proto",
+- "lineage_subgraph.proto",
+- "machine_resources.proto",
+- "manual_batch_tuning_parameters.proto",
+- "metadata_schema.proto",
+- "metadata_service.proto",
+- "metadata_store.proto",
+- "migratable_resource.proto",
+- "migration_service.proto",
+- "model.proto",
+- "model_deployment_monitoring_job.proto",
+- "model_evaluation.proto",
+- "model_evaluation_slice.proto",
+- "model_monitoring.proto",
+- "model_service.proto",
+- "operation.proto",
+- "pipeline_failure_policy.proto",
+- "pipeline_job.proto",
+- "pipeline_service.proto",
+- "pipeline_state.proto",
+- "prediction_service.proto",
+- "saved_query.proto",
+- "specialist_pool.proto",
+- "specialist_pool_service.proto",
+- "study.proto",
+- "tensorboard.proto",
+- "tensorboard_data.proto",
+- "tensorboard_experiment.proto",
+- "tensorboard_run.proto",
+- "tensorboard_service.proto",
+- "tensorboard_time_series.proto",
+- "training_pipeline.proto",
+- "types.proto",
+- "unmanaged_container_model.proto",
+- "user_action_reference.proto",
+- "value.proto",
+- "vizier_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:httpbody_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:money_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ] + _PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-proto_library_with_info(
+- name = "aiplatform_proto_with_info",
+- deps = [
+- ":aiplatform_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ] + _PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-_JAVA_PROTO_SUBPACKAGE_DEPS = [
+- "//google/cloud/aiplatform/v1/schema/predict/instance:instance_java_proto",
+- "//google/cloud/aiplatform/v1/schema/predict/params:params_java_proto",
+- "//google/cloud/aiplatform/v1/schema/predict/prediction:prediction_java_proto",
+- "//google/cloud/aiplatform/v1/schema/trainingjob/definition:definition_java_proto",
+-]
+-
+-_JAVA_GRPC_SUBPACKAGE_DEPS = [
+- "//google/cloud/aiplatform/v1/schema/predict/instance:instance_java_grpc",
+- "//google/cloud/aiplatform/v1/schema/predict/params:params_java_grpc",
+- "//google/cloud/aiplatform/v1/schema/predict/prediction:prediction_java_grpc",
+- "//google/cloud/aiplatform/v1/schema/trainingjob/definition:definition_java_grpc",
+-]
+-
+-java_proto_library(
+- name = "aiplatform_java_proto",
+- deps = [":aiplatform_proto"],
+-)
+-
+-java_grpc_library(
+- name = "aiplatform_java_grpc",
+- srcs = [":aiplatform_proto"],
+- deps = [":aiplatform_java_proto"] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-java_gapic_library(
+- name = "aiplatform_java_gapic",
+- srcs = [":aiplatform_proto_with_info"],
+- gapic_yaml = "aiplatform_gapic.yaml",
+- grpc_service_config = "aiplatform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "aiplatform_v1.yaml",
+- test_deps = [
+- ":aiplatform_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+- transport = "grpc",
+- deps = [
+- ":aiplatform_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-java_gapic_test(
+- name = "aiplatform_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.aiplatform.v1.DatasetServiceClientTest",
+- "com.google.cloud.aiplatform.v1.EndpointServiceClientTest",
+- "com.google.cloud.aiplatform.v1.FeaturestoreOnlineServingServiceClientTest",
+- "com.google.cloud.aiplatform.v1.FeaturestoreServiceClientTest",
+- "com.google.cloud.aiplatform.v1.IndexEndpointServiceClientTest",
+- "com.google.cloud.aiplatform.v1.IndexServiceClientTest",
+- "com.google.cloud.aiplatform.v1.JobServiceClientTest",
+- "com.google.cloud.aiplatform.v1.MetadataServiceClientTest",
+- "com.google.cloud.aiplatform.v1.MigrationServiceClientTest",
+- "com.google.cloud.aiplatform.v1.ModelServiceClientTest",
+- "com.google.cloud.aiplatform.v1.PipelineServiceClientTest",
+- "com.google.cloud.aiplatform.v1.PredictionServiceClientTest",
+- "com.google.cloud.aiplatform.v1.SpecialistPoolServiceClientTest",
+- "com.google.cloud.aiplatform.v1.TensorboardServiceClientTest",
+- "com.google.cloud.aiplatform.v1.VizierServiceClientTest",
+- ],
+- runtime_deps = [":aiplatform_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-aiplatform-v1-java",
+- transport = "grpc",
+- deps = [
+- ":aiplatform_java_gapic",
+- ":aiplatform_java_grpc",
+- ":aiplatform_java_proto",
+- ":aiplatform_proto",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS + _PROTO_SUBPACKAGE_DEPS + _JAVA_GRPC_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "aiplatform_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1",
+- protos = [":aiplatform_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:money_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "aiplatform_go_gapic",
+- srcs = [":aiplatform_proto_with_info"],
+- grpc_service_config = "aiplatform_grpc_service_config.json",
+- importpath = "cloud.google.com/go/aiplatform/apiv1;aiplatform",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "aiplatform_v1.yaml",
+- deps = [
+- ":aiplatform_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "aiplatform_go_gapic_test",
+- srcs = [":aiplatform_go_gapic_srcjar_test"],
+- embed = [":aiplatform_go_gapic"],
+- importpath = "cloud.google.com/go/aiplatform/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-aiplatform-v1-go",
+- deps = [
+- ":aiplatform_go_gapic",
+- ":aiplatform_go_gapic_srcjar-metadata.srcjar",
+- ":aiplatform_go_gapic_srcjar-test.srcjar",
+- ":aiplatform_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-_PY_GAPIC_SUBPACKAGE_DEPS = [
+- "//google/cloud/aiplatform/v1/schema/predict/instance:instance_py_gapic",
+- "//google/cloud/aiplatform/v1/schema/predict/params:params_py_gapic",
+- "//google/cloud/aiplatform/v1/schema/predict/prediction:prediction_py_gapic",
+- "//google/cloud/aiplatform/v1/schema/trainingjob/definition:definition_py_gapic",
+-]
+-
+-py_gapic_library(
+- name = "aiplatform_py_gapic",
+- srcs = [":aiplatform_proto"],
+- grpc_service_config = "aiplatform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "aiplatform_v1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "aiplatform_py_gapic_test",
+- srcs = [
+- "aiplatform_py_gapic_pytest.py",
+- "aiplatform_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":aiplatform_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "aiplatform-v1-py",
+- deps = [
+- ":aiplatform_py_gapic",
+- ] + _PROTO_SUBPACKAGE_DEPS + _PY_GAPIC_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "aiplatform_php_proto",
+- deps = [":aiplatform_proto"],
+-)
+-
+-php_grpc_library(
+- name = "aiplatform_php_grpc",
+- srcs = [":aiplatform_proto"],
+- deps = [":aiplatform_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "aiplatform_php_gapic",
+- srcs = [":aiplatform_proto_with_info"],
+- grpc_service_config = "aiplatform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "aiplatform_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":aiplatform_php_grpc",
+- ":aiplatform_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-aiplatform-v1-php",
+- deps = [
+- ":aiplatform_php_gapic",
+- ":aiplatform_php_grpc",
+- ":aiplatform_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "aiplatform_nodejs_gapic",
+- package_name = "@google-cloud/aiplatform",
+- src = ":aiplatform_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "aiplatform_grpc_service_config.json",
+- package = "google.cloud.aiplatform.v1",
+- rest_numeric_enums = False,
+- service_yaml = "aiplatform_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "aiplatform-v1-nodejs",
+- deps = [
+- ":aiplatform_nodejs_gapic",
+- ":aiplatform_proto",
+- ] + _PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "aiplatform_ruby_proto",
+- deps = [":aiplatform_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "aiplatform_ruby_grpc",
+- srcs = [":aiplatform_proto"],
+- deps = [":aiplatform_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "aiplatform_ruby_gapic",
+- srcs = [":aiplatform_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=aiplatform.googleapis.com",
+- "ruby-cloud-api-shortname=aiplatform",
+- "ruby-cloud-gem-name=google-cloud-ai_platform-v1",
+- "ruby-cloud-gem-namespace=Google::Cloud::AIPlatform::V1",
+- "ruby-cloud-product-url=https://cloud.google.com/vertex-ai/docs/",
+- "ruby-cloud-service-override=AiPlatform=AIPlatform",
+- ],
+- grpc_service_config = "aiplatform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Vertex AI enables data scientists, developers, and AI newcomers to create custom machine learning models specific to their business needs by leveraging Google's state-of-the-art transfer learning and innovative AI research.",
+- ruby_cloud_title = "Vertex AI V1",
+- service_yaml = "aiplatform_v1.yaml",
+- deps = [
+- ":aiplatform_ruby_grpc",
+- ":aiplatform_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-aiplatform-v1-ruby",
+- deps = [
+- ":aiplatform_ruby_gapic",
+- ":aiplatform_ruby_grpc",
+- ":aiplatform_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "aiplatform_csharp_proto",
+- deps = [":aiplatform_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "aiplatform_csharp_grpc",
+- srcs = [":aiplatform_proto"],
+- deps = [":aiplatform_csharp_proto"],
+-)
+-
+-# Generate a package for googleapis-gen even without the GAPIC client.
+-# This will allow OwlBot to trigger changes to be pushed to google-cloud-dotnet,
+-# which will perform full generation after fixing up the protos first.
+-
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-aiplatform-v1-csharp",
+- package_name = "Google.Cloud.AIPlatform.V1",
+- generate_nongapic_package = True,
+- deps = [
+- ":aiplatform_csharp_grpc",
+- ":aiplatform_csharp_proto",
+- ],
+-)
+-
+-# csharp_gapic_library(
+-# name = "aiplatform_csharp_gapic",
+-# srcs = [":aiplatform_proto_with_info"],
+-# common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+-# grpc_service_config = "aiplatform_grpc_service_config.json",
+-# service_yaml = "aiplatform_v1.yaml",
+-# deps = [
+-# ":aiplatform_csharp_grpc",
+-# ":aiplatform_csharp_proto",
+-# ],
+-# )
+-
+-################################
+-# Keep C# target commented out through the regeneration, as C# gen has an issue
+-# with the aiplatform v1 protos
+-#
+-# csharp_gapic_library(
+-# name = "aiplatform_csharp_gapic",
+-# srcs = [":aiplatform_proto_with_info"],
+-# common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+-# grpc_service_config = "aiplatform_grpc_service_config.json",
+-# deps = [
+-# ":aiplatform_csharp_grpc",
+-# ":aiplatform_csharp_proto",
+-# ],
+-# )
+-
+-# Open Source Packages
+-# csharp_gapic_assembly_pkg(
+-# name = "google-cloud-aiplatform-v1-csharp",
+-# deps = [
+-# ":aiplatform_csharp_gapic",
+-# ":aiplatform_csharp_grpc",
+-# ":aiplatform_csharp_proto",
+-# ],
+-# )
+-################################
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "aiplatform_cc_proto",
+- deps = [":aiplatform_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "aiplatform_cc_grpc",
+- srcs = [":aiplatform_proto"],
+- grpc_only = True,
+- deps = [":aiplatform_cc_proto"],
+-)
+diff -urN a/google/cloud/aiplatform/v1/schema/predict/instance/BUILD.bazel b/google/cloud/aiplatform/v1/schema/predict/instance/BUILD.bazel
+--- a/google/cloud/aiplatform/v1/schema/predict/instance/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/aiplatform/v1/schema/predict/instance/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,217 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "instance_proto",
+- srcs = [
+- "image_classification.proto",
+- "image_object_detection.proto",
+- "image_segmentation.proto",
+- "text_classification.proto",
+- "text_extraction.proto",
+- "text_sentiment.proto",
+- "video_action_recognition.proto",
+- "video_classification.proto",
+- "video_object_tracking.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "instance_java_proto",
+- deps = [":instance_proto"],
+-)
+-
+-java_grpc_library(
+- name = "instance_java_grpc",
+- srcs = [":instance_proto"],
+- deps = [":instance_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "instance_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1/schema/predict/instance",
+- protos = [":instance_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "instance_moved_proto",
+- srcs = [":instance_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "instance_py_proto",
+- deps = [":instance_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "instance_py_grpc",
+- srcs = [":instance_moved_proto"],
+- deps = [":instance_py_proto"],
+-)
+-
+-py_gapic_library(
+- name = "instance_py_gapic",
+- srcs = [":instance_proto"],
+- opt_args = [
+- "python-gapic-namespace=google.cloud.aiplatform.v1.schema.predict",
+- "python-gapic-name=instance",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "instance-py",
+- deps = [
+- ":instance_py_gapic",
+- ],
+-)
+-
+-#load("@gapic_generator_java//rules_java_gapic:java_gapic.bzl", "java_generator_request_dump")
+-#
+-#java_generator_request_dump(
+-# name = "instance_request_dump",
+-# srcs = [":instance_py_gapic"],
+-# # opt_args = [
+-# # "python-gapic-namespace=google.cloud.aiplatform.v1.schema.predict",
+-# # "python-gapic-name=instance",
+-# # ],
+-# transport = "grpc",
+-#)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "instance_php_proto",
+- deps = [":instance_proto"],
+-)
+-
+-php_grpc_library(
+- name = "instance_php_grpc",
+- srcs = [":instance_proto"],
+- deps = [":instance_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "instance_ruby_proto",
+- deps = [":instance_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "instance_ruby_grpc",
+- srcs = [":instance_proto"],
+- deps = [":instance_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "instance_csharp_proto",
+- deps = [":instance_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "instance_csharp_grpc",
+- srcs = [":instance_proto"],
+- deps = [":instance_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "instance_cc_proto",
+- deps = [":instance_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "instance_cc_grpc",
+- srcs = [":instance_proto"],
+- grpc_only = True,
+- deps = [":instance_cc_proto"],
+-)
+diff -urN a/google/cloud/aiplatform/v1/schema/predict/params/BUILD.bazel b/google/cloud/aiplatform/v1/schema/predict/params/BUILD.bazel
+--- a/google/cloud/aiplatform/v1/schema/predict/params/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/aiplatform/v1/schema/predict/params/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,202 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "params_proto",
+- srcs = [
+- "image_classification.proto",
+- "image_object_detection.proto",
+- "image_segmentation.proto",
+- "video_action_recognition.proto",
+- "video_classification.proto",
+- "video_object_tracking.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "params_java_proto",
+- deps = [":params_proto"],
+-)
+-
+-java_grpc_library(
+- name = "params_java_grpc",
+- srcs = [":params_proto"],
+- deps = [":params_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "params_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1/schema/predict/params",
+- protos = [":params_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "params_moved_proto",
+- srcs = [":params_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "params_py_proto",
+- deps = [":params_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "params_py_grpc",
+- srcs = [":params_moved_proto"],
+- deps = [":params_py_proto"],
+-)
+-
+-py_gapic_library(
+- name = "params_py_gapic",
+- srcs = [":params_proto"],
+- opt_args = [
+- "python-gapic-namespace=google.cloud.aiplatform.v1.schema.predict",
+- "python-gapic-name=params",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "params-py",
+- deps = [
+- ":params_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "params_php_proto",
+- deps = [":params_proto"],
+-)
+-
+-php_grpc_library(
+- name = "params_php_grpc",
+- srcs = [":params_proto"],
+- deps = [":params_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "params_ruby_proto",
+- deps = [":params_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "params_ruby_grpc",
+- srcs = [":params_proto"],
+- deps = [":params_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "params_csharp_proto",
+- deps = [":params_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "params_csharp_grpc",
+- srcs = [":params_proto"],
+- deps = [":params_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "params_cc_proto",
+- deps = [":params_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "params_cc_grpc",
+- srcs = [":params_proto"],
+- grpc_only = True,
+- deps = [":params_cc_proto"],
+-)
+diff -urN a/google/cloud/aiplatform/v1/schema/predict/prediction/BUILD.bazel b/google/cloud/aiplatform/v1/schema/predict/prediction/BUILD.bazel
+--- a/google/cloud/aiplatform/v1/schema/predict/prediction/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/aiplatform/v1/schema/predict/prediction/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,213 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "prediction_proto",
+- srcs = [
+- "classification.proto",
+- "image_object_detection.proto",
+- "image_segmentation.proto",
+- "tabular_classification.proto",
+- "tabular_regression.proto",
+- "text_extraction.proto",
+- "text_sentiment.proto",
+- "video_action_recognition.proto",
+- "video_classification.proto",
+- "video_object_tracking.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "prediction_java_proto",
+- deps = [":prediction_proto"],
+-)
+-
+-java_grpc_library(
+- name = "prediction_java_grpc",
+- srcs = [":prediction_proto"],
+- deps = [":prediction_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "prediction_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1/schema/predict/prediction",
+- protos = [":prediction_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/cloud/aiplatform/v1/schema/predict/instance:instance_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "prediction_moved_proto",
+- srcs = [":prediction_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/cloud/aiplatform/v1/schema/predict/instance:instance_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "prediction_py_proto",
+- deps = [":prediction_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "prediction_py_grpc",
+- srcs = [":prediction_moved_proto"],
+- deps = [":prediction_py_proto"],
+-)
+-
+-py_gapic_library(
+- name = "prediction_py_gapic",
+- srcs = [":prediction_proto"],
+- opt_args = [
+- "python-gapic-namespace=google.cloud.aiplatform.v1.schema.predict", # Replace with the current version
+- "python-gapic-name=prediction",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "prediction-py",
+- deps = [
+- ":prediction_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "prediction_php_proto",
+- deps = [":prediction_proto"],
+-)
+-
+-php_grpc_library(
+- name = "prediction_php_grpc",
+- srcs = [":prediction_proto"],
+- deps = [":prediction_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "prediction_ruby_proto",
+- deps = [":prediction_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "prediction_ruby_grpc",
+- srcs = [":prediction_proto"],
+- deps = [":prediction_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "prediction_csharp_proto",
+- deps = [":prediction_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "prediction_csharp_grpc",
+- srcs = [":prediction_proto"],
+- deps = [":prediction_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "prediction_cc_proto",
+- deps = [":prediction_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "prediction_cc_grpc",
+- srcs = [":prediction_proto"],
+- grpc_only = True,
+- deps = [":prediction_cc_proto"],
+-)
+diff -urN a/google/cloud/aiplatform/v1/schema/trainingjob/definition/BUILD.bazel b/google/cloud/aiplatform/v1/schema/trainingjob/definition/BUILD.bazel
+--- a/google/cloud/aiplatform/v1/schema/trainingjob/definition/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/aiplatform/v1/schema/trainingjob/definition/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,210 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "definition_proto",
+- srcs = [
+- "automl_image_classification.proto",
+- "automl_image_object_detection.proto",
+- "automl_image_segmentation.proto",
+- "automl_tables.proto",
+- "automl_text_classification.proto",
+- "automl_text_extraction.proto",
+- "automl_text_sentiment.proto",
+- "automl_video_action_recognition.proto",
+- "automl_video_classification.proto",
+- "automl_video_object_tracking.proto",
+- "export_evaluated_data_items_config.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:field_behavior_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "definition_java_proto",
+- deps = [":definition_proto"],
+-)
+-
+-java_grpc_library(
+- name = "definition_java_grpc",
+- srcs = [":definition_proto"],
+- deps = [":definition_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "definition_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1/schema/trainingjob/definition",
+- protos = [":definition_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:field_behavior_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "definition_moved_proto",
+- srcs = [":definition_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:field_behavior_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "definition_py_proto",
+- deps = [":definition_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "definition_py_grpc",
+- srcs = [":definition_moved_proto"],
+- deps = [":definition_py_proto"],
+-)
+-
+-py_gapic_library(
+- name = "definition_py_gapic",
+- srcs = [":definition_proto"],
+- opt_args = [
+- "python-gapic-namespace=google.cloud.aiplatform.v1.schema.trainingjob",
+- "python-gapic-name=definition",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "definition_py",
+- deps = [
+- ":definition_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "definition_php_proto",
+- deps = [":definition_proto"],
+-)
+-
+-php_grpc_library(
+- name = "definition_php_grpc",
+- srcs = [":definition_proto"],
+- deps = [":definition_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "definition_ruby_proto",
+- deps = [":definition_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "definition_ruby_grpc",
+- srcs = [":definition_proto"],
+- deps = [":definition_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "definition_csharp_proto",
+- deps = [":definition_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "definition_csharp_grpc",
+- srcs = [":definition_proto"],
+- deps = [":definition_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "definition_cc_proto",
+- deps = [":definition_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "definition_cc_grpc",
+- srcs = [":definition_proto"],
+- grpc_only = True,
+- deps = [":definition_cc_proto"],
+-)
+diff -urN a/google/cloud/aiplatform/v1beta1/BUILD.bazel b/google/cloud/aiplatform/v1beta1/BUILD.bazel
+--- a/google/cloud/aiplatform/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/aiplatform/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,505 +0,0 @@
+-# This file was generated and then heavily edited by hand. Be careful not
+-# to rollback, undo, or overwrite any of the manual changes.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-_PROTO_SUBPACKAGE_DEPS = [
+- "//google/cloud/aiplatform/v1beta1/schema:schema_proto",
+- "//google/cloud/aiplatform/v1beta1/schema/predict/instance:instance_proto",
+- "//google/cloud/aiplatform/v1beta1/schema/predict/params:params_proto",
+- "//google/cloud/aiplatform/v1beta1/schema/predict/prediction:prediction_proto",
+- "//google/cloud/aiplatform/v1beta1/schema/trainingjob/definition:definition_proto",
+-]
+-
+-proto_library(
+- name = "aiplatform_proto",
+- srcs = [
+- "accelerator_type.proto",
+- "annotation.proto",
+- "annotation_spec.proto",
+- "artifact.proto",
+- "batch_prediction_job.proto",
+- "completion_stats.proto",
+- "context.proto",
+- "custom_job.proto",
+- "data_item.proto",
+- "data_labeling_job.proto",
+- "dataset.proto",
+- "dataset_service.proto",
+- "deployed_index_ref.proto",
+- "deployed_model_ref.proto",
+- "deployment_resource_pool.proto",
+- "deployment_resource_pool_service.proto",
+- "encryption_spec.proto",
+- "endpoint.proto",
+- "endpoint_service.proto",
+- "entity_type.proto",
+- "env_var.proto",
+- "event.proto",
+- "execution.proto",
+- "explanation.proto",
+- "explanation_metadata.proto",
+- "feature.proto",
+- "feature_monitoring_stats.proto",
+- "feature_selector.proto",
+- "featurestore.proto",
+- "featurestore_monitoring.proto",
+- "featurestore_online_service.proto",
+- "featurestore_service.proto",
+- "hyperparameter_tuning_job.proto",
+- "index.proto",
+- "index_endpoint.proto",
+- "index_endpoint_service.proto",
+- "index_service.proto",
+- "io.proto",
+- "job_service.proto",
+- "job_state.proto",
+- "lineage_subgraph.proto",
+- "machine_resources.proto",
+- "manual_batch_tuning_parameters.proto",
+- "metadata_schema.proto",
+- "metadata_service.proto",
+- "metadata_store.proto",
+- "migratable_resource.proto",
+- "migration_service.proto",
+- "model.proto",
+- "model_deployment_monitoring_job.proto",
+- "model_evaluation.proto",
+- "model_evaluation_slice.proto",
+- "model_monitoring.proto",
+- "model_service.proto",
+- "operation.proto",
+- "pipeline_failure_policy.proto",
+- "pipeline_job.proto",
+- "pipeline_service.proto",
+- "pipeline_state.proto",
+- "prediction_service.proto",
+- "saved_query.proto",
+- "specialist_pool.proto",
+- "specialist_pool_service.proto",
+- "study.proto",
+- "tensorboard.proto",
+- "tensorboard_data.proto",
+- "tensorboard_experiment.proto",
+- "tensorboard_run.proto",
+- "tensorboard_service.proto",
+- "tensorboard_time_series.proto",
+- "training_pipeline.proto",
+- "types.proto",
+- "unmanaged_container_model.proto",
+- "user_action_reference.proto",
+- "value.proto",
+- "vizier_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:httpbody_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:interval_proto",
+- "//google/type:money_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ] + _PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-proto_library_with_info(
+- name = "aiplatform_proto_with_info",
+- deps = [
+- ":aiplatform_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ] + _PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-_JAVA_PROTO_SUBPACKAGE_DEPS = [
+- "//google/cloud/aiplatform/v1beta1/schema/predict/instance:instance_java_proto",
+- "//google/cloud/aiplatform/v1beta1/schema/predict/params:params_java_proto",
+- "//google/cloud/aiplatform/v1beta1/schema/predict/prediction:prediction_java_proto",
+- "//google/cloud/aiplatform/v1beta1/schema/trainingjob/definition:definition_java_proto",
+-]
+-
+-_JAVA_GRPC_SUBPACKAGE_DEPS = [
+- "//google/cloud/aiplatform/v1beta1/schema/predict/instance:instance_java_grpc",
+- "//google/cloud/aiplatform/v1beta1/schema/predict/params:params_java_grpc",
+- "//google/cloud/aiplatform/v1beta1/schema/predict/prediction:prediction_java_grpc",
+- "//google/cloud/aiplatform/v1beta1/schema/trainingjob/definition:definition_java_grpc",
+-]
+-
+-java_proto_library(
+- name = "aiplatform_java_proto",
+- deps = [":aiplatform_proto"],
+-)
+-
+-java_grpc_library(
+- name = "aiplatform_java_grpc",
+- srcs = [":aiplatform_proto"],
+- deps = [":aiplatform_java_proto"] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-java_gapic_library(
+- name = "aiplatform_java_gapic",
+- srcs = [":aiplatform_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "aiplatform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "aiplatform_v1beta1.yaml",
+- test_deps = [
+- ":aiplatform_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ] + _JAVA_GRPC_SUBPACKAGE_DEPS,
+- transport = "grpc",
+- deps = [
+- ":aiplatform_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-java_gapic_test(
+- name = "aiplatform_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.aiplatform.v1beta1.DatasetServiceClientTest",
+- "com.google.cloud.aiplatform.v1beta1.EndpointServiceClientTest",
+- "com.google.cloud.aiplatform.v1beta1.FeaturestoreOnlineServingServiceClientTest",
+- "com.google.cloud.aiplatform.v1beta1.FeaturestoreServiceClientTest",
+- "com.google.cloud.aiplatform.v1beta1.IndexEndpointServiceClientTest",
+- "com.google.cloud.aiplatform.v1beta1.IndexServiceClientTest",
+- "com.google.cloud.aiplatform.v1beta1.JobServiceClientTest",
+- "com.google.cloud.aiplatform.v1beta1.MetadataServiceClientTest",
+- "com.google.cloud.aiplatform.v1beta1.MigrationServiceClientTest",
+- "com.google.cloud.aiplatform.v1beta1.ModelServiceClientTest",
+- "com.google.cloud.aiplatform.v1beta1.PipelineServiceClientTest",
+- "com.google.cloud.aiplatform.v1beta1.PredictionServiceClientTest",
+- "com.google.cloud.aiplatform.v1beta1.SpecialistPoolServiceClientTest",
+- "com.google.cloud.aiplatform.v1beta1.TensorboardServiceClientTest",
+- "com.google.cloud.aiplatform.v1beta1.VizierServiceClientTest",
+- ],
+- runtime_deps = [":aiplatform_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-aiplatform-v1beta1-java",
+- transport = "grpc",
+- deps = [
+- ":aiplatform_java_gapic",
+- ":aiplatform_java_grpc",
+- ":aiplatform_java_proto",
+- ":aiplatform_proto",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS + _PROTO_SUBPACKAGE_DEPS + _JAVA_GRPC_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "aiplatform_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1",
+- protos = [":aiplatform_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:interval_go_proto",
+- "//google/type:money_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "aiplatform_go_gapic",
+- srcs = [":aiplatform_proto_with_info"],
+- grpc_service_config = "aiplatform_grpc_service_config.json",
+- importpath = "cloud.google.com/go/aiplatform/apiv1beta1;aiplatform",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "aiplatform_v1beta1.yaml",
+- deps = [
+- ":aiplatform_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "aiplatform_go_gapic_test",
+- srcs = [":aiplatform_go_gapic_srcjar_test"],
+- embed = [":aiplatform_go_gapic"],
+- importpath = "cloud.google.com/go/aiplatform/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-aiplatform-v1beta1-go",
+- deps = [
+- ":aiplatform_go_gapic",
+- ":aiplatform_go_gapic_srcjar-metadata.srcjar",
+- ":aiplatform_go_gapic_srcjar-test.srcjar",
+- ":aiplatform_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-_PY_GAPIC_SUBPACKAGE_DEPS = [
+- "//google/cloud/aiplatform/v1beta1/schema/predict/instance:instance_py_gapic",
+- "//google/cloud/aiplatform/v1beta1/schema/predict/params:params_py_gapic",
+- "//google/cloud/aiplatform/v1beta1/schema/predict/prediction:prediction_py_gapic",
+- "//google/cloud/aiplatform/v1beta1/schema/trainingjob/definition:definition_py_gapic",
+-]
+-
+-py_gapic_library(
+- name = "aiplatform_py_gapic",
+- srcs = [":aiplatform_proto"],
+- grpc_service_config = "aiplatform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "aiplatform_v1beta1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "aiplatform_py_gapic_test",
+- srcs = [
+- "aiplatform_py_gapic_pytest.py",
+- "aiplatform_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":aiplatform_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "aiplatform-v1beta1-py",
+- deps = [
+- ":aiplatform_py_gapic",
+- ] + _PROTO_SUBPACKAGE_DEPS + _PY_GAPIC_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "aiplatform_php_proto",
+- deps = [":aiplatform_proto"],
+-)
+-
+-php_grpc_library(
+- name = "aiplatform_php_grpc",
+- srcs = [":aiplatform_proto"],
+- deps = [":aiplatform_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "aiplatform_php_gapic",
+- srcs = [":aiplatform_proto_with_info"],
+- grpc_service_config = "aiplatform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "aiplatform_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":aiplatform_php_grpc",
+- ":aiplatform_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-aiplatform-v1beta1-php",
+- deps = [
+- ":aiplatform_php_gapic",
+- ":aiplatform_php_grpc",
+- ":aiplatform_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "aiplatform_nodejs_gapic",
+- package_name = "@google-cloud/aiplatform",
+- src = ":aiplatform_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "aiplatform_grpc_service_config.json",
+- package = "google.cloud.aiplatform.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "aiplatform_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "aiplatform-v1beta1-nodejs",
+- deps = [
+- ":aiplatform_nodejs_gapic",
+- ":aiplatform_proto",
+- ] + _PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "aiplatform_ruby_proto",
+- deps = [":aiplatform_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "aiplatform_ruby_grpc",
+- srcs = [":aiplatform_proto"],
+- deps = [":aiplatform_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "aiplatform_ruby_gapic",
+- srcs = [":aiplatform_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-aiplatform-v1beta1"],
+- grpc_service_config = "aiplatform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":aiplatform_ruby_grpc",
+- ":aiplatform_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-aiplatform-v1beta1-ruby",
+- deps = [
+- ":aiplatform_ruby_gapic",
+- ":aiplatform_ruby_grpc",
+- ":aiplatform_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "aiplatform_csharp_proto",
+- deps = [":aiplatform_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "aiplatform_csharp_grpc",
+- srcs = [":aiplatform_proto"],
+- deps = [":aiplatform_csharp_proto"],
+-)
+-
+-################################
+-# Keep C# targets commented out through the regeneration, as C# gen has an issue
+-# with the aiplatform v1beta1 protos
+-#
+-# csharp_gapic_library(
+-# name = "aiplatform_csharp_gapic",
+-# srcs = [":aiplatform_proto_with_info"],
+-# common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+-# grpc_service_config = "aiplatform_grpc_service_config.json",
+-# service_yaml = "aiplatform_v1beta1.yaml",
+-# deps = [
+-# ":aiplatform_csharp_grpc",
+-# ":aiplatform_csharp_proto",
+-# ],
+-# )
+-
+-# Open Source Packages
+-# csharp_gapic_assembly_pkg(
+-# name = "google-cloud-aiplatform-v1beta1-csharp",
+-# deps = [
+-# ":aiplatform_csharp_gapic",
+-# ":aiplatform_csharp_grpc",
+-# ":aiplatform_csharp_proto",
+-# ],
+-# )
+-################################
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/aiplatform/v1beta1/schema/BUILD.bazel b/google/cloud/aiplatform/v1beta1/schema/BUILD.bazel
+--- a/google/cloud/aiplatform/v1beta1/schema/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/aiplatform/v1beta1/schema/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,176 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "schema_proto",
+- srcs = [
+- "annotation_payload.proto",
+- "annotation_spec_color.proto",
+- "data_item_payload.proto",
+- "dataset_metadata.proto",
+- "geometry.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:field_behavior_proto",
+- "//google/type:color_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "schema_java_proto",
+- deps = [":schema_proto"],
+-)
+-
+-java_grpc_library(
+- name = "schema_java_grpc",
+- srcs = [":schema_proto"],
+- deps = [":schema_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "schema_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1/schema",
+- protos = [":schema_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:color_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "schema_moved_proto",
+- srcs = [":schema_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:field_behavior_proto",
+- "//google/type:color_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "schema_py_proto",
+- deps = [":schema_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "schema_py_grpc",
+- srcs = [":schema_moved_proto"],
+- deps = [":schema_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "schema_php_proto",
+- deps = [":schema_proto"],
+-)
+-
+-php_grpc_library(
+- name = "schema_php_grpc",
+- srcs = [":schema_proto"],
+- deps = [":schema_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "schema_ruby_proto",
+- deps = [":schema_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "schema_ruby_grpc",
+- srcs = [":schema_proto"],
+- deps = [":schema_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "schema_csharp_proto",
+- deps = [":schema_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "schema_csharp_grpc",
+- srcs = [":schema_proto"],
+- deps = [":schema_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/aiplatform/v1beta1/schema/predict/instance/BUILD.bazel b/google/cloud/aiplatform/v1beta1/schema/predict/instance/BUILD.bazel
+--- a/google/cloud/aiplatform/v1beta1/schema/predict/instance/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/aiplatform/v1beta1/schema/predict/instance/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,189 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "instance_proto",
+- srcs = [
+- "image_classification.proto",
+- "image_object_detection.proto",
+- "image_segmentation.proto",
+- "text_classification.proto",
+- "text_extraction.proto",
+- "text_sentiment.proto",
+- "video_action_recognition.proto",
+- "video_classification.proto",
+- "video_object_tracking.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "instance_java_proto",
+- deps = [":instance_proto"],
+-)
+-
+-java_grpc_library(
+- name = "instance_java_grpc",
+- srcs = [":instance_proto"],
+- deps = [":instance_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "instance_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1/schema/predict/instance",
+- protos = [":instance_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "instance_moved_proto",
+- srcs = [":instance_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "instance_py_proto",
+- deps = [":instance_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "instance_py_grpc",
+- srcs = [":instance_moved_proto"],
+- deps = [":instance_py_proto"],
+-)
+-
+-py_gapic_library(
+- name = "instance_py_gapic",
+- srcs = [":instance_proto"],
+- opt_args = [
+- "python-gapic-namespace=google.cloud.aiplatform.v1beta1.schema.predict",
+- "python-gapic-name=instance",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "instance-py",
+- deps = [
+- ":instance_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "instance_php_proto",
+- deps = [":instance_proto"],
+-)
+-
+-php_grpc_library(
+- name = "instance_php_grpc",
+- srcs = [":instance_proto"],
+- deps = [":instance_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "instance_ruby_proto",
+- deps = [":instance_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "instance_ruby_grpc",
+- srcs = [":instance_proto"],
+- deps = [":instance_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "instance_csharp_proto",
+- deps = [":instance_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "instance_csharp_grpc",
+- srcs = [":instance_proto"],
+- deps = [":instance_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/aiplatform/v1beta1/schema/predict/params/BUILD.bazel b/google/cloud/aiplatform/v1beta1/schema/predict/params/BUILD.bazel
+--- a/google/cloud/aiplatform/v1beta1/schema/predict/params/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/aiplatform/v1beta1/schema/predict/params/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,186 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "params_proto",
+- srcs = [
+- "image_classification.proto",
+- "image_object_detection.proto",
+- "image_segmentation.proto",
+- "video_action_recognition.proto",
+- "video_classification.proto",
+- "video_object_tracking.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "params_java_proto",
+- deps = [":params_proto"],
+-)
+-
+-java_grpc_library(
+- name = "params_java_grpc",
+- srcs = [":params_proto"],
+- deps = [":params_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "params_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1/schema/predict/params",
+- protos = [":params_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "params_moved_proto",
+- srcs = [":params_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "params_py_proto",
+- deps = [":params_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "params_py_grpc",
+- srcs = [":params_moved_proto"],
+- deps = [":params_py_proto"],
+-)
+-
+-py_gapic_library(
+- name = "params_py_gapic",
+- srcs = [":params_proto"],
+- opt_args = [
+- "python-gapic-namespace=google.cloud.aiplatform.v1beta1.schema.predict",
+- "python-gapic-name=params",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "params-py",
+- deps = [
+- ":params_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "params_php_proto",
+- deps = [":params_proto"],
+-)
+-
+-php_grpc_library(
+- name = "params_php_grpc",
+- srcs = [":params_proto"],
+- deps = [":params_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "params_ruby_proto",
+- deps = [":params_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "params_ruby_grpc",
+- srcs = [":params_proto"],
+- deps = [":params_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "params_csharp_proto",
+- deps = [":params_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "params_csharp_grpc",
+- srcs = [":params_proto"],
+- deps = [":params_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/aiplatform/v1beta1/schema/predict/prediction/BUILD.bazel b/google/cloud/aiplatform/v1beta1/schema/predict/prediction/BUILD.bazel
+--- a/google/cloud/aiplatform/v1beta1/schema/predict/prediction/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/aiplatform/v1beta1/schema/predict/prediction/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,200 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "prediction_proto",
+- srcs = [
+- "classification.proto",
+- "image_object_detection.proto",
+- "image_segmentation.proto",
+- "tabular_classification.proto",
+- "tabular_regression.proto",
+- "text_extraction.proto",
+- "text_sentiment.proto",
+- "time_series_forecasting.proto",
+- "video_action_recognition.proto",
+- "video_classification.proto",
+- "video_object_tracking.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/cloud/aiplatform/v1beta1/schema/predict/instance:instance_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "prediction_java_proto",
+- deps = [":prediction_proto"],
+-)
+-
+-java_grpc_library(
+- name = "prediction_java_grpc",
+- srcs = [":prediction_proto"],
+- deps = [":prediction_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "prediction_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1/schema/predict/prediction",
+- protos = [":prediction_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/cloud/aiplatform/v1beta1/schema/predict/instance:instance_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "prediction_moved_proto",
+- srcs = [":prediction_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/cloud/aiplatform/v1beta1/schema/predict/instance:instance_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "prediction_py_proto",
+- deps = [":prediction_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "prediction_py_grpc",
+- srcs = [":prediction_moved_proto"],
+- deps = [":prediction_py_proto"],
+-)
+-
+-py_gapic_library(
+- name = "prediction_py_gapic",
+- srcs = [":prediction_proto"],
+- opt_args = [
+- "python-gapic-namespace=google.cloud.aiplatform.v1beta1.schema.predict",
+- "python-gapic-name=prediction",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "prediction-py",
+- deps = [
+- ":prediction_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "prediction_php_proto",
+- deps = [":prediction_proto"],
+-)
+-
+-php_grpc_library(
+- name = "prediction_php_grpc",
+- srcs = [":prediction_proto"],
+- deps = [":prediction_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "prediction_ruby_proto",
+- deps = [":prediction_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "prediction_ruby_grpc",
+- srcs = [":prediction_proto"],
+- deps = [":prediction_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "prediction_csharp_proto",
+- deps = [":prediction_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "prediction_csharp_grpc",
+- srcs = [":prediction_proto"],
+- deps = [":prediction_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/BUILD.bazel b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/BUILD.bazel
+--- a/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,196 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "definition_proto",
+- srcs = [
+- "automl_image_classification.proto",
+- "automl_image_object_detection.proto",
+- "automl_image_segmentation.proto",
+- "automl_tables.proto",
+- "automl_text_classification.proto",
+- "automl_text_extraction.proto",
+- "automl_text_sentiment.proto",
+- "automl_time_series_forecasting.proto",
+- "automl_video_action_recognition.proto",
+- "automl_video_classification.proto",
+- "automl_video_object_tracking.proto",
+- "export_evaluated_data_items_config.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:field_behavior_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "definition_java_proto",
+- deps = [":definition_proto"],
+-)
+-
+-java_grpc_library(
+- name = "definition_java_grpc",
+- srcs = [":definition_proto"],
+- deps = [":definition_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "definition_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1/schema/trainingjob/definition",
+- protos = [":definition_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:field_behavior_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_grpc_library",
+- "py_proto_library",
+- "py_test",
+-)
+-
+-moved_proto_library(
+- name = "definition_moved_proto",
+- srcs = [":definition_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:field_behavior_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "definition_py_proto",
+- deps = [":definition_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "definition_py_grpc",
+- srcs = [":definition_moved_proto"],
+- deps = [":definition_py_proto"],
+-)
+-
+-py_gapic_library(
+- name = "definition_py_gapic",
+- srcs = [":definition_proto"],
+- opt_args = [
+- "python-gapic-namespace=google.cloud.aiplatform.v1beta1.schema.trainingjob",
+- "python-gapic-name=definition",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "definition_py",
+- deps = [
+- ":definition_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "definition_php_proto",
+- deps = [":definition_proto"],
+-)
+-
+-php_grpc_library(
+- name = "definition_php_grpc",
+- srcs = [":definition_proto"],
+- deps = [":definition_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "definition_ruby_proto",
+- deps = [":definition_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "definition_ruby_grpc",
+- srcs = [":definition_proto"],
+- deps = [":definition_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "definition_csharp_proto",
+- deps = [":definition_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "definition_csharp_grpc",
+- srcs = [":definition_proto"],
+- deps = [":definition_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/apigateway/BUILD.bazel b/google/cloud/apigateway/BUILD.bazel
+--- a/google/cloud/apigateway/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/apigateway/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-api_gateway.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for apigateway.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "apigateway_ruby_wrapper",
+- srcs = ["//google/cloud/apigateway/v1:apigateway_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-api_gateway",
+- "ruby-cloud-env-prefix=API_GATEWAY",
+- "ruby-cloud-wrapper-of=v1:0.1",
+- "ruby-cloud-product-url=https://cloud.google.com/api-gateway/",
+- "ruby-cloud-api-id=apigateway.googleapis.com",
+- "ruby-cloud-api-shortname=apigateway",
+- ],
+- ruby_cloud_description = "API Gateway enables you to provide secure access to your backend services through a well-defined REST API that is consistent across all of your services, regardless of the service implementation. Clients consume your REST APIS to implement standalone apps for a mobile device or tablet, through apps running in a browser, or through any other type of app that can make a request to an HTTP endpoint.",
+- ruby_cloud_title = "API Gateway",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-apigateway-ruby",
+- deps = [
+- ":apigateway_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/apigateway/v1/BUILD.bazel b/google/cloud/apigateway/v1/BUILD.bazel
+--- a/google/cloud/apigateway/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/apigateway/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,390 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "apigateway_proto",
+- srcs = [
+- "apigateway.proto",
+- "apigateway_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "apigateway_proto_with_info",
+- deps = [
+- ":apigateway_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "apigateway_java_proto",
+- deps = [":apigateway_proto"],
+-)
+-
+-java_grpc_library(
+- name = "apigateway_java_grpc",
+- srcs = [":apigateway_proto"],
+- deps = [":apigateway_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "apigateway_java_gapic",
+- srcs = [":apigateway_proto_with_info"],
+- grpc_service_config = "apigateway_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":apigateway_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":apigateway_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "apigateway_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.apigateway.v1.ApiGatewayServiceClientHttpJsonTest",
+- "com.google.cloud.apigateway.v1.ApiGatewayServiceClientTest",
+- ],
+- runtime_deps = [":apigateway_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-apigateway-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":apigateway_java_gapic",
+- ":apigateway_java_grpc",
+- ":apigateway_java_proto",
+- ":apigateway_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "apigateway_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/apigateway/v1",
+- protos = [":apigateway_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "apigateway_go_gapic",
+- srcs = [":apigateway_proto_with_info"],
+- grpc_service_config = "apigateway_grpc_service_config.json",
+- importpath = "cloud.google.com/go/apigateway/apiv1;apigateway",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "apigateway_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":apigateway_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "apigateway_go_gapic_test",
+- srcs = [":apigateway_go_gapic_srcjar_test"],
+- embed = [":apigateway_go_gapic"],
+- importpath = "cloud.google.com/go/apigateway/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-apigateway-v1-go",
+- deps = [
+- ":apigateway_go_gapic",
+- ":apigateway_go_gapic_srcjar-metadata.srcjar",
+- ":apigateway_go_gapic_srcjar-test.srcjar",
+- ":apigateway_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "apigateway_py_gapic",
+- srcs = [":apigateway_proto"],
+- grpc_service_config = "apigateway_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-api-gateway"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "apigateway_py_gapic_test",
+- srcs = [
+- "apigateway_py_gapic_pytest.py",
+- "apigateway_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":apigateway_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "google-cloud-apigateway-v1-py",
+- deps = [
+- ":apigateway_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "apigateway_php_proto",
+- deps = [":apigateway_proto"],
+-)
+-
+-php_grpc_library(
+- name = "apigateway_php_grpc",
+- srcs = [":apigateway_proto"],
+- deps = [":apigateway_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "apigateway_php_gapic",
+- srcs = [":apigateway_proto_with_info"],
+- grpc_service_config = "apigateway_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "apigateway_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":apigateway_php_grpc",
+- ":apigateway_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-apigateway-v1-php",
+- deps = [
+- ":apigateway_php_gapic",
+- ":apigateway_php_grpc",
+- ":apigateway_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "apigateway_nodejs_gapic",
+- package_name = "@google-cloud/api-gateway",
+- src = ":apigateway_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "apigateway_grpc_service_config.json",
+- package = "google.cloud.apigateway.v1",
+- rest_numeric_enums = False,
+- service_yaml = "apigateway_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "apigateway-v1-nodejs",
+- deps = [
+- ":apigateway_nodejs_gapic",
+- ":apigateway_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "apigateway_ruby_proto",
+- deps = [":apigateway_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "apigateway_ruby_grpc",
+- srcs = [":apigateway_proto"],
+- deps = [":apigateway_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "apigateway_ruby_gapic",
+- srcs = [":apigateway_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-api_gateway-v1",
+- "ruby-cloud-env-prefix=API_GATEWAY",
+- "ruby-cloud-product-url=https://cloud.google.com/api-gateway/",
+- "ruby-cloud-api-id=apigateway.googleapis.com",
+- "ruby-cloud-api-shortname=apigateway",
+- ],
+- grpc_service_config = "apigateway_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "API Gateway enables you to provide secure access to your backend services through a well-defined REST API that is consistent across all of your services, regardless of the service implementation. Clients consume your REST APIS to implement standalone apps for a mobile device or tablet, through apps running in a browser, or through any other type of app that can make a request to an HTTP endpoint.",
+- ruby_cloud_title = "API Gateway V1",
+- deps = [
+- ":apigateway_ruby_grpc",
+- ":apigateway_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-apigateway-v1-ruby",
+- deps = [
+- ":apigateway_ruby_gapic",
+- ":apigateway_ruby_grpc",
+- ":apigateway_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "apigateway_csharp_proto",
+- deps = [":apigateway_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "apigateway_csharp_grpc",
+- srcs = [":apigateway_proto"],
+- deps = [":apigateway_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "apigateway_csharp_gapic",
+- srcs = [":apigateway_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "apigateway_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "apigateway_v1.yaml",
+- deps = [
+- ":apigateway_csharp_grpc",
+- ":apigateway_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-apigateway-v1-csharp",
+- deps = [
+- ":apigateway_csharp_gapic",
+- ":apigateway_csharp_grpc",
+- ":apigateway_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "apigateway_cc_proto",
+- deps = [":apigateway_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "apigateway_cc_grpc",
+- srcs = [":apigateway_proto"],
+- grpc_only = True,
+- deps = [":apigateway_cc_proto"],
+-)
+diff -urN a/google/cloud/apigeeconnect/BUILD.bazel b/google/cloud/apigeeconnect/BUILD.bazel
+--- a/google/cloud/apigeeconnect/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/apigeeconnect/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-apigee_connect.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for apigeeconnect.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "apigeeconnect_ruby_wrapper",
+- srcs = ["//google/cloud/apigeeconnect/v1:apigeeconnect_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-apigee_connect",
+- "ruby-cloud-env-prefix=APIGEE_CONNECT",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/apigee/docs/hybrid/v1.4/apigee-connect",
+- "ruby-cloud-api-id=apigeeconnect.googleapis.com",
+- "ruby-cloud-api-shortname=apigeeconnect",
+- ],
+- ruby_cloud_description = "Apigee Connect allows the Apigee hybrid management plane to connect securely to the MART service in the runtime plane without requiring you to expose the MART endpoint on the internet. If you use Apigee Connect, you do not need to configure the MART ingress gateway with a host alias and an authorized DNS certificate.",
+- ruby_cloud_title = "Apigee Connect",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-apigeeconnect-ruby",
+- deps = [
+- ":apigeeconnect_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/apigeeconnect/v1/BUILD.bazel b/google/cloud/apigeeconnect/v1/BUILD.bazel
+--- a/google/cloud/apigeeconnect/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/apigeeconnect/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,388 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "apigeeconnect_proto",
+- srcs = [
+- "connection.proto",
+- "tether.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "apigeeconnect_proto_with_info",
+- deps = [
+- ":apigeeconnect_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "apigeeconnect_java_proto",
+- deps = [":apigeeconnect_proto"],
+-)
+-
+-java_grpc_library(
+- name = "apigeeconnect_java_grpc",
+- srcs = [":apigeeconnect_proto"],
+- deps = [":apigeeconnect_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "apigeeconnect_java_gapic",
+- srcs = [":apigeeconnect_proto_with_info"],
+- grpc_service_config = "connection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":apigeeconnect_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":apigeeconnect_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "apigeeconnect_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.apigeeconnect.v1.ConnectionServiceClientHttpJsonTest",
+- "com.google.cloud.apigeeconnect.v1.ConnectionServiceClientTest",
+- "com.google.cloud.apigeeconnect.v1.TetherClientHttpJsonTest",
+- "com.google.cloud.apigeeconnect.v1.TetherClientTest",
+- ],
+- runtime_deps = [":apigeeconnect_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-apigeeconnect-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":apigeeconnect_java_gapic",
+- ":apigeeconnect_java_grpc",
+- ":apigeeconnect_java_proto",
+- ":apigeeconnect_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "apigeeconnect_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/apigeeconnect/v1",
+- protos = [":apigeeconnect_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "apigeeconnect_go_gapic",
+- srcs = [":apigeeconnect_proto_with_info"],
+- grpc_service_config = "connection_grpc_service_config.json",
+- importpath = "cloud.google.com/go/apigeeconnect/apiv1;apigeeconnect",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "apigeeconnect_v1.yaml",
+- deps = [
+- ":apigeeconnect_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "apigeeconnect_go_gapic_test",
+- srcs = [":apigeeconnect_go_gapic_srcjar_test"],
+- embed = [":apigeeconnect_go_gapic"],
+- importpath = "cloud.google.com/go/apigeeconnect/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-apigeeconnect-v1-go",
+- deps = [
+- ":apigeeconnect_go_gapic",
+- ":apigeeconnect_go_gapic_srcjar-metadata.srcjar",
+- ":apigeeconnect_go_gapic_srcjar-test.srcjar",
+- ":apigeeconnect_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "apigeeconnect_py_gapic",
+- srcs = [":apigeeconnect_proto"],
+- grpc_service_config = "connection_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-apigee-connect"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "apigeeconnect_py_gapic_test",
+- srcs = [
+- "apigeeconnect_py_gapic_pytest.py",
+- "apigeeconnect_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":apigeeconnect_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "apigeeconnect-v1-py",
+- deps = [
+- ":apigeeconnect_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "apigeeconnect_php_proto",
+- deps = [":apigeeconnect_proto"],
+-)
+-
+-php_grpc_library(
+- name = "apigeeconnect_php_grpc",
+- srcs = [":apigeeconnect_proto"],
+- deps = [":apigeeconnect_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "apigeeconnect_php_gapic",
+- srcs = [":apigeeconnect_proto_with_info"],
+- grpc_service_config = "connection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "apigeeconnect_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":apigeeconnect_php_grpc",
+- ":apigeeconnect_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-apigeeconnect-v1-php",
+- deps = [
+- ":apigeeconnect_php_gapic",
+- ":apigeeconnect_php_grpc",
+- ":apigeeconnect_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "apigeeconnect_nodejs_gapic",
+- package_name = "@google-cloud/apigee-connect",
+- src = ":apigeeconnect_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "connection_grpc_service_config.json",
+- package = "google.cloud.apigeeconnect.v1",
+- rest_numeric_enums = False,
+- service_yaml = "apigeeconnect_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "apigeeconnect-v1-nodejs",
+- deps = [
+- ":apigeeconnect_nodejs_gapic",
+- ":apigeeconnect_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "apigeeconnect_ruby_proto",
+- deps = [":apigeeconnect_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "apigeeconnect_ruby_grpc",
+- srcs = [":apigeeconnect_proto"],
+- deps = [":apigeeconnect_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "apigeeconnect_ruby_gapic",
+- srcs = [":apigeeconnect_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-apigee_connect-v1",
+- "ruby-cloud-env-prefix=APIGEE_CONNECT",
+- "ruby-cloud-product-url=https://cloud.google.com/apigee/docs/hybrid/v1.4/apigee-connect",
+- "ruby-cloud-api-id=apigeeconnect.googleapis.com",
+- "ruby-cloud-api-shortname=apigeeconnect",
+- ],
+- grpc_service_config = "connection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Apigee Connect allows the Apigee hybrid management plane to connect securely to the MART service in the runtime plane without requiring you to expose the MART endpoint on the internet. If you use Apigee Connect, you do not need to configure the MART ingress gateway with a host alias and an authorized DNS certificate.",
+- ruby_cloud_title = "Apigee Connect V1",
+- deps = [
+- ":apigeeconnect_ruby_grpc",
+- ":apigeeconnect_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-apigeeconnect-v1-ruby",
+- deps = [
+- ":apigeeconnect_ruby_gapic",
+- ":apigeeconnect_ruby_grpc",
+- ":apigeeconnect_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "apigeeconnect_csharp_proto",
+- deps = [":apigeeconnect_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "apigeeconnect_csharp_grpc",
+- srcs = [":apigeeconnect_proto"],
+- deps = [":apigeeconnect_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "apigeeconnect_csharp_gapic",
+- srcs = [":apigeeconnect_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "connection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "apigeeconnect_v1.yaml",
+- deps = [
+- ":apigeeconnect_csharp_grpc",
+- ":apigeeconnect_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-apigeeconnect-v1-csharp",
+- deps = [
+- ":apigeeconnect_csharp_gapic",
+- ":apigeeconnect_csharp_grpc",
+- ":apigeeconnect_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "apigeeconnect_cc_proto",
+- deps = [":apigeeconnect_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "apigeeconnect_cc_grpc",
+- srcs = [":apigeeconnect_proto"],
+- grpc_only = True,
+- deps = [":apigeeconnect_cc_proto"],
+-)
+diff -urN a/google/cloud/apigeeregistry/BUILD.bazel b/google/cloud/apigeeregistry/BUILD.bazel
+--- a/google/cloud/apigeeregistry/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/apigeeregistry/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-apigee_registry.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for apigeeregistry.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "apigeeregistry_ruby_wrapper",
+- srcs = ["//google/cloud/apigeeregistry/v1:apigeeregistry_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=apigeeregistry.googleapis.com",
+- "ruby-cloud-api-shortname=apigeeregistry",
+- "ruby-cloud-gem-name=google-cloud-apigee_registry",
+- "ruby-cloud-product-url=https://cloud.google.com/apigee/docs/api-hub/get-started-registry-api/",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- ],
+- ruby_cloud_description = "The Apigee Registry API allows teams to upload and share machine-readable descriptions of APIs that are in use and in development. These descriptions include API specifications in standard formats like OpenAPI, the Google API Discovery Service Format, and the Protocol Buffers Language. These API specifications can be used by tools like linters, browsers, documentation generators, test runners, proxies, and API client and server generators. The Registry API itself can be seen as a machine-readable enterprise API catalog designed to back online directories, portals, and workflow managers.",
+- ruby_cloud_title = "Apigee Registry",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-apigeeregistry-ruby",
+- deps = [
+- ":apigeeregistry_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/apigeeregistry/v1/BUILD.bazel b/google/cloud/apigeeregistry/v1/BUILD.bazel
+--- a/google/cloud/apigeeregistry/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/apigeeregistry/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,415 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "apigeeregistry_proto",
+- srcs = [
+- "provisioning_service.proto",
+- "registry_models.proto",
+- "registry_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:httpbody_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "apigeeregistry_proto_with_info",
+- deps = [
+- ":apigeeregistry_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "apigeeregistry_java_proto",
+- deps = [":apigeeregistry_proto"],
+-)
+-
+-java_grpc_library(
+- name = "apigeeregistry_java_grpc",
+- srcs = [":apigeeregistry_proto"],
+- deps = [":apigeeregistry_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "apigeeregistry_java_gapic",
+- srcs = [":apigeeregistry_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "apigeeregistry_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "apigeeregistry_v1.yaml",
+- test_deps = [
+- ":apigeeregistry_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":apigeeregistry_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "apigeeregistry_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.apigeeregistry.v1.ProvisioningClientHttpJsonTest",
+- "com.google.cloud.apigeeregistry.v1.ProvisioningClientTest",
+- "com.google.cloud.apigeeregistry.v1.RegistryClientHttpJsonTest",
+- "com.google.cloud.apigeeregistry.v1.RegistryClientTest",
+- ],
+- runtime_deps = [":apigeeregistry_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-apigeeregistry-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":apigeeregistry_java_gapic",
+- ":apigeeregistry_java_grpc",
+- ":apigeeregistry_java_proto",
+- ":apigeeregistry_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "apigeeregistry_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1",
+- protos = [":apigeeregistry_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "apigeeregistry_go_gapic",
+- srcs = [":apigeeregistry_proto_with_info"],
+- grpc_service_config = "apigeeregistry_grpc_service_config.json",
+- importpath = "cloud.google.com/go/apigeeregistry/apiv1;apigeeregistry",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "apigeeregistry_v1.yaml",
+- deps = [
+- ":apigeeregistry_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "apigeeregistry_go_gapic_test",
+- srcs = [":apigeeregistry_go_gapic_srcjar_test"],
+- embed = [":apigeeregistry_go_gapic"],
+- importpath = "cloud.google.com/go/apigeeregistry/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-apigeeregistry-v1-go",
+- deps = [
+- ":apigeeregistry_go_gapic",
+- ":apigeeregistry_go_gapic_srcjar-metadata.srcjar",
+- ":apigeeregistry_go_gapic_srcjar-test.srcjar",
+- ":apigeeregistry_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "apigeeregistry_py_gapic",
+- srcs = [":apigeeregistry_proto"],
+- grpc_service_config = "apigeeregistry_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-apigee-registry",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=apigee_registry",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "apigeeregistry_v1.yaml",
+- transport = "grpc+rest",
+-)
+-
+-py_test(
+- name = "apigeeregistry_py_gapic_test",
+- srcs = [
+- "apigeeregistry_py_gapic_pytest.py",
+- "apigeeregistry_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [
+- ":apigeeregistry_py_gapic",
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "apigeeregistry-v1-py",
+- deps = [
+- ":apigeeregistry_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "apigeeregistry_php_proto",
+- deps = [":apigeeregistry_proto"],
+-)
+-
+-php_grpc_library(
+- name = "apigeeregistry_php_grpc",
+- srcs = [":apigeeregistry_proto"],
+- deps = [":apigeeregistry_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "apigeeregistry_php_gapic",
+- srcs = [":apigeeregistry_proto_with_info"],
+- grpc_service_config = "apigeeregistry_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "apigeeregistry_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":apigeeregistry_php_grpc",
+- ":apigeeregistry_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-apigeeregistry-v1-php",
+- deps = [
+- ":apigeeregistry_php_gapic",
+- ":apigeeregistry_php_grpc",
+- ":apigeeregistry_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "apigeeregistry_nodejs_gapic",
+- package_name = "@google-cloud/apigee-registry",
+- src = ":apigeeregistry_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "apigeeregistry_grpc_service_config.json",
+- package = "google.cloud.apigeeregistry.v1",
+- rest_numeric_enums = False,
+- service_yaml = "apigeeregistry_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "apigeeregistry-v1-nodejs",
+- deps = [
+- ":apigeeregistry_nodejs_gapic",
+- ":apigeeregistry_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "apigeeregistry_ruby_proto",
+- deps = [":apigeeregistry_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "apigeeregistry_ruby_grpc",
+- srcs = [":apigeeregistry_proto"],
+- deps = [":apigeeregistry_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "apigeeregistry_ruby_gapic",
+- srcs = [":apigeeregistry_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=apigeeregistry.googleapis.com",
+- "ruby-cloud-api-shortname=apigeeregistry",
+- "ruby-cloud-gem-name=google-cloud-apigee_registry-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/apigee/docs/api-hub/get-started-registry-api/",
+- ],
+- grpc_service_config = "apigeeregistry_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Apigee Registry API allows teams to upload and share machine-readable descriptions of APIs that are in use and in development. These descriptions include API specifications in standard formats like OpenAPI, the Google API Discovery Service Format, and the Protocol Buffers Language. These API specifications can be used by tools like linters, browsers, documentation generators, test runners, proxies, and API client and server generators. The Registry API itself can be seen as a machine-readable enterprise API catalog designed to back online directories, portals, and workflow managers.",
+- ruby_cloud_title = "Apigee Registry V1",
+- service_yaml = "apigeeregistry_v1.yaml",
+- deps = [
+- ":apigeeregistry_ruby_grpc",
+- ":apigeeregistry_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-apigeeregistry-v1-ruby",
+- deps = [
+- ":apigeeregistry_ruby_gapic",
+- ":apigeeregistry_ruby_grpc",
+- ":apigeeregistry_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "apigeeregistry_csharp_proto",
+- deps = [":apigeeregistry_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "apigeeregistry_csharp_grpc",
+- srcs = [":apigeeregistry_proto"],
+- deps = [":apigeeregistry_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "apigeeregistry_csharp_gapic",
+- srcs = [":apigeeregistry_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "apigeeregistry_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "apigeeregistry_v1.yaml",
+- deps = [
+- ":apigeeregistry_csharp_grpc",
+- ":apigeeregistry_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-apigeeregistry-v1-csharp",
+- deps = [
+- ":apigeeregistry_csharp_gapic",
+- ":apigeeregistry_csharp_grpc",
+- ":apigeeregistry_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "apigeeregistry_cc_proto",
+- deps = [":apigeeregistry_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "apigeeregistry_cc_grpc",
+- srcs = [":apigeeregistry_proto"],
+- grpc_only = True,
+- deps = [":apigeeregistry_cc_proto"],
+-)
+diff -urN a/google/cloud/asset/BUILD.bazel b/google/cloud/asset/BUILD.bazel
+--- a/google/cloud/asset/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/asset/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-asset.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for cloudasset.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "cloudasset_ruby_wrapper",
+- srcs = ["//google/cloud/asset/v1:asset_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-asset",
+- "ruby-cloud-env-prefix=ASSET",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/asset-inventory/",
+- "ruby-cloud-api-id=cloudasset.googleapis.com",
+- "ruby-cloud-api-shortname=cloudasset",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "A metadata inventory service that allows you to view, monitor, and analyze all your GCP and Anthos assets across projects and services.",
+- ruby_cloud_title = "Cloud Asset",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-asset-ruby",
+- deps = [
+- ":cloudasset_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/asset/v1/BUILD.bazel b/google/cloud/asset/v1/BUILD.bazel
+--- a/google/cloud/asset/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/asset/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,415 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "asset_proto",
+- srcs = [
+- "asset_service.proto",
+- "assets.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/cloud/orgpolicy/v1:orgpolicy_proto",
+- "//google/cloud/osconfig/v1:osconfig_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/identity/accesscontextmanager/v1:accesscontextmanager_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:code_proto",
+- "//google/rpc:status_proto",
+- "//google/type:expr_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "asset_proto_with_info",
+- deps = [
+- ":asset_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "asset_java_proto",
+- deps = [":asset_proto"],
+-)
+-
+-java_grpc_library(
+- name = "asset_java_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "asset_java_gapic",
+- srcs = [":asset_proto_with_info"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":asset_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":asset_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "asset_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.asset.v1.AssetServiceClientHttpJsonTest",
+- "com.google.cloud.asset.v1.AssetServiceClientTest",
+- ],
+- runtime_deps = [":asset_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-asset-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":asset_java_gapic",
+- ":asset_java_grpc",
+- ":asset_java_proto",
+- ":asset_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "asset_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1",
+- protos = [":asset_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/cloud/orgpolicy/v1:orgpolicy_go_proto",
+- "//google/cloud/osconfig/v1:osconfig_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/identity/accesscontextmanager/v1:accesscontextmanager_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:code_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:expr_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "asset_go_gapic",
+- srcs = [":asset_proto_with_info"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- importpath = "cloud.google.com/go/asset/apiv1;asset",
+- rest_numeric_enums = False,
+- service_yaml = "cloudasset_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":asset_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "asset_go_gapic_test",
+- srcs = [":asset_go_gapic_srcjar_test"],
+- embed = [":asset_go_gapic"],
+- importpath = "cloud.google.com/go/asset/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-asset-v1-go",
+- deps = [
+- ":asset_go_gapic",
+- ":asset_go_gapic_srcjar-test.srcjar",
+- ":asset_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "asset_py_gapic",
+- srcs = [":asset_proto"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/cloud/orgpolicy/v1:orgpolicy_py_original_proto",
+- "//google/cloud/osconfig/v1:osconfig_py_proto",
+- "//google/iam/v1:policy_py_proto",
+- "//google/identity/accesscontextmanager/v1:access_level_py_proto",
+- "//google/identity/accesscontextmanager/v1:access_policy_py_proto",
+- "//google/identity/accesscontextmanager/v1:accesscontextmanager_py_gapic",
+- "//google/identity/accesscontextmanager/v1:service_perimeter_py_proto",
+- ],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "asset-v1-py",
+- deps = [
+- ":asset_py_gapic",
+- ],
+-)
+-
+-py_test(
+- name = "asset_py_gapic_test",
+- srcs = [
+- "asset_py_gapic_pytest.py",
+- "asset_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":asset_py_gapic"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "asset_php_proto",
+- deps = [":asset_proto"],
+-)
+-
+-php_grpc_library(
+- name = "asset_php_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "asset_php_gapic",
+- srcs = [":asset_proto_with_info"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudasset_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":asset_php_grpc",
+- ":asset_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-asset-v1-php",
+- deps = [
+- ":asset_php_gapic",
+- ":asset_php_grpc",
+- ":asset_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "asset_nodejs_gapic",
+- package_name = "@google-cloud/asset",
+- src = ":asset_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- package = "google.cloud.asset.v1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudasset_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "asset-v1-nodejs",
+- deps = [
+- ":asset_nodejs_gapic",
+- ":asset_proto",
+- "//google/cloud/osconfig/v1:osconfig_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "asset_ruby_proto",
+- deps = [
+- ":asset_proto",
+- "//google/cloud/orgpolicy/v1:orgpolicy_proto",
+- ],
+-)
+-
+-ruby_grpc_library(
+- name = "asset_ruby_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "asset_ruby_gapic",
+- srcs = [":asset_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-asset-v1",
+- "ruby-cloud-env-prefix=ASSET",
+- "ruby-cloud-product-url=https://cloud.google.com/asset-inventory/",
+- "ruby-cloud-api-id=cloudasset.googleapis.com",
+- "ruby-cloud-api-shortname=cloudasset",
+- "ruby-cloud-extra-dependencies=google-identity-access_context_manager-v1=> 0.0|< 2.a;google-cloud-os_config-v1=> 0.0|< 2.a",
+- ],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "A metadata inventory service that allows you to view, monitor, and analyze all your GCP and Anthos assets across projects and services.",
+- ruby_cloud_title = "Cloud Asset V1",
+- deps = [
+- ":asset_ruby_grpc",
+- ":asset_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-asset-v1-ruby",
+- deps = [
+- ":asset_ruby_gapic",
+- ":asset_ruby_grpc",
+- ":asset_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "asset_csharp_proto",
+- deps = [":asset_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "asset_csharp_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "asset_csharp_gapic",
+- srcs = [":asset_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudasset_v1.yaml",
+- deps = [
+- ":asset_csharp_grpc",
+- ":asset_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-asset-v1-csharp",
+- deps = [
+- ":asset_csharp_gapic",
+- ":asset_csharp_grpc",
+- ":asset_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "asset_cc_proto",
+- deps = [":asset_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "asset_cc_grpc",
+- srcs = [":asset_proto"],
+- grpc_only = True,
+- deps = [":asset_cc_proto"],
+-)
+diff -urN a/google/cloud/asset/v1p1beta1/BUILD.bazel b/google/cloud/asset/v1p1beta1/BUILD.bazel
+--- a/google/cloud/asset/v1p1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/asset/v1p1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,351 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "asset_proto",
+- srcs = [
+- "asset_service.proto",
+- "assets.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/iam/v1:policy_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "asset_proto_with_info",
+- deps = [
+- ":asset_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "asset_java_proto",
+- deps = [":asset_proto"],
+-)
+-
+-java_grpc_library(
+- name = "asset_java_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "asset_java_gapic",
+- srcs = [":asset_proto_with_info"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":asset_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":asset_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "asset_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.asset.v1p1beta1.AssetServiceClientHttpJsonTest",
+- "com.google.cloud.asset.v1p1beta1.AssetServiceClientTest",
+- ],
+- runtime_deps = [":asset_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-asset-v1p1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":asset_java_gapic",
+- ":asset_java_grpc",
+- ":asset_java_proto",
+- ":asset_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "asset_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1p1beta1",
+- protos = [":asset_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "asset_go_gapic",
+- srcs = [":asset_proto_with_info"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- importpath = "cloud.google.com/go/asset/apiv1p1beta1;asset",
+- rest_numeric_enums = False,
+- service_yaml = "cloudasset_v1p1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":asset_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "asset_go_gapic_test",
+- srcs = [":asset_go_gapic_srcjar_test"],
+- embed = [":asset_go_gapic"],
+- importpath = "cloud.google.com/go/asset/apiv1p1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-asset-v1p1beta1-go",
+- deps = [
+- ":asset_go_gapic",
+- ":asset_go_gapic_srcjar-test.srcjar",
+- ":asset_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "asset_py_gapic",
+- srcs = [":asset_proto"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "asset_py_gapic_test",
+- srcs = [
+- "asset_py_gapic_pytest.py",
+- "asset_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":asset_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "asset-v1p1beta1-py",
+- deps = [
+- ":asset_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "asset_php_proto",
+- deps = [":asset_proto"],
+-)
+-
+-php_grpc_library(
+- name = "asset_php_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "asset_php_gapic",
+- srcs = [":asset_proto_with_info"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":asset_php_grpc",
+- ":asset_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-asset-v1p1beta1-php",
+- deps = [
+- ":asset_php_gapic",
+- ":asset_php_grpc",
+- ":asset_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "asset_nodejs_gapic",
+- package_name = "@google-cloud/asset",
+- src = ":asset_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- package = "google.cloud.asset.v1p1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudasset_v1p1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "asset-v1p1beta1-nodejs",
+- deps = [
+- ":asset_nodejs_gapic",
+- ":asset_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "asset_ruby_proto",
+- deps = [":asset_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "asset_ruby_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "asset_ruby_gapic",
+- srcs = [":asset_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-asset-v1p1beta1"],
+- rest_numeric_enums = False,
+- deps = [
+- ":asset_ruby_grpc",
+- ":asset_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-asset-v1p1beta1-ruby",
+- deps = [
+- ":asset_ruby_gapic",
+- ":asset_ruby_grpc",
+- ":asset_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "asset_csharp_proto",
+- deps = [":asset_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "asset_csharp_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "asset_csharp_gapic",
+- srcs = [":asset_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudasset_v1p1beta1.yaml",
+- deps = [
+- ":asset_csharp_grpc",
+- ":asset_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-asset-v1p1beta1-csharp",
+- deps = [
+- ":asset_csharp_gapic",
+- ":asset_csharp_grpc",
+- ":asset_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/asset/v1p2beta1/BUILD.bazel b/google/cloud/asset/v1p2beta1/BUILD.bazel
+--- a/google/cloud/asset/v1p2beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/asset/v1p2beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,363 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "asset_proto",
+- srcs = [
+- "asset_service.proto",
+- "assets.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "asset_proto_with_info",
+- deps = [
+- ":asset_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "asset_java_proto",
+- deps = [":asset_proto"],
+-)
+-
+-java_grpc_library(
+- name = "asset_java_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "asset_java_gapic",
+- srcs = [":asset_proto_with_info"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":asset_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":asset_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "asset_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.asset.v1p2beta1.AssetServiceClientHttpJsonTest",
+- "com.google.cloud.asset.v1p2beta1.AssetServiceClientTest",
+- ],
+- runtime_deps = [":asset_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-asset-v1p2beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":asset_java_gapic",
+- ":asset_java_grpc",
+- ":asset_java_proto",
+- ":asset_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "asset_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1p2beta1",
+- protos = [":asset_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "asset_go_gapic",
+- srcs = [":asset_proto_with_info"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- importpath = "cloud.google.com/go/asset/apiv1p2beta1;asset",
+- rest_numeric_enums = False,
+- service_yaml = "cloudasset_v1p2beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":asset_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "asset_go_gapic_test",
+- srcs = [":asset_go_gapic_srcjar_test"],
+- embed = [":asset_go_gapic"],
+- importpath = "cloud.google.com/go/asset/apiv1p2beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-asset-v1p2beta1-go",
+- deps = [
+- ":asset_go_gapic",
+- ":asset_go_gapic_srcjar-test.srcjar",
+- ":asset_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "asset_py_gapic",
+- srcs = [":asset_proto"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "asset_py_gapic_test",
+- srcs = [
+- "asset_py_gapic_pytest.py",
+- "asset_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":asset_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "asset-v1p2beta1-py",
+- deps = [
+- ":asset_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "asset_php_proto",
+- deps = [":asset_proto"],
+-)
+-
+-php_grpc_library(
+- name = "asset_php_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "asset_php_gapic",
+- srcs = [":asset_proto_with_info"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":asset_php_grpc",
+- ":asset_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-asset-v1p2beta1-php",
+- deps = [
+- ":asset_php_gapic",
+- ":asset_php_grpc",
+- ":asset_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "asset_nodejs_gapic",
+- package_name = "@google-cloud/asset",
+- src = ":asset_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- package = "google.cloud.asset.v1p2beta1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudasset_v1p2beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "asset-v1p2beta1-nodejs",
+- deps = [
+- ":asset_nodejs_gapic",
+- ":asset_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "asset_ruby_proto",
+- deps = [":asset_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "asset_ruby_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "asset_ruby_gapic",
+- srcs = [":asset_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-asset-v1p2beta1"],
+- rest_numeric_enums = False,
+- deps = [
+- ":asset_ruby_grpc",
+- ":asset_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-asset-v1p2beta1-ruby",
+- deps = [
+- ":asset_ruby_gapic",
+- ":asset_ruby_grpc",
+- ":asset_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "asset_csharp_proto",
+- deps = [":asset_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "asset_csharp_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_csharp_proto"],
+-)
+-
+-# Invalid C# namespaces, cannot build.
+-# csharp_gapic_library(
+-# name = "asset_csharp_gapic",
+-# srcs = [":asset_proto_with_info"],
+-# grpc_service_config = "cloudasset_grpc_service_config.json",
+-# common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+-# deps = [
+-# ":asset_csharp_grpc",
+-# ":asset_csharp_proto",
+-# ],
+-# )
+-
+-# # Open Source Packages
+-# csharp_gapic_assembly_pkg(
+-# name = "google-cloud-asset-v1p2beta1-csharp",
+-# deps = [
+-# ":asset_csharp_gapic",
+-# ":asset_csharp_grpc",
+-# ":asset_csharp_proto",
+-# ],
+-# )
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/asset/v1p5beta1/BUILD.bazel b/google/cloud/asset/v1p5beta1/BUILD.bazel
+--- a/google/cloud/asset/v1p5beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/asset/v1p5beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,361 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "asset_proto",
+- srcs = [
+- "asset_service.proto",
+- "assets.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/cloud/orgpolicy/v1:orgpolicy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/identity/accesscontextmanager/v1:accesscontextmanager_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "asset_proto_with_info",
+- deps = [
+- ":asset_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "asset_java_proto",
+- deps = [":asset_proto"],
+-)
+-
+-java_grpc_library(
+- name = "asset_java_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "asset_java_gapic",
+- srcs = [":asset_proto_with_info"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":asset_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":asset_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "asset_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.asset.v1p5beta1.AssetServiceClientHttpJsonTest",
+- "com.google.cloud.asset.v1p5beta1.AssetServiceClientTest",
+- ],
+- runtime_deps = [":asset_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-asset-v1p5beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":asset_java_gapic",
+- ":asset_java_grpc",
+- ":asset_java_proto",
+- ":asset_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "asset_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1p5beta1",
+- protos = [":asset_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/cloud/orgpolicy/v1:orgpolicy_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/identity/accesscontextmanager/v1:accesscontextmanager_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "asset_go_gapic",
+- srcs = [":asset_proto_with_info"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- importpath = "cloud.google.com/go/asset/apiv1p5beta1;asset",
+- rest_numeric_enums = False,
+- service_yaml = "cloudasset_v1p5beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":asset_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "asset_go_gapic_test",
+- srcs = [":asset_go_gapic_srcjar_test"],
+- embed = [":asset_go_gapic"],
+- importpath = "cloud.google.com/go/asset/apiv1p5beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-asset-v1p5beta1-go",
+- deps = [
+- ":asset_go_gapic",
+- ":asset_go_gapic_srcjar-test.srcjar",
+- ":asset_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "asset_py_gapic",
+- srcs = [":asset_proto"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/cloud/orgpolicy/v1:orgpolicy_py_original_proto",
+- "//google/iam/v1:iam_policy_py_proto",
+- "//google/identity/accesscontextmanager/v1:access_level_py_proto",
+- "//google/identity/accesscontextmanager/v1:access_policy_py_proto",
+- "//google/identity/accesscontextmanager/v1:accesscontextmanager_py_gapic",
+- "//google/identity/accesscontextmanager/v1:service_perimeter_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "asset_py_gapic_test",
+- srcs = [
+- "asset_py_gapic_pytest.py",
+- "asset_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":asset_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "asset-v1p5beta1-py",
+- deps = [
+- ":asset_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "asset_php_proto",
+- deps = [":asset_proto"],
+-)
+-
+-php_grpc_library(
+- name = "asset_php_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "asset_php_gapic",
+- srcs = [":asset_proto_with_info"],
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":asset_php_grpc",
+- ":asset_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-asset-v1p5beta1-php",
+- deps = [
+- ":asset_php_gapic",
+- ":asset_php_grpc",
+- ":asset_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "asset_nodejs_gapic",
+- src = ":asset_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- gapic_yaml = "cloudasset_gapic.yaml",
+- package = "google.cloud.asset.v1p5beta1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudasset_v1p5beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "asset-v1p5beta1-nodejs",
+- deps = [
+- ":asset_nodejs_gapic",
+- ":asset_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "asset_ruby_proto",
+- deps = [":asset_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "asset_ruby_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "asset_ruby_gapic",
+- srcs = [":asset_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-asset-v1p5beta1"],
+- rest_numeric_enums = False,
+- deps = [
+- ":asset_ruby_grpc",
+- ":asset_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-asset-v1p5beta1-ruby",
+- deps = [
+- ":asset_ruby_gapic",
+- ":asset_ruby_grpc",
+- ":asset_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "asset_csharp_proto",
+- deps = [":asset_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "asset_csharp_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_csharp_proto"],
+-)
+-
+-# Invalid C# namespaces, cannot build.
+-# csharp_gapic_library(
+-# name = "asset_csharp_gapic",
+-# srcs = [":asset_proto_with_info"],
+-# grpc_service_config = "cloudasset_grpc_service_config.json",
+-# common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+-# deps = [
+-# ":asset_csharp_grpc",
+-# ":asset_csharp_proto",
+-# ],
+-# )
+-
+-# # Open Source Packages
+-# csharp_gapic_assembly_pkg(
+-# name = "google-cloud-asset-v1p5beta1-csharp",
+-# deps = [
+-# ":asset_csharp_gapic",
+-# ":asset_csharp_grpc",
+-# ":asset_csharp_proto",
+-# ],
+-# )
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/asset/v1p7beta1/BUILD.bazel b/google/cloud/asset/v1p7beta1/BUILD.bazel
+--- a/google/cloud/asset/v1p7beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/asset/v1p7beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,328 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "asset_proto",
+- srcs = [
+- "asset_service.proto",
+- "assets.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/cloud/orgpolicy/v1:orgpolicy_proto",
+- "//google/cloud/osconfig/v1:osconfig_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/identity/accesscontextmanager/v1:accesscontextmanager_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "asset_proto_with_info",
+- deps = [
+- ":asset_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "asset_java_proto",
+- deps = [":asset_proto"],
+-)
+-
+-java_grpc_library(
+- name = "asset_java_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "asset_java_gapic",
+- srcs = [":asset_proto_with_info"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":asset_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":asset_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "asset_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.asset.v1p7beta1.AssetServiceClientTest",
+- ],
+- runtime_deps = [":asset_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-asset-v1p7beta1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":asset_java_gapic",
+- ":asset_java_grpc",
+- ":asset_java_proto",
+- ":asset_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "asset_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1p7beta1",
+- protos = [":asset_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/cloud/orgpolicy/v1:orgpolicy_go_proto",
+- "//google/cloud/osconfig/v1:osconfig_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/identity/accesscontextmanager/v1:accesscontextmanager_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "asset_go_gapic",
+- srcs = [":asset_proto_with_info"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- importpath = "cloud.google.com/go/asset/apiv1p7beta1;asset",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "cloudasset_v1p7beta1.yaml",
+- deps = [
+- ":asset_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "asset_go_gapic_test",
+- srcs = [":asset_go_gapic_srcjar_test"],
+- embed = [":asset_go_gapic"],
+- importpath = "cloud.google.com/go/asset/apiv1p7beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-asset-v1p7beta1-go",
+- deps = [
+- ":asset_go_gapic",
+- ":asset_go_gapic_srcjar-metadata.srcjar",
+- ":asset_go_gapic_srcjar-test.srcjar",
+- ":asset_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "asset_py_gapic",
+- srcs = [":asset_proto"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1376 is fixed
+-#py_test(
+-# name = "asset_py_gapic_test",
+-# srcs = [
+-# "asset_py_gapic_pytest.py",
+-# "asset_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":asset_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "asset-v1p7beta1-py",
+- deps = [
+- ":asset_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "asset_php_proto",
+- deps = [":asset_proto"],
+-)
+-
+-php_grpc_library(
+- name = "asset_php_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "asset_php_gapic",
+- srcs = [":asset_proto_with_info"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":asset_php_grpc",
+- ":asset_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-asset-v1p7beta1-php",
+- deps = [
+- ":asset_php_gapic",
+- ":asset_php_grpc",
+- ":asset_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "asset_nodejs_gapic",
+- package_name = "@google-cloud/asset",
+- src = ":asset_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudasset_grpc_service_config.json",
+- package = "google.cloud.asset.v1p7beta1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudasset_v1p7beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "asset-v1p7beta1-nodejs",
+- deps = [
+- ":asset_nodejs_gapic",
+- ":asset_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "asset_ruby_proto",
+- deps = [":asset_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "asset_ruby_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "asset_ruby_gapic",
+- srcs = [":asset_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-asset-v1p7beta1"],
+- rest_numeric_enums = False,
+- deps = [
+- ":asset_ruby_grpc",
+- ":asset_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-asset-v1p7beta1-ruby",
+- deps = [
+- ":asset_ruby_gapic",
+- ":asset_ruby_grpc",
+- ":asset_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "asset_csharp_proto",
+- deps = [":asset_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "asset_csharp_grpc",
+- srcs = [":asset_proto"],
+- deps = [":asset_csharp_proto"],
+-)
+-
+-# Invalid C# namespaces, cannot build.
+-# csharp_gapic_library(
+-# name = "asset_csharp_gapic",
+-# srcs = [":asset_proto_with_info"],
+-# common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+-# grpc_service_config = "cloudasset_grpc_service_config.json",
+-# deps = [
+-# ":asset_csharp_grpc",
+-# ":asset_csharp_proto",
+-# ],
+-# )
+-
+-# # Open Source Packages
+-# csharp_gapic_assembly_pkg(
+-# name = "google-cloud-asset-v1p7beta1-csharp",
+-# deps = [
+-# ":asset_csharp_gapic",
+-# ":asset_csharp_grpc",
+-# ":asset_csharp_proto",
+-# ],
+-# )
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/assuredworkloads/BUILD.bazel b/google/cloud/assuredworkloads/BUILD.bazel
+--- a/google/cloud/assuredworkloads/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/assuredworkloads/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-assured_workloads.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for assuredworkloads.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "assuredworkloads_ruby_wrapper",
+- srcs = ["//google/cloud/assuredworkloads/v1:assuredworkloads_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-assured_workloads",
+- "ruby-cloud-env-prefix=ASSURED_WORKLOADS",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/assured-workloads/",
+- "ruby-cloud-api-id=assuredworkloads.googleapis.com",
+- "ruby-cloud-api-shortname=assuredworkloads",
+- ],
+- ruby_cloud_description = "Assured Workloads for Government secures government workloads and accelerates the path to running compliant workloads on Google Cloud.",
+- ruby_cloud_title = "Assured Workloads for Government",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-assuredworkloads-ruby",
+- deps = [
+- ":assuredworkloads_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/assuredworkloads/regulatoryintercept/logging/v1/BUILD.bazel b/google/cloud/assuredworkloads/regulatoryintercept/logging/v1/BUILD.bazel
+--- a/google/cloud/assuredworkloads/regulatoryintercept/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/assuredworkloads/regulatoryintercept/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,173 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "regulatory_intercept_ack_log_entry.proto",
+- ],
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/assuredworkloads/regulatoryintercept/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/assuredworkloads/v1/BUILD.bazel b/google/cloud/assuredworkloads/v1/BUILD.bazel
+--- a/google/cloud/assuredworkloads/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/assuredworkloads/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,399 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "assuredworkloads_proto",
+- srcs = [
+- "assuredworkloads.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "assuredworkloads_proto_with_info",
+- deps = [
+- ":assuredworkloads_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "assuredworkloads_java_proto",
+- deps = [":assuredworkloads_proto"],
+-)
+-
+-java_grpc_library(
+- name = "assuredworkloads_java_grpc",
+- srcs = [":assuredworkloads_proto"],
+- deps = [":assuredworkloads_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "assuredworkloads_java_gapic",
+- srcs = [":assuredworkloads_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "assuredworkloads_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "assuredworkloads_v1.yaml",
+- test_deps = [
+- ":assuredworkloads_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":assuredworkloads_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "assuredworkloads_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.assuredworkloads.v1.AssuredWorkloadsServiceClientHttpJsonTest",
+- "com.google.cloud.assuredworkloads.v1.AssuredWorkloadsServiceClientTest",
+- ],
+- runtime_deps = [":assuredworkloads_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-assuredworkloads-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":assuredworkloads_java_gapic",
+- ":assuredworkloads_java_grpc",
+- ":assuredworkloads_java_proto",
+- ":assuredworkloads_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "assuredworkloads_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/assuredworkloads/v1",
+- protos = [":assuredworkloads_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "assuredworkloads_go_gapic",
+- srcs = [":assuredworkloads_proto_with_info"],
+- grpc_service_config = "assuredworkloads_grpc_service_config.json",
+- importpath = "cloud.google.com/go/assuredworkloads/apiv1;assuredworkloads",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "assuredworkloads_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":assuredworkloads_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "assuredworkloads_go_gapic_test",
+- srcs = [":assuredworkloads_go_gapic_srcjar_test"],
+- embed = [":assuredworkloads_go_gapic"],
+- importpath = "cloud.google.com/go/assuredworkloads/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-assuredworkloads-v1-go",
+- deps = [
+- ":assuredworkloads_go_gapic",
+- ":assuredworkloads_go_gapic_srcjar-metadata.srcjar",
+- ":assuredworkloads_go_gapic_srcjar-test.srcjar",
+- ":assuredworkloads_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "assuredworkloads_py_gapic",
+- srcs = [":assuredworkloads_proto"],
+- grpc_service_config = "assuredworkloads_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-assured-workloads"],
+- rest_numeric_enums = False,
+- service_yaml = "assuredworkloads_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "assuredworkloads_py_gapic_test",
+- srcs = [
+- "assuredworkloads_py_gapic_pytest.py",
+- "assuredworkloads_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":assuredworkloads_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "assuredworkloads-v1-py",
+- deps = [
+- ":assuredworkloads_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "assuredworkloads_php_proto",
+- deps = [":assuredworkloads_proto"],
+-)
+-
+-php_grpc_library(
+- name = "assuredworkloads_php_grpc",
+- srcs = [":assuredworkloads_proto"],
+- deps = [":assuredworkloads_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "assuredworkloads_php_gapic",
+- srcs = [":assuredworkloads_proto_with_info"],
+- grpc_service_config = "assuredworkloads_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "assuredworkloads_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":assuredworkloads_php_grpc",
+- ":assuredworkloads_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-assuredworkloads-v1-php",
+- deps = [
+- ":assuredworkloads_php_gapic",
+- ":assuredworkloads_php_grpc",
+- ":assuredworkloads_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "assuredworkloads_nodejs_gapic",
+- package_name = "@google-cloud/assured-workloads",
+- src = ":assuredworkloads_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "assuredworkloads_grpc_service_config.json",
+- package = "google.cloud.assuredworkloads.v1",
+- rest_numeric_enums = False,
+- service_yaml = "assuredworkloads_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "assuredworkloads-v1-nodejs",
+- deps = [
+- ":assuredworkloads_nodejs_gapic",
+- ":assuredworkloads_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "assuredworkloads_ruby_proto",
+- deps = [":assuredworkloads_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "assuredworkloads_ruby_grpc",
+- srcs = [":assuredworkloads_proto"],
+- deps = [":assuredworkloads_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "assuredworkloads_ruby_gapic",
+- srcs = [":assuredworkloads_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=assuredworkloads.googleapis.com",
+- "ruby-cloud-api-shortname=assuredworkloads",
+- "ruby-cloud-env-prefix=ASSURED_WORKLOADS",
+- "ruby-cloud-gem-name=google-cloud-assured_workloads-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/assured-workloads/",
+- ],
+- grpc_service_config = "assuredworkloads_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Assured Workloads for Government secures government workloads and accelerates the path to running compliant workloads on Google Cloud.",
+- ruby_cloud_title = "Assured Workloads for Government V1",
+- service_yaml = "assuredworkloads_v1.yaml",
+- deps = [
+- ":assuredworkloads_ruby_grpc",
+- ":assuredworkloads_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-assuredworkloads-v1-ruby",
+- deps = [
+- ":assuredworkloads_ruby_gapic",
+- ":assuredworkloads_ruby_grpc",
+- ":assuredworkloads_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "assuredworkloads_csharp_proto",
+- deps = [":assuredworkloads_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "assuredworkloads_csharp_grpc",
+- srcs = [":assuredworkloads_proto"],
+- deps = [":assuredworkloads_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "assuredworkloads_csharp_gapic",
+- srcs = [":assuredworkloads_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "assuredworkloads_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "assuredworkloads_v1.yaml",
+- deps = [
+- ":assuredworkloads_csharp_grpc",
+- ":assuredworkloads_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-assuredworkloads-v1-csharp",
+- deps = [
+- ":assuredworkloads_csharp_gapic",
+- ":assuredworkloads_csharp_grpc",
+- ":assuredworkloads_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "assuredworkloads_cc_proto",
+- deps = [":assuredworkloads_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "assuredworkloads_cc_grpc",
+- srcs = [":assuredworkloads_proto"],
+- grpc_only = True,
+- deps = [":assuredworkloads_cc_proto"],
+-)
+diff -urN a/google/cloud/assuredworkloads/v1beta1/BUILD.bazel b/google/cloud/assuredworkloads/v1beta1/BUILD.bazel
+--- a/google/cloud/assuredworkloads/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/assuredworkloads/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,398 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "assuredworkloads_proto",
+- srcs = [
+- "assuredworkloads.proto",
+- "assuredworkloads_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "assuredworkloads_proto_with_info",
+- deps = [
+- ":assuredworkloads_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "assuredworkloads_java_proto",
+- deps = [":assuredworkloads_proto"],
+-)
+-
+-java_grpc_library(
+- name = "assuredworkloads_java_grpc",
+- srcs = [":assuredworkloads_proto"],
+- deps = [":assuredworkloads_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "assuredworkloads_java_gapic",
+- srcs = [":assuredworkloads_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "assuredworkloads_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "assuredworkloads_v1beta1.yaml",
+- test_deps = [
+- ":assuredworkloads_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":assuredworkloads_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "assuredworkloads_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.assuredworkloads.v1beta1.AssuredWorkloadsServiceClientHttpJsonTest",
+- "com.google.cloud.assuredworkloads.v1beta1.AssuredWorkloadsServiceClientTest",
+- ],
+- runtime_deps = [":assuredworkloads_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-assuredworkloads-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":assuredworkloads_java_gapic",
+- ":assuredworkloads_java_grpc",
+- ":assuredworkloads_java_proto",
+- ":assuredworkloads_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "assuredworkloads_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/assuredworkloads/v1beta1",
+- protos = [":assuredworkloads_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "assuredworkloads_go_gapic",
+- srcs = [":assuredworkloads_proto_with_info"],
+- grpc_service_config = "assuredworkloads_grpc_service_config.json",
+- importpath = "cloud.google.com/go/assuredworkloads/apiv1beta1;assuredworkloads",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "assuredworkloads_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":assuredworkloads_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "assuredworkloads_go_gapic_test",
+- srcs = [":assuredworkloads_go_gapic_srcjar_test"],
+- embed = [":assuredworkloads_go_gapic"],
+- importpath = "cloud.google.com/go/assuredworkloads/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-assuredworkloads-v1beta1-go",
+- deps = [
+- ":assuredworkloads_go_gapic",
+- ":assuredworkloads_go_gapic_srcjar-metadata.srcjar",
+- ":assuredworkloads_go_gapic_srcjar-test.srcjar",
+- ":assuredworkloads_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "assuredworkloads_py_gapic",
+- srcs = [":assuredworkloads_proto"],
+- grpc_service_config = "assuredworkloads_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-assured-workloads"],
+- rest_numeric_enums = False,
+- service_yaml = "assuredworkloads_v1beta1.yaml",
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "assuredworkloads_py_gapic_test",
+- srcs = [
+- "assuredworkloads_py_gapic_pytest.py",
+- "assuredworkloads_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":assuredworkloads_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "assuredworkloads-v1beta1-py",
+- deps = [
+- ":assuredworkloads_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "assuredworkloads_php_proto",
+- deps = [":assuredworkloads_proto"],
+-)
+-
+-php_grpc_library(
+- name = "assuredworkloads_php_grpc",
+- srcs = [":assuredworkloads_proto"],
+- deps = [":assuredworkloads_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "assuredworkloads_php_gapic",
+- srcs = [":assuredworkloads_proto_with_info"],
+- grpc_service_config = "assuredworkloads_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "assuredworkloads_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":assuredworkloads_php_grpc",
+- ":assuredworkloads_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-assuredworkloads-v1beta1-php",
+- deps = [
+- ":assuredworkloads_php_gapic",
+- ":assuredworkloads_php_grpc",
+- ":assuredworkloads_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "assuredworkloads_nodejs_gapic",
+- package_name = "@google-cloud/assured-workloads",
+- src = ":assuredworkloads_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "assuredworkloads_grpc_service_config.json",
+- package = "google.cloud.assuredworkloads.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "assuredworkloads_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "assuredworkloads-v1beta1-nodejs",
+- deps = [
+- ":assuredworkloads_nodejs_gapic",
+- ":assuredworkloads_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "assuredworkloads_ruby_proto",
+- deps = [":assuredworkloads_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "assuredworkloads_ruby_grpc",
+- srcs = [":assuredworkloads_proto"],
+- deps = [":assuredworkloads_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "assuredworkloads_ruby_gapic",
+- srcs = [":assuredworkloads_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=assuredworkloads.googleapis.com",
+- "ruby-cloud-api-shortname=assuredworkloads",
+- "ruby-cloud-env-prefix=ASSURED_WORKLOADS",
+- "ruby-cloud-gem-name=google-cloud-assured_workloads-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/assured-workloads/",
+- ],
+- grpc_service_config = "assuredworkloads_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Assured Workloads for Government secures government workloads and accelerates the path to running compliant workloads on Google Cloud.",
+- ruby_cloud_title = "Assured Workloads for Government V1beta1",
+- service_yaml = "assuredworkloads_v1beta1.yaml",
+- deps = [
+- ":assuredworkloads_ruby_grpc",
+- ":assuredworkloads_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-assuredworkloads-v1beta1-ruby",
+- deps = [
+- ":assuredworkloads_ruby_gapic",
+- ":assuredworkloads_ruby_grpc",
+- ":assuredworkloads_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "assuredworkloads_csharp_proto",
+- deps = [":assuredworkloads_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "assuredworkloads_csharp_grpc",
+- srcs = [":assuredworkloads_proto"],
+- deps = [":assuredworkloads_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "assuredworkloads_csharp_gapic",
+- srcs = [":assuredworkloads_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "assuredworkloads_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "assuredworkloads_v1beta1.yaml",
+- deps = [
+- ":assuredworkloads_csharp_grpc",
+- ":assuredworkloads_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-assuredworkloads-v1beta1-csharp",
+- deps = [
+- ":assuredworkloads_csharp_gapic",
+- ":assuredworkloads_csharp_grpc",
+- ":assuredworkloads_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "assuredworkloads_cc_proto",
+- deps = [":assuredworkloads_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "assuredworkloads_cc_grpc",
+- srcs = [":assuredworkloads_proto"],
+- grpc_only = True,
+- deps = [":assuredworkloads_cc_proto"],
+-)
+diff -urN a/google/cloud/audit/BUILD.bazel b/google/cloud/audit/BUILD.bazel
+--- a/google/cloud/audit/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/audit/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,237 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "audit_proto",
+- srcs = [
+- "audit_log.proto",
+- "bigquery_audit_metadata.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/rpc:status_proto",
+- "//google/rpc/context:attribute_context_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "audit_proto_with_info",
+- deps = [
+- ":audit_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "audit_java_proto",
+- deps = [":audit_proto"],
+-)
+-
+-java_grpc_library(
+- name = "audit_java_grpc",
+- srcs = [":audit_proto"],
+- deps = [":audit_java_proto"],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-audit-java",
+- transport = "grpc+rest",
+- deps = [
+- ":audit_java_grpc",
+- ":audit_java_proto",
+- ":audit_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "audit_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/audit",
+- protos = [":audit_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/rpc/context:attribute_context_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "audit_moved_proto",
+- srcs = [":audit_proto"],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/rpc:status_proto",
+- "//google/rpc/context:attribute_context_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "audit_py_proto",
+- deps = [":audit_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "audit_py_grpc",
+- srcs = [":audit_moved_proto"],
+- deps = [":audit_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "audit_php_proto",
+- deps = [":audit_proto"],
+-)
+-
+-php_grpc_library(
+- name = "audit_php_grpc",
+- srcs = [":audit_proto"],
+- deps = [":audit_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "audit_ruby_proto",
+- deps = [":audit_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "audit_ruby_grpc",
+- srcs = [":audit_proto"],
+- deps = [":audit_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "audit_csharp_proto",
+- deps = [":audit_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "audit_csharp_grpc",
+- srcs = [":audit_proto"],
+- deps = [":audit_csharp_proto"],
+-)
+-
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-audit-csharp",
+- package_name = "Google.Cloud.Audit",
+- generate_nongapic_package = True,
+- deps = [
+- ":audit_csharp_grpc",
+- ":audit_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "audit_cc_proto",
+- deps = [":audit_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "audit_cc_grpc",
+- srcs = [":audit_proto"],
+- grpc_only = True,
+- deps = [":audit_cc_proto"],
+-)
+diff -urN a/google/cloud/automl/BUILD.bazel b/google/cloud/automl/BUILD.bazel
+--- a/google/cloud/automl/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/automl/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,44 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-automl.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for automl.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "automl_ruby_wrapper",
+- srcs = ["//google/cloud/automl/v1:automl_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-automl",
+- "ruby-cloud-gem-namespace=Google::Cloud::AutoML",
+- "ruby-cloud-env-prefix=AUTOML",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/automl",
+- "ruby-cloud-api-id=automl.googleapis.com",
+- "ruby-cloud-api-shortname=automl",
+- "ruby-cloud-migration-version=1.0",
+- "ruby-cloud-path-override=auto_ml=automl",
+- "ruby-cloud-namespace-override=AutoMl=AutoML",
+- ],
+- ruby_cloud_description = "AutoML makes the power of machine learning available to you even if you have limited knowledge of machine learning. You can use AutoML to build on Google's machine learning capabilities to create your own custom machine learning models that are tailored to your business needs, and then integrate those models into your applications and web sites.",
+- ruby_cloud_title = "Cloud AutoML",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-automl-ruby",
+- deps = [
+- ":automl_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/automl/v1/BUILD.bazel b/google/cloud/automl/v1/BUILD.bazel
+--- a/google/cloud/automl/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/automl/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,410 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "automl_proto",
+- srcs = [
+- "annotation_payload.proto",
+- "annotation_spec.proto",
+- "classification.proto",
+- "data_items.proto",
+- "dataset.proto",
+- "detection.proto",
+- "geometry.proto",
+- "image.proto",
+- "io.proto",
+- "model.proto",
+- "model_evaluation.proto",
+- "operations.proto",
+- "prediction_service.proto",
+- "service.proto",
+- "text.proto",
+- "text_extraction.proto",
+- "text_segment.proto",
+- "text_sentiment.proto",
+- "translation.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "automl_proto_with_info",
+- deps = [
+- ":automl_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "automl_java_proto",
+- deps = [":automl_proto"],
+-)
+-
+-java_grpc_library(
+- name = "automl_java_grpc",
+- srcs = [":automl_proto"],
+- deps = [":automl_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "automl_java_gapic",
+- srcs = [":automl_proto_with_info"],
+- grpc_service_config = "automl_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":automl_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":automl_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "automl_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.automl.v1.AutoMlClientHttpJsonTest",
+- "com.google.cloud.automl.v1.AutoMlClientTest",
+- "com.google.cloud.automl.v1.PredictionServiceClientHttpJsonTest",
+- "com.google.cloud.automl.v1.PredictionServiceClientTest",
+- ],
+- runtime_deps = [":automl_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-automl-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":automl_java_gapic",
+- ":automl_java_grpc",
+- ":automl_java_proto",
+- ":automl_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "automl_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/automl/v1",
+- protos = [":automl_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "automl_go_gapic",
+- srcs = [":automl_proto_with_info"],
+- grpc_service_config = "automl_grpc_service_config.json",
+- importpath = "cloud.google.com/go/automl/apiv1;automl",
+- rest_numeric_enums = False,
+- service_yaml = "automl_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":automl_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "automl_go_gapic_test",
+- srcs = [":automl_go_gapic_srcjar_test"],
+- embed = [":automl_go_gapic"],
+- importpath = "cloud.google.com/go/automl/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-automl-v1-go",
+- deps = [
+- ":automl_go_gapic",
+- ":automl_go_gapic_srcjar-test.srcjar",
+- ":automl_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "automl_py_gapic",
+- srcs = [":automl_proto"],
+- grpc_service_config = "automl_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "automl_py_gapic_test",
+- srcs = [
+- "automl_py_gapic_pytest.py",
+- "automl_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":automl_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "automl-v1-py",
+- deps = [
+- ":automl_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "automl_php_proto",
+- deps = [":automl_proto"],
+-)
+-
+-php_grpc_library(
+- name = "automl_php_grpc",
+- srcs = [":automl_proto"],
+- deps = [":automl_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "automl_php_gapic",
+- srcs = [":automl_proto_with_info"],
+- grpc_service_config = "automl_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "automl_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":automl_php_grpc",
+- ":automl_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-automl-v1-php",
+- deps = [
+- ":automl_php_gapic",
+- ":automl_php_grpc",
+- ":automl_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "automl_nodejs_gapic",
+- package_name = "@google-cloud/automl",
+- src = ":automl_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "automl_grpc_service_config.json",
+- main_service = "automl",
+- package = "google.cloud.automl.v1",
+- rest_numeric_enums = False,
+- service_yaml = "automl_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "automl-v1-nodejs",
+- deps = [
+- ":automl_nodejs_gapic",
+- ":automl_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "automl_ruby_proto",
+- deps = [":automl_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "automl_ruby_grpc",
+- srcs = [":automl_proto"],
+- deps = [":automl_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "automl_ruby_gapic",
+- srcs = [":automl_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-automl-v1",
+- "ruby-cloud-env-prefix=AUTOML",
+- "ruby-cloud-path-override=auto_ml=automl",
+- "ruby-cloud-namespace-override=AutoMl=AutoML;Automl=AutoML",
+- "ruby-cloud-yard-strict=false",
+- "ruby-cloud-product-url=https://cloud.google.com/automl",
+- "ruby-cloud-api-id=automl.googleapis.com",
+- "ruby-cloud-api-shortname=automl",
+- ],
+- grpc_service_config = "automl_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "AutoML makes the power of machine learning available to you even if you have limited knowledge of machine learning. You can use AutoML to build on Google's machine learning capabilities to create your own custom machine learning models that are tailored to your business needs, and then integrate those models into your applications and web sites.",
+- ruby_cloud_title = "Cloud AutoML V1",
+- deps = [
+- ":automl_ruby_grpc",
+- ":automl_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-automl-v1-ruby",
+- deps = [
+- ":automl_ruby_gapic",
+- ":automl_ruby_grpc",
+- ":automl_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "automl_csharp_proto",
+- deps = [":automl_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "automl_csharp_grpc",
+- srcs = [":automl_proto"],
+- deps = [":automl_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "automl_csharp_gapic",
+- srcs = [":automl_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "automl_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "automl_v1.yaml",
+- deps = [
+- ":automl_csharp_grpc",
+- ":automl_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-automl-v1-csharp",
+- deps = [
+- ":automl_csharp_gapic",
+- ":automl_csharp_grpc",
+- ":automl_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "automl_cc_proto",
+- deps = [":automl_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "automl_cc_grpc",
+- srcs = [":automl_proto"],
+- grpc_only = True,
+- deps = [":automl_cc_proto"],
+-)
+diff -urN a/google/cloud/automl/v1beta1/BUILD.bazel b/google/cloud/automl/v1beta1/BUILD.bazel
+--- a/google/cloud/automl/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/automl/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,402 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "automl_proto",
+- srcs = [
+- "annotation_payload.proto",
+- "annotation_spec.proto",
+- "classification.proto",
+- "column_spec.proto",
+- "data_items.proto",
+- "data_stats.proto",
+- "data_types.proto",
+- "dataset.proto",
+- "detection.proto",
+- "geometry.proto",
+- "image.proto",
+- "io.proto",
+- "model.proto",
+- "model_evaluation.proto",
+- "operations.proto",
+- "prediction_service.proto",
+- "ranges.proto",
+- "regression.proto",
+- "service.proto",
+- "table_spec.proto",
+- "tables.proto",
+- "temporal.proto",
+- "text.proto",
+- "text_extraction.proto",
+- "text_segment.proto",
+- "text_sentiment.proto",
+- "translation.proto",
+- "video.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "automl_proto_with_info",
+- deps = [
+- ":automl_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "automl_java_proto",
+- deps = [":automl_proto"],
+-)
+-
+-java_grpc_library(
+- name = "automl_java_grpc",
+- srcs = [":automl_proto"],
+- deps = [":automl_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "automl_java_gapic",
+- srcs = [":automl_proto_with_info"],
+- grpc_service_config = "automl_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":automl_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":automl_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "automl_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.automl.v1beta1.AutoMlClientHttpJsonTest",
+- "com.google.cloud.automl.v1beta1.AutoMlClientTest",
+- "com.google.cloud.automl.v1beta1.PredictionServiceClientHttpJsonTest",
+- "com.google.cloud.automl.v1beta1.PredictionServiceClientTest",
+- ],
+- runtime_deps = [":automl_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-automl-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":automl_java_gapic",
+- ":automl_java_grpc",
+- ":automl_java_proto",
+- ":automl_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "automl_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/automl/v1beta1",
+- protos = [":automl_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "automl_go_gapic",
+- srcs = [":automl_proto_with_info"],
+- grpc_service_config = "automl_grpc_service_config.json",
+- importpath = "cloud.google.com/go/automl/apiv1beta1;automl",
+- rest_numeric_enums = False,
+- service_yaml = "automl_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":automl_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "automl_go_gapic_test",
+- srcs = [":automl_go_gapic_srcjar_test"],
+- embed = [":automl_go_gapic"],
+- importpath = "cloud.google.com/go/automl/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-automl-v1beta1-go",
+- deps = [
+- ":automl_go_gapic",
+- ":automl_go_gapic_srcjar-test.srcjar",
+- ":automl_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "automl_py_gapic",
+- srcs = [":automl_proto"],
+- grpc_service_config = "automl_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "automl_py_gapic_test",
+- srcs = [
+- "automl_py_gapic_pytest.py",
+- "automl_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":automl_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "automl-v1beta1-py",
+- deps = [
+- ":automl_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "automl_php_proto",
+- deps = [":automl_proto"],
+-)
+-
+-php_grpc_library(
+- name = "automl_php_grpc",
+- srcs = [":automl_proto"],
+- deps = [":automl_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "automl_php_gapic",
+- srcs = [":automl_proto_with_info"],
+- grpc_service_config = "automl_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "automl_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":automl_php_grpc",
+- ":automl_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-automl-v1beta1-php",
+- deps = [
+- ":automl_php_gapic",
+- ":automl_php_grpc",
+- ":automl_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "automl_nodejs_gapic",
+- package_name = "@google-cloud/automl",
+- src = ":automl_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "automl_grpc_service_config.json",
+- main_service = "automl",
+- package = "google.cloud.automl.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "automl_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "automl-v1beta1-nodejs",
+- deps = [
+- ":automl_nodejs_gapic",
+- ":automl_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "automl_ruby_proto",
+- deps = [":automl_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "automl_ruby_grpc",
+- srcs = [":automl_proto"],
+- deps = [":automl_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "automl_ruby_gapic",
+- srcs = [":automl_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-automl-v1beta1",
+- "ruby-cloud-env-prefix=AUTOML",
+- "ruby-cloud-path-override=auto_ml=automl",
+- "ruby-cloud-namespace-override=AutoMl=AutoML;Automl=AutoML",
+- "ruby-cloud-product-url=https://cloud.google.com/automl",
+- "ruby-cloud-api-id=automl.googleapis.com",
+- "ruby-cloud-api-shortname=automl",
+- ],
+- grpc_service_config = "automl_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "AutoML makes the power of machine learning available to you even if you have limited knowledge of machine learning. You can use AutoML to build on Google's machine learning capabilities to create your own custom machine learning models that are tailored to your business needs, and then integrate those models into your applications and web sites.",
+- ruby_cloud_title = "Cloud AutoML V1beta1",
+- deps = [
+- ":automl_ruby_grpc",
+- ":automl_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-automl-v1beta1-ruby",
+- deps = [
+- ":automl_ruby_gapic",
+- ":automl_ruby_grpc",
+- ":automl_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "automl_csharp_proto",
+- deps = [":automl_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "automl_csharp_grpc",
+- srcs = [":automl_proto"],
+- deps = [":automl_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "automl_csharp_gapic",
+- srcs = [":automl_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "automl_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "automl_v1beta1.yaml",
+- deps = [
+- ":automl_csharp_grpc",
+- ":automl_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-automl-v1beta1-csharp",
+- deps = [
+- ":automl_csharp_gapic",
+- ":automl_csharp_grpc",
+- ":automl_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/backupdr/logging/v1/BUILD.bazel b/google/cloud/backupdr/logging/v1/BUILD.bazel
+--- a/google/cloud/backupdr/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/backupdr/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,177 +0,0 @@
+-# TODO(pandeydeeksha): describe this package.
+-
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "eventlog.proto",
+- ],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/backupdr/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- ],
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/baremetalsolution/BUILD.bazel b/google/cloud/baremetalsolution/BUILD.bazel
+--- a/google/cloud/baremetalsolution/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/baremetalsolution/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-bare_metal_solution.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for baremetalsolution.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v2 in this case.
+-ruby_cloud_gapic_library(
+- name = "baremetalsolution_ruby_wrapper",
+- srcs = ["//google/cloud/baremetalsolution/v2:baremetalsolution_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=baremetalsolution.googleapis.com",
+- "ruby-cloud-api-shortname=baremetalsolution",
+- "ruby-cloud-gem-name=google-cloud-bare_metal_solution",
+- "ruby-cloud-product-url=https://cloud.google.com/bare-metal/",
+- "ruby-cloud-wrapper-of=v2:0.0",
+- ],
+- ruby_cloud_description = "Bare Metal Solution is a managed solution that provides purpose-built HPE or Atos bare-metal servers in regional extensions that are connected to Google Cloud by a managed, high-performance connection with a low-latency network fabric.",
+- ruby_cloud_title = "Bare Metal Solution",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-baremetalsolution-ruby",
+- deps = [
+- ":baremetalsolution_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/baremetalsolution/v2/BUILD.bazel b/google/cloud/baremetalsolution/v2/BUILD.bazel
+--- a/google/cloud/baremetalsolution/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/baremetalsolution/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,403 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "baremetalsolution_proto",
+- srcs = [
+- "baremetalsolution.proto",
+- "instance.proto",
+- "lun.proto",
+- "network.proto",
+- "nfs_share.proto",
+- "volume.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "baremetalsolution_proto_with_info",
+- deps = [
+- ":baremetalsolution_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "baremetalsolution_java_proto",
+- deps = [":baremetalsolution_proto"],
+-)
+-
+-java_grpc_library(
+- name = "baremetalsolution_java_grpc",
+- srcs = [":baremetalsolution_proto"],
+- deps = [":baremetalsolution_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "baremetalsolution_java_gapic",
+- srcs = [":baremetalsolution_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "baremetalsolution_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "baremetalsolution_v2.yaml",
+- test_deps = [
+- ":baremetalsolution_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":baremetalsolution_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "baremetalsolution_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.baremetalsolution.v2.BareMetalSolutionClientHttpJsonTest",
+- "com.google.cloud.baremetalsolution.v2.BareMetalSolutionClientTest",
+- ],
+- runtime_deps = [":baremetalsolution_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-baremetalsolution-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":baremetalsolution_java_gapic",
+- ":baremetalsolution_java_grpc",
+- ":baremetalsolution_java_proto",
+- ":baremetalsolution_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "baremetalsolution_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/baremetalsolution/v2",
+- protos = [":baremetalsolution_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "baremetalsolution_go_gapic",
+- srcs = [":baremetalsolution_proto_with_info"],
+- grpc_service_config = "baremetalsolution_grpc_service_config.json",
+- importpath = "cloud.google.com/go/baremetalsolution/apiv2;baremetalsolution",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "baremetalsolution_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":baremetalsolution_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "baremetalsolution_go_gapic_test",
+- srcs = [":baremetalsolution_go_gapic_srcjar_test"],
+- embed = [":baremetalsolution_go_gapic"],
+- importpath = "cloud.google.com/go/baremetalsolution/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-baremetalsolution-v2-go",
+- deps = [
+- ":baremetalsolution_go_gapic",
+- ":baremetalsolution_go_gapic_srcjar-metadata.srcjar",
+- ":baremetalsolution_go_gapic_srcjar-test.srcjar",
+- ":baremetalsolution_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "baremetalsolution_py_gapic",
+- srcs = [":baremetalsolution_proto"],
+- grpc_service_config = "baremetalsolution_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-bare-metal-solution",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=bare_metal_solution",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "baremetalsolution_py_gapic_test",
+- srcs = [
+- "baremetalsolution_py_gapic_pytest.py",
+- "baremetalsolution_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":baremetalsolution_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "baremetalsolution-v2-py",
+- deps = [
+- ":baremetalsolution_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "baremetalsolution_php_proto",
+- deps = [":baremetalsolution_proto"],
+-)
+-
+-php_grpc_library(
+- name = "baremetalsolution_php_grpc",
+- srcs = [":baremetalsolution_proto"],
+- deps = [":baremetalsolution_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "baremetalsolution_php_gapic",
+- srcs = [":baremetalsolution_proto_with_info"],
+- grpc_service_config = "baremetalsolution_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "baremetalsolution_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":baremetalsolution_php_grpc",
+- ":baremetalsolution_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-baremetalsolution-v2-php",
+- deps = [
+- ":baremetalsolution_php_gapic",
+- ":baremetalsolution_php_grpc",
+- ":baremetalsolution_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "baremetalsolution_nodejs_gapic",
+- package_name = "@google-cloud/bare-metal-solution",
+- src = ":baremetalsolution_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "baremetalsolution_grpc_service_config.json",
+- package = "google.cloud.baremetalsolution.v2",
+- rest_numeric_enums = False,
+- service_yaml = "baremetalsolution_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "baremetalsolution-v2-nodejs",
+- deps = [
+- ":baremetalsolution_nodejs_gapic",
+- ":baremetalsolution_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "baremetalsolution_ruby_proto",
+- deps = [":baremetalsolution_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "baremetalsolution_ruby_grpc",
+- srcs = [":baremetalsolution_proto"],
+- deps = [":baremetalsolution_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "baremetalsolution_ruby_gapic",
+- srcs = [":baremetalsolution_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=baremetalsolution.googleapis.com",
+- "ruby-cloud-api-shortname=baremetalsolution",
+- "ruby-cloud-gem-name=google-cloud-bare_metal_solution-v2",
+- "ruby-cloud-product-url=https://cloud.google.com/bare-metal/",
+- ],
+- grpc_service_config = "baremetalsolution_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Bare Metal Solution is a managed solution that provides purpose-built HPE or Atos bare-metal servers in regional extensions that are connected to Google Cloud by a managed, high-performance connection with a low-latency network fabric.",
+- ruby_cloud_title = "Bare Metal Solution V2",
+- service_yaml = "baremetalsolution_v2.yaml",
+- deps = [
+- ":baremetalsolution_ruby_grpc",
+- ":baremetalsolution_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-baremetalsolution-v2-ruby",
+- deps = [
+- ":baremetalsolution_ruby_gapic",
+- ":baremetalsolution_ruby_grpc",
+- ":baremetalsolution_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "baremetalsolution_csharp_proto",
+- deps = [":baremetalsolution_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "baremetalsolution_csharp_grpc",
+- srcs = [":baremetalsolution_proto"],
+- deps = [":baremetalsolution_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "baremetalsolution_csharp_gapic",
+- srcs = [":baremetalsolution_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "baremetalsolution_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "baremetalsolution_v2.yaml",
+- deps = [
+- ":baremetalsolution_csharp_grpc",
+- ":baremetalsolution_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-baremetalsolution-v2-csharp",
+- deps = [
+- ":baremetalsolution_csharp_gapic",
+- ":baremetalsolution_csharp_grpc",
+- ":baremetalsolution_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "baremetalsolution_cc_proto",
+- deps = [":baremetalsolution_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "baremetalsolution_cc_grpc",
+- srcs = [":baremetalsolution_proto"],
+- grpc_only = True,
+- deps = [":baremetalsolution_cc_proto"],
+-)
+diff -urN a/google/cloud/batch/BUILD.bazel b/google/cloud/batch/BUILD.bazel
+--- a/google/cloud/batch/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/batch/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,38 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-batch.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for batch.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "batch_ruby_wrapper",
+- srcs = ["//google/cloud/batch/v1:batch_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=batch.googleapis.com",
+- "ruby-cloud-api-shortname=batch",
+- "ruby-cloud-gem-name=google-cloud-batch",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- ],
+- ruby_cloud_description = "Google Cloud Batch is a fully managed service used by scientists, VFX artists, developers to easily and efficiently run batch workloads on Google Cloud. This service manages provisioning of resources to satisfy the requirements of the batch jobs for a variety of workloads including ML, HPC, VFX rendering, transcoding, genomics and others.",
+- ruby_cloud_title = "Batch",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-batch-ruby",
+- deps = [
+- ":batch_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/batch/v1/BUILD.bazel b/google/cloud/batch/v1/BUILD.bazel
+--- a/google/cloud/batch/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/batch/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,406 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "batch_proto",
+- srcs = [
+- "batch.proto",
+- "job.proto",
+- "task.proto",
+- "volume.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "batch_proto_with_info",
+- deps = [
+- ":batch_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "batch_java_proto",
+- deps = [":batch_proto"],
+-)
+-
+-java_grpc_library(
+- name = "batch_java_grpc",
+- srcs = [":batch_proto"],
+- deps = [":batch_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "batch_java_gapic",
+- srcs = [":batch_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "batch_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "batch_v1.yaml",
+- test_deps = [
+- ":batch_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":batch_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "batch_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.batch.v1.BatchServiceClientHttpJsonTest",
+- "com.google.cloud.batch.v1.BatchServiceClientTest",
+- ],
+- runtime_deps = [":batch_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-batch-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":batch_java_gapic",
+- ":batch_java_grpc",
+- ":batch_java_proto",
+- ":batch_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "batch_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/batch/v1",
+- protos = [":batch_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "batch_go_gapic",
+- srcs = [":batch_proto_with_info"],
+- grpc_service_config = "batch_v1_grpc_service_config.json",
+- importpath = "cloud.google.com/go/batch/apiv1;batch",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "batch_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":batch_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "batch_go_gapic_test",
+- srcs = [":batch_go_gapic_srcjar_test"],
+- embed = [":batch_go_gapic"],
+- importpath = "cloud.google.com/go/batch/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-batch-v1-go",
+- deps = [
+- ":batch_go_gapic",
+- ":batch_go_gapic_srcjar-metadata.srcjar",
+- ":batch_go_gapic_srcjar-test.srcjar",
+- ":batch_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "batch_py_gapic",
+- srcs = [":batch_proto"],
+- grpc_service_config = "batch_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "batch_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "batch_py_gapic_test",
+- srcs = [
+- "batch_py_gapic_pytest.py",
+- "batch_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":batch_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "batch-v1-py",
+- deps = [
+- ":batch_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "batch_php_proto",
+- deps = [":batch_proto"],
+-)
+-
+-php_grpc_library(
+- name = "batch_php_grpc",
+- srcs = [":batch_proto"],
+- deps = [":batch_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "batch_php_gapic",
+- srcs = [":batch_proto_with_info"],
+- grpc_service_config = "batch_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "batch_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":batch_php_grpc",
+- ":batch_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-batch-v1-php",
+- deps = [
+- ":batch_php_gapic",
+- ":batch_php_grpc",
+- ":batch_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "batch_nodejs_gapic",
+- package_name = "@google-cloud/batch",
+- src = ":batch_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "batch_v1_grpc_service_config.json",
+- package = "google.cloud.batch.v1",
+- rest_numeric_enums = False,
+- service_yaml = "batch_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "batch-v1-nodejs",
+- deps = [
+- ":batch_nodejs_gapic",
+- ":batch_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "batch_ruby_proto",
+- deps = [":batch_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "batch_ruby_grpc",
+- srcs = [":batch_proto"],
+- deps = [":batch_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "batch_ruby_gapic",
+- srcs = [":batch_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=batch.googleapis.com",
+- "ruby-cloud-api-shortname=batch",
+- "ruby-cloud-gem-name=google-cloud-batch-v1",
+- ],
+- grpc_service_config = "batch_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Google Cloud Batch is a fully managed service used by scientists, VFX artists, developers to easily and efficiently run batch workloads on Google Cloud. This service manages provisioning of resources to satisfy the requirements of the batch jobs for a variety of workloads including ML, HPC, VFX rendering, transcoding, genomics and others.",
+- ruby_cloud_title = "Batch V1",
+- service_yaml = "batch_v1.yaml",
+- deps = [
+- ":batch_ruby_grpc",
+- ":batch_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-batch-v1-ruby",
+- deps = [
+- ":batch_ruby_gapic",
+- ":batch_ruby_grpc",
+- ":batch_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "batch_csharp_proto",
+- deps = [":batch_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "batch_csharp_grpc",
+- srcs = [":batch_proto"],
+- deps = [":batch_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "batch_csharp_gapic",
+- srcs = [":batch_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "batch_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "batch_v1.yaml",
+- deps = [
+- ":batch_csharp_grpc",
+- ":batch_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-batch-v1-csharp",
+- deps = [
+- ":batch_csharp_gapic",
+- ":batch_csharp_grpc",
+- ":batch_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "batch_cc_proto",
+- deps = [":batch_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "batch_cc_grpc",
+- srcs = [":batch_proto"],
+- grpc_only = True,
+- deps = [":batch_cc_proto"],
+-)
+diff -urN a/google/cloud/batch/v1alpha/BUILD.bazel b/google/cloud/batch/v1alpha/BUILD.bazel
+--- a/google/cloud/batch/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/batch/v1alpha/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,406 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "batch_proto",
+- srcs = [
+- "batch.proto",
+- "job.proto",
+- "task.proto",
+- "volume.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "batch_proto_with_info",
+- deps = [
+- ":batch_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "batch_java_proto",
+- deps = [":batch_proto"],
+-)
+-
+-java_grpc_library(
+- name = "batch_java_grpc",
+- srcs = [":batch_proto"],
+- deps = [":batch_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "batch_java_gapic",
+- srcs = [":batch_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "batch_v1alpha_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "batch_v1alpha.yaml",
+- test_deps = [
+- ":batch_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":batch_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "batch_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.batch.v1alpha.BatchServiceClientHttpJsonTest",
+- "com.google.cloud.batch.v1alpha.BatchServiceClientTest",
+- ],
+- runtime_deps = [":batch_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-batch-v1alpha-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":batch_java_gapic",
+- ":batch_java_grpc",
+- ":batch_java_proto",
+- ":batch_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "batch_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/batch/v1alpha",
+- protos = [":batch_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "batch_go_gapic",
+- srcs = [":batch_proto_with_info"],
+- grpc_service_config = "batch_v1alpha_grpc_service_config.json",
+- importpath = "cloud.google.com/go/batch/apiv1alpha;batch",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "batch_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":batch_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "batch_go_gapic_test",
+- srcs = [":batch_go_gapic_srcjar_test"],
+- embed = [":batch_go_gapic"],
+- importpath = "cloud.google.com/go/batch/apiv1alpha",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-batch-v1alpha-go",
+- deps = [
+- ":batch_go_gapic",
+- ":batch_go_gapic_srcjar-metadata.srcjar",
+- ":batch_go_gapic_srcjar-test.srcjar",
+- ":batch_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "batch_py_gapic",
+- srcs = [":batch_proto"],
+- grpc_service_config = "batch_v1alpha_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "batch_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "batch_py_gapic_test",
+- srcs = [
+- "batch_py_gapic_pytest.py",
+- "batch_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":batch_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "batch-v1alpha-py",
+- deps = [
+- ":batch_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "batch_php_proto",
+- deps = [":batch_proto"],
+-)
+-
+-php_grpc_library(
+- name = "batch_php_grpc",
+- srcs = [":batch_proto"],
+- deps = [":batch_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "batch_php_gapic",
+- srcs = [":batch_proto_with_info"],
+- grpc_service_config = "batch_v1alpha_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "batch_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":batch_php_grpc",
+- ":batch_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-batch-v1alpha-php",
+- deps = [
+- ":batch_php_gapic",
+- ":batch_php_grpc",
+- ":batch_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "batch_nodejs_gapic",
+- package_name = "@google-cloud/batch",
+- src = ":batch_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "batch_v1alpha_grpc_service_config.json",
+- package = "google.cloud.batch.v1alpha",
+- rest_numeric_enums = False,
+- service_yaml = "batch_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "batch-v1alpha-nodejs",
+- deps = [
+- ":batch_nodejs_gapic",
+- ":batch_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "batch_ruby_proto",
+- deps = [":batch_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "batch_ruby_grpc",
+- srcs = [":batch_proto"],
+- deps = [":batch_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "batch_ruby_gapic",
+- srcs = [":batch_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=batch.googleapis.com",
+- "ruby-cloud-api-shortname=batch",
+- "ruby-cloud-gem-name=google-cloud-batch-v1alpha",
+- ],
+- grpc_service_config = "batch_v1alpha_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Google Cloud Batch is a fully managed service used by scientists, VFX artists, developers to easily and efficiently run batch workloads on Google Cloud. This service manages provisioning of resources to satisfy the requirements of the batch jobs for a variety of workloads including ML, HPC, VFX rendering, transcoding, genomics and others.",
+- ruby_cloud_title = "Batch V1alpha",
+- service_yaml = "batch_v1alpha.yaml",
+- deps = [
+- ":batch_ruby_grpc",
+- ":batch_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-batch-v1alpha-ruby",
+- deps = [
+- ":batch_ruby_gapic",
+- ":batch_ruby_grpc",
+- ":batch_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "batch_csharp_proto",
+- deps = [":batch_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "batch_csharp_grpc",
+- srcs = [":batch_proto"],
+- deps = [":batch_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "batch_csharp_gapic",
+- srcs = [":batch_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "batch_v1alpha_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "batch_v1alpha.yaml",
+- deps = [
+- ":batch_csharp_grpc",
+- ":batch_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-batch-v1alpha-csharp",
+- deps = [
+- ":batch_csharp_gapic",
+- ":batch_csharp_grpc",
+- ":batch_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "batch_cc_proto",
+- deps = [":batch_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "batch_cc_grpc",
+- srcs = [":batch_proto"],
+- grpc_only = True,
+- deps = [":batch_cc_proto"],
+-)
+diff -urN a/google/cloud/beyondcorp/appconnections/BUILD.bazel b/google/cloud/beyondcorp/appconnections/BUILD.bazel
+--- a/google/cloud/beyondcorp/appconnections/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/beyondcorp/appconnections/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-beyond_corp-app_connections.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for appconnections.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "appconnections_ruby_wrapper",
+- srcs = ["//google/cloud/beyondcorp/appconnections/v1:appconnections_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=beyondcorp.googleapis.com",
+- "ruby-cloud-api-shortname=beyondcorp",
+- "ruby-cloud-gem-name=google-cloud-beyond_corp-app_connections",
+- "ruby-cloud-product-url=https://cloud.google.com/beyondcorp/",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- ],
+- ruby_cloud_description = "Beyondcorp Enterprise provides identity and context aware access controls for enterprise resources and enables zero-trust access. Using the Beyondcorp Enterprise APIs, enterprises can set up multi-cloud and on-prem connectivity using the App Connector hybrid connectivity solution.",
+- ruby_cloud_title = "BeyondCorp AppConnections",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-appconnections-ruby",
+- deps = [
+- ":appconnections_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/beyondcorp/appconnections/v1/BUILD.bazel b/google/cloud/beyondcorp/appconnections/v1/BUILD.bazel
+--- a/google/cloud/beyondcorp/appconnections/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/beyondcorp/appconnections/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,354 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "appconnections_proto",
+- srcs = [
+- "app_connections_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "appconnections_proto_with_info",
+- deps = [
+- ":appconnections_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "appconnections_java_proto",
+- deps = [":appconnections_proto"],
+-)
+-
+-java_grpc_library(
+- name = "appconnections_java_grpc",
+- srcs = [":appconnections_proto"],
+- deps = [":appconnections_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "appconnections_java_gapic",
+- srcs = [":appconnections_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "beyondcorp-appconnections_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- test_deps = [
+- ":appconnections_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":appconnections_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "appconnections_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.beyondcorp.appconnections.v1.AppConnectionsServiceClientTest",
+- ],
+- runtime_deps = [":appconnections_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-beyondcorp-appconnections-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":appconnections_java_gapic",
+- ":appconnections_java_grpc",
+- ":appconnections_java_proto",
+- ":appconnections_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "appconnections_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/beyondcorp/appconnections/v1",
+- protos = [":appconnections_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "appconnections_go_gapic",
+- srcs = [":appconnections_proto_with_info"],
+- grpc_service_config = "beyondcorp-appconnections_grpc_service_config.json",
+- importpath = "cloud.google.com/go/beyondcorp/appconnections/apiv1;appconnections",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- deps = [
+- ":appconnections_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "appconnections_go_gapic_test",
+- srcs = [":appconnections_go_gapic_srcjar_test"],
+- embed = [":appconnections_go_gapic"],
+- importpath = "cloud.google.com/go/beyondcorp/appconnections/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-beyondcorp-appconnections-v1-go",
+- deps = [
+- ":appconnections_go_gapic",
+- ":appconnections_go_gapic_srcjar-metadata.srcjar",
+- ":appconnections_go_gapic_srcjar-test.srcjar",
+- ":appconnections_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "appconnections_py_gapic",
+- srcs = [":appconnections_proto"],
+- grpc_service_config = "beyondcorp-appconnections_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-beyondcorp-appconnections",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=beyondcorp_appconnections",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "appconnections_py_gapic_test",
+- srcs = [
+- "appconnections_py_gapic_pytest.py",
+- "appconnections_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":appconnections_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "beyondcorp-appconnections-v1-py",
+- deps = [
+- ":appconnections_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "appconnections_php_proto",
+- deps = [":appconnections_proto"],
+-)
+-
+-php_grpc_library(
+- name = "appconnections_php_grpc",
+- srcs = [":appconnections_proto"],
+- deps = [":appconnections_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "appconnections_php_gapic",
+- srcs = [":appconnections_proto_with_info"],
+- grpc_service_config = "beyondcorp-appconnections_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":appconnections_php_grpc",
+- ":appconnections_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-beyondcorp-appconnections-v1-php",
+- deps = [
+- ":appconnections_php_gapic",
+- ":appconnections_php_grpc",
+- ":appconnections_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "appconnections_nodejs_gapic",
+- package_name = "@google-cloud/appconnections",
+- src = ":appconnections_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "beyondcorp-appconnections_grpc_service_config.json",
+- package = "google.cloud.beyondcorp.appconnections.v1",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "beyondcorp-appconnections-v1-nodejs",
+- deps = [
+- ":appconnections_nodejs_gapic",
+- ":appconnections_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "appconnections_ruby_proto",
+- deps = [":appconnections_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "appconnections_ruby_grpc",
+- srcs = [":appconnections_proto"],
+- deps = [":appconnections_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "appconnections_ruby_gapic",
+- srcs = [":appconnections_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-beyond_corp-app_connections-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/beyondcorp/",
+- "ruby-cloud-api-id=beyondcorp.googleapis.com",
+- "ruby-cloud-api-shortname=beyondcorp",
+- "ruby-cloud-wrapper-gem-override=google-cloud-beyond_corp",
+- ],
+- grpc_service_config = "beyondcorp-appconnections_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Beyondcorp Enterprise provides identity and context aware access controls for enterprise resources and enables zero-trust access. Using the Beyondcorp Enterprise APIs, enterprises can set up multi-cloud and on-prem connectivity using the App Connector hybrid connectivity solution.",
+- ruby_cloud_title = "BeyondCorp AppConnections V1",
+- service_yaml = "beyondcorp_v1.yaml",
+- deps = [
+- ":appconnections_ruby_grpc",
+- ":appconnections_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-beyondcorp-appconnections-v1-ruby",
+- deps = [
+- ":appconnections_ruby_gapic",
+- ":appconnections_ruby_grpc",
+- ":appconnections_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "appconnections_csharp_proto",
+- deps = [":appconnections_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "appconnections_csharp_grpc",
+- srcs = [":appconnections_proto"],
+- deps = [":appconnections_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "appconnections_csharp_gapic",
+- srcs = [":appconnections_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "beyondcorp-appconnections_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- deps = [
+- ":appconnections_csharp_grpc",
+- ":appconnections_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-beyondcorp-appconnections-v1-csharp",
+- deps = [
+- ":appconnections_csharp_gapic",
+- ":appconnections_csharp_grpc",
+- ":appconnections_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "appconnections_cc_proto",
+- deps = [":appconnections_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "appconnections_cc_grpc",
+- srcs = [":appconnections_proto"],
+- grpc_only = True,
+- deps = [":appconnections_cc_proto"],
+-)
+diff -urN a/google/cloud/beyondcorp/appconnectors/BUILD.bazel b/google/cloud/beyondcorp/appconnectors/BUILD.bazel
+--- a/google/cloud/beyondcorp/appconnectors/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/beyondcorp/appconnectors/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-beyond_corp-app_connectors.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for appconnectors.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "appconnectors_ruby_wrapper",
+- srcs = ["//google/cloud/beyondcorp/appconnectors/v1:appconnectors_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=beyondcorp.googleapis.com",
+- "ruby-cloud-api-shortname=beyondcorp",
+- "ruby-cloud-gem-name=google-cloud-beyond_corp-app_connectors",
+- "ruby-cloud-product-url=https://cloud.google.com/beyondcorp/",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- ],
+- ruby_cloud_description = "Beyondcorp Enterprise provides identity and context aware access controls for enterprise resources and enables zero-trust access. Using the Beyondcorp Enterprise APIs, enterprises can set up multi-cloud and on-prem connectivity using the App Connector hybrid connectivity solution.",
+- ruby_cloud_title = "BeyondCorp AppConnectors",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-appconnectors-ruby",
+- deps = [
+- ":appconnectors_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/beyondcorp/appconnectors/v1/BUILD.bazel b/google/cloud/beyondcorp/appconnectors/v1/BUILD.bazel
+--- a/google/cloud/beyondcorp/appconnectors/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/beyondcorp/appconnectors/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,358 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "appconnectors_proto",
+- srcs = [
+- "app_connector_instance_config.proto",
+- "app_connectors_service.proto",
+- "resource_info.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "appconnectors_proto_with_info",
+- deps = [
+- ":appconnectors_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "appconnectors_java_proto",
+- deps = [":appconnectors_proto"],
+-)
+-
+-java_grpc_library(
+- name = "appconnectors_java_grpc",
+- srcs = [":appconnectors_proto"],
+- deps = [":appconnectors_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "appconnectors_java_gapic",
+- srcs = [":appconnectors_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "beyondcorp-appconnectors_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- test_deps = [
+- ":appconnectors_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":appconnectors_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "appconnectors_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.beyondcorp.appconnectors.v1.AppConnectorsServiceClientTest",
+- ],
+- runtime_deps = [":appconnectors_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-beyondcorp-appconnectors-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":appconnectors_java_gapic",
+- ":appconnectors_java_grpc",
+- ":appconnectors_java_proto",
+- ":appconnectors_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "appconnectors_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/beyondcorp/appconnectors/v1",
+- protos = [":appconnectors_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "appconnectors_go_gapic",
+- srcs = [":appconnectors_proto_with_info"],
+- grpc_service_config = "beyondcorp-appconnectors_grpc_service_config.json",
+- importpath = "cloud.google.com/go/beyondcorp/appconnectors/apiv1;appconnectors",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- deps = [
+- ":appconnectors_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "appconnectors_go_gapic_test",
+- srcs = [":appconnectors_go_gapic_srcjar_test"],
+- embed = [":appconnectors_go_gapic"],
+- importpath = "cloud.google.com/go/beyondcorp/appconnectors/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-beyondcorp-appconnectors-v1-go",
+- deps = [
+- ":appconnectors_go_gapic",
+- ":appconnectors_go_gapic_srcjar-metadata.srcjar",
+- ":appconnectors_go_gapic_srcjar-test.srcjar",
+- ":appconnectors_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "appconnectors_py_gapic",
+- srcs = [":appconnectors_proto"],
+- grpc_service_config = "beyondcorp-appconnectors_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-beyondcorp-appconnectors",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=beyondcorp_appconnectors",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "appconnectors_py_gapic_test",
+- srcs = [
+- "appconnectors_py_gapic_pytest.py",
+- "appconnectors_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":appconnectors_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "beyondcorp-appconnectors-v1-py",
+- deps = [
+- ":appconnectors_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "appconnectors_php_proto",
+- deps = [":appconnectors_proto"],
+-)
+-
+-php_grpc_library(
+- name = "appconnectors_php_grpc",
+- srcs = [":appconnectors_proto"],
+- deps = [":appconnectors_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "appconnectors_php_gapic",
+- srcs = [":appconnectors_proto_with_info"],
+- grpc_service_config = "beyondcorp-appconnectors_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":appconnectors_php_grpc",
+- ":appconnectors_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-beyondcorp-appconnectors-v1-php",
+- deps = [
+- ":appconnectors_php_gapic",
+- ":appconnectors_php_grpc",
+- ":appconnectors_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "appconnectors_nodejs_gapic",
+- package_name = "@google-cloud/appconnectors",
+- src = ":appconnectors_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "beyondcorp-appconnectors_grpc_service_config.json",
+- package = "google.cloud.beyondcorp.appconnectors.v1",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "beyondcorp-appconnectors-v1-nodejs",
+- deps = [
+- ":appconnectors_nodejs_gapic",
+- ":appconnectors_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "appconnectors_ruby_proto",
+- deps = [":appconnectors_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "appconnectors_ruby_grpc",
+- srcs = [":appconnectors_proto"],
+- deps = [":appconnectors_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "appconnectors_ruby_gapic",
+- srcs = [":appconnectors_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-beyond_corp-app_connectors-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/beyondcorp/",
+- "ruby-cloud-api-id=beyondcorp.googleapis.com",
+- "ruby-cloud-api-shortname=beyondcorp",
+- "ruby-cloud-wrapper-gem-override=google-cloud-beyond_corp",
+- ],
+- grpc_service_config = "beyondcorp-appconnectors_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Beyondcorp Enterprise provides identity and context aware access controls for enterprise resources and enables zero-trust access. Using the Beyondcorp Enterprise APIs, enterprises can set up multi-cloud and on-prem connectivity using the App Connector hybrid connectivity solution.",
+- ruby_cloud_title = "BeyondCorp AppConnectors V1",
+- service_yaml = "beyondcorp_v1.yaml",
+- deps = [
+- ":appconnectors_ruby_grpc",
+- ":appconnectors_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-beyondcorp-appconnectors-v1-ruby",
+- deps = [
+- ":appconnectors_ruby_gapic",
+- ":appconnectors_ruby_grpc",
+- ":appconnectors_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "appconnectors_csharp_proto",
+- deps = [":appconnectors_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "appconnectors_csharp_grpc",
+- srcs = [":appconnectors_proto"],
+- deps = [":appconnectors_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "appconnectors_csharp_gapic",
+- srcs = [":appconnectors_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "beyondcorp-appconnectors_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- deps = [
+- ":appconnectors_csharp_grpc",
+- ":appconnectors_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-beyondcorp-appconnectors-v1-csharp",
+- deps = [
+- ":appconnectors_csharp_gapic",
+- ":appconnectors_csharp_grpc",
+- ":appconnectors_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "appconnectors_cc_proto",
+- deps = [":appconnectors_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "appconnectors_cc_grpc",
+- srcs = [":appconnectors_proto"],
+- grpc_only = True,
+- deps = [":appconnectors_cc_proto"],
+-)
+diff -urN a/google/cloud/beyondcorp/appgateways/BUILD.bazel b/google/cloud/beyondcorp/appgateways/BUILD.bazel
+--- a/google/cloud/beyondcorp/appgateways/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/beyondcorp/appgateways/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-beyond_corp-app_gateways.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for appgateways.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "appgateways_ruby_wrapper",
+- srcs = ["//google/cloud/beyondcorp/appgateways/v1:appgateways_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=beyondcorp.googleapis.com",
+- "ruby-cloud-api-shortname=beyondcorp",
+- "ruby-cloud-gem-name=google-cloud-beyond_corp-app_gateways",
+- "ruby-cloud-product-url=https://cloud.google.com/beyondcorp/",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- ],
+- ruby_cloud_description = "Beyondcorp Enterprise provides identity and context aware access controls for enterprise resources and enables zero-trust access. Using the Beyondcorp Enterprise APIs, enterprises can set up multi-cloud and on-prem connectivity using the App Connector hybrid connectivity solution.",
+- ruby_cloud_title = "BeyondCorp AppGateways",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-appgateways-ruby",
+- deps = [
+- ":appgateways_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/beyondcorp/appgateways/v1/BUILD.bazel b/google/cloud/beyondcorp/appgateways/v1/BUILD.bazel
+--- a/google/cloud/beyondcorp/appgateways/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/beyondcorp/appgateways/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,353 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "appgateways_proto",
+- srcs = [
+- "app_gateways_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "appgateways_proto_with_info",
+- deps = [
+- ":appgateways_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "appgateways_java_proto",
+- deps = [":appgateways_proto"],
+-)
+-
+-java_grpc_library(
+- name = "appgateways_java_grpc",
+- srcs = [":appgateways_proto"],
+- deps = [":appgateways_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "appgateways_java_gapic",
+- srcs = [":appgateways_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "beyondcorp-appgateways_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- test_deps = [
+- ":appgateways_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":appgateways_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "appgateways_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.beyondcorp.appgateways.v1.AppGatewaysServiceClientTest",
+- ],
+- runtime_deps = [":appgateways_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-beyondcorp-appgateways-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":appgateways_java_gapic",
+- ":appgateways_java_grpc",
+- ":appgateways_java_proto",
+- ":appgateways_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "appgateways_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/beyondcorp/appgateways/v1",
+- protos = [":appgateways_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "appgateways_go_gapic",
+- srcs = [":appgateways_proto_with_info"],
+- grpc_service_config = "beyondcorp-appgateways_grpc_service_config.json",
+- importpath = "cloud.google.com/go/beyondcorp/appgateways/apiv1;appgateways",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- deps = [
+- ":appgateways_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "appgateways_go_gapic_test",
+- srcs = [":appgateways_go_gapic_srcjar_test"],
+- embed = [":appgateways_go_gapic"],
+- importpath = "cloud.google.com/go/beyondcorp/appgateways/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-beyondcorp-appgateways-v1-go",
+- deps = [
+- ":appgateways_go_gapic",
+- ":appgateways_go_gapic_srcjar-metadata.srcjar",
+- ":appgateways_go_gapic_srcjar-test.srcjar",
+- ":appgateways_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "appgateways_py_gapic",
+- srcs = [":appgateways_proto"],
+- grpc_service_config = "beyondcorp-appgateways_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-beyondcorp-appgateways",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=beyondcorp_appgateways",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "appgateways_py_gapic_test",
+- srcs = [
+- "appgateways_py_gapic_pytest.py",
+- "appgateways_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":appgateways_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "beyondcorp-appgateways-v1-py",
+- deps = [
+- ":appgateways_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "appgateways_php_proto",
+- deps = [":appgateways_proto"],
+-)
+-
+-php_grpc_library(
+- name = "appgateways_php_grpc",
+- srcs = [":appgateways_proto"],
+- deps = [":appgateways_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "appgateways_php_gapic",
+- srcs = [":appgateways_proto_with_info"],
+- grpc_service_config = "beyondcorp-appgateways_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":appgateways_php_grpc",
+- ":appgateways_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-beyondcorp-appgateways-v1-php",
+- deps = [
+- ":appgateways_php_gapic",
+- ":appgateways_php_grpc",
+- ":appgateways_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "appgateways_nodejs_gapic",
+- package_name = "@google-cloud/appgateways",
+- src = ":appgateways_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "beyondcorp-appgateways_grpc_service_config.json",
+- package = "google.cloud.beyondcorp.appgateways.v1",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "beyondcorp-appgateways-v1-nodejs",
+- deps = [
+- ":appgateways_nodejs_gapic",
+- ":appgateways_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "appgateways_ruby_proto",
+- deps = [":appgateways_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "appgateways_ruby_grpc",
+- srcs = [":appgateways_proto"],
+- deps = [":appgateways_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "appgateways_ruby_gapic",
+- srcs = [":appgateways_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-beyond_corp-app_gateways-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/beyondcorp/",
+- "ruby-cloud-api-id=beyondcorp.googleapis.com",
+- "ruby-cloud-api-shortname=beyondcorp",
+- "ruby-cloud-wrapper-gem-override=google-cloud-beyond_corp",
+- ],
+- grpc_service_config = "beyondcorp-appgateways_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Beyondcorp Enterprise provides identity and context aware access controls for enterprise resources and enables zero-trust access. Using the Beyondcorp Enterprise APIs, enterprises can set up multi-cloud and on-prem connectivity using the App Connector hybrid connectivity solution.",
+- ruby_cloud_title = "BeyondCorp AppGateways V1",
+- service_yaml = "beyondcorp_v1.yaml",
+- deps = [
+- ":appgateways_ruby_grpc",
+- ":appgateways_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-beyondcorp-appgateways-v1-ruby",
+- deps = [
+- ":appgateways_ruby_gapic",
+- ":appgateways_ruby_grpc",
+- ":appgateways_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "appgateways_csharp_proto",
+- deps = [":appgateways_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "appgateways_csharp_grpc",
+- srcs = [":appgateways_proto"],
+- deps = [":appgateways_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "appgateways_csharp_gapic",
+- srcs = [":appgateways_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "beyondcorp-appgateways_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- deps = [
+- ":appgateways_csharp_grpc",
+- ":appgateways_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-beyondcorp-appgateways-v1-csharp",
+- deps = [
+- ":appgateways_csharp_gapic",
+- ":appgateways_csharp_grpc",
+- ":appgateways_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "appgateways_cc_proto",
+- deps = [":appgateways_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "appgateways_cc_grpc",
+- srcs = [":appgateways_proto"],
+- grpc_only = True,
+- deps = [":appgateways_cc_proto"],
+-)
+diff -urN a/google/cloud/beyondcorp/clientconnectorservices/BUILD.bazel b/google/cloud/beyondcorp/clientconnectorservices/BUILD.bazel
+--- a/google/cloud/beyondcorp/clientconnectorservices/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/beyondcorp/clientconnectorservices/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-beyond_corp-client_connector_services.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for clientconnectorservices.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "clientconnectorservices_ruby_wrapper",
+- srcs = ["//google/cloud/beyondcorp/clientconnectorservices/v1:clientconnectorservices_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=beyondcorp.googleapis.com",
+- "ruby-cloud-api-shortname=beyondcorp",
+- "ruby-cloud-gem-name=google-cloud-beyond_corp-client_connector_services",
+- "ruby-cloud-product-url=https://cloud.google.com/beyondcorp/",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- ],
+- ruby_cloud_description = "Beyondcorp Enterprise provides identity and context aware access controls for enterprise resources and enables zero-trust access. Using the Beyondcorp Enterprise APIs, enterprises can set up multi-cloud and on-prem connectivity using the App Connector hybrid connectivity solution.",
+- ruby_cloud_title = "BeyondCorp ClientConnectorServices",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-clientconnectorservices-ruby",
+- deps = [
+- ":clientconnectorservices_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/beyondcorp/clientconnectorservices/v1/BUILD.bazel b/google/cloud/beyondcorp/clientconnectorservices/v1/BUILD.bazel
+--- a/google/cloud/beyondcorp/clientconnectorservices/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/beyondcorp/clientconnectorservices/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,354 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "clientconnectorservices_proto",
+- srcs = [
+- "client_connector_services_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "clientconnectorservices_proto_with_info",
+- deps = [
+- ":clientconnectorservices_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "clientconnectorservices_java_proto",
+- deps = [":clientconnectorservices_proto"],
+-)
+-
+-java_grpc_library(
+- name = "clientconnectorservices_java_grpc",
+- srcs = [":clientconnectorservices_proto"],
+- deps = [":clientconnectorservices_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "clientconnectorservices_java_gapic",
+- srcs = [":clientconnectorservices_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "beyondcorp-clientconnectorservices_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- test_deps = [
+- ":clientconnectorservices_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":clientconnectorservices_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "clientconnectorservices_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.beyondcorp.clientconnectorservices.v1.ClientConnectorServicesServiceClientTest",
+- ],
+- runtime_deps = [":clientconnectorservices_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-beyondcorp-clientconnectorservices-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":clientconnectorservices_java_gapic",
+- ":clientconnectorservices_java_grpc",
+- ":clientconnectorservices_java_proto",
+- ":clientconnectorservices_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "clientconnectorservices_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/beyondcorp/clientconnectorservices/v1",
+- protos = [":clientconnectorservices_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "clientconnectorservices_go_gapic",
+- srcs = [":clientconnectorservices_proto_with_info"],
+- grpc_service_config = "beyondcorp-clientconnectorservices_grpc_service_config.json",
+- importpath = "cloud.google.com/go/beyondcorp/clientconnectorservices/apiv1;clientconnectorservices",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- deps = [
+- ":clientconnectorservices_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "clientconnectorservices_go_gapic_test",
+- srcs = [":clientconnectorservices_go_gapic_srcjar_test"],
+- embed = [":clientconnectorservices_go_gapic"],
+- importpath = "cloud.google.com/go/beyondcorp/clientconnectorservices/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-beyondcorp-clientconnectorservices-v1-go",
+- deps = [
+- ":clientconnectorservices_go_gapic",
+- ":clientconnectorservices_go_gapic_srcjar-metadata.srcjar",
+- ":clientconnectorservices_go_gapic_srcjar-test.srcjar",
+- ":clientconnectorservices_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "clientconnectorservices_py_gapic",
+- srcs = [":clientconnectorservices_proto"],
+- grpc_service_config = "beyondcorp-clientconnectorservices_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-beyondcorp-clientconnectorservices",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=beyondcorp_clientconnectorservices",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "clientconnectorservices_py_gapic_test",
+- srcs = [
+- "clientconnectorservices_py_gapic_pytest.py",
+- "clientconnectorservices_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":clientconnectorservices_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "beyondcorp-clientconnectorservices-v1-py",
+- deps = [
+- ":clientconnectorservices_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "clientconnectorservices_php_proto",
+- deps = [":clientconnectorservices_proto"],
+-)
+-
+-php_grpc_library(
+- name = "clientconnectorservices_php_grpc",
+- srcs = [":clientconnectorservices_proto"],
+- deps = [":clientconnectorservices_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "clientconnectorservices_php_gapic",
+- srcs = [":clientconnectorservices_proto_with_info"],
+- grpc_service_config = "beyondcorp-clientconnectorservices_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":clientconnectorservices_php_grpc",
+- ":clientconnectorservices_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-beyondcorp-clientconnectorservices-v1-php",
+- deps = [
+- ":clientconnectorservices_php_gapic",
+- ":clientconnectorservices_php_grpc",
+- ":clientconnectorservices_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "clientconnectorservices_nodejs_gapic",
+- package_name = "@google-cloud/clientconnectorservices",
+- src = ":clientconnectorservices_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "beyondcorp-clientconnectorservices_grpc_service_config.json",
+- package = "google.cloud.beyondcorp.clientconnectorservices.v1",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "beyondcorp-clientconnectorservices-v1-nodejs",
+- deps = [
+- ":clientconnectorservices_nodejs_gapic",
+- ":clientconnectorservices_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "clientconnectorservices_ruby_proto",
+- deps = [":clientconnectorservices_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "clientconnectorservices_ruby_grpc",
+- srcs = [":clientconnectorservices_proto"],
+- deps = [":clientconnectorservices_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "clientconnectorservices_ruby_gapic",
+- srcs = [":clientconnectorservices_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-beyond_corp-client_connector_services-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/beyondcorp/",
+- "ruby-cloud-api-id=beyondcorp.googleapis.com",
+- "ruby-cloud-api-shortname=beyondcorp",
+- "ruby-cloud-wrapper-gem-override=google-cloud-beyond_corp",
+- ],
+- grpc_service_config = "beyondcorp-clientconnectorservices_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Beyondcorp Enterprise provides identity and context aware access controls for enterprise resources and enables zero-trust access. Using the Beyondcorp Enterprise APIs, enterprises can set up multi-cloud and on-prem connectivity using the App Connector hybrid connectivity solution.",
+- ruby_cloud_title = "BeyondCorp ClientConnectorServices V1",
+- service_yaml = "beyondcorp_v1.yaml",
+- deps = [
+- ":clientconnectorservices_ruby_grpc",
+- ":clientconnectorservices_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-beyondcorp-clientconnectorservices-v1-ruby",
+- deps = [
+- ":clientconnectorservices_ruby_gapic",
+- ":clientconnectorservices_ruby_grpc",
+- ":clientconnectorservices_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "clientconnectorservices_csharp_proto",
+- deps = [":clientconnectorservices_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "clientconnectorservices_csharp_grpc",
+- srcs = [":clientconnectorservices_proto"],
+- deps = [":clientconnectorservices_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "clientconnectorservices_csharp_gapic",
+- srcs = [":clientconnectorservices_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "beyondcorp-clientconnectorservices_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- deps = [
+- ":clientconnectorservices_csharp_grpc",
+- ":clientconnectorservices_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-beyondcorp-clientconnectorservices-v1-csharp",
+- deps = [
+- ":clientconnectorservices_csharp_gapic",
+- ":clientconnectorservices_csharp_grpc",
+- ":clientconnectorservices_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "clientconnectorservices_cc_proto",
+- deps = [":clientconnectorservices_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "clientconnectorservices_cc_grpc",
+- srcs = [":clientconnectorservices_proto"],
+- grpc_only = True,
+- deps = [":clientconnectorservices_cc_proto"],
+-)
+diff -urN a/google/cloud/beyondcorp/clientgateways/BUILD.bazel b/google/cloud/beyondcorp/clientgateways/BUILD.bazel
+--- a/google/cloud/beyondcorp/clientgateways/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/beyondcorp/clientgateways/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-beyond_corp-client_gateways.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for clientgateways.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "clientgateways_ruby_wrapper",
+- srcs = ["//google/cloud/beyondcorp/clientgateways/v1:clientgateways_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=beyondcorp.googleapis.com",
+- "ruby-cloud-api-shortname=beyondcorp",
+- "ruby-cloud-gem-name=google-cloud-beyond_corp-client_gateways",
+- "ruby-cloud-product-url=https://cloud.google.com/beyondcorp/",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- ],
+- ruby_cloud_description = "Beyondcorp Enterprise provides identity and context aware access controls for enterprise resources and enables zero-trust access. Using the Beyondcorp Enterprise APIs, enterprises can set up multi-cloud and on-prem connectivity using the App Connector hybrid connectivity solution.",
+- ruby_cloud_title = "BeyondCorp ClientGateways",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-clientgateways-ruby",
+- deps = [
+- ":clientgateways_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/beyondcorp/clientgateways/v1/BUILD.bazel b/google/cloud/beyondcorp/clientgateways/v1/BUILD.bazel
+--- a/google/cloud/beyondcorp/clientgateways/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/beyondcorp/clientgateways/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,353 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "clientgateways_proto",
+- srcs = [
+- "client_gateways_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "clientgateways_proto_with_info",
+- deps = [
+- ":clientgateways_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "clientgateways_java_proto",
+- deps = [":clientgateways_proto"],
+-)
+-
+-java_grpc_library(
+- name = "clientgateways_java_grpc",
+- srcs = [":clientgateways_proto"],
+- deps = [":clientgateways_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "clientgateways_java_gapic",
+- srcs = [":clientgateways_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "beyondcorp-clientgateways_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- test_deps = [
+- ":clientgateways_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":clientgateways_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "clientgateways_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.beyondcorp.clientgateways.v1.ClientGatewaysServiceClientTest",
+- ],
+- runtime_deps = [":clientgateways_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-beyondcorp-clientgateways-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":clientgateways_java_gapic",
+- ":clientgateways_java_grpc",
+- ":clientgateways_java_proto",
+- ":clientgateways_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "clientgateways_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/beyondcorp/clientgateways/v1",
+- protos = [":clientgateways_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "clientgateways_go_gapic",
+- srcs = [":clientgateways_proto_with_info"],
+- grpc_service_config = "beyondcorp-clientgateways_grpc_service_config.json",
+- importpath = "cloud.google.com/go/beyondcorp/clientgateways/apiv1;clientgateways",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- deps = [
+- ":clientgateways_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "clientgateways_go_gapic_test",
+- srcs = [":clientgateways_go_gapic_srcjar_test"],
+- embed = [":clientgateways_go_gapic"],
+- importpath = "cloud.google.com/go/beyondcorp/clientgateways/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-beyondcorp-clientgateways-v1-go",
+- deps = [
+- ":clientgateways_go_gapic",
+- ":clientgateways_go_gapic_srcjar-metadata.srcjar",
+- ":clientgateways_go_gapic_srcjar-test.srcjar",
+- ":clientgateways_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "clientgateways_py_gapic",
+- srcs = [":clientgateways_proto"],
+- grpc_service_config = "beyondcorp-clientgateways_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-beyondcorp-clientgateways",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=beyondcorp_clientgateways",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "clientgateways_py_gapic_test",
+- srcs = [
+- "clientgateways_py_gapic_pytest.py",
+- "clientgateways_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":clientgateways_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "beyondcorp-clientgateways-v1-py",
+- deps = [
+- ":clientgateways_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "clientgateways_php_proto",
+- deps = [":clientgateways_proto"],
+-)
+-
+-php_grpc_library(
+- name = "clientgateways_php_grpc",
+- srcs = [":clientgateways_proto"],
+- deps = [":clientgateways_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "clientgateways_php_gapic",
+- srcs = [":clientgateways_proto_with_info"],
+- grpc_service_config = "beyondcorp-clientgateways_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":clientgateways_php_grpc",
+- ":clientgateways_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-beyondcorp-clientgateways-v1-php",
+- deps = [
+- ":clientgateways_php_gapic",
+- ":clientgateways_php_grpc",
+- ":clientgateways_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "clientgateways_nodejs_gapic",
+- package_name = "@google-cloud/clientgateways",
+- src = ":clientgateways_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "beyondcorp-clientgateways_grpc_service_config.json",
+- package = "google.cloud.beyondcorp.clientgateways.v1",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "beyondcorp-clientgateways-v1-nodejs",
+- deps = [
+- ":clientgateways_nodejs_gapic",
+- ":clientgateways_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "clientgateways_ruby_proto",
+- deps = [":clientgateways_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "clientgateways_ruby_grpc",
+- srcs = [":clientgateways_proto"],
+- deps = [":clientgateways_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "clientgateways_ruby_gapic",
+- srcs = [":clientgateways_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-beyond_corp-client_gateways-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/beyondcorp/",
+- "ruby-cloud-api-id=beyondcorp.googleapis.com",
+- "ruby-cloud-api-shortname=beyondcorp",
+- "ruby-cloud-wrapper-gem-override=google-cloud-beyond_corp",
+- ],
+- grpc_service_config = "beyondcorp-clientgateways_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Beyondcorp Enterprise provides identity and context aware access controls for enterprise resources and enables zero-trust access. Using the Beyondcorp Enterprise APIs, enterprises can set up multi-cloud and on-prem connectivity using the App Connector hybrid connectivity solution.",
+- ruby_cloud_title = "BeyondCorp ClientGateways V1",
+- service_yaml = "beyondcorp_v1.yaml",
+- deps = [
+- ":clientgateways_ruby_grpc",
+- ":clientgateways_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-beyondcorp-clientgateways-v1-ruby",
+- deps = [
+- ":clientgateways_ruby_gapic",
+- ":clientgateways_ruby_grpc",
+- ":clientgateways_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "clientgateways_csharp_proto",
+- deps = [":clientgateways_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "clientgateways_csharp_grpc",
+- srcs = [":clientgateways_proto"],
+- deps = [":clientgateways_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "clientgateways_csharp_gapic",
+- srcs = [":clientgateways_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "beyondcorp-clientgateways_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "beyondcorp_v1.yaml",
+- deps = [
+- ":clientgateways_csharp_grpc",
+- ":clientgateways_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-beyondcorp-clientgateways-v1-csharp",
+- deps = [
+- ":clientgateways_csharp_gapic",
+- ":clientgateways_csharp_grpc",
+- ":clientgateways_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "clientgateways_cc_proto",
+- deps = [":clientgateways_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "clientgateways_cc_grpc",
+- srcs = [":clientgateways_proto"],
+- grpc_only = True,
+- deps = [":clientgateways_cc_proto"],
+-)
+diff -urN a/google/cloud/bigquery/analyticshub/BUILD.bazel b/google/cloud/bigquery/analyticshub/BUILD.bazel
+--- a/google/cloud/bigquery/analyticshub/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/analyticshub/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-bigquery-analytics_hub.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for analyticshub.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "analyticshub_ruby_wrapper",
+- srcs = ["//google/cloud/bigquery/analyticshub/v1:analyticshub_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-bigquery-analytics_hub",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/bigquery",
+- "ruby-cloud-api-id=analyticshub.googleapis.com",
+- "ruby-cloud-api-shortname=analyticshub",
+- ],
+- ruby_cloud_description = "Analytics Hub is a data exchange platform that enables you to share data and insights at scale across organizational boundaries with a robust security and privacy framework. With Analytics Hub, you can discover and access a data library curated by various data providers.",
+- ruby_cloud_title = "Analytics Hub V1",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-analyticshub-ruby",
+- deps = [
+- ":analyticshub_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/bigquery/analyticshub/v1/BUILD.bazel b/google/cloud/bigquery/analyticshub/v1/BUILD.bazel
+--- a/google/cloud/bigquery/analyticshub/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/analyticshub/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,397 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "analyticshub_proto",
+- srcs = [
+- "analyticshub.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "analyticshub_proto_with_info",
+- deps = [
+- ":analyticshub_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "analyticshub_java_proto",
+- deps = [":analyticshub_proto"],
+-)
+-
+-java_grpc_library(
+- name = "analyticshub_java_grpc",
+- srcs = [":analyticshub_proto"],
+- deps = [":analyticshub_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "analyticshub_java_gapic",
+- srcs = [":analyticshub_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "analyticshub_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticshub_v1.yaml",
+- test_deps = [
+- ":analyticshub_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":analyticshub_java_proto",
+- "//google/api:api_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "analyticshub_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigquery.analyticshub.v1.AnalyticsHubServiceClientHttpJsonTest",
+- "com.google.cloud.bigquery.analyticshub.v1.AnalyticsHubServiceClientTest",
+- ],
+- runtime_deps = [":analyticshub_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigquery-analyticshub-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":analyticshub_java_gapic",
+- ":analyticshub_java_grpc",
+- ":analyticshub_java_proto",
+- ":analyticshub_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "analyticshub_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/analyticshub/v1",
+- protos = [":analyticshub_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "analyticshub_go_gapic",
+- srcs = [":analyticshub_proto_with_info"],
+- grpc_service_config = "analyticshub_v1_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigquery/analyticshub/apiv1;analyticshub",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "analyticshub_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":analyticshub_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "analyticshub_go_gapic_test",
+- srcs = [":analyticshub_go_gapic_srcjar_test"],
+- embed = [":analyticshub_go_gapic"],
+- importpath = "cloud.google.com/go/bigquery/analyticshub/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigquery-analyticshub-v1-go",
+- deps = [
+- ":analyticshub_go_gapic",
+- ":analyticshub_go_gapic_srcjar-metadata.srcjar",
+- ":analyticshub_go_gapic_srcjar-test.srcjar",
+- ":analyticshub_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "analyticshub_py_gapic",
+- srcs = [":analyticshub_proto"],
+- grpc_service_config = "analyticshub_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticshub_v1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "analyticshub_py_gapic_test",
+- srcs = [
+- "analyticshub_py_gapic_pytest.py",
+- "analyticshub_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":analyticshub_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "bigquery-analyticshub-v1-py",
+- deps = [
+- ":analyticshub_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "analyticshub_php_proto",
+- deps = [":analyticshub_proto"],
+-)
+-
+-php_grpc_library(
+- name = "analyticshub_php_grpc",
+- srcs = [":analyticshub_proto"],
+- deps = [":analyticshub_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "analyticshub_php_gapic",
+- srcs = [":analyticshub_proto_with_info"],
+- grpc_service_config = "analyticshub_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticshub_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":analyticshub_php_grpc",
+- ":analyticshub_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-analyticshub-v1-php",
+- deps = [
+- ":analyticshub_php_gapic",
+- ":analyticshub_php_grpc",
+- ":analyticshub_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "analyticshub_nodejs_gapic",
+- package_name = "@google-cloud/bigquery-analyticshub",
+- src = ":analyticshub_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "analyticshub_v1_grpc_service_config.json",
+- package = "google.cloud.bigquery.analyticshub.v1",
+- rest_numeric_enums = False,
+- service_yaml = "analyticshub_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigquery-analyticshub-v1-nodejs",
+- deps = [
+- ":analyticshub_nodejs_gapic",
+- ":analyticshub_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "analyticshub_ruby_proto",
+- deps = [":analyticshub_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "analyticshub_ruby_grpc",
+- srcs = [":analyticshub_proto"],
+- deps = [":analyticshub_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "analyticshub_ruby_gapic",
+- srcs = [":analyticshub_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=analyticshub.googleapis.com",
+- "ruby-cloud-api-shortname=analyticshub",
+- "ruby-cloud-gem-name=google-cloud-bigquery-analytics_hub-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/bigquery/docs",
+- ],
+- grpc_service_config = "analyticshub_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Analytics Hub is a data exchange platform that enables you to share data and insights at scale across organizational boundaries with a robust security and privacy framework. With Analytics Hub, you can discover and access a data library curated by various data providers.",
+- ruby_cloud_title = "Analytics Hub V1",
+- service_yaml = "analyticshub_v1.yaml",
+- deps = [
+- ":analyticshub_ruby_grpc",
+- ":analyticshub_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-analyticshub-v1-ruby",
+- deps = [
+- ":analyticshub_ruby_gapic",
+- ":analyticshub_ruby_grpc",
+- ":analyticshub_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "analyticshub_csharp_proto",
+- deps = [":analyticshub_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "analyticshub_csharp_grpc",
+- srcs = [":analyticshub_proto"],
+- deps = [":analyticshub_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "analyticshub_csharp_gapic",
+- srcs = [":analyticshub_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "analyticshub_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticshub_v1.yaml",
+- deps = [
+- ":analyticshub_csharp_grpc",
+- ":analyticshub_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-analyticshub-v1-csharp",
+- deps = [
+- ":analyticshub_csharp_gapic",
+- ":analyticshub_csharp_grpc",
+- ":analyticshub_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "analyticshub_cc_proto",
+- deps = [":analyticshub_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "analyticshub_cc_grpc",
+- srcs = [":analyticshub_proto"],
+- grpc_only = True,
+- deps = [":analyticshub_cc_proto"],
+-)
+diff -urN a/google/cloud/bigquery/connection/BUILD.bazel b/google/cloud/bigquery/connection/BUILD.bazel
+--- a/google/cloud/bigquery/connection/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/connection/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-bigquery-connection.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for bigqueryconnection.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "bigqueryconnection_ruby_wrapper",
+- srcs = ["//google/cloud/bigquery/connection/v1:connection_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-bigquery-connection",
+- "ruby-cloud-env-prefix=BIGQUERY_CONNECTION",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/bigquery/docs/reference/bigqueryconnection",
+- "ruby-cloud-api-id=bigqueryconnection.googleapis.com",
+- "ruby-cloud-api-shortname=bigqueryconnection",
+- ],
+- ruby_cloud_description = "The BigQuery Connection API allows users to manage BigQuery connections to external data sources.",
+- ruby_cloud_title = "BigQuery Connection",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-connection-ruby",
+- deps = [
+- ":bigqueryconnection_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/bigquery/connection/v1/BUILD.bazel b/google/cloud/bigquery/connection/v1/BUILD.bazel
+--- a/google/cloud/bigquery/connection/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/connection/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,387 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "connection_proto",
+- srcs = [
+- "connection.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "connection_proto_with_info",
+- deps = [
+- ":connection_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "connection_java_proto",
+- deps = [":connection_proto"],
+-)
+-
+-java_grpc_library(
+- name = "connection_java_grpc",
+- srcs = [":connection_proto"],
+- deps = [":connection_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "connection_java_gapic",
+- srcs = [":connection_proto_with_info"],
+- gapic_yaml = "connection_gapic.yaml",
+- grpc_service_config = "bigqueryconnection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":connection_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":connection_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "connection_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigqueryconnection.v1.ConnectionServiceClientHttpJsonTest",
+- "com.google.cloud.bigqueryconnection.v1.ConnectionServiceClientTest",
+- ],
+- runtime_deps = [":connection_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigquery-connection-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":connection_java_gapic",
+- ":connection_java_grpc",
+- ":connection_java_proto",
+- ":connection_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "connection_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1",
+- protos = [":connection_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "connection_go_gapic",
+- srcs = [":connection_proto_with_info"],
+- grpc_service_config = "bigqueryconnection_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigquery/connection/apiv1;connection",
+- rest_numeric_enums = False,
+- service_yaml = "bigqueryconnection_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":connection_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "connection_go_gapic_test",
+- srcs = [":connection_go_gapic_srcjar_test"],
+- embed = [":connection_go_gapic"],
+- importpath = "cloud.google.com/go/bigquery/connection/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigquery-connection-v1-go",
+- deps = [
+- ":connection_go_gapic",
+- ":connection_go_gapic_srcjar-test.srcjar",
+- ":connection_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "connection_py_gapic",
+- srcs = [":connection_proto"],
+- grpc_service_config = "bigqueryconnection_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=bigquery_connection",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "connection_py_gapic_test",
+- srcs = [
+- "connection_py_gapic_pytest.py",
+- "connection_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":connection_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "bigquery-connection-v1-py",
+- deps = [
+- ":connection_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "connection_php_proto",
+- deps = [":connection_proto"],
+-)
+-
+-php_grpc_library(
+- name = "connection_php_grpc",
+- srcs = [":connection_proto"],
+- deps = [":connection_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "connection_php_gapic",
+- srcs = [":connection_proto_with_info"],
+- grpc_service_config = "bigqueryconnection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":connection_php_grpc",
+- ":connection_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-connection-v1-php",
+- deps = [
+- ":connection_php_gapic",
+- ":connection_php_grpc",
+- ":connection_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "connection_nodejs_gapic",
+- package_name = "@google-cloud/bigquery-connection",
+- src = ":connection_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- gapic_yaml = "connection_gapic.yaml",
+- grpc_service_config = "bigqueryconnection_grpc_service_config.json",
+- package = "google.cloud.bigquery.connection.v1",
+- rest_numeric_enums = False,
+- service_yaml = "bigqueryconnection_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigquery-connection-v1-nodejs",
+- deps = [
+- ":connection_nodejs_gapic",
+- ":connection_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "connection_ruby_proto",
+- deps = [":connection_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "connection_ruby_grpc",
+- srcs = [":connection_proto"],
+- deps = [":connection_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "connection_ruby_gapic",
+- srcs = [":connection_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-bigquery-connection-v1",
+- "ruby-cloud-env-prefix=BIGQUERY_CONNECTION",
+- "ruby-cloud-product-url=https://cloud.google.com/bigquery/docs/reference/bigqueryconnection",
+- "ruby-cloud-api-id=bigqueryconnection.googleapis.com",
+- "ruby-cloud-api-shortname=bigqueryconnection",
+- ],
+- grpc_service_config = "bigqueryconnection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The BigQuery Connection API allows users to manage BigQuery connections to external data sources.",
+- ruby_cloud_title = "BigQuery Connection V1",
+- deps = [
+- ":connection_ruby_grpc",
+- ":connection_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-connection-v1-ruby",
+- deps = [
+- ":connection_ruby_gapic",
+- ":connection_ruby_grpc",
+- ":connection_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "connection_csharp_proto",
+- deps = [":connection_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "connection_csharp_grpc",
+- srcs = [":connection_proto"],
+- deps = [":connection_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "connection_csharp_gapic",
+- srcs = [":connection_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "bigqueryconnection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigqueryconnection_v1.yaml",
+- deps = [
+- ":connection_csharp_grpc",
+- ":connection_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-connection-v1-csharp",
+- deps = [
+- ":connection_csharp_gapic",
+- ":connection_csharp_grpc",
+- ":connection_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "connection_cc_proto",
+- deps = [":connection_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "connection_cc_grpc",
+- srcs = [":connection_proto"],
+- grpc_only = True,
+- deps = [":connection_cc_proto"],
+-)
+diff -urN a/google/cloud/bigquery/connection/v1beta1/BUILD.bazel b/google/cloud/bigquery/connection/v1beta1/BUILD.bazel
+--- a/google/cloud/bigquery/connection/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/connection/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,354 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "connection_proto",
+- srcs = [
+- "connection.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "connection_proto_with_info",
+- deps = [
+- ":connection_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "connection_java_proto",
+- deps = [":connection_proto"],
+-)
+-
+-java_grpc_library(
+- name = "connection_java_grpc",
+- srcs = [":connection_proto"],
+- deps = [":connection_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "connection_java_gapic",
+- srcs = [":connection_proto_with_info"],
+- grpc_service_config = "bigqueryconnection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":connection_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":connection_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "connection_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigquery.connection.v1beta1.ConnectionServiceClientHttpJsonTest",
+- "com.google.cloud.bigquery.connection.v1beta1.ConnectionServiceClientTest",
+- ],
+- runtime_deps = [":connection_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigquery-connection-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":connection_java_gapic",
+- ":connection_java_grpc",
+- ":connection_java_proto",
+- ":connection_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "connection_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1beta1",
+- protos = [":connection_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "connection_go_gapic",
+- srcs = [":connection_proto_with_info"],
+- grpc_service_config = "bigqueryconnection_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigquery/connection/apiv1beta1;connection",
+- rest_numeric_enums = False,
+- service_yaml = "bigqueryconnection_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":connection_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "connection_go_gapic_test",
+- srcs = [":connection_go_gapic_srcjar_test"],
+- embed = [":connection_go_gapic"],
+- importpath = "cloud.google.com/go/bigquery/connection/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigquery-connection-v1beta1-go",
+- deps = [
+- ":connection_go_gapic",
+- ":connection_go_gapic_srcjar-test.srcjar",
+- ":connection_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "connection_py_gapic",
+- srcs = [":connection_proto"],
+- grpc_service_config = "bigqueryconnection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "connection_py_gapic_test",
+- srcs = [
+- "connection_py_gapic_pytest.py",
+- "connection_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":connection_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "bigquery-connection-v1beta1-py",
+- deps = [
+- ":connection_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "connection_php_proto",
+- deps = [":connection_proto"],
+-)
+-
+-php_grpc_library(
+- name = "connection_php_grpc",
+- srcs = [":connection_proto"],
+- deps = [":connection_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "connection_php_gapic",
+- srcs = [":connection_proto_with_info"],
+- grpc_service_config = "bigqueryconnection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":connection_php_grpc",
+- ":connection_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-connection-v1beta1-php",
+- deps = [
+- ":connection_php_gapic",
+- ":connection_php_grpc",
+- ":connection_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "connection_nodejs_gapic",
+- src = ":connection_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "bigqueryconnection_grpc_service_config.json",
+- package = "google.cloud.bigquery.connection.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "bigqueryconnection_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigquery-connection-v1beta1-nodejs",
+- deps = [
+- ":connection_nodejs_gapic",
+- ":connection_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "connection_ruby_proto",
+- deps = [":connection_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "connection_ruby_grpc",
+- srcs = [":connection_proto"],
+- deps = [":connection_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "connection_ruby_gapic",
+- srcs = [":connection_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-connection-v1beta1"],
+- rest_numeric_enums = False,
+- deps = [
+- ":connection_ruby_grpc",
+- ":connection_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-connection-v1beta1-ruby",
+- deps = [
+- ":connection_ruby_gapic",
+- ":connection_ruby_grpc",
+- ":connection_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "connection_csharp_proto",
+- deps = [":connection_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "connection_csharp_grpc",
+- srcs = [":connection_proto"],
+- deps = [":connection_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "connection_csharp_gapic",
+- srcs = [":connection_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "bigqueryconnection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigqueryconnection_v1beta1.yaml",
+- deps = [
+- ":connection_csharp_grpc",
+- ":connection_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-connection-v1beta1-csharp",
+- deps = [
+- ":connection_csharp_gapic",
+- ":connection_csharp_grpc",
+- ":connection_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/bigquery/dataexchange/BUILD.bazel b/google/cloud/bigquery/dataexchange/BUILD.bazel
+--- a/google/cloud/bigquery/dataexchange/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/dataexchange/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-bigquery-data_exchange.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for analyticshub.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta1 in this case.
+-ruby_cloud_gapic_library(
+- name = "dataexchange_ruby_wrapper",
+- srcs = ["//google/cloud/bigquery/dataexchange/v1beta1:dataexchange_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=analyticshub.googleapis.com",
+- "ruby-cloud-api-shortname=analyticshub",
+- "ruby-cloud-gem-name=google-cloud-bigquery-data_exchange",
+- "ruby-cloud-product-url=https://cloud.google.com/analytics-hub/",
+- "ruby-cloud-wrapper-of=v1beta1:0.0",
+- ],
+- ruby_cloud_description = "Analytics Hub is a data exchange that allows you to efficiently and securely exchange data assets across organizations to address challenges of data reliability and cost. Curate a library of internal and external assets, including unique datasets like Google Trends, backed by the power of BigQuery.",
+- ruby_cloud_title = "Analytics Hub",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dataexchange-ruby",
+- deps = [
+- ":dataexchange_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/bigquery/dataexchange/v1beta1/BUILD.bazel b/google/cloud/bigquery/dataexchange/v1beta1/BUILD.bazel
+--- a/google/cloud/bigquery/dataexchange/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/dataexchange/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,406 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "dataexchange_proto",
+- srcs = [
+- "dataexchange.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "dataexchange_proto_with_info",
+- deps = [
+- ":dataexchange_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "dataexchange_java_proto",
+- deps = [":dataexchange_proto"],
+-)
+-
+-java_grpc_library(
+- name = "dataexchange_java_grpc",
+- srcs = [":dataexchange_proto"],
+- deps = [":dataexchange_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "dataexchange_java_gapic",
+- srcs = [":dataexchange_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "analyticshub_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticshub_v1beta1.yaml",
+- test_deps = [
+- ":dataexchange_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":dataexchange_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "dataexchange_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClientHttpJsonTest",
+- "com.google.cloud.bigquery.dataexchange.v1beta1.AnalyticsHubServiceClientTest",
+- ],
+- runtime_deps = [":dataexchange_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigquery-dataexchange-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":dataexchange_java_gapic",
+- ":dataexchange_java_grpc",
+- ":dataexchange_java_proto",
+- ":dataexchange_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "dataexchange_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1",
+- protos = [":dataexchange_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "dataexchange_go_gapic",
+- srcs = [":dataexchange_proto_with_info"],
+- grpc_service_config = "analyticshub_v1beta1_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigquery/dataexchange/apiv1beta1;dataexchange",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "analyticshub_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dataexchange_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "dataexchange_go_gapic_test",
+- srcs = [":dataexchange_go_gapic_srcjar_test"],
+- embed = [":dataexchange_go_gapic"],
+- importpath = "cloud.google.com/go/bigquery/dataexchange/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigquery-dataexchange-v1beta1-go",
+- deps = [
+- ":dataexchange_go_gapic",
+- ":dataexchange_go_gapic_srcjar-metadata.srcjar",
+- ":dataexchange_go_gapic_srcjar-test.srcjar",
+- ":dataexchange_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "dataexchange_py_gapic",
+- srcs = [":dataexchange_proto"],
+- grpc_service_config = "analyticshub_v1beta1_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=bigquery_data_exchange",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-bigquery-data-exchange",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "analyticshub_v1beta1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "dataexchange_py_gapic_test",
+- srcs = [
+- "dataexchange_py_gapic_pytest.py",
+- "dataexchange_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":dataexchange_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "bigquery-dataexchange-v1beta1-py",
+- deps = [
+- ":dataexchange_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "dataexchange_php_proto",
+- deps = [":dataexchange_proto"],
+-)
+-
+-php_grpc_library(
+- name = "dataexchange_php_grpc",
+- srcs = [":dataexchange_proto"],
+- deps = [":dataexchange_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "dataexchange_php_gapic",
+- srcs = [":dataexchange_proto_with_info"],
+- grpc_service_config = "analyticshub_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticshub_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dataexchange_php_grpc",
+- ":dataexchange_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-dataexchange-v1beta1-php",
+- deps = [
+- ":dataexchange_php_gapic",
+- ":dataexchange_php_grpc",
+- ":dataexchange_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "dataexchange_nodejs_gapic",
+- package_name = "@google-cloud/bigquery-data-exchange",
+- src = ":dataexchange_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "analyticshub_v1beta1_grpc_service_config.json",
+- package = "google.cloud.bigquery.dataexchange.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "analyticshub_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigquery-dataexchange-v1beta1-nodejs",
+- deps = [
+- ":dataexchange_nodejs_gapic",
+- ":dataexchange_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "dataexchange_ruby_proto",
+- deps = [":dataexchange_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "dataexchange_ruby_grpc",
+- srcs = [":dataexchange_proto"],
+- deps = [":dataexchange_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "dataexchange_ruby_gapic",
+- srcs = [":dataexchange_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=analyticshub.googleapis.com",
+- "ruby-cloud-api-shortname=analyticshub",
+- "ruby-cloud-gem-name=google-cloud-bigquery-data_exchange-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/analytics-hub/",
+- ],
+- grpc_service_config = "analyticshub_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Analytics Hub is a data exchange that allows you to efficiently and securely exchange data assets across organizations to address challenges of data reliability and cost. Curate a library of internal and external assets, including unique datasets like Google Trends, backed by the power of BigQuery.",
+- ruby_cloud_title = "Analytics Hub V1beta1",
+- service_yaml = "analyticshub_v1beta1.yaml",
+- deps = [
+- ":dataexchange_ruby_grpc",
+- ":dataexchange_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-dataexchange-v1beta1-ruby",
+- deps = [
+- ":dataexchange_ruby_gapic",
+- ":dataexchange_ruby_grpc",
+- ":dataexchange_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "dataexchange_csharp_proto",
+- deps = [":dataexchange_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "dataexchange_csharp_grpc",
+- srcs = [":dataexchange_proto"],
+- deps = [":dataexchange_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "dataexchange_csharp_gapic",
+- srcs = [":dataexchange_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "analyticshub_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "analyticshub_v1beta1.yaml",
+- deps = [
+- ":dataexchange_csharp_grpc",
+- ":dataexchange_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-dataexchange-v1beta1-csharp",
+- deps = [
+- ":dataexchange_csharp_gapic",
+- ":dataexchange_csharp_grpc",
+- ":dataexchange_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "dataexchange_cc_proto",
+- deps = [":dataexchange_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "dataexchange_cc_grpc",
+- srcs = [":dataexchange_proto"],
+- grpc_only = True,
+- deps = [":dataexchange_cc_proto"],
+-)
+diff -urN a/google/cloud/bigquery/datapolicies/BUILD.bazel b/google/cloud/bigquery/datapolicies/BUILD.bazel
+--- a/google/cloud/bigquery/datapolicies/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/datapolicies/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-bigquery-data_policies.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for bigquerydatapolicy.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta1 in this case.
+-ruby_cloud_gapic_library(
+- name = "bigquerydatapolicy_ruby_wrapper",
+- srcs = ["//google/cloud/bigquery/datapolicies/v1beta1:datapolicies_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-bigquery-data_policies",
+- "ruby-cloud-wrapper-of=v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/bigquery",
+- "ruby-cloud-api-id=bigquerydatapolicy.googleapis.com",
+- "ruby-cloud-api-shortname=bigquerydatapolicy",
+- ],
+- ruby_cloud_description = "The Data Policy Service provides APIs for managing the BigQuery label-policy bindings.",
+- ruby_cloud_title = "BigQuery Data Policy Service V1beta1",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-datapolicies-ruby",
+- deps = [
+- ":bigquerydatapolicy_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/bigquery/datapolicies/v1/BUILD.bazel b/google/cloud/bigquery/datapolicies/v1/BUILD.bazel
+--- a/google/cloud/bigquery/datapolicies/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/datapolicies/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,391 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "datapolicies_proto",
+- srcs = [
+- "datapolicy.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "datapolicies_proto_with_info",
+- deps = [
+- ":datapolicies_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "datapolicies_java_proto",
+- deps = [":datapolicies_proto"],
+-)
+-
+-java_grpc_library(
+- name = "datapolicies_java_grpc",
+- srcs = [":datapolicies_proto"],
+- deps = [":datapolicies_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "datapolicies_java_gapic",
+- srcs = [":datapolicies_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "datapolicies_v1_grpc_service_config.json",
+- rest_numeric_enums = True,
+- service_yaml = "bigquerydatapolicy_v1.yaml",
+- test_deps = [
+- ":datapolicies_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":datapolicies_java_proto",
+- "//google/api:api_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "datapolicies_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigquery.datapolicies.v1.DataPolicyServiceClientHttpJsonTest",
+- "com.google.cloud.bigquery.datapolicies.v1.DataPolicyServiceClientTest",
+- ],
+- runtime_deps = [":datapolicies_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigquery-datapolicies-v1-java",
+- transport = "grpc+rest",
+- deps = [
+- ":datapolicies_java_gapic",
+- ":datapolicies_java_grpc",
+- ":datapolicies_java_proto",
+- ":datapolicies_proto",
+- ],
+- include_samples = True,
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "datapolicies_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/datapolicies/v1",
+- protos = [":datapolicies_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "datapolicies_go_gapic",
+- srcs = [":datapolicies_proto_with_info"],
+- grpc_service_config = "datapolicies_v1_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigquery/datapolicies/apiv1;datapolicies",
+- metadata = True,
+- rest_numeric_enums = True,
+- service_yaml = "bigquerydatapolicy_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datapolicies_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "datapolicies_go_gapic_test",
+- srcs = [":datapolicies_go_gapic_srcjar_test"],
+- embed = [":datapolicies_go_gapic"],
+- importpath = "cloud.google.com/go/bigquery/datapolicies/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigquery-datapolicies-v1-go",
+- deps = [
+- ":datapolicies_go_gapic",
+- ":datapolicies_go_gapic_srcjar-test.srcjar",
+- ":datapolicies_go_gapic_srcjar-metadata.srcjar",
+- ":datapolicies_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "datapolicies_py_gapic",
+- srcs = [":datapolicies_proto"],
+- grpc_service_config = "datapolicies_v1_grpc_service_config.json",
+- rest_numeric_enums = True,
+- service_yaml = "bigquerydatapolicy_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "datapolicies_py_gapic_test",
+- srcs = [
+- "datapolicies_py_gapic_pytest.py",
+- "datapolicies_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":datapolicies_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "bigquery-datapolicies-v1-py",
+- deps = [
+- ":datapolicies_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "datapolicies_php_proto",
+- deps = [":datapolicies_proto"],
+-)
+-
+-php_grpc_library(
+- name = "datapolicies_php_grpc",
+- srcs = [":datapolicies_proto"],
+- deps = [":datapolicies_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "datapolicies_php_gapic",
+- srcs = [":datapolicies_proto_with_info"],
+- grpc_service_config = "datapolicies_v1_grpc_service_config.json",
+- rest_numeric_enums = True,
+- service_yaml = "bigquerydatapolicy_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datapolicies_php_grpc",
+- ":datapolicies_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-datapolicies-v1-php",
+- deps = [
+- ":datapolicies_php_gapic",
+- ":datapolicies_php_grpc",
+- ":datapolicies_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "datapolicies_nodejs_gapic",
+- package_name = "@google-cloud/datapolicies",
+- src = ":datapolicies_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "datapolicies_v1_grpc_service_config.json",
+- package = "google.cloud.bigquery.datapolicies.v1",
+- rest_numeric_enums = True,
+- service_yaml = "bigquerydatapolicy_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigquery-datapolicies-v1-nodejs",
+- deps = [
+- ":datapolicies_nodejs_gapic",
+- ":datapolicies_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_gapic_assembly_pkg",
+- "ruby_cloud_gapic_library",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "datapolicies_ruby_proto",
+- deps = [":datapolicies_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "datapolicies_ruby_grpc",
+- srcs = [":datapolicies_proto"],
+- deps = [":datapolicies_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "datapolicies_ruby_gapic",
+- srcs = [":datapolicies_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-bigquery-datapolicies-v1",
+- ],
+- grpc_service_config = "datapolicies_v1_grpc_service_config.json",
+- rest_numeric_enums = True,
+- service_yaml = "bigquerydatapolicy_v1.yaml",
+- deps = [
+- ":datapolicies_ruby_grpc",
+- ":datapolicies_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-datapolicies-v1-ruby",
+- deps = [
+- ":datapolicies_ruby_gapic",
+- ":datapolicies_ruby_grpc",
+- ":datapolicies_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "datapolicies_csharp_proto",
+- deps = [":datapolicies_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "datapolicies_csharp_grpc",
+- srcs = [":datapolicies_proto"],
+- deps = [":datapolicies_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "datapolicies_csharp_gapic",
+- srcs = [":datapolicies_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "datapolicies_v1_grpc_service_config.json",
+- rest_numeric_enums = True,
+- service_yaml = "bigquerydatapolicy_v1.yaml",
+- deps = [
+- ":datapolicies_csharp_grpc",
+- ":datapolicies_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-datapolicies-v1-csharp",
+- deps = [
+- ":datapolicies_csharp_gapic",
+- ":datapolicies_csharp_grpc",
+- ":datapolicies_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "datapolicies_cc_proto",
+- deps = [":datapolicies_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "datapolicies_cc_grpc",
+- srcs = [":datapolicies_proto"],
+- grpc_only = True,
+- deps = [":datapolicies_cc_proto"],
+-)
+diff -urN a/google/cloud/bigquery/datapolicies/v1beta1/BUILD.bazel b/google/cloud/bigquery/datapolicies/v1beta1/BUILD.bazel
+--- a/google/cloud/bigquery/datapolicies/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/datapolicies/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,396 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "datapolicies_proto",
+- srcs = [
+- "datapolicy.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "datapolicies_proto_with_info",
+- deps = [
+- ":datapolicies_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "datapolicies_java_proto",
+- deps = [":datapolicies_proto"],
+-)
+-
+-java_grpc_library(
+- name = "datapolicies_java_grpc",
+- srcs = [":datapolicies_proto"],
+- deps = [":datapolicies_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "datapolicies_java_gapic",
+- srcs = [":datapolicies_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "datapolicies_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerydatapolicy_v1beta1.yaml",
+- test_deps = [
+- ":datapolicies_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":datapolicies_java_proto",
+- "//google/api:api_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "datapolicies_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigquery.datapolicies.v1beta1.DataPolicyServiceClientHttpJsonTest",
+- "com.google.cloud.bigquery.datapolicies.v1beta1.DataPolicyServiceClientTest",
+- ],
+- runtime_deps = [":datapolicies_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigquery-datapolicies-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":datapolicies_java_gapic",
+- ":datapolicies_java_grpc",
+- ":datapolicies_java_proto",
+- ":datapolicies_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "datapolicies_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/datapolicies/v1beta1",
+- protos = [":datapolicies_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "datapolicies_go_gapic",
+- srcs = [":datapolicies_proto_with_info"],
+- grpc_service_config = "datapolicies_v1beta1_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigquery/datapolicies/apiv1beta1;datapolicies",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "bigquerydatapolicy_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datapolicies_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "datapolicies_go_gapic_test",
+- srcs = [":datapolicies_go_gapic_srcjar_test"],
+- embed = [":datapolicies_go_gapic"],
+- importpath = "cloud.google.com/go/bigquery/datapolicies/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigquery-datapolicies-v1beta1-go",
+- deps = [
+- ":datapolicies_go_gapic",
+- ":datapolicies_go_gapic_srcjar-metadata.srcjar",
+- ":datapolicies_go_gapic_srcjar-test.srcjar",
+- ":datapolicies_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "datapolicies_py_gapic",
+- srcs = [":datapolicies_proto"],
+- grpc_service_config = "datapolicies_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerydatapolicy_v1beta1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "datapolicies_py_gapic_test",
+- srcs = [
+- "datapolicies_py_gapic_pytest.py",
+- "datapolicies_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":datapolicies_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "bigquery-datapolicies-v1beta1-py",
+- deps = [
+- ":datapolicies_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "datapolicies_php_proto",
+- deps = [":datapolicies_proto"],
+-)
+-
+-php_grpc_library(
+- name = "datapolicies_php_grpc",
+- srcs = [":datapolicies_proto"],
+- deps = [":datapolicies_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "datapolicies_php_gapic",
+- srcs = [":datapolicies_proto_with_info"],
+- grpc_service_config = "datapolicies_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerydatapolicy_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datapolicies_php_grpc",
+- ":datapolicies_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-datapolicies-v1beta1-php",
+- deps = [
+- ":datapolicies_php_gapic",
+- ":datapolicies_php_grpc",
+- ":datapolicies_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "datapolicies_nodejs_gapic",
+- package_name = "@google-cloud/bigquery-datapolicies",
+- src = ":datapolicies_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "datapolicies_v1beta1_grpc_service_config.json",
+- package = "google.cloud.bigquery.datapolicies.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerydatapolicy_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigquery-datapolicies-v1beta1-nodejs",
+- deps = [
+- ":datapolicies_nodejs_gapic",
+- ":datapolicies_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "datapolicies_ruby_proto",
+- deps = [":datapolicies_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "datapolicies_ruby_grpc",
+- srcs = [":datapolicies_proto"],
+- deps = [":datapolicies_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "datapolicies_ruby_gapic",
+- srcs = [":datapolicies_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=bigquerydatapolicy.googleapis.com",
+- "ruby-cloud-api-shortname=bigquerydatapolicy",
+- "ruby-cloud-gem-name=google-cloud-bigquery-data_policies-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/bigquery/docs",
+- ],
+- grpc_service_config = "datapolicies_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Data Policy Service provides APIs for managing the BigQuery label-policy bindings.",
+- ruby_cloud_title = "BigQuery Data Policy Service V1beta1",
+- service_yaml = "bigquerydatapolicy_v1beta1.yaml",
+- deps = [
+- ":datapolicies_ruby_grpc",
+- ":datapolicies_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-datapolicies-v1beta1-ruby",
+- deps = [
+- ":datapolicies_ruby_gapic",
+- ":datapolicies_ruby_grpc",
+- ":datapolicies_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "datapolicies_csharp_proto",
+- deps = [":datapolicies_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "datapolicies_csharp_grpc",
+- srcs = [":datapolicies_proto"],
+- deps = [":datapolicies_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "datapolicies_csharp_gapic",
+- srcs = [":datapolicies_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "datapolicies_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerydatapolicy_v1beta1.yaml",
+- deps = [
+- ":datapolicies_csharp_grpc",
+- ":datapolicies_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-datapolicies-v1beta1-csharp",
+- deps = [
+- ":datapolicies_csharp_gapic",
+- ":datapolicies_csharp_grpc",
+- ":datapolicies_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "datapolicies_cc_proto",
+- deps = [":datapolicies_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "datapolicies_cc_grpc",
+- srcs = [":datapolicies_proto"],
+- grpc_only = True,
+- deps = [":datapolicies_cc_proto"],
+-)
+diff -urN a/google/cloud/bigquery/datatransfer/BUILD.bazel b/google/cloud/bigquery/datatransfer/BUILD.bazel
+--- a/google/cloud/bigquery/datatransfer/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/datatransfer/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-bigquery-data_transfer.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for bigquerydatatransfer.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "bigquerydatatransfer_ruby_wrapper",
+- srcs = ["//google/cloud/bigquery/datatransfer/v1:datatransfer_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-bigquery-data_transfer",
+- "ruby-cloud-env-prefix=DATA_TRANSFER",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/bigquery/transfer",
+- "ruby-cloud-api-id=bigquerydatatransfer.googleapis.com",
+- "ruby-cloud-api-shortname=bigquerydatatransfer",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "Schedules queries and transfers external data from SaaS applications to Google BigQuery on a regular basis.",
+- ruby_cloud_title = "BigQuery Data Transfer Service",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-datatransfer-ruby",
+- deps = [
+- ":bigquerydatatransfer_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/bigquery/datatransfer/v1/BUILD.bazel b/google/cloud/bigquery/datatransfer/v1/BUILD.bazel
+--- a/google/cloud/bigquery/datatransfer/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/datatransfer/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,384 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "datatransfer_proto",
+- srcs = [
+- "datatransfer.proto",
+- "transfer.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "datatransfer_proto_with_info",
+- deps = [
+- ":datatransfer_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "datatransfer_java_proto",
+- deps = [":datatransfer_proto"],
+-)
+-
+-java_grpc_library(
+- name = "datatransfer_java_grpc",
+- srcs = [":datatransfer_proto"],
+- deps = [":datatransfer_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "datatransfer_java_gapic",
+- srcs = [":datatransfer_proto_with_info"],
+- grpc_service_config = "bigquerydatatransfer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":datatransfer_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":datatransfer_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "datatransfer_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClientHttpJsonTest",
+- "com.google.cloud.bigquery.datatransfer.v1.DataTransferServiceClientTest",
+- ],
+- runtime_deps = [":datatransfer_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigquery-datatransfer-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":datatransfer_java_gapic",
+- ":datatransfer_java_grpc",
+- ":datatransfer_java_proto",
+- ":datatransfer_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "datatransfer_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1",
+- protos = [":datatransfer_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "datatransfer_go_gapic",
+- srcs = [":datatransfer_proto_with_info"],
+- grpc_service_config = "bigquerydatatransfer_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigquery/datatransfer/apiv1;datatransfer",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerydatatransfer_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datatransfer_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "datatransfer_go_gapic_test",
+- srcs = [":datatransfer_go_gapic_srcjar_test"],
+- embed = [":datatransfer_go_gapic"],
+- importpath = "cloud.google.com/go/bigquery/datatransfer/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigquery-datatransfer-v1-go",
+- deps = [
+- ":datatransfer_go_gapic",
+- ":datatransfer_go_gapic_srcjar-test.srcjar",
+- ":datatransfer_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "datatransfer_py_gapic",
+- srcs = [":datatransfer_proto"],
+- grpc_service_config = "bigquerydatatransfer_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=bigquery_datatransfer",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "datatransfer_py_gapic_test",
+- srcs = [
+- "datatransfer_py_gapic_pytest.py",
+- "datatransfer_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":datatransfer_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "bigquery-datatransfer-v1-py",
+- deps = [
+- ":datatransfer_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "datatransfer_php_proto",
+- deps = [":datatransfer_proto"],
+-)
+-
+-php_grpc_library(
+- name = "datatransfer_php_grpc",
+- srcs = [":datatransfer_proto"],
+- deps = [":datatransfer_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "datatransfer_php_gapic",
+- srcs = [":datatransfer_proto_with_info"],
+- grpc_service_config = "bigquerydatatransfer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":datatransfer_php_grpc",
+- ":datatransfer_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-datatransfer-v1-php",
+- deps = [
+- ":datatransfer_php_gapic",
+- ":datatransfer_php_grpc",
+- ":datatransfer_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "datatransfer_nodejs_gapic",
+- package_name = "@google-cloud/bigquery-data-transfer",
+- src = ":datatransfer_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "bigquerydatatransfer_grpc_service_config.json",
+- package = "google.cloud.bigquery.datatransfer.v1",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerydatatransfer_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigquery-datatransfer-v1-nodejs",
+- deps = [
+- ":datatransfer_nodejs_gapic",
+- ":datatransfer_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "datatransfer_ruby_proto",
+- deps = [":datatransfer_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "datatransfer_ruby_grpc",
+- srcs = [":datatransfer_proto"],
+- deps = [":datatransfer_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "datatransfer_ruby_gapic",
+- srcs = [":datatransfer_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-bigquery-data_transfer-v1",
+- "ruby-cloud-env-prefix=DATA_TRANSFER",
+- "ruby-cloud-yard-strict=false",
+- "ruby-cloud-product-url=https://cloud.google.com/bigquery/transfer",
+- "ruby-cloud-api-id=bigquerydatatransfer.googleapis.com",
+- "ruby-cloud-api-shortname=bigquerydatatransfer",
+- ],
+- grpc_service_config = "bigquerydatatransfer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Schedules queries and transfers external data from SaaS applications to Google BigQuery on a regular basis.",
+- ruby_cloud_title = "BigQuery Data Transfer Service V1",
+- deps = [
+- ":datatransfer_ruby_grpc",
+- ":datatransfer_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-datatransfer-v1-ruby",
+- deps = [
+- ":datatransfer_ruby_gapic",
+- ":datatransfer_ruby_grpc",
+- ":datatransfer_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "datatransfer_csharp_proto",
+- deps = [":datatransfer_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "datatransfer_csharp_grpc",
+- srcs = [":datatransfer_proto"],
+- deps = [":datatransfer_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "datatransfer_csharp_gapic",
+- srcs = [":datatransfer_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "bigquerydatatransfer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerydatatransfer_v1.yaml",
+- deps = [
+- ":datatransfer_csharp_grpc",
+- ":datatransfer_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-datatransfer-v1-csharp",
+- deps = [
+- ":datatransfer_csharp_gapic",
+- ":datatransfer_csharp_grpc",
+- ":datatransfer_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "datatransfer_cc_proto",
+- deps = [":datatransfer_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "datatransfer_cc_grpc",
+- srcs = [":datatransfer_proto"],
+- grpc_only = True,
+- deps = [":datatransfer_cc_proto"],
+-)
+diff -urN a/google/cloud/bigquery/logging/v1/BUILD.bazel b/google/cloud/bigquery/logging/v1/BUILD.bazel
+--- a/google/cloud/bigquery/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,181 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "audit_data.proto",
+- ],
+- deps = [
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/iam/v1:iam_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "logging_py_gapic",
+- srcs = [":logging_proto"],
+- opt_args = [
+- "warehouse-package-name=google-cloud-bigquery-logging",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=bigquery_logging",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-logging-v1-py",
+- deps = [
+- ":logging_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/bigquery/migration/BUILD.bazel b/google/cloud/bigquery/migration/BUILD.bazel
+--- a/google/cloud/bigquery/migration/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/migration/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-bigquery-migration.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for bigquerymigration.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v2 in this case.
+-ruby_cloud_gapic_library(
+- name = "migration_ruby_wrapper",
+- srcs = ["//google/cloud/bigquery/migration/v2:migration_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-bigquery-migration",
+- "ruby-cloud-wrapper-of=v2:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/bigquery/docs/reference/migration",
+- "ruby-cloud-api-id=bigquerymigration.googleapis.com",
+- "ruby-cloud-api-shortname=bigquerymigration",
+- ],
+- ruby_cloud_description = "The BigQuery Migration Service is a comprehensive solution for migrating your data warehouse to BigQuery.",
+- ruby_cloud_title = "BigQuery Migration",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-migration-ruby",
+- deps = [
+- ":migration_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/bigquery/migration/v2/BUILD.bazel b/google/cloud/bigquery/migration/v2/BUILD.bazel
+--- a/google/cloud/bigquery/migration/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/migration/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,401 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "migration_proto",
+- srcs = [
+- "migration_entities.proto",
+- "migration_error_details.proto",
+- "migration_metrics.proto",
+- "migration_service.proto",
+- "translation_config.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:distribution_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:metric_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:error_details_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "migration_proto_with_info",
+- deps = [
+- ":migration_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "migration_java_proto",
+- deps = [":migration_proto"],
+-)
+-
+-java_grpc_library(
+- name = "migration_java_grpc",
+- srcs = [":migration_proto"],
+- deps = [":migration_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "migration_java_gapic",
+- srcs = [":migration_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "bigquerymigration_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerymigration_v2.yaml",
+- test_deps = [
+- ":migration_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":migration_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "migration_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigquery.migration.v2.MigrationServiceClientHttpJsonTest",
+- "com.google.cloud.bigquery.migration.v2.MigrationServiceClientTest",
+- ],
+- runtime_deps = [":migration_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigquery-migration-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":migration_java_gapic",
+- ":migration_java_grpc",
+- ":migration_java_proto",
+- ":migration_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "migration_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2",
+- protos = [":migration_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:distribution_go_proto",
+- "//google/api:metric_go_proto",
+- "//google/rpc:errdetails_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "migration_go_gapic",
+- srcs = [":migration_proto_with_info"],
+- grpc_service_config = "bigquerymigration_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigquery/migration/apiv2;migration",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "bigquerymigration_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":migration_go_proto",
+- "//google/api:metric_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "migration_go_gapic_test",
+- srcs = [":migration_go_gapic_srcjar_test"],
+- embed = [":migration_go_gapic"],
+- importpath = "cloud.google.com/go/bigquery/migration/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigquery-migration-v2-go",
+- deps = [
+- ":migration_go_gapic",
+- ":migration_go_gapic_srcjar-metadata.srcjar",
+- ":migration_go_gapic_srcjar-test.srcjar",
+- ":migration_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "migration_py_gapic",
+- srcs = [":migration_proto"],
+- grpc_service_config = "bigquerymigration_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=bigquery_migration",
+- "python-gapic-namespace=google.cloud",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "migration_py_gapic_test",
+- srcs = [
+- "migration_py_gapic_pytest.py",
+- "migration_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":migration_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "bigquery-migration-v2-py",
+- deps = [
+- ":migration_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "migration_php_proto",
+- deps = [":migration_proto"],
+-)
+-
+-php_grpc_library(
+- name = "migration_php_grpc",
+- srcs = [":migration_proto"],
+- deps = [":migration_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "migration_php_gapic",
+- srcs = [":migration_proto_with_info"],
+- grpc_service_config = "bigquerymigration_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerymigration_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":migration_php_grpc",
+- ":migration_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-migration-v2-php",
+- deps = [
+- ":migration_php_gapic",
+- ":migration_php_grpc",
+- ":migration_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "migration_nodejs_gapic",
+- package_name = "@google-cloud/bigquery-migration",
+- src = ":migration_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "bigquerymigration_grpc_service_config.json",
+- package = "google.cloud.bigquery.migration.v2",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerymigration_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigquery-migration-v2-nodejs",
+- deps = [
+- ":migration_nodejs_gapic",
+- ":migration_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "migration_ruby_proto",
+- deps = [":migration_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "migration_ruby_grpc",
+- srcs = [":migration_proto"],
+- deps = [":migration_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "migration_ruby_gapic",
+- srcs = [":migration_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-bigquery-migration-v2",
+- "ruby-cloud-product-url=https://cloud.google.com/bigquery/docs/reference/migration",
+- "ruby-cloud-api-id=bigquerymigration.googleapis.com",
+- "ruby-cloud-api-shortname=bigquerymigration",
+- ],
+- grpc_service_config = "bigquerymigration_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The BigQuery Migration Service is a comprehensive solution for migrating your data warehouse to BigQuery.",
+- ruby_cloud_title = "BigQuery Migration V2",
+- deps = [
+- ":migration_ruby_grpc",
+- ":migration_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-migration-v2-ruby",
+- deps = [
+- ":migration_ruby_gapic",
+- ":migration_ruby_grpc",
+- ":migration_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "migration_csharp_proto",
+- deps = [":migration_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "migration_csharp_grpc",
+- srcs = [":migration_proto"],
+- deps = [":migration_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "migration_csharp_gapic",
+- srcs = [":migration_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "bigquerymigration_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerymigration_v2.yaml",
+- deps = [
+- ":migration_csharp_grpc",
+- ":migration_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-migration-v2-csharp",
+- deps = [
+- ":migration_csharp_gapic",
+- ":migration_csharp_grpc",
+- ":migration_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "migration_cc_proto",
+- deps = [":migration_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "migration_cc_grpc",
+- srcs = [":migration_proto"],
+- grpc_only = True,
+- deps = [":migration_cc_proto"],
+-)
+diff -urN a/google/cloud/bigquery/migration/v2alpha/BUILD.bazel b/google/cloud/bigquery/migration/v2alpha/BUILD.bazel
+--- a/google/cloud/bigquery/migration/v2alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/migration/v2alpha/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,377 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "migration_proto",
+- srcs = [
+- "assessment_task.proto",
+- "migration_entities.proto",
+- "migration_error_details.proto",
+- "migration_metrics.proto",
+- "migration_service.proto",
+- "translation_task.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:distribution_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:metric_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:error_details_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "migration_proto_with_info",
+- deps = [
+- ":migration_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "migration_java_proto",
+- deps = [":migration_proto"],
+-)
+-
+-java_grpc_library(
+- name = "migration_java_grpc",
+- srcs = [":migration_proto"],
+- deps = [":migration_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "migration_java_gapic",
+- srcs = [":migration_proto_with_info"],
+- grpc_service_config = "bigquerymigration_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":migration_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":migration_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "migration_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigquery.migration.v2alpha.MigrationServiceClientHttpJsonTest",
+- "com.google.cloud.bigquery.migration.v2alpha.MigrationServiceClientTest",
+- ],
+- runtime_deps = [":migration_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigquery-migration-v2alpha-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":migration_java_gapic",
+- ":migration_java_grpc",
+- ":migration_java_proto",
+- ":migration_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "migration_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha",
+- protos = [":migration_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:distribution_go_proto",
+- "//google/api:metric_go_proto",
+- "//google/rpc:errdetails_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "migration_go_gapic",
+- srcs = [":migration_proto_with_info"],
+- grpc_service_config = "bigquerymigration_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigquery/migration/apiv2alpha;migration",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "bigquerymigration_v2alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":migration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "migration_go_gapic_test",
+- srcs = [":migration_go_gapic_srcjar_test"],
+- embed = [":migration_go_gapic"],
+- importpath = "cloud.google.com/go/bigquery/migration/apiv2alpha",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigquery-migration-v2alpha-go",
+- deps = [
+- ":migration_go_gapic",
+- ":migration_go_gapic_srcjar-metadata.srcjar",
+- ":migration_go_gapic_srcjar-test.srcjar",
+- ":migration_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "migration_py_gapic",
+- srcs = [":migration_proto"],
+- grpc_service_config = "bigquerymigration_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=bigquery_migration",
+- "python-gapic-namespace=google.cloud",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "migration_py_gapic_test",
+- srcs = [
+- "migration_py_gapic_pytest.py",
+- "migration_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":migration_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "bigquery-migration-v2alpha-py",
+- deps = [
+- ":migration_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "migration_php_proto",
+- deps = [":migration_proto"],
+-)
+-
+-php_grpc_library(
+- name = "migration_php_grpc",
+- srcs = [":migration_proto"],
+- deps = [":migration_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "migration_php_gapic",
+- srcs = [":migration_proto_with_info"],
+- grpc_service_config = "bigquerymigration_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerymigration_v2alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":migration_php_grpc",
+- ":migration_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-migration-v2alpha-php",
+- deps = [
+- ":migration_php_gapic",
+- ":migration_php_grpc",
+- ":migration_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "migration_nodejs_gapic",
+- package_name = "@google-cloud/bigquery-migration",
+- src = ":migration_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "bigquerymigration_grpc_service_config.json",
+- package = "google.cloud.bigquery.migration.v2alpha",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerymigration_v2alpha.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigquery-migration-v2alpha-nodejs",
+- deps = [
+- ":migration_nodejs_gapic",
+- ":migration_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "migration_ruby_proto",
+- deps = [":migration_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "migration_ruby_grpc",
+- srcs = [":migration_proto"],
+- deps = [":migration_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "migration_ruby_gapic",
+- srcs = [":migration_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-bigquery-migration-v2alpha",
+- ],
+- grpc_service_config = "bigquerymigration_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":migration_ruby_grpc",
+- ":migration_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-migration-v2alpha-ruby",
+- deps = [
+- ":migration_ruby_gapic",
+- ":migration_ruby_grpc",
+- ":migration_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "migration_csharp_proto",
+- deps = [":migration_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "migration_csharp_grpc",
+- srcs = [":migration_proto"],
+- deps = [":migration_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "migration_csharp_gapic",
+- srcs = [":migration_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "bigquerymigration_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":migration_csharp_grpc",
+- ":migration_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-migration-v2alpha-csharp",
+- deps = [
+- ":migration_csharp_gapic",
+- ":migration_csharp_grpc",
+- ":migration_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/bigquery/reservation/BUILD.bazel b/google/cloud/bigquery/reservation/BUILD.bazel
+--- a/google/cloud/bigquery/reservation/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/reservation/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-bigquery-reservation.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for bigqueryreservation.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "bigqueryreservation_ruby_wrapper",
+- srcs = ["//google/cloud/bigquery/reservation/v1:reservation_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-bigquery-reservation",
+- "ruby-cloud-env-prefix=BIGQUERY_RESERVATION",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/bigquery/docs/reference/reservations",
+- "ruby-cloud-api-id=bigqueryreservation.googleapis.com",
+- "ruby-cloud-api-shortname=bigqueryreservation",
+- ],
+- ruby_cloud_description = "The BigQuery Reservation API provides the mechanisms by which enterprise users can provision and manage dedicated resources such as slots and BigQuery BI Engine memory allocations.",
+- ruby_cloud_title = "BigQuery Reservation",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-reservation-ruby",
+- deps = [
+- ":bigqueryreservation_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/bigquery/reservation/v1/BUILD.bazel b/google/cloud/bigquery/reservation/v1/BUILD.bazel
+--- a/google/cloud/bigquery/reservation/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/reservation/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,393 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "reservation_proto",
+- srcs = [
+- "reservation.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "reservation_proto_with_info",
+- deps = [
+- ":reservation_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "reservation_java_proto",
+- deps = [":reservation_proto"],
+-)
+-
+-java_grpc_library(
+- name = "reservation_java_grpc",
+- srcs = [":reservation_proto"],
+- deps = [":reservation_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "reservation_java_gapic",
+- srcs = [":reservation_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "bigqueryreservation_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigqueryreservation_v1.yaml",
+- test_deps = [
+- ":reservation_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":reservation_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "reservation_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigquery.reservation.v1.ReservationServiceClientHttpJsonTest",
+- "com.google.cloud.bigquery.reservation.v1.ReservationServiceClientTest",
+- ],
+- runtime_deps = [":reservation_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigquery-reservation-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":reservation_java_gapic",
+- ":reservation_java_grpc",
+- ":reservation_java_proto",
+- ":reservation_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "reservation_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/reservation/v1",
+- protos = [":reservation_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "reservation_go_gapic",
+- srcs = [":reservation_proto_with_info"],
+- grpc_service_config = "bigqueryreservation_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigquery/reservation/apiv1;reservation",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "bigqueryreservation_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":reservation_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "reservation_go_gapic_test",
+- srcs = [":reservation_go_gapic_srcjar_test"],
+- embed = [":reservation_go_gapic"],
+- importpath = "cloud.google.com/go/bigquery/reservation/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigquery-reservation-v1-go",
+- deps = [
+- ":reservation_go_gapic",
+- ":reservation_go_gapic_srcjar-metadata.srcjar",
+- ":reservation_go_gapic_srcjar-test.srcjar",
+- ":reservation_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "reservation_py_gapic",
+- srcs = [":reservation_proto"],
+- grpc_service_config = "bigqueryreservation_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=bigquery_reservation",
+- "python-gapic-namespace=google.cloud",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "reservation_py_gapic_test",
+- srcs = [
+- "reservation_py_gapic_pytest.py",
+- "reservation_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":reservation_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "bigquery-reservation-v1-py",
+- deps = [
+- ":reservation_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "reservation_php_proto",
+- deps = [":reservation_proto"],
+-)
+-
+-php_grpc_library(
+- name = "reservation_php_grpc",
+- srcs = [":reservation_proto"],
+- deps = [":reservation_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "reservation_php_gapic",
+- srcs = [":reservation_proto_with_info"],
+- grpc_service_config = "bigqueryreservation_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigqueryreservation_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":reservation_php_grpc",
+- ":reservation_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-reservation-v1-php",
+- deps = [
+- ":reservation_php_gapic",
+- ":reservation_php_grpc",
+- ":reservation_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "reservation_nodejs_gapic",
+- package_name = "@google-cloud/bigquery-reservation",
+- src = ":reservation_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "bigqueryreservation_grpc_service_config.json",
+- package = "google.cloud.bigquery.reservation.v1",
+- rest_numeric_enums = False,
+- service_yaml = "bigqueryreservation_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigquery-reservation-v1-nodejs",
+- deps = [
+- ":reservation_nodejs_gapic",
+- ":reservation_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "reservation_ruby_proto",
+- deps = [":reservation_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "reservation_ruby_grpc",
+- srcs = [":reservation_proto"],
+- deps = [":reservation_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "reservation_ruby_gapic",
+- srcs = [":reservation_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=bigqueryreservation.googleapis.com",
+- "ruby-cloud-api-shortname=bigqueryreservation",
+- "ruby-cloud-env-prefix=BIGQUERY_RESERVATION",
+- "ruby-cloud-gem-name=google-cloud-bigquery-reservation-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/bigquery/docs/reference/reservations",
+- ],
+- grpc_service_config = "bigqueryreservation_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The BigQuery Reservation API provides the mechanisms by which enterprise users can provision and manage dedicated resources such as slots and BigQuery BI Engine memory allocations.",
+- ruby_cloud_title = "BigQuery Reservation V1",
+- deps = [
+- ":reservation_ruby_grpc",
+- ":reservation_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-reservation-v1-ruby",
+- deps = [
+- ":reservation_ruby_gapic",
+- ":reservation_ruby_grpc",
+- ":reservation_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "reservation_csharp_proto",
+- deps = [":reservation_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "reservation_csharp_grpc",
+- srcs = [":reservation_proto"],
+- deps = [":reservation_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "reservation_csharp_gapic",
+- srcs = [":reservation_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "bigqueryreservation_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigqueryreservation_v1.yaml",
+- deps = [
+- ":reservation_csharp_grpc",
+- ":reservation_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-reservation-v1-csharp",
+- deps = [
+- ":reservation_csharp_gapic",
+- ":reservation_csharp_grpc",
+- ":reservation_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "reservation_cc_proto",
+- deps = [":reservation_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "reservation_cc_grpc",
+- srcs = [":reservation_proto"],
+- grpc_only = True,
+- deps = [":reservation_cc_proto"],
+-)
+diff -urN a/google/cloud/bigquery/storage/BUILD.bazel b/google/cloud/bigquery/storage/BUILD.bazel
+--- a/google/cloud/bigquery/storage/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/storage/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-bigquery-storage.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for bigquerystorage.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "bigquerystorage_ruby_wrapper",
+- srcs = ["//google/cloud/bigquery/storage/v1:storage_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-bigquery-storage",
+- "ruby-cloud-env-prefix=BIGQUERY_STORAGE",
+- "ruby-cloud-wrapper-of=v1:0.8",
+- "ruby-cloud-product-url=https://cloud.google.com/bigquery/docs/reference/storage",
+- "ruby-cloud-api-id=bigquerystorage.googleapis.com",
+- "ruby-cloud-api-shortname=bigquerystorage",
+- ],
+- ruby_cloud_description = "The BigQuery Storage API provides fast access to BigQuery managed storage.",
+- ruby_cloud_title = "BigQuery Storage",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-storage-ruby",
+- deps = [
+- ":bigquerystorage_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/bigquery/storage/v1/BUILD.bazel b/google/cloud/bigquery/storage/v1/BUILD.bazel
+--- a/google/cloud/bigquery/storage/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/storage/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,336 +0,0 @@
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "storage_proto",
+- srcs = [
+- "annotations.proto",
+- "arrow.proto",
+- "avro.proto",
+- "protobuf.proto",
+- "storage.proto",
+- "stream.proto",
+- "table.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:descriptor_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "storage_proto_with_info",
+- deps = [
+- ":storage_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "storage_java_proto",
+- deps = [":storage_proto"],
+-)
+-
+-java_grpc_library(
+- name = "storage_java_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "storage_java_gapic",
+- srcs = [":storage_proto_with_info"],
+- gapic_yaml = "bigquerystorage_gapic.yaml",
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":storage_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":storage_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "storage_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigquery.storage.v1.BaseBigQueryReadClientTest",
+- ],
+- runtime_deps = [":storage_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigquery-storage-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":storage_java_gapic",
+- ":storage_java_grpc",
+- ":storage_java_proto",
+- ":storage_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "storage_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1",
+- protos = [":storage_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "storage_go_gapic",
+- srcs = [":storage_proto_with_info"],
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigquery/storage/apiv1;storage",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerystorage_v1.yaml",
+- deps = [
+- ":storage_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "storage_go_gapic_test",
+- srcs = [":storage_go_gapic_srcjar_test"],
+- embed = [":storage_go_gapic"],
+- importpath = "cloud.google.com/go/bigquery/storage/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigquery-storage-v1-go",
+- deps = [
+- ":storage_go_gapic",
+- ":storage_go_gapic_srcjar-test.srcjar",
+- ":storage_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-
+-py_gapic_library(
+- name = "storage_py_gapic",
+- srcs = [":storage_proto"],
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=bigquery_storage",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "storage_py_gapic_test",
+- srcs = [
+- "storage_py_gapic_pytest.py",
+- "storage_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":storage_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "bigquery-storage-v1-py",
+- deps = [
+- ":storage_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "storage_php_proto",
+- deps = [":storage_proto"],
+-)
+-
+-php_grpc_library(
+- name = "storage_php_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "storage_php_gapic",
+- srcs = [":storage_proto_with_info"],
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":storage_php_grpc",
+- ":storage_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-storage-v1-php",
+- deps = [
+- ":storage_php_gapic",
+- ":storage_php_grpc",
+- ":storage_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "storage_nodejs_gapic",
+- package_name = "@google-cloud/bigquery-storage",
+- src = ":storage_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- package = "google.cloud.bigquery.storage.v1",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerystorage_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigquery-storage-v1-nodejs",
+- deps = [
+- ":storage_nodejs_gapic",
+- ":storage_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-
+-ruby_proto_library(
+- name = "storage_ruby_proto",
+- deps = [":storage_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "storage_ruby_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "storage_ruby_gapic",
+- srcs = [":storage_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-bigquery-storage-v1",
+- "ruby-cloud-env-prefix=BIGQUERY_STORAGE",
+- "ruby-cloud-product-url=https://cloud.google.com/bigquery/docs/reference/storage",
+- "ruby-cloud-api-id=bigquerystorage.googleapis.com",
+- "ruby-cloud-api-shortname=bigquerystorage",
+- ],
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The BigQuery Storage API provides fast access to BigQuery managed storage.",
+- ruby_cloud_title = "BigQuery Storage V1",
+- deps = [
+- ":storage_ruby_grpc",
+- ":storage_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-storage-v1-ruby",
+- deps = [
+- ":storage_ruby_gapic",
+- ":storage_ruby_grpc",
+- ":storage_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "storage_csharp_proto",
+- deps = [":storage_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "storage_csharp_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "storage_csharp_gapic",
+- srcs = [":storage_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerystorage_v1.yaml",
+- deps = [
+- ":storage_csharp_grpc",
+- ":storage_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-storage-v1-csharp",
+- deps = [
+- ":storage_csharp_gapic",
+- ":storage_csharp_grpc",
+- ":storage_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "storage_cc_proto",
+- deps = [":storage_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "storage_cc_grpc",
+- srcs = [":storage_proto"],
+- generate_mocks = True,
+- grpc_only = True,
+- deps = [":storage_cc_proto"],
+-)
+diff -urN a/google/cloud/bigquery/storage/v1beta1/BUILD.bazel b/google/cloud/bigquery/storage/v1beta1/BUILD.bazel
+--- a/google/cloud/bigquery/storage/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/storage/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,312 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "storage_proto",
+- srcs = [
+- "arrow.proto",
+- "avro.proto",
+- "read_options.proto",
+- "storage.proto",
+- "table_reference.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "storage_proto_with_info",
+- deps = [
+- ":storage_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "storage_java_proto",
+- deps = [":storage_proto"],
+-)
+-
+-java_grpc_library(
+- name = "storage_java_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "storage_java_gapic",
+- srcs = [":storage_proto_with_info"],
+- gapic_yaml = "bigquerystorage_gapic.yaml",
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":storage_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":storage_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "storage_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigquery.storage.v1beta1.BaseBigQueryStorageClientTest",
+- ],
+- runtime_deps = [":storage_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigquery-storage-v1beta1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":storage_java_gapic",
+- ":storage_java_grpc",
+- ":storage_java_proto",
+- ":storage_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "storage_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1",
+- protos = [":storage_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "storage_go_gapic",
+- srcs = [":storage_proto_with_info"],
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigquery/storage/apiv1beta1;storage",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerystorage_v1beta1.yaml",
+- deps = [
+- ":storage_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "storage_go_gapic_test",
+- srcs = [":storage_go_gapic_srcjar_test"],
+- embed = [":storage_go_gapic"],
+- importpath = "cloud.google.com/go/bigquery/storage/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigquery-storage-v1beta1-go",
+- deps = [
+- ":storage_go_gapic",
+- ":storage_go_gapic_srcjar-test.srcjar",
+- ":storage_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "storage_py_gapic",
+- srcs = [":storage_proto"],
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "storage_py_gapic_test",
+- srcs = [
+- "storage_py_gapic_pytest.py",
+- "storage_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":storage_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "bigquery-storage-v1beta1-py",
+- deps = [
+- ":storage_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "storage_php_proto",
+- deps = [":storage_proto"],
+-)
+-
+-php_grpc_library(
+- name = "storage_php_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "storage_php_gapic",
+- srcs = [":storage_proto_with_info"],
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":storage_php_grpc",
+- ":storage_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-storage-v1beta1-php",
+- deps = [
+- ":storage_php_gapic",
+- ":storage_php_grpc",
+- ":storage_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "storage_nodejs_gapic",
+- package_name = "@google-cloud/bigquery-storage",
+- src = ":storage_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- package = "google.cloud.bigquery.storage.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerystorage_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigquery-storage-v1beta1-nodejs",
+- deps = [
+- ":storage_nodejs_gapic",
+- ":storage_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "storage_ruby_proto",
+- deps = [":storage_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "storage_ruby_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "storage_ruby_gapic",
+- srcs = [":storage_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-bigquery-storage-v1beta1"],
+- rest_numeric_enums = False,
+- deps = [
+- ":storage_ruby_grpc",
+- ":storage_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-storage-v1beta1-ruby",
+- deps = [
+- ":storage_ruby_gapic",
+- ":storage_ruby_grpc",
+- ":storage_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "storage_csharp_proto",
+- deps = [":storage_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "storage_csharp_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "storage_csharp_gapic",
+- srcs = [":storage_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerystorage_v1beta1.yaml",
+- deps = [
+- ":storage_csharp_grpc",
+- ":storage_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-storage-v1beta1-csharp",
+- deps = [
+- ":storage_csharp_gapic",
+- ":storage_csharp_grpc",
+- ":storage_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "storage_cc_proto",
+- deps = [":storage_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "storage_cc_grpc",
+- srcs = [":storage_proto"],
+- generate_mocks = True,
+- grpc_only = True,
+- deps = [":storage_cc_proto"],
+-)
+diff -urN a/google/cloud/bigquery/storage/v1beta2/BUILD.bazel b/google/cloud/bigquery/storage/v1beta2/BUILD.bazel
+--- a/google/cloud/bigquery/storage/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/storage/v1beta2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,369 +0,0 @@
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "storage_proto",
+- srcs = [
+- "arrow.proto",
+- "avro.proto",
+- "protobuf.proto",
+- "storage.proto",
+- "stream.proto",
+- "table.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:descriptor_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "storage_proto_with_info",
+- deps = [
+- ":storage_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "storage_java_proto",
+- deps = [":storage_proto"],
+-)
+-
+-java_grpc_library(
+- name = "storage_java_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "storage_java_gapic",
+- srcs = [":storage_proto_with_info"],
+- gapic_yaml = "bigquerystorage_gapic.yaml",
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":storage_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":storage_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "storage_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigquery.storage.v1beta2.BaseBigQueryReadClientTest",
+- ],
+- runtime_deps = [":storage_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigquery-storage-v1beta2-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":storage_java_gapic",
+- ":storage_java_grpc",
+- ":storage_java_proto",
+- ":storage_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "storage_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta2",
+- protos = [":storage_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "storage_go_gapic",
+- srcs = [":storage_proto_with_info"],
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigquery/storage/apiv1beta2;storage",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerystorage_v1beta2.yaml",
+- deps = [
+- ":storage_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "storage_go_gapic_test",
+- srcs = [":storage_go_gapic_srcjar_test"],
+- embed = [":storage_go_gapic"],
+- importpath = "cloud.google.com/go/bigquery/storage/apiv1beta2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigquery-storage-v1beta2-go",
+- deps = [
+- ":storage_go_gapic",
+- ":storage_go_gapic_srcjar-test.srcjar",
+- ":storage_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "storage_py_gapic",
+- srcs = [":storage_proto"],
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=bigquery_storage",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "storage_py_gapic_test",
+- srcs = [
+- "storage_py_gapic_pytest.py",
+- "storage_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":storage_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "bigquery-storage-v1beta2-py",
+- deps = [
+- ":storage_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "storage_php_proto",
+- deps = [":storage_proto"],
+-)
+-
+-php_grpc_library(
+- name = "storage_php_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "storage_php_gapic",
+- srcs = [":storage_proto_with_info"],
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":storage_php_grpc",
+- ":storage_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-storage-v1beta2-php",
+- deps = [
+- ":storage_php_gapic",
+- ":storage_php_grpc",
+- ":storage_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "storage_nodejs_gapic",
+- src = ":storage_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- package = "google.cloud.bigquery.storage.v1beta2",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerystorage_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigquery-storage-v1beta2-nodejs",
+- deps = [
+- ":storage_nodejs_gapic",
+- ":storage_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-# load(
+-# "@com_google_googleapis_imports//:imports.bzl",
+-# "ruby_gapic_assembly_pkg",
+-# "ruby_cloud_gapic_library",
+-# "ruby_grpc_library",
+-# "ruby_proto_library",
+-# )
+-
+-# ruby_proto_library(
+-# name = "storage_ruby_proto",
+-# deps = [":storage_proto"],
+-# )
+-
+-# ruby_grpc_library(
+-# name = "storage_ruby_grpc",
+-# srcs = [":storage_proto"],
+-# deps = [":storage_ruby_proto"],
+-# )
+-
+-# ruby_cloud_gapic_library(
+-# name = "storage_ruby_gapic",
+-# srcs = [":storage_proto_with_info",],
+-# extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-bigquery-storage-v1beta2"],
+-# deps = [
+-# ":storage_ruby_grpc",
+-# ":storage_ruby_proto",
+-# ],
+-# )
+-
+-# ruby_gapic_assembly_pkg(
+-# name = "google-cloud-bigquery-storage-v1beta2-ruby",
+-# deps = [
+-# ":storage_ruby_gapic",
+-# ":storage_ruby_grpc",
+-# ":storage_ruby_proto",
+-# ],
+-# )
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "storage_csharp_proto",
+- deps = [":storage_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "storage_csharp_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "storage_csharp_gapic",
+- srcs = [":storage_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "bigquerystorage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigquerystorage_v1beta2.yaml",
+- deps = [
+- ":storage_csharp_grpc",
+- ":storage_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-storage-v1beta2-csharp",
+- deps = [
+- ":storage_csharp_gapic",
+- ":storage_csharp_grpc",
+- ":storage_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "storage_cc_proto",
+- deps = [":storage_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "storage_cc_grpc",
+- srcs = [":storage_proto"],
+- generate_mocks = True,
+- grpc_only = True,
+- deps = [":storage_cc_proto"],
+-)
+diff -urN a/google/cloud/bigquery/v2/BUILD.bazel b/google/cloud/bigquery/v2/BUILD.bazel
+--- a/google/cloud/bigquery/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/bigquery/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,365 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "bigquery_proto",
+- srcs = [
+- "encryption_config.proto",
+- "model.proto",
+- "model_reference.proto",
+- "standard_sql.proto",
+- "table_reference.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "bigquery_proto_with_info",
+- deps = [
+- ":bigquery_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "bigquery_java_proto",
+- deps = [":bigquery_proto"],
+-)
+-
+-java_grpc_library(
+- name = "bigquery_java_grpc",
+- srcs = [":bigquery_proto"],
+- deps = [":bigquery_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "bigquery_java_gapic",
+- srcs = [":bigquery_proto_with_info"],
+- grpc_service_config = "bigquery_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":bigquery_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":bigquery_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "bigquery_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.bigquery.v2.ModelServiceClientHttpJsonTest",
+- "com.google.cloud.bigquery.v2.ModelServiceClientTest",
+- ],
+- runtime_deps = [":bigquery_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-bigquery-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":bigquery_java_gapic",
+- ":bigquery_java_grpc",
+- ":bigquery_java_proto",
+- ":bigquery_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "bigquery_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/v2",
+- protos = [":bigquery_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "bigquery_go_gapic",
+- srcs = [":bigquery_proto_with_info"],
+- grpc_service_config = "bigquery_grpc_service_config.json",
+- importpath = "cloud.google.com/go/bigquery/apiv2;bigquery",
+- rest_numeric_enums = False,
+- service_yaml = "bigquery_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":bigquery_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "bigquery_go_gapic_test",
+- srcs = [":bigquery_go_gapic_srcjar_test"],
+- embed = [":bigquery_go_gapic"],
+- importpath = "cloud.google.com/go/bigquery/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-bigquery-v2-go",
+- deps = [
+- ":bigquery_go_gapic",
+- ":bigquery_go_gapic_srcjar-test.srcjar",
+- ":bigquery_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "bigquery_py_gapic",
+- srcs = [":bigquery_proto"],
+- grpc_service_config = "bigquery_grpc_service_config.json",
+- opt_args = ["autogen-snippets=False"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "bigquery_py_gapic_test",
+- srcs = [
+- "bigquery_py_gapic_pytest.py",
+- "bigquery_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":bigquery_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "bigquery-v2-py",
+- deps = [
+- ":bigquery_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "bigquery_php_proto",
+- deps = [":bigquery_proto"],
+-)
+-
+-php_grpc_library(
+- name = "bigquery_php_grpc",
+- srcs = [":bigquery_proto"],
+- deps = [":bigquery_php_proto"],
+-)
+-
+-# Add api.http options to all RPCs in the services to enable PHP GAPIC
+-#php_gapic_library(
+-# name = "bigquery_php_gapic",
+-# src = ":bigquery_proto_with_info",
+-# gapic_yaml = "bigquery_gapic.yaml",
+-# package = "google.cloud.bigquery.v2",
+-# service_yaml = "bigquery_v2.yaml",
+-# deps = [
+-# ":bigquery_php_grpc",
+-# ":bigquery_php_proto",
+-# ],
+-#)
+-#
+-## Open Source Packages
+-#php_gapic_assembly_pkg(
+-# name = "google-cloud-bigquery-v2-php",
+-# deps = [
+-# ":bigquery_php_gapic",
+-# ":bigquery_php_grpc",
+-# ":bigquery_php_proto",
+-# ],
+-#)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "bigquery_nodejs_gapic",
+- src = ":bigquery_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "bigquery_grpc_service_config.json",
+- package = "google.cloud.bigquery.v2",
+- rest_numeric_enums = False,
+- service_yaml = "bigquery_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "bigquery-v2-nodejs",
+- deps = [
+- ":bigquery_nodejs_gapic",
+- ":bigquery_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "bigquery_ruby_proto",
+- deps = [":bigquery_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "bigquery_ruby_grpc",
+- srcs = [":bigquery_proto"],
+- deps = [":bigquery_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "bigquery_ruby_gapic",
+- srcs = [":bigquery_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-bigquery-v2"],
+- rest_numeric_enums = False,
+- deps = [
+- ":bigquery_ruby_grpc",
+- ":bigquery_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-v2-ruby",
+- deps = [
+- ":bigquery_ruby_gapic",
+- ":bigquery_ruby_grpc",
+- ":bigquery_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "bigquery_csharp_proto",
+- deps = [":bigquery_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "bigquery_csharp_grpc",
+- srcs = [":bigquery_proto"],
+- deps = [":bigquery_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "bigquery_csharp_gapic",
+- srcs = [":bigquery_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "bigquery_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "bigquery_v2.yaml",
+- deps = [
+- ":bigquery_csharp_grpc",
+- ":bigquery_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-bigquery-v2-csharp",
+- deps = [
+- ":bigquery_csharp_gapic",
+- ":bigquery_csharp_grpc",
+- ":bigquery_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "bigquery_cc_proto",
+- deps = [":bigquery_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "bigquery_cc_grpc",
+- srcs = [":bigquery_proto"],
+- grpc_only = True,
+- deps = [":bigquery_cc_proto"],
+-)
+diff -urN a/google/cloud/billing/BUILD.bazel b/google/cloud/billing/BUILD.bazel
+--- a/google/cloud/billing/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/billing/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-billing.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for cloudbilling.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "cloudbilling_ruby_wrapper",
+- srcs = ["//google/cloud/billing/v1:billing_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-billing",
+- "ruby-cloud-env-prefix=BILLING",
+- "ruby-cloud-wrapper-of=v1:0.1",
+- "ruby-cloud-product-url=https://cloud.google.com/billing",
+- "ruby-cloud-api-id=cloudbilling.googleapis.com",
+- "ruby-cloud-api-shortname=cloudbilling",
+- "ruby-cloud-factory-method-suffix=_service",
+- ],
+- ruby_cloud_description = "Allows developers to manage billing for their Google Cloud Platform projects programmatically.",
+- ruby_cloud_title = "Billing",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-billing-ruby",
+- deps = [
+- ":cloudbilling_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/billing/budgets/BUILD.bazel b/google/cloud/billing/budgets/BUILD.bazel
+--- a/google/cloud/billing/budgets/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/billing/budgets/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-billing-budgets.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for billingbudgets.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "billingbudgets_ruby_wrapper",
+- srcs = ["//google/cloud/billing/budgets/v1:budgets_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-billing-budgets",
+- "ruby-cloud-env-prefix=BILLING_BUDGETS",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/billing/docs/how-to/budget-api-overview",
+- "ruby-cloud-api-id=billingbudgets.googleapis.com",
+- "ruby-cloud-api-shortname=billingbudgets",
+- ],
+- ruby_cloud_description = "Provides methods to view, create, and manage Cloud Billing budgets programmatically at scale.",
+- ruby_cloud_title = "Billing Budgets",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-billing-budgets-ruby",
+- deps = [
+- ":billingbudgets_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/billing/budgets/v1/BUILD.bazel b/google/cloud/billing/budgets/v1/BUILD.bazel
+--- a/google/cloud/billing/budgets/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/billing/budgets/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,343 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "budgets_proto",
+- srcs = [
+- "budget_model.proto",
+- "budget_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/type:date_proto",
+- "//google/type:money_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "budgets_proto_with_info",
+- deps = [
+- ":budgets_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "budgets_java_proto",
+- deps = [":budgets_proto"],
+-)
+-
+-java_grpc_library(
+- name = "budgets_java_grpc",
+- srcs = [":budgets_proto"],
+- deps = [":budgets_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "budgets_java_gapic",
+- srcs = [":budgets_proto_with_info"],
+- grpc_service_config = "billingbudgets_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":budgets_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":budgets_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "budgets_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.billing.budgets.v1.BudgetServiceClientHttpJsonTest",
+- "com.google.cloud.billing.budgets.v1.BudgetServiceClientTest",
+- ],
+- runtime_deps = [":budgets_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-billing-budgets-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":budgets_java_gapic",
+- ":budgets_java_grpc",
+- ":budgets_java_proto",
+- ":budgets_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "budgets_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/billing/budgets/v1",
+- protos = [":budgets_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:date_go_proto",
+- "//google/type:money_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "budgets_go_gapic",
+- srcs = [":budgets_proto_with_info"],
+- grpc_service_config = "billingbudgets_grpc_service_config.json",
+- importpath = "cloud.google.com/go/billing/budgets/apiv1;budgets",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "billingbudgets.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":budgets_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "budgets_go_gapic_test",
+- srcs = [":budgets_go_gapic_srcjar_test"],
+- embed = [":budgets_go_gapic"],
+- importpath = "cloud.google.com/go/billing/budgets/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-billing-budgets-v1-go",
+- deps = [
+- ":budgets_go_gapic",
+- ":budgets_go_gapic_srcjar-metadata.srcjar",
+- ":budgets_go_gapic_srcjar-test.srcjar",
+- ":budgets_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "budgets_py_gapic",
+- srcs = [":budgets_proto"],
+- grpc_service_config = "billingbudgets_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "budgets_py_gapic_test",
+- srcs = [
+- "budgets_py_gapic_pytest.py",
+- "budgets_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":budgets_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "billing-budgets-v1-py",
+- deps = [
+- ":budgets_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "budgets_php_proto",
+- deps = [":budgets_proto"],
+-)
+-
+-php_grpc_library(
+- name = "budgets_php_grpc",
+- srcs = [":budgets_proto"],
+- deps = [":budgets_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "budgets_php_gapic",
+- srcs = [":budgets_proto_with_info"],
+- grpc_service_config = "billingbudgets_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "billingbudgets.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":budgets_php_grpc",
+- ":budgets_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-billing-budgets-v1-php",
+- deps = [
+- ":budgets_php_gapic",
+- ":budgets_php_grpc",
+- ":budgets_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "budgets_nodejs_gapic",
+- package_name = "@google-cloud/billing-budgets",
+- src = ":budgets_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "billingbudgets_grpc_service_config.json",
+- package = "google.cloud.billing.budgets.v1",
+- rest_numeric_enums = False,
+- service_yaml = "billingbudgets.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "billing-budgets-v1-nodejs",
+- deps = [
+- ":budgets_nodejs_gapic",
+- ":budgets_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "budgets_ruby_proto",
+- deps = [":budgets_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "budgets_ruby_grpc",
+- srcs = [":budgets_proto"],
+- deps = [":budgets_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "budgets_ruby_gapic",
+- srcs = [":budgets_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=billingbudgets.googleapis.com",
+- "ruby-cloud-api-shortname=billingbudgets",
+- "ruby-cloud-env-prefix=BILLING_BUDGETS",
+- "ruby-cloud-gem-name=google-cloud-billing-budgets-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/billing/docs/how-to/budget-api-overview",
+- ],
+- grpc_service_config = "billingbudgets_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Provides methods to view, create, and manage Cloud Billing budgets programmatically at scale.",
+- ruby_cloud_title = "Billing Budgets V1",
+- deps = [
+- ":budgets_ruby_grpc",
+- ":budgets_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-billing-budgets-v1-ruby",
+- deps = [
+- ":budgets_ruby_gapic",
+- ":budgets_ruby_grpc",
+- ":budgets_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "budgets_csharp_proto",
+- deps = [":budgets_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "budgets_csharp_grpc",
+- srcs = [":budgets_proto"],
+- deps = [":budgets_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "budgets_csharp_gapic",
+- srcs = [":budgets_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "billingbudgets_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "billingbudgets.yaml",
+- deps = [
+- ":budgets_csharp_grpc",
+- ":budgets_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-billing-budgets-v1-csharp",
+- deps = [
+- ":budgets_csharp_gapic",
+- ":budgets_csharp_grpc",
+- ":budgets_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "budgets_cc_proto",
+- deps = [":budgets_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "budgets_cc_grpc",
+- srcs = [":budgets_proto"],
+- grpc_only = True,
+- deps = [":budgets_cc_proto"],
+-)
+diff -urN a/google/cloud/billing/budgets/v1beta1/BUILD.bazel b/google/cloud/billing/budgets/v1beta1/BUILD.bazel
+--- a/google/cloud/billing/budgets/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/billing/budgets/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,370 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "budgets_proto",
+- srcs = [
+- "budget_model.proto",
+- "budget_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/type:date_proto",
+- "//google/type:money_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "budgets_proto_with_info",
+- deps = [
+- ":budgets_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "budgets_java_proto",
+- deps = [":budgets_proto"],
+-)
+-
+-java_grpc_library(
+- name = "budgets_java_grpc",
+- srcs = [":budgets_proto"],
+- deps = [":budgets_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "budgets_java_gapic",
+- srcs = [":budgets_proto_with_info"],
+- grpc_service_config = "billingbudgets_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":budgets_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":budgets_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "budgets_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.billing.budgets.v1beta1.BudgetServiceClientTest",
+- ],
+- runtime_deps = [":budgets_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-billing-budgets-v1beta1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":budgets_java_gapic",
+- ":budgets_java_grpc",
+- ":budgets_java_proto",
+- ":budgets_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "budgets_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/billing/budgets/v1beta1",
+- protos = [":budgets_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:date_go_proto",
+- "//google/type:money_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "budgets_go_gapic",
+- srcs = [":budgets_proto_with_info"],
+- grpc_service_config = "billingbudgets_grpc_service_config.json",
+- importpath = "cloud.google.com/go/billing/budgets/apiv1beta1;budgets",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "billingbudgets.yaml",
+- deps = [
+- ":budgets_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "budgets_go_gapic_test",
+- srcs = [":budgets_go_gapic_srcjar_test"],
+- embed = [":budgets_go_gapic"],
+- importpath = "cloud.google.com/go/billing/budgets/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-billing-budgets-v1beta1-go",
+- deps = [
+- ":budgets_go_gapic",
+- ":budgets_go_gapic_srcjar-metadata.srcjar",
+- ":budgets_go_gapic_srcjar-test.srcjar",
+- ":budgets_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "budgets_py_gapic",
+- srcs = [":budgets_proto"],
+- grpc_service_config = "billingbudgets_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "budgets_py_gapic_test",
+- srcs = [
+- "budgets_py_gapic_pytest.py",
+- "budgets_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":budgets_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "billing-budgets-v1beta1-py",
+- deps = [
+- ":budgets_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "budgets_php_proto",
+- deps = [":budgets_proto"],
+-)
+-
+-php_grpc_library(
+- name = "budgets_php_grpc",
+- srcs = [":budgets_proto"],
+- deps = [":budgets_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "budgets_php_gapic",
+- srcs = [":budgets_proto_with_info"],
+- grpc_service_config = "billingbudgets_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":budgets_php_grpc",
+- ":budgets_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-billing-budgets-v1beta1-php",
+- deps = [
+- ":budgets_php_gapic",
+- ":budgets_php_grpc",
+- ":budgets_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "budgets_nodejs_gapic",
+- package_name = "@google-cloud/billing-budgets",
+- src = ":budgets_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "billingbudgets_grpc_service_config.json",
+- package = "google.cloud.billing.budgets.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "billingbudgets.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "billing-budgets-v1beta1-nodejs",
+- deps = [
+- ":budgets_nodejs_gapic",
+- ":budgets_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "budgets_ruby_proto",
+- deps = [":budgets_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "budgets_ruby_grpc",
+- srcs = [":budgets_proto"],
+- deps = [":budgets_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "budgets_ruby_gapic",
+- srcs = [":budgets_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=billingbudgets.googleapis.com",
+- "ruby-cloud-api-shortname=billingbudgets",
+- "ruby-cloud-env-prefix=BILLING_BUDGETS",
+- "ruby-cloud-gem-name=google-cloud-billing-budgets-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/billing/docs/how-to/budget-api-overview",
+- ],
+- grpc_service_config = "billingbudgets_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Provides methods to view, create, and manage Cloud Billing budgets programmatically at scale.",
+- ruby_cloud_title = "Billing Budgets V1beta1",
+- deps = [
+- ":budgets_ruby_grpc",
+- ":budgets_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-billing-budgets-v1beta1-ruby",
+- deps = [
+- ":budgets_ruby_gapic",
+- ":budgets_ruby_grpc",
+- ":budgets_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "budgets_csharp_proto",
+- deps = [":budgets_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "budgets_csharp_grpc",
+- srcs = [":budgets_proto"],
+- deps = [":budgets_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "budgets_csharp_gapic",
+- srcs = [":budgets_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "billingbudgets_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "billingbudgets.yaml",
+- deps = [
+- ":budgets_csharp_grpc",
+- ":budgets_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-billing-budgets-v1beta1-csharp",
+- deps = [
+- ":budgets_csharp_gapic",
+- ":budgets_csharp_grpc",
+- ":budgets_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/billing/v1/BUILD.bazel b/google/cloud/billing/v1/BUILD.bazel
+--- a/google/cloud/billing/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/billing/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,402 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "billing_proto",
+- srcs = [
+- "cloud_billing.proto",
+- "cloud_catalog.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/type:money_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "billing_proto_with_info",
+- deps = [
+- ":billing_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "billing_java_proto",
+- deps = [":billing_proto"],
+-)
+-
+-java_grpc_library(
+- name = "billing_java_grpc",
+- srcs = [":billing_proto"],
+- deps = [":billing_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "billing_java_gapic",
+- srcs = [":billing_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "cloud_billing_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudbilling.yaml",
+- test_deps = [
+- ":billing_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":billing_java_proto",
+- "//google/api:api_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "billing_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.billing.v1.CloudBillingClientHttpJsonTest",
+- "com.google.cloud.billing.v1.CloudBillingClientTest",
+- "com.google.cloud.billing.v1.CloudCatalogClientHttpJsonTest",
+- "com.google.cloud.billing.v1.CloudCatalogClientTest",
+- ],
+- runtime_deps = [":billing_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-billing-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":billing_java_gapic",
+- ":billing_java_grpc",
+- ":billing_java_proto",
+- ":billing_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "billing_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/billing/v1",
+- protos = [":billing_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/type:money_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "billing_go_gapic",
+- srcs = [":billing_proto_with_info"],
+- grpc_service_config = "cloud_billing_grpc_service_config.json",
+- importpath = "cloud.google.com/go/billing/apiv1;billing",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "cloudbilling.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":billing_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "billing_go_gapic_test",
+- srcs = [":billing_go_gapic_srcjar_test"],
+- embed = [":billing_go_gapic"],
+- importpath = "cloud.google.com/go/billing/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-billing-v1-go",
+- deps = [
+- ":billing_go_gapic",
+- ":billing_go_gapic_srcjar-metadata.srcjar",
+- ":billing_go_gapic_srcjar-test.srcjar",
+- ":billing_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "billing_py_gapic",
+- srcs = [":billing_proto"],
+- grpc_service_config = "cloud_billing_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudbilling.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "billing_py_gapic_test",
+- srcs = [
+- "billing_py_gapic_pytest.py",
+- "billing_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":billing_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "billing-v1-py",
+- deps = [
+- ":billing_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "billing_php_proto",
+- deps = [":billing_proto"],
+-)
+-
+-php_grpc_library(
+- name = "billing_php_grpc",
+- srcs = [":billing_proto"],
+- deps = [":billing_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "billing_php_gapic",
+- srcs = [":billing_proto_with_info"],
+- grpc_service_config = "cloud_billing_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudbilling.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":billing_php_grpc",
+- ":billing_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-billing-v1-php",
+- deps = [
+- ":billing_php_gapic",
+- ":billing_php_grpc",
+- ":billing_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "billing_nodejs_gapic",
+- package_name = "@google-cloud/billing",
+- src = ":billing_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloud_billing_grpc_service_config.json",
+- package = "google.cloud.billing.v1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudbilling.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "billing-v1-nodejs",
+- deps = [
+- ":billing_nodejs_gapic",
+- ":billing_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "billing_ruby_proto",
+- deps = [":billing_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "billing_ruby_grpc",
+- srcs = [":billing_proto"],
+- deps = [":billing_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "billing_ruby_gapic",
+- srcs = [":billing_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=cloudbilling.googleapis.com",
+- "ruby-cloud-api-shortname=cloudbilling",
+- "ruby-cloud-env-prefix=BILLING",
+- "ruby-cloud-gem-name=google-cloud-billing-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/billing",
+- ],
+- grpc_service_config = "cloud_billing_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Allows developers to manage billing for their Google Cloud Platform projects programmatically.",
+- ruby_cloud_title = "Billing V1",
+- service_yaml = "cloudbilling.yaml",
+- deps = [
+- ":billing_ruby_grpc",
+- ":billing_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-billing-v1-ruby",
+- deps = [
+- ":billing_ruby_gapic",
+- ":billing_ruby_grpc",
+- ":billing_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "billing_csharp_proto",
+- deps = [":billing_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "billing_csharp_grpc",
+- srcs = [":billing_proto"],
+- deps = [":billing_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "billing_csharp_gapic",
+- srcs = [":billing_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloud_billing_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudbilling.yaml",
+- deps = [
+- ":billing_csharp_grpc",
+- ":billing_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-billing-v1-csharp",
+- deps = [
+- ":billing_csharp_gapic",
+- ":billing_csharp_grpc",
+- ":billing_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "billing_cc_proto",
+- deps = [":billing_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "billing_cc_grpc",
+- srcs = [":billing_proto"],
+- grpc_only = True,
+- deps = [":billing_cc_proto"],
+-)
+diff -urN a/google/cloud/binaryauthorization/BUILD.bazel b/google/cloud/binaryauthorization/BUILD.bazel
+--- a/google/cloud/binaryauthorization/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/binaryauthorization/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-binary_authorization.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for binaryauthorization.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "binaryauthorization_ruby_wrapper",
+- srcs = ["//google/cloud/binaryauthorization/v1:binaryauthorization_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-binary_authorization",
+- "ruby-cloud-env-prefix=BINARY_AUTHORIZATION",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/binary-authorization/",
+- "ruby-cloud-api-id=binaryauthorization.googleapis.com",
+- "ruby-cloud-api-shortname=binaryauthorization",
+- "ruby-cloud-service-override=BinauthzManagementServiceV1=BinauthzManagementService;SystemPolicyV1=SystemPolicy;ValidationHelperV1=ValidationHelper",
+- ],
+- ruby_cloud_description = "Binary Authorization is a service on Google Cloud that provides centralized software supply-chain security for applications that run on Google Kubernetes Engine (GKE) and GKE on-prem.",
+- ruby_cloud_title = "Binary Authorization",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-binaryauthorization-ruby",
+- deps = [
+- ":binaryauthorization_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/binaryauthorization/v1/BUILD.bazel b/google/cloud/binaryauthorization/v1/BUILD.bazel
+--- a/google/cloud/binaryauthorization/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/binaryauthorization/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,404 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "binaryauthorization_proto",
+- srcs = [
+- "resources.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//grafeas/v1:grafeas_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "binaryauthorization_proto_with_info",
+- deps = [
+- ":binaryauthorization_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "binaryauthorization_java_proto",
+- deps = [":binaryauthorization_proto"],
+-)
+-
+-java_grpc_library(
+- name = "binaryauthorization_java_grpc",
+- srcs = [":binaryauthorization_proto"],
+- deps = [":binaryauthorization_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "binaryauthorization_java_gapic",
+- srcs = [":binaryauthorization_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "binaryauthorization_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "binaryauthorization_v1.yaml",
+- test_deps = [
+- ":binaryauthorization_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":binaryauthorization_java_proto",
+- "//google/api:api_java_proto",
+- "//grafeas/v1:grafeas_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "binaryauthorization_java_gapic_test_suite",
+- test_classes = [
+- "com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1ClientHttpJsonTest",
+- "com.google.protos.google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1ClientTest",
+- "com.google.protos.google.cloud.binaryauthorization.v1.SystemPolicyV1ClientHttpJsonTest",
+- "com.google.protos.google.cloud.binaryauthorization.v1.SystemPolicyV1ClientTest",
+- "com.google.protos.google.cloud.binaryauthorization.v1.ValidationHelperV1ClientHttpJsonTest",
+- "com.google.protos.google.cloud.binaryauthorization.v1.ValidationHelperV1ClientTest",
+- ],
+- runtime_deps = [":binaryauthorization_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-binaryauthorization-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":binaryauthorization_java_gapic",
+- ":binaryauthorization_java_grpc",
+- ":binaryauthorization_java_proto",
+- ":binaryauthorization_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "binaryauthorization_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1",
+- protos = [":binaryauthorization_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//grafeas/v1:grafeas_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "binaryauthorization_go_gapic",
+- srcs = [":binaryauthorization_proto_with_info"],
+- grpc_service_config = "binaryauthorization_grpc_service_config.json",
+- importpath = "cloud.google.com/go/binaryauthorization/apiv1;binaryauthorization",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "binaryauthorization_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":binaryauthorization_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "binaryauthorization_go_gapic_test",
+- srcs = [":binaryauthorization_go_gapic_srcjar_test"],
+- embed = [":binaryauthorization_go_gapic"],
+- importpath = "cloud.google.com/go/binaryauthorization/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-binaryauthorization-v1-go",
+- deps = [
+- ":binaryauthorization_go_gapic",
+- ":binaryauthorization_go_gapic_srcjar-metadata.srcjar",
+- ":binaryauthorization_go_gapic_srcjar-test.srcjar",
+- ":binaryauthorization_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "binaryauthorization_py_gapic",
+- srcs = [":binaryauthorization_proto"],
+- grpc_service_config = "binaryauthorization_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//grafeas/v1:grafeas_py_proto",
+- ],
+- opt_args = [
+- "warehouse-package-name=google-cloud-binary-authorization",
+- ],
+-)
+-
+-py_test(
+- name = "binaryauthorization_py_gapic_test",
+- srcs = [
+- "binaryauthorization_py_gapic_pytest.py",
+- "binaryauthorization_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":binaryauthorization_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "binaryauthorization-v1-py",
+- deps = [
+- ":binaryauthorization_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "binaryauthorization_php_proto",
+- deps = [":binaryauthorization_proto"],
+-)
+-
+-php_grpc_library(
+- name = "binaryauthorization_php_grpc",
+- srcs = [":binaryauthorization_proto"],
+- deps = [":binaryauthorization_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "binaryauthorization_php_gapic",
+- srcs = [":binaryauthorization_proto_with_info"],
+- grpc_service_config = "binaryauthorization_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "binaryauthorization_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":binaryauthorization_php_grpc",
+- ":binaryauthorization_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-binaryauthorization-v1-php",
+- deps = [
+- ":binaryauthorization_php_gapic",
+- ":binaryauthorization_php_grpc",
+- ":binaryauthorization_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "binaryauthorization_nodejs_gapic",
+- package_name = "@google-cloud/binary-authorization",
+- src = ":binaryauthorization_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "binaryauthorization_grpc_service_config.json",
+- package = "google.cloud.binaryauthorization.v1",
+- rest_numeric_enums = False,
+- service_yaml = "binaryauthorization_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "binaryauthorization-v1-nodejs",
+- deps = [
+- ":binaryauthorization_nodejs_gapic",
+- ":binaryauthorization_proto",
+- "//grafeas/v1:grafeas_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "binaryauthorization_ruby_proto",
+- deps = [":binaryauthorization_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "binaryauthorization_ruby_grpc",
+- srcs = [":binaryauthorization_proto"],
+- deps = [":binaryauthorization_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "binaryauthorization_ruby_gapic",
+- srcs = [":binaryauthorization_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=binaryauthorization.googleapis.com",
+- "ruby-cloud-api-shortname=binaryauthorization",
+- "ruby-cloud-env-prefix=BINARY_AUTHORIZATION",
+- "ruby-cloud-gem-name=google-cloud-binary_authorization-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/binary-authorization/",
+- "ruby-cloud-service-override=BinauthzManagementServiceV1=BinauthzManagementService;SystemPolicyV1=SystemPolicy;ValidationHelperV1=ValidationHelper",
+- "ruby-cloud-extra-dependencies=grafeas-v1=> 0.0|< 2.a",
+- "ruby-cloud-yard-strict=false",
+- ],
+- grpc_service_config = "binaryauthorization_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Binary Authorization is a service on Google Cloud that provides centralized software supply-chain security for applications that run on Google Kubernetes Engine (GKE) and GKE on-prem.",
+- ruby_cloud_title = "Binary Authorization V1",
+- deps = [
+- ":binaryauthorization_ruby_grpc",
+- ":binaryauthorization_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-binaryauthorization-v1-ruby",
+- deps = [
+- ":binaryauthorization_ruby_gapic",
+- ":binaryauthorization_ruby_grpc",
+- ":binaryauthorization_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "binaryauthorization_csharp_proto",
+- deps = [":binaryauthorization_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "binaryauthorization_csharp_grpc",
+- srcs = [":binaryauthorization_proto"],
+- deps = [":binaryauthorization_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "binaryauthorization_csharp_gapic",
+- srcs = [":binaryauthorization_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "binaryauthorization_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "binaryauthorization_v1.yaml",
+- deps = [
+- ":binaryauthorization_csharp_grpc",
+- ":binaryauthorization_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-binaryauthorization-v1-csharp",
+- deps = [
+- ":binaryauthorization_csharp_gapic",
+- ":binaryauthorization_csharp_grpc",
+- ":binaryauthorization_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "binaryauthorization_cc_proto",
+- deps = [":binaryauthorization_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "binaryauthorization_cc_grpc",
+- srcs = [":binaryauthorization_proto"],
+- grpc_only = True,
+- deps = [":binaryauthorization_cc_proto"],
+-)
+diff -urN a/google/cloud/binaryauthorization/v1beta1/BUILD.bazel b/google/cloud/binaryauthorization/v1beta1/BUILD.bazel
+--- a/google/cloud/binaryauthorization/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/binaryauthorization/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,373 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "binaryauthorization_proto",
+- srcs = [
+- "continuous_validation_logging.proto",
+- "resources.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "binaryauthorization_proto_with_info",
+- deps = [
+- ":binaryauthorization_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "binaryauthorization_java_proto",
+- deps = [":binaryauthorization_proto"],
+-)
+-
+-java_grpc_library(
+- name = "binaryauthorization_java_grpc",
+- srcs = [":binaryauthorization_proto"],
+- deps = [":binaryauthorization_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "binaryauthorization_java_gapic",
+- srcs = [":binaryauthorization_proto_with_info"],
+- grpc_service_config = "binaryauthorization_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":binaryauthorization_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":binaryauthorization_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "binaryauthorization_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1ClientHttpJsonTest",
+- "com.google.cloud.binaryauthorization.v1beta1.BinauthzManagementServiceV1Beta1ClientTest",
+- ],
+- runtime_deps = [":binaryauthorization_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-binaryauthorization-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":binaryauthorization_java_gapic",
+- ":binaryauthorization_java_grpc",
+- ":binaryauthorization_java_proto",
+- ":binaryauthorization_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "binaryauthorization_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1beta1",
+- protos = [":binaryauthorization_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "binaryauthorization_go_gapic",
+- srcs = [":binaryauthorization_proto_with_info"],
+- grpc_service_config = "binaryauthorization_grpc_service_config.json",
+- importpath = "cloud.google.com/go/binaryauthorization/apiv1beta1;binaryauthorization",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "binaryauthorization_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":binaryauthorization_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "binaryauthorization_go_gapic_test",
+- srcs = [":binaryauthorization_go_gapic_srcjar_test"],
+- embed = [":binaryauthorization_go_gapic"],
+- importpath = "cloud.google.com/go/binaryauthorization/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-binaryauthorization-v1beta1-go",
+- deps = [
+- ":binaryauthorization_go_gapic",
+- ":binaryauthorization_go_gapic_srcjar-metadata.srcjar",
+- ":binaryauthorization_go_gapic_srcjar-test.srcjar",
+- ":binaryauthorization_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "binaryauthorization_py_gapic",
+- srcs = [":binaryauthorization_proto"],
+- grpc_service_config = "binaryauthorization_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- opt_args = [
+- "warehouse-package-name=google-cloud-binary-authorization",
+- ],
+-)
+-
+-py_test(
+- name = "binaryauthorization_py_gapic_test",
+- srcs = [
+- "binaryauthorization_py_gapic_pytest.py",
+- "binaryauthorization_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":binaryauthorization_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "binaryauthorization-v1beta1-py",
+- deps = [
+- ":binaryauthorization_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "binaryauthorization_php_proto",
+- deps = [":binaryauthorization_proto"],
+-)
+-
+-php_grpc_library(
+- name = "binaryauthorization_php_grpc",
+- srcs = [":binaryauthorization_proto"],
+- deps = [":binaryauthorization_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "binaryauthorization_php_gapic",
+- srcs = [":binaryauthorization_proto_with_info"],
+- grpc_service_config = "binaryauthorization_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "binaryauthorization_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":binaryauthorization_php_grpc",
+- ":binaryauthorization_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-binaryauthorization-v1beta1-php",
+- deps = [
+- ":binaryauthorization_php_gapic",
+- ":binaryauthorization_php_grpc",
+- ":binaryauthorization_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "binaryauthorization_nodejs_gapic",
+- package_name = "@google-cloud/binary-authorization",
+- src = ":binaryauthorization_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "binaryauthorization_grpc_service_config.json",
+- package = "google.cloud.binaryauthorization.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "binaryauthorization_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "binaryauthorization-v1beta1-nodejs",
+- deps = [
+- ":binaryauthorization_nodejs_gapic",
+- ":binaryauthorization_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "binaryauthorization_ruby_proto",
+- deps = [":binaryauthorization_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "binaryauthorization_ruby_grpc",
+- srcs = [":binaryauthorization_proto"],
+- deps = [":binaryauthorization_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "binaryauthorization_ruby_gapic",
+- srcs = [":binaryauthorization_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=binaryauthorization.googleapis.com",
+- "ruby-cloud-api-shortname=binaryauthorization",
+- "ruby-cloud-env-prefix=BINARY_AUTHORIZATION",
+- "ruby-cloud-gem-name=google-cloud-binary_authorization-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/binary-authorization/",
+- "ruby-cloud-service-override=BinauthzManagementServiceV1Beta1=BinauthzManagementService;SystemPolicyV1Beta1=SystemPolicy",
+- ],
+- grpc_service_config = "binaryauthorization_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Binary Authorization is a service on Google Cloud that provides centralized software supply-chain security for applications that run on Google Kubernetes Engine (GKE) and GKE on-prem.",
+- ruby_cloud_title = "Binary Authorization V1beta1",
+- deps = [
+- ":binaryauthorization_ruby_grpc",
+- ":binaryauthorization_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-binaryauthorization-v1beta1-ruby",
+- deps = [
+- ":binaryauthorization_ruby_gapic",
+- ":binaryauthorization_ruby_grpc",
+- ":binaryauthorization_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "binaryauthorization_csharp_proto",
+- deps = [":binaryauthorization_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "binaryauthorization_csharp_grpc",
+- srcs = [":binaryauthorization_proto"],
+- deps = [":binaryauthorization_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "binaryauthorization_csharp_gapic",
+- srcs = [":binaryauthorization_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "binaryauthorization_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "binaryauthorization_v1beta1.yaml",
+- deps = [
+- ":binaryauthorization_csharp_grpc",
+- ":binaryauthorization_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-binaryauthorization-v1beta1-csharp",
+- deps = [
+- ":binaryauthorization_csharp_gapic",
+- ":binaryauthorization_csharp_grpc",
+- ":binaryauthorization_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/certificatemanager/BUILD.bazel b/google/cloud/certificatemanager/BUILD.bazel
+--- a/google/cloud/certificatemanager/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/certificatemanager/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-certificate_manager.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for certificatemanager.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "certificatemanager_ruby_wrapper",
+- srcs = ["//google/cloud/certificatemanager/v1:certificatemanager_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-certificate_manager",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/certificate-manager",
+- "ruby-cloud-api-id=certificatemanager.googleapis.com",
+- "ruby-cloud-api-shortname=certificatemanager",
+- ],
+- ruby_cloud_description = "Certificate Manager lets you acquire and manage Transport Layer Security (TLS) (SSL) certificates for use with classic external HTTP(S) load balancers in Google Cloud.",
+- ruby_cloud_title = "Certificate Manager",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-certificatemanager-ruby",
+- deps = [
+- ":certificatemanager_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/certificatemanager/logging/v1/BUILD.bazel b/google/cloud/certificatemanager/logging/v1/BUILD.bazel
+--- a/google/cloud/certificatemanager/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/certificatemanager/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,175 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "logs.proto",
+- ],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/certificatemanager/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/certificatemanager/v1/BUILD.bazel b/google/cloud/certificatemanager/v1/BUILD.bazel
+--- a/google/cloud/certificatemanager/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/certificatemanager/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,406 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "certificatemanager_proto",
+- srcs = [
+- "certificate_issuance_config.proto",
+- "certificate_manager.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "certificatemanager_proto_with_info",
+- deps = [
+- ":certificatemanager_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "certificatemanager_java_proto",
+- deps = [":certificatemanager_proto"],
+-)
+-
+-java_grpc_library(
+- name = "certificatemanager_java_grpc",
+- srcs = [":certificatemanager_proto"],
+- deps = [":certificatemanager_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "certificatemanager_java_gapic",
+- srcs = [":certificatemanager_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "certificatemanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "certificatemanager_v1.yaml",
+- test_deps = [
+- ":certificatemanager_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":certificatemanager_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "certificatemanager_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.certificatemanager.v1.CertificateManagerClientHttpJsonTest",
+- "com.google.cloud.certificatemanager.v1.CertificateManagerClientTest",
+- ],
+- runtime_deps = [":certificatemanager_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-certificatemanager-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":certificatemanager_java_gapic",
+- ":certificatemanager_java_grpc",
+- ":certificatemanager_java_proto",
+- ":certificatemanager_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "certificatemanager_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/certificatemanager/v1",
+- protos = [":certificatemanager_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "certificatemanager_go_gapic",
+- srcs = [":certificatemanager_proto_with_info"],
+- grpc_service_config = "certificatemanager_grpc_service_config.json",
+- importpath = "cloud.google.com/go/certificatemanager/apiv1;certificatemanager",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "certificatemanager_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":certificatemanager_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "certificatemanager_go_gapic_test",
+- srcs = [":certificatemanager_go_gapic_srcjar_test"],
+- embed = [":certificatemanager_go_gapic"],
+- importpath = "cloud.google.com/go/certificatemanager/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-certificatemanager-v1-go",
+- deps = [
+- ":certificatemanager_go_gapic",
+- ":certificatemanager_go_gapic_srcjar-metadata.srcjar",
+- ":certificatemanager_go_gapic_srcjar-test.srcjar",
+- ":certificatemanager_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "certificatemanager_py_gapic",
+- srcs = [":certificatemanager_proto"],
+- grpc_service_config = "certificatemanager_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=certificate_manager",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-certificate-manager",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "certificatemanager_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "certificatemanager_py_gapic_test",
+- srcs = [
+- "certificatemanager_py_gapic_pytest.py",
+- "certificatemanager_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":certificatemanager_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "certificatemanager-v1-py",
+- deps = [
+- ":certificatemanager_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "certificatemanager_php_proto",
+- deps = [":certificatemanager_proto"],
+-)
+-
+-php_grpc_library(
+- name = "certificatemanager_php_grpc",
+- srcs = [":certificatemanager_proto"],
+- deps = [":certificatemanager_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "certificatemanager_php_gapic",
+- srcs = [":certificatemanager_proto_with_info"],
+- grpc_service_config = "certificatemanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "certificatemanager_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":certificatemanager_php_grpc",
+- ":certificatemanager_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-certificatemanager-v1-php",
+- deps = [
+- ":certificatemanager_php_gapic",
+- ":certificatemanager_php_grpc",
+- ":certificatemanager_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "certificatemanager_nodejs_gapic",
+- package_name = "@google-cloud/certificate-manager",
+- src = ":certificatemanager_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "certificatemanager_grpc_service_config.json",
+- package = "google.cloud.certificatemanager.v1",
+- rest_numeric_enums = False,
+- service_yaml = "certificatemanager_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "certificatemanager-v1-nodejs",
+- deps = [
+- ":certificatemanager_nodejs_gapic",
+- ":certificatemanager_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "certificatemanager_ruby_proto",
+- deps = [":certificatemanager_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "certificatemanager_ruby_grpc",
+- srcs = [":certificatemanager_proto"],
+- deps = [":certificatemanager_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "certificatemanager_ruby_gapic",
+- srcs = [":certificatemanager_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=certificatemanager.googleapis.com",
+- "ruby-cloud-api-shortname=certificatemanager",
+- "ruby-cloud-gem-name=google-cloud-certificate_manager-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/certificate-manager",
+- ],
+- grpc_service_config = "certificatemanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Certificate Manager lets you acquire and manage Transport Layer Security (TLS) (SSL) certificates for use with classic external HTTP(S) load balancers in Google Cloud.",
+- ruby_cloud_title = "Certificate Manager V1",
+- service_yaml = "certificatemanager_v1.yaml",
+- deps = [
+- ":certificatemanager_ruby_grpc",
+- ":certificatemanager_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-certificatemanager-v1-ruby",
+- deps = [
+- ":certificatemanager_ruby_gapic",
+- ":certificatemanager_ruby_grpc",
+- ":certificatemanager_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "certificatemanager_csharp_proto",
+- deps = [":certificatemanager_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "certificatemanager_csharp_grpc",
+- srcs = [":certificatemanager_proto"],
+- deps = [":certificatemanager_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "certificatemanager_csharp_gapic",
+- srcs = [":certificatemanager_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "certificatemanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "certificatemanager_v1.yaml",
+- deps = [
+- ":certificatemanager_csharp_grpc",
+- ":certificatemanager_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-certificatemanager-v1-csharp",
+- deps = [
+- ":certificatemanager_csharp_gapic",
+- ":certificatemanager_csharp_grpc",
+- ":certificatemanager_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "certificatemanager_cc_proto",
+- deps = [":certificatemanager_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "certificatemanager_cc_grpc",
+- srcs = [":certificatemanager_proto"],
+- grpc_only = True,
+- deps = [":certificatemanager_cc_proto"],
+-)
+diff -urN a/google/cloud/channel/BUILD.bazel b/google/cloud/channel/BUILD.bazel
+--- a/google/cloud/channel/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/channel/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-channel.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for cloudchannel.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "cloudchannel_ruby_wrapper",
+- srcs = ["//google/cloud/channel/v1:channel_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-channel",
+- "ruby-cloud-env-prefix=CHANNEL",
+- "ruby-cloud-wrapper-of=v1:0.13",
+- "ruby-cloud-product-url=https://cloud.google.com/channel",
+- "ruby-cloud-api-id=cloudchannel.googleapis.com",
+- "ruby-cloud-api-shortname=cloudchannel",
+- ],
+- ruby_cloud_description = "You can use Channel Services to manage your relationships with your partners and your customers. Channel Services include a console and APIs to view and provision links between distributors and resellers, customers and entitlements.",
+- ruby_cloud_title = "Cloud Channel",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-channel-ruby",
+- deps = [
+- ":cloudchannel_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/channel/v1/BUILD.bazel b/google/cloud/channel/v1/BUILD.bazel
+--- a/google/cloud/channel/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/channel/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,415 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "channel_proto",
+- srcs = [
+- "channel_partner_links.proto",
+- "common.proto",
+- "customers.proto",
+- "entitlements.proto",
+- "offers.proto",
+- "operations.proto",
+- "products.proto",
+- "reports_service.proto",
+- "repricing.proto",
+- "service.proto",
+- "subscriber_event.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:date_proto",
+- "//google/type:datetime_proto",
+- "//google/type:decimal_proto",
+- "//google/type:money_proto",
+- "//google/type:postal_address_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "channel_proto_with_info",
+- deps = [
+- ":channel_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "channel_java_proto",
+- deps = [":channel_proto"],
+-)
+-
+-java_grpc_library(
+- name = "channel_java_grpc",
+- srcs = [":channel_proto"],
+- deps = [":channel_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "channel_java_gapic",
+- srcs = [":channel_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "cloudchannel_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudchannel_v1.yaml",
+- test_deps = [
+- ":channel_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":channel_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "channel_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.channel.v1.CloudChannelServiceClientHttpJsonTest",
+- "com.google.cloud.channel.v1.CloudChannelServiceClientTest",
+- ],
+- runtime_deps = [":channel_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-channel-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":channel_java_gapic",
+- ":channel_java_grpc",
+- ":channel_java_proto",
+- ":channel_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "channel_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/channel/v1",
+- protos = [":channel_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:date_go_proto",
+- "//google/type:datetime_go_proto",
+- "//google/type:decimal_go_proto",
+- "//google/type:money_go_proto",
+- "//google/type:postaladdress_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "channel_go_gapic",
+- srcs = [":channel_proto_with_info"],
+- grpc_service_config = "cloudchannel_grpc_service_config.json",
+- importpath = "cloud.google.com/go/channel/apiv1;channel",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "cloudchannel_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":channel_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "channel_go_gapic_test",
+- srcs = [":channel_go_gapic_srcjar_test"],
+- embed = [":channel_go_gapic"],
+- importpath = "cloud.google.com/go/channel/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-channel-v1-go",
+- deps = [
+- ":channel_go_gapic",
+- ":channel_go_gapic_srcjar-metadata.srcjar",
+- ":channel_go_gapic_srcjar-test.srcjar",
+- ":channel_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "channel_py_gapic",
+- srcs = [":channel_proto"],
+- grpc_service_config = "cloudchannel_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudchannel_v1.yaml",
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "channel_py_gapic_test",
+- srcs = [
+- "channel_py_gapic_pytest.py",
+- "channel_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":channel_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "channel-v1-py",
+- deps = [
+- ":channel_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "channel_php_proto",
+- deps = [":channel_proto"],
+-)
+-
+-php_grpc_library(
+- name = "channel_php_grpc",
+- srcs = [":channel_proto"],
+- deps = [":channel_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "channel_php_gapic",
+- srcs = [":channel_proto_with_info"],
+- grpc_service_config = "cloudchannel_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudchannel_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":channel_php_grpc",
+- ":channel_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-channel-v1-php",
+- deps = [
+- ":channel_php_gapic",
+- ":channel_php_grpc",
+- ":channel_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "channel_nodejs_gapic",
+- package_name = "@google-cloud/channel",
+- src = ":channel_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudchannel_grpc_service_config.json",
+- package = "google.cloud.channel.v1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudchannel_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "channel-v1-nodejs",
+- deps = [
+- ":channel_nodejs_gapic",
+- ":channel_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "channel_ruby_proto",
+- deps = [":channel_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "channel_ruby_grpc",
+- srcs = [":channel_proto"],
+- deps = [":channel_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "channel_ruby_gapic",
+- srcs = [":channel_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=cloudchannel.googleapis.com",
+- "ruby-cloud-api-shortname=cloudchannel",
+- "ruby-cloud-env-prefix=CHANNEL",
+- "ruby-cloud-gem-name=google-cloud-channel-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/channel",
+- ],
+- grpc_service_config = "cloudchannel_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "You can use Channel Services to manage your relationships with your partners and your customers. Channel Services include a console and APIs to view and provision links between distributors and resellers, customers and entitlements.",
+- ruby_cloud_title = "Cloud Channel V1",
+- deps = [
+- ":channel_ruby_grpc",
+- ":channel_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-channel-v1-ruby",
+- deps = [
+- ":channel_ruby_gapic",
+- ":channel_ruby_grpc",
+- ":channel_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "channel_csharp_proto",
+- deps = [":channel_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "channel_csharp_grpc",
+- srcs = [":channel_proto"],
+- deps = [":channel_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "channel_csharp_gapic",
+- srcs = [":channel_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudchannel_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudchannel_v1.yaml",
+- deps = [
+- ":channel_csharp_grpc",
+- ":channel_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-channel-v1-csharp",
+- deps = [
+- ":channel_csharp_gapic",
+- ":channel_csharp_grpc",
+- ":channel_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "channel_cc_proto",
+- deps = [":channel_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "channel_cc_grpc",
+- srcs = [":channel_proto"],
+- grpc_only = True,
+- deps = [":channel_cc_proto"],
+-)
+diff -urN a/google/cloud/clouddms/BUILD.bazel b/google/cloud/clouddms/BUILD.bazel
+--- a/google/cloud/clouddms/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/clouddms/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-cloud_dms.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for datamigration.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "datamigration_ruby_wrapper",
+- srcs = ["//google/cloud/clouddms/v1:clouddms_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-cloud_dms",
+- "ruby-cloud-env-prefix=DATABASE_MIGRATION",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/database-migration/",
+- "ruby-cloud-api-id=datamigration.googleapis.com",
+- "ruby-cloud-api-shortname=datamigration",
+- "ruby-cloud-namespace-override=CloudDms=CloudDMS",
+- ],
+- ruby_cloud_description = "Database Migration Service makes it easier for you to migrate your data to Google Cloud. Database Migration Service helps you lift and shift your MySQL and PostgreSQL workloads into Cloud SQL. Database Migration Service streamlines networking workflow, manages the initial snapshot and ongoing replication, and provides a status of the migration operation.",
+- ruby_cloud_title = "Cloud Database Migration Service",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-clouddms-ruby",
+- deps = [
+- ":datamigration_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/clouddms/logging/v1/BUILD.bazel b/google/cloud/clouddms/logging/v1/BUILD.bazel
+--- a/google/cloud/clouddms/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/clouddms/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,183 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "clouddms_platform_logs.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/clouddms/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/clouddms/v1/BUILD.bazel b/google/cloud/clouddms/v1/BUILD.bazel
+--- a/google/cloud/clouddms/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/clouddms/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,395 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "clouddms_proto",
+- srcs = [
+- "clouddms.proto",
+- "clouddms_resources.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "clouddms_proto_with_info",
+- deps = [
+- ":clouddms_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "clouddms_java_proto",
+- deps = [":clouddms_proto"],
+-)
+-
+-java_grpc_library(
+- name = "clouddms_java_grpc",
+- srcs = [":clouddms_proto"],
+- deps = [":clouddms_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "clouddms_java_gapic",
+- srcs = [":clouddms_proto_with_info"],
+- grpc_service_config = "library_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":clouddms_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":clouddms_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "clouddms_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.clouddms.v1.DataMigrationServiceClientTest",
+- ],
+- runtime_deps = [":clouddms_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-clouddms-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":clouddms_java_gapic",
+- ":clouddms_java_grpc",
+- ":clouddms_java_proto",
+- ":clouddms_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "clouddms_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/clouddms/v1",
+- protos = [":clouddms_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "clouddms_go_gapic",
+- srcs = [":clouddms_proto_with_info"],
+- grpc_service_config = "library_grpc_service_config.json",
+- importpath = "cloud.google.com/go/clouddms/apiv1;clouddms",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "datamigration_v1.yaml",
+- deps = [
+- ":clouddms_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "clouddms_go_gapic_test",
+- srcs = [":clouddms_go_gapic_srcjar_test"],
+- embed = [":clouddms_go_gapic"],
+- importpath = "cloud.google.com/go/clouddms/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-clouddms-v1-go",
+- deps = [
+- ":clouddms_go_gapic",
+- ":clouddms_go_gapic_srcjar-metadata.srcjar",
+- ":clouddms_go_gapic_srcjar-test.srcjar",
+- ":clouddms_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "clouddms_py_gapic",
+- srcs = [":clouddms_proto"],
+- grpc_service_config = "library_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-dms"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "clouddms_py_gapic_test",
+- srcs = [
+- "clouddms_py_gapic_pytest.py",
+- "clouddms_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":clouddms_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "clouddms-v1-py",
+- deps = [
+- ":clouddms_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "clouddms_php_proto",
+- deps = [":clouddms_proto"],
+-)
+-
+-php_grpc_library(
+- name = "clouddms_php_grpc",
+- srcs = [":clouddms_proto"],
+- deps = [":clouddms_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "clouddms_php_gapic",
+- srcs = [":clouddms_proto_with_info"],
+- grpc_service_config = "library_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datamigration_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":clouddms_php_grpc",
+- ":clouddms_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-clouddms-v1-php",
+- deps = [
+- ":clouddms_php_gapic",
+- ":clouddms_php_grpc",
+- ":clouddms_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "clouddms_nodejs_gapic",
+- package_name = "@google-cloud/dms",
+- src = ":clouddms_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "library_grpc_service_config.json",
+- package = "google.cloud.clouddms.v1",
+- rest_numeric_enums = False,
+- service_yaml = "datamigration_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "clouddms-v1-nodejs",
+- deps = [
+- ":clouddms_nodejs_gapic",
+- ":clouddms_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "clouddms_ruby_proto",
+- deps = [":clouddms_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "clouddms_ruby_grpc",
+- srcs = [":clouddms_proto"],
+- deps = [":clouddms_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "clouddms_ruby_gapic",
+- srcs = [":clouddms_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-cloud_dms-v1",
+- "ruby-cloud-gem-namespace=Google::Cloud::CloudDMS::V1",
+- "ruby-cloud-env-prefix=DATABASE_MIGRATION",
+- "ruby-cloud-product-url=https://cloud.google.com/database-migration/",
+- "ruby-cloud-api-id=datamigration.googleapis.com",
+- "ruby-cloud-api-shortname=datamigration",
+- "ruby-cloud-namespace-override=CloudDms=CloudDMS",
+- ],
+- grpc_service_config = "library_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Database Migration Service makes it easier for you to migrate your data to Google Cloud. Database Migration Service helps you lift and shift your MySQL and PostgreSQL workloads into Cloud SQL. Database Migration Service streamlines networking workflow, manages the initial snapshot and ongoing replication, and provides a status of the migration operation.",
+- ruby_cloud_title = "Cloud Database Migration Service V1",
+- deps = [
+- ":clouddms_ruby_grpc",
+- ":clouddms_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-clouddms-v1-ruby",
+- deps = [
+- ":clouddms_ruby_gapic",
+- ":clouddms_ruby_grpc",
+- ":clouddms_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "clouddms_csharp_proto",
+- deps = [":clouddms_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "clouddms_csharp_grpc",
+- srcs = [":clouddms_proto"],
+- deps = [":clouddms_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "clouddms_csharp_gapic",
+- srcs = [":clouddms_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "library_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datamigration_v1.yaml",
+- deps = [
+- ":clouddms_csharp_grpc",
+- ":clouddms_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-clouddms-v1-csharp",
+- deps = [
+- ":clouddms_csharp_gapic",
+- ":clouddms_csharp_grpc",
+- ":clouddms_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "clouddms_cc_proto",
+- deps = [":clouddms_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "clouddms_cc_grpc",
+- srcs = [":clouddms_proto"],
+- grpc_only = True,
+- deps = [":clouddms_cc_proto"],
+-)
+diff -urN a/google/cloud/cloudsetup/logging/v1/BUILD.bazel b/google/cloud/cloudsetup/logging/v1/BUILD.bazel
+--- a/google/cloud/cloudsetup/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/cloudsetup/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,180 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "complete_deployment.proto",
+- ],
+- deps = [
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/cloudsetup/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/commerce/consumer/procurement/v1alpha1/BUILD.bazel b/google/cloud/commerce/consumer/procurement/v1alpha1/BUILD.bazel
+--- a/google/cloud/commerce/consumer/procurement/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/commerce/consumer/procurement/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,387 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "procurement_proto",
+- srcs = [
+- "order.proto",
+- "procurement_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "procurement_proto_with_info",
+- deps = [
+- ":procurement_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "procurement_java_proto",
+- deps = [":procurement_proto"],
+-)
+-
+-java_grpc_library(
+- name = "procurement_java_grpc",
+- srcs = [":procurement_proto"],
+- deps = [":procurement_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "procurement_java_gapic",
+- srcs = [":procurement_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "commerceconsumerprocurement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudcommerceconsumerprocurement_v1alpha1.yaml",
+- test_deps = [
+- ":procurement_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":procurement_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "procurement_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.commerce.consumer.procurement.v1alpha1.ConsumerProcurementServiceClientHttpJsonTest",
+- "com.google.cloud.commerce.consumer.procurement.v1alpha1.ConsumerProcurementServiceClientTest",
+- ],
+- runtime_deps = [":procurement_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-consumer-procurement-v1alpha1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":procurement_java_gapic",
+- ":procurement_java_grpc",
+- ":procurement_java_proto",
+- ":procurement_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "procurement_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/commerce/consumer/procurement/v1alpha1",
+- protos = [":procurement_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "procurement_go_gapic",
+- srcs = [":procurement_proto_with_info"],
+- grpc_service_config = "commerceconsumerprocurement_grpc_service_config.json",
+- importpath = "cloud.google.com/go/commerce/consumer/procurement/apiv1alpha1;procurement",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "cloudcommerceconsumerprocurement_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":procurement_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "procurement_go_gapic_test",
+- srcs = [":procurement_go_gapic_srcjar_test"],
+- embed = [":procurement_go_gapic"],
+- importpath = "cloud.google.com/go/commerce/consumer/procurement/apiv1alpha1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-consumer-procurement-v1alpha1-go",
+- deps = [
+- ":procurement_go_gapic",
+- ":procurement_go_gapic_srcjar-metadata.srcjar",
+- ":procurement_go_gapic_srcjar-test.srcjar",
+- ":procurement_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "procurement_py_gapic",
+- srcs = [":procurement_proto"],
+- grpc_service_config = "commerceconsumerprocurement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudcommerceconsumerprocurement_v1alpha1.yaml",
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "procurement_py_gapic_test",
+- srcs = [
+- "procurement_py_gapic_pytest.py",
+- "procurement_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":procurement_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "consumer-procurement-v1alpha1-py",
+- deps = [
+- ":procurement_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "procurement_php_proto",
+- deps = [":procurement_proto"],
+-)
+-
+-php_grpc_library(
+- name = "procurement_php_grpc",
+- srcs = [":procurement_proto"],
+- deps = [":procurement_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "procurement_php_gapic",
+- srcs = [":procurement_proto_with_info"],
+- grpc_service_config = "commerceconsumerprocurement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudcommerceconsumerprocurement_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":procurement_php_grpc",
+- ":procurement_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-consumer-procurement-v1alpha1-php",
+- deps = [
+- ":procurement_php_gapic",
+- ":procurement_php_grpc",
+- ":procurement_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "procurement_nodejs_gapic",
+- package_name = "@google-cloud/procurement",
+- src = ":procurement_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "commerceconsumerprocurement_grpc_service_config.json",
+- package = "google.cloud.commerce.consumer.procurement.v1alpha1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudcommerceconsumerprocurement_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "consumer-procurement-v1alpha1-nodejs",
+- deps = [
+- ":procurement_nodejs_gapic",
+- ":procurement_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "procurement_ruby_proto",
+- deps = [":procurement_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "procurement_ruby_grpc",
+- srcs = [":procurement_proto"],
+- deps = [":procurement_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "procurement_ruby_gapic",
+- srcs = [":procurement_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-consumer-procurement-v1alpha1",
+- ],
+- grpc_service_config = "commerceconsumerprocurement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudcommerceconsumerprocurement_v1alpha1.yaml",
+- deps = [
+- ":procurement_ruby_grpc",
+- ":procurement_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-consumer-procurement-v1alpha1-ruby",
+- deps = [
+- ":procurement_ruby_gapic",
+- ":procurement_ruby_grpc",
+- ":procurement_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "procurement_csharp_proto",
+- deps = [":procurement_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "procurement_csharp_grpc",
+- srcs = [":procurement_proto"],
+- deps = [":procurement_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "procurement_csharp_gapic",
+- srcs = [":procurement_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "commerceconsumerprocurement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudcommerceconsumerprocurement_v1alpha1.yaml",
+- deps = [
+- ":procurement_csharp_grpc",
+- ":procurement_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-consumer-procurement-v1alpha1-csharp",
+- deps = [
+- ":procurement_csharp_gapic",
+- ":procurement_csharp_grpc",
+- ":procurement_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "procurement_cc_proto",
+- deps = [":procurement_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "procurement_cc_grpc",
+- srcs = [":procurement_proto"],
+- grpc_only = True,
+- deps = [":procurement_cc_proto"],
+-)
+diff -urN a/google/cloud/common/BUILD.bazel b/google/cloud/common/BUILD.bazel
+--- a/google/cloud/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/common/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,186 +0,0 @@
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "common_proto",
+- srcs = [
+- "operation_metadata.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "common_proto_with_info",
+- deps = [
+- ":common_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "common_java_proto",
+- deps = [":common_proto"],
+-)
+-
+-java_grpc_library(
+- name = "common_java_grpc",
+- srcs = [":common_proto"],
+- deps = [":common_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "common_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/common",
+- protos = [":common_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "common_php_proto",
+- deps = [":common_proto"],
+-)
+-
+-php_grpc_library(
+- name = "common_php_grpc",
+- srcs = [":common_proto"],
+- deps = [":common_php_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_proto_library",
+-)
+-
+-py_gapic_library(
+- name = "common_py_gapic",
+- srcs = [":common_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_proto_library(
+- name = "common_py_proto",
+- deps = [":common_proto"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "common-py",
+- deps = [
+- ":common_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "common_ruby_proto",
+- deps = [":common_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "common_ruby_grpc",
+- srcs = [":common_proto"],
+- deps = [":common_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "common_csharp_proto",
+- deps = [":common_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "common_csharp_grpc",
+- srcs = [":common_proto"],
+- deps = [":common_csharp_proto"],
+-)
+-
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-common-csharp",
+- package_name = "Google.Cloud.Common",
+- generate_nongapic_package = True,
+- deps = [
+- ":common_csharp_grpc",
+- ":common_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "common_cc_proto",
+- deps = [":common_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "common_cc_grpc",
+- srcs = [":common_proto"],
+- grpc_only = True,
+- deps = [":common_cc_proto"],
+-)
+diff -urN a/google/cloud/compute/BUILD.bazel b/google/cloud/compute/BUILD.bazel
+--- a/google/cloud/compute/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/compute/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-compute.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for compute.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "compute_ruby_wrapper",
+- srcs = ["//google/cloud/compute/v1:compute_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-compute",
+- "ruby-cloud-wrapper-of=v1:1.7",
+- "ruby-cloud-product-url=https://cloud.google.com/compute/",
+- "ruby-cloud-api-id=compute.googleapis.com",
+- "ruby-cloud-api-shortname=compute",
+- "ruby-cloud-generate-transports=rest",
+- "ruby-cloud-env-prefix=COMPUTE",
+- ],
+- ruby_cloud_description = "google-cloud-compute is the official client library for the Google Cloud Compute API.",
+- ruby_cloud_title = "Google Cloud Compute",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-compute-ruby",
+- deps = [
+- ":compute_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/compute/v1/BUILD.bazel b/google/cloud/compute/v1/BUILD.bazel
+--- a/google/cloud/compute/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/compute/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,411 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-exports_files(glob(include = ["*grpc_service_config.json"]))
+-
+-##############################################################################
+-# Discovery
+-##############################################################################
+-load(
+- "@com_google_disco_to_proto3_converter//rules_gapic:disco_to_proto.bzl",
+- "gapic_yaml_from_disco",
+- "grpc_service_config_from_disco",
+- "proto_from_disco",
+-)
+-
+-_MESSAGE_IGNORE_LIST = [
+- "HttpHealthCheck",
+- "HttpsHealthCheck",
+- "HttpHealthCheckList",
+- "HttpsHealthCheckList",
+- "GetHttpHealthCheckRequest",
+- "GetHttpsHealthCheckRequest",
+- "PatchHttpHealthCheckRequest",
+- "PatchHttpsHealthCheckRequest",
+- "UpdateHttpHealthCheckRequest",
+- "UpdateHttpsHealthCheckRequest",
+- "InsertHttpHealthCheckRequest",
+- "InsertHttpsHealthCheckRequest",
+- "ListHttpHealthChecksRequest",
+- "ListHttpsHealthChecksRequest",
+- "DeleteHttpHealthCheckRequest",
+- "DeleteHttpsHealthCheckRequest",
+-]
+-
+-_SERVICE_IGNORELIST = [
+- "HttpHealthChecks",
+- "HttpsHealthChecks",
+-]
+-
+-proto_from_disco(
+- name = "compute_gen",
+- src = "compute.v1.json",
+- previous_proto = "compute.proto",
+- enums_as_strings = True,
+- message_ignorelist = _MESSAGE_IGNORE_LIST,
+- service_ignorelist = _SERVICE_IGNORELIST,
+-)
+-
+-grpc_service_config_from_disco(
+- name = "compute_grpc_service_config_gen",
+- src = "compute.v1.json",
+- previous_proto = "compute.proto",
+- message_ignorelist = _MESSAGE_IGNORE_LIST,
+- service_ignorelist = _SERVICE_IGNORELIST,
+-)
+-
+-gapic_yaml_from_disco(
+- name = "compute_gapic_gen",
+- src = "compute.v1.json",
+- previous_proto = "compute.proto",
+- message_ignorelist = _MESSAGE_IGNORE_LIST,
+- service_ignorelist = _SERVICE_IGNORELIST,
+-)
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "compute_proto",
+- srcs = [
+- "compute.proto",
+- ],
+- deps = [
+- "@com_google_googleapis//google/api:annotations_proto",
+- "@com_google_googleapis//google/api:client_proto",
+- "@com_google_googleapis//google/api:field_behavior_proto",
+- "@com_google_googleapis//google/api:resource_proto",
+- "@com_google_googleapis//google/cloud:extended_operations_proto",
+- "@com_google_protobuf//:descriptor_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "compute_proto_with_info",
+- deps = [
+- ":compute_proto",
+- "@com_google_googleapis//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "compute_java_proto",
+- deps = [":compute_proto"],
+-)
+-
+-java_gapic_library(
+- name = "compute_java_gapic",
+- srcs = [":compute_proto_with_info"],
+- gapic_yaml = "compute_gapic.yaml",
+- grpc_service_config = ":compute_grpc_service_config.json",
+- test_deps = [],
+- transport = "rest",
+- deps = [
+- ":compute_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "compute_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.compute.v1.AcceleratorTypesClientTest",
+- "com.google.cloud.compute.v1.AddressesClientTest",
+- "com.google.cloud.compute.v1.AutoscalersClientTest",
+- "com.google.cloud.compute.v1.BackendBucketsClientTest",
+- "com.google.cloud.compute.v1.BackendServicesClientTest",
+- "com.google.cloud.compute.v1.DiskTypesClientTest",
+- "com.google.cloud.compute.v1.DisksClientTest",
+- "com.google.cloud.compute.v1.ExternalVpnGatewaysClientTest",
+- "com.google.cloud.compute.v1.FirewallPoliciesClientTest",
+- "com.google.cloud.compute.v1.FirewallsClientTest",
+- "com.google.cloud.compute.v1.ForwardingRulesClientTest",
+- "com.google.cloud.compute.v1.GlobalAddressesClientTest",
+- "com.google.cloud.compute.v1.GlobalForwardingRulesClientTest",
+- "com.google.cloud.compute.v1.GlobalNetworkEndpointGroupsClientTest",
+- "com.google.cloud.compute.v1.GlobalOperationsClientTest",
+- "com.google.cloud.compute.v1.GlobalOrganizationOperationsClientTest",
+- "com.google.cloud.compute.v1.GlobalPublicDelegatedPrefixesClientTest",
+- "com.google.cloud.compute.v1.HealthChecksClientTest",
+- "com.google.cloud.compute.v1.ImageFamilyViewsClientTest",
+- "com.google.cloud.compute.v1.ImagesClientTest",
+- "com.google.cloud.compute.v1.InstanceGroupManagersClientTest",
+- "com.google.cloud.compute.v1.InstanceGroupsClientTest",
+- "com.google.cloud.compute.v1.InstanceTemplatesClientTest",
+- "com.google.cloud.compute.v1.InstancesClientTest",
+- "com.google.cloud.compute.v1.InterconnectAttachmentsClientTest",
+- "com.google.cloud.compute.v1.InterconnectLocationsClientTest",
+- "com.google.cloud.compute.v1.InterconnectsClientTest",
+- "com.google.cloud.compute.v1.LicenseCodesClientTest",
+- "com.google.cloud.compute.v1.LicensesClientTest",
+- "com.google.cloud.compute.v1.MachineTypesClientTest",
+- "com.google.cloud.compute.v1.NetworkEndpointGroupsClientTest",
+- "com.google.cloud.compute.v1.NetworksClientTest",
+- "com.google.cloud.compute.v1.NodeGroupsClientTest",
+- "com.google.cloud.compute.v1.NodeTemplatesClientTest",
+- "com.google.cloud.compute.v1.NodeTypesClientTest",
+- "com.google.cloud.compute.v1.PacketMirroringsClientTest",
+- "com.google.cloud.compute.v1.ProjectsClientTest",
+- "com.google.cloud.compute.v1.PublicAdvertisedPrefixesClientTest",
+- "com.google.cloud.compute.v1.PublicDelegatedPrefixesClientTest",
+- "com.google.cloud.compute.v1.RegionAutoscalersClientTest",
+- "com.google.cloud.compute.v1.RegionBackendServicesClientTest",
+- "com.google.cloud.compute.v1.RegionCommitmentsClientTest",
+- "com.google.cloud.compute.v1.RegionDiskTypesClientTest",
+- "com.google.cloud.compute.v1.RegionDisksClientTest",
+- "com.google.cloud.compute.v1.RegionHealthCheckServicesClientTest",
+- "com.google.cloud.compute.v1.RegionHealthChecksClientTest",
+- "com.google.cloud.compute.v1.RegionInstanceGroupManagersClientTest",
+- "com.google.cloud.compute.v1.RegionInstanceGroupsClientTest",
+- "com.google.cloud.compute.v1.RegionInstancesClientTest",
+- "com.google.cloud.compute.v1.RegionNetworkEndpointGroupsClientTest",
+- "com.google.cloud.compute.v1.RegionNotificationEndpointsClientTest",
+- "com.google.cloud.compute.v1.RegionOperationsClientTest",
+- "com.google.cloud.compute.v1.RegionSslCertificatesClientTest",
+- "com.google.cloud.compute.v1.RegionTargetHttpProxiesClientTest",
+- "com.google.cloud.compute.v1.RegionTargetHttpsProxiesClientTest",
+- "com.google.cloud.compute.v1.RegionUrlMapsClientTest",
+- "com.google.cloud.compute.v1.RegionsClientTest",
+- "com.google.cloud.compute.v1.ReservationsClientTest",
+- "com.google.cloud.compute.v1.ResourcePoliciesClientTest",
+- "com.google.cloud.compute.v1.RoutersClientTest",
+- "com.google.cloud.compute.v1.RoutesClientTest",
+- "com.google.cloud.compute.v1.SecurityPoliciesClientTest",
+- "com.google.cloud.compute.v1.ServiceAttachmentsClientTest",
+- "com.google.cloud.compute.v1.SnapshotsClientTest",
+- "com.google.cloud.compute.v1.SslCertificatesClientTest",
+- "com.google.cloud.compute.v1.SslPoliciesClientTest",
+- "com.google.cloud.compute.v1.SubnetworksClientTest",
+- "com.google.cloud.compute.v1.TargetGrpcProxiesClientTest",
+- "com.google.cloud.compute.v1.TargetHttpProxiesClientTest",
+- "com.google.cloud.compute.v1.TargetHttpsProxiesClientTest",
+- "com.google.cloud.compute.v1.TargetInstancesClientTest",
+- "com.google.cloud.compute.v1.TargetPoolsClientTest",
+- "com.google.cloud.compute.v1.TargetSslProxiesClientTest",
+- "com.google.cloud.compute.v1.TargetTcpProxiesClientTest",
+- "com.google.cloud.compute.v1.TargetVpnGatewaysClientTest",
+- "com.google.cloud.compute.v1.UrlMapsClientTest",
+- "com.google.cloud.compute.v1.VpnGatewaysClientTest",
+- "com.google.cloud.compute.v1.VpnTunnelsClientTest",
+- "com.google.cloud.compute.v1.ZoneOperationsClientTest",
+- "com.google.cloud.compute.v1.ZonesClientTest",
+- ],
+- runtime_deps = [":compute_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-compute-v1-java",
+- transport = "rest",
+- deps = [
+- ":compute_java_gapic",
+- ":compute_java_proto",
+- ":compute_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "compute_py_gapic",
+- srcs = [
+- ":compute_proto",
+- ],
+- opt_args = [
+- "transport=rest",
+- "autogen-snippets=False",
+- ],
+-)
+-
+-py_test(
+- name = "compute_py_gapic_test",
+- srcs = [
+- "compute_py_gapic_pytest.py",
+- "compute_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":compute_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "compute-v1-py",
+- deps = [
+- ":compute_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "compute_php_proto",
+- deps = [":compute_proto"],
+-)
+-
+-php_gapic_library(
+- name = "compute_php_gapic",
+- srcs = [":compute_proto_with_info"],
+- grpc_service_config = "compute_grpc_service_config.json",
+- service_yaml = "compute_v1.yaml",
+- transport = "rest",
+- deps = [
+- ":compute_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-compute-v1-php",
+- deps = [
+- ":compute_php_gapic",
+- ":compute_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "compute_nodejs_gapic",
+- package_name = "@google-cloud/compute",
+- src = ":compute_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- diregapic = True,
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "compute-v1-nodejs",
+- deps = [
+- ":compute_nodejs_gapic",
+- ":compute_proto",
+- ],
+-)
+-
+-###############################################################################
+-# Ruby
+-###############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "compute_ruby_proto",
+- deps = [":compute_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "compute_ruby_gapic",
+- srcs = [":compute_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=compute.googleapis.com",
+- "ruby-cloud-api-shortname=compute",
+- "ruby-cloud-gem-name=google-cloud-compute-v1",
+- "ruby-cloud-generate-metadata=false",
+- "ruby-cloud-generate-transports=rest",
+- "ruby-cloud-env-prefix=COMPUTE",
+- "ruby-cloud-product-url=https://cloud.google.com/compute/",
+- "ruby-cloud-wrapper-gem-override=",
+- "ruby-cloud-extra-dependencies=google-cloud-common=~> 1.0",
+- ],
+- grpc_service_config = ":compute_grpc_service_config.json",
+- ruby_cloud_description = "google-cloud-compute-v1 is the official client library for the Google Cloud Compute V1 API.",
+- ruby_cloud_title = "Google Cloud Compute V1",
+- deps = [
+- ":compute_ruby_proto",
+- ],
+-)
+-
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-compute-v1-ruby",
+- deps = [
+- ":compute_ruby_gapic",
+- ":compute_ruby_proto",
+- ],
+-)
+-
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "compute_csharp_proto",
+- deps = [":compute_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "compute_csharp_grpc",
+- srcs = [":compute_proto"],
+- deps = [":compute_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "compute_csharp_gapic",
+- srcs = [":compute_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = ":compute_grpc_service_config.json",
+- transport = "rest",
+- deps = [
+- ":compute_csharp_grpc",
+- ":compute_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-compute-v1-csharp",
+- deps = [
+- ":compute_csharp_gapic",
+- ":compute_csharp_grpc",
+- ":compute_csharp_proto",
+- ],
+-)
+diff -urN a/google/cloud/compute/v1small/BUILD.bazel b/google/cloud/compute/v1small/BUILD.bazel
+--- a/google/cloud/compute/v1small/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/compute/v1small/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,182 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-exports_files(glob(include = ["*grpc_service_config.json"]))
+-
+-##############################################################################
+-# Discovery
+-##############################################################################
+-load(
+- "@com_google_disco_to_proto3_converter//rules_gapic:disco_to_proto.bzl",
+- "gapic_yaml_from_disco",
+- "grpc_service_config_from_disco",
+- "proto_from_disco",
+-)
+-
+-proto_from_disco(
+- name = "compute_small_gen",
+- src = "compute.v1small.json",
+- enums_as_strings = True,
+-)
+-
+-grpc_service_config_from_disco(
+- name = "compute_small_grpc_service_config_gen",
+- src = "compute.v1small.json",
+-)
+-
+-gapic_yaml_from_disco(
+- name = "compute_small_gapic_gen",
+- src = "compute.v1small.json",
+-)
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "compute_small_proto",
+- srcs = [
+- "compute_small.proto",
+- ],
+- deps = [
+- "@com_google_googleapis//google/api:annotations_proto",
+- "@com_google_googleapis//google/api:client_proto",
+- "@com_google_googleapis//google/api:field_behavior_proto",
+- "@com_google_googleapis//google/api:resource_proto",
+- "@com_google_googleapis//google/cloud:extended_operations_proto",
+- "@com_google_googleapis//google/longrunning:operations_proto",
+- "@com_google_protobuf//:descriptor_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "compute_small_proto_with_info",
+- deps = [
+- ":compute_small_proto",
+- "@com_google_googleapis//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-# Java Compute Small (for testing and prototyping purposes)
+-java_proto_library(
+- name = "compute_small_java_proto",
+- deps = [":compute_small_proto"],
+-)
+-
+-# Used for integration tests
+-java_gapic_library(
+- name = "compute_small_java_gapic",
+- srcs = [":compute_small_proto_with_info"],
+- gapic_yaml = "compute_small_gapic.yaml",
+- grpc_service_config = ":compute_small_grpc_service_config.json",
+- test_deps = [],
+- transport = "rest",
+- deps = [
+- ":compute_small_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "compute_small_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.compute.v1small.AddressesClientTest",
+- ],
+- runtime_deps = [":compute_small_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-compute-small-v1-java",
+- transport = "rest",
+- deps = [
+- ":compute_small_java_gapic",
+- ":compute_small_java_proto",
+- ":compute_small_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-# Python Compute Small (for testing and prototyping purposes)
+-py_gapic_library(
+- name = "compute_small_py_gapic",
+- srcs = [
+- ":compute_small_proto",
+- ],
+- opt_args = [
+- "transport=rest",
+- ],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "compute-small-v1-py",
+- deps = [
+- ":compute_small_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-# Put your PHP rules here
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-# Node.js Compute Small (for testing and prototyping purposes)
+-nodejs_gapic_library(
+- name = "compute_small_nodejs_gapic",
+- package_name = "@google-cloud/compute-small",
+- src = ":compute_small_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- diregapic = True,
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "compute-small-v1-nodejs",
+- deps = [
+- ":compute_small_nodejs_gapic",
+- ":compute_small_proto",
+- ],
+-)
+-
+-###############################################################################
+-# Ruby
+-###############################################################################
+-# Put your Ruby rules here
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-# Put your C# rules here
+diff -urN a/google/cloud/connectors/v1/BUILD.bazel b/google/cloud/connectors/v1/BUILD.bazel
+--- a/google/cloud/connectors/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/connectors/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,408 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "connectors_proto",
+- srcs = [
+- "authconfig.proto",
+- "common.proto",
+- "connection.proto",
+- "connector.proto",
+- "connector_version.proto",
+- "connectors_service.proto",
+- "destination_config.proto",
+- "provider.proto",
+- "runtime.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "connectors_proto_with_info",
+- deps = [
+- ":connectors_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "connectors_java_proto",
+- deps = [":connectors_proto"],
+-)
+-
+-java_grpc_library(
+- name = "connectors_java_grpc",
+- srcs = [":connectors_proto"],
+- deps = [":connectors_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "connectors_java_gapic",
+- srcs = [":connectors_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "connectors_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "connectors_v1.yaml",
+- test_deps = [
+- ":connectors_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":connectors_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "connectors_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.connectors.v1.ConnectorsClientHttpJsonTest",
+- "com.google.cloud.connectors.v1.ConnectorsClientTest",
+- ],
+- runtime_deps = [":connectors_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-connectors-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":connectors_java_gapic",
+- ":connectors_java_grpc",
+- ":connectors_java_proto",
+- ":connectors_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "connectors_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/connectors/v1",
+- protos = [":connectors_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "connectors_go_gapic",
+- srcs = [":connectors_proto_with_info"],
+- grpc_service_config = "connectors_grpc_service_config.json",
+- importpath = "cloud.google.com/go/connectors/apiv1;connectors",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "connectors_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":connectors_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "connectors_go_gapic_test",
+- srcs = [":connectors_go_gapic_srcjar_test"],
+- embed = [":connectors_go_gapic"],
+- importpath = "cloud.google.com/go/connectors/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-connectors-v1-go",
+- deps = [
+- ":connectors_go_gapic",
+- ":connectors_go_gapic_srcjar-metadata.srcjar",
+- ":connectors_go_gapic_srcjar-test.srcjar",
+- ":connectors_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "connectors_py_gapic",
+- srcs = [":connectors_proto"],
+- grpc_service_config = "connectors_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "connectors_v1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "connectors_py_gapic_test",
+- srcs = [
+- "connectors_py_gapic_pytest.py",
+- "connectors_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":connectors_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "connectors-v1-py",
+- deps = [
+- ":connectors_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "connectors_php_proto",
+- deps = [":connectors_proto"],
+-)
+-
+-php_grpc_library(
+- name = "connectors_php_grpc",
+- srcs = [":connectors_proto"],
+- deps = [":connectors_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "connectors_php_gapic",
+- srcs = [":connectors_proto_with_info"],
+- grpc_service_config = "connectors_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "connectors_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":connectors_php_grpc",
+- ":connectors_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-connectors-v1-php",
+- deps = [
+- ":connectors_php_gapic",
+- ":connectors_php_grpc",
+- ":connectors_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "connectors_nodejs_gapic",
+- package_name = "@google-cloud/connectors",
+- src = ":connectors_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "connectors_grpc_service_config.json",
+- package = "google.cloud.connectors.v1",
+- rest_numeric_enums = False,
+- service_yaml = "connectors_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "connectors-v1-nodejs",
+- deps = [
+- ":connectors_nodejs_gapic",
+- ":connectors_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "connectors_ruby_proto",
+- deps = [":connectors_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "connectors_ruby_grpc",
+- srcs = [":connectors_proto"],
+- deps = [":connectors_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "connectors_ruby_gapic",
+- srcs = [":connectors_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-connectors-v1",
+- ],
+- grpc_service_config = "connectors_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "connectors_v1.yaml",
+- deps = [
+- ":connectors_ruby_grpc",
+- ":connectors_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-connectors-v1-ruby",
+- deps = [
+- ":connectors_ruby_gapic",
+- ":connectors_ruby_grpc",
+- ":connectors_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "connectors_csharp_proto",
+- deps = [":connectors_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "connectors_csharp_grpc",
+- srcs = [":connectors_proto"],
+- deps = [":connectors_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "connectors_csharp_gapic",
+- srcs = [":connectors_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "connectors_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "connectors_v1.yaml",
+- deps = [
+- ":connectors_csharp_grpc",
+- ":connectors_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-connectors-v1-csharp",
+- deps = [
+- ":connectors_csharp_gapic",
+- ":connectors_csharp_grpc",
+- ":connectors_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "connectors_cc_proto",
+- deps = [":connectors_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "connectors_cc_grpc",
+- srcs = [":connectors_proto"],
+- grpc_only = True,
+- deps = [":connectors_cc_proto"],
+-)
+diff -urN a/google/cloud/contactcenterinsights/BUILD.bazel b/google/cloud/contactcenterinsights/BUILD.bazel
+--- a/google/cloud/contactcenterinsights/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/contactcenterinsights/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-contact_center_insights.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for contactcenterinsights.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "contactcenterinsights_ruby_wrapper",
+- srcs = ["//google/cloud/contactcenterinsights/v1:contactcenterinsights_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-contact_center_insights",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/contact-center/insights/docs",
+- "ruby-cloud-api-id=contactcenterinsights.googleapis.com",
+- "ruby-cloud-api-shortname=contactcenterinsights",
+- ],
+- ruby_cloud_description = "Contact Center AI Insights helps users detect and visualize patterns in their contact center data. Understanding conversational data drives business value, improves operational efficiency, and provides a voice for customer feedback.",
+- ruby_cloud_title = "Contact Center AI Insights",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-contactcenterinsights-ruby",
+- deps = [
+- ":contactcenterinsights_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/contactcenterinsights/v1/BUILD.bazel b/google/cloud/contactcenterinsights/v1/BUILD.bazel
+--- a/google/cloud/contactcenterinsights/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/contactcenterinsights/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,398 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "contactcenterinsights_proto",
+- srcs = [
+- "contact_center_insights.proto",
+- "resources.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "contactcenterinsights_proto_with_info",
+- deps = [
+- ":contactcenterinsights_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "contactcenterinsights_java_proto",
+- deps = [":contactcenterinsights_proto"],
+-)
+-
+-java_grpc_library(
+- name = "contactcenterinsights_java_grpc",
+- srcs = [":contactcenterinsights_proto"],
+- deps = [":contactcenterinsights_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "contactcenterinsights_java_gapic",
+- srcs = [":contactcenterinsights_proto_with_info"],
+- grpc_service_config = "contactcenterinsights_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":contactcenterinsights_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":contactcenterinsights_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "contactcenterinsights_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClientHttpJsonTest",
+- "com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClientTest",
+- ],
+- runtime_deps = [":contactcenterinsights_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-contactcenterinsights-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":contactcenterinsights_java_gapic",
+- ":contactcenterinsights_java_grpc",
+- ":contactcenterinsights_java_proto",
+- ":contactcenterinsights_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "contactcenterinsights_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/contactcenterinsights/v1",
+- protos = [":contactcenterinsights_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "contactcenterinsights_go_gapic",
+- srcs = [":contactcenterinsights_proto_with_info"],
+- grpc_service_config = "contactcenterinsights_grpc_service_config.json",
+- importpath = "cloud.google.com/go/contactcenterinsights/apiv1;contactcenterinsights",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "contactcenterinsights_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":contactcenterinsights_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "contactcenterinsights_go_gapic_test",
+- srcs = [":contactcenterinsights_go_gapic_srcjar_test"],
+- embed = [":contactcenterinsights_go_gapic"],
+- importpath = "cloud.google.com/go/contactcenterinsights/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-contactcenterinsights-v1-go",
+- deps = [
+- ":contactcenterinsights_go_gapic",
+- ":contactcenterinsights_go_gapic_srcjar-metadata.srcjar",
+- ":contactcenterinsights_go_gapic_srcjar-test.srcjar",
+- ":contactcenterinsights_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "contactcenterinsights_py_gapic",
+- srcs = [":contactcenterinsights_proto"],
+- grpc_service_config = "contactcenterinsights_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-contact-center-insights",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=contact_center_insights",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "contactcenterinsights_py_gapic_test",
+- srcs = [
+- "contactcenterinsights_py_gapic_pytest.py",
+- "contactcenterinsights_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":contactcenterinsights_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "contactcenterinsights-v1-py",
+- deps = [
+- ":contactcenterinsights_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "contactcenterinsights_php_proto",
+- deps = [":contactcenterinsights_proto"],
+-)
+-
+-php_grpc_library(
+- name = "contactcenterinsights_php_grpc",
+- srcs = [":contactcenterinsights_proto"],
+- deps = [":contactcenterinsights_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "contactcenterinsights_php_gapic",
+- srcs = [":contactcenterinsights_proto_with_info"],
+- grpc_service_config = "contactcenterinsights_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "contactcenterinsights_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":contactcenterinsights_php_grpc",
+- ":contactcenterinsights_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-contactcenterinsights-v1-php",
+- deps = [
+- ":contactcenterinsights_php_gapic",
+- ":contactcenterinsights_php_grpc",
+- ":contactcenterinsights_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "contactcenterinsights_nodejs_gapic",
+- package_name = "@google-cloud/contact-center-insights",
+- src = ":contactcenterinsights_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "contactcenterinsights_grpc_service_config.json",
+- package = "google.cloud.contactcenterinsights.v1",
+- rest_numeric_enums = False,
+- service_yaml = "contactcenterinsights_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "contactcenterinsights-v1-nodejs",
+- deps = [
+- ":contactcenterinsights_nodejs_gapic",
+- ":contactcenterinsights_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "contactcenterinsights_ruby_proto",
+- deps = [":contactcenterinsights_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "contactcenterinsights_ruby_grpc",
+- srcs = [":contactcenterinsights_proto"],
+- deps = [":contactcenterinsights_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "contactcenterinsights_ruby_gapic",
+- srcs = [":contactcenterinsights_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-contact_center_insights-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/contact-center/insights/docs",
+- "ruby-cloud-api-id=contactcenterinsights.googleapis.com",
+- "ruby-cloud-api-shortname=contactcenterinsights",
+- ],
+- grpc_service_config = "contactcenterinsights_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Contact Center AI Insights helps users detect and visualize patterns in their contact center data. Understanding conversational data drives business value, improves operational efficiency, and provides a voice for customer feedback.",
+- ruby_cloud_title = "Contact Center AI Insights V1",
+- deps = [
+- ":contactcenterinsights_ruby_grpc",
+- ":contactcenterinsights_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-contactcenterinsights-v1-ruby",
+- deps = [
+- ":contactcenterinsights_ruby_gapic",
+- ":contactcenterinsights_ruby_grpc",
+- ":contactcenterinsights_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "contactcenterinsights_csharp_proto",
+- deps = [":contactcenterinsights_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "contactcenterinsights_csharp_grpc",
+- srcs = [":contactcenterinsights_proto"],
+- deps = [":contactcenterinsights_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "contactcenterinsights_csharp_gapic",
+- srcs = [":contactcenterinsights_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "contactcenterinsights_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "contactcenterinsights_v1.yaml",
+- deps = [
+- ":contactcenterinsights_csharp_grpc",
+- ":contactcenterinsights_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-contactcenterinsights-v1-csharp",
+- deps = [
+- ":contactcenterinsights_csharp_gapic",
+- ":contactcenterinsights_csharp_grpc",
+- ":contactcenterinsights_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "contactcenterinsights_cc_proto",
+- deps = [":contactcenterinsights_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "contactcenterinsights_cc_grpc",
+- srcs = [":contactcenterinsights_proto"],
+- grpc_only = True,
+- deps = [":contactcenterinsights_cc_proto"],
+-)
+diff -urN a/google/cloud/contentwarehouse/v1/BUILD.bazel b/google/cloud/contentwarehouse/v1/BUILD.bazel
+--- a/google/cloud/contentwarehouse/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/contentwarehouse/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,427 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "contentwarehouse_proto",
+- srcs = [
+- "async_document_service_request.proto",
+- "common.proto",
+- "document.proto",
+- "document_link_service.proto",
+- "document_schema.proto",
+- "document_schema_service.proto",
+- "document_service.proto",
+- "document_service_request.proto",
+- "filters.proto",
+- "histogram.proto",
+- "rule_engine.proto",
+- "ruleset_service.proto",
+- "ruleset_service_request.proto",
+- "synonymset.proto",
+- "synonymset_service.proto",
+- "synonymset_service_request.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/cloud/documentai/v1:documentai_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/type:datetime_proto",
+- "//google/type:interval_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "contentwarehouse_proto_with_info",
+- deps = [
+- ":contentwarehouse_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "contentwarehouse_java_proto",
+- deps = [":contentwarehouse_proto"],
+-)
+-
+-java_grpc_library(
+- name = "contentwarehouse_java_grpc",
+- srcs = [":contentwarehouse_proto"],
+- deps = [":contentwarehouse_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "contentwarehouse_java_gapic",
+- srcs = [":contentwarehouse_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "contentwarehouse_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "contentwarehouse_v1.yaml",
+- test_deps = [
+- ":contentwarehouse_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":contentwarehouse_java_proto",
+- "//google/api:api_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-# TODO(b/246642734): Re-enable the failed json tests
+-java_gapic_test(
+- name = "contentwarehouse_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.contentwarehouse.v1.DocumentLinkServiceClientHttpJsonTest",
+- "com.google.cloud.contentwarehouse.v1.DocumentLinkServiceClientTest",
+- # "com.google.cloud.contentwarehouse.v1.DocumentSchemaServiceClientHttpJsonTest",
+- "com.google.cloud.contentwarehouse.v1.DocumentSchemaServiceClientTest",
+- # "com.google.cloud.contentwarehouse.v1.DocumentServiceClientHttpJsonTest",
+- "com.google.cloud.contentwarehouse.v1.DocumentServiceClientTest",
+- # "com.google.cloud.contentwarehouse.v1.RuleSetServiceClientHttpJsonTest",
+- "com.google.cloud.contentwarehouse.v1.RuleSetServiceClientTest",
+- # "com.google.cloud.contentwarehouse.v1.SynonymSetServiceClientHttpJsonTest",
+- "com.google.cloud.contentwarehouse.v1.SynonymSetServiceClientTest",
+- ],
+- runtime_deps = [":contentwarehouse_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-contentwarehouse-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":contentwarehouse_java_gapic",
+- ":contentwarehouse_java_grpc",
+- ":contentwarehouse_java_proto",
+- ":contentwarehouse_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "contentwarehouse_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/contentwarehouse/v1",
+- protos = [":contentwarehouse_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/cloud/documentai/v1:documentai_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/type:datetime_go_proto",
+- "//google/type:interval_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "contentwarehouse_go_gapic",
+- srcs = [":contentwarehouse_proto_with_info"],
+- grpc_service_config = "contentwarehouse_grpc_service_config.json",
+- importpath = "cloud.google.com/go/contentwarehouse/apiv1;contentwarehouse",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "contentwarehouse_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":contentwarehouse_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "contentwarehouse_go_gapic_test",
+- srcs = [":contentwarehouse_go_gapic_srcjar_test"],
+- embed = [":contentwarehouse_go_gapic"],
+- importpath = "cloud.google.com/go/contentwarehouse/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-contentwarehouse-v1-go",
+- deps = [
+- ":contentwarehouse_go_gapic",
+- ":contentwarehouse_go_gapic_srcjar-metadata.srcjar",
+- ":contentwarehouse_go_gapic_srcjar-test.srcjar",
+- ":contentwarehouse_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "contentwarehouse_py_gapic",
+- srcs = [":contentwarehouse_proto"],
+- grpc_service_config = "contentwarehouse_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "contentwarehouse_v1.yaml",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- "//google/cloud/documentai/v1:documentai_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "contentwarehouse_py_gapic_test",
+- srcs = [
+- "contentwarehouse_py_gapic_pytest.py",
+- "contentwarehouse_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [
+- ":contentwarehouse_py_gapic",
+- ],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "contentwarehouse-v1-py",
+- deps = [
+- ":contentwarehouse_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "contentwarehouse_php_proto",
+- deps = [":contentwarehouse_proto"],
+-)
+-
+-php_grpc_library(
+- name = "contentwarehouse_php_grpc",
+- srcs = [":contentwarehouse_proto"],
+- deps = [":contentwarehouse_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "contentwarehouse_php_gapic",
+- srcs = [":contentwarehouse_proto_with_info"],
+- grpc_service_config = "contentwarehouse_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "contentwarehouse_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":contentwarehouse_php_grpc",
+- ":contentwarehouse_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-contentwarehouse-v1-php",
+- deps = [
+- ":contentwarehouse_php_gapic",
+- ":contentwarehouse_php_grpc",
+- ":contentwarehouse_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "contentwarehouse_nodejs_gapic",
+- package_name = "@google-cloud/contentwarehouse",
+- src = ":contentwarehouse_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "contentwarehouse_grpc_service_config.json",
+- package = "google.cloud.contentwarehouse.v1",
+- rest_numeric_enums = False,
+- service_yaml = "contentwarehouse_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "contentwarehouse-v1-nodejs",
+- deps = [
+- ":contentwarehouse_nodejs_gapic",
+- ":contentwarehouse_proto",
+- # Cross-API dependency requires adding this explicitly to pack protos
+- "//google/cloud/documentai/v1:documentai_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "contentwarehouse_ruby_proto",
+- deps = [":contentwarehouse_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "contentwarehouse_ruby_grpc",
+- srcs = [":contentwarehouse_proto"],
+- deps = [":contentwarehouse_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "contentwarehouse_ruby_gapic",
+- srcs = [":contentwarehouse_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-contentwarehouse-v1",
+- ],
+- grpc_service_config = "contentwarehouse_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "contentwarehouse_v1.yaml",
+- deps = [
+- ":contentwarehouse_ruby_grpc",
+- ":contentwarehouse_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-contentwarehouse-v1-ruby",
+- deps = [
+- ":contentwarehouse_ruby_gapic",
+- ":contentwarehouse_ruby_grpc",
+- ":contentwarehouse_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "contentwarehouse_csharp_proto",
+- deps = [":contentwarehouse_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "contentwarehouse_csharp_grpc",
+- srcs = [":contentwarehouse_proto"],
+- deps = [":contentwarehouse_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "contentwarehouse_csharp_gapic",
+- srcs = [":contentwarehouse_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "contentwarehouse_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "contentwarehouse_v1.yaml",
+- deps = [
+- ":contentwarehouse_csharp_grpc",
+- ":contentwarehouse_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-contentwarehouse-v1-csharp",
+- deps = [
+- ":contentwarehouse_csharp_gapic",
+- ":contentwarehouse_csharp_grpc",
+- ":contentwarehouse_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "contentwarehouse_cc_proto",
+- deps = [":contentwarehouse_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "contentwarehouse_cc_grpc",
+- srcs = [":contentwarehouse_proto"],
+- grpc_only = True,
+- deps = [":contentwarehouse_cc_proto"],
+-)
+diff -urN a/google/cloud/datacatalog/BUILD.bazel b/google/cloud/datacatalog/BUILD.bazel
+--- a/google/cloud/datacatalog/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/datacatalog/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-data_catalog.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for datacatalog.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "datacatalog_ruby_wrapper",
+- srcs = ["//google/cloud/datacatalog/v1:datacatalog_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-data_catalog",
+- "ruby-cloud-env-prefix=DATA_CATALOG",
+- "ruby-cloud-wrapper-of=v1:0.7",
+- "ruby-cloud-product-url=https://cloud.google.com/data-catalog",
+- "ruby-cloud-api-id=datacatalog.googleapis.com",
+- "ruby-cloud-api-shortname=datacatalog",
+- ],
+- ruby_cloud_description = "Data Catalog is a centralized and unified data catalog service for all your Cloud resources, where users and systems can discover data, explore and curate its semantics, understand how to act on it, and help govern its usage.",
+- ruby_cloud_title = "Data Catalog",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-datacatalog-ruby",
+- deps = [
+- ":datacatalog_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/datacatalog/v1/BUILD.bazel b/google/cloud/datacatalog/v1/BUILD.bazel
+--- a/google/cloud/datacatalog/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/datacatalog/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,411 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "datacatalog_proto",
+- srcs = [
+- "bigquery.proto",
+- "common.proto",
+- "data_source.proto",
+- "datacatalog.proto",
+- "dataplex_spec.proto",
+- "gcs_fileset_spec.proto",
+- "physical_schema.proto",
+- "policytagmanager.proto",
+- "policytagmanagerserialization.proto",
+- "schema.proto",
+- "search.proto",
+- "table_spec.proto",
+- "tags.proto",
+- "timestamps.proto",
+- "usage.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "datacatalog_proto_with_info",
+- deps = [
+- ":datacatalog_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "datacatalog_java_proto",
+- deps = [":datacatalog_proto"],
+-)
+-
+-java_grpc_library(
+- name = "datacatalog_java_grpc",
+- srcs = [":datacatalog_proto"],
+- deps = [":datacatalog_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "datacatalog_java_gapic",
+- srcs = [":datacatalog_proto_with_info"],
+- grpc_service_config = "datacatalog_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":datacatalog_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":datacatalog_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "datacatalog_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.datacatalog.v1.DataCatalogClientHttpJsonTest",
+- "com.google.cloud.datacatalog.v1.DataCatalogClientTest",
+- "com.google.cloud.datacatalog.v1.PolicyTagManagerClientHttpJsonTest",
+- "com.google.cloud.datacatalog.v1.PolicyTagManagerClientTest",
+- "com.google.cloud.datacatalog.v1.PolicyTagManagerSerializationClientHttpJsonTest",
+- "com.google.cloud.datacatalog.v1.PolicyTagManagerSerializationClientTest",
+- ],
+- runtime_deps = [":datacatalog_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-datacatalog-v1-java",
+- include_samples = True,
+- deps = [
+- ":datacatalog_java_gapic",
+- ":datacatalog_java_grpc",
+- ":datacatalog_java_proto",
+- ":datacatalog_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "datacatalog_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/datacatalog/v1",
+- protos = [":datacatalog_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "datacatalog_go_gapic",
+- srcs = [":datacatalog_proto_with_info"],
+- grpc_service_config = "datacatalog_grpc_service_config.json",
+- importpath = "cloud.google.com/go/datacatalog/apiv1;datacatalog",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "datacatalog_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datacatalog_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "datacatalog_go_gapic_test",
+- srcs = [":datacatalog_go_gapic_srcjar_test"],
+- embed = [":datacatalog_go_gapic"],
+- importpath = "cloud.google.com/go/datacatalog/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-datacatalog-v1-go",
+- deps = [
+- ":datacatalog_go_gapic",
+- ":datacatalog_go_gapic_srcjar-metadata.srcjar",
+- ":datacatalog_go_gapic_srcjar-test.srcjar",
+- ":datacatalog_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "datacatalog_py_gapic",
+- srcs = [":datacatalog_proto"],
+- grpc_service_config = "datacatalog_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "datacatalog_py_gapic_test",
+- srcs = [
+- "datacatalog_py_gapic_pytest.py",
+- "datacatalog_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":datacatalog_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "datacatalog-v1-py",
+- deps = [
+- ":datacatalog_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "datacatalog_php_proto",
+- deps = [":datacatalog_proto"],
+-)
+-
+-php_grpc_library(
+- name = "datacatalog_php_grpc",
+- srcs = [":datacatalog_proto"],
+- deps = [":datacatalog_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "datacatalog_php_gapic",
+- srcs = [":datacatalog_proto_with_info"],
+- grpc_service_config = "datacatalog_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":datacatalog_php_grpc",
+- ":datacatalog_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-datacatalog-v1-php",
+- deps = [
+- ":datacatalog_php_gapic",
+- ":datacatalog_php_grpc",
+- ":datacatalog_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "datacatalog_nodejs_gapic",
+- package_name = "@google-cloud/datacatalog",
+- src = ":datacatalog_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "datacatalog_grpc_service_config.json",
+- main_service = "DataCatalog",
+- mixins = "none",
+- package = "google.cloud.datacatalog.v1",
+- rest_numeric_enums = False,
+- service_yaml = "datacatalog_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "datacatalog-v1-nodejs",
+- deps = [
+- ":datacatalog_nodejs_gapic",
+- ":datacatalog_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "datacatalog_ruby_proto",
+- deps = [":datacatalog_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "datacatalog_ruby_grpc",
+- srcs = [":datacatalog_proto"],
+- deps = [":datacatalog_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "datacatalog_ruby_gapic",
+- srcs = [":datacatalog_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=datacatalog.googleapis.com",
+- "ruby-cloud-api-shortname=datacatalog",
+- "ruby-cloud-env-prefix=DATA_CATALOG",
+- "ruby-cloud-gem-name=google-cloud-data_catalog-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/data-catalog",
+- ],
+- grpc_service_config = "datacatalog_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "DataCatalog is a centralized and unified data catalog service for all your Cloud resources, where users and systems can discover data, explore and curate its semantics, understand how to act on it, and help govern its usage.",
+- ruby_cloud_title = "Data Catalog V1",
+- deps = [
+- ":datacatalog_ruby_grpc",
+- ":datacatalog_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-datacatalog-v1-ruby",
+- deps = [
+- ":datacatalog_ruby_gapic",
+- ":datacatalog_ruby_grpc",
+- ":datacatalog_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "datacatalog_csharp_proto",
+- deps = [":datacatalog_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "datacatalog_csharp_grpc",
+- srcs = [":datacatalog_proto"],
+- deps = [":datacatalog_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "datacatalog_csharp_gapic",
+- srcs = [":datacatalog_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "datacatalog_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datacatalog_v1.yaml",
+- deps = [
+- ":datacatalog_csharp_grpc",
+- ":datacatalog_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-datacatalog-v1-csharp",
+- deps = [
+- ":datacatalog_csharp_gapic",
+- ":datacatalog_csharp_grpc",
+- ":datacatalog_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "datacatalog_cc_proto",
+- deps = [":datacatalog_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "datacatalog_cc_grpc",
+- srcs = [":datacatalog_proto"],
+- grpc_only = True,
+- deps = [":datacatalog_cc_proto"],
+-)
+diff -urN a/google/cloud/datacatalog/v1beta1/BUILD.bazel b/google/cloud/datacatalog/v1beta1/BUILD.bazel
+--- a/google/cloud/datacatalog/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/datacatalog/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,370 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "datacatalog_proto",
+- srcs = [
+- "common.proto",
+- "datacatalog.proto",
+- "gcs_fileset_spec.proto",
+- "policytagmanager.proto",
+- "policytagmanagerserialization.proto",
+- "schema.proto",
+- "search.proto",
+- "table_spec.proto",
+- "tags.proto",
+- "timestamps.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "datacatalog_proto_with_info",
+- deps = [
+- ":datacatalog_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "datacatalog_java_proto",
+- deps = [":datacatalog_proto"],
+-)
+-
+-java_grpc_library(
+- name = "datacatalog_java_grpc",
+- srcs = [":datacatalog_proto"],
+- deps = [":datacatalog_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "datacatalog_java_gapic",
+- srcs = [":datacatalog_proto_with_info"],
+- grpc_service_config = "datacatalog_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":datacatalog_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":datacatalog_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "datacatalog_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.datacatalog.v1beta1.DataCatalogClientTest",
+- "com.google.cloud.datacatalog.v1beta1.DataCatalogClientHttpJsonTest",
+- "com.google.cloud.datacatalog.v1beta1.PolicyTagManagerClientTest",
+- "com.google.cloud.datacatalog.v1beta1.PolicyTagManagerClientHttpJsonTest",
+- "com.google.cloud.datacatalog.v1beta1.PolicyTagManagerSerializationClientTest",
+- "com.google.cloud.datacatalog.v1beta1.PolicyTagManagerSerializationClientHttpJsonTest",
+- ],
+- runtime_deps = [":datacatalog_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-datacatalog-v1beta1-java",
+- include_samples = True,
+- deps = [
+- ":datacatalog_java_gapic",
+- ":datacatalog_java_grpc",
+- ":datacatalog_java_proto",
+- ":datacatalog_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "datacatalog_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1",
+- protos = [":datacatalog_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "datacatalog_go_gapic",
+- srcs = [":datacatalog_proto_with_info"],
+- grpc_service_config = "datacatalog_grpc_service_config.json",
+- importpath = "cloud.google.com/go/datacatalog/apiv1beta1;datacatalog",
+- rest_numeric_enums = False,
+- service_yaml = "datacatalog_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datacatalog_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "datacatalog_go_gapic_test",
+- srcs = [":datacatalog_go_gapic_srcjar_test"],
+- embed = [":datacatalog_go_gapic"],
+- importpath = "cloud.google.com/go/datacatalog/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-datacatalog-v1beta1-go",
+- deps = [
+- ":datacatalog_go_gapic",
+- ":datacatalog_go_gapic_srcjar-test.srcjar",
+- ":datacatalog_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "datacatalog_py_gapic",
+- srcs = [":datacatalog_proto"],
+- grpc_service_config = "datacatalog_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "datacatalog_py_gapic_test",
+- srcs = [
+- "datacatalog_py_gapic_pytest.py",
+- "datacatalog_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":datacatalog_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "datacatalog-v1beta1-py",
+- deps = [
+- ":datacatalog_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "datacatalog_php_proto",
+- deps = [":datacatalog_proto"],
+-)
+-
+-php_grpc_library(
+- name = "datacatalog_php_grpc",
+- srcs = [":datacatalog_proto"],
+- deps = [":datacatalog_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "datacatalog_php_gapic",
+- srcs = [":datacatalog_proto_with_info"],
+- grpc_service_config = "datacatalog_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":datacatalog_php_grpc",
+- ":datacatalog_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-datacatalog-v1beta1-php",
+- deps = [
+- ":datacatalog_php_gapic",
+- ":datacatalog_php_grpc",
+- ":datacatalog_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "datacatalog_nodejs_gapic",
+- package_name = "@google-cloud/datacatalog",
+- src = ":datacatalog_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "datacatalog_grpc_service_config.json",
+- main_service = "DataCatalog",
+- mixins = "none",
+- package = "google.cloud.datacatalog.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "datacatalog_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "datacatalog-v1beta1-nodejs",
+- deps = [
+- ":datacatalog_nodejs_gapic",
+- ":datacatalog_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "datacatalog_ruby_proto",
+- deps = [":datacatalog_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "datacatalog_ruby_grpc",
+- srcs = [":datacatalog_proto"],
+- deps = [":datacatalog_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "datacatalog_ruby_gapic",
+- srcs = [":datacatalog_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-datacatalog-v1beta1"],
+- rest_numeric_enums = False,
+- deps = [
+- ":datacatalog_ruby_grpc",
+- ":datacatalog_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-datacatalog-v1beta1-ruby",
+- deps = [
+- ":datacatalog_ruby_gapic",
+- ":datacatalog_ruby_grpc",
+- ":datacatalog_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "datacatalog_csharp_proto",
+- deps = [":datacatalog_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "datacatalog_csharp_grpc",
+- srcs = [":datacatalog_proto"],
+- deps = [":datacatalog_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "datacatalog_csharp_gapic",
+- srcs = [":datacatalog_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "datacatalog_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datacatalog_v1beta1.yaml",
+- deps = [
+- ":datacatalog_csharp_grpc",
+- ":datacatalog_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-datacatalog-v1beta1-csharp",
+- deps = [
+- ":datacatalog_csharp_gapic",
+- ":datacatalog_csharp_grpc",
+- ":datacatalog_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/dataform/BUILD.bazel b/google/cloud/dataform/BUILD.bazel
+--- a/google/cloud/dataform/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dataform/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-dataform.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for dataform.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta1 in this case.
+-ruby_cloud_gapic_library(
+- name = "dataform_ruby_wrapper",
+- srcs = ["//google/cloud/dataform/v1beta1:dataform_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-dataform",
+- "ruby-cloud-wrapper-of=v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/dataform",
+- "ruby-cloud-api-id=dataform.googleapis.com",
+- "ruby-cloud-api-shortname=dataform",
+- ],
+- ruby_cloud_description = "Dataform is a service for data analysts to develop, test, version control, and schedule complex SQL workflows for data transformation in BigQuery.",
+- ruby_cloud_title = "Dataform",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dataform-ruby",
+- deps = [
+- ":dataform_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/dataform/v1alpha2/BUILD.bazel b/google/cloud/dataform/v1alpha2/BUILD.bazel
+--- a/google/cloud/dataform/v1alpha2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dataform/v1alpha2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,392 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "dataform_proto",
+- srcs = [
+- "dataform.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/type:interval_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "dataform_proto_with_info",
+- deps = [
+- ":dataform_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "dataform_java_proto",
+- deps = [":dataform_proto"],
+-)
+-
+-java_grpc_library(
+- name = "dataform_java_grpc",
+- srcs = [":dataform_proto"],
+- deps = [":dataform_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "dataform_java_gapic",
+- srcs = [":dataform_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "dataform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataform_v1alpha2.yaml",
+- test_deps = [
+- ":dataform_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":dataform_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "dataform_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.dataform.v1alpha2.DataformClientHttpJsonTest",
+- "com.google.cloud.dataform.v1alpha2.DataformClientTest",
+- ],
+- runtime_deps = [":dataform_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-dataform-v1alpha2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":dataform_java_gapic",
+- ":dataform_java_grpc",
+- ":dataform_java_proto",
+- ":dataform_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "dataform_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/dataform/v1alpha2",
+- protos = [":dataform_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:interval_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "dataform_go_gapic",
+- srcs = [":dataform_proto_with_info"],
+- grpc_service_config = "dataform_grpc_service_config.json",
+- importpath = "cloud.google.com/go/dataform/apiv1alpha2;dataform",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "dataform_v1alpha2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dataform_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "dataform_go_gapic_test",
+- srcs = [":dataform_go_gapic_srcjar_test"],
+- embed = [":dataform_go_gapic"],
+- importpath = "cloud.google.com/go/dataform/apiv1alpha2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-dataform-v1alpha2-go",
+- deps = [
+- ":dataform_go_gapic",
+- ":dataform_go_gapic_srcjar-metadata.srcjar",
+- ":dataform_go_gapic_srcjar-test.srcjar",
+- ":dataform_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "dataform_py_gapic",
+- srcs = [":dataform_proto"],
+- grpc_service_config = "dataform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataform_v1alpha2.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "dataform_py_gapic_test",
+- srcs = [
+- "dataform_py_gapic_pytest.py",
+- "dataform_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":dataform_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "dataform-v1alpha2-py",
+- deps = [
+- ":dataform_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "dataform_php_proto",
+- deps = [":dataform_proto"],
+-)
+-
+-php_grpc_library(
+- name = "dataform_php_grpc",
+- srcs = [":dataform_proto"],
+- deps = [":dataform_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "dataform_php_gapic",
+- srcs = [":dataform_proto_with_info"],
+- grpc_service_config = "dataform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataform_v1alpha2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dataform_php_grpc",
+- ":dataform_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-dataform-v1alpha2-php",
+- deps = [
+- ":dataform_php_gapic",
+- ":dataform_php_grpc",
+- ":dataform_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "dataform_nodejs_gapic",
+- package_name = "@google-cloud/dataform",
+- src = ":dataform_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "dataform_grpc_service_config.json",
+- package = "google.cloud.dataform.v1alpha2",
+- rest_numeric_enums = False,
+- service_yaml = "dataform_v1alpha2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "dataform-v1alpha2-nodejs",
+- deps = [
+- ":dataform_nodejs_gapic",
+- ":dataform_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "dataform_ruby_proto",
+- deps = [":dataform_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "dataform_ruby_grpc",
+- srcs = [":dataform_proto"],
+- deps = [":dataform_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "dataform_ruby_gapic",
+- srcs = [":dataform_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-dataform-v1alpha2"],
+- grpc_service_config = "dataform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataform_v1alpha2.yaml",
+- deps = [
+- ":dataform_ruby_grpc",
+- ":dataform_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dataform-v1alpha2-ruby",
+- deps = [
+- ":dataform_ruby_gapic",
+- ":dataform_ruby_grpc",
+- ":dataform_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "dataform_csharp_proto",
+- deps = [":dataform_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "dataform_csharp_grpc",
+- srcs = [":dataform_proto"],
+- deps = [":dataform_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "dataform_csharp_gapic",
+- srcs = [":dataform_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "dataform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataform_v1alpha2.yaml",
+- deps = [
+- ":dataform_csharp_grpc",
+- ":dataform_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-dataform-v1alpha2-csharp",
+- deps = [
+- ":dataform_csharp_gapic",
+- ":dataform_csharp_grpc",
+- ":dataform_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "dataform_cc_proto",
+- deps = [":dataform_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "dataform_cc_grpc",
+- srcs = [":dataform_proto"],
+- grpc_only = True,
+- deps = [":dataform_cc_proto"],
+-)
+diff -urN a/google/cloud/dataform/v1beta1/BUILD.bazel b/google/cloud/dataform/v1beta1/BUILD.bazel
+--- a/google/cloud/dataform/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dataform/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,386 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "dataform_proto",
+- srcs = [
+- "dataform.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/type:interval_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "dataform_proto_with_info",
+- deps = [
+- ":dataform_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "dataform_java_proto",
+- deps = [":dataform_proto"],
+-)
+-
+-java_grpc_library(
+- name = "dataform_java_grpc",
+- srcs = [":dataform_proto"],
+- deps = [":dataform_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "dataform_java_gapic",
+- srcs = [":dataform_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "dataform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataform_v1beta1.yaml",
+- test_deps = [
+- ":dataform_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":dataform_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "dataform_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.dataform.v1beta1.DataformClientHttpJsonTest",
+- "com.google.cloud.dataform.v1beta1.DataformClientTest",
+- ],
+- runtime_deps = [":dataform_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-dataform-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":dataform_java_gapic",
+- ":dataform_java_grpc",
+- ":dataform_java_proto",
+- ":dataform_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "dataform_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/dataform/v1beta1",
+- protos = [":dataform_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:interval_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "dataform_go_gapic",
+- srcs = [":dataform_proto_with_info"],
+- grpc_service_config = "dataform_grpc_service_config.json",
+- importpath = "cloud.google.com/go/dataform/apiv1beta1;dataform",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "dataform_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dataform_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "dataform_go_gapic_test",
+- srcs = [":dataform_go_gapic_srcjar_test"],
+- embed = [":dataform_go_gapic"],
+- importpath = "cloud.google.com/go/dataform/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-dataform-v1beta1-go",
+- deps = [
+- ":dataform_go_gapic",
+- ":dataform_go_gapic_srcjar-metadata.srcjar",
+- ":dataform_go_gapic_srcjar-test.srcjar",
+- ":dataform_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "dataform_py_gapic",
+- srcs = [":dataform_proto"],
+- grpc_service_config = "dataform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataform_v1beta1.yaml",
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "dataform-v1beta1-py",
+- deps = [
+- ":dataform_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "dataform_php_proto",
+- deps = [":dataform_proto"],
+-)
+-
+-php_grpc_library(
+- name = "dataform_php_grpc",
+- srcs = [":dataform_proto"],
+- deps = [":dataform_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "dataform_php_gapic",
+- srcs = [":dataform_proto_with_info"],
+- grpc_service_config = "dataform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataform_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dataform_php_grpc",
+- ":dataform_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-dataform-v1beta1-php",
+- deps = [
+- ":dataform_php_gapic",
+- ":dataform_php_grpc",
+- ":dataform_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "dataform_nodejs_gapic",
+- package_name = "@google-cloud/dataform",
+- src = ":dataform_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "dataform_grpc_service_config.json",
+- package = "google.cloud.dataform.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "dataform_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "dataform-v1beta1-nodejs",
+- deps = [
+- ":dataform_nodejs_gapic",
+- ":dataform_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "dataform_ruby_proto",
+- deps = [":dataform_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "dataform_ruby_grpc",
+- srcs = [":dataform_proto"],
+- deps = [":dataform_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "dataform_ruby_gapic",
+- srcs = [":dataform_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=dataform.googleapis.com",
+- "ruby-cloud-api-shortname=dataform",
+- "ruby-cloud-gem-name=google-cloud-dataform-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/dataform",
+- ],
+- grpc_service_config = "dataform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Dataform is a service for data analysts to develop, test, version control, and schedule complex SQL workflows for data transformation in BigQuery.",
+- ruby_cloud_title = "Dataform V1beta1",
+- service_yaml = "dataform_v1beta1.yaml",
+- deps = [
+- ":dataform_ruby_grpc",
+- ":dataform_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dataform-v1beta1-ruby",
+- deps = [
+- ":dataform_ruby_gapic",
+- ":dataform_ruby_grpc",
+- ":dataform_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "dataform_csharp_proto",
+- deps = [":dataform_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "dataform_csharp_grpc",
+- srcs = [":dataform_proto"],
+- deps = [":dataform_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "dataform_csharp_gapic",
+- srcs = [":dataform_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "dataform_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataform_v1beta1.yaml",
+- deps = [
+- ":dataform_csharp_grpc",
+- ":dataform_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-dataform-v1beta1-csharp",
+- deps = [
+- ":dataform_csharp_gapic",
+- ":dataform_csharp_grpc",
+- ":dataform_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "dataform_cc_proto",
+- deps = [":dataform_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "dataform_cc_grpc",
+- srcs = [":dataform_proto"],
+- grpc_only = True,
+- deps = [":dataform_cc_proto"],
+-)
+diff -urN a/google/cloud/datafusion/BUILD.bazel b/google/cloud/datafusion/BUILD.bazel
+--- a/google/cloud/datafusion/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/datafusion/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-data_fusion.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for datafusion.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "datafusion_ruby_wrapper",
+- srcs = ["//google/cloud/datafusion/v1:datafusion_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-data_fusion",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/data-fusion",
+- "ruby-cloud-api-id=datafusion.googleapis.com",
+- "ruby-cloud-api-shortname=datafusion",
+- ],
+- ruby_cloud_description = "Cloud Data Fusion is a fully managed, cloud-native, enterprise data integration service for quickly building and managing data pipelines.",
+- ruby_cloud_title = "Cloud Data Fusion",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-datafusion-ruby",
+- deps = [
+- ":datafusion_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/datafusion/v1/BUILD.bazel b/google/cloud/datafusion/v1/BUILD.bazel
+--- a/google/cloud/datafusion/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/datafusion/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,392 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "datafusion_proto",
+- srcs = [
+- "datafusion.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "datafusion_proto_with_info",
+- deps = [
+- ":datafusion_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "datafusion_java_proto",
+- deps = [":datafusion_proto"],
+-)
+-
+-java_grpc_library(
+- name = "datafusion_java_grpc",
+- srcs = [":datafusion_proto"],
+- deps = [":datafusion_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "datafusion_java_gapic",
+- srcs = [":datafusion_proto_with_info"],
+- grpc_service_config = "datafusion_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":datafusion_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":datafusion_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "datafusion_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.datafusion.v1.DataFusionClientHttpJsonTest",
+- "com.google.cloud.datafusion.v1.DataFusionClientTest",
+- ],
+- runtime_deps = [":datafusion_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-datafusion-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":datafusion_java_gapic",
+- ":datafusion_java_grpc",
+- ":datafusion_java_proto",
+- ":datafusion_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "datafusion_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/datafusion/v1",
+- protos = [":datafusion_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "datafusion_go_gapic",
+- srcs = [":datafusion_proto_with_info"],
+- grpc_service_config = "datafusion_grpc_service_config.json",
+- importpath = "cloud.google.com/go/datafusion/apiv1;datafusion",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "datafusion_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datafusion_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "datafusion_go_gapic_test",
+- srcs = [":datafusion_go_gapic_srcjar_test"],
+- embed = [":datafusion_go_gapic"],
+- importpath = "cloud.google.com/go/datafusion/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-datafusion-v1-go",
+- deps = [
+- ":datafusion_go_gapic",
+- ":datafusion_go_gapic_srcjar-metadata.srcjar",
+- ":datafusion_go_gapic_srcjar-test.srcjar",
+- ":datafusion_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "datafusion_py_gapic",
+- srcs = [":datafusion_proto"],
+- grpc_service_config = "datafusion_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-data-fusion",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=data_fusion",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "datafusion_py_gapic_test",
+- srcs = [
+- "datafusion_py_gapic_pytest.py",
+- "datafusion_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":datafusion_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "datafusion-v1-py",
+- deps = [
+- ":datafusion_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "datafusion_php_proto",
+- deps = [":datafusion_proto"],
+-)
+-
+-php_grpc_library(
+- name = "datafusion_php_grpc",
+- srcs = [":datafusion_proto"],
+- deps = [":datafusion_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "datafusion_php_gapic",
+- srcs = [":datafusion_proto_with_info"],
+- grpc_service_config = "datafusion_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datafusion_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datafusion_php_grpc",
+- ":datafusion_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-datafusion-v1-php",
+- deps = [
+- ":datafusion_php_gapic",
+- ":datafusion_php_grpc",
+- ":datafusion_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "datafusion_nodejs_gapic",
+- package_name = "@google-cloud/data-fusion",
+- src = ":datafusion_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "datafusion_grpc_service_config.json",
+- package = "google.cloud.datafusion.v1",
+- rest_numeric_enums = False,
+- service_yaml = "datafusion_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "datafusion-v1-nodejs",
+- deps = [
+- ":datafusion_nodejs_gapic",
+- ":datafusion_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "datafusion_ruby_proto",
+- deps = [":datafusion_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "datafusion_ruby_grpc",
+- srcs = [":datafusion_proto"],
+- deps = [":datafusion_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "datafusion_ruby_gapic",
+- srcs = [":datafusion_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-data_fusion-v1",
+- "ruby-cloud-api-shortname=datafusion",
+- "ruby-cloud-api-id=datafusion.googleapis.com",
+- "ruby-cloud-product-url=https://cloud.google.com/data-fusion",
+- ],
+- grpc_service_config = "datafusion_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Data Fusion is a fully managed, cloud-native, enterprise data integration service for quickly building and managing data pipelines.",
+- ruby_cloud_title = "Cloud Data Fusion V1",
+- deps = [
+- ":datafusion_ruby_grpc",
+- ":datafusion_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-datafusion-v1-ruby",
+- deps = [
+- ":datafusion_ruby_gapic",
+- ":datafusion_ruby_grpc",
+- ":datafusion_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "datafusion_csharp_proto",
+- deps = [":datafusion_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "datafusion_csharp_grpc",
+- srcs = [":datafusion_proto"],
+- deps = [":datafusion_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "datafusion_csharp_gapic",
+- srcs = [":datafusion_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "datafusion_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datafusion_v1.yaml",
+- deps = [
+- ":datafusion_csharp_grpc",
+- ":datafusion_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-datafusion-v1-csharp",
+- deps = [
+- ":datafusion_csharp_gapic",
+- ":datafusion_csharp_grpc",
+- ":datafusion_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "datafusion_cc_proto",
+- deps = [":datafusion_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "datafusion_cc_grpc",
+- srcs = [":datafusion_proto"],
+- grpc_only = True,
+- deps = [":datafusion_cc_proto"],
+-)
+diff -urN a/google/cloud/datafusion/v1beta1/BUILD.bazel b/google/cloud/datafusion/v1beta1/BUILD.bazel
+--- a/google/cloud/datafusion/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/datafusion/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,381 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "datafusion_proto",
+- srcs = [
+- "v1beta1.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "datafusion_proto_with_info",
+- deps = [
+- ":datafusion_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "datafusion_java_proto",
+- deps = [":datafusion_proto"],
+-)
+-
+-java_grpc_library(
+- name = "datafusion_java_grpc",
+- srcs = [":datafusion_proto"],
+- deps = [":datafusion_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "datafusion_java_gapic",
+- srcs = [":datafusion_proto_with_info"],
+- grpc_service_config = "datafusion_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":datafusion_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":datafusion_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "datafusion_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.datafusion.v1beta1.DataFusionClientHttpJsonTest",
+- "com.google.cloud.datafusion.v1beta1.DataFusionClientTest",
+- ],
+- runtime_deps = [":datafusion_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-datafusion-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":datafusion_java_gapic",
+- ":datafusion_java_grpc",
+- ":datafusion_java_proto",
+- ":datafusion_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "datafusion_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/datafusion/v1beta1",
+- protos = [":datafusion_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "datafusion_go_gapic",
+- srcs = [":datafusion_proto_with_info"],
+- grpc_service_config = "datafusion_grpc_service_config.json",
+- importpath = "cloud.google.com/go/datafusion/apiv1beta1;datafusion",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "datafusion_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datafusion_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "datafusion_go_gapic_test",
+- srcs = [":datafusion_go_gapic_srcjar_test"],
+- embed = [":datafusion_go_gapic"],
+- importpath = "cloud.google.com/go/datafusion/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-datafusion-v1beta1-go",
+- deps = [
+- ":datafusion_go_gapic",
+- ":datafusion_go_gapic_srcjar-metadata.srcjar",
+- ":datafusion_go_gapic_srcjar-test.srcjar",
+- ":datafusion_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "datafusion_py_gapic",
+- srcs = [":datafusion_proto"],
+- grpc_service_config = "datafusion_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "datafusion_py_gapic_test",
+- srcs = [
+- "datafusion_py_gapic_pytest.py",
+- "datafusion_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":datafusion_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "datafusion-v1beta1-py",
+- deps = [
+- ":datafusion_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "datafusion_php_proto",
+- deps = [":datafusion_proto"],
+-)
+-
+-php_grpc_library(
+- name = "datafusion_php_grpc",
+- srcs = [":datafusion_proto"],
+- deps = [":datafusion_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "datafusion_php_gapic",
+- srcs = [":datafusion_proto_with_info"],
+- grpc_service_config = "datafusion_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datafusion_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datafusion_php_grpc",
+- ":datafusion_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-datafusion-v1beta1-php",
+- deps = [
+- ":datafusion_php_gapic",
+- ":datafusion_php_grpc",
+- ":datafusion_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "datafusion_nodejs_gapic",
+- package_name = "@google-cloud/data-fusion",
+- src = ":datafusion_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "datafusion_grpc_service_config.json",
+- package = "google.cloud.datafusion.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "datafusion_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "datafusion-v1beta1-nodejs",
+- deps = [
+- ":datafusion_nodejs_gapic",
+- ":datafusion_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "datafusion_ruby_proto",
+- deps = [":datafusion_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "datafusion_ruby_grpc",
+- srcs = [":datafusion_proto"],
+- deps = [":datafusion_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "datafusion_ruby_gapic",
+- srcs = [":datafusion_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-data_fusion-v1beta1",
+- "ruby-cloud-api-shortname=datafusion",
+- "ruby-cloud-api-id=datafusion.googleapis.com",
+- "ruby-cloud-product-url=https://cloud.google.com/data-fusion",
+- ],
+- grpc_service_config = "datafusion_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Data Fusion is a fully managed, cloud-native, enterprise data integration service for quickly building and managing data pipelines.",
+- ruby_cloud_title = "Cloud Data Fusion V1beta1",
+- deps = [
+- ":datafusion_ruby_grpc",
+- ":datafusion_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-datafusion-v1beta1-ruby",
+- deps = [
+- ":datafusion_ruby_gapic",
+- ":datafusion_ruby_grpc",
+- ":datafusion_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "datafusion_csharp_proto",
+- deps = [":datafusion_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "datafusion_csharp_grpc",
+- srcs = [":datafusion_proto"],
+- deps = [":datafusion_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "datafusion_csharp_gapic",
+- srcs = [":datafusion_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "datafusion_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datafusion_v1beta1.yaml",
+- deps = [
+- ":datafusion_csharp_grpc",
+- ":datafusion_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-datafusion-v1beta1-csharp",
+- deps = [
+- ":datafusion_csharp_gapic",
+- ":datafusion_csharp_grpc",
+- ":datafusion_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/datalabeling/BUILD.bazel b/google/cloud/datalabeling/BUILD.bazel
+--- a/google/cloud/datalabeling/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/datalabeling/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-data_labeling.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for datalabeling.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta1 in this case.
+-ruby_cloud_gapic_library(
+- name = "datalabeling_ruby_wrapper",
+- srcs = ["//google/cloud/datalabeling/v1beta1:datalabeling_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-data_labeling",
+- "ruby-cloud-env-prefix=DATA_LABELING",
+- "ruby-cloud-wrapper-of=v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/ai-platform/data-labeling/docs",
+- "ruby-cloud-api-id=datalabeling.googleapis.com",
+- "ruby-cloud-api-shortname=datalabeling",
+- ],
+- ruby_cloud_description = "AI Platform Data Labeling Service lets you work with human labelers to generate highly accurate labels for a collection of data that you can use in machine learning models.",
+- ruby_cloud_title = "AI Platform Data Labeling Service",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-datalabeling-ruby",
+- deps = [
+- ":datalabeling_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/datalabeling/v1beta1/BUILD.bazel b/google/cloud/datalabeling/v1beta1/BUILD.bazel
+--- a/google/cloud/datalabeling/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/datalabeling/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,373 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "datalabeling_proto",
+- srcs = [
+- "annotation.proto",
+- "annotation_spec_set.proto",
+- "data_labeling_service.proto",
+- "data_payloads.proto",
+- "dataset.proto",
+- "evaluation.proto",
+- "evaluation_job.proto",
+- "human_annotation_config.proto",
+- "instruction.proto",
+- "operations.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "datalabeling_proto_with_info",
+- deps = [
+- ":datalabeling_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "datalabeling_java_proto",
+- deps = [":datalabeling_proto"],
+-)
+-
+-java_grpc_library(
+- name = "datalabeling_java_grpc",
+- srcs = [":datalabeling_proto"],
+- deps = [":datalabeling_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "datalabeling_java_gapic",
+- srcs = [":datalabeling_proto_with_info"],
+- grpc_service_config = "datalabeling_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":datalabeling_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":datalabeling_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "datalabeling_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.datalabeling.v1beta1.DataLabelingServiceClientTest",
+- ],
+- runtime_deps = [":datalabeling_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-datalabeling-v1beta1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":datalabeling_java_gapic",
+- ":datalabeling_java_grpc",
+- ":datalabeling_java_proto",
+- ":datalabeling_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "datalabeling_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1",
+- protos = [":datalabeling_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "datalabeling_go_gapic",
+- srcs = [":datalabeling_proto_with_info"],
+- grpc_service_config = "datalabeling_grpc_service_config.json",
+- importpath = "cloud.google.com/go/datalabeling/apiv1beta1;datalabeling",
+- rest_numeric_enums = False,
+- service_yaml = "datalabeling_v1beta1.yaml",
+- deps = [
+- ":datalabeling_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "datalabeling_go_gapic_test",
+- srcs = [":datalabeling_go_gapic_srcjar_test"],
+- embed = [":datalabeling_go_gapic"],
+- importpath = "cloud.google.com/go/datalabeling/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-datalabeling-v1beta1-go",
+- deps = [
+- ":datalabeling_go_gapic",
+- ":datalabeling_go_gapic_srcjar-test.srcjar",
+- ":datalabeling_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "datalabeling_py_gapic",
+- srcs = [":datalabeling_proto"],
+- grpc_service_config = "datalabeling_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "datalabeling_py_gapic_test",
+- srcs = [
+- "datalabeling_py_gapic_pytest.py",
+- "datalabeling_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":datalabeling_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "datalabeling-v1beta1-py",
+- deps = [
+- ":datalabeling_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "datalabeling_php_proto",
+- deps = [":datalabeling_proto"],
+-)
+-
+-php_grpc_library(
+- name = "datalabeling_php_grpc",
+- srcs = [":datalabeling_proto"],
+- deps = [":datalabeling_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "datalabeling_php_gapic",
+- srcs = [":datalabeling_proto_with_info"],
+- grpc_service_config = "datalabeling_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datalabeling_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datalabeling_php_grpc",
+- ":datalabeling_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-datalabeling-v1beta1-php",
+- deps = [
+- ":datalabeling_php_gapic",
+- ":datalabeling_php_grpc",
+- ":datalabeling_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "datalabeling_nodejs_gapic",
+- package_name = "@google-cloud/datalabeling",
+- src = ":datalabeling_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "datalabeling_grpc_service_config.json",
+- main_service = "datalabeling",
+- package = "google.cloud.datalabeling.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "datalabeling_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "datalabeling-v1beta1-nodejs",
+- deps = [
+- ":datalabeling_nodejs_gapic",
+- ":datalabeling_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "datalabeling_ruby_proto",
+- deps = [":datalabeling_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "datalabeling_ruby_grpc",
+- srcs = [":datalabeling_proto"],
+- deps = [":datalabeling_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "datalabeling_ruby_gapic",
+- srcs = [":datalabeling_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-data_labeling-v1beta1",
+- "ruby-cloud-env-prefix=DATA_LABELING",
+- "ruby-cloud-product-url=https://cloud.google.com/ai-platform/data-labeling/docs",
+- "ruby-cloud-api-id=datalabeling.googleapis.com",
+- "ruby-cloud-api-shortname=datalabeling",
+- ],
+- grpc_service_config = "datalabeling_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "AI Platform Data Labeling Service lets you work with human labelers to generate highly accurate labels for a collection of data that you can use in machine learning models.",
+- ruby_cloud_title = "AI Platform Data Labeling Service V1beta1",
+- deps = [
+- ":datalabeling_ruby_grpc",
+- ":datalabeling_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-datalabeling-v1beta1-ruby",
+- deps = [
+- ":datalabeling_ruby_gapic",
+- ":datalabeling_ruby_grpc",
+- ":datalabeling_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "datalabeling_csharp_proto",
+- deps = [":datalabeling_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "datalabeling_csharp_grpc",
+- srcs = [":datalabeling_proto"],
+- deps = [":datalabeling_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "datalabeling_csharp_gapic",
+- srcs = [":datalabeling_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "datalabeling_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datalabeling_v1beta1.yaml",
+- deps = [
+- ":datalabeling_csharp_grpc",
+- ":datalabeling_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-datalabeling-v1beta1-csharp",
+- deps = [
+- ":datalabeling_csharp_gapic",
+- ":datalabeling_csharp_grpc",
+- ":datalabeling_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/dataplex/BUILD.bazel b/google/cloud/dataplex/BUILD.bazel
+--- a/google/cloud/dataplex/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dataplex/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-dataplex.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for dataplex.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "dataplex_ruby_wrapper",
+- srcs = ["//google/cloud/dataplex/v1:dataplex_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-dataplex",
+- "ruby-cloud-wrapper-of=v1:0.2",
+- "ruby-cloud-product-url=https://cloud.google.com/dataplex/",
+- "ruby-cloud-api-id=dataplex.googleapis.com",
+- "ruby-cloud-api-shortname=dataplex",
+- ],
+- ruby_cloud_description = "Dataplex is an intelligent data fabric that provides a way to centrally manage, monitor, and govern your data across data lakes, data warehouses and data marts, and make this data securely accessible to a variety of analytics and data science tools.",
+- ruby_cloud_title = "Dataplex",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dataplex-ruby",
+- deps = [
+- ":dataplex_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/dataplex/v1/BUILD.bazel b/google/cloud/dataplex/v1/BUILD.bazel
+--- a/google/cloud/dataplex/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dataplex/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,421 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "dataplex_proto",
+- srcs = [
+- "analyze.proto",
+- "content.proto",
+- "logs.proto",
+- "metadata.proto",
+- "resources.proto",
+- "service.proto",
+- "tasks.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "dataplex_proto_with_info",
+- deps = [
+- ":dataplex_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "dataplex_java_proto",
+- deps = [":dataplex_proto"],
+-)
+-
+-java_grpc_library(
+- name = "dataplex_java_grpc",
+- srcs = [":dataplex_proto"],
+- deps = [":dataplex_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "dataplex_java_gapic",
+- srcs = [":dataplex_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "dataplex_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataplex_v1.yaml",
+- test_deps = [
+- ":dataplex_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":dataplex_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "dataplex_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.dataplex.v1.ContentServiceClientHttpJsonTest",
+- "com.google.cloud.dataplex.v1.ContentServiceClientTest",
+- "com.google.cloud.dataplex.v1.DataplexServiceClientHttpJsonTest",
+- "com.google.cloud.dataplex.v1.DataplexServiceClientTest",
+- "com.google.cloud.dataplex.v1.MetadataServiceClientHttpJsonTest",
+- "com.google.cloud.dataplex.v1.MetadataServiceClientTest",
+- ],
+- runtime_deps = [":dataplex_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-dataplex-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":dataplex_java_gapic",
+- ":dataplex_java_grpc",
+- ":dataplex_java_proto",
+- ":dataplex_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "dataplex_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/dataplex/v1",
+- protos = [":dataplex_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "dataplex_go_gapic",
+- srcs = [":dataplex_proto_with_info"],
+- grpc_service_config = "dataplex_grpc_service_config.json",
+- importpath = "cloud.google.com/go/dataplex/apiv1;dataplex",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "dataplex_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dataplex_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "dataplex_go_gapic_test",
+- srcs = [":dataplex_go_gapic_srcjar_test"],
+- embed = [":dataplex_go_gapic"],
+- importpath = "cloud.google.com/go/dataplex/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-dataplex-v1-go",
+- deps = [
+- ":dataplex_go_gapic",
+- ":dataplex_go_gapic_srcjar-metadata.srcjar",
+- ":dataplex_go_gapic_srcjar-test.srcjar",
+- ":dataplex_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "dataplex_py_gapic",
+- srcs = [":dataplex_proto"],
+- grpc_service_config = "dataplex_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataplex_v1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "dataplex_py_gapic_test",
+- srcs = [
+- "dataplex_py_gapic_pytest.py",
+- "dataplex_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":dataplex_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "dataplex-v1-py",
+- deps = [
+- ":dataplex_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "dataplex_php_proto",
+- deps = [":dataplex_proto"],
+-)
+-
+-php_grpc_library(
+- name = "dataplex_php_grpc",
+- srcs = [":dataplex_proto"],
+- deps = [":dataplex_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "dataplex_php_gapic",
+- srcs = [":dataplex_proto_with_info"],
+- grpc_service_config = "dataplex_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataplex_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dataplex_php_grpc",
+- ":dataplex_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-dataplex-v1-php",
+- deps = [
+- ":dataplex_php_gapic",
+- ":dataplex_php_grpc",
+- ":dataplex_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "dataplex_nodejs_gapic",
+- package_name = "@google-cloud/dataplex",
+- src = ":dataplex_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "dataplex_grpc_service_config.json",
+- # Content service defines IAM RPCs, force override mixins to remove IAM
+- mixins = "google.cloud.location.Locations;google.longrunning.Operations",
+- package = "google.cloud.dataplex.v1",
+- rest_numeric_enums = False,
+- service_yaml = "dataplex_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "dataplex-v1-nodejs",
+- deps = [
+- ":dataplex_nodejs_gapic",
+- ":dataplex_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "dataplex_ruby_proto",
+- deps = [":dataplex_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "dataplex_ruby_grpc",
+- srcs = [":dataplex_proto"],
+- deps = [":dataplex_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "dataplex_ruby_gapic",
+- srcs = [":dataplex_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=dataplex.googleapis.com",
+- "ruby-cloud-api-shortname=dataplex",
+- "ruby-cloud-gem-name=google-cloud-dataplex-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/dataplex/",
+- ],
+- grpc_service_config = "dataplex_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Dataplex is an intelligent data fabric that provides a way to centrally manage, monitor, and govern your data across data lakes, data warehouses and data marts, and make this data securely accessible to a variety of analytics and data science tools.",
+- ruby_cloud_title = "Dataplex V1",
+- service_yaml = "dataplex_v1.yaml",
+- deps = [
+- ":dataplex_ruby_grpc",
+- ":dataplex_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dataplex-v1-ruby",
+- deps = [
+- ":dataplex_ruby_gapic",
+- ":dataplex_ruby_grpc",
+- ":dataplex_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "dataplex_csharp_proto",
+- deps = [":dataplex_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "dataplex_csharp_grpc",
+- srcs = [":dataplex_proto"],
+- deps = [":dataplex_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "dataplex_csharp_gapic",
+- srcs = [":dataplex_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "dataplex_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataplex_v1.yaml",
+- deps = [
+- ":dataplex_csharp_grpc",
+- ":dataplex_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-dataplex-v1-csharp",
+- deps = [
+- ":dataplex_csharp_gapic",
+- ":dataplex_csharp_grpc",
+- ":dataplex_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "dataplex_cc_proto",
+- deps = [":dataplex_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "dataplex_cc_grpc",
+- srcs = [":dataplex_proto"],
+- grpc_only = True,
+- deps = [":dataplex_cc_proto"],
+-)
+diff -urN a/google/cloud/dataproc/BUILD.bazel b/google/cloud/dataproc/BUILD.bazel
+--- a/google/cloud/dataproc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dataproc/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-dataproc.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for dataproc.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "dataproc_ruby_wrapper",
+- srcs = ["//google/cloud/dataproc/v1:dataproc_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-dataproc",
+- "ruby-cloud-env-prefix=DATAPROC",
+- "ruby-cloud-wrapper-of=v1:0.7",
+- "ruby-cloud-product-url=https://cloud.google.com/dataproc",
+- "ruby-cloud-api-id=dataproc.googleapis.com",
+- "ruby-cloud-api-shortname=dataproc",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "Manages Hadoop-based clusters and jobs on Google Cloud Platform.",
+- ruby_cloud_title = "Cloud Dataproc",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dataproc-ruby",
+- deps = [
+- ":dataproc_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/dataproc/logging/BUILD.bazel b/google/cloud/dataproc/logging/BUILD.bazel
+--- a/google/cloud/dataproc/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dataproc/logging/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,176 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "autoscaler_log.proto",
+- ],
+- deps = [
+- "@com_google_protobuf//:duration_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/dataproc/logging",
+- protos = [":logging_proto"],
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "@com_google_protobuf//:duration_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/dataproc/v1/BUILD.bazel b/google/cloud/dataproc/v1/BUILD.bazel
+--- a/google/cloud/dataproc/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dataproc/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,395 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "dataproc_proto",
+- srcs = [
+- "autoscaling_policies.proto",
+- "batches.proto",
+- "clusters.proto",
+- "jobs.proto",
+- "operations.proto",
+- "shared.proto",
+- "workflow_templates.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "dataproc_proto_with_info",
+- deps = [
+- ":dataproc_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "dataproc_java_proto",
+- deps = [":dataproc_proto"],
+-)
+-
+-java_grpc_library(
+- name = "dataproc_java_grpc",
+- srcs = [":dataproc_proto"],
+- deps = [":dataproc_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "dataproc_java_gapic",
+- srcs = [":dataproc_proto_with_info"],
+- gapic_yaml = "dataproc_gapic.yaml",
+- grpc_service_config = "dataproc_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":dataproc_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":dataproc_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "dataproc_java_gapic_test_suite",
+- test_classes = [
+- # Add AutoscalingPolicyService to gapic yaml
+- "com.google.cloud.dataproc.v1.AutoscalingPolicyServiceClientHttpJsonTest",
+- "com.google.cloud.dataproc.v1.AutoscalingPolicyServiceClientTest",
+- "com.google.cloud.dataproc.v1.ClusterControllerClientHttpJsonTest",
+- "com.google.cloud.dataproc.v1.ClusterControllerClientTest",
+- "com.google.cloud.dataproc.v1.JobControllerClientHttpJsonTest",
+- "com.google.cloud.dataproc.v1.JobControllerClientTest",
+- "com.google.cloud.dataproc.v1.WorkflowTemplateServiceClientHttpJsonTest",
+- "com.google.cloud.dataproc.v1.WorkflowTemplateServiceClientTest",
+- ],
+- runtime_deps = [":dataproc_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-dataproc-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":dataproc_java_gapic",
+- ":dataproc_java_grpc",
+- ":dataproc_java_proto",
+- ":dataproc_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "dataproc_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/dataproc/v1",
+- protos = [":dataproc_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "dataproc_go_gapic",
+- srcs = [":dataproc_proto_with_info"],
+- grpc_service_config = "dataproc_grpc_service_config.json",
+- importpath = "cloud.google.com/go/dataproc/apiv1;dataproc",
+- rest_numeric_enums = False,
+- service_yaml = "dataproc_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dataproc_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "dataproc_go_gapic_test",
+- srcs = [":dataproc_go_gapic_srcjar_test"],
+- embed = [":dataproc_go_gapic"],
+- importpath = "cloud.google.com/go/dataproc/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-dataproc-v1-go",
+- deps = [
+- ":dataproc_go_gapic",
+- ":dataproc_go_gapic_srcjar-test.srcjar",
+- ":dataproc_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "dataproc_py_gapic",
+- srcs = [":dataproc_proto"],
+- grpc_service_config = "dataproc_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "dataproc_py_gapic_test",
+- srcs = [
+- "dataproc_py_gapic_pytest.py",
+- "dataproc_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":dataproc_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "dataproc-v1-py",
+- deps = [
+- ":dataproc_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "dataproc_php_proto",
+- deps = [":dataproc_proto"],
+-)
+-
+-php_grpc_library(
+- name = "dataproc_php_grpc",
+- srcs = [":dataproc_proto"],
+- deps = [":dataproc_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "dataproc_php_gapic",
+- srcs = [":dataproc_proto_with_info"],
+- gapic_yaml = "dataproc_gapic.yaml",
+- grpc_service_config = "dataproc_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataproc_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dataproc_php_grpc",
+- ":dataproc_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-dataproc-v1-php",
+- deps = [
+- ":dataproc_php_gapic",
+- ":dataproc_php_grpc",
+- ":dataproc_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "dataproc_nodejs_gapic",
+- package_name = "@google-cloud/dataproc",
+- src = ":dataproc_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "dataproc_grpc_service_config.json",
+- main_service = "dataproc",
+- package = "google.cloud.dataproc.v1",
+- rest_numeric_enums = False,
+- service_yaml = "dataproc_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "dataproc-v1-nodejs",
+- deps = [
+- ":dataproc_nodejs_gapic",
+- ":dataproc_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "dataproc_ruby_proto",
+- deps = [":dataproc_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "dataproc_ruby_grpc",
+- srcs = [":dataproc_proto"],
+- deps = [":dataproc_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "dataproc_ruby_gapic",
+- srcs = [":dataproc_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-dataproc-v1",
+- "ruby-cloud-env-prefix=DATAPROC",
+- "ruby-cloud-product-url=https://cloud.google.com/dataproc",
+- "ruby-cloud-api-id=dataproc.googleapis.com",
+- "ruby-cloud-api-shortname=dataproc",
+- ],
+- grpc_service_config = "dataproc_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Manages Hadoop-based clusters and jobs on Google Cloud Platform.",
+- ruby_cloud_title = "Cloud Dataproc V1",
+- deps = [
+- ":dataproc_ruby_grpc",
+- ":dataproc_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dataproc-v1-ruby",
+- deps = [
+- ":dataproc_ruby_gapic",
+- ":dataproc_ruby_grpc",
+- ":dataproc_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "dataproc_csharp_proto",
+- deps = [":dataproc_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "dataproc_csharp_grpc",
+- srcs = [":dataproc_proto"],
+- deps = [":dataproc_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "dataproc_csharp_gapic",
+- srcs = [":dataproc_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "dataproc_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataproc_v1.yaml",
+- deps = [
+- ":dataproc_csharp_grpc",
+- ":dataproc_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-dataproc-v1-csharp",
+- deps = [
+- ":dataproc_csharp_gapic",
+- ":dataproc_csharp_grpc",
+- ":dataproc_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "dataproc_cc_proto",
+- deps = [":dataproc_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "dataproc_cc_grpc",
+- srcs = [":dataproc_proto"],
+- grpc_only = True,
+- deps = [":dataproc_cc_proto"],
+-)
+diff -urN a/google/cloud/dataqna/BUILD.bazel b/google/cloud/dataqna/BUILD.bazel
+--- a/google/cloud/dataqna/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dataqna/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-dataqna.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for dataqna.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1alpha in this case.
+-ruby_cloud_gapic_library(
+- name = "dataqna_ruby_wrapper",
+- srcs = ["//google/cloud/dataqna/v1alpha:dataqna_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-dataqna",
+- "ruby-cloud-env-prefix=BIGQUERY_DATAQNA",
+- "ruby-cloud-wrapper-of=v1alpha:0.0",
+- "ruby-cloud-path-override=data_qn_a=dataqna",
+- "ruby-cloud-namespace-override=Dataqna=DataQnA",
+- "ruby-cloud-api-id=dataqna.googleapis.com",
+- "ruby-cloud-api-shortname=dataqna",
+- ],
+- ruby_cloud_description = "Data QnA is a natural language question and answer service for BigQuery data.",
+- ruby_cloud_title = "BigQuery Data QnA",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dataqna-ruby",
+- deps = [
+- ":dataqna_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/dataqna/v1alpha/BUILD.bazel b/google/cloud/dataqna/v1alpha/BUILD.bazel
+--- a/google/cloud/dataqna/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dataqna/v1alpha/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,376 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "dataqna_proto",
+- srcs = [
+- "annotated_string.proto",
+- "auto_suggestion_service.proto",
+- "question.proto",
+- "question_service.proto",
+- "user_feedback.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "dataqna_proto_with_info",
+- deps = [
+- ":dataqna_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "dataqna_java_proto",
+- deps = [":dataqna_proto"],
+-)
+-
+-java_grpc_library(
+- name = "dataqna_java_grpc",
+- srcs = [":dataqna_proto"],
+- deps = [":dataqna_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "dataqna_java_gapic",
+- srcs = [":dataqna_proto_with_info"],
+- grpc_service_config = "dataqna_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":dataqna_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":dataqna_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "dataqna_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.dataqna.v1alpha.AutoSuggestionServiceClientHttpJsonTest",
+- "com.google.cloud.dataqna.v1alpha.AutoSuggestionServiceClientTest",
+- "com.google.cloud.dataqna.v1alpha.QuestionServiceClientHttpJsonTest",
+- "com.google.cloud.dataqna.v1alpha.QuestionServiceClientTest",
+- ],
+- runtime_deps = [":dataqna_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-dataqna-v1alpha-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":dataqna_java_gapic",
+- ":dataqna_java_grpc",
+- ":dataqna_java_proto",
+- ":dataqna_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "dataqna_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha",
+- protos = [":dataqna_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "dataqna_go_gapic",
+- srcs = [":dataqna_proto_with_info"],
+- grpc_service_config = "dataqna_grpc_service_config.json",
+- importpath = "cloud.google.com/go/dataqna/apiv1alpha;dataqna",
+- rest_numeric_enums = False,
+- service_yaml = "dataqna_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dataqna_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "dataqna_go_gapic_test",
+- srcs = [":dataqna_go_gapic_srcjar_test"],
+- embed = [":dataqna_go_gapic"],
+- importpath = "cloud.google.com/go/dataqna/apiv1alpha",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-dataqna-v1alpha-go",
+- deps = [
+- ":dataqna_go_gapic",
+- ":dataqna_go_gapic_srcjar-test.srcjar",
+- ":dataqna_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "dataqna_py_gapic",
+- srcs = [":dataqna_proto"],
+- grpc_service_config = "dataqna_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- opt_args = [
+- "warehouse-package-name=google-cloud-data-qna",
+- ],
+-)
+-
+-py_test(
+- name = "dataqna_py_gapic_test",
+- srcs = [
+- "dataqna_py_gapic_pytest.py",
+- "dataqna_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":dataqna_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "dataqna-v1alpha-py",
+- deps = [
+- ":dataqna_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "dataqna_php_proto",
+- deps = [":dataqna_proto"],
+-)
+-
+-php_grpc_library(
+- name = "dataqna_php_grpc",
+- srcs = [":dataqna_proto"],
+- deps = [":dataqna_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "dataqna_php_gapic",
+- srcs = [":dataqna_proto_with_info"],
+- grpc_service_config = "dataqna_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":dataqna_php_grpc",
+- ":dataqna_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-dataqna-v1alpha-php",
+- deps = [
+- ":dataqna_php_gapic",
+- ":dataqna_php_grpc",
+- ":dataqna_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "dataqna_nodejs_gapic",
+- package_name = "@google-cloud/data-qna",
+- src = ":dataqna_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "dataqna_grpc_service_config.json",
+- package = "google.cloud.dataqna.v1alpha",
+- rest_numeric_enums = False,
+- service_yaml = "dataqna_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "dataqna-v1alpha-nodejs",
+- deps = [
+- ":dataqna_nodejs_gapic",
+- ":dataqna_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "dataqna_ruby_proto",
+- deps = [":dataqna_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "dataqna_ruby_grpc",
+- srcs = [":dataqna_proto"],
+- deps = [":dataqna_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "dataqna_ruby_gapic",
+- srcs = [":dataqna_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-dataqna-v1alpha",
+- "ruby-cloud-env-prefix=BIGQUERY_DATAQNA",
+- "ruby-cloud-path-override=data_qn_a=dataqna",
+- "ruby-cloud-namespace-override=Dataqna=DataQnA",
+- "ruby-cloud-api-id=dataqna.googleapis.com",
+- "ruby-cloud-api-shortname=dataqna",
+- ],
+- grpc_service_config = "dataqna_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Data QnA is a natural language question and answer service for BigQuery data.",
+- ruby_cloud_title = "BigQuery Data QnA V1alpha",
+- deps = [
+- ":dataqna_ruby_grpc",
+- ":dataqna_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dataqna-v1alpha-ruby",
+- deps = [
+- ":dataqna_ruby_gapic",
+- ":dataqna_ruby_grpc",
+- ":dataqna_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "dataqna_csharp_proto",
+- deps = [":dataqna_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "dataqna_csharp_grpc",
+- srcs = [":dataqna_proto"],
+- deps = [":dataqna_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "dataqna_csharp_gapic",
+- srcs = [":dataqna_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "dataqna_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataqna_v1alpha.yaml",
+- deps = [
+- ":dataqna_csharp_grpc",
+- ":dataqna_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-dataqna-v1alpha-csharp",
+- deps = [
+- ":dataqna_csharp_gapic",
+- ":dataqna_csharp_grpc",
+- ":dataqna_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/datastream/BUILD.bazel b/google/cloud/datastream/BUILD.bazel
+--- a/google/cloud/datastream/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/datastream/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-datastream.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for datastream.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "datastream_ruby_wrapper",
+- srcs = ["//google/cloud/datastream/v1:datastream_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-datastream",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/datastream/",
+- "ruby-cloud-api-id=datastream.googleapis.com",
+- "ruby-cloud-api-shortname=datastream",
+- ],
+- ruby_cloud_description = "Datastream is a serverless and easy-to-use change data capture (CDC) and replication service. It allows you to synchronize data across heterogeneous databases and applications reliably, and with minimal latency and downtime.",
+- ruby_cloud_title = "Datastream",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-datastream-ruby",
+- deps = [
+- ":datastream_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/datastream/v1/BUILD.bazel b/google/cloud/datastream/v1/BUILD.bazel
+--- a/google/cloud/datastream/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/datastream/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,406 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "datastream_proto",
+- srcs = [
+- "datastream.proto",
+- "datastream_resources.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "datastream_proto_with_info",
+- deps = [
+- ":datastream_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "datastream_java_proto",
+- deps = [":datastream_proto"],
+-)
+-
+-java_grpc_library(
+- name = "datastream_java_grpc",
+- srcs = [":datastream_proto"],
+- deps = [":datastream_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "datastream_java_gapic",
+- srcs = [":datastream_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "datastream_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datastream_v1.yaml",
+- test_deps = [
+- ":datastream_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":datastream_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "datastream_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.datastream.v1.DatastreamClientHttpJsonTest",
+- "com.google.cloud.datastream.v1.DatastreamClientTest",
+- ],
+- runtime_deps = [":datastream_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-datastream-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":datastream_java_gapic",
+- ":datastream_java_grpc",
+- ":datastream_java_proto",
+- ":datastream_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "datastream_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/datastream/v1",
+- protos = [":datastream_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "datastream_go_gapic",
+- srcs = [":datastream_proto_with_info"],
+- grpc_service_config = "datastream_grpc_service_config.json",
+- importpath = "cloud.google.com/go/datastream/apiv1;datastream",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "datastream_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datastream_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "datastream_go_gapic_test",
+- srcs = [":datastream_go_gapic_srcjar_test"],
+- embed = [":datastream_go_gapic"],
+- importpath = "cloud.google.com/go/datastream/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-datastream-v1-go",
+- deps = [
+- ":datastream_go_gapic",
+- ":datastream_go_gapic_srcjar-metadata.srcjar",
+- ":datastream_go_gapic_srcjar-test.srcjar",
+- ":datastream_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "datastream_py_gapic",
+- srcs = [":datastream_proto"],
+- grpc_service_config = "datastream_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datastream_v1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "datastream_py_gapic_test",
+- srcs = [
+- "datastream_py_gapic_pytest.py",
+- "datastream_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":datastream_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "datastream-v1-py",
+- deps = [
+- ":datastream_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "datastream_php_proto",
+- deps = [":datastream_proto"],
+-)
+-
+-php_grpc_library(
+- name = "datastream_php_grpc",
+- srcs = [":datastream_proto"],
+- deps = [":datastream_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "datastream_php_gapic",
+- srcs = [":datastream_proto_with_info"],
+- grpc_service_config = "datastream_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datastream_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datastream_php_grpc",
+- ":datastream_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-datastream-v1-php",
+- deps = [
+- ":datastream_php_gapic",
+- ":datastream_php_grpc",
+- ":datastream_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "datastream_nodejs_gapic",
+- package_name = "@google-cloud/datastream",
+- src = ":datastream_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "datastream_grpc_service_config.json",
+- package = "google.cloud.datastream.v1",
+- rest_numeric_enums = False,
+- service_yaml = "datastream_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "datastream-v1-nodejs",
+- deps = [
+- ":datastream_nodejs_gapic",
+- ":datastream_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "datastream_ruby_proto",
+- deps = [":datastream_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "datastream_ruby_grpc",
+- srcs = [":datastream_proto"],
+- deps = [":datastream_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "datastream_ruby_gapic",
+- srcs = [":datastream_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=datastream.googleapis.com",
+- "ruby-cloud-api-shortname=datastream",
+- "ruby-cloud-gem-name=google-cloud-datastream-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/datastream/",
+- ],
+- grpc_service_config = "datastream_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Datastream is a serverless and easy-to-use change data capture (CDC) and replication service. It allows you to synchronize data across heterogeneous databases and applications reliably, and with minimal latency and downtime.",
+- ruby_cloud_title = "Datastream V1",
+- service_yaml = "datastream_v1.yaml",
+- deps = [
+- ":datastream_ruby_grpc",
+- ":datastream_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-datastream-v1-ruby",
+- deps = [
+- ":datastream_ruby_gapic",
+- ":datastream_ruby_grpc",
+- ":datastream_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "datastream_csharp_proto",
+- deps = [":datastream_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "datastream_csharp_grpc",
+- srcs = [":datastream_proto"],
+- deps = [":datastream_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "datastream_csharp_gapic",
+- srcs = [":datastream_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "datastream_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datastream_v1.yaml",
+- deps = [
+- ":datastream_csharp_grpc",
+- ":datastream_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-datastream-v1-csharp",
+- deps = [
+- ":datastream_csharp_gapic",
+- ":datastream_csharp_grpc",
+- ":datastream_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "datastream_cc_proto",
+- deps = [":datastream_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "datastream_cc_grpc",
+- srcs = [":datastream_proto"],
+- grpc_only = True,
+- deps = [":datastream_cc_proto"],
+-)
+diff -urN a/google/cloud/datastream/v1alpha1/BUILD.bazel b/google/cloud/datastream/v1alpha1/BUILD.bazel
+--- a/google/cloud/datastream/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/datastream/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,374 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "datastream_proto",
+- srcs = [
+- "datastream.proto",
+- "datastream_resources.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "datastream_proto_with_info",
+- deps = [
+- ":datastream_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "datastream_java_proto",
+- deps = [":datastream_proto"],
+-)
+-
+-java_grpc_library(
+- name = "datastream_java_grpc",
+- srcs = [":datastream_proto"],
+- deps = [":datastream_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "datastream_java_gapic",
+- srcs = [":datastream_proto_with_info"],
+- grpc_service_config = "datastream_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":datastream_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":datastream_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "datastream_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.datastream.v1alpha1.DatastreamClientHttpJsonTest",
+- "com.google.cloud.datastream.v1alpha1.DatastreamClientTest",
+- ],
+- runtime_deps = [":datastream_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-datastream-v1alpha1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":datastream_java_gapic",
+- ":datastream_java_grpc",
+- ":datastream_java_proto",
+- ":datastream_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "datastream_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1",
+- protos = [":datastream_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "datastream_go_gapic",
+- srcs = [":datastream_proto_with_info"],
+- grpc_service_config = "datastream_grpc_service_config.json",
+- importpath = "cloud.google.com/go/datastream/apiv1alpha1;datastream",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "datastream_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datastream_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "datastream_go_gapic_test",
+- srcs = [":datastream_go_gapic_srcjar_test"],
+- embed = [":datastream_go_gapic"],
+- importpath = "cloud.google.com/go/datastream/apiv1alpha1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-datastream-v1alpha1-go",
+- deps = [
+- ":datastream_go_gapic",
+- ":datastream_go_gapic_srcjar-metadata.srcjar",
+- ":datastream_go_gapic_srcjar-test.srcjar",
+- ":datastream_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "datastream_py_gapic",
+- srcs = [":datastream_proto"],
+- grpc_service_config = "datastream_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "datastream_py_gapic_test",
+- srcs = [
+- "datastream_py_gapic_pytest.py",
+- "datastream_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":datastream_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "datastream-v1alpha1-py",
+- deps = [
+- ":datastream_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "datastream_php_proto",
+- deps = [":datastream_proto"],
+-)
+-
+-php_grpc_library(
+- name = "datastream_php_grpc",
+- srcs = [":datastream_proto"],
+- deps = [":datastream_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "datastream_php_gapic",
+- srcs = [":datastream_proto_with_info"],
+- grpc_service_config = "datastream_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datastream_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datastream_php_grpc",
+- ":datastream_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-datastream-v1alpha1-php",
+- deps = [
+- ":datastream_php_gapic",
+- ":datastream_php_grpc",
+- ":datastream_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "datastream_nodejs_gapic",
+- package_name = "@google-cloud/datastream",
+- src = ":datastream_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "datastream_grpc_service_config.json",
+- package = "google.cloud.datastream.v1alpha1",
+- rest_numeric_enums = False,
+- service_yaml = "datastream_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "datastream-v1alpha1-nodejs",
+- deps = [
+- ":datastream_nodejs_gapic",
+- ":datastream_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "datastream_ruby_proto",
+- deps = [":datastream_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "datastream_ruby_grpc",
+- srcs = [":datastream_proto"],
+- deps = [":datastream_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "datastream_ruby_gapic",
+- srcs = [":datastream_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-datastream-v1alpha1",
+- "ruby-cloud-product-url=https://cloud.google.com/datastream/",
+- "ruby-cloud-api-id=datastream.googleapis.com",
+- "ruby-cloud-api-shortname=datastream",
+- ],
+- grpc_service_config = "datastream_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Datastream is a serverless and easy-to-use change data capture (CDC) and replication service. It allows you to synchronize data across heterogeneous databases and applications reliably, and with minimal latency and downtime.",
+- ruby_cloud_title = "Datastream V1alpha1",
+- deps = [
+- ":datastream_ruby_grpc",
+- ":datastream_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-datastream-v1alpha1-ruby",
+- deps = [
+- ":datastream_ruby_gapic",
+- ":datastream_ruby_grpc",
+- ":datastream_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "datastream_csharp_proto",
+- deps = [":datastream_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "datastream_csharp_grpc",
+- srcs = [":datastream_proto"],
+- deps = [":datastream_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "datastream_csharp_gapic",
+- srcs = [":datastream_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "datastream_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datastream_v1alpha1.yaml",
+- deps = [
+- ":datastream_csharp_grpc",
+- ":datastream_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-datastream-v1alpha1-csharp",
+- deps = [
+- ":datastream_csharp_gapic",
+- ":datastream_csharp_grpc",
+- ":datastream_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/deploy/BUILD.bazel b/google/cloud/deploy/BUILD.bazel
+--- a/google/cloud/deploy/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/deploy/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-deploy.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for clouddeploy.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "clouddeploy_ruby_wrapper",
+- srcs = ["//google/cloud/deploy/v1:deploy_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-deploy",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/deploy/",
+- "ruby-cloud-api-id=clouddeploy.googleapis.com",
+- "ruby-cloud-api-shortname=clouddeploy",
+- ],
+- ruby_cloud_description = "Google Cloud Deploy is a managed service that automates delivery of your applications to a series of target environments in a defined promotion sequence.",
+- ruby_cloud_title = "Google Cloud Deploy",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-deploy-ruby",
+- deps = [
+- ":clouddeploy_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/deploy/v1/BUILD.bazel b/google/cloud/deploy/v1/BUILD.bazel
+--- a/google/cloud/deploy/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/deploy/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,415 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "deploy_proto",
+- srcs = [
+- "cloud_deploy.proto",
+- "deliverypipeline_notification_payload.proto",
+- "jobrun_notification_payload.proto",
+- "log_enums.proto",
+- "release_notification_payload.proto",
+- "release_render_payload.proto",
+- "rollout_notification_payload.proto",
+- "target_notification_payload.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:date_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "deploy_proto_with_info",
+- deps = [
+- ":deploy_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "deploy_java_proto",
+- deps = [":deploy_proto"],
+-)
+-
+-java_grpc_library(
+- name = "deploy_java_grpc",
+- srcs = [":deploy_proto"],
+- deps = [":deploy_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "deploy_java_gapic",
+- srcs = [":deploy_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "clouddeploy_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "clouddeploy_v1.yaml",
+- test_deps = [
+- ":deploy_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":deploy_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "deploy_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.deploy.v1.CloudDeployClientHttpJsonTest",
+- "com.google.cloud.deploy.v1.CloudDeployClientTest",
+- ],
+- runtime_deps = [":deploy_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-deploy-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":deploy_java_gapic",
+- ":deploy_java_grpc",
+- ":deploy_java_proto",
+- ":deploy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "deploy_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/deploy/v1",
+- protos = [":deploy_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:date_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "deploy_go_gapic",
+- srcs = [":deploy_proto_with_info"],
+- grpc_service_config = "clouddeploy_grpc_service_config.json",
+- importpath = "cloud.google.com/go/deploy/apiv1;deploy",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "clouddeploy_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":deploy_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "deploy_go_gapic_test",
+- srcs = [":deploy_go_gapic_srcjar_test"],
+- embed = [":deploy_go_gapic"],
+- importpath = "cloud.google.com/go/deploy/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-deploy-v1-go",
+- deps = [
+- ":deploy_go_gapic",
+- ":deploy_go_gapic_srcjar-metadata.srcjar",
+- ":deploy_go_gapic_srcjar-test.srcjar",
+- ":deploy_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "deploy_py_gapic",
+- srcs = [":deploy_proto"],
+- grpc_service_config = "clouddeploy_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "clouddeploy_v1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "deploy_py_gapic_test",
+- srcs = [
+- "deploy_py_gapic_pytest.py",
+- "deploy_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":deploy_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "deploy-v1-py",
+- deps = [
+- ":deploy_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "deploy_php_proto",
+- deps = [":deploy_proto"],
+-)
+-
+-php_grpc_library(
+- name = "deploy_php_grpc",
+- srcs = [":deploy_proto"],
+- deps = [":deploy_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "deploy_php_gapic",
+- srcs = [":deploy_proto_with_info"],
+- grpc_service_config = "clouddeploy_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "clouddeploy_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":deploy_php_grpc",
+- ":deploy_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-deploy-v1-php",
+- deps = [
+- ":deploy_php_gapic",
+- ":deploy_php_grpc",
+- ":deploy_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "deploy_nodejs_gapic",
+- package_name = "@google-cloud/deploy",
+- src = ":deploy_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "clouddeploy_grpc_service_config.json",
+- package = "google.cloud.deploy.v1",
+- rest_numeric_enums = False,
+- service_yaml = "clouddeploy_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "deploy-v1-nodejs",
+- deps = [
+- ":deploy_nodejs_gapic",
+- ":deploy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "deploy_ruby_proto",
+- deps = [":deploy_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "deploy_ruby_grpc",
+- srcs = [":deploy_proto"],
+- deps = [":deploy_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "deploy_ruby_gapic",
+- srcs = [":deploy_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=clouddeploy.googleapis.com",
+- "ruby-cloud-api-shortname=clouddeploy",
+- "ruby-cloud-gem-name=google-cloud-deploy-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/deploy/",
+- "ruby-cloud-yard-strict=false",
+- ],
+- grpc_service_config = "clouddeploy_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Google Cloud Deploy is a managed service that automates delivery of your applications to a series of target environments in a defined promotion sequence.",
+- ruby_cloud_title = "Google Cloud Deploy V1",
+- service_yaml = "clouddeploy_v1.yaml",
+- deps = [
+- ":deploy_ruby_grpc",
+- ":deploy_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-deploy-v1-ruby",
+- deps = [
+- ":deploy_ruby_gapic",
+- ":deploy_ruby_grpc",
+- ":deploy_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "deploy_csharp_proto",
+- deps = [":deploy_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "deploy_csharp_grpc",
+- srcs = [":deploy_proto"],
+- deps = [":deploy_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "deploy_csharp_gapic",
+- srcs = [":deploy_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "clouddeploy_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "clouddeploy_v1.yaml",
+- deps = [
+- ":deploy_csharp_grpc",
+- ":deploy_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-deploy-v1-csharp",
+- deps = [
+- ":deploy_csharp_gapic",
+- ":deploy_csharp_grpc",
+- ":deploy_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "deploy_cc_proto",
+- deps = [":deploy_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "deploy_cc_grpc",
+- srcs = [":deploy_proto"],
+- grpc_only = True,
+- deps = [":deploy_cc_proto"],
+-)
+diff -urN a/google/cloud/dialogflow/BUILD.bazel b/google/cloud/dialogflow/BUILD.bazel
+--- a/google/cloud/dialogflow/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dialogflow/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-dialogflow.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for dialogflow.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v2 in this case.
+-ruby_cloud_gapic_library(
+- name = "dialogflow_ruby_wrapper",
+- srcs = ["//google/cloud/dialogflow/v2:dialogflow_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-dialogflow",
+- "ruby-cloud-env-prefix=DIALOGFLOW",
+- "ruby-cloud-wrapper-of=v2:0.15",
+- "ruby-cloud-product-url=https://cloud.google.com/dialogflow",
+- "ruby-cloud-api-id=dialogflow.googleapis.com",
+- "ruby-cloud-api-shortname=dialogflow",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "Dialogflow is an end-to-end, build-once deploy-everywhere development suite for creating conversational interfaces for websites, mobile applications, popular messaging platforms, and IoT devices. You can use it to build interfaces (such as chatbots and conversational IVR) that enable natural and rich interactions between your users and your business. This client is for Dialogflow ES, providing the standard agent type suitable for small and simple agents.",
+- ruby_cloud_title = "Dialogflow",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dialogflow-ruby",
+- deps = [
+- ":dialogflow_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/dialogflow/cx/BUILD.bazel b/google/cloud/dialogflow/cx/BUILD.bazel
+--- a/google/cloud/dialogflow/cx/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dialogflow/cx/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-dialogflow-cx.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for dialogflow.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v3 in this case.
+-ruby_cloud_gapic_library(
+- name = "dialogflow_ruby_wrapper",
+- srcs = ["//google/cloud/dialogflow/cx/v3:cx_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-dialogflow-cx",
+- "ruby-cloud-env-prefix=DIALOGFLOW",
+- "ruby-cloud-wrapper-of=v3:0.3",
+- "ruby-cloud-product-url=https://cloud.google.com/dialogflow",
+- "ruby-cloud-api-id=dialogflow.googleapis.com",
+- "ruby-cloud-api-shortname=dialogflow",
+- "ruby-cloud-namespace-override=Cx=CX",
+- ],
+- ruby_cloud_description = "Dialogflow is an end-to-end, build-once deploy-everywhere development suite for creating conversational interfaces for websites, mobile applications, popular messaging platforms, and IoT devices. You can use it to build interfaces (such as chatbots and conversational IVR) that enable natural and rich interactions between your users and your business. This client is for Dialogflow CX, providing an advanced agent type suitable for large or very complex agents.",
+- ruby_cloud_title = "Dialogflow CX",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dialogflow-cx-ruby",
+- deps = [
+- ":dialogflow_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/dialogflow/cx/v3/BUILD.bazel b/google/cloud/dialogflow/cx/v3/BUILD.bazel
+--- a/google/cloud/dialogflow/cx/v3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dialogflow/cx/v3/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,466 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "cx_proto",
+- srcs = [
+- "advanced_settings.proto",
+- "agent.proto",
+- "audio_config.proto",
+- "changelog.proto",
+- "deployment.proto",
+- "entity_type.proto",
+- "environment.proto",
+- "experiment.proto",
+- "flow.proto",
+- "fulfillment.proto",
+- "intent.proto",
+- "page.proto",
+- "response_message.proto",
+- "security_settings.proto",
+- "session.proto",
+- "session_entity_type.proto",
+- "test_case.proto",
+- "transition_route_group.proto",
+- "validation_message.proto",
+- "version.proto",
+- "webhook.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "cx_proto_with_info",
+- deps = [
+- ":cx_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "cx_java_proto",
+- deps = [":cx_proto"],
+-)
+-
+-java_grpc_library(
+- name = "cx_java_grpc",
+- srcs = [":cx_proto"],
+- deps = [":cx_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "cx_java_gapic",
+- srcs = [":cx_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v3.yaml",
+- test_deps = [
+- ":cx_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":cx_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "cx_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.dialogflow.cx.v3.AgentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.AgentsClientTest",
+- "com.google.cloud.dialogflow.cx.v3.ChangelogsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.ChangelogsClientTest",
+- "com.google.cloud.dialogflow.cx.v3.DeploymentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.DeploymentsClientTest",
+- "com.google.cloud.dialogflow.cx.v3.EntityTypesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.EntityTypesClientTest",
+- "com.google.cloud.dialogflow.cx.v3.EnvironmentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.EnvironmentsClientTest",
+- "com.google.cloud.dialogflow.cx.v3.ExperimentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.ExperimentsClientTest",
+- "com.google.cloud.dialogflow.cx.v3.FlowsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.FlowsClientTest",
+- "com.google.cloud.dialogflow.cx.v3.IntentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.IntentsClientTest",
+- "com.google.cloud.dialogflow.cx.v3.PagesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.PagesClientTest",
+- "com.google.cloud.dialogflow.cx.v3.SecuritySettingsServiceClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.SecuritySettingsServiceClientTest",
+- "com.google.cloud.dialogflow.cx.v3.SessionEntityTypesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.SessionEntityTypesClientTest",
+- "com.google.cloud.dialogflow.cx.v3.SessionsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.SessionsClientTest",
+- "com.google.cloud.dialogflow.cx.v3.TestCasesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.TestCasesClientTest",
+- "com.google.cloud.dialogflow.cx.v3.TransitionRouteGroupsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.TransitionRouteGroupsClientTest",
+- "com.google.cloud.dialogflow.cx.v3.VersionsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.VersionsClientTest",
+- "com.google.cloud.dialogflow.cx.v3.WebhooksClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3.WebhooksClientTest",
+- ],
+- runtime_deps = [":cx_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-dialogflow-cx-v3-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":cx_java_gapic",
+- ":cx_java_grpc",
+- ":cx_java_proto",
+- ":cx_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "cx_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3",
+- protos = [":cx_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "cx_go_gapic",
+- srcs = [":cx_proto_with_info"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- importpath = "cloud.google.com/go/dialogflow/cx/apiv3;cx",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v3.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":cx_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "cx_go_gapic_test",
+- srcs = [":cx_go_gapic_srcjar_test"],
+- embed = [":cx_go_gapic"],
+- importpath = "cloud.google.com/go/dialogflow/cx/apiv3",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-dialogflow-cx-v3-go",
+- deps = [
+- ":cx_go_gapic",
+- ":cx_go_gapic_srcjar-metadata.srcjar",
+- ":cx_go_gapic_srcjar-test.srcjar",
+- ":cx_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "cx_py_gapic",
+- srcs = [":cx_proto"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=dialogflowcx",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-dialogflow-cx",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v3.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1376 is fixed
+-# py_test(
+-# name = "cx_py_gapic_test",
+-# srcs = [
+-# "cx_py_gapic_pytest.py",
+-# "cx_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":cx_py_gapic"],
+-# )
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "dialogflow-cx-v3-py",
+- deps = [
+- ":cx_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "cx_php_proto",
+- deps = [":cx_proto"],
+-)
+-
+-php_grpc_library(
+- name = "cx_php_grpc",
+- srcs = [":cx_proto"],
+- deps = [":cx_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "cx_php_gapic",
+- srcs = [":cx_proto_with_info"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v3.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":cx_php_grpc",
+- ":cx_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-dialogflow-cx-v3-php",
+- deps = [
+- ":cx_php_gapic",
+- ":cx_php_grpc",
+- ":cx_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "cx_nodejs_gapic",
+- package_name = "@google-cloud/dialogflow-cx",
+- src = ":cx_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- mixins = "google.longrunning.Operations;google.cloud.location.Locations",
+- package = "google.cloud.dialogflow.cx.v3",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v3.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "dialogflow-cx-v3-nodejs",
+- deps = [
+- ":cx_nodejs_gapic",
+- ":cx_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "cx_ruby_proto",
+- deps = [":cx_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "cx_ruby_grpc",
+- srcs = [":cx_proto"],
+- deps = [":cx_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "cx_ruby_gapic",
+- srcs = [":cx_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=dialogflow.googleapis.com",
+- "ruby-cloud-api-shortname=dialogflow",
+- "ruby-cloud-env-prefix=DIALOGFLOW",
+- "ruby-cloud-gem-name=google-cloud-dialogflow-cx-v3",
+- "ruby-cloud-namespace-override=Cx=CX",
+- "ruby-cloud-product-url=https://cloud.google.com/dialogflow",
+- ],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Dialogflow is an end-to-end, build-once deploy-everywhere development suite for creating conversational interfaces for websites, mobile applications, popular messaging platforms, and IoT devices. You can use it to build interfaces (such as chatbots and conversational IVR) that enable natural and rich interactions between your users and your business. This client is for Dialogflow CX, providing an advanced agent type suitable for large or very complex agents.",
+- ruby_cloud_title = "Dialogflow CX V3",
+- service_yaml = "dialogflow_v3.yaml",
+- deps = [
+- ":cx_ruby_grpc",
+- ":cx_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dialogflow-cx-v3-ruby",
+- deps = [
+- ":cx_ruby_gapic",
+- ":cx_ruby_grpc",
+- ":cx_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "cx_csharp_proto",
+- deps = [":cx_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "cx_csharp_grpc",
+- srcs = [":cx_proto"],
+- deps = [":cx_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "cx_csharp_gapic",
+- srcs = [":cx_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v3.yaml",
+- deps = [
+- ":cx_csharp_grpc",
+- ":cx_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-dialogflow-cx-v3-csharp",
+- deps = [
+- ":cx_csharp_gapic",
+- ":cx_csharp_grpc",
+- ":cx_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "cx_cc_proto",
+- deps = [":cx_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "cx_cc_grpc",
+- srcs = [":cx_proto"],
+- grpc_only = True,
+- deps = [":cx_cc_proto"],
+-)
+diff -urN a/google/cloud/dialogflow/cx/v3beta1/BUILD.bazel b/google/cloud/dialogflow/cx/v3beta1/BUILD.bazel
+--- a/google/cloud/dialogflow/cx/v3beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dialogflow/cx/v3beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,465 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "cx_proto",
+- srcs = [
+- "advanced_settings.proto",
+- "agent.proto",
+- "audio_config.proto",
+- "changelog.proto",
+- "deployment.proto",
+- "entity_type.proto",
+- "environment.proto",
+- "experiment.proto",
+- "flow.proto",
+- "fulfillment.proto",
+- "intent.proto",
+- "page.proto",
+- "response_message.proto",
+- "security_settings.proto",
+- "session.proto",
+- "session_entity_type.proto",
+- "test_case.proto",
+- "transition_route_group.proto",
+- "validation_message.proto",
+- "version.proto",
+- "webhook.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "cx_proto_with_info",
+- deps = [
+- ":cx_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "cx_java_proto",
+- deps = [":cx_proto"],
+-)
+-
+-java_grpc_library(
+- name = "cx_java_grpc",
+- srcs = [":cx_proto"],
+- deps = [":cx_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "cx_java_gapic",
+- srcs = [":cx_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v3beta1.yaml",
+- test_deps = [
+- ":cx_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":cx_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "cx_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.dialogflow.cx.v3beta1.AgentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.AgentsClientTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.ChangelogsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.ChangelogsClientTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.DeploymentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.DeploymentsClientTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.EntityTypesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.EntityTypesClientTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.EnvironmentsClientTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.ExperimentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.ExperimentsClientTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.FlowsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.FlowsClientTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.IntentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.IntentsClientTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.PagesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.PagesClientTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.SecuritySettingsServiceClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.SecuritySettingsServiceClientTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.SessionEntityTypesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.SessionEntityTypesClientTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.SessionsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.SessionsClientTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.TestCasesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.TestCasesClientTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroupsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.TransitionRouteGroupsClientTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.VersionsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.VersionsClientTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.WebhooksClientHttpJsonTest",
+- "com.google.cloud.dialogflow.cx.v3beta1.WebhooksClientTest",
+- ],
+- runtime_deps = [":cx_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-dialogflow-cx-v3beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":cx_java_gapic",
+- ":cx_java_grpc",
+- ":cx_java_proto",
+- ":cx_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "cx_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1",
+- protos = [":cx_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "cx_go_gapic",
+- srcs = [":cx_proto_with_info"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- importpath = "cloud.google.com/go/dialogflow/cx/apiv3beta1;cx",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v3beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":cx_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "cx_go_gapic_test",
+- srcs = [":cx_go_gapic_srcjar_test"],
+- embed = [":cx_go_gapic"],
+- importpath = "cloud.google.com/go/dialogflow/cx/apiv3beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-dialogflow-cx-v3beta1-go",
+- deps = [
+- ":cx_go_gapic",
+- ":cx_go_gapic_srcjar-metadata.srcjar",
+- ":cx_go_gapic_srcjar-test.srcjar",
+- ":cx_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "cx_py_gapic",
+- srcs = [":cx_proto"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=dialogflowcx",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-dialogflow-cx",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v3beta1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1376 is fixed
+-# py_test(
+-# name = "cx_py_gapic_test",
+-# srcs = [
+-# "cx_py_gapic_pytest.py",
+-# "cx_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":cx_py_gapic"],
+-# )
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "dialogflow-cx-v3beta1-py",
+- deps = [
+- ":cx_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "cx_php_proto",
+- deps = [":cx_proto"],
+-)
+-
+-php_grpc_library(
+- name = "cx_php_grpc",
+- srcs = [":cx_proto"],
+- deps = [":cx_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "cx_php_gapic",
+- srcs = [":cx_proto_with_info"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v3beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":cx_php_grpc",
+- ":cx_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-dialogflow-cx-v3beta1-php",
+- deps = [
+- ":cx_php_gapic",
+- ":cx_php_grpc",
+- ":cx_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "cx_nodejs_gapic",
+- package_name = "@google-cloud/dialogflow-cx",
+- src = ":cx_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- package = "google.cloud.dialogflow.cx.v3beta1",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v3beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "dialogflow-cx-v3beta1-nodejs",
+- deps = [
+- ":cx_nodejs_gapic",
+- ":cx_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "cx_ruby_proto",
+- deps = [":cx_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "cx_ruby_grpc",
+- srcs = [":cx_proto"],
+- deps = [":cx_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "cx_ruby_gapic",
+- srcs = [":cx_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=dialogflow.googleapis.com",
+- "ruby-cloud-api-shortname=dialogflow",
+- "ruby-cloud-env-prefix=DIALOGFLOW",
+- "ruby-cloud-gem-name=google-cloud-dialogflow-cx-v3beta1",
+- "ruby-cloud-namespace-override=Cx=CX",
+- "ruby-cloud-product-url=https://cloud.google.com/dialogflow",
+- ],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Dialogflow is an end-to-end, build-once deploy-everywhere development suite for creating conversational interfaces for websites, mobile applications, popular messaging platforms, and IoT devices. You can use it to build interfaces (such as chatbots and conversational IVR) that enable natural and rich interactions between your users and your business. This client is for Dialogflow CX, providing an advanced agent type suitable for large or very complex agents.",
+- ruby_cloud_title = "Dialogflow CX V3beta1",
+- service_yaml = "dialogflow_v3beta1.yaml",
+- deps = [
+- ":cx_ruby_grpc",
+- ":cx_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dialogflow-cx-v3beta1-ruby",
+- deps = [
+- ":cx_ruby_gapic",
+- ":cx_ruby_grpc",
+- ":cx_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "cx_csharp_proto",
+- deps = [":cx_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "cx_csharp_grpc",
+- srcs = [":cx_proto"],
+- deps = [":cx_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "cx_csharp_gapic",
+- srcs = [":cx_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v3beta1.yaml",
+- deps = [
+- ":cx_csharp_grpc",
+- ":cx_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-dialogflow-cx-v3beta1-csharp",
+- deps = [
+- ":cx_csharp_gapic",
+- ":cx_csharp_grpc",
+- ":cx_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "cx_cc_proto",
+- deps = [":cx_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "cx_cc_grpc",
+- srcs = [":cx_proto"],
+- grpc_only = True,
+- deps = [":cx_cc_proto"],
+-)
+diff -urN a/google/cloud/dialogflow/v2/BUILD.bazel b/google/cloud/dialogflow/v2/BUILD.bazel
+--- a/google/cloud/dialogflow/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dialogflow/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,463 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "dialogflow_proto",
+- srcs = [
+- "agent.proto",
+- "answer_record.proto",
+- "audio_config.proto",
+- "context.proto",
+- "conversation.proto",
+- "conversation_dataset.proto",
+- "conversation_event.proto",
+- "conversation_model.proto",
+- "conversation_profile.proto",
+- "document.proto",
+- "entity_type.proto",
+- "environment.proto",
+- "fulfillment.proto",
+- "gcs.proto",
+- "human_agent_assistant_event.proto",
+- "intent.proto",
+- "knowledge_base.proto",
+- "participant.proto",
+- "session.proto",
+- "session_entity_type.proto",
+- "validation_result.proto",
+- "version.proto",
+- "webhook.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "dialogflow_proto_with_info",
+- deps = [
+- ":dialogflow_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "dialogflow_java_proto",
+- deps = [":dialogflow_proto"],
+-)
+-
+-java_grpc_library(
+- name = "dialogflow_java_grpc",
+- srcs = [":dialogflow_proto"],
+- deps = [":dialogflow_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "dialogflow_java_gapic",
+- srcs = [":dialogflow_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v2.yaml",
+- test_deps = [
+- ":dialogflow_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":dialogflow_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "dialogflow_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.dialogflow.v2.AgentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.AgentsClientTest",
+- "com.google.cloud.dialogflow.v2.AnswerRecordsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.AnswerRecordsClientTest",
+- "com.google.cloud.dialogflow.v2.ContextsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.ContextsClientTest",
+- "com.google.cloud.dialogflow.v2.ConversationDatasetsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.ConversationDatasetsClientTest",
+- "com.google.cloud.dialogflow.v2.ConversationModelsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.ConversationModelsClientTest",
+- "com.google.cloud.dialogflow.v2.ConversationProfilesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.ConversationProfilesClientTest",
+- "com.google.cloud.dialogflow.v2.ConversationsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.ConversationsClientTest",
+- "com.google.cloud.dialogflow.v2.DocumentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.DocumentsClientTest",
+- "com.google.cloud.dialogflow.v2.EntityTypesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.EntityTypesClientTest",
+- "com.google.cloud.dialogflow.v2.EnvironmentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.EnvironmentsClientTest",
+- "com.google.cloud.dialogflow.v2.FulfillmentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.FulfillmentsClientTest",
+- "com.google.cloud.dialogflow.v2.IntentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.IntentsClientTest",
+- "com.google.cloud.dialogflow.v2.KnowledgeBasesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.KnowledgeBasesClientTest",
+- "com.google.cloud.dialogflow.v2.ParticipantsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.ParticipantsClientTest",
+- "com.google.cloud.dialogflow.v2.SessionEntityTypesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.SessionEntityTypesClientTest",
+- "com.google.cloud.dialogflow.v2.SessionsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.SessionsClientTest",
+- "com.google.cloud.dialogflow.v2.VersionsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2.VersionsClientTest",
+- ],
+- runtime_deps = [":dialogflow_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-dialogflow-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":dialogflow_java_gapic",
+- ":dialogflow_java_grpc",
+- ":dialogflow_java_proto",
+- ":dialogflow_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "dialogflow_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2",
+- protos = [":dialogflow_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "dialogflow_go_gapic",
+- srcs = [":dialogflow_proto_with_info"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- importpath = "cloud.google.com/go/dialogflow/apiv2;dialogflow",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dialogflow_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "dialogflow_go_gapic_test",
+- srcs = [":dialogflow_go_gapic_srcjar_test"],
+- embed = [":dialogflow_go_gapic"],
+- importpath = "cloud.google.com/go/dialogflow/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-dialogflow-v2-go",
+- deps = [
+- ":dialogflow_go_gapic",
+- ":dialogflow_go_gapic_srcjar-metadata.srcjar",
+- ":dialogflow_go_gapic_srcjar-test.srcjar",
+- ":dialogflow_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "dialogflow_py_gapic",
+- srcs = [":dialogflow_proto"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v2.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "dialogflow_py_gapic_test",
+- srcs = [
+- "dialogflow_py_gapic_pytest.py",
+- "dialogflow_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":dialogflow_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "dialogflow-v2-py",
+- deps = [
+- ":dialogflow_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "dialogflow_php_proto",
+- deps = [":dialogflow_proto"],
+-)
+-
+-php_grpc_library(
+- name = "dialogflow_php_grpc",
+- srcs = [":dialogflow_proto"],
+- deps = [":dialogflow_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "dialogflow_php_gapic",
+- srcs = [":dialogflow_proto_with_info"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dialogflow_php_grpc",
+- ":dialogflow_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-dialogflow-v2-php",
+- deps = [
+- ":dialogflow_php_gapic",
+- ":dialogflow_php_grpc",
+- ":dialogflow_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "dialogflow_nodejs_gapic",
+- package_name = "@google-cloud/dialogflow",
+- src = ":dialogflow_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- main_service = "dialogflow",
+- package = "google.cloud.dialogflow.v2",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "dialogflow-v2-nodejs",
+- deps = [
+- ":dialogflow_nodejs_gapic",
+- ":dialogflow_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "dialogflow_ruby_proto",
+- deps = [":dialogflow_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "dialogflow_ruby_grpc",
+- srcs = [":dialogflow_proto"],
+- deps = [":dialogflow_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "dialogflow_ruby_gapic",
+- srcs = [":dialogflow_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=dialogflow.googleapis.com",
+- "ruby-cloud-api-shortname=dialogflow",
+- "ruby-cloud-env-prefix=DIALOGFLOW",
+- "ruby-cloud-gem-name=google-cloud-dialogflow-v2",
+- "ruby-cloud-product-url=https://cloud.google.com/dialogflow",
+- ],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Dialogflow is an end-to-end, build-once deploy-everywhere development suite for creating conversational interfaces for websites, mobile applications, popular messaging platforms, and IoT devices. You can use it to build interfaces (such as chatbots and conversational IVR) that enable natural and rich interactions between your users and your business. This client is for Dialogflow ES, providing the standard agent type suitable for small and simple agents.",
+- ruby_cloud_title = "Dialogflow V2",
+- service_yaml = "dialogflow_v2.yaml",
+- deps = [
+- ":dialogflow_ruby_grpc",
+- ":dialogflow_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dialogflow-v2-ruby",
+- deps = [
+- ":dialogflow_ruby_gapic",
+- ":dialogflow_ruby_grpc",
+- ":dialogflow_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "dialogflow_csharp_proto",
+- deps = [":dialogflow_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "dialogflow_csharp_grpc",
+- srcs = [":dialogflow_proto"],
+- deps = [":dialogflow_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "dialogflow_csharp_gapic",
+- srcs = [":dialogflow_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v2.yaml",
+- deps = [
+- ":dialogflow_csharp_grpc",
+- ":dialogflow_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-dialogflow-v2-csharp",
+- deps = [
+- ":dialogflow_csharp_gapic",
+- ":dialogflow_csharp_grpc",
+- ":dialogflow_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "dialogflow_cc_proto",
+- deps = [":dialogflow_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "dialogflow_cc_grpc",
+- srcs = [":dialogflow_proto"],
+- grpc_only = True,
+- deps = [":dialogflow_cc_proto"],
+-)
+diff -urN a/google/cloud/dialogflow/v2beta1/BUILD.bazel b/google/cloud/dialogflow/v2beta1/BUILD.bazel
+--- a/google/cloud/dialogflow/v2beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/dialogflow/v2beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,457 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "dialogflow_proto",
+- srcs = [
+- "agent.proto",
+- "answer_record.proto",
+- "audio_config.proto",
+- "context.proto",
+- "conversation.proto",
+- "conversation_event.proto",
+- "conversation_profile.proto",
+- "document.proto",
+- "entity_type.proto",
+- "environment.proto",
+- "fulfillment.proto",
+- "gcs.proto",
+- "human_agent_assistant_event.proto",
+- "intent.proto",
+- "knowledge_base.proto",
+- "participant.proto",
+- "session.proto",
+- "session_entity_type.proto",
+- "validation_result.proto",
+- "version.proto",
+- "webhook.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "dialogflow_proto_with_info",
+- deps = [
+- ":dialogflow_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "dialogflow_java_proto",
+- deps = [":dialogflow_proto"],
+-)
+-
+-java_grpc_library(
+- name = "dialogflow_java_grpc",
+- srcs = [":dialogflow_proto"],
+- deps = [":dialogflow_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "dialogflow_java_gapic",
+- srcs = [":dialogflow_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v2beta1.yaml",
+- test_deps = [
+- ":dialogflow_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":dialogflow_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "dialogflow_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.dialogflow.v2beta1.AgentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2beta1.AgentsClientTest",
+- "com.google.cloud.dialogflow.v2beta1.AnswerRecordsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2beta1.AnswerRecordsClientTest",
+- "com.google.cloud.dialogflow.v2beta1.ContextsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2beta1.ContextsClientTest",
+- "com.google.cloud.dialogflow.v2beta1.ConversationProfilesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2beta1.ConversationProfilesClientTest",
+- "com.google.cloud.dialogflow.v2beta1.ConversationsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2beta1.ConversationsClientTest",
+- "com.google.cloud.dialogflow.v2beta1.DocumentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2beta1.DocumentsClientTest",
+- "com.google.cloud.dialogflow.v2beta1.EntityTypesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2beta1.EntityTypesClientTest",
+- "com.google.cloud.dialogflow.v2beta1.EnvironmentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2beta1.EnvironmentsClientTest",
+- "com.google.cloud.dialogflow.v2beta1.FulfillmentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2beta1.FulfillmentsClientTest",
+- "com.google.cloud.dialogflow.v2beta1.IntentsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2beta1.IntentsClientTest",
+- "com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2beta1.KnowledgeBasesClientTest",
+- "com.google.cloud.dialogflow.v2beta1.ParticipantsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2beta1.ParticipantsClientTest",
+- "com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2beta1.SessionEntityTypesClientTest",
+- "com.google.cloud.dialogflow.v2beta1.SessionsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2beta1.SessionsClientTest",
+- "com.google.cloud.dialogflow.v2beta1.VersionsClientHttpJsonTest",
+- "com.google.cloud.dialogflow.v2beta1.VersionsClientTest",
+- ],
+- runtime_deps = [":dialogflow_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-dialogflow-v2beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":dialogflow_java_gapic",
+- ":dialogflow_java_grpc",
+- ":dialogflow_java_proto",
+- ":dialogflow_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "dialogflow_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1",
+- protos = [":dialogflow_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "dialogflow_go_gapic",
+- srcs = [":dialogflow_proto_with_info"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- importpath = "cloud.google.com/go/dialogflow/apiv2beta1;dialogflow",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v2beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dialogflow_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "dialogflow_go_gapic_test",
+- srcs = [":dialogflow_go_gapic_srcjar_test"],
+- embed = [":dialogflow_go_gapic"],
+- importpath = "cloud.google.com/go/dialogflow/apiv2beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-dialogflow-v2beta1-go",
+- deps = [
+- ":dialogflow_go_gapic",
+- ":dialogflow_go_gapic_srcjar-metadata.srcjar",
+- ":dialogflow_go_gapic_srcjar-test.srcjar",
+- ":dialogflow_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "dialogflow_py_gapic",
+- srcs = [":dialogflow_proto"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v2beta1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "dialogflow_py_gapic_test",
+- srcs = [
+- "dialogflow_py_gapic_pytest.py",
+- "dialogflow_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":dialogflow_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "dialogflow-v2beta1-py",
+- deps = [
+- ":dialogflow_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "dialogflow_php_proto",
+- deps = [":dialogflow_proto"],
+-)
+-
+-php_grpc_library(
+- name = "dialogflow_php_grpc",
+- srcs = [":dialogflow_proto"],
+- deps = [":dialogflow_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "dialogflow_php_gapic",
+- srcs = [":dialogflow_proto_with_info"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v2beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dialogflow_php_grpc",
+- ":dialogflow_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-dialogflow-v2beta1-php",
+- deps = [
+- ":dialogflow_php_gapic",
+- ":dialogflow_php_grpc",
+- ":dialogflow_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "dialogflow_nodejs_gapic",
+- package_name = "@google-cloud/dialogflow",
+- src = ":dialogflow_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- main_service = "dialogflow",
+- package = "google.cloud.dialogflow.v2beta1",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v2beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "dialogflow-v2beta1-nodejs",
+- deps = [
+- ":dialogflow_nodejs_gapic",
+- ":dialogflow_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "dialogflow_ruby_proto",
+- deps = [":dialogflow_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "dialogflow_ruby_grpc",
+- srcs = [":dialogflow_proto"],
+- deps = [":dialogflow_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "dialogflow_ruby_gapic",
+- srcs = [":dialogflow_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=dialogflow.googleapis.com",
+- "ruby-cloud-api-shortname=dialogflow",
+- "ruby-cloud-env-prefix=DIALOGFLOW",
+- "ruby-cloud-gem-name=google-cloud-dialogflow-v2beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/dialogflow",
+- ],
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Dialogflow is an end-to-end, build-once deploy-everywhere development suite for creating conversational interfaces for websites, mobile applications, popular messaging platforms, and IoT devices. You can use it to build interfaces (such as chatbots and conversational IVR) that enable natural and rich interactions between your users and your business. This client is for Dialogflow ES, providing the standard agent type suitable for small and simple agents.",
+- ruby_cloud_title = "Dialogflow V2beta1",
+- service_yaml = "dialogflow_v2beta1.yaml",
+- deps = [
+- ":dialogflow_ruby_grpc",
+- ":dialogflow_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dialogflow-v2beta1-ruby",
+- deps = [
+- ":dialogflow_ruby_gapic",
+- ":dialogflow_ruby_grpc",
+- ":dialogflow_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "dialogflow_csharp_proto",
+- deps = [":dialogflow_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "dialogflow_csharp_grpc",
+- srcs = [":dialogflow_proto"],
+- deps = [":dialogflow_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "dialogflow_csharp_gapic",
+- srcs = [":dialogflow_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "dialogflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dialogflow_v2beta1.yaml",
+- deps = [
+- ":dialogflow_csharp_grpc",
+- ":dialogflow_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-dialogflow-v2beta1-csharp",
+- deps = [
+- ":dialogflow_csharp_gapic",
+- ":dialogflow_csharp_grpc",
+- ":dialogflow_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "dialogflow_cc_proto",
+- deps = [":dialogflow_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "dialogflow_cc_grpc",
+- srcs = [":dialogflow_proto"],
+- grpc_only = True,
+- deps = [":dialogflow_cc_proto"],
+-)
+diff -urN a/google/cloud/discoveryengine/v1beta/BUILD.bazel b/google/cloud/discoveryengine/v1beta/BUILD.bazel
+--- a/google/cloud/discoveryengine/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/discoveryengine/v1beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,408 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "discoveryengine_proto",
+- srcs = [
+- "common.proto",
+- "document.proto",
+- "document_service.proto",
+- "import_config.proto",
+- "recommendation_service.proto",
+- "user_event.proto",
+- "user_event_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:httpbody_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:date_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "discoveryengine_proto_with_info",
+- deps = [
+- ":discoveryengine_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "discoveryengine_java_proto",
+- deps = [":discoveryengine_proto"],
+-)
+-
+-java_grpc_library(
+- name = "discoveryengine_java_grpc",
+- srcs = [":discoveryengine_proto"],
+- deps = [":discoveryengine_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "discoveryengine_java_gapic",
+- srcs = [":discoveryengine_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "discoveryengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "discoveryengine_v1beta.yaml",
+- test_deps = [
+- ":discoveryengine_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":discoveryengine_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "discoveryengine_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.discoveryengine.v1beta.DocumentServiceClientHttpJsonTest",
+- "com.google.cloud.discoveryengine.v1beta.DocumentServiceClientTest",
+- "com.google.cloud.discoveryengine.v1beta.RecommendationServiceClientHttpJsonTest",
+- "com.google.cloud.discoveryengine.v1beta.RecommendationServiceClientTest",
+- "com.google.cloud.discoveryengine.v1beta.UserEventServiceClientHttpJsonTest",
+- "com.google.cloud.discoveryengine.v1beta.UserEventServiceClientTest",
+- ],
+- runtime_deps = [":discoveryengine_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-discoveryengine-v1beta-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":discoveryengine_java_gapic",
+- ":discoveryengine_java_grpc",
+- ":discoveryengine_java_proto",
+- ":discoveryengine_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "discoveryengine_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/discoveryengine/v1beta",
+- protos = [":discoveryengine_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:date_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "discoveryengine_go_gapic",
+- srcs = [":discoveryengine_proto_with_info"],
+- grpc_service_config = "discoveryengine_grpc_service_config.json",
+- importpath = "cloud.google.com/go/discoveryengine/apiv1beta;discoveryengine",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "discoveryengine_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":discoveryengine_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "discoveryengine_go_gapic_test",
+- srcs = [":discoveryengine_go_gapic_srcjar_test"],
+- embed = [":discoveryengine_go_gapic"],
+- importpath = "cloud.google.com/go/discoveryengine/apiv1beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-discoveryengine-v1beta-go",
+- deps = [
+- ":discoveryengine_go_gapic",
+- ":discoveryengine_go_gapic_srcjar-metadata.srcjar",
+- ":discoveryengine_go_gapic_srcjar-test.srcjar",
+- ":discoveryengine_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "discoveryengine_py_gapic",
+- srcs = [":discoveryengine_proto"],
+- grpc_service_config = "discoveryengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "discoveryengine_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "discoveryengine_py_gapic_test",
+- srcs = [
+- "discoveryengine_py_gapic_pytest.py",
+- "discoveryengine_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":discoveryengine_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "discoveryengine-v1beta-py",
+- deps = [
+- ":discoveryengine_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "discoveryengine_php_proto",
+- deps = [":discoveryengine_proto"],
+-)
+-
+-php_grpc_library(
+- name = "discoveryengine_php_grpc",
+- srcs = [":discoveryengine_proto"],
+- deps = [":discoveryengine_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "discoveryengine_php_gapic",
+- srcs = [":discoveryengine_proto_with_info"],
+- grpc_service_config = "discoveryengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "discoveryengine_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":discoveryengine_php_grpc",
+- ":discoveryengine_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-discoveryengine-v1beta-php",
+- deps = [
+- ":discoveryengine_php_gapic",
+- ":discoveryengine_php_grpc",
+- ":discoveryengine_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "discoveryengine_nodejs_gapic",
+- package_name = "@google-cloud/discoveryengine",
+- src = ":discoveryengine_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "discoveryengine_grpc_service_config.json",
+- package = "google.cloud.discoveryengine.v1beta",
+- rest_numeric_enums = False,
+- service_yaml = "discoveryengine_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "discoveryengine-v1beta-nodejs",
+- deps = [
+- ":discoveryengine_nodejs_gapic",
+- ":discoveryengine_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "discoveryengine_ruby_proto",
+- deps = [":discoveryengine_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "discoveryengine_ruby_grpc",
+- srcs = [":discoveryengine_proto"],
+- deps = [":discoveryengine_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "discoveryengine_ruby_gapic",
+- srcs = [":discoveryengine_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-discoveryengine-v1beta"],
+- grpc_service_config = "discoveryengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "discoveryengine_v1beta.yaml",
+- deps = [
+- ":discoveryengine_ruby_grpc",
+- ":discoveryengine_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-discoveryengine-v1beta-ruby",
+- deps = [
+- ":discoveryengine_ruby_gapic",
+- ":discoveryengine_ruby_grpc",
+- ":discoveryengine_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "discoveryengine_csharp_proto",
+- deps = [":discoveryengine_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "discoveryengine_csharp_grpc",
+- srcs = [":discoveryengine_proto"],
+- deps = [":discoveryengine_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "discoveryengine_csharp_gapic",
+- srcs = [":discoveryengine_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "discoveryengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "discoveryengine_v1beta.yaml",
+- deps = [
+- ":discoveryengine_csharp_grpc",
+- ":discoveryengine_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-discoveryengine-v1beta-csharp",
+- deps = [
+- ":discoveryengine_csharp_gapic",
+- ":discoveryengine_csharp_grpc",
+- ":discoveryengine_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "discoveryengine_cc_proto",
+- deps = [":discoveryengine_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "discoveryengine_cc_grpc",
+- srcs = [":discoveryengine_proto"],
+- grpc_only = True,
+- deps = [":discoveryengine_cc_proto"],
+-)
+diff -urN a/google/cloud/documentai/BUILD.bazel b/google/cloud/documentai/BUILD.bazel
+--- a/google/cloud/documentai/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/documentai/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-document_ai.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for documentai.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta3 in this case.
+-ruby_cloud_gapic_library(
+- name = "documentai_ruby_wrapper",
+- srcs = ["//google/cloud/documentai/v1beta3:documentai_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-document_ai",
+- "ruby-cloud-env-prefix=DOCUMENT_AI",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta3:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/document-ai/",
+- "ruby-cloud-api-id=us-documentai.googleapis.com",
+- "ruby-cloud-api-shortname=documentai",
+- "ruby-cloud-namespace-override=DocumentAi=DocumentAI",
+- ],
+- ruby_cloud_description = "Document AI uses machine learning on a single cloud-based platform to automatically classify, extract, and enrich data within your documents to unlock insights.",
+- ruby_cloud_title = "Document AI",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-documentai-ruby",
+- deps = [
+- ":documentai_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/documentai/v1/BUILD.bazel b/google/cloud/documentai/v1/BUILD.bazel
+--- a/google/cloud/documentai/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/documentai/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,429 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "documentai_proto",
+- srcs = [
+- "barcode.proto",
+- "document.proto",
+- "document_io.proto",
+- "document_processor_service.proto",
+- "document_schema.proto",
+- "geometry.proto",
+- "operation_metadata.proto",
+- "processor.proto",
+- "processor_type.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:launch_stage_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:color_proto",
+- "//google/type:date_proto",
+- "//google/type:datetime_proto",
+- "//google/type:money_proto",
+- "//google/type:postal_address_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "documentai_proto_with_info",
+- deps = [
+- ":documentai_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "documentai_java_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-java_grpc_library(
+- name = "documentai_java_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "documentai_java_gapic",
+- srcs = [":documentai_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "documentai_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "documentai_v1.yaml",
+- test_deps = [
+- ":documentai_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":documentai_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "documentai_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.documentai.v1.DocumentProcessorServiceClientHttpJsonTest",
+- "com.google.cloud.documentai.v1.DocumentProcessorServiceClientTest",
+- ],
+- runtime_deps = [":documentai_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-documentai-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":documentai_java_gapic",
+- ":documentai_java_grpc",
+- ":documentai_java_proto",
+- ":documentai_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "documentai_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/documentai/v1",
+- protos = [":documentai_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:api_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:color_go_proto",
+- "//google/type:date_go_proto",
+- "//google/type:datetime_go_proto",
+- "//google/type:money_go_proto",
+- "//google/type:postaladdress_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "documentai_go_gapic",
+- srcs = [":documentai_proto_with_info"],
+- grpc_service_config = "documentai_v1_grpc_service_config.json",
+- importpath = "cloud.google.com/go/documentai/apiv1;documentai",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "documentai_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":documentai_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "documentai_go_gapic_test",
+- srcs = [":documentai_go_gapic_srcjar_test"],
+- embed = [":documentai_go_gapic"],
+- importpath = "cloud.google.com/go/documentai/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-documentai-v1-go",
+- deps = [
+- ":documentai_go_gapic",
+- ":documentai_go_gapic_srcjar-metadata.srcjar",
+- ":documentai_go_gapic_srcjar-test.srcjar",
+- ":documentai_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_proto_library",
+- "py_test",
+-)
+-
+-py_proto_library(
+- name = "documentai_py_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-py_gapic_library(
+- name = "documentai_py_gapic",
+- srcs = [":documentai_proto"],
+- grpc_service_config = "documentai_v1_grpc_service_config.json",
+- opt_args = ["autogen-snippets"],
+- rest_numeric_enums = False,
+- service_yaml = "documentai_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "documentai_py_gapic_test",
+- srcs = [
+- "documentai_py_gapic_pytest.py",
+- "documentai_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":documentai_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "documentai-v1-py",
+- deps = [
+- ":documentai_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "documentai_php_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-php_grpc_library(
+- name = "documentai_php_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "documentai_php_gapic",
+- srcs = [":documentai_proto_with_info"],
+- grpc_service_config = "documentai_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "documentai_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":documentai_php_grpc",
+- ":documentai_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-documentai-v1-php",
+- deps = [
+- ":documentai_php_gapic",
+- ":documentai_php_grpc",
+- ":documentai_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "documentai_nodejs_gapic",
+- package_name = "@google-cloud/documentai",
+- src = ":documentai_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "documentai_v1_grpc_service_config.json",
+- package = "google.cloud.documentai.v1",
+- rest_numeric_enums = False,
+- service_yaml = "documentai_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "documentai-v1-nodejs",
+- deps = [
+- ":documentai_nodejs_gapic",
+- ":documentai_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "documentai_ruby_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "documentai_ruby_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "documentai_ruby_gapic",
+- srcs = [":documentai_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=us-documentai.googleapis.com",
+- "ruby-cloud-api-shortname=documentai",
+- "ruby-cloud-env-prefix=DOCUMENT_AI",
+- "ruby-cloud-gem-name=google-cloud-document_ai-v1",
+- "ruby-cloud-namespace-override=DocumentAi=DocumentAI",
+- "ruby-cloud-product-url=https://cloud.google.com/document-ai/",
+- ],
+- grpc_service_config = "documentai_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Document AI uses machine learning on a single cloud-based platform to automatically classify, extract, and enrich data within your documents to unlock insights.",
+- ruby_cloud_title = "Document AI V1",
+- service_yaml = "documentai_v1.yaml",
+- deps = [
+- ":documentai_ruby_grpc",
+- ":documentai_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-documentai-v1-ruby",
+- deps = [
+- ":documentai_ruby_gapic",
+- ":documentai_ruby_grpc",
+- ":documentai_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "documentai_csharp_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "documentai_csharp_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "documentai_csharp_gapic",
+- srcs = [":documentai_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "documentai_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "documentai_v1.yaml",
+- deps = [
+- ":documentai_csharp_grpc",
+- ":documentai_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-documentai-v1-csharp",
+- deps = [
+- ":documentai_csharp_gapic",
+- ":documentai_csharp_grpc",
+- ":documentai_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "documentai_cc_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "documentai_cc_grpc",
+- srcs = [":documentai_proto"],
+- grpc_only = True,
+- deps = [":documentai_cc_proto"],
+-)
+diff -urN a/google/cloud/documentai/v1beta1/BUILD.bazel b/google/cloud/documentai/v1beta1/BUILD.bazel
+--- a/google/cloud/documentai/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/documentai/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,363 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "documentai_proto",
+- srcs = [
+- "document.proto",
+- "document_understanding.proto",
+- "geometry.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:color_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "documentai_proto_with_info",
+- deps = [
+- ":documentai_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "documentai_java_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-java_grpc_library(
+- name = "documentai_java_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "documentai_java_gapic",
+- srcs = [":documentai_proto_with_info"],
+- grpc_service_config = "documentai_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":documentai_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":documentai_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "documentai_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.documentai.v1beta1.DocumentUnderstandingServiceClientTest",
+- ],
+- runtime_deps = [":documentai_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-documentai-v1beta1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":documentai_java_gapic",
+- ":documentai_java_grpc",
+- ":documentai_java_proto",
+- ":documentai_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "documentai_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta1",
+- protos = [":documentai_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:color_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "documentai_go_gapic",
+- srcs = [":documentai_proto_with_info"],
+- grpc_service_config = "documentai_grpc_service_config.json",
+- importpath = "cloud.google.com/go/documentai/apiv1beta1;documentai",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/documentai:documentai_v1beta1.yaml",
+- deps = [
+- ":documentai_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "documentai_go_gapic_test",
+- srcs = [":documentai_go_gapic_srcjar_test"],
+- embed = [":documentai_go_gapic"],
+- importpath = "cloud.google.com/go/documentai/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-documentai-v1beta1-go",
+- deps = [
+- ":documentai_go_gapic",
+- ":documentai_go_gapic_srcjar-test.srcjar",
+- ":documentai_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "documentai_py_gapic",
+- srcs = [":documentai_proto"],
+- grpc_service_config = "documentai_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "documentai_py_gapic_test",
+- srcs = [
+- "documentai_py_gapic_pytest.py",
+- "documentai_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":documentai_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "documentai-v1beta1-py",
+- deps = [
+- ":documentai_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "documentai_php_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-php_grpc_library(
+- name = "documentai_php_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "documentai_php_gapic",
+- srcs = [":documentai_proto_with_info"],
+- grpc_service_config = "documentai_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/documentai:documentai_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":documentai_php_grpc",
+- ":documentai_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-documentai-v1beta1-php",
+- deps = [
+- ":documentai_php_gapic",
+- ":documentai_php_grpc",
+- ":documentai_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "documentai_nodejs_gapic",
+- package_name = "@google-cloud/documentai",
+- src = ":documentai_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "documentai_grpc_service_config.json",
+- package = "google.cloud.documentai.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/documentai:documentai_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "documentai-v1beta1-nodejs",
+- deps = [
+- ":documentai_nodejs_gapic",
+- ":documentai_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "documentai_ruby_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "documentai_ruby_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "documentai_ruby_gapic",
+- srcs = [":documentai_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-documentai-v1beta1"],
+- rest_numeric_enums = False,
+- deps = [
+- ":documentai_ruby_grpc",
+- ":documentai_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-documentai-v1beta1-ruby",
+- deps = [
+- ":documentai_ruby_gapic",
+- ":documentai_ruby_grpc",
+- ":documentai_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "documentai_csharp_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "documentai_csharp_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "documentai_csharp_gapic",
+- srcs = [":documentai_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "documentai_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/documentai:documentai_v1beta1.yaml",
+- deps = [
+- ":documentai_csharp_grpc",
+- ":documentai_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-documentai-v1beta1-csharp",
+- deps = [
+- ":documentai_csharp_gapic",
+- ":documentai_csharp_grpc",
+- ":documentai_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/documentai/v1beta2/BUILD.bazel b/google/cloud/documentai/v1beta2/BUILD.bazel
+--- a/google/cloud/documentai/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/documentai/v1beta2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,362 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "documentai_proto",
+- srcs = [
+- "document.proto",
+- "document_understanding.proto",
+- "geometry.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:color_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "documentai_proto_with_info",
+- deps = [
+- ":documentai_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "documentai_java_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-java_grpc_library(
+- name = "documentai_java_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "documentai_java_gapic",
+- srcs = [":documentai_proto_with_info"],
+- grpc_service_config = "documentai_v1beta2_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":documentai_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":documentai_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "documentai_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.documentai.v1beta2.DocumentUnderstandingServiceClientTest",
+- ],
+- runtime_deps = [":documentai_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-documentai-v1beta2-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":documentai_java_gapic",
+- ":documentai_java_grpc",
+- ":documentai_java_proto",
+- ":documentai_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "documentai_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta2",
+- protos = [":documentai_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:color_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "documentai_go_gapic",
+- srcs = [":documentai_proto_with_info"],
+- grpc_service_config = "documentai_v1beta2_grpc_service_config.json",
+- importpath = "cloud.google.com/go/documentai/apiv1beta2;documentai",
+- rest_numeric_enums = False,
+- service_yaml = "documentai_v1beta2.yaml",
+- deps = [
+- ":documentai_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "documentai_go_gapic_test",
+- srcs = [":documentai_go_gapic_srcjar_test"],
+- embed = [":documentai_go_gapic"],
+- importpath = "cloud.google.com/go/documentai/apiv1beta2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-documentai-v1beta2-go",
+- deps = [
+- ":documentai_go_gapic",
+- ":documentai_go_gapic_srcjar-test.srcjar",
+- ":documentai_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "documentai_py_gapic",
+- srcs = [":documentai_proto"],
+- grpc_service_config = "documentai_v1beta2_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "documentai_py_gapic_test",
+- srcs = [
+- "documentai_py_gapic_pytest.py",
+- "documentai_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":documentai_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "documentai-v1beta2-py",
+- deps = [
+- ":documentai_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "documentai_php_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-php_grpc_library(
+- name = "documentai_php_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "documentai_php_gapic",
+- srcs = [":documentai_proto_with_info"],
+- grpc_service_config = "documentai_v1beta2_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":documentai_php_grpc",
+- ":documentai_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-documentai-v1beta2-php",
+- deps = [
+- ":documentai_php_gapic",
+- ":documentai_php_grpc",
+- ":documentai_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "documentai_nodejs_gapic",
+- package_name = "@google-cloud/documentai",
+- src = ":documentai_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "documentai_v1beta2_grpc_service_config.json",
+- package = "google.cloud.documentai.v1beta2",
+- rest_numeric_enums = False,
+- service_yaml = "documentai_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "documentai-v1beta2-nodejs",
+- deps = [
+- ":documentai_nodejs_gapic",
+- ":documentai_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "documentai_ruby_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "documentai_ruby_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "documentai_ruby_gapic",
+- srcs = [":documentai_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-documentai-v1beta2"],
+- rest_numeric_enums = False,
+- deps = [
+- ":documentai_ruby_grpc",
+- ":documentai_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-documentai-v1beta2-ruby",
+- deps = [
+- ":documentai_ruby_gapic",
+- ":documentai_ruby_grpc",
+- ":documentai_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "documentai_csharp_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "documentai_csharp_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "documentai_csharp_gapic",
+- srcs = [":documentai_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "documentai_v1beta2_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "documentai_v1beta2.yaml",
+- deps = [
+- ":documentai_csharp_grpc",
+- ":documentai_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-documentai-v1beta2-csharp",
+- deps = [
+- ":documentai_csharp_gapic",
+- ":documentai_csharp_grpc",
+- ":documentai_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/documentai/v1beta3/BUILD.bazel b/google/cloud/documentai/v1beta3/BUILD.bazel
+--- a/google/cloud/documentai/v1beta3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/documentai/v1beta3/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,424 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "documentai_proto",
+- srcs = [
+- "barcode.proto",
+- "document.proto",
+- "document_io.proto",
+- "document_processor_service.proto",
+- "document_schema.proto",
+- "evaluation.proto",
+- "geometry.proto",
+- "operation_metadata.proto",
+- "processor.proto",
+- "processor_type.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:launch_stage_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:color_proto",
+- "//google/type:date_proto",
+- "//google/type:datetime_proto",
+- "//google/type:money_proto",
+- "//google/type:postal_address_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "documentai_proto_with_info",
+- deps = [
+- ":documentai_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "documentai_java_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-java_grpc_library(
+- name = "documentai_java_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "documentai_java_gapic",
+- srcs = [":documentai_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "documentai_v1beta3_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "documentai_v1beta3.yaml",
+- test_deps = [
+- ":documentai_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":documentai_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "documentai_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClientHttpJsonTest",
+- "com.google.cloud.documentai.v1beta3.DocumentProcessorServiceClientTest",
+- ],
+- runtime_deps = [":documentai_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-documentai-v1beta3-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":documentai_java_gapic",
+- ":documentai_java_grpc",
+- ":documentai_java_proto",
+- ":documentai_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "documentai_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3",
+- protos = [":documentai_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:api_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:color_go_proto",
+- "//google/type:date_go_proto",
+- "//google/type:datetime_go_proto",
+- "//google/type:money_go_proto",
+- "//google/type:postaladdress_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "documentai_go_gapic",
+- srcs = [":documentai_proto_with_info"],
+- grpc_service_config = "documentai_v1beta3_grpc_service_config.json",
+- importpath = "cloud.google.com/go/documentai/apiv1beta3;documentai",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "documentai_v1beta3.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":documentai_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "documentai_go_gapic_test",
+- srcs = [":documentai_go_gapic_srcjar_test"],
+- embed = [":documentai_go_gapic"],
+- importpath = "cloud.google.com/go/documentai/apiv1beta3",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-documentai-v1beta3-go",
+- deps = [
+- ":documentai_go_gapic",
+- ":documentai_go_gapic_srcjar-metadata.srcjar",
+- ":documentai_go_gapic_srcjar-test.srcjar",
+- ":documentai_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "documentai_py_gapic",
+- srcs = [":documentai_proto"],
+- grpc_service_config = "documentai_v1beta3_grpc_service_config.json",
+- opt_args = ["autogen-snippets"],
+- rest_numeric_enums = False,
+- service_yaml = "documentai_v1beta3.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "documentai_py_gapic_test",
+- srcs = [
+- "documentai_py_gapic_pytest.py",
+- "documentai_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":documentai_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "documentai-v1beta3-py",
+- deps = [
+- ":documentai_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "documentai_php_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-php_grpc_library(
+- name = "documentai_php_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "documentai_php_gapic",
+- srcs = [":documentai_proto_with_info"],
+- grpc_service_config = "documentai_v1beta3_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "documentai_v1beta3.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":documentai_php_grpc",
+- ":documentai_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-documentai-v1beta3-php",
+- deps = [
+- ":documentai_php_gapic",
+- ":documentai_php_grpc",
+- ":documentai_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "documentai_nodejs_gapic",
+- package_name = "@google-cloud/documentai",
+- src = ":documentai_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "documentai_v1beta3_grpc_service_config.json",
+- package = "google.cloud.documentai.v1beta3",
+- rest_numeric_enums = False,
+- service_yaml = "documentai_v1beta3.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "documentai-v1beta3-nodejs",
+- deps = [
+- ":documentai_nodejs_gapic",
+- ":documentai_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "documentai_ruby_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "documentai_ruby_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "documentai_ruby_gapic",
+- srcs = [":documentai_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=us-documentai.googleapis.com",
+- "ruby-cloud-api-shortname=documentai",
+- "ruby-cloud-env-prefix=DOCUMENT_AI",
+- "ruby-cloud-gem-name=google-cloud-document_ai-v1beta3",
+- "ruby-cloud-namespace-override=DocumentAi=DocumentAI",
+- "ruby-cloud-product-url=https://cloud.google.com/document-ai/",
+- ],
+- grpc_service_config = "documentai_v1beta3_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Document AI uses machine learning on a single cloud-based platform to automatically classify, extract, and enrich data within your documents to unlock insights.",
+- ruby_cloud_title = "Document AI V1beta3",
+- service_yaml = "documentai_v1beta3.yaml",
+- deps = [
+- ":documentai_ruby_grpc",
+- ":documentai_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-documentai-v1beta3-ruby",
+- deps = [
+- ":documentai_ruby_gapic",
+- ":documentai_ruby_grpc",
+- ":documentai_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "documentai_csharp_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "documentai_csharp_grpc",
+- srcs = [":documentai_proto"],
+- deps = [":documentai_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "documentai_csharp_gapic",
+- srcs = [":documentai_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "documentai_v1beta3_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "documentai_v1beta3.yaml",
+- deps = [
+- ":documentai_csharp_grpc",
+- ":documentai_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-documentai-v1beta3-csharp",
+- deps = [
+- ":documentai_csharp_gapic",
+- ":documentai_csharp_grpc",
+- ":documentai_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "documentai_cc_proto",
+- deps = [":documentai_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "documentai_cc_grpc",
+- srcs = [":documentai_proto"],
+- grpc_only = True,
+- deps = [":documentai_cc_proto"],
+-)
+diff -urN a/google/cloud/domains/BUILD.bazel b/google/cloud/domains/BUILD.bazel
+--- a/google/cloud/domains/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/domains/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-domains.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for domains.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta1 in this case.
+-ruby_cloud_gapic_library(
+- name = "domains_ruby_wrapper",
+- srcs = ["//google/cloud/domains/v1beta1:domains_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-domains",
+- "ruby-cloud-env-prefix=DOMAINS",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/domains",
+- "ruby-cloud-api-id=domains.googleapis.com",
+- "ruby-cloud-api-shortname=domains",
+- ],
+- ruby_cloud_description = "The Cloud Domains API provides registration, management and configuration of domain names.",
+- ruby_cloud_title = "Cloud Domains",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-domains-ruby",
+- deps = [
+- ":domains_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/domains/v1/BUILD.bazel b/google/cloud/domains/v1/BUILD.bazel
+--- a/google/cloud/domains/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/domains/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,396 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "domains_proto",
+- srcs = [
+- "domains.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:money_proto",
+- "//google/type:postal_address_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "domains_proto_with_info",
+- deps = [
+- ":domains_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "domains_java_proto",
+- deps = [":domains_proto"],
+-)
+-
+-java_grpc_library(
+- name = "domains_java_grpc",
+- srcs = [":domains_proto"],
+- deps = [":domains_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "domains_java_gapic",
+- srcs = [":domains_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "domains_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "domains_v1.yaml",
+- test_deps = [
+- ":domains_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":domains_java_proto",
+- "//google/api:api_java_proto",
+- "//google/type:type_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "domains_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.domains.v1.DomainsClientHttpJsonTest",
+- "com.google.cloud.domains.v1.DomainsClientTest",
+- ],
+- runtime_deps = [":domains_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-domains-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":domains_java_gapic",
+- ":domains_java_grpc",
+- ":domains_java_proto",
+- ":domains_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "domains_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/domains/v1",
+- protos = [":domains_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:money_go_proto",
+- "//google/type:postaladdress_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "domains_go_gapic",
+- srcs = [":domains_proto_with_info"],
+- grpc_service_config = "domains_grpc_service_config.json",
+- importpath = "cloud.google.com/go/domains/apiv1;domains",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "domains_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":domains_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "domains_go_gapic_test",
+- srcs = [":domains_go_gapic_srcjar_test"],
+- embed = [":domains_go_gapic"],
+- importpath = "cloud.google.com/go/domains/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-domains-v1-go",
+- deps = [
+- ":domains_go_gapic",
+- ":domains_go_gapic_srcjar-metadata.srcjar",
+- ":domains_go_gapic_srcjar-test.srcjar",
+- ":domains_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "domains_py_gapic",
+- srcs = [":domains_proto"],
+- grpc_service_config = "domains_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "domains_py_gapic_test",
+- srcs = [
+- "domains_py_gapic_pytest.py",
+- "domains_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":domains_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "domains-v1-py",
+- deps = [
+- ":domains_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "domains_php_proto",
+- deps = [":domains_proto"],
+-)
+-
+-php_grpc_library(
+- name = "domains_php_grpc",
+- srcs = [":domains_proto"],
+- deps = [":domains_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "domains_php_gapic",
+- srcs = [":domains_proto_with_info"],
+- grpc_service_config = "domains_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "domains_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":domains_php_grpc",
+- ":domains_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-domains-v1-php",
+- deps = [
+- ":domains_php_gapic",
+- ":domains_php_grpc",
+- ":domains_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "domains_nodejs_gapic",
+- package_name = "@google-cloud/domains",
+- src = ":domains_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "domains_grpc_service_config.json",
+- package = "google.cloud.domains.v1",
+- rest_numeric_enums = False,
+- service_yaml = "domains_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "domains-v1-nodejs",
+- deps = [
+- ":domains_nodejs_gapic",
+- ":domains_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "domains_ruby_proto",
+- deps = [":domains_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "domains_ruby_grpc",
+- srcs = [":domains_proto"],
+- deps = [":domains_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "domains_ruby_gapic",
+- srcs = [":domains_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=domains.googleapis.com",
+- "ruby-cloud-api-shortname=domains",
+- "ruby-cloud-env-prefix=DOMAINS",
+- "ruby-cloud-gem-name=google-cloud-domains-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/domains",
+- ],
+- grpc_service_config = "domains_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Cloud Domains API provides registration, management and configuration of domain names.",
+- ruby_cloud_title = "Cloud Domains V1",
+- deps = [
+- ":domains_ruby_grpc",
+- ":domains_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-domains-v1-ruby",
+- deps = [
+- ":domains_ruby_gapic",
+- ":domains_ruby_grpc",
+- ":domains_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "domains_csharp_proto",
+- deps = [":domains_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "domains_csharp_grpc",
+- srcs = [":domains_proto"],
+- deps = [":domains_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "domains_csharp_gapic",
+- srcs = [":domains_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "domains_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "domains_v1.yaml",
+- deps = [
+- ":domains_csharp_grpc",
+- ":domains_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-domains-v1-csharp",
+- deps = [
+- ":domains_csharp_gapic",
+- ":domains_csharp_grpc",
+- ":domains_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "domains_cc_proto",
+- deps = [":domains_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "domains_cc_grpc",
+- srcs = [":domains_proto"],
+- grpc_only = True,
+- deps = [":domains_cc_proto"],
+-)
+diff -urN a/google/cloud/domains/v1alpha2/BUILD.bazel b/google/cloud/domains/v1alpha2/BUILD.bazel
+--- a/google/cloud/domains/v1alpha2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/domains/v1alpha2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,380 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "domains_proto",
+- srcs = [
+- "domains.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:money_proto",
+- "//google/type:postal_address_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "domains_proto_with_info",
+- deps = [
+- ":domains_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "domains_java_proto",
+- deps = [":domains_proto"],
+-)
+-
+-java_grpc_library(
+- name = "domains_java_grpc",
+- srcs = [":domains_proto"],
+- deps = [":domains_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "domains_java_gapic",
+- srcs = [":domains_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "domains_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "domains_v1alpha2.yaml",
+- test_deps = [
+- ":domains_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":domains_java_proto",
+- "//google/api:api_java_proto",
+- "//google/type:type_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "domains_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.domains.v1alpha2.DomainsClientHttpJsonTest",
+- "com.google.cloud.domains.v1alpha2.DomainsClientTest",
+- ],
+- runtime_deps = [":domains_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-domains-v1alpha2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":domains_java_gapic",
+- ":domains_java_grpc",
+- ":domains_java_proto",
+- ":domains_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "domains_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/domains/v1alpha2",
+- protos = [":domains_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:money_go_proto",
+- "//google/type:postaladdress_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "domains_go_gapic",
+- srcs = [":domains_proto_with_info"],
+- grpc_service_config = "domains_grpc_service_config.json",
+- importpath = "cloud.google.com/go/domains/apiv1alpha2;domains",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "domains_v1alpha2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":domains_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "domains_go_gapic_test",
+- srcs = [":domains_go_gapic_srcjar_test"],
+- embed = [":domains_go_gapic"],
+- importpath = "cloud.google.com/go/domains/apiv1alpha2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-domains-v1alpha2-go",
+- deps = [
+- ":domains_go_gapic",
+- ":domains_go_gapic_srcjar-metadata.srcjar",
+- ":domains_go_gapic_srcjar-test.srcjar",
+- ":domains_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "domains_py_gapic",
+- srcs = [":domains_proto"],
+- grpc_service_config = "domains_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "domains_py_gapic_test",
+- srcs = [
+- "domains_py_gapic_pytest.py",
+- "domains_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":domains_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "domains-v1alpha2-py",
+- deps = [
+- ":domains_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "domains_php_proto",
+- deps = [":domains_proto"],
+-)
+-
+-php_grpc_library(
+- name = "domains_php_grpc",
+- srcs = [":domains_proto"],
+- deps = [":domains_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "domains_php_gapic",
+- srcs = [":domains_proto_with_info"],
+- grpc_service_config = "domains_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "domains_v1alpha2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":domains_php_grpc",
+- ":domains_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-domains-v1alpha2-php",
+- deps = [
+- ":domains_php_gapic",
+- ":domains_php_grpc",
+- ":domains_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "domains_nodejs_gapic",
+- package_name = "@google-cloud/domains",
+- src = ":domains_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "domains_grpc_service_config.json",
+- package = "google.cloud.domains.v1alpha2",
+- rest_numeric_enums = False,
+- service_yaml = "domains_v1alpha2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "domains-v1alpha2-nodejs",
+- deps = [
+- ":domains_nodejs_gapic",
+- ":domains_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "domains_ruby_proto",
+- deps = [":domains_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "domains_ruby_grpc",
+- srcs = [":domains_proto"],
+- deps = [":domains_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "domains_ruby_gapic",
+- srcs = [":domains_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=domains.googleapis.com",
+- "ruby-cloud-api-shortname=domains",
+- "ruby-cloud-env-prefix=DOMAINS",
+- "ruby-cloud-gem-name=google-cloud-domains-v1alpha2",
+- "ruby-cloud-product-url=https://cloud.google.com/domains",
+- ],
+- grpc_service_config = "domains_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Cloud Domains API provides registration, management and configuration of domain names.",
+- ruby_cloud_title = "Cloud Domains V1alpha2",
+- deps = [
+- ":domains_ruby_grpc",
+- ":domains_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-domains-v1alpha2-ruby",
+- deps = [
+- ":domains_ruby_gapic",
+- ":domains_ruby_grpc",
+- ":domains_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "domains_csharp_proto",
+- deps = [":domains_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "domains_csharp_grpc",
+- srcs = [":domains_proto"],
+- deps = [":domains_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "domains_csharp_gapic",
+- srcs = [":domains_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "domains_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "domains_v1alpha2.yaml",
+- deps = [
+- ":domains_csharp_grpc",
+- ":domains_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-domains-v1alpha2-csharp",
+- deps = [
+- ":domains_csharp_gapic",
+- ":domains_csharp_grpc",
+- ":domains_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/domains/v1beta1/BUILD.bazel b/google/cloud/domains/v1beta1/BUILD.bazel
+--- a/google/cloud/domains/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/domains/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,380 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "domains_proto",
+- srcs = [
+- "domains.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:money_proto",
+- "//google/type:postal_address_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "domains_proto_with_info",
+- deps = [
+- ":domains_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "domains_java_proto",
+- deps = [":domains_proto"],
+-)
+-
+-java_grpc_library(
+- name = "domains_java_grpc",
+- srcs = [":domains_proto"],
+- deps = [":domains_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "domains_java_gapic",
+- srcs = [":domains_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "domains_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "domains_v1beta1.yaml",
+- test_deps = [
+- ":domains_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":domains_java_proto",
+- "//google/api:api_java_proto",
+- "//google/type:type_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "domains_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.domains.v1beta1.DomainsClientHttpJsonTest",
+- "com.google.cloud.domains.v1beta1.DomainsClientTest",
+- ],
+- runtime_deps = [":domains_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-domains-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":domains_java_gapic",
+- ":domains_java_grpc",
+- ":domains_java_proto",
+- ":domains_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "domains_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/domains/v1beta1",
+- protos = [":domains_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:money_go_proto",
+- "//google/type:postaladdress_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "domains_go_gapic",
+- srcs = [":domains_proto_with_info"],
+- grpc_service_config = "domains_grpc_service_config.json",
+- importpath = "cloud.google.com/go/domains/apiv1beta1;domains",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "domains_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":domains_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "domains_go_gapic_test",
+- srcs = [":domains_go_gapic_srcjar_test"],
+- embed = [":domains_go_gapic"],
+- importpath = "cloud.google.com/go/domains/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-domains-v1beta1-go",
+- deps = [
+- ":domains_go_gapic",
+- ":domains_go_gapic_srcjar-metadata.srcjar",
+- ":domains_go_gapic_srcjar-test.srcjar",
+- ":domains_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "domains_py_gapic",
+- srcs = [":domains_proto"],
+- grpc_service_config = "domains_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "domains_py_gapic_test",
+- srcs = [
+- "domains_py_gapic_pytest.py",
+- "domains_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":domains_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "domains-v1beta1-py",
+- deps = [
+- ":domains_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "domains_php_proto",
+- deps = [":domains_proto"],
+-)
+-
+-php_grpc_library(
+- name = "domains_php_grpc",
+- srcs = [":domains_proto"],
+- deps = [":domains_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "domains_php_gapic",
+- srcs = [":domains_proto_with_info"],
+- grpc_service_config = "domains_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "domains_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":domains_php_grpc",
+- ":domains_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-domains-v1beta1-php",
+- deps = [
+- ":domains_php_gapic",
+- ":domains_php_grpc",
+- ":domains_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "domains_nodejs_gapic",
+- package_name = "@google-cloud/domains",
+- src = ":domains_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "domains_grpc_service_config.json",
+- package = "google.cloud.domains.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "domains_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "domains-v1beta1-nodejs",
+- deps = [
+- ":domains_nodejs_gapic",
+- ":domains_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "domains_ruby_proto",
+- deps = [":domains_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "domains_ruby_grpc",
+- srcs = [":domains_proto"],
+- deps = [":domains_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "domains_ruby_gapic",
+- srcs = [":domains_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=domains.googleapis.com",
+- "ruby-cloud-api-shortname=domains",
+- "ruby-cloud-env-prefix=DOMAINS",
+- "ruby-cloud-gem-name=google-cloud-domains-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/domains",
+- ],
+- grpc_service_config = "domains_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Cloud Domains API provides registration, management and configuration of domain names.",
+- ruby_cloud_title = "Cloud Domains V1beta1",
+- deps = [
+- ":domains_ruby_grpc",
+- ":domains_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-domains-v1beta1-ruby",
+- deps = [
+- ":domains_ruby_gapic",
+- ":domains_ruby_grpc",
+- ":domains_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "domains_csharp_proto",
+- deps = [":domains_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "domains_csharp_grpc",
+- srcs = [":domains_proto"],
+- deps = [":domains_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "domains_csharp_gapic",
+- srcs = [":domains_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "domains_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "domains_v1beta1.yaml",
+- deps = [
+- ":domains_csharp_grpc",
+- ":domains_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-domains-v1beta1-csharp",
+- deps = [
+- ":domains_csharp_gapic",
+- ":domains_csharp_grpc",
+- ":domains_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/edgecontainer/v1/BUILD.bazel b/google/cloud/edgecontainer/v1/BUILD.bazel
+--- a/google/cloud/edgecontainer/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/edgecontainer/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,390 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "edgecontainer_proto",
+- srcs = [
+- "resources.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "edgecontainer_proto_with_info",
+- deps = [
+- ":edgecontainer_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "edgecontainer_java_proto",
+- deps = [":edgecontainer_proto"],
+-)
+-
+-java_grpc_library(
+- name = "edgecontainer_java_grpc",
+- srcs = [":edgecontainer_proto"],
+- deps = [":edgecontainer_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "edgecontainer_java_gapic",
+- srcs = [":edgecontainer_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "edgecontainer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = None,
+- test_deps = [
+- ":edgecontainer_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":edgecontainer_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "edgecontainer_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.edgecontainer.v1.EdgeContainerClientHttpJsonTest",
+- "com.google.cloud.edgecontainer.v1.EdgeContainerClientTest",
+- ],
+- runtime_deps = [":edgecontainer_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-edgecontainer-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":edgecontainer_java_gapic",
+- ":edgecontainer_java_grpc",
+- ":edgecontainer_java_proto",
+- ":edgecontainer_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "edgecontainer_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/edgecontainer/v1",
+- protos = [":edgecontainer_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "edgecontainer_go_gapic",
+- srcs = [":edgecontainer_proto_with_info"],
+- grpc_service_config = "edgecontainer_grpc_service_config.json",
+- importpath = "cloud.google.com/go/edgecontainer/apiv1;edgecontainer",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = None,
+- transport = "grpc+rest",
+- deps = [
+- ":edgecontainer_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "edgecontainer_go_gapic_test",
+- srcs = [":edgecontainer_go_gapic_srcjar_test"],
+- embed = [":edgecontainer_go_gapic"],
+- importpath = "cloud.google.com/go/edgecontainer/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-edgecontainer-v1-go",
+- deps = [
+- ":edgecontainer_go_gapic",
+- ":edgecontainer_go_gapic_srcjar-metadata.srcjar",
+- ":edgecontainer_go_gapic_srcjar-test.srcjar",
+- ":edgecontainer_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "edgecontainer_py_gapic",
+- srcs = [":edgecontainer_proto"],
+- grpc_service_config = "edgecontainer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = None,
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "edgecontainer_py_gapic_test",
+- srcs = [
+- "edgecontainer_py_gapic_pytest.py",
+- "edgecontainer_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":edgecontainer_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "edgecontainer-v1-py",
+- deps = [
+- ":edgecontainer_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "edgecontainer_php_proto",
+- deps = [":edgecontainer_proto"],
+-)
+-
+-php_grpc_library(
+- name = "edgecontainer_php_grpc",
+- srcs = [":edgecontainer_proto"],
+- deps = [":edgecontainer_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "edgecontainer_php_gapic",
+- srcs = [":edgecontainer_proto_with_info"],
+- grpc_service_config = "edgecontainer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = None,
+- transport = "grpc+rest",
+- deps = [
+- ":edgecontainer_php_grpc",
+- ":edgecontainer_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-edgecontainer-v1-php",
+- deps = [
+- ":edgecontainer_php_gapic",
+- ":edgecontainer_php_grpc",
+- ":edgecontainer_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "edgecontainer_nodejs_gapic",
+- package_name = "@google-cloud/edgecontainer",
+- src = ":edgecontainer_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "edgecontainer_grpc_service_config.json",
+- package = "google.cloud.edgecontainer.v1",
+- rest_numeric_enums = False,
+- service_yaml = None,
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "edgecontainer-v1-nodejs",
+- deps = [
+- ":edgecontainer_nodejs_gapic",
+- ":edgecontainer_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "edgecontainer_ruby_proto",
+- deps = [":edgecontainer_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "edgecontainer_ruby_grpc",
+- srcs = [":edgecontainer_proto"],
+- deps = [":edgecontainer_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "edgecontainer_ruby_gapic",
+- srcs = [":edgecontainer_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-edgecontainer-v1"],
+- grpc_service_config = "edgecontainer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = None,
+- deps = [
+- ":edgecontainer_ruby_grpc",
+- ":edgecontainer_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-edgecontainer-v1-ruby",
+- deps = [
+- ":edgecontainer_ruby_gapic",
+- ":edgecontainer_ruby_grpc",
+- ":edgecontainer_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "edgecontainer_csharp_proto",
+- deps = [":edgecontainer_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "edgecontainer_csharp_grpc",
+- srcs = [":edgecontainer_proto"],
+- deps = [":edgecontainer_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "edgecontainer_csharp_gapic",
+- srcs = [":edgecontainer_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "edgecontainer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = None,
+- deps = [
+- ":edgecontainer_csharp_grpc",
+- ":edgecontainer_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-edgecontainer-v1-csharp",
+- deps = [
+- ":edgecontainer_csharp_gapic",
+- ":edgecontainer_csharp_grpc",
+- ":edgecontainer_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "edgecontainer_cc_proto",
+- deps = [":edgecontainer_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "edgecontainer_cc_grpc",
+- srcs = [":edgecontainer_proto"],
+- grpc_only = True,
+- deps = [":edgecontainer_cc_proto"],
+-)
+diff -urN a/google/cloud/enterpriseknowledgegraph/v1/BUILD.bazel b/google/cloud/enterpriseknowledgegraph/v1/BUILD.bazel
+--- a/google/cloud/enterpriseknowledgegraph/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/enterpriseknowledgegraph/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,283 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "enterpriseknowledgegraph_proto",
+- srcs = [
+- "job_state.proto",
+- "operation_metadata.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "enterpriseknowledgegraph_proto_with_info",
+- deps = [
+- ":enterpriseknowledgegraph_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "enterpriseknowledgegraph_java_proto",
+- deps = [
+- ":enterpriseknowledgegraph_proto",
+- ],
+-)
+-
+-java_grpc_library(
+- name = "enterpriseknowledgegraph_java_grpc",
+- srcs = [":enterpriseknowledgegraph_proto"],
+- deps = [":enterpriseknowledgegraph_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "enterpriseknowledgegraph_java_gapic",
+- srcs = [":enterpriseknowledgegraph_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "enterpriseknowledgegraph_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "enterpriseknowledgegraph_v1.yaml",
+- test_deps = [
+- ":enterpriseknowledgegraph_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":enterpriseknowledgegraph_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "enterpriseknowledgegraph_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphServiceClientHttpJsonTest",
+- "com.google.cloud.enterpriseknowledgegraph.v1.EnterpriseKnowledgeGraphServiceClientTest",
+- ],
+- runtime_deps = [":enterpriseknowledgegraph_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-enterpriseknowledgegraph-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":enterpriseknowledgegraph_java_gapic",
+- ":enterpriseknowledgegraph_java_grpc",
+- ":enterpriseknowledgegraph_java_proto",
+- ":enterpriseknowledgegraph_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "enterpriseknowledgegraph_py_gapic",
+- srcs = [
+- ":enterpriseknowledgegraph_proto",
+- ],
+- grpc_service_config = "enterpriseknowledgegraph_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "enterpriseknowledgegraph_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "enterpriseknowledgegraph_py_gapic_test",
+- srcs = [
+- "enterpriseknowledgegraph_py_gapic_pytest.py",
+- "enterpriseknowledgegraph_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [
+- ":enterpriseknowledgegraph_py_gapic",
+- ],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "enterpriseknowledgegraph-v1-py",
+- deps = [
+- ":enterpriseknowledgegraph_py_gapic",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "enterpriseknowledgegraph_cc_proto",
+- deps = [":enterpriseknowledgegraph_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "enterpriseknowledgegraph_cc_grpc",
+- srcs = [":enterpriseknowledgegraph_proto"],
+- grpc_only = True,
+- deps = [":enterpriseknowledgegraph_cc_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-
+-php_proto_library(
+- name = "enterpriseknowledgegraph_php_proto",
+- deps = [":enterpriseknowledgegraph_proto"],
+-)
+-
+-php_grpc_library(
+- name = "enterpriseknowledgegraph_php_grpc",
+- srcs = [":enterpriseknowledgegraph_proto"],
+- deps = [":enterpriseknowledgegraph_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "enterpriseknowledgegraph_php_gapic",
+- srcs = [":enterpriseknowledgegraph_proto_with_info"],
+- grpc_service_config = "enterpriseknowledgegraph_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "enterpriseknowledgegraph_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":enterpriseknowledgegraph_php_grpc",
+- ":enterpriseknowledgegraph_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-enterpriseknowledgegraph-v1-php",
+- deps = [
+- ":enterpriseknowledgegraph_php_gapic",
+- ":enterpriseknowledgegraph_php_grpc",
+- ":enterpriseknowledgegraph_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-ruby_proto_library(
+- name = "enterpriseknowledgegraph_ruby_proto",
+- deps = [":enterpriseknowledgegraph_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "enterpriseknowledgegraph_ruby_grpc",
+- srcs = [":enterpriseknowledgegraph_proto"],
+- deps = [":enterpriseknowledgegraph_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "enterpriseknowledgegraph_ruby_gapic",
+- srcs = [":enterpriseknowledgegraph_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-enterpriseknowledgegraph-v1",
+- ],
+- grpc_service_config = "enterpriseknowledgegraph_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "enterpriseknowledgegraph_v1.yaml",
+- deps = [
+- ":enterpriseknowledgegraph_ruby_grpc",
+- ":enterpriseknowledgegraph_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-enterpriseknowledgegraph-v1-ruby",
+- deps = [
+- ":enterpriseknowledgegraph_ruby_gapic",
+- ":enterpriseknowledgegraph_ruby_grpc",
+- ":enterpriseknowledgegraph_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-csharp_proto_library(
+- name = "enterpriseknowledgegraph_csharp_proto",
+- deps = [":enterpriseknowledgegraph_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "enterpriseknowledgegraph_csharp_grpc",
+- srcs = [":enterpriseknowledgegraph_proto"],
+- deps = [":enterpriseknowledgegraph_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "enterpriseknowledgegraph_csharp_gapic",
+- srcs = [":enterpriseknowledgegraph_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "enterpriseknowledgegraph_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "enterpriseknowledgegraph_v1.yaml",
+- deps = [
+- ":enterpriseknowledgegraph_csharp_grpc",
+- ":enterpriseknowledgegraph_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-enterpriseknowledgegraph-v1-csharp",
+- deps = [
+- ":enterpriseknowledgegraph_csharp_gapic",
+- ":enterpriseknowledgegraph_csharp_grpc",
+- ":enterpriseknowledgegraph_csharp_proto",
+- ],
+-)
+diff -urN a/google/cloud/essentialcontacts/BUILD.bazel b/google/cloud/essentialcontacts/BUILD.bazel
+--- a/google/cloud/essentialcontacts/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/essentialcontacts/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-essential_contacts.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for essentialcontacts.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "essentialcontacts_ruby_wrapper",
+- srcs = ["//google/cloud/essentialcontacts/v1:essentialcontacts_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-essential_contacts",
+- "ruby-cloud-env-prefix=ESSENTIAL_CONTACTS",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/resource-manager/docs/managing-notification-contacts/",
+- "ruby-cloud-api-id=essentialcontacts.googleapis.com",
+- "ruby-cloud-api-shortname=essentialcontacts",
+- ],
+- ruby_cloud_description = "Many Google Cloud services, such as Cloud Billing, send out notifications to share important information with Google Cloud users. By default, these notifications are sent to members with certain Identity and Access Management (IAM) roles. With Essential Contacts, you can customize who receives notifications by providing your own list of contacts.",
+- ruby_cloud_title = "Essential Contacts",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-essentialcontacts-ruby",
+- deps = [
+- ":essentialcontacts_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/essentialcontacts/v1/BUILD.bazel b/google/cloud/essentialcontacts/v1/BUILD.bazel
+--- a/google/cloud/essentialcontacts/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/essentialcontacts/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,344 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "essentialcontacts_proto",
+- srcs = [
+- "enums.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "essentialcontacts_proto_with_info",
+- deps = [
+- ":essentialcontacts_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "essentialcontacts_java_proto",
+- deps = [":essentialcontacts_proto"],
+-)
+-
+-java_grpc_library(
+- name = "essentialcontacts_java_grpc",
+- srcs = [":essentialcontacts_proto"],
+- deps = [":essentialcontacts_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "essentialcontacts_java_gapic",
+- srcs = [":essentialcontacts_proto_with_info"],
+- grpc_service_config = "essentialcontacts_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":essentialcontacts_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":essentialcontacts_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "essentialcontacts_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.essentialcontacts.v1.EssentialContactsServiceClientHttpJsonTest",
+- "com.google.cloud.essentialcontacts.v1.EssentialContactsServiceClientTest",
+- ],
+- runtime_deps = [":essentialcontacts_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-essentialcontacts-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":essentialcontacts_java_gapic",
+- ":essentialcontacts_java_grpc",
+- ":essentialcontacts_java_proto",
+- ":essentialcontacts_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "essentialcontacts_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1",
+- protos = [":essentialcontacts_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "essentialcontacts_go_gapic",
+- srcs = [":essentialcontacts_proto_with_info"],
+- grpc_service_config = "essentialcontacts_v1_grpc_service_config.json",
+- importpath = "cloud.google.com/go/essentialcontacts/apiv1;essentialcontacts",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "essentialcontacts_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":essentialcontacts_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "essentialcontacts_go_gapic_test",
+- srcs = [":essentialcontacts_go_gapic_srcjar_test"],
+- embed = [":essentialcontacts_go_gapic"],
+- importpath = "cloud.google.com/go/essentialcontacts/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-essentialcontacts-v1-go",
+- deps = [
+- ":essentialcontacts_go_gapic",
+- ":essentialcontacts_go_gapic_srcjar-metadata.srcjar",
+- ":essentialcontacts_go_gapic_srcjar-test.srcjar",
+- ":essentialcontacts_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "essentialcontacts_py_gapic",
+- srcs = [":essentialcontacts_proto"],
+- grpc_service_config = "essentialcontacts_v1_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-essential-contacts",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=essential_contacts",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "essentialcontacts_py_gapic_test",
+- srcs = [
+- "essentialcontacts_py_gapic_pytest.py",
+- "essentialcontacts_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":essentialcontacts_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "essentialcontacts-v1-py",
+- deps = [
+- ":essentialcontacts_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "essentialcontacts_php_proto",
+- deps = [":essentialcontacts_proto"],
+-)
+-
+-php_grpc_library(
+- name = "essentialcontacts_php_grpc",
+- srcs = [":essentialcontacts_proto"],
+- deps = [":essentialcontacts_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "essentialcontacts_php_gapic",
+- srcs = [":essentialcontacts_proto_with_info"],
+- grpc_service_config = "essentialcontacts_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "essentialcontacts_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":essentialcontacts_php_grpc",
+- ":essentialcontacts_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-essentialcontacts-v1-php",
+- deps = [
+- ":essentialcontacts_php_gapic",
+- ":essentialcontacts_php_grpc",
+- ":essentialcontacts_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "essentialcontacts_nodejs_gapic",
+- package_name = "@google-cloud/essential-contacts",
+- src = ":essentialcontacts_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "essentialcontacts_v1_grpc_service_config.json",
+- package = "google.cloud.essentialcontacts.v1",
+- rest_numeric_enums = False,
+- service_yaml = "essentialcontacts_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "essentialcontacts-v1-nodejs",
+- deps = [
+- ":essentialcontacts_nodejs_gapic",
+- ":essentialcontacts_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "essentialcontacts_ruby_proto",
+- deps = [":essentialcontacts_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "essentialcontacts_ruby_grpc",
+- srcs = [":essentialcontacts_proto"],
+- deps = [":essentialcontacts_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "essentialcontacts_ruby_gapic",
+- srcs = [":essentialcontacts_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-essential_contacts-v1",
+- "ruby-cloud-env-prefix=ESSENTIAL_CONTACTS",
+- "ruby-cloud-product-url=https://cloud.google.com/resource-manager/docs/managing-notification-contacts/",
+- "ruby-cloud-api-id=essentialcontacts.googleapis.com",
+- "ruby-cloud-api-shortname=essentialcontacts",
+- ],
+- grpc_service_config = "essentialcontacts_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Many Google Cloud services, such as Cloud Billing, send out notifications to share important information with Google Cloud users. By default, these notifications are sent to members with certain Identity and Access Management (IAM) roles. With Essential Contacts, you can customize who receives notifications by providing your own list of contacts.",
+- ruby_cloud_title = "Essential Contacts V1",
+- deps = [
+- ":essentialcontacts_ruby_grpc",
+- ":essentialcontacts_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-essentialcontacts-v1-ruby",
+- deps = [
+- ":essentialcontacts_ruby_gapic",
+- ":essentialcontacts_ruby_grpc",
+- ":essentialcontacts_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "essentialcontacts_csharp_proto",
+- deps = [":essentialcontacts_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "essentialcontacts_csharp_grpc",
+- srcs = [":essentialcontacts_proto"],
+- deps = [":essentialcontacts_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "essentialcontacts_csharp_gapic",
+- srcs = [":essentialcontacts_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "essentialcontacts_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "essentialcontacts_v1.yaml",
+- deps = [
+- ":essentialcontacts_csharp_grpc",
+- ":essentialcontacts_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-essentialcontacts-v1-csharp",
+- deps = [
+- ":essentialcontacts_csharp_gapic",
+- ":essentialcontacts_csharp_grpc",
+- ":essentialcontacts_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "essentialcontacts_cc_proto",
+- deps = [":essentialcontacts_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "essentialcontacts_cc_grpc",
+- srcs = [":essentialcontacts_proto"],
+- grpc_only = True,
+- deps = [":essentialcontacts_cc_proto"],
+-)
+diff -urN a/google/cloud/eventarc/BUILD.bazel b/google/cloud/eventarc/BUILD.bazel
+--- a/google/cloud/eventarc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/eventarc/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-eventarc.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for eventarc.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "eventarc_ruby_wrapper",
+- srcs = ["//google/cloud/eventarc/v1:eventarc_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-eventarc",
+- "ruby-cloud-env-prefix=EVENTARC",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/eventarc/",
+- "ruby-cloud-api-id=eventarc.googleapis.com",
+- "ruby-cloud-api-shortname=eventarc",
+- ],
+- ruby_cloud_description = "Eventarc lets you asynchronously deliver events from Google services, SaaS, and your own apps using loosely coupled services that react to state changes. Eventarc requires no infrastructure management — you can optimize productivity and costs while building a modern, event-driven solution.",
+- ruby_cloud_title = "Eventarc",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-eventarc-ruby",
+- deps = [
+- ":eventarc_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/eventarc/publishing/BUILD.bazel b/google/cloud/eventarc/publishing/BUILD.bazel
+--- a/google/cloud/eventarc/publishing/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/eventarc/publishing/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-eventarc-publishing.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for eventarc-publishing.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "publishing_ruby_wrapper",
+- srcs = ["//google/cloud/eventarc/publishing/v1:publishing_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-eventarc-publishing",
+- "ruby-cloud-env-prefix=EVENTARC",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/eventarc/",
+- "ruby-cloud-api-id=eventarcpublishing.googleapis.com",
+- "ruby-cloud-api-shortname=eventarcpublishing",
+- ],
+- ruby_cloud_description = "Eventarc lets you asynchronously deliver events from Google services, SaaS, and your own apps using loosely coupled services that react to state changes. Eventarc requires no infrastructure management — you can optimize productivity and costs while building a modern, event-driven solution.",
+- ruby_cloud_title = "Eventarc Publishing",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-eventarc-publishing-ruby",
+- deps = [
+- ":publishing_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/eventarc/publishing/v1/BUILD.bazel b/google/cloud/eventarc/publishing/v1/BUILD.bazel
+--- a/google/cloud/eventarc/publishing/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/eventarc/publishing/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,339 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "publishing_proto",
+- srcs = [
+- "publisher.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "@com_google_protobuf//:any_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "publishing_proto_with_info",
+- deps = [
+- ":publishing_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "publishing_java_proto",
+- deps = [":publishing_proto"],
+-)
+-
+-java_grpc_library(
+- name = "publishing_java_grpc",
+- srcs = [":publishing_proto"],
+- deps = [":publishing_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "publishing_java_gapic",
+- srcs = [":publishing_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "eventarcpublishing_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "eventarcpublishing_v1.yaml",
+- test_deps = [
+- ":publishing_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":publishing_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "publishing_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.eventarc.publishing.v1.PublisherClientHttpJsonTest",
+- "com.google.cloud.eventarc.publishing.v1.PublisherClientTest",
+- ],
+- runtime_deps = [":publishing_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-eventarc-publishing-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":publishing_java_gapic",
+- ":publishing_java_grpc",
+- ":publishing_java_proto",
+- ":publishing_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "publishing_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/eventarc/publishing/v1",
+- protos = [":publishing_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "publishing_go_gapic",
+- srcs = [":publishing_proto_with_info"],
+- grpc_service_config = "eventarcpublishing_grpc_service_config.json",
+- importpath = "cloud.google.com/go/eventarc/publishing/apiv1;publisher",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "eventarcpublishing_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":publishing_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "publishing_go_gapic_test",
+- srcs = [":publishing_go_gapic_srcjar_test"],
+- embed = [":publishing_go_gapic"],
+- importpath = "cloud.google.com/go/eventarc/publishing/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-eventarc-publishing-v1-go",
+- deps = [
+- ":publishing_go_gapic",
+- ":publishing_go_gapic_srcjar-metadata.srcjar",
+- ":publishing_go_gapic_srcjar-test.srcjar",
+- ":publishing_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "publishing_py_gapic",
+- srcs = [":publishing_proto"],
+- grpc_service_config = "eventarcpublishing_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=eventarc_publishing",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-eventarc-publishing",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "eventarcpublishing_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "publishing_py_gapic_test",
+- srcs = [
+- "publishing_py_gapic_pytest.py",
+- "publishing_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":publishing_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "eventarc-publishing-v1-py",
+- deps = [
+- ":publishing_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "publishing_php_proto",
+- deps = [":publishing_proto"],
+-)
+-
+-php_grpc_library(
+- name = "publishing_php_grpc",
+- srcs = [":publishing_proto"],
+- deps = [":publishing_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "publishing_php_gapic",
+- srcs = [":publishing_proto_with_info"],
+- grpc_service_config = "eventarcpublishing_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "eventarcpublishing_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":publishing_php_grpc",
+- ":publishing_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-eventarc-publishing-v1-php",
+- deps = [
+- ":publishing_php_gapic",
+- ":publishing_php_grpc",
+- ":publishing_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "publishing_nodejs_gapic",
+- package_name = "@google-cloud/eventarc-publishing",
+- src = ":publishing_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "eventarcpublishing_grpc_service_config.json",
+- package = "google.cloud.eventarc.publishing.v1",
+- rest_numeric_enums = False,
+- service_yaml = "eventarcpublishing_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "eventarc-publishing-v1-nodejs",
+- deps = [
+- ":publishing_nodejs_gapic",
+- ":publishing_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "publishing_ruby_proto",
+- deps = [":publishing_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "publishing_ruby_grpc",
+- srcs = [":publishing_proto"],
+- deps = [":publishing_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "publishing_ruby_gapic",
+- srcs = [":publishing_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=eventarcpublishing.googleapis.com",
+- "ruby-cloud-api-shortname=eventarcpublishing",
+- "ruby-cloud-env-prefix=EVENTARC",
+- "ruby-cloud-gem-name=google-cloud-eventarc-publishing-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/eventarc/",
+- ],
+- grpc_service_config = "eventarcpublishing_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Eventarc lets you asynchronously deliver events from Google services, SaaS, and your own apps using loosely coupled services that react to state changes. Eventarc requires no infrastructure management — you can optimize productivity and costs while building a modern, event-driven solution.",
+- ruby_cloud_title = "Eventarc Publishing V1",
+- service_yaml = "eventarcpublishing_v1.yaml",
+- deps = [
+- ":publishing_ruby_grpc",
+- ":publishing_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-eventarc-publishing-v1-ruby",
+- deps = [
+- ":publishing_ruby_gapic",
+- ":publishing_ruby_grpc",
+- ":publishing_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "publishing_csharp_proto",
+- deps = [":publishing_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "publishing_csharp_grpc",
+- srcs = [":publishing_proto"],
+- deps = [":publishing_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "publishing_csharp_gapic",
+- srcs = [":publishing_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "eventarcpublishing_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "eventarcpublishing_v1.yaml",
+- deps = [
+- ":publishing_csharp_grpc",
+- ":publishing_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-eventarc-publishing-v1-csharp",
+- deps = [
+- ":publishing_csharp_gapic",
+- ":publishing_csharp_grpc",
+- ":publishing_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "publishing_cc_proto",
+- deps = [":publishing_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "publishing_cc_grpc",
+- srcs = [":publishing_proto"],
+- grpc_only = True,
+- deps = [":publishing_cc_proto"],
+-)
+diff -urN a/google/cloud/eventarc/v1/BUILD.bazel b/google/cloud/eventarc/v1/BUILD.bazel
+--- a/google/cloud/eventarc/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/eventarc/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,411 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "eventarc_proto",
+- srcs = [
+- "channel.proto",
+- "channel_connection.proto",
+- "discovery.proto",
+- "eventarc.proto",
+- "google_channel_config.proto",
+- "trigger.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:code_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "eventarc_proto_with_info",
+- deps = [
+- ":eventarc_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "eventarc_java_proto",
+- deps = [":eventarc_proto"],
+-)
+-
+-java_grpc_library(
+- name = "eventarc_java_grpc",
+- srcs = [":eventarc_proto"],
+- deps = [":eventarc_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "eventarc_java_gapic",
+- srcs = [":eventarc_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "eventarc_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "eventarc_v1.yaml",
+- test_deps = [
+- ":eventarc_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":eventarc_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "eventarc_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.eventarc.v1.EventarcClientHttpJsonTest",
+- "com.google.cloud.eventarc.v1.EventarcClientTest",
+- ],
+- runtime_deps = [":eventarc_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-eventarc-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":eventarc_java_gapic",
+- ":eventarc_java_grpc",
+- ":eventarc_java_proto",
+- ":eventarc_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "eventarc_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/eventarc/v1",
+- protos = [":eventarc_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:code_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "eventarc_go_gapic",
+- srcs = [":eventarc_proto_with_info"],
+- grpc_service_config = "eventarc_grpc_service_config.json",
+- importpath = "cloud.google.com/go/eventarc/apiv1;eventarc",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "eventarc_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":eventarc_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "eventarc_go_gapic_test",
+- srcs = [":eventarc_go_gapic_srcjar_test"],
+- embed = [":eventarc_go_gapic"],
+- importpath = "cloud.google.com/go/eventarc/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-eventarc-v1-go",
+- deps = [
+- ":eventarc_go_gapic",
+- ":eventarc_go_gapic_srcjar-metadata.srcjar",
+- ":eventarc_go_gapic_srcjar-test.srcjar",
+- ":eventarc_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "eventarc_py_gapic",
+- srcs = [":eventarc_proto"],
+- grpc_service_config = "eventarc_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "eventarc_v1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "eventarc_py_gapic_test",
+- srcs = [
+- "eventarc_py_gapic_pytest.py",
+- "eventarc_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":eventarc_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "eventarc-v1-py",
+- deps = [
+- ":eventarc_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "eventarc_php_proto",
+- deps = [":eventarc_proto"],
+-)
+-
+-php_grpc_library(
+- name = "eventarc_php_grpc",
+- srcs = [":eventarc_proto"],
+- deps = [":eventarc_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "eventarc_php_gapic",
+- srcs = [":eventarc_proto_with_info"],
+- grpc_service_config = "eventarc_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "eventarc_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":eventarc_php_grpc",
+- ":eventarc_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-eventarc-v1-php",
+- deps = [
+- ":eventarc_php_gapic",
+- ":eventarc_php_grpc",
+- ":eventarc_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "eventarc_nodejs_gapic",
+- package_name = "@google-cloud/eventarc",
+- src = ":eventarc_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "eventarc_grpc_service_config.json",
+- package = "google.cloud.eventarc.v1",
+- rest_numeric_enums = False,
+- service_yaml = "eventarc_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "eventarc-v1-nodejs",
+- deps = [
+- ":eventarc_nodejs_gapic",
+- ":eventarc_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "eventarc_ruby_proto",
+- deps = [":eventarc_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "eventarc_ruby_grpc",
+- srcs = [":eventarc_proto"],
+- deps = [":eventarc_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "eventarc_ruby_gapic",
+- srcs = [":eventarc_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=eventarc.googleapis.com",
+- "ruby-cloud-api-shortname=eventarc",
+- "ruby-cloud-env-prefix=EVENTARC",
+- "ruby-cloud-gem-name=google-cloud-eventarc-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/eventarc/",
+- ],
+- grpc_service_config = "eventarc_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Eventarc lets you asynchronously deliver events from Google services, SaaS, and your own apps using loosely coupled services that react to state changes. Eventarc requires no infrastructure management — you can optimize productivity and costs while building a modern, event-driven solution.",
+- ruby_cloud_title = "Eventarc V1",
+- service_yaml = "eventarc_v1.yaml",
+- deps = [
+- ":eventarc_ruby_grpc",
+- ":eventarc_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-eventarc-v1-ruby",
+- deps = [
+- ":eventarc_ruby_gapic",
+- ":eventarc_ruby_grpc",
+- ":eventarc_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "eventarc_csharp_proto",
+- deps = [":eventarc_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "eventarc_csharp_grpc",
+- srcs = [":eventarc_proto"],
+- deps = [":eventarc_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "eventarc_csharp_gapic",
+- srcs = [":eventarc_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "eventarc_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "eventarc_v1.yaml",
+- deps = [
+- ":eventarc_csharp_grpc",
+- ":eventarc_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-eventarc-v1-csharp",
+- deps = [
+- ":eventarc_csharp_gapic",
+- ":eventarc_csharp_grpc",
+- ":eventarc_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "eventarc_cc_proto",
+- deps = [":eventarc_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "eventarc_cc_grpc",
+- srcs = [":eventarc_proto"],
+- grpc_only = True,
+- deps = [":eventarc_cc_proto"],
+-)
+diff -urN a/google/cloud/filestore/BUILD.bazel b/google/cloud/filestore/BUILD.bazel
+--- a/google/cloud/filestore/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/filestore/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-filestore.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for file.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "file_ruby_wrapper",
+- srcs = ["//google/cloud/filestore/v1:filestore_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-filestore",
+- "ruby-cloud-wrapper-of=v1:0.1",
+- "ruby-cloud-product-url=https://cloud.google.com/filestore/",
+- "ruby-cloud-api-id=file.googleapis.com",
+- "ruby-cloud-api-shortname=file",
+- ],
+- ruby_cloud_description = "Filestore instances are fully managed NFS file servers on Google Cloud for use with applications running on Compute Engine virtual machines (VMs) instances or Google Kubernetes Engine clusters.",
+- ruby_cloud_title = "Filestore",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-filestore-ruby",
+- deps = [
+- ":file_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/filestore/v1/BUILD.bazel b/google/cloud/filestore/v1/BUILD.bazel
+--- a/google/cloud/filestore/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/filestore/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,400 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "filestore_proto",
+- srcs = [
+- "cloud_filestore_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/cloud/common:common_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "filestore_proto_with_info",
+- deps = [
+- ":filestore_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "filestore_java_proto",
+- deps = [":filestore_proto"],
+-)
+-
+-java_grpc_library(
+- name = "filestore_java_grpc",
+- srcs = [":filestore_proto"],
+- deps = [":filestore_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "filestore_java_gapic",
+- srcs = [":filestore_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "file_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "file_v1.yaml",
+- test_deps = [
+- ":filestore_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":filestore_java_proto",
+- "//google/cloud/common:common_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "filestore_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.filestore.v1.CloudFilestoreManagerClientHttpJsonTest",
+- "com.google.cloud.filestore.v1.CloudFilestoreManagerClientTest",
+- ],
+- runtime_deps = [":filestore_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-filestore-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":filestore_java_gapic",
+- ":filestore_java_grpc",
+- ":filestore_java_proto",
+- ":filestore_proto",
+- "//google/cloud/common:common_java_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "filestore_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/filestore/v1",
+- protos = [":filestore_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/cloud/common:common_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "filestore_go_gapic",
+- srcs = [":filestore_proto_with_info"],
+- grpc_service_config = "file_grpc_service_config.json",
+- importpath = "cloud.google.com/go/filestore/apiv1;filestore",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "file_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":filestore_go_proto",
+- "//google/cloud/common:common_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "filestore_go_gapic_test",
+- srcs = [":filestore_go_gapic_srcjar_test"],
+- embed = [":filestore_go_gapic"],
+- importpath = "cloud.google.com/go/filestore/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-filestore-v1-go",
+- deps = [
+- ":filestore_go_gapic",
+- ":filestore_go_gapic_srcjar-metadata.srcjar",
+- ":filestore_go_gapic_srcjar-test.srcjar",
+- ":filestore_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "filestore_py_gapic",
+- srcs = [":filestore_proto"],
+- grpc_service_config = "file_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/cloud/common:common_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "filestore_py_gapic_test",
+- srcs = [
+- "filestore_py_gapic_pytest.py",
+- "filestore_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":filestore_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "filestore-v1-py",
+- deps = [
+- ":filestore_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "filestore_php_proto",
+- deps = [":filestore_proto"],
+-)
+-
+-php_grpc_library(
+- name = "filestore_php_grpc",
+- srcs = [":filestore_proto"],
+- deps = [":filestore_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "filestore_php_gapic",
+- srcs = [":filestore_proto_with_info"],
+- grpc_service_config = "file_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "file_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":filestore_php_grpc",
+- ":filestore_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-filestore-v1-php",
+- deps = [
+- ":filestore_php_gapic",
+- ":filestore_php_grpc",
+- ":filestore_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "filestore_nodejs_gapic",
+- package_name = "@google-cloud/filestore",
+- src = ":filestore_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "file_grpc_service_config.json",
+- package = "google.cloud.filestore.v1",
+- rest_numeric_enums = False,
+- service_yaml = "file_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "filestore-v1-nodejs",
+- deps = [
+- ":filestore_nodejs_gapic",
+- ":filestore_proto",
+- "//google/cloud/common:common_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "filestore_ruby_proto",
+- deps = [":filestore_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "filestore_ruby_grpc",
+- srcs = [":filestore_proto"],
+- deps = [":filestore_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "filestore_ruby_gapic",
+- srcs = [":filestore_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=file.googleapis.com",
+- "ruby-cloud-api-shortname=file",
+- "ruby-cloud-gem-name=google-cloud-filestore-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/filestore/",
+- "ruby-cloud-extra-dependencies=google-cloud-common=~> 1.0",
+- ],
+- grpc_service_config = "file_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Filestore instances are fully managed NFS file servers on Google Cloud for use with applications running on Compute Engine virtual machines (VMs) instances or Google Kubernetes Engine clusters.",
+- ruby_cloud_title = "Filestore V1",
+- deps = [
+- ":filestore_ruby_grpc",
+- ":filestore_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-filestore-v1-ruby",
+- deps = [
+- ":filestore_ruby_gapic",
+- ":filestore_ruby_grpc",
+- ":filestore_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "filestore_csharp_proto",
+- deps = [":filestore_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "filestore_csharp_grpc",
+- srcs = [":filestore_proto"],
+- deps = [":filestore_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "filestore_csharp_gapic",
+- srcs = [":filestore_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "file_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "file_v1.yaml",
+- deps = [
+- ":filestore_csharp_grpc",
+- ":filestore_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-filestore-v1-csharp",
+- deps = [
+- ":filestore_csharp_gapic",
+- ":filestore_csharp_grpc",
+- ":filestore_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "filestore_cc_proto",
+- deps = [":filestore_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "filestore_cc_grpc",
+- srcs = [":filestore_proto"],
+- grpc_only = True,
+- deps = [":filestore_cc_proto"],
+-)
+diff -urN a/google/cloud/filestore/v1beta1/BUILD.bazel b/google/cloud/filestore/v1beta1/BUILD.bazel
+--- a/google/cloud/filestore/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/filestore/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,377 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "filestore_proto",
+- srcs = [
+- "cloud_filestore_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/cloud/common:common_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "filestore_proto_with_info",
+- deps = [
+- ":filestore_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/common:common_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "filestore_java_proto",
+- deps = [
+- ":filestore_proto",
+- "//google/cloud/common:common_proto",
+- ],
+-)
+-
+-java_grpc_library(
+- name = "filestore_java_grpc",
+- srcs = [":filestore_proto"],
+- deps = [":filestore_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "filestore_java_gapic",
+- srcs = [":filestore_proto_with_info"],
+- gapic_yaml = "file_gapic.yaml",
+- grpc_service_config = "file_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":filestore_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":filestore_java_proto",
+- "//google/cloud/common:common_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "filestore_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.filestore.v1beta1.CloudFilestoreManagerClientHttpJsonTest",
+- "com.google.cloud.filestore.v1beta1.CloudFilestoreManagerClientTest",
+- ],
+- runtime_deps = [":filestore_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-filestore-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":filestore_java_gapic",
+- ":filestore_java_grpc",
+- ":filestore_java_proto",
+- ":filestore_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "filestore_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/filestore/v1beta1",
+- protos = [":filestore_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/cloud/common:common_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "filestore_go_gapic",
+- srcs = [":filestore_proto_with_info"],
+- grpc_service_config = "file_grpc_service_config.json",
+- importpath = "cloud.google.com/go/filestore/apiv1beta1;filestore",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "file_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":filestore_go_proto",
+- "//google/cloud/common:common_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "filestore_go_gapic_test",
+- srcs = [":filestore_go_gapic_srcjar_test"],
+- embed = [":filestore_go_gapic"],
+- importpath = "cloud.google.com/go/filestore/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-filestore-v1beta1-go",
+- deps = [
+- ":filestore_go_gapic",
+- ":filestore_go_gapic_srcjar-metadata.srcjar",
+- ":filestore_go_gapic_srcjar-test.srcjar",
+- ":filestore_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-#
+-# Commented out: Python generator cannot accept LRO metadata from a different
+-# proto namespace.
+-#
+-# load(
+-# "@com_google_googleapis_imports//:imports.bzl",
+-# "py_gapic_assembly_pkg",
+-# "py_gapic_library",
+-# "py_test",
+-# )
+-
+-# py_gapic_library(
+-# name = "filestore_py_gapic",
+-# srcs = [":filestore_proto_with_info"],
+-# grpc_service_config = "file_grpc_service_config.json",
+-# )
+-
+-# # Open Source Packages
+-# py_gapic_assembly_pkg(
+-# name = "filestore-v1beta1-py",
+-# deps = [
+-# ":filestore_py_gapic",
+-# ],
+-# )
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "filestore_php_proto",
+- deps = [":filestore_proto"],
+-)
+-
+-php_grpc_library(
+- name = "filestore_php_grpc",
+- srcs = [":filestore_proto"],
+- deps = [":filestore_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "filestore_php_gapic",
+- srcs = [":filestore_proto_with_info"],
+- gapic_yaml = "file_gapic.yaml",
+- grpc_service_config = "file_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "file_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":filestore_php_grpc",
+- ":filestore_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-filestore-v1beta1-php",
+- deps = [
+- ":filestore_php_gapic",
+- ":filestore_php_grpc",
+- ":filestore_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "filestore_nodejs_gapic",
+- package_name = "@google-cloud/filestore",
+- src = ":filestore_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "file_grpc_service_config.json",
+- package = "google.cloud.filestore.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "file_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "filestore-v1beta1-nodejs",
+- deps = [
+- ":filestore_nodejs_gapic",
+- ":filestore_proto",
+- "//google/cloud/common:common_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "filestore_ruby_proto",
+- deps = [":filestore_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "filestore_ruby_grpc",
+- srcs = [":filestore_proto"],
+- deps = [":filestore_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "filestore_ruby_gapic",
+- srcs = [":filestore_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-filestore-v1beta1",
+- "ruby-cloud-api-shortname=file",
+- "ruby-cloud-api-id=file.googleapis.com",
+- "ruby-cloud-product-url=https://cloud.google.com/filestore/",
+- "ruby-cloud-extra-dependencies=google-cloud-common=~> 1.0",
+- ],
+- grpc_service_config = "file_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Filestore instances are fully managed NFS file servers on Google Cloud for use with applications running on Compute Engine virtual machines (VMs) instances or Google Kubernetes Engine clusters.",
+- ruby_cloud_title = "Filestore V1beta1",
+- deps = [
+- ":filestore_ruby_grpc",
+- ":filestore_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-filestore-v1beta1-ruby",
+- deps = [
+- ":filestore_ruby_gapic",
+- ":filestore_ruby_grpc",
+- ":filestore_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "filestore_csharp_proto",
+- deps = [":filestore_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "filestore_csharp_grpc",
+- srcs = [":filestore_proto"],
+- deps = [":filestore_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "filestore_csharp_gapic",
+- srcs = [":filestore_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "file_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "file_v1beta1.yaml",
+- deps = [
+- ":filestore_csharp_grpc",
+- ":filestore_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-filestore-v1beta1-csharp",
+- deps = [
+- ":filestore_csharp_gapic",
+- ":filestore_csharp_grpc",
+- ":filestore_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/functions/BUILD.bazel b/google/cloud/functions/BUILD.bazel
+--- a/google/cloud/functions/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/functions/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-functions.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for cloudfunctions.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "cloudfunctions_ruby_wrapper",
+- srcs = ["//google/cloud/functions/v1:functions_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-functions",
+- "ruby-cloud-env-prefix=FUNCTIONS",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/functions",
+- "ruby-cloud-api-id=cloudfunctions.googleapis.com",
+- "ruby-cloud-api-shortname=cloudfunctions",
+- ],
+- ruby_cloud_description = "The Cloud Functions API manages lightweight user-provided functions executed in response to events.",
+- ruby_cloud_title = "Cloud Functions",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-functions-ruby",
+- deps = [
+- ":cloudfunctions_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/functions/v1/BUILD.bazel b/google/cloud/functions/v1/BUILD.bazel
+--- a/google/cloud/functions/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/functions/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,406 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "functions_proto",
+- srcs = [
+- "functions.proto",
+- "operations.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "functions_proto_with_info",
+- deps = [
+- ":functions_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "functions_java_proto",
+- deps = [":functions_proto"],
+-)
+-
+-java_grpc_library(
+- name = "functions_java_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "functions_java_gapic",
+- srcs = [":functions_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v1.yaml",
+- test_deps = [
+- ":functions_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":functions_java_proto",
+- "//google/api:api_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "functions_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.functions.v1.CloudFunctionsServiceClientHttpJsonTest",
+- "com.google.cloud.functions.v1.CloudFunctionsServiceClientTest",
+- ],
+- runtime_deps = [":functions_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-functions-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":functions_java_gapic",
+- ":functions_java_grpc",
+- ":functions_java_proto",
+- ":functions_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "functions_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/functions/v1",
+- protos = [":functions_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "functions_go_gapic",
+- srcs = [":functions_proto_with_info"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- importpath = "cloud.google.com/go/functions/apiv1;functions",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":functions_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "functions_go_gapic_test",
+- srcs = [":functions_go_gapic_srcjar_test"],
+- embed = [":functions_go_gapic"],
+- importpath = "cloud.google.com/go/functions/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-functions-v1-go",
+- deps = [
+- ":functions_go_gapic",
+- ":functions_go_gapic_srcjar-metadata.srcjar",
+- ":functions_go_gapic_srcjar-test.srcjar",
+- ":functions_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "functions_py_gapic",
+- srcs = [":functions_proto"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "functions_py_gapic_test",
+- srcs = [
+- "functions_py_gapic_pytest.py",
+- "functions_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":functions_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "functions-v1-py",
+- deps = [
+- ":functions_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "functions_php_proto",
+- deps = [":functions_proto"],
+-)
+-
+-php_grpc_library(
+- name = "functions_php_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "functions_php_gapic",
+- srcs = [":functions_proto_with_info"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":functions_php_grpc",
+- ":functions_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-functions-v1-php",
+- deps = [
+- ":functions_php_gapic",
+- ":functions_php_grpc",
+- ":functions_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "functions_nodejs_gapic",
+- package_name = "@google-cloud/functions",
+- src = ":functions_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- package = "google.cloud.functions.v1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "functions-v1-nodejs",
+- deps = [
+- ":functions_nodejs_gapic",
+- ":functions_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "functions_ruby_proto",
+- deps = [":functions_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "functions_ruby_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "functions_ruby_gapic",
+- srcs = [":functions_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=cloudfunctions.googleapis.com",
+- "ruby-cloud-api-shortname=cloudfunctions",
+- "ruby-cloud-env-prefix=FUNCTIONS",
+- "ruby-cloud-gem-name=google-cloud-functions-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/functions",
+- ],
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Cloud Functions API manages lightweight user-provided functions executed in response to events.",
+- ruby_cloud_title = "Cloud Functions V1",
+- deps = [
+- ":functions_ruby_grpc",
+- ":functions_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-functions-v1-ruby",
+- deps = [
+- ":functions_ruby_gapic",
+- ":functions_ruby_grpc",
+- ":functions_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "functions_csharp_proto",
+- deps = [":functions_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "functions_csharp_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "functions_csharp_gapic",
+- srcs = [":functions_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v1.yaml",
+- deps = [
+- ":functions_csharp_grpc",
+- ":functions_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-functions-v1-csharp",
+- deps = [
+- ":functions_csharp_gapic",
+- ":functions_csharp_grpc",
+- ":functions_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "functions_cc_proto",
+- deps = [":functions_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "functions_cc_grpc",
+- srcs = [":functions_proto"],
+- grpc_only = True,
+- deps = [":functions_cc_proto"],
+-)
+diff -urN a/google/cloud/functions/v2/BUILD.bazel b/google/cloud/functions/v2/BUILD.bazel
+--- a/google/cloud/functions/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/functions/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,406 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "functions_proto",
+- srcs = [
+- "functions.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "functions_proto_with_info",
+- deps = [
+- ":functions_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "functions_java_proto",
+- deps = [":functions_proto"],
+-)
+-
+-java_grpc_library(
+- name = "functions_java_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "functions_java_gapic",
+- srcs = [":functions_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2.yaml",
+- test_deps = [
+- ":functions_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":functions_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "functions_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.functions.v2.FunctionServiceClientHttpJsonTest",
+- "com.google.cloud.functions.v2.FunctionServiceClientTest",
+- ],
+- runtime_deps = [":functions_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-functions-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":functions_java_gapic",
+- ":functions_java_grpc",
+- ":functions_java_proto",
+- ":functions_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "functions_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/functions/v2",
+- protos = [":functions_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "functions_go_gapic",
+- srcs = [":functions_proto_with_info"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- importpath = "cloud.google.com/go/functions/apiv2;functions",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":functions_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "functions_go_gapic_test",
+- srcs = [":functions_go_gapic_srcjar_test"],
+- embed = [":functions_go_gapic"],
+- importpath = "cloud.google.com/go/functions/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-functions-v2-go",
+- deps = [
+- ":functions_go_gapic",
+- ":functions_go_gapic_srcjar-metadata.srcjar",
+- ":functions_go_gapic_srcjar-test.srcjar",
+- ":functions_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "functions_py_gapic",
+- srcs = [":functions_proto"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "functions_py_gapic_test",
+- srcs = [
+- "functions_py_gapic_pytest.py",
+- "functions_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":functions_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "functions-v2-py",
+- deps = [
+- ":functions_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "functions_php_proto",
+- deps = [":functions_proto"],
+-)
+-
+-php_grpc_library(
+- name = "functions_php_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "functions_php_gapic",
+- srcs = [":functions_proto_with_info"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":functions_php_grpc",
+- ":functions_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-functions-v2-php",
+- deps = [
+- ":functions_php_gapic",
+- ":functions_php_grpc",
+- ":functions_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "functions_nodejs_gapic",
+- package_name = "@google-cloud/functions",
+- src = ":functions_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- package = "google.cloud.functions.v2",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "functions-v2-nodejs",
+- deps = [
+- ":functions_nodejs_gapic",
+- ":functions_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "functions_ruby_proto",
+- deps = [":functions_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "functions_ruby_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "functions_ruby_gapic",
+- srcs = [":functions_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=cloudfunctions.googleapis.com",
+- "ruby-cloud-api-shortname=cloudfunctions",
+- "ruby-cloud-env-prefix=FUNCTIONS",
+- "ruby-cloud-gem-name=google-cloud-functions-v2",
+- "ruby-cloud-product-url=https://cloud.google.com/functions",
+- ],
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Cloud Functions API manages lightweight user-provided functions executed in response to events.",
+- ruby_cloud_title = "Cloud Functions V2",
+- service_yaml = "cloudfunctions_v2.yaml",
+- deps = [
+- ":functions_ruby_grpc",
+- ":functions_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-functions-v2-ruby",
+- deps = [
+- ":functions_ruby_gapic",
+- ":functions_ruby_grpc",
+- ":functions_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "functions_csharp_proto",
+- deps = [":functions_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "functions_csharp_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "functions_csharp_gapic",
+- srcs = [":functions_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2.yaml",
+- deps = [
+- ":functions_csharp_grpc",
+- ":functions_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-functions-v2-csharp",
+- deps = [
+- ":functions_csharp_gapic",
+- ":functions_csharp_grpc",
+- ":functions_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "functions_cc_proto",
+- deps = [":functions_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "functions_cc_grpc",
+- srcs = [":functions_proto"],
+- grpc_only = True,
+- deps = [":functions_cc_proto"],
+-)
+diff -urN a/google/cloud/functions/v2alpha/BUILD.bazel b/google/cloud/functions/v2alpha/BUILD.bazel
+--- a/google/cloud/functions/v2alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/functions/v2alpha/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,346 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "functions_proto",
+- srcs = [
+- "functions.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "functions_proto_with_info",
+- deps = [
+- ":functions_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "functions_java_proto",
+- deps = [":functions_proto"],
+-)
+-
+-java_grpc_library(
+- name = "functions_java_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "functions_java_gapic",
+- srcs = [":functions_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2alpha.yaml",
+- test_deps = [
+- ":functions_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":functions_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "functions_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.functions.v2alpha.FunctionServiceClientHttpJsonTest",
+- "com.google.cloud.functions.v2alpha.FunctionServiceClientTest",
+- ],
+- runtime_deps = [":functions_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-functions-v2alpha-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":functions_java_gapic",
+- ":functions_java_grpc",
+- ":functions_java_proto",
+- ":functions_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "functions_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/functions/v2alpha",
+- protos = [":functions_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "functions_go_gapic",
+- srcs = [":functions_proto_with_info"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- importpath = "cloud.google.com/go/functions/apiv2alpha;functions",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":functions_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "functions_go_gapic_test",
+- srcs = [":functions_go_gapic_srcjar_test"],
+- embed = [":functions_go_gapic"],
+- importpath = "cloud.google.com/go/functions/apiv2alpha",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-functions-v2alpha-go",
+- deps = [
+- ":functions_go_gapic",
+- ":functions_go_gapic_srcjar-metadata.srcjar",
+- ":functions_go_gapic_srcjar-test.srcjar",
+- ":functions_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "functions_py_gapic",
+- srcs = [":functions_proto"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2alpha.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "functions_py_gapic_test",
+- srcs = [
+- "functions_py_gapic_pytest.py",
+- "functions_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":functions_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "functions-v2alpha-py",
+- deps = [
+- ":functions_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "functions_php_proto",
+- deps = [":functions_proto"],
+-)
+-
+-php_grpc_library(
+- name = "functions_php_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "functions_php_gapic",
+- srcs = [":functions_proto_with_info"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":functions_php_grpc",
+- ":functions_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-functions-v2alpha-php",
+- deps = [
+- ":functions_php_gapic",
+- ":functions_php_grpc",
+- ":functions_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "functions_nodejs_gapic",
+- package_name = "@google-cloud/functions",
+- src = ":functions_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- package = "google.cloud.functions.v2alpha",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2alpha.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "functions-v2alpha-nodejs",
+- deps = [
+- ":functions_nodejs_gapic",
+- ":functions_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "functions_ruby_proto",
+- deps = [":functions_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "functions_ruby_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "functions_ruby_gapic",
+- srcs = [":functions_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-functions-v2alpha",
+- ],
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":functions_ruby_grpc",
+- ":functions_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-functions-v2alpha-ruby",
+- deps = [
+- ":functions_ruby_gapic",
+- ":functions_ruby_grpc",
+- ":functions_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "functions_csharp_proto",
+- deps = [":functions_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "functions_csharp_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "functions_csharp_gapic",
+- srcs = [":functions_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2alpha.yaml",
+- deps = [
+- ":functions_csharp_grpc",
+- ":functions_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-functions-v2alpha-csharp",
+- deps = [
+- ":functions_csharp_gapic",
+- ":functions_csharp_grpc",
+- ":functions_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "functions_cc_proto",
+- deps = [":functions_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "functions_cc_grpc",
+- srcs = [":functions_proto"],
+- grpc_only = True,
+- deps = [":functions_cc_proto"],
+-)
+diff -urN a/google/cloud/functions/v2beta/BUILD.bazel b/google/cloud/functions/v2beta/BUILD.bazel
+--- a/google/cloud/functions/v2beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/functions/v2beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,346 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "functions_proto",
+- srcs = [
+- "functions.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "functions_proto_with_info",
+- deps = [
+- ":functions_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "functions_java_proto",
+- deps = [":functions_proto"],
+-)
+-
+-java_grpc_library(
+- name = "functions_java_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "functions_java_gapic",
+- srcs = [":functions_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2beta.yaml",
+- test_deps = [
+- ":functions_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":functions_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "functions_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.functions.v2beta.FunctionServiceClientHttpJsonTest",
+- "com.google.cloud.functions.v2beta.FunctionServiceClientTest",
+- ],
+- runtime_deps = [":functions_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-functions-v2beta-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":functions_java_gapic",
+- ":functions_java_grpc",
+- ":functions_java_proto",
+- ":functions_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "functions_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/functions/v2beta",
+- protos = [":functions_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "functions_go_gapic",
+- srcs = [":functions_proto_with_info"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- importpath = "cloud.google.com/go/functions/apiv2beta;functions",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":functions_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "functions_go_gapic_test",
+- srcs = [":functions_go_gapic_srcjar_test"],
+- embed = [":functions_go_gapic"],
+- importpath = "cloud.google.com/go/functions/apiv2beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-functions-v2beta-go",
+- deps = [
+- ":functions_go_gapic",
+- ":functions_go_gapic_srcjar-metadata.srcjar",
+- ":functions_go_gapic_srcjar-test.srcjar",
+- ":functions_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "functions_py_gapic",
+- srcs = [":functions_proto"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2beta.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "functions_py_gapic_test",
+- srcs = [
+- "functions_py_gapic_pytest.py",
+- "functions_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":functions_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "functions-v2beta-py",
+- deps = [
+- ":functions_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "functions_php_proto",
+- deps = [":functions_proto"],
+-)
+-
+-php_grpc_library(
+- name = "functions_php_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "functions_php_gapic",
+- srcs = [":functions_proto_with_info"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":functions_php_grpc",
+- ":functions_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-functions-v2beta-php",
+- deps = [
+- ":functions_php_gapic",
+- ":functions_php_grpc",
+- ":functions_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "functions_nodejs_gapic",
+- package_name = "@google-cloud/functions",
+- src = ":functions_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "functions_grpc_service_config.json",
+- package = "google.cloud.functions.v2beta",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "functions-v2beta-nodejs",
+- deps = [
+- ":functions_nodejs_gapic",
+- ":functions_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "functions_ruby_proto",
+- deps = [":functions_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "functions_ruby_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "functions_ruby_gapic",
+- srcs = [":functions_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-functions-v2beta",
+- ],
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":functions_ruby_grpc",
+- ":functions_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-functions-v2beta-ruby",
+- deps = [
+- ":functions_ruby_gapic",
+- ":functions_ruby_grpc",
+- ":functions_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "functions_csharp_proto",
+- deps = [":functions_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "functions_csharp_grpc",
+- srcs = [":functions_proto"],
+- deps = [":functions_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "functions_csharp_gapic",
+- srcs = [":functions_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "functions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudfunctions_v2beta.yaml",
+- deps = [
+- ":functions_csharp_grpc",
+- ":functions_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-functions-v2beta-csharp",
+- deps = [
+- ":functions_csharp_gapic",
+- ":functions_csharp_grpc",
+- ":functions_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "functions_cc_proto",
+- deps = [":functions_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "functions_cc_grpc",
+- srcs = [":functions_proto"],
+- grpc_only = True,
+- deps = [":functions_cc_proto"],
+-)
+diff -urN a/google/cloud/gaming/BUILD.bazel b/google/cloud/gaming/BUILD.bazel
+--- a/google/cloud/gaming/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gaming/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-gaming.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for gameservices.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "gameservices_ruby_wrapper",
+- srcs = ["//google/cloud/gaming/v1:gaming_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-gaming",
+- "ruby-cloud-env-prefix=GAMING",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/game-servers",
+- "ruby-cloud-api-id=gameservices.googleapis.com",
+- "ruby-cloud-api-shortname=gameservices",
+- ],
+- ruby_cloud_description = "With Game Servers, studios and publishers can deploy and manage their game server infrastructure hosted on multiple Agones clusters around the world through a single interface.",
+- ruby_cloud_title = "Cloud Gaming",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gaming-ruby",
+- deps = [
+- ":gameservices_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/gaming/v1/BUILD.bazel b/google/cloud/gaming/v1/BUILD.bazel
+--- a/google/cloud/gaming/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gaming/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,405 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "gaming_proto",
+- srcs = [
+- "common.proto",
+- "game_server_clusters.proto",
+- "game_server_clusters_service.proto",
+- "game_server_configs.proto",
+- "game_server_configs_service.proto",
+- "game_server_deployments.proto",
+- "game_server_deployments_service.proto",
+- "realms.proto",
+- "realms_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "gaming_proto_with_info",
+- deps = [
+- ":gaming_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "gaming_java_proto",
+- deps = [":gaming_proto"],
+-)
+-
+-java_grpc_library(
+- name = "gaming_java_grpc",
+- srcs = [":gaming_proto"],
+- deps = [":gaming_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "gaming_java_gapic",
+- srcs = [":gaming_proto_with_info"],
+- grpc_service_config = "gaming_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":gaming_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":gaming_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "gaming_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.gaming.v1.GameServerClustersServiceClientHttpJsonTest",
+- "com.google.cloud.gaming.v1.GameServerClustersServiceClientTest",
+- "com.google.cloud.gaming.v1.GameServerConfigsServiceClientHttpJsonTest",
+- "com.google.cloud.gaming.v1.GameServerConfigsServiceClientTest",
+- "com.google.cloud.gaming.v1.GameServerDeploymentsServiceClientHttpJsonTest",
+- "com.google.cloud.gaming.v1.GameServerDeploymentsServiceClientTest",
+- "com.google.cloud.gaming.v1.RealmsServiceClientHttpJsonTest",
+- "com.google.cloud.gaming.v1.RealmsServiceClientTest",
+- ],
+- runtime_deps = [":gaming_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-gaming-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":gaming_java_gapic",
+- ":gaming_java_grpc",
+- ":gaming_java_proto",
+- ":gaming_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "gaming_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gaming/v1",
+- protos = [":gaming_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "gaming_go_gapic",
+- srcs = [":gaming_proto_with_info"],
+- grpc_service_config = "gaming_grpc_service_config.json",
+- importpath = "cloud.google.com/go/gaming/apiv1;gaming",
+- rest_numeric_enums = False,
+- service_yaml = "gameservices_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gaming_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "gaming_go_gapic_test",
+- srcs = [":gaming_go_gapic_srcjar_test"],
+- embed = [":gaming_go_gapic"],
+- importpath = "cloud.google.com/go/gaming/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-gaming-v1-go",
+- deps = [
+- ":gaming_go_gapic",
+- ":gaming_go_gapic_srcjar-test.srcjar",
+- ":gaming_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "gaming_py_gapic",
+- srcs = [":gaming_proto"],
+- grpc_service_config = "gaming_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-game-servers",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "gaming_py_gapic_test",
+- srcs = [
+- "gaming_py_gapic_pytest.py",
+- "gaming_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":gaming_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "gaming-v1-py",
+- deps = [
+- ":gaming_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "gaming_php_proto",
+- deps = [":gaming_proto"],
+-)
+-
+-php_grpc_library(
+- name = "gaming_php_grpc",
+- srcs = [":gaming_proto"],
+- deps = [":gaming_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "gaming_php_gapic",
+- srcs = [":gaming_proto_with_info"],
+- grpc_service_config = "gaming_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gameservices_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gaming_php_grpc",
+- ":gaming_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-gaming-v1-php",
+- deps = [
+- ":gaming_php_gapic",
+- ":gaming_php_grpc",
+- ":gaming_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "gaming_nodejs_gapic",
+- package_name = "@google-cloud/game-servers",
+- src = ":gaming_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "gaming_grpc_service_config.json",
+- package = "google.cloud.gaming.v1",
+- rest_numeric_enums = False,
+- service_yaml = "gameservices_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "gaming-v1-nodejs",
+- deps = [
+- ":gaming_nodejs_gapic",
+- ":gaming_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "gaming_ruby_proto",
+- deps = [":gaming_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "gaming_ruby_grpc",
+- srcs = [":gaming_proto"],
+- deps = [":gaming_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "gaming_ruby_gapic",
+- srcs = [":gaming_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-gaming-v1",
+- "ruby-cloud-env-prefix=GAMING",
+- "ruby-cloud-product-url=https://cloud.google.com/game-servers",
+- "ruby-cloud-api-id=gameservices.googleapis.com",
+- "ruby-cloud-api-shortname=gameservices",
+- ],
+- grpc_service_config = "gaming_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "With Game Servers, studios and publishers can deploy and manage their game server infrastructure hosted on multiple Agones clusters around the world through a single interface.",
+- ruby_cloud_title = "Cloud Gaming V1",
+- deps = [
+- ":gaming_ruby_grpc",
+- ":gaming_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gaming-v1-ruby",
+- deps = [
+- ":gaming_ruby_gapic",
+- ":gaming_ruby_grpc",
+- ":gaming_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "gaming_csharp_proto",
+- deps = [":gaming_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "gaming_csharp_grpc",
+- srcs = [":gaming_proto"],
+- deps = [":gaming_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "gaming_csharp_gapic",
+- srcs = [":gaming_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "gaming_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gameservices_v1.yaml",
+- deps = [
+- ":gaming_csharp_grpc",
+- ":gaming_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-gaming-v1-csharp",
+- deps = [
+- ":gaming_csharp_gapic",
+- ":gaming_csharp_grpc",
+- ":gaming_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "gaming_cc_proto",
+- deps = [":gaming_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "gaming_cc_grpc",
+- srcs = [":gaming_proto"],
+- grpc_only = True,
+- deps = [":gaming_cc_proto"],
+-)
+diff -urN a/google/cloud/gaming/v1beta/BUILD.bazel b/google/cloud/gaming/v1beta/BUILD.bazel
+--- a/google/cloud/gaming/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gaming/v1beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,370 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "gaming_proto",
+- srcs = [
+- "common.proto",
+- "game_server_clusters.proto",
+- "game_server_clusters_service.proto",
+- "game_server_configs.proto",
+- "game_server_configs_service.proto",
+- "game_server_deployments.proto",
+- "game_server_deployments_service.proto",
+- "realms.proto",
+- "realms_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "gaming_proto_with_info",
+- deps = [
+- ":gaming_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "gaming_java_proto",
+- deps = [":gaming_proto"],
+-)
+-
+-java_grpc_library(
+- name = "gaming_java_grpc",
+- srcs = [":gaming_proto"],
+- deps = [":gaming_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "gaming_java_gapic",
+- srcs = [":gaming_proto_with_info"],
+- grpc_service_config = "gaming_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":gaming_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":gaming_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "gaming_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.gaming.v1beta.GameServerClustersServiceClientHttpJsonTest",
+- "com.google.cloud.gaming.v1beta.GameServerClustersServiceClientTest",
+- "com.google.cloud.gaming.v1beta.GameServerConfigsServiceClientHttpJsonTest",
+- "com.google.cloud.gaming.v1beta.GameServerConfigsServiceClientTest",
+- "com.google.cloud.gaming.v1beta.GameServerDeploymentsServiceClientHttpJsonTest",
+- "com.google.cloud.gaming.v1beta.GameServerDeploymentsServiceClientTest",
+- "com.google.cloud.gaming.v1beta.RealmsServiceClientHttpJsonTest",
+- "com.google.cloud.gaming.v1beta.RealmsServiceClientTest",
+- ],
+- runtime_deps = [":gaming_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-gaming-v1beta-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":gaming_java_gapic",
+- ":gaming_java_grpc",
+- ":gaming_java_proto",
+- ":gaming_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "gaming_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gaming/v1beta",
+- protos = [":gaming_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "gaming_go_gapic",
+- srcs = [":gaming_proto_with_info"],
+- grpc_service_config = "gaming_grpc_service_config.json",
+- importpath = "cloud.google.com/go/gaming/apiv1beta;gaming",
+- rest_numeric_enums = False,
+- service_yaml = "gameservices_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gaming_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "gaming_go_gapic_test",
+- srcs = [":gaming_go_gapic_srcjar_test"],
+- embed = [":gaming_go_gapic"],
+- importpath = "cloud.google.com/go/gaming/apiv1beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-gaming-v1beta-go",
+- deps = [
+- ":gaming_go_gapic",
+- ":gaming_go_gapic_srcjar-test.srcjar",
+- ":gaming_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "gaming_py_gapic",
+- srcs = [":gaming_proto"],
+- grpc_service_config = "gaming_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-game-servers",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "gaming_py_gapic_test",
+- srcs = [
+- "gaming_py_gapic_pytest.py",
+- "gaming_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":gaming_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "gaming-v1beta-py",
+- deps = [
+- ":gaming_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "gaming_php_proto",
+- deps = [":gaming_proto"],
+-)
+-
+-php_grpc_library(
+- name = "gaming_php_grpc",
+- srcs = [":gaming_proto"],
+- deps = [":gaming_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "gaming_php_gapic",
+- srcs = [":gaming_proto_with_info"],
+- grpc_service_config = "gaming_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":gaming_php_grpc",
+- ":gaming_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-gaming-v1beta-php",
+- deps = [
+- ":gaming_php_gapic",
+- ":gaming_php_grpc",
+- ":gaming_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "gaming_nodejs_gapic",
+- package_name = "@google-cloud/game-servers",
+- src = ":gaming_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "gaming_grpc_service_config.json",
+- package = "google.cloud.gaming.v1beta",
+- rest_numeric_enums = False,
+- service_yaml = "gameservices_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "gaming-v1beta-nodejs",
+- deps = [
+- ":gaming_nodejs_gapic",
+- ":gaming_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "gaming_ruby_proto",
+- deps = [":gaming_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "gaming_ruby_grpc",
+- srcs = [":gaming_proto"],
+- deps = [":gaming_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "gaming_ruby_gapic",
+- srcs = [":gaming_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-gaming-v1beta"],
+- rest_numeric_enums = False,
+- deps = [
+- ":gaming_ruby_grpc",
+- ":gaming_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gaming-v1beta-ruby",
+- deps = [
+- ":gaming_ruby_gapic",
+- ":gaming_ruby_grpc",
+- ":gaming_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "gaming_csharp_proto",
+- deps = [":gaming_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "gaming_csharp_grpc",
+- srcs = [":gaming_proto"],
+- deps = [":gaming_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "gaming_csharp_gapic",
+- srcs = [":gaming_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "gaming_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gameservices_v1beta.yaml",
+- deps = [
+- ":gaming_csharp_grpc",
+- ":gaming_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-gaming-v1beta-csharp",
+- deps = [
+- ":gaming_csharp_gapic",
+- ":gaming_csharp_grpc",
+- ":gaming_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/gkebackup/BUILD.bazel b/google/cloud/gkebackup/BUILD.bazel
+--- a/google/cloud/gkebackup/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkebackup/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-gke_backup.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for gkebackup.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "gkebackup_ruby_wrapper",
+- srcs = ["//google/cloud/gkebackup/v1:gkebackup_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=gkebackup.googleapis.com",
+- "ruby-cloud-api-shortname=gkebackup",
+- "ruby-cloud-gem-name=google-cloud-gke_backup",
+- "ruby-cloud-product-url=https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke/",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- ],
+- ruby_cloud_description = "Backup for GKE lets you protect, manage, and restore your containerized applications and data for stateful workloads running on Google Kubernetes Engine clusters.",
+- ruby_cloud_title = "Backup for GKE",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gkebackup-ruby",
+- deps = [
+- ":gkebackup_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/gkebackup/logging/v1/BUILD.bazel b/google/cloud/gkebackup/logging/v1/BUILD.bazel
+--- a/google/cloud/gkebackup/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkebackup/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,184 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "logged_backup.proto",
+- "logged_backup_plan.proto",
+- "logged_common.proto",
+- "logged_restore.proto",
+- "logged_restore_plan.proto",
+- "logging.proto",
+- ],
+- deps = [
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkebackup/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/gkebackup/v1/BUILD.bazel b/google/cloud/gkebackup/v1/BUILD.bazel
+--- a/google/cloud/gkebackup/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkebackup/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,348 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "gkebackup_proto",
+- srcs = [
+- "backup.proto",
+- "backup_plan.proto",
+- "common.proto",
+- "gkebackup.proto",
+- "restore.proto",
+- "restore_plan.proto",
+- "volume.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "gkebackup_proto_with_info",
+- deps = [
+- ":gkebackup_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "gkebackup_java_proto",
+- deps = [":gkebackup_proto"],
+-)
+-
+-java_grpc_library(
+- name = "gkebackup_java_grpc",
+- srcs = [":gkebackup_proto"],
+- deps = [":gkebackup_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "gkebackup_java_gapic",
+- srcs = [":gkebackup_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "gkebackup_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkebackup_v1.yaml",
+- test_deps = [
+- ":gkebackup_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":gkebackup_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "gkebackup_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.gkebackup.v1.BackupForGKEClientHttpJsonTest",
+- "com.google.cloud.gkebackup.v1.BackupForGKEClientTest",
+- ],
+- runtime_deps = [":gkebackup_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-gkebackup-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":gkebackup_java_gapic",
+- ":gkebackup_java_grpc",
+- ":gkebackup_java_proto",
+- ":gkebackup_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "gkebackup_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkebackup/v1",
+- protos = [":gkebackup_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "gkebackup_go_gapic",
+- srcs = [":gkebackup_proto_with_info"],
+- grpc_service_config = "gkebackup_grpc_service_config.json",
+- importpath = "cloud.google.com/go/gkebackup/apiv1;gkebackup",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "gkebackup_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gkebackup_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "gkebackup_go_gapic_test",
+- srcs = [":gkebackup_go_gapic_srcjar_test"],
+- embed = [":gkebackup_go_gapic"],
+- importpath = "cloud.google.com/go/gkebackup/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-gkebackup-v1-go",
+- deps = [
+- ":gkebackup_go_gapic",
+- ":gkebackup_go_gapic_srcjar-metadata.srcjar",
+- ":gkebackup_go_gapic_srcjar-test.srcjar",
+- ":gkebackup_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "gkebackup_py_gapic",
+- srcs = [":gkebackup_proto"],
+- grpc_service_config = "gkebackup_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-gke-backup",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=gke_backup",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+-)
+-
+-py_test(
+- name = "gkebackup_py_gapic_test",
+- srcs = [
+- "gkebackup_py_gapic_pytest.py",
+- "gkebackup_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":gkebackup_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "gkebackup-v1-py",
+- deps = [
+- ":gkebackup_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "gkebackup_php_proto",
+- deps = [":gkebackup_proto"],
+-)
+-
+-php_grpc_library(
+- name = "gkebackup_php_grpc",
+- srcs = [":gkebackup_proto"],
+- deps = [":gkebackup_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "gkebackup_php_gapic",
+- srcs = [":gkebackup_proto_with_info"],
+- grpc_service_config = "gkebackup_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkebackup_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gkebackup_php_grpc",
+- ":gkebackup_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-gkebackup-v1-php",
+- deps = [
+- ":gkebackup_php_gapic",
+- ":gkebackup_php_grpc",
+- ":gkebackup_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "gkebackup_nodejs_gapic",
+- package_name = "@google-cloud/gke-backup",
+- src = ":gkebackup_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "gkebackup_grpc_service_config.json",
+- package = "google.cloud.gkebackup.v1",
+- rest_numeric_enums = False,
+- service_yaml = "gkebackup_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "gkebackup-v1-nodejs",
+- deps = [
+- ":gkebackup_nodejs_gapic",
+- ":gkebackup_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "gkebackup_ruby_proto",
+- deps = [":gkebackup_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "gkebackup_ruby_grpc",
+- srcs = [":gkebackup_proto"],
+- deps = [":gkebackup_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "gkebackup_ruby_gapic",
+- srcs = [":gkebackup_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=gkebackup.googleapis.com",
+- "ruby-cloud-api-shortname=gkebackup",
+- "ruby-cloud-gem-name=google-cloud-gke_backup-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/kubernetes-engine/docs/add-on/backup-for-gke/",
+- ],
+- grpc_service_config = "gkebackup_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Backup for GKE lets you protect, manage, and restore your containerized applications and data for stateful workloads running on Google Kubernetes Engine clusters.",
+- ruby_cloud_title = "Backup for GKE V1",
+- deps = [
+- ":gkebackup_ruby_grpc",
+- ":gkebackup_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gkebackup-v1-ruby",
+- deps = [
+- ":gkebackup_ruby_gapic",
+- ":gkebackup_ruby_grpc",
+- ":gkebackup_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "gkebackup_csharp_proto",
+- deps = [":gkebackup_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "gkebackup_csharp_grpc",
+- srcs = [":gkebackup_proto"],
+- deps = [":gkebackup_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "gkebackup_csharp_gapic",
+- srcs = [":gkebackup_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "gkebackup_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkebackup_v1.yaml",
+- deps = [
+- ":gkebackup_csharp_grpc",
+- ":gkebackup_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-gkebackup-v1-csharp",
+- deps = [
+- ":gkebackup_csharp_gapic",
+- ":gkebackup_csharp_grpc",
+- ":gkebackup_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "gkebackup_cc_proto",
+- deps = [":gkebackup_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "gkebackup_cc_grpc",
+- srcs = [":gkebackup_proto"],
+- grpc_only = True,
+- deps = [":gkebackup_cc_proto"],
+-)
+diff -urN a/google/cloud/gkeconnect/gateway/BUILD.bazel b/google/cloud/gkeconnect/gateway/BUILD.bazel
+--- a/google/cloud/gkeconnect/gateway/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkeconnect/gateway/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-gke_connect-gateway.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for connectgateway.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta1 in this case.
+-ruby_cloud_gapic_library(
+- name = "connectgateway_ruby_wrapper",
+- srcs = ["//google/cloud/gkeconnect/gateway/v1beta1:gateway_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-gke_connect-gateway",
+- "ruby-cloud-env-prefix=GKE_CONNECT_GATEWAY",
+- "ruby-cloud-wrapper-of=v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/anthos/multicluster-management/gateway/",
+- "ruby-cloud-api-id=connectgateway.googleapis.com",
+- "ruby-cloud-api-shortname=connectgateway",
+- ],
+- ruby_cloud_description = "The Connect gateway builds on the power of fleets to let Anthos users connect to and run commands against registered Anthos clusters in a simple, consistent, and secured way, whether the clusters are on Google Cloud, other public clouds, or on premises, and makes it easier to automate DevOps processes across all your clusters.",
+- ruby_cloud_title = "Connect Gateway",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gkeconnect-gateway-ruby",
+- deps = [
+- ":connectgateway_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/gkeconnect/gateway/v1/BUILD.bazel b/google/cloud/gkeconnect/gateway/v1/BUILD.bazel
+--- a/google/cloud/gkeconnect/gateway/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkeconnect/gateway/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,191 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "gateway_proto",
+- srcs = [
+- "gateway.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:httpbody_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "gateway_java_proto",
+- deps = [":gateway_proto"],
+-)
+-
+-java_grpc_library(
+- name = "gateway_java_grpc",
+- srcs = [":gateway_proto"],
+- deps = [":gateway_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "gateway_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkeconnect/gateway/v1",
+- protos = [":gateway_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:httpbody_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "gateway_moved_proto",
+- srcs = [":gateway_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:httpbody_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "gateway_py_proto",
+- deps = [":gateway_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "gateway_py_grpc",
+- srcs = [":gateway_moved_proto"],
+- deps = [":gateway_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "gateway_php_proto",
+- deps = [":gateway_proto"],
+-)
+-
+-php_grpc_library(
+- name = "gateway_php_grpc",
+- srcs = [":gateway_proto"],
+- deps = [":gateway_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "gateway_ruby_proto",
+- deps = [":gateway_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "gateway_ruby_grpc",
+- srcs = [":gateway_proto"],
+- deps = [":gateway_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "gateway_csharp_proto",
+- deps = [":gateway_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "gateway_csharp_grpc",
+- srcs = [":gateway_proto"],
+- deps = [":gateway_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "gateway_cc_proto",
+- deps = [":gateway_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "gateway_cc_grpc",
+- srcs = [":gateway_proto"],
+- grpc_only = True,
+- deps = [":gateway_cc_proto"],
+-)
+diff -urN a/google/cloud/gkeconnect/gateway/v1alpha1/BUILD.bazel b/google/cloud/gkeconnect/gateway/v1alpha1/BUILD.bazel
+--- a/google/cloud/gkeconnect/gateway/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkeconnect/gateway/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,175 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "gateway_proto",
+- srcs = [
+- "gateway.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:httpbody_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "gateway_java_proto",
+- deps = [":gateway_proto"],
+-)
+-
+-java_grpc_library(
+- name = "gateway_java_grpc",
+- srcs = [":gateway_proto"],
+- deps = [":gateway_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "gateway_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkeconnect/gateway/v1alpha1",
+- protos = [":gateway_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:httpbody_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "gateway_moved_proto",
+- srcs = [":gateway_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:httpbody_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "gateway_py_proto",
+- deps = [":gateway_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "gateway_py_grpc",
+- srcs = [":gateway_moved_proto"],
+- deps = [":gateway_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "gateway_php_proto",
+- deps = [":gateway_proto"],
+-)
+-
+-php_grpc_library(
+- name = "gateway_php_grpc",
+- srcs = [":gateway_proto"],
+- deps = [":gateway_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "gateway_ruby_proto",
+- deps = [":gateway_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "gateway_ruby_grpc",
+- srcs = [":gateway_proto"],
+- deps = [":gateway_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "gateway_csharp_proto",
+- deps = [":gateway_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "gateway_csharp_grpc",
+- srcs = [":gateway_proto"],
+- deps = [":gateway_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/gkeconnect/gateway/v1beta1/BUILD.bazel b/google/cloud/gkeconnect/gateway/v1beta1/BUILD.bazel
+--- a/google/cloud/gkeconnect/gateway/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkeconnect/gateway/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,366 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "gateway_proto",
+- srcs = [
+- "gateway.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:httpbody_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "gateway_proto_with_info",
+- deps = [
+- ":gateway_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "gateway_java_proto",
+- deps = [":gateway_proto"],
+-)
+-
+-java_grpc_library(
+- name = "gateway_java_grpc",
+- srcs = [":gateway_proto"],
+- deps = [":gateway_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "gateway_java_gapic",
+- srcs = [":gateway_proto_with_info"],
+- grpc_service_config = "connectgw_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":gateway_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":gateway_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "gateway_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.gkeconnect.gateway.v1beta1.GatewayServiceClientTest",
+- ],
+- runtime_deps = [":gateway_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-gkeconnect-gateway-v1beta1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":gateway_java_gapic",
+- ":gateway_java_grpc",
+- ":gateway_java_proto",
+- ":gateway_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "gateway_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkeconnect/gateway/v1beta1",
+- protos = [":gateway_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:httpbody_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "gateway_go_gapic",
+- srcs = [":gateway_proto_with_info"],
+- grpc_service_config = "connectgw_grpc_service_config.json",
+- importpath = "cloud.google.com/go/gkeconnect/gateway/apiv1beta1;gateway",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "connectgateway_v1beta1.yaml",
+- deps = [
+- ":gateway_go_proto",
+- "//google/api:httpbody_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "gateway_go_gapic_test",
+- srcs = [":gateway_go_gapic_srcjar_test"],
+- embed = [":gateway_go_gapic"],
+- importpath = "cloud.google.com/go/gkeconnect/gateway/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-gkeconnect-gateway-v1beta1-go",
+- deps = [
+- ":gateway_go_gapic",
+- ":gateway_go_gapic_srcjar-metadata.srcjar",
+- ":gateway_go_gapic_srcjar-test.srcjar",
+- ":gateway_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "gateway_py_gapic",
+- srcs = [":gateway_proto"],
+- grpc_service_config = "connectgw_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-gke-connect-gateway"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "gateway_py_gapic_test",
+- srcs = [
+- "gateway_py_gapic_pytest.py",
+- "gateway_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":gateway_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "gkeconnect-gateway-v1beta1-py",
+- deps = [
+- ":gateway_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "gateway_php_proto",
+- deps = [":gateway_proto"],
+-)
+-
+-php_grpc_library(
+- name = "gateway_php_grpc",
+- srcs = [":gateway_proto"],
+- deps = [":gateway_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "gateway_php_gapic",
+- srcs = [":gateway_proto_with_info"],
+- grpc_service_config = "connectgw_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "connectgateway_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gateway_php_grpc",
+- ":gateway_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-gkeconnect-gateway-v1beta1-php",
+- deps = [
+- ":gateway_php_gapic",
+- ":gateway_php_grpc",
+- ":gateway_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "gateway_nodejs_gapic",
+- package_name = "@google-cloud/gke-connect-gateway",
+- src = ":gateway_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "connectgw_grpc_service_config.json",
+- package = "google.cloud.gkeconnect.gateway.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "connectgateway_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "gkeconnect-gateway-v1beta1-nodejs",
+- deps = [
+- ":gateway_nodejs_gapic",
+- ":gateway_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "gateway_ruby_proto",
+- deps = [":gateway_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "gateway_ruby_grpc",
+- srcs = [":gateway_proto"],
+- deps = [":gateway_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "gateway_ruby_gapic",
+- srcs = [":gateway_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-gke_connect-gateway-v1beta1",
+- "ruby-cloud-env-prefix=GKE_CONNECT_GATEWAY",
+- "ruby-cloud-product-url=https://cloud.google.com/anthos/multicluster-management/gateway/",
+- "ruby-cloud-api-id=connectgateway.googleapis.com",
+- "ruby-cloud-api-shortname=connectgateway",
+- ],
+- grpc_service_config = "connectgw_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Connect gateway builds on the power of fleets to let Anthos users connect to and run commands against registered Anthos clusters in a simple, consistent, and secured way, whether the clusters are on Google Cloud, other public clouds, or on premises, and makes it easier to automate DevOps processes across all your clusters.",
+- ruby_cloud_title = "Connect Gateway V1beta1",
+- deps = [
+- ":gateway_ruby_grpc",
+- ":gateway_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gkeconnect-gateway-v1beta1-ruby",
+- deps = [
+- ":gateway_ruby_gapic",
+- ":gateway_ruby_grpc",
+- ":gateway_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "gateway_csharp_proto",
+- deps = [":gateway_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "gateway_csharp_grpc",
+- srcs = [":gateway_proto"],
+- deps = [":gateway_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "gateway_csharp_gapic",
+- srcs = [":gateway_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "connectgw_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "connectgateway_v1beta1.yaml",
+- deps = [
+- ":gateway_csharp_grpc",
+- ":gateway_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-gkeconnect-gateway-v1beta1-csharp",
+- deps = [
+- ":gateway_csharp_gapic",
+- ":gateway_csharp_grpc",
+- ":gateway_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/gkehub/BUILD.bazel b/google/cloud/gkehub/BUILD.bazel
+--- a/google/cloud/gkehub/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-gke_hub.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for gkehub.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "gkehub_ruby_wrapper",
+- srcs = ["//google/cloud/gkehub/v1:gkehub_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-gke_hub",
+- "ruby-cloud-env-prefix=GKE_HUB",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/anthos/clusters/docs",
+- "ruby-cloud-api-id=gkehub.googleapis.com",
+- "ruby-cloud-api-shortname=gkehub",
+- ],
+- ruby_cloud_description = "The GKE Hub API centrally manages features and services on all your Kubernetes clusters running in a variety of environments, including Google cloud, on premises in customer datacenters, or other third party clouds.",
+- ruby_cloud_title = "GKE Hub",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-ruby",
+- deps = [
+- ":gkehub_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/gkehub/v1/BUILD.bazel b/google/cloud/gkehub/v1/BUILD.bazel
+--- a/google/cloud/gkehub/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,416 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "gkehub_proto",
+- srcs = [
+- "feature.proto",
+- "membership.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/cloud/gkehub/v1/configmanagement:configmanagement_proto",
+- "//google/cloud/gkehub/v1/multiclusteringress:multiclusteringress_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "gkehub_proto_with_info",
+- deps = [
+- ":gkehub_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-_JAVA_PROTO_SUBPACKAGE_DEPS = [
+- "//google/cloud/gkehub/v1/multiclusteringress:multiclusteringress_java_proto",
+- "//google/cloud/gkehub/v1/configmanagement:configmanagement_java_proto",
+-]
+-
+-_JAVA_GRPC_SUBPACKAGE_DEPS = [
+- "//google/cloud/gkehub/v1/multiclusteringress:multiclusteringress_java_grpc",
+- "//google/cloud/gkehub/v1/configmanagement:configmanagement_java_grpc",
+-]
+-
+-java_proto_library(
+- name = "gkehub_java_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-java_grpc_library(
+- name = "gkehub_java_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_java_proto"] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-java_gapic_library(
+- name = "gkehub_java_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1.yaml",
+- test_deps = [
+- ":gkehub_java_grpc",
+- ] + _JAVA_GRPC_SUBPACKAGE_DEPS,
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_java_proto",
+- "//google/api:api_java_proto",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-java_gapic_test(
+- name = "gkehub_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.gkehub.v1.GkeHubClientHttpJsonTest",
+- "com.google.cloud.gkehub.v1.GkeHubClientTest",
+- ],
+- runtime_deps = [":gkehub_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-gkehub-v1-java",
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_java_gapic",
+- ":gkehub_java_grpc",
+- ":gkehub_java_proto",
+- ":gkehub_proto",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS + _JAVA_GRPC_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "gkehub_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/v1",
+- protos = [":gkehub_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/cloud/gkehub/v1/configmanagement:configmanagement_go_proto",
+- "//google/cloud/gkehub/v1/multiclusteringress:multiclusteringress_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "gkehub_go_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- grpc_service_config = "v1_grpc_service_config.json",
+- importpath = "cloud.google.com/go/gkehub/apiv1;gkehub",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "gkehub_go_gapic_test",
+- srcs = [":gkehub_go_gapic_srcjar_test"],
+- embed = [":gkehub_go_gapic"],
+- importpath = "cloud.google.com/go/gkehub/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-gkehub-v1-go",
+- deps = [
+- ":gkehub_go_gapic",
+- ":gkehub_go_gapic_srcjar-metadata.srcjar",
+- ":gkehub_go_gapic_srcjar-test.srcjar",
+- ":gkehub_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "gkehub_py_gapic",
+- srcs = [":gkehub_proto"],
+- grpc_service_config = "v1_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-gke-hub"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1376 is fixed
+-#py_test(
+-# name = "gkehub_py_gapic_test",
+-# srcs = [
+-# "gkehub_py_gapic_pytest.py",
+-# "gkehub_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":gkehub_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "gkehub-v1-py",
+- deps = [
+- ":gkehub_py_gapic",
+- "//google/cloud/gkehub/v1/configmanagement:configmanagement_py_gapic",
+- "//google/cloud/gkehub/v1/multiclusteringress:multiclusteringress_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "gkehub_php_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-php_grpc_library(
+- name = "gkehub_php_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "gkehub_php_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- grpc_service_config = "v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_php_grpc",
+- ":gkehub_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-v1-php",
+- deps = [
+- ":gkehub_php_gapic",
+- ":gkehub_php_grpc",
+- ":gkehub_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "gkehub_nodejs_gapic",
+- package_name = "@google-cloud/gke-hub",
+- src = ":gkehub_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "v1_grpc_service_config.json",
+- package = "google.cloud.gkehub.v1",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "gkehub-v1-nodejs",
+- deps = [
+- ":gkehub_nodejs_gapic",
+- ":gkehub_proto",
+- "//google/cloud/gkehub/v1/configmanagement:configmanagement_proto",
+- "//google/cloud/gkehub/v1/multiclusteringress:multiclusteringress_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "gkehub_ruby_proto",
+- deps = [
+- ":gkehub_proto",
+- "//google/cloud/gkehub/v1/configmanagement:configmanagement_proto",
+- "//google/cloud/gkehub/v1/multiclusteringress:multiclusteringress_proto",
+- ],
+-)
+-
+-ruby_grpc_library(
+- name = "gkehub_ruby_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "gkehub_ruby_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=gkehub.googleapis.com",
+- "ruby-cloud-api-shortname=gkehub",
+- "ruby-cloud-env-prefix=GKE_HUB",
+- "ruby-cloud-gem-name=google-cloud-gke_hub-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/anthos/clusters/docs",
+- ],
+- grpc_service_config = "v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The GKE Hub API centrally manages features and services on all your Kubernetes clusters running in a variety of environments, including Google cloud, on premises in customer datacenters, or other third party clouds.",
+- ruby_cloud_title = "GKE Hub V1",
+- deps = [
+- ":gkehub_ruby_grpc",
+- ":gkehub_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-v1-ruby",
+- deps = [
+- ":gkehub_ruby_gapic",
+- ":gkehub_ruby_grpc",
+- ":gkehub_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "gkehub_csharp_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "gkehub_csharp_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "gkehub_csharp_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1.yaml",
+- deps = [
+- ":gkehub_csharp_grpc",
+- ":gkehub_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-v1-csharp",
+- deps = [
+- ":gkehub_csharp_gapic",
+- ":gkehub_csharp_grpc",
+- ":gkehub_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "gkehub_cc_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "gkehub_cc_grpc",
+- srcs = [":gkehub_proto"],
+- grpc_only = True,
+- deps = [":gkehub_cc_proto"],
+-)
+diff -urN a/google/cloud/gkehub/v1/configmanagement/BUILD.bazel b/google/cloud/gkehub/v1/configmanagement/BUILD.bazel
+--- a/google/cloud/gkehub/v1/configmanagement/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/v1/configmanagement/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,163 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "configmanagement_proto",
+- srcs = [
+- "configmanagement.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "configmanagement_java_proto",
+- deps = [":configmanagement_proto"],
+-)
+-
+-java_grpc_library(
+- name = "configmanagement_java_grpc",
+- srcs = [":configmanagement_proto"],
+- deps = [":configmanagement_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "configmanagement_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/configmanagement/v1",
+- protos = [":configmanagement_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "configmanagement_py_gapic",
+- srcs = [":configmanagement_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "configmanagement_php_proto",
+- deps = [":configmanagement_proto"],
+-)
+-
+-php_grpc_library(
+- name = "configmanagement_php_grpc",
+- srcs = [":configmanagement_proto"],
+- deps = [":configmanagement_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "configmanagement_ruby_proto",
+- deps = [":configmanagement_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "configmanagement_ruby_grpc",
+- srcs = [":configmanagement_proto"],
+- deps = [":configmanagement_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "configmanagement_csharp_proto",
+- deps = [":configmanagement_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "configmanagement_csharp_grpc",
+- srcs = [":configmanagement_proto"],
+- deps = [":configmanagement_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "configmanagement_cc_proto",
+- deps = [":configmanagement_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "configmanagement_cc_grpc",
+- srcs = [":configmanagement_proto"],
+- grpc_only = True,
+- deps = [":configmanagement_cc_proto"],
+-)
+diff -urN a/google/cloud/gkehub/v1/multiclusteringress/BUILD.bazel b/google/cloud/gkehub/v1/multiclusteringress/BUILD.bazel
+--- a/google/cloud/gkehub/v1/multiclusteringress/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/v1/multiclusteringress/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,162 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "multiclusteringress_proto",
+- srcs = [
+- "multiclusteringress.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "multiclusteringress_java_proto",
+- deps = [":multiclusteringress_proto"],
+-)
+-
+-java_grpc_library(
+- name = "multiclusteringress_java_grpc",
+- srcs = [":multiclusteringress_proto"],
+- deps = [":multiclusteringress_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "multiclusteringress_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/multiclusteringress/v1",
+- protos = [":multiclusteringress_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "multiclusteringress_py_gapic",
+- srcs = [":multiclusteringress_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "multiclusteringress_php_proto",
+- deps = [":multiclusteringress_proto"],
+-)
+-
+-php_grpc_library(
+- name = "multiclusteringress_php_grpc",
+- srcs = [":multiclusteringress_proto"],
+- deps = [":multiclusteringress_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "multiclusteringress_ruby_proto",
+- deps = [":multiclusteringress_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "multiclusteringress_ruby_grpc",
+- srcs = [":multiclusteringress_proto"],
+- deps = [":multiclusteringress_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "multiclusteringress_csharp_proto",
+- deps = [":multiclusteringress_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "multiclusteringress_csharp_grpc",
+- srcs = [":multiclusteringress_proto"],
+- deps = [":multiclusteringress_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "multiclusteringress_cc_proto",
+- deps = [":multiclusteringress_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "multiclusteringress_cc_grpc",
+- srcs = [":multiclusteringress_proto"],
+- grpc_only = True,
+- deps = [":multiclusteringress_cc_proto"],
+-)
+diff -urN a/google/cloud/gkehub/v1alpha/BUILD.bazel b/google/cloud/gkehub/v1alpha/BUILD.bazel
+--- a/google/cloud/gkehub/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/v1alpha/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,401 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "gkehub_proto",
+- srcs = [
+- "feature.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/cloud/gkehub/v1alpha/cloudauditlogging:cloudauditlogging_proto",
+- "//google/cloud/gkehub/v1alpha/configmanagement:configmanagement_proto",
+- "//google/cloud/gkehub/v1alpha/metering:metering_proto",
+- "//google/cloud/gkehub/v1alpha/multiclusteringress:multiclusteringress_proto",
+- "//google/cloud/gkehub/v1alpha/servicemesh:servicemesh_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "gkehub_proto_with_info",
+- deps = [
+- ":gkehub_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-_JAVA_PROTO_SUBPACKAGE_DEPS = [
+- "//google/cloud/gkehub/v1alpha/multiclusteringress:multiclusteringress_java_proto",
+- "//google/cloud/gkehub/v1alpha/configmanagement:configmanagement_java_proto",
+- "//google/cloud/gkehub/v1alpha/metering:metering_java_proto",
+- "//google/cloud/gkehub/v1alpha/cloudauditlogging:cloudauditlogging_java_proto",
+- "//google/cloud/gkehub/v1alpha/servicemesh:servicemesh_java_proto",
+-]
+-
+-_JAVA_GRPC_SUBPACKAGE_DEPS = [
+- "//google/cloud/gkehub/v1alpha/multiclusteringress:multiclusteringress_java_grpc",
+- "//google/cloud/gkehub/v1alpha/configmanagement:configmanagement_java_grpc",
+- "//google/cloud/gkehub/v1alpha/metering:metering_java_grpc",
+- "//google/cloud/gkehub/v1alpha/cloudauditlogging:cloudauditlogging_java_grpc",
+- "//google/cloud/gkehub/v1alpha/servicemesh:servicemesh_java_grpc",
+-]
+-
+-java_proto_library(
+- name = "gkehub_java_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-java_grpc_library(
+- name = "gkehub_java_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_java_proto"] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-java_gapic_library(
+- name = "gkehub_java_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- grpc_service_config = "v1alpha_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":gkehub_java_grpc",
+- ] + _JAVA_GRPC_SUBPACKAGE_DEPS,
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_java_proto",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-java_gapic_test(
+- name = "gkehub_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.gkehub.v1alpha.GkeHubClientHttpJsonTest",
+- "com.google.cloud.gkehub.v1alpha.GkeHubClientTest",
+- ],
+- runtime_deps = [":gkehub_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-gkehub-v1alpha-java",
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_java_gapic",
+- ":gkehub_java_grpc",
+- ":gkehub_java_proto",
+- ":gkehub_proto",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS + _JAVA_GRPC_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "gkehub_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/v1alpha",
+- protos = [":gkehub_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/cloud/gkehub/v1alpha/cloudauditlogging:cloudauditlogging_go_proto",
+- "//google/cloud/gkehub/v1alpha/configmanagement:configmanagement_go_proto",
+- "//google/cloud/gkehub/v1alpha/metering:metering_go_proto",
+- "//google/cloud/gkehub/v1alpha/multiclusteringress:multiclusteringress_go_proto",
+- "//google/cloud/gkehub/v1alpha/servicemesh:servicemesh_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "gkehub_go_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- grpc_service_config = "v1alpha_grpc_service_config.json",
+- importpath = "cloud.google.com/go/gkehub/apiv1alpha;gkehub",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "gkehub_go_gapic_test",
+- srcs = [":gkehub_go_gapic_srcjar_test"],
+- embed = [":gkehub_go_gapic"],
+- importpath = "cloud.google.com/go/gkehub/apiv1alpha",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-gkehub-v1alpha-go",
+- deps = [
+- ":gkehub_go_gapic",
+- ":gkehub_go_gapic_srcjar-metadata.srcjar",
+- ":gkehub_go_gapic_srcjar-test.srcjar",
+- ":gkehub_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "gkehub_py_gapic",
+- srcs = [":gkehub_proto"],
+- grpc_service_config = "v1alpha_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-gke-hub"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1376 is fixed
+-#py_test(
+-# name = "gkehub_py_gapic_test",
+-# srcs = [
+-# "gkehub_py_gapic_pytest.py",
+-# "gkehub_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":gkehub_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "gkehub-v1alpha-py",
+- deps = [
+- ":gkehub_py_gapic",
+- "//google/cloud/gkehub/v1alpha/cloudauditlogging:cloudauditlogging_py_gapic",
+- "//google/cloud/gkehub/v1alpha/configmanagement:configmanagement_py_gapic",
+- "//google/cloud/gkehub/v1alpha/metering:metering_py_gapic",
+- "//google/cloud/gkehub/v1alpha/multiclusteringress:multiclusteringress_py_gapic",
+- "//google/cloud/gkehub/v1alpha/servicemesh:servicemesh_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "gkehub_php_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-php_grpc_library(
+- name = "gkehub_php_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "gkehub_php_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- grpc_service_config = "v1alpha_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_php_grpc",
+- ":gkehub_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-v1alpha-php",
+- deps = [
+- ":gkehub_php_gapic",
+- ":gkehub_php_grpc",
+- ":gkehub_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "gkehub_nodejs_gapic",
+- package_name = "@google-cloud/gke-hub",
+- src = ":gkehub_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "v1alpha_grpc_service_config.json",
+- package = "google.cloud.gkehub.v1alpha",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "gkehub-v1alpha-nodejs",
+- deps = [
+- ":gkehub_nodejs_gapic",
+- ":gkehub_proto",
+- "//google/cloud/gkehub/v1alpha/cloudauditlogging:cloudauditlogging_proto",
+- "//google/cloud/gkehub/v1alpha/configmanagement:configmanagement_proto",
+- "//google/cloud/gkehub/v1alpha/metering:metering_proto",
+- "//google/cloud/gkehub/v1alpha/multiclusteringress:multiclusteringress_proto",
+- "//google/cloud/gkehub/v1alpha/servicemesh:servicemesh_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "gkehub_ruby_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "gkehub_ruby_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "gkehub_ruby_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-gkehub-v1alpha"],
+- grpc_service_config = "v1alpha_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":gkehub_ruby_grpc",
+- ":gkehub_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-v1alpha-ruby",
+- deps = [
+- ":gkehub_ruby_gapic",
+- ":gkehub_ruby_grpc",
+- ":gkehub_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "gkehub_csharp_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "gkehub_csharp_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "gkehub_csharp_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "v1alpha_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1alpha.yaml",
+- deps = [
+- ":gkehub_csharp_grpc",
+- ":gkehub_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-v1alpha-csharp",
+- deps = [
+- ":gkehub_csharp_gapic",
+- ":gkehub_csharp_grpc",
+- ":gkehub_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/gkehub/v1alpha/cloudauditlogging/BUILD.bazel b/google/cloud/gkehub/v1alpha/cloudauditlogging/BUILD.bazel
+--- a/google/cloud/gkehub/v1alpha/cloudauditlogging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/v1alpha/cloudauditlogging/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,146 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "cloudauditlogging_proto",
+- srcs = [
+- "cloudauditlogging.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "cloudauditlogging_java_proto",
+- deps = [":cloudauditlogging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "cloudauditlogging_java_grpc",
+- srcs = [":cloudauditlogging_proto"],
+- deps = [":cloudauditlogging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "cloudauditlogging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/cloudauditlogging/v1alpha",
+- protos = [":cloudauditlogging_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "cloudauditlogging_py_gapic",
+- srcs = [":cloudauditlogging_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "cloudauditlogging_php_proto",
+- deps = [":cloudauditlogging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "cloudauditlogging_php_grpc",
+- srcs = [":cloudauditlogging_proto"],
+- deps = [":cloudauditlogging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "cloudauditlogging_ruby_proto",
+- deps = [":cloudauditlogging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "cloudauditlogging_ruby_grpc",
+- srcs = [":cloudauditlogging_proto"],
+- deps = [":cloudauditlogging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "cloudauditlogging_csharp_proto",
+- deps = [":cloudauditlogging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "cloudauditlogging_csharp_grpc",
+- srcs = [":cloudauditlogging_proto"],
+- deps = [":cloudauditlogging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/gkehub/v1alpha/configmanagement/BUILD.bazel b/google/cloud/gkehub/v1alpha/configmanagement/BUILD.bazel
+--- a/google/cloud/gkehub/v1alpha/configmanagement/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/v1alpha/configmanagement/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,147 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "configmanagement_proto",
+- srcs = [
+- "configmanagement.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "configmanagement_java_proto",
+- deps = [":configmanagement_proto"],
+-)
+-
+-java_grpc_library(
+- name = "configmanagement_java_grpc",
+- srcs = [":configmanagement_proto"],
+- deps = [":configmanagement_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "configmanagement_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/configmanagement/v1alpha",
+- protos = [":configmanagement_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "configmanagement_py_gapic",
+- srcs = [":configmanagement_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "configmanagement_php_proto",
+- deps = [":configmanagement_proto"],
+-)
+-
+-php_grpc_library(
+- name = "configmanagement_php_grpc",
+- srcs = [":configmanagement_proto"],
+- deps = [":configmanagement_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "configmanagement_ruby_proto",
+- deps = [":configmanagement_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "configmanagement_ruby_grpc",
+- srcs = [":configmanagement_proto"],
+- deps = [":configmanagement_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "configmanagement_csharp_proto",
+- deps = [":configmanagement_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "configmanagement_csharp_grpc",
+- srcs = [":configmanagement_proto"],
+- deps = [":configmanagement_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/gkehub/v1alpha/metering/BUILD.bazel b/google/cloud/gkehub/v1alpha/metering/BUILD.bazel
+--- a/google/cloud/gkehub/v1alpha/metering/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/v1alpha/metering/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,147 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "metering_proto",
+- srcs = [
+- "metering.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "metering_java_proto",
+- deps = [":metering_proto"],
+-)
+-
+-java_grpc_library(
+- name = "metering_java_grpc",
+- srcs = [":metering_proto"],
+- deps = [":metering_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "metering_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/metering/v1alpha",
+- protos = [":metering_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "metering_py_gapic",
+- srcs = [":metering_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "metering_php_proto",
+- deps = [":metering_proto"],
+-)
+-
+-php_grpc_library(
+- name = "metering_php_grpc",
+- srcs = [":metering_proto"],
+- deps = [":metering_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "metering_ruby_proto",
+- deps = [":metering_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "metering_ruby_grpc",
+- srcs = [":metering_proto"],
+- deps = [":metering_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "metering_csharp_proto",
+- deps = [":metering_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "metering_csharp_grpc",
+- srcs = [":metering_proto"],
+- deps = [":metering_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/gkehub/v1alpha/multiclusteringress/BUILD.bazel b/google/cloud/gkehub/v1alpha/multiclusteringress/BUILD.bazel
+--- a/google/cloud/gkehub/v1alpha/multiclusteringress/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/v1alpha/multiclusteringress/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,146 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "multiclusteringress_proto",
+- srcs = [
+- "multiclusteringress.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "multiclusteringress_java_proto",
+- deps = [":multiclusteringress_proto"],
+-)
+-
+-java_grpc_library(
+- name = "multiclusteringress_java_grpc",
+- srcs = [":multiclusteringress_proto"],
+- deps = [":multiclusteringress_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "multiclusteringress_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/multiclusteringress/v1alpha",
+- protos = [":multiclusteringress_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "multiclusteringress_py_gapic",
+- srcs = [":multiclusteringress_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "multiclusteringress_php_proto",
+- deps = [":multiclusteringress_proto"],
+-)
+-
+-php_grpc_library(
+- name = "multiclusteringress_php_grpc",
+- srcs = [":multiclusteringress_proto"],
+- deps = [":multiclusteringress_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "multiclusteringress_ruby_proto",
+- deps = [":multiclusteringress_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "multiclusteringress_ruby_grpc",
+- srcs = [":multiclusteringress_proto"],
+- deps = [":multiclusteringress_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "multiclusteringress_csharp_proto",
+- deps = [":multiclusteringress_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "multiclusteringress_csharp_grpc",
+- srcs = [":multiclusteringress_proto"],
+- deps = [":multiclusteringress_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/gkehub/v1alpha/servicemesh/BUILD.bazel b/google/cloud/gkehub/v1alpha/servicemesh/BUILD.bazel
+--- a/google/cloud/gkehub/v1alpha/servicemesh/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/v1alpha/servicemesh/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,149 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "servicemesh_proto",
+- srcs = [
+- "servicemesh.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:field_behavior_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "servicemesh_java_proto",
+- deps = [":servicemesh_proto"],
+-)
+-
+-java_grpc_library(
+- name = "servicemesh_java_grpc",
+- srcs = [":servicemesh_proto"],
+- deps = [":servicemesh_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "servicemesh_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/servicemesh/v1alpha",
+- protos = [":servicemesh_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "servicemesh_py_gapic",
+- srcs = [":servicemesh_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "servicemesh_php_proto",
+- deps = [":servicemesh_proto"],
+-)
+-
+-php_grpc_library(
+- name = "servicemesh_php_grpc",
+- srcs = [":servicemesh_proto"],
+- deps = [":servicemesh_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "servicemesh_ruby_proto",
+- deps = [":servicemesh_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "servicemesh_ruby_grpc",
+- srcs = [":servicemesh_proto"],
+- deps = [":servicemesh_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "servicemesh_csharp_proto",
+- deps = [":servicemesh_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "servicemesh_csharp_grpc",
+- srcs = [":servicemesh_proto"],
+- deps = [":servicemesh_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/gkehub/v1alpha2/BUILD.bazel b/google/cloud/gkehub/v1alpha2/BUILD.bazel
+--- a/google/cloud/gkehub/v1alpha2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/v1alpha2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,384 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "gkehub_proto",
+- srcs = [
+- "membership.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "gkehub_proto_with_info",
+- deps = [
+- ":gkehub_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "gkehub_java_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-java_grpc_library(
+- name = "gkehub_java_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "gkehub_java_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "membership_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1alpha2.yaml",
+- test_deps = [
+- ":gkehub_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "gkehub_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.gkehub.v1alpha2.GkeHubClientHttpJsonTest",
+- "com.google.cloud.gkehub.v1alpha2.GkeHubClientTest",
+- ],
+- runtime_deps = [":gkehub_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-gkehub-v1alpha2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_java_gapic",
+- ":gkehub_java_grpc",
+- ":gkehub_java_proto",
+- ":gkehub_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "gkehub_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/v1alpha2",
+- protos = [":gkehub_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "gkehub_go_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- grpc_service_config = "membership_grpc_service_config.json",
+- importpath = "cloud.google.com/go/gkehub/apiv1alpha2;gkehub",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1alpha2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "gkehub_go_gapic_test",
+- srcs = [":gkehub_go_gapic_srcjar_test"],
+- embed = [":gkehub_go_gapic"],
+- importpath = "cloud.google.com/go/gkehub/apiv1alpha2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-gkehub-v1alpha2-go",
+- deps = [
+- ":gkehub_go_gapic",
+- ":gkehub_go_gapic_srcjar-metadata.srcjar",
+- ":gkehub_go_gapic_srcjar-test.srcjar",
+- ":gkehub_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "gkehub_py_gapic",
+- srcs = [":gkehub_proto"],
+- grpc_service_config = "membership_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-gke-hub"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "gkehub_py_gapic_test",
+- srcs = [
+- "gkehub_py_gapic_pytest.py",
+- "gkehub_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":gkehub_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "gkehub-v1alpha2-py",
+- deps = [
+- ":gkehub_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "gkehub_php_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-php_grpc_library(
+- name = "gkehub_php_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "gkehub_php_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- grpc_service_config = "membership_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1alpha2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_php_grpc",
+- ":gkehub_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-v1alpha2-php",
+- deps = [
+- ":gkehub_php_gapic",
+- ":gkehub_php_grpc",
+- ":gkehub_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "gkehub_nodejs_gapic",
+- package_name = "@google-cloud/gke-hub",
+- src = ":gkehub_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "membership_grpc_service_config.json",
+- package = "google.cloud.gkehub.v1alpha2",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1alpha2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "gkehub-v1alpha2-nodejs",
+- deps = [
+- ":gkehub_nodejs_gapic",
+- ":gkehub_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "gkehub_ruby_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "gkehub_ruby_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "gkehub_ruby_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-gkehub-v1alpha2"],
+- grpc_service_config = "membership_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":gkehub_ruby_grpc",
+- ":gkehub_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-v1alpha2-ruby",
+- deps = [
+- ":gkehub_ruby_gapic",
+- ":gkehub_ruby_grpc",
+- ":gkehub_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "gkehub_csharp_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "gkehub_csharp_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "gkehub_csharp_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "membership_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1alpha2.yaml",
+- deps = [
+- ":gkehub_csharp_grpc",
+- ":gkehub_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-v1alpha2-csharp",
+- deps = [
+- ":gkehub_csharp_gapic",
+- ":gkehub_csharp_grpc",
+- ":gkehub_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "gkehub_cc_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "gkehub_cc_grpc",
+- srcs = [":gkehub_proto"],
+- grpc_only = True,
+- deps = [":gkehub_cc_proto"],
+-)
+diff -urN a/google/cloud/gkehub/v1beta/BUILD.bazel b/google/cloud/gkehub/v1beta/BUILD.bazel
+--- a/google/cloud/gkehub/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/v1beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,399 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "gkehub_proto",
+- srcs = [
+- "feature.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/cloud/gkehub/v1beta/configmanagement:configmanagement_proto",
+- "//google/cloud/gkehub/v1beta/metering:metering_proto",
+- "//google/cloud/gkehub/v1beta/multiclusteringress:multiclusteringress_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "gkehub_proto_with_info",
+- deps = [
+- ":gkehub_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-_JAVA_PROTO_SUBPACKAGE_DEPS = [
+- "//google/cloud/gkehub/v1beta/multiclusteringress:multiclusteringress_java_proto",
+- "//google/cloud/gkehub/v1beta/configmanagement:configmanagement_java_proto",
+- "//google/cloud/gkehub/v1beta/metering:metering_java_proto",
+-]
+-
+-_JAVA_GRPC_SUBPACKAGE_DEPS = [
+- "//google/cloud/gkehub/v1beta/multiclusteringress:multiclusteringress_java_grpc",
+- "//google/cloud/gkehub/v1beta/configmanagement:configmanagement_java_grpc",
+- "//google/cloud/gkehub/v1beta/metering:metering_java_grpc",
+-]
+-
+-java_proto_library(
+- name = "gkehub_java_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-java_grpc_library(
+- name = "gkehub_java_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_java_proto"] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-java_gapic_library(
+- name = "gkehub_java_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- grpc_service_config = "v1beta_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":gkehub_java_grpc",
+- ] + _JAVA_GRPC_SUBPACKAGE_DEPS,
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_java_proto",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-java_gapic_test(
+- name = "gkehub_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.gkehub.v1beta.GkeHubClientHttpJsonTest",
+- "com.google.cloud.gkehub.v1beta.GkeHubClientTest",
+- ],
+- runtime_deps = [":gkehub_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-gkehub-v1beta-java",
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_java_gapic",
+- ":gkehub_java_grpc",
+- ":gkehub_java_proto",
+- ":gkehub_proto",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS + _JAVA_GRPC_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "gkehub_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/v1beta",
+- protos = [":gkehub_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/cloud/gkehub/v1beta/configmanagement:configmanagement_go_proto",
+- "//google/cloud/gkehub/v1beta/metering:metering_go_proto",
+- "//google/cloud/gkehub/v1beta/multiclusteringress:multiclusteringress_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "gkehub_go_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- grpc_service_config = "v1beta_grpc_service_config.json",
+- importpath = "cloud.google.com/go/gkehub/apiv1beta;gkehub",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "gkehub_go_gapic_test",
+- srcs = [":gkehub_go_gapic_srcjar_test"],
+- embed = [":gkehub_go_gapic"],
+- importpath = "cloud.google.com/go/gkehub/apiv1beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-gkehub-v1beta-go",
+- deps = [
+- ":gkehub_go_gapic",
+- ":gkehub_go_gapic_srcjar-metadata.srcjar",
+- ":gkehub_go_gapic_srcjar-test.srcjar",
+- ":gkehub_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "gkehub_py_gapic",
+- srcs = [":gkehub_proto"],
+- grpc_service_config = "v1beta_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-gke-hub",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1376 is fixed
+-#py_test(
+-# name = "gkehub_py_gapic_test",
+-# srcs = [
+-# "gkehub_py_gapic_pytest.py",
+-# "gkehub_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":gkehub_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "gkehub-v1beta-py",
+- deps = [
+- ":gkehub_py_gapic",
+- "//google/cloud/gkehub/v1beta/configmanagement:configmanagement_py_gapic",
+- "//google/cloud/gkehub/v1beta/metering:metering_py_gapic",
+- "//google/cloud/gkehub/v1beta/multiclusteringress:multiclusteringress_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "gkehub_php_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-php_grpc_library(
+- name = "gkehub_php_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "gkehub_php_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- grpc_service_config = "v1beta_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_php_grpc",
+- ":gkehub_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-v1beta-php",
+- deps = [
+- ":gkehub_php_gapic",
+- ":gkehub_php_grpc",
+- ":gkehub_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "gkehub_nodejs_gapic",
+- package_name = "@google-cloud/gke-hub",
+- src = ":gkehub_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "v1beta_grpc_service_config.json",
+- package = "google.cloud.gkehub.v1beta",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "gkehub-v1beta-nodejs",
+- deps = [
+- ":gkehub_nodejs_gapic",
+- ":gkehub_proto",
+- "//google/cloud/gkehub/v1beta/configmanagement:configmanagement_proto",
+- "//google/cloud/gkehub/v1beta/metering:metering_proto",
+- "//google/cloud/gkehub/v1beta/multiclusteringress:multiclusteringress_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "gkehub_ruby_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "gkehub_ruby_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "gkehub_ruby_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=gkehub.googleapis.com",
+- "ruby-cloud-api-shortname=gkehub",
+- "ruby-cloud-env-prefix=GKE_HUB",
+- "ruby-cloud-gem-name=google-cloud-gke_hub-v1beta",
+- "ruby-cloud-product-url=https://cloud.google.com/anthos/clusters/docs",
+- ],
+- grpc_service_config = "v1beta_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The GKE Hub API centrally manages features and services on all your Kubernetes clusters running in a variety of environments, including Google cloud, on premises in customer datacenters, or other third party clouds.",
+- ruby_cloud_title = "GKE Hub V1beta",
+- deps = [
+- ":gkehub_ruby_grpc",
+- ":gkehub_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-v1beta-ruby",
+- deps = [
+- ":gkehub_ruby_gapic",
+- ":gkehub_ruby_grpc",
+- ":gkehub_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "gkehub_csharp_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "gkehub_csharp_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "gkehub_csharp_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "v1beta_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1beta.yaml",
+- deps = [
+- ":gkehub_csharp_grpc",
+- ":gkehub_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-v1beta-csharp",
+- deps = [
+- ":gkehub_csharp_gapic",
+- ":gkehub_csharp_grpc",
+- ":gkehub_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/gkehub/v1beta/configmanagement/BUILD.bazel b/google/cloud/gkehub/v1beta/configmanagement/BUILD.bazel
+--- a/google/cloud/gkehub/v1beta/configmanagement/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/v1beta/configmanagement/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,147 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "configmanagement_proto",
+- srcs = [
+- "configmanagement.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "configmanagement_java_proto",
+- deps = [":configmanagement_proto"],
+-)
+-
+-java_grpc_library(
+- name = "configmanagement_java_grpc",
+- srcs = [":configmanagement_proto"],
+- deps = [":configmanagement_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "configmanagement_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/configmanagement/v1beta",
+- protos = [":configmanagement_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "configmanagement_py_gapic",
+- srcs = [":configmanagement_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "configmanagement_php_proto",
+- deps = [":configmanagement_proto"],
+-)
+-
+-php_grpc_library(
+- name = "configmanagement_php_grpc",
+- srcs = [":configmanagement_proto"],
+- deps = [":configmanagement_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "configmanagement_ruby_proto",
+- deps = [":configmanagement_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "configmanagement_ruby_grpc",
+- srcs = [":configmanagement_proto"],
+- deps = [":configmanagement_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "configmanagement_csharp_proto",
+- deps = [":configmanagement_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "configmanagement_csharp_grpc",
+- srcs = [":configmanagement_proto"],
+- deps = [":configmanagement_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/gkehub/v1beta/metering/BUILD.bazel b/google/cloud/gkehub/v1beta/metering/BUILD.bazel
+--- a/google/cloud/gkehub/v1beta/metering/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/v1beta/metering/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,147 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "metering_proto",
+- srcs = [
+- "metering.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "metering_java_proto",
+- deps = [":metering_proto"],
+-)
+-
+-java_grpc_library(
+- name = "metering_java_grpc",
+- srcs = [":metering_proto"],
+- deps = [":metering_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "metering_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/metering/v1beta",
+- protos = [":metering_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "metering_py_gapic",
+- srcs = [":metering_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "metering_php_proto",
+- deps = [":metering_proto"],
+-)
+-
+-php_grpc_library(
+- name = "metering_php_grpc",
+- srcs = [":metering_proto"],
+- deps = [":metering_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "metering_ruby_proto",
+- deps = [":metering_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "metering_ruby_grpc",
+- srcs = [":metering_proto"],
+- deps = [":metering_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "metering_csharp_proto",
+- deps = [":metering_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "metering_csharp_grpc",
+- srcs = [":metering_proto"],
+- deps = [":metering_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/gkehub/v1beta/multiclusteringress/BUILD.bazel b/google/cloud/gkehub/v1beta/multiclusteringress/BUILD.bazel
+--- a/google/cloud/gkehub/v1beta/multiclusteringress/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/v1beta/multiclusteringress/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,146 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "multiclusteringress_proto",
+- srcs = [
+- "multiclusteringress.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "multiclusteringress_java_proto",
+- deps = [":multiclusteringress_proto"],
+-)
+-
+-java_grpc_library(
+- name = "multiclusteringress_java_grpc",
+- srcs = [":multiclusteringress_proto"],
+- deps = [":multiclusteringress_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "multiclusteringress_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/multiclusteringress/v1beta",
+- protos = [":multiclusteringress_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "multiclusteringress_py_gapic",
+- srcs = [":multiclusteringress_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "multiclusteringress_php_proto",
+- deps = [":multiclusteringress_proto"],
+-)
+-
+-php_grpc_library(
+- name = "multiclusteringress_php_grpc",
+- srcs = [":multiclusteringress_proto"],
+- deps = [":multiclusteringress_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "multiclusteringress_ruby_proto",
+- deps = [":multiclusteringress_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "multiclusteringress_ruby_grpc",
+- srcs = [":multiclusteringress_proto"],
+- deps = [":multiclusteringress_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "multiclusteringress_csharp_proto",
+- deps = [":multiclusteringress_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "multiclusteringress_csharp_grpc",
+- srcs = [":multiclusteringress_proto"],
+- deps = [":multiclusteringress_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/gkehub/v1beta1/BUILD.bazel b/google/cloud/gkehub/v1beta1/BUILD.bazel
+--- a/google/cloud/gkehub/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkehub/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,411 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "gkehub_proto",
+- srcs = [
+- "membership.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "gkehub_proto_with_info",
+- deps = [
+- ":gkehub_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "gkehub_java_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-java_grpc_library(
+- name = "gkehub_java_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "gkehub_java_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- gapic_yaml = "memberships_gapic.yaml",
+- grpc_service_config = "membership_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1beta1.yaml",
+- test_deps = [
+- ":gkehub_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_grpc",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "gkehub_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClientHttpJsonTest",
+- "com.google.cloud.gkehub.v1beta1.GkeHubMembershipServiceClientTest",
+- ],
+- runtime_deps = [":gkehub_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-gkehub-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_java_gapic",
+- ":gkehub_java_grpc",
+- ":gkehub_java_proto",
+- ":gkehub_proto",
+- "//google/cloud/location:location_java_grpc",
+- "//google/cloud/location:location_java_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "gkehub_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/v1beta1",
+- protos = [":gkehub_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "gkehub_go_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- grpc_service_config = "membership_grpc_service_config.json",
+- importpath = "cloud.google.com/go/gkehub/apiv1beta1;gkehub",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "gkehub_go_gapic_test",
+- srcs = [":gkehub_go_gapic_srcjar_test"],
+- embed = [":gkehub_go_gapic"],
+- importpath = "cloud.google.com/go/gkehub/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-gkehub-v1beta1-go",
+- deps = [
+- ":gkehub_go_gapic",
+- ":gkehub_go_gapic_srcjar-metadata.srcjar",
+- ":gkehub_go_gapic_srcjar-test.srcjar",
+- ":gkehub_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "gkehub_py_gapic",
+- srcs = [":gkehub_proto"],
+- grpc_service_config = "membership_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-gke-hub"],
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1beta1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "gkehub_py_gapic_test",
+- srcs = [
+- "gkehub_py_gapic_pytest.py",
+- "gkehub_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":gkehub_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "gkehub-v1beta1-py",
+- deps = [
+- ":gkehub_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "gkehub_php_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-php_grpc_library(
+- name = "gkehub_php_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "gkehub_php_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- grpc_service_config = "membership_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gkehub_php_grpc",
+- ":gkehub_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-v1beta1-php",
+- deps = [
+- ":gkehub_php_gapic",
+- ":gkehub_php_grpc",
+- ":gkehub_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "gkehub_nodejs_gapic",
+- package_name = "@google-cloud/gke-hub",
+- src = ":gkehub_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "membership_grpc_service_config.json",
+- package = "google.cloud.gkehub.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "gkehub-v1beta1-nodejs",
+- deps = [
+- ":gkehub_nodejs_gapic",
+- ":gkehub_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "gkehub_ruby_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "gkehub_ruby_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "gkehub_ruby_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=gkehub.googleapis.com",
+- "ruby-cloud-api-shortname=gkehub",
+- "ruby-cloud-env-prefix=GKE_HUB",
+- "ruby-cloud-gem-name=google-cloud-gke_hub-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/anthos/clusters/docs",
+- ],
+- grpc_service_config = "membership_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The GKE Hub API centrally manages features and services on all your Kubernetes clusters running in a variety of environments, including Google cloud, on premises in customer datacenters, or other third party clouds.",
+- ruby_cloud_title = "GKE Hub V1beta1",
+- service_yaml = "gkehub_v1beta1.yaml",
+- deps = [
+- ":gkehub_ruby_grpc",
+- ":gkehub_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-v1beta1-ruby",
+- deps = [
+- ":gkehub_ruby_gapic",
+- ":gkehub_ruby_grpc",
+- ":gkehub_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "gkehub_csharp_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "gkehub_csharp_grpc",
+- srcs = [":gkehub_proto"],
+- deps = [":gkehub_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "gkehub_csharp_gapic",
+- srcs = [":gkehub_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "membership_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkehub_v1beta1.yaml",
+- deps = [
+- ":gkehub_csharp_grpc",
+- ":gkehub_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-gkehub-v1beta1-csharp",
+- deps = [
+- ":gkehub_csharp_gapic",
+- ":gkehub_csharp_grpc",
+- ":gkehub_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "gkehub_cc_proto",
+- deps = [":gkehub_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "gkehub_cc_grpc",
+- srcs = [":gkehub_proto"],
+- grpc_only = True,
+- deps = [":gkehub_cc_proto"],
+-)
+diff -urN a/google/cloud/gkemulticloud/BUILD.bazel b/google/cloud/gkemulticloud/BUILD.bazel
+--- a/google/cloud/gkemulticloud/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkemulticloud/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-gke_multi_cloud.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for gkemulticloud.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "gkemulticloud_ruby_wrapper",
+- srcs = ["//google/cloud/gkemulticloud/v1:gkemulticloud_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=gkemulticloud.googleapis.com",
+- "ruby-cloud-api-shortname=gkemulticloud",
+- "ruby-cloud-gem-name=google-cloud-gke_multi_cloud",
+- "ruby-cloud-product-url=https://cloud.google.com/anthos/clusters/docs/multi-cloud",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- ],
+- ruby_cloud_description = "Anthos Multi-Cloud provides a way to manage Kubernetes clusters that run on AWS and Azure infrastructure using the Anthos Multi-Cloud API. Combined with Connect, you can manage Kubernetes clusters on Google Cloud, AWS, and Azure from the Google Cloud Console.",
+- ruby_cloud_title = "Anthos Multi-Cloud",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gkemulticloud-ruby",
+- deps = [
+- ":gkemulticloud_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/gkemulticloud/v1/BUILD.bazel b/google/cloud/gkemulticloud/v1/BUILD.bazel
+--- a/google/cloud/gkemulticloud/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gkemulticloud/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,402 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "gkemulticloud_proto",
+- srcs = [
+- "aws_resources.proto",
+- "aws_service.proto",
+- "azure_resources.proto",
+- "azure_service.proto",
+- "common_resources.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "gkemulticloud_proto_with_info",
+- deps = [
+- ":gkemulticloud_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "gkemulticloud_java_proto",
+- deps = [":gkemulticloud_proto"],
+-)
+-
+-java_grpc_library(
+- name = "gkemulticloud_java_grpc",
+- srcs = [":gkemulticloud_proto"],
+- deps = [":gkemulticloud_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "gkemulticloud_java_gapic",
+- srcs = [":gkemulticloud_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "gkemulticloud_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkemulticloud_v1.yaml",
+- test_deps = [
+- ":gkemulticloud_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":gkemulticloud_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "gkemulticloud_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.gkemulticloud.v1.AwsClustersClientHttpJsonTest",
+- "com.google.cloud.gkemulticloud.v1.AwsClustersClientTest",
+- "com.google.cloud.gkemulticloud.v1.AzureClustersClientHttpJsonTest",
+- "com.google.cloud.gkemulticloud.v1.AzureClustersClientTest",
+- ],
+- runtime_deps = [":gkemulticloud_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-gkemulticloud-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":gkemulticloud_java_gapic",
+- ":gkemulticloud_java_grpc",
+- ":gkemulticloud_java_proto",
+- ":gkemulticloud_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "gkemulticloud_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gkemulticloud/v1",
+- protos = [":gkemulticloud_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "gkemulticloud_go_gapic",
+- srcs = [":gkemulticloud_proto_with_info"],
+- grpc_service_config = "gkemulticloud_grpc_service_config.json",
+- importpath = "cloud.google.com/go/gkemulticloud/apiv1;gkemulticloud",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "gkemulticloud_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gkemulticloud_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "gkemulticloud_go_gapic_test",
+- srcs = [":gkemulticloud_go_gapic_srcjar_test"],
+- embed = [":gkemulticloud_go_gapic"],
+- importpath = "cloud.google.com/go/gkemulticloud/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-gkemulticloud-v1-go",
+- deps = [
+- ":gkemulticloud_go_gapic",
+- ":gkemulticloud_go_gapic_srcjar-metadata.srcjar",
+- ":gkemulticloud_go_gapic_srcjar-test.srcjar",
+- ":gkemulticloud_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "gkemulticloud_py_gapic",
+- srcs = [":gkemulticloud_proto"],
+- grpc_service_config = "gkemulticloud_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-gke-multicloud",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=gke_multicloud",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "gkemulticloud_v1.yaml",
+- transport = "grpc+rest",
+-)
+-
+-py_test(
+- name = "gkemulticloud_py_gapic_test",
+- srcs = [
+- "gkemulticloud_py_gapic_pytest.py",
+- "gkemulticloud_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":gkemulticloud_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "gkemulticloud-v1-py",
+- deps = [
+- ":gkemulticloud_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "gkemulticloud_php_proto",
+- deps = [":gkemulticloud_proto"],
+-)
+-
+-php_grpc_library(
+- name = "gkemulticloud_php_grpc",
+- srcs = [":gkemulticloud_proto"],
+- deps = [":gkemulticloud_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "gkemulticloud_php_gapic",
+- srcs = [":gkemulticloud_proto_with_info"],
+- grpc_service_config = "gkemulticloud_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkemulticloud_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gkemulticloud_php_grpc",
+- ":gkemulticloud_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-gkemulticloud-v1-php",
+- deps = [
+- ":gkemulticloud_php_gapic",
+- ":gkemulticloud_php_grpc",
+- ":gkemulticloud_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "gkemulticloud_nodejs_gapic",
+- package_name = "@google-cloud/gkemulticloud",
+- src = ":gkemulticloud_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "gkemulticloud_grpc_service_config.json",
+- package = "google.cloud.gkemulticloud.v1",
+- rest_numeric_enums = False,
+- service_yaml = "gkemulticloud_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "gkemulticloud-v1-nodejs",
+- deps = [
+- ":gkemulticloud_nodejs_gapic",
+- ":gkemulticloud_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "gkemulticloud_ruby_proto",
+- deps = [":gkemulticloud_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "gkemulticloud_ruby_grpc",
+- srcs = [":gkemulticloud_proto"],
+- deps = [":gkemulticloud_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "gkemulticloud_ruby_gapic",
+- srcs = [":gkemulticloud_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=gkemulticloud.googleapis.com",
+- "ruby-cloud-api-shortname=gkemulticloud",
+- "ruby-cloud-gem-name=google-cloud-gke_multi_cloud-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/anthos/clusters/docs/multi-cloud",
+- ],
+- grpc_service_config = "gkemulticloud_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Anthos Multi-Cloud provides a way to manage Kubernetes clusters that run on AWS and Azure infrastructure using the Anthos Multi-Cloud API. Combined with Connect, you can manage Kubernetes clusters on Google Cloud, AWS, and Azure from the Google Cloud Console.",
+- ruby_cloud_title = "Anthos Multi-Cloud V1",
+- deps = [
+- ":gkemulticloud_ruby_grpc",
+- ":gkemulticloud_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gkemulticloud-v1-ruby",
+- deps = [
+- ":gkemulticloud_ruby_gapic",
+- ":gkemulticloud_ruby_grpc",
+- ":gkemulticloud_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "gkemulticloud_csharp_proto",
+- deps = [":gkemulticloud_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "gkemulticloud_csharp_grpc",
+- srcs = [":gkemulticloud_proto"],
+- deps = [":gkemulticloud_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "gkemulticloud_csharp_gapic",
+- srcs = [":gkemulticloud_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "gkemulticloud_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gkemulticloud_v1.yaml",
+- deps = [
+- ":gkemulticloud_csharp_grpc",
+- ":gkemulticloud_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-gkemulticloud-v1-csharp",
+- deps = [
+- ":gkemulticloud_csharp_gapic",
+- ":gkemulticloud_csharp_grpc",
+- ":gkemulticloud_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "gkemulticloud_cc_proto",
+- deps = [":gkemulticloud_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "gkemulticloud_cc_grpc",
+- srcs = [":gkemulticloud_proto"],
+- grpc_only = True,
+- deps = [":gkemulticloud_cc_proto"],
+-)
+diff -urN a/google/cloud/gsuiteaddons/logging/v1/BUILD.bazel b/google/cloud/gsuiteaddons/logging/v1/BUILD.bazel
+--- a/google/cloud/gsuiteaddons/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gsuiteaddons/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,176 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "g_suite_add_ons_log_entry.proto",
+- ],
+- deps = [
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/gsuiteaddons/v1/BUILD.bazel b/google/cloud/gsuiteaddons/v1/BUILD.bazel
+--- a/google/cloud/gsuiteaddons/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/gsuiteaddons/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,370 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "gsuiteaddons_proto",
+- srcs = [
+- "gsuiteaddons.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/apps/script/type:type_proto",
+- "//google/apps/script/type/calendar:calendar_proto",
+- "//google/apps/script/type/docs:docs_proto",
+- "//google/apps/script/type/drive:drive_proto",
+- "//google/apps/script/type/gmail:gmail_proto",
+- "//google/apps/script/type/sheets:sheets_proto",
+- "//google/apps/script/type/slides:slides_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "gsuiteaddons_proto_with_info",
+- deps = [
+- ":gsuiteaddons_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "gsuiteaddons_java_proto",
+- deps = [":gsuiteaddons_proto"],
+-)
+-
+-java_grpc_library(
+- name = "gsuiteaddons_java_grpc",
+- srcs = [":gsuiteaddons_proto"],
+- deps = [":gsuiteaddons_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "gsuiteaddons_java_gapic",
+- srcs = [":gsuiteaddons_proto_with_info"],
+- grpc_service_config = "gsuiteaddons_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":gsuiteaddons_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":gsuiteaddons_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "gsuiteaddons_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.gsuiteaddons.v1.GSuiteAddOnsClientHttpJsonTest",
+- "com.google.cloud.gsuiteaddons.v1.GSuiteAddOnsClientTest",
+- ],
+- runtime_deps = [":gsuiteaddons_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-gsuiteaddons-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":gsuiteaddons_java_gapic",
+- ":gsuiteaddons_java_grpc",
+- ":gsuiteaddons_java_proto",
+- ":gsuiteaddons_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "gsuiteaddons_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1",
+- protos = [":gsuiteaddons_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/apps/script/type:type_go_proto",
+- "//google/apps/script/type/calendar:calendar_go_proto",
+- "//google/apps/script/type/docs:docs_go_proto",
+- "//google/apps/script/type/drive:drive_go_proto",
+- "//google/apps/script/type/gmail:gmail_go_proto",
+- "//google/apps/script/type/sheets:sheets_go_proto",
+- "//google/apps/script/type/slides:slides_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "gsuiteaddons_go_gapic",
+- srcs = [":gsuiteaddons_proto_with_info"],
+- grpc_service_config = "gsuiteaddons_grpc_service_config.json",
+- importpath = "cloud.google.com/go/gsuiteaddons/apiv1;gsuiteaddons",
+- rest_numeric_enums = False,
+- service_yaml = "gsuiteaddons_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":gsuiteaddons_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "gsuiteaddons_go_gapic_test",
+- srcs = [":gsuiteaddons_go_gapic_srcjar_test"],
+- embed = [":gsuiteaddons_go_gapic"],
+- importpath = "cloud.google.com/go/gsuiteaddons/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-gsuiteaddons-v1-go",
+- deps = [
+- ":gsuiteaddons_go_gapic",
+- ":gsuiteaddons_go_gapic_srcjar-test.srcjar",
+- ":gsuiteaddons_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-py_gapic_library(
+- name = "gsuiteaddons_py_gapic",
+- srcs = [":gsuiteaddons_proto"],
+- grpc_service_config = "gsuiteaddons_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/apps/script/type:type_py_proto",
+- "//google/apps/script/type/calendar:calendar_py_proto",
+- "//google/apps/script/type/docs:docs_py_proto",
+- "//google/apps/script/type/drive:drive_py_proto",
+- "//google/apps/script/type/gmail:gmail_py_proto",
+- "//google/apps/script/type/sheets:sheets_py_proto",
+- "//google/apps/script/type/slides:slides_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "gsuiteaddons_py_gapic_test",
+- srcs = [
+- "gsuiteaddons_py_gapic_pytest.py",
+- "gsuiteaddons_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":gsuiteaddons_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "gsuiteaddons-v1-py",
+- deps = [
+- ":gsuiteaddons_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "gsuiteaddons_php_proto",
+- deps = [":gsuiteaddons_proto"],
+-)
+-
+-php_grpc_library(
+- name = "gsuiteaddons_php_grpc",
+- srcs = [":gsuiteaddons_proto"],
+- deps = [":gsuiteaddons_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "gsuiteaddons_php_gapic",
+- srcs = [":gsuiteaddons_proto_with_info"],
+- grpc_service_config = "gsuiteaddons_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":gsuiteaddons_php_grpc",
+- ":gsuiteaddons_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-gsuiteaddons-v1-php",
+- deps = [
+- ":gsuiteaddons_php_gapic",
+- ":gsuiteaddons_php_grpc",
+- ":gsuiteaddons_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "gsuiteaddons_nodejs_gapic",
+- package_name = "@google-cloud/gsuiteaddons",
+- src = ":gsuiteaddons_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "gsuiteaddons_grpc_service_config.json",
+- package = "google.cloud.gsuiteaddons.v1",
+- rest_numeric_enums = False,
+- service_yaml = "gsuiteaddons_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "gsuiteaddons-v1-nodejs",
+- deps = [
+- ":gsuiteaddons_nodejs_gapic",
+- ":gsuiteaddons_proto",
+- "//google/apps/script/type:type_proto",
+- "//google/apps/script/type/calendar:calendar_proto",
+- "//google/apps/script/type/docs:docs_proto",
+- "//google/apps/script/type/drive:drive_proto",
+- "//google/apps/script/type/gmail:gmail_proto",
+- "//google/apps/script/type/sheets:sheets_proto",
+- "//google/apps/script/type/slides:slides_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "gsuiteaddons_ruby_proto",
+- deps = [":gsuiteaddons_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "gsuiteaddons_ruby_grpc",
+- srcs = [":gsuiteaddons_proto"],
+- deps = [":gsuiteaddons_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "gsuiteaddons_ruby_gapic",
+- srcs = [":gsuiteaddons_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-gsuite_add_ons-v1",
+- "ruby-cloud-gem-namespace=Google::Cloud::GSuiteAddOns::V1",
+- "ruby-cloud-env-prefix=GSUITE_ADD_ONS",
+- "ruby-cloud-product-url=https://developers.google.com/workspace/add-ons/",
+- "ruby-cloud-api-id=gsuiteaddons.googleapis.com",
+- "ruby-cloud-api-shortname=gsuiteaddons",
+- "ruby-cloud-namespace-override=GsuiteAddOns=GSuiteAddOns",
+- "ruby-cloud-path-override=g_suite_add_ons=gsuite_add_ons",
+- ],
+- grpc_service_config = "gsuiteaddons_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Add-ons are customized applications that integrate with Google Workspace productivity applications.",
+- ruby_cloud_title = "Google Workspace Add-ons V1",
+- deps = [
+- ":gsuiteaddons_ruby_grpc",
+- ":gsuiteaddons_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-gsuiteaddons-v1-ruby",
+- deps = [
+- ":gsuiteaddons_ruby_gapic",
+- ":gsuiteaddons_ruby_grpc",
+- ":gsuiteaddons_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "gsuiteaddons_csharp_proto",
+- deps = [":gsuiteaddons_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "gsuiteaddons_csharp_grpc",
+- srcs = [":gsuiteaddons_proto"],
+- deps = [":gsuiteaddons_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "gsuiteaddons_csharp_gapic",
+- srcs = [":gsuiteaddons_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "gsuiteaddons_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "gsuiteaddons_v1.yaml",
+- deps = [
+- ":gsuiteaddons_csharp_grpc",
+- ":gsuiteaddons_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-gsuiteaddons-v1-csharp",
+- deps = [
+- ":gsuiteaddons_csharp_gapic",
+- ":gsuiteaddons_csharp_grpc",
+- ":gsuiteaddons_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "gsuiteaddons_cc_proto",
+- deps = [":gsuiteaddons_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "gsuiteaddons_cc_grpc",
+- srcs = [":gsuiteaddons_proto"],
+- grpc_only = True,
+- deps = [":gsuiteaddons_cc_proto"],
+-)
+diff -urN a/google/cloud/healthcare/logging/BUILD.bazel b/google/cloud/healthcare/logging/BUILD.bazel
+--- a/google/cloud/healthcare/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/healthcare/logging/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,182 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "annotation.proto",
+- "consent.proto",
+- "deid.proto",
+- "dicom.proto",
+- "fhir.proto",
+- "hl7v2.proto",
+- ],
+- deps = [
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/healthcare/logging",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/iap/BUILD.bazel b/google/cloud/iap/BUILD.bazel
+--- a/google/cloud/iap/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/iap/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-iap.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for iap.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "iap_ruby_wrapper",
+- srcs = ["//google/cloud/iap/v1:iap_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-iap",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-env-prefix=IAP",
+- "ruby-cloud-product-url=https://cloud.google.com/iap/",
+- "ruby-cloud-api-id=iap.googleapis.com",
+- "ruby-cloud-api-shortname=iap",
+- ],
+- ruby_cloud_description = "IAP lets you establish a central authorization layer for applications accessed by HTTPS, so you can use an application-level access control model instead of relying on network-level firewalls.",
+- ruby_cloud_title = "Identity-Aware Proxy",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-iap-ruby",
+- deps = [
+- ":iap_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/iap/v1/BUILD.bazel b/google/cloud/iap/v1/BUILD.bazel
+--- a/google/cloud/iap/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/iap/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,400 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "iap_proto",
+- srcs = [
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "iap_proto_with_info",
+- deps = [
+- ":iap_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "iap_java_proto",
+- deps = [":iap_proto"],
+-)
+-
+-java_grpc_library(
+- name = "iap_java_grpc",
+- srcs = [":iap_proto"],
+- deps = [":iap_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "iap_java_gapic",
+- srcs = [":iap_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "iap_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iap_v1.yaml",
+- test_deps = [
+- ":iap_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":iap_java_proto",
+- "//google/api:api_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "iap_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.iap.v1.IdentityAwareProxyAdminServiceClientHttpJsonTest",
+- "com.google.cloud.iap.v1.IdentityAwareProxyAdminServiceClientTest",
+- "com.google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClientHttpJsonTest",
+- "com.google.cloud.iap.v1.IdentityAwareProxyOAuthServiceClientTest",
+- ],
+- runtime_deps = [":iap_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-iap-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":iap_java_gapic",
+- ":iap_java_grpc",
+- ":iap_java_proto",
+- ":iap_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "iap_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/iap/v1",
+- protos = [":iap_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "iap_go_gapic",
+- srcs = [":iap_proto_with_info"],
+- grpc_service_config = "iap_grpc_service_config.json",
+- importpath = "cloud.google.com/go/iap/apiv1;iap",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "iap_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":iap_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "iap_go_gapic_test",
+- srcs = [":iap_go_gapic_srcjar_test"],
+- embed = [":iap_go_gapic"],
+- importpath = "cloud.google.com/go/iap/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-iap-v1-go",
+- deps = [
+- ":iap_go_gapic",
+- ":iap_go_gapic_srcjar-metadata.srcjar",
+- ":iap_go_gapic_srcjar-test.srcjar",
+- ":iap_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "iap_py_gapic",
+- srcs = [":iap_proto"],
+- grpc_service_config = "iap_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "iap_py_gapic_test",
+- srcs = [
+- "iap_py_gapic_pytest.py",
+- "iap_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":iap_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "iap-v1-py",
+- deps = [
+- ":iap_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "iap_php_proto",
+- deps = [":iap_proto"],
+-)
+-
+-php_grpc_library(
+- name = "iap_php_grpc",
+- srcs = [":iap_proto"],
+- deps = [":iap_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "iap_php_gapic",
+- srcs = [":iap_proto_with_info"],
+- grpc_service_config = "iap_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iap_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":iap_php_grpc",
+- ":iap_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-iap-v1-php",
+- deps = [
+- ":iap_php_gapic",
+- ":iap_php_grpc",
+- ":iap_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "iap_nodejs_gapic",
+- package_name = "@google-cloud/iap",
+- src = ":iap_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "iap_grpc_service_config.json",
+- package = "google.cloud.iap.v1",
+- rest_numeric_enums = False,
+- service_yaml = "iap_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "iap-v1-nodejs",
+- deps = [
+- ":iap_nodejs_gapic",
+- ":iap_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "iap_ruby_proto",
+- deps = [":iap_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "iap_ruby_grpc",
+- srcs = [":iap_proto"],
+- deps = [":iap_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "iap_ruby_gapic",
+- srcs = [":iap_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=iap.googleapis.com",
+- "ruby-cloud-api-shortname=iap",
+- "ruby-cloud-env-prefix=IAP",
+- "ruby-cloud-gem-name=google-cloud-iap-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/iap/",
+- ],
+- grpc_service_config = "iap_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "IAP lets you establish a central authorization layer for applications accessed by HTTPS, so you can use an application-level access control model instead of relying on network-level firewalls.",
+- ruby_cloud_title = "Identity-Aware Proxy V1",
+- deps = [
+- ":iap_ruby_grpc",
+- ":iap_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-iap-v1-ruby",
+- deps = [
+- ":iap_ruby_gapic",
+- ":iap_ruby_grpc",
+- ":iap_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "iap_csharp_proto",
+- deps = [":iap_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "iap_csharp_grpc",
+- srcs = [":iap_proto"],
+- deps = [":iap_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "iap_csharp_gapic",
+- srcs = [":iap_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "iap_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iap_v1.yaml",
+- deps = [
+- ":iap_csharp_grpc",
+- ":iap_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-iap-v1-csharp",
+- deps = [
+- ":iap_csharp_gapic",
+- ":iap_csharp_grpc",
+- ":iap_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "iap_cc_proto",
+- deps = [":iap_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "iap_cc_grpc",
+- srcs = [":iap_proto"],
+- grpc_only = True,
+- deps = [":iap_cc_proto"],
+-)
+diff -urN a/google/cloud/iap/v1beta1/BUILD.bazel b/google/cloud/iap/v1beta1/BUILD.bazel
+--- a/google/cloud/iap/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/iap/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,372 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "iap_proto",
+- srcs = [
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "iap_proto_with_info",
+- deps = [
+- ":iap_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "iap_java_proto",
+- deps = [":iap_proto"],
+-)
+-
+-java_grpc_library(
+- name = "iap_java_grpc",
+- srcs = [":iap_proto"],
+- deps = [":iap_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "iap_java_gapic",
+- srcs = [":iap_proto_with_info"],
+- grpc_service_config = "iap_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":iap_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":iap_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "iap_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1ClientHttpJsonTest",
+- "com.google.cloud.iap.v1beta1.IdentityAwareProxyAdminV1Beta1ClientTest",
+- ],
+- runtime_deps = [":iap_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-iap-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":iap_java_gapic",
+- ":iap_java_grpc",
+- ":iap_java_proto",
+- ":iap_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "iap_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/iap/v1beta1",
+- protos = [":iap_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "iap_go_gapic",
+- srcs = [":iap_proto_with_info"],
+- grpc_service_config = "iap_grpc_service_config.json",
+- importpath = "cloud.google.com/go/iap/apiv1beta1;iap",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "iap_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":iap_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "iap_go_gapic_test",
+- srcs = [":iap_go_gapic_srcjar_test"],
+- embed = [":iap_go_gapic"],
+- importpath = "cloud.google.com/go/iap/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-iap-v1beta1-go",
+- deps = [
+- ":iap_go_gapic",
+- ":iap_go_gapic_srcjar-metadata.srcjar",
+- ":iap_go_gapic_srcjar-test.srcjar",
+- ":iap_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "iap_py_gapic",
+- srcs = [":iap_proto"],
+- grpc_service_config = "iap_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "iap_py_gapic_test",
+- srcs = [
+- "iap_py_gapic_pytest.py",
+- "iap_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":iap_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "iap-v1beta1-py",
+- deps = [
+- ":iap_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "iap_php_proto",
+- deps = [":iap_proto"],
+-)
+-
+-php_grpc_library(
+- name = "iap_php_grpc",
+- srcs = [":iap_proto"],
+- deps = [":iap_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "iap_php_gapic",
+- srcs = [":iap_proto_with_info"],
+- grpc_service_config = "iap_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iap_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":iap_php_grpc",
+- ":iap_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-iap-v1beta1-php",
+- deps = [
+- ":iap_php_gapic",
+- ":iap_php_grpc",
+- ":iap_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "iap_nodejs_gapic",
+- package_name = "@google-cloud/iap",
+- src = ":iap_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "iap_grpc_service_config.json",
+- package = "google.cloud.iap.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "iap_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "iap-v1beta1-nodejs",
+- deps = [
+- ":iap_nodejs_gapic",
+- ":iap_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "iap_ruby_proto",
+- deps = [":iap_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "iap_ruby_grpc",
+- srcs = [":iap_proto"],
+- deps = [":iap_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "iap_ruby_gapic",
+- srcs = [":iap_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-iap-v1beta1",
+- "ruby-cloud-env-prefix=IAP",
+- "ruby-cloud-product-url=https://cloud.google.com/iap/",
+- "ruby-cloud-api-id=iap.googleapis.com",
+- "ruby-cloud-api-shortname=iap",
+- ],
+- grpc_service_config = "iap_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "IAP lets you establish a central authorization layer for applications accessed by HTTPS, so you can use an application-level access control model instead of relying on network-level firewalls.",
+- ruby_cloud_title = "Identity-Aware Proxy V1beta1",
+- deps = [
+- ":iap_ruby_grpc",
+- ":iap_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-iap-v1beta1-ruby",
+- deps = [
+- ":iap_ruby_gapic",
+- ":iap_ruby_grpc",
+- ":iap_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "iap_csharp_proto",
+- deps = [":iap_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "iap_csharp_grpc",
+- srcs = [":iap_proto"],
+- deps = [":iap_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "iap_csharp_gapic",
+- srcs = [":iap_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "iap_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iap_v1beta1.yaml",
+- deps = [
+- ":iap_csharp_grpc",
+- ":iap_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-iap-v1beta1-csharp",
+- deps = [
+- ":iap_csharp_gapic",
+- ":iap_csharp_grpc",
+- ":iap_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/identitytoolkit/logging/BUILD.bazel b/google/cloud/identitytoolkit/logging/BUILD.bazel
+--- a/google/cloud/identitytoolkit/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/identitytoolkit/logging/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,179 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "request_log.proto",
+- ],
+- deps = [
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/identitytoolkit/logging",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/identitytoolkit/v2/BUILD.bazel b/google/cloud/identitytoolkit/v2/BUILD.bazel
+--- a/google/cloud/identitytoolkit/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/identitytoolkit/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,392 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "identitytoolkit_proto",
+- srcs = [
+- "account_management_service.proto",
+- "authentication_service.proto",
+- "mfa_info.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "identitytoolkit_proto_with_info",
+- deps = [
+- ":identitytoolkit_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "identitytoolkit_java_proto",
+- deps = [":identitytoolkit_proto"],
+-)
+-
+-java_grpc_library(
+- name = "identitytoolkit_java_grpc",
+- srcs = [":identitytoolkit_proto"],
+- deps = [":identitytoolkit_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "identitytoolkit_java_gapic",
+- srcs = [":identitytoolkit_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "identitytoolkit_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "identitytoolkit_v2.yaml",
+- test_deps = [
+- ":identitytoolkit_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":identitytoolkit_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "identitytoolkit_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.identitytoolkit.v2.AccountManagementServiceClientHttpJsonTest",
+- "com.google.cloud.identitytoolkit.v2.AccountManagementServiceClientTest",
+- "com.google.cloud.identitytoolkit.v2.AuthenticationServiceClientHttpJsonTest",
+- "com.google.cloud.identitytoolkit.v2.AuthenticationServiceClientTest",
+- ],
+- runtime_deps = [":identitytoolkit_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-identitytoolkit-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":identitytoolkit_java_gapic",
+- ":identitytoolkit_java_grpc",
+- ":identitytoolkit_java_proto",
+- ":identitytoolkit_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "identitytoolkit_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/identitytoolkit/v2",
+- protos = [":identitytoolkit_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "identitytoolkit_go_gapic",
+- srcs = [":identitytoolkit_proto_with_info"],
+- grpc_service_config = "identitytoolkit_grpc_service_config.json",
+- importpath = "cloud.google.com/go/identitytoolkit/apiv2;identitytoolkit",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "identitytoolkit_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":identitytoolkit_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "identitytoolkit_go_gapic_test",
+- srcs = [":identitytoolkit_go_gapic_srcjar_test"],
+- embed = [":identitytoolkit_go_gapic"],
+- importpath = "cloud.google.com/go/identitytoolkit/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-identitytoolkit-v2-go",
+- deps = [
+- ":identitytoolkit_go_gapic",
+- ":identitytoolkit_go_gapic_srcjar-metadata.srcjar",
+- ":identitytoolkit_go_gapic_srcjar-test.srcjar",
+- ":identitytoolkit_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "identitytoolkit_py_gapic",
+- srcs = [":identitytoolkit_proto"],
+- grpc_service_config = "identitytoolkit_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-identity-toolkit",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=identity_toolkit",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "identitytoolkit_py_gapic_test",
+- srcs = [
+- "identitytoolkit_py_gapic_pytest.py",
+- "identitytoolkit_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":identitytoolkit_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "identitytoolkit-v2-py",
+- deps = [
+- ":identitytoolkit_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "identitytoolkit_php_proto",
+- deps = [":identitytoolkit_proto"],
+-)
+-
+-php_grpc_library(
+- name = "identitytoolkit_php_grpc",
+- srcs = [":identitytoolkit_proto"],
+- deps = [":identitytoolkit_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "identitytoolkit_php_gapic",
+- srcs = [":identitytoolkit_proto_with_info"],
+- grpc_service_config = "identitytoolkit_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "identitytoolkit_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":identitytoolkit_php_grpc",
+- ":identitytoolkit_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-identitytoolkit-v2-php",
+- deps = [
+- ":identitytoolkit_php_gapic",
+- ":identitytoolkit_php_grpc",
+- ":identitytoolkit_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "identitytoolkit_nodejs_gapic",
+- package_name = "@google-cloud/identitytoolkit",
+- src = ":identitytoolkit_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "identitytoolkit_grpc_service_config.json",
+- package = "google.cloud.identitytoolkit.v2",
+- rest_numeric_enums = False,
+- service_yaml = "identitytoolkit_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "identitytoolkit-v2-nodejs",
+- deps = [
+- ":identitytoolkit_nodejs_gapic",
+- ":identitytoolkit_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "identitytoolkit_ruby_proto",
+- deps = [":identitytoolkit_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "identitytoolkit_ruby_grpc",
+- srcs = [":identitytoolkit_proto"],
+- deps = [":identitytoolkit_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "identitytoolkit_ruby_gapic",
+- srcs = [":identitytoolkit_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=identitytoolkit.googleapis.com",
+- "ruby-cloud-api-shortname=identitytoolkit",
+- "ruby-cloud-gem-name=google-cloud-identity_toolkit-v2",
+- "ruby-cloud-product-url=https://cloud.google.com/identity-platform/docs/reference/rest",
+- ],
+- grpc_service_config = "identitytoolkit_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Google Identity Toolkit API lets you use open standards to verify a user's identity.",
+- ruby_cloud_title = "Identity Platform V2",
+- deps = [
+- ":identitytoolkit_ruby_grpc",
+- ":identitytoolkit_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-identitytoolkit-v2-ruby",
+- deps = [
+- ":identitytoolkit_ruby_gapic",
+- ":identitytoolkit_ruby_grpc",
+- ":identitytoolkit_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "identitytoolkit_csharp_proto",
+- deps = [":identitytoolkit_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "identitytoolkit_csharp_grpc",
+- srcs = [":identitytoolkit_proto"],
+- deps = [":identitytoolkit_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "identitytoolkit_csharp_gapic",
+- srcs = [":identitytoolkit_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "identitytoolkit_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "identitytoolkit_v2.yaml",
+- deps = [
+- ":identitytoolkit_csharp_grpc",
+- ":identitytoolkit_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-identitytoolkit-v2-csharp",
+- deps = [
+- ":identitytoolkit_csharp_gapic",
+- ":identitytoolkit_csharp_grpc",
+- ":identitytoolkit_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "identitytoolkit_cc_proto",
+- deps = [":identitytoolkit_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "identitytoolkit_cc_grpc",
+- srcs = [":identitytoolkit_proto"],
+- grpc_only = True,
+- deps = [":identitytoolkit_cc_proto"],
+-)
+diff -urN a/google/cloud/ids/BUILD.bazel b/google/cloud/ids/BUILD.bazel
+--- a/google/cloud/ids/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/ids/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-ids.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for IDS.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "ids_ruby_wrapper",
+- srcs = ["//google/cloud/ids/v1:ids_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-ids",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/intrusion-detection-system/",
+- "ruby-cloud-api-id=ids.googleapis.com",
+- "ruby-cloud-api-shortname=ids",
+- "ruby-cloud-namespace-override=Ids=IDS",
+- ],
+- ruby_cloud_description = "Cloud IDS is an intrusion detection service that provides threat detection for intrusions, malware, spyware, and command-and-control attacks on your network. Cloud IDS works by creating a Google-managed peered network with mirrored VMs. Traffic in the peered network is mirrored, and then inspected by Palo Alto Networks threat protection technologies to provide advanced threat detection. You can mirror all traffic or you can mirror filtered traffic, based on protocol, IP address range, or ingress and egress.",
+- ruby_cloud_title = "Cloud IDS",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-ids-ruby",
+- deps = [
+- ":ids_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/ids/logging/v1/BUILD.bazel b/google/cloud/ids/logging/v1/BUILD.bazel
+--- a/google/cloud/ids/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/ids/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,177 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "logging.proto",
+- ],
+- deps = [
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/ids/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/ids/v1/BUILD.bazel b/google/cloud/ids/v1/BUILD.bazel
+--- a/google/cloud/ids/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/ids/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,392 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "ids_proto",
+- srcs = [
+- "ids.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "ids_proto_with_info",
+- deps = [
+- ":ids_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "ids_java_proto",
+- deps = [":ids_proto"],
+-)
+-
+-java_grpc_library(
+- name = "ids_java_grpc",
+- srcs = [":ids_proto"],
+- deps = [":ids_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "ids_java_gapic",
+- srcs = [":ids_proto_with_info"],
+- gapic_yaml = "ids_gapic.yaml",
+- grpc_service_config = "ids_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "ids_v1.yaml",
+- test_deps = [
+- ":ids_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":ids_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "ids_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.ids.v1.IDSClientHttpJsonTest",
+- "com.google.cloud.ids.v1.IDSClientTest",
+- ],
+- runtime_deps = [":ids_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-ids-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":ids_java_gapic",
+- ":ids_java_grpc",
+- ":ids_java_proto",
+- ":ids_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "ids_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/ids/v1",
+- protos = [":ids_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "ids_go_gapic",
+- srcs = [":ids_proto_with_info"],
+- grpc_service_config = "ids_grpc_service_config.json",
+- importpath = "cloud.google.com/go/ids/apiv1;ids",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "ids_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":ids_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "ids_go_gapic_test",
+- srcs = [":ids_go_gapic_srcjar_test"],
+- embed = [":ids_go_gapic"],
+- importpath = "cloud.google.com/go/ids/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-ids-v1-go",
+- deps = [
+- ":ids_go_gapic",
+- ":ids_go_gapic_srcjar-metadata.srcjar",
+- ":ids_go_gapic_srcjar-test.srcjar",
+- ":ids_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "ids_py_gapic",
+- srcs = [":ids_proto"],
+- grpc_service_config = "ids_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "ids_py_gapic_test",
+- srcs = [
+- "ids_py_gapic_pytest.py",
+- "ids_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":ids_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "ids-v1-py",
+- deps = [
+- ":ids_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "ids_php_proto",
+- deps = [":ids_proto"],
+-)
+-
+-php_grpc_library(
+- name = "ids_php_grpc",
+- srcs = [":ids_proto"],
+- deps = [":ids_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "ids_php_gapic",
+- srcs = [":ids_proto_with_info"],
+- gapic_yaml = "ids_gapic.yaml",
+- grpc_service_config = "ids_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "ids_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":ids_php_grpc",
+- ":ids_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-ids-v1-php",
+- deps = [
+- ":ids_php_gapic",
+- ":ids_php_grpc",
+- ":ids_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "ids_nodejs_gapic",
+- package_name = "@google-cloud/ids",
+- src = ":ids_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "ids_grpc_service_config.json",
+- package = "google.cloud.ids.v1",
+- rest_numeric_enums = False,
+- service_yaml = "ids_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "ids-v1-nodejs",
+- deps = [
+- ":ids_nodejs_gapic",
+- ":ids_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "ids_ruby_proto",
+- deps = [":ids_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "ids_ruby_grpc",
+- srcs = [":ids_proto"],
+- deps = [":ids_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "ids_ruby_gapic",
+- srcs = [":ids_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-ids-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/intrusion-detection-system/",
+- "ruby-cloud-api-id=ids.googleapis.com",
+- "ruby-cloud-api-shortname=ids",
+- "ruby-cloud-namespace-override=Ids=IDS",
+- ],
+- grpc_service_config = "ids_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud IDS is an intrusion detection service that provides threat detection for intrusions, malware, spyware, and command-and-control attacks on your network. Cloud IDS works by creating a Google-managed peered network with mirrored VMs. Traffic in the peered network is mirrored, and then inspected by Palo Alto Networks threat protection technologies to provide advanced threat detection. You can mirror all traffic or you can mirror filtered traffic, based on protocol, IP address range, or ingress and egress.",
+- ruby_cloud_title = "Cloud IDS V1",
+- deps = [
+- ":ids_ruby_grpc",
+- ":ids_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-ids-v1-ruby",
+- deps = [
+- ":ids_ruby_gapic",
+- ":ids_ruby_grpc",
+- ":ids_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "ids_csharp_proto",
+- deps = [":ids_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "ids_csharp_grpc",
+- srcs = [":ids_proto"],
+- deps = [":ids_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "ids_csharp_gapic",
+- srcs = [":ids_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "ids_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "ids_v1.yaml",
+- deps = [
+- ":ids_csharp_grpc",
+- ":ids_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-ids-v1-csharp",
+- deps = [
+- ":ids_csharp_gapic",
+- ":ids_csharp_grpc",
+- ":ids_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "ids_cc_proto",
+- deps = [":ids_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "ids_cc_grpc",
+- srcs = [":ids_proto"],
+- grpc_only = True,
+- deps = [":ids_cc_proto"],
+-)
+diff -urN a/google/cloud/integrations/v1alpha/BUILD.bazel b/google/cloud/integrations/v1alpha/BUILD.bazel
+--- a/google/cloud/integrations/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/integrations/v1alpha/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,168 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "integrations_proto",
+- srcs = [
+- "event_parameter.proto",
+- "json_validation.proto",
+- "log_entries.proto",
+- "product.proto",
+- "task_config.proto",
+- "value_type.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "integrations_java_proto",
+- deps = [":integrations_proto"],
+-)
+-
+-java_grpc_library(
+- name = "integrations_java_grpc",
+- srcs = [":integrations_proto"],
+- deps = [":integrations_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "integrations_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/integrations/v1alpha",
+- protos = [":integrations_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "integrations_moved_proto",
+- srcs = [":integrations_proto"],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "integrations_py_proto",
+- deps = [":integrations_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "integrations_py_grpc",
+- srcs = [":integrations_moved_proto"],
+- deps = [":integrations_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "integrations_php_proto",
+- deps = [":integrations_proto"],
+-)
+-
+-php_grpc_library(
+- name = "integrations_php_grpc",
+- srcs = [":integrations_proto"],
+- deps = [":integrations_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "integrations_ruby_proto",
+- deps = [":integrations_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "integrations_ruby_grpc",
+- srcs = [":integrations_proto"],
+- deps = [":integrations_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "integrations_csharp_proto",
+- deps = [":integrations_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "integrations_csharp_grpc",
+- srcs = [":integrations_proto"],
+- deps = [":integrations_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/iot/BUILD.bazel b/google/cloud/iot/BUILD.bazel
+--- a/google/cloud/iot/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/iot/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-iot.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for cloudiot.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "cloudiot_ruby_wrapper",
+- srcs = ["//google/cloud/iot/v1:iot_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-iot",
+- "ruby-cloud-env-prefix=IOT",
+- "ruby-cloud-wrapper-of=v1:0.3",
+- "ruby-cloud-product-url=https://cloud.google.com/iot",
+- "ruby-cloud-api-id=cloudiot.googleapis.com",
+- "ruby-cloud-api-shortname=cloudiot",
+- ],
+- ruby_cloud_description = "Registers and manages IoT (Internet of Things) devices that connect to the Google Cloud Platform.",
+- ruby_cloud_title = "Cloud IoT",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-iot-ruby",
+- deps = [
+- ":cloudiot_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/iot/v1/BUILD.bazel b/google/cloud/iot/v1/BUILD.bazel
+--- a/google/cloud/iot/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/iot/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,384 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "iot_proto",
+- srcs = [
+- "device_manager.proto",
+- "resources.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "iot_proto_with_info",
+- deps = [
+- ":iot_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "iot_java_proto",
+- deps = [":iot_proto"],
+-)
+-
+-java_grpc_library(
+- name = "iot_java_grpc",
+- srcs = [":iot_proto"],
+- deps = [":iot_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "iot_java_gapic",
+- srcs = [":iot_proto_with_info"],
+- grpc_service_config = "cloudiot_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":iot_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":iot_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "iot_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.iot.v1.DeviceManagerClientHttpJsonTest",
+- "com.google.cloud.iot.v1.DeviceManagerClientTest",
+- ],
+- runtime_deps = [":iot_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-iot-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":iot_java_gapic",
+- ":iot_java_grpc",
+- ":iot_java_proto",
+- ":iot_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "iot_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/iot/v1",
+- protos = [":iot_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "iot_go_gapic",
+- srcs = [":iot_proto_with_info"],
+- grpc_service_config = "cloudiot_grpc_service_config.json",
+- importpath = "cloud.google.com/go/iot/apiv1;iot",
+- rest_numeric_enums = False,
+- service_yaml = "cloudiot_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":iot_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "iot_go_gapic_test",
+- srcs = [":iot_go_gapic_srcjar_test"],
+- embed = [":iot_go_gapic"],
+- importpath = "cloud.google.com/go/iot/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-iot-v1-go",
+- deps = [
+- ":iot_go_gapic",
+- ":iot_go_gapic_srcjar-test.srcjar",
+- ":iot_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "iot_py_gapic",
+- srcs = [":iot_proto"],
+- grpc_service_config = "cloudiot_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "iot_py_gapic_test",
+- srcs = [
+- "iot_py_gapic_pytest.py",
+- "iot_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":iot_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "iot-v1-py",
+- deps = [
+- ":iot_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "iot_php_proto",
+- deps = [":iot_proto"],
+-)
+-
+-php_grpc_library(
+- name = "iot_php_grpc",
+- srcs = [":iot_proto"],
+- deps = [":iot_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "iot_php_gapic",
+- srcs = [":iot_proto_with_info"],
+- grpc_service_config = "cloudiot_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":iot_php_grpc",
+- ":iot_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-iot-v1-php",
+- deps = [
+- ":iot_php_gapic",
+- ":iot_php_grpc",
+- ":iot_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "iot_nodejs_gapic",
+- package_name = "@google-cloud/iot",
+- src = ":iot_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudiot_grpc_service_config.json",
+- main_service = "iot",
+- package = "google.cloud.iot.v1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudiot_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "iot-v1-nodejs",
+- deps = [
+- ":iot_nodejs_gapic",
+- ":iot_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "iot_ruby_proto",
+- deps = [":iot_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "iot_ruby_grpc",
+- srcs = [":iot_proto"],
+- deps = [":iot_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "iot_ruby_gapic",
+- srcs = [":iot_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-iot-v1",
+- "ruby-cloud-env-prefix=IOT",
+- "ruby-cloud-product-url=https://cloud.google.com/iot",
+- "ruby-cloud-api-id=cloudiot.googleapis.com",
+- "ruby-cloud-api-shortname=cloudiot",
+- ],
+- grpc_service_config = "cloudiot_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Registers and manages IoT (Internet of Things) devices that connect to the Google Cloud Platform.",
+- ruby_cloud_title = "Cloud IoT V1",
+- deps = [
+- ":iot_ruby_grpc",
+- ":iot_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-iot-v1-ruby",
+- deps = [
+- ":iot_ruby_gapic",
+- ":iot_ruby_grpc",
+- ":iot_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "iot_csharp_proto",
+- deps = [":iot_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "iot_csharp_grpc",
+- srcs = [":iot_proto"],
+- deps = [":iot_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "iot_csharp_gapic",
+- srcs = [":iot_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudiot_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudiot_v1.yaml",
+- deps = [
+- ":iot_csharp_grpc",
+- ":iot_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-iot-v1-csharp",
+- deps = [
+- ":iot_csharp_gapic",
+- ":iot_csharp_grpc",
+- ":iot_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "iot_cc_proto",
+- deps = [":iot_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "iot_cc_grpc",
+- srcs = [":iot_proto"],
+- grpc_only = True,
+- deps = [":iot_cc_proto"],
+-)
+diff -urN a/google/cloud/kms/BUILD.bazel b/google/cloud/kms/BUILD.bazel
+--- a/google/cloud/kms/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/kms/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-kms.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for cloudkms.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "cloudkms_ruby_wrapper",
+- srcs = ["//google/cloud/kms/v1:kms_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-kms",
+- "ruby-cloud-env-prefix=KMS",
+- "ruby-cloud-wrapper-of=v1:0.11",
+- "ruby-cloud-product-url=https://cloud.google.com/kms",
+- "ruby-cloud-api-id=cloudkms.googleapis.com",
+- "ruby-cloud-api-shortname=cloudkms",
+- "ruby-cloud-migration-version=2.0",
+- ],
+- ruby_cloud_description = "Manages keys and performs cryptographic operations in a central cloud service, for direct use by other cloud resources and applications.",
+- ruby_cloud_title = "Cloud Key Management Service (KMS)",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-kms-ruby",
+- deps = [
+- ":cloudkms_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/kms/v1/BUILD.bazel b/google/cloud/kms/v1/BUILD.bazel
+--- a/google/cloud/kms/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/kms/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,412 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Reading the default service config is useful for custom gRPC clients.
+-exports_files(["cloudkms_grpc_service_config.json"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-# buildifier: disable=load-on-top
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "kms_proto",
+- srcs = [
+- "ekm_service.proto",
+- "resources.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "kms_proto_with_info",
+- deps = [
+- ":kms_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-# buildifier: disable=load-on-top
+-# buildifier: disable=same-origin-load
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "kms_java_proto",
+- deps = [":kms_proto"],
+-)
+-
+-java_grpc_library(
+- name = "kms_java_grpc",
+- srcs = [":kms_proto"],
+- deps = [":kms_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "kms_java_gapic",
+- srcs = [":kms_proto_with_info"],
+- grpc_service_config = "cloudkms_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudkms_v1.yaml",
+- test_deps = [
+- ":kms_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":kms_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "kms_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.kms.v1.KeyManagementServiceClientHttpJsonTest",
+- "com.google.cloud.kms.v1.KeyManagementServiceClientTest",
+- ],
+- runtime_deps = [":kms_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-kms-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":kms_java_gapic",
+- ":kms_java_grpc",
+- ":kms_java_proto",
+- ":kms_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-# buildifier: disable=load-on-top
+-# buildifier: disable=same-origin-load
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "kms_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/kms/v1",
+- protos = [":kms_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "kms_go_gapic",
+- srcs = [":kms_proto_with_info"],
+- grpc_service_config = "cloudkms_grpc_service_config.json",
+- importpath = "cloud.google.com/go/kms/apiv1;kms",
+- rest_numeric_enums = False,
+- service_yaml = "cloudkms_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":kms_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "kms_go_gapic_test",
+- srcs = [":kms_go_gapic_srcjar_test"],
+- embed = [":kms_go_gapic"],
+- importpath = "cloud.google.com/go/kms/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-kms-v1-go",
+- deps = [
+- ":kms_go_gapic",
+- ":kms_go_gapic_srcjar-test.srcjar",
+- ":kms_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-# buildifier: disable=load-on-top
+-# buildifier: disable=same-origin-load
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "kms_py_gapic",
+- srcs = [":kms_proto"],
+- grpc_service_config = "cloudkms_grpc_service_config.json",
+- opt_args = ["add-iam-methods"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- "//google/iam/v1:policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "kms_py_gapic_test",
+- srcs = [
+- "kms_py_gapic_pytest.py",
+- "kms_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":kms_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "kms-v1-py",
+- deps = [
+- ":kms_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-# buildifier: disable=load-on-top
+-# buildifier: disable=same-origin-load
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "kms_php_proto",
+- deps = [":kms_proto"],
+-)
+-
+-php_grpc_library(
+- name = "kms_php_grpc",
+- srcs = [":kms_proto"],
+- deps = [":kms_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "kms_php_gapic",
+- srcs = [":kms_proto_with_info"],
+- rest_numeric_enums = False,
+- service_yaml = "cloudkms_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":kms_php_grpc",
+- ":kms_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-kms-v1-php",
+- deps = [
+- ":kms_php_gapic",
+- ":kms_php_grpc",
+- ":kms_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-# buildifier: disable=load-on-top
+-# buildifier: disable=same-origin-load
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "kms_nodejs_gapic",
+- package_name = "@google-cloud/kms",
+- src = ":kms_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudkms_grpc_service_config.json",
+- package = "google.cloud.kms.v1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudkms_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "kms-v1-nodejs",
+- deps = [
+- ":kms_nodejs_gapic",
+- ":kms_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-# buildifier: disable=load-on-top
+-# buildifier: disable=same-origin-load
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "kms_ruby_proto",
+- deps = [":kms_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "kms_ruby_grpc",
+- srcs = [":kms_proto"],
+- deps = [":kms_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "kms_ruby_gapic",
+- srcs = [":kms_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-kms-v1",
+- "ruby-cloud-env-prefix=KMS",
+- "ruby-cloud-product-url=https://cloud.google.com/kms",
+- "ruby-cloud-api-id=cloudkms.googleapis.com",
+- "ruby-cloud-api-shortname=cloudkms",
+- ],
+- grpc_service_config = "cloudkms_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Manages keys and performs cryptographic operations in a central cloud service, for direct use by other cloud resources and applications.",
+- ruby_cloud_title = "Cloud Key Management Service (KMS) V1",
+- service_yaml = "cloudkms_v1.yaml",
+- deps = [
+- ":kms_ruby_grpc",
+- ":kms_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-kms-v1-ruby",
+- deps = [
+- ":kms_ruby_gapic",
+- ":kms_ruby_grpc",
+- ":kms_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-# buildifier: disable=load-on-top
+-# buildifier: disable=same-origin-load
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "kms_csharp_proto",
+- deps = [":kms_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "kms_csharp_grpc",
+- srcs = [":kms_proto"],
+- deps = [":kms_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "kms_csharp_gapic",
+- srcs = [":kms_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudkms_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudkms_v1.yaml",
+- deps = [
+- ":kms_csharp_grpc",
+- ":kms_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-kms-v1-csharp",
+- deps = [
+- ":kms_csharp_gapic",
+- ":kms_csharp_grpc",
+- ":kms_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# buildifier: disable=load-on-top
+-# buildifier: disable=same-origin-load
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "kms_cc_proto",
+- deps = [":kms_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "kms_cc_grpc",
+- srcs = [":kms_proto"],
+- grpc_only = True,
+- deps = [":kms_cc_proto"],
+-)
+diff -urN a/google/cloud/kubernetes/security/containersecurity_logging/BUILD.bazel b/google/cloud/kubernetes/security/containersecurity_logging/BUILD.bazel
+--- a/google/cloud/kubernetes/security/containersecurity_logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/kubernetes/security/containersecurity_logging/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,175 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "containersecurity_logging_proto",
+- srcs = [
+- "logging.proto",
+- ],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "containersecurity_logging_java_proto",
+- deps = [":containersecurity_logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "containersecurity_logging_java_grpc",
+- srcs = [":containersecurity_logging_proto"],
+- deps = [":containersecurity_logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "containersecurity_logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/kubernetes/security/containersecurity_logging",
+- protos = [":containersecurity_logging_proto"],
+- deps = [],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "containersecurity_logging_moved_proto",
+- srcs = [":containersecurity_logging_proto"],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "containersecurity_logging_py_proto",
+- deps = [":containersecurity_logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "containersecurity_logging_py_grpc",
+- srcs = [":containersecurity_logging_moved_proto"],
+- deps = [":containersecurity_logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "containersecurity_logging_php_proto",
+- deps = [":containersecurity_logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "containersecurity_logging_php_grpc",
+- srcs = [":containersecurity_logging_proto"],
+- deps = [":containersecurity_logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "containersecurity_logging_ruby_proto",
+- deps = [":containersecurity_logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "containersecurity_logging_ruby_grpc",
+- srcs = [":containersecurity_logging_proto"],
+- deps = [":containersecurity_logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "containersecurity_logging_csharp_proto",
+- deps = [":containersecurity_logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "containersecurity_logging_csharp_grpc",
+- srcs = [":containersecurity_logging_proto"],
+- deps = [":containersecurity_logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "containersecurity_logging_cc_proto",
+- deps = [":containersecurity_logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "containersecurity_logging_cc_grpc",
+- srcs = [":containersecurity_logging_proto"],
+- grpc_only = True,
+- deps = [":containersecurity_logging_cc_proto"],
+-)
+diff -urN a/google/cloud/language/BUILD.bazel b/google/cloud/language/BUILD.bazel
+--- a/google/cloud/language/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/language/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-language.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for language.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "language_ruby_wrapper",
+- srcs = ["//google/cloud/language/v1:language_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-language",
+- "ruby-cloud-env-prefix=LANGUAGE",
+- "ruby-cloud-wrapper-of=v1:0.4;v1beta2:0.4",
+- "ruby-cloud-product-url=https://cloud.google.com/natural-language",
+- "ruby-cloud-api-id=language.googleapis.com",
+- "ruby-cloud-api-shortname=language",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "Provides natural language understanding technologies, such as sentiment analysis, entity recognition, entity sentiment analysis, and other text annotations.",
+- ruby_cloud_title = "Cloud Natural Language",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-language-ruby",
+- deps = [
+- ":language_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/language/v1/BUILD.bazel b/google/cloud/language/v1/BUILD.bazel
+--- a/google/cloud/language/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/language/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,387 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "language_proto",
+- srcs = [
+- "language_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "language_proto_with_info",
+- deps = [
+- ":language_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "language_java_proto",
+- deps = [":language_proto"],
+-)
+-
+-java_grpc_library(
+- name = "language_java_grpc",
+- srcs = [":language_proto"],
+- deps = [":language_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "language_java_gapic",
+- srcs = [":language_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "language_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "language_v1.yaml",
+- test_deps = [
+- ":language_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":language_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "language_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.language.v1.LanguageServiceClientHttpJsonTest",
+- "com.google.cloud.language.v1.LanguageServiceClientTest",
+- ],
+- runtime_deps = [":language_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-language-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":language_java_gapic",
+- ":language_java_grpc",
+- ":language_java_proto",
+- ":language_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "language_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/language/v1",
+- protos = [":language_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "language_go_gapic",
+- srcs = [":language_proto_with_info"],
+- grpc_service_config = "language_grpc_service_config.json",
+- importpath = "cloud.google.com/go/language/apiv1;language",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "language_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":language_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "language_go_gapic_test",
+- srcs = [":language_go_gapic_srcjar_test"],
+- embed = [":language_go_gapic"],
+- importpath = "cloud.google.com/go/language/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-language-v1-go",
+- deps = [
+- ":language_go_gapic",
+- ":language_go_gapic_srcjar-metadata.srcjar",
+- ":language_go_gapic_srcjar-test.srcjar",
+- ":language_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "language_py_gapic",
+- srcs = [":language_proto"],
+- grpc_service_config = "language_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "language_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "language_py_gapic_test",
+- srcs = [
+- "language_py_gapic_pytest.py",
+- "language_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":language_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "language-v1-py",
+- deps = [
+- ":language_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "language_php_proto",
+- deps = [":language_proto"],
+-)
+-
+-php_grpc_library(
+- name = "language_php_grpc",
+- srcs = [":language_proto"],
+- deps = [":language_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "language_php_gapic",
+- srcs = [":language_proto_with_info"],
+- grpc_service_config = "language_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "language_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":language_php_grpc",
+- ":language_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-language-v1-php",
+- deps = [
+- ":language_php_gapic",
+- ":language_php_grpc",
+- ":language_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "language_nodejs_gapic",
+- package_name = "@google-cloud/language",
+- src = ":language_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "language_grpc_service_config.json",
+- package = "google.cloud.language.v1",
+- rest_numeric_enums = False,
+- service_yaml = "language_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "language-v1-nodejs",
+- deps = [
+- ":language_nodejs_gapic",
+- ":language_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "language_ruby_proto",
+- deps = [":language_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "language_ruby_grpc",
+- srcs = [":language_proto"],
+- deps = [":language_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "language_ruby_gapic",
+- srcs = [":language_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=language.googleapis.com",
+- "ruby-cloud-api-shortname=language",
+- "ruby-cloud-env-prefix=LANGUAGE",
+- "ruby-cloud-gem-name=google-cloud-language-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/natural-language",
+- ],
+- grpc_service_config = "language_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Provides natural language understanding technologies, such as sentiment analysis, entity recognition, entity sentiment analysis, and other text annotations.",
+- ruby_cloud_title = "Natural Language V1",
+- service_yaml = "language_v1.yaml",
+- deps = [
+- ":language_ruby_grpc",
+- ":language_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-language-v1-ruby",
+- deps = [
+- ":language_ruby_gapic",
+- ":language_ruby_grpc",
+- ":language_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "language_csharp_proto",
+- deps = [":language_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "language_csharp_grpc",
+- srcs = [":language_proto"],
+- deps = [":language_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "language_csharp_gapic",
+- srcs = [":language_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "language_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "language_v1.yaml",
+- deps = [
+- ":language_csharp_grpc",
+- ":language_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-language-v1-csharp",
+- deps = [
+- ":language_csharp_gapic",
+- ":language_csharp_grpc",
+- ":language_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "language_cc_proto",
+- deps = [":language_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "language_cc_grpc",
+- srcs = [":language_proto"],
+- grpc_only = True,
+- deps = [":language_cc_proto"],
+-)
+diff -urN a/google/cloud/language/v1beta1/BUILD.bazel b/google/cloud/language/v1beta1/BUILD.bazel
+--- a/google/cloud/language/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/language/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,161 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "language_proto",
+- srcs = [
+- "language_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "language_java_proto",
+- deps = [":language_proto"],
+-)
+-
+-java_grpc_library(
+- name = "language_java_grpc",
+- srcs = [":language_proto"],
+- deps = [":language_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "language_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/language/v1beta1",
+- protos = [":language_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "language_moved_proto",
+- srcs = [":language_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "language_py_proto",
+- deps = [":language_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "language_py_grpc",
+- srcs = [":language_moved_proto"],
+- deps = [":language_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "language_php_proto",
+- deps = [":language_proto"],
+-)
+-
+-php_grpc_library(
+- name = "language_php_grpc",
+- srcs = [":language_proto"],
+- deps = [":language_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "language_ruby_proto",
+- deps = [":language_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "language_ruby_grpc",
+- srcs = [":language_proto"],
+- deps = [":language_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "language_csharp_proto",
+- deps = [":language_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "language_csharp_grpc",
+- srcs = [":language_proto"],
+- deps = [":language_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/language/v1beta2/BUILD.bazel b/google/cloud/language/v1beta2/BUILD.bazel
+--- a/google/cloud/language/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/language/v1beta2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,387 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "language_proto",
+- srcs = [
+- "language_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "language_proto_with_info",
+- deps = [
+- ":language_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "language_java_proto",
+- deps = [":language_proto"],
+-)
+-
+-java_grpc_library(
+- name = "language_java_grpc",
+- srcs = [":language_proto"],
+- deps = [":language_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "language_java_gapic",
+- srcs = [":language_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "language_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "language_v1beta2.yaml",
+- test_deps = [
+- ":language_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":language_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "language_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.language.v1beta2.LanguageServiceClientHttpJsonTest",
+- "com.google.cloud.language.v1beta2.LanguageServiceClientTest",
+- ],
+- runtime_deps = [":language_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-language-v1beta2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":language_java_gapic",
+- ":language_java_grpc",
+- ":language_java_proto",
+- ":language_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "language_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/language/v1beta2",
+- protos = [":language_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "language_go_gapic",
+- srcs = [":language_proto_with_info"],
+- grpc_service_config = "language_grpc_service_config.json",
+- importpath = "cloud.google.com/go/language/apiv1beta2;language",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "language_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":language_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "language_go_gapic_test",
+- srcs = [":language_go_gapic_srcjar_test"],
+- embed = [":language_go_gapic"],
+- importpath = "cloud.google.com/go/language/apiv1beta2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-language-v1beta2-go",
+- deps = [
+- ":language_go_gapic",
+- ":language_go_gapic_srcjar-metadata.srcjar",
+- ":language_go_gapic_srcjar-test.srcjar",
+- ":language_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "language_py_gapic",
+- srcs = [":language_proto"],
+- grpc_service_config = "language_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "language_v1beta2.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "language_py_gapic_test",
+- srcs = [
+- "language_py_gapic_pytest.py",
+- "language_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":language_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "language-v1beta2-py",
+- deps = [
+- ":language_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "language_php_proto",
+- deps = [":language_proto"],
+-)
+-
+-php_grpc_library(
+- name = "language_php_grpc",
+- srcs = [":language_proto"],
+- deps = [":language_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "language_php_gapic",
+- srcs = [":language_proto_with_info"],
+- grpc_service_config = "language_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "language_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":language_php_grpc",
+- ":language_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-language-v1beta2-php",
+- deps = [
+- ":language_php_gapic",
+- ":language_php_grpc",
+- ":language_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "language_nodejs_gapic",
+- package_name = "@google-cloud/language",
+- src = ":language_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "language_grpc_service_config.json",
+- package = "google.cloud.language.v1beta2",
+- rest_numeric_enums = False,
+- service_yaml = "language_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "language-v1beta2-nodejs",
+- deps = [
+- ":language_nodejs_gapic",
+- ":language_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "language_ruby_proto",
+- deps = [":language_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "language_ruby_grpc",
+- srcs = [":language_proto"],
+- deps = [":language_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "language_ruby_gapic",
+- srcs = [":language_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=language.googleapis.com",
+- "ruby-cloud-api-shortname=language",
+- "ruby-cloud-env-prefix=LANGUAGE",
+- "ruby-cloud-gem-name=google-cloud-language-v1beta2",
+- "ruby-cloud-product-url=https://cloud.google.com/natural-language",
+- ],
+- grpc_service_config = "language_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Provides natural language understanding technologies, such as sentiment analysis, entity recognition, entity sentiment analysis, and other text annotations.",
+- ruby_cloud_title = "Natural Language V1beta2",
+- service_yaml = "language_v1beta2.yaml",
+- deps = [
+- ":language_ruby_grpc",
+- ":language_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-language-v1beta2-ruby",
+- deps = [
+- ":language_ruby_gapic",
+- ":language_ruby_grpc",
+- ":language_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "language_csharp_proto",
+- deps = [":language_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "language_csharp_grpc",
+- srcs = [":language_proto"],
+- deps = [":language_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "language_csharp_gapic",
+- srcs = [":language_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "language_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "language_v1beta2.yaml",
+- deps = [
+- ":language_csharp_grpc",
+- ":language_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-language-v1beta2-csharp",
+- deps = [
+- ":language_csharp_gapic",
+- ":language_csharp_grpc",
+- ":language_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "language_cc_proto",
+- deps = [":language_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "language_cc_grpc",
+- srcs = [":language_proto"],
+- grpc_only = True,
+- deps = [":language_cc_proto"],
+-)
+diff -urN a/google/cloud/lifesciences/BUILD.bazel b/google/cloud/lifesciences/BUILD.bazel
+--- a/google/cloud/lifesciences/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/lifesciences/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-life_sciences.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for lifesciences.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v2beta in this case.
+-ruby_cloud_gapic_library(
+- name = "lifesciences_ruby_wrapper",
+- srcs = ["//google/cloud/lifesciences/v2beta:lifesciences_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-life_sciences",
+- "ruby-cloud-env-prefix=LIFE_SCIENCES",
+- "ruby-cloud-wrapper-of=v2beta:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/life-sciences/",
+- "ruby-cloud-api-id=lifesciences.googleapis.com",
+- "ruby-cloud-api-shortname=lifesciences",
+- "ruby-cloud-service-override=WorkflowsServiceV2Beta=WorkflowsService",
+- ],
+- ruby_cloud_description = "Cloud Life Sciences is a suite of services and tools for managing, processing, and transforming life sciences data. It also enables advanced insights and operational workflows using highly scalable and compliant infrastructure.",
+- ruby_cloud_title = "Cloud Life Sciences",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-lifesciences-ruby",
+- deps = [
+- ":lifesciences_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/lifesciences/v2beta/BUILD.bazel b/google/cloud/lifesciences/v2beta/BUILD.bazel
+--- a/google/cloud/lifesciences/v2beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/lifesciences/v2beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,403 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "lifesciences_proto",
+- srcs = [
+- "workflows.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:code_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "lifesciences_proto_with_info",
+- deps = [
+- ":lifesciences_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "lifesciences_java_proto",
+- deps = [":lifesciences_proto"],
+-)
+-
+-java_grpc_library(
+- name = "lifesciences_java_grpc",
+- srcs = [":lifesciences_proto"],
+- deps = [":lifesciences_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "lifesciences_java_gapic",
+- srcs = [":lifesciences_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "lifesciences_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "lifesciences_v2beta.yaml",
+- test_deps = [
+- ":lifesciences_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":lifesciences_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "lifesciences_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaClientHttpJsonTest",
+- "com.google.cloud.lifesciences.v2beta.WorkflowsServiceV2BetaClientTest",
+- ],
+- runtime_deps = [":lifesciences_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-lifesciences-v2beta-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":lifesciences_java_gapic",
+- ":lifesciences_java_grpc",
+- ":lifesciences_java_proto",
+- ":lifesciences_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "lifesciences_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/lifesciences/v2beta",
+- protos = [":lifesciences_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:code_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "lifesciences_go_gapic",
+- srcs = [":lifesciences_proto_with_info"],
+- grpc_service_config = "lifesciences_grpc_service_config.json",
+- importpath = "cloud.google.com/go/lifesciences/apiv2beta;lifesciences",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "lifesciences_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":lifesciences_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "lifesciences_go_gapic_test",
+- srcs = [":lifesciences_go_gapic_srcjar_test"],
+- embed = [":lifesciences_go_gapic"],
+- importpath = "cloud.google.com/go/lifesciences/apiv2beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-lifesciences-v2beta-go",
+- deps = [
+- ":lifesciences_go_gapic",
+- ":lifesciences_go_gapic_srcjar-metadata.srcjar",
+- ":lifesciences_go_gapic_srcjar-test.srcjar",
+- ":lifesciences_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "lifesciences_py_gapic",
+- srcs = [":lifesciences_proto"],
+- grpc_service_config = "lifesciences_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-life-sciences"],
+- rest_numeric_enums = False,
+- service_yaml = "lifesciences_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "lifesciences_py_gapic_test",
+- srcs = [
+- "lifesciences_py_gapic_pytest.py",
+- "lifesciences_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":lifesciences_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "lifesciences-v2beta-py",
+- deps = [
+- ":lifesciences_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "lifesciences_php_proto",
+- deps = [":lifesciences_proto"],
+-)
+-
+-php_grpc_library(
+- name = "lifesciences_php_grpc",
+- srcs = [":lifesciences_proto"],
+- deps = [":lifesciences_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "lifesciences_php_gapic",
+- srcs = [":lifesciences_proto_with_info"],
+- grpc_service_config = "lifesciences_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "lifesciences_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":lifesciences_php_grpc",
+- ":lifesciences_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-lifesciences-v2beta-php",
+- deps = [
+- ":lifesciences_php_gapic",
+- ":lifesciences_php_grpc",
+- ":lifesciences_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "lifesciences_nodejs_gapic",
+- package_name = "@google-cloud/life-sciences",
+- src = ":lifesciences_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "lifesciences_grpc_service_config.json",
+- package = "google.cloud.lifesciences.v2beta",
+- rest_numeric_enums = False,
+- service_yaml = "lifesciences_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "lifesciences-v2beta-nodejs",
+- deps = [
+- ":lifesciences_nodejs_gapic",
+- ":lifesciences_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "lifesciences_ruby_proto",
+- deps = [":lifesciences_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "lifesciences_ruby_grpc",
+- srcs = [":lifesciences_proto"],
+- deps = [":lifesciences_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "lifesciences_ruby_gapic",
+- srcs = [":lifesciences_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=lifesciences.googleapis.com",
+- "ruby-cloud-api-shortname=lifesciences",
+- "ruby-cloud-env-prefix=LIFE_SCIENCES",
+- "ruby-cloud-gem-name=google-cloud-life_sciences-v2beta",
+- "ruby-cloud-product-url=https://cloud.google.com/life-sciences/",
+- "ruby-cloud-service-override=WorkflowsServiceV2Beta=WorkflowsService",
+- ],
+- grpc_service_config = "lifesciences_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Life Sciences is a suite of services and tools for managing, processing, and transforming life sciences data. It also enables advanced insights and operational workflows using highly scalable and compliant infrastructure.",
+- ruby_cloud_title = "Cloud Life Sciences V2beta",
+- service_yaml = "lifesciences_v2beta.yaml",
+- deps = [
+- ":lifesciences_ruby_grpc",
+- ":lifesciences_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-lifesciences-v2beta-ruby",
+- deps = [
+- ":lifesciences_ruby_gapic",
+- ":lifesciences_ruby_grpc",
+- ":lifesciences_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "lifesciences_csharp_proto",
+- deps = [":lifesciences_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "lifesciences_csharp_grpc",
+- srcs = [":lifesciences_proto"],
+- deps = [":lifesciences_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "lifesciences_csharp_gapic",
+- srcs = [":lifesciences_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "lifesciences_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "lifesciences_v2beta.yaml",
+- deps = [
+- ":lifesciences_csharp_grpc",
+- ":lifesciences_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-lifesciences-v2beta-csharp",
+- deps = [
+- ":lifesciences_csharp_gapic",
+- ":lifesciences_csharp_grpc",
+- ":lifesciences_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "lifesciences_cc_proto",
+- deps = [":lifesciences_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "lifesciences_cc_grpc",
+- srcs = [":lifesciences_proto"],
+- grpc_only = True,
+- deps = [":lifesciences_cc_proto"],
+-)
+diff -urN a/google/cloud/location/BUILD.bazel b/google/cloud/location/BUILD.bazel
+--- a/google/cloud/location/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/location/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,251 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "location_proto",
+- srcs = [
+- "locations.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "@com_google_protobuf//:any_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "location_proto_with_info",
+- deps = [
+- ":location_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "location_java_proto",
+- deps = [":location_proto"],
+-)
+-
+-java_grpc_library(
+- name = "location_java_grpc",
+- srcs = [":location_proto"],
+- deps = [":location_java_proto"],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-location-java",
+- transport = "grpc+rest",
+- deps = [
+- ":location_java_grpc",
+- ":location_java_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "location_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/location",
+- protos = [":location_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "location_moved_proto",
+- srcs = [":location_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "@com_google_protobuf//:any_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "location_py_proto",
+- deps = [":location_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "location_py_grpc",
+- srcs = [":location_moved_proto"],
+- deps = [":location_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "location_php_proto",
+- deps = [":location_proto"],
+-)
+-
+-php_grpc_library(
+- name = "location_php_grpc",
+- srcs = [":location_proto"],
+- deps = [":location_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "location_ruby_proto",
+- deps = [":location_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "location_ruby_grpc",
+- srcs = [":location_proto"],
+- deps = [":location_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "location_ruby_gapic",
+- srcs = [":location_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-location",
+- ],
+- rest_numeric_enums = False,
+- ruby_cloud_description = "An add-on interface used by some Google API clients to provide location management calls.",
+- ruby_cloud_title = "Locations",
+- deps = [
+- ":location_ruby_grpc",
+- ":location_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-location-ruby",
+- deps = [
+- ":location_ruby_gapic",
+- ":location_ruby_grpc",
+- ":location_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "location_csharp_proto",
+- deps = [":location_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "location_csharp_grpc",
+- srcs = [":location_proto"],
+- deps = [":location_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "location_csharp_gapic",
+- srcs = [":location_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":location_csharp_grpc",
+- ":location_csharp_proto",
+- ],
+-)
+-
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-location-csharp",
+- deps = [
+- ":location_csharp_gapic",
+- ":location_csharp_grpc",
+- ":location_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "location_cc_proto",
+- deps = [":location_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "location_cc_grpc",
+- srcs = [":location_proto"],
+- grpc_only = True,
+- deps = [":location_cc_proto"],
+-)
+diff -urN a/google/cloud/managedidentities/BUILD.bazel b/google/cloud/managedidentities/BUILD.bazel
+--- a/google/cloud/managedidentities/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/managedidentities/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-managed_identities.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for managedidentities.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "managedidentities_ruby_wrapper",
+- srcs = ["//google/cloud/managedidentities/v1:managedidentities_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-managed_identities",
+- "ruby-cloud-env-prefix=MANAGED_IDENTITIES",
+- "ruby-cloud-wrapper-of=v1:0.3",
+- "ruby-cloud-product-url=https://cloud.google.com/managed-microsoft-ad/",
+- "ruby-cloud-api-id=managedidentities.googleapis.com",
+- "ruby-cloud-api-shortname=managedidentities",
+- ],
+- ruby_cloud_description = "The Managed Service for Microsoft Active Directory API is used for managing a highly available, hardened service running Microsoft Active Directory.",
+- ruby_cloud_title = "Managed Service for Microsoft Active Directory API",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-managedidentities-ruby",
+- deps = [
+- ":managedidentities_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/managedidentities/v1/BUILD.bazel b/google/cloud/managedidentities/v1/BUILD.bazel
+--- a/google/cloud/managedidentities/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/managedidentities/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,387 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "managedidentities_proto",
+- srcs = [
+- "managed_identities_service.proto",
+- "resource.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "managedidentities_proto_with_info",
+- deps = [
+- ":managedidentities_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "managedidentities_java_proto",
+- deps = [":managedidentities_proto"],
+-)
+-
+-java_grpc_library(
+- name = "managedidentities_java_grpc",
+- srcs = [":managedidentities_proto"],
+- deps = [":managedidentities_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "managedidentities_java_gapic",
+- srcs = [":managedidentities_proto_with_info"],
+- grpc_service_config = "managedidentities_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":managedidentities_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":managedidentities_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "managedidentities_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.managedidentities.v1.ManagedIdentitiesServiceClientTest",
+- ],
+- runtime_deps = [":managedidentities_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-managedidentities-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":managedidentities_java_gapic",
+- ":managedidentities_java_grpc",
+- ":managedidentities_java_proto",
+- ":managedidentities_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "managedidentities_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/managedidentities/v1",
+- protos = [":managedidentities_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "managedidentities_go_gapic",
+- srcs = [":managedidentities_proto_with_info"],
+- grpc_service_config = "managedidentities_grpc_service_config.json",
+- importpath = "cloud.google.com/go/managedidentities/apiv1;managedidentities",
+- rest_numeric_enums = False,
+- service_yaml = "managedidentities_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":managedidentities_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "managedidentities_go_gapic_test",
+- srcs = [":managedidentities_go_gapic_srcjar_test"],
+- embed = [":managedidentities_go_gapic"],
+- importpath = "cloud.google.com/go/managedidentities/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-managedidentities-v1-go",
+- deps = [
+- ":managedidentities_go_gapic",
+- ":managedidentities_go_gapic_srcjar-test.srcjar",
+- ":managedidentities_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "managedidentities_py_gapic",
+- srcs = [":managedidentities_proto"],
+- grpc_service_config = "managedidentities_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-managed-identities"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "managedidentities_py_gapic_test",
+- srcs = [
+- "managedidentities_py_gapic_pytest.py",
+- "managedidentities_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":managedidentities_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "managedidentities-v1-py",
+- deps = [
+- ":managedidentities_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "managedidentities_php_proto",
+- deps = [":managedidentities_proto"],
+-)
+-
+-php_grpc_library(
+- name = "managedidentities_php_grpc",
+- srcs = [":managedidentities_proto"],
+- deps = [":managedidentities_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "managedidentities_php_gapic",
+- srcs = [":managedidentities_proto_with_info"],
+- grpc_service_config = "managedidentities_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "managedidentities_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":managedidentities_php_grpc",
+- ":managedidentities_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-managedidentities-v1-php",
+- deps = [
+- ":managedidentities_php_gapic",
+- ":managedidentities_php_grpc",
+- ":managedidentities_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "managedidentities_nodejs_gapic",
+- package_name = "@google-cloud/managed-identities",
+- src = ":managedidentities_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "managedidentities_grpc_service_config.json",
+- package = "google.cloud.managedidentities.v1",
+- rest_numeric_enums = False,
+- service_yaml = "managedidentities_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "managedidentities-v1-nodejs",
+- deps = [
+- ":managedidentities_nodejs_gapic",
+- ":managedidentities_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "managedidentities_ruby_proto",
+- deps = [":managedidentities_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "managedidentities_ruby_grpc",
+- srcs = [":managedidentities_proto"],
+- deps = [":managedidentities_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "managedidentities_ruby_gapic",
+- srcs = [":managedidentities_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-managed_identities-v1",
+- "ruby-cloud-env-prefix=MANAGED_IDENTITIES",
+- "ruby-cloud-product-url=https://cloud.google.com/managed-microsoft-ad/",
+- "ruby-cloud-api-id=managedidentities.googleapis.com",
+- "ruby-cloud-api-shortname=managedidentities",
+- ],
+- grpc_service_config = "managedidentities_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Managed Service for Microsoft Active Directory API is used for managing a highly available, hardened service running Microsoft Active Directory.",
+- ruby_cloud_title = "Managed Service for Microsoft Active Directory API V1",
+- deps = [
+- ":managedidentities_ruby_grpc",
+- ":managedidentities_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-managedidentities-v1-ruby",
+- deps = [
+- ":managedidentities_ruby_gapic",
+- ":managedidentities_ruby_grpc",
+- ":managedidentities_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "managedidentities_csharp_proto",
+- deps = [":managedidentities_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "managedidentities_csharp_grpc",
+- srcs = [":managedidentities_proto"],
+- deps = [":managedidentities_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "managedidentities_csharp_gapic",
+- srcs = [":managedidentities_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "managedidentities_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "managedidentities_v1.yaml",
+- deps = [
+- ":managedidentities_csharp_grpc",
+- ":managedidentities_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-managedidentities-v1-csharp",
+- deps = [
+- ":managedidentities_csharp_gapic",
+- ":managedidentities_csharp_grpc",
+- ":managedidentities_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "managedidentities_cc_proto",
+- deps = [":managedidentities_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "managedidentities_cc_grpc",
+- srcs = [":managedidentities_proto"],
+- grpc_only = True,
+- deps = [":managedidentities_cc_proto"],
+-)
+diff -urN a/google/cloud/managedidentities/v1beta1/BUILD.bazel b/google/cloud/managedidentities/v1beta1/BUILD.bazel
+--- a/google/cloud/managedidentities/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/managedidentities/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,383 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "managedidentities_proto",
+- srcs = [
+- "managed_identities_service.proto",
+- "resource.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "managedidentities_proto_with_info",
+- deps = [
+- ":managedidentities_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "managedidentities_java_proto",
+- deps = [":managedidentities_proto"],
+-)
+-
+-java_grpc_library(
+- name = "managedidentities_java_grpc",
+- srcs = [":managedidentities_proto"],
+- deps = [":managedidentities_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "managedidentities_java_gapic",
+- srcs = [":managedidentities_proto_with_info"],
+- gapic_yaml = "managedidentities_gapic.yaml",
+- grpc_service_config = "managedidentities_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "managedidentities_v1beta1.yaml",
+- test_deps = [
+- ":managedidentities_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":managedidentities_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "managedidentities_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.managedidentities.v1beta1.ManagedIdentitiesServiceClientTest",
+- ],
+- runtime_deps = [":managedidentities_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-managedidentities-v1beta1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":managedidentities_java_gapic",
+- ":managedidentities_java_grpc",
+- ":managedidentities_java_proto",
+- ":managedidentities_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "managedidentities_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/managedidentities/v1beta1",
+- protos = [":managedidentities_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "managedidentities_go_gapic",
+- srcs = [":managedidentities_proto_with_info"],
+- grpc_service_config = "managedidentities_grpc_service_config.json",
+- importpath = "cloud.google.com/go/managedidentities/apiv1beta1;managedidentities",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "managedidentities_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":managedidentities_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "managedidentities_go_gapic_test",
+- srcs = [":managedidentities_go_gapic_srcjar_test"],
+- embed = [":managedidentities_go_gapic"],
+- importpath = "cloud.google.com/go/managedidentities/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-managedidentities-v1beta1-go",
+- deps = [
+- ":managedidentities_go_gapic",
+- ":managedidentities_go_gapic_srcjar-metadata.srcjar",
+- ":managedidentities_go_gapic_srcjar-test.srcjar",
+- ":managedidentities_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "managedidentities_py_gapic",
+- srcs = [":managedidentities_proto"],
+- grpc_service_config = "managedidentities_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "managedidentities_py_gapic_test",
+- srcs = [
+- "managedidentities_py_gapic_pytest.py",
+- "managedidentities_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":managedidentities_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "managedidentities-v1beta1-py",
+- deps = [
+- ":managedidentities_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "managedidentities_php_proto",
+- deps = [":managedidentities_proto"],
+-)
+-
+-php_grpc_library(
+- name = "managedidentities_php_grpc",
+- srcs = [":managedidentities_proto"],
+- deps = [":managedidentities_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "managedidentities_php_gapic",
+- srcs = [":managedidentities_proto_with_info"],
+- grpc_service_config = "managedidentities_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "managedidentities_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":managedidentities_php_grpc",
+- ":managedidentities_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-managedidentities-v1beta1-php",
+- deps = [
+- ":managedidentities_php_gapic",
+- ":managedidentities_php_grpc",
+- ":managedidentities_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "managedidentities_nodejs_gapic",
+- package_name = "@google-cloud/managed-identities",
+- src = ":managedidentities_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "managedidentities_grpc_service_config.json",
+- package = "google.cloud.managedidentities.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "managedidentities_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "managedidentities-v1beta1-nodejs",
+- deps = [
+- ":managedidentities_nodejs_gapic",
+- ":managedidentities_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "managedidentities_ruby_proto",
+- deps = [":managedidentities_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "managedidentities_ruby_grpc",
+- srcs = [":managedidentities_proto"],
+- deps = [":managedidentities_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "managedidentities_ruby_gapic",
+- srcs = [":managedidentities_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-managedidentities-v1beta1"],
+- grpc_service_config = "managedidentities_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":managedidentities_ruby_grpc",
+- ":managedidentities_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-managedidentities-v1beta1-ruby",
+- deps = [
+- ":managedidentities_ruby_gapic",
+- ":managedidentities_ruby_grpc",
+- ":managedidentities_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "managedidentities_csharp_proto",
+- deps = [":managedidentities_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "managedidentities_csharp_grpc",
+- srcs = [":managedidentities_proto"],
+- deps = [":managedidentities_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "managedidentities_csharp_gapic",
+- srcs = [":managedidentities_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "managedidentities_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "managedidentities_v1beta1.yaml",
+- deps = [
+- ":managedidentities_csharp_grpc",
+- ":managedidentities_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-managedidentities-v1beta1-csharp",
+- deps = [
+- ":managedidentities_csharp_gapic",
+- ":managedidentities_csharp_grpc",
+- ":managedidentities_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "managedidentities_cc_proto",
+- deps = [":managedidentities_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "managedidentities_cc_grpc",
+- srcs = [":managedidentities_proto"],
+- grpc_only = True,
+- deps = [":managedidentities_cc_proto"],
+-)
+diff -urN a/google/cloud/mediatranslation/BUILD.bazel b/google/cloud/mediatranslation/BUILD.bazel
+--- a/google/cloud/mediatranslation/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/mediatranslation/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-media_translation.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for mediatranslation.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta1 in this case.
+-ruby_cloud_gapic_library(
+- name = "mediatranslation_ruby_wrapper",
+- srcs = ["//google/cloud/mediatranslation/v1beta1:mediatranslation_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-media_translation",
+- "ruby-cloud-env-prefix=MEDIA_TRANSLATION",
+- "ruby-cloud-wrapper-of=v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/media-translation/",
+- "ruby-cloud-api-id=mediatranslation.googleapis.com",
+- "ruby-cloud-api-shortname=mediatranslation",
+- ],
+- ruby_cloud_description = "Media Translation API delivers real-time speech translation to your content and applications directly from your audio data. Leveraging Google’s machine learning technologies, the API offers enhanced accuracy and simplified integration while equipping you with a comprehensive set of features to further refine your translation results. Improve user experience with low-latency streaming translation and scale quickly with straightforward internationalization.",
+- ruby_cloud_title = "Media Translation",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-mediatranslation-ruby",
+- deps = [
+- ":mediatranslation_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/mediatranslation/v1alpha1/BUILD.bazel b/google/cloud/mediatranslation/v1alpha1/BUILD.bazel
+--- a/google/cloud/mediatranslation/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/mediatranslation/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,166 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "mediatranslation_proto",
+- srcs = [
+- "media_translation.proto",
+- ],
+- deps = [
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "mediatranslation_java_proto",
+- deps = [":mediatranslation_proto"],
+-)
+-
+-java_grpc_library(
+- name = "mediatranslation_java_grpc",
+- srcs = [":mediatranslation_proto"],
+- deps = [":mediatranslation_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "mediatranslation_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/mediatranslation/v1alpha1",
+- protos = [":mediatranslation_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "mediatranslation_moved_proto",
+- srcs = [":mediatranslation_proto"],
+- deps = [
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "mediatranslation_py_proto",
+- deps = [":mediatranslation_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "mediatranslation_py_grpc",
+- srcs = [":mediatranslation_moved_proto"],
+- deps = [":mediatranslation_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "mediatranslation_php_proto",
+- deps = [":mediatranslation_proto"],
+-)
+-
+-php_grpc_library(
+- name = "mediatranslation_php_grpc",
+- srcs = [":mediatranslation_proto"],
+- deps = [":mediatranslation_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "mediatranslation_ruby_proto",
+- deps = [":mediatranslation_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "mediatranslation_ruby_grpc",
+- srcs = [":mediatranslation_proto"],
+- deps = [":mediatranslation_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "mediatranslation_csharp_proto",
+- deps = [":mediatranslation_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "mediatranslation_csharp_grpc",
+- srcs = [":mediatranslation_proto"],
+- deps = [":mediatranslation_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/mediatranslation/v1beta1/BUILD.bazel b/google/cloud/mediatranslation/v1beta1/BUILD.bazel
+--- a/google/cloud/mediatranslation/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/mediatranslation/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,367 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "mediatranslation_proto",
+- srcs = [
+- "media_translation.proto",
+- ],
+- deps = [
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "mediatranslation_proto_with_info",
+- deps = [
+- ":mediatranslation_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "mediatranslation_java_proto",
+- deps = [":mediatranslation_proto"],
+-)
+-
+-java_grpc_library(
+- name = "mediatranslation_java_grpc",
+- srcs = [":mediatranslation_proto"],
+- deps = [":mediatranslation_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "mediatranslation_java_gapic",
+- srcs = [":mediatranslation_proto_with_info"],
+- grpc_service_config = "mediatranslation_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":mediatranslation_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":mediatranslation_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "mediatranslation_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.mediatranslation.v1beta1.SpeechTranslationServiceClientHttpJsonTest",
+- "com.google.cloud.mediatranslation.v1beta1.SpeechTranslationServiceClientTest",
+- ],
+- runtime_deps = [":mediatranslation_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-mediatranslation-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":mediatranslation_java_gapic",
+- ":mediatranslation_java_grpc",
+- ":mediatranslation_java_proto",
+- ":mediatranslation_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "mediatranslation_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/mediatranslation/v1beta1",
+- protos = [":mediatranslation_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "mediatranslation_go_gapic",
+- srcs = [":mediatranslation_proto_with_info"],
+- grpc_service_config = "mediatranslation_grpc_service_config.json",
+- importpath = "cloud.google.com/go/mediatranslation/apiv1beta1;mediatranslation",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "mediatranslation_v1beta1.yaml",
+- deps = [
+- ":mediatranslation_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "mediatranslation_go_gapic_test",
+- srcs = [":mediatranslation_go_gapic_srcjar_test"],
+- embed = [":mediatranslation_go_gapic"],
+- importpath = "cloud.google.com/go/mediatranslation/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-mediatranslation-v1beta1-go",
+- deps = [
+- ":mediatranslation_go_gapic",
+- ":mediatranslation_go_gapic_srcjar-metadata.srcjar",
+- ":mediatranslation_go_gapic_srcjar-test.srcjar",
+- ":mediatranslation_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "mediatranslation_py_gapic",
+- srcs = [":mediatranslation_proto"],
+- grpc_service_config = "mediatranslation_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-media-translation",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "mediatranslation_py_gapic_test",
+- srcs = [
+- "mediatranslation_py_gapic_pytest.py",
+- "mediatranslation_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":mediatranslation_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "mediatranslation-v1beta1-py",
+- deps = [
+- ":mediatranslation_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "mediatranslation_php_proto",
+- deps = [":mediatranslation_proto"],
+-)
+-
+-php_grpc_library(
+- name = "mediatranslation_php_grpc",
+- srcs = [":mediatranslation_proto"],
+- deps = [":mediatranslation_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "mediatranslation_php_gapic",
+- srcs = [":mediatranslation_proto_with_info"],
+- grpc_service_config = "mediatranslation_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "mediatranslation_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":mediatranslation_php_grpc",
+- ":mediatranslation_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-mediatranslation-v1beta1-php",
+- deps = [
+- ":mediatranslation_php_gapic",
+- ":mediatranslation_php_grpc",
+- ":mediatranslation_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "mediatranslation_nodejs_gapic",
+- package_name = "@google-cloud/media-translation",
+- src = ":mediatranslation_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "mediatranslation_grpc_service_config.json",
+- package = "google.cloud.mediatranslation.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "mediatranslation_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "mediatranslation-v1beta1-nodejs",
+- deps = [
+- ":mediatranslation_nodejs_gapic",
+- ":mediatranslation_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "mediatranslation_ruby_proto",
+- deps = [":mediatranslation_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "mediatranslation_ruby_grpc",
+- srcs = [":mediatranslation_proto"],
+- deps = [":mediatranslation_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "mediatranslation_ruby_gapic",
+- srcs = [":mediatranslation_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=mediatranslation.googleapis.com",
+- "ruby-cloud-api-shortname=mediatranslation",
+- "ruby-cloud-env-prefix=MEDIA_TRANSLATION",
+- "ruby-cloud-gem-name=google-cloud-media_translation-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/media-translation/",
+- ],
+- grpc_service_config = "mediatranslation_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Media Translation API delivers real-time speech translation to your content and applications directly from your audio data. Leveraging Google’s machine learning technologies, the API offers enhanced accuracy and simplified integration while equipping you with a comprehensive set of features to further refine your translation results. Improve user experience with low-latency streaming translation and scale quickly with straightforward internationalization.",
+- ruby_cloud_title = "Media Translation V1beta1",
+- deps = [
+- ":mediatranslation_ruby_grpc",
+- ":mediatranslation_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-mediatranslation-v1beta1-ruby",
+- deps = [
+- ":mediatranslation_ruby_gapic",
+- ":mediatranslation_ruby_grpc",
+- ":mediatranslation_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "mediatranslation_csharp_proto",
+- deps = [":mediatranslation_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "mediatranslation_csharp_grpc",
+- srcs = [":mediatranslation_proto"],
+- deps = [":mediatranslation_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "mediatranslation_csharp_gapic",
+- srcs = [":mediatranslation_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "mediatranslation_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "mediatranslation_v1beta1.yaml",
+- deps = [
+- ":mediatranslation_csharp_grpc",
+- ":mediatranslation_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-mediatranslation-v1beta1-csharp",
+- deps = [
+- ":mediatranslation_csharp_gapic",
+- ":mediatranslation_csharp_grpc",
+- ":mediatranslation_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/memcache/BUILD.bazel b/google/cloud/memcache/BUILD.bazel
+--- a/google/cloud/memcache/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/memcache/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-memcache.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for memcache.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta2 in this case.
+-ruby_cloud_gapic_library(
+- name = "memcache_ruby_wrapper",
+- srcs = ["//google/cloud/memcache/v1beta2:memcache_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-memcache",
+- "ruby-cloud-env-prefix=MEMCACHE",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta2:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/memorystore/docs/memcached/",
+- "ruby-cloud-api-id=memcache.googleapis.com",
+- "ruby-cloud-api-shortname=memcache",
+- ],
+- ruby_cloud_description = "Google Cloud Memorystore for Memcached API is used for creating and managing Memcached instances in GCP.",
+- ruby_cloud_title = "Google Cloud Memorystore for Memcached",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-memcache-ruby",
+- deps = [
+- ":memcache_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/memcache/v1/BUILD.bazel b/google/cloud/memcache/v1/BUILD.bazel
+--- a/google/cloud/memcache/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/memcache/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,405 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "memcache_proto",
+- srcs = [
+- "cloud_memcache.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:dayofweek_proto",
+- "//google/type:timeofday_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "memcache_proto_with_info",
+- deps = [
+- ":memcache_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "memcache_java_proto",
+- deps = [":memcache_proto"],
+-)
+-
+-java_grpc_library(
+- name = "memcache_java_grpc",
+- srcs = [":memcache_proto"],
+- deps = [":memcache_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "memcache_java_gapic",
+- srcs = [":memcache_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "memcache_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "memcache_v1.yaml",
+- test_deps = [
+- ":memcache_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":memcache_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "memcache_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.memcache.v1.CloudMemcacheClientHttpJsonTest",
+- "com.google.cloud.memcache.v1.CloudMemcacheClientTest",
+- ],
+- runtime_deps = [":memcache_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-memcache-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":memcache_java_gapic",
+- ":memcache_java_grpc",
+- ":memcache_java_proto",
+- ":memcache_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "memcache_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/memcache/v1",
+- protos = [":memcache_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:dayofweek_go_proto",
+- "//google/type:timeofday_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "memcache_go_gapic",
+- srcs = [":memcache_proto_with_info"],
+- grpc_service_config = "memcache_grpc_service_config.json",
+- importpath = "cloud.google.com/go/memcache/apiv1;memcache",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "memcache_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":memcache_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "memcache_go_gapic_test",
+- srcs = [":memcache_go_gapic_srcjar_test"],
+- embed = [":memcache_go_gapic"],
+- importpath = "cloud.google.com/go/memcache/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-memcache-v1-go",
+- deps = [
+- ":memcache_go_gapic",
+- ":memcache_go_gapic_srcjar-metadata.srcjar",
+- ":memcache_go_gapic_srcjar-test.srcjar",
+- ":memcache_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "memcache_py_gapic",
+- srcs = [":memcache_proto"],
+- grpc_service_config = "memcache_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "memcache_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "memcache_py_gapic_test",
+- srcs = [
+- "memcache_py_gapic_pytest.py",
+- "memcache_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":memcache_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "memcache-v1-py",
+- deps = [
+- ":memcache_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "memcache_php_proto",
+- deps = [":memcache_proto"],
+-)
+-
+-php_grpc_library(
+- name = "memcache_php_grpc",
+- srcs = [":memcache_proto"],
+- deps = [":memcache_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "memcache_php_gapic",
+- srcs = [":memcache_proto_with_info"],
+- grpc_service_config = "memcache_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "memcache_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":memcache_php_grpc",
+- ":memcache_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-memcache-v1-php",
+- deps = [
+- ":memcache_php_gapic",
+- ":memcache_php_grpc",
+- ":memcache_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "memcache_nodejs_gapic",
+- package_name = "@google-cloud/memcache",
+- src = ":memcache_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "memcache_grpc_service_config.json",
+- package = "google.cloud.memcache.v1",
+- rest_numeric_enums = False,
+- service_yaml = "memcache_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "memcache-v1-nodejs",
+- deps = [
+- ":memcache_nodejs_gapic",
+- ":memcache_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "memcache_ruby_proto",
+- deps = [":memcache_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "memcache_ruby_grpc",
+- srcs = [":memcache_proto"],
+- deps = [":memcache_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "memcache_ruby_gapic",
+- srcs = [":memcache_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=memcache.googleapis.com",
+- "ruby-cloud-api-shortname=memcache",
+- "ruby-cloud-env-prefix=MEMCACHE",
+- "ruby-cloud-gem-name=google-cloud-memcache-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/memorystore/docs/memcached/",
+- ],
+- grpc_service_config = "memcache_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Google Cloud Memorystore for Memcached API is used for creating and managing Memcached instances in GCP.",
+- ruby_cloud_title = "Google Cloud Memorystore for Memcached V1",
+- service_yaml = "memcache_v1.yaml",
+- deps = [
+- ":memcache_ruby_grpc",
+- ":memcache_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-memcache-v1-ruby",
+- deps = [
+- ":memcache_ruby_gapic",
+- ":memcache_ruby_grpc",
+- ":memcache_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "memcache_csharp_proto",
+- deps = [":memcache_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "memcache_csharp_grpc",
+- srcs = [":memcache_proto"],
+- deps = [":memcache_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "memcache_csharp_gapic",
+- srcs = [":memcache_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "memcache_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "memcache_v1.yaml",
+- deps = [
+- ":memcache_csharp_grpc",
+- ":memcache_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-memcache-v1-csharp",
+- deps = [
+- ":memcache_csharp_gapic",
+- ":memcache_csharp_grpc",
+- ":memcache_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "memcache_cc_proto",
+- deps = [":memcache_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "memcache_cc_grpc",
+- srcs = [":memcache_proto"],
+- grpc_only = True,
+- deps = [":memcache_cc_proto"],
+-)
+diff -urN a/google/cloud/memcache/v1beta2/BUILD.bazel b/google/cloud/memcache/v1beta2/BUILD.bazel
+--- a/google/cloud/memcache/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/memcache/v1beta2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,405 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "memcache_proto",
+- srcs = [
+- "cloud_memcache.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:dayofweek_proto",
+- "//google/type:timeofday_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "memcache_proto_with_info",
+- deps = [
+- ":memcache_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "memcache_java_proto",
+- deps = [":memcache_proto"],
+-)
+-
+-java_grpc_library(
+- name = "memcache_java_grpc",
+- srcs = [":memcache_proto"],
+- deps = [":memcache_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "memcache_java_gapic",
+- srcs = [":memcache_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "memcache_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "memcache_v1beta2.yaml",
+- test_deps = [
+- ":memcache_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":memcache_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "memcache_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.memcache.v1beta2.CloudMemcacheClientHttpJsonTest",
+- "com.google.cloud.memcache.v1beta2.CloudMemcacheClientTest",
+- ],
+- runtime_deps = [":memcache_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-memcache-v1beta2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":memcache_java_gapic",
+- ":memcache_java_grpc",
+- ":memcache_java_proto",
+- ":memcache_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "memcache_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/memcache/v1beta2",
+- protos = [":memcache_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:dayofweek_go_proto",
+- "//google/type:timeofday_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "memcache_go_gapic",
+- srcs = [":memcache_proto_with_info"],
+- grpc_service_config = "memcache_grpc_service_config.json",
+- importpath = "cloud.google.com/go/memcache/apiv1beta2;memcache",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "memcache_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":memcache_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "memcache_go_gapic_test",
+- srcs = [":memcache_go_gapic_srcjar_test"],
+- embed = [":memcache_go_gapic"],
+- importpath = "cloud.google.com/go/memcache/apiv1beta2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-memcache-v1beta2-go",
+- deps = [
+- ":memcache_go_gapic",
+- ":memcache_go_gapic_srcjar-metadata.srcjar",
+- ":memcache_go_gapic_srcjar-test.srcjar",
+- ":memcache_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "memcache_py_gapic",
+- srcs = [":memcache_proto"],
+- grpc_service_config = "memcache_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "memcache_v1beta2.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "memcache_py_gapic_test",
+- srcs = [
+- "memcache_py_gapic_pytest.py",
+- "memcache_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":memcache_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "memcache-v1beta2-py",
+- deps = [
+- ":memcache_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "memcache_php_proto",
+- deps = [":memcache_proto"],
+-)
+-
+-php_grpc_library(
+- name = "memcache_php_grpc",
+- srcs = [":memcache_proto"],
+- deps = [":memcache_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "memcache_php_gapic",
+- srcs = [":memcache_proto_with_info"],
+- grpc_service_config = "memcache_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "memcache_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":memcache_php_grpc",
+- ":memcache_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-memcache-v1beta2-php",
+- deps = [
+- ":memcache_php_gapic",
+- ":memcache_php_grpc",
+- ":memcache_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "memcache_nodejs_gapic",
+- package_name = "@google-cloud/memcache",
+- src = ":memcache_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "memcache_grpc_service_config.json",
+- package = "google.cloud.memcache.v1beta2",
+- rest_numeric_enums = False,
+- service_yaml = "memcache_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "memcache-v1beta2-nodejs",
+- deps = [
+- ":memcache_nodejs_gapic",
+- ":memcache_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "memcache_ruby_proto",
+- deps = [":memcache_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "memcache_ruby_grpc",
+- srcs = [":memcache_proto"],
+- deps = [":memcache_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "memcache_ruby_gapic",
+- srcs = [":memcache_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=memcache.googleapis.com",
+- "ruby-cloud-api-shortname=memcache",
+- "ruby-cloud-env-prefix=MEMCACHE",
+- "ruby-cloud-gem-name=google-cloud-memcache-v1beta2",
+- "ruby-cloud-product-url=https://cloud.google.com/memorystore/docs/memcached/",
+- ],
+- grpc_service_config = "memcache_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Google Cloud Memorystore for Memcached API is used for creating and managing Memcached instances in GCP.",
+- ruby_cloud_title = "Google Cloud Memorystore for Memcached",
+- service_yaml = "memcache_v1beta2.yaml",
+- deps = [
+- ":memcache_ruby_grpc",
+- ":memcache_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-memcache-v1beta2-ruby",
+- deps = [
+- ":memcache_ruby_gapic",
+- ":memcache_ruby_grpc",
+- ":memcache_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "memcache_csharp_proto",
+- deps = [":memcache_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "memcache_csharp_grpc",
+- srcs = [":memcache_proto"],
+- deps = [":memcache_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "memcache_csharp_gapic",
+- srcs = [":memcache_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "memcache_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "memcache_v1beta2.yaml",
+- deps = [
+- ":memcache_csharp_grpc",
+- ":memcache_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-memcache-v1beta2-csharp",
+- deps = [
+- ":memcache_csharp_gapic",
+- ":memcache_csharp_grpc",
+- ":memcache_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "memcache_cc_proto",
+- deps = [":memcache_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "memcache_cc_grpc",
+- srcs = [":memcache_proto"],
+- grpc_only = True,
+- deps = [":memcache_cc_proto"],
+-)
+diff -urN a/google/cloud/metastore/BUILD.bazel b/google/cloud/metastore/BUILD.bazel
+--- a/google/cloud/metastore/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/metastore/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-metastore.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for metastore.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "metastore_ruby_wrapper",
+- srcs = ["//google/cloud/metastore/v1:metastore_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-metastore",
+- "ruby-cloud-env-prefix=METASTORE",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/dataproc-metastore/",
+- "ruby-cloud-api-id=metastore.googleapis.com",
+- "ruby-cloud-api-shortname=metastore",
+- ],
+- ruby_cloud_description = "Dataproc Metastore is a fully managed, highly available within a region, autohealing serverless Apache Hive metastore (HMS) on Google Cloud for data analytics products. It supports HMS and serves as a critical component for managing the metadata of relational entities and provides interoperability between data processing applications in the open source data ecosystem.",
+- ruby_cloud_title = "Dataproc Metastore",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-metastore-ruby",
+- deps = [
+- ":metastore_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/metastore/logging/v1/BUILD.bazel b/google/cloud/metastore/logging/v1/BUILD.bazel
+--- a/google/cloud/metastore/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/metastore/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,171 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "log_streams.proto",
+- ],
+- deps = [],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/metastore/logging/v1",
+- protos = [":logging_proto"],
+- deps = [],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/metastore/v1/BUILD.bazel b/google/cloud/metastore/v1/BUILD.bazel
+--- a/google/cloud/metastore/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/metastore/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,398 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "metastore_proto",
+- srcs = [
+- "metastore.proto",
+- "metastore_federation.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:dayofweek_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "metastore_proto_with_info",
+- deps = [
+- ":metastore_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "metastore_java_proto",
+- deps = [":metastore_proto"],
+-)
+-
+-java_grpc_library(
+- name = "metastore_java_grpc",
+- srcs = [":metastore_proto"],
+- deps = [":metastore_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "metastore_java_gapic",
+- srcs = [":metastore_proto_with_info"],
+- gapic_yaml = "metastore_gapic.yaml",
+- grpc_service_config = "metastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":metastore_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":metastore_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "metastore_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.metastore.v1.DataprocMetastoreClientHttpJsonTest",
+- "com.google.cloud.metastore.v1.DataprocMetastoreClientTest",
+- ],
+- runtime_deps = [":metastore_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-metastore-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":metastore_java_gapic",
+- ":metastore_java_grpc",
+- ":metastore_java_proto",
+- ":metastore_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "metastore_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/metastore/v1",
+- protos = [":metastore_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:dayofweek_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "metastore_go_gapic",
+- srcs = [":metastore_proto_with_info"],
+- grpc_service_config = "metastore_grpc_service_config.json",
+- importpath = "cloud.google.com/go/metastore/apiv1;metastore",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "metastore_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":metastore_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "metastore_go_gapic_test",
+- srcs = [":metastore_go_gapic_srcjar_test"],
+- embed = [":metastore_go_gapic"],
+- importpath = "cloud.google.com/go/metastore/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-metastore-v1-go",
+- deps = [
+- ":metastore_go_gapic",
+- ":metastore_go_gapic_srcjar-metadata.srcjar",
+- ":metastore_go_gapic_srcjar-test.srcjar",
+- ":metastore_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "metastore_py_gapic",
+- srcs = [":metastore_proto"],
+- grpc_service_config = "metastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- opt_args = [
+- "warehouse-package-name=google-cloud-dataproc-metastore",
+- ],
+-)
+-
+-py_test(
+- name = "metastore_py_gapic_test",
+- srcs = [
+- "metastore_py_gapic_pytest.py",
+- "metastore_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":metastore_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "metastore-v1-py",
+- deps = [
+- ":metastore_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "metastore_php_proto",
+- deps = [":metastore_proto"],
+-)
+-
+-php_grpc_library(
+- name = "metastore_php_grpc",
+- srcs = [":metastore_proto"],
+- deps = [":metastore_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "metastore_php_gapic",
+- srcs = [":metastore_proto_with_info"],
+- grpc_service_config = "metastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "metastore_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":metastore_php_grpc",
+- ":metastore_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-metastore-v1-php",
+- deps = [
+- ":metastore_php_gapic",
+- ":metastore_php_grpc",
+- ":metastore_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "metastore_nodejs_gapic",
+- package_name = "@google-cloud/dataproc-metastore",
+- src = ":metastore_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "metastore_grpc_service_config.json",
+- package = "google.cloud.metastore.v1",
+- rest_numeric_enums = False,
+- service_yaml = "metastore_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "metastore-v1-nodejs",
+- deps = [
+- ":metastore_nodejs_gapic",
+- ":metastore_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "metastore_ruby_proto",
+- deps = [":metastore_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "metastore_ruby_grpc",
+- srcs = [":metastore_proto"],
+- deps = [":metastore_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "metastore_ruby_gapic",
+- srcs = [":metastore_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-metastore-v1",
+- "ruby-cloud-env-prefix=METASTORE",
+- "ruby-cloud-product-url=https://cloud.google.com/dataproc-metastore/",
+- "ruby-cloud-api-id=metastore.googleapis.com",
+- "ruby-cloud-api-shortname=metastore",
+- ],
+- grpc_service_config = "metastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Dataproc Metastore is a fully managed, highly available within a region, autohealing serverless Apache Hive metastore (HMS) on Google Cloud for data analytics products. It supports HMS and serves as a critical component for managing the metadata of relational entities and provides interoperability between data processing applications in the open source data ecosystem.",
+- ruby_cloud_title = "Dataproc Metastore V1",
+- deps = [
+- ":metastore_ruby_grpc",
+- ":metastore_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-metastore-v1-ruby",
+- deps = [
+- ":metastore_ruby_gapic",
+- ":metastore_ruby_grpc",
+- ":metastore_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "metastore_csharp_proto",
+- deps = [":metastore_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "metastore_csharp_grpc",
+- srcs = [":metastore_proto"],
+- deps = [":metastore_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "metastore_csharp_gapic",
+- srcs = [":metastore_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "metastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "metastore_v1.yaml",
+- deps = [
+- ":metastore_csharp_grpc",
+- ":metastore_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-metastore-v1-csharp",
+- deps = [
+- ":metastore_csharp_gapic",
+- ":metastore_csharp_grpc",
+- ":metastore_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "metastore_cc_proto",
+- deps = [":metastore_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "metastore_cc_grpc",
+- srcs = [":metastore_proto"],
+- grpc_only = True,
+- deps = [":metastore_cc_proto"],
+-)
+diff -urN a/google/cloud/metastore/v1alpha/BUILD.bazel b/google/cloud/metastore/v1alpha/BUILD.bazel
+--- a/google/cloud/metastore/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/metastore/v1alpha/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,392 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "metastore_proto",
+- srcs = [
+- "metastore.proto",
+- "metastore_federation.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:dayofweek_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "metastore_proto_with_info",
+- deps = [
+- ":metastore_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "metastore_java_proto",
+- deps = [":metastore_proto"],
+-)
+-
+-java_grpc_library(
+- name = "metastore_java_grpc",
+- srcs = [":metastore_proto"],
+- deps = [":metastore_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "metastore_java_gapic",
+- srcs = [":metastore_proto_with_info"],
+- gapic_yaml = "metastore_gapic.yaml",
+- grpc_service_config = "metastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "metastore_v1alpha.yaml",
+- test_deps = [
+- ":metastore_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":metastore_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "metastore_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.metastore.v1alpha.DataprocMetastoreClientHttpJsonTest",
+- "com.google.cloud.metastore.v1alpha.DataprocMetastoreClientTest",
+- ],
+- runtime_deps = [":metastore_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-metastore-v1alpha-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":metastore_java_gapic",
+- ":metastore_java_grpc",
+- ":metastore_java_proto",
+- ":metastore_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "metastore_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/metastore/v1alpha",
+- protos = [":metastore_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:dayofweek_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "metastore_go_gapic",
+- srcs = [":metastore_proto_with_info"],
+- grpc_service_config = "metastore_grpc_service_config.json",
+- importpath = "cloud.google.com/go/metastore/apiv1alpha;metastore",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "metastore_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":metastore_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "metastore_go_gapic_test",
+- srcs = [":metastore_go_gapic_srcjar_test"],
+- embed = [":metastore_go_gapic"],
+- importpath = "cloud.google.com/go/metastore/apiv1alpha",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-metastore-v1alpha-go",
+- deps = [
+- ":metastore_go_gapic",
+- ":metastore_go_gapic_srcjar-metadata.srcjar",
+- ":metastore_go_gapic_srcjar-test.srcjar",
+- ":metastore_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "metastore_py_gapic",
+- srcs = [":metastore_proto"],
+- grpc_service_config = "metastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- opt_args = [
+- "warehouse-package-name=google-cloud-dataproc-metastore",
+- ],
+-)
+-
+-py_test(
+- name = "metastore_py_gapic_test",
+- srcs = [
+- "metastore_py_gapic_pytest.py",
+- "metastore_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":metastore_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "metastore-v1alpha-py",
+- deps = [
+- ":metastore_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "metastore_php_proto",
+- deps = [":metastore_proto"],
+-)
+-
+-php_grpc_library(
+- name = "metastore_php_grpc",
+- srcs = [":metastore_proto"],
+- deps = [":metastore_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "metastore_php_gapic",
+- srcs = [":metastore_proto_with_info"],
+- grpc_service_config = "metastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "metastore_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":metastore_php_grpc",
+- ":metastore_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-metastore-v1alpha-php",
+- deps = [
+- ":metastore_php_gapic",
+- ":metastore_php_grpc",
+- ":metastore_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "metastore_nodejs_gapic",
+- package_name = "@google-cloud/dataproc-metastore",
+- src = ":metastore_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "metastore_grpc_service_config.json",
+- package = "google.cloud.metastore.v1alpha",
+- rest_numeric_enums = False,
+- service_yaml = "metastore_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "metastore-v1alpha-nodejs",
+- deps = [
+- ":metastore_nodejs_gapic",
+- ":metastore_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "metastore_ruby_proto",
+- deps = [":metastore_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "metastore_ruby_grpc",
+- srcs = [":metastore_proto"],
+- deps = [":metastore_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "metastore_ruby_gapic",
+- srcs = [":metastore_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-metastore-v1alpha"],
+- grpc_service_config = "metastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":metastore_ruby_grpc",
+- ":metastore_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-metastore-v1alpha-ruby",
+- deps = [
+- ":metastore_ruby_gapic",
+- ":metastore_ruby_grpc",
+- ":metastore_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "metastore_csharp_proto",
+- deps = [":metastore_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "metastore_csharp_grpc",
+- srcs = [":metastore_proto"],
+- deps = [":metastore_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "metastore_csharp_gapic",
+- srcs = [":metastore_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "metastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "metastore_v1alpha.yaml",
+- deps = [
+- ":metastore_csharp_grpc",
+- ":metastore_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-metastore-v1alpha-csharp",
+- deps = [
+- ":metastore_csharp_gapic",
+- ":metastore_csharp_grpc",
+- ":metastore_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "metastore_cc_proto",
+- deps = [":metastore_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "metastore_cc_grpc",
+- srcs = [":metastore_proto"],
+- grpc_only = True,
+- deps = [":metastore_cc_proto"],
+-)
+diff -urN a/google/cloud/metastore/v1beta/BUILD.bazel b/google/cloud/metastore/v1beta/BUILD.bazel
+--- a/google/cloud/metastore/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/metastore/v1beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,383 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "metastore_proto",
+- srcs = [
+- "metastore.proto",
+- "metastore_federation.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:dayofweek_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "metastore_proto_with_info",
+- deps = [
+- ":metastore_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "metastore_java_proto",
+- deps = [":metastore_proto"],
+-)
+-
+-java_grpc_library(
+- name = "metastore_java_grpc",
+- srcs = [":metastore_proto"],
+- deps = [":metastore_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "metastore_java_gapic",
+- srcs = [":metastore_proto_with_info"],
+- gapic_yaml = "metastore_gapic.yaml",
+- grpc_service_config = "metastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":metastore_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":metastore_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "metastore_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.metastore.v1beta.DataprocMetastoreClientHttpJsonTest",
+- "com.google.cloud.metastore.v1beta.DataprocMetastoreClientTest",
+- ],
+- runtime_deps = [":metastore_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-metastore-v1beta-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":metastore_java_gapic",
+- ":metastore_java_grpc",
+- ":metastore_java_proto",
+- ":metastore_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "metastore_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/metastore/v1beta",
+- protos = [":metastore_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:dayofweek_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "metastore_go_gapic",
+- srcs = [":metastore_proto_with_info"],
+- grpc_service_config = "metastore_grpc_service_config.json",
+- importpath = "cloud.google.com/go/metastore/apiv1beta;metastore",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "metastore_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":metastore_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "metastore_go_gapic_test",
+- srcs = [":metastore_go_gapic_srcjar_test"],
+- embed = [":metastore_go_gapic"],
+- importpath = "cloud.google.com/go/metastore/apiv1beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-metastore-v1beta-go",
+- deps = [
+- ":metastore_go_gapic",
+- ":metastore_go_gapic_srcjar-metadata.srcjar",
+- ":metastore_go_gapic_srcjar-test.srcjar",
+- ":metastore_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "metastore_py_gapic",
+- srcs = [":metastore_proto"],
+- grpc_service_config = "metastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- opt_args = [
+- "warehouse-package-name=google-cloud-dataproc-metastore",
+- ],
+-)
+-
+-py_test(
+- name = "metastore_py_gapic_test",
+- srcs = [
+- "metastore_py_gapic_pytest.py",
+- "metastore_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":metastore_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "metastore-v1beta-py",
+- deps = [
+- ":metastore_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "metastore_php_proto",
+- deps = [":metastore_proto"],
+-)
+-
+-php_grpc_library(
+- name = "metastore_php_grpc",
+- srcs = [":metastore_proto"],
+- deps = [":metastore_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "metastore_php_gapic",
+- srcs = [":metastore_proto_with_info"],
+- gapic_yaml = "metastore_gapic.yaml",
+- grpc_service_config = "metastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "metastore_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":metastore_php_grpc",
+- ":metastore_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-metastore-v1beta-php",
+- deps = [
+- ":metastore_php_gapic",
+- ":metastore_php_grpc",
+- ":metastore_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "metastore_nodejs_gapic",
+- package_name = "@google-cloud/dataproc-metastore",
+- src = ":metastore_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "metastore_grpc_service_config.json",
+- package = "google.cloud.metastore.v1beta",
+- rest_numeric_enums = False,
+- service_yaml = "metastore_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "metastore-v1beta-nodejs",
+- deps = [
+- ":metastore_nodejs_gapic",
+- ":metastore_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "metastore_ruby_proto",
+- deps = [":metastore_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "metastore_ruby_grpc",
+- srcs = [":metastore_proto"],
+- deps = [":metastore_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "metastore_ruby_gapic",
+- srcs = [":metastore_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-metastore-v1beta",
+- "ruby-cloud-env-prefix=METASTORE",
+- "ruby-cloud-product-url=https://cloud.google.com/dataproc-metastore/",
+- "ruby-cloud-api-id=metastore.googleapis.com",
+- "ruby-cloud-api-shortname=metastore",
+- ],
+- grpc_service_config = "metastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Dataproc Metastore is a fully managed, highly available within a region, autohealing serverless Apache Hive metastore (HMS) on Google Cloud for data analytics products. It supports HMS and serves as a critical component for managing the metadata of relational entities and provides interoperability between data processing applications in the open source data ecosystem.",
+- ruby_cloud_title = "Dataproc Metastore V1beta",
+- deps = [
+- ":metastore_ruby_grpc",
+- ":metastore_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-metastore-v1beta-ruby",
+- deps = [
+- ":metastore_ruby_gapic",
+- ":metastore_ruby_grpc",
+- ":metastore_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "metastore_csharp_proto",
+- deps = [":metastore_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "metastore_csharp_grpc",
+- srcs = [":metastore_proto"],
+- deps = [":metastore_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "metastore_csharp_gapic",
+- srcs = [":metastore_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "metastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "metastore_v1beta.yaml",
+- deps = [
+- ":metastore_csharp_grpc",
+- ":metastore_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-metastore-v1beta-csharp",
+- deps = [
+- ":metastore_csharp_gapic",
+- ":metastore_csharp_grpc",
+- ":metastore_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/networkanalyzer/logging/v1/BUILD.bazel b/google/cloud/networkanalyzer/logging/v1/BUILD.bazel
+--- a/google/cloud/networkanalyzer/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/networkanalyzer/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,176 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "analyzer_log.proto",
+- ],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/networkanalyzer/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/networkconnectivity/BUILD.bazel b/google/cloud/networkconnectivity/BUILD.bazel
+--- a/google/cloud/networkconnectivity/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/networkconnectivity/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-network_connectivity.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for networkconnectivity.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "networkconnectivity_ruby_wrapper",
+- srcs = ["//google/cloud/networkconnectivity/v1:networkconnectivity_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-network_connectivity",
+- "ruby-cloud-env-prefix=NETWORK_CONNECTIVITY",
+- "ruby-cloud-wrapper-of=v1:0.4;v1alpha1:0.5",
+- "ruby-cloud-product-url=https://cloud.google.com/network-connectivity/docs",
+- "ruby-cloud-api-id=networkconnectivity.googleapis.com",
+- "ruby-cloud-api-shortname=networkconnectivity",
+- ],
+- ruby_cloud_description = "Network Connectivity is Google's suite of products that provide enterprise connectivity from your on-premises network or from another cloud provider to your Virtual Private Cloud (VPC) network.",
+- ruby_cloud_title = "Network Connectivity",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-networkconnectivity-ruby",
+- deps = [
+- ":networkconnectivity_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/networkconnectivity/v1/BUILD.bazel b/google/cloud/networkconnectivity/v1/BUILD.bazel
+--- a/google/cloud/networkconnectivity/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/networkconnectivity/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,395 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "networkconnectivity_proto",
+- srcs = [
+- "common.proto",
+- "hub.proto",
+- "policy_based_routing.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "networkconnectivity_proto_with_info",
+- deps = [
+- ":networkconnectivity_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "networkconnectivity_java_proto",
+- deps = [":networkconnectivity_proto"],
+-)
+-
+-java_grpc_library(
+- name = "networkconnectivity_java_grpc",
+- srcs = [":networkconnectivity_proto"],
+- deps = [":networkconnectivity_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "networkconnectivity_java_gapic",
+- srcs = [":networkconnectivity_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "networkconnectivity_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkconnectivity_v1.yaml",
+- test_deps = [
+- ":networkconnectivity_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":networkconnectivity_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "networkconnectivity_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.networkconnectivity.v1.HubServiceClientTest",
+- "com.google.cloud.networkconnectivity.v1.PolicyBasedRoutingServiceClientTest",
+- ],
+- runtime_deps = [":networkconnectivity_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-networkconnectivity-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":networkconnectivity_java_gapic",
+- ":networkconnectivity_java_grpc",
+- ":networkconnectivity_java_proto",
+- ":networkconnectivity_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "networkconnectivity_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1",
+- protos = [":networkconnectivity_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "networkconnectivity_go_gapic",
+- srcs = [":networkconnectivity_proto_with_info"],
+- grpc_service_config = "networkconnectivity_v1_grpc_service_config.json",
+- importpath = "cloud.google.com/go/networkconnectivity/apiv1;networkconnectivity",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "networkconnectivity_v1.yaml",
+- deps = [
+- ":networkconnectivity_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "networkconnectivity_go_gapic_test",
+- srcs = [":networkconnectivity_go_gapic_srcjar_test"],
+- embed = [":networkconnectivity_go_gapic"],
+- importpath = "cloud.google.com/go/networkconnectivity/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-networkconnectivity-v1-go",
+- deps = [
+- ":networkconnectivity_go_gapic",
+- ":networkconnectivity_go_gapic_srcjar-metadata.srcjar",
+- ":networkconnectivity_go_gapic_srcjar-test.srcjar",
+- ":networkconnectivity_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "networkconnectivity_py_gapic",
+- srcs = [":networkconnectivity_proto"],
+- grpc_service_config = "networkconnectivity_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- opt_args = ["warehouse-package-name=google-cloud-network-connectivity"],
+-)
+-
+-py_test(
+- name = "networkconnectivity_py_gapic_test",
+- srcs = [
+- "networkconnectivity_py_gapic_pytest.py",
+- "networkconnectivity_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":networkconnectivity_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "networkconnectivity-v1-py",
+- deps = [
+- ":networkconnectivity_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "networkconnectivity_php_proto",
+- deps = [":networkconnectivity_proto"],
+-)
+-
+-php_grpc_library(
+- name = "networkconnectivity_php_grpc",
+- srcs = [":networkconnectivity_proto"],
+- deps = [":networkconnectivity_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "networkconnectivity_php_gapic",
+- srcs = [":networkconnectivity_proto_with_info"],
+- grpc_service_config = "networkconnectivity_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkconnectivity_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":networkconnectivity_php_grpc",
+- ":networkconnectivity_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-networkconnectivity-v1-php",
+- deps = [
+- ":networkconnectivity_php_gapic",
+- ":networkconnectivity_php_grpc",
+- ":networkconnectivity_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "networkconnectivity_nodejs_gapic",
+- package_name = "@google-cloud/network-connectivity",
+- src = ":networkconnectivity_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "networkconnectivity_v1_grpc_service_config.json",
+- package = "google.cloud.networkconnectivity.v1",
+- rest_numeric_enums = False,
+- service_yaml = "networkconnectivity_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "networkconnectivity-v1-nodejs",
+- deps = [
+- ":networkconnectivity_nodejs_gapic",
+- ":networkconnectivity_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "networkconnectivity_ruby_proto",
+- deps = [":networkconnectivity_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "networkconnectivity_ruby_grpc",
+- srcs = [":networkconnectivity_proto"],
+- deps = [":networkconnectivity_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "networkconnectivity_ruby_gapic",
+- srcs = [":networkconnectivity_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=networkconnectivity.googleapis.com",
+- "ruby-cloud-api-shortname=networkconnectivity",
+- "ruby-cloud-env-prefix=NETWORK_CONNECTIVITY",
+- "ruby-cloud-gem-name=google-cloud-network_connectivity-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/network-connectivity/docs",
+- ],
+- grpc_service_config = "networkconnectivity_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Network Connectivity is Google's suite of products that provide enterprise connectivity from your on-premises network or from another cloud provider to your Virtual Private Cloud (VPC) network.",
+- ruby_cloud_title = "Network Connectivity V1",
+- deps = [
+- ":networkconnectivity_ruby_grpc",
+- ":networkconnectivity_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-networkconnectivity-v1-ruby",
+- deps = [
+- ":networkconnectivity_ruby_gapic",
+- ":networkconnectivity_ruby_grpc",
+- ":networkconnectivity_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "networkconnectivity_csharp_proto",
+- deps = [":networkconnectivity_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "networkconnectivity_csharp_grpc",
+- srcs = [":networkconnectivity_proto"],
+- deps = [":networkconnectivity_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "networkconnectivity_csharp_gapic",
+- srcs = [":networkconnectivity_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "networkconnectivity_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkconnectivity_v1.yaml",
+- deps = [
+- ":networkconnectivity_csharp_grpc",
+- ":networkconnectivity_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-networkconnectivity-v1-csharp",
+- deps = [
+- ":networkconnectivity_csharp_gapic",
+- ":networkconnectivity_csharp_grpc",
+- ":networkconnectivity_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "networkconnectivity_cc_proto",
+- deps = [":networkconnectivity_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "networkconnectivity_cc_grpc",
+- srcs = [":networkconnectivity_proto"],
+- grpc_only = True,
+- deps = [":networkconnectivity_cc_proto"],
+-)
+diff -urN a/google/cloud/networkconnectivity/v1alpha1/BUILD.bazel b/google/cloud/networkconnectivity/v1alpha1/BUILD.bazel
+--- a/google/cloud/networkconnectivity/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/networkconnectivity/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,372 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "networkconnectivity_proto",
+- srcs = [
+- "common.proto",
+- "hub.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "networkconnectivity_proto_with_info",
+- deps = [
+- ":networkconnectivity_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "networkconnectivity_java_proto",
+- deps = [":networkconnectivity_proto"],
+-)
+-
+-java_grpc_library(
+- name = "networkconnectivity_java_grpc",
+- srcs = [":networkconnectivity_proto"],
+- deps = [":networkconnectivity_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "networkconnectivity_java_gapic",
+- srcs = [":networkconnectivity_proto_with_info"],
+- grpc_service_config = "networkconnectivity_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":networkconnectivity_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":networkconnectivity_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "networkconnectivity_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.networkconnectivity.v1alpha1.HubServiceClientTest",
+- ],
+- runtime_deps = [":networkconnectivity_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-networkconnectivity-v1alpha1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":networkconnectivity_java_gapic",
+- ":networkconnectivity_java_grpc",
+- ":networkconnectivity_java_proto",
+- ":networkconnectivity_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "networkconnectivity_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1",
+- protos = [":networkconnectivity_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "networkconnectivity_go_gapic",
+- srcs = [":networkconnectivity_proto_with_info"],
+- grpc_service_config = "networkconnectivity_grpc_service_config.json",
+- importpath = "cloud.google.com/go/networkconnectivity/apiv1alpha1;networkconnectivity",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "networkconnectivity_v1alpha1.yaml",
+- deps = [
+- ":networkconnectivity_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "networkconnectivity_go_gapic_test",
+- srcs = [":networkconnectivity_go_gapic_srcjar_test"],
+- embed = [":networkconnectivity_go_gapic"],
+- importpath = "cloud.google.com/go/networkconnectivity/apiv1alpha1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-networkconnectivity-v1alpha1-go",
+- deps = [
+- ":networkconnectivity_go_gapic",
+- ":networkconnectivity_go_gapic_srcjar-metadata.srcjar",
+- ":networkconnectivity_go_gapic_srcjar-test.srcjar",
+- ":networkconnectivity_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "networkconnectivity_py_gapic",
+- srcs = [":networkconnectivity_proto"],
+- grpc_service_config = "networkconnectivity_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-network-connectivity"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "networkconnectivity_py_gapic_test",
+- srcs = [
+- "networkconnectivity_py_gapic_pytest.py",
+- "networkconnectivity_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":networkconnectivity_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "networkconnectivity-v1alpha1-py",
+- deps = [
+- ":networkconnectivity_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "networkconnectivity_php_proto",
+- deps = [":networkconnectivity_proto"],
+-)
+-
+-php_grpc_library(
+- name = "networkconnectivity_php_grpc",
+- srcs = [":networkconnectivity_proto"],
+- deps = [":networkconnectivity_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "networkconnectivity_php_gapic",
+- srcs = [":networkconnectivity_proto_with_info"],
+- grpc_service_config = "networkconnectivity_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkconnectivity_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":networkconnectivity_php_grpc",
+- ":networkconnectivity_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-networkconnectivity-v1alpha1-php",
+- deps = [
+- ":networkconnectivity_php_gapic",
+- ":networkconnectivity_php_grpc",
+- ":networkconnectivity_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "networkconnectivity_nodejs_gapic",
+- package_name = "@google-cloud/network-connectivity",
+- src = ":networkconnectivity_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "networkconnectivity_grpc_service_config.json",
+- package = "google.cloud.networkconnectivity.v1alpha1",
+- rest_numeric_enums = False,
+- service_yaml = "networkconnectivity_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "networkconnectivity-v1alpha1-nodejs",
+- deps = [
+- ":networkconnectivity_nodejs_gapic",
+- ":networkconnectivity_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "networkconnectivity_ruby_proto",
+- deps = [":networkconnectivity_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "networkconnectivity_ruby_grpc",
+- srcs = [":networkconnectivity_proto"],
+- deps = [":networkconnectivity_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "networkconnectivity_ruby_gapic",
+- srcs = [":networkconnectivity_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=networkconnectivity.googleapis.com",
+- "ruby-cloud-api-shortname=networkconnectivity",
+- "ruby-cloud-env-prefix=NETWORK_CONNECTIVITY",
+- "ruby-cloud-gem-name=google-cloud-network_connectivity-v1alpha1",
+- "ruby-cloud-product-url=https://cloud.google.com/network-connectivity/docs",
+- ],
+- grpc_service_config = "networkconnectivity_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Network Connectivity is Google's suite of products that provide enterprise connectivity from your on-premises network or from another cloud provider to your Virtual Private Cloud (VPC) network.",
+- ruby_cloud_title = "Network Connectivity V1alpha1",
+- deps = [
+- ":networkconnectivity_ruby_grpc",
+- ":networkconnectivity_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-networkconnectivity-v1alpha1-ruby",
+- deps = [
+- ":networkconnectivity_ruby_gapic",
+- ":networkconnectivity_ruby_grpc",
+- ":networkconnectivity_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "networkconnectivity_csharp_proto",
+- deps = [":networkconnectivity_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "networkconnectivity_csharp_grpc",
+- srcs = [":networkconnectivity_proto"],
+- deps = [":networkconnectivity_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "networkconnectivity_csharp_gapic",
+- srcs = [":networkconnectivity_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "networkconnectivity_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkconnectivity_v1alpha1.yaml",
+- deps = [
+- ":networkconnectivity_csharp_grpc",
+- ":networkconnectivity_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-networkconnectivity-v1alpha1-csharp",
+- deps = [
+- ":networkconnectivity_csharp_gapic",
+- ":networkconnectivity_csharp_grpc",
+- ":networkconnectivity_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/networkmanagement/BUILD.bazel b/google/cloud/networkmanagement/BUILD.bazel
+--- a/google/cloud/networkmanagement/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/networkmanagement/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-network_management.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for networkmanagement.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "networkmanagement_ruby_wrapper",
+- srcs = ["//google/cloud/networkmanagement/v1:networkmanagement_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-network_management",
+- "ruby-cloud-wrapper-of=v1:0.1",
+- "ruby-cloud-product-url=https://cloud.google.com/network-intelligence-center/docs/connectivity-tests/reference/networkmanagement/rest",
+- "ruby-cloud-api-id=networkmanagement.googleapis.com",
+- "ruby-cloud-api-shortname=networkmanagement",
+- ],
+- ruby_cloud_description = "The Network Management API provides a collection of network performance monitoring and diagnostic capabilities.",
+- ruby_cloud_title = "Network Management",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-networkmanagement-ruby",
+- deps = [
+- ":networkmanagement_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/networkmanagement/v1/BUILD.bazel b/google/cloud/networkmanagement/v1/BUILD.bazel
+--- a/google/cloud/networkmanagement/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/networkmanagement/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,396 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "networkmanagement_proto",
+- srcs = [
+- "connectivity_test.proto",
+- "reachability.proto",
+- "trace.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "networkmanagement_proto_with_info",
+- deps = [
+- ":networkmanagement_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "networkmanagement_java_proto",
+- deps = [":networkmanagement_proto"],
+-)
+-
+-java_grpc_library(
+- name = "networkmanagement_java_grpc",
+- srcs = [":networkmanagement_proto"],
+- deps = [":networkmanagement_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "networkmanagement_java_gapic",
+- srcs = [":networkmanagement_proto_with_info"],
+- grpc_service_config = "networkmanagement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":networkmanagement_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":networkmanagement_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "networkmanagement_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.networkmanagement.v1.ReachabilityServiceClientHttpJsonTest",
+- "com.google.cloud.networkmanagement.v1.ReachabilityServiceClientTest",
+- ],
+- runtime_deps = [":networkmanagement_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-networkmanagement-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":networkmanagement_java_gapic",
+- ":networkmanagement_java_grpc",
+- ":networkmanagement_java_proto",
+- ":networkmanagement_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "networkmanagement_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/networkmanagement/v1",
+- protos = [":networkmanagement_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "networkmanagement_go_gapic",
+- srcs = [":networkmanagement_proto_with_info"],
+- grpc_service_config = "networkmanagement_grpc_service_config.json",
+- importpath = "cloud.google.com/go/networkmanagement/apiv1;networkmanagement",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "networkmanagement_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":networkmanagement_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "networkmanagement_go_gapic_test",
+- srcs = [":networkmanagement_go_gapic_srcjar_test"],
+- embed = [":networkmanagement_go_gapic"],
+- importpath = "cloud.google.com/go/networkmanagement/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-networkmanagement-v1-go",
+- deps = [
+- ":networkmanagement_go_gapic",
+- ":networkmanagement_go_gapic_srcjar-metadata.srcjar",
+- ":networkmanagement_go_gapic_srcjar-test.srcjar",
+- ":networkmanagement_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "networkmanagement_py_gapic",
+- srcs = [":networkmanagement_proto"],
+- grpc_service_config = "networkmanagement_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-network-management",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=network_management",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1376 is fixed
+-#py_test(
+-# name = "networkmanagement_py_gapic_test",
+-# srcs = [
+-# "networkmanagement_py_gapic_pytest.py",
+-# "networkmanagement_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":networkmanagement_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "networkmanagement-v1-py",
+- deps = [
+- ":networkmanagement_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "networkmanagement_php_proto",
+- deps = [":networkmanagement_proto"],
+-)
+-
+-php_grpc_library(
+- name = "networkmanagement_php_grpc",
+- srcs = [":networkmanagement_proto"],
+- deps = [":networkmanagement_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "networkmanagement_php_gapic",
+- srcs = [":networkmanagement_proto_with_info"],
+- grpc_service_config = "networkmanagement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkmanagement_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":networkmanagement_php_grpc",
+- ":networkmanagement_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-networkmanagement-v1-php",
+- deps = [
+- ":networkmanagement_php_gapic",
+- ":networkmanagement_php_grpc",
+- ":networkmanagement_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "networkmanagement_nodejs_gapic",
+- package_name = "@google-cloud/network-management",
+- src = ":networkmanagement_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "networkmanagement_grpc_service_config.json",
+- package = "google.cloud.networkmanagement.v1",
+- rest_numeric_enums = False,
+- service_yaml = "networkmanagement_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "networkmanagement-v1-nodejs",
+- deps = [
+- ":networkmanagement_nodejs_gapic",
+- ":networkmanagement_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "networkmanagement_ruby_proto",
+- deps = [":networkmanagement_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "networkmanagement_ruby_grpc",
+- srcs = [":networkmanagement_proto"],
+- deps = [":networkmanagement_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "networkmanagement_ruby_gapic",
+- srcs = [":networkmanagement_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-network_management-v1",
+- "ruby-cloud-api-shortname=networkmanagement",
+- "ruby-cloud-api-id=networkmanagement.googleapis.com",
+- "ruby-cloud-product-url=https://cloud.google.com/network-intelligence-center/docs/connectivity-tests/reference/networkmanagement/rest",
+- ],
+- grpc_service_config = "networkmanagement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Network Management API provides a collection of network performance monitoring and diagnostic capabilities.",
+- ruby_cloud_title = "Network Management V1",
+- deps = [
+- ":networkmanagement_ruby_grpc",
+- ":networkmanagement_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-networkmanagement-v1-ruby",
+- deps = [
+- ":networkmanagement_ruby_gapic",
+- ":networkmanagement_ruby_grpc",
+- ":networkmanagement_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "networkmanagement_csharp_proto",
+- deps = [":networkmanagement_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "networkmanagement_csharp_grpc",
+- srcs = [":networkmanagement_proto"],
+- deps = [":networkmanagement_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "networkmanagement_csharp_gapic",
+- srcs = [":networkmanagement_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "networkmanagement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkmanagement_v1.yaml",
+- deps = [
+- ":networkmanagement_csharp_grpc",
+- ":networkmanagement_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-networkmanagement-v1-csharp",
+- deps = [
+- ":networkmanagement_csharp_gapic",
+- ":networkmanagement_csharp_grpc",
+- ":networkmanagement_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "networkmanagement_cc_proto",
+- deps = [":networkmanagement_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "networkmanagement_cc_grpc",
+- srcs = [":networkmanagement_proto"],
+- grpc_only = True,
+- deps = [":networkmanagement_cc_proto"],
+-)
+diff -urN a/google/cloud/networkmanagement/v1beta1/BUILD.bazel b/google/cloud/networkmanagement/v1beta1/BUILD.bazel
+--- a/google/cloud/networkmanagement/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/networkmanagement/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,375 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "networkmanagement_proto",
+- srcs = [
+- "connectivity_test.proto",
+- "reachability.proto",
+- "trace.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "networkmanagement_proto_with_info",
+- deps = [
+- ":networkmanagement_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "networkmanagement_java_proto",
+- deps = [":networkmanagement_proto"],
+-)
+-
+-java_grpc_library(
+- name = "networkmanagement_java_grpc",
+- srcs = [":networkmanagement_proto"],
+- deps = [":networkmanagement_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "networkmanagement_java_gapic",
+- srcs = [":networkmanagement_proto_with_info"],
+- grpc_service_config = "networkmanagement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":networkmanagement_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":networkmanagement_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "networkmanagement_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.networkmanagement.v1beta1.ReachabilityServiceClientHttpJsonTest",
+- "com.google.cloud.networkmanagement.v1beta1.ReachabilityServiceClientTest",
+- ],
+- runtime_deps = [":networkmanagement_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-networkmanagement-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":networkmanagement_java_gapic",
+- ":networkmanagement_java_grpc",
+- ":networkmanagement_java_proto",
+- ":networkmanagement_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "networkmanagement_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/networkmanagement/v1beta1",
+- protos = [":networkmanagement_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "networkmanagement_go_gapic",
+- srcs = [":networkmanagement_proto_with_info"],
+- grpc_service_config = "networkmanagement_grpc_service_config.json",
+- importpath = "cloud.google.com/go/networkmanagement/apiv1beta1;networkmanagement",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "networkmanagement_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":networkmanagement_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "networkmanagement_go_gapic_test",
+- srcs = [":networkmanagement_go_gapic_srcjar_test"],
+- embed = [":networkmanagement_go_gapic"],
+- importpath = "cloud.google.com/go/networkmanagement/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-networkmanagement-v1beta1-go",
+- deps = [
+- ":networkmanagement_go_gapic",
+- ":networkmanagement_go_gapic_srcjar-metadata.srcjar",
+- ":networkmanagement_go_gapic_srcjar-test.srcjar",
+- ":networkmanagement_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "networkmanagement_py_gapic",
+- srcs = [":networkmanagement_proto"],
+- grpc_service_config = "networkmanagement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1376 is fixed
+-#py_test(
+-# name = "networkmanagement_py_gapic_test",
+-# srcs = [
+-# "networkmanagement_py_gapic_pytest.py",
+-# "networkmanagement_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":networkmanagement_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "networkmanagement-v1beta1-py",
+- deps = [
+- ":networkmanagement_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "networkmanagement_php_proto",
+- deps = [":networkmanagement_proto"],
+-)
+-
+-php_grpc_library(
+- name = "networkmanagement_php_grpc",
+- srcs = [":networkmanagement_proto"],
+- deps = [":networkmanagement_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "networkmanagement_php_gapic",
+- srcs = [":networkmanagement_proto_with_info"],
+- grpc_service_config = "networkmanagement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkmanagement_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":networkmanagement_php_grpc",
+- ":networkmanagement_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-networkmanagement-v1beta1-php",
+- deps = [
+- ":networkmanagement_php_gapic",
+- ":networkmanagement_php_grpc",
+- ":networkmanagement_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "networkmanagement_nodejs_gapic",
+- package_name = "@google-cloud/network-management",
+- src = ":networkmanagement_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "networkmanagement_grpc_service_config.json",
+- package = "google.cloud.networkmanagement.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "networkmanagement_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "networkmanagement-v1beta1-nodejs",
+- deps = [
+- ":networkmanagement_nodejs_gapic",
+- ":networkmanagement_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "networkmanagement_ruby_proto",
+- deps = [":networkmanagement_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "networkmanagement_ruby_grpc",
+- srcs = [":networkmanagement_proto"],
+- deps = [":networkmanagement_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "networkmanagement_ruby_gapic",
+- srcs = [":networkmanagement_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-network_management-v1beta1",
+- "ruby-cloud-api-shortname=networkmanagement",
+- "ruby-cloud-api-id=networkmanagement.googleapis.com",
+- "ruby-cloud-product-url=https://cloud.google.com/network-intelligence-center/docs/connectivity-tests/reference/networkmanagement/rest",
+- ],
+- grpc_service_config = "networkmanagement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Network Management API provides a collection of network performance monitoring and diagnostic capabilities.",
+- ruby_cloud_title = "Network Management V1beta1",
+- deps = [
+- ":networkmanagement_ruby_grpc",
+- ":networkmanagement_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-networkmanagement-v1beta1-ruby",
+- deps = [
+- ":networkmanagement_ruby_gapic",
+- ":networkmanagement_ruby_grpc",
+- ":networkmanagement_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "networkmanagement_csharp_proto",
+- deps = [":networkmanagement_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "networkmanagement_csharp_grpc",
+- srcs = [":networkmanagement_proto"],
+- deps = [":networkmanagement_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "networkmanagement_csharp_gapic",
+- srcs = [":networkmanagement_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "networkmanagement_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkmanagement_v1beta1.yaml",
+- deps = [
+- ":networkmanagement_csharp_grpc",
+- ":networkmanagement_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-networkmanagement-v1beta1-csharp",
+- deps = [
+- ":networkmanagement_csharp_gapic",
+- ":networkmanagement_csharp_grpc",
+- ":networkmanagement_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/networksecurity/BUILD.bazel b/google/cloud/networksecurity/BUILD.bazel
+--- a/google/cloud/networksecurity/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/networksecurity/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-network_security.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for networksecurity.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta1 in this case.
+-ruby_cloud_gapic_library(
+- name = "networksecurity_ruby_wrapper",
+- srcs = ["//google/cloud/networksecurity/v1beta1:networksecurity_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-network_security",
+- "ruby-cloud-wrapper-of=v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/traffic-director/docs/reference/network-security/rest/",
+- "ruby-cloud-api-id=networksecurity.googleapis.com",
+- "ruby-cloud-api-shortname=networksecurity",
+- ],
+- ruby_cloud_description = "The client library for the Google Network Security V1beta1 API.",
+- ruby_cloud_title = "Network Security",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-networksecurity-ruby",
+- deps = [
+- ":networksecurity_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/networksecurity/v1/BUILD.bazel b/google/cloud/networksecurity/v1/BUILD.bazel
+--- a/google/cloud/networksecurity/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/networksecurity/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,335 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "networksecurity_proto",
+- srcs = [
+- "authorization_policy.proto",
+- "client_tls_policy.proto",
+- "common.proto",
+- "network_security.proto",
+- "server_tls_policy.proto",
+- "tls.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "networksecurity_proto_with_info",
+- deps = [
+- ":networksecurity_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "networksecurity_java_proto",
+- deps = [":networksecurity_proto"],
+-)
+-
+-java_grpc_library(
+- name = "networksecurity_java_grpc",
+- srcs = [":networksecurity_proto"],
+- deps = [":networksecurity_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "networksecurity_java_gapic",
+- srcs = [":networksecurity_proto_with_info"],
+- grpc_service_config = "networksecurity_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":networksecurity_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":networksecurity_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "networksecurity_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.networksecurity.v1.NetworkSecurityClientTest",
+- ],
+- runtime_deps = [":networksecurity_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-networksecurity-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":networksecurity_java_gapic",
+- ":networksecurity_java_grpc",
+- ":networksecurity_java_proto",
+- ":networksecurity_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "networksecurity_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/networksecurity/v1",
+- protos = [":networksecurity_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "networksecurity_go_gapic",
+- srcs = [":networksecurity_proto_with_info"],
+- grpc_service_config = "networksecurity_v1_grpc_service_config.json",
+- importpath = "cloud.google.com/go/networksecurity/apiv1;networksecurity",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "networksecurity_v1.yaml",
+- deps = [
+- ":networksecurity_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "networksecurity_go_gapic_test",
+- srcs = [":networksecurity_go_gapic_srcjar_test"],
+- embed = [":networksecurity_go_gapic"],
+- importpath = "cloud.google.com/go/networksecurity/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-networksecurity-v1-go",
+- deps = [
+- ":networksecurity_go_gapic",
+- ":networksecurity_go_gapic_srcjar-metadata.srcjar",
+- ":networksecurity_go_gapic_srcjar-test.srcjar",
+- ":networksecurity_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "networksecurity_py_gapic",
+- srcs = [":networksecurity_proto"],
+- grpc_service_config = "networksecurity_v1_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-network-security",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=network_security",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+-)
+-
+-py_test(
+- name = "networksecurity_py_gapic_test",
+- srcs = [
+- "networksecurity_py_gapic_pytest.py",
+- "networksecurity_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":networksecurity_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "networksecurity-v1-py",
+- deps = [
+- ":networksecurity_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "networksecurity_php_proto",
+- deps = [":networksecurity_proto"],
+-)
+-
+-php_grpc_library(
+- name = "networksecurity_php_grpc",
+- srcs = [":networksecurity_proto"],
+- deps = [":networksecurity_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "networksecurity_php_gapic",
+- srcs = [":networksecurity_proto_with_info"],
+- grpc_service_config = "networksecurity_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networksecurity_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":networksecurity_php_grpc",
+- ":networksecurity_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-networksecurity-v1-php",
+- deps = [
+- ":networksecurity_php_gapic",
+- ":networksecurity_php_grpc",
+- ":networksecurity_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "networksecurity_nodejs_gapic",
+- package_name = "@google-cloud/networksecurity",
+- src = ":networksecurity_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "networksecurity_v1_grpc_service_config.json",
+- package = "google.cloud.networksecurity.v1",
+- rest_numeric_enums = False,
+- service_yaml = "networksecurity_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "networksecurity-v1-nodejs",
+- deps = [
+- ":networksecurity_nodejs_gapic",
+- ":networksecurity_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "networksecurity_ruby_proto",
+- deps = [":networksecurity_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "networksecurity_ruby_grpc",
+- srcs = [":networksecurity_proto"],
+- deps = [":networksecurity_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "networksecurity_ruby_gapic",
+- srcs = [":networksecurity_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-networksecurity-v1",
+- ],
+- grpc_service_config = "networksecurity_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":networksecurity_ruby_grpc",
+- ":networksecurity_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-networksecurity-v1-ruby",
+- deps = [
+- ":networksecurity_ruby_gapic",
+- ":networksecurity_ruby_grpc",
+- ":networksecurity_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "networksecurity_csharp_proto",
+- deps = [":networksecurity_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "networksecurity_csharp_grpc",
+- srcs = [":networksecurity_proto"],
+- deps = [":networksecurity_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "networksecurity_csharp_gapic",
+- srcs = [":networksecurity_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "networksecurity_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":networksecurity_csharp_grpc",
+- ":networksecurity_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-networksecurity-v1-csharp",
+- deps = [
+- ":networksecurity_csharp_gapic",
+- ":networksecurity_csharp_grpc",
+- ":networksecurity_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/networksecurity/v1beta1/BUILD.bazel b/google/cloud/networksecurity/v1beta1/BUILD.bazel
+--- a/google/cloud/networksecurity/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/networksecurity/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,413 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "networksecurity_proto",
+- srcs = [
+- "authorization_policy.proto",
+- "client_tls_policy.proto",
+- "common.proto",
+- "network_security.proto",
+- "server_tls_policy.proto",
+- "tls.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "networksecurity_proto_with_info",
+- deps = [
+- ":networksecurity_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "networksecurity_java_proto",
+- deps = [":networksecurity_proto"],
+-)
+-
+-java_grpc_library(
+- name = "networksecurity_java_grpc",
+- srcs = [":networksecurity_proto"],
+- deps = [":networksecurity_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "networksecurity_java_gapic",
+- srcs = [":networksecurity_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "networksecurity_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networksecurity_v1beta1.yaml",
+- test_deps = [
+- ":networksecurity_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":networksecurity_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "networksecurity_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.networksecurity.v1beta1.NetworkSecurityClientHttpJsonTest",
+- "com.google.cloud.networksecurity.v1beta1.NetworkSecurityClientTest",
+- ],
+- runtime_deps = [":networksecurity_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-networksecurity-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":networksecurity_java_gapic",
+- ":networksecurity_java_grpc",
+- ":networksecurity_java_proto",
+- ":networksecurity_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "networksecurity_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1",
+- protos = [":networksecurity_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "networksecurity_go_gapic",
+- srcs = [":networksecurity_proto_with_info"],
+- grpc_service_config = "networksecurity_v1beta1_grpc_service_config.json",
+- importpath = "cloud.google.com/go/networksecurity/apiv1beta1;networksecurity",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "networksecurity_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":networksecurity_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "networksecurity_go_gapic_test",
+- srcs = [":networksecurity_go_gapic_srcjar_test"],
+- embed = [":networksecurity_go_gapic"],
+- importpath = "cloud.google.com/go/networksecurity/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-networksecurity-v1beta1-go",
+- deps = [
+- ":networksecurity_go_gapic",
+- ":networksecurity_go_gapic_srcjar-metadata.srcjar",
+- ":networksecurity_go_gapic_srcjar-test.srcjar",
+- ":networksecurity_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "networksecurity_py_gapic",
+- srcs = [":networksecurity_proto"],
+- grpc_service_config = "networksecurity_v1beta1_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-network-security",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=network_security",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "networksecurity_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "networksecurity_py_gapic_test",
+- srcs = [
+- "networksecurity_py_gapic_pytest.py",
+- "networksecurity_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":networksecurity_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "networksecurity-v1beta1-py",
+- deps = [
+- ":networksecurity_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "networksecurity_php_proto",
+- deps = [":networksecurity_proto"],
+-)
+-
+-php_grpc_library(
+- name = "networksecurity_php_grpc",
+- srcs = [":networksecurity_proto"],
+- deps = [":networksecurity_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "networksecurity_php_gapic",
+- srcs = [":networksecurity_proto_with_info"],
+- grpc_service_config = "networksecurity_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networksecurity_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":networksecurity_php_grpc",
+- ":networksecurity_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-networksecurity-v1beta1-php",
+- deps = [
+- ":networksecurity_php_gapic",
+- ":networksecurity_php_grpc",
+- ":networksecurity_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "networksecurity_nodejs_gapic",
+- package_name = "@google-cloud/network-security",
+- src = ":networksecurity_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "networksecurity_v1beta1_grpc_service_config.json",
+- package = "google.cloud.networksecurity.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "networksecurity_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "networksecurity-v1beta1-nodejs",
+- deps = [
+- ":networksecurity_nodejs_gapic",
+- ":networksecurity_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "networksecurity_ruby_proto",
+- deps = [":networksecurity_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "networksecurity_ruby_grpc",
+- srcs = [":networksecurity_proto"],
+- deps = [":networksecurity_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "networksecurity_ruby_gapic",
+- srcs = [":networksecurity_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=networksecurity.googleapis.com",
+- "ruby-cloud-api-shortname=networksecurity",
+- "ruby-cloud-gem-name=google-cloud-network_security-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/traffic-director/docs/reference/network-security/rest/",
+- ],
+- grpc_service_config = "networksecurity_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The client library for the Google Network Security V1beta1 API.",
+- ruby_cloud_title = "Network Security V1beta1",
+- service_yaml = "networksecurity_v1beta1.yaml",
+- deps = [
+- ":networksecurity_ruby_grpc",
+- ":networksecurity_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-networksecurity-v1beta1-ruby",
+- deps = [
+- ":networksecurity_ruby_gapic",
+- ":networksecurity_ruby_grpc",
+- ":networksecurity_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "networksecurity_csharp_proto",
+- deps = [":networksecurity_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "networksecurity_csharp_grpc",
+- srcs = [":networksecurity_proto"],
+- deps = [":networksecurity_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "networksecurity_csharp_gapic",
+- srcs = [":networksecurity_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "networksecurity_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networksecurity_v1beta1.yaml",
+- deps = [
+- ":networksecurity_csharp_grpc",
+- ":networksecurity_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-networksecurity-v1beta1-csharp",
+- deps = [
+- ":networksecurity_csharp_gapic",
+- ":networksecurity_csharp_grpc",
+- ":networksecurity_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "networksecurity_cc_proto",
+- deps = [":networksecurity_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "networksecurity_cc_grpc",
+- srcs = [":networksecurity_proto"],
+- grpc_only = True,
+- deps = [":networksecurity_cc_proto"],
+-)
+diff -urN a/google/cloud/networkservices/v1/BUILD.bazel b/google/cloud/networkservices/v1/BUILD.bazel
+--- a/google/cloud/networkservices/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/networkservices/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,411 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "networkservices_proto",
+- srcs = [
+- "common.proto",
+- "endpoint_policy.proto",
+- "gateway.proto",
+- "grpc_route.proto",
+- "http_route.proto",
+- "mesh.proto",
+- "network_services.proto",
+- "service_binding.proto",
+- "tcp_route.proto",
+- "tls_route.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "networkservices_proto_with_info",
+- deps = [
+- ":networkservices_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "networkservices_java_proto",
+- deps = [":networkservices_proto"],
+-)
+-
+-java_grpc_library(
+- name = "networkservices_java_grpc",
+- srcs = [":networkservices_proto"],
+- deps = [":networkservices_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "networkservices_java_gapic",
+- srcs = [":networkservices_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "networkservices_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkservices_v1.yaml",
+- test_deps = [
+- ":networkservices_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":networkservices_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "networkservices_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.networkservices.v1.NetworkServicesClientHttpJsonTest",
+- "com.google.cloud.networkservices.v1.NetworkServicesClientTest",
+- ],
+- runtime_deps = [":networkservices_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-networkservices-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":networkservices_java_gapic",
+- ":networkservices_java_grpc",
+- ":networkservices_java_proto",
+- ":networkservices_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "networkservices_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/networkservices/v1",
+- protos = [":networkservices_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "networkservices_go_gapic",
+- srcs = [":networkservices_proto_with_info"],
+- grpc_service_config = "networkservices_grpc_service_config.json",
+- importpath = "cloud.google.com/go/networkservices/apiv1;networkservices",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "networkservices_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":networkservices_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "networkservices_go_gapic_test",
+- srcs = [":networkservices_go_gapic_srcjar_test"],
+- embed = [":networkservices_go_gapic"],
+- importpath = "cloud.google.com/go/networkservices/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-networkservices-v1-go",
+- deps = [
+- ":networkservices_go_gapic",
+- ":networkservices_go_gapic_srcjar-metadata.srcjar",
+- ":networkservices_go_gapic_srcjar-test.srcjar",
+- ":networkservices_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "networkservices_py_gapic",
+- srcs = [":networkservices_proto"],
+- grpc_service_config = "networkservices_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=network_services",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-network-services",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "networkservices_v1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "networkservices_py_gapic_test",
+- srcs = [
+- "networkservices_py_gapic_pytest.py",
+- "networkservices_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":networkservices_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "networkservices-v1-py",
+- deps = [
+- ":networkservices_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "networkservices_php_proto",
+- deps = [":networkservices_proto"],
+-)
+-
+-php_grpc_library(
+- name = "networkservices_php_grpc",
+- srcs = [":networkservices_proto"],
+- deps = [":networkservices_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "networkservices_php_gapic",
+- srcs = [":networkservices_proto_with_info"],
+- grpc_service_config = "networkservices_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkservices_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":networkservices_php_grpc",
+- ":networkservices_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-networkservices-v1-php",
+- deps = [
+- ":networkservices_php_gapic",
+- ":networkservices_php_grpc",
+- ":networkservices_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "networkservices_nodejs_gapic",
+- package_name = "@google-cloud/networkservices",
+- src = ":networkservices_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "networkservices_grpc_service_config.json",
+- package = "google.cloud.networkservices.v1",
+- rest_numeric_enums = False,
+- service_yaml = "networkservices_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "networkservices-v1-nodejs",
+- deps = [
+- ":networkservices_nodejs_gapic",
+- ":networkservices_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "networkservices_ruby_proto",
+- deps = [":networkservices_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "networkservices_ruby_grpc",
+- srcs = [":networkservices_proto"],
+- deps = [":networkservices_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "networkservices_ruby_gapic",
+- srcs = [":networkservices_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-networkservices-v1"],
+- grpc_service_config = "networkservices_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkservices_v1.yaml",
+- deps = [
+- ":networkservices_ruby_grpc",
+- ":networkservices_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-networkservices-v1-ruby",
+- deps = [
+- ":networkservices_ruby_gapic",
+- ":networkservices_ruby_grpc",
+- ":networkservices_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "networkservices_csharp_proto",
+- deps = [":networkservices_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "networkservices_csharp_grpc",
+- srcs = [":networkservices_proto"],
+- deps = [":networkservices_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "networkservices_csharp_gapic",
+- srcs = [":networkservices_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "networkservices_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkservices_v1.yaml",
+- deps = [
+- ":networkservices_csharp_grpc",
+- ":networkservices_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-networkservices-v1-csharp",
+- deps = [
+- ":networkservices_csharp_gapic",
+- ":networkservices_csharp_grpc",
+- ":networkservices_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "networkservices_cc_proto",
+- deps = [":networkservices_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "networkservices_cc_grpc",
+- srcs = [":networkservices_proto"],
+- grpc_only = True,
+- deps = [":networkservices_cc_proto"],
+-)
+diff -urN a/google/cloud/networkservices/v1beta1/BUILD.bazel b/google/cloud/networkservices/v1beta1/BUILD.bazel
+--- a/google/cloud/networkservices/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/networkservices/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,385 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "networkservices_proto",
+- srcs = [
+- "common.proto",
+- "endpoint_policy.proto",
+- "network_services.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "networkservices_proto_with_info",
+- deps = [
+- ":networkservices_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "networkservices_java_proto",
+- deps = [":networkservices_proto"],
+-)
+-
+-java_grpc_library(
+- name = "networkservices_java_grpc",
+- srcs = [":networkservices_proto"],
+- deps = [":networkservices_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "networkservices_java_gapic",
+- srcs = [":networkservices_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "networkservices_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkservices_v1beta1.yaml",
+- test_deps = [
+- ":networkservices_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":networkservices_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "networkservices_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.networkservices.v1beta1.NetworkServicesClientHttpJsonTest",
+- "com.google.cloud.networkservices.v1beta1.NetworkServicesClientTest",
+- ],
+- runtime_deps = [":networkservices_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-networkservices-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":networkservices_java_gapic",
+- ":networkservices_java_grpc",
+- ":networkservices_java_proto",
+- ":networkservices_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "networkservices_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/networkservices/v1beta1",
+- protos = [":networkservices_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "networkservices_go_gapic",
+- srcs = [":networkservices_proto_with_info"],
+- grpc_service_config = "networkservices_v1beta1_grpc_service_config.json",
+- importpath = "cloud.google.com/go/networkservices/apiv1beta1;networkservices",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "networkservices_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":networkservices_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "networkservices_go_gapic_test",
+- srcs = [":networkservices_go_gapic_srcjar_test"],
+- embed = [":networkservices_go_gapic"],
+- importpath = "cloud.google.com/go/networkservices/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-networkservices-v1beta1-go",
+- deps = [
+- ":networkservices_go_gapic",
+- ":networkservices_go_gapic_srcjar-metadata.srcjar",
+- ":networkservices_go_gapic_srcjar-test.srcjar",
+- ":networkservices_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "networkservices_py_gapic",
+- srcs = [":networkservices_proto"],
+- grpc_service_config = "networkservices_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "networkservices_py_gapic_test",
+- srcs = [
+- "networkservices_py_gapic_pytest.py",
+- "networkservices_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":networkservices_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "networkservices-v1beta1-py",
+- deps = [
+- ":networkservices_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "networkservices_php_proto",
+- deps = [":networkservices_proto"],
+-)
+-
+-php_grpc_library(
+- name = "networkservices_php_grpc",
+- srcs = [":networkservices_proto"],
+- deps = [":networkservices_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "networkservices_php_gapic",
+- srcs = [":networkservices_proto_with_info"],
+- grpc_service_config = "networkservices_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkservices_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":networkservices_php_grpc",
+- ":networkservices_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-networkservices-v1beta1-php",
+- deps = [
+- ":networkservices_php_gapic",
+- ":networkservices_php_grpc",
+- ":networkservices_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "networkservices_nodejs_gapic",
+- package_name = "@google-cloud/networkservices",
+- src = ":networkservices_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "networkservices_v1beta1_grpc_service_config.json",
+- package = "google.cloud.networkservices.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "networkservices_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "networkservices-v1beta1-nodejs",
+- deps = [
+- ":networkservices_nodejs_gapic",
+- ":networkservices_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "networkservices_ruby_proto",
+- deps = [":networkservices_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "networkservices_ruby_grpc",
+- srcs = [":networkservices_proto"],
+- deps = [":networkservices_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "networkservices_ruby_gapic",
+- srcs = [":networkservices_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-networkservices-v1beta1"],
+- grpc_service_config = "networkservices_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":networkservices_ruby_grpc",
+- ":networkservices_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-networkservices-v1beta1-ruby",
+- deps = [
+- ":networkservices_ruby_gapic",
+- ":networkservices_ruby_grpc",
+- ":networkservices_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "networkservices_csharp_proto",
+- deps = [":networkservices_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "networkservices_csharp_grpc",
+- srcs = [":networkservices_proto"],
+- deps = [":networkservices_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "networkservices_csharp_gapic",
+- srcs = [":networkservices_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "networkservices_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "networkservices_v1beta1.yaml",
+- deps = [
+- ":networkservices_csharp_grpc",
+- ":networkservices_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-networkservices-v1beta1-csharp",
+- deps = [
+- ":networkservices_csharp_gapic",
+- ":networkservices_csharp_grpc",
+- ":networkservices_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "networkservices_cc_proto",
+- deps = [":networkservices_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "networkservices_cc_grpc",
+- srcs = [":networkservices_proto"],
+- grpc_only = True,
+- deps = [":networkservices_cc_proto"],
+-)
+diff -urN a/google/cloud/notebooks/BUILD.bazel b/google/cloud/notebooks/BUILD.bazel
+--- a/google/cloud/notebooks/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/notebooks/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-notebooks.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for notebooks.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta1 in this case.
+-ruby_cloud_gapic_library(
+- name = "notebooks_ruby_wrapper",
+- srcs = ["//google/cloud/notebooks/v1beta1:notebooks_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-notebooks",
+- "ruby-cloud-env-prefix=NOTEBOOKS",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/ai-platform-notebooks",
+- "ruby-cloud-api-id=notebooks.googleapis.com",
+- "ruby-cloud-api-shortname=notebooks",
+- ],
+- ruby_cloud_description = "AI Platform Notebooks makes it easy to manage JupyterLab instances through a protected, publicly available notebook instance URL. A JupyterLab instance is a Deep Learning virtual machine instance with the latest machine learning and data science libraries pre-installed.",
+- ruby_cloud_title = "AI Platform Notebooks",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-notebooks-ruby",
+- deps = [
+- ":notebooks_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/notebooks/logging/v1/BUILD.bazel b/google/cloud/notebooks/logging/v1/BUILD.bazel
+--- a/google/cloud/notebooks/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/notebooks/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,177 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "runtime_log.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/notebooks/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "//google/api:field_behavior_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/notebooks/v1/BUILD.bazel b/google/cloud/notebooks/v1/BUILD.bazel
+--- a/google/cloud/notebooks/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/notebooks/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,413 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "notebooks_proto",
+- srcs = [
+- "diagnostic_config.proto",
+- "environment.proto",
+- "event.proto",
+- "execution.proto",
+- "instance.proto",
+- "instance_config.proto",
+- "managed_service.proto",
+- "runtime.proto",
+- "schedule.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "notebooks_proto_with_info",
+- deps = [
+- ":notebooks_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "notebooks_java_proto",
+- deps = [":notebooks_proto"],
+-)
+-
+-java_grpc_library(
+- name = "notebooks_java_grpc",
+- srcs = [":notebooks_proto"],
+- deps = [":notebooks_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "notebooks_java_gapic",
+- srcs = [":notebooks_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "notebooks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "notebooks_v1.yaml",
+- test_deps = [
+- ":notebooks_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":notebooks_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "notebooks_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.notebooks.v1.ManagedNotebookServiceClientTest",
+- "com.google.cloud.notebooks.v1.NotebookServiceClientTest",
+- ],
+- runtime_deps = [":notebooks_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-notebooks-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":notebooks_java_gapic",
+- ":notebooks_java_grpc",
+- ":notebooks_java_proto",
+- ":notebooks_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "notebooks_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/notebooks/v1",
+- protos = [":notebooks_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "notebooks_go_gapic",
+- srcs = [":notebooks_proto_with_info"],
+- grpc_service_config = "notebooks_grpc_service_config.json",
+- importpath = "cloud.google.com/go/notebooks/apiv1;notebooks",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "notebooks_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":notebooks_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "notebooks_go_gapic_test",
+- srcs = [":notebooks_go_gapic_srcjar_test"],
+- embed = [":notebooks_go_gapic"],
+- importpath = "cloud.google.com/go/notebooks/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-notebooks-v1-go",
+- deps = [
+- ":notebooks_go_gapic",
+- ":notebooks_go_gapic_srcjar-metadata.srcjar",
+- ":notebooks_go_gapic_srcjar-test.srcjar",
+- ":notebooks_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "notebooks_py_gapic",
+- srcs = [":notebooks_proto"],
+- grpc_service_config = "notebooks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "notebooks_v1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "notebooks_py_gapic_test",
+- srcs = [
+- "notebooks_py_gapic_pytest.py",
+- "notebooks_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":notebooks_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "notebooks-v1-py",
+- deps = [
+- ":notebooks_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "notebooks_php_proto",
+- deps = [":notebooks_proto"],
+-)
+-
+-php_grpc_library(
+- name = "notebooks_php_grpc",
+- srcs = [":notebooks_proto"],
+- deps = [":notebooks_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "notebooks_php_gapic",
+- srcs = [":notebooks_proto_with_info"],
+- grpc_service_config = "notebooks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "notebooks_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":notebooks_php_grpc",
+- ":notebooks_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-notebooks-v1-php",
+- deps = [
+- ":notebooks_php_gapic",
+- ":notebooks_php_grpc",
+- ":notebooks_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "notebooks_nodejs_gapic",
+- package_name = "@google-cloud/notebooks",
+- src = ":notebooks_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "notebooks_grpc_service_config.json",
+- package = "google.cloud.notebooks.v1",
+- rest_numeric_enums = False,
+- service_yaml = "notebooks_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "notebooks-v1-nodejs",
+- deps = [
+- ":notebooks_nodejs_gapic",
+- ":notebooks_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "notebooks_ruby_proto",
+- deps = [":notebooks_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "notebooks_ruby_grpc",
+- srcs = [":notebooks_proto"],
+- deps = [":notebooks_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "notebooks_ruby_gapic",
+- srcs = [":notebooks_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=notebooks.googleapis.com",
+- "ruby-cloud-api-shortname=notebooks",
+- "ruby-cloud-env-prefix=NOTEBOOKS",
+- "ruby-cloud-gem-name=google-cloud-notebooks-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/ai-platform-notebooks",
+- ],
+- grpc_service_config = "notebooks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "AI Platform Notebooks makes it easy to manage JupyterLab instances through a protected, publicly available notebook instance URL. A JupyterLab instance is a Deep Learning virtual machine instance with the latest machine learning and data science libraries pre-installed.",
+- ruby_cloud_title = "AI Platform Notebooks V1",
+- service_yaml = "notebooks_v1.yaml",
+- deps = [
+- ":notebooks_ruby_grpc",
+- ":notebooks_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-notebooks-v1-ruby",
+- deps = [
+- ":notebooks_ruby_gapic",
+- ":notebooks_ruby_grpc",
+- ":notebooks_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "notebooks_csharp_proto",
+- deps = [":notebooks_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "notebooks_csharp_grpc",
+- srcs = [":notebooks_proto"],
+- deps = [":notebooks_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "notebooks_csharp_gapic",
+- srcs = [":notebooks_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "notebooks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "notebooks_v1.yaml",
+- deps = [
+- ":notebooks_csharp_grpc",
+- ":notebooks_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-notebooks-v1-csharp",
+- deps = [
+- ":notebooks_csharp_gapic",
+- ":notebooks_csharp_grpc",
+- ":notebooks_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "notebooks_cc_proto",
+- deps = [":notebooks_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "notebooks_cc_grpc",
+- srcs = [":notebooks_proto"],
+- grpc_only = True,
+- deps = [":notebooks_cc_proto"],
+-)
+diff -urN a/google/cloud/notebooks/v1beta1/BUILD.bazel b/google/cloud/notebooks/v1beta1/BUILD.bazel
+--- a/google/cloud/notebooks/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/notebooks/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,404 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "notebooks_proto",
+- srcs = [
+- "environment.proto",
+- "instance.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "notebooks_proto_with_info",
+- deps = [
+- ":notebooks_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "notebooks_java_proto",
+- deps = [":notebooks_proto"],
+-)
+-
+-java_grpc_library(
+- name = "notebooks_java_grpc",
+- srcs = [":notebooks_proto"],
+- deps = [":notebooks_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "notebooks_java_gapic",
+- srcs = [":notebooks_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "notebooks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "notebooks_v1beta1.yaml",
+- test_deps = [
+- ":notebooks_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":notebooks_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "notebooks_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.notebooks.v1beta1.NotebookServiceClientTest",
+- ],
+- runtime_deps = [":notebooks_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-notebooks-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":notebooks_java_gapic",
+- ":notebooks_java_grpc",
+- ":notebooks_java_proto",
+- ":notebooks_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "notebooks_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/notebooks/v1beta1",
+- protos = [":notebooks_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "notebooks_go_gapic",
+- srcs = [":notebooks_proto_with_info"],
+- grpc_service_config = "notebooks_grpc_service_config.json",
+- importpath = "cloud.google.com/go/notebooks/apiv1beta1;notebooks",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "notebooks_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":notebooks_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "notebooks_go_gapic_test",
+- srcs = [":notebooks_go_gapic_srcjar_test"],
+- embed = [":notebooks_go_gapic"],
+- importpath = "cloud.google.com/go/notebooks/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-notebooks-v1beta1-go",
+- deps = [
+- ":notebooks_go_gapic",
+- ":notebooks_go_gapic_srcjar-metadata.srcjar",
+- ":notebooks_go_gapic_srcjar-test.srcjar",
+- ":notebooks_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "notebooks_py_gapic",
+- srcs = [":notebooks_proto"],
+- grpc_service_config = "notebooks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "notebooks_v1beta1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "notebooks_py_gapic_test",
+- srcs = [
+- "notebooks_py_gapic_pytest.py",
+- "notebooks_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":notebooks_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "notebooks-v1beta1-py",
+- deps = [
+- ":notebooks_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "notebooks_php_proto",
+- deps = [":notebooks_proto"],
+-)
+-
+-php_grpc_library(
+- name = "notebooks_php_grpc",
+- srcs = [":notebooks_proto"],
+- deps = [":notebooks_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "notebooks_php_gapic",
+- srcs = [":notebooks_proto_with_info"],
+- grpc_service_config = "notebooks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "notebooks_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":notebooks_php_grpc",
+- ":notebooks_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-notebooks-v1beta1-php",
+- deps = [
+- ":notebooks_php_gapic",
+- ":notebooks_php_grpc",
+- ":notebooks_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "notebooks_nodejs_gapic",
+- package_name = "@google-cloud/notebooks",
+- src = ":notebooks_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "notebooks_grpc_service_config.json",
+- package = "google.cloud.notebooks.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "notebooks_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "notebooks-v1beta1-nodejs",
+- deps = [
+- ":notebooks_nodejs_gapic",
+- ":notebooks_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "notebooks_ruby_proto",
+- deps = [":notebooks_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "notebooks_ruby_grpc",
+- srcs = [":notebooks_proto"],
+- deps = [":notebooks_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "notebooks_ruby_gapic",
+- srcs = [":notebooks_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=notebooks.googleapis.com",
+- "ruby-cloud-api-shortname=notebooks",
+- "ruby-cloud-env-prefix=NOTEBOOKS",
+- "ruby-cloud-gem-name=google-cloud-notebooks-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/ai-platform-notebooks",
+- ],
+- grpc_service_config = "notebooks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "AI Platform Notebooks makes it easy to manage JupyterLab instances through a protected, publicly available notebook instance URL. A JupyterLab instance is a Deep Learning virtual machine instance with the latest machine learning and data science libraries pre-installed.",
+- ruby_cloud_title = "AI Platform Notebooks V1beta1",
+- service_yaml = "notebooks_v1beta1.yaml",
+- deps = [
+- ":notebooks_ruby_grpc",
+- ":notebooks_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-notebooks-v1beta1-ruby",
+- deps = [
+- ":notebooks_ruby_gapic",
+- ":notebooks_ruby_grpc",
+- ":notebooks_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "notebooks_csharp_proto",
+- deps = [":notebooks_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "notebooks_csharp_grpc",
+- srcs = [":notebooks_proto"],
+- deps = [":notebooks_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "notebooks_csharp_gapic",
+- srcs = [":notebooks_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "notebooks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "notebooks_v1beta1.yaml",
+- deps = [
+- ":notebooks_csharp_grpc",
+- ":notebooks_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-notebooks-v1beta1-csharp",
+- deps = [
+- ":notebooks_csharp_gapic",
+- ":notebooks_csharp_grpc",
+- ":notebooks_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "notebooks_cc_proto",
+- deps = [":notebooks_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "notebooks_cc_grpc",
+- srcs = [":notebooks_proto"],
+- grpc_only = True,
+- deps = [":notebooks_cc_proto"],
+-)
+diff -urN a/google/cloud/optimization/BUILD.bazel b/google/cloud/optimization/BUILD.bazel
+--- a/google/cloud/optimization/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/optimization/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-optimization.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for cloudoptimization.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "optimization_ruby_wrapper",
+- srcs = ["//google/cloud/optimization/v1:optimization_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-optimization",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/optimization",
+- "ruby-cloud-api-id=cloudoptimization.googleapis.com",
+- "ruby-cloud-api-shortname=cloudoptimization",
+- ],
+- ruby_cloud_description = "Cloud Optimization API provides a portfolio of solvers to address common optimization use cases starting with optimal route planning for vehicle fleets.",
+- ruby_cloud_title = "Cloud Optimization",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-optimization-ruby",
+- deps = [
+- ":optimization_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/optimization/v1/BUILD.bazel b/google/cloud/optimization/v1/BUILD.bazel
+--- a/google/cloud/optimization/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/optimization/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,394 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "optimization_proto",
+- srcs = [
+- "async_model.proto",
+- "fleet_routing.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "optimization_proto_with_info",
+- deps = [
+- ":optimization_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "optimization_java_proto",
+- deps = [":optimization_proto"],
+-)
+-
+-java_grpc_library(
+- name = "optimization_java_grpc",
+- srcs = [":optimization_proto"],
+- deps = [":optimization_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "optimization_java_gapic",
+- srcs = [":optimization_proto_with_info"],
+- gapic_yaml = "cloudoptimization_gapic.yaml",
+- grpc_service_config = "cloudoptimization_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudoptimization_v1.yaml",
+- test_deps = [
+- ":optimization_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":optimization_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "optimization_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.optimization.v1.FleetRoutingClientHttpJsonTest",
+- "com.google.cloud.optimization.v1.FleetRoutingClientTest",
+- ],
+- runtime_deps = [":optimization_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-optimization-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":optimization_java_gapic",
+- ":optimization_java_grpc",
+- ":optimization_java_proto",
+- ":optimization_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "optimization_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/optimization/v1",
+- protos = [":optimization_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "optimization_go_gapic",
+- srcs = [":optimization_proto_with_info"],
+- grpc_service_config = "cloudoptimization_grpc_service_config.json",
+- importpath = "cloud.google.com/go/optimization/apiv1;optimization",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "cloudoptimization_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":optimization_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "optimization_go_gapic_test",
+- srcs = [":optimization_go_gapic_srcjar_test"],
+- embed = [":optimization_go_gapic"],
+- importpath = "cloud.google.com/go/optimization/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-optimization-v1-go",
+- deps = [
+- ":optimization_go_gapic",
+- ":optimization_go_gapic_srcjar-metadata.srcjar",
+- ":optimization_go_gapic_srcjar-test.srcjar",
+- ":optimization_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "optimization_py_gapic",
+- srcs = [":optimization_proto"],
+- grpc_service_config = "cloudoptimization_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "optimization_py_gapic_test",
+- srcs = [
+- "optimization_py_gapic_pytest.py",
+- "optimization_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":optimization_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "optimization-v1-py",
+- deps = [
+- ":optimization_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "optimization_php_proto",
+- deps = [":optimization_proto"],
+-)
+-
+-php_grpc_library(
+- name = "optimization_php_grpc",
+- srcs = [":optimization_proto"],
+- deps = [":optimization_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "optimization_php_gapic",
+- srcs = [":optimization_proto_with_info"],
+- gapic_yaml = "cloudoptimization_gapic.yaml",
+- grpc_service_config = "cloudoptimization_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudoptimization_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":optimization_php_grpc",
+- ":optimization_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-optimization-v1-php",
+- deps = [
+- ":optimization_php_gapic",
+- ":optimization_php_grpc",
+- ":optimization_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "optimization_nodejs_gapic",
+- package_name = "@google-cloud/optimization",
+- src = ":optimization_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudoptimization_grpc_service_config.json",
+- package = "google.cloud.optimization.v1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudoptimization_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "optimization-v1-nodejs",
+- deps = [
+- ":optimization_nodejs_gapic",
+- ":optimization_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "optimization_ruby_proto",
+- deps = [":optimization_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "optimization_ruby_grpc",
+- srcs = [":optimization_proto"],
+- deps = [":optimization_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "optimization_ruby_gapic",
+- srcs = [":optimization_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-optimization-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/optimization",
+- "ruby-cloud-api-id=cloudoptimization.googleapis.com",
+- "ruby-cloud-api-shortname=cloudoptimization",
+- ],
+- grpc_service_config = "cloudoptimization_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Optimization API provides a portfolio of solvers to address common optimization use cases starting with optimal route planning for vehicle fleets.",
+- ruby_cloud_title = "Cloud Optimization V1",
+- deps = [
+- ":optimization_ruby_grpc",
+- ":optimization_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-optimization-v1-ruby",
+- deps = [
+- ":optimization_ruby_gapic",
+- ":optimization_ruby_grpc",
+- ":optimization_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "optimization_csharp_proto",
+- deps = [":optimization_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "optimization_csharp_grpc",
+- srcs = [":optimization_proto"],
+- deps = [":optimization_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "optimization_csharp_gapic",
+- srcs = [":optimization_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudoptimization_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudoptimization_v1.yaml",
+- deps = [
+- ":optimization_csharp_grpc",
+- ":optimization_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-optimization-v1-csharp",
+- deps = [
+- ":optimization_csharp_gapic",
+- ":optimization_csharp_grpc",
+- ":optimization_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "optimization_cc_proto",
+- deps = [":optimization_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "optimization_cc_grpc",
+- srcs = [":optimization_proto"],
+- grpc_only = True,
+- deps = [":optimization_cc_proto"],
+-)
+diff -urN a/google/cloud/orchestration/airflow/service/BUILD.bazel b/google/cloud/orchestration/airflow/service/BUILD.bazel
+--- a/google/cloud/orchestration/airflow/service/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/orchestration/airflow/service/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-orchestration-airflow-service.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for composer.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "composer_ruby_wrapper",
+- srcs = ["//google/cloud/orchestration/airflow/service/v1:service_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-orchestration-airflow-service",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/composer",
+- "ruby-cloud-api-id=composer.googleapis.com",
+- "ruby-cloud-api-shortname=composer",
+- ],
+- ruby_cloud_description = "The client library for the Cloud Composer API, built on the popular Apache Airflow open source project. Cloud Composer is a fully managed workflow orchestration service, enabling you to create, schedule, monitor, and manage workflows that span across clouds and on-premises data centers.",
+- ruby_cloud_title = "Cloud Composer",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-orchestration-airflow-service-ruby",
+- deps = [
+- ":composer_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/orchestration/airflow/service/v1/BUILD.bazel b/google/cloud/orchestration/airflow/service/v1/BUILD.bazel
+--- a/google/cloud/orchestration/airflow/service/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/orchestration/airflow/service/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,396 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "service_proto",
+- srcs = [
+- "environments.proto",
+- "image_versions.proto",
+- "operations.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:date_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "service_proto_with_info",
+- deps = [
+- ":service_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "service_java_proto",
+- deps = [":service_proto"],
+-)
+-
+-java_grpc_library(
+- name = "service_java_grpc",
+- srcs = [":service_proto"],
+- deps = [":service_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "service_java_gapic",
+- srcs = [":service_proto_with_info"],
+- grpc_service_config = "composer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":service_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":service_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "service_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.orchestration.airflow.service.v1.EnvironmentsClientHttpJsonTest",
+- "com.google.cloud.orchestration.airflow.service.v1.EnvironmentsClientTest",
+- "com.google.cloud.orchestration.airflow.service.v1.ImageVersionsClientHttpJsonTest",
+- "com.google.cloud.orchestration.airflow.service.v1.ImageVersionsClientTest",
+- ],
+- runtime_deps = [":service_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-airflow-service-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":service_java_gapic",
+- ":service_java_grpc",
+- ":service_java_proto",
+- ":service_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "service_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/orchestration/airflow/service/v1",
+- protos = [":service_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:date_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "service_go_gapic",
+- srcs = [":service_proto_with_info"],
+- grpc_service_config = "composer_grpc_service_config.json",
+- importpath = "cloud.google.com/go/orchestration/airflow/service/apiv1;service",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "composer_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":service_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "service_go_gapic_test",
+- srcs = [":service_go_gapic_srcjar_test"],
+- embed = [":service_go_gapic"],
+- importpath = "cloud.google.com/go/orchestration/airflow/service/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-airflow-service-v1-go",
+- deps = [
+- ":service_go_gapic",
+- ":service_go_gapic_srcjar-metadata.srcjar",
+- ":service_go_gapic_srcjar-test.srcjar",
+- ":service_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "service_py_gapic",
+- srcs = [":service_proto"],
+- grpc_service_config = "composer_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-orchestration-airflow",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "service_py_gapic_test",
+- srcs = [
+- "service_py_gapic_pytest.py",
+- "service_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":service_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "airflow-service-v1-py",
+- deps = [
+- ":service_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "service_php_proto",
+- deps = [":service_proto"],
+-)
+-
+-php_grpc_library(
+- name = "service_php_grpc",
+- srcs = [":service_proto"],
+- deps = [":service_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "service_php_gapic",
+- srcs = [":service_proto_with_info"],
+- grpc_service_config = "composer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "composer_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":service_php_grpc",
+- ":service_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-airflow-service-v1-php",
+- deps = [
+- ":service_php_gapic",
+- ":service_php_grpc",
+- ":service_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "service_nodejs_gapic",
+- package_name = "@google-cloud/orchestration-airflow",
+- src = ":service_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "composer_grpc_service_config.json",
+- package = "google.cloud.orchestration.airflow.service.v1",
+- rest_numeric_enums = False,
+- service_yaml = "composer_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "airflow-service-v1-nodejs",
+- deps = [
+- ":service_nodejs_gapic",
+- ":service_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "service_ruby_proto",
+- deps = [":service_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "service_ruby_grpc",
+- srcs = [":service_proto"],
+- deps = [":service_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "service_ruby_gapic",
+- srcs = [":service_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-orchestration-airflow-service-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/composer",
+- "ruby-cloud-api-id=composer.googleapis.com",
+- "ruby-cloud-api-shortname=composer",
+- ],
+- grpc_service_config = "composer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The client library for the Cloud Composer API, built on the popular Apache Airflow open source project. Cloud Composer is a fully managed workflow orchestration service, enabling you to create, schedule, monitor, and manage workflows that span across clouds and on-premises data centers.",
+- ruby_cloud_title = "Cloud Composer V1",
+- deps = [
+- ":service_ruby_grpc",
+- ":service_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-airflow-service-v1-ruby",
+- deps = [
+- ":service_ruby_gapic",
+- ":service_ruby_grpc",
+- ":service_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "service_csharp_proto",
+- deps = [":service_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "service_csharp_grpc",
+- srcs = [":service_proto"],
+- deps = [":service_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "service_csharp_gapic",
+- srcs = [":service_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "composer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "composer_v1.yaml",
+- deps = [
+- ":service_csharp_grpc",
+- ":service_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-airflow-service-v1-csharp",
+- deps = [
+- ":service_csharp_gapic",
+- ":service_csharp_grpc",
+- ":service_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "service_cc_proto",
+- deps = [":service_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "service_cc_grpc",
+- srcs = [":service_proto"],
+- grpc_only = True,
+- deps = [":service_cc_proto"],
+-)
+diff -urN a/google/cloud/orchestration/airflow/service/v1beta1/BUILD.bazel b/google/cloud/orchestration/airflow/service/v1beta1/BUILD.bazel
+--- a/google/cloud/orchestration/airflow/service/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/orchestration/airflow/service/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,377 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "service_proto",
+- srcs = [
+- "environments.proto",
+- "image_versions.proto",
+- "operations.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:date_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "service_proto_with_info",
+- deps = [
+- ":service_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "service_java_proto",
+- deps = [":service_proto"],
+-)
+-
+-java_grpc_library(
+- name = "service_java_grpc",
+- srcs = [":service_proto"],
+- deps = [":service_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "service_java_gapic",
+- srcs = [":service_proto_with_info"],
+- grpc_service_config = "composer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":service_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":service_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "service_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.orchestration.airflow.service.v1beta1.EnvironmentsClientHttpJsonTest",
+- "com.google.cloud.orchestration.airflow.service.v1beta1.EnvironmentsClientTest",
+- "com.google.cloud.orchestration.airflow.service.v1beta1.ImageVersionsClientHttpJsonTest",
+- "com.google.cloud.orchestration.airflow.service.v1beta1.ImageVersionsClientTest",
+- ],
+- runtime_deps = [":service_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-airflow-service-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":service_java_gapic",
+- ":service_java_grpc",
+- ":service_java_proto",
+- ":service_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "service_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/orchestration/airflow/service/v1beta1",
+- protos = [":service_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:date_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "service_go_gapic",
+- srcs = [":service_proto_with_info"],
+- grpc_service_config = "composer_grpc_service_config.json",
+- importpath = "cloud.google.com/go/orchestration/airflow/service/apiv1beta1;service",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "composer_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":service_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "service_go_gapic_test",
+- srcs = [":service_go_gapic_srcjar_test"],
+- embed = [":service_go_gapic"],
+- importpath = "cloud.google.com/go/orchestration/airflow/service/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-airflow-service-v1beta1-go",
+- deps = [
+- ":service_go_gapic",
+- ":service_go_gapic_srcjar-metadata.srcjar",
+- ":service_go_gapic_srcjar-test.srcjar",
+- ":service_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "service_py_gapic",
+- srcs = [":service_proto"],
+- grpc_service_config = "composer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "service_py_gapic_test",
+- srcs = [
+- "service_py_gapic_pytest.py",
+- "service_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":service_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "airflow-service-v1beta1-py",
+- deps = [
+- ":service_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "service_php_proto",
+- deps = [":service_proto"],
+-)
+-
+-php_grpc_library(
+- name = "service_php_grpc",
+- srcs = [":service_proto"],
+- deps = [":service_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "service_php_gapic",
+- srcs = [":service_proto_with_info"],
+- grpc_service_config = "composer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "composer_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":service_php_grpc",
+- ":service_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-airflow-service-v1beta1-php",
+- deps = [
+- ":service_php_gapic",
+- ":service_php_grpc",
+- ":service_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "service_nodejs_gapic",
+- package_name = "@google-cloud/orchestration-airflow",
+- src = ":service_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "composer_grpc_service_config.json",
+- package = "google.cloud.orchestration.airflow.service.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "composer_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "airflow-service-v1beta1-nodejs",
+- deps = [
+- ":service_nodejs_gapic",
+- ":service_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "service_ruby_proto",
+- deps = [":service_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "service_ruby_grpc",
+- srcs = [":service_proto"],
+- deps = [":service_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "service_ruby_gapic",
+- srcs = [":service_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-orchestration-airflow-service-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/composer",
+- "ruby-cloud-api-id=composer.googleapis.com",
+- "ruby-cloud-api-shortname=composer",
+- ],
+- grpc_service_config = "composer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The client library for the Cloud Composer API, built on the popular Apache Airflow open source project. Cloud Composer is a fully managed workflow orchestration service, enabling you to create, schedule, monitor, and manage workflows that span across clouds and on-premises data centers.",
+- ruby_cloud_title = "Cloud Composer V1beta1",
+- deps = [
+- ":service_ruby_grpc",
+- ":service_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-airflow-service-v1beta1-ruby",
+- deps = [
+- ":service_ruby_gapic",
+- ":service_ruby_grpc",
+- ":service_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "service_csharp_proto",
+- deps = [":service_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "service_csharp_grpc",
+- srcs = [":service_proto"],
+- deps = [":service_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "service_csharp_gapic",
+- srcs = [":service_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "composer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "composer_v1beta1.yaml",
+- deps = [
+- ":service_csharp_grpc",
+- ":service_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-airflow-service-v1beta1-csharp",
+- deps = [
+- ":service_csharp_gapic",
+- ":service_csharp_grpc",
+- ":service_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/orgpolicy/BUILD.bazel b/google/cloud/orgpolicy/BUILD.bazel
+--- a/google/cloud/orgpolicy/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/orgpolicy/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-org_policy.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for orgpolicy.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v2 in this case.
+-ruby_cloud_gapic_library(
+- name = "orgpolicy_ruby_wrapper",
+- srcs = ["//google/cloud/orgpolicy/v2:orgpolicy_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-org_policy",
+- "ruby-cloud-env-prefix=ORG_POLICY",
+- "ruby-cloud-wrapper-of=v2:0.2",
+- "ruby-cloud-product-url=https://cloud.google.com/resource-manager/docs/organization-policy/overview",
+- "ruby-cloud-api-id=orgpolicy.googleapis.com",
+- "ruby-cloud-api-shortname=orgpolicy",
+- ],
+- ruby_cloud_description = "The Cloud Org Policy service provides a simple mechanism for organizations to restrict the allowed configurations across their entire Cloud Resource hierarchy.",
+- ruby_cloud_title = "Organization Policy",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-orgpolicy-ruby",
+- deps = [
+- ":orgpolicy_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/orgpolicy/v1/BUILD.bazel b/google/cloud/orgpolicy/v1/BUILD.bazel
+--- a/google/cloud/orgpolicy/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/orgpolicy/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,222 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "orgpolicy_proto",
+- srcs = [
+- "orgpolicy.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "orgpolicy_java_proto",
+- deps = [":orgpolicy_proto"],
+-)
+-
+-java_grpc_library(
+- name = "orgpolicy_java_grpc",
+- srcs = [":orgpolicy_proto"],
+- deps = [":orgpolicy_java_proto"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-orgpolicy-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":orgpolicy_java_grpc",
+- ":orgpolicy_java_proto",
+- ":orgpolicy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "orgpolicy_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/orgpolicy/v1",
+- protos = [":orgpolicy_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_gapic_assembly_pkg",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "orgpolicy_moved_proto",
+- srcs = [":orgpolicy_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "orgpolicy_py_proto",
+- deps = [":orgpolicy_moved_proto"],
+-)
+-
+-py_proto_library(
+- name = "orgpolicy_py_original_proto",
+- deps = [":orgpolicy_proto"],
+-)
+-
+-py_grpc_library(
+- name = "orgpolicy_py_grpc",
+- srcs = [":orgpolicy_moved_proto"],
+- deps = [":orgpolicy_py_proto"],
+-)
+-
+-# Open Source Packages
+-# DO NOT REMOVE, this is needed to generate a Python package
+-# with the orgpolicy protos.
+-py_gapic_assembly_pkg(
+- name = "orgpolicy-v1-py",
+- deps = [
+- ":orgpolicy_proto",
+- ":orgpolicy_py_grpc",
+- ":orgpolicy_py_proto",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "orgpolicy_php_proto",
+- deps = [":orgpolicy_proto"],
+-)
+-
+-php_grpc_library(
+- name = "orgpolicy_php_grpc",
+- srcs = [":orgpolicy_proto"],
+- deps = [":orgpolicy_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "orgpolicy_ruby_proto",
+- deps = [":orgpolicy_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "orgpolicy_ruby_grpc",
+- srcs = [":orgpolicy_proto"],
+- deps = [":orgpolicy_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "orgpolicy_csharp_proto",
+- deps = [":orgpolicy_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "orgpolicy_csharp_grpc",
+- srcs = [":orgpolicy_proto"],
+- deps = [":orgpolicy_csharp_proto"],
+-)
+-
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-orgpolicy-v1-csharp",
+- package_name = "Google.Cloud.OrgPolicy.V1",
+- generate_nongapic_package = True,
+- deps = [
+- ":orgpolicy_csharp_grpc",
+- ":orgpolicy_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "orgpolicy_cc_proto",
+- deps = [":orgpolicy_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "orgpolicy_cc_grpc",
+- srcs = [":orgpolicy_proto"],
+- grpc_only = True,
+- deps = [":orgpolicy_cc_proto"],
+-)
+diff -urN a/google/cloud/orgpolicy/v2/BUILD.bazel b/google/cloud/orgpolicy/v2/BUILD.bazel
+--- a/google/cloud/orgpolicy/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/orgpolicy/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,386 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "orgpolicy_proto",
+- srcs = [
+- "constraint.proto",
+- "orgpolicy.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/type:expr_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "orgpolicy_proto_with_info",
+- deps = [
+- ":orgpolicy_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "orgpolicy_java_proto",
+- deps = [":orgpolicy_proto"],
+-)
+-
+-java_grpc_library(
+- name = "orgpolicy_java_grpc",
+- srcs = [":orgpolicy_proto"],
+- deps = [":orgpolicy_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "orgpolicy_java_gapic",
+- srcs = [":orgpolicy_proto_with_info"],
+- grpc_service_config = "orgpolicy_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":orgpolicy_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":orgpolicy_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "orgpolicy_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.orgpolicy.v2.OrgPolicyClientHttpJsonTest",
+- "com.google.cloud.orgpolicy.v2.OrgPolicyClientTest",
+- ],
+- runtime_deps = [":orgpolicy_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-orgpolicy-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":orgpolicy_java_gapic",
+- ":orgpolicy_java_grpc",
+- ":orgpolicy_java_proto",
+- ":orgpolicy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "orgpolicy_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/orgpolicy/v2",
+- protos = [":orgpolicy_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:expr_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "orgpolicy_go_gapic",
+- srcs = [":orgpolicy_proto_with_info"],
+- grpc_service_config = "orgpolicy_grpc_service_config.json",
+- importpath = "cloud.google.com/go/orgpolicy/apiv2;orgpolicy",
+- rest_numeric_enums = False,
+- service_yaml = "orgpolicy_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":orgpolicy_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "orgpolicy_go_gapic_test",
+- srcs = [":orgpolicy_go_gapic_srcjar_test"],
+- embed = [":orgpolicy_go_gapic"],
+- importpath = "cloud.google.com/go/orgpolicy/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-orgpolicy-v2-go",
+- deps = [
+- ":orgpolicy_go_gapic",
+- ":orgpolicy_go_gapic_srcjar-test.srcjar",
+- ":orgpolicy_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "orgpolicy_py_gapic",
+- srcs = [":orgpolicy_proto"],
+- grpc_service_config = "orgpolicy_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- opt_args = [
+- "warehouse-package-name=google-cloud-org-policy",
+- ],
+-)
+-
+-py_test(
+- name = "orgpolicy_py_gapic_test",
+- srcs = [
+- "orgpolicy_py_gapic_pytest.py",
+- "orgpolicy_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":orgpolicy_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "orgpolicy-v2-py",
+- deps = [
+- ":orgpolicy_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "orgpolicy_php_proto",
+- deps = [":orgpolicy_proto"],
+-)
+-
+-php_grpc_library(
+- name = "orgpolicy_php_grpc",
+- srcs = [":orgpolicy_proto"],
+- deps = [":orgpolicy_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "orgpolicy_php_gapic",
+- srcs = [":orgpolicy_proto_with_info"],
+- grpc_service_config = "orgpolicy_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":orgpolicy_php_grpc",
+- ":orgpolicy_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-orgpolicy-v2-php",
+- deps = [
+- ":orgpolicy_php_gapic",
+- ":orgpolicy_php_grpc",
+- ":orgpolicy_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "orgpolicy_nodejs_gapic",
+- package_name = "@google-cloud/org-policy",
+- src = ":orgpolicy_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "orgpolicy_grpc_service_config.json",
+- package = "google.cloud.orgpolicy.v2",
+- rest_numeric_enums = False,
+- service_yaml = "orgpolicy_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "orgpolicy-v2-nodejs",
+- deps = [
+- ":orgpolicy_nodejs_gapic",
+- ":orgpolicy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "orgpolicy_ruby_proto",
+- deps = [":orgpolicy_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "orgpolicy_ruby_grpc",
+- srcs = [":orgpolicy_proto"],
+- deps = [":orgpolicy_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "orgpolicy_ruby_gapic",
+- srcs = [":orgpolicy_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-org_policy-v2",
+- "ruby-cloud-env-prefix=ORG_POLICY",
+- "ruby-cloud-product-url=https://cloud.google.com/resource-manager/docs/organization-policy/overview",
+- "ruby-cloud-api-id=orgpolicy.googleapis.com",
+- "ruby-cloud-api-shortname=orgpolicy",
+- ],
+- grpc_service_config = "orgpolicy_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Cloud Org Policy service provides a simple mechanism for organizations to restrict the allowed configurations across their entire Cloud Resource hierarchy.",
+- ruby_cloud_title = "Organization Policy V2",
+- deps = [
+- ":orgpolicy_ruby_grpc",
+- ":orgpolicy_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-orgpolicy-v2-ruby",
+- deps = [
+- ":orgpolicy_ruby_gapic",
+- ":orgpolicy_ruby_grpc",
+- ":orgpolicy_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "orgpolicy_csharp_proto",
+- deps = [":orgpolicy_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "orgpolicy_csharp_grpc",
+- srcs = [":orgpolicy_proto"],
+- deps = [":orgpolicy_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "orgpolicy_csharp_gapic",
+- srcs = [":orgpolicy_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "orgpolicy_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "orgpolicy_v2.yaml",
+- deps = [
+- ":orgpolicy_csharp_grpc",
+- ":orgpolicy_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-orgpolicy-v2-csharp",
+- deps = [
+- ":orgpolicy_csharp_gapic",
+- ":orgpolicy_csharp_grpc",
+- ":orgpolicy_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "orgpolicy_cc_proto",
+- deps = [":orgpolicy_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "orgpolicy_cc_grpc",
+- srcs = [":orgpolicy_proto"],
+- grpc_only = True,
+- deps = [":orgpolicy_cc_proto"],
+-)
+diff -urN a/google/cloud/osconfig/BUILD.bazel b/google/cloud/osconfig/BUILD.bazel
+--- a/google/cloud/osconfig/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/osconfig/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-os_config.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for osconfig.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "osconfig_ruby_wrapper",
+- srcs = ["//google/cloud/osconfig/v1:osconfig_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-os_config",
+- "ruby-cloud-env-prefix=OS_CONFIG",
+- "ruby-cloud-wrapper-of=v1:0.6",
+- "ruby-cloud-product-url=https://cloud.google.com/compute/docs/manage-os",
+- "ruby-cloud-api-id=osconfig.googleapis.com",
+- "ruby-cloud-api-shortname=osconfig",
+- ],
+- ruby_cloud_description = "Cloud OS Config provides OS management tools that can be used for patch management, patch compliance, and configuration management on VM instances.",
+- ruby_cloud_title = "Cloud OS Config",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-ruby",
+- deps = [
+- ":osconfig_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/osconfig/agentendpoint/v1/BUILD.bazel b/google/cloud/osconfig/agentendpoint/v1/BUILD.bazel
+--- a/google/cloud/osconfig/agentendpoint/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/osconfig/agentendpoint/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,384 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "agentendpoint_proto",
+- srcs = [
+- "agentendpoint.proto",
+- "config_common.proto",
+- "inventory.proto",
+- "os_policy.proto",
+- "patch_jobs.proto",
+- "tasks.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/type:date_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "agentendpoint_proto_with_info",
+- deps = [
+- ":agentendpoint_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "agentendpoint_java_proto",
+- deps = [":agentendpoint_proto"],
+-)
+-
+-java_grpc_library(
+- name = "agentendpoint_java_grpc",
+- srcs = [":agentendpoint_proto"],
+- deps = [":agentendpoint_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "agentendpoint_java_gapic",
+- srcs = [":agentendpoint_proto_with_info"],
+- gapic_yaml = "osconfig_gapic.yaml",
+- grpc_service_config = "agentendpoint_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1.yaml",
+- test_deps = [
+- ":agentendpoint_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":agentendpoint_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "agentendpoint_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.osconfig.agentendpoint.v1.AgentEndpointServiceClientHttpJsonTest",
+- "com.google.cloud.osconfig.agentendpoint.v1.AgentEndpointServiceClientTest",
+- ],
+- runtime_deps = [":agentendpoint_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-osconfig-agentendpoint-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":agentendpoint_java_gapic",
+- ":agentendpoint_java_grpc",
+- ":agentendpoint_java_proto",
+- ":agentendpoint_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "agentendpoint_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/agentendpoint/v1",
+- protos = [":agentendpoint_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:date_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "agentendpoint_go_gapic",
+- srcs = [":agentendpoint_proto_with_info"],
+- grpc_service_config = "agentendpoint_grpc_service_config.json",
+- importpath = "cloud.google.com/go/osconfig/agentendpoint/apiv1;agentendpoint",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":agentendpoint_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "agentendpoint_go_gapic_test",
+- srcs = [":agentendpoint_go_gapic_srcjar_test"],
+- embed = [":agentendpoint_go_gapic"],
+- importpath = "cloud.google.com/go/osconfig/agentendpoint/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-osconfig-agentendpoint-v1-go",
+- deps = [
+- ":agentendpoint_go_gapic",
+- ":agentendpoint_go_gapic_srcjar-metadata.srcjar",
+- ":agentendpoint_go_gapic_srcjar-test.srcjar",
+- ":agentendpoint_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "agentendpoint_py_gapic",
+- srcs = [":agentendpoint_proto"],
+- grpc_service_config = "agentendpoint_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "agentendpoint_py_gapic_test",
+- srcs = [
+- "agentendpoint_py_gapic_pytest.py",
+- "agentendpoint_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":agentendpoint_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "osconfig-agentendpoint-v1-py",
+- deps = [
+- ":agentendpoint_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "agentendpoint_php_proto",
+- deps = [":agentendpoint_proto"],
+-)
+-
+-php_grpc_library(
+- name = "agentendpoint_php_grpc",
+- srcs = [":agentendpoint_proto"],
+- deps = [":agentendpoint_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "agentendpoint_php_gapic",
+- srcs = [":agentendpoint_proto_with_info"],
+- grpc_service_config = "agentendpoint_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":agentendpoint_php_grpc",
+- ":agentendpoint_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-agentendpoint-v1-php",
+- deps = [
+- ":agentendpoint_php_gapic",
+- ":agentendpoint_php_grpc",
+- ":agentendpoint_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "agentendpoint_nodejs_gapic",
+- package_name = "@google-cloud/agentendpoint",
+- src = ":agentendpoint_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "agentendpoint_grpc_service_config.json",
+- package = "google.cloud.osconfig.agentendpoint.v1",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "osconfig-agentendpoint-v1-nodejs",
+- deps = [
+- ":agentendpoint_nodejs_gapic",
+- ":agentendpoint_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "agentendpoint_ruby_proto",
+- deps = [":agentendpoint_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "agentendpoint_ruby_grpc",
+- srcs = [":agentendpoint_proto"],
+- deps = [":agentendpoint_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "agentendpoint_ruby_gapic",
+- srcs = [":agentendpoint_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-agentendpoint-v1"],
+- grpc_service_config = "agentendpoint_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":agentendpoint_ruby_grpc",
+- ":agentendpoint_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-agentendpoint-v1-ruby",
+- deps = [
+- ":agentendpoint_ruby_gapic",
+- ":agentendpoint_ruby_grpc",
+- ":agentendpoint_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "agentendpoint_csharp_proto",
+- deps = [":agentendpoint_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "agentendpoint_csharp_grpc",
+- srcs = [":agentendpoint_proto"],
+- deps = [":agentendpoint_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "agentendpoint_csharp_gapic",
+- srcs = [":agentendpoint_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "agentendpoint_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1.yaml",
+- deps = [
+- ":agentendpoint_csharp_grpc",
+- ":agentendpoint_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-agentendpoint-v1-csharp",
+- deps = [
+- ":agentendpoint_csharp_gapic",
+- ":agentendpoint_csharp_grpc",
+- ":agentendpoint_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "agentendpoint_cc_proto",
+- deps = [":agentendpoint_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "agentendpoint_cc_grpc",
+- srcs = [":agentendpoint_proto"],
+- grpc_only = True,
+- deps = [":agentendpoint_cc_proto"],
+-)
+diff -urN a/google/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel b/google/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel
+--- a/google/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,378 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "agentendpoint_proto",
+- srcs = [
+- "agentendpoint.proto",
+- "guest_policies.proto",
+- "patch_jobs.proto",
+- "tasks.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "agentendpoint_proto_with_info",
+- deps = [
+- ":agentendpoint_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "agentendpoint_java_proto",
+- deps = [":agentendpoint_proto"],
+-)
+-
+-java_grpc_library(
+- name = "agentendpoint_java_grpc",
+- srcs = [":agentendpoint_proto"],
+- deps = [":agentendpoint_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "agentendpoint_java_gapic",
+- srcs = [":agentendpoint_proto_with_info"],
+- gapic_yaml = "osconfig_gapic.yaml",
+- grpc_service_config = "agentendpoint_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1beta.yaml",
+- test_deps = [
+- ":agentendpoint_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":agentendpoint_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "agentendpoint_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.osconfig.agentendpoint.v1beta.AgentEndpointServiceClientHttpJsonTest",
+- "com.google.cloud.osconfig.agentendpoint.v1beta.AgentEndpointServiceClientTest",
+- ],
+- runtime_deps = [":agentendpoint_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-osconfig-agentendpoint-v1beta-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":agentendpoint_java_gapic",
+- ":agentendpoint_java_grpc",
+- ":agentendpoint_java_proto",
+- ":agentendpoint_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "agentendpoint_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/agentendpoint/v1beta",
+- protos = [":agentendpoint_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "agentendpoint_go_gapic",
+- srcs = [":agentendpoint_proto_with_info"],
+- grpc_service_config = "agentendpoint_grpc_service_config.json",
+- importpath = "cloud.google.com/go/osconfig/agentendpoint/apiv1beta;agentendpoint",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":agentendpoint_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "agentendpoint_go_gapic_test",
+- srcs = [":agentendpoint_go_gapic_srcjar_test"],
+- embed = [":agentendpoint_go_gapic"],
+- importpath = "cloud.google.com/go/osconfig/agentendpoint/apiv1beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-osconfig-agentendpoint-v1beta-go",
+- deps = [
+- ":agentendpoint_go_gapic",
+- ":agentendpoint_go_gapic_srcjar-metadata.srcjar",
+- ":agentendpoint_go_gapic_srcjar-test.srcjar",
+- ":agentendpoint_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "agentendpoint_py_gapic",
+- srcs = [":agentendpoint_proto"],
+- grpc_service_config = "agentendpoint_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "agentendpoint_py_gapic_test",
+- srcs = [
+- "agentendpoint_py_gapic_pytest.py",
+- "agentendpoint_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":agentendpoint_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "osconfig-agentendpoint-v1beta-py",
+- deps = [
+- ":agentendpoint_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "agentendpoint_php_proto",
+- deps = [":agentendpoint_proto"],
+-)
+-
+-php_grpc_library(
+- name = "agentendpoint_php_grpc",
+- srcs = [":agentendpoint_proto"],
+- deps = [":agentendpoint_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "agentendpoint_php_gapic",
+- srcs = [":agentendpoint_proto_with_info"],
+- grpc_service_config = "agentendpoint_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":agentendpoint_php_grpc",
+- ":agentendpoint_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-agentendpoint-v1beta-php",
+- deps = [
+- ":agentendpoint_php_gapic",
+- ":agentendpoint_php_grpc",
+- ":agentendpoint_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "agentendpoint_nodejs_gapic",
+- package_name = "@google-cloud/agentendpoint",
+- src = ":agentendpoint_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "agentendpoint_grpc_service_config.json",
+- package = "google.cloud.osconfig.agentendpoint.v1beta",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "osconfig-agentendpoint-v1beta-nodejs",
+- deps = [
+- ":agentendpoint_nodejs_gapic",
+- ":agentendpoint_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "agentendpoint_ruby_proto",
+- deps = [":agentendpoint_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "agentendpoint_ruby_grpc",
+- srcs = [":agentendpoint_proto"],
+- deps = [":agentendpoint_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "agentendpoint_ruby_gapic",
+- srcs = [":agentendpoint_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-agentendpoint-v1beta"],
+- grpc_service_config = "agentendpoint_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":agentendpoint_ruby_grpc",
+- ":agentendpoint_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-agentendpoint-v1beta-ruby",
+- deps = [
+- ":agentendpoint_ruby_gapic",
+- ":agentendpoint_ruby_grpc",
+- ":agentendpoint_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "agentendpoint_csharp_proto",
+- deps = [":agentendpoint_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "agentendpoint_csharp_grpc",
+- srcs = [":agentendpoint_proto"],
+- deps = [":agentendpoint_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "agentendpoint_csharp_gapic",
+- srcs = [":agentendpoint_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "agentendpoint_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1beta.yaml",
+- deps = [
+- ":agentendpoint_csharp_grpc",
+- ":agentendpoint_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-agentendpoint-v1beta-csharp",
+- deps = [
+- ":agentendpoint_csharp_gapic",
+- ":agentendpoint_csharp_grpc",
+- ":agentendpoint_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "agentendpoint_cc_proto",
+- deps = [":agentendpoint_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "agentendpoint_cc_grpc",
+- srcs = [":agentendpoint_proto"],
+- grpc_only = True,
+- deps = [":agentendpoint_cc_proto"],
+-)
+diff -urN a/google/cloud/osconfig/logging/BUILD.bazel b/google/cloud/osconfig/logging/BUILD.bazel
+--- a/google/cloud/osconfig/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/osconfig/logging/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,177 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "patch_job_log.proto",
+- ],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/logging",
+- protos = [":logging_proto"],
+- deps = [
+-
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/osconfig/v1/BUILD.bazel b/google/cloud/osconfig/v1/BUILD.bazel
+--- a/google/cloud/osconfig/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/osconfig/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,421 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "osconfig_proto",
+- srcs = [
+- "inventory.proto",
+- "os_policy.proto",
+- "os_policy_assignment_reports.proto",
+- "os_policy_assignments.proto",
+- "osconfig_common.proto",
+- "osconfig_service.proto",
+- "osconfig_zonal_service.proto",
+- "patch_deployments.proto",
+- "patch_jobs.proto",
+- "vulnerability.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:date_proto",
+- "//google/type:datetime_proto",
+- "//google/type:dayofweek_proto",
+- "//google/type:timeofday_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "osconfig_proto_with_info",
+- deps = [
+- ":osconfig_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "osconfig_java_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-java_grpc_library(
+- name = "osconfig_java_grpc",
+- srcs = [":osconfig_proto"],
+- deps = [":osconfig_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "osconfig_java_gapic",
+- srcs = [":osconfig_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1.yaml",
+- test_deps = [
+- ":osconfig_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":osconfig_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "osconfig_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.osconfig.v1.OsConfigServiceClientHttpJsonTest",
+- "com.google.cloud.osconfig.v1.OsConfigServiceClientTest",
+- "com.google.cloud.osconfig.v1.OsConfigZonalServiceClientHttpJsonTest",
+- "com.google.cloud.osconfig.v1.OsConfigZonalServiceClientTest",
+- ],
+- runtime_deps = [":osconfig_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-osconfig-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":osconfig_java_gapic",
+- ":osconfig_java_grpc",
+- ":osconfig_java_proto",
+- ":osconfig_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "osconfig_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/v1",
+- protos = [":osconfig_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:date_go_proto",
+- "//google/type:datetime_go_proto",
+- "//google/type:dayofweek_go_proto",
+- "//google/type:timeofday_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "osconfig_go_gapic",
+- srcs = [":osconfig_proto_with_info"],
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- importpath = "cloud.google.com/go/osconfig/apiv1;osconfig",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":osconfig_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "osconfig_go_gapic_test",
+- srcs = [":osconfig_go_gapic_srcjar_test"],
+- embed = [":osconfig_go_gapic"],
+- importpath = "cloud.google.com/go/osconfig/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-osconfig-v1-go",
+- deps = [
+- ":osconfig_go_gapic",
+- ":osconfig_go_gapic_srcjar-metadata.srcjar",
+- ":osconfig_go_gapic_srcjar-test.srcjar",
+- ":osconfig_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_proto_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "osconfig_py_gapic",
+- srcs = [":osconfig_proto"],
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-os-config"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "osconfig_py_gapic_test",
+- srcs = [
+- "osconfig_py_gapic_pytest.py",
+- "osconfig_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":osconfig_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "osconfig-v1-py",
+- deps = [
+- ":osconfig_py_gapic",
+- ],
+-)
+-
+-py_proto_library(
+- name = "osconfig_py_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "osconfig_php_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-php_grpc_library(
+- name = "osconfig_php_grpc",
+- srcs = [":osconfig_proto"],
+- deps = [":osconfig_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "osconfig_php_gapic",
+- srcs = [":osconfig_proto_with_info"],
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":osconfig_php_grpc",
+- ":osconfig_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-v1-php",
+- deps = [
+- ":osconfig_php_gapic",
+- ":osconfig_php_grpc",
+- ":osconfig_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "osconfig_nodejs_gapic",
+- package_name = "@google-cloud/os-config",
+- src = ":osconfig_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- main_service = "OsConfigServiceClient",
+- package = "google.cloud.osconfig.v1",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "osconfig-v1-nodejs",
+- deps = [
+- ":osconfig_nodejs_gapic",
+- ":osconfig_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "osconfig_ruby_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "osconfig_ruby_grpc",
+- srcs = [":osconfig_proto"],
+- deps = [":osconfig_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "osconfig_ruby_gapic",
+- srcs = [":osconfig_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=osconfig.googleapis.com",
+- "ruby-cloud-api-shortname=osconfig",
+- "ruby-cloud-env-prefix=OS_CONFIG",
+- "ruby-cloud-gem-name=google-cloud-os_config-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/compute/docs/manage-os",
+- ],
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud OS Config provides OS management tools that can be used for patch management, patch compliance, and configuration management on VM instances.",
+- ruby_cloud_title = "Cloud OS Config V1",
+- deps = [
+- ":osconfig_ruby_grpc",
+- ":osconfig_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-v1-ruby",
+- deps = [
+- ":osconfig_ruby_gapic",
+- ":osconfig_ruby_grpc",
+- ":osconfig_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "osconfig_csharp_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "osconfig_csharp_grpc",
+- srcs = [":osconfig_proto"],
+- deps = [":osconfig_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "osconfig_csharp_gapic",
+- srcs = [":osconfig_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1.yaml",
+- deps = [
+- ":osconfig_csharp_grpc",
+- ":osconfig_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-v1-csharp",
+- deps = [
+- ":osconfig_csharp_gapic",
+- ":osconfig_csharp_grpc",
+- ":osconfig_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "osconfig_cc_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "osconfig_cc_grpc",
+- srcs = [":osconfig_proto"],
+- grpc_only = True,
+- deps = [":osconfig_cc_proto"],
+-)
+diff -urN a/google/cloud/osconfig/v1alpha/BUILD.bazel b/google/cloud/osconfig/v1alpha/BUILD.bazel
+--- a/google/cloud/osconfig/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/osconfig/v1alpha/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,404 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "osconfig_proto",
+- srcs = [
+- "config_common.proto",
+- "instance_os_policies_compliance.proto",
+- "inventory.proto",
+- "os_policy.proto",
+- "os_policy_assignment_reports.proto",
+- "os_policy_assignments.proto",
+- "osconfig_common.proto",
+- "osconfig_zonal_service.proto",
+- "vulnerability.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:date_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "osconfig_proto_with_info",
+- deps = [
+- ":osconfig_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "osconfig_java_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-java_grpc_library(
+- name = "osconfig_java_grpc",
+- srcs = [":osconfig_proto"],
+- deps = [":osconfig_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "osconfig_java_gapic",
+- srcs = [":osconfig_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1alpha.yaml",
+- test_deps = [
+- ":osconfig_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":osconfig_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "osconfig_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClientHttpJsonTest",
+- "com.google.cloud.osconfig.v1alpha.OsConfigZonalServiceClientTest",
+- ],
+- runtime_deps = [":osconfig_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-osconfig-v1alpha-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":osconfig_java_gapic",
+- ":osconfig_java_grpc",
+- ":osconfig_java_proto",
+- ":osconfig_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "osconfig_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/v1alpha",
+- protos = [":osconfig_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:date_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "osconfig_go_gapic",
+- srcs = [":osconfig_proto_with_info"],
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- importpath = "cloud.google.com/go/osconfig/apiv1alpha;osconfig",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":osconfig_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "osconfig_go_gapic_test",
+- srcs = [":osconfig_go_gapic_srcjar_test"],
+- embed = [":osconfig_go_gapic"],
+- importpath = "cloud.google.com/go/osconfig/apiv1alpha",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-osconfig-v1alpha-go",
+- deps = [
+- ":osconfig_go_gapic",
+- ":osconfig_go_gapic_srcjar-metadata.srcjar",
+- ":osconfig_go_gapic_srcjar-test.srcjar",
+- ":osconfig_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "osconfig_py_gapic",
+- srcs = [":osconfig_proto"],
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-os-config"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "osconfig_py_gapic_test",
+- srcs = [
+- "osconfig_py_gapic_pytest.py",
+- "osconfig_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":osconfig_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "osconfig-v1alpha-py",
+- deps = [
+- ":osconfig_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "osconfig_php_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-php_grpc_library(
+- name = "osconfig_php_grpc",
+- srcs = [":osconfig_proto"],
+- deps = [":osconfig_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "osconfig_php_gapic",
+- srcs = [":osconfig_proto_with_info"],
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":osconfig_php_grpc",
+- ":osconfig_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-v1alpha-php",
+- deps = [
+- ":osconfig_php_gapic",
+- ":osconfig_php_grpc",
+- ":osconfig_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "osconfig_nodejs_gapic",
+- package_name = "@google-cloud/os-config",
+- src = ":osconfig_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- package = "google.cloud.osconfig.v1alpha",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "osconfig-v1alpha-nodejs",
+- deps = [
+- ":osconfig_nodejs_gapic",
+- ":osconfig_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "osconfig_ruby_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "osconfig_ruby_grpc",
+- srcs = [":osconfig_proto"],
+- deps = [":osconfig_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "osconfig_ruby_gapic",
+- srcs = [":osconfig_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=osconfig.googleapis.com",
+- "ruby-cloud-api-shortname=osconfig",
+- "ruby-cloud-env-prefix=OS_CONFIG",
+- "ruby-cloud-gem-name=google-cloud-os_config-v1alpha",
+- "ruby-cloud-product-url=https://cloud.google.com/compute/docs/manage-os",
+- ],
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud OS Config provides OS management tools that can be used for patch management, patch compliance, and configuration management on VM instances.",
+- ruby_cloud_title = "Cloud OS Config V1alpha",
+- deps = [
+- ":osconfig_ruby_grpc",
+- ":osconfig_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-v1alpha-ruby",
+- deps = [
+- ":osconfig_ruby_gapic",
+- ":osconfig_ruby_grpc",
+- ":osconfig_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "osconfig_csharp_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "osconfig_csharp_grpc",
+- srcs = [":osconfig_proto"],
+- deps = [":osconfig_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "osconfig_csharp_gapic",
+- srcs = [":osconfig_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1alpha.yaml",
+- deps = [
+- ":osconfig_csharp_grpc",
+- ":osconfig_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-v1alpha-csharp",
+- deps = [
+- ":osconfig_csharp_gapic",
+- ":osconfig_csharp_grpc",
+- ":osconfig_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "osconfig_cc_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "osconfig_cc_grpc",
+- srcs = [":osconfig_proto"],
+- grpc_only = True,
+- deps = [":osconfig_cc_proto"],
+-)
+diff -urN a/google/cloud/osconfig/v1beta/BUILD.bazel b/google/cloud/osconfig/v1beta/BUILD.bazel
+--- a/google/cloud/osconfig/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/osconfig/v1beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,392 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "osconfig_proto",
+- srcs = [
+- "guest_policies.proto",
+- "osconfig_common.proto",
+- "osconfig_service.proto",
+- "patch_deployments.proto",
+- "patch_jobs.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/type:datetime_proto",
+- "//google/type:dayofweek_proto",
+- "//google/type:timeofday_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "osconfig_proto_with_info",
+- deps = [
+- ":osconfig_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "osconfig_java_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-java_grpc_library(
+- name = "osconfig_java_grpc",
+- srcs = [":osconfig_proto"],
+- deps = [":osconfig_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "osconfig_java_gapic",
+- srcs = [":osconfig_proto_with_info"],
+- gapic_yaml = "osconfig_gapic.yaml",
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1beta.yaml",
+- test_deps = [
+- ":osconfig_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":osconfig_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "osconfig_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.osconfig.v1beta.OsConfigServiceClientHttpJsonTest",
+- "com.google.cloud.osconfig.v1beta.OsConfigServiceClientTest",
+- ],
+- runtime_deps = [":osconfig_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-osconfig-v1beta-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":osconfig_java_gapic",
+- ":osconfig_java_grpc",
+- ":osconfig_java_proto",
+- ":osconfig_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "osconfig_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/v1beta",
+- protos = [":osconfig_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:datetime_go_proto",
+- "//google/type:dayofweek_go_proto",
+- "//google/type:timeofday_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "osconfig_go_gapic",
+- srcs = [":osconfig_proto_with_info"],
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- importpath = "cloud.google.com/go/osconfig/apiv1beta;osconfig",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":osconfig_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "osconfig_go_gapic_test",
+- srcs = [":osconfig_go_gapic_srcjar_test"],
+- embed = [":osconfig_go_gapic"],
+- importpath = "cloud.google.com/go/osconfig/apiv1beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-osconfig-v1beta-go",
+- deps = [
+- ":osconfig_go_gapic",
+- ":osconfig_go_gapic_srcjar-metadata.srcjar",
+- ":osconfig_go_gapic_srcjar-test.srcjar",
+- ":osconfig_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "osconfig_py_gapic",
+- srcs = [":osconfig_proto"],
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-os-config"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "osconfig_py_gapic_test",
+- srcs = [
+- "osconfig_py_gapic_pytest.py",
+- "osconfig_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":osconfig_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "osconfig-v1beta-py",
+- deps = [
+- ":osconfig_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "osconfig_php_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-php_grpc_library(
+- name = "osconfig_php_grpc",
+- srcs = [":osconfig_proto"],
+- deps = [":osconfig_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "osconfig_php_gapic",
+- srcs = [":osconfig_proto_with_info"],
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":osconfig_php_grpc",
+- ":osconfig_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-v1beta-php",
+- deps = [
+- ":osconfig_php_gapic",
+- ":osconfig_php_grpc",
+- ":osconfig_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "osconfig_nodejs_gapic",
+- package_name = "@google-cloud/osconfig",
+- src = ":osconfig_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- package = "google.cloud.osconfig.v1beta",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "osconfig-v1beta-nodejs",
+- deps = [
+- ":osconfig_nodejs_gapic",
+- ":osconfig_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "osconfig_ruby_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "osconfig_ruby_grpc",
+- srcs = [":osconfig_proto"],
+- deps = [":osconfig_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "osconfig_ruby_gapic",
+- srcs = [":osconfig_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-osconfig-v1beta"],
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":osconfig_ruby_grpc",
+- ":osconfig_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-v1beta-ruby",
+- deps = [
+- ":osconfig_ruby_gapic",
+- ":osconfig_ruby_grpc",
+- ":osconfig_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "osconfig_csharp_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "osconfig_csharp_grpc",
+- srcs = [":osconfig_proto"],
+- deps = [":osconfig_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "osconfig_csharp_gapic",
+- srcs = [":osconfig_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "osconfig_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "osconfig_v1beta.yaml",
+- deps = [
+- ":osconfig_csharp_grpc",
+- ":osconfig_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-osconfig-v1beta-csharp",
+- deps = [
+- ":osconfig_csharp_gapic",
+- ":osconfig_csharp_grpc",
+- ":osconfig_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "osconfig_cc_proto",
+- deps = [":osconfig_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "osconfig_cc_grpc",
+- srcs = [":osconfig_proto"],
+- grpc_only = True,
+- deps = [":osconfig_cc_proto"],
+-)
+diff -urN a/google/cloud/oslogin/BUILD.bazel b/google/cloud/oslogin/BUILD.bazel
+--- a/google/cloud/oslogin/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/oslogin/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-os_login.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for oslogin.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "oslogin_ruby_wrapper",
+- srcs = ["//google/cloud/oslogin/v1:oslogin_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-os_login",
+- "ruby-cloud-env-prefix=OS_LOGIN",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/compute/docs/oslogin",
+- "ruby-cloud-api-id=oslogin.googleapis.com",
+- "ruby-cloud-api-shortname=oslogin",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "Use OS Login to manage SSH access to your instances using IAM without having to create and manage individual SSH keys. OS Login maintains a consistent Linux user identity across VM instances and is the recommended way to manage many users across multiple instances or projects.",
+- ruby_cloud_title = "Cloud OS Login",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-oslogin-ruby",
+- deps = [
+- ":oslogin_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/oslogin/common/BUILD.bazel b/google/cloud/oslogin/common/BUILD.bazel
+--- a/google/cloud/oslogin/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/oslogin/common/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,199 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "common_proto",
+- srcs = [
+- "common.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "common_proto_with_info",
+- deps = [
+- ":common_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "common_java_proto",
+- deps = [":common_proto"],
+-)
+-
+-java_grpc_library(
+- name = "common_java_grpc",
+- srcs = [":common_proto"],
+- deps = [":common_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "common_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/oslogin/common",
+- protos = [":common_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_proto_library",
+-)
+-
+-py_gapic_library(
+- name = "common_py_gapic",
+- srcs = [":common_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_proto_library(
+- name = "common_py_proto",
+- deps = [":common_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "common_php_proto",
+- deps = [":common_proto"],
+-)
+-
+-php_grpc_library(
+- name = "common_php_grpc",
+- srcs = [":common_proto"],
+- deps = [":common_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "common_ruby_proto",
+- deps = [":common_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "common_ruby_grpc",
+- srcs = [":common_proto"],
+- deps = [":common_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "common_csharp_proto",
+- deps = [":common_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "common_csharp_grpc",
+- srcs = [":common_proto"],
+- deps = [":common_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "common_csharp_gapic",
+- srcs = [":common_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":common_csharp_grpc",
+- ":common_csharp_proto",
+- ],
+-)
+-
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-oslogin-common-csharp",
+- deps = [
+- ":common_csharp_gapic",
+- ":common_csharp_grpc",
+- ":common_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "common_cc_proto",
+- deps = [":common_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "common_cc_grpc",
+- srcs = [":common_proto"],
+- grpc_only = True,
+- deps = [":common_cc_proto"],
+-)
+diff -urN a/google/cloud/oslogin/v1/BUILD.bazel b/google/cloud/oslogin/v1/BUILD.bazel
+--- a/google/cloud/oslogin/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/oslogin/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,411 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-_PROTO_SUBPACKAGE_DEPS = [
+- "//google/cloud/oslogin/common:common_proto",
+-]
+-
+-proto_library(
+- name = "oslogin_proto",
+- srcs = [
+- "oslogin.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ] + _PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-proto_library_with_info(
+- name = "oslogin_proto_with_info",
+- deps = [
+- ":oslogin_proto",
+- "//google/cloud:common_resources_proto",
+- ] + _PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-_JAVA_PROTO_SUBPACKAGE_DEPS = [
+- "//google/cloud/oslogin/common:common_java_proto",
+-]
+-
+-_JAVA_GRPC_SUBPACKAGE_DEPS = [
+- "//google/cloud/oslogin/common:common_java_grpc",
+-]
+-
+-java_proto_library(
+- name = "oslogin_java_proto",
+- deps = [":oslogin_proto"],
+-)
+-
+-java_grpc_library(
+- name = "oslogin_java_grpc",
+- srcs = [":oslogin_proto"],
+- deps = [":oslogin_java_proto"] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-java_gapic_library(
+- name = "oslogin_java_gapic",
+- srcs = [":oslogin_proto_with_info"],
+- grpc_service_config = "oslogin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":oslogin_java_grpc",
+- ] + _JAVA_GRPC_SUBPACKAGE_DEPS,
+- transport = "grpc+rest",
+- deps = [
+- ":oslogin_java_proto",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-java_gapic_test(
+- name = "oslogin_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.oslogin.v1.OsLoginServiceClientHttpJsonTest",
+- "com.google.cloud.oslogin.v1.OsLoginServiceClientTest",
+- ],
+- runtime_deps = [":oslogin_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-oslogin-v1-java",
+- transport = "grpc+rest",
+- deps = [
+- ":oslogin_java_gapic",
+- ":oslogin_java_grpc",
+- ":oslogin_java_proto",
+- ":oslogin_proto",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS + _PROTO_SUBPACKAGE_DEPS + _JAVA_GRPC_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "oslogin_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/oslogin/v1",
+- protos = [":oslogin_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/cloud/oslogin/common:common_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "oslogin_go_gapic",
+- srcs = [":oslogin_proto_with_info"],
+- grpc_service_config = "oslogin_grpc_service_config.json",
+- importpath = "cloud.google.com/go/oslogin/apiv1;oslogin",
+- rest_numeric_enums = False,
+- service_yaml = "oslogin_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":oslogin_go_proto",
+- "//google/cloud/oslogin/common:common_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "oslogin_go_gapic_test",
+- srcs = [":oslogin_go_gapic_srcjar_test"],
+- embed = [":oslogin_go_gapic"],
+- importpath = "cloud.google.com/go/oslogin/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-oslogin-v1-go",
+- deps = [
+- ":oslogin_go_gapic",
+- ":oslogin_go_gapic_srcjar-test.srcjar",
+- ":oslogin_go_proto",
+- "//google/cloud/oslogin/common:common_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "oslogin_py_gapic",
+- srcs = [
+- ":oslogin_proto",
+- ],
+- grpc_service_config = "oslogin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/cloud/oslogin/common:common_py_proto",
+- ],
+- opt_args = [
+- "warehouse-package-name=google-cloud-os-login",
+- ],
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1376 is fixed
+-#py_test(
+-# name = "oslogin_py_gapic_test",
+-# srcs = [
+-# "oslogin_py_gapic_pytest.py",
+-# "oslogin_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [
+-# ":oslogin_py_gapic",
+-# ],
+-#)
+-
+-py_gapic_assembly_pkg(
+- name = "oslogin-v1-py",
+- deps = [
+- ":oslogin_py_gapic",
+- # "//google/cloud/oslogin/common:common_py_gapic",
+- "//google/cloud/oslogin/common:common_py_proto",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-_PHP_SUBPACKAGE_DEPS = [
+- "//google/cloud/oslogin/common:common_php_proto",
+- "//google/cloud/oslogin/common:common_php_grpc",
+-]
+-
+-php_proto_library(
+- name = "oslogin_php_proto",
+- deps = [":oslogin_proto"],
+-)
+-
+-php_grpc_library(
+- name = "oslogin_php_grpc",
+- srcs = [":oslogin_proto"],
+- deps = [":oslogin_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "oslogin_php_gapic",
+- srcs = [":oslogin_proto_with_info"],
+- grpc_service_config = "oslogin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":oslogin_php_grpc",
+- ":oslogin_php_proto",
+- ] + _PHP_SUBPACKAGE_DEPS,
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-oslogin-v1-php",
+- deps = [
+- ":oslogin_php_gapic",
+- ":oslogin_php_grpc",
+- ":oslogin_php_proto",
+- ] + _PHP_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "oslogin_nodejs_gapic",
+- package_name = "@google-cloud/os-login",
+- src = ":oslogin_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "oslogin_grpc_service_config.json",
+- package = "google.cloud.oslogin.v1",
+- rest_numeric_enums = False,
+- service_yaml = "oslogin_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "oslogin-v1-nodejs",
+- deps = [
+- ":oslogin_nodejs_gapic",
+- ":oslogin_proto",
+- ] + _PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-_RUBY_SUBPACKAGE_DEPS = [
+- "//google/cloud/oslogin/common:common_ruby_proto",
+- "//google/cloud/oslogin/common:common_ruby_grpc",
+-]
+-
+-ruby_proto_library(
+- name = "oslogin_ruby_proto",
+- deps = [":oslogin_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "oslogin_ruby_grpc",
+- srcs = [":oslogin_proto"],
+- deps = [":oslogin_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "oslogin_ruby_gapic",
+- srcs = [":oslogin_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-os_login-v1",
+- "ruby-cloud-env-prefix=OS_LOGIN",
+- "ruby-cloud-product-url=https://cloud.google.com/compute/docs/oslogin",
+- "ruby-cloud-api-id=oslogin.googleapis.com",
+- "ruby-cloud-api-shortname=oslogin",
+- ],
+- grpc_service_config = "oslogin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Use OS Login to manage SSH access to your instances using IAM without having to create and manage individual SSH keys. OS Login maintains a consistent Linux user identity across VM instances and is the recommended way to manage many users across multiple instances or projects.",
+- ruby_cloud_title = "Cloud OS Login V1",
+- deps = [
+- ":oslogin_ruby_grpc",
+- ":oslogin_ruby_proto",
+- ] + _RUBY_SUBPACKAGE_DEPS,
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-oslogin-v1-ruby",
+- deps = [
+- ":oslogin_ruby_gapic",
+- ":oslogin_ruby_grpc",
+- ":oslogin_ruby_proto",
+- ] + _RUBY_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-_CSHARP_SUBPACKAGE_DEPS = [
+- "//google/cloud/oslogin/common:common_csharp_proto",
+- "//google/cloud/oslogin/common:common_csharp_grpc",
+-]
+-
+-csharp_proto_library(
+- name = "oslogin_csharp_proto",
+- deps = [":oslogin_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "oslogin_csharp_grpc",
+- srcs = [":oslogin_proto"],
+- deps = [":oslogin_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "oslogin_csharp_gapic",
+- srcs = [":oslogin_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "oslogin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "oslogin_v1.yaml",
+- deps = [
+- ":oslogin_csharp_grpc",
+- ":oslogin_csharp_proto",
+- ] + _CSHARP_SUBPACKAGE_DEPS,
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-oslogin-v1-csharp",
+- deps = [
+- ":oslogin_csharp_gapic",
+- ":oslogin_csharp_grpc",
+- ":oslogin_csharp_proto",
+- ] + _CSHARP_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "oslogin_cc_proto",
+- deps = [":oslogin_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "oslogin_cc_grpc",
+- srcs = [":oslogin_proto"],
+- grpc_only = True,
+- deps = [":oslogin_cc_proto"],
+-)
+diff -urN a/google/cloud/oslogin/v1beta/BUILD.bazel b/google/cloud/oslogin/v1beta/BUILD.bazel
+--- a/google/cloud/oslogin/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/oslogin/v1beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,383 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-_PROTO_SUBPACKAGE_DEPS = [
+- "//google/cloud/oslogin/common:common_proto",
+-]
+-
+-proto_library(
+- name = "oslogin_proto",
+- srcs = [
+- "oslogin.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ] + _PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-proto_library_with_info(
+- name = "oslogin_proto_with_info",
+- deps = [
+- ":oslogin_proto",
+- "//google/cloud:common_resources_proto",
+- ] + _PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-_JAVA_PROTO_SUBPACKAGE_DEPS = [
+- "//google/cloud/oslogin/common:common_java_proto",
+-]
+-
+-_JAVA_GRPC_SUBPACKAGE_DEPS = [
+- "//google/cloud/oslogin/common:common_java_grpc",
+-]
+-
+-java_proto_library(
+- name = "oslogin_java_proto",
+- deps = [":oslogin_proto"],
+-)
+-
+-java_grpc_library(
+- name = "oslogin_java_grpc",
+- srcs = [":oslogin_proto"],
+- deps = [":oslogin_java_proto"] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-java_gapic_library(
+- name = "oslogin_java_gapic",
+- srcs = [":oslogin_proto_with_info"],
+- grpc_service_config = "oslogin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [":oslogin_java_grpc"],
+- transport = "grpc+rest",
+- deps = [
+- ":oslogin_java_proto",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-java_gapic_test(
+- name = "oslogin_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.oslogin.v1beta.OsLoginServiceClientHttpJsonTest",
+- "com.google.cloud.oslogin.v1beta.OsLoginServiceClientTest",
+- ],
+- runtime_deps = [":oslogin_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-oslogin-v1beta-java",
+- transport = "grpc+rest",
+- deps = [
+- ":oslogin_java_gapic",
+- ":oslogin_java_grpc",
+- ":oslogin_java_proto",
+- ":oslogin_proto",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS + _PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "oslogin_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/oslogin/v1beta",
+- protos = [":oslogin_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/cloud/oslogin/common:common_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "oslogin_go_gapic",
+- srcs = [":oslogin_proto_with_info"],
+- grpc_service_config = "oslogin_grpc_service_config.json",
+- importpath = "cloud.google.com/go/oslogin/apiv1beta;oslogin",
+- rest_numeric_enums = False,
+- service_yaml = "oslogin_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":oslogin_go_proto",
+- "//google/cloud/oslogin/common:common_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "oslogin_go_gapic_test",
+- srcs = [":oslogin_go_gapic_srcjar_test"],
+- embed = [":oslogin_go_gapic"],
+- importpath = "cloud.google.com/go/oslogin/apiv1beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-oslogin-v1beta-go",
+- deps = [
+- ":oslogin_go_gapic",
+- ":oslogin_go_gapic_srcjar-test.srcjar",
+- ":oslogin_go_proto",
+- "//google/cloud/oslogin/common:common_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "oslogin_py_gapic",
+- srcs = [
+- ":oslogin_proto",
+- ],
+- grpc_service_config = "oslogin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1376 is fixed
+-#py_test(
+-# name = "oslogin_py_gapic_test",
+-# srcs = [
+-# "oslogin_py_gapic_pytest.py",
+-# "oslogin_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":oslogin_py_gapic"],
+-#)
+-
+-py_gapic_assembly_pkg(
+- name = "oslogin-v1beta-py",
+- deps = [
+- ":oslogin_py_gapic",
+- "//google/cloud/oslogin/common:common_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-_PHP_SUBPACKAGE_DEPS = [
+- "//google/cloud/oslogin/common:common_php_proto",
+- "//google/cloud/oslogin/common:common_php_grpc",
+-]
+-
+-php_proto_library(
+- name = "oslogin_php_proto",
+- deps = [":oslogin_proto"],
+-)
+-
+-php_grpc_library(
+- name = "oslogin_php_grpc",
+- srcs = [":oslogin_proto"],
+- deps = [":oslogin_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "oslogin_php_gapic",
+- srcs = [":oslogin_proto_with_info"],
+- grpc_service_config = "oslogin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":oslogin_php_grpc",
+- ":oslogin_php_proto",
+- ] + _PHP_SUBPACKAGE_DEPS,
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-oslogin-v1beta-php",
+- deps = [
+- ":oslogin_php_gapic",
+- ":oslogin_php_grpc",
+- ":oslogin_php_proto",
+- ] + _PHP_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "oslogin_nodejs_gapic",
+- package_name = "@google-cloud/os-login",
+- src = ":oslogin_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "oslogin_grpc_service_config.json",
+- package = "google.cloud.oslogin.v1beta",
+- rest_numeric_enums = False,
+- service_yaml = "oslogin_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "oslogin-v1beta-nodejs",
+- deps = [
+- ":oslogin_nodejs_gapic",
+- ":oslogin_proto",
+- ] + _PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-_RUBY_SUBPACKAGE_DEPS = [
+- "//google/cloud/oslogin/common:common_ruby_proto",
+- "//google/cloud/oslogin/common:common_ruby_grpc",
+-]
+-
+-ruby_proto_library(
+- name = "oslogin_ruby_proto",
+- deps = [":oslogin_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "oslogin_ruby_grpc",
+- srcs = [":oslogin_proto"],
+- deps = [":oslogin_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "oslogin_ruby_gapic",
+- srcs = [":oslogin_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-os_login-v1beta",
+- "ruby-cloud-env-prefix=OS_LOGIN",
+- "ruby-cloud-product-url=https://cloud.google.com/compute/docs/oslogin",
+- "ruby-cloud-api-id=oslogin.googleapis.com",
+- "ruby-cloud-api-shortname=oslogin",
+- ],
+- grpc_service_config = "oslogin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Use OS Login to manage SSH access to your instances using IAM without having to create and manage individual SSH keys. OS Login maintains a consistent Linux user identity across VM instances and is the recommended way to manage many users across multiple instances or projects.",
+- ruby_cloud_title = "Cloud OS Login V1beta",
+- deps = [
+- ":oslogin_ruby_grpc",
+- ":oslogin_ruby_proto",
+- ] + _RUBY_SUBPACKAGE_DEPS,
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-oslogin-v1beta-ruby",
+- deps = [
+- ":oslogin_ruby_gapic",
+- ":oslogin_ruby_grpc",
+- ":oslogin_ruby_proto",
+- ] + _RUBY_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-_CSHARP_SUBPACKAGE_DEPS = [
+- "//google/cloud/oslogin/common:common_csharp_proto",
+- "//google/cloud/oslogin/common:common_csharp_grpc",
+-]
+-
+-csharp_proto_library(
+- name = "oslogin_csharp_proto",
+- deps = [":oslogin_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "oslogin_csharp_grpc",
+- srcs = [":oslogin_proto"],
+- deps = [":oslogin_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "oslogin_csharp_gapic",
+- srcs = [":oslogin_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "oslogin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "oslogin_v1beta.yaml",
+- deps = [
+- ":oslogin_csharp_grpc",
+- ":oslogin_csharp_proto",
+- ] + _CSHARP_SUBPACKAGE_DEPS,
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-oslogin-v1beta-csharp",
+- deps = [
+- ":oslogin_csharp_gapic",
+- ":oslogin_csharp_grpc",
+- ":oslogin_csharp_proto",
+- ] + _CSHARP_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/paymentgateway/issuerswitch/v1/BUILD.bazel b/google/cloud/paymentgateway/issuerswitch/v1/BUILD.bazel
+--- a/google/cloud/paymentgateway/issuerswitch/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/paymentgateway/issuerswitch/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,406 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "issuerswitch_proto",
+- srcs = [
+- "common_fields.proto",
+- "logs.proto",
+- "resolutions.proto",
+- "rules.proto",
+- "transactions.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/logging/type:type_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:date_proto",
+- "//google/type:money_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "issuerswitch_proto_with_info",
+- deps = [
+- ":issuerswitch_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "issuerswitch_java_proto",
+- deps = [":issuerswitch_proto"],
+-)
+-
+-java_grpc_library(
+- name = "issuerswitch_java_grpc",
+- srcs = [":issuerswitch_proto"],
+- deps = [":issuerswitch_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "issuerswitch_java_gapic",
+- srcs = [":issuerswitch_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "issuerswitch_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "issuerswitch_v1.yaml",
+- test_deps = [
+- ":issuerswitch_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":issuerswitch_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "issuerswitch_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.paymentgateway.issuerswitch.v1.IssuerSwitchResolutionsClientHttpJsonTest",
+- "com.google.cloud.paymentgateway.issuerswitch.v1.IssuerSwitchResolutionsClientTest",
+- "com.google.cloud.paymentgateway.issuerswitch.v1.IssuerSwitchRulesClientHttpJsonTest",
+- "com.google.cloud.paymentgateway.issuerswitch.v1.IssuerSwitchRulesClientTest",
+- "com.google.cloud.paymentgateway.issuerswitch.v1.IssuerSwitchTransactionsClientHttpJsonTest",
+- "com.google.cloud.paymentgateway.issuerswitch.v1.IssuerSwitchTransactionsClientTest",
+- ],
+- runtime_deps = [":issuerswitch_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-paymentgateway-issuerswitch-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":issuerswitch_java_gapic",
+- ":issuerswitch_java_grpc",
+- ":issuerswitch_java_proto",
+- ":issuerswitch_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "issuerswitch_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/paymentgateway/issuerswitch/v1",
+- protos = [":issuerswitch_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/logging/type:type_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:date_go_proto",
+- "//google/type:money_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "issuerswitch_go_gapic",
+- srcs = [":issuerswitch_proto_with_info"],
+- grpc_service_config = "issuerswitch_grpc_service_config.json",
+- importpath = "cloud.google.com/go/paymentgateway/issuerswitch/apiv1;issuerswitch",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "issuerswitch_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":issuerswitch_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "issuerswitch_go_gapic_test",
+- srcs = [":issuerswitch_go_gapic_srcjar_test"],
+- embed = [":issuerswitch_go_gapic"],
+- importpath = "cloud.google.com/go/paymentgateway/issuerswitch/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-paymentgateway-issuerswitch-v1-go",
+- deps = [
+- ":issuerswitch_go_gapic",
+- ":issuerswitch_go_gapic_srcjar-metadata.srcjar",
+- ":issuerswitch_go_gapic_srcjar-test.srcjar",
+- ":issuerswitch_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "issuerswitch_py_gapic",
+- srcs = [":issuerswitch_proto"],
+- grpc_service_config = "issuerswitch_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=payment_gateway_issuer_switch",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-payment-gateway-issuer-switch",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "issuerswitch_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "issuerswitch_py_gapic_test",
+- srcs = [
+- "issuerswitch_py_gapic_pytest.py",
+- "issuerswitch_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":issuerswitch_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "paymentgateway-issuerswitch-v1-py",
+- deps = [
+- ":issuerswitch_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "issuerswitch_php_proto",
+- deps = [":issuerswitch_proto"],
+-)
+-
+-php_grpc_library(
+- name = "issuerswitch_php_grpc",
+- srcs = [":issuerswitch_proto"],
+- deps = [":issuerswitch_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "issuerswitch_php_gapic",
+- srcs = [":issuerswitch_proto_with_info"],
+- grpc_service_config = "issuerswitch_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "issuerswitch_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":issuerswitch_php_grpc",
+- ":issuerswitch_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-paymentgateway-issuerswitch-v1-php",
+- deps = [
+- ":issuerswitch_php_gapic",
+- ":issuerswitch_php_grpc",
+- ":issuerswitch_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "issuerswitch_nodejs_gapic",
+- package_name = "@google-cloud/issuerswitch",
+- src = ":issuerswitch_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "issuerswitch_grpc_service_config.json",
+- package = "google.cloud.paymentgateway.issuerswitch.v1",
+- rest_numeric_enums = False,
+- service_yaml = "issuerswitch_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "paymentgateway-issuerswitch-v1-nodejs",
+- deps = [
+- ":issuerswitch_nodejs_gapic",
+- ":issuerswitch_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "issuerswitch_ruby_proto",
+- deps = [":issuerswitch_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "issuerswitch_ruby_grpc",
+- srcs = [":issuerswitch_proto"],
+- deps = [":issuerswitch_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "issuerswitch_ruby_gapic",
+- srcs = [":issuerswitch_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-paymentgateway-issuerswitch-v1"],
+- grpc_service_config = "issuerswitch_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "issuerswitch_v1.yaml",
+- deps = [
+- ":issuerswitch_ruby_grpc",
+- ":issuerswitch_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-paymentgateway-issuerswitch-v1-ruby",
+- deps = [
+- ":issuerswitch_ruby_gapic",
+- ":issuerswitch_ruby_grpc",
+- ":issuerswitch_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "issuerswitch_csharp_proto",
+- deps = [":issuerswitch_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "issuerswitch_csharp_grpc",
+- srcs = [":issuerswitch_proto"],
+- deps = [":issuerswitch_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "issuerswitch_csharp_gapic",
+- srcs = [":issuerswitch_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "issuerswitch_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "issuerswitch_v1.yaml",
+- deps = [
+- ":issuerswitch_csharp_grpc",
+- ":issuerswitch_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-paymentgateway-issuerswitch-v1-csharp",
+- deps = [
+- ":issuerswitch_csharp_gapic",
+- ":issuerswitch_csharp_grpc",
+- ":issuerswitch_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "issuerswitch_cc_proto",
+- deps = [":issuerswitch_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "issuerswitch_cc_grpc",
+- srcs = [":issuerswitch_proto"],
+- grpc_only = True,
+- deps = [":issuerswitch_cc_proto"],
+-)
+diff -urN a/google/cloud/phishingprotection/BUILD.bazel b/google/cloud/phishingprotection/BUILD.bazel
+--- a/google/cloud/phishingprotection/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/phishingprotection/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,42 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-phishing_protection.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for phishingprotection.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta1 in this case.
+-ruby_cloud_gapic_library(
+- name = "phishingprotection_ruby_wrapper",
+- srcs = ["//google/cloud/phishingprotection/v1beta1:phishingprotection_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-phishing_protection",
+- "ruby-cloud-env-prefix=PHISHING_PROTECTION",
+- "ruby-cloud-wrapper-of=v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/phishing-protection",
+- "ruby-cloud-api-id=phishingprotection.googleapis.com",
+- "ruby-cloud-api-shortname=phishingprotection",
+- "ruby-cloud-migration-version=0.10",
+- "ruby-cloud-service-override=PhishingProtectionServiceV1Beta1=PhishingProtectionService",
+- ],
+- ruby_cloud_description = "Phishing Protection helps prevent users from accessing phishing sites by identifying various signals associated with malicious content, including the use of your brand assets, classifying malicious content that uses your brand and reporting the unsafe URLs to Google Safe Browsing.",
+- ruby_cloud_title = "Phishing Protection",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-phishingprotection-ruby",
+- deps = [
+- ":phishingprotection_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/phishingprotection/v1beta1/BUILD.bazel b/google/cloud/phishingprotection/v1beta1/BUILD.bazel
+--- a/google/cloud/phishingprotection/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/phishingprotection/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,357 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "phishingprotection_proto",
+- srcs = [
+- "phishingprotection.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "phishingprotection_proto_with_info",
+- deps = [
+- ":phishingprotection_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "phishingprotection_java_proto",
+- deps = [":phishingprotection_proto"],
+-)
+-
+-java_grpc_library(
+- name = "phishingprotection_java_grpc",
+- srcs = [":phishingprotection_proto"],
+- deps = [":phishingprotection_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "phishingprotection_java_gapic",
+- srcs = [":phishingprotection_proto_with_info"],
+- gapic_yaml = "phishingprotection_gapic.yaml",
+- grpc_service_config = "phishingprotection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":phishingprotection_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":phishingprotection_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "phishingprotection_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.phishingprotection.v1beta1.PhishingProtectionServiceV1Beta1ClientHttpJsonTest",
+- "com.google.cloud.phishingprotection.v1beta1.PhishingProtectionServiceV1Beta1ClientTest",
+- ],
+- runtime_deps = [":phishingprotection_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-phishingprotection-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":phishingprotection_java_gapic",
+- ":phishingprotection_java_grpc",
+- ":phishingprotection_java_proto",
+- ":phishingprotection_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "phishingprotection_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/phishingprotection/v1beta1",
+- protos = [":phishingprotection_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "phishingprotection_go_gapic",
+- srcs = [":phishingprotection_proto_with_info"],
+- grpc_service_config = "phishingprotection_grpc_service_config.json",
+- importpath = "cloud.google.com/go/phishingprotection/apiv1beta1;phishingprotection",
+- rest_numeric_enums = False,
+- service_yaml = "phishingprotection_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":phishingprotection_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "phishingprotection_go_gapic_test",
+- srcs = [":phishingprotection_go_gapic_srcjar_test"],
+- embed = [":phishingprotection_go_gapic"],
+- importpath = "cloud.google.com/go/phishingprotection/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-phishingprotection-v1beta1-go",
+- deps = [
+- ":phishingprotection_go_gapic",
+- ":phishingprotection_go_gapic_srcjar-test.srcjar",
+- ":phishingprotection_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "phishingprotection_py_gapic",
+- srcs = [":phishingprotection_proto"],
+- grpc_service_config = "phishingprotection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- opt_args = [
+- "warehouse-package-name=google-cloud-phishing-protection",
+- ],
+-)
+-
+-py_test(
+- name = "phishingprotection_py_gapic_test",
+- srcs = [
+- "phishingprotection_py_gapic_pytest.py",
+- "phishingprotection_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":phishingprotection_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "phishingprotection-v1beta1-py",
+- deps = [
+- ":phishingprotection_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "phishingprotection_php_proto",
+- deps = [":phishingprotection_proto"],
+-)
+-
+-php_grpc_library(
+- name = "phishingprotection_php_grpc",
+- srcs = [":phishingprotection_proto"],
+- deps = [":phishingprotection_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "phishingprotection_php_gapic",
+- srcs = [":phishingprotection_proto_with_info"],
+- grpc_service_config = "phishingprotection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":phishingprotection_php_grpc",
+- ":phishingprotection_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-phishingprotection-v1beta1-php",
+- deps = [
+- ":phishingprotection_php_gapic",
+- ":phishingprotection_php_grpc",
+- ":phishingprotection_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "phishingprotection_nodejs_gapic",
+- package_name = "@google-cloud/phishing-protection",
+- src = ":phishingprotection_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "phishingprotection_grpc_service_config.json",
+- package = "google.cloud.phishingprotection.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "phishingprotection_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "phishingprotection-v1beta1-nodejs",
+- deps = [
+- ":phishingprotection_nodejs_gapic",
+- ":phishingprotection_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "phishingprotection_ruby_proto",
+- deps = [":phishingprotection_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "phishingprotection_ruby_grpc",
+- srcs = [":phishingprotection_proto"],
+- deps = [":phishingprotection_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "phishingprotection_ruby_gapic",
+- srcs = [":phishingprotection_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-phishing_protection-v1beta1",
+- "ruby-cloud-env-prefix=PHISHING_PROTECTION",
+- "ruby-cloud-product-url=https://cloud.google.com/phishing-protection",
+- "ruby-cloud-api-id=phishingprotection.googleapis.com",
+- "ruby-cloud-api-shortname=phishingprotection",
+- "ruby-cloud-service-override=PhishingProtectionServiceV1Beta1=PhishingProtectionService",
+- ],
+- grpc_service_config = "phishingprotection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Phishing Protection helps prevent users from accessing phishing sites by identifying various signals associated with malicious content, including the use of your brand assets, classifying malicious content that uses your brand and reporting the unsafe URLs to Google Safe Browsing.",
+- ruby_cloud_title = "Phishing Protection V1beta1",
+- deps = [
+- ":phishingprotection_ruby_grpc",
+- ":phishingprotection_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-phishingprotection-v1beta1-ruby",
+- deps = [
+- ":phishingprotection_ruby_gapic",
+- ":phishingprotection_ruby_grpc",
+- ":phishingprotection_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "phishingprotection_csharp_proto",
+- deps = [":phishingprotection_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "phishingprotection_csharp_grpc",
+- srcs = [":phishingprotection_proto"],
+- deps = [":phishingprotection_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "phishingprotection_csharp_gapic",
+- srcs = [":phishingprotection_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "phishingprotection_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "phishingprotection_v1beta1.yaml",
+- deps = [
+- ":phishingprotection_csharp_grpc",
+- ":phishingprotection_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-phishingprotection-v1beta1-csharp",
+- deps = [
+- ":phishingprotection_csharp_gapic",
+- ":phishingprotection_csharp_grpc",
+- ":phishingprotection_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/policytroubleshooter/BUILD.bazel b/google/cloud/policytroubleshooter/BUILD.bazel
+--- a/google/cloud/policytroubleshooter/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/policytroubleshooter/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-policy_troubleshooter.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for policytroubleshooter.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "policytroubleshooter_ruby_wrapper",
+- srcs = ["//google/cloud/policytroubleshooter/v1:policytroubleshooter_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-policy_troubleshooter",
+- "ruby-cloud-env-prefix=POLICY_TROUBLESHOOTER",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/iam/docs/troubleshooting-access",
+- "ruby-cloud-api-id=policytroubleshooter.googleapis.com",
+- "ruby-cloud-api-shortname=policytroubleshooter",
+- ],
+- ruby_cloud_description = "Policy Troubleshooter makes it easier to understand why a user has access to a resource or doesn't have permission to call an API. Given an email, resource, and permission, Policy Troubleshooter will examine all IAM policies that apply to the resource. It then reveals whether the member's roles include the permission on that resource and, if so, which policies bind the member to those roles.",
+- ruby_cloud_title = "IAM Policy Troubleshooter",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-policytroubleshooter-ruby",
+- deps = [
+- ":policytroubleshooter_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/policytroubleshooter/v1/BUILD.bazel b/google/cloud/policytroubleshooter/v1/BUILD.bazel
+--- a/google/cloud/policytroubleshooter/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/policytroubleshooter/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,389 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "policytroubleshooter_proto",
+- srcs = [
+- "checker.proto",
+- "explanations.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/type:expr_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "policytroubleshooter_proto_with_info",
+- deps = [
+- ":policytroubleshooter_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "policytroubleshooter_java_proto",
+- deps = [":policytroubleshooter_proto"],
+-)
+-
+-java_grpc_library(
+- name = "policytroubleshooter_java_grpc",
+- srcs = [":policytroubleshooter_proto"],
+- deps = [":policytroubleshooter_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "policytroubleshooter_java_gapic",
+- srcs = [":policytroubleshooter_proto_with_info"],
+- grpc_service_config = "checker_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":policytroubleshooter_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":policytroubleshooter_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "policytroubleshooter_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.policytroubleshooter.v1.IamCheckerClientHttpJsonTest",
+- "com.google.cloud.policytroubleshooter.v1.IamCheckerClientTest",
+- ],
+- runtime_deps = [":policytroubleshooter_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-policytroubleshooter-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":policytroubleshooter_java_gapic",
+- ":policytroubleshooter_java_grpc",
+- ":policytroubleshooter_java_proto",
+- ":policytroubleshooter_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "policytroubleshooter_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/policytroubleshooter/v1",
+- protos = [":policytroubleshooter_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/type:expr_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "policytroubleshooter_go_gapic",
+- srcs = [":policytroubleshooter_proto_with_info"],
+- grpc_service_config = "checker_grpc_service_config.json",
+- importpath = "cloud.google.com/go/policytroubleshooter/apiv1;policytroubleshooter",
+- rest_numeric_enums = False,
+- service_yaml = "policytroubleshooter_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":policytroubleshooter_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "policytroubleshooter_go_gapic_test",
+- srcs = [":policytroubleshooter_go_gapic_srcjar_test"],
+- embed = [":policytroubleshooter_go_gapic"],
+- importpath = "cloud.google.com/go/policytroubleshooter/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-policytroubleshooter-v1-go",
+- deps = [
+- ":policytroubleshooter_go_gapic",
+- ":policytroubleshooter_go_gapic_srcjar-test.srcjar",
+- ":policytroubleshooter_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "policytroubleshooter_py_gapic",
+- srcs = [":policytroubleshooter_proto"],
+- grpc_service_config = "checker_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-policy-troubleshooter"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "policytroubleshooter_py_gapic_test",
+- srcs = [
+- "policytroubleshooter_py_gapic_pytest.py",
+- "policytroubleshooter_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":policytroubleshooter_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "google-cloud-policytroubleshooter-v1-py",
+- deps = [
+- ":policytroubleshooter_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "policytroubleshooter_php_proto",
+- deps = [":policytroubleshooter_proto"],
+-)
+-
+-php_grpc_library(
+- name = "policytroubleshooter_php_grpc",
+- srcs = [":policytroubleshooter_proto"],
+- deps = [":policytroubleshooter_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "policytroubleshooter_php_gapic",
+- srcs = [":policytroubleshooter_proto_with_info"],
+- grpc_service_config = "checker_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":policytroubleshooter_php_grpc",
+- ":policytroubleshooter_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-policytroubleshooter-v1-php",
+- deps = [
+- ":policytroubleshooter_php_gapic",
+- ":policytroubleshooter_php_grpc",
+- ":policytroubleshooter_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "policytroubleshooter_nodejs_gapic",
+- package_name = "@google-cloud/policy-troubleshooter",
+- src = ":policytroubleshooter_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "checker_grpc_service_config.json",
+- package = "google.cloud.policytroubleshooter.v1",
+- rest_numeric_enums = False,
+- service_yaml = "policytroubleshooter_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "policytroubleshooter-v1-nodejs",
+- deps = [
+- ":policytroubleshooter_nodejs_gapic",
+- ":policytroubleshooter_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "policytroubleshooter_ruby_proto",
+- deps = [":policytroubleshooter_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "policytroubleshooter_ruby_grpc",
+- srcs = [":policytroubleshooter_proto"],
+- deps = [":policytroubleshooter_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "policytroubleshooter_ruby_gapic",
+- srcs = [":policytroubleshooter_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=policytroubleshooter.googleapis.com",
+- "ruby-cloud-api-shortname=policytroubleshooter",
+- "ruby-cloud-env-prefix=POLICY_TROUBLESHOOTER",
+- "ruby-cloud-gem-name=google-cloud-policy_troubleshooter-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/iam/docs/troubleshooting-access",
+- ],
+- grpc_service_config = "checker_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Policy Troubleshooter makes it easier to understand why a user has access to a resource or doesn't have permission to call an API. Given an email, resource, and permission, Policy Troubleshooter will examine all IAM policies that apply to the resource. It then reveals whether the member's roles include the permission on that resource and, if so, which policies bind the member to those roles.",
+- ruby_cloud_title = "IAM Policy Troubleshooter V1",
+- deps = [
+- ":policytroubleshooter_ruby_grpc",
+- ":policytroubleshooter_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-policytroubleshooter-v1-ruby",
+- deps = [
+- ":policytroubleshooter_ruby_gapic",
+- ":policytroubleshooter_ruby_grpc",
+- ":policytroubleshooter_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "policytroubleshooter_csharp_proto",
+- deps = [":policytroubleshooter_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "policytroubleshooter_csharp_grpc",
+- srcs = [":policytroubleshooter_proto"],
+- deps = [":policytroubleshooter_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "policytroubleshooter_csharp_gapic",
+- srcs = [":policytroubleshooter_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "checker_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "policytroubleshooter_v1.yaml",
+- deps = [
+- ":policytroubleshooter_csharp_grpc",
+- ":policytroubleshooter_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-policytroubleshooter-v1-csharp",
+- deps = [
+- ":policytroubleshooter_csharp_gapic",
+- ":policytroubleshooter_csharp_grpc",
+- ":policytroubleshooter_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "policytroubleshooter_cc_proto",
+- deps = [":policytroubleshooter_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "policytroubleshooter_cc_grpc",
+- srcs = [":policytroubleshooter_proto"],
+- grpc_only = True,
+- deps = [":policytroubleshooter_cc_proto"],
+-)
+diff -urN a/google/cloud/privatecatalog/BUILD.bazel b/google/cloud/privatecatalog/BUILD.bazel
+--- a/google/cloud/privatecatalog/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/privatecatalog/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-private_catalog.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for cloudprivatecatalog.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta1 in this case.
+-ruby_cloud_gapic_library(
+- name = "cloudprivatecatalog_ruby_wrapper",
+- srcs = ["//google/cloud/privatecatalog/v1beta1:privatecatalog_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-private_catalog",
+- "ruby-cloud-env-prefix=PRIVATE_CATALOG",
+- "ruby-cloud-wrapper-of=v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/private-catalog/",
+- "ruby-cloud-api-id=cloudprivatecatalog.googleapis.com",
+- "ruby-cloud-api-shortname=cloudprivatecatalog",
+- ],
+- ruby_cloud_description = "With Private Catalog, developers and cloud admins can make their solutions discoverable to their internal enterprise users. Cloud admins can manage their solutions and ensure their users are always launching the latest versions.",
+- ruby_cloud_title = "Private Catalog",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-privatecatalog-ruby",
+- deps = [
+- ":cloudprivatecatalog_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/privatecatalog/v1beta1/BUILD.bazel b/google/cloud/privatecatalog/v1beta1/BUILD.bazel
+--- a/google/cloud/privatecatalog/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/privatecatalog/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,382 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "privatecatalog_proto",
+- srcs = [
+- "private_catalog.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "privatecatalog_proto_with_info",
+- deps = [
+- ":privatecatalog_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "privatecatalog_java_proto",
+- deps = [":privatecatalog_proto"],
+-)
+-
+-java_grpc_library(
+- name = "privatecatalog_java_grpc",
+- srcs = [":privatecatalog_proto"],
+- deps = [":privatecatalog_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "privatecatalog_java_gapic",
+- srcs = [":privatecatalog_proto_with_info"],
+- grpc_service_config = "cloudprivatecatalog_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":privatecatalog_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":privatecatalog_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "privatecatalog_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClientHttpJsonTest",
+- "com.google.cloud.privatecatalog.v1beta1.PrivateCatalogClientTest",
+- ],
+- runtime_deps = [":privatecatalog_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-privatecatalog-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":privatecatalog_java_gapic",
+- ":privatecatalog_java_grpc",
+- ":privatecatalog_java_proto",
+- ":privatecatalog_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "privatecatalog_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/privatecatalog/v1beta1",
+- protos = [":privatecatalog_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "privatecatalog_go_gapic",
+- srcs = [":privatecatalog_proto_with_info"],
+- grpc_service_config = "cloudprivatecatalog_grpc_service_config.json",
+- importpath = "cloud.google.com/go/privatecatalog/apiv1beta1;privatecatalog",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "cloudprivatecatalog_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":privatecatalog_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "privatecatalog_go_gapic_test",
+- srcs = [":privatecatalog_go_gapic_srcjar_test"],
+- embed = [":privatecatalog_go_gapic"],
+- importpath = "cloud.google.com/go/privatecatalog/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-privatecatalog-v1beta1-go",
+- deps = [
+- ":privatecatalog_go_gapic",
+- ":privatecatalog_go_gapic_srcjar-metadata.srcjar",
+- ":privatecatalog_go_gapic_srcjar-test.srcjar",
+- ":privatecatalog_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "privatecatalog_py_gapic",
+- srcs = [":privatecatalog_proto"],
+- grpc_service_config = "cloudprivatecatalog_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-private-catalog",
+- "autogen-snippets",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+-)
+-
+-py_test(
+- name = "privatecatalog_py_gapic_test",
+- srcs = [
+- "privatecatalog_py_gapic_pytest.py",
+- "privatecatalog_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":privatecatalog_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "privatecatalog-v1beta1-py",
+- deps = [
+- ":privatecatalog_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "privatecatalog_php_proto",
+- deps = [":privatecatalog_proto"],
+-)
+-
+-php_grpc_library(
+- name = "privatecatalog_php_grpc",
+- srcs = [":privatecatalog_proto"],
+- deps = [":privatecatalog_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "privatecatalog_php_gapic",
+- srcs = [":privatecatalog_proto_with_info"],
+- grpc_service_config = "cloudprivatecatalog_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudprivatecatalog_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":privatecatalog_php_grpc",
+- ":privatecatalog_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-privatecatalog-v1beta1-php",
+- deps = [
+- ":privatecatalog_php_gapic",
+- ":privatecatalog_php_grpc",
+- ":privatecatalog_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "privatecatalog_nodejs_gapic",
+- package_name = "@google-cloud/private-catalog",
+- src = ":privatecatalog_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudprivatecatalog_grpc_service_config.json",
+- package = "google.cloud.privatecatalog.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudprivatecatalog_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "privatecatalog-v1beta1-nodejs",
+- deps = [
+- ":privatecatalog_nodejs_gapic",
+- ":privatecatalog_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "privatecatalog_ruby_proto",
+- deps = [":privatecatalog_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "privatecatalog_ruby_grpc",
+- srcs = [":privatecatalog_proto"],
+- deps = [":privatecatalog_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "privatecatalog_ruby_gapic",
+- srcs = [":privatecatalog_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-private_catalog-v1beta1",
+- "ruby-cloud-env-prefix=PRIVATE_CATALOG",
+- "ruby-cloud-product-url=https://cloud.google.com/private-catalog/",
+- "ruby-cloud-api-id=cloudprivatecatalog.googleapis.com",
+- "ruby-cloud-api-shortname=cloudprivatecatalog",
+- "ruby-cloud-yard-strict=false",
+- ],
+- grpc_service_config = "cloudprivatecatalog_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "With Private Catalog, developers and cloud admins can make their solutions discoverable to their internal enterprise users. Cloud admins can manage their solutions and ensure their users are always launching the latest versions.",
+- ruby_cloud_title = "Private Catalog V1beta1",
+- deps = [
+- ":privatecatalog_ruby_grpc",
+- ":privatecatalog_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-privatecatalog-v1beta1-ruby",
+- deps = [
+- ":privatecatalog_ruby_gapic",
+- ":privatecatalog_ruby_grpc",
+- ":privatecatalog_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "privatecatalog_csharp_proto",
+- deps = [":privatecatalog_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "privatecatalog_csharp_grpc",
+- srcs = [":privatecatalog_proto"],
+- deps = [":privatecatalog_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "privatecatalog_csharp_gapic",
+- srcs = [":privatecatalog_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudprivatecatalog_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudprivatecatalog_v1beta1.yaml",
+- deps = [
+- ":privatecatalog_csharp_grpc",
+- ":privatecatalog_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-privatecatalog-v1beta1-csharp",
+- deps = [
+- ":privatecatalog_csharp_gapic",
+- ":privatecatalog_csharp_grpc",
+- ":privatecatalog_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/pubsublite/v1/BUILD.bazel b/google/cloud/pubsublite/v1/BUILD.bazel
+--- a/google/cloud/pubsublite/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/pubsublite/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,347 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "pubsublite_proto",
+- srcs = [
+- "admin.proto",
+- "common.proto",
+- "cursor.proto",
+- "publisher.proto",
+- "subscriber.proto",
+- "topic_stats.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "pubsublite_proto_with_info",
+- deps = [
+- ":pubsublite_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "pubsublite_java_proto",
+- deps = [":pubsublite_proto"],
+-)
+-
+-java_grpc_library(
+- name = "pubsublite_java_grpc",
+- srcs = [":pubsublite_proto"],
+- deps = [":pubsublite_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "pubsublite_java_gapic",
+- srcs = [":pubsublite_proto_with_info"],
+- gapic_yaml = "gapic.yaml",
+- grpc_service_config = "pubsublite_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":pubsublite_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":pubsublite_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "pubsublite_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.pubsublite.v1.AdminServiceClientTest",
+- "com.google.cloud.pubsublite.v1.CursorServiceClientTest",
+- "com.google.cloud.pubsublite.v1.PartitionAssignmentServiceClientTest",
+- "com.google.cloud.pubsublite.v1.PublisherServiceClientTest",
+- "com.google.cloud.pubsublite.v1.SubscriberServiceClientTest",
+- "com.google.cloud.pubsublite.v1.TopicStatsServiceClientTest",
+- ],
+- runtime_deps = [":pubsublite_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-pubsublite-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":pubsublite_java_gapic",
+- ":pubsublite_java_grpc",
+- ":pubsublite_java_proto",
+- ":pubsublite_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "pubsublite_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/pubsublite/v1",
+- protos = [":pubsublite_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "pubsublite_go_gapic",
+- srcs = [":pubsublite_proto_with_info"],
+- grpc_service_config = "pubsublite_grpc_service_config.json",
+- importpath = "cloud.google.com/go/pubsublite/apiv1;pubsublite",
+- rest_numeric_enums = False,
+- service_yaml = "pubsublite_v1.yaml",
+- deps = [
+- ":pubsublite_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "pubsublite_go_gapic_test",
+- srcs = [":pubsublite_go_gapic_srcjar_test"],
+- embed = [":pubsublite_go_gapic"],
+- importpath = "cloud.google.com/go/pubsublite/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-pubsublite-v1-go",
+- deps = [
+- ":pubsublite_go_gapic",
+- ":pubsublite_go_gapic_srcjar-test.srcjar",
+- ":pubsublite_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "pubsublite_py_gapic",
+- srcs = [":pubsublite_proto"],
+- grpc_service_config = "pubsublite_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "pubsublite_py_gapic_test",
+- srcs = [
+- "pubsublite_py_gapic_pytest.py",
+- "pubsublite_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":pubsublite_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "pubsublite-v1-py",
+- deps = [
+- ":pubsublite_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "pubsublite_nodejs_gapic",
+- package_name = "@google-cloud/pubsublite",
+- src = ":pubsublite_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "pubsublite_grpc_service_config.json",
+- package = "google.cloud.pubsublite.v1",
+- rest_numeric_enums = False,
+- service_yaml = "pubsublite_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "pubsublite-v1-nodejs",
+- deps = [
+- ":pubsublite_nodejs_gapic",
+- ":pubsublite_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "pubsublite_ruby_proto",
+- deps = [":pubsublite_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "pubsublite_ruby_grpc",
+- srcs = [":pubsublite_proto"],
+- deps = [":pubsublite_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "pubsublite_ruby_gapic",
+- srcs = [":pubsublite_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-pubsublite-v1"],
+- grpc_service_config = "pubsublite_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":pubsublite_ruby_grpc",
+- ":pubsublite_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-pubsublite-v1-ruby",
+- deps = [
+- ":pubsublite_ruby_gapic",
+- ":pubsublite_ruby_grpc",
+- ":pubsublite_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "pubsublite_csharp_proto",
+- deps = [":pubsublite_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "pubsublite_csharp_grpc",
+- srcs = [":pubsublite_proto"],
+- deps = [":pubsublite_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "pubsublite_csharp_gapic",
+- srcs = [":pubsublite_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "pubsublite_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "pubsublite_v1.yaml",
+- deps = [
+- ":pubsublite_csharp_grpc",
+- ":pubsublite_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-pubsublite-v1-csharp",
+- deps = [
+- ":pubsublite_csharp_gapic",
+- ":pubsublite_csharp_grpc",
+- ":pubsublite_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "pubsublite_cc_proto",
+- deps = [":pubsublite_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "pubsublite_cc_grpc",
+- srcs = [":pubsublite_proto"],
+- grpc_only = True,
+- deps = [":pubsublite_cc_proto"],
+-)
+diff -urN a/google/cloud/recaptchaenterprise/BUILD.bazel b/google/cloud/recaptchaenterprise/BUILD.bazel
+--- a/google/cloud/recaptchaenterprise/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/recaptchaenterprise/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-recaptcha_enterprise.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for recaptchaenterprise.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "recaptchaenterprise_ruby_wrapper",
+- srcs = ["//google/cloud/recaptchaenterprise/v1:recaptchaenterprise_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-recaptcha_enterprise",
+- "ruby-cloud-env-prefix=RECAPTCHA_ENTERPRISE",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/recaptcha-enterprise",
+- "ruby-cloud-api-id=recaptchaenterprise.googleapis.com",
+- "ruby-cloud-api-shortname=recaptchaenterprise",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "reCAPTCHA Enterprise is a service that protects your site from spam and abuse.",
+- ruby_cloud_title = "reCAPTCHA Enterprise",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-recaptchaenterprise-ruby",
+- deps = [
+- ":recaptchaenterprise_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/recaptchaenterprise/v1/BUILD.bazel b/google/cloud/recaptchaenterprise/v1/BUILD.bazel
+--- a/google/cloud/recaptchaenterprise/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/recaptchaenterprise/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,383 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "recaptchaenterprise_proto",
+- srcs = [
+- "recaptchaenterprise.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "recaptchaenterprise_proto_with_info",
+- deps = [
+- ":recaptchaenterprise_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "recaptchaenterprise_java_proto",
+- deps = [":recaptchaenterprise_proto"],
+-)
+-
+-java_grpc_library(
+- name = "recaptchaenterprise_java_grpc",
+- srcs = [":recaptchaenterprise_proto"],
+- deps = [":recaptchaenterprise_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "recaptchaenterprise_java_gapic",
+- srcs = [":recaptchaenterprise_proto_with_info"],
+- gapic_yaml = "recaptchaenterprise_gapic.yaml",
+- grpc_service_config = "recaptchaenterprise_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":recaptchaenterprise_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":recaptchaenterprise_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "recaptchaenterprise_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.recaptchaenterprise.v1.RecaptchaEnterpriseServiceClientTest",
+- ],
+- runtime_deps = [":recaptchaenterprise_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-recaptchaenterprise-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":recaptchaenterprise_java_gapic",
+- ":recaptchaenterprise_java_grpc",
+- ":recaptchaenterprise_java_proto",
+- ":recaptchaenterprise_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "recaptchaenterprise_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1",
+- protos = [":recaptchaenterprise_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "recaptchaenterprise_go_gapic",
+- srcs = [":recaptchaenterprise_proto_with_info"],
+- grpc_service_config = "recaptchaenterprise_grpc_service_config.json",
+- importpath = "cloud.google.com/go/recaptchaenterprise/apiv1;recaptchaenterprise",
+- rest_numeric_enums = False,
+- service_yaml = "recaptchaenterprise_v1.yaml",
+- deps = [
+- ":recaptchaenterprise_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "recaptchaenterprise_go_gapic_test",
+- srcs = [":recaptchaenterprise_go_gapic_srcjar_test"],
+- embed = [":recaptchaenterprise_go_gapic"],
+- importpath = "cloud.google.com/go/recaptchaenterprise/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-recaptchaenterprise-v1-go",
+- deps = [
+- ":recaptchaenterprise_go_gapic",
+- ":recaptchaenterprise_go_gapic_srcjar-test.srcjar",
+- ":recaptchaenterprise_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "recaptchaenterprise_py_gapic",
+- srcs = [":recaptchaenterprise_proto"],
+- grpc_service_config = "recaptchaenterprise_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-recaptcha-enterprise",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "recaptchaenterprise_py_gapic_test",
+- srcs = [
+- "recaptchaenterprise_py_gapic_pytest.py",
+- "recaptchaenterprise_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":recaptchaenterprise_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "recaptchaenterprise-v1-py",
+- deps = [
+- ":recaptchaenterprise_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "recaptchaenterprise_php_proto",
+- deps = [":recaptchaenterprise_proto"],
+-)
+-
+-php_grpc_library(
+- name = "recaptchaenterprise_php_grpc",
+- srcs = [":recaptchaenterprise_proto"],
+- deps = [":recaptchaenterprise_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "recaptchaenterprise_php_gapic",
+- srcs = [":recaptchaenterprise_proto_with_info"],
+- grpc_service_config = "recaptchaenterprise_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":recaptchaenterprise_php_grpc",
+- ":recaptchaenterprise_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-recaptchaenterprise-v1-php",
+- deps = [
+- ":recaptchaenterprise_php_gapic",
+- ":recaptchaenterprise_php_grpc",
+- ":recaptchaenterprise_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "recaptchaenterprise_nodejs_gapic",
+- package_name = "@google-cloud/recaptcha-enterprise",
+- src = ":recaptchaenterprise_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "recaptchaenterprise_grpc_service_config.json",
+- package = "google.cloud.recaptchaenterprise.v1",
+- rest_numeric_enums = False,
+- service_yaml = "recaptchaenterprise_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "recaptchaenterprise-v1-nodejs",
+- deps = [
+- ":recaptchaenterprise_nodejs_gapic",
+- ":recaptchaenterprise_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "recaptchaenterprise_ruby_proto",
+- deps = [":recaptchaenterprise_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "recaptchaenterprise_ruby_grpc",
+- srcs = [":recaptchaenterprise_proto"],
+- deps = [":recaptchaenterprise_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "recaptchaenterprise_ruby_gapic",
+- srcs = [":recaptchaenterprise_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-recaptcha_enterprise-v1",
+- "ruby-cloud-env-prefix=RECAPTCHA_ENTERPRISE",
+- "ruby-cloud-product-url=https://cloud.google.com/recaptcha-enterprise",
+- "ruby-cloud-api-id=recaptchaenterprise.googleapis.com",
+- "ruby-cloud-api-shortname=recaptchaenterprise",
+- ],
+- grpc_service_config = "recaptchaenterprise_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "reCAPTCHA Enterprise is a service that protects your site from spam and abuse.",
+- ruby_cloud_title = "reCAPTCHA Enterprise V1",
+- deps = [
+- ":recaptchaenterprise_ruby_grpc",
+- ":recaptchaenterprise_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-recaptchaenterprise-v1-ruby",
+- deps = [
+- ":recaptchaenterprise_ruby_gapic",
+- ":recaptchaenterprise_ruby_grpc",
+- ":recaptchaenterprise_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "recaptchaenterprise_csharp_proto",
+- deps = [":recaptchaenterprise_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "recaptchaenterprise_csharp_grpc",
+- srcs = [":recaptchaenterprise_proto"],
+- deps = [":recaptchaenterprise_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "recaptchaenterprise_csharp_gapic",
+- srcs = [":recaptchaenterprise_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "recaptchaenterprise_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "recaptchaenterprise_v1.yaml",
+- deps = [
+- ":recaptchaenterprise_csharp_grpc",
+- ":recaptchaenterprise_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-recaptchaenterprise-v1-csharp",
+- deps = [
+- ":recaptchaenterprise_csharp_gapic",
+- ":recaptchaenterprise_csharp_grpc",
+- ":recaptchaenterprise_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "recaptchaenterprise_cc_proto",
+- deps = [":recaptchaenterprise_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "recaptchaenterprise_cc_grpc",
+- srcs = [":recaptchaenterprise_proto"],
+- grpc_only = True,
+- deps = [":recaptchaenterprise_cc_proto"],
+-)
+diff -urN a/google/cloud/recaptchaenterprise/v1beta1/BUILD.bazel b/google/cloud/recaptchaenterprise/v1beta1/BUILD.bazel
+--- a/google/cloud/recaptchaenterprise/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/recaptchaenterprise/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,370 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "recaptchaenterprise_proto",
+- srcs = [
+- "recaptchaenterprise.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "recaptchaenterprise_proto_with_info",
+- deps = [
+- ":recaptchaenterprise_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "recaptchaenterprise_java_proto",
+- deps = [":recaptchaenterprise_proto"],
+-)
+-
+-java_grpc_library(
+- name = "recaptchaenterprise_java_grpc",
+- srcs = [":recaptchaenterprise_proto"],
+- deps = [":recaptchaenterprise_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "recaptchaenterprise_java_gapic",
+- srcs = [":recaptchaenterprise_proto_with_info"],
+- gapic_yaml = "recaptchaenterprise_gapic.yaml",
+- grpc_service_config = "recaptchaenterprise_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":recaptchaenterprise_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":recaptchaenterprise_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "recaptchaenterprise_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1ClientHttpJsonTest",
+- "com.google.cloud.recaptchaenterprise.v1beta1.RecaptchaEnterpriseServiceV1Beta1ClientTest",
+- ],
+- runtime_deps = [":recaptchaenterprise_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-recaptchaenterprise-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":recaptchaenterprise_java_gapic",
+- ":recaptchaenterprise_java_grpc",
+- ":recaptchaenterprise_java_proto",
+- ":recaptchaenterprise_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "recaptchaenterprise_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1beta1",
+- protos = [":recaptchaenterprise_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "recaptchaenterprise_go_gapic",
+- srcs = [":recaptchaenterprise_proto_with_info"],
+- grpc_service_config = "recaptchaenterprise_grpc_service_config.json",
+- importpath = "cloud.google.com/go/recaptchaenterprise/apiv1beta1;recaptchaenterprise",
+- rest_numeric_enums = False,
+- service_yaml = "recaptchaenterprise_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":recaptchaenterprise_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "recaptchaenterprise_go_gapic_test",
+- srcs = [":recaptchaenterprise_go_gapic_srcjar_test"],
+- embed = [":recaptchaenterprise_go_gapic"],
+- importpath = "cloud.google.com/go/recaptchaenterprise/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-recaptchaenterprise-v1beta1-go",
+- deps = [
+- ":recaptchaenterprise_go_gapic",
+- ":recaptchaenterprise_go_gapic_srcjar-test.srcjar",
+- ":recaptchaenterprise_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "recaptchaenterprise_py_gapic",
+- srcs = [":recaptchaenterprise_proto"],
+- grpc_service_config = "recaptchaenterprise_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-recaptcha-enterprise",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "recaptchaenterprise_py_gapic_test",
+- srcs = [
+- "recaptchaenterprise_py_gapic_pytest.py",
+- "recaptchaenterprise_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":recaptchaenterprise_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "recaptchaenterprise-v1beta1-py",
+- deps = [
+- ":recaptchaenterprise_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "recaptchaenterprise_php_proto",
+- deps = [":recaptchaenterprise_proto"],
+-)
+-
+-php_grpc_library(
+- name = "recaptchaenterprise_php_grpc",
+- srcs = [":recaptchaenterprise_proto"],
+- deps = [":recaptchaenterprise_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "recaptchaenterprise_php_gapic",
+- srcs = [":recaptchaenterprise_proto_with_info"],
+- grpc_service_config = "recaptchaenterprise_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":recaptchaenterprise_php_grpc",
+- ":recaptchaenterprise_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-recaptchaenterprise-v1beta1-php",
+- deps = [
+- ":recaptchaenterprise_php_gapic",
+- ":recaptchaenterprise_php_grpc",
+- ":recaptchaenterprise_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "recaptchaenterprise_nodejs_gapic",
+- package_name = "@google-cloud/recaptcha-enterprise",
+- src = ":recaptchaenterprise_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "recaptchaenterprise_grpc_service_config.json",
+- package = "google.cloud.recaptchaenterprise.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "recaptchaenterprise_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "recaptchaenterprise-v1beta1-nodejs",
+- deps = [
+- ":recaptchaenterprise_nodejs_gapic",
+- ":recaptchaenterprise_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "recaptchaenterprise_ruby_proto",
+- deps = [":recaptchaenterprise_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "recaptchaenterprise_ruby_grpc",
+- srcs = [":recaptchaenterprise_proto"],
+- deps = [":recaptchaenterprise_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "recaptchaenterprise_ruby_gapic",
+- srcs = [":recaptchaenterprise_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-recaptcha_enterprise-v1beta1",
+- "ruby-cloud-env-prefix=RECAPTCHA_ENTERPRISE",
+- "ruby-cloud-product-url=https://cloud.google.com/recaptcha-enterprise",
+- "ruby-cloud-api-id=recaptchaenterprise.googleapis.com",
+- "ruby-cloud-api-shortname=recaptchaenterprise",
+- "ruby-cloud-service-override=RecaptchaEnterpriseServiceV1Beta1=RecaptchaEnterpriseService",
+- ],
+- grpc_service_config = "recaptchaenterprise_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "reCAPTCHA Enterprise is a service that protects your site from spam and abuse.",
+- ruby_cloud_title = "reCAPTCHA Enterprise V1beta1",
+- deps = [
+- ":recaptchaenterprise_ruby_grpc",
+- ":recaptchaenterprise_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-recaptchaenterprise-v1beta1-ruby",
+- deps = [
+- ":recaptchaenterprise_ruby_gapic",
+- ":recaptchaenterprise_ruby_grpc",
+- ":recaptchaenterprise_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "recaptchaenterprise_csharp_proto",
+- deps = [":recaptchaenterprise_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "recaptchaenterprise_csharp_grpc",
+- srcs = [":recaptchaenterprise_proto"],
+- deps = [":recaptchaenterprise_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "recaptchaenterprise_csharp_gapic",
+- srcs = [":recaptchaenterprise_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "recaptchaenterprise_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "recaptchaenterprise_v1beta1.yaml",
+- deps = [
+- ":recaptchaenterprise_csharp_grpc",
+- ":recaptchaenterprise_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-recaptchaenterprise-v1beta1-csharp",
+- deps = [
+- ":recaptchaenterprise_csharp_gapic",
+- ":recaptchaenterprise_csharp_grpc",
+- ":recaptchaenterprise_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/recommendationengine/BUILD.bazel b/google/cloud/recommendationengine/BUILD.bazel
+--- a/google/cloud/recommendationengine/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/recommendationengine/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-recommendation_engine.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for recommendationengine.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta1 in this case.
+-ruby_cloud_gapic_library(
+- name = "recommendationengine_ruby_wrapper",
+- srcs = ["//google/cloud/recommendationengine/v1beta1:recommendationengine_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-recommendation_engine",
+- "ruby-cloud-env-prefix=RECOMMENDATION_ENGINE",
+- "ruby-cloud-wrapper-of=v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/recommendations-ai/",
+- "ruby-cloud-api-id=recommendationengine.googleapis.com",
+- "ruby-cloud-api-shortname=recommendationengine",
+- ],
+- ruby_cloud_description = "Recommendations AI enables you to build an end-to-end personalized recommendation system based on state-of-the-art deep learning ML models, without a need for expertise in ML or recommendation systems.",
+- ruby_cloud_title = "Recommendations AI",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-recommendationengine-ruby",
+- deps = [
+- ":recommendationengine_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/recommendationengine/v1beta1/BUILD.bazel b/google/cloud/recommendationengine/v1beta1/BUILD.bazel
+--- a/google/cloud/recommendationengine/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/recommendationengine/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,342 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "recommendationengine_proto",
+- srcs = [
+- "catalog.proto",
+- "catalog_service.proto",
+- "common.proto",
+- "import.proto",
+- "prediction_apikey_registry_service.proto",
+- "prediction_service.proto",
+- "recommendationengine_resources.proto",
+- "user_event.proto",
+- "user_event_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:httpbody_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:date_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "recommendationengine_proto_with_info",
+- deps = [
+- ":recommendationengine_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "recommendationengine_java_proto",
+- deps = [
+- ":recommendationengine_proto",
+- ],
+-)
+-
+-java_grpc_library(
+- name = "recommendationengine_java_grpc",
+- srcs = [":recommendationengine_proto"],
+- deps = [":recommendationengine_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "recommendationengine_java_gapic",
+- srcs = [":recommendationengine_proto_with_info"],
+- gapic_yaml = "recommendationengine_gapic.yaml",
+- grpc_service_config = "recommendationengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":recommendationengine_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":recommendationengine_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "recommendationengine_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.recommendationengine.v1beta1.CatalogServiceClientHttpJsonTest",
+- "com.google.cloud.recommendationengine.v1beta1.CatalogServiceClientTest",
+- "com.google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistryClientHttpJsonTest",
+- "com.google.cloud.recommendationengine.v1beta1.PredictionApiKeyRegistryClientTest",
+- "com.google.cloud.recommendationengine.v1beta1.PredictionServiceClientHttpJsonTest",
+- "com.google.cloud.recommendationengine.v1beta1.PredictionServiceClientTest",
+- "com.google.cloud.recommendationengine.v1beta1.UserEventServiceClientHttpJsonTest",
+- "com.google.cloud.recommendationengine.v1beta1.UserEventServiceClientTest",
+- ],
+- runtime_deps = [":recommendationengine_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-recommendationengine-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":recommendationengine_java_gapic",
+- ":recommendationengine_java_grpc",
+- ":recommendationengine_java_proto",
+- ":recommendationengine_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "recommendationengine_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/recommendationengine/v1beta1",
+- protos = [":recommendationengine_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:date_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "recommendationengine_go_gapic",
+- srcs = [":recommendationengine_proto_with_info"],
+- grpc_service_config = "recommendationengine_grpc_service_config.json",
+- importpath = "cloud.google.com/go/recommendationengine/apiv1beta1;recommendationengine",
+- rest_numeric_enums = False,
+- service_yaml = "recommendationengine_v1beta1.yaml",
+- deps = [
+- ":recommendationengine_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "recommendationengine_go_gapic_test",
+- srcs = [":recommendationengine_go_gapic_srcjar_test"],
+- embed = [":recommendationengine_go_gapic"],
+- importpath = "cloud.google.com/go/recommendationengine/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-recommendationengine-v1beta1-go",
+- deps = [
+- ":recommendationengine_go_gapic",
+- ":recommendationengine_go_gapic_srcjar-test.srcjar",
+- ":recommendationengine_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "recommendationengine_py_gapic",
+- srcs = [":recommendationengine_proto"],
+- grpc_service_config = "recommendationengine_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-recommendations-ai"],
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+-)
+-
+-py_test(
+- name = "recommendationengine_py_gapic_test",
+- srcs = [
+- "recommendationengine_py_gapic_pytest.py",
+- "recommendationengine_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":recommendationengine_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "recommendationengine-v1beta1-py",
+- deps = [
+- ":recommendationengine_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "recommendationengine_php_proto",
+- deps = [":recommendationengine_proto"],
+-)
+-
+-php_grpc_library(
+- name = "recommendationengine_php_grpc",
+- srcs = [":recommendationengine_proto"],
+- deps = [":recommendationengine_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "recommendationengine_php_gapic",
+- srcs = [":recommendationengine_proto_with_info"],
+- gapic_yaml = "recommendationengine_gapic.yaml",
+- grpc_service_config = "recommendationengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "recommendationengine_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":recommendationengine_php_grpc",
+- ":recommendationengine_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-recommendationengine-v1beta1-php",
+- deps = [
+- ":recommendationengine_php_gapic",
+- ":recommendationengine_php_grpc",
+- ":recommendationengine_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "recommendationengine_nodejs_gapic",
+- src = ":recommendationengine_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "recommendationengine_grpc_service_config.json",
+- package = "google.cloud.recommendationengine.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "recommendationengine_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "recommendationengine-v1beta1-nodejs",
+- deps = [
+- ":recommendationengine_nodejs_gapic",
+- ":recommendationengine_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "recommendationengine_ruby_proto",
+- deps = [":recommendationengine_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "recommendationengine_ruby_grpc",
+- srcs = [":recommendationengine_proto"],
+- deps = [":recommendationengine_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "recommendationengine_ruby_gapic",
+- srcs = [":recommendationengine_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-recommendation_engine-v1beta1",
+- "ruby-cloud-env-prefix=RECOMMENDATION_ENGINE",
+- "ruby-cloud-product-url=https://cloud.google.com/recommendations-ai/",
+- "ruby-cloud-api-id=recommendationengine.googleapis.com",
+- "ruby-cloud-api-shortname=recommendationengine",
+- ],
+- grpc_service_config = "recommendationengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Recommendations AI enables you to build an end-to-end personalized recommendation system based on state-of-the-art deep learning ML models, without a need for expertise in ML or recommendation systems.",
+- ruby_cloud_title = "Recommendations AI V1beta1",
+- deps = [
+- ":recommendationengine_ruby_grpc",
+- ":recommendationengine_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-recommendationengine-v1beta1-ruby",
+- deps = [
+- ":recommendationengine_ruby_gapic",
+- ":recommendationengine_ruby_grpc",
+- ":recommendationengine_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "recommendationengine_csharp_proto",
+- deps = [":recommendationengine_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "recommendationengine_csharp_grpc",
+- srcs = [":recommendationengine_proto"],
+- deps = [":recommendationengine_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "recommendationengine_csharp_gapic",
+- srcs = [":recommendationengine_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "recommendationengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "recommendationengine_v1beta1.yaml",
+- deps = [
+- ":recommendationengine_csharp_grpc",
+- ":recommendationengine_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-recommendationengine-v1beta1-csharp",
+- deps = [
+- ":recommendationengine_csharp_gapic",
+- ":recommendationengine_csharp_grpc",
+- ":recommendationengine_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/recommender/BUILD.bazel b/google/cloud/recommender/BUILD.bazel
+--- a/google/cloud/recommender/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/recommender/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-recommender.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for recommender.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "recommender_ruby_wrapper",
+- srcs = ["//google/cloud/recommender/v1:recommender_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-recommender",
+- "ruby-cloud-env-prefix=RECOMMENDER",
+- "ruby-cloud-wrapper-of=v1:0.1",
+- "ruby-cloud-product-url=https://cloud.google.com/recommender",
+- "ruby-cloud-api-id=recommender.googleapis.com",
+- "ruby-cloud-api-shortname=recommender",
+- "ruby-cloud-factory-method-suffix=_service",
+- ],
+- ruby_cloud_description = "Recommender is a service on Google Cloud that provides usage recommendations for Cloud products and services.",
+- ruby_cloud_title = "Recommender",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-recommender-ruby",
+- deps = [
+- ":recommender_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/recommender/logging/v1/BUILD.bazel b/google/cloud/recommender/logging/v1/BUILD.bazel
+--- a/google/cloud/recommender/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/recommender/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,182 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "action_log.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/cloud/recommender/v1:recommender_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/recommender/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/cloud/recommender/v1:recommender_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/cloud/recommender/v1:recommender_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/recommender/logging/v1beta1/BUILD.bazel b/google/cloud/recommender/logging/v1beta1/BUILD.bazel
+--- a/google/cloud/recommender/logging/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/recommender/logging/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,164 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "action_log.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/cloud/recommender/v1beta1:recommender_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/recommender/logging/v1beta1",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/cloud/recommender/v1beta1:recommender_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/cloud/recommender/v1beta1:recommender_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/cloud/recommender/v1/BUILD.bazel b/google/cloud/recommender/v1/BUILD.bazel
+--- a/google/cloud/recommender/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/recommender/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,397 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "recommender_proto",
+- srcs = [
+- "insight.proto",
+- "insight_type_config.proto",
+- "recommendation.proto",
+- "recommender_config.proto",
+- "recommender_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/type:money_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "recommender_proto_with_info",
+- deps = [
+- ":recommender_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "recommender_java_proto",
+- deps = [":recommender_proto"],
+-)
+-
+-java_grpc_library(
+- name = "recommender_java_grpc",
+- srcs = [":recommender_proto"],
+- deps = [":recommender_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "recommender_java_gapic",
+- srcs = [":recommender_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "recommender_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "recommender_v1.yaml",
+- test_deps = [
+- ":recommender_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":recommender_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "recommender_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.recommender.v1.RecommenderClientHttpJsonTest",
+- "com.google.cloud.recommender.v1.RecommenderClientTest",
+- ],
+- runtime_deps = [":recommender_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-recommender-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":recommender_java_gapic",
+- ":recommender_java_grpc",
+- ":recommender_java_proto",
+- ":recommender_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "recommender_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/recommender/v1",
+- protos = [":recommender_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:money_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "recommender_go_gapic",
+- srcs = [":recommender_proto_with_info"],
+- grpc_service_config = "recommender_grpc_service_config.json",
+- importpath = "cloud.google.com/go/recommender/apiv1;recommender",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "recommender_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":recommender_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "recommender_go_gapic_test",
+- srcs = [":recommender_go_gapic_srcjar_test"],
+- embed = [":recommender_go_gapic"],
+- importpath = "cloud.google.com/go/recommender/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-recommender-v1-go",
+- deps = [
+- ":recommender_go_gapic",
+- ":recommender_go_gapic_srcjar-metadata.srcjar",
+- ":recommender_go_gapic_srcjar-test.srcjar",
+- ":recommender_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "recommender_py_gapic",
+- srcs = [":recommender_proto"],
+- grpc_service_config = "recommender_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "recommender_v1.yaml",
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "recommender_py_gapic_test",
+- srcs = [
+- "recommender_py_gapic_pytest.py",
+- "recommender_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":recommender_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "recommender-v1-py",
+- deps = [
+- ":recommender_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "recommender_php_proto",
+- deps = [":recommender_proto"],
+-)
+-
+-php_grpc_library(
+- name = "recommender_php_grpc",
+- srcs = [":recommender_proto"],
+- deps = [":recommender_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "recommender_php_gapic",
+- srcs = [":recommender_proto_with_info"],
+- grpc_service_config = "recommender_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "recommender_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":recommender_php_grpc",
+- ":recommender_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-recommender-v1-php",
+- deps = [
+- ":recommender_php_gapic",
+- ":recommender_php_grpc",
+- ":recommender_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "recommender_nodejs_gapic",
+- package_name = "@google-cloud/recommender",
+- src = ":recommender_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "recommender_grpc_service_config.json",
+- package = "google.cloud.recommender.v1",
+- rest_numeric_enums = False,
+- service_yaml = "recommender_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "recommender-v1-nodejs",
+- deps = [
+- ":recommender_nodejs_gapic",
+- ":recommender_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "recommender_ruby_proto",
+- deps = [":recommender_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "recommender_ruby_grpc",
+- srcs = [":recommender_proto"],
+- deps = [":recommender_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "recommender_ruby_gapic",
+- srcs = [":recommender_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=recommender.googleapis.com",
+- "ruby-cloud-api-shortname=recommender",
+- "ruby-cloud-env-prefix=RECOMMENDER",
+- "ruby-cloud-gem-name=google-cloud-recommender-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/recommender",
+- ],
+- grpc_service_config = "recommender_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Recommender is a service on Google Cloud that provides usage recommendations for Cloud products and services.",
+- ruby_cloud_title = "Recommender V1",
+- service_yaml = "recommender_v1.yaml",
+- deps = [
+- ":recommender_ruby_grpc",
+- ":recommender_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-recommender-v1-ruby",
+- deps = [
+- ":recommender_ruby_gapic",
+- ":recommender_ruby_grpc",
+- ":recommender_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "recommender_csharp_proto",
+- deps = [":recommender_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "recommender_csharp_grpc",
+- srcs = [":recommender_proto"],
+- deps = [":recommender_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "recommender_csharp_gapic",
+- srcs = [":recommender_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "recommender_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "recommender_v1.yaml",
+- deps = [
+- ":recommender_csharp_grpc",
+- ":recommender_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-recommender-v1-csharp",
+- deps = [
+- ":recommender_csharp_gapic",
+- ":recommender_csharp_grpc",
+- ":recommender_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "recommender_cc_proto",
+- deps = [":recommender_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "recommender_cc_grpc",
+- srcs = [":recommender_proto"],
+- grpc_only = True,
+- deps = [":recommender_cc_proto"],
+-)
+diff -urN a/google/cloud/recommender/v1beta1/BUILD.bazel b/google/cloud/recommender/v1beta1/BUILD.bazel
+--- a/google/cloud/recommender/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/recommender/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,389 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "recommender_proto",
+- srcs = [
+- "insight.proto",
+- "insight_type_config.proto",
+- "recommendation.proto",
+- "recommender_config.proto",
+- "recommender_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/type:money_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "recommender_proto_with_info",
+- deps = [
+- ":recommender_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "recommender_java_proto",
+- deps = [":recommender_proto"],
+-)
+-
+-java_grpc_library(
+- name = "recommender_java_grpc",
+- srcs = [":recommender_proto"],
+- deps = [":recommender_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "recommender_java_gapic",
+- srcs = [":recommender_proto_with_info"],
+- gapic_yaml = "recommender_gapic.yaml",
+- grpc_service_config = "recommender_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "recommender_v1beta1.yaml",
+- test_deps = [
+- ":recommender_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":recommender_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "recommender_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.recommender.v1beta1.RecommenderClientHttpJsonTest",
+- "com.google.cloud.recommender.v1beta1.RecommenderClientTest",
+- ],
+- runtime_deps = [":recommender_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-recommender-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":recommender_java_gapic",
+- ":recommender_java_grpc",
+- ":recommender_java_proto",
+- ":recommender_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "recommender_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/recommender/v1beta1",
+- protos = [":recommender_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:money_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "recommender_go_gapic",
+- srcs = [":recommender_proto_with_info"],
+- grpc_service_config = "recommender_grpc_service_config.json",
+- importpath = "cloud.google.com/go/recommender/apiv1beta1;recommender",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "recommender_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":recommender_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "recommender_go_gapic_test",
+- srcs = [":recommender_go_gapic_srcjar_test"],
+- embed = [":recommender_go_gapic"],
+- importpath = "cloud.google.com/go/recommender/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-recommender-v1beta1-go",
+- deps = [
+- ":recommender_go_gapic",
+- ":recommender_go_gapic_srcjar-metadata.srcjar",
+- ":recommender_go_gapic_srcjar-test.srcjar",
+- ":recommender_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "recommender_py_gapic",
+- srcs = [":recommender_proto"],
+- grpc_service_config = "recommender_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "recommender_v1beta1.yaml",
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "recommender_py_gapic_test",
+- srcs = [
+- "recommender_py_gapic_pytest.py",
+- "recommender_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":recommender_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "recommender-v1beta1-py",
+- deps = [
+- ":recommender_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "recommender_php_proto",
+- deps = [":recommender_proto"],
+-)
+-
+-php_grpc_library(
+- name = "recommender_php_grpc",
+- srcs = [":recommender_proto"],
+- deps = [":recommender_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "recommender_php_gapic",
+- srcs = [":recommender_proto_with_info"],
+- grpc_service_config = "recommender_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "recommender_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":recommender_php_grpc",
+- ":recommender_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-recommender-v1beta1-php",
+- deps = [
+- ":recommender_php_gapic",
+- ":recommender_php_grpc",
+- ":recommender_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "recommender_nodejs_gapic",
+- package_name = "@google-cloud/recommender",
+- src = ":recommender_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "recommender_grpc_service_config.json",
+- package = "google.cloud.recommender.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "recommender_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "recommender-v1beta1-nodejs",
+- deps = [
+- ":recommender_nodejs_gapic",
+- ":recommender_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "recommender_ruby_proto",
+- deps = [":recommender_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "recommender_ruby_grpc",
+- srcs = [":recommender_proto"],
+- deps = [":recommender_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "recommender_ruby_gapic",
+- srcs = [":recommender_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-recommender-v1beta1"],
+- grpc_service_config = "recommender_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "recommender_v1beta1.yaml",
+- deps = [
+- ":recommender_ruby_grpc",
+- ":recommender_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-recommender-v1beta1-ruby",
+- deps = [
+- ":recommender_ruby_gapic",
+- ":recommender_ruby_grpc",
+- ":recommender_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "recommender_csharp_proto",
+- deps = [":recommender_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "recommender_csharp_grpc",
+- srcs = [":recommender_proto"],
+- deps = [":recommender_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "recommender_csharp_gapic",
+- srcs = [":recommender_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "recommender_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "recommender_v1beta1.yaml",
+- deps = [
+- ":recommender_csharp_grpc",
+- ":recommender_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-recommender-v1beta1-csharp",
+- deps = [
+- ":recommender_csharp_gapic",
+- ":recommender_csharp_grpc",
+- ":recommender_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "recommender_cc_proto",
+- deps = [":recommender_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "recommender_cc_grpc",
+- srcs = [":recommender_proto"],
+- grpc_only = True,
+- deps = [":recommender_cc_proto"],
+-)
+diff -urN a/google/cloud/redis/BUILD.bazel b/google/cloud/redis/BUILD.bazel
+--- a/google/cloud/redis/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/redis/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-redis.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for redis.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "redis_ruby_wrapper",
+- srcs = ["//google/cloud/redis/v1:redis_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-redis",
+- "ruby-cloud-env-prefix=REDIS",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/memorystore/docs/redis",
+- "ruby-cloud-api-id=redis.googleapis.com",
+- "ruby-cloud-api-shortname=redis",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "Creates and manages Redis instances on the Google Cloud Platform.",
+- ruby_cloud_title = "Google Cloud Memorystore for Redis",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-redis-ruby",
+- deps = [
+- ":redis_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/redis/v1/BUILD.bazel b/google/cloud/redis/v1/BUILD.bazel
+--- a/google/cloud/redis/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/redis/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,397 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "redis_proto",
+- srcs = [
+- "cloud_redis.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:dayofweek_proto",
+- "//google/type:timeofday_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "redis_proto_with_info",
+- deps = [
+- ":redis_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "redis_java_proto",
+- deps = [":redis_proto"],
+-)
+-
+-java_grpc_library(
+- name = "redis_java_grpc",
+- srcs = [":redis_proto"],
+- deps = [":redis_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "redis_java_gapic",
+- srcs = [":redis_proto_with_info"],
+- gapic_yaml = "redis_gapic.yaml",
+- grpc_service_config = "redis_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "redis_v1.yaml",
+- test_deps = [
+- ":redis_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":redis_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "redis_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.redis.v1.CloudRedisClientHttpJsonTest",
+- "com.google.cloud.redis.v1.CloudRedisClientTest",
+- ],
+- runtime_deps = [":redis_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-redis-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":redis_java_gapic",
+- ":redis_java_grpc",
+- ":redis_java_proto",
+- ":redis_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "redis_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/redis/v1",
+- protos = [":redis_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:dayofweek_go_proto",
+- "//google/type:timeofday_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "redis_go_gapic",
+- srcs = [":redis_proto_with_info"],
+- grpc_service_config = "redis_grpc_service_config.json",
+- importpath = "cloud.google.com/go/redis/apiv1;redis",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "redis_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":redis_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "redis_go_gapic_test",
+- srcs = [":redis_go_gapic_srcjar_test"],
+- embed = [":redis_go_gapic"],
+- importpath = "cloud.google.com/go/redis/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-redis-v1-go",
+- deps = [
+- ":redis_go_gapic",
+- ":redis_go_gapic_srcjar-metadata.srcjar",
+- ":redis_go_gapic_srcjar-test.srcjar",
+- ":redis_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "redis_py_gapic",
+- srcs = [":redis_proto"],
+- grpc_service_config = "redis_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "redis_py_gapic_test",
+- srcs = [
+- "redis_py_gapic_pytest.py",
+- "redis_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":redis_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "redis-v1-py",
+- deps = [
+- ":redis_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "redis_php_proto",
+- deps = [":redis_proto"],
+-)
+-
+-php_grpc_library(
+- name = "redis_php_grpc",
+- srcs = [":redis_proto"],
+- deps = [":redis_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "redis_php_gapic",
+- srcs = [":redis_proto_with_info"],
+- grpc_service_config = "redis_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "redis_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":redis_php_grpc",
+- ":redis_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-redis-v1-php",
+- deps = [
+- ":redis_php_gapic",
+- ":redis_php_grpc",
+- ":redis_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "redis_nodejs_gapic",
+- package_name = "@google-cloud/redis",
+- src = ":redis_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "redis_grpc_service_config.json",
+- package = "google.cloud.redis.v1",
+- rest_numeric_enums = False,
+- service_yaml = "redis_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "redis-v1-nodejs",
+- deps = [
+- ":redis_nodejs_gapic",
+- ":redis_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "redis_ruby_proto",
+- deps = [":redis_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "redis_ruby_grpc",
+- srcs = [":redis_proto"],
+- deps = [":redis_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "redis_ruby_gapic",
+- srcs = [":redis_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=redis.googleapis.com",
+- "ruby-cloud-api-shortname=redis",
+- "ruby-cloud-env-prefix=REDIS",
+- "ruby-cloud-gem-name=google-cloud-redis-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/memorystore/docs/redis",
+- ],
+- grpc_service_config = "redis_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Creates and manages Redis instances on the Google Cloud Platform.",
+- ruby_cloud_title = "Google Cloud Memorystore for Redis V1",
+- deps = [
+- ":redis_ruby_grpc",
+- ":redis_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-redis-v1-ruby",
+- deps = [
+- ":redis_ruby_gapic",
+- ":redis_ruby_grpc",
+- ":redis_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "redis_csharp_proto",
+- deps = [":redis_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "redis_csharp_grpc",
+- srcs = [":redis_proto"],
+- deps = [":redis_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "redis_csharp_gapic",
+- srcs = [":redis_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "redis_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "redis_v1.yaml",
+- deps = [
+- ":redis_csharp_grpc",
+- ":redis_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-redis-v1-csharp",
+- deps = [
+- ":redis_csharp_gapic",
+- ":redis_csharp_grpc",
+- ":redis_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "redis_cc_proto",
+- deps = [":redis_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "redis_cc_grpc",
+- srcs = [":redis_proto"],
+- grpc_only = True,
+- deps = [":redis_cc_proto"],
+-)
+diff -urN a/google/cloud/redis/v1beta1/BUILD.bazel b/google/cloud/redis/v1beta1/BUILD.bazel
+--- a/google/cloud/redis/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/redis/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,397 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "redis_proto",
+- srcs = [
+- "cloud_redis.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:dayofweek_proto",
+- "//google/type:timeofday_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "redis_proto_with_info",
+- deps = [
+- ":redis_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "redis_java_proto",
+- deps = [":redis_proto"],
+-)
+-
+-java_grpc_library(
+- name = "redis_java_grpc",
+- srcs = [":redis_proto"],
+- deps = [":redis_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "redis_java_gapic",
+- srcs = [":redis_proto_with_info"],
+- gapic_yaml = "redis_gapic.yaml",
+- grpc_service_config = "redis_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "redis_v1beta1.yaml",
+- test_deps = [
+- ":redis_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":redis_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "redis_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.redis.v1beta1.CloudRedisClientHttpJsonTest",
+- "com.google.cloud.redis.v1beta1.CloudRedisClientTest",
+- ],
+- runtime_deps = [":redis_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-redis-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":redis_java_gapic",
+- ":redis_java_grpc",
+- ":redis_java_proto",
+- ":redis_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "redis_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/redis/v1beta1",
+- protos = [":redis_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:dayofweek_go_proto",
+- "//google/type:timeofday_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "redis_go_gapic",
+- srcs = [":redis_proto_with_info"],
+- grpc_service_config = "redis_grpc_service_config.json",
+- importpath = "cloud.google.com/go/redis/apiv1beta1;redis",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "redis_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":redis_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "redis_go_gapic_test",
+- srcs = [":redis_go_gapic_srcjar_test"],
+- embed = [":redis_go_gapic"],
+- importpath = "cloud.google.com/go/redis/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-redis-v1beta1-go",
+- deps = [
+- ":redis_go_gapic",
+- ":redis_go_gapic_srcjar-metadata.srcjar",
+- ":redis_go_gapic_srcjar-test.srcjar",
+- ":redis_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "redis_py_gapic",
+- srcs = [":redis_proto"],
+- grpc_service_config = "redis_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "redis_py_gapic_test",
+- srcs = [
+- "redis_py_gapic_pytest.py",
+- "redis_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":redis_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "redis-v1beta1-py",
+- deps = [
+- ":redis_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "redis_php_proto",
+- deps = [":redis_proto"],
+-)
+-
+-php_grpc_library(
+- name = "redis_php_grpc",
+- srcs = [":redis_proto"],
+- deps = [":redis_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "redis_php_gapic",
+- srcs = [":redis_proto_with_info"],
+- grpc_service_config = "redis_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "redis_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":redis_php_grpc",
+- ":redis_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-redis-v1beta1-php",
+- deps = [
+- ":redis_php_gapic",
+- ":redis_php_grpc",
+- ":redis_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "redis_nodejs_gapic",
+- package_name = "@google-cloud/redis",
+- src = ":redis_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "redis_grpc_service_config.json",
+- package = "google.cloud.redis.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "redis_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "redis-v1beta1-nodejs",
+- deps = [
+- ":redis_nodejs_gapic",
+- ":redis_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "redis_ruby_proto",
+- deps = [":redis_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "redis_ruby_grpc",
+- srcs = [":redis_proto"],
+- deps = [":redis_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "redis_ruby_gapic",
+- srcs = [":redis_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=redis.googleapis.com",
+- "ruby-cloud-api-shortname=redis",
+- "ruby-cloud-env-prefix=REDIS",
+- "ruby-cloud-gem-name=google-cloud-redis-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/memorystore/docs/redis",
+- ],
+- grpc_service_config = "redis_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Creates and manages Redis instances on the Google Cloud Platform.",
+- ruby_cloud_title = "Google Cloud Memorystore for Redis V1beta1",
+- deps = [
+- ":redis_ruby_grpc",
+- ":redis_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-redis-v1beta1-ruby",
+- deps = [
+- ":redis_ruby_gapic",
+- ":redis_ruby_grpc",
+- ":redis_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "redis_csharp_proto",
+- deps = [":redis_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "redis_csharp_grpc",
+- srcs = [":redis_proto"],
+- deps = [":redis_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "redis_csharp_gapic",
+- srcs = [":redis_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "redis_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "redis_v1beta1.yaml",
+- deps = [
+- ":redis_csharp_grpc",
+- ":redis_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-redis-v1beta1-csharp",
+- deps = [
+- ":redis_csharp_gapic",
+- ":redis_csharp_grpc",
+- ":redis_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "redis_cc_proto",
+- deps = [":redis_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "redis_cc_grpc",
+- srcs = [":redis_proto"],
+- grpc_only = True,
+- deps = [":redis_cc_proto"],
+-)
+diff -urN a/google/cloud/resourcemanager/v2/BUILD.bazel b/google/cloud/resourcemanager/v2/BUILD.bazel
+--- a/google/cloud/resourcemanager/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/resourcemanager/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,195 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "resourcemanager_proto",
+- srcs = [
+- "folders.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "resourcemanager_proto_with_info",
+- deps = [
+- ":resourcemanager_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "resourcemanager_java_proto",
+- deps = [":resourcemanager_proto"],
+-)
+-
+-java_grpc_library(
+- name = "resourcemanager_java_grpc",
+- srcs = [":resourcemanager_proto"],
+- deps = [":resourcemanager_java_proto"],
+-)
+-
+-#############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "resourcemanager_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/resourcemanager/v2",
+- protos = [":resourcemanager_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "resourcemanager_moved_proto",
+- srcs = [":resourcemanager_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "resourcemanager_py_proto",
+- deps = [":resourcemanager_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "resourcemanager_py_grpc",
+- srcs = [":resourcemanager_moved_proto"],
+- deps = [":resourcemanager_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "resourcemanager_php_proto",
+- deps = [":resourcemanager_proto"],
+-)
+-
+-php_grpc_library(
+- name = "resourcemanager_php_grpc",
+- srcs = [":resourcemanager_proto"],
+- deps = [":resourcemanager_php_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "resourcemanager_ruby_proto",
+- deps = [":resourcemanager_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "resourcemanager_ruby_grpc",
+- srcs = [":resourcemanager_proto"],
+- deps = [":resourcemanager_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "resourcemanager_csharp_proto",
+- deps = [":resourcemanager_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "resourcemanager_csharp_grpc",
+- srcs = [":resourcemanager_proto"],
+- deps = [":resourcemanager_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "resourcemanager_cc_proto",
+- deps = [":resourcemanager_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "resourcemanager_cc_grpc",
+- srcs = [":resourcemanager_proto"],
+- grpc_only = True,
+- deps = [":resourcemanager_cc_proto"],
+-)
+diff -urN a/google/cloud/resourcemanager/v3/BUILD.bazel b/google/cloud/resourcemanager/v3/BUILD.bazel
+--- a/google/cloud/resourcemanager/v3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/resourcemanager/v3/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,414 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "resourcemanager_proto",
+- srcs = [
+- "folders.proto",
+- "organizations.proto",
+- "projects.proto",
+- "tag_bindings.proto",
+- "tag_keys.proto",
+- "tag_values.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "resourcemanager_proto_with_info",
+- deps = [
+- ":resourcemanager_proto",
+- # This line was manually modified since Projects, Folders, Organizations
+- # are special cased since they are also common resources.
+- #"//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "resourcemanager_java_proto",
+- deps = [":resourcemanager_proto"],
+-)
+-
+-java_grpc_library(
+- name = "resourcemanager_java_grpc",
+- srcs = [":resourcemanager_proto"],
+- deps = [":resourcemanager_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "resourcemanager_java_gapic",
+- srcs = [":resourcemanager_proto_with_info"],
+- grpc_service_config = "cloudresourcemanager_v3_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":resourcemanager_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":resourcemanager_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "resourcemanager_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.resourcemanager.v3.FoldersClientHttpJsonTest",
+- "com.google.cloud.resourcemanager.v3.FoldersClientTest",
+- "com.google.cloud.resourcemanager.v3.OrganizationsClientHttpJsonTest",
+- "com.google.cloud.resourcemanager.v3.OrganizationsClientTest",
+- "com.google.cloud.resourcemanager.v3.ProjectsClientHttpJsonTest",
+- "com.google.cloud.resourcemanager.v3.ProjectsClientTest",
+- "com.google.cloud.resourcemanager.v3.TagBindingsClientHttpJsonTest",
+- "com.google.cloud.resourcemanager.v3.TagBindingsClientTest",
+- "com.google.cloud.resourcemanager.v3.TagKeysClientHttpJsonTest",
+- "com.google.cloud.resourcemanager.v3.TagKeysClientTest",
+- "com.google.cloud.resourcemanager.v3.TagValuesClientHttpJsonTest",
+- "com.google.cloud.resourcemanager.v3.TagValuesClientTest",
+- ],
+- runtime_deps = [":resourcemanager_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-resourcemanager-v3-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":resourcemanager_java_gapic",
+- ":resourcemanager_java_grpc",
+- ":resourcemanager_java_proto",
+- ":resourcemanager_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "resourcemanager_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3",
+- protos = [":resourcemanager_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "resourcemanager_go_gapic",
+- srcs = [":resourcemanager_proto_with_info"],
+- grpc_service_config = "cloudresourcemanager_v3_grpc_service_config.json",
+- importpath = "cloud.google.com/go/resourcemanager/apiv3;resourcemanager",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "cloudresourcemanager_v3.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":resourcemanager_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "resourcemanager_go_gapic_test",
+- srcs = [":resourcemanager_go_gapic_srcjar_test"],
+- embed = [":resourcemanager_go_gapic"],
+- importpath = "cloud.google.com/go/resourcemanager/apiv3",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-resourcemanager-v3-go",
+- deps = [
+- ":resourcemanager_go_gapic",
+- ":resourcemanager_go_gapic_srcjar-metadata.srcjar",
+- ":resourcemanager_go_gapic_srcjar-test.srcjar",
+- ":resourcemanager_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "resourcemanager_py_gapic",
+- srcs = [":resourcemanager_proto"],
+- grpc_service_config = "cloudresourcemanager_v3_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "resourcemanager_py_gapic_test",
+- srcs = [
+- "resourcemanager_py_gapic_pytest.py",
+- "resourcemanager_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":resourcemanager_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "resourcemanager-v3-py",
+- deps = [
+- ":resourcemanager_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "resourcemanager_php_proto",
+- deps = [":resourcemanager_proto"],
+-)
+-
+-php_grpc_library(
+- name = "resourcemanager_php_grpc",
+- srcs = [":resourcemanager_proto"],
+- deps = [":resourcemanager_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "resourcemanager_php_gapic",
+- srcs = [":resourcemanager_proto_with_info"],
+- grpc_service_config = "cloudresourcemanager_v3_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudresourcemanager_v3.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":resourcemanager_php_grpc",
+- ":resourcemanager_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-resourcemanager-v3-php",
+- deps = [
+- ":resourcemanager_php_gapic",
+- ":resourcemanager_php_grpc",
+- ":resourcemanager_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "resourcemanager_nodejs_gapic",
+- package_name = "@google-cloud/resource-manager",
+- src = ":resourcemanager_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudresourcemanager_v3_grpc_service_config.json",
+- package = "google.cloud.resourcemanager.v3",
+- rest_numeric_enums = False,
+- service_yaml = "cloudresourcemanager_v3.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "resourcemanager-v3-nodejs",
+- deps = [
+- ":resourcemanager_nodejs_gapic",
+- ":resourcemanager_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "resourcemanager_ruby_proto",
+- deps = [":resourcemanager_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "resourcemanager_ruby_grpc",
+- srcs = [":resourcemanager_proto"],
+- deps = [":resourcemanager_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "resourcemanager_ruby_gapic",
+- srcs = [":resourcemanager_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-resource_manager-v3",
+- "ruby-cloud-env-prefix=RESOURCE_MANAGER",
+- "ruby-cloud-product-url=https://cloud.google.com/resource-manager/",
+- "ruby-cloud-api-id=cloudresourcemanager.googleapis.com",
+- "ruby-cloud-api-shortname=cloudresourcemanager",
+- ],
+- grpc_service_config = "cloudresourcemanager_v3_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Google Cloud provides container resources such as organizations and projects that allow you to group and hierarchically organize other Google Cloud resources. This hierarchical organization helps you manage common aspects of your resources, such as access control and configuration settings. The Resource Manager API enables you to programmatically manage these container resources.",
+- ruby_cloud_title = "Resource Manager V3",
+- deps = [
+- ":resourcemanager_ruby_grpc",
+- ":resourcemanager_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-resourcemanager-v3-ruby",
+- deps = [
+- ":resourcemanager_ruby_gapic",
+- ":resourcemanager_ruby_grpc",
+- ":resourcemanager_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "resourcemanager_csharp_proto",
+- deps = [":resourcemanager_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "resourcemanager_csharp_grpc",
+- srcs = [":resourcemanager_proto"],
+- deps = [":resourcemanager_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "resourcemanager_csharp_gapic",
+- srcs = [":resourcemanager_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudresourcemanager_v3_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudresourcemanager_v3.yaml",
+- deps = [
+- ":resourcemanager_csharp_grpc",
+- ":resourcemanager_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-resourcemanager-v3-csharp",
+- deps = [
+- ":resourcemanager_csharp_gapic",
+- ":resourcemanager_csharp_grpc",
+- ":resourcemanager_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "resourcemanager_cc_proto",
+- deps = [":resourcemanager_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "resourcemanager_cc_grpc",
+- srcs = [":resourcemanager_proto"],
+- grpc_only = True,
+- deps = [":resourcemanager_cc_proto"],
+-)
+diff -urN a/google/cloud/resourcesettings/BUILD.bazel b/google/cloud/resourcesettings/BUILD.bazel
+--- a/google/cloud/resourcesettings/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/resourcesettings/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-resource_settings.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for resourcesettings.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "resourcesettings_ruby_wrapper",
+- srcs = ["//google/cloud/resourcesettings/v1:resourcesettings_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-resource_settings",
+- "ruby-cloud-env-prefix=RESOURCE_SETTINGS",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/resource-manager/docs/resource-settings/overview",
+- "ruby-cloud-api-id=resourcesettings.googleapis.com",
+- "ruby-cloud-api-shortname=resourcesettings",
+- ],
+- ruby_cloud_description = "You can use Resource Settings to centrally configure settings for your Google Cloud projects, folders, and organization. These settings are inherited by their descendants in the resource hierarchy. Each setting is created and managed by Google.",
+- ruby_cloud_title = "Resource Settings",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-resourcesettings-ruby",
+- deps = [
+- ":resourcesettings_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/resourcesettings/v1/BUILD.bazel b/google/cloud/resourcesettings/v1/BUILD.bazel
+--- a/google/cloud/resourcesettings/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/resourcesettings/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,381 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "resourcesettings_proto",
+- srcs = [
+- "resource_settings.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "resourcesettings_proto_with_info",
+- deps = [
+- ":resourcesettings_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "resourcesettings_java_proto",
+- deps = [":resourcesettings_proto"],
+-)
+-
+-java_grpc_library(
+- name = "resourcesettings_java_grpc",
+- srcs = [":resourcesettings_proto"],
+- deps = [":resourcesettings_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "resourcesettings_java_gapic",
+- srcs = [":resourcesettings_proto_with_info"],
+- grpc_service_config = "resourcesettings_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":resourcesettings_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":resourcesettings_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "resourcesettings_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClientHttpJsonTest",
+- "com.google.cloud.resourcesettings.v1.ResourceSettingsServiceClientTest",
+- ],
+- runtime_deps = [":resourcesettings_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-resourcesettings-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":resourcesettings_java_gapic",
+- ":resourcesettings_java_grpc",
+- ":resourcesettings_java_proto",
+- ":resourcesettings_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "resourcesettings_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/resourcesettings/v1",
+- protos = [":resourcesettings_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "resourcesettings_go_gapic",
+- srcs = [":resourcesettings_proto_with_info"],
+- grpc_service_config = "resourcesettings_grpc_service_config.json",
+- importpath = "cloud.google.com/go/resourcesettings/apiv1;resourcesettings",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "resourcesettings_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":resourcesettings_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "resourcesettings_go_gapic_test",
+- srcs = [":resourcesettings_go_gapic_srcjar_test"],
+- embed = [":resourcesettings_go_gapic"],
+- importpath = "cloud.google.com/go/resourcesettings/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-resourcesettings-v1-go",
+- deps = [
+- ":resourcesettings_go_gapic",
+- ":resourcesettings_go_gapic_srcjar-metadata.srcjar",
+- ":resourcesettings_go_gapic_srcjar-test.srcjar",
+- ":resourcesettings_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "resourcesettings_py_gapic",
+- srcs = [":resourcesettings_proto"],
+- grpc_service_config = "resourcesettings_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-resource-settings"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "resourcesettings_py_gapic_test",
+- srcs = [
+- "resourcesettings_py_gapic_pytest.py",
+- "resourcesettings_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":resourcesettings_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "resourcesettings-v1-py",
+- deps = [
+- ":resourcesettings_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "resourcesettings_php_proto",
+- deps = [":resourcesettings_proto"],
+-)
+-
+-php_grpc_library(
+- name = "resourcesettings_php_grpc",
+- srcs = [":resourcesettings_proto"],
+- deps = [":resourcesettings_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "resourcesettings_php_gapic",
+- srcs = [":resourcesettings_proto_with_info"],
+- grpc_service_config = "resourcesettings_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "resourcesettings_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":resourcesettings_php_grpc",
+- ":resourcesettings_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-resourcesettings-v1-php",
+- deps = [
+- ":resourcesettings_php_gapic",
+- ":resourcesettings_php_grpc",
+- ":resourcesettings_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "resourcesettings_nodejs_gapic",
+- package_name = "@google-cloud/resource-settings",
+- src = ":resourcesettings_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "resourcesettings_grpc_service_config.json",
+- package = "google.cloud.resourcesettings.v1",
+- rest_numeric_enums = False,
+- service_yaml = "resourcesettings_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "resourcesettings-v1-nodejs",
+- deps = [
+- ":resourcesettings_nodejs_gapic",
+- ":resourcesettings_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "resourcesettings_ruby_proto",
+- deps = [":resourcesettings_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "resourcesettings_ruby_grpc",
+- srcs = [":resourcesettings_proto"],
+- deps = [":resourcesettings_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "resourcesettings_ruby_gapic",
+- srcs = [":resourcesettings_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-resource_settings-v1",
+- "ruby-cloud-env-prefix=RESOURCE_SETTINGS",
+- "ruby-cloud-product-url=https://cloud.google.com/resource-manager/docs/resource-settings/overview",
+- "ruby-cloud-api-id=resourcesettings.googleapis.com",
+- "ruby-cloud-api-shortname=resourcesettings",
+- ],
+- grpc_service_config = "resourcesettings_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "You can use Resource Settings to centrally configure settings for your Google Cloud projects, folders, and organization. These settings are inherited by their descendants in the resource hierarchy. Each setting is created and managed by Google.",
+- ruby_cloud_title = "Resource Settings V1",
+- deps = [
+- ":resourcesettings_ruby_grpc",
+- ":resourcesettings_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-resourcesettings-v1-ruby",
+- deps = [
+- ":resourcesettings_ruby_gapic",
+- ":resourcesettings_ruby_grpc",
+- ":resourcesettings_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "resourcesettings_csharp_proto",
+- deps = [":resourcesettings_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "resourcesettings_csharp_grpc",
+- srcs = [":resourcesettings_proto"],
+- deps = [":resourcesettings_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "resourcesettings_csharp_gapic",
+- srcs = [":resourcesettings_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "resourcesettings_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "resourcesettings_v1.yaml",
+- deps = [
+- ":resourcesettings_csharp_grpc",
+- ":resourcesettings_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-resourcesettings-v1-csharp",
+- deps = [
+- ":resourcesettings_csharp_gapic",
+- ":resourcesettings_csharp_grpc",
+- ":resourcesettings_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "resourcesettings_cc_proto",
+- deps = [":resourcesettings_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "resourcesettings_cc_grpc",
+- srcs = [":resourcesettings_proto"],
+- grpc_only = True,
+- deps = [":resourcesettings_cc_proto"],
+-)
+diff -urN a/google/cloud/retail/BUILD.bazel b/google/cloud/retail/BUILD.bazel
+--- a/google/cloud/retail/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/retail/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-retail.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for retail.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v2 in this case.
+-ruby_cloud_gapic_library(
+- name = "retail_ruby_wrapper",
+- srcs = ["//google/cloud/retail/v2:retail_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-retail",
+- "ruby-cloud-env-prefix=RETAIL",
+- "ruby-cloud-wrapper-of=v2:0.11",
+- "ruby-cloud-product-url=https://cloud.google.com/retail/docs/apis",
+- "ruby-cloud-api-id=retail.googleapis.com",
+- "ruby-cloud-api-shortname=retail",
+- ],
+- ruby_cloud_description = "Retail enables you to build an end-to-end personalized recommendation system based on state-of-the-art deep learning ML models, without a need for expertise in ML or recommendation systems.",
+- ruby_cloud_title = "Retail",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-retail-ruby",
+- deps = [
+- ":retail_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/retail/v2/BUILD.bazel b/google/cloud/retail/v2/BUILD.bazel
+--- a/google/cloud/retail/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/retail/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,434 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "retail_proto",
+- srcs = [
+- "catalog.proto",
+- "catalog_service.proto",
+- "common.proto",
+- "completion_service.proto",
+- "control.proto",
+- "control_service.proto",
+- "import_config.proto",
+- "prediction_service.proto",
+- "product.proto",
+- "product_service.proto",
+- "promotion.proto",
+- "purge_config.proto",
+- "search_service.proto",
+- "serving_config.proto",
+- "serving_config_service.proto",
+- "user_event.proto",
+- "user_event_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:httpbody_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:date_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "retail_proto_with_info",
+- deps = [
+- ":retail_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "retail_java_proto",
+- deps = [":retail_proto"],
+-)
+-
+-java_grpc_library(
+- name = "retail_java_grpc",
+- srcs = [":retail_proto"],
+- deps = [":retail_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "retail_java_gapic",
+- srcs = [":retail_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "retail_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "retail_v2.yaml",
+- test_deps = [
+- ":retail_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":retail_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "retail_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.retail.v2.CatalogServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2.CatalogServiceClientTest",
+- "com.google.cloud.retail.v2.ControlServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2.ControlServiceClientTest",
+- "com.google.cloud.retail.v2.CompletionServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2.CompletionServiceClientTest",
+- "com.google.cloud.retail.v2.PredictionServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2.PredictionServiceClientTest",
+- "com.google.cloud.retail.v2.ProductServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2.ProductServiceClientTest",
+- "com.google.cloud.retail.v2.SearchServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2.SearchServiceClientTest",
+- "com.google.cloud.retail.v2.ServingConfigServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2.ServingConfigServiceClientTest",
+- "com.google.cloud.retail.v2.UserEventServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2.UserEventServiceClientTest",
+- ],
+- runtime_deps = [":retail_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-retail-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":retail_java_gapic",
+- ":retail_java_grpc",
+- ":retail_java_proto",
+- ":retail_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "retail_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/retail/v2",
+- protos = [":retail_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:date_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "retail_go_gapic",
+- srcs = [":retail_proto_with_info"],
+- grpc_service_config = "retail_grpc_service_config.json",
+- importpath = "cloud.google.com/go/retail/apiv2;retail",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "retail_v2.yaml",
+- deps = [
+- ":retail_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "retail_go_gapic_test",
+- srcs = [":retail_go_gapic_srcjar_test"],
+- embed = [":retail_go_gapic"],
+- importpath = "cloud.google.com/go/retail/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-retail-v2-go",
+- deps = [
+- ":retail_go_gapic",
+- ":retail_go_gapic_srcjar-metadata.srcjar",
+- ":retail_go_gapic_srcjar-test.srcjar",
+- ":retail_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "retail_py_gapic",
+- srcs = [":retail_proto"],
+- grpc_service_config = "retail_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "retail_py_gapic_test",
+- srcs = [
+- "retail_py_gapic_pytest.py",
+- "retail_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":retail_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "retail-v2-py",
+- deps = [
+- ":retail_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "retail_php_proto",
+- deps = [":retail_proto"],
+-)
+-
+-php_grpc_library(
+- name = "retail_php_grpc",
+- srcs = [":retail_proto"],
+- deps = [":retail_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "retail_php_gapic",
+- srcs = [":retail_proto_with_info"],
+- grpc_service_config = "retail_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "retail_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":retail_php_grpc",
+- ":retail_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-retail-v2-php",
+- deps = [
+- ":retail_php_gapic",
+- ":retail_php_grpc",
+- ":retail_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "retail_nodejs_gapic",
+- package_name = "@google-cloud/retail",
+- src = ":retail_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "retail_grpc_service_config.json",
+- mixins = "google.longrunning.Operations;google.cloud.location.Locations",
+- package = "google.cloud.retail.v2",
+- rest_numeric_enums = False,
+- service_yaml = "retail_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "retail-v2-nodejs",
+- deps = [
+- ":retail_nodejs_gapic",
+- ":retail_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "retail_ruby_proto",
+- deps = [":retail_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "retail_ruby_grpc",
+- srcs = [":retail_proto"],
+- deps = [":retail_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "retail_ruby_gapic",
+- srcs = [":retail_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=retail.googleapis.com",
+- "ruby-cloud-api-shortname=retail",
+- "ruby-cloud-env-prefix=RETAIL",
+- "ruby-cloud-gem-name=google-cloud-retail-v2",
+- "ruby-cloud-product-url=https://cloud.google.com/retail/docs/apis",
+- ],
+- grpc_service_config = "retail_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Retail enables you to build an end-to-end personalized recommendation system based on state-of-the-art deep learning ML models, without a need for expertise in ML or recommendation systems.",
+- ruby_cloud_title = "Retail V2",
+- deps = [
+- ":retail_ruby_grpc",
+- ":retail_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-retail-v2-ruby",
+- deps = [
+- ":retail_ruby_gapic",
+- ":retail_ruby_grpc",
+- ":retail_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "retail_csharp_proto",
+- deps = [":retail_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "retail_csharp_grpc",
+- srcs = [":retail_proto"],
+- deps = [":retail_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "retail_csharp_gapic",
+- srcs = [":retail_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "retail_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "retail_v2.yaml",
+- deps = [
+- ":retail_csharp_grpc",
+- ":retail_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-retail-v2-csharp",
+- deps = [
+- ":retail_csharp_gapic",
+- ":retail_csharp_grpc",
+- ":retail_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "retail_cc_proto",
+- deps = [":retail_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "retail_cc_grpc",
+- srcs = [":retail_proto"],
+- grpc_only = True,
+- deps = [":retail_cc_proto"],
+-)
+diff -urN a/google/cloud/retail/v2alpha/BUILD.bazel b/google/cloud/retail/v2alpha/BUILD.bazel
+--- a/google/cloud/retail/v2alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/retail/v2alpha/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,439 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "retail_proto",
+- srcs = [
+- "catalog.proto",
+- "catalog_service.proto",
+- "common.proto",
+- "completion_service.proto",
+- "control.proto",
+- "control_service.proto",
+- "export_config.proto",
+- "import_config.proto",
+- "model.proto",
+- "model_service.proto",
+- "prediction_service.proto",
+- "product.proto",
+- "product_service.proto",
+- "promotion.proto",
+- "purge_config.proto",
+- "search_service.proto",
+- "serving_config.proto",
+- "serving_config_service.proto",
+- "user_event.proto",
+- "user_event_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:httpbody_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:date_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "retail_proto_with_info",
+- deps = [
+- ":retail_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "retail_java_proto",
+- deps = [":retail_proto"],
+-)
+-
+-java_grpc_library(
+- name = "retail_java_grpc",
+- srcs = [":retail_proto"],
+- deps = [":retail_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "retail_java_gapic",
+- srcs = [":retail_proto_with_info"],
+- gapic_yaml = "retail_gapic.yaml",
+- grpc_service_config = "retail_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "retail_v2alpha.yaml",
+- test_deps = [
+- ":retail_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":retail_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "retail_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.retail.v2alpha.CatalogServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2alpha.CatalogServiceClientTest",
+- "com.google.cloud.retail.v2alpha.CompletionServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2alpha.CompletionServiceClientTest",
+- "com.google.cloud.retail.v2alpha.ControlServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2alpha.ControlServiceClientTest",
+- "com.google.cloud.retail.v2alpha.ModelServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2alpha.ModelServiceClientTest",
+- "com.google.cloud.retail.v2alpha.PredictionServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2alpha.PredictionServiceClientTest",
+- "com.google.cloud.retail.v2alpha.ProductServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2alpha.ProductServiceClientTest",
+- "com.google.cloud.retail.v2alpha.SearchServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2alpha.SearchServiceClientTest",
+- "com.google.cloud.retail.v2alpha.ServingConfigServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2alpha.ServingConfigServiceClientTest",
+- "com.google.cloud.retail.v2alpha.UserEventServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2alpha.UserEventServiceClientTest",
+- ],
+- runtime_deps = [":retail_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-retail-v2alpha-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":retail_java_gapic",
+- ":retail_java_grpc",
+- ":retail_java_proto",
+- ":retail_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "retail_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha",
+- protos = [":retail_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:date_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "retail_go_gapic",
+- srcs = [":retail_proto_with_info"],
+- grpc_service_config = "retail_grpc_service_config.json",
+- importpath = "cloud.google.com/go/retail/apiv2alpha;retail",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "retail_v2alpha.yaml",
+- deps = [
+- ":retail_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "retail_go_gapic_test",
+- srcs = [":retail_go_gapic_srcjar_test"],
+- embed = [":retail_go_gapic"],
+- importpath = "cloud.google.com/go/retail/apiv2alpha",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-retail-v2alpha-go",
+- deps = [
+- ":retail_go_gapic",
+- ":retail_go_gapic_srcjar-metadata.srcjar",
+- ":retail_go_gapic_srcjar-test.srcjar",
+- ":retail_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "retail_py_gapic",
+- srcs = [":retail_proto"],
+- grpc_service_config = "retail_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "retail_py_gapic_test",
+- srcs = [
+- "retail_py_gapic_pytest.py",
+- "retail_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":retail_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "retail-v2alpha-py",
+- deps = [
+- ":retail_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "retail_php_proto",
+- deps = [":retail_proto"],
+-)
+-
+-php_grpc_library(
+- name = "retail_php_grpc",
+- srcs = [":retail_proto"],
+- deps = [":retail_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "retail_php_gapic",
+- srcs = [":retail_proto_with_info"],
+- grpc_service_config = "retail_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "retail_v2alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":retail_php_grpc",
+- ":retail_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-retail-v2alpha-php",
+- deps = [
+- ":retail_php_gapic",
+- ":retail_php_grpc",
+- ":retail_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "retail_nodejs_gapic",
+- package_name = "@google-cloud/retail",
+- src = ":retail_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "retail_grpc_service_config.json",
+- mixins = "google.longrunning.Operations;google.cloud.location.Locations",
+- package = "google.cloud.retail.v2alpha",
+- rest_numeric_enums = False,
+- service_yaml = "retail_v2alpha.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "retail-v2alpha-nodejs",
+- deps = [
+- ":retail_nodejs_gapic",
+- ":retail_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "retail_ruby_proto",
+- deps = [":retail_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "retail_ruby_grpc",
+- srcs = [":retail_proto"],
+- deps = [":retail_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "retail_ruby_gapic",
+- srcs = [":retail_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=retail.googleapis.com",
+- "ruby-cloud-api-shortname=retail",
+- "ruby-cloud-env-prefix=RETAIL",
+- "ruby-cloud-gem-name=google-cloud-retail-v2alpha",
+- "ruby-cloud-product-url=https://cloud.google.com/retail/docs/apis",
+- ],
+- grpc_service_config = "retail_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Retail enables you to build an end-to-end personalized recommendation system based on state-of-the-art deep learning ML models, without a need for expertise in ML or recommendation systems.",
+- ruby_cloud_title = "Retail V2alpha",
+- deps = [
+- ":retail_ruby_grpc",
+- ":retail_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-retail-v2alpha-ruby",
+- deps = [
+- ":retail_ruby_gapic",
+- ":retail_ruby_grpc",
+- ":retail_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "retail_csharp_proto",
+- deps = [":retail_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "retail_csharp_grpc",
+- srcs = [":retail_proto"],
+- deps = [":retail_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "retail_csharp_gapic",
+- srcs = [":retail_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "retail_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "retail_v2alpha.yaml",
+- deps = [
+- ":retail_csharp_grpc",
+- ":retail_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-retail-v2alpha-csharp",
+- deps = [
+- ":retail_csharp_gapic",
+- ":retail_csharp_grpc",
+- ":retail_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "retail_cc_proto",
+- deps = [":retail_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "retail_cc_grpc",
+- srcs = [":retail_proto"],
+- grpc_only = True,
+- deps = [":retail_cc_proto"],
+-)
+diff -urN a/google/cloud/retail/v2beta/BUILD.bazel b/google/cloud/retail/v2beta/BUILD.bazel
+--- a/google/cloud/retail/v2beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/retail/v2beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,439 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "retail_proto",
+- srcs = [
+- "catalog.proto",
+- "catalog_service.proto",
+- "common.proto",
+- "completion_service.proto",
+- "control.proto",
+- "control_service.proto",
+- "export_config.proto",
+- "import_config.proto",
+- "model.proto",
+- "model_service.proto",
+- "prediction_service.proto",
+- "product.proto",
+- "product_service.proto",
+- "promotion.proto",
+- "purge_config.proto",
+- "search_service.proto",
+- "serving_config.proto",
+- "serving_config_service.proto",
+- "user_event.proto",
+- "user_event_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:httpbody_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:date_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "retail_proto_with_info",
+- deps = [
+- ":retail_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "retail_java_proto",
+- deps = [":retail_proto"],
+-)
+-
+-java_grpc_library(
+- name = "retail_java_grpc",
+- srcs = [":retail_proto"],
+- deps = [":retail_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "retail_java_gapic",
+- srcs = [":retail_proto_with_info"],
+- gapic_yaml = "retail_gapic.yaml",
+- grpc_service_config = "retail_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "retail_v2beta.yaml",
+- test_deps = [
+- ":retail_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":retail_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "retail_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.retail.v2beta.CatalogServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2beta.CatalogServiceClientTest",
+- "com.google.cloud.retail.v2beta.CompletionServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2beta.CompletionServiceClientTest",
+- "com.google.cloud.retail.v2beta.ControlServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2beta.ControlServiceClientTest",
+- "com.google.cloud.retail.v2beta.ModelServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2beta.ModelServiceClientTest",
+- "com.google.cloud.retail.v2beta.PredictionServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2beta.PredictionServiceClientTest",
+- "com.google.cloud.retail.v2beta.ProductServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2beta.ProductServiceClientTest",
+- "com.google.cloud.retail.v2beta.SearchServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2beta.SearchServiceClientTest",
+- "com.google.cloud.retail.v2beta.ServingConfigServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2beta.ServingConfigServiceClientTest",
+- "com.google.cloud.retail.v2beta.UserEventServiceClientHttpJsonTest",
+- "com.google.cloud.retail.v2beta.UserEventServiceClientTest",
+- ],
+- runtime_deps = [":retail_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-retail-v2beta-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":retail_java_gapic",
+- ":retail_java_grpc",
+- ":retail_java_proto",
+- ":retail_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "retail_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/retail/v2beta",
+- protos = [":retail_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:date_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "retail_go_gapic",
+- srcs = [":retail_proto_with_info"],
+- grpc_service_config = "retail_grpc_service_config.json",
+- importpath = "cloud.google.com/go/retail/apiv2beta;retail",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "retail_v2beta.yaml",
+- deps = [
+- ":retail_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "retail_go_gapic_test",
+- srcs = [":retail_go_gapic_srcjar_test"],
+- embed = [":retail_go_gapic"],
+- importpath = "cloud.google.com/go/retail/apiv2beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-retail-v2beta-go",
+- deps = [
+- ":retail_go_gapic",
+- ":retail_go_gapic_srcjar-metadata.srcjar",
+- ":retail_go_gapic_srcjar-test.srcjar",
+- ":retail_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "retail_py_gapic",
+- srcs = [":retail_proto"],
+- grpc_service_config = "retail_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "retail_py_gapic_test",
+- srcs = [
+- "retail_py_gapic_pytest.py",
+- "retail_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":retail_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "retail-v2beta-py",
+- deps = [
+- ":retail_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "retail_php_proto",
+- deps = [":retail_proto"],
+-)
+-
+-php_grpc_library(
+- name = "retail_php_grpc",
+- srcs = [":retail_proto"],
+- deps = [":retail_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "retail_php_gapic",
+- srcs = [":retail_proto_with_info"],
+- grpc_service_config = "retail_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "retail_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":retail_php_grpc",
+- ":retail_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-retail-v2beta-php",
+- deps = [
+- ":retail_php_gapic",
+- ":retail_php_grpc",
+- ":retail_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "retail_nodejs_gapic",
+- package_name = "@google-cloud/retail",
+- src = ":retail_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "retail_grpc_service_config.json",
+- mixins = "google.longrunning.Operations;google.cloud.location.Locations",
+- package = "google.cloud.retail.v2beta",
+- rest_numeric_enums = False,
+- service_yaml = "retail_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "retail-v2beta-nodejs",
+- deps = [
+- ":retail_nodejs_gapic",
+- ":retail_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "retail_ruby_proto",
+- deps = [":retail_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "retail_ruby_grpc",
+- srcs = [":retail_proto"],
+- deps = [":retail_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "retail_ruby_gapic",
+- srcs = [":retail_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=retail.googleapis.com",
+- "ruby-cloud-api-shortname=retail",
+- "ruby-cloud-env-prefix=RETAIL",
+- "ruby-cloud-gem-name=google-cloud-retail-v2beta",
+- "ruby-cloud-product-url=https://cloud.google.com/retail/docs/apis",
+- ],
+- grpc_service_config = "retail_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Retail enables you to build an end-to-end personalized recommendation system based on state-of-the-art deep learning ML models, without a need for expertise in ML or recommendation systems.",
+- ruby_cloud_title = "Retail V2beta",
+- deps = [
+- ":retail_ruby_grpc",
+- ":retail_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-retail-v2beta-ruby",
+- deps = [
+- ":retail_ruby_gapic",
+- ":retail_ruby_grpc",
+- ":retail_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "retail_csharp_proto",
+- deps = [":retail_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "retail_csharp_grpc",
+- srcs = [":retail_proto"],
+- deps = [":retail_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "retail_csharp_gapic",
+- srcs = [":retail_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "retail_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "retail_v2beta.yaml",
+- deps = [
+- ":retail_csharp_grpc",
+- ":retail_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-retail-v2beta-csharp",
+- deps = [
+- ":retail_csharp_gapic",
+- ":retail_csharp_grpc",
+- ":retail_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "retail_cc_proto",
+- deps = [":retail_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "retail_cc_grpc",
+- srcs = [":retail_proto"],
+- grpc_only = True,
+- deps = [":retail_cc_proto"],
+-)
+diff -urN a/google/cloud/run/BUILD.bazel b/google/cloud/run/BUILD.bazel
+--- a/google/cloud/run/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/run/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-run.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for run.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v2 in this case.
+-ruby_cloud_gapic_library(
+- name = "run_ruby_wrapper",
+- srcs = ["//google/cloud/run/v2:run_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-run",
+- "ruby-cloud-wrapper-of=v2:0.5",
+- "ruby-cloud-product-url=https://cloud.google.com/run",
+- "ruby-cloud-api-id=run.googleapis.com",
+- "ruby-cloud-api-shortname=run",
+- ],
+- ruby_cloud_description = "Cloud Run deploys and manages user provided container images that scale automatically based on incoming requests.",
+- ruby_cloud_title = "Cloud Run",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-run-ruby",
+- deps = [
+- ":run_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/run/v2/BUILD.bazel b/google/cloud/run/v2/BUILD.bazel
+--- a/google/cloud/run/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/run/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,432 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "run_proto",
+- srcs = [
+- "condition.proto",
+- "execution.proto",
+- "execution_template.proto",
+- "job.proto",
+- "k8s.min.proto",
+- "revision.proto",
+- "revision_template.proto",
+- "service.proto",
+- "task.proto",
+- "task_template.proto",
+- "traffic_target.proto",
+- "vendor_settings.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:launch_stage_proto",
+- "//google/api:resource_proto",
+- "//google/api:routing_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "run_proto_with_info",
+- deps = [
+- ":run_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "run_java_proto",
+- deps = [":run_proto"],
+-)
+-
+-java_grpc_library(
+- name = "run_java_grpc",
+- srcs = [":run_proto"],
+- deps = [":run_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "run_java_gapic",
+- srcs = [":run_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "run_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "run_v2.yaml",
+- test_deps = [
+- ":run_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":run_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "run_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.run.v2.ExecutionsClientHttpJsonTest",
+- "com.google.cloud.run.v2.ExecutionsClientTest",
+- "com.google.cloud.run.v2.JobsClientHttpJsonTest",
+- "com.google.cloud.run.v2.JobsClientTest",
+- "com.google.cloud.run.v2.RevisionsClientHttpJsonTest",
+- "com.google.cloud.run.v2.RevisionsClientTest",
+- "com.google.cloud.run.v2.ServicesClientHttpJsonTest",
+- "com.google.cloud.run.v2.ServicesClientTest",
+- "com.google.cloud.run.v2.TasksClientHttpJsonTest",
+- "com.google.cloud.run.v2.TasksClientTest",
+- ],
+- runtime_deps = [":run_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-run-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":run_java_gapic",
+- ":run_java_grpc",
+- ":run_java_proto",
+- ":run_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "run_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/run/v2",
+- protos = [":run_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:api_go_proto",
+- "//google/api:routing_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "run_go_gapic",
+- srcs = [":run_proto_with_info"],
+- grpc_service_config = "run_grpc_service_config.json",
+- importpath = "cloud.google.com/go/run/apiv2;run",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "run_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":run_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "run_go_gapic_test",
+- srcs = [":run_go_gapic_srcjar_test"],
+- embed = [":run_go_gapic"],
+- importpath = "cloud.google.com/go/run/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-run-v2-go",
+- deps = [
+- ":run_go_gapic",
+- ":run_go_gapic_srcjar-metadata.srcjar",
+- ":run_go_gapic_srcjar-test.srcjar",
+- ":run_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "run_py_gapic",
+- srcs = [":run_proto"],
+- grpc_service_config = "run_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "run_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "run_py_gapic_test",
+- srcs = [
+- "run_py_gapic_pytest.py",
+- "run_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":run_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "run-v2-py",
+- deps = [
+- ":run_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "run_php_proto",
+- deps = [":run_proto"],
+-)
+-
+-php_grpc_library(
+- name = "run_php_grpc",
+- srcs = [":run_proto"],
+- deps = [":run_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "run_php_gapic",
+- srcs = [":run_proto_with_info"],
+- grpc_service_config = "run_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "run_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":run_php_grpc",
+- ":run_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-run-v2-php",
+- deps = [
+- ":run_php_gapic",
+- ":run_php_grpc",
+- ":run_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "run_nodejs_gapic",
+- package_name = "@google-cloud/run",
+- src = ":run_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "run_grpc_service_config.json",
+- package = "google.cloud.run.v2",
+- rest_numeric_enums = False,
+- service_yaml = "run_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "run-v2-nodejs",
+- deps = [
+- ":run_nodejs_gapic",
+- ":run_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "run_ruby_proto",
+- deps = [":run_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "run_ruby_grpc",
+- srcs = [":run_proto"],
+- deps = [":run_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "run_ruby_gapic",
+- srcs = [":run_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=run.googleapis.com",
+- "ruby-cloud-api-shortname=run",
+- "ruby-cloud-gem-name=google-cloud-run-v2",
+- "ruby-cloud-product-url=https://cloud.google.com/run/",
+- "ruby-cloud-wrapper-gem-override=google-cloud-run-client",
+- ],
+- grpc_service_config = "run_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Run deploys and manages user provided container images that scale automatically based on incoming requests.",
+- ruby_cloud_title = "Cloud Run V2",
+- service_yaml = "run_v2.yaml",
+- deps = [
+- ":run_ruby_grpc",
+- ":run_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-run-v2-ruby",
+- deps = [
+- ":run_ruby_gapic",
+- ":run_ruby_grpc",
+- ":run_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "run_csharp_proto",
+- deps = [":run_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "run_csharp_grpc",
+- srcs = [":run_proto"],
+- deps = [":run_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "run_csharp_gapic",
+- srcs = [":run_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "run_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "run_v2.yaml",
+- deps = [
+- ":run_csharp_grpc",
+- ":run_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-run-v2-csharp",
+- deps = [
+- ":run_csharp_gapic",
+- ":run_csharp_grpc",
+- ":run_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "run_cc_proto",
+- deps = [":run_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "run_cc_grpc",
+- srcs = [":run_proto"],
+- grpc_only = True,
+- deps = [":run_cc_proto"],
+-)
+diff -urN a/google/cloud/saasaccelerator/management/logs/v1/BUILD.bazel b/google/cloud/saasaccelerator/management/logs/v1/BUILD.bazel
+--- a/google/cloud/saasaccelerator/management/logs/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/saasaccelerator/management/logs/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,176 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logs_proto",
+- srcs = [
+- "notification_service_payload.proto",
+- "saas_instance_payload.proto",
+- ],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logs_java_proto",
+- deps = [":logs_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logs_java_grpc",
+- srcs = [":logs_proto"],
+- deps = [":logs_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logs_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/saasaccelerator/management/logs/v1",
+- protos = [":logs_proto"],
+- deps = [],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logs_moved_proto",
+- srcs = [":logs_proto"],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logs_py_proto",
+- deps = [":logs_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logs_py_grpc",
+- srcs = [":logs_moved_proto"],
+- deps = [":logs_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logs_php_proto",
+- deps = [":logs_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logs_php_grpc",
+- srcs = [":logs_proto"],
+- deps = [":logs_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logs_ruby_proto",
+- deps = [":logs_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logs_ruby_grpc",
+- srcs = [":logs_proto"],
+- deps = [":logs_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logs_csharp_proto",
+- deps = [":logs_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logs_csharp_grpc",
+- srcs = [":logs_proto"],
+- deps = [":logs_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logs_cc_proto",
+- deps = [":logs_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logs_cc_grpc",
+- srcs = [":logs_proto"],
+- grpc_only = True,
+- deps = [":logs_cc_proto"],
+-)
+diff -urN a/google/cloud/scheduler/BUILD.bazel b/google/cloud/scheduler/BUILD.bazel
+--- a/google/cloud/scheduler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/scheduler/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-scheduler.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for cloudscheduler.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "cloudscheduler_ruby_wrapper",
+- srcs = ["//google/cloud/scheduler/v1:scheduler_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-scheduler",
+- "ruby-cloud-env-prefix=SCHEDULER",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/scheduler",
+- "ruby-cloud-api-id=cloudscheduler.googleapis.com",
+- "ruby-cloud-api-shortname=cloudscheduler",
+- "ruby-cloud-migration-version=2.0",
+- ],
+- ruby_cloud_description = "Cloud Scheduler is a fully managed enterprise-grade cron job scheduler. It allows you to schedule virtually any job, including batch, big data jobs, cloud infrastructure operations, and more. You can automate everything, including retries in case of failure to reduce manual toil and intervention. Cloud Scheduler even acts as a single pane of glass, allowing you to manage all your automation tasks from one place.",
+- ruby_cloud_title = "Cloud Scheduler",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-scheduler-ruby",
+- deps = [
+- ":cloudscheduler_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/scheduler/v1/BUILD.bazel b/google/cloud/scheduler/v1/BUILD.bazel
+--- a/google/cloud/scheduler/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/scheduler/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,378 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "scheduler_proto",
+- srcs = [
+- "cloudscheduler.proto",
+- "job.proto",
+- "target.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "scheduler_proto_with_info",
+- deps = [
+- ":scheduler_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "scheduler_java_proto",
+- deps = [":scheduler_proto"],
+-)
+-
+-java_grpc_library(
+- name = "scheduler_java_grpc",
+- srcs = [":scheduler_proto"],
+- deps = [":scheduler_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "scheduler_java_gapic",
+- srcs = [":scheduler_proto_with_info"],
+- grpc_service_config = "cloudscheduler_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":scheduler_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":scheduler_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "scheduler_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.scheduler.v1.CloudSchedulerClientHttpJsonTest",
+- "com.google.cloud.scheduler.v1.CloudSchedulerClientTest",
+- ],
+- runtime_deps = [":scheduler_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-scheduler-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":scheduler_java_gapic",
+- ":scheduler_java_grpc",
+- ":scheduler_java_proto",
+- ":scheduler_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "scheduler_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/scheduler/v1",
+- protos = [":scheduler_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "scheduler_go_gapic",
+- srcs = [":scheduler_proto_with_info"],
+- grpc_service_config = "cloudscheduler_grpc_service_config.json",
+- importpath = "cloud.google.com/go/scheduler/apiv1;scheduler",
+- rest_numeric_enums = False,
+- service_yaml = "cloudscheduler_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":scheduler_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "scheduler_go_gapic_test",
+- srcs = [":scheduler_go_gapic_srcjar_test"],
+- embed = [":scheduler_go_gapic"],
+- importpath = "cloud.google.com/go/scheduler/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-scheduler-v1-go",
+- deps = [
+- ":scheduler_go_gapic",
+- ":scheduler_go_gapic_srcjar-test.srcjar",
+- ":scheduler_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "scheduler_py_gapic",
+- srcs = [":scheduler_proto"],
+- grpc_service_config = "cloudscheduler_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "scheduler_py_gapic_test",
+- srcs = [
+- "scheduler_py_gapic_pytest.py",
+- "scheduler_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":scheduler_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "scheduler-v1-py",
+- deps = [
+- ":scheduler_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "scheduler_php_proto",
+- deps = [":scheduler_proto"],
+-)
+-
+-php_grpc_library(
+- name = "scheduler_php_grpc",
+- srcs = [":scheduler_proto"],
+- deps = [":scheduler_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "scheduler_php_gapic",
+- srcs = [":scheduler_proto_with_info"],
+- grpc_service_config = "cloudscheduler_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":scheduler_php_grpc",
+- ":scheduler_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-scheduler-v1-php",
+- deps = [
+- ":scheduler_php_gapic",
+- ":scheduler_php_grpc",
+- ":scheduler_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "scheduler_nodejs_gapic",
+- package_name = "@google-cloud/scheduler",
+- src = ":scheduler_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudscheduler_grpc_service_config.json",
+- main_service = "scheduler",
+- package = "google.cloud.scheduler.v1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudscheduler_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "scheduler-v1-nodejs",
+- deps = [
+- ":scheduler_nodejs_gapic",
+- ":scheduler_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "scheduler_ruby_proto",
+- deps = [":scheduler_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "scheduler_ruby_grpc",
+- srcs = [":scheduler_proto"],
+- deps = [":scheduler_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "scheduler_ruby_gapic",
+- srcs = [":scheduler_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-scheduler-v1",
+- "ruby-cloud-env-prefix=SCHEDULER",
+- "ruby-cloud-product-url=https://cloud.google.com/scheduler",
+- "ruby-cloud-api-id=cloudscheduler.googleapis.com",
+- "ruby-cloud-api-shortname=cloudscheduler",
+- ],
+- grpc_service_config = "cloudscheduler_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Scheduler is a fully managed enterprise-grade cron job scheduler. It allows you to schedule virtually any job, including batch, big data jobs, cloud infrastructure operations, and more. You can automate everything, including retries in case of failure to reduce manual toil and intervention. Cloud Scheduler even acts as a single pane of glass, allowing you to manage all your automation tasks from one place.",
+- ruby_cloud_title = "Cloud Scheduler V1",
+- deps = [
+- ":scheduler_ruby_grpc",
+- ":scheduler_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-scheduler-v1-ruby",
+- deps = [
+- ":scheduler_ruby_gapic",
+- ":scheduler_ruby_grpc",
+- ":scheduler_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "scheduler_csharp_proto",
+- deps = [":scheduler_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "scheduler_csharp_grpc",
+- srcs = [":scheduler_proto"],
+- deps = [":scheduler_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "scheduler_csharp_gapic",
+- srcs = [":scheduler_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudscheduler_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudscheduler_v1.yaml",
+- deps = [
+- ":scheduler_csharp_grpc",
+- ":scheduler_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-scheduler-v1-csharp",
+- deps = [
+- ":scheduler_csharp_gapic",
+- ":scheduler_csharp_grpc",
+- ":scheduler_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "scheduler_cc_proto",
+- deps = [":scheduler_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "scheduler_cc_grpc",
+- srcs = [":scheduler_proto"],
+- grpc_only = True,
+- deps = [":scheduler_cc_proto"],
+-)
+diff -urN a/google/cloud/scheduler/v1beta1/BUILD.bazel b/google/cloud/scheduler/v1beta1/BUILD.bazel
+--- a/google/cloud/scheduler/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/scheduler/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,362 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "scheduler_proto",
+- srcs = [
+- "cloudscheduler.proto",
+- "job.proto",
+- "target.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "scheduler_proto_with_info",
+- deps = [
+- ":scheduler_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "scheduler_java_proto",
+- deps = [":scheduler_proto"],
+-)
+-
+-java_grpc_library(
+- name = "scheduler_java_grpc",
+- srcs = [":scheduler_proto"],
+- deps = [":scheduler_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "scheduler_java_gapic",
+- srcs = [":scheduler_proto_with_info"],
+- grpc_service_config = "cloudscheduler_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":scheduler_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":scheduler_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "scheduler_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.scheduler.v1beta1.CloudSchedulerClientHttpJsonTest",
+- "com.google.cloud.scheduler.v1beta1.CloudSchedulerClientTest",
+- ],
+- runtime_deps = [":scheduler_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-scheduler-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":scheduler_java_gapic",
+- ":scheduler_java_grpc",
+- ":scheduler_java_proto",
+- ":scheduler_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "scheduler_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1",
+- protos = [":scheduler_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "scheduler_go_gapic",
+- srcs = [":scheduler_proto_with_info"],
+- grpc_service_config = "cloudscheduler_grpc_service_config.json",
+- importpath = "cloud.google.com/go/scheduler/apiv1beta1;scheduler",
+- rest_numeric_enums = False,
+- service_yaml = "cloudscheduler_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":scheduler_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "scheduler_go_gapic_test",
+- srcs = [":scheduler_go_gapic_srcjar_test"],
+- embed = [":scheduler_go_gapic"],
+- importpath = "cloud.google.com/go/scheduler/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-scheduler-v1beta1-go",
+- deps = [
+- ":scheduler_go_gapic",
+- ":scheduler_go_gapic_srcjar-test.srcjar",
+- ":scheduler_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "scheduler_py_gapic",
+- srcs = [":scheduler_proto"],
+- grpc_service_config = "cloudscheduler_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "scheduler_py_gapic_test",
+- srcs = [
+- "scheduler_py_gapic_pytest.py",
+- "scheduler_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":scheduler_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "scheduler-v1beta1-py",
+- deps = [
+- ":scheduler_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "scheduler_php_proto",
+- deps = [":scheduler_proto"],
+-)
+-
+-php_grpc_library(
+- name = "scheduler_php_grpc",
+- srcs = [":scheduler_proto"],
+- deps = [":scheduler_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "scheduler_php_gapic",
+- srcs = [":scheduler_proto_with_info"],
+- grpc_service_config = "cloudscheduler_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":scheduler_php_grpc",
+- ":scheduler_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-scheduler-v1beta1-php",
+- deps = [
+- ":scheduler_php_gapic",
+- ":scheduler_php_grpc",
+- ":scheduler_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "scheduler_nodejs_gapic",
+- package_name = "@google-cloud/scheduler",
+- src = ":scheduler_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudscheduler_grpc_service_config.json",
+- main_service = "scheduler",
+- package = "google.cloud.scheduler.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudscheduler_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "scheduler-v1beta1-nodejs",
+- deps = [
+- ":scheduler_nodejs_gapic",
+- ":scheduler_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "scheduler_ruby_proto",
+- deps = [":scheduler_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "scheduler_ruby_grpc",
+- srcs = [":scheduler_proto"],
+- deps = [":scheduler_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "scheduler_ruby_gapic",
+- srcs = [":scheduler_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-scheduler-v1beta1",
+- "ruby-cloud-env-prefix=SCHEDULER",
+- "ruby-cloud-product-url=https://cloud.google.com/scheduler",
+- "ruby-cloud-api-id=cloudscheduler.googleapis.com",
+- "ruby-cloud-api-shortname=cloudscheduler",
+- ],
+- grpc_service_config = "cloudscheduler_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Scheduler is a fully managed enterprise-grade cron job scheduler. It allows you to schedule virtually any job, including batch, big data jobs, cloud infrastructure operations, and more. You can automate everything, including retries in case of failure to reduce manual toil and intervention. Cloud Scheduler even acts as a single pane of glass, allowing you to manage all your automation tasks from one place.",
+- ruby_cloud_title = "Cloud Scheduler V1beta1",
+- deps = [
+- ":scheduler_ruby_grpc",
+- ":scheduler_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-scheduler-v1beta1-ruby",
+- deps = [
+- ":scheduler_ruby_gapic",
+- ":scheduler_ruby_grpc",
+- ":scheduler_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "scheduler_csharp_proto",
+- deps = [":scheduler_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "scheduler_csharp_grpc",
+- srcs = [":scheduler_proto"],
+- deps = [":scheduler_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "scheduler_csharp_gapic",
+- srcs = [":scheduler_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudscheduler_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudscheduler_v1beta1.yaml",
+- deps = [
+- ":scheduler_csharp_grpc",
+- ":scheduler_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-scheduler-v1beta1-csharp",
+- deps = [
+- ":scheduler_csharp_gapic",
+- ":scheduler_csharp_grpc",
+- ":scheduler_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/secretmanager/BUILD.bazel b/google/cloud/secretmanager/BUILD.bazel
+--- a/google/cloud/secretmanager/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/secretmanager/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-secret_manager.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for secretmanager.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "secretmanager_ruby_wrapper",
+- srcs = ["//google/cloud/secretmanager/v1:secretmanager_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-secret_manager",
+- "ruby-cloud-env-prefix=SECRET_MANAGER",
+- "ruby-cloud-wrapper-of=v1:0.1;v1beta1:0.3",
+- "ruby-cloud-product-url=https://cloud.google.com/secret-manager",
+- "ruby-cloud-api-id=secretmanager.googleapis.com",
+- "ruby-cloud-api-shortname=secretmanager",
+- ],
+- ruby_cloud_description = "Secret Manager is a secure and convenient storage system for API keys, passwords, certificates, and other sensitive data. Secret Manager provides a central place and single source of truth to manage, access, and audit secrets across Google Cloud.",
+- ruby_cloud_title = "Secret Manager",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-secretmanager-ruby",
+- deps = [
+- ":secretmanager_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/secretmanager/logging/v1/BUILD.bazel b/google/cloud/secretmanager/logging/v1/BUILD.bazel
+--- a/google/cloud/secretmanager/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/secretmanager/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,173 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "secret_event.proto",
+- ],
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/secretmanager/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/secretmanager/v1/BUILD.bazel b/google/cloud/secretmanager/v1/BUILD.bazel
+--- a/google/cloud/secretmanager/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/secretmanager/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,398 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "secretmanager_proto",
+- srcs = [
+- "resources.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "secretmanager_proto_with_info",
+- deps = [
+- ":secretmanager_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "secretmanager_java_proto",
+- deps = [":secretmanager_proto"],
+-)
+-
+-java_grpc_library(
+- name = "secretmanager_java_grpc",
+- srcs = [":secretmanager_proto"],
+- deps = [":secretmanager_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "secretmanager_java_gapic",
+- srcs = [":secretmanager_proto_with_info"],
+- grpc_service_config = "secretmanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":secretmanager_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":secretmanager_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "secretmanager_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.secretmanager.v1.SecretManagerServiceClientHttpJsonTest",
+- "com.google.cloud.secretmanager.v1.SecretManagerServiceClientTest",
+- ],
+- runtime_deps = [":secretmanager_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-secretmanager-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":secretmanager_java_gapic",
+- ":secretmanager_java_grpc",
+- ":secretmanager_java_proto",
+- ":secretmanager_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "secretmanager_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/secretmanager/v1",
+- protos = [":secretmanager_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "secretmanager_go_gapic",
+- srcs = [":secretmanager_proto_with_info"],
+- grpc_service_config = "secretmanager_grpc_service_config.json",
+- importpath = "cloud.google.com/go/secretmanager/apiv1;secretmanager",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "secretmanager_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":secretmanager_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "secretmanager_go_gapic_test",
+- srcs = [":secretmanager_go_gapic_srcjar_test"],
+- embed = [":secretmanager_go_gapic"],
+- importpath = "cloud.google.com/go/secretmanager/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-secretmanager-v1-go",
+- deps = [
+- ":secretmanager_go_gapic",
+- ":secretmanager_go_gapic_srcjar-metadata.srcjar",
+- ":secretmanager_go_gapic_srcjar-test.srcjar",
+- ":secretmanager_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "secretmanager_py_gapic",
+- srcs = [":secretmanager_proto"],
+- grpc_service_config = "secretmanager_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-secret-manager",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "secretmanager_py_gapic_test",
+- srcs = [
+- "secretmanager_py_gapic_pytest.py",
+- "secretmanager_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":secretmanager_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "secretmanager-v1-py",
+- deps = [
+- ":secretmanager_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "secretmanager_php_proto",
+- deps = [":secretmanager_proto"],
+-)
+-
+-php_grpc_library(
+- name = "secretmanager_php_grpc",
+- srcs = [":secretmanager_proto"],
+- deps = [":secretmanager_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "secretmanager_php_gapic",
+- srcs = [":secretmanager_proto_with_info"],
+- grpc_service_config = "secretmanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":secretmanager_php_grpc",
+- ":secretmanager_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-secretmanager-v1-php",
+- deps = [
+- ":secretmanager_php_gapic",
+- ":secretmanager_php_grpc",
+- ":secretmanager_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "secretmanager_nodejs_gapic",
+- package_name = "@google-cloud/secret-manager",
+- src = ":secretmanager_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "secretmanager_grpc_service_config.json",
+- package = "google.cloud.secretmanager.v1",
+- rest_numeric_enums = False,
+- service_yaml = "secretmanager_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "secretmanager-v1-nodejs",
+- deps = [
+- ":secretmanager_nodejs_gapic",
+- ":secretmanager_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "secretmanager_ruby_proto",
+- deps = [":secretmanager_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "secretmanager_ruby_grpc",
+- srcs = [":secretmanager_proto"],
+- deps = [":secretmanager_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "secretmanager_ruby_gapic",
+- srcs = [":secretmanager_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=secretmanager.googleapis.com",
+- "ruby-cloud-api-shortname=secretmanager",
+- "ruby-cloud-env-prefix=SECRET_MANAGER",
+- "ruby-cloud-gem-name=google-cloud-secret_manager-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/secret-manager",
+- ],
+- grpc_service_config = "secretmanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Secret Manager is a secure and convenient storage system for API keys, passwords, certificates, and other sensitive data. Secret Manager provides a central place and single source of truth to manage, access, and audit secrets across Google Cloud.",
+- ruby_cloud_title = "Secret Manager V1",
+- deps = [
+- ":secretmanager_ruby_grpc",
+- ":secretmanager_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-secretmanager-v1-ruby",
+- deps = [
+- ":secretmanager_ruby_gapic",
+- ":secretmanager_ruby_grpc",
+- ":secretmanager_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "secretmanager_csharp_proto",
+- deps = [":secretmanager_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "secretmanager_csharp_grpc",
+- srcs = [":secretmanager_proto"],
+- deps = [":secretmanager_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "secretmanager_csharp_gapic",
+- srcs = [":secretmanager_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "secretmanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "secretmanager_v1.yaml",
+- deps = [
+- ":secretmanager_csharp_grpc",
+- ":secretmanager_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-secretmanager-v1-csharp",
+- deps = [
+- ":secretmanager_csharp_gapic",
+- ":secretmanager_csharp_grpc",
+- ":secretmanager_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "secretmanager_cc_proto",
+- deps = [":secretmanager_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "secretmanager_cc_grpc",
+- srcs = [":secretmanager_proto"],
+- grpc_only = True,
+- deps = [":secretmanager_cc_proto"],
+-)
+diff -urN a/google/cloud/secrets/v1beta1/BUILD.bazel b/google/cloud/secrets/v1beta1/BUILD.bazel
+--- a/google/cloud/secrets/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/secrets/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,367 +0,0 @@
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "secretmanager_proto",
+- srcs = [
+- "resources.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "secretmanager_proto_with_info",
+- deps = [
+- ":secretmanager_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "secretmanager_java_proto",
+- deps = [":secretmanager_proto"],
+-)
+-
+-java_grpc_library(
+- name = "secretmanager_java_grpc",
+- srcs = [":secretmanager_proto"],
+- deps = [":secretmanager_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "secretmanager_java_gapic",
+- srcs = [":secretmanager_proto_with_info"],
+- grpc_service_config = "secretmanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":secretmanager_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":secretmanager_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "secretmanager_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.secretmanager.v1beta1.SecretManagerServiceClientHttpJsonTest",
+- "com.google.cloud.secretmanager.v1beta1.SecretManagerServiceClientTest",
+- ],
+- runtime_deps = [":secretmanager_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-secretmanager-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":secretmanager_java_gapic",
+- ":secretmanager_java_grpc",
+- ":secretmanager_java_proto",
+- ":secretmanager_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "secretmanager_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/secretmanager/v1beta1",
+- protos = [":secretmanager_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "secretmanager_go_gapic",
+- srcs = [":secretmanager_proto_with_info"],
+- grpc_service_config = "secretmanager_grpc_service_config.json",
+- importpath = "cloud.google.com/go/secretmanager/apiv1beta1;secretmanager",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/secrets/v1beta1:secretmanager_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":secretmanager_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "secretmanager_go_gapic_test",
+- srcs = [":secretmanager_go_gapic_srcjar_test"],
+- embed = [":secretmanager_go_gapic"],
+- importpath = "cloud.google.com/go/secretmanager/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-secretmanager-v1beta1-go",
+- deps = [
+- ":secretmanager_go_gapic",
+- ":secretmanager_go_gapic_srcjar-test.srcjar",
+- ":secretmanager_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "secretmanager_py_gapic",
+- srcs = [":secretmanager_proto"],
+- grpc_service_config = "secretmanager_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=secretmanager",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "secretmanager_py_gapic_test",
+- srcs = [
+- "secretmanager_py_gapic_pytest.py",
+- "secretmanager_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":secretmanager_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "secretmanager-v1beta1-py",
+- deps = [
+- ":secretmanager_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "secretmanager_php_proto",
+- deps = [":secretmanager_proto"],
+-)
+-
+-php_grpc_library(
+- name = "secretmanager_php_grpc",
+- srcs = [":secretmanager_proto"],
+- deps = [":secretmanager_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "secretmanager_php_gapic",
+- srcs = [":secretmanager_proto_with_info"],
+- grpc_service_config = "secretmanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":secretmanager_php_grpc",
+- ":secretmanager_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-secretmanager-v1beta1-php",
+- deps = [
+- ":secretmanager_php_gapic",
+- ":secretmanager_php_grpc",
+- ":secretmanager_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "secretmanager_nodejs_gapic",
+- package_name = "@google-cloud/secret-manager",
+- src = ":secretmanager_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "secretmanager_grpc_service_config.json",
+- package = "google.cloud.secrets.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/secrets/v1beta1:secretmanager_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "secretmanager-v1beta1-nodejs",
+- deps = [
+- ":secretmanager_nodejs_gapic",
+- ":secretmanager_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "secretmanager_ruby_proto",
+- deps = [":secretmanager_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "secretmanager_ruby_grpc",
+- srcs = [":secretmanager_proto"],
+- deps = [":secretmanager_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "secretmanager_ruby_gapic",
+- srcs = [":secretmanager_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-secret_manager-v1beta1",
+- "ruby-cloud-env-prefix=SECRET_MANAGER",
+- "ruby-cloud-product-url=https://cloud.google.com/secret-manager",
+- "ruby-cloud-api-id=secretmanager.googleapis.com",
+- "ruby-cloud-api-shortname=secretmanager",
+- ],
+- grpc_service_config = "secretmanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Secret Manager is a secure and convenient storage system for API keys, passwords, certificates, and other sensitive data. Secret Manager provides a central place and single source of truth to manage, access, and audit secrets across Google Cloud.",
+- ruby_cloud_title = "Secret Manager V1beta1",
+- deps = [
+- ":secretmanager_ruby_grpc",
+- ":secretmanager_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-secretmanager-v1beta1-ruby",
+- deps = [
+- ":secretmanager_ruby_gapic",
+- ":secretmanager_ruby_grpc",
+- ":secretmanager_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "secretmanager_csharp_proto",
+- deps = [":secretmanager_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "secretmanager_csharp_grpc",
+- srcs = [":secretmanager_proto"],
+- deps = [":secretmanager_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "secretmanager_csharp_gapic",
+- srcs = [":secretmanager_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "secretmanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/secrets/v1beta1:secretmanager_v1beta1.yaml",
+- deps = [
+- ":secretmanager_csharp_grpc",
+- ":secretmanager_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-secretmanager-v1beta1-csharp",
+- deps = [
+- ":secretmanager_csharp_gapic",
+- ":secretmanager_csharp_grpc",
+- ":secretmanager_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/security/privateca/BUILD.bazel b/google/cloud/security/privateca/BUILD.bazel
+--- a/google/cloud/security/privateca/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/security/privateca/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-security-private_ca.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for privateca.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "privateca_ruby_wrapper",
+- srcs = ["//google/cloud/security/privateca/v1:privateca_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-security-private_ca",
+- "ruby-cloud-gem-namespace=Google::Cloud::Security::PrivateCA",
+- "ruby-cloud-env-prefix=PRIVATE_CA",
+- "ruby-cloud-wrapper-of=v1:0.3;v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/certificate-authority-service/",
+- "ruby-cloud-api-id=privateca.googleapis.com",
+- "ruby-cloud-api-shortname=privateca",
+- ],
+- ruby_cloud_description = "Certificate Authority Service is a highly available, scalable Google Cloud service that enables you to simplify, automate, and customize the deployment, management, and security of private certificate authorities (CA).",
+- ruby_cloud_title = "Certificate Authority Service",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-security-privateca-ruby",
+- deps = [
+- ":privateca_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/security/privateca/v1/BUILD.bazel b/google/cloud/security/privateca/v1/BUILD.bazel
+--- a/google/cloud/security/privateca/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/security/privateca/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,410 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "privateca_proto",
+- srcs = [
+- "resources.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:expr_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "privateca_proto_with_info",
+- deps = [
+- ":privateca_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "privateca_java_proto",
+- deps = [":privateca_proto"],
+-)
+-
+-java_grpc_library(
+- name = "privateca_java_grpc",
+- srcs = [":privateca_proto"],
+- deps = [":privateca_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "privateca_java_gapic",
+- srcs = [":privateca_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "privateca_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "privateca_v1.yaml",
+- test_deps = [
+- ":privateca_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":privateca_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "privateca_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClientHttpJsonTest",
+- "com.google.cloud.security.privateca.v1.CertificateAuthorityServiceClientTest",
+- ],
+- runtime_deps = [":privateca_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-security-privateca-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":privateca_java_gapic",
+- ":privateca_java_grpc",
+- ":privateca_java_proto",
+- ":privateca_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "privateca_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/security/privateca/v1",
+- protos = [":privateca_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:expr_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "privateca_go_gapic",
+- srcs = [":privateca_proto_with_info"],
+- grpc_service_config = "privateca_grpc_service_config.json",
+- importpath = "cloud.google.com/go/security/privateca/apiv1;privateca",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "privateca_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":privateca_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "privateca_go_gapic_test",
+- srcs = [":privateca_go_gapic_srcjar_test"],
+- embed = [":privateca_go_gapic"],
+- importpath = "cloud.google.com/go/security/privateca/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-security-privateca-v1-go",
+- deps = [
+- ":privateca_go_gapic",
+- ":privateca_go_gapic_srcjar-metadata.srcjar",
+- ":privateca_go_gapic_srcjar-test.srcjar",
+- ":privateca_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "privateca_py_gapic",
+- srcs = [":privateca_proto"],
+- grpc_service_config = "privateca_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-private-ca",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "privateca_py_gapic_test",
+- srcs = [
+- "privateca_py_gapic_pytest.py",
+- "privateca_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":privateca_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "security-privateca-v1-py",
+- deps = [
+- ":privateca_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "privateca_php_proto",
+- deps = [":privateca_proto"],
+-)
+-
+-php_grpc_library(
+- name = "privateca_php_grpc",
+- srcs = [":privateca_proto"],
+- deps = [":privateca_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "privateca_php_gapic",
+- srcs = [":privateca_proto_with_info"],
+- grpc_service_config = "privateca_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "privateca_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":privateca_php_grpc",
+- ":privateca_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-security-privateca-v1-php",
+- deps = [
+- ":privateca_php_gapic",
+- ":privateca_php_grpc",
+- ":privateca_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "privateca_nodejs_gapic",
+- package_name = "@google-cloud/security-private-ca",
+- src = ":privateca_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "privateca_grpc_service_config.json",
+- package = "google.cloud.security.privateca.v1",
+- rest_numeric_enums = False,
+- service_yaml = "privateca_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "security-privateca-v1-nodejs",
+- deps = [
+- ":privateca_nodejs_gapic",
+- ":privateca_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "privateca_ruby_proto",
+- deps = [":privateca_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "privateca_ruby_grpc",
+- srcs = [":privateca_proto"],
+- deps = [":privateca_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "privateca_ruby_gapic",
+- srcs = [":privateca_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-security-private_ca-v1",
+- "ruby-cloud-gem-namespace=Google::Cloud::Security::PrivateCA::V1",
+- "ruby-cloud-env-prefix=PRIVATE_CA",
+- "ruby-cloud-product-url=https://cloud.google.com/certificate-authority-service/",
+- "ruby-cloud-api-id=privateca.googleapis.com",
+- "ruby-cloud-api-shortname=privateca",
+- ],
+- grpc_service_config = "privateca_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Certificate Authority Service is a highly available, scalable Google Cloud service that enables you to simplify, automate, and customize the deployment, management, and security of private certificate authorities (CA).",
+- ruby_cloud_title = "Ceritificate Authority Service V1",
+- service_yaml = "privateca_v1.yaml",
+- deps = [
+- ":privateca_ruby_grpc",
+- ":privateca_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-security-privateca-v1-ruby",
+- deps = [
+- ":privateca_ruby_gapic",
+- ":privateca_ruby_grpc",
+- ":privateca_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "privateca_csharp_proto",
+- deps = [":privateca_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "privateca_csharp_grpc",
+- srcs = [":privateca_proto"],
+- deps = [":privateca_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "privateca_csharp_gapic",
+- srcs = [":privateca_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "privateca_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "privateca_v1.yaml",
+- deps = [
+- ":privateca_csharp_grpc",
+- ":privateca_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-security-privateca-v1-csharp",
+- deps = [
+- ":privateca_csharp_gapic",
+- ":privateca_csharp_grpc",
+- ":privateca_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "privateca_cc_proto",
+- deps = [":privateca_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "privateca_cc_grpc",
+- srcs = [":privateca_proto"],
+- grpc_only = True,
+- deps = [":privateca_cc_proto"],
+-)
+diff -urN a/google/cloud/security/privateca/v1beta1/BUILD.bazel b/google/cloud/security/privateca/v1beta1/BUILD.bazel
+--- a/google/cloud/security/privateca/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/security/privateca/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,376 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "privateca_proto",
+- srcs = [
+- "resources.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "privateca_proto_with_info",
+- deps = [
+- ":privateca_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "privateca_java_proto",
+- deps = [":privateca_proto"],
+-)
+-
+-java_grpc_library(
+- name = "privateca_java_grpc",
+- srcs = [":privateca_proto"],
+- deps = [":privateca_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "privateca_java_gapic",
+- srcs = [":privateca_proto_with_info"],
+- grpc_service_config = "privateca_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":privateca_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":privateca_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "privateca_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClientHttpJsonTest",
+- "com.google.cloud.security.privateca.v1beta1.CertificateAuthorityServiceClientTest",
+- ],
+- runtime_deps = [":privateca_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-security-privateca-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":privateca_java_gapic",
+- ":privateca_java_grpc",
+- ":privateca_java_proto",
+- ":privateca_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "privateca_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1",
+- protos = [":privateca_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "privateca_go_gapic",
+- srcs = [":privateca_proto_with_info"],
+- grpc_service_config = "privateca_grpc_service_config.json",
+- importpath = "cloud.google.com/go/security/privateca/apiv1beta1;privateca",
+- rest_numeric_enums = False,
+- service_yaml = "privateca_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":privateca_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "privateca_go_gapic_test",
+- srcs = [":privateca_go_gapic_srcjar_test"],
+- embed = [":privateca_go_gapic"],
+- importpath = "cloud.google.com/go/security/privateca/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-security-privateca-v1beta1-go",
+- deps = [
+- ":privateca_go_gapic",
+- ":privateca_go_gapic_srcjar-test.srcjar",
+- ":privateca_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "privateca_py_gapic",
+- srcs = [":privateca_proto"],
+- grpc_service_config = "privateca_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-private-ca",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "privateca_py_gapic_test",
+- srcs = [
+- "privateca_py_gapic_pytest.py",
+- "privateca_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":privateca_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "security-privateca-v1beta1-py",
+- deps = [
+- ":privateca_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "privateca_php_proto",
+- deps = [":privateca_proto"],
+-)
+-
+-php_grpc_library(
+- name = "privateca_php_grpc",
+- srcs = [":privateca_proto"],
+- deps = [":privateca_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "privateca_php_gapic",
+- srcs = [":privateca_proto_with_info"],
+- grpc_service_config = "privateca_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":privateca_php_grpc",
+- ":privateca_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-security-privateca-v1beta1-php",
+- deps = [
+- ":privateca_php_gapic",
+- ":privateca_php_grpc",
+- ":privateca_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "privateca_nodejs_gapic",
+- package_name = "@google-cloud/security-private-ca",
+- src = ":privateca_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "privateca_grpc_service_config.json",
+- package = "google.cloud.security.privateca.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "privateca_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "security-privateca-v1beta1-nodejs",
+- deps = [
+- ":privateca_nodejs_gapic",
+- ":privateca_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "privateca_ruby_proto",
+- deps = [":privateca_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "privateca_ruby_grpc",
+- srcs = [":privateca_proto"],
+- deps = [":privateca_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "privateca_ruby_gapic",
+- srcs = [":privateca_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-security-private_ca-v1beta1",
+- "ruby-cloud-gem-namespace=Google::Cloud::Security::PrivateCA::V1beta1",
+- "ruby-cloud-env-prefix=PRIVATE_CA",
+- "ruby-cloud-product-url=https://cloud.google.com/certificate-authority-service/",
+- "ruby-cloud-api-id=privateca.googleapis.com",
+- "ruby-cloud-api-shortname=privateca",
+- ],
+- grpc_service_config = "privateca_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Certificate Authority Service is a highly available, scalable Google Cloud service that enables you to simplify, automate, and customize the deployment, management, and security of private certificate authorities (CA).",
+- ruby_cloud_title = "Certificate Authority Service V1beta1",
+- deps = [
+- ":privateca_ruby_grpc",
+- ":privateca_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-security-privateca-v1beta1-ruby",
+- deps = [
+- ":privateca_ruby_gapic",
+- ":privateca_ruby_grpc",
+- ":privateca_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "privateca_csharp_proto",
+- deps = [":privateca_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "privateca_csharp_grpc",
+- srcs = [":privateca_proto"],
+- deps = [":privateca_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "privateca_csharp_gapic",
+- srcs = [":privateca_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "privateca_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "privateca_v1beta1.yaml",
+- deps = [
+- ":privateca_csharp_grpc",
+- ":privateca_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-security-privateca-v1beta1-csharp",
+- deps = [
+- ":privateca_csharp_gapic",
+- ":privateca_csharp_grpc",
+- ":privateca_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/security/publicca/BUILD.bazel b/google/cloud/security/publicca/BUILD.bazel
+--- a/google/cloud/security/publicca/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/security/publicca/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-security-public_ca.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for publicca.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta1 in this case.
+-ruby_cloud_gapic_library(
+- name = "publicca_ruby_wrapper",
+- srcs = ["//google/cloud/security/publicca/v1beta1:publicca_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=publicca.googleapis.com",
+- "ruby-cloud-api-shortname=publicca",
+- "ruby-cloud-gem-name=google-cloud-security-public_ca",
+- "ruby-cloud-gem-namespace=Google::Cloud::Security::PublicCA",
+- "ruby-cloud-wrapper-of=v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/certificate-manager/docs/public-ca/",
+- ],
+- ruby_cloud_description = "Certificate Manager's Public Certificate Authority (CA) functionality allows you to provision and deploy widely trusted X.509 certificates after validating that the certificate requester controls the domains. Certificate Manager lets you directly and programmatically request publicly trusted TLS certificates that are already in the root of trust stores used by major browsers, operating systems, and applications. You can use these TLS certificates to authenticate and encrypt internet traffic.",
+- ruby_cloud_title = "Public Certificate Authority",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-security-publicca-ruby",
+- deps = [
+- ":publicca_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/security/publicca/v1beta1/BUILD.bazel b/google/cloud/security/publicca/v1beta1/BUILD.bazel
+--- a/google/cloud/security/publicca/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/security/publicca/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,392 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "publicca_proto",
+- srcs = [
+- "resources.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "publicca_proto_with_info",
+- deps = [
+- ":publicca_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "publicca_java_proto",
+- deps = [":publicca_proto"],
+-)
+-
+-java_grpc_library(
+- name = "publicca_java_grpc",
+- srcs = [":publicca_proto"],
+- deps = [":publicca_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "publicca_java_gapic",
+- srcs = [":publicca_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "publicca_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "publicca_v1beta1.yaml",
+- test_deps = [
+- ":publicca_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":publicca_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "publicca_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.security.publicca.v1beta1.PublicCertificateAuthorityServiceClientHttpJsonTest",
+- "com.google.cloud.security.publicca.v1beta1.PublicCertificateAuthorityServiceClientTest",
+- ],
+- runtime_deps = [":publicca_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-security-publicca-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":publicca_java_gapic",
+- ":publicca_java_grpc",
+- ":publicca_java_proto",
+- ":publicca_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "publicca_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/security/publicca/v1beta1",
+- protos = [":publicca_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "publicca_go_gapic",
+- srcs = [":publicca_proto_with_info"],
+- grpc_service_config = "publicca_v1beta1_grpc_service_config.json",
+- importpath = "cloud.google.com/go/security/publicca/apiv1beta1;publicca",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "publicca_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":publicca_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "publicca_go_gapic_test",
+- srcs = [":publicca_go_gapic_srcjar_test"],
+- embed = [":publicca_go_gapic"],
+- importpath = "cloud.google.com/go/security/publicca/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-security-publicca-v1beta1-go",
+- deps = [
+- ":publicca_go_gapic",
+- ":publicca_go_gapic_srcjar-metadata.srcjar",
+- ":publicca_go_gapic_srcjar-test.srcjar",
+- ":publicca_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "publicca_py_gapic",
+- srcs = [":publicca_proto"],
+- grpc_service_config = "publicca_v1beta1_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-public-ca",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "publicca_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "publicca_py_gapic_test",
+- srcs = [
+- "publicca_py_gapic_pytest.py",
+- "publicca_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":publicca_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "security-publicca-v1beta1-py",
+- deps = [
+- ":publicca_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "publicca_php_proto",
+- deps = [":publicca_proto"],
+-)
+-
+-php_grpc_library(
+- name = "publicca_php_grpc",
+- srcs = [":publicca_proto"],
+- deps = [":publicca_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "publicca_php_gapic",
+- srcs = [":publicca_proto_with_info"],
+- grpc_service_config = "publicca_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "publicca_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":publicca_php_grpc",
+- ":publicca_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-security-publicca-v1beta1-php",
+- deps = [
+- ":publicca_php_gapic",
+- ":publicca_php_grpc",
+- ":publicca_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "publicca_nodejs_gapic",
+- package_name = "@google-cloud/publicca",
+- src = ":publicca_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "publicca_v1beta1_grpc_service_config.json",
+- package = "google.cloud.security.publicca.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "publicca_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "security-publicca-v1beta1-nodejs",
+- deps = [
+- ":publicca_nodejs_gapic",
+- ":publicca_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "publicca_ruby_proto",
+- deps = [":publicca_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "publicca_ruby_grpc",
+- srcs = [":publicca_proto"],
+- deps = [":publicca_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "publicca_ruby_gapic",
+- srcs = [":publicca_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=publicca.googleapis.com",
+- "ruby-cloud-api-shortname=publicca",
+- "ruby-cloud-gem-name=google-cloud-security-public_ca-v1beta1",
+- "ruby-cloud-gem-namespace=Google::Cloud::Security::PublicCA::V1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/certificate-manager/docs/public-ca/",
+- ],
+- grpc_service_config = "publicca_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Certificate Manager's Public Certificate Authority (CA) functionality allows you to provision and deploy widely trusted X.509 certificates after validating that the certificate requester controls the domains. Certificate Manager lets you directly and programmatically request publicly trusted TLS certificates that are already in the root of trust stores used by major browsers, operating systems, and applications. You can use these TLS certificates to authenticate and encrypt internet traffic.",
+- ruby_cloud_title = "Public Certificate Authority V1beta1",
+- service_yaml = "publicca_v1beta1.yaml",
+- deps = [
+- ":publicca_ruby_grpc",
+- ":publicca_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-security-publicca-v1beta1-ruby",
+- deps = [
+- ":publicca_ruby_gapic",
+- ":publicca_ruby_grpc",
+- ":publicca_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "publicca_csharp_proto",
+- deps = [":publicca_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "publicca_csharp_grpc",
+- srcs = [":publicca_proto"],
+- deps = [":publicca_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "publicca_csharp_gapic",
+- srcs = [":publicca_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "publicca_v1beta1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "publicca_v1beta1.yaml",
+- deps = [
+- ":publicca_csharp_grpc",
+- ":publicca_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-security-publicca-v1beta1-csharp",
+- deps = [
+- ":publicca_csharp_gapic",
+- ":publicca_csharp_grpc",
+- ":publicca_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "publicca_cc_proto",
+- deps = [":publicca_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "publicca_cc_grpc",
+- srcs = [":publicca_proto"],
+- grpc_only = True,
+- deps = [":publicca_cc_proto"],
+-)
+diff -urN a/google/cloud/securitycenter/BUILD.bazel b/google/cloud/securitycenter/BUILD.bazel
+--- a/google/cloud/securitycenter/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/securitycenter/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-security_center.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for securitycenter.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "securitycenter_ruby_wrapper",
+- srcs = ["//google/cloud/securitycenter/v1:securitycenter_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-security_center",
+- "ruby-cloud-env-prefix=SECURITY_CENTER",
+- "ruby-cloud-wrapper-of=v1:0.0;v1p1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/security-command-center",
+- "ruby-cloud-api-id=securitycenter.googleapis.com",
+- "ruby-cloud-api-shortname=securitycenter",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "Security Command Center API provides access to temporal views of assets and findings within an organization.",
+- ruby_cloud_title = "Security Command Center",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-securitycenter-ruby",
+- deps = [
+- ":securitycenter_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/securitycenter/settings/v1beta1/BUILD.bazel b/google/cloud/securitycenter/settings/v1beta1/BUILD.bazel
+--- a/google/cloud/securitycenter/settings/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/securitycenter/settings/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,312 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "settings_proto",
+- srcs = [
+- "billing_settings.proto",
+- "component_settings.proto",
+- "detector.proto",
+- "securitycenter_settings_service.proto",
+- "settings.proto",
+- "sink_settings.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "settings_proto_with_info",
+- deps = [
+- ":settings_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "settings_java_proto",
+- deps = [":settings_proto"],
+-)
+-
+-java_grpc_library(
+- name = "settings_java_grpc",
+- srcs = [":settings_proto"],
+- deps = [":settings_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "settings_java_gapic",
+- srcs = [":settings_proto_with_info"],
+- grpc_service_config = "securitycenter_settings_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":settings_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":settings_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "settings_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.securitycenter.settings.v1beta1.SecurityCenterSettingsServiceClientTest",
+- ],
+- runtime_deps = [":settings_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-securitycenter-settings-v1beta1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":settings_java_gapic",
+- ":settings_java_grpc",
+- ":settings_java_proto",
+- ":settings_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "settings_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1",
+- protos = [":settings_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "settings_go_gapic",
+- srcs = [":settings_proto_with_info"],
+- grpc_service_config = "securitycenter_settings_grpc_service_config.json",
+- importpath = "cloud.google.com/go/securitycenter/settings/apiv1beta1;settings",
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_settings.yaml",
+- deps = [
+- ":settings_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "settings_go_gapic_test",
+- srcs = [":settings_go_gapic_srcjar_test"],
+- embed = [":settings_go_gapic"],
+- importpath = "cloud.google.com/go/securitycenter/settings/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-securitycenter-settings-v1beta1-go",
+- deps = [
+- ":settings_go_gapic",
+- ":settings_go_gapic_srcjar-test.srcjar",
+- ":settings_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "settings_py_gapic",
+- srcs = [":settings_proto"],
+- grpc_service_config = "securitycenter_settings_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "settings_py_gapic_test",
+- srcs = [
+- "settings_py_gapic_pytest.py",
+- "settings_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":settings_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "securitycenter-settings-v1beta1-py",
+- deps = [
+- ":settings_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "settings_php_proto",
+- deps = [":settings_proto"],
+-)
+-
+-php_grpc_library(
+- name = "settings_php_grpc",
+- srcs = [":settings_proto"],
+- deps = [":settings_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "settings_php_gapic",
+- srcs = [":settings_proto_with_info"],
+- grpc_service_config = "securitycenter_settings_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":settings_php_grpc",
+- ":settings_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-securitycenter-settings-v1beta1-php",
+- deps = [
+- ":settings_php_gapic",
+- ":settings_php_grpc",
+- ":settings_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "settings_nodejs_gapic",
+- src = ":settings_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "securitycenter_settings_grpc_service_config.json",
+- package = "google.cloud.securitycenter.settings.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_settings.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "securitycenter-settings-v1beta1-nodejs",
+- deps = [
+- ":settings_nodejs_gapic",
+- ":settings_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "settings_ruby_proto",
+- deps = [":settings_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "settings_ruby_grpc",
+- srcs = [":settings_proto"],
+- deps = [":settings_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "settings_ruby_gapic",
+- srcs = [":settings_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-settings-v1beta1"],
+- rest_numeric_enums = False,
+- deps = [
+- ":settings_ruby_grpc",
+- ":settings_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-securitycenter-settings-v1beta1-ruby",
+- deps = [
+- ":settings_ruby_gapic",
+- ":settings_ruby_grpc",
+- ":settings_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "settings_csharp_proto",
+- deps = [":settings_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "settings_csharp_grpc",
+- srcs = [":settings_proto"],
+- deps = [":settings_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "settings_csharp_gapic",
+- srcs = [":settings_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "securitycenter_settings_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_settings.yaml",
+- deps = [
+- ":settings_csharp_grpc",
+- ":settings_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-securitycenter-settings-v1beta1-csharp",
+- deps = [
+- ":settings_csharp_gapic",
+- ":settings_csharp_grpc",
+- ":settings_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/securitycenter/v1/BUILD.bazel b/google/cloud/securitycenter/v1/BUILD.bazel
+--- a/google/cloud/securitycenter/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/securitycenter/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,380 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "securitycenter_proto",
+- srcs = [
+- "access.proto",
+- "asset.proto",
+- "bigquery_export.proto",
+- "compliance.proto",
+- "connection.proto",
+- "contact_details.proto",
+- "container.proto",
+- "database.proto",
+- "exfiltration.proto",
+- "external_system.proto",
+- "file.proto",
+- "finding.proto",
+- "folder.proto",
+- "iam_binding.proto",
+- "indicator.proto",
+- "kubernetes.proto",
+- "label.proto",
+- "mitre_attack.proto",
+- "mute_config.proto",
+- "notification_config.proto",
+- "notification_message.proto",
+- "organization_settings.proto",
+- "process.proto",
+- "resource.proto",
+- "run_asset_discovery_response.proto",
+- "security_marks.proto",
+- "securitycenter_service.proto",
+- "source.proto",
+- "vulnerability.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "securitycenter_proto_with_info",
+- deps = [
+- ":securitycenter_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "securitycenter_java_proto",
+- deps = [":securitycenter_proto"],
+-)
+-
+-java_grpc_library(
+- name = "securitycenter_java_grpc",
+- srcs = [":securitycenter_proto"],
+- deps = [":securitycenter_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "securitycenter_java_gapic",
+- srcs = [":securitycenter_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_v1.yaml",
+- test_deps = [
+- ":securitycenter_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":securitycenter_java_proto",
+- "//google/api:api_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "securitycenter_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.securitycenter.v1.SecurityCenterClientHttpJsonTest",
+- "com.google.cloud.securitycenter.v1.SecurityCenterClientTest",
+- ],
+- runtime_deps = [":securitycenter_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-securitycenter-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":securitycenter_java_gapic",
+- ":securitycenter_java_grpc",
+- ":securitycenter_java_proto",
+- ":securitycenter_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "securitycenter_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1",
+- protos = [":securitycenter_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "securitycenter_go_gapic",
+- srcs = [":securitycenter_proto_with_info"],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- importpath = "cloud.google.com/go/securitycenter/apiv1;securitycenter",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":securitycenter_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "securitycenter_go_gapic_test",
+- srcs = [":securitycenter_go_gapic_srcjar_test"],
+- embed = [":securitycenter_go_gapic"],
+- importpath = "cloud.google.com/go/securitycenter/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-securitycenter-v1-go",
+- deps = [
+- ":securitycenter_go_gapic",
+- ":securitycenter_go_gapic_srcjar-metadata.srcjar",
+- ":securitycenter_go_gapic_srcjar-test.srcjar",
+- ":securitycenter_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "securitycenter_py_gapic",
+- srcs = [":securitycenter_proto"],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "securitycenter_py_gapic_test",
+- srcs = [
+- "securitycenter_py_gapic_pytest.py",
+- "securitycenter_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":securitycenter_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "securitycenter-v1-py",
+- deps = [
+- ":securitycenter_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "securitycenter_php_proto",
+- deps = [":securitycenter_proto"],
+-)
+-
+-php_grpc_library(
+- name = "securitycenter_php_grpc",
+- srcs = [":securitycenter_proto"],
+- deps = [":securitycenter_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "securitycenter_php_gapic",
+- srcs = [":securitycenter_proto_with_info"],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":securitycenter_php_grpc",
+- ":securitycenter_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-securitycenter-v1-php",
+- deps = [
+- ":securitycenter_php_gapic",
+- ":securitycenter_php_grpc",
+- ":securitycenter_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "securitycenter_nodejs_gapic",
+- package_name = "@google-cloud/security-center",
+- src = ":securitycenter_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- package = "google.cloud.securitycenter.v1",
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "securitycenter-v1-nodejs",
+- deps = [
+- ":securitycenter_nodejs_gapic",
+- ":securitycenter_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "securitycenter_ruby_proto",
+- deps = [":securitycenter_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "securitycenter_ruby_grpc",
+- srcs = [":securitycenter_proto"],
+- deps = [":securitycenter_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "securitycenter_ruby_gapic",
+- srcs = [":securitycenter_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=securitycenter.googleapis.com",
+- "ruby-cloud-api-shortname=securitycenter",
+- "ruby-cloud-env-prefix=SECURITY_CENTER",
+- "ruby-cloud-gem-name=google-cloud-security_center-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/security-command-center",
+- ],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Security Command Center API provides access to temporal views of assets and findings within an organization.",
+- ruby_cloud_title = "Cloud Security Command Center V1",
+- deps = [
+- ":securitycenter_ruby_grpc",
+- ":securitycenter_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-securitycenter-v1-ruby",
+- deps = [
+- ":securitycenter_ruby_gapic",
+- ":securitycenter_ruby_grpc",
+- ":securitycenter_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "securitycenter_csharp_proto",
+- deps = [":securitycenter_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "securitycenter_csharp_grpc",
+- srcs = [":securitycenter_proto"],
+- deps = [":securitycenter_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "securitycenter_csharp_gapic",
+- srcs = [":securitycenter_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_v1.yaml",
+- deps = [
+- ":securitycenter_csharp_grpc",
+- ":securitycenter_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-securitycenter-v1-csharp",
+- deps = [
+- ":securitycenter_csharp_gapic",
+- ":securitycenter_csharp_grpc",
+- ":securitycenter_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "securitycenter_cc_proto",
+- deps = [":securitycenter_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "securitycenter_cc_grpc",
+- srcs = [":securitycenter_proto"],
+- grpc_only = True,
+- deps = [":securitycenter_cc_proto"],
+-)
+diff -urN a/google/cloud/securitycenter/v1beta1/BUILD.bazel b/google/cloud/securitycenter/v1beta1/BUILD.bazel
+--- a/google/cloud/securitycenter/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/securitycenter/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,367 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "securitycenter_proto",
+- srcs = [
+- "asset.proto",
+- "finding.proto",
+- "organization_settings.proto",
+- "run_asset_discovery_response.proto",
+- "security_marks.proto",
+- "securitycenter_service.proto",
+- "source.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "securitycenter_proto_with_info",
+- deps = [
+- ":securitycenter_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "securitycenter_java_proto",
+- deps = [":securitycenter_proto"],
+-)
+-
+-java_grpc_library(
+- name = "securitycenter_java_grpc",
+- srcs = [":securitycenter_proto"],
+- deps = [":securitycenter_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "securitycenter_java_gapic",
+- srcs = [":securitycenter_proto_with_info"],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":securitycenter_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":securitycenter_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "securitycenter_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.securitycenter.v1beta1.SecurityCenterClientHttpJsonTest",
+- "com.google.cloud.securitycenter.v1beta1.SecurityCenterClientTest",
+- ],
+- runtime_deps = [":securitycenter_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-securitycenter-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":securitycenter_java_gapic",
+- ":securitycenter_java_grpc",
+- ":securitycenter_java_proto",
+- ":securitycenter_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "securitycenter_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1",
+- protos = [":securitycenter_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "securitycenter_go_gapic",
+- srcs = [":securitycenter_proto_with_info"],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- importpath = "cloud.google.com/go/securitycenter/apiv1beta1;securitycenter",
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":securitycenter_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "securitycenter_go_gapic_test",
+- srcs = [":securitycenter_go_gapic_srcjar_test"],
+- embed = [":securitycenter_go_gapic"],
+- importpath = "cloud.google.com/go/securitycenter/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-securitycenter-v1beta1-go",
+- deps = [
+- ":securitycenter_go_gapic",
+- ":securitycenter_go_gapic_srcjar-test.srcjar",
+- ":securitycenter_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "securitycenter_py_gapic",
+- srcs = [":securitycenter_proto"],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "securitycenter_py_gapic_test",
+- srcs = [
+- "securitycenter_py_gapic_pytest.py",
+- "securitycenter_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":securitycenter_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "securitycenter-v1beta1-py",
+- deps = [
+- ":securitycenter_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "securitycenter_php_proto",
+- deps = [":securitycenter_proto"],
+-)
+-
+-php_grpc_library(
+- name = "securitycenter_php_grpc",
+- srcs = [":securitycenter_proto"],
+- deps = [":securitycenter_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "securitycenter_php_gapic",
+- srcs = [":securitycenter_proto_with_info"],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":securitycenter_php_grpc",
+- ":securitycenter_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-securitycenter-v1beta1-php",
+- deps = [
+- ":securitycenter_php_gapic",
+- ":securitycenter_php_grpc",
+- ":securitycenter_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "securitycenter_nodejs_gapic",
+- package_name = "@google-cloud/security-center",
+- src = ":securitycenter_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- package = "google.cloud.securitycenter.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "securitycenter-v1beta1-nodejs",
+- deps = [
+- ":securitycenter_nodejs_gapic",
+- ":securitycenter_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "securitycenter_ruby_proto",
+- deps = [":securitycenter_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "securitycenter_ruby_grpc",
+- srcs = [":securitycenter_proto"],
+- deps = [":securitycenter_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "securitycenter_ruby_gapic",
+- srcs = [":securitycenter_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-securitycenter-v1beta1"],
+- rest_numeric_enums = False,
+- deps = [
+- ":securitycenter_ruby_grpc",
+- ":securitycenter_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-securitycenter-v1beta1-ruby",
+- deps = [
+- ":securitycenter_ruby_gapic",
+- ":securitycenter_ruby_grpc",
+- ":securitycenter_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "securitycenter_csharp_proto",
+- deps = [":securitycenter_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "securitycenter_csharp_grpc",
+- srcs = [":securitycenter_proto"],
+- deps = [":securitycenter_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "securitycenter_csharp_gapic",
+- srcs = [":securitycenter_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_v1beta1.yaml",
+- deps = [
+- ":securitycenter_csharp_grpc",
+- ":securitycenter_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-securitycenter-v1beta1-csharp",
+- deps = [
+- ":securitycenter_csharp_gapic",
+- ":securitycenter_csharp_grpc",
+- ":securitycenter_csharp_proto",
+- ],
+-)
+diff -urN a/google/cloud/securitycenter/v1p1beta1/BUILD.bazel b/google/cloud/securitycenter/v1p1beta1/BUILD.bazel
+--- a/google/cloud/securitycenter/v1p1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/securitycenter/v1p1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,389 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "securitycenter_proto",
+- srcs = [
+- "asset.proto",
+- "finding.proto",
+- "folder.proto",
+- "notification_config.proto",
+- "notification_message.proto",
+- "organization_settings.proto",
+- "resource.proto",
+- "run_asset_discovery_response.proto",
+- "security_marks.proto",
+- "securitycenter_service.proto",
+- "source.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "securitycenter_proto_with_info",
+- deps = [
+- ":securitycenter_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "securitycenter_java_proto",
+- deps = [":securitycenter_proto"],
+-)
+-
+-java_grpc_library(
+- name = "securitycenter_java_grpc",
+- srcs = [":securitycenter_proto"],
+- deps = [":securitycenter_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "securitycenter_java_gapic",
+- srcs = [":securitycenter_proto_with_info"],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":securitycenter_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":securitycenter_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "securitycenter_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.securitycenter.v1p1beta1.SecurityCenterClientHttpJsonTest",
+- "com.google.cloud.securitycenter.v1p1beta1.SecurityCenterClientTest",
+- ],
+- runtime_deps = [":securitycenter_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-securitycenter-v1p1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":securitycenter_java_gapic",
+- ":securitycenter_java_grpc",
+- ":securitycenter_java_proto",
+- ":securitycenter_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "securitycenter_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1",
+- protos = [":securitycenter_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "securitycenter_go_gapic",
+- srcs = [":securitycenter_proto_with_info"],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- importpath = "cloud.google.com/go/securitycenter/apiv1p1beta1;securitycenter",
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_v1p1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":securitycenter_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "securitycenter_go_gapic_test",
+- srcs = [":securitycenter_go_gapic_srcjar_test"],
+- embed = [":securitycenter_go_gapic"],
+- importpath = "cloud.google.com/go/securitycenter/apiv1p1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-securitycenter-v1p1beta1-go",
+- deps = [
+- ":securitycenter_go_gapic",
+- ":securitycenter_go_gapic_srcjar-test.srcjar",
+- ":securitycenter_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "securitycenter_py_gapic",
+- srcs = [":securitycenter_proto"],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "securitycenter_py_gapic_test",
+- srcs = [
+- "securitycenter_py_gapic_pytest.py",
+- "securitycenter_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":securitycenter_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "securitycenter-v1p1beta1-py",
+- deps = [
+- ":securitycenter_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "securitycenter_php_proto",
+- deps = [":securitycenter_proto"],
+-)
+-
+-php_grpc_library(
+- name = "securitycenter_php_grpc",
+- srcs = [":securitycenter_proto"],
+- deps = [":securitycenter_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "securitycenter_php_gapic",
+- srcs = [":securitycenter_proto_with_info"],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_v1p1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":securitycenter_php_grpc",
+- ":securitycenter_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-securitycenter-v1p1beta1-php",
+- deps = [
+- ":securitycenter_php_gapic",
+- ":securitycenter_php_grpc",
+- ":securitycenter_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "securitycenter_nodejs_gapic",
+- package_name = "@google-cloud/security-center",
+- src = ":securitycenter_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- package = "google.cloud.securitycenter.v1p1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_v1p1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "securitycenter-v1p1beta1-nodejs",
+- deps = [
+- ":securitycenter_nodejs_gapic",
+- ":securitycenter_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "securitycenter_ruby_proto",
+- deps = [":securitycenter_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "securitycenter_ruby_grpc",
+- srcs = [":securitycenter_proto"],
+- deps = [":securitycenter_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "securitycenter_ruby_gapic",
+- srcs = [":securitycenter_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-security_center-v1p1beta1",
+- "ruby-cloud-env-prefix=SECURITY_CENTER",
+- "ruby-cloud-product-url=https://cloud.google.com/security-command-center",
+- "ruby-cloud-api-id=securitycenter.googleapis.com",
+- "ruby-cloud-api-shortname=securitycenter",
+- ],
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Security Command Center API provides access to temporal views of assets and findings within an organization.",
+- ruby_cloud_title = "Cloud Security Command Center V1p1beta1",
+- deps = [
+- ":securitycenter_ruby_grpc",
+- ":securitycenter_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-securitycenter-v1p1beta1-ruby",
+- deps = [
+- ":securitycenter_ruby_gapic",
+- ":securitycenter_ruby_grpc",
+- ":securitycenter_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "securitycenter_csharp_proto",
+- deps = [":securitycenter_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "securitycenter_csharp_grpc",
+- srcs = [":securitycenter_proto"],
+- deps = [":securitycenter_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "securitycenter_csharp_gapic",
+- srcs = [":securitycenter_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "securitycenter_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "securitycenter_v1p1beta1.yaml",
+- deps = [
+- ":securitycenter_csharp_grpc",
+- ":securitycenter_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-securitycenter-v1p1beta1-csharp",
+- deps = [
+- ":securitycenter_csharp_gapic",
+- ":securitycenter_csharp_grpc",
+- ":securitycenter_csharp_proto",
+- ],
+-)
+diff -urN a/google/cloud/sensitiveaction/logging/v1/BUILD.bazel b/google/cloud/sensitiveaction/logging/v1/BUILD.bazel
+--- a/google/cloud/sensitiveaction/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/sensitiveaction/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,127 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_proto_library",
+- "java_grpc_library",
+- "java_proto_library",
+- "moved_proto_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "sensitive_action_payload.proto",
+- ],
+- deps = [
+- "//google/cloud/securitycenter/v1:securitycenter_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/sensitiveaction/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/cloud/securitycenter/v1:securitycenter_go_proto",
+- ],
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "//google/cloud/securitycenter/v1:securitycenter_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/servicedirectory/BUILD.bazel b/google/cloud/servicedirectory/BUILD.bazel
+--- a/google/cloud/servicedirectory/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/servicedirectory/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-service_directory.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for servicedirectory.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "servicedirectory_ruby_wrapper",
+- srcs = ["//google/cloud/servicedirectory/v1:servicedirectory_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-service_directory",
+- "ruby-cloud-env-prefix=SERVICE_DIRECTORY",
+- "ruby-cloud-wrapper-of=v1:0.1;v1beta1:0.1",
+- "ruby-cloud-product-url=https://cloud.google.com/service-directory",
+- "ruby-cloud-api-id=servicedirectory.googleapis.com",
+- "ruby-cloud-api-shortname=servicedirectory",
+- ],
+- ruby_cloud_description = "Service Directory is the single place to register, browse, and resolve application services.",
+- ruby_cloud_title = "Service Directory",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-servicedirectory-ruby",
+- deps = [
+- ":servicedirectory_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/servicedirectory/v1/BUILD.bazel b/google/cloud/servicedirectory/v1/BUILD.bazel
+--- a/google/cloud/servicedirectory/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/servicedirectory/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,356 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "moved_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_grpc_library",
+- "py_proto_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "servicedirectory_proto",
+- srcs = [
+- "endpoint.proto",
+- "lookup_service.proto",
+- "namespace.proto",
+- "registration_service.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "servicedirectory_proto_with_info",
+- deps = [
+- ":servicedirectory_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "servicedirectory_java_proto",
+- deps = [":servicedirectory_proto"],
+-)
+-
+-java_grpc_library(
+- name = "servicedirectory_java_grpc",
+- srcs = [":servicedirectory_proto"],
+- deps = [":servicedirectory_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "servicedirectory_java_gapic",
+- srcs = [":servicedirectory_proto_with_info"],
+- grpc_service_config = "servicedirectory_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":servicedirectory_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":servicedirectory_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "servicedirectory_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.servicedirectory.v1.LookupServiceClientHttpJsonTest",
+- "com.google.cloud.servicedirectory.v1.LookupServiceClientTest",
+- "com.google.cloud.servicedirectory.v1.RegistrationServiceClientHttpJsonTest",
+- "com.google.cloud.servicedirectory.v1.RegistrationServiceClientTest",
+- ],
+- runtime_deps = [":servicedirectory_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-servicedirectory-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":servicedirectory_java_gapic",
+- ":servicedirectory_java_grpc",
+- ":servicedirectory_java_proto",
+- ":servicedirectory_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "servicedirectory_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1",
+- protos = [":servicedirectory_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "servicedirectory_go_gapic",
+- srcs = [":servicedirectory_proto_with_info"],
+- grpc_service_config = "servicedirectory_grpc_service_config.json",
+- importpath = "cloud.google.com/go/servicedirectory/apiv1;servicedirectory",
+- rest_numeric_enums = False,
+- service_yaml = "servicedirectory_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":servicedirectory_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "servicedirectory_go_gapic_test",
+- srcs = [":servicedirectory_go_gapic_srcjar_test"],
+- embed = [":servicedirectory_go_gapic"],
+- importpath = "cloud.google.com/go/servicedirectory/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-servicedirectory-v1-go",
+- deps = [
+- ":servicedirectory_go_gapic",
+- ":servicedirectory_go_gapic_srcjar-test.srcjar",
+- ":servicedirectory_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "servicedirectory_py_gapic",
+- srcs = [":servicedirectory_proto"],
+- grpc_service_config = "servicedirectory_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-service-directory",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "servicedirectory_py_gapic_test",
+- srcs = [
+- "servicedirectory_py_gapic_pytest.py",
+- "servicedirectory_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":servicedirectory_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "servicedirectory-v1-py",
+- deps = [
+- ":servicedirectory_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "servicedirectory_php_proto",
+- deps = [":servicedirectory_proto"],
+-)
+-
+-php_grpc_library(
+- name = "servicedirectory_php_grpc",
+- srcs = [":servicedirectory_proto"],
+- deps = [":servicedirectory_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "servicedirectory_php_gapic",
+- srcs = [":servicedirectory_proto_with_info"],
+- grpc_service_config = "servicedirectory_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":servicedirectory_php_grpc",
+- ":servicedirectory_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-servicedirectory-v1-php",
+- deps = [
+- ":servicedirectory_php_gapic",
+- ":servicedirectory_php_grpc",
+- ":servicedirectory_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "servicedirectory_nodejs_gapic",
+- package_name = "@google-cloud/service-directory",
+- src = ":servicedirectory_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "servicedirectory_grpc_service_config.json",
+- main_service = "ServiceDirectory",
+- package = "google.cloud.servicedirectory.v1",
+- rest_numeric_enums = False,
+- service_yaml = "servicedirectory_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "servicedirectory-v1-nodejs",
+- deps = [
+- ":servicedirectory_nodejs_gapic",
+- ":servicedirectory_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "servicedirectory_ruby_proto",
+- deps = [":servicedirectory_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "servicedirectory_ruby_grpc",
+- srcs = [":servicedirectory_proto"],
+- deps = [":servicedirectory_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "servicedirectory_ruby_gapic",
+- srcs = [":servicedirectory_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-service_directory-v1",
+- "ruby-cloud-env-prefix=SERVICE_DIRECTORY",
+- "ruby-cloud-product-url=https://cloud.google.com/service-directory",
+- "ruby-cloud-api-id=servicedirectory.googleapis.com",
+- "ruby-cloud-api-shortname=servicedirectory",
+- ],
+- grpc_service_config = "servicedirectory_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Service Directory is the single place to register, browse, and resolve application services.",
+- ruby_cloud_title = "Service Directory V1",
+- deps = [
+- ":servicedirectory_ruby_grpc",
+- ":servicedirectory_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-servicedirectory-v1-ruby",
+- deps = [
+- ":servicedirectory_ruby_gapic",
+- ":servicedirectory_ruby_grpc",
+- ":servicedirectory_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "servicedirectory_csharp_proto",
+- deps = [":servicedirectory_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "servicedirectory_csharp_grpc",
+- srcs = [":servicedirectory_proto"],
+- deps = [":servicedirectory_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "servicedirectory_csharp_gapic",
+- srcs = [":servicedirectory_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "servicedirectory_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "servicedirectory_v1.yaml",
+- deps = [
+- ":servicedirectory_csharp_grpc",
+- ":servicedirectory_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-servicedirectory-v1-csharp",
+- deps = [
+- ":servicedirectory_csharp_gapic",
+- ":servicedirectory_csharp_grpc",
+- ":servicedirectory_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "servicedirectory_cc_proto",
+- deps = [":servicedirectory_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "servicedirectory_cc_grpc",
+- srcs = [":servicedirectory_proto"],
+- grpc_only = True,
+- deps = [":servicedirectory_cc_proto"],
+-)
+diff -urN a/google/cloud/servicedirectory/v1beta1/BUILD.bazel b/google/cloud/servicedirectory/v1beta1/BUILD.bazel
+--- a/google/cloud/servicedirectory/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/servicedirectory/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,385 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "servicedirectory_proto",
+- srcs = [
+- "endpoint.proto",
+- "lookup_service.proto",
+- "namespace.proto",
+- "registration_service.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "servicedirectory_proto_with_info",
+- deps = [
+- ":servicedirectory_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "servicedirectory_java_proto",
+- deps = [":servicedirectory_proto"],
+-)
+-
+-java_grpc_library(
+- name = "servicedirectory_java_grpc",
+- srcs = [":servicedirectory_proto"],
+- deps = [":servicedirectory_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "servicedirectory_java_gapic",
+- srcs = [":servicedirectory_proto_with_info"],
+- grpc_service_config = "servicedirectory_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":servicedirectory_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":servicedirectory_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "servicedirectory_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.servicedirectory.v1beta1.LookupServiceClientHttpJsonTest",
+- "com.google.cloud.servicedirectory.v1beta1.LookupServiceClientTest",
+- "com.google.cloud.servicedirectory.v1beta1.RegistrationServiceClientHttpJsonTest",
+- "com.google.cloud.servicedirectory.v1beta1.RegistrationServiceClientTest",
+- ],
+- runtime_deps = [":servicedirectory_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-servicedirectory-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":servicedirectory_java_gapic",
+- ":servicedirectory_java_grpc",
+- ":servicedirectory_java_proto",
+- ":servicedirectory_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "servicedirectory_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1",
+- protos = [":servicedirectory_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "servicedirectory_go_gapic",
+- srcs = [":servicedirectory_proto_with_info"],
+- grpc_service_config = "servicedirectory_grpc_service_config.json",
+- importpath = "cloud.google.com/go/servicedirectory/apiv1beta1;servicedirectory",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "servicedirectory_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":servicedirectory_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "servicedirectory_go_gapic_test",
+- srcs = [":servicedirectory_go_gapic_srcjar_test"],
+- embed = [":servicedirectory_go_gapic"],
+- importpath = "cloud.google.com/go/servicedirectory/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-servicedirectory-v1beta1-go",
+- deps = [
+- ":servicedirectory_go_gapic",
+- ":servicedirectory_go_gapic_srcjar-metadata.srcjar",
+- ":servicedirectory_go_gapic_srcjar-test.srcjar",
+- ":servicedirectory_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "servicedirectory_py_gapic",
+- srcs = [":servicedirectory_proto"],
+- grpc_service_config = "servicedirectory_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-service-directory"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "servicedirectory_py_gapic_test",
+- srcs = [
+- "servicedirectory_py_gapic_pytest.py",
+- "servicedirectory_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":servicedirectory_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "servicedirectory-v1beta1-py",
+- deps = [
+- ":servicedirectory_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "servicedirectory_php_proto",
+- deps = [":servicedirectory_proto"],
+-)
+-
+-php_grpc_library(
+- name = "servicedirectory_php_grpc",
+- srcs = [":servicedirectory_proto"],
+- deps = [":servicedirectory_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "servicedirectory_php_gapic",
+- srcs = [":servicedirectory_proto_with_info"],
+- grpc_service_config = "servicedirectory_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "servicedirectory_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":servicedirectory_php_grpc",
+- ":servicedirectory_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-servicedirectory-v1beta1-php",
+- deps = [
+- ":servicedirectory_php_gapic",
+- ":servicedirectory_php_grpc",
+- ":servicedirectory_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "servicedirectory_nodejs_gapic",
+- package_name = "@google-cloud/service-directory",
+- src = ":servicedirectory_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "servicedirectory_grpc_service_config.json",
+- main_service = "ServiceDirectory",
+- package = "google.cloud.servicedirectory.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "servicedirectory_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "servicedirectory-v1beta1-nodejs",
+- deps = [
+- ":servicedirectory_nodejs_gapic",
+- ":servicedirectory_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "servicedirectory_ruby_proto",
+- deps = [":servicedirectory_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "servicedirectory_ruby_grpc",
+- srcs = [":servicedirectory_proto"],
+- deps = [":servicedirectory_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "servicedirectory_ruby_gapic",
+- srcs = [":servicedirectory_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=servicedirectory.googleapis.com",
+- "ruby-cloud-api-shortname=servicedirectory",
+- "ruby-cloud-env-prefix=SERVICE_DIRECTORY",
+- "ruby-cloud-gem-name=google-cloud-service_directory-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/service-directory",
+- ],
+- grpc_service_config = "servicedirectory_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Service directory is the single place to register, browse, and resolve application services.",
+- ruby_cloud_title = "Service Directory V1beta1",
+- deps = [
+- ":servicedirectory_ruby_grpc",
+- ":servicedirectory_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-servicedirectory-v1beta1-ruby",
+- deps = [
+- ":servicedirectory_ruby_gapic",
+- ":servicedirectory_ruby_grpc",
+- ":servicedirectory_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "servicedirectory_csharp_proto",
+- deps = [":servicedirectory_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "servicedirectory_csharp_grpc",
+- srcs = [":servicedirectory_proto"],
+- deps = [":servicedirectory_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "servicedirectory_csharp_gapic",
+- srcs = [":servicedirectory_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "servicedirectory_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "servicedirectory_v1beta1.yaml",
+- deps = [
+- ":servicedirectory_csharp_grpc",
+- ":servicedirectory_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-servicedirectory-v1beta1-csharp",
+- deps = [
+- ":servicedirectory_csharp_gapic",
+- ":servicedirectory_csharp_grpc",
+- ":servicedirectory_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/shell/BUILD.bazel b/google/cloud/shell/BUILD.bazel
+--- a/google/cloud/shell/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/shell/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-shell.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for cloudshell.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "cloudshell_ruby_wrapper",
+- srcs = ["//google/cloud/shell/v1:shell_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-shell",
+- "ruby-cloud-env-prefix=CLOUD_SHELL",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/shell/",
+- "ruby-cloud-api-id=cloudshell.googleapis.com",
+- "ruby-cloud-api-shortname=cloudshell",
+- ],
+- ruby_cloud_description = "Cloud Shell is an interactive shell environment for Google Cloud that makes it easy for you to learn and experiment with Google Cloud and manage your projects and resources from your web browser.",
+- ruby_cloud_title = "Cloud Shell",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-shell-ruby",
+- deps = [
+- ":cloudshell_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/shell/v1/BUILD.bazel b/google/cloud/shell/v1/BUILD.bazel
+--- a/google/cloud/shell/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/shell/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,388 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "shell_proto",
+- srcs = [
+- "cloudshell.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "shell_proto_with_info",
+- deps = [
+- ":shell_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "shell_java_proto",
+- deps = [":shell_proto"],
+-)
+-
+-java_grpc_library(
+- name = "shell_java_grpc",
+- srcs = [":shell_proto"],
+- deps = [":shell_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "shell_java_gapic",
+- srcs = [":shell_proto_with_info"],
+- grpc_service_config = "cloudshell_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":shell_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":shell_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "shell_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.shell.v1.CloudShellServiceClientHttpJsonTest",
+- "com.google.cloud.shell.v1.CloudShellServiceClientTest",
+- ],
+- runtime_deps = [":shell_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-shell-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":shell_java_gapic",
+- ":shell_java_grpc",
+- ":shell_java_proto",
+- ":shell_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "shell_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/shell/v1",
+- protos = [":shell_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "shell_go_gapic",
+- srcs = [":shell_proto_with_info"],
+- grpc_service_config = "cloudshell_grpc_service_config.json",
+- importpath = "cloud.google.com/go/shell/apiv1;shell",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "cloudshell_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":shell_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "shell_go_gapic_test",
+- srcs = [":shell_go_gapic_srcjar_test"],
+- embed = [":shell_go_gapic"],
+- importpath = "cloud.google.com/go/shell/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-shell-v1-go",
+- deps = [
+- ":shell_go_gapic",
+- ":shell_go_gapic_srcjar-metadata.srcjar",
+- ":shell_go_gapic_srcjar-test.srcjar",
+- ":shell_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "shell_py_gapic",
+- srcs = [":shell_proto"],
+- grpc_service_config = "cloudshell_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "shell_py_gapic_test",
+- srcs = [
+- "shell_py_gapic_pytest.py",
+- "shell_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":shell_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "shell-v1-py",
+- deps = [
+- ":shell_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "shell_php_proto",
+- deps = [":shell_proto"],
+-)
+-
+-php_grpc_library(
+- name = "shell_php_grpc",
+- srcs = [":shell_proto"],
+- deps = [":shell_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "shell_php_gapic",
+- srcs = [":shell_proto_with_info"],
+- grpc_service_config = "cloudshell_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudshell_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":shell_php_grpc",
+- ":shell_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-shell-v1-php",
+- deps = [
+- ":shell_php_gapic",
+- ":shell_php_grpc",
+- ":shell_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "shell_nodejs_gapic",
+- package_name = "@google-cloud/shell",
+- src = ":shell_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudshell_grpc_service_config.json",
+- package = "google.cloud.shell.v1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudshell_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "shell-v1-nodejs",
+- deps = [
+- ":shell_nodejs_gapic",
+- ":shell_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "shell_ruby_proto",
+- deps = [":shell_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "shell_ruby_grpc",
+- srcs = [":shell_proto"],
+- deps = [":shell_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "shell_ruby_gapic",
+- srcs = [":shell_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-shell-v1",
+- "ruby-cloud-env-prefix=CLOUD_SHELL",
+- "ruby-cloud-product-url=https://cloud.google.com/shell/",
+- "ruby-cloud-api-id=cloudshell.googleapis.com",
+- "ruby-cloud-api-shortname=cloudshell",
+- ],
+- grpc_service_config = "cloudshell_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Shell is an interactive shell environment for Google Cloud that makes it easy for you to learn and experiment with Google Cloud and manage your projects and resources from your web browser.",
+- ruby_cloud_title = "Cloud Shell V1",
+- deps = [
+- ":shell_ruby_grpc",
+- ":shell_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-shell-v1-ruby",
+- deps = [
+- ":shell_ruby_gapic",
+- ":shell_ruby_grpc",
+- ":shell_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "shell_csharp_proto",
+- deps = [":shell_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "shell_csharp_grpc",
+- srcs = [":shell_proto"],
+- deps = [":shell_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "shell_csharp_gapic",
+- srcs = [":shell_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudshell_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudshell_v1.yaml",
+- deps = [
+- ":shell_csharp_grpc",
+- ":shell_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-shell-v1-csharp",
+- deps = [
+- ":shell_csharp_gapic",
+- ":shell_csharp_grpc",
+- ":shell_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "shell_cc_proto",
+- deps = [":shell_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "shell_cc_grpc",
+- srcs = [":shell_proto"],
+- grpc_only = True,
+- deps = [":shell_cc_proto"],
+-)
+diff -urN a/google/cloud/speech/BUILD.bazel b/google/cloud/speech/BUILD.bazel
+--- a/google/cloud/speech/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/speech/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-speech.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for speech.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "speech_ruby_wrapper",
+- srcs = ["//google/cloud/speech/v1:speech_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-speech",
+- "ruby-cloud-env-prefix=SPEECH",
+- "ruby-cloud-wrapper-of=v1:0.8;v1p1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/speech-to-text",
+- "ruby-cloud-api-id=speech.googleapis.com",
+- "ruby-cloud-api-shortname=speech",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "Google Speech-to-Text enables developers to convert audio to text by applying powerful neural network models in an easy-to-use API. The API recognizes more than 120 languages and variants to support your global user base. You can enable voice command-and-control, transcribe audio from call centers, and more. It can process real-time streaming or prerecorded audio, using Google's machine learning technology.",
+- ruby_cloud_title = "Cloud Speech-to-Text",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-speech-ruby",
+- deps = [
+- ":speech_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/speech/v1/BUILD.bazel b/google/cloud/speech/v1/BUILD.bazel
+--- a/google/cloud/speech/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/speech/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,402 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "speech_proto",
+- srcs = [
+- "cloud_speech.proto",
+- "cloud_speech_adaptation.proto",
+- "resource.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "speech_proto_with_info",
+- deps = [
+- ":speech_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "speech_java_proto",
+- deps = [":speech_proto"],
+-)
+-
+-java_grpc_library(
+- name = "speech_java_grpc",
+- srcs = [":speech_proto"],
+- deps = [":speech_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "speech_java_gapic",
+- srcs = [":speech_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "speech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "speech_v1.yaml",
+- test_deps = [
+- ":speech_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":speech_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "speech_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.speech.v1.AdaptationClientHttpJsonTest",
+- "com.google.cloud.speech.v1.AdaptationClientTest",
+- "com.google.cloud.speech.v1.SpeechClientHttpJsonTest",
+- "com.google.cloud.speech.v1.SpeechClientTest",
+- ],
+- runtime_deps = [":speech_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-speech-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":speech_java_gapic",
+- ":speech_java_grpc",
+- ":speech_java_proto",
+- ":speech_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "speech_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/speech/v1",
+- protos = [":speech_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "speech_go_gapic",
+- srcs = [":speech_proto_with_info"],
+- grpc_service_config = "speech_grpc_service_config.json",
+- importpath = "cloud.google.com/go/speech/apiv1;speech",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "speech_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":speech_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "speech_go_gapic_test",
+- srcs = [":speech_go_gapic_srcjar_test"],
+- embed = [":speech_go_gapic"],
+- importpath = "cloud.google.com/go/speech/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-speech-v1-go",
+- deps = [
+- ":speech_go_gapic",
+- ":speech_go_gapic_srcjar-metadata.srcjar",
+- ":speech_go_gapic_srcjar-test.srcjar",
+- ":speech_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "speech_py_gapic",
+- srcs = [":speech_proto"],
+- grpc_service_config = "speech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "speech_v1.yaml",
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "speech_py_gapic_test",
+- srcs = [
+- "speech_py_gapic_pytest.py",
+- "speech_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":speech_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "speech-v1-py",
+- deps = [
+- ":speech_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "speech_php_proto",
+- deps = [":speech_proto"],
+-)
+-
+-php_grpc_library(
+- name = "speech_php_grpc",
+- srcs = [":speech_proto"],
+- deps = [":speech_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "speech_php_gapic",
+- srcs = [":speech_proto_with_info"],
+- grpc_service_config = "speech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "speech_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":speech_php_grpc",
+- ":speech_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-speech-v1-php",
+- deps = [
+- ":speech_php_gapic",
+- ":speech_php_grpc",
+- ":speech_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "speech_nodejs_gapic",
+- package_name = "@google-cloud/speech",
+- src = ":speech_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "speech_grpc_service_config.json",
+- package = "google.cloud.speech.v1",
+- rest_numeric_enums = False,
+- service_yaml = "speech_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "speech-v1-nodejs",
+- deps = [
+- ":speech_nodejs_gapic",
+- ":speech_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "speech_ruby_proto",
+- deps = [":speech_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "speech_ruby_grpc",
+- srcs = [":speech_proto"],
+- deps = [":speech_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "speech_ruby_gapic",
+- srcs = [":speech_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=speech.googleapis.com",
+- "ruby-cloud-api-shortname=speech",
+- "ruby-cloud-env-prefix=SPEECH",
+- "ruby-cloud-gem-name=google-cloud-speech-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/speech-to-text",
+- ],
+- grpc_service_config = "speech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Google Speech-to-Text enables developers to convert audio to text by applying powerful neural network models in an easy-to-use API. The API recognizes more than 120 languages and variants to support your global user base. You can enable voice command-and-control, transcribe audio from call centers, and more. It can process real-time streaming or prerecorded audio, using Google's machine learning technology.",
+- ruby_cloud_title = "Cloud Speech-to-Text V1",
+- deps = [
+- ":speech_ruby_grpc",
+- ":speech_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-speech-v1-ruby",
+- deps = [
+- ":speech_ruby_gapic",
+- ":speech_ruby_grpc",
+- ":speech_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "speech_csharp_proto",
+- deps = [":speech_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "speech_csharp_grpc",
+- srcs = [":speech_proto"],
+- deps = [":speech_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "speech_csharp_gapic",
+- srcs = [":speech_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "speech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "speech_v1.yaml",
+- deps = [
+- ":speech_csharp_grpc",
+- ":speech_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-speech-v1-csharp",
+- deps = [
+- ":speech_csharp_gapic",
+- ":speech_csharp_grpc",
+- ":speech_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "speech_cc_proto",
+- deps = [":speech_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "speech_cc_grpc",
+- srcs = [":speech_proto"],
+- grpc_only = True,
+- deps = [":speech_cc_proto"],
+-)
+diff -urN a/google/cloud/speech/v1p1beta1/BUILD.bazel b/google/cloud/speech/v1p1beta1/BUILD.bazel
+--- a/google/cloud/speech/v1p1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/speech/v1p1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,384 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "speech_proto",
+- srcs = [
+- "cloud_speech.proto",
+- "cloud_speech_adaptation.proto",
+- "resource.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "speech_proto_with_info",
+- deps = [
+- ":speech_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "speech_java_proto",
+- deps = [":speech_proto"],
+-)
+-
+-java_grpc_library(
+- name = "speech_java_grpc",
+- srcs = [":speech_proto"],
+- deps = [":speech_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "speech_java_gapic",
+- srcs = [":speech_proto_with_info"],
+- grpc_service_config = "speech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":speech_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":speech_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "speech_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.speech.v1p1beta1.AdaptationClientHttpJsonTest",
+- "com.google.cloud.speech.v1p1beta1.AdaptationClientTest",
+- "com.google.cloud.speech.v1p1beta1.SpeechClientHttpJsonTest",
+- "com.google.cloud.speech.v1p1beta1.SpeechClientTest",
+- ],
+- runtime_deps = [":speech_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-speech-v1p1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":speech_java_gapic",
+- ":speech_java_grpc",
+- ":speech_java_proto",
+- ":speech_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "speech_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1",
+- protos = [":speech_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "speech_go_gapic",
+- srcs = [":speech_proto_with_info"],
+- grpc_service_config = "speech_grpc_service_config.json",
+- importpath = "cloud.google.com/go/speech/apiv1p1beta1;speech",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "speech_v1p1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":speech_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "speech_go_gapic_test",
+- srcs = [":speech_go_gapic_srcjar_test"],
+- embed = [":speech_go_gapic"],
+- importpath = "cloud.google.com/go/speech/apiv1p1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-speech-v1p1beta1-go",
+- deps = [
+- ":speech_go_gapic",
+- ":speech_go_gapic_srcjar-metadata.srcjar",
+- ":speech_go_gapic_srcjar-test.srcjar",
+- ":speech_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "speech_py_gapic",
+- srcs = [":speech_proto"],
+- grpc_service_config = "speech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "speech_py_gapic_test",
+- srcs = [
+- "speech_py_gapic_pytest.py",
+- "speech_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":speech_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "speech-v1p1beta1-py",
+- deps = [
+- ":speech_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "speech_php_proto",
+- deps = [":speech_proto"],
+-)
+-
+-php_grpc_library(
+- name = "speech_php_grpc",
+- srcs = [":speech_proto"],
+- deps = [":speech_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "speech_php_gapic",
+- srcs = [":speech_proto_with_info"],
+- grpc_service_config = "speech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "speech_v1p1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":speech_php_grpc",
+- ":speech_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-speech-v1p1beta1-php",
+- deps = [
+- ":speech_php_gapic",
+- ":speech_php_grpc",
+- ":speech_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "speech_nodejs_gapic",
+- package_name = "@google-cloud/speech",
+- src = ":speech_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "speech_grpc_service_config.json",
+- package = "google.cloud.speech.v1p1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "speech_v1p1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "speech-v1p1beta1-nodejs",
+- deps = [
+- ":speech_nodejs_gapic",
+- ":speech_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "speech_ruby_proto",
+- deps = [":speech_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "speech_ruby_grpc",
+- srcs = [":speech_proto"],
+- deps = [":speech_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "speech_ruby_gapic",
+- srcs = [":speech_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=speech.googleapis.com",
+- "ruby-cloud-api-shortname=speech",
+- "ruby-cloud-env-prefix=SPEECH",
+- "ruby-cloud-gem-name=google-cloud-speech-v1p1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/speech-to-text",
+- ],
+- grpc_service_config = "speech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Google Speech-to-Text enables developers to convert audio to text by applying powerful neural network models in an easy-to-use API. The API recognizes more than 120 languages and variants to support your global user base. You can enable voice command-and-control, transcribe audio from call centers, and more. It can process real-time streaming or prerecorded audio, using Google's machine learning technology.",
+- ruby_cloud_title = "Cloud Speech-to-Text V1p1beta1",
+- deps = [
+- ":speech_ruby_grpc",
+- ":speech_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-speech-v1p1beta1-ruby",
+- deps = [
+- ":speech_ruby_gapic",
+- ":speech_ruby_grpc",
+- ":speech_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "speech_csharp_proto",
+- deps = [":speech_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "speech_csharp_grpc",
+- srcs = [":speech_proto"],
+- deps = [":speech_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "speech_csharp_gapic",
+- srcs = [":speech_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "speech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "speech_v1p1beta1.yaml",
+- deps = [
+- ":speech_csharp_grpc",
+- ":speech_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-speech-v1p1beta1-csharp",
+- deps = [
+- ":speech_csharp_gapic",
+- ":speech_csharp_grpc",
+- ":speech_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/speech/v2/BUILD.bazel b/google/cloud/speech/v2/BUILD.bazel
+--- a/google/cloud/speech/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/speech/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,398 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "speech_proto",
+- srcs = [
+- "cloud_speech.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "speech_proto_with_info",
+- deps = [
+- ":speech_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "speech_java_proto",
+- deps = [":speech_proto"],
+-)
+-
+-java_grpc_library(
+- name = "speech_java_grpc",
+- srcs = [":speech_proto"],
+- deps = [":speech_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "speech_java_gapic",
+- srcs = [":speech_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "speech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "speech_v2.yaml",
+- test_deps = [
+- ":speech_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":speech_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "speech_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.speech.v2.SpeechClientHttpJsonTest",
+- "com.google.cloud.speech.v2.SpeechClientTest",
+- ],
+- runtime_deps = [":speech_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-speech-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":speech_java_gapic",
+- ":speech_java_grpc",
+- ":speech_java_proto",
+- ":speech_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "speech_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/speech/v2",
+- protos = [":speech_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "speech_go_gapic",
+- srcs = [":speech_proto_with_info"],
+- grpc_service_config = "speech_grpc_service_config.json",
+- importpath = "cloud.google.com/go/speech/apiv2;speech",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "speech_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":speech_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "speech_go_gapic_test",
+- srcs = [":speech_go_gapic_srcjar_test"],
+- embed = [":speech_go_gapic"],
+- importpath = "cloud.google.com/go/speech/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-speech-v2-go",
+- deps = [
+- ":speech_go_gapic",
+- ":speech_go_gapic_srcjar-metadata.srcjar",
+- ":speech_go_gapic_srcjar-test.srcjar",
+- ":speech_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "speech_py_gapic",
+- srcs = [":speech_proto"],
+- grpc_service_config = "speech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "speech_v2.yaml",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "speech_py_gapic_test",
+- srcs = [
+- "speech_py_gapic_pytest.py",
+- "speech_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":speech_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "speech-v2-py",
+- deps = [
+- ":speech_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "speech_php_proto",
+- deps = [":speech_proto"],
+-)
+-
+-php_grpc_library(
+- name = "speech_php_grpc",
+- srcs = [":speech_proto"],
+- deps = [":speech_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "speech_php_gapic",
+- srcs = [":speech_proto_with_info"],
+- grpc_service_config = "speech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "speech_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":speech_php_grpc",
+- ":speech_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-speech-v2-php",
+- deps = [
+- ":speech_php_gapic",
+- ":speech_php_grpc",
+- ":speech_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "speech_nodejs_gapic",
+- package_name = "@google-cloud/speech",
+- src = ":speech_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "speech_grpc_service_config.json",
+- package = "google.cloud.speech.v2",
+- rest_numeric_enums = False,
+- service_yaml = "speech_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "speech-v2-nodejs",
+- deps = [
+- ":speech_nodejs_gapic",
+- ":speech_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "speech_ruby_proto",
+- deps = [":speech_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "speech_ruby_grpc",
+- srcs = [":speech_proto"],
+- deps = [":speech_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "speech_ruby_gapic",
+- srcs = [":speech_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=speech.googleapis.com",
+- "ruby-cloud-api-shortname=speech",
+- "ruby-cloud-env-prefix=SPEECH",
+- "ruby-cloud-gem-name=google-cloud-speech-v2",
+- "ruby-cloud-product-url=https://cloud.google.com/speech-to-text",
+- ],
+- grpc_service_config = "speech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Google Speech-to-Text enables developers to convert audio to text by applying powerful neural network models in an easy-to-use API. The API recognizes more than 120 languages and variants to support your global user base. You can enable voice command-and-control, transcribe audio from call centers, and more. It can process real-time streaming or prerecorded audio, using Google's machine learning technology.",
+- ruby_cloud_title = "Cloud Speech-to-Text V2",
+- service_yaml = "speech_v2.yaml",
+- deps = [
+- ":speech_ruby_grpc",
+- ":speech_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-speech-v2-ruby",
+- deps = [
+- ":speech_ruby_gapic",
+- ":speech_ruby_grpc",
+- ":speech_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "speech_csharp_proto",
+- deps = [":speech_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "speech_csharp_grpc",
+- srcs = [":speech_proto"],
+- deps = [":speech_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "speech_csharp_gapic",
+- srcs = [":speech_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "speech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "speech_v2.yaml",
+- deps = [
+- ":speech_csharp_grpc",
+- ":speech_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-speech-v2-csharp",
+- deps = [
+- ":speech_csharp_gapic",
+- ":speech_csharp_grpc",
+- ":speech_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "speech_cc_proto",
+- deps = [":speech_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "speech_cc_grpc",
+- srcs = [":speech_proto"],
+- grpc_only = True,
+- deps = [":speech_cc_proto"],
+-)
+diff -urN a/google/cloud/sql/v1/BUILD.bazel b/google/cloud/sql/v1/BUILD.bazel
+--- a/google/cloud/sql/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/sql/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,397 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "sql_proto",
+- srcs = [
+- "cloud_sql_backup_runs.proto",
+- "cloud_sql_connect.proto",
+- "cloud_sql_databases.proto",
+- "cloud_sql_flags.proto",
+- "cloud_sql_instance_names.proto",
+- "cloud_sql_instances.proto",
+- "cloud_sql_operations.proto",
+- "cloud_sql_resources.proto",
+- "cloud_sql_ssl_certs.proto",
+- "cloud_sql_tiers.proto",
+- "cloud_sql_users.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "sql_proto_with_info",
+- deps = [
+- ":sql_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "sql_java_proto",
+- deps = [":sql_proto"],
+-)
+-
+-java_grpc_library(
+- name = "sql_java_grpc",
+- srcs = [":sql_proto"],
+- deps = [":sql_java_proto"],
+-)
+-
+-# Excluded because of generation errors.
+-#
+-# java_gapic_library(
+-# name = "sql_java_gapic",
+-# srcs = [":sql_proto_with_info"],
+-# gapic_yaml = None,
+-# grpc_service_config = "sqladmin_grpc_service_config.json",
+-# service_yaml = "sqladmin_v1.yaml",
+-# test_deps = [
+-# ":sql_java_grpc",
+-# ],
+-# deps = [
+-# ":sql_java_proto",
+-# "//google/api:api_java_proto",
+-# ],
+-# )
+-
+-# java_gapic_test(
+-# name = "sql_java_gapic_test_suite",
+-# test_classes = [
+-# "com.google.cloud.sql.v1.SqlBackupRunsServiceClientTest",
+-# "com.google.cloud.sql.v1.SqlConnectServiceClientTest",
+-# "com.google.cloud.sql.v1.SqlDatabasesServiceClientTest",
+-# "com.google.cloud.sql.v1.SqlFlagsServiceClientTest",
+-# "com.google.cloud.sql.v1.SqlInstanceNamesServiceClientTest",
+-# "com.google.cloud.sql.v1.SqlInstancesServiceClientTest",
+-# "com.google.cloud.sql.v1.SqlOperationsServiceClientTest",
+-# "com.google.cloud.sql.v1.SqlRegionsServiceClientTest",
+-# "com.google.cloud.sql.v1.SqlSslCertsServiceClientTest",
+-# "com.google.cloud.sql.v1.SqlTiersServiceClientTest",
+-# "com.google.cloud.sql.v1.SqlUsersServiceClientTest",
+-# ],
+-# runtime_deps = [":sql_java_gapic_test"],
+-# )
+-
+-# Open Source Packages
+-# java_gapic_assembly_gradle_pkg(
+-# name = "google-cloud-sql-v1-java",
+-# deps = [
+-# ":sql_java_gapic",
+-# ":sql_java_grpc",
+-# ":sql_java_proto",
+-# ":sql_proto",
+-# ],
+-# include_samples = True,
+-# )
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "sql_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/sql/v1",
+- protos = [":sql_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-# Excluded because of generation errors.
+-#
+-# go_gapic_library(
+-# name = "sql_go_gapic",
+-# srcs = [":sql_proto_with_info"],
+-# grpc_service_config = "sqladmin_grpc_service_config.json",
+-# importpath = "cloud.google.com/go/sql/apiv1;sql",
+-# service_yaml = "sqladmin_v1.yaml",
+-# metadata = True,
+-# deps = [
+-# ":sql_go_proto",
+-# ],
+-# )
+-
+-# go_test(
+-# name = "sql_go_gapic_test",
+-# srcs = [":sql_go_gapic_srcjar_test"],
+-# embed = [":sql_go_gapic"],
+-# importpath = "cloud.google.com/go/sql/apiv1",
+-# )
+-
+-# Open Source Packages
+-# go_gapic_assembly_pkg(
+-# name = "gapi-cloud-sql-v1-go",
+-# deps = [
+-# ":sql_go_gapic",
+-# ":sql_go_gapic_srcjar-test.srcjar",
+-# ":sql_go_gapic_srcjar-metadata.srcjar",
+-# ":sql_go_proto",
+-# ],
+-# )
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "sql_py_gapic",
+- srcs = [":sql_proto"],
+- grpc_service_config = "sqladmin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "sql_py_gapic_test",
+- srcs = [
+- "sql_py_gapic_pytest.py",
+- "sql_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":sql_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "sql-v1-py",
+- deps = [
+- ":sql_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "sql_php_proto",
+- deps = [":sql_proto"],
+-)
+-
+-php_grpc_library(
+- name = "sql_php_grpc",
+- srcs = [":sql_proto"],
+- deps = [":sql_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "sql_php_gapic",
+- srcs = [":sql_proto_with_info"],
+- grpc_service_config = "sqladmin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "sqladmin_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":sql_php_grpc",
+- ":sql_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-sql-v1-php",
+- deps = [
+- ":sql_php_gapic",
+- ":sql_php_grpc",
+- ":sql_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "sql_nodejs_gapic",
+- package_name = "@google-cloud/sql",
+- src = ":sql_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "sqladmin_grpc_service_config.json",
+- package = "google.cloud.sql.v1",
+- rest_numeric_enums = False,
+- service_yaml = "sqladmin_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "sql-v1-nodejs",
+- deps = [
+- ":sql_nodejs_gapic",
+- ":sql_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "sql_ruby_proto",
+- deps = [":sql_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "sql_ruby_grpc",
+- srcs = [":sql_proto"],
+- deps = [":sql_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "sql_ruby_gapic",
+- srcs = [":sql_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-sql-v1",
+- ],
+- grpc_service_config = "sqladmin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":sql_ruby_grpc",
+- ":sql_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-sql-v1-ruby",
+- deps = [
+- ":sql_ruby_gapic",
+- ":sql_ruby_grpc",
+- ":sql_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "sql_csharp_proto",
+- deps = [":sql_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "sql_csharp_grpc",
+- srcs = [":sql_proto"],
+- deps = [":sql_csharp_proto"],
+-)
+-
+-# Excluded because of generation errors.
+-#
+-# csharp_gapic_library(
+-# name = "sql_csharp_gapic",
+-# srcs = [":sql_proto_with_info"],
+-# common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+-# grpc_service_config = "sqladmin_grpc_service_config.json",
+-# deps = [
+-# ":sql_csharp_grpc",
+-# ":sql_csharp_proto",
+-# ],
+-# )
+-
+-# # Open Source Packages
+-# csharp_gapic_assembly_pkg(
+-# name = "google-cloud-sql-v1-csharp",
+-# deps = [
+-# ":sql_csharp_gapic",
+-# ":sql_csharp_grpc",
+-# ":sql_csharp_proto",
+-# ],
+-# )
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "sql_cc_proto",
+- deps = [":sql_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "sql_cc_grpc",
+- srcs = [":sql_proto"],
+- grpc_only = True,
+- deps = [":sql_cc_proto"],
+-)
+diff -urN a/google/cloud/sql/v1beta4/BUILD.bazel b/google/cloud/sql/v1beta4/BUILD.bazel
+--- a/google/cloud/sql/v1beta4/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/sql/v1beta4/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,383 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "sql_proto",
+- srcs = [
+- "cloud_sql.proto",
+- "cloud_sql_connect.proto",
+- "cloud_sql_resources.proto",
+- "cloud_sql_tiers.proto",
+- "cloud_sql_users.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "sql_proto_with_info",
+- deps = [
+- ":sql_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-#load(
+-# "@com_google_googleapis_imports//:imports.bzl",
+-# "java_gapic_assembly_gradle_pkg",
+-# "java_gapic_library",
+-# "java_gapic_test",
+-# "java_grpc_library",
+-# "java_proto_library",
+-#)
+-
+-#java_proto_library(
+-# name = "sql_java_proto",
+-# deps = [":sql_proto"],
+-#)
+-
+-#java_grpc_library(
+-# name = "sql_java_grpc",
+-# srcs = [":sql_proto"],
+-# deps = [":sql_java_proto"],
+-#)
+-
+-#java_gapic_library(
+-# name = "sql_java_gapic",
+-# srcs = [":sql_proto_with_info"],
+-# gapic_yaml = None,
+-# grpc_service_config = "sqladmin_grpc_service_config.json",
+-# service_yaml = "sqladmin_v1beta4.yaml",
+-# test_deps = [
+-# ":sql_java_grpc",
+-# ],
+-# deps = [
+-# ":sql_java_proto",
+-# "//google/api:api_java_proto",
+-# ],
+-#)
+-
+-#java_gapic_test(
+-# name = "sql_java_gapic_test_suite",
+-# test_classes = [
+-# "com.google.cloud.sql.v1beta4.SqlBackupRunsServiceClientTest",
+-# "com.google.cloud.sql.v1beta4.SqlConnectServiceClientTest",
+-# "com.google.cloud.sql.v1beta4.SqlDatabasesServiceClientTest",
+-# "com.google.cloud.sql.v1beta4.SqlFlagsServiceClientTest",
+-# "com.google.cloud.sql.v1beta4.SqlInstancesServiceClientTest",
+-# "com.google.cloud.sql.v1beta4.SqlOperationsServiceClientTest",
+-# "com.google.cloud.sql.v1beta4.SqlSslCertsServiceClientTest",
+-# "com.google.cloud.sql.v1beta4.SqlTiersServiceClientTest",
+-# "com.google.cloud.sql.v1beta4.SqlUsersServiceClientTest",
+-# ],
+-# runtime_deps = [":sql_java_gapic_test"],
+-#)
+-
+-# Open Source Packages
+-#java_gapic_assembly_gradle_pkg(
+-# name = "google-cloud-sql-v1beta4-java",
+-# deps = [
+-# ":sql_java_gapic",
+-# ":sql_java_grpc",
+-# ":sql_java_proto",
+-# ":sql_proto",
+-# ],
+-# include_samples = True,
+-#)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-# load(
+-# "@com_google_googleapis_imports//:imports.bzl",
+-# "go_gapic_assembly_pkg",
+-# "go_gapic_library",
+-# "go_proto_library",
+-# "go_test",
+-#)
+-
+-#go_proto_library(
+-# name = "sql_go_proto",
+-# compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+-# importpath = "google.golang.org/genproto/googleapis/cloud/sql/v1beta4",
+-# protos = [":sql_proto"],
+-# deps = [
+-# "//google/api:annotations_go_proto",
+-# ],
+-#)
+-
+-#go_gapic_library(
+-# name = "sql_go_gapic",
+-# srcs = [":sql_proto_with_info"],
+-# grpc_service_config = "sqladmin_grpc_service_config.json",
+-# importpath = "cloud.google.com/go/sql/apiv1beta4;sql",
+-# metadata = True,
+-# service_yaml = "sqladmin_v1beta4.yaml",
+-# deps = [
+-# ":sql_go_proto",
+-# "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+-# ],
+-#)
+-
+-#go_test(
+-# name = "sql_go_gapic_test",
+-# srcs = [":sql_go_gapic_srcjar_test"],
+-# embed = [":sql_go_gapic"],
+-# importpath = "cloud.google.com/go/sql/apiv1beta4",
+-#)
+-
+-# Open Source Packages
+-#go_gapic_assembly_pkg(
+-# name = "gapi-cloud-sql-v1beta4-go",
+-# deps = [
+-# ":sql_go_gapic",
+-# ":sql_go_gapic_srcjar-metadata.srcjar",
+-# ":sql_go_gapic_srcjar-test.srcjar",
+-# ":sql_go_proto",
+-# ],
+-#)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "sql_py_gapic",
+- srcs = [":sql_proto"],
+- grpc_service_config = "sqladmin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "sql_py_gapic_test",
+- srcs = [
+- "sql_py_gapic_pytest.py",
+- "sql_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":sql_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "sql-v1beta4-py",
+- deps = [
+- ":sql_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "sql_php_proto",
+- deps = [":sql_proto"],
+-)
+-
+-php_grpc_library(
+- name = "sql_php_grpc",
+- srcs = [":sql_proto"],
+- deps = [":sql_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "sql_php_gapic",
+- srcs = [":sql_proto_with_info"],
+- grpc_service_config = "sqladmin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "sqladmin_v1beta4.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":sql_php_grpc",
+- ":sql_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-sql-v1beta4-php",
+- deps = [
+- ":sql_php_gapic",
+- ":sql_php_grpc",
+- ":sql_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "sql_nodejs_gapic",
+- package_name = "@google-cloud/sql",
+- src = ":sql_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "sqladmin_grpc_service_config.json",
+- package = "google.cloud.sql.v1beta4",
+- rest_numeric_enums = False,
+- service_yaml = "sqladmin_v1beta4.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "sql-v1beta4-nodejs",
+- deps = [
+- ":sql_nodejs_gapic",
+- ":sql_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "sql_ruby_proto",
+- deps = [":sql_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "sql_ruby_grpc",
+- srcs = [":sql_proto"],
+- deps = [":sql_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "sql_ruby_gapic",
+- srcs = [":sql_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-sql-v1beta4"],
+- grpc_service_config = "sqladmin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":sql_ruby_grpc",
+- ":sql_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-sql-v1beta4-ruby",
+- deps = [
+- ":sql_ruby_gapic",
+- ":sql_ruby_grpc",
+- ":sql_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-#load(
+-# "@com_google_googleapis_imports//:imports.bzl",
+-# "csharp_gapic_assembly_pkg",
+-# "csharp_gapic_library",
+-# "csharp_grpc_library",
+-# "csharp_proto_library",
+-#)
+-
+-#csharp_proto_library(
+-# name = "sql_csharp_proto",
+-# deps = [":sql_proto"],
+-#)
+-
+-#csharp_grpc_library(
+-# name = "sql_csharp_grpc",
+-# srcs = [":sql_proto"],
+-# deps = [":sql_csharp_proto"],
+-#)
+-
+-#csharp_gapic_library(
+-# name = "sql_csharp_gapic",
+-# srcs = [":sql_proto_with_info"],
+-# common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+-# grpc_service_config = "sqladmin_grpc_service_config.json",
+-# deps = [
+-# ":sql_csharp_grpc",
+-# ":sql_csharp_proto",
+-# ],
+-#)
+-
+-# Open Source Packages
+-# csharp_gapic_assembly_pkg(
+-# name = "google-cloud-sql-v1beta4-csharp",
+-# deps = [
+-# ":sql_csharp_gapic",
+-# ":sql_csharp_grpc",
+-# ":sql_csharp_proto",
+-# ],
+-#)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "sql_cc_proto",
+- deps = [":sql_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "sql_cc_grpc",
+- srcs = [":sql_proto"],
+- grpc_only = True,
+- deps = [":sql_cc_proto"],
+-)
+diff -urN a/google/cloud/storageinsights/v1/BUILD.bazel b/google/cloud/storageinsights/v1/BUILD.bazel
+--- a/google/cloud/storageinsights/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/storageinsights/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,397 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "storageinsights_proto",
+- srcs = [
+- "storageinsights.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "//google/type:date_proto",
+- "//google/type:datetime_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "storageinsights_proto_with_info",
+- deps = [
+- ":storageinsights_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "storageinsights_java_proto",
+- deps = [":storageinsights_proto"],
+-)
+-
+-java_grpc_library(
+- name = "storageinsights_java_grpc",
+- srcs = [":storageinsights_proto"],
+- deps = [":storageinsights_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "storageinsights_java_gapic",
+- srcs = [":storageinsights_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "storageinsights_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "storageinsights_v1.yaml",
+- test_deps = [
+- ":storageinsights_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":storageinsights_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "storageinsights_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.storageinsights.v1.StorageInsightsClientHttpJsonTest",
+- "com.google.cloud.storageinsights.v1.StorageInsightsClientTest",
+- ],
+- runtime_deps = [":storageinsights_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-storageinsights-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":storageinsights_java_gapic",
+- ":storageinsights_java_grpc",
+- ":storageinsights_java_proto",
+- ":storageinsights_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "storageinsights_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/storageinsights/v1",
+- protos = [":storageinsights_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:date_go_proto",
+- "//google/type:datetime_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "storageinsights_go_gapic",
+- srcs = [":storageinsights_proto_with_info"],
+- grpc_service_config = "storageinsights_grpc_service_config.json",
+- importpath = "cloud.google.com/go/storageinsights/apiv1;storageinsights",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "storageinsights_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":storageinsights_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto", ## manual change
+- "//google/longrunning:longrunning_go_proto", ## manual change
+- ],
+-)
+-
+-go_test(
+- name = "storageinsights_go_gapic_test",
+- srcs = [":storageinsights_go_gapic_srcjar_test"],
+- embed = [":storageinsights_go_gapic"],
+- importpath = "cloud.google.com/go/storageinsights/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-storageinsights-v1-go",
+- deps = [
+- ":storageinsights_go_gapic",
+- ":storageinsights_go_gapic_srcjar-metadata.srcjar",
+- ":storageinsights_go_gapic_srcjar-test.srcjar",
+- ":storageinsights_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "storageinsights_py_gapic",
+- srcs = [":storageinsights_proto"],
+- grpc_service_config = "storageinsights_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "storageinsights_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "storageinsights_py_gapic_test",
+- srcs = [
+- "storageinsights_py_gapic_pytest.py",
+- "storageinsights_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":storageinsights_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "storageinsights-v1-py",
+- deps = [
+- ":storageinsights_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "storageinsights_php_proto",
+- deps = [":storageinsights_proto"],
+-)
+-
+-php_grpc_library(
+- name = "storageinsights_php_grpc",
+- srcs = [":storageinsights_proto"],
+- deps = [":storageinsights_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "storageinsights_php_gapic",
+- srcs = [":storageinsights_proto_with_info"],
+- grpc_service_config = "storageinsights_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "storageinsights_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":storageinsights_php_grpc",
+- ":storageinsights_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-storageinsights-v1-php",
+- deps = [
+- ":storageinsights_php_gapic",
+- ":storageinsights_php_grpc",
+- ":storageinsights_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "storageinsights_nodejs_gapic",
+- package_name = "@google-cloud/storageinsights",
+- src = ":storageinsights_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "storageinsights_grpc_service_config.json",
+- package = "google.cloud.storageinsights.v1",
+- rest_numeric_enums = False,
+- service_yaml = "storageinsights_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "storageinsights-v1-nodejs",
+- deps = [
+- ":storageinsights_nodejs_gapic",
+- ":storageinsights_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "storageinsights_ruby_proto",
+- deps = [":storageinsights_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "storageinsights_ruby_grpc",
+- srcs = [":storageinsights_proto"],
+- deps = [":storageinsights_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "storageinsights_ruby_gapic",
+- srcs = [":storageinsights_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-storageinsights-v1",
+- ],
+- grpc_service_config = "storageinsights_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "storageinsights_v1.yaml",
+- deps = [
+- ":storageinsights_ruby_grpc",
+- ":storageinsights_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-storageinsights-v1-ruby",
+- deps = [
+- ":storageinsights_ruby_gapic",
+- ":storageinsights_ruby_grpc",
+- ":storageinsights_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "storageinsights_csharp_proto",
+- deps = [":storageinsights_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "storageinsights_csharp_grpc",
+- srcs = [":storageinsights_proto"],
+- deps = [":storageinsights_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "storageinsights_csharp_gapic",
+- srcs = [":storageinsights_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "storageinsights_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "storageinsights_v1.yaml",
+- deps = [
+- ":storageinsights_csharp_grpc",
+- ":storageinsights_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-storageinsights-v1-csharp",
+- deps = [
+- ":storageinsights_csharp_gapic",
+- ":storageinsights_csharp_grpc",
+- ":storageinsights_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "storageinsights_cc_proto",
+- deps = [":storageinsights_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "storageinsights_cc_grpc",
+- srcs = [":storageinsights_proto"],
+- grpc_only = True,
+- deps = [":storageinsights_cc_proto"],
+-)
+diff -urN a/google/cloud/stream/logging/v1/BUILD.bazel b/google/cloud/stream/logging/v1/BUILD.bazel
+--- a/google/cloud/stream/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/stream/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,175 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "logging.proto",
+- ],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/stream/logging/v1",
+- protos = [":logging_proto"],
+- deps = [],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/talent/BUILD.bazel b/google/cloud/talent/BUILD.bazel
+--- a/google/cloud/talent/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/talent/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-talent.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for jobs.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v4 in this case.
+-ruby_cloud_gapic_library(
+- name = "jobs_ruby_wrapper",
+- srcs = ["//google/cloud/talent/v4:talent_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-talent",
+- "ruby-cloud-env-prefix=TALENT",
+- "ruby-cloud-wrapper-of=v4:0.2;v4beta1:0.2",
+- "ruby-cloud-product-url=https://cloud.google.com/solutions/talent-solution",
+- "ruby-cloud-api-id=jobs.googleapis.com",
+- "ruby-cloud-api-shortname=jobs",
+- "ruby-cloud-migration-version=0.20",
+- ],
+- ruby_cloud_description = "Transform your job search and candidate matching capabilities with Cloud Talent Solution, designed to support enterprise talent acquisition technology and evolve with your growing needs. This AI solution includes features such as Job Search and Profile Search (Beta) to provide candidates and employers with an enhanced talent acquisition experience.",
+- ruby_cloud_title = "Cloud Talent Solution",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-talent-ruby",
+- deps = [
+- ":jobs_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/talent/v4/BUILD.bazel b/google/cloud/talent/v4/BUILD.bazel
+--- a/google/cloud/talent/v4/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/talent/v4/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,419 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "talent_proto",
+- srcs = [
+- "common.proto",
+- "company.proto",
+- "company_service.proto",
+- "completion_service.proto",
+- "event.proto",
+- "event_service.proto",
+- "filters.proto",
+- "histogram.proto",
+- "job.proto",
+- "job_service.proto",
+- "tenant.proto",
+- "tenant_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:latlng_proto",
+- "//google/type:money_proto",
+- "//google/type:postal_address_proto",
+- "//google/type:timeofday_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "talent_proto_with_info",
+- deps = [
+- ":talent_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "talent_java_proto",
+- deps = [":talent_proto"],
+-)
+-
+-java_grpc_library(
+- name = "talent_java_grpc",
+- srcs = [":talent_proto"],
+- deps = [":talent_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "talent_java_gapic",
+- srcs = [":talent_proto_with_info"],
+- grpc_service_config = "talent_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":talent_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":talent_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "talent_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.talent.v4.CompanyServiceClientHttpJsonTest",
+- "com.google.cloud.talent.v4.CompanyServiceClientTest",
+- "com.google.cloud.talent.v4.CompletionClientHttpJsonTest",
+- "com.google.cloud.talent.v4.CompletionClientTest",
+- "com.google.cloud.talent.v4.EventServiceClientHttpJsonTest",
+- "com.google.cloud.talent.v4.EventServiceClientTest",
+- "com.google.cloud.talent.v4.JobServiceClientHttpJsonTest",
+- "com.google.cloud.talent.v4.JobServiceClientTest",
+- "com.google.cloud.talent.v4.TenantServiceClientHttpJsonTest",
+- "com.google.cloud.talent.v4.TenantServiceClientTest",
+- ],
+- runtime_deps = [":talent_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-talent-v4-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":talent_java_gapic",
+- ":talent_java_grpc",
+- ":talent_java_proto",
+- ":talent_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "talent_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/talent/v4",
+- protos = [":talent_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:latlng_go_proto",
+- "//google/type:money_go_proto",
+- "//google/type:postaladdress_go_proto",
+- "//google/type:timeofday_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "talent_go_gapic",
+- srcs = [":talent_proto_with_info"],
+- grpc_service_config = "talent_grpc_service_config.json",
+- importpath = "cloud.google.com/go/talent/apiv4;talent",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/talent:talent_v4.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":talent_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "talent_go_gapic_test",
+- srcs = [":talent_go_gapic_srcjar_test"],
+- embed = [":talent_go_gapic"],
+- importpath = "cloud.google.com/go/talent/apiv4",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-talent-v4-go",
+- deps = [
+- ":talent_go_gapic",
+- ":talent_go_gapic_srcjar-test.srcjar",
+- ":talent_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "talent_py_gapic",
+- srcs = [":talent_proto"],
+- grpc_service_config = "talent_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "talent_py_gapic_test",
+- srcs = [
+- "talent_py_gapic_pytest.py",
+- "talent_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":talent_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "talent-v4-py",
+- deps = [
+- ":talent_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "talent_php_proto",
+- deps = [":talent_proto"],
+-)
+-
+-php_grpc_library(
+- name = "talent_php_grpc",
+- srcs = [":talent_proto"],
+- deps = [":talent_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "talent_php_gapic",
+- srcs = [":talent_proto_with_info"],
+- grpc_service_config = "talent_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "jobs_v4.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":talent_php_grpc",
+- ":talent_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-talent-v4-php",
+- deps = [
+- ":talent_php_gapic",
+- ":talent_php_grpc",
+- ":talent_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "talent_nodejs_gapic",
+- package_name = "@google-cloud/talent",
+- src = ":talent_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "talent_grpc_service_config.json",
+- main_service = "talent",
+- package = "google.cloud.talent.v4",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/talent:talent_v4.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "talent-v4-nodejs",
+- deps = [
+- ":talent_nodejs_gapic",
+- ":talent_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "talent_ruby_proto",
+- deps = [":talent_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "talent_ruby_grpc",
+- srcs = [":talent_proto"],
+- deps = [":talent_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "talent_ruby_gapic",
+- srcs = [":talent_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-talent-v4",
+- "ruby-cloud-env-prefix=TALENT",
+- "ruby-cloud-product-url=https://cloud.google.com/solutions/talent-solution",
+- "ruby-cloud-api-id=jobs.googleapis.com",
+- "ruby-cloud-api-shortname=jobs",
+- ],
+- grpc_service_config = "talent_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Transform your job search and candidate matching capabilities with Cloud Talent Solution, designed to support enterprise talent acquisition technology and evolve with your growing needs. This AI solution includes features such as Job Search and Profile Search to provide candidates and employers with an enhanced talent acquisition experience.",
+- ruby_cloud_title = "Cloud Talent Solution V4",
+- deps = [
+- ":talent_ruby_grpc",
+- ":talent_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-talent-v4-ruby",
+- deps = [
+- ":talent_ruby_gapic",
+- ":talent_ruby_grpc",
+- ":talent_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "talent_csharp_proto",
+- deps = [":talent_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "talent_csharp_grpc",
+- srcs = [":talent_proto"],
+- deps = [":talent_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "talent_csharp_gapic",
+- srcs = [":talent_proto_with_info"],
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/talent:talent_v4.yaml",
+- deps = [
+- ":talent_csharp_grpc",
+- ":talent_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-talent-v4-csharp",
+- deps = [
+- ":talent_csharp_gapic",
+- ":talent_csharp_grpc",
+- ":talent_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "talent_cc_proto",
+- deps = [":talent_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "talent_cc_grpc",
+- srcs = [":talent_proto"],
+- grpc_only = True,
+- deps = [":talent_cc_proto"],
+-)
+diff -urN a/google/cloud/talent/v4beta1/BUILD.bazel b/google/cloud/talent/v4beta1/BUILD.bazel
+--- a/google/cloud/talent/v4beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/talent/v4beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,432 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "talent_proto",
+- srcs = [
+- "batch.proto",
+- "common.proto",
+- "company.proto",
+- "company_service.proto",
+- "completion_service.proto",
+- "event.proto",
+- "event_service.proto",
+- "filters.proto",
+- "histogram.proto",
+- "job.proto",
+- "job_service.proto",
+- "tenant.proto",
+- "tenant_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:date_proto",
+- "//google/type:dayofweek_proto",
+- "//google/type:latlng_proto",
+- "//google/type:money_proto",
+- "//google/type:postal_address_proto",
+- "//google/type:timeofday_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "talent_proto_with_info",
+- deps = [
+- ":talent_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "talent_java_proto",
+- deps = [":talent_proto"],
+-)
+-
+-java_grpc_library(
+- name = "talent_java_grpc",
+- srcs = [":talent_proto"],
+- deps = [":talent_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "talent_java_gapic",
+- srcs = [":talent_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "talent_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "jobs_v4beta1.yaml",
+- test_deps = [
+- ":talent_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":talent_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "talent_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.talent.v4beta1.CompanyServiceClientHttpJsonTest",
+- "com.google.cloud.talent.v4beta1.CompanyServiceClientTest",
+- "com.google.cloud.talent.v4beta1.CompletionClientHttpJsonTest",
+- "com.google.cloud.talent.v4beta1.CompletionClientTest",
+- "com.google.cloud.talent.v4beta1.EventServiceClientHttpJsonTest",
+- "com.google.cloud.talent.v4beta1.EventServiceClientTest",
+- "com.google.cloud.talent.v4beta1.JobServiceClientHttpJsonTest",
+- "com.google.cloud.talent.v4beta1.JobServiceClientTest",
+- "com.google.cloud.talent.v4beta1.TenantServiceClientHttpJsonTest",
+- "com.google.cloud.talent.v4beta1.TenantServiceClientTest",
+- ],
+- runtime_deps = [":talent_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-talent-v4beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":talent_java_gapic",
+- ":talent_java_grpc",
+- ":talent_java_proto",
+- ":talent_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "talent_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1",
+- protos = [":talent_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:date_go_proto",
+- "//google/type:dayofweek_go_proto",
+- "//google/type:latlng_go_proto",
+- "//google/type:money_go_proto",
+- "//google/type:postaladdress_go_proto",
+- "//google/type:timeofday_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "talent_go_gapic",
+- srcs = [":talent_proto_with_info"],
+- grpc_service_config = "talent_grpc_service_config.json",
+- importpath = "cloud.google.com/go/talent/apiv4beta1;talent",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "jobs_v4beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":talent_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "talent_go_gapic_test",
+- srcs = [":talent_go_gapic_srcjar_test"],
+- embed = [":talent_go_gapic"],
+- importpath = "cloud.google.com/go/talent/apiv4beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-talent-v4beta1-go",
+- deps = [
+- ":talent_go_gapic",
+- ":talent_go_gapic_srcjar-metadata.srcjar",
+- ":talent_go_gapic_srcjar-test.srcjar",
+- ":talent_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "talent_py_gapic",
+- srcs = [":talent_proto"],
+- grpc_service_config = "talent_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "jobs_v4beta1.yaml",
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "talent_py_gapic_test",
+- srcs = [
+- "talent_py_gapic_pytest.py",
+- "talent_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":talent_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "talent-v4beta1-py",
+- deps = [
+- ":talent_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "talent_php_proto",
+- deps = [":talent_proto"],
+-)
+-
+-php_grpc_library(
+- name = "talent_php_grpc",
+- srcs = [":talent_proto"],
+- deps = [":talent_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "talent_php_gapic",
+- srcs = [":talent_proto_with_info"],
+- grpc_service_config = "talent_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "jobs_v4beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":talent_php_grpc",
+- ":talent_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-talent-v4beta1-php",
+- deps = [
+- ":talent_php_gapic",
+- ":talent_php_grpc",
+- ":talent_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "talent_nodejs_gapic",
+- package_name = "@google-cloud/talent",
+- src = ":talent_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "talent_grpc_service_config.json",
+- main_service = "talent",
+- package = "google.cloud.talent.v4beta1",
+- rest_numeric_enums = False,
+- service_yaml = "jobs_v4beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "talent-v4beta1-nodejs",
+- deps = [
+- ":talent_nodejs_gapic",
+- ":talent_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "talent_ruby_proto",
+- deps = [":talent_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "talent_ruby_grpc",
+- srcs = [":talent_proto"],
+- deps = [":talent_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "talent_ruby_gapic",
+- srcs = [":talent_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=jobs.googleapis.com",
+- "ruby-cloud-api-shortname=jobs",
+- "ruby-cloud-env-prefix=TALENT",
+- "ruby-cloud-gem-name=google-cloud-talent-v4beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/solutions/talent-solution",
+- ],
+- grpc_service_config = "talent_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Transform your job search and candidate matching capabilities with Cloud Talent Solution, designed to support enterprise talent acquisition technology and evolve with your growing needs. This AI solution includes features such as Job Search and Profile Search to provide candidates and employers with an enhanced talent acquisition experience.",
+- ruby_cloud_title = "Cloud Talent Solution V4beta1",
+- deps = [
+- ":talent_ruby_grpc",
+- ":talent_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-talent-v4beta1-ruby",
+- deps = [
+- ":talent_ruby_gapic",
+- ":talent_ruby_grpc",
+- ":talent_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "talent_csharp_proto",
+- deps = [":talent_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "talent_csharp_grpc",
+- srcs = [":talent_proto"],
+- deps = [":talent_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "talent_csharp_gapic",
+- srcs = [":talent_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "talent_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "jobs_v4beta1.yaml",
+- deps = [
+- ":talent_csharp_grpc",
+- ":talent_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-talent-v4beta1-csharp",
+- deps = [
+- ":talent_csharp_gapic",
+- ":talent_csharp_grpc",
+- ":talent_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "talent_cc_proto",
+- deps = [":talent_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "talent_cc_grpc",
+- srcs = [":talent_proto"],
+- grpc_only = True,
+- deps = [":talent_cc_proto"],
+-)
+diff -urN a/google/cloud/tasks/BUILD.bazel b/google/cloud/tasks/BUILD.bazel
+--- a/google/cloud/tasks/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/tasks/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-tasks.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for cloudtasks.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v2 in this case.
+-ruby_cloud_gapic_library(
+- name = "cloudtasks_ruby_wrapper",
+- srcs = ["//google/cloud/tasks/v2:tasks_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-tasks",
+- "ruby-cloud-env-prefix=TASKS",
+- "ruby-cloud-wrapper-of=v2:0.0;v2beta2:0.0;v2beta3:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/tasks",
+- "ruby-cloud-api-id=cloudtasks.googleapis.com",
+- "ruby-cloud-api-shortname=cloudtasks",
+- "ruby-cloud-migration-version=2.0",
+- ],
+- ruby_cloud_description = "Cloud Tasks is a fully managed service that allows you to manage the execution, dispatch and delivery of a large number of distributed tasks. You can asynchronously perform work outside of a user request. Your tasks can be executed on App Engine or any arbitrary HTTP endpoint.",
+- ruby_cloud_title = "Cloud Tasks",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-tasks-ruby",
+- deps = [
+- ":cloudtasks_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/tasks/v2/BUILD.bazel b/google/cloud/tasks/v2/BUILD.bazel
+--- a/google/cloud/tasks/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/tasks/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,387 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "tasks_proto",
+- srcs = [
+- "cloudtasks.proto",
+- "queue.proto",
+- "target.proto",
+- "task.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "tasks_proto_with_info",
+- deps = [
+- ":tasks_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "tasks_java_proto",
+- deps = [":tasks_proto"],
+-)
+-
+-java_grpc_library(
+- name = "tasks_java_grpc",
+- srcs = [":tasks_proto"],
+- deps = [":tasks_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "tasks_java_gapic",
+- srcs = [":tasks_proto_with_info"],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":tasks_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":tasks_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "tasks_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.tasks.v2.CloudTasksClientHttpJsonTest",
+- "com.google.cloud.tasks.v2.CloudTasksClientTest",
+- ],
+- runtime_deps = [":tasks_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-tasks-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":tasks_java_gapic",
+- ":tasks_java_grpc",
+- ":tasks_java_proto",
+- ":tasks_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "tasks_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/tasks/v2",
+- protos = [":tasks_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "tasks_go_gapic",
+- srcs = [":tasks_proto_with_info"],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- importpath = "cloud.google.com/go/cloudtasks/apiv2;tasks",
+- rest_numeric_enums = False,
+- service_yaml = "cloudtasks_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":tasks_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "tasks_go_gapic_test",
+- srcs = [":tasks_go_gapic_srcjar_test"],
+- embed = [":tasks_go_gapic"],
+- importpath = "cloud.google.com/go/cloudtasks/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-tasks-v2-go",
+- deps = [
+- ":tasks_go_gapic",
+- ":tasks_go_gapic_srcjar-test.srcjar",
+- ":tasks_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "tasks_py_gapic",
+- srcs = [":tasks_proto"],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "tasks_py_gapic_test",
+- srcs = [
+- "tasks_py_gapic_pytest.py",
+- "tasks_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":tasks_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "tasks-v2-py",
+- deps = [
+- ":tasks_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "tasks_php_proto",
+- deps = [":tasks_proto"],
+-)
+-
+-php_grpc_library(
+- name = "tasks_php_grpc",
+- srcs = [":tasks_proto"],
+- deps = [":tasks_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "tasks_php_gapic",
+- srcs = [":tasks_proto_with_info"],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":tasks_php_grpc",
+- ":tasks_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-tasks-v2-php",
+- deps = [
+- ":tasks_php_gapic",
+- ":tasks_php_grpc",
+- ":tasks_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "tasks_nodejs_gapic",
+- package_name = "@google-cloud/tasks",
+- src = ":tasks_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- main_service = "tasks",
+- package = "google.cloud.tasks.v2",
+- rest_numeric_enums = False,
+- service_yaml = "cloudtasks_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "tasks-v2-nodejs",
+- deps = [
+- ":tasks_nodejs_gapic",
+- ":tasks_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "tasks_ruby_proto",
+- deps = [":tasks_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "tasks_ruby_grpc",
+- srcs = [":tasks_proto"],
+- deps = [":tasks_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "tasks_ruby_gapic",
+- srcs = [":tasks_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-tasks-v2",
+- "ruby-cloud-env-prefix=TASKS",
+- "ruby-cloud-product-url=https://cloud.google.com/tasks",
+- "ruby-cloud-api-id=cloudtasks.googleapis.com",
+- "ruby-cloud-api-shortname=cloudtasks",
+- ],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Tasks is a fully managed service that allows you to manage the execution, dispatch and delivery of a large number of distributed tasks. You can asynchronously perform work outside of a user request. Your tasks can be executed on App Engine or any arbitrary HTTP endpoint.",
+- ruby_cloud_title = "Cloud Tasks V2",
+- deps = [
+- ":tasks_ruby_grpc",
+- ":tasks_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-tasks-v2-ruby",
+- deps = [
+- ":tasks_ruby_gapic",
+- ":tasks_ruby_grpc",
+- ":tasks_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "tasks_csharp_proto",
+- deps = [":tasks_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "tasks_csharp_grpc",
+- srcs = [":tasks_proto"],
+- deps = [":tasks_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "tasks_csharp_gapic",
+- srcs = [":tasks_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudtasks_v2.yaml",
+- deps = [
+- ":tasks_csharp_grpc",
+- ":tasks_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-tasks-v2-csharp",
+- deps = [
+- ":tasks_csharp_gapic",
+- ":tasks_csharp_grpc",
+- ":tasks_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "tasks_cc_proto",
+- deps = [":tasks_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "tasks_cc_grpc",
+- srcs = [":tasks_proto"],
+- grpc_only = True,
+- deps = [":tasks_cc_proto"],
+-)
+diff -urN a/google/cloud/tasks/v2beta2/BUILD.bazel b/google/cloud/tasks/v2beta2/BUILD.bazel
+--- a/google/cloud/tasks/v2beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/tasks/v2beta2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,372 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "tasks_proto",
+- srcs = [
+- "cloudtasks.proto",
+- "queue.proto",
+- "target.proto",
+- "task.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "tasks_proto_with_info",
+- deps = [
+- ":tasks_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "tasks_java_proto",
+- deps = [":tasks_proto"],
+-)
+-
+-java_grpc_library(
+- name = "tasks_java_grpc",
+- srcs = [":tasks_proto"],
+- deps = [":tasks_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "tasks_java_gapic",
+- srcs = [":tasks_proto_with_info"],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":tasks_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":tasks_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "tasks_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.tasks.v2beta2.CloudTasksClientHttpJsonTest",
+- "com.google.cloud.tasks.v2beta2.CloudTasksClientTest",
+- ],
+- runtime_deps = [":tasks_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-tasks-v2beta2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":tasks_java_gapic",
+- ":tasks_java_grpc",
+- ":tasks_java_proto",
+- ":tasks_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "tasks_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta2",
+- protos = [":tasks_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "tasks_go_gapic",
+- srcs = [":tasks_proto_with_info"],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- importpath = "cloud.google.com/go/cloudtasks/apiv2beta2;tasks",
+- rest_numeric_enums = False,
+- service_yaml = "cloudtasks_v2beta2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":tasks_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "tasks_go_gapic_test",
+- srcs = [":tasks_go_gapic_srcjar_test"],
+- embed = [":tasks_go_gapic"],
+- importpath = "cloud.google.com/go/cloudtasks/apiv2beta2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-tasks-v2beta2-go",
+- deps = [
+- ":tasks_go_gapic",
+- ":tasks_go_gapic_srcjar-test.srcjar",
+- ":tasks_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "tasks_py_gapic",
+- srcs = [":tasks_proto"],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "tasks_py_gapic_test",
+- srcs = [
+- "tasks_py_gapic_pytest.py",
+- "tasks_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":tasks_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "tasks-v2beta2-py",
+- deps = [
+- ":tasks_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "tasks_php_proto",
+- deps = [":tasks_proto"],
+-)
+-
+-php_grpc_library(
+- name = "tasks_php_grpc",
+- srcs = [":tasks_proto"],
+- deps = [":tasks_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "tasks_php_gapic",
+- srcs = [":tasks_proto_with_info"],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":tasks_php_grpc",
+- ":tasks_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-tasks-v2beta2-php",
+- deps = [
+- ":tasks_php_gapic",
+- ":tasks_php_grpc",
+- ":tasks_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "tasks_nodejs_gapic",
+- package_name = "@google-cloud/tasks",
+- src = ":tasks_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- main_service = "tasks",
+- package = "google.cloud.tasks.v2beta2",
+- rest_numeric_enums = False,
+- service_yaml = "cloudtasks_v2beta2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "tasks-v2beta2-nodejs",
+- deps = [
+- ":tasks_nodejs_gapic",
+- ":tasks_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "tasks_ruby_proto",
+- deps = [":tasks_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "tasks_ruby_grpc",
+- srcs = [":tasks_proto"],
+- deps = [":tasks_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "tasks_ruby_gapic",
+- srcs = [":tasks_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-tasks-v2beta2",
+- "ruby-cloud-env-prefix=TASKS",
+- "ruby-cloud-product-url=https://cloud.google.com/tasks",
+- "ruby-cloud-api-id=cloudtasks.googleapis.com",
+- "ruby-cloud-api-shortname=cloudtasks",
+- ],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Tasks is a fully managed service that allows you to manage the execution, dispatch and delivery of a large number of distributed tasks. You can asynchronously perform work outside of a user request. Your tasks can be executed on App Engine or any arbitrary HTTP endpoint.",
+- ruby_cloud_title = "Cloud Tasks V2beta2",
+- deps = [
+- ":tasks_ruby_grpc",
+- ":tasks_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-tasks-v2beta2-ruby",
+- deps = [
+- ":tasks_ruby_gapic",
+- ":tasks_ruby_grpc",
+- ":tasks_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "tasks_csharp_proto",
+- deps = [":tasks_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "tasks_csharp_grpc",
+- srcs = [":tasks_proto"],
+- deps = [":tasks_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "tasks_csharp_gapic",
+- srcs = [":tasks_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudtasks_v2beta2.yaml",
+- deps = [
+- ":tasks_csharp_grpc",
+- ":tasks_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-tasks-v2beta2-csharp",
+- deps = [
+- ":tasks_csharp_gapic",
+- ":tasks_csharp_grpc",
+- ":tasks_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/tasks/v2beta3/BUILD.bazel b/google/cloud/tasks/v2beta3/BUILD.bazel
+--- a/google/cloud/tasks/v2beta3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/tasks/v2beta3/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,372 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "tasks_proto",
+- srcs = [
+- "cloudtasks.proto",
+- "queue.proto",
+- "target.proto",
+- "task.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "tasks_proto_with_info",
+- deps = [
+- ":tasks_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "tasks_java_proto",
+- deps = [":tasks_proto"],
+-)
+-
+-java_grpc_library(
+- name = "tasks_java_grpc",
+- srcs = [":tasks_proto"],
+- deps = [":tasks_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "tasks_java_gapic",
+- srcs = [":tasks_proto_with_info"],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":tasks_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":tasks_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "tasks_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.tasks.v2beta3.CloudTasksClientHttpJsonTest",
+- "com.google.cloud.tasks.v2beta3.CloudTasksClientTest",
+- ],
+- runtime_deps = [":tasks_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-tasks-v2beta3-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":tasks_java_gapic",
+- ":tasks_java_grpc",
+- ":tasks_java_proto",
+- ":tasks_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "tasks_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta3",
+- protos = [":tasks_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "tasks_go_gapic",
+- srcs = [":tasks_proto_with_info"],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- importpath = "cloud.google.com/go/cloudtasks/apiv2beta3;tasks",
+- rest_numeric_enums = False,
+- service_yaml = "cloudtasks_v2beta3.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":tasks_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "tasks_go_gapic_test",
+- srcs = [":tasks_go_gapic_srcjar_test"],
+- embed = [":tasks_go_gapic"],
+- importpath = "cloud.google.com/go/cloudtasks/apiv2beta3",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-tasks-v2beta3-go",
+- deps = [
+- ":tasks_go_gapic",
+- ":tasks_go_gapic_srcjar-test.srcjar",
+- ":tasks_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "tasks_py_gapic",
+- srcs = [":tasks_proto"],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "tasks_py_gapic_test",
+- srcs = [
+- "tasks_py_gapic_pytest.py",
+- "tasks_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":tasks_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "tasks-v2beta3-py",
+- deps = [
+- ":tasks_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "tasks_php_proto",
+- deps = [":tasks_proto"],
+-)
+-
+-php_grpc_library(
+- name = "tasks_php_grpc",
+- srcs = [":tasks_proto"],
+- deps = [":tasks_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "tasks_php_gapic",
+- srcs = [":tasks_proto_with_info"],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":tasks_php_grpc",
+- ":tasks_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-tasks-v2beta3-php",
+- deps = [
+- ":tasks_php_gapic",
+- ":tasks_php_grpc",
+- ":tasks_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "tasks_nodejs_gapic",
+- package_name = "@google-cloud/tasks",
+- src = ":tasks_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- main_service = "tasks",
+- package = "google.cloud.tasks.v2beta3",
+- rest_numeric_enums = False,
+- service_yaml = "cloudtasks_v2beta3.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "tasks-v2beta3-nodejs",
+- deps = [
+- ":tasks_nodejs_gapic",
+- ":tasks_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "tasks_ruby_proto",
+- deps = [":tasks_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "tasks_ruby_grpc",
+- srcs = [":tasks_proto"],
+- deps = [":tasks_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "tasks_ruby_gapic",
+- srcs = [":tasks_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-tasks-v2beta3",
+- "ruby-cloud-env-prefix=TASKS",
+- "ruby-cloud-product-url=https://cloud.google.com/tasks",
+- "ruby-cloud-api-id=cloudtasks.googleapis.com",
+- "ruby-cloud-api-shortname=cloudtasks",
+- ],
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Tasks is a fully managed service that allows you to manage the execution, dispatch and delivery of a large number of distributed tasks. You can asynchronously perform work outside of a user request. Your tasks can be executed on App Engine or any arbitrary HTTP endpoint.",
+- ruby_cloud_title = "Cloud Tasks V2beta3",
+- deps = [
+- ":tasks_ruby_grpc",
+- ":tasks_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-tasks-v2beta3-ruby",
+- deps = [
+- ":tasks_ruby_gapic",
+- ":tasks_ruby_grpc",
+- ":tasks_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "tasks_csharp_proto",
+- deps = [":tasks_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "tasks_csharp_grpc",
+- srcs = [":tasks_proto"],
+- deps = [":tasks_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "tasks_csharp_gapic",
+- srcs = [":tasks_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudtasks_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudtasks_v2beta3.yaml",
+- deps = [
+- ":tasks_csharp_grpc",
+- ":tasks_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-tasks-v2beta3-csharp",
+- deps = [
+- ":tasks_csharp_gapic",
+- ":tasks_csharp_grpc",
+- ":tasks_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/texttospeech/BUILD.bazel b/google/cloud/texttospeech/BUILD.bazel
+--- a/google/cloud/texttospeech/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/texttospeech/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-text_to_speech.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for texttospeech.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "texttospeech_ruby_wrapper",
+- srcs = ["//google/cloud/texttospeech/v1:texttospeech_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-text_to_speech",
+- "ruby-cloud-env-prefix=TEXTTOSPEECH",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/text-to-speech",
+- "ruby-cloud-api-id=texttospeech.googleapis.com",
+- "ruby-cloud-api-shortname=texttospeech",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "Text-to-Speech converts text or Speech Synthesis Markup Language (SSML) input into audio data of natural human speech.",
+- ruby_cloud_title = "Cloud Text-to-Speech",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-texttospeech-ruby",
+- deps = [
+- ":texttospeech_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/texttospeech/v1/BUILD.bazel b/google/cloud/texttospeech/v1/BUILD.bazel
+--- a/google/cloud/texttospeech/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/texttospeech/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,384 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "texttospeech_proto",
+- srcs = [
+- "cloud_tts.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "texttospeech_proto_with_info",
+- deps = [
+- ":texttospeech_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "texttospeech_java_proto",
+- deps = [":texttospeech_proto"],
+-)
+-
+-java_grpc_library(
+- name = "texttospeech_java_grpc",
+- srcs = [":texttospeech_proto"],
+- deps = [":texttospeech_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "texttospeech_java_gapic",
+- srcs = [":texttospeech_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "texttospeech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "texttospeech_v1.yaml",
+- test_deps = [
+- ":texttospeech_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":texttospeech_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "texttospeech_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.texttospeech.v1.TextToSpeechClientHttpJsonTest",
+- "com.google.cloud.texttospeech.v1.TextToSpeechClientTest",
+- ],
+- runtime_deps = [":texttospeech_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-texttospeech-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":texttospeech_java_gapic",
+- ":texttospeech_java_grpc",
+- ":texttospeech_java_proto",
+- ":texttospeech_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "texttospeech_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/texttospeech/v1",
+- protos = [":texttospeech_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "texttospeech_go_gapic",
+- srcs = [":texttospeech_proto_with_info"],
+- grpc_service_config = "texttospeech_grpc_service_config.json",
+- importpath = "cloud.google.com/go/texttospeech/apiv1;texttospeech",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "texttospeech_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":texttospeech_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "texttospeech_go_gapic_test",
+- srcs = [":texttospeech_go_gapic_srcjar_test"],
+- embed = [":texttospeech_go_gapic"],
+- importpath = "cloud.google.com/go/texttospeech/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-texttospeech-v1-go",
+- deps = [
+- ":texttospeech_go_gapic",
+- ":texttospeech_go_gapic_srcjar-metadata.srcjar",
+- ":texttospeech_go_gapic_srcjar-test.srcjar",
+- ":texttospeech_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "texttospeech_py_gapic",
+- srcs = [":texttospeech_proto"],
+- grpc_service_config = "texttospeech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "texttospeech_py_gapic_test",
+- srcs = [
+- "texttospeech_py_gapic_pytest.py",
+- "texttospeech_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":texttospeech_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "texttospeech-v1-py",
+- deps = [
+- ":texttospeech_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "texttospeech_php_proto",
+- deps = [":texttospeech_proto"],
+-)
+-
+-php_grpc_library(
+- name = "texttospeech_php_grpc",
+- srcs = [":texttospeech_proto"],
+- deps = [":texttospeech_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "texttospeech_php_gapic",
+- srcs = [":texttospeech_proto_with_info"],
+- grpc_service_config = "texttospeech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "texttospeech_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":texttospeech_php_grpc",
+- ":texttospeech_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-texttospeech-v1-php",
+- deps = [
+- ":texttospeech_php_gapic",
+- ":texttospeech_php_grpc",
+- ":texttospeech_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "texttospeech_nodejs_gapic",
+- package_name = "@google-cloud/text-to-speech",
+- src = ":texttospeech_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "texttospeech_grpc_service_config.json",
+- package = "google.cloud.texttospeech.v1",
+- rest_numeric_enums = False,
+- service_yaml = "texttospeech_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "texttospeech-v1-nodejs",
+- deps = [
+- ":texttospeech_nodejs_gapic",
+- ":texttospeech_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "texttospeech_ruby_proto",
+- deps = [":texttospeech_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "texttospeech_ruby_grpc",
+- srcs = [":texttospeech_proto"],
+- deps = [":texttospeech_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "texttospeech_ruby_gapic",
+- srcs = [":texttospeech_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=texttospeech.googleapis.com",
+- "ruby-cloud-api-shortname=texttospeech",
+- "ruby-cloud-env-prefix=TEXTTOSPEECH",
+- "ruby-cloud-gem-name=google-cloud-text_to_speech-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/text-to-speech",
+- ],
+- grpc_service_config = "texttospeech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Text-to-Speech converts text or Speech Synthesis Markup Language (SSML) input into audio data of natural human speech.",
+- ruby_cloud_title = "Cloud Text-to-Speech V1",
+- deps = [
+- ":texttospeech_ruby_grpc",
+- ":texttospeech_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-texttospeech-v1-ruby",
+- deps = [
+- ":texttospeech_ruby_gapic",
+- ":texttospeech_ruby_grpc",
+- ":texttospeech_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "texttospeech_csharp_proto",
+- deps = [":texttospeech_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "texttospeech_csharp_grpc",
+- srcs = [":texttospeech_proto"],
+- deps = [":texttospeech_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "texttospeech_csharp_gapic",
+- srcs = [":texttospeech_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "texttospeech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "texttospeech_v1.yaml",
+- deps = [
+- ":texttospeech_csharp_grpc",
+- ":texttospeech_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-texttospeech-v1-csharp",
+- deps = [
+- ":texttospeech_csharp_gapic",
+- ":texttospeech_csharp_grpc",
+- ":texttospeech_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "texttospeech_cc_proto",
+- deps = [":texttospeech_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "texttospeech_cc_grpc",
+- srcs = [":texttospeech_proto"],
+- grpc_only = True,
+- deps = [":texttospeech_cc_proto"],
+-)
+diff -urN a/google/cloud/texttospeech/v1beta1/BUILD.bazel b/google/cloud/texttospeech/v1beta1/BUILD.bazel
+--- a/google/cloud/texttospeech/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/texttospeech/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,368 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "texttospeech_proto",
+- srcs = [
+- "cloud_tts.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "texttospeech_proto_with_info",
+- deps = [
+- ":texttospeech_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "texttospeech_java_proto",
+- deps = [":texttospeech_proto"],
+-)
+-
+-java_grpc_library(
+- name = "texttospeech_java_grpc",
+- srcs = [":texttospeech_proto"],
+- deps = [":texttospeech_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "texttospeech_java_gapic",
+- srcs = [":texttospeech_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "texttospeech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "texttospeech_v1beta1.yaml",
+- test_deps = [
+- ":texttospeech_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":texttospeech_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "texttospeech_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.texttospeech.v1beta1.TextToSpeechClientHttpJsonTest",
+- "com.google.cloud.texttospeech.v1beta1.TextToSpeechClientTest",
+- ],
+- runtime_deps = [":texttospeech_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-texttospeech-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":texttospeech_java_gapic",
+- ":texttospeech_java_grpc",
+- ":texttospeech_java_proto",
+- ":texttospeech_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "texttospeech_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/texttospeech/v1beta1",
+- protos = [":texttospeech_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "texttospeech_go_gapic",
+- srcs = [":texttospeech_proto_with_info"],
+- grpc_service_config = "texttospeech_grpc_service_config.json",
+- importpath = "cloud.google.com/go/texttospeech/apiv1beta1;texttospeech",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "texttospeech_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":texttospeech_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "texttospeech_go_gapic_test",
+- srcs = [":texttospeech_go_gapic_srcjar_test"],
+- embed = [":texttospeech_go_gapic"],
+- importpath = "cloud.google.com/go/texttospeech/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-texttospeech-v1beta1-go",
+- deps = [
+- ":texttospeech_go_gapic",
+- ":texttospeech_go_gapic_srcjar-metadata.srcjar",
+- ":texttospeech_go_gapic_srcjar-test.srcjar",
+- ":texttospeech_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "texttospeech_py_gapic",
+- srcs = [":texttospeech_proto"],
+- grpc_service_config = "texttospeech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "texttospeech_py_gapic_test",
+- srcs = [
+- "texttospeech_py_gapic_pytest.py",
+- "texttospeech_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":texttospeech_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "texttospeech-v1beta1-py",
+- deps = [
+- ":texttospeech_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "texttospeech_php_proto",
+- deps = [":texttospeech_proto"],
+-)
+-
+-php_grpc_library(
+- name = "texttospeech_php_grpc",
+- srcs = [":texttospeech_proto"],
+- deps = [":texttospeech_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "texttospeech_php_gapic",
+- srcs = [":texttospeech_proto_with_info"],
+- grpc_service_config = "texttospeech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "texttospeech_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":texttospeech_php_grpc",
+- ":texttospeech_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-texttospeech-v1beta1-php",
+- deps = [
+- ":texttospeech_php_gapic",
+- ":texttospeech_php_grpc",
+- ":texttospeech_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "texttospeech_nodejs_gapic",
+- package_name = "@google-cloud/text-to-speech",
+- src = ":texttospeech_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "texttospeech_grpc_service_config.json",
+- package = "google.cloud.texttospeech.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "texttospeech_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "texttospeech-v1beta1-nodejs",
+- deps = [
+- ":texttospeech_nodejs_gapic",
+- ":texttospeech_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "texttospeech_ruby_proto",
+- deps = [":texttospeech_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "texttospeech_ruby_grpc",
+- srcs = [":texttospeech_proto"],
+- deps = [":texttospeech_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "texttospeech_ruby_gapic",
+- srcs = [":texttospeech_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=texttospeech.googleapis.com",
+- "ruby-cloud-api-shortname=texttospeech",
+- "ruby-cloud-env-prefix=TEXTTOSPEECH",
+- "ruby-cloud-gem-name=google-cloud-text_to_speech-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/text-to-speech",
+- ],
+- grpc_service_config = "texttospeech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Text-to-Speech converts text or Speech Synthesis Markup Language (SSML) input into audio data of natural human speech.",
+- ruby_cloud_title = "Cloud Text-to-Speech V1beta1",
+- deps = [
+- ":texttospeech_ruby_grpc",
+- ":texttospeech_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-texttospeech-v1beta1-ruby",
+- deps = [
+- ":texttospeech_ruby_gapic",
+- ":texttospeech_ruby_grpc",
+- ":texttospeech_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "texttospeech_csharp_proto",
+- deps = [":texttospeech_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "texttospeech_csharp_grpc",
+- srcs = [":texttospeech_proto"],
+- deps = [":texttospeech_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "texttospeech_csharp_gapic",
+- srcs = [":texttospeech_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "texttospeech_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "texttospeech_v1beta1.yaml",
+- deps = [
+- ":texttospeech_csharp_grpc",
+- ":texttospeech_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-texttospeech-v1beta1-csharp",
+- deps = [
+- ":texttospeech_csharp_gapic",
+- ":texttospeech_csharp_grpc",
+- ":texttospeech_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/timeseriesinsights/v1/BUILD.bazel b/google/cloud/timeseriesinsights/v1/BUILD.bazel
+--- a/google/cloud/timeseriesinsights/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/timeseriesinsights/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,390 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "timeseriesinsights_proto",
+- srcs = [
+- "timeseries_insights.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "timeseriesinsights_proto_with_info",
+- deps = [
+- ":timeseriesinsights_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "timeseriesinsights_java_proto",
+- deps = [":timeseriesinsights_proto"],
+-)
+-
+-java_grpc_library(
+- name = "timeseriesinsights_java_grpc",
+- srcs = [":timeseriesinsights_proto"],
+- deps = [":timeseriesinsights_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "timeseriesinsights_java_gapic",
+- srcs = [":timeseriesinsights_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "timeseries_insights_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "timeseriesinsights_v1.yaml",
+- test_deps = [
+- ":timeseriesinsights_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":timeseriesinsights_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "timeseriesinsights_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.timeseriesinsights.v1.TimeseriesInsightsControllerClientHttpJsonTest",
+- "com.google.cloud.timeseriesinsights.v1.TimeseriesInsightsControllerClientTest",
+- ],
+- runtime_deps = [":timeseriesinsights_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-timeseriesinsights-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":timeseriesinsights_java_gapic",
+- ":timeseriesinsights_java_grpc",
+- ":timeseriesinsights_java_proto",
+- ":timeseriesinsights_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "timeseriesinsights_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/timeseriesinsights/v1",
+- protos = [":timeseriesinsights_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "timeseriesinsights_go_gapic",
+- srcs = [":timeseriesinsights_proto_with_info"],
+- grpc_service_config = "timeseries_insights_grpc_service_config.json",
+- importpath = "cloud.google.com/go/timeseriesinsights/apiv1;timeseriesinsights",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "timeseriesinsights_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":timeseriesinsights_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "timeseriesinsights_go_gapic_test",
+- srcs = [":timeseriesinsights_go_gapic_srcjar_test"],
+- embed = [":timeseriesinsights_go_gapic"],
+- importpath = "cloud.google.com/go/timeseriesinsights/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-timeseriesinsights-v1-go",
+- deps = [
+- ":timeseriesinsights_go_gapic",
+- ":timeseriesinsights_go_gapic_srcjar-metadata.srcjar",
+- ":timeseriesinsights_go_gapic_srcjar-test.srcjar",
+- ":timeseriesinsights_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "timeseriesinsights_py_gapic",
+- srcs = [":timeseriesinsights_proto"],
+- grpc_service_config = "timeseries_insights_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "timeseriesinsights_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "timeseriesinsights_py_gapic_test",
+- srcs = [
+- "timeseriesinsights_py_gapic_pytest.py",
+- "timeseriesinsights_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":timeseriesinsights_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "timeseriesinsights-v1-py",
+- deps = [
+- ":timeseriesinsights_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "timeseriesinsights_php_proto",
+- deps = [":timeseriesinsights_proto"],
+-)
+-
+-php_grpc_library(
+- name = "timeseriesinsights_php_grpc",
+- srcs = [":timeseriesinsights_proto"],
+- deps = [":timeseriesinsights_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "timeseriesinsights_php_gapic",
+- srcs = [":timeseriesinsights_proto_with_info"],
+- grpc_service_config = "timeseries_insights_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "timeseriesinsights_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":timeseriesinsights_php_grpc",
+- ":timeseriesinsights_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-timeseriesinsights-v1-php",
+- deps = [
+- ":timeseriesinsights_php_gapic",
+- ":timeseriesinsights_php_grpc",
+- ":timeseriesinsights_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "timeseriesinsights_nodejs_gapic",
+- package_name = "@google-cloud/timeseriesinsights",
+- src = ":timeseriesinsights_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "timeseries_insights_grpc_service_config.json",
+- package = "google.cloud.timeseriesinsights.v1",
+- rest_numeric_enums = False,
+- service_yaml = "timeseriesinsights_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "timeseriesinsights-v1-nodejs",
+- deps = [
+- ":timeseriesinsights_nodejs_gapic",
+- ":timeseriesinsights_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "timeseriesinsights_ruby_proto",
+- deps = [":timeseriesinsights_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "timeseriesinsights_ruby_grpc",
+- srcs = [":timeseriesinsights_proto"],
+- deps = [":timeseriesinsights_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "timeseriesinsights_ruby_gapic",
+- srcs = [":timeseriesinsights_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-timeseriesinsights-v1"],
+- grpc_service_config = "timeseries_insights_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "timeseriesinsights_v1.yaml",
+- deps = [
+- ":timeseriesinsights_ruby_grpc",
+- ":timeseriesinsights_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-timeseriesinsights-v1-ruby",
+- deps = [
+- ":timeseriesinsights_ruby_gapic",
+- ":timeseriesinsights_ruby_grpc",
+- ":timeseriesinsights_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "timeseriesinsights_csharp_proto",
+- deps = [":timeseriesinsights_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "timeseriesinsights_csharp_grpc",
+- srcs = [":timeseriesinsights_proto"],
+- deps = [":timeseriesinsights_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "timeseriesinsights_csharp_gapic",
+- srcs = [":timeseriesinsights_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "timeseries_insights_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "timeseriesinsights_v1.yaml",
+- deps = [
+- ":timeseriesinsights_csharp_grpc",
+- ":timeseriesinsights_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-timeseriesinsights-v1-csharp",
+- deps = [
+- ":timeseriesinsights_csharp_gapic",
+- ":timeseriesinsights_csharp_grpc",
+- ":timeseriesinsights_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "timeseriesinsights_cc_proto",
+- deps = [":timeseriesinsights_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "timeseriesinsights_cc_grpc",
+- srcs = [":timeseriesinsights_proto"],
+- grpc_only = True,
+- deps = [":timeseriesinsights_cc_proto"],
+-)
+diff -urN a/google/cloud/tpu/BUILD.bazel b/google/cloud/tpu/BUILD.bazel
+--- a/google/cloud/tpu/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/tpu/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-tpu.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for tpu.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "tpu_ruby_wrapper",
+- srcs = ["//google/cloud/tpu/v1:tpu_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-tpu",
+- "ruby-cloud-env-prefix=CLOUD_TPU",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/tpu/",
+- "ruby-cloud-api-id=tpu.googleapis.com",
+- "ruby-cloud-api-shortname=tpu",
+- ],
+- ruby_cloud_description = "Tensor Processing Units (TPUs) are Google's custom-developed application-specific integrated circuits (ASICs) used to accelerate machine learning workloads. Cloud TPUs allow you to access TPUs from Compute Engine, Google Kubernetes Engine and AI Platform.",
+- ruby_cloud_title = "Cloud TPU",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-tpu-ruby",
+- deps = [
+- ":tpu_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/tpu/v1/BUILD.bazel b/google/cloud/tpu/v1/BUILD.bazel
+--- a/google/cloud/tpu/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/tpu/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,397 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "tpu_proto",
+- srcs = [
+- "cloud_tpu.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "tpu_proto_with_info",
+- deps = [
+- ":tpu_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "tpu_java_proto",
+- deps = [":tpu_proto"],
+-)
+-
+-java_grpc_library(
+- name = "tpu_java_grpc",
+- srcs = [":tpu_proto"],
+- deps = [":tpu_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "tpu_java_gapic",
+- srcs = [":tpu_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "tpu_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "tpu_v1.yaml",
+- test_deps = [
+- ":tpu_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":tpu_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "tpu_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.tpu.v1.TpuClientTest",
+- ],
+- runtime_deps = [":tpu_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-tpu-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":tpu_java_gapic",
+- ":tpu_java_grpc",
+- ":tpu_java_proto",
+- ":tpu_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "tpu_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/tpu/v1",
+- protos = [":tpu_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "tpu_go_gapic",
+- srcs = [":tpu_proto_with_info"],
+- grpc_service_config = "tpu_grpc_service_config.json",
+- importpath = "cloud.google.com/go/tpu/apiv1;tpu",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "tpu_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":tpu_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "tpu_go_gapic_test",
+- srcs = [":tpu_go_gapic_srcjar_test"],
+- embed = [":tpu_go_gapic"],
+- importpath = "cloud.google.com/go/tpu/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-tpu-v1-go",
+- deps = [
+- ":tpu_go_gapic",
+- ":tpu_go_gapic_srcjar-metadata.srcjar",
+- ":tpu_go_gapic_srcjar-test.srcjar",
+- ":tpu_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "tpu_py_gapic",
+- srcs = [":tpu_proto"],
+- grpc_service_config = "tpu_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "tpu_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "tpu_py_gapic_test",
+- srcs = [
+- "tpu_py_gapic_pytest.py",
+- "tpu_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":tpu_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "tpu-v1-py",
+- deps = [
+- ":tpu_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "tpu_php_proto",
+- deps = [":tpu_proto"],
+-)
+-
+-php_grpc_library(
+- name = "tpu_php_grpc",
+- srcs = [":tpu_proto"],
+- deps = [":tpu_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "tpu_php_gapic",
+- srcs = [":tpu_proto_with_info"],
+- grpc_service_config = "tpu_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "tpu_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":tpu_php_grpc",
+- ":tpu_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-tpu-v1-php",
+- deps = [
+- ":tpu_php_gapic",
+- ":tpu_php_grpc",
+- ":tpu_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "tpu_nodejs_gapic",
+- package_name = "@google-cloud/tpu",
+- src = ":tpu_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "tpu_grpc_service_config.json",
+- package = "google.cloud.tpu.v1",
+- rest_numeric_enums = False,
+- service_yaml = "tpu_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "tpu-v1-nodejs",
+- deps = [
+- ":tpu_nodejs_gapic",
+- ":tpu_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "tpu_ruby_proto",
+- deps = [":tpu_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "tpu_ruby_grpc",
+- srcs = [":tpu_proto"],
+- deps = [":tpu_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "tpu_ruby_gapic",
+- srcs = [":tpu_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=tpu.googleapis.com",
+- "ruby-cloud-api-shortname=tpu",
+- "ruby-cloud-env-prefix=CLOUD_TPU",
+- "ruby-cloud-gem-name=google-cloud-tpu-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/tpu/",
+- ],
+- grpc_service_config = "tpu_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Tensor Processing Units (TPUs) are Google's custom-developed application-specific integrated circuits (ASICs) used to accelerate machine learning workloads. Cloud TPUs allow you to access TPUs from Compute Engine, Google Kubernetes Engine and AI Platform.",
+- ruby_cloud_title = "Cloud TPU V1",
+- service_yaml = "tpu_v1.yaml",
+- deps = [
+- ":tpu_ruby_grpc",
+- ":tpu_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-tpu-v1-ruby",
+- deps = [
+- ":tpu_ruby_gapic",
+- ":tpu_ruby_grpc",
+- ":tpu_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "tpu_csharp_proto",
+- deps = [":tpu_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "tpu_csharp_grpc",
+- srcs = [":tpu_proto"],
+- deps = [":tpu_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "tpu_csharp_gapic",
+- srcs = [":tpu_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "tpu_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "tpu_v1.yaml",
+- deps = [
+- ":tpu_csharp_grpc",
+- ":tpu_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-tpu-v1-csharp",
+- deps = [
+- ":tpu_csharp_gapic",
+- ":tpu_csharp_grpc",
+- ":tpu_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "tpu_cc_proto",
+- deps = [":tpu_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "tpu_cc_grpc",
+- srcs = [":tpu_proto"],
+- grpc_only = True,
+- deps = [":tpu_cc_proto"],
+-)
+diff -urN a/google/cloud/tpu/v2alpha1/BUILD.bazel b/google/cloud/tpu/v2alpha1/BUILD.bazel
+--- a/google/cloud/tpu/v2alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/tpu/v2alpha1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,367 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "tpu_proto",
+- srcs = [
+- "cloud_tpu.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "tpu_proto_with_info",
+- deps = [
+- ":tpu_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "tpu_java_proto",
+- deps = [":tpu_proto"],
+-)
+-
+-java_grpc_library(
+- name = "tpu_java_grpc",
+- srcs = [":tpu_proto"],
+- deps = [":tpu_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "tpu_java_gapic",
+- srcs = [":tpu_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "tpu_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "tpu.yaml",
+- test_deps = [
+- ":tpu_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":tpu_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "tpu_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.tpu.v2alpha1.TpuClientTest",
+- ],
+- runtime_deps = [":tpu_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-tpu-v2alpha1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":tpu_java_gapic",
+- ":tpu_java_grpc",
+- ":tpu_java_proto",
+- ":tpu_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "tpu_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/tpu/v2alpha1",
+- protos = [":tpu_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "tpu_go_gapic",
+- srcs = [":tpu_proto_with_info"],
+- grpc_service_config = "tpu_grpc_service_config.json",
+- importpath = "cloud.google.com/go/tpu/apiv2alpha1;tpu",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "tpu.yaml",
+- deps = [
+- ":tpu_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "tpu_go_gapic_test",
+- srcs = [":tpu_go_gapic_srcjar_test"],
+- embed = [":tpu_go_gapic"],
+- importpath = "cloud.google.com/go/tpu/apiv2alpha1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-tpu-v2alpha1-go",
+- deps = [
+- ":tpu_go_gapic",
+- ":tpu_go_gapic_srcjar-metadata.srcjar",
+- ":tpu_go_gapic_srcjar-test.srcjar",
+- ":tpu_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "tpu_py_gapic",
+- srcs = [":tpu_proto"],
+- grpc_service_config = "tpu_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "tpu_py_gapic_test",
+- srcs = [
+- "tpu_py_gapic_pytest.py",
+- "tpu_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":tpu_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "tpu-v2alpha1-py",
+- deps = [
+- ":tpu_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "tpu_php_proto",
+- deps = [":tpu_proto"],
+-)
+-
+-php_grpc_library(
+- name = "tpu_php_grpc",
+- srcs = [":tpu_proto"],
+- deps = [":tpu_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "tpu_php_gapic",
+- srcs = [":tpu_proto_with_info"],
+- grpc_service_config = "tpu_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "tpu.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":tpu_php_grpc",
+- ":tpu_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-tpu-v2alpha1-php",
+- deps = [
+- ":tpu_php_gapic",
+- ":tpu_php_grpc",
+- ":tpu_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "tpu_nodejs_gapic",
+- package_name = "@google-cloud/tpu",
+- src = ":tpu_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "tpu_grpc_service_config.json",
+- package = "google.cloud.tpu.v2alpha1",
+- rest_numeric_enums = False,
+- service_yaml = "tpu.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "tpu-v2alpha1-nodejs",
+- deps = [
+- ":tpu_nodejs_gapic",
+- ":tpu_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "tpu_ruby_proto",
+- deps = [":tpu_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "tpu_ruby_grpc",
+- srcs = [":tpu_proto"],
+- deps = [":tpu_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "tpu_ruby_gapic",
+- srcs = [":tpu_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-tpu-v2alpha1",
+- ],
+- grpc_service_config = "tpu_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":tpu_ruby_grpc",
+- ":tpu_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-tpu-v2alpha1-ruby",
+- deps = [
+- ":tpu_ruby_gapic",
+- ":tpu_ruby_grpc",
+- ":tpu_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "tpu_csharp_proto",
+- deps = [":tpu_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "tpu_csharp_grpc",
+- srcs = [":tpu_proto"],
+- deps = [":tpu_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "tpu_csharp_gapic",
+- srcs = [":tpu_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "tpu_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "tpu.yaml",
+- deps = [
+- ":tpu_csharp_grpc",
+- ":tpu_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-tpu-v2alpha1-csharp",
+- deps = [
+- ":tpu_csharp_gapic",
+- ":tpu_csharp_grpc",
+- ":tpu_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/translate/BUILD.bazel b/google/cloud/translate/BUILD.bazel
+--- a/google/cloud/translate/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/translate/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-translate.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for translate.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v3 in this case.
+-ruby_cloud_gapic_library(
+- name = "translate_ruby_wrapper",
+- srcs = ["//google/cloud/translate/v3:translation_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-translate",
+- "ruby-cloud-env-prefix=TRANSLATE",
+- "ruby-cloud-wrapper-of=v3:0.0;v2:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/translate",
+- "ruby-cloud-api-id=translate.googleapis.com",
+- "ruby-cloud-api-shortname=translate",
+- "ruby-cloud-migration-version=3.0",
+- ],
+- ruby_cloud_description = "Cloud Translation can dynamically translate text between thousands of language pairs. Translation lets websites and programs programmatically integrate with the translation service.",
+- ruby_cloud_title = "Cloud Translation",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-translate-ruby",
+- deps = [
+- ":translate_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/translate/v3/BUILD.bazel b/google/cloud/translate/v3/BUILD.bazel
+--- a/google/cloud/translate/v3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/translate/v3/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,401 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "translation_proto",
+- srcs = [
+- "translation_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "translation_proto_with_info",
+- deps = [
+- ":translation_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "translation_java_proto",
+- deps = [":translation_proto"],
+-)
+-
+-java_grpc_library(
+- name = "translation_java_grpc",
+- srcs = [":translation_proto"],
+- deps = [":translation_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "translation_java_gapic",
+- srcs = [":translation_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "translate_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "translate_v3.yaml",
+- test_deps = [
+- ":translation_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":translation_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_grpc",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "translation_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.translate.v3.TranslationServiceClientHttpJsonTest",
+- "com.google.cloud.translate.v3.TranslationServiceClientTest",
+- ],
+- runtime_deps = [":translation_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-translation-v3-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":translation_java_gapic",
+- ":translation_java_grpc",
+- ":translation_java_proto",
+- ":translation_proto",
+- "//google/cloud/location:location_java_grpc",
+- "//google/cloud/location:location_java_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "translation_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/translate/v3",
+- protos = [":translation_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "translation_go_gapic",
+- srcs = [":translation_proto_with_info"],
+- grpc_service_config = "translate_grpc_service_config.json",
+- importpath = "cloud.google.com/go/translate/apiv3;translate",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "translate_v3.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":translation_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "translation_go_gapic_test",
+- srcs = [":translation_go_gapic_srcjar_test"],
+- embed = [":translation_go_gapic"],
+- importpath = "cloud.google.com/go/translate/apiv3",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-translation-v3-go",
+- deps = [
+- ":translation_go_gapic",
+- ":translation_go_gapic_srcjar-metadata.srcjar",
+- ":translation_go_gapic_srcjar-test.srcjar",
+- ":translation_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "translation_py_gapic",
+- srcs = [":translation_proto"],
+- grpc_service_config = "translate_grpc_service_config.json",
+- opt_args = ["python-gapic-name=translate"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "translation_py_gapic_test",
+- srcs = [
+- "translation_py_gapic_pytest.py",
+- "translation_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":translation_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "translation-v3-py",
+- deps = [
+- ":translation_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "translation_php_proto",
+- deps = [":translation_proto"],
+-)
+-
+-php_grpc_library(
+- name = "translation_php_grpc",
+- srcs = [":translation_proto"],
+- deps = [":translation_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "translation_php_gapic",
+- srcs = [":translation_proto_with_info"],
+- grpc_service_config = "translate_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "translate_v3.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":translation_php_grpc",
+- ":translation_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-translation-v3-php",
+- deps = [
+- ":translation_php_gapic",
+- ":translation_php_grpc",
+- ":translation_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "translation_nodejs_gapic",
+- package_name = "@google-cloud/translate",
+- src = ":translation_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "translate_grpc_service_config.json",
+- package = "google.cloud.translation.v3",
+- rest_numeric_enums = False,
+- service_yaml = "translate_v3.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "translation-v3-nodejs",
+- deps = [
+- ":translation_nodejs_gapic",
+- ":translation_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "translation_ruby_proto",
+- deps = [":translation_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "translation_ruby_grpc",
+- srcs = [":translation_proto"],
+- deps = [":translation_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "translation_ruby_gapic",
+- srcs = [":translation_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=translate.googleapis.com",
+- "ruby-cloud-api-shortname=translate",
+- "ruby-cloud-env-prefix=TRANSLATE",
+- "ruby-cloud-gem-name=google-cloud-translate-v3",
+- "ruby-cloud-product-url=https://cloud.google.com/translate",
+- ],
+- grpc_service_config = "translate_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Translation can dynamically translate text between thousands of language pairs. Translation lets websites and programs programmatically integrate with the translation service.",
+- ruby_cloud_title = "Cloud Translation V3",
+- deps = [
+- ":translation_ruby_grpc",
+- ":translation_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-translation-v3-ruby",
+- deps = [
+- ":translation_ruby_gapic",
+- ":translation_ruby_grpc",
+- ":translation_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "translation_csharp_proto",
+- deps = [":translation_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "translation_csharp_grpc",
+- srcs = [":translation_proto"],
+- deps = [":translation_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "translation_csharp_gapic",
+- srcs = [":translation_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "translate_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "translate_v3.yaml",
+- deps = [
+- ":translation_csharp_grpc",
+- ":translation_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-translation-v3-csharp",
+- deps = [
+- ":translation_csharp_gapic",
+- ":translation_csharp_grpc",
+- ":translation_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "translation_cc_proto",
+- deps = [":translation_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "translation_cc_grpc",
+- srcs = [":translation_proto"],
+- grpc_only = True,
+- deps = [":translation_cc_proto"],
+-)
+diff -urN a/google/cloud/translate/v3beta1/BUILD.bazel b/google/cloud/translate/v3beta1/BUILD.bazel
+--- a/google/cloud/translate/v3beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/translate/v3beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,376 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "translation_proto",
+- srcs = [
+- "translation_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "translation_proto_with_info",
+- deps = [
+- ":translation_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "translation_java_proto",
+- deps = [":translation_proto"],
+-)
+-
+-java_grpc_library(
+- name = "translation_java_grpc",
+- srcs = [":translation_proto"],
+- deps = [":translation_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "translation_java_gapic",
+- srcs = [":translation_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "translate_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "translate_v3beta1.yaml",
+- test_deps = [
+- ":translation_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":translation_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_grpc",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "translation_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.translate.v3beta1.TranslationServiceClientHttpJsonTest",
+- "com.google.cloud.translate.v3beta1.TranslationServiceClientTest",
+- ],
+- runtime_deps = [":translation_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-translation-v3beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":translation_java_gapic",
+- ":translation_java_grpc",
+- ":translation_java_proto",
+- ":translation_proto",
+- "//google/cloud/location:location_java_grpc",
+- "//google/cloud/location:location_java_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "translation_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/translate/v3beta1",
+- protos = [":translation_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "translation_go_gapic",
+- srcs = [":translation_proto_with_info"],
+- grpc_service_config = "translate_grpc_service_config.json",
+- importpath = "cloud.google.com/go/translate/apiv3beta1;translate",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "translate_v3beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":translation_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "translation_go_gapic_test",
+- srcs = [":translation_go_gapic_srcjar_test"],
+- embed = [":translation_go_gapic"],
+- importpath = "cloud.google.com/go/translate/apiv3beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-translation-v3beta1-go",
+- deps = [
+- ":translation_go_gapic",
+- ":translation_go_gapic_srcjar-metadata.srcjar",
+- ":translation_go_gapic_srcjar-test.srcjar",
+- ":translation_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "translation_py_gapic",
+- srcs = [":translation_proto"],
+- grpc_service_config = "translate_grpc_service_config.json",
+- opt_args = ["python-gapic-name=translate"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "translation_py_gapic_test",
+- srcs = [
+- "translation_py_gapic_pytest.py",
+- "translation_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":translation_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "translation-v3beta1-py",
+- deps = [
+- ":translation_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "translation_php_proto",
+- deps = [":translation_proto"],
+-)
+-
+-php_grpc_library(
+- name = "translation_php_grpc",
+- srcs = [":translation_proto"],
+- deps = [":translation_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "translation_php_gapic",
+- srcs = [":translation_proto_with_info"],
+- grpc_service_config = "translate_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "translate_v3beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":translation_php_grpc",
+- ":translation_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-translation-v3beta1-php",
+- deps = [
+- ":translation_php_gapic",
+- ":translation_php_grpc",
+- ":translation_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "translation_nodejs_gapic",
+- package_name = "@google-cloud/translate",
+- src = ":translation_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "translate_grpc_service_config.json",
+- package = "google.cloud.translation.v3beta1",
+- rest_numeric_enums = False,
+- service_yaml = "translate_v3beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "translation-v3beta1-nodejs",
+- deps = [
+- ":translation_nodejs_gapic",
+- ":translation_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "translation_ruby_proto",
+- deps = [":translation_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "translation_ruby_grpc",
+- srcs = [":translation_proto"],
+- deps = [":translation_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "translation_ruby_gapic",
+- srcs = [":translation_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-translation-v3beta1"],
+- grpc_service_config = "translate_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":translation_ruby_grpc",
+- ":translation_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-translation-v3beta1-ruby",
+- deps = [
+- ":translation_ruby_gapic",
+- ":translation_ruby_grpc",
+- ":translation_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "translation_csharp_proto",
+- deps = [":translation_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "translation_csharp_grpc",
+- srcs = [":translation_proto"],
+- deps = [":translation_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "translation_csharp_gapic",
+- srcs = [":translation_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "translate_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "translate_v3beta1.yaml",
+- deps = [
+- ":translation_csharp_grpc",
+- ":translation_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-translation-v3beta1-csharp",
+- deps = [
+- ":translation_csharp_gapic",
+- ":translation_csharp_grpc",
+- ":translation_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/video/livestream/BUILD.bazel b/google/cloud/video/livestream/BUILD.bazel
+--- a/google/cloud/video/livestream/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/video/livestream/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-video-live_stream.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for livestream.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "livestream_ruby_wrapper",
+- srcs = ["//google/cloud/video/livestream/v1:livestream_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-video-live_stream",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/livestream/",
+- "ruby-cloud-api-id=livestream.googleapis.com",
+- "ruby-cloud-api-shortname=livestream",
+- ],
+- ruby_cloud_description = "The Live Stream API transcodes mezzanine live signals into direct-to-consumer streaming formats, including Dynamic Adaptive Streaming over HTTP (DASH/MPEG-DASH), and HTTP Live Streaming (HLS), for multiple device platforms.",
+- ruby_cloud_title = "Live Stream",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-video-livestream-ruby",
+- deps = [
+- ":livestream_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/video/livestream/logging/v1/BUILD.bazel b/google/cloud/video/livestream/logging/v1/BUILD.bazel
+--- a/google/cloud/video/livestream/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/video/livestream/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,179 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "logs.proto",
+- ],
+- deps = [
+- "//google/cloud/video/livestream/v1:livestream_proto",
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/video/livestream/logging/v1",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/cloud/video/livestream/v1:livestream_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "//google/cloud/video/livestream/v1:livestream_proto",
+- "//google/rpc:status_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/cloud/video/livestream/v1/BUILD.bazel b/google/cloud/video/livestream/v1/BUILD.bazel
+--- a/google/cloud/video/livestream/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/video/livestream/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,402 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "livestream_proto",
+- srcs = [
+- "outputs.proto",
+- "resources.proto",
+- "service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "livestream_proto_with_info",
+- deps = [
+- ":livestream_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "livestream_java_proto",
+- deps = [":livestream_proto"],
+-)
+-
+-java_grpc_library(
+- name = "livestream_java_grpc",
+- srcs = [":livestream_proto"],
+- deps = [":livestream_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "livestream_java_gapic",
+- srcs = [":livestream_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "livestream_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "livestream_v1.yaml",
+- test_deps = [
+- ":livestream_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":livestream_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "livestream_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.video.livestream.v1.LivestreamServiceClientHttpJsonTest",
+- "com.google.cloud.video.livestream.v1.LivestreamServiceClientTest",
+- ],
+- runtime_deps = [":livestream_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-video-livestream-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":livestream_java_gapic",
+- ":livestream_java_grpc",
+- ":livestream_java_proto",
+- ":livestream_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "livestream_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/video/livestream/v1",
+- protos = [":livestream_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "livestream_go_gapic",
+- srcs = [":livestream_proto_with_info"],
+- grpc_service_config = "livestream_grpc_service_config.json",
+- importpath = "cloud.google.com/go/video/livestream/apiv1;livestream",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "livestream_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":livestream_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "livestream_go_gapic_test",
+- srcs = [":livestream_go_gapic_srcjar_test"],
+- embed = [":livestream_go_gapic"],
+- importpath = "cloud.google.com/go/video/livestream/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-video-livestream-v1-go",
+- deps = [
+- ":livestream_go_gapic",
+- ":livestream_go_gapic_srcjar-metadata.srcjar",
+- ":livestream_go_gapic_srcjar-test.srcjar",
+- ":livestream_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "livestream_py_gapic",
+- srcs = [":livestream_proto"],
+- grpc_service_config = "livestream_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-video-live-stream",
+- "python-gapic-namespace=google.cloud.video",
+- "python-gapic-name=live_stream",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "livestream_py_gapic_test",
+- srcs = [
+- "livestream_py_gapic_pytest.py",
+- "livestream_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":livestream_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "video-livestream-v1-py",
+- deps = [
+- ":livestream_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "livestream_php_proto",
+- deps = [":livestream_proto"],
+-)
+-
+-php_grpc_library(
+- name = "livestream_php_grpc",
+- srcs = [":livestream_proto"],
+- deps = [":livestream_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "livestream_php_gapic",
+- srcs = [":livestream_proto_with_info"],
+- grpc_service_config = "livestream_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "livestream_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":livestream_php_grpc",
+- ":livestream_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-video-livestream-v1-php",
+- deps = [
+- ":livestream_php_gapic",
+- ":livestream_php_grpc",
+- ":livestream_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "livestream_nodejs_gapic",
+- package_name = "@google-cloud/livestream",
+- src = ":livestream_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "livestream_grpc_service_config.json",
+- package = "google.cloud.video.livestream.v1",
+- rest_numeric_enums = False,
+- service_yaml = "livestream_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "video-livestream-v1-nodejs",
+- deps = [
+- ":livestream_nodejs_gapic",
+- ":livestream_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "livestream_ruby_proto",
+- deps = [":livestream_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "livestream_ruby_grpc",
+- srcs = [":livestream_proto"],
+- deps = [":livestream_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "livestream_ruby_gapic",
+- srcs = [":livestream_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=livestream.googleapis.com",
+- "ruby-cloud-api-shortname=livestream",
+- "ruby-cloud-gem-name=google-cloud-video-live_stream-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/livestream/",
+- ],
+- grpc_service_config = "livestream_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Live Stream API transcodes mezzanine live signals into direct-to-consumer streaming formats, including Dynamic Adaptive Streaming over HTTP (DASH/MPEG-DASH), and HTTP Live Streaming (HLS), for multiple device platforms.",
+- ruby_cloud_title = "Live Stream V1",
+- deps = [
+- ":livestream_ruby_grpc",
+- ":livestream_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-video-livestream-v1-ruby",
+- deps = [
+- ":livestream_ruby_gapic",
+- ":livestream_ruby_grpc",
+- ":livestream_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "livestream_csharp_proto",
+- deps = [":livestream_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "livestream_csharp_grpc",
+- srcs = [":livestream_proto"],
+- deps = [":livestream_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "livestream_csharp_gapic",
+- srcs = [":livestream_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "livestream_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "livestream_v1.yaml",
+- deps = [
+- ":livestream_csharp_grpc",
+- ":livestream_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-video-livestream-v1-csharp",
+- deps = [
+- ":livestream_csharp_gapic",
+- ":livestream_csharp_grpc",
+- ":livestream_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "livestream_cc_proto",
+- deps = [":livestream_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "livestream_cc_grpc",
+- srcs = [":livestream_proto"],
+- grpc_only = True,
+- deps = [":livestream_cc_proto"],
+-)
+diff -urN a/google/cloud/video/stitcher/BUILD.bazel b/google/cloud/video/stitcher/BUILD.bazel
+--- a/google/cloud/video/stitcher/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/video/stitcher/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-video-stitcher.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for videostitcher.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "stitcher_ruby_wrapper",
+- srcs = ["//google/cloud/video/stitcher/v1:stitcher_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-video-stitcher",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/video-stitcher/",
+- "ruby-cloud-api-id=videostitcher.googleapis.com",
+- "ruby-cloud-api-shortname=videostitcher",
+- ],
+- ruby_cloud_description = "The Video Stitcher API allows you to manipulate video content to dynamically insert ads prior to delivery to client devices. Using the Video Stitcher API, you can monetize your video-on-demand (VOD) and livestreaming videos by inserting ads as described by metadata stored on ad servers.",
+- ruby_cloud_title = "Video Stitcher",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-video-stitcher-ruby",
+- deps = [
+- ":stitcher_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/video/stitcher/v1/BUILD.bazel b/google/cloud/video/stitcher/v1/BUILD.bazel
+--- a/google/cloud/video/stitcher/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/video/stitcher/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,394 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "stitcher_proto",
+- srcs = [
+- "ad_tag_details.proto",
+- "cdn_keys.proto",
+- "companions.proto",
+- "events.proto",
+- "sessions.proto",
+- "slates.proto",
+- "stitch_details.proto",
+- "video_stitcher_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "stitcher_proto_with_info",
+- deps = [
+- ":stitcher_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "stitcher_java_proto",
+- deps = [":stitcher_proto"],
+-)
+-
+-java_grpc_library(
+- name = "stitcher_java_grpc",
+- srcs = [":stitcher_proto"],
+- deps = [":stitcher_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "stitcher_java_gapic",
+- srcs = [":stitcher_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "videostitcher_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "videostitcher_v1.yaml",
+- test_deps = [
+- ":stitcher_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":stitcher_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "stitcher_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.video.stitcher.v1.VideoStitcherServiceClientTest",
+- ],
+- runtime_deps = [":stitcher_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-video-stitcher-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":stitcher_java_gapic",
+- ":stitcher_java_grpc",
+- ":stitcher_java_proto",
+- ":stitcher_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "stitcher_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/video/stitcher/v1",
+- protos = [":stitcher_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "stitcher_go_gapic",
+- srcs = [":stitcher_proto_with_info"],
+- grpc_service_config = "videostitcher_grpc_service_config.json",
+- importpath = "cloud.google.com/go/video/stitcher/apiv1;stitcher",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "videostitcher_v1.yaml",
+- deps = [
+- ":stitcher_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "stitcher_go_gapic_test",
+- srcs = [":stitcher_go_gapic_srcjar_test"],
+- embed = [":stitcher_go_gapic"],
+- importpath = "cloud.google.com/go/video/stitcher/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-video-stitcher-v1-go",
+- deps = [
+- ":stitcher_go_gapic",
+- ":stitcher_go_gapic_srcjar-metadata.srcjar",
+- ":stitcher_go_gapic_srcjar-test.srcjar",
+- ":stitcher_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "stitcher_py_gapic",
+- srcs = [":stitcher_proto"],
+- grpc_service_config = "videostitcher_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "videostitcher_v1.yaml",
+- transport = "grpc+rest",
+-)
+-
+-py_test(
+- name = "stitcher_py_gapic_test",
+- srcs = [
+- "stitcher_py_gapic_pytest.py",
+- "stitcher_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":stitcher_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "video-stitcher-v1-py",
+- deps = [
+- ":stitcher_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "stitcher_php_proto",
+- deps = [":stitcher_proto"],
+-)
+-
+-php_grpc_library(
+- name = "stitcher_php_grpc",
+- srcs = [":stitcher_proto"],
+- deps = [":stitcher_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "stitcher_php_gapic",
+- srcs = [":stitcher_proto_with_info"],
+- grpc_service_config = "videostitcher_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "videostitcher_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":stitcher_php_grpc",
+- ":stitcher_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-video-stitcher-v1-php",
+- deps = [
+- ":stitcher_php_gapic",
+- ":stitcher_php_grpc",
+- ":stitcher_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "stitcher_nodejs_gapic",
+- package_name = "@google-cloud/video-stitcher",
+- src = ":stitcher_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "videostitcher_grpc_service_config.json",
+- package = "google.cloud.video.stitcher.v1",
+- rest_numeric_enums = False,
+- service_yaml = "videostitcher_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "video-stitcher-v1-nodejs",
+- deps = [
+- ":stitcher_nodejs_gapic",
+- ":stitcher_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "stitcher_ruby_proto",
+- deps = [":stitcher_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "stitcher_ruby_grpc",
+- srcs = [":stitcher_proto"],
+- deps = [":stitcher_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "stitcher_ruby_gapic",
+- srcs = [":stitcher_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=videostitcher.googleapis.com",
+- "ruby-cloud-api-shortname=videostitcher",
+- "ruby-cloud-gem-name=google-cloud-video-stitcher-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/video-stitcher/",
+- ],
+- grpc_service_config = "videostitcher_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Video Stitcher API allows you to manipulate video content to dynamically insert ads prior to delivery to client devices. Using the Video Stitcher API, you can monetize your video-on-demand (VOD) and livestreaming videos by inserting ads as described by metadata stored on ad servers.",
+- ruby_cloud_title = "Video Stitcher V1",
+- deps = [
+- ":stitcher_ruby_grpc",
+- ":stitcher_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-video-stitcher-v1-ruby",
+- deps = [
+- ":stitcher_ruby_gapic",
+- ":stitcher_ruby_grpc",
+- ":stitcher_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "stitcher_csharp_proto",
+- deps = [":stitcher_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "stitcher_csharp_grpc",
+- srcs = [":stitcher_proto"],
+- deps = [":stitcher_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "stitcher_csharp_gapic",
+- srcs = [":stitcher_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "videostitcher_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "videostitcher_v1.yaml",
+- deps = [
+- ":stitcher_csharp_grpc",
+- ":stitcher_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-video-stitcher-v1-csharp",
+- deps = [
+- ":stitcher_csharp_gapic",
+- ":stitcher_csharp_grpc",
+- ":stitcher_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "stitcher_cc_proto",
+- deps = [":stitcher_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "stitcher_cc_grpc",
+- srcs = [":stitcher_proto"],
+- grpc_only = True,
+- deps = [":stitcher_cc_proto"],
+-)
+diff -urN a/google/cloud/video/transcoder/BUILD.bazel b/google/cloud/video/transcoder/BUILD.bazel
+--- a/google/cloud/video/transcoder/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/video/transcoder/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-video-transcoder.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for transcoder.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "transcoder_ruby_wrapper",
+- srcs = ["//google/cloud/video/transcoder/v1:transcoder_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-video-transcoder",
+- "ruby-cloud-env-prefix=TRANSCODER",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/transcoder/",
+- "ruby-cloud-api-id=transcoder.googleapis.com",
+- "ruby-cloud-api-shortname=transcoder",
+- ],
+- ruby_cloud_description = "The Transcoder API allows you to convert video files and package them for optimized delivery to web, mobile and connected TVs.",
+- ruby_cloud_title = "Transcoder",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-video-transcoder-ruby",
+- deps = [
+- ":transcoder_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/video/transcoder/v1/BUILD.bazel b/google/cloud/video/transcoder/v1/BUILD.bazel
+--- a/google/cloud/video/transcoder/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/video/transcoder/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,388 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "transcoder_proto",
+- srcs = [
+- "resources.proto",
+- "services.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "transcoder_proto_with_info",
+- deps = [
+- ":transcoder_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "transcoder_java_proto",
+- deps = [":transcoder_proto"],
+-)
+-
+-java_grpc_library(
+- name = "transcoder_java_grpc",
+- srcs = [":transcoder_proto"],
+- deps = [":transcoder_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "transcoder_java_gapic",
+- srcs = [":transcoder_proto_with_info"],
+- grpc_service_config = "transcoder_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":transcoder_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":transcoder_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "transcoder_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.video.transcoder.v1.TranscoderServiceClientHttpJsonTest",
+- "com.google.cloud.video.transcoder.v1.TranscoderServiceClientTest",
+- ],
+- runtime_deps = [":transcoder_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-video-transcoder-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":transcoder_java_gapic",
+- ":transcoder_java_grpc",
+- ":transcoder_java_proto",
+- ":transcoder_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "transcoder_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1",
+- protos = [":transcoder_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "transcoder_go_gapic",
+- srcs = [":transcoder_proto_with_info"],
+- grpc_service_config = "transcoder_grpc_service_config.json",
+- importpath = "cloud.google.com/go/video/transcoder/apiv1;transcoder",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "transcoder_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":transcoder_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "transcoder_go_gapic_test",
+- srcs = [":transcoder_go_gapic_srcjar_test"],
+- embed = [":transcoder_go_gapic"],
+- importpath = "cloud.google.com/go/video/transcoder/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-video-transcoder-v1-go",
+- deps = [
+- ":transcoder_go_gapic",
+- ":transcoder_go_gapic_srcjar-metadata.srcjar",
+- ":transcoder_go_gapic_srcjar-test.srcjar",
+- ":transcoder_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "transcoder_py_gapic",
+- srcs = [":transcoder_proto"],
+- grpc_service_config = "transcoder_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "transcoder_py_gapic_test",
+- srcs = [
+- "transcoder_py_gapic_pytest.py",
+- "transcoder_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":transcoder_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "video-transcoder-v1-py",
+- deps = [
+- ":transcoder_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "transcoder_php_proto",
+- deps = [":transcoder_proto"],
+-)
+-
+-php_grpc_library(
+- name = "transcoder_php_grpc",
+- srcs = [":transcoder_proto"],
+- deps = [":transcoder_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "transcoder_php_gapic",
+- srcs = [":transcoder_proto_with_info"],
+- grpc_service_config = "transcoder_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "transcoder_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":transcoder_php_grpc",
+- ":transcoder_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-video-transcoder-v1-php",
+- deps = [
+- ":transcoder_php_gapic",
+- ":transcoder_php_grpc",
+- ":transcoder_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "transcoder_nodejs_gapic",
+- package_name = "@google-cloud/video-transcoder",
+- src = ":transcoder_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "transcoder_grpc_service_config.json",
+- package = "google.cloud.video.transcoder.v1",
+- rest_numeric_enums = False,
+- service_yaml = "transcoder_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "video-transcoder-v1-nodejs",
+- deps = [
+- ":transcoder_nodejs_gapic",
+- ":transcoder_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "transcoder_ruby_proto",
+- deps = [":transcoder_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "transcoder_ruby_grpc",
+- srcs = [":transcoder_proto"],
+- deps = [":transcoder_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "transcoder_ruby_gapic",
+- srcs = [":transcoder_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=transcoder.googleapis.com",
+- "ruby-cloud-api-shortname=transcoder",
+- "ruby-cloud-env-prefix=TRANSCODER",
+- "ruby-cloud-gem-name=google-cloud-video-transcoder-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/transcoder/",
+- ],
+- grpc_service_config = "transcoder_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Transcoder API allows you to convert video files and package them for optimized delivery to web, mobile and connected TVs.",
+- ruby_cloud_title = "Transcoder V1",
+- deps = [
+- ":transcoder_ruby_grpc",
+- ":transcoder_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-video-transcoder-v1-ruby",
+- deps = [
+- ":transcoder_ruby_gapic",
+- ":transcoder_ruby_grpc",
+- ":transcoder_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "transcoder_csharp_proto",
+- deps = [":transcoder_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "transcoder_csharp_grpc",
+- srcs = [":transcoder_proto"],
+- deps = [":transcoder_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "transcoder_csharp_gapic",
+- srcs = [":transcoder_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "transcoder_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "transcoder_v1.yaml",
+- deps = [
+- ":transcoder_csharp_grpc",
+- ":transcoder_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-video-transcoder-v1-csharp",
+- deps = [
+- ":transcoder_csharp_gapic",
+- ":transcoder_csharp_grpc",
+- ":transcoder_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "transcoder_cc_proto",
+- deps = [":transcoder_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "transcoder_cc_grpc",
+- srcs = [":transcoder_proto"],
+- grpc_only = True,
+- deps = [":transcoder_cc_proto"],
+-)
+diff -urN a/google/cloud/videointelligence/BUILD.bazel b/google/cloud/videointelligence/BUILD.bazel
+--- a/google/cloud/videointelligence/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/videointelligence/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-video_intelligence.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for videointelligence.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "videointelligence_ruby_wrapper",
+- srcs = ["//google/cloud/videointelligence/v1:videointelligence_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-video_intelligence",
+- "ruby-cloud-env-prefix=VIDEO_INTELLIGENCE",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta2:0.0;v1p1beta1:0.0;v1p2beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/video-intelligence",
+- "ruby-cloud-api-id=videointelligence.googleapis.com",
+- "ruby-cloud-api-shortname=videointelligence",
+- "ruby-cloud-migration-version=3.0",
+- ],
+- ruby_cloud_description = "Detects objects, explicit content, and scene changes in videos. It also specifies the region for annotation and transcribes speech to text. Supports both asynchronous API and streaming API.",
+- ruby_cloud_title = "Cloud Video Intelligence",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-ruby",
+- deps = [
+- ":videointelligence_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/videointelligence/v1/BUILD.bazel b/google/cloud/videointelligence/v1/BUILD.bazel
+--- a/google/cloud/videointelligence/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/videointelligence/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,381 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "videointelligence_proto",
+- srcs = [
+- "video_intelligence.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "videointelligence_proto_with_info",
+- deps = [
+- ":videointelligence_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "videointelligence_java_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-java_grpc_library(
+- name = "videointelligence_java_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "videointelligence_java_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- gapic_yaml = "videointelligence_gapic.yaml",
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":videointelligence_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "videointelligence_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClientHttpJsonTest",
+- "com.google.cloud.videointelligence.v1.VideoIntelligenceServiceClientTest",
+- ],
+- runtime_deps = [":videointelligence_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-videointelligence-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_java_gapic",
+- ":videointelligence_java_grpc",
+- ":videointelligence_java_proto",
+- ":videointelligence_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "videointelligence_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1",
+- protos = [":videointelligence_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "videointelligence_go_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- importpath = "cloud.google.com/go/videointelligence/apiv1;videointelligence",
+- rest_numeric_enums = False,
+- service_yaml = "videointelligence_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "videointelligence_go_gapic_test",
+- srcs = [":videointelligence_go_gapic_srcjar_test"],
+- embed = [":videointelligence_go_gapic"],
+- importpath = "cloud.google.com/go/videointelligence/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-videointelligence-v1-go",
+- deps = [
+- ":videointelligence_go_gapic",
+- ":videointelligence_go_gapic_srcjar-test.srcjar",
+- ":videointelligence_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "videointelligence_py_gapic",
+- srcs = [":videointelligence_proto"],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "videointelligence_py_gapic_test",
+- srcs = [
+- "videointelligence_py_gapic_pytest.py",
+- "videointelligence_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":videointelligence_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "videointelligence-v1-py",
+- deps = [
+- ":videointelligence_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "videointelligence_php_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-php_grpc_library(
+- name = "videointelligence_php_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "videointelligence_php_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- # Do not change this to the videointelligence_gapic.yaml, see tracking bug.
+- gapic_yaml = "videointelligence_gapic.legacy.yaml",
+- rest_numeric_enums = False,
+- service_yaml = "videointelligence_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_php_grpc",
+- ":videointelligence_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-v1-php",
+- deps = [
+- ":videointelligence_php_gapic",
+- ":videointelligence_php_grpc",
+- ":videointelligence_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "videointelligence_nodejs_gapic",
+- package_name = "@google-cloud/video-intelligence",
+- src = ":videointelligence_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- main_service = "videointelligence",
+- package = "google.cloud.videointelligence.v1",
+- rest_numeric_enums = False,
+- service_yaml = "videointelligence_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "videointelligence-v1-nodejs",
+- deps = [
+- ":videointelligence_nodejs_gapic",
+- ":videointelligence_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "videointelligence_ruby_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "videointelligence_ruby_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "videointelligence_ruby_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-video_intelligence-v1",
+- "ruby-cloud-env-prefix=VIDEO_INTELLIGENCE",
+- "ruby-cloud-product-url=https://cloud.google.com/video-intelligence",
+- "ruby-cloud-api-id=videointelligence.googleapis.com",
+- "ruby-cloud-api-shortname=videointelligence",
+- ],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Detects objects, explicit content, and scene changes in videos. It also specifies the region for annotation and transcribes speech to text. Supports both asynchronous API and streaming API.",
+- ruby_cloud_title = "Cloud Video Intelligence V1",
+- deps = [
+- ":videointelligence_ruby_grpc",
+- ":videointelligence_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-v1-ruby",
+- deps = [
+- ":videointelligence_ruby_gapic",
+- ":videointelligence_ruby_grpc",
+- ":videointelligence_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "videointelligence_csharp_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "videointelligence_csharp_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "videointelligence_csharp_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "videointelligence_v1.yaml",
+- deps = [
+- ":videointelligence_csharp_grpc",
+- ":videointelligence_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-v1-csharp",
+- deps = [
+- ":videointelligence_csharp_gapic",
+- ":videointelligence_csharp_grpc",
+- ":videointelligence_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "videointelligence_cc_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "videointelligence_cc_grpc",
+- srcs = [":videointelligence_proto"],
+- grpc_only = True,
+- deps = [":videointelligence_cc_proto"],
+-)
+diff -urN a/google/cloud/videointelligence/v1beta2/BUILD.bazel b/google/cloud/videointelligence/v1beta2/BUILD.bazel
+--- a/google/cloud/videointelligence/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/videointelligence/v1beta2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,363 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "videointelligence_proto",
+- srcs = [
+- "video_intelligence.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "videointelligence_proto_with_info",
+- deps = [
+- ":videointelligence_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "videointelligence_java_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-java_grpc_library(
+- name = "videointelligence_java_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "videointelligence_java_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- gapic_yaml = "videointelligence_gapic.yaml",
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":videointelligence_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "videointelligence_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.videointelligence.v1beta2.VideoIntelligenceServiceClientHttpJsonTest",
+- "com.google.cloud.videointelligence.v1beta2.VideoIntelligenceServiceClientTest",
+- ],
+- runtime_deps = [":videointelligence_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-videointelligence-v1beta2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_java_gapic",
+- ":videointelligence_java_grpc",
+- ":videointelligence_java_proto",
+- ":videointelligence_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "videointelligence_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta2",
+- protos = [":videointelligence_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "videointelligence_go_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- importpath = "cloud.google.com/go/videointelligence/apiv1beta2;videointelligence",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/videointelligence:videointelligence_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "videointelligence_go_gapic_test",
+- srcs = [":videointelligence_go_gapic_srcjar_test"],
+- embed = [":videointelligence_go_gapic"],
+- importpath = "cloud.google.com/go/videointelligence/apiv1beta2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-videointelligence-v1beta2-go",
+- deps = [
+- ":videointelligence_go_gapic",
+- ":videointelligence_go_gapic_srcjar-test.srcjar",
+- ":videointelligence_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "videointelligence_py_gapic",
+- srcs = [":videointelligence_proto"],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "videointelligence_py_gapic_test",
+- srcs = [
+- "videointelligence_py_gapic_pytest.py",
+- "videointelligence_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":videointelligence_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "videointelligence-v1beta2-py",
+- deps = [
+- ":videointelligence_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "videointelligence_php_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-php_grpc_library(
+- name = "videointelligence_php_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "videointelligence_php_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- gapic_yaml = "videointelligence_gapic.yaml",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/videointelligence:videointelligence_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_php_grpc",
+- ":videointelligence_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-v1beta2-php",
+- deps = [
+- ":videointelligence_php_gapic",
+- ":videointelligence_php_grpc",
+- ":videointelligence_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "videointelligence_nodejs_gapic",
+- package_name = "@google-cloud/video-intelligence",
+- src = ":videointelligence_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- main_service = "videointelligence",
+- package = "google.cloud.videointelligence.v1beta2",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/videointelligence:videointelligence_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "videointelligence-v1beta2-nodejs",
+- deps = [
+- ":videointelligence_nodejs_gapic",
+- ":videointelligence_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "videointelligence_ruby_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "videointelligence_ruby_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "videointelligence_ruby_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-video_intelligence-v1beta2",
+- "ruby-cloud-env-prefix=VIDEO_INTELLIGENCE",
+- "ruby-cloud-product-url=https://cloud.google.com/video-intelligence",
+- "ruby-cloud-api-id=videointelligence.googleapis.com",
+- "ruby-cloud-api-shortname=videointelligence",
+- ],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Detects objects, explicit content, and scene changes in videos. It also specifies the region for annotation and transcribes speech to text. Supports both asynchronous API and streaming API.",
+- ruby_cloud_title = "Cloud Video Intelligence V1beta2",
+- deps = [
+- ":videointelligence_ruby_grpc",
+- ":videointelligence_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-v1beta2-ruby",
+- deps = [
+- ":videointelligence_ruby_gapic",
+- ":videointelligence_ruby_grpc",
+- ":videointelligence_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "videointelligence_csharp_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "videointelligence_csharp_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "videointelligence_csharp_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":videointelligence_csharp_grpc",
+- ":videointelligence_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-v1beta2-csharp",
+- deps = [
+- ":videointelligence_csharp_gapic",
+- ":videointelligence_csharp_grpc",
+- ":videointelligence_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/videointelligence/v1p1beta1/BUILD.bazel b/google/cloud/videointelligence/v1p1beta1/BUILD.bazel
+--- a/google/cloud/videointelligence/v1p1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/videointelligence/v1p1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,365 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "videointelligence_proto",
+- srcs = [
+- "video_intelligence.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "videointelligence_proto_with_info",
+- deps = [
+- ":videointelligence_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "videointelligence_java_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-java_grpc_library(
+- name = "videointelligence_java_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "videointelligence_java_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- gapic_yaml = "videointelligence_gapic.yaml",
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":videointelligence_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "videointelligence_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.videointelligence.v1p1beta1.VideoIntelligenceServiceClientHttpJsonTest",
+- "com.google.cloud.videointelligence.v1p1beta1.VideoIntelligenceServiceClientTest",
+- ],
+- runtime_deps = [":videointelligence_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-videointelligence-v1p1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_java_gapic",
+- ":videointelligence_java_grpc",
+- ":videointelligence_java_proto",
+- ":videointelligence_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "videointelligence_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1p1beta1",
+- protos = [":videointelligence_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "videointelligence_go_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- importpath = "cloud.google.com/go/videointelligence/apiv1p1beta1;videointelligence",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/videointelligence:videointelligence_v1p1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "videointelligence_go_gapic_test",
+- srcs = [":videointelligence_go_gapic_srcjar_test"],
+- embed = [":videointelligence_go_gapic"],
+- importpath = "cloud.google.com/go/videointelligence/apiv1p1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-videointelligence-v1p1beta1-go",
+- deps = [
+- ":videointelligence_go_gapic",
+- ":videointelligence_go_gapic_srcjar-test.srcjar",
+- ":videointelligence_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "videointelligence_py_gapic",
+- srcs = [":videointelligence_proto"],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "videointelligence_py_gapic_test",
+- srcs = [
+- "videointelligence_py_gapic_pytest.py",
+- "videointelligence_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":videointelligence_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "videointelligence-v1p1beta1-py",
+- deps = [
+- ":videointelligence_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "videointelligence_php_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-php_grpc_library(
+- name = "videointelligence_php_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "videointelligence_php_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- gapic_yaml = "videointelligence_gapic.yaml",
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/videointelligence:videointelligence_v1p1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_php_grpc",
+- ":videointelligence_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-v1p1beta1-php",
+- deps = [
+- ":videointelligence_php_gapic",
+- ":videointelligence_php_grpc",
+- ":videointelligence_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "videointelligence_nodejs_gapic",
+- package_name = "@google-cloud/video-intelligence",
+- src = ":videointelligence_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- main_service = "videointelligence",
+- package = "google.cloud.videointelligence.v1p1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/videointelligence:videointelligence_v1p1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "videointelligence-v1p1beta1-nodejs",
+- deps = [
+- ":videointelligence_nodejs_gapic",
+- ":videointelligence_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "videointelligence_ruby_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "videointelligence_ruby_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "videointelligence_ruby_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-video_intelligence-v1p1beta1",
+- "ruby-cloud-env-prefix=VIDEO_INTELLIGENCE",
+- "ruby-cloud-product-url=https://cloud.google.com/video-intelligence",
+- "ruby-cloud-api-id=videointelligence.googleapis.com",
+- "ruby-cloud-api-shortname=videointelligence",
+- ],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Detects objects, explicit content, and scene changes in videos. It also specifies the region for annotation and transcribes speech to text. Supports both asynchronous API and streaming API.",
+- ruby_cloud_title = "Cloud Video Intelligence V1p1beta1",
+- deps = [
+- ":videointelligence_ruby_grpc",
+- ":videointelligence_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-v1p1beta1-ruby",
+- deps = [
+- ":videointelligence_ruby_gapic",
+- ":videointelligence_ruby_grpc",
+- ":videointelligence_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "videointelligence_csharp_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "videointelligence_csharp_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "videointelligence_csharp_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/videointelligence:videointelligence_v1p1beta1.yaml",
+- deps = [
+- ":videointelligence_csharp_grpc",
+- ":videointelligence_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-v1p1beta1-csharp",
+- deps = [
+- ":videointelligence_csharp_gapic",
+- ":videointelligence_csharp_grpc",
+- ":videointelligence_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/videointelligence/v1p2beta1/BUILD.bazel b/google/cloud/videointelligence/v1p2beta1/BUILD.bazel
+--- a/google/cloud/videointelligence/v1p2beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/videointelligence/v1p2beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,365 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "videointelligence_proto",
+- srcs = [
+- "video_intelligence.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "videointelligence_proto_with_info",
+- deps = [
+- ":videointelligence_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "videointelligence_java_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-java_grpc_library(
+- name = "videointelligence_java_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "videointelligence_java_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- gapic_yaml = "videointelligence_gapic.yaml",
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":videointelligence_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "videointelligence_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.videointelligence.v1p2beta1.VideoIntelligenceServiceClientHttpJsonTest",
+- "com.google.cloud.videointelligence.v1p2beta1.VideoIntelligenceServiceClientTest",
+- ],
+- runtime_deps = [":videointelligence_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-videointelligence-v1p2beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_java_gapic",
+- ":videointelligence_java_grpc",
+- ":videointelligence_java_proto",
+- ":videointelligence_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "videointelligence_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1p2beta1",
+- protos = [":videointelligence_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "videointelligence_go_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- importpath = "cloud.google.com/go/videointelligence/apiv1p2beta1;videointelligence",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/videointelligence:videointelligence_v1p2beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "videointelligence_go_gapic_test",
+- srcs = [":videointelligence_go_gapic_srcjar_test"],
+- embed = [":videointelligence_go_gapic"],
+- importpath = "cloud.google.com/go/videointelligence/apiv1p2beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-videointelligence-v1p2beta1-go",
+- deps = [
+- ":videointelligence_go_gapic",
+- ":videointelligence_go_gapic_srcjar-test.srcjar",
+- ":videointelligence_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "videointelligence_py_gapic",
+- srcs = [":videointelligence_proto"],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "videointelligence_py_gapic_test",
+- srcs = [
+- "videointelligence_py_gapic_pytest.py",
+- "videointelligence_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":videointelligence_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "videointelligence-v1p2beta1-py",
+- deps = [
+- ":videointelligence_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "videointelligence_php_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-php_grpc_library(
+- name = "videointelligence_php_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "videointelligence_php_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- gapic_yaml = "videointelligence_gapic.yaml",
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/videointelligence:videointelligence_v1p2beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_php_grpc",
+- ":videointelligence_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-v1p2beta1-php",
+- deps = [
+- ":videointelligence_php_gapic",
+- ":videointelligence_php_grpc",
+- ":videointelligence_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "videointelligence_nodejs_gapic",
+- package_name = "@google-cloud/video-intelligence",
+- src = ":videointelligence_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- main_service = "videointelligence",
+- package = "google.cloud.videointelligence.v1p2beta1",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/videointelligence:videointelligence_v1p2beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "videointelligence-v1p2beta1-nodejs",
+- deps = [
+- ":videointelligence_nodejs_gapic",
+- ":videointelligence_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "videointelligence_ruby_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "videointelligence_ruby_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "videointelligence_ruby_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-video_intelligence-v1p2beta1",
+- "ruby-cloud-env-prefix=VIDEO_INTELLIGENCE",
+- "ruby-cloud-product-url=https://cloud.google.com/video-intelligence",
+- "ruby-cloud-api-id=videointelligence.googleapis.com",
+- "ruby-cloud-api-shortname=videointelligence",
+- ],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Detects objects, explicit content, and scene changes in videos. It also specifies the region for annotation and transcribes speech to text. Supports both asynchronous API and streaming API.",
+- ruby_cloud_title = "Cloud Video Intelligence V1p2beta1",
+- deps = [
+- ":videointelligence_ruby_grpc",
+- ":videointelligence_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-v1p2beta1-ruby",
+- deps = [
+- ":videointelligence_ruby_gapic",
+- ":videointelligence_ruby_grpc",
+- ":videointelligence_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "videointelligence_csharp_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "videointelligence_csharp_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "videointelligence_csharp_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/videointelligence:videointelligence_v1p2beta1.yaml",
+- deps = [
+- ":videointelligence_csharp_grpc",
+- ":videointelligence_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-v1p2beta1-csharp",
+- deps = [
+- ":videointelligence_csharp_gapic",
+- ":videointelligence_csharp_grpc",
+- ":videointelligence_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/videointelligence/v1p3beta1/BUILD.bazel b/google/cloud/videointelligence/v1p3beta1/BUILD.bazel
+--- a/google/cloud/videointelligence/v1p3beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/videointelligence/v1p3beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,366 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "videointelligence_proto",
+- srcs = [
+- "video_intelligence.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "videointelligence_proto_with_info",
+- deps = [
+- ":videointelligence_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "videointelligence_java_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-java_grpc_library(
+- name = "videointelligence_java_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "videointelligence_java_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- gapic_yaml = "videointelligence_gapic.yaml",
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":videointelligence_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "videointelligence_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.videointelligence.v1p3beta1.StreamingVideoIntelligenceServiceClientHttpJsonTest",
+- "com.google.cloud.videointelligence.v1p3beta1.StreamingVideoIntelligenceServiceClientTest",
+- "com.google.cloud.videointelligence.v1p3beta1.VideoIntelligenceServiceClientHttpJsonTest",
+- "com.google.cloud.videointelligence.v1p3beta1.VideoIntelligenceServiceClientTest",
+- ],
+- runtime_deps = [":videointelligence_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-videointelligence-v1p3beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_java_gapic",
+- ":videointelligence_java_grpc",
+- ":videointelligence_java_proto",
+- ":videointelligence_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "videointelligence_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1p3beta1",
+- protos = [":videointelligence_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "videointelligence_go_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- importpath = "cloud.google.com/go/videointelligence/apiv1p3beta1;videointelligence",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/videointelligence:videointelligence_v1p3beta1.yaml",
+- deps = [
+- ":videointelligence_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "videointelligence_go_gapic_test",
+- srcs = [":videointelligence_go_gapic_srcjar_test"],
+- embed = [":videointelligence_go_gapic"],
+- importpath = "cloud.google.com/go/videointelligence/apiv1p3beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-videointelligence-v1p3beta1-go",
+- deps = [
+- ":videointelligence_go_gapic",
+- ":videointelligence_go_gapic_srcjar-test.srcjar",
+- ":videointelligence_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "videointelligence_py_gapic",
+- srcs = [":videointelligence_proto"],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "videointelligence_py_gapic_test",
+- srcs = [
+- "videointelligence_py_gapic_pytest.py",
+- "videointelligence_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":videointelligence_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "videointelligence-v1p3beta1-py",
+- deps = [
+- ":videointelligence_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "videointelligence_php_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-php_grpc_library(
+- name = "videointelligence_php_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "videointelligence_php_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- gapic_yaml = "videointelligence_gapic.yaml",
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/videointelligence:videointelligence_v1p3beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":videointelligence_php_grpc",
+- ":videointelligence_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-v1p3beta1-php",
+- deps = [
+- ":videointelligence_php_gapic",
+- ":videointelligence_php_grpc",
+- ":videointelligence_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "videointelligence_nodejs_gapic",
+- package_name = "@google-cloud/video-intelligence",
+- src = ":videointelligence_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- main_service = "videointelligence",
+- package = "google.cloud.videointelligence.v1p3beta1",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/videointelligence:videointelligence_v1p3beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "videointelligence-v1p3beta1-nodejs",
+- deps = [
+- ":videointelligence_nodejs_gapic",
+- ":videointelligence_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "videointelligence_ruby_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "videointelligence_ruby_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "videointelligence_ruby_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-video_intelligence-v1p3beta1",
+- "ruby-cloud-env-prefix=VIDEO_INTELLIGENCE",
+- "ruby-cloud-product-url=https://cloud.google.com/video-intelligence",
+- "ruby-cloud-api-id=videointelligence.googleapis.com",
+- "ruby-cloud-api-shortname=videointelligence",
+- ],
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Detects objects, explicit content, and scene changes in videos. It also specifies the region for annotation and transcribes speech to text. Supports both asynchronous API and streaming API.",
+- ruby_cloud_title = "Cloud Video Intelligence V1p3beta1",
+- deps = [
+- ":videointelligence_ruby_grpc",
+- ":videointelligence_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-v1p3beta1-ruby",
+- deps = [
+- ":videointelligence_ruby_gapic",
+- ":videointelligence_ruby_grpc",
+- ":videointelligence_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "videointelligence_csharp_proto",
+- deps = [":videointelligence_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "videointelligence_csharp_grpc",
+- srcs = [":videointelligence_proto"],
+- deps = [":videointelligence_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "videointelligence_csharp_gapic",
+- srcs = [":videointelligence_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "videointelligence_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//google/cloud/videointelligence:videointelligence_v1p3beta1.yaml",
+- deps = [
+- ":videointelligence_csharp_grpc",
+- ":videointelligence_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-videointelligence-v1p3beta1-csharp",
+- deps = [
+- ":videointelligence_csharp_gapic",
+- ":videointelligence_csharp_grpc",
+- ":videointelligence_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/vision/BUILD.bazel b/google/cloud/vision/BUILD.bazel
+--- a/google/cloud/vision/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/vision/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-vision.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for vision.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "vision_ruby_wrapper",
+- srcs = ["//google/cloud/vision/v1:vision_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-vision",
+- "ruby-cloud-env-prefix=VISION",
+- "ruby-cloud-wrapper-of=v1:0.0;v1p3beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/vision",
+- "ruby-cloud-api-id=vision.googleapis.com",
+- "ruby-cloud-api-shortname=vision",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "Cloud Vision API allows developers to easily integrate vision detection features within applications, including image labeling, face and landmark detection, optical character recognition (OCR), and tagging of explicit content.",
+- ruby_cloud_title = "Cloud Vision",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-vision-ruby",
+- deps = [
+- ":vision_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/vision/v1/BUILD.bazel b/google/cloud/vision/v1/BUILD.bazel
+--- a/google/cloud/vision/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/vision/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,409 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "vision_proto",
+- srcs = [
+- "geometry.proto",
+- "image_annotator.proto",
+- "product_search.proto",
+- "product_search_service.proto",
+- "text_annotation.proto",
+- "web_detection.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:color_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "vision_proto_with_info",
+- deps = [
+- ":vision_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "vision_java_proto",
+- deps = [":vision_proto"],
+-)
+-
+-java_grpc_library(
+- name = "vision_java_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "vision_java_gapic",
+- srcs = [":vision_proto_with_info"],
+- gapic_yaml = "vision_gapic.yaml",
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1.yaml",
+- test_deps = [
+- ":vision_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":vision_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "vision_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.vision.v1.ImageAnnotatorClientHttpJsonTest",
+- "com.google.cloud.vision.v1.ImageAnnotatorClientTest",
+- "com.google.cloud.vision.v1.ProductSearchClientHttpJsonTest",
+- "com.google.cloud.vision.v1.ProductSearchClientTest",
+- ],
+- runtime_deps = [":vision_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-vision-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":vision_java_gapic",
+- ":vision_java_grpc",
+- ":vision_java_proto",
+- ":vision_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "vision_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/vision/v1",
+- protos = [":vision_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:color_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "vision_go_gapic",
+- srcs = [":vision_proto_with_info"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- importpath = "cloud.google.com/go/vision/apiv1;vision",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":vision_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "vision_go_gapic_test",
+- srcs = [":vision_go_gapic_srcjar_test"],
+- embed = [":vision_go_gapic"],
+- importpath = "cloud.google.com/go/vision/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-vision-v1-go",
+- deps = [
+- ":vision_go_gapic",
+- ":vision_go_gapic_srcjar-metadata.srcjar",
+- ":vision_go_gapic_srcjar-test.srcjar",
+- ":vision_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "vision_py_gapic",
+- srcs = [":vision_proto"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1.yaml",
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "vision_py_gapic_test",
+- srcs = [
+- "vision_py_gapic_pytest.py",
+- "vision_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":vision_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "vision-v1-py",
+- deps = [
+- ":vision_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "vision_php_proto",
+- deps = [":vision_proto"],
+-)
+-
+-php_grpc_library(
+- name = "vision_php_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "vision_php_gapic",
+- srcs = [":vision_proto_with_info"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":vision_php_grpc",
+- ":vision_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-vision-v1-php",
+- deps = [
+- ":vision_php_gapic",
+- ":vision_php_grpc",
+- ":vision_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "vision_nodejs_gapic",
+- package_name = "@google-cloud/vision",
+- src = ":vision_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- main_service = "vision",
+- package = "google.cloud.vision.v1",
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "vision-v1-nodejs",
+- deps = [
+- ":vision_nodejs_gapic",
+- ":vision_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "vision_ruby_proto",
+- deps = [":vision_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "vision_ruby_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "vision_ruby_gapic",
+- srcs = [":vision_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=vision.googleapis.com",
+- "ruby-cloud-api-shortname=vision",
+- "ruby-cloud-env-prefix=VISION",
+- "ruby-cloud-gem-name=google-cloud-vision-v1",
+- "ruby-cloud-generate-standalone-snippets=true",
+- "ruby-cloud-generate-yardoc-snippets=true",
+- "ruby-cloud-product-url=https://cloud.google.com/vision",
+- ],
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Vision API allows developers to easily integrate vision detection features within applications, including image labeling, face and landmark detection, optical character recognition (OCR), and tagging of explicit content.",
+- ruby_cloud_title = "Cloud Vision V1",
+- deps = [
+- ":vision_ruby_grpc",
+- ":vision_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-vision-v1-ruby",
+- deps = [
+- ":vision_ruby_gapic",
+- ":vision_ruby_grpc",
+- ":vision_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "vision_csharp_proto",
+- deps = [":vision_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "vision_csharp_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "vision_csharp_gapic",
+- srcs = [":vision_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1.yaml",
+- deps = [
+- ":vision_csharp_grpc",
+- ":vision_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-vision-v1-csharp",
+- deps = [
+- ":vision_csharp_gapic",
+- ":vision_csharp_grpc",
+- ":vision_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "vision_cc_proto",
+- deps = [":vision_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "vision_cc_grpc",
+- srcs = [":vision_proto"],
+- grpc_only = True,
+- deps = [":vision_cc_proto"],
+-)
+diff -urN a/google/cloud/vision/v1p1beta1/BUILD.bazel b/google/cloud/vision/v1p1beta1/BUILD.bazel
+--- a/google/cloud/vision/v1p1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/vision/v1p1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,352 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "vision_proto",
+- srcs = [
+- "geometry.proto",
+- "image_annotator.proto",
+- "text_annotation.proto",
+- "web_detection.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/rpc:status_proto",
+- "//google/type:color_proto",
+- "//google/type:latlng_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "vision_proto_with_info",
+- deps = [
+- ":vision_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "vision_java_proto",
+- deps = [":vision_proto"],
+-)
+-
+-java_grpc_library(
+- name = "vision_java_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "vision_java_gapic",
+- srcs = [":vision_proto_with_info"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":vision_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":vision_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "vision_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.vision.v1p1beta1.ImageAnnotatorClientHttpJsonTest",
+- "com.google.cloud.vision.v1p1beta1.ImageAnnotatorClientTest",
+- ],
+- runtime_deps = [":vision_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-vision-v1p1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":vision_java_gapic",
+- ":vision_java_grpc",
+- ":vision_java_proto",
+- ":vision_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "vision_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1",
+- protos = [":vision_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:color_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "vision_go_gapic",
+- srcs = [":vision_proto_with_info"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- importpath = "cloud.google.com/go/vision/apiv1p1beta1;vision",
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1p1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":vision_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "vision_go_gapic_test",
+- srcs = [":vision_go_gapic_srcjar_test"],
+- embed = [":vision_go_gapic"],
+- importpath = "cloud.google.com/go/vision/apiv1p1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-vision-v1p1beta1-go",
+- deps = [
+- ":vision_go_gapic",
+- ":vision_go_gapic_srcjar-test.srcjar",
+- ":vision_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "vision_py_gapic",
+- srcs = [":vision_proto"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "vision_py_gapic_test",
+- srcs = [
+- "vision_py_gapic_pytest.py",
+- "vision_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":vision_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "vision-v1p1beta1-py",
+- deps = [
+- ":vision_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "vision_php_proto",
+- deps = [":vision_proto"],
+-)
+-
+-php_grpc_library(
+- name = "vision_php_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "vision_php_gapic",
+- srcs = [":vision_proto_with_info"],
+- gapic_yaml = "vision_gapic.yaml",
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":vision_php_grpc",
+- ":vision_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-vision-v1p1beta1-php",
+- deps = [
+- ":vision_php_gapic",
+- ":vision_php_grpc",
+- ":vision_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "vision_nodejs_gapic",
+- package_name = "@google-cloud/vision",
+- src = ":vision_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- main_service = "vision",
+- package = "google.cloud.vision.v1p1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1p1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "vision-v1p1beta1-nodejs",
+- deps = [
+- ":vision_nodejs_gapic",
+- ":vision_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "vision_ruby_proto",
+- deps = [":vision_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "vision_ruby_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "vision_ruby_gapic",
+- srcs = [":vision_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-vision-v1p1beta1"],
+- rest_numeric_enums = False,
+- deps = [
+- ":vision_ruby_grpc",
+- ":vision_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-vision-v1p1beta1-ruby",
+- deps = [
+- ":vision_ruby_gapic",
+- ":vision_ruby_grpc",
+- ":vision_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "vision_csharp_proto",
+- deps = [":vision_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "vision_csharp_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "vision_csharp_gapic",
+- srcs = [":vision_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":vision_csharp_grpc",
+- ":vision_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-vision-v1p1beta1-csharp",
+- deps = [
+- ":vision_csharp_gapic",
+- ":vision_csharp_grpc",
+- ":vision_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/vision/v1p2beta1/BUILD.bazel b/google/cloud/vision/v1p2beta1/BUILD.bazel
+--- a/google/cloud/vision/v1p2beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/vision/v1p2beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,359 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "vision_proto",
+- srcs = [
+- "geometry.proto",
+- "image_annotator.proto",
+- "text_annotation.proto",
+- "web_detection.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:color_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "vision_proto_with_info",
+- deps = [
+- ":vision_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "vision_java_proto",
+- deps = [":vision_proto"],
+-)
+-
+-java_grpc_library(
+- name = "vision_java_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "vision_java_gapic",
+- srcs = [":vision_proto_with_info"],
+- gapic_yaml = "vision_gapic.yaml",
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":vision_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":vision_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "vision_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.vision.v1p2beta1.ImageAnnotatorClientHttpJsonTest",
+- "com.google.cloud.vision.v1p2beta1.ImageAnnotatorClientTest",
+- ],
+- runtime_deps = [":vision_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-vision-v1p2beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":vision_java_gapic",
+- ":vision_java_grpc",
+- ":vision_java_proto",
+- ":vision_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "vision_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1",
+- protos = [":vision_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:color_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "vision_go_gapic",
+- srcs = [":vision_proto_with_info"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- importpath = "cloud.google.com/go/vision/apiv1p2beta1;vision",
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1p2beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":vision_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "vision_go_gapic_test",
+- srcs = [":vision_go_gapic_srcjar_test"],
+- embed = [":vision_go_gapic"],
+- importpath = "cloud.google.com/go/vision/apiv1p2beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-vision-v1p2beta1-go",
+- deps = [
+- ":vision_go_gapic",
+- ":vision_go_gapic_srcjar-test.srcjar",
+- ":vision_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "vision_py_gapic",
+- srcs = [":vision_proto"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "vision_py_gapic_test",
+- srcs = [
+- "vision_py_gapic_pytest.py",
+- "vision_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":vision_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "vision-v1p2beta1-py",
+- deps = [
+- ":vision_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "vision_php_proto",
+- deps = [":vision_proto"],
+-)
+-
+-php_grpc_library(
+- name = "vision_php_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "vision_php_gapic",
+- srcs = [":vision_proto_with_info"],
+- gapic_yaml = "vision_gapic.yaml",
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":vision_php_grpc",
+- ":vision_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-vision-v1p2beta1-php",
+- deps = [
+- ":vision_php_gapic",
+- ":vision_php_grpc",
+- ":vision_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "vision_nodejs_gapic",
+- package_name = "@google-cloud/vision",
+- src = ":vision_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- main_service = "vision",
+- package = "google.cloud.vision.v1p2beta1",
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1p2beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "vision-v1p2beta1-nodejs",
+- deps = [
+- ":vision_nodejs_gapic",
+- ":vision_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "vision_ruby_proto",
+- deps = [":vision_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "vision_ruby_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "vision_ruby_gapic",
+- srcs = [":vision_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-vision-v1p2beta1"],
+- rest_numeric_enums = False,
+- deps = [
+- ":vision_ruby_grpc",
+- ":vision_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-vision-v1p2beta1-ruby",
+- deps = [
+- ":vision_ruby_gapic",
+- ":vision_ruby_grpc",
+- ":vision_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "vision_csharp_proto",
+- deps = [":vision_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "vision_csharp_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "vision_csharp_gapic",
+- srcs = [":vision_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":vision_csharp_grpc",
+- ":vision_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-vision-v1p2beta1-csharp",
+- deps = [
+- ":vision_csharp_gapic",
+- ":vision_csharp_grpc",
+- ":vision_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/vision/v1p3beta1/BUILD.bazel b/google/cloud/vision/v1p3beta1/BUILD.bazel
+--- a/google/cloud/vision/v1p3beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/vision/v1p3beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,376 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "vision_proto",
+- srcs = [
+- "geometry.proto",
+- "image_annotator.proto",
+- "product_search.proto",
+- "product_search_service.proto",
+- "text_annotation.proto",
+- "web_detection.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:color_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "vision_proto_with_info",
+- deps = [
+- ":vision_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "vision_java_proto",
+- deps = [":vision_proto"],
+-)
+-
+-java_grpc_library(
+- name = "vision_java_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "vision_java_gapic",
+- srcs = [":vision_proto_with_info"],
+- gapic_yaml = "vision_gapic.yaml",
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":vision_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":vision_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "vision_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.vision.v1p3beta1.ImageAnnotatorClientHttpJsonTest",
+- "com.google.cloud.vision.v1p3beta1.ImageAnnotatorClientTest",
+- "com.google.cloud.vision.v1p3beta1.ProductSearchClientHttpJsonTest",
+- "com.google.cloud.vision.v1p3beta1.ProductSearchClientTest",
+- ],
+- runtime_deps = [":vision_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-vision-v1p3beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":vision_java_gapic",
+- ":vision_java_grpc",
+- ":vision_java_proto",
+- ":vision_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "vision_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1",
+- protos = [":vision_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:color_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "vision_go_gapic",
+- srcs = [":vision_proto_with_info"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- importpath = "cloud.google.com/go/vision/apiv1p3beta1;vision",
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1p3beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":vision_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "vision_go_gapic_test",
+- srcs = [":vision_go_gapic_srcjar_test"],
+- embed = [":vision_go_gapic"],
+- importpath = "cloud.google.com/go/vision/apiv1p3beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-vision-v1p3beta1-go",
+- deps = [
+- ":vision_go_gapic",
+- ":vision_go_gapic_srcjar-test.srcjar",
+- ":vision_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "vision_py_gapic",
+- srcs = [":vision_proto"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "vision_py_gapic_test",
+- srcs = [
+- "vision_py_gapic_pytest.py",
+- "vision_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":vision_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "vision-v1p3beta1-py",
+- deps = [
+- ":vision_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "vision_php_proto",
+- deps = [":vision_proto"],
+-)
+-
+-php_grpc_library(
+- name = "vision_php_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "vision_php_gapic",
+- srcs = [":vision_proto_with_info"],
+- gapic_yaml = "vision_gapic.yaml",
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1p3beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":vision_php_grpc",
+- ":vision_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-vision-v1p3beta1-php",
+- deps = [
+- ":vision_php_gapic",
+- ":vision_php_grpc",
+- ":vision_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "vision_nodejs_gapic",
+- package_name = "@google-cloud/vision",
+- src = ":vision_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- main_service = "vision",
+- package = "google.cloud.vision.v1p3beta1",
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1p3beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "vision-v1p3beta1-nodejs",
+- deps = [
+- ":vision_nodejs_gapic",
+- ":vision_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "vision_ruby_proto",
+- deps = [":vision_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "vision_ruby_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "vision_ruby_gapic",
+- srcs = [":vision_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-vision-v1p3beta1",
+- "ruby-cloud-env-prefix=VISION",
+- "ruby-cloud-product-url=https://cloud.google.com/vision",
+- "ruby-cloud-api-id=vision.googleapis.com",
+- "ruby-cloud-api-shortname=vision",
+- ],
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Vision API allows developers to easily integrate vision detection features within applications, including image labeling, face and landmark detection, optical character recognition (OCR), and tagging of explicit content.",
+- ruby_cloud_title = "Cloud Vision V1p3beta1",
+- deps = [
+- ":vision_ruby_grpc",
+- ":vision_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-vision-v1p3beta1-ruby",
+- deps = [
+- ":vision_ruby_gapic",
+- ":vision_ruby_grpc",
+- ":vision_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "vision_csharp_proto",
+- deps = [":vision_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "vision_csharp_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "vision_csharp_gapic",
+- srcs = [":vision_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":vision_csharp_grpc",
+- ":vision_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-vision-v1p3beta1-csharp",
+- deps = [
+- ":vision_csharp_gapic",
+- ":vision_csharp_grpc",
+- ":vision_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/vision/v1p4beta1/BUILD.bazel b/google/cloud/vision/v1p4beta1/BUILD.bazel
+--- a/google/cloud/vision/v1p4beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/vision/v1p4beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,377 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "vision_proto",
+- srcs = [
+- "face.proto",
+- "geometry.proto",
+- "image_annotator.proto",
+- "product_search.proto",
+- "product_search_service.proto",
+- "text_annotation.proto",
+- "web_detection.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:color_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "vision_proto_with_info",
+- deps = [
+- ":vision_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "vision_java_proto",
+- deps = [":vision_proto"],
+-)
+-
+-java_grpc_library(
+- name = "vision_java_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "vision_java_gapic",
+- srcs = [":vision_proto_with_info"],
+- gapic_yaml = "vision_gapic.yaml",
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":vision_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":vision_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "vision_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.vision.v1p4beta1.ImageAnnotatorClientHttpJsonTest",
+- "com.google.cloud.vision.v1p4beta1.ImageAnnotatorClientTest",
+- "com.google.cloud.vision.v1p4beta1.ProductSearchClientHttpJsonTest",
+- "com.google.cloud.vision.v1p4beta1.ProductSearchClientTest",
+- ],
+- runtime_deps = [":vision_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-vision-v1p4beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":vision_java_gapic",
+- ":vision_java_grpc",
+- ":vision_java_proto",
+- ":vision_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "vision_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/vision/v1p4beta1",
+- protos = [":vision_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:color_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "vision_go_gapic",
+- srcs = [":vision_proto_with_info"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- importpath = "cloud.google.com/go/vision/apiv1p4beta1;vision",
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1p4beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":vision_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "vision_go_gapic_test",
+- srcs = [":vision_go_gapic_srcjar_test"],
+- embed = [":vision_go_gapic"],
+- importpath = "cloud.google.com/go/vision/apiv1p4beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-vision-v1p4beta1-go",
+- deps = [
+- ":vision_go_gapic",
+- ":vision_go_gapic_srcjar-test.srcjar",
+- ":vision_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "vision_py_gapic",
+- srcs = [":vision_proto"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "vision_py_gapic_test",
+- srcs = [
+- "vision_py_gapic_pytest.py",
+- "vision_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":vision_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "vision-v1p4beta1-py",
+- deps = [
+- ":vision_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "vision_php_proto",
+- deps = [":vision_proto"],
+-)
+-
+-php_grpc_library(
+- name = "vision_php_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "vision_php_gapic",
+- srcs = [":vision_proto_with_info"],
+- gapic_yaml = "vision_gapic.yaml",
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1p4beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":vision_php_grpc",
+- ":vision_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-vision-v1p4beta1-php",
+- deps = [
+- ":vision_php_gapic",
+- ":vision_php_grpc",
+- ":vision_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "vision_nodejs_gapic",
+- package_name = "@google-cloud/vision",
+- src = ":vision_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "vision_grpc_service_config.json",
+- main_service = "vision",
+- package = "google.cloud.vision.v1p4beta1",
+- rest_numeric_enums = False,
+- service_yaml = "vision_v1p4beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "vision-v1p4beta1-nodejs",
+- deps = [
+- ":vision_nodejs_gapic",
+- ":vision_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "vision_ruby_proto",
+- deps = [":vision_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "vision_ruby_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "vision_ruby_gapic",
+- srcs = [":vision_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-vision-v1p4beta1",
+- "ruby-cloud-env-prefix=VISION",
+- "ruby-cloud-product-url=https://cloud.google.com/vision",
+- "ruby-cloud-api-id=vision.googleapis.com",
+- "ruby-cloud-api-shortname=vision",
+- ],
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Vision API allows developers to easily integrate vision detection features within applications, including image labeling, face and landmark detection, optical character recognition (OCR), and tagging of explicit content.",
+- ruby_cloud_title = "Cloud Vision V1p4beta1",
+- deps = [
+- ":vision_ruby_grpc",
+- ":vision_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-vision-v1p4beta1-ruby",
+- deps = [
+- ":vision_ruby_gapic",
+- ":vision_ruby_grpc",
+- ":vision_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "vision_csharp_proto",
+- deps = [":vision_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "vision_csharp_grpc",
+- srcs = [":vision_proto"],
+- deps = [":vision_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "vision_csharp_gapic",
+- srcs = [":vision_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "vision_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":vision_csharp_grpc",
+- ":vision_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-vision-v1p4beta1-csharp",
+- deps = [
+- ":vision_csharp_gapic",
+- ":vision_csharp_grpc",
+- ":vision_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/visionai/v1alpha1/BUILD.bazel b/google/cloud/visionai/v1alpha1/BUILD.bazel
+--- a/google/cloud/visionai/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/visionai/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,427 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "visionai_proto",
+- srcs = [
+- "annotations.proto",
+- "common.proto",
+- "lva.proto",
+- "lva_resources.proto",
+- "lva_service.proto",
+- "platform.proto",
+- "streaming_resources.proto",
+- "streaming_service.proto",
+- "streams_resources.proto",
+- "streams_service.proto",
+- "warehouse.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:datetime_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "visionai_proto_with_info",
+- deps = [
+- ":visionai_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "visionai_java_proto",
+- deps = [":visionai_proto"],
+-)
+-
+-java_grpc_library(
+- name = "visionai_java_grpc",
+- srcs = [":visionai_proto"],
+- deps = [":visionai_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "visionai_java_gapic",
+- srcs = [":visionai_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "visionai_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "visionai_v1alpha1.yaml",
+- test_deps = [
+- ":visionai_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":visionai_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "visionai_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.visionai.v1alpha1.AppPlatformClientHttpJsonTest",
+- "com.google.cloud.visionai.v1alpha1.AppPlatformClientTest",
+- "com.google.cloud.visionai.v1alpha1.LiveVideoAnalyticsClientHttpJsonTest",
+- "com.google.cloud.visionai.v1alpha1.LiveVideoAnalyticsClientTest",
+- "com.google.cloud.visionai.v1alpha1.StreamingServiceClientHttpJsonTest",
+- "com.google.cloud.visionai.v1alpha1.StreamingServiceClientTest",
+- "com.google.cloud.visionai.v1alpha1.StreamsServiceClientHttpJsonTest",
+- "com.google.cloud.visionai.v1alpha1.StreamsServiceClientTest",
+- "com.google.cloud.visionai.v1alpha1.WarehouseClientHttpJsonTest",
+- "com.google.cloud.visionai.v1alpha1.WarehouseClientTest",
+- ],
+- runtime_deps = [":visionai_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-visionai-v1alpha1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":visionai_java_gapic",
+- ":visionai_java_grpc",
+- ":visionai_java_proto",
+- ":visionai_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "visionai_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/visionai/v1alpha1",
+- protos = [":visionai_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:datetime_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "visionai_go_gapic",
+- srcs = [":visionai_proto_with_info"],
+- grpc_service_config = "visionai_grpc_service_config.json",
+- importpath = "cloud.google.com/go/visionai/apiv1alpha1;visionai",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "visionai_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":visionai_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "visionai_go_gapic_test",
+- srcs = [":visionai_go_gapic_srcjar_test"],
+- embed = [":visionai_go_gapic"],
+- importpath = "cloud.google.com/go/visionai/apiv1alpha1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-visionai-v1alpha1-go",
+- deps = [
+- ":visionai_go_gapic",
+- ":visionai_go_gapic_srcjar-metadata.srcjar",
+- ":visionai_go_gapic_srcjar-test.srcjar",
+- ":visionai_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "visionai_py_gapic",
+- srcs = [":visionai_proto"],
+- grpc_service_config = "visionai_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "visionai_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "visionai_py_gapic_test",
+- srcs = [
+- "visionai_py_gapic_pytest.py",
+- "visionai_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":visionai_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "visionai-v1alpha1-py",
+- deps = [
+- ":visionai_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "visionai_php_proto",
+- deps = [":visionai_proto"],
+-)
+-
+-php_grpc_library(
+- name = "visionai_php_grpc",
+- srcs = [":visionai_proto"],
+- deps = [":visionai_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "visionai_php_gapic",
+- srcs = [":visionai_proto_with_info"],
+- grpc_service_config = "visionai_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "visionai_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":visionai_php_grpc",
+- ":visionai_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-visionai-v1alpha1-php",
+- deps = [
+- ":visionai_php_gapic",
+- ":visionai_php_grpc",
+- ":visionai_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "visionai_nodejs_gapic",
+- package_name = "@google-cloud/visionai",
+- src = ":visionai_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "visionai_grpc_service_config.json",
+- package = "google.cloud.visionai.v1alpha1",
+- rest_numeric_enums = False,
+- service_yaml = "visionai_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "visionai-v1alpha1-nodejs",
+- deps = [
+- ":visionai_nodejs_gapic",
+- ":visionai_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "visionai_ruby_proto",
+- deps = [":visionai_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "visionai_ruby_grpc",
+- srcs = [":visionai_proto"],
+- deps = [":visionai_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "visionai_ruby_gapic",
+- srcs = [":visionai_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-visionai-v1alpha1",
+- ],
+- grpc_service_config = "visionai_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "visionai_v1alpha1.yaml",
+- deps = [
+- ":visionai_ruby_grpc",
+- ":visionai_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-visionai-v1alpha1-ruby",
+- deps = [
+- ":visionai_ruby_gapic",
+- ":visionai_ruby_grpc",
+- ":visionai_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "visionai_csharp_proto",
+- deps = [":visionai_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "visionai_csharp_grpc",
+- srcs = [":visionai_proto"],
+- deps = [":visionai_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "visionai_csharp_gapic",
+- srcs = [":visionai_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "visionai_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "visionai_v1alpha1.yaml",
+- deps = [
+- ":visionai_csharp_grpc",
+- ":visionai_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-visionai-v1alpha1-csharp",
+- deps = [
+- ":visionai_csharp_gapic",
+- ":visionai_csharp_grpc",
+- ":visionai_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "visionai_cc_proto",
+- deps = [":visionai_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "visionai_cc_grpc",
+- srcs = [":visionai_proto"],
+- grpc_only = True,
+- deps = [":visionai_cc_proto"],
+-)
+diff -urN a/google/cloud/vmmigration/BUILD.bazel b/google/cloud/vmmigration/BUILD.bazel
+--- a/google/cloud/vmmigration/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/vmmigration/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-vm_migration.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for VMMigration.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "vmmigration_ruby_wrapper",
+- srcs = ["//google/cloud/vmmigration/v1:vmmigration_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-vm_migration",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/migrate/compute-engine/",
+- "ruby-cloud-api-id=vmmigration.googleapis.com",
+- "ruby-cloud-api-shortname=vmmigration",
+- "ruby-cloud-namespace-override=VmMigration=VMMigration",
+- ],
+- ruby_cloud_description = "Migrate for Compute Engine enables you to migrate (Lift and Shift) your virtual machines (VMs), with minor automatic modifications, from your source environment to Google Compute Engine.",
+- ruby_cloud_title = "Migrate for Compute Engine",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-vmmigration-ruby",
+- deps = [
+- ":vmmigration_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/vmmigration/v1/BUILD.bazel b/google/cloud/vmmigration/v1/BUILD.bazel
+--- a/google/cloud/vmmigration/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/vmmigration/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,400 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "vmmigration_proto",
+- srcs = [
+- "vmmigration.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:error_details_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "vmmigration_proto_with_info",
+- deps = [
+- ":vmmigration_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "vmmigration_java_proto",
+- deps = [":vmmigration_proto"],
+-)
+-
+-java_grpc_library(
+- name = "vmmigration_java_grpc",
+- srcs = [":vmmigration_proto"],
+- deps = [":vmmigration_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "vmmigration_java_gapic",
+- srcs = [":vmmigration_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "vmmigration_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "vmmigration_v1.yaml",
+- test_deps = [
+- ":vmmigration_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":vmmigration_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "vmmigration_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.vmmigration.v1.VmMigrationClientHttpJsonTest",
+- "com.google.cloud.vmmigration.v1.VmMigrationClientTest",
+- ],
+- runtime_deps = [":vmmigration_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-vmmigration-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":vmmigration_java_gapic",
+- ":vmmigration_java_grpc",
+- ":vmmigration_java_proto",
+- ":vmmigration_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "vmmigration_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/vmmigration/v1",
+- protos = [":vmmigration_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:errdetails_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "vmmigration_go_gapic",
+- srcs = [":vmmigration_proto_with_info"],
+- grpc_service_config = "vmmigration_v1_grpc_service_config.json",
+- importpath = "cloud.google.com/go/vmmigration/apiv1;vmmigration",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "vmmigration_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":vmmigration_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "vmmigration_go_gapic_test",
+- srcs = [":vmmigration_go_gapic_srcjar_test"],
+- embed = [":vmmigration_go_gapic"],
+- importpath = "cloud.google.com/go/vmmigration/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-vmmigration-v1-go",
+- deps = [
+- ":vmmigration_go_gapic",
+- ":vmmigration_go_gapic_srcjar-metadata.srcjar",
+- ":vmmigration_go_gapic_srcjar-test.srcjar",
+- ":vmmigration_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "vmmigration_py_gapic",
+- srcs = [":vmmigration_proto"],
+- grpc_service_config = "vmmigration_v1_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-vm-migration",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "vmmigration_py_gapic_test",
+- srcs = [
+- "vmmigration_py_gapic_pytest.py",
+- "vmmigration_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":vmmigration_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "vmmigration-v1-py",
+- deps = [
+- ":vmmigration_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "vmmigration_php_proto",
+- deps = [":vmmigration_proto"],
+-)
+-
+-php_grpc_library(
+- name = "vmmigration_php_grpc",
+- srcs = [":vmmigration_proto"],
+- deps = [":vmmigration_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "vmmigration_php_gapic",
+- srcs = [":vmmigration_proto_with_info"],
+- grpc_service_config = "vmmigration_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "vmmigration_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":vmmigration_php_grpc",
+- ":vmmigration_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-vmmigration-v1-php",
+- deps = [
+- ":vmmigration_php_gapic",
+- ":vmmigration_php_grpc",
+- ":vmmigration_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "vmmigration_nodejs_gapic",
+- package_name = "@google-cloud/vmmigration",
+- src = ":vmmigration_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "vmmigration_v1_grpc_service_config.json",
+- package = "google.cloud.vmmigration.v1",
+- rest_numeric_enums = False,
+- service_yaml = "vmmigration_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "vmmigration-v1-nodejs",
+- deps = [
+- ":vmmigration_nodejs_gapic",
+- ":vmmigration_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "vmmigration_ruby_proto",
+- deps = [":vmmigration_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "vmmigration_ruby_grpc",
+- srcs = [":vmmigration_proto"],
+- deps = [":vmmigration_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "vmmigration_ruby_gapic",
+- srcs = [":vmmigration_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-vm_migration-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/migrate/compute-engine/",
+- "ruby-cloud-api-id=vmmigration.googleapis.com",
+- "ruby-cloud-api-shortname=vmmigration",
+- "ruby-cloud-namespace-override=VmMigration=VMMigration",
+- ],
+- grpc_service_config = "vmmigration_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Migrate for Compute Engine enables you to migrate (Lift and Shift) your virtual machines (VMs), with minor automatic modifications, from your source environment to Google Compute Engine.",
+- ruby_cloud_title = "Migrate for Compute Engine V1",
+- deps = [
+- ":vmmigration_ruby_grpc",
+- ":vmmigration_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-vmmigration-v1-ruby",
+- deps = [
+- ":vmmigration_ruby_gapic",
+- ":vmmigration_ruby_grpc",
+- ":vmmigration_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "vmmigration_csharp_proto",
+- deps = [":vmmigration_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "vmmigration_csharp_grpc",
+- srcs = [":vmmigration_proto"],
+- deps = [":vmmigration_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "vmmigration_csharp_gapic",
+- srcs = [":vmmigration_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "vmmigration_v1_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "vmmigration_v1.yaml",
+- deps = [
+- ":vmmigration_csharp_grpc",
+- ":vmmigration_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-vmmigration-v1-csharp",
+- deps = [
+- ":vmmigration_csharp_gapic",
+- ":vmmigration_csharp_grpc",
+- ":vmmigration_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "vmmigration_cc_proto",
+- deps = [":vmmigration_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "vmmigration_cc_grpc",
+- srcs = [":vmmigration_proto"],
+- grpc_only = True,
+- deps = [":vmmigration_cc_proto"],
+-)
+diff -urN a/google/cloud/vmwareengine/BUILD.bazel b/google/cloud/vmwareengine/BUILD.bazel
+--- a/google/cloud/vmwareengine/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/vmwareengine/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-vmware_engine.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for VMware Engine.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "vmwareengine_ruby_wrapper",
+- srcs = ["//google/cloud/vmwareengine/v1:vmwareengine_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-vmware_engine",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/vmware-engine/",
+- "ruby-cloud-api-id=vmwareengine.googleapis.com",
+- "ruby-cloud-api-shortname=vmwareengine",
+- ],
+- ruby_cloud_description = "Google Cloud VMware Engine is a fully managed service that lets you run the VMware platform in Google Cloud. VMware Engine provides you with VMware operational continuity so you can benefit from a cloud consumption model and lower your total cost of ownership. VMware Engine also offers on-demand provisioning, pay-as-you-grow, and capacity optimization.",
+- ruby_cloud_title = "Google Cloud VMware Engine",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-vmwareengine-ruby",
+- deps = [
+- ":vmwareengine_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/vmwareengine/v1/BUILD.bazel b/google/cloud/vmwareengine/v1/BUILD.bazel
+--- a/google/cloud/vmwareengine/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/vmwareengine/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,395 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "vmwareengine_proto",
+- srcs = [
+- "vmwareengine.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "vmwareengine_proto_with_info",
+- deps = [
+- ":vmwareengine_proto",
+- "//google/cloud/location:location_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/iam/v1:iam_policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "vmwareengine_java_proto",
+- deps = [":vmwareengine_proto"],
+-)
+-
+-java_grpc_library(
+- name = "vmwareengine_java_grpc",
+- srcs = [":vmwareengine_proto"],
+- deps = [":vmwareengine_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "vmwareengine_java_gapic",
+- srcs = [":vmwareengine_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "vmwareengine_grpc_service_config.json",
+- service_yaml = "vmwareengine_v1.yaml",
+- test_deps = [
+- ":vmwareengine_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":vmwareengine_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "vmwareengine_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.vmwareengine.v1.VmwareEngineClientHttpJsonTest",
+- "com.google.cloud.vmwareengine.v1.VmwareEngineClientTest",
+- ],
+- runtime_deps = [":vmwareengine_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-vmwareengine-v1-java",
+- transport = "grpc+rest",
+- deps = [
+- ":vmwareengine_java_gapic",
+- ":vmwareengine_java_grpc",
+- ":vmwareengine_java_proto",
+- ":vmwareengine_proto",
+- ],
+- include_samples = True,
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "vmwareengine_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/vmwareengine/v1",
+- protos = [":vmwareengine_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "vmwareengine_go_gapic",
+- srcs = [":vmwareengine_proto_with_info"],
+- grpc_service_config = "vmwareengine_grpc_service_config.json",
+- importpath = "cloud.google.com/go/vmwareengine/apiv1;vmwareengine",
+- metadata = True,
+- service_yaml = "vmwareengine_v1.yaml",
+- transport = "grpc+rest",
+- rest_numeric_enums = True,
+- deps = [
+- ":vmwareengine_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "vmwareengine_go_gapic_test",
+- srcs = [":vmwareengine_go_gapic_srcjar_test"],
+- embed = [":vmwareengine_go_gapic"],
+- importpath = "cloud.google.com/go/vmwareengine/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-vmwareengine-v1-go",
+- deps = [
+- ":vmwareengine_go_gapic",
+- ":vmwareengine_go_gapic_srcjar-test.srcjar",
+- ":vmwareengine_go_gapic_srcjar-metadata.srcjar",
+- ":vmwareengine_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "vmwareengine_py_gapic",
+- srcs = [":vmwareengine_proto"],
+- grpc_service_config = "vmwareengine_grpc_service_config.json",
+- service_yaml = "vmwareengine_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "vmwareengine_py_gapic_test",
+- srcs = [
+- "vmwareengine_py_gapic_pytest.py",
+- "vmwareengine_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":vmwareengine_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "vmwareengine-v1-py",
+- deps = [
+- ":vmwareengine_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "vmwareengine_php_proto",
+- deps = [":vmwareengine_proto"],
+-)
+-
+-php_grpc_library(
+- name = "vmwareengine_php_grpc",
+- srcs = [":vmwareengine_proto"],
+- deps = [":vmwareengine_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "vmwareengine_php_gapic",
+- srcs = [":vmwareengine_proto_with_info"],
+- grpc_service_config = "vmwareengine_grpc_service_config.json",
+- service_yaml = "vmwareengine_v1.yaml",
+- deps = [
+- ":vmwareengine_php_grpc",
+- ":vmwareengine_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-vmwareengine-v1-php",
+- deps = [
+- ":vmwareengine_php_gapic",
+- ":vmwareengine_php_grpc",
+- ":vmwareengine_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "vmwareengine_nodejs_gapic",
+- package_name = "@google-cloud/vmwareengine",
+- src = ":vmwareengine_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "vmwareengine_grpc_service_config.json",
+- package = "google.cloud.vmwareengine.v1",
+- service_yaml = "vmwareengine_v1.yaml",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "vmwareengine-v1-nodejs",
+- deps = [
+- ":vmwareengine_nodejs_gapic",
+- ":vmwareengine_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_gapic_assembly_pkg",
+- "ruby_cloud_gapic_library",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "vmwareengine_ruby_proto",
+- deps = [":vmwareengine_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "vmwareengine_ruby_grpc",
+- srcs = [":vmwareengine_proto"],
+- deps = [":vmwareengine_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "vmwareengine_ruby_gapic",
+- srcs = [":vmwareengine_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=vmwareengine.googleapis.com",
+- "ruby-cloud-api-shortname=vmwareengine",
+- "ruby-cloud-gem-name=google-cloud-vmware_engine-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/vmware-engine/",
+- ],
+- grpc_service_config = "vmwareengine_grpc_service_config.json",
+- service_yaml = "vmwareengine_v1.yaml",
+- ruby_cloud_description = "Google Cloud VMware Engine is a fully managed service that lets you run the VMware platform in Google Cloud. VMware Engine provides you with VMware operational continuity so you can benefit from a cloud consumption model and lower your total cost of ownership. VMware Engine also offers on-demand provisioning, pay-as-you-grow, and capacity optimization.",
+- ruby_cloud_title = "Google Cloud VMware Engine V1",
+- deps = [
+- ":vmwareengine_ruby_grpc",
+- ":vmwareengine_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-vmwareengine-v1-ruby",
+- deps = [
+- ":vmwareengine_ruby_gapic",
+- ":vmwareengine_ruby_grpc",
+- ":vmwareengine_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "vmwareengine_csharp_proto",
+- deps = [":vmwareengine_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "vmwareengine_csharp_grpc",
+- srcs = [":vmwareengine_proto"],
+- deps = [":vmwareengine_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "vmwareengine_csharp_gapic",
+- srcs = [":vmwareengine_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "vmwareengine_grpc_service_config.json",
+- service_yaml = "vmwareengine_v1.yaml",
+- deps = [
+- ":vmwareengine_csharp_grpc",
+- ":vmwareengine_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-vmwareengine-v1-csharp",
+- deps = [
+- ":vmwareengine_csharp_gapic",
+- ":vmwareengine_csharp_grpc",
+- ":vmwareengine_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "vmwareengine_cc_proto",
+- deps = [":vmwareengine_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "vmwareengine_cc_grpc",
+- srcs = [":vmwareengine_proto"],
+- grpc_only = True,
+- deps = [":vmwareengine_cc_proto"],
+-)
+diff -urN a/google/cloud/vpcaccess/BUILD.bazel b/google/cloud/vpcaccess/BUILD.bazel
+--- a/google/cloud/vpcaccess/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/vpcaccess/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-vpc_access.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for vpcaccess.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "vpcaccess_ruby_wrapper",
+- srcs = ["//google/cloud/vpcaccess/v1:vpcaccess_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-vpc_access",
+- "ruby-cloud-env-prefix=VPC_ACCESS",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/vpc/docs/serverless-vpc-access",
+- "ruby-cloud-api-id=vpcaccess.googleapis.com",
+- "ruby-cloud-api-shortname=vpcaccess",
+- ],
+- ruby_cloud_description = "Serverless VPC Access enables you to connect from a serverless environment on Google Cloud (Cloud Run, Cloud Functions, or the App Engine standard environment) directly to your VPC network. This connection makes it possible for your serverless environment to access Compute Engine VM instances, Memorystore instances, and any other resources with an internal IP address.",
+- ruby_cloud_title = "Serverless VPC Access",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-vpcaccess-ruby",
+- deps = [
+- ":vpcaccess_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/vpcaccess/v1/BUILD.bazel b/google/cloud/vpcaccess/v1/BUILD.bazel
+--- a/google/cloud/vpcaccess/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/vpcaccess/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,399 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "vpcaccess_proto",
+- srcs = [
+- "vpc_access.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "vpcaccess_proto_with_info",
+- deps = [
+- ":vpcaccess_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "vpcaccess_java_proto",
+- deps = [":vpcaccess_proto"],
+-)
+-
+-java_grpc_library(
+- name = "vpcaccess_java_grpc",
+- srcs = [":vpcaccess_proto"],
+- deps = [":vpcaccess_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "vpcaccess_java_gapic",
+- srcs = [":vpcaccess_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "vpcaccess_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "vpcaccess_v1.yaml",
+- test_deps = [
+- ":vpcaccess_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":vpcaccess_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "vpcaccess_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.vpcaccess.v1.VpcAccessServiceClientHttpJsonTest",
+- "com.google.cloud.vpcaccess.v1.VpcAccessServiceClientTest",
+- ],
+- runtime_deps = [":vpcaccess_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-vpcaccess-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":vpcaccess_java_gapic",
+- ":vpcaccess_java_grpc",
+- ":vpcaccess_java_proto",
+- ":vpcaccess_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "vpcaccess_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/vpcaccess/v1",
+- protos = [":vpcaccess_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "vpcaccess_go_gapic",
+- srcs = [":vpcaccess_proto_with_info"],
+- grpc_service_config = "vpcaccess_grpc_service_config.json",
+- importpath = "cloud.google.com/go/vpcaccess/apiv1;vpcaccess",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "vpcaccess_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":vpcaccess_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "vpcaccess_go_gapic_test",
+- srcs = [":vpcaccess_go_gapic_srcjar_test"],
+- embed = [":vpcaccess_go_gapic"],
+- importpath = "cloud.google.com/go/vpcaccess/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-vpcaccess-v1-go",
+- deps = [
+- ":vpcaccess_go_gapic",
+- ":vpcaccess_go_gapic_srcjar-metadata.srcjar",
+- ":vpcaccess_go_gapic_srcjar-test.srcjar",
+- ":vpcaccess_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "vpcaccess_py_gapic",
+- srcs = [":vpcaccess_proto"],
+- grpc_service_config = "vpcaccess_grpc_service_config.json",
+- opt_args = ["warehouse-package-name=google-cloud-vpc-access"],
+- rest_numeric_enums = False,
+- service_yaml = "vpcaccess_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "vpcaccess_py_gapic_test",
+- srcs = [
+- "vpcaccess_py_gapic_pytest.py",
+- "vpcaccess_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":vpcaccess_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "vpcaccess-v1-py",
+- deps = [
+- ":vpcaccess_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "vpcaccess_php_proto",
+- deps = [":vpcaccess_proto"],
+-)
+-
+-php_grpc_library(
+- name = "vpcaccess_php_grpc",
+- srcs = [":vpcaccess_proto"],
+- deps = [":vpcaccess_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "vpcaccess_php_gapic",
+- srcs = [":vpcaccess_proto_with_info"],
+- grpc_service_config = "vpcaccess_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "vpcaccess_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":vpcaccess_php_grpc",
+- ":vpcaccess_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-vpcaccess-v1-php",
+- deps = [
+- ":vpcaccess_php_gapic",
+- ":vpcaccess_php_grpc",
+- ":vpcaccess_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "vpcaccess_nodejs_gapic",
+- package_name = "@google-cloud/vpc-access",
+- src = ":vpcaccess_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "vpcaccess_grpc_service_config.json",
+- package = "google.cloud.vpcaccess.v1",
+- rest_numeric_enums = False,
+- service_yaml = "vpcaccess_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "vpcaccess-v1-nodejs",
+- deps = [
+- ":vpcaccess_nodejs_gapic",
+- ":vpcaccess_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "vpcaccess_ruby_proto",
+- deps = [":vpcaccess_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "vpcaccess_ruby_grpc",
+- srcs = [":vpcaccess_proto"],
+- deps = [":vpcaccess_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "vpcaccess_ruby_gapic",
+- srcs = [":vpcaccess_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=vpcaccess.googleapis.com",
+- "ruby-cloud-api-shortname=vpcaccess",
+- "ruby-cloud-env-prefix=VPC_ACCESS",
+- "ruby-cloud-gem-name=google-cloud-vpc_access-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/vpc/docs/serverless-vpc-access",
+- ],
+- grpc_service_config = "vpcaccess_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Serverless VPC Access enables you to connect from a serverless environment on Google Cloud (Cloud Run, Cloud Functions, or the App Engine standard environment) directly to your VPC network. This connection makes it possible for your serverless environment to access Compute Engine VM instances, Memorystore instances, and any other resources with an internal IP address.",
+- ruby_cloud_title = "Serverless VPC Access V1",
+- service_yaml = "vpcaccess_v1.yaml",
+- deps = [
+- ":vpcaccess_ruby_grpc",
+- ":vpcaccess_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-vpcaccess-v1-ruby",
+- deps = [
+- ":vpcaccess_ruby_gapic",
+- ":vpcaccess_ruby_grpc",
+- ":vpcaccess_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "vpcaccess_csharp_proto",
+- deps = [":vpcaccess_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "vpcaccess_csharp_grpc",
+- srcs = [":vpcaccess_proto"],
+- deps = [":vpcaccess_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "vpcaccess_csharp_gapic",
+- srcs = [":vpcaccess_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "vpcaccess_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "vpcaccess_v1.yaml",
+- deps = [
+- ":vpcaccess_csharp_grpc",
+- ":vpcaccess_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-vpcaccess-v1-csharp",
+- deps = [
+- ":vpcaccess_csharp_gapic",
+- ":vpcaccess_csharp_grpc",
+- ":vpcaccess_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "vpcaccess_cc_proto",
+- deps = [":vpcaccess_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "vpcaccess_cc_grpc",
+- srcs = [":vpcaccess_proto"],
+- grpc_only = True,
+- deps = [":vpcaccess_cc_proto"],
+-)
+diff -urN a/google/cloud/webrisk/BUILD.bazel b/google/cloud/webrisk/BUILD.bazel
+--- a/google/cloud/webrisk/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/webrisk/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-web_risk.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for webrisk.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "webrisk_ruby_wrapper",
+- srcs = ["//google/cloud/webrisk/v1:webrisk_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-web_risk",
+- "ruby-cloud-env-prefix=WEBRISK",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/web-risk",
+- "ruby-cloud-api-id=webrisk.googleapis.com",
+- "ruby-cloud-api-shortname=webrisk",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "Web Risk is an enterprise security product that lets your client applications check URLs against Google's constantly updated lists of unsafe web resources.",
+- ruby_cloud_title = "Web Risk",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-webrisk-ruby",
+- deps = [
+- ":webrisk_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/webrisk/v1/BUILD.bazel b/google/cloud/webrisk/v1/BUILD.bazel
+--- a/google/cloud/webrisk/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/webrisk/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,389 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "webrisk_proto",
+- srcs = [
+- "webrisk.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "webrisk_proto_with_info",
+- deps = [
+- ":webrisk_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "webrisk_java_proto",
+- deps = [":webrisk_proto"],
+-)
+-
+-java_grpc_library(
+- name = "webrisk_java_grpc",
+- srcs = [":webrisk_proto"],
+- deps = [":webrisk_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "webrisk_java_gapic",
+- srcs = [":webrisk_proto_with_info"],
+- gapic_yaml = "webrisk_gapic.yaml",
+- grpc_service_config = "webrisk_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "webrisk_v1.yaml",
+- test_deps = [
+- ":webrisk_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":webrisk_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "webrisk_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.webrisk.v1.WebRiskServiceClientHttpJsonTest",
+- "com.google.cloud.webrisk.v1.WebRiskServiceClientTest",
+- ],
+- runtime_deps = [":webrisk_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-webrisk-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":webrisk_java_gapic",
+- ":webrisk_java_grpc",
+- ":webrisk_java_proto",
+- ":webrisk_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "webrisk_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/webrisk/v1",
+- protos = [":webrisk_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "webrisk_go_gapic",
+- srcs = [":webrisk_proto_with_info"],
+- grpc_service_config = "webrisk_grpc_service_config.json",
+- importpath = "cloud.google.com/go/webrisk/apiv1;webrisk",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "webrisk_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":webrisk_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "webrisk_go_gapic_test",
+- srcs = [":webrisk_go_gapic_srcjar_test"],
+- embed = [":webrisk_go_gapic"],
+- importpath = "cloud.google.com/go/webrisk/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-webrisk-v1-go",
+- deps = [
+- ":webrisk_go_gapic",
+- ":webrisk_go_gapic_srcjar-metadata.srcjar",
+- ":webrisk_go_gapic_srcjar-test.srcjar",
+- ":webrisk_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "webrisk_py_gapic",
+- srcs = [":webrisk_proto"],
+- grpc_service_config = "webrisk_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "webrisk_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "webrisk_py_gapic_test",
+- srcs = [
+- "webrisk_py_gapic_pytest.py",
+- "webrisk_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":webrisk_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "webrisk-v1-py",
+- deps = [
+- ":webrisk_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "webrisk_php_proto",
+- deps = [":webrisk_proto"],
+-)
+-
+-php_grpc_library(
+- name = "webrisk_php_grpc",
+- srcs = [":webrisk_proto"],
+- deps = [":webrisk_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "webrisk_php_gapic",
+- srcs = [":webrisk_proto_with_info"],
+- grpc_service_config = "webrisk_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "webrisk_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":webrisk_php_grpc",
+- ":webrisk_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-webrisk-v1-php",
+- deps = [
+- ":webrisk_php_gapic",
+- ":webrisk_php_grpc",
+- ":webrisk_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "webrisk_nodejs_gapic",
+- package_name = "@google-cloud/web-risk",
+- src = ":webrisk_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "webrisk_grpc_service_config.json",
+- package = "google.cloud.webrisk.v1",
+- rest_numeric_enums = False,
+- service_yaml = "webrisk_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "webrisk-v1-nodejs",
+- deps = [
+- ":webrisk_nodejs_gapic",
+- ":webrisk_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "webrisk_ruby_proto",
+- deps = [":webrisk_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "webrisk_ruby_grpc",
+- srcs = [":webrisk_proto"],
+- deps = [":webrisk_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "webrisk_ruby_gapic",
+- srcs = [":webrisk_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=webrisk.googleapis.com",
+- "ruby-cloud-api-shortname=webrisk",
+- "ruby-cloud-env-prefix=WEBRISK",
+- "ruby-cloud-gem-name=google-cloud-web_risk-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/web-risk",
+- ],
+- grpc_service_config = "webrisk_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Web Risk is an enterprise security product that lets your client applications check URLs against Google's constantly updated lists of unsafe web resources.",
+- ruby_cloud_title = "Web Risk V1",
+- service_yaml = "webrisk_v1.yaml",
+- deps = [
+- ":webrisk_ruby_grpc",
+- ":webrisk_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-webrisk-v1-ruby",
+- deps = [
+- ":webrisk_ruby_gapic",
+- ":webrisk_ruby_grpc",
+- ":webrisk_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "webrisk_csharp_proto",
+- deps = [":webrisk_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "webrisk_csharp_grpc",
+- srcs = [":webrisk_proto"],
+- deps = [":webrisk_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "webrisk_csharp_gapic",
+- srcs = [":webrisk_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "webrisk_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "webrisk_v1.yaml",
+- deps = [
+- ":webrisk_csharp_grpc",
+- ":webrisk_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-webrisk-v1-csharp",
+- deps = [
+- ":webrisk_csharp_gapic",
+- ":webrisk_csharp_grpc",
+- ":webrisk_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "webrisk_cc_proto",
+- deps = [":webrisk_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "webrisk_cc_grpc",
+- srcs = [":webrisk_proto"],
+- grpc_only = True,
+- deps = [":webrisk_cc_proto"],
+-)
+diff -urN a/google/cloud/webrisk/v1beta1/BUILD.bazel b/google/cloud/webrisk/v1beta1/BUILD.bazel
+--- a/google/cloud/webrisk/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/webrisk/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,389 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "webrisk_proto",
+- srcs = [
+- "webrisk.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "webrisk_proto_with_info",
+- deps = [
+- ":webrisk_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "webrisk_java_proto",
+- deps = [":webrisk_proto"],
+-)
+-
+-java_grpc_library(
+- name = "webrisk_java_grpc",
+- srcs = [":webrisk_proto"],
+- deps = [":webrisk_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "webrisk_java_gapic",
+- srcs = [":webrisk_proto_with_info"],
+- gapic_yaml = "webrisk_gapic.yaml",
+- grpc_service_config = "webrisk_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "webrisk_v1beta1.yaml",
+- test_deps = [
+- ":webrisk_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":webrisk_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "webrisk_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1ClientHttpJsonTest",
+- "com.google.cloud.webrisk.v1beta1.WebRiskServiceV1Beta1ClientTest",
+- ],
+- runtime_deps = [":webrisk_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-webrisk-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":webrisk_java_gapic",
+- ":webrisk_java_grpc",
+- ":webrisk_java_proto",
+- ":webrisk_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "webrisk_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/webrisk/v1beta1",
+- protos = [":webrisk_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "webrisk_go_gapic",
+- srcs = [":webrisk_proto_with_info"],
+- grpc_service_config = "webrisk_grpc_service_config.json",
+- importpath = "cloud.google.com/go/webrisk/apiv1beta1;webrisk",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "webrisk_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":webrisk_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "webrisk_go_gapic_test",
+- srcs = [":webrisk_go_gapic_srcjar_test"],
+- embed = [":webrisk_go_gapic"],
+- importpath = "cloud.google.com/go/webrisk/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-webrisk-v1beta1-go",
+- deps = [
+- ":webrisk_go_gapic",
+- ":webrisk_go_gapic_srcjar-metadata.srcjar",
+- ":webrisk_go_gapic_srcjar-test.srcjar",
+- ":webrisk_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "webrisk_py_gapic",
+- srcs = [":webrisk_proto"],
+- grpc_service_config = "webrisk_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "webrisk_v1beta1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "webrisk_py_gapic_test",
+- srcs = [
+- "webrisk_py_gapic_pytest.py",
+- "webrisk_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":webrisk_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "webrisk-v1beta1-py",
+- deps = [
+- ":webrisk_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "webrisk_php_proto",
+- deps = [":webrisk_proto"],
+-)
+-
+-php_grpc_library(
+- name = "webrisk_php_grpc",
+- srcs = [":webrisk_proto"],
+- deps = [":webrisk_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "webrisk_php_gapic",
+- srcs = [":webrisk_proto_with_info"],
+- grpc_service_config = "webrisk_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "webrisk_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":webrisk_php_grpc",
+- ":webrisk_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-webrisk-v1beta1-php",
+- deps = [
+- ":webrisk_php_gapic",
+- ":webrisk_php_grpc",
+- ":webrisk_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "webrisk_nodejs_gapic",
+- package_name = "@google-cloud/web-risk",
+- src = ":webrisk_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "webrisk_grpc_service_config.json",
+- package = "google.cloud.webrisk.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "webrisk_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "webrisk-v1beta1-nodejs",
+- deps = [
+- ":webrisk_nodejs_gapic",
+- ":webrisk_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "webrisk_ruby_proto",
+- deps = [":webrisk_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "webrisk_ruby_grpc",
+- srcs = [":webrisk_proto"],
+- deps = [":webrisk_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "webrisk_ruby_gapic",
+- srcs = [":webrisk_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=webrisk.googleapis.com",
+- "ruby-cloud-api-shortname=webrisk",
+- "ruby-cloud-env-prefix=WEBRISK",
+- "ruby-cloud-gem-name=google-cloud-web_risk-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/web-risk",
+- "ruby-cloud-service-override=WebRiskServiceV1Beta1=WebRiskService",
+- ],
+- grpc_service_config = "webrisk_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Web Risk is an enterprise security product that lets your client applications check URLs against Google's constantly updated lists of unsafe web resources.",
+- ruby_cloud_title = "Web Risk V1beta1",
+- service_yaml = "webrisk_v1beta1.yaml",
+- deps = [
+- ":webrisk_ruby_grpc",
+- ":webrisk_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-webrisk-v1beta1-ruby",
+- deps = [
+- ":webrisk_ruby_gapic",
+- ":webrisk_ruby_grpc",
+- ":webrisk_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "webrisk_csharp_proto",
+- deps = [":webrisk_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "webrisk_csharp_grpc",
+- srcs = [":webrisk_proto"],
+- deps = [":webrisk_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "webrisk_csharp_gapic",
+- srcs = [":webrisk_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "webrisk_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "webrisk_v1beta1.yaml",
+- deps = [
+- ":webrisk_csharp_grpc",
+- ":webrisk_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-webrisk-v1beta1-csharp",
+- deps = [
+- ":webrisk_csharp_gapic",
+- ":webrisk_csharp_grpc",
+- ":webrisk_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "webrisk_cc_proto",
+- deps = [":webrisk_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "webrisk_cc_grpc",
+- srcs = [":webrisk_proto"],
+- grpc_only = True,
+- deps = [":webrisk_cc_proto"],
+-)
+diff -urN a/google/cloud/websecurityscanner/BUILD.bazel b/google/cloud/websecurityscanner/BUILD.bazel
+--- a/google/cloud/websecurityscanner/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/websecurityscanner/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-web_security_scanner.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for websecurityscanner.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "websecurityscanner_ruby_wrapper",
+- srcs = ["//google/cloud/websecurityscanner/v1:websecurityscanner_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-web_security_scanner",
+- "ruby-cloud-env-prefix=WEB_SECURITY_SCANNER",
+- "ruby-cloud-wrapper-of=v1:0.3;v1beta:0.3",
+- "ruby-cloud-product-url=https://cloud.google.com/security-command-center/docs/concepts-web-security-scanner-overview/",
+- "ruby-cloud-api-id=websecurityscanner.googleapis.com",
+- "ruby-cloud-api-shortname=websecurityscanner",
+- ],
+- ruby_cloud_description = "Web Security Scanner scans your Compute and App Engine apps for common web vulnerabilities.",
+- ruby_cloud_title = "Web Security Scanner",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-websecurityscanner-ruby",
+- deps = [
+- ":websecurityscanner_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/websecurityscanner/v1/BUILD.bazel b/google/cloud/websecurityscanner/v1/BUILD.bazel
+--- a/google/cloud/websecurityscanner/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/websecurityscanner/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,401 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "websecurityscanner_proto",
+- srcs = [
+- "crawled_url.proto",
+- "finding.proto",
+- "finding_addon.proto",
+- "finding_type_stats.proto",
+- "scan_config.proto",
+- "scan_config_error.proto",
+- "scan_run.proto",
+- "scan_run_error_trace.proto",
+- "scan_run_log.proto",
+- "scan_run_warning_trace.proto",
+- "web_security_scanner.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "websecurityscanner_proto_with_info",
+- deps = [
+- ":websecurityscanner_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "websecurityscanner_java_proto",
+- deps = [":websecurityscanner_proto"],
+-)
+-
+-java_grpc_library(
+- name = "websecurityscanner_java_grpc",
+- srcs = [":websecurityscanner_proto"],
+- deps = [":websecurityscanner_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "websecurityscanner_java_gapic",
+- srcs = [":websecurityscanner_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "websecurityscanner_v1.yaml",
+- test_deps = [
+- ":websecurityscanner_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":websecurityscanner_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "websecurityscanner_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.websecurityscanner.v1.WebSecurityScannerClientHttpJsonTest",
+- "com.google.cloud.websecurityscanner.v1.WebSecurityScannerClientTest",
+- ],
+- runtime_deps = [":websecurityscanner_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-websecurityscanner-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":websecurityscanner_java_gapic",
+- ":websecurityscanner_java_grpc",
+- ":websecurityscanner_java_proto",
+- ":websecurityscanner_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "websecurityscanner_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1",
+- protos = [":websecurityscanner_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "websecurityscanner_go_gapic",
+- srcs = [":websecurityscanner_proto_with_info"],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- importpath = "cloud.google.com/go/websecurityscanner/apiv1;websecurityscanner",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "websecurityscanner_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":websecurityscanner_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "websecurityscanner_go_gapic_test",
+- srcs = [":websecurityscanner_go_gapic_srcjar_test"],
+- embed = [":websecurityscanner_go_gapic"],
+- importpath = "cloud.google.com/go/websecurityscanner/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-websecurityscanner-v1-go",
+- deps = [
+- ":websecurityscanner_go_gapic",
+- ":websecurityscanner_go_gapic_srcjar-metadata.srcjar",
+- ":websecurityscanner_go_gapic_srcjar-test.srcjar",
+- ":websecurityscanner_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "websecurityscanner_py_gapic",
+- srcs = [":websecurityscanner_proto"],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "websecurityscanner_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "websecurityscanner_py_gapic_test",
+- srcs = [
+- "websecurityscanner_py_gapic_pytest.py",
+- "websecurityscanner_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":websecurityscanner_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "websecurityscanner-v1-py",
+- deps = [
+- ":websecurityscanner_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "websecurityscanner_php_proto",
+- deps = [":websecurityscanner_proto"],
+-)
+-
+-php_grpc_library(
+- name = "websecurityscanner_php_grpc",
+- srcs = [":websecurityscanner_proto"],
+- deps = [":websecurityscanner_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "websecurityscanner_php_gapic",
+- srcs = [":websecurityscanner_proto_with_info"],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "websecurityscanner_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":websecurityscanner_php_grpc",
+- ":websecurityscanner_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-websecurityscanner-v1-php",
+- deps = [
+- ":websecurityscanner_php_gapic",
+- ":websecurityscanner_php_grpc",
+- ":websecurityscanner_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "websecurityscanner_nodejs_gapic",
+- package_name = "@google-cloud/web-security-scanner",
+- src = ":websecurityscanner_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- package = "google.cloud.websecurityscanner.v1",
+- rest_numeric_enums = False,
+- service_yaml = "websecurityscanner_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "websecurityscanner-v1-nodejs",
+- deps = [
+- ":websecurityscanner_nodejs_gapic",
+- ":websecurityscanner_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "websecurityscanner_ruby_proto",
+- deps = [":websecurityscanner_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "websecurityscanner_ruby_grpc",
+- srcs = [":websecurityscanner_proto"],
+- deps = [":websecurityscanner_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "websecurityscanner_ruby_gapic",
+- srcs = [":websecurityscanner_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=websecurityscanner.googleapis.com",
+- "ruby-cloud-api-shortname=websecurityscanner",
+- "ruby-cloud-env-prefix=WEB_SECURITY_SCANNER",
+- "ruby-cloud-gem-name=google-cloud-web_security_scanner-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/security-command-center/docs/concepts-web-security-scanner-overview/",
+- ],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Web Security Scanner scans your Compute and App Engine apps for common web vulnerabilities.",
+- ruby_cloud_title = "Web Security Scanner V1",
+- service_yaml = "websecurityscanner_v1.yaml",
+- deps = [
+- ":websecurityscanner_ruby_grpc",
+- ":websecurityscanner_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-websecurityscanner-v1-ruby",
+- deps = [
+- ":websecurityscanner_ruby_gapic",
+- ":websecurityscanner_ruby_grpc",
+- ":websecurityscanner_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "websecurityscanner_csharp_proto",
+- deps = [":websecurityscanner_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "websecurityscanner_csharp_grpc",
+- srcs = [":websecurityscanner_proto"],
+- deps = [":websecurityscanner_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "websecurityscanner_csharp_gapic",
+- srcs = [":websecurityscanner_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "websecurityscanner_v1.yaml",
+- deps = [
+- ":websecurityscanner_csharp_grpc",
+- ":websecurityscanner_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-websecurityscanner-v1-csharp",
+- deps = [
+- ":websecurityscanner_csharp_gapic",
+- ":websecurityscanner_csharp_grpc",
+- ":websecurityscanner_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "websecurityscanner_cc_proto",
+- deps = [":websecurityscanner_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "websecurityscanner_cc_grpc",
+- srcs = [":websecurityscanner_proto"],
+- grpc_only = True,
+- deps = [":websecurityscanner_cc_proto"],
+-)
+diff -urN a/google/cloud/websecurityscanner/v1alpha/BUILD.bazel b/google/cloud/websecurityscanner/v1alpha/BUILD.bazel
+--- a/google/cloud/websecurityscanner/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/websecurityscanner/v1alpha/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,352 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "websecurityscanner_proto",
+- srcs = [
+- "crawled_url.proto",
+- "finding.proto",
+- "finding_addon.proto",
+- "finding_type_stats.proto",
+- "scan_config.proto",
+- "scan_run.proto",
+- "web_security_scanner.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "websecurityscanner_proto_with_info",
+- deps = [
+- ":websecurityscanner_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "websecurityscanner_java_proto",
+- deps = [":websecurityscanner_proto"],
+-)
+-
+-java_grpc_library(
+- name = "websecurityscanner_java_grpc",
+- srcs = [":websecurityscanner_proto"],
+- deps = [":websecurityscanner_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "websecurityscanner_java_gapic",
+- srcs = [":websecurityscanner_proto_with_info"],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":websecurityscanner_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":websecurityscanner_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "websecurityscanner_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClientHttpJsonTest",
+- "com.google.cloud.websecurityscanner.v1alpha.WebSecurityScannerClientTest",
+- ],
+- runtime_deps = [":websecurityscanner_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-websecurityscanner-v1alpha-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":websecurityscanner_java_gapic",
+- ":websecurityscanner_java_grpc",
+- ":websecurityscanner_java_proto",
+- ":websecurityscanner_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "websecurityscanner_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha",
+- protos = [":websecurityscanner_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "websecurityscanner_go_gapic",
+- srcs = [":websecurityscanner_proto_with_info"],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- importpath = "cloud.google.com/go/cloud/websecurityscanner/apiv1alpha;websecurityscanner",
+- rest_numeric_enums = False,
+- service_yaml = "websecurityscanner_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":websecurityscanner_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "websecurityscanner_go_gapic_test",
+- srcs = [":websecurityscanner_go_gapic_srcjar_test"],
+- embed = [":websecurityscanner_go_gapic"],
+- importpath = "cloud.google.com/go/cloud/websecurityscanner/apiv1alpha",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-websecurityscanner-v1alpha-go",
+- deps = [
+- ":websecurityscanner_go_gapic",
+- ":websecurityscanner_go_gapic_srcjar-test.srcjar",
+- ":websecurityscanner_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "websecurityscanner_py_gapic",
+- srcs = [":websecurityscanner_proto"],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "websecurityscanner_py_gapic_test",
+- srcs = [
+- "websecurityscanner_py_gapic_pytest.py",
+- "websecurityscanner_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":websecurityscanner_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "websecurityscanner-v1alpha-py",
+- deps = [
+- ":websecurityscanner_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "websecurityscanner_php_proto",
+- deps = [":websecurityscanner_proto"],
+-)
+-
+-php_grpc_library(
+- name = "websecurityscanner_php_grpc",
+- srcs = [":websecurityscanner_proto"],
+- deps = [":websecurityscanner_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "websecurityscanner_php_gapic",
+- srcs = [":websecurityscanner_proto_with_info"],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":websecurityscanner_php_grpc",
+- ":websecurityscanner_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-websecurityscanner-v1alpha-php",
+- deps = [
+- ":websecurityscanner_php_gapic",
+- ":websecurityscanner_php_grpc",
+- ":websecurityscanner_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "websecurityscanner_nodejs_gapic",
+- package_name = "@google-cloud/web-security-scanner",
+- src = ":websecurityscanner_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- package = "google.cloud.websecurityscanner.v1alpha",
+- rest_numeric_enums = False,
+- service_yaml = "websecurityscanner_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "websecurityscanner-v1alpha-nodejs",
+- deps = [
+- ":websecurityscanner_nodejs_gapic",
+- ":websecurityscanner_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "websecurityscanner_ruby_proto",
+- deps = [":websecurityscanner_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "websecurityscanner_ruby_grpc",
+- srcs = [":websecurityscanner_proto"],
+- deps = [":websecurityscanner_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "websecurityscanner_ruby_gapic",
+- srcs = [":websecurityscanner_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-websecurityscanner-v1alpha"],
+- rest_numeric_enums = False,
+- deps = [
+- ":websecurityscanner_ruby_grpc",
+- ":websecurityscanner_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-websecurityscanner-v1alpha-ruby",
+- deps = [
+- ":websecurityscanner_ruby_gapic",
+- ":websecurityscanner_ruby_grpc",
+- ":websecurityscanner_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "websecurityscanner_csharp_proto",
+- deps = [":websecurityscanner_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "websecurityscanner_csharp_grpc",
+- srcs = [":websecurityscanner_proto"],
+- deps = [":websecurityscanner_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "websecurityscanner_csharp_gapic",
+- srcs = [":websecurityscanner_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "websecurityscanner_v1alpha.yaml",
+- deps = [
+- ":websecurityscanner_csharp_grpc",
+- ":websecurityscanner_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-websecurityscanner-v1alpha-csharp",
+- deps = [
+- ":websecurityscanner_csharp_gapic",
+- ":websecurityscanner_csharp_grpc",
+- ":websecurityscanner_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/websecurityscanner/v1beta/BUILD.bazel b/google/cloud/websecurityscanner/v1beta/BUILD.bazel
+--- a/google/cloud/websecurityscanner/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/websecurityscanner/v1beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,364 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "websecurityscanner_proto",
+- srcs = [
+- "crawled_url.proto",
+- "finding.proto",
+- "finding_addon.proto",
+- "finding_type_stats.proto",
+- "scan_config.proto",
+- "scan_config_error.proto",
+- "scan_run.proto",
+- "scan_run_error_trace.proto",
+- "scan_run_warning_trace.proto",
+- "web_security_scanner.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "websecurityscanner_proto_with_info",
+- deps = [
+- ":websecurityscanner_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "websecurityscanner_java_proto",
+- deps = [":websecurityscanner_proto"],
+-)
+-
+-java_grpc_library(
+- name = "websecurityscanner_java_grpc",
+- srcs = [":websecurityscanner_proto"],
+- deps = [":websecurityscanner_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "websecurityscanner_java_gapic",
+- srcs = [":websecurityscanner_proto_with_info"],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":websecurityscanner_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":websecurityscanner_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "websecurityscanner_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.websecurityscanner.v1beta.WebSecurityScannerClientHttpJsonTest",
+- "com.google.cloud.websecurityscanner.v1beta.WebSecurityScannerClientTest",
+- ],
+- runtime_deps = [":websecurityscanner_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-websecurityscanner-v1beta-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":websecurityscanner_java_gapic",
+- ":websecurityscanner_java_grpc",
+- ":websecurityscanner_java_proto",
+- ":websecurityscanner_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "websecurityscanner_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta",
+- protos = [":websecurityscanner_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "websecurityscanner_go_gapic",
+- srcs = [":websecurityscanner_proto_with_info"],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- importpath = "cloud.google.com/go/websecurityscanner/apiv1beta;websecurityscanner",
+- rest_numeric_enums = False,
+- service_yaml = "websecurityscanner_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":websecurityscanner_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "websecurityscanner_go_gapic_test",
+- srcs = [":websecurityscanner_go_gapic_srcjar_test"],
+- embed = [":websecurityscanner_go_gapic"],
+- importpath = "cloud.google.com/go/websecurityscanner/apiv1beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-websecurityscanner-v1beta-go",
+- deps = [
+- ":websecurityscanner_go_gapic",
+- ":websecurityscanner_go_gapic_srcjar-test.srcjar",
+- ":websecurityscanner_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "websecurityscanner_py_gapic",
+- srcs = [":websecurityscanner_proto"],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "websecurityscanner_py_gapic_test",
+- srcs = [
+- "websecurityscanner_py_gapic_pytest.py",
+- "websecurityscanner_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":websecurityscanner_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "websecurityscanner-v1beta-py",
+- deps = [
+- ":websecurityscanner_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "websecurityscanner_php_proto",
+- deps = [":websecurityscanner_proto"],
+-)
+-
+-php_grpc_library(
+- name = "websecurityscanner_php_grpc",
+- srcs = [":websecurityscanner_proto"],
+- deps = [":websecurityscanner_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "websecurityscanner_php_gapic",
+- srcs = [":websecurityscanner_proto_with_info"],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":websecurityscanner_php_grpc",
+- ":websecurityscanner_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-websecurityscanner-v1beta-php",
+- deps = [
+- ":websecurityscanner_php_gapic",
+- ":websecurityscanner_php_grpc",
+- ":websecurityscanner_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "websecurityscanner_nodejs_gapic",
+- package_name = "@google-cloud/web-security-scanner",
+- src = ":websecurityscanner_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- package = "google.cloud.websecurityscanner.v1beta",
+- rest_numeric_enums = False,
+- service_yaml = "websecurityscanner_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "websecurityscanner-v1beta-nodejs",
+- deps = [
+- ":websecurityscanner_nodejs_gapic",
+- ":websecurityscanner_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "websecurityscanner_ruby_proto",
+- deps = [":websecurityscanner_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "websecurityscanner_ruby_grpc",
+- srcs = [":websecurityscanner_proto"],
+- deps = [":websecurityscanner_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "websecurityscanner_ruby_gapic",
+- srcs = [":websecurityscanner_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-web_security_scanner-v1beta",
+- "ruby-cloud-env-prefix=WEB_SECURITY_SCANNER",
+- "ruby-cloud-product-url=https://cloud.google.com/security-command-center/docs/concepts-web-security-scanner-overview/",
+- "ruby-cloud-api-id=websecurityscanner.googleapis.com",
+- "ruby-cloud-api-shortname=websecurityscanner",
+- ],
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Web Security Scanner scans your Compute and App Engine apps for common web vulnerabilities.",
+- ruby_cloud_title = "Web Security Scanner V1beta",
+- deps = [
+- ":websecurityscanner_ruby_grpc",
+- ":websecurityscanner_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-websecurityscanner-v1beta-ruby",
+- deps = [
+- ":websecurityscanner_ruby_gapic",
+- ":websecurityscanner_ruby_grpc",
+- ":websecurityscanner_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "websecurityscanner_csharp_proto",
+- deps = [":websecurityscanner_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "websecurityscanner_csharp_grpc",
+- srcs = [":websecurityscanner_proto"],
+- deps = [":websecurityscanner_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "websecurityscanner_csharp_gapic",
+- srcs = [":websecurityscanner_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "websecurityscanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "websecurityscanner_v1beta.yaml",
+- deps = [
+- ":websecurityscanner_csharp_grpc",
+- ":websecurityscanner_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-websecurityscanner-v1beta-csharp",
+- deps = [
+- ":websecurityscanner_csharp_gapic",
+- ":websecurityscanner_csharp_grpc",
+- ":websecurityscanner_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/workflows/BUILD.bazel b/google/cloud/workflows/BUILD.bazel
+--- a/google/cloud/workflows/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/workflows/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-workflows.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for workflowexecutions.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "workflows_ruby_wrapper",
+- srcs = ["//google/cloud/workflows/v1:workflows_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-workflows",
+- "ruby-cloud-env-prefix=WORKFLOWS",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/workflows/",
+- "ruby-cloud-api-id=workflows.googleapis.com",
+- "ruby-cloud-api-shortname=workflows",
+- ],
+- ruby_cloud_description = "Workflows link series of serverless tasks together in an order you define. Combine the power of Google Cloud's APIs, serverless products like Cloud Functions and Cloud Run, and calls to external APIs to create flexible serverless applications. Workflows requires no infrastructure management and scales seamlessly with demand, including scaling down to zero.",
+- ruby_cloud_title = "Workflows",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-workflows-ruby",
+- deps = [
+- ":workflows_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/workflows/executions/BUILD.bazel b/google/cloud/workflows/executions/BUILD.bazel
+--- a/google/cloud/workflows/executions/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/workflows/executions/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-workflows-executions.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for workflowexecutions.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "workflowexecutions_ruby_wrapper",
+- srcs = ["//google/cloud/workflows/executions/v1:executions_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-workflows-executions",
+- "ruby-cloud-env-prefix=WORKFLOWS",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/workflows/",
+- "ruby-cloud-api-id=workflowexecutions.googleapis.com",
+- "ruby-cloud-api-shortname=workflowexecutions",
+- ],
+- ruby_cloud_description = "Workflows link series of serverless tasks together in an order you define. Combine the power of Google Cloud's APIs, serverless products like Cloud Functions and Cloud Run, and calls to external APIs to create flexible serverless applications. Workflows requires no infrastructure management and scales seamlessly with demand, including scaling down to zero.",
+- ruby_cloud_title = "Workflows Executions",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-workflows-executions-ruby",
+- deps = [
+- ":workflowexecutions_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/cloud/workflows/executions/v1/BUILD.bazel b/google/cloud/workflows/executions/v1/BUILD.bazel
+--- a/google/cloud/workflows/executions/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/workflows/executions/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,386 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "executions_proto",
+- srcs = [
+- "executions.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "executions_proto_with_info",
+- deps = [
+- ":executions_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "executions_java_proto",
+- deps = [":executions_proto"],
+-)
+-
+-java_grpc_library(
+- name = "executions_java_grpc",
+- srcs = [":executions_proto"],
+- deps = [":executions_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "executions_java_gapic",
+- srcs = [":executions_proto_with_info"],
+- gapic_yaml = "executions_gapic.yaml",
+- grpc_service_config = "executions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "workflowexecutions_v1.yaml",
+- test_deps = [
+- ":executions_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":executions_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "executions_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.workflows.executions.v1.ExecutionsClientHttpJsonTest",
+- "com.google.cloud.workflows.executions.v1.ExecutionsClientTest",
+- ],
+- runtime_deps = [":executions_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-workflows-executions-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":executions_java_gapic",
+- ":executions_java_grpc",
+- ":executions_java_proto",
+- ":executions_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "executions_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/workflows/executions/v1",
+- protos = [":executions_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "executions_go_gapic",
+- srcs = [":executions_proto_with_info"],
+- grpc_service_config = "executions_grpc_service_config.json",
+- importpath = "cloud.google.com/go/workflows/executions/apiv1;executions",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "workflowexecutions_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":executions_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "executions_go_gapic_test",
+- srcs = [":executions_go_gapic_srcjar_test"],
+- embed = [":executions_go_gapic"],
+- importpath = "cloud.google.com/go/workflows/executions/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-workflows-executions-v1-go",
+- deps = [
+- ":executions_go_gapic",
+- ":executions_go_gapic_srcjar-metadata.srcjar",
+- ":executions_go_gapic_srcjar-test.srcjar",
+- ":executions_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "executions_py_gapic",
+- srcs = [":executions_proto"],
+- grpc_service_config = "executions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "executions_py_gapic_test",
+- srcs = [
+- "executions_py_gapic_pytest.py",
+- "executions_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":executions_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "workflows-executions-v1-py",
+- deps = [
+- ":executions_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "executions_php_proto",
+- deps = [":executions_proto"],
+-)
+-
+-php_grpc_library(
+- name = "executions_php_grpc",
+- srcs = [":executions_proto"],
+- deps = [":executions_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "executions_php_gapic",
+- srcs = [":executions_proto_with_info"],
+- grpc_service_config = "executions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "workflowexecutions_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":executions_php_grpc",
+- ":executions_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-workflows-executions-v1-php",
+- deps = [
+- ":executions_php_gapic",
+- ":executions_php_grpc",
+- ":executions_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "executions_nodejs_gapic",
+- package_name = "@google-cloud/workflow-executions",
+- src = ":executions_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "executions_grpc_service_config.json",
+- package = "google.cloud.workflows.executions.v1",
+- rest_numeric_enums = False,
+- service_yaml = "workflowexecutions_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "workflows-executions-v1-nodejs",
+- deps = [
+- ":executions_nodejs_gapic",
+- ":executions_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "executions_ruby_proto",
+- deps = [":executions_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "executions_ruby_grpc",
+- srcs = [":executions_proto"],
+- deps = [":executions_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "executions_ruby_gapic",
+- srcs = [":executions_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=workflowexecutions.googleapis.com",
+- "ruby-cloud-api-shortname=workflowexecutions",
+- "ruby-cloud-env-prefix=WORKFLOWS",
+- "ruby-cloud-gem-name=google-cloud-workflows-executions-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/workflows/",
+- "ruby-cloud-wrapper-gem-override=google-cloud-workflows",
+- ],
+- grpc_service_config = "executions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Workflows link series of serverless tasks together in an order you define. Combine the power of Google Cloud's APIs, serverless products like Cloud Functions and Cloud Run, and calls to external APIs to create flexible serverless applications. Workflows requires no infrastructure management and scales seamlessly with demand, including scaling down to zero..",
+- ruby_cloud_title = "Workflows Executions V1",
+- deps = [
+- ":executions_ruby_grpc",
+- ":executions_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-workflows-executions-v1-ruby",
+- deps = [
+- ":executions_ruby_gapic",
+- ":executions_ruby_grpc",
+- ":executions_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "executions_csharp_proto",
+- deps = [":executions_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "executions_csharp_grpc",
+- srcs = [":executions_proto"],
+- deps = [":executions_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "executions_csharp_gapic",
+- srcs = [":executions_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "executions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "workflowexecutions_v1.yaml",
+- deps = [
+- ":executions_csharp_grpc",
+- ":executions_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-workflows-executions-v1-csharp",
+- deps = [
+- ":executions_csharp_gapic",
+- ":executions_csharp_grpc",
+- ":executions_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "executions_cc_proto",
+- deps = [":executions_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "executions_cc_grpc",
+- srcs = [":executions_proto"],
+- grpc_only = True,
+- deps = [":executions_cc_proto"],
+-)
+diff -urN a/google/cloud/workflows/executions/v1beta/BUILD.bazel b/google/cloud/workflows/executions/v1beta/BUILD.bazel
+--- a/google/cloud/workflows/executions/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/workflows/executions/v1beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,356 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "executions_proto",
+- srcs = [
+- "executions.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "executions_proto_with_info",
+- deps = [
+- ":executions_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "executions_java_proto",
+- deps = [":executions_proto"],
+-)
+-
+-java_grpc_library(
+- name = "executions_java_grpc",
+- srcs = [":executions_proto"],
+- deps = [":executions_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "executions_java_gapic",
+- srcs = [":executions_proto_with_info"],
+- grpc_service_config = "executions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":executions_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":executions_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "executions_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.workflows.executions.v1beta.ExecutionsClientHttpJsonTest",
+- "com.google.cloud.workflows.executions.v1beta.ExecutionsClientTest",
+- ],
+- runtime_deps = [":executions_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-workflows-executions-v1beta-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":executions_java_gapic",
+- ":executions_java_grpc",
+- ":executions_java_proto",
+- ":executions_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "executions_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/workflows/executions/v1beta",
+- protos = [":executions_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "executions_go_gapic",
+- srcs = [":executions_proto_with_info"],
+- grpc_service_config = "executions_grpc_service_config.json",
+- importpath = "cloud.google.com/go/workflows/executions/apiv1beta;executions",
+- rest_numeric_enums = False,
+- service_yaml = "workflowexecutions_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":executions_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "executions_go_gapic_test",
+- srcs = [":executions_go_gapic_srcjar_test"],
+- embed = [":executions_go_gapic"],
+- importpath = "cloud.google.com/go/workflows/executions/apiv1beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-workflows-executions-v1beta-go",
+- deps = [
+- ":executions_go_gapic",
+- ":executions_go_gapic_srcjar-test.srcjar",
+- ":executions_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "executions_py_gapic",
+- srcs = [":executions_proto"],
+- grpc_service_config = "executions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "executions_py_gapic_test",
+- srcs = [
+- "executions_py_gapic_pytest.py",
+- "executions_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":executions_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "workflows-executions-v1beta-py",
+- deps = [
+- ":executions_py_gapic",
+- ":executions_py_grpc",
+- ":executions_py_proto",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "executions_php_proto",
+- deps = [":executions_proto"],
+-)
+-
+-php_grpc_library(
+- name = "executions_php_grpc",
+- srcs = [":executions_proto"],
+- deps = [":executions_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "executions_php_gapic",
+- srcs = [":executions_proto_with_info"],
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":executions_php_grpc",
+- ":executions_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-workflows-executions-v1beta-php",
+- deps = [
+- ":executions_php_gapic",
+- ":executions_php_grpc",
+- ":executions_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "executions_nodejs_gapic",
+- package_name = "@google-cloud/workflows-executions",
+- src = ":executions_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- gapic_yaml = "executions_gapic.yaml",
+- package = "google.cloud.workflows.executions.v1beta",
+- rest_numeric_enums = False,
+- service_yaml = "workflowexecutions_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "workflows-executions-v1beta-nodejs",
+- deps = [
+- ":executions_nodejs_gapic",
+- ":executions_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "executions_ruby_proto",
+- deps = [":executions_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "executions_ruby_grpc",
+- srcs = [":executions_proto"],
+- deps = [":executions_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "executions_ruby_gapic",
+- srcs = [":executions_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-workflows-executions-v1beta",
+- "ruby-cloud-env-prefix=WORKFLOWS",
+- "ruby-cloud-product-url=https://cloud.google.com/workflows/",
+- "ruby-cloud-api-id=workflowexecutions.googleapis.com",
+- "ruby-cloud-api-shortname=workflowexecutions",
+- "ruby-cloud-wrapper-gem-override=google-cloud-workflows",
+- ],
+- grpc_service_config = "executions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Workflows link series of serverless tasks together in an order you define. Combine the power of Google Cloud's APIs, serverless products like Cloud Functions and Cloud Run, and calls to external APIs to create flexible serverless applications. Workflows requires no infrastructure management and scales seamlessly with demand, including scaling down to zero..",
+- ruby_cloud_title = "Workflows Executions V1beta",
+- deps = [
+- ":executions_ruby_grpc",
+- ":executions_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-workflows-executions-v1beta-ruby",
+- deps = [
+- ":executions_ruby_gapic",
+- ":executions_ruby_grpc",
+- ":executions_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "executions_csharp_proto",
+- deps = [":executions_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "executions_csharp_grpc",
+- srcs = [":executions_proto"],
+- deps = [":executions_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "executions_csharp_gapic",
+- srcs = [":executions_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "executions_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "workflowexecutions_v1beta.yaml",
+- deps = [
+- ":executions_csharp_grpc",
+- ":executions_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-workflows-executions-v1beta-csharp",
+- deps = [
+- ":executions_csharp_gapic",
+- ":executions_csharp_grpc",
+- ":executions_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/cloud/workflows/type/BUILD.bazel b/google/cloud/workflows/type/BUILD.bazel
+--- a/google/cloud/workflows/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/workflows/type/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,180 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "type_proto",
+- srcs = [
+- "engine_call.proto",
+- "executions_system.proto",
+- ],
+- deps = [
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "type_java_proto",
+- deps = [":type_proto"],
+-)
+-
+-java_grpc_library(
+- name = "type_java_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "type_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/workflows/type",
+- protos = [":type_proto"],
+- deps = [
+-
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "type_moved_proto",
+- srcs = [":type_proto"],
+- deps = [
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "type_py_proto",
+- deps = [":type_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "type_py_grpc",
+- srcs = [":type_moved_proto"],
+- deps = [":type_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "type_php_proto",
+- deps = [":type_proto"],
+-)
+-
+-php_grpc_library(
+- name = "type_php_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "type_ruby_proto",
+- deps = [":type_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "type_ruby_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "type_csharp_proto",
+- deps = [":type_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "type_csharp_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "type_cc_proto",
+- deps = [":type_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "type_cc_grpc",
+- srcs = [":type_proto"],
+- grpc_only = True,
+- deps = [":type_cc_proto"],
+-)
+diff -urN a/google/cloud/workflows/v1/BUILD.bazel b/google/cloud/workflows/v1/BUILD.bazel
+--- a/google/cloud/workflows/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/workflows/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,391 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "workflows_proto",
+- srcs = [
+- "workflows.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "workflows_proto_with_info",
+- deps = [
+- ":workflows_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "workflows_java_proto",
+- deps = [":workflows_proto"],
+-)
+-
+-java_grpc_library(
+- name = "workflows_java_grpc",
+- srcs = [":workflows_proto"],
+- deps = [":workflows_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "workflows_java_gapic",
+- srcs = [":workflows_proto_with_info"],
+- gapic_yaml = "workflows_gapic.yaml",
+- grpc_service_config = "workflows_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "workflows_v1.yaml",
+- test_deps = [
+- ":workflows_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":workflows_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "workflows_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.workflows.v1.WorkflowsClientHttpJsonTest",
+- "com.google.cloud.workflows.v1.WorkflowsClientTest",
+- ],
+- runtime_deps = [":workflows_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-workflows-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":workflows_java_gapic",
+- ":workflows_java_grpc",
+- ":workflows_java_proto",
+- ":workflows_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "workflows_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/workflows/v1",
+- protos = [":workflows_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "workflows_go_gapic",
+- srcs = [":workflows_proto_with_info"],
+- grpc_service_config = "workflows_grpc_service_config.json",
+- importpath = "cloud.google.com/go/workflows/apiv1;workflows",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "workflows_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":workflows_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "workflows_go_gapic_test",
+- srcs = [":workflows_go_gapic_srcjar_test"],
+- embed = [":workflows_go_gapic"],
+- importpath = "cloud.google.com/go/workflows/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-workflows-v1-go",
+- deps = [
+- ":workflows_go_gapic",
+- ":workflows_go_gapic_srcjar-metadata.srcjar",
+- ":workflows_go_gapic_srcjar-test.srcjar",
+- ":workflows_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "workflows_py_gapic",
+- srcs = [":workflows_proto"],
+- grpc_service_config = "workflows_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "workflows_py_gapic_test",
+- srcs = [
+- "workflows_py_gapic_pytest.py",
+- "workflows_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":workflows_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "workflows-v1-py",
+- deps = [
+- ":workflows_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "workflows_php_proto",
+- deps = [":workflows_proto"],
+-)
+-
+-php_grpc_library(
+- name = "workflows_php_grpc",
+- srcs = [":workflows_proto"],
+- deps = [":workflows_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "workflows_php_gapic",
+- srcs = [":workflows_proto_with_info"],
+- grpc_service_config = "workflows_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "workflows_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":workflows_php_grpc",
+- ":workflows_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-workflows-v1-php",
+- deps = [
+- ":workflows_php_gapic",
+- ":workflows_php_grpc",
+- ":workflows_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "workflows_nodejs_gapic",
+- package_name = "@google-cloud/workflows",
+- src = ":workflows_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "workflows_grpc_service_config.json",
+- package = "google.cloud.workflows.v1",
+- rest_numeric_enums = False,
+- service_yaml = "workflows_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "workflows-v1-nodejs",
+- deps = [
+- ":workflows_nodejs_gapic",
+- ":workflows_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "workflows_ruby_proto",
+- deps = [":workflows_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "workflows_ruby_grpc",
+- srcs = [":workflows_proto"],
+- deps = [":workflows_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "workflows_ruby_gapic",
+- srcs = [":workflows_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=workflows.googleapis.com",
+- "ruby-cloud-api-shortname=workflows",
+- "ruby-cloud-env-prefix=WORKFLOWS",
+- "ruby-cloud-gem-name=google-cloud-workflows-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/workflows/",
+- ],
+- grpc_service_config = "workflows_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Workflows link series of serverless tasks together in an order you define. Combine the power of Google Cloud's APIs, serverless products like Cloud Functions and Cloud Run, and calls to external APIs to create flexible serverless applications. Workflows requires no infrastructure management and scales seamlessly with demand, including scaling down to zero..",
+- ruby_cloud_title = "Workflows V1",
+- deps = [
+- ":workflows_ruby_grpc",
+- ":workflows_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-workflows-v1-ruby",
+- deps = [
+- ":workflows_ruby_gapic",
+- ":workflows_ruby_grpc",
+- ":workflows_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "workflows_csharp_proto",
+- deps = [":workflows_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "workflows_csharp_grpc",
+- srcs = [":workflows_proto"],
+- deps = [":workflows_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "workflows_csharp_gapic",
+- srcs = [":workflows_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "workflows_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "workflows_v1.yaml",
+- deps = [
+- ":workflows_csharp_grpc",
+- ":workflows_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-workflows-v1-csharp",
+- deps = [
+- ":workflows_csharp_gapic",
+- ":workflows_csharp_grpc",
+- ":workflows_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "workflows_cc_proto",
+- deps = [":workflows_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "workflows_cc_grpc",
+- srcs = [":workflows_proto"],
+- grpc_only = True,
+- deps = [":workflows_cc_proto"],
+-)
+diff -urN a/google/cloud/workflows/v1beta/BUILD.bazel b/google/cloud/workflows/v1beta/BUILD.bazel
+--- a/google/cloud/workflows/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/cloud/workflows/v1beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,361 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "workflows_proto",
+- srcs = [
+- "workflows.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "workflows_proto_with_info",
+- deps = [
+- ":workflows_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "workflows_java_proto",
+- deps = [":workflows_proto"],
+-)
+-
+-java_grpc_library(
+- name = "workflows_java_grpc",
+- srcs = [":workflows_proto"],
+- deps = [":workflows_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "workflows_java_gapic",
+- srcs = [":workflows_proto_with_info"],
+- grpc_service_config = "workflows_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":workflows_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":workflows_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "workflows_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.workflows.v1beta.WorkflowsClientHttpJsonTest",
+- "com.google.cloud.workflows.v1beta.WorkflowsClientTest",
+- ],
+- runtime_deps = [":workflows_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-workflows-v1beta-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":workflows_java_gapic",
+- ":workflows_java_grpc",
+- ":workflows_java_proto",
+- ":workflows_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "workflows_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/cloud/workflows/v1beta",
+- protos = [":workflows_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "workflows_go_gapic",
+- srcs = [":workflows_proto_with_info"],
+- grpc_service_config = "workflows_grpc_service_config.json",
+- importpath = "cloud.google.com/go/workflows/apiv1beta;workflows",
+- rest_numeric_enums = False,
+- service_yaml = "workflows_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":workflows_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "workflows_go_gapic_test",
+- srcs = [":workflows_go_gapic_srcjar_test"],
+- embed = [":workflows_go_gapic"],
+- importpath = "cloud.google.com/go/workflows/apiv1beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-workflows-v1beta-go",
+- deps = [
+- ":workflows_go_gapic",
+- ":workflows_go_gapic_srcjar-test.srcjar",
+- ":workflows_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "workflows_py_gapic",
+- srcs = [":workflows_proto"],
+- grpc_service_config = "workflows_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "workflows_py_gapic_test",
+- srcs = [
+- "workflows_py_gapic_pytest.py",
+- "workflows_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":workflows_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "workflows-v1beta-py",
+- deps = [
+- ":workflows_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "workflows_php_proto",
+- deps = [":workflows_proto"],
+-)
+-
+-php_grpc_library(
+- name = "workflows_php_grpc",
+- srcs = [":workflows_proto"],
+- deps = [":workflows_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "workflows_php_gapic",
+- srcs = [":workflows_proto_with_info"],
+- grpc_service_config = "workflows_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "workflows_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":workflows_php_grpc",
+- ":workflows_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-workflows-v1beta-php",
+- deps = [
+- ":workflows_php_gapic",
+- ":workflows_php_grpc",
+- ":workflows_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "workflows_nodejs_gapic",
+- package_name = "@google-cloud/workflows",
+- src = ":workflows_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- gapic_yaml = "workflows_gapic.yaml",
+- package = "google.cloud.workflows.v1beta",
+- rest_numeric_enums = False,
+- service_yaml = "workflows_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "workflows-v1beta-nodejs",
+- deps = [
+- ":workflows_nodejs_gapic",
+- ":workflows_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "workflows_ruby_proto",
+- deps = [":workflows_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "workflows_ruby_grpc",
+- srcs = [":workflows_proto"],
+- deps = [":workflows_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "workflows_ruby_gapic",
+- srcs = [":workflows_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-workflows-v1beta",
+- "ruby-cloud-env-prefix=WORKFLOWS",
+- "ruby-cloud-product-url=https://cloud.google.com/workflows/",
+- "ruby-cloud-api-id=workflows.googleapis.com",
+- "ruby-cloud-api-shortname=workflows",
+- ],
+- grpc_service_config = "workflows_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Workflows link series of serverless tasks together in an order you define. Combine the power of Google Cloud's APIs, serverless products like Cloud Functions and Cloud Run, and calls to external APIs to create flexible serverless applications. Workflows requires no infrastructure management and scales seamlessly with demand, including scaling down to zero..",
+- ruby_cloud_title = "Workflows V1beta",
+- deps = [
+- ":workflows_ruby_grpc",
+- ":workflows_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-workflows-v1beta-ruby",
+- deps = [
+- ":workflows_ruby_gapic",
+- ":workflows_ruby_grpc",
+- ":workflows_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "workflows_csharp_proto",
+- deps = [":workflows_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "workflows_csharp_grpc",
+- srcs = [":workflows_proto"],
+- deps = [":workflows_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "workflows_csharp_gapic",
+- srcs = [":workflows_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "workflows_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "workflows_v1beta.yaml",
+- deps = [
+- ":workflows_csharp_grpc",
+- ":workflows_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-workflows-v1beta-csharp",
+- deps = [
+- ":workflows_csharp_gapic",
+- ":workflows_csharp_grpc",
+- ":workflows_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/container/BUILD.bazel b/google/container/BUILD.bazel
+--- a/google/container/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/container/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-container.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for container.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "container_ruby_wrapper",
+- srcs = ["//google/container/v1:container_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-container",
+- "ruby-cloud-env-prefix=CONTAINER",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/kubernetes-engine",
+- "ruby-cloud-api-id=container.googleapis.com",
+- "ruby-cloud-api-shortname=container",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "Builds and manages container-based applications, powered by the open source Kubernetes technology.",
+- ruby_cloud_title = "Kubernetes Engine",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-container-ruby",
+- deps = [
+- ":container_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/container/v1/BUILD.bazel b/google/container/v1/BUILD.bazel
+--- a/google/container/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/container/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,341 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "container_proto",
+- srcs = [
+- "cluster_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:code_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "container_proto_with_info",
+- deps = [
+- ":container_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "container_java_proto",
+- deps = [":container_proto"],
+-)
+-
+-java_grpc_library(
+- name = "container_java_grpc",
+- srcs = [":container_proto"],
+- deps = [":container_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "container_java_gapic",
+- srcs = [":container_proto_with_info"],
+- gapic_yaml = "container_gapic.yaml",
+- grpc_service_config = "container_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "container_v1.yaml",
+- test_deps = [
+- ":container_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":container_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "container_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.container.v1.ClusterManagerClientTest",
+- ],
+- runtime_deps = [":container_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-container-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":container_java_gapic",
+- ":container_java_grpc",
+- ":container_java_proto",
+- ":container_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "container_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/container/v1",
+- protos = [":container_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:code_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "container_go_gapic",
+- srcs = [":container_proto_with_info"],
+- grpc_service_config = "container_grpc_service_config.json",
+- importpath = "cloud.google.com/go/container/apiv1;container",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "container_v1.yaml",
+- deps = [
+- ":container_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "container_go_gapic_test",
+- srcs = [":container_go_gapic_srcjar_test"],
+- embed = [":container_go_gapic"],
+- importpath = "cloud.google.com/go/container/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-container-v1-go",
+- deps = [
+- ":container_go_gapic",
+- ":container_go_gapic_srcjar-metadata.srcjar",
+- ":container_go_gapic_srcjar-test.srcjar",
+- ":container_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "container_py_gapic",
+- srcs = [":container_proto"],
+- grpc_service_config = "container_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-container",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "container_py_gapic_test",
+- srcs = [
+- "container_py_gapic_pytest.py",
+- "container_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":container_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "container-v1-py",
+- deps = [
+- ":container_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "container_php_proto",
+- deps = [":container_proto"],
+-)
+-
+-php_grpc_library(
+- name = "container_php_grpc",
+- srcs = [":container_proto"],
+- deps = [":container_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "container_php_gapic",
+- srcs = [":container_proto_with_info"],
+- grpc_service_config = "container_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "container_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":container_php_grpc",
+- ":container_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-container-v1-php",
+- deps = [
+- ":container_php_gapic",
+- ":container_php_grpc",
+- ":container_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "container_nodejs_gapic",
+- package_name = "@google-cloud/container",
+- src = ":container_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "container_grpc_service_config.json",
+- package = "google.container.v1",
+- rest_numeric_enums = False,
+- service_yaml = "container_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "container-v1-nodejs",
+- deps = [
+- ":container_nodejs_gapic",
+- ":container_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "container_ruby_proto",
+- deps = [":container_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "container_ruby_grpc",
+- srcs = [":container_proto"],
+- deps = [":container_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "container_ruby_gapic",
+- srcs = [":container_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=container.googleapis.com",
+- "ruby-cloud-api-shortname=container",
+- "ruby-cloud-env-prefix=CONTAINER",
+- "ruby-cloud-gem-name=google-cloud-container-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/kubernetes-engine",
+- ],
+- grpc_service_config = "container_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Builds and manages container-based applications, powered by the open source Kubernetes technology.",
+- ruby_cloud_title = "Kubernetes Engine V1",
+- deps = [
+- ":container_ruby_grpc",
+- ":container_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-container-v1-ruby",
+- deps = [
+- ":container_ruby_gapic",
+- ":container_ruby_grpc",
+- ":container_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "container_csharp_proto",
+- deps = [":container_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "container_csharp_grpc",
+- srcs = [":container_proto"],
+- deps = [":container_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "container_csharp_gapic",
+- srcs = [":container_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "container_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "container_v1.yaml",
+- deps = [
+- ":container_csharp_grpc",
+- ":container_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-container-v1-csharp",
+- deps = [
+- ":container_csharp_gapic",
+- ":container_csharp_grpc",
+- ":container_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "container_cc_proto",
+- deps = [":container_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "container_cc_grpc",
+- srcs = [":container_proto"],
+- grpc_only = True,
+- deps = [":container_cc_proto"],
+-)
+diff -urN a/google/container/v1alpha1/BUILD.bazel b/google/container/v1alpha1/BUILD.bazel
+--- a/google/container/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/container/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,178 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "container_proto",
+- srcs = [
+- "cluster_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "@com_google_protobuf//:empty_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "container_java_proto",
+- deps = [":container_proto"],
+-)
+-
+-java_grpc_library(
+- name = "container_java_grpc",
+- srcs = [":container_proto"],
+- deps = [":container_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "container_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/container/v1alpha1",
+- protos = [":container_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "container_moved_proto",
+- srcs = [":container_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "@com_google_protobuf//:empty_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "container_py_proto",
+- deps = [":container_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "container_py_grpc",
+- srcs = [":container_moved_proto"],
+- deps = [":container_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "container_php_proto",
+- deps = [":container_proto"],
+-)
+-
+-php_grpc_library(
+- name = "container_php_grpc",
+- srcs = [":container_proto"],
+- deps = [":container_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "container_ruby_proto",
+- deps = [":container_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "container_ruby_grpc",
+- srcs = [":container_proto"],
+- deps = [":container_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "container_csharp_proto",
+- deps = [":container_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "container_csharp_grpc",
+- srcs = [":container_proto"],
+- deps = [":container_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "container_cc_proto",
+- deps = [":container_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "container_cc_grpc",
+- srcs = [":container_proto"],
+- grpc_only = True,
+- deps = [":container_cc_proto"],
+-)
+diff -urN a/google/container/v1beta1/BUILD.bazel b/google/container/v1beta1/BUILD.bazel
+--- a/google/container/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/container/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,343 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "container_proto",
+- srcs = [
+- "cluster_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:code_proto",
+- "//google/rpc:status_proto",
+- "//google/type:date_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "container_proto_with_info",
+- deps = [
+- ":container_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "container_java_proto",
+- deps = [":container_proto"],
+-)
+-
+-java_grpc_library(
+- name = "container_java_grpc",
+- srcs = [":container_proto"],
+- deps = [":container_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "container_java_gapic",
+- srcs = [":container_proto_with_info"],
+- gapic_yaml = "container_gapic.yaml",
+- grpc_service_config = "container_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "container_v1beta1.yaml",
+- test_deps = [
+- ":container_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":container_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "container_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.container.v1beta1.ClusterManagerClientTest",
+- ],
+- runtime_deps = [":container_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-container-v1beta1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":container_java_gapic",
+- ":container_java_grpc",
+- ":container_java_proto",
+- ":container_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "container_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/container/v1beta1",
+- protos = [":container_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:code_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:date_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "container_go_gapic",
+- srcs = [":container_proto_with_info"],
+- grpc_service_config = "container_grpc_service_config.json",
+- importpath = "cloud.google.com/go/container/apiv1beta1;container",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "container_v1beta1.yaml",
+- deps = [
+- ":container_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "container_go_gapic_test",
+- srcs = [":container_go_gapic_srcjar_test"],
+- embed = [":container_go_gapic"],
+- importpath = "cloud.google.com/go/container/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-container-v1beta1-go",
+- deps = [
+- ":container_go_gapic",
+- ":container_go_gapic_srcjar-metadata.srcjar",
+- ":container_go_gapic_srcjar-test.srcjar",
+- ":container_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "container_py_gapic",
+- srcs = [":container_proto"],
+- grpc_service_config = "container_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-container",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "container_py_gapic_test",
+- srcs = [
+- "container_py_gapic_pytest.py",
+- "container_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":container_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "container-v1beta1-py",
+- deps = [
+- ":container_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "container_php_proto",
+- deps = [":container_proto"],
+-)
+-
+-php_grpc_library(
+- name = "container_php_grpc",
+- srcs = [":container_proto"],
+- deps = [":container_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "container_php_gapic",
+- srcs = [":container_proto_with_info"],
+- grpc_service_config = "container_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "container_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":container_php_grpc",
+- ":container_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-container-v1beta1-php",
+- deps = [
+- ":container_php_gapic",
+- ":container_php_grpc",
+- ":container_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "container_nodejs_gapic",
+- package_name = "@google-cloud/container",
+- src = ":container_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "container_grpc_service_config.json",
+- package = "google.container.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "container_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "container-v1beta1-nodejs",
+- deps = [
+- ":container_nodejs_gapic",
+- ":container_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "container_ruby_proto",
+- deps = [":container_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "container_ruby_grpc",
+- srcs = [":container_proto"],
+- deps = [":container_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "container_ruby_gapic",
+- srcs = [":container_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=container.googleapis.com",
+- "ruby-cloud-api-shortname=container",
+- "ruby-cloud-env-prefix=CONTAINER",
+- "ruby-cloud-gem-name=google-cloud-container-v1beta1",
+- "ruby-cloud-product-url=https://cloud.google.com/kubernetes-engine",
+- ],
+- grpc_service_config = "container_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Builds and manages container-based applications, powered by the open source Kubernetes technology.",
+- ruby_cloud_title = "Kubernetes Engine V1beta1",
+- deps = [
+- ":container_ruby_grpc",
+- ":container_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-container-v1beta1-ruby",
+- deps = [
+- ":container_ruby_gapic",
+- ":container_ruby_grpc",
+- ":container_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "container_csharp_proto",
+- deps = [":container_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "container_csharp_grpc",
+- srcs = [":container_proto"],
+- deps = [":container_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "container_csharp_gapic",
+- srcs = [":container_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "container_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "container_v1beta1.yaml",
+- deps = [
+- ":container_csharp_grpc",
+- ":container_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-container-v1beta1-csharp",
+- deps = [
+- ":container_csharp_gapic",
+- ":container_csharp_grpc",
+- ":container_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "container_cc_proto",
+- deps = [":container_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "container_cc_grpc",
+- srcs = [":container_proto"],
+- grpc_only = True,
+- deps = [":container_cc_proto"],
+-)
+diff -urN a/google/dataflow/BUILD.bazel b/google/dataflow/BUILD.bazel
+--- a/google/dataflow/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/dataflow/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-dataflow.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for dataflow.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1beta3 in this case.
+-ruby_cloud_gapic_library(
+- name = "dataflow_ruby_wrapper",
+- srcs = ["//google/dataflow/v1beta3:dataflow_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-dataflow",
+- "ruby-cloud-env-prefix=DATAFLOW",
+- "ruby-cloud-wrapper-of=v1beta3:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/dataflow",
+- "ruby-cloud-api-id=dataflow.googleapis.com",
+- "ruby-cloud-api-shortname=dataflow",
+- "ruby-cloud-service-override=JobsV1Beta3=Jobs;MessagesV1Beta3=Messages;MetricsV1Beta3=Metrics;SnapshotsV1Beta3=Snapshots",
+- ],
+- ruby_cloud_description = "Dataflow is a managed service for executing a wide variety of data processing patterns.",
+- ruby_cloud_title = "Dataflow",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dataflow-ruby",
+- deps = [
+- ":dataflow_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/dataflow/v1beta3/BUILD.bazel b/google/dataflow/v1beta3/BUILD.bazel
+--- a/google/dataflow/v1beta3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/dataflow/v1beta3/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,359 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "dataflow_proto",
+- srcs = [
+- "environment.proto",
+- "jobs.proto",
+- "messages.proto",
+- "metrics.proto",
+- "snapshots.proto",
+- "streaming.proto",
+- "templates.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "dataflow_proto_with_info",
+- deps = [
+- ":dataflow_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "dataflow_java_proto",
+- deps = [":dataflow_proto"],
+-)
+-
+-java_grpc_library(
+- name = "dataflow_java_grpc",
+- srcs = [":dataflow_proto"],
+- deps = [":dataflow_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "dataflow_java_gapic",
+- srcs = [":dataflow_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "dataflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataflow_v1beta3.yaml",
+- test_deps = [
+- ":dataflow_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":dataflow_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "dataflow_java_gapic_test_suite",
+- test_classes = [
+- "com.google.dataflow.v1beta3.FlexTemplatesServiceClientHttpJsonTest",
+- "com.google.dataflow.v1beta3.FlexTemplatesServiceClientTest",
+- "com.google.dataflow.v1beta3.JobsV1Beta3ClientHttpJsonTest",
+- "com.google.dataflow.v1beta3.JobsV1Beta3ClientTest",
+- "com.google.dataflow.v1beta3.MessagesV1Beta3ClientHttpJsonTest",
+- "com.google.dataflow.v1beta3.MessagesV1Beta3ClientTest",
+- "com.google.dataflow.v1beta3.MetricsV1Beta3ClientHttpJsonTest",
+- "com.google.dataflow.v1beta3.MetricsV1Beta3ClientTest",
+- "com.google.dataflow.v1beta3.SnapshotsV1Beta3ClientHttpJsonTest",
+- "com.google.dataflow.v1beta3.SnapshotsV1Beta3ClientTest",
+- "com.google.dataflow.v1beta3.TemplatesServiceClientHttpJsonTest",
+- "com.google.dataflow.v1beta3.TemplatesServiceClientTest",
+- ],
+- runtime_deps = [":dataflow_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-dataflow-v1beta3-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":dataflow_java_gapic",
+- ":dataflow_java_grpc",
+- ":dataflow_java_proto",
+- ":dataflow_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "dataflow_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/dataflow/v1beta3",
+- protos = [":dataflow_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "dataflow_go_gapic",
+- srcs = [":dataflow_proto_with_info"],
+- grpc_service_config = "dataflow_grpc_service_config.json",
+- importpath = "cloud.google.com/go/dataflow/apiv1beta3;dataflow",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "dataflow_v1beta3.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dataflow_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "dataflow_go_gapic_test",
+- srcs = [":dataflow_go_gapic_srcjar_test"],
+- embed = [":dataflow_go_gapic"],
+- importpath = "cloud.google.com/go/dataflow/apiv1beta3",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-dataflow-v1beta3-go",
+- deps = [
+- ":dataflow_go_gapic",
+- ":dataflow_go_gapic_srcjar-metadata.srcjar",
+- ":dataflow_go_gapic_srcjar-test.srcjar",
+- ":dataflow_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "dataflow_py_gapic",
+- srcs = [":dataflow_proto"],
+- grpc_service_config = "dataflow_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=dataflow",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-dataflow-client",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+-)
+-
+-py_test(
+- name = "dataflow_py_gapic_test",
+- srcs = [
+- "dataflow_py_gapic_pytest.py",
+- "dataflow_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":dataflow_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "dataflow-v1beta3-py",
+- deps = [
+- ":dataflow_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "dataflow_php_proto",
+- deps = [":dataflow_proto"],
+-)
+-
+-php_grpc_library(
+- name = "dataflow_php_grpc",
+- srcs = [":dataflow_proto"],
+- deps = [":dataflow_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "dataflow_php_gapic",
+- srcs = [":dataflow_proto_with_info"],
+- grpc_service_config = "dataflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataflow_v1beta3.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dataflow_php_grpc",
+- ":dataflow_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-dataflow-v1beta3-php",
+- deps = [
+- ":dataflow_php_gapic",
+- ":dataflow_php_grpc",
+- ":dataflow_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "dataflow_nodejs_gapic",
+- package_name = "@google-cloud/dataflow",
+- src = ":dataflow_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "dataflow_grpc_service_config.json",
+- package = "google.dataflow.v1beta3",
+- rest_numeric_enums = False,
+- service_yaml = "dataflow_v1beta3.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "dataflow-v1beta3-nodejs",
+- deps = [
+- ":dataflow_nodejs_gapic",
+- ":dataflow_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "dataflow_ruby_proto",
+- deps = [":dataflow_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "dataflow_ruby_grpc",
+- srcs = [":dataflow_proto"],
+- deps = [":dataflow_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "dataflow_ruby_gapic",
+- srcs = [":dataflow_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=dataflow.googleapis.com",
+- "ruby-cloud-api-shortname=dataflow",
+- "ruby-cloud-env-prefix=DATAFLOW",
+- "ruby-cloud-gem-name=google-cloud-dataflow-v1beta3",
+- "ruby-cloud-product-url=https://cloud.google.com/dataflow",
+- "ruby-cloud-service-override=JobsV1Beta3=Jobs;MessagesV1Beta3=Messages;MetricsV1Beta3=Metrics;SnapshotsV1Beta3=Snapshots",
+- ],
+- grpc_service_config = "dataflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Dataflow is a managed service for executing a wide variety of data processing patterns.",
+- ruby_cloud_title = "Dataflow V1beta3",
+- deps = [
+- ":dataflow_ruby_grpc",
+- ":dataflow_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dataflow-v1beta3-ruby",
+- deps = [
+- ":dataflow_ruby_gapic",
+- ":dataflow_ruby_grpc",
+- ":dataflow_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "dataflow_csharp_proto",
+- deps = [":dataflow_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "dataflow_csharp_grpc",
+- srcs = [":dataflow_proto"],
+- deps = [":dataflow_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "dataflow_csharp_gapic",
+- srcs = [":dataflow_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "dataflow_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dataflow_v1beta3.yaml",
+- deps = [
+- ":dataflow_csharp_grpc",
+- ":dataflow_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-dataflow-v1beta3-csharp",
+- deps = [
+- ":dataflow_csharp_gapic",
+- ":dataflow_csharp_grpc",
+- ":dataflow_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "dataflow_cc_proto",
+- deps = [":dataflow_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "dataflow_cc_grpc",
+- srcs = [":dataflow_proto"],
+- grpc_only = True,
+- deps = [":dataflow_cc_proto"],
+-)
+diff -urN a/google/datastore/BUILD.bazel b/google/datastore/BUILD.bazel
+--- a/google/datastore/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/datastore/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/datastore/admin/BUILD.bazel b/google/datastore/admin/BUILD.bazel
+--- a/google/datastore/admin/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/datastore/admin/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/datastore/admin/v1/BUILD.bazel b/google/datastore/admin/v1/BUILD.bazel
+--- a/google/datastore/admin/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/datastore/admin/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,340 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "admin_proto",
+- srcs = [
+- "datastore_admin.proto",
+- "index.proto",
+- "migration.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "admin_proto_with_info",
+- deps = [
+- ":admin_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "admin_java_proto",
+- deps = [":admin_proto"],
+-)
+-
+-java_grpc_library(
+- name = "admin_java_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "admin_java_gapic",
+- srcs = [":admin_proto_with_info"],
+- gapic_yaml = "datastore_admin_gapic.yaml",
+- grpc_service_config = "datastore_admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datastore_v1.yaml",
+- test_deps = [
+- ":admin_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":admin_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "admin_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.datastore.admin.v1.DatastoreAdminClientHttpJsonTest",
+- "com.google.cloud.datastore.admin.v1.DatastoreAdminClientTest",
+- ],
+- runtime_deps = [":admin_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-datastore-admin-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":admin_java_gapic",
+- ":admin_java_grpc",
+- ":admin_java_proto",
+- ":admin_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "admin_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/datastore/admin/v1",
+- protos = [":admin_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "admin_go_gapic",
+- srcs = [":admin_proto_with_info"],
+- grpc_service_config = "datastore_admin_grpc_service_config.json",
+- importpath = "cloud.google.com/go/datastore/admin/apiv1;admin",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "datastore_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":admin_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "admin_go_gapic_test",
+- srcs = [":admin_go_gapic_srcjar_test"],
+- embed = [":admin_go_gapic"],
+- importpath = "cloud.google.com/go/datastore/admin/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-datastore-admin-v1-go",
+- deps = [
+- ":admin_go_gapic",
+- ":admin_go_gapic_srcjar-metadata.srcjar",
+- ":admin_go_gapic_srcjar-test.srcjar",
+- ":admin_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "admin_py_gapic",
+- srcs = [":admin_proto"],
+- grpc_service_config = "datastore_admin_grpc_service_config.json",
+- opt_args = ["python-gapic-namespace=google.cloud, python-gapic-name=datastore-admin"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "admin_py_gapic_test",
+- srcs = [
+- "admin_py_gapic_pytest.py",
+- "admin_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":admin_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "datastore-admin-v1-py",
+- deps = [
+- ":admin_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "admin_php_proto",
+- deps = [":admin_proto"],
+-)
+-
+-php_grpc_library(
+- name = "admin_php_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "admin_php_gapic",
+- srcs = [":admin_proto_with_info"],
+- grpc_service_config = "datastore_admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datastore_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":admin_php_grpc",
+- ":admin_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-datastore-admin-v1-php",
+- deps = [
+- ":admin_php_gapic",
+- ":admin_php_grpc",
+- ":admin_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "admin_nodejs_gapic",
+- package_name = "@google-cloud/datastore-admin",
+- src = ":admin_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "datastore_admin_grpc_service_config.json",
+- package = "google.datastore.admin.v1",
+- rest_numeric_enums = False,
+- service_yaml = "datastore_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "datastore-admin-v1-nodejs",
+- deps = [
+- ":admin_nodejs_gapic",
+- ":admin_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "admin_ruby_proto",
+- deps = [":admin_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "admin_ruby_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "admin_ruby_gapic",
+- srcs = [":admin_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-datastore-admin-v1",
+- "ruby-cloud-env-prefix=DATASTORE",
+- "ruby-cloud-product-url=https://cloud.google.com/datastore",
+- "ruby-cloud-api-id=datastore.googleapis.com",
+- "ruby-cloud-api-shortname=datastore",
+- "ruby-cloud-wrapper-gem-override=google-cloud-datastore",
+- ],
+- grpc_service_config = "datastore_admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Firestore in Datastore mode is a NoSQL document database built for automatic scaling, high performance, and ease of application development.",
+- ruby_cloud_title = "Firestore in Datastore mode Admin V1",
+- deps = [
+- ":admin_ruby_grpc",
+- ":admin_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-datastore-admin-v1-ruby",
+- deps = [
+- ":admin_ruby_gapic",
+- ":admin_ruby_grpc",
+- ":admin_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "admin_csharp_proto",
+- deps = [":admin_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "admin_csharp_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "admin_csharp_gapic",
+- srcs = [":admin_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "datastore_admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datastore_v1.yaml",
+- deps = [
+- ":admin_csharp_grpc",
+- ":admin_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-datastore-admin-v1-csharp",
+- deps = [
+- ":admin_csharp_gapic",
+- ":admin_csharp_grpc",
+- ":admin_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "admin_cc_proto",
+- deps = [":admin_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "admin_cc_grpc",
+- srcs = [":admin_proto"],
+- grpc_only = True,
+- deps = [":admin_cc_proto"],
+-)
+diff -urN a/google/datastore/v1/BUILD.bazel b/google/datastore/v1/BUILD.bazel
+--- a/google/datastore/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/datastore/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,402 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "datastore_proto",
+- srcs = [
+- "aggregation_result.proto",
+- "datastore.proto",
+- "entity.proto",
+- "query.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "datastore_proto_with_info",
+- deps = [
+- ":datastore_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "datastore_java_proto",
+- deps = [":datastore_proto"],
+-)
+-
+-java_grpc_library(
+- name = "datastore_java_grpc",
+- srcs = [":datastore_proto"],
+- deps = [":datastore_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "datastore_java_gapic",
+- srcs = [":datastore_proto_with_info"],
+- gapic_yaml = "datastore_gapic.yaml",
+- grpc_service_config = "datastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datastore_v1.yaml",
+- test_deps = [
+- ":datastore_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":datastore_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "datastore_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.datastore.v1.DatastoreClientHttpJsonTest",
+- "com.google.cloud.datastore.v1.DatastoreClientTest",
+- ],
+- runtime_deps = [":datastore_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-datastore-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":datastore_java_gapic",
+- ":datastore_java_grpc",
+- ":datastore_java_proto",
+- ":datastore_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "datastore_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/datastore/v1",
+- protos = [":datastore_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "datastore_go_gapic",
+- srcs = [":datastore_proto_with_info"],
+- grpc_service_config = "datastore_grpc_service_config.json",
+- importpath = "cloud.google.com/go/datastore/apiv1;datastore",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "datastore_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datastore_go_proto",
+- "//google/longrunning:longrunning_go_gapic",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "datastore_go_gapic_test",
+- srcs = [":datastore_go_gapic_srcjar_test"],
+- embed = [":datastore_go_gapic"],
+- importpath = "cloud.google.com/go/datastore/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-datastore-v1-go",
+- deps = [
+- ":datastore_go_gapic",
+- ":datastore_go_gapic_srcjar-metadata.srcjar",
+- ":datastore_go_gapic_srcjar-test.srcjar",
+- ":datastore_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "datastore_py_gapic",
+- srcs = [":datastore_proto"],
+- grpc_service_config = "datastore_grpc_service_config.json",
+- opt_args = ["python-gapic-namespace=google.cloud"],
+- rest_numeric_enums = False,
+- service_yaml = "datastore_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "datastore_py_gapic_test",
+- srcs = [
+- "datastore_py_gapic_pytest.py",
+- "datastore_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":datastore_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "datastore-v1-py",
+- deps = [
+- ":datastore_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "datastore_php_proto",
+- deps = [":datastore_proto"],
+-)
+-
+-php_grpc_library(
+- name = "datastore_php_grpc",
+- srcs = [":datastore_proto"],
+- deps = [":datastore_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "datastore_php_gapic",
+- srcs = [":datastore_proto_with_info"],
+- grpc_service_config = "datastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datastore_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":datastore_php_grpc",
+- ":datastore_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-datastore-v1-php",
+- deps = [
+- ":datastore_php_gapic",
+- ":datastore_php_grpc",
+- ":datastore_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "datastore_nodejs_gapic",
+- package_name = "@google-cloud/datastore",
+- src = ":datastore_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "datastore_grpc_service_config.json",
+- main_service = "datastore",
+- mixins = "google.longrunning.Operations",
+- package = "google.datastore.v1",
+- rest_numeric_enums = False,
+- service_yaml = "datastore_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "datastore-v1-nodejs",
+- deps = [
+- ":datastore_nodejs_gapic",
+- ":datastore_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "datastore_ruby_proto",
+- deps = [":datastore_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "datastore_ruby_grpc",
+- srcs = [":datastore_proto"],
+- deps = [":datastore_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "datastore_ruby_gapic",
+- srcs = [":datastore_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=datastore.googleapis.com",
+- "ruby-cloud-api-shortname=datastore",
+- "ruby-cloud-env-prefix=DATASTORE",
+- "ruby-cloud-gem-name=google-cloud-datastore-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/datastore",
+- ],
+- grpc_service_config = "datastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Firestore in Datastore mode is a NoSQL document database built for automatic scaling, high performance, and ease of application development.",
+- ruby_cloud_title = "Firestore in Datastore mode V1",
+- service_yaml = "datastore_v1.yaml",
+- deps = [
+- ":datastore_ruby_grpc",
+- ":datastore_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-datastore-v1-ruby",
+- deps = [
+- ":datastore_ruby_gapic",
+- ":datastore_ruby_grpc",
+- ":datastore_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "datastore_csharp_proto",
+- deps = [":datastore_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "datastore_csharp_grpc",
+- srcs = [":datastore_proto"],
+- deps = [":datastore_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "datastore_csharp_gapic",
+- srcs = [":datastore_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "datastore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "datastore_v1.yaml",
+- deps = [
+- ":datastore_csharp_grpc",
+- ":datastore_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-datastore-v1-csharp",
+- deps = [
+- ":datastore_csharp_gapic",
+- ":datastore_csharp_grpc",
+- ":datastore_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "datastore_cc_proto",
+- deps = [":datastore_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "datastore_cc_grpc",
+- srcs = [":datastore_proto"],
+- grpc_only = True,
+- deps = [":datastore_cc_proto"],
+-)
+diff -urN a/google/devtools/artifactregistry/BUILD.bazel b/google/devtools/artifactregistry/BUILD.bazel
+--- a/google/devtools/artifactregistry/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/artifactregistry/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-artifact_registry.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for artifactregistry.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "artifactregistry_ruby_wrapper",
+- srcs = ["//google/devtools/artifactregistry/v1:artifactregistry_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-artifact_registry",
+- "ruby-cloud-env-prefix=ARTIFACT_REGISTRY",
+- "ruby-cloud-wrapper-of=v1:0.0;v1beta2:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/artifact-registry/",
+- "ruby-cloud-api-id=artifactregistry.googleapis.com",
+- "ruby-cloud-api-shortname=artifactregistry",
+- ],
+- ruby_cloud_description = "Artifact Registry stores and manages build artifacts in a scalable and integrated service built on Google infrastructure.",
+- ruby_cloud_title = "Artifact Registry",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-artifactregistry-ruby",
+- deps = [
+- ":artifactregistry_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/devtools/artifactregistry/v1/BUILD.bazel b/google/devtools/artifactregistry/v1/BUILD.bazel
+--- a/google/devtools/artifactregistry/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/artifactregistry/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,366 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "artifactregistry_proto",
+- srcs = [
+- "apt_artifact.proto",
+- "artifact.proto",
+- "file.proto",
+- "package.proto",
+- "repository.proto",
+- "service.proto",
+- "settings.proto",
+- "tag.proto",
+- "version.proto",
+- "yum_artifact.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "artifactregistry_proto_with_info",
+- deps = [
+- ":artifactregistry_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "artifactregistry_java_proto",
+- deps = [":artifactregistry_proto"],
+-)
+-
+-java_grpc_library(
+- name = "artifactregistry_java_grpc",
+- srcs = [":artifactregistry_proto"],
+- deps = [":artifactregistry_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "artifactregistry_java_gapic",
+- srcs = [":artifactregistry_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "artifactregistry_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "artifactregistry_v1.yaml",
+- test_deps = [
+- ":artifactregistry_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":artifactregistry_java_proto",
+- "//google/api:api_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "artifactregistry_java_gapic_test_suite",
+- test_classes = [
+- "com.google.devtools.artifactregistry.v1.ArtifactRegistryClientHttpJsonTest",
+- "com.google.devtools.artifactregistry.v1.ArtifactRegistryClientTest",
+- ],
+- runtime_deps = [":artifactregistry_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-devtools-artifactregistry-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":artifactregistry_java_gapic",
+- ":artifactregistry_java_grpc",
+- ":artifactregistry_java_proto",
+- ":artifactregistry_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "artifactregistry_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1",
+- protos = [":artifactregistry_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "artifactregistry_go_gapic",
+- srcs = [":artifactregistry_proto_with_info"],
+- grpc_service_config = "artifactregistry_grpc_service_config.json",
+- importpath = "cloud.google.com/go/devtools/artifactregistry/apiv1;artifactregistry",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "artifactregistry_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":artifactregistry_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "artifactregistry_go_gapic_test",
+- srcs = [":artifactregistry_go_gapic_srcjar_test"],
+- embed = [":artifactregistry_go_gapic"],
+- importpath = "cloud.google.com/go/devtools/artifactregistry/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-devtools-artifactregistry-v1-go",
+- deps = [
+- ":artifactregistry_go_gapic",
+- ":artifactregistry_go_gapic_srcjar-metadata.srcjar",
+- ":artifactregistry_go_gapic_srcjar-test.srcjar",
+- ":artifactregistry_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "artifactregistry_py_gapic",
+- srcs = [":artifactregistry_proto"],
+- grpc_service_config = "artifactregistry_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=artifactregistry",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-artifact-registry",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "artifactregistry_py_gapic_test",
+- srcs = [
+- "artifactregistry_py_gapic_pytest.py",
+- "artifactregistry_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":artifactregistry_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "devtools-artifactregistry-v1-py",
+- deps = [
+- ":artifactregistry_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "artifactregistry_php_proto",
+- deps = [":artifactregistry_proto"],
+-)
+-
+-php_grpc_library(
+- name = "artifactregistry_php_grpc",
+- srcs = [":artifactregistry_proto"],
+- deps = [":artifactregistry_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "artifactregistry_php_gapic",
+- srcs = [":artifactregistry_proto_with_info"],
+- grpc_service_config = "artifactregistry_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "artifactregistry_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":artifactregistry_php_grpc",
+- ":artifactregistry_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-devtools-artifactregistry-v1-php",
+- deps = [
+- ":artifactregistry_php_gapic",
+- ":artifactregistry_php_grpc",
+- ":artifactregistry_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "artifactregistry_nodejs_gapic",
+- package_name = "@google-cloud/artifact-registry",
+- src = ":artifactregistry_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "artifactregistry_grpc_service_config.json",
+- package = "google.devtools.artifactregistry.v1",
+- rest_numeric_enums = False,
+- service_yaml = "artifactregistry_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "devtools-artifactregistry-v1-nodejs",
+- deps = [
+- ":artifactregistry_nodejs_gapic",
+- ":artifactregistry_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "artifactregistry_ruby_proto",
+- deps = [":artifactregistry_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "artifactregistry_ruby_grpc",
+- srcs = [":artifactregistry_proto"],
+- deps = [":artifactregistry_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "artifactregistry_ruby_gapic",
+- srcs = [":artifactregistry_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=artifactregistry.googleapis.com",
+- "ruby-cloud-api-shortname=artifactregistry",
+- "ruby-cloud-env-prefix=ARTIFACT_REGISTRY",
+- "ruby-cloud-gem-name=google-cloud-artifact_registry-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/artifact-registry/",
+- ],
+- grpc_service_config = "artifactregistry_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Artifact Registry stores and manages build artifacts in a scalable and integrated service built on Google infrastructure.",
+- ruby_cloud_title = "Artifact Registry V1",
+- deps = [
+- ":artifactregistry_ruby_grpc",
+- ":artifactregistry_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-devtools-artifactregistry-v1-ruby",
+- deps = [
+- ":artifactregistry_ruby_gapic",
+- ":artifactregistry_ruby_grpc",
+- ":artifactregistry_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "artifactregistry_csharp_proto",
+- deps = [":artifactregistry_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "artifactregistry_csharp_grpc",
+- srcs = [":artifactregistry_proto"],
+- deps = [":artifactregistry_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "artifactregistry_csharp_gapic",
+- srcs = [":artifactregistry_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "artifactregistry_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "artifactregistry_v1.yaml",
+- deps = [
+- ":artifactregistry_csharp_grpc",
+- ":artifactregistry_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-devtools-artifactregistry-v1-csharp",
+- deps = [
+- ":artifactregistry_csharp_gapic",
+- ":artifactregistry_csharp_grpc",
+- ":artifactregistry_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "artifactregistry_cc_proto",
+- deps = [":artifactregistry_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "artifactregistry_cc_grpc",
+- srcs = [":artifactregistry_proto"],
+- grpc_only = True,
+- deps = [":artifactregistry_cc_proto"],
+-)
+diff -urN a/google/devtools/artifactregistry/v1beta2/BUILD.bazel b/google/devtools/artifactregistry/v1beta2/BUILD.bazel
+--- a/google/devtools/artifactregistry/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/artifactregistry/v1beta2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,350 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "artifactregistry_proto",
+- srcs = [
+- "apt_artifact.proto",
+- "file.proto",
+- "package.proto",
+- "repository.proto",
+- "service.proto",
+- "settings.proto",
+- "tag.proto",
+- "version.proto",
+- "yum_artifact.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "artifactregistry_proto_with_info",
+- deps = [
+- ":artifactregistry_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "artifactregistry_java_proto",
+- deps = [":artifactregistry_proto"],
+-)
+-
+-java_grpc_library(
+- name = "artifactregistry_java_grpc",
+- srcs = [":artifactregistry_proto"],
+- deps = [":artifactregistry_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "artifactregistry_java_gapic",
+- srcs = [":artifactregistry_proto_with_info"],
+- grpc_service_config = "artifactregistry_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":artifactregistry_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":artifactregistry_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "artifactregistry_java_gapic_test_suite",
+- test_classes = [
+- "com.google.devtools.artifactregistry.v1beta2.ArtifactRegistryClientHttpJsonTest",
+- "com.google.devtools.artifactregistry.v1beta2.ArtifactRegistryClientTest",
+- ],
+- runtime_deps = [":artifactregistry_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-devtools-artifactregistry-v1beta2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":artifactregistry_java_gapic",
+- ":artifactregistry_java_grpc",
+- ":artifactregistry_java_proto",
+- ":artifactregistry_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "artifactregistry_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2",
+- protos = [":artifactregistry_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "artifactregistry_go_gapic",
+- srcs = [":artifactregistry_proto_with_info"],
+- grpc_service_config = "artifactregistry_grpc_service_config.json",
+- importpath = "cloud.google.com/go/devtools/artifactregistry/apiv1beta2;artifactregistry",
+- rest_numeric_enums = False,
+- service_yaml = "artifactregistry_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":artifactregistry_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "artifactregistry_go_gapic_test",
+- srcs = [":artifactregistry_go_gapic_srcjar_test"],
+- embed = [":artifactregistry_go_gapic"],
+- importpath = "cloud.google.com/go/devtools/artifactregistry/apiv1beta2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-devtools-artifactregistry-v1beta2-go",
+- deps = [
+- ":artifactregistry_go_gapic",
+- ":artifactregistry_go_gapic_srcjar-test.srcjar",
+- ":artifactregistry_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "artifactregistry_py_gapic",
+- srcs = [":artifactregistry_proto"],
+- grpc_service_config = "artifactregistry_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=artifactregistry",
+- "warehouse-package-name=google-cloud-artifact-registry",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "artifactregistry_py_gapic_test",
+- srcs = [
+- "artifactregistry_py_gapic_pytest.py",
+- "artifactregistry_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":artifactregistry_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "google-cloud-artifactregistry-v1beta2-py",
+- deps = [
+- ":artifactregistry_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "artifactregistry_php_proto",
+- deps = [":artifactregistry_proto"],
+-)
+-
+-php_grpc_library(
+- name = "artifactregistry_php_grpc",
+- srcs = [":artifactregistry_proto"],
+- deps = [":artifactregistry_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "artifactregistry_php_gapic",
+- srcs = [":artifactregistry_proto_with_info"],
+- grpc_service_config = "artifactregistry_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "artifactregistry_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":artifactregistry_php_grpc",
+- ":artifactregistry_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-devtools-artifactregistry-v1beta2-php",
+- deps = [
+- ":artifactregistry_php_gapic",
+- ":artifactregistry_php_grpc",
+- ":artifactregistry_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "artifactregistry_nodejs_gapic",
+- package_name = "@google-cloud/artifact-registry",
+- src = ":artifactregistry_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "artifactregistry_grpc_service_config.json",
+- package = "google.devtools.artifactregistry.v1beta2",
+- rest_numeric_enums = False,
+- service_yaml = "artifactregistry_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "devtools-artifactregistry-v1beta2-nodejs",
+- deps = [
+- ":artifactregistry_nodejs_gapic",
+- ":artifactregistry_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "artifactregistry_ruby_proto",
+- deps = [":artifactregistry_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "artifactregistry_ruby_grpc",
+- srcs = [":artifactregistry_proto"],
+- deps = [":artifactregistry_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "artifactregistry_ruby_gapic",
+- srcs = [":artifactregistry_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-artifact_registry-v1beta2",
+- "ruby-cloud-env-prefix=ARTIFACT_REGISTRY",
+- "ruby-cloud-product-url=https://cloud.google.com/artifact-registry/",
+- "ruby-cloud-api-id=artifactregistry.googleapis.com",
+- "ruby-cloud-api-shortname=artifactregistry",
+- ],
+- grpc_service_config = "artifactregistry_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Artifact Registry stores and manages build artifacts in a scalable and integrated service built on Google infrastructure.",
+- ruby_cloud_title = "Artifact Registry V1beta2",
+- deps = [
+- ":artifactregistry_ruby_grpc",
+- ":artifactregistry_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-devtools-artifactregistry-v1beta2-ruby",
+- deps = [
+- ":artifactregistry_ruby_gapic",
+- ":artifactregistry_ruby_grpc",
+- ":artifactregistry_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "artifactregistry_csharp_proto",
+- deps = [":artifactregistry_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "artifactregistry_csharp_grpc",
+- srcs = [":artifactregistry_proto"],
+- deps = [":artifactregistry_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "artifactregistry_csharp_gapic",
+- srcs = [":artifactregistry_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "artifactregistry_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "artifactregistry_v1beta2.yaml",
+- deps = [
+- ":artifactregistry_csharp_grpc",
+- ":artifactregistry_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-devtools-artifactregistry-v1beta2-csharp",
+- deps = [
+- ":artifactregistry_csharp_gapic",
+- ":artifactregistry_csharp_grpc",
+- ":artifactregistry_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/devtools/build/BUILD.bazel b/google/devtools/build/BUILD.bazel
+--- a/google/devtools/build/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/build/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/devtools/build/v1/BUILD.bazel b/google/devtools/build/v1/BUILD.bazel
+--- a/google/devtools/build/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/build/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,321 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "build_proto",
+- srcs = [
+- "build_events.proto",
+- "build_status.proto",
+- "publish_build_event.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "build_proto_with_info",
+- deps = [
+- ":build_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "build_java_proto",
+- deps = [":build_proto"],
+-)
+-
+-java_grpc_library(
+- name = "build_java_grpc",
+- srcs = [":build_proto"],
+- deps = [":build_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "build_java_gapic",
+- srcs = [":build_proto_with_info"],
+- gapic_yaml = "buildeventservice_gapic.yaml",
+- grpc_service_config = "buildeventservice_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":build_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":build_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "build_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.devtools.build.v1.PublishBuildEventClientHttpJsonTest",
+- "com.google.cloud.devtools.build.v1.PublishBuildEventClientTest",
+- ],
+- runtime_deps = [":build_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-devtools-build-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":build_java_gapic",
+- ":build_java_grpc",
+- ":build_java_proto",
+- ":build_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "build_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/build/v1",
+- protos = [":build_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "build_go_gapic",
+- srcs = [":build_proto_with_info"],
+- grpc_service_config = "buildeventservice_grpc_service_config.json",
+- importpath = "cloud.google.com/go/devtools/build/apiv1;build",
+- rest_numeric_enums = False,
+- service_yaml = "buildeventservice_v1.yaml",
+- deps = [
+- ":build_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "build_go_gapic_test",
+- srcs = [":build_go_gapic_srcjar_test"],
+- embed = [":build_go_gapic"],
+- importpath = "cloud.google.com/go/devtools/build/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-devtools-build-v1-go",
+- deps = [
+- ":build_go_gapic",
+- ":build_go_gapic_srcjar-test.srcjar",
+- ":build_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "build_py_gapic",
+- srcs = [":build_proto"],
+- grpc_service_config = "buildeventservice_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "build_py_gapic_test",
+- srcs = [
+- "build_py_gapic_pytest.py",
+- "build_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":build_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "devtools-build-v1-py",
+- deps = [
+- ":build_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "build_php_proto",
+- deps = [":build_proto"],
+-)
+-
+-php_grpc_library(
+- name = "build_php_grpc",
+- srcs = [":build_proto"],
+- deps = [":build_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "build_php_gapic",
+- srcs = [":build_proto_with_info"],
+- grpc_service_config = "buildeventservice_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":build_php_grpc",
+- ":build_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-devtools-build-v1-php",
+- deps = [
+- ":build_php_gapic",
+- ":build_php_grpc",
+- ":build_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "build_nodejs_gapic",
+- src = ":build_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "buildeventservice_grpc_service_config.json",
+- package = "google.devtools.build.v1",
+- rest_numeric_enums = False,
+- service_yaml = "buildeventservice_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "devtools-build-v1-nodejs",
+- deps = [
+- ":build_nodejs_gapic",
+- ":build_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "build_ruby_proto",
+- deps = [":build_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "build_ruby_grpc",
+- srcs = [":build_proto"],
+- deps = [":build_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "build_ruby_gapic",
+- srcs = [":build_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-build-v1"],
+- rest_numeric_enums = False,
+- deps = [
+- ":build_ruby_grpc",
+- ":build_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-devtools-build-v1-ruby",
+- deps = [
+- ":build_ruby_gapic",
+- ":build_ruby_grpc",
+- ":build_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "build_csharp_proto",
+- deps = [":build_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "build_csharp_grpc",
+- srcs = [":build_proto"],
+- deps = [":build_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "build_csharp_gapic",
+- srcs = [":build_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "buildeventservice_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "buildeventservice_v1.yaml",
+- deps = [
+- ":build_csharp_grpc",
+- ":build_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-devtools-build-v1-csharp",
+- deps = [
+- ":build_csharp_gapic",
+- ":build_csharp_grpc",
+- ":build_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "build_cc_proto",
+- deps = [":build_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "build_cc_grpc",
+- srcs = [":build_proto"],
+- grpc_only = True,
+- deps = [":build_cc_proto"],
+-)
+diff -urN a/google/devtools/cloudbuild/BUILD.bazel b/google/devtools/cloudbuild/BUILD.bazel
+--- a/google/devtools/cloudbuild/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/cloudbuild/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-build.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for cloudbuild.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "cloudbuild_ruby_wrapper",
+- srcs = ["//google/devtools/cloudbuild/v1:cloudbuild_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-build",
+- "ruby-cloud-env-prefix=CLOUD_BUILD",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/cloud-build",
+- "ruby-cloud-api-id=cloudbuild.googleapis.com",
+- "ruby-cloud-api-shortname=cloudbuild",
+- ],
+- ruby_cloud_description = "Cloud Build is a service that executes your builds on Google Cloud Platform infrastructure. Cloud Build can import source code from Google Cloud Storage, Cloud Source Repositories, GitHub, or Bitbucket, execute a build to your specifications, and produce artifacts such as Docker containers or Java archives.",
+- ruby_cloud_title = "Cloud Build",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-build-ruby",
+- deps = [
+- ":cloudbuild_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/devtools/cloudbuild/v1/BUILD.bazel b/google/devtools/cloudbuild/v1/BUILD.bazel
+--- a/google/devtools/cloudbuild/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/cloudbuild/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,342 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "cloudbuild_proto",
+- srcs = [
+- "cloudbuild.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:httpbody_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "cloudbuild_proto_with_info",
+- deps = [
+- ":cloudbuild_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "cloudbuild_java_proto",
+- deps = [":cloudbuild_proto"],
+-)
+-
+-java_grpc_library(
+- name = "cloudbuild_java_grpc",
+- srcs = [":cloudbuild_proto"],
+- deps = [":cloudbuild_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "cloudbuild_java_gapic",
+- srcs = [":cloudbuild_proto_with_info"],
+- gapic_yaml = "cloudbuild_gapic.yaml",
+- grpc_service_config = "cloudbuild_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":cloudbuild_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":cloudbuild_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "cloudbuild_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.devtools.cloudbuild.v1.CloudBuildClientHttpJsonTest",
+- "com.google.cloud.devtools.cloudbuild.v1.CloudBuildClientTest",
+- ],
+- runtime_deps = [":cloudbuild_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-devtools-cloudbuild-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":cloudbuild_java_gapic",
+- ":cloudbuild_java_grpc",
+- ":cloudbuild_java_proto",
+- ":cloudbuild_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "cloudbuild_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1",
+- protos = [":cloudbuild_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "cloudbuild_go_gapic",
+- srcs = [":cloudbuild_proto_with_info"],
+- grpc_service_config = "cloudbuild_grpc_service_config.json",
+- importpath = "cloud.google.com/go/cloudbuild/apiv1;cloudbuild",
+- rest_numeric_enums = False,
+- service_yaml = "cloudbuild_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":cloudbuild_go_proto",
+- "//google/api:httpbody_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "cloudbuild_go_gapic_test",
+- srcs = [":cloudbuild_go_gapic_srcjar_test"],
+- embed = [":cloudbuild_go_gapic"],
+- importpath = "cloud.google.com/go/cloudbuild/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-devtools-cloudbuild-v1-go",
+- deps = [
+- ":cloudbuild_go_gapic",
+- ":cloudbuild_go_gapic_srcjar-test.srcjar",
+- ":cloudbuild_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-py_gapic_library(
+- name = "cloudbuild_py_gapic",
+- srcs = [":cloudbuild_proto"],
+- grpc_service_config = "cloudbuild_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-build",
+- "python-gapic-namespace=google.cloud.devtools",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "cloudbuild_py_gapic_test",
+- srcs = [
+- "cloudbuild_py_gapic_pytest.py",
+- "cloudbuild_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":cloudbuild_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "devtools-cloudbuild-v1-py",
+- deps = [
+- ":cloudbuild_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "cloudbuild_php_proto",
+- deps = [":cloudbuild_proto"],
+-)
+-
+-php_grpc_library(
+- name = "cloudbuild_php_grpc",
+- srcs = [":cloudbuild_proto"],
+- deps = [":cloudbuild_php_proto"],
+-)
+-
+-# Add api.http options to all RPCs in the services to enable PHP GAPIC
+-#php_gapic_library(
+-# name = "cloudbuild_php_gapic",
+-# srcs = [":cloudbuild_proto_with_info"],
+-# service_yaml = "cloudbuild_v1.yaml",
+-# deps = [
+-# ":cloudbuild_php_grpc",
+-# ":cloudbuild_php_proto",
+-# ],
+-#)
+-#
+-## Open Source Packages
+-#php_gapic_assembly_pkg(
+-# name = "google-cloud-devtools-cloudbuild-v1-php",
+-# deps = [
+-# ":cloudbuild_php_gapic",
+-# ":cloudbuild_php_grpc",
+-# ":cloudbuild_php_proto",
+-# ],
+-#)
+-
+-nodejs_gapic_library(
+- name = "cloudbuild_nodejs_gapic",
+- package_name = "@google-cloud/cloudbuild",
+- src = ":cloudbuild_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudbuild_grpc_service_config.json",
+- package = "google.devtools.cloudbuild.v1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudbuild_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "devtools-cloudbuild-v1-nodejs",
+- deps = [
+- ":cloudbuild_nodejs_gapic",
+- ":cloudbuild_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-
+-ruby_proto_library(
+- name = "cloudbuild_ruby_proto",
+- deps = [":cloudbuild_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "cloudbuild_ruby_grpc",
+- srcs = [":cloudbuild_proto"],
+- deps = [":cloudbuild_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "cloudbuild_ruby_gapic",
+- srcs = [":cloudbuild_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-build-v1",
+- "ruby-cloud-env-prefix=CLOUD_BUILD",
+- "ruby-cloud-product-url=https://cloud.google.com/cloud-build",
+- "ruby-cloud-api-id=cloudbuild.googleapis.com",
+- "ruby-cloud-api-shortname=cloudbuild",
+- ],
+- grpc_service_config = "cloudbuild_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Build is a service that executes your builds on Google Cloud Platform infrastructure. Cloud Build can import source code from Google Cloud Storage, Cloud Source Repositories, GitHub, or Bitbucket, execute a build to your specifications, and produce artifacts such as Docker containers or Java archives.",
+- ruby_cloud_title = "Cloud Build V1",
+- deps = [
+- ":cloudbuild_ruby_grpc",
+- ":cloudbuild_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-devtools-cloudbuild-v1-ruby",
+- deps = [
+- ":cloudbuild_ruby_gapic",
+- ":cloudbuild_ruby_grpc",
+- ":cloudbuild_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-
+-csharp_proto_library(
+- name = "cloudbuild_csharp_proto",
+- deps = [":cloudbuild_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "cloudbuild_csharp_grpc",
+- srcs = [":cloudbuild_proto"],
+- deps = [":cloudbuild_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "cloudbuild_csharp_gapic",
+- srcs = [":cloudbuild_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudbuild_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudbuild_v1.yaml",
+- deps = [
+- ":cloudbuild_csharp_grpc",
+- ":cloudbuild_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-devtools-cloudbuild-v1-csharp",
+- deps = [
+- ":cloudbuild_csharp_gapic",
+- ":cloudbuild_csharp_grpc",
+- ":cloudbuild_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "cloudbuild_cc_proto",
+- deps = [":cloudbuild_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "cloudbuild_cc_grpc",
+- srcs = [":cloudbuild_proto"],
+- grpc_only = True,
+- deps = [":cloudbuild_cc_proto"],
+-)
+diff -urN a/google/devtools/clouddebugger/BUILD.bazel b/google/devtools/clouddebugger/BUILD.bazel
+--- a/google/devtools/clouddebugger/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/clouddebugger/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/devtools/clouddebugger/v2/BUILD.bazel b/google/devtools/clouddebugger/v2/BUILD.bazel
+--- a/google/devtools/clouddebugger/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/clouddebugger/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,342 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "clouddebugger_proto",
+- srcs = [
+- "controller.proto",
+- "data.proto",
+- "debugger.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/devtools/source/v1:source_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "clouddebugger_proto_with_info",
+- deps = [
+- ":clouddebugger_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "clouddebugger_java_proto",
+- deps = [":clouddebugger_proto"],
+-)
+-
+-java_grpc_library(
+- name = "clouddebugger_java_grpc",
+- srcs = [":clouddebugger_proto"],
+- deps = [":clouddebugger_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "clouddebugger_java_gapic",
+- srcs = [":clouddebugger_proto_with_info"],
+- gapic_yaml = "clouddebugger_gapic.yaml",
+- grpc_service_config = "clouddebugger_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":clouddebugger_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":clouddebugger_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "clouddebugger_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.debugger.v2.Controller2ClientHttpJsonTest",
+- "com.google.cloud.debugger.v2.Controller2ClientTest",
+- "com.google.cloud.debugger.v2.Debugger2ClientHttpJsonTest",
+- "com.google.cloud.debugger.v2.Debugger2ClientTest",
+- ],
+- runtime_deps = [":clouddebugger_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-devtools-clouddebugger-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":clouddebugger_java_gapic",
+- ":clouddebugger_java_grpc",
+- ":clouddebugger_java_proto",
+- ":clouddebugger_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "clouddebugger_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2",
+- protos = [":clouddebugger_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/devtools/source/v1:source_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "clouddebugger_go_gapic",
+- srcs = [":clouddebugger_proto_with_info"],
+- grpc_service_config = "clouddebugger_grpc_service_config.json",
+- importpath = "cloud.google.com/go/debugger/apiv2;clouddebugger",
+- rest_numeric_enums = False,
+- service_yaml = "clouddebugger_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":clouddebugger_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "clouddebugger_go_gapic_test",
+- srcs = [":clouddebugger_go_gapic_srcjar_test"],
+- embed = [":clouddebugger_go_gapic"],
+- importpath = "cloud.google.com/go/debugger/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-devtools-clouddebugger-v2-go",
+- deps = [
+- ":clouddebugger_go_gapic",
+- ":clouddebugger_go_gapic_srcjar-test.srcjar",
+- ":clouddebugger_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "clouddebugger_py_gapic",
+- srcs = [":clouddebugger_proto"],
+- grpc_service_config = "clouddebugger_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-debugger-client",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=debugger",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1376 is fixed
+-#py_test(
+-# name = "clouddebugger_py_gapic_test",
+-# srcs = [
+-# "clouddebugger_py_gapic_pytest.py",
+-# "clouddebugger_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":clouddebugger_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "devtools-clouddebugger-v2-py",
+- deps = [
+- ":clouddebugger_py_gapic",
+- "//google/devtools/source/v1:google-cloud-source-v1-py",
+- ],
+-)
+-
+-php_proto_library(
+- name = "clouddebugger_php_proto",
+- deps = [":clouddebugger_proto"],
+-)
+-
+-php_grpc_library(
+- name = "clouddebugger_php_grpc",
+- srcs = [":clouddebugger_proto"],
+- deps = [":clouddebugger_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "clouddebugger_php_gapic",
+- srcs = [":clouddebugger_proto_with_info"],
+- grpc_service_config = "clouddebugger_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":clouddebugger_php_grpc",
+- ":clouddebugger_php_proto",
+- "//google/devtools/source/v1:source_php_grpc",
+- "//google/devtools/source/v1:source_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-devtools-clouddebugger-v2-php",
+- deps = [
+- ":clouddebugger_php_gapic",
+- ":clouddebugger_php_grpc",
+- ":clouddebugger_php_proto",
+- "//google/devtools/source/v1:source_php_grpc",
+- "//google/devtools/source/v1:source_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "clouddebugger_nodejs_gapic",
+- src = ":clouddebugger_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "clouddebugger_grpc_service_config.json",
+- package = "google.devtools.clouddebugger.v2",
+- rest_numeric_enums = False,
+- service_yaml = "clouddebugger_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "devtools-clouddebugger-v2-nodejs",
+- deps = [
+- ":clouddebugger_nodejs_gapic",
+- ":clouddebugger_proto",
+- "//google/devtools/source/v1:source_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "clouddebugger_ruby_proto",
+- deps = [":clouddebugger_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "clouddebugger_ruby_grpc",
+- srcs = [":clouddebugger_proto"],
+- deps = [":clouddebugger_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "clouddebugger_ruby_gapic",
+- srcs = [":clouddebugger_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-debugger-v2",
+- "ruby-cloud-env-prefix=DEBUGGER",
+- "ruby-cloud-product-url=https://cloud.google.com/debugger",
+- "ruby-cloud-api-id=clouddebugger.googleapis.com",
+- "ruby-cloud-api-shortname=clouddebugger",
+- "ruby-cloud-service-override=Controller2=Controller;Debugger2=Debugger",
+- ],
+- grpc_service_config = "clouddebugger_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Cloud Debugger API allows applications to interact with the Google Cloud Debugger backends. It provides two interfaces: the Debugger interface and the Controller interface. The Controller interface allows you to implement an agent that sends state data -- for example, the value of program variables and the call stack -- to Cloud Debugger when the application is running. The Debugger interface allows you to implement a Cloud Debugger client that allows users to set and delete the breakpoints at which the state data is collected, as well as read the data that is captured.",
+- ruby_cloud_title = "Cloud Debugger V2",
+- deps = [
+- ":clouddebugger_ruby_grpc",
+- ":clouddebugger_ruby_proto",
+- "//google/devtools/source/v1:source_ruby_grpc",
+- "//google/devtools/source/v1:source_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-devtools-clouddebugger-v2-ruby",
+- deps = [
+- ":clouddebugger_ruby_gapic",
+- ":clouddebugger_ruby_grpc",
+- ":clouddebugger_ruby_proto",
+- "//google/devtools/source/v1:source_ruby_grpc",
+- "//google/devtools/source/v1:source_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "clouddebugger_csharp_proto",
+- deps = [":clouddebugger_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "clouddebugger_csharp_grpc",
+- srcs = [":clouddebugger_proto"],
+- deps = [":clouddebugger_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "clouddebugger_csharp_gapic",
+- srcs = [":clouddebugger_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "clouddebugger_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "clouddebugger_v2.yaml",
+- deps = [
+- ":clouddebugger_csharp_grpc",
+- ":clouddebugger_csharp_proto",
+- "//google/devtools/source/v1:source_csharp_grpc",
+- "//google/devtools/source/v1:source_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-devtools-clouddebugger-v2-csharp",
+- deps = [
+- ":clouddebugger_csharp_gapic",
+- ":clouddebugger_csharp_grpc",
+- ":clouddebugger_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "clouddebugger_cc_proto",
+- deps = [":clouddebugger_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "clouddebugger_cc_grpc",
+- srcs = [":clouddebugger_proto"],
+- grpc_only = True,
+- deps = [":clouddebugger_cc_proto"],
+-)
+diff -urN a/google/devtools/clouderrorreporting/BUILD.bazel b/google/devtools/clouderrorreporting/BUILD.bazel
+--- a/google/devtools/clouderrorreporting/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/clouderrorreporting/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/devtools/clouderrorreporting/v1beta1/BUILD.bazel b/google/devtools/clouderrorreporting/v1beta1/BUILD.bazel
+--- a/google/devtools/clouderrorreporting/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/clouderrorreporting/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,332 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "clouderrorreporting_proto",
+- srcs = [
+- "common.proto",
+- "error_group_service.proto",
+- "error_stats_service.proto",
+- "report_errors_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "clouderrorreporting_proto_with_info",
+- deps = [
+- ":clouderrorreporting_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "clouderrorreporting_java_proto",
+- deps = [":clouderrorreporting_proto"],
+-)
+-
+-java_grpc_library(
+- name = "clouderrorreporting_java_grpc",
+- srcs = [":clouderrorreporting_proto"],
+- deps = [":clouderrorreporting_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "clouderrorreporting_java_gapic",
+- srcs = [":clouderrorreporting_proto_with_info"],
+- grpc_service_config = "errorreporting_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":clouderrorreporting_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":clouderrorreporting_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "clouderrorreporting_java_gapic_test_suite",
+- test_classes = [
+- "com.google.devtools.clouderrorreporting.v1beta1.ErrorGroupServiceClientHttpJsonTest",
+- "com.google.devtools.clouderrorreporting.v1beta1.ErrorGroupServiceClientTest",
+- "com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClientHttpJsonTest",
+- "com.google.devtools.clouderrorreporting.v1beta1.ErrorStatsServiceClientTest",
+- "com.google.devtools.clouderrorreporting.v1beta1.ReportErrorsServiceClientHttpJsonTest",
+- "com.google.devtools.clouderrorreporting.v1beta1.ReportErrorsServiceClientTest",
+- ],
+- runtime_deps = [":clouderrorreporting_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-devtools-clouderrorreporting-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":clouderrorreporting_java_gapic",
+- ":clouderrorreporting_java_grpc",
+- ":clouderrorreporting_java_proto",
+- ":clouderrorreporting_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "clouderrorreporting_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1",
+- protos = [":clouderrorreporting_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/appengine/logging/v1:logging_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "clouderrorreporting_go_gapic",
+- srcs = [":clouderrorreporting_proto_with_info"],
+- grpc_service_config = "errorreporting_grpc_service_config.json",
+- importpath = "cloud.google.com/go/devtools/clouderrorreporting/apiv1beta1;clouderrorreporting",
+- rest_numeric_enums = False,
+- service_yaml = "clouderrorreporting_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":clouderrorreporting_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "clouderrorreporting_go_gapic_test",
+- srcs = [":clouderrorreporting_go_gapic_srcjar_test"],
+- embed = [":clouderrorreporting_go_gapic"],
+- importpath = "cloud.google.com/go/devtools/clouderrorreporting/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-devtools-clouderrorreporting-v1beta1-go",
+- deps = [
+- ":clouderrorreporting_go_gapic",
+- ":clouderrorreporting_go_gapic_srcjar-test.srcjar",
+- ":clouderrorreporting_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "clouderrorreporting_py_gapic",
+- srcs = [":clouderrorreporting_proto"],
+- grpc_service_config = "errorreporting_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=errorreporting",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-error-reporting",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "clouderrorreporting_py_gapic_test",
+- srcs = [
+- "clouderrorreporting_py_gapic_pytest.py",
+- "clouderrorreporting_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":clouderrorreporting_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "devtools-clouderrorreporting-v1beta1-py",
+- deps = [
+- ":clouderrorreporting_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "clouderrorreporting_php_proto",
+- deps = [":clouderrorreporting_proto"],
+-)
+-
+-php_grpc_library(
+- name = "clouderrorreporting_php_grpc",
+- srcs = [":clouderrorreporting_proto"],
+- deps = [":clouderrorreporting_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "clouderrorreporting_php_gapic",
+- srcs = [":clouderrorreporting_proto_with_info"],
+- grpc_service_config = "errorreporting_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":clouderrorreporting_php_grpc",
+- ":clouderrorreporting_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-devtools-clouderrorreporting-v1beta1-php",
+- deps = [
+- ":clouderrorreporting_php_gapic",
+- ":clouderrorreporting_php_grpc",
+- ":clouderrorreporting_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "clouderrorreporting_nodejs_gapic",
+- package_name = "@google-cloud/clouderrorreporting",
+- src = ":clouderrorreporting_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "errorreporting_grpc_service_config.json",
+- package = "google.devtools.clouderrorreporting.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "clouderrorreporting_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "devtools-clouderrorreporting-v1beta1-nodejs",
+- deps = [
+- ":clouderrorreporting_nodejs_gapic",
+- ":clouderrorreporting_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "clouderrorreporting_ruby_proto",
+- deps = [":clouderrorreporting_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "clouderrorreporting_ruby_grpc",
+- srcs = [":clouderrorreporting_proto"],
+- deps = [":clouderrorreporting_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "clouderrorreporting_ruby_gapic",
+- srcs = [":clouderrorreporting_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-error_reporting-v1beta1",
+- "ruby-cloud-env-prefix=ERROR_REPORTING",
+- "ruby-cloud-product-url=https://cloud.google.com/error-reporting",
+- "ruby-cloud-api-id=clouderrorreporting.googleapis.com",
+- "ruby-cloud-api-shortname=clouderrorreporting",
+- ],
+- grpc_service_config = "errorreporting_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Error Reporting API provides a simple endpoint to report errors from your running service, and read access to error groups and their associated errors.",
+- ruby_cloud_title = "Error Reporting V1beta1",
+- deps = [
+- ":clouderrorreporting_ruby_grpc",
+- ":clouderrorreporting_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-devtools-clouderrorreporting-v1beta1-ruby",
+- deps = [
+- ":clouderrorreporting_ruby_gapic",
+- ":clouderrorreporting_ruby_grpc",
+- ":clouderrorreporting_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "clouderrorreporting_csharp_proto",
+- deps = [":clouderrorreporting_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "clouderrorreporting_csharp_grpc",
+- srcs = [":clouderrorreporting_proto"],
+- deps = [":clouderrorreporting_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "clouderrorreporting_csharp_gapic",
+- srcs = [":clouderrorreporting_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "errorreporting_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "clouderrorreporting_v1beta1.yaml",
+- deps = [
+- ":clouderrorreporting_csharp_grpc",
+- ":clouderrorreporting_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-devtools-clouderrorreporting-v1beta1-csharp",
+- deps = [
+- ":clouderrorreporting_csharp_gapic",
+- ":clouderrorreporting_csharp_grpc",
+- ":clouderrorreporting_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/devtools/cloudprofiler/BUILD.bazel b/google/devtools/cloudprofiler/BUILD.bazel
+--- a/google/devtools/cloudprofiler/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/cloudprofiler/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-profiler.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for cloudprofiler.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v2 in this case.
+-ruby_cloud_gapic_library(
+- name = "cloudprofiler_ruby_wrapper",
+- srcs = ["//google/devtools/cloudprofiler/v2:cloudprofiler_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-profiler",
+- "ruby-cloud-env-prefix=PROFILER",
+- "ruby-cloud-wrapper-of=v2:0.2",
+- "ruby-cloud-product-url=https://cloud.google.com/profiler/",
+- "ruby-cloud-api-id=cloudprofiler.googleapis.com",
+- "ruby-cloud-api-shortname=cloudprofiler",
+- ],
+- ruby_cloud_description = "Cloud Profiler is a statistical, low-overhead profiler that continuously gathers CPU usage and memory-allocation information from your production applications. It attributes that information to the application's source code, helping you identify the parts of the application consuming the most resources, and otherwise illuminating the performance characteristics of the code.",
+- ruby_cloud_title = "Cloud Profiler",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-profiler-ruby",
+- deps = [
+- ":cloudprofiler_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/devtools/cloudprofiler/v2/BUILD.bazel b/google/devtools/cloudprofiler/v2/BUILD.bazel
+--- a/google/devtools/cloudprofiler/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/cloudprofiler/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,326 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "cloudprofiler_proto",
+- srcs = [
+- "profiler.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "cloudprofiler_proto_with_info",
+- deps = [
+- ":cloudprofiler_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "cloudprofiler_java_proto",
+- deps = [":cloudprofiler_proto"],
+-)
+-
+-java_grpc_library(
+- name = "cloudprofiler_java_grpc",
+- srcs = [":cloudprofiler_proto"],
+- deps = [":cloudprofiler_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "cloudprofiler_java_gapic",
+- srcs = [":cloudprofiler_proto_with_info"],
+- grpc_service_config = "cloudprofiler_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":cloudprofiler_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":cloudprofiler_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "cloudprofiler_java_gapic_test_suite",
+- test_classes = [
+- "com.google.devtools.cloudprofiler.v2.ProfilerServiceClientHttpJsonTest",
+- "com.google.devtools.cloudprofiler.v2.ProfilerServiceClientTest",
+- ],
+- runtime_deps = [":cloudprofiler_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-devtools-cloudprofiler-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":cloudprofiler_java_gapic",
+- ":cloudprofiler_java_grpc",
+- ":cloudprofiler_java_proto",
+- ":cloudprofiler_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "cloudprofiler_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/cloudprofiler/v2",
+- protos = [":cloudprofiler_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "cloudprofiler_go_gapic",
+- srcs = [":cloudprofiler_proto_with_info"],
+- grpc_service_config = "cloudprofiler_grpc_service_config.json",
+- importpath = "cloud.google.com/go/devtools/cloudprofiler/apiv2;cloudprofiler",
+- rest_numeric_enums = False,
+- service_yaml = "cloudprofiler_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":cloudprofiler_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "cloudprofiler_go_gapic_test",
+- srcs = [":cloudprofiler_go_gapic_srcjar_test"],
+- embed = [":cloudprofiler_go_gapic"],
+- importpath = "cloud.google.com/go/devtools/cloudprofiler/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-devtools-cloudprofiler-v2-go",
+- deps = [
+- ":cloudprofiler_go_gapic",
+- ":cloudprofiler_go_gapic_srcjar-test.srcjar",
+- ":cloudprofiler_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "cloudprofiler_py_gapic",
+- srcs = [":cloudprofiler_proto"],
+- grpc_service_config = "cloudprofiler_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "cloudprofiler_py_gapic_test",
+- srcs = [
+- "cloudprofiler_py_gapic_pytest.py",
+- "cloudprofiler_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":cloudprofiler_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "devtools-cloudprofiler-v2-py",
+- deps = [
+- ":cloudprofiler_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "cloudprofiler_php_proto",
+- deps = [":cloudprofiler_proto"],
+-)
+-
+-php_grpc_library(
+- name = "cloudprofiler_php_grpc",
+- srcs = [":cloudprofiler_proto"],
+- deps = [":cloudprofiler_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "cloudprofiler_php_gapic",
+- srcs = [":cloudprofiler_proto_with_info"],
+- grpc_service_config = "cloudprofiler_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":cloudprofiler_php_grpc",
+- ":cloudprofiler_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-devtools-cloudprofiler-v2-php",
+- deps = [
+- ":cloudprofiler_php_gapic",
+- ":cloudprofiler_php_grpc",
+- ":cloudprofiler_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "cloudprofiler_nodejs_gapic",
+- package_name = "@google-cloud/cloudprofiler",
+- src = ":cloudprofiler_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudprofiler_grpc_service_config.json",
+- package = "google.devtools.cloudprofiler.v2",
+- rest_numeric_enums = False,
+- service_yaml = "cloudprofiler_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "devtools-cloudprofiler-v2-nodejs",
+- deps = [
+- ":cloudprofiler_nodejs_gapic",
+- ":cloudprofiler_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "cloudprofiler_ruby_proto",
+- deps = [":cloudprofiler_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "cloudprofiler_ruby_grpc",
+- srcs = [":cloudprofiler_proto"],
+- deps = [":cloudprofiler_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "cloudprofiler_ruby_gapic",
+- srcs = [":cloudprofiler_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-profiler-v2",
+- "ruby-cloud-env-prefix=PROFILER",
+- "ruby-cloud-product-url=https://cloud.google.com/profiler/",
+- "ruby-cloud-api-id=cloudprofiler.googleapis.com",
+- "ruby-cloud-api-shortname=cloudprofiler",
+- ],
+- grpc_service_config = "cloudprofiler_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Profiler is a statistical, low-overhead profiler that continuously gathers CPU usage and memory-allocation information from your production applications. It attributes that information to the application's source code, helping you identify the parts of the application consuming the most resources, and otherwise illuminating the performance characteristics of the code.",
+- ruby_cloud_title = "Cloud Profiler V2",
+- deps = [
+- ":cloudprofiler_ruby_grpc",
+- ":cloudprofiler_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-devtools-cloudprofiler-v2-ruby",
+- deps = [
+- ":cloudprofiler_ruby_gapic",
+- ":cloudprofiler_ruby_grpc",
+- ":cloudprofiler_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "cloudprofiler_csharp_proto",
+- deps = [":cloudprofiler_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "cloudprofiler_csharp_grpc",
+- srcs = [":cloudprofiler_proto"],
+- deps = [":cloudprofiler_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "cloudprofiler_csharp_gapic",
+- srcs = [":cloudprofiler_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudprofiler_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudprofiler_v2.yaml",
+- deps = [
+- ":cloudprofiler_csharp_grpc",
+- ":cloudprofiler_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-devtools-cloudprofiler-v2-csharp",
+- deps = [
+- ":cloudprofiler_csharp_gapic",
+- ":cloudprofiler_csharp_grpc",
+- ":cloudprofiler_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "cloudprofiler_cc_proto",
+- deps = [":cloudprofiler_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "cloudprofiler_cc_grpc",
+- srcs = [":cloudprofiler_proto"],
+- grpc_only = True,
+- deps = [":cloudprofiler_cc_proto"],
+-)
+diff -urN a/google/devtools/cloudtrace/BUILD.bazel b/google/devtools/cloudtrace/BUILD.bazel
+--- a/google/devtools/cloudtrace/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/cloudtrace/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/devtools/cloudtrace/v1/BUILD.bazel b/google/devtools/cloudtrace/v1/BUILD.bazel
+--- a/google/devtools/cloudtrace/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/cloudtrace/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,332 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "cloudtrace_proto",
+- srcs = [
+- "trace.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "cloudtrace_proto_with_info",
+- deps = [
+- ":cloudtrace_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "cloudtrace_java_proto",
+- deps = [":cloudtrace_proto"],
+-)
+-
+-java_grpc_library(
+- name = "cloudtrace_java_grpc",
+- srcs = [":cloudtrace_proto"],
+- deps = [":cloudtrace_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "cloudtrace_java_gapic",
+- srcs = [":cloudtrace_proto_with_info"],
+- gapic_yaml = "cloudtrace_gapic.yaml",
+- grpc_service_config = "cloudtrace_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":cloudtrace_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":cloudtrace_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "cloudtrace_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.trace.v1.TraceServiceClientHttpJsonTest",
+- "com.google.cloud.trace.v1.TraceServiceClientTest",
+- ],
+- runtime_deps = [":cloudtrace_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-devtools-cloudtrace-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":cloudtrace_java_gapic",
+- ":cloudtrace_java_grpc",
+- ":cloudtrace_java_proto",
+- ":cloudtrace_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "cloudtrace_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/cloudtrace/v1",
+- protos = [":cloudtrace_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "cloudtrace_go_gapic",
+- srcs = [":cloudtrace_proto_with_info"],
+- grpc_service_config = "cloudtrace_grpc_service_config.json",
+- importpath = "cloud.google.com/go/devtools/cloudtrace/apiv1;cloudtrace",
+- rest_numeric_enums = False,
+- service_yaml = "cloudtrace_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":cloudtrace_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "cloudtrace_go_gapic_test",
+- srcs = [":cloudtrace_go_gapic_srcjar_test"],
+- embed = [":cloudtrace_go_gapic"],
+- importpath = "cloud.google.com/go/devtools/cloudtrace/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-devtools-cloudtrace-v1-go",
+- deps = [
+- ":cloudtrace_go_gapic",
+- ":cloudtrace_go_gapic_srcjar-test.srcjar",
+- ":cloudtrace_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "cloudtrace_py_gapic",
+- srcs = [":cloudtrace_proto"],
+- grpc_service_config = "cloudtrace_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=trace",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "cloudtrace_py_gapic_test",
+- srcs = [
+- "cloudtrace_py_gapic_pytest.py",
+- "cloudtrace_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":cloudtrace_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "devtools-cloudtrace-v1-py",
+- deps = [
+- ":cloudtrace_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "cloudtrace_php_proto",
+- deps = [":cloudtrace_proto"],
+-)
+-
+-php_grpc_library(
+- name = "cloudtrace_php_grpc",
+- srcs = [":cloudtrace_proto"],
+- deps = [":cloudtrace_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "cloudtrace_php_gapic",
+- srcs = [":cloudtrace_proto_with_info"],
+- grpc_service_config = "cloudtrace_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":cloudtrace_php_grpc",
+- ":cloudtrace_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-devtools-cloudtrace-v1-php",
+- deps = [
+- ":cloudtrace_php_gapic",
+- ":cloudtrace_php_grpc",
+- ":cloudtrace_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "cloudtrace_nodejs_gapic",
+- src = ":cloudtrace_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudtrace_grpc_service_config.json",
+- package = "google.devtools.cloudtrace.v1",
+- rest_numeric_enums = False,
+- service_yaml = "cloudtrace_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "devtools-cloudtrace-v1-nodejs",
+- deps = [
+- ":cloudtrace_nodejs_gapic",
+- ":cloudtrace_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "cloudtrace_ruby_proto",
+- deps = [":cloudtrace_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "cloudtrace_ruby_grpc",
+- srcs = [":cloudtrace_proto"],
+- deps = [":cloudtrace_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "cloudtrace_ruby_gapic",
+- srcs = [":cloudtrace_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-trace-v1",
+- "ruby-cloud-env-prefix=TRACE",
+- "ruby-cloud-product-url=https://cloud.google.com/trace",
+- "ruby-cloud-api-id=cloudtrace.googleapis.com",
+- "ruby-cloud-api-shortname=cloudtrace",
+- ],
+- grpc_service_config = "cloudtrace_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Cloud Trace API lets you send and retrieve latency data to and from Cloud Trace. This API provides low-level interfaces for interacting directly with the feature. For some languages, you can use OpenCensus, a set of open source tracing and stats instrumentation libraries that work with multiple backends.",
+- ruby_cloud_title = "Cloud Trace V1",
+- deps = [
+- ":cloudtrace_ruby_grpc",
+- ":cloudtrace_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-devtools-cloudtrace-v1-ruby",
+- deps = [
+- ":cloudtrace_ruby_gapic",
+- ":cloudtrace_ruby_grpc",
+- ":cloudtrace_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "cloudtrace_csharp_proto",
+- deps = [":cloudtrace_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "cloudtrace_csharp_grpc",
+- srcs = [":cloudtrace_proto"],
+- deps = [":cloudtrace_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "cloudtrace_csharp_gapic",
+- srcs = [":cloudtrace_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudtrace_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudtrace_v1.yaml",
+- deps = [
+- ":cloudtrace_csharp_grpc",
+- ":cloudtrace_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-devtools-cloudtrace-v1-csharp",
+- deps = [
+- ":cloudtrace_csharp_gapic",
+- ":cloudtrace_csharp_grpc",
+- ":cloudtrace_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "cloudtrace_cc_proto",
+- deps = [":cloudtrace_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "cloudtrace_cc_grpc",
+- srcs = [":cloudtrace_proto"],
+- generate_mocks = True,
+- grpc_only = True,
+- deps = [":cloudtrace_cc_proto"],
+-)
+diff -urN a/google/devtools/cloudtrace/v2/BUILD.bazel b/google/devtools/cloudtrace/v2/BUILD.bazel
+--- a/google/devtools/cloudtrace/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/cloudtrace/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,337 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "cloudtrace_proto",
+- srcs = [
+- "trace.proto",
+- "tracing.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "cloudtrace_proto_with_info",
+- deps = [
+- ":cloudtrace_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "cloudtrace_java_proto",
+- deps = [":cloudtrace_proto"],
+-)
+-
+-java_grpc_library(
+- name = "cloudtrace_java_grpc",
+- srcs = [":cloudtrace_proto"],
+- deps = [":cloudtrace_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "cloudtrace_java_gapic",
+- srcs = [":cloudtrace_proto_with_info"],
+- gapic_yaml = "cloudtrace_gapic.yaml",
+- grpc_service_config = "cloudtrace_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":cloudtrace_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":cloudtrace_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "cloudtrace_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.trace.v2.TraceServiceClientHttpJsonTest",
+- "com.google.cloud.trace.v2.TraceServiceClientTest",
+- ],
+- runtime_deps = [":cloudtrace_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-devtools-cloudtrace-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":cloudtrace_java_gapic",
+- ":cloudtrace_java_grpc",
+- ":cloudtrace_java_proto",
+- ":cloudtrace_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "cloudtrace_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/cloudtrace/v2",
+- protos = [":cloudtrace_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "cloudtrace_go_gapic",
+- srcs = [":cloudtrace_proto_with_info"],
+- grpc_service_config = "cloudtrace_grpc_service_config.json",
+- importpath = "cloud.google.com/go/devtools/cloudtrace/apiv2;cloudtrace",
+- rest_numeric_enums = False,
+- service_yaml = "cloudtrace_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":cloudtrace_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "cloudtrace_go_gapic_test",
+- srcs = [":cloudtrace_go_gapic_srcjar_test"],
+- embed = [":cloudtrace_go_gapic"],
+- importpath = "cloud.google.com/go/devtools/cloudtrace/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-devtools-cloudtrace-v2-go",
+- deps = [
+- ":cloudtrace_go_gapic",
+- ":cloudtrace_go_gapic_srcjar-test.srcjar",
+- ":cloudtrace_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "cloudtrace_py_gapic",
+- srcs = [":cloudtrace_proto"],
+- grpc_service_config = "cloudtrace_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=trace",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "cloudtrace_py_gapic_test",
+- srcs = [
+- "cloudtrace_py_gapic_pytest.py",
+- "cloudtrace_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":cloudtrace_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "devtools-cloudtrace-v2-py",
+- deps = [
+- ":cloudtrace_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "cloudtrace_php_proto",
+- deps = [":cloudtrace_proto"],
+-)
+-
+-php_grpc_library(
+- name = "cloudtrace_php_grpc",
+- srcs = [":cloudtrace_proto"],
+- deps = [":cloudtrace_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "cloudtrace_php_gapic",
+- srcs = [":cloudtrace_proto_with_info"],
+- grpc_service_config = "cloudtrace_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":cloudtrace_php_grpc",
+- ":cloudtrace_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-devtools-cloudtrace-v2-php",
+- deps = [
+- ":cloudtrace_php_gapic",
+- ":cloudtrace_php_grpc",
+- ":cloudtrace_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "cloudtrace_nodejs_gapic",
+- src = ":cloudtrace_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "cloudtrace_grpc_service_config.json",
+- package = "google.devtools.cloudtrace.v2",
+- rest_numeric_enums = False,
+- service_yaml = "cloudtrace_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "devtools-cloudtrace-v2-nodejs",
+- deps = [
+- ":cloudtrace_nodejs_gapic",
+- ":cloudtrace_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "cloudtrace_ruby_proto",
+- deps = [":cloudtrace_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "cloudtrace_ruby_grpc",
+- srcs = [":cloudtrace_proto"],
+- deps = [":cloudtrace_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "cloudtrace_ruby_gapic",
+- srcs = [":cloudtrace_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-trace-v2",
+- "ruby-cloud-env-prefix=TRACE",
+- "ruby-cloud-product-url=https://cloud.google.com/trace",
+- "ruby-cloud-api-id=cloudtrace.googleapis.com",
+- "ruby-cloud-api-shortname=cloudtrace",
+- ],
+- grpc_service_config = "cloudtrace_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Cloud Trace API lets you send and retrieve latency data to and from Cloud Trace. This API provides low-level interfaces for interacting directly with the feature. For some languages, you can use OpenCensus, a set of open source tracing and stats instrumentation libraries that work with multiple backends.",
+- ruby_cloud_title = "Cloud Trace V2",
+- deps = [
+- ":cloudtrace_ruby_grpc",
+- ":cloudtrace_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-devtools-cloudtrace-v2-ruby",
+- deps = [
+- ":cloudtrace_ruby_gapic",
+- ":cloudtrace_ruby_grpc",
+- ":cloudtrace_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "cloudtrace_csharp_proto",
+- deps = [":cloudtrace_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "cloudtrace_csharp_grpc",
+- srcs = [":cloudtrace_proto"],
+- deps = [":cloudtrace_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "cloudtrace_csharp_gapic",
+- srcs = [":cloudtrace_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "cloudtrace_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "cloudtrace_v2.yaml",
+- deps = [
+- ":cloudtrace_csharp_grpc",
+- ":cloudtrace_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-devtools-cloudtrace-v2-csharp",
+- deps = [
+- ":cloudtrace_csharp_gapic",
+- ":cloudtrace_csharp_grpc",
+- ":cloudtrace_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "cloudtrace_cc_proto",
+- deps = [":cloudtrace_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "cloudtrace_cc_grpc",
+- srcs = [":cloudtrace_proto"],
+- generate_mocks = True,
+- grpc_only = True,
+- deps = [":cloudtrace_cc_proto"],
+-)
+diff -urN a/google/devtools/containeranalysis/BUILD.bazel b/google/devtools/containeranalysis/BUILD.bazel
+--- a/google/devtools/containeranalysis/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/containeranalysis/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-container_analysis.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for containeranalysis.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "containeranalysis_ruby_wrapper",
+- srcs = ["//google/devtools/containeranalysis/v1:containeranalysis_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-container_analysis",
+- "ruby-cloud-env-prefix=CONTAINER_ANALYSIS",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/container-registry/docs/container-analysis",
+- "ruby-cloud-api-id=containeranalysis.googleapis.com",
+- "ruby-cloud-api-shortname=containeranalysis",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "The Container Analysis API is an implementation of Grafeas. It stores, and enables querying and retrieval of, critical metadata about all of your software artifacts.",
+- ruby_cloud_title = "Container Analysis",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-containeranalysis-ruby",
+- deps = [
+- ":containeranalysis_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/devtools/containeranalysis/v1/BUILD.bazel b/google/devtools/containeranalysis/v1/BUILD.bazel
+--- a/google/devtools/containeranalysis/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/containeranalysis/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,363 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_proto_library",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "containeranalysis_proto",
+- srcs = [
+- "containeranalysis.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//grafeas/v1:grafeas_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "containeranalysis_proto_with_info",
+- deps = [
+- ":containeranalysis_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-## DO NOT REMOVE
+-## Node.js library must be built based on both ContainerAnalysis v1 and
+-## Grafeas v1 protos.
+-proto_library_with_info(
+- name = "containeranalysis_grafeas_proto_with_info",
+- deps = [
+- ":containeranalysis_proto",
+- "//google/cloud:common_resources_proto",
+- "//grafeas/v1:grafeas_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "containeranalysis_java_proto",
+- deps = [":containeranalysis_proto"],
+-)
+-
+-java_grpc_library(
+- name = "containeranalysis_java_grpc",
+- srcs = [":containeranalysis_proto"],
+- deps = [":containeranalysis_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "containeranalysis_java_gapic",
+- srcs = [":containeranalysis_proto_with_info"],
+- gapic_yaml = "containeranalysis_gapic.yaml",
+- grpc_service_config = "containeranalysis_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "containeranalysis_v1.yaml",
+- test_deps = [
+- ":containeranalysis_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":containeranalysis_java_proto",
+- "//google/api:api_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- "//grafeas/v1:common_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "containeranalysis_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.devtools.containeranalysis.v1.ContainerAnalysisClientHttpJsonTest",
+- "com.google.cloud.devtools.containeranalysis.v1.ContainerAnalysisClientTest",
+- ],
+- runtime_deps = [":containeranalysis_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-devtools-containeranalysis-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":containeranalysis_java_gapic",
+- ":containeranalysis_java_grpc",
+- ":containeranalysis_java_proto",
+- ":containeranalysis_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "containeranalysis_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1",
+- protos = [":containeranalysis_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//grafeas/v1:grafeas_go_proto",
+- ],
+-)
+-
+-# go_gapic_library(
+-# name = "containeranalysis_go_gapic",
+-# srcs = [":containeranalysis_proto_with_info"],
+-# grpc_service_config = "containeranalysis_grpc_service_config.json",
+-# importpath = "cloud.google.com/go/devtools/containeranalysis/apiv1;containeranalysis",
+-# metadata = True,
+-# service_yaml = "containeranalysis_v1.yaml",
+-# deps = [
+-# ":containeranalysis_go_proto",
+-# "//google/iam/v1:iam_go_proto",
+-# "//grafeas/v1:common_go_proto",
+-# ],
+-# )
+-
+-# go_test(
+-# name = "containeranalysis_go_gapic_test",
+-# srcs = [":containeranalysis_go_gapic_srcjar_test"],
+-# embed = [":containeranalysis_go_gapic"],
+-# importpath = "cloud.google.com/go/devtools/containeranalysis/apiv1",
+-# )
+-
+-# # Open Source Packages
+-# go_gapic_assembly_pkg(
+-# name = "gapi-cloud-devtools-containeranalysis-v1-go",
+-# deps = [
+-# ":containeranalysis_go_gapic",
+-# ":containeranalysis_go_gapic_srcjar-metadata.srcjar",
+-# ":containeranalysis_go_gapic_srcjar-test.srcjar",
+-# ":containeranalysis_go_proto",
+-# ],
+-# )
+-
+-py_gapic_library(
+- name = "containeranalysis_py_gapic",
+- srcs = [":containeranalysis_proto"],
+- grpc_service_config = "containeranalysis_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=google.cloud.devtools",
+- "warehouse-package-name=google-cloud-containeranalysis",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- "//google/iam/v1:policy_py_proto",
+- "//grafeas/v1:grafeas_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "containeranalysis_py_gapic_test",
+- srcs = [
+- "containeranalysis_py_gapic_pytest.py",
+- "containeranalysis_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":containeranalysis_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "devtools-containeranalysis-v1-py",
+- deps = [
+- ":containeranalysis_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "containeranalysis_php_proto",
+- deps = [":containeranalysis_proto"],
+-)
+-
+-php_grpc_library(
+- name = "containeranalysis_php_grpc",
+- srcs = [":containeranalysis_proto"],
+- deps = [":containeranalysis_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "containeranalysis_php_gapic",
+- srcs = [":containeranalysis_proto_with_info"],
+- grpc_service_config = "containeranalysis_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "containeranalysis_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":containeranalysis_php_grpc",
+- ":containeranalysis_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-devtools-containeranalysis-v1-php",
+- deps = [
+- ":containeranalysis_php_gapic",
+- ":containeranalysis_php_grpc",
+- ":containeranalysis_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "containeranalysis_nodejs_gapic",
+- package_name = "@google-cloud/containeranalysis",
+- ## DO NOT CHANGE: src must point to a combined proto target
+- src = ":containeranalysis_grafeas_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "containeranalysis_grpc_service_config.json",
+- main_service = "containeranalysis",
+- package = "google.devtools.containeranalysis.v1",
+- rest_numeric_enums = False,
+- service_yaml = "containeranalysis_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "devtools-containeranalysis-v1-nodejs",
+- deps = [
+- ":containeranalysis_nodejs_gapic",
+- ":containeranalysis_proto",
+- ## DO NOT CHANGE: must include Grafeas protos
+- "//grafeas/v1:grafeas_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "containeranalysis_ruby_proto",
+- deps = [":containeranalysis_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "containeranalysis_ruby_grpc",
+- srcs = [":containeranalysis_proto"],
+- deps = [":containeranalysis_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "containeranalysis_ruby_gapic",
+- srcs = [":containeranalysis_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-container_analysis-v1",
+- "ruby-cloud-env-prefix=CONTAINER_ANALYSIS",
+- "ruby-cloud-product-url=https://cloud.google.com/container-registry/docs/container-analysis",
+- "ruby-cloud-api-id=containeranalysis.googleapis.com",
+- "ruby-cloud-api-shortname=containeranalysis",
+- "ruby-cloud-extra-dependencies=grafeas-v1=>= 0.4|< 2.a",
+- ],
+- grpc_service_config = "containeranalysis_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Container Analysis API is an implementation of Grafeas. It stores, and enables querying and retrieval of, critical metadata about all of your software artifacts.",
+- ruby_cloud_title = "Container Analysis V1",
+- deps = [
+- ":containeranalysis_ruby_grpc",
+- ":containeranalysis_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-devtools-containeranalysis-v1-ruby",
+- deps = [
+- ":containeranalysis_ruby_gapic",
+- ":containeranalysis_ruby_grpc",
+- ":containeranalysis_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "containeranalysis_csharp_proto",
+- deps = [":containeranalysis_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "containeranalysis_csharp_grpc",
+- srcs = [":containeranalysis_proto"],
+- deps = [":containeranalysis_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "containeranalysis_csharp_gapic",
+- srcs = [":containeranalysis_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "containeranalysis_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "containeranalysis_v1.yaml",
+- deps = [
+- ":containeranalysis_csharp_grpc",
+- ":containeranalysis_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-devtools-containeranalysis-v1-csharp",
+- deps = [
+- ":containeranalysis_csharp_gapic",
+- ":containeranalysis_csharp_grpc",
+- ":containeranalysis_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "containeranalysis_cc_proto",
+- deps = [":containeranalysis_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "containeranalysis_cc_grpc",
+- srcs = [":containeranalysis_proto"],
+- grpc_only = True,
+- deps = [":containeranalysis_cc_proto"],
+-)
+diff -urN a/google/devtools/containeranalysis/v1beta1/BUILD.bazel b/google/devtools/containeranalysis/v1beta1/BUILD.bazel
+--- a/google/devtools/containeranalysis/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/containeranalysis/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,244 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-_PROTO_SUBPACKAGE_DEPS = [
+- "//google/devtools/containeranalysis/v1beta1/attestation:attestation_proto",
+- "//google/devtools/containeranalysis/v1beta1/build:build_proto",
+- "//google/devtools/containeranalysis/v1beta1/common:common_proto",
+- "//google/devtools/containeranalysis/v1beta1/cvss:cvss_proto",
+- "//google/devtools/containeranalysis/v1beta1/deployment:deployment_proto",
+- "//google/devtools/containeranalysis/v1beta1/discovery:discovery_proto",
+- "//google/devtools/containeranalysis/v1beta1/grafeas:grafeas_proto",
+- "//google/devtools/containeranalysis/v1beta1/image:image_proto",
+- "//google/devtools/containeranalysis/v1beta1/package:package_proto",
+- "//google/devtools/containeranalysis/v1beta1/provenance:provenance_proto",
+- "//google/devtools/containeranalysis/v1beta1/source:source_proto",
+- "//google/devtools/containeranalysis/v1beta1/vulnerability:vulnerability_proto",
+-]
+-
+-proto_library(
+- name = "containeranalysis_proto",
+- srcs = [
+- "containeranalysis.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "containeranalysis_proto_with_info",
+- deps = [
+- "//google/cloud:common_resources_proto",
+- ":containeranalysis_proto",
+- ] + _PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-_JAVA_PROTO_SUBPACKAGE_DEPS = [
+- "//google/devtools/containeranalysis/v1beta1/attestation:attestation_java_proto",
+- "//google/devtools/containeranalysis/v1beta1/build:build_java_proto",
+- "//google/devtools/containeranalysis/v1beta1/common:common_java_proto",
+- "//google/devtools/containeranalysis/v1beta1/deployment:deployment_java_proto",
+- "//google/devtools/containeranalysis/v1beta1/discovery:discovery_java_proto",
+- "//google/devtools/containeranalysis/v1beta1/grafeas:grafeas_java_proto",
+- "//google/devtools/containeranalysis/v1beta1/image:image_java_proto",
+- "//google/devtools/containeranalysis/v1beta1/package:package_java_proto",
+- "//google/devtools/containeranalysis/v1beta1/provenance:provenance_java_proto",
+- "//google/devtools/containeranalysis/v1beta1/source:source_java_proto",
+- "//google/devtools/containeranalysis/v1beta1/vulnerability:vulnerability_java_proto",
+-]
+-
+-_JAVA_GRPC_SUBPACKAGE_DEPS = [
+- "//google/devtools/containeranalysis/v1beta1/attestation:attestation_java_grpc",
+- "//google/devtools/containeranalysis/v1beta1/build:build_java_grpc",
+- "//google/devtools/containeranalysis/v1beta1/common:common_java_grpc",
+- "//google/devtools/containeranalysis/v1beta1/deployment:deployment_java_grpc",
+- "//google/devtools/containeranalysis/v1beta1/discovery:discovery_java_grpc",
+- "//google/devtools/containeranalysis/v1beta1/grafeas:grafeas_java_grpc",
+- "//google/devtools/containeranalysis/v1beta1/image:image_java_grpc",
+- "//google/devtools/containeranalysis/v1beta1/package:package_java_grpc",
+- "//google/devtools/containeranalysis/v1beta1/provenance:provenance_java_grpc",
+- "//google/devtools/containeranalysis/v1beta1/source:source_java_grpc",
+- "//google/devtools/containeranalysis/v1beta1/vulnerability:vulnerability_java_grpc",
+-]
+-
+-java_proto_library(
+- name = "containeranalysis_java_proto",
+- deps = [":containeranalysis_proto"],
+-)
+-
+-java_grpc_library(
+- name = "containeranalysis_java_grpc",
+- srcs = [":containeranalysis_proto"],
+- deps = [":containeranalysis_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "containeranalysis_java_gapic",
+- srcs = [":containeranalysis_proto_with_info"],
+- gapic_yaml = "containeranalysis_gapic.yaml",
+- grpc_service_config = "containeranalysis_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":containeranalysis_java_grpc",
+- ] + _JAVA_GRPC_SUBPACKAGE_DEPS,
+- transport = "grpc+rest",
+- deps = [
+- ":containeranalysis_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ] + _JAVA_PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-java_gapic_test(
+- name = "containeranalysis_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1ClientHttpJsonTest",
+- "com.google.cloud.devtools.containeranalysis.v1beta1.ContainerAnalysisV1Beta1ClientTest",
+- "com.google.cloud.devtools.containeranalysis.v1beta1.GrafeasV1Beta1ClientHttpJsonTest",
+- "com.google.cloud.devtools.containeranalysis.v1beta1.GrafeasV1Beta1ClientTest",
+- ],
+- runtime_deps = ["containeranalysis_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-devtools-containeranalysis-v1beta1-java",
+- transport = "grpc+rest",
+- deps = [
+- ":containeranalysis_java_gapic",
+- ":containeranalysis_java_grpc",
+- ":containeranalysis_java_proto",
+- ":containeranalysis_proto",
+- ] + _JAVA_GRPC_SUBPACKAGE_DEPS + _JAVA_PROTO_SUBPACKAGE_DEPS + _PROTO_SUBPACKAGE_DEPS,
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "containeranalysis_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1",
+- protos = [":containeranalysis_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "containeranalysis_go_gapic",
+- srcs = [":containeranalysis_proto_with_info"],
+- grpc_service_config = "containeranalysis_grpc_service_config.json",
+- importpath = "cloud.google.com/go/containeranalysis/apiv1beta1;containeranalysis",
+- rest_numeric_enums = False,
+- service_yaml = "containeranalysis_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":containeranalysis_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/attestation:attestation_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/build:build_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/common:common_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/deployment:deployment_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/discovery:discovery_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/grafeas:grafeas_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/image:image_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/package:package_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/provenance:provenance_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/source:source_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/vulnerability:vulnerability_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "containeranalysis_go_gapic_test",
+- srcs = [":containeranalysis_go_gapic_srcjar_test"],
+- embed = [":containeranalysis_go_gapic"],
+- importpath = "cloud.google.com/go/containeranalysis/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-devtools-containeranalysis-v1beta1-go",
+- deps = [
+- ":containeranalysis_go_gapic",
+- ":containeranalysis_go_gapic_srcjar-test.srcjar",
+- ":containeranalysis_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/attestation:attestation_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/build:build_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/common:common_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/deployment:deployment_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/discovery:discovery_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/grafeas:grafeas_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/image:image_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/package:package_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/provenance:provenance_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/source:source_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/vulnerability:vulnerability_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "containeranalysis_nodejs_gapic",
+- package_name = "@google-cloud/containeranalysis",
+- src = ":containeranalysis_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "containeranalysis_grpc_service_config.json",
+- main_service = "containeranalysis",
+- package = "google.devtools.containeranalysis.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "containeranalysis_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "devtools-containeranalysis-v1beta1-nodejs",
+- deps = [
+- ":containeranalysis_nodejs_gapic",
+- ":containeranalysis_proto",
+- ] + _PROTO_SUBPACKAGE_DEPS,
+-)
+diff -urN a/google/devtools/containeranalysis/v1beta1/attestation/BUILD.bazel b/google/devtools/containeranalysis/v1beta1/attestation/BUILD.bazel
+--- a/google/devtools/containeranalysis/v1beta1/attestation/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/containeranalysis/v1beta1/attestation/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,59 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "attestation_proto",
+- srcs = [
+- "attestation.proto",
+- ],
+- deps = [
+- "//google/devtools/containeranalysis/v1beta1/common:common_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "attestation_proto_with_info",
+- deps = [":attestation_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "attestation_java_proto",
+- deps = [":attestation_proto"],
+-)
+-
+-java_grpc_library(
+- name = "attestation_java_grpc",
+- srcs = [":attestation_proto"],
+- deps = [":attestation_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "attestation_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/attestation",
+- protos = [":attestation_proto"],
+- deps = [
+- "//google/devtools/containeranalysis/v1beta1/common:common_go_proto",
+- ],
+-)
+diff -urN a/google/devtools/containeranalysis/v1beta1/build/BUILD.bazel b/google/devtools/containeranalysis/v1beta1/build/BUILD.bazel
+--- a/google/devtools/containeranalysis/v1beta1/build/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/containeranalysis/v1beta1/build/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,58 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "build_proto",
+- srcs = [
+- "build.proto",
+- ],
+- deps = [
+- "//google/devtools/containeranalysis/v1beta1/provenance:provenance_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "build_proto_with_info",
+- deps = [":build_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+-)
+-
+-java_proto_library(
+- name = "build_java_proto",
+- deps = [":build_proto"],
+-)
+-
+-java_grpc_library(
+- name = "build_java_grpc",
+- srcs = [":build_proto"],
+- deps = [":build_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "build_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/build",
+- protos = [":build_proto"],
+- deps = [
+- "//google/devtools/containeranalysis/v1beta1/provenance:provenance_go_proto",
+- ],
+-)
+diff -urN a/google/devtools/containeranalysis/v1beta1/common/BUILD.bazel b/google/devtools/containeranalysis/v1beta1/common/BUILD.bazel
+--- a/google/devtools/containeranalysis/v1beta1/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/containeranalysis/v1beta1/common/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,55 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "common_proto",
+- srcs = [
+- "common.proto",
+- ],
+- deps = [],
+-)
+-
+-proto_library_with_info(
+- name = "common_proto_with_info",
+- deps = [":common_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "common_java_proto",
+- deps = [":common_proto"],
+-)
+-
+-java_grpc_library(
+- name = "common_java_grpc",
+- srcs = [":common_proto"],
+- deps = [":common_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "common_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/common",
+- protos = [":common_proto"],
+- deps = [],
+-)
+diff -urN a/google/devtools/containeranalysis/v1beta1/cvss/BUILD.bazel b/google/devtools/containeranalysis/v1beta1/cvss/BUILD.bazel
+--- a/google/devtools/containeranalysis/v1beta1/cvss/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/containeranalysis/v1beta1/cvss/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,55 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "cvss_proto",
+- srcs = [
+- "cvss.proto",
+- ],
+- deps = [],
+-)
+-
+-proto_library_with_info(
+- name = "cvss_proto_with_info",
+- deps = [":cvss_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "cvss_java_proto",
+- deps = [":cvss_proto"],
+-)
+-
+-java_grpc_library(
+- name = "cvss_java_grpc",
+- srcs = [":cvss_proto"],
+- deps = [":cvss_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "cvss_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/cvss",
+- protos = [":cvss_proto"],
+- deps = [],
+-)
+diff -urN a/google/devtools/containeranalysis/v1beta1/deployment/BUILD.bazel b/google/devtools/containeranalysis/v1beta1/deployment/BUILD.bazel
+--- a/google/devtools/containeranalysis/v1beta1/deployment/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/containeranalysis/v1beta1/deployment/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,56 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "deployment_proto",
+- srcs = [
+- "deployment.proto",
+- ],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "deployment_proto_with_info",
+- deps = [":deployment_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+-)
+-
+-java_proto_library(
+- name = "deployment_java_proto",
+- deps = [":deployment_proto"],
+-)
+-
+-java_grpc_library(
+- name = "deployment_java_grpc",
+- srcs = [":deployment_proto"],
+- deps = [":deployment_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "deployment_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/deployment",
+- protos = [":deployment_proto"],
+- deps = [],
+-)
+diff -urN a/google/devtools/containeranalysis/v1beta1/discovery/BUILD.bazel b/google/devtools/containeranalysis/v1beta1/discovery/BUILD.bazel
+--- a/google/devtools/containeranalysis/v1beta1/discovery/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/containeranalysis/v1beta1/discovery/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,61 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "discovery_proto",
+- srcs = [
+- "discovery.proto",
+- ],
+- deps = [
+- "//google/devtools/containeranalysis/v1beta1/common:common_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "discovery_proto_with_info",
+- deps = [":discovery_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+-)
+-
+-java_proto_library(
+- name = "discovery_java_proto",
+- deps = [":discovery_proto"],
+-)
+-
+-java_grpc_library(
+- name = "discovery_java_grpc",
+- srcs = [":discovery_proto"],
+- deps = [":discovery_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "discovery_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/discovery",
+- protos = [":discovery_proto"],
+- deps = [
+- "//google/devtools/containeranalysis/v1beta1/common:common_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+diff -urN a/google/devtools/containeranalysis/v1beta1/grafeas/BUILD.bazel b/google/devtools/containeranalysis/v1beta1/grafeas/BUILD.bazel
+--- a/google/devtools/containeranalysis/v1beta1/grafeas/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/containeranalysis/v1beta1/grafeas/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,82 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "grafeas_proto",
+- srcs = [
+- "grafeas.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/devtools/containeranalysis/v1beta1/attestation:attestation_proto",
+- "//google/devtools/containeranalysis/v1beta1/build:build_proto",
+- "//google/devtools/containeranalysis/v1beta1/common:common_proto",
+- "//google/devtools/containeranalysis/v1beta1/deployment:deployment_proto",
+- "//google/devtools/containeranalysis/v1beta1/discovery:discovery_proto",
+- "//google/devtools/containeranalysis/v1beta1/image:image_proto",
+- "//google/devtools/containeranalysis/v1beta1/package:package_proto",
+- "//google/devtools/containeranalysis/v1beta1/provenance:provenance_proto",
+- "//google/devtools/containeranalysis/v1beta1/vulnerability:vulnerability_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "grafeas_proto_with_info",
+- deps = [":grafeas_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "grafeas_java_proto",
+- deps = [":grafeas_proto"],
+-)
+-
+-java_grpc_library(
+- name = "grafeas_java_grpc",
+- srcs = [":grafeas_proto"],
+- deps = [":grafeas_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "grafeas_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas",
+- protos = [":grafeas_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/attestation:attestation_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/build:build_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/common:common_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/deployment:deployment_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/discovery:discovery_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/image:image_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/package:package_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/provenance:provenance_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/vulnerability:vulnerability_go_proto",
+- ],
+-)
+diff -urN a/google/devtools/containeranalysis/v1beta1/image/BUILD.bazel b/google/devtools/containeranalysis/v1beta1/image/BUILD.bazel
+--- a/google/devtools/containeranalysis/v1beta1/image/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/containeranalysis/v1beta1/image/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,54 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "image_proto",
+- srcs = [
+- "image.proto",
+- ],
+- deps = [],
+-)
+-
+-proto_library_with_info(
+- name = "image_proto_with_info",
+- deps = [":image_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+-)
+-
+-java_proto_library(
+- name = "image_java_proto",
+- deps = [":image_proto"],
+-)
+-
+-java_grpc_library(
+- name = "image_java_grpc",
+- srcs = [":image_proto"],
+- deps = [":image_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "image_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/image",
+- protos = [":image_proto"],
+- deps = [],
+-)
+diff -urN a/google/devtools/containeranalysis/v1beta1/package/BUILD.bazel b/google/devtools/containeranalysis/v1beta1/package/BUILD.bazel
+--- a/google/devtools/containeranalysis/v1beta1/package/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/containeranalysis/v1beta1/package/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,55 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "package_proto",
+- srcs = [
+- "package.proto",
+- ],
+- deps = [],
+-)
+-
+-proto_library_with_info(
+- name = "package_proto_with_info",
+- deps = [":package_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "package_java_proto",
+- deps = [":package_proto"],
+-)
+-
+-java_grpc_library(
+- name = "package_java_grpc",
+- srcs = [":package_proto"],
+- deps = [":package_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "package_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/package",
+- protos = [":package_proto"],
+- deps = [],
+-)
+diff -urN a/google/devtools/containeranalysis/v1beta1/provenance/BUILD.bazel b/google/devtools/containeranalysis/v1beta1/provenance/BUILD.bazel
+--- a/google/devtools/containeranalysis/v1beta1/provenance/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/containeranalysis/v1beta1/provenance/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,60 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "provenance_proto",
+- srcs = [
+- "provenance.proto",
+- ],
+- deps = [
+- "//google/devtools/containeranalysis/v1beta1/source:source_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "provenance_proto_with_info",
+- deps = [":provenance_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "provenance_java_proto",
+- deps = [":provenance_proto"],
+-)
+-
+-java_grpc_library(
+- name = "provenance_java_grpc",
+- srcs = [":provenance_proto"],
+- deps = [":provenance_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "provenance_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/provenance",
+- protos = [":provenance_proto"],
+- deps = [
+- "//google/devtools/containeranalysis/v1beta1/source:source_go_proto",
+- ],
+-)
+diff -urN a/google/devtools/containeranalysis/v1beta1/source/BUILD.bazel b/google/devtools/containeranalysis/v1beta1/source/BUILD.bazel
+--- a/google/devtools/containeranalysis/v1beta1/source/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/containeranalysis/v1beta1/source/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,55 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "source_proto",
+- srcs = [
+- "source.proto",
+- ],
+- deps = [],
+-)
+-
+-proto_library_with_info(
+- name = "source_proto_with_info",
+- deps = [":source_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "source_java_proto",
+- deps = [":source_proto"],
+-)
+-
+-java_grpc_library(
+- name = "source_java_grpc",
+- srcs = [":source_proto"],
+- deps = [":source_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "source_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/source",
+- protos = [":source_proto"],
+- deps = [],
+-)
+diff -urN a/google/devtools/containeranalysis/v1beta1/vulnerability/BUILD.bazel b/google/devtools/containeranalysis/v1beta1/vulnerability/BUILD.bazel
+--- a/google/devtools/containeranalysis/v1beta1/vulnerability/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/containeranalysis/v1beta1/vulnerability/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,64 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "vulnerability_proto",
+- srcs = [
+- "vulnerability.proto",
+- ],
+- deps = [
+- "//google/devtools/containeranalysis/v1beta1/common:common_proto",
+- "//google/devtools/containeranalysis/v1beta1/cvss:cvss_proto",
+- "//google/devtools/containeranalysis/v1beta1/package:package_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "vulnerability_proto_with_info",
+- deps = [":vulnerability_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "vulnerability_java_proto",
+- deps = [":vulnerability_proto"],
+-)
+-
+-java_grpc_library(
+- name = "vulnerability_java_grpc",
+- srcs = [":vulnerability_proto"],
+- deps = [":vulnerability_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "vulnerability_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/vulnerability",
+- protos = [":vulnerability_proto"],
+- deps = [
+- "//google/devtools/containeranalysis/v1beta1/common:common_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/cvss:cvss_go_proto",
+- "//google/devtools/containeranalysis/v1beta1/package:package_go_proto",
+- ],
+-)
+diff -urN a/google/devtools/remoteworkers/v1test2/BUILD.bazel b/google/devtools/remoteworkers/v1test2/BUILD.bazel
+--- a/google/devtools/remoteworkers/v1test2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/remoteworkers/v1test2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,315 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "remoteworkers_proto",
+- srcs = [
+- "bots.proto",
+- "command.proto",
+- "worker.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "remoteworkers_proto_with_info",
+- deps = [
+- ":remoteworkers_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "remoteworkers_java_proto",
+- deps = [":remoteworkers_proto"],
+-)
+-
+-java_grpc_library(
+- name = "remoteworkers_java_grpc",
+- srcs = [":remoteworkers_proto"],
+- deps = [":remoteworkers_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "remoteworkers_java_gapic",
+- srcs = [":remoteworkers_proto_with_info"],
+- gapic_yaml = "remoteworkers_gapic.yaml",
+- grpc_service_config = "remoteworkers_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":remoteworkers_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":remoteworkers_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "remoteworkers_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.devtools.remoteworkers.v1test2.BotsClientHttpJsonTest",
+- "com.google.cloud.devtools.remoteworkers.v1test2.BotsClientTest",
+- ],
+- runtime_deps = [":remoteworkers_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-devtools-remoteworkers-v1test2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":remoteworkers_java_gapic",
+- ":remoteworkers_java_grpc",
+- ":remoteworkers_java_proto",
+- ":remoteworkers_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "remoteworkers_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/remoteworkers/v1test2",
+- protos = [":remoteworkers_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "remoteworkers_go_gapic",
+- srcs = [":remoteworkers_proto_with_info"],
+- grpc_service_config = "remoteworkers_grpc_service_config.json",
+- importpath = "cloud.google.com/go/devtools/remoteworkers/apiv1test2;remoteworkers",
+- rest_numeric_enums = False,
+- service_yaml = "remoteworkers_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":remoteworkers_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "remoteworkers_go_gapic_test",
+- srcs = [":remoteworkers_go_gapic_srcjar_test"],
+- embed = [":remoteworkers_go_gapic"],
+- importpath = "cloud.google.com/go/devtools/remoteworkers/apiv1test2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-devtools-remoteworkers-v1test2-go",
+- deps = [
+- ":remoteworkers_go_gapic",
+- ":remoteworkers_go_gapic_srcjar-test.srcjar",
+- ":remoteworkers_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "remoteworkers_py_gapic",
+- srcs = [":remoteworkers_proto"],
+- grpc_service_config = "remoteworkers_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "remoteworkers_py_gapic_test",
+- srcs = [
+- "remoteworkers_py_gapic_pytest.py",
+- "remoteworkers_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":remoteworkers_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "devtools-remoteworkers-v1test2-py",
+- deps = [
+- ":remoteworkers_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "remoteworkers_php_proto",
+- deps = [":remoteworkers_proto"],
+-)
+-
+-php_grpc_library(
+- name = "remoteworkers_php_grpc",
+- srcs = [":remoteworkers_proto"],
+- deps = [":remoteworkers_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "remoteworkers_php_gapic",
+- srcs = [":remoteworkers_proto_with_info"],
+- grpc_service_config = "remoteworkers_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":remoteworkers_php_grpc",
+- ":remoteworkers_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-devtools-remoteworkers-v1test2-php",
+- deps = [
+- ":remoteworkers_php_gapic",
+- ":remoteworkers_php_grpc",
+- ":remoteworkers_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "remoteworkers_nodejs_gapic",
+- src = ":remoteworkers_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "remoteworkers_grpc_service_config.json",
+- package = "google.devtools.remoteworkers.v1test2",
+- rest_numeric_enums = False,
+- service_yaml = "remoteworkers_v1beta2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "devtools-remoteworkers-v1test2-nodejs",
+- deps = [
+- ":remoteworkers_nodejs_gapic",
+- ":remoteworkers_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "remoteworkers_ruby_proto",
+- deps = [":remoteworkers_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "remoteworkers_ruby_grpc",
+- srcs = [":remoteworkers_proto"],
+- deps = [":remoteworkers_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "remoteworkers_ruby_gapic",
+- srcs = [":remoteworkers_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-remoteworkers-v1test2"],
+- rest_numeric_enums = False,
+- deps = [
+- ":remoteworkers_ruby_grpc",
+- ":remoteworkers_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-devtools-remoteworkers-v1test2-ruby",
+- deps = [
+- ":remoteworkers_ruby_gapic",
+- ":remoteworkers_ruby_grpc",
+- ":remoteworkers_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "remoteworkers_csharp_proto",
+- deps = [":remoteworkers_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "remoteworkers_csharp_grpc",
+- srcs = [":remoteworkers_proto"],
+- deps = [":remoteworkers_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "remoteworkers_csharp_gapic",
+- srcs = [":remoteworkers_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "remoteworkers_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "remoteworkers_v1beta2.yaml",
+- deps = [
+- ":remoteworkers_csharp_grpc",
+- ":remoteworkers_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-devtools-remoteworkers-v1test2-csharp",
+- deps = [
+- ":remoteworkers_csharp_gapic",
+- ":remoteworkers_csharp_grpc",
+- ":remoteworkers_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/devtools/resultstore/v2/BUILD.bazel b/google/devtools/resultstore/v2/BUILD.bazel
+--- a/google/devtools/resultstore/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/resultstore/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,209 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "resultstore_proto",
+- srcs = [
+- "action.proto",
+- "common.proto",
+- "configuration.proto",
+- "configured_target.proto",
+- "coverage.proto",
+- "coverage_summary.proto",
+- "download_metadata.proto",
+- "file.proto",
+- "file_processing_error.proto",
+- "file_set.proto",
+- "invocation.proto",
+- "resultstore_download.proto",
+- "resultstore_file_download.proto",
+- "resultstore_upload.proto",
+- "target.proto",
+- "test_suite.proto",
+- "upload_metadata.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "resultstore_java_proto",
+- deps = [":resultstore_proto"],
+-)
+-
+-java_grpc_library(
+- name = "resultstore_java_grpc",
+- srcs = [":resultstore_proto"],
+- deps = [":resultstore_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "resultstore_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/resultstore/v2",
+- protos = [":resultstore_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "resultstore_moved_proto",
+- srcs = [":resultstore_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "resultstore_py_proto",
+- deps = [":resultstore_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "resultstore_py_grpc",
+- srcs = [":resultstore_moved_proto"],
+- deps = [":resultstore_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "resultstore_php_proto",
+- deps = [":resultstore_proto"],
+-)
+-
+-php_grpc_library(
+- name = "resultstore_php_grpc",
+- srcs = [":resultstore_proto"],
+- deps = [":resultstore_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "resultstore_ruby_proto",
+- deps = [":resultstore_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "resultstore_ruby_grpc",
+- srcs = [":resultstore_proto"],
+- deps = [":resultstore_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "resultstore_csharp_proto",
+- deps = [":resultstore_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "resultstore_csharp_grpc",
+- srcs = [":resultstore_proto"],
+- deps = [":resultstore_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "resultstore_cc_proto",
+- deps = [":resultstore_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "resultstore_cc_grpc",
+- srcs = [":resultstore_proto"],
+- grpc_only = True,
+- deps = [":resultstore_cc_proto"],
+-)
+diff -urN a/google/devtools/source/v1/BUILD.bazel b/google/devtools/source/v1/BUILD.bazel
+--- a/google/devtools/source/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/source/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,143 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_proto_library",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "source_proto",
+- srcs = [
+- "source_context.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "source_proto_with_info",
+- deps = [
+- ":source_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "source_java_proto",
+- deps = [":source_proto"],
+-)
+-
+-java_grpc_library(
+- name = "source_java_grpc",
+- srcs = [":source_proto"],
+- deps = [":source_java_proto"],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-devtools-source-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":source_java_grpc",
+- ":source_java_proto",
+- ":source_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "source_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/devtools/source/v1",
+- protos = [":source_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "source_py_gapic",
+- srcs = [":source_proto"],
+- opt_args = [
+- "warehouse-package-name=google-cloud-source-context",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=source_context",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "google-cloud-source-v1-py",
+- deps = [
+- ":source_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "source_php_proto",
+- deps = [":source_proto"],
+-)
+-
+-php_grpc_library(
+- name = "source_php_grpc",
+- srcs = [":source_proto"],
+- deps = [":source_php_proto"],
+-)
+-
+-ruby_proto_library(
+- name = "source_ruby_proto",
+- deps = [":source_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "source_ruby_grpc",
+- srcs = [":source_proto"],
+- deps = [":source_ruby_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "source_csharp_proto",
+- deps = [":source_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "source_csharp_grpc",
+- srcs = [":source_proto"],
+- deps = [":source_csharp_proto"],
+-)
+-
+-cc_proto_library(
+- name = "source_cc_proto",
+- deps = [":source_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "source_cc_grpc",
+- srcs = [":source_proto"],
+- grpc_only = True,
+- deps = [":source_cc_proto"],
+-)
+diff -urN a/google/devtools/testing/v1/BUILD.bazel b/google/devtools/testing/v1/BUILD.bazel
+--- a/google/devtools/testing/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/devtools/testing/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,351 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "testing_proto",
+- srcs = [
+- "application_details.proto",
+- "test_environment_discovery.proto",
+- "test_execution.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/type:date_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "testing_proto_with_info",
+- deps = [
+- ":testing_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "testing_java_proto",
+- deps = [":testing_proto"],
+-)
+-
+-java_grpc_library(
+- name = "testing_java_grpc",
+- srcs = [":testing_proto"],
+- deps = [":testing_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "testing_java_gapic",
+- srcs = [":testing_proto_with_info"],
+- grpc_service_config = "testing_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":testing_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":testing_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "testing_java_gapic_test_suite",
+- test_classes = [
+- "com.google.devtools.testing.v1.ApplicationDetailServiceClientHttpJsonTest",
+- "com.google.devtools.testing.v1.ApplicationDetailServiceClientTest",
+- "com.google.devtools.testing.v1.TestEnvironmentDiscoveryServiceClientHttpJsonTest",
+- "com.google.devtools.testing.v1.TestEnvironmentDiscoveryServiceClientTest",
+- "com.google.devtools.testing.v1.TestExecutionServiceClientHttpJsonTest",
+- "com.google.devtools.testing.v1.TestExecutionServiceClientTest",
+- ],
+- runtime_deps = [":testing_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-devtools-testing-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":testing_java_gapic",
+- ":testing_java_grpc",
+- ":testing_java_proto",
+- ":testing_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-#
+-# Commented out because of a build failure:
+-# bazel-out/k8-fastbuild/bin/google/devtools/testing/v1/testing_go_gapic_srcjar_main.go/cloud.google.com/go/devtools/testing/apiv1/test_environment_discovery_client.go:23:2: imported and not used: "net/url"
+-# compilepkg: error running subcommand external/go_sdk/pkg/tool/linux_amd64/compile: exit status 2
+-#
+-# load(
+-# "@com_google_googleapis_imports//:imports.bzl",
+-# "go_gapic_assembly_pkg",
+-# "go_gapic_library",
+-# "go_proto_library",
+-# "go_test",
+-# )
+-
+-# go_proto_library(
+-# name = "testing_go_proto",
+-# compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+-# importpath = "google.golang.org/genproto/googleapis/devtools/testing/v1",
+-# protos = [":testing_proto"],
+-# deps = [
+-# "//google/api:annotations_go_proto",
+-# "//google/type:date_go_proto",
+-# ],
+-# )
+-
+-# go_gapic_library(
+-# name = "testing_go_gapic",
+-# srcs = [":testing_proto_with_info"],
+-# grpc_service_config = "testing_grpc_service_config.json",
+-# importpath = "cloud.google.com/go/devtools/testing/apiv1;testing",
+-# service_yaml = "testing_v1.yaml",
+-# metadata = True,
+-# deps = [
+-# ":testing_go_proto",
+-# "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+-# ],
+-# )
+-
+-# go_test(
+-# name = "testing_go_gapic_test",
+-# srcs = [":testing_go_gapic_srcjar_test"],
+-# embed = [":testing_go_gapic"],
+-# importpath = "cloud.google.com/go/devtools/testing/apiv1",
+-# )
+-
+-# # Open Source Packages
+-# go_gapic_assembly_pkg(
+-# name = "gapi-cloud-devtools-testing-v1-go",
+-# deps = [
+-# ":testing_go_gapic",
+-# ":testing_go_gapic_srcjar-test.srcjar",
+-# ":testing_go_gapic_srcjar-metadata.srcjar",
+-# ":testing_go_proto",
+-# ],
+-# )
+-
+-py_gapic_library(
+- name = "testing_py_gapic",
+- srcs = [":testing_proto"],
+- grpc_service_config = "testing_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1376 is fixed
+-#py_test(
+-# name = "testing_py_gapic_test",
+-# srcs = [
+-# "testing_py_gapic_pytest.py",
+-# "testing_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":testing_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "devtools-testing-v1-py",
+- deps = [
+- ":testing_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "testing_php_proto",
+- deps = [":testing_proto"],
+-)
+-
+-php_grpc_library(
+- name = "testing_php_grpc",
+- srcs = [":testing_proto"],
+- deps = [":testing_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "testing_php_gapic",
+- srcs = [":testing_proto_with_info"],
+- grpc_service_config = "testing_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "testing_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":testing_php_grpc",
+- ":testing_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-devtools-testing-v1-php",
+- deps = [
+- ":testing_php_gapic",
+- ":testing_php_grpc",
+- ":testing_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "testing_nodejs_gapic",
+- package_name = "@google-cloud/testing",
+- src = ":testing_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "testing_grpc_service_config.json",
+- package = "google.devtools.testing.v1",
+- rest_numeric_enums = False,
+- service_yaml = "testing_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "devtools-testing-v1-nodejs",
+- deps = [
+- ":testing_nodejs_gapic",
+- ":testing_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "testing_ruby_proto",
+- deps = [":testing_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "testing_ruby_grpc",
+- srcs = [":testing_proto"],
+- deps = [":testing_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "testing_ruby_gapic",
+- srcs = [":testing_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-devtools-testing-v1",
+- ],
+- grpc_service_config = "testing_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":testing_ruby_grpc",
+- ":testing_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-devtools-testing-v1-ruby",
+- deps = [
+- ":testing_ruby_gapic",
+- ":testing_ruby_grpc",
+- ":testing_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-#
+-# Commented out until enum path segments are supported.
+-# --gapic_out: System.InvalidOperationException: Path in http url must resolve to a string field: 'environment_type'.
+-#
+-# load(
+-# "@com_google_googleapis_imports//:imports.bzl",
+-# "csharp_gapic_assembly_pkg",
+-# "csharp_gapic_library",
+-# "csharp_grpc_library",
+-# "csharp_proto_library",
+-# )
+-
+-# csharp_proto_library(
+-# name = "testing_csharp_proto",
+-# deps = [":testing_proto"],
+-# )
+-
+-# csharp_grpc_library(
+-# name = "testing_csharp_grpc",
+-# srcs = [":testing_proto"],
+-# deps = [":testing_csharp_proto"],
+-# )
+-
+-# csharp_gapic_library(
+-# name = "testing_csharp_gapic",
+-# srcs = [":testing_proto_with_info"],
+-# common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+-# grpc_service_config = "testing_grpc_service_config.json",
+-# deps = [
+-# ":testing_csharp_grpc",
+-# ":testing_csharp_proto",
+-# ],
+-# )
+-
+-# # Open Source Packages
+-# csharp_gapic_assembly_pkg(
+-# name = "google-cloud-devtools-testing-v1-csharp",
+-# deps = [
+-# ":testing_csharp_gapic",
+-# ":testing_csharp_grpc",
+-# ":testing_csharp_proto",
+-# ],
+-# )
+-
+-cc_proto_library(
+- name = "testing_cc_proto",
+- deps = [":testing_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "testing_cc_grpc",
+- srcs = [":testing_proto"],
+- grpc_only = True,
+- deps = [":testing_cc_proto"],
+-)
+diff -urN a/google/example/endpointsapis/BUILD.bazel b/google/example/endpointsapis/BUILD.bazel
+--- a/google/example/endpointsapis/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/example/endpointsapis/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/example/library/BUILD.bazel b/google/example/library/BUILD.bazel
+--- a/google/example/library/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/example/library/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/example/library/v1/BUILD.bazel b/google/example/library/v1/BUILD.bazel
+--- a/google/example/library/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/example/library/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,332 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "library_proto",
+- srcs = [
+- "library.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "library_proto_with_info",
+- deps = [
+- ":library_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "library_java_proto",
+- deps = [":library_proto"],
+-)
+-
+-java_grpc_library(
+- name = "library_java_grpc",
+- srcs = [":library_proto"],
+- deps = [":library_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "library_java_gapic",
+- srcs = [":library_proto_with_info"],
+- gapic_yaml = "library_example_gapic.yaml",
+- grpc_service_config = "library_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":library_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":library_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "library_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.example.library.v1.LibraryServiceClientHttpJsonTest",
+- "com.google.cloud.example.library.v1.LibraryServiceClientTest",
+- ],
+- runtime_deps = [":library_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-example-library-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":library_java_gapic",
+- ":library_java_grpc",
+- ":library_java_proto",
+- ":library_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "library_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/example/library/v1",
+- protos = [":library_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "library_go_gapic",
+- srcs = [":library_proto_with_info"],
+- grpc_service_config = "library_grpc_service_config.json",
+- importpath = "google.golang.org/google/example/library/v1;library",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "//google/example/library:library_example_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":library_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "library_go_gapic_test",
+- srcs = [":library_go_gapic_srcjar_test"],
+- embed = [":library_go_gapic"],
+- importpath = "google.golang.org/google/example/library/v1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-example-library-v1-go",
+- deps = [
+- ":library_go_gapic",
+- ":library_go_gapic_srcjar-metadata.srcjar",
+- ":library_go_gapic_srcjar-test.srcjar",
+- ":library_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "library_py_gapic",
+- srcs = [":library_proto"],
+- grpc_service_config = "library_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "library_py_gapic_test",
+- srcs = [
+- "library_py_gapic_pytest.py",
+- "library_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":library_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "example-library-v1-py",
+- deps = [
+- ":library_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "library_php_proto",
+- deps = [":library_proto"],
+-)
+-
+-php_grpc_library(
+- name = "library_php_grpc",
+- srcs = [":library_proto"],
+- deps = [":library_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "library_php_gapic",
+- srcs = [":library_proto_with_info"],
+- grpc_service_config = "library_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//google/example/library:library_example_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":library_php_grpc",
+- ":library_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-example-library-v1-php",
+- deps = [
+- ":library_php_gapic",
+- ":library_php_grpc",
+- ":library_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "library_nodejs_gapic",
+- package_name = "@google-cloud/library",
+- src = ":library_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "library_grpc_service_config.json",
+- package = "google.cloud.example.library.v1",
+- rest_numeric_enums = False,
+- service_yaml = "//google/example/library:library_example_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "example-library-v1-nodejs",
+- deps = [
+- ":library_nodejs_gapic",
+- ":library_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "library_ruby_proto",
+- deps = [":library_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "library_ruby_grpc",
+- srcs = [":library_proto"],
+- deps = [":library_ruby_proto"],
+-)
+-
+-# Uncomment the following once the space issue has been fixed.
+-ruby_cloud_gapic_library(
+- name = "library_ruby_gapic",
+- srcs = [":library_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-example_library-v1",
+- "ruby-cloud-env-prefix=LIBRARY",
+- "ruby-cloud-product-url=https://cloud.google.com",
+- "ruby-cloud-api-id=library-example.googleapis.com",
+- "ruby-cloud-api-shortname=library",
+- ],
+- grpc_service_config = "library_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "This is a Google example service representing a simple digital library. It manages a collection of shelf resources, and each shelf owns a collection of book resources.",
+- ruby_cloud_title = "Example Library V1",
+- deps = [
+- ":library_ruby_grpc",
+- ":library_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-example-library-v1-ruby",
+- deps = [
+- ":library_ruby_gapic",
+- ":library_ruby_grpc",
+- ":library_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "library_csharp_proto",
+- deps = [":library_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "library_csharp_grpc",
+- srcs = [":library_proto"],
+- deps = [":library_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "library_csharp_gapic",
+- srcs = [":library_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "library_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//google/example/library:library_example_v1.yaml",
+- deps = [
+- ":library_csharp_grpc",
+- ":library_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-example-library-v1-csharp",
+- deps = [
+- ":library_csharp_gapic",
+- ":library_csharp_grpc",
+- ":library_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "library_cc_proto",
+- deps = [":library_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "library_cc_grpc",
+- srcs = [":library_proto"],
+- grpc_only = True,
+- deps = [":library_cc_proto"],
+-)
+diff -urN a/google/firestore/BUILD.bazel b/google/firestore/BUILD.bazel
+--- a/google/firestore/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/firestore/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/firestore/admin/BUILD.bazel b/google/firestore/admin/BUILD.bazel
+--- a/google/firestore/admin/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/firestore/admin/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/firestore/admin/v1/BUILD.bazel b/google/firestore/admin/v1/BUILD.bazel
+--- a/google/firestore/admin/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/firestore/admin/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,410 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "admin_proto",
+- srcs = [
+- "database.proto",
+- "field.proto",
+- "firestore_admin.proto",
+- "index.proto",
+- "location.proto",
+- "operation.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "admin_proto_with_info",
+- deps = [
+- ":admin_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "admin_java_proto",
+- deps = [":admin_proto"],
+-)
+-
+-java_grpc_library(
+- name = "admin_java_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "admin_java_gapic",
+- srcs = [":admin_proto_with_info"],
+- gapic_yaml = "firestore_gapic.yaml",
+- grpc_service_config = "firestore_admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "firestore_v1.yaml",
+- test_deps = [
+- ":admin_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":admin_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "admin_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.firestore.v1.FirestoreAdminClientHttpJsonTest",
+- "com.google.cloud.firestore.v1.FirestoreAdminClientTest",
+- ],
+- runtime_deps = [":admin_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-firestore-admin-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":admin_java_gapic",
+- ":admin_java_grpc",
+- ":admin_java_proto",
+- ":admin_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "admin_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/firestore/admin/v1",
+- protos = [":admin_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "admin_go_gapic",
+- srcs = [":admin_proto_with_info"],
+- grpc_service_config = "firestore_admin_grpc_service_config.json",
+- importpath = "cloud.google.com/go/firestore/admin/apiv1;admin",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "firestore_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":admin_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "admin_go_gapic_test",
+- srcs = [":admin_go_gapic_srcjar_test"],
+- embed = [":admin_go_gapic"],
+- importpath = "cloud.google.com/go/firestore/admin/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-firestore-admin-v1-go",
+- deps = [
+- ":admin_go_gapic",
+- ":admin_go_gapic_srcjar-metadata.srcjar",
+- ":admin_go_gapic_srcjar-test.srcjar",
+- ":admin_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "admin_py_gapic",
+- srcs = [":admin_proto"],
+- grpc_service_config = "firestore_admin_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=firestore_admin",
+- "python-gapic-namespace=google.cloud",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "firestore_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "admin_py_gapic_test",
+- srcs = [
+- "admin_py_gapic_pytest.py",
+- "admin_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":admin_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "firestore-admin-v1-py",
+- deps = [
+- ":admin_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "admin_php_proto",
+- deps = [":admin_proto"],
+-)
+-
+-php_grpc_library(
+- name = "admin_php_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "admin_php_gapic",
+- srcs = [":admin_proto_with_info"],
+- grpc_service_config = "firestore_admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "firestore_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":admin_php_grpc",
+- ":admin_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-firestore-admin-v1-php",
+- deps = [
+- ":admin_php_gapic",
+- ":admin_php_grpc",
+- ":admin_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "admin_nodejs_gapic",
+- package_name = "@google-cloud/firestore-admin",
+- src = ":admin_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "firestore_admin_grpc_service_config.json",
+- package = "google.firestore.admin.v1",
+- rest_numeric_enums = False,
+- service_yaml = "firestore_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "firestore-admin-v1-nodejs",
+- deps = [
+- ":admin_nodejs_gapic",
+- ":admin_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "admin_ruby_proto",
+- deps = [":admin_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "admin_ruby_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "admin_ruby_gapic",
+- srcs = [":admin_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=firestore.googleapis.com",
+- "ruby-cloud-api-shortname=firestore",
+- "ruby-cloud-env-prefix=FIRESTORE",
+- "ruby-cloud-gem-name=google-cloud-firestore-admin-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/firestore",
+- "ruby-cloud-wrapper-gem-override=google-cloud-firestore",
+- ],
+- grpc_service_config = "firestore_admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Firestore is a NoSQL document database built for automatic scaling, high performance, and ease of application development.",
+- ruby_cloud_title = "Cloud Firestore Admin V1",
+- service_yaml = "firestore_v1.yaml",
+- deps = [
+- ":admin_ruby_grpc",
+- ":admin_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-firestore-admin-v1-ruby",
+- deps = [
+- ":admin_ruby_gapic",
+- ":admin_ruby_grpc",
+- ":admin_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "admin_csharp_proto",
+- deps = [":admin_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "admin_csharp_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "admin_csharp_gapic",
+- srcs = [":admin_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "firestore_admin_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "firestore_v1.yaml",
+- deps = [
+- ":admin_csharp_grpc",
+- ":admin_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-firestore-admin-v1-csharp",
+- deps = [
+- ":admin_csharp_gapic",
+- ":admin_csharp_grpc",
+- ":admin_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "admin_cc_proto",
+- deps = [":admin_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "admin_cc_grpc",
+- srcs = [":admin_proto"],
+- grpc_only = True,
+- deps = [":admin_cc_proto"],
+-)
+diff -urN a/google/firestore/bundle/BUILD.bazel b/google/firestore/bundle/BUILD.bazel
+--- a/google/firestore/bundle/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/firestore/bundle/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,121 +0,0 @@
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "firestore_bundle_proto",
+- srcs = [
+- "bundle.proto",
+- ],
+- deps = [
+- "//google/firestore/v1:firestore_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "firestore_bundle_proto_with_info",
+- deps = [
+- ":firestore_bundle_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "firestore_bundle_java_proto",
+- deps = [":firestore_bundle_proto"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-firestore-bundle-v1-java",
+- transport = "grpc+rest",
+- deps = [
+- ":firestore_bundle_java_proto",
+- ":firestore_bundle_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-# Put your Go rules here
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "firestore_bundle_py_gapic",
+- srcs = [":firestore_bundle_proto"],
+- opt_args = ["python-gapic-namespace=google.cloud"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "firestore-bundle-py",
+- deps = [
+- ":firestore_bundle_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-# Put your PHP rules here
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-# Put your Node.js rules here
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-# Put your Ruby rules here
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-# Put your C# rules here
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "firestore_bundle_cc_proto",
+- deps = [":firestore_bundle_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "firestore_bundle_cc_grpc",
+- srcs = [":firestore_bundle_proto"],
+- grpc_only = True,
+- deps = [":firestore_bundle_cc_proto"],
+-)
+diff -urN a/google/firestore/v1/BUILD.bazel b/google/firestore/v1/BUILD.bazel
+--- a/google/firestore/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/firestore/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,409 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "firestore_proto",
+- srcs = [
+- "aggregation_result.proto",
+- "common.proto",
+- "document.proto",
+- "firestore.proto",
+- "query.proto",
+- "write.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/rpc:status_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "firestore_proto_with_info",
+- deps = [
+- ":firestore_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/cloud/location:location_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "firestore_java_proto",
+- deps = [":firestore_proto"],
+-)
+-
+-java_grpc_library(
+- name = "firestore_java_grpc",
+- srcs = [":firestore_proto"],
+- deps = [":firestore_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "firestore_java_gapic",
+- srcs = [":firestore_proto_with_info"],
+- gapic_yaml = "firestore_gapic.yaml",
+- grpc_service_config = "firestore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "firestore_v1.yaml",
+- test_deps = [
+- ":firestore_java_grpc",
+- "//google/cloud/location:location_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":firestore_java_proto",
+- "//google/api:api_java_proto",
+- "//google/cloud/location:location_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "firestore_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.firestore.v1.FirestoreClientHttpJsonTest",
+- "com.google.cloud.firestore.v1.FirestoreClientTest",
+- ],
+- runtime_deps = [":firestore_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-firestore-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":firestore_java_gapic",
+- ":firestore_java_grpc",
+- ":firestore_java_proto",
+- ":firestore_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "firestore_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/firestore/v1",
+- protos = [":firestore_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "firestore_go_gapic",
+- srcs = [":firestore_proto_with_info"],
+- grpc_service_config = "firestore_grpc_service_config.json",
+- importpath = "cloud.google.com/go/firestore/apiv1;firestore",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "firestore_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":firestore_go_proto",
+- "//google/cloud/location:location_go_proto",
+- "//google/longrunning:longrunning_go_gapic",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "firestore_go_gapic_test",
+- srcs = [":firestore_go_gapic_srcjar_test"],
+- embed = [":firestore_go_gapic"],
+- importpath = "cloud.google.com/go/firestore/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-firestore-v1-go",
+- deps = [
+- ":firestore_go_gapic",
+- ":firestore_go_gapic_srcjar-metadata.srcjar",
+- ":firestore_go_gapic_srcjar-test.srcjar",
+- ":firestore_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "firestore_py_gapic",
+- srcs = [":firestore_proto"],
+- grpc_service_config = "firestore_grpc_service_config.json",
+- opt_args = ["python-gapic-namespace=google.cloud"],
+- rest_numeric_enums = False,
+- service_yaml = "firestore_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "firestore_py_gapic_test",
+- srcs = [
+- "firestore_py_gapic_pytest.py",
+- "firestore_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":firestore_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "firestore-v1-py",
+- deps = [
+- ":firestore_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "firestore_php_proto",
+- deps = [":firestore_proto"],
+-)
+-
+-php_grpc_library(
+- name = "firestore_php_grpc",
+- srcs = [":firestore_proto"],
+- deps = [":firestore_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "firestore_php_gapic",
+- srcs = [":firestore_proto_with_info"],
+- grpc_service_config = "firestore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "firestore_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":firestore_php_grpc",
+- ":firestore_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-firestore-v1-php",
+- deps = [
+- ":firestore_php_gapic",
+- ":firestore_php_grpc",
+- ":firestore_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "firestore_nodejs_gapic",
+- package_name = "@google-cloud/firestore",
+- src = ":firestore_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "firestore_grpc_service_config.json",
+- package = "google.firestore.v1",
+- rest_numeric_enums = False,
+- service_yaml = "firestore_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "firestore-v1-nodejs",
+- deps = [
+- ":firestore_nodejs_gapic",
+- ":firestore_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "firestore_ruby_proto",
+- deps = [":firestore_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "firestore_ruby_grpc",
+- srcs = [":firestore_proto"],
+- deps = [":firestore_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "firestore_ruby_gapic",
+- srcs = [":firestore_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=firestore.googleapis.com",
+- "ruby-cloud-api-shortname=firestore",
+- "ruby-cloud-env-prefix=FIRESTORE",
+- "ruby-cloud-gem-name=google-cloud-firestore-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/firestore",
+- ],
+- grpc_service_config = "firestore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Firestore is a NoSQL document database built for automatic scaling, high performance, and ease of application development.",
+- ruby_cloud_title = "Cloud Firestore V1",
+- service_yaml = "firestore_v1.yaml",
+- deps = [
+- ":firestore_ruby_grpc",
+- ":firestore_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-firestore-v1-ruby",
+- deps = [
+- ":firestore_ruby_gapic",
+- ":firestore_ruby_grpc",
+- ":firestore_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "firestore_csharp_proto",
+- deps = [":firestore_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "firestore_csharp_grpc",
+- srcs = [":firestore_proto"],
+- deps = [":firestore_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "firestore_csharp_gapic",
+- srcs = [":firestore_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "firestore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "firestore_v1.yaml",
+- deps = [
+- ":firestore_csharp_grpc",
+- ":firestore_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-firestore-v1-csharp",
+- deps = [
+- ":firestore_csharp_gapic",
+- ":firestore_csharp_grpc",
+- ":firestore_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "firestore_cc_proto",
+- deps = [":firestore_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "firestore_cc_grpc",
+- srcs = [":firestore_proto"],
+- grpc_only = True,
+- deps = [":firestore_cc_proto"],
+-)
+diff -urN a/google/firestore/v1beta1/BUILD.bazel b/google/firestore/v1beta1/BUILD.bazel
+--- a/google/firestore/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/firestore/v1beta1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,317 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "firestore_proto",
+- srcs = [
+- "common.proto",
+- "document.proto",
+- "firestore.proto",
+- "query.proto",
+- "write.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/rpc:status_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "firestore_proto_with_info",
+- deps = [
+- ":firestore_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "firestore_java_proto",
+- deps = [":firestore_proto"],
+-)
+-
+-java_grpc_library(
+- name = "firestore_java_grpc",
+- srcs = [":firestore_proto"],
+- deps = [":firestore_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "firestore_java_gapic",
+- srcs = [":firestore_proto_with_info"],
+- gapic_yaml = "firestore_gapic.yaml",
+- grpc_service_config = "firestore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":firestore_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":firestore_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "firestore_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.firestore.v1beta1.FirestoreClientHttpJsonTest",
+- "com.google.cloud.firestore.v1beta1.FirestoreClientTest",
+- ],
+- runtime_deps = [":firestore_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-firestore-v1beta1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":firestore_java_gapic",
+- ":firestore_java_grpc",
+- ":firestore_java_proto",
+- ":firestore_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "firestore_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/firestore/v1beta1",
+- protos = [":firestore_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "firestore_go_gapic",
+- srcs = [":firestore_proto_with_info"],
+- grpc_service_config = "firestore_grpc_service_config.json",
+- importpath = "cloud.google.com/go/firestore/apiv1beta1;firestore",
+- rest_numeric_enums = False,
+- service_yaml = "firestore_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":firestore_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "firestore_go_gapic_test",
+- srcs = [":firestore_go_gapic_srcjar_test"],
+- embed = [":firestore_go_gapic"],
+- importpath = "cloud.google.com/go/firestore/apiv1beta1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-firestore-v1beta1-go",
+- deps = [
+- ":firestore_go_gapic",
+- ":firestore_go_gapic_srcjar-test.srcjar",
+- ":firestore_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "firestore_py_gapic",
+- srcs = [":firestore_proto"],
+- grpc_service_config = "firestore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "firestore_py_gapic_test",
+- srcs = [
+- "firestore_py_gapic_pytest.py",
+- "firestore_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":firestore_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "firestore-v1beta1-py",
+- deps = [
+- ":firestore_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "firestore_php_proto",
+- deps = [":firestore_proto"],
+-)
+-
+-php_grpc_library(
+- name = "firestore_php_grpc",
+- srcs = [":firestore_proto"],
+- deps = [":firestore_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "firestore_php_gapic",
+- srcs = [":firestore_proto_with_info"],
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":firestore_php_grpc",
+- ":firestore_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-firestore-v1beta1-php",
+- deps = [
+- ":firestore_php_gapic",
+- ":firestore_php_grpc",
+- ":firestore_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "firestore_nodejs_gapic",
+- src = ":firestore_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "firestore_grpc_service_config.json",
+- package = "google.firestore.v1beta1",
+- rest_numeric_enums = False,
+- service_yaml = "firestore_v1beta1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "firestore-v1beta1-nodejs",
+- deps = [
+- ":firestore_nodejs_gapic",
+- ":firestore_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "firestore_ruby_proto",
+- deps = [":firestore_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "firestore_ruby_grpc",
+- srcs = [":firestore_proto"],
+- deps = [":firestore_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "firestore_ruby_gapic",
+- srcs = [":firestore_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-firestore-v1beta1"],
+- rest_numeric_enums = False,
+- deps = [
+- ":firestore_ruby_grpc",
+- ":firestore_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-firestore-v1beta1-ruby",
+- deps = [
+- ":firestore_ruby_gapic",
+- ":firestore_ruby_grpc",
+- ":firestore_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "firestore_csharp_proto",
+- deps = [":firestore_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "firestore_csharp_grpc",
+- srcs = [":firestore_proto"],
+- deps = [":firestore_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "firestore_csharp_gapic",
+- srcs = [":firestore_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "firestore_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "firestore_v1beta1.yaml",
+- deps = [
+- ":firestore_csharp_grpc",
+- ":firestore_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-firestore-v1beta1-csharp",
+- deps = [
+- ":firestore_csharp_gapic",
+- ":firestore_csharp_grpc",
+- ":firestore_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/geo/type/BUILD.bazel b/google/geo/type/BUILD.bazel
+--- a/google/geo/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/geo/type/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,89 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_proto_library",
+- "go_proto_library",
+- "java_gapic_assembly_gradle_pkg",
+- "java_proto_library",
+-)
+-
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-proto_library(
+- name = "viewport_proto",
+- srcs = ["viewport.proto"],
+- deps = ["//google/type:latlng_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-java_proto_library(
+- name = "viewport_java_proto",
+- deps = [
+- ":viewport_proto",
+- ],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-geo-type-java",
+- transport = "grpc+rest",
+- deps = [
+- ":viewport_java_proto",
+- ":viewport_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-go_proto_library(
+- name = "viewport_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/geo/type",
+- protos = [":viewport_proto"],
+- deps = ["//google/type:latlng_go_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_proto_library",
+-)
+-
+-py_gapic_library(
+- name = "viewport_py_gapic",
+- srcs = [":viewport_proto"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_proto_library(
+- name = "viewport_py_proto",
+- deps = [":viewport_proto"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "viewport-py",
+- deps = [
+- ":viewport_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-cc_proto_library(
+- name = "viewport_cc_proto",
+- deps = [":viewport_proto"],
+-)
+diff -urN a/google/home/enterprise/sdm/v1/BUILD.bazel b/google/home/enterprise/sdm/v1/BUILD.bazel
+--- a/google/home/enterprise/sdm/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/home/enterprise/sdm/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,310 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "sdm_proto",
+- srcs = [
+- "device.proto",
+- "site.proto",
+- "smart_device_management_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "sdm_proto_with_info",
+- deps = [
+- ":sdm_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "sdm_java_proto",
+- deps = [":sdm_proto"],
+-)
+-
+-java_grpc_library(
+- name = "sdm_java_grpc",
+- srcs = [":sdm_proto"],
+- deps = [":sdm_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "sdm_java_gapic",
+- srcs = [":sdm_proto_with_info"],
+- grpc_service_config = "smart_device_management_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":sdm_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":sdm_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "sdm_java_gapic_test_suite",
+- test_classes = [
+- "com.google.home.enterprise.sdm.v1.SmartDeviceManagementServiceClientHttpJsonTest",
+- "com.google.home.enterprise.sdm.v1.SmartDeviceManagementServiceClientTest",
+- ],
+- runtime_deps = [":sdm_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-enterprise-sdm-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":sdm_java_gapic",
+- ":sdm_java_grpc",
+- ":sdm_java_proto",
+- ":sdm_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "sdm_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/home/enterprise/sdm/v1",
+- protos = [":sdm_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "sdm_go_gapic",
+- srcs = [":sdm_proto_with_info"],
+- grpc_service_config = "smart_device_management_grpc_service_config.json",
+- importpath = "google.golang.org/google/home/enterprise/sdm/v1;sdm",
+- rest_numeric_enums = False,
+- service_yaml = "smartdevicemanagement_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":sdm_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "sdm_go_gapic_test",
+- srcs = [":sdm_go_gapic_srcjar_test"],
+- embed = [":sdm_go_gapic"],
+- importpath = "google.golang.org/google/home/enterprise/sdm/v1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-enterprise-sdm-v1-go",
+- deps = [
+- ":sdm_go_gapic",
+- ":sdm_go_gapic_srcjar-test.srcjar",
+- ":sdm_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "sdm_py_gapic",
+- srcs = [":sdm_proto"],
+- grpc_service_config = "smart_device_management_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "sdm_py_gapic_test",
+- srcs = [
+- "sdm_py_gapic_pytest.py",
+- "sdm_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":sdm_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "enterprise-sdm-v1-py",
+- deps = [
+- ":sdm_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "sdm_php_proto",
+- deps = [":sdm_proto"],
+-)
+-
+-php_grpc_library(
+- name = "sdm_php_grpc",
+- srcs = [":sdm_proto"],
+- deps = [":sdm_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "sdm_php_gapic",
+- srcs = [":sdm_proto_with_info"],
+- grpc_service_config = "smart_device_management_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":sdm_php_grpc",
+- ":sdm_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-enterprise-sdm-v1-php",
+- deps = [
+- ":sdm_php_gapic",
+- ":sdm_php_grpc",
+- ":sdm_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "sdm_nodejs_gapic",
+- src = ":sdm_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "smart_device_management_grpc_service_config.json",
+- package = "google.home.enterprise.sdm.v1",
+- rest_numeric_enums = False,
+- service_yaml = "smartdevicemanagement_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "enterprise-sdm-v1-nodejs",
+- deps = [
+- ":sdm_nodejs_gapic",
+- ":sdm_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "sdm_ruby_proto",
+- deps = [":sdm_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "sdm_ruby_grpc",
+- srcs = [":sdm_proto"],
+- deps = [":sdm_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "sdm_ruby_gapic",
+- srcs = [":sdm_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-sdm-v1"],
+- grpc_service_config = "smart_device_management_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":sdm_ruby_grpc",
+- ":sdm_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-enterprise-sdm-v1-ruby",
+- deps = [
+- ":sdm_ruby_gapic",
+- ":sdm_ruby_grpc",
+- ":sdm_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "sdm_csharp_proto",
+- deps = [":sdm_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "sdm_csharp_grpc",
+- srcs = [":sdm_proto"],
+- deps = [":sdm_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "sdm_csharp_gapic",
+- srcs = [":sdm_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "smart_device_management_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "smartdevicemanagement_v1.yaml",
+- deps = [
+- ":sdm_csharp_grpc",
+- ":sdm_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-enterprise-sdm-v1-csharp",
+- deps = [
+- ":sdm_csharp_gapic",
+- ":sdm_csharp_grpc",
+- ":sdm_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/home/graph/BUILD.bazel b/google/home/graph/BUILD.bazel
+--- a/google/home/graph/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/home/graph/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/home/graph/v1/BUILD.bazel b/google/home/graph/v1/BUILD.bazel
+--- a/google/home/graph/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/home/graph/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,298 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "graph_proto",
+- srcs = [
+- "device.proto",
+- "homegraph.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:struct_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "graph_proto_with_info",
+- deps = [
+- ":graph_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "graph_java_proto",
+- deps = [":graph_proto"],
+-)
+-
+-java_grpc_library(
+- name = "graph_java_grpc",
+- srcs = [":graph_proto"],
+- deps = [":graph_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "graph_java_gapic",
+- srcs = [":graph_proto_with_info"],
+- grpc_service_config = "homegraph_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":graph_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":graph_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "graph_java_gapic_test_suite",
+- test_classes = [
+- "com.google.home.graph.v1.HomeGraphApiServiceClientHttpJsonTest",
+- "com.google.home.graph.v1.HomeGraphApiServiceClientTest",
+- ],
+- runtime_deps = [":graph_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-home-graph-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":graph_java_gapic",
+- ":graph_java_grpc",
+- ":graph_java_proto",
+- ":graph_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "graph_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/home/graph/v1",
+- protos = [":graph_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "graph_go_gapic",
+- srcs = [":graph_proto_with_info"],
+- grpc_service_config = "homegraph_grpc_service_config.json",
+- importpath = "google.golang.org/api/homegraph/v1;graph",
+- rest_numeric_enums = False,
+- service_yaml = "homegraph_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":graph_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "graph_go_gapic_test",
+- srcs = [":graph_go_gapic_srcjar_test"],
+- embed = [":graph_go_gapic"],
+- importpath = "google.golang.org/api/homegraph/v1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-home-graph-v1-go",
+- deps = [
+- ":graph_go_gapic",
+- ":graph_go_gapic_srcjar-test.srcjar",
+- ":graph_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "graph_py_gapic",
+- srcs = [":graph_proto"],
+- grpc_service_config = "homegraph_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "graph_py_gapic_test",
+- srcs = [
+- "graph_py_gapic_pytest.py",
+- "graph_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":graph_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "home-graph-v1-py",
+- deps = [
+- ":graph_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "graph_php_proto",
+- deps = [":graph_proto"],
+-)
+-
+-php_grpc_library(
+- name = "graph_php_grpc",
+- srcs = [":graph_proto"],
+- deps = [":graph_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "graph_php_gapic",
+- srcs = [":graph_proto_with_info"],
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":graph_php_grpc",
+- ":graph_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-home-graph-v1-php",
+- deps = [
+- ":graph_php_gapic",
+- ":graph_php_grpc",
+- ":graph_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "graph_nodejs_gapic",
+- src = ":graph_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "homegraph_grpc_service_config.json",
+- package = "google.home.graph.v1",
+- rest_numeric_enums = False,
+- service_yaml = "homegraph_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "home-graph-v1-nodejs",
+- deps = [
+- ":graph_nodejs_gapic",
+- ":graph_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "graph_ruby_proto",
+- deps = [":graph_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "graph_ruby_grpc",
+- srcs = [":graph_proto"],
+- deps = [":graph_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "graph_ruby_gapic",
+- srcs = [":graph_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-graph-v1"],
+- rest_numeric_enums = False,
+- deps = [
+- ":graph_ruby_grpc",
+- ":graph_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-home-graph-v1-ruby",
+- deps = [
+- ":graph_ruby_gapic",
+- ":graph_ruby_grpc",
+- ":graph_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "graph_csharp_proto",
+- deps = [":graph_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "graph_csharp_grpc",
+- srcs = [":graph_proto"],
+- deps = [":graph_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "graph_csharp_gapic",
+- srcs = [":graph_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "homegraph_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "homegraph_v1.yaml",
+- deps = [
+- ":graph_csharp_grpc",
+- ":graph_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-home-graph-v1-csharp",
+- deps = [
+- ":graph_csharp_gapic",
+- ":graph_csharp_grpc",
+- ":graph_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/iam/BUILD.bazel b/google/iam/BUILD.bazel
+--- a/google/iam/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/iam/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-iam.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for iam.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v2 in this case.
+-ruby_cloud_gapic_library(
+- name = "iam_ruby_wrapper",
+- srcs = ["//google/iam/v2:iam_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-iam",
+- "ruby-cloud-wrapper-of=v2:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/iam",
+- "ruby-cloud-api-id=iam.googleapis.com",
+- "ruby-cloud-api-shortname=iam",
+- ],
+- ruby_cloud_description = "Manages identity and access control policies for Google Cloud Platform resources.",
+- ruby_cloud_title = "IAM",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-iam-ruby",
+- deps = [
+- ":iam_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/iam/admin/v1/BUILD.bazel b/google/iam/admin/v1/BUILD.bazel
+--- a/google/iam/admin/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/iam/admin/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,395 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "admin_proto",
+- srcs = [
+- "audit_data.proto",
+- "iam.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/type:expr_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "admin_proto_with_info",
+- deps = [
+- ":admin_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "admin_java_proto",
+- deps = [":admin_proto"],
+-)
+-
+-java_grpc_library(
+- name = "admin_java_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "admin_java_gapic",
+- srcs = [":admin_proto_with_info"],
+- # This was manually replaced - build_gen shouldn't have removed it.
+- gapic_yaml = "iam_gapic.yaml",
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iam.yaml",
+- test_deps = [
+- ":admin_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":admin_java_proto",
+- "//google/api:api_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "admin_java_gapic_test_suite",
+- # This was manually named IAMClientTest - build_gen attempts to rename it to
+- # IamClientTest.
+- test_classes = [
+- # Java package override from gapic.yaml.
+- "com.google.cloud.iam.admin.v1.IAMClientTest",
+- ],
+- runtime_deps = [":admin_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-iam-admin-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":admin_java_gapic",
+- ":admin_java_grpc",
+- ":admin_java_proto",
+- ":admin_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "admin_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/iam/admin/v1",
+- protos = [":admin_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/type:expr_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "admin_go_gapic",
+- srcs = [":admin_proto_with_info"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- importpath = "cloud.google.com/go/iam/admin/apiv1;admin",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "iam.yaml",
+- transport = "grpc",
+- deps = [
+- ":admin_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "admin_go_gapic_test",
+- srcs = [":admin_go_gapic_srcjar_test"],
+- embed = [":admin_go_gapic"],
+- importpath = "cloud.google.com/go/iam/admin/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-iam-admin-v1-go",
+- deps = [
+- ":admin_go_gapic",
+- ":admin_go_gapic_srcjar-metadata.srcjar",
+- ":admin_go_gapic_srcjar-test.srcjar",
+- ":admin_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "admin_py_gapic",
+- srcs = [":admin_proto"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "admin_py_gapic_test",
+- srcs = [
+- "admin_py_gapic_pytest.py",
+- "admin_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":admin_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "iam-admin-v1-py",
+- deps = [
+- ":admin_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "admin_php_proto",
+- deps = [":admin_proto"],
+-)
+-
+-php_grpc_library(
+- name = "admin_php_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "admin_php_gapic",
+- srcs = [":admin_proto_with_info"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iam.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":admin_php_grpc",
+- ":admin_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-iam-admin-v1-php",
+- deps = [
+- ":admin_php_gapic",
+- ":admin_php_grpc",
+- ":admin_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "admin_nodejs_gapic",
+- package_name = "@google-cloud/admin",
+- src = ":admin_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- package = "google.iam.admin.v1",
+- rest_numeric_enums = False,
+- service_yaml = "iam.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "iam-admin-v1-nodejs",
+- deps = [
+- ":admin_nodejs_gapic",
+- ":admin_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "admin_ruby_proto",
+- deps = [":admin_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "admin_ruby_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "admin_ruby_gapic",
+- srcs = [":admin_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-iam-admin-v1"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iam.yaml",
+- deps = [
+- ":admin_ruby_grpc",
+- ":admin_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-iam-admin-v1-ruby",
+- deps = [
+- ":admin_ruby_gapic",
+- ":admin_ruby_grpc",
+- ":admin_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "admin_csharp_proto",
+- deps = [":admin_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "admin_csharp_grpc",
+- srcs = [":admin_proto"],
+- deps = [":admin_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "admin_csharp_gapic",
+- srcs = [":admin_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iam.yaml",
+- deps = [
+- ":admin_csharp_grpc",
+- ":admin_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-iam-admin-v1-csharp",
+- deps = [
+- ":admin_csharp_gapic",
+- ":admin_csharp_grpc",
+- ":admin_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "admin_cc_proto",
+- deps = [":admin_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "admin_cc_grpc",
+- srcs = [":admin_proto"],
+- grpc_only = True,
+- deps = [":admin_cc_proto"],
+-)
+diff -urN a/google/iam/credentials/BUILD.bazel b/google/iam/credentials/BUILD.bazel
+--- a/google/iam/credentials/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/iam/credentials/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-iam-credentials.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for iamcredentials.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "iamcredentials_ruby_wrapper",
+- srcs = ["//google/iam/credentials/v1:credentials_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-iam-credentials",
+- "ruby-cloud-env-prefix=IAM_CREDENTIALS",
+- "ruby-cloud-wrapper-of=v1:0.3",
+- "ruby-cloud-product-url=https://cloud.google.com/iam",
+- "ruby-cloud-api-id=iamcredentials.googleapis.com",
+- "ruby-cloud-api-shortname=iamcredentials",
+- ],
+- ruby_cloud_description = "The Service Account Credentials API creates short-lived credentials for Identity and Access Management (IAM) service accounts. You can also use this API to sign JSON Web Tokens (JWTs), as well as blobs of binary data that contain other types of tokens.",
+- ruby_cloud_title = "IAM Service Account Credentials",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-iam-credentials-ruby",
+- deps = [
+- ":iamcredentials_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/iam/credentials/v1/BUILD.bazel b/google/iam/credentials/v1/BUILD.bazel
+--- a/google/iam/credentials/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/iam/credentials/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,324 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "credentials_proto",
+- srcs = [
+- "common.proto",
+- "iamcredentials.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "credentials_proto_with_info",
+- deps = [
+- ":credentials_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "credentials_java_proto",
+- deps = [":credentials_proto"],
+-)
+-
+-java_grpc_library(
+- name = "credentials_java_grpc",
+- srcs = [":credentials_proto"],
+- deps = [":credentials_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "credentials_java_gapic",
+- srcs = [":credentials_proto_with_info"],
+- grpc_service_config = "iamcredentials_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":credentials_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":credentials_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "credentials_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.iam.credentials.v1.IAMCredentialsClientHttpJsonTest",
+- "com.google.cloud.iam.credentials.v1.IAMCredentialsClientTest",
+- ],
+- runtime_deps = [":credentials_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-iam-credentials-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":credentials_java_gapic",
+- ":credentials_java_grpc",
+- ":credentials_java_proto",
+- ":credentials_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "credentials_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/iam/credentials/v1",
+- protos = [":credentials_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "credentials_go_gapic",
+- srcs = [":credentials_proto_with_info"],
+- grpc_service_config = "iamcredentials_grpc_service_config.json",
+- importpath = "cloud.google.com/go/iam/credentials/apiv1;credentials",
+- rest_numeric_enums = False,
+- service_yaml = "iamcredentials_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":credentials_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "credentials_go_gapic_test",
+- srcs = [":credentials_go_gapic_srcjar_test"],
+- embed = [":credentials_go_gapic"],
+- importpath = "cloud.google.com/go/iam/credentials/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-iam-credentials-v1-go",
+- deps = [
+- ":credentials_go_gapic",
+- ":credentials_go_gapic_srcjar-test.srcjar",
+- ":credentials_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "credentials_py_gapic",
+- srcs = [":credentials_proto"],
+- grpc_service_config = "iamcredentials_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-iam",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=iam_credentials",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "credentials_py_gapic_test",
+- srcs = [
+- "credentials_py_gapic_pytest.py",
+- "credentials_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":credentials_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "iam-credentials-v1-py",
+- deps = [
+- ":credentials_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "credentials_php_proto",
+- deps = [":credentials_proto"],
+-)
+-
+-php_grpc_library(
+- name = "credentials_php_grpc",
+- srcs = [":credentials_proto"],
+- deps = [":credentials_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "credentials_php_gapic",
+- srcs = [":credentials_proto_with_info"],
+- grpc_service_config = "iamcredentials_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":credentials_php_grpc",
+- ":credentials_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-iam-credentials-v1-php",
+- deps = [
+- ":credentials_php_gapic",
+- ":credentials_php_grpc",
+- ":credentials_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "credentials_nodejs_gapic",
+- package_name = "@google-cloud/iam-credentials",
+- src = ":credentials_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "iamcredentials_grpc_service_config.json",
+- package = "google.iam.credentials.v1",
+- rest_numeric_enums = False,
+- service_yaml = "iamcredentials_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "iam-credentials-v1-nodejs",
+- deps = [
+- ":credentials_nodejs_gapic",
+- ":credentials_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "credentials_ruby_proto",
+- deps = [":credentials_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "credentials_ruby_grpc",
+- srcs = [":credentials_proto"],
+- deps = [":credentials_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "credentials_ruby_gapic",
+- srcs = [":credentials_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-iam-credentials-v1",
+- "ruby-cloud-env-prefix=IAM_CREDENTIALS",
+- "ruby-cloud-product-url=https://cloud.google.com/iam",
+- "ruby-cloud-api-id=iamcredentials.googleapis.com",
+- "ruby-cloud-api-shortname=iamcredentials",
+- ],
+- grpc_service_config = "iamcredentials_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Service Account Credentials API creates short-lived credentials for Identity and Access Management (IAM) service accounts. You can also use this API to sign JSON Web Tokens (JWTs), as well as blobs of binary data that contain other types of tokens.",
+- ruby_cloud_title = "IAM Service Account Credentials V1",
+- deps = [
+- ":credentials_ruby_grpc",
+- ":credentials_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-iam-credentials-v1-ruby",
+- deps = [
+- ":credentials_ruby_gapic",
+- ":credentials_ruby_grpc",
+- ":credentials_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "credentials_csharp_proto",
+- deps = [":credentials_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "credentials_csharp_grpc",
+- srcs = [":credentials_proto"],
+- deps = [":credentials_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "credentials_csharp_gapic",
+- srcs = [":credentials_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "iamcredentials_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iamcredentials_v1.yaml",
+- deps = [
+- ":credentials_csharp_grpc",
+- ":credentials_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-iam-credentials-v1-csharp",
+- deps = [
+- ":credentials_csharp_gapic",
+- ":credentials_csharp_grpc",
+- ":credentials_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "credentials_cc_proto",
+- deps = [":credentials_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "credentials_cc_grpc",
+- srcs = [":credentials_proto"],
+- grpc_only = True,
+- deps = [":credentials_cc_proto"],
+-)
+diff -urN a/google/iam/v1/BUILD.bazel b/google/iam/v1/BUILD.bazel
+--- a/google/iam/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/iam/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,233 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_proto_library",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+- "proto_library_with_info",
+- "py_proto_library",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "iam_policy_proto",
+- srcs = ["iam_policy.proto"],
+- deps = [
+- ":options_proto",
+- ":policy_proto",
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "policy_proto",
+- srcs = ["policy.proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/type:expr_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "options_proto",
+- srcs = ["options.proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "iam_proto_with_info",
+- deps = [
+- ":iam_policy_proto",
+- ":options_proto",
+- ":policy_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "iam_java_proto",
+- deps = [
+- ":iam_policy_proto",
+- ":options_proto",
+- ":policy_proto",
+- ],
+-)
+-
+-java_grpc_library(
+- name = "iam_java_grpc",
+- srcs = [":iam_policy_proto"],
+- deps = [":iam_java_proto"],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-iam-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- "iam_java_grpc",
+- "iam_java_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "iam_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/iam/v1",
+- protos = [
+- ":iam_policy_proto",
+- ":options_proto",
+- ":policy_proto",
+- ],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:expr_go_proto",
+- ],
+-)
+-
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-iam-v1-go",
+- deps = [
+- ":iam_go_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "iam_policy_cc_proto",
+- deps = [":iam_policy_proto"],
+-)
+-
+-cc_proto_library(
+- name = "options_cc_proto",
+- deps = [":options_proto"],
+-)
+-
+-cc_proto_library(
+- name = "policy_cc_proto",
+- deps = [":policy_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "iam_cc_grpc",
+- srcs = [":iam_policy_proto"],
+- grpc_only = True,
+- deps = [":iam_policy_cc_proto"],
+-)
+-
+-py_proto_library(
+- name = "iam_policy_py_proto",
+- deps = [":iam_policy_proto"],
+-)
+-
+-py_proto_library(
+- name = "policy_py_proto",
+- deps = [":policy_proto"],
+-)
+-
+-py_proto_library(
+- name = "options_py_proto",
+- deps = [":options_proto"],
+-)
+-
+-ruby_proto_library(
+- name = "iam_ruby_proto",
+- deps = [
+- ":iam_policy_proto",
+- ":options_proto",
+- ":policy_proto",
+- "//google/iam/v1/logging:audit_data_proto",
+- ],
+-)
+-
+-ruby_grpc_library(
+- name = "iam_ruby_grpc",
+- srcs = [":iam_policy_proto"],
+- deps = [":iam_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "iam_ruby_gapic",
+- srcs = [":iam_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-iam-v1",
+- ],
+- rest_numeric_enums = False,
+- ruby_cloud_description = "An add-on interface used by some Google API clients to provide IAM Policy calls.",
+- ruby_cloud_title = "IAM",
+- deps = [
+- ":iam_ruby_grpc",
+- ":iam_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-iam-v1-ruby",
+- deps = [
+- ":iam_ruby_gapic",
+- ":iam_ruby_grpc",
+- ":iam_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "iam_csharp_proto",
+- deps = [
+- ":iam_policy_proto",
+- ":options_proto",
+- ":policy_proto",
+- "//google/iam/v1/logging:audit_data_proto",
+- ],
+-)
+-
+-csharp_grpc_library(
+- name = "iam_csharp_grpc",
+- srcs = [":iam_policy_proto"],
+- deps = [":iam_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "iam_csharp_gapic",
+- srcs = [":iam_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":iam_csharp_grpc",
+- ":iam_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-iam-v1-csharp",
+- deps = [
+- ":iam_csharp_gapic",
+- ":iam_csharp_grpc",
+- ":iam_csharp_proto",
+- ],
+-)
+diff -urN a/google/iam/v1/logging/BUILD.bazel b/google/iam/v1/logging/BUILD.bazel
+--- a/google/iam/v1/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/iam/v1/logging/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,112 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "audit_data_proto",
+- srcs = [
+- "audit_data.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/iam/v1:policy_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "logging_proto_with_info",
+- deps = [":audit_data_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "java_proto_library")
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":audit_data_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/iam/v1/logging",
+- protos = [":audit_data_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-iam-admin-go",
+- deps = [
+- ":logging_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+-)
+-
+-py_gapic_library(
+- name = "logging_py_gapic",
+- srcs = [":audit_data_proto"],
+- opt_args = [
+- "warehouse-package-name=google-cloud-iam-logging",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=iam_logging",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "google-cloud-iam-logging-v1-py",
+- deps = [
+- ":logging_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":audit_data_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":audit_data_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/iam/v1beta/BUILD.bazel b/google/iam/v1beta/BUILD.bazel
+--- a/google/iam/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/iam/v1beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,322 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "iam_proto",
+- srcs = [
+- "workload_identity_pool.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "iam_proto_with_info",
+- deps = [
+- ":iam_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "iam_java_proto",
+- deps = [":iam_proto"],
+-)
+-
+-java_grpc_library(
+- name = "iam_java_grpc",
+- srcs = [":iam_proto"],
+- deps = [":iam_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "iam_java_gapic",
+- srcs = [":iam_proto_with_info"],
+- gapic_yaml = "iam_gapic.yaml",
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":iam_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "iam_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.iam.v1beta.WorkloadIdentityPoolsClientTest",
+- ],
+- runtime_deps = [":iam_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-iam-v1beta-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":iam_java_gapic",
+- ":iam_java_grpc",
+- ":iam_java_proto",
+- ":iam_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "iam_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/iam/v1beta",
+- protos = [":iam_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "iam_go_gapic",
+- srcs = [":iam_proto_with_info"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- importpath = "cloud.google.com/go/iam/apiv1beta;iam",
+- rest_numeric_enums = False,
+- service_yaml = "iam_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "iam_go_gapic_test",
+- srcs = [":iam_go_gapic_srcjar_test"],
+- embed = [":iam_go_gapic"],
+- importpath = "cloud.google.com/go/iam/apiv1beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-iam-v1beta-go",
+- deps = [
+- ":iam_go_gapic",
+- ":iam_go_gapic_srcjar-test.srcjar",
+- ":iam_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "iam_py_gapic",
+- srcs = [":iam_proto"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "iam_py_gapic_test",
+- srcs = [
+- "iam_py_gapic_pytest.py",
+- "iam_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":iam_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "iam-v1beta-py",
+- deps = [
+- ":iam_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "iam_php_proto",
+- deps = [":iam_proto"],
+-)
+-
+-php_grpc_library(
+- name = "iam_php_grpc",
+- srcs = [":iam_proto"],
+- deps = [":iam_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "iam_php_gapic",
+- srcs = [":iam_proto_with_info"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iam_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":iam_php_grpc",
+- ":iam_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-iam-v1beta-php",
+- deps = [
+- ":iam_php_gapic",
+- ":iam_php_grpc",
+- ":iam_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "iam_nodejs_gapic",
+- src = ":iam_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- package = "google.iam.v1beta",
+- rest_numeric_enums = False,
+- service_yaml = "iam_v1beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "iam-v1beta-nodejs",
+- deps = [
+- ":iam_nodejs_gapic",
+- ":iam_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "iam_ruby_proto",
+- deps = [":iam_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "iam_ruby_grpc",
+- srcs = [":iam_proto"],
+- deps = [":iam_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "iam_ruby_gapic",
+- srcs = [":iam_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-iam-v1beta",
+- "ruby-cloud-env-prefix=IAM",
+- "ruby-cloud-product-url=https://cloud.google.com/iam/docs/manage-workload-identity-pools-providers",
+- "ruby-cloud-api-id=iam.googleapis.com",
+- "ruby-cloud-api-shortname=iam",
+- ],
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Pre-release client for the WorkloadIdentityPools service.",
+- ruby_cloud_title = "Google IAM V1beta",
+- deps = [
+- ":iam_ruby_grpc",
+- ":iam_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-iam-v1beta-ruby",
+- deps = [
+- ":iam_ruby_gapic",
+- ":iam_ruby_grpc",
+- ":iam_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "iam_csharp_proto",
+- deps = [":iam_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "iam_csharp_grpc",
+- srcs = [":iam_proto"],
+- deps = [":iam_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "iam_csharp_gapic",
+- srcs = [":iam_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iam_v1beta.yaml",
+- deps = [
+- ":iam_csharp_grpc",
+- ":iam_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-iam-v1beta-csharp",
+- deps = [
+- ":iam_csharp_gapic",
+- ":iam_csharp_grpc",
+- ":iam_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/iam/v2/BUILD.bazel b/google/iam/v2/BUILD.bazel
+--- a/google/iam/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/iam/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,401 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "iam_proto",
+- srcs = [
+- "deny.proto",
+- "policy.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:expr_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "iam_proto_with_info",
+- deps = [
+- ":iam_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "iam_java_proto",
+- deps = [":iam_proto"],
+-)
+-
+-java_grpc_library(
+- name = "iam_java_grpc",
+- srcs = [":iam_proto"],
+- deps = [":iam_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "iam_java_gapic",
+- srcs = [":iam_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iam_v2.yaml",
+- test_deps = [
+- ":iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":iam_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "iam_java_gapic_test_suite",
+- test_classes = [
+- "com.google.iam.v2.PoliciesClientHttpJsonTest",
+- "com.google.iam.v2.PoliciesClientTest",
+- ],
+- runtime_deps = [":iam_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-iam-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":iam_java_gapic",
+- ":iam_java_grpc",
+- ":iam_java_proto",
+- ":iam_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "iam_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/iam/v2",
+- protos = [":iam_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:expr_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "iam_go_gapic",
+- srcs = [":iam_proto_with_info"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- importpath = "cloud.google.com/go/iam/apiv2;iam",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "iam_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "iam_go_gapic_test",
+- srcs = [":iam_go_gapic_srcjar_test"],
+- embed = [":iam_go_gapic"],
+- importpath = "cloud.google.com/go/iam/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-iam-v2-go",
+- deps = [
+- ":iam_go_gapic",
+- ":iam_go_gapic_srcjar-metadata.srcjar",
+- ":iam_go_gapic_srcjar-test.srcjar",
+- ":iam_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "iam_py_gapic",
+- srcs = [":iam_proto"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=iam",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-iam",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "iam_v2.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "iam_py_gapic_test",
+- srcs = [
+- "iam_py_gapic_pytest.py",
+- "iam_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":iam_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "iam-v2-py",
+- deps = [
+- ":iam_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "iam_php_proto",
+- deps = [":iam_proto"],
+-)
+-
+-php_grpc_library(
+- name = "iam_php_grpc",
+- srcs = [":iam_proto"],
+- deps = [":iam_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "iam_php_gapic",
+- srcs = [":iam_proto_with_info"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iam_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":iam_php_grpc",
+- ":iam_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-iam-v2-php",
+- deps = [
+- ":iam_php_gapic",
+- ":iam_php_grpc",
+- ":iam_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "iam_nodejs_gapic",
+- package_name = "@google-cloud/iam",
+- src = ":iam_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- package = "google.iam.v2",
+- rest_numeric_enums = False,
+- service_yaml = "iam_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "iam-v2-nodejs",
+- deps = [
+- ":iam_nodejs_gapic",
+- ":iam_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "iam_ruby_proto",
+- deps = [":iam_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "iam_ruby_grpc",
+- srcs = [":iam_proto"],
+- deps = [":iam_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "iam_ruby_gapic",
+- srcs = [":iam_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=iam.googleapis.com",
+- "ruby-cloud-api-shortname=iam",
+- "ruby-cloud-gem-name=google-iam-v2",
+- "ruby-cloud-product-url=https://cloud.google.com/iam",
+- "ruby-cloud-wrapper-gem-override=google-iam-client",
+- ],
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Manages identity and access control policies for Google Cloud Platform resources.",
+- ruby_cloud_title = "IAM V2",
+- service_yaml = "iam_v2.yaml",
+- deps = [
+- ":iam_ruby_grpc",
+- ":iam_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-iam-v2-ruby",
+- deps = [
+- ":iam_ruby_gapic",
+- ":iam_ruby_grpc",
+- ":iam_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "iam_csharp_proto",
+- deps = [":iam_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "iam_csharp_grpc",
+- srcs = [":iam_proto"],
+- deps = [":iam_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "iam_csharp_gapic",
+- srcs = [":iam_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iam_v2.yaml",
+- deps = [
+- ":iam_csharp_grpc",
+- ":iam_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-iam-v2-csharp",
+- deps = [
+- ":iam_csharp_gapic",
+- ":iam_csharp_grpc",
+- ":iam_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "iam_cc_proto",
+- deps = [":iam_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "iam_cc_grpc",
+- srcs = [":iam_proto"],
+- grpc_only = True,
+- deps = [":iam_cc_proto"],
+-)
+diff -urN a/google/iam/v2beta/BUILD.bazel b/google/iam/v2beta/BUILD.bazel
+--- a/google/iam/v2beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/iam/v2beta/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,393 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "iam_proto",
+- srcs = [
+- "deny.proto",
+- "policy.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:expr_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "iam_proto_with_info",
+- deps = [
+- ":iam_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "iam_java_proto",
+- deps = [":iam_proto"],
+-)
+-
+-java_grpc_library(
+- name = "iam_java_grpc",
+- srcs = [":iam_proto"],
+- deps = [":iam_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "iam_java_gapic",
+- srcs = [":iam_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iam_v2beta.yaml",
+- test_deps = [
+- ":iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":iam_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "iam_java_gapic_test_suite",
+- test_classes = [
+- "com.google.iam.v2beta.PoliciesClientHttpJsonTest",
+- "com.google.iam.v2beta.PoliciesClientTest",
+- ],
+- runtime_deps = [":iam_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-iam-v2beta-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":iam_java_gapic",
+- ":iam_java_grpc",
+- ":iam_java_proto",
+- ":iam_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "iam_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/iam/v2beta",
+- protos = [":iam_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:expr_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "iam_go_gapic",
+- srcs = [":iam_proto_with_info"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- importpath = "cloud.google.com/go/iam/apiv2beta;iam",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "iam_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "iam_go_gapic_test",
+- srcs = [":iam_go_gapic_srcjar_test"],
+- embed = [":iam_go_gapic"],
+- importpath = "cloud.google.com/go/iam/apiv2beta",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-iam-v2beta-go",
+- deps = [
+- ":iam_go_gapic",
+- ":iam_go_gapic_srcjar-metadata.srcjar",
+- ":iam_go_gapic_srcjar-test.srcjar",
+- ":iam_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "iam_py_gapic",
+- srcs = [":iam_proto"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=iam",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-iam",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "iam_v2beta.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "iam_py_gapic_test",
+- srcs = [
+- "iam_py_gapic_pytest.py",
+- "iam_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":iam_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "iam-v2beta-py",
+- deps = [
+- ":iam_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "iam_php_proto",
+- deps = [":iam_proto"],
+-)
+-
+-php_grpc_library(
+- name = "iam_php_grpc",
+- srcs = [":iam_proto"],
+- deps = [":iam_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "iam_php_gapic",
+- srcs = [":iam_proto_with_info"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iam_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":iam_php_grpc",
+- ":iam_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-iam-v2beta-php",
+- deps = [
+- ":iam_php_gapic",
+- ":iam_php_grpc",
+- ":iam_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "iam_nodejs_gapic",
+- package_name = "@google-cloud/iam",
+- src = ":iam_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- package = "google.iam.v2beta",
+- rest_numeric_enums = False,
+- service_yaml = "iam_v2beta.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "iam-v2beta-nodejs",
+- deps = [
+- ":iam_nodejs_gapic",
+- ":iam_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "iam_ruby_proto",
+- deps = [":iam_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "iam_ruby_grpc",
+- srcs = [":iam_proto"],
+- deps = [":iam_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "iam_ruby_gapic",
+- srcs = [":iam_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-iam-v2beta"],
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iam_v2beta.yaml",
+- deps = [
+- ":iam_ruby_grpc",
+- ":iam_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-iam-v2beta-ruby",
+- deps = [
+- ":iam_ruby_gapic",
+- ":iam_ruby_grpc",
+- ":iam_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "iam_csharp_proto",
+- deps = [":iam_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "iam_csharp_grpc",
+- srcs = [":iam_proto"],
+- deps = [":iam_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "iam_csharp_gapic",
+- srcs = [":iam_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "iam_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "iam_v2beta.yaml",
+- deps = [
+- ":iam_csharp_grpc",
+- ":iam_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-iam-v2beta-csharp",
+- deps = [
+- ":iam_csharp_gapic",
+- ":iam_csharp_grpc",
+- ":iam_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "iam_cc_proto",
+- deps = [":iam_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "iam_cc_grpc",
+- srcs = [":iam_proto"],
+- grpc_only = True,
+- deps = [":iam_cc_proto"],
+-)
+diff -urN a/google/identity/accesscontextmanager/BUILD.bazel b/google/identity/accesscontextmanager/BUILD.bazel
+--- a/google/identity/accesscontextmanager/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/identity/accesscontextmanager/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-identity-access_context_manager.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for accesscontextmanager.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "accesscontextmanager_ruby_wrapper",
+- srcs = ["//google/identity/accesscontextmanager/v1:accesscontextmanager_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-identity-access_context_manager",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/access-context-manager/",
+- "ruby-cloud-api-id=accesscontextmanager.googleapis.com",
+- "ruby-cloud-api-shortname=accesscontextmanager",
+- ],
+- ruby_cloud_description = "Access Context Manager allows enterprises to configure access levels which map to a policy defined on request attributes.",
+- ruby_cloud_title = "Access Context Manager",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-identity-accesscontextmanager-ruby",
+- deps = [
+- ":accesscontextmanager_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/identity/accesscontextmanager/type/BUILD.bazel b/google/identity/accesscontextmanager/type/BUILD.bazel
+--- a/google/identity/accesscontextmanager/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/identity/accesscontextmanager/type/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,199 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "type_proto",
+- srcs = [
+- "device_resources.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "type_java_proto",
+- deps = [":type_proto"],
+-)
+-
+-java_grpc_library(
+- name = "type_java_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_java_proto"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-accesscontextmanager-type-java",
+- transport = "grpc+rest",
+- deps = [
+- ":type_java_grpc",
+- ":type_java_proto",
+- ":type_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "type_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/type",
+- protos = [":type_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "type_moved_proto",
+- srcs = [":type_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "type_py_proto",
+- deps = [":type_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "type_py_grpc",
+- srcs = [":type_moved_proto"],
+- deps = [":type_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "type_php_proto",
+- deps = [":type_proto"],
+-)
+-
+-php_grpc_library(
+- name = "type_php_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "type_ruby_proto",
+- deps = [":type_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "type_ruby_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "type_csharp_proto",
+- deps = [":type_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "type_csharp_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_csharp_proto"],
+-)
+-
+-csharp_gapic_assembly_pkg(
+- name = "google-identity-accesscontextmanager-type-csharp",
+- package_name = "Google.Identity.AccessContextManager.Type",
+- generate_nongapic_package = True,
+- deps = [
+- ":type_csharp_grpc",
+- ":type_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "type_cc_proto",
+- deps = [":type_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "type_cc_grpc",
+- srcs = [":type_proto"],
+- grpc_only = True,
+- deps = [":type_cc_proto"],
+-)
+diff -urN a/google/identity/accesscontextmanager/v1/BUILD.bazel b/google/identity/accesscontextmanager/v1/BUILD.bazel
+--- a/google/identity/accesscontextmanager/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/identity/accesscontextmanager/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,465 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "accesscontextmanager_proto",
+- srcs = [
+- "access_context_manager.proto",
+- "access_level.proto",
+- "access_policy.proto",
+- "gcp_user_access_binding.proto",
+- "service_perimeter.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/identity/accesscontextmanager/type:type_proto",
+- "//google/longrunning:operations_proto",
+- "//google/type:expr_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "accesscontextmanager_proto_with_info",
+- deps = [
+- ":accesscontextmanager_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "access_level_proto",
+- srcs = [
+- "access_level.proto",
+- ],
+- deps = [
+- "//google/api:resource_proto",
+- "//google/identity/accesscontextmanager/type:type_proto",
+- "//google/type:expr_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "access_policy_proto",
+- srcs = [
+- "access_policy.proto",
+- ],
+- deps = [
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "service_perimeter_proto",
+- srcs = [
+- "service_perimeter.proto",
+- ],
+- deps = [
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "accesscontextmanager_java_proto",
+- deps = [":accesscontextmanager_proto"],
+-)
+-
+-java_grpc_library(
+- name = "accesscontextmanager_java_grpc",
+- srcs = [":accesscontextmanager_proto"],
+- deps = [":accesscontextmanager_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "accesscontextmanager_java_gapic",
+- srcs = [":accesscontextmanager_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "accesscontextmanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "accesscontextmanager_v1.yaml",
+- test_deps = [
+- ":accesscontextmanager_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":accesscontextmanager_java_proto",
+- "//google/api:api_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "accesscontextmanager_java_gapic_test_suite",
+- test_classes = [
+- "com.google.identity.accesscontextmanager.v1.AccessContextManagerClientHttpJsonTest",
+- "com.google.identity.accesscontextmanager.v1.AccessContextManagerClientTest",
+- ],
+- runtime_deps = [":accesscontextmanager_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-accesscontextmanager-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":accesscontextmanager_java_gapic",
+- ":accesscontextmanager_java_grpc",
+- ":accesscontextmanager_java_proto",
+- ":accesscontextmanager_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "accesscontextmanager_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/v1",
+- protos = [":accesscontextmanager_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/identity/accesscontextmanager/type:type_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/type:expr_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "accesscontextmanager_go_gapic",
+- srcs = [":accesscontextmanager_proto_with_info"],
+- grpc_service_config = "accesscontextmanager_grpc_service_config.json",
+- importpath = "cloud.google.com/go/identity/accesscontextmanager/apiv1;accesscontextmanager",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "accesscontextmanager_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":accesscontextmanager_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "accesscontextmanager_go_gapic_test",
+- srcs = [":accesscontextmanager_go_gapic_srcjar_test"],
+- embed = [":accesscontextmanager_go_gapic"],
+- importpath = "cloud.google.com/go/identity/accesscontextmanager/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-identity-accesscontextmanager-v1-go",
+- deps = [
+- ":accesscontextmanager_go_gapic",
+- ":accesscontextmanager_go_gapic_srcjar-metadata.srcjar",
+- ":accesscontextmanager_go_gapic_srcjar-test.srcjar",
+- ":accesscontextmanager_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_proto_library",
+- "py_test",
+-)
+-
+-py_proto_library(
+- name = "access_level_py_proto",
+- deps = ["access_level_proto"],
+-)
+-
+-py_proto_library(
+- name = "access_policy_py_proto",
+- deps = ["access_policy_proto"],
+-)
+-
+-py_proto_library(
+- name = "service_perimeter_py_proto",
+- deps = ["service_perimeter_proto"],
+-)
+-
+-py_gapic_library(
+- name = "accesscontextmanager_py_gapic",
+- srcs = [":accesscontextmanager_proto"],
+- grpc_service_config = "accesscontextmanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "accesscontextmanager_v1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1376 is fixed
+-#py_test(
+-# name = "accesscontextmanager_py_gapic_test",
+-# srcs = [
+-# "accesscontextmanager_py_gapic_pytest.py",
+-# "accesscontextmanager_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":accesscontextmanager_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "identity-accesscontextmanager-v1-py",
+- deps = [
+- ":accesscontextmanager_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "accesscontextmanager_php_proto",
+- deps = [":accesscontextmanager_proto"],
+-)
+-
+-php_grpc_library(
+- name = "accesscontextmanager_php_grpc",
+- srcs = [":accesscontextmanager_proto"],
+- deps = [":accesscontextmanager_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "accesscontextmanager_php_gapic",
+- srcs = [":accesscontextmanager_proto_with_info"],
+- grpc_service_config = "accesscontextmanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "accesscontextmanager_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":accesscontextmanager_php_grpc",
+- ":accesscontextmanager_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-identity-accesscontextmanager-v1-php",
+- deps = [
+- ":accesscontextmanager_php_gapic",
+- ":accesscontextmanager_php_grpc",
+- ":accesscontextmanager_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "accesscontextmanager_nodejs_gapic",
+- package_name = "@google-cloud/access-context-manager",
+- src = ":accesscontextmanager_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "accesscontextmanager_grpc_service_config.json",
+- package = "google.identity.accesscontextmanager.v1",
+- rest_numeric_enums = False,
+- service_yaml = "accesscontextmanager_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "identity-accesscontextmanager-v1-nodejs",
+- deps = [
+- ":accesscontextmanager_nodejs_gapic",
+- ":accesscontextmanager_proto",
+- "//google/identity/accesscontextmanager/type:type_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "accesscontextmanager_ruby_proto",
+- deps = [
+- ":accesscontextmanager_proto",
+- "//google/identity/accesscontextmanager/type:type_proto",
+- ],
+-)
+-
+-ruby_grpc_library(
+- name = "accesscontextmanager_ruby_grpc",
+- srcs = [":accesscontextmanager_proto"],
+- deps = [":accesscontextmanager_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "accesscontextmanager_ruby_gapic",
+- srcs = [":accesscontextmanager_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=accesscontextmanager.googleapis.com",
+- "ruby-cloud-api-shortname=accesscontextmanager",
+- "ruby-cloud-gem-name=google-identity-access_context_manager-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/access-context-manager/",
+- ],
+- grpc_service_config = "accesscontextmanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Access Context Manager allows enterprises to configure access levels which map to a policy defined on request attributes.",
+- ruby_cloud_title = "Access Context Manager V1",
+- service_yaml = "accesscontextmanager_v1.yaml",
+- deps = [
+- ":accesscontextmanager_ruby_grpc",
+- ":accesscontextmanager_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-identity-accesscontextmanager-v1-ruby",
+- deps = [
+- ":accesscontextmanager_ruby_gapic",
+- ":accesscontextmanager_ruby_grpc",
+- ":accesscontextmanager_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "accesscontextmanager_csharp_proto",
+- deps = [":accesscontextmanager_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "accesscontextmanager_csharp_grpc",
+- srcs = [":accesscontextmanager_proto"],
+- deps = [":accesscontextmanager_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "accesscontextmanager_csharp_gapic",
+- srcs = [":accesscontextmanager_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "accesscontextmanager_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "accesscontextmanager_v1.yaml",
+- deps = [
+- ":accesscontextmanager_csharp_grpc",
+- ":accesscontextmanager_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-identity-accesscontextmanager-v1-csharp",
+- deps = [
+- ":accesscontextmanager_csharp_gapic",
+- ":accesscontextmanager_csharp_grpc",
+- ":accesscontextmanager_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "accesscontextmanager_cc_proto",
+- deps = [":accesscontextmanager_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "accesscontextmanager_cc_grpc",
+- srcs = [":accesscontextmanager_proto"],
+- grpc_only = True,
+- deps = [":accesscontextmanager_cc_proto"],
+-)
+diff -urN a/google/logging/BUILD.bazel b/google/logging/BUILD.bazel
+--- a/google/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/logging/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/logging/type/BUILD.bazel b/google/logging/type/BUILD.bazel
+--- a/google/logging/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/logging/type/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,204 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "type_proto",
+- srcs = [
+- "http_request.proto",
+- "log_severity.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "@com_google_protobuf//:duration_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "type_java_proto",
+- deps = [":type_proto"],
+-)
+-
+-java_grpc_library(
+- name = "type_java_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_java_proto"],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-logging-type-java",
+- transport = "grpc+rest",
+- deps = [
+- ":type_java_grpc",
+- ":type_java_proto",
+- ":type_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "type_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/logging/type",
+- protos = [":type_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "type_moved_proto",
+- srcs = [":type_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "@com_google_protobuf//:duration_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "type_py_proto",
+- deps = [":type_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "type_py_grpc",
+- srcs = [":type_moved_proto"],
+- deps = [":type_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "type_php_proto",
+- deps = [":type_proto"],
+-)
+-
+-php_grpc_library(
+- name = "type_php_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "type_ruby_proto",
+- deps = [":type_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "type_ruby_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "type_csharp_proto",
+- deps = [":type_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "type_csharp_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_csharp_proto"],
+-)
+-
+-csharp_gapic_assembly_pkg(
+- name = "google-logging-type-csharp",
+- package_name = "Google.Cloud.Logging.Type",
+- generate_nongapic_package = True,
+- deps = [
+- ":type_csharp_grpc",
+- ":type_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "type_cc_proto",
+- deps = [":type_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "type_cc_grpc",
+- srcs = [":type_proto"],
+- grpc_only = True,
+- deps = [":type_cc_proto"],
+-)
+diff -urN a/google/logging/v2/BUILD.bazel b/google/logging/v2/BUILD.bazel
+--- a/google/logging/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/logging/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,368 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "log_entry.proto",
+- "logging.proto",
+- "logging_config.proto",
+- "logging_metrics.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:distribution_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:metric_proto",
+- "//google/api:monitored_resource_proto",
+- "//google/api:resource_proto",
+- "//google/logging/type:type_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "logging_proto_with_info",
+- deps = [
+- ":logging_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "logging_java_gapic",
+- srcs = [":logging_proto_with_info"],
+- gapic_yaml = "logging_gapic.yaml",
+- grpc_service_config = "logging_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "logging_v2.yaml",
+- test_deps = [
+- ":logging_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":logging_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "logging_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.logging.v2.ConfigClientTest",
+- "com.google.cloud.logging.v2.LoggingClientTest",
+- "com.google.cloud.logging.v2.MetricsClientTest",
+- ],
+- runtime_deps = [":logging_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-logging-v2-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":logging_java_gapic",
+- ":logging_java_grpc",
+- ":logging_java_proto",
+- ":logging_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/logging/v2",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:distribution_go_proto",
+- "//google/api:metric_go_proto",
+- "//google/api:monitoredres_go_proto",
+- "//google/logging/type:type_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "logging_go_gapic",
+- srcs = [":logging_proto_with_info"],
+- grpc_service_config = "logging_grpc_service_config.json",
+- importpath = "cloud.google.com/go/logging/apiv2;logging",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "logging_v2.yaml",
+- deps = [
+- ":logging_go_proto",
+- "//google/api:metric_go_proto",
+- "//google/api:monitoredres_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:any_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "logging_go_gapic_test",
+- srcs = [":logging_go_gapic_srcjar_test"],
+- embed = [":logging_go_gapic"],
+- importpath = "cloud.google.com/go/logging/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-logging-v2-go",
+- deps = [
+- ":logging_go_gapic",
+- ":logging_go_gapic_srcjar-metadata.srcjar",
+- ":logging_go_gapic_srcjar-test.srcjar",
+- ":logging_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "logging_py_gapic",
+- srcs = [":logging_proto"],
+- grpc_service_config = "logging_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=logging",
+- "python-gapic-namespace=google.cloud",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1359 is fixed
+-#py_test(
+-# name = "logging_py_gapic_test",
+-# srcs = [
+-# "logging_py_gapic_pytest.py",
+-# "logging_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":logging_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "logging-v2-py",
+- deps = [
+- ":logging_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "logging_php_gapic",
+- srcs = [":logging_proto_with_info"],
+- gapic_yaml = "logging_gapic.yaml",
+- grpc_service_config = "logging_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":logging_php_grpc",
+- ":logging_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-logging-v2-php",
+- deps = [
+- ":logging_php_gapic",
+- ":logging_php_grpc",
+- ":logging_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "logging_nodejs_gapic",
+- package_name = "@google-cloud/logging",
+- src = ":logging_proto_with_info",
+- bundle_config = "logging_gapic.yaml",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "logging_grpc_service_config.json",
+- main_service = "logging",
+- package = "google.logging.v2",
+- rest_numeric_enums = False,
+- service_yaml = "logging_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "logging-v2-nodejs",
+- deps = [
+- ":logging_nodejs_gapic",
+- ":logging_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "logging_ruby_gapic",
+- srcs = [":logging_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=logging.googleapis.com",
+- "ruby-cloud-api-shortname=logging",
+- "ruby-cloud-env-prefix=LOGGING",
+- "ruby-cloud-gem-name=google-cloud-logging-v2",
+- "ruby-cloud-product-url=https://cloud.google.com/logging",
+- "ruby-cloud-service-override=ConfigServiceV2=ConfigService;LoggingServiceV2=LoggingService;MetricsServiceV2=MetricsService",
+- "ruby-cloud-yard-strict=false",
+- ],
+- grpc_service_config = "logging_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Cloud Logging API lets you programmatically read and write log entries, set up exclusions, create logs-based metrics, and manage export sinks.",
+- ruby_cloud_title = "Cloud Logging V2",
+- deps = [
+- ":logging_ruby_grpc",
+- ":logging_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-logging-v2-ruby",
+- deps = [
+- ":logging_ruby_gapic",
+- ":logging_ruby_grpc",
+- ":logging_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "logging_csharp_gapic",
+- srcs = [":logging_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "logging_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "logging_v2.yaml",
+- deps = [
+- ":logging_csharp_grpc",
+- ":logging_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-logging-v2-csharp",
+- deps = [
+- ":logging_csharp_gapic",
+- ":logging_csharp_grpc",
+- ":logging_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/longrunning/BUILD.bazel b/google/longrunning/BUILD.bazel
+--- a/google/longrunning/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/longrunning/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,215 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "operations_proto",
+- srcs = ["operations.proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:descriptor_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "longrunning_proto_with_info",
+- deps = [":operations_proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "longrunning_java_proto",
+- deps = [":operations_proto"],
+-)
+-
+-java_grpc_library(
+- name = "longrunning_java_grpc",
+- srcs = [":operations_proto"],
+- deps = [":longrunning_java_proto"],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-longrunning-java",
+- transport = "grpc+rest",
+- deps = [
+- ":longrunning_java_grpc",
+- ":longrunning_java_proto",
+- ":operations_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "longrunning_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/longrunning",
+- protos = [":operations_proto"],
+- visibility = ["//visibility:public"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "longrunning_go_gapic",
+- srcs = [":longrunning_proto_with_info"],
+- grpc_service_config = "longrunning_grpc_service_config.json",
+- importpath = "cloud.google.com/go/longrunning/autogen;longrunning",
+- rest_numeric_enums = False,
+- service_yaml = "//google/longrunning:longrunning.yaml",
+- transport = "grpc+rest",
+- deps = [":longrunning_go_proto"],
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-longrunning-go",
+- deps = [
+- ":longrunning_go_gapic",
+- ":longrunning_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "longrunning_cc_proto",
+- deps = [":operations_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "longrunning_cc_grpc",
+- srcs = [":operations_proto"],
+- grpc_only = True,
+- deps = [":longrunning_cc_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "longrunning_csharp_proto",
+- deps = [":operations_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "longrunning_csharp_grpc",
+- srcs = [":operations_proto"],
+- deps = [":longrunning_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "longrunning_csharp_gapic",
+- srcs = [":longrunning_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "longrunning_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//google/longrunning:longrunning.yaml",
+- deps = [
+- ":longrunning_csharp_grpc",
+- ":longrunning_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-longrunning-csharp",
+- deps = [
+- ":longrunning_csharp_gapic",
+- ":longrunning_csharp_grpc",
+- ":longrunning_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "longrunning_php_proto",
+- deps = [":operations_proto"],
+-)
+-
+-php_grpc_library(
+- name = "longrunning_php_grpc",
+- srcs = [":operations_proto"],
+- deps = [":longrunning_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "longrunning_php_gapic",
+- srcs = [":longrunning_proto_with_info"],
+- grpc_service_config = "longrunning_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//google/longrunning:longrunning.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":longrunning_php_grpc",
+- ":longrunning_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-longrunning-php",
+- deps = [
+- ":longrunning_php_gapic",
+- ":longrunning_php_grpc",
+- ":longrunning_php_proto",
+- ],
+-)
+diff -urN a/google/maps/BUILD.bazel b/google/maps/BUILD.bazel
+--- a/google/maps/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/maps/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,11 +0,0 @@
+-package(default_visibility = ["//google/maps:__subpackages__"])
+-
+-sh_binary(
+- name = "postprocessing_java",
+- srcs = ["postprocessing_java.sh"],
+-)
+-
+-sh_binary(
+- name = "postprocessing_py",
+- srcs = ["postprocessing_py.sh"],
+-)
+diff -urN a/google/maps/addressvalidation/v1/BUILD.bazel b/google/maps/addressvalidation/v1/BUILD.bazel
+--- a/google/maps/addressvalidation/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/maps/addressvalidation/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,400 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "addressvalidation_proto",
+- srcs = [
+- "address.proto",
+- "address_validation_service.proto",
+- "geocode.proto",
+- "metadata.proto",
+- "usps_data.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/geo/type:viewport_proto",
+- "//google/type:latlng_proto",
+- "//google/type:postal_address_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "addressvalidation_proto_with_info",
+- deps = [
+- ":addressvalidation_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "addressvalidation_java_proto",
+- deps = [":addressvalidation_proto"],
+-)
+-
+-java_grpc_library(
+- name = "addressvalidation_java_grpc",
+- srcs = [":addressvalidation_proto"],
+- deps = [":addressvalidation_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "addressvalidation_java_gapic",
+- srcs = [":addressvalidation_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "addressvalidation_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "addressvalidation_v1.yaml",
+- test_deps = [
+- ":addressvalidation_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":addressvalidation_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "addressvalidation_java_gapic_test_suite",
+- test_classes = [
+- "com.google.maps.addressvalidation.v1.AddressValidationClientHttpJsonTest",
+- "com.google.maps.addressvalidation.v1.AddressValidationClientTest",
+- ],
+- runtime_deps = [":addressvalidation_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-maps-addressvalidation-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":addressvalidation_java_gapic",
+- ":addressvalidation_java_grpc",
+- ":addressvalidation_java_proto",
+- ":addressvalidation_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "addressvalidation_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/maps/addressvalidation/v1",
+- protos = [":addressvalidation_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/geo/type:viewport_go_proto",
+- "//google/type:latlng_go_proto",
+- "//google/type:postaladdress_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "addressvalidation_go_gapic",
+- srcs = [":addressvalidation_proto_with_info"],
+- grpc_service_config = "addressvalidation_grpc_service_config.json",
+- importpath = "google.golang.org/google/maps/addressvalidation/v1;addressvalidation",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "addressvalidation_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":addressvalidation_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "addressvalidation_go_gapic_test",
+- srcs = [":addressvalidation_go_gapic_srcjar_test"],
+- embed = [":addressvalidation_go_gapic"],
+- importpath = "google.golang.org/google/maps/addressvalidation/v1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-maps-addressvalidation-v1-go",
+- deps = [
+- ":addressvalidation_go_gapic",
+- ":addressvalidation_go_gapic_srcjar-metadata.srcjar",
+- ":addressvalidation_go_gapic_srcjar-test.srcjar",
+- ":addressvalidation_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "addressvalidation_py_gapic",
+- srcs = [":addressvalidation_proto"],
+- grpc_service_config = "addressvalidation_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "addressvalidation_v1.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/geo/type:viewport_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "addressvalidation_py_gapic_test",
+- srcs = [
+- "addressvalidation_py_gapic_pytest.py",
+- "addressvalidation_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [
+- ":addressvalidation_py_gapic",
+- ],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "maps-addressvalidation-v1-py",
+- deps = [
+- ":addressvalidation_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "addressvalidation_php_proto",
+- deps = [":addressvalidation_proto"],
+-)
+-
+-php_grpc_library(
+- name = "addressvalidation_php_grpc",
+- srcs = [":addressvalidation_proto"],
+- deps = [":addressvalidation_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "addressvalidation_php_gapic",
+- srcs = [":addressvalidation_proto_with_info"],
+- grpc_service_config = "addressvalidation_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "addressvalidation_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":addressvalidation_php_grpc",
+- ":addressvalidation_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-maps-addressvalidation-v1-php",
+- deps = [
+- ":addressvalidation_php_gapic",
+- ":addressvalidation_php_grpc",
+- ":addressvalidation_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "addressvalidation_nodejs_gapic",
+- package_name = "@googlemaps/addressvalidation",
+- src = ":addressvalidation_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "addressvalidation_grpc_service_config.json",
+- package = "google.maps.addressvalidation.v1",
+- rest_numeric_enums = False,
+- service_yaml = "addressvalidation_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "maps-addressvalidation-v1-nodejs",
+- deps = [
+- ":addressvalidation_nodejs_gapic",
+- ":addressvalidation_proto",
+- "//google/geo/type:viewport_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "addressvalidation_ruby_proto",
+- deps = [":addressvalidation_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "addressvalidation_ruby_grpc",
+- srcs = [":addressvalidation_proto"],
+- deps = [":addressvalidation_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "addressvalidation_ruby_gapic",
+- srcs = [":addressvalidation_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=addressvalidation.googleapis.com",
+- "ruby-cloud-api-shortname=addressvalidation",
+- "ruby-cloud-gem-name=google-maps-address_validation-v1",
+- "ruby-cloud-product-url=https://developers.google.com/maps/documentation/address-validation/",
+- ],
+- grpc_service_config = "addressvalidation_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Address Validation is an API that accepts an address, identifies its components, validates them, normalizes the address for mailing and finds the best known location for it. It can help understand if an address refers to a real place. If the address does not refer to a real place, it can identify possibly wrong components, enabling users to correct them.",
+- ruby_cloud_title = "Address Validation V1",
+- service_yaml = "addressvalidation_v1.yaml",
+- deps = [
+- ":addressvalidation_ruby_grpc",
+- ":addressvalidation_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-maps-addressvalidation-v1-ruby",
+- deps = [
+- ":addressvalidation_ruby_gapic",
+- ":addressvalidation_ruby_grpc",
+- ":addressvalidation_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "addressvalidation_csharp_proto",
+- deps = [":addressvalidation_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "addressvalidation_csharp_grpc",
+- srcs = [":addressvalidation_proto"],
+- deps = [":addressvalidation_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "addressvalidation_csharp_gapic",
+- srcs = [":addressvalidation_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "addressvalidation_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "addressvalidation_v1.yaml",
+- deps = [
+- ":addressvalidation_csharp_grpc",
+- ":addressvalidation_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-maps-addressvalidation-v1-csharp",
+- deps = [
+- ":addressvalidation_csharp_gapic",
+- ":addressvalidation_csharp_grpc",
+- ":addressvalidation_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "addressvalidation_cc_proto",
+- deps = [":addressvalidation_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "addressvalidation_cc_grpc",
+- srcs = [":addressvalidation_proto"],
+- grpc_only = True,
+- deps = [":addressvalidation_cc_proto"],
+-)
+diff -urN a/google/maps/fleetengine/delivery/v1/BUILD.bazel b/google/maps/fleetengine/delivery/v1/BUILD.bazel
+--- a/google/maps/fleetengine/delivery/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/maps/fleetengine/delivery/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,334 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "delivery_proto",
+- srcs = [
+- "common.proto",
+- "delivery_api.proto",
+- "delivery_vehicles.proto",
+- "header.proto",
+- "tasks.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/api:routing_proto",
+- "//google/geo/type:viewport_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "delivery_proto_with_info",
+- deps = [
+- ":delivery_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "delivery_java_proto",
+- deps = [":delivery_proto"],
+-)
+-
+-java_grpc_library(
+- name = "delivery_java_grpc",
+- srcs = [":delivery_proto"],
+- deps = [":delivery_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "delivery_java_gapic",
+- srcs = [":delivery_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "//google/maps/fleetengine/v1:fleetengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "fleetengine.yaml",
+- test_deps = [
+- ":delivery_java_grpc",
+- "//google/maps/fleetengine/v1:fleetengine_java_proto",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":delivery_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "delivery_java_gapic_test_suite",
+- test_classes = [
+- "google.maps.fleetengine.delivery.v1.DeliveryServiceClientHttpJsonTest",
+- "google.maps.fleetengine.delivery.v1.DeliveryServiceClientTest",
+- ],
+- runtime_deps = [":delivery_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-maps-fleetengine-delivery-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":delivery_java_gapic",
+- ":delivery_java_grpc",
+- ":delivery_java_proto",
+- ":delivery_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "delivery_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/maps/fleetengine/delivery/v1",
+- protos = [":delivery_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/geo/type:viewport_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "delivery_go_gapic",
+- srcs = [":delivery_proto_with_info"],
+- grpc_service_config = "//google/maps/fleetengine/v1:fleetengine_grpc_service_config.json",
+- importpath = "google.golang.org/maps/fleetengine/delivery/v1;delivery",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "fleetengine.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":delivery_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "delivery_go_gapic_test",
+- srcs = [":delivery_go_gapic_srcjar_test"],
+- embed = [":delivery_go_gapic"],
+- importpath = "google.golang.org/maps/fleetengine/delivery/v1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-maps-fleetengine-delivery-v1-go",
+- deps = [
+- ":delivery_go_gapic",
+- ":delivery_go_gapic_srcjar-metadata.srcjar",
+- ":delivery_go_gapic_srcjar-test.srcjar",
+- ":delivery_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "delivery_py_gapic",
+- srcs = [":delivery_proto"],
+- grpc_service_config = "//google/maps/fleetengine/v1:fleetengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/geo/type:viewport_py_proto",
+- ],
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1371 is fixed
+-#py_test(
+-# name = "delivery_py_gapic_test",
+-# srcs = [
+-# "delivery_py_gapic_pytest.py",
+-# "delivery_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":delivery_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "maps-fleetengine-delivery-v1-py",
+- deps = [
+- ":delivery_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "delivery_php_proto",
+- deps = [":delivery_proto"],
+-)
+-
+-php_grpc_library(
+- name = "delivery_php_grpc",
+- srcs = [":delivery_proto"],
+- deps = [":delivery_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "delivery_php_gapic",
+- srcs = [":delivery_proto_with_info"],
+- grpc_service_config = "//google/maps/fleetengine/v1:fleetengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "fleetengine.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":delivery_php_grpc",
+- ":delivery_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-maps-fleetengine-delivery-v1-php",
+- deps = [
+- ":delivery_php_gapic",
+- ":delivery_php_grpc",
+- ":delivery_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "delivery_nodejs_gapic",
+- package_name = "@googlemaps/fleetengine-delivery",
+- src = ":delivery_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "//google/maps/fleetengine/v1:fleetengine_grpc_service_config.json",
+- package = "maps.fleetengine.delivery.v1",
+- rest_numeric_enums = False,
+- service_yaml = "fleetengine.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "maps-fleetengine-delivery-v1-nodejs",
+- deps = [
+- ":delivery_nodejs_gapic",
+- ":delivery_proto",
+- "//google/geo/type:viewport_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "delivery_ruby_proto",
+- deps = [":delivery_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "delivery_ruby_grpc",
+- srcs = [":delivery_proto"],
+- deps = [":delivery_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "delivery_ruby_gapic",
+- srcs = [":delivery_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-maps-fleetengine-delivery-v1",
+- ],
+- grpc_service_config = "//google/maps/fleetengine/v1:fleetengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":delivery_ruby_grpc",
+- ":delivery_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-maps-fleetengine-delivery-v1-ruby",
+- deps = [
+- ":delivery_ruby_gapic",
+- ":delivery_ruby_grpc",
+- ":delivery_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "delivery_csharp_proto",
+- deps = [":delivery_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "delivery_csharp_grpc",
+- srcs = [":delivery_proto"],
+- deps = [":delivery_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "delivery_csharp_gapic",
+- srcs = [":delivery_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "//google/maps/fleetengine/v1:fleetengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":delivery_csharp_grpc",
+- ":delivery_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-maps-fleetengine-delivery-v1-csharp",
+- deps = [
+- ":delivery_csharp_gapic",
+- ":delivery_csharp_grpc",
+- ":delivery_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/maps/fleetengine/v1/BUILD.bazel b/google/maps/fleetengine/v1/BUILD.bazel
+--- a/google/maps/fleetengine/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/maps/fleetengine/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,327 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "fleetengine_proto",
+- srcs = [
+- "fleetengine.proto",
+- "header.proto",
+- "traffic.proto",
+- "trip_api.proto",
+- "trips.proto",
+- "vehicle_api.proto",
+- "vehicles.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/api:routing_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "fleetengine_proto_with_info",
+- deps = [
+- ":fleetengine_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "fleetengine_java_proto",
+- deps = [":fleetengine_proto"],
+-)
+-
+-java_grpc_library(
+- name = "fleetengine_java_grpc",
+- srcs = [":fleetengine_proto"],
+- deps = [":fleetengine_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "fleetengine_java_gapic",
+- srcs = [":fleetengine_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "fleetengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "fleetengine.yaml",
+- test_deps = [
+- ":fleetengine_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":fleetengine_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "fleetengine_java_gapic_test_suite",
+- test_classes = [
+- "google.maps.fleetengine.v1.TripServiceClientTest",
+- "google.maps.fleetengine.v1.VehicleServiceClientTest",
+- ],
+- runtime_deps = [":fleetengine_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-maps-fleetengine-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":fleetengine_java_gapic",
+- ":fleetengine_java_grpc",
+- ":fleetengine_java_proto",
+- ":fleetengine_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "fleetengine_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/maps/fleetengine/v1",
+- protos = [":fleetengine_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "fleetengine_go_gapic",
+- srcs = [":fleetengine_proto_with_info"],
+- grpc_service_config = "fleetengine_grpc_service_config.json",
+- importpath = "google.golang.org/maps/fleetengine/v1;fleetengine",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "fleetengine.yaml",
+- deps = [
+- ":fleetengine_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "fleetengine_go_gapic_test",
+- srcs = [":fleetengine_go_gapic_srcjar_test"],
+- embed = [":fleetengine_go_gapic"],
+- importpath = "google.golang.org/maps/fleetengine/v1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-maps-fleetengine-v1-go",
+- deps = [
+- ":fleetengine_go_gapic",
+- ":fleetengine_go_gapic_srcjar-metadata.srcjar",
+- ":fleetengine_go_gapic_srcjar-test.srcjar",
+- ":fleetengine_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "fleetengine_py_gapic",
+- srcs = [":fleetengine_proto"],
+- grpc_service_config = "fleetengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1371 is fixed
+-#py_test(
+-# name = "fleetengine_py_gapic_test",
+-# srcs = [
+-# "fleetengine_py_gapic_pytest.py",
+-# "fleetengine_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":fleetengine_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "maps-fleetengine-v1-py",
+- deps = [
+- ":fleetengine_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "fleetengine_php_proto",
+- deps = [":fleetengine_proto"],
+-)
+-
+-php_grpc_library(
+- name = "fleetengine_php_grpc",
+- srcs = [":fleetengine_proto"],
+- deps = [":fleetengine_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "fleetengine_php_gapic",
+- srcs = [":fleetengine_proto_with_info"],
+- grpc_service_config = "fleetengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "fleetengine.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":fleetengine_php_grpc",
+- ":fleetengine_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-maps-fleetengine-v1-php",
+- deps = [
+- ":fleetengine_php_gapic",
+- ":fleetengine_php_grpc",
+- ":fleetengine_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "fleetengine_nodejs_gapic",
+- package_name = "@googlemaps/fleetengine",
+- src = ":fleetengine_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "fleetengine_grpc_service_config.json",
+- package = "maps.fleetengine.v1",
+- rest_numeric_enums = False,
+- service_yaml = "fleetengine.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "maps-fleetengine-v1-nodejs",
+- deps = [
+- ":fleetengine_nodejs_gapic",
+- ":fleetengine_proto",
+- "//google/geo/type:viewport_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "fleetengine_ruby_proto",
+- deps = [":fleetengine_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "fleetengine_ruby_grpc",
+- srcs = [":fleetengine_proto"],
+- deps = [":fleetengine_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "fleetengine_ruby_gapic",
+- srcs = [":fleetengine_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-maps-fleetengine-v1"],
+- grpc_service_config = "fleetengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":fleetengine_ruby_grpc",
+- ":fleetengine_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-maps-fleetengine-v1-ruby",
+- deps = [
+- ":fleetengine_ruby_gapic",
+- ":fleetengine_ruby_grpc",
+- ":fleetengine_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "fleetengine_csharp_proto",
+- deps = [":fleetengine_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "fleetengine_csharp_grpc",
+- srcs = [":fleetengine_proto"],
+- deps = [":fleetengine_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "fleetengine_csharp_gapic",
+- srcs = [":fleetengine_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "fleetengine_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":fleetengine_csharp_grpc",
+- ":fleetengine_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-maps-fleetengine-v1-csharp",
+- deps = [
+- ":fleetengine_csharp_gapic",
+- ":fleetengine_csharp_grpc",
+- ":fleetengine_csharp_proto",
+- ],
+-)
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/maps/mapsplatformdatasets/v1alpha/BUILD.bazel b/google/maps/mapsplatformdatasets/v1alpha/BUILD.bazel
+--- a/google/maps/mapsplatformdatasets/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/maps/mapsplatformdatasets/v1alpha/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,386 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "mapsplatformdatasets_proto",
+- srcs = [
+- "data_source.proto",
+- "dataset.proto",
+- "maps_platform_datasets.proto",
+- "maps_platform_datasets_alpha_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "mapsplatformdatasets_proto_with_info",
+- deps = [
+- ":mapsplatformdatasets_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "mapsplatformdatasets_java_proto",
+- deps = [":mapsplatformdatasets_proto"],
+-)
+-
+-java_grpc_library(
+- name = "mapsplatformdatasets_java_grpc",
+- srcs = [":mapsplatformdatasets_proto"],
+- deps = [":mapsplatformdatasets_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "mapsplatformdatasets_java_gapic",
+- srcs = [":mapsplatformdatasets_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "mapsplatformdatasets_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "mapsplatformdatasets_v1alpha.yaml",
+- test_deps = [
+- ":mapsplatformdatasets_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":mapsplatformdatasets_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "mapsplatformdatasets_java_gapic_test_suite",
+- test_classes = [
+- "com.google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClientHttpJsonTest",
+- "com.google.maps.mapsplatformdatasets.v1alpha.MapsPlatformDatasetsV1AlphaClientTest",
+- ],
+- runtime_deps = [":mapsplatformdatasets_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-maps-mapsplatformdatasets-v1alpha-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":mapsplatformdatasets_java_gapic",
+- ":mapsplatformdatasets_java_grpc",
+- ":mapsplatformdatasets_java_proto",
+- ":mapsplatformdatasets_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "mapsplatformdatasets_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/maps/mapsplatformdatasets/v1alpha",
+- protos = [":mapsplatformdatasets_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "mapsplatformdatasets_go_gapic",
+- srcs = [":mapsplatformdatasets_proto_with_info"],
+- grpc_service_config = "mapsplatformdatasets_grpc_service_config.json",
+- importpath = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha;mapsplatformdatasets",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "mapsplatformdatasets_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":mapsplatformdatasets_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "mapsplatformdatasets_go_gapic_test",
+- srcs = [":mapsplatformdatasets_go_gapic_srcjar_test"],
+- embed = [":mapsplatformdatasets_go_gapic"],
+- importpath = "cloud.google.com/go/maps/mapsplatformdatasets/apiv1alpha",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-maps-mapsplatformdatasets-v1alpha-go",
+- deps = [
+- ":mapsplatformdatasets_go_gapic",
+- ":mapsplatformdatasets_go_gapic_srcjar-metadata.srcjar",
+- ":mapsplatformdatasets_go_gapic_srcjar-test.srcjar",
+- ":mapsplatformdatasets_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "mapsplatformdatasets_py_gapic",
+- srcs = [":mapsplatformdatasets_proto"],
+- grpc_service_config = "mapsplatformdatasets_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "mapsplatformdatasets_v1alpha.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "mapsplatformdatasets_py_gapic_test",
+- srcs = [
+- "mapsplatformdatasets_py_gapic_pytest.py",
+- "mapsplatformdatasets_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":mapsplatformdatasets_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "maps-mapsplatformdatasets-v1alpha-py",
+- deps = [
+- ":mapsplatformdatasets_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "mapsplatformdatasets_php_proto",
+- deps = [":mapsplatformdatasets_proto"],
+-)
+-
+-php_grpc_library(
+- name = "mapsplatformdatasets_php_grpc",
+- srcs = [":mapsplatformdatasets_proto"],
+- deps = [":mapsplatformdatasets_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "mapsplatformdatasets_php_gapic",
+- srcs = [":mapsplatformdatasets_proto_with_info"],
+- grpc_service_config = "mapsplatformdatasets_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "mapsplatformdatasets_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":mapsplatformdatasets_php_grpc",
+- ":mapsplatformdatasets_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-maps-mapsplatformdatasets-v1alpha-php",
+- deps = [
+- ":mapsplatformdatasets_php_gapic",
+- ":mapsplatformdatasets_php_grpc",
+- ":mapsplatformdatasets_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "mapsplatformdatasets_nodejs_gapic",
+- package_name = "@google-cloud/mapsplatformdatasets",
+- src = ":mapsplatformdatasets_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "mapsplatformdatasets_grpc_service_config.json",
+- package = "google.maps.mapsplatformdatasets.v1alpha",
+- rest_numeric_enums = False,
+- service_yaml = "mapsplatformdatasets_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "maps-mapsplatformdatasets-v1alpha-nodejs",
+- deps = [
+- ":mapsplatformdatasets_nodejs_gapic",
+- ":mapsplatformdatasets_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "mapsplatformdatasets_ruby_proto",
+- deps = [":mapsplatformdatasets_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "mapsplatformdatasets_ruby_grpc",
+- srcs = [":mapsplatformdatasets_proto"],
+- deps = [":mapsplatformdatasets_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "mapsplatformdatasets_ruby_gapic",
+- srcs = [":mapsplatformdatasets_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-maps-mapsplatformdatasets-v1alpha"],
+- grpc_service_config = "mapsplatformdatasets_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "mapsplatformdatasets_v1alpha.yaml",
+- deps = [
+- ":mapsplatformdatasets_ruby_grpc",
+- ":mapsplatformdatasets_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-maps-mapsplatformdatasets-v1alpha-ruby",
+- deps = [
+- ":mapsplatformdatasets_ruby_gapic",
+- ":mapsplatformdatasets_ruby_grpc",
+- ":mapsplatformdatasets_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "mapsplatformdatasets_csharp_proto",
+- deps = [":mapsplatformdatasets_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "mapsplatformdatasets_csharp_grpc",
+- srcs = [":mapsplatformdatasets_proto"],
+- deps = [":mapsplatformdatasets_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "mapsplatformdatasets_csharp_gapic",
+- srcs = [":mapsplatformdatasets_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "mapsplatformdatasets_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "mapsplatformdatasets_v1alpha.yaml",
+- deps = [
+- ":mapsplatformdatasets_csharp_grpc",
+- ":mapsplatformdatasets_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-maps-mapsplatformdatasets-v1alpha-csharp",
+- deps = [
+- ":mapsplatformdatasets_csharp_gapic",
+- ":mapsplatformdatasets_csharp_grpc",
+- ":mapsplatformdatasets_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "mapsplatformdatasets_cc_proto",
+- deps = [":mapsplatformdatasets_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "mapsplatformdatasets_cc_grpc",
+- srcs = [":mapsplatformdatasets_proto"],
+- grpc_only = True,
+- deps = [":mapsplatformdatasets_cc_proto"],
+-)
+diff -urN a/google/maps/playablelocations/v3/BUILD.bazel b/google/maps/playablelocations/v3/BUILD.bazel
+--- a/google/maps/playablelocations/v3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/maps/playablelocations/v3/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,279 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "playablelocations_proto",
+- srcs = [
+- "playablelocations.proto",
+- "resources.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/maps/playablelocations/v3/sample:resources_proto",
+- "//google/maps/unity:clientinfo_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "playablelocations_proto_with_info",
+- deps = [
+- ":playablelocations_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "playablelocations_java_proto",
+- deps = [
+- ":playablelocations_proto",
+- "//google/maps/playablelocations/v3/sample:resources_proto",
+- "//google/maps/unity:clientinfo_proto",
+- ],
+-)
+-
+-java_grpc_library(
+- name = "playablelocations_java_grpc",
+- srcs = [":playablelocations_proto"],
+- deps = [":playablelocations_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "playablelocations_java_gapic",
+- srcs = [":playablelocations_proto_with_info"],
+- grpc_service_config = "playablelocations_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":playablelocations_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":playablelocations_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "playablelocations_java_gapic_test_suite",
+- test_classes = [
+- "com.google.maps.playablelocations.v3.PlayableLocationsClientHttpJsonTest",
+- "com.google.maps.playablelocations.v3.PlayableLocationsClientTest",
+- ],
+- runtime_deps = [":playablelocations_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-maps-playablelocations-v3-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":playablelocations_java_gapic",
+- ":playablelocations_java_grpc",
+- ":playablelocations_java_proto",
+- ":playablelocations_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "playablelocations_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/maps/playablelocations/v3",
+- protos = [":playablelocations_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/maps/playablelocations/v3/sample:resources_go_proto",
+- "//google/maps/unity:clientinfo_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "playablelocations_go_gapic",
+- srcs = [":playablelocations_proto_with_info"],
+- grpc_service_config = "playablelocations_grpc_service_config.json",
+- importpath = "google.golang.org/google/maps/playablelocations/v3;playablelocations",
+- rest_numeric_enums = False,
+- service_yaml = "playablelocations_v3.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":playablelocations_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "playablelocations_go_gapic_test",
+- srcs = [":playablelocations_go_gapic_srcjar_test"],
+- embed = [":playablelocations_go_gapic"],
+- importpath = "google.golang.org/google/maps/playablelocations/v3",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-maps-playablelocations-v3-go",
+- deps = [
+- ":playablelocations_go_gapic",
+- ":playablelocations_go_gapic_srcjar-test.srcjar",
+- ":playablelocations_go_proto",
+- ],
+-)
+-
+-php_proto_library(
+- name = "playablelocations_php_proto",
+- deps = [":playablelocations_proto"],
+-)
+-
+-php_grpc_library(
+- name = "playablelocations_php_grpc",
+- srcs = [":playablelocations_proto"],
+- deps = [":playablelocations_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "playablelocations_php_gapic",
+- srcs = [":playablelocations_proto_with_info"],
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":playablelocations_php_grpc",
+- ":playablelocations_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-maps-playablelocations-v3-php",
+- deps = [
+- ":playablelocations_php_gapic",
+- ":playablelocations_php_grpc",
+- ":playablelocations_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "playablelocations_nodejs_gapic",
+- src = ":playablelocations_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "playablelocations_grpc_service_config.json",
+- package = "google.maps.playablelocations.v3",
+- rest_numeric_enums = False,
+- service_yaml = "playablelocations_v3.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "maps-playablelocations-v3-nodejs",
+- deps = [
+- ":playablelocations_nodejs_gapic",
+- ":playablelocations_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "playablelocations_ruby_proto",
+- deps = [":playablelocations_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "playablelocations_ruby_grpc",
+- srcs = [":playablelocations_proto"],
+- deps = [":playablelocations_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "playablelocations_ruby_gapic",
+- srcs = [":playablelocations_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-playablelocations-v3"],
+- rest_numeric_enums = False,
+- deps = [
+- ":playablelocations_ruby_grpc",
+- ":playablelocations_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-maps-playablelocations-v3-ruby",
+- deps = [
+- ":playablelocations_ruby_gapic",
+- ":playablelocations_ruby_grpc",
+- ":playablelocations_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "playablelocations_csharp_proto",
+- deps = [":playablelocations_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "playablelocations_csharp_grpc",
+- srcs = [":playablelocations_proto"],
+- deps = [":playablelocations_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "playablelocations_csharp_gapic",
+- srcs = [":playablelocations_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "playablelocations_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":playablelocations_csharp_grpc",
+- ":playablelocations_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-maps-playablelocations-v3-csharp",
+- deps = [
+- ":playablelocations_csharp_gapic",
+- ":playablelocations_csharp_grpc",
+- ":playablelocations_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ rules here
+diff -urN a/google/maps/playablelocations/v3/sample/BUILD.bazel b/google/maps/playablelocations/v3/sample/BUILD.bazel
+--- a/google/maps/playablelocations/v3/sample/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/maps/playablelocations/v3/sample/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,134 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "resources_proto",
+- srcs = [
+- "resources.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "resources_java_proto",
+- deps = [":resources_proto"],
+-)
+-
+-java_grpc_library(
+- name = "resources_java_grpc",
+- srcs = [":resources_proto"],
+- deps = [":resources_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "resources_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/maps/playablelocations/v3/sample",
+- protos = [":resources_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "resources_php_proto",
+- deps = [":resources_proto"],
+-)
+-
+-php_grpc_library(
+- name = "resources_php_grpc",
+- srcs = [":resources_proto"],
+- deps = [":resources_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "resources_ruby_proto",
+- deps = [":resources_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "resources_ruby_grpc",
+- srcs = [":resources_proto"],
+- deps = [":resources_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "resources_csharp_proto",
+- deps = [":resources_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "resources_csharp_grpc",
+- srcs = [":resources_proto"],
+- deps = [":resources_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/maps/regionlookup/v1alpha/BUILD.bazel b/google/maps/regionlookup/v1alpha/BUILD.bazel
+--- a/google/maps/regionlookup/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/maps/regionlookup/v1alpha/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,330 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "regionlookup_proto",
+- srcs = [
+- "region_identifier.proto",
+- "region_lookup_service.proto",
+- "region_match.proto",
+- "region_search_values.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/type:latlng_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "regionlookup_proto_with_info",
+- deps = [
+- ":regionlookup_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "regionlookup_java_proto",
+- deps = [":regionlookup_proto"],
+-)
+-
+-java_grpc_library(
+- name = "regionlookup_java_grpc",
+- srcs = [":regionlookup_proto"],
+- deps = [":regionlookup_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "regionlookup_java_gapic",
+- srcs = [":regionlookup_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "regionlookup_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "regionlookup_v1alpha.yaml",
+- test_deps = [
+- ":regionlookup_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":regionlookup_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "regionlookup_java_gapic_test_suite",
+- test_classes = [
+- "com.google.maps.regionlookup.v1alpha.RegionLookupClientHttpJsonTest",
+- "com.google.maps.regionlookup.v1alpha.RegionLookupClientTest",
+- ],
+- runtime_deps = [":regionlookup_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-maps-regionlookup-v1alpha-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":regionlookup_java_gapic",
+- ":regionlookup_java_grpc",
+- ":regionlookup_java_proto",
+- ":regionlookup_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "regionlookup_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/maps/regionlookup/v1alpha",
+- protos = [":regionlookup_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "regionlookup_go_gapic",
+- srcs = [":regionlookup_proto_with_info"],
+- grpc_service_config = "regionlookup_grpc_service_config.json",
+- importpath = "google.golang.org/google/maps/regionlookup/v1alpha;regionlookup",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "regionlookup_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":regionlookup_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "regionlookup_go_gapic_test",
+- srcs = [":regionlookup_go_gapic_srcjar_test"],
+- embed = [":regionlookup_go_gapic"],
+- importpath = "google.golang.org/google/maps/regionlookup/v1alpha",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-maps-regionlookup-v1alpha-go",
+- deps = [
+- ":regionlookup_go_gapic",
+- ":regionlookup_go_gapic_srcjar-metadata.srcjar",
+- ":regionlookup_go_gapic_srcjar-test.srcjar",
+- ":regionlookup_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "regionlookup_py_gapic",
+- srcs = [":regionlookup_proto"],
+- grpc_service_config = "regionlookup_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "regionlookup_v1alpha.yaml",
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "regionlookup_py_gapic_test",
+- srcs = [
+- "regionlookup_py_gapic_pytest.py",
+- "regionlookup_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":regionlookup_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "maps-regionlookup-v1alpha-py",
+- deps = [
+- ":regionlookup_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "regionlookup_php_proto",
+- deps = [":regionlookup_proto"],
+-)
+-
+-php_grpc_library(
+- name = "regionlookup_php_grpc",
+- srcs = [":regionlookup_proto"],
+- deps = [":regionlookup_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "regionlookup_php_gapic",
+- srcs = [":regionlookup_proto_with_info"],
+- grpc_service_config = "regionlookup_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "regionlookup_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":regionlookup_php_grpc",
+- ":regionlookup_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-maps-regionlookup-v1alpha-php",
+- deps = [
+- ":regionlookup_php_gapic",
+- ":regionlookup_php_grpc",
+- ":regionlookup_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "regionlookup_nodejs_gapic",
+- package_name = "@google-cloud/regionlookup",
+- src = ":regionlookup_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "regionlookup_grpc_service_config.json",
+- package = "google.maps.regionlookup.v1alpha",
+- rest_numeric_enums = False,
+- service_yaml = "regionlookup_v1alpha.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "maps-regionlookup-v1alpha-nodejs",
+- deps = [
+- ":regionlookup_nodejs_gapic",
+- ":regionlookup_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "regionlookup_ruby_proto",
+- deps = [":regionlookup_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "regionlookup_ruby_grpc",
+- srcs = [":regionlookup_proto"],
+- deps = [":regionlookup_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "regionlookup_ruby_gapic",
+- srcs = [":regionlookup_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-maps-regionlookup-v1alpha",
+- ],
+- grpc_service_config = "regionlookup_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":regionlookup_ruby_grpc",
+- ":regionlookup_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-maps-regionlookup-v1alpha-ruby",
+- deps = [
+- ":regionlookup_ruby_gapic",
+- ":regionlookup_ruby_grpc",
+- ":regionlookup_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "regionlookup_csharp_proto",
+- deps = [":regionlookup_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "regionlookup_csharp_grpc",
+- srcs = [":regionlookup_proto"],
+- deps = [":regionlookup_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "regionlookup_csharp_gapic",
+- srcs = [":regionlookup_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "regionlookup_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "regionlookup_v1alpha.yaml",
+- deps = [
+- ":regionlookup_csharp_grpc",
+- ":regionlookup_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-maps-regionlookup-v1alpha-csharp",
+- deps = [
+- ":regionlookup_csharp_gapic",
+- ":regionlookup_csharp_grpc",
+- ":regionlookup_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "regionlookup_cc_proto",
+- deps = [":regionlookup_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "regionlookup_cc_grpc",
+- srcs = [":regionlookup_proto"],
+- grpc_only = True,
+- deps = [":regionlookup_cc_proto"],
+-)
+diff -urN a/google/maps/roads/v1op/BUILD.bazel b/google/maps/roads/v1op/BUILD.bazel
+--- a/google/maps/roads/v1op/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/maps/roads/v1op/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,328 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_gapic_library",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-load("//google/maps:postprocessing.bzl", "maps_assembly_pkg")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "roads_proto",
+- srcs = [
+- "roads.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:resource_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "roads_proto_with_info",
+- deps = [
+- ":roads_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "roads_java_proto",
+- deps = [":roads_proto"],
+-)
+-
+-java_grpc_library(
+- name = "roads_java_grpc",
+- srcs = [":roads_proto"],
+- deps = [":roads_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "roads_java_gapic",
+- srcs = [":roads_proto_with_info"],
+- grpc_service_config = "roads_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":roads_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":roads_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "roads_java_gapic_test_suite",
+- test_classes = [
+- "com.google.maps.roads.v1op.RoadsServiceClientHttpJsonTest",
+- "com.google.maps.roads.v1op.RoadsServiceClientTest",
+- ],
+- runtime_deps = ["roads_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-maps-roads-v1op-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":roads_java_gapic",
+- ":roads_java_grpc",
+- ":roads_java_proto",
+- ":roads_proto",
+- ],
+-)
+-
+-maps_assembly_pkg(
+- name = "google-maps-roads-v1op-java-postprocess",
+- srcs = [":google-maps-roads-v1op-java"],
+- language = "java",
+-)
+-
+-go_proto_library(
+- name = "roads_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/maps/roads/v1op",
+- protos = [":roads_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "roads_go_gapic",
+- srcs = [":roads_proto_with_info"],
+- grpc_service_config = "roads_grpc_service_config.json",
+- importpath = "developers.google.com/maps/go/roads/v1op;roads",
+- rest_numeric_enums = False,
+- service_yaml = "roads_v1op.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":roads_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "roads_go_gapic_test",
+- srcs = [":roads_go_gapic_srcjar_test"],
+- embed = [":roads_go_gapic"],
+- importpath = "developers.google.com/maps/go/roads/v1op",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapic-maps-roads-v1op-go",
+- deps = [
+- ":roads_go_gapic",
+- ":roads_go_gapic_srcjar-test.srcjar",
+- ":roads_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "roads_py_gapic",
+- srcs = [":roads_proto"],
+- grpc_service_config = "roads_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "roads_py_gapic_test",
+- srcs = [
+- "roads_py_gapic_pytest.py",
+- "roads_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":roads_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "roads-v1op-py",
+- deps = [
+- ":roads_py_gapic",
+- ],
+-)
+-
+-maps_assembly_pkg(
+- name = "roads-v1op-py-postprocess",
+- srcs = [":roads-v1op-py"],
+- language = "py",
+-)
+-
+-php_proto_library(
+- name = "roads_php_proto",
+- deps = [":roads_proto"],
+-)
+-
+-php_grpc_library(
+- name = "roads_php_grpc",
+- srcs = [":roads_proto"],
+- deps = [":roads_php_proto"],
+-)
+-# A HttpRule option must be defined
+-# php_gapic_library(
+-# name = "roads_php_gapic",
+-# srcs = [":roads_proto_with_info"],
+-# service_yaml = "roads_v1op.yaml",
+-# deps = [
+-# ":roads_php_grpc",
+-# ":roads_php_proto",
+-# ],
+-# )
+-
+-# # Open Source Packages
+-# php_gapic_assembly_pkg(
+-# name = "google-maps-roads-v1op-php",
+-# deps = [
+-# ":roads_php_gapic",
+-# ":roads_php_grpc",
+-# ":roads_php_proto",
+-# ],
+-# )
+-
+-nodejs_gapic_library(
+- name = "roads_nodejs_gapic",
+- src = ":roads_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "roads_grpc_service_config.json",
+- package = "google.maps.roads.v1op",
+- rest_numeric_enums = False,
+- service_yaml = "roads_v1op.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "roads-v1op-nodejs",
+- deps = [
+- ":roads_nodejs_gapic",
+- ":roads_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "roads_ruby_proto",
+- deps = [":roads_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "roads_ruby_grpc",
+- srcs = [":roads_proto"],
+- deps = [":roads_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "roads_ruby_gapic",
+- srcs = [":roads_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-roads-v1op"],
+- rest_numeric_enums = False,
+- deps = [
+- ":roads_ruby_grpc",
+- ":roads_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-maps-roads-v1op-ruby",
+- deps = [
+- ":roads_ruby_gapic",
+- ":roads_ruby_grpc",
+- ":roads_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "roads_csharp_proto",
+- deps = [":roads_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "roads_csharp_grpc",
+- srcs = [":roads_proto"],
+- deps = [":roads_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "roads_csharp_gapic",
+- srcs = [":roads_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "roads_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":roads_csharp_grpc",
+- ":roads_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-maps-roads-v1op-csharp",
+- deps = [
+- ":roads_csharp_gapic",
+- ":roads_csharp_grpc",
+- ":roads_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "roads_cc_proto",
+- deps = [":roads_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "roads_cc_grpc",
+- srcs = [":roads_proto"],
+- generate_mocks = True,
+- grpc_only = True,
+- deps = [":roads_cc_proto"],
+-)
+-
+-cc_gapic_library(
+- name = "roads_cc_gapic",
+- src = ":roads_proto_with_info",
+- package = "google.maps.roads.v1op",
+- deps = [
+- ":roads_cc_grpc",
+- ":roads_cc_proto",
+- ],
+-)
+diff -urN a/google/maps/routes/v1/BUILD.bazel b/google/maps/routes/v1/BUILD.bazel
+--- a/google/maps/routes/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/maps/routes/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,171 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_proto_library",
+- "java_gapic_assembly_gradle_pkg",
+- "java_grpc_library",
+- "java_proto_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_library",
+- "py_test",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "routes_proto",
+- srcs = [
+- "compute_custom_routes_request.proto",
+- "compute_custom_routes_response.proto",
+- "compute_route_matrix_request.proto",
+- "compute_routes_request.proto",
+- "compute_routes_response.proto",
+- "custom_route.proto",
+- "fallback_info.proto",
+- "polyline.proto",
+- "route.proto",
+- "route_matrix_element.proto",
+- "route_service.proto",
+- "toll_passes.proto",
+- "vehicle_emission_type.proto",
+- "waypoint.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/geo/type:viewport_proto",
+- "//google/rpc:status_proto",
+- "//google/type:latlng_proto",
+- "//google/type:money_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "routes_proto_with_info",
+- deps = [
+- ":routes_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "routes_java_proto",
+- deps = [":routes_proto"],
+-)
+-
+-java_grpc_library(
+- name = "routes_java_grpc",
+- srcs = [":routes_proto"],
+- deps = [":routes_java_proto"],
+-)
+-
+-java_gapic_assembly_gradle_pkg(
+- name = "google-maps-routes-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- "//google/maps/routes/v1:routes_java_grpc",
+- "//google/maps/routes/v1:routes_java_proto",
+- "//google/maps/routes/v1:routes_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "routes_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/maps/routes/v1",
+- protos = [":routes_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/geo/type:viewport_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:latlng_go_proto",
+- "//google/type:money_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "routes_py_gapic",
+- srcs = [":routes_proto"],
+- grpc_service_config = "routes_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/geo/type:viewport_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "routes_py_gapic_test",
+- srcs = [
+- "routes_py_gapic_pytest.py",
+- "routes_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":routes_py_gapic"],
+-)
+-
+-php_proto_library(
+- name = "routes_php_proto",
+- deps = [":routes_proto"],
+-)
+-
+-php_grpc_library(
+- name = "routes_php_grpc",
+- srcs = [":routes_proto"],
+- deps = [":routes_php_proto"],
+-)
+-
+-ruby_proto_library(
+- name = "routes_ruby_proto",
+- deps = [":routes_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "routes_ruby_grpc",
+- srcs = [":routes_proto"],
+- deps = [":routes_ruby_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "routes_csharp_proto",
+- deps = [":routes_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "routes_csharp_grpc",
+- srcs = [":routes_proto"],
+- deps = [":routes_csharp_proto"],
+-)
+-
+-cc_proto_library(
+- name = "routes_cc_proto",
+- deps = [":routes_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "routes_cc_grpc",
+- srcs = [":routes_proto"],
+- generate_mocks = True,
+- grpc_only = True,
+- deps = [":routes_cc_proto"],
+-)
+diff -urN a/google/maps/routes/v1alpha/BUILD.bazel b/google/maps/routes/v1alpha/BUILD.bazel
+--- a/google/maps/routes/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/maps/routes/v1alpha/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,166 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "routes_proto",
+- srcs = [
+- "route_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/maps/routes/v1:routes_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "routes_java_proto",
+- deps = [":routes_proto"],
+-)
+-
+-java_grpc_library(
+- name = "routes_java_grpc",
+- srcs = [":routes_proto"],
+- deps = [":routes_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "routes_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/maps/routes/v1alpha",
+- protos = [":routes_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/maps/routes/v1:routes_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "routes_moved_proto",
+- srcs = [":routes_proto"],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/maps/routes/v1:routes_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "routes_py_proto",
+- deps = [":routes_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "routes_py_grpc",
+- srcs = [":routes_moved_proto"],
+- deps = [":routes_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "routes_php_proto",
+- deps = [":routes_proto"],
+-)
+-
+-php_grpc_library(
+- name = "routes_php_grpc",
+- srcs = [":routes_proto"],
+- deps = [":routes_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "routes_ruby_proto",
+- deps = [":routes_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "routes_ruby_grpc",
+- srcs = [":routes_proto"],
+- deps = [":routes_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "routes_csharp_proto",
+- deps = [":routes_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "routes_csharp_grpc",
+- srcs = [":routes_proto"],
+- deps = [":routes_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/maps/routespreferred/v1/BUILD.bazel b/google/maps/routespreferred/v1/BUILD.bazel
+--- a/google/maps/routespreferred/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/maps/routespreferred/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,100 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-load("//google/maps:postprocessing.bzl", "maps_assembly_pkg")
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-alias(
+- name = "routes_proto",
+- actual = "//google/maps/routes/v1:routes_proto",
+-)
+-
+-alias(
+- name = "routes_proto_with_info",
+- actual = "//google/maps/routes/v1:routes_proto_with_info",
+-)
+-
+-java_gapic_library(
+- name = "routespreferred_java_gapic",
+- srcs = [":routes_proto_with_info"],
+- gapic_yaml = "routespreferred_gapic.yaml",
+- grpc_service_config = "//google/maps/routes/v1:routes_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- "//google/maps/routes/v1:routes_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- "//google/maps/routes/v1:routes_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "routespreferred_java_gapic_test_suite",
+- test_classes = [
+- "com.google.maps.routespreferred.v1.RoutesPreferredClientHttpJsonTest",
+- "com.google.maps.routespreferred.v1.RoutesPreferredClientTest",
+- ],
+- runtime_deps = [":routespreferred_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-maps-routespreferred-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":routespreferred_java_gapic",
+- "//google/maps/routes/v1:routes_java_grpc", # needed for test mocks
+- ],
+-)
+-
+-maps_assembly_pkg(
+- name = "google-maps-routespreferred-v1-java-postprocess",
+- srcs = [":google-maps-routespreferred-v1-java"],
+- language = "java",
+-)
+-
+-go_gapic_library(
+- name = "routespreferred_go_gapic",
+- srcs = [":routes_proto_with_info"],
+- grpc_service_config = "",
+- importpath = "developers.google.com/maps/go/routespreferred/v1;routes",
+- rest_numeric_enums = False,
+- service_yaml = "routespreferred_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- "//google/maps/routes/v1:routes_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "routespreferred_go_gapic_test",
+- srcs = [":routespreferred_go_gapic_srcjar_test"],
+- embed = [":routespreferred_go_gapic"],
+- importpath = "developers.google.com/maps/go/routespreferred/v1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapic-maps-routespreferred-v1-go",
+- deps = [
+- ":routespreferred_go_gapic",
+- ":routespreferred_go_gapic_srcjar-test.srcjar",
+- "//google/maps/routes/v1:routes_go_proto",
+- ],
+-)
+diff -urN a/google/maps/routing/v2/BUILD.bazel b/google/maps/routing/v2/BUILD.bazel
+--- a/google/maps/routing/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/maps/routing/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,418 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "routing_proto",
+- srcs = [
+- "fallback_info.proto",
+- "location.proto",
+- "maneuver.proto",
+- "navigation_instruction.proto",
+- "polyline.proto",
+- "route.proto",
+- "route_label.proto",
+- "route_modifiers.proto",
+- "route_travel_mode.proto",
+- "routes_service.proto",
+- "routing_preference.proto",
+- "speed_reading_interval.proto",
+- "toll_info.proto",
+- "toll_passes.proto",
+- "units.proto",
+- "vehicle_emission_type.proto",
+- "vehicle_info.proto",
+- "waypoint.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/geo/type:viewport_proto",
+- "//google/rpc:status_proto",
+- "//google/type:latlng_proto",
+- "//google/type:money_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "routing_proto_with_info",
+- deps = [
+- ":routing_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "routing_java_proto",
+- deps = [":routing_proto"],
+-)
+-
+-java_grpc_library(
+- name = "routing_java_grpc",
+- srcs = [":routing_proto"],
+- deps = [":routing_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "routing_java_gapic",
+- srcs = [":routing_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "library_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "routes_v2.yaml",
+- test_deps = [
+- ":routing_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":routing_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "routing_java_gapic_test_suite",
+- test_classes = [
+- "com.google.maps.routing.v2.RoutesClientHttpJsonTest",
+- "com.google.maps.routing.v2.RoutesClientTest",
+- ],
+- runtime_deps = [":routing_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-maps-routing-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":routing_java_gapic",
+- ":routing_java_grpc",
+- ":routing_java_proto",
+- ":routing_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "routing_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/maps/routing/v2",
+- protos = [":routing_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/geo/type:viewport_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:latlng_go_proto",
+- "//google/type:money_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "routing_go_gapic",
+- srcs = [":routing_proto_with_info"],
+- grpc_service_config = "library_grpc_service_config.json",
+- importpath = "google.golang.org/google/maps/routing/v2;routing",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "routes_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":routing_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "routing_go_gapic_test",
+- srcs = [":routing_go_gapic_srcjar_test"],
+- embed = [":routing_go_gapic"],
+- importpath = "google.golang.org/google/maps/routing/v2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-maps-routing-v2-go",
+- deps = [
+- ":routing_go_gapic",
+- ":routing_go_gapic_srcjar-metadata.srcjar",
+- ":routing_go_gapic_srcjar-test.srcjar",
+- ":routing_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "routing_py_gapic",
+- srcs = [":routing_proto"],
+- grpc_service_config = "library_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "routes_v2.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/geo/type:viewport_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "routing_py_gapic_test",
+- srcs = [
+- "routing_py_gapic_pytest.py",
+- "routing_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":routing_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "maps-routing-v2-py",
+- deps = [
+- ":routing_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "routing_php_proto",
+- deps = [":routing_proto"],
+-)
+-
+-php_grpc_library(
+- name = "routing_php_grpc",
+- srcs = [":routing_proto"],
+- deps = [":routing_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "routing_php_gapic",
+- srcs = [":routing_proto_with_info"],
+- grpc_service_config = "library_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "routes_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":routing_php_grpc",
+- ":routing_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-maps-routing-v2-php",
+- deps = [
+- ":routing_php_gapic",
+- ":routing_php_grpc",
+- ":routing_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "routing_nodejs_gapic",
+- package_name = "@googlemaps/routing",
+- src = ":routing_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "library_grpc_service_config.json",
+- package = "google.maps.routing.v2",
+- rest_numeric_enums = False,
+- service_yaml = "routes_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "maps-routing-v2-nodejs",
+- deps = [
+- ":routing_nodejs_gapic",
+- ":routing_proto",
+- "//google/geo/type:viewport_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "routing_ruby_proto",
+- deps = [":routing_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "routing_ruby_grpc",
+- srcs = [":routing_proto"],
+- deps = [":routing_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "routing_ruby_gapic",
+- srcs = [":routing_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=routes.googleapis.com",
+- "ruby-cloud-api-shortname=routes",
+- "ruby-cloud-gem-name=google-maps-routing-v2",
+- "ruby-cloud-product-url=https://developers.google.com/maps/documentation/",
+- ],
+- grpc_service_config = "library_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Routing includes the process of calculating a path along the road network, complete with an Estimated Time of Arrival (ETA).",
+- ruby_cloud_title = "Routes V2",
+- service_yaml = "routes_v2.yaml",
+- deps = [
+- ":routing_ruby_grpc",
+- ":routing_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-maps-routing-v2-ruby",
+- deps = [
+- ":routing_ruby_gapic",
+- ":routing_ruby_grpc",
+- ":routing_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "routing_csharp_proto",
+- deps = [":routing_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "routing_csharp_grpc",
+- srcs = [":routing_proto"],
+- deps = [":routing_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "routing_csharp_gapic",
+- srcs = [":routing_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "library_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "routes_v2.yaml",
+- deps = [
+- ":routing_csharp_grpc",
+- ":routing_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-maps-routing-v2-csharp",
+- deps = [
+- ":routing_csharp_gapic",
+- ":routing_csharp_grpc",
+- ":routing_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "routing_cc_proto",
+- deps = [":routing_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "routing_cc_grpc",
+- srcs = [":routing_proto"],
+- grpc_only = True,
+- deps = [":routing_cc_proto"],
+-)
+diff -urN a/google/maps/unity/BUILD.bazel b/google/maps/unity/BUILD.bazel
+--- a/google/maps/unity/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/maps/unity/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,129 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "clientinfo_proto",
+- srcs = [
+- "clientinfo.proto",
+- ],
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "clientinfo_java_proto",
+- deps = [":clientinfo_proto"],
+-)
+-
+-java_grpc_library(
+- name = "clientinfo_java_grpc",
+- srcs = [":clientinfo_proto"],
+- deps = [":clientinfo_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "clientinfo_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/maps/unity",
+- protos = [":clientinfo_proto"],
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "clientinfo_php_proto",
+- deps = [":clientinfo_proto"],
+-)
+-
+-php_grpc_library(
+- name = "clientinfo_php_grpc",
+- srcs = [":clientinfo_proto"],
+- deps = [":clientinfo_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "clientinfo_ruby_proto",
+- deps = [":clientinfo_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "clientinfo_ruby_grpc",
+- srcs = [":clientinfo_proto"],
+- deps = [":clientinfo_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "clientinfo_csharp_proto",
+- deps = [":clientinfo_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "clientinfo_csharp_grpc",
+- srcs = [":clientinfo_proto"],
+- deps = [":clientinfo_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/monitoring/BUILD.bazel b/google/monitoring/BUILD.bazel
+--- a/google/monitoring/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/monitoring/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-monitoring.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for monitoring.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v3 in this case.
+-ruby_cloud_gapic_library(
+- name = "monitoring_ruby_wrapper",
+- srcs = ["//google/monitoring/v3:monitoring_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-monitoring",
+- "ruby-cloud-env-prefix=MONITORING",
+- "ruby-cloud-wrapper-of=v3:0.4",
+- "ruby-cloud-product-url=https://cloud.google.com/monitoring",
+- "ruby-cloud-api-id=monitoring.googleapis.com",
+- "ruby-cloud-api-shortname=monitoring",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "Cloud Monitoring collects metrics, events, and metadata from Google Cloud, Amazon Web Services (AWS), hosted uptime probes, and application instrumentation.",
+- ruby_cloud_title = "Cloud Monitoring",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-monitoring-ruby",
+- deps = [
+- ":monitoring_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/monitoring/dashboard/BUILD.bazel b/google/monitoring/dashboard/BUILD.bazel
+--- a/google/monitoring/dashboard/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/monitoring/dashboard/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-monitoring-dashboard.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for monitoring.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "dashboard_ruby_wrapper",
+- srcs = ["//google/monitoring/dashboard/v1:dashboard_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-monitoring-dashboard",
+- "ruby-cloud-env-prefix=MONITORING",
+- "ruby-cloud-wrapper-of=v1:0.5",
+- "ruby-cloud-product-url=https://cloud.google.com/monitoring",
+- "ruby-cloud-api-id=monitoring.googleapis.com",
+- "ruby-cloud-api-shortname=monitoring",
+- ],
+- ruby_cloud_description = "Cloud Monitoring collects metrics, events, and metadata from Google Cloud, Amazon Web Services (AWS), hosted uptime probes, and application instrumentation.",
+- ruby_cloud_title = "Cloud Monitoring Dashboard",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-monitoring-dashboard-ruby",
+- deps = [
+- ":dashboard_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/monitoring/dashboard/v1/BUILD.bazel b/google/monitoring/dashboard/v1/BUILD.bazel
+--- a/google/monitoring/dashboard/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/monitoring/dashboard/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,360 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "dashboard_proto",
+- srcs = [
+- "alertchart.proto",
+- "collapsible_group.proto",
+- "common.proto",
+- "dashboard.proto",
+- "dashboard_filter.proto",
+- "dashboards_service.proto",
+- "drilldowns.proto",
+- "layouts.proto",
+- "logs_panel.proto",
+- "metrics.proto",
+- "scorecard.proto",
+- "service.proto",
+- "table.proto",
+- "table_display_options.proto",
+- "text.proto",
+- "widget.proto",
+- "xychart.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "dashboard_proto_with_info",
+- deps = [
+- ":dashboard_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "dashboard_java_proto",
+- deps = [":dashboard_proto"],
+-)
+-
+-java_grpc_library(
+- name = "dashboard_java_grpc",
+- srcs = [":dashboard_proto"],
+- deps = [":dashboard_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "dashboard_java_gapic",
+- srcs = [":dashboard_proto_with_info"],
+- gapic_yaml = "monitoring_gapic.yaml",
+- grpc_service_config = "dashboards_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- test_deps = [
+- ":dashboard_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":dashboard_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "dashboard_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.monitoring.dashboard.v1.DashboardsServiceClientHttpJsonTest",
+- "com.google.cloud.monitoring.dashboard.v1.DashboardsServiceClientTest",
+- ],
+- runtime_deps = [":dashboard_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-monitoring-dashboard-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":dashboard_java_gapic",
+- ":dashboard_java_grpc",
+- ":dashboard_java_proto",
+- ":dashboard_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "dashboard_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/monitoring/dashboard/v1",
+- protos = [":dashboard_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "dashboard_go_gapic",
+- srcs = [":dashboard_proto_with_info"],
+- grpc_service_config = "dashboards_grpc_service_config.json",
+- importpath = "cloud.google.com/go/monitoring/dashboard/apiv1;dashboard",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dashboard_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "dashboard_go_gapic_test",
+- srcs = [":dashboard_go_gapic_srcjar_test"],
+- embed = [":dashboard_go_gapic"],
+- importpath = "cloud.google.com/go/monitoring/dashboard/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-monitoring-dashboard-v1-go",
+- deps = [
+- ":dashboard_go_gapic",
+- ":dashboard_go_gapic_srcjar-metadata.srcjar",
+- ":dashboard_go_gapic_srcjar-test.srcjar",
+- ":dashboard_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "dashboard_py_gapic",
+- srcs = [":dashboard_proto"],
+- grpc_service_config = "dashboards_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+- opt_args = [
+- "warehouse-package-name=google-cloud-monitoring-dashboards",
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=monitoring_dashboard",
+- ],
+-)
+-
+-py_test(
+- name = "dashboard_py_gapic_test",
+- srcs = [
+- "dashboard_py_gapic_pytest.py",
+- "dashboard_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":dashboard_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "monitoring-dashboard-v1-py",
+- deps = [
+- ":dashboard_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "dashboard_php_proto",
+- deps = [":dashboard_proto"],
+-)
+-
+-php_grpc_library(
+- name = "dashboard_php_grpc",
+- srcs = [":dashboard_proto"],
+- deps = [":dashboard_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "dashboard_php_gapic",
+- srcs = [":dashboard_proto_with_info"],
+- grpc_service_config = "dashboards_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dashboard_php_grpc",
+- ":dashboard_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-monitoring-dashboard-v1-php",
+- deps = [
+- ":dashboard_php_gapic",
+- ":dashboard_php_grpc",
+- ":dashboard_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "dashboard_nodejs_gapic",
+- package_name = "@google-cloud/monitoring-dashboards",
+- src = ":dashboard_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "dashboards_grpc_service_config.json",
+- package = "google.monitoring.dashboard.v1",
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "monitoring-dashboard-v1-nodejs",
+- deps = [
+- ":dashboard_nodejs_gapic",
+- ":dashboard_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "dashboard_ruby_proto",
+- deps = [":dashboard_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "dashboard_ruby_grpc",
+- srcs = [":dashboard_proto"],
+- deps = [":dashboard_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "dashboard_ruby_gapic",
+- srcs = [":dashboard_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=monitoring.googleapis.com",
+- "ruby-cloud-api-shortname=monitoring",
+- "ruby-cloud-env-prefix=MONITORING_DASHBOARD",
+- "ruby-cloud-gem-name=google-cloud-monitoring-dashboard-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/monitoring",
+- "ruby-cloud-wrapper-gem-override=google-cloud-monitoring",
+- ],
+- grpc_service_config = "dashboards_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Monitoring collects metrics, events, and metadata from Google Cloud, Amazon Web Services (AWS), hosted uptime probes, and application instrumentation. The Dashboards API manages arrangements of display widgets.",
+- ruby_cloud_title = "Cloud Monitoring Dashboards V1",
+- service_yaml = "monitoring.yaml",
+- deps = [
+- ":dashboard_ruby_grpc",
+- ":dashboard_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-monitoring-dashboard-v1-ruby",
+- deps = [
+- ":dashboard_ruby_gapic",
+- ":dashboard_ruby_grpc",
+- ":dashboard_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "dashboard_csharp_proto",
+- deps = [":dashboard_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "dashboard_csharp_grpc",
+- srcs = [":dashboard_proto"],
+- deps = [":dashboard_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "dashboard_csharp_gapic",
+- srcs = [":dashboard_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "dashboards_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- deps = [
+- ":dashboard_csharp_grpc",
+- ":dashboard_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-monitoring-dashboard-v1-csharp",
+- deps = [
+- ":dashboard_csharp_gapic",
+- ":dashboard_csharp_grpc",
+- ":dashboard_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "dashboard_cc_proto",
+- deps = [":dashboard_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "dashboard_cc_grpc",
+- srcs = [":dashboard_proto"],
+- grpc_only = True,
+- deps = [":dashboard_cc_proto"],
+-)
+diff -urN a/google/monitoring/metricsscope/BUILD.bazel b/google/monitoring/metricsscope/BUILD.bazel
+--- a/google/monitoring/metricsscope/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/monitoring/metricsscope/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-monitoring-metrics_scope.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for monitoring.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "metricsscope_ruby_wrapper",
+- srcs = ["//google/monitoring/metricsscope/v1:metricsscope_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-monitoring-metrics_scope",
+- "ruby-cloud-env-prefix=MONITORING",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://cloud.google.com/monitoring",
+- "ruby-cloud-api-id=monitoring.googleapis.com",
+- "ruby-cloud-api-shortname=monitoring",
+- ],
+- ruby_cloud_description = "Cloud Monitoring collects metrics, events, and metadata from Google Cloud, Amazon Web Services (AWS), hosted uptime probes, and application instrumentation.",
+- ruby_cloud_title = "Cloud Monitoring Metrics Scopes",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-monitoring-metricsscope-ruby",
+- deps = [
+- ":metricsscope_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/monitoring/metricsscope/v1/BUILD.bazel b/google/monitoring/metricsscope/v1/BUILD.bazel
+--- a/google/monitoring/metricsscope/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/monitoring/metricsscope/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,341 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "metricsscope_proto",
+- srcs = [
+- "metrics_scope.proto",
+- "metrics_scopes.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "metricsscope_proto_with_info",
+- deps = [
+- ":metricsscope_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "metricsscope_java_proto",
+- deps = [":metricsscope_proto"],
+-)
+-
+-java_grpc_library(
+- name = "metricsscope_java_grpc",
+- srcs = [":metricsscope_proto"],
+- deps = [":metricsscope_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "metricsscope_java_gapic",
+- srcs = [":metricsscope_proto_with_info"],
+- gapic_yaml = "monitoring_gapic.yaml",
+- grpc_service_config = "metricsscopes_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- test_deps = [
+- ":metricsscope_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":metricsscope_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "metricsscope_java_gapic_test_suite",
+- test_classes = [
+- "com.google.monitoring.metricsscope.v1.MetricsScopesClientTest",
+- ],
+- runtime_deps = [":metricsscope_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-monitoring-metricsscope-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":metricsscope_java_gapic",
+- ":metricsscope_java_grpc",
+- ":metricsscope_java_proto",
+- ":metricsscope_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "metricsscope_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/monitoring/metricsscope/v1",
+- protos = [":metricsscope_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "metricsscope_go_gapic",
+- srcs = [":metricsscope_proto_with_info"],
+- grpc_service_config = "metricsscopes_grpc_service_config.json",
+- importpath = "cloud.google.com/go/monitoring/metricsscope/apiv1;metricsscope",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- deps = [
+- ":metricsscope_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "metricsscope_go_gapic_test",
+- srcs = [":metricsscope_go_gapic_srcjar_test"],
+- embed = [":metricsscope_go_gapic"],
+- importpath = "cloud.google.com/go/monitoring/metricsscope/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-monitoring-metricsscope-v1-go",
+- deps = [
+- ":metricsscope_go_gapic",
+- ":metricsscope_go_gapic_srcjar-metadata.srcjar",
+- ":metricsscope_go_gapic_srcjar-test.srcjar",
+- ":metricsscope_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "metricsscope_py_gapic",
+- srcs = [":metricsscope_proto"],
+- grpc_service_config = "metricsscopes_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=monitoring_metrics_scope",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-monitoring-metrics-scopes",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "metricsscope_py_gapic_test",
+- srcs = [
+- "metricsscope_py_gapic_pytest.py",
+- "metricsscope_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":metricsscope_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "monitoring-metricsscope-v1-py",
+- deps = [
+- ":metricsscope_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "metricsscope_php_proto",
+- deps = [":metricsscope_proto"],
+-)
+-
+-php_grpc_library(
+- name = "metricsscope_php_grpc",
+- srcs = [":metricsscope_proto"],
+- deps = [":metricsscope_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "metricsscope_php_gapic",
+- srcs = [":metricsscope_proto_with_info"],
+- grpc_service_config = "metricsscopes_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":metricsscope_php_grpc",
+- ":metricsscope_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-monitoring-metricsscope-v1-php",
+- deps = [
+- ":metricsscope_php_gapic",
+- ":metricsscope_php_grpc",
+- ":metricsscope_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "metricsscope_nodejs_gapic",
+- package_name = "@google-cloud/metricsscope",
+- src = ":metricsscope_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "metricsscopes_grpc_service_config.json",
+- package = "google.monitoring.metricsscope.v1",
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "monitoring-metricsscope-v1-nodejs",
+- deps = [
+- ":metricsscope_nodejs_gapic",
+- ":metricsscope_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "metricsscope_ruby_proto",
+- deps = [":metricsscope_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "metricsscope_ruby_grpc",
+- srcs = [":metricsscope_proto"],
+- deps = [":metricsscope_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "metricsscope_ruby_gapic",
+- srcs = [":metricsscope_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=monitoring.googleapis.com",
+- "ruby-cloud-api-shortname=monitoring",
+- "ruby-cloud-gem-name=google-cloud-monitoring-metrics_scope-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/monitoring/settings/manage-api",
+- "ruby-cloud-wrapper-gem-override=google-cloud-monitoring",
+- ],
+- grpc_service_config = "metricsscopes_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Monitoring collects metrics, events, and metadata from Google Cloud, Amazon Web Services (AWS), hosted uptime probes, and application instrumentation. The Metrics Scopes API manages the list of monitored projects and accounts.",
+- ruby_cloud_title = "Cloud Monitoring Metrics Scopes V1",
+- deps = [
+- ":metricsscope_ruby_grpc",
+- ":metricsscope_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-monitoring-metricsscope-v1-ruby",
+- deps = [
+- ":metricsscope_ruby_gapic",
+- ":metricsscope_ruby_grpc",
+- ":metricsscope_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "metricsscope_csharp_proto",
+- deps = [":metricsscope_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "metricsscope_csharp_grpc",
+- srcs = [":metricsscope_proto"],
+- deps = [":metricsscope_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "metricsscope_csharp_gapic",
+- srcs = [":metricsscope_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "metricsscopes_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- deps = [
+- ":metricsscope_csharp_grpc",
+- ":metricsscope_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-monitoring-metricsscope-v1-csharp",
+- deps = [
+- ":metricsscope_csharp_gapic",
+- ":metricsscope_csharp_grpc",
+- ":metricsscope_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "metricsscope_cc_proto",
+- deps = [":metricsscope_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "metricsscope_cc_grpc",
+- srcs = [":metricsscope_proto"],
+- grpc_only = True,
+- deps = [":metricsscope_cc_proto"],
+-)
+diff -urN a/google/monitoring/v3/BUILD.bazel b/google/monitoring/v3/BUILD.bazel
+--- a/google/monitoring/v3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/monitoring/v3/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,383 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "monitoring_proto",
+- srcs = [
+- "alert.proto",
+- "alert_service.proto",
+- "common.proto",
+- "dropped_labels.proto",
+- "group.proto",
+- "group_service.proto",
+- "metric.proto",
+- "metric_service.proto",
+- "mutation_record.proto",
+- "notification.proto",
+- "notification_service.proto",
+- "query_service.proto",
+- "service.proto",
+- "service_service.proto",
+- "span_context.proto",
+- "uptime.proto",
+- "uptime_service.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:distribution_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:label_proto",
+- "//google/api:launch_stage_proto",
+- "//google/api:metric_proto",
+- "//google/api:monitored_resource_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:calendar_period_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "monitoring_proto_with_info",
+- deps = [
+- ":monitoring_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "monitoring_java_proto",
+- deps = [":monitoring_proto"],
+-)
+-
+-java_grpc_library(
+- name = "monitoring_java_grpc",
+- srcs = [":monitoring_proto"],
+- deps = [":monitoring_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "monitoring_java_gapic",
+- srcs = [":monitoring_proto_with_info"],
+- gapic_yaml = "monitoring_gapic.yaml",
+- grpc_service_config = "monitoring_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- test_deps = [
+- ":monitoring_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":monitoring_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "monitoring_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.monitoring.v3.AlertPolicyServiceClientTest",
+- "com.google.cloud.monitoring.v3.GroupServiceClientTest",
+- "com.google.cloud.monitoring.v3.MetricServiceClientTest",
+- "com.google.cloud.monitoring.v3.NotificationChannelServiceClientTest",
+- "com.google.cloud.monitoring.v3.QueryServiceClientTest",
+- "com.google.cloud.monitoring.v3.ServiceMonitoringServiceClientTest",
+- "com.google.cloud.monitoring.v3.UptimeCheckServiceClientTest",
+- ],
+- runtime_deps = [":monitoring_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-monitoring-v3-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":monitoring_java_gapic",
+- ":monitoring_java_grpc",
+- ":monitoring_java_proto",
+- ":monitoring_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "monitoring_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/monitoring/v3",
+- protos = [":monitoring_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:api_go_proto",
+- "//google/api:distribution_go_proto",
+- "//google/api:label_go_proto",
+- "//google/api:metric_go_proto",
+- "//google/api:monitoredres_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:calendar_period_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "monitoring_go_gapic",
+- srcs = [":monitoring_proto_with_info"],
+- grpc_service_config = "monitoring_grpc_service_config.json",
+- importpath = "cloud.google.com/go/monitoring/apiv3;monitoring",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- deps = [
+- ":monitoring_go_proto",
+- "//google/api:metric_go_proto",
+- "//google/api:monitoredres_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- "@io_bazel_rules_go//proto/wkt:struct_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "monitoring_go_gapic_test",
+- srcs = [":monitoring_go_gapic_srcjar_test"],
+- embed = [":monitoring_go_gapic"],
+- importpath = "cloud.google.com/go/monitoring/apiv3",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-monitoring-v3-go",
+- deps = [
+- ":monitoring_go_gapic",
+- ":monitoring_go_gapic_srcjar-metadata.srcjar",
+- ":monitoring_go_gapic_srcjar-test.srcjar",
+- ":monitoring_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "monitoring_py_gapic",
+- srcs = [":monitoring_proto"],
+- grpc_service_config = "monitoring_grpc_service_config.json",
+- opt_args = ["python-gapic-namespace=google.cloud"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1359 is fixed
+-#py_test(
+-# name = "monitoring_py_gapic_test",
+-# srcs = [
+-# "monitoring_py_gapic_pytest.py",
+-# "monitoring_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":monitoring_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "monitoring-v3-py",
+- deps = [
+- ":monitoring_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "monitoring_php_proto",
+- deps = [":monitoring_proto"],
+-)
+-
+-php_grpc_library(
+- name = "monitoring_php_grpc",
+- srcs = [":monitoring_proto"],
+- deps = [":monitoring_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "monitoring_php_gapic",
+- srcs = [":monitoring_proto_with_info"],
+- grpc_service_config = "monitoring_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":monitoring_php_grpc",
+- ":monitoring_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-monitoring-v3-php",
+- deps = [
+- ":monitoring_php_gapic",
+- ":monitoring_php_grpc",
+- ":monitoring_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "monitoring_nodejs_gapic",
+- package_name = "@google-cloud/monitoring",
+- src = ":monitoring_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "monitoring_grpc_service_config.json",
+- main_service = "monitoring",
+- package = "google.monitoring.v3",
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "monitoring-v3-nodejs",
+- deps = [
+- ":monitoring_nodejs_gapic",
+- ":monitoring_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "monitoring_ruby_proto",
+- deps = [":monitoring_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "monitoring_ruby_grpc",
+- srcs = [":monitoring_proto"],
+- deps = [":monitoring_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "monitoring_ruby_gapic",
+- srcs = [":monitoring_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=monitoring.googleapis.com",
+- "ruby-cloud-api-shortname=monitoring",
+- "ruby-cloud-env-prefix=MONITORING",
+- "ruby-cloud-gem-name=google-cloud-monitoring-v3",
+- "ruby-cloud-product-url=https://cloud.google.com/monitoring",
+- ],
+- grpc_service_config = "monitoring_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Monitoring collects metrics, events, and metadata from Google Cloud, Amazon Web Services (AWS), hosted uptime probes, and application instrumentation.",
+- ruby_cloud_title = "Cloud Monitoring V3",
+- deps = [
+- ":monitoring_ruby_grpc",
+- ":monitoring_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-monitoring-v3-ruby",
+- deps = [
+- ":monitoring_ruby_gapic",
+- ":monitoring_ruby_grpc",
+- ":monitoring_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "monitoring_csharp_proto",
+- deps = [":monitoring_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "monitoring_csharp_grpc",
+- srcs = [":monitoring_proto"],
+- deps = [":monitoring_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "monitoring_csharp_gapic",
+- srcs = [":monitoring_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "monitoring_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "monitoring.yaml",
+- deps = [
+- ":monitoring_csharp_grpc",
+- ":monitoring_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-monitoring-v3-csharp",
+- deps = [
+- ":monitoring_csharp_gapic",
+- ":monitoring_csharp_grpc",
+- ":monitoring_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "monitoring_cc_proto",
+- deps = [":monitoring_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "monitoring_cc_grpc",
+- srcs = [":monitoring_proto"],
+- generate_mocks = True,
+- grpc_only = True,
+- deps = [":monitoring_cc_proto"],
+-)
+diff -urN a/google/networking/trafficdirector/type/BUILD.bazel b/google/networking/trafficdirector/type/BUILD.bazel
+--- a/google/networking/trafficdirector/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/networking/trafficdirector/type/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,173 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "type_proto",
+- srcs = [
+- "traffic_director_log_entry.proto",
+- ],
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "type_java_proto",
+- deps = [":type_proto"],
+-)
+-
+-java_grpc_library(
+- name = "type_java_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "type_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/networking/trafficdirector/type",
+- protos = [":type_proto"],
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "type_moved_proto",
+- srcs = [":type_proto"],
+- deps = [
+- ],
+-)
+-
+-py_proto_library(
+- name = "type_py_proto",
+- deps = [":type_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "type_py_grpc",
+- srcs = [":type_moved_proto"],
+- deps = [":type_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "type_php_proto",
+- deps = [":type_proto"],
+-)
+-
+-php_grpc_library(
+- name = "type_php_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "type_ruby_proto",
+- deps = [":type_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "type_ruby_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "type_csharp_proto",
+- deps = [":type_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "type_csharp_grpc",
+- srcs = [":type_proto"],
+- deps = [":type_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "type_cc_proto",
+- deps = [":type_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "type_cc_grpc",
+- srcs = [":type_proto"],
+- grpc_only = True,
+- deps = [":type_cc_proto"],
+-)
+diff -urN a/google/partner/aistreams/v1alpha1/BUILD.bazel b/google/partner/aistreams/v1alpha1/BUILD.bazel
+--- a/google/partner/aistreams/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/partner/aistreams/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,324 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/gapic-generator/tree/master/rules_gapic/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "aistreams_proto",
+- srcs = [
+- "aistreams.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "aistreams_proto_with_info",
+- deps = [
+- ":aistreams_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "aistreams_java_proto",
+- deps = [":aistreams_proto"],
+-)
+-
+-java_grpc_library(
+- name = "aistreams_java_grpc",
+- srcs = [":aistreams_proto"],
+- deps = [":aistreams_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "aistreams_java_gapic",
+- srcs = [":aistreams_proto_with_info"],
+- grpc_service_config = "aistreams_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":aistreams_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":aistreams_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "aistreams_java_gapic_test_suite",
+- test_classes = [
+- "com.google.partner.aistreams.v1alpha1.AIStreamsClientHttpJsonTest",
+- "com.google.partner.aistreams.v1alpha1.AIStreamsClientTest",
+- ],
+- runtime_deps = [":aistreams_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-partner-aistreams-v1alpha1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":aistreams_java_gapic",
+- ":aistreams_java_grpc",
+- ":aistreams_java_proto",
+- ":aistreams_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "aistreams_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/partner/aistreams/v1alpha1",
+- protos = [":aistreams_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "aistreams_go_gapic",
+- srcs = [":aistreams_proto_with_info"],
+- grpc_service_config = "aistreams_grpc_service_config.json",
+- importpath = "cloud.google.com/go/partner/aistreams/apiv1alpha1;aistreams",
+- rest_numeric_enums = False,
+- service_yaml = "aistreams_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":aistreams_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "aistreams_go_gapic_test",
+- srcs = [":aistreams_go_gapic_srcjar_test"],
+- embed = [":aistreams_go_gapic"],
+- importpath = "cloud.google.com/go/partner/aistreams/apiv1alpha1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-partner-aistreams-v1alpha1-go",
+- deps = [
+- ":aistreams_go_gapic",
+- ":aistreams_go_gapic_srcjar-test.srcjar",
+- ":aistreams_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "aistreams_py_gapic",
+- srcs = [":aistreams_proto"],
+- grpc_service_config = "aistreams_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "aistreams_py_gapic_test",
+- srcs = [
+- "aistreams_py_gapic_pytest.py",
+- "aistreams_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":aistreams_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "partner-aistreams-v1alpha1-py",
+- deps = [
+- ":aistreams_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "aistreams_php_proto",
+- deps = [":aistreams_proto"],
+-)
+-
+-php_grpc_library(
+- name = "aistreams_php_grpc",
+- srcs = [":aistreams_proto"],
+- deps = [":aistreams_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "aistreams_php_gapic",
+- srcs = [":aistreams_proto_with_info"],
+- grpc_service_config = "aistreams_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "aistreams_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":aistreams_php_grpc",
+- ":aistreams_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-partner-aistreams-v1alpha1-php",
+- deps = [
+- ":aistreams_php_gapic",
+- ":aistreams_php_grpc",
+- ":aistreams_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "aistreams_nodejs_gapic",
+- src = ":aistreams_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "aistreams_grpc_service_config.json",
+- package = "google.partner.aistreams.v1alpha1",
+- rest_numeric_enums = False,
+- service_yaml = "aistreams_v1alpha1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "partner-aistreams-v1alpha1-nodejs",
+- deps = [
+- ":aistreams_nodejs_gapic",
+- ":aistreams_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "aistreams_ruby_proto",
+- deps = [":aistreams_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "aistreams_ruby_grpc",
+- srcs = [":aistreams_proto"],
+- deps = [":aistreams_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "aistreams_ruby_gapic",
+- srcs = [":aistreams_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-aistreams-v1alpha1"],
+- grpc_service_config = "aistreams_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":aistreams_ruby_grpc",
+- ":aistreams_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-partner-aistreams-v1alpha1-ruby",
+- deps = [
+- ":aistreams_ruby_gapic",
+- ":aistreams_ruby_grpc",
+- ":aistreams_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "aistreams_csharp_proto",
+- deps = [":aistreams_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "aistreams_csharp_grpc",
+- srcs = [":aistreams_proto"],
+- deps = [":aistreams_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "aistreams_csharp_gapic",
+- srcs = [":aistreams_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "aistreams_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "aistreams_v1alpha1.yaml",
+- deps = [
+- ":aistreams_csharp_grpc",
+- ":aistreams_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-partner-aistreams-v1alpha1-csharp",
+- deps = [
+- ":aistreams_csharp_gapic",
+- ":aistreams_csharp_grpc",
+- ":aistreams_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "aistreams_cc_proto",
+- deps = [":aistreams_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "aistreams_cc_grpc",
+- srcs = [":aistreams_proto"],
+- grpc_only = True,
+- deps = [":aistreams_cc_proto"],
+-)
+diff -urN a/google/privacy/dlp/BUILD.bazel b/google/privacy/dlp/BUILD.bazel
+--- a/google/privacy/dlp/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/privacy/dlp/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,41 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-dlp.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for dlp.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v2 in this case.
+-ruby_cloud_gapic_library(
+- name = "dlp_ruby_wrapper",
+- srcs = ["//google/privacy/dlp/v2:dlp_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-dlp",
+- "ruby-cloud-env-prefix=DLP",
+- "ruby-cloud-wrapper-of=v2:0.2",
+- "ruby-cloud-product-url=https://cloud.google.com/dlp",
+- "ruby-cloud-api-id=dlp.googleapis.com",
+- "ruby-cloud-api-shortname=dlp",
+- "ruby-cloud-migration-version=1.0",
+- ],
+- ruby_cloud_description = "Provides methods for detection of privacy-sensitive fragments in text, images, and Google Cloud Platform storage repositories.",
+- ruby_cloud_title = "Cloud Data Loss Prevention (DLP)",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-dlp-ruby",
+- deps = [
+- ":dlp_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/privacy/dlp/v2/BUILD.bazel b/google/privacy/dlp/v2/BUILD.bazel
+--- a/google/privacy/dlp/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/privacy/dlp/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,331 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "dlp_proto",
+- srcs = [
+- "dlp.proto",
+- "storage.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "//google/type:date_proto",
+- "//google/type:dayofweek_proto",
+- "//google/type:timeofday_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "dlp_proto_with_info",
+- deps = [
+- ":dlp_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "dlp_java_proto",
+- deps = [":dlp_proto"],
+-)
+-
+-java_grpc_library(
+- name = "dlp_java_grpc",
+- srcs = [":dlp_proto"],
+- deps = [":dlp_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "dlp_java_gapic",
+- srcs = [":dlp_proto_with_info"],
+- gapic_yaml = "dlp_gapic.yaml",
+- grpc_service_config = "dlp_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":dlp_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":dlp_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "dlp_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.dlp.v2.DlpServiceClientHttpJsonTest",
+- "com.google.cloud.dlp.v2.DlpServiceClientTest",
+- ],
+- runtime_deps = [":dlp_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-privacy-dlp-v2-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":dlp_java_gapic",
+- ":dlp_java_grpc",
+- ":dlp_java_proto",
+- ":dlp_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "dlp_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/privacy/dlp/v2",
+- protos = [":dlp_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:date_go_proto",
+- "//google/type:dayofweek_go_proto",
+- "//google/type:timeofday_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "dlp_go_gapic",
+- srcs = [":dlp_proto_with_info"],
+- grpc_service_config = "dlp_grpc_service_config.json",
+- importpath = "cloud.google.com/go/dlp/apiv2;dlp",
+- rest_numeric_enums = False,
+- service_yaml = "dlp_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":dlp_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "dlp_go_gapic_test",
+- srcs = [":dlp_go_gapic_srcjar_test"],
+- embed = [":dlp_go_gapic"],
+- importpath = "cloud.google.com/go/dlp/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-privacy-dlp-v2-go",
+- deps = [
+- ":dlp_go_gapic",
+- ":dlp_go_gapic_srcjar-test.srcjar",
+- ":dlp_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "dlp_py_gapic",
+- srcs = [":dlp_proto"],
+- grpc_service_config = "dlp_grpc_service_config.json",
+- opt_args = ["python-gapic-namespace=google.cloud"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "dlp_py_gapic_test",
+- srcs = [
+- "dlp_py_gapic_pytest.py",
+- "dlp_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":dlp_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "privacy-dlp-v2-py",
+- deps = [
+- ":dlp_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "dlp_php_proto",
+- deps = [":dlp_proto"],
+-)
+-
+-php_grpc_library(
+- name = "dlp_php_grpc",
+- srcs = [":dlp_proto"],
+- deps = [":dlp_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "dlp_php_gapic",
+- srcs = [":dlp_proto_with_info"],
+- grpc_service_config = "dlp_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc+rest",
+- deps = [
+- ":dlp_php_grpc",
+- ":dlp_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-privacy-dlp-v2-php",
+- deps = [
+- ":dlp_php_gapic",
+- ":dlp_php_grpc",
+- ":dlp_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "dlp_nodejs_gapic",
+- package_name = "@google-cloud/dlp",
+- src = ":dlp_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "dlp_grpc_service_config.json",
+- package = "google.privacy.dlp.v2",
+- rest_numeric_enums = False,
+- service_yaml = "dlp_v2.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "privacy-dlp-v2-nodejs",
+- deps = [
+- ":dlp_nodejs_gapic",
+- ":dlp_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "dlp_ruby_proto",
+- deps = [":dlp_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "dlp_ruby_grpc",
+- srcs = [":dlp_proto"],
+- deps = [":dlp_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "dlp_ruby_gapic",
+- srcs = [":dlp_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-dlp-v2",
+- "ruby-cloud-env-prefix=DLP",
+- "ruby-cloud-product-url=https://cloud.google.com/dlp",
+- "ruby-cloud-api-id=dlp.googleapis.com",
+- "ruby-cloud-api-shortname=dlp",
+- ],
+- grpc_service_config = "dlp_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Provides methods for detection of privacy-sensitive fragments in text, images, and Google Cloud Platform storage repositories.",
+- ruby_cloud_title = "Cloud Data Loss Prevention (DLP) V2",
+- deps = [
+- ":dlp_ruby_grpc",
+- ":dlp_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-privacy-dlp-v2-ruby",
+- deps = [
+- ":dlp_ruby_gapic",
+- ":dlp_ruby_grpc",
+- ":dlp_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "dlp_csharp_proto",
+- deps = [":dlp_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "dlp_csharp_grpc",
+- srcs = [":dlp_proto"],
+- deps = [":dlp_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "dlp_csharp_gapic",
+- srcs = [":dlp_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "dlp_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "dlp_v2.yaml",
+- deps = [
+- ":dlp_csharp_grpc",
+- ":dlp_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-privacy-dlp-v2-csharp",
+- deps = [
+- ":dlp_csharp_gapic",
+- ":dlp_csharp_grpc",
+- ":dlp_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "dlp_cc_proto",
+- deps = [":dlp_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "dlp_cc_grpc",
+- srcs = [":dlp_proto"],
+- grpc_only = True,
+- deps = [":dlp_cc_proto"],
+-)
+diff -urN a/google/pubsub/BUILD.bazel b/google/pubsub/BUILD.bazel
+--- a/google/pubsub/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/pubsub/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/pubsub/v1/BUILD.bazel b/google/pubsub/v1/BUILD.bazel
+--- a/google/pubsub/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/pubsub/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,393 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "pubsub_proto",
+- srcs = [
+- "pubsub.proto",
+- "schema.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "pubsub_proto_with_info",
+- deps = [
+- ":pubsub_proto",
+- "//google/cloud:common_resources_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "pubsub_java_proto",
+- deps = [":pubsub_proto"],
+-)
+-
+-java_grpc_library(
+- name = "pubsub_java_grpc",
+- srcs = [":pubsub_proto"],
+- deps = [":pubsub_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "pubsub_java_gapic",
+- srcs = [":pubsub_proto_with_info"],
+- gapic_yaml = "pubsub_gapic.yaml",
+- grpc_service_config = "pubsub_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = ":pubsub_v1.yaml",
+- test_deps = [
+- ":pubsub_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":pubsub_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "pubsub_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.pubsub.v1.SubscriptionAdminClientHttpJsonTest",
+- "com.google.cloud.pubsub.v1.SubscriptionAdminClientTest",
+- "com.google.cloud.pubsub.v1.TopicAdminClientHttpJsonTest",
+- "com.google.cloud.pubsub.v1.TopicAdminClientTest",
+- ],
+- runtime_deps = [":pubsub_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-pubsub-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":pubsub_java_gapic",
+- ":pubsub_java_grpc",
+- ":pubsub_java_proto",
+- ":pubsub_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "pubsub_py_gapic",
+- srcs = [":pubsub_proto"],
+- grpc_service_config = "pubsub_grpc_service_config.json",
+- opt_args = [
+- "warehouse-package-name=google-cloud-pubsub",
+- "add-iam-methods",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "pubsub_py_gapic_test",
+- srcs = [
+- "pubsub_py_gapic_pytest.py",
+- "pubsub_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":pubsub_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "pubsub-v1-py",
+- deps = [
+- ":pubsub_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "pubsub_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/pubsub/v1",
+- protos = [":pubsub_proto"],
+- deps = ["//google/api:annotations_go_proto"],
+-)
+-
+-go_gapic_library(
+- name = "pubsub_go_gapic",
+- srcs = [":pubsub_proto_with_info"],
+- grpc_service_config = "pubsub_grpc_service_config.json",
+- importpath = "cloud.google.com/go/pubsub/apiv1;pubsub",
+- rest_numeric_enums = False,
+- service_yaml = ":pubsub_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":pubsub_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "pubsub_go_gapic_test",
+- srcs = [":pubsub_go_gapic_srcjar_test"],
+- embed = [":pubsub_go_gapic"],
+- importpath = "cloud.google.com/go/pubsub/apiv1",
+- deps = ["//google/iam/v1:iam_go_proto"],
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-pubsub-v1-go",
+- deps = [
+- ":pubsub_go_gapic",
+- ":pubsub_go_gapic_srcjar-test.srcjar",
+- ":pubsub_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "pubsub_php_proto",
+- deps = [":pubsub_proto"],
+-)
+-
+-php_grpc_library(
+- name = "pubsub_php_grpc",
+- srcs = [":pubsub_proto"],
+- deps = [":pubsub_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "pubsub_php_gapic",
+- srcs = [":pubsub_proto_with_info"],
+- gapic_yaml = "pubsub_gapic.yaml",
+- grpc_service_config = "pubsub_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = ":pubsub_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":pubsub_php_grpc",
+- ":pubsub_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-pubsub-v1-php",
+- deps = [
+- ":pubsub_php_gapic",
+- ":pubsub_php_grpc",
+- ":pubsub_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "pubsub_nodejs_gapic",
+- package_name = "@google-cloud/pubsub",
+- src = ":pubsub_proto_with_info",
+- bundle_config = "pubsub_gapic.yaml",
+- extra_protoc_parameters = ["template=typescript_gapic"],
+- grpc_service_config = "pubsub_grpc_service_config.json",
+- handwritten_layer = True,
+- main_service = "pubsub",
+- rest_numeric_enums = False,
+- service_yaml = ":pubsub_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "pubsub-v1-nodejs",
+- deps = [
+- ":pubsub_nodejs_gapic",
+- ":pubsub_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "pubsub_ruby_proto",
+- deps = [":pubsub_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "pubsub_ruby_grpc",
+- srcs = [":pubsub_proto"],
+- deps = [":pubsub_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "pubsub_ruby_gapic",
+- srcs = [":pubsub_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-pubsub-v1",
+- "ruby-cloud-env-prefix=PUBSUB",
+- "ruby-cloud-path-override=pub_sub=pubsub",
+- "ruby-cloud-namespace-override=Pubsub=PubSub",
+- "ruby-cloud-product-url=https://cloud.google.com/pubsub",
+- "ruby-cloud-api-id=pubsub.googleapis.com",
+- "ruby-cloud-api-shortname=pubsub",
+- ],
+- grpc_service_config = "pubsub_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Pub/Sub is a fully-managed real-time messaging service that allows you to send and receive messages between independent applications.",
+- ruby_cloud_title = "Cloud Pub/Sub V1",
+- service_yaml = ":pubsub_v1.yaml",
+- deps = [
+- ":pubsub_ruby_grpc",
+- ":pubsub_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-pubsub-v1-ruby",
+- deps = [
+- ":pubsub_ruby_gapic",
+- ":pubsub_ruby_grpc",
+- ":pubsub_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "pubsub_csharp_proto",
+- deps = [":pubsub_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "pubsub_csharp_grpc",
+- srcs = [":pubsub_proto"],
+- deps = [":pubsub_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "pubsub_csharp_gapic",
+- srcs = [":pubsub_proto_with_info"],
+- grpc_service_config = "pubsub_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = ":pubsub_v1.yaml",
+- deps = [
+- ":pubsub_csharp_grpc",
+- ":pubsub_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-pubsub-v1-csharp",
+- deps = [
+- ":pubsub_csharp_gapic",
+- ":pubsub_csharp_grpc",
+- ":pubsub_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "pubsub_cc_proto",
+- deps = [":pubsub_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "pubsub_cc_grpc",
+- srcs = [":pubsub_proto"],
+- grpc_only = True,
+- deps = [":pubsub_cc_proto"],
+-)
+diff -urN a/google/rpc/BUILD.bazel b/google/rpc/BUILD.bazel
+--- a/google/rpc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/rpc/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,127 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-proto_library(
+- name = "code_proto",
+- srcs = ["code.proto"],
+- deps = [],
+-)
+-
+-proto_library(
+- name = "error_details_proto",
+- srcs = ["error_details.proto"],
+- deps = [
+- "@com_google_protobuf//:duration_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "status_proto",
+- srcs = ["status.proto"],
+- deps = [
+- "@com_google_protobuf//:any_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "rpc_java_proto",
+- deps = [
+- ":code_proto",
+- ":error_details_proto",
+- ":status_proto",
+- ],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-rpc-java",
+- transport = "grpc+rest",
+- deps = [
+- "error_details_proto",
+- "status_proto",
+- ":code_proto",
+- ":rpc_java_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "code_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/rpc/code",
+- protos = [":code_proto"],
+-)
+-
+-go_proto_library(
+- name = "errdetails_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/rpc/errdetails",
+- protos = [":error_details_proto"],
+-)
+-
+-go_proto_library(
+- name = "status_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/rpc/status",
+- protos = [":status_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "code_cc_proto",
+- deps = [":code_proto"],
+-)
+-
+-cc_proto_library(
+- name = "error_details_cc_proto",
+- deps = [":error_details_proto"],
+-)
+-
+-cc_proto_library(
+- name = "status_cc_proto",
+- deps = [":status_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "py_proto_library")
+-
+-py_proto_library(
+- name = "code_py_proto",
+- deps = [":code_proto"],
+-)
+-
+-py_proto_library(
+- name = "error_details_py_proto",
+- deps = [":error_details_proto"],
+-)
+-
+-py_proto_library(
+- name = "status_py_proto",
+- deps = [":status_proto"],
+-)
+diff -urN a/google/rpc/context/BUILD.bazel b/google/rpc/context/BUILD.bazel
+--- a/google/rpc/context/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/rpc/context/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,142 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "attribute_context_proto",
+- srcs = [
+- "attribute_context.proto",
+- ],
+- deps = [
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "attribute_context_java_proto",
+- deps = [":attribute_context_proto"],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-context-java",
+- transport = "grpc+rest",
+- deps = [
+- ":attribute_context_java_proto",
+- ":attribute_context_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "attribute_context_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/rpc/context/attribute_context",
+- protos = [":attribute_context_proto"],
+- deps = [
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "attribute_context_moved_proto",
+- srcs = [":attribute_context_proto"],
+- deps = [
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "attribute_context_py_proto",
+- deps = [":attribute_context_moved_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "attribute_context_php_proto",
+- deps = [":attribute_context_proto"],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "attribute_context_ruby_proto",
+- deps = [":attribute_context_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "attribute_context_csharp_proto",
+- deps = [":attribute_context_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "attribute_context_cc_proto",
+- deps = [":attribute_context_proto"],
+-)
+diff -urN a/google/search/partnerdataingestion/logging/v1/BUILD.bazel b/google/search/partnerdataingestion/logging/v1/BUILD.bazel
+--- a/google/search/partnerdataingestion/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/search/partnerdataingestion/logging/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,155 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "platformlog.proto",
+- ],
+- deps = [],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/search/partnerdataingestion/logging/v1",
+- protos = [":logging_proto"],
+- deps = [],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-# Put your C++ code here
+diff -urN a/google/spanner/BUILD.bazel b/google/spanner/BUILD.bazel
+--- a/google/spanner/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/spanner/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/spanner/admin/database/BUILD.bazel b/google/spanner/admin/database/BUILD.bazel
+--- a/google/spanner/admin/database/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/spanner/admin/database/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/spanner/admin/database/v1/BUILD.bazel b/google/spanner/admin/database/v1/BUILD.bazel
+--- a/google/spanner/admin/database/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/spanner/admin/database/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,359 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "database_proto",
+- srcs = [
+- "backup.proto",
+- "common.proto",
+- "spanner_database_admin.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "database_proto_with_info",
+- deps = [
+- ":database_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "database_java_proto",
+- deps = [":database_proto"],
+-)
+-
+-java_grpc_library(
+- name = "database_java_grpc",
+- srcs = [":database_proto"],
+- deps = [":database_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "database_java_gapic",
+- srcs = [":database_proto_with_info"],
+- gapic_yaml = "spanner_admin_database_gapic.yaml",
+- grpc_service_config = "spanner_admin_database_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "spanner.yaml",
+- test_deps = [
+- ":database_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":database_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "database_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.spanner.admin.database.v1.DatabaseAdminClientHttpJsonTest",
+- "com.google.cloud.spanner.admin.database.v1.DatabaseAdminClientTest",
+- ],
+- runtime_deps = [":database_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-admin-database-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":database_java_gapic",
+- ":database_java_grpc",
+- ":database_java_proto",
+- ":database_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "database_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/spanner/admin/database/v1",
+- protos = [":database_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "database_go_gapic",
+- srcs = [":database_proto_with_info"],
+- grpc_service_config = "spanner_admin_database_grpc_service_config.json",
+- importpath = "cloud.google.com/go/spanner/admin/database/apiv1;database",
+- rest_numeric_enums = False,
+- service_yaml = "spanner.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":database_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "database_go_gapic_test",
+- srcs = [":database_go_gapic_srcjar_test"],
+- embed = [":database_go_gapic"],
+- importpath = "cloud.google.com/go/spanner/admin/database/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-admin-database-v1-go",
+- deps = [
+- ":database_go_gapic",
+- ":database_go_gapic_srcjar-test.srcjar",
+- ":database_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "database_py_gapic",
+- srcs = [":database_proto"],
+- grpc_service_config = "spanner_admin_database_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=spanner_admin_database",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "spanner.yaml",
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "database_py_gapic_test",
+- srcs = [
+- "database_py_gapic_pytest.py",
+- "database_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":database_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "admin-database-v1-py",
+- deps = [
+- ":database_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "database_php_proto",
+- deps = [":database_proto"],
+-)
+-
+-php_grpc_library(
+- name = "database_php_grpc",
+- srcs = [":database_proto"],
+- deps = [":database_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "database_php_gapic",
+- srcs = [":database_proto_with_info"],
+- gapic_yaml = "spanner_admin_database_gapic.yaml",
+- grpc_service_config = "spanner_admin_database_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "spanner.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":database_php_grpc",
+- ":database_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-admin-database-v1-php",
+- deps = [
+- ":database_php_gapic",
+- ":database_php_grpc",
+- ":database_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "database_nodejs_gapic",
+- package_name = "@google-cloud/spanner",
+- src = ":database_proto_with_info",
+- extra_protoc_parameters = [
+- "metadata",
+- "template=typescript_gapic",
+- ],
+- grpc_service_config = "spanner_admin_database_grpc_service_config.json",
+- package = "google.spanner.admin.database.v1",
+- rest_numeric_enums = False,
+- service_yaml = "spanner.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "admin-database-v1-nodejs",
+- deps = [
+- ":database_nodejs_gapic",
+- ":database_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "database_ruby_proto",
+- deps = [":database_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "database_ruby_grpc",
+- srcs = [":database_proto"],
+- deps = [":database_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "database_ruby_gapic",
+- srcs = [":database_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-spanner-admin-database-v1",
+- "ruby-cloud-env-prefix=SPANNER",
+- "ruby-cloud-product-url=https://cloud.google.com/spanner",
+- "ruby-cloud-api-id=spanner.googleapis.com",
+- "ruby-cloud-api-shortname=spanner",
+- "ruby-cloud-wrapper-gem-override=google-cloud-spanner",
+- ],
+- grpc_service_config = "spanner_admin_database_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Spanner is a managed, mission-critical, globally consistent and scalable relational database service.",
+- ruby_cloud_title = "Cloud Spanner Database Admin V1",
+- service_yaml = "spanner.yaml",
+- deps = [
+- ":database_ruby_grpc",
+- ":database_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-admin-database-v1-ruby",
+- deps = [
+- ":database_ruby_gapic",
+- ":database_ruby_grpc",
+- ":database_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "database_csharp_proto",
+- deps = [":database_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "database_csharp_grpc",
+- srcs = [":database_proto"],
+- deps = [":database_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "database_csharp_gapic",
+- srcs = [":database_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "spanner_admin_database_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "spanner.yaml",
+- deps = [
+- ":database_csharp_grpc",
+- ":database_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-admin-database-v1-csharp",
+- deps = [
+- ":database_csharp_gapic",
+- ":database_csharp_grpc",
+- ":database_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "database_cc_proto",
+- deps = [":database_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "database_cc_grpc",
+- srcs = [":database_proto"],
+- grpc_only = True,
+- deps = [":database_cc_proto"],
+-)
+diff -urN a/google/spanner/admin/instance/BUILD.bazel b/google/spanner/admin/instance/BUILD.bazel
+--- a/google/spanner/admin/instance/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/spanner/admin/instance/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/spanner/admin/instance/v1/BUILD.bazel b/google/spanner/admin/instance/v1/BUILD.bazel
+--- a/google/spanner/admin/instance/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/spanner/admin/instance/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,344 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "instance_proto",
+- srcs = [
+- "common.proto",
+- "spanner_instance_admin.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/longrunning:operations_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "instance_proto_with_info",
+- deps = [
+- ":instance_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "instance_java_proto",
+- deps = [":instance_proto"],
+-)
+-
+-java_grpc_library(
+- name = "instance_java_grpc",
+- srcs = [":instance_proto"],
+- deps = [":instance_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "instance_java_gapic",
+- srcs = [":instance_proto_with_info"],
+- gapic_yaml = "spanner_admin_instance_gapic.yaml",
+- grpc_service_config = "spanner_admin_instance_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":instance_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":instance_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "instance_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.spanner.admin.instance.v1.InstanceAdminClientHttpJsonTest",
+- "com.google.cloud.spanner.admin.instance.v1.InstanceAdminClientTest",
+- ],
+- runtime_deps = [":instance_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-admin-instance-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":instance_java_gapic",
+- ":instance_java_grpc",
+- ":instance_java_proto",
+- ":instance_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "instance_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/spanner/admin/instance/v1",
+- protos = [":instance_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "instance_go_gapic",
+- srcs = [":instance_proto_with_info"],
+- grpc_service_config = "spanner_admin_instance_grpc_service_config.json",
+- importpath = "cloud.google.com/go/spanner/admin/instance/apiv1;instance",
+- rest_numeric_enums = False,
+- service_yaml = "spanner_admin_instance.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":instance_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- ],
+-)
+-
+-go_test(
+- name = "instance_go_gapic_test",
+- srcs = [":instance_go_gapic_srcjar_test"],
+- embed = [":instance_go_gapic"],
+- importpath = "cloud.google.com/go/spanner/admin/instance/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-admin-instance-v1-go",
+- deps = [
+- ":instance_go_gapic",
+- ":instance_go_gapic_srcjar-test.srcjar",
+- ":instance_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "instance_py_gapic",
+- srcs = [":instance_proto"],
+- grpc_service_config = "spanner_admin_instance_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=google.cloud",
+- "python-gapic-name=spanner_admin_instance",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- ],
+-)
+-
+-py_test(
+- name = "instance_py_gapic_test",
+- srcs = [
+- "instance_py_gapic_pytest.py",
+- "instance_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":instance_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "admin-instance-v1-py",
+- deps = [
+- ":instance_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "instance_php_proto",
+- deps = [":instance_proto"],
+-)
+-
+-php_grpc_library(
+- name = "instance_php_grpc",
+- srcs = [":instance_proto"],
+- deps = [":instance_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "instance_php_gapic",
+- srcs = [":instance_proto_with_info"],
+- gapic_yaml = "spanner_admin_instance_gapic.yaml",
+- grpc_service_config = "spanner_admin_instance_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "spanner_admin_instance.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":instance_php_grpc",
+- ":instance_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-admin-instance-v1-php",
+- deps = [
+- ":instance_php_gapic",
+- ":instance_php_grpc",
+- ":instance_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "instance_nodejs_gapic",
+- package_name = "@google-cloud/spanner",
+- src = ":instance_proto_with_info",
+- extra_protoc_parameters = [
+- "metadata",
+- "template=typescript_gapic",
+- ],
+- grpc_service_config = "spanner_admin_instance_grpc_service_config.json",
+- package = "google.spanner.admin.instance.v1",
+- rest_numeric_enums = False,
+- service_yaml = "spanner_admin_instance.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "admin-instance-v1-nodejs",
+- deps = [
+- ":instance_nodejs_gapic",
+- ":instance_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "instance_ruby_proto",
+- deps = [":instance_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "instance_ruby_grpc",
+- srcs = [":instance_proto"],
+- deps = [":instance_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "instance_ruby_gapic",
+- srcs = [":instance_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-spanner-admin-instance-v1",
+- "ruby-cloud-env-prefix=SPANNER",
+- "ruby-cloud-product-url=https://cloud.google.com/spanner",
+- "ruby-cloud-api-id=spanner.googleapis.com",
+- "ruby-cloud-api-shortname=spanner",
+- "ruby-cloud-wrapper-gem-override=google-cloud-spanner",
+- ],
+- grpc_service_config = "spanner_admin_instance_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Spanner is a managed, mission-critical, globally consistent and scalable relational database service.",
+- ruby_cloud_title = "Cloud Spanner Instance Admin V1",
+- deps = [
+- ":instance_ruby_grpc",
+- ":instance_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-admin-instance-v1-ruby",
+- deps = [
+- ":instance_ruby_gapic",
+- ":instance_ruby_grpc",
+- ":instance_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "instance_csharp_proto",
+- deps = [":instance_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "instance_csharp_grpc",
+- srcs = [":instance_proto"],
+- deps = [":instance_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "instance_csharp_gapic",
+- srcs = [":instance_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "spanner_admin_instance_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "spanner_admin_instance.yaml",
+- deps = [
+- ":instance_csharp_grpc",
+- ":instance_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-admin-instance-v1-csharp",
+- deps = [
+- ":instance_csharp_gapic",
+- ":instance_csharp_grpc",
+- ":instance_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "instance_cc_proto",
+- deps = [":instance_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "instance_cc_grpc",
+- srcs = [":instance_proto"],
+- grpc_only = True,
+- deps = [":instance_cc_proto"],
+-)
+diff -urN a/google/spanner/v1/BUILD.bazel b/google/spanner/v1/BUILD.bazel
+--- a/google/spanner/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/spanner/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,337 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "spanner_proto",
+- srcs = [
+- "commit_response.proto",
+- "keys.proto",
+- "mutation.proto",
+- "query_plan.proto",
+- "result_set.proto",
+- "spanner.proto",
+- "transaction.proto",
+- "type.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "spanner_proto_with_info",
+- deps = [
+- ":spanner_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "spanner_java_proto",
+- deps = [":spanner_proto"],
+-)
+-
+-java_grpc_library(
+- name = "spanner_java_grpc",
+- srcs = [":spanner_proto"],
+- deps = [":spanner_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "spanner_java_gapic",
+- srcs = [":spanner_proto_with_info"],
+- gapic_yaml = "spanner_gapic.yaml",
+- grpc_service_config = "spanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":spanner_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":spanner_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "spanner_java_gapic_test_suite",
+- test_classes = [
+- "com.google.cloud.spanner.v1.SpannerClientHttpJsonTest",
+- "com.google.cloud.spanner.v1.SpannerClientTest",
+- ],
+- runtime_deps = [":spanner_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-spanner-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":spanner_java_gapic",
+- ":spanner_java_grpc",
+- ":spanner_java_proto",
+- ":spanner_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "spanner_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/spanner/v1",
+- protos = [":spanner_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "spanner_go_gapic",
+- srcs = [":spanner_proto_with_info"],
+- grpc_service_config = "spanner_grpc_service_config.json",
+- importpath = "cloud.google.com/go/spanner/apiv1;spanner",
+- rest_numeric_enums = False,
+- service_yaml = "spanner.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":spanner_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "spanner_go_gapic_test",
+- srcs = [":spanner_go_gapic_srcjar_test"],
+- embed = [":spanner_go_gapic"],
+- importpath = "cloud.google.com/go/spanner/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-spanner-v1-go",
+- deps = [
+- ":spanner_go_gapic",
+- ":spanner_go_gapic_srcjar-test.srcjar",
+- ":spanner_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "spanner_py_gapic",
+- srcs = [":spanner_proto"],
+- grpc_service_config = "spanner_grpc_service_config.json",
+- opt_args = ["python-gapic-namespace=google.cloud"],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "spanner_py_gapic_test",
+- srcs = [
+- "spanner_py_gapic_pytest.py",
+- "spanner_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":spanner_py_gapic"],
+-)
+-
+-py_gapic_assembly_pkg(
+- name = "spanner-v1-py",
+- deps = [
+- ":spanner_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "spanner_php_proto",
+- deps = [":spanner_proto"],
+-)
+-
+-php_grpc_library(
+- name = "spanner_php_grpc",
+- srcs = [":spanner_proto"],
+- deps = [":spanner_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "spanner_php_gapic",
+- srcs = [":spanner_proto_with_info"],
+- grpc_service_config = "spanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "spanner.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":spanner_php_grpc",
+- ":spanner_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-spanner-v1-php",
+- deps = [
+- ":spanner_php_gapic",
+- ":spanner_php_grpc",
+- ":spanner_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "spanner_nodejs_gapic",
+- package_name = "@google-cloud/spanner",
+- src = ":spanner_proto_with_info",
+- extra_protoc_parameters = [
+- "metadata",
+- "template=typescript_gapic",
+- ],
+- grpc_service_config = "spanner_grpc_service_config.json",
+- handwritten_layer = True,
+- main_service = "spanner",
+- package = "google.spanner.v1",
+- rest_numeric_enums = False,
+- service_yaml = "spanner.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "spanner-v1-nodejs",
+- deps = [
+- ":spanner_nodejs_gapic",
+- ":spanner_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "spanner_ruby_proto",
+- deps = [":spanner_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "spanner_ruby_grpc",
+- srcs = [":spanner_proto"],
+- deps = [":spanner_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "spanner_ruby_gapic",
+- srcs = [":spanner_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-spanner-v1",
+- "ruby-cloud-env-prefix=SPANNER",
+- "ruby-cloud-product-url=https://cloud.google.com/spanner",
+- "ruby-cloud-api-id=spanner.googleapis.com",
+- "ruby-cloud-api-shortname=spanner",
+- ],
+- grpc_service_config = "spanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Cloud Spanner is a managed, mission-critical, globally consistent and scalable relational database service.",
+- ruby_cloud_title = "Cloud Spanner V1",
+- deps = [
+- ":spanner_ruby_grpc",
+- ":spanner_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-spanner-v1-ruby",
+- deps = [
+- ":spanner_ruby_gapic",
+- ":spanner_ruby_grpc",
+- ":spanner_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "spanner_csharp_proto",
+- deps = [":spanner_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "spanner_csharp_grpc",
+- srcs = [":spanner_proto"],
+- deps = [":spanner_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "spanner_csharp_gapic",
+- srcs = [":spanner_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "spanner_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "spanner.yaml",
+- deps = [
+- ":spanner_csharp_grpc",
+- ":spanner_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-spanner-v1-csharp",
+- deps = [
+- ":spanner_csharp_gapic",
+- ":spanner_csharp_grpc",
+- ":spanner_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "spanner_cc_proto",
+- deps = [":spanner_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "spanner_cc_grpc",
+- srcs = [":spanner_proto"],
+- grpc_only = True,
+- deps = [":spanner_cc_proto"],
+-)
+diff -urN a/google/storage/v1/BUILD.bazel b/google/storage/v1/BUILD.bazel
+--- a/google/storage/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/storage/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,187 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "storage_proto",
+- srcs = [
+- "storage.proto",
+- "storage_resources.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "storage_java_proto",
+- deps = [":storage_proto"],
+-)
+-
+-java_grpc_library(
+- name = "storage_java_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "storage_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/storage/v1",
+- protos = [":storage_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "storage_moved_proto",
+- srcs = [":storage_proto"],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "storage_py_proto",
+- deps = [":storage_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "storage_py_grpc",
+- srcs = [":storage_moved_proto"],
+- deps = [":storage_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "storage_php_proto",
+- deps = [":storage_proto"],
+-)
+-
+-php_grpc_library(
+- name = "storage_php_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "storage_ruby_proto",
+- deps = [":storage_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "storage_ruby_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "storage_csharp_proto",
+- deps = [":storage_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "storage_csharp_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "storage_cc_proto",
+- deps = [":storage_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "storage_cc_grpc",
+- srcs = [":storage_proto"],
+- grpc_only = True,
+- deps = [":storage_cc_proto"],
+-)
+diff -urN a/google/storage/v2/BUILD.bazel b/google/storage/v2/BUILD.bazel
+--- a/google/storage/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/storage/v2/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,348 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "storage_proto",
+- srcs = [
+- "storage.proto",
+- ],
+- deps = [
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/api:routing_proto",
+- "//google/iam/v1:iam_policy_proto",
+- "//google/iam/v1:policy_proto",
+- "//google/type:date_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "storage_proto_with_info",
+- deps = [
+- ":storage_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "storage_java_proto",
+- deps = [":storage_proto"],
+-)
+-
+-java_grpc_library(
+- name = "storage_java_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "storage_java_gapic",
+- srcs = [":storage_proto_with_info"],
+- grpc_service_config = "storage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- test_deps = [
+- ":storage_java_grpc",
+- "//google/iam/v1:iam_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":storage_java_proto",
+- "//google/iam/v1:iam_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "storage_java_gapic_test_suite",
+- test_classes = [
+- "com.google.storage.v2.StorageClientTest",
+- ],
+- runtime_deps = [":storage_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-storage-v2-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":storage_java_gapic",
+- ":storage_java_grpc",
+- ":storage_java_proto",
+- ":storage_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "storage_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/storage/v2",
+- protos = [":storage_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/api:routing_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "//google/type:date_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "storage_go_gapic",
+- srcs = [":storage_proto_with_info"],
+- grpc_service_config = "storage_grpc_service_config.json",
+- importpath = "cloud.google.com/go/storage/apiv2;storage",
+- metadata = True,
+- rest_numeric_enums = False,
+- transport = "grpc",
+- service_yaml = "storage_v2.yaml",
+- deps = [
+- ":storage_go_proto",
+- "//google/iam/v1:iam_go_proto",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "storage_go_gapic_test",
+- srcs = [":storage_go_gapic_srcjar_test"],
+- embed = [":storage_go_gapic"],
+- importpath = "cloud.google.com/go/storage/apiv2",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-storage-v2-go",
+- deps = [
+- ":storage_go_gapic",
+- ":storage_go_gapic_srcjar-metadata.srcjar",
+- ":storage_go_gapic_srcjar-test.srcjar",
+- ":storage_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "storage_py_gapic",
+- srcs = [":storage_proto"],
+- grpc_service_config = "storage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- transport = "grpc",
+- deps = [
+- "//google/iam/v1:iam_policy_py_proto",
+- "//google/iam/v1:policy_py_proto",
+- ],
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1377 is fixed
+-#py_test(
+-# name = "storage_py_gapic_test",
+-# srcs = [
+-# "storage_py_gapic_pytest.py",
+-# "storage_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":storage_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "storage-v2-py",
+- deps = [
+- ":storage_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "storage_php_proto",
+- deps = [":storage_proto"],
+-)
+-
+-php_grpc_library(
+- name = "storage_php_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_php_proto"],
+-)
+-
+-# PHP always supports gRPC and REST, but there is no PHP GAPIC for this API.
+-php_gapic_library(
+- name = "storage_php_gapic",
+- srcs = [":storage_proto_with_info"],
+- grpc_service_config = "storage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "storage_v2.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":storage_php_grpc",
+- ":storage_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-storage-v2-php",
+- deps = [
+- ":storage_php_gapic",
+- ":storage_php_grpc",
+- ":storage_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "storage_nodejs_gapic",
+- package_name = "@google-cloud/storage",
+- src = ":storage_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "storage_grpc_service_config.json",
+- package = "google.storage.v2",
+- rest_numeric_enums = False,
+- service_yaml = "storage_v2.yaml",
+- transport = "grpc",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "storage-v2-nodejs",
+- deps = [
+- ":storage_nodejs_gapic",
+- ":storage_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "storage_ruby_proto",
+- deps = [":storage_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "storage_ruby_grpc",
+- srcs = [":storage_proto"],
+- deps = [":storage_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "storage_ruby_gapic",
+- srcs = [":storage_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-storage-v2"],
+- grpc_service_config = "storage_grpc_service_config.json",
+- rest_numeric_enums = False,
+- deps = [
+- ":storage_ruby_grpc",
+- ":storage_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-storage-v2-ruby",
+- deps = [
+- ":storage_ruby_gapic",
+- ":storage_ruby_grpc",
+- ":storage_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-#
+-# C# generation is disabled because generation fails as gapic-generator-csharp
+-# doesn't support client-streaming RPCs.
+-#
+-# load(
+-# "@com_google_googleapis_imports//:imports.bzl",
+-# "csharp_gapic_assembly_pkg",
+-# "csharp_gapic_library",
+-# "csharp_grpc_library",
+-# "csharp_proto_library",
+-# )
+-#
+-# csharp_proto_library(
+-# name = "storage_csharp_proto",
+-# deps = [":storage_proto"],
+-# )
+-#
+-# csharp_grpc_library(
+-# name = "storage_csharp_grpc",
+-# srcs = [":storage_proto"],
+-# deps = [":storage_csharp_proto"],
+-# )
+-#
+-# csharp_gapic_library(
+-# name = "storage_csharp_gapic",
+-# srcs = [":storage_proto_with_info"],
+-# common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+-# grpc_service_config = "storage_grpc_service_config.json",
+-# deps = [
+-# ":storage_csharp_grpc",
+-# ":storage_csharp_proto",
+-# ],
+-# )
+-#
+-# # Open Source Packages
+-# csharp_gapic_assembly_pkg(
+-# name = "google-cloud-storage-v2-csharp",
+-# deps = [
+-# ":storage_csharp_gapic",
+-# ":storage_csharp_grpc",
+-# ":storage_csharp_proto",
+-# ],
+-# )
+-
+-cc_proto_library(
+- name = "storage_cc_proto",
+- deps = [":storage_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "storage_cc_grpc",
+- srcs = [":storage_proto"],
+- generate_mocks = True,
+- grpc_only = True,
+- deps = [":storage_cc_proto"],
+-)
+diff -urN a/google/storagetransfer/BUILD.bazel b/google/storagetransfer/BUILD.bazel
+--- a/google/storagetransfer/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/storagetransfer/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,39 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# google-cloud-storage_transfer.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for storagetransfer.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "storagetransfer_ruby_wrapper",
+- srcs = ["//google/storagetransfer/v1:storagetransfer_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=google-cloud-storage_transfer",
+- "ruby-cloud-wrapper-of=v1:0.1",
+- "ruby-cloud-product-url=https://cloud.google.com/storage-transfer-service/",
+- "ruby-cloud-api-id=storagetransfer.googleapis.com",
+- "ruby-cloud-api-shortname=storagetransfer",
+- ],
+- ruby_cloud_description = "Storage Transfer Service allows you to quickly import online data into Cloud Storage. You can also set up a repeating schedule for transferring data, as well as transfer data within Cloud Storage, from one bucket to another.",
+- ruby_cloud_title = "Storage Transfer Service",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-storagetransfer-ruby",
+- deps = [
+- ":storagetransfer_ruby_wrapper",
+- ],
+-)
+diff -urN a/google/storagetransfer/logging/BUILD.bazel b/google/storagetransfer/logging/BUILD.bazel
+--- a/google/storagetransfer/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/storagetransfer/logging/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,179 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-proto_library(
+- name = "logging_proto",
+- srcs = [
+- "transfer_activity_log.proto",
+- ],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "logging_java_proto",
+- deps = [":logging_proto"],
+-)
+-
+-java_grpc_library(
+- name = "logging_java_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_java_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_proto_library",
+-)
+-
+-go_proto_library(
+- name = "logging_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/storagetransfer/logging",
+- protos = [":logging_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "moved_proto_library",
+- "py_grpc_library",
+- "py_proto_library",
+-)
+-
+-moved_proto_library(
+- name = "logging_moved_proto",
+- srcs = [":logging_proto"],
+- deps = [
+- "//google/api:field_behavior_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-py_proto_library(
+- name = "logging_py_proto",
+- deps = [":logging_moved_proto"],
+-)
+-
+-py_grpc_library(
+- name = "logging_py_grpc",
+- srcs = [":logging_moved_proto"],
+- deps = [":logging_py_proto"],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "logging_php_proto",
+- deps = [":logging_proto"],
+-)
+-
+-php_grpc_library(
+- name = "logging_php_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_php_proto"],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "logging_ruby_proto",
+- deps = [":logging_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "logging_ruby_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_ruby_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "logging_csharp_proto",
+- deps = [":logging_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "logging_csharp_grpc",
+- srcs = [":logging_proto"],
+- deps = [":logging_csharp_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "logging_cc_proto",
+- deps = [":logging_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "logging_cc_grpc",
+- srcs = [":logging_proto"],
+- grpc_only = True,
+- deps = [":logging_cc_proto"],
+-)
+diff -urN a/google/storagetransfer/v1/BUILD.bazel b/google/storagetransfer/v1/BUILD.bazel
+--- a/google/storagetransfer/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/storagetransfer/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,352 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+- "proto_library_with_info",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-proto_library(
+- name = "storagetransfer_proto",
+- srcs = [
+- "transfer.proto",
+- "transfer_types.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:code_proto",
+- "//google/type:date_proto",
+- "//google/type:timeofday_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "storagetransfer_proto_with_info",
+- deps = [
+- ":storagetransfer_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "storagetransfer_java_proto",
+- deps = [":storagetransfer_proto"],
+-)
+-
+-java_grpc_library(
+- name = "storagetransfer_java_grpc",
+- srcs = [":storagetransfer_proto"],
+- deps = [":storagetransfer_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "storagetransfer_java_gapic",
+- srcs = [":storagetransfer_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "storagetransfer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "storagetransfer_v1.yaml",
+- test_deps = [
+- ":storagetransfer_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":storagetransfer_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "storagetransfer_java_gapic_test_suite",
+- test_classes = [
+- "com.google.storagetransfer.v1.proto.StorageTransferServiceClientHttpJsonTest",
+- "com.google.storagetransfer.v1.proto.StorageTransferServiceClientTest",
+- ],
+- runtime_deps = [":storagetransfer_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-storagetransfer-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":storagetransfer_java_gapic",
+- ":storagetransfer_java_grpc",
+- ":storagetransfer_java_proto",
+- ":storagetransfer_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "storagetransfer_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/storagetransfer/v1",
+- protos = [":storagetransfer_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:code_go_proto",
+- "//google/type:date_go_proto",
+- "//google/type:timeofday_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "storagetransfer_go_gapic",
+- srcs = [":storagetransfer_proto_with_info"],
+- grpc_service_config = "storagetransfer_grpc_service_config.json",
+- importpath = "cloud.google.com/go/storagetransfer/apiv1;storagetransfer",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "storagetransfer_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":storagetransfer_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "storagetransfer_go_gapic_test",
+- srcs = [":storagetransfer_go_gapic_srcjar_test"],
+- embed = [":storagetransfer_go_gapic"],
+- importpath = "cloud.google.com/go/storagetransfer/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-storagetransfer-v1-go",
+- deps = [
+- ":storagetransfer_go_gapic",
+- ":storagetransfer_go_gapic_srcjar-metadata.srcjar",
+- ":storagetransfer_go_gapic_srcjar-test.srcjar",
+- ":storagetransfer_go_proto",
+- ],
+-)
+-
+-py_gapic_library(
+- name = "storagetransfer_py_gapic",
+- srcs = [":storagetransfer_proto"],
+- grpc_service_config = "storagetransfer_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-name=storage_transfer",
+- "python-gapic-namespace=google.cloud",
+- "warehouse-package-name=google-cloud-storage-transfer",
+- ],
+- rest_numeric_enums = False,
+- transport = "grpc",
+-)
+-
+-py_test(
+- name = "storagetransfer_py_gapic_test",
+- srcs = [
+- "storagetransfer_py_gapic_pytest.py",
+- "storagetransfer_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":storagetransfer_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "storagetransfer-v1-py",
+- deps = [
+- ":storagetransfer_py_gapic",
+- ],
+-)
+-
+-php_proto_library(
+- name = "storagetransfer_php_proto",
+- deps = [":storagetransfer_proto"],
+-)
+-
+-php_grpc_library(
+- name = "storagetransfer_php_grpc",
+- srcs = [":storagetransfer_proto"],
+- deps = [":storagetransfer_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "storagetransfer_php_gapic",
+- srcs = [":storagetransfer_proto_with_info"],
+- grpc_service_config = "storagetransfer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "storagetransfer_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":storagetransfer_php_grpc",
+- ":storagetransfer_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-storagetransfer-v1-php",
+- deps = [
+- ":storagetransfer_php_gapic",
+- ":storagetransfer_php_grpc",
+- ":storagetransfer_php_proto",
+- ],
+-)
+-
+-nodejs_gapic_library(
+- name = "storagetransfer_nodejs_gapic",
+- package_name = "@google-cloud/storage-transfer",
+- src = ":storagetransfer_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "storagetransfer_grpc_service_config.json",
+- package = "google.storagetransfer.v1",
+- rest_numeric_enums = False,
+- service_yaml = "storagetransfer_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "storagetransfer-v1-nodejs",
+- deps = [
+- ":storagetransfer_nodejs_gapic",
+- ":storagetransfer_proto",
+- ],
+-)
+-
+-ruby_proto_library(
+- name = "storagetransfer_ruby_proto",
+- deps = [":storagetransfer_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "storagetransfer_ruby_grpc",
+- srcs = [":storagetransfer_proto"],
+- deps = [":storagetransfer_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "storagetransfer_ruby_gapic",
+- srcs = [":storagetransfer_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-api-id=storagetransfer.googleapis.com",
+- "ruby-cloud-api-shortname=storagetransfer",
+- "ruby-cloud-gem-name=google-cloud-storage_transfer-v1",
+- "ruby-cloud-product-url=https://cloud.google.com/storage-transfer-service/",
+- ],
+- grpc_service_config = "storagetransfer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "Storage Transfer Service allows you to quickly import online data into Cloud Storage. You can also set up a repeating schedule for transferring data, as well as transfer data within Cloud Storage, from one bucket to another.",
+- ruby_cloud_title = "Storage Transfer Service V1",
+- deps = [
+- ":storagetransfer_ruby_grpc",
+- ":storagetransfer_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-storagetransfer-v1-ruby",
+- deps = [
+- ":storagetransfer_ruby_gapic",
+- ":storagetransfer_ruby_grpc",
+- ":storagetransfer_ruby_proto",
+- ],
+-)
+-
+-csharp_proto_library(
+- name = "storagetransfer_csharp_proto",
+- deps = [":storagetransfer_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "storagetransfer_csharp_grpc",
+- srcs = [":storagetransfer_proto"],
+- deps = [":storagetransfer_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "storagetransfer_csharp_gapic",
+- srcs = [":storagetransfer_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "storagetransfer_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "storagetransfer_v1.yaml",
+- deps = [
+- ":storagetransfer_csharp_grpc",
+- ":storagetransfer_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-storagetransfer-v1-csharp",
+- deps = [
+- ":storagetransfer_csharp_gapic",
+- ":storagetransfer_csharp_grpc",
+- ":storagetransfer_csharp_proto",
+- ],
+-)
+-
+-cc_proto_library(
+- name = "storagetransfer_cc_proto",
+- deps = [":storagetransfer_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "storagetransfer_cc_grpc",
+- srcs = [":storagetransfer_proto"],
+- grpc_only = True,
+- deps = [":storagetransfer_cc_proto"],
+-)
+diff -urN a/google/streetview/publish/BUILD.bazel b/google/streetview/publish/BUILD.bazel
+--- a/google/streetview/publish/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/streetview/publish/BUILD.bazel 1969-12-31 16:00:00
+@@ -1 +0,0 @@
+-exports_files(glob(["*.yaml"]))
+diff -urN a/google/streetview/publish/v1/BUILD.bazel b/google/streetview/publish/v1/BUILD.bazel
+--- a/google/streetview/publish/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/streetview/publish/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,396 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "publish_proto",
+- srcs = [
+- "resources.proto",
+- "rpcmessages.proto",
+- "streetview_publish.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/longrunning:operations_proto",
+- "//google/rpc:status_proto",
+- "//google/type:latlng_proto",
+- "@com_google_protobuf//:duration_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "publish_proto_with_info",
+- deps = [
+- ":publish_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "publish_java_proto",
+- deps = [":publish_proto"],
+-)
+-
+-java_grpc_library(
+- name = "publish_java_grpc",
+- srcs = [":publish_proto"],
+- deps = [":publish_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "publish_java_gapic",
+- srcs = [":publish_proto_with_info"],
+- gapic_yaml = "streetview_publish_gapic.yaml",
+- grpc_service_config = "streetview_publish_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "streetviewpublish.yaml",
+- test_deps = [
+- ":publish_java_grpc",
+- ],
+- transport = "grpc+rest",
+- deps = [
+- ":publish_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "publish_java_gapic_test_suite",
+- test_classes = [
+- "com.google.streetview.publish.v1.StreetViewPublishServiceClientHttpJsonTest",
+- "com.google.streetview.publish.v1.StreetViewPublishServiceClientTest",
+- ],
+- runtime_deps = [":publish_java_gapic_test"],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-streetview-publish-v1-java",
+- include_samples = True,
+- transport = "grpc+rest",
+- deps = [
+- ":publish_java_gapic",
+- ":publish_java_grpc",
+- ":publish_java_proto",
+- ":publish_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "publish_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/streetview/publish/v1",
+- protos = [":publish_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "//google/rpc:status_go_proto",
+- "//google/type:latlng_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "publish_go_gapic",
+- srcs = [":publish_proto_with_info"],
+- grpc_service_config = "streetview_publish_grpc_service_config.json",
+- importpath = "google.golang.org/google/streetview/publish/v1;publish",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "streetviewpublish.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":publish_go_proto",
+- "//google/longrunning:longrunning_go_proto",
+- "@com_google_cloud_go//longrunning:go_default_library",
+- "@com_google_cloud_go//longrunning/autogen:go_default_library",
+- "@io_bazel_rules_go//proto/wkt:duration_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "publish_go_gapic_test",
+- srcs = [":publish_go_gapic_srcjar_test"],
+- embed = [":publish_go_gapic"],
+- importpath = "google.golang.org/google/streetview/publish/v1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-streetview-publish-v1-go",
+- deps = [
+- ":publish_go_gapic",
+- ":publish_go_gapic_srcjar-metadata.srcjar",
+- ":publish_go_gapic_srcjar-test.srcjar",
+- ":publish_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_test",
+-)
+-
+-py_gapic_library(
+- name = "publish_py_gapic",
+- srcs = [":publish_proto"],
+- grpc_service_config = "streetview_publish_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "streetviewpublish.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-# Uncomment once https://github.com/googleapis/gapic-generator-python/issues/1375 is fixed
+-#py_test(
+-# name = "publish_py_gapic_test",
+-# srcs = [
+-# "publish_py_gapic_pytest.py",
+-# "publish_py_gapic_test.py",
+-# ],
+-# legacy_create_init = False,
+-# deps = [":publish_py_gapic"],
+-#)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "streetview-publish-v1-py",
+- deps = [
+- ":publish_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "publish_php_proto",
+- deps = [":publish_proto"],
+-)
+-
+-php_grpc_library(
+- name = "publish_php_grpc",
+- srcs = [":publish_proto"],
+- deps = [":publish_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "publish_php_gapic",
+- srcs = [":publish_proto_with_info"],
+- grpc_service_config = "streetview_publish_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "streetviewpublish.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":publish_php_grpc",
+- ":publish_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-streetview-publish-v1-php",
+- deps = [
+- ":publish_php_gapic",
+- ":publish_php_grpc",
+- ":publish_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "publish_nodejs_gapic",
+- package_name = "@google-cloud/publish",
+- src = ":publish_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "streetview_publish_grpc_service_config.json",
+- package = "google.streetview.publish.v1",
+- rest_numeric_enums = False,
+- service_yaml = "streetviewpublish.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "streetview-publish-v1-nodejs",
+- deps = [
+- ":publish_nodejs_gapic",
+- ":publish_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "publish_ruby_proto",
+- deps = [":publish_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "publish_ruby_grpc",
+- srcs = [":publish_proto"],
+- deps = [":publish_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "publish_ruby_gapic",
+- srcs = [":publish_proto_with_info"],
+- extra_protoc_parameters = ["ruby-cloud-gem-name=google-cloud-publish-v1"],
+- grpc_service_config = "streetview_publish_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "streetviewpublish.yaml",
+- deps = [
+- ":publish_ruby_grpc",
+- ":publish_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-streetview-publish-v1-ruby",
+- deps = [
+- ":publish_ruby_gapic",
+- ":publish_ruby_grpc",
+- ":publish_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "publish_csharp_proto",
+- deps = [":publish_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "publish_csharp_grpc",
+- srcs = [":publish_proto"],
+- deps = [":publish_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "publish_csharp_gapic",
+- srcs = [":publish_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "streetview_publish_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "streetviewpublish.yaml",
+- deps = [
+- ":publish_csharp_grpc",
+- ":publish_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-streetview-publish-v1-csharp",
+- deps = [
+- ":publish_csharp_gapic",
+- ":publish_csharp_grpc",
+- ":publish_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "publish_cc_proto",
+- deps = [":publish_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "publish_cc_grpc",
+- srcs = [":publish_proto"],
+- grpc_only = True,
+- deps = [":publish_cc_proto"],
+-)
+diff -urN a/google/type/BUILD.bazel b/google/type/BUILD.bazel
+--- a/google/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/google/type/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,538 +0,0 @@
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-proto_library(
+- name = "calendar_period_proto",
+- srcs = ["calendar_period.proto"],
+-)
+-
+-proto_library(
+- name = "color_proto",
+- srcs = ["color.proto"],
+- deps = [
+- "@com_google_protobuf//:wrappers_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "date_proto",
+- srcs = ["date.proto"],
+-)
+-
+-proto_library(
+- name = "datetime_proto",
+- srcs = ["datetime.proto"],
+- deps = [
+- "@com_google_protobuf//:duration_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "dayofweek_proto",
+- srcs = ["dayofweek.proto"],
+-)
+-
+-proto_library(
+- name = "decimal_proto",
+- srcs = ["decimal.proto"],
+-)
+-
+-proto_library(
+- name = "expr_proto",
+- srcs = ["expr.proto"],
+-)
+-
+-proto_library(
+- name = "fraction_proto",
+- srcs = ["fraction.proto"],
+-)
+-
+-proto_library(
+- name = "interval_proto",
+- srcs = ["interval.proto"],
+- deps = [
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "latlng_proto",
+- srcs = ["latlng.proto"],
+-)
+-
+-proto_library(
+- name = "localized_text_proto",
+- srcs = ["localized_text.proto"],
+-)
+-
+-proto_library(
+- name = "money_proto",
+- srcs = ["money.proto"],
+-)
+-
+-proto_library(
+- name = "month_proto",
+- srcs = ["month.proto"],
+-)
+-
+-proto_library(
+- name = "phone_number_proto",
+- srcs = ["phone_number.proto"],
+-)
+-
+-proto_library(
+- name = "postal_address_proto",
+- srcs = ["postal_address.proto"],
+-)
+-
+-proto_library(
+- name = "quaternion_proto",
+- srcs = ["quaternion.proto"],
+-)
+-
+-proto_library(
+- name = "timeofday_proto",
+- srcs = ["timeofday.proto"],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "type_java_proto",
+- deps = [
+- ":calendar_period_proto",
+- ":color_proto",
+- ":date_proto",
+- ":datetime_proto",
+- ":dayofweek_proto",
+- ":decimal_proto",
+- ":expr_proto",
+- ":fraction_proto",
+- ":interval_proto",
+- ":latlng_proto",
+- ":localized_text_proto",
+- ":money_proto",
+- ":month_proto",
+- ":phone_number_proto",
+- ":postal_address_proto",
+- ":quaternion_proto",
+- ":timeofday_proto",
+- ],
+-)
+-
+-# Please DO-NOT-REMOVE this section.
+-# This is required to generate java files for these protos.
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-type-java",
+- transport = "grpc+rest",
+- deps = [
+- ":calendar_period_proto",
+- ":color_proto",
+- ":date_proto",
+- ":datetime_proto",
+- ":dayofweek_proto",
+- ":decimal_proto",
+- ":expr_proto",
+- ":fraction_proto",
+- ":interval_proto",
+- ":latlng_proto",
+- ":localized_text_proto",
+- ":money_proto",
+- ":month_proto",
+- ":phone_number_proto",
+- ":postal_address_proto",
+- ":quaternion_proto",
+- ":timeofday_proto",
+- ":type_java_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load("@com_google_googleapis_imports//:imports.bzl", "go_proto_library")
+-
+-go_proto_library(
+- name = "calendar_period_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/calendarperiod",
+- protos = [":calendar_period_proto"],
+-)
+-
+-go_proto_library(
+- name = "color_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/color",
+- protos = [":color_proto"],
+-)
+-
+-go_proto_library(
+- name = "date_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/date",
+- protos = [":date_proto"],
+-)
+-
+-go_proto_library(
+- name = "datetime_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/datetime",
+- protos = [":datetime_proto"],
+-)
+-
+-go_proto_library(
+- name = "dayofweek_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/dayofweek",
+- protos = [":dayofweek_proto"],
+-)
+-
+-go_proto_library(
+- name = "decimal_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/decimal",
+- protos = [":decimal_proto"],
+-)
+-
+-go_proto_library(
+- name = "expr_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/expr",
+- protos = [":expr_proto"],
+-)
+-
+-go_proto_library(
+- name = "fraction_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/fraction",
+- protos = [":fraction_proto"],
+-)
+-
+-go_proto_library(
+- name = "interval_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/interval",
+- protos = [":interval_proto"],
+-)
+-
+-go_proto_library(
+- name = "latlng_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/latlng",
+- protos = [":latlng_proto"],
+-)
+-
+-go_proto_library(
+- name = "localized_text_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/localized_text",
+- protos = [":localized_text_proto"],
+-)
+-
+-go_proto_library(
+- name = "money_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/money",
+- protos = [":money_proto"],
+-)
+-
+-go_proto_library(
+- name = "month_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/month",
+- protos = [":month_proto"],
+-)
+-
+-go_proto_library(
+- name = "phone_number_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/phone_number",
+- protos = [":phone_number_proto"],
+-)
+-
+-go_proto_library(
+- name = "postaladdress_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/postaladdress",
+- protos = [":postal_address_proto"],
+-)
+-
+-go_proto_library(
+- name = "quaternion_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/quaternion",
+- protos = [":quaternion_proto"],
+-)
+-
+-go_proto_library(
+- name = "timeofday_go_proto",
+- importpath = "google.golang.org/genproto/googleapis/type/timeofday",
+- protos = [":timeofday_proto"],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "calendar_period_cc_proto",
+- deps = [":calendar_period_proto"],
+-)
+-
+-cc_proto_library(
+- name = "color_cc_proto",
+- deps = [":color_proto"],
+-)
+-
+-cc_proto_library(
+- name = "date_cc_proto",
+- deps = [":date_proto"],
+-)
+-
+-cc_proto_library(
+- name = "datetime_cc_proto",
+- deps = [":datetime_proto"],
+-)
+-
+-cc_proto_library(
+- name = "dayofweek_cc_proto",
+- deps = [":dayofweek_proto"],
+-)
+-
+-cc_proto_library(
+- name = "decimal_cc_proto",
+- deps = [":decimal_proto"],
+-)
+-
+-cc_proto_library(
+- name = "expr_cc_proto",
+- deps = [":expr_proto"],
+-)
+-
+-cc_proto_library(
+- name = "fraction_cc_proto",
+- deps = [":fraction_proto"],
+-)
+-
+-cc_proto_library(
+- name = "interval_cc_proto",
+- deps = [":interval_proto"],
+-)
+-
+-cc_proto_library(
+- name = "latlng_cc_proto",
+- deps = [":latlng_proto"],
+-)
+-
+-cc_proto_library(
+- name = "money_cc_proto",
+- deps = [":money_proto"],
+-)
+-
+-cc_proto_library(
+- name = "month_cc_proto",
+- deps = [":month_proto"],
+-)
+-
+-cc_proto_library(
+- name = "phone_number_cc_proto",
+- deps = [":phone_number_proto"],
+-)
+-
+-cc_proto_library(
+- name = "postal_address_cc_proto",
+- deps = [":postal_address_proto"],
+-)
+-
+-cc_proto_library(
+- name = "quaternion_cc_proto",
+- deps = [":quaternion_proto"],
+-)
+-
+-cc_proto_library(
+- name = "timeofday_cc_proto",
+- deps = [":timeofday_proto"],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_proto_library",
+-)
+-
+-py_proto_library(
+- name = "calendar_period_py_proto",
+- deps = [":calendar_period_proto"],
+-)
+-
+-py_proto_library(
+- name = "color_py_proto",
+- deps = [":color_proto"],
+-)
+-
+-py_proto_library(
+- name = "date_py_proto",
+- deps = [":date_proto"],
+-)
+-
+-py_proto_library(
+- name = "datetime_py_proto",
+- deps = [":datetime_proto"],
+-)
+-
+-py_proto_library(
+- name = "dayofweek_py_proto",
+- deps = [":dayofweek_proto"],
+-)
+-
+-py_proto_library(
+- name = "decimal_py_proto",
+- deps = [":decimal_proto"],
+-)
+-
+-py_proto_library(
+- name = "expr_py_proto",
+- deps = [":expr_proto"],
+-)
+-
+-py_proto_library(
+- name = "fraction_py_proto",
+- deps = [":fraction_proto"],
+-)
+-
+-py_proto_library(
+- name = "interval_py_proto",
+- deps = [":interval_proto"],
+-)
+-
+-py_proto_library(
+- name = "latlng_py_proto",
+- deps = [":latlng_proto"],
+-)
+-
+-py_proto_library(
+- name = "localized_text_py_proto",
+- deps = [":localized_text_proto"],
+-)
+-
+-py_proto_library(
+- name = "money_py_proto",
+- deps = [":money_proto"],
+-)
+-
+-py_proto_library(
+- name = "month_py_proto",
+- deps = [":month_proto"],
+-)
+-
+-py_proto_library(
+- name = "phone_number_py_proto",
+- deps = [":phone_number_proto"],
+-)
+-
+-py_proto_library(
+- name = "postal_address_py_proto",
+- deps = [":postal_address_proto"],
+-)
+-
+-py_proto_library(
+- name = "quaternion_py_proto",
+- deps = [":quaternion_proto"],
+-)
+-
+-py_proto_library(
+- name = "timeofday_py_proto",
+- deps = [":timeofday_proto"],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "calendar_period_csharp_proto",
+- deps = [":calendar_period_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "color_csharp_proto",
+- deps = [":color_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "date_csharp_proto",
+- deps = [":date_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "datetime_csharp_proto",
+- deps = [":datetime_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "dayofweek_csharp_proto",
+- deps = [":dayofweek_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "decimal_csharp_proto",
+- deps = [":decimal_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "expr_csharp_proto",
+- deps = [":expr_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "fraction_csharp_proto",
+- deps = [":fraction_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "interval_csharp_proto",
+- deps = [":interval_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "latlng_csharp_proto",
+- deps = [":latlng_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "localized_text_csharp_proto",
+- deps = [":localized_text_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "money_csharp_proto",
+- deps = [":money_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "month_csharp_proto",
+- deps = [":month_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "phone_number_csharp_proto",
+- deps = [":phone_number_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "postal_address_csharp_proto",
+- deps = [":postal_address_proto"],
+-)
+-
+-csharp_proto_library(
+- name = "quaternion_csharp_proto",
+- deps = [":quaternion_proto"],
+-)
+diff -urN a/grafeas/BUILD.bazel b/grafeas/BUILD.bazel
+--- a/grafeas/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/grafeas/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,40 +0,0 @@
+-# This build file includes a target for the Ruby wrapper library for
+-# grafeas.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-# Export yaml configs.
+-exports_files(glob(["*.yaml"]))
+-
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+-)
+-
+-# Generates a Ruby wrapper client for grafeas.
+-# Ruby wrapper clients are versionless, but are generated from source protos
+-# for a particular service version, v1 in this case.
+-ruby_cloud_gapic_library(
+- name = "grafeas_ruby_wrapper",
+- srcs = ["//grafeas/v1:grafeas_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-gem-name=grafeas",
+- "ruby-cloud-env-prefix=GRAFEAS",
+- "ruby-cloud-wrapper-of=v1:0.0",
+- "ruby-cloud-product-url=https://grafeas.io",
+- "ruby-cloud-migration-version=1.0",
+- "ruby-cloud-generic-endpoint=true",
+- ],
+- ruby_cloud_description = "The Grafeas API stores, and enables querying and retrieval of, critical metadata about all of your software artifacts.",
+- ruby_cloud_title = "Grafeas",
+-)
+-
+-# Open Source package.
+-ruby_gapic_assembly_pkg(
+- name = "grafeas-ruby",
+- deps = [
+- ":grafeas_ruby_wrapper",
+- ],
+-)
+diff -urN a/grafeas/v1/BUILD.bazel b/grafeas/v1/BUILD.bazel
+--- a/grafeas/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
++++ b/grafeas/v1/BUILD.bazel 1969-12-31 16:00:00
+@@ -1,531 +0,0 @@
+-# This file was automatically generated by BuildFileGenerator
+-# https://github.com/googleapis/rules_gapic/tree/master/bazel
+-
+-# Most of the manual changes to this file will be overwritten.
+-# It's **only** allowed to change the following rule attribute values:
+-# - names of *_gapic_assembly_* rules
+-# - certain parameters of *_gapic_library rules, including but not limited to:
+-# * extra_protoc_parameters
+-# * extra_protoc_file_parameters
+-# The complete list of preserved parameters can be found in the source code.
+-
+-# This is an API workspace, having public visibility by default makes perfect sense.
+-package(default_visibility = ["//visibility:public"])
+-
+-##############################################################################
+-# Common
+-##############################################################################
+-load("@rules_proto//proto:defs.bzl", "proto_library")
+-load("@com_google_googleapis_imports//:imports.bzl", "proto_library_with_info")
+-
+-proto_library(
+- name = "grafeas_proto",
+- srcs = [
+- "attestation.proto",
+- "build.proto",
+- "common.proto",
+- "compliance.proto",
+- "cvss.proto",
+- "deployment.proto",
+- "discovery.proto",
+- "dsse_attestation.proto",
+- "grafeas.proto",
+- "image.proto",
+- "intoto_provenance.proto",
+- "intoto_statement.proto",
+- "package.proto",
+- "provenance.proto",
+- "severity.proto",
+- "slsa_provenance.proto",
+- "slsa_provenance_zero_two.proto",
+- "upgrade.proto",
+- "vulnerability.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:struct_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library_with_info(
+- name = "grafeas_proto_with_info",
+- deps = [
+- ":grafeas_proto",
+- "//google/cloud:common_resources_proto",
+- ],
+-)
+-
+-# The compliance_proto, common_proto and severity_proto targets were added so
+-# that clients can depend on those specific targets rather than grafeas_proto.
+-# Some clients that run code on certain VMs needed the smaller targets. Note
+-# that these were added by hand and were not autogenerated. Please ensure that
+-# these are not deleted while updating this file.
+-proto_library(
+- name = "compliance_proto",
+- srcs = [
+- "compliance.proto",
+- ],
+- deps = [
+- ":severity_proto",
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "common_proto",
+- srcs = [
+- "common.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-proto_library(
+- name = "severity_proto",
+- srcs = [
+- "severity.proto",
+- ],
+- deps = [
+- "//google/api:annotations_proto",
+- "//google/api:client_proto",
+- "//google/api:field_behavior_proto",
+- "//google/api:resource_proto",
+- "//google/rpc:status_proto",
+- "@com_google_protobuf//:any_proto",
+- "@com_google_protobuf//:empty_proto",
+- "@com_google_protobuf//:field_mask_proto",
+- "@com_google_protobuf//:timestamp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Java
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "java_gapic_assembly_gradle_pkg",
+- "java_gapic_library",
+- "java_gapic_test",
+- "java_grpc_library",
+- "java_proto_library",
+-)
+-
+-java_proto_library(
+- name = "grafeas_java_proto",
+- deps = [":grafeas_proto"],
+-)
+-
+-java_grpc_library(
+- name = "grafeas_java_grpc",
+- srcs = [":grafeas_proto"],
+- deps = [":grafeas_java_proto"],
+-)
+-
+-java_gapic_library(
+- name = "grafeas_java_gapic",
+- srcs = [":grafeas_proto_with_info"],
+- gapic_yaml = None,
+- grpc_service_config = "grafeas_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//grafeas:grafeas_v1.yaml",
+- test_deps = [
+- ":grafeas_java_grpc",
+- ],
+- transport = "grpc",
+- deps = [
+- ":common_proto",
+- ":grafeas_java_proto",
+- "//google/api:api_java_proto",
+- ],
+-)
+-
+-java_gapic_test(
+- name = "grafeas_java_gapic_test_suite",
+- test_classes = [
+- "io.grafeas.v1.GrafeasClientTest",
+- ],
+- runtime_deps = [
+- ":common_proto",
+- ":grafeas_java_gapic_test",
+- ],
+-)
+-
+-# Open Source Packages
+-java_gapic_assembly_gradle_pkg(
+- name = "google-cloud-grafeas-v1-java",
+- include_samples = True,
+- transport = "grpc",
+- deps = [
+- ":grafeas_java_gapic",
+- ":grafeas_java_grpc",
+- ":grafeas_java_proto",
+- ":grafeas_proto",
+- ],
+-)
+-
+-java_proto_library(
+- name = "common_java_proto",
+- deps = [":common_proto"],
+-)
+-
+-##############################################################################
+-# Go
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "go_gapic_assembly_pkg",
+- "go_gapic_library",
+- "go_proto_library",
+- "go_test",
+-)
+-
+-go_proto_library(
+- name = "grafeas_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/grafeas/v1",
+- protos = [":grafeas_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_gapic_library(
+- name = "grafeas_go_gapic",
+- srcs = [":grafeas_proto_with_info"],
+- grpc_service_config = "grafeas_grpc_service_config.json",
+- importpath = "cloud.google.com/go/grafeas/apiv1;grafeas",
+- metadata = True,
+- rest_numeric_enums = False,
+- service_yaml = "//grafeas:grafeas_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ":grafeas_go_proto",
+- ],
+-)
+-
+-go_test(
+- name = "grafeas_go_gapic_test",
+- srcs = [":grafeas_go_gapic_srcjar_test"],
+- embed = [":grafeas_go_gapic"],
+- importpath = "cloud.google.com/go/grafeas/apiv1",
+-)
+-
+-# Open Source Packages
+-go_gapic_assembly_pkg(
+- name = "gapi-cloud-grafeas-v1-go",
+- deps = [
+- ":grafeas_go_gapic",
+- ":grafeas_go_gapic_srcjar-metadata.srcjar",
+- ":grafeas_go_gapic_srcjar-test.srcjar",
+- ":grafeas_go_proto",
+- ],
+-)
+-
+-# The compliance_go_proto, common_go_proto and severity_go_proto targets were
+-# added so that clients can depend on those specific targets rather than
+-# grafeas_proto. Some clients that run code on certain VMs needed the
+-# smaller targets. Note that these were added by hand and were not
+-# autogenerated. Please ensure that these are not deleted while updating this
+-# file.
+-go_proto_library(
+- name = "compliance_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/grafeas/v1",
+- protos = [
+- ":compliance_proto",
+- ":severity_proto",
+- ],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "common_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/grafeas/v1",
+- protos = [":common_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-go_proto_library(
+- name = "severity_go_proto",
+- compilers = ["@io_bazel_rules_go//proto:go_grpc"],
+- importpath = "google.golang.org/genproto/googleapis/grafeas/v1",
+- protos = [":severity_proto"],
+- deps = [
+- "//google/api:annotations_go_proto",
+- "//google/rpc:status_go_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Python
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "py_gapic_assembly_pkg",
+- "py_gapic_library",
+- "py_proto_library",
+- "py_test",
+-)
+-
+-py_proto_library(
+- name = "grafeas_py_proto",
+- deps = ["grafeas_proto"],
+-)
+-
+-py_gapic_library(
+- name = "grafeas_py_gapic",
+- srcs = [":grafeas_proto"],
+- grpc_service_config = "grafeas_grpc_service_config.json",
+- opt_args = [
+- "python-gapic-namespace=grafeas",
+- "warehouse-package-name=grafeas",
+- ],
+- rest_numeric_enums = False,
+- service_yaml = "//grafeas:grafeas_v1.yaml",
+- transport = "grpc",
+- deps = [
+- ],
+-)
+-
+-py_test(
+- name = "grafeas_py_gapic_test",
+- srcs = [
+- "grafeas_py_gapic_pytest.py",
+- "grafeas_py_gapic_test.py",
+- ],
+- legacy_create_init = False,
+- deps = [":grafeas_py_gapic"],
+-)
+-
+-# Open Source Packages
+-py_gapic_assembly_pkg(
+- name = "grafeas-v1-py",
+- deps = [
+- ":grafeas_py_gapic",
+- ],
+-)
+-
+-##############################################################################
+-# PHP
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "php_gapic_assembly_pkg",
+- "php_gapic_library",
+- "php_grpc_library",
+- "php_proto_library",
+-)
+-
+-php_proto_library(
+- name = "grafeas_php_proto",
+- deps = [":grafeas_proto"],
+-)
+-
+-php_grpc_library(
+- name = "grafeas_php_grpc",
+- srcs = [":grafeas_proto"],
+- deps = [":grafeas_php_proto"],
+-)
+-
+-php_gapic_library(
+- name = "grafeas_php_gapic",
+- srcs = [":grafeas_proto_with_info"],
+- grpc_service_config = "grafeas_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//grafeas:grafeas_v1.yaml",
+- transport = "grpc+rest",
+- deps = [
+- ":grafeas_php_grpc",
+- ":grafeas_php_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-php_gapic_assembly_pkg(
+- name = "google-cloud-grafeas-v1-php",
+- deps = [
+- ":grafeas_php_gapic",
+- ":grafeas_php_grpc",
+- ":grafeas_php_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Node.js
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "nodejs_gapic_assembly_pkg",
+- "nodejs_gapic_library",
+-)
+-
+-nodejs_gapic_library(
+- name = "grafeas_nodejs_gapic",
+- package_name = "@google-cloud/grafeas",
+- src = ":grafeas_proto_with_info",
+- extra_protoc_parameters = ["metadata"],
+- grpc_service_config = "grafeas_grpc_service_config.json",
+- package = "grafeas.v1",
+- rest_numeric_enums = False,
+- service_yaml = "//grafeas:grafeas_v1.yaml",
+- transport = "grpc+rest",
+- deps = [],
+-)
+-
+-nodejs_gapic_assembly_pkg(
+- name = "grafeas-v1-nodejs",
+- deps = [
+- ":grafeas_nodejs_gapic",
+- ":grafeas_proto",
+- ],
+-)
+-
+-##############################################################################
+-# Ruby
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "ruby_cloud_gapic_library",
+- "ruby_gapic_assembly_pkg",
+- "ruby_grpc_library",
+- "ruby_proto_library",
+-)
+-
+-ruby_proto_library(
+- name = "grafeas_ruby_proto",
+- deps = [":grafeas_proto"],
+-)
+-
+-ruby_grpc_library(
+- name = "grafeas_ruby_grpc",
+- srcs = [":grafeas_proto"],
+- deps = [":grafeas_ruby_proto"],
+-)
+-
+-ruby_cloud_gapic_library(
+- name = "grafeas_ruby_gapic",
+- srcs = [":grafeas_proto_with_info"],
+- extra_protoc_parameters = [
+- "ruby-cloud-env-prefix=GRAFEAS",
+- "ruby-cloud-gem-name=grafeas-v1",
+- "ruby-cloud-generic-endpoint=true",
+- ],
+- grpc_service_config = "grafeas_grpc_service_config.json",
+- rest_numeric_enums = False,
+- ruby_cloud_description = "The Grafeas API stores, and enables querying and retrieval of, critical metadata about all of your software artifacts.",
+- ruby_cloud_title = "Grafeas V1",
+- service_yaml = "//grafeas:grafeas_v1.yaml",
+- deps = [
+- ":grafeas_ruby_grpc",
+- ":grafeas_ruby_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-ruby_gapic_assembly_pkg(
+- name = "google-cloud-grafeas-v1-ruby",
+- deps = [
+- ":grafeas_ruby_gapic",
+- ":grafeas_ruby_grpc",
+- ":grafeas_ruby_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C#
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "csharp_gapic_assembly_pkg",
+- "csharp_gapic_library",
+- "csharp_grpc_library",
+- "csharp_proto_library",
+-)
+-
+-csharp_proto_library(
+- name = "grafeas_csharp_proto",
+- deps = [":grafeas_proto"],
+-)
+-
+-csharp_grpc_library(
+- name = "grafeas_csharp_grpc",
+- srcs = [":grafeas_proto"],
+- deps = [":grafeas_csharp_proto"],
+-)
+-
+-csharp_gapic_library(
+- name = "grafeas_csharp_gapic",
+- srcs = [":grafeas_proto_with_info"],
+- common_resources_config = "@gax_dotnet//:Google.Api.Gax/ResourceNames/CommonResourcesConfig.json",
+- grpc_service_config = "grafeas_grpc_service_config.json",
+- rest_numeric_enums = False,
+- service_yaml = "//grafeas:grafeas_v1.yaml",
+- deps = [
+- ":grafeas_csharp_grpc",
+- ":grafeas_csharp_proto",
+- ],
+-)
+-
+-# Open Source Packages
+-csharp_gapic_assembly_pkg(
+- name = "google-cloud-grafeas-v1-csharp",
+- deps = [
+- ":grafeas_csharp_gapic",
+- ":grafeas_csharp_grpc",
+- ":grafeas_csharp_proto",
+- ],
+-)
+-
+-##############################################################################
+-# C++
+-##############################################################################
+-load(
+- "@com_google_googleapis_imports//:imports.bzl",
+- "cc_grpc_library",
+- "cc_proto_library",
+-)
+-
+-cc_proto_library(
+- name = "grafeas_cc_proto",
+- deps = [":grafeas_proto"],
+-)
+-
+-cc_grpc_library(
+- name = "grafeas_cc_grpc",
+- srcs = [":grafeas_proto"],
+- grpc_only = True,
+- deps = [":grafeas_cc_proto"],
+-)
diff --git a/third_party/go_googleapis-directives.patch b/third_party/go_googleapis-directives.patch
new file mode 100644
index 00000000..14d02400
--- /dev/null
+++ b/third_party/go_googleapis-directives.patch
@@ -0,0 +1,15 @@
+diff -urN b/BUILD.bazel c/BUILD.bazel
+--- b/BUILD.bazel 1969-12-31 16:00:00
++++ c/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,6 @@
++# gazelle:go_naming_convention import_alias
++# gazelle:proto package
++# gazelle:proto_group go_package
++# gazelle:exclude gapic
++# gazelle:exclude third_party
++# gazelle:exclude google/example/endpointsapis/goapp
+diff -urN b/google/BUILD.bazel c/google/BUILD.bazel
+--- b/google/BUILD.bazel 1969-12-31 16:00:00
++++ c/google/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1 @@
++# gazelle:prefix google.golang.org/genproto/googleapis
diff --git a/third_party/go_googleapis-gazelle.patch b/third_party/go_googleapis-gazelle.patch
new file mode 100644
index 00000000..a733ca89
--- /dev/null
+++ b/third_party/go_googleapis-gazelle.patch
@@ -0,0 +1,17342 @@
+diff -urN c/google/actions/sdk/v2/BUILD.bazel d/google/actions/sdk/v2/BUILD.bazel
+--- c/google/actions/sdk/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/actions/sdk/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,61 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "sdk_proto",
++ srcs = [
++ "account_linking.proto",
++ "account_linking_secret.proto",
++ "action.proto",
++ "actions_sdk.proto",
++ "actions_testing.proto",
++ "config_file.proto",
++ "data_file.proto",
++ "event_logs.proto",
++ "files.proto",
++ "localized_settings.proto",
++ "manifest.proto",
++ "release_channel.proto",
++ "settings.proto",
++ "surface.proto",
++ "theme_customization.proto",
++ "validation_results.proto",
++ "version.proto",
++ "webhook.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/actions/sdk/v2/conversation:conversation_proto",
++ "//google/actions/sdk/v2/conversation/prompt:conversation_proto",
++ "//google/actions/sdk/v2/conversation/prompt/content:conversation_proto",
++ "//google/actions/sdk/v2/interactionmodel:interactionmodel_proto",
++ "//google/actions/sdk/v2/interactionmodel/prompt:prompt_proto",
++ "//google/actions/sdk/v2/interactionmodel/type:type_proto",
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "sdk_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/actions/sdk/v2",
++ proto = ":sdk_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/actions/sdk/v2/conversation:conversation_go_proto",
++ "//google/actions/sdk/v2/conversation/prompt:conversation_go_proto",
++ "//google/actions/sdk/v2/conversation/prompt/content:conversation_go_proto",
++ "//google/actions/sdk/v2/interactionmodel:interactionmodel_go_proto",
++ "//google/actions/sdk/v2/interactionmodel/prompt:prompt_go_proto",
++ "//google/actions/sdk/v2/interactionmodel/type:type_go_proto",
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/actions/sdk/v2/conversation/BUILD.bazel d/google/actions/sdk/v2/conversation/BUILD.bazel
+--- c/google/actions/sdk/v2/conversation/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/actions/sdk/v2/conversation/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "conversation_proto",
++ srcs = [
++ "intent.proto",
++ "scene.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/actions/sdk/v2/conversation/prompt:conversation_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++go_proto_library(
++ name = "conversation_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/actions/sdk/v2/conversation",
++ proto = ":conversation_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/actions/sdk/v2/conversation/prompt:conversation_go_proto"],
++)
+diff -urN c/google/actions/sdk/v2/conversation/prompt/BUILD.bazel d/google/actions/sdk/v2/conversation/prompt/BUILD.bazel
+--- c/google/actions/sdk/v2/conversation/prompt/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/actions/sdk/v2/conversation/prompt/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "conversation_proto",
++ srcs = [
++ "prompt.proto",
++ "simple.proto",
++ "suggestion.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = ["//google/actions/sdk/v2/conversation/prompt/content:conversation_proto"],
++)
++
++go_proto_library(
++ name = "conversation_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/actions/sdk/v2/conversation",
++ proto = ":conversation_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/actions/sdk/v2/conversation/prompt/content:conversation_go_proto"],
++)
+diff -urN c/google/actions/sdk/v2/conversation/prompt/content/BUILD.bazel d/google/actions/sdk/v2/conversation/prompt/content/BUILD.bazel
+--- c/google/actions/sdk/v2/conversation/prompt/content/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/actions/sdk/v2/conversation/prompt/content/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "conversation_proto",
++ srcs = [
++ "canvas.proto",
++ "card.proto",
++ "collection.proto",
++ "content.proto",
++ "image.proto",
++ "link.proto",
++ "list.proto",
++ "media.proto",
++ "table.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++go_proto_library(
++ name = "conversation_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/actions/sdk/v2/conversation",
++ proto = ":conversation_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/actions/sdk/v2/interactionmodel/BUILD.bazel d/google/actions/sdk/v2/interactionmodel/BUILD.bazel
+--- c/google/actions/sdk/v2/interactionmodel/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/actions/sdk/v2/interactionmodel/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "interactionmodel_proto",
++ srcs = [
++ "conditional_event.proto",
++ "entity_set.proto",
++ "event_handler.proto",
++ "global_intent_event.proto",
++ "intent.proto",
++ "intent_event.proto",
++ "scene.proto",
++ "slot.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/actions/sdk/v2/interactionmodel/prompt:prompt_proto",
++ "//google/actions/sdk/v2/interactionmodel/type:type_proto",
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++go_proto_library(
++ name = "interactionmodel_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/actions/sdk/v2/interactionmodel",
++ proto = ":interactionmodel_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/actions/sdk/v2/interactionmodel/prompt:prompt_go_proto",
++ "//google/actions/sdk/v2/interactionmodel/type:type_go_proto",
++ "//google/api:annotations_go_proto",
++ ],
++)
+diff -urN c/google/actions/sdk/v2/interactionmodel/prompt/BUILD.bazel d/google/actions/sdk/v2/interactionmodel/prompt/BUILD.bazel
+--- c/google/actions/sdk/v2/interactionmodel/prompt/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/actions/sdk/v2/interactionmodel/prompt/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "prompt_proto",
++ srcs = [
++ "static_prompt.proto",
++ "static_simple_prompt.proto",
++ "suggestion.proto",
++ "surface_capabilities.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/actions/sdk/v2/interactionmodel/prompt/content:prompt_proto",
++ "//google/api:annotations_proto",
++ ],
++)
++
++go_proto_library(
++ name = "prompt_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/actions/sdk/v2/interactionmodel/prompt",
++ proto = ":prompt_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/actions/sdk/v2/interactionmodel/prompt/content:prompt_go_proto",
++ "//google/api:annotations_go_proto",
++ ],
++)
+diff -urN c/google/actions/sdk/v2/interactionmodel/prompt/content/BUILD.bazel d/google/actions/sdk/v2/interactionmodel/prompt/content/BUILD.bazel
+--- c/google/actions/sdk/v2/interactionmodel/prompt/content/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/actions/sdk/v2/interactionmodel/prompt/content/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "prompt_proto",
++ srcs = [
++ "static_canvas_prompt.proto",
++ "static_card_prompt.proto",
++ "static_collection_browse_prompt.proto",
++ "static_collection_prompt.proto",
++ "static_content_prompt.proto",
++ "static_image_prompt.proto",
++ "static_link_prompt.proto",
++ "static_list_prompt.proto",
++ "static_media_prompt.proto",
++ "static_table_prompt.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++go_proto_library(
++ name = "prompt_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/actions/sdk/v2/interactionmodel/prompt",
++ proto = ":prompt_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/actions/sdk/v2/interactionmodel/type/BUILD.bazel d/google/actions/sdk/v2/interactionmodel/type/BUILD.bazel
+--- c/google/actions/sdk/v2/interactionmodel/type/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/actions/sdk/v2/interactionmodel/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "type_proto",
++ srcs = [
++ "class_reference.proto",
++ "entity_display.proto",
++ "free_text_type.proto",
++ "regular_expression_type.proto",
++ "synonym_type.proto",
++ "type.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "type_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/actions/sdk/v2/interactionmodel/type",
++ proto = ":type_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/actions/type/BUILD.bazel d/google/actions/type/BUILD.bazel
+--- c/google/actions/type/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/actions/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "date_range_proto",
++ srcs = ["date_range.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/type:date_proto"],
++)
++
++proto_library(
++ name = "date_time_range_proto",
++ srcs = ["datetime_range.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/type:datetime_proto"],
++)
++
++go_proto_library(
++ name = "date_range_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/date_range",
++ proto = ":date_range_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/type:date_go_proto"],
++)
++
++go_proto_library(
++ name = "date_time_range_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/date_time_range",
++ proto = ":date_time_range_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/type:datetime_go_proto"],
++)
+diff -urN c/google/ads/admob/v1/BUILD.bazel d/google/ads/admob/v1/BUILD.bazel
+--- c/google/ads/admob/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/admob/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "admob_proto",
++ srcs = [
++ "admob_api.proto",
++ "admob_resources.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:date_proto",
++ ],
++)
++
++go_proto_library(
++ name = "admob_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/ads/admob/v1",
++ proto = ":admob_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:date_go_proto",
++ ],
++)
+diff -urN c/google/ads/googleads/v10/common/BUILD.bazel d/google/ads/googleads/v10/common/BUILD.bazel
+--- c/google/ads/googleads/v10/common/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/googleads/v10/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,59 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "common_proto",
++ srcs = [
++ "ad_asset.proto",
++ "ad_type_infos.proto",
++ "asset_policy.proto",
++ "asset_types.proto",
++ "asset_usage.proto",
++ "audiences.proto",
++ "bidding.proto",
++ "click_location.proto",
++ "criteria.proto",
++ "criterion_category_availability.proto",
++ "custom_parameter.proto",
++ "customizer_value.proto",
++ "dates.proto",
++ "explorer_auto_optimizer_setting.proto",
++ "extensions.proto",
++ "feed_common.proto",
++ "feed_item_set_filter_type_infos.proto",
++ "final_app_url.proto",
++ "frequency_cap.proto",
++ "keyword_plan_common.proto",
++ "matching_function.proto",
++ "metric_goal.proto",
++ "metrics.proto",
++ "offline_user_data.proto",
++ "policy.proto",
++ "policy_summary.proto",
++ "real_time_bidding_setting.proto",
++ "segments.proto",
++ "simulation.proto",
++ "tag_snippet.proto",
++ "targeting_setting.proto",
++ "text_label.proto",
++ "url_collection.proto",
++ "user_lists.proto",
++ "value.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v10/enums:enums_proto",
++ "//google/api:annotations_proto",
++ ],
++)
++
++go_proto_library(
++ name = "common_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/ads/googleads/v10/common",
++ proto = ":common_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v10/enums:enums_go_proto",
++ "//google/api:annotations_go_proto",
++ ],
++)
+diff -urN c/google/ads/googleads/v10/enums/BUILD.bazel d/google/ads/googleads/v10/enums/BUILD.bazel
+--- c/google/ads/googleads/v10/enums/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/googleads/v10/enums/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,310 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "enums_proto",
++ srcs = [
++ "access_invitation_status.proto",
++ "access_reason.proto",
++ "access_role.proto",
++ "account_budget_proposal_status.proto",
++ "account_budget_proposal_type.proto",
++ "account_budget_status.proto",
++ "account_link_status.proto",
++ "ad_customizer_placeholder_field.proto",
++ "ad_destination_type.proto",
++ "ad_group_ad_rotation_mode.proto",
++ "ad_group_ad_status.proto",
++ "ad_group_criterion_approval_status.proto",
++ "ad_group_criterion_status.proto",
++ "ad_group_status.proto",
++ "ad_group_type.proto",
++ "ad_network_type.proto",
++ "ad_serving_optimization_status.proto",
++ "ad_strength.proto",
++ "ad_type.proto",
++ "advertising_channel_sub_type.proto",
++ "advertising_channel_type.proto",
++ "affiliate_location_feed_relationship_type.proto",
++ "affiliate_location_placeholder_field.proto",
++ "age_range_type.proto",
++ "app_campaign_app_store.proto",
++ "app_campaign_bidding_strategy_goal_type.proto",
++ "app_payment_model_type.proto",
++ "app_placeholder_field.proto",
++ "app_store.proto",
++ "app_url_operating_system_type.proto",
++ "asset_field_type.proto",
++ "asset_group_status.proto",
++ "asset_link_status.proto",
++ "asset_performance_label.proto",
++ "asset_set_asset_status.proto",
++ "asset_set_link_status.proto",
++ "asset_set_status.proto",
++ "asset_set_type.proto",
++ "asset_type.proto",
++ "async_action_status.proto",
++ "attribution_model.proto",
++ "audience_status.proto",
++ "batch_job_status.proto",
++ "bid_modifier_source.proto",
++ "bidding_source.proto",
++ "bidding_strategy_status.proto",
++ "bidding_strategy_type.proto",
++ "billing_setup_status.proto",
++ "brand_safety_suitability.proto",
++ "budget_campaign_association_status.proto",
++ "budget_delivery_method.proto",
++ "budget_period.proto",
++ "budget_status.proto",
++ "budget_type.proto",
++ "call_conversion_reporting_state.proto",
++ "call_placeholder_field.proto",
++ "call_to_action_type.proto",
++ "call_tracking_display_location.proto",
++ "call_type.proto",
++ "callout_placeholder_field.proto",
++ "campaign_criterion_status.proto",
++ "campaign_draft_status.proto",
++ "campaign_experiment_status.proto",
++ "campaign_experiment_traffic_split_type.proto",
++ "campaign_experiment_type.proto",
++ "campaign_group_status.proto",
++ "campaign_serving_status.proto",
++ "campaign_shared_set_status.proto",
++ "campaign_status.proto",
++ "change_client_type.proto",
++ "change_event_resource_type.proto",
++ "change_status_operation.proto",
++ "change_status_resource_type.proto",
++ "click_type.proto",
++ "combined_audience_status.proto",
++ "content_label_type.proto",
++ "conversion_action_category.proto",
++ "conversion_action_counting_type.proto",
++ "conversion_action_status.proto",
++ "conversion_action_type.proto",
++ "conversion_adjustment_type.proto",
++ "conversion_attribution_event_type.proto",
++ "conversion_custom_variable_status.proto",
++ "conversion_environment_enum.proto",
++ "conversion_lag_bucket.proto",
++ "conversion_or_adjustment_lag_bucket.proto",
++ "conversion_origin.proto",
++ "conversion_tracking_status_enum.proto",
++ "conversion_value_rule_primary_dimension.proto",
++ "conversion_value_rule_set_status.proto",
++ "conversion_value_rule_status.proto",
++ "criterion_category_channel_availability_mode.proto",
++ "criterion_category_locale_availability_mode.proto",
++ "criterion_system_serving_status.proto",
++ "criterion_type.proto",
++ "custom_audience_member_type.proto",
++ "custom_audience_status.proto",
++ "custom_audience_type.proto",
++ "custom_conversion_goal_status.proto",
++ "custom_interest_member_type.proto",
++ "custom_interest_status.proto",
++ "custom_interest_type.proto",
++ "custom_placeholder_field.proto",
++ "customer_match_upload_key_type.proto",
++ "customer_pay_per_conversion_eligibility_failure_reason.proto",
++ "customer_status.proto",
++ "customizer_attribute_status.proto",
++ "customizer_attribute_type.proto",
++ "customizer_value_status.proto",
++ "data_driven_model_status.proto",
++ "day_of_week.proto",
++ "device.proto",
++ "display_ad_format_setting.proto",
++ "display_upload_product_type.proto",
++ "distance_bucket.proto",
++ "dsa_page_feed_criterion_field.proto",
++ "education_placeholder_field.proto",
++ "experiment_metric.proto",
++ "experiment_metric_direction.proto",
++ "experiment_status.proto",
++ "experiment_type.proto",
++ "extension_setting_device.proto",
++ "extension_type.proto",
++ "external_conversion_source.proto",
++ "feed_attribute_type.proto",
++ "feed_item_quality_approval_status.proto",
++ "feed_item_quality_disapproval_reason.proto",
++ "feed_item_set_status.proto",
++ "feed_item_set_string_filter_type.proto",
++ "feed_item_status.proto",
++ "feed_item_target_device.proto",
++ "feed_item_target_status.proto",
++ "feed_item_target_type.proto",
++ "feed_item_validation_status.proto",
++ "feed_link_status.proto",
++ "feed_mapping_criterion_type.proto",
++ "feed_mapping_status.proto",
++ "feed_origin.proto",
++ "feed_status.proto",
++ "flight_placeholder_field.proto",
++ "frequency_cap_event_type.proto",
++ "frequency_cap_level.proto",
++ "frequency_cap_time_unit.proto",
++ "gender_type.proto",
++ "geo_target_constant_status.proto",
++ "geo_targeting_restriction.proto",
++ "geo_targeting_type.proto",
++ "goal_config_level.proto",
++ "google_ads_field_category.proto",
++ "google_ads_field_data_type.proto",
++ "google_voice_call_status.proto",
++ "hotel_date_selection_type.proto",
++ "hotel_placeholder_field.proto",
++ "hotel_price_bucket.proto",
++ "hotel_rate_type.proto",
++ "hotel_reconciliation_status.proto",
++ "image_placeholder_field.proto",
++ "income_range_type.proto",
++ "interaction_event_type.proto",
++ "interaction_type.proto",
++ "invoice_type.proto",
++ "job_placeholder_field.proto",
++ "keyword_match_type.proto",
++ "keyword_plan_aggregate_metric_type.proto",
++ "keyword_plan_competition_level.proto",
++ "keyword_plan_concept_group_type.proto",
++ "keyword_plan_forecast_interval.proto",
++ "keyword_plan_keyword_annotation.proto",
++ "keyword_plan_network.proto",
++ "label_status.proto",
++ "lead_form_call_to_action_type.proto",
++ "lead_form_desired_intent.proto",
++ "lead_form_field_user_input_type.proto",
++ "lead_form_post_submit_call_to_action_type.proto",
++ "legacy_app_install_ad_app_store.proto",
++ "linked_account_type.proto",
++ "listing_group_filter_bidding_category_level.proto",
++ "listing_group_filter_custom_attribute_index.proto",
++ "listing_group_filter_product_channel.proto",
++ "listing_group_filter_product_condition.proto",
++ "listing_group_filter_product_type_level.proto",
++ "listing_group_filter_type_enum.proto",
++ "listing_group_filter_vertical.proto",
++ "listing_group_type.proto",
++ "local_placeholder_field.proto",
++ "location_extension_targeting_criterion_field.proto",
++ "location_group_radius_units.proto",
++ "location_placeholder_field.proto",
++ "location_source_type.proto",
++ "manager_link_status.proto",
++ "matching_function_context_type.proto",
++ "matching_function_operator.proto",
++ "media_type.proto",
++ "merchant_center_link_status.proto",
++ "message_placeholder_field.proto",
++ "mime_type.proto",
++ "minute_of_hour.proto",
++ "mobile_app_vendor.proto",
++ "mobile_device_type.proto",
++ "month_of_year.proto",
++ "negative_geo_target_type.proto",
++ "offline_user_data_job_failure_reason.proto",
++ "offline_user_data_job_match_rate_range.proto",
++ "offline_user_data_job_status.proto",
++ "offline_user_data_job_type.proto",
++ "operating_system_version_operator_type.proto",
++ "optimization_goal_type.proto",
++ "parental_status_type.proto",
++ "payment_mode.proto",
++ "placeholder_type.proto",
++ "placement_type.proto",
++ "policy_approval_status.proto",
++ "policy_review_status.proto",
++ "policy_topic_entry_type.proto",
++ "policy_topic_evidence_destination_mismatch_url_type.proto",
++ "policy_topic_evidence_destination_not_working_device.proto",
++ "policy_topic_evidence_destination_not_working_dns_error_type.proto",
++ "positive_geo_target_type.proto",
++ "preferred_content_type.proto",
++ "price_extension_price_qualifier.proto",
++ "price_extension_price_unit.proto",
++ "price_extension_type.proto",
++ "price_placeholder_field.proto",
++ "product_bidding_category_level.proto",
++ "product_bidding_category_status.proto",
++ "product_channel.proto",
++ "product_channel_exclusivity.proto",
++ "product_condition.proto",
++ "product_custom_attribute_index.proto",
++ "product_type_level.proto",
++ "promotion_extension_discount_modifier.proto",
++ "promotion_extension_occasion.proto",
++ "promotion_placeholder_field.proto",
++ "proximity_radius_units.proto",
++ "quality_score_bucket.proto",
++ "reach_plan_ad_length.proto",
++ "reach_plan_age_range.proto",
++ "reach_plan_network.proto",
++ "real_estate_placeholder_field.proto",
++ "recommendation_type.proto",
++ "resource_change_operation.proto",
++ "resource_limit_type.proto",
++ "response_content_type.proto",
++ "search_engine_results_page_type.proto",
++ "search_term_match_type.proto",
++ "search_term_targeting_status.proto",
++ "seasonality_event_scope.proto",
++ "seasonality_event_status.proto",
++ "served_asset_field_type.proto",
++ "shared_set_status.proto",
++ "shared_set_type.proto",
++ "simulation_modification_method.proto",
++ "simulation_type.proto",
++ "sitelink_placeholder_field.proto",
++ "sk_ad_network_ad_event_type.proto",
++ "sk_ad_network_attribution_credit.proto",
++ "sk_ad_network_user_type.proto",
++ "slot.proto",
++ "spending_limit_type.proto",
++ "structured_snippet_placeholder_field.proto",
++ "summary_row_setting.proto",
++ "system_managed_entity_source.proto",
++ "target_cpa_opt_in_recommendation_goal.proto",
++ "target_impression_share_location.proto",
++ "targeting_dimension.proto",
++ "time_type.proto",
++ "tracking_code_page_format.proto",
++ "tracking_code_type.proto",
++ "travel_placeholder_field.proto",
++ "user_identifier_source.proto",
++ "user_interest_taxonomy_type.proto",
++ "user_list_access_status.proto",
++ "user_list_closing_reason.proto",
++ "user_list_combined_rule_operator.proto",
++ "user_list_crm_data_source_type.proto",
++ "user_list_date_rule_item_operator.proto",
++ "user_list_logical_rule_operator.proto",
++ "user_list_membership_status.proto",
++ "user_list_number_rule_item_operator.proto",
++ "user_list_prepopulation_status.proto",
++ "user_list_rule_type.proto",
++ "user_list_size_range.proto",
++ "user_list_string_rule_item_operator.proto",
++ "user_list_type.proto",
++ "value_rule_device_type.proto",
++ "value_rule_geo_location_match_type.proto",
++ "value_rule_operation.proto",
++ "value_rule_set_attachment_type.proto",
++ "value_rule_set_dimension.proto",
++ "vanity_pharma_display_url_mode.proto",
++ "vanity_pharma_text.proto",
++ "video_thumbnail.proto",
++ "webpage_condition_operand.proto",
++ "webpage_condition_operator.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "enums_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/ads/googleads/v10/enums",
++ proto = ":enums_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/ads/googleads/v10/errors/BUILD.bazel d/google/ads/googleads/v10/errors/BUILD.bazel
+--- c/google/ads/googleads/v10/errors/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/googleads/v10/errors/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,165 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "errors_proto",
++ srcs = [
++ "access_invitation_error.proto",
++ "account_budget_proposal_error.proto",
++ "account_link_error.proto",
++ "ad_customizer_error.proto",
++ "ad_error.proto",
++ "ad_group_ad_error.proto",
++ "ad_group_bid_modifier_error.proto",
++ "ad_group_criterion_customizer_error.proto",
++ "ad_group_criterion_error.proto",
++ "ad_group_customizer_error.proto",
++ "ad_group_error.proto",
++ "ad_group_feed_error.proto",
++ "ad_parameter_error.proto",
++ "ad_sharing_error.proto",
++ "adx_error.proto",
++ "asset_error.proto",
++ "asset_group_asset_error.proto",
++ "asset_group_error.proto",
++ "asset_group_listing_group_filter_error.proto",
++ "asset_link_error.proto",
++ "asset_set_asset_error.proto",
++ "asset_set_error.proto",
++ "asset_set_link_error.proto",
++ "audience_error.proto",
++ "authentication_error.proto",
++ "authorization_error.proto",
++ "batch_job_error.proto",
++ "bidding_error.proto",
++ "bidding_strategy_error.proto",
++ "billing_setup_error.proto",
++ "campaign_budget_error.proto",
++ "campaign_conversion_goal_error.proto",
++ "campaign_criterion_error.proto",
++ "campaign_customizer_error.proto",
++ "campaign_draft_error.proto",
++ "campaign_error.proto",
++ "campaign_experiment_error.proto",
++ "campaign_feed_error.proto",
++ "campaign_shared_set_error.proto",
++ "change_event_error.proto",
++ "change_status_error.proto",
++ "collection_size_error.proto",
++ "context_error.proto",
++ "conversion_action_error.proto",
++ "conversion_adjustment_upload_error.proto",
++ "conversion_custom_variable_error.proto",
++ "conversion_goal_campaign_config_error.proto",
++ "conversion_upload_error.proto",
++ "conversion_value_rule_error.proto",
++ "conversion_value_rule_set_error.proto",
++ "country_code_error.proto",
++ "criterion_error.proto",
++ "currency_code_error.proto",
++ "custom_audience_error.proto",
++ "custom_conversion_goal_error.proto",
++ "custom_interest_error.proto",
++ "customer_client_link_error.proto",
++ "customer_customizer_error.proto",
++ "customer_error.proto",
++ "customer_feed_error.proto",
++ "customer_manager_link_error.proto",
++ "customer_user_access_error.proto",
++ "customizer_attribute_error.proto",
++ "database_error.proto",
++ "date_error.proto",
++ "date_range_error.proto",
++ "distinct_error.proto",
++ "enum_error.proto",
++ "errors.proto",
++ "experiment_arm_error.proto",
++ "experiment_error.proto",
++ "extension_feed_item_error.proto",
++ "extension_setting_error.proto",
++ "feed_attribute_reference_error.proto",
++ "feed_error.proto",
++ "feed_item_error.proto",
++ "feed_item_set_error.proto",
++ "feed_item_set_link_error.proto",
++ "feed_item_target_error.proto",
++ "feed_item_validation_error.proto",
++ "feed_mapping_error.proto",
++ "field_error.proto",
++ "field_mask_error.proto",
++ "function_error.proto",
++ "function_parsing_error.proto",
++ "geo_target_constant_suggestion_error.proto",
++ "header_error.proto",
++ "id_error.proto",
++ "image_error.proto",
++ "internal_error.proto",
++ "invoice_error.proto",
++ "keyword_plan_ad_group_error.proto",
++ "keyword_plan_ad_group_keyword_error.proto",
++ "keyword_plan_campaign_error.proto",
++ "keyword_plan_campaign_keyword_error.proto",
++ "keyword_plan_error.proto",
++ "keyword_plan_idea_error.proto",
++ "label_error.proto",
++ "language_code_error.proto",
++ "list_operation_error.proto",
++ "manager_link_error.proto",
++ "media_bundle_error.proto",
++ "media_file_error.proto",
++ "media_upload_error.proto",
++ "merchant_center_error.proto",
++ "multiplier_error.proto",
++ "mutate_error.proto",
++ "new_resource_creation_error.proto",
++ "not_allowlisted_error.proto",
++ "not_empty_error.proto",
++ "null_error.proto",
++ "offline_user_data_job_error.proto",
++ "operation_access_denied_error.proto",
++ "operator_error.proto",
++ "partial_failure_error.proto",
++ "payments_account_error.proto",
++ "policy_finding_error.proto",
++ "policy_validation_parameter_error.proto",
++ "policy_violation_error.proto",
++ "query_error.proto",
++ "quota_error.proto",
++ "range_error.proto",
++ "reach_plan_error.proto",
++ "recommendation_error.proto",
++ "region_code_error.proto",
++ "request_error.proto",
++ "resource_access_denied_error.proto",
++ "resource_count_limit_exceeded_error.proto",
++ "setting_error.proto",
++ "shared_criterion_error.proto",
++ "shared_set_error.proto",
++ "size_limit_error.proto",
++ "string_format_error.proto",
++ "string_length_error.proto",
++ "third_party_app_analytics_link_error.proto",
++ "time_zone_error.proto",
++ "url_field_error.proto",
++ "user_data_error.proto",
++ "user_list_error.proto",
++ "youtube_video_registration_error.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v10/common:common_proto",
++ "//google/ads/googleads/v10/enums:enums_proto",
++ "@com_google_protobuf//:duration_proto",
++ ],
++)
++
++go_proto_library(
++ name = "errors_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/ads/googleads/v10/errors",
++ proto = ":errors_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v10/common:common_go_proto",
++ "//google/ads/googleads/v10/enums:enums_go_proto",
++ ],
++)
+diff -urN c/google/ads/googleads/v10/resources/BUILD.bazel d/google/ads/googleads/v10/resources/BUILD.bazel
+--- c/google/ads/googleads/v10/resources/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/googleads/v10/resources/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,185 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "resources_proto",
++ srcs = [
++ "accessible_bidding_strategy.proto",
++ "account_budget.proto",
++ "account_budget_proposal.proto",
++ "account_link.proto",
++ "ad.proto",
++ "ad_group.proto",
++ "ad_group_ad.proto",
++ "ad_group_ad_asset_combination_view.proto",
++ "ad_group_ad_asset_view.proto",
++ "ad_group_ad_label.proto",
++ "ad_group_asset.proto",
++ "ad_group_audience_view.proto",
++ "ad_group_bid_modifier.proto",
++ "ad_group_criterion.proto",
++ "ad_group_criterion_customizer.proto",
++ "ad_group_criterion_label.proto",
++ "ad_group_criterion_simulation.proto",
++ "ad_group_customizer.proto",
++ "ad_group_extension_setting.proto",
++ "ad_group_feed.proto",
++ "ad_group_label.proto",
++ "ad_group_simulation.proto",
++ "ad_parameter.proto",
++ "ad_schedule_view.proto",
++ "age_range_view.proto",
++ "asset.proto",
++ "asset_field_type_view.proto",
++ "asset_group.proto",
++ "asset_group_asset.proto",
++ "asset_group_listing_group_filter.proto",
++ "asset_group_product_group_view.proto",
++ "asset_group_signal.proto",
++ "asset_set.proto",
++ "asset_set_asset.proto",
++ "audience.proto",
++ "batch_job.proto",
++ "bidding_data_exclusion.proto",
++ "bidding_seasonality_adjustment.proto",
++ "bidding_strategy.proto",
++ "bidding_strategy_simulation.proto",
++ "billing_setup.proto",
++ "call_view.proto",
++ "campaign.proto",
++ "campaign_asset.proto",
++ "campaign_asset_set.proto",
++ "campaign_audience_view.proto",
++ "campaign_bid_modifier.proto",
++ "campaign_budget.proto",
++ "campaign_conversion_goal.proto",
++ "campaign_criterion.proto",
++ "campaign_criterion_simulation.proto",
++ "campaign_customizer.proto",
++ "campaign_draft.proto",
++ "campaign_experiment.proto",
++ "campaign_extension_setting.proto",
++ "campaign_feed.proto",
++ "campaign_group.proto",
++ "campaign_label.proto",
++ "campaign_shared_set.proto",
++ "campaign_simulation.proto",
++ "carrier_constant.proto",
++ "change_event.proto",
++ "change_status.proto",
++ "click_view.proto",
++ "combined_audience.proto",
++ "conversion_action.proto",
++ "conversion_custom_variable.proto",
++ "conversion_goal_campaign_config.proto",
++ "conversion_value_rule.proto",
++ "conversion_value_rule_set.proto",
++ "currency_constant.proto",
++ "custom_audience.proto",
++ "custom_conversion_goal.proto",
++ "custom_interest.proto",
++ "customer.proto",
++ "customer_asset.proto",
++ "customer_client.proto",
++ "customer_client_link.proto",
++ "customer_conversion_goal.proto",
++ "customer_customizer.proto",
++ "customer_extension_setting.proto",
++ "customer_feed.proto",
++ "customer_label.proto",
++ "customer_manager_link.proto",
++ "customer_negative_criterion.proto",
++ "customer_user_access.proto",
++ "customer_user_access_invitation.proto",
++ "customizer_attribute.proto",
++ "detail_placement_view.proto",
++ "detailed_demographic.proto",
++ "display_keyword_view.proto",
++ "distance_view.proto",
++ "domain_category.proto",
++ "dynamic_search_ads_search_term_view.proto",
++ "expanded_landing_page_view.proto",
++ "experiment.proto",
++ "experiment_arm.proto",
++ "extension_feed_item.proto",
++ "feed.proto",
++ "feed_item.proto",
++ "feed_item_set.proto",
++ "feed_item_set_link.proto",
++ "feed_item_target.proto",
++ "feed_mapping.proto",
++ "feed_placeholder_view.proto",
++ "gender_view.proto",
++ "geo_target_constant.proto",
++ "geographic_view.proto",
++ "google_ads_field.proto",
++ "group_placement_view.proto",
++ "hotel_group_view.proto",
++ "hotel_performance_view.proto",
++ "hotel_reconciliation.proto",
++ "income_range_view.proto",
++ "invoice.proto",
++ "keyword_plan.proto",
++ "keyword_plan_ad_group.proto",
++ "keyword_plan_ad_group_keyword.proto",
++ "keyword_plan_campaign.proto",
++ "keyword_plan_campaign_keyword.proto",
++ "keyword_theme_constant.proto",
++ "keyword_view.proto",
++ "label.proto",
++ "landing_page_view.proto",
++ "language_constant.proto",
++ "lead_form_submission_data.proto",
++ "life_event.proto",
++ "location_view.proto",
++ "managed_placement_view.proto",
++ "media_file.proto",
++ "merchant_center_link.proto",
++ "mobile_app_category_constant.proto",
++ "mobile_device_constant.proto",
++ "offline_user_data_job.proto",
++ "operating_system_version_constant.proto",
++ "paid_organic_search_term_view.proto",
++ "parental_status_view.proto",
++ "payments_account.proto",
++ "product_bidding_category_constant.proto",
++ "product_group_view.proto",
++ "recommendation.proto",
++ "remarketing_action.proto",
++ "search_term_view.proto",
++ "shared_criterion.proto",
++ "shared_set.proto",
++ "shopping_performance_view.proto",
++ "smart_campaign_search_term_view.proto",
++ "smart_campaign_setting.proto",
++ "third_party_app_analytics_link.proto",
++ "topic_constant.proto",
++ "topic_view.proto",
++ "user_interest.proto",
++ "user_list.proto",
++ "user_location_view.proto",
++ "video.proto",
++ "webpage_view.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v10/common:common_proto",
++ "//google/ads/googleads/v10/enums:enums_proto",
++ "//google/ads/googleads/v10/errors:errors_proto",
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "resources_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/ads/googleads/v10/resources",
++ proto = ":resources_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v10/common:common_go_proto",
++ "//google/ads/googleads/v10/enums:enums_go_proto",
++ "//google/ads/googleads/v10/errors:errors_go_proto",
++ "//google/api:annotations_go_proto",
++ ],
++)
+diff -urN c/google/ads/googleads/v10/services/BUILD.bazel d/google/ads/googleads/v10/services/BUILD.bazel
+--- c/google/ads/googleads/v10/services/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/googleads/v10/services/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,137 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "services_proto",
++ srcs = [
++ "account_budget_proposal_service.proto",
++ "account_link_service.proto",
++ "ad_group_ad_label_service.proto",
++ "ad_group_ad_service.proto",
++ "ad_group_asset_service.proto",
++ "ad_group_bid_modifier_service.proto",
++ "ad_group_criterion_customizer_service.proto",
++ "ad_group_criterion_label_service.proto",
++ "ad_group_criterion_service.proto",
++ "ad_group_customizer_service.proto",
++ "ad_group_extension_setting_service.proto",
++ "ad_group_feed_service.proto",
++ "ad_group_label_service.proto",
++ "ad_group_service.proto",
++ "ad_parameter_service.proto",
++ "ad_service.proto",
++ "asset_group_asset_service.proto",
++ "asset_group_listing_group_filter_service.proto",
++ "asset_group_service.proto",
++ "asset_group_signal_service.proto",
++ "asset_service.proto",
++ "asset_set_asset_service.proto",
++ "asset_set_service.proto",
++ "audience_service.proto",
++ "batch_job_service.proto",
++ "bidding_data_exclusion_service.proto",
++ "bidding_seasonality_adjustment_service.proto",
++ "bidding_strategy_service.proto",
++ "billing_setup_service.proto",
++ "campaign_asset_service.proto",
++ "campaign_asset_set_service.proto",
++ "campaign_bid_modifier_service.proto",
++ "campaign_budget_service.proto",
++ "campaign_conversion_goal_service.proto",
++ "campaign_criterion_service.proto",
++ "campaign_customizer_service.proto",
++ "campaign_draft_service.proto",
++ "campaign_experiment_service.proto",
++ "campaign_extension_setting_service.proto",
++ "campaign_feed_service.proto",
++ "campaign_group_service.proto",
++ "campaign_label_service.proto",
++ "campaign_service.proto",
++ "campaign_shared_set_service.proto",
++ "conversion_action_service.proto",
++ "conversion_adjustment_upload_service.proto",
++ "conversion_custom_variable_service.proto",
++ "conversion_goal_campaign_config_service.proto",
++ "conversion_upload_service.proto",
++ "conversion_value_rule_service.proto",
++ "conversion_value_rule_set_service.proto",
++ "custom_audience_service.proto",
++ "custom_conversion_goal_service.proto",
++ "custom_interest_service.proto",
++ "customer_asset_service.proto",
++ "customer_client_link_service.proto",
++ "customer_conversion_goal_service.proto",
++ "customer_customizer_service.proto",
++ "customer_extension_setting_service.proto",
++ "customer_feed_service.proto",
++ "customer_label_service.proto",
++ "customer_manager_link_service.proto",
++ "customer_negative_criterion_service.proto",
++ "customer_service.proto",
++ "customer_user_access_invitation_service.proto",
++ "customer_user_access_service.proto",
++ "customizer_attribute_service.proto",
++ "experiment_arm_service.proto",
++ "experiment_service.proto",
++ "extension_feed_item_service.proto",
++ "feed_item_service.proto",
++ "feed_item_set_link_service.proto",
++ "feed_item_set_service.proto",
++ "feed_item_target_service.proto",
++ "feed_mapping_service.proto",
++ "feed_service.proto",
++ "geo_target_constant_service.proto",
++ "google_ads_field_service.proto",
++ "google_ads_service.proto",
++ "invoice_service.proto",
++ "keyword_plan_ad_group_keyword_service.proto",
++ "keyword_plan_ad_group_service.proto",
++ "keyword_plan_campaign_keyword_service.proto",
++ "keyword_plan_campaign_service.proto",
++ "keyword_plan_idea_service.proto",
++ "keyword_plan_service.proto",
++ "keyword_theme_constant_service.proto",
++ "label_service.proto",
++ "media_file_service.proto",
++ "merchant_center_link_service.proto",
++ "offline_user_data_job_service.proto",
++ "payments_account_service.proto",
++ "reach_plan_service.proto",
++ "recommendation_service.proto",
++ "remarketing_action_service.proto",
++ "shared_criterion_service.proto",
++ "shared_set_service.proto",
++ "smart_campaign_setting_service.proto",
++ "smart_campaign_suggest_service.proto",
++ "third_party_app_analytics_link_service.proto",
++ "user_data_service.proto",
++ "user_list_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v10/common:common_proto",
++ "//google/ads/googleads/v10/enums:enums_proto",
++ "//google/ads/googleads/v10/resources:resources_proto",
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "services_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/ads/googleads/v10/services",
++ proto = ":services_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v10/common:common_go_proto",
++ "//google/ads/googleads/v10/enums:enums_go_proto",
++ "//google/ads/googleads/v10/resources:resources_go_proto",
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/ads/googleads/v11/common/BUILD.bazel d/google/ads/googleads/v11/common/BUILD.bazel
+--- c/google/ads/googleads/v11/common/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/googleads/v11/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,59 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "common_proto",
++ srcs = [
++ "ad_asset.proto",
++ "ad_type_infos.proto",
++ "asset_policy.proto",
++ "asset_types.proto",
++ "asset_usage.proto",
++ "audiences.proto",
++ "bidding.proto",
++ "click_location.proto",
++ "criteria.proto",
++ "criterion_category_availability.proto",
++ "custom_parameter.proto",
++ "customizer_value.proto",
++ "dates.proto",
++ "explorer_auto_optimizer_setting.proto",
++ "extensions.proto",
++ "feed_common.proto",
++ "feed_item_set_filter_type_infos.proto",
++ "final_app_url.proto",
++ "frequency_cap.proto",
++ "keyword_plan_common.proto",
++ "matching_function.proto",
++ "metric_goal.proto",
++ "metrics.proto",
++ "offline_user_data.proto",
++ "policy.proto",
++ "policy_summary.proto",
++ "real_time_bidding_setting.proto",
++ "segments.proto",
++ "simulation.proto",
++ "tag_snippet.proto",
++ "targeting_setting.proto",
++ "text_label.proto",
++ "url_collection.proto",
++ "user_lists.proto",
++ "value.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v11/enums:enums_proto",
++ "//google/api:annotations_proto",
++ ],
++)
++
++go_proto_library(
++ name = "common_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/ads/googleads/v11/common",
++ proto = ":common_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v11/enums:enums_go_proto",
++ "//google/api:annotations_go_proto",
++ ],
++)
+diff -urN c/google/ads/googleads/v11/enums/BUILD.bazel d/google/ads/googleads/v11/enums/BUILD.bazel
+--- c/google/ads/googleads/v11/enums/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/googleads/v11/enums/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,315 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "enums_proto",
++ srcs = [
++ "access_invitation_status.proto",
++ "access_reason.proto",
++ "access_role.proto",
++ "account_budget_proposal_status.proto",
++ "account_budget_proposal_type.proto",
++ "account_budget_status.proto",
++ "account_link_status.proto",
++ "ad_customizer_placeholder_field.proto",
++ "ad_destination_type.proto",
++ "ad_group_ad_rotation_mode.proto",
++ "ad_group_ad_status.proto",
++ "ad_group_criterion_approval_status.proto",
++ "ad_group_criterion_status.proto",
++ "ad_group_status.proto",
++ "ad_group_type.proto",
++ "ad_network_type.proto",
++ "ad_serving_optimization_status.proto",
++ "ad_strength.proto",
++ "ad_type.proto",
++ "advertising_channel_sub_type.proto",
++ "advertising_channel_type.proto",
++ "affiliate_location_feed_relationship_type.proto",
++ "affiliate_location_placeholder_field.proto",
++ "age_range_type.proto",
++ "app_campaign_app_store.proto",
++ "app_campaign_bidding_strategy_goal_type.proto",
++ "app_payment_model_type.proto",
++ "app_placeholder_field.proto",
++ "app_store.proto",
++ "app_url_operating_system_type.proto",
++ "asset_field_type.proto",
++ "asset_group_status.proto",
++ "asset_link_status.proto",
++ "asset_performance_label.proto",
++ "asset_set_asset_status.proto",
++ "asset_set_link_status.proto",
++ "asset_set_status.proto",
++ "asset_set_type.proto",
++ "asset_source.proto",
++ "asset_type.proto",
++ "async_action_status.proto",
++ "attribution_model.proto",
++ "audience_insights_dimension.proto",
++ "audience_status.proto",
++ "batch_job_status.proto",
++ "bid_modifier_source.proto",
++ "bidding_source.proto",
++ "bidding_strategy_status.proto",
++ "bidding_strategy_system_status.proto",
++ "bidding_strategy_type.proto",
++ "billing_setup_status.proto",
++ "brand_safety_suitability.proto",
++ "budget_campaign_association_status.proto",
++ "budget_delivery_method.proto",
++ "budget_period.proto",
++ "budget_status.proto",
++ "budget_type.proto",
++ "call_conversion_reporting_state.proto",
++ "call_placeholder_field.proto",
++ "call_to_action_type.proto",
++ "call_tracking_display_location.proto",
++ "call_type.proto",
++ "callout_placeholder_field.proto",
++ "campaign_criterion_status.proto",
++ "campaign_draft_status.proto",
++ "campaign_experiment_status.proto",
++ "campaign_experiment_traffic_split_type.proto",
++ "campaign_experiment_type.proto",
++ "campaign_group_status.proto",
++ "campaign_serving_status.proto",
++ "campaign_shared_set_status.proto",
++ "campaign_status.proto",
++ "change_client_type.proto",
++ "change_event_resource_type.proto",
++ "change_status_operation.proto",
++ "change_status_resource_type.proto",
++ "click_type.proto",
++ "combined_audience_status.proto",
++ "content_label_type.proto",
++ "conversion_action_category.proto",
++ "conversion_action_counting_type.proto",
++ "conversion_action_status.proto",
++ "conversion_action_type.proto",
++ "conversion_adjustment_type.proto",
++ "conversion_attribution_event_type.proto",
++ "conversion_custom_variable_status.proto",
++ "conversion_environment_enum.proto",
++ "conversion_lag_bucket.proto",
++ "conversion_or_adjustment_lag_bucket.proto",
++ "conversion_origin.proto",
++ "conversion_tracking_status_enum.proto",
++ "conversion_value_rule_primary_dimension.proto",
++ "conversion_value_rule_set_status.proto",
++ "conversion_value_rule_status.proto",
++ "criterion_category_channel_availability_mode.proto",
++ "criterion_category_locale_availability_mode.proto",
++ "criterion_system_serving_status.proto",
++ "criterion_type.proto",
++ "custom_audience_member_type.proto",
++ "custom_audience_status.proto",
++ "custom_audience_type.proto",
++ "custom_conversion_goal_status.proto",
++ "custom_interest_member_type.proto",
++ "custom_interest_status.proto",
++ "custom_interest_type.proto",
++ "custom_placeholder_field.proto",
++ "customer_match_upload_key_type.proto",
++ "customer_pay_per_conversion_eligibility_failure_reason.proto",
++ "customer_status.proto",
++ "customizer_attribute_status.proto",
++ "customizer_attribute_type.proto",
++ "customizer_value_status.proto",
++ "data_driven_model_status.proto",
++ "day_of_week.proto",
++ "device.proto",
++ "display_ad_format_setting.proto",
++ "display_upload_product_type.proto",
++ "distance_bucket.proto",
++ "dsa_page_feed_criterion_field.proto",
++ "education_placeholder_field.proto",
++ "experiment_metric.proto",
++ "experiment_metric_direction.proto",
++ "experiment_status.proto",
++ "experiment_type.proto",
++ "extension_setting_device.proto",
++ "extension_type.proto",
++ "external_conversion_source.proto",
++ "feed_attribute_type.proto",
++ "feed_item_quality_approval_status.proto",
++ "feed_item_quality_disapproval_reason.proto",
++ "feed_item_set_status.proto",
++ "feed_item_set_string_filter_type.proto",
++ "feed_item_status.proto",
++ "feed_item_target_device.proto",
++ "feed_item_target_status.proto",
++ "feed_item_target_type.proto",
++ "feed_item_validation_status.proto",
++ "feed_link_status.proto",
++ "feed_mapping_criterion_type.proto",
++ "feed_mapping_status.proto",
++ "feed_origin.proto",
++ "feed_status.proto",
++ "flight_placeholder_field.proto",
++ "frequency_cap_event_type.proto",
++ "frequency_cap_level.proto",
++ "frequency_cap_time_unit.proto",
++ "gender_type.proto",
++ "geo_target_constant_status.proto",
++ "geo_targeting_restriction.proto",
++ "geo_targeting_type.proto",
++ "goal_config_level.proto",
++ "google_ads_field_category.proto",
++ "google_ads_field_data_type.proto",
++ "google_voice_call_status.proto",
++ "hotel_date_selection_type.proto",
++ "hotel_placeholder_field.proto",
++ "hotel_price_bucket.proto",
++ "hotel_rate_type.proto",
++ "hotel_reconciliation_status.proto",
++ "image_placeholder_field.proto",
++ "income_range_type.proto",
++ "interaction_event_type.proto",
++ "interaction_type.proto",
++ "invoice_type.proto",
++ "job_placeholder_field.proto",
++ "keyword_match_type.proto",
++ "keyword_plan_aggregate_metric_type.proto",
++ "keyword_plan_competition_level.proto",
++ "keyword_plan_concept_group_type.proto",
++ "keyword_plan_forecast_interval.proto",
++ "keyword_plan_keyword_annotation.proto",
++ "keyword_plan_network.proto",
++ "label_status.proto",
++ "lead_form_call_to_action_type.proto",
++ "lead_form_desired_intent.proto",
++ "lead_form_field_user_input_type.proto",
++ "lead_form_post_submit_call_to_action_type.proto",
++ "legacy_app_install_ad_app_store.proto",
++ "linked_account_type.proto",
++ "listing_group_filter_bidding_category_level.proto",
++ "listing_group_filter_custom_attribute_index.proto",
++ "listing_group_filter_product_channel.proto",
++ "listing_group_filter_product_condition.proto",
++ "listing_group_filter_product_type_level.proto",
++ "listing_group_filter_type_enum.proto",
++ "listing_group_filter_vertical.proto",
++ "listing_group_type.proto",
++ "local_placeholder_field.proto",
++ "location_extension_targeting_criterion_field.proto",
++ "location_group_radius_units.proto",
++ "location_placeholder_field.proto",
++ "location_source_type.proto",
++ "manager_link_status.proto",
++ "matching_function_context_type.proto",
++ "matching_function_operator.proto",
++ "media_type.proto",
++ "merchant_center_link_status.proto",
++ "message_placeholder_field.proto",
++ "mime_type.proto",
++ "minute_of_hour.proto",
++ "mobile_app_vendor.proto",
++ "mobile_device_type.proto",
++ "month_of_year.proto",
++ "negative_geo_target_type.proto",
++ "offline_user_data_job_failure_reason.proto",
++ "offline_user_data_job_match_rate_range.proto",
++ "offline_user_data_job_status.proto",
++ "offline_user_data_job_type.proto",
++ "operating_system_version_operator_type.proto",
++ "optimization_goal_type.proto",
++ "parental_status_type.proto",
++ "payment_mode.proto",
++ "performance_max_upgrade_status.proto",
++ "placeholder_type.proto",
++ "placement_type.proto",
++ "policy_approval_status.proto",
++ "policy_review_status.proto",
++ "policy_topic_entry_type.proto",
++ "policy_topic_evidence_destination_mismatch_url_type.proto",
++ "policy_topic_evidence_destination_not_working_device.proto",
++ "policy_topic_evidence_destination_not_working_dns_error_type.proto",
++ "positive_geo_target_type.proto",
++ "preferred_content_type.proto",
++ "price_extension_price_qualifier.proto",
++ "price_extension_price_unit.proto",
++ "price_extension_type.proto",
++ "price_placeholder_field.proto",
++ "product_bidding_category_level.proto",
++ "product_bidding_category_status.proto",
++ "product_channel.proto",
++ "product_channel_exclusivity.proto",
++ "product_condition.proto",
++ "product_custom_attribute_index.proto",
++ "product_type_level.proto",
++ "promotion_extension_discount_modifier.proto",
++ "promotion_extension_occasion.proto",
++ "promotion_placeholder_field.proto",
++ "proximity_radius_units.proto",
++ "quality_score_bucket.proto",
++ "reach_plan_ad_length.proto",
++ "reach_plan_age_range.proto",
++ "reach_plan_network.proto",
++ "real_estate_placeholder_field.proto",
++ "recommendation_type.proto",
++ "resource_change_operation.proto",
++ "resource_limit_type.proto",
++ "response_content_type.proto",
++ "search_engine_results_page_type.proto",
++ "search_term_match_type.proto",
++ "search_term_targeting_status.proto",
++ "seasonality_event_scope.proto",
++ "seasonality_event_status.proto",
++ "served_asset_field_type.proto",
++ "shared_set_status.proto",
++ "shared_set_type.proto",
++ "simulation_modification_method.proto",
++ "simulation_type.proto",
++ "sitelink_placeholder_field.proto",
++ "sk_ad_network_ad_event_type.proto",
++ "sk_ad_network_attribution_credit.proto",
++ "sk_ad_network_user_type.proto",
++ "slot.proto",
++ "spending_limit_type.proto",
++ "structured_snippet_placeholder_field.proto",
++ "summary_row_setting.proto",
++ "system_managed_entity_source.proto",
++ "target_cpa_opt_in_recommendation_goal.proto",
++ "target_impression_share_location.proto",
++ "targeting_dimension.proto",
++ "time_type.proto",
++ "tracking_code_page_format.proto",
++ "tracking_code_type.proto",
++ "travel_placeholder_field.proto",
++ "user_identifier_source.proto",
++ "user_interest_taxonomy_type.proto",
++ "user_list_access_status.proto",
++ "user_list_closing_reason.proto",
++ "user_list_combined_rule_operator.proto",
++ "user_list_crm_data_source_type.proto",
++ "user_list_date_rule_item_operator.proto",
++ "user_list_flexible_rule_operator.proto",
++ "user_list_logical_rule_operator.proto",
++ "user_list_membership_status.proto",
++ "user_list_number_rule_item_operator.proto",
++ "user_list_prepopulation_status.proto",
++ "user_list_rule_type.proto",
++ "user_list_size_range.proto",
++ "user_list_string_rule_item_operator.proto",
++ "user_list_type.proto",
++ "value_rule_device_type.proto",
++ "value_rule_geo_location_match_type.proto",
++ "value_rule_operation.proto",
++ "value_rule_set_attachment_type.proto",
++ "value_rule_set_dimension.proto",
++ "vanity_pharma_display_url_mode.proto",
++ "vanity_pharma_text.proto",
++ "video_thumbnail.proto",
++ "webpage_condition_operand.proto",
++ "webpage_condition_operator.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "enums_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/ads/googleads/v11/enums",
++ proto = ":enums_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/ads/googleads/v11/errors/BUILD.bazel d/google/ads/googleads/v11/errors/BUILD.bazel
+--- c/google/ads/googleads/v11/errors/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/googleads/v11/errors/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,166 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "errors_proto",
++ srcs = [
++ "access_invitation_error.proto",
++ "account_budget_proposal_error.proto",
++ "account_link_error.proto",
++ "ad_customizer_error.proto",
++ "ad_error.proto",
++ "ad_group_ad_error.proto",
++ "ad_group_bid_modifier_error.proto",
++ "ad_group_criterion_customizer_error.proto",
++ "ad_group_criterion_error.proto",
++ "ad_group_customizer_error.proto",
++ "ad_group_error.proto",
++ "ad_group_feed_error.proto",
++ "ad_parameter_error.proto",
++ "ad_sharing_error.proto",
++ "adx_error.proto",
++ "asset_error.proto",
++ "asset_group_asset_error.proto",
++ "asset_group_error.proto",
++ "asset_group_listing_group_filter_error.proto",
++ "asset_link_error.proto",
++ "asset_set_asset_error.proto",
++ "asset_set_error.proto",
++ "asset_set_link_error.proto",
++ "audience_error.proto",
++ "audience_insights_error.proto",
++ "authentication_error.proto",
++ "authorization_error.proto",
++ "batch_job_error.proto",
++ "bidding_error.proto",
++ "bidding_strategy_error.proto",
++ "billing_setup_error.proto",
++ "campaign_budget_error.proto",
++ "campaign_conversion_goal_error.proto",
++ "campaign_criterion_error.proto",
++ "campaign_customizer_error.proto",
++ "campaign_draft_error.proto",
++ "campaign_error.proto",
++ "campaign_experiment_error.proto",
++ "campaign_feed_error.proto",
++ "campaign_shared_set_error.proto",
++ "change_event_error.proto",
++ "change_status_error.proto",
++ "collection_size_error.proto",
++ "context_error.proto",
++ "conversion_action_error.proto",
++ "conversion_adjustment_upload_error.proto",
++ "conversion_custom_variable_error.proto",
++ "conversion_goal_campaign_config_error.proto",
++ "conversion_upload_error.proto",
++ "conversion_value_rule_error.proto",
++ "conversion_value_rule_set_error.proto",
++ "country_code_error.proto",
++ "criterion_error.proto",
++ "currency_code_error.proto",
++ "custom_audience_error.proto",
++ "custom_conversion_goal_error.proto",
++ "custom_interest_error.proto",
++ "customer_client_link_error.proto",
++ "customer_customizer_error.proto",
++ "customer_error.proto",
++ "customer_feed_error.proto",
++ "customer_manager_link_error.proto",
++ "customer_user_access_error.proto",
++ "customizer_attribute_error.proto",
++ "database_error.proto",
++ "date_error.proto",
++ "date_range_error.proto",
++ "distinct_error.proto",
++ "enum_error.proto",
++ "errors.proto",
++ "experiment_arm_error.proto",
++ "experiment_error.proto",
++ "extension_feed_item_error.proto",
++ "extension_setting_error.proto",
++ "feed_attribute_reference_error.proto",
++ "feed_error.proto",
++ "feed_item_error.proto",
++ "feed_item_set_error.proto",
++ "feed_item_set_link_error.proto",
++ "feed_item_target_error.proto",
++ "feed_item_validation_error.proto",
++ "feed_mapping_error.proto",
++ "field_error.proto",
++ "field_mask_error.proto",
++ "function_error.proto",
++ "function_parsing_error.proto",
++ "geo_target_constant_suggestion_error.proto",
++ "header_error.proto",
++ "id_error.proto",
++ "image_error.proto",
++ "internal_error.proto",
++ "invoice_error.proto",
++ "keyword_plan_ad_group_error.proto",
++ "keyword_plan_ad_group_keyword_error.proto",
++ "keyword_plan_campaign_error.proto",
++ "keyword_plan_campaign_keyword_error.proto",
++ "keyword_plan_error.proto",
++ "keyword_plan_idea_error.proto",
++ "label_error.proto",
++ "language_code_error.proto",
++ "list_operation_error.proto",
++ "manager_link_error.proto",
++ "media_bundle_error.proto",
++ "media_file_error.proto",
++ "media_upload_error.proto",
++ "merchant_center_error.proto",
++ "multiplier_error.proto",
++ "mutate_error.proto",
++ "new_resource_creation_error.proto",
++ "not_allowlisted_error.proto",
++ "not_empty_error.proto",
++ "null_error.proto",
++ "offline_user_data_job_error.proto",
++ "operation_access_denied_error.proto",
++ "operator_error.proto",
++ "partial_failure_error.proto",
++ "payments_account_error.proto",
++ "policy_finding_error.proto",
++ "policy_validation_parameter_error.proto",
++ "policy_violation_error.proto",
++ "query_error.proto",
++ "quota_error.proto",
++ "range_error.proto",
++ "reach_plan_error.proto",
++ "recommendation_error.proto",
++ "region_code_error.proto",
++ "request_error.proto",
++ "resource_access_denied_error.proto",
++ "resource_count_limit_exceeded_error.proto",
++ "setting_error.proto",
++ "shared_criterion_error.proto",
++ "shared_set_error.proto",
++ "size_limit_error.proto",
++ "string_format_error.proto",
++ "string_length_error.proto",
++ "third_party_app_analytics_link_error.proto",
++ "time_zone_error.proto",
++ "url_field_error.proto",
++ "user_data_error.proto",
++ "user_list_error.proto",
++ "youtube_video_registration_error.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v11/common:common_proto",
++ "//google/ads/googleads/v11/enums:enums_proto",
++ "@com_google_protobuf//:duration_proto",
++ ],
++)
++
++go_proto_library(
++ name = "errors_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/ads/googleads/v11/errors",
++ proto = ":errors_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v11/common:common_go_proto",
++ "//google/ads/googleads/v11/enums:enums_go_proto",
++ ],
++)
+diff -urN c/google/ads/googleads/v11/resources/BUILD.bazel d/google/ads/googleads/v11/resources/BUILD.bazel
+--- c/google/ads/googleads/v11/resources/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/googleads/v11/resources/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,185 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "resources_proto",
++ srcs = [
++ "accessible_bidding_strategy.proto",
++ "account_budget.proto",
++ "account_budget_proposal.proto",
++ "account_link.proto",
++ "ad.proto",
++ "ad_group.proto",
++ "ad_group_ad.proto",
++ "ad_group_ad_asset_combination_view.proto",
++ "ad_group_ad_asset_view.proto",
++ "ad_group_ad_label.proto",
++ "ad_group_asset.proto",
++ "ad_group_audience_view.proto",
++ "ad_group_bid_modifier.proto",
++ "ad_group_criterion.proto",
++ "ad_group_criterion_customizer.proto",
++ "ad_group_criterion_label.proto",
++ "ad_group_criterion_simulation.proto",
++ "ad_group_customizer.proto",
++ "ad_group_extension_setting.proto",
++ "ad_group_feed.proto",
++ "ad_group_label.proto",
++ "ad_group_simulation.proto",
++ "ad_parameter.proto",
++ "ad_schedule_view.proto",
++ "age_range_view.proto",
++ "asset.proto",
++ "asset_field_type_view.proto",
++ "asset_group.proto",
++ "asset_group_asset.proto",
++ "asset_group_listing_group_filter.proto",
++ "asset_group_product_group_view.proto",
++ "asset_group_signal.proto",
++ "asset_set.proto",
++ "asset_set_asset.proto",
++ "audience.proto",
++ "batch_job.proto",
++ "bidding_data_exclusion.proto",
++ "bidding_seasonality_adjustment.proto",
++ "bidding_strategy.proto",
++ "bidding_strategy_simulation.proto",
++ "billing_setup.proto",
++ "call_view.proto",
++ "campaign.proto",
++ "campaign_asset.proto",
++ "campaign_asset_set.proto",
++ "campaign_audience_view.proto",
++ "campaign_bid_modifier.proto",
++ "campaign_budget.proto",
++ "campaign_conversion_goal.proto",
++ "campaign_criterion.proto",
++ "campaign_criterion_simulation.proto",
++ "campaign_customizer.proto",
++ "campaign_draft.proto",
++ "campaign_experiment.proto",
++ "campaign_extension_setting.proto",
++ "campaign_feed.proto",
++ "campaign_group.proto",
++ "campaign_label.proto",
++ "campaign_shared_set.proto",
++ "campaign_simulation.proto",
++ "carrier_constant.proto",
++ "change_event.proto",
++ "change_status.proto",
++ "click_view.proto",
++ "combined_audience.proto",
++ "conversion_action.proto",
++ "conversion_custom_variable.proto",
++ "conversion_goal_campaign_config.proto",
++ "conversion_value_rule.proto",
++ "conversion_value_rule_set.proto",
++ "currency_constant.proto",
++ "custom_audience.proto",
++ "custom_conversion_goal.proto",
++ "custom_interest.proto",
++ "customer.proto",
++ "customer_asset.proto",
++ "customer_client.proto",
++ "customer_client_link.proto",
++ "customer_conversion_goal.proto",
++ "customer_customizer.proto",
++ "customer_extension_setting.proto",
++ "customer_feed.proto",
++ "customer_label.proto",
++ "customer_manager_link.proto",
++ "customer_negative_criterion.proto",
++ "customer_user_access.proto",
++ "customer_user_access_invitation.proto",
++ "customizer_attribute.proto",
++ "detail_placement_view.proto",
++ "detailed_demographic.proto",
++ "display_keyword_view.proto",
++ "distance_view.proto",
++ "domain_category.proto",
++ "dynamic_search_ads_search_term_view.proto",
++ "expanded_landing_page_view.proto",
++ "experiment.proto",
++ "experiment_arm.proto",
++ "extension_feed_item.proto",
++ "feed.proto",
++ "feed_item.proto",
++ "feed_item_set.proto",
++ "feed_item_set_link.proto",
++ "feed_item_target.proto",
++ "feed_mapping.proto",
++ "feed_placeholder_view.proto",
++ "gender_view.proto",
++ "geo_target_constant.proto",
++ "geographic_view.proto",
++ "google_ads_field.proto",
++ "group_placement_view.proto",
++ "hotel_group_view.proto",
++ "hotel_performance_view.proto",
++ "hotel_reconciliation.proto",
++ "income_range_view.proto",
++ "invoice.proto",
++ "keyword_plan.proto",
++ "keyword_plan_ad_group.proto",
++ "keyword_plan_ad_group_keyword.proto",
++ "keyword_plan_campaign.proto",
++ "keyword_plan_campaign_keyword.proto",
++ "keyword_theme_constant.proto",
++ "keyword_view.proto",
++ "label.proto",
++ "landing_page_view.proto",
++ "language_constant.proto",
++ "lead_form_submission_data.proto",
++ "life_event.proto",
++ "location_view.proto",
++ "managed_placement_view.proto",
++ "media_file.proto",
++ "merchant_center_link.proto",
++ "mobile_app_category_constant.proto",
++ "mobile_device_constant.proto",
++ "offline_user_data_job.proto",
++ "operating_system_version_constant.proto",
++ "paid_organic_search_term_view.proto",
++ "parental_status_view.proto",
++ "payments_account.proto",
++ "product_bidding_category_constant.proto",
++ "product_group_view.proto",
++ "recommendation.proto",
++ "remarketing_action.proto",
++ "search_term_view.proto",
++ "shared_criterion.proto",
++ "shared_set.proto",
++ "shopping_performance_view.proto",
++ "smart_campaign_search_term_view.proto",
++ "smart_campaign_setting.proto",
++ "third_party_app_analytics_link.proto",
++ "topic_constant.proto",
++ "topic_view.proto",
++ "user_interest.proto",
++ "user_list.proto",
++ "user_location_view.proto",
++ "video.proto",
++ "webpage_view.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v11/common:common_proto",
++ "//google/ads/googleads/v11/enums:enums_proto",
++ "//google/ads/googleads/v11/errors:errors_proto",
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "resources_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/ads/googleads/v11/resources",
++ proto = ":resources_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v11/common:common_go_proto",
++ "//google/ads/googleads/v11/enums:enums_go_proto",
++ "//google/ads/googleads/v11/errors:errors_go_proto",
++ "//google/api:annotations_go_proto",
++ ],
++)
+diff -urN c/google/ads/googleads/v11/services/BUILD.bazel d/google/ads/googleads/v11/services/BUILD.bazel
+--- c/google/ads/googleads/v11/services/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/googleads/v11/services/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,138 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "services_proto",
++ srcs = [
++ "account_budget_proposal_service.proto",
++ "account_link_service.proto",
++ "ad_group_ad_label_service.proto",
++ "ad_group_ad_service.proto",
++ "ad_group_asset_service.proto",
++ "ad_group_bid_modifier_service.proto",
++ "ad_group_criterion_customizer_service.proto",
++ "ad_group_criterion_label_service.proto",
++ "ad_group_criterion_service.proto",
++ "ad_group_customizer_service.proto",
++ "ad_group_extension_setting_service.proto",
++ "ad_group_feed_service.proto",
++ "ad_group_label_service.proto",
++ "ad_group_service.proto",
++ "ad_parameter_service.proto",
++ "ad_service.proto",
++ "asset_group_asset_service.proto",
++ "asset_group_listing_group_filter_service.proto",
++ "asset_group_service.proto",
++ "asset_group_signal_service.proto",
++ "asset_service.proto",
++ "asset_set_asset_service.proto",
++ "asset_set_service.proto",
++ "audience_insights_service.proto",
++ "audience_service.proto",
++ "batch_job_service.proto",
++ "bidding_data_exclusion_service.proto",
++ "bidding_seasonality_adjustment_service.proto",
++ "bidding_strategy_service.proto",
++ "billing_setup_service.proto",
++ "campaign_asset_service.proto",
++ "campaign_asset_set_service.proto",
++ "campaign_bid_modifier_service.proto",
++ "campaign_budget_service.proto",
++ "campaign_conversion_goal_service.proto",
++ "campaign_criterion_service.proto",
++ "campaign_customizer_service.proto",
++ "campaign_draft_service.proto",
++ "campaign_experiment_service.proto",
++ "campaign_extension_setting_service.proto",
++ "campaign_feed_service.proto",
++ "campaign_group_service.proto",
++ "campaign_label_service.proto",
++ "campaign_service.proto",
++ "campaign_shared_set_service.proto",
++ "conversion_action_service.proto",
++ "conversion_adjustment_upload_service.proto",
++ "conversion_custom_variable_service.proto",
++ "conversion_goal_campaign_config_service.proto",
++ "conversion_upload_service.proto",
++ "conversion_value_rule_service.proto",
++ "conversion_value_rule_set_service.proto",
++ "custom_audience_service.proto",
++ "custom_conversion_goal_service.proto",
++ "custom_interest_service.proto",
++ "customer_asset_service.proto",
++ "customer_client_link_service.proto",
++ "customer_conversion_goal_service.proto",
++ "customer_customizer_service.proto",
++ "customer_extension_setting_service.proto",
++ "customer_feed_service.proto",
++ "customer_label_service.proto",
++ "customer_manager_link_service.proto",
++ "customer_negative_criterion_service.proto",
++ "customer_service.proto",
++ "customer_user_access_invitation_service.proto",
++ "customer_user_access_service.proto",
++ "customizer_attribute_service.proto",
++ "experiment_arm_service.proto",
++ "experiment_service.proto",
++ "extension_feed_item_service.proto",
++ "feed_item_service.proto",
++ "feed_item_set_link_service.proto",
++ "feed_item_set_service.proto",
++ "feed_item_target_service.proto",
++ "feed_mapping_service.proto",
++ "feed_service.proto",
++ "geo_target_constant_service.proto",
++ "google_ads_field_service.proto",
++ "google_ads_service.proto",
++ "invoice_service.proto",
++ "keyword_plan_ad_group_keyword_service.proto",
++ "keyword_plan_ad_group_service.proto",
++ "keyword_plan_campaign_keyword_service.proto",
++ "keyword_plan_campaign_service.proto",
++ "keyword_plan_idea_service.proto",
++ "keyword_plan_service.proto",
++ "keyword_theme_constant_service.proto",
++ "label_service.proto",
++ "media_file_service.proto",
++ "merchant_center_link_service.proto",
++ "offline_user_data_job_service.proto",
++ "payments_account_service.proto",
++ "reach_plan_service.proto",
++ "recommendation_service.proto",
++ "remarketing_action_service.proto",
++ "shared_criterion_service.proto",
++ "shared_set_service.proto",
++ "smart_campaign_setting_service.proto",
++ "smart_campaign_suggest_service.proto",
++ "third_party_app_analytics_link_service.proto",
++ "user_data_service.proto",
++ "user_list_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v11/common:common_proto",
++ "//google/ads/googleads/v11/enums:enums_proto",
++ "//google/ads/googleads/v11/resources:resources_proto",
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "services_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/ads/googleads/v11/services",
++ proto = ":services_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v11/common:common_go_proto",
++ "//google/ads/googleads/v11/enums:enums_go_proto",
++ "//google/ads/googleads/v11/resources:resources_go_proto",
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/ads/googleads/v12/common/BUILD.bazel d/google/ads/googleads/v12/common/BUILD.bazel
+--- c/google/ads/googleads/v12/common/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/googleads/v12/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,60 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "common_proto",
++ srcs = [
++ "ad_asset.proto",
++ "ad_type_infos.proto",
++ "asset_policy.proto",
++ "asset_set_types.proto",
++ "asset_types.proto",
++ "asset_usage.proto",
++ "audiences.proto",
++ "bidding.proto",
++ "click_location.proto",
++ "criteria.proto",
++ "criterion_category_availability.proto",
++ "custom_parameter.proto",
++ "customizer_value.proto",
++ "dates.proto",
++ "explorer_auto_optimizer_setting.proto",
++ "extensions.proto",
++ "feed_common.proto",
++ "feed_item_set_filter_type_infos.proto",
++ "final_app_url.proto",
++ "frequency_cap.proto",
++ "keyword_plan_common.proto",
++ "matching_function.proto",
++ "metric_goal.proto",
++ "metrics.proto",
++ "offline_user_data.proto",
++ "policy.proto",
++ "policy_summary.proto",
++ "real_time_bidding_setting.proto",
++ "segments.proto",
++ "simulation.proto",
++ "tag_snippet.proto",
++ "targeting_setting.proto",
++ "text_label.proto",
++ "url_collection.proto",
++ "user_lists.proto",
++ "value.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v12/enums:enums_proto",
++ "//google/api:annotations_proto",
++ ],
++)
++
++go_proto_library(
++ name = "common_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/ads/googleads/v12/common",
++ proto = ":common_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v12/enums:enums_go_proto",
++ "//google/api:annotations_go_proto",
++ ],
++)
+diff -urN c/google/ads/googleads/v12/enums/BUILD.bazel d/google/ads/googleads/v12/enums/BUILD.bazel
+--- c/google/ads/googleads/v12/enums/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/googleads/v12/enums/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,317 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "enums_proto",
++ srcs = [
++ "access_invitation_status.proto",
++ "access_reason.proto",
++ "access_role.proto",
++ "account_budget_proposal_status.proto",
++ "account_budget_proposal_type.proto",
++ "account_budget_status.proto",
++ "account_link_status.proto",
++ "ad_customizer_placeholder_field.proto",
++ "ad_destination_type.proto",
++ "ad_group_ad_rotation_mode.proto",
++ "ad_group_ad_status.proto",
++ "ad_group_criterion_approval_status.proto",
++ "ad_group_criterion_status.proto",
++ "ad_group_status.proto",
++ "ad_group_type.proto",
++ "ad_network_type.proto",
++ "ad_serving_optimization_status.proto",
++ "ad_strength.proto",
++ "ad_type.proto",
++ "advertising_channel_sub_type.proto",
++ "advertising_channel_type.proto",
++ "affiliate_location_feed_relationship_type.proto",
++ "affiliate_location_placeholder_field.proto",
++ "age_range_type.proto",
++ "app_campaign_app_store.proto",
++ "app_campaign_bidding_strategy_goal_type.proto",
++ "app_payment_model_type.proto",
++ "app_placeholder_field.proto",
++ "app_store.proto",
++ "app_url_operating_system_type.proto",
++ "asset_field_type.proto",
++ "asset_group_status.proto",
++ "asset_link_status.proto",
++ "asset_performance_label.proto",
++ "asset_set_asset_status.proto",
++ "asset_set_link_status.proto",
++ "asset_set_status.proto",
++ "asset_set_type.proto",
++ "asset_source.proto",
++ "asset_type.proto",
++ "async_action_status.proto",
++ "attribution_model.proto",
++ "audience_insights_dimension.proto",
++ "audience_status.proto",
++ "batch_job_status.proto",
++ "bid_modifier_source.proto",
++ "bidding_source.proto",
++ "bidding_strategy_status.proto",
++ "bidding_strategy_system_status.proto",
++ "bidding_strategy_type.proto",
++ "billing_setup_status.proto",
++ "brand_safety_suitability.proto",
++ "budget_campaign_association_status.proto",
++ "budget_delivery_method.proto",
++ "budget_period.proto",
++ "budget_status.proto",
++ "budget_type.proto",
++ "call_conversion_reporting_state.proto",
++ "call_placeholder_field.proto",
++ "call_to_action_type.proto",
++ "call_tracking_display_location.proto",
++ "call_type.proto",
++ "callout_placeholder_field.proto",
++ "campaign_criterion_status.proto",
++ "campaign_draft_status.proto",
++ "campaign_experiment_type.proto",
++ "campaign_group_status.proto",
++ "campaign_primary_status.proto",
++ "campaign_primary_status_reason.proto",
++ "campaign_serving_status.proto",
++ "campaign_shared_set_status.proto",
++ "campaign_status.proto",
++ "chain_relationship_type.proto",
++ "change_client_type.proto",
++ "change_event_resource_type.proto",
++ "change_status_operation.proto",
++ "change_status_resource_type.proto",
++ "click_type.proto",
++ "combined_audience_status.proto",
++ "content_label_type.proto",
++ "conversion_action_category.proto",
++ "conversion_action_counting_type.proto",
++ "conversion_action_status.proto",
++ "conversion_action_type.proto",
++ "conversion_adjustment_type.proto",
++ "conversion_attribution_event_type.proto",
++ "conversion_custom_variable_status.proto",
++ "conversion_environment_enum.proto",
++ "conversion_lag_bucket.proto",
++ "conversion_or_adjustment_lag_bucket.proto",
++ "conversion_origin.proto",
++ "conversion_tracking_status_enum.proto",
++ "conversion_value_rule_primary_dimension.proto",
++ "conversion_value_rule_set_status.proto",
++ "conversion_value_rule_status.proto",
++ "criterion_category_channel_availability_mode.proto",
++ "criterion_category_locale_availability_mode.proto",
++ "criterion_system_serving_status.proto",
++ "criterion_type.proto",
++ "custom_audience_member_type.proto",
++ "custom_audience_status.proto",
++ "custom_audience_type.proto",
++ "custom_conversion_goal_status.proto",
++ "custom_interest_member_type.proto",
++ "custom_interest_status.proto",
++ "custom_interest_type.proto",
++ "custom_placeholder_field.proto",
++ "customer_match_upload_key_type.proto",
++ "customer_pay_per_conversion_eligibility_failure_reason.proto",
++ "customer_status.proto",
++ "customizer_attribute_status.proto",
++ "customizer_attribute_type.proto",
++ "customizer_value_status.proto",
++ "data_driven_model_status.proto",
++ "day_of_week.proto",
++ "device.proto",
++ "display_ad_format_setting.proto",
++ "display_upload_product_type.proto",
++ "distance_bucket.proto",
++ "dsa_page_feed_criterion_field.proto",
++ "education_placeholder_field.proto",
++ "experiment_metric.proto",
++ "experiment_metric_direction.proto",
++ "experiment_status.proto",
++ "experiment_type.proto",
++ "extension_setting_device.proto",
++ "extension_type.proto",
++ "external_conversion_source.proto",
++ "feed_attribute_type.proto",
++ "feed_item_quality_approval_status.proto",
++ "feed_item_quality_disapproval_reason.proto",
++ "feed_item_set_status.proto",
++ "feed_item_set_string_filter_type.proto",
++ "feed_item_status.proto",
++ "feed_item_target_device.proto",
++ "feed_item_target_status.proto",
++ "feed_item_target_type.proto",
++ "feed_item_validation_status.proto",
++ "feed_link_status.proto",
++ "feed_mapping_criterion_type.proto",
++ "feed_mapping_status.proto",
++ "feed_origin.proto",
++ "feed_status.proto",
++ "flight_placeholder_field.proto",
++ "frequency_cap_event_type.proto",
++ "frequency_cap_level.proto",
++ "frequency_cap_time_unit.proto",
++ "gender_type.proto",
++ "geo_target_constant_status.proto",
++ "geo_targeting_restriction.proto",
++ "geo_targeting_type.proto",
++ "goal_config_level.proto",
++ "google_ads_field_category.proto",
++ "google_ads_field_data_type.proto",
++ "google_voice_call_status.proto",
++ "hotel_date_selection_type.proto",
++ "hotel_placeholder_field.proto",
++ "hotel_price_bucket.proto",
++ "hotel_rate_type.proto",
++ "hotel_reconciliation_status.proto",
++ "image_placeholder_field.proto",
++ "income_range_type.proto",
++ "interaction_event_type.proto",
++ "interaction_type.proto",
++ "invoice_type.proto",
++ "job_placeholder_field.proto",
++ "keyword_match_type.proto",
++ "keyword_plan_aggregate_metric_type.proto",
++ "keyword_plan_competition_level.proto",
++ "keyword_plan_concept_group_type.proto",
++ "keyword_plan_forecast_interval.proto",
++ "keyword_plan_keyword_annotation.proto",
++ "keyword_plan_network.proto",
++ "label_status.proto",
++ "lead_form_call_to_action_type.proto",
++ "lead_form_desired_intent.proto",
++ "lead_form_field_user_input_type.proto",
++ "lead_form_post_submit_call_to_action_type.proto",
++ "legacy_app_install_ad_app_store.proto",
++ "linked_account_type.proto",
++ "listing_group_filter_bidding_category_level.proto",
++ "listing_group_filter_custom_attribute_index.proto",
++ "listing_group_filter_product_channel.proto",
++ "listing_group_filter_product_condition.proto",
++ "listing_group_filter_product_type_level.proto",
++ "listing_group_filter_type_enum.proto",
++ "listing_group_filter_vertical.proto",
++ "listing_group_type.proto",
++ "local_placeholder_field.proto",
++ "location_extension_targeting_criterion_field.proto",
++ "location_group_radius_units.proto",
++ "location_ownership_type.proto",
++ "location_placeholder_field.proto",
++ "location_source_type.proto",
++ "location_string_filter_type.proto",
++ "manager_link_status.proto",
++ "matching_function_context_type.proto",
++ "matching_function_operator.proto",
++ "media_type.proto",
++ "merchant_center_link_status.proto",
++ "message_placeholder_field.proto",
++ "mime_type.proto",
++ "minute_of_hour.proto",
++ "mobile_app_vendor.proto",
++ "mobile_device_type.proto",
++ "month_of_year.proto",
++ "negative_geo_target_type.proto",
++ "offline_user_data_job_failure_reason.proto",
++ "offline_user_data_job_match_rate_range.proto",
++ "offline_user_data_job_status.proto",
++ "offline_user_data_job_type.proto",
++ "operating_system_version_operator_type.proto",
++ "optimization_goal_type.proto",
++ "parental_status_type.proto",
++ "payment_mode.proto",
++ "performance_max_upgrade_status.proto",
++ "placeholder_type.proto",
++ "placement_type.proto",
++ "policy_approval_status.proto",
++ "policy_review_status.proto",
++ "policy_topic_entry_type.proto",
++ "policy_topic_evidence_destination_mismatch_url_type.proto",
++ "policy_topic_evidence_destination_not_working_device.proto",
++ "policy_topic_evidence_destination_not_working_dns_error_type.proto",
++ "positive_geo_target_type.proto",
++ "preferred_content_type.proto",
++ "price_extension_price_qualifier.proto",
++ "price_extension_price_unit.proto",
++ "price_extension_type.proto",
++ "price_placeholder_field.proto",
++ "product_bidding_category_level.proto",
++ "product_bidding_category_status.proto",
++ "product_channel.proto",
++ "product_channel_exclusivity.proto",
++ "product_condition.proto",
++ "product_custom_attribute_index.proto",
++ "product_type_level.proto",
++ "promotion_extension_discount_modifier.proto",
++ "promotion_extension_occasion.proto",
++ "promotion_placeholder_field.proto",
++ "proximity_radius_units.proto",
++ "quality_score_bucket.proto",
++ "reach_plan_age_range.proto",
++ "reach_plan_network.proto",
++ "real_estate_placeholder_field.proto",
++ "recommendation_type.proto",
++ "resource_change_operation.proto",
++ "resource_limit_type.proto",
++ "response_content_type.proto",
++ "search_engine_results_page_type.proto",
++ "search_term_match_type.proto",
++ "search_term_targeting_status.proto",
++ "seasonality_event_scope.proto",
++ "seasonality_event_status.proto",
++ "served_asset_field_type.proto",
++ "shared_set_status.proto",
++ "shared_set_type.proto",
++ "simulation_modification_method.proto",
++ "simulation_type.proto",
++ "sitelink_placeholder_field.proto",
++ "sk_ad_network_ad_event_type.proto",
++ "sk_ad_network_attribution_credit.proto",
++ "sk_ad_network_user_type.proto",
++ "slot.proto",
++ "spending_limit_type.proto",
++ "structured_snippet_placeholder_field.proto",
++ "summary_row_setting.proto",
++ "system_managed_entity_source.proto",
++ "target_cpa_opt_in_recommendation_goal.proto",
++ "target_impression_share_location.proto",
++ "targeting_dimension.proto",
++ "time_type.proto",
++ "tracking_code_page_format.proto",
++ "tracking_code_type.proto",
++ "travel_placeholder_field.proto",
++ "user_identifier_source.proto",
++ "user_interest_taxonomy_type.proto",
++ "user_list_access_status.proto",
++ "user_list_closing_reason.proto",
++ "user_list_combined_rule_operator.proto",
++ "user_list_crm_data_source_type.proto",
++ "user_list_date_rule_item_operator.proto",
++ "user_list_flexible_rule_operator.proto",
++ "user_list_logical_rule_operator.proto",
++ "user_list_membership_status.proto",
++ "user_list_number_rule_item_operator.proto",
++ "user_list_prepopulation_status.proto",
++ "user_list_rule_type.proto",
++ "user_list_size_range.proto",
++ "user_list_string_rule_item_operator.proto",
++ "user_list_type.proto",
++ "value_rule_device_type.proto",
++ "value_rule_geo_location_match_type.proto",
++ "value_rule_operation.proto",
++ "value_rule_set_attachment_type.proto",
++ "value_rule_set_dimension.proto",
++ "vanity_pharma_display_url_mode.proto",
++ "vanity_pharma_text.proto",
++ "video_thumbnail.proto",
++ "webpage_condition_operand.proto",
++ "webpage_condition_operator.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "enums_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/ads/googleads/v12/enums",
++ proto = ":enums_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/ads/googleads/v12/errors/BUILD.bazel d/google/ads/googleads/v12/errors/BUILD.bazel
+--- c/google/ads/googleads/v12/errors/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/googleads/v12/errors/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,167 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "errors_proto",
++ srcs = [
++ "access_invitation_error.proto",
++ "account_budget_proposal_error.proto",
++ "account_link_error.proto",
++ "ad_customizer_error.proto",
++ "ad_error.proto",
++ "ad_group_ad_error.proto",
++ "ad_group_bid_modifier_error.proto",
++ "ad_group_criterion_customizer_error.proto",
++ "ad_group_criterion_error.proto",
++ "ad_group_customizer_error.proto",
++ "ad_group_error.proto",
++ "ad_group_feed_error.proto",
++ "ad_parameter_error.proto",
++ "ad_sharing_error.proto",
++ "adx_error.proto",
++ "asset_error.proto",
++ "asset_group_asset_error.proto",
++ "asset_group_error.proto",
++ "asset_group_listing_group_filter_error.proto",
++ "asset_link_error.proto",
++ "asset_set_asset_error.proto",
++ "asset_set_error.proto",
++ "asset_set_link_error.proto",
++ "audience_error.proto",
++ "audience_insights_error.proto",
++ "authentication_error.proto",
++ "authorization_error.proto",
++ "batch_job_error.proto",
++ "bidding_error.proto",
++ "bidding_strategy_error.proto",
++ "billing_setup_error.proto",
++ "campaign_budget_error.proto",
++ "campaign_conversion_goal_error.proto",
++ "campaign_criterion_error.proto",
++ "campaign_customizer_error.proto",
++ "campaign_draft_error.proto",
++ "campaign_error.proto",
++ "campaign_experiment_error.proto",
++ "campaign_feed_error.proto",
++ "campaign_shared_set_error.proto",
++ "change_event_error.proto",
++ "change_status_error.proto",
++ "collection_size_error.proto",
++ "context_error.proto",
++ "conversion_action_error.proto",
++ "conversion_adjustment_upload_error.proto",
++ "conversion_custom_variable_error.proto",
++ "conversion_goal_campaign_config_error.proto",
++ "conversion_upload_error.proto",
++ "conversion_value_rule_error.proto",
++ "conversion_value_rule_set_error.proto",
++ "country_code_error.proto",
++ "criterion_error.proto",
++ "currency_code_error.proto",
++ "custom_audience_error.proto",
++ "custom_conversion_goal_error.proto",
++ "custom_interest_error.proto",
++ "customer_client_link_error.proto",
++ "customer_customizer_error.proto",
++ "customer_error.proto",
++ "customer_feed_error.proto",
++ "customer_manager_link_error.proto",
++ "customer_user_access_error.proto",
++ "customizer_attribute_error.proto",
++ "database_error.proto",
++ "date_error.proto",
++ "date_range_error.proto",
++ "distinct_error.proto",
++ "enum_error.proto",
++ "errors.proto",
++ "experiment_arm_error.proto",
++ "experiment_error.proto",
++ "extension_feed_item_error.proto",
++ "extension_setting_error.proto",
++ "feed_attribute_reference_error.proto",
++ "feed_error.proto",
++ "feed_item_error.proto",
++ "feed_item_set_error.proto",
++ "feed_item_set_link_error.proto",
++ "feed_item_target_error.proto",
++ "feed_item_validation_error.proto",
++ "feed_mapping_error.proto",
++ "field_error.proto",
++ "field_mask_error.proto",
++ "function_error.proto",
++ "function_parsing_error.proto",
++ "geo_target_constant_suggestion_error.proto",
++ "header_error.proto",
++ "id_error.proto",
++ "image_error.proto",
++ "internal_error.proto",
++ "invoice_error.proto",
++ "keyword_plan_ad_group_error.proto",
++ "keyword_plan_ad_group_keyword_error.proto",
++ "keyword_plan_campaign_error.proto",
++ "keyword_plan_campaign_keyword_error.proto",
++ "keyword_plan_error.proto",
++ "keyword_plan_idea_error.proto",
++ "label_error.proto",
++ "language_code_error.proto",
++ "list_operation_error.proto",
++ "manager_link_error.proto",
++ "media_bundle_error.proto",
++ "media_file_error.proto",
++ "media_upload_error.proto",
++ "merchant_center_error.proto",
++ "multiplier_error.proto",
++ "mutate_error.proto",
++ "new_resource_creation_error.proto",
++ "not_allowlisted_error.proto",
++ "not_empty_error.proto",
++ "null_error.proto",
++ "offline_user_data_job_error.proto",
++ "operation_access_denied_error.proto",
++ "operator_error.proto",
++ "partial_failure_error.proto",
++ "payments_account_error.proto",
++ "policy_finding_error.proto",
++ "policy_validation_parameter_error.proto",
++ "policy_violation_error.proto",
++ "query_error.proto",
++ "quota_error.proto",
++ "range_error.proto",
++ "reach_plan_error.proto",
++ "recommendation_error.proto",
++ "region_code_error.proto",
++ "request_error.proto",
++ "resource_access_denied_error.proto",
++ "resource_count_limit_exceeded_error.proto",
++ "setting_error.proto",
++ "shared_criterion_error.proto",
++ "shared_set_error.proto",
++ "size_limit_error.proto",
++ "smart_campaign_error.proto",
++ "string_format_error.proto",
++ "string_length_error.proto",
++ "third_party_app_analytics_link_error.proto",
++ "time_zone_error.proto",
++ "url_field_error.proto",
++ "user_data_error.proto",
++ "user_list_error.proto",
++ "youtube_video_registration_error.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v12/common:common_proto",
++ "//google/ads/googleads/v12/enums:enums_proto",
++ "@com_google_protobuf//:duration_proto",
++ ],
++)
++
++go_proto_library(
++ name = "errors_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/ads/googleads/v12/errors",
++ proto = ":errors_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v12/common:common_go_proto",
++ "//google/ads/googleads/v12/enums:enums_go_proto",
++ ],
++)
+diff -urN c/google/ads/googleads/v12/resources/BUILD.bazel d/google/ads/googleads/v12/resources/BUILD.bazel
+--- c/google/ads/googleads/v12/resources/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/googleads/v12/resources/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,188 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "resources_proto",
++ srcs = [
++ "accessible_bidding_strategy.proto",
++ "account_budget.proto",
++ "account_budget_proposal.proto",
++ "account_link.proto",
++ "ad.proto",
++ "ad_group.proto",
++ "ad_group_ad.proto",
++ "ad_group_ad_asset_combination_view.proto",
++ "ad_group_ad_asset_view.proto",
++ "ad_group_ad_label.proto",
++ "ad_group_asset.proto",
++ "ad_group_asset_set.proto",
++ "ad_group_audience_view.proto",
++ "ad_group_bid_modifier.proto",
++ "ad_group_criterion.proto",
++ "ad_group_criterion_customizer.proto",
++ "ad_group_criterion_label.proto",
++ "ad_group_criterion_simulation.proto",
++ "ad_group_customizer.proto",
++ "ad_group_extension_setting.proto",
++ "ad_group_feed.proto",
++ "ad_group_label.proto",
++ "ad_group_simulation.proto",
++ "ad_parameter.proto",
++ "ad_schedule_view.proto",
++ "age_range_view.proto",
++ "asset.proto",
++ "asset_field_type_view.proto",
++ "asset_group.proto",
++ "asset_group_asset.proto",
++ "asset_group_listing_group_filter.proto",
++ "asset_group_product_group_view.proto",
++ "asset_group_signal.proto",
++ "asset_set.proto",
++ "asset_set_asset.proto",
++ "asset_set_type_view.proto",
++ "audience.proto",
++ "batch_job.proto",
++ "bidding_data_exclusion.proto",
++ "bidding_seasonality_adjustment.proto",
++ "bidding_strategy.proto",
++ "bidding_strategy_simulation.proto",
++ "billing_setup.proto",
++ "call_view.proto",
++ "campaign.proto",
++ "campaign_asset.proto",
++ "campaign_asset_set.proto",
++ "campaign_audience_view.proto",
++ "campaign_bid_modifier.proto",
++ "campaign_budget.proto",
++ "campaign_conversion_goal.proto",
++ "campaign_criterion.proto",
++ "campaign_criterion_simulation.proto",
++ "campaign_customizer.proto",
++ "campaign_draft.proto",
++ "campaign_extension_setting.proto",
++ "campaign_feed.proto",
++ "campaign_group.proto",
++ "campaign_label.proto",
++ "campaign_shared_set.proto",
++ "campaign_simulation.proto",
++ "carrier_constant.proto",
++ "change_event.proto",
++ "change_status.proto",
++ "click_view.proto",
++ "combined_audience.proto",
++ "conversion_action.proto",
++ "conversion_custom_variable.proto",
++ "conversion_goal_campaign_config.proto",
++ "conversion_value_rule.proto",
++ "conversion_value_rule_set.proto",
++ "currency_constant.proto",
++ "custom_audience.proto",
++ "custom_conversion_goal.proto",
++ "custom_interest.proto",
++ "customer.proto",
++ "customer_asset.proto",
++ "customer_asset_set.proto",
++ "customer_client.proto",
++ "customer_client_link.proto",
++ "customer_conversion_goal.proto",
++ "customer_customizer.proto",
++ "customer_extension_setting.proto",
++ "customer_feed.proto",
++ "customer_label.proto",
++ "customer_manager_link.proto",
++ "customer_negative_criterion.proto",
++ "customer_user_access.proto",
++ "customer_user_access_invitation.proto",
++ "customizer_attribute.proto",
++ "detail_placement_view.proto",
++ "detailed_demographic.proto",
++ "display_keyword_view.proto",
++ "distance_view.proto",
++ "domain_category.proto",
++ "dynamic_search_ads_search_term_view.proto",
++ "expanded_landing_page_view.proto",
++ "experiment.proto",
++ "experiment_arm.proto",
++ "extension_feed_item.proto",
++ "feed.proto",
++ "feed_item.proto",
++ "feed_item_set.proto",
++ "feed_item_set_link.proto",
++ "feed_item_target.proto",
++ "feed_mapping.proto",
++ "feed_placeholder_view.proto",
++ "gender_view.proto",
++ "geo_target_constant.proto",
++ "geographic_view.proto",
++ "google_ads_field.proto",
++ "group_placement_view.proto",
++ "hotel_group_view.proto",
++ "hotel_performance_view.proto",
++ "hotel_reconciliation.proto",
++ "income_range_view.proto",
++ "invoice.proto",
++ "keyword_plan.proto",
++ "keyword_plan_ad_group.proto",
++ "keyword_plan_ad_group_keyword.proto",
++ "keyword_plan_campaign.proto",
++ "keyword_plan_campaign_keyword.proto",
++ "keyword_theme_constant.proto",
++ "keyword_view.proto",
++ "label.proto",
++ "landing_page_view.proto",
++ "language_constant.proto",
++ "lead_form_submission_data.proto",
++ "life_event.proto",
++ "location_view.proto",
++ "managed_placement_view.proto",
++ "media_file.proto",
++ "merchant_center_link.proto",
++ "mobile_app_category_constant.proto",
++ "mobile_device_constant.proto",
++ "offline_user_data_job.proto",
++ "operating_system_version_constant.proto",
++ "paid_organic_search_term_view.proto",
++ "parental_status_view.proto",
++ "payments_account.proto",
++ "per_store_view.proto",
++ "product_bidding_category_constant.proto",
++ "product_group_view.proto",
++ "recommendation.proto",
++ "remarketing_action.proto",
++ "search_term_view.proto",
++ "shared_criterion.proto",
++ "shared_set.proto",
++ "shopping_performance_view.proto",
++ "smart_campaign_search_term_view.proto",
++ "smart_campaign_setting.proto",
++ "third_party_app_analytics_link.proto",
++ "topic_constant.proto",
++ "topic_view.proto",
++ "user_interest.proto",
++ "user_list.proto",
++ "user_location_view.proto",
++ "video.proto",
++ "webpage_view.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v12/common:common_proto",
++ "//google/ads/googleads/v12/enums:enums_proto",
++ "//google/ads/googleads/v12/errors:errors_proto",
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "resources_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/ads/googleads/v12/resources",
++ proto = ":resources_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v12/common:common_go_proto",
++ "//google/ads/googleads/v12/enums:enums_go_proto",
++ "//google/ads/googleads/v12/errors:errors_go_proto",
++ "//google/api:annotations_go_proto",
++ ],
++)
+diff -urN c/google/ads/googleads/v12/services/BUILD.bazel d/google/ads/googleads/v12/services/BUILD.bazel
+--- c/google/ads/googleads/v12/services/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/googleads/v12/services/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,139 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "services_proto",
++ srcs = [
++ "account_budget_proposal_service.proto",
++ "account_link_service.proto",
++ "ad_group_ad_label_service.proto",
++ "ad_group_ad_service.proto",
++ "ad_group_asset_service.proto",
++ "ad_group_asset_set_service.proto",
++ "ad_group_bid_modifier_service.proto",
++ "ad_group_criterion_customizer_service.proto",
++ "ad_group_criterion_label_service.proto",
++ "ad_group_criterion_service.proto",
++ "ad_group_customizer_service.proto",
++ "ad_group_extension_setting_service.proto",
++ "ad_group_feed_service.proto",
++ "ad_group_label_service.proto",
++ "ad_group_service.proto",
++ "ad_parameter_service.proto",
++ "ad_service.proto",
++ "asset_group_asset_service.proto",
++ "asset_group_listing_group_filter_service.proto",
++ "asset_group_service.proto",
++ "asset_group_signal_service.proto",
++ "asset_service.proto",
++ "asset_set_asset_service.proto",
++ "asset_set_service.proto",
++ "audience_insights_service.proto",
++ "audience_service.proto",
++ "batch_job_service.proto",
++ "bidding_data_exclusion_service.proto",
++ "bidding_seasonality_adjustment_service.proto",
++ "bidding_strategy_service.proto",
++ "billing_setup_service.proto",
++ "campaign_asset_service.proto",
++ "campaign_asset_set_service.proto",
++ "campaign_bid_modifier_service.proto",
++ "campaign_budget_service.proto",
++ "campaign_conversion_goal_service.proto",
++ "campaign_criterion_service.proto",
++ "campaign_customizer_service.proto",
++ "campaign_draft_service.proto",
++ "campaign_extension_setting_service.proto",
++ "campaign_feed_service.proto",
++ "campaign_group_service.proto",
++ "campaign_label_service.proto",
++ "campaign_service.proto",
++ "campaign_shared_set_service.proto",
++ "conversion_action_service.proto",
++ "conversion_adjustment_upload_service.proto",
++ "conversion_custom_variable_service.proto",
++ "conversion_goal_campaign_config_service.proto",
++ "conversion_upload_service.proto",
++ "conversion_value_rule_service.proto",
++ "conversion_value_rule_set_service.proto",
++ "custom_audience_service.proto",
++ "custom_conversion_goal_service.proto",
++ "custom_interest_service.proto",
++ "customer_asset_service.proto",
++ "customer_asset_set_service.proto",
++ "customer_client_link_service.proto",
++ "customer_conversion_goal_service.proto",
++ "customer_customizer_service.proto",
++ "customer_extension_setting_service.proto",
++ "customer_feed_service.proto",
++ "customer_label_service.proto",
++ "customer_manager_link_service.proto",
++ "customer_negative_criterion_service.proto",
++ "customer_service.proto",
++ "customer_user_access_invitation_service.proto",
++ "customer_user_access_service.proto",
++ "customizer_attribute_service.proto",
++ "experiment_arm_service.proto",
++ "experiment_service.proto",
++ "extension_feed_item_service.proto",
++ "feed_item_service.proto",
++ "feed_item_set_link_service.proto",
++ "feed_item_set_service.proto",
++ "feed_item_target_service.proto",
++ "feed_mapping_service.proto",
++ "feed_service.proto",
++ "geo_target_constant_service.proto",
++ "google_ads_field_service.proto",
++ "google_ads_service.proto",
++ "invoice_service.proto",
++ "keyword_plan_ad_group_keyword_service.proto",
++ "keyword_plan_ad_group_service.proto",
++ "keyword_plan_campaign_keyword_service.proto",
++ "keyword_plan_campaign_service.proto",
++ "keyword_plan_idea_service.proto",
++ "keyword_plan_service.proto",
++ "keyword_theme_constant_service.proto",
++ "label_service.proto",
++ "media_file_service.proto",
++ "merchant_center_link_service.proto",
++ "offline_user_data_job_service.proto",
++ "payments_account_service.proto",
++ "reach_plan_service.proto",
++ "recommendation_service.proto",
++ "remarketing_action_service.proto",
++ "shared_criterion_service.proto",
++ "shared_set_service.proto",
++ "smart_campaign_setting_service.proto",
++ "smart_campaign_suggest_service.proto",
++ "third_party_app_analytics_link_service.proto",
++ "user_data_service.proto",
++ "user_list_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v12/common:common_proto",
++ "//google/ads/googleads/v12/enums:enums_proto",
++ "//google/ads/googleads/v12/resources:resources_proto",
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "services_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/ads/googleads/v12/services",
++ proto = ":services_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/googleads/v12/common:common_go_proto",
++ "//google/ads/googleads/v12/enums:enums_go_proto",
++ "//google/ads/googleads/v12/resources:resources_go_proto",
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/ads/searchads360/v0/common/BUILD.bazel d/google/ads/searchads360/v0/common/BUILD.bazel
+--- c/google/ads/searchads360/v0/common/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/searchads360/v0/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "common_proto",
++ srcs = [
++ "bidding.proto",
++ "criteria.proto",
++ "custom_parameter.proto",
++ "frequency_cap.proto",
++ "metrics.proto",
++ "real_time_bidding_setting.proto",
++ "segments.proto",
++ "value.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/searchads360/v0/enums:enums_proto",
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "common_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/ads/searchads360/v0/common",
++ proto = ":common_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/searchads360/v0/enums:enums_go_proto",
++ "//google/api:annotations_go_proto",
++ ],
++)
+diff -urN c/google/ads/searchads360/v0/enums/BUILD.bazel d/google/ads/searchads360/v0/enums/BUILD.bazel
+--- c/google/ads/searchads360/v0/enums/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/searchads360/v0/enums/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,62 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "enums_proto",
++ srcs = [
++ "account_status.proto",
++ "account_type.proto",
++ "ad_group_ad_rotation_mode.proto",
++ "ad_group_criterion_engine_status.proto",
++ "ad_group_criterion_status.proto",
++ "ad_group_status.proto",
++ "ad_group_type.proto",
++ "ad_serving_optimization_status.proto",
++ "advertising_channel_sub_type.proto",
++ "advertising_channel_type.proto",
++ "age_range_type.proto",
++ "asset_field_type.proto",
++ "attribution_model.proto",
++ "bidding_strategy_status.proto",
++ "bidding_strategy_system_status.proto",
++ "bidding_strategy_type.proto",
++ "budget_delivery_method.proto",
++ "budget_period.proto",
++ "campaign_serving_status.proto",
++ "campaign_status.proto",
++ "conversion_action_category.proto",
++ "conversion_action_status.proto",
++ "conversion_action_type.proto",
++ "conversion_tracking_status_enum.proto",
++ "criterion_type.proto",
++ "custom_column_value_type.proto",
++ "customer_status.proto",
++ "data_driven_model_status.proto",
++ "day_of_week.proto",
++ "device.proto",
++ "gender_type.proto",
++ "interaction_event_type.proto",
++ "keyword_match_type.proto",
++ "listing_group_type.proto",
++ "location_group_radius_units.proto",
++ "manager_link_status.proto",
++ "negative_geo_target_type.proto",
++ "optimization_goal_type.proto",
++ "positive_geo_target_type.proto",
++ "quality_score_bucket.proto",
++ "search_ads360_field_category.proto",
++ "search_ads360_field_data_type.proto",
++ "summary_row_setting.proto",
++ "target_impression_share_location.proto",
++ "webpage_condition_operand.proto",
++ "webpage_condition_operator.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "enums_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/ads/searchads360/v0/enums",
++ proto = ":enums_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/ads/searchads360/v0/resources/BUILD.bazel d/google/ads/searchads360/v0/resources/BUILD.bazel
+--- c/google/ads/searchads360/v0/resources/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/searchads360/v0/resources/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,41 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "resources_proto",
++ srcs = [
++ "ad_group.proto",
++ "ad_group_bid_modifier.proto",
++ "ad_group_criterion.proto",
++ "bidding_strategy.proto",
++ "campaign.proto",
++ "campaign_budget.proto",
++ "campaign_criterion.proto",
++ "conversion_action.proto",
++ "custom_column.proto",
++ "customer.proto",
++ "customer_client.proto",
++ "customer_manager_link.proto",
++ "keyword_view.proto",
++ "product_group_view.proto",
++ "search_ads360_field.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/searchads360/v0/common:common_proto",
++ "//google/ads/searchads360/v0/enums:enums_proto",
++ "//google/api:annotations_proto",
++ ],
++)
++
++go_proto_library(
++ name = "resources_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/ads/searchads360/v0/resources",
++ proto = ":resources_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/searchads360/v0/common:common_go_proto",
++ "//google/ads/searchads360/v0/enums:enums_go_proto",
++ "//google/api:annotations_go_proto",
++ ],
++)
+diff -urN c/google/ads/searchads360/v0/services/BUILD.bazel d/google/ads/searchads360/v0/services/BUILD.bazel
+--- c/google/ads/searchads360/v0/services/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/ads/searchads360/v0/services/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "services_proto",
++ srcs = [
++ "custom_column_service.proto",
++ "search_ads360_field_service.proto",
++ "search_ads360_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/searchads360/v0/common:common_proto",
++ "//google/ads/searchads360/v0/enums:enums_proto",
++ "//google/ads/searchads360/v0/resources:resources_proto",
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "services_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/ads/searchads360/v0/services",
++ proto = ":services_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/ads/searchads360/v0/common:common_go_proto",
++ "//google/ads/searchads360/v0/enums:enums_go_proto",
++ "//google/ads/searchads360/v0/resources:resources_go_proto",
++ "//google/api:annotations_go_proto",
++ ],
++)
+diff -urN c/google/analytics/admin/v1alpha/BUILD.bazel d/google/analytics/admin/v1alpha/BUILD.bazel
+--- c/google/analytics/admin/v1alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/analytics/admin/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "admin_proto",
++ srcs = [
++ "access_report.proto",
++ "analytics_admin.proto",
++ "audience.proto",
++ "resources.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "admin_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/analytics/admin/v1alpha",
++ proto = ":admin_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/analytics/admin/v1beta/BUILD.bazel d/google/analytics/admin/v1beta/BUILD.bazel
+--- c/google/analytics/admin/v1beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/analytics/admin/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "admin_proto",
++ srcs = [
++ "analytics_admin.proto",
++ "resources.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "admin_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/analytics/admin/v1beta",
++ proto = ":admin_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/analytics/data/v1alpha/BUILD.bazel d/google/analytics/data/v1alpha/BUILD.bazel
+--- c/google/analytics/data/v1alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/analytics/data/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "data_proto",
++ srcs = [
++ "analytics_data_api.proto",
++ "data.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:duration_proto",
++ ],
++)
++
++go_proto_library(
++ name = "data_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/analytics/data/v1alpha",
++ proto = ":data_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/analytics/data/v1beta/BUILD.bazel d/google/analytics/data/v1beta/BUILD.bazel
+--- c/google/analytics/data/v1beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/analytics/data/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "data_proto",
++ srcs = [
++ "analytics_data_api.proto",
++ "data.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "data_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/analytics/data/v1beta",
++ proto = ":data_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/api/BUILD.bazel d/google/api/BUILD.bazel
+--- c/google/api/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/api/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,215 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "annotations_proto",
++ srcs = [
++ "annotations.proto",
++ "client.proto",
++ "field_behavior.proto",
++ "http.proto",
++ "resource.proto",
++ "routing.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ ":api_proto",
++ "@com_google_protobuf//:descriptor_proto",
++ "@com_google_protobuf//:duration_proto",
++ ],
++)
++
++proto_library(
++ name = "api_proto",
++ srcs = ["launch_stage.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "configchange_proto",
++ srcs = ["config_change.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "distribution_proto",
++ srcs = ["distribution.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++proto_library(
++ name = "error_reason_proto",
++ srcs = ["error_reason.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "httpbody_proto",
++ srcs = ["httpbody.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:any_proto"],
++)
++
++proto_library(
++ name = "label_proto",
++ srcs = ["label.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "metric_proto",
++ srcs = ["metric.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ ":api_proto",
++ ":label_proto",
++ "@com_google_protobuf//:duration_proto",
++ ],
++)
++
++proto_library(
++ name = "monitoredres_proto",
++ srcs = ["monitored_resource.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ ":api_proto",
++ ":label_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++proto_library(
++ name = "serviceconfig_proto",
++ srcs = [
++ "auth.proto",
++ "backend.proto",
++ "billing.proto",
++ "consumer.proto",
++ "context.proto",
++ "control.proto",
++ "documentation.proto",
++ "endpoint.proto",
++ "log.proto",
++ "logging.proto",
++ "monitoring.proto",
++ "quota.proto",
++ "service.proto",
++ "source_info.proto",
++ "system_parameter.proto",
++ "usage.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ ":annotations_proto",
++ ":label_proto",
++ ":metric_proto",
++ ":monitoredres_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:api_proto",
++ "@com_google_protobuf//:type_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++proto_library(
++ name = "visibility_proto",
++ srcs = ["visibility.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:descriptor_proto"],
++)
++
++go_proto_library(
++ name = "annotations_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/api/annotations",
++ proto = ":annotations_proto",
++ visibility = ["//visibility:public"],
++ deps = [":api_go_proto"],
++)
++
++go_proto_library(
++ name = "api_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/api",
++ proto = ":api_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "configchange_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/api/configchange",
++ proto = ":configchange_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "distribution_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/api/distribution",
++ proto = ":distribution_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "error_reason_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/api/error_reason",
++ proto = ":error_reason_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "httpbody_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/api/httpbody",
++ proto = ":httpbody_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "label_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/api/label",
++ proto = ":label_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "metric_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/api/metric",
++ proto = ":metric_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ ":api_go_proto",
++ ":label_go_proto",
++ ],
++)
++
++go_proto_library(
++ name = "monitoredres_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/api/monitoredres",
++ proto = ":monitoredres_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ ":api_go_proto",
++ ":label_go_proto",
++ ],
++)
++
++go_proto_library(
++ name = "serviceconfig_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/api/serviceconfig",
++ proto = ":serviceconfig_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ ":annotations_go_proto",
++ ":label_go_proto",
++ ":metric_go_proto",
++ ":monitoredres_go_proto",
++ ],
++)
++
++go_proto_library(
++ name = "visibility_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/api/visibility",
++ proto = ":visibility_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/api/apikeys/v2/BUILD.bazel d/google/api/apikeys/v2/BUILD.bazel
+--- c/google/api/apikeys/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/api/apikeys/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "apikeys_proto",
++ srcs = [
++ "apikeys.proto",
++ "resources.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "apikeys_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/api/apikeys/v2",
++ proto = ":apikeys_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/api/expr/conformance/v1alpha1/BUILD.bazel d/google/api/expr/conformance/v1alpha1/BUILD.bazel
+--- c/google/api/expr/conformance/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/api/expr/conformance/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "confpb_proto",
++ srcs = ["conformance_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api/expr/v1alpha1:expr_proto",
++ "//google/rpc:status_proto",
++ ],
++)
++
++go_proto_library(
++ name = "confpb_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/api/expr/conformance/v1alpha1",
++ proto = ":confpb_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api/expr/v1alpha1:expr_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/api/expr/v1alpha1/BUILD.bazel d/google/api/expr/v1alpha1/BUILD.bazel
+--- c/google/api/expr/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/api/expr/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "expr_proto",
++ srcs = [
++ "checked.proto",
++ "eval.proto",
++ "explain.proto",
++ "syntax.proto",
++ "value.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "expr_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/api/expr/v1alpha1",
++ proto = ":expr_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/rpc:status_go_proto"],
++)
+diff -urN c/google/api/expr/v1beta1/BUILD.bazel d/google/api/expr/v1beta1/BUILD.bazel
+--- c/google/api/expr/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/api/expr/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "expr_proto",
++ srcs = [
++ "decl.proto",
++ "eval.proto",
++ "expr.proto",
++ "source.proto",
++ "value.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++go_proto_library(
++ name = "expr_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/api/expr/v1beta1",
++ proto = ":expr_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/rpc:status_go_proto"],
++)
+diff -urN c/google/api/servicecontrol/v1/BUILD.bazel d/google/api/servicecontrol/v1/BUILD.bazel
+--- c/google/api/servicecontrol/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/api/servicecontrol/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,41 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "servicecontrol_proto",
++ srcs = [
++ "check_error.proto",
++ "distribution.proto",
++ "http_request.proto",
++ "log_entry.proto",
++ "metric_value.proto",
++ "operation.proto",
++ "quota_controller.proto",
++ "service_controller.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:distribution_proto",
++ "//google/logging/type:ltype_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "servicecontrol_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/api/servicecontrol/v1",
++ proto = ":servicecontrol_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:distribution_go_proto",
++ "//google/logging/type:ltype_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/api/servicecontrol/v2/BUILD.bazel d/google/api/servicecontrol/v2/BUILD.bazel
+--- c/google/api/servicecontrol/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/api/servicecontrol/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "servicecontrol_proto",
++ srcs = ["service_controller.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "//google/rpc/context:attribute_context_proto",
++ ],
++)
++
++go_proto_library(
++ name = "servicecontrol_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/api/servicecontrol/v2",
++ proto = ":servicecontrol_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/rpc/context:attribute_context_go_proto",
++ ],
++)
+diff -urN c/google/api/servicemanagement/v1/BUILD.bazel d/google/api/servicemanagement/v1/BUILD.bazel
+--- c/google/api/servicemanagement/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/api/servicemanagement/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "servicemanagement_proto",
++ srcs = [
++ "resources.proto",
++ "servicemanager.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:configchange_proto",
++ "//google/api:serviceconfig_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "servicemanagement_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/api/servicemanagement/v1",
++ proto = ":servicemanagement_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:configchange_go_proto",
++ "//google/api:serviceconfig_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/api/serviceusage/v1/BUILD.bazel d/google/api/serviceusage/v1/BUILD.bazel
+--- c/google/api/serviceusage/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/api/serviceusage/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "serviceusage_proto",
++ srcs = [
++ "resources.proto",
++ "serviceusage.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:monitoredres_proto",
++ "//google/api:serviceconfig_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:api_proto",
++ ],
++)
++
++go_proto_library(
++ name = "serviceusage_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/api/serviceusage/v1",
++ proto = ":serviceusage_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:monitoredres_go_proto",
++ "//google/api:serviceconfig_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/api/serviceusage/v1beta1/BUILD.bazel d/google/api/serviceusage/v1beta1/BUILD.bazel
+--- c/google/api/serviceusage/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/api/serviceusage/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "serviceusage_proto",
++ srcs = [
++ "resources.proto",
++ "serviceusage.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:monitoredres_proto",
++ "//google/api:serviceconfig_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:api_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "serviceusage_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/api/serviceusage/v1beta1",
++ proto = ":serviceusage_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:monitoredres_go_proto",
++ "//google/api:serviceconfig_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/appengine/legacy/BUILD.bazel d/google/appengine/legacy/BUILD.bazel
+--- c/google/appengine/legacy/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/appengine/legacy/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "legacy_proto",
++ srcs = ["audit_data.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "legacy_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/appengine/legacy",
++ proto = ":legacy_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/appengine/logging/v1/BUILD.bazel d/google/appengine/logging/v1/BUILD.bazel
+--- c/google/appengine/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/appengine/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["request_log.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/logging/type:ltype_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/appengine/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/logging/type:ltype_go_proto"],
++)
+diff -urN c/google/appengine/v1/BUILD.bazel d/google/appengine/v1/BUILD.bazel
+--- c/google/appengine/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/appengine/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,45 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "appengine_proto",
++ srcs = [
++ "app_yaml.proto",
++ "appengine.proto",
++ "application.proto",
++ "audit_data.proto",
++ "certificate.proto",
++ "deploy.proto",
++ "deployed_files.proto",
++ "domain.proto",
++ "domain_mapping.proto",
++ "firewall.proto",
++ "instance.proto",
++ "location.proto",
++ "network_settings.proto",
++ "operation.proto",
++ "service.proto",
++ "version.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "appengine_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/appengine/v1",
++ proto = ":appengine_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/appengine/v1beta/BUILD.bazel d/google/appengine/v1beta/BUILD.bazel
+--- c/google/appengine/v1beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/appengine/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,44 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "appengine_proto",
++ srcs = [
++ "app_yaml.proto",
++ "appengine.proto",
++ "application.proto",
++ "audit_data.proto",
++ "certificate.proto",
++ "deploy.proto",
++ "domain.proto",
++ "domain_mapping.proto",
++ "firewall.proto",
++ "instance.proto",
++ "location.proto",
++ "network_settings.proto",
++ "operation.proto",
++ "service.proto",
++ "version.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "appengine_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/appengine/v1beta",
++ proto = ":appengine_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/apps/alertcenter/v1beta1/BUILD.bazel d/google/apps/alertcenter/v1beta1/BUILD.bazel
+--- c/google/apps/alertcenter/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/apps/alertcenter/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "alertcenter_proto",
++ srcs = ["alertcenter.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "alertcenter_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/apps/alertcenter/v1beta1",
++ proto = ":alertcenter_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/apps/drive/activity/v2/BUILD.bazel d/google/apps/drive/activity/v2/BUILD.bazel
+--- c/google/apps/drive/activity/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/apps/drive/activity/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "activity_proto",
++ srcs = [
++ "action.proto",
++ "actor.proto",
++ "common.proto",
++ "drive_activity_service.proto",
++ "query_drive_activity_request.proto",
++ "query_drive_activity_response.proto",
++ "target.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "activity_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/apps/drive/activity/v2",
++ proto = ":activity_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/apps/drive/labels/v2/BUILD.bazel d/google/apps/drive/labels/v2/BUILD.bazel
+--- c/google/apps/drive/labels/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/apps/drive/labels/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "labels_proto",
++ srcs = [
++ "common.proto",
++ "error_details.proto",
++ "exception_detail.proto",
++ "field.proto",
++ "label.proto",
++ "label_permission.proto",
++ "label_service.proto",
++ "requests.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:color_proto",
++ "//google/type:date_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "labels_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/apps/drive/labels/v2",
++ proto = ":labels_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:color_go_proto",
++ "//google/type:date_go_proto",
++ ],
++)
+diff -urN c/google/apps/drive/labels/v2beta/BUILD.bazel d/google/apps/drive/labels/v2beta/BUILD.bazel
+--- c/google/apps/drive/labels/v2beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/apps/drive/labels/v2beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,41 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "labels_proto",
++ srcs = [
++ "common.proto",
++ "error_details.proto",
++ "exception_detail.proto",
++ "field.proto",
++ "label.proto",
++ "label_limits.proto",
++ "label_lock.proto",
++ "label_permission.proto",
++ "label_service.proto",
++ "requests.proto",
++ "user_capabilities.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:color_proto",
++ "//google/type:date_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "labels_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/apps/drive/labels/v2beta",
++ proto = ":labels_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:color_go_proto",
++ "//google/type:date_go_proto",
++ ],
++)
+diff -urN c/google/apps/market/v2/BUILD.bazel d/google/apps/market/v2/BUILD.bazel
+--- c/google/apps/market/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/apps/market/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "marketplace_proto",
++ srcs = [
++ "resources.proto",
++ "services.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "marketplace_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/ccc/hosted/marketplace/v2",
++ proto = ":marketplace_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/apps/script/type/BUILD.bazel d/google/apps/script/type/BUILD.bazel
+--- c/google/apps/script/type/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/apps/script/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "type_proto",
++ srcs = [
++ "addon_widget_set.proto",
++ "extension_point.proto",
++ "script_manifest.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "type_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/apps/script/type",
++ proto = ":type_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/apps/script/type/calendar/BUILD.bazel d/google/apps/script/type/calendar/BUILD.bazel
+--- c/google/apps/script/type/calendar/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/apps/script/type/calendar/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "calendar_proto",
++ srcs = ["calendar_addon_manifest.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/apps/script/type:type_proto",
++ ],
++)
++
++go_proto_library(
++ name = "calendar_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/apps/script/type/calendar",
++ proto = ":calendar_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/apps/script/type:type_go_proto",
++ ],
++)
+diff -urN c/google/apps/script/type/docs/BUILD.bazel d/google/apps/script/type/docs/BUILD.bazel
+--- c/google/apps/script/type/docs/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/apps/script/type/docs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "docs_proto",
++ srcs = ["docs_addon_manifest.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/apps/script/type:type_proto",
++ ],
++)
++
++go_proto_library(
++ name = "docs_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/apps/script/type/docs",
++ proto = ":docs_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/apps/script/type:type_go_proto",
++ ],
++)
+diff -urN c/google/apps/script/type/drive/BUILD.bazel d/google/apps/script/type/drive/BUILD.bazel
+--- c/google/apps/script/type/drive/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/apps/script/type/drive/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "drive_proto",
++ srcs = ["drive_addon_manifest.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/apps/script/type:type_proto"],
++)
++
++go_proto_library(
++ name = "drive_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/apps/script/type/drive",
++ proto = ":drive_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/apps/script/type:type_go_proto"],
++)
+diff -urN c/google/apps/script/type/gmail/BUILD.bazel d/google/apps/script/type/gmail/BUILD.bazel
+--- c/google/apps/script/type/gmail/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/apps/script/type/gmail/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "gmail_proto",
++ srcs = ["gmail_addon_manifest.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/apps/script/type:type_proto"],
++)
++
++go_proto_library(
++ name = "gmail_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/apps/script/type/gmail",
++ proto = ":gmail_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/apps/script/type:type_go_proto"],
++)
+diff -urN c/google/apps/script/type/sheets/BUILD.bazel d/google/apps/script/type/sheets/BUILD.bazel
+--- c/google/apps/script/type/sheets/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/apps/script/type/sheets/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "sheets_proto",
++ srcs = ["sheets_addon_manifest.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/apps/script/type:type_proto",
++ ],
++)
++
++go_proto_library(
++ name = "sheets_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/apps/script/type/sheets",
++ proto = ":sheets_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/apps/script/type:type_go_proto",
++ ],
++)
+diff -urN c/google/apps/script/type/slides/BUILD.bazel d/google/apps/script/type/slides/BUILD.bazel
+--- c/google/apps/script/type/slides/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/apps/script/type/slides/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "slides_proto",
++ srcs = ["slides_addon_manifest.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/apps/script/type:type_proto",
++ ],
++)
++
++go_proto_library(
++ name = "slides_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/apps/script/type/slides",
++ proto = ":slides_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/apps/script/type:type_go_proto",
++ ],
++)
+diff -urN c/google/area120/tables/v1alpha1/BUILD.bazel d/google/area120/tables/v1alpha1/BUILD.bazel
+--- c/google/area120/tables/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/area120/tables/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "tables_proto",
++ srcs = ["tables.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++go_proto_library(
++ name = "tables_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/area120/tables/v1alpha1",
++ proto = ":tables_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/assistant/embedded/v1alpha1/BUILD.bazel d/google/assistant/embedded/v1alpha1/BUILD.bazel
+--- c/google/assistant/embedded/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/assistant/embedded/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "embedded_proto",
++ srcs = ["embedded_assistant.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ ],
++)
++
++go_proto_library(
++ name = "embedded_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/assistant/embedded/v1alpha1",
++ proto = ":embedded_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/assistant/embedded/v1alpha2/BUILD.bazel d/google/assistant/embedded/v1alpha2/BUILD.bazel
+--- c/google/assistant/embedded/v1alpha2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/assistant/embedded/v1alpha2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "embedded_proto",
++ srcs = ["embedded_assistant.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:latlng_proto",
++ ],
++)
++
++go_proto_library(
++ name = "embedded_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/assistant/embedded/v1alpha2",
++ proto = ":embedded_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/bigtable/admin/v2/BUILD.bazel d/google/bigtable/admin/v2/BUILD.bazel
+--- c/google/bigtable/admin/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/bigtable/admin/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "admin_proto",
++ srcs = [
++ "bigtable_instance_admin.proto",
++ "bigtable_table_admin.proto",
++ "common.proto",
++ "instance.proto",
++ "table.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "admin_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/bigtable/admin/v2",
++ proto = ":admin_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/bigtable/v2/BUILD.bazel d/google/bigtable/v2/BUILD.bazel
+--- c/google/bigtable/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/bigtable/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "bigtable_proto",
++ srcs = [
++ "bigtable.proto",
++ "data.proto",
++ "request_stats.proto",
++ "response_params.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "bigtable_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/bigtable/v2",
++ proto = ":bigtable_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/bytestream/BUILD.bazel d/google/bytestream/BUILD.bazel
+--- c/google/bytestream/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/bytestream/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "bytestream_proto",
++ srcs = ["bytestream.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "bytestream_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/bytestream",
++ proto = ":bytestream_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/chat/logging/v1/BUILD.bazel d/google/chat/logging/v1/BUILD.bazel
+--- c/google/chat/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/chat/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["chat_app_log_entry.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/rpc:status_proto"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/chat/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/rpc:status_go_proto"],
++)
+diff -urN c/google/chromeos/moblab/v1beta1/BUILD.bazel d/google/chromeos/moblab/v1beta1/BUILD.bazel
+--- c/google/chromeos/moblab/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/chromeos/moblab/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "moblab_proto",
++ srcs = [
++ "build_service.proto",
++ "resources.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "moblab_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/chromeos/moblab/v1beta1",
++ proto = ":moblab_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/chromeos/uidetection/v1/BUILD.bazel d/google/chromeos/uidetection/v1/BUILD.bazel
+--- c/google/chromeos/uidetection/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/chromeos/uidetection/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "uidetection_proto",
++ srcs = ["ui_detection.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "uidetection_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/chromeos/uidetection/v1",
++ proto = ":uidetection_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/BUILD.bazel d/google/cloud/BUILD.bazel
+--- c/google/cloud/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "cloud_proto",
++ srcs = ["common_resources.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++proto_library(
++ name = "extendedops_proto",
++ srcs = ["extended_operations.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:descriptor_proto"],
++)
++
++go_proto_library(
++ name = "cloud_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud",
++ proto = ":cloud_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
++
++go_proto_library(
++ name = "extendedops_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/extendedops",
++ proto = ":extendedops_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/accessapproval/v1/BUILD.bazel d/google/cloud/accessapproval/v1/BUILD.bazel
+--- c/google/cloud/accessapproval/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/accessapproval/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "accessapproval_proto",
++ srcs = ["accessapproval.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "accessapproval_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/accessapproval/v1",
++ proto = ":accessapproval_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/aiplatform/logging/BUILD.bazel d/google/cloud/aiplatform/logging/BUILD.bazel
+--- c/google/cloud/aiplatform/logging/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/aiplatform/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["prediction.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/rpc:status_proto"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/logging",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/rpc:status_go_proto"],
++)
+diff -urN c/google/cloud/aiplatform/v1/BUILD.bazel d/google/cloud/aiplatform/v1/BUILD.bazel
+--- c/google/cloud/aiplatform/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/aiplatform/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,110 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "aiplatform_proto",
++ srcs = [
++ "accelerator_type.proto",
++ "annotation.proto",
++ "annotation_spec.proto",
++ "artifact.proto",
++ "batch_prediction_job.proto",
++ "completion_stats.proto",
++ "context.proto",
++ "custom_job.proto",
++ "data_item.proto",
++ "data_labeling_job.proto",
++ "dataset.proto",
++ "dataset_service.proto",
++ "deployed_index_ref.proto",
++ "deployed_model_ref.proto",
++ "encryption_spec.proto",
++ "endpoint.proto",
++ "endpoint_service.proto",
++ "entity_type.proto",
++ "env_var.proto",
++ "event.proto",
++ "execution.proto",
++ "explanation.proto",
++ "explanation_metadata.proto",
++ "feature.proto",
++ "feature_monitoring_stats.proto",
++ "feature_selector.proto",
++ "featurestore.proto",
++ "featurestore_monitoring.proto",
++ "featurestore_online_service.proto",
++ "featurestore_service.proto",
++ "hyperparameter_tuning_job.proto",
++ "index.proto",
++ "index_endpoint.proto",
++ "index_endpoint_service.proto",
++ "index_service.proto",
++ "io.proto",
++ "job_service.proto",
++ "job_state.proto",
++ "lineage_subgraph.proto",
++ "machine_resources.proto",
++ "manual_batch_tuning_parameters.proto",
++ "metadata_schema.proto",
++ "metadata_service.proto",
++ "metadata_store.proto",
++ "migratable_resource.proto",
++ "migration_service.proto",
++ "model.proto",
++ "model_deployment_monitoring_job.proto",
++ "model_evaluation.proto",
++ "model_evaluation_slice.proto",
++ "model_monitoring.proto",
++ "model_service.proto",
++ "operation.proto",
++ "pipeline_failure_policy.proto",
++ "pipeline_job.proto",
++ "pipeline_service.proto",
++ "pipeline_state.proto",
++ "prediction_service.proto",
++ "saved_query.proto",
++ "specialist_pool.proto",
++ "specialist_pool_service.proto",
++ "study.proto",
++ "tensorboard.proto",
++ "tensorboard_data.proto",
++ "tensorboard_experiment.proto",
++ "tensorboard_run.proto",
++ "tensorboard_service.proto",
++ "tensorboard_time_series.proto",
++ "training_pipeline.proto",
++ "types.proto",
++ "unmanaged_container_model.proto",
++ "user_action_reference.proto",
++ "value.proto",
++ "vizier_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:httpbody_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:money_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "aiplatform_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1",
++ proto = ":aiplatform_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:httpbody_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:money_go_proto",
++ ],
++)
+diff -urN c/google/cloud/aiplatform/v1/schema/predict/instance/BUILD.bazel d/google/cloud/aiplatform/v1/schema/predict/instance/BUILD.bazel
+--- c/google/cloud/aiplatform/v1/schema/predict/instance/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/aiplatform/v1/schema/predict/instance/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "instance_proto",
++ srcs = [
++ "image_classification.proto",
++ "image_object_detection.proto",
++ "image_segmentation.proto",
++ "text_classification.proto",
++ "text_extraction.proto",
++ "text_sentiment.proto",
++ "video_action_recognition.proto",
++ "video_classification.proto",
++ "video_object_tracking.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "instance_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1/schema/predict/instance",
++ proto = ":instance_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/aiplatform/v1/schema/predict/params/BUILD.bazel d/google/cloud/aiplatform/v1/schema/predict/params/BUILD.bazel
+--- c/google/cloud/aiplatform/v1/schema/predict/params/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/aiplatform/v1/schema/predict/params/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "params_proto",
++ srcs = [
++ "image_classification.proto",
++ "image_object_detection.proto",
++ "image_segmentation.proto",
++ "video_action_recognition.proto",
++ "video_classification.proto",
++ "video_object_tracking.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "params_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1/schema/predict/params",
++ proto = ":params_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/aiplatform/v1/schema/predict/prediction/BUILD.bazel d/google/cloud/aiplatform/v1/schema/predict/prediction/BUILD.bazel
+--- c/google/cloud/aiplatform/v1/schema/predict/prediction/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/aiplatform/v1/schema/predict/prediction/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "prediction_proto",
++ srcs = [
++ "classification.proto",
++ "image_object_detection.proto",
++ "image_segmentation.proto",
++ "tabular_classification.proto",
++ "tabular_regression.proto",
++ "text_extraction.proto",
++ "text_sentiment.proto",
++ "video_action_recognition.proto",
++ "video_classification.proto",
++ "video_object_tracking.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "prediction_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1/schema/predict/prediction",
++ proto = ":prediction_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/aiplatform/v1/schema/trainingjob/definition/BUILD.bazel d/google/cloud/aiplatform/v1/schema/trainingjob/definition/BUILD.bazel
+--- c/google/cloud/aiplatform/v1/schema/trainingjob/definition/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/aiplatform/v1/schema/trainingjob/definition/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "definition_proto",
++ srcs = [
++ "automl_image_classification.proto",
++ "automl_image_object_detection.proto",
++ "automl_image_segmentation.proto",
++ "automl_tables.proto",
++ "automl_text_classification.proto",
++ "automl_text_extraction.proto",
++ "automl_text_sentiment.proto",
++ "automl_video_action_recognition.proto",
++ "automl_video_classification.proto",
++ "automl_video_object_tracking.proto",
++ "export_evaluated_data_items_config.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "definition_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1/schema/trainingjob/definition",
++ proto = ":definition_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/aiplatform/v1beta1/BUILD.bazel d/google/cloud/aiplatform/v1beta1/BUILD.bazel
+--- c/google/cloud/aiplatform/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/aiplatform/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,114 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "aiplatform_proto",
++ srcs = [
++ "accelerator_type.proto",
++ "annotation.proto",
++ "annotation_spec.proto",
++ "artifact.proto",
++ "batch_prediction_job.proto",
++ "completion_stats.proto",
++ "context.proto",
++ "custom_job.proto",
++ "data_item.proto",
++ "data_labeling_job.proto",
++ "dataset.proto",
++ "dataset_service.proto",
++ "deployed_index_ref.proto",
++ "deployed_model_ref.proto",
++ "deployment_resource_pool.proto",
++ "deployment_resource_pool_service.proto",
++ "encryption_spec.proto",
++ "endpoint.proto",
++ "endpoint_service.proto",
++ "entity_type.proto",
++ "env_var.proto",
++ "event.proto",
++ "execution.proto",
++ "explanation.proto",
++ "explanation_metadata.proto",
++ "feature.proto",
++ "feature_monitoring_stats.proto",
++ "feature_selector.proto",
++ "featurestore.proto",
++ "featurestore_monitoring.proto",
++ "featurestore_online_service.proto",
++ "featurestore_service.proto",
++ "hyperparameter_tuning_job.proto",
++ "index.proto",
++ "index_endpoint.proto",
++ "index_endpoint_service.proto",
++ "index_service.proto",
++ "io.proto",
++ "job_service.proto",
++ "job_state.proto",
++ "lineage_subgraph.proto",
++ "machine_resources.proto",
++ "manual_batch_tuning_parameters.proto",
++ "metadata_schema.proto",
++ "metadata_service.proto",
++ "metadata_store.proto",
++ "migratable_resource.proto",
++ "migration_service.proto",
++ "model.proto",
++ "model_deployment_monitoring_job.proto",
++ "model_evaluation.proto",
++ "model_evaluation_slice.proto",
++ "model_monitoring.proto",
++ "model_service.proto",
++ "operation.proto",
++ "pipeline_failure_policy.proto",
++ "pipeline_job.proto",
++ "pipeline_service.proto",
++ "pipeline_state.proto",
++ "prediction_service.proto",
++ "saved_query.proto",
++ "specialist_pool.proto",
++ "specialist_pool_service.proto",
++ "study.proto",
++ "tensorboard.proto",
++ "tensorboard_data.proto",
++ "tensorboard_experiment.proto",
++ "tensorboard_run.proto",
++ "tensorboard_service.proto",
++ "tensorboard_time_series.proto",
++ "training_pipeline.proto",
++ "types.proto",
++ "unmanaged_container_model.proto",
++ "user_action_reference.proto",
++ "value.proto",
++ "vizier_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:httpbody_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:interval_proto",
++ "//google/type:money_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "aiplatform_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1",
++ proto = ":aiplatform_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:httpbody_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:interval_go_proto",
++ "//google/type:money_go_proto",
++ ],
++)
+diff -urN c/google/cloud/aiplatform/v1beta1/schema/BUILD.bazel d/google/cloud/aiplatform/v1beta1/schema/BUILD.bazel
+--- c/google/cloud/aiplatform/v1beta1/schema/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/aiplatform/v1beta1/schema/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "schema_proto",
++ srcs = [
++ "annotation_payload.proto",
++ "annotation_spec_color.proto",
++ "data_item_payload.proto",
++ "dataset_metadata.proto",
++ "geometry.proto",
++ "io_format.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/aiplatform/v1beta1/schema/predict/instance:instance_proto",
++ "//google/rpc:code_proto",
++ "//google/type:color_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++go_proto_library(
++ name = "schema_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1/schema",
++ proto = ":schema_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/aiplatform/v1beta1/schema/predict/instance:instance_go_proto",
++ "//google/rpc:code_go_proto",
++ "//google/type:color_go_proto",
++ ],
++)
+diff -urN c/google/cloud/aiplatform/v1beta1/schema/predict/instance/BUILD.bazel d/google/cloud/aiplatform/v1beta1/schema/predict/instance/BUILD.bazel
+--- c/google/cloud/aiplatform/v1beta1/schema/predict/instance/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/aiplatform/v1beta1/schema/predict/instance/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "instance_proto",
++ srcs = [
++ "image_classification.proto",
++ "image_object_detection.proto",
++ "image_segmentation.proto",
++ "text_classification.proto",
++ "text_extraction.proto",
++ "text_sentiment.proto",
++ "video_action_recognition.proto",
++ "video_classification.proto",
++ "video_object_tracking.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "instance_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1/schema/predict/instance",
++ proto = ":instance_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/aiplatform/v1beta1/schema/predict/params/BUILD.bazel d/google/cloud/aiplatform/v1beta1/schema/predict/params/BUILD.bazel
+--- c/google/cloud/aiplatform/v1beta1/schema/predict/params/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/aiplatform/v1beta1/schema/predict/params/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "params_proto",
++ srcs = [
++ "image_classification.proto",
++ "image_object_detection.proto",
++ "image_segmentation.proto",
++ "video_action_recognition.proto",
++ "video_classification.proto",
++ "video_object_tracking.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "params_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1/schema/predict/params",
++ proto = ":params_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/aiplatform/v1beta1/schema/predict/prediction/BUILD.bazel d/google/cloud/aiplatform/v1beta1/schema/predict/prediction/BUILD.bazel
+--- c/google/cloud/aiplatform/v1beta1/schema/predict/prediction/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/aiplatform/v1beta1/schema/predict/prediction/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "prediction_proto",
++ srcs = [
++ "classification.proto",
++ "image_object_detection.proto",
++ "image_segmentation.proto",
++ "tabular_classification.proto",
++ "tabular_regression.proto",
++ "text_extraction.proto",
++ "text_sentiment.proto",
++ "time_series_forecasting.proto",
++ "video_action_recognition.proto",
++ "video_classification.proto",
++ "video_object_tracking.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "prediction_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1/schema/predict/prediction",
++ proto = ":prediction_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/BUILD.bazel d/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/BUILD.bazel
+--- c/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/aiplatform/v1beta1/schema/trainingjob/definition/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "definition_proto",
++ srcs = [
++ "automl_image_classification.proto",
++ "automl_image_object_detection.proto",
++ "automl_image_segmentation.proto",
++ "automl_tables.proto",
++ "automl_text_classification.proto",
++ "automl_text_extraction.proto",
++ "automl_text_sentiment.proto",
++ "automl_time_series_forecasting.proto",
++ "automl_video_action_recognition.proto",
++ "automl_video_classification.proto",
++ "automl_video_object_tracking.proto",
++ "export_evaluated_data_items_config.proto",
++ ],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "definition_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1/schema/trainingjob/definition",
++ proto = ":definition_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/apigateway/v1/BUILD.bazel d/google/cloud/apigateway/v1/BUILD.bazel
+--- c/google/cloud/apigateway/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/apigateway/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "apigateway_proto",
++ srcs = [
++ "apigateway.proto",
++ "apigateway_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "apigateway_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/apigateway/v1",
++ proto = ":apigateway_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/apigeeconnect/v1/BUILD.bazel d/google/cloud/apigeeconnect/v1/BUILD.bazel
+--- c/google/cloud/apigeeconnect/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/apigeeconnect/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "apigeeconnect_proto",
++ srcs = [
++ "connection.proto",
++ "tether.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ ],
++)
++
++go_proto_library(
++ name = "apigeeconnect_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/apigeeconnect/v1",
++ proto = ":apigeeconnect_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/apigeeregistry/v1/BUILD.bazel d/google/cloud/apigeeregistry/v1/BUILD.bazel
+--- c/google/cloud/apigeeregistry/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/apigeeregistry/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "apigeeregistry_proto",
++ srcs = [
++ "provisioning_service.proto",
++ "registry_models.proto",
++ "registry_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:httpbody_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "apigeeregistry_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1",
++ proto = ":apigeeregistry_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:httpbody_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/asset/v1/BUILD.bazel d/google/cloud/asset/v1/BUILD.bazel
+--- c/google/cloud/asset/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/asset/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,46 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "asset_proto",
++ srcs = [
++ "asset_service.proto",
++ "assets.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/orgpolicy/v1:orgpolicy_proto",
++ "//google/cloud/osconfig/v1:osconfig_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/identity/accesscontextmanager/v1:accesscontextmanager_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:code_proto",
++ "//google/rpc:status_proto",
++ "//google/type:expr_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "asset_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1",
++ proto = ":asset_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/orgpolicy/v1:orgpolicy_go_proto",
++ "//google/cloud/osconfig/v1:osconfig_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/identity/accesscontextmanager/v1:accesscontextmanager_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:code_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:expr_go_proto",
++ ],
++)
+diff -urN c/google/cloud/asset/v1p1beta1/BUILD.bazel d/google/cloud/asset/v1p1beta1/BUILD.bazel
+--- c/google/cloud/asset/v1p1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/asset/v1p1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "asset_proto",
++ srcs = [
++ "asset_service.proto",
++ "assets.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ ],
++)
++
++go_proto_library(
++ name = "asset_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1p1beta1",
++ proto = ":asset_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/asset/v1p2beta1/BUILD.bazel d/google/cloud/asset/v1p2beta1/BUILD.bazel
+--- c/google/cloud/asset/v1p2beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/asset/v1p2beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "asset_proto",
++ srcs = [
++ "asset_service.proto",
++ "assets.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "asset_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1p2beta1",
++ proto = ":asset_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/asset/v1p5beta1/BUILD.bazel d/google/cloud/asset/v1p5beta1/BUILD.bazel
+--- c/google/cloud/asset/v1p5beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/asset/v1p5beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "asset_proto",
++ srcs = [
++ "asset_service.proto",
++ "assets.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/orgpolicy/v1:orgpolicy_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/identity/accesscontextmanager/v1:accesscontextmanager_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "asset_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1p5beta1",
++ proto = ":asset_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/orgpolicy/v1:orgpolicy_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/identity/accesscontextmanager/v1:accesscontextmanager_go_proto",
++ ],
++)
+diff -urN c/google/cloud/asset/v1p7beta1/BUILD.bazel d/google/cloud/asset/v1p7beta1/BUILD.bazel
+--- c/google/cloud/asset/v1p7beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/asset/v1p7beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "asset_proto",
++ srcs = [
++ "asset_service.proto",
++ "assets.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/orgpolicy/v1:orgpolicy_proto",
++ "//google/cloud/osconfig/v1:osconfig_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/identity/accesscontextmanager/v1:accesscontextmanager_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "asset_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1p7beta1",
++ proto = ":asset_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/orgpolicy/v1:orgpolicy_go_proto",
++ "//google/cloud/osconfig/v1:osconfig_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/identity/accesscontextmanager/v1:accesscontextmanager_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/assuredworkloads/regulatoryintercept/logging/v1/BUILD.bazel d/google/cloud/assuredworkloads/regulatoryintercept/logging/v1/BUILD.bazel
+--- c/google/cloud/assuredworkloads/regulatoryintercept/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/assuredworkloads/regulatoryintercept/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["regulatory_intercept_ack_log_entry.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/assuredworkloads/regulatoryintercept/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/assuredworkloads/v1/BUILD.bazel d/google/cloud/assuredworkloads/v1/BUILD.bazel
+--- c/google/cloud/assuredworkloads/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/assuredworkloads/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "assuredworkloads_proto",
++ srcs = ["assuredworkloads.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "assuredworkloads_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/assuredworkloads/v1",
++ proto = ":assuredworkloads_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/assuredworkloads/v1beta1/BUILD.bazel d/google/cloud/assuredworkloads/v1beta1/BUILD.bazel
+--- c/google/cloud/assuredworkloads/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/assuredworkloads/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "assuredworkloads_proto",
++ srcs = [
++ "assuredworkloads.proto",
++ "assuredworkloads_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "assuredworkloads_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/assuredworkloads/v1beta1",
++ proto = ":assuredworkloads_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/audit/BUILD.bazel d/google/cloud/audit/BUILD.bazel
+--- c/google/cloud/audit/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/audit/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "audit_proto",
++ srcs = [
++ "audit_log.proto",
++ "bigquery_audit_metadata.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/rpc:status_proto",
++ "//google/rpc/context:attribute_context_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "audit_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/audit",
++ proto = ":audit_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/rpc/context:attribute_context_go_proto",
++ ],
++)
+diff -urN c/google/cloud/automl/v1/BUILD.bazel d/google/cloud/automl/v1/BUILD.bazel
+--- c/google/cloud/automl/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/automl/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,48 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "automl_proto",
++ srcs = [
++ "annotation_payload.proto",
++ "annotation_spec.proto",
++ "classification.proto",
++ "data_items.proto",
++ "dataset.proto",
++ "detection.proto",
++ "geometry.proto",
++ "image.proto",
++ "io.proto",
++ "model.proto",
++ "model_evaluation.proto",
++ "operations.proto",
++ "prediction_service.proto",
++ "service.proto",
++ "text.proto",
++ "text_extraction.proto",
++ "text_segment.proto",
++ "text_sentiment.proto",
++ "translation.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "automl_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/automl/v1",
++ proto = ":automl_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/automl/v1beta1/BUILD.bazel d/google/cloud/automl/v1beta1/BUILD.bazel
+--- c/google/cloud/automl/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/automl/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,59 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "automl_proto",
++ srcs = [
++ "annotation_payload.proto",
++ "annotation_spec.proto",
++ "classification.proto",
++ "column_spec.proto",
++ "data_items.proto",
++ "data_stats.proto",
++ "data_types.proto",
++ "dataset.proto",
++ "detection.proto",
++ "geometry.proto",
++ "image.proto",
++ "io.proto",
++ "model.proto",
++ "model_evaluation.proto",
++ "operations.proto",
++ "prediction_service.proto",
++ "ranges.proto",
++ "regression.proto",
++ "service.proto",
++ "table_spec.proto",
++ "tables.proto",
++ "temporal.proto",
++ "text.proto",
++ "text_extraction.proto",
++ "text_segment.proto",
++ "text_sentiment.proto",
++ "translation.proto",
++ "video.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "automl_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/automl/v1beta1",
++ proto = ":automl_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/backupdr/logging/v1/BUILD.bazel d/google/cloud/backupdr/logging/v1/BUILD.bazel
+--- c/google/cloud/backupdr/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/backupdr/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,16 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["eventlog.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:timestamp_proto"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/backupdr/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/baremetalsolution/v2/BUILD.bazel d/google/cloud/baremetalsolution/v2/BUILD.bazel
+--- c/google/cloud/baremetalsolution/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/baremetalsolution/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "baremetalsolution_proto",
++ srcs = [
++ "baremetalsolution.proto",
++ "instance.proto",
++ "lun.proto",
++ "network.proto",
++ "nfs_share.proto",
++ "volume.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "baremetalsolution_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/baremetalsolution/v2",
++ proto = ":baremetalsolution_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/batch/v1/BUILD.bazel d/google/cloud/batch/v1/BUILD.bazel
+--- c/google/cloud/batch/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/batch/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "batch_proto",
++ srcs = [
++ "batch.proto",
++ "job.proto",
++ "task.proto",
++ "volume.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "batch_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/batch/v1",
++ proto = ":batch_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/batch/v1alpha/BUILD.bazel d/google/cloud/batch/v1alpha/BUILD.bazel
+--- c/google/cloud/batch/v1alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/batch/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "batch_proto",
++ srcs = [
++ "batch.proto",
++ "job.proto",
++ "task.proto",
++ "volume.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "batch_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/batch/v1alpha",
++ proto = ":batch_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/beyondcorp/appconnections/v1/BUILD.bazel d/google/cloud/beyondcorp/appconnections/v1/BUILD.bazel
+--- c/google/cloud/beyondcorp/appconnections/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/beyondcorp/appconnections/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "appconnections_proto",
++ srcs = ["app_connections_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "appconnections_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/beyondcorp/appconnections/v1",
++ proto = ":appconnections_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/beyondcorp/appconnectors/v1/BUILD.bazel d/google/cloud/beyondcorp/appconnectors/v1/BUILD.bazel
+--- c/google/cloud/beyondcorp/appconnectors/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/beyondcorp/appconnectors/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "appconnectors_proto",
++ srcs = [
++ "app_connector_instance_config.proto",
++ "app_connectors_service.proto",
++ "resource_info.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "appconnectors_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/beyondcorp/appconnectors/v1",
++ proto = ":appconnectors_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/beyondcorp/appgateways/v1/BUILD.bazel d/google/cloud/beyondcorp/appgateways/v1/BUILD.bazel
+--- c/google/cloud/beyondcorp/appgateways/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/beyondcorp/appgateways/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "appgateways_proto",
++ srcs = ["app_gateways_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "appgateways_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/beyondcorp/appgateways/v1",
++ proto = ":appgateways_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/beyondcorp/clientconnectorservices/v1/BUILD.bazel d/google/cloud/beyondcorp/clientconnectorservices/v1/BUILD.bazel
+--- c/google/cloud/beyondcorp/clientconnectorservices/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/beyondcorp/clientconnectorservices/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "clientconnectorservices_proto",
++ srcs = ["client_connector_services_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "clientconnectorservices_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/beyondcorp/clientconnectorservices/v1",
++ proto = ":clientconnectorservices_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/beyondcorp/clientgateways/v1/BUILD.bazel d/google/cloud/beyondcorp/clientgateways/v1/BUILD.bazel
+--- c/google/cloud/beyondcorp/clientgateways/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/beyondcorp/clientgateways/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "clientgateways_proto",
++ srcs = ["client_gateways_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "clientgateways_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/beyondcorp/clientgateways/v1",
++ proto = ":clientgateways_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/bigquery/analyticshub/v1/BUILD.bazel d/google/cloud/bigquery/analyticshub/v1/BUILD.bazel
+--- c/google/cloud/bigquery/analyticshub/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/bigquery/analyticshub/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "analyticshub_proto",
++ srcs = ["analyticshub.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "analyticshub_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/analyticshub/v1",
++ proto = ":analyticshub_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/bigquery/connection/v1/BUILD.bazel d/google/cloud/bigquery/connection/v1/BUILD.bazel
+--- c/google/cloud/bigquery/connection/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/bigquery/connection/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "connection_proto",
++ srcs = ["connection.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "connection_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1",
++ proto = ":connection_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/bigquery/connection/v1beta1/BUILD.bazel d/google/cloud/bigquery/connection/v1beta1/BUILD.bazel
+--- c/google/cloud/bigquery/connection/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/bigquery/connection/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "connection_proto",
++ srcs = ["connection.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "connection_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1beta1",
++ proto = ":connection_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/bigquery/dataexchange/v1beta1/BUILD.bazel d/google/cloud/bigquery/dataexchange/v1beta1/BUILD.bazel
+--- c/google/cloud/bigquery/dataexchange/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/bigquery/dataexchange/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "dataexchange_proto",
++ srcs = ["dataexchange.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "dataexchange_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1",
++ proto = ":dataexchange_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/bigquery/datapolicies/v1/BUILD.bazel d/google/cloud/bigquery/datapolicies/v1/BUILD.bazel
+--- c/google/cloud/bigquery/datapolicies/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/bigquery/datapolicies/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "datapolicies_proto",
++ srcs = ["datapolicy.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "datapolicies_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/datapolicies/v1",
++ proto = ":datapolicies_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/bigquery/datapolicies/v1beta1/BUILD.bazel d/google/cloud/bigquery/datapolicies/v1beta1/BUILD.bazel
+--- c/google/cloud/bigquery/datapolicies/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/bigquery/datapolicies/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "datapolicies_proto",
++ srcs = ["datapolicy.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "datapolicies_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/datapolicies/v1beta1",
++ proto = ":datapolicies_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/bigquery/datatransfer/v1/BUILD.bazel d/google/cloud/bigquery/datatransfer/v1/BUILD.bazel
+--- c/google/cloud/bigquery/datatransfer/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/bigquery/datatransfer/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "datatransfer_proto",
++ srcs = [
++ "datatransfer.proto",
++ "transfer.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "datatransfer_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1",
++ proto = ":datatransfer_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/bigquery/logging/v1/BUILD.bazel d/google/cloud/bigquery/logging/v1/BUILD.bazel
+--- c/google/cloud/bigquery/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/bigquery/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["audit_data.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/iam/v1:iam_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/iam/v1:iam_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/bigquery/migration/v2/BUILD.bazel d/google/cloud/bigquery/migration/v2/BUILD.bazel
+--- c/google/cloud/bigquery/migration/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/bigquery/migration/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "migration_proto",
++ srcs = [
++ "migration_entities.proto",
++ "migration_error_details.proto",
++ "migration_metrics.proto",
++ "migration_service.proto",
++ "translation_config.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:distribution_proto",
++ "//google/api:metric_proto",
++ "//google/rpc:errdetails_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "migration_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2",
++ proto = ":migration_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:distribution_go_proto",
++ "//google/api:metric_go_proto",
++ "//google/rpc:errdetails_go_proto",
++ ],
++)
+diff -urN c/google/cloud/bigquery/migration/v2alpha/BUILD.bazel d/google/cloud/bigquery/migration/v2alpha/BUILD.bazel
+--- c/google/cloud/bigquery/migration/v2alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/bigquery/migration/v2alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "migration_proto",
++ srcs = [
++ "assessment_task.proto",
++ "migration_entities.proto",
++ "migration_error_details.proto",
++ "migration_metrics.proto",
++ "migration_service.proto",
++ "translation_service.proto",
++ "translation_task.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:distribution_proto",
++ "//google/api:metric_proto",
++ "//google/rpc:errdetails_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "migration_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha",
++ proto = ":migration_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:distribution_go_proto",
++ "//google/api:metric_go_proto",
++ "//google/rpc:errdetails_go_proto",
++ ],
++)
+diff -urN c/google/cloud/bigquery/reservation/v1/BUILD.bazel d/google/cloud/bigquery/reservation/v1/BUILD.bazel
+--- c/google/cloud/bigquery/reservation/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/bigquery/reservation/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "reservation_proto",
++ srcs = ["reservation.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "reservation_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/reservation/v1",
++ proto = ":reservation_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/bigquery/storage/v1/BUILD.bazel d/google/cloud/bigquery/storage/v1/BUILD.bazel
+--- c/google/cloud/bigquery/storage/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/bigquery/storage/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "storage_proto",
++ srcs = [
++ "annotations.proto",
++ "arrow.proto",
++ "avro.proto",
++ "protobuf.proto",
++ "storage.proto",
++ "stream.proto",
++ "table.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:descriptor_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "storage_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1",
++ proto = ":storage_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/bigquery/storage/v1beta1/BUILD.bazel d/google/cloud/bigquery/storage/v1beta1/BUILD.bazel
+--- c/google/cloud/bigquery/storage/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/bigquery/storage/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "storage_proto",
++ srcs = [
++ "arrow.proto",
++ "avro.proto",
++ "read_options.proto",
++ "storage.proto",
++ "table_reference.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "storage_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1",
++ proto = ":storage_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/bigquery/storage/v1beta2/BUILD.bazel d/google/cloud/bigquery/storage/v1beta2/BUILD.bazel
+--- c/google/cloud/bigquery/storage/v1beta2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/bigquery/storage/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "storage_proto",
++ srcs = [
++ "arrow.proto",
++ "avro.proto",
++ "protobuf.proto",
++ "storage.proto",
++ "stream.proto",
++ "table.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:descriptor_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "storage_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta2",
++ proto = ":storage_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/bigquery/v2/BUILD.bazel d/google/cloud/bigquery/v2/BUILD.bazel
+--- c/google/cloud/bigquery/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/bigquery/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "bigquery_proto",
++ srcs = [
++ "encryption_config.proto",
++ "model.proto",
++ "model_reference.proto",
++ "standard_sql.proto",
++ "table_reference.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "bigquery_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/v2",
++ proto = ":bigquery_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/billing/budgets/v1/BUILD.bazel d/google/cloud/billing/budgets/v1/BUILD.bazel
+--- c/google/cloud/billing/budgets/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/billing/budgets/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "budgets_proto",
++ srcs = [
++ "budget_model.proto",
++ "budget_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:date_proto",
++ "//google/type:money_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++go_proto_library(
++ name = "budgets_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/billing/budgets/v1",
++ proto = ":budgets_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:date_go_proto",
++ "//google/type:money_go_proto",
++ ],
++)
+diff -urN c/google/cloud/billing/budgets/v1beta1/BUILD.bazel d/google/cloud/billing/budgets/v1beta1/BUILD.bazel
+--- c/google/cloud/billing/budgets/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/billing/budgets/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "budgets_proto",
++ srcs = [
++ "budget_model.proto",
++ "budget_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:date_proto",
++ "//google/type:money_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++go_proto_library(
++ name = "budgets_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/billing/budgets/v1beta1",
++ proto = ":budgets_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:date_go_proto",
++ "//google/type:money_go_proto",
++ ],
++)
+diff -urN c/google/cloud/billing/v1/BUILD.bazel d/google/cloud/billing/v1/BUILD.bazel
+--- c/google/cloud/billing/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/billing/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "billing_proto",
++ srcs = [
++ "cloud_billing.proto",
++ "cloud_catalog.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/type:money_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "billing_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/billing/v1",
++ proto = ":billing_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/type:money_go_proto",
++ ],
++)
+diff -urN c/google/cloud/binaryauthorization/v1/BUILD.bazel d/google/cloud/binaryauthorization/v1/BUILD.bazel
+--- c/google/cloud/binaryauthorization/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/binaryauthorization/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "binaryauthorization_proto",
++ srcs = [
++ "resources.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//grafeas/v1:grafeas_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "binaryauthorization_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1",
++ proto = ":binaryauthorization_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//grafeas/v1:grafeas_go_proto",
++ ],
++)
+diff -urN c/google/cloud/binaryauthorization/v1beta1/BUILD.bazel d/google/cloud/binaryauthorization/v1beta1/BUILD.bazel
+--- c/google/cloud/binaryauthorization/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/binaryauthorization/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "binaryauthorization_proto",
++ srcs = [
++ "continuous_validation_logging.proto",
++ "resources.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "binaryauthorization_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1beta1",
++ proto = ":binaryauthorization_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/certificatemanager/logging/v1/BUILD.bazel d/google/cloud/certificatemanager/logging/v1/BUILD.bazel
+--- c/google/cloud/certificatemanager/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/certificatemanager/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,16 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["logs.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:timestamp_proto"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/certificatemanager/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/certificatemanager/v1/BUILD.bazel d/google/cloud/certificatemanager/v1/BUILD.bazel
+--- c/google/cloud/certificatemanager/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/certificatemanager/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "certificatemanager_proto",
++ srcs = [
++ "certificate_issuance_config.proto",
++ "certificate_manager.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "certificatemanager_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/certificatemanager/v1",
++ proto = ":certificatemanager_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/channel/v1/BUILD.bazel d/google/cloud/channel/v1/BUILD.bazel
+--- c/google/cloud/channel/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/channel/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,50 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "channel_proto",
++ srcs = [
++ "channel_partner_links.proto",
++ "common.proto",
++ "customers.proto",
++ "entitlements.proto",
++ "offers.proto",
++ "operations.proto",
++ "products.proto",
++ "reports_service.proto",
++ "repricing.proto",
++ "service.proto",
++ "subscriber_event.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:date_proto",
++ "//google/type:datetime_proto",
++ "//google/type:decimal_proto",
++ "//google/type:money_proto",
++ "//google/type:postaladdress_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "channel_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/channel/v1",
++ proto = ":channel_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:date_go_proto",
++ "//google/type:datetime_go_proto",
++ "//google/type:decimal_go_proto",
++ "//google/type:money_go_proto",
++ "//google/type:postaladdress_go_proto",
++ ],
++)
+diff -urN c/google/cloud/clouddms/logging/v1/BUILD.bazel d/google/cloud/clouddms/logging/v1/BUILD.bazel
+--- c/google/cloud/clouddms/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/clouddms/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["clouddms_platform_logs.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/clouddms/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/clouddms/v1/BUILD.bazel d/google/cloud/clouddms/v1/BUILD.bazel
+--- c/google/cloud/clouddms/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/clouddms/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "clouddms_proto",
++ srcs = [
++ "clouddms.proto",
++ "clouddms_resources.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "clouddms_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/clouddms/v1",
++ proto = ":clouddms_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/cloudsetup/logging/v1/BUILD.bazel d/google/cloud/cloudsetup/logging/v1/BUILD.bazel
+--- c/google/cloud/cloudsetup/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/cloudsetup/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["complete_deployment.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ ],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/cloudsetup/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/commerce/consumer/procurement/v1alpha1/BUILD.bazel d/google/cloud/commerce/consumer/procurement/v1alpha1/BUILD.bazel
+--- c/google/cloud/commerce/consumer/procurement/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/commerce/consumer/procurement/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "procurement_proto",
++ srcs = [
++ "order.proto",
++ "procurement_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "procurement_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/commerce/consumer/procurement/v1alpha1",
++ proto = ":procurement_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/common/BUILD.bazel d/google/cloud/common/BUILD.bazel
+--- c/google/cloud/common/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "common_proto",
++ srcs = ["operation_metadata.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "common_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/common",
++ proto = ":common_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/compute/v1/BUILD.bazel d/google/cloud/compute/v1/BUILD.bazel
+--- c/google/cloud/compute/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/compute/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "compute_proto",
++ srcs = ["compute.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud:extendedops_proto",
++ ],
++)
++
++go_proto_library(
++ name = "compute_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/compute/v1",
++ proto = ":compute_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud:extendedops_go_proto",
++ ],
++)
+diff -urN c/google/cloud/compute/v1small/BUILD.bazel d/google/cloud/compute/v1small/BUILD.bazel
+--- c/google/cloud/compute/v1small/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/compute/v1small/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "compute_proto",
++ srcs = ["compute_small.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud:extendedops_proto",
++ ],
++)
++
++go_proto_library(
++ name = "compute_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/compute/v1small",
++ proto = ":compute_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud:extendedops_go_proto",
++ ],
++)
+diff -urN c/google/cloud/connectors/v1/BUILD.bazel d/google/cloud/connectors/v1/BUILD.bazel
+--- c/google/cloud/connectors/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/connectors/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "connectors_proto",
++ srcs = [
++ "authconfig.proto",
++ "common.proto",
++ "connection.proto",
++ "connector.proto",
++ "connector_version.proto",
++ "connectors_service.proto",
++ "destination_config.proto",
++ "provider.proto",
++ "runtime.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "connectors_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/connectors/v1",
++ proto = ":connectors_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/contactcenterinsights/v1/BUILD.bazel d/google/cloud/contactcenterinsights/v1/BUILD.bazel
+--- c/google/cloud/contactcenterinsights/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/contactcenterinsights/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "contactcenterinsights_proto",
++ srcs = [
++ "contact_center_insights.proto",
++ "resources.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "contactcenterinsights_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/contactcenterinsights/v1",
++ proto = ":contactcenterinsights_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/contentwarehouse/v1/BUILD.bazel d/google/cloud/contentwarehouse/v1/BUILD.bazel
+--- c/google/cloud/contentwarehouse/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/contentwarehouse/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,50 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "contentwarehouse_proto",
++ srcs = [
++ "async_document_service_request.proto",
++ "common.proto",
++ "document.proto",
++ "document_link_service.proto",
++ "document_schema.proto",
++ "document_schema_service.proto",
++ "document_service.proto",
++ "document_service_request.proto",
++ "filters.proto",
++ "histogram.proto",
++ "rule_engine.proto",
++ "ruleset_service.proto",
++ "ruleset_service_request.proto",
++ "synonymset.proto",
++ "synonymset_service.proto",
++ "synonymset_service_request.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/documentai/v1:documentai_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/type:datetime_proto",
++ "//google/type:interval_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "contentwarehouse_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/contentwarehouse/v1",
++ proto = ":contentwarehouse_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/documentai/v1:documentai_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/type:datetime_go_proto",
++ "//google/type:interval_go_proto",
++ ],
++)
+diff -urN c/google/cloud/datacatalog/v1/BUILD.bazel d/google/cloud/datacatalog/v1/BUILD.bazel
+--- c/google/cloud/datacatalog/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/datacatalog/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,43 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "datacatalog_proto",
++ srcs = [
++ "bigquery.proto",
++ "common.proto",
++ "data_source.proto",
++ "datacatalog.proto",
++ "dataplex_spec.proto",
++ "gcs_fileset_spec.proto",
++ "physical_schema.proto",
++ "policytagmanager.proto",
++ "policytagmanagerserialization.proto",
++ "schema.proto",
++ "search.proto",
++ "table_spec.proto",
++ "tags.proto",
++ "timestamps.proto",
++ "usage.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "datacatalog_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datacatalog/v1",
++ proto = ":datacatalog_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/datacatalog/v1beta1/BUILD.bazel d/google/cloud/datacatalog/v1beta1/BUILD.bazel
+--- c/google/cloud/datacatalog/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/datacatalog/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "datacatalog_proto",
++ srcs = [
++ "common.proto",
++ "datacatalog.proto",
++ "gcs_fileset_spec.proto",
++ "policytagmanager.proto",
++ "policytagmanagerserialization.proto",
++ "schema.proto",
++ "search.proto",
++ "table_spec.proto",
++ "tags.proto",
++ "timestamps.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "datacatalog_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1",
++ proto = ":datacatalog_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/dataform/v1alpha2/BUILD.bazel d/google/cloud/dataform/v1alpha2/BUILD.bazel
+--- c/google/cloud/dataform/v1alpha2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/dataform/v1alpha2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "dataform_proto",
++ srcs = ["dataform.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:interval_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "dataform_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dataform/v1alpha2",
++ proto = ":dataform_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:interval_go_proto",
++ ],
++)
+diff -urN c/google/cloud/dataform/v1beta1/BUILD.bazel d/google/cloud/dataform/v1beta1/BUILD.bazel
+--- c/google/cloud/dataform/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/dataform/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "dataform_proto",
++ srcs = ["dataform.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:interval_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "dataform_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dataform/v1beta1",
++ proto = ":dataform_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:interval_go_proto",
++ ],
++)
+diff -urN c/google/cloud/datafusion/v1/BUILD.bazel d/google/cloud/datafusion/v1/BUILD.bazel
+--- c/google/cloud/datafusion/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/datafusion/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "datafusion_proto",
++ srcs = ["datafusion.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "datafusion_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datafusion/v1",
++ proto = ":datafusion_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/datafusion/v1beta1/BUILD.bazel d/google/cloud/datafusion/v1beta1/BUILD.bazel
+--- c/google/cloud/datafusion/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/datafusion/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "datafusion_proto",
++ srcs = ["v1beta1.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "datafusion_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datafusion/v1beta1",
++ proto = ":datafusion_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/datalabeling/v1beta1/BUILD.bazel d/google/cloud/datalabeling/v1beta1/BUILD.bazel
+--- c/google/cloud/datalabeling/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/datalabeling/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,41 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "datalabeling_proto",
++ srcs = [
++ "annotation.proto",
++ "annotation_spec_set.proto",
++ "data_labeling_service.proto",
++ "data_payloads.proto",
++ "dataset.proto",
++ "evaluation.proto",
++ "evaluation_job.proto",
++ "human_annotation_config.proto",
++ "instruction.proto",
++ "operations.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "datalabeling_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1",
++ proto = ":datalabeling_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/dataplex/v1/BUILD.bazel d/google/cloud/dataplex/v1/BUILD.bazel
+--- c/google/cloud/dataplex/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/dataplex/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "dataplex_proto",
++ srcs = [
++ "analyze.proto",
++ "content.proto",
++ "logs.proto",
++ "metadata.proto",
++ "resources.proto",
++ "service.proto",
++ "tasks.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "dataplex_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dataplex/v1",
++ proto = ":dataplex_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/dataproc/logging/BUILD.bazel d/google/cloud/dataproc/logging/BUILD.bazel
+--- c/google/cloud/dataproc/logging/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/dataproc/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,16 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["autoscaler_log.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:duration_proto"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/dataproc/logging",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/dataproc/v1/BUILD.bazel d/google/cloud/dataproc/v1/BUILD.bazel
+--- c/google/cloud/dataproc/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/dataproc/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "dataproc_proto",
++ srcs = [
++ "autoscaling_policies.proto",
++ "batches.proto",
++ "clusters.proto",
++ "jobs.proto",
++ "operations.proto",
++ "shared.proto",
++ "workflow_templates.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "dataproc_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dataproc/v1",
++ proto = ":dataproc_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/dataqna/v1alpha/BUILD.bazel d/google/cloud/dataqna/v1alpha/BUILD.bazel
+--- c/google/cloud/dataqna/v1alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/dataqna/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "dataqna_proto",
++ srcs = [
++ "annotated_string.proto",
++ "auto_suggestion_service.proto",
++ "question.proto",
++ "question_service.proto",
++ "user_feedback.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "dataqna_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha",
++ proto = ":dataqna_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/datastream/v1/BUILD.bazel d/google/cloud/datastream/v1/BUILD.bazel
+--- c/google/cloud/datastream/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/datastream/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "datastream_proto",
++ srcs = [
++ "datastream.proto",
++ "datastream_resources.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "datastream_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datastream/v1",
++ proto = ":datastream_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/datastream/v1alpha1/BUILD.bazel d/google/cloud/datastream/v1alpha1/BUILD.bazel
+--- c/google/cloud/datastream/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/datastream/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "datastream_proto",
++ srcs = [
++ "datastream.proto",
++ "datastream_resources.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "datastream_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1",
++ proto = ":datastream_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/deploy/v1/BUILD.bazel d/google/cloud/deploy/v1/BUILD.bazel
+--- c/google/cloud/deploy/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/deploy/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "deploy_proto",
++ srcs = [
++ "cloud_deploy.proto",
++ "deliverypipeline_notification_payload.proto",
++ "jobrun_notification_payload.proto",
++ "log_enums.proto",
++ "release_notification_payload.proto",
++ "release_render_payload.proto",
++ "rollout_notification_payload.proto",
++ "target_notification_payload.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:date_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "deploy_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/deploy/v1",
++ proto = ":deploy_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:date_go_proto",
++ ],
++)
+diff -urN c/google/cloud/dialogflow/cx/v3/BUILD.bazel d/google/cloud/dialogflow/cx/v3/BUILD.bazel
+--- c/google/cloud/dialogflow/cx/v3/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/dialogflow/cx/v3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,55 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "cx_proto",
++ srcs = [
++ "advanced_settings.proto",
++ "agent.proto",
++ "audio_config.proto",
++ "changelog.proto",
++ "deployment.proto",
++ "entity_type.proto",
++ "environment.proto",
++ "experiment.proto",
++ "flow.proto",
++ "fulfillment.proto",
++ "intent.proto",
++ "page.proto",
++ "response_message.proto",
++ "security_settings.proto",
++ "session.proto",
++ "session_entity_type.proto",
++ "test_case.proto",
++ "transition_route_group.proto",
++ "validation_message.proto",
++ "version.proto",
++ "webhook.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "cx_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3",
++ proto = ":cx_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/cloud/dialogflow/cx/v3beta1/BUILD.bazel d/google/cloud/dialogflow/cx/v3beta1/BUILD.bazel
+--- c/google/cloud/dialogflow/cx/v3beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/dialogflow/cx/v3beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,55 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "cx_proto",
++ srcs = [
++ "advanced_settings.proto",
++ "agent.proto",
++ "audio_config.proto",
++ "changelog.proto",
++ "deployment.proto",
++ "entity_type.proto",
++ "environment.proto",
++ "experiment.proto",
++ "flow.proto",
++ "fulfillment.proto",
++ "intent.proto",
++ "page.proto",
++ "response_message.proto",
++ "security_settings.proto",
++ "session.proto",
++ "session_entity_type.proto",
++ "test_case.proto",
++ "transition_route_group.proto",
++ "validation_message.proto",
++ "version.proto",
++ "webhook.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "cx_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1",
++ proto = ":cx_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/cloud/dialogflow/v2/BUILD.bazel d/google/cloud/dialogflow/v2/BUILD.bazel
+--- c/google/cloud/dialogflow/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/dialogflow/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,57 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "dialogflow_proto",
++ srcs = [
++ "agent.proto",
++ "answer_record.proto",
++ "audio_config.proto",
++ "context.proto",
++ "conversation.proto",
++ "conversation_dataset.proto",
++ "conversation_event.proto",
++ "conversation_model.proto",
++ "conversation_profile.proto",
++ "document.proto",
++ "entity_type.proto",
++ "environment.proto",
++ "fulfillment.proto",
++ "gcs.proto",
++ "human_agent_assistant_event.proto",
++ "intent.proto",
++ "knowledge_base.proto",
++ "participant.proto",
++ "session.proto",
++ "session_entity_type.proto",
++ "validation_result.proto",
++ "version.proto",
++ "webhook.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "dialogflow_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2",
++ proto = ":dialogflow_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/cloud/dialogflow/v2beta1/BUILD.bazel d/google/cloud/dialogflow/v2beta1/BUILD.bazel
+--- c/google/cloud/dialogflow/v2beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/dialogflow/v2beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,55 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "dialogflow_proto",
++ srcs = [
++ "agent.proto",
++ "answer_record.proto",
++ "audio_config.proto",
++ "context.proto",
++ "conversation.proto",
++ "conversation_event.proto",
++ "conversation_profile.proto",
++ "document.proto",
++ "entity_type.proto",
++ "environment.proto",
++ "fulfillment.proto",
++ "gcs.proto",
++ "human_agent_assistant_event.proto",
++ "intent.proto",
++ "knowledge_base.proto",
++ "participant.proto",
++ "session.proto",
++ "session_entity_type.proto",
++ "validation_result.proto",
++ "version.proto",
++ "webhook.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "dialogflow_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1",
++ proto = ":dialogflow_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/cloud/discoveryengine/v1beta/BUILD.bazel d/google/cloud/discoveryengine/v1beta/BUILD.bazel
+--- c/google/cloud/discoveryengine/v1beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/discoveryengine/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,42 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "discoveryengine_proto",
++ srcs = [
++ "common.proto",
++ "document.proto",
++ "document_service.proto",
++ "import_config.proto",
++ "recommendation_service.proto",
++ "user_event.proto",
++ "user_event_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:httpbody_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:date_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "discoveryengine_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/discoveryengine/v1beta",
++ proto = ":discoveryengine_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:httpbody_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:date_go_proto",
++ ],
++)
+diff -urN c/google/cloud/documentai/v1/BUILD.bazel d/google/cloud/documentai/v1/BUILD.bazel
+--- c/google/cloud/documentai/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/documentai/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,50 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "documentai_proto",
++ srcs = [
++ "barcode.proto",
++ "document.proto",
++ "document_io.proto",
++ "document_processor_service.proto",
++ "document_schema.proto",
++ "geometry.proto",
++ "operation_metadata.proto",
++ "processor.proto",
++ "processor_type.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:api_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:color_proto",
++ "//google/type:date_proto",
++ "//google/type:datetime_proto",
++ "//google/type:money_proto",
++ "//google/type:postaladdress_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "documentai_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/documentai/v1",
++ proto = ":documentai_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:api_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:color_go_proto",
++ "//google/type:date_go_proto",
++ "//google/type:datetime_go_proto",
++ "//google/type:money_go_proto",
++ "//google/type:postaladdress_go_proto",
++ ],
++)
+diff -urN c/google/cloud/documentai/v1beta1/BUILD.bazel d/google/cloud/documentai/v1beta1/BUILD.bazel
+--- c/google/cloud/documentai/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/documentai/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "documentai_proto",
++ srcs = [
++ "document.proto",
++ "document_understanding.proto",
++ "geometry.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:color_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "documentai_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta1",
++ proto = ":documentai_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:color_go_proto",
++ ],
++)
+diff -urN c/google/cloud/documentai/v1beta2/BUILD.bazel d/google/cloud/documentai/v1beta2/BUILD.bazel
+--- c/google/cloud/documentai/v1beta2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/documentai/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "documentai_proto",
++ srcs = [
++ "document.proto",
++ "document_understanding.proto",
++ "geometry.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:color_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "documentai_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta2",
++ proto = ":documentai_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:color_go_proto",
++ ],
++)
+diff -urN c/google/cloud/documentai/v1beta3/BUILD.bazel d/google/cloud/documentai/v1beta3/BUILD.bazel
+--- c/google/cloud/documentai/v1beta3/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/documentai/v1beta3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,51 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "documentai_proto",
++ srcs = [
++ "barcode.proto",
++ "document.proto",
++ "document_io.proto",
++ "document_processor_service.proto",
++ "document_schema.proto",
++ "evaluation.proto",
++ "geometry.proto",
++ "operation_metadata.proto",
++ "processor.proto",
++ "processor_type.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:api_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:color_proto",
++ "//google/type:date_proto",
++ "//google/type:datetime_proto",
++ "//google/type:money_proto",
++ "//google/type:postaladdress_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "documentai_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3",
++ proto = ":documentai_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:api_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:color_go_proto",
++ "//google/type:date_go_proto",
++ "//google/type:datetime_go_proto",
++ "//google/type:money_go_proto",
++ "//google/type:postaladdress_go_proto",
++ ],
++)
+diff -urN c/google/cloud/domains/v1/BUILD.bazel d/google/cloud/domains/v1/BUILD.bazel
+--- c/google/cloud/domains/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/domains/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "domains_proto",
++ srcs = ["domains.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:money_proto",
++ "//google/type:postaladdress_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "domains_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/domains/v1",
++ proto = ":domains_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:money_go_proto",
++ "//google/type:postaladdress_go_proto",
++ ],
++)
+diff -urN c/google/cloud/domains/v1alpha2/BUILD.bazel d/google/cloud/domains/v1alpha2/BUILD.bazel
+--- c/google/cloud/domains/v1alpha2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/domains/v1alpha2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "domains_proto",
++ srcs = ["domains.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:money_proto",
++ "//google/type:postaladdress_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "domains_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/domains/v1alpha2",
++ proto = ":domains_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:money_go_proto",
++ "//google/type:postaladdress_go_proto",
++ ],
++)
+diff -urN c/google/cloud/domains/v1beta1/BUILD.bazel d/google/cloud/domains/v1beta1/BUILD.bazel
+--- c/google/cloud/domains/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/domains/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "domains_proto",
++ srcs = ["domains.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:money_proto",
++ "//google/type:postaladdress_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "domains_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/domains/v1beta1",
++ proto = ":domains_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:money_go_proto",
++ "//google/type:postaladdress_go_proto",
++ ],
++)
+diff -urN c/google/cloud/edgecontainer/v1/BUILD.bazel d/google/cloud/edgecontainer/v1/BUILD.bazel
+--- c/google/cloud/edgecontainer/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/edgecontainer/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "edgecontainer_proto",
++ srcs = [
++ "resources.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "edgecontainer_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/edgecontainer/v1",
++ proto = ":edgecontainer_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/enterpriseknowledgegraph/v1/BUILD.bazel d/google/cloud/enterpriseknowledgegraph/v1/BUILD.bazel
+--- c/google/cloud/enterpriseknowledgegraph/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/enterpriseknowledgegraph/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "enterpriseknowledgegraph_proto",
++ srcs = [
++ "job_state.proto",
++ "operation_metadata.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "enterpriseknowledgegraph_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/enterpriseknowledgegraph/v1",
++ proto = ":enterpriseknowledgegraph_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/essentialcontacts/v1/BUILD.bazel d/google/cloud/essentialcontacts/v1/BUILD.bazel
+--- c/google/cloud/essentialcontacts/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/essentialcontacts/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "essentialcontacts_proto",
++ srcs = [
++ "enums.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "essentialcontacts_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1",
++ proto = ":essentialcontacts_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/eventarc/publishing/v1/BUILD.bazel d/google/cloud/eventarc/publishing/v1/BUILD.bazel
+--- c/google/cloud/eventarc/publishing/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/eventarc/publishing/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "publisher_proto",
++ srcs = ["publisher.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:any_proto",
++ ],
++)
++
++go_proto_library(
++ name = "publisher_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/eventarc/publishing/v1",
++ proto = ":publisher_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/eventarc/v1/BUILD.bazel d/google/cloud/eventarc/v1/BUILD.bazel
+--- c/google/cloud/eventarc/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/eventarc/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "eventarc_proto",
++ srcs = [
++ "channel.proto",
++ "channel_connection.proto",
++ "discovery.proto",
++ "eventarc.proto",
++ "google_channel_config.proto",
++ "trigger.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:code_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "eventarc_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/eventarc/v1",
++ proto = ":eventarc_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:code_go_proto",
++ ],
++)
+diff -urN c/google/cloud/filestore/v1/BUILD.bazel d/google/cloud/filestore/v1/BUILD.bazel
+--- c/google/cloud/filestore/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/filestore/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "filestore_proto",
++ srcs = ["cloud_filestore_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/common:common_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "filestore_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/filestore/v1",
++ proto = ":filestore_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/common:common_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/filestore/v1beta1/BUILD.bazel d/google/cloud/filestore/v1beta1/BUILD.bazel
+--- c/google/cloud/filestore/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/filestore/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "filestore_proto",
++ srcs = ["cloud_filestore_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/common:common_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "filestore_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/filestore/v1beta1",
++ proto = ":filestore_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/common:common_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/functions/v1/BUILD.bazel d/google/cloud/functions/v1/BUILD.bazel
+--- c/google/cloud/functions/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/functions/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "functions_proto",
++ srcs = [
++ "functions.proto",
++ "operations.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "functions_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/functions/v1",
++ proto = ":functions_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/functions/v2/BUILD.bazel d/google/cloud/functions/v2/BUILD.bazel
+--- c/google/cloud/functions/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/functions/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "functions_proto",
++ srcs = ["functions.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "functions_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/functions/v2",
++ proto = ":functions_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/functions/v2alpha/BUILD.bazel d/google/cloud/functions/v2alpha/BUILD.bazel
+--- c/google/cloud/functions/v2alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/functions/v2alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "functions_proto",
++ srcs = ["functions.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "functions_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/functions/v2alpha",
++ proto = ":functions_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/functions/v2beta/BUILD.bazel d/google/cloud/functions/v2beta/BUILD.bazel
+--- c/google/cloud/functions/v2beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/functions/v2beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "functions_proto",
++ srcs = ["functions.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "functions_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/functions/v2beta",
++ proto = ":functions_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/gaming/v1/BUILD.bazel d/google/cloud/gaming/v1/BUILD.bazel
+--- c/google/cloud/gaming/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gaming/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "gaming_proto",
++ srcs = [
++ "common.proto",
++ "game_server_clusters.proto",
++ "game_server_clusters_service.proto",
++ "game_server_configs.proto",
++ "game_server_configs_service.proto",
++ "game_server_deployments.proto",
++ "game_server_deployments_service.proto",
++ "realms.proto",
++ "realms_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "gaming_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gaming/v1",
++ proto = ":gaming_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/gaming/v1beta/BUILD.bazel d/google/cloud/gaming/v1beta/BUILD.bazel
+--- c/google/cloud/gaming/v1beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gaming/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "gaming_proto",
++ srcs = [
++ "common.proto",
++ "game_server_clusters.proto",
++ "game_server_clusters_service.proto",
++ "game_server_configs.proto",
++ "game_server_configs_service.proto",
++ "game_server_deployments.proto",
++ "game_server_deployments_service.proto",
++ "realms.proto",
++ "realms_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "gaming_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gaming/v1beta",
++ proto = ":gaming_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/gkebackup/logging/v1/BUILD.bazel d/google/cloud/gkebackup/logging/v1/BUILD.bazel
+--- c/google/cloud/gkebackup/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkebackup/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = [
++ "logged_backup.proto",
++ "logged_backup_plan.proto",
++ "logged_common.proto",
++ "logged_restore.proto",
++ "logged_restore_plan.proto",
++ "logging.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkebackup/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/rpc:status_go_proto"],
++)
+diff -urN c/google/cloud/gkebackup/v1/BUILD.bazel d/google/cloud/gkebackup/v1/BUILD.bazel
+--- c/google/cloud/gkebackup/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkebackup/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "gkebackup_proto",
++ srcs = [
++ "backup.proto",
++ "backup_plan.proto",
++ "common.proto",
++ "gkebackup.proto",
++ "restore.proto",
++ "restore_plan.proto",
++ "volume.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "gkebackup_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkebackup/v1",
++ proto = ":gkebackup_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/gkeconnect/gateway/v1/BUILD.bazel d/google/cloud/gkeconnect/gateway/v1/BUILD.bazel
+--- c/google/cloud/gkeconnect/gateway/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkeconnect/gateway/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "gateway_proto",
++ srcs = ["gateway.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "gateway_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkeconnect/gateway/v1",
++ proto = ":gateway_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/gkeconnect/gateway/v1alpha1/BUILD.bazel d/google/cloud/gkeconnect/gateway/v1alpha1/BUILD.bazel
+--- c/google/cloud/gkeconnect/gateway/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkeconnect/gateway/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "gateway_proto",
++ srcs = ["gateway.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "gateway_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkeconnect/gateway/v1alpha1",
++ proto = ":gateway_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/gkeconnect/gateway/v1beta1/BUILD.bazel d/google/cloud/gkeconnect/gateway/v1beta1/BUILD.bazel
+--- c/google/cloud/gkeconnect/gateway/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkeconnect/gateway/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "gateway_proto",
++ srcs = ["gateway.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:httpbody_proto",
++ ],
++)
++
++go_proto_library(
++ name = "gateway_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkeconnect/gateway/v1beta1",
++ proto = ":gateway_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:httpbody_go_proto",
++ ],
++)
+diff -urN c/google/cloud/gkehub/v1/BUILD.bazel d/google/cloud/gkehub/v1/BUILD.bazel
+--- c/google/cloud/gkehub/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkehub/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "gkehub_proto",
++ srcs = [
++ "feature.proto",
++ "membership.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/gkehub/v1/configmanagement:configmanagement_proto",
++ "//google/cloud/gkehub/v1/multiclusteringress:multiclusteringress_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "gkehub_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/v1",
++ proto = ":gkehub_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/gkehub/v1/configmanagement:configmanagement_go_proto",
++ "//google/cloud/gkehub/v1/multiclusteringress:multiclusteringress_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/gkehub/v1/configmanagement/BUILD.bazel d/google/cloud/gkehub/v1/configmanagement/BUILD.bazel
+--- c/google/cloud/gkehub/v1/configmanagement/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkehub/v1/configmanagement/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,16 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "configmanagement_proto",
++ srcs = ["configmanagement.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:timestamp_proto"],
++)
++
++go_proto_library(
++ name = "configmanagement_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/configmanagement/v1",
++ proto = ":configmanagement_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/gkehub/v1/multiclusteringress/BUILD.bazel d/google/cloud/gkehub/v1/multiclusteringress/BUILD.bazel
+--- c/google/cloud/gkehub/v1/multiclusteringress/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkehub/v1/multiclusteringress/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "multiclusteringress_proto",
++ srcs = ["multiclusteringress.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "multiclusteringress_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/multiclusteringress/v1",
++ proto = ":multiclusteringress_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/gkehub/v1alpha/BUILD.bazel d/google/cloud/gkehub/v1alpha/BUILD.bazel
+--- c/google/cloud/gkehub/v1alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkehub/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,39 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "gkehub_proto",
++ srcs = [
++ "feature.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/gkehub/v1alpha/cloudauditlogging:cloudauditlogging_proto",
++ "//google/cloud/gkehub/v1alpha/configmanagement:configmanagement_proto",
++ "//google/cloud/gkehub/v1alpha/metering:metering_proto",
++ "//google/cloud/gkehub/v1alpha/multiclusteringress:multiclusteringress_proto",
++ "//google/cloud/gkehub/v1alpha/servicemesh:servicemesh_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "gkehub_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/v1alpha",
++ proto = ":gkehub_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/gkehub/v1alpha/cloudauditlogging:cloudauditlogging_go_proto",
++ "//google/cloud/gkehub/v1alpha/configmanagement:configmanagement_go_proto",
++ "//google/cloud/gkehub/v1alpha/metering:metering_go_proto",
++ "//google/cloud/gkehub/v1alpha/multiclusteringress:multiclusteringress_go_proto",
++ "//google/cloud/gkehub/v1alpha/servicemesh:servicemesh_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/gkehub/v1alpha/cloudauditlogging/BUILD.bazel d/google/cloud/gkehub/v1alpha/cloudauditlogging/BUILD.bazel
+--- c/google/cloud/gkehub/v1alpha/cloudauditlogging/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkehub/v1alpha/cloudauditlogging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "cloudauditlogging_proto",
++ srcs = ["cloudauditlogging.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "cloudauditlogging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/cloudauditlogging/v1alpha",
++ proto = ":cloudauditlogging_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/gkehub/v1alpha/configmanagement/BUILD.bazel d/google/cloud/gkehub/v1alpha/configmanagement/BUILD.bazel
+--- c/google/cloud/gkehub/v1alpha/configmanagement/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkehub/v1alpha/configmanagement/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,16 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "configmanagement_proto",
++ srcs = ["configmanagement.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:timestamp_proto"],
++)
++
++go_proto_library(
++ name = "configmanagement_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/configmanagement/v1alpha",
++ proto = ":configmanagement_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/gkehub/v1alpha/metering/BUILD.bazel d/google/cloud/gkehub/v1alpha/metering/BUILD.bazel
+--- c/google/cloud/gkehub/v1alpha/metering/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkehub/v1alpha/metering/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,16 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "metering_proto",
++ srcs = ["metering.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:timestamp_proto"],
++)
++
++go_proto_library(
++ name = "metering_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/metering/v1alpha",
++ proto = ":metering_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/gkehub/v1alpha/multiclusteringress/BUILD.bazel d/google/cloud/gkehub/v1alpha/multiclusteringress/BUILD.bazel
+--- c/google/cloud/gkehub/v1alpha/multiclusteringress/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkehub/v1alpha/multiclusteringress/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "multiclusteringress_proto",
++ srcs = ["multiclusteringress.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "multiclusteringress_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/multiclusteringress/v1alpha",
++ proto = ":multiclusteringress_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/gkehub/v1alpha/servicemesh/BUILD.bazel d/google/cloud/gkehub/v1alpha/servicemesh/BUILD.bazel
+--- c/google/cloud/gkehub/v1alpha/servicemesh/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkehub/v1alpha/servicemesh/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "servicemesh_proto",
++ srcs = ["servicemesh.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++go_proto_library(
++ name = "servicemesh_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/servicemesh/v1alpha",
++ proto = ":servicemesh_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/gkehub/v1alpha2/BUILD.bazel d/google/cloud/gkehub/v1alpha2/BUILD.bazel
+--- c/google/cloud/gkehub/v1alpha2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkehub/v1alpha2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "gkehub_proto",
++ srcs = ["membership.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "gkehub_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/v1alpha2",
++ proto = ":gkehub_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/gkehub/v1beta/BUILD.bazel d/google/cloud/gkehub/v1beta/BUILD.bazel
+--- c/google/cloud/gkehub/v1beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkehub/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "gkehub_proto",
++ srcs = [
++ "feature.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/gkehub/v1beta/configmanagement:configmanagement_proto",
++ "//google/cloud/gkehub/v1beta/metering:metering_proto",
++ "//google/cloud/gkehub/v1beta/multiclusteringress:multiclusteringress_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "gkehub_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/v1beta",
++ proto = ":gkehub_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/gkehub/v1beta/configmanagement:configmanagement_go_proto",
++ "//google/cloud/gkehub/v1beta/metering:metering_go_proto",
++ "//google/cloud/gkehub/v1beta/multiclusteringress:multiclusteringress_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/gkehub/v1beta/configmanagement/BUILD.bazel d/google/cloud/gkehub/v1beta/configmanagement/BUILD.bazel
+--- c/google/cloud/gkehub/v1beta/configmanagement/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkehub/v1beta/configmanagement/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,16 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "configmanagement_proto",
++ srcs = ["configmanagement.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:timestamp_proto"],
++)
++
++go_proto_library(
++ name = "configmanagement_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/configmanagement/v1beta",
++ proto = ":configmanagement_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/gkehub/v1beta/metering/BUILD.bazel d/google/cloud/gkehub/v1beta/metering/BUILD.bazel
+--- c/google/cloud/gkehub/v1beta/metering/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkehub/v1beta/metering/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,16 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "metering_proto",
++ srcs = ["metering.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:timestamp_proto"],
++)
++
++go_proto_library(
++ name = "metering_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/metering/v1beta",
++ proto = ":metering_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/gkehub/v1beta/multiclusteringress/BUILD.bazel d/google/cloud/gkehub/v1beta/multiclusteringress/BUILD.bazel
+--- c/google/cloud/gkehub/v1beta/multiclusteringress/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkehub/v1beta/multiclusteringress/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "multiclusteringress_proto",
++ srcs = ["multiclusteringress.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "multiclusteringress_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/multiclusteringress/v1beta",
++ proto = ":multiclusteringress_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/gkehub/v1beta1/BUILD.bazel d/google/cloud/gkehub/v1beta1/BUILD.bazel
+--- c/google/cloud/gkehub/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkehub/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "gkehub_proto",
++ srcs = ["membership.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "gkehub_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/v1beta1",
++ proto = ":gkehub_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/gkemulticloud/v1/BUILD.bazel d/google/cloud/gkemulticloud/v1/BUILD.bazel
+--- c/google/cloud/gkemulticloud/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gkemulticloud/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "gkemulticloud_proto",
++ srcs = [
++ "aws_resources.proto",
++ "aws_service.proto",
++ "azure_resources.proto",
++ "azure_service.proto",
++ "common_resources.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "gkemulticloud_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkemulticloud/v1",
++ proto = ":gkemulticloud_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/gsuiteaddons/logging/v1/BUILD.bazel d/google/cloud/gsuiteaddons/logging/v1/BUILD.bazel
+--- c/google/cloud/gsuiteaddons/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gsuiteaddons/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["g_suite_add_ons_log_entry.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/rpc:status_proto"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/rpc:status_go_proto"],
++)
+diff -urN c/google/cloud/gsuiteaddons/v1/BUILD.bazel d/google/cloud/gsuiteaddons/v1/BUILD.bazel
+--- c/google/cloud/gsuiteaddons/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/gsuiteaddons/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "gsuiteaddons_proto",
++ srcs = ["gsuiteaddons.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/apps/script/type:type_proto",
++ "//google/apps/script/type/calendar:calendar_proto",
++ "//google/apps/script/type/docs:docs_proto",
++ "//google/apps/script/type/drive:drive_proto",
++ "//google/apps/script/type/gmail:gmail_proto",
++ "//google/apps/script/type/sheets:sheets_proto",
++ "//google/apps/script/type/slides:slides_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "gsuiteaddons_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1",
++ proto = ":gsuiteaddons_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/apps/script/type:type_go_proto",
++ "//google/apps/script/type/calendar:calendar_go_proto",
++ "//google/apps/script/type/docs:docs_go_proto",
++ "//google/apps/script/type/drive:drive_go_proto",
++ "//google/apps/script/type/gmail:gmail_go_proto",
++ "//google/apps/script/type/sheets:sheets_go_proto",
++ "//google/apps/script/type/slides:slides_go_proto",
++ ],
++)
+diff -urN c/google/cloud/healthcare/logging/BUILD.bazel d/google/cloud/healthcare/logging/BUILD.bazel
+--- c/google/cloud/healthcare/logging/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/healthcare/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = [
++ "annotation.proto",
++ "consent.proto",
++ "deid.proto",
++ "dicom.proto",
++ "fhir.proto",
++ "hl7v2.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = ["//google/rpc:status_proto"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/healthcare/logging",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/rpc:status_go_proto"],
++)
+diff -urN c/google/cloud/iap/v1/BUILD.bazel d/google/cloud/iap/v1/BUILD.bazel
+--- c/google/cloud/iap/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/iap/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "iap_proto",
++ srcs = ["service.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "iap_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/iap/v1",
++ proto = ":iap_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/iap/v1beta1/BUILD.bazel d/google/cloud/iap/v1beta1/BUILD.bazel
+--- c/google/cloud/iap/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/iap/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "iap_proto",
++ srcs = ["service.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ ],
++)
++
++go_proto_library(
++ name = "iap_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/iap/v1beta1",
++ proto = ":iap_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/identitytoolkit/logging/BUILD.bazel d/google/cloud/identitytoolkit/logging/BUILD.bazel
+--- c/google/cloud/identitytoolkit/logging/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/identitytoolkit/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["request_log.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/identitytoolkit/logging",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/rpc:status_go_proto"],
++)
+diff -urN c/google/cloud/identitytoolkit/v2/BUILD.bazel d/google/cloud/identitytoolkit/v2/BUILD.bazel
+--- c/google/cloud/identitytoolkit/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/identitytoolkit/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "identitytoolkit_proto",
++ srcs = [
++ "account_management_service.proto",
++ "authentication_service.proto",
++ "mfa_info.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "identitytoolkit_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/identitytoolkit/v2",
++ proto = ":identitytoolkit_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/ids/logging/v1/BUILD.bazel d/google/cloud/ids/logging/v1/BUILD.bazel
+--- c/google/cloud/ids/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/ids/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["logging.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/ids/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/ids/v1/BUILD.bazel d/google/cloud/ids/v1/BUILD.bazel
+--- c/google/cloud/ids/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/ids/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "ids_proto",
++ srcs = ["ids.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "ids_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/ids/v1",
++ proto = ":ids_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/integrations/v1alpha/BUILD.bazel d/google/cloud/integrations/v1alpha/BUILD.bazel
+--- c/google/cloud/integrations/v1alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/integrations/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "integrations_proto",
++ srcs = [
++ "event_parameter.proto",
++ "json_validation.proto",
++ "log_entries.proto",
++ "product.proto",
++ "task_config.proto",
++ "value_type.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "integrations_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/integrations/v1alpha",
++ proto = ":integrations_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/iot/v1/BUILD.bazel d/google/cloud/iot/v1/BUILD.bazel
+--- c/google/cloud/iot/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/iot/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "iot_proto",
++ srcs = [
++ "device_manager.proto",
++ "resources.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "iot_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/iot/v1",
++ proto = ":iot_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/kms/v1/BUILD.bazel d/google/cloud/kms/v1/BUILD.bazel
+--- c/google/cloud/kms/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/kms/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "kms_proto",
++ srcs = [
++ "ekm_service.proto",
++ "resources.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "kms_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/kms/v1",
++ proto = ":kms_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/kubernetes/security/containersecurity_logging/BUILD.bazel d/google/cloud/kubernetes/security/containersecurity_logging/BUILD.bazel
+--- c/google/cloud/kubernetes/security/containersecurity_logging/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/kubernetes/security/containersecurity_logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,16 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "containersecurity_logging_proto",
++ srcs = ["logging.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:timestamp_proto"],
++)
++
++go_proto_library(
++ name = "containersecurity_logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/kubernetes/security/containersecurity_logging",
++ proto = ":containersecurity_logging_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/language/v1/BUILD.bazel d/google/cloud/language/v1/BUILD.bazel
+--- c/google/cloud/language/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/language/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "language_proto",
++ srcs = ["language_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "language_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/language/v1",
++ proto = ":language_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/language/v1beta1/BUILD.bazel d/google/cloud/language/v1beta1/BUILD.bazel
+--- c/google/cloud/language/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/language/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "language_proto",
++ srcs = ["language_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "language_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/language/v1beta1",
++ proto = ":language_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/language/v1beta2/BUILD.bazel d/google/cloud/language/v1beta2/BUILD.bazel
+--- c/google/cloud/language/v1beta2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/language/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "language_proto",
++ srcs = ["language_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "language_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/language/v1beta2",
++ proto = ":language_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/lifesciences/v2beta/BUILD.bazel d/google/cloud/lifesciences/v2beta/BUILD.bazel
+--- c/google/cloud/lifesciences/v2beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/lifesciences/v2beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "lifesciences_proto",
++ srcs = ["workflows.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:code_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "lifesciences_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/lifesciences/v2beta",
++ proto = ":lifesciences_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:code_go_proto",
++ ],
++)
+diff -urN c/google/cloud/location/BUILD.bazel d/google/cloud/location/BUILD.bazel
+--- c/google/cloud/location/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/location/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "location_proto",
++ srcs = ["locations.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:any_proto",
++ ],
++)
++
++go_proto_library(
++ name = "location_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/location",
++ proto = ":location_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/managedidentities/v1/BUILD.bazel d/google/cloud/managedidentities/v1/BUILD.bazel
+--- c/google/cloud/managedidentities/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/managedidentities/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "managedidentities_proto",
++ srcs = [
++ "managed_identities_service.proto",
++ "resource.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "managedidentities_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/managedidentities/v1",
++ proto = ":managedidentities_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/managedidentities/v1beta1/BUILD.bazel d/google/cloud/managedidentities/v1beta1/BUILD.bazel
+--- c/google/cloud/managedidentities/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/managedidentities/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "managedidentities_proto",
++ srcs = [
++ "managed_identities_service.proto",
++ "resource.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "managedidentities_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/managedidentities/v1beta1",
++ proto = ":managedidentities_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/mediatranslation/v1alpha1/BUILD.bazel d/google/cloud/mediatranslation/v1alpha1/BUILD.bazel
+--- c/google/cloud/mediatranslation/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/mediatranslation/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "mediatranslation_proto",
++ srcs = ["media_translation.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ ],
++)
++
++go_proto_library(
++ name = "mediatranslation_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/mediatranslation/v1alpha1",
++ proto = ":mediatranslation_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/mediatranslation/v1beta1/BUILD.bazel d/google/cloud/mediatranslation/v1beta1/BUILD.bazel
+--- c/google/cloud/mediatranslation/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/mediatranslation/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "mediatranslation_proto",
++ srcs = ["media_translation.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ ],
++)
++
++go_proto_library(
++ name = "mediatranslation_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/mediatranslation/v1beta1",
++ proto = ":mediatranslation_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/memcache/v1/BUILD.bazel d/google/cloud/memcache/v1/BUILD.bazel
+--- c/google/cloud/memcache/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/memcache/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "memcache_proto",
++ srcs = ["cloud_memcache.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:dayofweek_proto",
++ "//google/type:timeofday_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "memcache_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/memcache/v1",
++ proto = ":memcache_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:dayofweek_go_proto",
++ "//google/type:timeofday_go_proto",
++ ],
++)
+diff -urN c/google/cloud/memcache/v1beta2/BUILD.bazel d/google/cloud/memcache/v1beta2/BUILD.bazel
+--- c/google/cloud/memcache/v1beta2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/memcache/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "memcache_proto",
++ srcs = ["cloud_memcache.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:dayofweek_proto",
++ "//google/type:timeofday_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "memcache_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/memcache/v1beta2",
++ proto = ":memcache_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:dayofweek_go_proto",
++ "//google/type:timeofday_go_proto",
++ ],
++)
+diff -urN c/google/cloud/metastore/logging/v1/BUILD.bazel d/google/cloud/metastore/logging/v1/BUILD.bazel
+--- c/google/cloud/metastore/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/metastore/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["log_streams.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/metastore/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/metastore/v1/BUILD.bazel d/google/cloud/metastore/v1/BUILD.bazel
+--- c/google/cloud/metastore/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/metastore/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "metastore_proto",
++ srcs = [
++ "metastore.proto",
++ "metastore_federation.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:dayofweek_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "metastore_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/metastore/v1",
++ proto = ":metastore_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:dayofweek_go_proto",
++ ],
++)
+diff -urN c/google/cloud/metastore/v1alpha/BUILD.bazel d/google/cloud/metastore/v1alpha/BUILD.bazel
+--- c/google/cloud/metastore/v1alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/metastore/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "metastore_proto",
++ srcs = [
++ "metastore.proto",
++ "metastore_federation.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:dayofweek_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "metastore_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/metastore/v1alpha",
++ proto = ":metastore_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:dayofweek_go_proto",
++ ],
++)
+diff -urN c/google/cloud/metastore/v1beta/BUILD.bazel d/google/cloud/metastore/v1beta/BUILD.bazel
+--- c/google/cloud/metastore/v1beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/metastore/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "metastore_proto",
++ srcs = [
++ "metastore.proto",
++ "metastore_federation.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:dayofweek_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "metastore_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/metastore/v1beta",
++ proto = ":metastore_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:dayofweek_go_proto",
++ ],
++)
+diff -urN c/google/cloud/networkanalyzer/logging/v1/BUILD.bazel d/google/cloud/networkanalyzer/logging/v1/BUILD.bazel
+--- c/google/cloud/networkanalyzer/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/networkanalyzer/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,16 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["analyzer_log.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:timestamp_proto"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/networkanalyzer/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/networkconnectivity/v1/BUILD.bazel d/google/cloud/networkconnectivity/v1/BUILD.bazel
+--- c/google/cloud/networkconnectivity/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/networkconnectivity/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "networkconnectivity_proto",
++ srcs = [
++ "common.proto",
++ "hub.proto",
++ "policy_based_routing.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "networkconnectivity_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1",
++ proto = ":networkconnectivity_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/networkconnectivity/v1alpha1/BUILD.bazel d/google/cloud/networkconnectivity/v1alpha1/BUILD.bazel
+--- c/google/cloud/networkconnectivity/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/networkconnectivity/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "networkconnectivity_proto",
++ srcs = [
++ "common.proto",
++ "hub.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "networkconnectivity_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1",
++ proto = ":networkconnectivity_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/networkmanagement/v1/BUILD.bazel d/google/cloud/networkmanagement/v1/BUILD.bazel
+--- c/google/cloud/networkmanagement/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/networkmanagement/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "networkmanagement_proto",
++ srcs = [
++ "connectivity_test.proto",
++ "reachability.proto",
++ "trace.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "networkmanagement_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networkmanagement/v1",
++ proto = ":networkmanagement_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/networkmanagement/v1beta1/BUILD.bazel d/google/cloud/networkmanagement/v1beta1/BUILD.bazel
+--- c/google/cloud/networkmanagement/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/networkmanagement/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "networkmanagement_proto",
++ srcs = [
++ "connectivity_test.proto",
++ "reachability.proto",
++ "trace.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "networkmanagement_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networkmanagement/v1beta1",
++ proto = ":networkmanagement_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/networksecurity/v1/BUILD.bazel d/google/cloud/networksecurity/v1/BUILD.bazel
+--- c/google/cloud/networksecurity/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/networksecurity/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "networksecurity_proto",
++ srcs = [
++ "authorization_policy.proto",
++ "client_tls_policy.proto",
++ "common.proto",
++ "network_security.proto",
++ "server_tls_policy.proto",
++ "tls.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "networksecurity_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networksecurity/v1",
++ proto = ":networksecurity_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/networksecurity/v1beta1/BUILD.bazel d/google/cloud/networksecurity/v1beta1/BUILD.bazel
+--- c/google/cloud/networksecurity/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/networksecurity/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "networksecurity_proto",
++ srcs = [
++ "authorization_policy.proto",
++ "client_tls_policy.proto",
++ "common.proto",
++ "network_security.proto",
++ "server_tls_policy.proto",
++ "tls.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "networksecurity_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1",
++ proto = ":networksecurity_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/networkservices/v1/BUILD.bazel d/google/cloud/networkservices/v1/BUILD.bazel
+--- c/google/cloud/networkservices/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/networkservices/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "networkservices_proto",
++ srcs = [
++ "common.proto",
++ "endpoint_policy.proto",
++ "gateway.proto",
++ "grpc_route.proto",
++ "http_route.proto",
++ "mesh.proto",
++ "network_services.proto",
++ "service_binding.proto",
++ "tcp_route.proto",
++ "tls_route.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "networkservices_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networkservices/v1",
++ proto = ":networkservices_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/networkservices/v1beta1/BUILD.bazel d/google/cloud/networkservices/v1beta1/BUILD.bazel
+--- c/google/cloud/networkservices/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/networkservices/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "networkservices_proto",
++ srcs = [
++ "common.proto",
++ "endpoint_policy.proto",
++ "network_services.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "networkservices_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networkservices/v1beta1",
++ proto = ":networkservices_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/notebooks/logging/v1/BUILD.bazel d/google/cloud/notebooks/logging/v1/BUILD.bazel
+--- c/google/cloud/notebooks/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/notebooks/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["runtime_log.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/notebooks/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/notebooks/v1/BUILD.bazel d/google/cloud/notebooks/v1/BUILD.bazel
+--- c/google/cloud/notebooks/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/notebooks/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "notebooks_proto",
++ srcs = [
++ "diagnostic_config.proto",
++ "environment.proto",
++ "event.proto",
++ "execution.proto",
++ "instance.proto",
++ "instance_config.proto",
++ "managed_service.proto",
++ "runtime.proto",
++ "schedule.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "notebooks_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/notebooks/v1",
++ proto = ":notebooks_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/notebooks/v1beta1/BUILD.bazel d/google/cloud/notebooks/v1beta1/BUILD.bazel
+--- c/google/cloud/notebooks/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/notebooks/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "notebooks_proto",
++ srcs = [
++ "environment.proto",
++ "instance.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "notebooks_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/notebooks/v1beta1",
++ proto = ":notebooks_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/optimization/v1/BUILD.bazel d/google/cloud/optimization/v1/BUILD.bazel
+--- c/google/cloud/optimization/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/optimization/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "optimization_proto",
++ srcs = [
++ "async_model.proto",
++ "fleet_routing.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "optimization_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/optimization/v1",
++ proto = ":optimization_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/cloud/orchestration/airflow/service/v1/BUILD.bazel d/google/cloud/orchestration/airflow/service/v1/BUILD.bazel
+--- c/google/cloud/orchestration/airflow/service/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/orchestration/airflow/service/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "service_proto",
++ srcs = [
++ "environments.proto",
++ "image_versions.proto",
++ "operations.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:date_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "service_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/orchestration/airflow/service/v1",
++ proto = ":service_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:date_go_proto",
++ ],
++)
+diff -urN c/google/cloud/orchestration/airflow/service/v1beta1/BUILD.bazel d/google/cloud/orchestration/airflow/service/v1beta1/BUILD.bazel
+--- c/google/cloud/orchestration/airflow/service/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/orchestration/airflow/service/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "service_proto",
++ srcs = [
++ "environments.proto",
++ "image_versions.proto",
++ "operations.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:date_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "service_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/orchestration/airflow/service/v1beta1",
++ proto = ":service_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:date_go_proto",
++ ],
++)
+diff -urN c/google/cloud/orgpolicy/v1/BUILD.bazel d/google/cloud/orgpolicy/v1/BUILD.bazel
+--- c/google/cloud/orgpolicy/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/orgpolicy/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,16 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "orgpolicy_proto",
++ srcs = ["orgpolicy.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:timestamp_proto"],
++)
++
++go_proto_library(
++ name = "orgpolicy_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/orgpolicy/v1",
++ proto = ":orgpolicy_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/orgpolicy/v2/BUILD.bazel d/google/cloud/orgpolicy/v2/BUILD.bazel
+--- c/google/cloud/orgpolicy/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/orgpolicy/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "orgpolicy_proto",
++ srcs = [
++ "constraint.proto",
++ "orgpolicy.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:expr_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "orgpolicy_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/orgpolicy/v2",
++ proto = ":orgpolicy_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:expr_go_proto",
++ ],
++)
+diff -urN c/google/cloud/osconfig/agentendpoint/v1/BUILD.bazel d/google/cloud/osconfig/agentendpoint/v1/BUILD.bazel
+--- c/google/cloud/osconfig/agentendpoint/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/osconfig/agentendpoint/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "agentendpoint_proto",
++ srcs = [
++ "agentendpoint.proto",
++ "config_common.proto",
++ "inventory.proto",
++ "os_policy.proto",
++ "patch_jobs.proto",
++ "tasks.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:date_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "agentendpoint_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/agentendpoint/v1",
++ proto = ":agentendpoint_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:date_go_proto",
++ ],
++)
+diff -urN c/google/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel d/google/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel
+--- c/google/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "agentendpoint_proto",
++ srcs = [
++ "agentendpoint.proto",
++ "guest_policies.proto",
++ "patch_jobs.proto",
++ "tasks.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "agentendpoint_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/agentendpoint/v1beta",
++ proto = ":agentendpoint_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/osconfig/logging/BUILD.bazel d/google/cloud/osconfig/logging/BUILD.bazel
+--- c/google/cloud/osconfig/logging/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/osconfig/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,16 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["patch_job_log.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:timestamp_proto"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/logging",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/osconfig/v1/BUILD.bazel d/google/cloud/osconfig/v1/BUILD.bazel
+--- c/google/cloud/osconfig/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/osconfig/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,47 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "osconfig_proto",
++ srcs = [
++ "inventory.proto",
++ "os_policy.proto",
++ "os_policy_assignment_reports.proto",
++ "os_policy_assignments.proto",
++ "osconfig_common.proto",
++ "osconfig_service.proto",
++ "osconfig_zonal_service.proto",
++ "patch_deployments.proto",
++ "patch_jobs.proto",
++ "vulnerability.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:date_proto",
++ "//google/type:datetime_proto",
++ "//google/type:dayofweek_proto",
++ "//google/type:timeofday_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "osconfig_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/v1",
++ proto = ":osconfig_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:date_go_proto",
++ "//google/type:datetime_go_proto",
++ "//google/type:dayofweek_go_proto",
++ "//google/type:timeofday_go_proto",
++ ],
++)
+diff -urN c/google/cloud/osconfig/v1alpha/BUILD.bazel d/google/cloud/osconfig/v1alpha/BUILD.bazel
+--- c/google/cloud/osconfig/v1alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/osconfig/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,39 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "osconfig_proto",
++ srcs = [
++ "config_common.proto",
++ "instance_os_policies_compliance.proto",
++ "inventory.proto",
++ "os_policy.proto",
++ "os_policy_assignment_reports.proto",
++ "os_policy_assignments.proto",
++ "osconfig_common.proto",
++ "osconfig_zonal_service.proto",
++ "vulnerability.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:date_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "osconfig_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/v1alpha",
++ proto = ":osconfig_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:date_go_proto",
++ ],
++)
+diff -urN c/google/cloud/osconfig/v1beta/BUILD.bazel d/google/cloud/osconfig/v1beta/BUILD.bazel
+--- c/google/cloud/osconfig/v1beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/osconfig/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "osconfig_proto",
++ srcs = [
++ "guest_policies.proto",
++ "osconfig_common.proto",
++ "osconfig_service.proto",
++ "patch_deployments.proto",
++ "patch_jobs.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:datetime_proto",
++ "//google/type:dayofweek_proto",
++ "//google/type:timeofday_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "osconfig_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/v1beta",
++ proto = ":osconfig_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:datetime_go_proto",
++ "//google/type:dayofweek_go_proto",
++ "//google/type:timeofday_go_proto",
++ ],
++)
+diff -urN c/google/cloud/oslogin/common/BUILD.bazel d/google/cloud/oslogin/common/BUILD.bazel
+--- c/google/cloud/oslogin/common/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/oslogin/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "common_proto",
++ srcs = ["common.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "common_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/oslogin/common",
++ proto = ":common_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/oslogin/v1/BUILD.bazel d/google/cloud/oslogin/v1/BUILD.bazel
+--- c/google/cloud/oslogin/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/oslogin/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "oslogin_proto",
++ srcs = ["oslogin.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/oslogin/common:common_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "oslogin_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/oslogin/v1",
++ proto = ":oslogin_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/oslogin/common:common_go_proto",
++ ],
++)
+diff -urN c/google/cloud/oslogin/v1alpha/BUILD.bazel d/google/cloud/oslogin/v1alpha/BUILD.bazel
+--- c/google/cloud/oslogin/v1alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/oslogin/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "oslogin_proto",
++ srcs = ["oslogin.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/oslogin/common:common_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "oslogin_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/oslogin/v1alpha",
++ proto = ":oslogin_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/oslogin/common:common_go_proto",
++ ],
++)
+diff -urN c/google/cloud/oslogin/v1beta/BUILD.bazel d/google/cloud/oslogin/v1beta/BUILD.bazel
+--- c/google/cloud/oslogin/v1beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/oslogin/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "oslogin_proto",
++ srcs = ["oslogin.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/oslogin/common:common_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "oslogin_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/oslogin/v1beta",
++ proto = ":oslogin_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/oslogin/common:common_go_proto",
++ ],
++)
+diff -urN c/google/cloud/paymentgateway/issuerswitch/v1/BUILD.bazel d/google/cloud/paymentgateway/issuerswitch/v1/BUILD.bazel
+--- c/google/cloud/paymentgateway/issuerswitch/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/paymentgateway/issuerswitch/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "issuerswitch_proto",
++ srcs = [
++ "common_fields.proto",
++ "logs.proto",
++ "resolutions.proto",
++ "rules.proto",
++ "transactions.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/logging/type:ltype_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:date_proto",
++ "//google/type:money_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "issuerswitch_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/paymentgateway/issuerswitch/v1",
++ proto = ":issuerswitch_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/logging/type:ltype_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:date_go_proto",
++ "//google/type:money_go_proto",
++ ],
++)
+diff -urN c/google/cloud/phishingprotection/v1beta1/BUILD.bazel d/google/cloud/phishingprotection/v1beta1/BUILD.bazel
+--- c/google/cloud/phishingprotection/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/phishingprotection/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "phishingprotection_proto",
++ srcs = ["phishingprotection.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "phishingprotection_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/phishingprotection/v1beta1",
++ proto = ":phishingprotection_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/policytroubleshooter/v1/BUILD.bazel d/google/cloud/policytroubleshooter/v1/BUILD.bazel
+--- c/google/cloud/policytroubleshooter/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/policytroubleshooter/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "policytroubleshooter_proto",
++ srcs = [
++ "checker.proto",
++ "explanations.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/type:expr_proto",
++ ],
++)
++
++go_proto_library(
++ name = "policytroubleshooter_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/policytroubleshooter/v1",
++ proto = ":policytroubleshooter_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/type:expr_go_proto",
++ ],
++)
+diff -urN c/google/cloud/privatecatalog/v1beta1/BUILD.bazel d/google/cloud/privatecatalog/v1beta1/BUILD.bazel
+--- c/google/cloud/privatecatalog/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/privatecatalog/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "privatecatalog_proto",
++ srcs = ["private_catalog.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "privatecatalog_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/privatecatalog/v1beta1",
++ proto = ":privatecatalog_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/pubsublite/v1/BUILD.bazel d/google/cloud/pubsublite/v1/BUILD.bazel
+--- c/google/cloud/pubsublite/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/pubsublite/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "pubsublite_proto",
++ srcs = [
++ "admin.proto",
++ "common.proto",
++ "cursor.proto",
++ "publisher.proto",
++ "subscriber.proto",
++ "topic_stats.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "pubsublite_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/pubsublite/v1",
++ proto = ":pubsublite_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/recaptchaenterprise/v1/BUILD.bazel d/google/cloud/recaptchaenterprise/v1/BUILD.bazel
+--- c/google/cloud/recaptchaenterprise/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/recaptchaenterprise/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "recaptchaenterprise_proto",
++ srcs = ["recaptchaenterprise.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "recaptchaenterprise_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1",
++ proto = ":recaptchaenterprise_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/recaptchaenterprise/v1beta1/BUILD.bazel d/google/cloud/recaptchaenterprise/v1beta1/BUILD.bazel
+--- c/google/cloud/recaptchaenterprise/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/recaptchaenterprise/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "recaptchaenterprise_proto",
++ srcs = ["recaptchaenterprise.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "recaptchaenterprise_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1beta1",
++ proto = ":recaptchaenterprise_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/recommendationengine/v1beta1/BUILD.bazel d/google/cloud/recommendationengine/v1beta1/BUILD.bazel
+--- c/google/cloud/recommendationengine/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/recommendationengine/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,42 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "recommendationengine_proto",
++ srcs = [
++ "catalog.proto",
++ "catalog_service.proto",
++ "common.proto",
++ "import.proto",
++ "prediction_apikey_registry_service.proto",
++ "prediction_service.proto",
++ "recommendationengine_resources.proto",
++ "user_event.proto",
++ "user_event_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:httpbody_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "recommendationengine_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/recommendationengine/v1beta1",
++ proto = ":recommendationengine_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:httpbody_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/recommender/logging/v1/BUILD.bazel d/google/cloud/recommender/logging/v1/BUILD.bazel
+--- c/google/cloud/recommender/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/recommender/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["action_log.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/recommender/v1:recommender_proto",
++ ],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/recommender/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/recommender/v1:recommender_go_proto",
++ ],
++)
+diff -urN c/google/cloud/recommender/logging/v1beta1/BUILD.bazel d/google/cloud/recommender/logging/v1beta1/BUILD.bazel
+--- c/google/cloud/recommender/logging/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/recommender/logging/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["action_log.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/recommender/v1beta1:recommender_proto",
++ ],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/recommender/logging/v1beta1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/recommender/v1beta1:recommender_go_proto",
++ ],
++)
+diff -urN c/google/cloud/recommender/v1/BUILD.bazel d/google/cloud/recommender/v1/BUILD.bazel
+--- c/google/cloud/recommender/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/recommender/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "recommender_proto",
++ srcs = [
++ "insight.proto",
++ "insight_type_config.proto",
++ "recommendation.proto",
++ "recommender_config.proto",
++ "recommender_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:money_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "recommender_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/recommender/v1",
++ proto = ":recommender_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:money_go_proto",
++ ],
++)
+diff -urN c/google/cloud/recommender/v1beta1/BUILD.bazel d/google/cloud/recommender/v1beta1/BUILD.bazel
+--- c/google/cloud/recommender/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/recommender/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "recommender_proto",
++ srcs = [
++ "insight.proto",
++ "insight_type_config.proto",
++ "recommendation.proto",
++ "recommender_config.proto",
++ "recommender_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:money_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "recommender_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/recommender/v1beta1",
++ proto = ":recommender_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:money_go_proto",
++ ],
++)
+diff -urN c/google/cloud/redis/v1/BUILD.bazel d/google/cloud/redis/v1/BUILD.bazel
+--- c/google/cloud/redis/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/redis/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "redis_proto",
++ srcs = ["cloud_redis.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:dayofweek_proto",
++ "//google/type:timeofday_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "redis_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/redis/v1",
++ proto = ":redis_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:dayofweek_go_proto",
++ "//google/type:timeofday_go_proto",
++ ],
++)
+diff -urN c/google/cloud/redis/v1beta1/BUILD.bazel d/google/cloud/redis/v1beta1/BUILD.bazel
+--- c/google/cloud/redis/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/redis/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "redis_proto",
++ srcs = ["cloud_redis.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:dayofweek_proto",
++ "//google/type:timeofday_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "redis_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/redis/v1beta1",
++ proto = ":redis_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:dayofweek_go_proto",
++ "//google/type:timeofday_go_proto",
++ ],
++)
+diff -urN c/google/cloud/resourcemanager/v2/BUILD.bazel d/google/cloud/resourcemanager/v2/BUILD.bazel
+--- c/google/cloud/resourcemanager/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/resourcemanager/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "resourcemanager_proto",
++ srcs = ["folders.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "resourcemanager_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/resourcemanager/v2",
++ proto = ":resourcemanager_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/resourcemanager/v3/BUILD.bazel d/google/cloud/resourcemanager/v3/BUILD.bazel
+--- c/google/cloud/resourcemanager/v3/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/resourcemanager/v3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "resourcemanager_proto",
++ srcs = [
++ "folders.proto",
++ "organizations.proto",
++ "projects.proto",
++ "tag_bindings.proto",
++ "tag_keys.proto",
++ "tag_values.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "resourcemanager_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3",
++ proto = ":resourcemanager_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/resourcesettings/v1/BUILD.bazel d/google/cloud/resourcesettings/v1/BUILD.bazel
+--- c/google/cloud/resourcesettings/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/resourcesettings/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "resourcesettings_proto",
++ srcs = ["resource_settings.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "resourcesettings_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/resourcesettings/v1",
++ proto = ":resourcesettings_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/retail/logging/BUILD.bazel d/google/cloud/retail/logging/BUILD.bazel
+--- c/google/cloud/retail/logging/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/retail/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["error_log.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/retail/logging",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/rpc:status_go_proto"],
++)
+diff -urN c/google/cloud/retail/v2/BUILD.bazel d/google/cloud/retail/v2/BUILD.bazel
+--- c/google/cloud/retail/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/retail/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,54 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "retail_proto",
++ srcs = [
++ "catalog.proto",
++ "catalog_service.proto",
++ "common.proto",
++ "completion_service.proto",
++ "control.proto",
++ "control_service.proto",
++ "import_config.proto",
++ "prediction_service.proto",
++ "product.proto",
++ "product_service.proto",
++ "promotion.proto",
++ "purge_config.proto",
++ "search_service.proto",
++ "serving_config.proto",
++ "serving_config_service.proto",
++ "user_event.proto",
++ "user_event_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:httpbody_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:date_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "retail_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/retail/v2",
++ proto = ":retail_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:httpbody_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:date_go_proto",
++ ],
++)
+diff -urN c/google/cloud/retail/v2alpha/BUILD.bazel d/google/cloud/retail/v2alpha/BUILD.bazel
+--- c/google/cloud/retail/v2alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/retail/v2alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,57 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "retail_proto",
++ srcs = [
++ "catalog.proto",
++ "catalog_service.proto",
++ "common.proto",
++ "completion_service.proto",
++ "control.proto",
++ "control_service.proto",
++ "export_config.proto",
++ "import_config.proto",
++ "model.proto",
++ "model_service.proto",
++ "prediction_service.proto",
++ "product.proto",
++ "product_service.proto",
++ "promotion.proto",
++ "purge_config.proto",
++ "search_service.proto",
++ "serving_config.proto",
++ "serving_config_service.proto",
++ "user_event.proto",
++ "user_event_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:httpbody_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:date_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "retail_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha",
++ proto = ":retail_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:httpbody_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:date_go_proto",
++ ],
++)
+diff -urN c/google/cloud/retail/v2beta/BUILD.bazel d/google/cloud/retail/v2beta/BUILD.bazel
+--- c/google/cloud/retail/v2beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/retail/v2beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,57 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "retail_proto",
++ srcs = [
++ "catalog.proto",
++ "catalog_service.proto",
++ "common.proto",
++ "completion_service.proto",
++ "control.proto",
++ "control_service.proto",
++ "export_config.proto",
++ "import_config.proto",
++ "model.proto",
++ "model_service.proto",
++ "prediction_service.proto",
++ "product.proto",
++ "product_service.proto",
++ "promotion.proto",
++ "purge_config.proto",
++ "search_service.proto",
++ "serving_config.proto",
++ "serving_config_service.proto",
++ "user_event.proto",
++ "user_event_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:httpbody_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:date_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "retail_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/retail/v2beta",
++ proto = ":retail_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:httpbody_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:date_go_proto",
++ ],
++)
+diff -urN c/google/cloud/run/v2/BUILD.bazel d/google/cloud/run/v2/BUILD.bazel
+--- c/google/cloud/run/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/run/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,45 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "run_proto",
++ srcs = [
++ "condition.proto",
++ "execution.proto",
++ "execution_template.proto",
++ "job.proto",
++ "k8s.min.proto",
++ "revision.proto",
++ "revision_template.proto",
++ "service.proto",
++ "task.proto",
++ "task_template.proto",
++ "traffic_target.proto",
++ "vendor_settings.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:api_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "run_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/run/v2",
++ proto = ":run_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:api_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/runtimeconfig/v1beta1/BUILD.bazel d/google/cloud/runtimeconfig/v1beta1/BUILD.bazel
+--- c/google/cloud/runtimeconfig/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/runtimeconfig/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "runtimeconfig_proto",
++ srcs = [
++ "resources.proto",
++ "runtimeconfig.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "runtimeconfig_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/runtimeconfig/v1beta1",
++ proto = ":runtimeconfig_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/saasaccelerator/management/logs/v1/BUILD.bazel d/google/cloud/saasaccelerator/management/logs/v1/BUILD.bazel
+--- c/google/cloud/saasaccelerator/management/logs/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/saasaccelerator/management/logs/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logs_proto",
++ srcs = [
++ "notification_service_payload.proto",
++ "saas_instance_payload.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:timestamp_proto"],
++)
++
++go_proto_library(
++ name = "logs_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/saasaccelerator/management/logs/v1",
++ proto = ":logs_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/scheduler/v1/BUILD.bazel d/google/cloud/scheduler/v1/BUILD.bazel
+--- c/google/cloud/scheduler/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/scheduler/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "scheduler_proto",
++ srcs = [
++ "cloudscheduler.proto",
++ "job.proto",
++ "target.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "scheduler_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/scheduler/v1",
++ proto = ":scheduler_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/scheduler/v1beta1/BUILD.bazel d/google/cloud/scheduler/v1beta1/BUILD.bazel
+--- c/google/cloud/scheduler/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/scheduler/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "scheduler_proto",
++ srcs = [
++ "cloudscheduler.proto",
++ "job.proto",
++ "target.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "scheduler_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1",
++ proto = ":scheduler_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/secretmanager/logging/v1/BUILD.bazel d/google/cloud/secretmanager/logging/v1/BUILD.bazel
+--- c/google/cloud/secretmanager/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/secretmanager/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["secret_event.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/secretmanager/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/secretmanager/v1/BUILD.bazel d/google/cloud/secretmanager/v1/BUILD.bazel
+--- c/google/cloud/secretmanager/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/secretmanager/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "secretmanager_proto",
++ srcs = [
++ "resources.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "secretmanager_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/secretmanager/v1",
++ proto = ":secretmanager_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/secrets/v1beta1/BUILD.bazel d/google/cloud/secrets/v1beta1/BUILD.bazel
+--- c/google/cloud/secrets/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/secrets/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "secretmanager_proto",
++ srcs = [
++ "resources.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "secretmanager_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/secretmanager/v1beta1",
++ proto = ":secretmanager_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/security/privateca/v1/BUILD.bazel d/google/cloud/security/privateca/v1/BUILD.bazel
+--- c/google/cloud/security/privateca/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/security/privateca/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "privateca_proto",
++ srcs = [
++ "resources.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:expr_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "privateca_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/security/privateca/v1",
++ proto = ":privateca_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:expr_go_proto",
++ ],
++)
+diff -urN c/google/cloud/security/privateca/v1beta1/BUILD.bazel d/google/cloud/security/privateca/v1beta1/BUILD.bazel
+--- c/google/cloud/security/privateca/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/security/privateca/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "privateca_proto",
++ srcs = [
++ "resources.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "privateca_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/security/privateca/v1beta1",
++ proto = ":privateca_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/security/publicca/v1beta1/BUILD.bazel d/google/cloud/security/publicca/v1beta1/BUILD.bazel
+--- c/google/cloud/security/publicca/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/security/publicca/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "publicca_proto",
++ srcs = [
++ "resources.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "publicca_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/security/publicca/v1beta1",
++ proto = ":publicca_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/securitycenter/settings/v1beta1/BUILD.bazel d/google/cloud/securitycenter/settings/v1beta1/BUILD.bazel
+--- c/google/cloud/securitycenter/settings/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/securitycenter/settings/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "settings_proto",
++ srcs = [
++ "billing_settings.proto",
++ "component_settings.proto",
++ "detector.proto",
++ "securitycenter_settings_service.proto",
++ "settings.proto",
++ "sink_settings.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "settings_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1",
++ proto = ":settings_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/securitycenter/v1/BUILD.bazel d/google/cloud/securitycenter/v1/BUILD.bazel
+--- c/google/cloud/securitycenter/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/securitycenter/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,61 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "securitycenter_proto",
++ srcs = [
++ "access.proto",
++ "asset.proto",
++ "bigquery_export.proto",
++ "compliance.proto",
++ "connection.proto",
++ "contact_details.proto",
++ "container.proto",
++ "database.proto",
++ "exfiltration.proto",
++ "external_system.proto",
++ "file.proto",
++ "finding.proto",
++ "folder.proto",
++ "iam_binding.proto",
++ "indicator.proto",
++ "kubernetes.proto",
++ "label.proto",
++ "mitre_attack.proto",
++ "mute_config.proto",
++ "notification_config.proto",
++ "notification_message.proto",
++ "organization_settings.proto",
++ "process.proto",
++ "resource.proto",
++ "run_asset_discovery_response.proto",
++ "security_marks.proto",
++ "securitycenter_service.proto",
++ "source.proto",
++ "vulnerability.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "securitycenter_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1",
++ proto = ":securitycenter_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/securitycenter/v1beta1/BUILD.bazel d/google/cloud/securitycenter/v1beta1/BUILD.bazel
+--- c/google/cloud/securitycenter/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/securitycenter/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "securitycenter_proto",
++ srcs = [
++ "asset.proto",
++ "finding.proto",
++ "organization_settings.proto",
++ "run_asset_discovery_response.proto",
++ "security_marks.proto",
++ "securitycenter_service.proto",
++ "source.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "securitycenter_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1",
++ proto = ":securitycenter_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/securitycenter/v1p1beta1/BUILD.bazel d/google/cloud/securitycenter/v1p1beta1/BUILD.bazel
+--- c/google/cloud/securitycenter/v1p1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/securitycenter/v1p1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,43 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "securitycenter_proto",
++ srcs = [
++ "asset.proto",
++ "finding.proto",
++ "folder.proto",
++ "notification_config.proto",
++ "notification_message.proto",
++ "organization_settings.proto",
++ "resource.proto",
++ "run_asset_discovery_response.proto",
++ "security_marks.proto",
++ "securitycenter_service.proto",
++ "source.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "securitycenter_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1",
++ proto = ":securitycenter_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/sensitiveaction/logging/v1/BUILD.bazel d/google/cloud/sensitiveaction/logging/v1/BUILD.bazel
+--- c/google/cloud/sensitiveaction/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/sensitiveaction/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["sensitive_action_payload.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/cloud/securitycenter/v1:securitycenter_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/sensitiveaction/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/cloud/securitycenter/v1:securitycenter_go_proto"],
++)
+diff -urN c/google/cloud/servicedirectory/v1/BUILD.bazel d/google/cloud/servicedirectory/v1/BUILD.bazel
+--- c/google/cloud/servicedirectory/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/servicedirectory/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "servicedirectory_proto",
++ srcs = [
++ "endpoint.proto",
++ "lookup_service.proto",
++ "namespace.proto",
++ "registration_service.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "servicedirectory_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1",
++ proto = ":servicedirectory_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/servicedirectory/v1beta1/BUILD.bazel d/google/cloud/servicedirectory/v1beta1/BUILD.bazel
+--- c/google/cloud/servicedirectory/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/servicedirectory/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "servicedirectory_proto",
++ srcs = [
++ "endpoint.proto",
++ "lookup_service.proto",
++ "namespace.proto",
++ "registration_service.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "servicedirectory_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1",
++ proto = ":servicedirectory_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/cloud/shell/v1/BUILD.bazel d/google/cloud/shell/v1/BUILD.bazel
+--- c/google/cloud/shell/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/shell/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "shell_proto",
++ srcs = ["cloudshell.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "shell_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/shell/v1",
++ proto = ":shell_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/speech/v1/BUILD.bazel d/google/cloud/speech/v1/BUILD.bazel
+--- c/google/cloud/speech/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/speech/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "speech_proto",
++ srcs = [
++ "cloud_speech.proto",
++ "cloud_speech_adaptation.proto",
++ "resource.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "speech_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/speech/v1",
++ proto = ":speech_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/speech/v1p1beta1/BUILD.bazel d/google/cloud/speech/v1p1beta1/BUILD.bazel
+--- c/google/cloud/speech/v1p1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/speech/v1p1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "speech_proto",
++ srcs = [
++ "cloud_speech.proto",
++ "cloud_speech_adaptation.proto",
++ "resource.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "speech_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1",
++ proto = ":speech_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/speech/v2/BUILD.bazel d/google/cloud/speech/v2/BUILD.bazel
+--- c/google/cloud/speech/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/speech/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "speech_proto",
++ srcs = ["cloud_speech.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "speech_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/speech/v2",
++ proto = ":speech_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/sql/v1/BUILD.bazel d/google/cloud/sql/v1/BUILD.bazel
+--- c/google/cloud/sql/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/sql/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "sql_proto",
++ srcs = [
++ "cloud_sql_backup_runs.proto",
++ "cloud_sql_connect.proto",
++ "cloud_sql_databases.proto",
++ "cloud_sql_flags.proto",
++ "cloud_sql_instance_names.proto",
++ "cloud_sql_instances.proto",
++ "cloud_sql_operations.proto",
++ "cloud_sql_resources.proto",
++ "cloud_sql_ssl_certs.proto",
++ "cloud_sql_tiers.proto",
++ "cloud_sql_users.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "sql_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/sql/v1",
++ proto = ":sql_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/sql/v1beta4/BUILD.bazel d/google/cloud/sql/v1beta4/BUILD.bazel
+--- c/google/cloud/sql/v1beta4/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/sql/v1beta4/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "sql_proto",
++ srcs = [
++ "cloud_sql.proto",
++ "cloud_sql_connect.proto",
++ "cloud_sql_resources.proto",
++ "cloud_sql_tiers.proto",
++ "cloud_sql_users.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "sql_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/sql/v1beta4",
++ proto = ":sql_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/storageinsights/v1/BUILD.bazel d/google/cloud/storageinsights/v1/BUILD.bazel
+--- c/google/cloud/storageinsights/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/storageinsights/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "storageinsights_proto",
++ srcs = ["storageinsights.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "//google/type:date_proto",
++ "//google/type:datetime_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "storageinsights_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/storageinsights/v1",
++ proto = ":storageinsights_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:date_go_proto",
++ "//google/type:datetime_go_proto",
++ ],
++)
+diff -urN c/google/cloud/stream/logging/v1/BUILD.bazel d/google/cloud/stream/logging/v1/BUILD.bazel
+--- c/google/cloud/stream/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/stream/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,16 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["logging.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:timestamp_proto"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/stream/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/support/BUILD.bazel d/google/cloud/support/BUILD.bazel
+--- c/google/cloud/support/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/support/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "common_proto",
++ srcs = ["common.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "common_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/support/common",
++ proto = ":common_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/support/v1alpha1/BUILD.bazel d/google/cloud/support/v1alpha1/BUILD.bazel
+--- c/google/cloud/support/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/support/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "support_proto",
++ srcs = ["cloud_support.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/cloud/support:common_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "support_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/support/v1alpha1",
++ proto = ":support_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/cloud/support:common_go_proto",
++ ],
++)
+diff -urN c/google/cloud/talent/v4/BUILD.bazel d/google/cloud/talent/v4/BUILD.bazel
+--- c/google/cloud/talent/v4/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/talent/v4/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,52 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "talent_proto",
++ srcs = [
++ "common.proto",
++ "company.proto",
++ "company_service.proto",
++ "completion_service.proto",
++ "event.proto",
++ "event_service.proto",
++ "filters.proto",
++ "histogram.proto",
++ "job.proto",
++ "job_service.proto",
++ "tenant.proto",
++ "tenant_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:latlng_proto",
++ "//google/type:money_proto",
++ "//google/type:postaladdress_proto",
++ "//google/type:timeofday_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "talent_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/talent/v4",
++ proto = ":talent_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:latlng_go_proto",
++ "//google/type:money_go_proto",
++ "//google/type:postaladdress_go_proto",
++ "//google/type:timeofday_go_proto",
++ ],
++)
+diff -urN c/google/cloud/talent/v4beta1/BUILD.bazel d/google/cloud/talent/v4beta1/BUILD.bazel
+--- c/google/cloud/talent/v4beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/talent/v4beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,53 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "talent_proto",
++ srcs = [
++ "batch.proto",
++ "common.proto",
++ "company.proto",
++ "company_service.proto",
++ "completion_service.proto",
++ "event.proto",
++ "event_service.proto",
++ "filters.proto",
++ "histogram.proto",
++ "job.proto",
++ "job_service.proto",
++ "tenant.proto",
++ "tenant_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:latlng_proto",
++ "//google/type:money_proto",
++ "//google/type:postaladdress_proto",
++ "//google/type:timeofday_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "talent_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1",
++ proto = ":talent_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:latlng_go_proto",
++ "//google/type:money_go_proto",
++ "//google/type:postaladdress_go_proto",
++ "//google/type:timeofday_go_proto",
++ ],
++)
+diff -urN c/google/cloud/tasks/v2/BUILD.bazel d/google/cloud/tasks/v2/BUILD.bazel
+--- c/google/cloud/tasks/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/tasks/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "tasks_proto",
++ srcs = [
++ "cloudtasks.proto",
++ "queue.proto",
++ "target.proto",
++ "task.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "tasks_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/tasks/v2",
++ proto = ":tasks_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/tasks/v2beta2/BUILD.bazel d/google/cloud/tasks/v2beta2/BUILD.bazel
+--- c/google/cloud/tasks/v2beta2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/tasks/v2beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "tasks_proto",
++ srcs = [
++ "cloudtasks.proto",
++ "old_target.proto",
++ "queue.proto",
++ "target.proto",
++ "task.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "tasks_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta2",
++ proto = ":tasks_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/tasks/v2beta3/BUILD.bazel d/google/cloud/tasks/v2beta3/BUILD.bazel
+--- c/google/cloud/tasks/v2beta3/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/tasks/v2beta3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "tasks_proto",
++ srcs = [
++ "cloudtasks.proto",
++ "queue.proto",
++ "target.proto",
++ "task.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "tasks_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta3",
++ proto = ":tasks_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/texttospeech/v1/BUILD.bazel d/google/cloud/texttospeech/v1/BUILD.bazel
+--- c/google/cloud/texttospeech/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/texttospeech/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "texttospeech_proto",
++ srcs = ["cloud_tts.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "texttospeech_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/texttospeech/v1",
++ proto = ":texttospeech_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/texttospeech/v1beta1/BUILD.bazel d/google/cloud/texttospeech/v1beta1/BUILD.bazel
+--- c/google/cloud/texttospeech/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/texttospeech/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "texttospeech_proto",
++ srcs = ["cloud_tts.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_proto"],
++)
++
++go_proto_library(
++ name = "texttospeech_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/texttospeech/v1beta1",
++ proto = ":texttospeech_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/timeseriesinsights/v1/BUILD.bazel d/google/cloud/timeseriesinsights/v1/BUILD.bazel
+--- c/google/cloud/timeseriesinsights/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/timeseriesinsights/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "timeseriesinsights_proto",
++ srcs = ["timeseries_insights.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "timeseriesinsights_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/timeseriesinsights/v1",
++ proto = ":timeseriesinsights_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/tpu/v1/BUILD.bazel d/google/cloud/tpu/v1/BUILD.bazel
+--- c/google/cloud/tpu/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/tpu/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "tpu_proto",
++ srcs = ["cloud_tpu.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "tpu_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/tpu/v1",
++ proto = ":tpu_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/tpu/v2alpha1/BUILD.bazel d/google/cloud/tpu/v2alpha1/BUILD.bazel
+--- c/google/cloud/tpu/v2alpha1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/tpu/v2alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "tpu_proto",
++ srcs = ["cloud_tpu.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "tpu_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/tpu/v2alpha1",
++ proto = ":tpu_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/translate/v3/BUILD.bazel d/google/cloud/translate/v3/BUILD.bazel
+--- c/google/cloud/translate/v3/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/translate/v3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "translate_proto",
++ srcs = ["translation_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "translate_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/translate/v3",
++ proto = ":translate_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/translate/v3beta1/BUILD.bazel d/google/cloud/translate/v3beta1/BUILD.bazel
+--- c/google/cloud/translate/v3beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/translate/v3beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "translate_proto",
++ srcs = ["translation_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "translate_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/translate/v3beta1",
++ proto = ":translate_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/video/livestream/logging/v1/BUILD.bazel d/google/cloud/video/livestream/logging/v1/BUILD.bazel
+--- c/google/cloud/video/livestream/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/video/livestream/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["logs.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/cloud/video/livestream/v1:livestream_proto",
++ "//google/rpc:status_proto",
++ ],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/video/livestream/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/cloud/video/livestream/v1:livestream_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/video/livestream/v1/BUILD.bazel d/google/cloud/video/livestream/v1/BUILD.bazel
+--- c/google/cloud/video/livestream/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/video/livestream/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "livestream_proto",
++ srcs = [
++ "outputs.proto",
++ "resources.proto",
++ "service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "livestream_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/video/livestream/v1",
++ proto = ":livestream_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/video/stitcher/v1/BUILD.bazel d/google/cloud/video/stitcher/v1/BUILD.bazel
+--- c/google/cloud/video/stitcher/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/video/stitcher/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "stitcher_proto",
++ srcs = [
++ "ad_tag_details.proto",
++ "cdn_keys.proto",
++ "companions.proto",
++ "events.proto",
++ "sessions.proto",
++ "slates.proto",
++ "stitch_details.proto",
++ "video_stitcher_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++go_proto_library(
++ name = "stitcher_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/video/stitcher/v1",
++ proto = ":stitcher_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/video/transcoder/v1/BUILD.bazel d/google/cloud/video/transcoder/v1/BUILD.bazel
+--- c/google/cloud/video/transcoder/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/video/transcoder/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "transcoder_proto",
++ srcs = [
++ "resources.proto",
++ "services.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "transcoder_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1",
++ proto = ":transcoder_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/videointelligence/v1/BUILD.bazel d/google/cloud/videointelligence/v1/BUILD.bazel
+--- c/google/cloud/videointelligence/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/videointelligence/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "videointelligence_proto",
++ srcs = ["video_intelligence.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "videointelligence_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1",
++ proto = ":videointelligence_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/videointelligence/v1beta2/BUILD.bazel d/google/cloud/videointelligence/v1beta2/BUILD.bazel
+--- c/google/cloud/videointelligence/v1beta2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/videointelligence/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "videointelligence_proto",
++ srcs = ["video_intelligence.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "videointelligence_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta2",
++ proto = ":videointelligence_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/videointelligence/v1p1beta1/BUILD.bazel d/google/cloud/videointelligence/v1p1beta1/BUILD.bazel
+--- c/google/cloud/videointelligence/v1p1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/videointelligence/v1p1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "videointelligence_proto",
++ srcs = ["video_intelligence.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "videointelligence_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1p1beta1",
++ proto = ":videointelligence_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/videointelligence/v1p2beta1/BUILD.bazel d/google/cloud/videointelligence/v1p2beta1/BUILD.bazel
+--- c/google/cloud/videointelligence/v1p2beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/videointelligence/v1p2beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "videointelligence_proto",
++ srcs = ["video_intelligence.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "videointelligence_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1p2beta1",
++ proto = ":videointelligence_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/videointelligence/v1p3beta1/BUILD.bazel d/google/cloud/videointelligence/v1p3beta1/BUILD.bazel
+--- c/google/cloud/videointelligence/v1p3beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/videointelligence/v1p3beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "videointelligence_proto",
++ srcs = ["video_intelligence.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "videointelligence_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1p3beta1",
++ proto = ":videointelligence_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/vision/v1/BUILD.bazel d/google/cloud/vision/v1/BUILD.bazel
+--- c/google/cloud/vision/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/vision/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "vision_proto",
++ srcs = [
++ "geometry.proto",
++ "image_annotator.proto",
++ "product_search.proto",
++ "product_search_service.proto",
++ "text_annotation.proto",
++ "web_detection.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:color_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "vision_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vision/v1",
++ proto = ":vision_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:color_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/cloud/vision/v1p1beta1/BUILD.bazel d/google/cloud/vision/v1p1beta1/BUILD.bazel
+--- c/google/cloud/vision/v1p1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/vision/v1p1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "vision_proto",
++ srcs = [
++ "geometry.proto",
++ "image_annotator.proto",
++ "text_annotation.proto",
++ "web_detection.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "//google/type:color_proto",
++ "//google/type:latlng_proto",
++ ],
++)
++
++go_proto_library(
++ name = "vision_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1",
++ proto = ":vision_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:color_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/cloud/vision/v1p2beta1/BUILD.bazel d/google/cloud/vision/v1p2beta1/BUILD.bazel
+--- c/google/cloud/vision/v1p2beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/vision/v1p2beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "vision_proto",
++ srcs = [
++ "geometry.proto",
++ "image_annotator.proto",
++ "text_annotation.proto",
++ "web_detection.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:color_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "vision_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1",
++ proto = ":vision_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:color_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/cloud/vision/v1p3beta1/BUILD.bazel d/google/cloud/vision/v1p3beta1/BUILD.bazel
+--- c/google/cloud/vision/v1p3beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/vision/v1p3beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "vision_proto",
++ srcs = [
++ "geometry.proto",
++ "image_annotator.proto",
++ "product_search.proto",
++ "product_search_service.proto",
++ "text_annotation.proto",
++ "web_detection.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:color_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "vision_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1",
++ proto = ":vision_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:color_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/cloud/vision/v1p4beta1/BUILD.bazel d/google/cloud/vision/v1p4beta1/BUILD.bazel
+--- c/google/cloud/vision/v1p4beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/vision/v1p4beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,41 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "vision_proto",
++ srcs = [
++ "face.proto",
++ "geometry.proto",
++ "image_annotator.proto",
++ "product_search.proto",
++ "product_search_service.proto",
++ "text_annotation.proto",
++ "web_detection.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:color_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "vision_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vision/v1p4beta1",
++ proto = ":vision_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:color_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/cloud/visionai/v1alpha1/BUILD.bazel d/google/cloud/visionai/v1alpha1/BUILD.bazel
+--- c/google/cloud/visionai/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/visionai/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,46 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "visionai_proto",
++ srcs = [
++ "annotations.proto",
++ "common.proto",
++ "lva.proto",
++ "lva_resources.proto",
++ "lva_service.proto",
++ "platform.proto",
++ "streaming_resources.proto",
++ "streaming_service.proto",
++ "streams_resources.proto",
++ "streams_service.proto",
++ "warehouse.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:datetime_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "visionai_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/visionai/v1alpha1",
++ proto = ":visionai_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:datetime_go_proto",
++ ],
++)
+diff -urN c/google/cloud/vmmigration/v1/BUILD.bazel d/google/cloud/vmmigration/v1/BUILD.bazel
+--- c/google/cloud/vmmigration/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/vmmigration/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "vmmigration_proto",
++ srcs = ["vmmigration.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:errdetails_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "vmmigration_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vmmigration/v1",
++ proto = ":vmmigration_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:errdetails_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/cloud/vmwareengine/v1/BUILD.bazel d/google/cloud/vmwareengine/v1/BUILD.bazel
+--- c/google/cloud/vmwareengine/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/vmwareengine/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "vmwareengine_proto",
++ srcs = ["vmwareengine.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "vmwareengine_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vmwareengine/v1",
++ proto = ":vmwareengine_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/vpcaccess/v1/BUILD.bazel d/google/cloud/vpcaccess/v1/BUILD.bazel
+--- c/google/cloud/vpcaccess/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/vpcaccess/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "vpcaccess_proto",
++ srcs = ["vpc_access.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "vpcaccess_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vpcaccess/v1",
++ proto = ":vpcaccess_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/webrisk/v1/BUILD.bazel d/google/cloud/webrisk/v1/BUILD.bazel
+--- c/google/cloud/webrisk/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/webrisk/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "webrisk_proto",
++ srcs = ["webrisk.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "webrisk_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/webrisk/v1",
++ proto = ":webrisk_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/webrisk/v1beta1/BUILD.bazel d/google/cloud/webrisk/v1beta1/BUILD.bazel
+--- c/google/cloud/webrisk/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/webrisk/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "webrisk_proto",
++ srcs = ["webrisk.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "webrisk_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/webrisk/v1beta1",
++ proto = ":webrisk_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/websecurityscanner/v1/BUILD.bazel d/google/cloud/websecurityscanner/v1/BUILD.bazel
+--- c/google/cloud/websecurityscanner/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/websecurityscanner/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "websecurityscanner_proto",
++ srcs = [
++ "crawled_url.proto",
++ "finding.proto",
++ "finding_addon.proto",
++ "finding_type_stats.proto",
++ "scan_config.proto",
++ "scan_config_error.proto",
++ "scan_run.proto",
++ "scan_run_error_trace.proto",
++ "scan_run_log.proto",
++ "scan_run_warning_trace.proto",
++ "web_security_scanner.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "websecurityscanner_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1",
++ proto = ":websecurityscanner_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/websecurityscanner/v1alpha/BUILD.bazel d/google/cloud/websecurityscanner/v1alpha/BUILD.bazel
+--- c/google/cloud/websecurityscanner/v1alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/websecurityscanner/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "websecurityscanner_proto",
++ srcs = [
++ "crawled_url.proto",
++ "finding.proto",
++ "finding_addon.proto",
++ "finding_type_stats.proto",
++ "scan_config.proto",
++ "scan_run.proto",
++ "web_security_scanner.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "websecurityscanner_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha",
++ proto = ":websecurityscanner_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/websecurityscanner/v1beta/BUILD.bazel d/google/cloud/websecurityscanner/v1beta/BUILD.bazel
+--- c/google/cloud/websecurityscanner/v1beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/websecurityscanner/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "websecurityscanner_proto",
++ srcs = [
++ "crawled_url.proto",
++ "finding.proto",
++ "finding_addon.proto",
++ "finding_type_stats.proto",
++ "scan_config.proto",
++ "scan_config_error.proto",
++ "scan_run.proto",
++ "scan_run_error_trace.proto",
++ "scan_run_warning_trace.proto",
++ "web_security_scanner.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "websecurityscanner_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta",
++ proto = ":websecurityscanner_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/workflows/executions/v1/BUILD.bazel d/google/cloud/workflows/executions/v1/BUILD.bazel
+--- c/google/cloud/workflows/executions/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/workflows/executions/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "executions_proto",
++ srcs = ["executions.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "executions_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/workflows/executions/v1",
++ proto = ":executions_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/workflows/executions/v1beta/BUILD.bazel d/google/cloud/workflows/executions/v1beta/BUILD.bazel
+--- c/google/cloud/workflows/executions/v1beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/workflows/executions/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "executions_proto",
++ srcs = ["executions.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "executions_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/workflows/executions/v1beta",
++ proto = ":executions_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/cloud/workflows/type/BUILD.bazel d/google/cloud/workflows/type/BUILD.bazel
+--- c/google/cloud/workflows/type/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/workflows/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "type_proto",
++ srcs = [
++ "engine_call.proto",
++ "executions_system.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "type_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/cloud/workflows/type",
++ proto = ":type_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/cloud/workflows/v1/BUILD.bazel d/google/cloud/workflows/v1/BUILD.bazel
+--- c/google/cloud/workflows/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/workflows/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "workflows_proto",
++ srcs = ["workflows.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "workflows_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/workflows/v1",
++ proto = ":workflows_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/cloud/workflows/v1beta/BUILD.bazel d/google/cloud/workflows/v1beta/BUILD.bazel
+--- c/google/cloud/workflows/v1beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/cloud/workflows/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "workflows_proto",
++ srcs = ["workflows.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "workflows_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/workflows/v1beta",
++ proto = ":workflows_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/container/v1/BUILD.bazel d/google/container/v1/BUILD.bazel
+--- c/google/container/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/container/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "container_proto",
++ srcs = ["cluster_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:code_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "container_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/container/v1",
++ proto = ":container_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:code_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/container/v1alpha1/BUILD.bazel d/google/container/v1alpha1/BUILD.bazel
+--- c/google/container/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/container/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "container_proto",
++ srcs = ["cluster_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ ],
++)
++
++go_proto_library(
++ name = "container_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/container/v1alpha1",
++ proto = ":container_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/container/v1beta1/BUILD.bazel d/google/container/v1beta1/BUILD.bazel
+--- c/google/container/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/container/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "container_proto",
++ srcs = ["cluster_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:code_proto",
++ "//google/rpc:status_proto",
++ "//google/type:date_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "container_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/container/v1beta1",
++ proto = ":container_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:code_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:date_go_proto",
++ ],
++)
+diff -urN c/google/dataflow/v1beta3/BUILD.bazel d/google/dataflow/v1beta3/BUILD.bazel
+--- c/google/dataflow/v1beta3/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/dataflow/v1beta3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "dataflow_proto",
++ srcs = [
++ "environment.proto",
++ "jobs.proto",
++ "messages.proto",
++ "metrics.proto",
++ "snapshots.proto",
++ "streaming.proto",
++ "templates.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "dataflow_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/dataflow/v1beta3",
++ proto = ":dataflow_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/datastore/admin/v1/BUILD.bazel d/google/datastore/admin/v1/BUILD.bazel
+--- c/google/datastore/admin/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/datastore/admin/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "admin_proto",
++ srcs = [
++ "datastore_admin.proto",
++ "index.proto",
++ "migration.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "admin_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/datastore/admin/v1",
++ proto = ":admin_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/datastore/admin/v1beta1/BUILD.bazel d/google/datastore/admin/v1beta1/BUILD.bazel
+--- c/google/datastore/admin/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/datastore/admin/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "admin_proto",
++ srcs = ["datastore_admin.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "admin_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/datastore/admin/v1beta1",
++ proto = ":admin_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/datastore/v1/BUILD.bazel d/google/datastore/v1/BUILD.bazel
+--- c/google/datastore/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/datastore/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "datastore_proto",
++ srcs = [
++ "aggregation_result.proto",
++ "datastore.proto",
++ "entity.proto",
++ "query.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "datastore_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/datastore/v1",
++ proto = ":datastore_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/datastore/v1beta3/BUILD.bazel d/google/datastore/v1beta3/BUILD.bazel
+--- c/google/datastore/v1beta3/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/datastore/v1beta3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "datastore_proto",
++ srcs = [
++ "datastore.proto",
++ "entity.proto",
++ "query.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "datastore_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/datastore/v1beta3",
++ proto = ":datastore_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/devtools/artifactregistry/v1/BUILD.bazel d/google/devtools/artifactregistry/v1/BUILD.bazel
+--- c/google/devtools/artifactregistry/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/artifactregistry/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,43 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "artifactregistry_proto",
++ srcs = [
++ "apt_artifact.proto",
++ "artifact.proto",
++ "file.proto",
++ "package.proto",
++ "repository.proto",
++ "service.proto",
++ "settings.proto",
++ "tag.proto",
++ "version.proto",
++ "yum_artifact.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "artifactregistry_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1",
++ proto = ":artifactregistry_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/devtools/artifactregistry/v1beta2/BUILD.bazel d/google/devtools/artifactregistry/v1beta2/BUILD.bazel
+--- c/google/devtools/artifactregistry/v1beta2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/artifactregistry/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,42 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "artifactregistry_proto",
++ srcs = [
++ "apt_artifact.proto",
++ "file.proto",
++ "package.proto",
++ "repository.proto",
++ "service.proto",
++ "settings.proto",
++ "tag.proto",
++ "version.proto",
++ "yum_artifact.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "artifactregistry_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2",
++ proto = ":artifactregistry_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/devtools/build/v1/BUILD.bazel d/google/devtools/build/v1/BUILD.bazel
+--- c/google/devtools/build/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/build/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "build_proto",
++ srcs = [
++ "build_events.proto",
++ "build_status.proto",
++ "publish_build_event.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "build_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/build/v1",
++ proto = ":build_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/devtools/cloudbuild/v1/BUILD.bazel d/google/devtools/cloudbuild/v1/BUILD.bazel
+--- c/google/devtools/cloudbuild/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/cloudbuild/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "cloudbuild_proto",
++ srcs = ["cloudbuild.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:httpbody_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "cloudbuild_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1",
++ proto = ":cloudbuild_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:httpbody_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/devtools/clouddebugger/v2/BUILD.bazel d/google/devtools/clouddebugger/v2/BUILD.bazel
+--- c/google/devtools/clouddebugger/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/clouddebugger/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "clouddebugger_proto",
++ srcs = [
++ "controller.proto",
++ "data.proto",
++ "debugger.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/devtools/source/v1:source_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "clouddebugger_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2",
++ proto = ":clouddebugger_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/devtools/source/v1:source_go_proto",
++ ],
++)
+diff -urN c/google/devtools/clouderrorreporting/v1beta1/BUILD.bazel d/google/devtools/clouderrorreporting/v1beta1/BUILD.bazel
+--- c/google/devtools/clouderrorreporting/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/clouderrorreporting/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "clouderrorreporting_proto",
++ srcs = [
++ "common.proto",
++ "error_group_service.proto",
++ "error_stats_service.proto",
++ "report_errors_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "clouderrorreporting_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1",
++ proto = ":clouderrorreporting_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/devtools/cloudprofiler/v2/BUILD.bazel d/google/devtools/cloudprofiler/v2/BUILD.bazel
+--- c/google/devtools/cloudprofiler/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/cloudprofiler/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "cloudprofiler_proto",
++ srcs = ["profiler.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "cloudprofiler_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/cloudprofiler/v2",
++ proto = ":cloudprofiler_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/devtools/cloudtrace/v1/BUILD.bazel d/google/devtools/cloudtrace/v1/BUILD.bazel
+--- c/google/devtools/cloudtrace/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/cloudtrace/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "cloudtrace_proto",
++ srcs = ["trace.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "cloudtrace_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/cloudtrace/v1",
++ proto = ":cloudtrace_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/devtools/cloudtrace/v2/BUILD.bazel d/google/devtools/cloudtrace/v2/BUILD.bazel
+--- c/google/devtools/cloudtrace/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/cloudtrace/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "cloudtrace_proto",
++ srcs = [
++ "trace.proto",
++ "tracing.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "cloudtrace_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/cloudtrace/v2",
++ proto = ":cloudtrace_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/devtools/containeranalysis/v1/BUILD.bazel d/google/devtools/containeranalysis/v1/BUILD.bazel
+--- c/google/devtools/containeranalysis/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/containeranalysis/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "containeranalysis_proto",
++ srcs = ["containeranalysis.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//grafeas/v1:grafeas_proto",
++ ],
++)
++
++go_proto_library(
++ name = "containeranalysis_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1",
++ proto = ":containeranalysis_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//grafeas/v1:grafeas_go_proto",
++ ],
++)
+diff -urN c/google/devtools/containeranalysis/v1beta1/BUILD.bazel d/google/devtools/containeranalysis/v1beta1/BUILD.bazel
+--- c/google/devtools/containeranalysis/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/containeranalysis/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "containeranalysis_proto",
++ srcs = ["containeranalysis.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "containeranalysis_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1",
++ proto = ":containeranalysis_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/devtools/containeranalysis/v1beta1/attestation/BUILD.bazel d/google/devtools/containeranalysis/v1beta1/attestation/BUILD.bazel
+--- c/google/devtools/containeranalysis/v1beta1/attestation/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/containeranalysis/v1beta1/attestation/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "attestation_proto",
++ srcs = ["attestation.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/devtools/containeranalysis/v1beta1/common:common_proto"],
++)
++
++go_proto_library(
++ name = "attestation_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/attestation",
++ proto = ":attestation_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/devtools/containeranalysis/v1beta1/common:common_go_proto"],
++)
+diff -urN c/google/devtools/containeranalysis/v1beta1/build/BUILD.bazel d/google/devtools/containeranalysis/v1beta1/build/BUILD.bazel
+--- c/google/devtools/containeranalysis/v1beta1/build/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/containeranalysis/v1beta1/build/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "build_proto",
++ srcs = ["build.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/devtools/containeranalysis/v1beta1/provenance:provenance_proto"],
++)
++
++go_proto_library(
++ name = "build_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/build",
++ proto = ":build_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/devtools/containeranalysis/v1beta1/provenance:provenance_go_proto"],
++)
+diff -urN c/google/devtools/containeranalysis/v1beta1/common/BUILD.bazel d/google/devtools/containeranalysis/v1beta1/common/BUILD.bazel
+--- c/google/devtools/containeranalysis/v1beta1/common/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/containeranalysis/v1beta1/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "common_proto",
++ srcs = ["common.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "common_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/common",
++ proto = ":common_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/devtools/containeranalysis/v1beta1/cvss/BUILD.bazel d/google/devtools/containeranalysis/v1beta1/cvss/BUILD.bazel
+--- c/google/devtools/containeranalysis/v1beta1/cvss/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/containeranalysis/v1beta1/cvss/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "cvss_proto",
++ srcs = ["cvss.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "cvss_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/cvss",
++ proto = ":cvss_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/devtools/containeranalysis/v1beta1/deployment/BUILD.bazel d/google/devtools/containeranalysis/v1beta1/deployment/BUILD.bazel
+--- c/google/devtools/containeranalysis/v1beta1/deployment/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/containeranalysis/v1beta1/deployment/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,16 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "deployment_proto",
++ srcs = ["deployment.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:timestamp_proto"],
++)
++
++go_proto_library(
++ name = "deployment_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/deployment",
++ proto = ":deployment_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/devtools/containeranalysis/v1beta1/discovery/BUILD.bazel d/google/devtools/containeranalysis/v1beta1/discovery/BUILD.bazel
+--- c/google/devtools/containeranalysis/v1beta1/discovery/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/containeranalysis/v1beta1/discovery/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "discovery_proto",
++ srcs = ["discovery.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/devtools/containeranalysis/v1beta1/common:common_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "discovery_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/discovery",
++ proto = ":discovery_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/devtools/containeranalysis/v1beta1/common:common_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/devtools/containeranalysis/v1beta1/grafeas/BUILD.bazel d/google/devtools/containeranalysis/v1beta1/grafeas/BUILD.bazel
+--- c/google/devtools/containeranalysis/v1beta1/grafeas/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/containeranalysis/v1beta1/grafeas/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,43 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "grafeas_proto",
++ srcs = ["grafeas.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/devtools/containeranalysis/v1beta1/attestation:attestation_proto",
++ "//google/devtools/containeranalysis/v1beta1/build:build_proto",
++ "//google/devtools/containeranalysis/v1beta1/common:common_proto",
++ "//google/devtools/containeranalysis/v1beta1/deployment:deployment_proto",
++ "//google/devtools/containeranalysis/v1beta1/discovery:discovery_proto",
++ "//google/devtools/containeranalysis/v1beta1/image:image_proto",
++ "//google/devtools/containeranalysis/v1beta1/package:package_proto",
++ "//google/devtools/containeranalysis/v1beta1/provenance:provenance_proto",
++ "//google/devtools/containeranalysis/v1beta1/vulnerability:vulnerability_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "grafeas_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas",
++ proto = ":grafeas_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/devtools/containeranalysis/v1beta1/attestation:attestation_go_proto",
++ "//google/devtools/containeranalysis/v1beta1/build:build_go_proto",
++ "//google/devtools/containeranalysis/v1beta1/common:common_go_proto",
++ "//google/devtools/containeranalysis/v1beta1/deployment:deployment_go_proto",
++ "//google/devtools/containeranalysis/v1beta1/discovery:discovery_go_proto",
++ "//google/devtools/containeranalysis/v1beta1/image:image_go_proto",
++ "//google/devtools/containeranalysis/v1beta1/package:package_go_proto",
++ "//google/devtools/containeranalysis/v1beta1/provenance:provenance_go_proto",
++ "//google/devtools/containeranalysis/v1beta1/vulnerability:vulnerability_go_proto",
++ ],
++)
+diff -urN c/google/devtools/containeranalysis/v1beta1/image/BUILD.bazel d/google/devtools/containeranalysis/v1beta1/image/BUILD.bazel
+--- c/google/devtools/containeranalysis/v1beta1/image/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/containeranalysis/v1beta1/image/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "image_proto",
++ srcs = ["image.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "image_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/image",
++ proto = ":image_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/devtools/containeranalysis/v1beta1/package/BUILD.bazel d/google/devtools/containeranalysis/v1beta1/package/BUILD.bazel
+--- c/google/devtools/containeranalysis/v1beta1/package/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/containeranalysis/v1beta1/package/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "package_proto",
++ srcs = ["package.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "package_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/package",
++ proto = ":package_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/devtools/containeranalysis/v1beta1/provenance/BUILD.bazel d/google/devtools/containeranalysis/v1beta1/provenance/BUILD.bazel
+--- c/google/devtools/containeranalysis/v1beta1/provenance/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/containeranalysis/v1beta1/provenance/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "provenance_proto",
++ srcs = ["provenance.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/devtools/containeranalysis/v1beta1/source:source_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "provenance_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/provenance",
++ proto = ":provenance_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/devtools/containeranalysis/v1beta1/source:source_go_proto"],
++)
+diff -urN c/google/devtools/containeranalysis/v1beta1/source/BUILD.bazel d/google/devtools/containeranalysis/v1beta1/source/BUILD.bazel
+--- c/google/devtools/containeranalysis/v1beta1/source/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/containeranalysis/v1beta1/source/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "source_proto",
++ srcs = ["source.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "source_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/source",
++ proto = ":source_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/devtools/containeranalysis/v1beta1/vulnerability/BUILD.bazel d/google/devtools/containeranalysis/v1beta1/vulnerability/BUILD.bazel
+--- c/google/devtools/containeranalysis/v1beta1/vulnerability/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/containeranalysis/v1beta1/vulnerability/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "vulnerability_proto",
++ srcs = ["vulnerability.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/devtools/containeranalysis/v1beta1/common:common_proto",
++ "//google/devtools/containeranalysis/v1beta1/cvss:cvss_proto",
++ "//google/devtools/containeranalysis/v1beta1/package:package_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "vulnerability_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/vulnerability",
++ proto = ":vulnerability_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/devtools/containeranalysis/v1beta1/common:common_go_proto",
++ "//google/devtools/containeranalysis/v1beta1/cvss:cvss_go_proto",
++ "//google/devtools/containeranalysis/v1beta1/package:package_go_proto",
++ ],
++)
+diff -urN c/google/devtools/remoteworkers/v1test2/BUILD.bazel d/google/devtools/remoteworkers/v1test2/BUILD.bazel
+--- c/google/devtools/remoteworkers/v1test2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/remoteworkers/v1test2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "remoteworkers_proto",
++ srcs = [
++ "bots.proto",
++ "command.proto",
++ "worker.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "remoteworkers_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/remoteworkers/v1test2",
++ proto = ":remoteworkers_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/devtools/resultstore/v2/BUILD.bazel d/google/devtools/resultstore/v2/BUILD.bazel
+--- c/google/devtools/resultstore/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/resultstore/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,43 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "resultstore_proto",
++ srcs = [
++ "action.proto",
++ "common.proto",
++ "configuration.proto",
++ "configured_target.proto",
++ "coverage.proto",
++ "coverage_summary.proto",
++ "download_metadata.proto",
++ "file.proto",
++ "file_processing_error.proto",
++ "file_set.proto",
++ "invocation.proto",
++ "resultstore_download.proto",
++ "resultstore_file_download.proto",
++ "resultstore_upload.proto",
++ "target.proto",
++ "test_suite.proto",
++ "upload_metadata.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "resultstore_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/resultstore/v2",
++ proto = ":resultstore_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/devtools/source/v1/BUILD.bazel d/google/devtools/source/v1/BUILD.bazel
+--- c/google/devtools/source/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/source/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "source_proto",
++ srcs = ["source_context.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "source_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/devtools/source/v1",
++ proto = ":source_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/devtools/sourcerepo/v1/BUILD.bazel d/google/devtools/sourcerepo/v1/BUILD.bazel
+--- c/google/devtools/sourcerepo/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/sourcerepo/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "sourcerepo_proto",
++ srcs = ["sourcerepo.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:empty_proto",
++ ],
++)
++
++go_proto_library(
++ name = "sourcerepo_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/sourcerepo/v1",
++ proto = ":sourcerepo_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/devtools/testing/v1/BUILD.bazel d/google/devtools/testing/v1/BUILD.bazel
+--- c/google/devtools/testing/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/devtools/testing/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "testing_proto",
++ srcs = [
++ "application_details.proto",
++ "test_environment_discovery.proto",
++ "test_execution.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:date_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "testing_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/testing/v1",
++ proto = ":testing_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:date_go_proto",
++ ],
++)
+diff -urN c/google/example/endpointsapis/v1/BUILD.bazel d/google/example/endpointsapis/v1/BUILD.bazel
+--- c/google/example/endpointsapis/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/example/endpointsapis/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "v1_proto",
++ srcs = ["workspace.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ ],
++)
++
++go_proto_library(
++ name = "v1_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/example/endpointsapis/v1",
++ proto = ":v1_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/example/library/v1/BUILD.bazel d/google/example/library/v1/BUILD.bazel
+--- c/google/example/library/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/example/library/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "library_proto",
++ srcs = ["library.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "library_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/example/library/v1",
++ proto = ":library_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/firebase/fcm/connection/v1alpha1/BUILD.bazel d/google/firebase/fcm/connection/v1alpha1/BUILD.bazel
+--- c/google/firebase/fcm/connection/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/firebase/fcm/connection/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "connection_proto",
++ srcs = ["connection_api.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "connection_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/firebase/fcm/connection/v1alpha1",
++ proto = ":connection_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/firestore/admin/v1/BUILD.bazel d/google/firestore/admin/v1/BUILD.bazel
+--- c/google/firestore/admin/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/firestore/admin/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "admin_proto",
++ srcs = [
++ "database.proto",
++ "field.proto",
++ "firestore_admin.proto",
++ "index.proto",
++ "location.proto",
++ "operation.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "admin_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/firestore/admin/v1",
++ proto = ":admin_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/firestore/admin/v1beta1/BUILD.bazel d/google/firestore/admin/v1beta1/BUILD.bazel
+--- c/google/firestore/admin/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/firestore/admin/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "admin_proto",
++ srcs = [
++ "firestore_admin.proto",
++ "index.proto",
++ "location.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "admin_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/firestore/admin/v1beta1",
++ proto = ":admin_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/firestore/admin/v1beta2/BUILD.bazel d/google/firestore/admin/v1beta2/BUILD.bazel
+--- c/google/firestore/admin/v1beta2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/firestore/admin/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "admin_proto",
++ srcs = [
++ "field.proto",
++ "firestore_admin.proto",
++ "index.proto",
++ "operation.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "admin_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/firestore/admin/v1beta2",
++ proto = ":admin_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/firestore/bundle/BUILD.bazel d/google/firestore/bundle/BUILD.bazel
+--- c/google/firestore/bundle/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/firestore/bundle/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "firestore_proto",
++ srcs = ["bundle.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/firestore/v1:firestore_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "firestore_go_proto",
++ importpath = "google.golang.org/genproto/firestore/bundle",
++ proto = ":firestore_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/firestore/v1:firestore_go_proto"],
++)
+diff -urN c/google/firestore/v1/BUILD.bazel d/google/firestore/v1/BUILD.bazel
+--- c/google/firestore/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/firestore/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "firestore_proto",
++ srcs = [
++ "aggregation_result.proto",
++ "common.proto",
++ "document.proto",
++ "firestore.proto",
++ "query.proto",
++ "write.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "firestore_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/firestore/v1",
++ proto = ":firestore_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/firestore/v1beta1/BUILD.bazel d/google/firestore/v1beta1/BUILD.bazel
+--- c/google/firestore/v1beta1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/firestore/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "firestore_proto",
++ srcs = [
++ "common.proto",
++ "document.proto",
++ "firestore.proto",
++ "query.proto",
++ "write.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "firestore_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/firestore/v1beta1",
++ proto = ":firestore_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/genomics/v1/BUILD.bazel d/google/genomics/v1/BUILD.bazel
+--- c/google/genomics/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/genomics/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,47 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "genomics_proto",
++ srcs = [
++ "annotations.proto",
++ "cigar.proto",
++ "datasets.proto",
++ "operations.proto",
++ "position.proto",
++ "range.proto",
++ "readalignment.proto",
++ "readgroup.proto",
++ "readgroupset.proto",
++ "reads.proto",
++ "references.proto",
++ "variants.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "genomics_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/genomics/v1",
++ proto = ":genomics_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/genomics/v1alpha2/BUILD.bazel d/google/genomics/v1alpha2/BUILD.bazel
+--- c/google/genomics/v1alpha2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/genomics/v1alpha2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "genomics_proto",
++ srcs = ["pipelines.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:code_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "genomics_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/genomics/v1alpha2",
++ proto = ":genomics_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:code_go_proto",
++ ],
++)
+diff -urN c/google/geo/type/BUILD.bazel d/google/geo/type/BUILD.bazel
+--- c/google/geo/type/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/geo/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "viewport_proto",
++ srcs = ["viewport.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/type:latlng_proto"],
++)
++
++go_proto_library(
++ name = "viewport_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/geo/type/viewport",
++ proto = ":viewport_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/type:latlng_go_proto"],
++)
+diff -urN c/google/home/enterprise/sdm/v1/BUILD.bazel d/google/home/enterprise/sdm/v1/BUILD.bazel
+--- c/google/home/enterprise/sdm/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/home/enterprise/sdm/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "sdm_proto",
++ srcs = [
++ "device.proto",
++ "site.proto",
++ "smart_device_management_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++go_proto_library(
++ name = "sdm_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/home/enterprise/sdm/v1",
++ proto = ":sdm_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/home/graph/v1/BUILD.bazel d/google/home/graph/v1/BUILD.bazel
+--- c/google/home/graph/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/home/graph/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "graph_proto",
++ srcs = [
++ "device.proto",
++ "homegraph.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:struct_proto",
++ ],
++)
++
++go_proto_library(
++ name = "graph_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/home/graph/v1",
++ proto = ":graph_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/iam/admin/v1/BUILD.bazel d/google/iam/admin/v1/BUILD.bazel
+--- c/google/iam/admin/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/iam/admin/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "admin_proto",
++ srcs = [
++ "audit_data.proto",
++ "iam.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/type:expr_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "admin_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/iam/admin/v1",
++ proto = ":admin_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/type:expr_go_proto",
++ ],
++)
+diff -urN c/google/iam/credentials/v1/BUILD.bazel d/google/iam/credentials/v1/BUILD.bazel
+--- c/google/iam/credentials/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/iam/credentials/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "credentials_proto",
++ srcs = [
++ "common.proto",
++ "iamcredentials.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "credentials_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/iam/credentials/v1",
++ proto = ":credentials_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/iam/v1/BUILD.bazel d/google/iam/v1/BUILD.bazel
+--- c/google/iam/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/iam/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "iam_proto",
++ srcs = [
++ "iam_policy.proto",
++ "options.proto",
++ "policy.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:expr_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "iam_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/iam/v1",
++ proto = ":iam_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:expr_go_proto",
++ ],
++)
+diff -urN c/google/iam/v1/logging/BUILD.bazel d/google/iam/v1/logging/BUILD.bazel
+--- c/google/iam/v1/logging/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/iam/v1/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["audit_data.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["//google/iam/v1:iam_proto"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/iam/v1/logging",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/iam/v1:iam_go_proto"],
++)
+diff -urN c/google/iam/v1beta/BUILD.bazel d/google/iam/v1beta/BUILD.bazel
+--- c/google/iam/v1beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/iam/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "iam_proto",
++ srcs = ["workload_identity_pool.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "iam_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/iam/v1beta",
++ proto = ":iam_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/iam/v2/BUILD.bazel d/google/iam/v2/BUILD.bazel
+--- c/google/iam/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/iam/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "iam_proto",
++ srcs = [
++ "deny.proto",
++ "policy.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:expr_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "iam_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/iam/v2",
++ proto = ":iam_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:expr_go_proto",
++ ],
++)
+diff -urN c/google/iam/v2beta/BUILD.bazel d/google/iam/v2beta/BUILD.bazel
+--- c/google/iam/v2beta/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/iam/v2beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "iam_proto",
++ srcs = [
++ "deny.proto",
++ "policy.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:expr_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "iam_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/iam/v2beta",
++ proto = ":iam_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:expr_go_proto",
++ ],
++)
+diff -urN c/google/identity/accesscontextmanager/type/BUILD.bazel d/google/identity/accesscontextmanager/type/BUILD.bazel
+--- c/google/identity/accesscontextmanager/type/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/identity/accesscontextmanager/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "type_proto",
++ srcs = ["device_resources.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "type_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/type",
++ proto = ":type_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/identity/accesscontextmanager/v1/BUILD.bazel d/google/identity/accesscontextmanager/v1/BUILD.bazel
+--- c/google/identity/accesscontextmanager/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/identity/accesscontextmanager/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "accesscontextmanager_proto",
++ srcs = [
++ "access_context_manager.proto",
++ "access_level.proto",
++ "access_policy.proto",
++ "gcp_user_access_binding.proto",
++ "service_perimeter.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/identity/accesscontextmanager/type:type_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/type:expr_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "accesscontextmanager_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/v1",
++ proto = ":accesscontextmanager_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/identity/accesscontextmanager/type:type_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/type:expr_go_proto",
++ ],
++)
+diff -urN c/google/logging/type/BUILD.bazel d/google/logging/type/BUILD.bazel
+--- c/google/logging/type/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/logging/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "ltype_proto",
++ srcs = [
++ "http_request.proto",
++ "log_severity.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:duration_proto"],
++)
++
++go_proto_library(
++ name = "ltype_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/logging/type",
++ proto = ":ltype_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/logging/v2/BUILD.bazel d/google/logging/v2/BUILD.bazel
+--- c/google/logging/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/logging/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,45 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = [
++ "log_entry.proto",
++ "logging.proto",
++ "logging_config.proto",
++ "logging_metrics.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:distribution_proto",
++ "//google/api:metric_proto",
++ "//google/api:monitoredres_proto",
++ "//google/logging/type:ltype_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/logging/v2",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:distribution_go_proto",
++ "//google/api:metric_go_proto",
++ "//google/api:monitoredres_go_proto",
++ "//google/logging/type:ltype_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/longrunning/BUILD.bazel d/google/longrunning/BUILD.bazel
+--- c/google/longrunning/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/longrunning/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "longrunning_proto",
++ srcs = ["operations.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:descriptor_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ ],
++)
++
++go_proto_library(
++ name = "longrunning_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/longrunning",
++ proto = ":longrunning_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/maps/addressvalidation/v1/BUILD.bazel d/google/maps/addressvalidation/v1/BUILD.bazel
+--- c/google/maps/addressvalidation/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/maps/addressvalidation/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "addressvalidation_proto",
++ srcs = [
++ "address.proto",
++ "address_validation_service.proto",
++ "geocode.proto",
++ "metadata.proto",
++ "usps_data.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/geo/type:viewport_proto",
++ "//google/type:latlng_proto",
++ "//google/type:postaladdress_proto",
++ ],
++)
++
++go_proto_library(
++ name = "addressvalidation_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/maps/addressvalidation/v1",
++ proto = ":addressvalidation_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/geo/type:viewport_go_proto",
++ "//google/type:latlng_go_proto",
++ "//google/type:postaladdress_go_proto",
++ ],
++)
+diff -urN c/google/maps/fleetengine/delivery/v1/BUILD.bazel d/google/maps/fleetengine/delivery/v1/BUILD.bazel
+--- c/google/maps/fleetengine/delivery/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/maps/fleetengine/delivery/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "delivery_proto",
++ srcs = [
++ "common.proto",
++ "delivery_api.proto",
++ "delivery_vehicles.proto",
++ "header.proto",
++ "tasks.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/geo/type:viewport_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "delivery_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/maps/fleetengine/delivery/v1",
++ proto = ":delivery_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/geo/type:viewport_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/maps/fleetengine/v1/BUILD.bazel d/google/maps/fleetengine/v1/BUILD.bazel
+--- c/google/maps/fleetengine/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/maps/fleetengine/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "fleetengine_proto",
++ srcs = [
++ "fleetengine.proto",
++ "header.proto",
++ "traffic.proto",
++ "trip_api.proto",
++ "trips.proto",
++ "vehicle_api.proto",
++ "vehicles.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "fleetengine_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/maps/fleetengine/v1",
++ proto = ":fleetengine_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/maps/mapsplatformdatasets/v1alpha/BUILD.bazel d/google/maps/mapsplatformdatasets/v1alpha/BUILD.bazel
+--- c/google/maps/mapsplatformdatasets/v1alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/maps/mapsplatformdatasets/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "mapsplatformdatasets_proto",
++ srcs = [
++ "data_source.proto",
++ "dataset.proto",
++ "maps_platform_datasets.proto",
++ "maps_platform_datasets_alpha_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "mapsplatformdatasets_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/maps/mapsplatformdatasets/v1alpha",
++ proto = ":mapsplatformdatasets_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/maps/playablelocations/v3/BUILD.bazel d/google/maps/playablelocations/v3/BUILD.bazel
+--- c/google/maps/playablelocations/v3/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/maps/playablelocations/v3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "playablelocations_proto",
++ srcs = [
++ "playablelocations.proto",
++ "resources.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/maps/playablelocations/v3/sample:sample_proto",
++ "//google/maps/unity:unity_proto",
++ "@com_google_protobuf//:duration_proto",
++ ],
++)
++
++go_proto_library(
++ name = "playablelocations_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/maps/playablelocations/v3",
++ proto = ":playablelocations_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/maps/playablelocations/v3/sample:sample_go_proto",
++ "//google/maps/unity:unity_go_proto",
++ ],
++)
+diff -urN c/google/maps/playablelocations/v3/sample/BUILD.bazel d/google/maps/playablelocations/v3/sample/BUILD.bazel
+--- c/google/maps/playablelocations/v3/sample/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/maps/playablelocations/v3/sample/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "sample_proto",
++ srcs = ["resources.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ ],
++)
++
++go_proto_library(
++ name = "sample_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/maps/playablelocations/v3/sample",
++ proto = ":sample_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/maps/regionlookup/v1alpha/BUILD.bazel d/google/maps/regionlookup/v1alpha/BUILD.bazel
+--- c/google/maps/regionlookup/v1alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/maps/regionlookup/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "regionlookup_proto",
++ srcs = [
++ "region_identifier.proto",
++ "region_lookup_service.proto",
++ "region_match.proto",
++ "region_search_values.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:latlng_proto",
++ ],
++)
++
++go_proto_library(
++ name = "regionlookup_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/maps/regionlookup/v1alpha",
++ proto = ":regionlookup_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/maps/roads/v1op/BUILD.bazel d/google/maps/roads/v1op/BUILD.bazel
+--- c/google/maps/roads/v1op/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/maps/roads/v1op/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "roads_proto",
++ srcs = ["roads.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "roads_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/maps/roads/v1op",
++ proto = ":roads_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/maps/routes/v1/BUILD.bazel d/google/maps/routes/v1/BUILD.bazel
+--- c/google/maps/routes/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/maps/routes/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,49 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "routes_proto",
++ srcs = [
++ "compute_custom_routes_request.proto",
++ "compute_custom_routes_response.proto",
++ "compute_route_matrix_request.proto",
++ "compute_routes_request.proto",
++ "compute_routes_response.proto",
++ "custom_route.proto",
++ "fallback_info.proto",
++ "polyline.proto",
++ "route.proto",
++ "route_matrix_element.proto",
++ "route_service.proto",
++ "toll_passes.proto",
++ "vehicle_emission_type.proto",
++ "waypoint.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/geo/type:viewport_proto",
++ "//google/rpc:status_proto",
++ "//google/type:latlng_proto",
++ "//google/type:money_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "routes_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/maps/routes/v1",
++ proto = ":routes_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/geo/type:viewport_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:latlng_go_proto",
++ "//google/type:money_go_proto",
++ ],
++)
+diff -urN c/google/maps/routes/v1alpha/BUILD.bazel d/google/maps/routes/v1alpha/BUILD.bazel
+--- c/google/maps/routes/v1alpha/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/maps/routes/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "routes_proto",
++ srcs = ["route_service.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/maps/routes/v1:routes_proto",
++ ],
++)
++
++go_proto_library(
++ name = "routes_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/maps/routes/v1alpha",
++ proto = ":routes_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/maps/routes/v1:routes_go_proto",
++ ],
++)
+diff -urN c/google/maps/routing/v2/BUILD.bazel d/google/maps/routing/v2/BUILD.bazel
+--- c/google/maps/routing/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/maps/routing/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,53 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "routing_proto",
++ srcs = [
++ "fallback_info.proto",
++ "location.proto",
++ "maneuver.proto",
++ "navigation_instruction.proto",
++ "polyline.proto",
++ "route.proto",
++ "route_label.proto",
++ "route_modifiers.proto",
++ "route_travel_mode.proto",
++ "routes_service.proto",
++ "routing_preference.proto",
++ "speed_reading_interval.proto",
++ "toll_info.proto",
++ "toll_passes.proto",
++ "units.proto",
++ "vehicle_emission_type.proto",
++ "vehicle_info.proto",
++ "waypoint.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/geo/type:viewport_proto",
++ "//google/rpc:status_proto",
++ "//google/type:latlng_proto",
++ "//google/type:money_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "routing_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/maps/routing/v2",
++ proto = ":routing_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/geo/type:viewport_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:latlng_go_proto",
++ "//google/type:money_go_proto",
++ ],
++)
+diff -urN c/google/maps/unity/BUILD.bazel d/google/maps/unity/BUILD.bazel
+--- c/google/maps/unity/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/maps/unity/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "unity_proto",
++ srcs = ["clientinfo.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "unity_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/maps/unity",
++ proto = ":unity_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/monitoring/dashboard/v1/BUILD.bazel d/google/monitoring/dashboard/v1/BUILD.bazel
+--- c/google/monitoring/dashboard/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/monitoring/dashboard/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "dashboard_proto",
++ srcs = [
++ "alertchart.proto",
++ "collapsible_group.proto",
++ "common.proto",
++ "dashboard.proto",
++ "dashboard_filter.proto",
++ "dashboards_service.proto",
++ "drilldowns.proto",
++ "layouts.proto",
++ "logs_panel.proto",
++ "metrics.proto",
++ "scorecard.proto",
++ "service.proto",
++ "table.proto",
++ "table_display_options.proto",
++ "text.proto",
++ "widget.proto",
++ "xychart.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ ],
++)
++
++go_proto_library(
++ name = "dashboard_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/monitoring/dashboard/v1",
++ proto = ":dashboard_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/monitoring/metricsscope/v1/BUILD.bazel d/google/monitoring/metricsscope/v1/BUILD.bazel
+--- c/google/monitoring/metricsscope/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/monitoring/metricsscope/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "metricsscope_proto",
++ srcs = [
++ "metrics_scope.proto",
++ "metrics_scopes.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "metricsscope_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/monitoring/metricsscope/v1",
++ proto = ":metricsscope_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/monitoring/v3/BUILD.bazel d/google/monitoring/v3/BUILD.bazel
+--- c/google/monitoring/v3/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/monitoring/v3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,59 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "monitoring_proto",
++ srcs = [
++ "alert.proto",
++ "alert_service.proto",
++ "common.proto",
++ "dropped_labels.proto",
++ "group.proto",
++ "group_service.proto",
++ "metric.proto",
++ "metric_service.proto",
++ "mutation_record.proto",
++ "notification.proto",
++ "notification_service.proto",
++ "query_service.proto",
++ "service.proto",
++ "service_service.proto",
++ "span_context.proto",
++ "uptime.proto",
++ "uptime_service.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/api:api_proto",
++ "//google/api:distribution_proto",
++ "//google/api:label_proto",
++ "//google/api:metric_proto",
++ "//google/api:monitoredres_proto",
++ "//google/rpc:status_proto",
++ "//google/type:calendarperiod_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "monitoring_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/monitoring/v3",
++ proto = ":monitoring_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/api:api_go_proto",
++ "//google/api:distribution_go_proto",
++ "//google/api:label_go_proto",
++ "//google/api:metric_go_proto",
++ "//google/api:monitoredres_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:calendarperiod_go_proto",
++ ],
++)
+diff -urN c/google/networking/trafficdirector/type/BUILD.bazel d/google/networking/trafficdirector/type/BUILD.bazel
+--- c/google/networking/trafficdirector/type/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/networking/trafficdirector/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "type_proto",
++ srcs = ["traffic_director_log_entry.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "type_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/networking/trafficdirector/type",
++ proto = ":type_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/partner/aistreams/v1alpha1/BUILD.bazel d/google/partner/aistreams/v1alpha1/BUILD.bazel
+--- c/google/partner/aistreams/v1alpha1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/partner/aistreams/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "aistreams_proto",
++ srcs = ["aistreams.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "aistreams_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/partner/aistreams/v1alpha1",
++ proto = ":aistreams_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/privacy/dlp/v2/BUILD.bazel d/google/privacy/dlp/v2/BUILD.bazel
+--- c/google/privacy/dlp/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/privacy/dlp/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "dlp_proto",
++ srcs = [
++ "dlp.proto",
++ "storage.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "//google/type:date_proto",
++ "//google/type:dayofweek_proto",
++ "//google/type:timeofday_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "dlp_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/privacy/dlp/v2",
++ proto = ":dlp_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:date_go_proto",
++ "//google/type:dayofweek_go_proto",
++ "//google/type:timeofday_go_proto",
++ ],
++)
+diff -urN c/google/pubsub/v1/BUILD.bazel d/google/pubsub/v1/BUILD.bazel
+--- c/google/pubsub/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/pubsub/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "pubsub_proto",
++ srcs = [
++ "pubsub.proto",
++ "schema.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "pubsub_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/pubsub/v1",
++ proto = ":pubsub_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/pubsub/v1beta2/BUILD.bazel d/google/pubsub/v1beta2/BUILD.bazel
+--- c/google/pubsub/v1beta2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/pubsub/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "pubsub_proto",
++ srcs = ["pubsub.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:empty_proto"],
++)
++
++go_proto_library(
++ name = "pubsub_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/pubsub/v1beta2",
++ proto = ":pubsub_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/rpc/BUILD.bazel d/google/rpc/BUILD.bazel
+--- c/google/rpc/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/rpc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,43 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "code_proto",
++ srcs = ["code.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "errdetails_proto",
++ srcs = ["error_details.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:duration_proto"],
++)
++
++proto_library(
++ name = "status_proto",
++ srcs = ["status.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:any_proto"],
++)
++
++go_proto_library(
++ name = "code_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/rpc/code",
++ proto = ":code_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "errdetails_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/rpc/errdetails",
++ proto = ":errdetails_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "status_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/rpc/status",
++ proto = ":status_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/rpc/context/BUILD.bazel d/google/rpc/context/BUILD.bazel
+--- c/google/rpc/context/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/rpc/context/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "attribute_context_proto",
++ srcs = ["attribute_context.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "attribute_context_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/rpc/context/attribute_context",
++ proto = ":attribute_context_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/search/partnerdataingestion/logging/v1/BUILD.bazel d/google/search/partnerdataingestion/logging/v1/BUILD.bazel
+--- c/google/search/partnerdataingestion/logging/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/search/partnerdataingestion/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["platformlog.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/search/partnerdataingestion/logging/v1",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/spanner/admin/database/v1/BUILD.bazel d/google/spanner/admin/database/v1/BUILD.bazel
+--- c/google/spanner/admin/database/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/spanner/admin/database/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "database_proto",
++ srcs = [
++ "backup.proto",
++ "common.proto",
++ "spanner_database_admin.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "database_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/spanner/admin/database/v1",
++ proto = ":database_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/spanner/admin/instance/v1/BUILD.bazel d/google/spanner/admin/instance/v1/BUILD.bazel
+--- c/google/spanner/admin/instance/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/spanner/admin/instance/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "instance_proto",
++ srcs = [
++ "common.proto",
++ "spanner_instance_admin.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/longrunning:longrunning_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "instance_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/spanner/admin/instance/v1",
++ proto = ":instance_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ ],
++)
+diff -urN c/google/spanner/v1/BUILD.bazel d/google/spanner/v1/BUILD.bazel
+--- c/google/spanner/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/spanner/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "spanner_proto",
++ srcs = [
++ "commit_response.proto",
++ "keys.proto",
++ "mutation.proto",
++ "query_plan.proto",
++ "result_set.proto",
++ "spanner.proto",
++ "transaction.proto",
++ "type.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "spanner_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/spanner/v1",
++ proto = ":spanner_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
+diff -urN c/google/storage/v1/BUILD.bazel d/google/storage/v1/BUILD.bazel
+--- c/google/storage/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/storage/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "storage_proto",
++ srcs = [
++ "storage.proto",
++ "storage_resources.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ "@com_google_protobuf//:wrappers_proto",
++ ],
++)
++
++go_proto_library(
++ name = "storage_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/storage/v1",
++ proto = ":storage_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ ],
++)
+diff -urN c/google/storage/v2/BUILD.bazel d/google/storage/v2/BUILD.bazel
+--- c/google/storage/v2/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/storage/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "storage_proto",
++ srcs = ["storage.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/iam/v1:iam_proto",
++ "//google/type:date_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "storage_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/storage/v2",
++ proto = ":storage_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/iam/v1:iam_go_proto",
++ "//google/type:date_go_proto",
++ ],
++)
+diff -urN c/google/storagetransfer/logging/BUILD.bazel d/google/storagetransfer/logging/BUILD.bazel
+--- c/google/storagetransfer/logging/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/storagetransfer/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "logging_proto",
++ srcs = ["transfer_activity_log.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "logging_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/storagetransfer/logging",
++ proto = ":logging_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/google/storagetransfer/v1/BUILD.bazel d/google/storagetransfer/v1/BUILD.bazel
+--- c/google/storagetransfer/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/storagetransfer/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "storagetransfer_proto",
++ srcs = [
++ "transfer.proto",
++ "transfer_types.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:code_proto",
++ "//google/type:date_proto",
++ "//google/type:timeofday_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "storagetransfer_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/storagetransfer/v1",
++ proto = ":storagetransfer_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:code_go_proto",
++ "//google/type:date_go_proto",
++ "//google/type:timeofday_go_proto",
++ ],
++)
+diff -urN c/google/streetview/publish/v1/BUILD.bazel d/google/streetview/publish/v1/BUILD.bazel
+--- c/google/streetview/publish/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/streetview/publish/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "publish_proto",
++ srcs = [
++ "resources.proto",
++ "rpcmessages.proto",
++ "streetview_publish.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/longrunning:longrunning_proto",
++ "//google/rpc:status_proto",
++ "//google/type:latlng_proto",
++ "@com_google_protobuf//:duration_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "publish_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/streetview/publish/v1",
++ proto = ":publish_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/longrunning:longrunning_go_proto",
++ "//google/rpc:status_go_proto",
++ "//google/type:latlng_go_proto",
++ ],
++)
+diff -urN c/google/type/BUILD.bazel d/google/type/BUILD.bazel
+--- c/google/type/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,226 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "calendarperiod_proto",
++ srcs = ["calendar_period.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "color_proto",
++ srcs = ["color.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:wrappers_proto"],
++)
++
++proto_library(
++ name = "date_proto",
++ srcs = ["date.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "datetime_proto",
++ srcs = ["datetime.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:duration_proto"],
++)
++
++proto_library(
++ name = "dayofweek_proto",
++ srcs = ["dayofweek.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "decimal_proto",
++ srcs = ["decimal.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "expr_proto",
++ srcs = ["expr.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "fraction_proto",
++ srcs = ["fraction.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "interval_proto",
++ srcs = ["interval.proto"],
++ visibility = ["//visibility:public"],
++ deps = ["@com_google_protobuf//:timestamp_proto"],
++)
++
++proto_library(
++ name = "latlng_proto",
++ srcs = ["latlng.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "localized_text_proto",
++ srcs = ["localized_text.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "money_proto",
++ srcs = ["money.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "month_proto",
++ srcs = ["month.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "phone_number_proto",
++ srcs = ["phone_number.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "postaladdress_proto",
++ srcs = ["postal_address.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "quaternion_proto",
++ srcs = ["quaternion.proto"],
++ visibility = ["//visibility:public"],
++)
++
++proto_library(
++ name = "timeofday_proto",
++ srcs = ["timeofday.proto"],
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "calendarperiod_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/calendarperiod",
++ proto = ":calendarperiod_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "color_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/color",
++ proto = ":color_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "date_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/date",
++ proto = ":date_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "datetime_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/datetime",
++ proto = ":datetime_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "dayofweek_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/dayofweek",
++ proto = ":dayofweek_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "decimal_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/decimal",
++ proto = ":decimal_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "expr_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/expr",
++ proto = ":expr_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "fraction_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/fraction",
++ proto = ":fraction_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "interval_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/interval",
++ proto = ":interval_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "latlng_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/latlng",
++ proto = ":latlng_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "localized_text_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/localized_text",
++ proto = ":localized_text_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "money_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/money",
++ proto = ":money_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "month_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/month",
++ proto = ":month_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "phone_number_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/phone_number",
++ proto = ":phone_number_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "postaladdress_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/postaladdress",
++ proto = ":postaladdress_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "quaternion_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/quaternion",
++ proto = ":quaternion_proto",
++ visibility = ["//visibility:public"],
++)
++
++go_proto_library(
++ name = "timeofday_go_proto",
++ importpath = "google.golang.org/genproto/googleapis/type/timeofday",
++ proto = ":timeofday_proto",
++ visibility = ["//visibility:public"],
++)
+diff -urN c/google/watcher/v1/BUILD.bazel d/google/watcher/v1/BUILD.bazel
+--- c/google/watcher/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/google/watcher/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "watcher_proto",
++ srcs = ["watch.proto"],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:empty_proto",
++ ],
++)
++
++go_proto_library(
++ name = "watcher_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/watcher/v1",
++ proto = ":watcher_proto",
++ visibility = ["//visibility:public"],
++ deps = ["//google/api:annotations_go_proto"],
++)
+diff -urN c/grafeas/v1/BUILD.bazel d/grafeas/v1/BUILD.bazel
+--- c/grafeas/v1/BUILD.bazel 1969-12-31 16:00:00
++++ d/grafeas/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,49 @@
++load("@rules_proto//proto:defs.bzl", "proto_library")
++load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
++
++proto_library(
++ name = "grafeas_proto",
++ srcs = [
++ "attestation.proto",
++ "build.proto",
++ "common.proto",
++ "compliance.proto",
++ "cvss.proto",
++ "deployment.proto",
++ "discovery.proto",
++ "dsse_attestation.proto",
++ "grafeas.proto",
++ "image.proto",
++ "intoto_provenance.proto",
++ "intoto_statement.proto",
++ "package.proto",
++ "provenance.proto",
++ "severity.proto",
++ "slsa_provenance.proto",
++ "slsa_provenance_zero_two.proto",
++ "upgrade.proto",
++ "vulnerability.proto",
++ ],
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_proto",
++ "//google/rpc:status_proto",
++ "@com_google_protobuf//:any_proto",
++ "@com_google_protobuf//:empty_proto",
++ "@com_google_protobuf//:field_mask_proto",
++ "@com_google_protobuf//:struct_proto",
++ "@com_google_protobuf//:timestamp_proto",
++ ],
++)
++
++go_proto_library(
++ name = "grafeas_go_proto",
++ compilers = ["@io_bazel_rules_go//proto:go_grpc"],
++ importpath = "google.golang.org/genproto/googleapis/grafeas/v1",
++ proto = ":grafeas_proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//google/api:annotations_go_proto",
++ "//google/rpc:status_go_proto",
++ ],
++)
diff --git a/third_party/org_golang_google_genproto-gazelle.patch b/third_party/org_golang_google_genproto-gazelle.patch
new file mode 100644
index 00000000..3f2e625b
--- /dev/null
+++ b/third_party/org_golang_google_genproto-gazelle.patch
@@ -0,0 +1,12231 @@
+diff -urN a/firestore/bundle/BUILD.bazel b/firestore/bundle/BUILD.bazel
+--- a/firestore/bundle/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/firestore/bundle/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "bundle",
++ srcs = ["bundle.pb.go"],
++ importpath = "google.golang.org/genproto/firestore/bundle",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/firestore/v1:firestore",
++ "@com_github_golang_protobuf//proto:go_default_library",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":bundle",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/actions/sdk/v2/BUILD.bazel b/googleapis/actions/sdk/v2/BUILD.bazel
+--- a/googleapis/actions/sdk/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/actions/sdk/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,51 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "sdk",
++ srcs = [
++ "account_linking.pb.go",
++ "account_linking_secret.pb.go",
++ "action.pb.go",
++ "actions_sdk.pb.go",
++ "actions_testing.pb.go",
++ "config_file.pb.go",
++ "data_file.pb.go",
++ "event_logs.pb.go",
++ "files.pb.go",
++ "localized_settings.pb.go",
++ "manifest.pb.go",
++ "release_channel.pb.go",
++ "settings.pb.go",
++ "surface.pb.go",
++ "theme_customization.pb.go",
++ "validation_results.pb.go",
++ "version.pb.go",
++ "webhook.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/actions/sdk/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/actions/sdk/v2/conversation",
++ "//googleapis/actions/sdk/v2/interactionmodel",
++ "//googleapis/actions/sdk/v2/interactionmodel/prompt",
++ "//googleapis/actions/sdk/v2/interactionmodel/type",
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "//googleapis/type/latlng",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sdk",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/actions/sdk/v2/conversation/BUILD.bazel b/googleapis/actions/sdk/v2/conversation/BUILD.bazel
+--- a/googleapis/actions/sdk/v2/conversation/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/actions/sdk/v2/conversation/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "conversation",
++ srcs = [
++ "canvas.pb.go",
++ "card.pb.go",
++ "collection.pb.go",
++ "content.pb.go",
++ "image.pb.go",
++ "intent.pb.go",
++ "link.pb.go",
++ "list.pb.go",
++ "media.pb.go",
++ "prompt.pb.go",
++ "scene.pb.go",
++ "simple.pb.go",
++ "suggestion.pb.go",
++ "table.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/actions/sdk/v2/conversation",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":conversation",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/actions/sdk/v2/interactionmodel/BUILD.bazel b/googleapis/actions/sdk/v2/interactionmodel/BUILD.bazel
+--- a/googleapis/actions/sdk/v2/interactionmodel/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/actions/sdk/v2/interactionmodel/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "interactionmodel",
++ srcs = [
++ "conditional_event.pb.go",
++ "entity_set.pb.go",
++ "event_handler.pb.go",
++ "global_intent_event.pb.go",
++ "intent.pb.go",
++ "intent_event.pb.go",
++ "scene.pb.go",
++ "slot.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/actions/sdk/v2/interactionmodel",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/actions/sdk/v2/interactionmodel/prompt",
++ "//googleapis/actions/sdk/v2/interactionmodel/type",
++ "//googleapis/api/annotations",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":interactionmodel",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/actions/sdk/v2/interactionmodel/prompt/BUILD.bazel b/googleapis/actions/sdk/v2/interactionmodel/prompt/BUILD.bazel
+--- a/googleapis/actions/sdk/v2/interactionmodel/prompt/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/actions/sdk/v2/interactionmodel/prompt/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "prompt",
++ srcs = [
++ "static_canvas_prompt.pb.go",
++ "static_card_prompt.pb.go",
++ "static_collection_browse_prompt.pb.go",
++ "static_collection_prompt.pb.go",
++ "static_content_prompt.pb.go",
++ "static_image_prompt.pb.go",
++ "static_link_prompt.pb.go",
++ "static_list_prompt.pb.go",
++ "static_media_prompt.pb.go",
++ "static_prompt.pb.go",
++ "static_simple_prompt.pb.go",
++ "static_table_prompt.pb.go",
++ "suggestion.pb.go",
++ "surface_capabilities.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/actions/sdk/v2/interactionmodel/prompt",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":prompt",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/actions/sdk/v2/interactionmodel/type/BUILD.bazel b/googleapis/actions/sdk/v2/interactionmodel/type/BUILD.bazel
+--- a/googleapis/actions/sdk/v2/interactionmodel/type/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/actions/sdk/v2/interactionmodel/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "type",
++ srcs = [
++ "class_reference.pb.go",
++ "entity_display.pb.go",
++ "free_text_type.pb.go",
++ "regular_expression_type.pb.go",
++ "synonym_type.pb.go",
++ "type.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/actions/sdk/v2/interactionmodel/type",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":type",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/analytics/admin/v1alpha/BUILD.bazel b/googleapis/analytics/admin/v1alpha/BUILD.bazel
+--- a/googleapis/analytics/admin/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/analytics/admin/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/analytics/admin/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_analytics//admin/apiv1alpha/adminpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/analytics/admin/v1beta/BUILD.bazel b/googleapis/analytics/admin/v1beta/BUILD.bazel
+--- a/googleapis/analytics/admin/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/analytics/admin/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = [
++ "access_report.pb.go",
++ "analytics_admin.pb.go",
++ "resources.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/analytics/admin/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/analytics/data/v1alpha/BUILD.bazel b/googleapis/analytics/data/v1alpha/BUILD.bazel
+--- a/googleapis/analytics/data/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/analytics/data/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = [
++ "analytics_data_api.pb.go",
++ "data.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/analytics/data/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/analytics/data/v1beta/BUILD.bazel b/googleapis/analytics/data/v1beta/BUILD.bazel
+--- a/googleapis/analytics/data/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/analytics/data/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = [
++ "analytics_data_api.pb.go",
++ "data.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/analytics/data/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/analytics/management/v1alpha/BUILD.bazel b/googleapis/analytics/management/v1alpha/BUILD.bazel
+--- a/googleapis/analytics/management/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/analytics/management/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = [
++ "management_api.pb.go",
++ "resources.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/analytics/management/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/annotations/BUILD.bazel b/googleapis/api/annotations/BUILD.bazel
+--- a/googleapis/api/annotations/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/annotations/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "annotations",
++ srcs = [
++ "annotations.pb.go",
++ "client.pb.go",
++ "field_behavior.pb.go",
++ "http.pb.go",
++ "resource.pb.go",
++ "routing.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/api/annotations",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/descriptorpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":annotations",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/apikeys/v2/BUILD.bazel b/googleapis/api/apikeys/v2/BUILD.bazel
+--- a/googleapis/api/apikeys/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/apikeys/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "apikeys",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/api/apikeys/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_apikeys//apiv2/apikeyspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":apikeys",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/BUILD.bazel b/googleapis/api/BUILD.bazel
+--- a/googleapis/api/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "api",
++ srcs = ["launch_stage.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/api",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":api",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/configchange/BUILD.bazel b/googleapis/api/configchange/BUILD.bazel
+--- a/googleapis/api/configchange/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/configchange/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "configchange",
++ srcs = ["config_change.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/api/configchange",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":configchange",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/distribution/BUILD.bazel b/googleapis/api/distribution/BUILD.bazel
+--- a/googleapis/api/distribution/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/distribution/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "distribution",
++ srcs = ["distribution.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/api/distribution",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":distribution",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/error_reason/BUILD.bazel b/googleapis/api/error_reason/BUILD.bazel
+--- a/googleapis/api/error_reason/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/error_reason/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "error_reason",
++ srcs = ["error_reason.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/api/error_reason",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":error_reason",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/expr/conformance/v1alpha1/BUILD.bazel b/googleapis/api/expr/conformance/v1alpha1/BUILD.bazel
+--- a/googleapis/api/expr/conformance/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/expr/conformance/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = ["conformance_service.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/api/expr/conformance/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/api/expr/v1alpha1",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/expr/v1alpha1/BUILD.bazel b/googleapis/api/expr/v1alpha1/BUILD.bazel
+--- a/googleapis/api/expr/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/expr/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = [
++ "checked.pb.go",
++ "eval.pb.go",
++ "explain.pb.go",
++ "syntax.pb.go",
++ "value.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/api/expr/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/expr/v1beta1/BUILD.bazel b/googleapis/api/expr/v1beta1/BUILD.bazel
+--- a/googleapis/api/expr/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/expr/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = [
++ "decl.pb.go",
++ "eval.pb.go",
++ "expr.pb.go",
++ "source.pb.go",
++ "value.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/api/expr/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/httpbody/BUILD.bazel b/googleapis/api/httpbody/BUILD.bazel
+--- a/googleapis/api/httpbody/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/httpbody/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "httpbody",
++ srcs = ["httpbody.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/api/httpbody",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":httpbody",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/label/BUILD.bazel b/googleapis/api/label/BUILD.bazel
+--- a/googleapis/api/label/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/label/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "label",
++ srcs = ["label.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/api/label",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":label",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/metric/BUILD.bazel b/googleapis/api/metric/BUILD.bazel
+--- a/googleapis/api/metric/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/metric/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "metric",
++ srcs = ["metric.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/api/metric",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api",
++ "//googleapis/api/label",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":metric",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/monitoredres/BUILD.bazel b/googleapis/api/monitoredres/BUILD.bazel
+--- a/googleapis/api/monitoredres/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/monitoredres/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "monitoredres",
++ srcs = ["monitored_resource.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/api/monitoredres",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api",
++ "//googleapis/api/label",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":monitoredres",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/serviceconfig/BUILD.bazel b/googleapis/api/serviceconfig/BUILD.bazel
+--- a/googleapis/api/serviceconfig/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/serviceconfig/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,43 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "serviceconfig",
++ srcs = [
++ "auth.pb.go",
++ "backend.pb.go",
++ "billing.pb.go",
++ "consumer.pb.go",
++ "context.pb.go",
++ "control.pb.go",
++ "documentation.pb.go",
++ "endpoint.pb.go",
++ "log.pb.go",
++ "logging.pb.go",
++ "monitoring.pb.go",
++ "quota.pb.go",
++ "service.pb.go",
++ "source_info.pb.go",
++ "system_parameter.pb.go",
++ "usage.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/api/serviceconfig",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/api/label",
++ "//googleapis/api/metric",
++ "//googleapis/api/monitoredres",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/apipb:go_default_library",
++ "@org_golang_google_protobuf//types/known/typepb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":serviceconfig",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/servicecontrol/v1/BUILD.bazel b/googleapis/api/servicecontrol/v1/BUILD.bazel
+--- a/googleapis/api/servicecontrol/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/servicecontrol/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "servicecontrol",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/api/servicecontrol/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_servicecontrol//apiv1/servicecontrolpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":servicecontrol",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/servicecontrol/v2/BUILD.bazel b/googleapis/api/servicecontrol/v2/BUILD.bazel
+--- a/googleapis/api/servicecontrol/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/servicecontrol/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "servicecontrol",
++ srcs = ["service_controller.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/api/servicecontrol/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/context/attribute_context",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":servicecontrol",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/servicemanagement/v1/BUILD.bazel b/googleapis/api/servicemanagement/v1/BUILD.bazel
+--- a/googleapis/api/servicemanagement/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/servicemanagement/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "servicemanagement",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/api/servicemanagement/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_servicemanagement//apiv1/servicemanagementpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":servicemanagement",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/serviceusage/v1/BUILD.bazel b/googleapis/api/serviceusage/v1/BUILD.bazel
+--- a/googleapis/api/serviceusage/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/serviceusage/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "serviceusage",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/api/serviceusage/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_serviceusage//apiv1/serviceusagepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":serviceusage",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/serviceusage/v1beta1/BUILD.bazel b/googleapis/api/serviceusage/v1beta1/BUILD.bazel
+--- a/googleapis/api/serviceusage/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/serviceusage/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = [
++ "resources.pb.go",
++ "serviceusage.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/api/serviceusage/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/api/monitoredres",
++ "//googleapis/api/serviceconfig",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/apipb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/api/visibility/BUILD.bazel b/googleapis/api/visibility/BUILD.bazel
+--- a/googleapis/api/visibility/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/api/visibility/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "visibility",
++ srcs = ["visibility.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/api/visibility",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/descriptorpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":visibility",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/appengine/legacy/BUILD.bazel b/googleapis/appengine/legacy/BUILD.bazel
+--- a/googleapis/appengine/legacy/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/appengine/legacy/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "legacy",
++ srcs = ["audit_data.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/appengine/legacy",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":legacy",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/appengine/logging/v1/BUILD.bazel b/googleapis/appengine/logging/v1/BUILD.bazel
+--- a/googleapis/appengine/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/appengine/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["request_log.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/appengine/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/logging/type",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/appengine/v1/BUILD.bazel b/googleapis/appengine/v1/BUILD.bazel
+--- a/googleapis/appengine/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/appengine/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "appengine",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/appengine/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_appengine//apiv1/appenginepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":appengine",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/appengine/v1beta/BUILD.bazel b/googleapis/appengine/v1beta/BUILD.bazel
+--- a/googleapis/appengine/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/appengine/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,45 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = [
++ "app_yaml.pb.go",
++ "appengine.pb.go",
++ "application.pb.go",
++ "audit_data.pb.go",
++ "certificate.pb.go",
++ "deploy.pb.go",
++ "deployed_files.pb.go",
++ "domain.pb.go",
++ "domain_mapping.pb.go",
++ "firewall.pb.go",
++ "instance.pb.go",
++ "location.pb.go",
++ "network_settings.pb.go",
++ "operation.pb.go",
++ "service.pb.go",
++ "version.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/appengine/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/apps/alertcenter/v1beta1/BUILD.bazel b/googleapis/apps/alertcenter/v1beta1/BUILD.bazel
+--- a/googleapis/apps/alertcenter/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/apps/alertcenter/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alertcenter.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/apps/alertcenter/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/apps/drive/activity/v2/BUILD.bazel b/googleapis/apps/drive/activity/v2/BUILD.bazel
+--- a/googleapis/apps/drive/activity/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/apps/drive/activity/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "activity",
++ srcs = [
++ "action.pb.go",
++ "actor.pb.go",
++ "common.pb.go",
++ "drive_activity_service.pb.go",
++ "query_drive_activity_request.pb.go",
++ "query_drive_activity_response.pb.go",
++ "target.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/apps/drive/activity/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":activity",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/apps/drive/labels/v2/BUILD.bazel b/googleapis/apps/drive/labels/v2/BUILD.bazel
+--- a/googleapis/apps/drive/labels/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/apps/drive/labels/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "labels",
++ srcs = [
++ "common.pb.go",
++ "error_details.pb.go",
++ "exception_detail.pb.go",
++ "field.pb.go",
++ "label.pb.go",
++ "label_permission.pb.go",
++ "label_service.pb.go",
++ "requests.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/apps/drive/labels/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/type/color",
++ "//googleapis/type/date",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":labels",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/apps/drive/labels/v2beta/BUILD.bazel b/googleapis/apps/drive/labels/v2beta/BUILD.bazel
+--- a/googleapis/apps/drive/labels/v2beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/apps/drive/labels/v2beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,39 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v2beta",
++ srcs = [
++ "common.pb.go",
++ "error_details.pb.go",
++ "exception_detail.pb.go",
++ "field.pb.go",
++ "label.pb.go",
++ "label_limits.pb.go",
++ "label_lock.pb.go",
++ "label_permission.pb.go",
++ "label_service.pb.go",
++ "requests.pb.go",
++ "user_capabilities.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/apps/drive/labels/v2beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/type/color",
++ "//googleapis/type/date",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v2beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/apps/script/type/BUILD.bazel b/googleapis/apps/script/type/BUILD.bazel
+--- a/googleapis/apps/script/type/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/apps/script/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "type",
++ srcs = [
++ "addon_widget_set.pb.go",
++ "extension_point.pb.go",
++ "script_manifest.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/apps/script/type",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":type",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/apps/script/type/calendar/BUILD.bazel b/googleapis/apps/script/type/calendar/BUILD.bazel
+--- a/googleapis/apps/script/type/calendar/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/apps/script/type/calendar/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "calendar",
++ srcs = ["calendar_addon_manifest.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/apps/script/type/calendar",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/apps/script/type",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":calendar",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/apps/script/type/docs/BUILD.bazel b/googleapis/apps/script/type/docs/BUILD.bazel
+--- a/googleapis/apps/script/type/docs/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/apps/script/type/docs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "docs",
++ srcs = ["docs_addon_manifest.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/apps/script/type/docs",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/apps/script/type",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":docs",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/apps/script/type/drive/BUILD.bazel b/googleapis/apps/script/type/drive/BUILD.bazel
+--- a/googleapis/apps/script/type/drive/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/apps/script/type/drive/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "drive",
++ srcs = ["drive_addon_manifest.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/apps/script/type/drive",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/apps/script/type",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":drive",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/apps/script/type/gmail/BUILD.bazel b/googleapis/apps/script/type/gmail/BUILD.bazel
+--- a/googleapis/apps/script/type/gmail/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/apps/script/type/gmail/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "gmail",
++ srcs = ["gmail_addon_manifest.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/apps/script/type/gmail",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/apps/script/type",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gmail",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/apps/script/type/sheets/BUILD.bazel b/googleapis/apps/script/type/sheets/BUILD.bazel
+--- a/googleapis/apps/script/type/sheets/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/apps/script/type/sheets/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "sheets",
++ srcs = ["sheets_addon_manifest.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/apps/script/type/sheets",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/apps/script/type",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sheets",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/apps/script/type/slides/BUILD.bazel b/googleapis/apps/script/type/slides/BUILD.bazel
+--- a/googleapis/apps/script/type/slides/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/apps/script/type/slides/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "slides",
++ srcs = ["slides_addon_manifest.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/apps/script/type/slides",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/apps/script/type",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":slides",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/area120/tables/v1alpha1/BUILD.bazel b/googleapis/area120/tables/v1alpha1/BUILD.bazel
+--- a/googleapis/area120/tables/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/area120/tables/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/area120/tables/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_area120//tables/apiv1alpha1/tablespb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/assistant/embedded/v1alpha1/BUILD.bazel b/googleapis/assistant/embedded/v1alpha1/BUILD.bazel
+--- a/googleapis/assistant/embedded/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/assistant/embedded/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = ["embedded_assistant.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/assistant/embedded/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/assistant/embedded/v1alpha2/BUILD.bazel b/googleapis/assistant/embedded/v1alpha2/BUILD.bazel
+--- a/googleapis/assistant/embedded/v1alpha2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/assistant/embedded/v1alpha2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha2",
++ srcs = ["embedded_assistant.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/assistant/embedded/v1alpha2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/type/latlng",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/bigtable/admin/cluster/v1/BUILD.bazel b/googleapis/bigtable/admin/cluster/v1/BUILD.bazel
+--- a/googleapis/bigtable/admin/cluster/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/bigtable/admin/cluster/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "cluster",
++ srcs = [
++ "bigtable_cluster_data.pb.go",
++ "bigtable_cluster_service.pb.go",
++ "bigtable_cluster_service_messages.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/bigtable/admin/cluster/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":cluster",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/bigtable/admin/table/v1/BUILD.bazel b/googleapis/bigtable/admin/table/v1/BUILD.bazel
+--- a/googleapis/bigtable/admin/table/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/bigtable/admin/table/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "table",
++ srcs = [
++ "bigtable_table_data.pb.go",
++ "bigtable_table_service.pb.go",
++ "bigtable_table_service_messages.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/bigtable/admin/table/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":table",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/bigtable/admin/v2/BUILD.bazel b/googleapis/bigtable/admin/v2/BUILD.bazel
+--- a/googleapis/bigtable/admin/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/bigtable/admin/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "admin",
++ srcs = [
++ "bigtable_instance_admin.pb.go",
++ "bigtable_table_admin.pb.go",
++ "common.pb.go",
++ "instance.pb.go",
++ "table.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/bigtable/admin/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/iam/v1:iam",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":admin",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/bigtable/v1/BUILD.bazel b/googleapis/bigtable/v1/BUILD.bazel
+--- a/googleapis/bigtable/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/bigtable/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "bigtable",
++ srcs = [
++ "bigtable_data.pb.go",
++ "bigtable_service.pb.go",
++ "bigtable_service_messages.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/bigtable/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":bigtable",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/bigtable/v2/BUILD.bazel b/googleapis/bigtable/v2/BUILD.bazel
+--- a/googleapis/bigtable/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/bigtable/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "bigtable",
++ srcs = [
++ "bigtable.pb.go",
++ "data.pb.go",
++ "request_stats.pb.go",
++ "response_params.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/bigtable/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":bigtable",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/bytestream/BUILD.bazel b/googleapis/bytestream/BUILD.bazel
+--- a/googleapis/bytestream/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/bytestream/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "bytestream",
++ srcs = ["bytestream.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/bytestream",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":bytestream",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/ccc/hosted/marketplace/v2/BUILD.bazel b/googleapis/ccc/hosted/marketplace/v2/BUILD.bazel
+--- a/googleapis/ccc/hosted/marketplace/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/ccc/hosted/marketplace/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "marketplace",
++ srcs = [
++ "resources.pb.go",
++ "services.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/ccc/hosted/marketplace/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":marketplace",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/chat/dynamite/integration/logging/v1/BUILD.bazel b/googleapis/chat/dynamite/integration/logging/v1/BUILD.bazel
+--- a/googleapis/chat/dynamite/integration/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/chat/dynamite/integration/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["dynamite_integration_log_entry.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/chat/dynamite/integration/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/chat/logging/v1/BUILD.bazel b/googleapis/chat/logging/v1/BUILD.bazel
+--- a/googleapis/chat/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/chat/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["chat_app_log_entry.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/chat/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/chromeos/moblab/v1beta1/BUILD.bazel b/googleapis/chromeos/moblab/v1beta1/BUILD.bazel
+--- a/googleapis/chromeos/moblab/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/chromeos/moblab/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = [
++ "build_service.pb.go",
++ "resources.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/chromeos/moblab/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/chromeos/uidetection/v1/BUILD.bazel b/googleapis/chromeos/uidetection/v1/BUILD.bazel
+--- a/googleapis/chromeos/uidetection/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/chromeos/uidetection/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "uidetection",
++ srcs = ["ui_detection.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/chromeos/uidetection/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":uidetection",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/accessapproval/v1/BUILD.bazel b/googleapis/cloud/accessapproval/v1/BUILD.bazel
+--- a/googleapis/cloud/accessapproval/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/accessapproval/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "accessapproval",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/accessapproval/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_accessapproval//apiv1/accessapprovalpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":accessapproval",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/aiplatform/logging/BUILD.bazel b/googleapis/cloud/aiplatform/logging/BUILD.bazel
+--- a/googleapis/cloud/aiplatform/logging/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/aiplatform/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["prediction.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/logging",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/aiplatform/v1/BUILD.bazel b/googleapis/cloud/aiplatform/v1/BUILD.bazel
+--- a/googleapis/cloud/aiplatform/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/aiplatform/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "aiplatform",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_aiplatform//apiv1/aiplatformpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":aiplatform",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/aiplatform/v1/schema/predict/instance/BUILD.bazel b/googleapis/cloud/aiplatform/v1/schema/predict/instance/BUILD.bazel
+--- a/googleapis/cloud/aiplatform/v1/schema/predict/instance/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/aiplatform/v1/schema/predict/instance/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "instance",
++ srcs = [
++ "image_classification.pb.go",
++ "image_object_detection.pb.go",
++ "image_segmentation.pb.go",
++ "text_classification.pb.go",
++ "text_extraction.pb.go",
++ "text_sentiment.pb.go",
++ "video_action_recognition.pb.go",
++ "video_classification.pb.go",
++ "video_object_tracking.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1/schema/predict/instance",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":instance",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/aiplatform/v1/schema/predict/params/BUILD.bazel b/googleapis/cloud/aiplatform/v1/schema/predict/params/BUILD.bazel
+--- a/googleapis/cloud/aiplatform/v1/schema/predict/params/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/aiplatform/v1/schema/predict/params/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "params",
++ srcs = [
++ "image_classification.pb.go",
++ "image_object_detection.pb.go",
++ "image_segmentation.pb.go",
++ "video_action_recognition.pb.go",
++ "video_classification.pb.go",
++ "video_object_tracking.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1/schema/predict/params",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":params",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/aiplatform/v1/schema/predict/prediction/BUILD.bazel b/googleapis/cloud/aiplatform/v1/schema/predict/prediction/BUILD.bazel
+--- a/googleapis/cloud/aiplatform/v1/schema/predict/prediction/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/aiplatform/v1/schema/predict/prediction/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "prediction",
++ srcs = [
++ "classification.pb.go",
++ "image_object_detection.pb.go",
++ "image_segmentation.pb.go",
++ "tabular_classification.pb.go",
++ "tabular_regression.pb.go",
++ "text_extraction.pb.go",
++ "text_sentiment.pb.go",
++ "video_action_recognition.pb.go",
++ "video_classification.pb.go",
++ "video_object_tracking.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1/schema/predict/prediction",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":prediction",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/aiplatform/v1/schema/trainingjob/definition/BUILD.bazel b/googleapis/cloud/aiplatform/v1/schema/trainingjob/definition/BUILD.bazel
+--- a/googleapis/cloud/aiplatform/v1/schema/trainingjob/definition/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/aiplatform/v1/schema/trainingjob/definition/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "definition",
++ srcs = [
++ "automl_image_classification.pb.go",
++ "automl_image_object_detection.pb.go",
++ "automl_image_segmentation.pb.go",
++ "automl_tables.pb.go",
++ "automl_text_classification.pb.go",
++ "automl_text_extraction.pb.go",
++ "automl_text_sentiment.pb.go",
++ "automl_time_series_forecasting.pb.go",
++ "automl_video_action_recognition.pb.go",
++ "automl_video_classification.pb.go",
++ "automl_video_object_tracking.pb.go",
++ "export_evaluated_data_items_config.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1/schema/trainingjob/definition",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@com_github_golang_protobuf//proto:go_default_library",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":definition",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/aiplatform/v1beta1/BUILD.bazel b/googleapis/cloud/aiplatform/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/aiplatform/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/aiplatform/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_aiplatform//apiv1beta1/aiplatformpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/aiplatform/v1beta1/schema/BUILD.bazel b/googleapis/cloud/aiplatform/v1beta1/schema/BUILD.bazel
+--- a/googleapis/cloud/aiplatform/v1beta1/schema/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/aiplatform/v1beta1/schema/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "schema",
++ srcs = [
++ "annotation_payload.pb.go",
++ "annotation_spec_color.pb.go",
++ "data_item_payload.pb.go",
++ "dataset_metadata.pb.go",
++ "geometry.pb.go",
++ "io_format.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1/schema",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/cloud/aiplatform/v1beta1/schema/predict/instance",
++ "//googleapis/rpc/code",
++ "//googleapis/type/color",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":schema",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/aiplatform/v1beta1/schema/predict/instance/BUILD.bazel b/googleapis/cloud/aiplatform/v1beta1/schema/predict/instance/BUILD.bazel
+--- a/googleapis/cloud/aiplatform/v1beta1/schema/predict/instance/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/aiplatform/v1beta1/schema/predict/instance/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "instance",
++ srcs = [
++ "image_classification.pb.go",
++ "image_object_detection.pb.go",
++ "image_segmentation.pb.go",
++ "text_classification.pb.go",
++ "text_extraction.pb.go",
++ "text_sentiment.pb.go",
++ "video_action_recognition.pb.go",
++ "video_classification.pb.go",
++ "video_object_tracking.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1/schema/predict/instance",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":instance",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/aiplatform/v1beta1/schema/predict/params/BUILD.bazel b/googleapis/cloud/aiplatform/v1beta1/schema/predict/params/BUILD.bazel
+--- a/googleapis/cloud/aiplatform/v1beta1/schema/predict/params/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/aiplatform/v1beta1/schema/predict/params/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "params",
++ srcs = [
++ "image_classification.pb.go",
++ "image_object_detection.pb.go",
++ "image_segmentation.pb.go",
++ "video_action_recognition.pb.go",
++ "video_classification.pb.go",
++ "video_object_tracking.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1/schema/predict/params",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":params",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/aiplatform/v1beta1/schema/predict/prediction/BUILD.bazel b/googleapis/cloud/aiplatform/v1beta1/schema/predict/prediction/BUILD.bazel
+--- a/googleapis/cloud/aiplatform/v1beta1/schema/predict/prediction/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/aiplatform/v1beta1/schema/predict/prediction/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "prediction",
++ srcs = [
++ "classification.pb.go",
++ "image_object_detection.pb.go",
++ "image_segmentation.pb.go",
++ "tabular_classification.pb.go",
++ "tabular_regression.pb.go",
++ "text_extraction.pb.go",
++ "text_sentiment.pb.go",
++ "time_series_forecasting.pb.go",
++ "video_action_recognition.pb.go",
++ "video_classification.pb.go",
++ "video_object_tracking.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1/schema/predict/prediction",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":prediction",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/aiplatform/v1beta1/schema/trainingjob/definition/BUILD.bazel b/googleapis/cloud/aiplatform/v1beta1/schema/trainingjob/definition/BUILD.bazel
+--- a/googleapis/cloud/aiplatform/v1beta1/schema/trainingjob/definition/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/aiplatform/v1beta1/schema/trainingjob/definition/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "definition",
++ srcs = [
++ "automl_image_classification.pb.go",
++ "automl_image_object_detection.pb.go",
++ "automl_image_segmentation.pb.go",
++ "automl_tables.pb.go",
++ "automl_text_classification.pb.go",
++ "automl_text_extraction.pb.go",
++ "automl_text_sentiment.pb.go",
++ "automl_time_series_forecasting.pb.go",
++ "automl_video_action_recognition.pb.go",
++ "automl_video_classification.pb.go",
++ "automl_video_object_tracking.pb.go",
++ "export_evaluated_data_items_config.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/aiplatform/v1beta1/schema/trainingjob/definition",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":definition",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/apigateway/v1/BUILD.bazel b/googleapis/cloud/apigateway/v1/BUILD.bazel
+--- a/googleapis/cloud/apigateway/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/apigateway/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "apigateway",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/apigateway/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_apigateway//apiv1/apigatewaypb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":apigateway",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/apigeeconnect/v1/BUILD.bazel b/googleapis/cloud/apigeeconnect/v1/BUILD.bazel
+--- a/googleapis/cloud/apigeeconnect/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/apigeeconnect/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "apigeeconnect",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/apigeeconnect/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_apigeeconnect//apiv1/apigeeconnectpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":apigeeconnect",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/apigeeregistry/v1/BUILD.bazel b/googleapis/cloud/apigeeregistry/v1/BUILD.bazel
+--- a/googleapis/cloud/apigeeregistry/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/apigeeregistry/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "apigeeregistry",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/apigeeregistry/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_apigeeregistry//apiv1/apigeeregistrypb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":apigeeregistry",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/asset/v1/BUILD.bazel b/googleapis/cloud/asset/v1/BUILD.bazel
+--- a/googleapis/cloud/asset/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/asset/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "asset",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_asset//apiv1/assetpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":asset",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/asset/v1p1beta1/BUILD.bazel b/googleapis/cloud/asset/v1p1beta1/BUILD.bazel
+--- a/googleapis/cloud/asset/v1p1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/asset/v1p1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1p1beta1",
++ srcs = [
++ "asset_service.pb.go",
++ "assets.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1p1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/iam/v1:iam",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1p1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/asset/v1p2beta1/BUILD.bazel b/googleapis/cloud/asset/v1p2beta1/BUILD.bazel
+--- a/googleapis/cloud/asset/v1p2beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/asset/v1p2beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1p2beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1p2beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_asset//apiv1p2beta1/assetpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1p2beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/asset/v1p4beta1/BUILD.bazel b/googleapis/cloud/asset/v1p4beta1/BUILD.bazel
+--- a/googleapis/cloud/asset/v1p4beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/asset/v1p4beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1p4beta1",
++ srcs = [
++ "asset_service.pb.go",
++ "assets.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1p4beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/iam/v1:iam",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/code",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1p4beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/asset/v1p5beta1/BUILD.bazel b/googleapis/cloud/asset/v1p5beta1/BUILD.bazel
+--- a/googleapis/cloud/asset/v1p5beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/asset/v1p5beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1p5beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1p5beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_asset//apiv1p5beta1/assetpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1p5beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/asset/v1p7beta1/BUILD.bazel b/googleapis/cloud/asset/v1p7beta1/BUILD.bazel
+--- a/googleapis/cloud/asset/v1p7beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/asset/v1p7beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1p7beta1",
++ srcs = [
++ "asset_service.pb.go",
++ "assets.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/asset/v1p7beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/cloud/orgpolicy/v1:orgpolicy",
++ "//googleapis/iam/v1:iam",
++ "//googleapis/identity/accesscontextmanager/v1:accesscontextmanager",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1p7beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/assuredworkloads/regulatoryintercept/logging/v1/BUILD.bazel b/googleapis/cloud/assuredworkloads/regulatoryintercept/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/assuredworkloads/regulatoryintercept/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/assuredworkloads/regulatoryintercept/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["regulatory_intercept_ack_log_entry.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/assuredworkloads/regulatoryintercept/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/assuredworkloads/v1/BUILD.bazel b/googleapis/cloud/assuredworkloads/v1/BUILD.bazel
+--- a/googleapis/cloud/assuredworkloads/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/assuredworkloads/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "assuredworkloads",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/assuredworkloads/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_assuredworkloads//apiv1/assuredworkloadspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":assuredworkloads",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/assuredworkloads/v1beta1/BUILD.bazel b/googleapis/cloud/assuredworkloads/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/assuredworkloads/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/assuredworkloads/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/assuredworkloads/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_assuredworkloads//apiv1beta1/assuredworkloadspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/audit/BUILD.bazel b/googleapis/cloud/audit/BUILD.bazel
+--- a/googleapis/cloud/audit/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/audit/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "audit",
++ srcs = [
++ "audit_log.pb.go",
++ "bigquery_audit_metadata.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/audit",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/iam/v1:iam",
++ "//googleapis/rpc/context/attribute_context",
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":audit",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/automl/v1/BUILD.bazel b/googleapis/cloud/automl/v1/BUILD.bazel
+--- a/googleapis/cloud/automl/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/automl/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "automl",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/automl/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_automl//apiv1/automlpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":automl",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/automl/v1beta1/BUILD.bazel b/googleapis/cloud/automl/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/automl/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/automl/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/automl/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_automl//apiv1beta1/automlpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/backupdr/logging/v1/BUILD.bazel b/googleapis/cloud/backupdr/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/backupdr/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/backupdr/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["eventlog.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/backupdr/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/baremetalsolution/v2/BUILD.bazel b/googleapis/cloud/baremetalsolution/v2/BUILD.bazel
+--- a/googleapis/cloud/baremetalsolution/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/baremetalsolution/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "baremetalsolution",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/baremetalsolution/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_baremetalsolution//apiv2/baremetalsolutionpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":baremetalsolution",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/batch/v1/BUILD.bazel b/googleapis/cloud/batch/v1/BUILD.bazel
+--- a/googleapis/cloud/batch/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/batch/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "batch",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/batch/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_batch//apiv1/batchpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":batch",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/batch/v1alpha/BUILD.bazel b/googleapis/cloud/batch/v1alpha/BUILD.bazel
+--- a/googleapis/cloud/batch/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/batch/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = [
++ "batch.pb.go",
++ "job.pb.go",
++ "task.pb.go",
++ "volume.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/batch/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/batch/v1alpha1/BUILD.bazel b/googleapis/cloud/batch/v1alpha1/BUILD.bazel
+--- a/googleapis/cloud/batch/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/batch/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = [
++ "batch.pb.go",
++ "job.pb.go",
++ "task.pb.go",
++ "volume.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/batch/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/batch/v1main/BUILD.bazel b/googleapis/cloud/batch/v1main/BUILD.bazel
+--- a/googleapis/cloud/batch/v1main/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/batch/v1main/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1main",
++ srcs = ["batch.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/batch/v1main",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1main",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/beyondcorp/appconnections/v1/BUILD.bazel b/googleapis/cloud/beyondcorp/appconnections/v1/BUILD.bazel
+--- a/googleapis/cloud/beyondcorp/appconnections/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/beyondcorp/appconnections/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "appconnections",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/beyondcorp/appconnections/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_beyondcorp//appconnections/apiv1/appconnectionspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":appconnections",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/beyondcorp/appconnectors/v1/BUILD.bazel b/googleapis/cloud/beyondcorp/appconnectors/v1/BUILD.bazel
+--- a/googleapis/cloud/beyondcorp/appconnectors/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/beyondcorp/appconnectors/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "appconnectors",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/beyondcorp/appconnectors/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_beyondcorp//appconnectors/apiv1/appconnectorspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":appconnectors",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/beyondcorp/appgateways/v1/BUILD.bazel b/googleapis/cloud/beyondcorp/appgateways/v1/BUILD.bazel
+--- a/googleapis/cloud/beyondcorp/appgateways/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/beyondcorp/appgateways/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "appgateways",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/beyondcorp/appgateways/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_beyondcorp//appgateways/apiv1/appgatewayspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":appgateways",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/beyondcorp/clientconnectorservices/v1/BUILD.bazel b/googleapis/cloud/beyondcorp/clientconnectorservices/v1/BUILD.bazel
+--- a/googleapis/cloud/beyondcorp/clientconnectorservices/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/beyondcorp/clientconnectorservices/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "clientconnectorservices",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/beyondcorp/clientconnectorservices/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_beyondcorp//clientconnectorservices/apiv1/clientconnectorservicespb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":clientconnectorservices",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/beyondcorp/clientgateways/v1/BUILD.bazel b/googleapis/cloud/beyondcorp/clientgateways/v1/BUILD.bazel
+--- a/googleapis/cloud/beyondcorp/clientgateways/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/beyondcorp/clientgateways/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "clientgateways",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/beyondcorp/clientgateways/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_beyondcorp//clientgateways/apiv1/clientgatewayspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":clientgateways",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/analyticshub/v1/BUILD.bazel b/googleapis/cloud/bigquery/analyticshub/v1/BUILD.bazel
+--- a/googleapis/cloud/bigquery/analyticshub/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/analyticshub/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "analyticshub",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/analyticshub/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_bigquery//analyticshub/apiv1/analyticshubpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":analyticshub",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/connection/v1/BUILD.bazel b/googleapis/cloud/bigquery/connection/v1/BUILD.bazel
+--- a/googleapis/cloud/bigquery/connection/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/connection/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "connection",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_bigquery//connection/apiv1/connectionpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":connection",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/connection/v1beta1/BUILD.bazel b/googleapis/cloud/bigquery/connection/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/bigquery/connection/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/connection/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/connection/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_bigquery//connection/apiv1beta1/connectionpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/dataexchange/common/BUILD.bazel b/googleapis/cloud/bigquery/dataexchange/common/BUILD.bazel
+--- a/googleapis/cloud/bigquery/dataexchange/common/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/dataexchange/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "common",
++ srcs = ["common.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/common",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":common",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/dataexchange/v1beta1/BUILD.bazel b/googleapis/cloud/bigquery/dataexchange/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/bigquery/dataexchange/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/dataexchange/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/dataexchange/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_bigquery//dataexchange/apiv1beta1/dataexchangepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/datapolicies/v1beta1/BUILD.bazel b/googleapis/cloud/bigquery/datapolicies/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/bigquery/datapolicies/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/datapolicies/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/datapolicies/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_bigquery//datapolicies/apiv1beta1/datapoliciespb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/datatransfer/v1/BUILD.bazel b/googleapis/cloud/bigquery/datatransfer/v1/BUILD.bazel
+--- a/googleapis/cloud/bigquery/datatransfer/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/datatransfer/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "datatransfer",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/datatransfer/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_bigquery//datatransfer/apiv1/datatransferpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":datatransfer",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/logging/v1/BUILD.bazel b/googleapis/cloud/bigquery/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/bigquery/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["audit_data.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/iam/v1:iam",
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/migration/tasks/assessment/v2alpha/BUILD.bazel b/googleapis/cloud/bigquery/migration/tasks/assessment/v2alpha/BUILD.bazel
+--- a/googleapis/cloud/bigquery/migration/tasks/assessment/v2alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/migration/tasks/assessment/v2alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v2alpha",
++ srcs = ["assessment.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/migration/tasks/assessment/v2alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v2alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/migration/tasks/translation/v2alpha/BUILD.bazel b/googleapis/cloud/bigquery/migration/tasks/translation/v2alpha/BUILD.bazel
+--- a/googleapis/cloud/bigquery/migration/tasks/translation/v2alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/migration/tasks/translation/v2alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v2alpha",
++ srcs = [
++ "dataset_reference.pb.go",
++ "translation.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/migration/tasks/translation/v2alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v2alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/migration/v2/BUILD.bazel b/googleapis/cloud/bigquery/migration/v2/BUILD.bazel
+--- a/googleapis/cloud/bigquery/migration/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/migration/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "migration",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_bigquery//migration/apiv2/migrationpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":migration",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/migration/v2alpha/BUILD.bazel b/googleapis/cloud/bigquery/migration/v2alpha/BUILD.bazel
+--- a/googleapis/cloud/bigquery/migration/v2alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/migration/v2alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v2alpha",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/migration/v2alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_bigquery//migration/apiv2alpha/migrationpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v2alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/reservation/v1/BUILD.bazel b/googleapis/cloud/bigquery/reservation/v1/BUILD.bazel
+--- a/googleapis/cloud/bigquery/reservation/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/reservation/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "reservation",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/reservation/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_bigquery//reservation/apiv1/reservationpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":reservation",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/reservation/v1beta1/BUILD.bazel b/googleapis/cloud/bigquery/reservation/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/bigquery/reservation/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/reservation/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["reservation.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/reservation/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/storage/v1/BUILD.bazel b/googleapis/cloud/bigquery/storage/v1/BUILD.bazel
+--- a/googleapis/cloud/bigquery/storage/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/storage/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "storage",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_bigquery//storage/apiv1/storagepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":storage",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/storage/v1alpha2/BUILD.bazel b/googleapis/cloud/bigquery/storage/v1alpha2/BUILD.bazel
+--- a/googleapis/cloud/bigquery/storage/v1alpha2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/storage/v1alpha2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha2",
++ srcs = [
++ "protobuf.pb.go",
++ "storage.pb.go",
++ "stream.pb.go",
++ "table.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1alpha2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/descriptorpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/storage/v1beta1/BUILD.bazel b/googleapis/cloud/bigquery/storage/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/bigquery/storage/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/storage/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_bigquery//storage/apiv1beta1/storagepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/storage/v1beta2/BUILD.bazel b/googleapis/cloud/bigquery/storage/v1beta2/BUILD.bazel
+--- a/googleapis/cloud/bigquery/storage/v1beta2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/storage/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta2",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/storage/v1beta2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_bigquery//storage/apiv1beta2/storagepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/bigquery/v2/BUILD.bazel b/googleapis/cloud/bigquery/v2/BUILD.bazel
+--- a/googleapis/cloud/bigquery/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/bigquery/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "bigquery",
++ srcs = [
++ "encryption_config.pb.go",
++ "model.pb.go",
++ "model_reference.pb.go",
++ "standard_sql.pb.go",
++ "table_reference.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/bigquery/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":bigquery",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/billing/budgets/v1/BUILD.bazel b/googleapis/cloud/billing/budgets/v1/BUILD.bazel
+--- a/googleapis/cloud/billing/budgets/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/billing/budgets/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "budgets",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/billing/budgets/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_billing//budgets/apiv1/budgetspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":budgets",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/billing/budgets/v1alpha1/BUILD.bazel b/googleapis/cloud/billing/budgets/v1alpha1/BUILD.bazel
+--- a/googleapis/cloud/billing/budgets/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/billing/budgets/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = [
++ "budget_model.pb.go",
++ "budget_service.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/billing/budgets/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/type/money",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/billing/budgets/v1beta1/BUILD.bazel b/googleapis/cloud/billing/budgets/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/billing/budgets/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/billing/budgets/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/billing/budgets/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_billing//budgets/apiv1beta1/budgetspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/billing/v1/BUILD.bazel b/googleapis/cloud/billing/v1/BUILD.bazel
+--- a/googleapis/cloud/billing/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/billing/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "billing",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/billing/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_billing//apiv1/billingpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":billing",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/binaryauthorization/v1/BUILD.bazel b/googleapis/cloud/binaryauthorization/v1/BUILD.bazel
+--- a/googleapis/cloud/binaryauthorization/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/binaryauthorization/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "binaryauthorization",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_binaryauthorization//apiv1/binaryauthorizationpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":binaryauthorization",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/binaryauthorization/v1beta1/BUILD.bazel b/googleapis/cloud/binaryauthorization/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/binaryauthorization/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/binaryauthorization/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/binaryauthorization/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_binaryauthorization//apiv1beta1/binaryauthorizationpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/certificatemanager/logging/v1/BUILD.bazel b/googleapis/cloud/certificatemanager/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/certificatemanager/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/certificatemanager/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["logs.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/certificatemanager/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/certificatemanager/v1/BUILD.bazel b/googleapis/cloud/certificatemanager/v1/BUILD.bazel
+--- a/googleapis/cloud/certificatemanager/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/certificatemanager/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "certificatemanager",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/certificatemanager/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_certificatemanager//apiv1/certificatemanagerpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":certificatemanager",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/channel/v1/BUILD.bazel b/googleapis/cloud/channel/v1/BUILD.bazel
+--- a/googleapis/cloud/channel/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/channel/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "channel",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/channel/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_channel//apiv1/channelpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":channel",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/clouddms/logging/v1/BUILD.bazel b/googleapis/cloud/clouddms/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/clouddms/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/clouddms/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["clouddms_platform_logs.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/clouddms/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/clouddms/v1/BUILD.bazel b/googleapis/cloud/clouddms/v1/BUILD.bazel
+--- a/googleapis/cloud/clouddms/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/clouddms/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "clouddms",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/clouddms/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_clouddms//apiv1/clouddmspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":clouddms",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/cloudsetup/logging/v1/BUILD.bazel b/googleapis/cloud/cloudsetup/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/cloudsetup/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/cloudsetup/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["complete_deployment.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/cloudsetup/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/commerce/consumer/procurement/v1alpha1/BUILD.bazel b/googleapis/cloud/commerce/consumer/procurement/v1alpha1/BUILD.bazel
+--- a/googleapis/cloud/commerce/consumer/procurement/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/commerce/consumer/procurement/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = [
++ "order.pb.go",
++ "procurement_service.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/commerce/consumer/procurement/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/common/BUILD.bazel b/googleapis/cloud/common/BUILD.bazel
+--- a/googleapis/cloud/common/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "common",
++ srcs = ["operation_metadata.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/common",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":common",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/compute/v1/BUILD.bazel b/googleapis/cloud/compute/v1/BUILD.bazel
+--- a/googleapis/cloud/compute/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/compute/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "compute",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/compute/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_compute//apiv1/computepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":compute",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/connectors/v1/BUILD.bazel b/googleapis/cloud/connectors/v1/BUILD.bazel
+--- a/googleapis/cloud/connectors/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/connectors/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "connectors",
++ srcs = [
++ "authconfig.pb.go",
++ "common.pb.go",
++ "connection.pb.go",
++ "connector.pb.go",
++ "connector_version.pb.go",
++ "connectors_service.pb.go",
++ "destination_config.pb.go",
++ "provider.pb.go",
++ "runtime.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/connectors/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":connectors",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/contactcenterinsights/v1/BUILD.bazel b/googleapis/cloud/contactcenterinsights/v1/BUILD.bazel
+--- a/googleapis/cloud/contactcenterinsights/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/contactcenterinsights/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "contactcenterinsights",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/contactcenterinsights/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_contactcenterinsights//apiv1/contactcenterinsightspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":contactcenterinsights",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/containers/workflow/analysis/BUILD.bazel b/googleapis/cloud/containers/workflow/analysis/BUILD.bazel
+--- a/googleapis/cloud/containers/workflow/analysis/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/containers/workflow/analysis/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "analysis",
++ srcs = ["package.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/containers/workflow/analysis",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":analysis",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/contentwarehouse/v1/BUILD.bazel b/googleapis/cloud/contentwarehouse/v1/BUILD.bazel
+--- a/googleapis/cloud/contentwarehouse/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/contentwarehouse/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,46 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "contentwarehouse",
++ srcs = [
++ "async_document_service_request.pb.go",
++ "common.pb.go",
++ "document.pb.go",
++ "document_link_service.pb.go",
++ "document_schema.pb.go",
++ "document_schema_service.pb.go",
++ "document_service.pb.go",
++ "document_service_request.pb.go",
++ "filters.pb.go",
++ "histogram.pb.go",
++ "rule_engine.pb.go",
++ "ruleset_service.pb.go",
++ "ruleset_service_request.pb.go",
++ "synonymset.pb.go",
++ "synonymset_service.pb.go",
++ "synonymset_service_request.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/contentwarehouse/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/cloud/documentai/v1:documentai",
++ "//googleapis/iam/v1:iam",
++ "//googleapis/type/datetime",
++ "//googleapis/type/interval",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":contentwarehouse",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/datacatalog/v1/BUILD.bazel b/googleapis/cloud/datacatalog/v1/BUILD.bazel
+--- a/googleapis/cloud/datacatalog/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/datacatalog/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "datacatalog",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datacatalog/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_datacatalog//apiv1/datacatalogpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":datacatalog",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/datacatalog/v1beta1/BUILD.bazel b/googleapis/cloud/datacatalog/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/datacatalog/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/datacatalog/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datacatalog/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_datacatalog//apiv1beta1/datacatalogpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/dataform/v1alpha2/BUILD.bazel b/googleapis/cloud/dataform/v1alpha2/BUILD.bazel
+--- a/googleapis/cloud/dataform/v1alpha2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/dataform/v1alpha2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha2",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dataform/v1alpha2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_dataform//apiv1alpha2/dataformpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/dataform/v1beta1/BUILD.bazel b/googleapis/cloud/dataform/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/dataform/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/dataform/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dataform/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_dataform//apiv1beta1/dataformpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/datafusion/v1/BUILD.bazel b/googleapis/cloud/datafusion/v1/BUILD.bazel
+--- a/googleapis/cloud/datafusion/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/datafusion/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "datafusion",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datafusion/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_datafusion//apiv1/datafusionpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":datafusion",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/datafusion/v1beta1/BUILD.bazel b/googleapis/cloud/datafusion/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/datafusion/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/datafusion/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["v1beta1.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datafusion/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/iam/v1:iam",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/datalabeling/v1beta1/BUILD.bazel b/googleapis/cloud/datalabeling/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/datalabeling/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/datalabeling/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datalabeling/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_datalabeling//apiv1beta1/datalabelingpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/datapipelines/logging/v1/BUILD.bazel b/googleapis/cloud/datapipelines/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/datapipelines/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/datapipelines/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["logging.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datapipelines/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/dataplex/v1/BUILD.bazel b/googleapis/cloud/dataplex/v1/BUILD.bazel
+--- a/googleapis/cloud/dataplex/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/dataplex/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "dataplex",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dataplex/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_dataplex//apiv1/dataplexpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":dataplex",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/dataproc/logging/BUILD.bazel b/googleapis/cloud/dataproc/logging/BUILD.bazel
+--- a/googleapis/cloud/dataproc/logging/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/dataproc/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["autoscaler_log.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dataproc/logging",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/dataproc/v1/BUILD.bazel b/googleapis/cloud/dataproc/v1/BUILD.bazel
+--- a/googleapis/cloud/dataproc/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/dataproc/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "dataproc",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dataproc/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_dataproc//apiv1/dataprocpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":dataproc",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/dataproc/v1beta2/BUILD.bazel b/googleapis/cloud/dataproc/v1beta2/BUILD.bazel
+--- a/googleapis/cloud/dataproc/v1beta2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/dataproc/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta2",
++ srcs = [
++ "autoscaling_policies.pb.go",
++ "clusters.pb.go",
++ "jobs.pb.go",
++ "operations.pb.go",
++ "shared.pb.go",
++ "workflow_templates.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dataproc/v1beta2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/dataqna/v1alpha/BUILD.bazel b/googleapis/cloud/dataqna/v1alpha/BUILD.bazel
+--- a/googleapis/cloud/dataqna/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/dataqna/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dataqna/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_dataqna//apiv1alpha/dataqnapb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/datastream/logging/v1/BUILD.bazel b/googleapis/cloud/datastream/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/datastream/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/datastream/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["datastream_logs.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datastream/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/datastream/v1/BUILD.bazel b/googleapis/cloud/datastream/v1/BUILD.bazel
+--- a/googleapis/cloud/datastream/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/datastream/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "datastream",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datastream/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_datastream//apiv1/datastreampb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":datastream",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/datastream/v1alpha1/BUILD.bazel b/googleapis/cloud/datastream/v1alpha1/BUILD.bazel
+--- a/googleapis/cloud/datastream/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/datastream/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/datastream/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_datastream//apiv1alpha1/datastreampb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/deploy/v1/BUILD.bazel b/googleapis/cloud/deploy/v1/BUILD.bazel
+--- a/googleapis/cloud/deploy/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/deploy/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "deploy",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/deploy/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_deploy//apiv1/deploypb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":deploy",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/dialogflow/cx/v3/BUILD.bazel b/googleapis/cloud/dialogflow/cx/v3/BUILD.bazel
+--- a/googleapis/cloud/dialogflow/cx/v3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/dialogflow/cx/v3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "cx",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_dialogflow//cx/apiv3/cxpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":cx",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/dialogflow/cx/v3beta1/BUILD.bazel b/googleapis/cloud/dialogflow/cx/v3beta1/BUILD.bazel
+--- a/googleapis/cloud/dialogflow/cx/v3beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/dialogflow/cx/v3beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v3beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dialogflow/cx/v3beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_dialogflow//cx/apiv3beta1/cxpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v3beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/dialogflow/v2/BUILD.bazel b/googleapis/cloud/dialogflow/v2/BUILD.bazel
+--- a/googleapis/cloud/dialogflow/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/dialogflow/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "dialogflow",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_dialogflow//apiv2/dialogflowpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":dialogflow",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/dialogflow/v2beta1/BUILD.bazel b/googleapis/cloud/dialogflow/v2beta1/BUILD.bazel
+--- a/googleapis/cloud/dialogflow/v2beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/dialogflow/v2beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v2beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/dialogflow/v2beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_dialogflow//apiv2beta1/dialogflowpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v2beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/documentai/v1/BUILD.bazel b/googleapis/cloud/documentai/v1/BUILD.bazel
+--- a/googleapis/cloud/documentai/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/documentai/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "documentai",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/documentai/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_documentai//apiv1/documentaipb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":documentai",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/documentai/v1beta1/BUILD.bazel b/googleapis/cloud/documentai/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/documentai/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/documentai/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = [
++ "document.pb.go",
++ "document_understanding.pb.go",
++ "geometry.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "//googleapis/type/color",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/documentai/v1beta2/BUILD.bazel b/googleapis/cloud/documentai/v1beta2/BUILD.bazel
+--- a/googleapis/cloud/documentai/v1beta2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/documentai/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta2",
++ srcs = [
++ "document.pb.go",
++ "document_understanding.pb.go",
++ "geometry.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "//googleapis/type/color",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/documentai/v1beta3/BUILD.bazel b/googleapis/cloud/documentai/v1beta3/BUILD.bazel
+--- a/googleapis/cloud/documentai/v1beta3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/documentai/v1beta3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta3",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/documentai/v1beta3",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_documentai//apiv1beta3/documentaipb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta3",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/domains/v1/BUILD.bazel b/googleapis/cloud/domains/v1/BUILD.bazel
+--- a/googleapis/cloud/domains/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/domains/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "domains",
++ srcs = ["domains.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/domains/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/type/money",
++ "//googleapis/type/postaladdress",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":domains",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/domains/v1alpha2/BUILD.bazel b/googleapis/cloud/domains/v1alpha2/BUILD.bazel
+--- a/googleapis/cloud/domains/v1alpha2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/domains/v1alpha2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha2",
++ srcs = ["domains.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/domains/v1alpha2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/type/money",
++ "//googleapis/type/postaladdress",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/domains/v1beta1/BUILD.bazel b/googleapis/cloud/domains/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/domains/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/domains/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/domains/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_domains//apiv1beta1/domainspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/edgecontainer/v1/BUILD.bazel b/googleapis/cloud/edgecontainer/v1/BUILD.bazel
+--- a/googleapis/cloud/edgecontainer/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/edgecontainer/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "edgecontainer",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/edgecontainer/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_edgecontainer//apiv1/edgecontainerpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":edgecontainer",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/enterpriseknowledgegraph/v1/BUILD.bazel b/googleapis/cloud/enterpriseknowledgegraph/v1/BUILD.bazel
+--- a/googleapis/cloud/enterpriseknowledgegraph/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/enterpriseknowledgegraph/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "enterpriseknowledgegraph",
++ srcs = [
++ "job_state.pb.go",
++ "operation_metadata.pb.go",
++ "service.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/enterpriseknowledgegraph/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":enterpriseknowledgegraph",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/essentialcontacts/v1/BUILD.bazel b/googleapis/cloud/essentialcontacts/v1/BUILD.bazel
+--- a/googleapis/cloud/essentialcontacts/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/essentialcontacts/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "essentialcontacts",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/essentialcontacts/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_essentialcontacts//apiv1/essentialcontactspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":essentialcontacts",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/eventarc/publishing/v1/BUILD.bazel b/googleapis/cloud/eventarc/publishing/v1/BUILD.bazel
+--- a/googleapis/cloud/eventarc/publishing/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/eventarc/publishing/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "publishing",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/eventarc/publishing/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_eventarc//publishing/apiv1/publishingpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":publishing",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/eventarc/v1/BUILD.bazel b/googleapis/cloud/eventarc/v1/BUILD.bazel
+--- a/googleapis/cloud/eventarc/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/eventarc/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "eventarc",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/eventarc/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_eventarc//apiv1/eventarcpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":eventarc",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/extendedops/BUILD.bazel b/googleapis/cloud/extendedops/BUILD.bazel
+--- a/googleapis/cloud/extendedops/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/extendedops/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "extendedops",
++ srcs = ["extended_operations.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/extendedops",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/descriptorpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":extendedops",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/filestore/v1/BUILD.bazel b/googleapis/cloud/filestore/v1/BUILD.bazel
+--- a/googleapis/cloud/filestore/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/filestore/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "filestore",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/filestore/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_filestore//apiv1/filestorepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":filestore",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/filestore/v1beta1/BUILD.bazel b/googleapis/cloud/filestore/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/filestore/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/filestore/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["cloud_filestore_service.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/filestore/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/cloud/common",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/functions/v1/BUILD.bazel b/googleapis/cloud/functions/v1/BUILD.bazel
+--- a/googleapis/cloud/functions/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/functions/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "functions",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/functions/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_functions//apiv1/functionspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":functions",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/functions/v1beta2/BUILD.bazel b/googleapis/cloud/functions/v1beta2/BUILD.bazel
+--- a/googleapis/cloud/functions/v1beta2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/functions/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta2",
++ srcs = [
++ "functions.pb.go",
++ "operations.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/functions/v1beta2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@com_github_golang_protobuf//proto:go_default_library",
++ "@com_github_golang_protobuf//ptypes/any:go_default_library",
++ "@com_github_golang_protobuf//ptypes/duration:go_default_library",
++ "@com_github_golang_protobuf//ptypes/timestamp: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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/functions/v2/BUILD.bazel b/googleapis/cloud/functions/v2/BUILD.bazel
+--- a/googleapis/cloud/functions/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/functions/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "functions",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/functions/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_functions//apiv2/functionspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":functions",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/functions/v2alpha/BUILD.bazel b/googleapis/cloud/functions/v2alpha/BUILD.bazel
+--- a/googleapis/cloud/functions/v2alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/functions/v2alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v2alpha",
++ srcs = ["functions.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/functions/v2alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v2alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/functions/v2beta/BUILD.bazel b/googleapis/cloud/functions/v2beta/BUILD.bazel
+--- a/googleapis/cloud/functions/v2beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/functions/v2beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v2beta",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/functions/v2beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_functions//apiv2beta/functionspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v2beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gaming/allocationendpoint/v1alpha/BUILD.bazel b/googleapis/cloud/gaming/allocationendpoint/v1alpha/BUILD.bazel
+--- a/googleapis/cloud/gaming/allocationendpoint/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gaming/allocationendpoint/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = ["allocation_endpoint.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gaming/allocationendpoint/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gaming/v1/BUILD.bazel b/googleapis/cloud/gaming/v1/BUILD.bazel
+--- a/googleapis/cloud/gaming/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gaming/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "gaming",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gaming/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_gaming//apiv1/gamingpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gaming",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gaming/v1beta/BUILD.bazel b/googleapis/cloud/gaming/v1beta/BUILD.bazel
+--- a/googleapis/cloud/gaming/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gaming/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gaming/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_gaming//apiv1beta/gamingpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkebackup/logging/v1/BUILD.bazel b/googleapis/cloud/gkebackup/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/gkebackup/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkebackup/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = [
++ "logged_backup.pb.go",
++ "logged_backup_plan.pb.go",
++ "logged_common.pb.go",
++ "logged_restore.pb.go",
++ "logged_restore_plan.pb.go",
++ "logging.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkebackup/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkebackup/v1/BUILD.bazel b/googleapis/cloud/gkebackup/v1/BUILD.bazel
+--- a/googleapis/cloud/gkebackup/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkebackup/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "gkebackup",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkebackup/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_gkebackup//apiv1/gkebackuppb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gkebackup",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkeconnect/gateway/v1/BUILD.bazel b/googleapis/cloud/gkeconnect/gateway/v1/BUILD.bazel
+--- a/googleapis/cloud/gkeconnect/gateway/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkeconnect/gateway/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "gateway",
++ srcs = ["gateway.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkeconnect/gateway/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@org_golang_google_grpc//:go_default_library",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gateway",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkeconnect/gateway/v1alpha1/BUILD.bazel b/googleapis/cloud/gkeconnect/gateway/v1alpha1/BUILD.bazel
+--- a/googleapis/cloud/gkeconnect/gateway/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkeconnect/gateway/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = ["gateway.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkeconnect/gateway/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@org_golang_google_grpc//:go_default_library",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkeconnect/gateway/v1beta1/BUILD.bazel b/googleapis/cloud/gkeconnect/gateway/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/gkeconnect/gateway/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkeconnect/gateway/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkeconnect/gateway/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_gkeconnect//gateway/apiv1beta1/gatewaypb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkehub/cloudauditlogging/v1alpha/BUILD.bazel b/googleapis/cloud/gkehub/cloudauditlogging/v1alpha/BUILD.bazel
+--- a/googleapis/cloud/gkehub/cloudauditlogging/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkehub/cloudauditlogging/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = ["cloudauditlogging.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/cloudauditlogging/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkehub/configmanagement/v1/BUILD.bazel b/googleapis/cloud/gkehub/configmanagement/v1/BUILD.bazel
+--- a/googleapis/cloud/gkehub/configmanagement/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkehub/configmanagement/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "configmanagement",
++ srcs = ["configmanagement.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/configmanagement/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":configmanagement",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkehub/configmanagement/v1alpha/BUILD.bazel b/googleapis/cloud/gkehub/configmanagement/v1alpha/BUILD.bazel
+--- a/googleapis/cloud/gkehub/configmanagement/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkehub/configmanagement/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = ["configmanagement.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/configmanagement/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkehub/configmanagement/v1beta/BUILD.bazel b/googleapis/cloud/gkehub/configmanagement/v1beta/BUILD.bazel
+--- a/googleapis/cloud/gkehub/configmanagement/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkehub/configmanagement/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = ["configmanagement.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/configmanagement/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkehub/metering/v1alpha/BUILD.bazel b/googleapis/cloud/gkehub/metering/v1alpha/BUILD.bazel
+--- a/googleapis/cloud/gkehub/metering/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkehub/metering/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = ["metering.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/metering/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkehub/metering/v1beta/BUILD.bazel b/googleapis/cloud/gkehub/metering/v1beta/BUILD.bazel
+--- a/googleapis/cloud/gkehub/metering/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkehub/metering/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = ["metering.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/metering/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkehub/multiclusteringress/v1/BUILD.bazel b/googleapis/cloud/gkehub/multiclusteringress/v1/BUILD.bazel
+--- a/googleapis/cloud/gkehub/multiclusteringress/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkehub/multiclusteringress/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "multiclusteringress",
++ srcs = ["multiclusteringress.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/multiclusteringress/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":multiclusteringress",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkehub/multiclusteringress/v1alpha/BUILD.bazel b/googleapis/cloud/gkehub/multiclusteringress/v1alpha/BUILD.bazel
+--- a/googleapis/cloud/gkehub/multiclusteringress/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkehub/multiclusteringress/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = ["multiclusteringress.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/multiclusteringress/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkehub/multiclusteringress/v1beta/BUILD.bazel b/googleapis/cloud/gkehub/multiclusteringress/v1beta/BUILD.bazel
+--- a/googleapis/cloud/gkehub/multiclusteringress/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkehub/multiclusteringress/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = ["multiclusteringress.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/multiclusteringress/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkehub/servicemesh/v1alpha/BUILD.bazel b/googleapis/cloud/gkehub/servicemesh/v1alpha/BUILD.bazel
+--- a/googleapis/cloud/gkehub/servicemesh/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkehub/servicemesh/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = ["servicemesh.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/servicemesh/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkehub/v1/BUILD.bazel b/googleapis/cloud/gkehub/v1/BUILD.bazel
+--- a/googleapis/cloud/gkehub/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkehub/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "gkehub",
++ srcs = [
++ "feature.pb.go",
++ "membership.pb.go",
++ "service.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/cloud/gkehub/configmanagement/v1:configmanagement",
++ "//googleapis/cloud/gkehub/multiclusteringress/v1:multiclusteringress",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gkehub",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkehub/v1alpha/BUILD.bazel b/googleapis/cloud/gkehub/v1alpha/BUILD.bazel
+--- a/googleapis/cloud/gkehub/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkehub/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = [
++ "feature.pb.go",
++ "service.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/cloud/gkehub/cloudauditlogging/v1alpha",
++ "//googleapis/cloud/gkehub/configmanagement/v1alpha",
++ "//googleapis/cloud/gkehub/metering/v1alpha",
++ "//googleapis/cloud/gkehub/multiclusteringress/v1alpha",
++ "//googleapis/cloud/gkehub/servicemesh/v1alpha",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkehub/v1alpha2/BUILD.bazel b/googleapis/cloud/gkehub/v1alpha2/BUILD.bazel
+--- a/googleapis/cloud/gkehub/v1alpha2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkehub/v1alpha2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha2",
++ srcs = ["membership.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/v1alpha2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkehub/v1beta/BUILD.bazel b/googleapis/cloud/gkehub/v1beta/BUILD.bazel
+--- a/googleapis/cloud/gkehub/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkehub/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = [
++ "feature.pb.go",
++ "service.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/cloud/gkehub/configmanagement/v1beta",
++ "//googleapis/cloud/gkehub/metering/v1beta",
++ "//googleapis/cloud/gkehub/multiclusteringress/v1beta",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkehub/v1beta1/BUILD.bazel b/googleapis/cloud/gkehub/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/gkehub/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkehub/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkehub/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_gkehub//apiv1beta1/gkehubpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gkemulticloud/v1/BUILD.bazel b/googleapis/cloud/gkemulticloud/v1/BUILD.bazel
+--- a/googleapis/cloud/gkemulticloud/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gkemulticloud/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "gkemulticloud",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gkemulticloud/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_gkemulticloud//apiv1/gkemulticloudpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gkemulticloud",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gsuiteaddons/logging/v1/BUILD.bazel b/googleapis/cloud/gsuiteaddons/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/gsuiteaddons/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gsuiteaddons/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["g_suite_add_ons_log_entry.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/gsuiteaddons/v1/BUILD.bazel b/googleapis/cloud/gsuiteaddons/v1/BUILD.bazel
+--- a/googleapis/cloud/gsuiteaddons/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/gsuiteaddons/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "gsuiteaddons",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/gsuiteaddons/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_gsuiteaddons//apiv1/gsuiteaddonspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gsuiteaddons",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/healthcare/logging/BUILD.bazel b/googleapis/cloud/healthcare/logging/BUILD.bazel
+--- a/googleapis/cloud/healthcare/logging/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/healthcare/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = [
++ "annotation.pb.go",
++ "consent.pb.go",
++ "deid.pb.go",
++ "dicom.pb.go",
++ "fhir.pb.go",
++ "hl7v2.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/healthcare/logging",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/iap/v1/BUILD.bazel b/googleapis/cloud/iap/v1/BUILD.bazel
+--- a/googleapis/cloud/iap/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/iap/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "iap",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/iap/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_iap//apiv1/iappb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":iap",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/iap/v1beta1/BUILD.bazel b/googleapis/cloud/iap/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/iap/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/iap/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["service.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/iap/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/iam/v1:iam",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/identitytoolkit/logging/BUILD.bazel b/googleapis/cloud/identitytoolkit/logging/BUILD.bazel
+--- a/googleapis/cloud/identitytoolkit/logging/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/identitytoolkit/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["request_log.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/identitytoolkit/logging",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/identitytoolkit/v2/BUILD.bazel b/googleapis/cloud/identitytoolkit/v2/BUILD.bazel
+--- a/googleapis/cloud/identitytoolkit/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/identitytoolkit/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "identitytoolkit",
++ srcs = [
++ "account_management_service.pb.go",
++ "authentication_service.pb.go",
++ "mfa_info.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/identitytoolkit/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":identitytoolkit",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/ids/logging/v1/BUILD.bazel b/googleapis/cloud/ids/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/ids/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/ids/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["logging.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/ids/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/ids/v1/BUILD.bazel b/googleapis/cloud/ids/v1/BUILD.bazel
+--- a/googleapis/cloud/ids/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/ids/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "ids",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/ids/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_ids//apiv1/idspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":ids",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/integrations/v1alpha/BUILD.bazel b/googleapis/cloud/integrations/v1alpha/BUILD.bazel
+--- a/googleapis/cloud/integrations/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/integrations/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = [
++ "event_parameter.pb.go",
++ "json_validation.pb.go",
++ "log_entries.pb.go",
++ "product.pb.go",
++ "task_config.pb.go",
++ "value_type.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/integrations/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/iot/v1/BUILD.bazel b/googleapis/cloud/iot/v1/BUILD.bazel
+--- a/googleapis/cloud/iot/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/iot/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "iot",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/iot/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_iot//apiv1/iotpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":iot",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/irm/v1alpha2/BUILD.bazel b/googleapis/cloud/irm/v1alpha2/BUILD.bazel
+--- a/googleapis/cloud/irm/v1alpha2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/irm/v1alpha2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha2",
++ srcs = [
++ "incidents.pb.go",
++ "incidents_service.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/irm/v1alpha2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//protobuf/field_mask",
++ "@com_github_golang_protobuf//proto:go_default_library",
++ "@com_github_golang_protobuf//ptypes/empty:go_default_library",
++ "@com_github_golang_protobuf//ptypes/timestamp: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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/kms/v1/BUILD.bazel b/googleapis/cloud/kms/v1/BUILD.bazel
+--- a/googleapis/cloud/kms/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/kms/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "kms",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/kms/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_kms//apiv1/kmspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":kms",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/kubernetes/security/containersecurity_logging/BUILD.bazel b/googleapis/cloud/kubernetes/security/containersecurity_logging/BUILD.bazel
+--- a/googleapis/cloud/kubernetes/security/containersecurity_logging/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/kubernetes/security/containersecurity_logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "containersecurity_logging",
++ srcs = ["logging.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/kubernetes/security/containersecurity_logging",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":containersecurity_logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/language/v1/BUILD.bazel b/googleapis/cloud/language/v1/BUILD.bazel
+--- a/googleapis/cloud/language/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/language/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "language",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/language/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_language//apiv1/languagepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":language",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/language/v1beta1/BUILD.bazel b/googleapis/cloud/language/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/language/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/language/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["language_service.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/language/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/language/v1beta2/BUILD.bazel b/googleapis/cloud/language/v1beta2/BUILD.bazel
+--- a/googleapis/cloud/language/v1beta2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/language/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta2",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/language/v1beta2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_language//apiv1beta2/languagepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/lifesciences/v2beta/BUILD.bazel b/googleapis/cloud/lifesciences/v2beta/BUILD.bazel
+--- a/googleapis/cloud/lifesciences/v2beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/lifesciences/v2beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v2beta",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/lifesciences/v2beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_lifesciences//apiv2beta/lifesciencespb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v2beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/location/BUILD.bazel b/googleapis/cloud/location/BUILD.bazel
+--- a/googleapis/cloud/location/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/location/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "location",
++ srcs = ["locations.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/location",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":location",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/managedidentities/v1/BUILD.bazel b/googleapis/cloud/managedidentities/v1/BUILD.bazel
+--- a/googleapis/cloud/managedidentities/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/managedidentities/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "managedidentities",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/managedidentities/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_managedidentities//apiv1/managedidentitiespb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":managedidentities",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/managedidentities/v1beta1/BUILD.bazel b/googleapis/cloud/managedidentities/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/managedidentities/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/managedidentities/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = [
++ "managed_identities_service.pb.go",
++ "resource.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/managedidentities/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/mediatranslation/v1alpha1/BUILD.bazel b/googleapis/cloud/mediatranslation/v1alpha1/BUILD.bazel
+--- a/googleapis/cloud/mediatranslation/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/mediatranslation/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = ["media_translation.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/mediatranslation/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/mediatranslation/v1beta1/BUILD.bazel b/googleapis/cloud/mediatranslation/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/mediatranslation/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/mediatranslation/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/mediatranslation/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_mediatranslation//apiv1beta1/mediatranslationpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/memcache/v1/BUILD.bazel b/googleapis/cloud/memcache/v1/BUILD.bazel
+--- a/googleapis/cloud/memcache/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/memcache/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "memcache",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/memcache/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_memcache//apiv1/memcachepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":memcache",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/memcache/v1beta2/BUILD.bazel b/googleapis/cloud/memcache/v1beta2/BUILD.bazel
+--- a/googleapis/cloud/memcache/v1beta2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/memcache/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta2",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/memcache/v1beta2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_memcache//apiv1beta2/memcachepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/metastore/logging/v1/BUILD.bazel b/googleapis/cloud/metastore/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/metastore/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/metastore/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["log_streams.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/metastore/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/metastore/v1/BUILD.bazel b/googleapis/cloud/metastore/v1/BUILD.bazel
+--- a/googleapis/cloud/metastore/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/metastore/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "metastore",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/metastore/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_metastore//apiv1/metastorepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":metastore",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/metastore/v1alpha/BUILD.bazel b/googleapis/cloud/metastore/v1alpha/BUILD.bazel
+--- a/googleapis/cloud/metastore/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/metastore/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/metastore/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_metastore//apiv1alpha/metastorepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/metastore/v1beta/BUILD.bazel b/googleapis/cloud/metastore/v1beta/BUILD.bazel
+--- a/googleapis/cloud/metastore/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/metastore/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/metastore/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_metastore//apiv1beta/metastorepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/ml/v1/BUILD.bazel b/googleapis/cloud/ml/v1/BUILD.bazel
+--- a/googleapis/cloud/ml/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/ml/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "ml",
++ srcs = [
++ "job_service.pb.go",
++ "model_service.pb.go",
++ "operation_metadata.pb.go",
++ "prediction_service.pb.go",
++ "project_service.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/ml/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/api/httpbody",
++ "//googleapis/api/serviceconfig",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":ml",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/networkanalyzer/logging/v1/BUILD.bazel b/googleapis/cloud/networkanalyzer/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/networkanalyzer/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/networkanalyzer/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["analyzer_log.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networkanalyzer/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/networkconnectivity/v1/BUILD.bazel b/googleapis/cloud/networkconnectivity/v1/BUILD.bazel
+--- a/googleapis/cloud/networkconnectivity/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/networkconnectivity/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "networkconnectivity",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_networkconnectivity//apiv1/networkconnectivitypb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":networkconnectivity",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/networkconnectivity/v1alpha1/BUILD.bazel b/googleapis/cloud/networkconnectivity/v1alpha1/BUILD.bazel
+--- a/googleapis/cloud/networkconnectivity/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/networkconnectivity/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networkconnectivity/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_networkconnectivity//apiv1alpha1/networkconnectivitypb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/networkmanagement/v1/BUILD.bazel b/googleapis/cloud/networkmanagement/v1/BUILD.bazel
+--- a/googleapis/cloud/networkmanagement/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/networkmanagement/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "networkmanagement",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networkmanagement/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_networkmanagement//apiv1/networkmanagementpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":networkmanagement",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/networkmanagement/v1beta1/BUILD.bazel b/googleapis/cloud/networkmanagement/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/networkmanagement/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/networkmanagement/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = [
++ "connectivity_test.pb.go",
++ "reachability.pb.go",
++ "trace.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networkmanagement/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/networksecurity/v1/BUILD.bazel b/googleapis/cloud/networksecurity/v1/BUILD.bazel
+--- a/googleapis/cloud/networksecurity/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/networksecurity/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "networksecurity",
++ srcs = [
++ "authorization_policy.pb.go",
++ "client_tls_policy.pb.go",
++ "common.pb.go",
++ "network_security.pb.go",
++ "server_tls_policy.pb.go",
++ "tls.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networksecurity/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":networksecurity",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/networksecurity/v1beta1/BUILD.bazel b/googleapis/cloud/networksecurity/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/networksecurity/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/networksecurity/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networksecurity/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_networksecurity//apiv1beta1/networksecuritypb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/networkservices/v1/BUILD.bazel b/googleapis/cloud/networkservices/v1/BUILD.bazel
+--- a/googleapis/cloud/networkservices/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/networkservices/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "networkservices",
++ srcs = [
++ "common.pb.go",
++ "endpoint_policy.pb.go",
++ "gateway.pb.go",
++ "grpc_route.pb.go",
++ "http_route.pb.go",
++ "mesh.pb.go",
++ "network_services.pb.go",
++ "service_binding.pb.go",
++ "tcp_route.pb.go",
++ "tls_route.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networkservices/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":networkservices",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/networkservices/v1beta1/BUILD.bazel b/googleapis/cloud/networkservices/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/networkservices/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/networkservices/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = [
++ "common.pb.go",
++ "endpoint_policy.pb.go",
++ "network_services.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/networkservices/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/notebooks/logging/v1/BUILD.bazel b/googleapis/cloud/notebooks/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/notebooks/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/notebooks/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["runtime_log.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/notebooks/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/notebooks/v1/BUILD.bazel b/googleapis/cloud/notebooks/v1/BUILD.bazel
+--- a/googleapis/cloud/notebooks/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/notebooks/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "notebooks",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/notebooks/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_notebooks//apiv1/notebookspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":notebooks",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/notebooks/v1beta1/BUILD.bazel b/googleapis/cloud/notebooks/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/notebooks/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/notebooks/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/notebooks/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_notebooks//apiv1beta1/notebookspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/optimization/v1/BUILD.bazel b/googleapis/cloud/optimization/v1/BUILD.bazel
+--- a/googleapis/cloud/optimization/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/optimization/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "optimization",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/optimization/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_optimization//apiv1/optimizationpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":optimization",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/orchestration/airflow/service/v1/BUILD.bazel b/googleapis/cloud/orchestration/airflow/service/v1/BUILD.bazel
+--- a/googleapis/cloud/orchestration/airflow/service/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/orchestration/airflow/service/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "service",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/orchestration/airflow/service/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_orchestration//airflow/service/apiv1/servicepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":service",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/orchestration/airflow/service/v1beta1/BUILD.bazel b/googleapis/cloud/orchestration/airflow/service/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/orchestration/airflow/service/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/orchestration/airflow/service/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = [
++ "environments.pb.go",
++ "image_versions.pb.go",
++ "operations.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/orchestration/airflow/service/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/type/date",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/orgpolicy/v1/BUILD.bazel b/googleapis/cloud/orgpolicy/v1/BUILD.bazel
+--- a/googleapis/cloud/orgpolicy/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/orgpolicy/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "orgpolicy",
++ srcs = ["orgpolicy.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/orgpolicy/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":orgpolicy",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/orgpolicy/v2/BUILD.bazel b/googleapis/cloud/orgpolicy/v2/BUILD.bazel
+--- a/googleapis/cloud/orgpolicy/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/orgpolicy/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "orgpolicy",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/orgpolicy/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_orgpolicy//apiv2/orgpolicypb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":orgpolicy",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/osconfig/agentendpoint/v1/BUILD.bazel b/googleapis/cloud/osconfig/agentendpoint/v1/BUILD.bazel
+--- a/googleapis/cloud/osconfig/agentendpoint/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/osconfig/agentendpoint/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "agentendpoint",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/agentendpoint/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_osconfig//agentendpoint/apiv1/agentendpointpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":agentendpoint",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel b/googleapis/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel
+--- a/googleapis/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/osconfig/agentendpoint/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/agentendpoint/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_osconfig//agentendpoint/apiv1beta/agentendpointpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/osconfig/logging/BUILD.bazel b/googleapis/cloud/osconfig/logging/BUILD.bazel
+--- a/googleapis/cloud/osconfig/logging/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/osconfig/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["patch_job_log.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/logging",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/osconfig/v1/BUILD.bazel b/googleapis/cloud/osconfig/v1/BUILD.bazel
+--- a/googleapis/cloud/osconfig/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/osconfig/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "osconfig",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_osconfig//apiv1/osconfigpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":osconfig",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/osconfig/v1alpha/BUILD.bazel b/googleapis/cloud/osconfig/v1alpha/BUILD.bazel
+--- a/googleapis/cloud/osconfig/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/osconfig/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_osconfig//apiv1alpha/osconfigpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/osconfig/v1beta/BUILD.bazel b/googleapis/cloud/osconfig/v1beta/BUILD.bazel
+--- a/googleapis/cloud/osconfig/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/osconfig/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/osconfig/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_osconfig//apiv1beta/osconfigpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/oslogin/common/BUILD.bazel b/googleapis/cloud/oslogin/common/BUILD.bazel
+--- a/googleapis/cloud/oslogin/common/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/oslogin/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "common",
++ srcs = ["common.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/oslogin/common",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":common",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/oslogin/v1/BUILD.bazel b/googleapis/cloud/oslogin/v1/BUILD.bazel
+--- a/googleapis/cloud/oslogin/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/oslogin/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "oslogin",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/oslogin/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_oslogin//apiv1/osloginpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":oslogin",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/oslogin/v1alpha/BUILD.bazel b/googleapis/cloud/oslogin/v1alpha/BUILD.bazel
+--- a/googleapis/cloud/oslogin/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/oslogin/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = ["oslogin.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/oslogin/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/cloud/oslogin/common",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/oslogin/v1beta/BUILD.bazel b/googleapis/cloud/oslogin/v1beta/BUILD.bazel
+--- a/googleapis/cloud/oslogin/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/oslogin/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/oslogin/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_oslogin//apiv1beta/osloginpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/paymentgateway/issuerswitch/v1/BUILD.bazel b/googleapis/cloud/paymentgateway/issuerswitch/v1/BUILD.bazel
+--- a/googleapis/cloud/paymentgateway/issuerswitch/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/paymentgateway/issuerswitch/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "issuerswitch",
++ srcs = [
++ "common_fields.pb.go",
++ "logs.pb.go",
++ "resolutions.pb.go",
++ "rules.pb.go",
++ "transactions.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/paymentgateway/issuerswitch/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/logging/type",
++ "//googleapis/longrunning",
++ "//googleapis/type/date",
++ "//googleapis/type/latlng",
++ "//googleapis/type/money",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issuerswitch",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/phishingprotection/v1beta1/BUILD.bazel b/googleapis/cloud/phishingprotection/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/phishingprotection/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/phishingprotection/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/phishingprotection/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_phishingprotection//apiv1beta1/phishingprotectionpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/policytroubleshooter/v1/BUILD.bazel b/googleapis/cloud/policytroubleshooter/v1/BUILD.bazel
+--- a/googleapis/cloud/policytroubleshooter/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/policytroubleshooter/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "policytroubleshooter",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/policytroubleshooter/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_policytroubleshooter//apiv1/policytroubleshooterpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":policytroubleshooter",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/privatecatalog/v1beta1/BUILD.bazel b/googleapis/cloud/privatecatalog/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/privatecatalog/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/privatecatalog/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/privatecatalog/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_privatecatalog//apiv1beta1/privatecatalogpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/pubsublite/v1/BUILD.bazel b/googleapis/cloud/pubsublite/v1/BUILD.bazel
+--- a/googleapis/cloud/pubsublite/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/pubsublite/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "pubsublite",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/pubsublite/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_pubsublite//apiv1/pubsublitepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":pubsublite",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/recaptchaenterprise/v1/BUILD.bazel b/googleapis/cloud/recaptchaenterprise/v1/BUILD.bazel
+--- a/googleapis/cloud/recaptchaenterprise/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/recaptchaenterprise/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "recaptchaenterprise",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_recaptchaenterprise_v2//apiv1/recaptchaenterprisepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":recaptchaenterprise",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/recaptchaenterprise/v1beta1/BUILD.bazel b/googleapis/cloud/recaptchaenterprise/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/recaptchaenterprise/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/recaptchaenterprise/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/recaptchaenterprise/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_recaptchaenterprise_v2//apiv1beta1/recaptchaenterprisepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/recommendationengine/v1beta1/BUILD.bazel b/googleapis/cloud/recommendationengine/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/recommendationengine/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/recommendationengine/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/recommendationengine/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_recommendationengine//apiv1beta1/recommendationenginepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/recommender/logging/v1/BUILD.bazel b/googleapis/cloud/recommender/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/recommender/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/recommender/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["action_log.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/recommender/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/cloud/recommender/v1:recommender",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/recommender/logging/v1beta1/BUILD.bazel b/googleapis/cloud/recommender/logging/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/recommender/logging/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/recommender/logging/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["action_log.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/recommender/logging/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/cloud/recommender/v1beta1",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/recommender/v1/BUILD.bazel b/googleapis/cloud/recommender/v1/BUILD.bazel
+--- a/googleapis/cloud/recommender/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/recommender/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "recommender",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/recommender/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_recommender//apiv1/recommenderpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":recommender",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/recommender/v1beta1/BUILD.bazel b/googleapis/cloud/recommender/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/recommender/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/recommender/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/recommender/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_recommender//apiv1beta1/recommenderpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/redis/v1/BUILD.bazel b/googleapis/cloud/redis/v1/BUILD.bazel
+--- a/googleapis/cloud/redis/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/redis/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "redis",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/redis/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_redis//apiv1/redispb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":redis",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/redis/v1beta1/BUILD.bazel b/googleapis/cloud/redis/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/redis/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/redis/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/redis/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_redis//apiv1beta1/redispb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/resourcemanager/v2/BUILD.bazel b/googleapis/cloud/resourcemanager/v2/BUILD.bazel
+--- a/googleapis/cloud/resourcemanager/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/resourcemanager/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "resourcemanager",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/resourcemanager/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_resourcemanager//apiv2/resourcemanagerpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":resourcemanager",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/resourcemanager/v3/BUILD.bazel b/googleapis/cloud/resourcemanager/v3/BUILD.bazel
+--- a/googleapis/cloud/resourcemanager/v3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/resourcemanager/v3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "resourcemanager",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_resourcemanager//apiv3/resourcemanagerpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":resourcemanager",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/resourcesettings/v1/BUILD.bazel b/googleapis/cloud/resourcesettings/v1/BUILD.bazel
+--- a/googleapis/cloud/resourcesettings/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/resourcesettings/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "resourcesettings",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/resourcesettings/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_resourcesettings//apiv1/resourcesettingspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":resourcesettings",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/retail/logging/BUILD.bazel b/googleapis/cloud/retail/logging/BUILD.bazel
+--- a/googleapis/cloud/retail/logging/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/retail/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["error_log.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/retail/logging",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/retail/v2/BUILD.bazel b/googleapis/cloud/retail/v2/BUILD.bazel
+--- a/googleapis/cloud/retail/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/retail/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "retail",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/retail/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_retail//apiv2/retailpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":retail",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/retail/v2alpha/BUILD.bazel b/googleapis/cloud/retail/v2alpha/BUILD.bazel
+--- a/googleapis/cloud/retail/v2alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/retail/v2alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v2alpha",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/retail/v2alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_retail//apiv2alpha/retailpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v2alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/retail/v2beta/BUILD.bazel b/googleapis/cloud/retail/v2beta/BUILD.bazel
+--- a/googleapis/cloud/retail/v2beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/retail/v2beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v2beta",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/retail/v2beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_retail//apiv2beta/retailpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v2beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/run/v2/BUILD.bazel b/googleapis/cloud/run/v2/BUILD.bazel
+--- a/googleapis/cloud/run/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/run/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "run",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/run/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_run//apiv2/runpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":run",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/runtimeconfig/v1beta1/BUILD.bazel b/googleapis/cloud/runtimeconfig/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/runtimeconfig/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/runtimeconfig/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = [
++ "resources.pb.go",
++ "runtimeconfig.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/runtimeconfig/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/saasaccelerator/management/logs/v1/BUILD.bazel b/googleapis/cloud/saasaccelerator/management/logs/v1/BUILD.bazel
+--- a/googleapis/cloud/saasaccelerator/management/logs/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/saasaccelerator/management/logs/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logs",
++ srcs = [
++ "notification_service_payload.pb.go",
++ "saas_instance_payload.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/saasaccelerator/management/logs/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logs",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/scheduler/v1/BUILD.bazel b/googleapis/cloud/scheduler/v1/BUILD.bazel
+--- a/googleapis/cloud/scheduler/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/scheduler/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "scheduler",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/scheduler/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_scheduler//apiv1/schedulerpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":scheduler",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/scheduler/v1beta1/BUILD.bazel b/googleapis/cloud/scheduler/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/scheduler/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/scheduler/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/scheduler/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_scheduler//apiv1beta1/schedulerpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/secretmanager/logging/v1/BUILD.bazel b/googleapis/cloud/secretmanager/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/secretmanager/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/secretmanager/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["secret_event.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/secretmanager/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/secretmanager/v1/BUILD.bazel b/googleapis/cloud/secretmanager/v1/BUILD.bazel
+--- a/googleapis/cloud/secretmanager/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/secretmanager/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "secretmanager",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/secretmanager/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_secretmanager//apiv1/secretmanagerpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":secretmanager",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/security/privateca/v1/BUILD.bazel b/googleapis/cloud/security/privateca/v1/BUILD.bazel
+--- a/googleapis/cloud/security/privateca/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/security/privateca/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "privateca",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/security/privateca/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_security//privateca/apiv1/privatecapb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":privateca",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/security/publicca/v1beta1/BUILD.bazel b/googleapis/cloud/security/publicca/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/security/publicca/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/security/publicca/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/security/publicca/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_security//publicca/apiv1beta1/publiccapb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/securitycenter/settings/v1beta1/BUILD.bazel b/googleapis/cloud/securitycenter/settings/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/securitycenter/settings/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/securitycenter/settings/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/securitycenter/settings/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_securitycenter//settings/apiv1beta1/settingspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/securitycenter/v1/BUILD.bazel b/googleapis/cloud/securitycenter/v1/BUILD.bazel
+--- a/googleapis/cloud/securitycenter/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/securitycenter/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "securitycenter",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_securitycenter//apiv1/securitycenterpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":securitycenter",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/securitycenter/v1beta1/BUILD.bazel b/googleapis/cloud/securitycenter/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/securitycenter/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/securitycenter/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_securitycenter//apiv1beta1/securitycenterpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/securitycenter/v1p1beta1/BUILD.bazel b/googleapis/cloud/securitycenter/v1p1beta1/BUILD.bazel
+--- a/googleapis/cloud/securitycenter/v1p1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/securitycenter/v1p1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1p1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/securitycenter/v1p1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_securitycenter//apiv1p1beta1/securitycenterpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1p1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/sensitiveaction/logging/v1/BUILD.bazel b/googleapis/cloud/sensitiveaction/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/sensitiveaction/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/sensitiveaction/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["sensitive_action_payload.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/sensitiveaction/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/cloud/securitycenter/v1:securitycenter",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/servicedirectory/v1/BUILD.bazel b/googleapis/cloud/servicedirectory/v1/BUILD.bazel
+--- a/googleapis/cloud/servicedirectory/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/servicedirectory/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "servicedirectory",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_servicedirectory//apiv1/servicedirectorypb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":servicedirectory",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/servicedirectory/v1beta1/BUILD.bazel b/googleapis/cloud/servicedirectory/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/servicedirectory/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/servicedirectory/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_servicedirectory//apiv1beta1/servicedirectorypb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/shell/v1/BUILD.bazel b/googleapis/cloud/shell/v1/BUILD.bazel
+--- a/googleapis/cloud/shell/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/shell/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "shell",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/shell/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_shell//apiv1/shellpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":shell",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/speech/v1/BUILD.bazel b/googleapis/cloud/speech/v1/BUILD.bazel
+--- a/googleapis/cloud/speech/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/speech/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "speech",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/speech/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_speech//apiv1/speechpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":speech",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/speech/v1p1beta1/BUILD.bazel b/googleapis/cloud/speech/v1p1beta1/BUILD.bazel
+--- a/googleapis/cloud/speech/v1p1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/speech/v1p1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1p1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/speech/v1p1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_speech//apiv1p1beta1/speechpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1p1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/speech/v2/BUILD.bazel b/googleapis/cloud/speech/v2/BUILD.bazel
+--- a/googleapis/cloud/speech/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/speech/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "speech",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/speech/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_speech//apiv2/speechpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":speech",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/sql/v1/BUILD.bazel b/googleapis/cloud/sql/v1/BUILD.bazel
+--- a/googleapis/cloud/sql/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/sql/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "sql",
++ srcs = [
++ "cloud_sql_backup_runs.pb.go",
++ "cloud_sql_connect.pb.go",
++ "cloud_sql_databases.pb.go",
++ "cloud_sql_flags.pb.go",
++ "cloud_sql_instance_names.pb.go",
++ "cloud_sql_instances.pb.go",
++ "cloud_sql_operations.pb.go",
++ "cloud_sql_resources.pb.go",
++ "cloud_sql_ssl_certs.pb.go",
++ "cloud_sql_tiers.pb.go",
++ "cloud_sql_users.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/sql/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sql",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/sql/v1beta4/BUILD.bazel b/googleapis/cloud/sql/v1beta4/BUILD.bazel
+--- a/googleapis/cloud/sql/v1beta4/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/sql/v1beta4/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta4",
++ srcs = [
++ "cloud_sql.pb.go",
++ "cloud_sql_connect.pb.go",
++ "cloud_sql_resources.pb.go",
++ "cloud_sql_tiers.pb.go",
++ "cloud_sql_users.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/sql/v1beta4",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta4",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/storageinsights/v1/BUILD.bazel b/googleapis/cloud/storageinsights/v1/BUILD.bazel
+--- a/googleapis/cloud/storageinsights/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/storageinsights/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "storageinsights",
++ srcs = ["storageinsights.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/storageinsights/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "//googleapis/type/date",
++ "//googleapis/type/datetime",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":storageinsights",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/stream/logging/v1/BUILD.bazel b/googleapis/cloud/stream/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/stream/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/stream/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["logging.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/stream/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/support/common/BUILD.bazel b/googleapis/cloud/support/common/BUILD.bazel
+--- a/googleapis/cloud/support/common/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/support/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "common",
++ srcs = ["common.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/support/common",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":common",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/support/v1alpha1/BUILD.bazel b/googleapis/cloud/support/v1alpha1/BUILD.bazel
+--- a/googleapis/cloud/support/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/support/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = ["cloud_support.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/support/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/cloud/support/common",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/talent/v4/BUILD.bazel b/googleapis/cloud/talent/v4/BUILD.bazel
+--- a/googleapis/cloud/talent/v4/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/talent/v4/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "talent",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/talent/v4",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_talent//apiv4/talentpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":talent",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/talent/v4beta1/BUILD.bazel b/googleapis/cloud/talent/v4beta1/BUILD.bazel
+--- a/googleapis/cloud/talent/v4beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/talent/v4beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v4beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/talent/v4beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_talent//apiv4beta1/talentpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v4beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/tasks/v2/BUILD.bazel b/googleapis/cloud/tasks/v2/BUILD.bazel
+--- a/googleapis/cloud/tasks/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/tasks/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "tasks",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/tasks/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_cloudtasks//apiv2/cloudtaskspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":tasks",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/tasks/v2beta2/BUILD.bazel b/googleapis/cloud/tasks/v2beta2/BUILD.bazel
+--- a/googleapis/cloud/tasks/v2beta2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/tasks/v2beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v2beta2",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_cloudtasks//apiv2beta2/cloudtaskspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v2beta2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/tasks/v2beta3/BUILD.bazel b/googleapis/cloud/tasks/v2beta3/BUILD.bazel
+--- a/googleapis/cloud/tasks/v2beta3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/tasks/v2beta3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v2beta3",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/tasks/v2beta3",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_cloudtasks//apiv2beta3/cloudtaskspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v2beta3",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/texttospeech/v1/BUILD.bazel b/googleapis/cloud/texttospeech/v1/BUILD.bazel
+--- a/googleapis/cloud/texttospeech/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/texttospeech/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "texttospeech",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/texttospeech/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_texttospeech//apiv1/texttospeechpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":texttospeech",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/texttospeech/v1beta1/BUILD.bazel b/googleapis/cloud/texttospeech/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/texttospeech/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/texttospeech/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = [
++ "cloud_tts.pb.go",
++ "cloud_tts_lrs.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/texttospeech/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/timeseriesinsights/v1/BUILD.bazel b/googleapis/cloud/timeseriesinsights/v1/BUILD.bazel
+--- a/googleapis/cloud/timeseriesinsights/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/timeseriesinsights/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "timeseriesinsights",
++ srcs = ["timeseries_insights.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/timeseriesinsights/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":timeseriesinsights",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/tpu/v1/BUILD.bazel b/googleapis/cloud/tpu/v1/BUILD.bazel
+--- a/googleapis/cloud/tpu/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/tpu/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "tpu",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/tpu/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_tpu//apiv1/tpupb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":tpu",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/tpu/v2/BUILD.bazel b/googleapis/cloud/tpu/v2/BUILD.bazel
+--- a/googleapis/cloud/tpu/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/tpu/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "tpu",
++ srcs = ["cloud_tpu.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/tpu/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":tpu",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/tpu/v2alpha1/BUILD.bazel b/googleapis/cloud/tpu/v2alpha1/BUILD.bazel
+--- a/googleapis/cloud/tpu/v2alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/tpu/v2alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v2alpha1",
++ srcs = ["cloud_tpu.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/tpu/v2alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "//googleapis/type/interval",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v2alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/translate/v3/BUILD.bazel b/googleapis/cloud/translate/v3/BUILD.bazel
+--- a/googleapis/cloud/translate/v3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/translate/v3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "translate",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/translate/v3",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_translate//apiv3/translatepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":translate",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/translate/v3beta1/BUILD.bazel b/googleapis/cloud/translate/v3beta1/BUILD.bazel
+--- a/googleapis/cloud/translate/v3beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/translate/v3beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v3beta1",
++ srcs = ["translation_service.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/translate/v3beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v3beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/video/livestream/logging/v1/BUILD.bazel b/googleapis/cloud/video/livestream/logging/v1/BUILD.bazel
+--- a/googleapis/cloud/video/livestream/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/video/livestream/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["logs.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/video/livestream/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/cloud/video/livestream/v1:livestream",
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/video/livestream/v1/BUILD.bazel b/googleapis/cloud/video/livestream/v1/BUILD.bazel
+--- a/googleapis/cloud/video/livestream/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/video/livestream/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "livestream",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/video/livestream/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_video//livestream/apiv1/livestreampb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":livestream",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/video/stitcher/v1/BUILD.bazel b/googleapis/cloud/video/stitcher/v1/BUILD.bazel
+--- a/googleapis/cloud/video/stitcher/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/video/stitcher/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "stitcher",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/video/stitcher/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_video//stitcher/apiv1/stitcherpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":stitcher",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/video/transcoder/v1/BUILD.bazel b/googleapis/cloud/video/transcoder/v1/BUILD.bazel
+--- a/googleapis/cloud/video/transcoder/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/video/transcoder/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "transcoder",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/video/transcoder/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_video//transcoder/apiv1/transcoderpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":transcoder",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/videointelligence/v1/BUILD.bazel b/googleapis/cloud/videointelligence/v1/BUILD.bazel
+--- a/googleapis/cloud/videointelligence/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/videointelligence/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "videointelligence",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_videointelligence//apiv1/videointelligencepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":videointelligence",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/videointelligence/v1beta2/BUILD.bazel b/googleapis/cloud/videointelligence/v1beta2/BUILD.bazel
+--- a/googleapis/cloud/videointelligence/v1beta2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/videointelligence/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta2",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1beta2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_videointelligence//apiv1beta2/videointelligencepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/videointelligence/v1p1beta1/BUILD.bazel b/googleapis/cloud/videointelligence/v1p1beta1/BUILD.bazel
+--- a/googleapis/cloud/videointelligence/v1p1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/videointelligence/v1p1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1p1beta1",
++ srcs = ["video_intelligence.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1p1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1p1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/videointelligence/v1p2beta1/BUILD.bazel b/googleapis/cloud/videointelligence/v1p2beta1/BUILD.bazel
+--- a/googleapis/cloud/videointelligence/v1p2beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/videointelligence/v1p2beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1p2beta1",
++ srcs = ["video_intelligence.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1p2beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1p2beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/videointelligence/v1p3beta1/BUILD.bazel b/googleapis/cloud/videointelligence/v1p3beta1/BUILD.bazel
+--- a/googleapis/cloud/videointelligence/v1p3beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/videointelligence/v1p3beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1p3beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/videointelligence/v1p3beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_videointelligence//apiv1p3beta1/videointelligencepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1p3beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/vision/v1/BUILD.bazel b/googleapis/cloud/vision/v1/BUILD.bazel
+--- a/googleapis/cloud/vision/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/vision/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "vision",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vision/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_vision_v2//apiv1/visionpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":vision",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/vision/v1p1beta1/BUILD.bazel b/googleapis/cloud/vision/v1p1beta1/BUILD.bazel
+--- a/googleapis/cloud/vision/v1p1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/vision/v1p1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1p1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vision/v1p1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_vision_v2//apiv1p1beta1/visionpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1p1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/vision/v1p2beta1/BUILD.bazel b/googleapis/cloud/vision/v1p2beta1/BUILD.bazel
+--- a/googleapis/cloud/vision/v1p2beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/vision/v1p2beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1p2beta1",
++ srcs = [
++ "geometry.pb.go",
++ "image_annotator.pb.go",
++ "text_annotation.pb.go",
++ "web_detection.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vision/v1p2beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "//googleapis/type/color",
++ "//googleapis/type/latlng",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1p2beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/vision/v1p3beta1/BUILD.bazel b/googleapis/cloud/vision/v1p3beta1/BUILD.bazel
+--- a/googleapis/cloud/vision/v1p3beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/vision/v1p3beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1p3beta1",
++ srcs = [
++ "geometry.pb.go",
++ "image_annotator.pb.go",
++ "product_search.pb.go",
++ "product_search_service.pb.go",
++ "text_annotation.pb.go",
++ "web_detection.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vision/v1p3beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "//googleapis/type/color",
++ "//googleapis/type/latlng",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1p3beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/vision/v1p4beta1/BUILD.bazel b/googleapis/cloud/vision/v1p4beta1/BUILD.bazel
+--- a/googleapis/cloud/vision/v1p4beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/vision/v1p4beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1p4beta1",
++ srcs = [
++ "face.pb.go",
++ "geometry.pb.go",
++ "image_annotator.pb.go",
++ "product_search.pb.go",
++ "product_search_service.pb.go",
++ "text_annotation.pb.go",
++ "web_detection.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vision/v1p4beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "//googleapis/type/color",
++ "//googleapis/type/latlng",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1p4beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/visionai/v1/BUILD.bazel b/googleapis/cloud/visionai/v1/BUILD.bazel
+--- a/googleapis/cloud/visionai/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/visionai/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,43 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "visionai",
++ srcs = [
++ "annotations.pb.go",
++ "common.pb.go",
++ "lva.pb.go",
++ "lva_resources.pb.go",
++ "lva_service.pb.go",
++ "platform.pb.go",
++ "streaming_resources.pb.go",
++ "streaming_service.pb.go",
++ "streams_resources.pb.go",
++ "streams_service.pb.go",
++ "warehouse.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/visionai/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "//googleapis/type/datetime",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":visionai",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/visionai/v1alpha1/BUILD.bazel b/googleapis/cloud/visionai/v1alpha1/BUILD.bazel
+--- a/googleapis/cloud/visionai/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/visionai/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,43 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = [
++ "annotations.pb.go",
++ "common.pb.go",
++ "lva.pb.go",
++ "lva_resources.pb.go",
++ "lva_service.pb.go",
++ "platform.pb.go",
++ "streaming_resources.pb.go",
++ "streaming_service.pb.go",
++ "streams_resources.pb.go",
++ "streams_service.pb.go",
++ "warehouse.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/visionai/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "//googleapis/type/datetime",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/visualinspection/v1beta1/BUILD.bazel b/googleapis/cloud/visualinspection/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/visualinspection/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/visualinspection/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,46 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = [
++ "annotation.pb.go",
++ "annotation_set.pb.go",
++ "annotation_spec.pb.go",
++ "common.pb.go",
++ "dataset.pb.go",
++ "geometry.pb.go",
++ "image.pb.go",
++ "io.pb.go",
++ "labeling.pb.go",
++ "metrics.pb.go",
++ "model.pb.go",
++ "model_evaluation.pb.go",
++ "module.pb.go",
++ "service.pb.go",
++ "solution_artifact.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/visualinspection/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/type/color",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/vmmigration/v1/BUILD.bazel b/googleapis/cloud/vmmigration/v1/BUILD.bazel
+--- a/googleapis/cloud/vmmigration/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/vmmigration/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "vmmigration",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vmmigration/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_vmmigration//apiv1/vmmigrationpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":vmmigration",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/vmwareengine/v1/BUILD.bazel b/googleapis/cloud/vmwareengine/v1/BUILD.bazel
+--- a/googleapis/cloud/vmwareengine/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/vmwareengine/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "vmwareengine",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vmwareengine/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_vmwareengine//apiv1/vmwareenginepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":vmwareengine",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/vpcaccess/v1/BUILD.bazel b/googleapis/cloud/vpcaccess/v1/BUILD.bazel
+--- a/googleapis/cloud/vpcaccess/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/vpcaccess/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "vpcaccess",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/vpcaccess/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_vpcaccess//apiv1/vpcaccesspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":vpcaccess",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/webrisk/v1/BUILD.bazel b/googleapis/cloud/webrisk/v1/BUILD.bazel
+--- a/googleapis/cloud/webrisk/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/webrisk/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "webrisk",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/webrisk/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_webrisk//apiv1/webriskpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":webrisk",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/webrisk/v1beta1/BUILD.bazel b/googleapis/cloud/webrisk/v1beta1/BUILD.bazel
+--- a/googleapis/cloud/webrisk/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/webrisk/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/webrisk/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_webrisk//apiv1beta1/webriskpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/websecurityscanner/v1/BUILD.bazel b/googleapis/cloud/websecurityscanner/v1/BUILD.bazel
+--- a/googleapis/cloud/websecurityscanner/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/websecurityscanner/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "websecurityscanner",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_websecurityscanner//apiv1/websecurityscannerpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":websecurityscanner",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/websecurityscanner/v1alpha/BUILD.bazel b/googleapis/cloud/websecurityscanner/v1alpha/BUILD.bazel
+--- a/googleapis/cloud/websecurityscanner/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/websecurityscanner/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = [
++ "crawled_url.pb.go",
++ "finding.pb.go",
++ "finding_addon.pb.go",
++ "finding_type_stats.pb.go",
++ "scan_config.pb.go",
++ "scan_run.pb.go",
++ "web_security_scanner.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/websecurityscanner/v1beta/BUILD.bazel b/googleapis/cloud/websecurityscanner/v1beta/BUILD.bazel
+--- a/googleapis/cloud/websecurityscanner/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/websecurityscanner/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = [
++ "crawled_url.pb.go",
++ "finding.pb.go",
++ "finding_addon.pb.go",
++ "finding_type_stats.pb.go",
++ "scan_config.pb.go",
++ "scan_config_error.pb.go",
++ "scan_run.pb.go",
++ "scan_run_error_trace.pb.go",
++ "scan_run_warning_trace.pb.go",
++ "web_security_scanner.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/websecurityscanner/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/workflows/executions/v1/BUILD.bazel b/googleapis/cloud/workflows/executions/v1/BUILD.bazel
+--- a/googleapis/cloud/workflows/executions/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/workflows/executions/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "executions",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/workflows/executions/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_workflows//executions/apiv1/executionspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":executions",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/workflows/executions/v1beta/BUILD.bazel b/googleapis/cloud/workflows/executions/v1beta/BUILD.bazel
+--- a/googleapis/cloud/workflows/executions/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/workflows/executions/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/workflows/executions/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_workflows//executions/apiv1beta/executionspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/workflows/type/BUILD.bazel b/googleapis/cloud/workflows/type/BUILD.bazel
+--- a/googleapis/cloud/workflows/type/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/workflows/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "type",
++ srcs = [
++ "engine_call.pb.go",
++ "executions_system.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/cloud/workflows/type",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":type",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/workflows/v1/BUILD.bazel b/googleapis/cloud/workflows/v1/BUILD.bazel
+--- a/googleapis/cloud/workflows/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/workflows/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "workflows",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/workflows/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_workflows//apiv1/workflowspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":workflows",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/cloud/workflows/v1beta/BUILD.bazel b/googleapis/cloud/workflows/v1beta/BUILD.bazel
+--- a/googleapis/cloud/workflows/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/cloud/workflows/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/cloud/workflows/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_workflows//apiv1beta/workflowspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/container/v1/BUILD.bazel b/googleapis/container/v1/BUILD.bazel
+--- a/googleapis/container/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/container/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "container",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/container/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_container//apiv1/containerpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":container",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/container/v1alpha1/BUILD.bazel b/googleapis/container/v1alpha1/BUILD.bazel
+--- a/googleapis/container/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/container/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = ["cluster_service.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/container/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/container/v1beta1/BUILD.bazel b/googleapis/container/v1beta1/BUILD.bazel
+--- a/googleapis/container/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/container/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["cluster_service.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/container/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/code",
++ "//googleapis/rpc/status",
++ "//googleapis/type/date",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/dataflow/v1beta3/BUILD.bazel b/googleapis/dataflow/v1beta3/BUILD.bazel
+--- a/googleapis/dataflow/v1beta3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/dataflow/v1beta3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta3",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/dataflow/v1beta3",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_dataflow//apiv1beta3/dataflowpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta3",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/datastore/admin/v1/BUILD.bazel b/googleapis/datastore/admin/v1/BUILD.bazel
+--- a/googleapis/datastore/admin/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/datastore/admin/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "admin",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/datastore/admin/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_datastore//admin/apiv1/adminpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":admin",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/datastore/admin/v1beta1/BUILD.bazel b/googleapis/datastore/admin/v1beta1/BUILD.bazel
+--- a/googleapis/datastore/admin/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/datastore/admin/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["datastore_admin.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/datastore/admin/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/datastore/v1/BUILD.bazel b/googleapis/datastore/v1/BUILD.bazel
+--- a/googleapis/datastore/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/datastore/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "datastore",
++ srcs = [
++ "aggregation_result.pb.go",
++ "datastore.pb.go",
++ "entity.pb.go",
++ "query.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/datastore/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/type/latlng",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":datastore",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/datastore/v1beta3/BUILD.bazel b/googleapis/datastore/v1beta3/BUILD.bazel
+--- a/googleapis/datastore/v1beta3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/datastore/v1beta3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta3",
++ srcs = [
++ "datastore.pb.go",
++ "entity.pb.go",
++ "query.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/datastore/v1beta3",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/type/latlng",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta3",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/artifactregistry/v1/BUILD.bazel b/googleapis/devtools/artifactregistry/v1/BUILD.bazel
+--- a/googleapis/devtools/artifactregistry/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/artifactregistry/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "artifactregistry",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_artifactregistry//apiv1/artifactregistrypb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":artifactregistry",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/artifactregistry/v1beta2/BUILD.bazel b/googleapis/devtools/artifactregistry/v1beta2/BUILD.bazel
+--- a/googleapis/devtools/artifactregistry/v1beta2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/artifactregistry/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta2",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/artifactregistry/v1beta2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_artifactregistry//apiv1beta2/artifactregistrypb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/build/v1/BUILD.bazel b/googleapis/devtools/build/v1/BUILD.bazel
+--- a/googleapis/devtools/build/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/build/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "build",
++ srcs = [
++ "build_events.pb.go",
++ "build_status.pb.go",
++ "publish_build_event.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/devtools/build/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":build",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/cloudbuild/v1/BUILD.bazel b/googleapis/devtools/cloudbuild/v1/BUILD.bazel
+--- a/googleapis/devtools/cloudbuild/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/cloudbuild/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "cloudbuild",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/cloudbuild/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_cloudbuild//apiv1/v2/cloudbuildpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":cloudbuild",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/clouddebugger/v2/BUILD.bazel b/googleapis/devtools/clouddebugger/v2/BUILD.bazel
+--- a/googleapis/devtools/clouddebugger/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/clouddebugger/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "clouddebugger",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/clouddebugger/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go//debugger/apiv2/debuggerpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":clouddebugger",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/clouderrorreporting/v1beta1/BUILD.bazel b/googleapis/devtools/clouderrorreporting/v1beta1/BUILD.bazel
+--- a/googleapis/devtools/clouderrorreporting/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/clouderrorreporting/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/clouderrorreporting/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_errorreporting//apiv1beta1/errorreportingpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/cloudprofiler/v2/BUILD.bazel b/googleapis/devtools/cloudprofiler/v2/BUILD.bazel
+--- a/googleapis/devtools/cloudprofiler/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/cloudprofiler/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "cloudprofiler",
++ srcs = ["profiler.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/cloudprofiler/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":cloudprofiler",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/cloudtrace/v1/BUILD.bazel b/googleapis/devtools/cloudtrace/v1/BUILD.bazel
+--- a/googleapis/devtools/cloudtrace/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/cloudtrace/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "cloudtrace",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/cloudtrace/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_trace//apiv1/tracepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":cloudtrace",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/cloudtrace/v2/BUILD.bazel b/googleapis/devtools/cloudtrace/v2/BUILD.bazel
+--- a/googleapis/devtools/cloudtrace/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/cloudtrace/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "cloudtrace",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/cloudtrace/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_trace//apiv2/tracepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":cloudtrace",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/containeranalysis/v1/BUILD.bazel b/googleapis/devtools/containeranalysis/v1/BUILD.bazel
+--- a/googleapis/devtools/containeranalysis/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/containeranalysis/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "containeranalysis",
++ srcs = ["containeranalysis.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/grafeas/v1:grafeas",
++ "//googleapis/iam/v1:iam",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":containeranalysis",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/containeranalysis/v1alpha1/BUILD.bazel b/googleapis/devtools/containeranalysis/v1alpha1/BUILD.bazel
+--- a/googleapis/devtools/containeranalysis/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/containeranalysis/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = [
++ "bill_of_materials.pb.go",
++ "containeranalysis.pb.go",
++ "image_basis.pb.go",
++ "package_vulnerability.pb.go",
++ "provenance.pb.go",
++ "source_context.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/iam/v1:iam",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "//protobuf/field_mask",
++ "@com_github_golang_protobuf//proto:go_default_library",
++ "@com_github_golang_protobuf//ptypes/any:go_default_library",
++ "@com_github_golang_protobuf//ptypes/empty:go_default_library",
++ "@com_github_golang_protobuf//ptypes/timestamp: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",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/containeranalysis/v1beta1/attestation/BUILD.bazel b/googleapis/devtools/containeranalysis/v1beta1/attestation/BUILD.bazel
+--- a/googleapis/devtools/containeranalysis/v1beta1/attestation/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/containeranalysis/v1beta1/attestation/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "attestation",
++ srcs = ["attestation.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/attestation",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/devtools/containeranalysis/v1beta1/common",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":attestation",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/containeranalysis/v1beta1/build/BUILD.bazel b/googleapis/devtools/containeranalysis/v1beta1/build/BUILD.bazel
+--- a/googleapis/devtools/containeranalysis/v1beta1/build/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/containeranalysis/v1beta1/build/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "build",
++ srcs = ["build.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/build",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/devtools/containeranalysis/v1beta1/provenance",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":build",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/containeranalysis/v1beta1/BUILD.bazel b/googleapis/devtools/containeranalysis/v1beta1/BUILD.bazel
+--- a/googleapis/devtools/containeranalysis/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/containeranalysis/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_containeranalysis//apiv1beta1/containeranalysispb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/containeranalysis/v1beta1/common/BUILD.bazel b/googleapis/devtools/containeranalysis/v1beta1/common/BUILD.bazel
+--- a/googleapis/devtools/containeranalysis/v1beta1/common/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/containeranalysis/v1beta1/common/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "common",
++ srcs = ["common.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/common",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":common",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/containeranalysis/v1beta1/cvss/BUILD.bazel b/googleapis/devtools/containeranalysis/v1beta1/cvss/BUILD.bazel
+--- a/googleapis/devtools/containeranalysis/v1beta1/cvss/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/containeranalysis/v1beta1/cvss/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "cvss",
++ srcs = ["cvss.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/cvss",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":cvss",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/containeranalysis/v1beta1/deployment/BUILD.bazel b/googleapis/devtools/containeranalysis/v1beta1/deployment/BUILD.bazel
+--- a/googleapis/devtools/containeranalysis/v1beta1/deployment/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/containeranalysis/v1beta1/deployment/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "deployment",
++ srcs = ["deployment.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/deployment",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":deployment",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/containeranalysis/v1beta1/discovery/BUILD.bazel b/googleapis/devtools/containeranalysis/v1beta1/discovery/BUILD.bazel
+--- a/googleapis/devtools/containeranalysis/v1beta1/discovery/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/containeranalysis/v1beta1/discovery/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "discovery",
++ srcs = ["discovery.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/discovery",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/devtools/containeranalysis/v1beta1/common",
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":discovery",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/containeranalysis/v1beta1/grafeas/BUILD.bazel b/googleapis/devtools/containeranalysis/v1beta1/grafeas/BUILD.bazel
+--- a/googleapis/devtools/containeranalysis/v1beta1/grafeas/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/containeranalysis/v1beta1/grafeas/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "grafeas",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/grafeas",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_containeranalysis//apiv1beta1/grafeas/grafeaspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":grafeas",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/containeranalysis/v1beta1/image/BUILD.bazel b/googleapis/devtools/containeranalysis/v1beta1/image/BUILD.bazel
+--- a/googleapis/devtools/containeranalysis/v1beta1/image/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/containeranalysis/v1beta1/image/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "image",
++ srcs = ["image.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/image",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":image",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/containeranalysis/v1beta1/package/BUILD.bazel b/googleapis/devtools/containeranalysis/v1beta1/package/BUILD.bazel
+--- a/googleapis/devtools/containeranalysis/v1beta1/package/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/containeranalysis/v1beta1/package/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "package",
++ srcs = ["package.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/package",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":package",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/containeranalysis/v1beta1/provenance/BUILD.bazel b/googleapis/devtools/containeranalysis/v1beta1/provenance/BUILD.bazel
+--- a/googleapis/devtools/containeranalysis/v1beta1/provenance/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/containeranalysis/v1beta1/provenance/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "provenance",
++ srcs = ["provenance.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/provenance",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/devtools/containeranalysis/v1beta1/source",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":provenance",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/containeranalysis/v1beta1/source/BUILD.bazel b/googleapis/devtools/containeranalysis/v1beta1/source/BUILD.bazel
+--- a/googleapis/devtools/containeranalysis/v1beta1/source/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/containeranalysis/v1beta1/source/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "source",
++ srcs = ["source.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/source",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":source",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/containeranalysis/v1beta1/vulnerability/BUILD.bazel b/googleapis/devtools/containeranalysis/v1beta1/vulnerability/BUILD.bazel
+--- a/googleapis/devtools/containeranalysis/v1beta1/vulnerability/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/containeranalysis/v1beta1/vulnerability/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "vulnerability",
++ srcs = ["vulnerability.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/containeranalysis/v1beta1/vulnerability",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/devtools/containeranalysis/v1beta1/common",
++ "//googleapis/devtools/containeranalysis/v1beta1/cvss",
++ "//googleapis/devtools/containeranalysis/v1beta1/package",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":vulnerability",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/remoteworkers/v1test2/BUILD.bazel b/googleapis/devtools/remoteworkers/v1test2/BUILD.bazel
+--- a/googleapis/devtools/remoteworkers/v1test2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/remoteworkers/v1test2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1test2",
++ srcs = [
++ "bots.pb.go",
++ "command.pb.go",
++ "tasks.pb.go",
++ "worker.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/devtools/remoteworkers/v1test2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "//protobuf/field_mask",
++ "@com_github_golang_protobuf//proto:go_default_library",
++ "@com_github_golang_protobuf//ptypes/any: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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1test2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/resultstore/v2/BUILD.bazel b/googleapis/devtools/resultstore/v2/BUILD.bazel
+--- a/googleapis/devtools/resultstore/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/resultstore/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,45 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "resultstore",
++ srcs = [
++ "action.pb.go",
++ "common.pb.go",
++ "configuration.pb.go",
++ "configured_target.pb.go",
++ "coverage.pb.go",
++ "coverage_summary.pb.go",
++ "download_metadata.pb.go",
++ "file.pb.go",
++ "file_processing_error.pb.go",
++ "file_set.pb.go",
++ "invocation.pb.go",
++ "resultstore_download.pb.go",
++ "resultstore_file_download.pb.go",
++ "resultstore_upload.pb.go",
++ "target.pb.go",
++ "test_suite.pb.go",
++ "upload_metadata.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/devtools/resultstore/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":resultstore",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/source/v1/BUILD.bazel b/googleapis/devtools/source/v1/BUILD.bazel
+--- a/googleapis/devtools/source/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/source/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "source",
++ srcs = ["source_context.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/source/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":source",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/sourcerepo/v1/BUILD.bazel b/googleapis/devtools/sourcerepo/v1/BUILD.bazel
+--- a/googleapis/devtools/sourcerepo/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/sourcerepo/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "sourcerepo",
++ srcs = ["sourcerepo.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/devtools/sourcerepo/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/iam/v1:iam",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sourcerepo",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/devtools/testing/v1/BUILD.bazel b/googleapis/devtools/testing/v1/BUILD.bazel
+--- a/googleapis/devtools/testing/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/devtools/testing/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "testing",
++ srcs = [
++ "application_details.pb.go",
++ "test_environment_discovery.pb.go",
++ "test_execution.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/devtools/testing/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/type/date",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":testing",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/example/library/v1/BUILD.bazel b/googleapis/example/library/v1/BUILD.bazel
+--- a/googleapis/example/library/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/example/library/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "library",
++ srcs = ["library.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/example/library/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":library",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/firebase/fcm/connection/v1alpha1/BUILD.bazel b/googleapis/firebase/fcm/connection/v1alpha1/BUILD.bazel
+--- a/googleapis/firebase/fcm/connection/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/firebase/fcm/connection/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = ["connection_api.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/firebase/fcm/connection/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/firestore/admin/v1/BUILD.bazel b/googleapis/firestore/admin/v1/BUILD.bazel
+--- a/googleapis/firestore/admin/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/firestore/admin/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "admin",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/firestore/admin/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_firestore//apiv1/admin/adminpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":admin",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/firestore/admin/v1beta1/BUILD.bazel b/googleapis/firestore/admin/v1beta1/BUILD.bazel
+--- a/googleapis/firestore/admin/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/firestore/admin/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = [
++ "firestore_admin.pb.go",
++ "index.pb.go",
++ "location.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/firestore/admin/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/type/latlng",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/firestore/admin/v1beta2/BUILD.bazel b/googleapis/firestore/admin/v1beta2/BUILD.bazel
+--- a/googleapis/firestore/admin/v1beta2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/firestore/admin/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta2",
++ srcs = [
++ "field.pb.go",
++ "firestore_admin.pb.go",
++ "index.pb.go",
++ "operation.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/firestore/admin/v1beta2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/firestore/v1/BUILD.bazel b/googleapis/firestore/v1/BUILD.bazel
+--- a/googleapis/firestore/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/firestore/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "firestore",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/firestore/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_firestore//apiv1/firestorepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":firestore",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/firestore/v1beta1/BUILD.bazel b/googleapis/firestore/v1beta1/BUILD.bazel
+--- a/googleapis/firestore/v1beta1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/firestore/v1beta1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta1",
++ srcs = [
++ "common.pb.go",
++ "document.pb.go",
++ "firestore.pb.go",
++ "query.pb.go",
++ "write.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/firestore/v1beta1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "//googleapis/type/latlng",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/gapic/metadata/BUILD.bazel b/googleapis/gapic/metadata/BUILD.bazel
+--- a/googleapis/gapic/metadata/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/gapic/metadata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "metadata",
++ srcs = ["gapic_metadata.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/gapic/metadata",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":metadata",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/genomics/v1/BUILD.bazel b/googleapis/genomics/v1/BUILD.bazel
+--- a/googleapis/genomics/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/genomics/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,44 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "genomics",
++ srcs = [
++ "annotations.pb.go",
++ "cigar.pb.go",
++ "datasets.pb.go",
++ "operations.pb.go",
++ "position.pb.go",
++ "range.pb.go",
++ "readalignment.pb.go",
++ "readgroup.pb.go",
++ "readgroupset.pb.go",
++ "reads.pb.go",
++ "references.pb.go",
++ "variants.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/genomics/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/iam/v1:iam",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":genomics",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/genomics/v1alpha2/BUILD.bazel b/googleapis/genomics/v1alpha2/BUILD.bazel
+--- a/googleapis/genomics/v1alpha2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/genomics/v1alpha2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha2",
++ srcs = ["pipelines.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/genomics/v1alpha2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/code",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/geo/type/viewport/BUILD.bazel b/googleapis/geo/type/viewport/BUILD.bazel
+--- a/googleapis/geo/type/viewport/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/geo/type/viewport/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "viewport",
++ srcs = ["viewport.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/geo/type/viewport",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/type/latlng",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":viewport",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/grafeas/v1/BUILD.bazel b/googleapis/grafeas/v1/BUILD.bazel
+--- a/googleapis/grafeas/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/grafeas/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,49 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "grafeas",
++ srcs = [
++ "attestation.pb.go",
++ "build.pb.go",
++ "common.pb.go",
++ "compliance.pb.go",
++ "cvss.pb.go",
++ "deployment.pb.go",
++ "discovery.pb.go",
++ "dsse_attestation.pb.go",
++ "grafeas.pb.go",
++ "image.pb.go",
++ "intoto_provenance.pb.go",
++ "intoto_statement.pb.go",
++ "package.pb.go",
++ "provenance.pb.go",
++ "severity.pb.go",
++ "slsa_provenance.pb.go",
++ "slsa_provenance_zero_two.pb.go",
++ "upgrade.pb.go",
++ "vex.pb.go",
++ "vulnerability.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/grafeas/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/rpc/status",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":grafeas",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/home/enterprise/sdm/v1/BUILD.bazel b/googleapis/home/enterprise/sdm/v1/BUILD.bazel
+--- a/googleapis/home/enterprise/sdm/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/home/enterprise/sdm/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "sdm",
++ srcs = [
++ "device.pb.go",
++ "site.pb.go",
++ "smart_device_management_service.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/home/enterprise/sdm/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sdm",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/home/graph/v1/BUILD.bazel b/googleapis/home/graph/v1/BUILD.bazel
+--- a/googleapis/home/graph/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/home/graph/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "graph",
++ srcs = [
++ "device.pb.go",
++ "homegraph.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/home/graph/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":graph",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/iam/admin/v1/BUILD.bazel b/googleapis/iam/admin/v1/BUILD.bazel
+--- a/googleapis/iam/admin/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/iam/admin/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "admin",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/iam/admin/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_iam//admin/apiv1/adminpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":admin",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/iam/credentials/v1/BUILD.bazel b/googleapis/iam/credentials/v1/BUILD.bazel
+--- a/googleapis/iam/credentials/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/iam/credentials/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "credentials",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/iam/credentials/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_iam//credentials/apiv1/credentialspb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":credentials",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/iam/v1/BUILD.bazel b/googleapis/iam/v1/BUILD.bazel
+--- a/googleapis/iam/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/iam/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "iam",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/iam/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_iam//apiv1/iampb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":iam",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/iam/v1/logging/BUILD.bazel b/googleapis/iam/v1/logging/BUILD.bazel
+--- a/googleapis/iam/v1/logging/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/iam/v1/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["audit_data.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/iam/v1/logging",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/iam/v1:iam",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/iam/v1beta/BUILD.bazel b/googleapis/iam/v1beta/BUILD.bazel
+--- a/googleapis/iam/v1beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/iam/v1beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta",
++ srcs = ["workload_identity_pool.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/iam/v1beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/iam/v2/BUILD.bazel b/googleapis/iam/v2/BUILD.bazel
+--- a/googleapis/iam/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/iam/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "iam",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/iam/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_iam//apiv2/iampb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":iam",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/iam/v2beta/BUILD.bazel b/googleapis/iam/v2beta/BUILD.bazel
+--- a/googleapis/iam/v2beta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/iam/v2beta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v2beta",
++ srcs = [
++ "deny.pb.go",
++ "policy.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/iam/v2beta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/type/expr",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v2beta",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/identity/accesscontextmanager/type/BUILD.bazel b/googleapis/identity/accesscontextmanager/type/BUILD.bazel
+--- a/googleapis/identity/accesscontextmanager/type/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/identity/accesscontextmanager/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "type",
++ srcs = ["device_resources.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/type",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":type",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/identity/accesscontextmanager/v1/BUILD.bazel b/googleapis/identity/accesscontextmanager/v1/BUILD.bazel
+--- a/googleapis/identity/accesscontextmanager/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/identity/accesscontextmanager/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "accesscontextmanager",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/identity/accesscontextmanager/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_accesscontextmanager//apiv1/accesscontextmanagerpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":accesscontextmanager",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/logging/type/BUILD.bazel b/googleapis/logging/type/BUILD.bazel
+--- a/googleapis/logging/type/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/logging/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "type",
++ srcs = [
++ "http_request.pb.go",
++ "log_severity.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/logging/type",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":type",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/logging/v2/BUILD.bazel b/googleapis/logging/v2/BUILD.bazel
+--- a/googleapis/logging/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/logging/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/logging/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_logging//apiv2/loggingpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/longrunning/BUILD.bazel b/googleapis/longrunning/BUILD.bazel
+--- a/googleapis/longrunning/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/longrunning/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "longrunning",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/longrunning",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_longrunning//autogen/longrunningpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":longrunning",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/maps/addressvalidation/v1/BUILD.bazel b/googleapis/maps/addressvalidation/v1/BUILD.bazel
+--- a/googleapis/maps/addressvalidation/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/maps/addressvalidation/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "addressvalidation",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/maps/addressvalidation/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_maps//addressvalidation/apiv1/addressvalidationpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":addressvalidation",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/maps/fleetengine/delivery/v1/BUILD.bazel b/googleapis/maps/fleetengine/delivery/v1/BUILD.bazel
+--- a/googleapis/maps/fleetengine/delivery/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/maps/fleetengine/delivery/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "delivery",
++ srcs = [
++ "common.pb.go",
++ "delivery_api.pb.go",
++ "delivery_vehicles.pb.go",
++ "header.pb.go",
++ "task_tracking_info.pb.go",
++ "tasks.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/maps/fleetengine/delivery/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/geo/type/viewport",
++ "//googleapis/type/latlng",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":delivery",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/maps/fleetengine/v1/BUILD.bazel b/googleapis/maps/fleetengine/v1/BUILD.bazel
+--- a/googleapis/maps/fleetengine/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/maps/fleetengine/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "fleetengine",
++ srcs = [
++ "fleetengine.pb.go",
++ "header.pb.go",
++ "traffic.pb.go",
++ "trip_api.pb.go",
++ "trips.pb.go",
++ "vehicle_api.pb.go",
++ "vehicles.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/maps/fleetengine/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/type/latlng",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fleetengine",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/maps/playablelocations/v3/BUILD.bazel b/googleapis/maps/playablelocations/v3/BUILD.bazel
+--- a/googleapis/maps/playablelocations/v3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/maps/playablelocations/v3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "playablelocations",
++ srcs = [
++ "playablelocations.pb.go",
++ "resources.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/maps/playablelocations/v3",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/maps/playablelocations/v3/sample",
++ "//googleapis/maps/unity",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":playablelocations",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/maps/playablelocations/v3/sample/BUILD.bazel b/googleapis/maps/playablelocations/v3/sample/BUILD.bazel
+--- a/googleapis/maps/playablelocations/v3/sample/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/maps/playablelocations/v3/sample/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "sample",
++ srcs = ["resources.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/maps/playablelocations/v3/sample",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/type/latlng",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sample",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/maps/regionlookup/v1alpha/BUILD.bazel b/googleapis/maps/regionlookup/v1alpha/BUILD.bazel
+--- a/googleapis/maps/regionlookup/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/maps/regionlookup/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = [
++ "region_identifier.pb.go",
++ "region_lookup_service.pb.go",
++ "region_match.pb.go",
++ "region_search_values.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/maps/regionlookup/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/type/latlng",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/maps/roads/v1op/BUILD.bazel b/googleapis/maps/roads/v1op/BUILD.bazel
+--- a/googleapis/maps/roads/v1op/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/maps/roads/v1op/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1op",
++ srcs = ["roads.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/maps/roads/v1op",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/type/latlng",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1op",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/maps/routes/v1/BUILD.bazel b/googleapis/maps/routes/v1/BUILD.bazel
+--- a/googleapis/maps/routes/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/maps/routes/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,45 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "routes",
++ srcs = [
++ "compute_custom_routes_request.pb.go",
++ "compute_custom_routes_response.pb.go",
++ "compute_route_matrix_request.pb.go",
++ "compute_routes_request.pb.go",
++ "compute_routes_response.pb.go",
++ "custom_route.pb.go",
++ "fallback_info.pb.go",
++ "polyline.pb.go",
++ "route.pb.go",
++ "route_matrix_element.pb.go",
++ "route_service.pb.go",
++ "toll_passes.pb.go",
++ "vehicle_emission_type.pb.go",
++ "waypoint.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/maps/routes/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/geo/type/viewport",
++ "//googleapis/rpc/status",
++ "//googleapis/type/latlng",
++ "//googleapis/type/money",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":routes",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/maps/routes/v1alpha/BUILD.bazel b/googleapis/maps/routes/v1alpha/BUILD.bazel
+--- a/googleapis/maps/routes/v1alpha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/maps/routes/v1alpha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha",
++ srcs = ["route_service.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/maps/routes/v1alpha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/maps/routes/v1:routes",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/maps/routing/v2/BUILD.bazel b/googleapis/maps/routing/v2/BUILD.bazel
+--- a/googleapis/maps/routing/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/maps/routing/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "routing",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/maps/routing/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_maps//routing/apiv2/routingpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":routing",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/maps/unity/BUILD.bazel b/googleapis/maps/unity/BUILD.bazel
+--- a/googleapis/maps/unity/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/maps/unity/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "unity",
++ srcs = ["clientinfo.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/maps/unity",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unity",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/monitoring/dashboard/v1/BUILD.bazel b/googleapis/monitoring/dashboard/v1/BUILD.bazel
+--- a/googleapis/monitoring/dashboard/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/monitoring/dashboard/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "dashboard",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/monitoring/dashboard/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_monitoring//dashboard/apiv1/dashboardpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":dashboard",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/monitoring/metricsscope/v1/BUILD.bazel b/googleapis/monitoring/metricsscope/v1/BUILD.bazel
+--- a/googleapis/monitoring/metricsscope/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/monitoring/metricsscope/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "metricsscope",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/monitoring/metricsscope/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_monitoring//metricsscope/apiv1/metricsscopepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":metricsscope",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/monitoring/v3/BUILD.bazel b/googleapis/monitoring/v3/BUILD.bazel
+--- a/googleapis/monitoring/v3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/monitoring/v3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "monitoring",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/monitoring/v3",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_monitoring//apiv3/v2/monitoringpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":monitoring",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/networking/trafficdirector/type/BUILD.bazel b/googleapis/networking/trafficdirector/type/BUILD.bazel
+--- a/googleapis/networking/trafficdirector/type/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/networking/trafficdirector/type/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "type",
++ srcs = ["traffic_director_log_entry.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/networking/trafficdirector/type",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":type",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/partner/aistreams/v1alpha1/BUILD.bazel b/googleapis/partner/aistreams/v1alpha1/BUILD.bazel
+--- a/googleapis/partner/aistreams/v1alpha1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/partner/aistreams/v1alpha1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1alpha1",
++ srcs = ["aistreams.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/partner/aistreams/v1alpha1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1alpha1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/privacy/dlp/v2/BUILD.bazel b/googleapis/privacy/dlp/v2/BUILD.bazel
+--- a/googleapis/privacy/dlp/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/privacy/dlp/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "dlp",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/privacy/dlp/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_dlp//apiv2/dlppb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":dlp",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/pubsub/v1/BUILD.bazel b/googleapis/pubsub/v1/BUILD.bazel
+--- a/googleapis/pubsub/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/pubsub/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "pubsub",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/pubsub/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_pubsub//apiv1/pubsubpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":pubsub",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/pubsub/v1beta2/BUILD.bazel b/googleapis/pubsub/v1beta2/BUILD.bazel
+--- a/googleapis/pubsub/v1beta2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/pubsub/v1beta2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "v1beta2",
++ srcs = ["pubsub.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/pubsub/v1beta2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":v1beta2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/rpc/code/BUILD.bazel b/googleapis/rpc/code/BUILD.bazel
+--- a/googleapis/rpc/code/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/rpc/code/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "code",
++ srcs = ["code.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/rpc/code",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":code",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/rpc/context/attribute_context/BUILD.bazel b/googleapis/rpc/context/attribute_context/BUILD.bazel
+--- a/googleapis/rpc/context/attribute_context/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/rpc/context/attribute_context/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "attribute_context",
++ srcs = ["attribute_context.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/rpc/context/attribute_context",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":attribute_context",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/rpc/context/BUILD.bazel b/googleapis/rpc/context/BUILD.bazel
+--- a/googleapis/rpc/context/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/rpc/context/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "context",
++ srcs = ["audit_context.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/rpc/context",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/structpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":context",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/rpc/errdetails/BUILD.bazel b/googleapis/rpc/errdetails/BUILD.bazel
+--- a/googleapis/rpc/errdetails/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/rpc/errdetails/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "errdetails",
++ srcs = ["error_details.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/rpc/errdetails",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":errdetails",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/rpc/http/BUILD.bazel b/googleapis/rpc/http/BUILD.bazel
+--- a/googleapis/rpc/http/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/rpc/http/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "http",
++ srcs = ["http.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/rpc/http",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":http",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/rpc/status/BUILD.bazel b/googleapis/rpc/status/BUILD.bazel
+--- a/googleapis/rpc/status/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/rpc/status/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "status",
++ srcs = ["status.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/rpc/status",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":status",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/search/partnerdataingestion/logging/v1/BUILD.bazel b/googleapis/search/partnerdataingestion/logging/v1/BUILD.bazel
+--- a/googleapis/search/partnerdataingestion/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/search/partnerdataingestion/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["platformlog.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/search/partnerdataingestion/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/spanner/admin/database/v1/BUILD.bazel b/googleapis/spanner/admin/database/v1/BUILD.bazel
+--- a/googleapis/spanner/admin/database/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/spanner/admin/database/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "database",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/spanner/admin/database/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_spanner//admin/database/apiv1/databasepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":database",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/spanner/admin/instance/v1/BUILD.bazel b/googleapis/spanner/admin/instance/v1/BUILD.bazel
+--- a/googleapis/spanner/admin/instance/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/spanner/admin/instance/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "instance",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/spanner/admin/instance/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_spanner//admin/instance/apiv1/instancepb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":instance",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/spanner/v1/BUILD.bazel b/googleapis/spanner/v1/BUILD.bazel
+--- a/googleapis/spanner/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/spanner/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "spanner",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/spanner/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_spanner//apiv1/spannerpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":spanner",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/storage/clouddms/logging/v1/BUILD.bazel b/googleapis/storage/clouddms/logging/v1/BUILD.bazel
+--- a/googleapis/storage/clouddms/logging/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/storage/clouddms/logging/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["clouddms_stackdriver_logs.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/storage/clouddms/logging/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/rpc/status",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/storage/v1/BUILD.bazel b/googleapis/storage/v1/BUILD.bazel
+--- a/googleapis/storage/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/storage/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "storage",
++ srcs = [
++ "storage.pb.go",
++ "storage_resources.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/storage/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/iam/v1:iam",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":storage",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/storage/v2/BUILD.bazel b/googleapis/storage/v2/BUILD.bazel
+--- a/googleapis/storage/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/storage/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "storage",
++ srcs = [
++ "doc.go",
++ "storage.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/storage/v2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/iam/v1:iam",
++ "//googleapis/type/date",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":storage",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/storagetransfer/logging/BUILD.bazel b/googleapis/storagetransfer/logging/BUILD.bazel
+--- a/googleapis/storagetransfer/logging/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/storagetransfer/logging/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "logging",
++ srcs = ["transfer_activity_log.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/storagetransfer/logging",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":logging",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/storagetransfer/v1/BUILD.bazel b/googleapis/storagetransfer/v1/BUILD.bazel
+--- a/googleapis/storagetransfer/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/storagetransfer/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "storagetransfer",
++ srcs = ["alias.go"],
++ importpath = "google.golang.org/genproto/googleapis/storagetransfer/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_google_cloud_go_storagetransfer//apiv1/storagetransferpb:go_default_library",
++ "@org_golang_google_grpc//:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":storagetransfer",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/streetview/publish/v1/BUILD.bazel b/googleapis/streetview/publish/v1/BUILD.bazel
+--- a/googleapis/streetview/publish/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/streetview/publish/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "publish",
++ srcs = [
++ "resources.pb.go",
++ "rpcmessages.pb.go",
++ "streetview_publish.pb.go",
++ ],
++ importpath = "google.golang.org/genproto/googleapis/streetview/publish/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "//googleapis/longrunning",
++ "//googleapis/rpc/status",
++ "//googleapis/type/latlng",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":publish",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/calendarperiod/BUILD.bazel b/googleapis/type/calendarperiod/BUILD.bazel
+--- a/googleapis/type/calendarperiod/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/calendarperiod/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "calendarperiod",
++ srcs = ["calendar_period.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/calendarperiod",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":calendarperiod",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/color/BUILD.bazel b/googleapis/type/color/BUILD.bazel
+--- a/googleapis/type/color/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/color/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "color",
++ srcs = ["color.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/color",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/wrapperspb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":color",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/date/BUILD.bazel b/googleapis/type/date/BUILD.bazel
+--- a/googleapis/type/date/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/date/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "date",
++ srcs = ["date.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/date",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":date",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/date_range/BUILD.bazel b/googleapis/type/date_range/BUILD.bazel
+--- a/googleapis/type/date_range/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/date_range/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "date_range",
++ srcs = ["date_range.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/date_range",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/type/date",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":date_range",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/datetime/BUILD.bazel b/googleapis/type/datetime/BUILD.bazel
+--- a/googleapis/type/datetime/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/datetime/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "datetime",
++ srcs = ["datetime.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/datetime",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/durationpb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":datetime",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/date_time_range/BUILD.bazel b/googleapis/type/date_time_range/BUILD.bazel
+--- a/googleapis/type/date_time_range/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/date_time_range/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "date_time_range",
++ srcs = ["datetime_range.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/date_time_range",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/type/datetime",
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":date_time_range",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/dayofweek/BUILD.bazel b/googleapis/type/dayofweek/BUILD.bazel
+--- a/googleapis/type/dayofweek/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/dayofweek/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "dayofweek",
++ srcs = ["dayofweek.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/dayofweek",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":dayofweek",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/decimal/BUILD.bazel b/googleapis/type/decimal/BUILD.bazel
+--- a/googleapis/type/decimal/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/decimal/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "decimal",
++ srcs = ["decimal.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/decimal",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":decimal",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/expr/BUILD.bazel b/googleapis/type/expr/BUILD.bazel
+--- a/googleapis/type/expr/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/expr/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "expr",
++ srcs = ["expr.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/expr",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":expr",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/fraction/BUILD.bazel b/googleapis/type/fraction/BUILD.bazel
+--- a/googleapis/type/fraction/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/fraction/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "fraction",
++ srcs = ["fraction.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/fraction",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fraction",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/interval/BUILD.bazel b/googleapis/type/interval/BUILD.bazel
+--- a/googleapis/type/interval/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/interval/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "interval",
++ srcs = ["interval.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/interval",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/timestamppb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":interval",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/latlng/BUILD.bazel b/googleapis/type/latlng/BUILD.bazel
+--- a/googleapis/type/latlng/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/latlng/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "latlng",
++ srcs = ["latlng.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/latlng",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":latlng",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/localized_text/BUILD.bazel b/googleapis/type/localized_text/BUILD.bazel
+--- a/googleapis/type/localized_text/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/localized_text/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "localized_text",
++ srcs = ["localized_text.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/localized_text",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":localized_text",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/money/BUILD.bazel b/googleapis/type/money/BUILD.bazel
+--- a/googleapis/type/money/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/money/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "money",
++ srcs = ["money.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/money",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":money",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/month/BUILD.bazel b/googleapis/type/month/BUILD.bazel
+--- a/googleapis/type/month/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/month/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "month",
++ srcs = ["month.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/month",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":month",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/phone_number/BUILD.bazel b/googleapis/type/phone_number/BUILD.bazel
+--- a/googleapis/type/phone_number/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/phone_number/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "phone_number",
++ srcs = ["phone_number.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/phone_number",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":phone_number",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/postaladdress/BUILD.bazel b/googleapis/type/postaladdress/BUILD.bazel
+--- a/googleapis/type/postaladdress/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/postaladdress/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "postaladdress",
++ srcs = ["postal_address.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/postaladdress",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":postaladdress",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/quaternion/BUILD.bazel b/googleapis/type/quaternion/BUILD.bazel
+--- a/googleapis/type/quaternion/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/quaternion/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "quaternion",
++ srcs = ["quaternion.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/quaternion",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":quaternion",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/type/timeofday/BUILD.bazel b/googleapis/type/timeofday/BUILD.bazel
+--- a/googleapis/type/timeofday/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/type/timeofday/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "timeofday",
++ srcs = ["timeofday.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/type/timeofday",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@org_golang_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":timeofday",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/googleapis/watcher/v1/BUILD.bazel b/googleapis/watcher/v1/BUILD.bazel
+--- a/googleapis/watcher/v1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/googleapis/watcher/v1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "watcher",
++ srcs = ["watch.pb.go"],
++ importpath = "google.golang.org/genproto/googleapis/watcher/v1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//googleapis/api/annotations",
++ "@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_google_protobuf//reflect/protoreflect:go_default_library",
++ "@org_golang_google_protobuf//runtime/protoimpl:go_default_library",
++ "@org_golang_google_protobuf//types/known/anypb:go_default_library",
++ "@org_golang_google_protobuf//types/known/emptypb:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":watcher",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protobuf/api/BUILD.bazel b/protobuf/api/BUILD.bazel
+--- a/protobuf/api/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protobuf/api/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "api",
++ srcs = ["api.go"],
++ importpath = "google.golang.org/genproto/protobuf/api",
++ visibility = ["//visibility:public"],
++ deps = ["@org_golang_google_protobuf//types/known/apipb:go_default_library"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":api",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protobuf/field_mask/BUILD.bazel b/protobuf/field_mask/BUILD.bazel
+--- a/protobuf/field_mask/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protobuf/field_mask/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "field_mask",
++ srcs = ["field_mask.go"],
++ importpath = "google.golang.org/genproto/protobuf/field_mask",
++ visibility = ["//visibility:public"],
++ deps = ["@org_golang_google_protobuf//types/known/fieldmaskpb:go_default_library"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":field_mask",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protobuf/ptype/BUILD.bazel b/protobuf/ptype/BUILD.bazel
+--- a/protobuf/ptype/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protobuf/ptype/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "ptype",
++ srcs = ["type.go"],
++ importpath = "google.golang.org/genproto/protobuf/ptype",
++ visibility = ["//visibility:public"],
++ deps = ["@org_golang_google_protobuf//types/known/typepb:go_default_library"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":ptype",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/protobuf/source_context/BUILD.bazel b/protobuf/source_context/BUILD.bazel
+--- a/protobuf/source_context/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protobuf/source_context/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "source_context",
++ srcs = ["source_context.go"],
++ importpath = "google.golang.org/genproto/protobuf/source_context",
++ visibility = ["//visibility:public"],
++ deps = ["@org_golang_google_protobuf//types/known/sourcecontextpb:go_default_library"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":source_context",
++ visibility = ["//visibility:public"],
++)
diff --git a/third_party/org_golang_google_protobuf-gazelle.patch b/third_party/org_golang_google_protobuf-gazelle.patch
new file mode 100644
index 00000000..5c4df040
--- /dev/null
+++ b/third_party/org_golang_google_protobuf-gazelle.patch
@@ -0,0 +1,3731 @@
+diff -urN a/cmd/protoc-gen-go/BUILD.bazel b/cmd/protoc-gen-go/BUILD.bazel
+--- a/cmd/protoc-gen-go/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "protoc-gen-go_lib",
++ srcs = ["main.go"],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//cmd/protoc-gen-go/internal_gengo",
++ "//compiler/protogen",
++ "//internal/version",
++ ],
++)
++
++go_binary(
++ name = "protoc-gen-go",
++ embed = [":protoc-gen-go_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "protoc-gen-go_test",
++ srcs = [
++ "annotation_test.go",
++ "retention_test.go",
++ ],
++ embed = [":protoc-gen-go_lib"],
++ deps = [
++ "//cmd/protoc-gen-go/testdata/retention",
++ "//encoding/prototext",
++ "//internal/genid",
++ "//proto",
++ "//reflect/protoreflect",
++ "//types/descriptorpb",
++ ],
++)
+diff -urN a/cmd/protoc-gen-go/internal_gengo/BUILD.bazel b/cmd/protoc-gen-go/internal_gengo/BUILD.bazel
+--- a/cmd/protoc-gen-go/internal_gengo/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/internal_gengo/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "internal_gengo",
++ srcs = [
++ "init.go",
++ "main.go",
++ "reflect.go",
++ "well_known_types.go",
++ ],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/internal_gengo",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//compiler/protogen",
++ "//encoding/protowire",
++ "//internal/encoding/tag",
++ "//internal/genid",
++ "//internal/version",
++ "//proto",
++ "//reflect/protopath",
++ "//reflect/protorange",
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ "//types/descriptorpb",
++ "//types/pluginpb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":internal_gengo",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/annotations/BUILD.bazel b/cmd/protoc-gen-go/testdata/annotations/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/annotations/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/annotations/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "annotations",
++ srcs = ["annotations.pb.go"],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/annotations",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":annotations",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/BUILD.bazel b/cmd/protoc-gen-go/testdata/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_test")
++
++go_test(
++ name = "testdata_test",
++ srcs = [
++ "gen_test.go",
++ "registry_test.go",
++ ],
++ deps = [
++ "//cmd/protoc-gen-go/testdata/annotations",
++ "//cmd/protoc-gen-go/testdata/comments",
++ "//cmd/protoc-gen-go/testdata/extensions/base",
++ "//cmd/protoc-gen-go/testdata/extensions/ext",
++ "//cmd/protoc-gen-go/testdata/extensions/extra",
++ "//cmd/protoc-gen-go/testdata/extensions/proto3",
++ "//cmd/protoc-gen-go/testdata/fieldnames",
++ "//cmd/protoc-gen-go/testdata/import_public",
++ "//cmd/protoc-gen-go/testdata/import_public/sub",
++ "//cmd/protoc-gen-go/testdata/import_public/sub2",
++ "//cmd/protoc-gen-go/testdata/imports",
++ "//cmd/protoc-gen-go/testdata/imports/fmt",
++ "//cmd/protoc-gen-go/testdata/imports/test_a_1",
++ "//cmd/protoc-gen-go/testdata/imports/test_a_2",
++ "//cmd/protoc-gen-go/testdata/imports/test_b_1",
++ "//cmd/protoc-gen-go/testdata/issue780_oneof_conflict",
++ "//cmd/protoc-gen-go/testdata/nopackage",
++ "//cmd/protoc-gen-go/testdata/proto2",
++ "//cmd/protoc-gen-go/testdata/proto3",
++ "//cmd/protoc-gen-go/testdata/retention",
++ "//internal/filedesc",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ ],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/comments/BUILD.bazel b/cmd/protoc-gen-go/testdata/comments/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/comments/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/comments/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "comments",
++ srcs = [
++ "comments.pb.go",
++ "deprecated.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/comments",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":comments",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/extensions/base/BUILD.bazel b/cmd/protoc-gen-go/testdata/extensions/base/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/extensions/base/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/extensions/base/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "base",
++ srcs = ["base.pb.go"],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/base",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":base",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/extensions/ext/BUILD.bazel b/cmd/protoc-gen-go/testdata/extensions/ext/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/extensions/ext/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/extensions/ext/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "ext",
++ srcs = ["ext.pb.go"],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/ext",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//cmd/protoc-gen-go/testdata/extensions/base",
++ "//cmd/protoc-gen-go/testdata/extensions/extra",
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":ext",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/extensions/extra/BUILD.bazel b/cmd/protoc-gen-go/testdata/extensions/extra/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/extensions/extra/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/extensions/extra/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "extra",
++ srcs = ["extra.pb.go"],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/extra",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":extra",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/extensions/proto3/BUILD.bazel b/cmd/protoc-gen-go/testdata/extensions/proto3/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/extensions/proto3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/extensions/proto3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto3",
++ srcs = ["ext3.pb.go"],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/extensions/proto3",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ "//types/descriptorpb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto3",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/fieldnames/BUILD.bazel b/cmd/protoc-gen-go/testdata/fieldnames/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/fieldnames/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/fieldnames/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "fieldnames",
++ srcs = ["fieldnames.pb.go"],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/fieldnames",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fieldnames",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/import_public/BUILD.bazel b/cmd/protoc-gen-go/testdata/import_public/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/import_public/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/import_public/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "import_public",
++ srcs = [
++ "a.pb.go",
++ "b.pb.go",
++ "c.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//cmd/protoc-gen-go/testdata/import_public/sub",
++ "//cmd/protoc-gen-go/testdata/import_public/sub2",
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":import_public",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/import_public/sub/BUILD.bazel b/cmd/protoc-gen-go/testdata/import_public/sub/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/import_public/sub/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/import_public/sub/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "sub",
++ srcs = [
++ "a.pb.go",
++ "b.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//cmd/protoc-gen-go/testdata/import_public/sub2",
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sub",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/import_public/sub2/BUILD.bazel b/cmd/protoc-gen-go/testdata/import_public/sub2/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/import_public/sub2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/import_public/sub2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "sub2",
++ srcs = ["a.pb.go"],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/import_public/sub2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sub2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/imports/BUILD.bazel b/cmd/protoc-gen-go/testdata/imports/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/imports/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/imports/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "imports",
++ srcs = [
++ "test_import_a1m1.pb.go",
++ "test_import_a1m2.pb.go",
++ "test_import_all.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//cmd/protoc-gen-go/testdata/imports/fmt",
++ "//cmd/protoc-gen-go/testdata/imports/test_a_1",
++ "//cmd/protoc-gen-go/testdata/imports/test_a_2",
++ "//cmd/protoc-gen-go/testdata/imports/test_b_1",
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":imports",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/imports/fmt/BUILD.bazel b/cmd/protoc-gen-go/testdata/imports/fmt/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/imports/fmt/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/imports/fmt/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "fmt",
++ srcs = ["m.pb.go"],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/fmt",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fmt",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/imports/test_a_1/BUILD.bazel b/cmd/protoc-gen-go/testdata/imports/test_a_1/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/imports/test_a_1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/imports/test_a_1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "test_a_1",
++ srcs = [
++ "m1.pb.go",
++ "m2.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":test_a_1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/imports/test_a_2/BUILD.bazel b/cmd/protoc-gen-go/testdata/imports/test_a_2/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/imports/test_a_2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/imports/test_a_2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "test_a_2",
++ srcs = [
++ "m3.pb.go",
++ "m4.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_a_2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":test_a_2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/imports/test_b_1/BUILD.bazel b/cmd/protoc-gen-go/testdata/imports/test_b_1/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/imports/test_b_1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/imports/test_b_1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "test_b_1",
++ srcs = [
++ "m1.pb.go",
++ "m2.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/imports/test_b_1",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":test_b_1",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/issue780_oneof_conflict/BUILD.bazel b/cmd/protoc-gen-go/testdata/issue780_oneof_conflict/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/issue780_oneof_conflict/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/issue780_oneof_conflict/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "issue780_oneof_conflict",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/issue780_oneof_conflict",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue780_oneof_conflict",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/nopackage/BUILD.bazel b/cmd/protoc-gen-go/testdata/nopackage/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/nopackage/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/nopackage/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "nopackage",
++ srcs = ["nopackage.pb.go"],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/nopackage",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":nopackage",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/proto2/BUILD.bazel b/cmd/protoc-gen-go/testdata/proto2/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/proto2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/proto2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto2",
++ srcs = [
++ "enum.pb.go",
++ "fields.pb.go",
++ "nested_messages.pb.go",
++ "proto2.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto2",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto2",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/proto3/BUILD.bazel b/cmd/protoc-gen-go/testdata/proto3/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/proto3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/proto3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto3",
++ srcs = [
++ "enum.pb.go",
++ "fields.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/proto3",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto3",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/cmd/protoc-gen-go/testdata/retention/BUILD.bazel b/cmd/protoc-gen-go/testdata/retention/BUILD.bazel
+--- a/cmd/protoc-gen-go/testdata/retention/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cmd/protoc-gen-go/testdata/retention/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "retention",
++ srcs = [
++ "options_message.pb.go",
++ "retention.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/cmd/protoc-gen-go/testdata/retention",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ "//types/descriptorpb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":retention",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/compiler/protogen/BUILD.bazel b/compiler/protogen/BUILD.bazel
+--- a/compiler/protogen/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/compiler/protogen/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,39 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "protogen",
++ srcs = ["protogen.go"],
++ importpath = "google.golang.org/protobuf/compiler/protogen",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//encoding/prototext",
++ "//internal/genid",
++ "//internal/strs",
++ "//proto",
++ "//reflect/protodesc",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ "//types/descriptorpb",
++ "//types/dynamicpb",
++ "//types/pluginpb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protogen",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "protogen_test",
++ srcs = ["protogen_test.go"],
++ embed = [":protogen"],
++ deps = [
++ "//proto",
++ "//reflect/protoreflect",
++ "//types/descriptorpb",
++ "//types/pluginpb",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ ],
++)
+diff -urN a/encoding/BUILD.bazel b/encoding/BUILD.bazel
+--- a/encoding/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/encoding/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,12 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_test")
++
++go_test(
++ name = "encoding_test",
++ srcs = ["bench_test.go"],
++ deps = [
++ "//encoding/protojson",
++ "//encoding/prototext",
++ "//internal/testprotos/test",
++ "//reflect/protoreflect",
++ ],
++)
+diff -urN a/encoding/protodelim/BUILD.bazel b/encoding/protodelim/BUILD.bazel
+--- a/encoding/protodelim/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/encoding/protodelim/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "protodelim",
++ srcs = ["protodelim.go"],
++ importpath = "google.golang.org/protobuf/encoding/protodelim",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//encoding/protowire",
++ "//internal/errors",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protodelim",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "protodelim_test",
++ srcs = ["protodelim_test.go"],
++ deps = [
++ ":protodelim",
++ "//encoding/protowire",
++ "//internal/testprotos/test3",
++ "//testing/protocmp",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ ],
++)
+diff -urN a/encoding/protojson/BUILD.bazel b/encoding/protojson/BUILD.bazel
+--- a/encoding/protojson/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/encoding/protojson/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,64 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "protojson",
++ srcs = [
++ "decode.go",
++ "doc.go",
++ "encode.go",
++ "well_known_types.go",
++ ],
++ importpath = "google.golang.org/protobuf/encoding/protojson",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//internal/encoding/json",
++ "//internal/encoding/messageset",
++ "//internal/errors",
++ "//internal/filedesc",
++ "//internal/flags",
++ "//internal/genid",
++ "//internal/order",
++ "//internal/pragma",
++ "//internal/set",
++ "//internal/strs",
++ "//proto",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protojson",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "protojson_test",
++ srcs = [
++ "bench_test.go",
++ "decode_test.go",
++ "encode_test.go",
++ ],
++ deps = [
++ ":protojson",
++ "//internal/detrand",
++ "//internal/errors",
++ "//internal/flags",
++ "//internal/testprotos/test",
++ "//internal/testprotos/test/weak1",
++ "//internal/testprotos/textpb2",
++ "//internal/testprotos/textpb3",
++ "//proto",
++ "//reflect/protoregistry",
++ "//testing/protopack",
++ "//types/known/anypb",
++ "//types/known/durationpb",
++ "//types/known/emptypb",
++ "//types/known/fieldmaskpb",
++ "//types/known/structpb",
++ "//types/known/timestamppb",
++ "//types/known/wrapperspb",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ ],
++)
+diff -urN a/encoding/prototext/BUILD.bazel b/encoding/prototext/BUILD.bazel
+--- a/encoding/prototext/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/encoding/prototext/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,61 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "prototext",
++ srcs = [
++ "decode.go",
++ "doc.go",
++ "encode.go",
++ ],
++ importpath = "google.golang.org/protobuf/encoding/prototext",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//encoding/protowire",
++ "//internal/encoding/messageset",
++ "//internal/encoding/text",
++ "//internal/errors",
++ "//internal/flags",
++ "//internal/genid",
++ "//internal/order",
++ "//internal/pragma",
++ "//internal/set",
++ "//internal/strs",
++ "//proto",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":prototext",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "prototext_test",
++ srcs = [
++ "decode_test.go",
++ "encode_test.go",
++ "other_test.go",
++ ],
++ deps = [
++ ":prototext",
++ "//internal/detrand",
++ "//internal/flags",
++ "//internal/testprotos/test",
++ "//internal/testprotos/test/weak1",
++ "//internal/testprotos/textpb2",
++ "//internal/testprotos/textpb3",
++ "//proto",
++ "//reflect/protoregistry",
++ "//testing/protopack",
++ "//types/known/anypb",
++ "//types/known/durationpb",
++ "//types/known/emptypb",
++ "//types/known/structpb",
++ "//types/known/timestamppb",
++ "//types/known/wrapperspb",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ ],
++)
+diff -urN a/encoding/protowire/BUILD.bazel b/encoding/protowire/BUILD.bazel
+--- a/encoding/protowire/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/encoding/protowire/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "protowire",
++ srcs = ["wire.go"],
++ importpath = "google.golang.org/protobuf/encoding/protowire",
++ visibility = ["//visibility:public"],
++ deps = ["//internal/errors"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protowire",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "protowire_test",
++ srcs = ["wire_test.go"],
++ embed = [":protowire"],
++)
+diff -urN a/internal/benchmarks/BUILD.bazel b/internal/benchmarks/BUILD.bazel
+--- a/internal/benchmarks/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/benchmarks/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_test")
++
++go_test(
++ name = "benchmarks_test",
++ srcs = ["bench_test.go"],
++ deps = [
++ "//encoding/protojson",
++ "//encoding/prototext",
++ "//internal/testprotos/benchmarks",
++ "//internal/testprotos/benchmarks/datasets/google_message1/proto2",
++ "//internal/testprotos/benchmarks/datasets/google_message1/proto3",
++ "//internal/testprotos/benchmarks/datasets/google_message2",
++ "//internal/testprotos/benchmarks/datasets/google_message3",
++ "//internal/testprotos/benchmarks/datasets/google_message4",
++ "//proto",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ ],
++)
+diff -urN a/internal/benchmarks/micro/BUILD.bazel b/internal/benchmarks/micro/BUILD.bazel
+--- a/internal/benchmarks/micro/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/benchmarks/micro/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_test")
++
++go_test(
++ name = "micro_test",
++ srcs = ["micro_test.go"],
++ deps = [
++ "//internal/impl",
++ "//internal/testprotos/benchmarks/micro",
++ "//internal/testprotos/test",
++ "//proto",
++ "//runtime/protoiface",
++ "//types/known/emptypb",
++ ],
++)
+diff -urN a/internal/cmd/generate-corpus/BUILD.bazel b/internal/cmd/generate-corpus/BUILD.bazel
+--- a/internal/cmd/generate-corpus/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/cmd/generate-corpus/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "generate-corpus_lib",
++ srcs = ["main.go"],
++ importpath = "google.golang.org/protobuf/internal/cmd/generate-corpus",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//encoding/protojson",
++ "//encoding/prototext",
++ "//internal/testprotos/fuzz",
++ "//internal/testprotos/test",
++ "//proto",
++ ],
++)
++
++go_binary(
++ name = "generate-corpus",
++ embed = [":generate-corpus_lib"],
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/cmd/generate-protos/BUILD.bazel b/internal/cmd/generate-protos/BUILD.bazel
+--- a/internal/cmd/generate-protos/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/cmd/generate-protos/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "generate-protos_lib",
++ srcs = ["main.go"],
++ importpath = "google.golang.org/protobuf/internal/cmd/generate-protos",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//cmd/protoc-gen-go/internal_gengo",
++ "//compiler/protogen",
++ "//internal/detrand",
++ ],
++)
++
++go_binary(
++ name = "generate-protos",
++ embed = [":generate-protos_lib"],
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/cmd/generate-types/BUILD.bazel b/internal/cmd/generate-types/BUILD.bazel
+--- a/internal/cmd/generate-types/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/cmd/generate-types/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "generate-types_lib",
++ srcs = [
++ "impl.go",
++ "main.go",
++ "proto.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/cmd/generate-types",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "generate-types",
++ embed = [":generate-types_lib"],
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/cmd/pbdump/BUILD.bazel b/internal/cmd/pbdump/BUILD.bazel
+--- a/internal/cmd/pbdump/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/cmd/pbdump/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "pbdump_lib",
++ srcs = ["pbdump.go"],
++ importpath = "google.golang.org/protobuf/internal/cmd/pbdump",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//encoding/protowire",
++ "//internal/errors",
++ "//proto",
++ "//reflect/protodesc",
++ "//reflect/protoreflect",
++ "//testing/protopack",
++ "//types/descriptorpb",
++ ],
++)
++
++go_binary(
++ name = "pbdump",
++ embed = [":pbdump_lib"],
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "pbdump_test",
++ srcs = ["pbdump_test.go"],
++ embed = [":pbdump_lib"],
++ deps = [
++ "//encoding/prototext",
++ "//proto",
++ "//reflect/protoreflect",
++ "//types/descriptorpb",
++ ],
++)
+diff -urN a/internal/conformance/BUILD.bazel b/internal/conformance/BUILD.bazel
+--- a/internal/conformance/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/conformance/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,12 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_test")
++
++go_test(
++ name = "conformance_test",
++ srcs = ["conformance_test.go"],
++ deps = [
++ "//encoding/protojson",
++ "//encoding/prototext",
++ "//internal/testprotos/conformance",
++ "//proto",
++ ],
++)
+diff -urN a/internal/descfmt/BUILD.bazel b/internal/descfmt/BUILD.bazel
+--- a/internal/descfmt/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/descfmt/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "descfmt",
++ srcs = ["stringer.go"],
++ importpath = "google.golang.org/protobuf/internal/descfmt",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/detrand",
++ "//internal/pragma",
++ "//reflect/protoreflect",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":descfmt",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "descfmt_test",
++ srcs = ["desc_test.go"],
++ embed = [":descfmt"],
++)
+diff -urN a/internal/descopts/BUILD.bazel b/internal/descopts/BUILD.bazel
+--- a/internal/descopts/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/descopts/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "descopts",
++ srcs = ["options.go"],
++ importpath = "google.golang.org/protobuf/internal/descopts",
++ visibility = ["//:__subpackages__"],
++ deps = ["//reflect/protoreflect"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":descopts",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/detrand/BUILD.bazel b/internal/detrand/BUILD.bazel
+--- a/internal/detrand/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/detrand/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "detrand",
++ srcs = ["rand.go"],
++ importpath = "google.golang.org/protobuf/internal/detrand",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":detrand",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "detrand_test",
++ srcs = ["rand_test.go"],
++ embed = [":detrand"],
++)
+diff -urN a/internal/encoding/defval/BUILD.bazel b/internal/encoding/defval/BUILD.bazel
+--- a/internal/encoding/defval/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/encoding/defval/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "defval",
++ srcs = ["default.go"],
++ importpath = "google.golang.org/protobuf/internal/encoding/defval",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/encoding/text",
++ "//internal/errors",
++ "//reflect/protoreflect",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":defval",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "defval_test",
++ srcs = ["default_test.go"],
++ deps = [
++ ":defval",
++ "//internal/filedesc",
++ "//reflect/protoreflect",
++ ],
++)
+diff -urN a/internal/encoding/json/BUILD.bazel b/internal/encoding/json/BUILD.bazel
+--- a/internal/encoding/json/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/encoding/json/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "json",
++ srcs = [
++ "decode.go",
++ "decode_number.go",
++ "decode_string.go",
++ "decode_token.go",
++ "encode.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/encoding/json",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/detrand",
++ "//internal/errors",
++ "//internal/strs",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":json",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "json_test",
++ srcs = [
++ "bench_test.go",
++ "decode_test.go",
++ "encode_test.go",
++ ],
++ deps = [
++ ":json",
++ "//internal/detrand",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ "@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
++ ],
++)
+diff -urN a/internal/encoding/messageset/BUILD.bazel b/internal/encoding/messageset/BUILD.bazel
+--- a/internal/encoding/messageset/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/encoding/messageset/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "messageset",
++ srcs = ["messageset.go"],
++ importpath = "google.golang.org/protobuf/internal/encoding/messageset",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//encoding/protowire",
++ "//internal/errors",
++ "//reflect/protoreflect",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":messageset",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/encoding/tag/BUILD.bazel b/internal/encoding/tag/BUILD.bazel
+--- a/internal/encoding/tag/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/encoding/tag/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "tag",
++ srcs = ["tag.go"],
++ importpath = "google.golang.org/protobuf/internal/encoding/tag",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/encoding/defval",
++ "//internal/filedesc",
++ "//internal/strs",
++ "//reflect/protoreflect",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":tag",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "tag_test",
++ srcs = ["tag_test.go"],
++ deps = [
++ ":tag",
++ "//internal/filedesc",
++ "//proto",
++ "//reflect/protodesc",
++ "//reflect/protoreflect",
++ ],
++)
+diff -urN a/internal/encoding/text/BUILD.bazel b/internal/encoding/text/BUILD.bazel
+--- a/internal/encoding/text/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/encoding/text/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,41 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "text",
++ srcs = [
++ "decode.go",
++ "decode_number.go",
++ "decode_string.go",
++ "decode_token.go",
++ "doc.go",
++ "encode.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/encoding/text",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/detrand",
++ "//internal/errors",
++ "//internal/flags",
++ "//internal/strs",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":text",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "text_test",
++ srcs = [
++ "decode_test.go",
++ "encode_test.go",
++ ],
++ deps = [
++ ":text",
++ "//internal/detrand",
++ "//internal/flags",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ ],
++)
+diff -urN a/internal/errors/BUILD.bazel b/internal/errors/BUILD.bazel
+--- a/internal/errors/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/errors/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "errors",
++ srcs = [
++ "errors.go",
++ "is_go112.go",
++ "is_go113.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/errors",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/detrand"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":errors",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "errors_test",
++ srcs = ["errors_test.go"],
++ embed = [":errors"],
++)
+diff -urN a/internal/filedesc/BUILD.bazel b/internal/filedesc/BUILD.bazel
+--- a/internal/filedesc/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/filedesc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,55 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "filedesc",
++ srcs = [
++ "build.go",
++ "desc.go",
++ "desc_init.go",
++ "desc_lazy.go",
++ "desc_list.go",
++ "desc_list_gen.go",
++ "placeholder.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/filedesc",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//encoding/protowire",
++ "//internal/descfmt",
++ "//internal/descopts",
++ "//internal/encoding/defval",
++ "//internal/encoding/messageset",
++ "//internal/errors",
++ "//internal/genid",
++ "//internal/pragma",
++ "//internal/strs",
++ "//proto",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":filedesc",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "filedesc_test",
++ srcs = [
++ "build_test.go",
++ "desc_test.go",
++ ],
++ deps = [
++ ":filedesc",
++ "//internal/detrand",
++ "//internal/testprotos/test",
++ "//internal/testprotos/test/weak1",
++ "//proto",
++ "//reflect/protodesc",
++ "//reflect/protoreflect",
++ "//types/descriptorpb",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ ],
++)
+diff -urN a/internal/filetype/BUILD.bazel b/internal/filetype/BUILD.bazel
+--- a/internal/filetype/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/filetype/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "filetype",
++ srcs = ["build.go"],
++ importpath = "google.golang.org/protobuf/internal/filetype",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/descopts",
++ "//internal/filedesc",
++ "//internal/impl",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":filetype",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/flags/BUILD.bazel b/internal/flags/BUILD.bazel
+--- a/internal/flags/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/flags/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "flags",
++ srcs = [
++ "flags.go",
++ "proto_legacy_disable.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/flags",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":flags",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/fuzz/jsonfuzz/BUILD.bazel b/internal/fuzz/jsonfuzz/BUILD.bazel
+--- a/internal/fuzz/jsonfuzz/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/fuzz/jsonfuzz/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "jsonfuzz",
++ srcs = ["fuzz.go"],
++ importpath = "google.golang.org/protobuf/internal/fuzz/jsonfuzz",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//encoding/protojson",
++ "//internal/testprotos/fuzz",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":jsonfuzz",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "jsonfuzz_test",
++ srcs = ["fuzz_test.go"],
++ embed = [":jsonfuzz"],
++ deps = ["//internal/fuzztest"],
++)
+diff -urN a/internal/fuzz/textfuzz/BUILD.bazel b/internal/fuzz/textfuzz/BUILD.bazel
+--- a/internal/fuzz/textfuzz/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/fuzz/textfuzz/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "textfuzz",
++ srcs = ["fuzz.go"],
++ importpath = "google.golang.org/protobuf/internal/fuzz/textfuzz",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//encoding/prototext",
++ "//internal/testprotos/fuzz",
++ "//proto",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":textfuzz",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "textfuzz_test",
++ srcs = ["fuzz_test.go"],
++ embed = [":textfuzz"],
++ deps = ["//internal/fuzztest"],
++)
+diff -urN a/internal/fuzz/wirefuzz/BUILD.bazel b/internal/fuzz/wirefuzz/BUILD.bazel
+--- a/internal/fuzz/wirefuzz/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/fuzz/wirefuzz/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "wirefuzz",
++ srcs = ["fuzz.go"],
++ importpath = "google.golang.org/protobuf/internal/fuzz/wirefuzz",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/impl",
++ "//internal/testprotos/fuzz",
++ "//proto",
++ "//reflect/protoregistry",
++ "//runtime/protoiface",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":wirefuzz",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "wirefuzz_test",
++ srcs = ["fuzz_test.go"],
++ embed = [":wirefuzz"],
++ deps = ["//internal/fuzztest"],
++)
+diff -urN a/internal/fuzztest/BUILD.bazel b/internal/fuzztest/BUILD.bazel
+--- a/internal/fuzztest/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/fuzztest/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "fuzztest",
++ srcs = ["fuzztest.go"],
++ importpath = "google.golang.org/protobuf/internal/fuzztest",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fuzztest",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/genid/BUILD.bazel b/internal/genid/BUILD.bazel
+--- a/internal/genid/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/genid/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "genid",
++ srcs = [
++ "any_gen.go",
++ "api_gen.go",
++ "descriptor_gen.go",
++ "doc.go",
++ "duration_gen.go",
++ "empty_gen.go",
++ "field_mask_gen.go",
++ "goname.go",
++ "map_entry.go",
++ "source_context_gen.go",
++ "struct_gen.go",
++ "timestamp_gen.go",
++ "type_gen.go",
++ "wrappers.go",
++ "wrappers_gen.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/genid",
++ visibility = ["//:__subpackages__"],
++ deps = ["//reflect/protoreflect"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":genid",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/impl/BUILD.bazel b/internal/impl/BUILD.bazel
+--- a/internal/impl/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/impl/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,111 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "impl",
++ srcs = [
++ "api_export.go",
++ "checkinit.go",
++ "codec_extension.go",
++ "codec_field.go",
++ "codec_gen.go",
++ "codec_map.go",
++ "codec_map_go111.go",
++ "codec_map_go112.go",
++ "codec_message.go",
++ "codec_messageset.go",
++ "codec_tables.go",
++ "codec_unsafe.go",
++ "convert.go",
++ "convert_list.go",
++ "convert_map.go",
++ "decode.go",
++ "encode.go",
++ "enum.go",
++ "extension.go",
++ "legacy_enum.go",
++ "legacy_export.go",
++ "legacy_extension.go",
++ "legacy_file.go",
++ "legacy_message.go",
++ "merge.go",
++ "merge_gen.go",
++ "message.go",
++ "message_reflect.go",
++ "message_reflect_field.go",
++ "message_reflect_gen.go",
++ "pointer_unsafe.go",
++ "validate.go",
++ "weak.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/impl",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//encoding/prototext",
++ "//encoding/protowire",
++ "//internal/descopts",
++ "//internal/detrand",
++ "//internal/encoding/messageset",
++ "//internal/encoding/tag",
++ "//internal/errors",
++ "//internal/filedesc",
++ "//internal/flags",
++ "//internal/genid",
++ "//internal/order",
++ "//internal/pragma",
++ "//internal/strs",
++ "//proto",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ "//runtime/protoiface",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":impl",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "impl_test",
++ srcs = [
++ "enum_test.go",
++ "extension_test.go",
++ "lazy_test.go",
++ "legacy_aberrant_test.go",
++ "legacy_export_test.go",
++ "legacy_file_test.go",
++ "legacy_test.go",
++ "message_reflect_test.go",
++ ],
++ embed = [":impl"],
++ deps = [
++ "//encoding/prototext",
++ "//internal/flags",
++ "//internal/pragma",
++ "//internal/protobuild",
++ "//internal/testprotos/legacy/proto2_20160225_2fc053c5",
++ "//internal/testprotos/legacy/proto2_20160519_a4ab9ec5",
++ "//internal/testprotos/legacy/proto2_20180125_92554152",
++ "//internal/testprotos/legacy/proto2_20180430_b4deda09",
++ "//internal/testprotos/legacy/proto2_20180814_aa810b61",
++ "//internal/testprotos/legacy/proto2_20190205_c823c79e",
++ "//internal/testprotos/legacy/proto3_20160225_2fc053c5",
++ "//internal/testprotos/legacy/proto3_20160519_a4ab9ec5",
++ "//internal/testprotos/legacy/proto3_20180125_92554152",
++ "//internal/testprotos/legacy/proto3_20180430_b4deda09",
++ "//internal/testprotos/legacy/proto3_20180814_aa810b61",
++ "//internal/testprotos/legacy/proto3_20190205_c823c79e",
++ "//internal/testprotos/test",
++ "//proto",
++ "//reflect/protodesc",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ "//runtime/protoiface",
++ "//testing/protocmp",
++ "//testing/protopack",
++ "//types/descriptorpb",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ "@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
++ ],
++)
+diff -urN a/internal/msgfmt/BUILD.bazel b/internal/msgfmt/BUILD.bazel
+--- a/internal/msgfmt/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/msgfmt/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,43 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "msgfmt",
++ srcs = ["format.go"],
++ importpath = "google.golang.org/protobuf/internal/msgfmt",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//encoding/protowire",
++ "//internal/detrand",
++ "//internal/genid",
++ "//internal/order",
++ "//proto",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":msgfmt",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "msgfmt_test",
++ srcs = ["format_test.go"],
++ deps = [
++ ":msgfmt",
++ "//internal/detrand",
++ "//internal/testprotos/test",
++ "//internal/testprotos/textpb2",
++ "//proto",
++ "//testing/protocmp",
++ "//testing/protopack",
++ "//types/dynamicpb",
++ "//types/known/anypb",
++ "//types/known/durationpb",
++ "//types/known/timestamppb",
++ "//types/known/wrapperspb",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ ],
++)
+diff -urN a/internal/order/BUILD.bazel b/internal/order/BUILD.bazel
+--- a/internal/order/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/order/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "order",
++ srcs = [
++ "order.go",
++ "range.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/order",
++ visibility = ["//:__subpackages__"],
++ deps = ["//reflect/protoreflect"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":order",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "order_test",
++ srcs = ["order_test.go"],
++ embed = [":order"],
++ deps = [
++ "//reflect/protoreflect",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ ],
++)
+diff -urN a/internal/pragma/BUILD.bazel b/internal/pragma/BUILD.bazel
+--- a/internal/pragma/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/pragma/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "pragma",
++ srcs = ["pragma.go"],
++ importpath = "google.golang.org/protobuf/internal/pragma",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":pragma",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/protobuild/BUILD.bazel b/internal/protobuild/BUILD.bazel
+--- a/internal/protobuild/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/protobuild/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "protobuild",
++ srcs = ["build.go"],
++ importpath = "google.golang.org/protobuf/internal/protobuild",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protobuild",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/protolegacy/BUILD.bazel b/internal/protolegacy/BUILD.bazel
+--- a/internal/protolegacy/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/protolegacy/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "protolegacy",
++ srcs = ["proto.go"],
++ importpath = "google.golang.org/protobuf/internal/protolegacy",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ "//runtime/protoiface",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protolegacy",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/set/BUILD.bazel b/internal/set/BUILD.bazel
+--- a/internal/set/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/set/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "set",
++ srcs = ["ints.go"],
++ importpath = "google.golang.org/protobuf/internal/set",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":set",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "set_test",
++ srcs = ["ints_test.go"],
++ embed = [":set"],
++)
+diff -urN a/internal/strs/BUILD.bazel b/internal/strs/BUILD.bazel
+--- a/internal/strs/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/strs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "strs",
++ srcs = [
++ "strings.go",
++ "strings_unsafe.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/strs",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/flags",
++ "//reflect/protoreflect",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":strs",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "strs_test",
++ srcs = ["strings_test.go"],
++ embed = [":strs"],
++)
+diff -urN a/internal/testprotos/annotation/BUILD.bazel b/internal/testprotos/annotation/BUILD.bazel
+--- a/internal/testprotos/annotation/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/annotation/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "annotation",
++ srcs = ["annotation.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/annotation",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ "//types/descriptorpb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":annotation",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/benchmarks/BUILD.bazel b/internal/testprotos/benchmarks/BUILD.bazel
+--- a/internal/testprotos/benchmarks/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/benchmarks/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "benchmarks",
++ srcs = ["benchmarks.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/benchmarks",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":benchmarks",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/benchmarks/datasets/google_message1/proto2/BUILD.bazel b/internal/testprotos/benchmarks/datasets/google_message1/proto2/BUILD.bazel
+--- a/internal/testprotos/benchmarks/datasets/google_message1/proto2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/benchmarks/datasets/google_message1/proto2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto2",
++ srcs = ["benchmark_message1_proto2.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/benchmarks/datasets/google_message1/proto2",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto2",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/benchmarks/datasets/google_message1/proto3/BUILD.bazel b/internal/testprotos/benchmarks/datasets/google_message1/proto3/BUILD.bazel
+--- a/internal/testprotos/benchmarks/datasets/google_message1/proto3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/benchmarks/datasets/google_message1/proto3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto3",
++ srcs = ["benchmark_message1_proto3.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/benchmarks/datasets/google_message1/proto3",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto3",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/benchmarks/datasets/google_message2/BUILD.bazel b/internal/testprotos/benchmarks/datasets/google_message2/BUILD.bazel
+--- a/internal/testprotos/benchmarks/datasets/google_message2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/benchmarks/datasets/google_message2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "google_message2",
++ srcs = ["benchmark_message2.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/benchmarks/datasets/google_message2",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":google_message2",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/benchmarks/datasets/google_message3/BUILD.bazel b/internal/testprotos/benchmarks/datasets/google_message3/BUILD.bazel
+--- a/internal/testprotos/benchmarks/datasets/google_message3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/benchmarks/datasets/google_message3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "google_message3",
++ srcs = [
++ "benchmark_message3.pb.go",
++ "benchmark_message3_1.pb.go",
++ "benchmark_message3_2.pb.go",
++ "benchmark_message3_3.pb.go",
++ "benchmark_message3_4.pb.go",
++ "benchmark_message3_5.pb.go",
++ "benchmark_message3_6.pb.go",
++ "benchmark_message3_7.pb.go",
++ "benchmark_message3_8.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/testprotos/benchmarks/datasets/google_message3",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":google_message3",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/benchmarks/datasets/google_message4/BUILD.bazel b/internal/testprotos/benchmarks/datasets/google_message4/BUILD.bazel
+--- a/internal/testprotos/benchmarks/datasets/google_message4/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/benchmarks/datasets/google_message4/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "google_message4",
++ srcs = [
++ "benchmark_message4.pb.go",
++ "benchmark_message4_1.pb.go",
++ "benchmark_message4_2.pb.go",
++ "benchmark_message4_3.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/testprotos/benchmarks/datasets/google_message4",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":google_message4",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/benchmarks/micro/BUILD.bazel b/internal/testprotos/benchmarks/micro/BUILD.bazel
+--- a/internal/testprotos/benchmarks/micro/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/benchmarks/micro/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "micro",
++ srcs = ["micro.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/benchmarks/micro",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":micro",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/conformance/BUILD.bazel b/internal/testprotos/conformance/BUILD.bazel
+--- a/internal/testprotos/conformance/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/conformance/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "conformance",
++ srcs = [
++ "conformance.pb.go",
++ "test_messages_proto2.pb.go",
++ "test_messages_proto3.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/testprotos/conformance",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ "//types/known/anypb",
++ "//types/known/durationpb",
++ "//types/known/fieldmaskpb",
++ "//types/known/structpb",
++ "//types/known/timestamppb",
++ "//types/known/wrapperspb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":conformance",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/enums/BUILD.bazel b/internal/testprotos/enums/BUILD.bazel
+--- a/internal/testprotos/enums/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/enums/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "enums",
++ srcs = ["enums.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/enums",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":enums",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/fieldtrack/BUILD.bazel b/internal/testprotos/fieldtrack/BUILD.bazel
+--- a/internal/testprotos/fieldtrack/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/fieldtrack/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "fieldtrack",
++ srcs = ["fieldtrack.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/fieldtrack",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/testprotos/annotation",
++ "//internal/testprotos/test",
++ "//proto",
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fieldtrack",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/fuzz/BUILD.bazel b/internal/testprotos/fuzz/BUILD.bazel
+--- a/internal/testprotos/fuzz/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/fuzz/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "fuzz",
++ srcs = ["fuzz.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/fuzz",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/testprotos/test",
++ "//internal/testprotos/test3",
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fuzz",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/irregular/BUILD.bazel b/internal/testprotos/irregular/BUILD.bazel
+--- a/internal/testprotos/irregular/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/irregular/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "irregular",
++ srcs = [
++ "irregular.go",
++ "test.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/testprotos/irregular",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//encoding/prototext",
++ "//reflect/protodesc",
++ "//reflect/protoreflect",
++ "//runtime/protoiface",
++ "//runtime/protoimpl",
++ "//types/descriptorpb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":irregular",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/legacy/bug1052/BUILD.bazel b/internal/testprotos/legacy/bug1052/BUILD.bazel
+--- a/internal/testprotos/legacy/bug1052/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/legacy/bug1052/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "bug1052",
++ srcs = ["bug1052.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/legacy/bug1052",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/protolegacy",
++ "//types/descriptorpb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":bug1052",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "bug1052_test",
++ srcs = ["bug1052_test.go"],
++ deps = [":bug1052"],
++)
+diff -urN a/internal/testprotos/legacy/BUILD.bazel b/internal/testprotos/legacy/BUILD.bazel
+--- a/internal/testprotos/legacy/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/legacy/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "legacy",
++ srcs = ["legacy.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/legacy",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/testprotos/legacy/proto2_20160225_2fc053c5",
++ "//internal/testprotos/legacy/proto2_20160519_a4ab9ec5",
++ "//internal/testprotos/legacy/proto2_20180125_92554152",
++ "//internal/testprotos/legacy/proto2_20180430_b4deda09",
++ "//internal/testprotos/legacy/proto2_20180814_aa810b61",
++ "//internal/testprotos/legacy/proto2_20190205_c823c79e",
++ "//internal/testprotos/legacy/proto3_20160225_2fc053c5",
++ "//internal/testprotos/legacy/proto3_20160519_a4ab9ec5",
++ "//internal/testprotos/legacy/proto3_20180125_92554152",
++ "//internal/testprotos/legacy/proto3_20180430_b4deda09",
++ "//internal/testprotos/legacy/proto3_20180814_aa810b61",
++ "//internal/testprotos/legacy/proto3_20190205_c823c79e",
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":legacy",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/legacy/proto2_20160225_2fc053c5/BUILD.bazel b/internal/testprotos/legacy/proto2_20160225_2fc053c5/BUILD.bazel
+--- a/internal/testprotos/legacy/proto2_20160225_2fc053c5/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/legacy/proto2_20160225_2fc053c5/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto2_20160225_2fc053c5",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/legacy/proto2_20160225_2fc053c5",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/protolegacy"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto2_20160225_2fc053c5",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/legacy/proto2_20160519_a4ab9ec5/BUILD.bazel b/internal/testprotos/legacy/proto2_20160519_a4ab9ec5/BUILD.bazel
+--- a/internal/testprotos/legacy/proto2_20160519_a4ab9ec5/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/legacy/proto2_20160519_a4ab9ec5/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto2_20160519_a4ab9ec5",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/legacy/proto2_20160519_a4ab9ec5",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/protolegacy"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto2_20160519_a4ab9ec5",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/legacy/proto2_20180125_92554152/BUILD.bazel b/internal/testprotos/legacy/proto2_20180125_92554152/BUILD.bazel
+--- a/internal/testprotos/legacy/proto2_20180125_92554152/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/legacy/proto2_20180125_92554152/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto2_20180125_92554152",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/legacy/proto2_20180125_92554152",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/protolegacy"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto2_20180125_92554152",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/legacy/proto2_20180430_b4deda09/BUILD.bazel b/internal/testprotos/legacy/proto2_20180430_b4deda09/BUILD.bazel
+--- a/internal/testprotos/legacy/proto2_20180430_b4deda09/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/legacy/proto2_20180430_b4deda09/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto2_20180430_b4deda09",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/legacy/proto2_20180430_b4deda09",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/protolegacy"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto2_20180430_b4deda09",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/legacy/proto2_20180814_aa810b61/BUILD.bazel b/internal/testprotos/legacy/proto2_20180814_aa810b61/BUILD.bazel
+--- a/internal/testprotos/legacy/proto2_20180814_aa810b61/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/legacy/proto2_20180814_aa810b61/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto2_20180814_aa810b61",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/legacy/proto2_20180814_aa810b61",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/protolegacy"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto2_20180814_aa810b61",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/legacy/proto2_20190205_c823c79e/BUILD.bazel b/internal/testprotos/legacy/proto2_20190205_c823c79e/BUILD.bazel
+--- a/internal/testprotos/legacy/proto2_20190205_c823c79e/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/legacy/proto2_20190205_c823c79e/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto2_20190205_c823c79e",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/legacy/proto2_20190205_c823c79e",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/protolegacy"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto2_20190205_c823c79e",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/legacy/proto3_20160225_2fc053c5/BUILD.bazel b/internal/testprotos/legacy/proto3_20160225_2fc053c5/BUILD.bazel
+--- a/internal/testprotos/legacy/proto3_20160225_2fc053c5/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/legacy/proto3_20160225_2fc053c5/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto3_20160225_2fc053c5",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/legacy/proto3_20160225_2fc053c5",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/protolegacy"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto3_20160225_2fc053c5",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/legacy/proto3_20160519_a4ab9ec5/BUILD.bazel b/internal/testprotos/legacy/proto3_20160519_a4ab9ec5/BUILD.bazel
+--- a/internal/testprotos/legacy/proto3_20160519_a4ab9ec5/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/legacy/proto3_20160519_a4ab9ec5/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto3_20160519_a4ab9ec5",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/legacy/proto3_20160519_a4ab9ec5",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/protolegacy"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto3_20160519_a4ab9ec5",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/legacy/proto3_20180125_92554152/BUILD.bazel b/internal/testprotos/legacy/proto3_20180125_92554152/BUILD.bazel
+--- a/internal/testprotos/legacy/proto3_20180125_92554152/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/legacy/proto3_20180125_92554152/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto3_20180125_92554152",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/legacy/proto3_20180125_92554152",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/protolegacy"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto3_20180125_92554152",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/legacy/proto3_20180430_b4deda09/BUILD.bazel b/internal/testprotos/legacy/proto3_20180430_b4deda09/BUILD.bazel
+--- a/internal/testprotos/legacy/proto3_20180430_b4deda09/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/legacy/proto3_20180430_b4deda09/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto3_20180430_b4deda09",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/legacy/proto3_20180430_b4deda09",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/protolegacy"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto3_20180430_b4deda09",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/legacy/proto3_20180814_aa810b61/BUILD.bazel b/internal/testprotos/legacy/proto3_20180814_aa810b61/BUILD.bazel
+--- a/internal/testprotos/legacy/proto3_20180814_aa810b61/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/legacy/proto3_20180814_aa810b61/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto3_20180814_aa810b61",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/legacy/proto3_20180814_aa810b61",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/protolegacy"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto3_20180814_aa810b61",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/legacy/proto3_20190205_c823c79e/BUILD.bazel b/internal/testprotos/legacy/proto3_20190205_c823c79e/BUILD.bazel
+--- a/internal/testprotos/legacy/proto3_20190205_c823c79e/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/legacy/proto3_20190205_c823c79e/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "proto3_20190205_c823c79e",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/legacy/proto3_20190205_c823c79e",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/protolegacy"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto3_20190205_c823c79e",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/messageset/messagesetpb/BUILD.bazel b/internal/testprotos/messageset/messagesetpb/BUILD.bazel
+--- a/internal/testprotos/messageset/messagesetpb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/messageset/messagesetpb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "messagesetpb",
++ srcs = ["message_set.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/messageset/messagesetpb",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":messagesetpb",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/messageset/msetextpb/BUILD.bazel b/internal/testprotos/messageset/msetextpb/BUILD.bazel
+--- a/internal/testprotos/messageset/msetextpb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/messageset/msetextpb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "msetextpb",
++ srcs = ["msetextpb.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/messageset/msetextpb",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/testprotos/messageset/messagesetpb",
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":msetextpb",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/news/BUILD.bazel b/internal/testprotos/news/BUILD.bazel
+--- a/internal/testprotos/news/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/news/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "news",
++ srcs = ["news.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/news",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ "//types/known/anypb",
++ "//types/known/timestamppb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":news",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/nullable/BUILD.bazel b/internal/testprotos/nullable/BUILD.bazel
+--- a/internal/testprotos/nullable/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/nullable/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "nullable",
++ srcs = ["nullable.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/nullable",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//encoding/prototext",
++ "//encoding/protowire",
++ "//runtime/protoimpl",
++ "//types/descriptorpb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":nullable",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "nullable_test",
++ srcs = ["nullable_test.go"],
++ embed = [":nullable"],
++ deps = [
++ "//proto",
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ "//testing/protocmp",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ ],
++)
+diff -urN a/internal/testprotos/order/BUILD.bazel b/internal/testprotos/order/BUILD.bazel
+--- a/internal/testprotos/order/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/order/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "order",
++ srcs = ["order.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/order",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":order",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/registry/BUILD.bazel b/internal/testprotos/registry/BUILD.bazel
+--- a/internal/testprotos/registry/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/registry/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "registry",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/registry",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":registry",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/required/BUILD.bazel b/internal/testprotos/required/BUILD.bazel
+--- a/internal/testprotos/required/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/required/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "required",
++ srcs = ["required.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/required",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":required",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/test/BUILD.bazel b/internal/testprotos/test/BUILD.bazel
+--- a/internal/testprotos/test/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/test/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "test",
++ srcs = [
++ "ext.pb.go",
++ "test.pb.go",
++ "test_import.pb.go",
++ "test_public.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/testprotos/test",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/testprotos/enums",
++ "//proto",
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":test",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/test/weak1/BUILD.bazel b/internal/testprotos/test/weak1/BUILD.bazel
+--- a/internal/testprotos/test/weak1/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/test/weak1/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "weak1",
++ srcs = ["test_weak.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/test/weak1",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":weak1",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/test/weak2/BUILD.bazel b/internal/testprotos/test/weak2/BUILD.bazel
+--- a/internal/testprotos/test/weak2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/test/weak2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "weak2",
++ srcs = ["test_weak.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/test/weak2",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":weak2",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/test3/BUILD.bazel b/internal/testprotos/test3/BUILD.bazel
+--- a/internal/testprotos/test3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/test3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "test3",
++ srcs = [
++ "test.pb.go",
++ "test_extension.pb.go",
++ "test_import.pb.go",
++ ],
++ importpath = "google.golang.org/protobuf/internal/testprotos/test3",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ "//types/descriptorpb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":test3",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/textpb2/BUILD.bazel b/internal/testprotos/textpb2/BUILD.bazel
+--- a/internal/testprotos/textpb2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/textpb2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "textpb2",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/textpb2",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ "//types/known/anypb",
++ "//types/known/durationpb",
++ "//types/known/emptypb",
++ "//types/known/fieldmaskpb",
++ "//types/known/structpb",
++ "//types/known/timestamppb",
++ "//types/known/wrapperspb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":textpb2",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/testprotos/textpb3/BUILD.bazel b/internal/testprotos/textpb3/BUILD.bazel
+--- a/internal/testprotos/textpb3/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/testprotos/textpb3/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "textpb3",
++ srcs = ["test.pb.go"],
++ importpath = "google.golang.org/protobuf/internal/testprotos/textpb3",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":textpb3",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/version/BUILD.bazel b/internal/version/BUILD.bazel
+--- a/internal/version/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/version/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "version",
++ srcs = ["version.go"],
++ importpath = "google.golang.org/protobuf/internal/version",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":version",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/internal/weakdeps/BUILD.bazel b/internal/weakdeps/BUILD.bazel
+--- a/internal/weakdeps/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/weakdeps/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "weakdeps",
++ srcs = ["doc.go"],
++ importpath = "google.golang.org/protobuf/internal/weakdeps",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":weakdeps",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN a/proto/BUILD.bazel b/proto/BUILD.bazel
+--- a/proto/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/proto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,95 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "proto",
++ srcs = [
++ "checkinit.go",
++ "decode.go",
++ "decode_gen.go",
++ "doc.go",
++ "encode.go",
++ "encode_gen.go",
++ "equal.go",
++ "extension.go",
++ "merge.go",
++ "messageset.go",
++ "proto.go",
++ "proto_methods.go",
++ "reset.go",
++ "size.go",
++ "size_gen.go",
++ "wrappers.go",
++ ],
++ importpath = "google.golang.org/protobuf/proto",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//encoding/protowire",
++ "//internal/encoding/messageset",
++ "//internal/errors",
++ "//internal/flags",
++ "//internal/genid",
++ "//internal/order",
++ "//internal/pragma",
++ "//internal/strs",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ "//runtime/protoiface",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proto",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "proto_test",
++ srcs = [
++ "bench_test.go",
++ "checkinit_test.go",
++ "decode_test.go",
++ "encode_test.go",
++ "equal_test.go",
++ "extension_test.go",
++ "merge_test.go",
++ "messageset_test.go",
++ "methods_test.go",
++ "nil_test.go",
++ "noenforceutf8_test.go",
++ "reset_test.go",
++ "testmessages_test.go",
++ "validate_test.go",
++ "weak_test.go",
++ ],
++ deps = [
++ ":proto",
++ "//encoding/prototext",
++ "//encoding/protowire",
++ "//internal/errors",
++ "//internal/filedesc",
++ "//internal/flags",
++ "//internal/impl",
++ "//internal/pragma",
++ "//internal/protobuild",
++ "//internal/testprotos/legacy",
++ "//internal/testprotos/legacy/proto2_20160225_2fc053c5",
++ "//internal/testprotos/messageset/messagesetpb",
++ "//internal/testprotos/messageset/msetextpb",
++ "//internal/testprotos/order",
++ "//internal/testprotos/required",
++ "//internal/testprotos/test",
++ "//internal/testprotos/test/weak1",
++ "//internal/testprotos/test3",
++ "//reflect/protodesc",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ "//runtime/protoiface",
++ "//runtime/protoimpl",
++ "//testing/protocmp",
++ "//testing/protopack",
++ "//types/descriptorpb",
++ "//types/dynamicpb",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ ],
++)
+diff -urN a/protoadapt/BUILD.bazel b/protoadapt/BUILD.bazel
+--- a/protoadapt/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/protoadapt/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "protoadapt",
++ srcs = ["convert.go"],
++ importpath = "google.golang.org/protobuf/protoadapt",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//runtime/protoiface",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protoadapt",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/reflect/protodesc/BUILD.bazel b/reflect/protodesc/BUILD.bazel
+--- a/reflect/protodesc/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/reflect/protodesc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,48 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "protodesc",
++ srcs = [
++ "desc.go",
++ "desc_init.go",
++ "desc_resolve.go",
++ "desc_validate.go",
++ "proto.go",
++ ],
++ importpath = "google.golang.org/protobuf/reflect/protodesc",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//encoding/protowire",
++ "//internal/encoding/defval",
++ "//internal/errors",
++ "//internal/filedesc",
++ "//internal/flags",
++ "//internal/genid",
++ "//internal/pragma",
++ "//internal/strs",
++ "//proto",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ "//types/descriptorpb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protodesc",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "protodesc_test",
++ srcs = ["file_test.go"],
++ embed = [":protodesc"],
++ deps = [
++ "//encoding/prototext",
++ "//internal/flags",
++ "//proto",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ "//types/descriptorpb",
++ ],
++)
+diff -urN a/reflect/protopath/BUILD.bazel b/reflect/protopath/BUILD.bazel
+--- a/reflect/protopath/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/reflect/protopath/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "protopath",
++ srcs = [
++ "path.go",
++ "step.go",
++ ],
++ importpath = "google.golang.org/protobuf/reflect/protopath",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//internal/encoding/text",
++ "//internal/msgfmt",
++ "//reflect/protoreflect",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protopath",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/reflect/protorange/BUILD.bazel b/reflect/protorange/BUILD.bazel
+--- a/reflect/protorange/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/reflect/protorange/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,46 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "protorange",
++ srcs = ["range.go"],
++ importpath = "google.golang.org/protobuf/reflect/protorange",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//internal/genid",
++ "//internal/order",
++ "//proto",
++ "//reflect/protopath",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protorange",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "protorange_test",
++ srcs = [
++ "example_test.go",
++ "range_test.go",
++ ],
++ embed = [":protorange"],
++ deps = [
++ "//encoding/protojson",
++ "//internal/detrand",
++ "//internal/testprotos/news",
++ "//proto",
++ "//reflect/protopath",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ "//testing/protocmp",
++ "//testing/protopack",
++ "//types/known/anypb",
++ "//types/known/timestamppb",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ "@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
++ ],
++)
+diff -urN a/reflect/protoreflect/BUILD.bazel b/reflect/protoreflect/BUILD.bazel
+--- a/reflect/protoreflect/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/reflect/protoreflect/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "protoreflect",
++ srcs = [
++ "methods.go",
++ "proto.go",
++ "source.go",
++ "source_gen.go",
++ "type.go",
++ "value.go",
++ "value_equal.go",
++ "value_union.go",
++ "value_unsafe.go",
++ ],
++ importpath = "google.golang.org/protobuf/reflect/protoreflect",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//encoding/protowire",
++ "//internal/pragma",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protoreflect",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "protoreflect_test",
++ srcs = [
++ "proto_test.go",
++ "source_test.go",
++ "value_test.go",
++ ],
++ embed = [":protoreflect"],
++)
+diff -urN a/reflect/protoregistry/BUILD.bazel b/reflect/protoregistry/BUILD.bazel
+--- a/reflect/protoregistry/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/reflect/protoregistry/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "protoregistry",
++ srcs = ["registry.go"],
++ importpath = "google.golang.org/protobuf/reflect/protoregistry",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//internal/encoding/messageset",
++ "//internal/errors",
++ "//internal/flags",
++ "//reflect/protoreflect",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protoregistry",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "protoregistry_test",
++ srcs = ["registry_test.go"],
++ deps = [
++ ":protoregistry",
++ "//encoding/prototext",
++ "//internal/impl",
++ "//internal/testprotos/registry",
++ "//reflect/protodesc",
++ "//reflect/protoreflect",
++ "//types/descriptorpb",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ "@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
++ ],
++)
+diff -urN a/runtime/protoiface/BUILD.bazel b/runtime/protoiface/BUILD.bazel
+--- a/runtime/protoiface/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/runtime/protoiface/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "protoiface",
++ srcs = [
++ "legacy.go",
++ "methods.go",
++ ],
++ importpath = "google.golang.org/protobuf/runtime/protoiface",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//internal/pragma",
++ "//reflect/protoreflect",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protoiface",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/runtime/protoimpl/BUILD.bazel b/runtime/protoimpl/BUILD.bazel
+--- a/runtime/protoimpl/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/runtime/protoimpl/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "protoimpl",
++ srcs = [
++ "impl.go",
++ "version.go",
++ ],
++ importpath = "google.golang.org/protobuf/runtime/protoimpl",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//internal/filedesc",
++ "//internal/filetype",
++ "//internal/impl",
++ "//internal/version",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protoimpl",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/testing/protocmp/BUILD.bazel b/testing/protocmp/BUILD.bazel
+--- a/testing/protocmp/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/testing/protocmp/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,52 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "protocmp",
++ srcs = [
++ "reflect.go",
++ "util.go",
++ "xform.go",
++ ],
++ importpath = "google.golang.org/protobuf/testing/protocmp",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//encoding/protowire",
++ "//internal/genid",
++ "//internal/msgfmt",
++ "//proto",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ "//runtime/protoiface",
++ "//runtime/protoimpl",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ "@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protocmp",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "protocmp_test",
++ srcs = [
++ "reflect_test.go",
++ "util_test.go",
++ "xform_test.go",
++ ],
++ embed = [":protocmp"],
++ deps = [
++ "//internal/detrand",
++ "//internal/testprotos/test",
++ "//internal/testprotos/textpb2",
++ "//proto",
++ "//reflect/protoreflect",
++ "//testing/protopack",
++ "//types/dynamicpb",
++ "//types/known/anypb",
++ "//types/known/wrapperspb",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ ],
++)
+diff -urN a/testing/protopack/BUILD.bazel b/testing/protopack/BUILD.bazel
+--- a/testing/protopack/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/testing/protopack/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "protopack",
++ srcs = ["pack.go"],
++ importpath = "google.golang.org/protobuf/testing/protopack",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//encoding/protowire",
++ "//reflect/protoreflect",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":protopack",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "protopack_test",
++ srcs = ["pack_test.go"],
++ embed = [":protopack"],
++ deps = [
++ "//encoding/prototext",
++ "//reflect/protodesc",
++ "//reflect/protoreflect",
++ "//types/descriptorpb",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ ],
++)
+diff -urN a/testing/prototest/BUILD.bazel b/testing/prototest/BUILD.bazel
+--- a/testing/prototest/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/testing/prototest/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,42 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "prototest",
++ srcs = [
++ "enum.go",
++ "message.go",
++ ],
++ importpath = "google.golang.org/protobuf/testing/prototest",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//encoding/prototext",
++ "//encoding/protowire",
++ "//proto",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":prototest",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "prototest_test",
++ srcs = ["prototest_test.go"],
++ deps = [
++ ":prototest",
++ "//internal/flags",
++ "//internal/testprotos/irregular",
++ "//internal/testprotos/legacy",
++ "//internal/testprotos/legacy/proto2_20160225_2fc053c5",
++ "//internal/testprotos/test",
++ "//internal/testprotos/test/weak1",
++ "//internal/testprotos/test/weak2",
++ "//internal/testprotos/test3",
++ "//proto",
++ "//runtime/protoimpl",
++ ],
++)
+diff -urN a/types/descriptorpb/BUILD.bazel b/types/descriptorpb/BUILD.bazel
+--- a/types/descriptorpb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/types/descriptorpb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "descriptorpb",
++ srcs = ["descriptor.pb.go"],
++ importpath = "google.golang.org/protobuf/types/descriptorpb",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":descriptorpb",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/types/dynamicpb/BUILD.bazel b/types/dynamicpb/BUILD.bazel
+--- a/types/dynamicpb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/types/dynamicpb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "dynamicpb",
++ srcs = ["dynamic.go"],
++ importpath = "google.golang.org/protobuf/types/dynamicpb",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//internal/errors",
++ "//reflect/protoreflect",
++ "//runtime/protoiface",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":dynamicpb",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "dynamicpb_test",
++ srcs = ["dynamic_test.go"],
++ deps = [
++ ":dynamicpb",
++ "//internal/testprotos/test",
++ "//internal/testprotos/test3",
++ "//proto",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ "//testing/prototest",
++ ],
++)
+diff -urN a/types/known/anypb/BUILD.bazel b/types/known/anypb/BUILD.bazel
+--- a/types/known/anypb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/types/known/anypb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "anypb",
++ srcs = ["any.pb.go"],
++ importpath = "google.golang.org/protobuf/types/known/anypb",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//reflect/protoreflect",
++ "//reflect/protoregistry",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":anypb",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "anypb_test",
++ srcs = ["any_test.go"],
++ deps = [
++ ":anypb",
++ "//internal/testprotos/test",
++ "//proto",
++ "//reflect/protoreflect",
++ "//testing/protocmp",
++ "//types/known/emptypb",
++ "//types/known/wrapperspb",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ ],
++)
+diff -urN a/types/known/apipb/BUILD.bazel b/types/known/apipb/BUILD.bazel
+--- a/types/known/apipb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/types/known/apipb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "apipb",
++ srcs = ["api.pb.go"],
++ importpath = "google.golang.org/protobuf/types/known/apipb",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ "//types/known/sourcecontextpb",
++ "//types/known/typepb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":apipb",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/types/known/durationpb/BUILD.bazel b/types/known/durationpb/BUILD.bazel
+--- a/types/known/durationpb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/types/known/durationpb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "durationpb",
++ srcs = ["duration.pb.go"],
++ importpath = "google.golang.org/protobuf/types/known/durationpb",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":durationpb",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "durationpb_test",
++ srcs = ["duration_test.go"],
++ deps = [
++ ":durationpb",
++ "//internal/detrand",
++ "//testing/protocmp",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ "@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
++ ],
++)
+diff -urN a/types/known/emptypb/BUILD.bazel b/types/known/emptypb/BUILD.bazel
+--- a/types/known/emptypb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/types/known/emptypb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "emptypb",
++ srcs = ["empty.pb.go"],
++ importpath = "google.golang.org/protobuf/types/known/emptypb",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":emptypb",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/types/known/fieldmaskpb/BUILD.bazel b/types/known/fieldmaskpb/BUILD.bazel
+--- a/types/known/fieldmaskpb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/types/known/fieldmaskpb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "fieldmaskpb",
++ srcs = ["field_mask.pb.go"],
++ importpath = "google.golang.org/protobuf/types/known/fieldmaskpb",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//proto",
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fieldmaskpb",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "fieldmaskpb_test",
++ srcs = ["field_mask_test.go"],
++ deps = [
++ ":fieldmaskpb",
++ "//internal/testprotos/test",
++ "//proto",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ "@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
++ ],
++)
+diff -urN a/types/known/sourcecontextpb/BUILD.bazel b/types/known/sourcecontextpb/BUILD.bazel
+--- a/types/known/sourcecontextpb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/types/known/sourcecontextpb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "sourcecontextpb",
++ srcs = ["source_context.pb.go"],
++ importpath = "google.golang.org/protobuf/types/known/sourcecontextpb",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sourcecontextpb",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/types/known/structpb/BUILD.bazel b/types/known/structpb/BUILD.bazel
+--- a/types/known/structpb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/types/known/structpb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "structpb",
++ srcs = ["struct.pb.go"],
++ importpath = "google.golang.org/protobuf/types/known/structpb",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//encoding/protojson",
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":structpb",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "structpb_test",
++ srcs = ["struct_test.go"],
++ deps = [
++ ":structpb",
++ "//reflect/protoreflect",
++ "//testing/protocmp",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ "@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
++ ],
++)
+diff -urN a/types/known/timestamppb/BUILD.bazel b/types/known/timestamppb/BUILD.bazel
+--- a/types/known/timestamppb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/types/known/timestamppb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "timestamppb",
++ srcs = ["timestamp.pb.go"],
++ importpath = "google.golang.org/protobuf/types/known/timestamppb",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":timestamppb",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "timestamppb_test",
++ srcs = ["timestamp_test.go"],
++ deps = [
++ ":timestamppb",
++ "//internal/detrand",
++ "//testing/protocmp",
++ "@com_github_google_go_cmp//cmp:go_default_library",
++ "@com_github_google_go_cmp//cmp/cmpopts:go_default_library",
++ ],
++)
+diff -urN a/types/known/typepb/BUILD.bazel b/types/known/typepb/BUILD.bazel
+--- a/types/known/typepb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/types/known/typepb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typepb",
++ srcs = ["type.pb.go"],
++ importpath = "google.golang.org/protobuf/types/known/typepb",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ "//types/known/anypb",
++ "//types/known/sourcecontextpb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typepb",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/types/known/wrapperspb/BUILD.bazel b/types/known/wrapperspb/BUILD.bazel
+--- a/types/known/wrapperspb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/types/known/wrapperspb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "wrapperspb",
++ srcs = ["wrappers.pb.go"],
++ importpath = "google.golang.org/protobuf/types/known/wrapperspb",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":wrapperspb",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/types/pluginpb/BUILD.bazel b/types/pluginpb/BUILD.bazel
+--- a/types/pluginpb/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/types/pluginpb/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "pluginpb",
++ srcs = ["plugin.pb.go"],
++ importpath = "google.golang.org/protobuf/types/pluginpb",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//reflect/protoreflect",
++ "//runtime/protoimpl",
++ "//types/descriptorpb",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":pluginpb",
++ visibility = ["//visibility:public"],
++)
diff --git a/third_party/org_golang_x_sys-gazelle.patch b/third_party/org_golang_x_sys-gazelle.patch
new file mode 100644
index 00000000..59feea5f
--- /dev/null
+++ b/third_party/org_golang_x_sys-gazelle.patch
@@ -0,0 +1,802 @@
+diff -urN a/cpu/BUILD.bazel b/cpu/BUILD.bazel
+--- a/cpu/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/cpu/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,67 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "cpu",
++ srcs = [
++ "asm_aix_ppc64.s",
++ "byteorder.go",
++ "cpu.go",
++ "cpu_aix.go",
++ "cpu_arm.go",
++ "cpu_arm64.go",
++ "cpu_arm64.s",
++ "cpu_gc_arm64.go",
++ "cpu_gc_s390x.go",
++ "cpu_gc_x86.go",
++ "cpu_linux.go",
++ "cpu_linux_arm.go",
++ "cpu_linux_arm64.go",
++ "cpu_linux_mips64x.go",
++ "cpu_linux_noinit.go",
++ "cpu_linux_ppc64x.go",
++ "cpu_linux_s390x.go",
++ "cpu_mips64x.go",
++ "cpu_mipsx.go",
++ "cpu_netbsd_arm64.go",
++ "cpu_openbsd_arm64.go",
++ "cpu_openbsd_arm64.s",
++ "cpu_other_arm.go",
++ "cpu_other_arm64.go",
++ "cpu_ppc64x.go",
++ "cpu_riscv64.go",
++ "cpu_s390x.go",
++ "cpu_s390x.s",
++ "cpu_wasm.go",
++ "cpu_x86.go",
++ "cpu_x86.s",
++ "cpu_zos.go",
++ "cpu_zos_s390x.go",
++ "endian_big.go",
++ "endian_little.go",
++ "hwcap_linux.go",
++ "parse.go",
++ "proc_cpuinfo_linux.go",
++ "runtime_auxv.go",
++ "runtime_auxv_go121.go",
++ "syscall_aix_ppc64_gc.go",
++ ],
++ importpath = "golang.org/x/sys/cpu",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":cpu",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "cpu_test",
++ srcs = [
++ "cpu_s390x_test.go",
++ "cpu_test.go",
++ "parse_test.go",
++ "runtime_auxv_go121_test.go",
++ ],
++ embed = [":cpu"],
++)
+diff -urN a/execabs/BUILD.bazel b/execabs/BUILD.bazel
+--- a/execabs/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/execabs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "execabs",
++ srcs = [
++ "execabs.go",
++ "execabs_go118.go",
++ "execabs_go119.go",
++ ],
++ importpath = "golang.org/x/sys/execabs",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":execabs",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "execabs_test",
++ srcs = ["execabs_test.go"],
++ embed = [":execabs"],
++)
+diff -urN a/internal/unsafeheader/BUILD.bazel b/internal/unsafeheader/BUILD.bazel
+--- a/internal/unsafeheader/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/unsafeheader/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "unsafeheader",
++ srcs = ["unsafeheader.go"],
++ importpath = "golang.org/x/sys/internal/unsafeheader",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unsafeheader",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "unsafeheader_test",
++ srcs = ["unsafeheader_test.go"],
++ deps = [":unsafeheader"],
++)
+diff -urN a/plan9/BUILD.bazel b/plan9/BUILD.bazel
+--- a/plan9/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/plan9/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,45 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "plan9",
++ srcs = [
++ "asm.s",
++ "asm_plan9_386.s",
++ "asm_plan9_amd64.s",
++ "asm_plan9_arm.s",
++ "const_plan9.go",
++ "dir_plan9.go",
++ "env_plan9.go",
++ "errors_plan9.go",
++ "pwd_go15_plan9.go",
++ "pwd_plan9.go",
++ "race.go",
++ "race0.go",
++ "str.go",
++ "syscall.go",
++ "syscall_plan9.go",
++ "zsyscall_plan9_386.go",
++ "zsyscall_plan9_amd64.go",
++ "zsyscall_plan9_arm.go",
++ "zsysnum_plan9.go",
++ ],
++ importpath = "golang.org/x/sys/plan9",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":plan9",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "plan9_test",
++ srcs = ["syscall_test.go"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:plan9": [
++ ":plan9",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN a/unix/BUILD.bazel b/unix/BUILD.bazel
+--- a/unix/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/unix/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,296 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "unix",
++ srcs = [
++ "affinity_linux.go",
++ "aliases.go",
++ "asm_aix_ppc64.s",
++ "asm_bsd_386.s",
++ "asm_bsd_amd64.s",
++ "asm_bsd_arm.s",
++ "asm_bsd_arm64.s",
++ "asm_linux_386.s",
++ "asm_linux_amd64.s",
++ "asm_linux_arm.s",
++ "asm_linux_arm64.s",
++ "asm_linux_mips64x.s",
++ "asm_linux_mipsx.s",
++ "asm_linux_ppc64x.s",
++ "asm_linux_riscv64.s",
++ "asm_linux_s390x.s",
++ "asm_solaris_amd64.s",
++ "bluetooth_linux.go",
++ "cap_freebsd.go",
++ "constants.go",
++ "dev_aix_ppc64.go",
++ "dev_darwin.go",
++ "dev_dragonfly.go",
++ "dev_freebsd.go",
++ "dev_linux.go",
++ "dev_netbsd.go",
++ "dev_openbsd.go",
++ "dirent.go",
++ "endian_big.go",
++ "endian_little.go",
++ "env_unix.go",
++ "fcntl.go",
++ "fcntl_darwin.go",
++ "fcntl_linux_32bit.go",
++ "fdset.go",
++ "ifreq_linux.go",
++ "ioctl.go",
++ "ioctl_linux.go",
++ "pagesize_unix.go",
++ "pledge_openbsd.go",
++ "ptrace_darwin.go",
++ "ptrace_ios.go",
++ "race.go",
++ "race0.go",
++ "readdirent_getdents.go",
++ "readdirent_getdirentries.go",
++ "sockcmsg_dragonfly.go",
++ "sockcmsg_linux.go",
++ "sockcmsg_unix.go",
++ "sockcmsg_unix_other.go",
++ "syscall.go",
++ "syscall_aix.go",
++ "syscall_aix_ppc64.go",
++ "syscall_bsd.go",
++ "syscall_darwin.go",
++ "syscall_darwin_amd64.go",
++ "syscall_darwin_arm64.go",
++ "syscall_darwin_libSystem.go",
++ "syscall_dragonfly.go",
++ "syscall_dragonfly_amd64.go",
++ "syscall_freebsd.go",
++ "syscall_freebsd_386.go",
++ "syscall_freebsd_amd64.go",
++ "syscall_freebsd_arm.go",
++ "syscall_freebsd_arm64.go",
++ "syscall_illumos.go",
++ "syscall_linux.go",
++ "syscall_linux_386.go",
++ "syscall_linux_alarm.go",
++ "syscall_linux_amd64.go",
++ "syscall_linux_amd64_gc.go",
++ "syscall_linux_arm.go",
++ "syscall_linux_arm64.go",
++ "syscall_linux_gc.go",
++ "syscall_linux_gc_386.go",
++ "syscall_linux_gc_arm.go",
++ "syscall_linux_mips64x.go",
++ "syscall_linux_mipsx.go",
++ "syscall_linux_ppc64x.go",
++ "syscall_linux_riscv64.go",
++ "syscall_linux_s390x.go",
++ "syscall_netbsd.go",
++ "syscall_netbsd_386.go",
++ "syscall_netbsd_amd64.go",
++ "syscall_netbsd_arm.go",
++ "syscall_netbsd_arm64.go",
++ "syscall_openbsd.go",
++ "syscall_openbsd_386.go",
++ "syscall_openbsd_amd64.go",
++ "syscall_openbsd_arm.go",
++ "syscall_openbsd_arm64.go",
++ "syscall_openbsd_libc.go",
++ "syscall_solaris.go",
++ "syscall_solaris_amd64.go",
++ "syscall_unix.go",
++ "syscall_unix_gc.go",
++ "syscall_unix_gc_ppc64x.go",
++ "sysvshm_linux.go",
++ "sysvshm_unix.go",
++ "sysvshm_unix_other.go",
++ "timestruct.go",
++ "unveil_openbsd.go",
++ "xattr_bsd.go",
++ "zerrors_aix_ppc64.go",
++ "zerrors_darwin_amd64.go",
++ "zerrors_darwin_arm64.go",
++ "zerrors_dragonfly_amd64.go",
++ "zerrors_freebsd_386.go",
++ "zerrors_freebsd_amd64.go",
++ "zerrors_freebsd_arm.go",
++ "zerrors_freebsd_arm64.go",
++ "zerrors_linux.go",
++ "zerrors_linux_386.go",
++ "zerrors_linux_amd64.go",
++ "zerrors_linux_arm.go",
++ "zerrors_linux_arm64.go",
++ "zerrors_linux_mips.go",
++ "zerrors_linux_mips64.go",
++ "zerrors_linux_mips64le.go",
++ "zerrors_linux_mipsle.go",
++ "zerrors_linux_ppc64.go",
++ "zerrors_linux_ppc64le.go",
++ "zerrors_linux_riscv64.go",
++ "zerrors_linux_s390x.go",
++ "zerrors_netbsd_386.go",
++ "zerrors_netbsd_amd64.go",
++ "zerrors_netbsd_arm.go",
++ "zerrors_netbsd_arm64.go",
++ "zerrors_openbsd_386.go",
++ "zerrors_openbsd_amd64.go",
++ "zerrors_openbsd_arm.go",
++ "zerrors_openbsd_arm64.go",
++ "zerrors_solaris_amd64.go",
++ "zptrace_armnn_linux.go",
++ "zptrace_linux_arm64.go",
++ "zptrace_mipsnn_linux.go",
++ "zptrace_mipsnnle_linux.go",
++ "zptrace_x86_linux.go",
++ "zsyscall_aix_ppc64.go",
++ "zsyscall_aix_ppc64_gc.go",
++ "zsyscall_darwin_amd64.go",
++ "zsyscall_darwin_amd64.s",
++ "zsyscall_darwin_arm64.go",
++ "zsyscall_darwin_arm64.s",
++ "zsyscall_dragonfly_amd64.go",
++ "zsyscall_freebsd_386.go",
++ "zsyscall_freebsd_amd64.go",
++ "zsyscall_freebsd_arm.go",
++ "zsyscall_freebsd_arm64.go",
++ "zsyscall_illumos_amd64.go",
++ "zsyscall_linux.go",
++ "zsyscall_linux_386.go",
++ "zsyscall_linux_amd64.go",
++ "zsyscall_linux_arm.go",
++ "zsyscall_linux_arm64.go",
++ "zsyscall_linux_mips.go",
++ "zsyscall_linux_mips64.go",
++ "zsyscall_linux_mips64le.go",
++ "zsyscall_linux_mipsle.go",
++ "zsyscall_linux_ppc64.go",
++ "zsyscall_linux_ppc64le.go",
++ "zsyscall_linux_riscv64.go",
++ "zsyscall_linux_s390x.go",
++ "zsyscall_netbsd_386.go",
++ "zsyscall_netbsd_amd64.go",
++ "zsyscall_netbsd_arm.go",
++ "zsyscall_netbsd_arm64.go",
++ "zsyscall_openbsd_386.go",
++ "zsyscall_openbsd_386.s",
++ "zsyscall_openbsd_amd64.go",
++ "zsyscall_openbsd_amd64.s",
++ "zsyscall_openbsd_arm.go",
++ "zsyscall_openbsd_arm.s",
++ "zsyscall_openbsd_arm64.go",
++ "zsyscall_openbsd_arm64.s",
++ "zsyscall_solaris_amd64.go",
++ "zsysctl_openbsd_386.go",
++ "zsysctl_openbsd_amd64.go",
++ "zsysctl_openbsd_arm.go",
++ "zsysctl_openbsd_arm64.go",
++ "zsysnum_darwin_amd64.go",
++ "zsysnum_darwin_arm64.go",
++ "zsysnum_dragonfly_amd64.go",
++ "zsysnum_freebsd_386.go",
++ "zsysnum_freebsd_amd64.go",
++ "zsysnum_freebsd_arm.go",
++ "zsysnum_freebsd_arm64.go",
++ "zsysnum_linux_386.go",
++ "zsysnum_linux_amd64.go",
++ "zsysnum_linux_arm.go",
++ "zsysnum_linux_arm64.go",
++ "zsysnum_linux_mips.go",
++ "zsysnum_linux_mips64.go",
++ "zsysnum_linux_mips64le.go",
++ "zsysnum_linux_mipsle.go",
++ "zsysnum_linux_ppc64.go",
++ "zsysnum_linux_ppc64le.go",
++ "zsysnum_linux_riscv64.go",
++ "zsysnum_linux_s390x.go",
++ "zsysnum_netbsd_386.go",
++ "zsysnum_netbsd_amd64.go",
++ "zsysnum_netbsd_arm.go",
++ "zsysnum_netbsd_arm64.go",
++ "zsysnum_openbsd_386.go",
++ "zsysnum_openbsd_amd64.go",
++ "zsysnum_openbsd_arm.go",
++ "zsysnum_openbsd_arm64.go",
++ "ztypes_aix_ppc64.go",
++ "ztypes_darwin_amd64.go",
++ "ztypes_darwin_arm64.go",
++ "ztypes_dragonfly_amd64.go",
++ "ztypes_freebsd_386.go",
++ "ztypes_freebsd_amd64.go",
++ "ztypes_freebsd_arm.go",
++ "ztypes_freebsd_arm64.go",
++ "ztypes_linux.go",
++ "ztypes_linux_386.go",
++ "ztypes_linux_amd64.go",
++ "ztypes_linux_arm.go",
++ "ztypes_linux_arm64.go",
++ "ztypes_linux_mips.go",
++ "ztypes_linux_mips64.go",
++ "ztypes_linux_mips64le.go",
++ "ztypes_linux_mipsle.go",
++ "ztypes_linux_ppc64.go",
++ "ztypes_linux_ppc64le.go",
++ "ztypes_linux_riscv64.go",
++ "ztypes_linux_s390x.go",
++ "ztypes_netbsd_386.go",
++ "ztypes_netbsd_amd64.go",
++ "ztypes_netbsd_arm.go",
++ "ztypes_netbsd_arm64.go",
++ "ztypes_openbsd_386.go",
++ "ztypes_openbsd_amd64.go",
++ "ztypes_openbsd_arm.go",
++ "ztypes_openbsd_arm64.go",
++ "ztypes_solaris_amd64.go",
++ ],
++ cgo = True,
++ importpath = "golang.org/x/sys/unix",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unix",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unix_test",
++ srcs = [
++ "creds_test.go",
++ "darwin_amd64_test.go",
++ "darwin_arm64_test.go",
++ "darwin_test.go",
++ "dev_linux_test.go",
++ "dirent_test.go",
++ "dup3_test.go",
++ "example_exec_test.go",
++ "example_flock_test.go",
++ "example_sysvshm_test.go",
++ "fdset_test.go",
++ "getdirentries_test.go",
++ "getfsstat_test.go",
++ "ifreq_linux_test.go",
++ "mmap_unix_test.go",
++ "openbsd_test.go",
++ "pipe2_test.go",
++ "sendfile_test.go",
++ "syscall_aix_test.go",
++ "syscall_bsd_test.go",
++ "syscall_darwin_test.go",
++ "syscall_freebsd_test.go",
++ "syscall_internal_bsd_test.go",
++ "syscall_internal_darwin_test.go",
++ "syscall_internal_linux_test.go",
++ "syscall_internal_solaris_test.go",
++ "syscall_linux_test.go",
++ "syscall_netbsd_test.go",
++ "syscall_openbsd_test.go",
++ "syscall_solaris_test.go",
++ "syscall_test.go",
++ "syscall_unix_test.go",
++ "sysctl_netbsd_test.go",
++ "sysvshm_unix_test.go",
++ "timestruct_test.go",
++ "xattr_test.go",
++ ],
++ embed = [":unix"],
++)
+diff -urN a/unix/internal/mkmerge/BUILD.bazel b/unix/internal/mkmerge/BUILD.bazel
+--- a/unix/internal/mkmerge/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/unix/internal/mkmerge/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "mkmerge_lib",
++ srcs = ["mkmerge.go"],
++ importpath = "golang.org/x/sys/unix/internal/mkmerge",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "mkmerge",
++ embed = [":mkmerge_lib"],
++ visibility = ["//unix:__subpackages__"],
++)
++
++go_test(
++ name = "mkmerge_test",
++ srcs = ["mkmerge_test.go"],
++ embed = [":mkmerge_lib"],
++)
+diff -urN a/windows/BUILD.bazel b/windows/BUILD.bazel
+--- a/windows/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/windows/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,59 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "windows",
++ srcs = [
++ "aliases.go",
++ "dll_windows.go",
++ "empty.s",
++ "env_windows.go",
++ "eventlog.go",
++ "exec_windows.go",
++ "memory_windows.go",
++ "race.go",
++ "race0.go",
++ "security_windows.go",
++ "service.go",
++ "setupapi_windows.go",
++ "str.go",
++ "syscall.go",
++ "syscall_windows.go",
++ "types_windows.go",
++ "types_windows_386.go",
++ "types_windows_amd64.go",
++ "types_windows_arm.go",
++ "zerrors_windows.go",
++ "zknownfolderids_windows.go",
++ "zsyscall_windows.go",
++ ],
++ importpath = "golang.org/x/sys/windows",
++ visibility = ["//visibility:public"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:windows": [
++ "//internal/unsafeheader",
++ ],
++ "//conditions:default": [],
++ }),
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":windows",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "windows_test",
++ srcs = [
++ "syscall_test.go",
++ "syscall_windows_test.go",
++ ],
++ data = glob(["testdata/**"]),
++ deps = select({
++ "@io_bazel_rules_go//go/platform:windows": [
++ ":windows",
++ "//internal/unsafeheader",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN a/windows/mkwinsyscall/BUILD.bazel b/windows/mkwinsyscall/BUILD.bazel
+--- a/windows/mkwinsyscall/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/windows/mkwinsyscall/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "mkwinsyscall_lib",
++ srcs = ["mkwinsyscall.go"],
++ importpath = "golang.org/x/sys/windows/mkwinsyscall",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "mkwinsyscall",
++ embed = [":mkwinsyscall_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "mkwinsyscall_test",
++ srcs = ["mkwinsyscall_test.go"],
++ embed = [":mkwinsyscall_lib"],
++)
+diff -urN a/windows/registry/BUILD.bazel b/windows/registry/BUILD.bazel
+--- a/windows/registry/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/windows/registry/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "registry",
++ srcs = [
++ "key.go",
++ "syscall.go",
++ "value.go",
++ "zsyscall_windows.go",
++ ],
++ importpath = "golang.org/x/sys/windows/registry",
++ visibility = ["//visibility:public"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:windows": [
++ "//windows",
++ ],
++ "//conditions:default": [],
++ }),
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":registry",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "registry_test",
++ srcs = [
++ "export_test.go",
++ "registry_test.go",
++ ],
++ embed = [":registry"],
++)
+diff -urN a/windows/svc/BUILD.bazel b/windows/svc/BUILD.bazel
+--- a/windows/svc/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/windows/svc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,36 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "svc",
++ srcs = [
++ "security.go",
++ "service.go",
++ ],
++ importpath = "golang.org/x/sys/windows/svc",
++ visibility = ["//visibility:public"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:windows": [
++ "//internal/unsafeheader",
++ "//windows",
++ ],
++ "//conditions:default": [],
++ }),
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":svc",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "svc_test",
++ srcs = ["svc_test.go"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:windows": [
++ ":svc",
++ "//windows/svc/mgr",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN a/windows/svc/debug/BUILD.bazel b/windows/svc/debug/BUILD.bazel
+--- a/windows/svc/debug/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/windows/svc/debug/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "debug",
++ srcs = [
++ "log.go",
++ "service.go",
++ ],
++ importpath = "golang.org/x/sys/windows/svc/debug",
++ visibility = ["//visibility:public"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:windows": [
++ "//windows/svc",
++ ],
++ "//conditions:default": [],
++ }),
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":debug",
++ visibility = ["//visibility:public"],
++)
+diff -urN a/windows/svc/eventlog/BUILD.bazel b/windows/svc/eventlog/BUILD.bazel
+--- a/windows/svc/eventlog/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/windows/svc/eventlog/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "eventlog",
++ srcs = [
++ "install.go",
++ "log.go",
++ ],
++ importpath = "golang.org/x/sys/windows/svc/eventlog",
++ visibility = ["//visibility:public"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:windows": [
++ "//windows",
++ "//windows/registry",
++ ],
++ "//conditions:default": [],
++ }),
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":eventlog",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "eventlog_test",
++ srcs = ["log_test.go"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:windows": [
++ ":eventlog",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN a/windows/svc/example/BUILD.bazel b/windows/svc/example/BUILD.bazel
+--- a/windows/svc/example/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/windows/svc/example/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "example_lib",
++ srcs = [
++ "beep.go",
++ "install.go",
++ "main.go",
++ "manage.go",
++ "service.go",
++ ],
++ importpath = "golang.org/x/sys/windows/svc/example",
++ visibility = ["//visibility:private"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:windows": [
++ "//windows/svc",
++ "//windows/svc/debug",
++ "//windows/svc/eventlog",
++ "//windows/svc/mgr",
++ ],
++ "//conditions:default": [],
++ }),
++)
++
++go_binary(
++ name = "example",
++ embed = [":example_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN a/windows/svc/mgr/BUILD.bazel b/windows/svc/mgr/BUILD.bazel
+--- a/windows/svc/mgr/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/windows/svc/mgr/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "mgr",
++ srcs = [
++ "config.go",
++ "mgr.go",
++ "recovery.go",
++ "service.go",
++ ],
++ importpath = "golang.org/x/sys/windows/svc/mgr",
++ visibility = ["//visibility:public"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:windows": [
++ "//internal/unsafeheader",
++ "//windows",
++ "//windows/svc",
++ ],
++ "//conditions:default": [],
++ }),
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":mgr",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "mgr_test",
++ srcs = ["mgr_test.go"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:windows": [
++ ":mgr",
++ ],
++ "//conditions:default": [],
++ }),
++)
diff --git a/third_party/org_golang_x_tools-deletegopls.patch b/third_party/org_golang_x_tools-deletegopls.patch
new file mode 100644
index 00000000..6011df55
--- /dev/null
+++ b/third_party/org_golang_x_tools-deletegopls.patch
@@ -0,0 +1,127069 @@
+diff -urN a/gopls/api-diff/api_diff.go b/gopls/api-diff/api_diff.go
+--- a/gopls/api-diff/api_diff.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/api-diff/api_diff.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,89 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package main
+-
+-import (
+- "bytes"
+- "context"
+- "encoding/json"
+- "flag"
+- "fmt"
+- "log"
+- "os"
+- "os/exec"
+-
+- "github.com/google/go-cmp/cmp"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-const usage = `api-diff <previous version> [<current version>]
+-
+-Compare the API of two gopls versions. If the second argument is provided, it
+-will be used as the new version to compare against. Otherwise, compare against
+-the current API.
+-`
+-
+-func main() {
+- flag.Parse()
+-
+- if flag.NArg() < 1 || flag.NArg() > 2 {
+- fmt.Fprint(os.Stderr, usage)
+- os.Exit(2)
+- }
+-
+- oldVer := flag.Arg(0)
+- newVer := ""
+- if flag.NArg() == 2 {
+- newVer = flag.Arg(1)
+- }
+-
+- apiDiff, err := diffAPI(oldVer, newVer)
+- if err != nil {
+- log.Fatal(err)
+- }
+- fmt.Println("\n" + apiDiff)
+-}
+-
+-func diffAPI(oldVer, newVer string) (string, error) {
+- ctx := context.Background()
+- previousAPI, err := loadAPI(ctx, oldVer)
+- if err != nil {
+- return "", fmt.Errorf("loading %s: %v", oldVer, err)
+- }
+- var currentAPI *source.APIJSON
+- if newVer == "" {
+- currentAPI = source.GeneratedAPIJSON
+- } else {
+- var err error
+- currentAPI, err = loadAPI(ctx, newVer)
+- if err != nil {
+- return "", fmt.Errorf("loading %s: %v", newVer, err)
+- }
+- }
+-
+- return cmp.Diff(previousAPI, currentAPI), nil
+-}
+-
+-func loadAPI(ctx context.Context, version string) (*source.APIJSON, error) {
+- ver := fmt.Sprintf("golang.org/x/tools/gopls@%s", version)
+- cmd := exec.Command("go", "run", ver, "api-json")
+-
+- stdout := &bytes.Buffer{}
+- stderr := &bytes.Buffer{}
+- cmd.Stdout = stdout
+- cmd.Stderr = stderr
+-
+- if err := cmd.Run(); err != nil {
+- return nil, fmt.Errorf("go run failed: %v; stderr:\n%s", err, stderr)
+- }
+- apiJson := &source.APIJSON{}
+- if err := json.Unmarshal(stdout.Bytes(), apiJson); err != nil {
+- return nil, fmt.Errorf("unmarshal: %v", err)
+- }
+- return apiJson, nil
+-}
+diff -urN a/gopls/doc/advanced.md b/gopls/doc/advanced.md
+--- a/gopls/doc/advanced.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/advanced.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,69 +0,0 @@
+-# Advanced topics
+-
+-This documentation is for advanced `gopls` users, who may want to test
+-unreleased versions or try out special features.
+-
+-## Installing unreleased versions
+-
+-To get a specific version of `gopls` (for example, to test a prerelease
+-version), run:
+-
+-```sh
+-GO111MODULE=on go install golang.org/x/tools/gopls@vX.Y.Z
+-```
+-
+-Where `vX.Y.Z` is the desired version.
+-
+-### Unstable versions
+-
+-To update `gopls` to the latest **unstable** version, use the following
+-commands.
+-
+-```sh
+-# Create an empty go.mod file, only for tracking requirements.
+-cd $(mktemp -d)
+-go mod init gopls-unstable
+-
+-# Use 'go get' to add requirements and to ensure they work together.
+-go get -d golang.org/x/tools/gopls@master golang.org/x/tools@master
+-
+-go install golang.org/x/tools/gopls
+-```
+-
+-## Working on the Go source distribution
+-
+-If you are working on the [Go project] itself, the `go` command that `gopls`
+-invokes will have to correspond to the version of the source you are working
+-on. That is, if you have checked out the Go project to `$HOME/go`, your `go`
+-command should be the `$HOME/go/bin/go` executable that you built with
+-`make.bash` or equivalent.
+-
+-You can achieve this by adding the right version of `go` to your `PATH`
+-(`export PATH=$HOME/go/bin:$PATH` on Unix systems) or by configuring your
+-editor.
+-
+-## Working with generic code
+-
+-Gopls has support for editing generic Go code. To enable this support, you need
+-to **install gopls using Go 1.18 or later**. The easiest way to do this is by
+-[installing Go 1.18+](https://go.dev/dl) and then using this Go version to
+-install gopls:
+-
+-```
+-$ go install golang.org/x/tools/gopls@latest
+-```
+-
+-It is strongly recommended that you install the latest version of `gopls`, or
+-the latest **unstable** version as [described above](#installing-unreleased-versions).
+-We're still working on improving our generics support.
+-
+-The `gopls` built with these instructions understands generic code. See the
+-[generics tutorial](https://go.dev/doc/tutorial/generics) for more information
+-on how to use generics in Go!
+-
+-### Known issues
+-
+- * [`staticcheck`](https://github.com/golang/tools/blob/master/gopls/doc/settings.md#staticcheck-bool)
+- on generic code is not supported yet.
+-
+-[Go project]: https://go.googlesource.com/go
+diff -urN a/gopls/doc/analyzers.md b/gopls/doc/analyzers.md
+--- a/gopls/doc/analyzers.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/analyzers.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,762 +0,0 @@
+-# Analyzers
+-
+-This document describes the analyzers that `gopls` uses inside the editor.
+-
+-Details about how to enable/disable these analyses can be found
+-[here](settings.md#analyses).
+-
+-<!-- BEGIN Analyzers: DO NOT MANUALLY EDIT THIS SECTION -->
+-## **asmdecl**
+-
+-report mismatches between assembly files and Go declarations
+-
+-**Enabled by default.**
+-
+-## **assign**
+-
+-check for useless assignments
+-
+-This checker reports assignments of the form x = x or a[i] = a[i].
+-These are almost always useless, and even when they aren't they are
+-usually a mistake.
+-
+-**Enabled by default.**
+-
+-## **atomic**
+-
+-check for common mistakes using the sync/atomic package
+-
+-The atomic checker looks for assignment statements of the form:
+-
+- x = atomic.AddUint64(&x, 1)
+-
+-which are not atomic.
+-
+-**Enabled by default.**
+-
+-## **atomicalign**
+-
+-check for non-64-bits-aligned arguments to sync/atomic functions
+-
+-**Enabled by default.**
+-
+-## **bools**
+-
+-check for common mistakes involving boolean operators
+-
+-**Enabled by default.**
+-
+-## **buildtag**
+-
+-check //go:build and // +build directives
+-
+-**Enabled by default.**
+-
+-## **cgocall**
+-
+-detect some violations of the cgo pointer passing rules
+-
+-Check for invalid cgo pointer passing.
+-This looks for code that uses cgo to call C code passing values
+-whose types are almost always invalid according to the cgo pointer
+-sharing rules.
+-Specifically, it warns about attempts to pass a Go chan, map, func,
+-or slice to C, either directly, or via a pointer, array, or struct.
+-
+-**Enabled by default.**
+-
+-## **composites**
+-
+-check for unkeyed composite literals
+-
+-This analyzer reports a diagnostic for composite literals of struct
+-types imported from another package that do not use the field-keyed
+-syntax. Such literals are fragile because the addition of a new field
+-(even if unexported) to the struct will cause compilation to fail.
+-
+-As an example,
+-
+- err = &net.DNSConfigError{err}
+-
+-should be replaced by:
+-
+- err = &net.DNSConfigError{Err: err}
+-
+-
+-**Enabled by default.**
+-
+-## **copylocks**
+-
+-check for locks erroneously passed by value
+-
+-Inadvertently copying a value containing a lock, such as sync.Mutex or
+-sync.WaitGroup, may cause both copies to malfunction. Generally such
+-values should be referred to through a pointer.
+-
+-**Enabled by default.**
+-
+-## **deepequalerrors**
+-
+-check for calls of reflect.DeepEqual on error values
+-
+-The deepequalerrors checker looks for calls of the form:
+-
+- reflect.DeepEqual(err1, err2)
+-
+-where err1 and err2 are errors. Using reflect.DeepEqual to compare
+-errors is discouraged.
+-
+-**Enabled by default.**
+-
+-## **directive**
+-
+-check Go toolchain directives such as //go:debug
+-
+-This analyzer checks for problems with known Go toolchain directives
+-in all Go source files in a package directory, even those excluded by
+-//go:build constraints, and all non-Go source files too.
+-
+-For //go:debug (see https://go.dev/doc/godebug), the analyzer checks
+-that the directives are placed only in Go source files, only above the
+-package comment, and only in package main or *_test.go files.
+-
+-Support for other known directives may be added in the future.
+-
+-This analyzer does not check //go:build, which is handled by the
+-buildtag analyzer.
+-
+-
+-**Enabled by default.**
+-
+-## **embed**
+-
+-check for //go:embed directive import
+-
+-This analyzer checks that the embed package is imported when source code contains //go:embed comment directives.
+-The embed package must be imported for //go:embed directives to function.import _ "embed".
+-
+-**Enabled by default.**
+-
+-## **errorsas**
+-
+-report passing non-pointer or non-error values to errors.As
+-
+-The errorsas analysis reports calls to errors.As where the type
+-of the second argument is not a pointer to a type implementing error.
+-
+-**Enabled by default.**
+-
+-## **fieldalignment**
+-
+-find structs that would use less memory if their fields were sorted
+-
+-This analyzer find structs that can be rearranged to use less memory, and provides
+-a suggested edit with the most compact order.
+-
+-Note that there are two different diagnostics reported. One checks struct size,
+-and the other reports "pointer bytes" used. Pointer bytes is how many bytes of the
+-object that the garbage collector has to potentially scan for pointers, for example:
+-
+- struct { uint32; string }
+-
+-have 16 pointer bytes because the garbage collector has to scan up through the string's
+-inner pointer.
+-
+- struct { string; *uint32 }
+-
+-has 24 pointer bytes because it has to scan further through the *uint32.
+-
+- struct { string; uint32 }
+-
+-has 8 because it can stop immediately after the string pointer.
+-
+-Be aware that the most compact order is not always the most efficient.
+-In rare cases it may cause two variables each updated by its own goroutine
+-to occupy the same CPU cache line, inducing a form of memory contention
+-known as "false sharing" that slows down both goroutines.
+-
+-
+-**Disabled by default. Enable it by setting `"analyses": {"fieldalignment": true}`.**
+-
+-## **httpresponse**
+-
+-check for mistakes using HTTP responses
+-
+-A common mistake when using the net/http package is to defer a function
+-call to close the http.Response Body before checking the error that
+-determines whether the response is valid:
+-
+- resp, err := http.Head(url)
+- defer resp.Body.Close()
+- if err != nil {
+- log.Fatal(err)
+- }
+- // (defer statement belongs here)
+-
+-This checker helps uncover latent nil dereference bugs by reporting a
+-diagnostic for such mistakes.
+-
+-**Enabled by default.**
+-
+-## **ifaceassert**
+-
+-detect impossible interface-to-interface type assertions
+-
+-This checker flags type assertions v.(T) and corresponding type-switch cases
+-in which the static type V of v is an interface that cannot possibly implement
+-the target interface T. This occurs when V and T contain methods with the same
+-name but different signatures. Example:
+-
+- var v interface {
+- Read()
+- }
+- _ = v.(io.Reader)
+-
+-The Read method in v has a different signature than the Read method in
+-io.Reader, so this assertion cannot succeed.
+-
+-
+-**Enabled by default.**
+-
+-## **infertypeargs**
+-
+-check for unnecessary type arguments in call expressions
+-
+-Explicit type arguments may be omitted from call expressions if they can be
+-inferred from function arguments, or from other type arguments:
+-
+- func f[T any](T) {}
+-
+- func _() {
+- f[string]("foo") // string could be inferred
+- }
+-
+-
+-**Enabled by default.**
+-
+-## **loopclosure**
+-
+-check references to loop variables from within nested functions
+-
+-This analyzer reports places where a function literal references the
+-iteration variable of an enclosing loop, and the loop calls the function
+-in such a way (e.g. with go or defer) that it may outlive the loop
+-iteration and possibly observe the wrong value of the variable.
+-
+-In this example, all the deferred functions run after the loop has
+-completed, so all observe the final value of v.
+-
+- for _, v := range list {
+- defer func() {
+- use(v) // incorrect
+- }()
+- }
+-
+-One fix is to create a new variable for each iteration of the loop:
+-
+- for _, v := range list {
+- v := v // new var per iteration
+- defer func() {
+- use(v) // ok
+- }()
+- }
+-
+-The next example uses a go statement and has a similar problem.
+-In addition, it has a data race because the loop updates v
+-concurrent with the goroutines accessing it.
+-
+- for _, v := range elem {
+- go func() {
+- use(v) // incorrect, and a data race
+- }()
+- }
+-
+-A fix is the same as before. The checker also reports problems
+-in goroutines started by golang.org/x/sync/errgroup.Group.
+-A hard-to-spot variant of this form is common in parallel tests:
+-
+- func Test(t *testing.T) {
+- for _, test := range tests {
+- t.Run(test.name, func(t *testing.T) {
+- t.Parallel()
+- use(test) // incorrect, and a data race
+- })
+- }
+- }
+-
+-The t.Parallel() call causes the rest of the function to execute
+-concurrent with the loop.
+-
+-The analyzer reports references only in the last statement,
+-as it is not deep enough to understand the effects of subsequent
+-statements that might render the reference benign.
+-("Last statement" is defined recursively in compound
+-statements such as if, switch, and select.)
+-
+-See: https://golang.org/doc/go_faq.html#closures_and_goroutines
+-
+-**Enabled by default.**
+-
+-## **lostcancel**
+-
+-check cancel func returned by context.WithCancel is called
+-
+-The cancellation function returned by context.WithCancel, WithTimeout,
+-and WithDeadline must be called or the new context will remain live
+-until its parent context is cancelled.
+-(The background context is never cancelled.)
+-
+-**Enabled by default.**
+-
+-## **nilfunc**
+-
+-check for useless comparisons between functions and nil
+-
+-A useless comparison is one like f == nil as opposed to f() == nil.
+-
+-**Enabled by default.**
+-
+-## **nilness**
+-
+-check for redundant or impossible nil comparisons
+-
+-The nilness checker inspects the control-flow graph of each function in
+-a package and reports nil pointer dereferences, degenerate nil
+-pointers, and panics with nil values. A degenerate comparison is of the form
+-x==nil or x!=nil where x is statically known to be nil or non-nil. These are
+-often a mistake, especially in control flow related to errors. Panics with nil
+-values are checked because they are not detectable by
+-
+- if r := recover(); r != nil {
+-
+-This check reports conditions such as:
+-
+- if f == nil { // impossible condition (f is a function)
+- }
+-
+-and:
+-
+- p := &v
+- ...
+- if p != nil { // tautological condition
+- }
+-
+-and:
+-
+- if p == nil {
+- print(*p) // nil dereference
+- }
+-
+-and:
+-
+- if p == nil {
+- panic(p)
+- }
+-
+-
+-**Disabled by default. Enable it by setting `"analyses": {"nilness": true}`.**
+-
+-## **printf**
+-
+-check consistency of Printf format strings and arguments
+-
+-The check applies to known functions (for example, those in package fmt)
+-as well as any detected wrappers of known functions.
+-
+-A function that wants to avail itself of printf checking but is not
+-found by this analyzer's heuristics (for example, due to use of
+-dynamic calls) can insert a bogus call:
+-
+- if false {
+- _ = fmt.Sprintf(format, args...) // enable printf checking
+- }
+-
+-The -funcs flag specifies a comma-separated list of names of additional
+-known formatting functions or methods. If the name contains a period,
+-it must denote a specific function using one of the following forms:
+-
+- dir/pkg.Function
+- dir/pkg.Type.Method
+- (*dir/pkg.Type).Method
+-
+-Otherwise the name is interpreted as a case-insensitive unqualified
+-identifier such as "errorf". Either way, if a listed name ends in f, the
+-function is assumed to be Printf-like, taking a format string before the
+-argument list. Otherwise it is assumed to be Print-like, taking a list
+-of arguments with no format string.
+-
+-
+-**Enabled by default.**
+-
+-## **shadow**
+-
+-check for possible unintended shadowing of variables
+-
+-This analyzer check for shadowed variables.
+-A shadowed variable is a variable declared in an inner scope
+-with the same name and type as a variable in an outer scope,
+-and where the outer variable is mentioned after the inner one
+-is declared.
+-
+-(This definition can be refined; the module generates too many
+-false positives and is not yet enabled by default.)
+-
+-For example:
+-
+- func BadRead(f *os.File, buf []byte) error {
+- var err error
+- for {
+- n, err := f.Read(buf) // shadows the function variable 'err'
+- if err != nil {
+- break // causes return of wrong value
+- }
+- foo(buf)
+- }
+- return err
+- }
+-
+-
+-**Disabled by default. Enable it by setting `"analyses": {"shadow": true}`.**
+-
+-## **shift**
+-
+-check for shifts that equal or exceed the width of the integer
+-
+-**Enabled by default.**
+-
+-## **simplifycompositelit**
+-
+-check for composite literal simplifications
+-
+-An array, slice, or map composite literal of the form:
+- []T{T{}, T{}}
+-will be simplified to:
+- []T{{}, {}}
+-
+-This is one of the simplifications that "gofmt -s" applies.
+-
+-**Enabled by default.**
+-
+-## **simplifyrange**
+-
+-check for range statement simplifications
+-
+-A range of the form:
+- for x, _ = range v {...}
+-will be simplified to:
+- for x = range v {...}
+-
+-A range of the form:
+- for _ = range v {...}
+-will be simplified to:
+- for range v {...}
+-
+-This is one of the simplifications that "gofmt -s" applies.
+-
+-**Enabled by default.**
+-
+-## **simplifyslice**
+-
+-check for slice simplifications
+-
+-A slice expression of the form:
+- s[a:len(s)]
+-will be simplified to:
+- s[a:]
+-
+-This is one of the simplifications that "gofmt -s" applies.
+-
+-**Enabled by default.**
+-
+-## **sortslice**
+-
+-check the argument type of sort.Slice
+-
+-sort.Slice requires an argument of a slice type. Check that
+-the interface{} value passed to sort.Slice is actually a slice.
+-
+-**Enabled by default.**
+-
+-## **stdmethods**
+-
+-check signature of methods of well-known interfaces
+-
+-Sometimes a type may be intended to satisfy an interface but may fail to
+-do so because of a mistake in its method signature.
+-For example, the result of this WriteTo method should be (int64, error),
+-not error, to satisfy io.WriterTo:
+-
+- type myWriterTo struct{...}
+- func (myWriterTo) WriteTo(w io.Writer) error { ... }
+-
+-This check ensures that each method whose name matches one of several
+-well-known interface methods from the standard library has the correct
+-signature for that interface.
+-
+-Checked method names include:
+- Format GobEncode GobDecode MarshalJSON MarshalXML
+- Peek ReadByte ReadFrom ReadRune Scan Seek
+- UnmarshalJSON UnreadByte UnreadRune WriteByte
+- WriteTo
+-
+-
+-**Enabled by default.**
+-
+-## **stringintconv**
+-
+-check for string(int) conversions
+-
+-This checker flags conversions of the form string(x) where x is an integer
+-(but not byte or rune) type. Such conversions are discouraged because they
+-return the UTF-8 representation of the Unicode code point x, and not a decimal
+-string representation of x as one might expect. Furthermore, if x denotes an
+-invalid code point, the conversion cannot be statically rejected.
+-
+-For conversions that intend on using the code point, consider replacing them
+-with string(rune(x)). Otherwise, strconv.Itoa and its equivalents return the
+-string representation of the value in the desired base.
+-
+-
+-**Enabled by default.**
+-
+-## **structtag**
+-
+-check that struct field tags conform to reflect.StructTag.Get
+-
+-Also report certain struct tags (json, xml) used with unexported fields.
+-
+-**Enabled by default.**
+-
+-## **testinggoroutine**
+-
+-report calls to (*testing.T).Fatal from goroutines started by a test.
+-
+-Functions that abruptly terminate a test, such as the Fatal, Fatalf, FailNow, and
+-Skip{,f,Now} methods of *testing.T, must be called from the test goroutine itself.
+-This checker detects calls to these functions that occur within a goroutine
+-started by the test. For example:
+-
+-func TestFoo(t *testing.T) {
+- go func() {
+- t.Fatal("oops") // error: (*T).Fatal called from non-test goroutine
+- }()
+-}
+-
+-
+-**Enabled by default.**
+-
+-## **tests**
+-
+-check for common mistaken usages of tests and examples
+-
+-The tests checker walks Test, Benchmark and Example functions checking
+-malformed names, wrong signatures and examples documenting non-existent
+-identifiers.
+-
+-Please see the documentation for package testing in golang.org/pkg/testing
+-for the conventions that are enforced for Tests, Benchmarks, and Examples.
+-
+-**Enabled by default.**
+-
+-## **timeformat**
+-
+-check for calls of (time.Time).Format or time.Parse with 2006-02-01
+-
+-The timeformat checker looks for time formats with the 2006-02-01 (yyyy-dd-mm)
+-format. Internationally, "yyyy-dd-mm" does not occur in common calendar date
+-standards, and so it is more likely that 2006-01-02 (yyyy-mm-dd) was intended.
+-
+-
+-**Enabled by default.**
+-
+-## **unmarshal**
+-
+-report passing non-pointer or non-interface values to unmarshal
+-
+-The unmarshal analysis reports calls to functions such as json.Unmarshal
+-in which the argument type is not a pointer or an interface.
+-
+-**Enabled by default.**
+-
+-## **unreachable**
+-
+-check for unreachable code
+-
+-The unreachable analyzer finds statements that execution can never reach
+-because they are preceded by an return statement, a call to panic, an
+-infinite loop, or similar constructs.
+-
+-**Enabled by default.**
+-
+-## **unsafeptr**
+-
+-check for invalid conversions of uintptr to unsafe.Pointer
+-
+-The unsafeptr analyzer reports likely incorrect uses of unsafe.Pointer
+-to convert integers to pointers. A conversion from uintptr to
+-unsafe.Pointer is invalid if it implies that there is a uintptr-typed
+-word in memory that holds a pointer value, because that word will be
+-invisible to stack copying and to the garbage collector.
+-
+-**Enabled by default.**
+-
+-## **unusedparams**
+-
+-check for unused parameters of functions
+-
+-The unusedparams analyzer checks functions to see if there are
+-any parameters that are not being used.
+-
+-To reduce false positives it ignores:
+-- methods
+-- parameters that do not have a name or are underscored
+-- functions in test files
+-- functions with empty bodies or those with just a return stmt
+-
+-**Disabled by default. Enable it by setting `"analyses": {"unusedparams": true}`.**
+-
+-## **unusedresult**
+-
+-check for unused results of calls to some functions
+-
+-Some functions like fmt.Errorf return a result and have no side effects,
+-so it is always a mistake to discard the result. This analyzer reports
+-calls to certain functions in which the result of the call is ignored.
+-
+-The set of functions may be controlled using flags.
+-
+-**Enabled by default.**
+-
+-## **unusedwrite**
+-
+-checks for unused writes
+-
+-The analyzer reports instances of writes to struct fields and
+-arrays that are never read. Specifically, when a struct object
+-or an array is copied, its elements are copied implicitly by
+-the compiler, and any element write to this copy does nothing
+-with the original object.
+-
+-For example:
+-
+- type T struct { x int }
+- func f(input []T) {
+- for i, v := range input { // v is a copy
+- v.x = i // unused write to field x
+- }
+- }
+-
+-Another example is about non-pointer receiver:
+-
+- type T struct { x int }
+- func (t T) f() { // t is a copy
+- t.x = i // unused write to field x
+- }
+-
+-
+-**Disabled by default. Enable it by setting `"analyses": {"unusedwrite": true}`.**
+-
+-## **useany**
+-
+-check for constraints that could be simplified to "any"
+-
+-**Disabled by default. Enable it by setting `"analyses": {"useany": true}`.**
+-
+-## **fillreturns**
+-
+-suggest fixes for errors due to an incorrect number of return values
+-
+-This checker provides suggested fixes for type errors of the
+-type "wrong number of return values (want %d, got %d)". For example:
+- func m() (int, string, *bool, error) {
+- return
+- }
+-will turn into
+- func m() (int, string, *bool, error) {
+- return 0, "", nil, nil
+- }
+-
+-This functionality is similar to https://github.com/sqs/goreturns.
+-
+-
+-**Enabled by default.**
+-
+-## **nonewvars**
+-
+-suggested fixes for "no new vars on left side of :="
+-
+-This checker provides suggested fixes for type errors of the
+-type "no new vars on left side of :=". For example:
+- z := 1
+- z := 2
+-will turn into
+- z := 1
+- z = 2
+-
+-
+-**Enabled by default.**
+-
+-## **noresultvalues**
+-
+-suggested fixes for unexpected return values
+-
+-This checker provides suggested fixes for type errors of the
+-type "no result values expected" or "too many return values".
+-For example:
+- func z() { return nil }
+-will turn into
+- func z() { return }
+-
+-
+-**Enabled by default.**
+-
+-## **undeclaredname**
+-
+-suggested fixes for "undeclared name: <>"
+-
+-This checker provides suggested fixes for type errors of the
+-type "undeclared name: <>". It will either insert a new statement,
+-such as:
+-
+-"<> := "
+-
+-or a new function declaration, such as:
+-
+-func <>(inferred parameters) {
+- panic("implement me!")
+-}
+-
+-
+-**Enabled by default.**
+-
+-## **unusedvariable**
+-
+-check for unused variables
+-
+-The unusedvariable analyzer suggests fixes for unused variables errors.
+-
+-
+-**Disabled by default. Enable it by setting `"analyses": {"unusedvariable": true}`.**
+-
+-## **fillstruct**
+-
+-note incomplete struct initializations
+-
+-This analyzer provides diagnostics for any struct literals that do not have
+-any fields initialized. Because the suggested fix for this analysis is
+-expensive to compute, callers should compute it separately, using the
+-SuggestedFix function below.
+-
+-
+-**Enabled by default.**
+-
+-## **stubmethods**
+-
+-stub methods analyzer
+-
+-This analyzer generates method stubs for concrete types
+-in order to implement a target interface
+-
+-**Enabled by default.**
+-
+-<!-- END Analyzers: DO NOT MANUALLY EDIT THIS SECTION -->
+diff -urN a/gopls/doc/command-line.md b/gopls/doc/command-line.md
+--- a/gopls/doc/command-line.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/command-line.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,15 +0,0 @@
+-# Command line
+-
+-**Note: The `gopls` command-line is still experimental and subject to change at any point.**
+-
+-`gopls` exposes some (but not all) features on the command-line. This can be useful for debugging `gopls` itself.
+-
+-<!--TODO(rstambler): Generate this file.-->
+-
+-Learn about available commands and flags by running `gopls help`.
+-
+-Much of the functionality of `gopls` is available through a command line interface.
+-
+-There are two main reasons for this. The first is that we do not want users to rely on separate command line tools when they wish to do some task outside of an editor. The second is that the CLI assists in debugging. It is easier to reproduce behavior via single command.
+-
+-It is not a goal of `gopls` to be a high performance command line tool. Its command line is intended for single file/package user interaction speeds, not bulk processing.
+diff -urN a/gopls/doc/commands.md b/gopls/doc/commands.md
+--- a/gopls/doc/commands.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/commands.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,467 +0,0 @@
+-# Commands
+-
+-This document describes the LSP-level commands supported by `gopls`. They cannot be invoked directly by users, and all the details are subject to change, so nobody should rely on this information.
+-
+-<!-- BEGIN Commands: DO NOT MANUALLY EDIT THIS SECTION -->
+-### **Add a dependency**
+-Identifier: `gopls.add_dependency`
+-
+-Adds a dependency to the go.mod file for a module.
+-
+-Args:
+-
+-```
+-{
+- // The go.mod file URI.
+- "URI": string,
+- // Additional args to pass to the go command.
+- "GoCmdArgs": []string,
+- // Whether to add a require directive.
+- "AddRequire": bool,
+-}
+-```
+-
+-### **Add an import**
+-Identifier: `gopls.add_import`
+-
+-Ask the server to add an import path to a given Go file. The method will
+-call applyEdit on the client so that clients don't have to apply the edit
+-themselves.
+-
+-Args:
+-
+-```
+-{
+- // ImportPath is the target import path that should
+- // be added to the URI file
+- "ImportPath": string,
+- // URI is the file that the ImportPath should be
+- // added to
+- "URI": string,
+-}
+-```
+-
+-### **Apply a fix**
+-Identifier: `gopls.apply_fix`
+-
+-Applies a fix to a region of source code.
+-
+-Args:
+-
+-```
+-{
+- // The fix to apply.
+- "Fix": string,
+- // The file URI for the document to fix.
+- "URI": string,
+- // The document range to scan for fixes.
+- "Range": {
+- "start": {
+- "line": uint32,
+- "character": uint32,
+- },
+- "end": {
+- "line": uint32,
+- "character": uint32,
+- },
+- },
+-}
+-```
+-
+-### **Check for upgrades**
+-Identifier: `gopls.check_upgrades`
+-
+-Checks for module upgrades.
+-
+-Args:
+-
+-```
+-{
+- // The go.mod file URI.
+- "URI": string,
+- // The modules to check.
+- "Modules": []string,
+-}
+-```
+-
+-### **Run go mod edit -go=version**
+-Identifier: `gopls.edit_go_directive`
+-
+-Runs `go mod edit -go=version` for a module.
+-
+-Args:
+-
+-```
+-{
+- // Any document URI within the relevant module.
+- "URI": string,
+- // The version to pass to `go mod edit -go`.
+- "Version": string,
+-}
+-```
+-
+-### **Get known vulncheck result**
+-Identifier: `gopls.fetch_vulncheck_result`
+-
+-Fetch the result of latest vulnerability check (`govulncheck`).
+-
+-Args:
+-
+-```
+-{
+- // The file URI.
+- "URI": string,
+-}
+-```
+-
+-Result:
+-
+-```
+-map[golang.org/x/tools/gopls/internal/lsp/protocol.DocumentURI]*golang.org/x/tools/gopls/internal/govulncheck.Result
+-```
+-
+-### **Toggle gc_details**
+-Identifier: `gopls.gc_details`
+-
+-Toggle the calculation of gc annotations.
+-
+-Args:
+-
+-```
+-string
+-```
+-
+-### **Run go generate**
+-Identifier: `gopls.generate`
+-
+-Runs `go generate` for a given directory.
+-
+-Args:
+-
+-```
+-{
+- // URI for the directory to generate.
+- "Dir": string,
+- // Whether to generate recursively (go generate ./...)
+- "Recursive": bool,
+-}
+-```
+-
+-### **go get a package**
+-Identifier: `gopls.go_get_package`
+-
+-Runs `go get` to fetch a package.
+-
+-Args:
+-
+-```
+-{
+- // Any document URI within the relevant module.
+- "URI": string,
+- // The package to go get.
+- "Pkg": string,
+- "AddRequire": bool,
+-}
+-```
+-
+-### **List imports of a file and its package**
+-Identifier: `gopls.list_imports`
+-
+-Retrieve a list of imports in the given Go file, and the package it
+-belongs to.
+-
+-Args:
+-
+-```
+-{
+- // The file URI.
+- "URI": string,
+-}
+-```
+-
+-Result:
+-
+-```
+-{
+- // Imports is a list of imports in the requested file.
+- "Imports": []{
+- "Path": string,
+- "Name": string,
+- },
+- // PackageImports is a list of all imports in the requested file's package.
+- "PackageImports": []{
+- "Path": string,
+- },
+-}
+-```
+-
+-### **List known packages**
+-Identifier: `gopls.list_known_packages`
+-
+-Retrieve a list of packages that are importable from the given URI.
+-
+-Args:
+-
+-```
+-{
+- // The file URI.
+- "URI": string,
+-}
+-```
+-
+-Result:
+-
+-```
+-{
+- // Packages is a list of packages relative
+- // to the URIArg passed by the command request.
+- // In other words, it omits paths that are already
+- // imported or cannot be imported due to compiler
+- // restrictions.
+- "Packages": []string,
+-}
+-```
+-
+-### **fetch memory statistics**
+-Identifier: `gopls.mem_stats`
+-
+-Call runtime.GC multiple times and return memory statistics as reported by
+-runtime.MemStats.
+-
+-This command is used for benchmarking, and may change in the future.
+-
+-Result:
+-
+-```
+-{
+- "HeapAlloc": uint64,
+- "HeapInUse": uint64,
+-}
+-```
+-
+-### **Regenerate cgo**
+-Identifier: `gopls.regenerate_cgo`
+-
+-Regenerates cgo definitions.
+-
+-Args:
+-
+-```
+-{
+- // The file URI.
+- "URI": string,
+-}
+-```
+-
+-### **Remove a dependency**
+-Identifier: `gopls.remove_dependency`
+-
+-Removes a dependency from the go.mod file of a module.
+-
+-Args:
+-
+-```
+-{
+- // The go.mod file URI.
+- "URI": string,
+- // The module path to remove.
+- "ModulePath": string,
+- "OnlyDiagnostic": bool,
+-}
+-```
+-
+-### **Reset go.mod diagnostics**
+-Identifier: `gopls.reset_go_mod_diagnostics`
+-
+-Reset diagnostics in the go.mod file of a module.
+-
+-Args:
+-
+-```
+-{
+- "URIArg": {
+- "URI": string,
+- },
+- // Optional: source of the diagnostics to reset.
+- // If not set, all resettable go.mod diagnostics will be cleared.
+- "DiagnosticSource": string,
+-}
+-```
+-
+-### **Run govulncheck.**
+-Identifier: `gopls.run_govulncheck`
+-
+-Run vulnerability check (`govulncheck`).
+-
+-Args:
+-
+-```
+-{
+- // Any document in the directory from which govulncheck will run.
+- "URI": string,
+- // Package pattern. E.g. "", ".", "./...".
+- "Pattern": string,
+-}
+-```
+-
+-Result:
+-
+-```
+-{
+- // Token holds the progress token for LSP workDone reporting of the vulncheck
+- // invocation.
+- "Token": interface{},
+-}
+-```
+-
+-### **Run test(s)**
+-Identifier: `gopls.run_tests`
+-
+-Runs `go test` for a specific set of test or benchmark functions.
+-
+-Args:
+-
+-```
+-{
+- // The test file containing the tests to run.
+- "URI": string,
+- // Specific test names to run, e.g. TestFoo.
+- "Tests": []string,
+- // Specific benchmarks to run, e.g. BenchmarkFoo.
+- "Benchmarks": []string,
+-}
+-```
+-
+-### **Start the gopls debug server**
+-Identifier: `gopls.start_debugging`
+-
+-Start the gopls debug server if it isn't running, and return the debug
+-address.
+-
+-Args:
+-
+-```
+-{
+- // Optional: the address (including port) for the debug server to listen on.
+- // If not provided, the debug server will bind to "localhost:0", and the
+- // full debug URL will be contained in the result.
+- //
+- // If there is more than one gopls instance along the serving path (i.e. you
+- // are using a daemon), each gopls instance will attempt to start debugging.
+- // If Addr specifies a port, only the daemon will be able to bind to that
+- // port, and each intermediate gopls instance will fail to start debugging.
+- // For this reason it is recommended not to specify a port (or equivalently,
+- // to specify ":0").
+- //
+- // If the server was already debugging this field has no effect, and the
+- // result will contain the previously configured debug URL(s).
+- "Addr": string,
+-}
+-```
+-
+-Result:
+-
+-```
+-{
+- // The URLs to use to access the debug servers, for all gopls instances in
+- // the serving path. For the common case of a single gopls instance (i.e. no
+- // daemon), this will be exactly one address.
+- //
+- // In the case of one or more gopls instances forwarding the LSP to a daemon,
+- // URLs will contain debug addresses for each server in the serving path, in
+- // serving order. The daemon debug address will be the last entry in the
+- // slice. If any intermediate gopls instance fails to start debugging, no
+- // error will be returned but the debug URL for that server in the URLs slice
+- // will be empty.
+- "URLs": []string,
+-}
+-```
+-
+-### **Run test(s) (legacy)**
+-Identifier: `gopls.test`
+-
+-Runs `go test` for a specific set of test or benchmark functions.
+-
+-Args:
+-
+-```
+-string,
+-[]string,
+-[]string
+-```
+-
+-### **Run go mod tidy**
+-Identifier: `gopls.tidy`
+-
+-Runs `go mod tidy` for a module.
+-
+-Args:
+-
+-```
+-{
+- // The file URIs.
+- "URIs": []string,
+-}
+-```
+-
+-### **Toggle gc_details**
+-Identifier: `gopls.toggle_gc_details`
+-
+-Toggle the calculation of gc annotations.
+-
+-Args:
+-
+-```
+-{
+- // The file URI.
+- "URI": string,
+-}
+-```
+-
+-### **Update go.sum**
+-Identifier: `gopls.update_go_sum`
+-
+-Updates the go.sum file for a module.
+-
+-Args:
+-
+-```
+-{
+- // The file URIs.
+- "URIs": []string,
+-}
+-```
+-
+-### **Upgrade a dependency**
+-Identifier: `gopls.upgrade_dependency`
+-
+-Upgrades a dependency in the go.mod file for a module.
+-
+-Args:
+-
+-```
+-{
+- // The go.mod file URI.
+- "URI": string,
+- // Additional args to pass to the go command.
+- "GoCmdArgs": []string,
+- // Whether to add a require directive.
+- "AddRequire": bool,
+-}
+-```
+-
+-### **Run go mod vendor**
+-Identifier: `gopls.vendor`
+-
+-Runs `go mod vendor` for a module.
+-
+-Args:
+-
+-```
+-{
+- // The file URI.
+- "URI": string,
+-}
+-```
+-
+-<!-- END Commands: DO NOT MANUALLY EDIT THIS SECTION -->
+diff -urN a/gopls/doc/contributing.md b/gopls/doc/contributing.md
+--- a/gopls/doc/contributing.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/contributing.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,119 +0,0 @@
+-# Documentation for contributors
+-
+-This documentation augments the general documentation for contributing to the
+-x/tools repository, described at the [repository root](../../CONTRIBUTING.md).
+-
+-Contributions are welcome, but since development is so active, we request that
+-you file an issue and claim it before starting to work on something. Otherwise,
+-it is likely that we might already be working on a fix for your issue.
+-
+-## Finding issues
+-
+-All `gopls` issues are labeled as such (see the [`gopls` label][issue-gopls]).
+-Issues that are suitable for contributors are additionally tagged with the
+-[`help-wanted` label][issue-wanted].
+-
+-Before you begin working on an issue, please leave a comment that you are
+-claiming it.
+-
+-## Getting started
+-
+-Most of the `gopls` logic is in the `golang.org/x/tools/gopls/internal/lsp`
+-directory.
+-
+-## Build
+-
+-To build a version of `gopls` with your changes applied:
+-
+-```bash
+-cd /path/to/tools/gopls
+-go install
+-```
+-
+-To confirm that you are testing with the correct `gopls` version, check that
+-your `gopls` version looks like this:
+-
+-```bash
+-$ gopls version
+-golang.org/x/tools/gopls master
+- golang.org/x/tools/gopls@(devel)
+-```
+-
+-## Getting help
+-
+-The best way to contact the gopls team directly is via the
+-[#gopls-dev](https://app.slack.com/client/T029RQSE6/CRWSN9NCD) channel on the
+-gophers slack. Please feel free to ask any questions about your contribution or
+-about contributing in general.
+-
+-## Testing
+-
+-To run tests for just `gopls/`, run,
+-
+-```bash
+-cd /path/to/tools/gopls
+-go test ./...
+-```
+-
+-But, much of the gopls work involves `internal/lsp` too, so you will want to
+-run both:
+-
+-```bash
+-cd /path/to/tools
+-cd gopls && go test ./...
+-cd ..
+-go test ./internal/lsp/...
+-```
+-
+-There is additional information about the `internal/lsp` tests in the
+-[internal/lsp/tests `README`](https://github.com/golang/tools/blob/master/internal/lsp/tests/README.md).
+-
+-### Regtests
+-
+-gopls has a suite of regression tests defined in the `./gopls/internal/regtest`
+-directory. Each of these tests writes files to a temporary directory, starts a
+-separate gopls session, and scripts interactions using an editor-like API. As a
+-result of this overhead they can be quite slow, particularly on systems where
+-file operations are costly.
+-
+-Due to the asynchronous nature of the LSP, regtests assertions are written
+-as 'expectations' that the editor state must achieve _eventually_. This can
+-make debugging the regtests difficult. To aid with debugging, the regtests
+-output their LSP logs on any failure. If your CL gets a test failure while
+-running the regtests, please do take a look at the description of the error and
+-the LSP logs, but don't hesitate to [reach out](#getting-help) to the gopls
+-team if you need help.
+-
+-### CI
+-
+-When you mail your CL and you or a fellow contributor assigns the
+-`Run-TryBot=1` label in Gerrit, the
+-[TryBots](https://golang.org/doc/contribute.html#trybots) will run tests in
+-both the `golang.org/x/tools` and `golang.org/x/tools/gopls` modules, as
+-described above.
+-
+-Furthermore, an additional "gopls-CI" pass will be run by _Kokoro_, which is a
+-Jenkins-like Google infrastructure for running Dockerized tests. This allows us
+-to run gopls tests in various environments that would be difficult to add to
+-the TryBots. Notably, Kokoro runs tests on
+-[older Go versions](../README.md#supported-go-versions) that are no longer supported
+-by the TryBots. Per that that policy, support for these older Go versions is
+-best-effort, and test failures may be skipped rather than fixed.
+-
+-Kokoro runs are triggered by the `Run-TryBot=1` label, just like TryBots, but
+-unlike TryBots they do not automatically re-run if the "gopls-CI" result is
+-removed in Gerrit. To force a re-run of the Kokoro CI on a CL containing the
+-`Run-TryBot=1` label, you can reply in Gerrit with the comment "kokoro rerun".
+-
+-## Debugging
+-
+-The easiest way to debug your change is to run a single `gopls` test with a
+-debugger.
+-
+-See also [Troubleshooting](troubleshooting.md#troubleshooting).
+-
+-<!--TODO(rstambler): Add more details about the debug server and viewing
+-telemetry.-->
+-
+-[issue-gopls]: https://github.com/golang/go/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3Agopls "gopls issues"
+-[issue-wanted]: https://github.com/golang/go/issues?utf8=✓&q=is%3Aissue+is%3Aopen+label%3Agopls+label%3A"help+wanted" "help wanted"
+diff -urN a/gopls/doc/daemon.md b/gopls/doc/daemon.md
+--- a/gopls/doc/daemon.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/daemon.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,183 +0,0 @@
+-# Running gopls as a daemon
+-
+-**Note: this feature is new. If you encounter bugs, please [file an
+-issue](troubleshooting.md#file-an-issue).**
+-
+-If you just want to try this out, skip ahead to the [quickstart](#quickstart).
+-
+-## Background: gopls execution modes
+-
+-Gopls was originally implemented as an LSP sidecar: a process started by
+-editors or editor plugins, and communicated with using jsonrpc 2.0 over
+-stdin/stdout. By executing as a stateful process, gopls can maintain a
+-significant amount of cache and can eagerly perform analysis on the source code
+-being edited.
+-
+-This execution mode does not work as well when there are many separate editor
+-processes or when editor processes are short-lived, as is often the case for
+-users of non-IDE editors such as Vim or Emacs. Having many processes means
+-having many caches, consuming a significant amount of system resources. Using
+-short-lived sessions means paying a start-up cost each time a session is
+-created.
+-
+-To support these types of workflows, a new mode of gopls execution is supported
+-wherein a single, persistent, shared gopls "daemon" process is responsible for
+-managing all gopls sessions. In this mode, editors still start a gopls sidecar,
+-but this sidecar merely acts as a thin "forwarder", responsible for forwarding
+-the LSP to the shared gopls instance and recording metrics, logs, and rpc
+-traces.
+-
+-## Quickstart
+-
+-To use a shared gopls instance you must either manage the daemon process
+-yourself, or let the gopls forwarder processes start the shared daemon as
+-needed.
+-
+-### Running with `-remote=auto`
+-
+-Automatic management of the daemon is easiest, and can be done by passing the
+-flag `-remote=auto` to the gopls process started by your editor. This will
+-cause this process to auto-start the gopls daemon if needed, connect to it, and
+-forward the LSP. For example, here is a reasonable gopls invocation, that sets
+-some additional flags for easier [debugging](#debugging):
+-
+-```bash
+-gopls -remote=auto -logfile=auto -debug=:0 -remote.debug=:0 -rpc.trace
+-```
+-
+-Note that the shared gopls process will automatically shut down after one
+-minute with no connected clients.
+-
+-### Managing the daemon manually
+-
+-To manage the gopls daemon process via external means rather than having the
+-forwarders manage it, you must start a gopls daemon process with the
+-`-listen=<addr>` flag, and then pass `-remote=<addr>` to the gopls processes
+-started by your editor.
+-
+-For example, to host the daemon on the TCP port `37374`, do:
+-
+-```bash
+-gopls -listen=:37374 -logfile=auto -debug=:0
+-```
+-
+-And then from the editor, run
+-
+-```bash
+-gopls -remote=:37374 -logfile=auto -debug=:0 -rpc.trace
+-```
+-
+-If you are on a POSIX system, you can also use unix domain sockets by prefixing
+-the flag values with `unix;`. For example:
+-
+-```bash
+-gopls -listen="unix;/tmp/gopls-daemon-socket" -logfile=auto -debug=:0
+-```
+-
+-And connect via:
+-
+-```bash
+-gopls -remote="unix;/tmp/gopls-daemon-socket" -logfile=auto -debug=:0 -rpc.trace
+-```
+-
+-(Note that these flag values MUST be enclosed in quotes, because ';' is a
+-special shell character. For this reason, this syntax is subject to change in
+-the future.)
+-
+-## Debugging
+-
+-Debugging a shared gopls session is more complicated than a singleton session,
+-because there are now two gopls processes involved with handling the LSP. Here
+-are some tips:
+-
+-### Finding logfiles and debug addresses
+-
+-When running in daemon mode, you can use the `gopls inspect sessions` command
+-to find the logfile and debug port for your gopls daemon instance (as well as
+-for all its connected clients). By default, this inspects the default daemon
+-(i.e. `-remote=auto`). To inspect a different daemon, use the `-remote` flag
+-explicitly: `gopls -remote=localhost:12345 inspect sessions`.
+-
+-This works whether or not you have enabled `-remote.debug`.
+-
+-### Traversing debug pages
+-
+-When `-debug=:0` is passed to gopls, it runs a webserver that serves stateful
+-debug pages (see [troubleshooting.md](troubleshooting.md)). You can find the
+-actual port hosting these pages by either using the `gopls inspect sessions`
+-command, or by checking the start of the logfile -- it will be one of the first
+-log messages. For example, if using `-logfile=auto`, find the debug address by
+-checking `head /tmp/gopls-<pid>.log`.
+-
+-By default, the gopls daemon is not started with `-debug`. To enable it, set
+-the `-remote.debug` flag on the forwarder instance, so that it invokes gopls
+-with `-debug` when starting the daemon.
+-
+-The debug pages of the forwarder process will have a link to the debug pages of
+-the daemon server process. Correspondingly, the debug pages of the daemon
+-process will have a link to each of its clients.
+-
+-This can help you find metrics, traces, and log files for all of the various
+-servers and clients.
+-
+-### Using logfiles
+-
+-The gopls daemon is started with logging disabled by default. To customize
+-this, pass `-remote.logfile` to the gopls forwarder. Using
+-`-remote.logfile=auto`, the daemon will log to a default location (on posix
+-systems: `/tmp/gopls-daemon-<pid>.log`).
+-
+-The gopls daemon does not log session-scoped messages: those are instead
+-reflected back to the forwarder so that they can be accessed by the editor.
+-Daemon logs will only contain global messages, for example logs when sessions
+-connect and disconnect.
+-
+-It is recommended to start the forwarder gopls process with `-rpc.trace`, so
+-that its logfile will contain rpc trace logs specific to the LSP session.
+-
+-## Using multiple shared gopls instances
+-
+-There may be environments where it is desirable to have more than one shared
+-gopls instance. If managing the daemon manually, this can be done by simply
+-choosing different `-listen` addresses for each distinct daemon process.
+-
+-On POSIX systems, there is also support for automatic management of distinct
+-shared gopls processes: distinct daemons can be selected by passing
+-`-remote="auto;<id>"`. Any gopls forwarder passing the same value for `<id>`
+-will use the same shared daemon.
+-
+-## FAQ
+-
+-**Q: Why am I not saving as much memory as I expected when using a shared gopls?**
+-
+-A: As described in [implementation.md](design/implementation.md), gopls has a
+-concept of view/session/cache. Each session and view map onto exactly one
+-editor session (because they contain things like edited but unsaved buffers).
+-The cache contains things that are independent of any editor session, and can
+-therefore be shared.
+-
+-When, for example, three editor session are sharing a single gopls process,
+-they will share the cache but will each have their own session and view. The
+-memory savings in this mode, when compared to three separate gopls processes,
+-corresponds to the amount of cache overlap across sessions.
+-
+-Because this hasn't mattered much in the past, it is likely that there is state
+-that can be moved out of the session/view, and into the cache, thereby
+-increasing the amount of memory savings in the shared mode.
+-
+-**Q: How do I customize the daemon instance when using `-remote=auto`?**
+-
+-The daemon may be customized using flags of the form `-remote.*` on the
+-forwarder gopls. This causes the forwarder to invoke gopls with these settings
+-when starting the daemon. As of writing, we expose the following configuration:
+-
+-* `-remote.logfile`: the location of the daemon logfile
+-* `-remote.debug`: the daemon's debug address
+-* `-remote.listen.timeout`: the amount of time the daemon should wait for new
+- connections while there are no current connections, before shutting down.
+- Must be set to a valid `time.Duration` (e.g. `30s` or `5m`). If `0`, listen
+- indefinitely. Default: `1m`.
+-
+-Note that once the daemon is already running, setting these flags will not
+-change its configuration. These flags only matter for the forwarder process
+-that actually starts the daemon.
+diff -urN a/gopls/doc/design/design.md b/gopls/doc/design/design.md
+--- a/gopls/doc/design/design.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/design/design.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,394 +0,0 @@
+-# `gopls` design documentation
+-
+-## Goals
+-
+-* `gopls` should **become the default editor backend** for the major editors used by Go programmers, fully supported by the Go team.
+-* `gopls` will be a **full implementation of LSP**, as described in the [LSP specification], to standardize as many of its features as possible.
+-* `gopls` will be **clean and extensible** so that it can encompass additional features in the future, allowing Go tooling to become best in class once more.
+-* `gopls` will **support alternate build systems and file layouts**, allowing Go development to be simpler and more powerful in any environment.
+-
+-## Context
+-
+-While Go has a number of excellent and useful command-line tools that enhance the developer experience, it has become clear that integrating these tools with IDEs can pose challenges.
+-
+-Support of these tools has relied on the goodwill of community members, and they have been put under a large burden of support at times as the language, toolchain and environments change. As a result many tools have ceased to work, have had support problems, or become confusing with forks and replacements, or provided an experience that is not as good as it could be.
+-See the section below on [existing solutions](#existing-solutions) for more problems and details.
+-
+-This is fine for tools used occasionally, but for core IDE features, this is not acceptable.
+-Autocompletion, jump to definition, formatting, and other such features should always work, as they are key for Go development.
+-
+-The Go team will create an editor backend that works in any build system.
+-It will also be able to improve upon the latency of Go tools, since each tool will no longer have to individually run the type-checker on each invocation, instead there will be a long-running process and data can be shared between the definitions, completions, diagnostics, and other features.
+-
+-By taking ownership of these tools and packaging them together in the form of gopls, the Go team will ensure that the Go development experience isn’t unnecessarily complicated for Go users.
+-Having one editor backend will simplify the lives of Go developers, the Go team, and the maintainers of Go editor plugins.
+-
+-See Rebecca's excellent GopherCon keynote [talk] and [slides] for some more context.
+-
+-## Non-Goals
+-
+-* Command line speed
+-
+- Although gopls will have a command line mode, it will be optimized for long running and not command responsiveness, as such it may not be the right tool for things like CI systems.
+- For such cases there will have to be an alternate tool using the same underlying libraries for consistency.
+-
+-* Low memory environments
+-
+- In order to do a good job of processing large projects with very low latencies gopls will be holding a lot of information in memory.
+- It is presumed that developers are normally working on systems with significant RAM and this will not be a problem.
+- In general this is upheld by the large memory usage of existing IDE solutions (like IntelliJ)
+-
+-* Syntax highlighting
+-
+- At the moment there is no editor that delegates this functionality to a separate binary, and no standard way of doing it.
+-
+-## Existing solutions
+-
+-Every year the Go team conducts a survey, asking developers about their experiences with the language.
+-
+-One question that is asked is “How do you feel about your editor?”.
+-
+-The responses told a very negative story. Some categorized quotes:
+-
+-* Setup
+- * "Hard to install and configure"
+- * "Inadequate documentation"
+-* Performance
+- * "Performance is very poor"
+- * "Pretty slow in large projects"
+-* Reliability
+- * "Features work one day, but not the next"
+- * "Tooling is not updated with new language features"
+-
+-Each editor has its own plugin that shells out to a variety of tools, many of which break with new Go releases or because they are no longer maintained.
+-
+-The individual tools each have to do the work to understand the code and all its transitive dependencies.
+-
+-Each feature is a different tool, with a different set of patterns for its command line, a different way to accept input and parse output, a different way of specifying source code locations.
+-To support its existing feature set, VSCode installed 24 different command line tools, many of which have options or forks to configure. When looking at the set of tools that needed to be migrated to modules, across all the editors, there were 63 separate tools.
+-
+-All these tools need to understand the code, and they use the same standard libraries to do it. Those libraries are optimized for these kinds of tools, but even so processing that much code takes a lot of time time. Almost none of the tools are capable of returning results within 100ms.
+-As developers type in their editor, multiple of these features need to activate, which means they are not just paying the cost once, but many times. The overall effect is an editing experience that feels sluggish, and features that are either not enabled or sometimes produce results that appear so slowly they are no longer useful when they arrive. This is a problem that increases with the size of the code base, which means it is getting worse over time, and is especially bad for the kinds of large code bases companies are dealing with as they use Go for more major tasks.
+-
+-## Requirements
+-
+-### Complete feature set
+-
+-For gopls to be considered a success it has to implement the full feature set discussed [below](#Features).
+-This is the set of features that users need in order to feel as productive as they were with the tooling it is replacing. It does not include every feature of previous implementations, there are some features that are almost never used that should be dropped (like guru's pointer analysis) and some other features that do not easily fit and will have to be worked around (replacing the save hook/linter).
+-
+-### Equivalent or better experience
+-
+-For all of those features, the user experience must match or exceed the current one available in all editors.
+-This is an easy statement to make, but a hard one to validate or measure. Many of the possible measures fail to capture the experience.
+-
+-For instance, if an attempt was made to measure the latency of a jump to definition call, the results would be fairly consistent from the old godef tool. From the gopls implementation there may be a much larger range of latencies, with the best being orders of magnitude faster, and the worse slightly worse, because gopls attempts to do far more work, but manages to cache it across calls.
+-
+-Or for a completion call, it might be slower but produce a better first match such that users accept it more often, resulting in an overall better experience.
+-
+-For the most part this has to rely on user reports. If users are refusing to switch because the experience is not better, it is clearly not done, if they are switching but most people are complaining, there are probably enough areas that are better to make the switch compelling but other areas which are worse. If most people are switching and either staying silent or being positive, it is probably done. When writing tools, the user is all that matters.
+-
+-### Solid community of contributors
+-
+-The scope and scale of the problem gopls is trying to solve is untenable for the core Go team, it is going to require a strong community to make it all happen.
+-
+-This implies the code must be easy to contribute to, and easy for many developers to work on in parallel. The functionality needs to be well decoupled, and have a thorough testing story.
+-
+-### Latencies that fall within user tolerance
+-
+-There has been a lot of research on acceptable latencies for user actions.
+-<!-- TODO: research links -->
+-The main result that affects gopls is that feedback in direct response to continuous user actions needs to be under 100ms to be imperceptible, and anything above 200ms aggravates the user.
+-This means in general the aim has to be <100ms for anything that happens as the developer types.
+-There will always be cases where gopls fails to meet this deadline, and there needs to be ways to make the user experience okay in those cases, but in general the point of this deadline is to inform the basic architecture design, any solution that cannot theoretically meet this goal in the long term is the wrong answer.
+-
+-### Easy to configure
+-
+-Developers are very particular, and have very differing desires in their coding experience. gopls is going to have to support a significant amount of flexibility, in order to meet those desires.
+-The default settings however with no configuration at all must be the one that is best experience for most users, and where possible the features must be flexible without configuration so that the client can easily make the choices about treatment without changing its communication with gopls.
+-
+-## Difficulties
+-
+-### Volume of data
+-
+-<!-- TODO: project sizes -->
+-* Small:
+-* Medium:
+-* Large:
+-* Corporate mono-repo: Much much bigger
+-
+-Parsing and type checking large amounts of code is quite expensive, and the converted forms use a lot of space. As gopls has to keep updating this information while the developer types, it needs to manage how it caches the converted forms very carefully to balance memory use vs speed.
+-
+-### Cache invalidation
+-
+-The basic unit of operation for the type checking is the package, but the basic unit of operation for an editor is the file.
+-gopls needs to be able to map files to packages efficiently, so that when files change it knows which packages need to be updated (along with any other packages that transitively depended on them).
+-This is made especially difficult by the fact that changing the content of a file can modify which packages it is considered part of (either by changing the package declaration or the build tags), a file can be in more than one package, and changes can be made to files without using the editor, in which case it will not notify us of the changes.
+-
+-### Inappropriate core functionality
+-
+-The base libraries for Go (things like [go/token], [go/ast] and [go/types]) are all designed for compiler-like applications.
+-They tend to worry more about throughput than memory use, they have structures that are intended to grow and then be thrown away at program exit, and they are not designed to keep going in the presence of errors in the source they are handling.
+-They also have no abilities to do incremental changes.
+-
+-Making a long running service work well with those libraries is a very large challenge, but writing new libraries would be far more work, and cause a significant long term cost as both sets of libraries would have to be maintained. Right now it is more important to get a working tool into the hands of users. In the long term this decision may have to be revisited, new low level libraries may be the only way to keep pushing the capabilities forwards.
+-
+-### Build system capabilities
+-
+-gopls is supposed to be build system agnostic, but it must use the build system to discover how files map to packages. When it tries to do so, even when the functionality is the same, the costs (in time, CPU and memory) are very different, and can significantly impact the user experience. Designing how gopls interacts with the build system to try to minimize or hide these differences is hard.
+-
+-### Build tags
+-
+-The build tag system in Go is quite powerful, and has many use cases. Source files can exclude themselves using powerful boolean logic on the set of active tags.
+-It is however designed for specifying the set of active tags on the command line, and the libraries are all designed to cope with only one valid combination at a time. There is also no way to work out the set of valid combinations.
+-
+-Type checking a file requires knowledge of all the other files in the same package, and that set of files is modified by the build tags. The set of exported identifiers of a package is also affected by which files are in the package, and thus its build tags.
+-
+-This means that even for files or packages that have no build tag controls it is not possible to produce correct results without knowing the set of build tags to consider.
+-This makes it very hard to produce useful results when viewing a file.
+-
+-### Features not supported by LSP
+-
+-There are some things it would be good to be able to do that do not fit easily into the existing LSP protocol.
+-For instance, displaying control flow information, automatic struct tags, complex refactoring...
+-
+-Each feature will have to be considered carefully, and either propose a change to LSP, or add a way to have gopls specific extensions to the protocol that are still easy to use in all the editor plugins.
+-
+-To avoid these at the start, only core LSP features will be implemented, as they are sufficient to meet the baseline requirements anyway, but the potential features need to be kept in mind in the core architecture.
+-
+-### Distribution
+-
+-Making sure that users are using the right version of gopls is going to be a problem. Each editor plugin is probably going to install the tools in its own way, some will choose to install it system wide, some will keep their own copy.
+-
+-Because it is a brand new tool, it will be changing rapidly. If users are not informed they are on an old version they will be experiencing problems that have already been fixed, which is worse for them, and then probably reporting them, which wastes time for the gopls team. There needs to be a mechanism for gopls to check if is up to date, and a recommended way to install an up to date version.
+-
+-### Debugging user problems
+-
+-gopls is essentially a very stateful long running server on the developer's machine. Its basic operation is affected by many things, from the users environment to the contents of the local build cache. The data it is operating on is often a confidential code base that cannot be shared.
+-All of these things make it hard for users to report a bug usefully, or create a minimal reproduction.
+-
+-There needs to be easy ways for users to report what information they can, and ways to attempt to reproduce problems without their entire state. This is also needed to produce regression tests.
+-
+-## Basic design decisions
+-
+-There are some fundamental architecture decisions that affect much of the rest of the design of the tool, making fundamental trade offs that impact the user experience.
+-
+-### Process lifetime: *managed by the editor*
+-
+-Processing a large code base to fully type check and then analyze it within the latency requirements is not feasible, and is one of the primary problems with the existing solutions. This remains true even if the computed information was cached on disk, as running analyzers and type checkers ends up requiring the full AST of all files in the dependency graph.
+-It is theoretically possible to do better, but only with a major re-write of the existing parsing and type checking libraries, something that is not feasible at this time.
+-
+-This implies that gopls should be a long running process, that is able to cache and pre-calculate results in memory so that when a request arrives it can produce the answer much faster.
+-
+-It could run as a daemon on the user's machine, but there are a lot of issues with managing a daemon. It may well be the right choice in the long term, and it should be allowed for in the fundamental architecture design, but to start with it will instead have a process that lasts as long as the editor that starts it, and that can easily be restarted.
+-
+-### Caching: *in memory*
+-
+-Persistent disk caches are very expensive to maintain, and require solving a lot of extra problems.
+-Although building the information required is expensive compared to the latencies required of the requests, it is fairly minor compared to the startup times of an editor, so it is expected that rebuilding the information when gopls is restarted will be acceptable.
+-
+-The advantage gained from this is that gopls becomes stateless across restarts which means if it has issues or gets its state confused, a simple restart will often fix the problem.
+-It also means that when users report problems, the entire state of the on disk cache is not needed to diagnose and reproduce the issue.
+-
+-### Communication: *stdin/stdout JSON*
+-
+-The LSP specification defines the JSON messages that are normally used, but it does not define how those message should be sent, and there are implementations of the LSP that do not use JSON (for instance, Protocol buffers are an option).
+-
+-The constraints on gopls are that it must be easy to integrate into *every editor* on *all operating systems*, and that it should not have large external dependencies.
+-
+-JSON is part of the Go standard library, and is also the native language of LSP, so it makes the most sense. By far the best supported communication mechanism is the standard input and output of a process, and the common client implementations all have ways of using [JSON rpc 2] in this mode. There were no complete and low dependency implementations of this protocol in Go, but it is a fairly small protocol on top of the JSON library that can be implemented with a moderate effort, and would be a generally useful library to have anyway.
+-
+-In the future it is expected to run in separated client server mode, so writing it in a way that could use sockets instead of stdin/stdout from the start was the best way to make sure it remained possible. It was also a huge debugging aid to be able to run the gopls server by hand and watch/debug it outside the editor.
+-
+-### Running other tools: *no*
+-
+-<!--- TODO: subprocess discuss --->
+-
+-## Features
+-
+-<!--TODO(rstambler): Generate a file that lists all of the supported features.-->
+-
+-There is a set of features that gopls needs to expose to be a comprehensive IDE solution.
+-The following is the minimum set of features, along with their existing solutions and how they should map to the LSP.
+-
+-### Introspection
+-
+-Introspection features tell developers information about their code while they work. They do not make or suggest changes.
+-
+----
+-Diagnostics | Static analysis results of the code, including compilation and lint errors
+------------ | ---
+-Requires | Full go/analysis run, which needs full AST, type and SSA information
+-LSP | [`textDocument/publishDiagnostics`]
+-Previous | `go build`, `go vet`, `golint`, [errcheck], [staticcheck] <!-- TODO: and all the rest -->
+-| | This is one of the most important IDE features, allowing fast turn around without having to run compilers and checkers in the shell. Often used to power problem lists, gutter markers and squiggle underlines in the IDE. <br/> There is some complicated design work to do in order to let users customize the set of checks being run, preferably without having to recompile the main LSP binary.
+-
+----
+-Hover | Information about the code under the cursor.
+--------- | ---
+-Requires | AST and type information for the file and all dependencies
+-LSP | [`textDocument/hover`]
+-Previous | [godoc], [gogetdoc]
+-| | Used when reading code to display information known to the compiler but not always obvious from the code. For instance it may return the types of identifiers, or the documentation.
+-
+----
+-Signature help | Function parameter information and documentation
+--------------- | ---
+-Requires | AST and type information for the file and all dependencies
+-LSP | [`textDocument/signatureHelp`]
+-Previous | [gogetdoc]
+-| | As a function call is being typed into code, it is helpful to know the parameters of that call to enable the developer to call it correctly.
+-
+-### Navigation
+-
+-Navigation features are designed to make it easier for a developer to find their way round a code base.
+-
+----
+-Definition | Select an identifier, and jump to the code where that identifier was defined.
+----------- | ---
+-Requires | Full type information for file and all dependencies
+-LSP | [`textDocument/declaration`]
+-| | [`textDocument/definition`]
+-| | [`textDocument/typeDefinition`]
+-Previous | [godef] |
+-| | Asking the editor to open the place where a symbol was defined is one of the most commonly used code navigation tools inside an IDE when available. It is especially valuable when exploring an unfamiliar code base.<br/>Due to a limitation of the compiler output, it is not possible to use the binary data for this task (specifically it does not know column information) and thus it must parse from source.
+-
+----
+-Implementation | Reports the types that implement an interface
+--------------- | ---
+-Requires | Full workspace type knowledge
+-LSP | [`textDocument/implementation`]
+-Previous | [impl]
+-| | This feature is hard to scale up to large code bases, and is going to take thought to get right. It may be feasible to implemented a more limited form in the meantime.
+-
+----
+-Document symbols | Provides the set of top level symbols in the current file.
+----------------- | ---
+-Requires | AST of the current file only
+-LSP | [`textDocument/documentSymbol`]
+-Previous | [go-outline], [go-symbols]
+-| | Used to drive things like outline mode.
+-
+----
+-References | Find all references to the symbol under the cursor.
+----------- | ---
+-Requires | AST and type information for the **reverse** transitive closure
+-LSP | [`textDocument/references`]
+-Previous | [guru]
+-| | This requires knowledge of every package that could possible depend on any packages the current file is part of. In the past this has been implemented either by global knowledge, which does not scale, or by specifying a "scope" which confused users to the point where they just did not use the tools. gopls is probably going to need a more powerful solution in the long term, but to start with automatically limiting the scope may produce acceptable results. This would probably be the module if known, or some sensible parent directory otherwise.
+-
+----
+-Folding | Report logical hierarchies of blocks
+--------- | ---
+-Requires | AST of the current file only
+-LSP | [`textDocument/foldingRange`]
+-Previous | [go-outline]
+-| | This is normally used to provide expand and collapse behavior in editors.
+-
+----
+-Selection | Report regions of logical selection around the cursor
+---------- | ---
+-Requires | AST of the current file only
+-LSP | [`textDocument/selectionRange`]
+-Previous | [guru]
+-| | Used in editor features like expand selection.
+-
+-
+-### Edit assistance
+-
+-These features suggest or apply edits to the code for the user, including refactoring features, for which there are many potential use cases.
+-Refactoring is one of the places where Go tools could potentially be very strong, but have not been so far, and thus there is huge potential for improvements in the developer experience.
+-There is not yet a clear understanding of the kinds of refactoring people need or how they should express them however, and there are weaknesses in the LSP protocol around this.
+-This means it may be much more of a research project.
+-
+-
+----
+-Format | Fix the formatting of the file
+--------- | ---
+-Requires | AST of current file
+-LSP | [`textDocument/formatting`]
+-| | [`textDocument/rangeFormatting`]
+-| | [`textDocument/onTypeFormatting`]
+-Previous | [gofmt], [goimports], [goreturns]
+-| | It will use the standard format package. <br/> Current limitations are that it does not work on malformed code. It may need some very careful changes to the formatter to allow for formatting an invalid AST or changes to force the AST to a valid mode. These changes would improve range and file mode as well, but are basically vital to onTypeFormatting
+-
+----
+-Imports | Rewrite the imports block automatically to match the symbols used.
+--------- | ---
+-Requires | AST of the current file and full symbol knowledge for all candidate packages.
+-LSP | [`textDocument/codeAction`]
+-Previous | [goimports], [goreturns]
+-| | This needs knowledge of packages that are not yet in use, and the ability to find those packages by name. <br/> It also needs exported symbol information for all the packages it discovers. <br/> It should be implemented using the standard imports package, but there may need to be exposed a more fine grained API than just a file rewrite for some of the interactions.
+-
+----
+-Autocompletion | Makes suggestions to complete the entity currently being typed.
+--------------- | ---
+-Requires | AST and type information for the file and all dependencies<br/> Also full exported symbol knowledge for all packages.
+-LSP | [`textDocument/completion`]
+-| | [`completionItem/resolve`]
+-Previous | [gocode]
+-| | Autocomplete is one of the most complicated features, and the more it knows the better its suggestions can be. For instance it can autocomplete into packages that are not yet being imported if it has their public symbols. It can make better suggestions of options if it knows what kind of program you are writing. It can suggest better arguments if it knows how you normally call a function. It can suggest entire patterns of code if it knows they are common. Unlike many other features, which have a specific task, and once it is doing that task the feature is done, autocomplete will never be finished. Balancing and improving both the candidates and how they are ranked will be a research problem for a long time to come.
+-
+----
+-Rename | Rename an identifier
+--------- | ---
+-Requires | AST and type information for the **reverse** transitive closure
+-LSP | [`textDocument/rename`]
+-| | [`textDocument/prepareRename`]
+-Previous | [gorename]
+-| | This uses the same information that find references does, with all the same problems and limitations. It is slightly worse because the changes it suggests make it intolerant of incorrect results. It is also dangerous using it to change the public API of a package.
+-
+----
+-Suggested fixes | Suggestions that can be manually or automatically accepted to change the code
+---------------- | ---
+-Requires | Full go/analysis run, which needs full AST, type and SSA information
+-LSP | [`textDocument/codeAction`]
+-Previous | N/A
+-| | This is a brand new feature powered by the new go/analysis engine, and it should allow a huge amount of automated refactoring.
+-
+-[LSP specification]: https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/
+-[talk]: TODO
+-[slides]: https://github.com/gophercon/2019-talks/blob/master/RebeccaStambler-GoPleaseStopBreakingMyEditor/slides.pdf "Go, please stop breaking my editor!"
+-[JSON rpc 2]: https://www.jsonrpc.org/specification
+-
+-[errcheck]: https://github.com/kisielk/errcheck
+-[go-outline]: https://github.com/lukehoban/go-outline
+-[go-symbols]: https://github.com/acroca/go-symbols
+-[gocode]: https://github.com/stamblerre/gocode
+-[godef]: https://github.com/rogpeppe/godef
+-[godoc]: https://golang.org/cmd/godoc
+-[gofmt]: https://golang.org/cmd/gofmt
+-[gogetdoc]: https://github.com/zmb3/gogetdoc
+-[goimports]: https://pkg.go.dev/golang.org/x/tools/cmd/goimports
+-[gorename]: https://pkg.go.dev/golang.org/x/tools/cmd/gorename
+-[goreturns]: https://github.com/sqs/goreturns
+-[gotags]: https://github.com/jstemmer/gotags
+-[guru]: https://pkg.go.dev/golang.org/x/tools/cmd/guru
+-[impl]: https://github.com/josharian/impl
+-[staticcheck]: https://staticcheck.io/docs/
+-[go/types]: https://golang.org/pkg/go/types/
+-[go/ast]: https://golang.org/pkg/go/ast/
+-[go/token]: https://golang.org/pkg/go/token/
+-
+-[`completionItem/resolve`]:https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#completionItem_resolve
+-[`textDocument/codeAction`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_codeAction
+-[`textDocument/completion`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_completion
+-[`textDocument/declaration`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_declaration
+-[`textDocument/definition`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_definition
+-[`textDocument/documentLink`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_documentLink
+-[`textDocument/documentSymbol`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_documentSymbol
+-[`textDocument/foldingRange`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_foldingRange
+-[`textDocument/formatting`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_formatting
+-[`textDocument/highlight`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_highlight
+-[`textDocument/hover`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_hover
+-[`textDocument/implementation`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_implementation
+-[`textDocument/onTypeFormatting`]:https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_onTypeFormatting
+-[`textDocument/prepareRename`]:https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_prepareRename
+-[`textDocument/publishDiagnostics`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_publishDiagnostics
+-[`textDocument/rangeFormatting`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_rangeFormatting
+-[`textDocument/references`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_references
+-[`textDocument/rename`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_rename
+-[`textDocument/selectionRange`]:https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_selectionRange
+-[`textDocument/signatureHelp`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_signatureHelp
+-[`textDocument/typeDefinition`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_typeDefinition
+-[`workspace/didChangeWatchedFiles`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#workspace_didChangeWatchedFiles
+diff -urN a/gopls/doc/design/implementation.md b/gopls/doc/design/implementation.md
+--- a/gopls/doc/design/implementation.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/design/implementation.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,48 +0,0 @@
+-# gopls implementation documentation
+-
+-This is not intended as a complete description of the implementation, for the most the part the package godoc, code comments and the code itself hold that.
+-Instead this is meant to be a guide into finding parts of the implementation, and understanding some core concepts used throughout the implementation.
+-
+-## View/Session/Cache
+-
+-Throughout the code there are references to these three concepts, and they build on each other.
+-
+-At the base is the *Cache*. This is the level at which we hold information that is global in nature, for instance information about the file system and its contents.
+-
+-Above that is the *Session*, which holds information for a connection to an editor. This layer hold things like the edited files (referred to as overlays).
+-
+-The top layer is called the *View*. This holds the configuration, and the mapping to configured packages.
+-
+-The purpose of this layering is to allow a single editor session to have multiple views active whilst still sharing as much information as possible for efficiency.
+-In theory if only the View layer existed, the results would be identical, but slower and using more memory.
+-
+-## Code location
+-
+-gopls will be developed in the [x/tools] Go repository; the core packages are in [internal/lsp], and the binary and integration tests are located in [gopls].
+-
+-Below is a list of the core packages of gopls, and their primary purpose:
+-
+-Package | Description
+---- | ---
+-[gopls] | the main binary, plugins and integration tests
+-[internal/lsp] | the core message handling package
+-[internal/lsp/cache] | the cache layer
+-[internal/lsp/cmd] | the gopls command line layer
+-[internal/lsp/debug] | features to aid in debugging gopls
+-[internal/lsp/protocol] | the types of LSP request and response messages
+-[internal/lsp/source] | the core feature implementations
+-[internal/span] | a package for dealing with source file locations
+-[internal/memoize] | a function invocation cache used to reduce the work done
+-[internal/jsonrpc2] | an implementation of the JSON RPC2 specification
+-
+-[gopls]: https://github.com/golang/tools/tree/master/gopls
+-[internal/jsonrpc2]: https://github.com/golang/tools/tree/master/internal/jsonrpc2
+-[internal/lsp]: https://github.com/golang/tools/tree/master/internal/lsp
+-[internal/lsp/cache]: https://github.com/golang/tools/tree/master/internal/lsp/cache
+-[internal/lsp/cmd]: https://github.com/golang/tools/tree/master/internal/lsp/cmd
+-[internal/lsp/debug]: https://github.com/golang/tools/tree/master/internal/lsp/debug
+-[internal/lsp/protocol]: https://github.com/golang/tools/tree/master/internal/lsp/protocol
+-[internal/lsp/source]: https://github.com/golang/tools/tree/master/internal/lsp/source
+-[internal/memoize]: https://github.com/golang/tools/tree/master/internal/memoize
+-[internal/span]: https://github.com/golang/tools/tree/master/internal/span
+-[x/tools]: https://github.com/golang/tools
+diff -urN a/gopls/doc/design/integrating.md b/gopls/doc/design/integrating.md
+--- a/gopls/doc/design/integrating.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/design/integrating.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,91 +0,0 @@
+-# Documentation for plugin authors
+-
+-If you are integrating `gopls` into an editor by writing an editor plugin, there are quite a few semantics of the communication between the editor and `gopls` that are not specified by the [LSP specification].
+-
+-We attempt to document those details along with any other information that has been helpful to other plugin authors here.
+-
+-If you are implementing a plugin yourself and have questions this page does not answer, please reach out to us to ask, and then also contribute your findings back to this page.
+-
+-## Supported features
+-
+-For the most part you should look at the [list](status.md#supported-features) in the current status document to know if gopls supports a feature.
+-For a truly authoritative answer you should check the [result][InitializeResult] of the [initialize] request, where gopls enumerates its support in the [ServerCapabilities].
+-
+-
+-## Positions and ranges
+-
+-Many LSP requests pass position or range information. This is described in the [LSP specification][lsp-text-documents]:
+-
+-> A position inside a document (see Position definition below) is expressed as a zero-based line and character offset. The offsets are based on a UTF-16 string representation. So a string of the form a𐐀b the character offset of the character a is 0, the character offset of 𐐀 is 1 and the character offset of b is 3 since 𐐀 is represented using two code units in UTF-16.
+-
+-This means that integrators will need to calculate UTF-16 based column offsets.
+-
+-[`golang.org/x/tools/gopls/internal/span`] has the code to do this in go.
+-[#31080] tracks making `span` and other useful packages non-internal.
+-
+-## Edits
+-
+-In order to deliver changes from gopls to the editor, the LSP supports arrays of [`TextEdit`][lsp-textedit]s in responses.
+-The spec specifies exactly how these should be applied:
+-
+-> All text edits ranges refer to positions in the original document. Text edits ranges must never overlap, that means no part of the original document must be manipulated by more than one edit. However, it is possible that multiple edits have the same start position: multiple inserts, or any number of inserts followed by a single remove or replace edit. If multiple inserts have the same position, the order in the array defines the order in which the inserted strings appear in the resulting text.
+-
+-All `[]TextEdit` are sorted such that applying the array of deltas received in reverse order achieves the desired result that holds with the spec.
+-
+-## Errors
+-
+-Various error codes are described in the [LSP specification][lsp-response]. We are still determining what it means for a method to return an error; are errors only for low-level LSP/transport issues or can other conditions cause errors to be returned? See some of this discussion on [#31526].
+-
+-The method chosen is currently influenced by the exact treatment in the currently popular editor integrations. It may well change, and ideally would become more coherent across requests.
+-
+-* [`textDocument/codeAction`]: Return error if there was an error computing code actions.
+-* [`textDocument/completion`]: Log errors, return empty result list.
+-* [`textDocument/definition`]: Return error if there was an error computing the definition for the position.
+-* [`textDocument/typeDefinition`]: Return error if there was an error computing the type definition for the position.
+-* [`textDocument/formatting`]: Return error if there was an error formatting the file.
+-* [`textDocument/highlight`]: Log errors, return empty result.
+-* [`textDocument/hover`]: Return empty result.
+-* [`textDocument/documentLink`]: Log errors, return nil result.
+-* [`textDocument/publishDiagnostics`]: Log errors if there were any while computing diagnostics.
+-* [`textDocument/references`]: Log errors, return empty result.
+-* [`textDocument/rename`]: Return error if there was an error computing renames.
+-* [`textDocument/signatureHelp`]: Log errors, return nil result.
+-* [`textDocument/documentSymbols`]: Return error if there was an error computing document symbols.
+-
+-## Watching files
+-
+-It is fairly normal for files that affect `gopls` to be modified outside of the editor it is associated with.
+-
+-For instance, files that are needed to do correct type checking are modified by switching branches in git, or updated by a code generator.
+-
+-Monitoring files inside gopls directly has a lot of awkward problems, but the [LSP specification] has methods that allow gopls to request that the client notify it of file system changes, specifically [`workspace/didChangeWatchedFiles`].
+-This is currently being added to gopls by a community member, and tracked in [#31553]
+-
+-[InitializeResult]: https://pkg.go.dev/golang.org/x/tools/gopls/internal/lsp/protocol#InitializeResult
+-[ServerCapabilities]: https://pkg.go.dev/golang.org/x/tools/gopls/internal/lsp/protocol#ServerCapabilities
+-[`golang.org/x/tools/gopls/internal/span`]: https://pkg.go.dev/golang.org/x/tools/internal/span#NewPoint
+-
+-[LSP specification]: https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/
+-[lsp-response]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#response-message
+-[initialize]: https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#initialize
+-[lsp-text-documents]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#text-documents
+-[lsp-textedit]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textedit
+-
+-[`textDocument/codeAction`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_codeAction
+-[`textDocument/completion`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_completion
+-[`textDocument/definition`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_definition
+-[`textDocument/typeDefinition`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_typeDefinition
+-[`textDocument/formatting`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_formatting
+-[`textDocument/highlight`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_highlight
+-[`textDocument/hover`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_hover
+-[`textDocument/documentLink`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_documentLink
+-[`textDocument/publishDiagnostics`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_publishDiagnostics
+-[`textDocument/references`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_references
+-[`textDocument/rename`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_rename
+-[`textDocument/signatureHelp`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_signatureHelp
+-[`textDocument/documentSymbols`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#textDocument_documentSymbols
+-[`workspace/didChangeWatchedFiles`]: https://github.com/Microsoft/language-server-protocol/blob/gh-pages/_specifications/specification-3-14.md#workspace_didChangeWatchedFiles
+-
+-[#31080]: https://github.com/golang/go/issues/31080
+-[#31553]: https://github.com/golang/go/issues/31553
+-[#31526]: https://github.com/golang/go/issues/31526
+diff -urN a/gopls/doc/emacs.md b/gopls/doc/emacs.md
+--- a/gopls/doc/emacs.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/emacs.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,183 +0,0 @@
+-# Emacs
+-
+-## Installing `gopls`
+-
+-To use `gopls` with Emacs, you must first
+-[install the `gopls` binary](../README.md#installation) and ensure that the directory
+-containing the resulting binary (either `$(go env GOBIN)` or `$(go env
+-GOPATH)/bin`) is in your `PATH`.
+-
+-## Choosing an Emacs LSP client
+-
+-To use `gopls` with Emacs, you will need to choose and install an Emacs LSP
+-client package. Two popular client packages are [LSP Mode] and [Eglot].
+-
+-LSP Mode takes a batteries-included approach, with many integrations enabled
+-“out of the box” and several additional behaviors provided by `lsp-mode` itself.
+-
+-Eglot takes a minimally-intrusive approach, focusing on smooth integration with
+-other established packages. It provides a few of its own `eglot-` commands but
+-no additional keybindings by default.
+-
+-Once you have selected which client you want to use, install it per the packages
+-instructions: see [Eglot 1-2-3](https://github.com/joaotavora/eglot#1-2-3) or
+-[LSP Mode Installation](https://emacs-lsp.github.io/lsp-mode/page/installation/).
+-
+-## Common configuration
+-
+-Both Eglot and LSP Mode can integrate with popular packages in the Emacs
+-ecosystem:
+-
+-* The built-in [`xref`] package provides cross-references.
+-* The built-in [Flymake] package provides an on-the-fly diagnostic overlay.
+-* [Company] mode displays code completion candidates (with a richer UI than
+- the built-in [`completion-at-point`]).
+-
+-Eglot provides documentation using the built-in [ElDoc] minor mode, while LSP
+-Mode by default provides documentation using its own [`lsp-ui`] mode.
+-
+-Eglot by default locates the project root using the [`project`] package. In LSP
+-Mode, this behavior can be configured using the `lsp-auto-guess-root` setting.
+-
+-## Configuring LSP Mode
+-
+-### Loading LSP Mode in `.emacs`
+-
+-```elisp
+-(require 'lsp-mode)
+-(add-hook 'go-mode-hook #'lsp-deferred)
+-
+-;; Set up before-save hooks to format buffer and add/delete imports.
+-;; Make sure you don't have other gofmt/goimports hooks enabled.
+-(defun lsp-go-install-save-hooks ()
+- (add-hook 'before-save-hook #'lsp-format-buffer t t)
+- (add-hook 'before-save-hook #'lsp-organize-imports t t))
+-(add-hook 'go-mode-hook #'lsp-go-install-save-hooks)
+-```
+-
+-### Configuring `gopls` via LSP Mode
+-
+-See [settings] for information about available gopls settings.
+-
+-Stable gopls settings have corresponding configuration variables in `lsp-mode`.
+-For example, `(setq lsp-gopls-use-placeholders nil)` will disable placeholders
+-in completion snippets. See [`lsp-go`] for a list of available variables.
+-
+-Experimental settings can be configured via `lsp-register-custom-settings`:
+-
+-```lisp
+-(lsp-register-custom-settings
+- '(("gopls.completeUnimported" t t)
+- ("gopls.staticcheck" t t)))
+-```
+-
+-Note that after changing settings you must restart gopls using e.g. `M-x
+-lsp-restart-workspace`.
+-
+-## Configuring Eglot
+-
+-### Configuring `project` for Go modules in `.emacs`
+-
+-Eglot uses the built-in `project` package to identify the LSP workspace for a
+-newly-opened buffer. The `project` package does not natively know about `GOPATH`
+-or Go modules. Fortunately, you can give it a custom hook to tell it to look for
+-the nearest parent `go.mod` file (that is, the root of the Go module) as the
+-project root.
+-
+-```elisp
+-(require 'project)
+-
+-(defun project-find-go-module (dir)
+- (when-let ((root (locate-dominating-file dir "go.mod")))
+- (cons 'go-module root)))
+-
+-(cl-defmethod project-root ((project (head go-module)))
+- (cdr project))
+-
+-(add-hook 'project-find-functions #'project-find-go-module)
+-```
+-
+-### Loading Eglot in `.emacs`
+-
+-```elisp
+-;; Optional: load other packages before eglot to enable eglot integrations.
+-(require 'company)
+-(require 'yasnippet)
+-
+-(require 'go-mode)
+-(require 'eglot)
+-(add-hook 'go-mode-hook 'eglot-ensure)
+-
+-;; Optional: install eglot-format-buffer as a save hook.
+-;; The depth of -10 places this before eglot's willSave notification,
+-;; so that that notification reports the actual contents that will be saved.
+-(defun eglot-format-buffer-on-save ()
+- (add-hook 'before-save-hook #'eglot-format-buffer -10 t))
+-(add-hook 'go-mode-hook #'eglot-format-buffer-on-save)
+-```
+-
+-### Configuring `gopls` via Eglot
+-
+-See [settings] for information about available gopls settings.
+-
+-LSP server settings are controlled by the `eglot-workspace-configuration`
+-variable, which can be set either globally in `.emacs` or in a `.dir-locals.el` file in the project root.
+-
+-`.emacs`:
+-```elisp
+-(setq-default eglot-workspace-configuration
+- '((:gopls .
+- ((staticcheck . t)
+- (matcher . "CaseSensitive")))))
+-```
+-
+-`.dir-locals.el`:
+-```elisp
+-((nil (eglot-workspace-configuration . ((gopls . ((staticcheck . t)
+- (matcher . "CaseSensitive")))))))
+-```
+-
+-### Organizing imports with Eglot
+-
+-`gopls` provides the import-organizing functionality of `goimports` as an LSP
+-code action, which you can invoke as needed by running `M-x eglot-code-actions`
+-(or a key of your choice bound to the `eglot-code-actions` function) and
+-selecting `Organize Imports` at the prompt.
+-
+-Eglot does not currently support a standalone function to execute a specific
+-code action (see
+-[joaotavora/eglot#411](https://github.com/joaotavora/eglot/issues/411)), nor an
+-option to organize imports as a `before-save-hook` (see
+-[joaotavora/eglot#574](https://github.com/joaotavora/eglot/issues/574)). In the
+-meantime, see those issues for discussion and possible workarounds.
+-
+-## Troubleshooting
+-
+-Common errors:
+-
+-* When prompted by Emacs for your project folder, if you are using modules you
+- must select the module's root folder (i.e. the directory with the "go.mod").
+- If you are using GOPATH, select your $GOPATH as your folder.
+-* Emacs must have your environment set properly (PATH, GOPATH, etc). You can
+- run `M-x getenv <RET> PATH <RET>` to see if your PATH is set in Emacs. If
+- not, you can try starting Emacs from your terminal, using [this
+- package][exec-path-from-shell], or moving your shell config from `.bashrc`
+- into `.profile` and logging out and back in.
+-* Make sure only one LSP client mode is installed. (For example, if using
+- `lsp-mode`, ensure that you are not _also_ enabling `eglot`.)
+-* Look for errors in the `*lsp-log*` buffer or run `M-x eglot-events-buffer`.
+-* Ask for help in the `#emacs` channel on the [Gophers slack].
+-
+-[LSP Mode]: https://emacs-lsp.github.io/lsp-mode/
+-[Eglot]: https://github.com/joaotavora/eglot/blob/master/README.md
+-[`xref`]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Xref.html
+-[Flymake]: https://www.gnu.org/software/emacs/manual/html_node/flymake/Using-Flymake.html#Using-Flymake
+-[Company]: https://company-mode.github.io/
+-[`completion-at-point`]: https://www.gnu.org/software/emacs/manual/html_node/elisp/Completion-in-Buffers.html
+-[ElDoc]: https://elpa.gnu.org/packages/eldoc.html
+-[`lsp-ui`]: https://emacs-lsp.github.io/lsp-ui/
+-[`lsp-go`]: https://github.com/emacs-lsp/lsp-mode/blob/master/clients/lsp-go.el
+-[`use-package`]: https://github.com/jwiegley/use-package
+-[`exec-path-from-shell`]: https://github.com/purcell/exec-path-from-shell
+-[settings]: settings.md
+-[Gophers slack]: https://invite.slack.golangbridge.org/
+diff -urN a/gopls/doc/features.md b/gopls/doc/features.md
+--- a/gopls/doc/features.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/features.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,55 +0,0 @@
+-# Features
+-
+-This document describes some of the features supported by `gopls`. It is
+-currently under construction, so, for a comprehensive list, see the
+-[Language Server Protocol](https://microsoft.github.io/language-server-protocol/).
+-
+-## Special features
+-
+-Here, only special features outside of the LSP are described.
+-
+-### Symbol Queries
+-
+-Gopls supports some extended syntax for `workspace/symbol` requests, when using
+-the `fuzzy` symbol matcher (the default). Inspired by the popular fuzzy matcher
+-[FZF](https://github.com/junegunn/fzf), the following special characters are
+-supported within symbol queries:
+-
+-| Character | Usage | Match |
+-| --------- | --------- | ------------ |
+-| `'` | `'abc` | exact |
+-| `^` | `^printf` | exact prefix |
+-| `$` | `printf$` | exact suffix |
+-
+-## Template Files
+-
+-Gopls provides some support for Go template files, that is, files that
+-are parsed by `text/template` or `html/template`.
+-Gopls recognizes template files based on their file extension, which may be
+-configured by the
+-[`templateExtensions`](https://github.com/golang/tools/blob/master/gopls/doc/settings.md#templateextensions-string) setting.
+-Making this list empty turns off template support.
+-
+-In template files, template support works inside
+-the default `{{` delimiters. (Go template parsing
+-allows the user to specify other delimiters, but
+-gopls does not know how to do that.)
+-
+-Gopls template support includes the following features:
+-+ **Diagnostics**: if template parsing returns an error,
+-it is presented as a diagnostic. (Missing functions do not produce errors.)
+-+ **Syntax Highlighting**: syntax highlighting is provided for template files.
+-+ **Definitions**: gopls provides jump-to-definition inside templates, though it does not understand scoping (all templates are considered to be in one global scope).
+-+ **References**: gopls provides find-references, with the same scoping limitation as definitions.
+-+ **Completions**: gopls will attempt to suggest completions inside templates.
+-
+-### Configuring your editor
+-
+-In addition to configuring `templateExtensions`, you may need to configure your
+-editor or LSP client to activate `gopls` for template files. For example, in
+-`VS Code` you will need to configure both
+-[`files.associations`](https://code.visualstudio.com/docs/languages/identifiers)
+-and `build.templateExtensions` (the gopls setting).
+-
+-<!--TODO(rstambler): Automatically generate a list of supported features.-->
+-
+diff -urN a/gopls/doc/generate.go b/gopls/doc/generate.go
+--- a/gopls/doc/generate.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/generate.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,778 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.16
+-// +build go1.16
+-
+-// Command generate creates API (settings, etc) documentation in JSON and
+-// Markdown for machine and human consumption.
+-package main
+-
+-import (
+- "bytes"
+- "encoding/json"
+- "fmt"
+- "go/ast"
+- "go/format"
+- "go/token"
+- "go/types"
+- "io"
+- "io/ioutil"
+- "os"
+- "os/exec"
+- "path/filepath"
+- "reflect"
+- "regexp"
+- "sort"
+- "strconv"
+- "strings"
+- "time"
+- "unicode"
+-
+- "github.com/jba/printsrc"
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/go/packages"
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/command/commandmeta"
+- "golang.org/x/tools/gopls/internal/lsp/mod"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-func main() {
+- if _, err := doMain(true); err != nil {
+- fmt.Fprintf(os.Stderr, "Generation failed: %v\n", err)
+- os.Exit(1)
+- }
+-}
+-
+-func doMain(write bool) (bool, error) {
+- api, err := loadAPI()
+- if err != nil {
+- return false, err
+- }
+-
+- sourceDir, err := pkgDir("golang.org/x/tools/gopls/internal/lsp/source")
+- if err != nil {
+- return false, err
+- }
+-
+- if ok, err := rewriteFile(filepath.Join(sourceDir, "api_json.go"), api, write, rewriteAPI); !ok || err != nil {
+- return ok, err
+- }
+-
+- goplsDir, err := pkgDir("golang.org/x/tools/gopls")
+- if err != nil {
+- return false, err
+- }
+-
+- if ok, err := rewriteFile(filepath.Join(goplsDir, "doc", "settings.md"), api, write, rewriteSettings); !ok || err != nil {
+- return ok, err
+- }
+- if ok, err := rewriteFile(filepath.Join(goplsDir, "doc", "commands.md"), api, write, rewriteCommands); !ok || err != nil {
+- return ok, err
+- }
+- if ok, err := rewriteFile(filepath.Join(goplsDir, "doc", "analyzers.md"), api, write, rewriteAnalyzers); !ok || err != nil {
+- return ok, err
+- }
+- if ok, err := rewriteFile(filepath.Join(goplsDir, "doc", "inlayHints.md"), api, write, rewriteInlayHints); !ok || err != nil {
+- return ok, err
+- }
+-
+- return true, nil
+-}
+-
+-// pkgDir returns the directory corresponding to the import path pkgPath.
+-func pkgDir(pkgPath string) (string, error) {
+- out, err := exec.Command("go", "list", "-f", "{{.Dir}}", pkgPath).Output()
+- if err != nil {
+- return "", err
+- }
+- return strings.TrimSpace(string(out)), nil
+-}
+-
+-func loadAPI() (*source.APIJSON, error) {
+- pkgs, err := packages.Load(
+- &packages.Config{
+- Mode: packages.NeedTypes | packages.NeedTypesInfo | packages.NeedSyntax | packages.NeedDeps,
+- },
+- "golang.org/x/tools/gopls/internal/lsp/source",
+- )
+- if err != nil {
+- return nil, err
+- }
+- pkg := pkgs[0]
+-
+- api := &source.APIJSON{
+- Options: map[string][]*source.OptionJSON{},
+- }
+- defaults := source.DefaultOptions()
+-
+- api.Commands, err = loadCommands(pkg)
+- if err != nil {
+- return nil, err
+- }
+- api.Lenses = loadLenses(api.Commands)
+-
+- // Transform the internal command name to the external command name.
+- for _, c := range api.Commands {
+- c.Command = command.ID(c.Command)
+- }
+- for _, m := range []map[string]*source.Analyzer{
+- defaults.DefaultAnalyzers,
+- defaults.TypeErrorAnalyzers,
+- defaults.ConvenienceAnalyzers,
+- // Don't yet add staticcheck analyzers.
+- } {
+- api.Analyzers = append(api.Analyzers, loadAnalyzers(m)...)
+- }
+- api.Hints = loadHints(source.AllInlayHints)
+- for _, category := range []reflect.Value{
+- reflect.ValueOf(defaults.UserOptions),
+- } {
+- // Find the type information and ast.File corresponding to the category.
+- optsType := pkg.Types.Scope().Lookup(category.Type().Name())
+- if optsType == nil {
+- return nil, fmt.Errorf("could not find %v in scope %v", category.Type().Name(), pkg.Types.Scope())
+- }
+- opts, err := loadOptions(category, optsType, pkg, "")
+- if err != nil {
+- return nil, err
+- }
+- catName := strings.TrimSuffix(category.Type().Name(), "Options")
+- api.Options[catName] = opts
+-
+- // Hardcode the expected values for the analyses and code lenses
+- // settings, since their keys are not enums.
+- for _, opt := range opts {
+- switch opt.Name {
+- case "analyses":
+- for _, a := range api.Analyzers {
+- opt.EnumKeys.Keys = append(opt.EnumKeys.Keys, source.EnumKey{
+- Name: fmt.Sprintf("%q", a.Name),
+- Doc: a.Doc,
+- Default: strconv.FormatBool(a.Default),
+- })
+- }
+- case "codelenses":
+- // Hack: Lenses don't set default values, and we don't want to
+- // pass in the list of expected lenses to loadOptions. Instead,
+- // format the defaults using reflection here. The hackiest part
+- // is reversing lowercasing of the field name.
+- reflectField := category.FieldByName(upperFirst(opt.Name))
+- for _, l := range api.Lenses {
+- def, err := formatDefaultFromEnumBoolMap(reflectField, l.Lens)
+- if err != nil {
+- return nil, err
+- }
+- opt.EnumKeys.Keys = append(opt.EnumKeys.Keys, source.EnumKey{
+- Name: fmt.Sprintf("%q", l.Lens),
+- Doc: l.Doc,
+- Default: def,
+- })
+- }
+- case "hints":
+- for _, a := range api.Hints {
+- opt.EnumKeys.Keys = append(opt.EnumKeys.Keys, source.EnumKey{
+- Name: fmt.Sprintf("%q", a.Name),
+- Doc: a.Doc,
+- Default: strconv.FormatBool(a.Default),
+- })
+- }
+- }
+- }
+- }
+- return api, nil
+-}
+-
+-func loadOptions(category reflect.Value, optsType types.Object, pkg *packages.Package, hierarchy string) ([]*source.OptionJSON, error) {
+- file, err := fileForPos(pkg, optsType.Pos())
+- if err != nil {
+- return nil, err
+- }
+-
+- enums, err := loadEnums(pkg)
+- if err != nil {
+- return nil, err
+- }
+-
+- var opts []*source.OptionJSON
+- optsStruct := optsType.Type().Underlying().(*types.Struct)
+- for i := 0; i < optsStruct.NumFields(); i++ {
+- // The types field gives us the type.
+- typesField := optsStruct.Field(i)
+-
+- // If the field name ends with "Options", assume it is a struct with
+- // additional options and process it recursively.
+- if h := strings.TrimSuffix(typesField.Name(), "Options"); h != typesField.Name() {
+- // Keep track of the parent structs.
+- if hierarchy != "" {
+- h = hierarchy + "." + h
+- }
+- options, err := loadOptions(category, typesField, pkg, strings.ToLower(h))
+- if err != nil {
+- return nil, err
+- }
+- opts = append(opts, options...)
+- continue
+- }
+- path, _ := astutil.PathEnclosingInterval(file, typesField.Pos(), typesField.Pos())
+- if len(path) < 2 {
+- return nil, fmt.Errorf("could not find AST node for field %v", typesField)
+- }
+- // The AST field gives us the doc.
+- astField, ok := path[1].(*ast.Field)
+- if !ok {
+- return nil, fmt.Errorf("unexpected AST path %v", path)
+- }
+-
+- // The reflect field gives us the default value.
+- reflectField := category.FieldByName(typesField.Name())
+- if !reflectField.IsValid() {
+- return nil, fmt.Errorf("could not find reflect field for %v", typesField.Name())
+- }
+-
+- def, err := formatDefault(reflectField)
+- if err != nil {
+- return nil, err
+- }
+-
+- typ := typesField.Type().String()
+- if _, ok := enums[typesField.Type()]; ok {
+- typ = "enum"
+- }
+- name := lowerFirst(typesField.Name())
+-
+- var enumKeys source.EnumKeys
+- if m, ok := typesField.Type().(*types.Map); ok {
+- e, ok := enums[m.Key()]
+- if ok {
+- typ = strings.Replace(typ, m.Key().String(), m.Key().Underlying().String(), 1)
+- }
+- keys, err := collectEnumKeys(name, m, reflectField, e)
+- if err != nil {
+- return nil, err
+- }
+- if keys != nil {
+- enumKeys = *keys
+- }
+- }
+-
+- // Get the status of the field by checking its struct tags.
+- reflectStructField, ok := category.Type().FieldByName(typesField.Name())
+- if !ok {
+- return nil, fmt.Errorf("no struct field for %s", typesField.Name())
+- }
+- status := reflectStructField.Tag.Get("status")
+-
+- opts = append(opts, &source.OptionJSON{
+- Name: name,
+- Type: typ,
+- Doc: lowerFirst(astField.Doc.Text()),
+- Default: def,
+- EnumKeys: enumKeys,
+- EnumValues: enums[typesField.Type()],
+- Status: status,
+- Hierarchy: hierarchy,
+- })
+- }
+- return opts, nil
+-}
+-
+-func loadEnums(pkg *packages.Package) (map[types.Type][]source.EnumValue, error) {
+- enums := map[types.Type][]source.EnumValue{}
+- for _, name := range pkg.Types.Scope().Names() {
+- obj := pkg.Types.Scope().Lookup(name)
+- cnst, ok := obj.(*types.Const)
+- if !ok {
+- continue
+- }
+- f, err := fileForPos(pkg, cnst.Pos())
+- if err != nil {
+- return nil, fmt.Errorf("finding file for %q: %v", cnst.Name(), err)
+- }
+- path, _ := astutil.PathEnclosingInterval(f, cnst.Pos(), cnst.Pos())
+- spec := path[1].(*ast.ValueSpec)
+- value := cnst.Val().ExactString()
+- doc := valueDoc(cnst.Name(), value, spec.Doc.Text())
+- v := source.EnumValue{
+- Value: value,
+- Doc: doc,
+- }
+- enums[obj.Type()] = append(enums[obj.Type()], v)
+- }
+- return enums, nil
+-}
+-
+-func collectEnumKeys(name string, m *types.Map, reflectField reflect.Value, enumValues []source.EnumValue) (*source.EnumKeys, error) {
+- // Make sure the value type gets set for analyses and codelenses
+- // too.
+- if len(enumValues) == 0 && !hardcodedEnumKeys(name) {
+- return nil, nil
+- }
+- keys := &source.EnumKeys{
+- ValueType: m.Elem().String(),
+- }
+- // We can get default values for enum -> bool maps.
+- var isEnumBoolMap bool
+- if basic, ok := m.Elem().(*types.Basic); ok && basic.Kind() == types.Bool {
+- isEnumBoolMap = true
+- }
+- for _, v := range enumValues {
+- var def string
+- if isEnumBoolMap {
+- var err error
+- def, err = formatDefaultFromEnumBoolMap(reflectField, v.Value)
+- if err != nil {
+- return nil, err
+- }
+- }
+- keys.Keys = append(keys.Keys, source.EnumKey{
+- Name: v.Value,
+- Doc: v.Doc,
+- Default: def,
+- })
+- }
+- return keys, nil
+-}
+-
+-func formatDefaultFromEnumBoolMap(reflectMap reflect.Value, enumKey string) (string, error) {
+- if reflectMap.Kind() != reflect.Map {
+- return "", nil
+- }
+- name := enumKey
+- if unquoted, err := strconv.Unquote(name); err == nil {
+- name = unquoted
+- }
+- for _, e := range reflectMap.MapKeys() {
+- if e.String() == name {
+- value := reflectMap.MapIndex(e)
+- if value.Type().Kind() == reflect.Bool {
+- return formatDefault(value)
+- }
+- }
+- }
+- // Assume that if the value isn't mentioned in the map, it defaults to
+- // the default value, false.
+- return formatDefault(reflect.ValueOf(false))
+-}
+-
+-// formatDefault formats the default value into a JSON-like string.
+-// VS Code exposes settings as JSON, so showing them as JSON is reasonable.
+-// TODO(rstambler): Reconsider this approach, as the VS Code Go generator now
+-// marshals to JSON.
+-func formatDefault(reflectField reflect.Value) (string, error) {
+- def := reflectField.Interface()
+-
+- // Durations marshal as nanoseconds, but we want the stringy versions,
+- // e.g. "100ms".
+- if t, ok := def.(time.Duration); ok {
+- def = t.String()
+- }
+- defBytes, err := json.Marshal(def)
+- if err != nil {
+- return "", err
+- }
+-
+- // Nil values format as "null" so print them as hardcoded empty values.
+- switch reflectField.Type().Kind() {
+- case reflect.Map:
+- if reflectField.IsNil() {
+- defBytes = []byte("{}")
+- }
+- case reflect.Slice:
+- if reflectField.IsNil() {
+- defBytes = []byte("[]")
+- }
+- }
+- return string(defBytes), err
+-}
+-
+-// valueDoc transforms a docstring documenting an constant identifier to a
+-// docstring documenting its value.
+-//
+-// If doc is of the form "Foo is a bar", it returns '`"fooValue"` is a bar'. If
+-// doc is non-standard ("this value is a bar"), it returns '`"fooValue"`: this
+-// value is a bar'.
+-func valueDoc(name, value, doc string) string {
+- if doc == "" {
+- return ""
+- }
+- if strings.HasPrefix(doc, name) {
+- // docstring in standard form. Replace the subject with value.
+- return fmt.Sprintf("`%s`%s", value, doc[len(name):])
+- }
+- return fmt.Sprintf("`%s`: %s", value, doc)
+-}
+-
+-func loadCommands(pkg *packages.Package) ([]*source.CommandJSON, error) {
+- var commands []*source.CommandJSON
+-
+- _, cmds, err := commandmeta.Load()
+- if err != nil {
+- return nil, err
+- }
+- // Parse the objects it contains.
+- for _, cmd := range cmds {
+- cmdjson := &source.CommandJSON{
+- Command: cmd.Name,
+- Title: cmd.Title,
+- Doc: cmd.Doc,
+- ArgDoc: argsDoc(cmd.Args),
+- }
+- if cmd.Result != nil {
+- cmdjson.ResultDoc = typeDoc(cmd.Result, 0)
+- }
+- commands = append(commands, cmdjson)
+- }
+- return commands, nil
+-}
+-
+-func argsDoc(args []*commandmeta.Field) string {
+- var b strings.Builder
+- for i, arg := range args {
+- b.WriteString(typeDoc(arg, 0))
+- if i != len(args)-1 {
+- b.WriteString(",\n")
+- }
+- }
+- return b.String()
+-}
+-
+-func typeDoc(arg *commandmeta.Field, level int) string {
+- // Max level to expand struct fields.
+- const maxLevel = 3
+- if len(arg.Fields) > 0 {
+- if level < maxLevel {
+- return arg.FieldMod + structDoc(arg.Fields, level)
+- }
+- return "{ ... }"
+- }
+- under := arg.Type.Underlying()
+- switch u := under.(type) {
+- case *types.Slice:
+- return fmt.Sprintf("[]%s", u.Elem().Underlying().String())
+- }
+- return types.TypeString(under, nil)
+-}
+-
+-func structDoc(fields []*commandmeta.Field, level int) string {
+- var b strings.Builder
+- b.WriteString("{\n")
+- indent := strings.Repeat("\t", level)
+- for _, fld := range fields {
+- if fld.Doc != "" && level == 0 {
+- doclines := strings.Split(fld.Doc, "\n")
+- for _, line := range doclines {
+- fmt.Fprintf(&b, "%s\t// %s\n", indent, line)
+- }
+- }
+- tag := strings.Split(fld.JSONTag, ",")[0]
+- if tag == "" {
+- tag = fld.Name
+- }
+- fmt.Fprintf(&b, "%s\t%q: %s,\n", indent, tag, typeDoc(fld, level+1))
+- }
+- fmt.Fprintf(&b, "%s}", indent)
+- return b.String()
+-}
+-
+-func loadLenses(commands []*source.CommandJSON) []*source.LensJSON {
+- all := map[command.Command]struct{}{}
+- for k := range source.LensFuncs() {
+- all[k] = struct{}{}
+- }
+- for k := range mod.LensFuncs() {
+- if _, ok := all[k]; ok {
+- panic(fmt.Sprintf("duplicate lens %q", string(k)))
+- }
+- all[k] = struct{}{}
+- }
+-
+- var lenses []*source.LensJSON
+-
+- for _, cmd := range commands {
+- if _, ok := all[command.Command(cmd.Command)]; ok {
+- lenses = append(lenses, &source.LensJSON{
+- Lens: cmd.Command,
+- Title: cmd.Title,
+- Doc: cmd.Doc,
+- })
+- }
+- }
+- return lenses
+-}
+-
+-func loadAnalyzers(m map[string]*source.Analyzer) []*source.AnalyzerJSON {
+- var sorted []string
+- for _, a := range m {
+- sorted = append(sorted, a.Analyzer.Name)
+- }
+- sort.Strings(sorted)
+- var json []*source.AnalyzerJSON
+- for _, name := range sorted {
+- a := m[name]
+- json = append(json, &source.AnalyzerJSON{
+- Name: a.Analyzer.Name,
+- Doc: a.Analyzer.Doc,
+- Default: a.Enabled,
+- })
+- }
+- return json
+-}
+-
+-func loadHints(m map[string]*source.Hint) []*source.HintJSON {
+- var sorted []string
+- for _, h := range m {
+- sorted = append(sorted, h.Name)
+- }
+- sort.Strings(sorted)
+- var json []*source.HintJSON
+- for _, name := range sorted {
+- h := m[name]
+- json = append(json, &source.HintJSON{
+- Name: h.Name,
+- Doc: h.Doc,
+- })
+- }
+- return json
+-}
+-
+-func lowerFirst(x string) string {
+- if x == "" {
+- return x
+- }
+- return strings.ToLower(x[:1]) + x[1:]
+-}
+-
+-func upperFirst(x string) string {
+- if x == "" {
+- return x
+- }
+- return strings.ToUpper(x[:1]) + x[1:]
+-}
+-
+-func fileForPos(pkg *packages.Package, pos token.Pos) (*ast.File, error) {
+- fset := pkg.Fset
+- for _, f := range pkg.Syntax {
+- if safetoken.StartPosition(fset, f.Pos()).Filename == safetoken.StartPosition(fset, pos).Filename {
+- return f, nil
+- }
+- }
+- return nil, fmt.Errorf("no file for pos %v", pos)
+-}
+-
+-func rewriteFile(file string, api *source.APIJSON, write bool, rewrite func([]byte, *source.APIJSON) ([]byte, error)) (bool, error) {
+- old, err := ioutil.ReadFile(file)
+- if err != nil {
+- return false, err
+- }
+-
+- new, err := rewrite(old, api)
+- if err != nil {
+- return false, fmt.Errorf("rewriting %q: %v", file, err)
+- }
+-
+- if !write {
+- return bytes.Equal(old, new), nil
+- }
+-
+- if err := ioutil.WriteFile(file, new, 0); err != nil {
+- return false, err
+- }
+-
+- return true, nil
+-}
+-
+-func rewriteAPI(_ []byte, api *source.APIJSON) ([]byte, error) {
+- var buf bytes.Buffer
+- fmt.Fprintf(&buf, "// Code generated by \"golang.org/x/tools/gopls/doc/generate\"; DO NOT EDIT.\n\npackage source\n\nvar GeneratedAPIJSON = ")
+- if err := printsrc.NewPrinter("golang.org/x/tools/gopls/internal/lsp/source").Fprint(&buf, api); err != nil {
+- return nil, err
+- }
+- return format.Source(buf.Bytes())
+-}
+-
+-type optionsGroup struct {
+- title string
+- final string
+- level int
+- options []*source.OptionJSON
+-}
+-
+-func rewriteSettings(doc []byte, api *source.APIJSON) ([]byte, error) {
+- result := doc
+- for category, opts := range api.Options {
+- groups := collectGroups(opts)
+-
+- // First, print a table of contents.
+- section := bytes.NewBuffer(nil)
+- fmt.Fprintln(section, "")
+- for _, h := range groups {
+- writeBullet(section, h.final, h.level)
+- }
+- fmt.Fprintln(section, "")
+-
+- // Currently, the settings document has a title and a subtitle, so
+- // start at level 3 for a header beginning with "###".
+- baseLevel := 3
+- for _, h := range groups {
+- level := baseLevel + h.level
+- writeTitle(section, h.final, level)
+- for _, opt := range h.options {
+- header := strMultiply("#", level+1)
+- fmt.Fprintf(section, "%s ", header)
+- opt.Write(section)
+- }
+- }
+- var err error
+- result, err = replaceSection(result, category, section.Bytes())
+- if err != nil {
+- return nil, err
+- }
+- }
+-
+- section := bytes.NewBuffer(nil)
+- for _, lens := range api.Lenses {
+- fmt.Fprintf(section, "### **%v**\n\nIdentifier: `%v`\n\n%v\n", lens.Title, lens.Lens, lens.Doc)
+- }
+- return replaceSection(result, "Lenses", section.Bytes())
+-}
+-
+-func collectGroups(opts []*source.OptionJSON) []optionsGroup {
+- optsByHierarchy := map[string][]*source.OptionJSON{}
+- for _, opt := range opts {
+- optsByHierarchy[opt.Hierarchy] = append(optsByHierarchy[opt.Hierarchy], opt)
+- }
+-
+- // As a hack, assume that uncategorized items are less important to
+- // users and force the empty string to the end of the list.
+- var containsEmpty bool
+- var sorted []string
+- for h := range optsByHierarchy {
+- if h == "" {
+- containsEmpty = true
+- continue
+- }
+- sorted = append(sorted, h)
+- }
+- sort.Strings(sorted)
+- if containsEmpty {
+- sorted = append(sorted, "")
+- }
+- var groups []optionsGroup
+- baseLevel := 0
+- for _, h := range sorted {
+- split := strings.SplitAfter(h, ".")
+- last := split[len(split)-1]
+- // Hack to capitalize all of UI.
+- if last == "ui" {
+- last = "UI"
+- }
+- // A hierarchy may look like "ui.formatting". If "ui" has no
+- // options of its own, it may not be added to the map, but it
+- // still needs a heading.
+- components := strings.Split(h, ".")
+- for i := 1; i < len(components); i++ {
+- parent := strings.Join(components[0:i], ".")
+- if _, ok := optsByHierarchy[parent]; !ok {
+- groups = append(groups, optionsGroup{
+- title: parent,
+- final: last,
+- level: baseLevel + i,
+- })
+- }
+- }
+- groups = append(groups, optionsGroup{
+- title: h,
+- final: last,
+- level: baseLevel + strings.Count(h, "."),
+- options: optsByHierarchy[h],
+- })
+- }
+- return groups
+-}
+-
+-func hardcodedEnumKeys(name string) bool {
+- return name == "analyses" || name == "codelenses"
+-}
+-
+-func writeBullet(w io.Writer, title string, level int) {
+- if title == "" {
+- return
+- }
+- // Capitalize the first letter of each title.
+- prefix := strMultiply(" ", level)
+- fmt.Fprintf(w, "%s* [%s](#%s)\n", prefix, capitalize(title), strings.ToLower(title))
+-}
+-
+-func writeTitle(w io.Writer, title string, level int) {
+- if title == "" {
+- return
+- }
+- // Capitalize the first letter of each title.
+- fmt.Fprintf(w, "%s %s\n\n", strMultiply("#", level), capitalize(title))
+-}
+-
+-func capitalize(s string) string {
+- return string(unicode.ToUpper(rune(s[0]))) + s[1:]
+-}
+-
+-func strMultiply(str string, count int) string {
+- var result string
+- for i := 0; i < count; i++ {
+- result += string(str)
+- }
+- return result
+-}
+-
+-func rewriteCommands(doc []byte, api *source.APIJSON) ([]byte, error) {
+- section := bytes.NewBuffer(nil)
+- for _, command := range api.Commands {
+- command.Write(section)
+- }
+- return replaceSection(doc, "Commands", section.Bytes())
+-}
+-
+-func rewriteAnalyzers(doc []byte, api *source.APIJSON) ([]byte, error) {
+- section := bytes.NewBuffer(nil)
+- for _, analyzer := range api.Analyzers {
+- fmt.Fprintf(section, "## **%v**\n\n", analyzer.Name)
+- fmt.Fprintf(section, "%s\n\n", analyzer.Doc)
+- switch analyzer.Default {
+- case true:
+- fmt.Fprintf(section, "**Enabled by default.**\n\n")
+- case false:
+- fmt.Fprintf(section, "**Disabled by default. Enable it by setting `\"analyses\": {\"%s\": true}`.**\n\n", analyzer.Name)
+- }
+- }
+- return replaceSection(doc, "Analyzers", section.Bytes())
+-}
+-
+-func rewriteInlayHints(doc []byte, api *source.APIJSON) ([]byte, error) {
+- section := bytes.NewBuffer(nil)
+- for _, hint := range api.Hints {
+- fmt.Fprintf(section, "## **%v**\n\n", hint.Name)
+- fmt.Fprintf(section, "%s\n\n", hint.Doc)
+- switch hint.Default {
+- case true:
+- fmt.Fprintf(section, "**Enabled by default.**\n\n")
+- case false:
+- fmt.Fprintf(section, "**Disabled by default. Enable it by setting `\"hints\": {\"%s\": true}`.**\n\n", hint.Name)
+- }
+- }
+- return replaceSection(doc, "Hints", section.Bytes())
+-}
+-
+-func replaceSection(doc []byte, sectionName string, replacement []byte) ([]byte, error) {
+- re := regexp.MustCompile(fmt.Sprintf(`(?s)<!-- BEGIN %v.* -->\n(.*?)<!-- END %v.* -->`, sectionName, sectionName))
+- idx := re.FindSubmatchIndex(doc)
+- if idx == nil {
+- return nil, fmt.Errorf("could not find section %q", sectionName)
+- }
+- result := append([]byte(nil), doc[:idx[2]]...)
+- result = append(result, replacement...)
+- result = append(result, doc[idx[3]:]...)
+- return result, nil
+-}
+diff -urN a/gopls/doc/generate_test.go b/gopls/doc/generate_test.go
+--- a/gopls/doc/generate_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/generate_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,26 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package main
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-func TestGenerated(t *testing.T) {
+- // This test fails on 1.18 Kokoro for unknown reasons; in any case, it
+- // suffices to run this test on any builder.
+- testenv.NeedsGo1Point(t, 19)
+- testenv.NeedsGoBuild(t) // This is a lie. We actually need the source code.
+-
+- ok, err := doMain(false)
+- if err != nil {
+- t.Fatal(err)
+- }
+- if !ok {
+- t.Error("documentation needs updating. run: `go run doc/generate.go` from the gopls module.")
+- }
+-}
+diff -urN a/gopls/doc/inlayHints.md b/gopls/doc/inlayHints.md
+--- a/gopls/doc/inlayHints.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/inlayHints.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,80 +0,0 @@
+-# Hints
+-
+-This document describes the inlay hints that `gopls` uses inside the editor.
+-
+-<!-- BEGIN Hints: DO NOT MANUALLY EDIT THIS SECTION -->
+-## **assignVariableTypes**
+-
+-Enable/disable inlay hints for variable types in assign statements:
+-```go
+- i/* int*/, j/* int*/ := 0, len(r)-1
+-```
+-
+-**Disabled by default. Enable it by setting `"hints": {"assignVariableTypes": true}`.**
+-
+-## **compositeLiteralFields**
+-
+-Enable/disable inlay hints for composite literal field names:
+-```go
+- {/*in: */"Hello, world", /*want: */"dlrow ,olleH"}
+-```
+-
+-**Disabled by default. Enable it by setting `"hints": {"compositeLiteralFields": true}`.**
+-
+-## **compositeLiteralTypes**
+-
+-Enable/disable inlay hints for composite literal types:
+-```go
+- for _, c := range []struct {
+- in, want string
+- }{
+- /*struct{ in string; want string }*/{"Hello, world", "dlrow ,olleH"},
+- }
+-```
+-
+-**Disabled by default. Enable it by setting `"hints": {"compositeLiteralTypes": true}`.**
+-
+-## **constantValues**
+-
+-Enable/disable inlay hints for constant values:
+-```go
+- const (
+- KindNone Kind = iota/* = 0*/
+- KindPrint/* = 1*/
+- KindPrintf/* = 2*/
+- KindErrorf/* = 3*/
+- )
+-```
+-
+-**Disabled by default. Enable it by setting `"hints": {"constantValues": true}`.**
+-
+-## **functionTypeParameters**
+-
+-Enable/disable inlay hints for implicit type parameters on generic functions:
+-```go
+- myFoo/*[int, string]*/(1, "hello")
+-```
+-
+-**Disabled by default. Enable it by setting `"hints": {"functionTypeParameters": true}`.**
+-
+-## **parameterNames**
+-
+-Enable/disable inlay hints for parameter names:
+-```go
+- parseInt(/* str: */ "123", /* radix: */ 8)
+-```
+-
+-**Disabled by default. Enable it by setting `"hints": {"parameterNames": true}`.**
+-
+-## **rangeVariableTypes**
+-
+-Enable/disable inlay hints for variable types in range statements:
+-```go
+- for k/* int*/, v/* string*/ := range []string{} {
+- fmt.Println(k, v)
+- }
+-```
+-
+-**Disabled by default. Enable it by setting `"hints": {"rangeVariableTypes": true}`.**
+-
+-<!-- END Hints: DO NOT MANUALLY EDIT THIS SECTION -->
+diff -urN a/gopls/doc/releases.md b/gopls/doc/releases.md
+--- a/gopls/doc/releases.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/releases.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,25 +0,0 @@
+-# Gopls release policy
+-
+-Gopls releases follow [semver](http://semver.org), with major changes and new
+-features introduced only in new minor versions (i.e. versions of the form
+-`v*.N.0` for some N). Subsequent patch releases contain only cherry-picked
+-fixes or superficial updates.
+-
+-In order to align with the
+-[Go release timeline](https://github.com/golang/go/wiki/Go-Release-Cycle#timeline),
+-we aim to release a new minor version of Gopls approximately every three
+-months, with patch releases approximately every month, according to the
+-following table:
+-
+-| Month | Version(s) |
+-| ---- | ------- |
+-| Jan | `v*.<N+0>.0` |
+-| Jan-Mar | `v*.<N+0>.*` |
+-| Apr | `v*.<N+1>.0` |
+-| Apr-Jun | `v*.<N+1>.*` |
+-| Jul | `v*.<N+2>.0` |
+-| Jul-Sep | `v*.<N+2>.*` |
+-| Oct | `v*.<N+3>.0` |
+-| Oct-Dec | `v*.<N+3>.*` |
+-
+-For more background on this policy, see https://go.dev/issue/55267.
+diff -urN a/gopls/doc/semantictokens.md b/gopls/doc/semantictokens.md
+--- a/gopls/doc/semantictokens.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/semantictokens.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,121 +0,0 @@
+-# Semantic Tokens
+-
+-The [LSP](https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#textDocument_semanticTokens)
+-specifies semantic tokens as a way of telling clients about language-specific
+-properties of pieces of code in a file being edited.
+-
+-The client asks for a set of semantic tokens and modifiers. This note describe which ones
+-gopls will return, and under what circumstances. Gopls has no control over how the client
+-converts semantic tokens into colors (or some other visible indication). In vscode it
+-is possible to modify the color a theme uses by setting the `editor.semanticTokenColorCustomizations`
+-object. We provide a little [guidance](#Colors) later.
+-
+-There are 22 semantic tokens, with 10 possible modifiers. The protocol allows each semantic
+-token to be used with any of the 1024 subsets of possible modifiers, but most combinations
+-don't make intuitive sense (although `async documentation` has a certain appeal).
+-
+-The 22 semantic tokens are `namespace`, `type`, `class`, `enum`, `interface`,
+- `struct`, `typeParameter`, `parameter`, `variable`, `property`, `enumMember`,
+- `event`, `function`, `method`, `macro`, `keyword`, `modifier`, `comment`,
+- `string`, `number`, `regexp`, `operator`.
+-
+-The 10 modifiers are `declaration`, `definition`, `readonly`, `static`,
+- `deprecated`, `abstract`, `async`, `modification`, `documentation`, `defaultLibrary`.
+-
+-The authoritative lists are in the [specification](https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#semanticTokenTypes)
+-
+-For the implementation to work correctly the client and server have to agree on the ordering
+-of the tokens and of the modifiers. Gopls, therefore, will only send tokens and modifiers
+-that the client has asked for. This document says what gopls would send if the client
+-asked for everything. By default, vscode asks for everything.
+-
+-Gopls sends 11 token types for `.go` files and 1 for `.*tmpl` files.
+-Nothing is sent for any other kind of file.
+-This all could change. (When Go has generics, gopls will return `typeParameter`.)
+-
+-For `.*tmpl` files gopls sends `macro`, and no modifiers, for each `{{`...`}}` scope.
+-
+-## Semantic tokens for Go files
+-
+-There are two contrasting guiding principles that might be used to decide what to mark
+-with semantic tokens. All clients already do some kind of syntax marking. E.g., vscode
+-uses a TextMate grammar. The minimal principle would send semantic tokens only for those
+-language features that cannot be reliably found without parsing Go and looking at types.
+-The maximal principle would attempt to convey as much as possible about the Go code,
+-using all available parsing and type information.
+-
+-There is much to be said for returning minimal information, but the minimal principle is
+-not well-specified. Gopls has no way of knowing what the clients know about the Go program
+-being edited. Even in vscode the TextMate grammars can be more or less elaborate
+-and change over time. (Nonetheless, a minimal implementation would not return `keyword`,
+-`number`, `comment`, or `string`.)
+-
+-The maximal position isn't particularly well-specified either. To chose one example, a
+-format string might have formatting codes (`%[4]-3.6f`), escape sequences (`\U00010604`), and regular
+-characters. Should these all be distinguished? One could even imagine distinguishing
+-different runes by their Unicode language assignment, or some other Unicode property, such as
+-being [confusable](http://www.unicode.org/Public/security/10.0.0/confusables.txt).
+-
+-Gopls does not come close to either of these principles. Semantic tokens are returned for
+-identifiers, keywords, operators, comments, and literals. (Semantic tokens do not
+-cover the file. They are not returned for
+-white space or punctuation, and there is no semantic token for labels.)
+-The following describes more precisely what gopls
+-does, with a few notes on possible alternative choices.
+-The references to *object* refer to the
+-```types.Object``` returned by the type checker. The references to *nodes* refer to the
+-```ast.Node``` from the parser.
+-
+-1. __`keyword`__ All Go [keywords](https://golang.org/ref/spec#Keywords) are marked `keyword`.
+-1. __`namespace`__ All package names are marked `namespace`. In an import, if there is an
+-alias, it would be marked. Otherwise the last component of the import path is marked.
+-1. __`type`__ Objects of type ```types.TypeName``` are marked `type`.
+-If they are also ```types.Basic```
+-the modifier is `defaultLibrary`. (And in ```type B struct{C}```, ```B``` has modifier `definition`.)
+-1. __`parameter`__ The formal arguments in ```ast.FuncDecl``` and ```ast.FuncType``` nodes are marked `parameter`.
+-1. __`variable`__ Identifiers in the
+-scope of ```const``` are modified with `readonly`. ```nil``` is usually a `variable` modified with both
+-`readonly` and `defaultLibrary`. (```nil``` is a predefined identifier; the user can redefine it,
+-in which case it would just be a variable, or whatever.) Identifiers of type ```types.Variable``` are,
+-not surprisingly, marked `variable`. Identifiers being defined (node ```ast.GenDecl```) are modified
+-by `definition` and, if appropriate, `readonly`. Receivers (in method declarations) are
+-`variable`.
+-1. __`method`__ Methods are marked at their definition (```func (x foo) bar() {}```) or declaration
+-in an ```interface```. Methods are not marked where they are used.
+-In ```x.bar()```, ```x``` will be marked
+-either as a `namespace` if it is a package name, or as a `variable` if it is an interface value,
+-so distinguishing ```bar``` seemed superfluous.
+-1. __`function`__ Bultins (```types.Builtin```) are modified with `defaultLibrary`
+-(e.g., ```make```, ```len```, ```copy```). Identifiers whose
+-object is ```types.Func``` or whose node is ```ast.FuncDecl``` are `function`.
+-1. __`comment`__ Comments and struct tags. (Perhaps struct tags should be `property`?)
+-1. __`string`__ Strings. Could add modifiers for e.g., escapes or format codes.
+-1. __`number`__ Numbers. Should the ```i``` in ```23i``` be handled specially?
+-1. __`operator`__ Assignment operators, binary operators, ellipses (```...```), increment/decrement
+-operators, sends (```<-```), and unary operators.
+-
+-Gopls will send the modifier `deprecated` if it finds a comment
+-```// deprecated``` in the godoc.
+-
+-The unused tokens for Go code are `class`, `enum`, `interface`,
+- `struct`, `typeParameter`, `property`, `enumMember`,
+- `event`, `macro`, `modifier`,
+- `regexp`
+-
+-## Colors
+-
+-These comments are about vscode.
+-
+-The documentation has a [helpful](https://code.visualstudio.com/api/language-extensions/semantic-highlight-guide#custom-textmate-scope-mappings)
+-description of which semantic tokens correspond to scopes in TextMate grammars. Themes seem
+-to use the TextMate scopes to decide on colors.
+-
+-Some examples of color customizations are [here](https://medium.com/@danromans/how-to-customize-semantic-token-colorization-with-visual-studio-code-ac3eab96141b).
+-
+-## Note
+-
+-While a file is being edited it may temporarily contain either
+-parsing errors or type errors. In this case gopls cannot determine some (or maybe any)
+-of the semantic tokens. To avoid weird flickering it is the responsibility
+-of clients to maintain the semantic token information
+-in the unedited part of the file, and they do.
+\ No newline at end of file
+diff -urN a/gopls/doc/settings.md b/gopls/doc/settings.md
+--- a/gopls/doc/settings.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/settings.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,527 +0,0 @@
+-# Settings
+-
+-<!--TODO: Generate this file from the documentation in golang.org/x/tools/gopls/internal/lsp/source/options.go.-->
+-
+-This document describes the global settings for `gopls` inside the editor.
+-The settings block will be called `"gopls"` and contains a collection of
+-controls for `gopls` that the editor is not expected to understand or control.
+-These settings can also be configured differently per workspace folder.
+-
+-In VSCode, this would be a section in your `settings.json` file that might look
+-like this:
+-
+-```json5
+- "gopls": {
+- "ui.completion.usePlaceholders": true,
+- ...
+- },
+-```
+-
+-## Officially supported
+-
+-Below is the list of settings that are officially supported for `gopls`.
+-
+-Any settings that are experimental or for debugging purposes are marked as
+-such.
+-
+-To enable all experimental features, use **allExperiments: `true`**. You will
+-still be able to independently override specific experimental features.
+-
+-<!-- BEGIN User: DO NOT MANUALLY EDIT THIS SECTION -->
+-
+-* [Build](#build)
+-* [Formatting](#formatting)
+-* [UI](#ui)
+- * [Completion](#completion)
+- * [Diagnostic](#diagnostic)
+- * [Documentation](#documentation)
+- * [Inlayhint](#inlayhint)
+- * [Navigation](#navigation)
+-
+-### Build
+-
+-#### **buildFlags** *[]string*
+-
+-buildFlags is the set of flags passed on to the build system when invoked.
+-It is applied to queries like `go list`, which is used when discovering files.
+-The most common use is to set `-tags`.
+-
+-Default: `[]`.
+-
+-#### **env** *map[string]string*
+-
+-env adds environment variables to external commands run by `gopls`, most notably `go list`.
+-
+-Default: `{}`.
+-
+-#### **directoryFilters** *[]string*
+-
+-directoryFilters can be used to exclude unwanted directories from the
+-workspace. By default, all directories are included. Filters are an
+-operator, `+` to include and `-` to exclude, followed by a path prefix
+-relative to the workspace folder. They are evaluated in order, and
+-the last filter that applies to a path controls whether it is included.
+-The path prefix can be empty, so an initial `-` excludes everything.
+-
+-DirectoryFilters also supports the `**` operator to match 0 or more directories.
+-
+-Examples:
+-
+-Exclude node_modules at current depth: `-node_modules`
+-
+-Exclude node_modules at any depth: `-**/node_modules`
+-
+-Include only project_a: `-` (exclude everything), `+project_a`
+-
+-Include only project_a, but not node_modules inside it: `-`, `+project_a`, `-project_a/node_modules`
+-
+-Default: `["-**/node_modules"]`.
+-
+-#### **templateExtensions** *[]string*
+-
+-templateExtensions gives the extensions of file names that are treateed
+-as template files. (The extension
+-is the part of the file name after the final dot.)
+-
+-Default: `[]`.
+-
+-#### **memoryMode** *enum*
+-
+-**This setting is experimental and may be deleted.**
+-
+-memoryMode controls the tradeoff `gopls` makes between memory usage and
+-correctness.
+-
+-Values other than `Normal` are untested and may break in surprising ways.
+-
+-Must be one of:
+-
+-* `"DegradeClosed"`: In DegradeClosed mode, `gopls` will collect less information about
+-packages without open files. As a result, features like Find
+-References and Rename will miss results in such packages.
+-* `"Normal"`
+-
+-Default: `"Normal"`.
+-
+-#### **expandWorkspaceToModule** *bool*
+-
+-**This setting is experimental and may be deleted.**
+-
+-expandWorkspaceToModule instructs `gopls` to adjust the scope of the
+-workspace to find the best available module root. `gopls` first looks for
+-a go.mod file in any parent directory of the workspace folder, expanding
+-the scope to that directory if it exists. If no viable parent directory is
+-found, gopls will check if there is exactly one child directory containing
+-a go.mod file, narrowing the scope to that directory if it exists.
+-
+-Default: `true`.
+-
+-#### **allowModfileModifications** *bool*
+-
+-**This setting is experimental and may be deleted.**
+-
+-allowModfileModifications disables -mod=readonly, allowing imports from
+-out-of-scope modules. This option will eventually be removed.
+-
+-Default: `false`.
+-
+-#### **allowImplicitNetworkAccess** *bool*
+-
+-**This setting is experimental and may be deleted.**
+-
+-allowImplicitNetworkAccess disables GOPROXY=off, allowing implicit module
+-downloads rather than requiring user action. This option will eventually
+-be removed.
+-
+-Default: `false`.
+-
+-#### **standaloneTags** *[]string*
+-
+-standaloneTags specifies a set of build constraints that identify
+-individual Go source files that make up the entire main package of an
+-executable.
+-
+-A common example of standalone main files is the convention of using the
+-directive `//go:build ignore` to denote files that are not intended to be
+-included in any package, for example because they are invoked directly by
+-the developer using `go run`.
+-
+-Gopls considers a file to be a standalone main file if and only if it has
+-package name "main" and has a build directive of the exact form
+-"//go:build tag" or "// +build tag", where tag is among the list of tags
+-configured by this setting. Notably, if the build constraint is more
+-complicated than a simple tag (such as the composite constraint
+-`//go:build tag && go1.18`), the file is not considered to be a standalone
+-main file.
+-
+-This setting is only supported when gopls is built with Go 1.16 or later.
+-
+-Default: `["ignore"]`.
+-
+-### Formatting
+-
+-#### **local** *string*
+-
+-local is the equivalent of the `goimports -local` flag, which puts
+-imports beginning with this string after third-party packages. It should
+-be the prefix of the import path whose imports should be grouped
+-separately.
+-
+-Default: `""`.
+-
+-#### **gofumpt** *bool*
+-
+-gofumpt indicates if we should run gofumpt formatting.
+-
+-Default: `false`.
+-
+-### UI
+-
+-#### **codelenses** *map[string]bool*
+-
+-codelenses overrides the enabled/disabled state of code lenses. See the
+-"Code Lenses" section of the
+-[Settings page](https://github.com/golang/tools/blob/master/gopls/doc/settings.md#code-lenses)
+-for the list of supported lenses.
+-
+-Example Usage:
+-
+-```json5
+-"gopls": {
+-...
+- "codelenses": {
+- "generate": false, // Don't show the `go generate` lens.
+- "gc_details": true // Show a code lens toggling the display of gc's choices.
+- }
+-...
+-}
+-```
+-
+-Default: `{"gc_details":false,"generate":true,"regenerate_cgo":true,"tidy":true,"upgrade_dependency":true,"vendor":true}`.
+-
+-#### **semanticTokens** *bool*
+-
+-**This setting is experimental and may be deleted.**
+-
+-semanticTokens controls whether the LSP server will send
+-semantic tokens to the client.
+-
+-Default: `false`.
+-
+-#### **noSemanticString** *bool*
+-
+-**This setting is experimental and may be deleted.**
+-
+-noSemanticString turns off the sending of the semantic token 'string'
+-
+-Default: `false`.
+-
+-#### **noSemanticNumber** *bool*
+-
+-**This setting is experimental and may be deleted.**
+-
+-noSemanticNumber turns off the sending of the semantic token 'number'
+-
+-Default: `false`.
+-
+-#### Completion
+-
+-##### **usePlaceholders** *bool*
+-
+-placeholders enables placeholders for function parameters or struct
+-fields in completion responses.
+-
+-Default: `false`.
+-
+-##### **completionBudget** *time.Duration*
+-
+-**This setting is for debugging purposes only.**
+-
+-completionBudget is the soft latency goal for completion requests. Most
+-requests finish in a couple milliseconds, but in some cases deep
+-completions can take much longer. As we use up our budget we
+-dynamically reduce the search scope to ensure we return timely
+-results. Zero means unlimited.
+-
+-Default: `"100ms"`.
+-
+-##### **matcher** *enum*
+-
+-**This is an advanced setting and should not be configured by most `gopls` users.**
+-
+-matcher sets the algorithm that is used when calculating completion
+-candidates.
+-
+-Must be one of:
+-
+-* `"CaseInsensitive"`
+-* `"CaseSensitive"`
+-* `"Fuzzy"`
+-
+-Default: `"Fuzzy"`.
+-
+-##### **experimentalPostfixCompletions** *bool*
+-
+-**This setting is experimental and may be deleted.**
+-
+-experimentalPostfixCompletions enables artificial method snippets
+-such as "someSlice.sort!".
+-
+-Default: `true`.
+-
+-#### Diagnostic
+-
+-##### **analyses** *map[string]bool*
+-
+-analyses specify analyses that the user would like to enable or disable.
+-A map of the names of analysis passes that should be enabled/disabled.
+-A full list of analyzers that gopls uses can be found in
+-[analyzers.md](https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md).
+-
+-Example Usage:
+-
+-```json5
+-...
+-"analyses": {
+- "unreachable": false, // Disable the unreachable analyzer.
+- "unusedparams": true // Enable the unusedparams analyzer.
+-}
+-...
+-```
+-
+-Default: `{}`.
+-
+-##### **staticcheck** *bool*
+-
+-**This setting is experimental and may be deleted.**
+-
+-staticcheck enables additional analyses from staticcheck.io.
+-These analyses are documented on
+-[Staticcheck's website](https://staticcheck.io/docs/checks/).
+-
+-Default: `false`.
+-
+-##### **annotations** *map[string]bool*
+-
+-**This setting is experimental and may be deleted.**
+-
+-annotations specifies the various kinds of optimization diagnostics
+-that should be reported by the gc_details command.
+-
+-Can contain any of:
+-
+-* `"bounds"` controls bounds checking diagnostics.
+-* `"escape"` controls diagnostics about escape choices.
+-* `"inline"` controls diagnostics about inlining choices.
+-* `"nil"` controls nil checks.
+-
+-Default: `{"bounds":true,"escape":true,"inline":true,"nil":true}`.
+-
+-##### **vulncheck** *enum*
+-
+-**This setting is experimental and may be deleted.**
+-
+-vulncheck enables vulnerability scanning.
+-
+-Must be one of:
+-
+-* `"Imports"`: In Imports mode, `gopls` will report vulnerabilities that affect packages
+-directly and indirectly used by the analyzed main module.
+-* `"Off"`: Disable vulnerability analysis.
+-
+-Default: `"Off"`.
+-
+-##### **diagnosticsDelay** *time.Duration*
+-
+-**This is an advanced setting and should not be configured by most `gopls` users.**
+-
+-diagnosticsDelay controls the amount of time that gopls waits
+-after the most recent file modification before computing deep diagnostics.
+-Simple diagnostics (parsing and type-checking) are always run immediately
+-on recently modified packages.
+-
+-This option must be set to a valid duration string, for example `"250ms"`.
+-
+-Default: `"250ms"`.
+-
+-#### Documentation
+-
+-##### **hoverKind** *enum*
+-
+-hoverKind controls the information that appears in the hover text.
+-SingleLine and Structured are intended for use only by authors of editor plugins.
+-
+-Must be one of:
+-
+-* `"FullDocumentation"`
+-* `"NoDocumentation"`
+-* `"SingleLine"`
+-* `"Structured"` is an experimental setting that returns a structured hover format.
+-This format separates the signature from the documentation, so that the client
+-can do more manipulation of these fields.\
+-This should only be used by clients that support this behavior.
+-* `"SynopsisDocumentation"`
+-
+-Default: `"FullDocumentation"`.
+-
+-##### **linkTarget** *string*
+-
+-linkTarget controls where documentation links go.
+-It might be one of:
+-
+-* `"godoc.org"`
+-* `"pkg.go.dev"`
+-
+-If company chooses to use its own `godoc.org`, its address can be used as well.
+-
+-Modules matching the GOPRIVATE environment variable will not have
+-documentation links in hover.
+-
+-Default: `"pkg.go.dev"`.
+-
+-##### **linksInHover** *bool*
+-
+-linksInHover toggles the presence of links to documentation in hover.
+-
+-Default: `true`.
+-
+-#### Inlayhint
+-
+-##### **hints** *map[string]bool*
+-
+-**This setting is experimental and may be deleted.**
+-
+-hints specify inlay hints that users want to see. A full list of hints
+-that gopls uses can be found in
+-[inlayHints.md](https://github.com/golang/tools/blob/master/gopls/doc/inlayHints.md).
+-
+-Default: `{}`.
+-
+-#### Navigation
+-
+-##### **importShortcut** *enum*
+-
+-importShortcut specifies whether import statements should link to
+-documentation or go to definitions.
+-
+-Must be one of:
+-
+-* `"Both"`
+-* `"Definition"`
+-* `"Link"`
+-
+-Default: `"Both"`.
+-
+-##### **symbolMatcher** *enum*
+-
+-**This is an advanced setting and should not be configured by most `gopls` users.**
+-
+-symbolMatcher sets the algorithm that is used when finding workspace symbols.
+-
+-Must be one of:
+-
+-* `"CaseInsensitive"`
+-* `"CaseSensitive"`
+-* `"FastFuzzy"`
+-* `"Fuzzy"`
+-
+-Default: `"FastFuzzy"`.
+-
+-##### **symbolStyle** *enum*
+-
+-**This is an advanced setting and should not be configured by most `gopls` users.**
+-
+-symbolStyle controls how symbols are qualified in symbol responses.
+-
+-Example Usage:
+-
+-```json5
+-"gopls": {
+-...
+- "symbolStyle": "Dynamic",
+-...
+-}
+-```
+-
+-Must be one of:
+-
+-* `"Dynamic"` uses whichever qualifier results in the highest scoring
+-match for the given symbol query. Here a "qualifier" is any "/" or "."
+-delimited suffix of the fully qualified symbol. i.e. "to/pkg.Foo.Field" or
+-just "Foo.Field".
+-* `"Full"` is fully qualified symbols, i.e.
+-"path/to/pkg.Foo.Field".
+-* `"Package"` is package qualified symbols i.e.
+-"pkg.Foo.Field".
+-
+-Default: `"Dynamic"`.
+-
+-#### **verboseOutput** *bool*
+-
+-**This setting is for debugging purposes only.**
+-
+-verboseOutput enables additional debug logging.
+-
+-Default: `false`.
+-
+-<!-- END User: DO NOT MANUALLY EDIT THIS SECTION -->
+-
+-#### **newDiff** *string*
+-
+-newDiff enables the new diff implementation. If this is "both", for now both
+-diffs will be run and statistics will be generated in a file in $TMPDIR. This
+-is a risky setting; help in trying it is appreciated. If it is "old" the old
+-implementation is used, and if it is "new", just the new implementation is
+-used. This setting will eventually be deleted, once gopls has fully migrated to
+-the new diff algorithm.
+-
+-Default: 'both'.
+-
+-## Code Lenses
+-
+-These are the code lenses that `gopls` currently supports. They can be enabled
+-and disabled using the `codelenses` setting, documented above. Their names and
+-features are subject to change.
+-
+-<!-- BEGIN Lenses: DO NOT MANUALLY EDIT THIS SECTION -->
+-### **Toggle gc_details**
+-
+-Identifier: `gc_details`
+-
+-Toggle the calculation of gc annotations.
+-### **Run go generate**
+-
+-Identifier: `generate`
+-
+-Runs `go generate` for a given directory.
+-### **Regenerate cgo**
+-
+-Identifier: `regenerate_cgo`
+-
+-Regenerates cgo definitions.
+-### **Run govulncheck.**
+-
+-Identifier: `run_govulncheck`
+-
+-Run vulnerability check (`govulncheck`).
+-### **Run test(s) (legacy)**
+-
+-Identifier: `test`
+-
+-Runs `go test` for a specific set of test or benchmark functions.
+-### **Run go mod tidy**
+-
+-Identifier: `tidy`
+-
+-Runs `go mod tidy` for a module.
+-### **Upgrade a dependency**
+-
+-Identifier: `upgrade_dependency`
+-
+-Upgrades a dependency in the go.mod file for a module.
+-### **Run go mod vendor**
+-
+-Identifier: `vendor`
+-
+-Runs `go mod vendor` for a module.
+-<!-- END Lenses: DO NOT MANUALLY EDIT THIS SECTION -->
+diff -urN a/gopls/doc/subl.md b/gopls/doc/subl.md
+--- a/gopls/doc/subl.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/subl.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,81 +0,0 @@
+-# Sublime Text
+-
+-Use the [LSP] package. After installing it using Package Control, do the following:
+-
+-* Open the **Command Palette**
+-* Find and run the command **LSP: Enable Language Server Globally**
+-* Select the **gopls** item. Be careful not to select the similarly named *golsp* by mistake.
+-
+-Finally, you should familiarise yourself with the LSP package's *Settings* and *Key Bindings*. Find them under the menu item **Preferences > Package Settings > LSP**.
+-
+-## Examples
+-Minimal global LSP settings, that assume **gopls** and **go** appear on the PATH seen by Sublime Text:<br>
+-```
+-{
+- "clients": {
+- "gopls": {
+- "enabled": true,
+- }
+- }
+-}
+-```
+-
+-Global LSP settings that supply a specific PATH for finding **gopls** and **go**, as well as some settings for Sublime LSP itself:
+-```
+-{
+- "clients": {
+- "gopls": {
+- "enabled": true,
+- "env": {
+- "PATH": "/path/to/your/go/bin",
+- }
+- }
+- },
+- // Recommended by https://agniva.me/gopls/2021/01/02/setting-up-gopls-sublime.html
+- // except log_stderr mentioned there is no longer recognized.
+- "show_references_in_quick_panel": true,
+- "log_debug": true,
+- // These two are recommended by LSP-json as replacement for deprecated only_show_lsp_completions
+- "inhibit_snippet_completions": true,
+- "inhibit_word_completions": true,
+- }
+- ```
+-
+-LSP and gopls settings can also be adjusted on a per-project basis to override global settings.
+-```
+-{
+- "folders": [
+- {
+- "path": "/path/to/a/folder/one"
+- },
+- {
+- // If you happen to be working on Go itself, this can be helpful; go-dev/bin should be on PATH.
+- "path": "/path/to/your/go-dev/src/cmd"
+- }
+- ],
+- "settings": {
+- "LSP": {
+- "gopls": {
+- // To use a specific version of gopls with Sublime Text LSP (e.g., to try new features in development)
+- "command": [
+- "/path/to/your/go/bin/gopls"
+- ],
+- "env": {
+- "PATH": "/path/to/your/go-dev/bin:/path/to/your/go/bin",
+- "GOPATH": "",
+- },
+- "settings": {
+- "experimentalWorkspaceModule": true
+- }
+- }
+- },
+- // This will apply for all languages in this project that have
+- // LSP servers, not just Go, however cannot enable just for Go.
+- "lsp_format_on_save": true,
+- }
+-}
+-```
+-
+-Usually changes to these settings are recognized after saving the project file, but it may sometimes be necessary to either restart the server(s) (**Tools > LSP > Restart Servers**) or quit and restart Sublime Text itself.
+-
+-[LSP]: https://packagecontrol.io/packages/LSP
+diff -urN a/gopls/doc/troubleshooting.md b/gopls/doc/troubleshooting.md
+--- a/gopls/doc/troubleshooting.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/troubleshooting.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,48 +0,0 @@
+-# Troubleshooting
+-
+-If you suspect that `gopls` is crashing or not working correctly, please follow the troubleshooting steps below.
+-
+-If `gopls` is using too much memory, please follow the steps under [Memory usage](#debug-memory-usage).
+-
+-## Steps
+-
+-VS Code users should follow [their troubleshooting guide](https://github.com/golang/vscode-go/blob/master/docs/troubleshooting.md), which has more a more specific version of these instructions.
+-
+-1. Verify that your project is in good shape by working with it outside of your editor. Running a command like `go build ./...` in the workspace directory will compile everything. For modules, `go mod tidy` is another good check, though it may modify your `go.mod`.
+-1. Check that your editor isn't showing any diagnostics that indicate a problem with your workspace. They may appear as diagnostics on a Go file's package declaration, diagnostics in a go.mod file, or as a status or progress message. Problems in the workspace configuration can cause many different symptoms. See the [workspace setup instructions](workspace.md) for help.
+-1. Make sure `gopls` is up to date by following the [installation instructions](../README.md#installation), then [restarting gopls](#restart-gopls).
+-1. Optionally, [ask for help](#ask-for-help) on Gophers Slack.
+-1. Finally, [report the issue](#file-an-issue) to the `gopls` developers.
+-
+-## Restart `gopls`
+-
+-`gopls` has no persistent state, so restarting it will fix transient problems. This is good and bad: good, because you can keep working, and bad, because you won't be able to debug the issue until it recurs.
+-
+-In most cases, closing all your open editors will guarantee that `gopls` is killed and restarted. If you don't want to do that, there may be an editor command you can use to restart only `gopls`. Note that some `vim` configurations keep the server alive for a while after the editor exits; you may need to explicitly kill `gopls` if you use `vim`.
+-
+-## Ask for help
+-
+-Gophers Slack has active editor-specific channels like [#emacs](https://gophers.slack.com/archives/C0HKHULEM), [#vim](https://gophers.slack.com/archives/C07GBR52P), and [#vscode](https://gophers.slack.com/archives/C2B4L99RS) that can help debug further. If you're confident the problem is with `gopls`, you can go straight to [#gopls](https://gophers.slack.com/archives/CJZH85XCZ). Invites are [available to everyone](https://invite.slack.golangbridge.org). Come prepared with a short description of the issue, and try to be available to answer questions for a while afterward.
+-
+-## File an issue
+-
+-We can't diagnose a problem from just a description. When filing an issue, please include as much as possible of the following information:
+-
+-1. Your editor and any settings you have configured (for example, your VSCode `settings.json` file).
+-1. A sample program that reproduces the issue, if possible.
+-1. The output of `gopls version` on the command line.
+-1. A complete gopls log file from a session where the issue occurred. It should have a `go env for <workspace folder>` log line near the beginning. It's also helpful to tell us the timestamp the problem occurred, so we can find it the log. See the [instructions](#capture-logs) for information on how to capture gopls logs.
+-
+-Your editor may have a command that fills out some of the necessary information, such as `:GoReportGitHubIssue` in `vim-go`. Otherwise, you can use `gopls bug` on the command line. If neither of those work you can start from scratch directly on the [Go issue tracker](https://github.com/golang/go/issues/new?title=x%2Ftools%2Fgopls%3A%20%3Cfill%20this%20in%3E).
+-
+-## Capture logs
+-
+-You may have to change your editor's configuration to pass a `-logfile` flag to gopls.
+-
+-To increase the level of detail in your logs, start `gopls` with the `-rpc.trace` flag. To start a debug server that will allow you to see profiles and memory usage, start `gopls` with `serve --debug=localhost:6060`. You will then be able to view debug information by navigating to `localhost:6060`.
+-
+-If you are unsure of how to pass a flag to `gopls` through your editor, please see the [documentation for your editor](../README.md#editors).
+-
+-## Debug memory usage
+-
+-`gopls` automatically writes out memory debug information when your usage exceeds 1GB. This information can be found in your temporary directory with names like `gopls.1234-5GiB-withnames.zip`. On Windows, your temporary directory will be located at `%TMP%`, and on Unixes, it will be `$TMPDIR`, which is usually `/tmp`. Please [file an issue](#file-an-issue) with this memory debug information attached. If you are uncomfortable sharing the package names of your code, you can share the `-nonames` zip instead, but it's much less useful.
+diff -urN a/gopls/doc/vim.md b/gopls/doc/vim.md
+--- a/gopls/doc/vim.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/vim.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,216 +0,0 @@
+-# Vim / Neovim
+-
+-* [vim-go](#vimgo)
+-* [LanguageClient-neovim](#lcneovim)
+-* [Ale](#ale)
+-* [vim-lsp](#vimlsp)
+-* [vim-lsc](#vimlsc)
+-* [coc.nvim](#cocnvim)
+-* [govim](#govim)
+-* [Neovim v0.5.0+](#neovim)
+- * [Installation](#neovim-install)
+- * [Custom Configuration](#neovim-config)
+- * [Imports](#neovim-imports)
+- * [Omnifunc](#neovim-omnifunc)
+- * [Additional Links](#neovim-links)
+-
+-## <a href="#vimgo" id="vimgo">vim-go</a>
+-
+-Use [vim-go] ver 1.20+, with the following configuration:
+-
+-```vim
+-let g:go_def_mode='gopls'
+-let g:go_info_mode='gopls'
+-```
+-
+-## <a href="#lcneovim" id="lcneovim">LanguageClient-neovim</a>
+-
+-Use [LanguageClient-neovim], with the following configuration:
+-
+-```vim
+-" Launch gopls when Go files are in use
+-let g:LanguageClient_serverCommands = {
+- \ 'go': ['gopls']
+- \ }
+-" Run gofmt on save
+-autocmd BufWritePre *.go :call LanguageClient#textDocument_formatting_sync()
+-```
+-
+-## <a href="#ale" id="ale">Ale</a>
+-
+-Use [ale]:
+-
+-```vim
+-let g:ale_linters = {
+- \ 'go': ['gopls'],
+- \}
+-```
+-
+-see [this issue][ale-issue-2179]
+-
+-## <a href="#vimlsp" id="vimlsp">vim-lsp</a>
+-
+-Use [prabirshrestha/vim-lsp], with the following configuration:
+-
+-```vim
+-augroup LspGo
+- au!
+- autocmd User lsp_setup call lsp#register_server({
+- \ 'name': 'go-lang',
+- \ 'cmd': {server_info->['gopls']},
+- \ 'whitelist': ['go'],
+- \ })
+- autocmd FileType go setlocal omnifunc=lsp#complete
+- "autocmd FileType go nmap <buffer> gd <plug>(lsp-definition)
+- "autocmd FileType go nmap <buffer> ,n <plug>(lsp-next-error)
+- "autocmd FileType go nmap <buffer> ,p <plug>(lsp-previous-error)
+-augroup END
+-```
+-
+-## <a href="#vimlsc" id="vimlsc">vim-lsc</a>
+-
+-Use [natebosch/vim-lsc], with the following configuration:
+-
+-```vim
+-let g:lsc_server_commands = {
+-\ "go": {
+-\ "command": "gopls serve",
+-\ "log_level": -1,
+-\ "suppress_stderr": v:true,
+-\ },
+-\}
+-```
+-
+-The `log_level` and `suppress_stderr` parts are needed to prevent breakage from logging. See
+-issues [#180](https://github.com/natebosch/vim-lsc/issues/180) and
+-[#213](https://github.com/natebosch/vim-lsc/issues/213).
+-
+-## <a href="#cocnvim" id="cocnvim">coc.nvim</a>
+-
+-Use [coc.nvim], with the following `coc-settings.json` configuration:
+-
+-```json
+- "languageserver": {
+- "golang": {
+- "command": "gopls",
+- "rootPatterns": ["go.work", "go.mod", ".vim/", ".git/", ".hg/"],
+- "filetypes": ["go"],
+- "initializationOptions": {
+- "usePlaceholders": true
+- }
+- }
+- }
+-```
+-
+-If you use `go.work` files, you may want to set the
+-`workspace.workspaceFolderCheckCwd` option. This will force coc.nvim to search
+-parent directories for `go.work` files, even if the current open directory has
+-a `go.mod` file. See the
+-[coc.nvim documentation](https://github.com/neoclide/coc.nvim/wiki/Using-workspaceFolders)
+-for more details.
+-
+-Other [settings](settings.md) can be added in `initializationOptions` too.
+-
+-The `editor.action.organizeImport` code action will auto-format code and add missing imports. To run this automatically on save, add the following line to your `init.vim`:
+-
+-```vim
+-autocmd BufWritePre *.go :call CocAction('runCommand', 'editor.action.organizeImport')
+-```
+-
+-## <a href="#govim" id="govim">govim</a>
+-
+-In vim classic only, use the experimental [`govim`], simply follow the [install steps][govim-install].
+-
+-## <a href="#neovim" id="neovim">Neovim v0.5.0+</a>
+-
+-To use the new native LSP client in Neovim, make sure you
+-[install][nvim-install] Neovim v.0.5.0+,
+-the `nvim-lspconfig` configuration helper plugin, and check the
+-[`gopls` configuration section][nvim-lspconfig] there.
+-
+-### <a href="#neovim-install" id="neovim-install">Installation</a>
+-
+-You can use Neovim's native plugin system. On a Unix system, you can do that by
+-cloning the `nvim-lspconfig` repository into the correct directory:
+-
+-```sh
+-dir="${HOME}/.local/share/nvim/site/pack/nvim-lspconfig/opt/nvim-lspconfig/"
+-mkdir -p "$dir"
+-cd "$dir"
+-git clone 'https://github.com/neovim/nvim-lspconfig.git' .
+-```
+-
+-### <a href="#neovim-config" id="neovim-config">Custom Configuration</a>
+-
+-You can add custom configuration using Lua. Here is an example of enabling the
+-`unusedparams` check as well as `staticcheck`:
+-
+-```vim
+-lua <<EOF
+- lspconfig = require "lspconfig"
+- util = require "lspconfig/util"
+-
+- lspconfig.gopls.setup {
+- cmd = {"gopls", "serve"},
+- filetypes = {"go", "gomod"},
+- root_dir = util.root_pattern("go.work", "go.mod", ".git"),
+- settings = {
+- gopls = {
+- analyses = {
+- unusedparams = true,
+- },
+- staticcheck = true,
+- },
+- },
+- }
+-EOF
+-```
+-
+-### <a href="#neovim-imports" id="neovim-imports">Imports</a>
+-
+-Use the following configuration to have your imports organized on save using
+-the logic of `goimports`. Note: this requires Neovim v0.7.0 or later.
+-
+-```lua
+-vim.api.nvim_create_autocmd('BufWritePre', {
+- pattern = '*.go',
+- callback = function()
+- vim.lsp.buf.code_action({ context = { only = { 'source.organizeImports' } }, apply = true })
+- end
+-})
+-```
+-
+-### <a href="#neovim-omnifunc" id="neovim-omnifunc">Omnifunc</a>
+-
+-In Neovim v0.8.1 and later if you don't set the option `omnifunc`, it will auto
+-set to `v:lua.vim.lsp.omnifunc`. If you are using an earlier version, you can
+-configure it manually:
+-
+-```lua
+-local on_attach = function(client, bufnr)
+- -- Enable completion triggered by <c-x><c-o>
+- vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
+-end
+-require('lspconfig').gopls.setup({
+- on_attach = on_attach
+-})
+-```
+-
+-### <a href="#neovim-links" id="neovim-links">Additional Links</a>
+-
+-* [Neovim's official LSP documentation][nvim-docs].
+-
+-[vim-go]: https://github.com/fatih/vim-go
+-[LanguageClient-neovim]: https://github.com/autozimu/LanguageClient-neovim
+-[ale]: https://github.com/w0rp/ale
+-[ale-issue-2179]: https://github.com/w0rp/ale/issues/2179
+-[prabirshrestha/vim-lsp]: https://github.com/prabirshrestha/vim-lsp/
+-[natebosch/vim-lsc]: https://github.com/natebosch/vim-lsc/
+-[natebosch/vim-lsc#180]: https://github.com/natebosch/vim-lsc/issues/180
+-[coc.nvim]: https://github.com/neoclide/coc.nvim/
+-[`govim`]: https://github.com/myitcv/govim
+-[govim-install]: https://github.com/myitcv/govim/blob/master/README.md#govim---go-development-plugin-for-vim8
+-[nvim-docs]: https://neovim.io/doc/user/lsp.html
+-[nvim-install]: https://github.com/neovim/neovim/wiki/Installing-Neovim
+-[nvim-lspconfig]: https://github.com/neovim/nvim-lspconfig/blob/master/doc/server_configurations.md#gopls
+-[nvim-lspconfig-imports]: https://github.com/neovim/nvim-lspconfig/issues/115
+diff -urN a/gopls/doc/workspace.md b/gopls/doc/workspace.md
+--- a/gopls/doc/workspace.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/doc/workspace.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,101 +0,0 @@
+-# Setting up your workspace
+-
+-`gopls` supports both Go module and GOPATH modes. However, it needs a defined
+-scope in which language features like references, rename, and implementation
+-should operate.
+-
+-The following options are available for configuring this scope:
+-
+-## Module mode
+-
+-### One module
+-
+-If you are working with a single module, you can open the module root (the
+-directory containing the `go.mod` file), a subdirectory within the module,
+-or a parent directory containing the module.
+-
+-**Note**: If you open a parent directory containing a module, it must **only**
+-contain that single module. Otherwise, you are working with multiple modules.
+-
+-### Multiple modules
+-
+-Gopls has several alternatives for working on multiple modules simultaneously,
+-described below. Starting with Go 1.18, Go workspaces are the preferred solution.
+-
+-#### Go workspaces (Go 1.18+)
+-
+-Starting with Go 1.18, the `go` command has native support for multi-module
+-workspaces, via [`go.work`](https://go.dev/ref/mod#workspaces) files. These
+-files are recognized by gopls starting with `gopls@v0.8.0`.
+-
+-The easiest way to work on multiple modules in Go 1.18 and later is therefore
+-to create a `go.work` file containing the modules you wish to work on, and set
+-your workspace root to the directory containing the `go.work` file.
+-
+-For example, suppose this repo is checked out into the `$WORK/tools` directory.
+-We can work on both `golang.org/x/tools` and `golang.org/x/tools/gopls`
+-simultaneously by creating a `go.work` file using `go work init`, followed by
+-`go work use MODULE_DIRECTORIES...` to add directories containing `go.mod` files to the
+-workspace:
+-
+-```sh
+-cd $WORK
+-go work init
+-go work use ./tools/ ./tools/gopls/
+-```
+-
+-...followed by opening the `$WORK` directory in our editor.
+-
+-#### DEPRECATED: Experimental workspace module (Go 1.17 and earlier)
+-
+-**This feature is deprecated and will be removed in future versions of gopls.
+-Please see [issue #52897](https://go.dev/issue/52897) for additional
+-information.**
+-
+-With earlier versions of Go, `gopls` can simulate multi-module workspaces by
+-creating a synthetic module requiring the modules in the workspace root.
+-See [the design document](https://github.com/golang/proposal/blob/master/design/37720-gopls-workspaces.md)
+-for more information.
+-
+-This feature is experimental, and will eventually be removed once `go.work`
+-files are accepted by all supported Go versions.
+-
+-You can enable this feature by configuring the
+-[experimentalWorkspaceModule](settings.md#experimentalworkspacemodule-bool)
+-setting.
+-
+-#### Multiple workspace folders
+-
+-If neither of the above solutions work, and your editor allows configuring the
+-set of
+-["workspace folders"](https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#workspaceFolder)
+-used during your LSP session, you can still work on multiple modules by adding
+-a workspace folder at each module root (the locations of `go.mod` files). This
+-means that each module has its own scope, and features will not work across
+-modules.
+-
+-In VS Code, you can create a workspace folder by setting up a
+-[multi-root workspace](https://code.visualstudio.com/docs/editor/multi-root-workspaces).
+-View the [documentation for your editor plugin](../README.md#editor) to learn how to
+-configure a workspace folder in your editor.
+-
+-### GOPATH mode
+-
+-When opening a directory within your GOPATH, the workspace scope will be just
+-that directory.
+-
+-### At your own risk
+-
+-Some users or companies may have projects that encompass one `$GOPATH`. If you
+-open your entire `$GOPATH` or `$GOPATH/src` folder, the workspace scope will be
+-your entire `GOPATH`. If your GOPATH is large, `gopls` to be very slow to start
+-because it will try to find all of the Go files in the directory you have
+-opened. It will then load all of the files it has found.
+-
+-To work around this case, you can create a new `$GOPATH` that contains only the
+-packages you want to work on.
+-
+----
+-
+-If you have additional use cases that are not mentioned above, please
+-[file a new issue](https://github.com/golang/go/issues/new).
+diff -urN a/gopls/go.mod b/gopls/go.mod
+--- a/gopls/go.mod 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/go.mod 1970-01-01 00:00:00.000000000 +0000
+@@ -1,29 +0,0 @@
+-module golang.org/x/tools/gopls
+-
+-go 1.18
+-
+-require (
+- github.com/google/go-cmp v0.5.9
+- github.com/jba/printsrc v0.2.2
+- github.com/jba/templatecheck v0.6.0
+- github.com/sergi/go-diff v1.1.0
+- golang.org/x/mod v0.9.0
+- golang.org/x/sync v0.1.0
+- golang.org/x/sys v0.6.0
+- golang.org/x/text v0.8.0
+- golang.org/x/tools v0.6.0
+- golang.org/x/vuln v0.0.0-20230110180137-6ad3e3d07815
+- gopkg.in/yaml.v3 v3.0.1
+- honnef.co/go/tools v0.4.2
+- mvdan.cc/gofumpt v0.4.0
+- mvdan.cc/xurls/v2 v2.4.0
+-)
+-
+-require (
+- github.com/BurntSushi/toml v1.2.1 // indirect
+- github.com/google/safehtml v0.1.0 // indirect
+- golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect
+- golang.org/x/exp/typeparams v0.0.0-20221212164502-fae10dda9338 // indirect
+-)
+-
+-replace golang.org/x/tools => ../
+diff -urN a/gopls/go.sum b/gopls/go.sum
+--- a/gopls/go.sum 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/go.sum 1970-01-01 00:00:00.000000000 +0000
+@@ -1,101 +0,0 @@
+-github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
+-github.com/BurntSushi/toml v1.2.1 h1:9F2/+DoOYIOksmaJFPw1tGFy1eDnIJXg+UHjuD8lTak=
+-github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
+-github.com/client9/misspell v0.3.4 h1:ta993UF76GwbvJcIo3Y68y/M3WxlpEHPWIGDkJYwzJI=
+-github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
+-github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
+-github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+-github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
+-github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
+-github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
+-github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps=
+-github.com/google/go-cmdtest v0.4.1-0.20220921163831-55ab3332a786/go.mod h1:apVn/GCasLZUVpAJ6oWAuyP7Ne7CEsQbTnc0plM3m+o=
+-github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
+-github.com/google/go-cmp v0.5.7/go.mod h1:n+brtR0CgQNWTVd5ZUFpTBC8YFBDLK/h/bpaJ8/DtOE=
+-github.com/google/go-cmp v0.5.8/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+-github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
+-github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
+-github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
+-github.com/google/safehtml v0.0.2/go.mod h1:L4KWwDsUJdECRAEpZoBn3O64bQaywRscowZjJAzjHnU=
+-github.com/google/safehtml v0.1.0 h1:EwLKo8qawTKfsi0orxcQAZzu07cICaBeFMegAU9eaT8=
+-github.com/google/safehtml v0.1.0/go.mod h1:L4KWwDsUJdECRAEpZoBn3O64bQaywRscowZjJAzjHnU=
+-github.com/jba/printsrc v0.2.2 h1:9OHK51UT+/iMAEBlQIIXW04qvKyF3/vvLuwW/hL8tDU=
+-github.com/jba/printsrc v0.2.2/go.mod h1:1xULjw59sL0dPdWpDoVU06TIEO/Wnfv6AHRpiElTwYM=
+-github.com/jba/templatecheck v0.6.0 h1:SwM8C4hlK/YNLsdcXStfnHWE2HKkuTVwy5FKQHt5ro8=
+-github.com/jba/templatecheck v0.6.0/go.mod h1:/1k7EajoSErFI9GLHAsiIJEaNLt3ALKNw2TV7z2SYv4=
+-github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
+-github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
+-github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
+-github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
+-github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
+-github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
+-github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+-github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
+-github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
+-github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
+-github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
+-github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o=
+-github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8=
+-github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
+-github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
+-github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM=
+-github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
+-github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
+-github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
+-github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
+-golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+-golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA=
+-golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA=
+-golang.org/x/exp/typeparams v0.0.0-20221208152030-732eee02a75a/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
+-golang.org/x/exp/typeparams v0.0.0-20221212164502-fae10dda9338 h1:2O2DON6y3XMJiQRAS1UWU+54aec2uopH3x7MAiqGW6Y=
+-golang.org/x/exp/typeparams v0.0.0-20221212164502-fae10dda9338/go.mod h1:AbB0pIl9nAr9wVwH+Z2ZpaocVmF5I4GyWCDIsVjR0bk=
+-golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY=
+-golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
+-golang.org/x/mod v0.7.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
+-golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
+-golang.org/x/mod v0.9.0 h1:KENHtAZL2y3NLMYZeHY9DW8HW8V+kQyJsY/V9JlKvCs=
+-golang.org/x/mod v0.9.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
+-golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
+-golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
+-golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+-golang.org/x/sync v0.0.0-20220819030929-7fc1605a5dde/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+-golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
+-golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+-golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+-golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+-golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+-golang.org/x/sys v0.0.0-20211213223007-03aa0b5f6827/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+-golang.org/x/sys v0.0.0-20220829200755-d48e67d00261/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+-golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+-golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+-golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
+-golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+-golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+-golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U=
+-golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+-golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
+-golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
+-golang.org/x/vuln v0.0.0-20230110180137-6ad3e3d07815 h1:A9kONVi4+AnuOr1dopsibH6hLi1Huy54cbeJxnq4vmU=
+-golang.org/x/vuln v0.0.0-20230110180137-6ad3e3d07815/go.mod h1:XJiVExZgoZfrrxoTeVsFYrSSk1snhfpOEC95JL+A4T0=
+-golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+-golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+-golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
+-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=
+-gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
+-gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
+-gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
+-gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+-gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
+-gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+-gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+-gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+-honnef.co/go/tools v0.2.2/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY=
+-honnef.co/go/tools v0.4.2 h1:6qXr+R5w+ktL5UkwEbPp+fEvfyoMPche6GkOpGHZcLc=
+-honnef.co/go/tools v0.4.2/go.mod h1:36ZgoUOrqOk1GxwHhyryEkq8FQWkUO2xGuSMhUCcdvA=
+-mvdan.cc/gofumpt v0.4.0 h1:JVf4NN1mIpHogBj7ABpgOyZc65/UUOkKQFkoURsz4MM=
+-mvdan.cc/gofumpt v0.4.0/go.mod h1:PljLOHDeZqgS8opHRKLzp2It2VBuSdteAgqUfzMTxlQ=
+-mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5 h1:Jh3LAeMt1eGpxomyu3jVkmVZWW2MxZ1qIIV2TZ/nRio=
+-mvdan.cc/unparam v0.0.0-20211214103731-d0ef000c54e5/go.mod h1:b8RRCBm0eeiWR8cfN88xeq2G5SG3VKGO+5UPWi5FSOY=
+-mvdan.cc/xurls/v2 v2.4.0 h1:tzxjVAj+wSBmDcF6zBB7/myTy3gX9xvi8Tyr28AuQgc=
+-mvdan.cc/xurls/v2 v2.4.0/go.mod h1:+GEjq9uNjqs8LQfM9nVnM8rff0OQ5Iash5rzX+N1CSg=
+diff -urN a/gopls/integration/govim/artifacts.go b/gopls/integration/govim/artifacts.go
+--- a/gopls/integration/govim/artifacts.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/integration/govim/artifacts.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,67 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package main
+-
+-import (
+- "flag"
+- "fmt"
+- "io/ioutil"
+- "net/http"
+- "os"
+- "path"
+-)
+-
+-var bucket = flag.String("bucket", "golang-gopls_integration_tests", "GCS bucket holding test artifacts.")
+-
+-const usage = `
+-artifacts [--bucket=<bucket ID>] <cloud build evaluation ID>
+-
+-Fetch artifacts from an integration test run. Evaluation ID should be extracted
+-from the cloud build notification.
+-
+-In order for this to work, the GCS bucket that artifacts were written to must
+-be publicly readable. By default, this fetches from the
+-golang-gopls_integration_tests bucket.
+-`
+-
+-func main() {
+- flag.Usage = func() {
+- fmt.Fprint(flag.CommandLine.Output(), usage)
+- }
+- flag.Parse()
+- if flag.NArg() != 1 {
+- flag.Usage()
+- os.Exit(2)
+- }
+- evalID := flag.Arg(0)
+- logURL := fmt.Sprintf("https://storage.googleapis.com/%s/log-%s.txt", *bucket, evalID)
+- if err := download(logURL); err != nil {
+- fmt.Fprintf(os.Stderr, "downloading logs: %v", err)
+- }
+- tarURL := fmt.Sprintf("https://storage.googleapis.com/%s/govim/%s/artifacts.tar.gz", *bucket, evalID)
+- if err := download(tarURL); err != nil {
+- fmt.Fprintf(os.Stderr, "downloading artifact tarball: %v", err)
+- }
+-}
+-
+-func download(artifactURL string) error {
+- name := path.Base(artifactURL)
+- resp, err := http.Get(artifactURL)
+- if err != nil {
+- return fmt.Errorf("fetching from GCS: %v", err)
+- }
+- defer resp.Body.Close()
+- if resp.StatusCode != http.StatusOK {
+- return fmt.Errorf("got status code %d from GCS", resp.StatusCode)
+- }
+- data, err := ioutil.ReadAll(resp.Body)
+- if err != nil {
+- return fmt.Errorf("reading result: %v", err)
+- }
+- if err := ioutil.WriteFile(name, data, 0644); err != nil {
+- return fmt.Errorf("writing artifact: %v", err)
+- }
+- return nil
+-}
+diff -urN a/gopls/integration/govim/cloudbuild.harness.yaml b/gopls/integration/govim/cloudbuild.harness.yaml
+--- a/gopls/integration/govim/cloudbuild.harness.yaml 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/integration/govim/cloudbuild.harness.yaml 1970-01-01 00:00:00.000000000 +0000
+@@ -1,21 +0,0 @@
+-# Copyright 2019 The Go Authors. All rights reserved.
+-# Use of this source code is governed by a BSD-style
+-# license that can be found in the LICENSE file.
+-
+-# Build the govim test harness that will be used to run govim integration tests
+-# for gopls. See README.md for instructions on how to use this.
+-steps:
+- - name: 'gcr.io/cloud-builders/docker'
+- args: ['build',
+- # To allow for breaking changes to this test harness, tag with a major
+- # version number.
+- '-t', 'gcr.io/$PROJECT_ID/govim-harness:latest',
+- '-t', 'gcr.io/$PROJECT_ID/govim-harness:3',
+- # It is assumed that this build is running from the root directory of the
+- # tools repository.
+- '-f', 'gopls/integration/govim/Dockerfile',
+- # Use the integration test directory as build context: the test harness
+- # doesn't actually require any local files.
+- 'gopls/integration/govim']
+-images:
+- - gcr.io/$PROJECT_ID/govim-harness
+diff -urN a/gopls/integration/govim/cloudbuild.yaml b/gopls/integration/govim/cloudbuild.yaml
+--- a/gopls/integration/govim/cloudbuild.yaml 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/integration/govim/cloudbuild.yaml 1970-01-01 00:00:00.000000000 +0000
+@@ -1,51 +0,0 @@
+-# Copyright 2019 The Go Authors. All rights reserved.
+-# Use of this source code is governed by a BSD-style
+-# license that can be found in the LICENSE file.
+-
+-# Build gopls, and run the govim integration tests. See README.md for
+-# instructions on how to use this.
+-
+-substitutions:
+- # This bucket must be owned by the GCP project executing the build. If
+- # you are running this from your own project, override using --substitutions.
+- _RESULT_BUCKET: 'golang-gopls_integration_tests'
+-
+-steps:
+- # Build gopls from source, to use with the govim integration tests.
+- - name: 'golang:1.14'
+- env: ['GOPROXY=https://proxy.golang.org']
+- dir: 'gopls'
+- args: ['go', 'build']
+-
+- # Run the tests. Note that the script in this step does not return the exit
+- # code from `go test`, but rather saves it for use in the final step after
+- # uploading artifacts.
+- - name: 'gcr.io/$PROJECT_ID/govim-harness:3'
+- dir: '/src/govim'
+- volumes:
+- - name: artifacts
+- path: /artifacts
+- env:
+- - GOVIM_TESTSCRIPT_WORKDIR_ROOT=/artifacts
+- - VIM_FLAVOR=vim
+- args: ['/workspace/gopls/integration/govim/run_tests_for_cloudbuild.sh']
+-
+- # The govim tests produce a large number of artifacts; tarball/gzip to reduce
+- # roundtrips and save space.
+- - name: 'ubuntu'
+- volumes:
+- - name: artifacts
+- path: /artifacts
+- args: ['tar', '-czf', 'artifacts.tar.gz', '/artifacts']
+-
+- # Upload artifacts to GCS.
+- - name: 'gcr.io/cloud-builders/gsutil'
+- args: ['cp', 'artifacts.tar.gz', 'gs://${_RESULT_BUCKET}/govim/${BUILD_ID}/artifacts.tar.gz']
+-
+- # Exit with the actual exit code of the integration tests.
+- - name: 'ubuntu'
+- args: ['bash', 'govim_test_result.sh']
+-
+-# Write build logs to the same bucket as artifacts, so they can be more easily
+-# shared.
+-logsBucket: 'gs://${_RESULT_BUCKET}'
+diff -urN a/gopls/integration/govim/Dockerfile b/gopls/integration/govim/Dockerfile
+--- a/gopls/integration/govim/Dockerfile 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/integration/govim/Dockerfile 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+-# Copyright 2019 The Go Authors. All rights reserved.
+-# Use of this source code is governed by a BSD-style
+-# license that can be found in the LICENSE file.
+-
+-# govim requires a more recent version of vim than is available in most
+-# distros, so we build from their base image.
+-FROM govim/govim:latest-vim
+-ARG GOVIM_REF
+-
+-ENV GOPROXY=https://proxy.golang.org GOPATH=/go VIM_FLAVOR=vim
+-WORKDIR /src
+-
+-# Clone govim. In order to use the go command for resolving latest, we download
+-# a redundant copy of govim to the build cache using `go mod download`.
+-RUN git clone https://github.com/govim/govim /src/govim && cd /src/govim && \
+- git checkout $GOVIM_REF
+diff -urN a/gopls/integration/govim/README.md b/gopls/integration/govim/README.md
+--- a/gopls/integration/govim/README.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/integration/govim/README.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,47 +0,0 @@
+-# govim integration tests
+-
+-Files in this directory configure Cloud Build to run [govim] integration tests
+-against a gopls binary built from source.
+-
+-## Running on GCP
+-
+-To run these integration tests in Cloud Build, use the following steps. Here
+-we assume that `$PROJECT_ID` is a valid GCP project and `$BUCKET` is a cloud
+-storage bucket owned by that project.
+-
+-- `cd` to the root directory of the tools project.
+-- (at least once per GCP project) Build the test harness:
+-```
+-$ gcloud builds submit \
+- --project="${PROJECT_ID}" \
+- --config=gopls/integration/govim/cloudbuild.harness.yaml
+-```
+-- Run the integration tests:
+-```
+-$ gcloud builds submit \
+- --project="${PROJECT_ID}" \
+- --config=gopls/integration/govim/cloudbuild.yaml \
+- --substitutions=_RESULT_BUCKET="${BUCKET}"
+-```
+-
+-## Fetching Artifacts
+-
+-Assuming the artifacts bucket is world readable, you can fetch integration from
+-GCS. They are located at:
+-
+-- logs: `https://storage.googleapis.com/${BUCKET}/log-${EVALUATION_ID}.txt`
+-- artifact tarball: `https://storage.googleapis.com/${BUCKET}/govim/${EVALUATION_ID}/artifacts.tar.gz`
+-
+-The `artifacts.go` command can be used to fetch both artifacts using an
+-evaluation id.
+-
+-## Running locally
+-
+-Run `gopls/integration/govim/run_local.sh`. This may take a while the first
+-time it is run, as it will require building the test harness. This script
+-accepts two flags to modify its behavior:
+-
+-**--sudo**: run docker with `sudo`
+-**--short**: run `go test -short`
+-
+-[govim]: https://github.com/govim/govim
+diff -urN a/gopls/integration/govim/run_local.sh b/gopls/integration/govim/run_local.sh
+--- a/gopls/integration/govim/run_local.sh 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/integration/govim/run_local.sh 1970-01-01 00:00:00.000000000 +0000
+@@ -1,96 +0,0 @@
+-#!/bin/bash -e
+-
+-# Copyright 2019 The Go Authors. All rights reserved.
+-# Use of this source code is governed by a BSD-style
+-# license that can be found in the LICENSE file.
+-
+-# Run govim integration tests against a local gopls.
+-
+-usage() {
+- cat <<EOUSAGE
+-Usage: $0 [--sudo] [--short] [--version (semver|latest)]
+-
+-Args:
+- --sudo run docker with sudo
+- --short run `go test` with `-short`
+- --version run on the specific tagged govim version (or latest) rather
+- than the default branch
+-
+-Run govim tests against HEAD using local docker.
+-EOUSAGE
+-}
+-
+-SUDO_IF_NEEDED=
+-TEST_SHORT=
+-DOCKERFILE=gopls/integration/govim/Dockerfile
+-GOVIM_REF=main
+-while [[ $# -gt 0 ]]; do
+- case "$1" in
+- "-h" | "--help" | "help")
+- usage
+- exit 0
+- ;;
+- "--sudo")
+- SUDO_IF_NEEDED="sudo "
+- shift
+- ;;
+- "--short")
+- TEST_SHORT="-short"
+- shift
+- ;;
+- "--version")
+- if [[ -z "$2" ]]; then
+- usage
+- exit 1
+- fi
+- GOVIM_REF=$2
+- if [[ "${GOVIM_REF}" == "latest" ]]; then
+- TMPGOPATH=$(mktemp -d)
+- trap "GOPATH=${TMPGOPATH} go clean -modcache && rm -r ${TMPGOPATH}" EXIT
+- GOVIM_REF=$(GOPATH=${TMPGOPATH} go mod download -json \
+- github.com/govim/govim@latest | jq -r .Version)
+- fi
+- shift 2
+- ;;
+- *)
+- usage
+- exit 1
+- esac
+-done
+-
+-# Find the tools root, so that this script can be run from any directory.
+-script_dir=$(dirname "$(readlink -f "$0")")
+-tools_dir=$(readlink -f "${script_dir}/../../..")
+-
+-# Build gopls.
+-cd "${tools_dir}/gopls"
+-temp_gopls=$(mktemp -p "$PWD")
+-trap "rm -f \"${temp_gopls}\"" EXIT
+-# For consistency across environments, use golang docker to build rather than
+-# the local go command.
+-${SUDO_IF_NEEDED}docker run --rm -t \
+- -v "${tools_dir}:/src/tools" \
+- -w "/src/tools/gopls" \
+- golang:rc \
+- go build -o $(basename ${temp_gopls})
+-
+-# Build the test harness. Here we are careful to pass in a very limited build
+-# context so as to optimize caching.
+-echo "Checking out govim@${GOVIM_REF}"
+-cd "${tools_dir}"
+-${SUDO_IF_NEEDED}docker build \
+- --build-arg GOVIM_REF="${GOVIM_REF}" \
+- -t gopls-govim-harness:${GOVIM_REF} \
+- -f gopls/integration/govim/Dockerfile \
+- gopls/integration/govim
+-
+-# Run govim integration tests.
+-echo "running govim integration tests using ${temp_gopls}"
+-temp_gopls_name=$(basename "${temp_gopls}")
+-${SUDO_IF_NEEDED}docker run --rm -t \
+- -v "${tools_dir}:/src/tools" \
+- -w "/src/govim" \
+- --ulimit memlock=-1:-1 \
+- gopls-govim-harness:${GOVIM_REF} \
+- go test ${TEST_SHORT} ./cmd/govim \
+- -gopls "/src/tools/gopls/${temp_gopls_name}"
+diff -urN a/gopls/integration/govim/run_tests_for_cloudbuild.sh b/gopls/integration/govim/run_tests_for_cloudbuild.sh
+--- a/gopls/integration/govim/run_tests_for_cloudbuild.sh 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/integration/govim/run_tests_for_cloudbuild.sh 1970-01-01 00:00:00.000000000 +0000
+@@ -1,28 +0,0 @@
+-#!/bin/bash
+-
+-# Copyright 2020 The Go Authors. All rights reserved.
+-# Use of this source code is governed by a BSD-style
+-# license that can be found in the LICENSE file.
+-
+-# This script runs govim integration tests but always succeeds, instead writing
+-# their result to a file so that any test failure can be deferred to a later
+-# build step. We do this so that we can capture govim test artifacts regardless
+-# of the test results.
+-
+-# Substitute the locally built gopls binary for use in govim integration tests.
+-go test -short ./cmd/govim -gopls /workspace/gopls/gopls
+-
+-# Stash the error, for use in a later build step.
+-echo "exit $?" > /workspace/govim_test_result.sh
+-
+-# Clean up unnecessary artifacts. This is based on govim/_scripts/tidyUp.bash.
+-# Since we're fetching govim using the go command, we won't have this non-go
+-# source directory available to us.
+-if [[ -n "$GOVIM_TESTSCRIPT_WORKDIR_ROOT" ]]; then
+- echo "Cleaning up build artifacts..."
+- # Make artifacts writable so that rm -rf doesn't complain.
+- chmod -R u+w "$GOVIM_TESTSCRIPT_WORKDIR_ROOT"
+-
+- # Remove directories we don't care about.
+- find "$GOVIM_TESTSCRIPT_WORKDIR_ROOT" -type d \( -name .vim -o -name gopath \) -prune -exec rm -rf '{}' \;
+-fi
+diff -urN a/gopls/internal/coverage/coverage.go b/gopls/internal/coverage/coverage.go
+--- a/gopls/internal/coverage/coverage.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/coverage/coverage.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,266 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go.1.16
+-// +build go.1.16
+-
+-// Running this program in the tools directory will produce a coverage file /tmp/cover.out
+-// and a coverage report for all the packages under internal/lsp, accumulated by all the tests
+-// under gopls.
+-//
+-// -o controls where the coverage file is written, defaulting to /tmp/cover.out
+-// -i coverage-file will generate the report from an existing coverage file
+-// -v controls verbosity (0: only report coverage, 1: report as each directory is finished,
+-//
+-// 2: report on each test, 3: more details, 4: too much)
+-//
+-// -t tests only tests packages in the given comma-separated list of directories in gopls.
+-//
+-// The names should start with ., as in ./internal/regtest/bench
+-//
+-// -run tests. If set, -run tests is passed on to the go test command.
+-//
+-// Despite gopls' use of goroutines, the counts are almost deterministic.
+-package main
+-
+-import (
+- "bytes"
+- "encoding/json"
+- "flag"
+- "fmt"
+- "log"
+- "os"
+- "os/exec"
+- "path/filepath"
+- "sort"
+- "strings"
+- "time"
+-
+- "golang.org/x/tools/cover"
+-)
+-
+-var (
+- proFile = flag.String("i", "", "existing profile file")
+- outFile = flag.String("o", "/tmp/cover.out", "where to write the coverage file")
+- verbose = flag.Int("v", 0, "how much detail to print as tests are running")
+- tests = flag.String("t", "", "list of tests to run")
+- run = flag.String("run", "", "value of -run to pass to go test")
+-)
+-
+-func main() {
+- log.SetFlags(log.Lshortfile)
+- flag.Parse()
+-
+- if *proFile != "" {
+- report(*proFile)
+- return
+- }
+-
+- checkCwd()
+- // find the packages under gopls containing tests
+- tests := listDirs("gopls")
+- tests = onlyTests(tests)
+- tests = realTestName(tests)
+-
+- // report coverage for packages under internal/lsp
+- parg := "golang.org/x/tools/gopls/internal/lsp/..."
+-
+- accum := []string{}
+- seen := make(map[string]bool)
+- now := time.Now()
+- for _, toRun := range tests {
+- if excluded(toRun) {
+- continue
+- }
+- x := runTest(toRun, parg)
+- if *verbose > 0 {
+- fmt.Printf("finished %s %.1fs\n", toRun, time.Since(now).Seconds())
+- }
+- lines := bytes.Split(x, []byte{'\n'})
+- for _, l := range lines {
+- if len(l) == 0 {
+- continue
+- }
+- if !seen[string(l)] {
+- // not accumulating counts, so only works for mode:set
+- seen[string(l)] = true
+- accum = append(accum, string(l))
+- }
+- }
+- }
+- sort.Strings(accum[1:])
+- if err := os.WriteFile(*outFile, []byte(strings.Join(accum, "\n")), 0644); err != nil {
+- log.Print(err)
+- }
+- report(*outFile)
+-}
+-
+-type result struct {
+- Time time.Time
+- Test string
+- Action string
+- Package string
+- Output string
+- Elapsed float64
+-}
+-
+-func runTest(tName, parg string) []byte {
+- args := []string{"test", "-short", "-coverpkg", parg, "-coverprofile", *outFile,
+- "-json"}
+- if *run != "" {
+- args = append(args, fmt.Sprintf("-run=%s", *run))
+- }
+- args = append(args, tName)
+- cmd := exec.Command("go", args...)
+- cmd.Dir = "./gopls"
+- ans, err := cmd.Output()
+- if *verbose > 1 {
+- got := strings.Split(string(ans), "\n")
+- for _, g := range got {
+- if g == "" {
+- continue
+- }
+- var m result
+- if err := json.Unmarshal([]byte(g), &m); err != nil {
+- log.Printf("%T/%v", err, err) // shouldn't happen
+- continue
+- }
+- maybePrint(m)
+- }
+- }
+- if err != nil {
+- log.Printf("%s: %q, cmd=%s", tName, ans, cmd.String())
+- }
+- buf, err := os.ReadFile(*outFile)
+- if err != nil {
+- log.Fatal(err)
+- }
+- return buf
+-}
+-
+-func report(fn string) {
+- profs, err := cover.ParseProfiles(fn)
+- if err != nil {
+- log.Fatal(err)
+- }
+- for _, p := range profs {
+- statements, counts := 0, 0
+- for _, x := range p.Blocks {
+- statements += x.NumStmt
+- if x.Count != 0 {
+- counts += x.NumStmt // sic: if any were executed, all were
+- }
+- }
+- pc := 100 * float64(counts) / float64(statements)
+- fmt.Printf("%3.0f%% %3d/%3d %s\n", pc, counts, statements, p.FileName)
+- }
+-}
+-
+-var todo []string // tests to run
+-
+-func excluded(tname string) bool {
+- if *tests == "" { // run all tests
+- return false
+- }
+- if todo == nil {
+- todo = strings.Split(*tests, ",")
+- }
+- for _, nm := range todo {
+- if tname == nm { // run this test
+- return false
+- }
+- }
+- // not in list, skip it
+- return true
+-}
+-
+-// should m.Package be printed sometime?
+-func maybePrint(m result) {
+- switch m.Action {
+- case "pass", "fail", "skip":
+- fmt.Printf("%s %s %.3f\n", m.Action, m.Test, m.Elapsed)
+- case "run":
+- if *verbose > 2 {
+- fmt.Printf("%s %s %.3f\n", m.Action, m.Test, m.Elapsed)
+- }
+- case "output":
+- if *verbose > 3 {
+- fmt.Printf("%s %s %q %.3f\n", m.Action, m.Test, m.Output, m.Elapsed)
+- }
+- case "pause", "cont":
+- if *verbose > 2 {
+- fmt.Printf("%s %s %.3f\n", m.Action, m.Test, m.Elapsed)
+- }
+- default:
+- fmt.Printf("%#v\n", m)
+- log.Fatalf("unknown action %s\n", m.Action)
+- }
+-}
+-
+-// return only the directories that contain tests
+-func onlyTests(s []string) []string {
+- ans := []string{}
+-outer:
+- for _, d := range s {
+- files, err := os.ReadDir(d)
+- if err != nil {
+- log.Fatalf("%s: %v", d, err)
+- }
+- for _, de := range files {
+- if strings.Contains(de.Name(), "_test.go") {
+- ans = append(ans, d)
+- continue outer
+- }
+- }
+- }
+- return ans
+-}
+-
+-// replace the prefix gopls/ with ./ as the tests are run in the gopls directory
+-func realTestName(p []string) []string {
+- ans := []string{}
+- for _, x := range p {
+- x = x[len("gopls/"):]
+- ans = append(ans, "./"+x)
+- }
+- return ans
+-}
+-
+-// make sure we start in a tools directory
+-func checkCwd() {
+- dir, err := os.Getwd()
+- if err != nil {
+- log.Fatal(err)
+- }
+- // we expect to be at the root of golang.org/x/tools
+- cmd := exec.Command("go", "list", "-m", "-f", "{{.Dir}}", "golang.org/x/tools")
+- buf, err := cmd.Output()
+- buf = bytes.Trim(buf, "\n \t") // remove \n at end
+- if err != nil {
+- log.Fatal(err)
+- }
+- if string(buf) != dir {
+- log.Fatalf("wrong directory: in %q, should be in %q", dir, string(buf))
+- }
+- // and we expect gopls and internal/lsp as subdirectories
+- _, err = os.Stat("gopls")
+- if err != nil {
+- log.Fatalf("expected a gopls directory, %v", err)
+- }
+-}
+-
+-func listDirs(dir string) []string {
+- ans := []string{}
+- f := func(path string, dirEntry os.DirEntry, err error) error {
+- if strings.HasSuffix(path, "/testdata") || strings.HasSuffix(path, "/typescript") {
+- return filepath.SkipDir
+- }
+- if dirEntry.IsDir() {
+- ans = append(ans, path)
+- }
+- return nil
+- }
+- filepath.WalkDir(dir, f)
+- return ans
+-}
+diff -urN a/gopls/internal/govulncheck/semver/semver.go b/gopls/internal/govulncheck/semver/semver.go
+--- a/gopls/internal/govulncheck/semver/semver.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/govulncheck/semver/semver.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,51 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-// Package semver provides shared utilities for manipulating
+-// Go semantic versions.
+-package semver
+-
+-import (
+- "regexp"
+- "strings"
+-)
+-
+-// addSemverPrefix adds a 'v' prefix to s if it isn't already prefixed
+-// with 'v' or 'go'. This allows us to easily test go-style SEMVER
+-// strings against normal SEMVER strings.
+-func addSemverPrefix(s string) string {
+- if !strings.HasPrefix(s, "v") && !strings.HasPrefix(s, "go") {
+- return "v" + s
+- }
+- return s
+-}
+-
+-// removeSemverPrefix removes the 'v' or 'go' prefixes from go-style
+-// SEMVER strings, for usage in the public vulnerability format.
+-func removeSemverPrefix(s string) string {
+- s = strings.TrimPrefix(s, "v")
+- s = strings.TrimPrefix(s, "go")
+- return s
+-}
+-
+-// CanonicalizeSemverPrefix turns a SEMVER string into the canonical
+-// representation using the 'v' prefix, as used by the OSV format.
+-// Input may be a bare SEMVER ("1.2.3"), Go prefixed SEMVER ("go1.2.3"),
+-// or already canonical SEMVER ("v1.2.3").
+-func CanonicalizeSemverPrefix(s string) string {
+- return addSemverPrefix(removeSemverPrefix(s))
+-}
+-
+-var (
+- // Regexp for matching go tags. The groups are:
+- // 1 the major.minor version
+- // 2 the patch version, or empty if none
+- // 3 the entire prerelease, if present
+- // 4 the prerelease type ("beta" or "rc")
+- // 5 the prerelease number
+- tagRegexp = regexp.MustCompile(`^go(\d+\.\d+)(\.\d+|)((beta|rc|-pre)(\d+))?$`)
+-)
+diff -urN a/gopls/internal/govulncheck/semver/semver_test.go b/gopls/internal/govulncheck/semver/semver_test.go
+--- a/gopls/internal/govulncheck/semver/semver_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/govulncheck/semver/semver_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,28 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package semver
+-
+-import (
+- "testing"
+-)
+-
+-func TestCanonicalize(t *testing.T) {
+- for _, test := range []struct {
+- v string
+- want string
+- }{
+- {"v1.2.3", "v1.2.3"},
+- {"1.2.3", "v1.2.3"},
+- {"go1.2.3", "v1.2.3"},
+- } {
+- got := CanonicalizeSemverPrefix(test.v)
+- if got != test.want {
+- t.Errorf("want %s; got %s", test.want, got)
+- }
+- }
+-}
+diff -urN a/gopls/internal/govulncheck/types_118.go b/gopls/internal/govulncheck/types_118.go
+--- a/gopls/internal/govulncheck/types_118.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/govulncheck/types_118.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,43 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-// Package govulncheck provides an experimental govulncheck API.
+-package govulncheck
+-
+-import (
+- "golang.org/x/vuln/exp/govulncheck"
+-)
+-
+-var (
+- // Source reports vulnerabilities that affect the analyzed packages.
+- Source = govulncheck.Source
+-
+- // DefaultCache constructs cache for a vulnerability database client.
+- DefaultCache = govulncheck.DefaultCache
+-)
+-
+-type (
+- // Config is the configuration for Main.
+- Config = govulncheck.Config
+-
+- // Vuln represents a single OSV entry.
+- Vuln = govulncheck.Vuln
+-
+- // Module represents a specific vulnerability relevant to a
+- // single module or package.
+- Module = govulncheck.Module
+-
+- // Package is a Go package with known vulnerable symbols.
+- Package = govulncheck.Package
+-
+- // CallStacks contains a representative call stack for each
+- // vulnerable symbol that is called.
+- CallStack = govulncheck.CallStack
+-
+- // StackFrame represents a call stack entry.
+- StackFrame = govulncheck.StackFrame
+-)
+diff -urN a/gopls/internal/govulncheck/types.go b/gopls/internal/govulncheck/types.go
+--- a/gopls/internal/govulncheck/types.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/govulncheck/types.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,37 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package govulncheck
+-
+-import "time"
+-
+-// Result is the result of vulnerability scanning.
+-type Result struct {
+- // Vulns contains all vulnerabilities that are called or imported by
+- // the analyzed module.
+- Vulns []*Vuln `json:",omitempty"`
+-
+- // Mode contains the source of the vulnerability info.
+- // Clients of the gopls.fetch_vulncheck_result command may need
+- // to interpret the vulnerabilities differently based on the
+- // analysis mode. For example, Vuln without callstack traces
+- // indicate a vulnerability that is not used if the result was
+- // from 'govulncheck' analysis mode. On the other hand, Vuln
+- // without callstack traces just implies the package with the
+- // vulnerability is known to the workspace and we do not know
+- // whether the vulnerable symbols are actually used or not.
+- Mode AnalysisMode `json:",omitempty"`
+-
+- // AsOf describes when this Result was computed using govulncheck.
+- // It is valid only with the govulncheck analysis mode.
+- AsOf time.Time `json:",omitempty"`
+-}
+-
+-type AnalysisMode string
+-
+-const (
+- ModeInvalid AnalysisMode = "" // zero value
+- ModeGovulncheck AnalysisMode = "govulncheck"
+- ModeImports AnalysisMode = "imports"
+-)
+diff -urN a/gopls/internal/govulncheck/types_not118.go b/gopls/internal/govulncheck/types_not118.go
+--- a/gopls/internal/govulncheck/types_not118.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/govulncheck/types_not118.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,126 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build !go1.18
+-// +build !go1.18
+-
+-package govulncheck
+-
+-import (
+- "go/token"
+-
+- "golang.org/x/vuln/osv"
+-)
+-
+-// Vuln represents a single OSV entry.
+-type Vuln struct {
+- // OSV contains all data from the OSV entry for this vulnerability.
+- OSV *osv.Entry
+-
+- // Modules contains all of the modules in the OSV entry where a
+- // vulnerable package is imported by the target source code or binary.
+- //
+- // For example, a module M with two packages M/p1 and M/p2, where only p1
+- // is vulnerable, will appear in this list if and only if p1 is imported by
+- // the target source code or binary.
+- Modules []*Module
+-}
+-
+-func (v *Vuln) IsCalled() bool {
+- return false
+-}
+-
+-// Module represents a specific vulnerability relevant to a single module.
+-type Module struct {
+- // Path is the module path of the module containing the vulnerability.
+- //
+- // Importable packages in the standard library will have the path "stdlib".
+- Path string
+-
+- // FoundVersion is the module version where the vulnerability was found.
+- FoundVersion string
+-
+- // FixedVersion is the module version where the vulnerability was
+- // fixed. If there are multiple fixed versions in the OSV report, this will
+- // be the latest fixed version.
+- //
+- // This is empty if a fix is not available.
+- FixedVersion string
+-
+- // Packages contains all the vulnerable packages in OSV entry that are
+- // imported by the target source code or binary.
+- //
+- // For example, given a module M with two packages M/p1 and M/p2, where
+- // both p1 and p2 are vulnerable, p1 and p2 will each only appear in this
+- // list they are individually imported by the target source code or binary.
+- Packages []*Package
+-}
+-
+-// Package is a Go package with known vulnerable symbols.
+-type Package struct {
+- // Path is the import path of the package containing the vulnerability.
+- Path string
+-
+- // CallStacks contains a representative call stack for each
+- // vulnerable symbol that is called.
+- //
+- // For vulnerabilities found from binary analysis, only CallStack.Symbol
+- // will be provided.
+- //
+- // For non-affecting vulnerabilities reported from the source mode
+- // analysis, this will be empty.
+- CallStacks []CallStack
+-}
+-
+-// CallStacks contains a representative call stack for a vulnerable
+-// symbol.
+-type CallStack struct {
+- // Symbol is the name of the detected vulnerable function
+- // or method.
+- //
+- // This follows the naming convention in the OSV report.
+- Symbol string
+-
+- // Summary is a one-line description of the callstack, used by the
+- // default govulncheck mode.
+- //
+- // Example: module3.main calls github.com/shiyanhui/dht.DHT.Run
+- Summary string
+-
+- // Frames contains an entry for each stack in the call stack.
+- //
+- // Frames are sorted starting from the entry point to the
+- // imported vulnerable symbol. The last frame in Frames should match
+- // Symbol.
+- Frames []*StackFrame
+-}
+-
+-// StackFrame represents a call stack entry.
+-type StackFrame struct {
+- // PackagePath is the import path.
+- PkgPath string
+-
+- // FuncName is the function name.
+- FuncName string
+-
+- // RecvType is the fully qualified receiver type,
+- // if the called symbol is a method.
+- //
+- // The client can create the final symbol name by
+- // prepending RecvType to FuncName.
+- RecvType string
+-
+- // Position describes an arbitrary source position
+- // including the file, line, and column location.
+- // A Position is valid if the line number is > 0.
+- Position token.Position
+-}
+-
+-func (sf *StackFrame) Name() string {
+- return ""
+-}
+-
+-func (sf *StackFrame) Pos() string {
+- return ""
+-}
+diff -urN a/gopls/internal/govulncheck/util.go b/gopls/internal/govulncheck/util.go
+--- a/gopls/internal/govulncheck/util.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/govulncheck/util.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,36 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package govulncheck
+-
+-import (
+- "golang.org/x/mod/semver"
+- isem "golang.org/x/tools/gopls/internal/govulncheck/semver"
+- "golang.org/x/vuln/osv"
+-)
+-
+-// LatestFixed returns the latest fixed version in the list of affected ranges,
+-// or the empty string if there are no fixed versions.
+-func LatestFixed(modulePath string, as []osv.Affected) string {
+- v := ""
+- for _, a := range as {
+- if a.Package.Name != modulePath {
+- continue
+- }
+- for _, r := range a.Ranges {
+- if r.Type == osv.TypeSemver {
+- for _, e := range r.Events {
+- if e.Fixed != "" && (v == "" ||
+- semver.Compare(isem.CanonicalizeSemverPrefix(e.Fixed), isem.CanonicalizeSemverPrefix(v)) > 0) {
+- v = e.Fixed
+- }
+- }
+- }
+- }
+- }
+- return v
+-}
+diff -urN a/gopls/internal/govulncheck/vulncache.go b/gopls/internal/govulncheck/vulncache.go
+--- a/gopls/internal/govulncheck/vulncache.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/govulncheck/vulncache.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,105 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package govulncheck
+-
+-import (
+- "sync"
+- "time"
+-
+- vulnc "golang.org/x/vuln/client"
+- "golang.org/x/vuln/osv"
+-)
+-
+-// inMemoryCache is an implementation of the [client.Cache] interface
+-// that "decorates" another instance of that interface to provide
+-// an additional layer of (memory-based) caching.
+-type inMemoryCache struct {
+- mu sync.Mutex
+- underlying vulnc.Cache
+- db map[string]*db
+-}
+-
+-var _ vulnc.Cache = &inMemoryCache{}
+-
+-type db struct {
+- retrieved time.Time
+- index vulnc.DBIndex
+- entry map[string][]*osv.Entry
+-}
+-
+-// NewInMemoryCache returns a new memory-based cache that decorates
+-// the provided cache (file-based, perhaps).
+-func NewInMemoryCache(underlying vulnc.Cache) *inMemoryCache {
+- return &inMemoryCache{
+- underlying: underlying,
+- db: make(map[string]*db),
+- }
+-}
+-
+-func (c *inMemoryCache) lookupDBLocked(dbName string) *db {
+- cached := c.db[dbName]
+- if cached == nil {
+- cached = &db{entry: make(map[string][]*osv.Entry)}
+- c.db[dbName] = cached
+- }
+- return cached
+-}
+-
+-// ReadIndex returns the index for dbName from the cache, or returns zero values
+-// if it is not present.
+-func (c *inMemoryCache) ReadIndex(dbName string) (vulnc.DBIndex, time.Time, error) {
+- c.mu.Lock()
+- defer c.mu.Unlock()
+- cached := c.lookupDBLocked(dbName)
+-
+- if cached.retrieved.IsZero() {
+- // First time ReadIndex is called.
+- index, retrieved, err := c.underlying.ReadIndex(dbName)
+- if err != nil {
+- return index, retrieved, err
+- }
+- cached.index, cached.retrieved = index, retrieved
+- }
+- return cached.index, cached.retrieved, nil
+-}
+-
+-// WriteIndex puts the index and retrieved time into the cache.
+-func (c *inMemoryCache) WriteIndex(dbName string, index vulnc.DBIndex, retrieved time.Time) error {
+- c.mu.Lock()
+- defer c.mu.Unlock()
+- cached := c.lookupDBLocked(dbName)
+- cached.index, cached.retrieved = index, retrieved
+- // TODO(hyangah): shouldn't we invalidate all cached entries?
+- return c.underlying.WriteIndex(dbName, index, retrieved)
+-}
+-
+-// ReadEntries returns the vulndb entries for path from the cache.
+-func (c *inMemoryCache) ReadEntries(dbName, path string) ([]*osv.Entry, error) {
+- c.mu.Lock()
+- defer c.mu.Unlock()
+- cached := c.lookupDBLocked(dbName)
+- entries, ok := cached.entry[path]
+- if !ok {
+- // cache miss
+- entries, err := c.underlying.ReadEntries(dbName, path)
+- if err != nil {
+- return entries, err
+- }
+- cached.entry[path] = entries
+- }
+- return entries, nil
+-}
+-
+-// WriteEntries puts the entries for path into the cache.
+-func (c *inMemoryCache) WriteEntries(dbName, path string, entries []*osv.Entry) error {
+- c.mu.Lock()
+- defer c.mu.Unlock()
+- cached := c.lookupDBLocked(dbName)
+- cached.entry[path] = entries
+- return c.underlying.WriteEntries(dbName, path, entries)
+-}
+diff -urN a/gopls/internal/hooks/analysis_116.go b/gopls/internal/hooks/analysis_116.go
+--- a/gopls/internal/hooks/analysis_116.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/hooks/analysis_116.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build !go1.19
+-// +build !go1.19
+-
+-package hooks
+-
+-import "golang.org/x/tools/gopls/internal/lsp/source"
+-
+-func updateAnalyzers(options *source.Options) {
+- options.StaticcheckSupported = false
+-}
+diff -urN a/gopls/internal/hooks/analysis_119.go b/gopls/internal/hooks/analysis_119.go
+--- a/gopls/internal/hooks/analysis_119.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/hooks/analysis_119.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,62 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.19
+-// +build go1.19
+-
+-package hooks
+-
+-import (
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "honnef.co/go/tools/analysis/lint"
+- "honnef.co/go/tools/quickfix"
+- "honnef.co/go/tools/simple"
+- "honnef.co/go/tools/staticcheck"
+- "honnef.co/go/tools/stylecheck"
+-)
+-
+-func updateAnalyzers(options *source.Options) {
+- options.StaticcheckSupported = true
+-
+- mapSeverity := func(severity lint.Severity) protocol.DiagnosticSeverity {
+- switch severity {
+- case lint.SeverityError:
+- return protocol.SeverityError
+- case lint.SeverityDeprecated:
+- // TODO(dh): in LSP, deprecated is a tag, not a severity.
+- // We'll want to support this once we enable SA5011.
+- return protocol.SeverityWarning
+- case lint.SeverityWarning:
+- return protocol.SeverityWarning
+- case lint.SeverityInfo:
+- return protocol.SeverityInformation
+- case lint.SeverityHint:
+- return protocol.SeverityHint
+- default:
+- return protocol.SeverityWarning
+- }
+- }
+- add := func(analyzers []*lint.Analyzer, skip map[string]struct{}) {
+- for _, a := range analyzers {
+- if _, ok := skip[a.Analyzer.Name]; ok {
+- continue
+- }
+-
+- enabled := !a.Doc.NonDefault
+- options.AddStaticcheckAnalyzer(a.Analyzer, enabled, mapSeverity(a.Doc.Severity))
+- }
+- }
+-
+- add(simple.Analyzers, nil)
+- add(staticcheck.Analyzers, map[string]struct{}{
+- // This check conflicts with the vet printf check (golang/go#34494).
+- "SA5009": {},
+- // This check relies on facts from dependencies, which
+- // we don't currently compute.
+- "SA5011": {},
+- })
+- add(stylecheck.Analyzers, nil)
+- add(quickfix.Analyzers, nil)
+-}
+diff -urN a/gopls/internal/hooks/diff.go b/gopls/internal/hooks/diff.go
+--- a/gopls/internal/hooks/diff.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/hooks/diff.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,169 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package hooks
+-
+-import (
+- "encoding/json"
+- "fmt"
+- "io/ioutil"
+- "log"
+- "os"
+- "path/filepath"
+- "runtime"
+- "sync"
+- "time"
+-
+- "github.com/sergi/go-diff/diffmatchpatch"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/diff"
+-)
+-
+-// structure for saving information about diffs
+-// while the new code is being rolled out
+-type diffstat struct {
+- Before, After int
+- Oldedits, Newedits int
+- Oldtime, Newtime time.Duration
+- Stack string
+- Msg string `json:",omitempty"` // for errors
+- Ignored int `json:",omitempty"` // numbr of skipped records with 0 edits
+-}
+-
+-var (
+- ignoredMu sync.Mutex
+- ignored int // counter of diff requests on equal strings
+-
+- diffStatsOnce sync.Once
+- diffStats *os.File // never closed
+-)
+-
+-// save writes a JSON record of statistics about diff requests to a temporary file.
+-func (s *diffstat) save() {
+- diffStatsOnce.Do(func() {
+- f, err := ioutil.TempFile("", "gopls-diff-stats-*")
+- if err != nil {
+- log.Printf("can't create diff stats temp file: %v", err) // e.g. disk full
+- return
+- }
+- diffStats = f
+- })
+- if diffStats == nil {
+- return
+- }
+-
+- // diff is frequently called with equal strings,
+- // so we count repeated instances but only print every 15th.
+- ignoredMu.Lock()
+- if s.Oldedits == 0 && s.Newedits == 0 {
+- ignored++
+- if ignored < 15 {
+- ignoredMu.Unlock()
+- return
+- }
+- }
+- s.Ignored = ignored
+- ignored = 0
+- ignoredMu.Unlock()
+-
+- // Record the name of the file in which diff was called.
+- // There aren't many calls, so only the base name is needed.
+- if _, file, line, ok := runtime.Caller(2); ok {
+- s.Stack = fmt.Sprintf("%s:%d", filepath.Base(file), line)
+- }
+- x, err := json.Marshal(s)
+- if err != nil {
+- log.Fatalf("internal error marshalling JSON: %v", err)
+- }
+- fmt.Fprintf(diffStats, "%s\n", x)
+-}
+-
+-// disaster is called when the diff algorithm panics or produces a
+-// diff that cannot be applied. It saves the broken input in a
+-// new temporary file and logs the file name, which is returned.
+-func disaster(before, after string) string {
+- // We use the pid to salt the name, not os.TempFile,
+- // so that each process creates at most one file.
+- // One is sufficient for a bug report.
+- filename := fmt.Sprintf("%s/gopls-diff-bug-%x", os.TempDir(), os.Getpid())
+-
+- // We use NUL as a separator: it should never appear in Go source.
+- data := before + "\x00" + after
+-
+- if err := ioutil.WriteFile(filename, []byte(data), 0600); err != nil {
+- log.Printf("failed to write diff bug report: %v", err)
+- return ""
+- }
+-
+- bug.Reportf("Bug detected in diff algorithm! Please send file %s to the maintainers of gopls if you are comfortable sharing its contents.", filename)
+-
+- return filename
+-}
+-
+-// BothDiffs edits calls both the new and old diffs, checks that the new diffs
+-// change before into after, and attempts to preserve some statistics.
+-func BothDiffs(before, after string) (edits []diff.Edit) {
+- // The new diff code contains a lot of internal checks that panic when they
+- // fail. This code catches the panics, or other failures, tries to save
+- // the failing example (and it would ask the user to send it back to us, and
+- // changes options.newDiff to 'old', if only we could figure out how.)
+- stat := diffstat{Before: len(before), After: len(after)}
+- now := time.Now()
+- oldedits := ComputeEdits(before, after)
+- stat.Oldedits = len(oldedits)
+- stat.Oldtime = time.Since(now)
+- defer func() {
+- if r := recover(); r != nil {
+- disaster(before, after)
+- edits = oldedits
+- }
+- }()
+- now = time.Now()
+- newedits := diff.Strings(before, after)
+- stat.Newedits = len(newedits)
+- stat.Newtime = time.Now().Sub(now)
+- got, err := diff.Apply(before, newedits)
+- if err != nil || got != after {
+- stat.Msg += "FAIL"
+- disaster(before, after)
+- stat.save()
+- return oldedits
+- }
+- stat.save()
+- return newedits
+-}
+-
+-// ComputeEdits computes a diff using the github.com/sergi/go-diff implementation.
+-func ComputeEdits(before, after string) (edits []diff.Edit) {
+- // The go-diff library has an unresolved panic (see golang/go#278774).
+- // TODO(rstambler): Remove the recover once the issue has been fixed
+- // upstream.
+- defer func() {
+- if r := recover(); r != nil {
+- bug.Reportf("unable to compute edits: %s", r)
+- // Report one big edit for the whole file.
+- edits = []diff.Edit{{
+- Start: 0,
+- End: len(before),
+- New: after,
+- }}
+- }
+- }()
+- diffs := diffmatchpatch.New().DiffMain(before, after, true)
+- edits = make([]diff.Edit, 0, len(diffs))
+- offset := 0
+- for _, d := range diffs {
+- start := offset
+- switch d.Type {
+- case diffmatchpatch.DiffDelete:
+- offset += len(d.Text)
+- edits = append(edits, diff.Edit{Start: start, End: offset})
+- case diffmatchpatch.DiffEqual:
+- offset += len(d.Text)
+- case diffmatchpatch.DiffInsert:
+- edits = append(edits, diff.Edit{Start: start, End: start, New: d.Text})
+- }
+- }
+- return edits
+-}
+diff -urN a/gopls/internal/hooks/diff_test.go b/gopls/internal/hooks/diff_test.go
+--- a/gopls/internal/hooks/diff_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/hooks/diff_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,33 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package hooks
+-
+-import (
+- "io/ioutil"
+- "os"
+- "testing"
+-
+- "golang.org/x/tools/internal/diff/difftest"
+-)
+-
+-func TestDiff(t *testing.T) {
+- difftest.DiffTest(t, ComputeEdits)
+-}
+-
+-func TestDisaster(t *testing.T) {
+- a := "This is a string,(\u0995) just for basic\nfunctionality"
+- b := "This is another string, (\u0996) to see if disaster will store stuff correctly"
+- fname := disaster(a, b)
+- buf, err := ioutil.ReadFile(fname)
+- if err != nil {
+- t.Fatal(err)
+- }
+- if string(buf) != a+"\x00"+b {
+- t.Error("failed to record original strings")
+- }
+- if err := os.Remove(fname); err != nil {
+- t.Error(err)
+- }
+-}
+diff -urN a/gopls/internal/hooks/gen-licenses.sh b/gopls/internal/hooks/gen-licenses.sh
+--- a/gopls/internal/hooks/gen-licenses.sh 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/hooks/gen-licenses.sh 1970-01-01 00:00:00.000000000 +0000
+@@ -1,38 +0,0 @@
+-#!/bin/bash -eu
+-
+-# Copyright 2020 The Go Authors. All rights reserved.
+-# Use of this source code is governed by a BSD-style
+-# license that can be found in the LICENSE file.
+-
+-set -o pipefail
+-
+-output=$1
+-tempfile=$(mktemp)
+-cd $(dirname $0)
+-
+-cat > $tempfile <<END
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:generate ./gen-licenses.sh licenses.go
+-package hooks
+-
+-const licensesText = \`
+-END
+-
+-# List all the modules gopls depends on, except other golang.org modules, which
+-# are known to have the same license.
+-mods=$(go list -deps -f '{{with .Module}}{{.Path}}{{end}}' golang.org/x/tools/gopls | sort -u | grep -v golang.org)
+-for mod in $mods; do
+- # Find the license file, either LICENSE or COPYING, and add it to the result.
+- dir=$(go list -m -f {{.Dir}} $mod)
+- license=$(ls -1 $dir | grep -E -i '^(LICENSE|COPYING)$')
+- echo "-- $mod $license --" >> $tempfile
+- echo >> $tempfile
+- sed 's/^-- / &/' $dir/$license >> $tempfile
+- echo >> $tempfile
+-done
+-
+-echo "\`" >> $tempfile
+-mv $tempfile $output
+\ No newline at end of file
+diff -urN a/gopls/internal/hooks/gofumpt_117.go b/gopls/internal/hooks/gofumpt_117.go
+--- a/gopls/internal/hooks/gofumpt_117.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/hooks/gofumpt_117.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build !go1.18
+-// +build !go1.18
+-
+-package hooks
+-
+-import "golang.org/x/tools/gopls/internal/lsp/source"
+-
+-func updateGofumpt(options *source.Options) {
+-}
+diff -urN a/gopls/internal/hooks/gofumpt_118.go b/gopls/internal/hooks/gofumpt_118.go
+--- a/gopls/internal/hooks/gofumpt_118.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/hooks/gofumpt_118.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package hooks
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "mvdan.cc/gofumpt/format"
+-)
+-
+-func updateGofumpt(options *source.Options) {
+- options.GofumptFormat = func(ctx context.Context, langVersion, modulePath string, src []byte) ([]byte, error) {
+- return format.Source(src, format.Options{
+- LangVersion: langVersion,
+- ModulePath: modulePath,
+- })
+- }
+-}
+diff -urN a/gopls/internal/hooks/hooks.go b/gopls/internal/hooks/hooks.go
+--- a/gopls/internal/hooks/hooks.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/hooks/hooks.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,31 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package hooks adds all the standard gopls implementations.
+-// This can be used in tests without needing to use the gopls main, and is
+-// also the place to edit for custom builds of gopls.
+-package hooks // import "golang.org/x/tools/gopls/internal/hooks"
+-
+-import (
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/diff"
+- "mvdan.cc/xurls/v2"
+-)
+-
+-func Options(options *source.Options) {
+- options.LicensesText = licensesText
+- if options.GoDiff {
+- switch options.NewDiff {
+- case "old":
+- options.ComputeEdits = ComputeEdits
+- case "new":
+- options.ComputeEdits = diff.Strings
+- default:
+- options.ComputeEdits = BothDiffs
+- }
+- }
+- options.URLRegexp = xurls.Relaxed()
+- updateAnalyzers(options)
+- updateGofumpt(options)
+-}
+diff -urN a/gopls/internal/hooks/licenses.go b/gopls/internal/hooks/licenses.go
+--- a/gopls/internal/hooks/licenses.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/hooks/licenses.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,169 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:generate ./gen-licenses.sh licenses.go
+-package hooks
+-
+-const licensesText = `
+--- github.com/BurntSushi/toml COPYING --
+-
+-The MIT License (MIT)
+-
+-Copyright (c) 2013 TOML authors
+-
+-Permission is hereby granted, free of charge, to any person obtaining a copy
+-of this software and associated documentation files (the "Software"), to deal
+-in the Software without restriction, including without limitation the rights
+-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+-copies of the Software, and to permit persons to whom the Software is
+-furnished to do so, subject to the following conditions:
+-
+-The above copyright notice and this permission notice shall be included in
+-all copies or substantial portions of the Software.
+-
+-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+-THE SOFTWARE.
+-
+--- github.com/google/go-cmp LICENSE --
+-
+-Copyright (c) 2017 The Go Authors. All rights reserved.
+-
+-Redistribution and use in source and binary forms, with or without
+-modification, are permitted provided that the following conditions are
+-met:
+-
+- * Redistributions of source code must retain the above copyright
+-notice, this list of conditions and the following disclaimer.
+- * Redistributions in binary form must reproduce the above
+-copyright notice, this list of conditions and the following disclaimer
+-in the documentation and/or other materials provided with the
+-distribution.
+- * Neither the name of Google Inc. nor the names of its
+-contributors may be used to endorse or promote products derived from
+-this software without specific prior written permission.
+-
+-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-
+--- github.com/sergi/go-diff LICENSE --
+-
+-Copyright (c) 2012-2016 The go-diff Authors. All rights reserved.
+-
+-Permission is hereby granted, free of charge, to any person obtaining a
+-copy of this software and associated documentation files (the "Software"),
+-to deal in the Software without restriction, including without limitation
+-the rights to use, copy, modify, merge, publish, distribute, sublicense,
+-and/or sell copies of the Software, and to permit persons to whom the
+-Software is furnished to do so, subject to the following conditions:
+-
+-The above copyright notice and this permission notice shall be included
+-in all copies or substantial portions of the Software.
+-
+-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+-OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+-FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+-DEALINGS IN THE SOFTWARE.
+-
+-
+--- honnef.co/go/tools LICENSE --
+-
+-Copyright (c) 2016 Dominik Honnef
+-
+-Permission is hereby granted, free of charge, to any person obtaining
+-a copy of this software and associated documentation files (the
+-"Software"), to deal in the Software without restriction, including
+-without limitation the rights to use, copy, modify, merge, publish,
+-distribute, sublicense, and/or sell copies of the Software, and to
+-permit persons to whom the Software is furnished to do so, subject to
+-the following conditions:
+-
+-The above copyright notice and this permission notice shall be
+-included in all copies or substantial portions of the Software.
+-
+-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+-
+--- mvdan.cc/gofumpt LICENSE --
+-
+-Copyright (c) 2019, Daniel Martí. All rights reserved.
+-
+-Redistribution and use in source and binary forms, with or without
+-modification, are permitted provided that the following conditions are
+-met:
+-
+- * Redistributions of source code must retain the above copyright
+-notice, this list of conditions and the following disclaimer.
+- * Redistributions in binary form must reproduce the above
+-copyright notice, this list of conditions and the following disclaimer
+-in the documentation and/or other materials provided with the
+-distribution.
+- * Neither the name of the copyright holder nor the names of its
+-contributors may be used to endorse or promote products derived from
+-this software without specific prior written permission.
+-
+-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-
+--- mvdan.cc/xurls/v2 LICENSE --
+-
+-Copyright (c) 2015, Daniel Martí. All rights reserved.
+-
+-Redistribution and use in source and binary forms, with or without
+-modification, are permitted provided that the following conditions are
+-met:
+-
+- * Redistributions of source code must retain the above copyright
+-notice, this list of conditions and the following disclaimer.
+- * Redistributions in binary form must reproduce the above
+-copyright notice, this list of conditions and the following disclaimer
+-in the documentation and/or other materials provided with the
+-distribution.
+- * Neither the name of the copyright holder nor the names of its
+-contributors may be used to endorse or promote products derived from
+-this software without specific prior written permission.
+-
+-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-
+-`
+diff -urN a/gopls/internal/hooks/licenses_test.go b/gopls/internal/hooks/licenses_test.go
+--- a/gopls/internal/hooks/licenses_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/hooks/licenses_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,47 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package hooks
+-
+-import (
+- "bytes"
+- "io/ioutil"
+- "os/exec"
+- "runtime"
+- "testing"
+-
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-func TestLicenses(t *testing.T) {
+- // License text differs for older Go versions because staticcheck or gofumpt
+- // isn't supported for those versions, and this fails for unknown, unrelated
+- // reasons on Kokoro legacy CI.
+- testenv.NeedsGo1Point(t, 19)
+-
+- if runtime.GOOS != "linux" && runtime.GOOS != "darwin" {
+- t.Skip("generating licenses only works on Unixes")
+- }
+- tmp, err := ioutil.TempFile("", "")
+- if err != nil {
+- t.Fatal(err)
+- }
+- tmp.Close()
+-
+- if out, err := exec.Command("./gen-licenses.sh", tmp.Name()).CombinedOutput(); err != nil {
+- t.Fatalf("generating licenses failed: %q, %v", out, err)
+- }
+-
+- got, err := ioutil.ReadFile(tmp.Name())
+- if err != nil {
+- t.Fatal(err)
+- }
+- want, err := ioutil.ReadFile("licenses.go")
+- if err != nil {
+- t.Fatal(err)
+- }
+- if !bytes.Equal(got, want) {
+- t.Error("combined license text needs updating. Run: `go generate ./internal/hooks` from the gopls module.")
+- }
+-}
+diff -urN a/gopls/internal/lsp/analysis/embeddirective/embeddirective.go b/gopls/internal/lsp/analysis/embeddirective/embeddirective.go
+--- a/gopls/internal/lsp/analysis/embeddirective/embeddirective.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/embeddirective/embeddirective.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,58 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package embeddirective defines an Analyzer that validates import for //go:embed directive.
+-package embeddirective
+-
+-import (
+- "go/ast"
+- "strings"
+-
+- "golang.org/x/tools/go/analysis"
+-)
+-
+-const Doc = `check for //go:embed directive import
+-
+-This analyzer checks that the embed package is imported when source code contains //go:embed comment directives.
+-The embed package must be imported for //go:embed directives to function.import _ "embed".`
+-
+-var Analyzer = &analysis.Analyzer{
+- Name: "embed",
+- Doc: Doc,
+- Requires: []*analysis.Analyzer{},
+- Run: run,
+- RunDespiteErrors: true,
+-}
+-
+-func run(pass *analysis.Pass) (interface{}, error) {
+- for _, f := range pass.Files {
+- com := hasEmbedDirectiveComment(f)
+- if com != nil {
+- assertEmbedImport(pass, com, f)
+- }
+- }
+- return nil, nil
+-}
+-
+-// Check if the comment contains //go:embed directive.
+-func hasEmbedDirectiveComment(f *ast.File) *ast.Comment {
+- for _, cg := range f.Comments {
+- for _, c := range cg.List {
+- if strings.HasPrefix(c.Text, "//go:embed ") {
+- return c
+- }
+- }
+- }
+- return nil
+-}
+-
+-// Verifies that "embed" import exists for //go:embed directive.
+-func assertEmbedImport(pass *analysis.Pass, com *ast.Comment, f *ast.File) {
+- for _, imp := range f.Imports {
+- if "\"embed\"" == imp.Path.Value {
+- return
+- }
+- }
+- pass.Report(analysis.Diagnostic{Pos: com.Pos(), End: com.Pos() + 10, Message: "The \"embed\" package must be imported when using go:embed directives."})
+-}
+diff -urN a/gopls/internal/lsp/analysis/embeddirective/embeddirective_test.go b/gopls/internal/lsp/analysis/embeddirective/embeddirective_test.go
+--- a/gopls/internal/lsp/analysis/embeddirective/embeddirective_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/embeddirective/embeddirective_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,22 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package embeddirective
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/go/analysis/analysistest"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-func Test(t *testing.T) {
+- testdata := analysistest.TestData()
+- tests := []string{"a"}
+- if typeparams.Enabled {
+- tests = append(tests)
+- }
+-
+- analysistest.RunWithSuggestedFixes(t, testdata, Analyzer, tests...)
+-}
+diff -urN a/gopls/internal/lsp/analysis/embeddirective/testdata/src/a/a.go b/gopls/internal/lsp/analysis/embeddirective/testdata/src/a/a.go
+--- a/gopls/internal/lsp/analysis/embeddirective/testdata/src/a/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/embeddirective/testdata/src/a/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-package a
+-
+-import (
+- "fmt"
+-)
+-
+-//go:embed embedText // want "The \"embed\" package must be imported when using go:embed directives"
+-var s string
+-
+-// This is main function
+-func main() {
+- fmt.Println(s)
+-}
+diff -urN a/gopls/internal/lsp/analysis/embeddirective/testdata/src/a/b.go b/gopls/internal/lsp/analysis/embeddirective/testdata/src/a/b.go
+--- a/gopls/internal/lsp/analysis/embeddirective/testdata/src/a/b.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/embeddirective/testdata/src/a/b.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+-package a
+-
+-import (
+- _ "embed"
+- "fmt"
+-)
+-
+-//go:embed embedText // ok
+-var s string
+-
+-// This is main function
+-func main() {
+- fmt.Println(s)
+-}
+diff -urN a/gopls/internal/lsp/analysis/embeddirective/testdata/src/a/embedText b/gopls/internal/lsp/analysis/embeddirective/testdata/src/a/embedText
+--- a/gopls/internal/lsp/analysis/embeddirective/testdata/src/a/embedText 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/embeddirective/testdata/src/a/embedText 1970-01-01 00:00:00.000000000 +0000
+@@ -1 +0,0 @@
+-Hello World
+\ No newline at end of file
+diff -urN a/gopls/internal/lsp/analysis/fillreturns/fillreturns.go b/gopls/internal/lsp/analysis/fillreturns/fillreturns.go
+--- a/gopls/internal/lsp/analysis/fillreturns/fillreturns.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/fillreturns/fillreturns.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,279 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package fillreturns defines an Analyzer that will attempt to
+-// automatically fill in a return statement that has missing
+-// values with zero value elements.
+-package fillreturns
+-
+-import (
+- "bytes"
+- "fmt"
+- "go/ast"
+- "go/format"
+- "go/types"
+- "regexp"
+- "strings"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/internal/analysisinternal"
+- "golang.org/x/tools/internal/fuzzy"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-const Doc = `suggest fixes for errors due to an incorrect number of return values
+-
+-This checker provides suggested fixes for type errors of the
+-type "wrong number of return values (want %d, got %d)". For example:
+- func m() (int, string, *bool, error) {
+- return
+- }
+-will turn into
+- func m() (int, string, *bool, error) {
+- return 0, "", nil, nil
+- }
+-
+-This functionality is similar to https://github.com/sqs/goreturns.
+-`
+-
+-var Analyzer = &analysis.Analyzer{
+- Name: "fillreturns",
+- Doc: Doc,
+- Requires: []*analysis.Analyzer{},
+- Run: run,
+- RunDespiteErrors: true,
+-}
+-
+-func run(pass *analysis.Pass) (interface{}, error) {
+- info := pass.TypesInfo
+- if info == nil {
+- return nil, fmt.Errorf("nil TypeInfo")
+- }
+-
+-outer:
+- for _, typeErr := range pass.TypeErrors {
+- // Filter out the errors that are not relevant to this analyzer.
+- if !FixesError(typeErr) {
+- continue
+- }
+- var file *ast.File
+- for _, f := range pass.Files {
+- if f.Pos() <= typeErr.Pos && typeErr.Pos <= f.End() {
+- file = f
+- break
+- }
+- }
+- if file == nil {
+- continue
+- }
+-
+- // Get the end position of the error.
+- // (This heuristic assumes that the buffer is formatted,
+- // at least up to the end position of the error.)
+- var buf bytes.Buffer
+- if err := format.Node(&buf, pass.Fset, file); err != nil {
+- continue
+- }
+- typeErrEndPos := analysisinternal.TypeErrorEndPos(pass.Fset, buf.Bytes(), typeErr.Pos)
+-
+- // TODO(rfindley): much of the error handling code below returns, when it
+- // should probably continue.
+-
+- // Get the path for the relevant range.
+- path, _ := astutil.PathEnclosingInterval(file, typeErr.Pos, typeErrEndPos)
+- if len(path) == 0 {
+- return nil, nil
+- }
+-
+- // Find the enclosing return statement.
+- var ret *ast.ReturnStmt
+- var retIdx int
+- for i, n := range path {
+- if r, ok := n.(*ast.ReturnStmt); ok {
+- ret = r
+- retIdx = i
+- break
+- }
+- }
+- if ret == nil {
+- return nil, nil
+- }
+-
+- // Get the function type that encloses the ReturnStmt.
+- var enclosingFunc *ast.FuncType
+- for _, n := range path[retIdx+1:] {
+- switch node := n.(type) {
+- case *ast.FuncLit:
+- enclosingFunc = node.Type
+- case *ast.FuncDecl:
+- enclosingFunc = node.Type
+- }
+- if enclosingFunc != nil {
+- break
+- }
+- }
+- if enclosingFunc == nil || enclosingFunc.Results == nil {
+- continue
+- }
+-
+- // Skip any generic enclosing functions, since type parameters don't
+- // have 0 values.
+- // TODO(rfindley): We should be able to handle this if the return
+- // values are all concrete types.
+- if tparams := typeparams.ForFuncType(enclosingFunc); tparams != nil && tparams.NumFields() > 0 {
+- return nil, nil
+- }
+-
+- // Find the function declaration that encloses the ReturnStmt.
+- var outer *ast.FuncDecl
+- for _, p := range path {
+- if p, ok := p.(*ast.FuncDecl); ok {
+- outer = p
+- break
+- }
+- }
+- if outer == nil {
+- return nil, nil
+- }
+-
+- // Skip any return statements that contain function calls with multiple
+- // return values.
+- for _, expr := range ret.Results {
+- e, ok := expr.(*ast.CallExpr)
+- if !ok {
+- continue
+- }
+- if tup, ok := info.TypeOf(e).(*types.Tuple); ok && tup.Len() > 1 {
+- continue outer
+- }
+- }
+-
+- // Duplicate the return values to track which values have been matched.
+- remaining := make([]ast.Expr, len(ret.Results))
+- copy(remaining, ret.Results)
+-
+- fixed := make([]ast.Expr, len(enclosingFunc.Results.List))
+-
+- // For each value in the return function declaration, find the leftmost element
+- // in the return statement that has the desired type. If no such element exists,
+- // fill in the missing value with the appropriate "zero" value.
+- // Beware that type information may be incomplete.
+- var retTyps []types.Type
+- for _, ret := range enclosingFunc.Results.List {
+- retTyp := info.TypeOf(ret.Type)
+- if retTyp == nil {
+- return nil, nil
+- }
+- retTyps = append(retTyps, retTyp)
+- }
+- matches := analysisinternal.MatchingIdents(retTyps, file, ret.Pos(), info, pass.Pkg)
+- for i, retTyp := range retTyps {
+- var match ast.Expr
+- var idx int
+- for j, val := range remaining {
+- if t := info.TypeOf(val); t == nil || !matchingTypes(t, retTyp) {
+- continue
+- }
+- if !analysisinternal.IsZeroValue(val) {
+- match, idx = val, j
+- break
+- }
+- // If the current match is a "zero" value, we keep searching in
+- // case we find a non-"zero" value match. If we do not find a
+- // non-"zero" value, we will use the "zero" value.
+- match, idx = val, j
+- }
+-
+- if match != nil {
+- fixed[i] = match
+- remaining = append(remaining[:idx], remaining[idx+1:]...)
+- } else {
+- names, ok := matches[retTyp]
+- if !ok {
+- return nil, fmt.Errorf("invalid return type: %v", retTyp)
+- }
+- // Find the identifier most similar to the return type.
+- // If no identifier matches the pattern, generate a zero value.
+- if best := fuzzy.BestMatch(retTyp.String(), names); best != "" {
+- fixed[i] = ast.NewIdent(best)
+- } else if zero := analysisinternal.ZeroValue(file, pass.Pkg, retTyp); zero != nil {
+- fixed[i] = zero
+- } else {
+- return nil, nil
+- }
+- }
+- }
+-
+- // Remove any non-matching "zero values" from the leftover values.
+- var nonZeroRemaining []ast.Expr
+- for _, expr := range remaining {
+- if !analysisinternal.IsZeroValue(expr) {
+- nonZeroRemaining = append(nonZeroRemaining, expr)
+- }
+- }
+- // Append leftover return values to end of new return statement.
+- fixed = append(fixed, nonZeroRemaining...)
+-
+- newRet := &ast.ReturnStmt{
+- Return: ret.Pos(),
+- Results: fixed,
+- }
+-
+- // Convert the new return statement AST to text.
+- var newBuf bytes.Buffer
+- if err := format.Node(&newBuf, pass.Fset, newRet); err != nil {
+- return nil, err
+- }
+-
+- pass.Report(analysis.Diagnostic{
+- Pos: typeErr.Pos,
+- End: typeErrEndPos,
+- Message: typeErr.Msg,
+- SuggestedFixes: []analysis.SuggestedFix{{
+- Message: "Fill in return values",
+- TextEdits: []analysis.TextEdit{{
+- Pos: ret.Pos(),
+- End: ret.End(),
+- NewText: newBuf.Bytes(),
+- }},
+- }},
+- })
+- }
+- return nil, nil
+-}
+-
+-func matchingTypes(want, got types.Type) bool {
+- if want == got || types.Identical(want, got) {
+- return true
+- }
+- // Code segment to help check for untyped equality from (golang/go#32146).
+- if rhs, ok := want.(*types.Basic); ok && rhs.Info()&types.IsUntyped > 0 {
+- if lhs, ok := got.Underlying().(*types.Basic); ok {
+- return rhs.Info()&types.IsConstType == lhs.Info()&types.IsConstType
+- }
+- }
+- return types.AssignableTo(want, got) || types.ConvertibleTo(want, got)
+-}
+-
+-// Error messages have changed across Go versions. These regexps capture recent
+-// incarnations.
+-//
+-// TODO(rfindley): once error codes are exported and exposed via go/packages,
+-// use error codes rather than string matching here.
+-var wrongReturnNumRegexes = []*regexp.Regexp{
+- regexp.MustCompile(`wrong number of return values \(want (\d+), got (\d+)\)`),
+- regexp.MustCompile(`too many return values`),
+- regexp.MustCompile(`not enough return values`),
+-}
+-
+-func FixesError(err types.Error) bool {
+- msg := strings.TrimSpace(err.Msg)
+- for _, rx := range wrongReturnNumRegexes {
+- if rx.MatchString(msg) {
+- return true
+- }
+- }
+- return false
+-}
+diff -urN a/gopls/internal/lsp/analysis/fillreturns/fillreturns_test.go b/gopls/internal/lsp/analysis/fillreturns/fillreturns_test.go
+--- a/gopls/internal/lsp/analysis/fillreturns/fillreturns_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/fillreturns/fillreturns_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,22 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fillreturns_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/go/analysis/analysistest"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/fillreturns"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-func Test(t *testing.T) {
+- testdata := analysistest.TestData()
+- tests := []string{"a"}
+- if typeparams.Enabled {
+- tests = append(tests, "typeparams")
+- }
+- analysistest.RunWithSuggestedFixes(t, testdata, fillreturns.Analyzer, tests...)
+-}
+diff -urN a/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/a.go b/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/a.go
+--- a/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,139 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fillreturns
+-
+-import (
+- "errors"
+- "go/ast"
+- ast2 "go/ast"
+- "io"
+- "net/http"
+- . "net/http"
+- "net/url"
+- "strconv"
+-)
+-
+-type T struct{}
+-type T1 = T
+-type I interface{}
+-type I1 = I
+-type z func(string, http.Handler) error
+-
+-func x() error {
+- return errors.New("foo")
+-}
+-
+-// The error messages below changed in 1.18; "return values" covers both forms.
+-
+-func b() (string, int, error) {
+- return "", errors.New("foo") // want "return values"
+-}
+-
+-func c() (string, int, error) {
+- return 7, errors.New("foo") // want "return values"
+-}
+-
+-func d() (string, int, error) {
+- return "", 7 // want "return values"
+-}
+-
+-func e() (T, error, *bool) {
+- return (z(http.ListenAndServe))("", nil) // want "return values"
+-}
+-
+-func preserveLeft() (int, int, error) {
+- return 1, errors.New("foo") // want "return values"
+-}
+-
+-func matchValues() (int, error, string) {
+- return errors.New("foo"), 3 // want "return values"
+-}
+-
+-func preventDataOverwrite() (int, string) {
+- return errors.New("foo") // want "return values"
+-}
+-
+-func closure() (string, error) {
+- _ = func() (int, error) {
+- return // want "return values"
+- }
+- return // want "return values"
+-}
+-
+-func basic() (uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64, complex64, complex128, byte, rune, uint, int, uintptr, string, bool, error) {
+- return // want "return values"
+-}
+-
+-func complex() (*int, []int, [2]int, map[int]int) {
+- return // want "return values"
+-}
+-
+-func structsAndInterfaces() (T, url.URL, T1, I, I1, io.Reader, Client, ast2.Stmt) {
+- return // want "return values"
+-}
+-
+-func m() (int, error) {
+- if 1 == 2 {
+- return // want "return values"
+- } else if 1 == 3 {
+- return errors.New("foo") // want "return values"
+- } else {
+- return 1 // want "return values"
+- }
+- return // want "return values"
+-}
+-
+-func convertibleTypes() (ast2.Expr, int) {
+- return &ast2.ArrayType{} // want "return values"
+-}
+-
+-func assignableTypes() (map[string]int, int) {
+- type X map[string]int
+- var x X
+- return x // want "return values"
+-}
+-
+-func interfaceAndError() (I, int) {
+- return errors.New("foo") // want "return values"
+-}
+-
+-func funcOneReturn() (string, error) {
+- return strconv.Itoa(1) // want "return values"
+-}
+-
+-func funcMultipleReturn() (int, error, string) {
+- return strconv.Atoi("1")
+-}
+-
+-func localFuncMultipleReturn() (string, int, error, string) {
+- return b()
+-}
+-
+-func multipleUnused() (int, string, string, string) {
+- return 3, 4, 5 // want "return values"
+-}
+-
+-func gotTooMany() int {
+- if true {
+- return 0, "" // want "return values"
+- } else {
+- return 1, 0, nil // want "return values"
+- }
+- return 0, 5, false // want "return values"
+-}
+-
+-func fillVars() (int, string, ast.Node, bool, error) {
+- eint := 0
+- s := "a"
+- var t bool
+- if true {
+- err := errors.New("fail")
+- return // want "return values"
+- }
+- n := ast.NewIdent("ident")
+- int := 3
+- var b bool
+- return "" // want "return values"
+-}
+diff -urN a/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/a.go.golden b/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/a.go.golden
+--- a/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,139 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fillreturns
+-
+-import (
+- "errors"
+- "go/ast"
+- ast2 "go/ast"
+- "io"
+- "net/http"
+- . "net/http"
+- "net/url"
+- "strconv"
+-)
+-
+-type T struct{}
+-type T1 = T
+-type I interface{}
+-type I1 = I
+-type z func(string, http.Handler) error
+-
+-func x() error {
+- return errors.New("foo")
+-}
+-
+-// The error messages below changed in 1.18; "return values" covers both forms.
+-
+-func b() (string, int, error) {
+- return "", 0, errors.New("foo") // want "return values"
+-}
+-
+-func c() (string, int, error) {
+- return "", 7, errors.New("foo") // want "return values"
+-}
+-
+-func d() (string, int, error) {
+- return "", 7, nil // want "return values"
+-}
+-
+-func e() (T, error, *bool) {
+- return T{}, (z(http.ListenAndServe))("", nil), nil // want "return values"
+-}
+-
+-func preserveLeft() (int, int, error) {
+- return 1, 0, errors.New("foo") // want "return values"
+-}
+-
+-func matchValues() (int, error, string) {
+- return 3, errors.New("foo"), "" // want "return values"
+-}
+-
+-func preventDataOverwrite() (int, string) {
+- return 0, "", errors.New("foo") // want "return values"
+-}
+-
+-func closure() (string, error) {
+- _ = func() (int, error) {
+- return 0, nil // want "return values"
+- }
+- return "", nil // want "return values"
+-}
+-
+-func basic() (uint8, uint16, uint32, uint64, int8, int16, int32, int64, float32, float64, complex64, complex128, byte, rune, uint, int, uintptr, string, bool, error) {
+- return 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "", false, nil // want "return values"
+-}
+-
+-func complex() (*int, []int, [2]int, map[int]int) {
+- return nil, nil, nil, nil // want "return values"
+-}
+-
+-func structsAndInterfaces() (T, url.URL, T1, I, I1, io.Reader, Client, ast2.Stmt) {
+- return T{}, url.URL{}, T{}, nil, nil, nil, Client{}, nil // want "return values"
+-}
+-
+-func m() (int, error) {
+- if 1 == 2 {
+- return 0, nil // want "return values"
+- } else if 1 == 3 {
+- return 0, errors.New("foo") // want "return values"
+- } else {
+- return 1, nil // want "return values"
+- }
+- return 0, nil // want "return values"
+-}
+-
+-func convertibleTypes() (ast2.Expr, int) {
+- return &ast2.ArrayType{}, 0 // want "return values"
+-}
+-
+-func assignableTypes() (map[string]int, int) {
+- type X map[string]int
+- var x X
+- return x, 0 // want "return values"
+-}
+-
+-func interfaceAndError() (I, int) {
+- return errors.New("foo"), 0 // want "return values"
+-}
+-
+-func funcOneReturn() (string, error) {
+- return strconv.Itoa(1), nil // want "return values"
+-}
+-
+-func funcMultipleReturn() (int, error, string) {
+- return strconv.Atoi("1")
+-}
+-
+-func localFuncMultipleReturn() (string, int, error, string) {
+- return b()
+-}
+-
+-func multipleUnused() (int, string, string, string) {
+- return 3, "", "", "", 4, 5 // want "return values"
+-}
+-
+-func gotTooMany() int {
+- if true {
+- return 0 // want "return values"
+- } else {
+- return 1 // want "return values"
+- }
+- return 5 // want "return values"
+-}
+-
+-func fillVars() (int, string, ast.Node, bool, error) {
+- eint := 0
+- s := "a"
+- var t bool
+- if true {
+- err := errors.New("fail")
+- return eint, s, nil, false, err // want "return values"
+- }
+- n := ast.NewIdent("ident")
+- int := 3
+- var b bool
+- return int, "", n, b, nil // want "return values"
+-}
+diff -urN a/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/typeparams/a.go b/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/typeparams/a.go
+--- a/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/typeparams/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/typeparams/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,5 +0,0 @@
+-package fillreturns
+-
+-func hello[T any]() int {
+- return
+-}
+diff -urN a/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/typeparams/a.go.golden b/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/typeparams/a.go.golden
+--- a/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/typeparams/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/fillreturns/testdata/src/a/typeparams/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,5 +0,0 @@
+-package fillreturns
+-
+-func hello[T any]() int {
+- return
+-}
+diff -urN a/gopls/internal/lsp/analysis/fillstruct/fillstruct.go b/gopls/internal/lsp/analysis/fillstruct/fillstruct.go
+--- a/gopls/internal/lsp/analysis/fillstruct/fillstruct.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/fillstruct/fillstruct.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,506 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package fillstruct defines an Analyzer that automatically
+-// fills in a struct declaration with zero value elements for each field.
+-//
+-// The analyzer's diagnostic is merely a prompt.
+-// The actual fix is created by a separate direct call from gopls to
+-// the SuggestedFixes function.
+-// Tests of Analyzer.Run can be found in ./testdata/src.
+-// Tests of the SuggestedFixes logic live in ../../testdata/fillstruct.
+-package fillstruct
+-
+-import (
+- "bytes"
+- "fmt"
+- "go/ast"
+- "go/format"
+- "go/token"
+- "go/types"
+- "strings"
+- "unicode"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/analysis/passes/inspect"
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/go/ast/inspector"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/internal/analysisinternal"
+- "golang.org/x/tools/internal/fuzzy"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-const Doc = `note incomplete struct initializations
+-
+-This analyzer provides diagnostics for any struct literals that do not have
+-any fields initialized. Because the suggested fix for this analysis is
+-expensive to compute, callers should compute it separately, using the
+-SuggestedFix function below.
+-`
+-
+-var Analyzer = &analysis.Analyzer{
+- Name: "fillstruct",
+- Doc: Doc,
+- Requires: []*analysis.Analyzer{inspect.Analyzer},
+- Run: run,
+- RunDespiteErrors: true,
+-}
+-
+-func run(pass *analysis.Pass) (interface{}, error) {
+- inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
+- nodeFilter := []ast.Node{(*ast.CompositeLit)(nil)}
+- inspect.Preorder(nodeFilter, func(n ast.Node) {
+- expr := n.(*ast.CompositeLit)
+-
+- // Find enclosing file.
+- // TODO(adonovan): use inspect.WithStack?
+- var file *ast.File
+- for _, f := range pass.Files {
+- if f.Pos() <= expr.Pos() && expr.Pos() <= f.End() {
+- file = f
+- break
+- }
+- }
+- if file == nil {
+- return
+- }
+-
+- typ := pass.TypesInfo.TypeOf(expr)
+- if typ == nil {
+- return
+- }
+-
+- // Find reference to the type declaration of the struct being initialized.
+- typ = deref(typ)
+- tStruct, ok := typ.Underlying().(*types.Struct)
+- if !ok {
+- return
+- }
+- // Inv: typ is the possibly-named struct type.
+-
+- fieldCount := tStruct.NumFields()
+-
+- // Skip any struct that is already populated or that has no fields.
+- if fieldCount == 0 || fieldCount == len(expr.Elts) {
+- return
+- }
+-
+- // Are any fields in need of filling?
+- var fillableFields []string
+- for i := 0; i < fieldCount; i++ {
+- field := tStruct.Field(i)
+- // Ignore fields that are not accessible in the current package.
+- if field.Pkg() != nil && field.Pkg() != pass.Pkg && !field.Exported() {
+- continue
+- }
+- fillableFields = append(fillableFields, fmt.Sprintf("%s: %s", field.Name(), field.Type().String()))
+- }
+- if len(fillableFields) == 0 {
+- return
+- }
+-
+- // Derive a name for the struct type.
+- var name string
+- if typ != tStruct {
+- // named struct type (e.g. pkg.S[T])
+- name = types.TypeString(typ, types.RelativeTo(pass.Pkg))
+- } else {
+- // anonymous struct type
+- totalFields := len(fillableFields)
+- const maxLen = 20
+- // Find the index to cut off printing of fields.
+- var i, fieldLen int
+- for i = range fillableFields {
+- if fieldLen > maxLen {
+- break
+- }
+- fieldLen += len(fillableFields[i])
+- }
+- fillableFields = fillableFields[:i]
+- if i < totalFields {
+- fillableFields = append(fillableFields, "...")
+- }
+- name = fmt.Sprintf("anonymous struct { %s }", strings.Join(fillableFields, ", "))
+- }
+- pass.Report(analysis.Diagnostic{
+- Message: fmt.Sprintf("Fill %s", name),
+- Pos: expr.Pos(),
+- End: expr.End(),
+- })
+- })
+- return nil, nil
+-}
+-
+-// SuggestedFix computes the suggested fix for the kinds of
+-// diagnostics produced by the Analyzer above.
+-func SuggestedFix(fset *token.FileSet, start, end token.Pos, content []byte, file *ast.File, pkg *types.Package, info *types.Info) (*analysis.SuggestedFix, error) {
+- if info == nil {
+- return nil, fmt.Errorf("nil types.Info")
+- }
+-
+- pos := start // don't use the end
+-
+- // TODO(rstambler): Using ast.Inspect would probably be more efficient than
+- // calling PathEnclosingInterval. Switch this approach.
+- path, _ := astutil.PathEnclosingInterval(file, pos, pos)
+- if len(path) == 0 {
+- return nil, fmt.Errorf("no enclosing ast.Node")
+- }
+- var expr *ast.CompositeLit
+- for _, n := range path {
+- if node, ok := n.(*ast.CompositeLit); ok {
+- expr = node
+- break
+- }
+- }
+-
+- typ := info.TypeOf(expr)
+- if typ == nil {
+- return nil, fmt.Errorf("no composite literal")
+- }
+-
+- // Find reference to the type declaration of the struct being initialized.
+- typ = deref(typ)
+- tStruct, ok := typ.Underlying().(*types.Struct)
+- if !ok {
+- return nil, fmt.Errorf("%s is not a (pointer to) struct type",
+- types.TypeString(typ, types.RelativeTo(pkg)))
+- }
+- // Inv: typ is the the possibly-named struct type.
+-
+- fieldCount := tStruct.NumFields()
+-
+- // Check which types have already been filled in. (we only want to fill in
+- // the unfilled types, or else we'll blat user-supplied details)
+- prefilledFields := map[string]ast.Expr{}
+- for _, e := range expr.Elts {
+- if kv, ok := e.(*ast.KeyValueExpr); ok {
+- if key, ok := kv.Key.(*ast.Ident); ok {
+- prefilledFields[key.Name] = kv.Value
+- }
+- }
+- }
+-
+- // Use a new fileset to build up a token.File for the new composite
+- // literal. We need one line for foo{, one line for }, and one line for
+- // each field we're going to set. format.Node only cares about line
+- // numbers, so we don't need to set columns, and each line can be
+- // 1 byte long.
+- // TODO(adonovan): why is this necessary? The position information
+- // is going to be wrong for the existing trees in prefilledFields.
+- // Can't the formatter just do its best with an empty fileset?
+- fakeFset := token.NewFileSet()
+- tok := fakeFset.AddFile("", -1, fieldCount+2)
+-
+- line := 2 // account for 1-based lines and the left brace
+- var fieldTyps []types.Type
+- for i := 0; i < fieldCount; i++ {
+- field := tStruct.Field(i)
+- // Ignore fields that are not accessible in the current package.
+- if field.Pkg() != nil && field.Pkg() != pkg && !field.Exported() {
+- fieldTyps = append(fieldTyps, nil)
+- continue
+- }
+- fieldTyps = append(fieldTyps, field.Type())
+- }
+- matches := analysisinternal.MatchingIdents(fieldTyps, file, start, info, pkg)
+- var elts []ast.Expr
+- for i, fieldTyp := range fieldTyps {
+- if fieldTyp == nil {
+- continue // TODO(adonovan): is this reachable?
+- }
+- fieldName := tStruct.Field(i).Name()
+-
+- tok.AddLine(line - 1) // add 1 byte per line
+- if line > tok.LineCount() {
+- panic(fmt.Sprintf("invalid line number %v (of %v) for fillstruct", line, tok.LineCount()))
+- }
+- pos := tok.LineStart(line)
+-
+- kv := &ast.KeyValueExpr{
+- Key: &ast.Ident{
+- NamePos: pos,
+- Name: fieldName,
+- },
+- Colon: pos,
+- }
+- if expr, ok := prefilledFields[fieldName]; ok {
+- kv.Value = expr
+- } else {
+- names, ok := matches[fieldTyp]
+- if !ok {
+- return nil, fmt.Errorf("invalid struct field type: %v", fieldTyp)
+- }
+-
+- // Find the name most similar to the field name.
+- // If no name matches the pattern, generate a zero value.
+- // NOTE: We currently match on the name of the field key rather than the field type.
+- if best := fuzzy.BestMatch(fieldName, names); best != "" {
+- kv.Value = ast.NewIdent(best)
+- } else if v := populateValue(file, pkg, fieldTyp); v != nil {
+- kv.Value = v
+- } else {
+- return nil, nil
+- }
+- }
+- elts = append(elts, kv)
+- line++
+- }
+-
+- // If all of the struct's fields are unexported, we have nothing to do.
+- if len(elts) == 0 {
+- return nil, fmt.Errorf("no elements to fill")
+- }
+-
+- // Add the final line for the right brace. Offset is the number of
+- // bytes already added plus 1.
+- tok.AddLine(len(elts) + 1)
+- line = len(elts) + 2
+- if line > tok.LineCount() {
+- panic(fmt.Sprintf("invalid line number %v (of %v) for fillstruct", line, tok.LineCount()))
+- }
+-
+- cl := &ast.CompositeLit{
+- Type: expr.Type,
+- Lbrace: tok.LineStart(1),
+- Elts: elts,
+- Rbrace: tok.LineStart(line),
+- }
+-
+- // Find the line on which the composite literal is declared.
+- split := bytes.Split(content, []byte("\n"))
+- lineNumber := safetoken.StartPosition(fset, expr.Lbrace).Line
+- firstLine := split[lineNumber-1] // lines are 1-indexed
+-
+- // Trim the whitespace from the left of the line, and use the index
+- // to get the amount of whitespace on the left.
+- trimmed := bytes.TrimLeftFunc(firstLine, unicode.IsSpace)
+- index := bytes.Index(firstLine, trimmed)
+- whitespace := firstLine[:index]
+-
+- // First pass through the formatter: turn the expr into a string.
+- var formatBuf bytes.Buffer
+- if err := format.Node(&formatBuf, fakeFset, cl); err != nil {
+- return nil, fmt.Errorf("failed to run first format on:\n%s\ngot err: %v", cl.Type, err)
+- }
+- sug := indent(formatBuf.Bytes(), whitespace)
+-
+- if len(prefilledFields) > 0 {
+- // Attempt a second pass through the formatter to line up columns.
+- sourced, err := format.Source(sug)
+- if err == nil {
+- sug = indent(sourced, whitespace)
+- }
+- }
+-
+- return &analysis.SuggestedFix{
+- TextEdits: []analysis.TextEdit{
+- {
+- Pos: expr.Pos(),
+- End: expr.End(),
+- NewText: sug,
+- },
+- },
+- }, nil
+-}
+-
+-// indent works line by line through str, indenting (prefixing) each line with
+-// ind.
+-func indent(str, ind []byte) []byte {
+- split := bytes.Split(str, []byte("\n"))
+- newText := bytes.NewBuffer(nil)
+- for i, s := range split {
+- if len(s) == 0 {
+- continue
+- }
+- // Don't add the extra indentation to the first line.
+- if i != 0 {
+- newText.Write(ind)
+- }
+- newText.Write(s)
+- if i < len(split)-1 {
+- newText.WriteByte('\n')
+- }
+- }
+- return newText.Bytes()
+-}
+-
+-// populateValue constructs an expression to fill the value of a struct field.
+-//
+-// When the type of a struct field is a basic literal or interface, we return
+-// default values. For other types, such as maps, slices, and channels, we create
+-// empty expressions such as []T{} or make(chan T) rather than using default values.
+-//
+-// The reasoning here is that users will call fillstruct with the intention of
+-// initializing the struct, in which case setting these fields to nil has no effect.
+-func populateValue(f *ast.File, pkg *types.Package, typ types.Type) ast.Expr {
+- switch u := typ.Underlying().(type) {
+- case *types.Basic:
+- switch {
+- case u.Info()&types.IsNumeric != 0:
+- return &ast.BasicLit{Kind: token.INT, Value: "0"}
+- case u.Info()&types.IsBoolean != 0:
+- return &ast.Ident{Name: "false"}
+- case u.Info()&types.IsString != 0:
+- return &ast.BasicLit{Kind: token.STRING, Value: `""`}
+- case u.Kind() == types.UnsafePointer:
+- return ast.NewIdent("nil")
+- default:
+- panic("unknown basic type")
+- }
+-
+- case *types.Map:
+- k := analysisinternal.TypeExpr(f, pkg, u.Key())
+- v := analysisinternal.TypeExpr(f, pkg, u.Elem())
+- if k == nil || v == nil {
+- return nil
+- }
+- return &ast.CompositeLit{
+- Type: &ast.MapType{
+- Key: k,
+- Value: v,
+- },
+- }
+- case *types.Slice:
+- s := analysisinternal.TypeExpr(f, pkg, u.Elem())
+- if s == nil {
+- return nil
+- }
+- return &ast.CompositeLit{
+- Type: &ast.ArrayType{
+- Elt: s,
+- },
+- }
+-
+- case *types.Array:
+- a := analysisinternal.TypeExpr(f, pkg, u.Elem())
+- if a == nil {
+- return nil
+- }
+- return &ast.CompositeLit{
+- Type: &ast.ArrayType{
+- Elt: a,
+- Len: &ast.BasicLit{
+- Kind: token.INT, Value: fmt.Sprintf("%v", u.Len()),
+- },
+- },
+- }
+-
+- case *types.Chan:
+- v := analysisinternal.TypeExpr(f, pkg, u.Elem())
+- if v == nil {
+- return nil
+- }
+- dir := ast.ChanDir(u.Dir())
+- if u.Dir() == types.SendRecv {
+- dir = ast.SEND | ast.RECV
+- }
+- return &ast.CallExpr{
+- Fun: ast.NewIdent("make"),
+- Args: []ast.Expr{
+- &ast.ChanType{
+- Dir: dir,
+- Value: v,
+- },
+- },
+- }
+-
+- case *types.Struct:
+- s := analysisinternal.TypeExpr(f, pkg, typ)
+- if s == nil {
+- return nil
+- }
+- return &ast.CompositeLit{
+- Type: s,
+- }
+-
+- case *types.Signature:
+- var params []*ast.Field
+- for i := 0; i < u.Params().Len(); i++ {
+- p := analysisinternal.TypeExpr(f, pkg, u.Params().At(i).Type())
+- if p == nil {
+- return nil
+- }
+- params = append(params, &ast.Field{
+- Type: p,
+- Names: []*ast.Ident{
+- {
+- Name: u.Params().At(i).Name(),
+- },
+- },
+- })
+- }
+- var returns []*ast.Field
+- for i := 0; i < u.Results().Len(); i++ {
+- r := analysisinternal.TypeExpr(f, pkg, u.Results().At(i).Type())
+- if r == nil {
+- return nil
+- }
+- returns = append(returns, &ast.Field{
+- Type: r,
+- })
+- }
+- return &ast.FuncLit{
+- Type: &ast.FuncType{
+- Params: &ast.FieldList{
+- List: params,
+- },
+- Results: &ast.FieldList{
+- List: returns,
+- },
+- },
+- Body: &ast.BlockStmt{},
+- }
+-
+- case *types.Pointer:
+- switch u.Elem().(type) {
+- case *types.Basic:
+- return &ast.CallExpr{
+- Fun: &ast.Ident{
+- Name: "new",
+- },
+- Args: []ast.Expr{
+- &ast.Ident{
+- Name: u.Elem().String(),
+- },
+- },
+- }
+- default:
+- return &ast.UnaryExpr{
+- Op: token.AND,
+- X: populateValue(f, pkg, u.Elem()),
+- }
+- }
+-
+- case *types.Interface:
+- if param, ok := typ.(*typeparams.TypeParam); ok {
+- // *new(T) is the zero value of a type parameter T.
+- // TODO(adonovan): one could give a more specific zero
+- // value if the type has a core type that is, say,
+- // always a number or a pointer. See go/ssa for details.
+- return &ast.StarExpr{
+- X: &ast.CallExpr{
+- Fun: ast.NewIdent("new"),
+- Args: []ast.Expr{
+- ast.NewIdent(param.Obj().Name()),
+- },
+- },
+- }
+- }
+-
+- return ast.NewIdent("nil")
+- }
+- return nil
+-}
+-
+-func deref(t types.Type) types.Type {
+- for {
+- ptr, ok := t.Underlying().(*types.Pointer)
+- if !ok {
+- return t
+- }
+- t = ptr.Elem()
+- }
+-}
+diff -urN a/gopls/internal/lsp/analysis/fillstruct/fillstruct_test.go b/gopls/internal/lsp/analysis/fillstruct/fillstruct_test.go
+--- a/gopls/internal/lsp/analysis/fillstruct/fillstruct_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/fillstruct/fillstruct_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,22 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fillstruct_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/go/analysis/analysistest"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/fillstruct"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-func Test(t *testing.T) {
+- testdata := analysistest.TestData()
+- tests := []string{"a"}
+- if typeparams.Enabled {
+- tests = append(tests, "typeparams")
+- }
+- analysistest.Run(t, testdata, fillstruct.Analyzer, tests...)
+-}
+diff -urN a/gopls/internal/lsp/analysis/fillstruct/testdata/src/a/a.go b/gopls/internal/lsp/analysis/fillstruct/testdata/src/a/a.go
+--- a/gopls/internal/lsp/analysis/fillstruct/testdata/src/a/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/fillstruct/testdata/src/a/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,113 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fillstruct
+-
+-import (
+- data "b"
+- "go/ast"
+- "go/token"
+- "unsafe"
+-)
+-
+-type emptyStruct struct{}
+-
+-var _ = emptyStruct{}
+-
+-type basicStruct struct {
+- foo int
+-}
+-
+-var _ = basicStruct{} // want `Fill basicStruct`
+-
+-type twoArgStruct struct {
+- foo int
+- bar string
+-}
+-
+-var _ = twoArgStruct{} // want `Fill twoArgStruct`
+-
+-var _ = twoArgStruct{ // want `Fill twoArgStruct`
+- bar: "bar",
+-}
+-
+-type nestedStruct struct {
+- bar string
+- basic basicStruct
+-}
+-
+-var _ = nestedStruct{} // want `Fill nestedStruct`
+-
+-var _ = data.B{} // want `Fill b.B`
+-
+-type typedStruct struct {
+- m map[string]int
+- s []int
+- c chan int
+- c1 <-chan int
+- a [2]string
+-}
+-
+-var _ = typedStruct{} // want `Fill typedStruct`
+-
+-type funStruct struct {
+- fn func(i int) int
+-}
+-
+-var _ = funStruct{} // want `Fill funStruct`
+-
+-type funStructComplex struct {
+- fn func(i int, s string) (string, int)
+-}
+-
+-var _ = funStructComplex{} // want `Fill funStructComplex`
+-
+-type funStructEmpty struct {
+- fn func()
+-}
+-
+-var _ = funStructEmpty{} // want `Fill funStructEmpty`
+-
+-type Foo struct {
+- A int
+-}
+-
+-type Bar struct {
+- X *Foo
+- Y *Foo
+-}
+-
+-var _ = Bar{} // want `Fill Bar`
+-
+-type importedStruct struct {
+- m map[*ast.CompositeLit]ast.Field
+- s []ast.BadExpr
+- a [3]token.Token
+- c chan ast.EmptyStmt
+- fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+- st ast.CompositeLit
+-}
+-
+-var _ = importedStruct{} // want `Fill importedStruct`
+-
+-type pointerBuiltinStruct struct {
+- b *bool
+- s *string
+- i *int
+-}
+-
+-var _ = pointerBuiltinStruct{} // want `Fill pointerBuiltinStruct`
+-
+-var _ = []ast.BasicLit{
+- {}, // want `Fill go/ast.BasicLit`
+-}
+-
+-var _ = []ast.BasicLit{{}, // want "go/ast.BasicLit"
+-}
+-
+-type unsafeStruct struct {
+- foo unsafe.Pointer
+-}
+-
+-var _ = unsafeStruct{} // want `Fill unsafeStruct`
+diff -urN a/gopls/internal/lsp/analysis/fillstruct/testdata/src/b/b.go b/gopls/internal/lsp/analysis/fillstruct/testdata/src/b/b.go
+--- a/gopls/internal/lsp/analysis/fillstruct/testdata/src/b/b.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/fillstruct/testdata/src/b/b.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-package fillstruct
+-
+-type B struct {
+- ExportedInt int
+- unexportedInt int
+-}
+diff -urN a/gopls/internal/lsp/analysis/fillstruct/testdata/src/typeparams/typeparams.go b/gopls/internal/lsp/analysis/fillstruct/testdata/src/typeparams/typeparams.go
+--- a/gopls/internal/lsp/analysis/fillstruct/testdata/src/typeparams/typeparams.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/fillstruct/testdata/src/typeparams/typeparams.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,50 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fillstruct
+-
+-type emptyStruct[A any] struct{}
+-
+-var _ = emptyStruct[int]{}
+-
+-type basicStruct[T any] struct {
+- foo T
+-}
+-
+-var _ = basicStruct[int]{} // want `Fill basicStruct\[int\]`
+-
+-type twoArgStruct[F, B any] struct {
+- foo F
+- bar B
+-}
+-
+-var _ = twoArgStruct[string, int]{} // want `Fill twoArgStruct\[string, int\]`
+-
+-var _ = twoArgStruct[int, string]{ // want `Fill twoArgStruct\[int, string\]`
+- bar: "bar",
+-}
+-
+-type nestedStruct struct {
+- bar string
+- basic basicStruct[int]
+-}
+-
+-var _ = nestedStruct{} // want "Fill nestedStruct"
+-
+-func _[T any]() {
+- type S struct{ t T }
+- x := S{} // want "Fill S"
+- _ = x
+-}
+-
+-func Test() {
+- var tests = []struct {
+- a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p string
+- }{
+- {}, // want "Fill anonymous struct { a: string, b: string, c: string, ... }"
+- }
+- for _, test := range tests {
+- _ = test
+- }
+-}
+diff -urN a/gopls/internal/lsp/analysis/infertypeargs/infertypeargs.go b/gopls/internal/lsp/analysis/infertypeargs/infertypeargs.go
+--- a/gopls/internal/lsp/analysis/infertypeargs/infertypeargs.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/infertypeargs/infertypeargs.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,31 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package infertypeargs defines an analyzer that checks for explicit function
+-// arguments that could be inferred.
+-package infertypeargs
+-
+-import (
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/analysis/passes/inspect"
+-)
+-
+-const Doc = `check for unnecessary type arguments in call expressions
+-
+-Explicit type arguments may be omitted from call expressions if they can be
+-inferred from function arguments, or from other type arguments:
+-
+- func f[T any](T) {}
+-
+- func _() {
+- f[string]("foo") // string could be inferred
+- }
+-`
+-
+-var Analyzer = &analysis.Analyzer{
+- Name: "infertypeargs",
+- Doc: Doc,
+- Requires: []*analysis.Analyzer{inspect.Analyzer},
+- Run: run,
+-}
+diff -urN a/gopls/internal/lsp/analysis/infertypeargs/infertypeargs_test.go b/gopls/internal/lsp/analysis/infertypeargs/infertypeargs_test.go
+--- a/gopls/internal/lsp/analysis/infertypeargs/infertypeargs_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/infertypeargs/infertypeargs_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,21 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package infertypeargs_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/go/analysis/analysistest"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/infertypeargs"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-func Test(t *testing.T) {
+- if !typeparams.Enabled {
+- t.Skip("type params are not enabled")
+- }
+- testdata := analysistest.TestData()
+- analysistest.RunWithSuggestedFixes(t, testdata, infertypeargs.Analyzer, "a")
+-}
+diff -urN a/gopls/internal/lsp/analysis/infertypeargs/run_go117.go b/gopls/internal/lsp/analysis/infertypeargs/run_go117.go
+--- a/gopls/internal/lsp/analysis/infertypeargs/run_go117.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/infertypeargs/run_go117.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build !go1.18
+-// +build !go1.18
+-
+-package infertypeargs
+-
+-import "golang.org/x/tools/go/analysis"
+-
+-// This analyzer only relates to go1.18+, and uses the types.CheckExpr API that
+-// was added in Go 1.13.
+-func run(pass *analysis.Pass) (interface{}, error) {
+- return nil, nil
+-}
+diff -urN a/gopls/internal/lsp/analysis/infertypeargs/run_go118.go b/gopls/internal/lsp/analysis/infertypeargs/run_go118.go
+--- a/gopls/internal/lsp/analysis/infertypeargs/run_go118.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/infertypeargs/run_go118.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,111 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package infertypeargs
+-
+-import (
+- "go/ast"
+- "go/token"
+- "go/types"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/analysis/passes/inspect"
+- "golang.org/x/tools/go/ast/inspector"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-func run(pass *analysis.Pass) (interface{}, error) {
+- inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
+-
+- nodeFilter := []ast.Node{
+- (*ast.CallExpr)(nil),
+- }
+-
+- inspect.Preorder(nodeFilter, func(node ast.Node) {
+- call := node.(*ast.CallExpr)
+- x, lbrack, indices, rbrack := typeparams.UnpackIndexExpr(call.Fun)
+- ident := calledIdent(x)
+- if ident == nil || len(indices) == 0 {
+- return // no explicit args, nothing to do
+- }
+-
+- // Confirm that instantiation actually occurred at this ident.
+- idata, ok := typeparams.GetInstances(pass.TypesInfo)[ident]
+- if !ok {
+- return // something went wrong, but fail open
+- }
+- instance := idata.Type
+-
+- // Start removing argument expressions from the right, and check if we can
+- // still infer the call expression.
+- required := len(indices) // number of type expressions that are required
+- for i := len(indices) - 1; i >= 0; i-- {
+- var fun ast.Expr
+- if i == 0 {
+- // No longer an index expression: just use the parameterized operand.
+- fun = x
+- } else {
+- fun = typeparams.PackIndexExpr(x, lbrack, indices[:i], indices[i-1].End())
+- }
+- newCall := &ast.CallExpr{
+- Fun: fun,
+- Lparen: call.Lparen,
+- Args: call.Args,
+- Ellipsis: call.Ellipsis,
+- Rparen: call.Rparen,
+- }
+- info := new(types.Info)
+- typeparams.InitInstanceInfo(info)
+- if err := types.CheckExpr(pass.Fset, pass.Pkg, call.Pos(), newCall, info); err != nil {
+- // Most likely inference failed.
+- break
+- }
+- newIData := typeparams.GetInstances(info)[ident]
+- newInstance := newIData.Type
+- if !types.Identical(instance, newInstance) {
+- // The inferred result type does not match the original result type, so
+- // this simplification is not valid.
+- break
+- }
+- required = i
+- }
+- if required < len(indices) {
+- var start, end token.Pos
+- var edit analysis.TextEdit
+- if required == 0 {
+- start, end = lbrack, rbrack+1 // erase the entire index
+- edit = analysis.TextEdit{Pos: start, End: end}
+- } else {
+- start = indices[required].Pos()
+- end = rbrack
+- // erase from end of last arg to include last comma & white-spaces
+- edit = analysis.TextEdit{Pos: indices[required-1].End(), End: end}
+- }
+- pass.Report(analysis.Diagnostic{
+- Pos: start,
+- End: end,
+- Message: "unnecessary type arguments",
+- SuggestedFixes: []analysis.SuggestedFix{{
+- Message: "simplify type arguments",
+- TextEdits: []analysis.TextEdit{edit},
+- }},
+- })
+- }
+- })
+-
+- return nil, nil
+-}
+-
+-func calledIdent(x ast.Expr) *ast.Ident {
+- switch x := x.(type) {
+- case *ast.Ident:
+- return x
+- case *ast.SelectorExpr:
+- return x.Sel
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/basic.go b/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/basic.go
+--- a/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/basic.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/basic.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,20 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// This file contains tests for the infertyepargs checker.
+-
+-package a
+-
+-func f[T any](T) {}
+-
+-func g[T any]() T { var x T; return x }
+-
+-func h[P interface{ ~*T }, T any]() {}
+-
+-func _() {
+- f[string]("hello") // want "unnecessary type arguments"
+- f[int](2) // want "unnecessary type arguments"
+- _ = g[int]()
+- h[*int, int]() // want "unnecessary type arguments"
+-}
+diff -urN a/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/basic.go.golden b/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/basic.go.golden
+--- a/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/basic.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/basic.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,20 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// This file contains tests for the infertyepargs checker.
+-
+-package a
+-
+-func f[T any](T) {}
+-
+-func g[T any]() T { var x T; return x }
+-
+-func h[P interface{ ~*T }, T any]() {}
+-
+-func _() {
+- f("hello") // want "unnecessary type arguments"
+- f(2) // want "unnecessary type arguments"
+- _ = g[int]()
+- h[*int]() // want "unnecessary type arguments"
+-}
+diff -urN a/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/imported/imported.go b/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/imported/imported.go
+--- a/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/imported/imported.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/imported/imported.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package imported
+-
+-func F[T any](T) {}
+diff -urN a/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/imported.go b/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/imported.go
+--- a/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/imported.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/imported.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package a
+-
+-import "a/imported"
+-
+-func _() {
+- var x int
+- imported.F[int](x) // want "unnecessary type arguments"
+-}
+diff -urN a/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/imported.go.golden b/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/imported.go.golden
+--- a/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/imported.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/imported.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package a
+-
+-import "a/imported"
+-
+-func _() {
+- var x int
+- imported.F(x) // want "unnecessary type arguments"
+-}
+diff -urN a/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/notypechange.go b/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/notypechange.go
+--- a/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/notypechange.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/notypechange.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,26 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// We should not suggest removing type arguments if doing so would change the
+-// resulting type.
+-
+-package a
+-
+-func id[T any](t T) T { return t }
+-
+-var _ = id[int](1) // want "unnecessary type arguments"
+-var _ = id[string]("foo") // want "unnecessary type arguments"
+-var _ = id[int64](2)
+-
+-func pair[T any](t T) (T, T) { return t, t }
+-
+-var _, _ = pair[int](3) // want "unnecessary type arguments"
+-var _, _ = pair[int64](3)
+-
+-func noreturn[T any](t T) {}
+-
+-func _() {
+- noreturn[int64](4)
+- noreturn[int](4) // want "unnecessary type arguments"
+-}
+diff -urN a/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/notypechange.go.golden b/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/notypechange.go.golden
+--- a/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/notypechange.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/infertypeargs/testdata/src/a/notypechange.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,26 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// We should not suggest removing type arguments if doing so would change the
+-// resulting type.
+-
+-package a
+-
+-func id[T any](t T) T { return t }
+-
+-var _ = id(1) // want "unnecessary type arguments"
+-var _ = id("foo") // want "unnecessary type arguments"
+-var _ = id[int64](2)
+-
+-func pair[T any](t T) (T, T) { return t, t }
+-
+-var _, _ = pair(3) // want "unnecessary type arguments"
+-var _, _ = pair[int64](3)
+-
+-func noreturn[T any](t T) {}
+-
+-func _() {
+- noreturn[int64](4)
+- noreturn(4) // want "unnecessary type arguments"
+-}
+diff -urN a/gopls/internal/lsp/analysis/nonewvars/nonewvars.go b/gopls/internal/lsp/analysis/nonewvars/nonewvars.go
+--- a/gopls/internal/lsp/analysis/nonewvars/nonewvars.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/nonewvars/nonewvars.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,95 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package nonewvars defines an Analyzer that applies suggested fixes
+-// to errors of the type "no new variables on left side of :=".
+-package nonewvars
+-
+-import (
+- "bytes"
+- "go/ast"
+- "go/format"
+- "go/token"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/analysis/passes/inspect"
+- "golang.org/x/tools/go/ast/inspector"
+- "golang.org/x/tools/internal/analysisinternal"
+-)
+-
+-const Doc = `suggested fixes for "no new vars on left side of :="
+-
+-This checker provides suggested fixes for type errors of the
+-type "no new vars on left side of :=". For example:
+- z := 1
+- z := 2
+-will turn into
+- z := 1
+- z = 2
+-`
+-
+-var Analyzer = &analysis.Analyzer{
+- Name: "nonewvars",
+- Doc: Doc,
+- Requires: []*analysis.Analyzer{inspect.Analyzer},
+- Run: run,
+- RunDespiteErrors: true,
+-}
+-
+-func run(pass *analysis.Pass) (interface{}, error) {
+- inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
+- if len(pass.TypeErrors) == 0 {
+- return nil, nil
+- }
+-
+- nodeFilter := []ast.Node{(*ast.AssignStmt)(nil)}
+- inspect.Preorder(nodeFilter, func(n ast.Node) {
+- assignStmt, _ := n.(*ast.AssignStmt)
+- // We only care about ":=".
+- if assignStmt.Tok != token.DEFINE {
+- return
+- }
+-
+- var file *ast.File
+- for _, f := range pass.Files {
+- if f.Pos() <= assignStmt.Pos() && assignStmt.Pos() < f.End() {
+- file = f
+- break
+- }
+- }
+- if file == nil {
+- return
+- }
+-
+- for _, err := range pass.TypeErrors {
+- if !FixesError(err.Msg) {
+- continue
+- }
+- if assignStmt.Pos() > err.Pos || err.Pos >= assignStmt.End() {
+- continue
+- }
+- var buf bytes.Buffer
+- if err := format.Node(&buf, pass.Fset, file); err != nil {
+- continue
+- }
+- pass.Report(analysis.Diagnostic{
+- Pos: err.Pos,
+- End: analysisinternal.TypeErrorEndPos(pass.Fset, buf.Bytes(), err.Pos),
+- Message: err.Msg,
+- SuggestedFixes: []analysis.SuggestedFix{{
+- Message: "Change ':=' to '='",
+- TextEdits: []analysis.TextEdit{{
+- Pos: err.Pos,
+- End: err.Pos + 1,
+- }},
+- }},
+- })
+- }
+- })
+- return nil, nil
+-}
+-
+-func FixesError(msg string) bool {
+- return msg == "no new variables on left side of :="
+-}
+diff -urN a/gopls/internal/lsp/analysis/nonewvars/nonewvars_test.go b/gopls/internal/lsp/analysis/nonewvars/nonewvars_test.go
+--- a/gopls/internal/lsp/analysis/nonewvars/nonewvars_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/nonewvars/nonewvars_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,22 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package nonewvars_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/go/analysis/analysistest"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/nonewvars"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-func Test(t *testing.T) {
+- testdata := analysistest.TestData()
+- tests := []string{"a"}
+- if typeparams.Enabled {
+- tests = append(tests, "typeparams")
+- }
+- analysistest.RunWithSuggestedFixes(t, testdata, nonewvars.Analyzer, tests...)
+-}
+diff -urN a/gopls/internal/lsp/analysis/nonewvars/testdata/src/a/a.go b/gopls/internal/lsp/analysis/nonewvars/testdata/src/a/a.go
+--- a/gopls/internal/lsp/analysis/nonewvars/testdata/src/a/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/nonewvars/testdata/src/a/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package nonewvars
+-
+-import "log"
+-
+-func x() {
+- z := 1
+- z := 2 // want "no new variables on left side of :="
+-
+- _, z := 3, 100 // want "no new variables on left side of :="
+-
+- log.Println(z)
+-}
+diff -urN a/gopls/internal/lsp/analysis/nonewvars/testdata/src/a/a.go.golden b/gopls/internal/lsp/analysis/nonewvars/testdata/src/a/a.go.golden
+--- a/gopls/internal/lsp/analysis/nonewvars/testdata/src/a/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/nonewvars/testdata/src/a/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package nonewvars
+-
+-import "log"
+-
+-func x() {
+- z := 1
+- z = 2 // want "no new variables on left side of :="
+-
+- _, z = 3, 100 // want "no new variables on left side of :="
+-
+- log.Println(z)
+-}
+diff -urN a/gopls/internal/lsp/analysis/nonewvars/testdata/src/typeparams/a.go b/gopls/internal/lsp/analysis/nonewvars/testdata/src/typeparams/a.go
+--- a/gopls/internal/lsp/analysis/nonewvars/testdata/src/typeparams/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/nonewvars/testdata/src/typeparams/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-package nonewvars
+-
+-func hello[T any]() int {
+- var z T
+- z := 1 // want "no new variables on left side of :="
+-}
+diff -urN a/gopls/internal/lsp/analysis/nonewvars/testdata/src/typeparams/a.go.golden b/gopls/internal/lsp/analysis/nonewvars/testdata/src/typeparams/a.go.golden
+--- a/gopls/internal/lsp/analysis/nonewvars/testdata/src/typeparams/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/nonewvars/testdata/src/typeparams/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-package nonewvars
+-
+-func hello[T any]() int {
+- var z T
+- z = 1 // want "no new variables on left side of :="
+-}
+diff -urN a/gopls/internal/lsp/analysis/noresultvalues/noresultvalues.go b/gopls/internal/lsp/analysis/noresultvalues/noresultvalues.go
+--- a/gopls/internal/lsp/analysis/noresultvalues/noresultvalues.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/noresultvalues/noresultvalues.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,92 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package noresultvalues defines an Analyzer that applies suggested fixes
+-// to errors of the type "no result values expected".
+-package noresultvalues
+-
+-import (
+- "bytes"
+- "go/ast"
+- "go/format"
+- "strings"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/analysis/passes/inspect"
+- "golang.org/x/tools/go/ast/inspector"
+- "golang.org/x/tools/internal/analysisinternal"
+-)
+-
+-const Doc = `suggested fixes for unexpected return values
+-
+-This checker provides suggested fixes for type errors of the
+-type "no result values expected" or "too many return values".
+-For example:
+- func z() { return nil }
+-will turn into
+- func z() { return }
+-`
+-
+-var Analyzer = &analysis.Analyzer{
+- Name: "noresultvalues",
+- Doc: Doc,
+- Requires: []*analysis.Analyzer{inspect.Analyzer},
+- Run: run,
+- RunDespiteErrors: true,
+-}
+-
+-func run(pass *analysis.Pass) (interface{}, error) {
+- inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
+- if len(pass.TypeErrors) == 0 {
+- return nil, nil
+- }
+-
+- nodeFilter := []ast.Node{(*ast.ReturnStmt)(nil)}
+- inspect.Preorder(nodeFilter, func(n ast.Node) {
+- retStmt, _ := n.(*ast.ReturnStmt)
+-
+- var file *ast.File
+- for _, f := range pass.Files {
+- if f.Pos() <= retStmt.Pos() && retStmt.Pos() < f.End() {
+- file = f
+- break
+- }
+- }
+- if file == nil {
+- return
+- }
+-
+- for _, err := range pass.TypeErrors {
+- if !FixesError(err.Msg) {
+- continue
+- }
+- if retStmt.Pos() >= err.Pos || err.Pos >= retStmt.End() {
+- continue
+- }
+- var buf bytes.Buffer
+- if err := format.Node(&buf, pass.Fset, file); err != nil {
+- continue
+- }
+- pass.Report(analysis.Diagnostic{
+- Pos: err.Pos,
+- End: analysisinternal.TypeErrorEndPos(pass.Fset, buf.Bytes(), err.Pos),
+- Message: err.Msg,
+- SuggestedFixes: []analysis.SuggestedFix{{
+- Message: "Delete return values",
+- TextEdits: []analysis.TextEdit{{
+- Pos: retStmt.Pos(),
+- End: retStmt.End(),
+- NewText: []byte("return"),
+- }},
+- }},
+- })
+- }
+- })
+- return nil, nil
+-}
+-
+-func FixesError(msg string) bool {
+- return msg == "no result values expected" ||
+- strings.HasPrefix(msg, "too many return values") && strings.Contains(msg, "want ()")
+-}
+diff -urN a/gopls/internal/lsp/analysis/noresultvalues/noresultvalues_test.go b/gopls/internal/lsp/analysis/noresultvalues/noresultvalues_test.go
+--- a/gopls/internal/lsp/analysis/noresultvalues/noresultvalues_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/noresultvalues/noresultvalues_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,22 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package noresultvalues_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/go/analysis/analysistest"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/noresultvalues"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-func Test(t *testing.T) {
+- testdata := analysistest.TestData()
+- tests := []string{"a"}
+- if typeparams.Enabled {
+- tests = append(tests, "typeparams")
+- }
+- analysistest.RunWithSuggestedFixes(t, testdata, noresultvalues.Analyzer, tests...)
+-}
+diff -urN a/gopls/internal/lsp/analysis/noresultvalues/testdata/src/a/a.go b/gopls/internal/lsp/analysis/noresultvalues/testdata/src/a/a.go
+--- a/gopls/internal/lsp/analysis/noresultvalues/testdata/src/a/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/noresultvalues/testdata/src/a/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package noresultvalues
+-
+-func x() { return nil } // want `no result values expected|too many return values`
+-
+-func y() { return nil, "hello" } // want `no result values expected|too many return values`
+diff -urN a/gopls/internal/lsp/analysis/noresultvalues/testdata/src/a/a.go.golden b/gopls/internal/lsp/analysis/noresultvalues/testdata/src/a/a.go.golden
+--- a/gopls/internal/lsp/analysis/noresultvalues/testdata/src/a/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/noresultvalues/testdata/src/a/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package noresultvalues
+-
+-func x() { return } // want `no result values expected|too many return values`
+-
+-func y() { return } // want `no result values expected|too many return values`
+diff -urN a/gopls/internal/lsp/analysis/noresultvalues/testdata/src/typeparams/a.go b/gopls/internal/lsp/analysis/noresultvalues/testdata/src/typeparams/a.go
+--- a/gopls/internal/lsp/analysis/noresultvalues/testdata/src/typeparams/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/noresultvalues/testdata/src/typeparams/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-package noresult
+-
+-func hello[T any]() {
+- var z T
+- return z // want `no result values expected|too many return values`
+-}
+diff -urN a/gopls/internal/lsp/analysis/noresultvalues/testdata/src/typeparams/a.go.golden b/gopls/internal/lsp/analysis/noresultvalues/testdata/src/typeparams/a.go.golden
+--- a/gopls/internal/lsp/analysis/noresultvalues/testdata/src/typeparams/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/noresultvalues/testdata/src/typeparams/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-package noresult
+-
+-func hello[T any]() {
+- var z T
+- return // want `no result values expected|too many return values`
+-}
+diff -urN a/gopls/internal/lsp/analysis/simplifycompositelit/simplifycompositelit.go b/gopls/internal/lsp/analysis/simplifycompositelit/simplifycompositelit.go
+--- a/gopls/internal/lsp/analysis/simplifycompositelit/simplifycompositelit.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/simplifycompositelit/simplifycompositelit.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,196 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package simplifycompositelit defines an Analyzer that simplifies composite literals.
+-// https://github.com/golang/go/blob/master/src/cmd/gofmt/simplify.go
+-// https://golang.org/cmd/gofmt/#hdr-The_simplify_command
+-package simplifycompositelit
+-
+-import (
+- "bytes"
+- "fmt"
+- "go/ast"
+- "go/printer"
+- "go/token"
+- "reflect"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/analysis/passes/inspect"
+- "golang.org/x/tools/go/ast/inspector"
+-)
+-
+-const Doc = `check for composite literal simplifications
+-
+-An array, slice, or map composite literal of the form:
+- []T{T{}, T{}}
+-will be simplified to:
+- []T{{}, {}}
+-
+-This is one of the simplifications that "gofmt -s" applies.`
+-
+-var Analyzer = &analysis.Analyzer{
+- Name: "simplifycompositelit",
+- Doc: Doc,
+- Requires: []*analysis.Analyzer{inspect.Analyzer},
+- Run: run,
+-}
+-
+-func run(pass *analysis.Pass) (interface{}, error) {
+- inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
+- nodeFilter := []ast.Node{(*ast.CompositeLit)(nil)}
+- inspect.Preorder(nodeFilter, func(n ast.Node) {
+- expr := n.(*ast.CompositeLit)
+-
+- outer := expr
+- var keyType, eltType ast.Expr
+- switch typ := outer.Type.(type) {
+- case *ast.ArrayType:
+- eltType = typ.Elt
+- case *ast.MapType:
+- keyType = typ.Key
+- eltType = typ.Value
+- }
+-
+- if eltType == nil {
+- return
+- }
+- var ktyp reflect.Value
+- if keyType != nil {
+- ktyp = reflect.ValueOf(keyType)
+- }
+- typ := reflect.ValueOf(eltType)
+- for _, x := range outer.Elts {
+- // look at value of indexed/named elements
+- if t, ok := x.(*ast.KeyValueExpr); ok {
+- if keyType != nil {
+- simplifyLiteral(pass, ktyp, keyType, t.Key)
+- }
+- x = t.Value
+- }
+- simplifyLiteral(pass, typ, eltType, x)
+- }
+- })
+- return nil, nil
+-}
+-
+-func simplifyLiteral(pass *analysis.Pass, typ reflect.Value, astType, x ast.Expr) {
+- // if the element is a composite literal and its literal type
+- // matches the outer literal's element type exactly, the inner
+- // literal type may be omitted
+- if inner, ok := x.(*ast.CompositeLit); ok && match(typ, reflect.ValueOf(inner.Type)) {
+- var b bytes.Buffer
+- printer.Fprint(&b, pass.Fset, inner.Type)
+- createDiagnostic(pass, inner.Type.Pos(), inner.Type.End(), b.String())
+- }
+- // if the outer literal's element type is a pointer type *T
+- // and the element is & of a composite literal of type T,
+- // the inner &T may be omitted.
+- if ptr, ok := astType.(*ast.StarExpr); ok {
+- if addr, ok := x.(*ast.UnaryExpr); ok && addr.Op == token.AND {
+- if inner, ok := addr.X.(*ast.CompositeLit); ok {
+- if match(reflect.ValueOf(ptr.X), reflect.ValueOf(inner.Type)) {
+- var b bytes.Buffer
+- printer.Fprint(&b, pass.Fset, inner.Type)
+- // Account for the & by subtracting 1 from typ.Pos().
+- createDiagnostic(pass, inner.Type.Pos()-1, inner.Type.End(), "&"+b.String())
+- }
+- }
+- }
+- }
+-}
+-
+-func createDiagnostic(pass *analysis.Pass, start, end token.Pos, typ string) {
+- pass.Report(analysis.Diagnostic{
+- Pos: start,
+- End: end,
+- Message: "redundant type from array, slice, or map composite literal",
+- SuggestedFixes: []analysis.SuggestedFix{{
+- Message: fmt.Sprintf("Remove '%s'", typ),
+- TextEdits: []analysis.TextEdit{{
+- Pos: start,
+- End: end,
+- NewText: []byte{},
+- }},
+- }},
+- })
+-}
+-
+-// match reports whether pattern matches val,
+-// recording wildcard submatches in m.
+-// If m == nil, match checks whether pattern == val.
+-// from https://github.com/golang/go/blob/26154f31ad6c801d8bad5ef58df1e9263c6beec7/src/cmd/gofmt/rewrite.go#L160
+-func match(pattern, val reflect.Value) bool {
+- // Otherwise, pattern and val must match recursively.
+- if !pattern.IsValid() || !val.IsValid() {
+- return !pattern.IsValid() && !val.IsValid()
+- }
+- if pattern.Type() != val.Type() {
+- return false
+- }
+-
+- // Special cases.
+- switch pattern.Type() {
+- case identType:
+- // For identifiers, only the names need to match
+- // (and none of the other *ast.Object information).
+- // This is a common case, handle it all here instead
+- // of recursing down any further via reflection.
+- p := pattern.Interface().(*ast.Ident)
+- v := val.Interface().(*ast.Ident)
+- return p == nil && v == nil || p != nil && v != nil && p.Name == v.Name
+- case objectPtrType, positionType:
+- // object pointers and token positions always match
+- return true
+- case callExprType:
+- // For calls, the Ellipsis fields (token.Position) must
+- // match since that is how f(x) and f(x...) are different.
+- // Check them here but fall through for the remaining fields.
+- p := pattern.Interface().(*ast.CallExpr)
+- v := val.Interface().(*ast.CallExpr)
+- if p.Ellipsis.IsValid() != v.Ellipsis.IsValid() {
+- return false
+- }
+- }
+-
+- p := reflect.Indirect(pattern)
+- v := reflect.Indirect(val)
+- if !p.IsValid() || !v.IsValid() {
+- return !p.IsValid() && !v.IsValid()
+- }
+-
+- switch p.Kind() {
+- case reflect.Slice:
+- if p.Len() != v.Len() {
+- return false
+- }
+- for i := 0; i < p.Len(); i++ {
+- if !match(p.Index(i), v.Index(i)) {
+- return false
+- }
+- }
+- return true
+-
+- case reflect.Struct:
+- for i := 0; i < p.NumField(); i++ {
+- if !match(p.Field(i), v.Field(i)) {
+- return false
+- }
+- }
+- return true
+-
+- case reflect.Interface:
+- return match(p.Elem(), v.Elem())
+- }
+-
+- // Handle token integers, etc.
+- return p.Interface() == v.Interface()
+-}
+-
+-// Values/types for special cases.
+-var (
+- identType = reflect.TypeOf((*ast.Ident)(nil))
+- objectPtrType = reflect.TypeOf((*ast.Object)(nil))
+- positionType = reflect.TypeOf(token.NoPos)
+- callExprType = reflect.TypeOf((*ast.CallExpr)(nil))
+-)
+diff -urN a/gopls/internal/lsp/analysis/simplifycompositelit/simplifycompositelit_test.go b/gopls/internal/lsp/analysis/simplifycompositelit/simplifycompositelit_test.go
+--- a/gopls/internal/lsp/analysis/simplifycompositelit/simplifycompositelit_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/simplifycompositelit/simplifycompositelit_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,17 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package simplifycompositelit_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/go/analysis/analysistest"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/simplifycompositelit"
+-)
+-
+-func Test(t *testing.T) {
+- testdata := analysistest.TestData()
+- analysistest.RunWithSuggestedFixes(t, testdata, simplifycompositelit.Analyzer, "a")
+-}
+diff -urN a/gopls/internal/lsp/analysis/simplifycompositelit/testdata/src/a/a.go b/gopls/internal/lsp/analysis/simplifycompositelit/testdata/src/a/a.go
+--- a/gopls/internal/lsp/analysis/simplifycompositelit/testdata/src/a/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/simplifycompositelit/testdata/src/a/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,234 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package testdata
+-
+-type T struct {
+- x, y int
+-}
+-
+-type T2 struct {
+- w, z int
+-}
+-
+-var _ = [42]T{
+- T{}, // want "redundant type from array, slice, or map composite literal"
+- T{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- T{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = [...]T{
+- T{}, // want "redundant type from array, slice, or map composite literal"
+- T{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- T{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []T{
+- T{}, // want "redundant type from array, slice, or map composite literal"
+- T{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- T{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []T{
+- T{}, // want "redundant type from array, slice, or map composite literal"
+- 10: T{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- 20: T{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []struct {
+- x, y int
+-}{
+- struct{ x, y int }{}, // want "redundant type from array, slice, or map composite literal"
+- 10: struct{ x, y int }{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- 20: struct{ x, y int }{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []interface{}{
+- T{},
+- 10: T{1, 2},
+- 20: T{3, 4},
+-}
+-
+-var _ = [][]int{
+- []int{}, // want "redundant type from array, slice, or map composite literal"
+- []int{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- []int{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = [][]int{
+- ([]int{}),
+- ([]int{1, 2}),
+- []int{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = [][][]int{
+- [][]int{}, // want "redundant type from array, slice, or map composite literal"
+- [][]int{ // want "redundant type from array, slice, or map composite literal"
+- []int{}, // want "redundant type from array, slice, or map composite literal"
+- []int{0, 1, 2, 3}, // want "redundant type from array, slice, or map composite literal"
+- []int{4, 5}, // want "redundant type from array, slice, or map composite literal"
+- },
+-}
+-
+-var _ = map[string]T{
+- "foo": T{}, // want "redundant type from array, slice, or map composite literal"
+- "bar": T{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- "bal": T{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[string]struct {
+- x, y int
+-}{
+- "foo": struct{ x, y int }{}, // want "redundant type from array, slice, or map composite literal"
+- "bar": struct{ x, y int }{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- "bal": struct{ x, y int }{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[string]interface{}{
+- "foo": T{},
+- "bar": T{1, 2},
+- "bal": T{3, 4},
+-}
+-
+-var _ = map[string][]int{
+- "foo": []int{}, // want "redundant type from array, slice, or map composite literal"
+- "bar": []int{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- "bal": []int{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[string][]int{
+- "foo": ([]int{}),
+- "bar": ([]int{1, 2}),
+- "bal": []int{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-type Point struct {
+- a int
+- b int
+-}
+-
+-type Piece struct {
+- a int
+- b int
+- c Point
+- d []Point
+- e *Point
+- f *Point
+-}
+-
+-// from exp/4s/data.go
+-var pieces3 = []Piece{
+- Piece{0, 0, Point{4, 1}, []Point{Point{0, 0}, Point{1, 0}, Point{1, 0}, Point{1, 0}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- Piece{1, 0, Point{1, 4}, []Point{Point{0, 0}, Point{0, 1}, Point{0, 1}, Point{0, 1}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- Piece{2, 0, Point{4, 1}, []Point{Point{0, 0}, Point{1, 0}, Point{1, 0}, Point{1, 0}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- Piece{3, 0, Point{1, 4}, []Point{Point{0, 0}, Point{0, 1}, Point{0, 1}, Point{0, 1}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = [42]*T{
+- &T{}, // want "redundant type from array, slice, or map composite literal"
+- &T{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- &T{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = [...]*T{
+- &T{}, // want "redundant type from array, slice, or map composite literal"
+- &T{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- &T{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []*T{
+- &T{}, // want "redundant type from array, slice, or map composite literal"
+- &T{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- &T{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []*T{
+- &T{}, // want "redundant type from array, slice, or map composite literal"
+- 10: &T{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- 20: &T{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []*struct {
+- x, y int
+-}{
+- &struct{ x, y int }{}, // want "redundant type from array, slice, or map composite literal"
+- 10: &struct{ x, y int }{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- 20: &struct{ x, y int }{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []interface{}{
+- &T{},
+- 10: &T{1, 2},
+- 20: &T{3, 4},
+-}
+-
+-var _ = []*[]int{
+- &[]int{}, // want "redundant type from array, slice, or map composite literal"
+- &[]int{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- &[]int{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []*[]int{
+- (&[]int{}),
+- (&[]int{1, 2}),
+- &[]int{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []*[]*[]int{
+- &[]*[]int{}, // want "redundant type from array, slice, or map composite literal"
+- &[]*[]int{ // want "redundant type from array, slice, or map composite literal"
+- &[]int{}, // want "redundant type from array, slice, or map composite literal"
+- &[]int{0, 1, 2, 3}, // want "redundant type from array, slice, or map composite literal"
+- &[]int{4, 5}, // want "redundant type from array, slice, or map composite literal"
+- },
+-}
+-
+-var _ = map[string]*T{
+- "foo": &T{}, // want "redundant type from array, slice, or map composite literal"
+- "bar": &T{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- "bal": &T{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[string]*struct {
+- x, y int
+-}{
+- "foo": &struct{ x, y int }{}, // want "redundant type from array, slice, or map composite literal"
+- "bar": &struct{ x, y int }{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- "bal": &struct{ x, y int }{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[string]interface{}{
+- "foo": &T{},
+- "bar": &T{1, 2},
+- "bal": &T{3, 4},
+-}
+-
+-var _ = map[string]*[]int{
+- "foo": &[]int{}, // want "redundant type from array, slice, or map composite literal"
+- "bar": &[]int{1, 2}, // want "redundant type from array, slice, or map composite literal"
+- "bal": &[]int{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[string]*[]int{
+- "foo": (&[]int{}),
+- "bar": (&[]int{1, 2}),
+- "bal": &[]int{3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var pieces4 = []*Piece{
+- &Piece{0, 0, Point{4, 1}, []Point{Point{0, 0}, Point{1, 0}, Point{1, 0}, Point{1, 0}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- &Piece{1, 0, Point{1, 4}, []Point{Point{0, 0}, Point{0, 1}, Point{0, 1}, Point{0, 1}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- &Piece{2, 0, Point{4, 1}, []Point{Point{0, 0}, Point{1, 0}, Point{1, 0}, Point{1, 0}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- &Piece{3, 0, Point{1, 4}, []Point{Point{0, 0}, Point{0, 1}, Point{0, 1}, Point{0, 1}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[T]T2{
+- T{1, 2}: T2{3, 4}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- T{5, 6}: T2{7, 8}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[*T]*T2{
+- &T{1, 2}: &T2{3, 4}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- &T{5, 6}: &T2{7, 8}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+-}
+diff -urN a/gopls/internal/lsp/analysis/simplifycompositelit/testdata/src/a/a.go.golden b/gopls/internal/lsp/analysis/simplifycompositelit/testdata/src/a/a.go.golden
+--- a/gopls/internal/lsp/analysis/simplifycompositelit/testdata/src/a/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/simplifycompositelit/testdata/src/a/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,234 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package testdata
+-
+-type T struct {
+- x, y int
+-}
+-
+-type T2 struct {
+- w, z int
+-}
+-
+-var _ = [42]T{
+- {}, // want "redundant type from array, slice, or map composite literal"
+- {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = [...]T{
+- {}, // want "redundant type from array, slice, or map composite literal"
+- {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []T{
+- {}, // want "redundant type from array, slice, or map composite literal"
+- {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []T{
+- {}, // want "redundant type from array, slice, or map composite literal"
+- 10: {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- 20: {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []struct {
+- x, y int
+-}{
+- {}, // want "redundant type from array, slice, or map composite literal"
+- 10: {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- 20: {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []interface{}{
+- T{},
+- 10: T{1, 2},
+- 20: T{3, 4},
+-}
+-
+-var _ = [][]int{
+- {}, // want "redundant type from array, slice, or map composite literal"
+- {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = [][]int{
+- ([]int{}),
+- ([]int{1, 2}),
+- {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = [][][]int{
+- {}, // want "redundant type from array, slice, or map composite literal"
+- { // want "redundant type from array, slice, or map composite literal"
+- {}, // want "redundant type from array, slice, or map composite literal"
+- {0, 1, 2, 3}, // want "redundant type from array, slice, or map composite literal"
+- {4, 5}, // want "redundant type from array, slice, or map composite literal"
+- },
+-}
+-
+-var _ = map[string]T{
+- "foo": {}, // want "redundant type from array, slice, or map composite literal"
+- "bar": {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- "bal": {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[string]struct {
+- x, y int
+-}{
+- "foo": {}, // want "redundant type from array, slice, or map composite literal"
+- "bar": {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- "bal": {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[string]interface{}{
+- "foo": T{},
+- "bar": T{1, 2},
+- "bal": T{3, 4},
+-}
+-
+-var _ = map[string][]int{
+- "foo": {}, // want "redundant type from array, slice, or map composite literal"
+- "bar": {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- "bal": {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[string][]int{
+- "foo": ([]int{}),
+- "bar": ([]int{1, 2}),
+- "bal": {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-type Point struct {
+- a int
+- b int
+-}
+-
+-type Piece struct {
+- a int
+- b int
+- c Point
+- d []Point
+- e *Point
+- f *Point
+-}
+-
+-// from exp/4s/data.go
+-var pieces3 = []Piece{
+- {0, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- {1, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- {2, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- {3, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = [42]*T{
+- {}, // want "redundant type from array, slice, or map composite literal"
+- {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = [...]*T{
+- {}, // want "redundant type from array, slice, or map composite literal"
+- {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []*T{
+- {}, // want "redundant type from array, slice, or map composite literal"
+- {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []*T{
+- {}, // want "redundant type from array, slice, or map composite literal"
+- 10: {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- 20: {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []*struct {
+- x, y int
+-}{
+- {}, // want "redundant type from array, slice, or map composite literal"
+- 10: {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- 20: {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []interface{}{
+- &T{},
+- 10: &T{1, 2},
+- 20: &T{3, 4},
+-}
+-
+-var _ = []*[]int{
+- {}, // want "redundant type from array, slice, or map composite literal"
+- {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []*[]int{
+- (&[]int{}),
+- (&[]int{1, 2}),
+- {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = []*[]*[]int{
+- {}, // want "redundant type from array, slice, or map composite literal"
+- { // want "redundant type from array, slice, or map composite literal"
+- {}, // want "redundant type from array, slice, or map composite literal"
+- {0, 1, 2, 3}, // want "redundant type from array, slice, or map composite literal"
+- {4, 5}, // want "redundant type from array, slice, or map composite literal"
+- },
+-}
+-
+-var _ = map[string]*T{
+- "foo": {}, // want "redundant type from array, slice, or map composite literal"
+- "bar": {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- "bal": {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[string]*struct {
+- x, y int
+-}{
+- "foo": {}, // want "redundant type from array, slice, or map composite literal"
+- "bar": {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- "bal": {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[string]interface{}{
+- "foo": &T{},
+- "bar": &T{1, 2},
+- "bal": &T{3, 4},
+-}
+-
+-var _ = map[string]*[]int{
+- "foo": {}, // want "redundant type from array, slice, or map composite literal"
+- "bar": {1, 2}, // want "redundant type from array, slice, or map composite literal"
+- "bal": {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[string]*[]int{
+- "foo": (&[]int{}),
+- "bar": (&[]int{1, 2}),
+- "bal": {3, 4}, // want "redundant type from array, slice, or map composite literal"
+-}
+-
+-var pieces4 = []*Piece{
+- {0, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- {1, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- {2, 0, Point{4, 1}, []Point{{0, 0}, {1, 0}, {1, 0}, {1, 0}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- {3, 0, Point{1, 4}, []Point{{0, 0}, {0, 1}, {0, 1}, {0, 1}}, nil, nil}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[T]T2{
+- {1, 2}: {3, 4}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- {5, 6}: {7, 8}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+-}
+-
+-var _ = map[*T]*T2{
+- {1, 2}: {3, 4}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+- {5, 6}: {7, 8}, // want "redundant type from array, slice, or map composite literal" "redundant type from array, slice, or map composite literal"
+-}
+diff -urN a/gopls/internal/lsp/analysis/simplifyrange/simplifyrange.go b/gopls/internal/lsp/analysis/simplifyrange/simplifyrange.go
+--- a/gopls/internal/lsp/analysis/simplifyrange/simplifyrange.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/simplifyrange/simplifyrange.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,116 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package simplifyrange defines an Analyzer that simplifies range statements.
+-// https://golang.org/cmd/gofmt/#hdr-The_simplify_command
+-// https://github.com/golang/go/blob/master/src/cmd/gofmt/simplify.go
+-package simplifyrange
+-
+-import (
+- "bytes"
+- "go/ast"
+- "go/printer"
+- "go/token"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/analysis/passes/inspect"
+- "golang.org/x/tools/go/ast/inspector"
+-)
+-
+-const Doc = `check for range statement simplifications
+-
+-A range of the form:
+- for x, _ = range v {...}
+-will be simplified to:
+- for x = range v {...}
+-
+-A range of the form:
+- for _ = range v {...}
+-will be simplified to:
+- for range v {...}
+-
+-This is one of the simplifications that "gofmt -s" applies.`
+-
+-var Analyzer = &analysis.Analyzer{
+- Name: "simplifyrange",
+- Doc: Doc,
+- Requires: []*analysis.Analyzer{inspect.Analyzer},
+- Run: run,
+-}
+-
+-func run(pass *analysis.Pass) (interface{}, error) {
+- inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
+- nodeFilter := []ast.Node{
+- (*ast.RangeStmt)(nil),
+- }
+- inspect.Preorder(nodeFilter, func(n ast.Node) {
+- var copy *ast.RangeStmt
+- if stmt, ok := n.(*ast.RangeStmt); ok {
+- x := *stmt
+- copy = &x
+- }
+- if copy == nil {
+- return
+- }
+- end := newlineIndex(pass.Fset, copy)
+-
+- // Range statements of the form: for i, _ := range x {}
+- var old ast.Expr
+- if isBlank(copy.Value) {
+- old = copy.Value
+- copy.Value = nil
+- }
+- // Range statements of the form: for _ := range x {}
+- if isBlank(copy.Key) && copy.Value == nil {
+- old = copy.Key
+- copy.Key = nil
+- }
+- // Return early if neither if condition is met.
+- if old == nil {
+- return
+- }
+- pass.Report(analysis.Diagnostic{
+- Pos: old.Pos(),
+- End: old.End(),
+- Message: "simplify range expression",
+- SuggestedFixes: suggestedFixes(pass.Fset, copy, end),
+- })
+- })
+- return nil, nil
+-}
+-
+-func suggestedFixes(fset *token.FileSet, rng *ast.RangeStmt, end token.Pos) []analysis.SuggestedFix {
+- var b bytes.Buffer
+- printer.Fprint(&b, fset, rng)
+- stmt := b.Bytes()
+- index := bytes.Index(stmt, []byte("\n"))
+- // If there is a new line character, then don't replace the body.
+- if index != -1 {
+- stmt = stmt[:index]
+- }
+- return []analysis.SuggestedFix{{
+- Message: "Remove empty value",
+- TextEdits: []analysis.TextEdit{{
+- Pos: rng.Pos(),
+- End: end,
+- NewText: stmt[:index],
+- }},
+- }}
+-}
+-
+-func newlineIndex(fset *token.FileSet, rng *ast.RangeStmt) token.Pos {
+- var b bytes.Buffer
+- printer.Fprint(&b, fset, rng)
+- contents := b.Bytes()
+- index := bytes.Index(contents, []byte("\n"))
+- if index == -1 {
+- return rng.End()
+- }
+- return rng.Pos() + token.Pos(index)
+-}
+-
+-func isBlank(x ast.Expr) bool {
+- ident, ok := x.(*ast.Ident)
+- return ok && ident.Name == "_"
+-}
+diff -urN a/gopls/internal/lsp/analysis/simplifyrange/simplifyrange_test.go b/gopls/internal/lsp/analysis/simplifyrange/simplifyrange_test.go
+--- a/gopls/internal/lsp/analysis/simplifyrange/simplifyrange_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/simplifyrange/simplifyrange_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,17 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package simplifyrange_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/go/analysis/analysistest"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/simplifyrange"
+-)
+-
+-func Test(t *testing.T) {
+- testdata := analysistest.TestData()
+- analysistest.RunWithSuggestedFixes(t, testdata, simplifyrange.Analyzer, "a")
+-}
+diff -urN a/gopls/internal/lsp/analysis/simplifyrange/testdata/src/a/a.go b/gopls/internal/lsp/analysis/simplifyrange/testdata/src/a/a.go
+--- a/gopls/internal/lsp/analysis/simplifyrange/testdata/src/a/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/simplifyrange/testdata/src/a/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package testdata
+-
+-import "log"
+-
+-func m() {
+- maps := make(map[string]string)
+- for k, _ := range maps { // want "simplify range expression"
+- log.Println(k)
+- }
+- for _ = range maps { // want "simplify range expression"
+- }
+-}
+diff -urN a/gopls/internal/lsp/analysis/simplifyrange/testdata/src/a/a.go.golden b/gopls/internal/lsp/analysis/simplifyrange/testdata/src/a/a.go.golden
+--- a/gopls/internal/lsp/analysis/simplifyrange/testdata/src/a/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/simplifyrange/testdata/src/a/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package testdata
+-
+-import "log"
+-
+-func m() {
+- maps := make(map[string]string)
+- for k := range maps { // want "simplify range expression"
+- log.Println(k)
+- }
+- for range maps { // want "simplify range expression"
+- }
+-}
+diff -urN a/gopls/internal/lsp/analysis/simplifyslice/simplifyslice.go b/gopls/internal/lsp/analysis/simplifyslice/simplifyslice.go
+--- a/gopls/internal/lsp/analysis/simplifyslice/simplifyslice.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/simplifyslice/simplifyslice.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,94 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package simplifyslice defines an Analyzer that simplifies slice statements.
+-// https://github.com/golang/go/blob/master/src/cmd/gofmt/simplify.go
+-// https://golang.org/cmd/gofmt/#hdr-The_simplify_command
+-package simplifyslice
+-
+-import (
+- "bytes"
+- "fmt"
+- "go/ast"
+- "go/printer"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/analysis/passes/inspect"
+- "golang.org/x/tools/go/ast/inspector"
+-)
+-
+-const Doc = `check for slice simplifications
+-
+-A slice expression of the form:
+- s[a:len(s)]
+-will be simplified to:
+- s[a:]
+-
+-This is one of the simplifications that "gofmt -s" applies.`
+-
+-var Analyzer = &analysis.Analyzer{
+- Name: "simplifyslice",
+- Doc: Doc,
+- Requires: []*analysis.Analyzer{inspect.Analyzer},
+- Run: run,
+-}
+-
+-// Note: We could also simplify slice expressions of the form s[0:b] to s[:b]
+-// but we leave them as is since sometimes we want to be very explicit
+-// about the lower bound.
+-// An example where the 0 helps:
+-// x, y, z := b[0:2], b[2:4], b[4:6]
+-// An example where it does not:
+-// x, y := b[:n], b[n:]
+-
+-func run(pass *analysis.Pass) (interface{}, error) {
+- inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
+- nodeFilter := []ast.Node{
+- (*ast.SliceExpr)(nil),
+- }
+- inspect.Preorder(nodeFilter, func(n ast.Node) {
+- expr := n.(*ast.SliceExpr)
+- // - 3-index slices always require the 2nd and 3rd index
+- if expr.Max != nil {
+- return
+- }
+- s, ok := expr.X.(*ast.Ident)
+- // the array/slice object is a single, resolved identifier
+- if !ok || s.Obj == nil {
+- return
+- }
+- call, ok := expr.High.(*ast.CallExpr)
+- // the high expression is a function call with a single argument
+- if !ok || len(call.Args) != 1 || call.Ellipsis.IsValid() {
+- return
+- }
+- fun, ok := call.Fun.(*ast.Ident)
+- // the function called is "len" and it is not locally defined; and
+- // because we don't have dot imports, it must be the predefined len()
+- if !ok || fun.Name != "len" || fun.Obj != nil {
+- return
+- }
+- arg, ok := call.Args[0].(*ast.Ident)
+- // the len argument is the array/slice object
+- if !ok || arg.Obj != s.Obj {
+- return
+- }
+- var b bytes.Buffer
+- printer.Fprint(&b, pass.Fset, expr.High)
+- pass.Report(analysis.Diagnostic{
+- Pos: expr.High.Pos(),
+- End: expr.High.End(),
+- Message: fmt.Sprintf("unneeded: %s", b.String()),
+- SuggestedFixes: []analysis.SuggestedFix{{
+- Message: fmt.Sprintf("Remove '%s'", b.String()),
+- TextEdits: []analysis.TextEdit{{
+- Pos: expr.High.Pos(),
+- End: expr.High.End(),
+- NewText: []byte{},
+- }},
+- }},
+- })
+- })
+- return nil, nil
+-}
+diff -urN a/gopls/internal/lsp/analysis/simplifyslice/simplifyslice_test.go b/gopls/internal/lsp/analysis/simplifyslice/simplifyslice_test.go
+--- a/gopls/internal/lsp/analysis/simplifyslice/simplifyslice_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/simplifyslice/simplifyslice_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,22 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package simplifyslice_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/go/analysis/analysistest"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/simplifyslice"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-func Test(t *testing.T) {
+- testdata := analysistest.TestData()
+- tests := []string{"a"}
+- if typeparams.Enabled {
+- tests = append(tests, "typeparams")
+- }
+- analysistest.RunWithSuggestedFixes(t, testdata, simplifyslice.Analyzer, tests...)
+-}
+diff -urN a/gopls/internal/lsp/analysis/simplifyslice/testdata/src/a/a.go b/gopls/internal/lsp/analysis/simplifyslice/testdata/src/a/a.go
+--- a/gopls/internal/lsp/analysis/simplifyslice/testdata/src/a/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/simplifyslice/testdata/src/a/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,70 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package testdata
+-
+-var (
+- a [10]byte
+- b [20]float32
+- s []int
+- t struct {
+- s []byte
+- }
+-
+- _ = a[0:]
+- _ = a[1:10]
+- _ = a[2:len(a)] // want "unneeded: len\\(a\\)"
+- _ = a[3:(len(a))]
+- _ = a[len(a)-1 : len(a)] // want "unneeded: len\\(a\\)"
+- _ = a[2:len(a):len(a)]
+-
+- _ = a[:]
+- _ = a[:10]
+- _ = a[:len(a)] // want "unneeded: len\\(a\\)"
+- _ = a[:(len(a))]
+- _ = a[:len(a)-1]
+- _ = a[:len(a):len(a)]
+-
+- _ = s[0:]
+- _ = s[1:10]
+- _ = s[2:len(s)] // want "unneeded: len\\(s\\)"
+- _ = s[3:(len(s))]
+- _ = s[len(a) : len(s)-1]
+- _ = s[0:len(b)]
+- _ = s[2:len(s):len(s)]
+-
+- _ = s[:]
+- _ = s[:10]
+- _ = s[:len(s)] // want "unneeded: len\\(s\\)"
+- _ = s[:(len(s))]
+- _ = s[:len(s)-1]
+- _ = s[:len(b)]
+- _ = s[:len(s):len(s)]
+-
+- _ = t.s[0:]
+- _ = t.s[1:10]
+- _ = t.s[2:len(t.s)]
+- _ = t.s[3:(len(t.s))]
+- _ = t.s[len(a) : len(t.s)-1]
+- _ = t.s[0:len(b)]
+- _ = t.s[2:len(t.s):len(t.s)]
+-
+- _ = t.s[:]
+- _ = t.s[:10]
+- _ = t.s[:len(t.s)]
+- _ = t.s[:(len(t.s))]
+- _ = t.s[:len(t.s)-1]
+- _ = t.s[:len(b)]
+- _ = t.s[:len(t.s):len(t.s)]
+-)
+-
+-func _() {
+- s := s[0:len(s)] // want "unneeded: len\\(s\\)"
+- _ = s
+-}
+-
+-func m() {
+- maps := []int{}
+- _ = maps[1:len(maps)] // want "unneeded: len\\(maps\\)"
+-}
+diff -urN a/gopls/internal/lsp/analysis/simplifyslice/testdata/src/a/a.go.golden b/gopls/internal/lsp/analysis/simplifyslice/testdata/src/a/a.go.golden
+--- a/gopls/internal/lsp/analysis/simplifyslice/testdata/src/a/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/simplifyslice/testdata/src/a/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,70 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package testdata
+-
+-var (
+- a [10]byte
+- b [20]float32
+- s []int
+- t struct {
+- s []byte
+- }
+-
+- _ = a[0:]
+- _ = a[1:10]
+- _ = a[2:] // want "unneeded: len\\(a\\)"
+- _ = a[3:(len(a))]
+- _ = a[len(a)-1:] // want "unneeded: len\\(a\\)"
+- _ = a[2:len(a):len(a)]
+-
+- _ = a[:]
+- _ = a[:10]
+- _ = a[:] // want "unneeded: len\\(a\\)"
+- _ = a[:(len(a))]
+- _ = a[:len(a)-1]
+- _ = a[:len(a):len(a)]
+-
+- _ = s[0:]
+- _ = s[1:10]
+- _ = s[2:] // want "unneeded: len\\(s\\)"
+- _ = s[3:(len(s))]
+- _ = s[len(a) : len(s)-1]
+- _ = s[0:len(b)]
+- _ = s[2:len(s):len(s)]
+-
+- _ = s[:]
+- _ = s[:10]
+- _ = s[:] // want "unneeded: len\\(s\\)"
+- _ = s[:(len(s))]
+- _ = s[:len(s)-1]
+- _ = s[:len(b)]
+- _ = s[:len(s):len(s)]
+-
+- _ = t.s[0:]
+- _ = t.s[1:10]
+- _ = t.s[2:len(t.s)]
+- _ = t.s[3:(len(t.s))]
+- _ = t.s[len(a) : len(t.s)-1]
+- _ = t.s[0:len(b)]
+- _ = t.s[2:len(t.s):len(t.s)]
+-
+- _ = t.s[:]
+- _ = t.s[:10]
+- _ = t.s[:len(t.s)]
+- _ = t.s[:(len(t.s))]
+- _ = t.s[:len(t.s)-1]
+- _ = t.s[:len(b)]
+- _ = t.s[:len(t.s):len(t.s)]
+-)
+-
+-func _() {
+- s := s[0:] // want "unneeded: len\\(s\\)"
+- _ = s
+-}
+-
+-func m() {
+- maps := []int{}
+- _ = maps[1:] // want "unneeded: len\\(maps\\)"
+-}
+diff -urN a/gopls/internal/lsp/analysis/simplifyslice/testdata/src/typeparams/typeparams.go b/gopls/internal/lsp/analysis/simplifyslice/testdata/src/typeparams/typeparams.go
+--- a/gopls/internal/lsp/analysis/simplifyslice/testdata/src/typeparams/typeparams.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/simplifyslice/testdata/src/typeparams/typeparams.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,39 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-//
+-//go:build go1.18
+-// +build go1.18
+-
+-package testdata
+-
+-type List[E any] []E
+-
+-// TODO(suzmue): add a test for generic slice expressions when https://github.com/golang/go/issues/48618 is closed.
+-// type S interface{ ~[]int }
+-
+-var (
+- a [10]byte
+- b [20]float32
+- p List[int]
+-
+- _ = p[0:]
+- _ = p[1:10]
+- _ = p[2:len(p)] // want "unneeded: len\\(p\\)"
+- _ = p[3:(len(p))]
+- _ = p[len(a) : len(p)-1]
+- _ = p[0:len(b)]
+- _ = p[2:len(p):len(p)]
+-
+- _ = p[:]
+- _ = p[:10]
+- _ = p[:len(p)] // want "unneeded: len\\(p\\)"
+- _ = p[:(len(p))]
+- _ = p[:len(p)-1]
+- _ = p[:len(b)]
+- _ = p[:len(p):len(p)]
+-)
+-
+-func foo[E any](a List[E]) {
+- _ = a[0:len(a)] // want "unneeded: len\\(a\\)"
+-}
+diff -urN a/gopls/internal/lsp/analysis/simplifyslice/testdata/src/typeparams/typeparams.go.golden b/gopls/internal/lsp/analysis/simplifyslice/testdata/src/typeparams/typeparams.go.golden
+--- a/gopls/internal/lsp/analysis/simplifyslice/testdata/src/typeparams/typeparams.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/simplifyslice/testdata/src/typeparams/typeparams.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,39 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-//
+-//go:build go1.18
+-// +build go1.18
+-
+-package testdata
+-
+-type List[E any] []E
+-
+-// TODO(suzmue): add a test for generic slice expressions when https://github.com/golang/go/issues/48618 is closed.
+-// type S interface{ ~[]int }
+-
+-var (
+- a [10]byte
+- b [20]float32
+- p List[int]
+-
+- _ = p[0:]
+- _ = p[1:10]
+- _ = p[2:] // want "unneeded: len\\(p\\)"
+- _ = p[3:(len(p))]
+- _ = p[len(a) : len(p)-1]
+- _ = p[0:len(b)]
+- _ = p[2:len(p):len(p)]
+-
+- _ = p[:]
+- _ = p[:10]
+- _ = p[:] // want "unneeded: len\\(p\\)"
+- _ = p[:(len(p))]
+- _ = p[:len(p)-1]
+- _ = p[:len(b)]
+- _ = p[:len(p):len(p)]
+-)
+-
+-func foo[E any](a List[E]) {
+- _ = a[0:] // want "unneeded: len\\(a\\)"
+-}
+diff -urN a/gopls/internal/lsp/analysis/stubmethods/stubmethods.go b/gopls/internal/lsp/analysis/stubmethods/stubmethods.go
+--- a/gopls/internal/lsp/analysis/stubmethods/stubmethods.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/stubmethods/stubmethods.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,418 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package stubmethods
+-
+-import (
+- "bytes"
+- "fmt"
+- "go/ast"
+- "go/format"
+- "go/token"
+- "go/types"
+- "strconv"
+- "strings"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/analysis/passes/inspect"
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/internal/analysisinternal"
+- "golang.org/x/tools/internal/typesinternal"
+-)
+-
+-const Doc = `stub methods analyzer
+-
+-This analyzer generates method stubs for concrete types
+-in order to implement a target interface`
+-
+-var Analyzer = &analysis.Analyzer{
+- Name: "stubmethods",
+- Doc: Doc,
+- Requires: []*analysis.Analyzer{inspect.Analyzer},
+- Run: run,
+- RunDespiteErrors: true,
+-}
+-
+-func run(pass *analysis.Pass) (interface{}, error) {
+- for _, err := range pass.TypeErrors {
+- ifaceErr := strings.Contains(err.Msg, "missing method") || strings.HasPrefix(err.Msg, "cannot convert")
+- if !ifaceErr {
+- continue
+- }
+- var file *ast.File
+- for _, f := range pass.Files {
+- if f.Pos() <= err.Pos && err.Pos < f.End() {
+- file = f
+- break
+- }
+- }
+- if file == nil {
+- continue
+- }
+- // Get the end position of the error.
+- _, _, endPos, ok := typesinternal.ReadGo116ErrorData(err)
+- if !ok {
+- var buf bytes.Buffer
+- if err := format.Node(&buf, pass.Fset, file); err != nil {
+- continue
+- }
+- endPos = analysisinternal.TypeErrorEndPos(pass.Fset, buf.Bytes(), err.Pos)
+- }
+- path, _ := astutil.PathEnclosingInterval(file, err.Pos, endPos)
+- si := GetStubInfo(pass.Fset, pass.TypesInfo, path, err.Pos)
+- if si == nil {
+- continue
+- }
+- qf := RelativeToFiles(si.Concrete.Obj().Pkg(), file, nil, nil)
+- pass.Report(analysis.Diagnostic{
+- Pos: err.Pos,
+- End: endPos,
+- Message: fmt.Sprintf("Implement %s", types.TypeString(si.Interface.Type(), qf)),
+- })
+- }
+- return nil, nil
+-}
+-
+-// StubInfo represents a concrete type
+-// that wants to stub out an interface type
+-type StubInfo struct {
+- // Interface is the interface that the client wants to implement.
+- // When the interface is defined, the underlying object will be a TypeName.
+- // Note that we keep track of types.Object instead of types.Type in order
+- // to keep a reference to the declaring object's package and the ast file
+- // in the case where the concrete type file requires a new import that happens to be renamed
+- // in the interface file.
+- // TODO(marwan-at-work): implement interface literals.
+- Fset *token.FileSet // the FileSet used to type-check the types below
+- Interface *types.TypeName
+- Concrete *types.Named
+- Pointer bool
+-}
+-
+-// GetStubInfo determines whether the "missing method error"
+-// can be used to deduced what the concrete and interface types are.
+-//
+-// TODO(adonovan): this function (and its following 5 helpers) tries
+-// to deduce a pair of (concrete, interface) types that are related by
+-// an assignment, either explictly or through a return statement or
+-// function call. This is essentially what the refactor/satisfy does,
+-// more generally. Refactor to share logic, after auditing 'satisfy'
+-// for safety on ill-typed code.
+-func GetStubInfo(fset *token.FileSet, ti *types.Info, path []ast.Node, pos token.Pos) *StubInfo {
+- for _, n := range path {
+- switch n := n.(type) {
+- case *ast.ValueSpec:
+- return fromValueSpec(fset, ti, n, pos)
+- case *ast.ReturnStmt:
+- // An error here may not indicate a real error the user should know about, but it may.
+- // Therefore, it would be best to log it out for debugging/reporting purposes instead of ignoring
+- // it. However, event.Log takes a context which is not passed via the analysis package.
+- // TODO(marwan-at-work): properly log this error.
+- si, _ := fromReturnStmt(fset, ti, pos, path, n)
+- return si
+- case *ast.AssignStmt:
+- return fromAssignStmt(fset, ti, n, pos)
+- case *ast.CallExpr:
+- // Note that some call expressions don't carry the interface type
+- // because they don't point to a function or method declaration elsewhere.
+- // For eaxmple, "var Interface = (*Concrete)(nil)". In that case, continue
+- // this loop to encounter other possibilities such as *ast.ValueSpec or others.
+- si := fromCallExpr(fset, ti, pos, n)
+- if si != nil {
+- return si
+- }
+- }
+- }
+- return nil
+-}
+-
+-// fromCallExpr tries to find an *ast.CallExpr's function declaration and
+-// analyzes a function call's signature against the passed in parameter to deduce
+-// the concrete and interface types.
+-func fromCallExpr(fset *token.FileSet, ti *types.Info, pos token.Pos, ce *ast.CallExpr) *StubInfo {
+- paramIdx := -1
+- for i, p := range ce.Args {
+- if pos >= p.Pos() && pos <= p.End() {
+- paramIdx = i
+- break
+- }
+- }
+- if paramIdx == -1 {
+- return nil
+- }
+- p := ce.Args[paramIdx]
+- concObj, pointer := concreteType(p, ti)
+- if concObj == nil || concObj.Obj().Pkg() == nil {
+- return nil
+- }
+- tv, ok := ti.Types[ce.Fun]
+- if !ok {
+- return nil
+- }
+- sig, ok := tv.Type.(*types.Signature)
+- if !ok {
+- return nil
+- }
+- sigVar := sig.Params().At(paramIdx)
+- iface := ifaceObjFromType(sigVar.Type())
+- if iface == nil {
+- return nil
+- }
+- return &StubInfo{
+- Fset: fset,
+- Concrete: concObj,
+- Pointer: pointer,
+- Interface: iface,
+- }
+-}
+-
+-// fromReturnStmt analyzes a "return" statement to extract
+-// a concrete type that is trying to be returned as an interface type.
+-//
+-// For example, func() io.Writer { return myType{} }
+-// would return StubInfo with the interface being io.Writer and the concrete type being myType{}.
+-func fromReturnStmt(fset *token.FileSet, ti *types.Info, pos token.Pos, path []ast.Node, rs *ast.ReturnStmt) (*StubInfo, error) {
+- returnIdx := -1
+- for i, r := range rs.Results {
+- if pos >= r.Pos() && pos <= r.End() {
+- returnIdx = i
+- }
+- }
+- if returnIdx == -1 {
+- return nil, fmt.Errorf("pos %d not within return statement bounds: [%d-%d]", pos, rs.Pos(), rs.End())
+- }
+- concObj, pointer := concreteType(rs.Results[returnIdx], ti)
+- if concObj == nil || concObj.Obj().Pkg() == nil {
+- return nil, nil
+- }
+- ef := enclosingFunction(path, ti)
+- if ef == nil {
+- return nil, fmt.Errorf("could not find the enclosing function of the return statement")
+- }
+- iface := ifaceType(ef.Results.List[returnIdx].Type, ti)
+- if iface == nil {
+- return nil, nil
+- }
+- return &StubInfo{
+- Fset: fset,
+- Concrete: concObj,
+- Pointer: pointer,
+- Interface: iface,
+- }, nil
+-}
+-
+-// fromValueSpec returns *StubInfo from a variable declaration such as
+-// var x io.Writer = &T{}
+-func fromValueSpec(fset *token.FileSet, ti *types.Info, vs *ast.ValueSpec, pos token.Pos) *StubInfo {
+- var idx int
+- for i, vs := range vs.Values {
+- if pos >= vs.Pos() && pos <= vs.End() {
+- idx = i
+- break
+- }
+- }
+-
+- valueNode := vs.Values[idx]
+- ifaceNode := vs.Type
+- callExp, ok := valueNode.(*ast.CallExpr)
+- // if the ValueSpec is `var _ = myInterface(...)`
+- // as opposed to `var _ myInterface = ...`
+- if ifaceNode == nil && ok && len(callExp.Args) == 1 {
+- ifaceNode = callExp.Fun
+- valueNode = callExp.Args[0]
+- }
+- concObj, pointer := concreteType(valueNode, ti)
+- if concObj == nil || concObj.Obj().Pkg() == nil {
+- return nil
+- }
+- ifaceObj := ifaceType(ifaceNode, ti)
+- if ifaceObj == nil {
+- return nil
+- }
+- return &StubInfo{
+- Fset: fset,
+- Concrete: concObj,
+- Interface: ifaceObj,
+- Pointer: pointer,
+- }
+-}
+-
+-// fromAssignStmt returns *StubInfo from a variable re-assignment such as
+-// var x io.Writer
+-// x = &T{}
+-func fromAssignStmt(fset *token.FileSet, ti *types.Info, as *ast.AssignStmt, pos token.Pos) *StubInfo {
+- idx := -1
+- var lhs, rhs ast.Expr
+- // Given a re-assignment interface conversion error,
+- // the compiler error shows up on the right hand side of the expression.
+- // For example, x = &T{} where x is io.Writer highlights the error
+- // under "&T{}" and not "x".
+- for i, hs := range as.Rhs {
+- if pos >= hs.Pos() && pos <= hs.End() {
+- idx = i
+- break
+- }
+- }
+- if idx == -1 {
+- return nil
+- }
+- // Technically, this should never happen as
+- // we would get a "cannot assign N values to M variables"
+- // before we get an interface conversion error. Nonetheless,
+- // guard against out of range index errors.
+- if idx >= len(as.Lhs) {
+- return nil
+- }
+- lhs, rhs = as.Lhs[idx], as.Rhs[idx]
+- ifaceObj := ifaceType(lhs, ti)
+- if ifaceObj == nil {
+- return nil
+- }
+- concType, pointer := concreteType(rhs, ti)
+- if concType == nil || concType.Obj().Pkg() == nil {
+- return nil
+- }
+- return &StubInfo{
+- Fset: fset,
+- Concrete: concType,
+- Interface: ifaceObj,
+- Pointer: pointer,
+- }
+-}
+-
+-// RelativeToFiles returns a types.Qualifier that formats package
+-// names according to the import environments of the files that define
+-// the concrete type and the interface type. (Only the imports of the
+-// latter file are provided.)
+-//
+-// This is similar to types.RelativeTo except if a file imports the package with a different name,
+-// then it will use it. And if the file does import the package but it is ignored,
+-// then it will return the original name. It also prefers package names in importEnv in case
+-// an import is missing from concFile but is present among importEnv.
+-//
+-// Additionally, if missingImport is not nil, the function will be called whenever the concFile
+-// is presented with a package that is not imported. This is useful so that as types.TypeString is
+-// formatting a function signature, it is identifying packages that will need to be imported when
+-// stubbing an interface.
+-//
+-// TODO(rfindley): investigate if this can be merged with source.Qualifier.
+-func RelativeToFiles(concPkg *types.Package, concFile *ast.File, ifaceImports []*ast.ImportSpec, missingImport func(name, path string)) types.Qualifier {
+- return func(other *types.Package) string {
+- if other == concPkg {
+- return ""
+- }
+-
+- // Check if the concrete file already has the given import,
+- // if so return the default package name or the renamed import statement.
+- for _, imp := range concFile.Imports {
+- impPath, _ := strconv.Unquote(imp.Path.Value)
+- isIgnored := imp.Name != nil && (imp.Name.Name == "." || imp.Name.Name == "_")
+- // TODO(adonovan): this comparison disregards a vendor prefix in 'other'.
+- if impPath == other.Path() && !isIgnored {
+- importName := other.Name()
+- if imp.Name != nil {
+- importName = imp.Name.Name
+- }
+- return importName
+- }
+- }
+-
+- // If the concrete file does not have the import, check if the package
+- // is renamed in the interface file and prefer that.
+- var importName string
+- for _, imp := range ifaceImports {
+- impPath, _ := strconv.Unquote(imp.Path.Value)
+- isIgnored := imp.Name != nil && (imp.Name.Name == "." || imp.Name.Name == "_")
+- // TODO(adonovan): this comparison disregards a vendor prefix in 'other'.
+- if impPath == other.Path() && !isIgnored {
+- if imp.Name != nil && imp.Name.Name != concPkg.Name() {
+- importName = imp.Name.Name
+- }
+- break
+- }
+- }
+-
+- if missingImport != nil {
+- missingImport(importName, other.Path())
+- }
+-
+- // Up until this point, importName must stay empty when calling missingImport,
+- // otherwise we'd end up with `import time "time"` which doesn't look idiomatic.
+- if importName == "" {
+- importName = other.Name()
+- }
+- return importName
+- }
+-}
+-
+-// ifaceType will try to extract the types.Object that defines
+-// the interface given the ast.Expr where the "missing method"
+-// or "conversion" errors happen.
+-func ifaceType(n ast.Expr, ti *types.Info) *types.TypeName {
+- tv, ok := ti.Types[n]
+- if !ok {
+- return nil
+- }
+- return ifaceObjFromType(tv.Type)
+-}
+-
+-func ifaceObjFromType(t types.Type) *types.TypeName {
+- named, ok := t.(*types.Named)
+- if !ok {
+- return nil
+- }
+- _, ok = named.Underlying().(*types.Interface)
+- if !ok {
+- return nil
+- }
+- // Interfaces defined in the "builtin" package return nil a Pkg().
+- // But they are still real interfaces that we need to make a special case for.
+- // Therefore, protect gopls from panicking if a new interface type was added in the future.
+- if named.Obj().Pkg() == nil && named.Obj().Name() != "error" {
+- return nil
+- }
+- return named.Obj()
+-}
+-
+-// concreteType tries to extract the *types.Named that defines
+-// the concrete type given the ast.Expr where the "missing method"
+-// or "conversion" errors happened. If the concrete type is something
+-// that cannot have methods defined on it (such as basic types), this
+-// method will return a nil *types.Named. The second return parameter
+-// is a boolean that indicates whether the concreteType was defined as a
+-// pointer or value.
+-func concreteType(n ast.Expr, ti *types.Info) (*types.Named, bool) {
+- tv, ok := ti.Types[n]
+- if !ok {
+- return nil, false
+- }
+- typ := tv.Type
+- ptr, isPtr := typ.(*types.Pointer)
+- if isPtr {
+- typ = ptr.Elem()
+- }
+- named, ok := typ.(*types.Named)
+- if !ok {
+- return nil, false
+- }
+- return named, isPtr
+-}
+-
+-// enclosingFunction returns the signature and type of the function
+-// enclosing the given position.
+-func enclosingFunction(path []ast.Node, info *types.Info) *ast.FuncType {
+- for _, node := range path {
+- switch t := node.(type) {
+- case *ast.FuncDecl:
+- if _, ok := info.Defs[t.Name]; ok {
+- return t.Type
+- }
+- case *ast.FuncLit:
+- if _, ok := info.Types[t]; ok {
+- return t.Type
+- }
+- }
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/a.go b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/a.go
+--- a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,28 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package undeclared
+-
+-func x() int {
+- var z int
+- z = y // want "(undeclared name|undefined): y"
+-
+- if z == m { // want "(undeclared name|undefined): m"
+- z = 1
+- }
+-
+- if z == 1 {
+- z = 1
+- } else if z == n+1 { // want "(undeclared name|undefined): n"
+- z = 1
+- }
+-
+- switch z {
+- case 10:
+- z = 1
+- case a: // want "(undeclared name|undefined): a"
+- z = 1
+- }
+- return z
+-}
+diff -urN a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/channels.go b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/channels.go
+--- a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/channels.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/channels.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package undeclared
+-
+-func channels(s string) {
+- undefinedChannels(c()) // want "(undeclared name|undefined): undefinedChannels"
+-}
+-
+-func c() (<-chan string, chan string) {
+- return make(<-chan string), make(chan string)
+-}
+diff -urN a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/consecutive_params.go b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/consecutive_params.go
+--- a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/consecutive_params.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/consecutive_params.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package undeclared
+-
+-func consecutiveParams() {
+- var s string
+- undefinedConsecutiveParams(s, s) // want "(undeclared name|undefined): undefinedConsecutiveParams"
+-}
+diff -urN a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/error_param.go b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/error_param.go
+--- a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/error_param.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/error_param.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package undeclared
+-
+-func errorParam() {
+- var err error
+- undefinedErrorParam(err) // want "(undeclared name|undefined): undefinedErrorParam"
+-}
+diff -urN a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/literals.go b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/literals.go
+--- a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/literals.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/literals.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package undeclared
+-
+-type T struct{}
+-
+-func literals() {
+- undefinedLiterals("hey compiler", T{}, &T{}) // want "(undeclared name|undefined): undefinedLiterals"
+-}
+diff -urN a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/operation.go b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/operation.go
+--- a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/operation.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/operation.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package undeclared
+-
+-import "time"
+-
+-func operation() {
+- undefinedOperation(10 * time.Second) // want "(undeclared name|undefined): undefinedOperation"
+-}
+diff -urN a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/selector.go b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/selector.go
+--- a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/selector.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/selector.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package undeclared
+-
+-func selector() {
+- m := map[int]bool{}
+- undefinedSelector(m[1]) // want "(undeclared name|undefined): undefinedSelector"
+-}
+diff -urN a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/slice.go b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/slice.go
+--- a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/slice.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/slice.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package undeclared
+-
+-func slice() {
+- undefinedSlice([]int{1, 2}) // want "(undeclared name|undefined): undefinedSlice"
+-}
+diff -urN a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/tuple.go b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/tuple.go
+--- a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/tuple.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/tuple.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package undeclared
+-
+-func tuple() {
+- undefinedTuple(b()) // want "(undeclared name|undefined): undefinedTuple"
+-}
+-
+-func b() (string, error) {
+- return "", nil
+-}
+diff -urN a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/unique_params.go b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/unique_params.go
+--- a/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/unique_params.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/undeclaredname/testdata/src/a/unique_params.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package undeclared
+-
+-func uniqueArguments() {
+- var s string
+- var i int
+- undefinedUniqueArguments(s, i, s) // want "(undeclared name|undefined): undefinedUniqueArguments"
+-}
+diff -urN a/gopls/internal/lsp/analysis/undeclaredname/undeclared.go b/gopls/internal/lsp/analysis/undeclaredname/undeclared.go
+--- a/gopls/internal/lsp/analysis/undeclaredname/undeclared.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/undeclaredname/undeclared.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,347 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package undeclaredname defines an Analyzer that applies suggested fixes
+-// to errors of the type "undeclared name: %s".
+-package undeclaredname
+-
+-import (
+- "bytes"
+- "fmt"
+- "go/ast"
+- "go/format"
+- "go/token"
+- "go/types"
+- "strings"
+- "unicode"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/internal/analysisinternal"
+-)
+-
+-const Doc = `suggested fixes for "undeclared name: <>"
+-
+-This checker provides suggested fixes for type errors of the
+-type "undeclared name: <>". It will either insert a new statement,
+-such as:
+-
+-"<> := "
+-
+-or a new function declaration, such as:
+-
+-func <>(inferred parameters) {
+- panic("implement me!")
+-}
+-`
+-
+-var Analyzer = &analysis.Analyzer{
+- Name: "undeclaredname",
+- Doc: Doc,
+- Requires: []*analysis.Analyzer{},
+- Run: run,
+- RunDespiteErrors: true,
+-}
+-
+-// The prefix for this error message changed in Go 1.20.
+-var undeclaredNamePrefixes = []string{"undeclared name: ", "undefined: "}
+-
+-func run(pass *analysis.Pass) (interface{}, error) {
+- for _, err := range pass.TypeErrors {
+- runForError(pass, err)
+- }
+- return nil, nil
+-}
+-
+-func runForError(pass *analysis.Pass, err types.Error) {
+- var name string
+- for _, prefix := range undeclaredNamePrefixes {
+- if !strings.HasPrefix(err.Msg, prefix) {
+- continue
+- }
+- name = strings.TrimPrefix(err.Msg, prefix)
+- }
+- if name == "" {
+- return
+- }
+- var file *ast.File
+- for _, f := range pass.Files {
+- if f.Pos() <= err.Pos && err.Pos < f.End() {
+- file = f
+- break
+- }
+- }
+- if file == nil {
+- return
+- }
+-
+- // Get the path for the relevant range.
+- path, _ := astutil.PathEnclosingInterval(file, err.Pos, err.Pos)
+- if len(path) < 2 {
+- return
+- }
+- ident, ok := path[0].(*ast.Ident)
+- if !ok || ident.Name != name {
+- return
+- }
+-
+- // Undeclared quick fixes only work in function bodies.
+- inFunc := false
+- for i := range path {
+- if _, inFunc = path[i].(*ast.FuncDecl); inFunc {
+- if i == 0 {
+- return
+- }
+- if _, isBody := path[i-1].(*ast.BlockStmt); !isBody {
+- return
+- }
+- break
+- }
+- }
+- if !inFunc {
+- return
+- }
+- // Skip selector expressions because it might be too complex
+- // to try and provide a suggested fix for fields and methods.
+- if _, ok := path[1].(*ast.SelectorExpr); ok {
+- return
+- }
+- tok := pass.Fset.File(file.Pos())
+- if tok == nil {
+- return
+- }
+- offset := safetoken.StartPosition(pass.Fset, err.Pos).Offset
+- end := tok.Pos(offset + len(name)) // TODO(adonovan): dubious! err.Pos + len(name)??
+- pass.Report(analysis.Diagnostic{
+- Pos: err.Pos,
+- End: end,
+- Message: err.Msg,
+- })
+-}
+-
+-func SuggestedFix(fset *token.FileSet, start, end token.Pos, content []byte, file *ast.File, pkg *types.Package, info *types.Info) (*analysis.SuggestedFix, error) {
+- pos := start // don't use the end
+- path, _ := astutil.PathEnclosingInterval(file, pos, pos)
+- if len(path) < 2 {
+- return nil, fmt.Errorf("no expression found")
+- }
+- ident, ok := path[0].(*ast.Ident)
+- if !ok {
+- return nil, fmt.Errorf("no identifier found")
+- }
+-
+- // Check for a possible call expression, in which case we should add a
+- // new function declaration.
+- if len(path) > 1 {
+- if _, ok := path[1].(*ast.CallExpr); ok {
+- return newFunctionDeclaration(path, file, pkg, info, fset)
+- }
+- }
+-
+- // Get the place to insert the new statement.
+- insertBeforeStmt := analysisinternal.StmtToInsertVarBefore(path)
+- if insertBeforeStmt == nil {
+- return nil, fmt.Errorf("could not locate insertion point")
+- }
+-
+- insertBefore := safetoken.StartPosition(fset, insertBeforeStmt.Pos()).Offset
+-
+- // Get the indent to add on the line after the new statement.
+- // Since this will have a parse error, we can not use format.Source().
+- contentBeforeStmt, indent := content[:insertBefore], "\n"
+- if nl := bytes.LastIndex(contentBeforeStmt, []byte("\n")); nl != -1 {
+- indent = string(contentBeforeStmt[nl:])
+- }
+-
+- // Create the new local variable statement.
+- newStmt := fmt.Sprintf("%s := %s", ident.Name, indent)
+- return &analysis.SuggestedFix{
+- Message: fmt.Sprintf("Create variable \"%s\"", ident.Name),
+- TextEdits: []analysis.TextEdit{{
+- Pos: insertBeforeStmt.Pos(),
+- End: insertBeforeStmt.Pos(),
+- NewText: []byte(newStmt),
+- }},
+- }, nil
+-}
+-
+-func newFunctionDeclaration(path []ast.Node, file *ast.File, pkg *types.Package, info *types.Info, fset *token.FileSet) (*analysis.SuggestedFix, error) {
+- if len(path) < 3 {
+- return nil, fmt.Errorf("unexpected set of enclosing nodes: %v", path)
+- }
+- ident, ok := path[0].(*ast.Ident)
+- if !ok {
+- return nil, fmt.Errorf("no name for function declaration %v (%T)", path[0], path[0])
+- }
+- call, ok := path[1].(*ast.CallExpr)
+- if !ok {
+- return nil, fmt.Errorf("no call expression found %v (%T)", path[1], path[1])
+- }
+-
+- // Find the enclosing function, so that we can add the new declaration
+- // below.
+- var enclosing *ast.FuncDecl
+- for _, n := range path {
+- if n, ok := n.(*ast.FuncDecl); ok {
+- enclosing = n
+- break
+- }
+- }
+- // TODO(rstambler): Support the situation when there is no enclosing
+- // function.
+- if enclosing == nil {
+- return nil, fmt.Errorf("no enclosing function found: %v", path)
+- }
+-
+- pos := enclosing.End()
+-
+- var paramNames []string
+- var paramTypes []types.Type
+- // keep track of all param names to later ensure uniqueness
+- nameCounts := map[string]int{}
+- for _, arg := range call.Args {
+- typ := info.TypeOf(arg)
+- if typ == nil {
+- return nil, fmt.Errorf("unable to determine type for %s", arg)
+- }
+-
+- switch t := typ.(type) {
+- // this is the case where another function call returning multiple
+- // results is used as an argument
+- case *types.Tuple:
+- n := t.Len()
+- for i := 0; i < n; i++ {
+- name := typeToArgName(t.At(i).Type())
+- nameCounts[name]++
+-
+- paramNames = append(paramNames, name)
+- paramTypes = append(paramTypes, types.Default(t.At(i).Type()))
+- }
+-
+- default:
+- // does the argument have a name we can reuse?
+- // only happens in case of a *ast.Ident
+- var name string
+- if ident, ok := arg.(*ast.Ident); ok {
+- name = ident.Name
+- }
+-
+- if name == "" {
+- name = typeToArgName(typ)
+- }
+-
+- nameCounts[name]++
+-
+- paramNames = append(paramNames, name)
+- paramTypes = append(paramTypes, types.Default(typ))
+- }
+- }
+-
+- for n, c := range nameCounts {
+- // Any names we saw more than once will need a unique suffix added
+- // on. Reset the count to 1 to act as the suffix for the first
+- // occurrence of that name.
+- if c >= 2 {
+- nameCounts[n] = 1
+- } else {
+- delete(nameCounts, n)
+- }
+- }
+-
+- params := &ast.FieldList{}
+-
+- for i, name := range paramNames {
+- if suffix, repeats := nameCounts[name]; repeats {
+- nameCounts[name]++
+- name = fmt.Sprintf("%s%d", name, suffix)
+- }
+-
+- // only worth checking after previous param in the list
+- if i > 0 {
+- // if type of parameter at hand is the same as the previous one,
+- // add it to the previous param list of identifiers so to have:
+- // (s1, s2 string)
+- // and not
+- // (s1 string, s2 string)
+- if paramTypes[i] == paramTypes[i-1] {
+- params.List[len(params.List)-1].Names = append(params.List[len(params.List)-1].Names, ast.NewIdent(name))
+- continue
+- }
+- }
+-
+- params.List = append(params.List, &ast.Field{
+- Names: []*ast.Ident{
+- ast.NewIdent(name),
+- },
+- Type: analysisinternal.TypeExpr(file, pkg, paramTypes[i]),
+- })
+- }
+-
+- decl := &ast.FuncDecl{
+- Name: ast.NewIdent(ident.Name),
+- Type: &ast.FuncType{
+- Params: params,
+- // TODO(rstambler): Also handle result parameters here.
+- },
+- Body: &ast.BlockStmt{
+- List: []ast.Stmt{
+- &ast.ExprStmt{
+- X: &ast.CallExpr{
+- Fun: ast.NewIdent("panic"),
+- Args: []ast.Expr{
+- &ast.BasicLit{
+- Value: `"unimplemented"`,
+- },
+- },
+- },
+- },
+- },
+- },
+- }
+-
+- b := bytes.NewBufferString("\n\n")
+- if err := format.Node(b, fset, decl); err != nil {
+- return nil, err
+- }
+- return &analysis.SuggestedFix{
+- Message: fmt.Sprintf("Create function \"%s\"", ident.Name),
+- TextEdits: []analysis.TextEdit{{
+- Pos: pos,
+- End: pos,
+- NewText: b.Bytes(),
+- }},
+- }, nil
+-}
+-func typeToArgName(ty types.Type) string {
+- s := types.Default(ty).String()
+-
+- switch t := ty.(type) {
+- case *types.Basic:
+- // use first letter in type name for basic types
+- return s[0:1]
+- case *types.Slice:
+- // use element type to decide var name for slices
+- return typeToArgName(t.Elem())
+- case *types.Array:
+- // use element type to decide var name for arrays
+- return typeToArgName(t.Elem())
+- case *types.Chan:
+- return "ch"
+- }
+-
+- s = strings.TrimFunc(s, func(r rune) bool {
+- return !unicode.IsLetter(r)
+- })
+-
+- if s == "error" {
+- return "err"
+- }
+-
+- // remove package (if present)
+- // and make first letter lowercase
+- a := []rune(s[strings.LastIndexByte(s, '.')+1:])
+- a[0] = unicode.ToLower(a[0])
+- return string(a)
+-}
+diff -urN a/gopls/internal/lsp/analysis/undeclaredname/undeclared_test.go b/gopls/internal/lsp/analysis/undeclaredname/undeclared_test.go
+--- a/gopls/internal/lsp/analysis/undeclaredname/undeclared_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/undeclaredname/undeclared_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,17 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package undeclaredname_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/go/analysis/analysistest"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/undeclaredname"
+-)
+-
+-func Test(t *testing.T) {
+- testdata := analysistest.TestData()
+- analysistest.Run(t, testdata, undeclaredname.Analyzer, "a")
+-}
+diff -urN a/gopls/internal/lsp/analysis/unusedparams/testdata/src/a/a.go b/gopls/internal/lsp/analysis/unusedparams/testdata/src/a/a.go
+--- a/gopls/internal/lsp/analysis/unusedparams/testdata/src/a/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/unusedparams/testdata/src/a/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,55 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package a
+-
+-import (
+- "bytes"
+- "fmt"
+- "net/http"
+-)
+-
+-type parent interface {
+- n(f bool)
+-}
+-
+-type yuh struct {
+- a int
+-}
+-
+-func (y *yuh) n(f bool) {
+- for i := 0; i < 10; i++ {
+- fmt.Println(i)
+- }
+-}
+-
+-func a(i1 int, i2 int, i3 int) int { // want "potentially unused parameter: 'i2'"
+- i3 += i1
+- _ = func(z int) int { // want "potentially unused parameter: 'z'"
+- _ = 1
+- return 1
+- }
+- return i3
+-}
+-
+-func b(c bytes.Buffer) { // want "potentially unused parameter: 'c'"
+- _ = 1
+-}
+-
+-func z(h http.ResponseWriter, _ *http.Request) { // want "potentially unused parameter: 'h'"
+- fmt.Println("Before")
+-}
+-
+-func l(h http.Handler) http.Handler {
+- return http.HandlerFunc(z)
+-}
+-
+-func mult(a, b int) int { // want "potentially unused parameter: 'b'"
+- a += 1
+- return a
+-}
+-
+-func y(a int) {
+- panic("yo")
+-}
+diff -urN a/gopls/internal/lsp/analysis/unusedparams/testdata/src/a/a.go.golden b/gopls/internal/lsp/analysis/unusedparams/testdata/src/a/a.go.golden
+--- a/gopls/internal/lsp/analysis/unusedparams/testdata/src/a/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/unusedparams/testdata/src/a/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,55 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package a
+-
+-import (
+- "bytes"
+- "fmt"
+- "net/http"
+-)
+-
+-type parent interface {
+- n(f bool)
+-}
+-
+-type yuh struct {
+- a int
+-}
+-
+-func (y *yuh) n(f bool) {
+- for i := 0; i < 10; i++ {
+- fmt.Println(i)
+- }
+-}
+-
+-func a(i1 int, _ int, i3 int) int { // want "potentially unused parameter: 'i2'"
+- i3 += i1
+- _ = func(_ int) int { // want "potentially unused parameter: 'z'"
+- _ = 1
+- return 1
+- }
+- return i3
+-}
+-
+-func b(_ bytes.Buffer) { // want "potentially unused parameter: 'c'"
+- _ = 1
+-}
+-
+-func z(_ http.ResponseWriter, _ *http.Request) { // want "potentially unused parameter: 'h'"
+- fmt.Println("Before")
+-}
+-
+-func l(h http.Handler) http.Handler {
+- return http.HandlerFunc(z)
+-}
+-
+-func mult(a, _ int) int { // want "potentially unused parameter: 'b'"
+- a += 1
+- return a
+-}
+-
+-func y(a int) {
+- panic("yo")
+-}
+diff -urN a/gopls/internal/lsp/analysis/unusedparams/testdata/src/typeparams/typeparams.go b/gopls/internal/lsp/analysis/unusedparams/testdata/src/typeparams/typeparams.go
+--- a/gopls/internal/lsp/analysis/unusedparams/testdata/src/typeparams/typeparams.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/unusedparams/testdata/src/typeparams/typeparams.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,55 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package typeparams
+-
+-import (
+- "bytes"
+- "fmt"
+- "net/http"
+-)
+-
+-type parent[T any] interface {
+- n(f T)
+-}
+-
+-type yuh[T any] struct {
+- a T
+-}
+-
+-func (y *yuh[int]) n(f bool) {
+- for i := 0; i < 10; i++ {
+- fmt.Println(i)
+- }
+-}
+-
+-func a[T comparable](i1 int, i2 T, i3 int) int { // want "potentially unused parameter: 'i2'"
+- i3 += i1
+- _ = func(z int) int { // want "potentially unused parameter: 'z'"
+- _ = 1
+- return 1
+- }
+- return i3
+-}
+-
+-func b[T any](c bytes.Buffer) { // want "potentially unused parameter: 'c'"
+- _ = 1
+-}
+-
+-func z[T http.ResponseWriter](h T, _ *http.Request) { // want "potentially unused parameter: 'h'"
+- fmt.Println("Before")
+-}
+-
+-func l(h http.Handler) http.Handler {
+- return http.HandlerFunc(z[http.ResponseWriter])
+-}
+-
+-func mult(a, b int) int { // want "potentially unused parameter: 'b'"
+- a += 1
+- return a
+-}
+-
+-func y[T any](a T) {
+- panic("yo")
+-}
+diff -urN a/gopls/internal/lsp/analysis/unusedparams/testdata/src/typeparams/typeparams.go.golden b/gopls/internal/lsp/analysis/unusedparams/testdata/src/typeparams/typeparams.go.golden
+--- a/gopls/internal/lsp/analysis/unusedparams/testdata/src/typeparams/typeparams.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/unusedparams/testdata/src/typeparams/typeparams.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,55 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package typeparams
+-
+-import (
+- "bytes"
+- "fmt"
+- "net/http"
+-)
+-
+-type parent[T any] interface {
+- n(f T)
+-}
+-
+-type yuh[T any] struct {
+- a T
+-}
+-
+-func (y *yuh[int]) n(f bool) {
+- for i := 0; i < 10; i++ {
+- fmt.Println(i)
+- }
+-}
+-
+-func a[T comparable](i1 int, _ T, i3 int) int { // want "potentially unused parameter: 'i2'"
+- i3 += i1
+- _ = func(_ int) int { // want "potentially unused parameter: 'z'"
+- _ = 1
+- return 1
+- }
+- return i3
+-}
+-
+-func b[T any](_ bytes.Buffer) { // want "potentially unused parameter: 'c'"
+- _ = 1
+-}
+-
+-func z[T http.ResponseWriter](_ T, _ *http.Request) { // want "potentially unused parameter: 'h'"
+- fmt.Println("Before")
+-}
+-
+-func l(h http.Handler) http.Handler {
+- return http.HandlerFunc(z[http.ResponseWriter])
+-}
+-
+-func mult(a, _ int) int { // want "potentially unused parameter: 'b'"
+- a += 1
+- return a
+-}
+-
+-func y[T any](a T) {
+- panic("yo")
+-}
+diff -urN a/gopls/internal/lsp/analysis/unusedparams/unusedparams.go b/gopls/internal/lsp/analysis/unusedparams/unusedparams.go
+--- a/gopls/internal/lsp/analysis/unusedparams/unusedparams.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/unusedparams/unusedparams.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,152 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package unusedparams defines an analyzer that checks for unused
+-// parameters of functions.
+-package unusedparams
+-
+-import (
+- "fmt"
+- "go/ast"
+- "go/types"
+- "strings"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/analysis/passes/inspect"
+- "golang.org/x/tools/go/ast/inspector"
+-)
+-
+-const Doc = `check for unused parameters of functions
+-
+-The unusedparams analyzer checks functions to see if there are
+-any parameters that are not being used.
+-
+-To reduce false positives it ignores:
+-- methods
+-- parameters that do not have a name or are underscored
+-- functions in test files
+-- functions with empty bodies or those with just a return stmt`
+-
+-var Analyzer = &analysis.Analyzer{
+- Name: "unusedparams",
+- Doc: Doc,
+- Requires: []*analysis.Analyzer{inspect.Analyzer},
+- Run: run,
+-}
+-
+-type paramData struct {
+- field *ast.Field
+- ident *ast.Ident
+- typObj types.Object
+-}
+-
+-func run(pass *analysis.Pass) (interface{}, error) {
+- inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
+- nodeFilter := []ast.Node{
+- (*ast.FuncDecl)(nil),
+- (*ast.FuncLit)(nil),
+- }
+-
+- inspect.Preorder(nodeFilter, func(n ast.Node) {
+- var fieldList *ast.FieldList
+- var body *ast.BlockStmt
+-
+- // Get the fieldList and body from the function node.
+- switch f := n.(type) {
+- case *ast.FuncDecl:
+- fieldList, body = f.Type.Params, f.Body
+- // TODO(golang/go#36602): add better handling for methods, if we enable methods
+- // we will get false positives if a struct is potentially implementing
+- // an interface.
+- if f.Recv != nil {
+- return
+- }
+- // Ignore functions in _test.go files to reduce false positives.
+- if file := pass.Fset.File(n.Pos()); file != nil && strings.HasSuffix(file.Name(), "_test.go") {
+- return
+- }
+- case *ast.FuncLit:
+- fieldList, body = f.Type.Params, f.Body
+- }
+- // If there are no arguments or the function is empty, then return.
+- if fieldList.NumFields() == 0 || body == nil || len(body.List) == 0 {
+- return
+- }
+-
+- switch expr := body.List[0].(type) {
+- case *ast.ReturnStmt:
+- // Ignore functions that only contain a return statement to reduce false positives.
+- return
+- case *ast.ExprStmt:
+- callExpr, ok := expr.X.(*ast.CallExpr)
+- if !ok || len(body.List) > 1 {
+- break
+- }
+- // Ignore functions that only contain a panic statement to reduce false positives.
+- if fun, ok := callExpr.Fun.(*ast.Ident); ok && fun.Name == "panic" {
+- return
+- }
+- }
+-
+- // Get the useful data from each field.
+- params := make(map[string]*paramData)
+- unused := make(map[*paramData]bool)
+- for _, f := range fieldList.List {
+- for _, i := range f.Names {
+- if i.Name == "_" {
+- continue
+- }
+- params[i.Name] = &paramData{
+- field: f,
+- ident: i,
+- typObj: pass.TypesInfo.ObjectOf(i),
+- }
+- unused[params[i.Name]] = true
+- }
+- }
+-
+- // Traverse through the body of the function and
+- // check to see which parameters are unused.
+- ast.Inspect(body, func(node ast.Node) bool {
+- n, ok := node.(*ast.Ident)
+- if !ok {
+- return true
+- }
+- param, ok := params[n.Name]
+- if !ok {
+- return false
+- }
+- if nObj := pass.TypesInfo.ObjectOf(n); nObj != param.typObj {
+- return false
+- }
+- delete(unused, param)
+- return false
+- })
+-
+- // Create the reports for the unused parameters.
+- for u := range unused {
+- start, end := u.field.Pos(), u.field.End()
+- if len(u.field.Names) > 1 {
+- start, end = u.ident.Pos(), u.ident.End()
+- }
+- // TODO(golang/go#36602): Add suggested fixes to automatically
+- // remove the unused parameter from every use of this
+- // function.
+- pass.Report(analysis.Diagnostic{
+- Pos: start,
+- End: end,
+- Message: fmt.Sprintf("potentially unused parameter: '%s'", u.ident.Name),
+- SuggestedFixes: []analysis.SuggestedFix{{
+- Message: `Replace with "_"`,
+- TextEdits: []analysis.TextEdit{{
+- Pos: u.ident.Pos(),
+- End: u.ident.End(),
+- NewText: []byte("_"),
+- }},
+- }},
+- })
+- }
+- })
+- return nil, nil
+-}
+diff -urN a/gopls/internal/lsp/analysis/unusedparams/unusedparams_test.go b/gopls/internal/lsp/analysis/unusedparams/unusedparams_test.go
+--- a/gopls/internal/lsp/analysis/unusedparams/unusedparams_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/unusedparams/unusedparams_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,22 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package unusedparams_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/go/analysis/analysistest"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/unusedparams"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-func Test(t *testing.T) {
+- testdata := analysistest.TestData()
+- tests := []string{"a"}
+- if typeparams.Enabled {
+- tests = append(tests, "typeparams")
+- }
+- analysistest.RunWithSuggestedFixes(t, testdata, unusedparams.Analyzer, tests...)
+-}
+diff -urN a/gopls/internal/lsp/analysis/unusedvariable/testdata/src/assign/a.go b/gopls/internal/lsp/analysis/unusedvariable/testdata/src/assign/a.go
+--- a/gopls/internal/lsp/analysis/unusedvariable/testdata/src/assign/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/unusedvariable/testdata/src/assign/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,74 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package a
+-
+-import (
+- "fmt"
+- "os"
+-)
+-
+-type A struct {
+- b int
+-}
+-
+-func singleAssignment() {
+- v := "s" // want `v declared (and|but) not used`
+-
+- s := []int{ // want `s declared (and|but) not used`
+- 1,
+- 2,
+- }
+-
+- a := func(s string) bool { // want `a declared (and|but) not used`
+- return false
+- }
+-
+- if 1 == 1 {
+- s := "v" // want `s declared (and|but) not used`
+- }
+-
+- panic("I should survive")
+-}
+-
+-func noOtherStmtsInBlock() {
+- v := "s" // want `v declared (and|but) not used`
+-}
+-
+-func partOfMultiAssignment() {
+- f, err := os.Open("file") // want `f declared (and|but) not used`
+- panic(err)
+-}
+-
+-func sideEffects(cBool chan bool, cInt chan int) {
+- b := <-c // want `b declared (and|but) not used`
+- s := fmt.Sprint("") // want `s declared (and|but) not used`
+- a := A{ // want `a declared (and|but) not used`
+- b: func() int {
+- return 1
+- }(),
+- }
+- c := A{<-cInt} // want `c declared (and|but) not used`
+- d := fInt() + <-cInt // want `d declared (and|but) not used`
+- e := fBool() && <-cBool // want `e declared (and|but) not used`
+- f := map[int]int{ // want `f declared (and|but) not used`
+- fInt(): <-cInt,
+- }
+- g := []int{<-cInt} // want `g declared (and|but) not used`
+- h := func(s string) {} // want `h declared (and|but) not used`
+- i := func(s string) {}() // want `i declared (and|but) not used`
+-}
+-
+-func commentAbove() {
+- // v is a variable
+- v := "s" // want `v declared (and|but) not used`
+-}
+-
+-func fBool() bool {
+- return true
+-}
+-
+-func fInt() int {
+- return 1
+-}
+diff -urN a/gopls/internal/lsp/analysis/unusedvariable/testdata/src/assign/a.go.golden b/gopls/internal/lsp/analysis/unusedvariable/testdata/src/assign/a.go.golden
+--- a/gopls/internal/lsp/analysis/unusedvariable/testdata/src/assign/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/unusedvariable/testdata/src/assign/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,59 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package a
+-
+-import (
+- "fmt"
+- "os"
+-)
+-
+-type A struct {
+- b int
+-}
+-
+-func singleAssignment() {
+- if 1 == 1 {
+- }
+-
+- panic("I should survive")
+-}
+-
+-func noOtherStmtsInBlock() {
+-}
+-
+-func partOfMultiAssignment() {
+- _, err := os.Open("file") // want `f declared (and|but) not used`
+- panic(err)
+-}
+-
+-func sideEffects(cBool chan bool, cInt chan int) {
+- <-c // want `b declared (and|but) not used`
+- fmt.Sprint("") // want `s declared (and|but) not used`
+- A{ // want `a declared (and|but) not used`
+- b: func() int {
+- return 1
+- }(),
+- }
+- A{<-cInt} // want `c declared (and|but) not used`
+- fInt() + <-cInt // want `d declared (and|but) not used`
+- fBool() && <-cBool // want `e declared (and|but) not used`
+- map[int]int{ // want `f declared (and|but) not used`
+- fInt(): <-cInt,
+- }
+- []int{<-cInt} // want `g declared (and|but) not used`
+- func(s string) {}() // want `i declared (and|but) not used`
+-}
+-
+-func commentAbove() {
+- // v is a variable
+-}
+-
+-func fBool() bool {
+- return true
+-}
+-
+-func fInt() int {
+- return 1
+-}
+diff -urN a/gopls/internal/lsp/analysis/unusedvariable/testdata/src/decl/a.go b/gopls/internal/lsp/analysis/unusedvariable/testdata/src/decl/a.go
+--- a/gopls/internal/lsp/analysis/unusedvariable/testdata/src/decl/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/unusedvariable/testdata/src/decl/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,30 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package decl
+-
+-func a() {
+- var b, c bool // want `b declared (and|but) not used`
+- panic(c)
+-
+- if 1 == 1 {
+- var s string // want `s declared (and|but) not used`
+- }
+-}
+-
+-func b() {
+- // b is a variable
+- var b bool // want `b declared (and|but) not used`
+-}
+-
+-func c() {
+- var (
+- d string
+-
+- // some comment for c
+- c bool // want `c declared (and|but) not used`
+- )
+-
+- panic(d)
+-}
+diff -urN a/gopls/internal/lsp/analysis/unusedvariable/testdata/src/decl/a.go.golden b/gopls/internal/lsp/analysis/unusedvariable/testdata/src/decl/a.go.golden
+--- a/gopls/internal/lsp/analysis/unusedvariable/testdata/src/decl/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/unusedvariable/testdata/src/decl/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package decl
+-
+-func a() {
+- var c bool // want `b declared (and|but) not used`
+- panic(c)
+-
+- if 1 == 1 {
+- }
+-}
+-
+-func b() {
+- // b is a variable
+-}
+-
+-func c() {
+- var (
+- d string
+- )
+- panic(d)
+-}
+diff -urN a/gopls/internal/lsp/analysis/unusedvariable/unusedvariable.go b/gopls/internal/lsp/analysis/unusedvariable/unusedvariable.go
+--- a/gopls/internal/lsp/analysis/unusedvariable/unusedvariable.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/unusedvariable/unusedvariable.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,300 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package unusedvariable defines an analyzer that checks for unused variables.
+-package unusedvariable
+-
+-import (
+- "bytes"
+- "fmt"
+- "go/ast"
+- "go/format"
+- "go/token"
+- "go/types"
+- "strings"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/ast/astutil"
+-)
+-
+-const Doc = `check for unused variables
+-
+-The unusedvariable analyzer suggests fixes for unused variables errors.
+-`
+-
+-var Analyzer = &analysis.Analyzer{
+- Name: "unusedvariable",
+- Doc: Doc,
+- Requires: []*analysis.Analyzer{},
+- Run: run,
+- RunDespiteErrors: true, // an unusedvariable diagnostic is a compile error
+-}
+-
+-// The suffix for this error message changed in Go 1.20.
+-var unusedVariableSuffixes = []string{" declared and not used", " declared but not used"}
+-
+-func run(pass *analysis.Pass) (interface{}, error) {
+- for _, typeErr := range pass.TypeErrors {
+- for _, suffix := range unusedVariableSuffixes {
+- if strings.HasSuffix(typeErr.Msg, suffix) {
+- varName := strings.TrimSuffix(typeErr.Msg, suffix)
+- err := runForError(pass, typeErr, varName)
+- if err != nil {
+- return nil, err
+- }
+- }
+- }
+- }
+-
+- return nil, nil
+-}
+-
+-func runForError(pass *analysis.Pass, err types.Error, name string) error {
+- var file *ast.File
+- for _, f := range pass.Files {
+- if f.Pos() <= err.Pos && err.Pos < f.End() {
+- file = f
+- break
+- }
+- }
+- if file == nil {
+- return nil
+- }
+-
+- path, _ := astutil.PathEnclosingInterval(file, err.Pos, err.Pos)
+- if len(path) < 2 {
+- return nil
+- }
+-
+- ident, ok := path[0].(*ast.Ident)
+- if !ok || ident.Name != name {
+- return nil
+- }
+-
+- diag := analysis.Diagnostic{
+- Pos: ident.Pos(),
+- End: ident.End(),
+- Message: err.Msg,
+- }
+-
+- for i := range path {
+- switch stmt := path[i].(type) {
+- case *ast.ValueSpec:
+- // Find GenDecl to which offending ValueSpec belongs.
+- if decl, ok := path[i+1].(*ast.GenDecl); ok {
+- fixes := removeVariableFromSpec(pass, path, stmt, decl, ident)
+- // fixes may be nil
+- if len(fixes) > 0 {
+- diag.SuggestedFixes = fixes
+- pass.Report(diag)
+- }
+- }
+-
+- case *ast.AssignStmt:
+- if stmt.Tok != token.DEFINE {
+- continue
+- }
+-
+- containsIdent := false
+- for _, expr := range stmt.Lhs {
+- if expr == ident {
+- containsIdent = true
+- }
+- }
+- if !containsIdent {
+- continue
+- }
+-
+- fixes := removeVariableFromAssignment(pass, path, stmt, ident)
+- // fixes may be nil
+- if len(fixes) > 0 {
+- diag.SuggestedFixes = fixes
+- pass.Report(diag)
+- }
+- }
+- }
+-
+- return nil
+-}
+-
+-func removeVariableFromSpec(pass *analysis.Pass, path []ast.Node, stmt *ast.ValueSpec, decl *ast.GenDecl, ident *ast.Ident) []analysis.SuggestedFix {
+- newDecl := new(ast.GenDecl)
+- *newDecl = *decl
+- newDecl.Specs = nil
+-
+- for _, spec := range decl.Specs {
+- if spec != stmt {
+- newDecl.Specs = append(newDecl.Specs, spec)
+- continue
+- }
+-
+- newSpec := new(ast.ValueSpec)
+- *newSpec = *stmt
+- newSpec.Names = nil
+-
+- for _, n := range stmt.Names {
+- if n != ident {
+- newSpec.Names = append(newSpec.Names, n)
+- }
+- }
+-
+- if len(newSpec.Names) > 0 {
+- newDecl.Specs = append(newDecl.Specs, newSpec)
+- }
+- }
+-
+- // decl.End() does not include any comments, so if a comment is present we
+- // need to account for it when we delete the statement
+- end := decl.End()
+- if stmt.Comment != nil && stmt.Comment.End() > end {
+- end = stmt.Comment.End()
+- }
+-
+- // There are no other specs left in the declaration, the whole statement can
+- // be deleted
+- if len(newDecl.Specs) == 0 {
+- // Find parent DeclStmt and delete it
+- for _, node := range path {
+- if declStmt, ok := node.(*ast.DeclStmt); ok {
+- return []analysis.SuggestedFix{
+- {
+- Message: suggestedFixMessage(ident.Name),
+- TextEdits: deleteStmtFromBlock(path, declStmt),
+- },
+- }
+- }
+- }
+- }
+-
+- var b bytes.Buffer
+- if err := format.Node(&b, pass.Fset, newDecl); err != nil {
+- return nil
+- }
+-
+- return []analysis.SuggestedFix{
+- {
+- Message: suggestedFixMessage(ident.Name),
+- TextEdits: []analysis.TextEdit{
+- {
+- Pos: decl.Pos(),
+- // Avoid adding a new empty line
+- End: end + 1,
+- NewText: b.Bytes(),
+- },
+- },
+- },
+- }
+-}
+-
+-func removeVariableFromAssignment(pass *analysis.Pass, path []ast.Node, stmt *ast.AssignStmt, ident *ast.Ident) []analysis.SuggestedFix {
+- // The only variable in the assignment is unused
+- if len(stmt.Lhs) == 1 {
+- // If LHS has only one expression to be valid it has to have 1 expression
+- // on RHS
+- //
+- // RHS may have side effects, preserve RHS
+- if exprMayHaveSideEffects(stmt.Rhs[0]) {
+- // Delete until RHS
+- return []analysis.SuggestedFix{
+- {
+- Message: suggestedFixMessage(ident.Name),
+- TextEdits: []analysis.TextEdit{
+- {
+- Pos: ident.Pos(),
+- End: stmt.Rhs[0].Pos(),
+- },
+- },
+- },
+- }
+- }
+-
+- // RHS does not have any side effects, delete the whole statement
+- return []analysis.SuggestedFix{
+- {
+- Message: suggestedFixMessage(ident.Name),
+- TextEdits: deleteStmtFromBlock(path, stmt),
+- },
+- }
+- }
+-
+- // Otherwise replace ident with `_`
+- return []analysis.SuggestedFix{
+- {
+- Message: suggestedFixMessage(ident.Name),
+- TextEdits: []analysis.TextEdit{
+- {
+- Pos: ident.Pos(),
+- End: ident.End(),
+- NewText: []byte("_"),
+- },
+- },
+- },
+- }
+-}
+-
+-func suggestedFixMessage(name string) string {
+- return fmt.Sprintf("Remove variable %s", name)
+-}
+-
+-func deleteStmtFromBlock(path []ast.Node, stmt ast.Stmt) []analysis.TextEdit {
+- // Find innermost enclosing BlockStmt.
+- var block *ast.BlockStmt
+- for i := range path {
+- if blockStmt, ok := path[i].(*ast.BlockStmt); ok {
+- block = blockStmt
+- break
+- }
+- }
+-
+- nodeIndex := -1
+- for i, blockStmt := range block.List {
+- if blockStmt == stmt {
+- nodeIndex = i
+- break
+- }
+- }
+-
+- // The statement we need to delete was not found in BlockStmt
+- if nodeIndex == -1 {
+- return nil
+- }
+-
+- // Delete until the end of the block unless there is another statement after
+- // the one we are trying to delete
+- end := block.Rbrace
+- if nodeIndex < len(block.List)-1 {
+- end = block.List[nodeIndex+1].Pos()
+- }
+-
+- return []analysis.TextEdit{
+- {
+- Pos: stmt.Pos(),
+- End: end,
+- },
+- }
+-}
+-
+-// exprMayHaveSideEffects reports whether the expression may have side effects
+-// (because it contains a function call or channel receive). We disregard
+-// runtime panics as well written programs should not encounter them.
+-func exprMayHaveSideEffects(expr ast.Expr) bool {
+- var mayHaveSideEffects bool
+- ast.Inspect(expr, func(n ast.Node) bool {
+- switch n := n.(type) {
+- case *ast.CallExpr: // possible function call
+- mayHaveSideEffects = true
+- return false
+- case *ast.UnaryExpr:
+- if n.Op == token.ARROW { // channel receive
+- mayHaveSideEffects = true
+- return false
+- }
+- case *ast.FuncLit:
+- return false // evaluating what's inside a FuncLit has no effect
+- }
+- return true
+- })
+-
+- return mayHaveSideEffects
+-}
+diff -urN a/gopls/internal/lsp/analysis/unusedvariable/unusedvariable_test.go b/gopls/internal/lsp/analysis/unusedvariable/unusedvariable_test.go
+--- a/gopls/internal/lsp/analysis/unusedvariable/unusedvariable_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/unusedvariable/unusedvariable_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package unusedvariable_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/go/analysis/analysistest"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/unusedvariable"
+-)
+-
+-func Test(t *testing.T) {
+- testdata := analysistest.TestData()
+-
+- t.Run("decl", func(t *testing.T) {
+- analysistest.RunWithSuggestedFixes(t, testdata, unusedvariable.Analyzer, "decl")
+- })
+-
+- t.Run("assign", func(t *testing.T) {
+- analysistest.RunWithSuggestedFixes(t, testdata, unusedvariable.Analyzer, "assign")
+- })
+-}
+diff -urN a/gopls/internal/lsp/analysis/useany/testdata/src/a/a.go b/gopls/internal/lsp/analysis/useany/testdata/src/a/a.go
+--- a/gopls/internal/lsp/analysis/useany/testdata/src/a/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/useany/testdata/src/a/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,25 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// This file contains tests for the useany checker.
+-
+-package a
+-
+-type Any interface{}
+-
+-func _[T interface{}]() {} // want "could use \"any\" for this empty interface"
+-func _[X any, T interface{}]() {} // want "could use \"any\" for this empty interface"
+-func _[any interface{}]() {} // want "could use \"any\" for this empty interface"
+-func _[T Any]() {} // want "could use \"any\" for this empty interface"
+-func _[T interface{ int | interface{} }]() {} // want "could use \"any\" for this empty interface"
+-func _[T interface{ int | Any }]() {} // want "could use \"any\" for this empty interface"
+-func _[T any]() {}
+-
+-type _[T interface{}] int // want "could use \"any\" for this empty interface"
+-type _[X any, T interface{}] int // want "could use \"any\" for this empty interface"
+-type _[any interface{}] int // want "could use \"any\" for this empty interface"
+-type _[T Any] int // want "could use \"any\" for this empty interface"
+-type _[T interface{ int | interface{} }] int // want "could use \"any\" for this empty interface"
+-type _[T interface{ int | Any }] int // want "could use \"any\" for this empty interface"
+-type _[T any] int
+diff -urN a/gopls/internal/lsp/analysis/useany/testdata/src/a/a.go.golden b/gopls/internal/lsp/analysis/useany/testdata/src/a/a.go.golden
+--- a/gopls/internal/lsp/analysis/useany/testdata/src/a/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/useany/testdata/src/a/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,25 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// This file contains tests for the useany checker.
+-
+-package a
+-
+-type Any interface{}
+-
+-func _[T any]() {} // want "could use \"any\" for this empty interface"
+-func _[X any, T any]() {} // want "could use \"any\" for this empty interface"
+-func _[any interface{}]() {} // want "could use \"any\" for this empty interface"
+-func _[T any]() {} // want "could use \"any\" for this empty interface"
+-func _[T any]() {} // want "could use \"any\" for this empty interface"
+-func _[T any]() {} // want "could use \"any\" for this empty interface"
+-func _[T any]() {}
+-
+-type _[T any] int // want "could use \"any\" for this empty interface"
+-type _[X any, T any] int // want "could use \"any\" for this empty interface"
+-type _[any interface{}] int // want "could use \"any\" for this empty interface"
+-type _[T any] int // want "could use \"any\" for this empty interface"
+-type _[T any] int // want "could use \"any\" for this empty interface"
+-type _[T any] int // want "could use \"any\" for this empty interface"
+-type _[T any] int
+diff -urN a/gopls/internal/lsp/analysis/useany/useany.go b/gopls/internal/lsp/analysis/useany/useany.go
+--- a/gopls/internal/lsp/analysis/useany/useany.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/useany/useany.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,102 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package useany defines an Analyzer that checks for usage of interface{} in
+-// constraints, rather than the predeclared any.
+-package useany
+-
+-import (
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/analysis/passes/inspect"
+- "golang.org/x/tools/go/ast/inspector"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-const Doc = `check for constraints that could be simplified to "any"`
+-
+-var Analyzer = &analysis.Analyzer{
+- Name: "useany",
+- Doc: Doc,
+- Requires: []*analysis.Analyzer{inspect.Analyzer},
+- Run: run,
+-}
+-
+-func run(pass *analysis.Pass) (interface{}, error) {
+- inspect := pass.ResultOf[inspect.Analyzer].(*inspector.Inspector)
+-
+- universeAny := types.Universe.Lookup("any")
+- if universeAny == nil {
+- // Go <= 1.17. Nothing to check.
+- return nil, nil
+- }
+-
+- nodeFilter := []ast.Node{
+- (*ast.TypeSpec)(nil),
+- (*ast.FuncType)(nil),
+- }
+-
+- inspect.Preorder(nodeFilter, func(node ast.Node) {
+- var tparams *ast.FieldList
+- switch node := node.(type) {
+- case *ast.TypeSpec:
+- tparams = typeparams.ForTypeSpec(node)
+- case *ast.FuncType:
+- tparams = typeparams.ForFuncType(node)
+- default:
+- panic(fmt.Sprintf("unexpected node type %T", node))
+- }
+- if tparams.NumFields() == 0 {
+- return
+- }
+-
+- for _, field := range tparams.List {
+- typ := pass.TypesInfo.Types[field.Type].Type
+- if typ == nil {
+- continue // something is wrong, but not our concern
+- }
+- iface, ok := typ.Underlying().(*types.Interface)
+- if !ok {
+- continue // invalid constraint
+- }
+-
+- // If the constraint is the empty interface, offer a fix to use 'any'
+- // instead.
+- if iface.Empty() {
+- id, _ := field.Type.(*ast.Ident)
+- if id != nil && pass.TypesInfo.Uses[id] == universeAny {
+- continue
+- }
+-
+- diag := analysis.Diagnostic{
+- Pos: field.Type.Pos(),
+- End: field.Type.End(),
+- Message: `could use "any" for this empty interface`,
+- }
+-
+- // Only suggest a fix to 'any' if we actually resolve the predeclared
+- // any in this scope.
+- if scope := pass.TypesInfo.Scopes[node]; scope != nil {
+- if _, any := scope.LookupParent("any", token.NoPos); any == universeAny {
+- diag.SuggestedFixes = []analysis.SuggestedFix{{
+- Message: `use "any"`,
+- TextEdits: []analysis.TextEdit{{
+- Pos: field.Type.Pos(),
+- End: field.Type.End(),
+- NewText: []byte("any"),
+- }},
+- }}
+- }
+- }
+-
+- pass.Report(diag)
+- }
+- }
+- })
+- return nil, nil
+-}
+diff -urN a/gopls/internal/lsp/analysis/useany/useany_test.go b/gopls/internal/lsp/analysis/useany/useany_test.go
+--- a/gopls/internal/lsp/analysis/useany/useany_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/analysis/useany/useany_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,21 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package useany_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/go/analysis/analysistest"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/useany"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-func Test(t *testing.T) {
+- if !typeparams.Enabled {
+- t.Skip("type params are not enabled")
+- }
+- testdata := analysistest.TestData()
+- analysistest.RunWithSuggestedFixes(t, testdata, useany.Analyzer, "a")
+-}
+diff -urN a/gopls/internal/lsp/browser/browser.go b/gopls/internal/lsp/browser/browser.go
+--- a/gopls/internal/lsp/browser/browser.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/browser/browser.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,67 +0,0 @@
+-// Copyright 2016 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package browser provides utilities for interacting with users' browsers.
+-package browser
+-
+-import (
+- exec "golang.org/x/sys/execabs"
+- "os"
+- "runtime"
+- "time"
+-)
+-
+-// Commands returns a list of possible commands to use to open a url.
+-func Commands() [][]string {
+- var cmds [][]string
+- if exe := os.Getenv("BROWSER"); exe != "" {
+- cmds = append(cmds, []string{exe})
+- }
+- switch runtime.GOOS {
+- case "darwin":
+- cmds = append(cmds, []string{"/usr/bin/open"})
+- case "windows":
+- cmds = append(cmds, []string{"cmd", "/c", "start"})
+- default:
+- if os.Getenv("DISPLAY") != "" {
+- // xdg-open is only for use in a desktop environment.
+- cmds = append(cmds, []string{"xdg-open"})
+- }
+- }
+- cmds = append(cmds,
+- []string{"chrome"},
+- []string{"google-chrome"},
+- []string{"chromium"},
+- []string{"firefox"},
+- )
+- return cmds
+-}
+-
+-// Open tries to open url in a browser and reports whether it succeeded.
+-func Open(url string) bool {
+- for _, args := range Commands() {
+- cmd := exec.Command(args[0], append(args[1:], url)...)
+- if cmd.Start() == nil && appearsSuccessful(cmd, 3*time.Second) {
+- return true
+- }
+- }
+- return false
+-}
+-
+-// appearsSuccessful reports whether the command appears to have run successfully.
+-// If the command runs longer than the timeout, it's deemed successful.
+-// If the command runs within the timeout, it's deemed successful if it exited cleanly.
+-func appearsSuccessful(cmd *exec.Cmd, timeout time.Duration) bool {
+- errc := make(chan error, 1)
+- go func() {
+- errc <- cmd.Wait()
+- }()
+-
+- select {
+- case <-time.After(timeout):
+- return true
+- case err := <-errc:
+- return err == nil
+- }
+-}
+diff -urN a/gopls/internal/lsp/browser/README.md b/gopls/internal/lsp/browser/README.md
+--- a/gopls/internal/lsp/browser/README.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/browser/README.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1 +0,0 @@
+-This package is a copy of cmd/internal/browser from the go distribution
+\ No newline at end of file
+diff -urN a/gopls/internal/lsp/cache/analysis.go b/gopls/internal/lsp/cache/analysis.go
+--- a/gopls/internal/lsp/cache/analysis.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/analysis.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1247 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-// This file defines gopls' driver for modular static analysis (go/analysis).
+-
+-import (
+- "bytes"
+- "context"
+- "crypto/sha256"
+- "encoding/gob"
+- "encoding/json"
+- "errors"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "log"
+- "reflect"
+- "runtime/debug"
+- "sort"
+- "strings"
+- "sync"
+- "time"
+-
+- "golang.org/x/sync/errgroup"
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/gopls/internal/lsp/filecache"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/facts"
+- "golang.org/x/tools/internal/gcimporter"
+- "golang.org/x/tools/internal/memoize"
+- "golang.org/x/tools/internal/typeparams"
+- "golang.org/x/tools/internal/typesinternal"
+-)
+-
+-/*
+-
+- DESIGN
+-
+- An analysis request is for a set of analyzers and an individual
+- package ID, notated (a*, p). The result is the set of diagnostics
+- for that package. It could easily be generalized to a set of
+- packages, (a*, p*), and perhaps should be, to improve performance
+- versus calling it in a loop.
+-
+- The snapshot holds a cache (persistent.Map) of entries keyed by
+- (a*, p) pairs ("analysisKey") that have been requested so far. Some
+- of these entries may be invalidated during snapshot cloning after a
+- modification event. The cache maps each (a*, p) to a promise of
+- the analysis result or "analysisSummary". The summary contains the
+- results of analysis (e.g. diagnostics) as well as the intermediate
+- results required by the recursion, such as serialized types and
+- facts.
+-
+- The promise represents the result of a call to analyzeImpl, which
+- type-checks a package and then applies a graph of analyzers to it
+- in parallel postorder. (These graph edges are "horizontal": within
+- the same package.) First, analyzeImpl reads the source files of
+- package p, and obtains (recursively) the results of the "vertical"
+- dependencies (i.e. analyzers applied to the packages imported by
+- p). Only the subset of analyzers that use facts need be executed
+- recursively, but even if this subset is empty, the step is still
+- necessary because it provides type information. It is possible that
+- a package may need to be type-checked and analyzed twice, for
+- different subsets of analyzers, but the overlap is typically
+- insignificant.
+-
+- With the file contents and the results of vertical dependencies,
+- analyzeImpl is then in a position to produce a key representing the
+- unit of work (parsing, type-checking, and analysis) that it has to
+- do. The key is a cryptographic hash of the "recipe" for this step,
+- including the Metadata, the file contents, the set of analyzers,
+- and the type and fact information from the vertical dependencies.
+-
+- The key is sought in a machine-global persistent file-system based
+- cache. If this gopls process, or another gopls process on the same
+- machine, has already performed this analysis step, analyzeImpl will
+- make a cache hit and load the serialized summary of the results. If
+- not, it will have to proceed to type-checking and analysis, and
+- write a new cache entry. The entry contains serialized types
+- (export data) and analysis facts.
+-
+- For types, we use "shallow" export data. Historically, the Go
+- compiler always produced a summary of the types for a given package
+- that included types from other packages that it indirectly
+- referenced: "deep" export data. This had the advantage that the
+- compiler (and analogous tools such as gopls) need only load one
+- file per direct import. However, it meant that the files tended to
+- get larger based on the level of the package in the import
+- graph. For example, higher-level packages in the kubernetes module
+- have over 1MB of "deep" export data, even when they have almost no
+- content of their own, merely because they mention a major type that
+- references many others. In pathological cases the export data was
+- 300x larger than the source for a package due to this quadratic
+- growth.
+-
+- "Shallow" export data means that the serialized types describe only
+- a single package. If those types mention types from other packages,
+- the type checker may need to request additional packages beyond
+- just the direct imports. This means type information for the entire
+- transitive closure of imports may need to be available just in
+- case. After a cache hit or a cache miss, the summary is
+- postprocessed so that it contains the union of export data payloads
+- of all its direct dependencies.
+-
+- For correct dependency analysis, the digest used as a cache key
+- must reflect the "deep" export data, so it is derived recursively
+- from the transitive closure. As an optimization, we needn't include
+- every package of the transitive closure in the deep hash, only the
+- packages that were actually requested by the type checker. This
+- allows changes to a package that have no effect on its export data
+- to be "pruned". The direct consumer will need to be re-executed,
+- but if its export data is unchanged as a result, then indirect
+- consumers may not need to be re-executed. This allows, for example,
+- one to insert a print statement in a function and not "rebuild" the
+- whole application (though export data does record line numbers of
+- types which may be perturbed by otherwise insignificant changes.)
+-
+- The summary must record whether a package is transitively
+- error-free (whether it would compile) because many analyzers are
+- not safe to run on packages with inconsistent types.
+-
+- For fact encoding, we use the same fact set as the unitchecker
+- (vet) to record and serialize analysis facts. The fact
+- serialization mechanism is analogous to "deep" export data.
+-
+-*/
+-
+-// TODO(adonovan):
+-// - Profile + optimize:
+-// - on a cold run, mostly type checking + export data, unsurprisingly.
+-// - on a hot-disk run, mostly type checking the IWL.
+-// Would be nice to have a benchmark that separates this out.
+-// - measure and record in the code the typical operation times
+-// and file sizes (export data + facts = cache entries).
+-// - Do "port the old logic" tasks (see TODO in actuallyAnalyze).
+-// - Add a (white-box) test of pruning when a change doesn't affect export data.
+-// - Optimise pruning based on subset of packages mentioned in exportdata.
+-// - Better logging so that it is possible to deduce why an analyzer
+-// is not being run--often due to very indirect failures.
+-// Even if the ultimate consumer decides to ignore errors,
+-// tests and other situations want to be assured of freedom from
+-// errors, not just missing results. This should be recorded.
+-// - Check that the event trace is intelligible.
+-// - Split this into a subpackage, gopls/internal/lsp/cache/driver,
+-// consisting of this file and three helpers from errors.go.
+-// The (*snapshot).Analyze method would stay behind and make calls
+-// to the driver package.
+-// Steps:
+-// - define a narrow driver.Snapshot interface with only these methods:
+-// Metadata(PackageID) source.Metadata
+-// GetFile(Context, URI) (source.FileHandle, error)
+-// View() *View // for Options
+-// - define a State type that encapsulates the persistent map
+-// (with its own mutex), and has methods:
+-// New() *State
+-// Clone(invalidate map[PackageID]bool) *State
+-// Destroy()
+-// - share cache.{goVersionRx,parseGoImpl}
+-
+-var born = time.Now()
+-
+-// Analyze applies a set of analyzers to the package denoted by id,
+-// and returns their diagnostics for that package.
+-//
+-// The analyzers list must be duplicate free; order does not matter.
+-//
+-// Precondition: all analyzers within the process have distinct names.
+-// (The names are relied on by the serialization logic.)
+-func (s *snapshot) Analyze(ctx context.Context, id PackageID, analyzers []*source.Analyzer) ([]*source.Diagnostic, error) {
+- if false { // debugging
+- log.Println("Analyze@", time.Since(born)) // called after the 7s IWL in k8s
+- }
+-
+- // Filter and sort enabled root analyzers.
+- // A disabled analyzer may still be run if required by another.
+- toSrc := make(map[*analysis.Analyzer]*source.Analyzer)
+- var enabled []*analysis.Analyzer
+- for _, a := range analyzers {
+- if a.IsEnabled(s.view.Options()) {
+- toSrc[a.Analyzer] = a
+- enabled = append(enabled, a.Analyzer)
+- }
+- }
+- sort.Slice(enabled, func(i, j int) bool {
+- return enabled[i].Name < enabled[j].Name
+- })
+-
+- // Register fact types of required analyzers.
+- for _, a := range requiredAnalyzers(enabled) {
+- for _, f := range a.FactTypes {
+- gob.Register(f)
+- }
+- }
+-
+- if false { // debugging
+- // TODO(adonovan): use proper tracing.
+- t0 := time.Now()
+- defer func() {
+- log.Printf("%v for analyze(%s, %s)", time.Since(t0), id, enabled)
+- }()
+- }
+-
+- // Run the analysis.
+- res, err := s.analyze(ctx, id, enabled)
+- if err != nil {
+- return nil, err
+- }
+-
+- // Report diagnostics only from enabled actions that succeeded.
+- // Errors from creating or analyzing packages are ignored.
+- // Diagnostics are reported in the order of the analyzers argument.
+- //
+- // TODO(adonovan): ignoring action errors gives the caller no way
+- // to distinguish "there are no problems in this code" from
+- // "the code (or analyzers!) are so broken that we couldn't even
+- // begin the analysis you asked for".
+- // Even if current callers choose to discard the
+- // results, we should propagate the per-action errors.
+- var results []*source.Diagnostic
+- for _, a := range enabled {
+- summary := res.Actions[a.Name]
+- if summary.Err != "" {
+- continue // action failed
+- }
+- for _, gobDiag := range summary.Diagnostics {
+- results = append(results, toSourceDiagnostic(toSrc[a], &gobDiag))
+- }
+- }
+- return results, nil
+-}
+-
+-// analysisKey is the type of keys in the snapshot.analyses map.
+-type analysisKey struct {
+- analyzerNames string
+- pkgid PackageID
+-}
+-
+-func (key analysisKey) String() string {
+- return fmt.Sprintf("%s@%s", key.analyzerNames, key.pkgid)
+-}
+-
+-// analyzeSummary is a gob-serializable summary of successfully
+-// applying a list of analyzers to a package.
+-type analyzeSummary struct {
+- PkgPath PackagePath // types.Package.Path() (needed to decode export data)
+- Export []byte
+- DeepExportHash source.Hash // hash of reflexive transitive closure of export data
+- Compiles bool // transitively free of list/parse/type errors
+- Actions actionsMap // map from analyzer name to analysis results (*actionSummary)
+-
+- // Not serialized: populated after the summary is computed or deserialized.
+- allExport map[PackagePath][]byte // transitive export data
+-}
+-
+-// actionsMap defines a stable Gob encoding for a map.
+-// TODO(adonovan): generalize and move to a library when we can use generics.
+-type actionsMap map[string]*actionSummary
+-
+-var _ gob.GobEncoder = (actionsMap)(nil)
+-var _ gob.GobDecoder = (*actionsMap)(nil)
+-
+-type actionsMapEntry struct {
+- K string
+- V *actionSummary
+-}
+-
+-func (m actionsMap) GobEncode() ([]byte, error) {
+- entries := make([]actionsMapEntry, 0, len(m))
+- for k, v := range m {
+- entries = append(entries, actionsMapEntry{k, v})
+- }
+- sort.Slice(entries, func(i, j int) bool {
+- return entries[i].K < entries[j].K
+- })
+- var buf bytes.Buffer
+- err := gob.NewEncoder(&buf).Encode(entries)
+- return buf.Bytes(), err
+-}
+-
+-func (m *actionsMap) GobDecode(data []byte) error {
+- var entries []actionsMapEntry
+- if err := gob.NewDecoder(bytes.NewReader(data)).Decode(&entries); err != nil {
+- return err
+- }
+- *m = make(actionsMap, len(entries))
+- for _, e := range entries {
+- (*m)[e.K] = e.V
+- }
+- return nil
+-}
+-
+-// actionSummary is a gob-serializable summary of one possibly failed analysis action.
+-// If Err is non-empty, the other fields are undefined.
+-type actionSummary struct {
+- Facts []byte // the encoded facts.Set
+- FactsHash source.Hash // hash(Facts)
+- Diagnostics []gobDiagnostic
+- Err string // "" => success
+-}
+-
+-// analyze is a memoization of analyzeImpl.
+-func (s *snapshot) analyze(ctx context.Context, id PackageID, analyzers []*analysis.Analyzer) (*analyzeSummary, error) {
+- // Use the sorted list of names of analyzers in the key.
+- //
+- // TODO(adonovan): opt: account for analysis results at a
+- // finer grain to avoid duplicate work when a
+- // a proper subset of analyzers is requested?
+- // In particular, TypeErrorAnalyzers don't use facts
+- // but need to request vdeps just for type information.
+- names := make([]string, 0, len(analyzers))
+- for _, a := range analyzers {
+- names = append(names, a.Name)
+- }
+- // This key describes the result of applying a list of analyzers to a package.
+- key := analysisKey{strings.Join(names, ","), id}
+-
+- // An analysisPromise represents the result of loading, parsing,
+- // type-checking and analyzing a single package.
+- type analysisPromise struct {
+- promise *memoize.Promise // [analyzeImplResult]
+- }
+-
+- type analyzeImplResult struct {
+- summary *analyzeSummary
+- err error
+- }
+-
+- // Access the map once, briefly, and atomically.
+- s.mu.Lock()
+- entry, hit := s.analyses.Get(key)
+- if !hit {
+- entry = analysisPromise{
+- promise: memoize.NewPromise("analysis", func(ctx context.Context, arg interface{}) interface{} {
+- summary, err := analyzeImpl(ctx, arg.(*snapshot), analyzers, id)
+- return analyzeImplResult{summary, err}
+- }),
+- }
+- s.analyses.Set(key, entry, nil) // nothing needs releasing
+- }
+- s.mu.Unlock()
+-
+- // Await result.
+- ap := entry.(analysisPromise)
+- v, err := s.awaitPromise(ctx, ap.promise)
+- if err != nil {
+- return nil, err // e.g. cancelled
+- }
+- res := v.(analyzeImplResult)
+- return res.summary, res.err
+-}
+-
+-// analyzeImpl applies a list of analyzers (plus any others
+-// transitively required by them) to a package. It succeeds as long
+-// as it could produce a types.Package, even if there were direct or
+-// indirect list/parse/type errors, and even if all the analysis
+-// actions failed. It usually fails only if the package was unknown,
+-// a file was missing, or the operation was cancelled.
+-//
+-// Postcondition: analyzeImpl must not continue to use the snapshot
+-// (in background goroutines) after it has returned; see memoize.RefCounted.
+-func analyzeImpl(ctx context.Context, snapshot *snapshot, analyzers []*analysis.Analyzer, id PackageID) (*analyzeSummary, error) {
+- m := snapshot.Metadata(id)
+- if m == nil {
+- return nil, fmt.Errorf("no metadata for %s", id)
+- }
+-
+- // Recursively analyze each "vertical" dependency
+- // for its types.Package and (perhaps) analysis.Facts.
+- // If any of them fails to produce a package, we cannot continue.
+- // We request only the analyzers that produce facts.
+- //
+- // Also, load the contents of each "compiled" Go file through
+- // the snapshot's cache.
+- //
+- // Both loops occur in parallel, and parallel with each other.
+- vdeps := make(map[PackageID]*analyzeSummary)
+- compiledGoFiles := make([]source.FileHandle, len(m.CompiledGoFiles))
+- {
+- var group errgroup.Group
+-
+- // Analyze vertical dependencies.
+- // We request only the required analyzers that use facts.
+- var useFacts []*analysis.Analyzer
+- for _, a := range requiredAnalyzers(analyzers) {
+- if len(a.FactTypes) > 0 {
+- useFacts = append(useFacts, a)
+- }
+- }
+- var vdepsMu sync.Mutex
+- for _, id := range m.DepsByPkgPath {
+- id := id
+- group.Go(func() error {
+- res, err := snapshot.analyze(ctx, id, useFacts)
+- if err != nil {
+- return err // cancelled, or failed to produce a package
+- }
+-
+- vdepsMu.Lock()
+- vdeps[id] = res
+- vdepsMu.Unlock()
+- return nil
+- })
+- }
+-
+- // Read file contents.
+- // (In practice these will be cache hits
+- // on reads done by the initial workspace load
+- // or after a change modification event.)
+- for i, uri := range m.CompiledGoFiles {
+- i, uri := i, uri
+- group.Go(func() error {
+- fh, err := snapshot.GetFile(ctx, uri) // ~25us
+- compiledGoFiles[i] = fh
+- return err // e.g. cancelled
+- })
+- }
+-
+- if err := group.Wait(); err != nil {
+- return nil, err
+- }
+- }
+-
+- // Inv: analyze() of all vdeps succeeded (though some actions may have failed).
+-
+- // We no longer depend on the snapshot.
+- snapshot = nil
+-
+- // At this point we have the action results (serialized
+- // packages and facts) of our immediate dependencies,
+- // and the metadata and content of this package.
+- //
+- // We now compute a hash for all our inputs, and consult a
+- // global cache of promised results. If nothing material
+- // has changed, we'll make a hit in the shared cache.
+- //
+- // The hash of our inputs is based on the serialized export
+- // data and facts so that immaterial changes can be pruned
+- // without decoding.
+- key := analysisCacheKey(analyzers, m, compiledGoFiles, vdeps)
+-
+- // Access the cache.
+- var summary *analyzeSummary
+- const cacheKind = "analysis"
+- if data, err := filecache.Get(cacheKind, key); err == nil {
+- // cache hit
+- mustDecode(data, &summary)
+-
+- } else if err != filecache.ErrNotFound {
+- return nil, bug.Errorf("internal error reading shared cache: %v", err)
+-
+- } else {
+- // Cache miss: do the work.
+- var err error
+- summary, err = actuallyAnalyze(ctx, analyzers, m, vdeps, compiledGoFiles)
+- if err != nil {
+- return nil, err
+- }
+- data := mustEncode(summary)
+- if false {
+- log.Printf("Set key=%d value=%d id=%s\n", len(key), len(data), id)
+- }
+- if err := filecache.Set(cacheKind, key, data); err != nil {
+- return nil, fmt.Errorf("internal error updating shared cache: %v", err)
+- }
+- }
+-
+- // Hit or miss, we need to merge the export data from
+- // dependencies so that it includes all the types
+- // that might be summoned by the type checker.
+- //
+- // TODO(adonovan): opt: reduce this set by recording
+- // which packages were actually summoned by insert().
+- // (Just makes map smaller; probably marginal?)
+- allExport := make(map[PackagePath][]byte)
+- for _, vdep := range vdeps {
+- for k, v := range vdep.allExport {
+- allExport[k] = v
+- }
+- }
+- allExport[m.PkgPath] = summary.Export
+- summary.allExport = allExport
+-
+- return summary, nil
+-}
+-
+-// analysisCacheKey returns a cache key that is a cryptographic digest
+-// of the all the values that might affect type checking and analysis:
+-// the analyzer names, package metadata, names and contents of
+-// compiled Go files, and vdeps information (export data and facts).
+-//
+-// TODO(adonovan): safety: define our own flavor of Metadata
+-// containing just the fields we need, and using it in the subsequent
+-// logic, to keep us honest about hashing all parts that matter?
+-func analysisCacheKey(analyzers []*analysis.Analyzer, m *source.Metadata, compiledGoFiles []source.FileHandle, vdeps map[PackageID]*analyzeSummary) [sha256.Size]byte {
+- hasher := sha256.New()
+-
+- // In principle, a key must be the hash of an
+- // unambiguous encoding of all the relevant data.
+- // If it's ambiguous, we risk collisions.
+-
+- // analyzers
+- fmt.Fprintf(hasher, "analyzers: %d\n", len(analyzers))
+- for _, a := range analyzers {
+- fmt.Fprintln(hasher, a.Name)
+- }
+-
+- // package metadata
+- fmt.Fprintf(hasher, "package: %s %s %s\n", m.ID, m.Name, m.PkgPath)
+- // We can ignore m.DepsBy{Pkg,Import}Path: although the logic
+- // uses those fields, we account for them by hashing vdeps.
+-
+- // type sizes
+- // This assertion is safe, but if a black-box implementation
+- // is ever needed, record Sizeof(*int) and Alignof(int64).
+- sz := m.TypesSizes.(*types.StdSizes)
+- fmt.Fprintf(hasher, "sizes: %d %d\n", sz.WordSize, sz.MaxAlign)
+-
+- // metadata errors: used for 'compiles' field
+- fmt.Fprintf(hasher, "errors: %d", len(m.Errors))
+-
+- // module Go version
+- if m.Module != nil && m.Module.GoVersion != "" {
+- fmt.Fprintf(hasher, "go %s\n", m.Module.GoVersion)
+- }
+-
+- // file names and contents
+- fmt.Fprintf(hasher, "files: %d\n", len(compiledGoFiles))
+- for _, fh := range compiledGoFiles {
+- fmt.Fprintln(hasher, fh.FileIdentity())
+- }
+-
+- // vdeps, in PackageID order
+- depIDs := make([]string, 0, len(vdeps))
+- for depID := range vdeps {
+- depIDs = append(depIDs, string(depID))
+- }
+- sort.Strings(depIDs)
+- for _, depID := range depIDs {
+- vdep := vdeps[PackageID(depID)]
+- fmt.Fprintf(hasher, "dep: %s\n", vdep.PkgPath)
+- fmt.Fprintf(hasher, "export: %s\n", vdep.DeepExportHash)
+-
+- // action results: errors and facts
+- names := make([]string, 0, len(vdep.Actions))
+- for name := range vdep.Actions {
+- names = append(names, name)
+- }
+- sort.Strings(names)
+- for _, name := range names {
+- summary := vdep.Actions[name]
+- fmt.Fprintf(hasher, "action %s\n", name)
+- if summary.Err != "" {
+- fmt.Fprintf(hasher, "error %s\n", summary.Err)
+- } else {
+- fmt.Fprintf(hasher, "facts %s\n", summary.FactsHash)
+- // We can safely omit summary.diagnostics
+- // from the key since they have no downstream effect.
+- }
+- }
+- }
+-
+- var hash [sha256.Size]byte
+- hasher.Sum(hash[:0])
+- return hash
+-}
+-
+-// actuallyAnalyze implements the cache-miss case.
+-// This function does not access the snapshot.
+-func actuallyAnalyze(ctx context.Context, analyzers []*analysis.Analyzer, m *source.Metadata, vdeps map[PackageID]*analyzeSummary, compiledGoFiles []source.FileHandle) (*analyzeSummary, error) {
+-
+- // Create a local FileSet for processing this package only.
+- fset := token.NewFileSet()
+-
+- // Parse only the "compiled" Go files.
+- // Do the computation in parallel.
+- parsed := make([]*source.ParsedGoFile, len(compiledGoFiles))
+- {
+- var group errgroup.Group
+- for i, fh := range compiledGoFiles {
+- i, fh := i, fh
+- group.Go(func() error {
+- // Call parseGoImpl directly, not the caching wrapper,
+- // as cached ASTs require the global FileSet.
+- pgf, err := parseGoImpl(ctx, fset, fh, source.ParseFull)
+- parsed[i] = pgf
+- return err
+- })
+- }
+- if err := group.Wait(); err != nil {
+- return nil, err // cancelled, or catastrophic error (e.g. missing file)
+- }
+- }
+-
+- // Type-check the package.
+- pkg := typeCheckForAnalysis(fset, parsed, m, vdeps)
+-
+- // Build a map of PkgPath to *Package for all packages mentioned
+- // in exportdata for use by facts.
+- pkg.factsDecoder = facts.NewDecoder(pkg.types)
+-
+- // Poll cancellation state.
+- if err := ctx.Err(); err != nil {
+- return nil, err
+- }
+-
+- // TODO(adonovan): port the old logic to:
+- // - gather go/packages diagnostics from m.Errors? (port goPackagesErrorDiagnostics)
+- // - record unparseable file URIs so we can suppress type errors for these files.
+- // - gather diagnostics from expandErrors + typeErrorDiagnostics + depsErrors.
+-
+- // -- analysis --
+-
+- // Build action graph for this package.
+- // Each graph node (action) is one unit of analysis.
+- actions := make(map[*analysis.Analyzer]*action)
+- var mkAction func(a *analysis.Analyzer) *action
+- mkAction = func(a *analysis.Analyzer) *action {
+- act, ok := actions[a]
+- if !ok {
+- var hdeps []*action
+- for _, req := range a.Requires {
+- hdeps = append(hdeps, mkAction(req))
+- }
+- act = &action{a: a, pkg: pkg, vdeps: vdeps, hdeps: hdeps}
+- actions[a] = act
+- }
+- return act
+- }
+-
+- // Build actions for initial package.
+- var roots []*action
+- for _, a := range analyzers {
+- roots = append(roots, mkAction(a))
+- }
+-
+- // Execute the graph in parallel.
+- execActions(roots)
+-
+- // Don't return (or cache) the result in case of cancellation.
+- if err := ctx.Err(); err != nil {
+- return nil, err // cancelled
+- }
+-
+- // Return summaries only for the requested actions.
+- summaries := make(map[string]*actionSummary)
+- for _, act := range roots {
+- summaries[act.a.Name] = act.summary
+- }
+-
+- return &analyzeSummary{
+- PkgPath: PackagePath(pkg.types.Path()),
+- Export: pkg.export,
+- DeepExportHash: pkg.deepExportHash,
+- Compiles: pkg.compiles,
+- Actions: summaries,
+- }, nil
+-}
+-
+-func typeCheckForAnalysis(fset *token.FileSet, parsed []*source.ParsedGoFile, m *source.Metadata, vdeps map[PackageID]*analyzeSummary) *analysisPackage {
+- if false { // debugging
+- log.Println("typeCheckForAnalysis", m.PkgPath)
+- }
+-
+- pkg := &analysisPackage{
+- m: m,
+- fset: fset,
+- parsed: parsed,
+- files: make([]*ast.File, len(parsed)),
+- compiles: len(m.Errors) == 0, // false => list error
+- types: types.NewPackage(string(m.PkgPath), string(m.Name)),
+- typesInfo: &types.Info{
+- Types: make(map[ast.Expr]types.TypeAndValue),
+- Defs: make(map[*ast.Ident]types.Object),
+- Uses: make(map[*ast.Ident]types.Object),
+- Implicits: make(map[ast.Node]types.Object),
+- Selections: make(map[*ast.SelectorExpr]*types.Selection),
+- Scopes: make(map[ast.Node]*types.Scope),
+- },
+- typesSizes: m.TypesSizes,
+- }
+- typeparams.InitInstanceInfo(pkg.typesInfo)
+-
+- for i, p := range parsed {
+- pkg.files[i] = p.File
+- if p.ParseErr != nil {
+- pkg.compiles = false // parse error
+- }
+- }
+-
+- // Unsafe is special.
+- if m.PkgPath == "unsafe" {
+- pkg.types = types.Unsafe
+- return pkg
+- }
+-
+- // Compute the union of transitive export data.
+- // (The actual values are shared, and not serialized.)
+- allExport := make(map[PackagePath][]byte)
+- for _, vdep := range vdeps {
+- for k, v := range vdep.allExport {
+- allExport[k] = v
+- }
+-
+- if !vdep.Compiles {
+- pkg.compiles = false // transitive error
+- }
+- }
+-
+- // exportHasher computes a hash of the names and export data of
+- // each package that was actually loaded during type checking.
+- //
+- // Because we use shallow export data, the hash for dependency
+- // analysis must incorporate indirect dependencies. As an
+- // optimization, we include only those that were actually
+- // used, which may be a small subset of those available.
+- //
+- // TODO(adonovan): opt: even better would be to implement a
+- // traversal over the package API like facts.NewDecoder does
+- // and only mention that set of packages in the hash.
+- // Perhaps there's a way to do that more efficiently.
+- //
+- // TODO(adonovan): opt: record the shallow hash alongside the
+- // shallow export data in the allExport map to avoid repeatedly
+- // hashing the export data.
+- //
+- // The writes to hasher below assume that type checking imports
+- // packages in a deterministic order.
+- exportHasher := sha256.New()
+- hashExport := func(pkgPath PackagePath, export []byte) {
+- fmt.Fprintf(exportHasher, "%s %d ", pkgPath, len(export))
+- exportHasher.Write(export)
+- }
+-
+- // importer state
+- var (
+- insert func(p *types.Package, name string)
+- importMap = make(map[string]*types.Package) // keys are PackagePaths
+- )
+- loadFromExportData := func(pkgPath PackagePath) (*types.Package, error) {
+- export, ok := allExport[pkgPath]
+- if !ok {
+- return nil, bug.Errorf("missing export data for %q", pkgPath)
+- }
+- hashExport(pkgPath, export)
+- imported, err := gcimporter.IImportShallow(fset, importMap, export, string(pkgPath), insert)
+- if err != nil {
+- return nil, bug.Errorf("invalid export data for %q: %v", pkgPath, err)
+- }
+- return imported, nil
+- }
+- insert = func(p *types.Package, name string) {
+- imported, err := loadFromExportData(PackagePath(p.Path()))
+- if err != nil {
+- log.Fatalf("internal error: %v", err)
+- }
+- if imported != p {
+- log.Fatalf("internal error: inconsistent packages")
+- }
+- }
+-
+- cfg := &types.Config{
+- Sizes: m.TypesSizes,
+- Error: func(e error) {
+- pkg.compiles = false // type error
+- pkg.typeErrors = append(pkg.typeErrors, e.(types.Error))
+- },
+- Importer: importerFunc(func(importPath string) (*types.Package, error) {
+- if importPath == "unsafe" {
+- return types.Unsafe, nil // unsafe has no export data
+- }
+-
+- // Beware that returning an error from this function
+- // will cause the type checker to synthesize a fake
+- // package whose Path is importPath, potentially
+- // losing a vendor/ prefix. If type-checking errors
+- // are swallowed, these packages may be confusing.
+-
+- id, ok := m.DepsByImpPath[ImportPath(importPath)]
+- if !ok {
+- // The import syntax is inconsistent with the metadata.
+- // This could be because the import declaration was
+- // incomplete and the metadata only includes complete
+- // imports; or because the metadata ignores import
+- // edges that would lead to cycles in the graph.
+- return nil, fmt.Errorf("missing metadata for import of %q", importPath)
+- }
+-
+- depResult, ok := vdeps[id] // id may be ""
+- if !ok {
+- // Analogous to (*snapshot).missingPkgError
+- // in the logic for regular type-checking,
+- // but without a snapshot we can't provide
+- // such detail, and anyway most analysis
+- // failures aren't surfaced in the UI.
+- return nil, fmt.Errorf("no required module provides package %q (id=%q)", importPath, id)
+- }
+-
+- // (Duplicates logic from check.go.)
+- if !source.IsValidImport(m.PkgPath, depResult.PkgPath) {
+- return nil, fmt.Errorf("invalid use of internal package %s", importPath)
+- }
+-
+- return loadFromExportData(depResult.PkgPath)
+- }),
+- }
+-
+- // Set Go dialect.
+- if m.Module != nil && m.Module.GoVersion != "" {
+- goVersion := "go" + m.Module.GoVersion
+- // types.NewChecker panics if GoVersion is invalid.
+- // An unparsable mod file should probably stop us
+- // before we get here, but double check just in case.
+- if goVersionRx.MatchString(goVersion) {
+- typesinternal.SetGoVersion(cfg, goVersion)
+- }
+- }
+-
+- // We want to type check cgo code if go/types supports it.
+- // We passed typecheckCgo to go/packages when we Loaded.
+- // TODO(adonovan): do we actually need this??
+- typesinternal.SetUsesCgo(cfg)
+-
+- check := types.NewChecker(cfg, fset, pkg.types, pkg.typesInfo)
+-
+- // Type checking errors are handled via the config, so ignore them here.
+- _ = check.Files(pkg.files)
+-
+- // debugging (type errors are quite normal)
+- if false {
+- if pkg.typeErrors != nil {
+- log.Printf("package %s has type errors: %v", pkg.types.Path(), pkg.typeErrors)
+- }
+- }
+-
+- // Emit the export data and compute the deep hash.
+- export, err := gcimporter.IExportShallow(pkg.fset, pkg.types)
+- if err != nil {
+- // TODO(adonovan): in light of exporter bugs such as #57729,
+- // consider using bug.Report here and retrying the IExportShallow
+- // call here using an empty types.Package.
+- log.Fatalf("internal error writing shallow export data: %v", err)
+- }
+- pkg.export = export
+- hashExport(m.PkgPath, export)
+- exportHasher.Sum(pkg.deepExportHash[:0])
+-
+- return pkg
+-}
+-
+-// analysisPackage contains information about a package, including
+-// syntax trees, used transiently during its type-checking and analysis.
+-type analysisPackage struct {
+- m *source.Metadata
+- fset *token.FileSet // local to this package
+- parsed []*source.ParsedGoFile
+- files []*ast.File // same as parsed[i].File
+- types *types.Package
+- compiles bool // package is transitively free of list/parse/type errors
+- factsDecoder *facts.Decoder
+- export []byte // encoding of types.Package
+- deepExportHash source.Hash // reflexive transitive hash of export data
+- typesInfo *types.Info
+- typeErrors []types.Error
+- typesSizes types.Sizes
+-}
+-
+-// An action represents one unit of analysis work: the application of
+-// one analysis to one package. Actions form a DAG, both within a
+-// package (as different analyzers are applied, either in sequence or
+-// parallel), and across packages (as dependencies are analyzed).
+-type action struct {
+- once sync.Once
+- a *analysis.Analyzer
+- pkg *analysisPackage
+- hdeps []*action // horizontal dependencies
+- vdeps map[PackageID]*analyzeSummary // vertical dependencies
+-
+- // results of action.exec():
+- result interface{} // result of Run function, of type a.ResultType
+- summary *actionSummary
+- err error
+-}
+-
+-func (act *action) String() string {
+- return fmt.Sprintf("%s@%s", act.a.Name, act.pkg.m.ID)
+-}
+-
+-// execActions executes a set of action graph nodes in parallel.
+-func execActions(actions []*action) {
+- var wg sync.WaitGroup
+- for _, act := range actions {
+- act := act
+- wg.Add(1)
+- go func() {
+- defer wg.Done()
+- act.once.Do(func() {
+- execActions(act.hdeps) // analyze "horizontal" dependencies
+- act.result, act.summary, act.err = act.exec()
+- if act.err != nil {
+- act.summary = &actionSummary{Err: act.err.Error()}
+- // TODO(adonovan): suppress logging. But
+- // shouldn't the root error's causal chain
+- // include this information?
+- if false { // debugging
+- log.Printf("act.exec(%v) failed: %v", act, act.err)
+- }
+- }
+- })
+- }()
+- }
+- wg.Wait()
+-}
+-
+-// exec defines the execution of a single action.
+-// It returns the (ephemeral) result of the analyzer's Run function,
+-// along with its (serializable) facts and diagnostics.
+-// Or it returns an error if the analyzer did not run to
+-// completion and deliver a valid result.
+-func (act *action) exec() (interface{}, *actionSummary, error) {
+- analyzer := act.a
+- pkg := act.pkg
+-
+- hasFacts := len(analyzer.FactTypes) > 0
+-
+- // Report an error if any action dependency (vertical or horizontal) failed.
+- // To avoid long error messages describing chains of failure,
+- // we return the dependencies' error' unadorned.
+- if hasFacts {
+- // TODO(adonovan): use deterministic order.
+- for _, res := range act.vdeps {
+- if vdep := res.Actions[analyzer.Name]; vdep.Err != "" {
+- return nil, nil, errors.New(vdep.Err)
+- }
+- }
+- }
+- for _, dep := range act.hdeps {
+- if dep.err != nil {
+- return nil, nil, dep.err
+- }
+- }
+- // Inv: all action dependencies succeeded.
+-
+- // Were there list/parse/type errors that might prevent analysis?
+- if !pkg.compiles && !analyzer.RunDespiteErrors {
+- return nil, nil, fmt.Errorf("skipping analysis %q because package %q does not compile", analyzer.Name, pkg.m.ID)
+- }
+- // Inv: package is well-formed enough to proceed with analysis.
+-
+- if false { // debugging
+- log.Println("action.exec", act)
+- }
+-
+- // Gather analysis Result values from horizontal dependencies.
+- var inputs = make(map[*analysis.Analyzer]interface{})
+- for _, dep := range act.hdeps {
+- inputs[dep.a] = dep.result
+- }
+-
+- // TODO(adonovan): opt: facts.Set works but it may be more
+- // efficient to fork and tailor it to our precise needs.
+- //
+- // We've already sharded the fact encoding by action
+- // so that it can be done in parallel (hoisting the
+- // ImportMap call so that we build the map once per package).
+- // We could eliminate locking.
+- // We could also dovetail more closely with the export data
+- // decoder to obtain a more compact representation of
+- // packages and objects (e.g. its internal IDs, instead
+- // of PkgPaths and objectpaths.)
+-
+- // Read and decode analysis facts for each imported package.
+- factset, err := pkg.factsDecoder.Decode(func(imp *types.Package) ([]byte, error) {
+- if !hasFacts {
+- return nil, nil // analyzer doesn't use facts, so no vdeps
+- }
+-
+- // Package.Imports() may contain a fake "C" package. Ignore it.
+- if imp.Path() == "C" {
+- return nil, nil
+- }
+-
+- id, ok := pkg.m.DepsByPkgPath[PackagePath(imp.Path())]
+- if !ok {
+- // This may mean imp was synthesized by the type
+- // checker because it failed to import it for any reason
+- // (e.g. bug processing export data; metadata ignoring
+- // a cycle-forming import).
+- // In that case, the fake package's imp.Path
+- // is set to the failed importPath (and thus
+- // it may lack a "vendor/" prefix).
+- //
+- // For now, silently ignore it on the assumption
+- // that the error is already reported elsewhere.
+- // return nil, fmt.Errorf("missing metadata")
+- return nil, nil
+- }
+-
+- vdep, ok := act.vdeps[id]
+- if !ok {
+- return nil, bug.Errorf("internal error in %s: missing vdep for id=%s", pkg.types.Path(), id)
+- }
+- return vdep.Actions[analyzer.Name].Facts, nil
+- })
+- if err != nil {
+- return nil, nil, fmt.Errorf("internal error decoding analysis facts: %w", err)
+- }
+-
+- // TODO(adonovan): make Export*Fact panic rather than discarding
+- // undeclared fact types, so that we discover bugs in analyzers.
+- factFilter := make(map[reflect.Type]bool)
+- for _, f := range analyzer.FactTypes {
+- factFilter[reflect.TypeOf(f)] = true
+- }
+-
+- // posToLocation converts from token.Pos to protocol form.
+- // TODO(adonovan): improve error messages.
+- posToLocation := func(start, end token.Pos) (protocol.Location, error) {
+- tokFile := pkg.fset.File(start)
+- for _, p := range pkg.parsed {
+- if p.Tok == tokFile {
+- if end == token.NoPos {
+- end = start
+- }
+- return p.PosLocation(start, end)
+- }
+- }
+- return protocol.Location{},
+- bug.Errorf("internal error: token.Pos not within package")
+- }
+-
+- // Now run the (pkg, analyzer) action.
+- var diagnostics []gobDiagnostic
+- pass := &analysis.Pass{
+- Analyzer: analyzer,
+- Fset: pkg.fset,
+- Files: pkg.files,
+- Pkg: pkg.types,
+- TypesInfo: pkg.typesInfo,
+- TypesSizes: pkg.typesSizes,
+- TypeErrors: pkg.typeErrors,
+- ResultOf: inputs,
+- Report: func(d analysis.Diagnostic) {
+- // Prefix the diagnostic category with the analyzer's name.
+- if d.Category == "" {
+- d.Category = analyzer.Name
+- } else {
+- d.Category = analyzer.Name + "." + d.Category
+- }
+-
+- diagnostic, err := toGobDiagnostic(posToLocation, d)
+- if err != nil {
+- bug.Reportf("internal error converting diagnostic from analyzer %q: %v", analyzer.Name, err)
+- return
+- }
+- diagnostics = append(diagnostics, diagnostic)
+- },
+- ImportObjectFact: factset.ImportObjectFact,
+- ExportObjectFact: factset.ExportObjectFact,
+- ImportPackageFact: factset.ImportPackageFact,
+- ExportPackageFact: factset.ExportPackageFact,
+- AllObjectFacts: func() []analysis.ObjectFact { return factset.AllObjectFacts(factFilter) },
+- AllPackageFacts: func() []analysis.PackageFact { return factset.AllPackageFacts(factFilter) },
+- }
+-
+- // Recover from panics (only) within the analyzer logic.
+- // (Use an anonymous function to limit the recover scope.)
+- var result interface{}
+- func() {
+- defer func() {
+- if r := recover(); r != nil {
+- // An Analyzer panicked, likely due to a bug.
+- //
+- // In general we want to discover and fix such panics quickly,
+- // so we don't suppress them, but some bugs in third-party
+- // analyzers cannot be quickly fixed, so we use an allowlist
+- // to suppress panics.
+- const strict = true
+- if strict && bug.PanicOnBugs &&
+- analyzer.Name != "buildir" { // see https://github.com/dominikh/go-tools/issues/1343
+- // Uncomment this when debugging suspected failures
+- // in the driver, not the analyzer.
+- if false {
+- debug.SetTraceback("all") // show all goroutines
+- }
+- panic(r)
+- } else {
+- // In production, suppress the panic and press on.
+- err = fmt.Errorf("analysis %s for package %s panicked: %v", analyzer.Name, pass.Pkg.Path(), r)
+- }
+- }
+- }()
+- result, err = pass.Analyzer.Run(pass)
+- }()
+- if err != nil {
+- return nil, nil, err
+- }
+-
+- if got, want := reflect.TypeOf(result), pass.Analyzer.ResultType; got != want {
+- return nil, nil, bug.Errorf(
+- "internal error: on package %s, analyzer %s returned a result of type %v, but declared ResultType %v",
+- pass.Pkg.Path(), pass.Analyzer, got, want)
+- }
+-
+- // Disallow Export*Fact calls after Run.
+- // (A panic means the Analyzer is abusing concurrency.)
+- pass.ExportObjectFact = func(obj types.Object, fact analysis.Fact) {
+- panic(fmt.Sprintf("%v: Pass.ExportObjectFact(%s, %T) called after Run", act, obj, fact))
+- }
+- pass.ExportPackageFact = func(fact analysis.Fact) {
+- panic(fmt.Sprintf("%v: Pass.ExportPackageFact(%T) called after Run", act, fact))
+- }
+-
+- factsdata := factset.Encode()
+- return result, &actionSummary{
+- Diagnostics: diagnostics,
+- Facts: factsdata,
+- FactsHash: source.HashOf(factsdata),
+- }, nil
+-}
+-
+-// requiredAnalyzers returns the transitive closure of required analyzers in preorder.
+-func requiredAnalyzers(analyzers []*analysis.Analyzer) []*analysis.Analyzer {
+- var result []*analysis.Analyzer
+- seen := make(map[*analysis.Analyzer]bool)
+- var visitAll func([]*analysis.Analyzer)
+- visitAll = func(analyzers []*analysis.Analyzer) {
+- for _, a := range analyzers {
+- if !seen[a] {
+- seen[a] = true
+- result = append(result, a)
+- visitAll(a.Requires)
+- }
+- }
+- }
+- visitAll(analyzers)
+- return result
+-}
+-
+-func mustEncode(x interface{}) []byte {
+- var buf bytes.Buffer
+- if err := gob.NewEncoder(&buf).Encode(x); err != nil {
+- log.Fatalf("internal error encoding %T: %v", x, err)
+- }
+- return buf.Bytes()
+-}
+-
+-func mustDecode(data []byte, ptr interface{}) {
+- if err := gob.NewDecoder(bytes.NewReader(data)).Decode(ptr); err != nil {
+- log.Fatalf("internal error decoding %T: %v", ptr, err)
+- }
+-}
+-
+-// -- data types for serialization of analysis.Diagnostic and source.Diagnostic --
+-
+-type gobDiagnostic struct {
+- Location protocol.Location
+- Severity protocol.DiagnosticSeverity
+- Code string
+- CodeHref string
+- Source string
+- Message string
+- SuggestedFixes []gobSuggestedFix
+- Related []gobRelatedInformation
+- Tags []protocol.DiagnosticTag
+-}
+-
+-type gobRelatedInformation struct {
+- Location protocol.Location
+- Message string
+-}
+-
+-type gobSuggestedFix struct {
+- Message string
+- TextEdits []gobTextEdit
+- Command *gobCommand
+- ActionKind protocol.CodeActionKind
+-}
+-
+-type gobCommand struct {
+- Title string
+- Command string
+- Arguments []json.RawMessage
+-}
+-
+-type gobTextEdit struct {
+- Location protocol.Location
+- NewText []byte
+-}
+-
+-// toGobDiagnostic converts an analysis.Diagnosic to a serializable gobDiagnostic,
+-// which requires expanding token.Pos positions into protocol.Location form.
+-func toGobDiagnostic(posToLocation func(start, end token.Pos) (protocol.Location, error), diag analysis.Diagnostic) (gobDiagnostic, error) {
+- var fixes []gobSuggestedFix
+- for _, fix := range diag.SuggestedFixes {
+- var gobEdits []gobTextEdit
+- for _, textEdit := range fix.TextEdits {
+- loc, err := posToLocation(textEdit.Pos, textEdit.End)
+- if err != nil {
+- return gobDiagnostic{}, fmt.Errorf("in SuggestedFixes: %w", err)
+- }
+- gobEdits = append(gobEdits, gobTextEdit{
+- Location: loc,
+- NewText: textEdit.NewText,
+- })
+- }
+- fixes = append(fixes, gobSuggestedFix{
+- Message: fix.Message,
+- TextEdits: gobEdits,
+- })
+- }
+-
+- var related []gobRelatedInformation
+- for _, r := range diag.Related {
+- loc, err := posToLocation(r.Pos, r.End)
+- if err != nil {
+- return gobDiagnostic{}, fmt.Errorf("in Related: %w", err)
+- }
+- related = append(related, gobRelatedInformation{
+- Location: loc,
+- Message: r.Message,
+- })
+- }
+-
+- loc, err := posToLocation(diag.Pos, diag.End)
+- if err != nil {
+- return gobDiagnostic{}, err
+- }
+-
+- return gobDiagnostic{
+- Location: loc,
+- // Severity for analysis diagnostics is dynamic, based on user
+- // configuration per analyzer.
+- // Code and CodeHref are unset for Analysis diagnostics,
+- // TODO(rfindley): set Code fields if/when golang/go#57906 is accepted.
+- Source: diag.Category,
+- Message: diag.Message,
+- SuggestedFixes: fixes,
+- Related: related,
+- // Analysis diagnostics do not contain tags.
+- }, nil
+-}
+diff -urN a/gopls/internal/lsp/cache/cache.go b/gopls/internal/lsp/cache/cache.go
+--- a/gopls/internal/lsp/cache/cache.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/cache.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,78 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "context"
+- "reflect"
+- "strconv"
+- "sync/atomic"
+-
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/gocommand"
+- "golang.org/x/tools/internal/memoize"
+- "golang.org/x/tools/internal/robustio"
+-)
+-
+-// New Creates a new cache for gopls operation results, using the given file
+-// set, shared store, and session options.
+-//
+-// Both the fset and store may be nil, but if store is non-nil so must be fset
+-// (and they must always be used together), otherwise it may be possible to get
+-// cached data referencing token.Pos values not mapped by the FileSet.
+-func New(store *memoize.Store) *Cache {
+- index := atomic.AddInt64(&cacheIndex, 1)
+-
+- if store == nil {
+- store = &memoize.Store{}
+- }
+-
+- c := &Cache{
+- id: strconv.FormatInt(index, 10),
+- store: store,
+- memoizedFS: &memoizedFS{filesByID: map[robustio.FileID][]*DiskFile{}},
+- }
+- return c
+-}
+-
+-// A Cache holds caching stores that are bundled together for consistency.
+-//
+-// TODO(rfindley): once fset and store need not be bundled together, the Cache
+-// type can be eliminated.
+-type Cache struct {
+- id string
+-
+- store *memoize.Store
+-
+- *memoizedFS // implements source.FileSource
+-}
+-
+-// NewSession creates a new gopls session with the given cache and options overrides.
+-//
+-// The provided optionsOverrides may be nil.
+-//
+-// TODO(rfindley): move this to session.go.
+-func NewSession(ctx context.Context, c *Cache, optionsOverrides func(*source.Options)) *Session {
+- index := atomic.AddInt64(&sessionIndex, 1)
+- options := source.DefaultOptions().Clone()
+- if optionsOverrides != nil {
+- optionsOverrides(options)
+- }
+- s := &Session{
+- id: strconv.FormatInt(index, 10),
+- cache: c,
+- gocmdRunner: &gocommand.Runner{},
+- options: options,
+- overlayFS: newOverlayFS(c),
+- }
+- event.Log(ctx, "New session", KeyCreateSession.Of(s))
+- return s
+-}
+-
+-var cacheIndex, sessionIndex, viewIndex int64
+-
+-func (c *Cache) ID() string { return c.id }
+-func (c *Cache) MemStats() map[reflect.Type]int { return c.store.Stats() }
+diff -urN a/gopls/internal/lsp/cache/check.go b/gopls/internal/lsp/cache/check.go
+--- a/gopls/internal/lsp/cache/check.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/check.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1227 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "context"
+- "crypto/sha256"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "log"
+- "regexp"
+- "sort"
+- "strings"
+- "sync"
+-
+- "golang.org/x/mod/module"
+- "golang.org/x/sync/errgroup"
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/gopls/internal/lsp/filecache"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/source/methodsets"
+- "golang.org/x/tools/gopls/internal/lsp/source/xrefs"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+- "golang.org/x/tools/internal/gcimporter"
+- "golang.org/x/tools/internal/memoize"
+- "golang.org/x/tools/internal/packagesinternal"
+- "golang.org/x/tools/internal/typeparams"
+- "golang.org/x/tools/internal/typesinternal"
+-)
+-
+-// A typeCheckBatch holds data for a logical type-checking operation, which may
+-// type-check many unrelated packages.
+-//
+-// It shares state such as parsed files and imports, to optimize type-checking
+-// for packages with overlapping dependency graphs.
+-type typeCheckBatch struct {
+- meta *metadataGraph
+-
+- parsedFiles map[span.URI]*source.ParsedGoFile // parsed files necessary for type-checking
+- fset *token.FileSet // FileSet describing all parsed files
+-
+- // Promises holds promises to either read export data for the package, or
+- // parse and type-check its syntax.
+- //
+- // The return value of these promises is not used: after promises are
+- // awaited, they must write an entry into the imports map.
+- promises map[PackageID]*memoize.Promise
+-
+- mu sync.Mutex
+- needFiles map[span.URI]source.FileHandle // de-duplicated file handles required for type-checking
+- imports map[PackageID]pkgOrErr // types.Packages to use for importing
+- exportData map[PackageID][]byte
+- packages map[PackageID]*Package
+-}
+-
+-type pkgOrErr struct {
+- pkg *types.Package
+- err error
+-}
+-
+-// TypeCheck type-checks the specified packages.
+-//
+-// The resulting packages slice always contains len(ids) entries, though some
+-// of them may be nil if (and only if) the resulting error is non-nil.
+-//
+-// An error is returned if any of the requested packages fail to type-check.
+-// This is different from having type-checking errors: a failure to type-check
+-// indicates context cancellation or otherwise significant failure to perform
+-// the type-checking operation.
+-func (s *snapshot) TypeCheck(ctx context.Context, ids ...PackageID) ([]source.Package, error) {
+- // Check for existing active packages.
+- //
+- // Since gopls can't depend on package identity, any instance of the
+- // requested package must be ok to return.
+- //
+- // This is an optimization to avoid redundant type-checking: following
+- // changes to an open package many LSP clients send several successive
+- // requests for package information for the modified package (semantic
+- // tokens, code lens, inlay hints, etc.)
+- pkgs := make([]source.Package, len(ids))
+- needSyntax := make(map[PackageID]bool)
+- for i, id := range ids {
+- if pkg := s.getActivePackage(id); pkg != nil {
+- pkgs[i] = pkg
+- } else {
+- needSyntax[id] = true
+- }
+- }
+-
+- if len(needSyntax) == 0 {
+- return pkgs, nil
+- }
+-
+- // Build up shared state for efficient type-checking.
+- b := &typeCheckBatch{
+- parsedFiles: make(map[span.URI]*source.ParsedGoFile),
+- // fset is built during the parsing pass.
+- needFiles: make(map[span.URI]source.FileHandle),
+-
+- promises: make(map[PackageID]*memoize.Promise),
+- imports: make(map[PackageID]pkgOrErr),
+- exportData: make(map[PackageID][]byte),
+- packages: make(map[PackageID]*Package),
+- }
+-
+- // Capture metadata once to ensure a consistent view.
+- s.mu.Lock()
+- b.meta = s.meta
+- s.mu.Unlock()
+-
+- // -- Step 1: assemble the promises graph --
+-
+- var (
+- needExportData = make(map[PackageID]packageHandleKey)
+- packageHandles = make(map[PackageID]*packageHandle)
+- )
+-
+- // collectPromises collects promises to load packages from export data or
+- // type-check.
+- var collectPromises func(PackageID) error
+- collectPromises = func(id PackageID) error {
+- if _, ok := b.promises[id]; ok {
+- return nil
+- }
+- b.promises[id] = nil // break cycles
+-
+- m := b.meta.metadata[id]
+- if m == nil {
+- return bug.Errorf("missing metadata for %v", id)
+- }
+- for _, id := range m.DepsByPkgPath {
+- if err := collectPromises(id); err != nil {
+- return err
+- }
+- }
+-
+- // Note that we can't reuse active packages here, as they will have the
+- // wrong FileSet. Any active packages that exist as dependencies of other
+- // packages will need to be loaded from export data.
+- ph, err := s.buildPackageHandle(ctx, id)
+- if err != nil {
+- return err
+- }
+- packageHandles[id] = ph
+-
+- if needSyntax[id] {
+- // We will need to parse and type-check this package.
+- //
+- // We may also need to parse and type-check if export data is missing,
+- // but that is handled after fetching export data below.
+- b.addNeededFiles(ph)
+- } else if id != "unsafe" { // we can't load export data for unsafe
+- needExportData[id] = ph.key
+- }
+-
+- debugName := fmt.Sprintf("check(%s)", id)
+- b.promises[id] = memoize.NewPromise(debugName, func(ctx context.Context, _ interface{}) interface{} {
+- var res pkgOrErr
+- if err := b.awaitPredecessors(ctx, ph.m); err != nil {
+- res.err = err
+- } else {
+- b.mu.Lock()
+- data, ok := b.exportData[id]
+- b.mu.Unlock()
+-
+- if ok {
+- // We need export data, and have it.
+- res.pkg, res.err = b.importPackage(ctx, m, data)
+- } else if !needSyntax[id] {
+- // We need only a types.Package, but don't have export data.
+- // Type-check as fast as possible (skipping function bodies).
+- res.pkg, res.err = b.checkPackageForImport(ctx, ph)
+- } else {
+- // We need a syntax package.
+- var pkg *Package
+- pkg, res.err = b.checkPackage(ctx, ph)
+- if res.err == nil {
+- res.pkg = pkg.pkg.types
+- b.mu.Lock()
+- b.packages[id] = pkg
+- b.mu.Unlock()
+- }
+- }
+- }
+-
+- b.mu.Lock()
+- b.imports[m.ID] = res
+- b.mu.Unlock()
+- return nil
+- })
+- return nil
+- }
+- for id := range needSyntax {
+- collectPromises(id)
+- }
+-
+- // -- Step 2: collect export data --
+- //
+- // This must be done before parsing in order to determine which files must be
+- // parsed.
+- {
+- var g errgroup.Group
+- for id, key := range needExportData {
+- id := id
+- key := key
+- g.Go(func() error {
+- data, err := filecache.Get(exportDataKind, key)
+- if err != nil {
+- if err == filecache.ErrNotFound {
+- ph := packageHandles[id]
+- b.addNeededFiles(ph) // we will need to parse and type check
+- return nil // ok: we will type check later
+- }
+- return err
+- }
+- b.mu.Lock()
+- b.exportData[id] = data
+- b.mu.Unlock()
+- return nil
+- })
+- }
+- if err := g.Wait(); err != nil {
+- return pkgs, err
+- }
+- }
+-
+- // -- Step 3: parse files required for type checking. --
+- //
+- // Parse all necessary files in parallel. Unfortunately we can't start
+- // parsing each package's file as soon as we discover that it is a syntax
+- // package, because the parseCache cannot add files to an existing FileSet.
+- {
+- var fhs []source.FileHandle
+- for _, fh := range b.needFiles {
+- fhs = append(fhs, fh)
+- }
+- pgfs, fset, err := s.parseCache.parseFiles(ctx, source.ParseFull, fhs...)
+- if err != nil {
+- return pkgs, err
+- }
+- for _, pgf := range pgfs {
+- b.parsedFiles[pgf.URI] = pgf
+- }
+- b.fset = fset
+- }
+-
+- // -- Step 4: await type-checking. --
+- //
+- // Start a single goroutine for each promise.
+- {
+- var g errgroup.Group
+- // TODO(rfindley): find a good way to limit concurrency of type-checking,
+- // which is CPU bound at this point.
+- //
+- // (calling g.SetLimit here is mostly ineffective, as promises are
+- // recursively concurrent.)
+- for _, promise := range b.promises {
+- promise := promise
+- g.Go(func() error {
+- _, err := promise.Get(ctx, nil)
+- return err
+- })
+- }
+- if err := g.Wait(); err != nil {
+- return pkgs, err
+- }
+- }
+-
+- // Fill in the gaps of the results slice.
+- var firstErr error
+- for i, id := range ids {
+- if pkgs[i] != nil {
+- continue
+- }
+- if err := b.imports[id].err; err != nil {
+- if firstErr == nil {
+- firstErr = err
+- }
+- continue
+- }
+- pkg := b.packages[id]
+- if pkg == nil {
+- panic("nil package")
+- }
+- if alt := s.memoizeActivePackage(id, pkg); alt != nil && alt != pkg {
+- // pkg is an open package, but we've lost a race and an existing package
+- // has already been memoized.
+- pkg = alt
+- }
+- pkgs[i] = pkg
+- }
+-
+- return pkgs, firstErr
+-}
+-
+-// addNeededFiles records the files necessary for type-checking ph, for later
+-// parsing.
+-func (b *typeCheckBatch) addNeededFiles(ph *packageHandle) {
+- b.mu.Lock()
+- defer b.mu.Unlock()
+-
+- // Technically for export-only packages we only need compiledGoFiles, but
+- // these slices are usually redundant.
+- for _, fh := range ph.inputs.goFiles {
+- b.needFiles[fh.URI()] = fh
+- }
+- for _, fh := range ph.inputs.compiledGoFiles {
+- b.needFiles[fh.URI()] = fh
+- }
+-}
+-
+-// importPackage loads the given package from its export data in p.exportData
+-// (which must already be populated).
+-func (b *typeCheckBatch) importPackage(ctx context.Context, m *source.Metadata, data []byte) (*types.Package, error) {
+- impMap, errMap := b.importMap(m.ID)
+- // Any failure to populate an import will cause confusing errors from
+- // IImportShallow below.
+- for path, err := range errMap {
+- return nil, fmt.Errorf("error importing %q for %q: %v", path, m.ID, err)
+- }
+-
+- // TODO(rfindley): collect "deep" hashes here using the provided
+- // callback, for precise pruning.
+- imported, err := gcimporter.IImportShallow(b.fset, impMap, data, string(m.PkgPath), func(*types.Package, string) {})
+- if err != nil {
+- return nil, bug.Errorf("invalid export data for %q: %v", m.ID, err)
+- }
+- return imported, nil
+-}
+-
+-// checkPackageForImport type checks, but skips function bodies and does not
+-// record syntax information.
+-func (b *typeCheckBatch) checkPackageForImport(ctx context.Context, ph *packageHandle) (*types.Package, error) {
+- if ph.m.ID == "unsafe" {
+- return types.Unsafe, nil
+- }
+- impMap, errMap := b.importMap(ph.inputs.id)
+- onError := func(e error) {
+- // Ignore errors for exporting.
+- }
+- cfg := b.typesConfig(ph.inputs, onError, impMap, errMap)
+- var files []*ast.File
+- for _, fh := range ph.inputs.compiledGoFiles {
+- pgf := b.parsedFiles[fh.URI()]
+- if pgf == nil {
+- return nil, fmt.Errorf("compiled go file %q failed to parse", fh.URI().Filename())
+- }
+- files = append(files, pgf.File)
+- }
+- cfg.IgnoreFuncBodies = true
+- pkg := types.NewPackage(string(ph.inputs.pkgPath), string(ph.inputs.name))
+- check := types.NewChecker(cfg, b.fset, pkg, nil)
+-
+- _ = check.Files(files) // ignore errors
+-
+- // If the context was cancelled, we may have returned a ton of transient
+- // errors to the type checker. Swallow them.
+- if ctx.Err() != nil {
+- return nil, ctx.Err()
+- }
+-
+- // Asynchronously record export data.
+- go func() {
+- exportData, err := gcimporter.IExportShallow(b.fset, pkg)
+- if err != nil {
+- bug.Reportf("exporting package %v: %v", ph.m.ID, err)
+- return
+- }
+- if err := filecache.Set(exportDataKind, ph.key, exportData); err != nil {
+- event.Error(ctx, fmt.Sprintf("storing export data for %s", ph.m.ID), err)
+- }
+- }()
+- return pkg, nil
+-}
+-
+-// checkPackage "fully type checks" to produce a syntax package.
+-func (b *typeCheckBatch) checkPackage(ctx context.Context, ph *packageHandle) (*Package, error) {
+- // TODO(rfindley): refactor to inline typeCheckImpl here. There is no need
+- // for so many layers to build up the package
+- // (checkPackage->typeCheckImpl->doTypeCheck).
+- pkg, err := typeCheckImpl(ctx, b, ph.inputs)
+-
+- if err == nil {
+- // Write package data to disk asynchronously.
+- go func() {
+- toCache := map[string][]byte{
+- xrefsKind: pkg.xrefs,
+- methodSetsKind: pkg.methodsets.Encode(),
+- diagnosticsKind: encodeDiagnostics(pkg.diagnostics),
+- }
+-
+- if ph.m.ID != "unsafe" { // unsafe cannot be exported
+- exportData, err := gcimporter.IExportShallow(pkg.fset, pkg.types)
+- if err != nil {
+- bug.Reportf("exporting package %v: %v", ph.m.ID, err)
+- } else {
+- toCache[exportDataKind] = exportData
+- }
+- }
+-
+- for kind, data := range toCache {
+- if err := filecache.Set(kind, ph.key, data); err != nil {
+- event.Error(ctx, fmt.Sprintf("storing %s data for %s", kind, ph.m.ID), err)
+- }
+- }
+- }()
+- }
+-
+- return &Package{ph.m, pkg}, err
+-}
+-
+-// awaitPredecessors awaits all promises for m.DepsByPkgPath, returning an
+-// error if awaiting failed due to context cancellation or if there was an
+-// unrecoverable error loading export data.
+-func (b *typeCheckBatch) awaitPredecessors(ctx context.Context, m *source.Metadata) error {
+- for _, depID := range m.DepsByPkgPath {
+- depID := depID
+- if p, ok := b.promises[depID]; ok {
+- if _, err := p.Get(ctx, nil); err != nil {
+- return err
+- }
+- }
+- }
+- return nil
+-}
+-
+-// importMap returns an import map for the given package ID, populated with
+-// type-checked packages for its dependencies. It is intended for compatibility
+-// with gcimporter.IImportShallow, so the first result uses the map signature
+-// of that API, where keys are package path strings.
+-//
+-// importMap must only be used once all promises for dependencies of id have
+-// been awaited.
+-//
+-// For any missing packages, importMap returns an entry in the resulting errMap
+-// reporting the error for that package.
+-//
+-// Invariant: for all recursive dependencies, either impMap[path] or
+-// errMap[path] is set.
+-func (b *typeCheckBatch) importMap(id PackageID) (impMap map[string]*types.Package, errMap map[PackagePath]error) {
+- impMap = make(map[string]*types.Package)
+- outerID := id
+- var populateDepsOf func(m *source.Metadata)
+- populateDepsOf = func(parent *source.Metadata) {
+- for _, id := range parent.DepsByPkgPath {
+- m := b.meta.metadata[id]
+- if _, ok := impMap[string(m.PkgPath)]; ok {
+- continue
+- }
+- if _, ok := errMap[m.PkgPath]; ok {
+- continue
+- }
+- b.mu.Lock()
+- result, ok := b.imports[m.ID]
+- b.mu.Unlock()
+- if !ok {
+- panic(fmt.Sprintf("import map for %q missing package data for %q", outerID, m.ID))
+- }
+- // We may fail to produce a package due to e.g. context cancellation
+- // (handled elsewhere), or some catastrophic failure such as a package with
+- // no files.
+- switch {
+- case result.err != nil:
+- if errMap == nil {
+- errMap = make(map[PackagePath]error)
+- }
+- errMap[m.PkgPath] = result.err
+- case result.pkg != nil:
+- impMap[string(m.PkgPath)] = result.pkg
+- default:
+- panic("invalid import for " + id)
+- }
+- populateDepsOf(m)
+- }
+- }
+- m := b.meta.metadata[id]
+- populateDepsOf(m)
+- return impMap, errMap
+-}
+-
+-// packageData holds binary data (e.g. types, xrefs) extracted from a syntax
+-// package.
+-type packageData struct {
+- m *source.Metadata
+- data []byte
+-}
+-
+-// getPackageData gets package data (e.g. types, xrefs) for the requested ids,
+-// either loading from the file-based cache or type-checking and extracting
+-// data using the provided get function.
+-func (s *snapshot) getPackageData(ctx context.Context, kind string, ids []PackageID, get func(*syntaxPackage) []byte) ([]*packageData, error) {
+- var needIDs []PackageID
+- keys := make([]packageHandleKey, len(ids))
+- pkgData := make([]*packageData, len(ids))
+- var firstErr error
+- // Compute package keys and query file cache.
+- for i, id := range ids {
+- ph, err := s.buildPackageHandle(ctx, id)
+- if err != nil {
+- if firstErr == nil {
+- firstErr = err
+- }
+- if ctx.Err() != nil {
+- return pkgData, firstErr
+- }
+- continue
+- }
+- keys[i] = ph.key
+- data, err := filecache.Get(kind, ph.key)
+- switch err {
+- case nil:
+- pkgData[i] = &packageData{m: ph.m, data: data}
+- case filecache.ErrNotFound:
+- needIDs = append(needIDs, id)
+- default:
+- if firstErr == nil {
+- firstErr = err
+- }
+- if ctx.Err() != nil {
+- return pkgData, firstErr
+- }
+- }
+- }
+-
+- // Type-check the packages for which we got file-cache misses.
+- pkgs, err := s.TypeCheck(ctx, needIDs...)
+- if err != nil {
+- return nil, err
+- }
+-
+- pkgMap := make(map[PackageID]source.Package)
+- for i, id := range needIDs {
+- pkgMap[id] = pkgs[i]
+- }
+-
+- // Fill in the gaps using data derived from type checking.
+- for i, id := range ids {
+- if pkgData[i] != nil {
+- continue
+- }
+- result := pkgMap[id]
+- if result == nil {
+- panic(fmt.Sprintf("missing type-check result for %s", id))
+- }
+- data := get(result.(*Package).pkg)
+- pkgData[i] = &packageData{m: result.Metadata(), data: data}
+- }
+-
+- return pkgData, firstErr
+-}
+-
+-type packageHandleKey source.Hash
+-
+-// A packageHandle holds package information, some of which may not be fully
+-// evaluated.
+-//
+-// The only methods on packageHandle that are safe to call before calling await
+-// are Metadata and await itself.
+-type packageHandle struct {
+- m *source.Metadata
+-
+- inputs typeCheckInputs
+-
+- // key is the hashed key for the package.
+- //
+- // It includes the all bits of the transitive closure of
+- // dependencies's sources. This is more than type checking
+- // really depends on: export data of direct deps should be
+- // enough. (The key for analysis actions could similarly
+- // hash only Facts of direct dependencies.)
+- key packageHandleKey
+-
+- // Note: as an optimization, we could join in-flight type-checking by
+- // recording a transient ref-counted promise here.
+- // (This was done previously, but proved to be a premature optimization).
+-}
+-
+-// buildPackageHandle returns a handle for the future results of
+-// type-checking the package identified by id in the given mode.
+-// It assumes that the given ID already has metadata available, so it does not
+-// attempt to reload missing or invalid metadata. The caller must reload
+-// metadata if needed.
+-func (s *snapshot) buildPackageHandle(ctx context.Context, id PackageID) (*packageHandle, error) {
+- s.mu.Lock()
+- entry, hit := s.packages.Get(id)
+- m := s.meta.metadata[id]
+- s.mu.Unlock()
+-
+- if m == nil {
+- return nil, fmt.Errorf("no metadata for %s", id)
+- }
+-
+- if hit {
+- return entry.(*packageHandle), nil
+- }
+-
+- inputs, err := s.typeCheckInputs(ctx, m)
+- if err != nil {
+- return nil, err
+- }
+- // All the file reading has now been done.
+- // Create a handle for the result of type checking.
+- phKey := computePackageKey(s, inputs)
+- ph := &packageHandle{
+- m: m,
+- inputs: inputs,
+- key: phKey,
+- }
+-
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- // Check that the metadata has not changed
+- // (which should invalidate this handle).
+- //
+- // (In future, handles should form a graph with edges from a
+- // packageHandle to the handles for parsing its files and the
+- // handles for type-checking its immediate deps, at which
+- // point there will be no need to even access s.meta.)
+- if s.meta.metadata[ph.m.ID] != ph.m {
+- // TODO(rfindley): this should be bug.Errorf.
+- return nil, fmt.Errorf("stale metadata for %s", ph.m.ID)
+- }
+-
+- // Check cache again in case another goroutine got there first.
+- if prev, ok := s.packages.Get(id); ok {
+- prevPH := prev.(*packageHandle)
+- if prevPH.m != ph.m {
+- return nil, bug.Errorf("existing package handle does not match for %s", ph.m.ID)
+- }
+- return prevPH, nil
+- }
+-
+- s.packages.Set(id, ph, nil)
+- return ph, nil
+-}
+-
+-// typeCheckInputs contains the inputs of a call to typeCheckImpl, which
+-// type-checks a package.
+-//
+-// Part of the purpose of this type is to keep type checking in-sync with the
+-// package handle key, by explicitly identifying the inputs to type checking.
+-type typeCheckInputs struct {
+- id PackageID
+-
+- // Used for type checking:
+- pkgPath PackagePath
+- name PackageName
+- goFiles, compiledGoFiles []source.FileHandle
+- sizes types.Sizes
+- deps map[PackageID]*packageHandle
+- depsByImpPath map[ImportPath]PackageID
+- goVersion string // packages.Module.GoVersion, e.g. "1.18"
+-
+- // Used for type check diagnostics:
+- relatedInformation bool
+- linkTarget string
+- moduleMode bool
+-}
+-
+-func (s *snapshot) typeCheckInputs(ctx context.Context, m *source.Metadata) (typeCheckInputs, error) {
+- deps := make(map[PackageID]*packageHandle)
+- for _, depID := range m.DepsByPkgPath {
+- depHandle, err := s.buildPackageHandle(ctx, depID)
+- if err != nil {
+- // If err is non-nil, we either have an invalid dependency, or a
+- // catastrophic failure to read a file (context cancellation or
+- // permission issues).
+- //
+- // We don't want one bad dependency to prevent us from type-checking the
+- // package -- we should instead get an import error. So we only abort
+- // this operation if the context is cancelled.
+- //
+- // We could do a better job of handling permission errors on files, but
+- // this is rare, and it is reasonable to treat the same an invalid
+- // dependency.
+- event.Error(ctx, fmt.Sprintf("%s: no dep handle for %s", m.ID, depID), err, source.SnapshotLabels(s)...)
+- if ctx.Err() != nil {
+- return typeCheckInputs{}, ctx.Err() // cancelled
+- }
+- continue
+- }
+- deps[depID] = depHandle
+- }
+-
+- // Read both lists of files of this package, in parallel.
+- //
+- // goFiles aren't presented to the type checker--nor
+- // are they included in the key, unsoundly--but their
+- // syntax trees are available from (*pkg).File(URI).
+- // TODO(adonovan): consider parsing them on demand?
+- // The need should be rare.
+- goFiles, compiledGoFiles, err := readGoFiles(ctx, s, m)
+- if err != nil {
+- return typeCheckInputs{}, err
+- }
+-
+- goVersion := ""
+- if m.Module != nil && m.Module.GoVersion != "" {
+- goVersion = m.Module.GoVersion
+- }
+-
+- return typeCheckInputs{
+- id: m.ID,
+- pkgPath: m.PkgPath,
+- name: m.Name,
+- goFiles: goFiles,
+- compiledGoFiles: compiledGoFiles,
+- sizes: m.TypesSizes,
+- deps: deps,
+- depsByImpPath: m.DepsByImpPath,
+- goVersion: goVersion,
+-
+- relatedInformation: s.view.Options().RelatedInformationSupported,
+- linkTarget: s.view.Options().LinkTarget,
+- moduleMode: s.moduleMode(),
+- }, nil
+-}
+-
+-// readGoFiles reads the content of Metadata.GoFiles and
+-// Metadata.CompiledGoFiles, in parallel.
+-func readGoFiles(ctx context.Context, s *snapshot, m *source.Metadata) (goFiles, compiledGoFiles []source.FileHandle, err error) {
+- var group errgroup.Group
+- getFileHandles := func(files []span.URI) []source.FileHandle {
+- fhs := make([]source.FileHandle, len(files))
+- for i, uri := range files {
+- i, uri := i, uri
+- group.Go(func() (err error) {
+- fhs[i], err = s.GetFile(ctx, uri) // ~25us
+- return
+- })
+- }
+- return fhs
+- }
+- return getFileHandles(m.GoFiles),
+- getFileHandles(m.CompiledGoFiles),
+- group.Wait()
+-}
+-
+-// computePackageKey returns a key representing the act of type checking
+-// a package named id containing the specified files, metadata, and
+-// combined dependency hash.
+-func computePackageKey(s *snapshot, inputs typeCheckInputs) packageHandleKey {
+- hasher := sha256.New()
+-
+- // In principle, a key must be the hash of an
+- // unambiguous encoding of all the relevant data.
+- // If it's ambiguous, we risk collisions.
+-
+- // package identifiers
+- fmt.Fprintf(hasher, "package: %s %s %s\n", inputs.id, inputs.name, inputs.pkgPath)
+-
+- // module Go version
+- fmt.Fprintf(hasher, "go %s\n", inputs.goVersion)
+-
+- // import map
+- importPaths := make([]string, 0, len(inputs.depsByImpPath))
+- for impPath := range inputs.depsByImpPath {
+- importPaths = append(importPaths, string(impPath))
+- }
+- sort.Strings(importPaths)
+- for _, impPath := range importPaths {
+- fmt.Fprintf(hasher, "import %s %s", impPath, string(inputs.depsByImpPath[ImportPath(impPath)]))
+- }
+-
+- // deps, in PackageID order
+- depIDs := make([]string, 0, len(inputs.deps))
+- for depID := range inputs.deps {
+- depIDs = append(depIDs, string(depID))
+- }
+- sort.Strings(depIDs)
+- for _, depID := range depIDs {
+- dep := inputs.deps[PackageID(depID)]
+- fmt.Fprintf(hasher, "dep: %s key:%s\n", dep.m.PkgPath, dep.key)
+- }
+-
+- // file names and contents
+- fmt.Fprintf(hasher, "compiledGoFiles: %d\n", len(inputs.compiledGoFiles))
+- for _, fh := range inputs.compiledGoFiles {
+- fmt.Fprintln(hasher, fh.FileIdentity())
+- }
+- fmt.Fprintf(hasher, "goFiles: %d\n", len(inputs.goFiles))
+- for _, fh := range inputs.goFiles {
+- fmt.Fprintln(hasher, fh.FileIdentity())
+- }
+-
+- // types sizes
+- sz := inputs.sizes.(*types.StdSizes)
+- fmt.Fprintf(hasher, "sizes: %d %d\n", sz.WordSize, sz.MaxAlign)
+-
+- fmt.Fprintf(hasher, "relatedInformation: %t\n", inputs.relatedInformation)
+- fmt.Fprintf(hasher, "linkTarget: %s\n", inputs.linkTarget)
+- fmt.Fprintf(hasher, "moduleMode: %t\n", inputs.moduleMode)
+-
+- var hash [sha256.Size]byte
+- hasher.Sum(hash[:0])
+- return packageHandleKey(hash)
+-}
+-
+-// typeCheckImpl type checks the parsed source files in compiledGoFiles.
+-// (The resulting pkg also holds the parsed but not type-checked goFiles.)
+-// deps holds the future results of type-checking the direct dependencies.
+-func typeCheckImpl(ctx context.Context, b *typeCheckBatch, inputs typeCheckInputs) (*syntaxPackage, error) {
+- ctx, done := event.Start(ctx, "cache.typeCheck", tag.Package.Of(string(inputs.id)))
+- defer done()
+-
+- pkg, err := doTypeCheck(ctx, b, inputs)
+- if err != nil {
+- return nil, err
+- }
+- pkg.methodsets = methodsets.NewIndex(pkg.fset, pkg.types)
+- pkg.xrefs = xrefs.Index(pkg.compiledGoFiles, pkg.types, pkg.typesInfo)
+-
+- // Our heuristic for whether to show type checking errors is:
+- // + If any file was 'fixed', don't show type checking errors as we
+- // can't guarantee that they reference accurate locations in the source.
+- // + If there is a parse error _in the current file_, suppress type
+- // errors in that file.
+- // + Otherwise, show type errors even in the presence of parse errors in
+- // other package files. go/types attempts to suppress follow-on errors
+- // due to bad syntax, so on balance type checking errors still provide
+- // a decent signal/noise ratio as long as the file in question parses.
+-
+- // Track URIs with parse errors so that we can suppress type errors for these
+- // files.
+- unparseable := map[span.URI]bool{}
+- for _, e := range pkg.parseErrors {
+- diags, err := parseErrorDiagnostics(pkg, e)
+- if err != nil {
+- event.Error(ctx, "unable to compute positions for parse errors", err, tag.Package.Of(string(inputs.id)))
+- continue
+- }
+- for _, diag := range diags {
+- unparseable[diag.URI] = true
+- pkg.diagnostics = append(pkg.diagnostics, diag)
+- }
+- }
+-
+- if pkg.hasFixedFiles {
+- return pkg, nil
+- }
+-
+- unexpanded := pkg.typeErrors
+- pkg.typeErrors = nil
+- for _, e := range expandErrors(unexpanded, inputs.relatedInformation) {
+- diags, err := typeErrorDiagnostics(inputs.moduleMode, inputs.linkTarget, pkg, e)
+- if err != nil {
+- event.Error(ctx, "unable to compute positions for type errors", err, tag.Package.Of(string(inputs.id)))
+- continue
+- }
+- pkg.typeErrors = append(pkg.typeErrors, e.primary)
+- for _, diag := range diags {
+- // If the file didn't parse cleanly, it is highly likely that type
+- // checking errors will be confusing or redundant. But otherwise, type
+- // checking usually provides a good enough signal to include.
+- if !unparseable[diag.URI] {
+- pkg.diagnostics = append(pkg.diagnostics, diag)
+- }
+- }
+- }
+-
+- return pkg, nil
+-}
+-
+-var goVersionRx = regexp.MustCompile(`^go([1-9][0-9]*)\.(0|[1-9][0-9]*)$`)
+-
+-func doTypeCheck(ctx context.Context, b *typeCheckBatch, inputs typeCheckInputs) (*syntaxPackage, error) {
+- impMap, errMap := b.importMap(inputs.id)
+- pkg := &syntaxPackage{
+- id: inputs.id,
+- fset: b.fset, // must match parse call below
+- types: types.NewPackage(string(inputs.pkgPath), string(inputs.name)),
+- typesInfo: &types.Info{
+- Types: make(map[ast.Expr]types.TypeAndValue),
+- Defs: make(map[*ast.Ident]types.Object),
+- Uses: make(map[*ast.Ident]types.Object),
+- Implicits: make(map[ast.Node]types.Object),
+- Selections: make(map[*ast.SelectorExpr]*types.Selection),
+- Scopes: make(map[ast.Node]*types.Scope),
+- },
+- importMap: impMap,
+- }
+- typeparams.InitInstanceInfo(pkg.typesInfo)
+-
+- // Collect parsed files from the type check pass, capturing parse errors from
+- // compiled files.
+- for _, fh := range inputs.goFiles {
+- pgf := b.parsedFiles[fh.URI()]
+- if pgf == nil {
+- // If go/packages told us that a file is in a package, it should be
+- // parseable (after all, it was parsed by go list).
+- return nil, bug.Errorf("go file %q failed to parse", fh.URI().Filename())
+- }
+- pkg.goFiles = append(pkg.goFiles, pgf)
+- }
+- for _, fh := range inputs.compiledGoFiles {
+- pgf := b.parsedFiles[fh.URI()]
+- if pgf == nil {
+- return nil, fmt.Errorf("compiled go file %q failed to parse", fh.URI().Filename())
+- }
+- if pgf.ParseErr != nil {
+- pkg.parseErrors = append(pkg.parseErrors, pgf.ParseErr)
+- }
+- pkg.compiledGoFiles = append(pkg.compiledGoFiles, pgf)
+- }
+-
+- // Use the default type information for the unsafe package.
+- if inputs.pkgPath == "unsafe" {
+- // Don't type check Unsafe: it's unnecessary, and doing so exposes a data
+- // race to Unsafe.completed.
+- pkg.types = types.Unsafe
+- return pkg, nil
+- }
+-
+- if len(pkg.compiledGoFiles) == 0 {
+- // No files most likely means go/packages failed.
+- //
+- // TODO(rfindley): in the past, we would capture go list errors in this
+- // case, to present go list errors to the user. However we had no tests for
+- // this behavior. It is unclear if anything better can be done here.
+- return nil, fmt.Errorf("no parsed files for package %s", inputs.pkgPath)
+- }
+-
+- onError := func(e error) {
+- pkg.typeErrors = append(pkg.typeErrors, e.(types.Error))
+- }
+- cfg := b.typesConfig(inputs, onError, impMap, errMap)
+-
+- check := types.NewChecker(cfg, pkg.fset, pkg.types, pkg.typesInfo)
+-
+- var files []*ast.File
+- for _, cgf := range pkg.compiledGoFiles {
+- files = append(files, cgf.File)
+- }
+-
+- // Type checking errors are handled via the config, so ignore them here.
+- _ = check.Files(files) // 50us-15ms, depending on size of package
+-
+- // If the context was cancelled, we may have returned a ton of transient
+- // errors to the type checker. Swallow them.
+- if ctx.Err() != nil {
+- return nil, ctx.Err()
+- }
+- return pkg, nil
+-}
+-
+-func (b *typeCheckBatch) typesConfig(inputs typeCheckInputs, onError func(e error), impMap map[string]*types.Package, errMap map[PackagePath]error) *types.Config {
+- cfg := &types.Config{
+- Sizes: inputs.sizes,
+- Error: onError,
+- Importer: importerFunc(func(path string) (*types.Package, error) {
+- // While all of the import errors could be reported
+- // based on the metadata before we start type checking,
+- // reporting them via types.Importer places the errors
+- // at the correct source location.
+- id, ok := inputs.depsByImpPath[ImportPath(path)]
+- if !ok {
+- // If the import declaration is broken,
+- // go list may fail to report metadata about it.
+- // See TestFixImportDecl for an example.
+- return nil, fmt.Errorf("missing metadata for import of %q", path)
+- }
+- depPH := inputs.deps[id]
+- if depPH == nil {
+- // e.g. missing metadata for dependencies in buildPackageHandle
+- return nil, missingPkgError(path, inputs.moduleMode)
+- }
+- if !source.IsValidImport(inputs.pkgPath, depPH.m.PkgPath) {
+- return nil, fmt.Errorf("invalid use of internal package %q", path)
+- }
+- pkg, ok := impMap[string(depPH.m.PkgPath)]
+- if !ok {
+- err := errMap[depPH.m.PkgPath]
+- if err == nil {
+- log.Fatalf("neither pkg nor error is set")
+- }
+- return nil, err
+- }
+- return pkg, nil
+- }),
+- }
+-
+- if inputs.goVersion != "" {
+- goVersion := "go" + inputs.goVersion
+- // types.NewChecker panics if GoVersion is invalid. An unparsable mod
+- // file should probably stop us before we get here, but double check
+- // just in case.
+- if goVersionRx.MatchString(goVersion) {
+- typesinternal.SetGoVersion(cfg, goVersion)
+- }
+- }
+-
+- // We want to type check cgo code if go/types supports it.
+- // We passed typecheckCgo to go/packages when we Loaded.
+- typesinternal.SetUsesCgo(cfg)
+- return cfg
+-}
+-
+-// depsErrors creates diagnostics for each metadata error (e.g. import cycle).
+-// These may be attached to import declarations in the transitive source files
+-// of pkg, or to 'requires' declarations in the package's go.mod file.
+-//
+-// TODO(rfindley): move this to load.go
+-func depsErrors(ctx context.Context, m *source.Metadata, meta *metadataGraph, fs source.FileSource, workspacePackages map[PackageID]PackagePath) ([]*source.Diagnostic, error) {
+- // Select packages that can't be found, and were imported in non-workspace packages.
+- // Workspace packages already show their own errors.
+- var relevantErrors []*packagesinternal.PackageError
+- for _, depsError := range m.DepsErrors {
+- // Up to Go 1.15, the missing package was included in the stack, which
+- // was presumably a bug. We want the next one up.
+- directImporterIdx := len(depsError.ImportStack) - 1
+- if directImporterIdx < 0 {
+- continue
+- }
+-
+- directImporter := depsError.ImportStack[directImporterIdx]
+- if _, ok := workspacePackages[PackageID(directImporter)]; ok {
+- continue
+- }
+- relevantErrors = append(relevantErrors, depsError)
+- }
+-
+- // Don't build the import index for nothing.
+- if len(relevantErrors) == 0 {
+- return nil, nil
+- }
+-
+- // Subsequent checks require Go files.
+- if len(m.CompiledGoFiles) == 0 {
+- return nil, nil
+- }
+-
+- // Build an index of all imports in the package.
+- type fileImport struct {
+- cgf *source.ParsedGoFile
+- imp *ast.ImportSpec
+- }
+- allImports := map[string][]fileImport{}
+- for _, uri := range m.CompiledGoFiles {
+- pgf, err := parseGoURI(ctx, fs, uri, source.ParseHeader)
+- if err != nil {
+- return nil, err
+- }
+- fset := source.FileSetFor(pgf.Tok)
+- // TODO(adonovan): modify Imports() to accept a single token.File (cgf.Tok).
+- for _, group := range astutil.Imports(fset, pgf.File) {
+- for _, imp := range group {
+- if imp.Path == nil {
+- continue
+- }
+- path := strings.Trim(imp.Path.Value, `"`)
+- allImports[path] = append(allImports[path], fileImport{pgf, imp})
+- }
+- }
+- }
+-
+- // Apply a diagnostic to any import involved in the error, stopping once
+- // we reach the workspace.
+- var errors []*source.Diagnostic
+- for _, depErr := range relevantErrors {
+- for i := len(depErr.ImportStack) - 1; i >= 0; i-- {
+- item := depErr.ImportStack[i]
+- if _, ok := workspacePackages[PackageID(item)]; ok {
+- break
+- }
+-
+- for _, imp := range allImports[item] {
+- rng, err := imp.cgf.NodeRange(imp.imp)
+- if err != nil {
+- return nil, err
+- }
+- fixes, err := goGetQuickFixes(m.Module != nil, imp.cgf.URI, item)
+- if err != nil {
+- return nil, err
+- }
+- errors = append(errors, &source.Diagnostic{
+- URI: imp.cgf.URI,
+- Range: rng,
+- Severity: protocol.SeverityError,
+- Source: source.TypeError,
+- Message: fmt.Sprintf("error while importing %v: %v", item, depErr.Err),
+- SuggestedFixes: fixes,
+- })
+- }
+- }
+- }
+-
+- modFile, err := nearestModFile(ctx, m.CompiledGoFiles[0], fs)
+- if err != nil {
+- return nil, err
+- }
+- pm, err := parseModURI(ctx, fs, modFile)
+- if err != nil {
+- return nil, err
+- }
+-
+- // Add a diagnostic to the module that contained the lowest-level import of
+- // the missing package.
+- for _, depErr := range relevantErrors {
+- for i := len(depErr.ImportStack) - 1; i >= 0; i-- {
+- item := depErr.ImportStack[i]
+- m := meta.metadata[PackageID(item)]
+- if m == nil || m.Module == nil {
+- continue
+- }
+- modVer := module.Version{Path: m.Module.Path, Version: m.Module.Version}
+- reference := findModuleReference(pm.File, modVer)
+- if reference == nil {
+- continue
+- }
+- rng, err := pm.Mapper.OffsetRange(reference.Start.Byte, reference.End.Byte)
+- if err != nil {
+- return nil, err
+- }
+- fixes, err := goGetQuickFixes(true, pm.URI, item)
+- if err != nil {
+- return nil, err
+- }
+- errors = append(errors, &source.Diagnostic{
+- URI: pm.URI,
+- Range: rng,
+- Severity: protocol.SeverityError,
+- Source: source.TypeError,
+- Message: fmt.Sprintf("error while importing %v: %v", item, depErr.Err),
+- SuggestedFixes: fixes,
+- })
+- break
+- }
+- }
+- return errors, nil
+-}
+-
+-// missingPkgError returns an error message for a missing package that varies
+-// based on the user's workspace mode.
+-func missingPkgError(pkgPath string, moduleMode bool) error {
+- // TODO(rfindley): improve this error. Previous versions of this error had
+- // access to the full snapshot, and could provide more information (such as
+- // the initialization error).
+- if moduleMode {
+- // Previously, we would present the initialization error here.
+- return fmt.Errorf("no required module provides package %q", pkgPath)
+- } else {
+- // Previously, we would list the directories in GOROOT and GOPATH here.
+- return fmt.Errorf("cannot find package %q in GOROOT or GOPATH", pkgPath)
+- }
+-}
+-
+-type extendedError struct {
+- primary types.Error
+- secondaries []types.Error
+-}
+-
+-func (e extendedError) Error() string {
+- return e.primary.Error()
+-}
+-
+-// expandErrors duplicates "secondary" errors by mapping them to their main
+-// error. Some errors returned by the type checker are followed by secondary
+-// errors which give more information about the error. These are errors in
+-// their own right, and they are marked by starting with \t. For instance, when
+-// there is a multiply-defined function, the secondary error points back to the
+-// definition first noticed.
+-//
+-// This function associates the secondary error with its primary error, which can
+-// then be used as RelatedInformation when the error becomes a diagnostic.
+-//
+-// If supportsRelatedInformation is false, the secondary is instead embedded as
+-// additional context in the primary error.
+-func expandErrors(errs []types.Error, supportsRelatedInformation bool) []extendedError {
+- var result []extendedError
+- for i := 0; i < len(errs); {
+- original := extendedError{
+- primary: errs[i],
+- }
+- for i++; i < len(errs); i++ {
+- spl := errs[i]
+- if len(spl.Msg) == 0 || spl.Msg[0] != '\t' {
+- break
+- }
+- spl.Msg = spl.Msg[1:]
+- original.secondaries = append(original.secondaries, spl)
+- }
+-
+- // Clone the error to all its related locations -- VS Code, at least,
+- // doesn't do it for us.
+- result = append(result, original)
+- for i, mainSecondary := range original.secondaries {
+- // Create the new primary error, with a tweaked message, in the
+- // secondary's location. We need to start from the secondary to
+- // capture its unexported location fields.
+- relocatedSecondary := mainSecondary
+- if supportsRelatedInformation {
+- relocatedSecondary.Msg = fmt.Sprintf("%v (see details)", original.primary.Msg)
+- } else {
+- relocatedSecondary.Msg = fmt.Sprintf("%v (this error: %v)", original.primary.Msg, mainSecondary.Msg)
+- }
+- relocatedSecondary.Soft = original.primary.Soft
+-
+- // Copy over the secondary errors, noting the location of the
+- // current error we're cloning.
+- clonedError := extendedError{primary: relocatedSecondary, secondaries: []types.Error{original.primary}}
+- for j, secondary := range original.secondaries {
+- if i == j {
+- secondary.Msg += " (this error)"
+- }
+- clonedError.secondaries = append(clonedError.secondaries, secondary)
+- }
+- result = append(result, clonedError)
+- }
+-
+- }
+- return result
+-}
+-
+-// An importFunc is an implementation of the single-method
+-// types.Importer interface based on a function value.
+-type importerFunc func(path string) (*types.Package, error)
+-
+-func (f importerFunc) Import(path string) (*types.Package, error) { return f(path) }
+diff -urN a/gopls/internal/lsp/cache/debug.go b/gopls/internal/lsp/cache/debug.go
+--- a/gopls/internal/lsp/cache/debug.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/debug.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,55 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "fmt"
+- "os"
+- "sort"
+-)
+-
+-// This file contains helpers that can be used to instrument code while
+-// debugging.
+-
+-// debugEnabled toggles the helpers below.
+-const debugEnabled = false
+-
+-// If debugEnabled is true, debugf formats its arguments and prints to stderr.
+-// If debugEnabled is false, it is a no-op.
+-func debugf(format string, args ...interface{}) {
+- if !debugEnabled {
+- return
+- }
+- if false {
+- _ = fmt.Sprintf(format, args...) // encourage vet to validate format strings
+- }
+- fmt.Fprintf(os.Stderr, ">>> "+format+"\n", args...)
+-}
+-
+-// If debugEnabled is true, dumpWorkspace prints a summary of workspace
+-// packages to stderr. If debugEnabled is false, it is a no-op.
+-//
+-// TODO(rfindley): this has served its purpose. Delete.
+-func (s *snapshot) dumpWorkspace(context string) {
+- if !debugEnabled {
+- return
+- }
+-
+- debugf("workspace (after %s):", context)
+- var ids []PackageID
+- for id := range s.workspacePackages {
+- ids = append(ids, id)
+- }
+-
+- sort.Slice(ids, func(i, j int) bool {
+- return ids[i] < ids[j]
+- })
+-
+- for _, id := range ids {
+- pkgPath := s.workspacePackages[id]
+- _, ok := s.meta.metadata[id]
+- debugf(" %s:%s (metadata: %t)", id, pkgPath, ok)
+- }
+-}
+diff -urN a/gopls/internal/lsp/cache/errors.go b/gopls/internal/lsp/cache/errors.go
+--- a/gopls/internal/lsp/cache/errors.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/errors.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,528 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-// This file defines routines to convert diagnostics from go list, go
+-// get, go/packages, parsing, type checking, and analysis into
+-// source.Diagnostic form, and suggesting quick fixes.
+-
+-import (
+- "context"
+- "fmt"
+- "go/scanner"
+- "go/token"
+- "go/types"
+- "log"
+- "regexp"
+- "strconv"
+- "strings"
+-
+- "golang.org/x/tools/go/packages"
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/analysisinternal"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/typesinternal"
+-)
+-
+-// goPackagesErrorDiagnostics translates the given go/packages Error into a
+-// diagnostic, using the provided metadata and filesource.
+-//
+-// The slice of diagnostics may be empty.
+-func goPackagesErrorDiagnostics(ctx context.Context, e packages.Error, m *source.Metadata, fs source.FileSource) ([]*source.Diagnostic, error) {
+- if diag, err := parseGoListImportCycleError(ctx, e, m, fs); err != nil {
+- return nil, err
+- } else if diag != nil {
+- return []*source.Diagnostic{diag}, nil
+- }
+-
+- var spn span.Span
+- if e.Pos == "" {
+- spn = parseGoListError(e.Msg, m.LoadDir)
+- // We may not have been able to parse a valid span. Apply the errors to all files.
+- if _, err := spanToRange(ctx, fs, spn); err != nil {
+- var diags []*source.Diagnostic
+- for _, uri := range m.CompiledGoFiles {
+- diags = append(diags, &source.Diagnostic{
+- URI: uri,
+- Severity: protocol.SeverityError,
+- Source: source.ListError,
+- Message: e.Msg,
+- })
+- }
+- return diags, nil
+- }
+- } else {
+- spn = span.ParseInDir(e.Pos, m.LoadDir)
+- }
+-
+- // TODO(rfindley): in some cases the go command outputs invalid spans, for
+- // example (from TestGoListErrors):
+- //
+- // package a
+- // import
+- //
+- // In this case, the go command will complain about a.go:2:8, which is after
+- // the trailing newline but still considered to be on the second line, most
+- // likely because *token.File lacks information about newline termination.
+- //
+- // We could do better here by handling that case.
+- rng, err := spanToRange(ctx, fs, spn)
+- if err != nil {
+- return nil, err
+- }
+- return []*source.Diagnostic{{
+- URI: spn.URI(),
+- Range: rng,
+- Severity: protocol.SeverityError,
+- Source: source.ListError,
+- Message: e.Msg,
+- }}, nil
+-}
+-
+-func parseErrorDiagnostics(pkg *syntaxPackage, errList scanner.ErrorList) ([]*source.Diagnostic, error) {
+- // The first parser error is likely the root cause of the problem.
+- if errList.Len() <= 0 {
+- return nil, fmt.Errorf("no errors in %v", errList)
+- }
+- e := errList[0]
+- pgf, err := pkg.File(span.URIFromPath(e.Pos.Filename))
+- if err != nil {
+- return nil, err
+- }
+- rng, err := pgf.Mapper.OffsetRange(e.Pos.Offset, e.Pos.Offset)
+- if err != nil {
+- return nil, err
+- }
+- return []*source.Diagnostic{{
+- URI: pgf.URI,
+- Range: rng,
+- Severity: protocol.SeverityError,
+- Source: source.ParseError,
+- Message: e.Msg,
+- }}, nil
+-}
+-
+-var importErrorRe = regexp.MustCompile(`could not import ([^\s]+)`)
+-var unsupportedFeatureRe = regexp.MustCompile(`.*require.* go(\d+\.\d+) or later`)
+-
+-func typeErrorDiagnostics(moduleMode bool, linkTarget string, pkg *syntaxPackage, e extendedError) ([]*source.Diagnostic, error) {
+- code, loc, err := typeErrorData(pkg, e.primary)
+- if err != nil {
+- return nil, err
+- }
+- diag := &source.Diagnostic{
+- URI: loc.URI.SpanURI(),
+- Range: loc.Range,
+- Severity: protocol.SeverityError,
+- Source: source.TypeError,
+- Message: e.primary.Msg,
+- }
+- if code != 0 {
+- diag.Code = code.String()
+- diag.CodeHref = typesCodeHref(linkTarget, code)
+- }
+- switch code {
+- case typesinternal.UnusedVar, typesinternal.UnusedImport:
+- diag.Tags = append(diag.Tags, protocol.Unnecessary)
+- }
+-
+- for _, secondary := range e.secondaries {
+- _, secondaryLoc, err := typeErrorData(pkg, secondary)
+- if err != nil {
+- return nil, err
+- }
+- diag.Related = append(diag.Related, protocol.DiagnosticRelatedInformation{
+- Location: secondaryLoc,
+- Message: secondary.Msg,
+- })
+- }
+-
+- if match := importErrorRe.FindStringSubmatch(e.primary.Msg); match != nil {
+- diag.SuggestedFixes, err = goGetQuickFixes(moduleMode, loc.URI.SpanURI(), match[1])
+- if err != nil {
+- return nil, err
+- }
+- }
+- if match := unsupportedFeatureRe.FindStringSubmatch(e.primary.Msg); match != nil {
+- diag.SuggestedFixes, err = editGoDirectiveQuickFix(moduleMode, loc.URI.SpanURI(), match[1])
+- if err != nil {
+- return nil, err
+- }
+- }
+- return []*source.Diagnostic{diag}, nil
+-}
+-
+-func goGetQuickFixes(moduleMode bool, uri span.URI, pkg string) ([]source.SuggestedFix, error) {
+- // Go get only supports module mode for now.
+- if !moduleMode {
+- return nil, nil
+- }
+- title := fmt.Sprintf("go get package %v", pkg)
+- cmd, err := command.NewGoGetPackageCommand(title, command.GoGetPackageArgs{
+- URI: protocol.URIFromSpanURI(uri),
+- AddRequire: true,
+- Pkg: pkg,
+- })
+- if err != nil {
+- return nil, err
+- }
+- return []source.SuggestedFix{source.SuggestedFixFromCommand(cmd, protocol.QuickFix)}, nil
+-}
+-
+-func editGoDirectiveQuickFix(moduleMode bool, uri span.URI, version string) ([]source.SuggestedFix, error) {
+- // Go mod edit only supports module mode.
+- if !moduleMode {
+- return nil, nil
+- }
+- title := fmt.Sprintf("go mod edit -go=%s", version)
+- cmd, err := command.NewEditGoDirectiveCommand(title, command.EditGoDirectiveArgs{
+- URI: protocol.URIFromSpanURI(uri),
+- Version: version,
+- })
+- if err != nil {
+- return nil, err
+- }
+- return []source.SuggestedFix{source.SuggestedFixFromCommand(cmd, protocol.QuickFix)}, nil
+-}
+-
+-// encodeDiagnostics gob-encodes the given diagnostics.
+-func encodeDiagnostics(srcDiags []*source.Diagnostic) []byte {
+- var gobDiags []gobDiagnostic
+- for _, srcDiag := range srcDiags {
+- var gobFixes []gobSuggestedFix
+- for _, srcFix := range srcDiag.SuggestedFixes {
+- gobFix := gobSuggestedFix{
+- Message: srcFix.Title,
+- ActionKind: srcFix.ActionKind,
+- }
+- for uri, srcEdits := range srcFix.Edits {
+- for _, srcEdit := range srcEdits {
+- gobFix.TextEdits = append(gobFix.TextEdits, gobTextEdit{
+- Location: protocol.Location{
+- URI: protocol.URIFromSpanURI(uri),
+- Range: srcEdit.Range,
+- },
+- NewText: []byte(srcEdit.NewText),
+- })
+- }
+- }
+- if srcCmd := srcFix.Command; srcCmd != nil {
+- gobFix.Command = &gobCommand{
+- Title: srcCmd.Title,
+- Command: srcCmd.Command,
+- Arguments: srcCmd.Arguments,
+- }
+- }
+- gobFixes = append(gobFixes, gobFix)
+- }
+- var gobRelated []gobRelatedInformation
+- for _, srcRel := range srcDiag.Related {
+- gobRel := gobRelatedInformation(srcRel)
+- gobRelated = append(gobRelated, gobRel)
+- }
+- gobDiag := gobDiagnostic{
+- Location: protocol.Location{
+- URI: protocol.URIFromSpanURI(srcDiag.URI),
+- Range: srcDiag.Range,
+- },
+- Severity: srcDiag.Severity,
+- Code: srcDiag.Code,
+- CodeHref: srcDiag.CodeHref,
+- Source: string(srcDiag.Source),
+- Message: srcDiag.Message,
+- SuggestedFixes: gobFixes,
+- Related: gobRelated,
+- Tags: srcDiag.Tags,
+- }
+- gobDiags = append(gobDiags, gobDiag)
+- }
+- return mustEncode(gobDiags)
+-}
+-
+-// decodeDiagnostics decodes the given gob-encoded diagnostics.
+-func decodeDiagnostics(data []byte) []*source.Diagnostic {
+- var gobDiags []gobDiagnostic
+- mustDecode(data, &gobDiags)
+- var srcDiags []*source.Diagnostic
+- for _, gobDiag := range gobDiags {
+- var srcFixes []source.SuggestedFix
+- for _, gobFix := range gobDiag.SuggestedFixes {
+- srcFix := source.SuggestedFix{
+- Title: gobFix.Message,
+- ActionKind: gobFix.ActionKind,
+- }
+- for _, gobEdit := range gobFix.TextEdits {
+- if srcFix.Edits == nil {
+- srcFix.Edits = make(map[span.URI][]protocol.TextEdit)
+- }
+- srcEdit := protocol.TextEdit{
+- Range: gobEdit.Location.Range,
+- NewText: string(gobEdit.NewText),
+- }
+- uri := gobEdit.Location.URI.SpanURI()
+- srcFix.Edits[uri] = append(srcFix.Edits[uri], srcEdit)
+- }
+- if gobCmd := gobFix.Command; gobCmd != nil {
+- gobFix.Command = &gobCommand{
+- Title: gobCmd.Title,
+- Command: gobCmd.Command,
+- Arguments: gobCmd.Arguments,
+- }
+- }
+- srcFixes = append(srcFixes, srcFix)
+- }
+- var srcRelated []protocol.DiagnosticRelatedInformation
+- for _, gobRel := range gobDiag.Related {
+- srcRel := protocol.DiagnosticRelatedInformation(gobRel)
+- srcRelated = append(srcRelated, srcRel)
+- }
+- srcDiag := &source.Diagnostic{
+- URI: gobDiag.Location.URI.SpanURI(),
+- Range: gobDiag.Location.Range,
+- Severity: gobDiag.Severity,
+- Source: source.AnalyzerErrorKind(gobDiag.Source),
+- Message: gobDiag.Message,
+- Tags: gobDiag.Tags,
+- Related: srcRelated,
+- SuggestedFixes: srcFixes,
+- }
+- srcDiags = append(srcDiags, srcDiag)
+- }
+- return srcDiags
+-}
+-
+-// toSourceDiagnostic converts a gobDiagnostic to "source" form.
+-func toSourceDiagnostic(srcAnalyzer *source.Analyzer, gobDiag *gobDiagnostic) *source.Diagnostic {
+- var related []protocol.DiagnosticRelatedInformation
+- for _, gobRelated := range gobDiag.Related {
+- related = append(related, protocol.DiagnosticRelatedInformation(gobRelated))
+- }
+-
+- kinds := srcAnalyzer.ActionKind
+- if len(srcAnalyzer.ActionKind) == 0 {
+- kinds = append(kinds, protocol.QuickFix)
+- }
+- fixes := suggestedAnalysisFixes(gobDiag, kinds)
+- if srcAnalyzer.Fix != "" {
+- cmd, err := command.NewApplyFixCommand(gobDiag.Message, command.ApplyFixArgs{
+- URI: gobDiag.Location.URI,
+- Range: gobDiag.Location.Range,
+- Fix: srcAnalyzer.Fix,
+- })
+- if err != nil {
+- // JSON marshalling of these argument values cannot fail.
+- log.Fatalf("internal error in NewApplyFixCommand: %v", err)
+- }
+- for _, kind := range kinds {
+- fixes = append(fixes, source.SuggestedFixFromCommand(cmd, kind))
+- }
+- }
+-
+- severity := srcAnalyzer.Severity
+- if severity == 0 {
+- severity = protocol.SeverityWarning
+- }
+-
+- diag := &source.Diagnostic{
+- URI: gobDiag.Location.URI.SpanURI(),
+- Range: gobDiag.Location.Range,
+- Severity: severity,
+- Source: source.AnalyzerErrorKind(gobDiag.Source),
+- Message: gobDiag.Message,
+- Related: related,
+- SuggestedFixes: fixes,
+- }
+- // If the fixes only delete code, assume that the diagnostic is reporting dead code.
+- if onlyDeletions(fixes) {
+- diag.Tags = []protocol.DiagnosticTag{protocol.Unnecessary}
+- }
+- return diag
+-}
+-
+-// onlyDeletions returns true if all of the suggested fixes are deletions.
+-func onlyDeletions(fixes []source.SuggestedFix) bool {
+- for _, fix := range fixes {
+- if fix.Command != nil {
+- return false
+- }
+- for _, edits := range fix.Edits {
+- for _, edit := range edits {
+- if edit.NewText != "" {
+- return false
+- }
+- if protocol.ComparePosition(edit.Range.Start, edit.Range.End) == 0 {
+- return false
+- }
+- }
+- }
+- }
+- return len(fixes) > 0
+-}
+-
+-func typesCodeHref(linkTarget string, code typesinternal.ErrorCode) string {
+- return source.BuildLink(linkTarget, "golang.org/x/tools/internal/typesinternal", code.String())
+-}
+-
+-func suggestedAnalysisFixes(diag *gobDiagnostic, kinds []protocol.CodeActionKind) []source.SuggestedFix {
+- var fixes []source.SuggestedFix
+- for _, fix := range diag.SuggestedFixes {
+- edits := make(map[span.URI][]protocol.TextEdit)
+- for _, e := range fix.TextEdits {
+- uri := span.URI(e.Location.URI)
+- edits[uri] = append(edits[uri], protocol.TextEdit{
+- Range: e.Location.Range,
+- NewText: string(e.NewText),
+- })
+- }
+- for _, kind := range kinds {
+- fixes = append(fixes, source.SuggestedFix{
+- Title: fix.Message,
+- Edits: edits,
+- ActionKind: kind,
+- })
+- }
+-
+- }
+- return fixes
+-}
+-
+-func typeErrorData(pkg *syntaxPackage, terr types.Error) (typesinternal.ErrorCode, protocol.Location, error) {
+- ecode, start, end, ok := typesinternal.ReadGo116ErrorData(terr)
+- if !ok {
+- start, end = terr.Pos, terr.Pos
+- ecode = 0
+- }
+- // go/types may return invalid positions in some cases, such as
+- // in errors on tokens missing from the syntax tree.
+- if !start.IsValid() {
+- return 0, protocol.Location{}, fmt.Errorf("type error (%q, code %d, go116=%t) without position", terr.Msg, ecode, ok)
+- }
+- // go/types errors retain their FileSet.
+- // Sanity-check that we're using the right one.
+- fset := pkg.fset
+- if fset != terr.Fset {
+- return 0, protocol.Location{}, bug.Errorf("wrong FileSet for type error")
+- }
+- posn := safetoken.StartPosition(fset, start)
+- if !posn.IsValid() {
+- return 0, protocol.Location{}, fmt.Errorf("position %d of type error %q (code %q) not found in FileSet", start, start, terr)
+- }
+- pgf, err := pkg.File(span.URIFromPath(posn.Filename))
+- if err != nil {
+- return 0, protocol.Location{}, err
+- }
+- if !end.IsValid() || end == start {
+- end = analysisinternal.TypeErrorEndPos(fset, pgf.Src, start)
+- }
+- loc, err := pgf.Mapper.PosLocation(pgf.Tok, start, end)
+- return ecode, loc, err
+-}
+-
+-// spanToRange converts a span.Span to a protocol.Range, by mapping content
+-// contained in the provided FileSource.
+-func spanToRange(ctx context.Context, fs source.FileSource, spn span.Span) (protocol.Range, error) {
+- uri := spn.URI()
+- fh, err := fs.GetFile(ctx, uri)
+- if err != nil {
+- return protocol.Range{}, err
+- }
+- content, err := fh.Read()
+- if err != nil {
+- return protocol.Range{}, err
+- }
+- mapper := protocol.NewMapper(uri, content)
+- return mapper.SpanRange(spn)
+-}
+-
+-// parseGoListError attempts to parse a standard `go list` error message
+-// by stripping off the trailing error message.
+-//
+-// It works only on errors whose message is prefixed by colon,
+-// followed by a space (": "). For example:
+-//
+-// attributes.go:13:1: expected 'package', found 'type'
+-func parseGoListError(input, wd string) span.Span {
+- input = strings.TrimSpace(input)
+- msgIndex := strings.Index(input, ": ")
+- if msgIndex < 0 {
+- return span.Parse(input)
+- }
+- return span.ParseInDir(input[:msgIndex], wd)
+-}
+-
+-// parseGoListImportCycleError attempts to parse the given go/packages error as
+-// an import cycle, returning a diagnostic if successful.
+-//
+-// If the error is not detected as an import cycle error, it returns nil, nil.
+-func parseGoListImportCycleError(ctx context.Context, e packages.Error, m *source.Metadata, fs source.FileSource) (*source.Diagnostic, error) {
+- re := regexp.MustCompile(`(.*): import stack: \[(.+)\]`)
+- matches := re.FindStringSubmatch(strings.TrimSpace(e.Msg))
+- if len(matches) < 3 {
+- return nil, nil
+- }
+- msg := matches[1]
+- importList := strings.Split(matches[2], " ")
+- // Since the error is relative to the current package. The import that is causing
+- // the import cycle error is the second one in the list.
+- if len(importList) < 2 {
+- return nil, nil
+- }
+- // Imports have quotation marks around them.
+- circImp := strconv.Quote(importList[1])
+- for _, uri := range m.CompiledGoFiles {
+- pgf, err := parseGoURI(ctx, fs, uri, source.ParseHeader)
+- if err != nil {
+- return nil, err
+- }
+- // Search file imports for the import that is causing the import cycle.
+- for _, imp := range pgf.File.Imports {
+- if imp.Path.Value == circImp {
+- rng, err := pgf.NodeMappedRange(imp)
+- if err != nil {
+- return nil, nil
+- }
+-
+- return &source.Diagnostic{
+- URI: pgf.URI,
+- Range: rng.Range(),
+- Severity: protocol.SeverityError,
+- Source: source.ListError,
+- Message: msg,
+- }, nil
+- }
+- }
+- }
+- return nil, nil
+-}
+-
+-// parseGoURI is a helper to parse the Go file at the given URI from the file
+-// source fs. The resulting syntax and token.File belong to an ephemeral,
+-// encapsulated FileSet, so this file stands only on its own: it's not suitable
+-// to use in a list of file of a package, for example.
+-//
+-// It returns an error if the file could not be read.
+-func parseGoURI(ctx context.Context, fs source.FileSource, uri span.URI, mode source.ParseMode) (*source.ParsedGoFile, error) {
+- fh, err := fs.GetFile(ctx, uri)
+- if err != nil {
+- return nil, err
+- }
+- return parseGoImpl(ctx, token.NewFileSet(), fh, source.ParseHeader)
+-}
+-
+-// parseModURI is a helper to parse the Mod file at the given URI from the file
+-// source fs.
+-//
+-// It returns an error if the file could not be read.
+-func parseModURI(ctx context.Context, fs source.FileSource, uri span.URI) (*source.ParsedModule, error) {
+- fh, err := fs.GetFile(ctx, uri)
+- if err != nil {
+- return nil, err
+- }
+- return parseModImpl(ctx, fh)
+-}
+diff -urN a/gopls/internal/lsp/cache/errors_test.go b/gopls/internal/lsp/cache/errors_test.go
+--- a/gopls/internal/lsp/cache/errors_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/errors_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,52 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "strings"
+- "testing"
+-)
+-
+-func TestParseErrorMessage(t *testing.T) {
+- tests := []struct {
+- name string
+- in string
+- expectedFileName string
+- expectedLine int
+- expectedColumn int
+- }{
+- {
+- name: "from go list output",
+- in: "\nattributes.go:13:1: expected 'package', found 'type'",
+- expectedFileName: "attributes.go",
+- expectedLine: 13,
+- expectedColumn: 1,
+- },
+- }
+-
+- for _, tt := range tests {
+- t.Run(tt.name, func(t *testing.T) {
+- spn := parseGoListError(tt.in, ".")
+- fn := spn.URI().Filename()
+-
+- if !strings.HasSuffix(fn, tt.expectedFileName) {
+- t.Errorf("expected filename with suffix %v but got %v", tt.expectedFileName, fn)
+- }
+-
+- if !spn.HasPosition() {
+- t.Fatalf("expected span to have position")
+- }
+-
+- pos := spn.Start()
+- if pos.Line() != tt.expectedLine {
+- t.Errorf("expected line %v but got %v", tt.expectedLine, pos.Line())
+- }
+-
+- if pos.Column() != tt.expectedColumn {
+- t.Errorf("expected line %v but got %v", tt.expectedLine, pos.Line())
+- }
+- })
+- }
+-}
+diff -urN a/gopls/internal/lsp/cache/fs_memoized.go b/gopls/internal/lsp/cache/fs_memoized.go
+--- a/gopls/internal/lsp/cache/fs_memoized.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/fs_memoized.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,149 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "context"
+- "os"
+- "sync"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+- "golang.org/x/tools/internal/robustio"
+-)
+-
+-// A memoizedFS is a file source that memoizes reads, to reduce IO.
+-type memoizedFS struct {
+- mu sync.Mutex
+-
+- // filesByID maps existing file inodes to the result of a read.
+- // (The read may have failed, e.g. due to EACCES or a delete between stat+read.)
+- // Each slice is a non-empty list of aliases: different URIs.
+- filesByID map[robustio.FileID][]*DiskFile
+-}
+-
+-func newMemoizedFS() *memoizedFS {
+- return &memoizedFS{filesByID: make(map[robustio.FileID][]*DiskFile)}
+-}
+-
+-// A DiskFile is a file on the filesystem, or a failure to read one.
+-// It implements the source.FileHandle interface.
+-type DiskFile struct {
+- uri span.URI
+- modTime time.Time
+- content []byte
+- hash source.Hash
+- err error
+-}
+-
+-func (h *DiskFile) URI() span.URI { return h.uri }
+-
+-func (h *DiskFile) FileIdentity() source.FileIdentity {
+- return source.FileIdentity{
+- URI: h.uri,
+- Hash: h.hash,
+- }
+-}
+-
+-func (h *DiskFile) Saved() bool { return true }
+-func (h *DiskFile) Version() int32 { return 0 }
+-func (h *DiskFile) Read() ([]byte, error) { return h.content, h.err }
+-
+-// GetFile stats and (maybe) reads the file, updates the cache, and returns it.
+-func (fs *memoizedFS) GetFile(ctx context.Context, uri span.URI) (source.FileHandle, error) {
+- id, mtime, err := robustio.GetFileID(uri.Filename())
+- if err != nil {
+- // file does not exist
+- return &DiskFile{
+- err: err,
+- uri: uri,
+- }, nil
+- }
+-
+- // We check if the file has changed by comparing modification times. Notably,
+- // this is an imperfect heuristic as various systems have low resolution
+- // mtimes (as much as 1s on WSL or s390x builders), so we only cache
+- // filehandles if mtime is old enough to be reliable, meaning that we don't
+- // expect a subsequent write to have the same mtime.
+- //
+- // The coarsest mtime precision we've seen in practice is 1s, so consider
+- // mtime to be unreliable if it is less than 2s old. Capture this before
+- // doing anything else.
+- recentlyModified := time.Since(mtime) < 2*time.Second
+-
+- fs.mu.Lock()
+- fhs, ok := fs.filesByID[id]
+- if ok && fhs[0].modTime.Equal(mtime) {
+- var fh *DiskFile
+- // We have already seen this file and it has not changed.
+- for _, h := range fhs {
+- if h.uri == uri {
+- fh = h
+- break
+- }
+- }
+- // No file handle for this exact URI. Create an alias, but share content.
+- if fh == nil {
+- newFH := *fhs[0]
+- newFH.uri = uri
+- fh = &newFH
+- fhs = append(fhs, fh)
+- fs.filesByID[id] = fhs
+- }
+- fs.mu.Unlock()
+- return fh, nil
+- }
+- fs.mu.Unlock()
+-
+- // Unknown file, or file has changed. Read (or re-read) it.
+- fh, err := readFile(ctx, uri, mtime) // ~25us
+- if err != nil {
+- return nil, err // e.g. cancelled (not: read failed)
+- }
+-
+- fs.mu.Lock()
+- if !recentlyModified {
+- fs.filesByID[id] = []*DiskFile{fh}
+- } else {
+- delete(fs.filesByID, id)
+- }
+- fs.mu.Unlock()
+- return fh, nil
+-}
+-
+-// ioLimit limits the number of parallel file reads per process.
+-var ioLimit = make(chan struct{}, 128)
+-
+-func readFile(ctx context.Context, uri span.URI, mtime time.Time) (*DiskFile, error) {
+- select {
+- case ioLimit <- struct{}{}:
+- case <-ctx.Done():
+- return nil, ctx.Err()
+- }
+- defer func() { <-ioLimit }()
+-
+- ctx, done := event.Start(ctx, "cache.readFile", tag.File.Of(uri.Filename()))
+- _ = ctx
+- defer done()
+-
+- // It is possible that a race causes us to read a file with different file
+- // ID, or whose mtime differs from the given mtime. However, in these cases
+- // we expect the client to notify of a subsequent file change, and the file
+- // content should be eventually consistent.
+- content, err := os.ReadFile(uri.Filename()) // ~20us
+- if err != nil {
+- content = nil // just in case
+- }
+- return &DiskFile{
+- modTime: mtime,
+- uri: uri,
+- content: content,
+- hash: source.HashOf(content),
+- err: err,
+- }, nil
+-}
+diff -urN a/gopls/internal/lsp/cache/fs_overlay.go b/gopls/internal/lsp/cache/fs_overlay.go
+--- a/gopls/internal/lsp/cache/fs_overlay.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/fs_overlay.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,78 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "context"
+- "sync"
+-
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-// An overlayFS is a source.FileSource that keeps track of overlays on top of a
+-// delegate FileSource.
+-type overlayFS struct {
+- delegate source.FileSource
+-
+- mu sync.Mutex
+- overlays map[span.URI]*Overlay
+-}
+-
+-func newOverlayFS(delegate source.FileSource) *overlayFS {
+- return &overlayFS{
+- delegate: delegate,
+- overlays: make(map[span.URI]*Overlay),
+- }
+-}
+-
+-// Overlays returns a new unordered array of overlays.
+-func (fs *overlayFS) Overlays() []*Overlay {
+- fs.mu.Lock()
+- defer fs.mu.Unlock()
+- overlays := make([]*Overlay, 0, len(fs.overlays))
+- for _, overlay := range fs.overlays {
+- overlays = append(overlays, overlay)
+- }
+- return overlays
+-}
+-
+-func (fs *overlayFS) GetFile(ctx context.Context, uri span.URI) (source.FileHandle, error) {
+- fs.mu.Lock()
+- overlay, ok := fs.overlays[uri]
+- fs.mu.Unlock()
+- if ok {
+- return overlay, nil
+- }
+- return fs.delegate.GetFile(ctx, uri)
+-}
+-
+-// An Overlay is a file open in the editor. It may have unsaved edits.
+-// It implements the source.FileHandle interface.
+-type Overlay struct {
+- uri span.URI
+- content []byte
+- hash source.Hash
+- version int32
+- kind source.FileKind
+-
+- // saved is true if a file matches the state on disk,
+- // and therefore does not need to be part of the overlay sent to go/packages.
+- saved bool
+-}
+-
+-func (o *Overlay) URI() span.URI { return o.uri }
+-
+-func (o *Overlay) FileIdentity() source.FileIdentity {
+- return source.FileIdentity{
+- URI: o.uri,
+- Hash: o.hash,
+- }
+-}
+-
+-func (o *Overlay) Read() ([]byte, error) { return o.content, nil }
+-func (o *Overlay) Version() int32 { return o.version }
+-func (o *Overlay) Saved() bool { return o.saved }
+-func (o *Overlay) Kind() source.FileKind { return o.kind }
+diff -urN a/gopls/internal/lsp/cache/graph.go b/gopls/internal/lsp/cache/graph.go
+--- a/gopls/internal/lsp/cache/graph.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/graph.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,131 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "sort"
+-
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-// A metadataGraph is an immutable and transitively closed import
+-// graph of Go packages, as obtained from go/packages.
+-type metadataGraph struct {
+- // metadata maps package IDs to their associated metadata.
+- metadata map[PackageID]*source.Metadata
+-
+- // importedBy maps package IDs to the list of packages that import them.
+- importedBy map[PackageID][]PackageID
+-
+- // ids maps file URIs to package IDs, sorted by (!valid, cli, packageID).
+- // A single file may belong to multiple packages due to tests packages.
+- ids map[span.URI][]PackageID
+-}
+-
+-// Metadata implements the source.MetadataSource interface.
+-func (g *metadataGraph) Metadata(id PackageID) *source.Metadata {
+- return g.metadata[id]
+-}
+-
+-// Clone creates a new metadataGraph, applying the given updates to the
+-// receiver.
+-func (g *metadataGraph) Clone(updates map[PackageID]*source.Metadata) *metadataGraph {
+- if len(updates) == 0 {
+- // Optimization: since the graph is immutable, we can return the receiver.
+- return g
+- }
+- result := &metadataGraph{metadata: make(map[PackageID]*source.Metadata, len(g.metadata))}
+- // Copy metadata.
+- for id, m := range g.metadata {
+- result.metadata[id] = m
+- }
+- for id, m := range updates {
+- if m == nil {
+- delete(result.metadata, id)
+- } else {
+- result.metadata[id] = m
+- }
+- }
+- result.build()
+- return result
+-}
+-
+-// build constructs g.importedBy and g.uris from g.metadata.
+-//
+-// TODO(rfindley): we should enforce that the graph is acyclic here.
+-func (g *metadataGraph) build() {
+- // Build the import graph.
+- g.importedBy = make(map[PackageID][]PackageID)
+- for id, m := range g.metadata {
+- for _, depID := range m.DepsByPkgPath {
+- g.importedBy[depID] = append(g.importedBy[depID], id)
+- }
+- }
+-
+- // Collect file associations.
+- g.ids = make(map[span.URI][]PackageID)
+- for id, m := range g.metadata {
+- uris := map[span.URI]struct{}{}
+- for _, uri := range m.CompiledGoFiles {
+- uris[uri] = struct{}{}
+- }
+- for _, uri := range m.GoFiles {
+- uris[uri] = struct{}{}
+- }
+- for uri := range uris {
+- g.ids[uri] = append(g.ids[uri], id)
+- }
+- }
+-
+- // Sort and filter file associations.
+- for uri, ids := range g.ids {
+- sort.Slice(ids, func(i, j int) bool {
+- cli := source.IsCommandLineArguments(ids[i])
+- clj := source.IsCommandLineArguments(ids[j])
+- if cli != clj {
+- return clj
+- }
+-
+- // 2. packages appear in name order.
+- return ids[i] < ids[j]
+- })
+-
+- // Choose the best IDs for each URI, according to the following rules:
+- // - If there are any valid real packages, choose them.
+- // - Else, choose the first valid command-line-argument package, if it exists.
+- //
+- // TODO(rfindley): it might be better to track all IDs here, and exclude
+- // them later when type checking, but this is the existing behavior.
+- for i, id := range ids {
+- // If we've seen *anything* prior to command-line arguments package, take
+- // it. Note that ids[0] may itself be command-line-arguments.
+- if i > 0 && source.IsCommandLineArguments(id) {
+- g.ids[uri] = ids[:i]
+- break
+- }
+- }
+- }
+-}
+-
+-// reverseReflexiveTransitiveClosure returns a new mapping containing the
+-// metadata for the specified packages along with any package that
+-// transitively imports one of them, keyed by ID, including all the initial packages.
+-func (g *metadataGraph) reverseReflexiveTransitiveClosure(ids ...PackageID) map[PackageID]*source.Metadata {
+- seen := make(map[PackageID]*source.Metadata)
+- var visitAll func([]PackageID)
+- visitAll = func(ids []PackageID) {
+- for _, id := range ids {
+- if seen[id] == nil {
+- if m := g.metadata[id]; m != nil {
+- seen[id] = m
+- visitAll(g.importedBy[id])
+- }
+- }
+- }
+- }
+- visitAll(ids)
+- return seen
+-}
+diff -urN a/gopls/internal/lsp/cache/imports.go b/gopls/internal/lsp/cache/imports.go
+--- a/gopls/internal/lsp/cache/imports.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/imports.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,188 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "context"
+- "fmt"
+- "reflect"
+- "strings"
+- "sync"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/keys"
+- "golang.org/x/tools/internal/gocommand"
+- "golang.org/x/tools/internal/imports"
+-)
+-
+-type importsState struct {
+- ctx context.Context
+-
+- mu sync.Mutex
+- processEnv *imports.ProcessEnv
+- cacheRefreshDuration time.Duration
+- cacheRefreshTimer *time.Timer
+- cachedModFileHash source.Hash
+- cachedBuildFlags []string
+- cachedDirectoryFilters []string
+-
+- // runOnce records whether runProcessEnvFunc has been called at least once.
+- // This is necessary to avoid resetting state before the process env is
+- // populated.
+- //
+- // TODO(rfindley): this shouldn't be necessary.
+- runOnce bool
+-}
+-
+-func (s *importsState) runProcessEnvFunc(ctx context.Context, snapshot *snapshot, fn func(*imports.Options) error) error {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- // Find the hash of active mod files, if any. Using the unsaved content
+- // is slightly wasteful, since we'll drop caches a little too often, but
+- // the mod file shouldn't be changing while people are autocompleting.
+- //
+- // TODO(rfindley): consider instead hashing on-disk modfiles here.
+- var modFileHash source.Hash
+- for m := range snapshot.workspaceModFiles {
+- fh, err := snapshot.GetFile(ctx, m)
+- if err != nil {
+- return err
+- }
+- modFileHash.XORWith(fh.FileIdentity().Hash)
+- }
+-
+- // view.goEnv is immutable -- changes make a new view. Options can change.
+- // We can't compare build flags directly because we may add -modfile.
+- snapshot.view.optionsMu.Lock()
+- localPrefix := snapshot.view.options.Local
+- currentBuildFlags := snapshot.view.options.BuildFlags
+- currentDirectoryFilters := snapshot.view.options.DirectoryFilters
+- changed := !reflect.DeepEqual(currentBuildFlags, s.cachedBuildFlags) ||
+- snapshot.view.options.VerboseOutput != (s.processEnv.Logf != nil) ||
+- modFileHash != s.cachedModFileHash ||
+- !reflect.DeepEqual(snapshot.view.options.DirectoryFilters, s.cachedDirectoryFilters)
+- snapshot.view.optionsMu.Unlock()
+-
+- // If anything relevant to imports has changed, clear caches and
+- // update the processEnv. Clearing caches blocks on any background
+- // scans.
+- if changed {
+- // As a special case, skip cleanup the first time -- we haven't fully
+- // initialized the environment yet and calling GetResolver will do
+- // unnecessary work and potentially mess up the go.mod file.
+- if s.runOnce {
+- if resolver, err := s.processEnv.GetResolver(); err == nil {
+- if modResolver, ok := resolver.(*imports.ModuleResolver); ok {
+- modResolver.ClearForNewMod()
+- }
+- }
+- }
+-
+- s.cachedModFileHash = modFileHash
+- s.cachedBuildFlags = currentBuildFlags
+- s.cachedDirectoryFilters = currentDirectoryFilters
+- if err := s.populateProcessEnv(ctx, snapshot); err != nil {
+- return err
+- }
+- s.runOnce = true
+- }
+-
+- // Run the user function.
+- opts := &imports.Options{
+- // Defaults.
+- AllErrors: true,
+- Comments: true,
+- Fragment: true,
+- FormatOnly: false,
+- TabIndent: true,
+- TabWidth: 8,
+- Env: s.processEnv,
+- LocalPrefix: localPrefix,
+- }
+-
+- if err := fn(opts); err != nil {
+- return err
+- }
+-
+- if s.cacheRefreshTimer == nil {
+- // Don't refresh more than twice per minute.
+- delay := 30 * time.Second
+- // Don't spend more than a couple percent of the time refreshing.
+- if adaptive := 50 * s.cacheRefreshDuration; adaptive > delay {
+- delay = adaptive
+- }
+- s.cacheRefreshTimer = time.AfterFunc(delay, s.refreshProcessEnv)
+- }
+-
+- return nil
+-}
+-
+-// populateProcessEnv sets the dynamically configurable fields for the view's
+-// process environment. Assumes that the caller is holding the s.view.importsMu.
+-func (s *importsState) populateProcessEnv(ctx context.Context, snapshot *snapshot) error {
+- pe := s.processEnv
+-
+- if snapshot.view.Options().VerboseOutput {
+- pe.Logf = func(format string, args ...interface{}) {
+- event.Log(ctx, fmt.Sprintf(format, args...))
+- }
+- } else {
+- pe.Logf = nil
+- }
+-
+- // Extract invocation details from the snapshot to use with goimports.
+- //
+- // TODO(rfindley): refactor to extract the necessary invocation logic into
+- // separate functions. Using goCommandInvocation is unnecessarily indirect,
+- // and has led to memory leaks in the past, when the snapshot was
+- // unintentionally held past its lifetime.
+- _, inv, cleanupInvocation, err := snapshot.goCommandInvocation(ctx, source.LoadWorkspace, &gocommand.Invocation{
+- WorkingDir: snapshot.view.workingDir().Filename(),
+- })
+- if err != nil {
+- return err
+- }
+-
+- pe.BuildFlags = inv.BuildFlags
+- pe.ModFlag = "readonly" // processEnv operations should not mutate the modfile
+- pe.Env = map[string]string{}
+- for _, kv := range inv.Env {
+- split := strings.SplitN(kv, "=", 2)
+- if len(split) != 2 {
+- continue
+- }
+- pe.Env[split[0]] = split[1]
+- }
+- // We don't actually use the invocation, so clean it up now.
+- cleanupInvocation()
+- // TODO(rfindley): should this simply be inv.WorkingDir?
+- pe.WorkingDir = snapshot.view.workingDir().Filename()
+- return nil
+-}
+-
+-func (s *importsState) refreshProcessEnv() {
+- start := time.Now()
+-
+- s.mu.Lock()
+- env := s.processEnv
+- if resolver, err := s.processEnv.GetResolver(); err == nil {
+- resolver.ClearForNewScan()
+- }
+- s.mu.Unlock()
+-
+- event.Log(s.ctx, "background imports cache refresh starting")
+- if err := imports.PrimeCache(context.Background(), env); err == nil {
+- event.Log(s.ctx, fmt.Sprintf("background refresh finished after %v", time.Since(start)))
+- } else {
+- event.Log(s.ctx, fmt.Sprintf("background refresh finished after %v", time.Since(start)), keys.Err.Of(err))
+- }
+- s.mu.Lock()
+- s.cacheRefreshDuration = time.Since(start)
+- s.cacheRefreshTimer = nil
+- s.mu.Unlock()
+-}
+diff -urN a/gopls/internal/lsp/cache/keys.go b/gopls/internal/lsp/cache/keys.go
+--- a/gopls/internal/lsp/cache/keys.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/keys.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,52 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "io"
+-
+- "golang.org/x/tools/internal/event/label"
+-)
+-
+-var (
+- KeyCreateSession = NewSessionKey("create_session", "A new session was added")
+- KeyUpdateSession = NewSessionKey("update_session", "Updated information about a session")
+- KeyShutdownSession = NewSessionKey("shutdown_session", "A session was shut down")
+-)
+-
+-// SessionKey represents an event label key that has a *Session value.
+-type SessionKey struct {
+- name string
+- description string
+-}
+-
+-// NewSessionKey creates a new Key for *Session values.
+-func NewSessionKey(name, description string) *SessionKey {
+- return &SessionKey{name: name, description: description}
+-}
+-
+-func (k *SessionKey) Name() string { return k.name }
+-func (k *SessionKey) Description() string { return k.description }
+-
+-func (k *SessionKey) Format(w io.Writer, buf []byte, l label.Label) {
+- io.WriteString(w, k.From(l).ID())
+-}
+-
+-// Of creates a new Label with this key and the supplied session.
+-func (k *SessionKey) Of(v *Session) label.Label { return label.OfValue(k, v) }
+-
+-// Get can be used to get the session for the key from a label.Map.
+-func (k *SessionKey) Get(lm label.Map) *Session {
+- if t := lm.Find(k); t.Valid() {
+- return k.From(t)
+- }
+- return nil
+-}
+-
+-// From can be used to get the session value from a Label.
+-func (k *SessionKey) From(t label.Label) *Session {
+- err, _ := t.UnpackValue().(*Session)
+- return err
+-}
+diff -urN a/gopls/internal/lsp/cache/load.go b/gopls/internal/lsp/cache/load.go
+--- a/gopls/internal/lsp/cache/load.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/load.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,782 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "bytes"
+- "context"
+- "errors"
+- "fmt"
+- "path/filepath"
+- "sort"
+- "strings"
+- "sync/atomic"
+- "time"
+-
+- "golang.org/x/tools/go/packages"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+- "golang.org/x/tools/internal/gocommand"
+- "golang.org/x/tools/internal/packagesinternal"
+-)
+-
+-var loadID uint64 // atomic identifier for loads
+-
+-// errNoPackages indicates that a load query matched no packages.
+-var errNoPackages = errors.New("no packages returned")
+-
+-// load calls packages.Load for the given scopes, updating package metadata,
+-// import graph, and mapped files with the result.
+-//
+-// The resulting error may wrap the moduleErrorMap error type, representing
+-// errors associated with specific modules.
+-func (s *snapshot) load(ctx context.Context, allowNetwork bool, scopes ...loadScope) (err error) {
+- id := atomic.AddUint64(&loadID, 1)
+- eventName := fmt.Sprintf("go/packages.Load #%d", id) // unique name for logging
+-
+- var query []string
+- var containsDir bool // for logging
+-
+- // Keep track of module query -> module path so that we can later correlate query
+- // errors with errors.
+- moduleQueries := make(map[string]string)
+- for _, scope := range scopes {
+- switch scope := scope.(type) {
+- case packageLoadScope:
+- // The only time we pass package paths is when we're doing a
+- // partial workspace load. In those cases, the paths came back from
+- // go list and should already be GOPATH-vendorized when appropriate.
+- query = append(query, string(scope))
+-
+- case fileLoadScope:
+- uri := span.URI(scope)
+- fh := s.FindFile(uri)
+- if fh == nil || s.View().FileKind(fh) != source.Go {
+- // Don't try to load a file that doesn't exist, or isn't a go file.
+- continue
+- }
+- contents, err := fh.Read()
+- if err != nil {
+- continue
+- }
+- if isStandaloneFile(contents, s.view.Options().StandaloneTags) {
+- query = append(query, uri.Filename())
+- } else {
+- query = append(query, fmt.Sprintf("file=%s", uri.Filename()))
+- }
+-
+- case moduleLoadScope:
+- switch scope {
+- case "std", "cmd":
+- query = append(query, string(scope))
+- default:
+- modQuery := fmt.Sprintf("%s/...", scope)
+- query = append(query, modQuery)
+- moduleQueries[modQuery] = string(scope)
+- }
+-
+- case viewLoadScope:
+- // If we are outside of GOPATH, a module, or some other known
+- // build system, don't load subdirectories.
+- if !s.ValidBuildConfiguration() {
+- query = append(query, "./")
+- } else {
+- query = append(query, "./...")
+- }
+-
+- default:
+- panic(fmt.Sprintf("unknown scope type %T", scope))
+- }
+- switch scope.(type) {
+- case viewLoadScope, moduleLoadScope:
+- containsDir = true
+- }
+- }
+- if len(query) == 0 {
+- return nil
+- }
+- sort.Strings(query) // for determinism
+-
+- ctx, done := event.Start(ctx, "cache.view.load", tag.Query.Of(query))
+- defer done()
+-
+- flags := source.LoadWorkspace
+- if allowNetwork {
+- flags |= source.AllowNetwork
+- }
+- _, inv, cleanup, err := s.goCommandInvocation(ctx, flags, &gocommand.Invocation{
+- WorkingDir: s.view.workingDir().Filename(),
+- })
+- if err != nil {
+- return err
+- }
+-
+- // Set a last resort deadline on packages.Load since it calls the go
+- // command, which may hang indefinitely if it has a bug. golang/go#42132
+- // and golang/go#42255 have more context.
+- ctx, cancel := context.WithTimeout(ctx, 10*time.Minute)
+- defer cancel()
+-
+- cfg := s.config(ctx, inv)
+- pkgs, err := packages.Load(cfg, query...)
+- cleanup()
+-
+- // If the context was canceled, return early. Otherwise, we might be
+- // type-checking an incomplete result. Check the context directly,
+- // because go/packages adds extra information to the error.
+- if ctx.Err() != nil {
+- return ctx.Err()
+- }
+-
+- // This log message is sought for by TestReloadOnlyOnce.
+- labels := append(source.SnapshotLabels(s), tag.Query.Of(query), tag.PackageCount.Of(len(pkgs)))
+- if err != nil {
+- event.Error(ctx, eventName, err, labels...)
+- } else {
+- event.Log(ctx, eventName, labels...)
+- }
+-
+- if len(pkgs) == 0 {
+- if err == nil {
+- err = errNoPackages
+- }
+- return fmt.Errorf("packages.Load error: %w", err)
+- }
+-
+- moduleErrs := make(map[string][]packages.Error) // module path -> errors
+- filterFunc := s.view.filterFunc()
+- newMetadata := make(map[PackageID]*source.Metadata)
+- for _, pkg := range pkgs {
+- // The Go command returns synthetic list results for module queries that
+- // encountered module errors.
+- //
+- // For example, given a module path a.mod, we'll query for "a.mod/..." and
+- // the go command will return a package named "a.mod/..." holding this
+- // error. Save it for later interpretation.
+- //
+- // See golang/go#50862 for more details.
+- if mod := moduleQueries[pkg.PkgPath]; mod != "" { // a synthetic result for the unloadable module
+- if len(pkg.Errors) > 0 {
+- moduleErrs[mod] = pkg.Errors
+- }
+- continue
+- }
+-
+- if !containsDir || s.view.Options().VerboseOutput {
+- event.Log(ctx, eventName, append(
+- source.SnapshotLabels(s),
+- tag.Package.Of(pkg.ID),
+- tag.Files.Of(pkg.CompiledGoFiles))...)
+- }
+-
+- // Ignore packages with no sources, since we will never be able to
+- // correctly invalidate that metadata.
+- if len(pkg.GoFiles) == 0 && len(pkg.CompiledGoFiles) == 0 {
+- continue
+- }
+- // Special case for the builtin package, as it has no dependencies.
+- if pkg.PkgPath == "builtin" {
+- if len(pkg.GoFiles) != 1 {
+- return fmt.Errorf("only expected 1 file for builtin, got %v", len(pkg.GoFiles))
+- }
+- s.setBuiltin(pkg.GoFiles[0])
+- continue
+- }
+- // Skip test main packages.
+- if isTestMain(pkg, s.view.gocache) {
+- continue
+- }
+- // Skip filtered packages. They may be added anyway if they're
+- // dependencies of non-filtered packages.
+- //
+- // TODO(rfindley): why exclude metadata arbitrarily here? It should be safe
+- // to capture all metadata.
+- // TODO(rfindley): what about compiled go files?
+- if allFilesExcluded(pkg.GoFiles, filterFunc) {
+- continue
+- }
+- if err := buildMetadata(ctx, pkg, cfg, query, newMetadata, nil); err != nil {
+- return err
+- }
+- }
+-
+- s.mu.Lock()
+-
+- // Compute the minimal metadata updates (for Clone)
+- // required to preserve this invariant:
+- // for all id, s.packages.Get(id).m == s.meta.metadata[id].
+- updates := make(map[PackageID]*source.Metadata)
+- for _, m := range newMetadata {
+- if existing := s.meta.metadata[m.ID]; existing == nil {
+- updates[m.ID] = m
+- delete(s.shouldLoad, m.ID)
+- }
+- }
+- // Assert the invariant.
+- s.packages.Range(func(k, v interface{}) {
+- id, ph := k.(PackageID), v.(*packageHandle)
+- if s.meta.metadata[id] != ph.m {
+- // TODO(adonovan): upgrade to unconditional panic after Jan 2023.
+- bug.Reportf("inconsistent metadata")
+- }
+- })
+-
+- event.Log(ctx, fmt.Sprintf("%s: updating metadata for %d packages", eventName, len(updates)))
+-
+- // Before mutating the snapshot, ensure that we compute load diagnostics
+- // successfully. This could fail if the context is cancelled, and we don't
+- // want to leave the snapshot metadata in a partial state.
+- meta := s.meta.Clone(updates)
+- workspacePackages := computeWorkspacePackagesLocked(s, meta)
+- for _, update := range updates {
+- if err := computeLoadDiagnostics(ctx, update, meta, lockedSnapshot{s}, workspacePackages); err != nil {
+- return err
+- }
+- }
+- s.meta = meta
+- s.workspacePackages = workspacePackages
+- s.resetActivePackagesLocked()
+-
+- s.dumpWorkspace("load")
+- s.mu.Unlock()
+-
+- // Recompute the workspace package handle for any packages we invalidated.
+- //
+- // This is (putatively) an optimization since handle construction prefetches
+- // the content of all Go source files.
+- //
+- // However, one necessary side effect of this operation is that we are
+- // guaranteed to visit all package files during load. This is required for
+- // e.g. determining the set of directories to watch.
+- //
+- // TODO(rfindley, golang/go#57558): determine the set of directories based on
+- // loaded packages, and skip this precomputation.
+- for _, m := range updates {
+- s.buildPackageHandle(ctx, m.ID) // ignore error
+- }
+-
+- if len(moduleErrs) > 0 {
+- return &moduleErrorMap{moduleErrs}
+- }
+-
+- return nil
+-}
+-
+-type moduleErrorMap struct {
+- errs map[string][]packages.Error // module path -> errors
+-}
+-
+-func (m *moduleErrorMap) Error() string {
+- var paths []string // sort for stability
+- for path, errs := range m.errs {
+- if len(errs) > 0 { // should always be true, but be cautious
+- paths = append(paths, path)
+- }
+- }
+- sort.Strings(paths)
+-
+- var buf bytes.Buffer
+- fmt.Fprintf(&buf, "%d modules have errors:\n", len(paths))
+- for _, path := range paths {
+- fmt.Fprintf(&buf, "\t%s:%s\n", path, m.errs[path][0].Msg)
+- }
+-
+- return buf.String()
+-}
+-
+-// workspaceLayoutError returns an error describing a misconfiguration of the
+-// workspace, along with related diagnostic.
+-//
+-// The unusual argument ordering of results is intentional: if the resulting
+-// error is nil, so must be the resulting diagnostics.
+-//
+-// If ctx is cancelled, it may return ctx.Err(), nil.
+-//
+-// TODO(rfindley): separate workspace diagnostics from critical workspace
+-// errors.
+-func (s *snapshot) workspaceLayoutError(ctx context.Context) (error, []*source.Diagnostic) {
+- // TODO(rfindley): both of the checks below should be delegated to the workspace.
+-
+- if s.view.effectiveGO111MODULE() == off {
+- return nil, nil
+- }
+-
+- // If the user is using a go.work file, we assume that they know what they
+- // are doing.
+- //
+- // TODO(golang/go#53880): improve orphaned file diagnostics when using go.work.
+- if s.view.gowork != "" {
+- return nil, nil
+- }
+-
+- // Apply diagnostics about the workspace configuration to relevant open
+- // files.
+- openFiles := s.openFiles()
+-
+- // If the snapshot does not have a valid build configuration, it may be
+- // that the user has opened a directory that contains multiple modules.
+- // Check for that an warn about it.
+- if !s.ValidBuildConfiguration() {
+- var msg string
+- if s.view.goversion >= 18 {
+- msg = `gopls was not able to find modules in your workspace.
+-When outside of GOPATH, gopls needs to know which modules you are working on.
+-You can fix this by opening your workspace to a folder inside a Go module, or
+-by using a go.work file to specify multiple modules.
+-See the documentation for more information on setting up your workspace:
+-https://github.com/golang/tools/blob/master/gopls/doc/workspace.md.`
+- } else {
+- msg = `gopls requires a module at the root of your workspace.
+-You can work with multiple modules by upgrading to Go 1.18 or later, and using
+-go workspaces (go.work files).
+-See the documentation for more information on setting up your workspace:
+-https://github.com/golang/tools/blob/master/gopls/doc/workspace.md.`
+- }
+- return fmt.Errorf(msg), s.applyCriticalErrorToFiles(ctx, msg, openFiles)
+- }
+-
+- // If the user has one active go.mod file, they may still be editing files
+- // in nested modules. Check the module of each open file and add warnings
+- // that the nested module must be opened as a workspace folder.
+- if len(s.workspaceModFiles) == 1 {
+- // Get the active root go.mod file to compare against.
+- var rootMod string
+- for uri := range s.workspaceModFiles {
+- rootMod = uri.Filename()
+- }
+- rootDir := filepath.Dir(rootMod)
+- nestedModules := make(map[string][]source.FileHandle)
+- for _, fh := range openFiles {
+- mod, err := findRootPattern(ctx, filepath.Dir(fh.URI().Filename()), "go.mod", s)
+- if err != nil {
+- if ctx.Err() != nil {
+- return ctx.Err(), nil
+- }
+- continue
+- }
+- if mod == "" {
+- continue
+- }
+- if mod != rootMod && source.InDir(rootDir, mod) {
+- modDir := filepath.Dir(mod)
+- nestedModules[modDir] = append(nestedModules[modDir], fh)
+- }
+- }
+- var multiModuleMsg string
+- if s.view.goversion >= 18 {
+- multiModuleMsg = `To work on multiple modules at once, please use a go.work file.
+-See https://github.com/golang/tools/blob/master/gopls/doc/workspace.md for more information on using workspaces.`
+- } else {
+- multiModuleMsg = `To work on multiple modules at once, please upgrade to Go 1.18 and use a go.work file.
+-See https://github.com/golang/tools/blob/master/gopls/doc/workspace.md for more information on using workspaces.`
+- }
+- // Add a diagnostic to each file in a nested module to mark it as
+- // "orphaned". Don't show a general diagnostic in the progress bar,
+- // because the user may still want to edit a file in a nested module.
+- var srcDiags []*source.Diagnostic
+- for modDir, uris := range nestedModules {
+- msg := fmt.Sprintf("This file is in %s, which is a nested module in the %s module.\n%s", modDir, rootMod, multiModuleMsg)
+- srcDiags = append(srcDiags, s.applyCriticalErrorToFiles(ctx, msg, uris)...)
+- }
+- if len(srcDiags) != 0 {
+- return fmt.Errorf("You have opened a nested module.\n%s", multiModuleMsg), srcDiags
+- }
+- }
+- return nil, nil
+-}
+-
+-func (s *snapshot) applyCriticalErrorToFiles(ctx context.Context, msg string, files []source.FileHandle) []*source.Diagnostic {
+- var srcDiags []*source.Diagnostic
+- for _, fh := range files {
+- // Place the diagnostics on the package or module declarations.
+- var rng protocol.Range
+- switch s.view.FileKind(fh) {
+- case source.Go:
+- if pgf, err := s.ParseGo(ctx, fh, source.ParseHeader); err == nil {
+- // Check that we have a valid `package foo` range to use for positioning the error.
+- if pgf.File.Package.IsValid() && pgf.File.Name != nil && pgf.File.Name.End().IsValid() {
+- rng, _ = pgf.PosRange(pgf.File.Package, pgf.File.Name.End())
+- }
+- }
+- case source.Mod:
+- if pmf, err := s.ParseMod(ctx, fh); err == nil {
+- if mod := pmf.File.Module; mod != nil && mod.Syntax != nil {
+- rng, _ = pmf.Mapper.OffsetRange(mod.Syntax.Start.Byte, mod.Syntax.End.Byte)
+- }
+- }
+- }
+- srcDiags = append(srcDiags, &source.Diagnostic{
+- URI: fh.URI(),
+- Range: rng,
+- Severity: protocol.SeverityError,
+- Source: source.ListError,
+- Message: msg,
+- })
+- }
+- return srcDiags
+-}
+-
+-// buildMetadata populates the updates map with metadata updates to
+-// apply, based on the given pkg. It recurs through pkg.Imports to ensure that
+-// metadata exists for all dependencies.
+-func buildMetadata(ctx context.Context, pkg *packages.Package, cfg *packages.Config, query []string, updates map[PackageID]*source.Metadata, path []PackageID) error {
+- // Allow for multiple ad-hoc packages in the workspace (see #47584).
+- pkgPath := PackagePath(pkg.PkgPath)
+- id := PackageID(pkg.ID)
+- if source.IsCommandLineArguments(id) {
+- suffix := ":" + strings.Join(query, ",")
+- id = PackageID(pkg.ID + suffix)
+- pkgPath = PackagePath(pkg.PkgPath + suffix)
+- }
+-
+- if _, ok := updates[id]; ok {
+- // If we've already seen this dependency, there may be an import cycle, or
+- // we may have reached the same package transitively via distinct paths.
+- // Check the path to confirm.
+-
+- // TODO(rfindley): this doesn't look sufficient. Any single piece of new
+- // metadata could theoretically introduce import cycles in the metadata
+- // graph. What's the point of this limited check here (and is it even
+- // possible to get an import cycle in data from go/packages)? Consider
+- // simply returning, so that this function need not return an error.
+- //
+- // We should consider doing a more complete guard against import cycles
+- // elsewhere.
+- for _, prev := range path {
+- if prev == id {
+- return fmt.Errorf("import cycle detected: %q", id)
+- }
+- }
+- return nil
+- }
+-
+- // Recreate the metadata rather than reusing it to avoid locking.
+- m := &source.Metadata{
+- ID: id,
+- PkgPath: pkgPath,
+- Name: PackageName(pkg.Name),
+- ForTest: PackagePath(packagesinternal.GetForTest(pkg)),
+- TypesSizes: pkg.TypesSizes,
+- LoadDir: cfg.Dir,
+- Module: pkg.Module,
+- Errors: pkg.Errors,
+- DepsErrors: packagesinternal.GetDepsErrors(pkg),
+- }
+-
+- updates[id] = m
+-
+- for _, filename := range pkg.CompiledGoFiles {
+- uri := span.URIFromPath(filename)
+- m.CompiledGoFiles = append(m.CompiledGoFiles, uri)
+- }
+- for _, filename := range pkg.GoFiles {
+- uri := span.URIFromPath(filename)
+- m.GoFiles = append(m.GoFiles, uri)
+- }
+-
+- depsByImpPath := make(map[ImportPath]PackageID)
+- depsByPkgPath := make(map[PackagePath]PackageID)
+- for importPath, imported := range pkg.Imports {
+- importPath := ImportPath(importPath)
+-
+- // It is not an invariant that importPath == imported.PkgPath.
+- // For example, package "net" imports "golang.org/x/net/dns/dnsmessage"
+- // which refers to the package whose ID and PkgPath are both
+- // "vendor/golang.org/x/net/dns/dnsmessage". Notice the ImportMap,
+- // which maps ImportPaths to PackagePaths:
+- //
+- // $ go list -json net vendor/golang.org/x/net/dns/dnsmessage
+- // {
+- // "ImportPath": "net",
+- // "Name": "net",
+- // "Imports": [
+- // "C",
+- // "vendor/golang.org/x/net/dns/dnsmessage",
+- // "vendor/golang.org/x/net/route",
+- // ...
+- // ],
+- // "ImportMap": {
+- // "golang.org/x/net/dns/dnsmessage": "vendor/golang.org/x/net/dns/dnsmessage",
+- // "golang.org/x/net/route": "vendor/golang.org/x/net/route"
+- // },
+- // ...
+- // }
+- // {
+- // "ImportPath": "vendor/golang.org/x/net/dns/dnsmessage",
+- // "Name": "dnsmessage",
+- // ...
+- // }
+- //
+- // (Beware that, for historical reasons, go list uses
+- // the JSON field "ImportPath" for the package's
+- // path--effectively the linker symbol prefix.)
+- //
+- // The example above is slightly special to go list
+- // because it's in the std module. Otherwise,
+- // vendored modules are simply modules whose directory
+- // is vendor/ instead of GOMODCACHE, and the
+- // import path equals the package path.
+- //
+- // But in GOPATH (non-module) mode, it's possible for
+- // package vendoring to cause a non-identity ImportMap,
+- // as in this example:
+- //
+- // $ cd $HOME/src
+- // $ find . -type f
+- // ./b/b.go
+- // ./vendor/example.com/a/a.go
+- // $ cat ./b/b.go
+- // package b
+- // import _ "example.com/a"
+- // $ cat ./vendor/example.com/a/a.go
+- // package a
+- // $ GOPATH=$HOME GO111MODULE=off go list -json ./b | grep -A2 ImportMap
+- // "ImportMap": {
+- // "example.com/a": "vendor/example.com/a"
+- // },
+-
+- // Don't remember any imports with significant errors.
+- //
+- // The len=0 condition is a heuristic check for imports of
+- // non-existent packages (for which go/packages will create
+- // an edge to a synthesized node). The heuristic is unsound
+- // because some valid packages have zero files, for example,
+- // a directory containing only the file p_test.go defines an
+- // empty package p.
+- // TODO(adonovan): clarify this. Perhaps go/packages should
+- // report which nodes were synthesized.
+- if importPath != "unsafe" && len(imported.CompiledGoFiles) == 0 {
+- depsByImpPath[importPath] = "" // missing
+- continue
+- }
+-
+- depsByImpPath[importPath] = PackageID(imported.ID)
+- depsByPkgPath[PackagePath(imported.PkgPath)] = PackageID(imported.ID)
+- if err := buildMetadata(ctx, imported, cfg, query, updates, append(path, id)); err != nil {
+- event.Error(ctx, "error in dependency", err)
+- }
+- }
+- m.DepsByImpPath = depsByImpPath
+- m.DepsByPkgPath = depsByPkgPath
+-
+- // m.Diagnostics is set later in the loading pass, using
+- // computeLoadDiagnostics.
+-
+- return nil
+-}
+-
+-// computeLoadDiagnostics computes and sets m.Diagnostics for the given metadata m.
+-//
+-// It should only be called during metadata construction in snapshot.load.
+-func computeLoadDiagnostics(ctx context.Context, m *source.Metadata, meta *metadataGraph, fs source.FileSource, workspacePackages map[PackageID]PackagePath) error {
+- for _, packagesErr := range m.Errors {
+- // Filter out parse errors from go list. We'll get them when we
+- // actually parse, and buggy overlay support may generate spurious
+- // errors. (See TestNewModule_Issue38207.)
+- if strings.Contains(packagesErr.Msg, "expected '") {
+- continue
+- }
+- pkgDiags, err := goPackagesErrorDiagnostics(ctx, packagesErr, m, fs)
+- if err != nil {
+- // There are certain cases where the go command returns invalid
+- // positions, so we cannot panic or even bug.Reportf here.
+- event.Error(ctx, "unable to compute positions for list errors", err, tag.Package.Of(string(m.ID)))
+- continue
+- }
+- m.Diagnostics = append(m.Diagnostics, pkgDiags...)
+- }
+-
+- // TODO(rfindley): this is buggy: an insignificant change to a modfile
+- // (or an unsaved modfile) could affect the position of deps errors,
+- // without invalidating the package.
+- depsDiags, err := depsErrors(ctx, m, meta, fs, workspacePackages)
+- if err != nil {
+- if ctx.Err() == nil {
+- // TODO(rfindley): consider making this a bug.Reportf. depsErrors should
+- // not normally fail.
+- event.Error(ctx, "unable to compute deps errors", err, tag.Package.Of(string(m.ID)))
+- }
+- return nil
+- }
+- m.Diagnostics = append(m.Diagnostics, depsDiags...)
+- return nil
+-}
+-
+-// containsPackageLocked reports whether p is a workspace package for the
+-// snapshot s.
+-//
+-// s.mu must be held while calling this function.
+-func containsPackageLocked(s *snapshot, m *source.Metadata) bool {
+- // In legacy workspace mode, or if a package does not have an associated
+- // module, a package is considered inside the workspace if any of its files
+- // are under the workspace root (and not excluded).
+- //
+- // Otherwise if the package has a module it must be an active module (as
+- // defined by the module root or go.work file) and at least one file must not
+- // be filtered out by directoryFilters.
+- //
+- // TODO(rfindley): revisit this function. We should not need to predicate on
+- // gowork != "". It should suffice to consider workspace mod files (also, we
+- // will hopefully eliminate the concept of a workspace package soon).
+- if m.Module != nil && s.view.gowork != "" {
+- modURI := span.URIFromPath(m.Module.GoMod)
+- _, ok := s.workspaceModFiles[modURI]
+- if !ok {
+- return false
+- }
+-
+- uris := map[span.URI]struct{}{}
+- for _, uri := range m.CompiledGoFiles {
+- uris[uri] = struct{}{}
+- }
+- for _, uri := range m.GoFiles {
+- uris[uri] = struct{}{}
+- }
+-
+- filterFunc := s.view.filterFunc()
+- for uri := range uris {
+- // Don't use view.contains here. go.work files may include modules
+- // outside of the workspace folder.
+- if !strings.Contains(string(uri), "/vendor/") && !filterFunc(uri) {
+- return true
+- }
+- }
+- return false
+- }
+-
+- return containsFileInWorkspaceLocked(s, m)
+-}
+-
+-// containsOpenFileLocked reports whether any file referenced by m is open in
+-// the snapshot s.
+-//
+-// s.mu must be held while calling this function.
+-func containsOpenFileLocked(s *snapshot, m *source.Metadata) bool {
+- uris := map[span.URI]struct{}{}
+- for _, uri := range m.CompiledGoFiles {
+- uris[uri] = struct{}{}
+- }
+- for _, uri := range m.GoFiles {
+- uris[uri] = struct{}{}
+- }
+-
+- for uri := range uris {
+- if s.isOpenLocked(uri) {
+- return true
+- }
+- }
+- return false
+-}
+-
+-// containsFileInWorkspaceLocked reports whether m contains any file inside the
+-// workspace of the snapshot s.
+-//
+-// s.mu must be held while calling this function.
+-func containsFileInWorkspaceLocked(s *snapshot, m *source.Metadata) bool {
+- uris := map[span.URI]struct{}{}
+- for _, uri := range m.CompiledGoFiles {
+- uris[uri] = struct{}{}
+- }
+- for _, uri := range m.GoFiles {
+- uris[uri] = struct{}{}
+- }
+-
+- for uri := range uris {
+- // In order for a package to be considered for the workspace, at least one
+- // file must be contained in the workspace and not vendored.
+-
+- // The package's files are in this view. It may be a workspace package.
+- // Vendored packages are not likely to be interesting to the user.
+- if !strings.Contains(string(uri), "/vendor/") && s.view.contains(uri) {
+- return true
+- }
+- }
+- return false
+-}
+-
+-// computeWorkspacePackagesLocked computes workspace packages in the snapshot s
+-// for the given metadata graph.
+-//
+-// s.mu must be held while calling this function.
+-func computeWorkspacePackagesLocked(s *snapshot, meta *metadataGraph) map[PackageID]PackagePath {
+- workspacePackages := make(map[PackageID]PackagePath)
+- for _, m := range meta.metadata {
+- if !containsPackageLocked(s, m) {
+- continue
+- }
+-
+- if source.IsCommandLineArguments(m.ID) {
+- // If all the files contained in m have a real package, we don't need to
+- // keep m as a workspace package.
+- if allFilesHaveRealPackages(meta, m) {
+- continue
+- }
+-
+- // We only care about command-line-arguments packages if they are still
+- // open.
+- if !containsOpenFileLocked(s, m) {
+- continue
+- }
+- }
+-
+- switch {
+- case m.ForTest == "":
+- // A normal package.
+- workspacePackages[m.ID] = m.PkgPath
+- case m.ForTest == m.PkgPath, m.ForTest+"_test" == m.PkgPath:
+- // The test variant of some workspace package or its x_test.
+- // To load it, we need to load the non-test variant with -test.
+- //
+- // Notably, this excludes intermediate test variants from workspace
+- // packages.
+- workspacePackages[m.ID] = m.ForTest
+- }
+- }
+- return workspacePackages
+-}
+-
+-// allFilesHaveRealPackages reports whether all files referenced by m are
+-// contained in a "real" package (not command-line-arguments).
+-//
+-// If m is valid but all "real" packages containing any file are invalid, this
+-// function returns false.
+-//
+-// If m is not a command-line-arguments package, this is trivially true.
+-func allFilesHaveRealPackages(g *metadataGraph, m *source.Metadata) bool {
+- n := len(m.CompiledGoFiles)
+-checkURIs:
+- for _, uri := range append(m.CompiledGoFiles[0:n:n], m.GoFiles...) {
+- for _, id := range g.ids[uri] {
+- if !source.IsCommandLineArguments(id) {
+- continue checkURIs
+- }
+- }
+- return false
+- }
+- return true
+-}
+-
+-func isTestMain(pkg *packages.Package, gocache string) bool {
+- // Test mains must have an import path that ends with ".test".
+- if !strings.HasSuffix(pkg.PkgPath, ".test") {
+- return false
+- }
+- // Test main packages are always named "main".
+- if pkg.Name != "main" {
+- return false
+- }
+- // Test mains always have exactly one GoFile that is in the build cache.
+- if len(pkg.GoFiles) > 1 {
+- return false
+- }
+- if !source.InDir(gocache, pkg.GoFiles[0]) {
+- return false
+- }
+- return true
+-}
+diff -urN a/gopls/internal/lsp/cache/maps.go b/gopls/internal/lsp/cache/maps.go
+--- a/gopls/internal/lsp/cache/maps.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/maps.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,121 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/persistent"
+-)
+-
+-// TODO(euroelessar): Use generics once support for go1.17 is dropped.
+-
+-type filesMap struct {
+- impl *persistent.Map
+-}
+-
+-// uriLessInterface is the < relation for "any" values containing span.URIs.
+-func uriLessInterface(a, b interface{}) bool {
+- return a.(span.URI) < b.(span.URI)
+-}
+-
+-func newFilesMap() filesMap {
+- return filesMap{
+- impl: persistent.NewMap(uriLessInterface),
+- }
+-}
+-
+-func (m filesMap) Clone() filesMap {
+- return filesMap{
+- impl: m.impl.Clone(),
+- }
+-}
+-
+-func (m filesMap) Destroy() {
+- m.impl.Destroy()
+-}
+-
+-func (m filesMap) Get(key span.URI) (source.FileHandle, bool) {
+- value, ok := m.impl.Get(key)
+- if !ok {
+- return nil, false
+- }
+- return value.(source.FileHandle), true
+-}
+-
+-func (m filesMap) Range(do func(key span.URI, value source.FileHandle)) {
+- m.impl.Range(func(key, value interface{}) {
+- do(key.(span.URI), value.(source.FileHandle))
+- })
+-}
+-
+-func (m filesMap) Set(key span.URI, value source.FileHandle) {
+- m.impl.Set(key, value, nil)
+-}
+-
+-func (m filesMap) Delete(key span.URI) {
+- m.impl.Delete(key)
+-}
+-
+-func packageIDLessInterface(x, y interface{}) bool {
+- return x.(PackageID) < y.(PackageID)
+-}
+-
+-type knownDirsSet struct {
+- impl *persistent.Map
+-}
+-
+-func newKnownDirsSet() knownDirsSet {
+- return knownDirsSet{
+- impl: persistent.NewMap(func(a, b interface{}) bool {
+- return a.(span.URI) < b.(span.URI)
+- }),
+- }
+-}
+-
+-func (s knownDirsSet) Clone() knownDirsSet {
+- return knownDirsSet{
+- impl: s.impl.Clone(),
+- }
+-}
+-
+-func (s knownDirsSet) Destroy() {
+- s.impl.Destroy()
+-}
+-
+-func (s knownDirsSet) Contains(key span.URI) bool {
+- _, ok := s.impl.Get(key)
+- return ok
+-}
+-
+-func (s knownDirsSet) Range(do func(key span.URI)) {
+- s.impl.Range(func(key, value interface{}) {
+- do(key.(span.URI))
+- })
+-}
+-
+-func (s knownDirsSet) SetAll(other knownDirsSet) {
+- s.impl.SetAll(other.impl)
+-}
+-
+-func (s knownDirsSet) Insert(key span.URI) {
+- s.impl.Set(key, nil, nil)
+-}
+-
+-func (s knownDirsSet) Remove(key span.URI) {
+- s.impl.Delete(key)
+-}
+-
+-// analysisKeyLessInterface is the less-than relation for analysisKey
+-// values wrapped in an interface.
+-func analysisKeyLessInterface(a, b interface{}) bool {
+- x, y := a.(analysisKey), b.(analysisKey)
+- if cmp := strings.Compare(x.analyzerNames, y.analyzerNames); cmp != 0 {
+- return cmp < 0
+- }
+- return x.pkgid < y.pkgid
+-}
+diff -urN a/gopls/internal/lsp/cache/mod.go b/gopls/internal/lsp/cache/mod.go
+--- a/gopls/internal/lsp/cache/mod.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/mod.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,522 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "context"
+- "errors"
+- "fmt"
+- "path/filepath"
+- "regexp"
+- "strings"
+-
+- "golang.org/x/mod/modfile"
+- "golang.org/x/mod/module"
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+- "golang.org/x/tools/internal/gocommand"
+- "golang.org/x/tools/internal/memoize"
+-)
+-
+-// ParseMod parses a go.mod file, using a cache. It may return partial results and an error.
+-func (s *snapshot) ParseMod(ctx context.Context, fh source.FileHandle) (*source.ParsedModule, error) {
+- uri := fh.URI()
+-
+- s.mu.Lock()
+- entry, hit := s.parseModHandles.Get(uri)
+- s.mu.Unlock()
+-
+- type parseModKey source.FileIdentity
+- type parseModResult struct {
+- parsed *source.ParsedModule
+- err error
+- }
+-
+- // cache miss?
+- if !hit {
+- promise, release := s.store.Promise(parseModKey(fh.FileIdentity()), func(ctx context.Context, _ interface{}) interface{} {
+- parsed, err := parseModImpl(ctx, fh)
+- return parseModResult{parsed, err}
+- })
+-
+- entry = promise
+- s.mu.Lock()
+- s.parseModHandles.Set(uri, entry, func(_, _ interface{}) { release() })
+- s.mu.Unlock()
+- }
+-
+- // Await result.
+- v, err := s.awaitPromise(ctx, entry.(*memoize.Promise))
+- if err != nil {
+- return nil, err
+- }
+- res := v.(parseModResult)
+- return res.parsed, res.err
+-}
+-
+-// parseModImpl parses the go.mod file whose name and contents are in fh.
+-// It may return partial results and an error.
+-func parseModImpl(ctx context.Context, fh source.FileHandle) (*source.ParsedModule, error) {
+- _, done := event.Start(ctx, "cache.ParseMod", tag.URI.Of(fh.URI()))
+- defer done()
+-
+- contents, err := fh.Read()
+- if err != nil {
+- return nil, err
+- }
+- m := protocol.NewMapper(fh.URI(), contents)
+- file, parseErr := modfile.Parse(fh.URI().Filename(), contents, nil)
+- // Attempt to convert the error to a standardized parse error.
+- var parseErrors []*source.Diagnostic
+- if parseErr != nil {
+- mfErrList, ok := parseErr.(modfile.ErrorList)
+- if !ok {
+- return nil, fmt.Errorf("unexpected parse error type %v", parseErr)
+- }
+- for _, mfErr := range mfErrList {
+- rng, err := m.OffsetRange(mfErr.Pos.Byte, mfErr.Pos.Byte)
+- if err != nil {
+- return nil, err
+- }
+- parseErrors = append(parseErrors, &source.Diagnostic{
+- URI: fh.URI(),
+- Range: rng,
+- Severity: protocol.SeverityError,
+- Source: source.ParseError,
+- Message: mfErr.Err.Error(),
+- })
+- }
+- }
+- return &source.ParsedModule{
+- URI: fh.URI(),
+- Mapper: m,
+- File: file,
+- ParseErrors: parseErrors,
+- }, parseErr
+-}
+-
+-// ParseWork parses a go.work file, using a cache. It may return partial results and an error.
+-// TODO(adonovan): move to new work.go file.
+-func (s *snapshot) ParseWork(ctx context.Context, fh source.FileHandle) (*source.ParsedWorkFile, error) {
+- uri := fh.URI()
+-
+- s.mu.Lock()
+- entry, hit := s.parseWorkHandles.Get(uri)
+- s.mu.Unlock()
+-
+- type parseWorkKey source.FileIdentity
+- type parseWorkResult struct {
+- parsed *source.ParsedWorkFile
+- err error
+- }
+-
+- // cache miss?
+- if !hit {
+- handle, release := s.store.Promise(parseWorkKey(fh.FileIdentity()), func(ctx context.Context, _ interface{}) interface{} {
+- parsed, err := parseWorkImpl(ctx, fh)
+- return parseWorkResult{parsed, err}
+- })
+-
+- entry = handle
+- s.mu.Lock()
+- s.parseWorkHandles.Set(uri, entry, func(_, _ interface{}) { release() })
+- s.mu.Unlock()
+- }
+-
+- // Await result.
+- v, err := s.awaitPromise(ctx, entry.(*memoize.Promise))
+- if err != nil {
+- return nil, err
+- }
+- res := v.(parseWorkResult)
+- return res.parsed, res.err
+-}
+-
+-// parseWorkImpl parses a go.work file. It may return partial results and an error.
+-func parseWorkImpl(ctx context.Context, fh source.FileHandle) (*source.ParsedWorkFile, error) {
+- _, done := event.Start(ctx, "cache.ParseWork", tag.URI.Of(fh.URI()))
+- defer done()
+-
+- contents, err := fh.Read()
+- if err != nil {
+- return nil, err
+- }
+- m := protocol.NewMapper(fh.URI(), contents)
+- file, parseErr := modfile.ParseWork(fh.URI().Filename(), contents, nil)
+- // Attempt to convert the error to a standardized parse error.
+- var parseErrors []*source.Diagnostic
+- if parseErr != nil {
+- mfErrList, ok := parseErr.(modfile.ErrorList)
+- if !ok {
+- return nil, fmt.Errorf("unexpected parse error type %v", parseErr)
+- }
+- for _, mfErr := range mfErrList {
+- rng, err := m.OffsetRange(mfErr.Pos.Byte, mfErr.Pos.Byte)
+- if err != nil {
+- return nil, err
+- }
+- parseErrors = append(parseErrors, &source.Diagnostic{
+- URI: fh.URI(),
+- Range: rng,
+- Severity: protocol.SeverityError,
+- Source: source.ParseError,
+- Message: mfErr.Err.Error(),
+- })
+- }
+- }
+- return &source.ParsedWorkFile{
+- URI: fh.URI(),
+- Mapper: m,
+- File: file,
+- ParseErrors: parseErrors,
+- }, parseErr
+-}
+-
+-// goSum reads the go.sum file for the go.mod file at modURI, if it exists. If
+-// it doesn't exist, it returns nil.
+-func (s *snapshot) goSum(ctx context.Context, modURI span.URI) []byte {
+- // Get the go.sum file, either from the snapshot or directly from the
+- // cache. Avoid (*snapshot).GetFile here, as we don't want to add
+- // nonexistent file handles to the snapshot if the file does not exist.
+- //
+- // TODO(rfindley): but that's not right. Changes to sum files should
+- // invalidate content, even if it's nonexistent content.
+- sumURI := span.URIFromPath(sumFilename(modURI))
+- var sumFH source.FileHandle = s.FindFile(sumURI)
+- if sumFH == nil {
+- var err error
+- sumFH, err = s.view.fs.GetFile(ctx, sumURI)
+- if err != nil {
+- return nil
+- }
+- }
+- content, err := sumFH.Read()
+- if err != nil {
+- return nil
+- }
+- return content
+-}
+-
+-func sumFilename(modURI span.URI) string {
+- return strings.TrimSuffix(modURI.Filename(), ".mod") + ".sum"
+-}
+-
+-// ModWhy returns the "go mod why" result for each module named in a
+-// require statement in the go.mod file.
+-// TODO(adonovan): move to new mod_why.go file.
+-func (s *snapshot) ModWhy(ctx context.Context, fh source.FileHandle) (map[string]string, error) {
+- uri := fh.URI()
+-
+- if s.View().FileKind(fh) != source.Mod {
+- return nil, fmt.Errorf("%s is not a go.mod file", uri)
+- }
+-
+- s.mu.Lock()
+- entry, hit := s.modWhyHandles.Get(uri)
+- s.mu.Unlock()
+-
+- type modWhyResult struct {
+- why map[string]string
+- err error
+- }
+-
+- // cache miss?
+- if !hit {
+- handle := memoize.NewPromise("modWhy", func(ctx context.Context, arg interface{}) interface{} {
+- why, err := modWhyImpl(ctx, arg.(*snapshot), fh)
+- return modWhyResult{why, err}
+- })
+-
+- entry = handle
+- s.mu.Lock()
+- s.modWhyHandles.Set(uri, entry, nil)
+- s.mu.Unlock()
+- }
+-
+- // Await result.
+- v, err := s.awaitPromise(ctx, entry.(*memoize.Promise))
+- if err != nil {
+- return nil, err
+- }
+- res := v.(modWhyResult)
+- return res.why, res.err
+-}
+-
+-// modWhyImpl returns the result of "go mod why -m" on the specified go.mod file.
+-func modWhyImpl(ctx context.Context, snapshot *snapshot, fh source.FileHandle) (map[string]string, error) {
+- ctx, done := event.Start(ctx, "cache.ModWhy", tag.URI.Of(fh.URI()))
+- defer done()
+-
+- pm, err := snapshot.ParseMod(ctx, fh)
+- if err != nil {
+- return nil, err
+- }
+- // No requires to explain.
+- if len(pm.File.Require) == 0 {
+- return nil, nil // empty result
+- }
+- // Run `go mod why` on all the dependencies.
+- inv := &gocommand.Invocation{
+- Verb: "mod",
+- Args: []string{"why", "-m"},
+- WorkingDir: filepath.Dir(fh.URI().Filename()),
+- }
+- for _, req := range pm.File.Require {
+- inv.Args = append(inv.Args, req.Mod.Path)
+- }
+- stdout, err := snapshot.RunGoCommandDirect(ctx, source.Normal, inv)
+- if err != nil {
+- return nil, err
+- }
+- whyList := strings.Split(stdout.String(), "\n\n")
+- if len(whyList) != len(pm.File.Require) {
+- return nil, fmt.Errorf("mismatched number of results: got %v, want %v", len(whyList), len(pm.File.Require))
+- }
+- why := make(map[string]string, len(pm.File.Require))
+- for i, req := range pm.File.Require {
+- why[req.Mod.Path] = whyList[i]
+- }
+- return why, nil
+-}
+-
+-// extractGoCommandErrors tries to parse errors that come from the go command
+-// and shape them into go.mod diagnostics.
+-// TODO: rename this to 'load errors'
+-func (s *snapshot) extractGoCommandErrors(ctx context.Context, goCmdError error) []*source.Diagnostic {
+- if goCmdError == nil {
+- return nil
+- }
+-
+- type locatedErr struct {
+- spn span.Span
+- msg string
+- }
+- diagLocations := map[*source.ParsedModule]locatedErr{}
+- backupDiagLocations := map[*source.ParsedModule]locatedErr{}
+-
+- // If moduleErrs is non-nil, go command errors are scoped to specific
+- // modules.
+- var moduleErrs *moduleErrorMap
+- _ = errors.As(goCmdError, &moduleErrs)
+-
+- // Match the error against all the mod files in the workspace.
+- for _, uri := range s.ModFiles() {
+- fh, err := s.GetFile(ctx, uri)
+- if err != nil {
+- event.Error(ctx, "getting modfile for Go command error", err)
+- continue
+- }
+- pm, err := s.ParseMod(ctx, fh)
+- if err != nil {
+- // Parsing errors are reported elsewhere
+- return nil
+- }
+- var msgs []string // error messages to consider
+- if moduleErrs != nil {
+- if pm.File.Module != nil {
+- for _, mes := range moduleErrs.errs[pm.File.Module.Mod.Path] {
+- msgs = append(msgs, mes.Error())
+- }
+- }
+- } else {
+- msgs = append(msgs, goCmdError.Error())
+- }
+- for _, msg := range msgs {
+- if strings.Contains(goCmdError.Error(), "errors parsing go.mod") {
+- // The go command emits parse errors for completely invalid go.mod files.
+- // Those are reported by our own diagnostics and can be ignored here.
+- // As of writing, we are not aware of any other errors that include
+- // file/position information, so don't even try to find it.
+- continue
+- }
+- spn, found, err := s.matchErrorToModule(ctx, pm, msg)
+- if err != nil {
+- event.Error(ctx, "matching error to module", err)
+- continue
+- }
+- le := locatedErr{
+- spn: spn,
+- msg: msg,
+- }
+- if found {
+- diagLocations[pm] = le
+- } else {
+- backupDiagLocations[pm] = le
+- }
+- }
+- }
+-
+- // If we didn't find any good matches, assign diagnostics to all go.mod files.
+- if len(diagLocations) == 0 {
+- diagLocations = backupDiagLocations
+- }
+-
+- var srcErrs []*source.Diagnostic
+- for pm, le := range diagLocations {
+- diag, err := s.goCommandDiagnostic(pm, le.spn, le.msg)
+- if err != nil {
+- event.Error(ctx, "building go command diagnostic", err)
+- continue
+- }
+- srcErrs = append(srcErrs, diag)
+- }
+- return srcErrs
+-}
+-
+-var moduleVersionInErrorRe = regexp.MustCompile(`[:\s]([+-._~0-9A-Za-z]+)@([+-._~0-9A-Za-z]+)[:\s]`)
+-
+-// matchErrorToModule matches a go command error message to a go.mod file.
+-// Some examples:
+-//
+-// example.com@v1.2.2: reading example.com/@v/v1.2.2.mod: no such file or directory
+-// go: github.com/cockroachdb/apd/v2@v2.0.72: reading github.com/cockroachdb/apd/go.mod at revision v2.0.72: unknown revision v2.0.72
+-// go: example.com@v1.2.3 requires\n\trandom.org@v1.2.3: parsing go.mod:\n\tmodule declares its path as: bob.org\n\tbut was required as: random.org
+-//
+-// It returns the location of a reference to the one of the modules and true
+-// if one exists. If none is found it returns a fallback location and false.
+-func (s *snapshot) matchErrorToModule(ctx context.Context, pm *source.ParsedModule, goCmdError string) (span.Span, bool, error) {
+- var reference *modfile.Line
+- matches := moduleVersionInErrorRe.FindAllStringSubmatch(goCmdError, -1)
+-
+- for i := len(matches) - 1; i >= 0; i-- {
+- ver := module.Version{Path: matches[i][1], Version: matches[i][2]}
+- if err := module.Check(ver.Path, ver.Version); err != nil {
+- continue
+- }
+- reference = findModuleReference(pm.File, ver)
+- if reference != nil {
+- break
+- }
+- }
+-
+- if reference == nil {
+- // No match for the module path was found in the go.mod file.
+- // Show the error on the module declaration, if one exists, or
+- // just the first line of the file.
+- if pm.File.Module == nil {
+- return span.New(pm.URI, span.NewPoint(1, 1, 0), span.Point{}), false, nil
+- }
+- syntax := pm.File.Module.Syntax
+- spn, err := pm.Mapper.OffsetSpan(syntax.Start.Byte, syntax.End.Byte)
+- return spn, false, err
+- }
+-
+- spn, err := pm.Mapper.OffsetSpan(reference.Start.Byte, reference.End.Byte)
+- return spn, true, err
+-}
+-
+-// goCommandDiagnostic creates a diagnostic for a given go command error.
+-func (s *snapshot) goCommandDiagnostic(pm *source.ParsedModule, spn span.Span, goCmdError string) (*source.Diagnostic, error) {
+- rng, err := pm.Mapper.SpanRange(spn)
+- if err != nil {
+- return nil, err
+- }
+-
+- matches := moduleVersionInErrorRe.FindAllStringSubmatch(goCmdError, -1)
+- var innermost *module.Version
+- for i := len(matches) - 1; i >= 0; i-- {
+- ver := module.Version{Path: matches[i][1], Version: matches[i][2]}
+- if err := module.Check(ver.Path, ver.Version); err != nil {
+- continue
+- }
+- innermost = &ver
+- break
+- }
+-
+- switch {
+- case strings.Contains(goCmdError, "inconsistent vendoring"):
+- cmd, err := command.NewVendorCommand("Run go mod vendor", command.URIArg{URI: protocol.URIFromSpanURI(pm.URI)})
+- if err != nil {
+- return nil, err
+- }
+- return &source.Diagnostic{
+- URI: pm.URI,
+- Range: rng,
+- Severity: protocol.SeverityError,
+- Source: source.ListError,
+- Message: `Inconsistent vendoring detected. Please re-run "go mod vendor".
+-See https://github.com/golang/go/issues/39164 for more detail on this issue.`,
+- SuggestedFixes: []source.SuggestedFix{source.SuggestedFixFromCommand(cmd, protocol.QuickFix)},
+- }, nil
+-
+- case strings.Contains(goCmdError, "updates to go.sum needed"), strings.Contains(goCmdError, "missing go.sum entry"):
+- var args []protocol.DocumentURI
+- for _, uri := range s.ModFiles() {
+- args = append(args, protocol.URIFromSpanURI(uri))
+- }
+- tidyCmd, err := command.NewTidyCommand("Run go mod tidy", command.URIArgs{URIs: args})
+- if err != nil {
+- return nil, err
+- }
+- updateCmd, err := command.NewUpdateGoSumCommand("Update go.sum", command.URIArgs{URIs: args})
+- if err != nil {
+- return nil, err
+- }
+- msg := "go.sum is out of sync with go.mod. Please update it by applying the quick fix."
+- if innermost != nil {
+- msg = fmt.Sprintf("go.sum is out of sync with go.mod: entry for %v is missing. Please updating it by applying the quick fix.", innermost)
+- }
+- return &source.Diagnostic{
+- URI: pm.URI,
+- Range: rng,
+- Severity: protocol.SeverityError,
+- Source: source.ListError,
+- Message: msg,
+- SuggestedFixes: []source.SuggestedFix{
+- source.SuggestedFixFromCommand(tidyCmd, protocol.QuickFix),
+- source.SuggestedFixFromCommand(updateCmd, protocol.QuickFix),
+- },
+- }, nil
+- case strings.Contains(goCmdError, "disabled by GOPROXY=off") && innermost != nil:
+- title := fmt.Sprintf("Download %v@%v", innermost.Path, innermost.Version)
+- cmd, err := command.NewAddDependencyCommand(title, command.DependencyArgs{
+- URI: protocol.URIFromSpanURI(pm.URI),
+- AddRequire: false,
+- GoCmdArgs: []string{fmt.Sprintf("%v@%v", innermost.Path, innermost.Version)},
+- })
+- if err != nil {
+- return nil, err
+- }
+- return &source.Diagnostic{
+- URI: pm.URI,
+- Range: rng,
+- Severity: protocol.SeverityError,
+- Message: fmt.Sprintf("%v@%v has not been downloaded", innermost.Path, innermost.Version),
+- Source: source.ListError,
+- SuggestedFixes: []source.SuggestedFix{source.SuggestedFixFromCommand(cmd, protocol.QuickFix)},
+- }, nil
+- default:
+- return &source.Diagnostic{
+- URI: pm.URI,
+- Range: rng,
+- Severity: protocol.SeverityError,
+- Source: source.ListError,
+- Message: goCmdError,
+- }, nil
+- }
+-}
+-
+-func findModuleReference(mf *modfile.File, ver module.Version) *modfile.Line {
+- for _, req := range mf.Require {
+- if req.Mod == ver {
+- return req.Syntax
+- }
+- }
+- for _, ex := range mf.Exclude {
+- if ex.Mod == ver {
+- return ex.Syntax
+- }
+- }
+- for _, rep := range mf.Replace {
+- if rep.New == ver || rep.Old == ver {
+- return rep.Syntax
+- }
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cache/mod_tidy.go b/gopls/internal/lsp/cache/mod_tidy.go
+--- a/gopls/internal/lsp/cache/mod_tidy.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/mod_tidy.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,469 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "context"
+- "fmt"
+- "go/ast"
+- "io/ioutil"
+- "os"
+- "path/filepath"
+- "strconv"
+- "strings"
+-
+- "golang.org/x/mod/modfile"
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+- "golang.org/x/tools/internal/gocommand"
+- "golang.org/x/tools/internal/memoize"
+-)
+-
+-// ModTidy returns the go.mod file that would be obtained by running
+-// "go mod tidy". Concurrent requests are combined into a single command.
+-func (s *snapshot) ModTidy(ctx context.Context, pm *source.ParsedModule) (*source.TidiedModule, error) {
+- uri := pm.URI
+- if pm.File == nil {
+- return nil, fmt.Errorf("cannot tidy unparseable go.mod file: %v", uri)
+- }
+-
+- s.mu.Lock()
+- entry, hit := s.modTidyHandles.Get(uri)
+- s.mu.Unlock()
+-
+- type modTidyResult struct {
+- tidied *source.TidiedModule
+- err error
+- }
+-
+- // Cache miss?
+- if !hit {
+- // If the file handle is an overlay, it may not be written to disk.
+- // The go.mod file has to be on disk for `go mod tidy` to work.
+- // TODO(rfindley): is this still true with Go 1.16 overlay support?
+- fh, err := s.GetFile(ctx, pm.URI)
+- if err != nil {
+- return nil, err
+- }
+- if _, ok := fh.(*Overlay); ok {
+- if info, _ := os.Stat(uri.Filename()); info == nil {
+- return nil, source.ErrNoModOnDisk
+- }
+- }
+-
+- if criticalErr := s.GetCriticalError(ctx); criticalErr != nil {
+- return &source.TidiedModule{
+- Diagnostics: criticalErr.Diagnostics,
+- }, nil
+- }
+- if ctx.Err() != nil { // must check ctx after GetCriticalError
+- return nil, ctx.Err()
+- }
+-
+- if err := s.awaitLoaded(ctx); err != nil {
+- return nil, err
+- }
+-
+- handle := memoize.NewPromise("modTidy", func(ctx context.Context, arg interface{}) interface{} {
+- tidied, err := modTidyImpl(ctx, arg.(*snapshot), uri.Filename(), pm)
+- return modTidyResult{tidied, err}
+- })
+-
+- entry = handle
+- s.mu.Lock()
+- s.modTidyHandles.Set(uri, entry, nil)
+- s.mu.Unlock()
+- }
+-
+- // Await result.
+- v, err := s.awaitPromise(ctx, entry.(*memoize.Promise))
+- if err != nil {
+- return nil, err
+- }
+- res := v.(modTidyResult)
+- return res.tidied, res.err
+-}
+-
+-// modTidyImpl runs "go mod tidy" on a go.mod file.
+-func modTidyImpl(ctx context.Context, snapshot *snapshot, filename string, pm *source.ParsedModule) (*source.TidiedModule, error) {
+- ctx, done := event.Start(ctx, "cache.ModTidy", tag.URI.Of(filename))
+- defer done()
+-
+- inv := &gocommand.Invocation{
+- Verb: "mod",
+- Args: []string{"tidy"},
+- WorkingDir: filepath.Dir(filename),
+- }
+- // TODO(adonovan): ensure that unsaved overlays are passed through to 'go'.
+- tmpURI, inv, cleanup, err := snapshot.goCommandInvocation(ctx, source.WriteTemporaryModFile, inv)
+- if err != nil {
+- return nil, err
+- }
+- // Keep the temporary go.mod file around long enough to parse it.
+- defer cleanup()
+-
+- if _, err := snapshot.view.gocmdRunner.Run(ctx, *inv); err != nil {
+- return nil, err
+- }
+-
+- // Go directly to disk to get the temporary mod file,
+- // since it is always on disk.
+- tempContents, err := ioutil.ReadFile(tmpURI.Filename())
+- if err != nil {
+- return nil, err
+- }
+- ideal, err := modfile.Parse(tmpURI.Filename(), tempContents, nil)
+- if err != nil {
+- // We do not need to worry about the temporary file's parse errors
+- // since it has been "tidied".
+- return nil, err
+- }
+-
+- // Compare the original and tidied go.mod files to compute errors and
+- // suggested fixes.
+- diagnostics, err := modTidyDiagnostics(ctx, snapshot, pm, ideal)
+- if err != nil {
+- return nil, err
+- }
+-
+- return &source.TidiedModule{
+- Diagnostics: diagnostics,
+- TidiedContent: tempContents,
+- }, nil
+-}
+-
+-// modTidyDiagnostics computes the differences between the original and tidied
+-// go.mod files to produce diagnostic and suggested fixes. Some diagnostics
+-// may appear on the Go files that import packages from missing modules.
+-func modTidyDiagnostics(ctx context.Context, snapshot *snapshot, pm *source.ParsedModule, ideal *modfile.File) (diagnostics []*source.Diagnostic, err error) {
+- // First, determine which modules are unused and which are missing from the
+- // original go.mod file.
+- var (
+- unused = make(map[string]*modfile.Require, len(pm.File.Require))
+- missing = make(map[string]*modfile.Require, len(ideal.Require))
+- wrongDirectness = make(map[string]*modfile.Require, len(pm.File.Require))
+- )
+- for _, req := range pm.File.Require {
+- unused[req.Mod.Path] = req
+- }
+- for _, req := range ideal.Require {
+- origReq := unused[req.Mod.Path]
+- if origReq == nil {
+- missing[req.Mod.Path] = req
+- continue
+- } else if origReq.Indirect != req.Indirect {
+- wrongDirectness[req.Mod.Path] = origReq
+- }
+- delete(unused, req.Mod.Path)
+- }
+- for _, req := range wrongDirectness {
+- // Handle dependencies that are incorrectly labeled indirect and
+- // vice versa.
+- srcDiag, err := directnessDiagnostic(pm.Mapper, req, snapshot.View().Options().ComputeEdits)
+- if err != nil {
+- // We're probably in a bad state if we can't compute a
+- // directnessDiagnostic, but try to keep going so as to not suppress
+- // other, valid diagnostics.
+- event.Error(ctx, "computing directness diagnostic", err)
+- continue
+- }
+- diagnostics = append(diagnostics, srcDiag)
+- }
+- // Next, compute any diagnostics for modules that are missing from the
+- // go.mod file. The fixes will be for the go.mod file, but the
+- // diagnostics should also appear in both the go.mod file and the import
+- // statements in the Go files in which the dependencies are used.
+- missingModuleFixes := map[*modfile.Require][]source.SuggestedFix{}
+- for _, req := range missing {
+- srcDiag, err := missingModuleDiagnostic(pm, req)
+- if err != nil {
+- return nil, err
+- }
+- missingModuleFixes[req] = srcDiag.SuggestedFixes
+- diagnostics = append(diagnostics, srcDiag)
+- }
+- // Add diagnostics for missing modules anywhere they are imported in the
+- // workspace.
+- // TODO(adonovan): opt: opportunities for parallelism abound.
+- for _, m := range snapshot.workspaceMetadata() {
+- // Read both lists of files of this package, in parallel.
+- goFiles, compiledGoFiles, err := readGoFiles(ctx, snapshot, m)
+- if err != nil {
+- return nil, err
+- }
+-
+- missingImports := map[string]*modfile.Require{}
+-
+- // If -mod=readonly is not set we may have successfully imported
+- // packages from missing modules. Otherwise they'll be in
+- // MissingDependencies. Combine both.
+- imps, err := parseImports(ctx, snapshot, goFiles)
+- if err != nil {
+- return nil, err
+- }
+- for imp := range imps {
+- if req, ok := missing[imp]; ok {
+- missingImports[imp] = req
+- break
+- }
+- // If the import is a package of the dependency, then add the
+- // package to the map, this will eliminate the need to do this
+- // prefix package search on each import for each file.
+- // Example:
+- //
+- // import (
+- // "golang.org/x/tools/go/expect"
+- // "golang.org/x/tools/go/packages"
+- // )
+- // They both are related to the same module: "golang.org/x/tools".
+- var match string
+- for _, req := range ideal.Require {
+- if strings.HasPrefix(imp, req.Mod.Path) && len(req.Mod.Path) > len(match) {
+- match = req.Mod.Path
+- }
+- }
+- if req, ok := missing[match]; ok {
+- missingImports[imp] = req
+- }
+- }
+- // None of this package's imports are from missing modules.
+- if len(missingImports) == 0 {
+- continue
+- }
+- for _, goFile := range compiledGoFiles {
+- pgf, err := snapshot.ParseGo(ctx, goFile, source.ParseHeader)
+- if err != nil {
+- continue
+- }
+- file, m := pgf.File, pgf.Mapper
+- if file == nil || m == nil {
+- continue
+- }
+- imports := make(map[string]*ast.ImportSpec)
+- for _, imp := range file.Imports {
+- if imp.Path == nil {
+- continue
+- }
+- if target, err := strconv.Unquote(imp.Path.Value); err == nil {
+- imports[target] = imp
+- }
+- }
+- if len(imports) == 0 {
+- continue
+- }
+- for importPath, req := range missingImports {
+- imp, ok := imports[importPath]
+- if !ok {
+- continue
+- }
+- fixes, ok := missingModuleFixes[req]
+- if !ok {
+- return nil, fmt.Errorf("no missing module fix for %q (%q)", importPath, req.Mod.Path)
+- }
+- srcErr, err := missingModuleForImport(pgf, imp, req, fixes)
+- if err != nil {
+- return nil, err
+- }
+- diagnostics = append(diagnostics, srcErr)
+- }
+- }
+- }
+- // Finally, add errors for any unused dependencies.
+- onlyDiagnostic := len(diagnostics) == 0 && len(unused) == 1
+- for _, req := range unused {
+- srcErr, err := unusedDiagnostic(pm.Mapper, req, onlyDiagnostic)
+- if err != nil {
+- return nil, err
+- }
+- diagnostics = append(diagnostics, srcErr)
+- }
+- return diagnostics, nil
+-}
+-
+-// unusedDiagnostic returns a source.Diagnostic for an unused require.
+-func unusedDiagnostic(m *protocol.Mapper, req *modfile.Require, onlyDiagnostic bool) (*source.Diagnostic, error) {
+- rng, err := m.OffsetRange(req.Syntax.Start.Byte, req.Syntax.End.Byte)
+- if err != nil {
+- return nil, err
+- }
+- title := fmt.Sprintf("Remove dependency: %s", req.Mod.Path)
+- cmd, err := command.NewRemoveDependencyCommand(title, command.RemoveDependencyArgs{
+- URI: protocol.URIFromSpanURI(m.URI),
+- OnlyDiagnostic: onlyDiagnostic,
+- ModulePath: req.Mod.Path,
+- })
+- if err != nil {
+- return nil, err
+- }
+- return &source.Diagnostic{
+- URI: m.URI,
+- Range: rng,
+- Severity: protocol.SeverityWarning,
+- Source: source.ModTidyError,
+- Message: fmt.Sprintf("%s is not used in this module", req.Mod.Path),
+- SuggestedFixes: []source.SuggestedFix{source.SuggestedFixFromCommand(cmd, protocol.QuickFix)},
+- }, nil
+-}
+-
+-// directnessDiagnostic extracts errors when a dependency is labeled indirect when
+-// it should be direct and vice versa.
+-func directnessDiagnostic(m *protocol.Mapper, req *modfile.Require, computeEdits source.DiffFunction) (*source.Diagnostic, error) {
+- rng, err := m.OffsetRange(req.Syntax.Start.Byte, req.Syntax.End.Byte)
+- if err != nil {
+- return nil, err
+- }
+- direction := "indirect"
+- if req.Indirect {
+- direction = "direct"
+-
+- // If the dependency should be direct, just highlight the // indirect.
+- if comments := req.Syntax.Comment(); comments != nil && len(comments.Suffix) > 0 {
+- end := comments.Suffix[0].Start
+- end.LineRune += len(comments.Suffix[0].Token)
+- end.Byte += len(comments.Suffix[0].Token)
+- rng, err = m.OffsetRange(comments.Suffix[0].Start.Byte, end.Byte)
+- if err != nil {
+- return nil, err
+- }
+- }
+- }
+- // If the dependency should be indirect, add the // indirect.
+- edits, err := switchDirectness(req, m, computeEdits)
+- if err != nil {
+- return nil, err
+- }
+- return &source.Diagnostic{
+- URI: m.URI,
+- Range: rng,
+- Severity: protocol.SeverityWarning,
+- Source: source.ModTidyError,
+- Message: fmt.Sprintf("%s should be %s", req.Mod.Path, direction),
+- SuggestedFixes: []source.SuggestedFix{{
+- Title: fmt.Sprintf("Change %s to %s", req.Mod.Path, direction),
+- Edits: map[span.URI][]protocol.TextEdit{
+- m.URI: edits,
+- },
+- ActionKind: protocol.QuickFix,
+- }},
+- }, nil
+-}
+-
+-func missingModuleDiagnostic(pm *source.ParsedModule, req *modfile.Require) (*source.Diagnostic, error) {
+- var rng protocol.Range
+- // Default to the start of the file if there is no module declaration.
+- if pm.File != nil && pm.File.Module != nil && pm.File.Module.Syntax != nil {
+- start, end := pm.File.Module.Syntax.Span()
+- var err error
+- rng, err = pm.Mapper.OffsetRange(start.Byte, end.Byte)
+- if err != nil {
+- return nil, err
+- }
+- }
+- title := fmt.Sprintf("Add %s to your go.mod file", req.Mod.Path)
+- cmd, err := command.NewAddDependencyCommand(title, command.DependencyArgs{
+- URI: protocol.URIFromSpanURI(pm.Mapper.URI),
+- AddRequire: !req.Indirect,
+- GoCmdArgs: []string{req.Mod.Path + "@" + req.Mod.Version},
+- })
+- if err != nil {
+- return nil, err
+- }
+- return &source.Diagnostic{
+- URI: pm.Mapper.URI,
+- Range: rng,
+- Severity: protocol.SeverityError,
+- Source: source.ModTidyError,
+- Message: fmt.Sprintf("%s is not in your go.mod file", req.Mod.Path),
+- SuggestedFixes: []source.SuggestedFix{source.SuggestedFixFromCommand(cmd, protocol.QuickFix)},
+- }, nil
+-}
+-
+-// switchDirectness gets the edits needed to change an indirect dependency to
+-// direct and vice versa.
+-func switchDirectness(req *modfile.Require, m *protocol.Mapper, computeEdits source.DiffFunction) ([]protocol.TextEdit, error) {
+- // We need a private copy of the parsed go.mod file, since we're going to
+- // modify it.
+- copied, err := modfile.Parse("", m.Content, nil)
+- if err != nil {
+- return nil, err
+- }
+- // Change the directness in the matching require statement. To avoid
+- // reordering the require statements, rewrite all of them.
+- var requires []*modfile.Require
+- seenVersions := make(map[string]string)
+- for _, r := range copied.Require {
+- if seen := seenVersions[r.Mod.Path]; seen != "" && seen != r.Mod.Version {
+- // Avoid a panic in SetRequire below, which panics on conflicting
+- // versions.
+- return nil, fmt.Errorf("%q has conflicting versions: %q and %q", r.Mod.Path, seen, r.Mod.Version)
+- }
+- seenVersions[r.Mod.Path] = r.Mod.Version
+- if r.Mod.Path == req.Mod.Path {
+- requires = append(requires, &modfile.Require{
+- Mod: r.Mod,
+- Syntax: r.Syntax,
+- Indirect: !r.Indirect,
+- })
+- continue
+- }
+- requires = append(requires, r)
+- }
+- copied.SetRequire(requires)
+- newContent, err := copied.Format()
+- if err != nil {
+- return nil, err
+- }
+- // Calculate the edits to be made due to the change.
+- edits := computeEdits(string(m.Content), string(newContent))
+- return source.ToProtocolEdits(m, edits)
+-}
+-
+-// missingModuleForImport creates an error for a given import path that comes
+-// from a missing module.
+-func missingModuleForImport(pgf *source.ParsedGoFile, imp *ast.ImportSpec, req *modfile.Require, fixes []source.SuggestedFix) (*source.Diagnostic, error) {
+- if req.Syntax == nil {
+- return nil, fmt.Errorf("no syntax for %v", req)
+- }
+- rng, err := pgf.NodeRange(imp.Path)
+- if err != nil {
+- return nil, err
+- }
+- return &source.Diagnostic{
+- URI: pgf.URI,
+- Range: rng,
+- Severity: protocol.SeverityError,
+- Source: source.ModTidyError,
+- Message: fmt.Sprintf("%s is not in your go.mod file", req.Mod.Path),
+- SuggestedFixes: fixes,
+- }, nil
+-}
+-
+-// parseImports parses the headers of the specified files and returns
+-// the set of strings that appear in import declarations within
+-// GoFiles. Errors are ignored.
+-//
+-// (We can't simply use Metadata.Imports because it is based on
+-// CompiledGoFiles, after cgo processing.)
+-//
+-// TODO(rfindley): this should key off source.ImportPath.
+-func parseImports(ctx context.Context, s *snapshot, files []source.FileHandle) (map[string]bool, error) {
+- pgfs, _, err := s.parseCache.parseFiles(ctx, source.ParseHeader, files...)
+- if err != nil { // e.g. context cancellation
+- return nil, err
+- }
+-
+- seen := make(map[string]bool)
+- for _, pgf := range pgfs {
+- for _, spec := range pgf.File.Imports {
+- path, _ := strconv.Unquote(spec.Path.Value)
+- seen[path] = true
+- }
+- }
+- return seen, nil
+-}
+diff -urN a/gopls/internal/lsp/cache/mod_vuln.go b/gopls/internal/lsp/cache/mod_vuln.go
+--- a/gopls/internal/lsp/cache/mod_vuln.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/mod_vuln.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,75 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "context"
+- "os"
+-
+- "golang.org/x/tools/gopls/internal/govulncheck"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/gopls/internal/vulncheck"
+- "golang.org/x/tools/internal/memoize"
+-)
+-
+-// ModVuln returns import vulnerability analysis for the given go.mod URI.
+-// Concurrent requests are combined into a single command.
+-func (s *snapshot) ModVuln(ctx context.Context, modURI span.URI) (*govulncheck.Result, error) {
+- s.mu.Lock()
+- entry, hit := s.modVulnHandles.Get(modURI)
+- s.mu.Unlock()
+-
+- type modVuln struct {
+- result *govulncheck.Result
+- err error
+- }
+-
+- // Cache miss?
+- if !hit {
+- // If the file handle is an overlay, it may not be written to disk.
+- // The go.mod file has to be on disk for vulncheck to work.
+- //
+- // TODO(hyangah): use overlays for vulncheck.
+- fh, err := s.GetFile(ctx, modURI)
+- if err != nil {
+- return nil, err
+- }
+- if _, ok := fh.(*Overlay); ok {
+- if info, _ := os.Stat(modURI.Filename()); info == nil {
+- return nil, source.ErrNoModOnDisk
+- }
+- }
+-
+- handle := memoize.NewPromise("modVuln", func(ctx context.Context, arg interface{}) interface{} {
+- result, err := modVulnImpl(ctx, arg.(*snapshot), modURI)
+- return modVuln{result, err}
+- })
+-
+- entry = handle
+- s.mu.Lock()
+- s.modVulnHandles.Set(modURI, entry, nil)
+- s.mu.Unlock()
+- }
+-
+- // Await result.
+- v, err := s.awaitPromise(ctx, entry.(*memoize.Promise))
+- if err != nil {
+- return nil, err
+- }
+- res := v.(modVuln)
+- return res.result, res.err
+-}
+-
+-func modVulnImpl(ctx context.Context, s *snapshot, uri span.URI) (*govulncheck.Result, error) {
+- if vulncheck.VulnerablePackages == nil {
+- return &govulncheck.Result{}, nil
+- }
+- fh, err := s.GetFile(ctx, uri)
+- if err != nil {
+- return nil, err
+- }
+- return vulncheck.VulnerablePackages(ctx, s, fh)
+-}
+diff -urN a/gopls/internal/lsp/cache/os_darwin.go b/gopls/internal/lsp/cache/os_darwin.go
+--- a/gopls/internal/lsp/cache/os_darwin.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/os_darwin.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,59 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "bytes"
+- "fmt"
+- "os"
+- "path/filepath"
+- "strings"
+- "syscall"
+- "unsafe"
+-)
+-
+-func init() {
+- checkPathCase = darwinCheckPathCase
+-}
+-
+-func darwinCheckPathCase(path string) error {
+- // Darwin provides fcntl(F_GETPATH) to get a path for an arbitrary FD.
+- // Conveniently for our purposes, it gives the canonical case back. But
+- // there's no guarantee that it will follow the same route through the
+- // filesystem that the original path did.
+-
+- path, err := filepath.Abs(path)
+- if err != nil {
+- return err
+- }
+- fd, err := syscall.Open(path, os.O_RDONLY, 0)
+- if err != nil {
+- return err
+- }
+- defer syscall.Close(fd)
+- buf := make([]byte, 4096) // No MAXPATHLEN in syscall, I think it's 1024, this is bigger.
+-
+- // Wheeee! syscall doesn't expose a way to call Fcntl except FcntlFlock.
+- // As of writing, it just passes the pointer through, so we can just lie.
+- if err := syscall.FcntlFlock(uintptr(fd), syscall.F_GETPATH, (*syscall.Flock_t)(unsafe.Pointer(&buf[0]))); err != nil {
+- return err
+- }
+- buf = buf[:bytes.IndexByte(buf, 0)]
+-
+- isRoot := func(p string) bool {
+- return p[len(p)-1] == filepath.Separator
+- }
+- // Darwin seems to like having multiple names for the same folder. Match as much of the suffix as we can.
+- for got, want := path, string(buf); !isRoot(got) && !isRoot(want); got, want = filepath.Dir(got), filepath.Dir(want) {
+- g, w := filepath.Base(got), filepath.Base(want)
+- if !strings.EqualFold(g, w) {
+- break
+- }
+- if g != w {
+- return fmt.Errorf("case mismatch in path %q: component %q is listed by macOS as %q", path, g, w)
+- }
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cache/os_windows.go b/gopls/internal/lsp/cache/os_windows.go
+--- a/gopls/internal/lsp/cache/os_windows.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/os_windows.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,56 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "fmt"
+- "path/filepath"
+- "syscall"
+-)
+-
+-func init() {
+- checkPathCase = windowsCheckPathCase
+-}
+-
+-func windowsCheckPathCase(path string) error {
+- // Back in the day, Windows used to have short and long filenames, and
+- // it still supports those APIs. GetLongPathName gets the real case for a
+- // path, so we can use it here. Inspired by
+- // http://stackoverflow.com/q/2113822.
+-
+- // Short paths can be longer than long paths, and unicode, so be generous.
+- buflen := 4 * len(path)
+- namep, err := syscall.UTF16PtrFromString(path)
+- if err != nil {
+- return err
+- }
+- short := make([]uint16, buflen)
+- n, err := syscall.GetShortPathName(namep, &short[0], uint32(len(short)*2)) // buflen is in bytes.
+- if err != nil {
+- return err
+- }
+- if int(n) > len(short)*2 {
+- return fmt.Errorf("short buffer too short: %v vs %v*2", n, len(short))
+- }
+- long := make([]uint16, buflen)
+- n, err = syscall.GetLongPathName(&short[0], &long[0], uint32(len(long)*2))
+- if err != nil {
+- return err
+- }
+- if int(n) > len(long)*2 {
+- return fmt.Errorf("long buffer too short: %v vs %v*2", n, len(long))
+- }
+- longstr := syscall.UTF16ToString(long)
+-
+- isRoot := func(p string) bool {
+- return p[len(p)-1] == filepath.Separator
+- }
+- for got, want := path, longstr; !isRoot(got) && !isRoot(want); got, want = filepath.Dir(got), filepath.Dir(want) {
+- if g, w := filepath.Base(got), filepath.Base(want); g != w {
+- return fmt.Errorf("case mismatch in path %q: component %q is listed by Windows as %q", path, g, w)
+- }
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cache/parse_cache.go b/gopls/internal/lsp/cache/parse_cache.go
+--- a/gopls/internal/lsp/cache/parse_cache.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/parse_cache.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,298 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "container/heap"
+- "context"
+- "go/token"
+- "runtime"
+- "sort"
+- "sync"
+-
+- "golang.org/x/sync/errgroup"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/memoize"
+-)
+-
+-// This file contains an implementation of a bounded-size parse cache, that
+-// offsets the base token.Pos value of each cached file so that they may be
+-// later described by a single dedicated FileSet.
+-//
+-// This is achieved by tracking a monotonic offset in the token.Pos space, that
+-// is incremented before parsing allow room for the resulting parsed file.
+-
+-// Keep 200 recently parsed files, based on the following rationale:
+-// - One of the most important benefits of caching is avoiding re-parsing
+-// everything in a package when working on a single file. No packages in
+-// Kubernetes have > 200 files (only one has > 100).
+-// - Experience has shown that ~1000 parsed files can use noticeable space.
+-// 200 feels like a sweet spot between limiting cache size and optimizing
+-// cache hits for low-latency operations.
+-const parseCacheMaxFiles = 200
+-
+-// parsePadding is additional padding allocated between entries in the parse
+-// cache to allow for increases in length (such as appending missing braces)
+-// caused by fixAST.
+-//
+-// This is used to mitigate a chicken and egg problem: we must know the base
+-// offset of the file we're about to parse, before we start parsing, and yet
+-// src fixups may affect the actual size of the parsed content (and therefore
+-// the offsets of subsequent files).
+-//
+-// When we encounter a file that no longer fits in its allocated space in the
+-// fileset, we have no choice but to re-parse it. Leaving a generous padding
+-// reduces the likelihood of this "slow path".
+-//
+-// This value is mutable for testing, so that we can exercise the slow path.
+-var parsePadding = 1000 // mutable for testing
+-
+-// A parseCache holds a bounded number of recently accessed parsed Go files. As
+-// new files are stored, older files may be evicted from the cache.
+-//
+-// The parseCache.parseFiles method exposes a batch API for parsing (and
+-// caching) multiple files. This is necessary for type-checking, where files
+-// must be parsed in a common fileset.
+-type parseCache struct {
+- mu sync.Mutex
+- m map[parseKey]*parseCacheEntry
+- lru queue // min-atime priority queue of *parseCacheEntry
+- clock uint64 // clock time, incremented when the cache is updated
+- nextOffset token.Pos // token.Pos offset for the next parsed file
+-}
+-
+-// parseKey uniquely identifies a parsed Go file.
+-type parseKey struct {
+- file source.FileIdentity
+- mode source.ParseMode
+-}
+-
+-type parseCacheEntry struct {
+- key parseKey
+- promise *memoize.Promise // memoize.Promise[*source.ParsedGoFile]
+- atime uint64 // clock time of last access
+- lruIndex int
+-}
+-
+-// startParse prepares a parsing pass, using the following steps:
+-// - search for cache hits
+-// - create new promises for cache misses
+-// - store as many new promises in the cache as space will allow
+-//
+-// The resulting slice has an entry for every given file handle, though some
+-// entries may be nil if there was an error reading the file (in which case the
+-// resulting error will be non-nil).
+-func (c *parseCache) startParse(mode source.ParseMode, fhs ...source.FileHandle) ([]*memoize.Promise, error) {
+- c.mu.Lock()
+- defer c.mu.Unlock()
+-
+- // Any parsing pass increments the clock, as we'll update access times.
+- // (technically, if fhs is empty this isn't necessary, but that's a degenerate case).
+- //
+- // All entries parsed from a single call get the same access time.
+- c.clock++
+-
+- // Read file data and collect cacheable files.
+- var (
+- data = make([][]byte, len(fhs)) // file content for each readable file
+- promises = make([]*memoize.Promise, len(fhs))
+- firstReadError error // first error from fh.Read, or nil
+- )
+- for i, fh := range fhs {
+- src, err := fh.Read()
+- if err != nil {
+- if firstReadError == nil {
+- firstReadError = err
+- }
+- continue
+- }
+- data[i] = src
+-
+- key := parseKey{
+- file: fh.FileIdentity(),
+- mode: mode,
+- }
+-
+- // Check for a cache hit.
+- if e, ok := c.m[key]; ok {
+- e.atime = c.clock
+- heap.Fix(&c.lru, e.lruIndex)
+- promises[i] = e.promise
+- continue
+- }
+-
+- // ...otherwise, create a new promise to parse with a non-overlapping offset
+- fset := token.NewFileSet()
+- if c.nextOffset > 0 {
+- // Add a dummy file so that this parsed file does not overlap with others.
+- fset.AddFile("", 1, int(c.nextOffset))
+- }
+- c.nextOffset += token.Pos(len(src) + parsePadding + 1) // leave room for src fixes
+- fh := fh
+- promise := memoize.NewPromise(string(fh.URI()), func(ctx context.Context, _ interface{}) interface{} {
+- return parseGoSrc(ctx, fset, fh.URI(), src, mode)
+- })
+- promises[i] = promise
+-
+- var e *parseCacheEntry
+- if len(c.lru) < parseCacheMaxFiles {
+- // add new entry
+- e = new(parseCacheEntry)
+- if c.m == nil {
+- c.m = make(map[parseKey]*parseCacheEntry)
+- }
+- } else {
+- // evict oldest entry
+- e = heap.Pop(&c.lru).(*parseCacheEntry)
+- delete(c.m, e.key)
+- }
+- e.key = key
+- e.promise = promise
+- e.atime = c.clock
+- c.m[e.key] = e
+- heap.Push(&c.lru, e)
+- }
+-
+- if len(c.m) != len(c.lru) {
+- panic("map and LRU are inconsistent")
+- }
+-
+- return promises, firstReadError
+-}
+-
+-// parseFiles returns a ParsedGoFile for the given file handles in the
+-// requested parse mode.
+-//
+-// If parseFiles returns an error, it still returns a slice,
+-// but with a nil entry for each file that could not be parsed.
+-//
+-// The second result is a FileSet describing all resulting parsed files.
+-//
+-// For parsed files that already exists in the cache, access time will be
+-// updated. For others, parseFiles will parse and store as many results in the
+-// cache as space allows.
+-func (c *parseCache) parseFiles(ctx context.Context, mode source.ParseMode, fhs ...source.FileHandle) ([]*source.ParsedGoFile, *token.FileSet, error) {
+- promises, firstReadError := c.startParse(mode, fhs...)
+-
+- // Await all parsing.
+- var g errgroup.Group
+- g.SetLimit(runtime.GOMAXPROCS(-1)) // parsing is CPU-bound.
+- pgfs := make([]*source.ParsedGoFile, len(fhs))
+- for i, promise := range promises {
+- if promise == nil {
+- continue
+- }
+- i := i
+- promise := promise
+- g.Go(func() error {
+- result, err := promise.Get(ctx, nil)
+- if err != nil {
+- return err
+- }
+- pgfs[i] = result.(*source.ParsedGoFile)
+- return nil
+- })
+- }
+- if err := g.Wait(); err != nil {
+- return nil, nil, err
+- }
+-
+- // Construct a token.FileSet mapping all parsed files, and update their
+- // Tok to the corresponding file in the new fileset.
+- //
+- // In the unlikely event that a parsed file no longer fits in its allocated
+- // space in the FileSet range, it will need to be re-parsed.
+-
+- var tokenFiles []*token.File
+- fileIndex := make(map[*token.File]int) // to look up original indexes after sorting
+- for i, pgf := range pgfs {
+- if pgf == nil {
+- continue
+- }
+- fileIndex[pgf.Tok] = i
+- tokenFiles = append(tokenFiles, pgf.Tok)
+- }
+-
+- sort.Slice(tokenFiles, func(i, j int) bool {
+- return tokenFiles[i].Base() < tokenFiles[j].Base()
+- })
+-
+- var needReparse []int // files requiring reparsing
+- out := tokenFiles[:0]
+- for i, f := range tokenFiles {
+- if i < len(tokenFiles)-1 && f.Base()+f.Size() >= tokenFiles[i+1].Base() {
+- if f != tokenFiles[i+1] { // no need to re-parse duplicates
+- needReparse = append(needReparse, fileIndex[f])
+- }
+- } else {
+- out = append(out, f)
+- }
+- }
+- fset := source.FileSetFor(out...)
+-
+- // Re-parse any remaining files using the stitched fileSet.
+- for _, i := range needReparse {
+- // Start from scratch, rather than using ParsedGoFile.Src, so that source
+- // fixing operates exactly the same (note that fixing stops after a limited
+- // number of tries).
+- fh := fhs[i]
+- src, err := fh.Read()
+- if err != nil {
+- if firstReadError == nil {
+- firstReadError = err
+- }
+- continue
+- }
+- pgfs[i] = parseGoSrc(ctx, fset, fh.URI(), src, mode)
+- }
+-
+- // Ensure each PGF refers to a token.File from the new FileSet.
+- for i, pgf := range pgfs {
+- if pgf == nil {
+- continue
+- }
+- newTok := fset.File(token.Pos(pgf.Tok.Base()))
+- if newTok == nil {
+- panic("internal error: missing tok for " + pgf.URI)
+- }
+- if newTok.Base() != pgf.Tok.Base() || newTok.Size() != pgf.Tok.Size() {
+- panic("internal error: mismatching token.File in synthetic FileSet")
+- }
+- pgf2 := *pgf
+- pgf2.Tok = newTok
+- pgfs[i] = &pgf2
+- }
+-
+- return pgfs, fset, firstReadError
+-}
+-
+-// -- priority queue boilerplate --
+-
+-// queue is a min-atime prority queue of cache entries.
+-type queue []*parseCacheEntry
+-
+-func (q queue) Len() int { return len(q) }
+-
+-func (q queue) Less(i, j int) bool { return q[i].atime < q[j].atime }
+-
+-func (q queue) Swap(i, j int) {
+- q[i], q[j] = q[j], q[i]
+- q[i].lruIndex = i
+- q[j].lruIndex = j
+-}
+-
+-func (q *queue) Push(x interface{}) {
+- e := x.(*parseCacheEntry)
+- e.lruIndex = len(*q)
+- *q = append(*q, e)
+-}
+-
+-func (q *queue) Pop() interface{} {
+- last := len(*q) - 1
+- e := (*q)[last]
+- (*q)[last] = nil // aid GC
+- *q = (*q)[:last]
+- return e
+-}
+diff -urN a/gopls/internal/lsp/cache/parse_cache_test.go b/gopls/internal/lsp/cache/parse_cache_test.go
+--- a/gopls/internal/lsp/cache/parse_cache_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/parse_cache_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,142 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "context"
+- "fmt"
+- "go/token"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-func TestParseCache(t *testing.T) {
+- ctx := context.Background()
+- uri := span.URI("file:///myfile")
+- fh := makeFakeFileHandle(uri, []byte("package p\n\nconst _ = \"foo\""))
+-
+- var cache parseCache
+- pgfs1, _, err := cache.parseFiles(ctx, source.ParseFull, fh)
+- if err != nil {
+- t.Fatal(err)
+- }
+- pgf1 := pgfs1[0]
+- pgfs2, _, err := cache.parseFiles(ctx, source.ParseFull, fh)
+- pgf2 := pgfs2[0]
+- if err != nil {
+- t.Fatal(err)
+- }
+- if pgf1.File != pgf2.File {
+- t.Errorf("parseFiles(%q): unexpected cache miss on repeated call", uri)
+- }
+-
+- // Fill up the cache with other files, but don't evict the file above.
+- files := []source.FileHandle{fh}
+- files = append(files, dummyFileHandles(parseCacheMaxFiles-1)...)
+- pgfs3, fset, err := cache.parseFiles(ctx, source.ParseFull, files...)
+- pgf3 := pgfs3[0]
+- if pgf3.File != pgf1.File {
+- t.Errorf("parseFiles(%q, ...): unexpected cache miss", uri)
+- }
+- if pgf3.Tok == pgf1.Tok {
+- t.Errorf("parseFiles(%q, ...): unexpectedly matching token file", uri)
+- }
+- if pgf3.Tok.Base() != pgf1.Tok.Base() || pgf3.Tok.Size() != pgf1.Tok.Size() {
+- t.Errorf("parseFiles(%q, ...): result.Tok has base: %d, size: %d, want (%d, %d)", uri, pgf3.Tok.Base(), pgf3.Tok.Size(), pgf1.Tok.Base(), pgf1.Tok.Size())
+- }
+- if tok := fset.File(token.Pos(pgf3.Tok.Base())); tok != pgf3.Tok {
+- t.Errorf("parseFiles(%q, ...): result.Tok not contained in FileSet", uri)
+- }
+-
+- // Now overwrite the cache, after which we should get new results.
+- files = dummyFileHandles(parseCacheMaxFiles)
+- _, _, err = cache.parseFiles(ctx, source.ParseFull, files...)
+- if err != nil {
+- t.Fatal(err)
+- }
+- pgfs4, _, err := cache.parseFiles(ctx, source.ParseFull, fh)
+- if err != nil {
+- t.Fatal(err)
+- }
+- if pgfs4[0].File == pgf1.File {
+- t.Errorf("parseFiles(%q): unexpected cache hit after overwriting cache", uri)
+- }
+-}
+-
+-func TestParseCache_Reparsing(t *testing.T) {
+- defer func(padding int) {
+- parsePadding = padding
+- }(parsePadding)
+- parsePadding = 0
+-
+- files := dummyFileHandles(parseCacheMaxFiles)
+- danglingSelector := []byte("package p\nfunc _() {\n\tx.\n}")
+- files = append(files, makeFakeFileHandle("file:///bad1", danglingSelector))
+- files = append(files, makeFakeFileHandle("file:///bad2", danglingSelector))
+-
+- // Parsing should succeed even though we overflow the padding.
+- var cache parseCache
+- _, _, err := cache.parseFiles(context.Background(), source.ParseFull, files...)
+- if err != nil {
+- t.Fatal(err)
+- }
+-}
+-
+-func TestParseCache_Duplicates(t *testing.T) {
+- ctx := context.Background()
+- uri := span.URI("file:///myfile")
+- fh := makeFakeFileHandle(uri, []byte("package p\n\nconst _ = \"foo\""))
+-
+- var cache parseCache
+- pgfs, _, err := cache.parseFiles(ctx, source.ParseFull, fh, fh)
+- if err != nil {
+- t.Fatal(err)
+- }
+- if pgfs[0].File != pgfs[1].File {
+- t.Errorf("parseFiles(fh, fh): = [%p, %p], want duplicate files", pgfs[0].File, pgfs[1].File)
+- }
+-}
+-
+-func dummyFileHandles(n int) []source.FileHandle {
+- var fhs []source.FileHandle
+- for i := 0; i < n; i++ {
+- uri := span.URI(fmt.Sprintf("file:///_%d", i))
+- src := []byte(fmt.Sprintf("package p\nvar _ = %d", i))
+- fhs = append(fhs, makeFakeFileHandle(uri, src))
+- }
+- return fhs
+-}
+-
+-func makeFakeFileHandle(uri span.URI, src []byte) fakeFileHandle {
+- return fakeFileHandle{
+- uri: uri,
+- data: src,
+- hash: source.HashOf(src),
+- }
+-}
+-
+-type fakeFileHandle struct {
+- source.FileHandle
+- uri span.URI
+- data []byte
+- hash source.Hash
+-}
+-
+-func (h fakeFileHandle) URI() span.URI {
+- return h.uri
+-}
+-
+-func (h fakeFileHandle) Read() ([]byte, error) {
+- return h.data, nil
+-}
+-
+-func (h fakeFileHandle) FileIdentity() source.FileIdentity {
+- return source.FileIdentity{
+- URI: h.uri,
+- Hash: h.hash,
+- }
+-}
+diff -urN a/gopls/internal/lsp/cache/parse.go b/gopls/internal/lsp/cache/parse.go
+--- a/gopls/internal/lsp/cache/parse.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/parse.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,900 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "bytes"
+- "context"
+- "fmt"
+- "go/ast"
+- "go/parser"
+- "go/scanner"
+- "go/token"
+- "path/filepath"
+- "reflect"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/diff"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+-)
+-
+-// ParseGo parses the file whose contents are provided by fh, using a cache.
+-// The resulting tree may have beeen fixed up.
+-func (s *snapshot) ParseGo(ctx context.Context, fh source.FileHandle, mode source.ParseMode) (*source.ParsedGoFile, error) {
+- pgfs, _, err := s.parseCache.parseFiles(ctx, mode, fh)
+- if err != nil {
+- return nil, err
+- }
+- return pgfs[0], nil
+-}
+-
+-// parseGoImpl parses the Go source file whose content is provided by fh.
+-func parseGoImpl(ctx context.Context, fset *token.FileSet, fh source.FileHandle, mode source.ParseMode) (*source.ParsedGoFile, error) {
+- ctx, done := event.Start(ctx, "cache.parseGo", tag.File.Of(fh.URI().Filename()))
+- defer done()
+-
+- ext := filepath.Ext(fh.URI().Filename())
+- if ext != ".go" && ext != "" { // files generated by cgo have no extension
+- return nil, fmt.Errorf("cannot parse non-Go file %s", fh.URI())
+- }
+- src, err := fh.Read()
+- if err != nil {
+- return nil, err
+- }
+- return parseGoSrc(ctx, fset, fh.URI(), src, mode), nil
+-}
+-
+-// parseGoSrc parses a buffer of Go source, repairing the tree if necessary.
+-func parseGoSrc(ctx context.Context, fset *token.FileSet, uri span.URI, src []byte, mode source.ParseMode) (res *source.ParsedGoFile) {
+- parserMode := parser.AllErrors | parser.ParseComments
+- if mode == source.ParseHeader {
+- parserMode = parser.ImportsOnly | parser.ParseComments
+- }
+-
+- file, err := parser.ParseFile(fset, uri.Filename(), src, parserMode)
+- var parseErr scanner.ErrorList
+- if err != nil {
+- // We passed a byte slice, so the only possible error is a parse error.
+- parseErr = err.(scanner.ErrorList)
+- }
+-
+- tok := fset.File(file.Pos())
+- if tok == nil {
+- // file.Pos is the location of the package declaration (issue #53202). If there was
+- // none, we can't find the token.File that ParseFile created, and we
+- // have no choice but to recreate it.
+- tok = fset.AddFile(uri.Filename(), -1, len(src))
+- tok.SetLinesForContent(src)
+- }
+-
+- fixed := false
+- // If there were parse errors, attempt to fix them up.
+- if parseErr != nil {
+- // Fix any badly parsed parts of the AST.
+- fixed = fixAST(file, tok, src)
+-
+- for i := 0; i < 10; i++ {
+- // Fix certain syntax errors that render the file unparseable.
+- newSrc := fixSrc(file, tok, src)
+- if newSrc == nil {
+- break
+- }
+-
+- // If we thought there was something to fix 10 times in a row,
+- // it is likely we got stuck in a loop somehow. Log out a diff
+- // of the last changes we made to aid in debugging.
+- if i == 9 {
+- unified := diff.Unified("before", "after", string(src), string(newSrc))
+- event.Log(ctx, fmt.Sprintf("fixSrc loop - last diff:\n%v", unified), tag.File.Of(tok.Name()))
+- }
+-
+- newFile, _ := parser.ParseFile(fset, uri.Filename(), newSrc, parserMode)
+- if newFile != nil {
+- // Maintain the original parseError so we don't try formatting the doctored file.
+- file = newFile
+- src = newSrc
+- tok = fset.File(file.Pos())
+-
+- fixed = fixAST(file, tok, src)
+- }
+- }
+- }
+-
+- return &source.ParsedGoFile{
+- URI: uri,
+- Mode: mode,
+- Src: src,
+- Fixed: fixed,
+- File: file,
+- Tok: tok,
+- Mapper: protocol.NewMapper(uri, src),
+- ParseErr: parseErr,
+- }
+-}
+-
+-// fixAST inspects the AST and potentially modifies any *ast.BadStmts so that it can be
+-// type-checked more effectively.
+-//
+-// If fixAST returns true, the resulting AST is considered "fixed", meaning
+-// positions have been mangled, and type checker errors may not make sense.
+-func fixAST(n ast.Node, tok *token.File, src []byte) (fixed bool) {
+- var err error
+- walkASTWithParent(n, func(n, parent ast.Node) bool {
+- switch n := n.(type) {
+- case *ast.BadStmt:
+- if fixed = fixDeferOrGoStmt(n, parent, tok, src); fixed {
+- // Recursively fix in our fixed node.
+- _ = fixAST(parent, tok, src)
+- } else {
+- err = fmt.Errorf("unable to parse defer or go from *ast.BadStmt: %v", err)
+- }
+- return false
+- case *ast.BadExpr:
+- if fixed = fixArrayType(n, parent, tok, src); fixed {
+- // Recursively fix in our fixed node.
+- _ = fixAST(parent, tok, src)
+- return false
+- }
+-
+- // Fix cases where parser interprets if/for/switch "init"
+- // statement as "cond" expression, e.g.:
+- //
+- // // "i := foo" is init statement, not condition.
+- // for i := foo
+- //
+- fixInitStmt(n, parent, tok, src)
+-
+- return false
+- case *ast.SelectorExpr:
+- // Fix cases where a keyword prefix results in a phantom "_" selector, e.g.:
+- //
+- // foo.var<> // want to complete to "foo.variance"
+- //
+- fixPhantomSelector(n, tok, src)
+- return true
+-
+- case *ast.BlockStmt:
+- switch parent.(type) {
+- case *ast.SwitchStmt, *ast.TypeSwitchStmt, *ast.SelectStmt:
+- // Adjust closing curly brace of empty switch/select
+- // statements so we can complete inside them.
+- fixEmptySwitch(n, tok, src)
+- }
+-
+- return true
+- default:
+- return true
+- }
+- })
+- return fixed
+-}
+-
+-// walkASTWithParent walks the AST rooted at n. The semantics are
+-// similar to ast.Inspect except it does not call f(nil).
+-func walkASTWithParent(n ast.Node, f func(n ast.Node, parent ast.Node) bool) {
+- var ancestors []ast.Node
+- ast.Inspect(n, func(n ast.Node) (recurse bool) {
+- defer func() {
+- if recurse {
+- ancestors = append(ancestors, n)
+- }
+- }()
+-
+- if n == nil {
+- ancestors = ancestors[:len(ancestors)-1]
+- return false
+- }
+-
+- var parent ast.Node
+- if len(ancestors) > 0 {
+- parent = ancestors[len(ancestors)-1]
+- }
+-
+- return f(n, parent)
+- })
+-}
+-
+-// fixSrc attempts to modify the file's source code to fix certain
+-// syntax errors that leave the rest of the file unparsed.
+-func fixSrc(f *ast.File, tf *token.File, src []byte) (newSrc []byte) {
+- walkASTWithParent(f, func(n, parent ast.Node) bool {
+- if newSrc != nil {
+- return false
+- }
+-
+- switch n := n.(type) {
+- case *ast.BlockStmt:
+- newSrc = fixMissingCurlies(f, n, parent, tf, src)
+- case *ast.SelectorExpr:
+- newSrc = fixDanglingSelector(n, tf, src)
+- }
+-
+- return newSrc == nil
+- })
+-
+- return newSrc
+-}
+-
+-// fixMissingCurlies adds in curly braces for block statements that
+-// are missing curly braces. For example:
+-//
+-// if foo
+-//
+-// becomes
+-//
+-// if foo {}
+-func fixMissingCurlies(f *ast.File, b *ast.BlockStmt, parent ast.Node, tok *token.File, src []byte) []byte {
+- // If the "{" is already in the source code, there isn't anything to
+- // fix since we aren't missing curlies.
+- if b.Lbrace.IsValid() {
+- braceOffset, err := safetoken.Offset(tok, b.Lbrace)
+- if err != nil {
+- return nil
+- }
+- if braceOffset < len(src) && src[braceOffset] == '{' {
+- return nil
+- }
+- }
+-
+- parentLine := tok.Line(parent.Pos())
+-
+- if parentLine >= tok.LineCount() {
+- // If we are the last line in the file, no need to fix anything.
+- return nil
+- }
+-
+- // Insert curlies at the end of parent's starting line. The parent
+- // is the statement that contains the block, e.g. *ast.IfStmt. The
+- // block's Pos()/End() can't be relied upon because they are based
+- // on the (missing) curly braces. We assume the statement is a
+- // single line for now and try sticking the curly braces at the end.
+- insertPos := tok.LineStart(parentLine+1) - 1
+-
+- // Scootch position backwards until it's not in a comment. For example:
+- //
+- // if foo<> // some amazing comment |
+- // someOtherCode()
+- //
+- // insertPos will be located at "|", so we back it out of the comment.
+- didSomething := true
+- for didSomething {
+- didSomething = false
+- for _, c := range f.Comments {
+- if c.Pos() < insertPos && insertPos <= c.End() {
+- insertPos = c.Pos()
+- didSomething = true
+- }
+- }
+- }
+-
+- // Bail out if line doesn't end in an ident or ".". This is to avoid
+- // cases like below where we end up making things worse by adding
+- // curlies:
+- //
+- // if foo &&
+- // bar<>
+- switch precedingToken(insertPos, tok, src) {
+- case token.IDENT, token.PERIOD:
+- // ok
+- default:
+- return nil
+- }
+-
+- var buf bytes.Buffer
+- buf.Grow(len(src) + 3)
+- offset, err := safetoken.Offset(tok, insertPos)
+- if err != nil {
+- return nil
+- }
+- buf.Write(src[:offset])
+-
+- // Detect if we need to insert a semicolon to fix "for" loop situations like:
+- //
+- // for i := foo(); foo<>
+- //
+- // Just adding curlies is not sufficient to make things parse well.
+- if fs, ok := parent.(*ast.ForStmt); ok {
+- if _, ok := fs.Cond.(*ast.BadExpr); !ok {
+- if xs, ok := fs.Post.(*ast.ExprStmt); ok {
+- if _, ok := xs.X.(*ast.BadExpr); ok {
+- buf.WriteByte(';')
+- }
+- }
+- }
+- }
+-
+- // Insert "{}" at insertPos.
+- buf.WriteByte('{')
+- buf.WriteByte('}')
+- buf.Write(src[offset:])
+- return buf.Bytes()
+-}
+-
+-// fixEmptySwitch moves empty switch/select statements' closing curly
+-// brace down one line. This allows us to properly detect incomplete
+-// "case" and "default" keywords as inside the switch statement. For
+-// example:
+-//
+-// switch {
+-// def<>
+-// }
+-//
+-// gets parsed like:
+-//
+-// switch {
+-// }
+-//
+-// Later we manually pull out the "def" token, but we need to detect
+-// that our "<>" position is inside the switch block. To do that we
+-// move the curly brace so it looks like:
+-//
+-// switch {
+-//
+-// }
+-func fixEmptySwitch(body *ast.BlockStmt, tok *token.File, src []byte) {
+- // We only care about empty switch statements.
+- if len(body.List) > 0 || !body.Rbrace.IsValid() {
+- return
+- }
+-
+- // If the right brace is actually in the source code at the
+- // specified position, don't mess with it.
+- braceOffset, err := safetoken.Offset(tok, body.Rbrace)
+- if err != nil {
+- return
+- }
+- if braceOffset < len(src) && src[braceOffset] == '}' {
+- return
+- }
+-
+- braceLine := tok.Line(body.Rbrace)
+- if braceLine >= tok.LineCount() {
+- // If we are the last line in the file, no need to fix anything.
+- return
+- }
+-
+- // Move the right brace down one line.
+- body.Rbrace = tok.LineStart(braceLine + 1)
+-}
+-
+-// fixDanglingSelector inserts real "_" selector expressions in place
+-// of phantom "_" selectors. For example:
+-//
+-// func _() {
+-// x.<>
+-// }
+-//
+-// var x struct { i int }
+-//
+-// To fix completion at "<>", we insert a real "_" after the "." so the
+-// following declaration of "x" can be parsed and type checked
+-// normally.
+-func fixDanglingSelector(s *ast.SelectorExpr, tf *token.File, src []byte) []byte {
+- if !isPhantomUnderscore(s.Sel, tf, src) {
+- return nil
+- }
+-
+- if !s.X.End().IsValid() {
+- return nil
+- }
+-
+- insertOffset, err := safetoken.Offset(tf, s.X.End())
+- if err != nil {
+- return nil
+- }
+- // Insert directly after the selector's ".".
+- insertOffset++
+- if src[insertOffset-1] != '.' {
+- return nil
+- }
+-
+- var buf bytes.Buffer
+- buf.Grow(len(src) + 1)
+- buf.Write(src[:insertOffset])
+- buf.WriteByte('_')
+- buf.Write(src[insertOffset:])
+- return buf.Bytes()
+-}
+-
+-// fixPhantomSelector tries to fix selector expressions with phantom
+-// "_" selectors. In particular, we check if the selector is a
+-// keyword, and if so we swap in an *ast.Ident with the keyword text. For example:
+-//
+-// foo.var
+-//
+-// yields a "_" selector instead of "var" since "var" is a keyword.
+-//
+-// TODO(rfindley): should this constitute an ast 'fix'?
+-func fixPhantomSelector(sel *ast.SelectorExpr, tf *token.File, src []byte) {
+- if !isPhantomUnderscore(sel.Sel, tf, src) {
+- return
+- }
+-
+- // Only consider selectors directly abutting the selector ".". This
+- // avoids false positives in cases like:
+- //
+- // foo. // don't think "var" is our selector
+- // var bar = 123
+- //
+- if sel.Sel.Pos() != sel.X.End()+1 {
+- return
+- }
+-
+- maybeKeyword := readKeyword(sel.Sel.Pos(), tf, src)
+- if maybeKeyword == "" {
+- return
+- }
+-
+- replaceNode(sel, sel.Sel, &ast.Ident{
+- Name: maybeKeyword,
+- NamePos: sel.Sel.Pos(),
+- })
+-}
+-
+-// isPhantomUnderscore reports whether the given ident is a phantom
+-// underscore. The parser sometimes inserts phantom underscores when
+-// it encounters otherwise unparseable situations.
+-func isPhantomUnderscore(id *ast.Ident, tok *token.File, src []byte) bool {
+- if id == nil || id.Name != "_" {
+- return false
+- }
+-
+- // Phantom underscore means the underscore is not actually in the
+- // program text.
+- offset, err := safetoken.Offset(tok, id.Pos())
+- if err != nil {
+- return false
+- }
+- return len(src) <= offset || src[offset] != '_'
+-}
+-
+-// fixInitStmt fixes cases where the parser misinterprets an
+-// if/for/switch "init" statement as the "cond" conditional. In cases
+-// like "if i := 0" the user hasn't typed the semicolon yet so the
+-// parser is looking for the conditional expression. However, "i := 0"
+-// are not valid expressions, so we get a BadExpr.
+-//
+-// fixInitStmt returns valid AST for the original source.
+-func fixInitStmt(bad *ast.BadExpr, parent ast.Node, tok *token.File, src []byte) {
+- if !bad.Pos().IsValid() || !bad.End().IsValid() {
+- return
+- }
+-
+- // Try to extract a statement from the BadExpr.
+- start, end, err := safetoken.Offsets(tok, bad.Pos(), bad.End()-1)
+- if err != nil {
+- return
+- }
+- stmtBytes := src[start : end+1]
+- stmt, err := parseStmt(bad.Pos(), stmtBytes)
+- if err != nil {
+- return
+- }
+-
+- // If the parent statement doesn't already have an "init" statement,
+- // move the extracted statement into the "init" field and insert a
+- // dummy expression into the required "cond" field.
+- switch p := parent.(type) {
+- case *ast.IfStmt:
+- if p.Init != nil {
+- return
+- }
+- p.Init = stmt
+- p.Cond = &ast.Ident{
+- Name: "_",
+- NamePos: stmt.End(),
+- }
+- case *ast.ForStmt:
+- if p.Init != nil {
+- return
+- }
+- p.Init = stmt
+- p.Cond = &ast.Ident{
+- Name: "_",
+- NamePos: stmt.End(),
+- }
+- case *ast.SwitchStmt:
+- if p.Init != nil {
+- return
+- }
+- p.Init = stmt
+- p.Tag = nil
+- }
+-}
+-
+-// readKeyword reads the keyword starting at pos, if any.
+-func readKeyword(pos token.Pos, tok *token.File, src []byte) string {
+- var kwBytes []byte
+- offset, err := safetoken.Offset(tok, pos)
+- if err != nil {
+- return ""
+- }
+- for i := offset; i < len(src); i++ {
+- // Use a simplified identifier check since keywords are always lowercase ASCII.
+- if src[i] < 'a' || src[i] > 'z' {
+- break
+- }
+- kwBytes = append(kwBytes, src[i])
+-
+- // Stop search at arbitrarily chosen too-long-for-a-keyword length.
+- if len(kwBytes) > 15 {
+- return ""
+- }
+- }
+-
+- if kw := string(kwBytes); token.Lookup(kw).IsKeyword() {
+- return kw
+- }
+-
+- return ""
+-}
+-
+-// fixArrayType tries to parse an *ast.BadExpr into an *ast.ArrayType.
+-// go/parser often turns lone array types like "[]int" into BadExprs
+-// if it isn't expecting a type.
+-func fixArrayType(bad *ast.BadExpr, parent ast.Node, tok *token.File, src []byte) bool {
+- // Our expected input is a bad expression that looks like "[]someExpr".
+-
+- from := bad.Pos()
+- to := bad.End()
+-
+- if !from.IsValid() || !to.IsValid() {
+- return false
+- }
+-
+- exprBytes := make([]byte, 0, int(to-from)+3)
+- // Avoid doing tok.Offset(to) since that panics if badExpr ends at EOF.
+- // It also panics if the position is not in the range of the file, and
+- // badExprs may not necessarily have good positions, so check first.
+- fromOffset, toOffset, err := safetoken.Offsets(tok, from, to-1)
+- if err != nil {
+- return false
+- }
+- exprBytes = append(exprBytes, src[fromOffset:toOffset+1]...)
+- exprBytes = bytes.TrimSpace(exprBytes)
+-
+- // If our expression ends in "]" (e.g. "[]"), add a phantom selector
+- // so we can complete directly after the "[]".
+- if len(exprBytes) > 0 && exprBytes[len(exprBytes)-1] == ']' {
+- exprBytes = append(exprBytes, '_')
+- }
+-
+- // Add "{}" to turn our ArrayType into a CompositeLit. This is to
+- // handle the case of "[...]int" where we must make it a composite
+- // literal to be parseable.
+- exprBytes = append(exprBytes, '{', '}')
+-
+- expr, err := parseExpr(from, exprBytes)
+- if err != nil {
+- return false
+- }
+-
+- cl, _ := expr.(*ast.CompositeLit)
+- if cl == nil {
+- return false
+- }
+-
+- at, _ := cl.Type.(*ast.ArrayType)
+- if at == nil {
+- return false
+- }
+-
+- return replaceNode(parent, bad, at)
+-}
+-
+-// precedingToken scans src to find the token preceding pos.
+-func precedingToken(pos token.Pos, tok *token.File, src []byte) token.Token {
+- s := &scanner.Scanner{}
+- s.Init(tok, src, nil, 0)
+-
+- var lastTok token.Token
+- for {
+- p, t, _ := s.Scan()
+- if t == token.EOF || p >= pos {
+- break
+- }
+-
+- lastTok = t
+- }
+- return lastTok
+-}
+-
+-// fixDeferOrGoStmt tries to parse an *ast.BadStmt into a defer or a go statement.
+-//
+-// go/parser packages a statement of the form "defer x." as an *ast.BadStmt because
+-// it does not include a call expression. This means that go/types skips type-checking
+-// this statement entirely, and we can't use the type information when completing.
+-// Here, we try to generate a fake *ast.DeferStmt or *ast.GoStmt to put into the AST,
+-// instead of the *ast.BadStmt.
+-func fixDeferOrGoStmt(bad *ast.BadStmt, parent ast.Node, tok *token.File, src []byte) bool {
+- // Check if we have a bad statement containing either a "go" or "defer".
+- s := &scanner.Scanner{}
+- s.Init(tok, src, nil, 0)
+-
+- var (
+- pos token.Pos
+- tkn token.Token
+- )
+- for {
+- if tkn == token.EOF {
+- return false
+- }
+- if pos >= bad.From {
+- break
+- }
+- pos, tkn, _ = s.Scan()
+- }
+-
+- var stmt ast.Stmt
+- switch tkn {
+- case token.DEFER:
+- stmt = &ast.DeferStmt{
+- Defer: pos,
+- }
+- case token.GO:
+- stmt = &ast.GoStmt{
+- Go: pos,
+- }
+- default:
+- return false
+- }
+-
+- var (
+- from, to, last token.Pos
+- lastToken token.Token
+- braceDepth int
+- phantomSelectors []token.Pos
+- )
+-FindTo:
+- for {
+- to, tkn, _ = s.Scan()
+-
+- if from == token.NoPos {
+- from = to
+- }
+-
+- switch tkn {
+- case token.EOF:
+- break FindTo
+- case token.SEMICOLON:
+- // If we aren't in nested braces, end of statement means
+- // end of expression.
+- if braceDepth == 0 {
+- break FindTo
+- }
+- case token.LBRACE:
+- braceDepth++
+- }
+-
+- // This handles the common dangling selector case. For example in
+- //
+- // defer fmt.
+- // y := 1
+- //
+- // we notice the dangling period and end our expression.
+- //
+- // If the previous token was a "." and we are looking at a "}",
+- // the period is likely a dangling selector and needs a phantom
+- // "_". Likewise if the current token is on a different line than
+- // the period, the period is likely a dangling selector.
+- if lastToken == token.PERIOD && (tkn == token.RBRACE || tok.Line(to) > tok.Line(last)) {
+- // Insert phantom "_" selector after the dangling ".".
+- phantomSelectors = append(phantomSelectors, last+1)
+- // If we aren't in a block then end the expression after the ".".
+- if braceDepth == 0 {
+- to = last + 1
+- break
+- }
+- }
+-
+- lastToken = tkn
+- last = to
+-
+- switch tkn {
+- case token.RBRACE:
+- braceDepth--
+- if braceDepth <= 0 {
+- if braceDepth == 0 {
+- // +1 to include the "}" itself.
+- to += 1
+- }
+- break FindTo
+- }
+- }
+- }
+-
+- fromOffset, toOffset, err := safetoken.Offsets(tok, from, to)
+- if err != nil {
+- return false
+- }
+- if !from.IsValid() || fromOffset >= len(src) {
+- return false
+- }
+- if !to.IsValid() || toOffset >= len(src) {
+- return false
+- }
+-
+- // Insert any phantom selectors needed to prevent dangling "." from messing
+- // up the AST.
+- exprBytes := make([]byte, 0, int(to-from)+len(phantomSelectors))
+- for i, b := range src[fromOffset:toOffset] {
+- if len(phantomSelectors) > 0 && from+token.Pos(i) == phantomSelectors[0] {
+- exprBytes = append(exprBytes, '_')
+- phantomSelectors = phantomSelectors[1:]
+- }
+- exprBytes = append(exprBytes, b)
+- }
+-
+- if len(phantomSelectors) > 0 {
+- exprBytes = append(exprBytes, '_')
+- }
+-
+- expr, err := parseExpr(from, exprBytes)
+- if err != nil {
+- return false
+- }
+-
+- // Package the expression into a fake *ast.CallExpr and re-insert
+- // into the function.
+- call := &ast.CallExpr{
+- Fun: expr,
+- Lparen: to,
+- Rparen: to,
+- }
+-
+- switch stmt := stmt.(type) {
+- case *ast.DeferStmt:
+- stmt.Call = call
+- case *ast.GoStmt:
+- stmt.Call = call
+- }
+-
+- return replaceNode(parent, bad, stmt)
+-}
+-
+-// parseStmt parses the statement in src and updates its position to
+-// start at pos.
+-func parseStmt(pos token.Pos, src []byte) (ast.Stmt, error) {
+- // Wrap our expression to make it a valid Go file we can pass to ParseFile.
+- fileSrc := bytes.Join([][]byte{
+- []byte("package fake;func _(){"),
+- src,
+- []byte("}"),
+- }, nil)
+-
+- // Use ParseFile instead of ParseExpr because ParseFile has
+- // best-effort behavior, whereas ParseExpr fails hard on any error.
+- fakeFile, err := parser.ParseFile(token.NewFileSet(), "", fileSrc, 0)
+- if fakeFile == nil {
+- return nil, fmt.Errorf("error reading fake file source: %v", err)
+- }
+-
+- // Extract our expression node from inside the fake file.
+- if len(fakeFile.Decls) == 0 {
+- return nil, fmt.Errorf("error parsing fake file: %v", err)
+- }
+-
+- fakeDecl, _ := fakeFile.Decls[0].(*ast.FuncDecl)
+- if fakeDecl == nil || len(fakeDecl.Body.List) == 0 {
+- return nil, fmt.Errorf("no statement in %s: %v", src, err)
+- }
+-
+- stmt := fakeDecl.Body.List[0]
+-
+- // parser.ParseFile returns undefined positions.
+- // Adjust them for the current file.
+- offsetPositions(stmt, pos-1-(stmt.Pos()-1))
+-
+- return stmt, nil
+-}
+-
+-// parseExpr parses the expression in src and updates its position to
+-// start at pos.
+-func parseExpr(pos token.Pos, src []byte) (ast.Expr, error) {
+- stmt, err := parseStmt(pos, src)
+- if err != nil {
+- return nil, err
+- }
+-
+- exprStmt, ok := stmt.(*ast.ExprStmt)
+- if !ok {
+- return nil, fmt.Errorf("no expr in %s: %v", src, err)
+- }
+-
+- return exprStmt.X, nil
+-}
+-
+-var tokenPosType = reflect.TypeOf(token.NoPos)
+-
+-// offsetPositions applies an offset to the positions in an ast.Node.
+-func offsetPositions(n ast.Node, offset token.Pos) {
+- ast.Inspect(n, func(n ast.Node) bool {
+- if n == nil {
+- return false
+- }
+-
+- v := reflect.ValueOf(n).Elem()
+-
+- switch v.Kind() {
+- case reflect.Struct:
+- for i := 0; i < v.NumField(); i++ {
+- f := v.Field(i)
+- if f.Type() != tokenPosType {
+- continue
+- }
+-
+- if !f.CanSet() {
+- continue
+- }
+-
+- // Don't offset invalid positions: they should stay invalid.
+- if !token.Pos(f.Int()).IsValid() {
+- continue
+- }
+-
+- f.SetInt(f.Int() + int64(offset))
+- }
+- }
+-
+- return true
+- })
+-}
+-
+-// replaceNode updates parent's child oldChild to be newChild. It
+-// returns whether it replaced successfully.
+-func replaceNode(parent, oldChild, newChild ast.Node) bool {
+- if parent == nil || oldChild == nil || newChild == nil {
+- return false
+- }
+-
+- parentVal := reflect.ValueOf(parent).Elem()
+- if parentVal.Kind() != reflect.Struct {
+- return false
+- }
+-
+- newChildVal := reflect.ValueOf(newChild)
+-
+- tryReplace := func(v reflect.Value) bool {
+- if !v.CanSet() || !v.CanInterface() {
+- return false
+- }
+-
+- // If the existing value is oldChild, we found our child. Make
+- // sure our newChild is assignable and then make the swap.
+- if v.Interface() == oldChild && newChildVal.Type().AssignableTo(v.Type()) {
+- v.Set(newChildVal)
+- return true
+- }
+-
+- return false
+- }
+-
+- // Loop over parent's struct fields.
+- for i := 0; i < parentVal.NumField(); i++ {
+- f := parentVal.Field(i)
+-
+- switch f.Kind() {
+- // Check interface and pointer fields.
+- case reflect.Interface, reflect.Ptr:
+- if tryReplace(f) {
+- return true
+- }
+-
+- // Search through any slice fields.
+- case reflect.Slice:
+- for i := 0; i < f.Len(); i++ {
+- if tryReplace(f.Index(i)) {
+- return true
+- }
+- }
+- }
+- }
+-
+- return false
+-}
+diff -urN a/gopls/internal/lsp/cache/parsemode_go116.go b/gopls/internal/lsp/cache/parsemode_go116.go
+--- a/gopls/internal/lsp/cache/parsemode_go116.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/parsemode_go116.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build !go1.17
+-// +build !go1.17
+-
+-package cache
+-
+-// The parser.SkipObjectResolution mode flag is not supported before Go 1.17.
+-const skipObjectResolution = 0
+diff -urN a/gopls/internal/lsp/cache/parsemode_go117.go b/gopls/internal/lsp/cache/parsemode_go117.go
+--- a/gopls/internal/lsp/cache/parsemode_go117.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/parsemode_go117.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.17
+-// +build go1.17
+-
+-package cache
+-
+-import "go/parser"
+-
+-const skipObjectResolution = parser.SkipObjectResolution
+diff -urN a/gopls/internal/lsp/cache/pkg.go b/gopls/internal/lsp/cache/pkg.go
+--- a/gopls/internal/lsp/cache/pkg.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/pkg.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,165 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "context"
+- "fmt"
+- "go/ast"
+- "go/scanner"
+- "go/token"
+- "go/types"
+-
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/source/methodsets"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/memoize"
+-)
+-
+-// Convenient local aliases for typed strings.
+-type (
+- PackageID = source.PackageID
+- PackagePath = source.PackagePath
+- PackageName = source.PackageName
+- ImportPath = source.ImportPath
+-)
+-
+-// A Package is the union of snapshot-local information (Metadata) and shared
+-// type-checking information (a syntaxPackage).
+-//
+-// TODO(rfindley): for now, we do not persist the post-processing of
+-// loadDiagnostics, because the value of the snapshot.packages map is just the
+-// package handle. Fix this.
+-type Package struct {
+- m *source.Metadata
+- pkg *syntaxPackage
+-}
+-
+-// syntaxPackage contains parse trees and type information for a package.
+-type syntaxPackage struct {
+- // -- identifiers --
+- id PackageID
+- mode source.ParseMode
+-
+- // -- outputs --
+- fset *token.FileSet // for now, same as the snapshot's FileSet
+- goFiles []*source.ParsedGoFile
+- compiledGoFiles []*source.ParsedGoFile
+- diagnostics []*source.Diagnostic
+- parseErrors []scanner.ErrorList
+- typeErrors []types.Error
+- types *types.Package
+- typesInfo *types.Info
+- importMap map[string]*types.Package // keys are PackagePaths
+- hasFixedFiles bool // if true, AST was sufficiently mangled that we should hide type errors
+- analyses memoize.Store // maps analyzer.Name to Promise[actionResult]
+- xrefs []byte
+- methodsets *methodsets.Index
+-}
+-
+-func (p *Package) String() string { return string(p.m.ID) }
+-
+-func (p *Package) Metadata() *source.Metadata { return p.m }
+-
+-// A loadScope defines a package loading scope for use with go/packages.
+-//
+-// TODO(rfindley): move this to load.go.
+-type loadScope interface {
+- aScope()
+-}
+-
+-type (
+- fileLoadScope span.URI // load packages containing a file (including command-line-arguments)
+- packageLoadScope string // load a specific package (the value is its PackageID)
+- moduleLoadScope string // load packages in a specific module
+- viewLoadScope span.URI // load the workspace
+-)
+-
+-// Implement the loadScope interface.
+-func (fileLoadScope) aScope() {}
+-func (packageLoadScope) aScope() {}
+-func (moduleLoadScope) aScope() {}
+-func (viewLoadScope) aScope() {}
+-
+-func (p *Package) ParseMode() source.ParseMode {
+- return p.pkg.mode
+-}
+-
+-func (p *Package) CompiledGoFiles() []*source.ParsedGoFile {
+- return p.pkg.compiledGoFiles
+-}
+-
+-func (p *Package) File(uri span.URI) (*source.ParsedGoFile, error) {
+- return p.pkg.File(uri)
+-}
+-
+-func (pkg *syntaxPackage) File(uri span.URI) (*source.ParsedGoFile, error) {
+- for _, cgf := range pkg.compiledGoFiles {
+- if cgf.URI == uri {
+- return cgf, nil
+- }
+- }
+- for _, gf := range pkg.goFiles {
+- if gf.URI == uri {
+- return gf, nil
+- }
+- }
+- return nil, fmt.Errorf("no parsed file for %s in %v", uri, pkg.id)
+-}
+-
+-func (p *Package) GetSyntax() []*ast.File {
+- var syntax []*ast.File
+- for _, pgf := range p.pkg.compiledGoFiles {
+- syntax = append(syntax, pgf.File)
+- }
+- return syntax
+-}
+-
+-func (p *Package) FileSet() *token.FileSet {
+- return p.pkg.fset
+-}
+-
+-func (p *Package) GetTypes() *types.Package {
+- return p.pkg.types
+-}
+-
+-func (p *Package) GetTypesInfo() *types.Info {
+- return p.pkg.typesInfo
+-}
+-
+-// DependencyTypes returns the type checker's symbol for the specified
+-// package. It returns nil if path is not among the transitive
+-// dependencies of p, or if no symbols from that package were
+-// referenced during the type-checking of p.
+-func (p *Package) DependencyTypes(path source.PackagePath) *types.Package {
+- if path == p.m.PkgPath {
+- return p.pkg.types
+- }
+- return p.pkg.importMap[string(path)]
+-}
+-
+-func (p *Package) HasParseErrors() bool {
+- return len(p.pkg.parseErrors) != 0
+-}
+-
+-func (p *Package) HasTypeErrors() bool {
+- return len(p.pkg.typeErrors) != 0
+-}
+-
+-func (p *Package) DiagnosticsForFile(ctx context.Context, s source.Snapshot, uri span.URI) ([]*source.Diagnostic, error) {
+- var diags []*source.Diagnostic
+- for _, diag := range p.m.Diagnostics {
+- if diag.URI == uri {
+- diags = append(diags, diag)
+- }
+- }
+- for _, diag := range p.pkg.diagnostics {
+- if diag.URI == uri {
+- diags = append(diags, diag)
+- }
+- }
+-
+- return diags, nil
+-}
+diff -urN a/gopls/internal/lsp/cache/session.go b/gopls/internal/lsp/cache/session.go
+--- a/gopls/internal/lsp/cache/session.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/session.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,730 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "context"
+- "fmt"
+- "strconv"
+- "strings"
+- "sync"
+- "sync/atomic"
+-
+- "golang.org/x/tools/gopls/internal/govulncheck"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/gocommand"
+- "golang.org/x/tools/internal/imports"
+- "golang.org/x/tools/internal/persistent"
+- "golang.org/x/tools/internal/xcontext"
+-)
+-
+-type Session struct {
+- // Unique identifier for this session.
+- id string
+-
+- // Immutable attributes shared across views.
+- cache *Cache // shared cache
+- gocmdRunner *gocommand.Runner // limits go command concurrency
+-
+- optionsMu sync.Mutex
+- options *source.Options
+-
+- viewMu sync.Mutex
+- views []*View
+- viewMap map[span.URI]*View // map of URI->best view
+-
+- *overlayFS
+-}
+-
+-// ID returns the unique identifier for this session on this server.
+-func (s *Session) ID() string { return s.id }
+-func (s *Session) String() string { return s.id }
+-
+-// Options returns a copy of the SessionOptions for this session.
+-func (s *Session) Options() *source.Options {
+- s.optionsMu.Lock()
+- defer s.optionsMu.Unlock()
+- return s.options
+-}
+-
+-// SetOptions sets the options of this session to new values.
+-func (s *Session) SetOptions(options *source.Options) {
+- s.optionsMu.Lock()
+- defer s.optionsMu.Unlock()
+- s.options = options
+-}
+-
+-// Shutdown the session and all views it has created.
+-func (s *Session) Shutdown(ctx context.Context) {
+- var views []*View
+- s.viewMu.Lock()
+- views = append(views, s.views...)
+- s.views = nil
+- s.viewMap = nil
+- s.viewMu.Unlock()
+- for _, view := range views {
+- view.shutdown()
+- }
+- event.Log(ctx, "Shutdown session", KeyShutdownSession.Of(s))
+-}
+-
+-// Cache returns the cache that created this session, for debugging only.
+-func (s *Session) Cache() *Cache {
+- return s.cache
+-}
+-
+-// NewView creates a new View, returning it and its first snapshot. If a
+-// non-empty tempWorkspace directory is provided, the View will record a copy
+-// of its gopls workspace module in that directory, so that client tooling
+-// can execute in the same main module. On success it also returns a release
+-// function that must be called when the Snapshot is no longer needed.
+-func (s *Session) NewView(ctx context.Context, name string, folder span.URI, options *source.Options) (*View, source.Snapshot, func(), error) {
+- s.viewMu.Lock()
+- defer s.viewMu.Unlock()
+- for _, view := range s.views {
+- if span.SameExistingFile(view.folder, folder) {
+- return nil, nil, nil, source.ErrViewExists
+- }
+- }
+- view, snapshot, release, err := s.createView(ctx, name, folder, options, 0)
+- if err != nil {
+- return nil, nil, nil, err
+- }
+- s.views = append(s.views, view)
+- // we always need to drop the view map
+- s.viewMap = make(map[span.URI]*View)
+- return view, snapshot, release, nil
+-}
+-
+-// TODO(rfindley): clarify that createView can never be cancelled (with the
+-// possible exception of server shutdown).
+-func (s *Session) createView(ctx context.Context, name string, folder span.URI, options *source.Options, seqID uint64) (*View, *snapshot, func(), error) {
+- index := atomic.AddInt64(&viewIndex, 1)
+-
+- // Get immutable workspace information.
+- info, err := s.getWorkspaceInformation(ctx, folder, options)
+- if err != nil {
+- return nil, nil, func() {}, err
+- }
+-
+- wsModFiles, wsModFilesErr := computeWorkspaceModFiles(ctx, info.gomod, info.effectiveGOWORK(), info.effectiveGO111MODULE(), s)
+-
+- // We want a true background context and not a detached context here
+- // the spans need to be unrelated and no tag values should pollute it.
+- baseCtx := event.Detach(xcontext.Detach(ctx))
+- backgroundCtx, cancel := context.WithCancel(baseCtx)
+-
+- v := &View{
+- id: strconv.FormatInt(index, 10),
+- gocmdRunner: s.gocmdRunner,
+- initialWorkspaceLoad: make(chan struct{}),
+- initializationSema: make(chan struct{}, 1),
+- options: options,
+- baseCtx: baseCtx,
+- name: name,
+- folder: folder,
+- moduleUpgrades: map[span.URI]map[string]string{},
+- vulns: map[span.URI]*govulncheck.Result{},
+- fs: s.overlayFS,
+- workspaceInformation: info,
+- }
+- v.importsState = &importsState{
+- ctx: backgroundCtx,
+- processEnv: &imports.ProcessEnv{
+- GocmdRunner: s.gocmdRunner,
+- SkipPathInScan: func(dir string) bool {
+- prefix := strings.TrimSuffix(string(v.folder), "/") + "/"
+- uri := strings.TrimSuffix(string(span.URIFromPath(dir)), "/")
+- if !strings.HasPrefix(uri+"/", prefix) {
+- return false
+- }
+- filterer := source.NewFilterer(options.DirectoryFilters)
+- rel := strings.TrimPrefix(uri, prefix)
+- disallow := filterer.Disallow(rel)
+- return disallow
+- },
+- },
+- }
+- v.snapshot = &snapshot{
+- sequenceID: seqID,
+- globalID: nextSnapshotID(),
+- view: v,
+- backgroundCtx: backgroundCtx,
+- cancel: cancel,
+- store: s.cache.store,
+- packages: persistent.NewMap(packageIDLessInterface),
+- meta: new(metadataGraph),
+- files: newFilesMap(),
+- parseCache: new(parseCache),
+- activePackages: persistent.NewMap(packageIDLessInterface),
+- symbolizeHandles: persistent.NewMap(uriLessInterface),
+- analyses: persistent.NewMap(analysisKeyLessInterface),
+- workspacePackages: make(map[PackageID]PackagePath),
+- unloadableFiles: make(map[span.URI]struct{}),
+- parseModHandles: persistent.NewMap(uriLessInterface),
+- parseWorkHandles: persistent.NewMap(uriLessInterface),
+- modTidyHandles: persistent.NewMap(uriLessInterface),
+- modVulnHandles: persistent.NewMap(uriLessInterface),
+- modWhyHandles: persistent.NewMap(uriLessInterface),
+- knownSubdirs: newKnownDirsSet(),
+- workspaceModFiles: wsModFiles,
+- workspaceModFilesErr: wsModFilesErr,
+- }
+- // Save one reference in the view.
+- v.releaseSnapshot = v.snapshot.Acquire()
+-
+- // Record the environment of the newly created view in the log.
+- event.Log(ctx, viewEnv(v))
+-
+- // Initialize the view without blocking.
+- initCtx, initCancel := context.WithCancel(xcontext.Detach(ctx))
+- v.initCancelFirstAttempt = initCancel
+- snapshot := v.snapshot
+-
+- // Pass a second reference to the background goroutine.
+- bgRelease := snapshot.Acquire()
+- go func() {
+- defer bgRelease()
+- snapshot.initialize(initCtx, true)
+- }()
+-
+- // Return a third reference to the caller.
+- return v, snapshot, snapshot.Acquire(), nil
+-}
+-
+-// View returns a view with a matching name, if the session has one.
+-func (s *Session) View(name string) *View {
+- s.viewMu.Lock()
+- defer s.viewMu.Unlock()
+- for _, view := range s.views {
+- if view.Name() == name {
+- return view
+- }
+- }
+- return nil
+-}
+-
+-// ViewOf returns a view corresponding to the given URI.
+-// If the file is not already associated with a view, pick one using some heuristics.
+-func (s *Session) ViewOf(uri span.URI) (*View, error) {
+- s.viewMu.Lock()
+- defer s.viewMu.Unlock()
+- return s.viewOfLocked(uri)
+-}
+-
+-// Precondition: caller holds s.viewMu lock.
+-func (s *Session) viewOfLocked(uri span.URI) (*View, error) {
+- // Check if we already know this file.
+- if v, found := s.viewMap[uri]; found {
+- return v, nil
+- }
+- // Pick the best view for this file and memoize the result.
+- if len(s.views) == 0 {
+- return nil, fmt.Errorf("no views in session")
+- }
+- s.viewMap[uri] = bestViewForURI(uri, s.views)
+- return s.viewMap[uri], nil
+-}
+-
+-func (s *Session) Views() []*View {
+- s.viewMu.Lock()
+- defer s.viewMu.Unlock()
+- result := make([]*View, len(s.views))
+- copy(result, s.views)
+- return result
+-}
+-
+-// bestViewForURI returns the most closely matching view for the given URI
+-// out of the given set of views.
+-func bestViewForURI(uri span.URI, views []*View) *View {
+- // we need to find the best view for this file
+- var longest *View
+- for _, view := range views {
+- if longest != nil && len(longest.Folder()) > len(view.Folder()) {
+- continue
+- }
+- // TODO(rfindley): this should consider the workspace layout (i.e.
+- // go.work).
+- if view.contains(uri) {
+- longest = view
+- }
+- }
+- if longest != nil {
+- return longest
+- }
+- // Try our best to return a view that knows the file.
+- for _, view := range views {
+- if view.knownFile(uri) {
+- return view
+- }
+- }
+- // TODO: are there any more heuristics we can use?
+- return views[0]
+-}
+-
+-// RemoveView removes the view v from the session
+-func (s *Session) RemoveView(view *View) {
+- s.viewMu.Lock()
+- defer s.viewMu.Unlock()
+- i := s.dropView(view)
+- if i == -1 { // error reported elsewhere
+- return
+- }
+- // delete this view... we don't care about order but we do want to make
+- // sure we can garbage collect the view
+- s.views = removeElement(s.views, i)
+-}
+-
+-// updateView recreates the view with the given options.
+-//
+-// If the resulting error is non-nil, the view may or may not have already been
+-// dropped from the session.
+-func (s *Session) updateView(ctx context.Context, view *View, options *source.Options) (*View, error) {
+- s.viewMu.Lock()
+- defer s.viewMu.Unlock()
+-
+- return s.updateViewLocked(ctx, view, options)
+-}
+-
+-func (s *Session) updateViewLocked(ctx context.Context, view *View, options *source.Options) (*View, error) {
+- // Preserve the snapshot ID if we are recreating the view.
+- view.snapshotMu.Lock()
+- if view.snapshot == nil {
+- view.snapshotMu.Unlock()
+- panic("updateView called after View was already shut down")
+- }
+- seqID := view.snapshot.sequenceID // Preserve sequence IDs when updating a view in place.
+- view.snapshotMu.Unlock()
+-
+- i := s.dropView(view)
+- if i == -1 {
+- return nil, fmt.Errorf("view %q not found", view.id)
+- }
+-
+- v, _, release, err := s.createView(ctx, view.name, view.folder, options, seqID)
+- release()
+-
+- if err != nil {
+- // we have dropped the old view, but could not create the new one
+- // this should not happen and is very bad, but we still need to clean
+- // up the view array if it happens
+- s.views = removeElement(s.views, i)
+- return nil, err
+- }
+- // substitute the new view into the array where the old view was
+- s.views[i] = v
+- return v, nil
+-}
+-
+-// removeElement removes the ith element from the slice replacing it with the last element.
+-// TODO(adonovan): generics, someday.
+-func removeElement(slice []*View, index int) []*View {
+- last := len(slice) - 1
+- slice[index] = slice[last]
+- slice[last] = nil // aid GC
+- return slice[:last]
+-}
+-
+-// dropView removes v from the set of views for the receiver s and calls
+-// v.shutdown, returning the index of v in s.views (if found), or -1 if v was
+-// not found. s.viewMu must be held while calling this function.
+-func (s *Session) dropView(v *View) int {
+- // we always need to drop the view map
+- s.viewMap = make(map[span.URI]*View)
+- for i := range s.views {
+- if v == s.views[i] {
+- // we found the view, drop it and return the index it was found at
+- s.views[i] = nil
+- v.shutdown()
+- return i
+- }
+- }
+- // TODO(rfindley): it looks wrong that we don't shutdown v in this codepath.
+- // We should never get here.
+- bug.Reportf("tried to drop nonexistent view %q", v.id)
+- return -1
+-}
+-
+-func (s *Session) ModifyFiles(ctx context.Context, changes []source.FileModification) error {
+- _, release, err := s.DidModifyFiles(ctx, changes)
+- release()
+- return err
+-}
+-
+-// TODO(rfindley): fileChange seems redundant with source.FileModification.
+-// De-dupe into a common representation for changes.
+-type fileChange struct {
+- content []byte
+- exists bool
+- fileHandle source.FileHandle
+-
+- // isUnchanged indicates whether the file action is one that does not
+- // change the actual contents of the file. Opens and closes should not
+- // be treated like other changes, since the file content doesn't change.
+- isUnchanged bool
+-}
+-
+-// DidModifyFiles reports a file modification to the session. It returns
+-// the new snapshots after the modifications have been applied, paired with
+-// the affected file URIs for those snapshots.
+-// On success, it returns a release function that
+-// must be called when the snapshots are no longer needed.
+-//
+-// TODO(rfindley): what happens if this function fails? It must leave us in a
+-// broken state, which we should surface to the user, probably as a request to
+-// restart gopls.
+-func (s *Session) DidModifyFiles(ctx context.Context, changes []source.FileModification) (map[source.Snapshot][]span.URI, func(), error) {
+- s.viewMu.Lock()
+- defer s.viewMu.Unlock()
+-
+- // Update overlays.
+- //
+- // TODO(rfindley): I think we do this while holding viewMu to prevent views
+- // from seeing the updated file content before they have processed
+- // invalidations, which could lead to a partial view of the changes (i.e.
+- // spurious diagnostics). However, any such view would immediately be
+- // invalidated here, so it is possible that we could update overlays before
+- // acquiring viewMu.
+- if err := s.updateOverlays(ctx, changes); err != nil {
+- return nil, nil, err
+- }
+-
+- // Re-create views whose definition may have changed.
+- //
+- // checkViews controls whether to re-evaluate view definitions when
+- // collecting views below. Any addition or deletion of a go.mod or go.work
+- // file may have affected the definition of the view.
+- checkViews := false
+-
+- for _, c := range changes {
+- if isGoMod(c.URI) || isGoWork(c.URI) {
+- // Change, InvalidateMetadata, and UnknownFileAction actions do not cause
+- // us to re-evaluate views.
+- redoViews := (c.Action != source.Change &&
+- c.Action != source.InvalidateMetadata &&
+- c.Action != source.UnknownFileAction)
+-
+- if redoViews {
+- checkViews = true
+- break
+- }
+- }
+- }
+-
+- if checkViews {
+- for _, view := range s.views {
+- // TODO(rfindley): can we avoid running the go command (go env)
+- // synchronously to change processing? Can we assume that the env did not
+- // change, and derive go.work using a combination of the configured
+- // GOWORK value and filesystem?
+- info, err := s.getWorkspaceInformation(ctx, view.folder, view.Options())
+- if err != nil {
+- // Catastrophic failure, equivalent to a failure of session
+- // initialization and therefore should almost never happen. One
+- // scenario where this failure mode could occur is if some file
+- // permissions have changed preventing us from reading go.mod
+- // files.
+- //
+- // TODO(rfindley): consider surfacing this error more loudly. We
+- // could report a bug, but it's not really a bug.
+- event.Error(ctx, "fetching workspace information", err)
+- }
+-
+- if info != view.workspaceInformation {
+- _, err := s.updateViewLocked(ctx, view, view.Options())
+- if err != nil {
+- // More catastrophic failure. The view may or may not still exist.
+- // The best we can do is log and move on.
+- event.Error(ctx, "recreating view", err)
+- }
+- }
+- }
+- }
+-
+- // Collect information about views affected by these changes.
+- views := make(map[*View]map[span.URI]*fileChange)
+- affectedViews := map[span.URI][]*View{}
+- // forceReloadMetadata records whether any change is the magic
+- // source.InvalidateMetadata action.
+- forceReloadMetadata := false
+- for _, c := range changes {
+- if c.Action == source.InvalidateMetadata {
+- forceReloadMetadata = true
+- }
+- // Build the list of affected views.
+- var changedViews []*View
+- for _, view := range s.views {
+- // Don't propagate changes that are outside of the view's scope
+- // or knowledge.
+- if !view.relevantChange(c) {
+- continue
+- }
+- changedViews = append(changedViews, view)
+- }
+- // If the change is not relevant to any view, but the change is
+- // happening in the editor, assign it the most closely matching view.
+- if len(changedViews) == 0 {
+- if c.OnDisk {
+- continue
+- }
+- bestView, err := s.viewOfLocked(c.URI)
+- if err != nil {
+- return nil, nil, err
+- }
+- changedViews = append(changedViews, bestView)
+- }
+- affectedViews[c.URI] = changedViews
+-
+- isUnchanged := c.Action == source.Open || c.Action == source.Close
+-
+- // Apply the changes to all affected views.
+- for _, view := range changedViews {
+- // Make sure that the file is added to the view's seenFiles set.
+- view.markKnown(c.URI)
+- if _, ok := views[view]; !ok {
+- views[view] = make(map[span.URI]*fileChange)
+- }
+- fh, err := s.GetFile(ctx, c.URI)
+- if err != nil {
+- return nil, nil, err
+- }
+- content, err := fh.Read()
+- if err != nil {
+- // Ignore the error: the file may be deleted.
+- content = nil
+- }
+- views[view][c.URI] = &fileChange{
+- content: content,
+- exists: err == nil,
+- fileHandle: fh,
+- isUnchanged: isUnchanged,
+- }
+- }
+- }
+-
+- var releases []func()
+- viewToSnapshot := map[*View]*snapshot{}
+- for view, changed := range views {
+- snapshot, release := view.invalidateContent(ctx, changed, forceReloadMetadata)
+- releases = append(releases, release)
+- viewToSnapshot[view] = snapshot
+- }
+-
+- // The release function is called when the
+- // returned URIs no longer need to be valid.
+- release := func() {
+- for _, release := range releases {
+- release()
+- }
+- }
+-
+- // We only want to diagnose each changed file once, in the view to which
+- // it "most" belongs. We do this by picking the best view for each URI,
+- // and then aggregating the set of snapshots and their URIs (to avoid
+- // diagnosing the same snapshot multiple times).
+- snapshotURIs := map[source.Snapshot][]span.URI{}
+- for _, mod := range changes {
+- viewSlice, ok := affectedViews[mod.URI]
+- if !ok || len(viewSlice) == 0 {
+- continue
+- }
+- view := bestViewForURI(mod.URI, viewSlice)
+- snapshot, ok := viewToSnapshot[view]
+- if !ok {
+- panic(fmt.Sprintf("no snapshot for view %s", view.Folder()))
+- }
+- snapshotURIs[snapshot] = append(snapshotURIs[snapshot], mod.URI)
+- }
+-
+- return snapshotURIs, release, nil
+-}
+-
+-// ExpandModificationsToDirectories returns the set of changes with the
+-// directory changes removed and expanded to include all of the files in
+-// the directory.
+-func (s *Session) ExpandModificationsToDirectories(ctx context.Context, changes []source.FileModification) []source.FileModification {
+- var snapshots []*snapshot
+- s.viewMu.Lock()
+- for _, v := range s.views {
+- snapshot, release, err := v.getSnapshot()
+- if err != nil {
+- continue // view is shut down; continue with others
+- }
+- defer release()
+- snapshots = append(snapshots, snapshot)
+- }
+- s.viewMu.Unlock()
+-
+- knownDirs := knownDirectories(ctx, snapshots)
+- defer knownDirs.Destroy()
+-
+- var result []source.FileModification
+- for _, c := range changes {
+- if !knownDirs.Contains(c.URI) {
+- result = append(result, c)
+- continue
+- }
+- affectedFiles := knownFilesInDir(ctx, snapshots, c.URI)
+- var fileChanges []source.FileModification
+- for uri := range affectedFiles {
+- fileChanges = append(fileChanges, source.FileModification{
+- URI: uri,
+- Action: c.Action,
+- LanguageID: "",
+- OnDisk: c.OnDisk,
+- // changes to directories cannot include text or versions
+- })
+- }
+- result = append(result, fileChanges...)
+- }
+- return result
+-}
+-
+-// knownDirectories returns all of the directories known to the given
+-// snapshots, including workspace directories and their subdirectories.
+-// It is responsibility of the caller to destroy the returned set.
+-func knownDirectories(ctx context.Context, snapshots []*snapshot) knownDirsSet {
+- result := newKnownDirsSet()
+- for _, snapshot := range snapshots {
+- dirs := snapshot.dirs(ctx)
+- for _, dir := range dirs {
+- result.Insert(dir)
+- }
+- knownSubdirs := snapshot.getKnownSubdirs(dirs)
+- result.SetAll(knownSubdirs)
+- knownSubdirs.Destroy()
+- }
+- return result
+-}
+-
+-// knownFilesInDir returns the files known to the snapshots in the session.
+-// It does not respect symlinks.
+-func knownFilesInDir(ctx context.Context, snapshots []*snapshot, dir span.URI) map[span.URI]struct{} {
+- files := map[span.URI]struct{}{}
+-
+- for _, snapshot := range snapshots {
+- for _, uri := range snapshot.knownFilesInDir(ctx, dir) {
+- files[uri] = struct{}{}
+- }
+- }
+- return files
+-}
+-
+-// Precondition: caller holds s.viewMu lock.
+-// TODO(rfindley): move this to fs_overlay.go.
+-func (fs *overlayFS) updateOverlays(ctx context.Context, changes []source.FileModification) error {
+- fs.mu.Lock()
+- defer fs.mu.Unlock()
+-
+- for _, c := range changes {
+- // Don't update overlays for metadata invalidations.
+- if c.Action == source.InvalidateMetadata {
+- continue
+- }
+-
+- o, ok := fs.overlays[c.URI]
+-
+- // If the file is not opened in an overlay and the change is on disk,
+- // there's no need to update an overlay. If there is an overlay, we
+- // may need to update the overlay's saved value.
+- if !ok && c.OnDisk {
+- continue
+- }
+-
+- // Determine the file kind on open, otherwise, assume it has been cached.
+- var kind source.FileKind
+- switch c.Action {
+- case source.Open:
+- kind = source.FileKindForLang(c.LanguageID)
+- default:
+- if !ok {
+- return fmt.Errorf("updateOverlays: modifying unopened overlay %v", c.URI)
+- }
+- kind = o.kind
+- }
+-
+- // Closing a file just deletes its overlay.
+- if c.Action == source.Close {
+- delete(fs.overlays, c.URI)
+- continue
+- }
+-
+- // If the file is on disk, check if its content is the same as in the
+- // overlay. Saves and on-disk file changes don't come with the file's
+- // content.
+- text := c.Text
+- if text == nil && (c.Action == source.Save || c.OnDisk) {
+- if !ok {
+- return fmt.Errorf("no known content for overlay for %s", c.Action)
+- }
+- text = o.content
+- }
+- // On-disk changes don't come with versions.
+- version := c.Version
+- if c.OnDisk || c.Action == source.Save {
+- version = o.version
+- }
+- hash := source.HashOf(text)
+- var sameContentOnDisk bool
+- switch c.Action {
+- case source.Delete:
+- // Do nothing. sameContentOnDisk should be false.
+- case source.Save:
+- // Make sure the version and content (if present) is the same.
+- if false && o.version != version { // Client no longer sends the version
+- return fmt.Errorf("updateOverlays: saving %s at version %v, currently at %v", c.URI, c.Version, o.version)
+- }
+- if c.Text != nil && o.hash != hash {
+- return fmt.Errorf("updateOverlays: overlay %s changed on save", c.URI)
+- }
+- sameContentOnDisk = true
+- default:
+- fh, err := fs.delegate.GetFile(ctx, c.URI)
+- if err != nil {
+- return err
+- }
+- _, readErr := fh.Read()
+- sameContentOnDisk = (readErr == nil && fh.FileIdentity().Hash == hash)
+- }
+- o = &Overlay{
+- uri: c.URI,
+- version: version,
+- content: text,
+- kind: kind,
+- hash: hash,
+- saved: sameContentOnDisk,
+- }
+-
+- // NOTE: previous versions of this code checked here that the overlay had a
+- // view and file kind (but we don't know why).
+-
+- fs.overlays[c.URI] = o
+- }
+-
+- return nil
+-}
+-
+-// FileWatchingGlobPatterns returns glob patterns to watch every directory
+-// known by the view. For views within a module, this is the module root,
+-// any directory in the module root, and any replace targets.
+-func (s *Session) FileWatchingGlobPatterns(ctx context.Context) map[string]struct{} {
+- s.viewMu.Lock()
+- defer s.viewMu.Unlock()
+- patterns := map[string]struct{}{}
+- for _, view := range s.views {
+- snapshot, release, err := view.getSnapshot()
+- if err != nil {
+- continue // view is shut down; continue with others
+- }
+- for k, v := range snapshot.fileWatchingGlobPatterns(ctx) {
+- patterns[k] = v
+- }
+- release()
+- }
+- return patterns
+-}
+diff -urN a/gopls/internal/lsp/cache/snapshot.go b/gopls/internal/lsp/cache/snapshot.go
+--- a/gopls/internal/lsp/cache/snapshot.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/snapshot.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,2214 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "bytes"
+- "context"
+- "errors"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "io"
+- "io/ioutil"
+- "log"
+- "os"
+- "path/filepath"
+- "regexp"
+- "runtime"
+- "sort"
+- "strconv"
+- "strings"
+- "sync"
+- "sync/atomic"
+- "unsafe"
+-
+- "golang.org/x/sync/errgroup"
+- "golang.org/x/tools/go/packages"
+- "golang.org/x/tools/go/types/objectpath"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/source/methodsets"
+- "golang.org/x/tools/gopls/internal/lsp/source/xrefs"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+- "golang.org/x/tools/internal/gocommand"
+- "golang.org/x/tools/internal/memoize"
+- "golang.org/x/tools/internal/packagesinternal"
+- "golang.org/x/tools/internal/persistent"
+- "golang.org/x/tools/internal/typesinternal"
+-)
+-
+-type snapshot struct {
+- sequenceID uint64
+- globalID source.GlobalSnapshotID
+-
+- // TODO(rfindley): the snapshot holding a reference to the view poses
+- // lifecycle problems: a view may be shut down and waiting for work
+- // associated with this snapshot to complete. While most accesses of the view
+- // are benign (options or workspace information), this is not formalized and
+- // it is wrong for the snapshot to use a shutdown view.
+- //
+- // Fix this by passing options and workspace information to the snapshot,
+- // both of which should be immutable for the snapshot.
+- view *View
+-
+- cancel func()
+- backgroundCtx context.Context
+-
+- store *memoize.Store // cache of handles shared by all snapshots
+-
+- refcount sync.WaitGroup // number of references
+- destroyedBy *string // atomically set to non-nil in Destroy once refcount = 0
+-
+- // initialized reports whether the snapshot has been initialized. Concurrent
+- // initialization is guarded by the view.initializationSema. Each snapshot is
+- // initialized at most once: concurrent initialization is guarded by
+- // view.initializationSema.
+- initialized bool
+- // initializedErr holds the last error resulting from initialization. If
+- // initialization fails, we only retry when the the workspace modules change,
+- // to avoid too many go/packages calls.
+- initializedErr *source.CriticalError
+-
+- // mu guards all of the maps in the snapshot, as well as the builtin URI.
+- mu sync.Mutex
+-
+- // builtin pins the AST and package for builtin.go in memory.
+- builtin span.URI
+-
+- // meta holds loaded metadata.
+- //
+- // meta is guarded by mu, but the metadataGraph itself is immutable.
+- // TODO(rfindley): in many places we hold mu while operating on meta, even
+- // though we only need to hold mu while reading the pointer.
+- meta *metadataGraph
+-
+- // files maps file URIs to their corresponding FileHandles.
+- // It may invalidated when a file's content changes.
+- files filesMap
+-
+- // parseCache holds an LRU cache of recently parsed files.
+- parseCache *parseCache
+-
+- // symbolizeHandles maps each file URI to a handle for the future
+- // result of computing the symbols declared in that file.
+- symbolizeHandles *persistent.Map // from span.URI to *memoize.Promise[symbolizeResult]
+-
+- // packages maps a packageKey to a *packageHandle.
+- // It may be invalidated when a file's content changes.
+- //
+- // Invariants to preserve:
+- // - packages.Get(id).meta == meta.metadata[id] for all ids
+- // - if a package is in packages, then all of its dependencies should also
+- // be in packages, unless there is a missing import
+- packages *persistent.Map // from packageID to *packageHandle
+-
+- // activePackages maps a package ID to a memoized active package, or nil if
+- // the package is known not to be open.
+- //
+- // IDs not contained in the map are not known to be open or not open.
+- activePackages *persistent.Map // from packageID to *Package
+-
+- // analyses maps an analysisKey (which identifies a package
+- // and a set of analyzers) to the handle for the future result
+- // of loading the package and analyzing it.
+- analyses *persistent.Map // from analysisKey to analysisPromise
+-
+- // workspacePackages contains the workspace's packages, which are loaded
+- // when the view is created.
+- workspacePackages map[PackageID]PackagePath
+-
+- // shouldLoad tracks packages that need to be reloaded, mapping a PackageID
+- // to the package paths that should be used to reload it
+- //
+- // When we try to load a package, we clear it from the shouldLoad map
+- // regardless of whether the load succeeded, to prevent endless loads.
+- shouldLoad map[PackageID][]PackagePath
+-
+- // unloadableFiles keeps track of files that we've failed to load.
+- unloadableFiles map[span.URI]struct{}
+-
+- // TODO(rfindley): rename the handles below to "promises". A promise is
+- // different from a handle (we mutate the package handle.)
+-
+- // parseModHandles keeps track of any parseModHandles for the snapshot.
+- // The handles need not refer to only the view's go.mod file.
+- parseModHandles *persistent.Map // from span.URI to *memoize.Promise[parseModResult]
+-
+- // parseWorkHandles keeps track of any parseWorkHandles for the snapshot.
+- // The handles need not refer to only the view's go.work file.
+- parseWorkHandles *persistent.Map // from span.URI to *memoize.Promise[parseWorkResult]
+-
+- // Preserve go.mod-related handles to avoid garbage-collecting the results
+- // of various calls to the go command. The handles need not refer to only
+- // the view's go.mod file.
+- modTidyHandles *persistent.Map // from span.URI to *memoize.Promise[modTidyResult]
+- modWhyHandles *persistent.Map // from span.URI to *memoize.Promise[modWhyResult]
+- modVulnHandles *persistent.Map // from span.URI to *memoize.Promise[modVulnResult]
+-
+- // knownSubdirs is the set of subdirectories in the workspace, used to
+- // create glob patterns for file watching.
+- knownSubdirs knownDirsSet
+- knownSubdirsPatternCache string
+- // unprocessedSubdirChanges are any changes that might affect the set of
+- // subdirectories in the workspace. They are not reflected to knownSubdirs
+- // during the snapshot cloning step as it can slow down cloning.
+- unprocessedSubdirChanges []*fileChange
+-
+- // workspaceModFiles holds the set of mod files active in this snapshot.
+- //
+- // This is either empty, a single entry for the workspace go.mod file, or the
+- // set of mod files used by the workspace go.work file.
+- //
+- // This set is immutable inside the snapshot, and therefore is not guarded by mu.
+- workspaceModFiles map[span.URI]struct{}
+- workspaceModFilesErr error // error encountered computing workspaceModFiles
+-}
+-
+-var globalSnapshotID uint64
+-
+-func nextSnapshotID() source.GlobalSnapshotID {
+- return source.GlobalSnapshotID(atomic.AddUint64(&globalSnapshotID, 1))
+-}
+-
+-var _ memoize.RefCounted = (*snapshot)(nil) // snapshots are reference-counted
+-
+-// Acquire prevents the snapshot from being destroyed until the returned function is called.
+-//
+-// (s.Acquire().release() could instead be expressed as a pair of
+-// method calls s.IncRef(); s.DecRef(). The latter has the advantage
+-// that the DecRefs are fungible and don't require holding anything in
+-// addition to the refcounted object s, but paradoxically that is also
+-// an advantage of the current approach, which forces the caller to
+-// consider the release function at every stage, making a reference
+-// leak more obvious.)
+-func (s *snapshot) Acquire() func() {
+- type uP = unsafe.Pointer
+- if destroyedBy := atomic.LoadPointer((*uP)(uP(&s.destroyedBy))); destroyedBy != nil {
+- log.Panicf("%d: acquire() after Destroy(%q)", s.globalID, *(*string)(destroyedBy))
+- }
+- s.refcount.Add(1)
+- return s.refcount.Done
+-}
+-
+-func (s *snapshot) awaitPromise(ctx context.Context, p *memoize.Promise) (interface{}, error) {
+- return p.Get(ctx, s)
+-}
+-
+-// destroy waits for all leases on the snapshot to expire then releases
+-// any resources (reference counts and files) associated with it.
+-// Snapshots being destroyed can be awaited using v.destroyWG.
+-//
+-// TODO(adonovan): move this logic into the release function returned
+-// by Acquire when the reference count becomes zero. (This would cost
+-// us the destroyedBy debug info, unless we add it to the signature of
+-// memoize.RefCounted.Acquire.)
+-//
+-// The destroyedBy argument is used for debugging.
+-//
+-// v.snapshotMu must be held while calling this function, in order to preserve
+-// the invariants described by the the docstring for v.snapshot.
+-func (v *View) destroy(s *snapshot, destroyedBy string) {
+- v.snapshotWG.Add(1)
+- go func() {
+- defer v.snapshotWG.Done()
+- s.destroy(destroyedBy)
+- }()
+-}
+-
+-func (s *snapshot) destroy(destroyedBy string) {
+- // Wait for all leases to end before commencing destruction.
+- s.refcount.Wait()
+-
+- // Report bad state as a debugging aid.
+- // Not foolproof: another thread could acquire() at this moment.
+- type uP = unsafe.Pointer // looking forward to generics...
+- if old := atomic.SwapPointer((*uP)(uP(&s.destroyedBy)), uP(&destroyedBy)); old != nil {
+- log.Panicf("%d: Destroy(%q) after Destroy(%q)", s.globalID, destroyedBy, *(*string)(old))
+- }
+-
+- s.packages.Destroy()
+- s.activePackages.Destroy()
+- s.analyses.Destroy()
+- s.files.Destroy()
+- s.knownSubdirs.Destroy()
+- s.symbolizeHandles.Destroy()
+- s.parseModHandles.Destroy()
+- s.parseWorkHandles.Destroy()
+- s.modTidyHandles.Destroy()
+- s.modVulnHandles.Destroy()
+- s.modWhyHandles.Destroy()
+-}
+-
+-func (s *snapshot) SequenceID() uint64 {
+- return s.sequenceID
+-}
+-
+-func (s *snapshot) GlobalID() source.GlobalSnapshotID {
+- return s.globalID
+-}
+-
+-func (s *snapshot) View() source.View {
+- return s.view
+-}
+-
+-func (s *snapshot) BackgroundContext() context.Context {
+- return s.backgroundCtx
+-}
+-
+-func (s *snapshot) ModFiles() []span.URI {
+- var uris []span.URI
+- for modURI := range s.workspaceModFiles {
+- uris = append(uris, modURI)
+- }
+- return uris
+-}
+-
+-func (s *snapshot) WorkFile() span.URI {
+- return s.view.effectiveGOWORK()
+-}
+-
+-func (s *snapshot) Templates() map[span.URI]source.FileHandle {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- tmpls := map[span.URI]source.FileHandle{}
+- s.files.Range(func(k span.URI, fh source.FileHandle) {
+- if s.view.FileKind(fh) == source.Tmpl {
+- tmpls[k] = fh
+- }
+- })
+- return tmpls
+-}
+-
+-func (s *snapshot) ValidBuildConfiguration() bool {
+- // Since we only really understand the `go` command, if the user has a
+- // different GOPACKAGESDRIVER, assume that their configuration is valid.
+- if s.view.hasGopackagesDriver {
+- return true
+- }
+- // Check if the user is working within a module or if we have found
+- // multiple modules in the workspace.
+- if len(s.workspaceModFiles) > 0 {
+- return true
+- }
+- // The user may have a multiple directories in their GOPATH.
+- // Check if the workspace is within any of them.
+- // TODO(rfindley): this should probably be subject to "if GO111MODULES = off {...}".
+- for _, gp := range filepath.SplitList(s.view.gopath) {
+- if source.InDir(filepath.Join(gp, "src"), s.view.folder.Filename()) {
+- return true
+- }
+- }
+- return false
+-}
+-
+-// moduleMode reports whether the current snapshot uses Go modules.
+-//
+-// From https://go.dev/ref/mod, module mode is active if either of the
+-// following hold:
+-// - GO111MODULE=on
+-// - GO111MODULE=auto and we are inside a module or have a GOWORK value.
+-//
+-// Additionally, this method returns false if GOPACKAGESDRIVER is set.
+-//
+-// TODO(rfindley): use this more widely.
+-func (s *snapshot) moduleMode() bool {
+- // Since we only really understand the `go` command, if the user has a
+- // different GOPACKAGESDRIVER, assume that their configuration is valid.
+- if s.view.hasGopackagesDriver {
+- return false
+- }
+-
+- switch s.view.effectiveGO111MODULE() {
+- case on:
+- return true
+- case off:
+- return false
+- default:
+- return len(s.workspaceModFiles) > 0 || s.view.gowork != ""
+- }
+-}
+-
+-// workspaceMode describes the way in which the snapshot's workspace should
+-// be loaded.
+-//
+-// TODO(rfindley): remove this, in favor of specific methods.
+-func (s *snapshot) workspaceMode() workspaceMode {
+- var mode workspaceMode
+-
+- // If the view has an invalid configuration, don't build the workspace
+- // module.
+- validBuildConfiguration := s.ValidBuildConfiguration()
+- if !validBuildConfiguration {
+- return mode
+- }
+- // If the view is not in a module and contains no modules, but still has a
+- // valid workspace configuration, do not create the workspace module.
+- // It could be using GOPATH or a different build system entirely.
+- if len(s.workspaceModFiles) == 0 && validBuildConfiguration {
+- return mode
+- }
+- mode |= moduleMode
+- options := s.view.Options()
+- if options.TempModfile {
+- mode |= tempModfile
+- }
+- return mode
+-}
+-
+-// config returns the configuration used for the snapshot's interaction with
+-// the go/packages API. It uses the given working directory.
+-//
+-// TODO(rstambler): go/packages requires that we do not provide overlays for
+-// multiple modules in on config, so buildOverlay needs to filter overlays by
+-// module.
+-func (s *snapshot) config(ctx context.Context, inv *gocommand.Invocation) *packages.Config {
+- s.view.optionsMu.Lock()
+- verboseOutput := s.view.options.VerboseOutput
+- s.view.optionsMu.Unlock()
+-
+- cfg := &packages.Config{
+- Context: ctx,
+- Dir: inv.WorkingDir,
+- Env: inv.Env,
+- BuildFlags: inv.BuildFlags,
+- Mode: packages.NeedName |
+- packages.NeedFiles |
+- packages.NeedCompiledGoFiles |
+- packages.NeedImports |
+- packages.NeedDeps |
+- packages.NeedTypesSizes |
+- packages.NeedModule |
+- packages.NeedEmbedFiles |
+- packages.LoadMode(packagesinternal.DepsErrors) |
+- packages.LoadMode(packagesinternal.ForTest),
+- Fset: nil, // we do our own parsing
+- Overlay: s.buildOverlay(),
+- ParseFile: func(*token.FileSet, string, []byte) (*ast.File, error) {
+- panic("go/packages must not be used to parse files")
+- },
+- Logf: func(format string, args ...interface{}) {
+- if verboseOutput {
+- event.Log(ctx, fmt.Sprintf(format, args...))
+- }
+- },
+- Tests: true,
+- }
+- packagesinternal.SetModFile(cfg, inv.ModFile)
+- packagesinternal.SetModFlag(cfg, inv.ModFlag)
+- // We want to type check cgo code if go/types supports it.
+- if typesinternal.SetUsesCgo(&types.Config{}) {
+- cfg.Mode |= packages.LoadMode(packagesinternal.TypecheckCgo)
+- }
+- packagesinternal.SetGoCmdRunner(cfg, s.view.gocmdRunner)
+- return cfg
+-}
+-
+-func (s *snapshot) RunGoCommandDirect(ctx context.Context, mode source.InvocationFlags, inv *gocommand.Invocation) (*bytes.Buffer, error) {
+- _, inv, cleanup, err := s.goCommandInvocation(ctx, mode, inv)
+- if err != nil {
+- return nil, err
+- }
+- defer cleanup()
+-
+- return s.view.gocmdRunner.Run(ctx, *inv)
+-}
+-
+-func (s *snapshot) RunGoCommandPiped(ctx context.Context, mode source.InvocationFlags, inv *gocommand.Invocation, stdout, stderr io.Writer) error {
+- _, inv, cleanup, err := s.goCommandInvocation(ctx, mode, inv)
+- if err != nil {
+- return err
+- }
+- defer cleanup()
+- return s.view.gocmdRunner.RunPiped(ctx, *inv, stdout, stderr)
+-}
+-
+-func (s *snapshot) RunGoCommands(ctx context.Context, allowNetwork bool, wd string, run func(invoke func(...string) (*bytes.Buffer, error)) error) (bool, []byte, []byte, error) {
+- var flags source.InvocationFlags
+- if s.workspaceMode()&tempModfile != 0 {
+- flags = source.WriteTemporaryModFile
+- } else {
+- flags = source.Normal
+- }
+- if allowNetwork {
+- flags |= source.AllowNetwork
+- }
+- tmpURI, inv, cleanup, err := s.goCommandInvocation(ctx, flags, &gocommand.Invocation{WorkingDir: wd})
+- if err != nil {
+- return false, nil, nil, err
+- }
+- defer cleanup()
+- invoke := func(args ...string) (*bytes.Buffer, error) {
+- inv.Verb = args[0]
+- inv.Args = args[1:]
+- return s.view.gocmdRunner.Run(ctx, *inv)
+- }
+- if err := run(invoke); err != nil {
+- return false, nil, nil, err
+- }
+- if flags.Mode() != source.WriteTemporaryModFile {
+- return false, nil, nil, nil
+- }
+- var modBytes, sumBytes []byte
+- modBytes, err = ioutil.ReadFile(tmpURI.Filename())
+- if err != nil && !os.IsNotExist(err) {
+- return false, nil, nil, err
+- }
+- sumBytes, err = ioutil.ReadFile(strings.TrimSuffix(tmpURI.Filename(), ".mod") + ".sum")
+- if err != nil && !os.IsNotExist(err) {
+- return false, nil, nil, err
+- }
+- return true, modBytes, sumBytes, nil
+-}
+-
+-// goCommandInvocation populates inv with configuration for running go commands on the snapshot.
+-//
+-// TODO(rfindley): refactor this function to compose the required configuration
+-// explicitly, rather than implicitly deriving it from flags and inv.
+-//
+-// TODO(adonovan): simplify cleanup mechanism. It's hard to see, but
+-// it used only after call to tempModFile. Clarify that it is only
+-// non-nil on success.
+-func (s *snapshot) goCommandInvocation(ctx context.Context, flags source.InvocationFlags, inv *gocommand.Invocation) (tmpURI span.URI, updatedInv *gocommand.Invocation, cleanup func(), err error) {
+- s.view.optionsMu.Lock()
+- allowModfileModificationOption := s.view.options.AllowModfileModifications
+- allowNetworkOption := s.view.options.AllowImplicitNetworkAccess
+-
+- // TODO(rfindley): this is very hard to follow, and may not even be doing the
+- // right thing: should inv.Env really trample view.options? Do we ever invoke
+- // this with a non-empty inv.Env?
+- //
+- // We should refactor to make it clearer that the correct env is being used.
+- inv.Env = append(append(append(os.Environ(), s.view.options.EnvSlice()...), inv.Env...), "GO111MODULE="+s.view.GO111MODULE())
+- inv.BuildFlags = append([]string{}, s.view.options.BuildFlags...)
+- s.view.optionsMu.Unlock()
+- cleanup = func() {} // fallback
+-
+- // All logic below is for module mode.
+- if s.workspaceMode()&moduleMode == 0 {
+- return "", inv, cleanup, nil
+- }
+-
+- mode, allowNetwork := flags.Mode(), flags.AllowNetwork()
+- if !allowNetwork && !allowNetworkOption {
+- inv.Env = append(inv.Env, "GOPROXY=off")
+- }
+-
+- // What follows is rather complicated logic for how to actually run the go
+- // command. A word of warning: this is the result of various incremental
+- // features added to gopls, and varying behavior of the Go command across Go
+- // versions. It can surely be cleaned up significantly, but tread carefully.
+- //
+- // Roughly speaking we need to resolve four things:
+- // - the working directory.
+- // - the -mod flag
+- // - the -modfile flag
+- //
+- // These are dependent on a number of factors: whether we need to run in a
+- // synthetic workspace, whether flags are supported at the current go
+- // version, and what we're actually trying to achieve (the
+- // source.InvocationFlags).
+-
+- var modURI span.URI
+- // Select the module context to use.
+- // If we're type checking, we need to use the workspace context, meaning
+- // the main (workspace) module. Otherwise, we should use the module for
+- // the passed-in working dir.
+- if mode == source.LoadWorkspace {
+- if s.view.effectiveGOWORK() == "" && s.view.gomod != "" {
+- modURI = s.view.gomod
+- }
+- } else {
+- modURI = s.GoModForFile(span.URIFromPath(inv.WorkingDir))
+- }
+-
+- var modContent []byte
+- if modURI != "" {
+- modFH, err := s.GetFile(ctx, modURI)
+- if err != nil {
+- return "", nil, cleanup, err
+- }
+- modContent, err = modFH.Read()
+- if err != nil {
+- return "", nil, cleanup, err
+- }
+- }
+-
+- // TODO(rfindley): in the case of go.work mode, modURI is empty and we fall
+- // back on the default behavior of vendorEnabled with an empty modURI. Figure
+- // out what is correct here and implement it explicitly.
+- vendorEnabled, err := s.vendorEnabled(ctx, modURI, modContent)
+- if err != nil {
+- return "", nil, cleanup, err
+- }
+-
+- const mutableModFlag = "mod"
+- // If the mod flag isn't set, populate it based on the mode and workspace.
+- // TODO(rfindley): this doesn't make sense if we're not in module mode
+- if inv.ModFlag == "" {
+- switch mode {
+- case source.LoadWorkspace, source.Normal:
+- if vendorEnabled {
+- inv.ModFlag = "vendor"
+- } else if !allowModfileModificationOption {
+- inv.ModFlag = "readonly"
+- } else {
+- inv.ModFlag = mutableModFlag
+- }
+- case source.WriteTemporaryModFile:
+- inv.ModFlag = mutableModFlag
+- // -mod must be readonly when using go.work files - see issue #48941
+- inv.Env = append(inv.Env, "GOWORK=off")
+- }
+- }
+-
+- // Only use a temp mod file if the modfile can actually be mutated.
+- needTempMod := inv.ModFlag == mutableModFlag
+- useTempMod := s.workspaceMode()&tempModfile != 0
+- if needTempMod && !useTempMod {
+- return "", nil, cleanup, source.ErrTmpModfileUnsupported
+- }
+-
+- // We should use -modfile if:
+- // - the workspace mode supports it
+- // - we're using a go.work file on go1.18+, or we need a temp mod file (for
+- // example, if running go mod tidy in a go.work workspace)
+- //
+- // TODO(rfindley): this is very hard to follow. Refactor.
+- if !needTempMod && s.view.gowork != "" {
+- // Since we're running in the workspace root, the go command will resolve GOWORK automatically.
+- } else if useTempMod {
+- if modURI == "" {
+- return "", nil, cleanup, fmt.Errorf("no go.mod file found in %s", inv.WorkingDir)
+- }
+- modFH, err := s.GetFile(ctx, modURI)
+- if err != nil {
+- return "", nil, cleanup, err
+- }
+- // Use the go.sum if it happens to be available.
+- gosum := s.goSum(ctx, modURI)
+- tmpURI, cleanup, err = tempModFile(modFH, gosum)
+- if err != nil {
+- return "", nil, cleanup, err
+- }
+- inv.ModFile = tmpURI.Filename()
+- }
+-
+- return tmpURI, inv, cleanup, nil
+-}
+-
+-func (s *snapshot) buildOverlay() map[string][]byte {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- overlays := make(map[string][]byte)
+- s.files.Range(func(uri span.URI, fh source.FileHandle) {
+- overlay, ok := fh.(*Overlay)
+- if !ok {
+- return
+- }
+- if overlay.saved {
+- return
+- }
+- // TODO(rstambler): Make sure not to send overlays outside of the current view.
+- overlays[uri.Filename()] = overlay.content
+- })
+- return overlays
+-}
+-
+-// Package data kinds, identifying various package data that may be stored in
+-// the file cache.
+-const (
+- xrefsKind = "xrefs"
+- methodSetsKind = "methodsets"
+- exportDataKind = "export"
+- diagnosticsKind = "diagnostics"
+-)
+-
+-func (s *snapshot) PackageDiagnostics(ctx context.Context, ids ...PackageID) (map[span.URI][]*source.Diagnostic, error) {
+- // TODO(rfindley): opt: avoid unnecessary encode->decode after type-checking.
+- data, err := s.getPackageData(ctx, diagnosticsKind, ids, func(p *syntaxPackage) []byte {
+- return encodeDiagnostics(p.diagnostics)
+- })
+- perFile := make(map[span.URI][]*source.Diagnostic)
+- for _, data := range data {
+- if data != nil {
+- for _, diag := range data.m.Diagnostics {
+- perFile[diag.URI] = append(perFile[diag.URI], diag)
+- }
+- diags := decodeDiagnostics(data.data)
+- for _, diag := range diags {
+- perFile[diag.URI] = append(perFile[diag.URI], diag)
+- }
+- }
+- }
+- return perFile, err
+-}
+-
+-func (s *snapshot) References(ctx context.Context, ids ...PackageID) ([]source.XrefIndex, error) {
+- data, err := s.getPackageData(ctx, xrefsKind, ids, func(p *syntaxPackage) []byte { return p.xrefs })
+- indexes := make([]source.XrefIndex, len(ids))
+- for i, data := range data {
+- if data != nil {
+- indexes[i] = XrefIndex{m: data.m, data: data.data}
+- }
+- }
+- return indexes, err
+-}
+-
+-// An XrefIndex is a helper for looking up a package in a given package.
+-type XrefIndex struct {
+- m *source.Metadata
+- data []byte
+-}
+-
+-func (index XrefIndex) Lookup(targets map[PackagePath]map[objectpath.Path]struct{}) []protocol.Location {
+- return xrefs.Lookup(index.m, index.data, targets)
+-}
+-
+-func (s *snapshot) MethodSets(ctx context.Context, ids ...PackageID) ([]*methodsets.Index, error) {
+- // TODO(rfindley): opt: avoid unnecessary encode->decode after type-checking.
+- data, err := s.getPackageData(ctx, methodSetsKind, ids, func(p *syntaxPackage) []byte {
+- return p.methodsets.Encode()
+- })
+- indexes := make([]*methodsets.Index, len(ids))
+- for i, data := range data {
+- if data != nil {
+- indexes[i] = methodsets.Decode(data.data)
+- } else if ids[i] == "unsafe" {
+- indexes[i] = &methodsets.Index{}
+- } else {
+- panic(fmt.Sprintf("nil data for %s", ids[i]))
+- }
+- }
+- return indexes, err
+-}
+-
+-func (s *snapshot) MetadataForFile(ctx context.Context, uri span.URI) ([]*source.Metadata, error) {
+- s.mu.Lock()
+-
+- // Start with the set of package associations derived from the last load.
+- ids := s.meta.ids[uri]
+-
+- shouldLoad := false // whether any packages containing uri are marked 'shouldLoad'
+- for _, id := range ids {
+- if len(s.shouldLoad[id]) > 0 {
+- shouldLoad = true
+- }
+- }
+-
+- // Check if uri is known to be unloadable.
+- _, unloadable := s.unloadableFiles[uri]
+-
+- s.mu.Unlock()
+-
+- // Reload if loading is likely to improve the package associations for uri:
+- // - uri is not contained in any valid packages
+- // - ...or one of the packages containing uri is marked 'shouldLoad'
+- // - ...but uri is not unloadable
+- if (shouldLoad || len(ids) == 0) && !unloadable {
+- scope := fileLoadScope(uri)
+- err := s.load(ctx, false, scope)
+-
+- // Guard against failed loads due to context cancellation.
+- //
+- // Return the context error here as the current operation is no longer
+- // valid.
+- if ctxErr := ctx.Err(); ctxErr != nil {
+- return nil, ctxErr
+- }
+-
+- // We must clear scopes after loading.
+- //
+- // TODO(rfindley): unlike reloadWorkspace, this is simply marking loaded
+- // packages as loaded. We could do this from snapshot.load and avoid
+- // raciness.
+- s.clearShouldLoad(scope)
+-
+- // Don't return an error here, as we may still return stale IDs.
+- // Furthermore, the result of MetadataForFile should be consistent upon
+- // subsequent calls, even if the file is marked as unloadable.
+- if err != nil && !errors.Is(err, errNoPackages) {
+- event.Error(ctx, "MetadataForFile", err)
+- }
+- }
+-
+- // Retrieve the metadata.
+- s.mu.Lock()
+- defer s.mu.Unlock()
+- ids = s.meta.ids[uri]
+- metas := make([]*source.Metadata, len(ids))
+- for i, id := range ids {
+- metas[i] = s.meta.metadata[id]
+- if metas[i] == nil {
+- panic("nil metadata")
+- }
+- }
+- // Metadata is only ever added by loading,
+- // so if we get here and still have
+- // no IDs, uri is unloadable.
+- if !unloadable && len(ids) == 0 {
+- s.unloadableFiles[uri] = struct{}{}
+- }
+-
+- // Sort packages "narrowest" to "widest" (in practice: non-tests before tests).
+- sort.Slice(metas, func(i, j int) bool {
+- return len(metas[i].CompiledGoFiles) < len(metas[j].CompiledGoFiles)
+- })
+-
+- return metas, nil
+-}
+-
+-func (s *snapshot) ReverseDependencies(ctx context.Context, id PackageID, transitive bool) (map[PackageID]*source.Metadata, error) {
+- if err := s.awaitLoaded(ctx); err != nil {
+- return nil, err
+- }
+- s.mu.Lock()
+- meta := s.meta
+- s.mu.Unlock()
+-
+- var rdeps map[PackageID]*source.Metadata
+- if transitive {
+- rdeps = meta.reverseReflexiveTransitiveClosure(id)
+-
+- // Remove the original package ID from the map.
+- // (Callers all want irreflexivity but it's easier
+- // to compute reflexively then subtract.)
+- delete(rdeps, id)
+-
+- } else {
+- // direct reverse dependencies
+- rdeps = make(map[PackageID]*source.Metadata)
+- for _, rdepID := range meta.importedBy[id] {
+- if rdep := meta.metadata[rdepID]; rdep != nil {
+- rdeps[rdepID] = rdep
+- }
+- }
+- }
+-
+- return rdeps, nil
+-}
+-
+-func (s *snapshot) workspaceMetadata() (meta []*source.Metadata) {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- for id := range s.workspacePackages {
+- meta = append(meta, s.meta.metadata[id])
+- }
+- return meta
+-}
+-
+-// -- Active package tracking --
+-//
+-// We say a package is "active" if any of its files are open. After
+-// type-checking we keep active packages in memory. The activePackages
+-// peristent map does bookkeeping for the set of active packages.
+-
+-// getActivePackage returns a the memoized active package for id, if it exists.
+-// If id is not active or has not yet been type-checked, it returns nil.
+-func (s *snapshot) getActivePackage(id PackageID) *Package {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- if value, ok := s.activePackages.Get(id); ok {
+- return value.(*Package) // possibly nil, if we have already checked this id.
+- }
+- return nil
+-}
+-
+-// memoizeActivePackage checks if pkg is active, and if so either records it in
+-// the active packages map or returns the existing memoized active package for id.
+-//
+-// The resulting package is non-nil if and only if the specified package is open.
+-func (s *snapshot) memoizeActivePackage(id PackageID, pkg *Package) (active *Package) {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- if value, ok := s.activePackages.Get(id); ok {
+- return value.(*Package) // possibly nil, if we have already checked this id.
+- }
+-
+- defer func() {
+- s.activePackages.Set(id, active, nil) // store the result either way: remember that pkg is not open
+- }()
+- for _, cgf := range pkg.Metadata().GoFiles {
+- if s.isOpenLocked(cgf) {
+- return pkg
+- }
+- }
+- for _, cgf := range pkg.Metadata().CompiledGoFiles {
+- if s.isOpenLocked(cgf) {
+- return pkg
+- }
+- }
+- return nil
+-}
+-
+-func (s *snapshot) resetActivePackagesLocked() {
+- s.activePackages.Destroy()
+- s.activePackages = persistent.NewMap(packageIDLessInterface)
+-}
+-
+-const fileExtensions = "go,mod,sum,work"
+-
+-func (s *snapshot) fileWatchingGlobPatterns(ctx context.Context) map[string]struct{} {
+- extensions := fileExtensions
+- for _, ext := range s.View().Options().TemplateExtensions {
+- extensions += "," + ext
+- }
+- // Work-around microsoft/vscode#100870 by making sure that we are,
+- // at least, watching the user's entire workspace. This will still be
+- // applied to every folder in the workspace.
+- patterns := map[string]struct{}{
+- fmt.Sprintf("**/*.{%s}", extensions): {},
+- }
+-
+- // If GOWORK is outside the folder, ensure we are watching it.
+- gowork := s.view.effectiveGOWORK()
+- if gowork != "" && !source.InDir(s.view.folder.Filename(), gowork.Filename()) {
+- patterns[gowork.Filename()] = struct{}{}
+- }
+-
+- // Add a pattern for each Go module in the workspace that is not within the view.
+- dirs := s.dirs(ctx)
+- for _, dir := range dirs {
+- dirName := dir.Filename()
+-
+- // If the directory is within the view's folder, we're already watching
+- // it with the first pattern above.
+- if source.InDir(s.view.folder.Filename(), dirName) {
+- continue
+- }
+- // TODO(rstambler): If microsoft/vscode#3025 is resolved before
+- // microsoft/vscode#101042, we will need a work-around for Windows
+- // drive letter casing.
+- patterns[fmt.Sprintf("%s/**/*.{%s}", dirName, extensions)] = struct{}{}
+- }
+-
+- // Some clients do not send notifications for changes to directories that
+- // contain Go code (golang/go#42348). To handle this, explicitly watch all
+- // of the directories in the workspace. We find them by adding the
+- // directories of every file in the snapshot's workspace directories.
+- // There may be thousands.
+- if pattern := s.getKnownSubdirsPattern(dirs); pattern != "" {
+- patterns[pattern] = struct{}{}
+- }
+-
+- return patterns
+-}
+-
+-func (s *snapshot) getKnownSubdirsPattern(wsDirs []span.URI) string {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- // First, process any pending changes and update the set of known
+- // subdirectories.
+- // It may change list of known subdirs and therefore invalidate the cache.
+- s.applyKnownSubdirsChangesLocked(wsDirs)
+-
+- if s.knownSubdirsPatternCache == "" {
+- var builder strings.Builder
+- s.knownSubdirs.Range(func(uri span.URI) {
+- if builder.Len() == 0 {
+- builder.WriteString("{")
+- } else {
+- builder.WriteString(",")
+- }
+- builder.WriteString(uri.Filename())
+- })
+- if builder.Len() > 0 {
+- builder.WriteString("}")
+- s.knownSubdirsPatternCache = builder.String()
+- }
+- }
+-
+- return s.knownSubdirsPatternCache
+-}
+-
+-// collectAllKnownSubdirs collects all of the subdirectories within the
+-// snapshot's workspace directories. None of the workspace directories are
+-// included.
+-func (s *snapshot) collectAllKnownSubdirs(ctx context.Context) {
+- dirs := s.dirs(ctx)
+-
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- s.knownSubdirs.Destroy()
+- s.knownSubdirs = newKnownDirsSet()
+- s.knownSubdirsPatternCache = ""
+- s.files.Range(func(uri span.URI, fh source.FileHandle) {
+- s.addKnownSubdirLocked(uri, dirs)
+- })
+-}
+-
+-func (s *snapshot) getKnownSubdirs(wsDirs []span.URI) knownDirsSet {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- // First, process any pending changes and update the set of known
+- // subdirectories.
+- s.applyKnownSubdirsChangesLocked(wsDirs)
+-
+- return s.knownSubdirs.Clone()
+-}
+-
+-func (s *snapshot) applyKnownSubdirsChangesLocked(wsDirs []span.URI) {
+- for _, c := range s.unprocessedSubdirChanges {
+- if c.isUnchanged {
+- continue
+- }
+- if !c.exists {
+- s.removeKnownSubdirLocked(c.fileHandle.URI())
+- } else {
+- s.addKnownSubdirLocked(c.fileHandle.URI(), wsDirs)
+- }
+- }
+- s.unprocessedSubdirChanges = nil
+-}
+-
+-func (s *snapshot) addKnownSubdirLocked(uri span.URI, dirs []span.URI) {
+- dir := filepath.Dir(uri.Filename())
+- // First check if the directory is already known, because then we can
+- // return early.
+- if s.knownSubdirs.Contains(span.URIFromPath(dir)) {
+- return
+- }
+- var matched span.URI
+- for _, wsDir := range dirs {
+- if source.InDir(wsDir.Filename(), dir) {
+- matched = wsDir
+- break
+- }
+- }
+- // Don't watch any directory outside of the workspace directories.
+- if matched == "" {
+- return
+- }
+- for {
+- if dir == "" || dir == matched.Filename() {
+- break
+- }
+- uri := span.URIFromPath(dir)
+- if s.knownSubdirs.Contains(uri) {
+- break
+- }
+- s.knownSubdirs.Insert(uri)
+- dir = filepath.Dir(dir)
+- s.knownSubdirsPatternCache = ""
+- }
+-}
+-
+-func (s *snapshot) removeKnownSubdirLocked(uri span.URI) {
+- dir := filepath.Dir(uri.Filename())
+- for dir != "" {
+- uri := span.URIFromPath(dir)
+- if !s.knownSubdirs.Contains(uri) {
+- break
+- }
+- if info, _ := os.Stat(dir); info == nil {
+- s.knownSubdirs.Remove(uri)
+- s.knownSubdirsPatternCache = ""
+- }
+- dir = filepath.Dir(dir)
+- }
+-}
+-
+-// knownFilesInDir returns the files known to the given snapshot that are in
+-// the given directory. It does not respect symlinks.
+-func (s *snapshot) knownFilesInDir(ctx context.Context, dir span.URI) []span.URI {
+- var files []span.URI
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- s.files.Range(func(uri span.URI, fh source.FileHandle) {
+- if source.InDir(dir.Filename(), uri.Filename()) {
+- files = append(files, uri)
+- }
+- })
+- return files
+-}
+-
+-func (s *snapshot) ActiveMetadata(ctx context.Context) ([]*source.Metadata, error) {
+- if err := s.awaitLoaded(ctx); err != nil {
+- return nil, err
+- }
+- return s.workspaceMetadata(), nil
+-}
+-
+-// Symbols extracts and returns symbol information for every file contained in
+-// a loaded package. It awaits snapshot loading.
+-//
+-// TODO(rfindley): move this to the top of cache/symbols.go
+-func (s *snapshot) Symbols(ctx context.Context) (map[span.URI][]source.Symbol, error) {
+- if err := s.awaitLoaded(ctx); err != nil {
+- return nil, err
+- }
+-
+- // Build symbols for all loaded Go files.
+- s.mu.Lock()
+- meta := s.meta
+- s.mu.Unlock()
+-
+- goFiles := make(map[span.URI]struct{})
+- for _, m := range meta.metadata {
+- for _, uri := range m.GoFiles {
+- goFiles[uri] = struct{}{}
+- }
+- for _, uri := range m.CompiledGoFiles {
+- goFiles[uri] = struct{}{}
+- }
+- }
+-
+- // Symbolize them in parallel.
+- var (
+- group errgroup.Group
+- nprocs = 2 * runtime.GOMAXPROCS(-1) // symbolize is a mix of I/O and CPU
+- resultMu sync.Mutex
+- result = make(map[span.URI][]source.Symbol)
+- )
+- group.SetLimit(nprocs)
+- for uri := range goFiles {
+- uri := uri
+- group.Go(func() error {
+- symbols, err := s.symbolize(ctx, uri)
+- if err != nil {
+- return err
+- }
+- resultMu.Lock()
+- result[uri] = symbols
+- resultMu.Unlock()
+- return nil
+- })
+- }
+- // Keep going on errors, but log the first failure.
+- // Partial results are better than no symbol results.
+- if err := group.Wait(); err != nil {
+- event.Error(ctx, "getting snapshot symbols", err)
+- }
+- return result, nil
+-}
+-
+-func (s *snapshot) AllMetadata(ctx context.Context) ([]*source.Metadata, error) {
+- if err := s.awaitLoaded(ctx); err != nil {
+- return nil, err
+- }
+-
+- s.mu.Lock()
+- g := s.meta
+- s.mu.Unlock()
+-
+- meta := make([]*source.Metadata, 0, len(g.metadata))
+- for _, m := range g.metadata {
+- meta = append(meta, m)
+- }
+- return meta, nil
+-}
+-
+-// TODO(rfindley): clarify that this is only active modules. Or update to just
+-// use findRootPattern.
+-func (s *snapshot) GoModForFile(uri span.URI) span.URI {
+- return moduleForURI(s.workspaceModFiles, uri)
+-}
+-
+-func moduleForURI(modFiles map[span.URI]struct{}, uri span.URI) span.URI {
+- var match span.URI
+- for modURI := range modFiles {
+- if !source.InDir(span.Dir(modURI).Filename(), uri.Filename()) {
+- continue
+- }
+- if len(modURI) > len(match) {
+- match = modURI
+- }
+- }
+- return match
+-}
+-
+-// nearestModFile finds the nearest go.mod file contained in the directory
+-// containing uri, or a parent of that directory.
+-//
+-// The given uri must be a file, not a directory.
+-func nearestModFile(ctx context.Context, uri span.URI, fs source.FileSource) (span.URI, error) {
+- // TODO(rfindley)
+- dir := filepath.Dir(uri.Filename())
+- mod, err := findRootPattern(ctx, dir, "go.mod", fs)
+- if err != nil {
+- return "", err
+- }
+- return span.URIFromPath(mod), nil
+-}
+-
+-func (s *snapshot) Metadata(id PackageID) *source.Metadata {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+- return s.meta.metadata[id]
+-}
+-
+-// clearShouldLoad clears package IDs that no longer need to be reloaded after
+-// scopes has been loaded.
+-func (s *snapshot) clearShouldLoad(scopes ...loadScope) {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- for _, scope := range scopes {
+- switch scope := scope.(type) {
+- case packageLoadScope:
+- scopePath := PackagePath(scope)
+- var toDelete []PackageID
+- for id, pkgPaths := range s.shouldLoad {
+- for _, pkgPath := range pkgPaths {
+- if pkgPath == scopePath {
+- toDelete = append(toDelete, id)
+- }
+- }
+- }
+- for _, id := range toDelete {
+- delete(s.shouldLoad, id)
+- }
+- case fileLoadScope:
+- uri := span.URI(scope)
+- ids := s.meta.ids[uri]
+- for _, id := range ids {
+- delete(s.shouldLoad, id)
+- }
+- }
+- }
+-}
+-
+-// noValidMetadataForURILocked reports whether there is any valid metadata for
+-// the given URI.
+-func (s *snapshot) noValidMetadataForURILocked(uri span.URI) bool {
+- for _, id := range s.meta.ids[uri] {
+- if _, ok := s.meta.metadata[id]; ok {
+- return false
+- }
+- }
+- return true
+-}
+-
+-func (s *snapshot) isWorkspacePackage(id PackageID) bool {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- _, ok := s.workspacePackages[id]
+- return ok
+-}
+-
+-func (s *snapshot) FindFile(uri span.URI) source.FileHandle {
+- s.view.markKnown(uri)
+-
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- result, _ := s.files.Get(uri)
+- return result
+-}
+-
+-// GetFile returns a File for the given URI. If the file is unknown it is added
+-// to the managed set.
+-//
+-// GetFile succeeds even if the file does not exist. A non-nil error return
+-// indicates some type of internal error, for example if ctx is cancelled.
+-func (s *snapshot) GetFile(ctx context.Context, uri span.URI) (source.FileHandle, error) {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- return lockedSnapshot{s}.GetFile(ctx, uri)
+-}
+-
+-// A lockedSnapshot implements the source.FileSource interface while holding
+-// the lock for the wrapped snapshot.
+-type lockedSnapshot struct{ wrapped *snapshot }
+-
+-func (s lockedSnapshot) GetFile(ctx context.Context, uri span.URI) (source.FileHandle, error) {
+- s.wrapped.view.markKnown(uri)
+- if fh, ok := s.wrapped.files.Get(uri); ok {
+- return fh, nil
+- }
+-
+- fh, err := s.wrapped.view.fs.GetFile(ctx, uri) // read the file
+- if err != nil {
+- return nil, err
+- }
+- s.wrapped.files.Set(uri, fh)
+- return fh, nil
+-}
+-
+-func (s *snapshot) IsOpen(uri span.URI) bool {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+- return s.isOpenLocked(uri)
+-
+-}
+-
+-func (s *snapshot) openFiles() []source.FileHandle {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- var open []source.FileHandle
+- s.files.Range(func(uri span.URI, fh source.FileHandle) {
+- if isFileOpen(fh) {
+- open = append(open, fh)
+- }
+- })
+- return open
+-}
+-
+-func (s *snapshot) isOpenLocked(uri span.URI) bool {
+- fh, _ := s.files.Get(uri)
+- return isFileOpen(fh)
+-}
+-
+-func isFileOpen(fh source.FileHandle) bool {
+- _, open := fh.(*Overlay)
+- return open
+-}
+-
+-func (s *snapshot) awaitLoaded(ctx context.Context) error {
+- loadErr := s.awaitLoadedAllErrors(ctx)
+-
+- // TODO(rfindley): eliminate this function as part of simplifying
+- // CriticalErrors.
+- if loadErr != nil {
+- return loadErr.MainError
+- }
+- return nil
+-}
+-
+-func (s *snapshot) GetCriticalError(ctx context.Context) *source.CriticalError {
+- // If we couldn't compute workspace mod files, then the load below is
+- // invalid.
+- //
+- // TODO(rfindley): is this a clear error to present to the user?
+- if s.workspaceModFilesErr != nil {
+- return &source.CriticalError{MainError: s.workspaceModFilesErr}
+- }
+-
+- loadErr := s.awaitLoadedAllErrors(ctx)
+- if loadErr != nil && errors.Is(loadErr.MainError, context.Canceled) {
+- return nil
+- }
+-
+- // Even if packages didn't fail to load, we still may want to show
+- // additional warnings.
+- if loadErr == nil {
+- active, _ := s.ActiveMetadata(ctx)
+- if msg := shouldShowAdHocPackagesWarning(s, active); msg != "" {
+- return &source.CriticalError{
+- MainError: errors.New(msg),
+- }
+- }
+- // Even if workspace packages were returned, there still may be an error
+- // with the user's workspace layout. Workspace packages that only have the
+- // ID "command-line-arguments" are usually a symptom of a bad workspace
+- // configuration.
+- //
+- // This heuristic is path-dependent: we only get command-line-arguments
+- // packages when we've loaded using file scopes, which only occurs
+- // on-demand or via orphaned file reloading.
+- //
+- // TODO(rfindley): re-evaluate this heuristic.
+- if containsCommandLineArguments(active) {
+- err, diags := s.workspaceLayoutError(ctx)
+- if err != nil {
+- if ctx.Err() != nil {
+- return nil // see the API documentation for source.Snapshot
+- }
+- return &source.CriticalError{
+- MainError: err,
+- Diagnostics: diags,
+- }
+- }
+- }
+- return nil
+- }
+-
+- if errMsg := loadErr.MainError.Error(); strings.Contains(errMsg, "cannot find main module") || strings.Contains(errMsg, "go.mod file not found") {
+- err, diags := s.workspaceLayoutError(ctx)
+- if err != nil {
+- if ctx.Err() != nil {
+- return nil // see the API documentation for source.Snapshot
+- }
+- return &source.CriticalError{
+- MainError: err,
+- Diagnostics: diags,
+- }
+- }
+- }
+- return loadErr
+-}
+-
+-// A portion of this text is expected by TestBrokenWorkspace_OutsideModule.
+-const adHocPackagesWarning = `You are outside of a module and outside of $GOPATH/src.
+-If you are using modules, please open your editor to a directory in your module.
+-If you believe this warning is incorrect, please file an issue: https://github.com/golang/go/issues/new.`
+-
+-func shouldShowAdHocPackagesWarning(snapshot source.Snapshot, active []*source.Metadata) string {
+- if !snapshot.ValidBuildConfiguration() {
+- for _, m := range active {
+- // A blank entry in DepsByImpPath
+- // indicates a missing dependency.
+- for _, importID := range m.DepsByImpPath {
+- if importID == "" {
+- return adHocPackagesWarning
+- }
+- }
+- }
+- }
+- return ""
+-}
+-
+-func containsCommandLineArguments(metas []*source.Metadata) bool {
+- for _, m := range metas {
+- if source.IsCommandLineArguments(m.ID) {
+- return true
+- }
+- }
+- return false
+-}
+-
+-func (s *snapshot) awaitLoadedAllErrors(ctx context.Context) *source.CriticalError {
+- // Do not return results until the snapshot's view has been initialized.
+- s.AwaitInitialized(ctx)
+-
+- // TODO(rfindley): Should we be more careful about returning the
+- // initialization error? Is it possible for the initialization error to be
+- // corrected without a successful reinitialization?
+- if err := s.getInitializationError(); err != nil {
+- return err
+- }
+-
+- // TODO(rfindley): revisit this handling. Calling reloadWorkspace with a
+- // cancelled context should have the same effect, so this preemptive handling
+- // should not be necessary.
+- //
+- // Also: GetCriticalError ignores context cancellation errors. Should we be
+- // returning nil here?
+- if ctx.Err() != nil {
+- return &source.CriticalError{MainError: ctx.Err()}
+- }
+-
+- // TODO(rfindley): reloading is not idempotent: if we try to reload or load
+- // orphaned files below and fail, we won't try again. For that reason, we
+- // could get different results from subsequent calls to this function, which
+- // may cause critical errors to be suppressed.
+-
+- if err := s.reloadWorkspace(ctx); err != nil {
+- diags := s.extractGoCommandErrors(ctx, err)
+- return &source.CriticalError{
+- MainError: err,
+- Diagnostics: diags,
+- }
+- }
+-
+- if err := s.reloadOrphanedOpenFiles(ctx); err != nil {
+- diags := s.extractGoCommandErrors(ctx, err)
+- return &source.CriticalError{
+- MainError: err,
+- Diagnostics: diags,
+- }
+- }
+- return nil
+-}
+-
+-func (s *snapshot) getInitializationError() *source.CriticalError {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- return s.initializedErr
+-}
+-
+-func (s *snapshot) AwaitInitialized(ctx context.Context) {
+- select {
+- case <-ctx.Done():
+- return
+- case <-s.view.initialWorkspaceLoad:
+- }
+- // We typically prefer to run something as intensive as the IWL without
+- // blocking. I'm not sure if there is a way to do that here.
+- s.initialize(ctx, false)
+-}
+-
+-// reloadWorkspace reloads the metadata for all invalidated workspace packages.
+-func (s *snapshot) reloadWorkspace(ctx context.Context) error {
+- var scopes []loadScope
+- var seen map[PackagePath]bool
+- s.mu.Lock()
+- for _, pkgPaths := range s.shouldLoad {
+- for _, pkgPath := range pkgPaths {
+- if seen == nil {
+- seen = make(map[PackagePath]bool)
+- }
+- if seen[pkgPath] {
+- continue
+- }
+- seen[pkgPath] = true
+- scopes = append(scopes, packageLoadScope(pkgPath))
+- }
+- }
+- s.mu.Unlock()
+-
+- if len(scopes) == 0 {
+- return nil
+- }
+-
+- // If the view's build configuration is invalid, we cannot reload by
+- // package path. Just reload the directory instead.
+- if !s.ValidBuildConfiguration() {
+- scopes = []loadScope{viewLoadScope("LOAD_INVALID_VIEW")}
+- }
+-
+- err := s.load(ctx, false, scopes...)
+-
+- // Unless the context was canceled, set "shouldLoad" to false for all
+- // of the metadata we attempted to load.
+- if !errors.Is(err, context.Canceled) {
+- s.clearShouldLoad(scopes...)
+- }
+-
+- return err
+-}
+-
+-func (s *snapshot) reloadOrphanedOpenFiles(ctx context.Context) error {
+- // When we load ./... or a package path directly, we may not get packages
+- // that exist only in overlays. As a workaround, we search all of the files
+- // available in the snapshot and reload their metadata individually using a
+- // file= query if the metadata is unavailable.
+- files := s.orphanedOpenFiles()
+-
+- // Files without a valid package declaration can't be loaded. Don't try.
+- var scopes []loadScope
+- for _, file := range files {
+- pgf, err := s.ParseGo(ctx, file, source.ParseHeader)
+- if err != nil {
+- continue
+- }
+- if !pgf.File.Package.IsValid() {
+- continue
+- }
+-
+- scopes = append(scopes, fileLoadScope(file.URI()))
+- }
+-
+- if len(scopes) == 0 {
+- return nil
+- }
+-
+- // The regtests match this exact log message, keep them in sync.
+- event.Log(ctx, "reloadOrphanedFiles reloading", tag.Query.Of(scopes))
+- err := s.load(ctx, false, scopes...)
+-
+- // If we failed to load some files, i.e. they have no metadata,
+- // mark the failures so we don't bother retrying until the file's
+- // content changes.
+- //
+- // TODO(rstambler): This may be an overestimate if the load stopped
+- // early for an unrelated errors. Add a fallback?
+- //
+- // Check for context cancellation so that we don't incorrectly mark files
+- // as unloadable, but don't return before setting all workspace packages.
+- if ctx.Err() == nil && err != nil {
+- event.Error(ctx, "reloadOrphanedFiles: failed to load", err, tag.Query.Of(scopes))
+- s.mu.Lock()
+- for _, scope := range scopes {
+- uri := span.URI(scope.(fileLoadScope))
+- if s.noValidMetadataForURILocked(uri) {
+- s.unloadableFiles[uri] = struct{}{}
+- }
+- }
+- s.mu.Unlock()
+- }
+- return nil
+-}
+-
+-func (s *snapshot) orphanedOpenFiles() []source.FileHandle {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- var files []source.FileHandle
+- s.files.Range(func(uri span.URI, fh source.FileHandle) {
+- // Only consider open files, which will be represented as overlays.
+- if _, isOverlay := fh.(*Overlay); !isOverlay {
+- return
+- }
+- // Don't try to reload metadata for go.mod files.
+- if s.view.FileKind(fh) != source.Go {
+- return
+- }
+- // If the URI doesn't belong to this view, then it's not in a workspace
+- // package and should not be reloaded directly.
+- if !source.InDir(s.view.folder.Filename(), uri.Filename()) {
+- return
+- }
+- // Don't reload metadata for files we've already deemed unloadable.
+- if _, ok := s.unloadableFiles[uri]; ok {
+- return
+- }
+- if s.noValidMetadataForURILocked(uri) {
+- files = append(files, fh)
+- }
+- })
+- return files
+-}
+-
+-// TODO(golang/go#53756): this function needs to consider more than just the
+-// absolute URI, for example:
+-// - the position of /vendor/ with respect to the relevant module root
+-// - whether or not go.work is in use (as vendoring isn't supported in workspace mode)
+-//
+-// Most likely, each call site of inVendor needs to be reconsidered to
+-// understand and correctly implement the desired behavior.
+-func inVendor(uri span.URI) bool {
+- _, after, found := cut(string(uri), "/vendor/")
+- // Only subdirectories of /vendor/ are considered vendored
+- // (/vendor/a/foo.go is vendored, /vendor/foo.go is not).
+- return found && strings.Contains(after, "/")
+-}
+-
+-// TODO(adonovan): replace with strings.Cut when we can assume go1.18.
+-func cut(s, sep string) (before, after string, found bool) {
+- if i := strings.Index(s, sep); i >= 0 {
+- return s[:i], s[i+len(sep):], true
+- }
+- return s, "", false
+-}
+-
+-// unappliedChanges is a file source that handles an uncloned snapshot.
+-type unappliedChanges struct {
+- originalSnapshot *snapshot
+- changes map[span.URI]*fileChange
+-}
+-
+-func (ac *unappliedChanges) GetFile(ctx context.Context, uri span.URI) (source.FileHandle, error) {
+- if c, ok := ac.changes[uri]; ok {
+- return c.fileHandle, nil
+- }
+- return ac.originalSnapshot.GetFile(ctx, uri)
+-}
+-
+-func (s *snapshot) clone(ctx, bgCtx context.Context, changes map[span.URI]*fileChange, forceReloadMetadata bool) (*snapshot, func()) {
+- ctx, done := event.Start(ctx, "snapshot.clone")
+- defer done()
+-
+- reinit := false
+- wsModFiles, wsModFilesErr := s.workspaceModFiles, s.workspaceModFilesErr
+-
+- if workURI := s.view.effectiveGOWORK(); workURI != "" {
+- if change, ok := changes[workURI]; ok {
+- wsModFiles, wsModFilesErr = computeWorkspaceModFiles(ctx, s.view.gomod, workURI, s.view.effectiveGO111MODULE(), &unappliedChanges{
+- originalSnapshot: s,
+- changes: changes,
+- })
+- // TODO(rfindley): don't rely on 'isUnchanged' here. Use a content hash instead.
+- reinit = change.fileHandle.Saved() && !change.isUnchanged
+- }
+- }
+-
+- // Reinitialize if any workspace mod file has changed on disk.
+- for uri, change := range changes {
+- if _, ok := wsModFiles[uri]; ok && change.fileHandle.Saved() && !change.isUnchanged {
+- reinit = true
+- }
+- }
+-
+- // Finally, process sumfile changes that may affect loading.
+- for uri, change := range changes {
+- if !change.fileHandle.Saved() {
+- continue // like with go.mod files, we only reinit when things are saved
+- }
+- if filepath.Base(uri.Filename()) == "go.work.sum" && s.view.gowork != "" {
+- if filepath.Dir(uri.Filename()) == filepath.Dir(s.view.gowork) {
+- reinit = true
+- }
+- }
+- if filepath.Base(uri.Filename()) == "go.sum" {
+- dir := filepath.Dir(uri.Filename())
+- modURI := span.URIFromPath(filepath.Join(dir, "go.mod"))
+- if _, active := wsModFiles[modURI]; active {
+- reinit = true
+- }
+- }
+- }
+-
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- // Changes to vendor tree may require reinitialization,
+- // either because of an initialization error
+- // (e.g. "inconsistent vendoring detected"), or because
+- // one or more modules may have moved into or out of the
+- // vendor tree after 'go mod vendor' or 'rm -fr vendor/'.
+- for uri := range changes {
+- if inVendor(uri) && s.initializedErr != nil ||
+- strings.HasSuffix(string(uri), "/vendor/modules.txt") {
+- reinit = true
+- break
+- }
+- }
+-
+- bgCtx, cancel := context.WithCancel(bgCtx)
+- result := &snapshot{
+- sequenceID: s.sequenceID + 1,
+- globalID: nextSnapshotID(),
+- store: s.store,
+- view: s.view,
+- backgroundCtx: bgCtx,
+- cancel: cancel,
+- builtin: s.builtin,
+- initialized: s.initialized,
+- initializedErr: s.initializedErr,
+- packages: s.packages.Clone(),
+- activePackages: s.activePackages.Clone(),
+- analyses: s.analyses.Clone(),
+- files: s.files.Clone(),
+- parseCache: s.parseCache,
+- symbolizeHandles: s.symbolizeHandles.Clone(),
+- workspacePackages: make(map[PackageID]PackagePath, len(s.workspacePackages)),
+- unloadableFiles: make(map[span.URI]struct{}, len(s.unloadableFiles)),
+- parseModHandles: s.parseModHandles.Clone(),
+- parseWorkHandles: s.parseWorkHandles.Clone(),
+- modTidyHandles: s.modTidyHandles.Clone(),
+- modWhyHandles: s.modWhyHandles.Clone(),
+- modVulnHandles: s.modVulnHandles.Clone(),
+- knownSubdirs: s.knownSubdirs.Clone(),
+- workspaceModFiles: wsModFiles,
+- workspaceModFilesErr: wsModFilesErr,
+- }
+-
+- // The snapshot should be initialized if either s was uninitialized, or we've
+- // detected a change that triggers reinitialization.
+- if reinit {
+- result.initialized = false
+- }
+-
+- // Create a lease on the new snapshot.
+- // (Best to do this early in case the code below hides an
+- // incref/decref operation that might destroy it prematurely.)
+- release := result.Acquire()
+-
+- // Copy the set of unloadable files.
+- //
+- // TODO(rfindley): this looks wrong. Shouldn't we clear unloadableFiles on
+- // changes to environment or workspace layout, or more generally on any
+- // metadata change?
+- //
+- // Maybe not, as major configuration changes cause a new view.
+- for k, v := range s.unloadableFiles {
+- result.unloadableFiles[k] = v
+- }
+-
+- // Add all of the known subdirectories, but don't update them for the
+- // changed files. We need to rebuild the workspace module to know the
+- // true set of known subdirectories, but we don't want to do that in clone.
+- result.knownSubdirs = s.knownSubdirs.Clone()
+- result.knownSubdirsPatternCache = s.knownSubdirsPatternCache
+- for _, c := range changes {
+- result.unprocessedSubdirChanges = append(result.unprocessedSubdirChanges, c)
+- }
+-
+- // directIDs keeps track of package IDs that have directly changed.
+- // Note: this is not a set, it's a map from id to invalidateMetadata.
+- directIDs := map[PackageID]bool{}
+-
+- // Invalidate all package metadata if the workspace module has changed.
+- if reinit {
+- for k := range s.meta.metadata {
+- directIDs[k] = true
+- }
+- }
+-
+- // Compute invalidations based on file changes.
+- anyImportDeleted := false // import deletions can resolve cycles
+- anyFileOpenedOrClosed := false // opened files affect workspace packages
+- anyFileAdded := false // adding a file can resolve missing dependencies
+-
+- for uri, change := range changes {
+- // Invalidate go.mod-related handles.
+- result.modTidyHandles.Delete(uri)
+- result.modWhyHandles.Delete(uri)
+- result.modVulnHandles.Delete(uri)
+-
+- // Invalidate handles for cached symbols.
+- result.symbolizeHandles.Delete(uri)
+-
+- // The original FileHandle for this URI is cached on the snapshot.
+- originalFH, _ := s.files.Get(uri)
+- var originalOpen, newOpen bool
+- _, originalOpen = originalFH.(*Overlay)
+- _, newOpen = change.fileHandle.(*Overlay)
+- anyFileOpenedOrClosed = anyFileOpenedOrClosed || (originalOpen != newOpen)
+- anyFileAdded = anyFileAdded || (originalFH == nil && change.fileHandle != nil)
+-
+- // If uri is a Go file, check if it has changed in a way that would
+- // invalidate metadata. Note that we can't use s.view.FileKind here,
+- // because the file type that matters is not what the *client* tells us,
+- // but what the Go command sees.
+- var invalidateMetadata, pkgFileChanged, importDeleted bool
+- if strings.HasSuffix(uri.Filename(), ".go") {
+- invalidateMetadata, pkgFileChanged, importDeleted = metadataChanges(ctx, s, originalFH, change.fileHandle)
+- }
+-
+- invalidateMetadata = invalidateMetadata || forceReloadMetadata || reinit
+- anyImportDeleted = anyImportDeleted || importDeleted
+-
+- // Mark all of the package IDs containing the given file.
+- filePackageIDs := invalidatedPackageIDs(uri, s.meta.ids, pkgFileChanged)
+- for id := range filePackageIDs {
+- directIDs[id] = directIDs[id] || invalidateMetadata // may insert 'false'
+- }
+-
+- // Invalidate the previous modTidyHandle if any of the files have been
+- // saved or if any of the metadata has been invalidated.
+- if invalidateMetadata || fileWasSaved(originalFH, change.fileHandle) {
+- // TODO(maybe): Only delete mod handles for
+- // which the withoutURI is relevant.
+- // Requires reverse-engineering the go command. (!)
+- result.modTidyHandles.Clear()
+- result.modWhyHandles.Clear()
+- result.modVulnHandles.Clear()
+- }
+-
+- result.parseModHandles.Delete(uri)
+- result.parseWorkHandles.Delete(uri)
+- // Handle the invalidated file; it may have new contents or not exist.
+- if !change.exists {
+- result.files.Delete(uri)
+- } else {
+- result.files.Set(uri, change.fileHandle)
+- }
+-
+- // Make sure to remove the changed file from the unloadable set.
+- delete(result.unloadableFiles, uri)
+- }
+-
+- // Deleting an import can cause list errors due to import cycles to be
+- // resolved. The best we can do without parsing the list error message is to
+- // hope that list errors may have been resolved by a deleted import.
+- //
+- // We could do better by parsing the list error message. We already do this
+- // to assign a better range to the list error, but for such critical
+- // functionality as metadata, it's better to be conservative until it proves
+- // impractical.
+- //
+- // We could also do better by looking at which imports were deleted and
+- // trying to find cycles they are involved in. This fails when the file goes
+- // from an unparseable state to a parseable state, as we don't have a
+- // starting point to compare with.
+- if anyImportDeleted {
+- for id, metadata := range s.meta.metadata {
+- if len(metadata.Errors) > 0 {
+- directIDs[id] = true
+- }
+- }
+- }
+-
+- // Adding a file can resolve missing dependencies from existing packages.
+- //
+- // We could be smart here and try to guess which packages may have been
+- // fixed, but until that proves necessary, just invalidate metadata for any
+- // package with missing dependencies.
+- if anyFileAdded {
+- for id, metadata := range s.meta.metadata {
+- for _, impID := range metadata.DepsByImpPath {
+- if impID == "" { // missing import
+- directIDs[id] = true
+- break
+- }
+- }
+- }
+- }
+-
+- // Invalidate reverse dependencies too.
+- // idsToInvalidate keeps track of transitive reverse dependencies.
+- // If an ID is present in the map, invalidate its types.
+- // If an ID's value is true, invalidate its metadata too.
+- idsToInvalidate := map[PackageID]bool{}
+- var addRevDeps func(PackageID, bool)
+- addRevDeps = func(id PackageID, invalidateMetadata bool) {
+- current, seen := idsToInvalidate[id]
+- newInvalidateMetadata := current || invalidateMetadata
+-
+- // If we've already seen this ID, and the value of invalidate
+- // metadata has not changed, we can return early.
+- if seen && current == newInvalidateMetadata {
+- return
+- }
+- idsToInvalidate[id] = newInvalidateMetadata
+- for _, rid := range s.meta.importedBy[id] {
+- addRevDeps(rid, invalidateMetadata)
+- }
+- }
+- for id, invalidateMetadata := range directIDs {
+- addRevDeps(id, invalidateMetadata)
+- }
+-
+- // Delete invalidated package type information.
+- for id := range idsToInvalidate {
+- result.packages.Delete(id)
+- result.activePackages.Delete(id)
+- }
+-
+- // Delete invalidated analysis actions.
+- var actionsToDelete []analysisKey
+- result.analyses.Range(func(k, _ interface{}) {
+- key := k.(analysisKey)
+- if _, ok := idsToInvalidate[key.pkgid]; ok {
+- actionsToDelete = append(actionsToDelete, key)
+- }
+- })
+- for _, key := range actionsToDelete {
+- result.analyses.Delete(key)
+- }
+-
+- // If a file has been deleted, we must delete metadata for all packages
+- // containing that file.
+- //
+- // TODO(rfindley): why not keep invalid metadata in this case? If we
+- // otherwise allow operate on invalid metadata, why not continue to do so,
+- // skipping the missing file?
+- skipID := map[PackageID]bool{}
+- for _, c := range changes {
+- if c.exists {
+- continue
+- }
+- // The file has been deleted.
+- if ids, ok := s.meta.ids[c.fileHandle.URI()]; ok {
+- for _, id := range ids {
+- skipID[id] = true
+- }
+- }
+- }
+-
+- // Any packages that need loading in s still need loading in the new
+- // snapshot.
+- for k, v := range s.shouldLoad {
+- if result.shouldLoad == nil {
+- result.shouldLoad = make(map[PackageID][]PackagePath)
+- }
+- result.shouldLoad[k] = v
+- }
+-
+- // Compute which metadata updates are required. We only need to invalidate
+- // packages directly containing the affected file, and only if it changed in
+- // a relevant way.
+- metadataUpdates := make(map[PackageID]*source.Metadata)
+- for k, v := range s.meta.metadata {
+- invalidateMetadata := idsToInvalidate[k]
+-
+- // For metadata that has been newly invalidated, capture package paths
+- // requiring reloading in the shouldLoad map.
+- if invalidateMetadata && !source.IsCommandLineArguments(v.ID) {
+- if result.shouldLoad == nil {
+- result.shouldLoad = make(map[PackageID][]PackagePath)
+- }
+- needsReload := []PackagePath{v.PkgPath}
+- if v.ForTest != "" && v.ForTest != v.PkgPath {
+- // When reloading test variants, always reload their ForTest package as
+- // well. Otherwise, we may miss test variants in the resulting load.
+- //
+- // TODO(rfindley): is this actually sufficient? Is it possible that
+- // other test variants may be invalidated? Either way, we should
+- // determine exactly what needs to be reloaded here.
+- needsReload = append(needsReload, v.ForTest)
+- }
+- result.shouldLoad[k] = needsReload
+- }
+-
+- // Check whether the metadata should be deleted.
+- if skipID[k] || invalidateMetadata {
+- metadataUpdates[k] = nil
+- continue
+- }
+- }
+-
+- // Update metadata, if necessary.
+- result.meta = s.meta.Clone(metadataUpdates)
+-
+- // Update workspace and active packages, if necessary.
+- if result.meta != s.meta || anyFileOpenedOrClosed {
+- result.workspacePackages = computeWorkspacePackagesLocked(result, result.meta)
+- result.resetActivePackagesLocked()
+- } else {
+- result.workspacePackages = s.workspacePackages
+- }
+-
+- // Don't bother copying the importedBy graph,
+- // as it changes each time we update metadata.
+-
+- // TODO(rfindley): consolidate the this workspace mode detection with
+- // workspace invalidation.
+- workspaceModeChanged := s.workspaceMode() != result.workspaceMode()
+-
+- // If the snapshot's workspace mode has changed, the packages loaded using
+- // the previous mode are no longer relevant, so clear them out.
+- if workspaceModeChanged {
+- result.workspacePackages = map[PackageID]PackagePath{}
+- }
+- result.dumpWorkspace("clone")
+- return result, release
+-}
+-
+-// invalidatedPackageIDs returns all packages invalidated by a change to uri.
+-// If we haven't seen this URI before, we guess based on files in the same
+-// directory. This is of course incorrect in build systems where packages are
+-// not organized by directory.
+-//
+-// If packageFileChanged is set, the file is either a new file, or has a new
+-// package name. In this case, all known packages in the directory will be
+-// invalidated.
+-func invalidatedPackageIDs(uri span.URI, known map[span.URI][]PackageID, packageFileChanged bool) map[PackageID]struct{} {
+- invalidated := make(map[PackageID]struct{})
+-
+- // At a minimum, we invalidate packages known to contain uri.
+- for _, id := range known[uri] {
+- invalidated[id] = struct{}{}
+- }
+-
+- // If the file didn't move to a new package, we should only invalidate the
+- // packages it is currently contained inside.
+- if !packageFileChanged && len(invalidated) > 0 {
+- return invalidated
+- }
+-
+- // This is a file we don't yet know about, or which has moved packages. Guess
+- // relevant packages by considering files in the same directory.
+-
+- // Cache of FileInfo to avoid unnecessary stats for multiple files in the
+- // same directory.
+- stats := make(map[string]struct {
+- os.FileInfo
+- error
+- })
+- getInfo := func(dir string) (os.FileInfo, error) {
+- if res, ok := stats[dir]; ok {
+- return res.FileInfo, res.error
+- }
+- fi, err := os.Stat(dir)
+- stats[dir] = struct {
+- os.FileInfo
+- error
+- }{fi, err}
+- return fi, err
+- }
+- dir := filepath.Dir(uri.Filename())
+- fi, err := getInfo(dir)
+- if err == nil {
+- // Aggregate all possibly relevant package IDs.
+- for knownURI, ids := range known {
+- knownDir := filepath.Dir(knownURI.Filename())
+- knownFI, err := getInfo(knownDir)
+- if err != nil {
+- continue
+- }
+- if os.SameFile(fi, knownFI) {
+- for _, id := range ids {
+- invalidated[id] = struct{}{}
+- }
+- }
+- }
+- }
+- return invalidated
+-}
+-
+-// fileWasSaved reports whether the FileHandle passed in has been saved. It
+-// accomplishes this by checking to see if the original and current FileHandles
+-// are both overlays, and if the current FileHandle is saved while the original
+-// FileHandle was not saved.
+-func fileWasSaved(originalFH, currentFH source.FileHandle) bool {
+- c, ok := currentFH.(*Overlay)
+- if !ok || c == nil {
+- return true
+- }
+- o, ok := originalFH.(*Overlay)
+- if !ok || o == nil {
+- return c.saved
+- }
+- return !o.saved && c.saved
+-}
+-
+-// metadataChanges detects features of the change from oldFH->newFH that may
+-// affect package metadata.
+-//
+-// It uses lockedSnapshot to access cached parse information. lockedSnapshot
+-// must be locked.
+-//
+-// The result parameters have the following meaning:
+-// - invalidate means that package metadata for packages containing the file
+-// should be invalidated.
+-// - pkgFileChanged means that the file->package associates for the file have
+-// changed (possibly because the file is new, or because its package name has
+-// changed).
+-// - importDeleted means that an import has been deleted, or we can't
+-// determine if an import was deleted due to errors.
+-func metadataChanges(ctx context.Context, lockedSnapshot *snapshot, oldFH, newFH source.FileHandle) (invalidate, pkgFileChanged, importDeleted bool) {
+- if oldFH == nil || newFH == nil { // existential changes
+- changed := (oldFH == nil) != (newFH == nil)
+- return changed, changed, (newFH == nil) // we don't know if an import was deleted
+- }
+-
+- // If the file hasn't changed, there's no need to reload.
+- if oldFH.FileIdentity() == newFH.FileIdentity() {
+- return false, false, false
+- }
+-
+- // Parse headers to compare package names and imports.
+- oldHeads, _, oldErr := lockedSnapshot.parseCache.parseFiles(ctx, source.ParseHeader, oldFH)
+- newHeads, _, newErr := lockedSnapshot.parseCache.parseFiles(ctx, source.ParseHeader, newFH)
+-
+- if oldErr != nil || newErr != nil {
+- // TODO(rfindley): we can get here if newFH does not exist. There is
+- // asymmetry, in that newFH may be non-nil even if the underlying file does
+- // not exist.
+- //
+- // We should not produce a non-nil filehandle for a file that does not exist.
+- errChanged := (oldErr == nil) != (newErr == nil)
+- return errChanged, errChanged, (newErr != nil) // we don't know if an import was deleted
+- }
+-
+- oldHead := oldHeads[0]
+- newHead := newHeads[0]
+-
+- // `go list` fails completely if the file header cannot be parsed. If we go
+- // from a non-parsing state to a parsing state, we should reload.
+- if oldHead.ParseErr != nil && newHead.ParseErr == nil {
+- return true, true, true // We don't know what changed, so fall back on full invalidation.
+- }
+-
+- // If a package name has changed, the set of package imports may have changed
+- // in ways we can't detect here. Assume an import has been deleted.
+- if oldHead.File.Name.Name != newHead.File.Name.Name {
+- return true, true, true
+- }
+-
+- // Check whether package imports have changed. Only consider potentially
+- // valid imports paths.
+- oldImports := validImports(oldHead.File.Imports)
+- newImports := validImports(newHead.File.Imports)
+-
+- for path := range newImports {
+- if _, ok := oldImports[path]; ok {
+- delete(oldImports, path)
+- } else {
+- invalidate = true // a new, potentially valid import was added
+- }
+- }
+-
+- if len(oldImports) > 0 {
+- invalidate = true
+- importDeleted = true
+- }
+-
+- // If the change does not otherwise invalidate metadata, get the full ASTs in
+- // order to check magic comments.
+- //
+- // Note: if this affects performance we can probably avoid parsing in the
+- // common case by first scanning the source for potential comments.
+- if !invalidate {
+- origFulls, _, oldErr := lockedSnapshot.parseCache.parseFiles(ctx, source.ParseFull, oldFH)
+- newFulls, _, newErr := lockedSnapshot.parseCache.parseFiles(ctx, source.ParseFull, newFH)
+- if oldErr == nil && newErr == nil {
+- invalidate = magicCommentsChanged(origFulls[0].File, newFulls[0].File)
+- } else {
+- // At this point, we shouldn't ever fail to produce a ParsedGoFile, as
+- // we're already past header parsing.
+- bug.Reportf("metadataChanges: unparseable file %v (old error: %v, new error: %v)", oldFH.URI(), oldErr, newErr)
+- }
+- }
+-
+- return invalidate, pkgFileChanged, importDeleted
+-}
+-
+-func magicCommentsChanged(original *ast.File, current *ast.File) bool {
+- oldComments := extractMagicComments(original)
+- newComments := extractMagicComments(current)
+- if len(oldComments) != len(newComments) {
+- return true
+- }
+- for i := range oldComments {
+- if oldComments[i] != newComments[i] {
+- return true
+- }
+- }
+- return false
+-}
+-
+-// validImports extracts the set of valid import paths from imports.
+-func validImports(imports []*ast.ImportSpec) map[string]struct{} {
+- m := make(map[string]struct{})
+- for _, spec := range imports {
+- if path := spec.Path.Value; validImportPath(path) {
+- m[path] = struct{}{}
+- }
+- }
+- return m
+-}
+-
+-func validImportPath(path string) bool {
+- path, err := strconv.Unquote(path)
+- if err != nil {
+- return false
+- }
+- if path == "" {
+- return false
+- }
+- if path[len(path)-1] == '/' {
+- return false
+- }
+- return true
+-}
+-
+-var buildConstraintOrEmbedRe = regexp.MustCompile(`^//(go:embed|go:build|\s*\+build).*`)
+-
+-// extractMagicComments finds magic comments that affect metadata in f.
+-func extractMagicComments(f *ast.File) []string {
+- var results []string
+- for _, cg := range f.Comments {
+- for _, c := range cg.List {
+- if buildConstraintOrEmbedRe.MatchString(c.Text) {
+- results = append(results, c.Text)
+- }
+- }
+- }
+- return results
+-}
+-
+-func (s *snapshot) BuiltinFile(ctx context.Context) (*source.ParsedGoFile, error) {
+- s.AwaitInitialized(ctx)
+-
+- s.mu.Lock()
+- builtin := s.builtin
+- s.mu.Unlock()
+-
+- if builtin == "" {
+- return nil, fmt.Errorf("no builtin package for view %s", s.view.name)
+- }
+-
+- fh, err := s.GetFile(ctx, builtin)
+- if err != nil {
+- return nil, err
+- }
+- return s.ParseGo(ctx, fh, source.ParseFull)
+-}
+-
+-func (s *snapshot) IsBuiltin(ctx context.Context, uri span.URI) bool {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+- // We should always get the builtin URI in a canonical form, so use simple
+- // string comparison here. span.CompareURI is too expensive.
+- return uri == s.builtin
+-}
+-
+-func (s *snapshot) setBuiltin(path string) {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- s.builtin = span.URIFromPath(path)
+-}
+diff -urN a/gopls/internal/lsp/cache/standalone_go115.go b/gopls/internal/lsp/cache/standalone_go115.go
+--- a/gopls/internal/lsp/cache/standalone_go115.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/standalone_go115.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build !go1.16
+-// +build !go1.16
+-
+-package cache
+-
+-// isStandaloneFile returns false, as the 'standaloneTags' setting is
+-// unsupported on Go 1.15 and earlier.
+-func isStandaloneFile(src []byte, standaloneTags []string) bool {
+- return false
+-}
+diff -urN a/gopls/internal/lsp/cache/standalone_go116.go b/gopls/internal/lsp/cache/standalone_go116.go
+--- a/gopls/internal/lsp/cache/standalone_go116.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/standalone_go116.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,50 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.16
+-// +build go1.16
+-
+-package cache
+-
+-import (
+- "go/build/constraint"
+- "go/parser"
+- "go/token"
+-)
+-
+-// isStandaloneFile reports whether a file with the given contents should be
+-// considered a 'standalone main file', meaning a package that consists of only
+-// a single file.
+-func isStandaloneFile(src []byte, standaloneTags []string) bool {
+- f, err := parser.ParseFile(token.NewFileSet(), "", src, parser.PackageClauseOnly|parser.ParseComments)
+- if err != nil {
+- return false
+- }
+-
+- if f.Name == nil || f.Name.Name != "main" {
+- return false
+- }
+-
+- for _, cg := range f.Comments {
+- // Even with PackageClauseOnly the parser consumes the semicolon following
+- // the package clause, so we must guard against comments that come after
+- // the package name.
+- if cg.Pos() > f.Name.Pos() {
+- continue
+- }
+- for _, comment := range cg.List {
+- if c, err := constraint.Parse(comment.Text); err == nil {
+- if tag, ok := c.(*constraint.TagExpr); ok {
+- for _, t := range standaloneTags {
+- if t == tag.Tag {
+- return true
+- }
+- }
+- }
+- }
+- }
+- }
+-
+- return false
+-}
+diff -urN a/gopls/internal/lsp/cache/standalone_go116_test.go b/gopls/internal/lsp/cache/standalone_go116_test.go
+--- a/gopls/internal/lsp/cache/standalone_go116_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/standalone_go116_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,96 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.16
+-// +build go1.16
+-
+-package cache
+-
+-import (
+- "testing"
+-)
+-
+-func TestIsStandaloneFile(t *testing.T) {
+- tests := []struct {
+- desc string
+- contents string
+- standaloneTags []string
+- want bool
+- }{
+- {
+- "new syntax",
+- "//go:build ignore\n\npackage main\n",
+- []string{"ignore"},
+- true,
+- },
+- {
+- "legacy syntax",
+- "// +build ignore\n\npackage main\n",
+- []string{"ignore"},
+- true,
+- },
+- {
+- "multiple tags",
+- "//go:build ignore\n\npackage main\n",
+- []string{"exclude", "ignore"},
+- true,
+- },
+- {
+- "invalid tag",
+- "// +build ignore\n\npackage main\n",
+- []string{"script"},
+- false,
+- },
+- {
+- "non-main package",
+- "//go:build ignore\n\npackage p\n",
+- []string{"ignore"},
+- false,
+- },
+- {
+- "alternate tag",
+- "// +build script\n\npackage main\n",
+- []string{"script"},
+- true,
+- },
+- {
+- "both syntax",
+- "//go:build ignore\n// +build ignore\n\npackage main\n",
+- []string{"ignore"},
+- true,
+- },
+- {
+- "after comments",
+- "// A non-directive comment\n//go:build ignore\n\npackage main\n",
+- []string{"ignore"},
+- true,
+- },
+- {
+- "after package decl",
+- "package main //go:build ignore\n",
+- []string{"ignore"},
+- false,
+- },
+- {
+- "on line after package decl",
+- "package main\n\n//go:build ignore\n",
+- []string{"ignore"},
+- false,
+- },
+- {
+- "combined with other expressions",
+- "\n\n//go:build ignore || darwin\n\npackage main\n",
+- []string{"ignore"},
+- false,
+- },
+- }
+-
+- for _, test := range tests {
+- t.Run(test.desc, func(t *testing.T) {
+- if got := isStandaloneFile([]byte(test.contents), test.standaloneTags); got != test.want {
+- t.Errorf("isStandaloneFile(%q, %v) = %t, want %t", test.contents, test.standaloneTags, got, test.want)
+- }
+- })
+- }
+-}
+diff -urN a/gopls/internal/lsp/cache/symbols.go b/gopls/internal/lsp/cache/symbols.go
+--- a/gopls/internal/lsp/cache/symbols.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/symbols.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,213 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "context"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/memoize"
+-)
+-
+-// symbolize returns the result of symbolizing the file identified by uri, using a cache.
+-func (s *snapshot) symbolize(ctx context.Context, uri span.URI) ([]source.Symbol, error) {
+-
+- s.mu.Lock()
+- entry, hit := s.symbolizeHandles.Get(uri)
+- s.mu.Unlock()
+-
+- type symbolizeResult struct {
+- symbols []source.Symbol
+- err error
+- }
+-
+- // Cache miss?
+- if !hit {
+- fh, err := s.GetFile(ctx, uri)
+- if err != nil {
+- return nil, err
+- }
+- type symbolHandleKey source.Hash
+- key := symbolHandleKey(fh.FileIdentity().Hash)
+- promise, release := s.store.Promise(key, func(ctx context.Context, arg interface{}) interface{} {
+- symbols, err := symbolizeImpl(ctx, arg.(*snapshot), fh)
+- return symbolizeResult{symbols, err}
+- })
+-
+- entry = promise
+-
+- s.mu.Lock()
+- s.symbolizeHandles.Set(uri, entry, func(_, _ interface{}) { release() })
+- s.mu.Unlock()
+- }
+-
+- // Await result.
+- v, err := s.awaitPromise(ctx, entry.(*memoize.Promise))
+- if err != nil {
+- return nil, err
+- }
+- res := v.(symbolizeResult)
+- return res.symbols, res.err
+-}
+-
+-// symbolizeImpl reads and parses a file and extracts symbols from it.
+-// It may use a parsed file already present in the cache but
+-// otherwise does not populate the cache.
+-func symbolizeImpl(ctx context.Context, snapshot *snapshot, fh source.FileHandle) ([]source.Symbol, error) {
+- pgfs, _, err := snapshot.parseCache.parseFiles(ctx, source.ParseFull, fh)
+- if err != nil {
+- return nil, err
+- }
+-
+- w := &symbolWalker{
+- tokFile: pgfs[0].Tok,
+- mapper: pgfs[0].Mapper,
+- }
+- w.fileDecls(pgfs[0].File.Decls)
+-
+- return w.symbols, w.firstError
+-}
+-
+-type symbolWalker struct {
+- // for computing positions
+- tokFile *token.File
+- mapper *protocol.Mapper
+-
+- symbols []source.Symbol
+- firstError error
+-}
+-
+-func (w *symbolWalker) atNode(node ast.Node, name string, kind protocol.SymbolKind, path ...*ast.Ident) {
+- var b strings.Builder
+- for _, ident := range path {
+- if ident != nil {
+- b.WriteString(ident.Name)
+- b.WriteString(".")
+- }
+- }
+- b.WriteString(name)
+-
+- rng, err := w.mapper.NodeRange(w.tokFile, node)
+- if err != nil {
+- w.error(err)
+- return
+- }
+- sym := source.Symbol{
+- Name: b.String(),
+- Kind: kind,
+- Range: rng,
+- }
+- w.symbols = append(w.symbols, sym)
+-}
+-
+-func (w *symbolWalker) error(err error) {
+- if err != nil && w.firstError == nil {
+- w.firstError = err
+- }
+-}
+-
+-func (w *symbolWalker) fileDecls(decls []ast.Decl) {
+- for _, decl := range decls {
+- switch decl := decl.(type) {
+- case *ast.FuncDecl:
+- kind := protocol.Function
+- var recv *ast.Ident
+- if decl.Recv.NumFields() > 0 {
+- kind = protocol.Method
+- recv = unpackRecv(decl.Recv.List[0].Type)
+- }
+- w.atNode(decl.Name, decl.Name.Name, kind, recv)
+- case *ast.GenDecl:
+- for _, spec := range decl.Specs {
+- switch spec := spec.(type) {
+- case *ast.TypeSpec:
+- kind := guessKind(spec)
+- w.atNode(spec.Name, spec.Name.Name, kind)
+- w.walkType(spec.Type, spec.Name)
+- case *ast.ValueSpec:
+- for _, name := range spec.Names {
+- kind := protocol.Variable
+- if decl.Tok == token.CONST {
+- kind = protocol.Constant
+- }
+- w.atNode(name, name.Name, kind)
+- }
+- }
+- }
+- }
+- }
+-}
+-
+-func guessKind(spec *ast.TypeSpec) protocol.SymbolKind {
+- switch spec.Type.(type) {
+- case *ast.InterfaceType:
+- return protocol.Interface
+- case *ast.StructType:
+- return protocol.Struct
+- case *ast.FuncType:
+- return protocol.Function
+- }
+- return protocol.Class
+-}
+-
+-func unpackRecv(rtyp ast.Expr) *ast.Ident {
+- // Extract the receiver identifier. Lifted from go/types/resolver.go
+-L:
+- for {
+- switch t := rtyp.(type) {
+- case *ast.ParenExpr:
+- rtyp = t.X
+- case *ast.StarExpr:
+- rtyp = t.X
+- default:
+- break L
+- }
+- }
+- if name, _ := rtyp.(*ast.Ident); name != nil {
+- return name
+- }
+- return nil
+-}
+-
+-// walkType processes symbols related to a type expression. path is path of
+-// nested type identifiers to the type expression.
+-func (w *symbolWalker) walkType(typ ast.Expr, path ...*ast.Ident) {
+- switch st := typ.(type) {
+- case *ast.StructType:
+- for _, field := range st.Fields.List {
+- w.walkField(field, protocol.Field, protocol.Field, path...)
+- }
+- case *ast.InterfaceType:
+- for _, field := range st.Methods.List {
+- w.walkField(field, protocol.Interface, protocol.Method, path...)
+- }
+- }
+-}
+-
+-// walkField processes symbols related to the struct field or interface method.
+-//
+-// unnamedKind and namedKind are the symbol kinds if the field is resp. unnamed
+-// or named. path is the path of nested identifiers containing the field.
+-func (w *symbolWalker) walkField(field *ast.Field, unnamedKind, namedKind protocol.SymbolKind, path ...*ast.Ident) {
+- if len(field.Names) == 0 {
+- switch typ := field.Type.(type) {
+- case *ast.SelectorExpr:
+- // embedded qualified type
+- w.atNode(field, typ.Sel.Name, unnamedKind, path...)
+- default:
+- w.atNode(field, types.ExprString(field.Type), unnamedKind, path...)
+- }
+- }
+- for _, name := range field.Names {
+- w.atNode(name, name.Name, namedKind, path...)
+- w.walkType(field.Type, append(path, name)...)
+- }
+-}
+diff -urN a/gopls/internal/lsp/cache/view.go b/gopls/internal/lsp/cache/view.go
+--- a/gopls/internal/lsp/cache/view.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/view.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1142 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package cache implements the caching layer for gopls.
+-package cache
+-
+-import (
+- "bytes"
+- "context"
+- "encoding/json"
+- "errors"
+- "fmt"
+- "io/ioutil"
+- "os"
+- "path"
+- "path/filepath"
+- "reflect"
+- "regexp"
+- "sort"
+- "strings"
+- "sync"
+- "time"
+-
+- "golang.org/x/mod/modfile"
+- "golang.org/x/mod/semver"
+- exec "golang.org/x/sys/execabs"
+- "golang.org/x/tools/gopls/internal/govulncheck"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/gocommand"
+- "golang.org/x/tools/internal/imports"
+- "golang.org/x/tools/internal/xcontext"
+-)
+-
+-type View struct {
+- id string
+-
+- gocmdRunner *gocommand.Runner // limits go command concurrency
+-
+- // baseCtx is the context handed to NewView. This is the parent of all
+- // background contexts created for this view.
+- baseCtx context.Context
+-
+- // name is the user-specified name of this view.
+- name string
+-
+- optionsMu sync.Mutex
+- options *source.Options
+-
+- // Workspace information. The fields below are immutable, and together with
+- // options define the build list. Any change to these fields results in a new
+- // View.
+- folder span.URI // user-specified workspace folder
+- workspaceInformation // Go environment information
+-
+- importsState *importsState
+-
+- // moduleUpgrades tracks known upgrades for module paths in each modfile.
+- // Each modfile has a map of module name to upgrade version.
+- moduleUpgradesMu sync.Mutex
+- moduleUpgrades map[span.URI]map[string]string
+-
+- // vulns maps each go.mod file's URI to its known vulnerabilities.
+- vulnsMu sync.Mutex
+- vulns map[span.URI]*govulncheck.Result
+-
+- // fs is the file source used to populate this view.
+- fs source.FileSource
+-
+- // seenFiles tracks files that the view has accessed.
+- // TODO(golang/go#57558): this notion is fundamentally problematic, and
+- // should be removed.
+- knownFilesMu sync.Mutex
+- knownFiles map[span.URI]bool
+-
+- // initCancelFirstAttempt can be used to terminate the view's first
+- // attempt at initialization.
+- initCancelFirstAttempt context.CancelFunc
+-
+- // Track the latest snapshot via the snapshot field, guarded by snapshotMu.
+- //
+- // Invariant: whenever the snapshot field is overwritten, destroy(snapshot)
+- // is called on the previous (overwritten) snapshot while snapshotMu is held,
+- // incrementing snapshotWG. During shutdown the final snapshot is
+- // overwritten with nil and destroyed, guaranteeing that all observed
+- // snapshots have been destroyed via the destroy method, and snapshotWG may
+- // be waited upon to let these destroy operations complete.
+- snapshotMu sync.Mutex
+- snapshot *snapshot // latest snapshot; nil after shutdown has been called
+- releaseSnapshot func() // called when snapshot is no longer needed
+- snapshotWG sync.WaitGroup // refcount for pending destroy operations
+-
+- // initialWorkspaceLoad is closed when the first workspace initialization has
+- // completed. If we failed to load, we only retry if the go.mod file changes,
+- // to avoid too many go/packages calls.
+- initialWorkspaceLoad chan struct{}
+-
+- // initializationSema is used limit concurrent initialization of snapshots in
+- // the view. We use a channel instead of a mutex to avoid blocking when a
+- // context is canceled.
+- //
+- // This field (along with snapshot.initialized) guards against duplicate
+- // initialization of snapshots. Do not change it without adjusting snapshot
+- // accordingly.
+- initializationSema chan struct{}
+-}
+-
+-// workspaceInformation holds the defining features of the View workspace.
+-//
+-// This type is compared to see if the View needs to be reconstructed.
+-type workspaceInformation struct {
+- // `go env` variables that need to be tracked by gopls.
+- goEnv
+-
+- // gomod holds the relevant go.mod file for this workspace.
+- gomod span.URI
+-
+- // The Go version in use: X in Go 1.X.
+- goversion int
+-
+- // The complete output of the go version command.
+- // (Call gocommand.ParseGoVersionOutput to extract a version
+- // substring such as go1.19.1 or go1.20-rc.1, go1.21-abcdef01.)
+- goversionOutput string
+-
+- // hasGopackagesDriver is true if the user has a value set for the
+- // GOPACKAGESDRIVER environment variable or a gopackagesdriver binary on
+- // their machine.
+- hasGopackagesDriver bool
+-}
+-
+-// effectiveGO111MODULE reports the value of GO111MODULE effective in the go
+-// command at this go version, assuming at least Go 1.16.
+-func (w workspaceInformation) effectiveGO111MODULE() go111module {
+- switch w.GO111MODULE() {
+- case "off":
+- return off
+- case "on", "":
+- return on
+- default:
+- return auto
+- }
+-}
+-
+-// effectiveGOWORK returns the effective GOWORK value for this workspace, if
+-// any, in URI form.
+-func (w workspaceInformation) effectiveGOWORK() span.URI {
+- if w.gowork == "off" || w.gowork == "" {
+- return ""
+- }
+- return span.URIFromPath(w.gowork)
+-}
+-
+-// GO111MODULE returns the value of GO111MODULE to use for running the go
+-// command. It differs from the user's environment in order to allow for the
+-// more forgiving default value "auto" when using recent go versions.
+-//
+-// TODO(rfindley): it is probably not worthwhile diverging from the go command
+-// here. The extra forgiveness may be nice, but breaks the invariant that
+-// running the go command from the command line produces the same build list.
+-//
+-// Put differently: we shouldn't go out of our way to make GOPATH work, when
+-// the go command does not.
+-func (w workspaceInformation) GO111MODULE() string {
+- if w.go111module == "" {
+- return "auto"
+- }
+- return w.go111module
+-}
+-
+-type go111module int
+-
+-const (
+- off = go111module(iota)
+- auto
+- on
+-)
+-
+-// goEnv holds important environment variables that gopls cares about.
+-type goEnv struct {
+- gocache, gopath, goroot, goprivate, gomodcache, gowork, goflags string
+-
+- // go111module holds the value of GO111MODULE as reported by go env.
+- //
+- // Don't use this value directly, because we choose to use a different
+- // default (auto) on Go 1.16 and later, to avoid spurious errors. Use
+- // the effectiveGO111MODULE method instead.
+- go111module string
+-}
+-
+-// loadGoEnv loads `go env` values into the receiver, using the provided user
+-// environment and go command runner.
+-func (env *goEnv) load(ctx context.Context, folder string, configEnv []string, runner *gocommand.Runner) error {
+- vars := env.vars()
+-
+- // We can save ~200 ms by requesting only the variables we care about.
+- args := []string{"-json"}
+- for k := range vars {
+- args = append(args, k)
+- }
+-
+- inv := gocommand.Invocation{
+- Verb: "env",
+- Args: args,
+- Env: configEnv,
+- WorkingDir: folder,
+- }
+- stdout, err := runner.Run(ctx, inv)
+- if err != nil {
+- return err
+- }
+- envMap := make(map[string]string)
+- if err := json.Unmarshal(stdout.Bytes(), &envMap); err != nil {
+- return fmt.Errorf("internal error unmarshaling JSON from 'go env': %w", err)
+- }
+- for key, ptr := range vars {
+- *ptr = envMap[key]
+- }
+-
+- return nil
+-}
+-
+-func (env goEnv) String() string {
+- var vars []string
+- for govar, ptr := range env.vars() {
+- vars = append(vars, fmt.Sprintf("%s=%s", govar, *ptr))
+- }
+- sort.Strings(vars)
+- return "[" + strings.Join(vars, ", ") + "]"
+-}
+-
+-// vars returns a map from Go environment variable to field value containing it.
+-func (env *goEnv) vars() map[string]*string {
+- return map[string]*string{
+- "GOCACHE": &env.gocache,
+- "GOPATH": &env.gopath,
+- "GOROOT": &env.goroot,
+- "GOPRIVATE": &env.goprivate,
+- "GOMODCACHE": &env.gomodcache,
+- "GO111MODULE": &env.go111module,
+- "GOWORK": &env.gowork,
+- "GOFLAGS": &env.goflags,
+- }
+-}
+-
+-// workspaceMode holds various flags defining how the gopls workspace should
+-// behave. They may be derived from the environment, user configuration, or
+-// depend on the Go version.
+-//
+-// TODO(rfindley): remove workspace mode, in favor of explicit checks.
+-type workspaceMode int
+-
+-const (
+- moduleMode workspaceMode = 1 << iota
+-
+- // tempModfile indicates whether or not the -modfile flag should be used.
+- tempModfile
+-)
+-
+-func (v *View) ID() string { return v.id }
+-
+-// tempModFile creates a temporary go.mod file based on the contents
+-// of the given go.mod file. On success, it is the caller's
+-// responsibility to call the cleanup function when the file is no
+-// longer needed.
+-func tempModFile(modFh source.FileHandle, gosum []byte) (tmpURI span.URI, cleanup func(), err error) {
+- filenameHash := source.Hashf("%s", modFh.URI().Filename())
+- tmpMod, err := ioutil.TempFile("", fmt.Sprintf("go.%s.*.mod", filenameHash))
+- if err != nil {
+- return "", nil, err
+- }
+- defer tmpMod.Close()
+-
+- tmpURI = span.URIFromPath(tmpMod.Name())
+- tmpSumName := sumFilename(tmpURI)
+-
+- content, err := modFh.Read()
+- if err != nil {
+- return "", nil, err
+- }
+-
+- if _, err := tmpMod.Write(content); err != nil {
+- return "", nil, err
+- }
+-
+- // We use a distinct name here to avoid subtlety around the fact
+- // that both 'return' and 'defer' update the "cleanup" variable.
+- doCleanup := func() {
+- _ = os.Remove(tmpSumName)
+- _ = os.Remove(tmpURI.Filename())
+- }
+-
+- // Be careful to clean up if we return an error from this function.
+- defer func() {
+- if err != nil {
+- doCleanup()
+- cleanup = nil
+- }
+- }()
+-
+- // Create an analogous go.sum, if one exists.
+- if gosum != nil {
+- if err := ioutil.WriteFile(tmpSumName, gosum, 0655); err != nil {
+- return "", nil, err
+- }
+- }
+-
+- return tmpURI, doCleanup, nil
+-}
+-
+-// Name returns the user visible name of this view.
+-func (v *View) Name() string {
+- return v.name
+-}
+-
+-// Folder returns the folder at the base of this view.
+-func (v *View) Folder() span.URI {
+- return v.folder
+-}
+-
+-func (v *View) Options() *source.Options {
+- v.optionsMu.Lock()
+- defer v.optionsMu.Unlock()
+- return v.options
+-}
+-
+-func (v *View) FileKind(fh source.FileHandle) source.FileKind {
+- // The kind of an unsaved buffer comes from the
+- // TextDocumentItem.LanguageID field in the didChange event,
+- // not from the file name. They may differ.
+- if o, ok := fh.(*Overlay); ok {
+- if o.kind != source.UnknownKind {
+- return o.kind
+- }
+- }
+-
+- fext := filepath.Ext(fh.URI().Filename())
+- switch fext {
+- case ".go":
+- return source.Go
+- case ".mod":
+- return source.Mod
+- case ".sum":
+- return source.Sum
+- case ".work":
+- return source.Work
+- }
+- exts := v.Options().TemplateExtensions
+- for _, ext := range exts {
+- if fext == ext || fext == "."+ext {
+- return source.Tmpl
+- }
+- }
+- // and now what? This should never happen, but it does for cgo before go1.15
+- return source.Go
+-}
+-
+-func minorOptionsChange(a, b *source.Options) bool {
+- // Check if any of the settings that modify our understanding of files have
+- // been changed.
+- if !reflect.DeepEqual(a.Env, b.Env) {
+- return false
+- }
+- if !reflect.DeepEqual(a.DirectoryFilters, b.DirectoryFilters) {
+- return false
+- }
+- if !reflect.DeepEqual(a.StandaloneTags, b.StandaloneTags) {
+- return false
+- }
+- if a.ExpandWorkspaceToModule != b.ExpandWorkspaceToModule {
+- return false
+- }
+- if a.MemoryMode != b.MemoryMode {
+- return false
+- }
+- aBuildFlags := make([]string, len(a.BuildFlags))
+- bBuildFlags := make([]string, len(b.BuildFlags))
+- copy(aBuildFlags, a.BuildFlags)
+- copy(bBuildFlags, b.BuildFlags)
+- sort.Strings(aBuildFlags)
+- sort.Strings(bBuildFlags)
+- // the rest of the options are benign
+- return reflect.DeepEqual(aBuildFlags, bBuildFlags)
+-}
+-
+-// SetViewOptions sets the options of the given view to new values. Calling
+-// this may cause the view to be invalidated and a replacement view added to
+-// the session. If so the new view will be returned, otherwise the original one
+-// will be returned.
+-func (s *Session) SetViewOptions(ctx context.Context, v *View, options *source.Options) (*View, error) {
+- // no need to rebuild the view if the options were not materially changed
+- v.optionsMu.Lock()
+- if minorOptionsChange(v.options, options) {
+- v.options = options
+- v.optionsMu.Unlock()
+- return v, nil
+- }
+- v.optionsMu.Unlock()
+- newView, err := s.updateView(ctx, v, options)
+- return newView, err
+-}
+-
+-// viewEnv returns a string describing the environment of a newly created view.
+-//
+-// It must not be called concurrently with any other view methods.
+-func viewEnv(v *View) string {
+- env := v.options.EnvSlice()
+- buildFlags := append([]string{}, v.options.BuildFlags...)
+-
+- var buf bytes.Buffer
+- fmt.Fprintf(&buf, `go info for %v
+-(go dir %s)
+-(go version %s)
+-(valid build configuration = %v)
+-(build flags: %v)
+-(selected go env: %v)
+-`,
+- v.folder.Filename(),
+- v.workingDir().Filename(),
+- strings.TrimRight(v.workspaceInformation.goversionOutput, "\n"),
+- v.snapshot.ValidBuildConfiguration(),
+- buildFlags,
+- v.goEnv,
+- )
+-
+- for _, v := range env {
+- s := strings.SplitN(v, "=", 2)
+- if len(s) != 2 {
+- continue
+- }
+- }
+-
+- return buf.String()
+-}
+-
+-func (s *snapshot) RunProcessEnvFunc(ctx context.Context, fn func(*imports.Options) error) error {
+- return s.view.importsState.runProcessEnvFunc(ctx, s, fn)
+-}
+-
+-// separated out from its sole use in locateTemplateFiles for testability
+-func fileHasExtension(path string, suffixes []string) bool {
+- ext := filepath.Ext(path)
+- if ext != "" && ext[0] == '.' {
+- ext = ext[1:]
+- }
+- for _, s := range suffixes {
+- if s != "" && ext == s {
+- return true
+- }
+- }
+- return false
+-}
+-
+-// locateTemplateFiles ensures that the snapshot has mapped template files
+-// within the workspace folder.
+-func (s *snapshot) locateTemplateFiles(ctx context.Context) {
+- if len(s.view.Options().TemplateExtensions) == 0 {
+- return
+- }
+- suffixes := s.view.Options().TemplateExtensions
+-
+- searched := 0
+- filterFunc := s.view.filterFunc()
+- err := filepath.WalkDir(s.view.folder.Filename(), func(path string, entry os.DirEntry, err error) error {
+- if err != nil {
+- return err
+- }
+- if entry.IsDir() {
+- return nil
+- }
+- if fileLimit > 0 && searched > fileLimit {
+- return errExhausted
+- }
+- searched++
+- if !fileHasExtension(path, suffixes) {
+- return nil
+- }
+- uri := span.URIFromPath(path)
+- if filterFunc(uri) {
+- return nil
+- }
+- // Get the file in order to include it in the snapshot.
+- // TODO(golang/go#57558): it is fundamentally broken to track files in this
+- // way; we may lose them if configuration or layout changes cause a view to
+- // be recreated.
+- //
+- // Furthermore, this operation must ignore errors, including context
+- // cancellation, or risk leaving the snapshot in an undefined state.
+- s.GetFile(ctx, uri)
+- return nil
+- })
+- if err != nil {
+- event.Error(ctx, "searching for template files failed", err)
+- }
+-}
+-
+-func (v *View) contains(uri span.URI) bool {
+- // If we've expanded the go dir to a parent directory, consider if the
+- // expanded dir contains the uri.
+- // TODO(rfindley): should we ignore the root here? It is not provided by the
+- // user. It would be better to explicitly consider the set of active modules
+- // wherever relevant.
+- inGoDir := false
+- if source.InDir(v.workingDir().Filename(), v.folder.Filename()) {
+- inGoDir = source.InDir(v.workingDir().Filename(), uri.Filename())
+- }
+- inFolder := source.InDir(v.folder.Filename(), uri.Filename())
+-
+- if !inGoDir && !inFolder {
+- return false
+- }
+-
+- return !v.filterFunc()(uri)
+-}
+-
+-// filterFunc returns a func that reports whether uri is filtered by the currently configured
+-// directoryFilters.
+-func (v *View) filterFunc() func(span.URI) bool {
+- filterer := buildFilterer(v.folder.Filename(), v.gomodcache, v.Options())
+- return func(uri span.URI) bool {
+- // Only filter relative to the configured root directory.
+- if source.InDir(v.folder.Filename(), uri.Filename()) {
+- return pathExcludedByFilter(strings.TrimPrefix(uri.Filename(), v.folder.Filename()), filterer)
+- }
+- return false
+- }
+-}
+-
+-func (v *View) relevantChange(c source.FileModification) bool {
+- // If the file is known to the view, the change is relevant.
+- if v.knownFile(c.URI) {
+- return true
+- }
+- // The go.work file may not be "known" because we first access it through the
+- // session. As a result, treat changes to the view's go.work file as always
+- // relevant, even if they are only on-disk changes.
+- //
+- // TODO(rfindley): Make sure the go.work files are always known
+- // to the view.
+- if c.URI == v.effectiveGOWORK() {
+- return true
+- }
+-
+- // Note: CL 219202 filtered out on-disk changes here that were not known to
+- // the view, but this introduces a race when changes arrive before the view
+- // is initialized (and therefore, before it knows about files). Since that CL
+- // had neither test nor associated issue, and cited only emacs behavior, this
+- // logic was deleted.
+-
+- return v.contains(c.URI)
+-}
+-
+-func (v *View) markKnown(uri span.URI) {
+- v.knownFilesMu.Lock()
+- defer v.knownFilesMu.Unlock()
+- if v.knownFiles == nil {
+- v.knownFiles = make(map[span.URI]bool)
+- }
+- v.knownFiles[uri] = true
+-}
+-
+-// knownFile reports whether the specified valid URI (or an alias) is known to the view.
+-func (v *View) knownFile(uri span.URI) bool {
+- v.knownFilesMu.Lock()
+- defer v.knownFilesMu.Unlock()
+- return v.knownFiles[uri]
+-}
+-
+-// shutdown releases resources associated with the view, and waits for ongoing
+-// work to complete.
+-func (v *View) shutdown() {
+- // Cancel the initial workspace load if it is still running.
+- v.initCancelFirstAttempt()
+-
+- v.snapshotMu.Lock()
+- if v.snapshot != nil {
+- v.releaseSnapshot()
+- v.destroy(v.snapshot, "View.shutdown")
+- v.snapshot = nil
+- v.releaseSnapshot = nil
+- }
+- v.snapshotMu.Unlock()
+-
+- v.snapshotWG.Wait()
+-}
+-
+-func (s *snapshot) IgnoredFile(uri span.URI) bool {
+- filename := uri.Filename()
+- var prefixes []string
+- if len(s.workspaceModFiles) == 0 {
+- for _, entry := range filepath.SplitList(s.view.gopath) {
+- prefixes = append(prefixes, filepath.Join(entry, "src"))
+- }
+- } else {
+- prefixes = append(prefixes, s.view.gomodcache)
+- for m := range s.workspaceModFiles {
+- prefixes = append(prefixes, span.Dir(m).Filename())
+- }
+- }
+- for _, prefix := range prefixes {
+- if strings.HasPrefix(filename, prefix) {
+- return checkIgnored(filename[len(prefix):])
+- }
+- }
+- return false
+-}
+-
+-// checkIgnored implements go list's exclusion rules.
+-// Quoting “go help list”:
+-//
+-// Directory and file names that begin with "." or "_" are ignored
+-// by the go tool, as are directories named "testdata".
+-func checkIgnored(suffix string) bool {
+- for _, component := range strings.Split(suffix, string(filepath.Separator)) {
+- if len(component) == 0 {
+- continue
+- }
+- if component[0] == '.' || component[0] == '_' || component == "testdata" {
+- return true
+- }
+- }
+- return false
+-}
+-
+-func (v *View) Snapshot() (source.Snapshot, func(), error) {
+- return v.getSnapshot()
+-}
+-
+-func (v *View) getSnapshot() (*snapshot, func(), error) {
+- v.snapshotMu.Lock()
+- defer v.snapshotMu.Unlock()
+- if v.snapshot == nil {
+- return nil, nil, errors.New("view is shutdown")
+- }
+- return v.snapshot, v.snapshot.Acquire(), nil
+-}
+-
+-func (s *snapshot) initialize(ctx context.Context, firstAttempt bool) {
+- select {
+- case <-ctx.Done():
+- return
+- case s.view.initializationSema <- struct{}{}:
+- }
+-
+- defer func() {
+- <-s.view.initializationSema
+- }()
+-
+- s.mu.Lock()
+- initialized := s.initialized
+- s.mu.Unlock()
+-
+- if initialized {
+- return
+- }
+-
+- s.loadWorkspace(ctx, firstAttempt)
+- s.collectAllKnownSubdirs(ctx)
+-}
+-
+-func (s *snapshot) loadWorkspace(ctx context.Context, firstAttempt bool) (loadErr error) {
+- // A failure is retryable if it may have been due to context cancellation,
+- // and this is not the initial workspace load (firstAttempt==true).
+- //
+- // The IWL runs on a detached context with a long (~10m) timeout, so
+- // if the context was canceled we consider loading to have failed
+- // permanently.
+- retryableFailure := func() bool {
+- return loadErr != nil && ctx.Err() != nil && !firstAttempt
+- }
+- defer func() {
+- if !retryableFailure() {
+- s.mu.Lock()
+- s.initialized = true
+- s.mu.Unlock()
+- }
+- if firstAttempt {
+- close(s.view.initialWorkspaceLoad)
+- }
+- }()
+-
+- // TODO(rFindley): we should only locate template files on the first attempt,
+- // or guard it via a different mechanism.
+- s.locateTemplateFiles(ctx)
+-
+- // Collect module paths to load by parsing go.mod files. If a module fails to
+- // parse, capture the parsing failure as a critical diagnostic.
+- var scopes []loadScope // scopes to load
+- var modDiagnostics []*source.Diagnostic // diagnostics for broken go.mod files
+- addError := func(uri span.URI, err error) {
+- modDiagnostics = append(modDiagnostics, &source.Diagnostic{
+- URI: uri,
+- Severity: protocol.SeverityError,
+- Source: source.ListError,
+- Message: err.Error(),
+- })
+- }
+-
+- if len(s.workspaceModFiles) > 0 {
+- for modURI := range s.workspaceModFiles {
+- // Be careful not to add context cancellation errors as critical module
+- // errors.
+- fh, err := s.GetFile(ctx, modURI)
+- if err != nil {
+- if ctx.Err() == nil {
+- addError(modURI, err)
+- }
+- continue
+- }
+- parsed, err := s.ParseMod(ctx, fh)
+- if err != nil {
+- if ctx.Err() == nil {
+- addError(modURI, err)
+- }
+- continue
+- }
+- if parsed.File == nil || parsed.File.Module == nil {
+- addError(modURI, fmt.Errorf("no module path for %s", modURI))
+- continue
+- }
+- path := parsed.File.Module.Mod.Path
+- scopes = append(scopes, moduleLoadScope(path))
+- }
+- } else {
+- scopes = append(scopes, viewLoadScope("LOAD_VIEW"))
+- }
+-
+- // If we're loading anything, ensure we also load builtin,
+- // since it provides fake definitions (and documentation)
+- // for types like int that are used everywhere.
+- if len(scopes) > 0 {
+- scopes = append(scopes, packageLoadScope("builtin"))
+- }
+- loadErr = s.load(ctx, true, scopes...)
+-
+- if retryableFailure() {
+- return loadErr
+- }
+-
+- var criticalErr *source.CriticalError
+- switch {
+- case loadErr != nil && ctx.Err() != nil:
+- event.Error(ctx, fmt.Sprintf("initial workspace load: %v", loadErr), loadErr)
+- criticalErr = &source.CriticalError{
+- MainError: loadErr,
+- }
+- case loadErr != nil:
+- event.Error(ctx, "initial workspace load failed", loadErr)
+- extractedDiags := s.extractGoCommandErrors(ctx, loadErr)
+- criticalErr = &source.CriticalError{
+- MainError: loadErr,
+- Diagnostics: append(modDiagnostics, extractedDiags...),
+- }
+- case len(modDiagnostics) == 1:
+- criticalErr = &source.CriticalError{
+- MainError: fmt.Errorf(modDiagnostics[0].Message),
+- Diagnostics: modDiagnostics,
+- }
+- case len(modDiagnostics) > 1:
+- criticalErr = &source.CriticalError{
+- MainError: fmt.Errorf("error loading module names"),
+- Diagnostics: modDiagnostics,
+- }
+- }
+-
+- // Lock the snapshot when setting the initialized error.
+- s.mu.Lock()
+- defer s.mu.Unlock()
+- s.initializedErr = criticalErr
+- return loadErr
+-}
+-
+-// invalidateContent invalidates the content of a Go file,
+-// including any position and type information that depends on it.
+-//
+-// invalidateContent returns a non-nil snapshot for the new content, along with
+-// a callback which the caller must invoke to release that snapshot.
+-func (v *View) invalidateContent(ctx context.Context, changes map[span.URI]*fileChange, forceReloadMetadata bool) (*snapshot, func()) {
+- // Detach the context so that content invalidation cannot be canceled.
+- ctx = xcontext.Detach(ctx)
+-
+- // This should be the only time we hold the view's snapshot lock for any period of time.
+- v.snapshotMu.Lock()
+- defer v.snapshotMu.Unlock()
+-
+- prevSnapshot, prevReleaseSnapshot := v.snapshot, v.releaseSnapshot
+-
+- if prevSnapshot == nil {
+- panic("invalidateContent called after shutdown")
+- }
+-
+- // Cancel all still-running previous requests, since they would be
+- // operating on stale data.
+- prevSnapshot.cancel()
+-
+- // Do not clone a snapshot until its view has finished initializing.
+- prevSnapshot.AwaitInitialized(ctx)
+-
+- // Save one lease of the cloned snapshot in the view.
+- v.snapshot, v.releaseSnapshot = prevSnapshot.clone(ctx, v.baseCtx, changes, forceReloadMetadata)
+-
+- prevReleaseSnapshot()
+- v.destroy(prevSnapshot, "View.invalidateContent")
+-
+- // Return a second lease to the caller.
+- return v.snapshot, v.snapshot.Acquire()
+-}
+-
+-func (s *Session) getWorkspaceInformation(ctx context.Context, folder span.URI, options *source.Options) (workspaceInformation, error) {
+- if err := checkPathCase(folder.Filename()); err != nil {
+- return workspaceInformation{}, fmt.Errorf("invalid workspace folder path: %w; check that the casing of the configured workspace folder path agrees with the casing reported by the operating system", err)
+- }
+- var err error
+- var info workspaceInformation
+- inv := gocommand.Invocation{
+- WorkingDir: folder.Filename(),
+- Env: options.EnvSlice(),
+- }
+- info.goversion, err = gocommand.GoVersion(ctx, inv, s.gocmdRunner)
+- if err != nil {
+- return info, err
+- }
+- info.goversionOutput, err = gocommand.GoVersionOutput(ctx, inv, s.gocmdRunner)
+- if err != nil {
+- return info, err
+- }
+- if err := info.goEnv.load(ctx, folder.Filename(), options.EnvSlice(), s.gocmdRunner); err != nil {
+- return info, err
+- }
+- // The value of GOPACKAGESDRIVER is not returned through the go command.
+- gopackagesdriver := os.Getenv("GOPACKAGESDRIVER")
+- // A user may also have a gopackagesdriver binary on their machine, which
+- // works the same way as setting GOPACKAGESDRIVER.
+- tool, _ := exec.LookPath("gopackagesdriver")
+- info.hasGopackagesDriver = gopackagesdriver != "off" && (gopackagesdriver != "" || tool != "")
+-
+- // filterFunc is the path filter function for this workspace folder. Notably,
+- // it is relative to folder (which is specified by the user), not root.
+- filterFunc := pathExcludedByFilterFunc(folder.Filename(), info.gomodcache, options)
+- info.gomod, err = findWorkspaceModFile(ctx, folder, s, filterFunc)
+- if err != nil {
+- return info, err
+- }
+-
+- return info, nil
+-}
+-
+-// findWorkspaceModFile searches for a single go.mod file relative to the given
+-// folder URI, using the following algorithm:
+-// 1. if there is a go.mod file in a parent directory, return it
+-// 2. else, if there is exactly one nested module, return it
+-// 3. else, return ""
+-func findWorkspaceModFile(ctx context.Context, folderURI span.URI, fs source.FileSource, excludePath func(string) bool) (span.URI, error) {
+- folder := folderURI.Filename()
+- match, err := findRootPattern(ctx, folder, "go.mod", fs)
+- if err != nil {
+- if ctxErr := ctx.Err(); ctxErr != nil {
+- return "", ctxErr
+- }
+- return "", err
+- }
+- if match != "" {
+- return span.URIFromPath(match), nil
+- }
+-
+- // ...else we should check if there's exactly one nested module.
+- all, err := findModules(folderURI, excludePath, 2)
+- if err == errExhausted {
+- // Fall-back behavior: if we don't find any modules after searching 10000
+- // files, assume there are none.
+- event.Log(ctx, fmt.Sprintf("stopped searching for modules after %d files", fileLimit))
+- return "", nil
+- }
+- if err != nil {
+- return "", err
+- }
+- if len(all) == 1 {
+- // range to access first element.
+- for uri := range all {
+- return uri, nil
+- }
+- }
+- return "", nil
+-}
+-
+-// workingDir returns the directory from which to run Go commands.
+-//
+-// The only case where this should matter is if we've narrowed the workspace to
+-// a singular nested module. In that case, the go command won't be able to find
+-// the module unless we tell it the nested directory.
+-func (v *View) workingDir() span.URI {
+- // Note: if gowork is in use, this will default to the workspace folder. In
+- // the past, we would instead use the folder containing go.work. This should
+- // not make a difference, and in fact may improve go list error messages.
+- //
+- // TODO(golang/go#57514): eliminate the expandWorkspaceToModule setting
+- // entirely.
+- if v.Options().ExpandWorkspaceToModule && v.gomod != "" {
+- return span.Dir(v.gomod)
+- }
+- return v.folder
+-}
+-
+-// findRootPattern looks for files with the given basename in dir or any parent
+-// directory of dir, using the provided FileSource. It returns the first match,
+-// starting from dir and search parents.
+-//
+-// The resulting string is either the file path of a matching file with the
+-// given basename, or "" if none was found.
+-func findRootPattern(ctx context.Context, dir, basename string, fs source.FileSource) (string, error) {
+- for dir != "" {
+- target := filepath.Join(dir, basename)
+- exists, err := fileExists(ctx, span.URIFromPath(target), fs)
+- if err != nil {
+- return "", err // not readable or context cancelled
+- }
+- if exists {
+- return target, nil
+- }
+- // Trailing separators must be trimmed, otherwise filepath.Split is a noop.
+- next, _ := filepath.Split(strings.TrimRight(dir, string(filepath.Separator)))
+- if next == dir {
+- break
+- }
+- dir = next
+- }
+- return "", nil
+-}
+-
+-// OS-specific path case check, for case-insensitive filesystems.
+-var checkPathCase = defaultCheckPathCase
+-
+-func defaultCheckPathCase(path string) error {
+- return nil
+-}
+-
+-func (v *View) IsGoPrivatePath(target string) bool {
+- return globsMatchPath(v.goprivate, target)
+-}
+-
+-func (v *View) ModuleUpgrades(modfile span.URI) map[string]string {
+- v.moduleUpgradesMu.Lock()
+- defer v.moduleUpgradesMu.Unlock()
+-
+- upgrades := map[string]string{}
+- for mod, ver := range v.moduleUpgrades[modfile] {
+- upgrades[mod] = ver
+- }
+- return upgrades
+-}
+-
+-func (v *View) RegisterModuleUpgrades(modfile span.URI, upgrades map[string]string) {
+- // Return early if there are no upgrades.
+- if len(upgrades) == 0 {
+- return
+- }
+-
+- v.moduleUpgradesMu.Lock()
+- defer v.moduleUpgradesMu.Unlock()
+-
+- m := v.moduleUpgrades[modfile]
+- if m == nil {
+- m = make(map[string]string)
+- v.moduleUpgrades[modfile] = m
+- }
+- for mod, ver := range upgrades {
+- m[mod] = ver
+- }
+-}
+-
+-func (v *View) ClearModuleUpgrades(modfile span.URI) {
+- v.moduleUpgradesMu.Lock()
+- defer v.moduleUpgradesMu.Unlock()
+-
+- delete(v.moduleUpgrades, modfile)
+-}
+-
+-const maxGovulncheckResultAge = 1 * time.Hour // Invalidate results older than this limit.
+-var timeNow = time.Now // for testing
+-
+-func (v *View) Vulnerabilities(modfiles ...span.URI) map[span.URI]*govulncheck.Result {
+- m := make(map[span.URI]*govulncheck.Result)
+- now := timeNow()
+- v.vulnsMu.Lock()
+- defer v.vulnsMu.Unlock()
+-
+- if len(modfiles) == 0 { // empty means all modfiles
+- for modfile := range v.vulns {
+- modfiles = append(modfiles, modfile)
+- }
+- }
+- for _, modfile := range modfiles {
+- vuln := v.vulns[modfile]
+- if vuln != nil && now.Sub(vuln.AsOf) > maxGovulncheckResultAge {
+- v.vulns[modfile] = nil // same as SetVulnerabilities(modfile, nil)
+- vuln = nil
+- }
+- m[modfile] = vuln
+- }
+- return m
+-}
+-
+-func (v *View) SetVulnerabilities(modfile span.URI, vulns *govulncheck.Result) {
+- v.vulnsMu.Lock()
+- defer v.vulnsMu.Unlock()
+-
+- v.vulns[modfile] = vulns
+-}
+-
+-func (v *View) GoVersion() int {
+- return v.workspaceInformation.goversion
+-}
+-
+-func (v *View) GoVersionString() string {
+- return gocommand.ParseGoVersionOutput(v.workspaceInformation.goversionOutput)
+-}
+-
+-// Copied from
+-// https://cs.opensource.google/go/go/+/master:src/cmd/go/internal/str/path.go;l=58;drc=2910c5b4a01a573ebc97744890a07c1a3122c67a
+-func globsMatchPath(globs, target string) bool {
+- for globs != "" {
+- // Extract next non-empty glob in comma-separated list.
+- var glob string
+- if i := strings.Index(globs, ","); i >= 0 {
+- glob, globs = globs[:i], globs[i+1:]
+- } else {
+- glob, globs = globs, ""
+- }
+- if glob == "" {
+- continue
+- }
+-
+- // A glob with N+1 path elements (N slashes) needs to be matched
+- // against the first N+1 path elements of target,
+- // which end just before the N+1'th slash.
+- n := strings.Count(glob, "/")
+- prefix := target
+- // Walk target, counting slashes, truncating at the N+1'th slash.
+- for i := 0; i < len(target); i++ {
+- if target[i] == '/' {
+- if n == 0 {
+- prefix = target[:i]
+- break
+- }
+- n--
+- }
+- }
+- if n > 0 {
+- // Not enough prefix elements.
+- continue
+- }
+- matched, _ := path.Match(glob, prefix)
+- if matched {
+- return true
+- }
+- }
+- return false
+-}
+-
+-var modFlagRegexp = regexp.MustCompile(`-mod[ =](\w+)`)
+-
+-// TODO(rstambler): Consolidate modURI and modContent back into a FileHandle
+-// after we have a version of the workspace go.mod file on disk. Getting a
+-// FileHandle from the cache for temporary files is problematic, since we
+-// cannot delete it.
+-func (s *snapshot) vendorEnabled(ctx context.Context, modURI span.URI, modContent []byte) (bool, error) {
+- // Legacy GOPATH workspace?
+- if s.workspaceMode()&moduleMode == 0 {
+- return false, nil
+- }
+-
+- // Explicit -mod flag?
+- matches := modFlagRegexp.FindStringSubmatch(s.view.goflags)
+- if len(matches) != 0 {
+- modFlag := matches[1]
+- if modFlag != "" {
+- // Don't override an explicit '-mod=vendor' argument.
+- // We do want to override '-mod=readonly': it would break various module code lenses,
+- // and on 1.16 we know -modfile is available, so we won't mess with go.mod anyway.
+- return modFlag == "vendor", nil
+- }
+- }
+-
+- modFile, err := modfile.Parse(modURI.Filename(), modContent, nil)
+- if err != nil {
+- return false, err
+- }
+-
+- // No vendor directory?
+- // TODO(golang/go#57514): this is wrong if the working dir is not the module
+- // root.
+- if fi, err := os.Stat(filepath.Join(s.view.workingDir().Filename(), "vendor")); err != nil || !fi.IsDir() {
+- return false, nil
+- }
+-
+- // Vendoring enabled by default by go declaration in go.mod?
+- vendorEnabled := modFile.Go != nil && modFile.Go.Version != "" && semver.Compare("v"+modFile.Go.Version, "v1.14") >= 0
+- return vendorEnabled, nil
+-}
+-
+-// TODO(rfindley): clean up the redundancy of allFilesExcluded,
+-// pathExcludedByFilterFunc, pathExcludedByFilter, view.filterFunc...
+-func allFilesExcluded(files []string, filterFunc func(span.URI) bool) bool {
+- for _, f := range files {
+- uri := span.URIFromPath(f)
+- if !filterFunc(uri) {
+- return false
+- }
+- }
+- return true
+-}
+-
+-func pathExcludedByFilterFunc(folder, gomodcache string, opts *source.Options) func(string) bool {
+- filterer := buildFilterer(folder, gomodcache, opts)
+- return func(path string) bool {
+- return pathExcludedByFilter(path, filterer)
+- }
+-}
+-
+-// pathExcludedByFilter reports whether the path (relative to the workspace
+-// folder) should be excluded by the configured directory filters.
+-//
+-// TODO(rfindley): passing root and gomodcache here makes it confusing whether
+-// path should be absolute or relative, and has already caused at least one
+-// bug.
+-func pathExcludedByFilter(path string, filterer *source.Filterer) bool {
+- path = strings.TrimPrefix(filepath.ToSlash(path), "/")
+- return filterer.Disallow(path)
+-}
+-
+-func buildFilterer(folder, gomodcache string, opts *source.Options) *source.Filterer {
+- filters := opts.DirectoryFilters
+-
+- if pref := strings.TrimPrefix(gomodcache, folder); pref != gomodcache {
+- modcacheFilter := "-" + strings.TrimPrefix(filepath.ToSlash(pref), "/")
+- filters = append(filters, modcacheFilter)
+- }
+- return source.NewFilterer(filters)
+-}
+diff -urN a/gopls/internal/lsp/cache/view_test.go b/gopls/internal/lsp/cache/view_test.go
+--- a/gopls/internal/lsp/cache/view_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/view_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,278 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-package cache
+-
+-import (
+- "context"
+- "encoding/json"
+- "io/ioutil"
+- "os"
+- "path/filepath"
+- "testing"
+- "time"
+-
+- "github.com/google/go-cmp/cmp"
+- "golang.org/x/tools/gopls/internal/govulncheck"
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-func TestCaseInsensitiveFilesystem(t *testing.T) {
+- base, err := ioutil.TempDir("", t.Name())
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- inner := filepath.Join(base, "a/B/c/DEFgh")
+- if err := os.MkdirAll(inner, 0777); err != nil {
+- t.Fatal(err)
+- }
+- file := filepath.Join(inner, "f.go")
+- if err := ioutil.WriteFile(file, []byte("hi"), 0777); err != nil {
+- t.Fatal(err)
+- }
+- if _, err := os.Stat(filepath.Join(inner, "F.go")); err != nil {
+- t.Skip("filesystem is case-sensitive")
+- }
+-
+- tests := []struct {
+- path string
+- err bool
+- }{
+- {file, false},
+- {filepath.Join(inner, "F.go"), true},
+- {filepath.Join(base, "a/b/c/defgh/f.go"), true},
+- }
+- for _, tt := range tests {
+- err := checkPathCase(tt.path)
+- if err != nil != tt.err {
+- t.Errorf("checkPathCase(%q) = %v, wanted error: %v", tt.path, err, tt.err)
+- }
+- }
+-}
+-
+-func TestFindWorkspaceModFile(t *testing.T) {
+- workspace := `
+--- a/go.mod --
+-module a
+--- a/x/x.go
+-package x
+--- a/x/y/y.go
+-package x
+--- b/go.mod --
+-module b
+--- b/c/go.mod --
+-module bc
+--- d/gopls.mod --
+-module d-goplsworkspace
+--- d/e/go.mod --
+-module de
+--- f/g/go.mod --
+-module fg
+-`
+- dir, err := fake.Tempdir(fake.UnpackTxt(workspace))
+- if err != nil {
+- t.Fatal(err)
+- }
+- defer os.RemoveAll(dir)
+-
+- tests := []struct {
+- folder, want string
+- }{
+- {"", ""}, // no module at root, and more than one nested module
+- {"a", "a/go.mod"},
+- {"a/x", "a/go.mod"},
+- {"a/x/y", "a/go.mod"},
+- {"b/c", "b/c/go.mod"},
+- {"d", "d/e/go.mod"},
+- {"d/e", "d/e/go.mod"},
+- {"f", "f/g/go.mod"},
+- }
+-
+- for _, test := range tests {
+- ctx := context.Background()
+- rel := fake.RelativeTo(dir)
+- folderURI := span.URIFromPath(rel.AbsPath(test.folder))
+- excludeNothing := func(string) bool { return false }
+- got, err := findWorkspaceModFile(ctx, folderURI, New(nil), excludeNothing)
+- if err != nil {
+- t.Fatal(err)
+- }
+- want := span.URI("")
+- if test.want != "" {
+- want = span.URIFromPath(rel.AbsPath(test.want))
+- }
+- if got != want {
+- t.Errorf("findWorkspaceModFile(%q) = %q, want %q", test.folder, got, want)
+- }
+- }
+-}
+-
+-func TestInVendor(t *testing.T) {
+- for _, tt := range []struct {
+- path string
+- inVendor bool
+- }{
+- {"foo/vendor/x.go", false},
+- {"foo/vendor/x/x.go", true},
+- {"foo/x.go", false},
+- {"foo/vendor/foo.txt", false},
+- {"foo/vendor/modules.txt", false},
+- } {
+- if got := inVendor(span.URIFromPath(tt.path)); got != tt.inVendor {
+- t.Errorf("expected %s inVendor %v, got %v", tt.path, tt.inVendor, got)
+- }
+- }
+-}
+-
+-func TestFilters(t *testing.T) {
+- tests := []struct {
+- filters []string
+- included []string
+- excluded []string
+- }{
+- {
+- included: []string{"x"},
+- },
+- {
+- filters: []string{"-"},
+- excluded: []string{"x", "x/a"},
+- },
+- {
+- filters: []string{"-x", "+y"},
+- included: []string{"y", "y/a", "z"},
+- excluded: []string{"x", "x/a"},
+- },
+- {
+- filters: []string{"-x", "+x/y", "-x/y/z"},
+- included: []string{"x/y", "x/y/a", "a"},
+- excluded: []string{"x", "x/a", "x/y/z/a"},
+- },
+- {
+- filters: []string{"+foobar", "-foo"},
+- included: []string{"foobar", "foobar/a"},
+- excluded: []string{"foo", "foo/a"},
+- },
+- }
+-
+- for _, tt := range tests {
+- filterer := source.NewFilterer(tt.filters)
+- for _, inc := range tt.included {
+- if pathExcludedByFilter(inc, filterer) {
+- t.Errorf("filters %q excluded %v, wanted included", tt.filters, inc)
+- }
+- }
+- for _, exc := range tt.excluded {
+- if !pathExcludedByFilter(exc, filterer) {
+- t.Errorf("filters %q included %v, wanted excluded", tt.filters, exc)
+- }
+- }
+- }
+-}
+-
+-func TestSuffixes(t *testing.T) {
+- type file struct {
+- path string
+- want bool
+- }
+- type cases struct {
+- option []string
+- files []file
+- }
+- tests := []cases{
+- {[]string{"tmpl", "gotmpl"}, []file{ // default
+- {"foo", false},
+- {"foo.tmpl", true},
+- {"foo.gotmpl", true},
+- {"tmpl", false},
+- {"tmpl.go", false}},
+- },
+- {[]string{"tmpl", "gotmpl", "html", "gohtml"}, []file{
+- {"foo.gotmpl", true},
+- {"foo.html", true},
+- {"foo.gohtml", true},
+- {"html", false}},
+- },
+- {[]string{"tmpl", "gotmpl", ""}, []file{ // possible user mistake
+- {"foo.gotmpl", true},
+- {"foo.go", false},
+- {"foo", false}},
+- },
+- }
+- for _, a := range tests {
+- suffixes := a.option
+- for _, b := range a.files {
+- got := fileHasExtension(b.path, suffixes)
+- if got != b.want {
+- t.Errorf("got %v, want %v, option %q, file %q (%+v)",
+- got, b.want, a.option, b.path, b)
+- }
+- }
+- }
+-}
+-
+-func TestView_Vulnerabilities(t *testing.T) {
+- // TODO(hyangah): use t.Cleanup when we get rid of go1.13 legacy CI.
+- defer func() { timeNow = time.Now }()
+-
+- now := time.Now()
+-
+- view := &View{
+- vulns: make(map[span.URI]*govulncheck.Result),
+- }
+- file1, file2 := span.URIFromPath("f1/go.mod"), span.URIFromPath("f2/go.mod")
+-
+- vuln1 := &govulncheck.Result{AsOf: now.Add(-(maxGovulncheckResultAge * 3) / 4)} // already ~3/4*maxGovulncheckResultAge old
+- view.SetVulnerabilities(file1, vuln1)
+-
+- vuln2 := &govulncheck.Result{AsOf: now} // fresh.
+- view.SetVulnerabilities(file2, vuln2)
+-
+- t.Run("fresh", func(t *testing.T) {
+- got := view.Vulnerabilities()
+- want := map[span.URI]*govulncheck.Result{
+- file1: vuln1,
+- file2: vuln2,
+- }
+-
+- if diff := cmp.Diff(toJSON(want), toJSON(got)); diff != "" {
+- t.Errorf("view.Vulnerabilities() mismatch (-want +got):\n%s", diff)
+- }
+- })
+-
+- // maxGovulncheckResultAge/2 later
+- timeNow = func() time.Time { return now.Add(maxGovulncheckResultAge / 2) }
+- t.Run("after30min", func(t *testing.T) {
+- got := view.Vulnerabilities()
+- want := map[span.URI]*govulncheck.Result{
+- file1: nil, // expired.
+- file2: vuln2,
+- }
+-
+- if diff := cmp.Diff(toJSON(want), toJSON(got)); diff != "" {
+- t.Errorf("view.Vulnerabilities() mismatch (-want +got):\n%s", diff)
+- }
+- })
+-
+- // maxGovulncheckResultAge later
+- timeNow = func() time.Time { return now.Add(maxGovulncheckResultAge + time.Minute) }
+-
+- t.Run("after1hr", func(t *testing.T) {
+- got := view.Vulnerabilities()
+- want := map[span.URI]*govulncheck.Result{
+- file1: nil,
+- file2: nil,
+- }
+-
+- if diff := cmp.Diff(toJSON(want), toJSON(got)); diff != "" {
+- t.Errorf("view.Vulnerabilities() mismatch (-want +got):\n%s", diff)
+- }
+- })
+-}
+-
+-func toJSON(x interface{}) string {
+- b, _ := json.MarshalIndent(x, "", " ")
+- return string(b)
+-}
+diff -urN a/gopls/internal/lsp/cache/workspace.go b/gopls/internal/lsp/cache/workspace.go
+--- a/gopls/internal/lsp/cache/workspace.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cache/workspace.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,177 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cache
+-
+-import (
+- "context"
+- "errors"
+- "fmt"
+- "os"
+- "path/filepath"
+- "sort"
+- "strings"
+-
+- "golang.org/x/mod/modfile"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-// TODO(rfindley): now that experimentalWorkspaceModule is gone, this file can
+-// be massively cleaned up and/or removed.
+-
+-// computeWorkspaceModFiles computes the set of workspace mod files based on the
+-// value of go.mod, go.work, and GO111MODULE.
+-func computeWorkspaceModFiles(ctx context.Context, gomod, gowork span.URI, go111module go111module, fs source.FileSource) (map[span.URI]struct{}, error) {
+- if go111module == off {
+- return nil, nil
+- }
+- if gowork != "" {
+- fh, err := fs.GetFile(ctx, gowork)
+- if err != nil {
+- return nil, err
+- }
+- content, err := fh.Read()
+- if err != nil {
+- return nil, err
+- }
+- filename := gowork.Filename()
+- dir := filepath.Dir(filename)
+- workFile, err := modfile.ParseWork(filename, content, nil)
+- if err != nil {
+- return nil, fmt.Errorf("parsing go.work: %w", err)
+- }
+- modFiles := make(map[span.URI]struct{})
+- for _, use := range workFile.Use {
+- modDir := filepath.FromSlash(use.Path)
+- if !filepath.IsAbs(modDir) {
+- modDir = filepath.Join(dir, modDir)
+- }
+- modURI := span.URIFromPath(filepath.Join(modDir, "go.mod"))
+- modFiles[modURI] = struct{}{}
+- }
+- return modFiles, nil
+- }
+- if gomod != "" {
+- return map[span.URI]struct{}{gomod: {}}, nil
+- }
+- return nil, nil
+-}
+-
+-// dirs returns the workspace directories for the loaded modules.
+-//
+-// A workspace directory is, roughly speaking, a directory for which we care
+-// about file changes. This is used for the purpose of registering file
+-// watching patterns, and expanding directory modifications to their adjacent
+-// files.
+-//
+-// TODO(rfindley): move this to snapshot.go.
+-// TODO(rfindley): can we make this abstraction simpler and/or more accurate?
+-func (s *snapshot) dirs(ctx context.Context) []span.URI {
+- dirSet := make(map[span.URI]struct{})
+-
+- // Dirs should, at the very least, contain the working directory and folder.
+- dirSet[s.view.workingDir()] = struct{}{}
+- dirSet[s.view.folder] = struct{}{}
+-
+- // Additionally, if e.g. go.work indicates other workspace modules, we should
+- // include their directories too.
+- if s.workspaceModFilesErr == nil {
+- for modFile := range s.workspaceModFiles {
+- dir := filepath.Dir(modFile.Filename())
+- dirSet[span.URIFromPath(dir)] = struct{}{}
+- }
+- }
+- var dirs []span.URI
+- for d := range dirSet {
+- dirs = append(dirs, d)
+- }
+- sort.Slice(dirs, func(i, j int) bool { return dirs[i] < dirs[j] })
+- return dirs
+-}
+-
+-// isGoMod reports if uri is a go.mod file.
+-func isGoMod(uri span.URI) bool {
+- return filepath.Base(uri.Filename()) == "go.mod"
+-}
+-
+-// isGoWork reports if uri is a go.work file.
+-func isGoWork(uri span.URI) bool {
+- return filepath.Base(uri.Filename()) == "go.work"
+-}
+-
+-// fileExists reports if the file uri exists within source.
+-func fileExists(ctx context.Context, uri span.URI, source source.FileSource) (bool, error) {
+- fh, err := source.GetFile(ctx, uri)
+- if err != nil {
+- return false, err
+- }
+- return fileHandleExists(fh)
+-}
+-
+-// fileHandleExists reports if the file underlying fh actually exits.
+-func fileHandleExists(fh source.FileHandle) (bool, error) {
+- _, err := fh.Read()
+- if err == nil {
+- return true, nil
+- }
+- if os.IsNotExist(err) {
+- return false, nil
+- }
+- return false, err
+-}
+-
+-// errExhausted is returned by findModules if the file scan limit is reached.
+-var errExhausted = errors.New("exhausted")
+-
+-// Limit go.mod search to 1 million files. As a point of reference,
+-// Kubernetes has 22K files (as of 2020-11-24).
+-const fileLimit = 1000000
+-
+-// findModules recursively walks the root directory looking for go.mod files,
+-// returning the set of modules it discovers. If modLimit is non-zero,
+-// searching stops once modLimit modules have been found.
+-//
+-// TODO(rfindley): consider overlays.
+-func findModules(root span.URI, excludePath func(string) bool, modLimit int) (map[span.URI]struct{}, error) {
+- // Walk the view's folder to find all modules in the view.
+- modFiles := make(map[span.URI]struct{})
+- searched := 0
+- errDone := errors.New("done")
+- err := filepath.Walk(root.Filename(), func(path string, info os.FileInfo, err error) error {
+- if err != nil {
+- // Probably a permission error. Keep looking.
+- return filepath.SkipDir
+- }
+- // For any path that is not the workspace folder, check if the path
+- // would be ignored by the go command. Vendor directories also do not
+- // contain workspace modules.
+- if info.IsDir() && path != root.Filename() {
+- suffix := strings.TrimPrefix(path, root.Filename())
+- switch {
+- case checkIgnored(suffix),
+- strings.Contains(filepath.ToSlash(suffix), "/vendor/"),
+- excludePath(suffix):
+- return filepath.SkipDir
+- }
+- }
+- // We're only interested in go.mod files.
+- uri := span.URIFromPath(path)
+- if isGoMod(uri) {
+- modFiles[uri] = struct{}{}
+- }
+- if modLimit > 0 && len(modFiles) >= modLimit {
+- return errDone
+- }
+- searched++
+- if fileLimit > 0 && searched >= fileLimit {
+- return errExhausted
+- }
+- return nil
+- })
+- if err == errDone {
+- return modFiles, nil
+- }
+- return modFiles, err
+-}
+diff -urN a/gopls/internal/lsp/call_hierarchy.go b/gopls/internal/lsp/call_hierarchy.go
+--- a/gopls/internal/lsp/call_hierarchy.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/call_hierarchy.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,42 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-func (s *Server) prepareCallHierarchy(ctx context.Context, params *protocol.CallHierarchyPrepareParams) ([]protocol.CallHierarchyItem, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.Go)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+-
+- return source.PrepareCallHierarchy(ctx, snapshot, fh, params.Position)
+-}
+-
+-func (s *Server) incomingCalls(ctx context.Context, params *protocol.CallHierarchyIncomingCallsParams) ([]protocol.CallHierarchyIncomingCall, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.Item.URI, source.Go)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+-
+- return source.IncomingCalls(ctx, snapshot, fh, params.Item.Range.Start)
+-}
+-
+-func (s *Server) outgoingCalls(ctx context.Context, params *protocol.CallHierarchyOutgoingCallsParams) ([]protocol.CallHierarchyOutgoingCall, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.Item.URI, source.Go)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+-
+- return source.OutgoingCalls(ctx, snapshot, fh, params.Item.Range.Start)
+-}
+diff -urN a/gopls/internal/lsp/cmd/call_hierarchy.go b/gopls/internal/lsp/cmd/call_hierarchy.go
+--- a/gopls/internal/lsp/cmd/call_hierarchy.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/call_hierarchy.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,142 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// callHierarchy implements the callHierarchy verb for gopls.
+-type callHierarchy struct {
+- app *Application
+-}
+-
+-func (c *callHierarchy) Name() string { return "call_hierarchy" }
+-func (c *callHierarchy) Parent() string { return c.app.Name() }
+-func (c *callHierarchy) Usage() string { return "<position>" }
+-func (c *callHierarchy) ShortHelp() string { return "display selected identifier's call hierarchy" }
+-func (c *callHierarchy) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), `
+-Example:
+-
+- $ # 1-indexed location (:line:column or :#offset) of the target identifier
+- $ gopls call_hierarchy helper/helper.go:8:6
+- $ gopls call_hierarchy helper/helper.go:#53
+-`)
+- printFlagDefaults(f)
+-}
+-
+-func (c *callHierarchy) Run(ctx context.Context, args ...string) error {
+- if len(args) != 1 {
+- return tool.CommandLineErrorf("call_hierarchy expects 1 argument (position)")
+- }
+-
+- conn, err := c.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+-
+- from := span.Parse(args[0])
+- file := conn.openFile(ctx, from.URI())
+- if file.err != nil {
+- return file.err
+- }
+-
+- loc, err := file.mapper.SpanLocation(from)
+- if err != nil {
+- return err
+- }
+-
+- p := protocol.CallHierarchyPrepareParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+-
+- callItems, err := conn.PrepareCallHierarchy(ctx, &p)
+- if err != nil {
+- return err
+- }
+- if len(callItems) == 0 {
+- return fmt.Errorf("function declaration identifier not found at %v", args[0])
+- }
+-
+- for _, item := range callItems {
+- incomingCalls, err := conn.IncomingCalls(ctx, &protocol.CallHierarchyIncomingCallsParams{Item: item})
+- if err != nil {
+- return err
+- }
+- for i, call := range incomingCalls {
+- // From the spec: CallHierarchyIncomingCall.FromRanges is relative to
+- // the caller denoted by CallHierarchyIncomingCall.from.
+- printString, err := callItemPrintString(ctx, conn, call.From, call.From.URI, call.FromRanges)
+- if err != nil {
+- return err
+- }
+- fmt.Printf("caller[%d]: %s\n", i, printString)
+- }
+-
+- printString, err := callItemPrintString(ctx, conn, item, "", nil)
+- if err != nil {
+- return err
+- }
+- fmt.Printf("identifier: %s\n", printString)
+-
+- outgoingCalls, err := conn.OutgoingCalls(ctx, &protocol.CallHierarchyOutgoingCallsParams{Item: item})
+- if err != nil {
+- return err
+- }
+- for i, call := range outgoingCalls {
+- // From the spec: CallHierarchyOutgoingCall.FromRanges is the range
+- // relative to the caller, e.g the item passed to
+- printString, err := callItemPrintString(ctx, conn, call.To, item.URI, call.FromRanges)
+- if err != nil {
+- return err
+- }
+- fmt.Printf("callee[%d]: %s\n", i, printString)
+- }
+- }
+-
+- return nil
+-}
+-
+-// callItemPrintString returns a protocol.CallHierarchyItem object represented as a string.
+-// item and call ranges (protocol.Range) are converted to user friendly spans (1-indexed).
+-func callItemPrintString(ctx context.Context, conn *connection, item protocol.CallHierarchyItem, callsURI protocol.DocumentURI, calls []protocol.Range) (string, error) {
+- itemFile := conn.openFile(ctx, item.URI.SpanURI())
+- if itemFile.err != nil {
+- return "", itemFile.err
+- }
+- itemSpan, err := itemFile.mapper.LocationSpan(protocol.Location{URI: item.URI, Range: item.Range})
+- if err != nil {
+- return "", err
+- }
+-
+- callsFile := conn.openFile(ctx, callsURI.SpanURI())
+- if callsURI != "" && callsFile.err != nil {
+- return "", callsFile.err
+- }
+- var callRanges []string
+- for _, rng := range calls {
+- call, err := callsFile.mapper.RangeSpan(rng)
+- if err != nil {
+- return "", err
+- }
+- callRange := fmt.Sprintf("%d:%d-%d", call.Start().Line(), call.Start().Column(), call.End().Column())
+- callRanges = append(callRanges, callRange)
+- }
+-
+- printString := fmt.Sprintf("function %s in %v", item.Name, itemSpan)
+- if len(calls) > 0 {
+- printString = fmt.Sprintf("ranges %s in %s from/to %s", strings.Join(callRanges, ", "), callsURI.SpanURI().Filename(), printString)
+- }
+- return printString, nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/capabilities_test.go b/gopls/internal/lsp/cmd/capabilities_test.go
+--- a/gopls/internal/lsp/cmd/capabilities_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/capabilities_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,166 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "fmt"
+- "io/ioutil"
+- "os"
+- "path/filepath"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp"
+- "golang.org/x/tools/gopls/internal/lsp/cache"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-// TestCapabilities does some minimal validation of the server's adherence to the LSP.
+-// The checks in the test are added as changes are made and errors noticed.
+-func TestCapabilities(t *testing.T) {
+- tmpDir, err := ioutil.TempDir("", "fake")
+- if err != nil {
+- t.Fatal(err)
+- }
+- tmpFile := filepath.Join(tmpDir, "fake.go")
+- if err := ioutil.WriteFile(tmpFile, []byte(""), 0775); err != nil {
+- t.Fatal(err)
+- }
+- if err := ioutil.WriteFile(filepath.Join(tmpDir, "go.mod"), []byte("module fake\n\ngo 1.12\n"), 0775); err != nil {
+- t.Fatal(err)
+- }
+- defer os.RemoveAll(tmpDir)
+-
+- app := New("gopls-test", tmpDir, os.Environ(), nil)
+- c := newConnection(app)
+- ctx := context.Background()
+- defer c.terminate(ctx)
+-
+- params := &protocol.ParamInitialize{}
+- params.RootURI = protocol.URIFromPath(c.Client.app.wd)
+- params.Capabilities.Workspace.Configuration = true
+-
+- // Send an initialize request to the server.
+- c.Server = lsp.NewServer(cache.NewSession(ctx, cache.New(nil), app.options), c.Client)
+- result, err := c.Server.Initialize(ctx, params)
+- if err != nil {
+- t.Fatal(err)
+- }
+- // Validate initialization result.
+- if err := validateCapabilities(result); err != nil {
+- t.Error(err)
+- }
+- // Complete initialization of server.
+- if err := c.Server.Initialized(ctx, &protocol.InitializedParams{}); err != nil {
+- t.Fatal(err)
+- }
+-
+- // Open the file on the server side.
+- uri := protocol.URIFromPath(tmpFile)
+- if err := c.Server.DidOpen(ctx, &protocol.DidOpenTextDocumentParams{
+- TextDocument: protocol.TextDocumentItem{
+- URI: uri,
+- LanguageID: "go",
+- Version: 1,
+- Text: `package main; func main() {};`,
+- },
+- }); err != nil {
+- t.Fatal(err)
+- }
+-
+- // If we are sending a full text change, the change.Range must be nil.
+- // It is not enough for the Change to be empty, as that is ambiguous.
+- if err := c.Server.DidChange(ctx, &protocol.DidChangeTextDocumentParams{
+- TextDocument: protocol.VersionedTextDocumentIdentifier{
+- TextDocumentIdentifier: protocol.TextDocumentIdentifier{
+- URI: uri,
+- },
+- Version: 2,
+- },
+- ContentChanges: []protocol.TextDocumentContentChangeEvent{
+- {
+- Range: nil,
+- Text: `package main; func main() { fmt.Println("") }`,
+- },
+- },
+- }); err != nil {
+- t.Fatal(err)
+- }
+-
+- // Send a code action request to validate expected types.
+- actions, err := c.Server.CodeAction(ctx, &protocol.CodeActionParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: uri,
+- },
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- for _, action := range actions {
+- // Validate that an empty command is sent along with import organization responses.
+- if action.Kind == protocol.SourceOrganizeImports && action.Command != nil {
+- t.Errorf("unexpected command for import organization")
+- }
+- }
+-
+- if err := c.Server.DidSave(ctx, &protocol.DidSaveTextDocumentParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: uri,
+- },
+- // LSP specifies that a file can be saved with optional text, so this field must be nil.
+- Text: nil,
+- }); err != nil {
+- t.Fatal(err)
+- }
+-
+- // Send a completion request to validate expected types.
+- list, err := c.Server.Completion(ctx, &protocol.CompletionParams{
+- TextDocumentPositionParams: protocol.TextDocumentPositionParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: uri,
+- },
+- Position: protocol.Position{
+- Line: 0,
+- Character: 28,
+- },
+- },
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- for _, item := range list.Items {
+- // All other completion items should have nil commands.
+- // An empty command will be treated as a command with the name '' by VS Code.
+- // This causes VS Code to report errors to users about invalid commands.
+- if item.Command != nil {
+- t.Errorf("unexpected command for completion item")
+- }
+- // The item's TextEdit must be a pointer, as VS Code considers TextEdits
+- // that don't contain the cursor position to be invalid.
+- var textEdit interface{} = item.TextEdit
+- if _, ok := textEdit.(*protocol.TextEdit); !ok {
+- t.Errorf("textEdit is not a *protocol.TextEdit, instead it is %T", textEdit)
+- }
+- }
+- if err := c.Server.Shutdown(ctx); err != nil {
+- t.Fatal(err)
+- }
+- if err := c.Server.Exit(ctx); err != nil {
+- t.Fatal(err)
+- }
+-}
+-
+-func validateCapabilities(result *protocol.InitializeResult) error {
+- // If the client sends "false" for RenameProvider.PrepareSupport,
+- // the server must respond with a boolean.
+- if v, ok := result.Capabilities.RenameProvider.(bool); !ok {
+- return fmt.Errorf("RenameProvider must be a boolean if PrepareSupport is false (got %T)", v)
+- }
+- // The same goes for CodeActionKind.ValueSet.
+- if v, ok := result.Capabilities.CodeActionProvider.(bool); !ok {
+- return fmt.Errorf("CodeActionSupport must be a boolean if CodeActionKind.ValueSet has length 0 (got %T)", v)
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/check.go b/gopls/internal/lsp/cmd/check.go
+--- a/gopls/internal/lsp/cmd/check.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/check.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,73 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+-
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-// check implements the check verb for gopls.
+-type check struct {
+- app *Application
+-}
+-
+-func (c *check) Name() string { return "check" }
+-func (c *check) Parent() string { return c.app.Name() }
+-func (c *check) Usage() string { return "<filename>" }
+-func (c *check) ShortHelp() string { return "show diagnostic results for the specified file" }
+-func (c *check) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), `
+-Example: show the diagnostic results of this file:
+-
+- $ gopls check internal/lsp/cmd/check.go
+-`)
+- printFlagDefaults(f)
+-}
+-
+-// Run performs the check on the files specified by args and prints the
+-// results to stdout.
+-func (c *check) Run(ctx context.Context, args ...string) error {
+- if len(args) == 0 {
+- // no files, so no results
+- return nil
+- }
+- checking := map[span.URI]*cmdFile{}
+- var uris []span.URI
+- // now we ready to kick things off
+- conn, err := c.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+- for _, arg := range args {
+- uri := span.URIFromPath(arg)
+- uris = append(uris, uri)
+- file := conn.openFile(ctx, uri)
+- if file.err != nil {
+- return file.err
+- }
+- checking[uri] = file
+- }
+- if err := conn.diagnoseFiles(ctx, uris); err != nil {
+- return err
+- }
+- conn.Client.filesMu.Lock()
+- defer conn.Client.filesMu.Unlock()
+-
+- for _, file := range checking {
+- for _, d := range file.diagnostics {
+- spn, err := file.mapper.RangeSpan(d.Range)
+- if err != nil {
+- return fmt.Errorf("Could not convert position %v for %q", d.Range, d.Message)
+- }
+- fmt.Printf("%v: %v\n", spn, d.Message)
+- }
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/cmd.go b/gopls/internal/lsp/cmd/cmd.go
+--- a/gopls/internal/lsp/cmd/cmd.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/cmd.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,640 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package cmd handles the gopls command line.
+-// It contains a handler for each of the modes, along with all the flag handling
+-// and the command line output format.
+-package cmd
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+- "io/ioutil"
+- "log"
+- "os"
+- "reflect"
+- "sort"
+- "strings"
+- "sync"
+- "text/tabwriter"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/lsp"
+- "golang.org/x/tools/gopls/internal/lsp/cache"
+- "golang.org/x/tools/gopls/internal/lsp/debug"
+- "golang.org/x/tools/gopls/internal/lsp/lsprpc"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/jsonrpc2"
+- "golang.org/x/tools/internal/tool"
+- "golang.org/x/tools/internal/xcontext"
+-)
+-
+-// Application is the main application as passed to tool.Main
+-// It handles the main command line parsing and dispatch to the sub commands.
+-type Application struct {
+- // Core application flags
+-
+- // Embed the basic profiling flags supported by the tool package
+- tool.Profile
+-
+- // We include the server configuration directly for now, so the flags work
+- // even without the verb.
+- // TODO: Remove this when we stop allowing the serve verb by default.
+- Serve Serve
+-
+- // the options configuring function to invoke when building a server
+- options func(*source.Options)
+-
+- // The name of the binary, used in help and telemetry.
+- name string
+-
+- // The working directory to run commands in.
+- wd string
+-
+- // The environment variables to use.
+- env []string
+-
+- // Support for remote LSP server.
+- Remote string `flag:"remote" help:"forward all commands to a remote lsp specified by this flag. With no special prefix, this is assumed to be a TCP address. If prefixed by 'unix;', the subsequent address is assumed to be a unix domain socket. If 'auto', or prefixed by 'auto;', the remote address is automatically resolved based on the executing environment."`
+-
+- // Verbose enables verbose logging.
+- Verbose bool `flag:"v,verbose" help:"verbose output"`
+-
+- // VeryVerbose enables a higher level of verbosity in logging output.
+- VeryVerbose bool `flag:"vv,veryverbose" help:"very verbose output"`
+-
+- // Control ocagent export of telemetry
+- OCAgent string `flag:"ocagent" help:"the address of the ocagent (e.g. http://localhost:55678), or off"`
+-
+- // PrepareOptions is called to update the options when a new view is built.
+- // It is primarily to allow the behavior of gopls to be modified by hooks.
+- PrepareOptions func(*source.Options)
+-}
+-
+-func (app *Application) verbose() bool {
+- return app.Verbose || app.VeryVerbose
+-}
+-
+-// New returns a new Application ready to run.
+-func New(name, wd string, env []string, options func(*source.Options)) *Application {
+- if wd == "" {
+- wd, _ = os.Getwd()
+- }
+- app := &Application{
+- options: options,
+- name: name,
+- wd: wd,
+- env: env,
+- OCAgent: "off", //TODO: Remove this line to default the exporter to on
+-
+- Serve: Serve{
+- RemoteListenTimeout: 1 * time.Minute,
+- },
+- }
+- app.Serve.app = app
+- return app
+-}
+-
+-// Name implements tool.Application returning the binary name.
+-func (app *Application) Name() string { return app.name }
+-
+-// Usage implements tool.Application returning empty extra argument usage.
+-func (app *Application) Usage() string { return "" }
+-
+-// ShortHelp implements tool.Application returning the main binary help.
+-func (app *Application) ShortHelp() string {
+- return ""
+-}
+-
+-// DetailedHelp implements tool.Application returning the main binary help.
+-// This includes the short help for all the sub commands.
+-func (app *Application) DetailedHelp(f *flag.FlagSet) {
+- w := tabwriter.NewWriter(f.Output(), 0, 0, 2, ' ', 0)
+- defer w.Flush()
+-
+- fmt.Fprint(w, `
+-gopls is a Go language server.
+-
+-It is typically used with an editor to provide language features. When no
+-command is specified, gopls will default to the 'serve' command. The language
+-features can also be accessed via the gopls command-line interface.
+-
+-Usage:
+- gopls help [<subject>]
+-
+-Command:
+-`)
+- fmt.Fprint(w, "\nMain\t\n")
+- for _, c := range app.mainCommands() {
+- fmt.Fprintf(w, " %s\t%s\n", c.Name(), c.ShortHelp())
+- }
+- fmt.Fprint(w, "\t\nFeatures\t\n")
+- for _, c := range app.featureCommands() {
+- fmt.Fprintf(w, " %s\t%s\n", c.Name(), c.ShortHelp())
+- }
+- fmt.Fprint(w, "\nflags:\n")
+- printFlagDefaults(f)
+-}
+-
+-// this is a slightly modified version of flag.PrintDefaults to give us control
+-func printFlagDefaults(s *flag.FlagSet) {
+- var flags [][]*flag.Flag
+- seen := map[flag.Value]int{}
+- s.VisitAll(func(f *flag.Flag) {
+- if i, ok := seen[f.Value]; !ok {
+- seen[f.Value] = len(flags)
+- flags = append(flags, []*flag.Flag{f})
+- } else {
+- flags[i] = append(flags[i], f)
+- }
+- })
+- for _, entry := range flags {
+- sort.SliceStable(entry, func(i, j int) bool {
+- return len(entry[i].Name) < len(entry[j].Name)
+- })
+- var b strings.Builder
+- for i, f := range entry {
+- switch i {
+- case 0:
+- b.WriteString(" -")
+- default:
+- b.WriteString(",-")
+- }
+- b.WriteString(f.Name)
+- }
+-
+- f := entry[0]
+- name, usage := flag.UnquoteUsage(f)
+- if len(name) > 0 {
+- b.WriteString("=")
+- b.WriteString(name)
+- }
+- // Boolean flags of one ASCII letter are so common we
+- // treat them specially, putting their usage on the same line.
+- if b.Len() <= 4 { // space, space, '-', 'x'.
+- b.WriteString("\t")
+- } else {
+- // Four spaces before the tab triggers good alignment
+- // for both 4- and 8-space tab stops.
+- b.WriteString("\n \t")
+- }
+- b.WriteString(strings.ReplaceAll(usage, "\n", "\n \t"))
+- if !isZeroValue(f, f.DefValue) {
+- if reflect.TypeOf(f.Value).Elem().Name() == "stringValue" {
+- fmt.Fprintf(&b, " (default %q)", f.DefValue)
+- } else {
+- fmt.Fprintf(&b, " (default %v)", f.DefValue)
+- }
+- }
+- fmt.Fprint(s.Output(), b.String(), "\n")
+- }
+-}
+-
+-// isZeroValue is copied from the flags package
+-func isZeroValue(f *flag.Flag, value string) bool {
+- // Build a zero value of the flag's Value type, and see if the
+- // result of calling its String method equals the value passed in.
+- // This works unless the Value type is itself an interface type.
+- typ := reflect.TypeOf(f.Value)
+- var z reflect.Value
+- if typ.Kind() == reflect.Ptr {
+- z = reflect.New(typ.Elem())
+- } else {
+- z = reflect.Zero(typ)
+- }
+- return value == z.Interface().(flag.Value).String()
+-}
+-
+-// Run takes the args after top level flag processing, and invokes the correct
+-// sub command as specified by the first argument.
+-// If no arguments are passed it will invoke the server sub command, as a
+-// temporary measure for compatibility.
+-func (app *Application) Run(ctx context.Context, args ...string) error {
+- ctx = debug.WithInstance(ctx, app.wd, app.OCAgent)
+- if len(args) == 0 {
+- s := flag.NewFlagSet(app.Name(), flag.ExitOnError)
+- return tool.Run(ctx, s, &app.Serve, args)
+- }
+- command, args := args[0], args[1:]
+- for _, c := range app.Commands() {
+- if c.Name() == command {
+- s := flag.NewFlagSet(app.Name(), flag.ExitOnError)
+- return tool.Run(ctx, s, c, args)
+- }
+- }
+- return tool.CommandLineErrorf("Unknown command %v", command)
+-}
+-
+-// Commands returns the set of commands supported by the gopls tool on the
+-// command line.
+-// The command is specified by the first non flag argument.
+-func (app *Application) Commands() []tool.Application {
+- var commands []tool.Application
+- commands = append(commands, app.mainCommands()...)
+- commands = append(commands, app.featureCommands()...)
+- return commands
+-}
+-
+-func (app *Application) mainCommands() []tool.Application {
+- return []tool.Application{
+- &app.Serve,
+- &version{app: app},
+- &bug{app: app},
+- &help{app: app},
+- &apiJSON{app: app},
+- &licenses{app: app},
+- }
+-}
+-
+-func (app *Application) featureCommands() []tool.Application {
+- return []tool.Application{
+- &callHierarchy{app: app},
+- &check{app: app},
+- &definition{app: app},
+- &foldingRanges{app: app},
+- &format{app: app},
+- &highlight{app: app},
+- &implementation{app: app},
+- &imports{app: app},
+- newRemote(app, ""),
+- newRemote(app, "inspect"),
+- &links{app: app},
+- &prepareRename{app: app},
+- &references{app: app},
+- &rename{app: app},
+- &semtok{app: app},
+- &signature{app: app},
+- &suggestedFix{app: app},
+- &symbols{app: app},
+- &workspaceSymbol{app: app},
+- &vulncheck{app: app},
+- }
+-}
+-
+-var (
+- internalMu sync.Mutex
+- internalConnections = make(map[string]*connection)
+-)
+-
+-func (app *Application) connect(ctx context.Context) (*connection, error) {
+- switch {
+- case app.Remote == "":
+- connection := newConnection(app)
+- connection.Server = lsp.NewServer(cache.NewSession(ctx, cache.New(nil), app.options), connection.Client)
+- ctx = protocol.WithClient(ctx, connection.Client)
+- return connection, connection.initialize(ctx, app.options)
+- case strings.HasPrefix(app.Remote, "internal@"):
+- internalMu.Lock()
+- defer internalMu.Unlock()
+- opts := source.DefaultOptions().Clone()
+- if app.options != nil {
+- app.options(opts)
+- }
+- key := fmt.Sprintf("%s %v %v %v", app.wd, opts.PreferredContentFormat, opts.HierarchicalDocumentSymbolSupport, opts.SymbolMatcher)
+- if c := internalConnections[key]; c != nil {
+- return c, nil
+- }
+- remote := app.Remote[len("internal@"):]
+- ctx := xcontext.Detach(ctx) //TODO:a way of shutting down the internal server
+- connection, err := app.connectRemote(ctx, remote)
+- if err != nil {
+- return nil, err
+- }
+- internalConnections[key] = connection
+- return connection, nil
+- default:
+- return app.connectRemote(ctx, app.Remote)
+- }
+-}
+-
+-// CloseTestConnections terminates shared connections used in command tests. It
+-// should only be called from tests.
+-func CloseTestConnections(ctx context.Context) {
+- for _, c := range internalConnections {
+- c.Shutdown(ctx)
+- c.Exit(ctx)
+- }
+-}
+-
+-func (app *Application) connectRemote(ctx context.Context, remote string) (*connection, error) {
+- connection := newConnection(app)
+- conn, err := lsprpc.ConnectToRemote(ctx, remote)
+- if err != nil {
+- return nil, err
+- }
+- stream := jsonrpc2.NewHeaderStream(conn)
+- cc := jsonrpc2.NewConn(stream)
+- connection.Server = protocol.ServerDispatcher(cc)
+- ctx = protocol.WithClient(ctx, connection.Client)
+- cc.Go(ctx,
+- protocol.Handlers(
+- protocol.ClientHandler(connection.Client,
+- jsonrpc2.MethodNotFound)))
+- return connection, connection.initialize(ctx, app.options)
+-}
+-
+-var matcherString = map[source.SymbolMatcher]string{
+- source.SymbolFuzzy: "fuzzy",
+- source.SymbolCaseSensitive: "caseSensitive",
+- source.SymbolCaseInsensitive: "caseInsensitive",
+-}
+-
+-func (c *connection) initialize(ctx context.Context, options func(*source.Options)) error {
+- params := &protocol.ParamInitialize{}
+- params.RootURI = protocol.URIFromPath(c.Client.app.wd)
+- params.Capabilities.Workspace.Configuration = true
+-
+- // Make sure to respect configured options when sending initialize request.
+- opts := source.DefaultOptions().Clone()
+- if options != nil {
+- options(opts)
+- }
+- // If you add an additional option here, you must update the map key in connect.
+- params.Capabilities.TextDocument.Hover = &protocol.HoverClientCapabilities{
+- ContentFormat: []protocol.MarkupKind{opts.PreferredContentFormat},
+- }
+- params.Capabilities.TextDocument.DocumentSymbol.HierarchicalDocumentSymbolSupport = opts.HierarchicalDocumentSymbolSupport
+- params.Capabilities.TextDocument.SemanticTokens = protocol.SemanticTokensClientCapabilities{}
+- params.Capabilities.TextDocument.SemanticTokens.Formats = []protocol.TokenFormat{"relative"}
+- params.Capabilities.TextDocument.SemanticTokens.Requests.Range.Value = true
+- params.Capabilities.TextDocument.SemanticTokens.Requests.Full.Value = true
+- params.Capabilities.TextDocument.SemanticTokens.TokenTypes = lsp.SemanticTypes()
+- params.Capabilities.TextDocument.SemanticTokens.TokenModifiers = lsp.SemanticModifiers()
+- params.InitializationOptions = map[string]interface{}{
+- "symbolMatcher": matcherString[opts.SymbolMatcher],
+- }
+- if _, err := c.Server.Initialize(ctx, params); err != nil {
+- return err
+- }
+- if err := c.Server.Initialized(ctx, &protocol.InitializedParams{}); err != nil {
+- return err
+- }
+- return nil
+-}
+-
+-type connection struct {
+- protocol.Server
+- Client *cmdClient
+-}
+-
+-type cmdClient struct {
+- protocol.Server
+- app *Application
+-
+- diagnosticsMu sync.Mutex
+- diagnosticsDone chan struct{}
+-
+- filesMu sync.Mutex
+- files map[span.URI]*cmdFile
+-}
+-
+-type cmdFile struct {
+- uri span.URI
+- mapper *protocol.Mapper
+- err error
+- open bool
+- diagnostics []protocol.Diagnostic
+-}
+-
+-func newConnection(app *Application) *connection {
+- return &connection{
+- Client: &cmdClient{
+- app: app,
+- files: make(map[span.URI]*cmdFile),
+- },
+- }
+-}
+-
+-// fileURI converts a DocumentURI to a file:// span.URI, panicking if it's not a file.
+-func fileURI(uri protocol.DocumentURI) span.URI {
+- sURI := uri.SpanURI()
+- if !sURI.IsFile() {
+- panic(fmt.Sprintf("%q is not a file URI", uri))
+- }
+- return sURI
+-}
+-
+-func (c *cmdClient) CodeLensRefresh(context.Context) error { return nil }
+-
+-func (c *cmdClient) LogTrace(context.Context, *protocol.LogTraceParams) error { return nil }
+-
+-func (c *cmdClient) ShowMessage(ctx context.Context, p *protocol.ShowMessageParams) error { return nil }
+-
+-func (c *cmdClient) ShowMessageRequest(ctx context.Context, p *protocol.ShowMessageRequestParams) (*protocol.MessageActionItem, error) {
+- return nil, nil
+-}
+-
+-func (c *cmdClient) LogMessage(ctx context.Context, p *protocol.LogMessageParams) error {
+- switch p.Type {
+- case protocol.Error:
+- log.Print("Error:", p.Message)
+- case protocol.Warning:
+- log.Print("Warning:", p.Message)
+- case protocol.Info:
+- if c.app.verbose() {
+- log.Print("Info:", p.Message)
+- }
+- case protocol.Log:
+- if c.app.verbose() {
+- log.Print("Log:", p.Message)
+- }
+- default:
+- if c.app.verbose() {
+- log.Print(p.Message)
+- }
+- }
+- return nil
+-}
+-
+-func (c *cmdClient) Event(ctx context.Context, t *interface{}) error { return nil }
+-
+-func (c *cmdClient) RegisterCapability(ctx context.Context, p *protocol.RegistrationParams) error {
+- return nil
+-}
+-
+-func (c *cmdClient) UnregisterCapability(ctx context.Context, p *protocol.UnregistrationParams) error {
+- return nil
+-}
+-
+-func (c *cmdClient) WorkspaceFolders(ctx context.Context) ([]protocol.WorkspaceFolder, error) {
+- return nil, nil
+-}
+-
+-func (c *cmdClient) Configuration(ctx context.Context, p *protocol.ParamConfiguration) ([]interface{}, error) {
+- results := make([]interface{}, len(p.Items))
+- for i, item := range p.Items {
+- if item.Section != "gopls" {
+- continue
+- }
+- env := map[string]interface{}{}
+- for _, value := range c.app.env {
+- l := strings.SplitN(value, "=", 2)
+- if len(l) != 2 {
+- continue
+- }
+- env[l[0]] = l[1]
+- }
+- m := map[string]interface{}{
+- "env": env,
+- "analyses": map[string]bool{
+- "fillreturns": true,
+- "nonewvars": true,
+- "noresultvalues": true,
+- "undeclaredname": true,
+- },
+- }
+- if c.app.VeryVerbose {
+- m["verboseOutput"] = true
+- }
+- results[i] = m
+- }
+- return results, nil
+-}
+-
+-func (c *cmdClient) ApplyEdit(ctx context.Context, p *protocol.ApplyWorkspaceEditParams) (*protocol.ApplyWorkspaceEditResult, error) {
+- return &protocol.ApplyWorkspaceEditResult{Applied: false, FailureReason: "not implemented"}, nil
+-}
+-
+-func (c *cmdClient) PublishDiagnostics(ctx context.Context, p *protocol.PublishDiagnosticsParams) error {
+- if p.URI == "gopls://diagnostics-done" {
+- close(c.diagnosticsDone)
+- }
+- // Don't worry about diagnostics without versions.
+- if p.Version == 0 {
+- return nil
+- }
+-
+- c.filesMu.Lock()
+- defer c.filesMu.Unlock()
+-
+- file := c.getFile(ctx, fileURI(p.URI))
+- file.diagnostics = p.Diagnostics
+- return nil
+-}
+-
+-func (c *cmdClient) Progress(context.Context, *protocol.ProgressParams) error {
+- return nil
+-}
+-
+-func (c *cmdClient) ShowDocument(context.Context, *protocol.ShowDocumentParams) (*protocol.ShowDocumentResult, error) {
+- return nil, nil
+-}
+-
+-func (c *cmdClient) WorkDoneProgressCreate(context.Context, *protocol.WorkDoneProgressCreateParams) error {
+- return nil
+-}
+-
+-func (c *cmdClient) DiagnosticRefresh(context.Context) error {
+- return nil
+-}
+-
+-func (c *cmdClient) InlayHintRefresh(context.Context) error {
+- return nil
+-}
+-
+-func (c *cmdClient) SemanticTokensRefresh(context.Context) error {
+- return nil
+-}
+-
+-func (c *cmdClient) InlineValueRefresh(context.Context) error {
+- return nil
+-}
+-
+-func (c *cmdClient) getFile(ctx context.Context, uri span.URI) *cmdFile {
+- file, found := c.files[uri]
+- if !found || file.err != nil {
+- file = &cmdFile{
+- uri: uri,
+- }
+- c.files[uri] = file
+- }
+- if file.mapper == nil {
+- content, err := ioutil.ReadFile(uri.Filename())
+- if err != nil {
+- file.err = fmt.Errorf("getFile: %v: %v", uri, err)
+- return file
+- }
+- file.mapper = protocol.NewMapper(uri, content)
+- }
+- return file
+-}
+-
+-func (c *cmdClient) openFile(ctx context.Context, uri span.URI) *cmdFile {
+- c.filesMu.Lock()
+- defer c.filesMu.Unlock()
+-
+- file := c.getFile(ctx, uri)
+- if file.err != nil || file.open {
+- return file
+- }
+- file.open = true
+- return file
+-}
+-
+-func (c *connection) openFile(ctx context.Context, uri span.URI) *cmdFile {
+- file := c.Client.openFile(ctx, uri)
+- if file.err != nil {
+- return file
+- }
+-
+- p := &protocol.DidOpenTextDocumentParams{
+- TextDocument: protocol.TextDocumentItem{
+- URI: protocol.URIFromSpanURI(uri),
+- LanguageID: "go",
+- Version: 1,
+- Text: string(file.mapper.Content),
+- },
+- }
+- if err := c.Server.DidOpen(ctx, p); err != nil {
+- file.err = fmt.Errorf("%v: %v", uri, err)
+- }
+- return file
+-}
+-
+-func (c *connection) semanticTokens(ctx context.Context, p *protocol.SemanticTokensRangeParams) (*protocol.SemanticTokens, error) {
+- // use range to avoid limits on full
+- resp, err := c.Server.SemanticTokensRange(ctx, p)
+- if err != nil {
+- return nil, err
+- }
+- return resp, nil
+-}
+-
+-func (c *connection) diagnoseFiles(ctx context.Context, files []span.URI) error {
+- var untypedFiles []interface{}
+- for _, file := range files {
+- untypedFiles = append(untypedFiles, string(file))
+- }
+- c.Client.diagnosticsMu.Lock()
+- defer c.Client.diagnosticsMu.Unlock()
+-
+- c.Client.diagnosticsDone = make(chan struct{})
+- _, err := c.Server.NonstandardRequest(ctx, "gopls/diagnoseFiles", map[string]interface{}{"files": untypedFiles})
+- if err != nil {
+- close(c.Client.diagnosticsDone)
+- return err
+- }
+-
+- <-c.Client.diagnosticsDone
+- return nil
+-}
+-
+-func (c *connection) terminate(ctx context.Context) {
+- if strings.HasPrefix(c.Client.app.Remote, "internal@") {
+- // internal connections need to be left alive for the next test
+- return
+- }
+- //TODO: do we need to handle errors on these calls?
+- c.Shutdown(ctx)
+- //TODO: right now calling exit terminates the process, we should rethink that
+- //server.Exit(ctx)
+-}
+-
+-// Implement io.Closer.
+-func (c *cmdClient) Close() error {
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/definition.go b/gopls/internal/lsp/cmd/definition.go
+--- a/gopls/internal/lsp/cmd/definition.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/definition.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,132 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "encoding/json"
+- "flag"
+- "fmt"
+- "os"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// A Definition is the result of a 'definition' query.
+-type Definition struct {
+- Span span.Span `json:"span"` // span of the definition
+- Description string `json:"description"` // description of the denoted object
+-}
+-
+-// These constant is printed in the help, and then used in a test to verify the
+-// help is still valid.
+-// They refer to "Set" in "flag.FlagSet" from the DetailedHelp method below.
+-const (
+- exampleLine = 44
+- exampleColumn = 47
+- exampleOffset = 1270
+-)
+-
+-// definition implements the definition verb for gopls.
+-type definition struct {
+- app *Application
+-
+- JSON bool `flag:"json" help:"emit output in JSON format"`
+- MarkdownSupported bool `flag:"markdown" help:"support markdown in responses"`
+-}
+-
+-func (d *definition) Name() string { return "definition" }
+-func (d *definition) Parent() string { return d.app.Name() }
+-func (d *definition) Usage() string { return "[definition-flags] <position>" }
+-func (d *definition) ShortHelp() string { return "show declaration of selected identifier" }
+-func (d *definition) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprintf(f.Output(), `
+-Example: show the definition of the identifier at syntax at offset %[1]v in this file (flag.FlagSet):
+-
+- $ gopls definition internal/lsp/cmd/definition.go:%[1]v:%[2]v
+- $ gopls definition internal/lsp/cmd/definition.go:#%[3]v
+-
+-definition-flags:
+-`, exampleLine, exampleColumn, exampleOffset)
+- printFlagDefaults(f)
+-}
+-
+-// Run performs the definition query as specified by args and prints the
+-// results to stdout.
+-func (d *definition) Run(ctx context.Context, args ...string) error {
+- if len(args) != 1 {
+- return tool.CommandLineErrorf("definition expects 1 argument")
+- }
+- // Plaintext makes more sense for the command line.
+- opts := d.app.options
+- d.app.options = func(o *source.Options) {
+- if opts != nil {
+- opts(o)
+- }
+- o.PreferredContentFormat = protocol.PlainText
+- if d.MarkdownSupported {
+- o.PreferredContentFormat = protocol.Markdown
+- }
+- }
+- conn, err := d.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+- from := span.Parse(args[0])
+- file := conn.openFile(ctx, from.URI())
+- if file.err != nil {
+- return file.err
+- }
+- loc, err := file.mapper.SpanLocation(from)
+- if err != nil {
+- return err
+- }
+- p := protocol.DefinitionParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+- locs, err := conn.Definition(ctx, &p)
+- if err != nil {
+- return fmt.Errorf("%v: %v", from, err)
+- }
+-
+- if len(locs) == 0 {
+- return fmt.Errorf("%v: not an identifier", from)
+- }
+- q := protocol.HoverParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+- hover, err := conn.Hover(ctx, &q)
+- if err != nil {
+- return fmt.Errorf("%v: %v", from, err)
+- }
+- if hover == nil {
+- return fmt.Errorf("%v: not an identifier", from)
+- }
+- file = conn.openFile(ctx, fileURI(locs[0].URI))
+- if file.err != nil {
+- return fmt.Errorf("%v: %v", from, file.err)
+- }
+- definition, err := file.mapper.LocationSpan(locs[0])
+- if err != nil {
+- return fmt.Errorf("%v: %v", from, err)
+- }
+- description := strings.TrimSpace(hover.Contents.Value)
+- result := &Definition{
+- Span: definition,
+- Description: description,
+- }
+- if d.JSON {
+- enc := json.NewEncoder(os.Stdout)
+- enc.SetIndent("", "\t")
+- return enc.Encode(result)
+- }
+- fmt.Printf("%v: defined here as %s", result.Span, result.Description)
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/folding_range.go b/gopls/internal/lsp/cmd/folding_range.go
+--- a/gopls/internal/lsp/cmd/folding_range.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/folding_range.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,73 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// foldingRanges implements the folding_ranges verb for gopls
+-type foldingRanges struct {
+- app *Application
+-}
+-
+-func (r *foldingRanges) Name() string { return "folding_ranges" }
+-func (r *foldingRanges) Parent() string { return r.app.Name() }
+-func (r *foldingRanges) Usage() string { return "<file>" }
+-func (r *foldingRanges) ShortHelp() string { return "display selected file's folding ranges" }
+-func (r *foldingRanges) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), `
+-Example:
+-
+- $ gopls folding_ranges helper/helper.go
+-`)
+- printFlagDefaults(f)
+-}
+-
+-func (r *foldingRanges) Run(ctx context.Context, args ...string) error {
+- if len(args) != 1 {
+- return tool.CommandLineErrorf("folding_ranges expects 1 argument (file)")
+- }
+-
+- conn, err := r.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+-
+- from := span.Parse(args[0])
+- file := conn.openFile(ctx, from.URI())
+- if file.err != nil {
+- return file.err
+- }
+-
+- p := protocol.FoldingRangeParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(from.URI()),
+- },
+- }
+-
+- ranges, err := conn.FoldingRange(ctx, &p)
+- if err != nil {
+- return err
+- }
+-
+- for _, r := range ranges {
+- fmt.Printf("%v:%v-%v:%v\n",
+- r.StartLine+1,
+- r.StartCharacter+1,
+- r.EndLine+1,
+- r.EndCharacter+1,
+- )
+- }
+-
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/format.go b/gopls/internal/lsp/cmd/format.go
+--- a/gopls/internal/lsp/cmd/format.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/format.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,110 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+- "io/ioutil"
+- "os"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/diff"
+-)
+-
+-// format implements the format verb for gopls.
+-type format struct {
+- Diff bool `flag:"d,diff" help:"display diffs instead of rewriting files"`
+- Write bool `flag:"w,write" help:"write result to (source) file instead of stdout"`
+- List bool `flag:"l,list" help:"list files whose formatting differs from gofmt's"`
+-
+- app *Application
+-}
+-
+-func (c *format) Name() string { return "format" }
+-func (c *format) Parent() string { return c.app.Name() }
+-func (c *format) Usage() string { return "[format-flags] <filerange>" }
+-func (c *format) ShortHelp() string { return "format the code according to the go standard" }
+-func (c *format) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), `
+-The arguments supplied may be simple file names, or ranges within files.
+-
+-Example: reformat this file:
+-
+- $ gopls format -w internal/lsp/cmd/check.go
+-
+-format-flags:
+-`)
+- printFlagDefaults(f)
+-}
+-
+-// Run performs the check on the files specified by args and prints the
+-// results to stdout.
+-func (c *format) Run(ctx context.Context, args ...string) error {
+- if len(args) == 0 {
+- // no files, so no results
+- return nil
+- }
+- // now we ready to kick things off
+- conn, err := c.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+- for _, arg := range args {
+- spn := span.Parse(arg)
+- file := conn.openFile(ctx, spn.URI())
+- if file.err != nil {
+- return file.err
+- }
+- filename := spn.URI().Filename()
+- loc, err := file.mapper.SpanLocation(spn)
+- if err != nil {
+- return err
+- }
+- if loc.Range.Start != loc.Range.End {
+- return fmt.Errorf("only full file formatting supported")
+- }
+- p := protocol.DocumentFormattingParams{
+- TextDocument: protocol.TextDocumentIdentifier{URI: loc.URI},
+- }
+- edits, err := conn.Formatting(ctx, &p)
+- if err != nil {
+- return fmt.Errorf("%v: %v", spn, err)
+- }
+- formatted, sedits, err := source.ApplyProtocolEdits(file.mapper, edits)
+- if err != nil {
+- return fmt.Errorf("%v: %v", spn, err)
+- }
+- printIt := true
+- if c.List {
+- printIt = false
+- if len(edits) > 0 {
+- fmt.Println(filename)
+- }
+- }
+- if c.Write {
+- printIt = false
+- if len(edits) > 0 {
+- ioutil.WriteFile(filename, formatted, 0644)
+- }
+- }
+- if c.Diff {
+- printIt = false
+- unified, err := diff.ToUnified(filename+".orig", filename, string(file.mapper.Content), sedits)
+- if err != nil {
+- return err
+- }
+- fmt.Print(unified)
+- }
+- if printIt {
+- os.Stdout.Write(formatted)
+- }
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/help_test.go b/gopls/internal/lsp/cmd/help_test.go
+--- a/gopls/internal/lsp/cmd/help_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/help_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,58 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd_test
+-
+-import (
+- "bytes"
+- "context"
+- "flag"
+- "io/ioutil"
+- "path/filepath"
+- "testing"
+-
+- "github.com/google/go-cmp/cmp"
+- "golang.org/x/tools/gopls/internal/lsp/cmd"
+- "golang.org/x/tools/internal/testenv"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-//go:generate go test -run Help -update-help-files
+-
+-var updateHelpFiles = flag.Bool("update-help-files", false, "Write out the help files instead of checking them")
+-
+-const appName = "gopls"
+-
+-func TestHelpFiles(t *testing.T) {
+- testenv.NeedsGoBuild(t) // This is a lie. We actually need the source code.
+- app := cmd.New(appName, "", nil, nil)
+- ctx := context.Background()
+- for _, page := range append(app.Commands(), app) {
+- t.Run(page.Name(), func(t *testing.T) {
+- var buf bytes.Buffer
+- s := flag.NewFlagSet(page.Name(), flag.ContinueOnError)
+- s.SetOutput(&buf)
+- tool.Run(ctx, s, page, []string{"-h"})
+- name := page.Name()
+- if name == appName {
+- name = "usage"
+- }
+- helpFile := filepath.Join("usage", name+".hlp")
+- got := buf.Bytes()
+- if *updateHelpFiles {
+- if err := ioutil.WriteFile(helpFile, got, 0666); err != nil {
+- t.Errorf("Failed writing %v: %v", helpFile, err)
+- }
+- return
+- }
+- want, err := ioutil.ReadFile(helpFile)
+- if err != nil {
+- t.Fatalf("Missing help file %q", helpFile)
+- }
+- if diff := cmp.Diff(string(want), string(got)); diff != "" {
+- t.Errorf("Help file %q did not match, run with -update-help-files to fix (-want +got)\n%s", helpFile, diff)
+- }
+- })
+- }
+-}
+diff -urN a/gopls/internal/lsp/cmd/highlight.go b/gopls/internal/lsp/cmd/highlight.go
+--- a/gopls/internal/lsp/cmd/highlight.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/highlight.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,82 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// highlight implements the highlight verb for gopls.
+-type highlight struct {
+- app *Application
+-}
+-
+-func (r *highlight) Name() string { return "highlight" }
+-func (r *highlight) Parent() string { return r.app.Name() }
+-func (r *highlight) Usage() string { return "<position>" }
+-func (r *highlight) ShortHelp() string { return "display selected identifier's highlights" }
+-func (r *highlight) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), `
+-Example:
+-
+- $ # 1-indexed location (:line:column or :#offset) of the target identifier
+- $ gopls highlight helper/helper.go:8:6
+- $ gopls highlight helper/helper.go:#53
+-`)
+- printFlagDefaults(f)
+-}
+-
+-func (r *highlight) Run(ctx context.Context, args ...string) error {
+- if len(args) != 1 {
+- return tool.CommandLineErrorf("highlight expects 1 argument (position)")
+- }
+-
+- conn, err := r.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+-
+- from := span.Parse(args[0])
+- file := conn.openFile(ctx, from.URI())
+- if file.err != nil {
+- return file.err
+- }
+-
+- loc, err := file.mapper.SpanLocation(from)
+- if err != nil {
+- return err
+- }
+-
+- p := protocol.DocumentHighlightParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+- highlights, err := conn.DocumentHighlight(ctx, &p)
+- if err != nil {
+- return err
+- }
+-
+- var results []span.Span
+- for _, h := range highlights {
+- s, err := file.mapper.RangeSpan(h.Range)
+- if err != nil {
+- return err
+- }
+- results = append(results, s)
+- }
+- // Sort results to make tests deterministic since DocumentHighlight uses a map.
+- span.SortSpans(results)
+-
+- for _, s := range results {
+- fmt.Println(s)
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/implementation.go b/gopls/internal/lsp/cmd/implementation.go
+--- a/gopls/internal/lsp/cmd/implementation.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/implementation.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,84 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+- "sort"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// implementation implements the implementation verb for gopls
+-type implementation struct {
+- app *Application
+-}
+-
+-func (i *implementation) Name() string { return "implementation" }
+-func (i *implementation) Parent() string { return i.app.Name() }
+-func (i *implementation) Usage() string { return "<position>" }
+-func (i *implementation) ShortHelp() string { return "display selected identifier's implementation" }
+-func (i *implementation) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), `
+-Example:
+-
+- $ # 1-indexed location (:line:column or :#offset) of the target identifier
+- $ gopls implementation helper/helper.go:8:6
+- $ gopls implementation helper/helper.go:#53
+-`)
+- printFlagDefaults(f)
+-}
+-
+-func (i *implementation) Run(ctx context.Context, args ...string) error {
+- if len(args) != 1 {
+- return tool.CommandLineErrorf("implementation expects 1 argument (position)")
+- }
+-
+- conn, err := i.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+-
+- from := span.Parse(args[0])
+- file := conn.openFile(ctx, from.URI())
+- if file.err != nil {
+- return file.err
+- }
+-
+- loc, err := file.mapper.SpanLocation(from)
+- if err != nil {
+- return err
+- }
+-
+- p := protocol.ImplementationParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+- implementations, err := conn.Implementation(ctx, &p)
+- if err != nil {
+- return err
+- }
+-
+- var spans []string
+- for _, impl := range implementations {
+- f := conn.openFile(ctx, fileURI(impl.URI))
+- span, err := f.mapper.LocationSpan(impl)
+- if err != nil {
+- return err
+- }
+- spans = append(spans, fmt.Sprint(span))
+- }
+- sort.Strings(spans)
+-
+- for _, s := range spans {
+- fmt.Println(s)
+- }
+-
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/imports.go b/gopls/internal/lsp/cmd/imports.go
+--- a/gopls/internal/lsp/cmd/imports.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/imports.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,105 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+- "io/ioutil"
+- "os"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/diff"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// imports implements the import verb for gopls.
+-type imports struct {
+- Diff bool `flag:"d,diff" help:"display diffs instead of rewriting files"`
+- Write bool `flag:"w,write" help:"write result to (source) file instead of stdout"`
+-
+- app *Application
+-}
+-
+-func (t *imports) Name() string { return "imports" }
+-func (t *imports) Parent() string { return t.app.Name() }
+-func (t *imports) Usage() string { return "[imports-flags] <filename>" }
+-func (t *imports) ShortHelp() string { return "updates import statements" }
+-func (t *imports) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprintf(f.Output(), `
+-Example: update imports statements in a file:
+-
+- $ gopls imports -w internal/lsp/cmd/check.go
+-
+-imports-flags:
+-`)
+- printFlagDefaults(f)
+-}
+-
+-// Run performs diagnostic checks on the file specified and either;
+-// - if -w is specified, updates the file in place;
+-// - if -d is specified, prints out unified diffs of the changes; or
+-// - otherwise, prints the new versions to stdout.
+-func (t *imports) Run(ctx context.Context, args ...string) error {
+- if len(args) != 1 {
+- return tool.CommandLineErrorf("imports expects 1 argument")
+- }
+- conn, err := t.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+-
+- from := span.Parse(args[0])
+- uri := from.URI()
+- file := conn.openFile(ctx, uri)
+- if file.err != nil {
+- return file.err
+- }
+- actions, err := conn.CodeAction(ctx, &protocol.CodeActionParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- })
+- if err != nil {
+- return fmt.Errorf("%v: %v", from, err)
+- }
+- var edits []protocol.TextEdit
+- for _, a := range actions {
+- if a.Title != "Organize Imports" {
+- continue
+- }
+- for _, c := range a.Edit.DocumentChanges {
+- if c.TextDocumentEdit != nil {
+- if fileURI(c.TextDocumentEdit.TextDocument.URI) == uri {
+- edits = append(edits, c.TextDocumentEdit.Edits...)
+- }
+- }
+- }
+- }
+- newContent, sedits, err := source.ApplyProtocolEdits(file.mapper, edits)
+- if err != nil {
+- return fmt.Errorf("%v: %v", edits, err)
+- }
+- filename := file.uri.Filename()
+- switch {
+- case t.Write:
+- if len(edits) > 0 {
+- ioutil.WriteFile(filename, newContent, 0644)
+- }
+- case t.Diff:
+- unified, err := diff.ToUnified(filename+".orig", filename, string(file.mapper.Content), sedits)
+- if err != nil {
+- return err
+- }
+- fmt.Print(unified)
+- default:
+- os.Stdout.Write(newContent)
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/info.go b/gopls/internal/lsp/cmd/info.go
+--- a/gopls/internal/lsp/cmd/info.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/info.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,246 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "bytes"
+- "context"
+- "encoding/json"
+- "flag"
+- "fmt"
+- "net/url"
+- "os"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/browser"
+- "golang.org/x/tools/gopls/internal/lsp/debug"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// help implements the help command.
+-type help struct {
+- app *Application
+-}
+-
+-func (h *help) Name() string { return "help" }
+-func (h *help) Parent() string { return h.app.Name() }
+-func (h *help) Usage() string { return "" }
+-func (h *help) ShortHelp() string { return "print usage information for subcommands" }
+-func (h *help) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), `
+-
+-Examples:
+-$ gopls help # main gopls help message
+-$ gopls help remote # help on 'remote' command
+-$ gopls help remote sessions # help on 'remote sessions' subcommand
+-`)
+- printFlagDefaults(f)
+-}
+-
+-// Run prints help information about a subcommand.
+-func (h *help) Run(ctx context.Context, args ...string) error {
+- find := func(cmds []tool.Application, name string) tool.Application {
+- for _, cmd := range cmds {
+- if cmd.Name() == name {
+- return cmd
+- }
+- }
+- return nil
+- }
+-
+- // Find the subcommand denoted by args (empty => h.app).
+- var cmd tool.Application = h.app
+- for i, arg := range args {
+- cmd = find(getSubcommands(cmd), arg)
+- if cmd == nil {
+- return tool.CommandLineErrorf(
+- "no such subcommand: %s", strings.Join(args[:i+1], " "))
+- }
+- }
+-
+- // 'gopls help cmd subcmd' is equivalent to 'gopls cmd subcmd -h'.
+- // The flag package prints the usage information (defined by tool.Run)
+- // when it sees the -h flag.
+- fs := flag.NewFlagSet(cmd.Name(), flag.ExitOnError)
+- return tool.Run(ctx, fs, h.app, append(args[:len(args):len(args)], "-h"))
+-}
+-
+-// version implements the version command.
+-type version struct {
+- JSON bool `flag:"json" help:"outputs in json format."`
+-
+- app *Application
+-}
+-
+-func (v *version) Name() string { return "version" }
+-func (v *version) Parent() string { return v.app.Name() }
+-func (v *version) Usage() string { return "" }
+-func (v *version) ShortHelp() string { return "print the gopls version information" }
+-func (v *version) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), ``)
+- printFlagDefaults(f)
+-}
+-
+-// Run prints version information to stdout.
+-func (v *version) Run(ctx context.Context, args ...string) error {
+- var mode = debug.PlainText
+- if v.JSON {
+- mode = debug.JSON
+- }
+-
+- return debug.PrintVersionInfo(ctx, os.Stdout, v.app.verbose(), mode)
+-}
+-
+-// bug implements the bug command.
+-type bug struct {
+- app *Application
+-}
+-
+-func (b *bug) Name() string { return "bug" }
+-func (b *bug) Parent() string { return b.app.Name() }
+-func (b *bug) Usage() string { return "" }
+-func (b *bug) ShortHelp() string { return "report a bug in gopls" }
+-func (b *bug) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), ``)
+- printFlagDefaults(f)
+-}
+-
+-const goplsBugPrefix = "x/tools/gopls: <DESCRIBE THE PROBLEM>"
+-const goplsBugHeader = `ATTENTION: Please answer these questions BEFORE submitting your issue. Thanks!
+-
+-#### What did you do?
+-If possible, provide a recipe for reproducing the error.
+-A complete runnable program is good.
+-A link on play.golang.org is better.
+-A failing unit test is the best.
+-
+-#### What did you expect to see?
+-
+-
+-#### What did you see instead?
+-
+-
+-`
+-
+-// Run collects some basic information and then prepares an issue ready to
+-// be reported.
+-func (b *bug) Run(ctx context.Context, args ...string) error {
+- buf := &bytes.Buffer{}
+- fmt.Fprint(buf, goplsBugHeader)
+- debug.PrintVersionInfo(ctx, buf, true, debug.Markdown)
+- body := buf.String()
+- title := strings.Join(args, " ")
+- if !strings.HasPrefix(title, goplsBugPrefix) {
+- title = goplsBugPrefix + title
+- }
+- if !browser.Open("https://github.com/golang/go/issues/new?title=" + url.QueryEscape(title) + "&body=" + url.QueryEscape(body)) {
+- fmt.Print("Please file a new issue at golang.org/issue/new using this template:\n\n")
+- fmt.Print(body)
+- }
+- return nil
+-}
+-
+-type apiJSON struct {
+- app *Application
+-}
+-
+-func (j *apiJSON) Name() string { return "api-json" }
+-func (j *apiJSON) Parent() string { return j.app.Name() }
+-func (j *apiJSON) Usage() string { return "" }
+-func (j *apiJSON) ShortHelp() string { return "print json describing gopls API" }
+-func (j *apiJSON) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), ``)
+- printFlagDefaults(f)
+-}
+-
+-func (j *apiJSON) Run(ctx context.Context, args ...string) error {
+- js, err := json.MarshalIndent(source.GeneratedAPIJSON, "", "\t")
+- if err != nil {
+- return err
+- }
+- fmt.Fprint(os.Stdout, string(js))
+- return nil
+-}
+-
+-type licenses struct {
+- app *Application
+-}
+-
+-func (l *licenses) Name() string { return "licenses" }
+-func (l *licenses) Parent() string { return l.app.Name() }
+-func (l *licenses) Usage() string { return "" }
+-func (l *licenses) ShortHelp() string { return "print licenses of included software" }
+-func (l *licenses) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), ``)
+- printFlagDefaults(f)
+-}
+-
+-const licensePreamble = `
+-gopls is made available under the following BSD-style license:
+-
+-Copyright (c) 2009 The Go Authors. All rights reserved.
+-
+-Redistribution and use in source and binary forms, with or without
+-modification, are permitted provided that the following conditions are
+-met:
+-
+- * Redistributions of source code must retain the above copyright
+-notice, this list of conditions and the following disclaimer.
+- * Redistributions in binary form must reproduce the above
+-copyright notice, this list of conditions and the following disclaimer
+-in the documentation and/or other materials provided with the
+-distribution.
+- * Neither the name of Google Inc. nor the names of its
+-contributors may be used to endorse or promote products derived from
+-this software without specific prior written permission.
+-
+-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+-
+-gopls implements the LSP specification, which is made available under the following license:
+-
+-Copyright (c) Microsoft Corporation
+-
+-All rights reserved.
+-
+-MIT License
+-
+-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation
+-files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy,
+-modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software
+-is furnished to do so, subject to the following conditions:
+-
+-The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+-
+-THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
+-BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT
+-OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+-
+-gopls also includes software made available under these licenses:
+-`
+-
+-func (l *licenses) Run(ctx context.Context, args ...string) error {
+- opts := source.DefaultOptions()
+- l.app.options(opts)
+- txt := licensePreamble
+- if opts.LicensesText == "" {
+- txt += "(development gopls, license information not available)"
+- } else {
+- txt += opts.LicensesText
+- }
+- fmt.Fprint(os.Stdout, txt)
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/links.go b/gopls/internal/lsp/cmd/links.go
+--- a/gopls/internal/lsp/cmd/links.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/links.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,77 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "encoding/json"
+- "flag"
+- "fmt"
+- "os"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// links implements the links verb for gopls.
+-type links struct {
+- JSON bool `flag:"json" help:"emit document links in JSON format"`
+-
+- app *Application
+-}
+-
+-func (l *links) Name() string { return "links" }
+-func (l *links) Parent() string { return l.app.Name() }
+-func (l *links) Usage() string { return "[links-flags] <filename>" }
+-func (l *links) ShortHelp() string { return "list links in a file" }
+-func (l *links) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprintf(f.Output(), `
+-Example: list links contained within a file:
+-
+- $ gopls links internal/lsp/cmd/check.go
+-
+-links-flags:
+-`)
+- printFlagDefaults(f)
+-}
+-
+-// Run finds all the links within a document
+-// - if -json is specified, outputs location range and uri
+-// - otherwise, prints the a list of unique links
+-func (l *links) Run(ctx context.Context, args ...string) error {
+- if len(args) != 1 {
+- return tool.CommandLineErrorf("links expects 1 argument")
+- }
+- conn, err := l.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+-
+- from := span.Parse(args[0])
+- uri := from.URI()
+- file := conn.openFile(ctx, uri)
+- if file.err != nil {
+- return file.err
+- }
+- results, err := conn.DocumentLink(ctx, &protocol.DocumentLinkParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- })
+- if err != nil {
+- return fmt.Errorf("%v: %v", from, err)
+- }
+- if l.JSON {
+- enc := json.NewEncoder(os.Stdout)
+- enc.SetIndent("", "\t")
+- return enc.Encode(results)
+- }
+- for _, v := range results {
+- fmt.Println(v.Target)
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/prepare_rename.go b/gopls/internal/lsp/cmd/prepare_rename.go
+--- a/gopls/internal/lsp/cmd/prepare_rename.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/prepare_rename.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,80 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "errors"
+- "flag"
+- "fmt"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// prepareRename implements the prepare_rename verb for gopls.
+-type prepareRename struct {
+- app *Application
+-}
+-
+-func (r *prepareRename) Name() string { return "prepare_rename" }
+-func (r *prepareRename) Parent() string { return r.app.Name() }
+-func (r *prepareRename) Usage() string { return "<position>" }
+-func (r *prepareRename) ShortHelp() string { return "test validity of a rename operation at location" }
+-func (r *prepareRename) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), `
+-Example:
+-
+- $ # 1-indexed location (:line:column or :#offset) of the target identifier
+- $ gopls prepare_rename helper/helper.go:8:6
+- $ gopls prepare_rename helper/helper.go:#53
+-`)
+- printFlagDefaults(f)
+-}
+-
+-// ErrInvalidRenamePosition is returned when prepareRename is run at a position that
+-// is not a candidate for renaming.
+-var ErrInvalidRenamePosition = errors.New("request is not valid at the given position")
+-
+-func (r *prepareRename) Run(ctx context.Context, args ...string) error {
+- if len(args) != 1 {
+- return tool.CommandLineErrorf("prepare_rename expects 1 argument (file)")
+- }
+-
+- conn, err := r.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+-
+- from := span.Parse(args[0])
+- file := conn.openFile(ctx, from.URI())
+- if file.err != nil {
+- return file.err
+- }
+- loc, err := file.mapper.SpanLocation(from)
+- if err != nil {
+- return err
+- }
+- p := protocol.PrepareRenameParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+- result, err := conn.PrepareRename(ctx, &p)
+- if err != nil {
+- return fmt.Errorf("prepare_rename failed: %w", err)
+- }
+- if result == nil {
+- return ErrInvalidRenamePosition
+- }
+-
+- s, err := file.mapper.RangeSpan(result.Range)
+- if err != nil {
+- return err
+- }
+-
+- fmt.Println(s)
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/references.go b/gopls/internal/lsp/cmd/references.go
+--- a/gopls/internal/lsp/cmd/references.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/references.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,89 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+- "sort"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// references implements the references verb for gopls
+-type references struct {
+- IncludeDeclaration bool `flag:"d,declaration" help:"include the declaration of the specified identifier in the results"`
+-
+- app *Application
+-}
+-
+-func (r *references) Name() string { return "references" }
+-func (r *references) Parent() string { return r.app.Name() }
+-func (r *references) Usage() string { return "[references-flags] <position>" }
+-func (r *references) ShortHelp() string { return "display selected identifier's references" }
+-func (r *references) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), `
+-Example:
+-
+- $ # 1-indexed location (:line:column or :#offset) of the target identifier
+- $ gopls references helper/helper.go:8:6
+- $ gopls references helper/helper.go:#53
+-
+-references-flags:
+-`)
+- printFlagDefaults(f)
+-}
+-
+-func (r *references) Run(ctx context.Context, args ...string) error {
+- if len(args) != 1 {
+- return tool.CommandLineErrorf("references expects 1 argument (position)")
+- }
+-
+- conn, err := r.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+-
+- from := span.Parse(args[0])
+- file := conn.openFile(ctx, from.URI())
+- if file.err != nil {
+- return file.err
+- }
+- loc, err := file.mapper.SpanLocation(from)
+- if err != nil {
+- return err
+- }
+- p := protocol.ReferenceParams{
+- Context: protocol.ReferenceContext{
+- IncludeDeclaration: r.IncludeDeclaration,
+- },
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+- locations, err := conn.References(ctx, &p)
+- if err != nil {
+- return err
+- }
+- var spans []string
+- for _, l := range locations {
+- f := conn.openFile(ctx, fileURI(l.URI))
+- // convert location to span for user-friendly 1-indexed line
+- // and column numbers
+- span, err := f.mapper.LocationSpan(l)
+- if err != nil {
+- return err
+- }
+- spans = append(spans, fmt.Sprint(span))
+- }
+-
+- sort.Strings(spans)
+- for _, s := range spans {
+- fmt.Println(s)
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/remote.go b/gopls/internal/lsp/cmd/remote.go
+--- a/gopls/internal/lsp/cmd/remote.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/remote.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,164 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "encoding/json"
+- "errors"
+- "flag"
+- "fmt"
+- "log"
+- "os"
+-
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/lsprpc"
+-)
+-
+-type remote struct {
+- app *Application
+- subcommands
+-
+- // For backward compatibility, allow aliasing this command (it was previously
+- // called 'inspect').
+- //
+- // TODO(rFindley): delete this after allowing some transition time in case
+- // there were any users of 'inspect' (I suspect not).
+- alias string
+-}
+-
+-func newRemote(app *Application, alias string) *remote {
+- return &remote{
+- app: app,
+- subcommands: subcommands{
+- &listSessions{app: app},
+- &startDebugging{app: app},
+- },
+- alias: alias,
+- }
+-}
+-
+-func (r *remote) Name() string {
+- if r.alias != "" {
+- return r.alias
+- }
+- return "remote"
+-}
+-
+-func (r *remote) Parent() string { return r.app.Name() }
+-
+-func (r *remote) ShortHelp() string {
+- short := "interact with the gopls daemon"
+- if r.alias != "" {
+- short += " (deprecated: use 'remote')"
+- }
+- return short
+-}
+-
+-// listSessions is an inspect subcommand to list current sessions.
+-type listSessions struct {
+- app *Application
+-}
+-
+-func (c *listSessions) Name() string { return "sessions" }
+-func (c *listSessions) Parent() string { return c.app.Name() }
+-func (c *listSessions) Usage() string { return "" }
+-func (c *listSessions) ShortHelp() string {
+- return "print information about current gopls sessions"
+-}
+-
+-const listSessionsExamples = `
+-Examples:
+-
+-1) list sessions for the default daemon:
+-
+-$ gopls -remote=auto remote sessions
+-or just
+-$ gopls remote sessions
+-
+-2) list sessions for a specific daemon:
+-
+-$ gopls -remote=localhost:8082 remote sessions
+-`
+-
+-func (c *listSessions) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), listSessionsExamples)
+- printFlagDefaults(f)
+-}
+-
+-func (c *listSessions) Run(ctx context.Context, args ...string) error {
+- remote := c.app.Remote
+- if remote == "" {
+- remote = "auto"
+- }
+- state, err := lsprpc.QueryServerState(ctx, remote)
+- if err != nil {
+- return err
+- }
+- v, err := json.MarshalIndent(state, "", "\t")
+- if err != nil {
+- log.Fatal(err)
+- }
+- os.Stdout.Write(v)
+- return nil
+-}
+-
+-type startDebugging struct {
+- app *Application
+-}
+-
+-func (c *startDebugging) Name() string { return "debug" }
+-func (c *startDebugging) Usage() string { return "[host:port]" }
+-func (c *startDebugging) ShortHelp() string {
+- return "start the debug server"
+-}
+-
+-const startDebuggingExamples = `
+-Examples:
+-
+-1) start a debug server for the default daemon, on an arbitrary port:
+-
+-$ gopls -remote=auto remote debug
+-or just
+-$ gopls remote debug
+-
+-2) start for a specific daemon, on a specific port:
+-
+-$ gopls -remote=localhost:8082 remote debug localhost:8083
+-`
+-
+-func (c *startDebugging) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), startDebuggingExamples)
+- printFlagDefaults(f)
+-}
+-
+-func (c *startDebugging) Run(ctx context.Context, args ...string) error {
+- if len(args) > 1 {
+- fmt.Fprintln(os.Stderr, c.Usage())
+- return errors.New("invalid usage")
+- }
+- remote := c.app.Remote
+- if remote == "" {
+- remote = "auto"
+- }
+- debugAddr := ""
+- if len(args) > 0 {
+- debugAddr = args[0]
+- }
+- debugArgs := command.DebuggingArgs{
+- Addr: debugAddr,
+- }
+- var result command.DebuggingResult
+- if err := lsprpc.ExecuteCommand(ctx, remote, command.StartDebugging.ID(), debugArgs, &result); err != nil {
+- return err
+- }
+- if len(result.URLs) == 0 {
+- return errors.New("no debugging URLs")
+- }
+- for _, url := range result.URLs {
+- fmt.Printf("debugging on %s\n", url)
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/rename.go b/gopls/internal/lsp/cmd/rename.go
+--- a/gopls/internal/lsp/cmd/rename.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/rename.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,130 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+- "io/ioutil"
+- "os"
+- "path/filepath"
+- "sort"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/diff"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// rename implements the rename verb for gopls.
+-type rename struct {
+- Diff bool `flag:"d,diff" help:"display diffs instead of rewriting files"`
+- Write bool `flag:"w,write" help:"write result to (source) file instead of stdout"`
+- Preserve bool `flag:"preserve" help:"preserve original files"`
+-
+- app *Application
+-}
+-
+-func (r *rename) Name() string { return "rename" }
+-func (r *rename) Parent() string { return r.app.Name() }
+-func (r *rename) Usage() string { return "[rename-flags] <position> <name>" }
+-func (r *rename) ShortHelp() string { return "rename selected identifier" }
+-func (r *rename) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), `
+-Example:
+-
+- $ # 1-based location (:line:column or :#position) of the thing to change
+- $ gopls rename helper/helper.go:8:6 Foo
+- $ gopls rename helper/helper.go:#53 Foo
+-
+-rename-flags:
+-`)
+- printFlagDefaults(f)
+-}
+-
+-// Run renames the specified identifier and either;
+-// - if -w is specified, updates the file(s) in place;
+-// - if -d is specified, prints out unified diffs of the changes; or
+-// - otherwise, prints the new versions to stdout.
+-func (r *rename) Run(ctx context.Context, args ...string) error {
+- if len(args) != 2 {
+- return tool.CommandLineErrorf("definition expects 2 arguments (position, new name)")
+- }
+- conn, err := r.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+-
+- from := span.Parse(args[0])
+- file := conn.openFile(ctx, from.URI())
+- if file.err != nil {
+- return file.err
+- }
+- loc, err := file.mapper.SpanLocation(from)
+- if err != nil {
+- return err
+- }
+- p := protocol.RenameParams{
+- TextDocument: protocol.TextDocumentIdentifier{URI: loc.URI},
+- Position: loc.Range.Start,
+- NewName: args[1],
+- }
+- edit, err := conn.Rename(ctx, &p)
+- if err != nil {
+- return err
+- }
+- var orderedURIs []string
+- edits := map[span.URI][]protocol.TextEdit{}
+- for _, c := range edit.DocumentChanges {
+- if c.TextDocumentEdit != nil {
+- uri := fileURI(c.TextDocumentEdit.TextDocument.URI)
+- edits[uri] = append(edits[uri], c.TextDocumentEdit.Edits...)
+- orderedURIs = append(orderedURIs, string(uri))
+- }
+- }
+- sort.Strings(orderedURIs)
+- changeCount := len(orderedURIs)
+-
+- for _, u := range orderedURIs {
+- uri := span.URIFromURI(u)
+- cmdFile := conn.openFile(ctx, uri)
+- filename := cmdFile.uri.Filename()
+-
+- newContent, renameEdits, err := source.ApplyProtocolEdits(cmdFile.mapper, edits[uri])
+- if err != nil {
+- return fmt.Errorf("%v: %v", edits, err)
+- }
+-
+- switch {
+- case r.Write:
+- fmt.Fprintln(os.Stderr, filename)
+- if r.Preserve {
+- if err := os.Rename(filename, filename+".orig"); err != nil {
+- return fmt.Errorf("%v: %v", edits, err)
+- }
+- }
+- ioutil.WriteFile(filename, newContent, 0644)
+- case r.Diff:
+- unified, err := diff.ToUnified(filename+".orig", filename, string(cmdFile.mapper.Content), renameEdits)
+- if err != nil {
+- return err
+- }
+- fmt.Print(unified)
+- default:
+- if len(orderedURIs) > 1 {
+- fmt.Printf("%s:\n", filepath.Base(filename))
+- }
+- os.Stdout.Write(newContent)
+- if changeCount > 1 { // if this wasn't last change, print newline
+- fmt.Println()
+- }
+- changeCount -= 1
+- }
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/semantictokens.go b/gopls/internal/lsp/cmd/semantictokens.go
+--- a/gopls/internal/lsp/cmd/semantictokens.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/semantictokens.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,225 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "bytes"
+- "context"
+- "flag"
+- "fmt"
+- "go/parser"
+- "go/token"
+- "io/ioutil"
+- "log"
+- "os"
+- "unicode/utf8"
+-
+- "golang.org/x/tools/gopls/internal/lsp"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-// generate semantic tokens and interpolate them in the file
+-
+-// The output is the input file decorated with comments showing the
+-// syntactic tokens. The comments are stylized:
+-// /*<arrow><length>,<token type>,[<modifiers]*/
+-// For most occurrences, the comment comes just before the token it
+-// describes, and arrow is a right arrow. If the token is inside a string
+-// the comment comes just after the string, and the arrow is a left arrow.
+-// <length> is the length of the token in runes, <token type> is one
+-// of the supported semantic token types, and <modifiers. is a
+-// (possibly empty) list of token type modifiers.
+-
+-// There are 3 coordinate systems for lines and character offsets in lines
+-// LSP (what's returned from semanticTokens()):
+-// 0-based: the first line is line 0, the first character of a line
+-// is character 0, and characters are counted as UTF-16 code points
+-// gopls (and Go error messages):
+-// 1-based: the first line is line1, the first character of a line
+-// is character 0, and characters are counted as bytes
+-// internal (as used in marks, and lines:=bytes.Split(buf, '\n'))
+-// 0-based: lines and character positions are 1 less than in
+-// the gopls coordinate system
+-
+-type semtok struct {
+- app *Application
+-}
+-
+-var colmap *protocol.Mapper
+-
+-func (c *semtok) Name() string { return "semtok" }
+-func (c *semtok) Parent() string { return c.app.Name() }
+-func (c *semtok) Usage() string { return "<filename>" }
+-func (c *semtok) ShortHelp() string { return "show semantic tokens for the specified file" }
+-func (c *semtok) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), `
+-Example: show the semantic tokens for this file:
+-
+- $ gopls semtok internal/lsp/cmd/semtok.go
+-`)
+- printFlagDefaults(f)
+-}
+-
+-// Run performs the semtok on the files specified by args and prints the
+-// results to stdout in the format described above.
+-func (c *semtok) Run(ctx context.Context, args ...string) error {
+- if len(args) != 1 {
+- return fmt.Errorf("expected one file name, got %d", len(args))
+- }
+- // perhaps simpler if app had just had a FlagSet member
+- origOptions := c.app.options
+- c.app.options = func(opts *source.Options) {
+- origOptions(opts)
+- opts.SemanticTokens = true
+- }
+- conn, err := c.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+- uri := span.URIFromPath(args[0])
+- file := conn.openFile(ctx, uri)
+- if file.err != nil {
+- return file.err
+- }
+-
+- buf, err := ioutil.ReadFile(args[0])
+- if err != nil {
+- return err
+- }
+- lines := bytes.Split(buf, []byte{'\n'})
+- p := &protocol.SemanticTokensRangeParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- Range: protocol.Range{Start: protocol.Position{Line: 0, Character: 0},
+- End: protocol.Position{
+- Line: uint32(len(lines) - 1),
+- Character: uint32(len(lines[len(lines)-1]))},
+- },
+- }
+- resp, err := conn.semanticTokens(ctx, p)
+- if err != nil {
+- return err
+- }
+- fset := token.NewFileSet()
+- f, err := parser.ParseFile(fset, args[0], buf, 0)
+- if err != nil {
+- log.Printf("parsing %s failed %v", args[0], err)
+- return err
+- }
+- tok := fset.File(f.Pos())
+- if tok == nil {
+- // can't happen; just parsed this file
+- return fmt.Errorf("can't find %s in fset", args[0])
+- }
+- colmap = protocol.NewMapper(uri, buf)
+- err = decorate(file.uri.Filename(), resp.Data)
+- if err != nil {
+- return err
+- }
+- return nil
+-}
+-
+-type mark struct {
+- line, offset int // 1-based, from RangeSpan
+- len int // bytes, not runes
+- typ string
+- mods []string
+-}
+-
+-// prefixes for semantic token comments
+-const (
+- SemanticLeft = "/*⇐"
+- SemanticRight = "/*⇒"
+-)
+-
+-func markLine(m mark, lines [][]byte) {
+- l := lines[m.line-1] // mx is 1-based
+- length := utf8.RuneCount(l[m.offset-1 : m.offset-1+m.len])
+- splitAt := m.offset - 1
+- insert := ""
+- if m.typ == "namespace" && m.offset-1+m.len < len(l) && l[m.offset-1+m.len] == '"' {
+- // it is the last component of an import spec
+- // cannot put a comment inside a string
+- insert = fmt.Sprintf("%s%d,namespace,[]*/", SemanticLeft, length)
+- splitAt = m.offset + m.len
+- } else {
+- // be careful not to generate //*
+- spacer := ""
+- if splitAt-1 >= 0 && l[splitAt-1] == '/' {
+- spacer = " "
+- }
+- insert = fmt.Sprintf("%s%s%d,%s,%v*/", spacer, SemanticRight, length, m.typ, m.mods)
+- }
+- x := append([]byte(insert), l[splitAt:]...)
+- l = append(l[:splitAt], x...)
+- lines[m.line-1] = l
+-}
+-
+-func decorate(file string, result []uint32) error {
+- buf, err := ioutil.ReadFile(file)
+- if err != nil {
+- return err
+- }
+- marks := newMarks(result)
+- if len(marks) == 0 {
+- return nil
+- }
+- lines := bytes.Split(buf, []byte{'\n'})
+- for i := len(marks) - 1; i >= 0; i-- {
+- mx := marks[i]
+- markLine(mx, lines)
+- }
+- os.Stdout.Write(bytes.Join(lines, []byte{'\n'}))
+- return nil
+-}
+-
+-func newMarks(d []uint32) []mark {
+- ans := []mark{}
+- // the following two loops could be merged, at the cost
+- // of making the logic slightly more complicated to understand
+- // first, convert from deltas to absolute, in LSP coordinates
+- lspLine := make([]uint32, len(d)/5)
+- lspChar := make([]uint32, len(d)/5)
+- var line, char uint32
+- for i := 0; 5*i < len(d); i++ {
+- lspLine[i] = line + d[5*i+0]
+- if d[5*i+0] > 0 {
+- char = 0
+- }
+- lspChar[i] = char + d[5*i+1]
+- char = lspChar[i]
+- line = lspLine[i]
+- }
+- // second, convert to gopls coordinates
+- for i := 0; 5*i < len(d); i++ {
+- pr := protocol.Range{
+- Start: protocol.Position{
+- Line: lspLine[i],
+- Character: lspChar[i],
+- },
+- End: protocol.Position{
+- Line: lspLine[i],
+- Character: lspChar[i] + d[5*i+2],
+- },
+- }
+- spn, err := colmap.RangeSpan(pr)
+- if err != nil {
+- log.Fatal(err)
+- }
+- m := mark{
+- line: spn.Start().Line(),
+- offset: spn.Start().Column(),
+- len: spn.End().Column() - spn.Start().Column(),
+- typ: lsp.SemType(int(d[5*i+3])),
+- mods: lsp.SemMods(int(d[5*i+4])),
+- }
+- ans = append(ans, m)
+- }
+- return ans
+-}
+diff -urN a/gopls/internal/lsp/cmd/serve.go b/gopls/internal/lsp/cmd/serve.go
+--- a/gopls/internal/lsp/cmd/serve.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/serve.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,130 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "errors"
+- "flag"
+- "fmt"
+- "io"
+- "log"
+- "os"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/lsp/cache"
+- "golang.org/x/tools/gopls/internal/lsp/debug"
+- "golang.org/x/tools/gopls/internal/lsp/lsprpc"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/fakenet"
+- "golang.org/x/tools/internal/jsonrpc2"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// Serve is a struct that exposes the configurable parts of the LSP server as
+-// flags, in the right form for tool.Main to consume.
+-type Serve struct {
+- Logfile string `flag:"logfile" help:"filename to log to. if value is \"auto\", then logging to a default output file is enabled"`
+- Mode string `flag:"mode" help:"no effect"`
+- Port int `flag:"port" help:"port on which to run gopls for debugging purposes"`
+- Address string `flag:"listen" help:"address on which to listen for remote connections. If prefixed by 'unix;', the subsequent address is assumed to be a unix domain socket. Otherwise, TCP is used."`
+- IdleTimeout time.Duration `flag:"listen.timeout" help:"when used with -listen, shut down the server when there are no connected clients for this duration"`
+- Trace bool `flag:"rpc.trace" help:"print the full rpc trace in lsp inspector format"`
+- Debug string `flag:"debug" help:"serve debug information on the supplied address"`
+-
+- RemoteListenTimeout time.Duration `flag:"remote.listen.timeout" help:"when used with -remote=auto, the -listen.timeout value used to start the daemon"`
+- RemoteDebug string `flag:"remote.debug" help:"when used with -remote=auto, the -debug value used to start the daemon"`
+- RemoteLogfile string `flag:"remote.logfile" help:"when used with -remote=auto, the -logfile value used to start the daemon"`
+-
+- app *Application
+-}
+-
+-func (s *Serve) Name() string { return "serve" }
+-func (s *Serve) Parent() string { return s.app.Name() }
+-func (s *Serve) Usage() string { return "[server-flags]" }
+-func (s *Serve) ShortHelp() string {
+- return "run a server for Go code using the Language Server Protocol"
+-}
+-func (s *Serve) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), ` gopls [flags] [server-flags]
+-
+-The server communicates using JSONRPC2 on stdin and stdout, and is intended to be run directly as
+-a child of an editor process.
+-
+-server-flags:
+-`)
+- printFlagDefaults(f)
+-}
+-
+-func (s *Serve) remoteArgs(network, address string) []string {
+- args := []string{"serve",
+- "-listen", fmt.Sprintf(`%s;%s`, network, address),
+- }
+- if s.RemoteDebug != "" {
+- args = append(args, "-debug", s.RemoteDebug)
+- }
+- if s.RemoteListenTimeout != 0 {
+- args = append(args, "-listen.timeout", s.RemoteListenTimeout.String())
+- }
+- if s.RemoteLogfile != "" {
+- args = append(args, "-logfile", s.RemoteLogfile)
+- }
+- return args
+-}
+-
+-// Run configures a server based on the flags, and then runs it.
+-// It blocks until the server shuts down.
+-func (s *Serve) Run(ctx context.Context, args ...string) error {
+- if len(args) > 0 {
+- return tool.CommandLineErrorf("server does not take arguments, got %v", args)
+- }
+-
+- di := debug.GetInstance(ctx)
+- isDaemon := s.Address != "" || s.Port != 0
+- if di != nil {
+- closeLog, err := di.SetLogFile(s.Logfile, isDaemon)
+- if err != nil {
+- return err
+- }
+- defer closeLog()
+- di.ServerAddress = s.Address
+- di.MonitorMemory(ctx)
+- di.Serve(ctx, s.Debug)
+- }
+- var ss jsonrpc2.StreamServer
+- if s.app.Remote != "" {
+- var err error
+- ss, err = lsprpc.NewForwarder(s.app.Remote, s.remoteArgs)
+- if err != nil {
+- return fmt.Errorf("creating forwarder: %w", err)
+- }
+- } else {
+- ss = lsprpc.NewStreamServer(cache.New(nil), isDaemon, s.app.options)
+- }
+-
+- var network, addr string
+- if s.Address != "" {
+- network, addr = lsprpc.ParseAddr(s.Address)
+- }
+- if s.Port != 0 {
+- network = "tcp"
+- addr = fmt.Sprintf(":%v", s.Port)
+- }
+- if addr != "" {
+- log.Printf("Gopls daemon: listening on %s network, address %s...", network, addr)
+- defer log.Printf("Gopls daemon: exiting")
+- return jsonrpc2.ListenAndServe(ctx, network, addr, ss, s.IdleTimeout)
+- }
+- stream := jsonrpc2.NewHeaderStream(fakenet.NewConn("stdio", os.Stdin, os.Stdout))
+- if s.Trace && di != nil {
+- stream = protocol.LoggingStream(stream, di.LogWriter)
+- }
+- conn := jsonrpc2.NewConn(stream)
+- err := ss.ServeStream(ctx, conn)
+- if errors.Is(err, io.EOF) {
+- return nil
+- }
+- return err
+-}
+diff -urN a/gopls/internal/lsp/cmd/signature.go b/gopls/internal/lsp/cmd/signature.go
+--- a/gopls/internal/lsp/cmd/signature.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/signature.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,88 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// signature implements the signature verb for gopls
+-type signature struct {
+- app *Application
+-}
+-
+-func (r *signature) Name() string { return "signature" }
+-func (r *signature) Parent() string { return r.app.Name() }
+-func (r *signature) Usage() string { return "<position>" }
+-func (r *signature) ShortHelp() string { return "display selected identifier's signature" }
+-func (r *signature) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), `
+-Example:
+-
+- $ # 1-indexed location (:line:column or :#offset) of the target identifier
+- $ gopls signature helper/helper.go:8:6
+- $ gopls signature helper/helper.go:#53
+-`)
+- printFlagDefaults(f)
+-}
+-
+-func (r *signature) Run(ctx context.Context, args ...string) error {
+- if len(args) != 1 {
+- return tool.CommandLineErrorf("signature expects 1 argument (position)")
+- }
+-
+- conn, err := r.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+-
+- from := span.Parse(args[0])
+- file := conn.openFile(ctx, from.URI())
+- if file.err != nil {
+- return file.err
+- }
+-
+- loc, err := file.mapper.SpanLocation(from)
+- if err != nil {
+- return err
+- }
+-
+- p := protocol.SignatureHelpParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+-
+- s, err := conn.SignatureHelp(ctx, &p)
+- if err != nil {
+- return err
+- }
+-
+- if s == nil || len(s.Signatures) == 0 {
+- return tool.CommandLineErrorf("%v: not a function", from)
+- }
+-
+- // there is only ever one possible signature,
+- // see toProtocolSignatureHelp in lsp/signature_help.go
+- signature := s.Signatures[0]
+- fmt.Printf("%s\n", signature.Label)
+- switch x := signature.Documentation.Value.(type) {
+- case string:
+- if x != "" {
+- fmt.Printf("\n%s\n", x)
+- }
+- case protocol.MarkupContent:
+- if x.Value != "" {
+- fmt.Printf("\n%s\n", x.Value)
+- }
+- }
+-
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/subcommands.go b/gopls/internal/lsp/cmd/subcommands.go
+--- a/gopls/internal/lsp/cmd/subcommands.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/subcommands.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,59 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+- "text/tabwriter"
+-
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// subcommands is a helper that may be embedded for commands that delegate to
+-// subcommands.
+-type subcommands []tool.Application
+-
+-func (s subcommands) DetailedHelp(f *flag.FlagSet) {
+- w := tabwriter.NewWriter(f.Output(), 0, 0, 2, ' ', 0)
+- defer w.Flush()
+- fmt.Fprint(w, "\nSubcommand:\n")
+- for _, c := range s {
+- fmt.Fprintf(w, " %s\t%s\n", c.Name(), c.ShortHelp())
+- }
+- printFlagDefaults(f)
+-}
+-
+-func (s subcommands) Usage() string { return "<subcommand> [arg]..." }
+-
+-func (s subcommands) Run(ctx context.Context, args ...string) error {
+- if len(args) == 0 {
+- return tool.CommandLineErrorf("must provide subcommand")
+- }
+- command, args := args[0], args[1:]
+- for _, c := range s {
+- if c.Name() == command {
+- s := flag.NewFlagSet(c.Name(), flag.ExitOnError)
+- return tool.Run(ctx, s, c, args)
+- }
+- }
+- return tool.CommandLineErrorf("unknown subcommand %v", command)
+-}
+-
+-func (s subcommands) Commands() []tool.Application { return s }
+-
+-// getSubcommands returns the subcommands of a given Application.
+-func getSubcommands(a tool.Application) []tool.Application {
+- // This interface is satisfied both by tool.Applications
+- // that embed subcommands, and by *cmd.Application.
+- type hasCommands interface {
+- Commands() []tool.Application
+- }
+- if sub, ok := a.(hasCommands); ok {
+- return sub.Commands()
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/suggested_fix.go b/gopls/internal/lsp/cmd/suggested_fix.go
+--- a/gopls/internal/lsp/cmd/suggested_fix.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/suggested_fix.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,167 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+- "io/ioutil"
+- "os"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/diff"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// suggestedFix implements the fix verb for gopls.
+-type suggestedFix struct {
+- Diff bool `flag:"d,diff" help:"display diffs instead of rewriting files"`
+- Write bool `flag:"w,write" help:"write result to (source) file instead of stdout"`
+- All bool `flag:"a,all" help:"apply all fixes, not just preferred fixes"`
+-
+- app *Application
+-}
+-
+-func (s *suggestedFix) Name() string { return "fix" }
+-func (s *suggestedFix) Parent() string { return s.app.Name() }
+-func (s *suggestedFix) Usage() string { return "[fix-flags] <filename>" }
+-func (s *suggestedFix) ShortHelp() string { return "apply suggested fixes" }
+-func (s *suggestedFix) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprintf(f.Output(), `
+-Example: apply suggested fixes for this file
+- $ gopls fix -w internal/lsp/cmd/check.go
+-
+-fix-flags:
+-`)
+- printFlagDefaults(f)
+-}
+-
+-// Run performs diagnostic checks on the file specified and either;
+-// - if -w is specified, updates the file in place;
+-// - if -d is specified, prints out unified diffs of the changes; or
+-// - otherwise, prints the new versions to stdout.
+-func (s *suggestedFix) Run(ctx context.Context, args ...string) error {
+- if len(args) < 1 {
+- return tool.CommandLineErrorf("fix expects at least 1 argument")
+- }
+- conn, err := s.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+-
+- from := span.Parse(args[0])
+- uri := from.URI()
+- file := conn.openFile(ctx, uri)
+- if file.err != nil {
+- return file.err
+- }
+-
+- if err := conn.diagnoseFiles(ctx, []span.URI{uri}); err != nil {
+- return err
+- }
+- conn.Client.filesMu.Lock()
+- defer conn.Client.filesMu.Unlock()
+-
+- codeActionKinds := []protocol.CodeActionKind{protocol.QuickFix}
+- if len(args) > 1 {
+- codeActionKinds = []protocol.CodeActionKind{}
+- for _, k := range args[1:] {
+- codeActionKinds = append(codeActionKinds, protocol.CodeActionKind(k))
+- }
+- }
+-
+- rng, err := file.mapper.SpanRange(from)
+- if err != nil {
+- return err
+- }
+- p := protocol.CodeActionParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- Context: protocol.CodeActionContext{
+- Only: codeActionKinds,
+- Diagnostics: file.diagnostics,
+- },
+- Range: rng,
+- }
+- actions, err := conn.CodeAction(ctx, &p)
+- if err != nil {
+- return fmt.Errorf("%v: %v", from, err)
+- }
+- var edits []protocol.TextEdit
+- for _, a := range actions {
+- if a.Command != nil {
+- return fmt.Errorf("ExecuteCommand is not yet supported on the command line")
+- }
+- if !a.IsPreferred && !s.All {
+- continue
+- }
+- if !from.HasPosition() {
+- for _, c := range a.Edit.DocumentChanges {
+- if c.TextDocumentEdit != nil {
+- if fileURI(c.TextDocumentEdit.TextDocument.URI) == uri {
+- edits = append(edits, c.TextDocumentEdit.Edits...)
+- }
+- }
+- }
+- continue
+- }
+- // If the span passed in has a position, then we need to find
+- // the codeaction that has the same range as the passed in span.
+- for _, diag := range a.Diagnostics {
+- spn, err := file.mapper.RangeSpan(diag.Range)
+- if err != nil {
+- continue
+- }
+- if span.ComparePoint(from.Start(), spn.Start()) == 0 {
+- for _, c := range a.Edit.DocumentChanges {
+- if c.TextDocumentEdit != nil {
+- if fileURI(c.TextDocumentEdit.TextDocument.URI) == uri {
+- edits = append(edits, c.TextDocumentEdit.Edits...)
+- }
+- }
+- }
+- break
+- }
+- }
+-
+- // If suggested fix is not a diagnostic, still must collect edits.
+- if len(a.Diagnostics) == 0 {
+- for _, c := range a.Edit.DocumentChanges {
+- if c.TextDocumentEdit != nil {
+- if fileURI(c.TextDocumentEdit.TextDocument.URI) == uri {
+- edits = append(edits, c.TextDocumentEdit.Edits...)
+- }
+- }
+- }
+- }
+- }
+-
+- newContent, sedits, err := source.ApplyProtocolEdits(file.mapper, edits)
+- if err != nil {
+- return fmt.Errorf("%v: %v", edits, err)
+- }
+-
+- filename := file.uri.Filename()
+- switch {
+- case s.Write:
+- if len(edits) > 0 {
+- ioutil.WriteFile(filename, newContent, 0644)
+- }
+- case s.Diff:
+- diffs, err := diff.ToUnified(filename+".orig", filename, string(file.mapper.Content), sedits)
+- if err != nil {
+- return err
+- }
+- fmt.Print(diffs)
+- default:
+- os.Stdout.Write(newContent)
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/symbols.go b/gopls/internal/lsp/cmd/symbols.go
+--- a/gopls/internal/lsp/cmd/symbols.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/symbols.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,116 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "encoding/json"
+- "flag"
+- "fmt"
+- "sort"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// symbols implements the symbols verb for gopls
+-type symbols struct {
+- app *Application
+-}
+-
+-func (r *symbols) Name() string { return "symbols" }
+-func (r *symbols) Parent() string { return r.app.Name() }
+-func (r *symbols) Usage() string { return "<file>" }
+-func (r *symbols) ShortHelp() string { return "display selected file's symbols" }
+-func (r *symbols) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), `
+-Example:
+- $ gopls symbols helper/helper.go
+-`)
+- printFlagDefaults(f)
+-}
+-func (r *symbols) Run(ctx context.Context, args ...string) error {
+- if len(args) != 1 {
+- return tool.CommandLineErrorf("symbols expects 1 argument (position)")
+- }
+-
+- conn, err := r.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+-
+- from := span.Parse(args[0])
+- p := protocol.DocumentSymbolParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(from.URI()),
+- },
+- }
+- symbols, err := conn.DocumentSymbol(ctx, &p)
+- if err != nil {
+- return err
+- }
+- for _, s := range symbols {
+- if m, ok := s.(map[string]interface{}); ok {
+- s, err = mapToSymbol(m)
+- if err != nil {
+- return err
+- }
+- }
+- switch t := s.(type) {
+- case protocol.DocumentSymbol:
+- printDocumentSymbol(t)
+- case protocol.SymbolInformation:
+- printSymbolInformation(t)
+- }
+- }
+- return nil
+-}
+-
+-func mapToSymbol(m map[string]interface{}) (interface{}, error) {
+- b, err := json.Marshal(m)
+- if err != nil {
+- return nil, err
+- }
+-
+- if _, ok := m["selectionRange"]; ok {
+- var s protocol.DocumentSymbol
+- if err := json.Unmarshal(b, &s); err != nil {
+- return nil, err
+- }
+- return s, nil
+- }
+-
+- var s protocol.SymbolInformation
+- if err := json.Unmarshal(b, &s); err != nil {
+- return nil, err
+- }
+- return s, nil
+-}
+-
+-func printDocumentSymbol(s protocol.DocumentSymbol) {
+- fmt.Printf("%s %s %s\n", s.Name, s.Kind, positionToString(s.SelectionRange))
+- // Sort children for consistency
+- sort.Slice(s.Children, func(i, j int) bool {
+- return s.Children[i].Name < s.Children[j].Name
+- })
+- for _, c := range s.Children {
+- fmt.Printf("\t%s %s %s\n", c.Name, c.Kind, positionToString(c.SelectionRange))
+- }
+-}
+-
+-func printSymbolInformation(s protocol.SymbolInformation) {
+- fmt.Printf("%s %s %s\n", s.Name, s.Kind, positionToString(s.Location.Range))
+-}
+-
+-func positionToString(r protocol.Range) string {
+- return fmt.Sprintf("%v:%v-%v:%v",
+- r.Start.Line+1,
+- r.Start.Character+1,
+- r.End.Line+1,
+- r.End.Character+1,
+- )
+-}
+diff -urN a/gopls/internal/lsp/cmd/test/cmdtest.go b/gopls/internal/lsp/cmd/test/cmdtest.go
+--- a/gopls/internal/lsp/cmd/test/cmdtest.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/test/cmdtest.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package cmdtest contains the test suite for the command line behavior of gopls.
+-package cmdtest
+diff -urN a/gopls/internal/lsp/cmd/test/integration_test.go b/gopls/internal/lsp/cmd/test/integration_test.go
+--- a/gopls/internal/lsp/cmd/test/integration_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/test/integration_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,898 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-package cmdtest
+-
+-// This file defines integration tests of each gopls subcommand that
+-// fork+exec the command in a separate process.
+-//
+-// (Rather than execute 'go build gopls' during the test, we reproduce
+-// the main entrypoint in the test executable.)
+-//
+-// The purpose of this test is to exercise client-side logic such as
+-// argument parsing and formatting of LSP RPC responses, not server
+-// behavior; see lsp_test for that.
+-//
+-// All tests run in parallel.
+-//
+-// TODO(adonovan):
+-// - Use markers to represent positions in the input and in assertions.
+-// - Coverage of cross-cutting things like cwd, enviro, span parsing, etc.
+-// - Subcommands that accept -write and -diff flags should implement
+-// them consistently wrt the default behavior; factor their tests.
+-// - Add missing test for 'vulncheck' subcommand.
+-// - Add tests for client-only commands: serve, bug, help, api-json, licenses.
+-
+-import (
+- "bytes"
+- "context"
+- "encoding/json"
+- "fmt"
+- "os"
+- "path/filepath"
+- "regexp"
+- "strings"
+- "testing"
+-
+- exec "golang.org/x/sys/execabs"
+- "golang.org/x/tools/gopls/internal/hooks"
+- "golang.org/x/tools/gopls/internal/lsp/cmd"
+- "golang.org/x/tools/gopls/internal/lsp/debug"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/testenv"
+- "golang.org/x/tools/internal/tool"
+- "golang.org/x/tools/txtar"
+-)
+-
+-// TestVersion tests the 'version' subcommand (../info.go).
+-func TestVersion(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, "")
+-
+- // There's not much we can robustly assert about the actual version.
+- const want = debug.Version // e.g. "master"
+-
+- // basic
+- {
+- res := gopls(t, tree, "version")
+- res.checkExit(true)
+- res.checkStdout(want)
+- }
+-
+- // -json flag
+- {
+- res := gopls(t, tree, "version", "-json")
+- res.checkExit(true)
+- var v debug.ServerVersion
+- if res.toJSON(&v) {
+- if v.Version != want {
+- t.Errorf("expected Version %q, got %q (%v)", want, v.Version, res)
+- }
+- }
+- }
+-}
+-
+-// TestCheck tests the 'check' subcommand (../check.go).
+-func TestCheck(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- go.mod --
+-module example.com
+-go 1.18
+-
+--- a.go --
+-package a
+-import "fmt"
+-var _ = fmt.Sprintf("%s", 123)
+-
+--- b.go --
+-package a
+-import "fmt"
+-var _ = fmt.Sprintf("%d", "123")
+-`)
+-
+- // no files
+- {
+- res := gopls(t, tree, "check")
+- res.checkExit(true)
+- if res.stdout != "" {
+- t.Errorf("unexpected output: %v", res)
+- }
+- }
+-
+- // one file
+- {
+- res := gopls(t, tree, "check", "./a.go")
+- res.checkExit(true)
+- res.checkStdout("fmt.Sprintf format %s has arg 123 of wrong type int")
+- }
+-
+- // two files
+- {
+- res := gopls(t, tree, "check", "./a.go", "./b.go")
+- res.checkExit(true)
+- res.checkStdout(`a.go:.* fmt.Sprintf format %s has arg 123 of wrong type int`)
+- res.checkStdout(`b.go:.* fmt.Sprintf format %d has arg "123" of wrong type string`)
+- }
+-}
+-
+-// TestCallHierarchy tests the 'call_hierarchy' subcommand (../call_hierarchy.go).
+-func TestCallHierarchy(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- go.mod --
+-module example.com
+-go 1.18
+-
+--- a.go --
+-package a
+-func f() {}
+-func g() {
+- f()
+-}
+-func h() {
+- f()
+- f()
+-}
+-`)
+- // missing position
+- {
+- res := gopls(t, tree, "call_hierarchy")
+- res.checkExit(false)
+- res.checkStderr("expects 1 argument")
+- }
+- // wrong place
+- {
+- res := gopls(t, tree, "call_hierarchy", "a.go:1")
+- res.checkExit(false)
+- res.checkStderr("identifier not found")
+- }
+- // f is called once from g and twice from h.
+- {
+- res := gopls(t, tree, "call_hierarchy", "a.go:2:6")
+- res.checkExit(true)
+- // We use regexp '.' as an OS-agnostic path separator.
+- res.checkStdout("ranges 7:2-3, 8:2-3 in ..a.go from/to function h in ..a.go:6:6-7")
+- res.checkStdout("ranges 4:2-3 in ..a.go from/to function g in ..a.go:3:6-7")
+- res.checkStdout("identifier: function f in ..a.go:2:6-7")
+- }
+-}
+-
+-// TestDefinition tests the 'definition' subcommand (../definition.go).
+-func TestDefinition(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- go.mod --
+-module example.com
+-go 1.18
+-
+--- a.go --
+-package a
+-import "fmt"
+-func f() {
+- fmt.Println()
+-}
+-func g() {
+- f()
+-}
+-`)
+- // missing position
+- {
+- res := gopls(t, tree, "definition")
+- res.checkExit(false)
+- res.checkStderr("expects 1 argument")
+- }
+- // intra-package
+- {
+- res := gopls(t, tree, "definition", "a.go:7:2") // "f()"
+- res.checkExit(true)
+- res.checkStdout("a.go:3:6-7: defined here as func f")
+- }
+- // cross-package
+- {
+- res := gopls(t, tree, "definition", "a.go:4:7") // "Println"
+- res.checkExit(true)
+- res.checkStdout("print.go.* defined here as func fmt.Println")
+- res.checkStdout("Println formats using the default formats for its operands")
+- }
+- // -json and -markdown
+- {
+- res := gopls(t, tree, "definition", "-json", "-markdown", "a.go:4:7")
+- res.checkExit(true)
+- var defn cmd.Definition
+- if res.toJSON(&defn) {
+- if !strings.HasPrefix(defn.Description, "```go\nfunc fmt.Println") {
+- t.Errorf("Description does not start with markdown code block. Got: %s", defn.Description)
+- }
+- }
+- }
+-}
+-
+-// TestFoldingRanges tests the 'folding_ranges' subcommand (../folding_range.go).
+-func TestFoldingRanges(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- go.mod --
+-module example.com
+-go 1.18
+-
+--- a.go --
+-package a
+-func f(x int) {
+- // hello
+-}
+-`)
+- // missing filename
+- {
+- res := gopls(t, tree, "folding_ranges")
+- res.checkExit(false)
+- res.checkStderr("expects 1 argument")
+- }
+- // success
+- {
+- res := gopls(t, tree, "folding_ranges", "a.go")
+- res.checkExit(true)
+- res.checkStdout("2:8-2:13") // params (x int)
+- res.checkStdout("2:16-4:1") // body { ... }
+- }
+-}
+-
+-// TestFormat tests the 'format' subcommand (../format.go).
+-func TestFormat(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- a.go --
+-package a ; func f ( ) { }
+-`)
+- const want = `package a
+-
+-func f() {}
+-`
+-
+- // no files => nop
+- {
+- res := gopls(t, tree, "format")
+- res.checkExit(true)
+- }
+- // default => print formatted result
+- {
+- res := gopls(t, tree, "format", "a.go")
+- res.checkExit(true)
+- if res.stdout != want {
+- t.Errorf("format: got <<%s>>, want <<%s>>", res.stdout, want)
+- }
+- }
+- // start/end position not supported (unless equal to start/end of file)
+- {
+- res := gopls(t, tree, "format", "a.go:1-2")
+- res.checkExit(false)
+- res.checkStderr("only full file formatting supported")
+- }
+- // -list: show only file names
+- {
+- res := gopls(t, tree, "format", "-list", "a.go")
+- res.checkExit(true)
+- res.checkStdout("a.go")
+- }
+- // -diff prints a unified diff
+- {
+- res := gopls(t, tree, "format", "-diff", "a.go")
+- res.checkExit(true)
+- // We omit the filenames as they vary by OS.
+- want := `
+--package a ; func f ( ) { }
+-+package a
+-+
+-+func f() {}
+-`
+- res.checkStdout(regexp.QuoteMeta(want))
+- }
+- // -write updates the file
+- {
+- res := gopls(t, tree, "format", "-write", "a.go")
+- res.checkExit(true)
+- res.checkStdout("^$") // empty
+- checkContent(t, filepath.Join(tree, "a.go"), want)
+- }
+-}
+-
+-// TestHighlight tests the 'highlight' subcommand (../highlight.go).
+-func TestHighlight(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- a.go --
+-package a
+-import "fmt"
+-func f() {
+- fmt.Println()
+- fmt.Println()
+-}
+-`)
+-
+- // no arguments
+- {
+- res := gopls(t, tree, "highlight")
+- res.checkExit(false)
+- res.checkStderr("expects 1 argument")
+- }
+- // all occurrences of Println
+- {
+- res := gopls(t, tree, "highlight", "a.go:4:7")
+- res.checkExit(true)
+- res.checkStdout("a.go:4:6-13")
+- res.checkStdout("a.go:5:6-13")
+- }
+-}
+-
+-// TestImplementations tests the 'implementation' subcommand (../implementation.go).
+-func TestImplementations(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- a.go --
+-package a
+-import "fmt"
+-type T int
+-func (T) String() string { return "" }
+-`)
+-
+- // no arguments
+- {
+- res := gopls(t, tree, "implementation")
+- res.checkExit(false)
+- res.checkStderr("expects 1 argument")
+- }
+- // T.String
+- {
+- res := gopls(t, tree, "implementation", "a.go:4:10")
+- res.checkExit(true)
+- // TODO(adonovan): extract and check the content of the reported ranges?
+- // We use regexp '.' as an OS-agnostic path separator.
+- res.checkStdout("fmt.print.go:") // fmt.Stringer.String
+- res.checkStdout("runtime.error.go:") // runtime.stringer.String
+- }
+-}
+-
+-// TestImports tests the 'imports' subcommand (../imports.go).
+-func TestImports(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- a.go --
+-package a
+-func _() {
+- fmt.Println()
+-}
+-`)
+-
+- want := `
+-package a
+-
+-import "fmt"
+-func _() {
+- fmt.Println()
+-}
+-`[1:]
+-
+- // no arguments
+- {
+- res := gopls(t, tree, "imports")
+- res.checkExit(false)
+- res.checkStderr("expects 1 argument")
+- }
+- // default: print with imports
+- {
+- res := gopls(t, tree, "imports", "a.go")
+- res.checkExit(true)
+- if res.stdout != want {
+- t.Errorf("format: got <<%s>>, want <<%s>>", res.stdout, want)
+- }
+- }
+- // -diff: show a unified diff
+- {
+- res := gopls(t, tree, "imports", "-diff", "a.go")
+- res.checkExit(true)
+- res.checkStdout(regexp.QuoteMeta(`+import "fmt"`))
+- }
+- // -write: update file
+- {
+- res := gopls(t, tree, "imports", "-write", "a.go")
+- res.checkExit(true)
+- checkContent(t, filepath.Join(tree, "a.go"), want)
+- }
+-}
+-
+-// TestLinks tests the 'links' subcommand (../links.go).
+-func TestLinks(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- a.go --
+-// Link in package doc: https://pkg.go.dev/
+-package a
+-
+-// Link in internal comment: https://go.dev/cl
+-
+-// Doc comment link: https://blog.go.dev/
+-func f() {}
+-`)
+- // no arguments
+- {
+- res := gopls(t, tree, "links")
+- res.checkExit(false)
+- res.checkStderr("expects 1 argument")
+- }
+- // success
+- {
+- res := gopls(t, tree, "links", "a.go")
+- res.checkExit(true)
+- res.checkStdout("https://go.dev/cl")
+- res.checkStdout("https://pkg.go.dev")
+- res.checkStdout("https://blog.go.dev/")
+- }
+- // -json
+- {
+- res := gopls(t, tree, "links", "-json", "a.go")
+- res.checkExit(true)
+- res.checkStdout("https://pkg.go.dev")
+- res.checkStdout("https://go.dev/cl")
+- res.checkStdout("https://blog.go.dev/") // at 5:21-5:41
+- var links []protocol.DocumentLink
+- if res.toJSON(&links) {
+- // Check just one of the three locations.
+- if got, want := fmt.Sprint(links[2].Range), "5:21-5:41"; got != want {
+- t.Errorf("wrong link location: got %v, want %v", got, want)
+- }
+- }
+- }
+-}
+-
+-// TestReferences tests the 'references' subcommand (../references.go).
+-func TestReferences(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- go.mod --
+-module example.com
+-go 1.18
+-
+--- a.go --
+-package a
+-import "fmt"
+-func f() {
+- fmt.Println()
+-}
+-
+--- b.go --
+-package a
+-import "fmt"
+-func g() {
+- fmt.Println()
+-}
+-`)
+- // no arguments
+- {
+- res := gopls(t, tree, "references")
+- res.checkExit(false)
+- res.checkStderr("expects 1 argument")
+- }
+- // fmt.Println
+- {
+- res := gopls(t, tree, "references", "a.go:4:10")
+- res.checkExit(true)
+- res.checkStdout("a.go:4:6-13")
+- res.checkStdout("b.go:4:6-13")
+- }
+-}
+-
+-// TestSignature tests the 'signature' subcommand (../signature.go).
+-func TestSignature(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- go.mod --
+-module example.com
+-go 1.18
+-
+--- a.go --
+-package a
+-import "fmt"
+-func f() {
+- fmt.Println(123)
+-}
+-`)
+- // no arguments
+- {
+- res := gopls(t, tree, "signature")
+- res.checkExit(false)
+- res.checkStderr("expects 1 argument")
+- }
+- // at 123 inside fmt.Println() call
+- {
+- res := gopls(t, tree, "signature", "a.go:4:15")
+- res.checkExit(true)
+- res.checkStdout("Println\\(a ...")
+- res.checkStdout("Println formats using the default formats...")
+- }
+-}
+-
+-// TestPrepareRename tests the 'prepare_rename' subcommand (../prepare_rename.go).
+-func TestPrepareRename(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- go.mod --
+-module example.com
+-go 1.18
+-
+--- a.go --
+-package a
+-func oldname() {}
+-`)
+- // no arguments
+- {
+- res := gopls(t, tree, "prepare_rename")
+- res.checkExit(false)
+- res.checkStderr("expects 1 argument")
+- }
+- // in 'package' keyword
+- {
+- res := gopls(t, tree, "prepare_rename", "a.go:1:3")
+- res.checkExit(false)
+- res.checkStderr("request is not valid at the given position")
+- }
+- // in 'package' identifier (not supported by client)
+- {
+- res := gopls(t, tree, "prepare_rename", "a.go:1:9")
+- res.checkExit(false)
+- res.checkStderr("can't rename package")
+- }
+- // in func oldname
+- {
+- res := gopls(t, tree, "prepare_rename", "a.go:2:9")
+- res.checkExit(true)
+- res.checkStdout("a.go:2:6-13") // all of "oldname"
+- }
+-}
+-
+-// TestRename tests the 'rename' subcommand (../rename.go).
+-func TestRename(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- go.mod --
+-module example.com
+-go 1.18
+-
+--- a.go --
+-package a
+-func oldname() {}
+-`)
+- // no arguments
+- {
+- res := gopls(t, tree, "rename")
+- res.checkExit(false)
+- res.checkStderr("expects 2 arguments")
+- }
+- // missing newname
+- {
+- res := gopls(t, tree, "rename", "a.go:1:3")
+- res.checkExit(false)
+- res.checkStderr("expects 2 arguments")
+- }
+- // in 'package' keyword
+- {
+- res := gopls(t, tree, "rename", "a.go:1:3", "newname")
+- res.checkExit(false)
+- res.checkStderr("no identifier found")
+- }
+- // in 'package' identifier
+- {
+- res := gopls(t, tree, "rename", "a.go:1:9", "newname")
+- res.checkExit(false)
+- res.checkStderr(`cannot rename package: module path .* same as the package path, so .* no effect`)
+- }
+- // success, func oldname (and -diff)
+- {
+- res := gopls(t, tree, "rename", "-diff", "a.go:2:9", "newname")
+- res.checkExit(true)
+- res.checkStdout(regexp.QuoteMeta("-func oldname() {}"))
+- res.checkStdout(regexp.QuoteMeta("+func newname() {}"))
+- }
+-}
+-
+-// TestSymbols tests the 'symbols' subcommand (../symbols.go).
+-func TestSymbols(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- go.mod --
+-module example.com
+-go 1.18
+-
+--- a.go --
+-package a
+-func f()
+-var v int
+-const c = 0
+-`)
+- // no files
+- {
+- res := gopls(t, tree, "symbols")
+- res.checkExit(false)
+- res.checkStderr("expects 1 argument")
+- }
+- // success
+- {
+- res := gopls(t, tree, "symbols", "a.go:123:456") // (line/col ignored)
+- res.checkExit(true)
+- res.checkStdout("f Function 2:6-2:7")
+- res.checkStdout("v Variable 3:5-3:6")
+- res.checkStdout("c Constant 4:7-4:8")
+- }
+-}
+-
+-// TestSemtok tests the 'semtok' subcommand (../semantictokens.go).
+-func TestSemtok(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- go.mod --
+-module example.com
+-go 1.18
+-
+--- a.go --
+-package a
+-func f()
+-var v int
+-const c = 0
+-`)
+- // no files
+- {
+- res := gopls(t, tree, "semtok")
+- res.checkExit(false)
+- res.checkStderr("expected one file name")
+- }
+- // success
+- {
+- res := gopls(t, tree, "semtok", "a.go")
+- res.checkExit(true)
+- got := res.stdout
+- want := `
+-/*⇒7,keyword,[]*/package /*⇒1,namespace,[]*/a
+-/*⇒4,keyword,[]*/func /*⇒1,function,[definition]*/f()
+-/*⇒3,keyword,[]*/var /*⇒1,variable,[definition]*/v /*⇒3,type,[defaultLibrary]*/int
+-/*⇒5,keyword,[]*/const /*⇒1,variable,[definition readonly]*/c = /*⇒1,number,[]*/0
+-`[1:]
+- if got != want {
+- t.Errorf("semtok: got <<%s>>, want <<%s>>", got, want)
+- }
+- }
+-}
+-
+-// TestFix tests the 'fix' subcommand (../suggested_fix.go).
+-func TestFix(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- go.mod --
+-module example.com
+-go 1.18
+-
+--- a.go --
+-package a
+-var _ error = T(0)
+-type T int
+-func f() (int, string) { return }
+-`)
+- want := `
+-package a
+-var _ error = T(0)
+-type T int
+-func f() (int, string) { return 0, "" }
+-`[1:]
+-
+- // no arguments
+- {
+- res := gopls(t, tree, "fix")
+- res.checkExit(false)
+- res.checkStderr("expects at least 1 argument")
+- }
+- // success (-a enables fillreturns)
+- {
+- res := gopls(t, tree, "fix", "-a", "a.go")
+- res.checkExit(true)
+- got := res.stdout
+- if got != want {
+- t.Errorf("fix: got <<%s>>, want <<%s>>", got, want)
+- }
+- }
+- // TODO(adonovan): more tests:
+- // - -write, -diff: factor with imports, format, rename.
+- // - without -all flag
+- // - args[2:] is an optional list of protocol.CodeActionKind enum values.
+- // - a span argument with a range causes filtering.
+-}
+-
+-// TestWorkspaceSymbol tests the 'workspace_symbol' subcommand (../workspace_symbol.go).
+-func TestWorkspaceSymbol(t *testing.T) {
+- t.Parallel()
+-
+- tree := writeTree(t, `
+--- go.mod --
+-module example.com
+-go 1.18
+-
+--- a.go --
+-package a
+-func someFunctionName()
+-`)
+- // no files
+- {
+- res := gopls(t, tree, "workspace_symbol")
+- res.checkExit(false)
+- res.checkStderr("expects 1 argument")
+- }
+- // success
+- {
+- res := gopls(t, tree, "workspace_symbol", "meFun")
+- res.checkExit(true)
+- res.checkStdout("a.go:2:6-22 someFunctionName Function")
+- }
+-}
+-
+-// -- test framework --
+-
+-func TestMain(m *testing.M) {
+- switch os.Getenv("ENTRYPOINT") {
+- case "goplsMain":
+- goplsMain()
+- default:
+- os.Exit(m.Run())
+- }
+-}
+-
+-// This function is a stand-in for gopls.main in ../../../../main.go.
+-func goplsMain() {
+- bug.PanicOnBugs = true // (not in the production command)
+- tool.Main(context.Background(), cmd.New("gopls", "", nil, hooks.Options), os.Args[1:])
+-}
+-
+-// writeTree extracts a txtar archive into a new directory and returns its path.
+-func writeTree(t *testing.T, archive string) string {
+- root := t.TempDir()
+-
+- // This unfortunate step is required because gopls output
+- // expands symbolic links it its input file names (arguably it
+- // should not), and on macOS the temp dir is in /var -> private/var.
+- root, err := filepath.EvalSymlinks(root)
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- for _, f := range txtar.Parse([]byte(archive)).Files {
+- filename := filepath.Join(root, f.Name)
+- if err := os.MkdirAll(filepath.Dir(filename), 0777); err != nil {
+- t.Fatal(err)
+- }
+- if err := os.WriteFile(filename, f.Data, 0666); err != nil {
+- t.Fatal(err)
+- }
+- }
+- return root
+-}
+-
+-// gopls executes gopls in a child process.
+-func gopls(t *testing.T, dir string, args ...string) *result {
+- testenv.NeedsTool(t, "go")
+-
+- // Catch inadvertent use of dir=".", which would make
+- // the ReplaceAll below unpredictable.
+- if !filepath.IsAbs(dir) {
+- t.Fatalf("dir is not absolute: %s", dir)
+- }
+-
+- cmd := exec.Command(os.Args[0], args...)
+- cmd.Env = append(os.Environ(), "ENTRYPOINT=goplsMain")
+- cmd.Dir = dir
+- cmd.Stdout = new(bytes.Buffer)
+- cmd.Stderr = new(bytes.Buffer)
+-
+- cmdErr := cmd.Run()
+-
+- stdout := strings.ReplaceAll(fmt.Sprint(cmd.Stdout), dir, ".")
+- stderr := strings.ReplaceAll(fmt.Sprint(cmd.Stderr), dir, ".")
+- exitcode := 0
+- if cmdErr != nil {
+- if exitErr, ok := cmdErr.(*exec.ExitError); ok {
+- exitcode = exitErr.ExitCode()
+- } else {
+- stderr = cmdErr.Error() // (execve failure)
+- exitcode = -1
+- }
+- }
+- res := &result{
+- t: t,
+- command: "gopls " + strings.Join(args, " "),
+- exitcode: exitcode,
+- stdout: stdout,
+- stderr: stderr,
+- }
+- if false {
+- t.Log(res)
+- }
+- return res
+-}
+-
+-// A result holds the result of a gopls invocation, and provides assertion helpers.
+-type result struct {
+- t *testing.T
+- command string
+- exitcode int
+- stdout, stderr string
+-}
+-
+-func (res *result) String() string {
+- return fmt.Sprintf("%s: exit=%d stdout=<<%s>> stderr=<<%s>>",
+- res.command, res.exitcode, res.stdout, res.stderr)
+-}
+-
+-// checkExit asserts that gopls returned the expected exit code.
+-func (res *result) checkExit(success bool) {
+- res.t.Helper()
+- if (res.exitcode == 0) != success {
+- res.t.Errorf("%s: exited with code %d, want success: %t (%s)",
+- res.command, res.exitcode, success, res)
+- }
+-}
+-
+-// checkStdout asserts that the gopls standard output matches the pattern.
+-func (res *result) checkStdout(pattern string) {
+- res.t.Helper()
+- res.checkOutput(pattern, "stdout", res.stdout)
+-}
+-
+-// checkStderr asserts that the gopls standard error matches the pattern.
+-func (res *result) checkStderr(pattern string) {
+- res.t.Helper()
+- res.checkOutput(pattern, "stderr", res.stderr)
+-}
+-
+-func (res *result) checkOutput(pattern, name, content string) {
+- res.t.Helper()
+- if match, err := regexp.MatchString(pattern, content); err != nil {
+- res.t.Errorf("invalid regexp: %v", err)
+- } else if !match {
+- res.t.Errorf("%s: %s does not match [%s]; got <<%s>>",
+- res.command, name, pattern, content)
+- }
+-}
+-
+-// toJSON decodes res.stdout as JSON into to *ptr and reports its success.
+-func (res *result) toJSON(ptr interface{}) bool {
+- if err := json.Unmarshal([]byte(res.stdout), ptr); err != nil {
+- res.t.Errorf("invalid JSON %v", err)
+- return false
+- }
+- return true
+-}
+-
+-// checkContent checks that the contents of the file are as expected.
+-func checkContent(t *testing.T, filename, want string) {
+- data, err := os.ReadFile(filename)
+- if err != nil {
+- t.Error(err)
+- return
+- }
+- if got := string(data); got != want {
+- t.Errorf("content of %s is <<%s>>, want <<%s>>", filename, got, want)
+- }
+-}
+diff -urN a/gopls/internal/lsp/cmd/usage/api-json.hlp b/gopls/internal/lsp/cmd/usage/api-json.hlp
+--- a/gopls/internal/lsp/cmd/usage/api-json.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/api-json.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,4 +0,0 @@
+-print json describing gopls API
+-
+-Usage:
+- gopls [flags] api-json
+diff -urN a/gopls/internal/lsp/cmd/usage/bug.hlp b/gopls/internal/lsp/cmd/usage/bug.hlp
+--- a/gopls/internal/lsp/cmd/usage/bug.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/bug.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,4 +0,0 @@
+-report a bug in gopls
+-
+-Usage:
+- gopls [flags] bug
+diff -urN a/gopls/internal/lsp/cmd/usage/call_hierarchy.hlp b/gopls/internal/lsp/cmd/usage/call_hierarchy.hlp
+--- a/gopls/internal/lsp/cmd/usage/call_hierarchy.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/call_hierarchy.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-display selected identifier's call hierarchy
+-
+-Usage:
+- gopls [flags] call_hierarchy <position>
+-
+-Example:
+-
+- $ # 1-indexed location (:line:column or :#offset) of the target identifier
+- $ gopls call_hierarchy helper/helper.go:8:6
+- $ gopls call_hierarchy helper/helper.go:#53
+diff -urN a/gopls/internal/lsp/cmd/usage/check.hlp b/gopls/internal/lsp/cmd/usage/check.hlp
+--- a/gopls/internal/lsp/cmd/usage/check.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/check.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-show diagnostic results for the specified file
+-
+-Usage:
+- gopls [flags] check <filename>
+-
+-Example: show the diagnostic results of this file:
+-
+- $ gopls check internal/lsp/cmd/check.go
+diff -urN a/gopls/internal/lsp/cmd/usage/definition.hlp b/gopls/internal/lsp/cmd/usage/definition.hlp
+--- a/gopls/internal/lsp/cmd/usage/definition.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/definition.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,15 +0,0 @@
+-show declaration of selected identifier
+-
+-Usage:
+- gopls [flags] definition [definition-flags] <position>
+-
+-Example: show the definition of the identifier at syntax at offset 44 in this file (flag.FlagSet):
+-
+- $ gopls definition internal/lsp/cmd/definition.go:44:47
+- $ gopls definition internal/lsp/cmd/definition.go:#1270
+-
+-definition-flags:
+- -json
+- emit output in JSON format
+- -markdown
+- support markdown in responses
+diff -urN a/gopls/internal/lsp/cmd/usage/fix.hlp b/gopls/internal/lsp/cmd/usage/fix.hlp
+--- a/gopls/internal/lsp/cmd/usage/fix.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/fix.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,15 +0,0 @@
+-apply suggested fixes
+-
+-Usage:
+- gopls [flags] fix [fix-flags] <filename>
+-
+-Example: apply suggested fixes for this file
+- $ gopls fix -w internal/lsp/cmd/check.go
+-
+-fix-flags:
+- -a,-all
+- apply all fixes, not just preferred fixes
+- -d,-diff
+- display diffs instead of rewriting files
+- -w,-write
+- write result to (source) file instead of stdout
+diff -urN a/gopls/internal/lsp/cmd/usage/folding_ranges.hlp b/gopls/internal/lsp/cmd/usage/folding_ranges.hlp
+--- a/gopls/internal/lsp/cmd/usage/folding_ranges.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/folding_ranges.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-display selected file's folding ranges
+-
+-Usage:
+- gopls [flags] folding_ranges <file>
+-
+-Example:
+-
+- $ gopls folding_ranges helper/helper.go
+diff -urN a/gopls/internal/lsp/cmd/usage/format.hlp b/gopls/internal/lsp/cmd/usage/format.hlp
+--- a/gopls/internal/lsp/cmd/usage/format.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/format.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+-format the code according to the go standard
+-
+-Usage:
+- gopls [flags] format [format-flags] <filerange>
+-
+-The arguments supplied may be simple file names, or ranges within files.
+-
+-Example: reformat this file:
+-
+- $ gopls format -w internal/lsp/cmd/check.go
+-
+-format-flags:
+- -d,-diff
+- display diffs instead of rewriting files
+- -l,-list
+- list files whose formatting differs from gofmt's
+- -w,-write
+- write result to (source) file instead of stdout
+diff -urN a/gopls/internal/lsp/cmd/usage/help.hlp b/gopls/internal/lsp/cmd/usage/help.hlp
+--- a/gopls/internal/lsp/cmd/usage/help.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/help.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-print usage information for subcommands
+-
+-Usage:
+- gopls [flags] help
+-
+-
+-Examples:
+-$ gopls help # main gopls help message
+-$ gopls help remote # help on 'remote' command
+-$ gopls help remote sessions # help on 'remote sessions' subcommand
+diff -urN a/gopls/internal/lsp/cmd/usage/highlight.hlp b/gopls/internal/lsp/cmd/usage/highlight.hlp
+--- a/gopls/internal/lsp/cmd/usage/highlight.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/highlight.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-display selected identifier's highlights
+-
+-Usage:
+- gopls [flags] highlight <position>
+-
+-Example:
+-
+- $ # 1-indexed location (:line:column or :#offset) of the target identifier
+- $ gopls highlight helper/helper.go:8:6
+- $ gopls highlight helper/helper.go:#53
+diff -urN a/gopls/internal/lsp/cmd/usage/implementation.hlp b/gopls/internal/lsp/cmd/usage/implementation.hlp
+--- a/gopls/internal/lsp/cmd/usage/implementation.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/implementation.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-display selected identifier's implementation
+-
+-Usage:
+- gopls [flags] implementation <position>
+-
+-Example:
+-
+- $ # 1-indexed location (:line:column or :#offset) of the target identifier
+- $ gopls implementation helper/helper.go:8:6
+- $ gopls implementation helper/helper.go:#53
+diff -urN a/gopls/internal/lsp/cmd/usage/imports.hlp b/gopls/internal/lsp/cmd/usage/imports.hlp
+--- a/gopls/internal/lsp/cmd/usage/imports.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/imports.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+-updates import statements
+-
+-Usage:
+- gopls [flags] imports [imports-flags] <filename>
+-
+-Example: update imports statements in a file:
+-
+- $ gopls imports -w internal/lsp/cmd/check.go
+-
+-imports-flags:
+- -d,-diff
+- display diffs instead of rewriting files
+- -w,-write
+- write result to (source) file instead of stdout
+diff -urN a/gopls/internal/lsp/cmd/usage/inspect.hlp b/gopls/internal/lsp/cmd/usage/inspect.hlp
+--- a/gopls/internal/lsp/cmd/usage/inspect.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/inspect.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-interact with the gopls daemon (deprecated: use 'remote')
+-
+-Usage:
+- gopls [flags] inspect <subcommand> [arg]...
+-
+-Subcommand:
+- sessions print information about current gopls sessions
+- debug start the debug server
+diff -urN a/gopls/internal/lsp/cmd/usage/licenses.hlp b/gopls/internal/lsp/cmd/usage/licenses.hlp
+--- a/gopls/internal/lsp/cmd/usage/licenses.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/licenses.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,4 +0,0 @@
+-print licenses of included software
+-
+-Usage:
+- gopls [flags] licenses
+diff -urN a/gopls/internal/lsp/cmd/usage/links.hlp b/gopls/internal/lsp/cmd/usage/links.hlp
+--- a/gopls/internal/lsp/cmd/usage/links.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/links.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+-list links in a file
+-
+-Usage:
+- gopls [flags] links [links-flags] <filename>
+-
+-Example: list links contained within a file:
+-
+- $ gopls links internal/lsp/cmd/check.go
+-
+-links-flags:
+- -json
+- emit document links in JSON format
+diff -urN a/gopls/internal/lsp/cmd/usage/prepare_rename.hlp b/gopls/internal/lsp/cmd/usage/prepare_rename.hlp
+--- a/gopls/internal/lsp/cmd/usage/prepare_rename.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/prepare_rename.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-test validity of a rename operation at location
+-
+-Usage:
+- gopls [flags] prepare_rename <position>
+-
+-Example:
+-
+- $ # 1-indexed location (:line:column or :#offset) of the target identifier
+- $ gopls prepare_rename helper/helper.go:8:6
+- $ gopls prepare_rename helper/helper.go:#53
+diff -urN a/gopls/internal/lsp/cmd/usage/references.hlp b/gopls/internal/lsp/cmd/usage/references.hlp
+--- a/gopls/internal/lsp/cmd/usage/references.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/references.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+-display selected identifier's references
+-
+-Usage:
+- gopls [flags] references [references-flags] <position>
+-
+-Example:
+-
+- $ # 1-indexed location (:line:column or :#offset) of the target identifier
+- $ gopls references helper/helper.go:8:6
+- $ gopls references helper/helper.go:#53
+-
+-references-flags:
+- -d,-declaration
+- include the declaration of the specified identifier in the results
+diff -urN a/gopls/internal/lsp/cmd/usage/remote.hlp b/gopls/internal/lsp/cmd/usage/remote.hlp
+--- a/gopls/internal/lsp/cmd/usage/remote.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/remote.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-interact with the gopls daemon
+-
+-Usage:
+- gopls [flags] remote <subcommand> [arg]...
+-
+-Subcommand:
+- sessions print information about current gopls sessions
+- debug start the debug server
+diff -urN a/gopls/internal/lsp/cmd/usage/rename.hlp b/gopls/internal/lsp/cmd/usage/rename.hlp
+--- a/gopls/internal/lsp/cmd/usage/rename.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/rename.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+-rename selected identifier
+-
+-Usage:
+- gopls [flags] rename [rename-flags] <position> <name>
+-
+-Example:
+-
+- $ # 1-based location (:line:column or :#position) of the thing to change
+- $ gopls rename helper/helper.go:8:6 Foo
+- $ gopls rename helper/helper.go:#53 Foo
+-
+-rename-flags:
+- -d,-diff
+- display diffs instead of rewriting files
+- -preserve
+- preserve original files
+- -w,-write
+- write result to (source) file instead of stdout
+diff -urN a/gopls/internal/lsp/cmd/usage/semtok.hlp b/gopls/internal/lsp/cmd/usage/semtok.hlp
+--- a/gopls/internal/lsp/cmd/usage/semtok.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/semtok.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-show semantic tokens for the specified file
+-
+-Usage:
+- gopls [flags] semtok <filename>
+-
+-Example: show the semantic tokens for this file:
+-
+- $ gopls semtok internal/lsp/cmd/semtok.go
+diff -urN a/gopls/internal/lsp/cmd/usage/serve.hlp b/gopls/internal/lsp/cmd/usage/serve.hlp
+--- a/gopls/internal/lsp/cmd/usage/serve.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/serve.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,30 +0,0 @@
+-run a server for Go code using the Language Server Protocol
+-
+-Usage:
+- gopls [flags] serve [server-flags]
+- gopls [flags] [server-flags]
+-
+-The server communicates using JSONRPC2 on stdin and stdout, and is intended to be run directly as
+-a child of an editor process.
+-
+-server-flags:
+- -debug=string
+- serve debug information on the supplied address
+- -listen=string
+- address on which to listen for remote connections. If prefixed by 'unix;', the subsequent address is assumed to be a unix domain socket. Otherwise, TCP is used.
+- -listen.timeout=duration
+- when used with -listen, shut down the server when there are no connected clients for this duration
+- -logfile=string
+- filename to log to. if value is "auto", then logging to a default output file is enabled
+- -mode=string
+- no effect
+- -port=int
+- port on which to run gopls for debugging purposes
+- -remote.debug=string
+- when used with -remote=auto, the -debug value used to start the daemon
+- -remote.listen.timeout=duration
+- when used with -remote=auto, the -listen.timeout value used to start the daemon (default 1m0s)
+- -remote.logfile=string
+- when used with -remote=auto, the -logfile value used to start the daemon
+- -rpc.trace
+- print the full rpc trace in lsp inspector format
+diff -urN a/gopls/internal/lsp/cmd/usage/signature.hlp b/gopls/internal/lsp/cmd/usage/signature.hlp
+--- a/gopls/internal/lsp/cmd/usage/signature.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/signature.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-display selected identifier's signature
+-
+-Usage:
+- gopls [flags] signature <position>
+-
+-Example:
+-
+- $ # 1-indexed location (:line:column or :#offset) of the target identifier
+- $ gopls signature helper/helper.go:8:6
+- $ gopls signature helper/helper.go:#53
+diff -urN a/gopls/internal/lsp/cmd/usage/symbols.hlp b/gopls/internal/lsp/cmd/usage/symbols.hlp
+--- a/gopls/internal/lsp/cmd/usage/symbols.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/symbols.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-display selected file's symbols
+-
+-Usage:
+- gopls [flags] symbols <file>
+-
+-Example:
+- $ gopls symbols helper/helper.go
+diff -urN a/gopls/internal/lsp/cmd/usage/usage.hlp b/gopls/internal/lsp/cmd/usage/usage.hlp
+--- a/gopls/internal/lsp/cmd/usage/usage.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/usage.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,77 +0,0 @@
+-
+-gopls is a Go language server.
+-
+-It is typically used with an editor to provide language features. When no
+-command is specified, gopls will default to the 'serve' command. The language
+-features can also be accessed via the gopls command-line interface.
+-
+-Usage:
+- gopls help [<subject>]
+-
+-Command:
+-
+-Main
+- serve run a server for Go code using the Language Server Protocol
+- version print the gopls version information
+- bug report a bug in gopls
+- help print usage information for subcommands
+- api-json print json describing gopls API
+- licenses print licenses of included software
+-
+-Features
+- call_hierarchy display selected identifier's call hierarchy
+- check show diagnostic results for the specified file
+- definition show declaration of selected identifier
+- folding_ranges display selected file's folding ranges
+- format format the code according to the go standard
+- highlight display selected identifier's highlights
+- implementation display selected identifier's implementation
+- imports updates import statements
+- remote interact with the gopls daemon
+- inspect interact with the gopls daemon (deprecated: use 'remote')
+- links list links in a file
+- prepare_rename test validity of a rename operation at location
+- references display selected identifier's references
+- rename rename selected identifier
+- semtok show semantic tokens for the specified file
+- signature display selected identifier's signature
+- fix apply suggested fixes
+- symbols display selected file's symbols
+- workspace_symbol search symbols in workspace
+- vulncheck run experimental vulncheck analysis (experimental: under development)
+-
+-flags:
+- -debug=string
+- serve debug information on the supplied address
+- -listen=string
+- address on which to listen for remote connections. If prefixed by 'unix;', the subsequent address is assumed to be a unix domain socket. Otherwise, TCP is used.
+- -listen.timeout=duration
+- when used with -listen, shut down the server when there are no connected clients for this duration
+- -logfile=string
+- filename to log to. if value is "auto", then logging to a default output file is enabled
+- -mode=string
+- no effect
+- -ocagent=string
+- the address of the ocagent (e.g. http://localhost:55678), or off (default "off")
+- -port=int
+- port on which to run gopls for debugging purposes
+- -profile.cpu=string
+- write CPU profile to this file
+- -profile.mem=string
+- write memory profile to this file
+- -profile.trace=string
+- write trace log to this file
+- -remote=string
+- forward all commands to a remote lsp specified by this flag. With no special prefix, this is assumed to be a TCP address. If prefixed by 'unix;', the subsequent address is assumed to be a unix domain socket. If 'auto', or prefixed by 'auto;', the remote address is automatically resolved based on the executing environment.
+- -remote.debug=string
+- when used with -remote=auto, the -debug value used to start the daemon
+- -remote.listen.timeout=duration
+- when used with -remote=auto, the -listen.timeout value used to start the daemon (default 1m0s)
+- -remote.logfile=string
+- when used with -remote=auto, the -logfile value used to start the daemon
+- -rpc.trace
+- print the full rpc trace in lsp inspector format
+- -v,-verbose
+- verbose output
+- -vv,-veryverbose
+- very verbose output
+diff -urN a/gopls/internal/lsp/cmd/usage/version.hlp b/gopls/internal/lsp/cmd/usage/version.hlp
+--- a/gopls/internal/lsp/cmd/usage/version.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/version.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-print the gopls version information
+-
+-Usage:
+- gopls [flags] version
+- -json
+- outputs in json format.
+diff -urN a/gopls/internal/lsp/cmd/usage/vulncheck.hlp b/gopls/internal/lsp/cmd/usage/vulncheck.hlp
+--- a/gopls/internal/lsp/cmd/usage/vulncheck.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/vulncheck.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,17 +0,0 @@
+-run experimental vulncheck analysis (experimental: under development)
+-
+-Usage:
+- gopls [flags] vulncheck
+-
+- WARNING: this command is experimental.
+-
+- By default, the command outputs a JSON-encoded
+- golang.org/x/tools/gopls/internal/lsp/command.VulncheckResult
+- message.
+- Example:
+- $ gopls vulncheck <packages>
+-
+- -config
+- If true, the command reads a JSON-encoded package load configuration from stdin
+- -summary
+- If true, outputs a JSON-encoded govulnchecklib.Summary JSON
+diff -urN a/gopls/internal/lsp/cmd/usage/workspace_symbol.hlp b/gopls/internal/lsp/cmd/usage/workspace_symbol.hlp
+--- a/gopls/internal/lsp/cmd/usage/workspace_symbol.hlp 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/usage/workspace_symbol.hlp 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-search symbols in workspace
+-
+-Usage:
+- gopls [flags] workspace_symbol [workspace_symbol-flags] <query>
+-
+-Example:
+-
+- $ gopls workspace_symbol -matcher fuzzy 'wsymbols'
+-
+-workspace_symbol-flags:
+- -matcher=string
+- specifies the type of matcher: fuzzy, caseSensitive, or caseInsensitive.
+- The default is caseInsensitive.
+diff -urN a/gopls/internal/lsp/cmd/vulncheck.go b/gopls/internal/lsp/cmd/vulncheck.go
+--- a/gopls/internal/lsp/cmd/vulncheck.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/vulncheck.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,84 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "encoding/json"
+- "flag"
+- "fmt"
+- "os"
+-
+- "golang.org/x/tools/go/packages"
+- vulnchecklib "golang.org/x/tools/gopls/internal/vulncheck"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// vulncheck implements the vulncheck command.
+-type vulncheck struct {
+- Config bool `flag:"config" help:"If true, the command reads a JSON-encoded package load configuration from stdin"`
+- AsSummary bool `flag:"summary" help:"If true, outputs a JSON-encoded govulnchecklib.Summary JSON"`
+- app *Application
+-}
+-
+-type pkgLoadConfig struct {
+- // BuildFlags is a list of command-line flags to be passed through to
+- // the build system's query tool.
+- BuildFlags []string
+-
+- // If Tests is set, the loader includes related test packages.
+- Tests bool
+-}
+-
+-// TODO(hyangah): document pkgLoadConfig
+-
+-func (v *vulncheck) Name() string { return "vulncheck" }
+-func (v *vulncheck) Parent() string { return v.app.Name() }
+-func (v *vulncheck) Usage() string { return "" }
+-func (v *vulncheck) ShortHelp() string {
+- return "run experimental vulncheck analysis (experimental: under development)"
+-}
+-func (v *vulncheck) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), `
+- WARNING: this command is experimental.
+-
+- By default, the command outputs a JSON-encoded
+- golang.org/x/tools/gopls/internal/lsp/command.VulncheckResult
+- message.
+- Example:
+- $ gopls vulncheck <packages>
+-
+-`)
+- printFlagDefaults(f)
+-}
+-
+-func (v *vulncheck) Run(ctx context.Context, args ...string) error {
+- if vulnchecklib.Main == nil {
+- return fmt.Errorf("vulncheck command is available only in gopls compiled with go1.18 or newer")
+- }
+-
+- // TODO(hyangah): what's wrong with allowing multiple targets?
+- if len(args) > 1 {
+- return tool.CommandLineErrorf("vulncheck accepts at most one package pattern")
+- }
+- var cfg pkgLoadConfig
+- if v.Config {
+- if err := json.NewDecoder(os.Stdin).Decode(&cfg); err != nil {
+- return tool.CommandLineErrorf("failed to parse cfg: %v", err)
+- }
+- }
+- loadCfg := packages.Config{
+- Context: ctx,
+- Tests: cfg.Tests,
+- BuildFlags: cfg.BuildFlags,
+- // inherit the current process's cwd and env.
+- }
+-
+- if err := vulnchecklib.Main(loadCfg, args...); err != nil {
+- fmt.Fprintln(os.Stderr, err)
+- os.Exit(1)
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/cmd/workspace_symbol.go b/gopls/internal/lsp/cmd/workspace_symbol.go
+--- a/gopls/internal/lsp/cmd/workspace_symbol.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/cmd/workspace_symbol.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,85 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package cmd
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-// workspaceSymbol implements the workspace_symbol verb for gopls.
+-type workspaceSymbol struct {
+- Matcher string `flag:"matcher" help:"specifies the type of matcher: fuzzy, caseSensitive, or caseInsensitive.\nThe default is caseInsensitive."`
+-
+- app *Application
+-}
+-
+-func (r *workspaceSymbol) Name() string { return "workspace_symbol" }
+-func (r *workspaceSymbol) Parent() string { return r.app.Name() }
+-func (r *workspaceSymbol) Usage() string { return "[workspace_symbol-flags] <query>" }
+-func (r *workspaceSymbol) ShortHelp() string { return "search symbols in workspace" }
+-func (r *workspaceSymbol) DetailedHelp(f *flag.FlagSet) {
+- fmt.Fprint(f.Output(), `
+-Example:
+-
+- $ gopls workspace_symbol -matcher fuzzy 'wsymbols'
+-
+-workspace_symbol-flags:
+-`)
+- printFlagDefaults(f)
+-}
+-
+-func (r *workspaceSymbol) Run(ctx context.Context, args ...string) error {
+- if len(args) != 1 {
+- return tool.CommandLineErrorf("workspace_symbol expects 1 argument")
+- }
+-
+- opts := r.app.options
+- r.app.options = func(o *source.Options) {
+- if opts != nil {
+- opts(o)
+- }
+- switch r.Matcher {
+- case "fuzzy":
+- o.SymbolMatcher = source.SymbolFuzzy
+- case "caseSensitive":
+- o.SymbolMatcher = source.SymbolCaseSensitive
+- case "fastfuzzy":
+- o.SymbolMatcher = source.SymbolFastFuzzy
+- default:
+- o.SymbolMatcher = source.SymbolCaseInsensitive
+- }
+- }
+-
+- conn, err := r.app.connect(ctx)
+- if err != nil {
+- return err
+- }
+- defer conn.terminate(ctx)
+-
+- p := protocol.WorkspaceSymbolParams{
+- Query: args[0],
+- }
+-
+- symbols, err := conn.Symbol(ctx, &p)
+- if err != nil {
+- return err
+- }
+- for _, s := range symbols {
+- f := conn.openFile(ctx, fileURI(s.Location.URI))
+- span, err := f.mapper.LocationSpan(s.Location)
+- if err != nil {
+- return err
+- }
+- fmt.Printf("%s %s %s\n", span, s.Name, s.Kind)
+- }
+-
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/code_action.go b/gopls/internal/lsp/code_action.go
+--- a/gopls/internal/lsp/code_action.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/code_action.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,481 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+- "fmt"
+- "sort"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/mod"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+- "golang.org/x/tools/internal/imports"
+-)
+-
+-func (s *Server) codeAction(ctx context.Context, params *protocol.CodeActionParams) ([]protocol.CodeAction, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.UnknownKind)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+- uri := fh.URI()
+-
+- // Determine the supported actions for this file kind.
+- kind := snapshot.View().FileKind(fh)
+- supportedCodeActions, ok := snapshot.View().Options().SupportedCodeActions[kind]
+- if !ok {
+- return nil, fmt.Errorf("no supported code actions for %v file kind", kind)
+- }
+-
+- // The Only field of the context specifies which code actions the client wants.
+- // If Only is empty, assume that the client wants all of the non-explicit code actions.
+- var wanted map[protocol.CodeActionKind]bool
+-
+- // Explicit Code Actions are opt-in and shouldn't be returned to the client unless
+- // requested using Only.
+- // TODO: Add other CodeLenses such as GoGenerate, RegenerateCgo, etc..
+- explicit := map[protocol.CodeActionKind]bool{
+- protocol.GoTest: true,
+- }
+-
+- if len(params.Context.Only) == 0 {
+- wanted = supportedCodeActions
+- } else {
+- wanted = make(map[protocol.CodeActionKind]bool)
+- for _, only := range params.Context.Only {
+- for k, v := range supportedCodeActions {
+- if only == k || strings.HasPrefix(string(k), string(only)+".") {
+- wanted[k] = wanted[k] || v
+- }
+- }
+- wanted[only] = wanted[only] || explicit[only]
+- }
+- }
+- if len(supportedCodeActions) == 0 {
+- return nil, nil // not an error if there are none supported
+- }
+- if len(wanted) == 0 {
+- return nil, fmt.Errorf("no supported code action to execute for %s, wanted %v", uri, params.Context.Only)
+- }
+-
+- var codeActions []protocol.CodeAction
+- switch kind {
+- case source.Mod:
+- if diagnostics := params.Context.Diagnostics; len(diagnostics) > 0 {
+- diags, err := mod.ModDiagnostics(ctx, snapshot, fh)
+- if source.IsNonFatalGoModError(err) {
+- return nil, nil
+- }
+- if err != nil {
+- return nil, err
+- }
+- udiags, err := mod.ModUpgradeDiagnostics(ctx, snapshot, fh)
+- if err != nil {
+- return nil, err
+- }
+- quickFixes, err := codeActionsMatchingDiagnostics(ctx, snapshot, diagnostics, append(diags, udiags...))
+- if err != nil {
+- return nil, err
+- }
+- codeActions = append(codeActions, quickFixes...)
+-
+- vdiags, err := mod.ModVulnerabilityDiagnostics(ctx, snapshot, fh)
+- if err != nil {
+- return nil, err
+- }
+- // Group vulnerabilities by location and then limit which code actions we return
+- // for each location.
+- m := make(map[protocol.Range][]*source.Diagnostic)
+- for _, v := range vdiags {
+- m[v.Range] = append(m[v.Range], v)
+- }
+- for _, sdiags := range m {
+- quickFixes, err = codeActionsMatchingDiagnostics(ctx, snapshot, diagnostics, sdiags)
+- if err != nil {
+- return nil, err
+- }
+- quickFixes = mod.SelectUpgradeCodeActions(quickFixes)
+- codeActions = append(codeActions, quickFixes...)
+- }
+- }
+- case source.Go:
+- // Don't suggest fixes for generated files, since they are generally
+- // not useful and some editors may apply them automatically on save.
+- if source.IsGenerated(ctx, snapshot, uri) {
+- return nil, nil
+- }
+- diagnostics := params.Context.Diagnostics
+-
+- // First, process any missing imports and pair them with the
+- // diagnostics they fix.
+- if wantQuickFixes := wanted[protocol.QuickFix] && len(diagnostics) > 0; wantQuickFixes || wanted[protocol.SourceOrganizeImports] {
+- importEdits, importEditsPerFix, err := source.AllImportsFixes(ctx, snapshot, fh)
+- if err != nil {
+- event.Error(ctx, "imports fixes", err, tag.File.Of(fh.URI().Filename()))
+- }
+- // Separate this into a set of codeActions per diagnostic, where
+- // each action is the addition, removal, or renaming of one import.
+- if wantQuickFixes {
+- for _, importFix := range importEditsPerFix {
+- fixes := importDiagnostics(importFix.Fix, diagnostics)
+- if len(fixes) == 0 {
+- continue
+- }
+- codeActions = append(codeActions, protocol.CodeAction{
+- Title: importFixTitle(importFix.Fix),
+- Kind: protocol.QuickFix,
+- Edit: &protocol.WorkspaceEdit{
+- DocumentChanges: documentChanges(fh, importFix.Edits),
+- },
+- Diagnostics: fixes,
+- })
+- }
+- }
+-
+- // Send all of the import edits as one code action if the file is
+- // being organized.
+- if wanted[protocol.SourceOrganizeImports] && len(importEdits) > 0 {
+- codeActions = append(codeActions, protocol.CodeAction{
+- Title: "Organize Imports",
+- Kind: protocol.SourceOrganizeImports,
+- Edit: &protocol.WorkspaceEdit{
+- DocumentChanges: documentChanges(fh, importEdits),
+- },
+- })
+- }
+- }
+- if ctx.Err() != nil {
+- return nil, ctx.Err()
+- }
+-
+- // Type-check the package and also run analysis,
+- // then combine their diagnostics.
+- pkg, _, err := source.PackageForFile(ctx, snapshot, fh.URI(), source.NarrowestPackage)
+- if err != nil {
+- return nil, err
+- }
+- pkgDiags, err := pkg.DiagnosticsForFile(ctx, snapshot, uri)
+- if err != nil {
+- return nil, err
+- }
+- analysisDiags, err := source.Analyze(ctx, snapshot, pkg.Metadata().ID, true)
+- if err != nil {
+- return nil, err
+- }
+- var fileDiags []*source.Diagnostic
+- source.CombineDiagnostics(pkgDiags, analysisDiags[uri], &fileDiags, &fileDiags)
+-
+- // Split diagnostics into fixes, which must match incoming diagnostics,
+- // and non-fixes, which must match the requested range. Build actions
+- // for all of them.
+- var fixDiags, nonFixDiags []*source.Diagnostic
+- for _, d := range fileDiags {
+- if len(d.SuggestedFixes) == 0 {
+- continue
+- }
+- var isFix bool
+- for _, fix := range d.SuggestedFixes {
+- if fix.ActionKind == protocol.QuickFix || fix.ActionKind == protocol.SourceFixAll {
+- isFix = true
+- break
+- }
+- }
+- if isFix {
+- fixDiags = append(fixDiags, d)
+- } else {
+- nonFixDiags = append(nonFixDiags, d)
+- }
+- }
+-
+- fixActions, err := codeActionsMatchingDiagnostics(ctx, snapshot, diagnostics, fixDiags)
+- if err != nil {
+- return nil, err
+- }
+- codeActions = append(codeActions, fixActions...)
+-
+- for _, nonfix := range nonFixDiags {
+- // For now, only show diagnostics for matching lines. Maybe we should
+- // alter this behavior in the future, depending on the user experience.
+- if !protocol.Intersect(nonfix.Range, params.Range) {
+- continue
+- }
+- actions, err := codeActionsForDiagnostic(ctx, snapshot, nonfix, nil)
+- if err != nil {
+- return nil, err
+- }
+- codeActions = append(codeActions, actions...)
+- }
+-
+- if wanted[protocol.RefactorExtract] {
+- fixes, err := extractionFixes(ctx, snapshot, uri, params.Range)
+- if err != nil {
+- return nil, err
+- }
+- codeActions = append(codeActions, fixes...)
+- }
+-
+- if wanted[protocol.GoTest] {
+- fixes, err := goTest(ctx, snapshot, uri, params.Range)
+- if err != nil {
+- return nil, err
+- }
+- codeActions = append(codeActions, fixes...)
+- }
+-
+- default:
+- // Unsupported file kind for a code action.
+- return nil, nil
+- }
+-
+- var filtered []protocol.CodeAction
+- for _, action := range codeActions {
+- if wanted[action.Kind] {
+- filtered = append(filtered, action)
+- }
+- }
+- return filtered, nil
+-}
+-
+-func (s *Server) getSupportedCodeActions() []protocol.CodeActionKind {
+- allCodeActionKinds := make(map[protocol.CodeActionKind]struct{})
+- for _, kinds := range s.session.Options().SupportedCodeActions {
+- for kind := range kinds {
+- allCodeActionKinds[kind] = struct{}{}
+- }
+- }
+- var result []protocol.CodeActionKind
+- for kind := range allCodeActionKinds {
+- result = append(result, kind)
+- }
+- sort.Slice(result, func(i, j int) bool {
+- return result[i] < result[j]
+- })
+- return result
+-}
+-
+-func importFixTitle(fix *imports.ImportFix) string {
+- var str string
+- switch fix.FixType {
+- case imports.AddImport:
+- str = fmt.Sprintf("Add import: %s %q", fix.StmtInfo.Name, fix.StmtInfo.ImportPath)
+- case imports.DeleteImport:
+- str = fmt.Sprintf("Delete import: %s %q", fix.StmtInfo.Name, fix.StmtInfo.ImportPath)
+- case imports.SetImportName:
+- str = fmt.Sprintf("Rename import: %s %q", fix.StmtInfo.Name, fix.StmtInfo.ImportPath)
+- }
+- return str
+-}
+-
+-func importDiagnostics(fix *imports.ImportFix, diagnostics []protocol.Diagnostic) (results []protocol.Diagnostic) {
+- for _, diagnostic := range diagnostics {
+- switch {
+- // "undeclared name: X" may be an unresolved import.
+- case strings.HasPrefix(diagnostic.Message, "undeclared name: "):
+- ident := strings.TrimPrefix(diagnostic.Message, "undeclared name: ")
+- if ident == fix.IdentName {
+- results = append(results, diagnostic)
+- }
+- // "undefined: X" may be an unresolved import at Go 1.20+.
+- case strings.HasPrefix(diagnostic.Message, "undefined: "):
+- ident := strings.TrimPrefix(diagnostic.Message, "undefined: ")
+- if ident == fix.IdentName {
+- results = append(results, diagnostic)
+- }
+- // "could not import: X" may be an invalid import.
+- case strings.HasPrefix(diagnostic.Message, "could not import: "):
+- ident := strings.TrimPrefix(diagnostic.Message, "could not import: ")
+- if ident == fix.IdentName {
+- results = append(results, diagnostic)
+- }
+- // "X imported but not used" is an unused import.
+- // "X imported but not used as Y" is an unused import.
+- case strings.Contains(diagnostic.Message, " imported but not used"):
+- idx := strings.Index(diagnostic.Message, " imported but not used")
+- importPath := diagnostic.Message[:idx]
+- if importPath == fmt.Sprintf("%q", fix.StmtInfo.ImportPath) {
+- results = append(results, diagnostic)
+- }
+- }
+- }
+- return results
+-}
+-
+-func extractionFixes(ctx context.Context, snapshot source.Snapshot, uri span.URI, rng protocol.Range) ([]protocol.CodeAction, error) {
+- if rng.Start == rng.End {
+- return nil, nil
+- }
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return nil, err
+- }
+- pgf, err := snapshot.ParseGo(ctx, fh, source.ParseFull)
+- if err != nil {
+- return nil, fmt.Errorf("getting file for Identifier: %w", err)
+- }
+- start, end, err := pgf.RangePos(rng)
+- if err != nil {
+- return nil, err
+- }
+- puri := protocol.URIFromSpanURI(uri)
+- var commands []protocol.Command
+- if _, ok, methodOk, _ := source.CanExtractFunction(pgf.Tok, start, end, pgf.Src, pgf.File); ok {
+- cmd, err := command.NewApplyFixCommand("Extract function", command.ApplyFixArgs{
+- URI: puri,
+- Fix: source.ExtractFunction,
+- Range: rng,
+- })
+- if err != nil {
+- return nil, err
+- }
+- commands = append(commands, cmd)
+- if methodOk {
+- cmd, err := command.NewApplyFixCommand("Extract method", command.ApplyFixArgs{
+- URI: puri,
+- Fix: source.ExtractMethod,
+- Range: rng,
+- })
+- if err != nil {
+- return nil, err
+- }
+- commands = append(commands, cmd)
+- }
+- }
+- if _, _, ok, _ := source.CanExtractVariable(start, end, pgf.File); ok {
+- cmd, err := command.NewApplyFixCommand("Extract variable", command.ApplyFixArgs{
+- URI: puri,
+- Fix: source.ExtractVariable,
+- Range: rng,
+- })
+- if err != nil {
+- return nil, err
+- }
+- commands = append(commands, cmd)
+- }
+- var actions []protocol.CodeAction
+- for i := range commands {
+- actions = append(actions, protocol.CodeAction{
+- Title: commands[i].Title,
+- Kind: protocol.RefactorExtract,
+- Command: &commands[i],
+- })
+- }
+- return actions, nil
+-}
+-
+-func documentChanges(fh source.FileHandle, edits []protocol.TextEdit) []protocol.DocumentChanges {
+- return []protocol.DocumentChanges{
+- {
+- TextDocumentEdit: &protocol.TextDocumentEdit{
+- TextDocument: protocol.OptionalVersionedTextDocumentIdentifier{
+- Version: fh.Version(),
+- TextDocumentIdentifier: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(fh.URI()),
+- },
+- },
+- Edits: edits,
+- },
+- },
+- }
+-}
+-
+-func codeActionsMatchingDiagnostics(ctx context.Context, snapshot source.Snapshot, pdiags []protocol.Diagnostic, sdiags []*source.Diagnostic) ([]protocol.CodeAction, error) {
+- var actions []protocol.CodeAction
+- for _, sd := range sdiags {
+- var diag *protocol.Diagnostic
+- for _, pd := range pdiags {
+- if sameDiagnostic(pd, sd) {
+- diag = &pd
+- break
+- }
+- }
+- if diag == nil {
+- continue
+- }
+- diagActions, err := codeActionsForDiagnostic(ctx, snapshot, sd, diag)
+- if err != nil {
+- return nil, err
+- }
+- actions = append(actions, diagActions...)
+-
+- }
+- return actions, nil
+-}
+-
+-func codeActionsForDiagnostic(ctx context.Context, snapshot source.Snapshot, sd *source.Diagnostic, pd *protocol.Diagnostic) ([]protocol.CodeAction, error) {
+- var actions []protocol.CodeAction
+- for _, fix := range sd.SuggestedFixes {
+- var changes []protocol.DocumentChanges
+- for uri, edits := range fix.Edits {
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return nil, err
+- }
+- changes = append(changes, documentChanges(fh, edits)...)
+- }
+- action := protocol.CodeAction{
+- Title: fix.Title,
+- Kind: fix.ActionKind,
+- Edit: &protocol.WorkspaceEdit{
+- DocumentChanges: changes,
+- },
+- Command: fix.Command,
+- }
+- if pd != nil {
+- action.Diagnostics = []protocol.Diagnostic{*pd}
+- }
+- actions = append(actions, action)
+- }
+- return actions, nil
+-}
+-
+-func sameDiagnostic(pd protocol.Diagnostic, sd *source.Diagnostic) bool {
+- return pd.Message == strings.TrimSpace(sd.Message) && // extra space may have been trimmed when converting to protocol.Diagnostic
+- protocol.CompareRange(pd.Range, sd.Range) == 0 && pd.Source == string(sd.Source)
+-}
+-
+-func goTest(ctx context.Context, snapshot source.Snapshot, uri span.URI, rng protocol.Range) ([]protocol.CodeAction, error) {
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return nil, err
+- }
+- fns, err := source.TestsAndBenchmarks(ctx, snapshot, fh)
+- if err != nil {
+- return nil, err
+- }
+-
+- var tests, benchmarks []string
+- for _, fn := range fns.Tests {
+- if !protocol.Intersect(fn.Rng, rng) {
+- continue
+- }
+- tests = append(tests, fn.Name)
+- }
+- for _, fn := range fns.Benchmarks {
+- if !protocol.Intersect(fn.Rng, rng) {
+- continue
+- }
+- benchmarks = append(benchmarks, fn.Name)
+- }
+-
+- if len(tests) == 0 && len(benchmarks) == 0 {
+- return nil, nil
+- }
+-
+- cmd, err := command.NewTestCommand("Run tests and benchmarks", protocol.URIFromSpanURI(uri), tests, benchmarks)
+- if err != nil {
+- return nil, err
+- }
+- return []protocol.CodeAction{{
+- Title: cmd.Title,
+- Kind: protocol.GoTest,
+- Command: &cmd,
+- }}, nil
+-}
+diff -urN a/gopls/internal/lsp/code_lens.go b/gopls/internal/lsp/code_lens.go
+--- a/gopls/internal/lsp/code_lens.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/code_lens.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,57 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+- "fmt"
+- "sort"
+-
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/mod"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-func (s *Server) codeLens(ctx context.Context, params *protocol.CodeLensParams) ([]protocol.CodeLens, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.UnknownKind)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+- var lenses map[command.Command]source.LensFunc
+- switch snapshot.View().FileKind(fh) {
+- case source.Mod:
+- lenses = mod.LensFuncs()
+- case source.Go:
+- lenses = source.LensFuncs()
+- default:
+- // Unsupported file kind for a code lens.
+- return nil, nil
+- }
+- var result []protocol.CodeLens
+- for cmd, lf := range lenses {
+- if !snapshot.View().Options().Codelenses[string(cmd)] {
+- continue
+- }
+- added, err := lf(ctx, snapshot, fh)
+- // Code lens is called on every keystroke, so we should just operate in
+- // a best-effort mode, ignoring errors.
+- if err != nil {
+- event.Error(ctx, fmt.Sprintf("code lens %s failed", cmd), err)
+- continue
+- }
+- result = append(result, added...)
+- }
+- sort.Slice(result, func(i, j int) bool {
+- a, b := result[i], result[j]
+- if cmp := protocol.CompareRange(a.Range, b.Range); cmp != 0 {
+- return cmp < 0
+- }
+- return a.Command.Command < b.Command.Command
+- })
+- return result, nil
+-}
+diff -urN a/gopls/internal/lsp/command/command_gen.go b/gopls/internal/lsp/command/command_gen.go
+--- a/gopls/internal/lsp/command/command_gen.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/command/command_gen.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,509 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Don't include this file during code generation, or it will break the build
+-// if existing interface methods have been modified.
+-//go:build !generate
+-// +build !generate
+-
+-package command
+-
+-// Code generated by generate.go. DO NOT EDIT.
+-
+-import (
+- "context"
+- "fmt"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-const (
+- AddDependency Command = "add_dependency"
+- AddImport Command = "add_import"
+- ApplyFix Command = "apply_fix"
+- CheckUpgrades Command = "check_upgrades"
+- EditGoDirective Command = "edit_go_directive"
+- FetchVulncheckResult Command = "fetch_vulncheck_result"
+- GCDetails Command = "gc_details"
+- Generate Command = "generate"
+- GoGetPackage Command = "go_get_package"
+- ListImports Command = "list_imports"
+- ListKnownPackages Command = "list_known_packages"
+- MemStats Command = "mem_stats"
+- RegenerateCgo Command = "regenerate_cgo"
+- RemoveDependency Command = "remove_dependency"
+- ResetGoModDiagnostics Command = "reset_go_mod_diagnostics"
+- RunGovulncheck Command = "run_govulncheck"
+- RunTests Command = "run_tests"
+- StartDebugging Command = "start_debugging"
+- Test Command = "test"
+- Tidy Command = "tidy"
+- ToggleGCDetails Command = "toggle_gc_details"
+- UpdateGoSum Command = "update_go_sum"
+- UpgradeDependency Command = "upgrade_dependency"
+- Vendor Command = "vendor"
+-)
+-
+-var Commands = []Command{
+- AddDependency,
+- AddImport,
+- ApplyFix,
+- CheckUpgrades,
+- EditGoDirective,
+- FetchVulncheckResult,
+- GCDetails,
+- Generate,
+- GoGetPackage,
+- ListImports,
+- ListKnownPackages,
+- MemStats,
+- RegenerateCgo,
+- RemoveDependency,
+- ResetGoModDiagnostics,
+- RunGovulncheck,
+- RunTests,
+- StartDebugging,
+- Test,
+- Tidy,
+- ToggleGCDetails,
+- UpdateGoSum,
+- UpgradeDependency,
+- Vendor,
+-}
+-
+-func Dispatch(ctx context.Context, params *protocol.ExecuteCommandParams, s Interface) (interface{}, error) {
+- switch params.Command {
+- case "gopls.add_dependency":
+- var a0 DependencyArgs
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.AddDependency(ctx, a0)
+- case "gopls.add_import":
+- var a0 AddImportArgs
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.AddImport(ctx, a0)
+- case "gopls.apply_fix":
+- var a0 ApplyFixArgs
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.ApplyFix(ctx, a0)
+- case "gopls.check_upgrades":
+- var a0 CheckUpgradesArgs
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.CheckUpgrades(ctx, a0)
+- case "gopls.edit_go_directive":
+- var a0 EditGoDirectiveArgs
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.EditGoDirective(ctx, a0)
+- case "gopls.fetch_vulncheck_result":
+- var a0 URIArg
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return s.FetchVulncheckResult(ctx, a0)
+- case "gopls.gc_details":
+- var a0 protocol.DocumentURI
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.GCDetails(ctx, a0)
+- case "gopls.generate":
+- var a0 GenerateArgs
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.Generate(ctx, a0)
+- case "gopls.go_get_package":
+- var a0 GoGetPackageArgs
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.GoGetPackage(ctx, a0)
+- case "gopls.list_imports":
+- var a0 URIArg
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return s.ListImports(ctx, a0)
+- case "gopls.list_known_packages":
+- var a0 URIArg
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return s.ListKnownPackages(ctx, a0)
+- case "gopls.mem_stats":
+- return s.MemStats(ctx)
+- case "gopls.regenerate_cgo":
+- var a0 URIArg
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.RegenerateCgo(ctx, a0)
+- case "gopls.remove_dependency":
+- var a0 RemoveDependencyArgs
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.RemoveDependency(ctx, a0)
+- case "gopls.reset_go_mod_diagnostics":
+- var a0 ResetGoModDiagnosticsArgs
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.ResetGoModDiagnostics(ctx, a0)
+- case "gopls.run_govulncheck":
+- var a0 VulncheckArgs
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return s.RunGovulncheck(ctx, a0)
+- case "gopls.run_tests":
+- var a0 RunTestsArgs
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.RunTests(ctx, a0)
+- case "gopls.start_debugging":
+- var a0 DebuggingArgs
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return s.StartDebugging(ctx, a0)
+- case "gopls.test":
+- var a0 protocol.DocumentURI
+- var a1 []string
+- var a2 []string
+- if err := UnmarshalArgs(params.Arguments, &a0, &a1, &a2); err != nil {
+- return nil, err
+- }
+- return nil, s.Test(ctx, a0, a1, a2)
+- case "gopls.tidy":
+- var a0 URIArgs
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.Tidy(ctx, a0)
+- case "gopls.toggle_gc_details":
+- var a0 URIArg
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.ToggleGCDetails(ctx, a0)
+- case "gopls.update_go_sum":
+- var a0 URIArgs
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.UpdateGoSum(ctx, a0)
+- case "gopls.upgrade_dependency":
+- var a0 DependencyArgs
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.UpgradeDependency(ctx, a0)
+- case "gopls.vendor":
+- var a0 URIArg
+- if err := UnmarshalArgs(params.Arguments, &a0); err != nil {
+- return nil, err
+- }
+- return nil, s.Vendor(ctx, a0)
+- }
+- return nil, fmt.Errorf("unsupported command %q", params.Command)
+-}
+-
+-func NewAddDependencyCommand(title string, a0 DependencyArgs) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.add_dependency",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewAddImportCommand(title string, a0 AddImportArgs) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.add_import",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewApplyFixCommand(title string, a0 ApplyFixArgs) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.apply_fix",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewCheckUpgradesCommand(title string, a0 CheckUpgradesArgs) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.check_upgrades",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewEditGoDirectiveCommand(title string, a0 EditGoDirectiveArgs) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.edit_go_directive",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewFetchVulncheckResultCommand(title string, a0 URIArg) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.fetch_vulncheck_result",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewGCDetailsCommand(title string, a0 protocol.DocumentURI) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.gc_details",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewGenerateCommand(title string, a0 GenerateArgs) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.generate",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewGoGetPackageCommand(title string, a0 GoGetPackageArgs) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.go_get_package",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewListImportsCommand(title string, a0 URIArg) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.list_imports",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewListKnownPackagesCommand(title string, a0 URIArg) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.list_known_packages",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewMemStatsCommand(title string) (protocol.Command, error) {
+- args, err := MarshalArgs()
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.mem_stats",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewRegenerateCgoCommand(title string, a0 URIArg) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.regenerate_cgo",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewRemoveDependencyCommand(title string, a0 RemoveDependencyArgs) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.remove_dependency",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewResetGoModDiagnosticsCommand(title string, a0 ResetGoModDiagnosticsArgs) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.reset_go_mod_diagnostics",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewRunGovulncheckCommand(title string, a0 VulncheckArgs) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.run_govulncheck",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewRunTestsCommand(title string, a0 RunTestsArgs) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.run_tests",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewStartDebuggingCommand(title string, a0 DebuggingArgs) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.start_debugging",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewTestCommand(title string, a0 protocol.DocumentURI, a1 []string, a2 []string) (protocol.Command, error) {
+- args, err := MarshalArgs(a0, a1, a2)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.test",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewTidyCommand(title string, a0 URIArgs) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.tidy",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewToggleGCDetailsCommand(title string, a0 URIArg) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.toggle_gc_details",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewUpdateGoSumCommand(title string, a0 URIArgs) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.update_go_sum",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewUpgradeDependencyCommand(title string, a0 DependencyArgs) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.upgrade_dependency",
+- Arguments: args,
+- }, nil
+-}
+-
+-func NewVendorCommand(title string, a0 URIArg) (protocol.Command, error) {
+- args, err := MarshalArgs(a0)
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "gopls.vendor",
+- Arguments: args,
+- }, nil
+-}
+diff -urN a/gopls/internal/lsp/command/commandmeta/meta.go b/gopls/internal/lsp/command/commandmeta/meta.go
+--- a/gopls/internal/lsp/command/commandmeta/meta.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/command/commandmeta/meta.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,259 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package commandmeta provides metadata about LSP commands, by analyzing the
+-// command.Interface type.
+-package commandmeta
+-
+-import (
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "reflect"
+- "strings"
+- "unicode"
+-
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/go/packages"
+- "golang.org/x/tools/gopls/internal/lsp/command"
+-)
+-
+-type Command struct {
+- MethodName string
+- Name string
+- // TODO(rFindley): I think Title can actually be eliminated. In all cases
+- // where we use it, there is probably a more appropriate contextual title.
+- Title string
+- Doc string
+- Args []*Field
+- Result *Field
+-}
+-
+-func (c *Command) ID() string {
+- return command.ID(c.Name)
+-}
+-
+-type Field struct {
+- Name string
+- Doc string
+- JSONTag string
+- Type types.Type
+- FieldMod string
+- // In some circumstances, we may want to recursively load additional field
+- // descriptors for fields of struct types, documenting their internals.
+- Fields []*Field
+-}
+-
+-func Load() (*packages.Package, []*Command, error) {
+- pkgs, err := packages.Load(
+- &packages.Config{
+- Mode: packages.NeedTypes | packages.NeedTypesInfo | packages.NeedSyntax | packages.NeedImports | packages.NeedDeps,
+- BuildFlags: []string{"-tags=generate"},
+- },
+- "golang.org/x/tools/gopls/internal/lsp/command",
+- )
+- if err != nil {
+- return nil, nil, fmt.Errorf("packages.Load: %v", err)
+- }
+- pkg := pkgs[0]
+- if len(pkg.Errors) > 0 {
+- return pkg, nil, pkg.Errors[0]
+- }
+-
+- // For a bit of type safety, use reflection to get the interface name within
+- // the package scope.
+- it := reflect.TypeOf((*command.Interface)(nil)).Elem()
+- obj := pkg.Types.Scope().Lookup(it.Name()).Type().Underlying().(*types.Interface)
+-
+- // Load command metadata corresponding to each interface method.
+- var commands []*Command
+- loader := fieldLoader{make(map[types.Object]*Field)}
+- for i := 0; i < obj.NumMethods(); i++ {
+- m := obj.Method(i)
+- c, err := loader.loadMethod(pkg, m)
+- if err != nil {
+- return nil, nil, fmt.Errorf("loading %s: %v", m.Name(), err)
+- }
+- commands = append(commands, c)
+- }
+- return pkg, commands, nil
+-}
+-
+-// fieldLoader loads field information, memoizing results to prevent infinite
+-// recursion.
+-type fieldLoader struct {
+- loaded map[types.Object]*Field
+-}
+-
+-var universeError = types.Universe.Lookup("error").Type()
+-
+-func (l *fieldLoader) loadMethod(pkg *packages.Package, m *types.Func) (*Command, error) {
+- node, err := findField(pkg, m.Pos())
+- if err != nil {
+- return nil, err
+- }
+- title, doc := splitDoc(node.Doc.Text())
+- c := &Command{
+- MethodName: m.Name(),
+- Name: lspName(m.Name()),
+- Doc: doc,
+- Title: title,
+- }
+- sig := m.Type().Underlying().(*types.Signature)
+- rlen := sig.Results().Len()
+- if rlen > 2 || rlen == 0 {
+- return nil, fmt.Errorf("must have 1 or 2 returns, got %d", rlen)
+- }
+- finalResult := sig.Results().At(rlen - 1)
+- if !types.Identical(finalResult.Type(), universeError) {
+- return nil, fmt.Errorf("final return must be error")
+- }
+- if rlen == 2 {
+- obj := sig.Results().At(0)
+- c.Result, err = l.loadField(pkg, obj, "", "")
+- if err != nil {
+- return nil, err
+- }
+- }
+- for i := 0; i < sig.Params().Len(); i++ {
+- obj := sig.Params().At(i)
+- fld, err := l.loadField(pkg, obj, "", "")
+- if err != nil {
+- return nil, err
+- }
+- if i == 0 {
+- // Lazy check that the first argument is a context. We could relax this,
+- // but then the generated code gets more complicated.
+- if named, ok := fld.Type.(*types.Named); !ok || named.Obj().Name() != "Context" || named.Obj().Pkg().Path() != "context" {
+- return nil, fmt.Errorf("first method parameter must be context.Context")
+- }
+- // Skip the context argument, as it is implied.
+- continue
+- }
+- c.Args = append(c.Args, fld)
+- }
+- return c, nil
+-}
+-
+-func (l *fieldLoader) loadField(pkg *packages.Package, obj *types.Var, doc, tag string) (*Field, error) {
+- if existing, ok := l.loaded[obj]; ok {
+- return existing, nil
+- }
+- fld := &Field{
+- Name: obj.Name(),
+- Doc: strings.TrimSpace(doc),
+- Type: obj.Type(),
+- JSONTag: reflect.StructTag(tag).Get("json"),
+- }
+- under := fld.Type.Underlying()
+- // Quick-and-dirty handling for various underlying types.
+- switch p := under.(type) {
+- case *types.Pointer:
+- under = p.Elem().Underlying()
+- case *types.Array:
+- under = p.Elem().Underlying()
+- fld.FieldMod = fmt.Sprintf("[%d]", p.Len())
+- case *types.Slice:
+- under = p.Elem().Underlying()
+- fld.FieldMod = "[]"
+- }
+-
+- if s, ok := under.(*types.Struct); ok {
+- for i := 0; i < s.NumFields(); i++ {
+- obj2 := s.Field(i)
+- pkg2 := pkg
+- if obj2.Pkg() != pkg2.Types {
+- pkg2, ok = pkg.Imports[obj2.Pkg().Path()]
+- if !ok {
+- return nil, fmt.Errorf("missing import for %q: %q", pkg.ID, obj2.Pkg().Path())
+- }
+- }
+- node, err := findField(pkg2, obj2.Pos())
+- if err != nil {
+- return nil, err
+- }
+- tag := s.Tag(i)
+- structField, err := l.loadField(pkg2, obj2, node.Doc.Text(), tag)
+- if err != nil {
+- return nil, err
+- }
+- fld.Fields = append(fld.Fields, structField)
+- }
+- }
+- return fld, nil
+-}
+-
+-// splitDoc parses a command doc string to separate the title from normal
+-// documentation.
+-//
+-// The doc comment should be of the form: "MethodName: Title\nDocumentation"
+-func splitDoc(text string) (title, doc string) {
+- docParts := strings.SplitN(text, "\n", 2)
+- titleParts := strings.SplitN(docParts[0], ":", 2)
+- if len(titleParts) > 1 {
+- title = strings.TrimSpace(titleParts[1])
+- }
+- if len(docParts) > 1 {
+- doc = strings.TrimSpace(docParts[1])
+- }
+- return title, doc
+-}
+-
+-// lspName returns the normalized command name to use in the LSP.
+-func lspName(methodName string) string {
+- words := splitCamel(methodName)
+- for i := range words {
+- words[i] = strings.ToLower(words[i])
+- }
+- return strings.Join(words, "_")
+-}
+-
+-// splitCamel splits s into words, according to camel-case word boundaries.
+-// Initialisms are grouped as a single word.
+-//
+-// For example:
+-//
+-// "RunTests" -> []string{"Run", "Tests"}
+-// "GCDetails" -> []string{"GC", "Details"}
+-func splitCamel(s string) []string {
+- var words []string
+- for len(s) > 0 {
+- last := strings.LastIndexFunc(s, unicode.IsUpper)
+- if last < 0 {
+- last = 0
+- }
+- if last == len(s)-1 {
+- // Group initialisms as a single word.
+- last = 1 + strings.LastIndexFunc(s[:last], func(r rune) bool { return !unicode.IsUpper(r) })
+- }
+- words = append(words, s[last:])
+- s = s[:last]
+- }
+- for i := 0; i < len(words)/2; i++ {
+- j := len(words) - i - 1
+- words[i], words[j] = words[j], words[i]
+- }
+- return words
+-}
+-
+-// findField finds the struct field or interface method positioned at pos,
+-// within the AST.
+-func findField(pkg *packages.Package, pos token.Pos) (*ast.Field, error) {
+- fset := pkg.Fset
+- var file *ast.File
+- for _, f := range pkg.Syntax {
+- if fset.File(f.Pos()).Name() == fset.File(pos).Name() {
+- file = f
+- break
+- }
+- }
+- if file == nil {
+- return nil, fmt.Errorf("no file for pos %v", pos)
+- }
+- path, _ := astutil.PathEnclosingInterval(file, pos, pos)
+- // This is fragile, but in the cases we care about, the field will be in
+- // path[1].
+- return path[1].(*ast.Field), nil
+-}
+diff -urN a/gopls/internal/lsp/command/gen/gen.go b/gopls/internal/lsp/command/gen/gen.go
+--- a/gopls/internal/lsp/command/gen/gen.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/command/gen/gen.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,155 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package gen is used to generate command bindings from the gopls command
+-// interface.
+-package gen
+-
+-import (
+- "bytes"
+- "fmt"
+- "go/types"
+- "text/template"
+-
+- "golang.org/x/tools/internal/imports"
+- "golang.org/x/tools/gopls/internal/lsp/command/commandmeta"
+-)
+-
+-const src = `// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Don't include this file during code generation, or it will break the build
+-// if existing interface methods have been modified.
+-//go:build !generate
+-// +build !generate
+-
+-package command
+-
+-// Code generated by generate.go. DO NOT EDIT.
+-
+-import (
+- {{range $k, $v := .Imports -}}
+- "{{$k}}"
+- {{end}}
+-)
+-
+-const (
+-{{- range .Commands}}
+- {{.MethodName}} Command = "{{.Name}}"
+-{{- end}}
+-)
+-
+-var Commands = []Command {
+-{{- range .Commands}}
+- {{.MethodName}},
+-{{- end}}
+-}
+-
+-func Dispatch(ctx context.Context, params *protocol.ExecuteCommandParams, s Interface) (interface{}, error) {
+- switch params.Command {
+- {{- range .Commands}}
+- case "{{.ID}}":
+- {{- if .Args -}}
+- {{- range $i, $v := .Args}}
+- var a{{$i}} {{typeString $v.Type}}
+- {{- end}}
+- if err := UnmarshalArgs(params.Arguments{{range $i, $v := .Args}}, &a{{$i}}{{end}}); err != nil {
+- return nil, err
+- }
+- {{end -}}
+- return {{if not .Result}}nil, {{end}}s.{{.MethodName}}(ctx{{range $i, $v := .Args}}, a{{$i}}{{end}})
+- {{- end}}
+- }
+- return nil, fmt.Errorf("unsupported command %q", params.Command)
+-}
+-{{- range .Commands}}
+-
+-func New{{.MethodName}}Command(title string, {{range $i, $v := .Args}}{{if $i}}, {{end}}a{{$i}} {{typeString $v.Type}}{{end}}) (protocol.Command, error) {
+- args, err := MarshalArgs({{range $i, $v := .Args}}{{if $i}}, {{end}}a{{$i}}{{end}})
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return protocol.Command{
+- Title: title,
+- Command: "{{.ID}}",
+- Arguments: args,
+- }, nil
+-}
+-{{end}}
+-`
+-
+-type data struct {
+- Imports map[string]bool
+- Commands []*commandmeta.Command
+-}
+-
+-func Generate() ([]byte, error) {
+- pkg, cmds, err := commandmeta.Load()
+- if err != nil {
+- return nil, fmt.Errorf("loading command data: %v", err)
+- }
+- qf := func(p *types.Package) string {
+- if p == pkg.Types {
+- return ""
+- }
+- return p.Name()
+- }
+- tmpl, err := template.New("").Funcs(template.FuncMap{
+- "typeString": func(t types.Type) string {
+- return types.TypeString(t, qf)
+- },
+- }).Parse(src)
+- if err != nil {
+- return nil, err
+- }
+- d := data{
+- Commands: cmds,
+- Imports: map[string]bool{
+- "context": true,
+- "fmt": true,
+- "golang.org/x/tools/gopls/internal/lsp/protocol": true,
+- },
+- }
+- const thispkg = "golang.org/x/tools/gopls/internal/lsp/command"
+- for _, c := range d.Commands {
+- for _, arg := range c.Args {
+- pth := pkgPath(arg.Type)
+- if pth != "" && pth != thispkg {
+- d.Imports[pth] = true
+- }
+- }
+- if c.Result != nil {
+- pth := pkgPath(c.Result.Type)
+- if pth != "" && pth != thispkg {
+- d.Imports[pth] = true
+- }
+- }
+- }
+-
+- var buf bytes.Buffer
+- if err := tmpl.Execute(&buf, d); err != nil {
+- return nil, fmt.Errorf("executing: %v", err)
+- }
+-
+- opts := &imports.Options{
+- AllErrors: true,
+- FormatOnly: true,
+- Comments: true,
+- }
+- content, err := imports.Process("", buf.Bytes(), opts)
+- if err != nil {
+- return nil, fmt.Errorf("goimports: %v", err)
+- }
+- return content, nil
+-}
+-
+-func pkgPath(t types.Type) string {
+- if n, ok := t.(*types.Named); ok {
+- if pkg := n.Obj().Pkg(); pkg != nil {
+- return pkg.Path()
+- }
+- }
+- return ""
+-}
+diff -urN a/gopls/internal/lsp/command/generate.go b/gopls/internal/lsp/command/generate.go
+--- a/gopls/internal/lsp/command/generate.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/command/generate.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,25 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build ignore
+-// +build ignore
+-
+-package main
+-
+-import (
+- "log"
+- "os"
+-
+- "golang.org/x/tools/gopls/internal/lsp/command/gen"
+-)
+-
+-func main() {
+- content, err := gen.Generate()
+- if err != nil {
+- log.Fatal(err)
+- }
+- if err := os.WriteFile("command_gen.go", content, 0644); err != nil {
+- log.Fatal(err)
+- }
+-}
+diff -urN a/gopls/internal/lsp/command/interface.go b/gopls/internal/lsp/command/interface.go
+--- a/gopls/internal/lsp/command/interface.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/command/interface.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,410 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:generate go run -tags=generate generate.go
+-
+-// Package command defines the interface provided by gopls for the
+-// workspace/executeCommand LSP request.
+-//
+-// This interface is fully specified by the Interface type, provided it
+-// conforms to the restrictions outlined in its doc string.
+-//
+-// Bindings for server-side command dispatch and client-side serialization are
+-// also provided by this package, via code generation.
+-package command
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/govulncheck"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-// Interface defines the interface gopls exposes for the
+-// workspace/executeCommand request.
+-//
+-// This interface is used to generate marshaling/unmarshaling code, dispatch,
+-// and documentation, and so has some additional restrictions:
+-// 1. All method arguments must be JSON serializable.
+-// 2. Methods must return either error or (T, error), where T is a
+-// JSON serializable type.
+-// 3. The first line of the doc string is special. Everything after the colon
+-// is considered the command 'Title'.
+-// TODO(rFindley): reconsider this -- Title may be unnecessary.
+-type Interface interface {
+- // ApplyFix: Apply a fix
+- //
+- // Applies a fix to a region of source code.
+- ApplyFix(context.Context, ApplyFixArgs) error
+- // Test: Run test(s) (legacy)
+- //
+- // Runs `go test` for a specific set of test or benchmark functions.
+- Test(context.Context, protocol.DocumentURI, []string, []string) error
+-
+- // TODO: deprecate Test in favor of RunTests below.
+-
+- // Test: Run test(s)
+- //
+- // Runs `go test` for a specific set of test or benchmark functions.
+- RunTests(context.Context, RunTestsArgs) error
+-
+- // Generate: Run go generate
+- //
+- // Runs `go generate` for a given directory.
+- Generate(context.Context, GenerateArgs) error
+-
+- // RegenerateCgo: Regenerate cgo
+- //
+- // Regenerates cgo definitions.
+- RegenerateCgo(context.Context, URIArg) error
+-
+- // Tidy: Run go mod tidy
+- //
+- // Runs `go mod tidy` for a module.
+- Tidy(context.Context, URIArgs) error
+-
+- // Vendor: Run go mod vendor
+- //
+- // Runs `go mod vendor` for a module.
+- Vendor(context.Context, URIArg) error
+-
+- // EditGoDirective: Run go mod edit -go=version
+- //
+- // Runs `go mod edit -go=version` for a module.
+- EditGoDirective(context.Context, EditGoDirectiveArgs) error
+-
+- // UpdateGoSum: Update go.sum
+- //
+- // Updates the go.sum file for a module.
+- UpdateGoSum(context.Context, URIArgs) error
+-
+- // CheckUpgrades: Check for upgrades
+- //
+- // Checks for module upgrades.
+- CheckUpgrades(context.Context, CheckUpgradesArgs) error
+-
+- // AddDependency: Add a dependency
+- //
+- // Adds a dependency to the go.mod file for a module.
+- AddDependency(context.Context, DependencyArgs) error
+-
+- // UpgradeDependency: Upgrade a dependency
+- //
+- // Upgrades a dependency in the go.mod file for a module.
+- UpgradeDependency(context.Context, DependencyArgs) error
+-
+- // RemoveDependency: Remove a dependency
+- //
+- // Removes a dependency from the go.mod file of a module.
+- RemoveDependency(context.Context, RemoveDependencyArgs) error
+-
+- // ResetGoModDiagnostics: Reset go.mod diagnostics
+- //
+- // Reset diagnostics in the go.mod file of a module.
+- ResetGoModDiagnostics(context.Context, ResetGoModDiagnosticsArgs) error
+-
+- // GoGetPackage: go get a package
+- //
+- // Runs `go get` to fetch a package.
+- GoGetPackage(context.Context, GoGetPackageArgs) error
+-
+- // GCDetails: Toggle gc_details
+- //
+- // Toggle the calculation of gc annotations.
+- GCDetails(context.Context, protocol.DocumentURI) error
+-
+- // TODO: deprecate GCDetails in favor of ToggleGCDetails below.
+-
+- // ToggleGCDetails: Toggle gc_details
+- //
+- // Toggle the calculation of gc annotations.
+- ToggleGCDetails(context.Context, URIArg) error
+-
+- // ListKnownPackages: List known packages
+- //
+- // Retrieve a list of packages that are importable from the given URI.
+- ListKnownPackages(context.Context, URIArg) (ListKnownPackagesResult, error)
+-
+- // ListImports: List imports of a file and its package
+- //
+- // Retrieve a list of imports in the given Go file, and the package it
+- // belongs to.
+- ListImports(context.Context, URIArg) (ListImportsResult, error)
+-
+- // AddImport: Add an import
+- //
+- // Ask the server to add an import path to a given Go file. The method will
+- // call applyEdit on the client so that clients don't have to apply the edit
+- // themselves.
+- AddImport(context.Context, AddImportArgs) error
+-
+- // StartDebugging: Start the gopls debug server
+- //
+- // Start the gopls debug server if it isn't running, and return the debug
+- // address.
+- StartDebugging(context.Context, DebuggingArgs) (DebuggingResult, error)
+-
+- // RunGovulncheck: Run govulncheck.
+- //
+- // Run vulnerability check (`govulncheck`).
+- RunGovulncheck(context.Context, VulncheckArgs) (RunVulncheckResult, error)
+-
+- // FetchVulncheckResult: Get known vulncheck result
+- //
+- // Fetch the result of latest vulnerability check (`govulncheck`).
+- FetchVulncheckResult(context.Context, URIArg) (map[protocol.DocumentURI]*govulncheck.Result, error)
+-
+- // MemStats: fetch memory statistics
+- //
+- // Call runtime.GC multiple times and return memory statistics as reported by
+- // runtime.MemStats.
+- //
+- // This command is used for benchmarking, and may change in the future.
+- MemStats(context.Context) (MemStatsResult, error)
+-}
+-
+-type RunTestsArgs struct {
+- // The test file containing the tests to run.
+- URI protocol.DocumentURI
+-
+- // Specific test names to run, e.g. TestFoo.
+- Tests []string
+-
+- // Specific benchmarks to run, e.g. BenchmarkFoo.
+- Benchmarks []string
+-}
+-
+-type GenerateArgs struct {
+- // URI for the directory to generate.
+- Dir protocol.DocumentURI
+-
+- // Whether to generate recursively (go generate ./...)
+- Recursive bool
+-}
+-
+-// TODO(rFindley): document the rest of these once the docgen is fleshed out.
+-
+-type ApplyFixArgs struct {
+- // The fix to apply.
+- Fix string
+- // The file URI for the document to fix.
+- URI protocol.DocumentURI
+- // The document range to scan for fixes.
+- Range protocol.Range
+-}
+-
+-type URIArg struct {
+- // The file URI.
+- URI protocol.DocumentURI
+-}
+-
+-type URIArgs struct {
+- // The file URIs.
+- URIs []protocol.DocumentURI
+-}
+-
+-type CheckUpgradesArgs struct {
+- // The go.mod file URI.
+- URI protocol.DocumentURI
+- // The modules to check.
+- Modules []string
+-}
+-
+-type DependencyArgs struct {
+- // The go.mod file URI.
+- URI protocol.DocumentURI
+- // Additional args to pass to the go command.
+- GoCmdArgs []string
+- // Whether to add a require directive.
+- AddRequire bool
+-}
+-
+-type RemoveDependencyArgs struct {
+- // The go.mod file URI.
+- URI protocol.DocumentURI
+- // The module path to remove.
+- ModulePath string
+- OnlyDiagnostic bool
+-}
+-
+-type EditGoDirectiveArgs struct {
+- // Any document URI within the relevant module.
+- URI protocol.DocumentURI
+- // The version to pass to `go mod edit -go`.
+- Version string
+-}
+-
+-type GoGetPackageArgs struct {
+- // Any document URI within the relevant module.
+- URI protocol.DocumentURI
+- // The package to go get.
+- Pkg string
+- AddRequire bool
+-}
+-
+-type AddImportArgs struct {
+- // ImportPath is the target import path that should
+- // be added to the URI file
+- ImportPath string
+- // URI is the file that the ImportPath should be
+- // added to
+- URI protocol.DocumentURI
+-}
+-
+-type ListKnownPackagesResult struct {
+- // Packages is a list of packages relative
+- // to the URIArg passed by the command request.
+- // In other words, it omits paths that are already
+- // imported or cannot be imported due to compiler
+- // restrictions.
+- Packages []string
+-}
+-
+-type ListImportsResult struct {
+- // Imports is a list of imports in the requested file.
+- Imports []FileImport
+-
+- // PackageImports is a list of all imports in the requested file's package.
+- PackageImports []PackageImport
+-}
+-
+-type FileImport struct {
+- // Path is the import path of the import.
+- Path string
+- // Name is the name of the import, e.g. `foo` in `import foo "strings"`.
+- Name string
+-}
+-
+-type PackageImport struct {
+- // Path is the import path of the import.
+- Path string
+-}
+-
+-type DebuggingArgs struct {
+- // Optional: the address (including port) for the debug server to listen on.
+- // If not provided, the debug server will bind to "localhost:0", and the
+- // full debug URL will be contained in the result.
+- //
+- // If there is more than one gopls instance along the serving path (i.e. you
+- // are using a daemon), each gopls instance will attempt to start debugging.
+- // If Addr specifies a port, only the daemon will be able to bind to that
+- // port, and each intermediate gopls instance will fail to start debugging.
+- // For this reason it is recommended not to specify a port (or equivalently,
+- // to specify ":0").
+- //
+- // If the server was already debugging this field has no effect, and the
+- // result will contain the previously configured debug URL(s).
+- Addr string
+-}
+-
+-type DebuggingResult struct {
+- // The URLs to use to access the debug servers, for all gopls instances in
+- // the serving path. For the common case of a single gopls instance (i.e. no
+- // daemon), this will be exactly one address.
+- //
+- // In the case of one or more gopls instances forwarding the LSP to a daemon,
+- // URLs will contain debug addresses for each server in the serving path, in
+- // serving order. The daemon debug address will be the last entry in the
+- // slice. If any intermediate gopls instance fails to start debugging, no
+- // error will be returned but the debug URL for that server in the URLs slice
+- // will be empty.
+- URLs []string
+-}
+-
+-type ResetGoModDiagnosticsArgs struct {
+- URIArg
+-
+- // Optional: source of the diagnostics to reset.
+- // If not set, all resettable go.mod diagnostics will be cleared.
+- DiagnosticSource string
+-}
+-
+-type VulncheckArgs struct {
+- // Any document in the directory from which govulncheck will run.
+- URI protocol.DocumentURI
+-
+- // Package pattern. E.g. "", ".", "./...".
+- Pattern string
+-
+- // TODO: -tests
+-}
+-
+-// RunVulncheckResult holds the result of asynchronously starting the vulncheck
+-// command.
+-type RunVulncheckResult struct {
+- // Token holds the progress token for LSP workDone reporting of the vulncheck
+- // invocation.
+- Token protocol.ProgressToken
+-}
+-
+-type VulncheckResult struct {
+- Vuln []Vuln
+-
+- // TODO: Text string format output?
+-}
+-
+-// CallStack models a trace of function calls starting
+-// with a client function or method and ending with a
+-// call to a vulnerable symbol.
+-type CallStack []StackEntry
+-
+-// StackEntry models an element of a call stack.
+-type StackEntry struct {
+- // See golang.org/x/exp/vulncheck.StackEntry.
+-
+- // User-friendly representation of function/method names.
+- // e.g. package.funcName, package.(recvType).methodName, ...
+- Name string
+- URI protocol.DocumentURI
+- Pos protocol.Position // Start position. (0-based. Column is always 0)
+-}
+-
+-// Vuln models an osv.Entry and representative call stacks.
+-// TODO: deprecate
+-type Vuln struct {
+- // ID is the vulnerability ID (osv.Entry.ID).
+- // https://ossf.github.io/osv-schema/#id-modified-fields
+- ID string
+- // Details is the description of the vulnerability (osv.Entry.Details).
+- // https://ossf.github.io/osv-schema/#summary-details-fields
+- Details string `json:",omitempty"`
+- // Aliases are alternative IDs of the vulnerability.
+- // https://ossf.github.io/osv-schema/#aliases-field
+- Aliases []string `json:",omitempty"`
+-
+- // Symbol is the name of the detected vulnerable function or method.
+- // Can be empty if the vulnerability exists in required modules, but no vulnerable symbols are used.
+- Symbol string `json:",omitempty"`
+- // PkgPath is the package path of the detected Symbol.
+- // Can be empty if the vulnerability exists in required modules, but no vulnerable packages are used.
+- PkgPath string `json:",omitempty"`
+- // ModPath is the module path corresponding to PkgPath.
+- // TODO: how do we specify standard library's vulnerability?
+- ModPath string `json:",omitempty"`
+-
+- // URL is the URL for more info about the information.
+- // Either the database specific URL or the one of the URLs
+- // included in osv.Entry.References.
+- URL string `json:",omitempty"`
+-
+- // Current is the current module version.
+- CurrentVersion string `json:",omitempty"`
+-
+- // Fixed is the minimum module version that contains the fix.
+- FixedVersion string `json:",omitempty"`
+-
+- // Example call stacks.
+- CallStacks []CallStack `json:",omitempty"`
+-
+- // Short description of each call stack in CallStacks.
+- CallStackSummaries []string `json:",omitempty"`
+-
+- // TODO: import graph & module graph.
+-}
+-
+-// MemStatsResult holds selected fields from runtime.MemStats.
+-type MemStatsResult struct {
+- HeapAlloc uint64
+- HeapInUse uint64
+-}
+diff -urN a/gopls/internal/lsp/command/interface_test.go b/gopls/internal/lsp/command/interface_test.go
+--- a/gopls/internal/lsp/command/interface_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/command/interface_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,31 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package command_test
+-
+-import (
+- "io/ioutil"
+- "testing"
+-
+- "github.com/google/go-cmp/cmp"
+- "golang.org/x/tools/gopls/internal/lsp/command/gen"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-func TestGenerated(t *testing.T) {
+- testenv.NeedsGoBuild(t) // This is a lie. We actually need the source code.
+-
+- onDisk, err := ioutil.ReadFile("command_gen.go")
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- generated, err := gen.Generate()
+- if err != nil {
+- t.Fatal(err)
+- }
+- if diff := cmp.Diff(string(generated), string(onDisk)); diff != "" {
+- t.Errorf("command_gen.go is stale -- regenerate (-generated +on disk)\n%s", diff)
+- }
+-}
+diff -urN a/gopls/internal/lsp/command/util.go b/gopls/internal/lsp/command/util.go
+--- a/gopls/internal/lsp/command/util.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/command/util.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,63 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package command
+-
+-import (
+- "encoding/json"
+- "fmt"
+-)
+-
+-// ID returns the command name for use in the LSP.
+-func ID(name string) string {
+- return "gopls." + name
+-}
+-
+-type Command string
+-
+-func (c Command) ID() string {
+- return ID(string(c))
+-}
+-
+-// MarshalArgs encodes the given arguments to json.RawMessages. This function
+-// is used to construct arguments to a protocol.Command.
+-//
+-// Example usage:
+-//
+-// jsonArgs, err := MarshalArgs(1, "hello", true, StructuredArg{42, 12.6})
+-func MarshalArgs(args ...interface{}) ([]json.RawMessage, error) {
+- var out []json.RawMessage
+- for _, arg := range args {
+- argJSON, err := json.Marshal(arg)
+- if err != nil {
+- return nil, err
+- }
+- out = append(out, argJSON)
+- }
+- return out, nil
+-}
+-
+-// UnmarshalArgs decodes the given json.RawMessages to the variables provided
+-// by args. Each element of args should be a pointer.
+-//
+-// Example usage:
+-//
+-// var (
+-// num int
+-// str string
+-// bul bool
+-// structured StructuredArg
+-// )
+-// err := UnmarshalArgs(args, &num, &str, &bul, &structured)
+-func UnmarshalArgs(jsonArgs []json.RawMessage, args ...interface{}) error {
+- if len(args) != len(jsonArgs) {
+- return fmt.Errorf("DecodeArgs: expected %d input arguments, got %d JSON arguments", len(args), len(jsonArgs))
+- }
+- for i, arg := range args {
+- if err := json.Unmarshal(jsonArgs[i], arg); err != nil {
+- return err
+- }
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/command.go b/gopls/internal/lsp/command.go
+--- a/gopls/internal/lsp/command.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/command.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,964 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "bytes"
+- "context"
+- "encoding/json"
+- "errors"
+- "fmt"
+- "io"
+- "io/ioutil"
+- "os"
+- "os/exec"
+- "path/filepath"
+- "runtime"
+- "sort"
+- "strings"
+- "time"
+-
+- "golang.org/x/mod/modfile"
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/gopls/internal/govulncheck"
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/debug"
+- "golang.org/x/tools/gopls/internal/lsp/progress"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/gopls/internal/vulncheck"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/gocommand"
+- "golang.org/x/tools/internal/xcontext"
+-)
+-
+-func (s *Server) executeCommand(ctx context.Context, params *protocol.ExecuteCommandParams) (interface{}, error) {
+- var found bool
+- for _, name := range s.session.Options().SupportedCommands {
+- if name == params.Command {
+- found = true
+- break
+- }
+- }
+- if !found {
+- return nil, fmt.Errorf("%s is not a supported command", params.Command)
+- }
+-
+- handler := &commandHandler{
+- s: s,
+- params: params,
+- }
+- return command.Dispatch(ctx, params, handler)
+-}
+-
+-type commandHandler struct {
+- s *Server
+- params *protocol.ExecuteCommandParams
+-}
+-
+-// commandConfig configures common command set-up and execution.
+-type commandConfig struct {
+- async bool // whether to run the command asynchronously. Async commands can only return errors.
+- requireSave bool // whether all files must be saved for the command to work
+- progress string // title to use for progress reporting. If empty, no progress will be reported.
+- forURI protocol.DocumentURI // URI to resolve to a snapshot. If unset, snapshot will be nil.
+-}
+-
+-// commandDeps is evaluated from a commandConfig. Note that not all fields may
+-// be populated, depending on which configuration is set. See comments in-line
+-// for details.
+-type commandDeps struct {
+- snapshot source.Snapshot // present if cfg.forURI was set
+- fh source.FileHandle // present if cfg.forURI was set
+- work *progress.WorkDone // present cfg.progress was set
+-}
+-
+-type commandFunc func(context.Context, commandDeps) error
+-
+-// run performs command setup for command execution, and invokes the given run
+-// function. If cfg.async is set, run executes the given func in a separate
+-// goroutine, and returns as soon as setup is complete and the goroutine is
+-// scheduled.
+-//
+-// Invariant: if the resulting error is non-nil, the given run func will
+-// (eventually) be executed exactly once.
+-func (c *commandHandler) run(ctx context.Context, cfg commandConfig, run commandFunc) (err error) {
+- if cfg.requireSave {
+- var unsaved []string
+- for _, overlay := range c.s.session.Overlays() {
+- if !overlay.Saved() {
+- unsaved = append(unsaved, overlay.URI().Filename())
+- }
+- }
+- if len(unsaved) > 0 {
+- return fmt.Errorf("All files must be saved first (unsaved: %v).", unsaved)
+- }
+- }
+- var deps commandDeps
+- if cfg.forURI != "" {
+- var ok bool
+- var release func()
+- deps.snapshot, deps.fh, ok, release, err = c.s.beginFileRequest(ctx, cfg.forURI, source.UnknownKind)
+- defer release()
+- if !ok {
+- if err != nil {
+- return err
+- }
+- return fmt.Errorf("invalid file URL: %v", cfg.forURI)
+- }
+- }
+- ctx, cancel := context.WithCancel(xcontext.Detach(ctx))
+- if cfg.progress != "" {
+- deps.work = c.s.progress.Start(ctx, cfg.progress, "Running...", c.params.WorkDoneToken, cancel)
+- }
+- runcmd := func() error {
+- defer cancel()
+- err := run(ctx, deps)
+- if deps.work != nil {
+- switch {
+- case errors.Is(err, context.Canceled):
+- deps.work.End(ctx, "canceled")
+- case err != nil:
+- event.Error(ctx, "command error", err)
+- deps.work.End(ctx, "failed")
+- default:
+- deps.work.End(ctx, "completed")
+- }
+- }
+- return err
+- }
+- if cfg.async {
+- go func() {
+- if err := runcmd(); err != nil {
+- if showMessageErr := c.s.client.ShowMessage(ctx, &protocol.ShowMessageParams{
+- Type: protocol.Error,
+- Message: err.Error(),
+- }); showMessageErr != nil {
+- event.Error(ctx, fmt.Sprintf("failed to show message: %q", err.Error()), showMessageErr)
+- }
+- }
+- }()
+- return nil
+- }
+- return runcmd()
+-}
+-
+-func (c *commandHandler) ApplyFix(ctx context.Context, args command.ApplyFixArgs) error {
+- return c.run(ctx, commandConfig{
+- // Note: no progress here. Applying fixes should be quick.
+- forURI: args.URI,
+- }, func(ctx context.Context, deps commandDeps) error {
+- edits, err := source.ApplyFix(ctx, args.Fix, deps.snapshot, deps.fh, args.Range)
+- if err != nil {
+- return err
+- }
+- var changes []protocol.DocumentChanges
+- for _, edit := range edits {
+- edit := edit
+- changes = append(changes, protocol.DocumentChanges{
+- TextDocumentEdit: &edit,
+- })
+- }
+- r, err := c.s.client.ApplyEdit(ctx, &protocol.ApplyWorkspaceEditParams{
+- Edit: protocol.WorkspaceEdit{
+- DocumentChanges: changes,
+- },
+- })
+- if err != nil {
+- return err
+- }
+- if !r.Applied {
+- return errors.New(r.FailureReason)
+- }
+- return nil
+- })
+-}
+-
+-func (c *commandHandler) RegenerateCgo(ctx context.Context, args command.URIArg) error {
+- return c.run(ctx, commandConfig{
+- progress: "Regenerating Cgo",
+- }, func(ctx context.Context, deps commandDeps) error {
+- mod := source.FileModification{
+- URI: args.URI.SpanURI(),
+- Action: source.InvalidateMetadata,
+- }
+- return c.s.didModifyFiles(ctx, []source.FileModification{mod}, FromRegenerateCgo)
+- })
+-}
+-
+-func (c *commandHandler) CheckUpgrades(ctx context.Context, args command.CheckUpgradesArgs) error {
+- return c.run(ctx, commandConfig{
+- forURI: args.URI,
+- progress: "Checking for upgrades",
+- }, func(ctx context.Context, deps commandDeps) error {
+- upgrades, err := c.s.getUpgrades(ctx, deps.snapshot, args.URI.SpanURI(), args.Modules)
+- if err != nil {
+- return err
+- }
+- deps.snapshot.View().RegisterModuleUpgrades(args.URI.SpanURI(), upgrades)
+- // Re-diagnose the snapshot to publish the new module diagnostics.
+- c.s.diagnoseSnapshot(deps.snapshot, nil, false)
+- return nil
+- })
+-}
+-
+-func (c *commandHandler) AddDependency(ctx context.Context, args command.DependencyArgs) error {
+- return c.GoGetModule(ctx, args)
+-}
+-
+-func (c *commandHandler) UpgradeDependency(ctx context.Context, args command.DependencyArgs) error {
+- return c.GoGetModule(ctx, args)
+-}
+-
+-func (c *commandHandler) ResetGoModDiagnostics(ctx context.Context, args command.ResetGoModDiagnosticsArgs) error {
+- return c.run(ctx, commandConfig{
+- forURI: args.URI,
+- }, func(ctx context.Context, deps commandDeps) error {
+- // Clear all diagnostics coming from the upgrade check source and vulncheck.
+- // This will clear the diagnostics in all go.mod files, but they
+- // will be re-calculated when the snapshot is diagnosed again.
+- if args.DiagnosticSource == "" || args.DiagnosticSource == string(source.UpgradeNotification) {
+- deps.snapshot.View().ClearModuleUpgrades(args.URI.SpanURI())
+- c.s.clearDiagnosticSource(modCheckUpgradesSource)
+- }
+-
+- if args.DiagnosticSource == "" || args.DiagnosticSource == string(source.Govulncheck) {
+- deps.snapshot.View().SetVulnerabilities(args.URI.SpanURI(), nil)
+- c.s.clearDiagnosticSource(modVulncheckSource)
+- }
+-
+- // Re-diagnose the snapshot to remove the diagnostics.
+- c.s.diagnoseSnapshot(deps.snapshot, nil, false)
+- return nil
+- })
+-}
+-
+-func (c *commandHandler) GoGetModule(ctx context.Context, args command.DependencyArgs) error {
+- return c.run(ctx, commandConfig{
+- progress: "Running go get",
+- forURI: args.URI,
+- }, func(ctx context.Context, deps commandDeps) error {
+- return c.s.runGoModUpdateCommands(ctx, deps.snapshot, args.URI.SpanURI(), func(invoke func(...string) (*bytes.Buffer, error)) error {
+- return runGoGetModule(invoke, args.AddRequire, args.GoCmdArgs)
+- })
+- })
+-}
+-
+-// TODO(rFindley): UpdateGoSum, Tidy, and Vendor could probably all be one command.
+-func (c *commandHandler) UpdateGoSum(ctx context.Context, args command.URIArgs) error {
+- return c.run(ctx, commandConfig{
+- progress: "Updating go.sum",
+- }, func(ctx context.Context, deps commandDeps) error {
+- for _, uri := range args.URIs {
+- snapshot, fh, ok, release, err := c.s.beginFileRequest(ctx, uri, source.UnknownKind)
+- defer release()
+- if !ok {
+- return err
+- }
+- if err := c.s.runGoModUpdateCommands(ctx, snapshot, fh.URI(), func(invoke func(...string) (*bytes.Buffer, error)) error {
+- _, err := invoke("list", "all")
+- return err
+- }); err != nil {
+- return err
+- }
+- }
+- return nil
+- })
+-}
+-
+-func (c *commandHandler) Tidy(ctx context.Context, args command.URIArgs) error {
+- return c.run(ctx, commandConfig{
+- requireSave: true,
+- progress: "Running go mod tidy",
+- }, func(ctx context.Context, deps commandDeps) error {
+- for _, uri := range args.URIs {
+- snapshot, fh, ok, release, err := c.s.beginFileRequest(ctx, uri, source.UnknownKind)
+- defer release()
+- if !ok {
+- return err
+- }
+- if err := c.s.runGoModUpdateCommands(ctx, snapshot, fh.URI(), func(invoke func(...string) (*bytes.Buffer, error)) error {
+- _, err := invoke("mod", "tidy")
+- return err
+- }); err != nil {
+- return err
+- }
+- }
+- return nil
+- })
+-}
+-
+-func (c *commandHandler) Vendor(ctx context.Context, args command.URIArg) error {
+- return c.run(ctx, commandConfig{
+- requireSave: true,
+- progress: "Running go mod vendor",
+- forURI: args.URI,
+- }, func(ctx context.Context, deps commandDeps) error {
+- // Use RunGoCommandPiped here so that we don't compete with any other go
+- // command invocations. go mod vendor deletes modules.txt before recreating
+- // it, and therefore can run into file locking issues on Windows if that
+- // file is in use by another process, such as go list.
+- //
+- // If golang/go#44119 is resolved, go mod vendor will instead modify
+- // modules.txt in-place. In that case we could theoretically allow this
+- // command to run concurrently.
+- err := deps.snapshot.RunGoCommandPiped(ctx, source.Normal|source.AllowNetwork, &gocommand.Invocation{
+- Verb: "mod",
+- Args: []string{"vendor"},
+- WorkingDir: filepath.Dir(args.URI.SpanURI().Filename()),
+- }, &bytes.Buffer{}, &bytes.Buffer{})
+- return err
+- })
+-}
+-
+-func (c *commandHandler) EditGoDirective(ctx context.Context, args command.EditGoDirectiveArgs) error {
+- return c.run(ctx, commandConfig{
+- requireSave: true, // if go.mod isn't saved it could cause a problem
+- forURI: args.URI,
+- }, func(ctx context.Context, deps commandDeps) error {
+- snapshot, fh, ok, release, err := c.s.beginFileRequest(ctx, args.URI, source.UnknownKind)
+- defer release()
+- if !ok {
+- return err
+- }
+- if err := c.s.runGoModUpdateCommands(ctx, snapshot, fh.URI(), func(invoke func(...string) (*bytes.Buffer, error)) error {
+- _, err := invoke("mod", "edit", "-go", args.Version)
+- return err
+- }); err != nil {
+- return err
+- }
+- return nil
+- })
+-}
+-
+-func (c *commandHandler) RemoveDependency(ctx context.Context, args command.RemoveDependencyArgs) error {
+- return c.run(ctx, commandConfig{
+- progress: "Removing dependency",
+- forURI: args.URI,
+- }, func(ctx context.Context, deps commandDeps) error {
+- // If the module is tidied apart from the one unused diagnostic, we can
+- // run `go get module@none`, and then run `go mod tidy`. Otherwise, we
+- // must make textual edits.
+- // TODO(rstambler): In Go 1.17+, we will be able to use the go command
+- // without checking if the module is tidy.
+- if args.OnlyDiagnostic {
+- return c.s.runGoModUpdateCommands(ctx, deps.snapshot, args.URI.SpanURI(), func(invoke func(...string) (*bytes.Buffer, error)) error {
+- if err := runGoGetModule(invoke, false, []string{args.ModulePath + "@none"}); err != nil {
+- return err
+- }
+- _, err := invoke("mod", "tidy")
+- return err
+- })
+- }
+- pm, err := deps.snapshot.ParseMod(ctx, deps.fh)
+- if err != nil {
+- return err
+- }
+- edits, err := dropDependency(deps.snapshot, pm, args.ModulePath)
+- if err != nil {
+- return err
+- }
+- response, err := c.s.client.ApplyEdit(ctx, &protocol.ApplyWorkspaceEditParams{
+- Edit: protocol.WorkspaceEdit{
+- DocumentChanges: []protocol.DocumentChanges{
+- {
+- TextDocumentEdit: &protocol.TextDocumentEdit{
+- TextDocument: protocol.OptionalVersionedTextDocumentIdentifier{
+- Version: deps.fh.Version(),
+- TextDocumentIdentifier: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(deps.fh.URI()),
+- },
+- },
+- Edits: edits,
+- },
+- },
+- },
+- },
+- })
+- if err != nil {
+- return err
+- }
+- if !response.Applied {
+- return fmt.Errorf("edits not applied because of %s", response.FailureReason)
+- }
+- return nil
+- })
+-}
+-
+-// dropDependency returns the edits to remove the given require from the go.mod
+-// file.
+-func dropDependency(snapshot source.Snapshot, pm *source.ParsedModule, modulePath string) ([]protocol.TextEdit, error) {
+- // We need a private copy of the parsed go.mod file, since we're going to
+- // modify it.
+- copied, err := modfile.Parse("", pm.Mapper.Content, nil)
+- if err != nil {
+- return nil, err
+- }
+- if err := copied.DropRequire(modulePath); err != nil {
+- return nil, err
+- }
+- copied.Cleanup()
+- newContent, err := copied.Format()
+- if err != nil {
+- return nil, err
+- }
+- // Calculate the edits to be made due to the change.
+- diff := snapshot.View().Options().ComputeEdits(string(pm.Mapper.Content), string(newContent))
+- return source.ToProtocolEdits(pm.Mapper, diff)
+-}
+-
+-func (c *commandHandler) Test(ctx context.Context, uri protocol.DocumentURI, tests, benchmarks []string) error {
+- return c.RunTests(ctx, command.RunTestsArgs{
+- URI: uri,
+- Tests: tests,
+- Benchmarks: benchmarks,
+- })
+-}
+-
+-func (c *commandHandler) RunTests(ctx context.Context, args command.RunTestsArgs) error {
+- return c.run(ctx, commandConfig{
+- async: true,
+- progress: "Running go test",
+- requireSave: true,
+- forURI: args.URI,
+- }, func(ctx context.Context, deps commandDeps) error {
+- if err := c.runTests(ctx, deps.snapshot, deps.work, args.URI, args.Tests, args.Benchmarks); err != nil {
+- return fmt.Errorf("running tests failed: %w", err)
+- }
+- return nil
+- })
+-}
+-
+-func (c *commandHandler) runTests(ctx context.Context, snapshot source.Snapshot, work *progress.WorkDone, uri protocol.DocumentURI, tests, benchmarks []string) error {
+- // TODO: fix the error reporting when this runs async.
+- metas, err := snapshot.MetadataForFile(ctx, uri.SpanURI())
+- if err != nil {
+- return err
+- }
+- metas = source.RemoveIntermediateTestVariants(metas)
+- if len(metas) == 0 {
+- return fmt.Errorf("package could not be found for file: %s", uri.SpanURI().Filename())
+- }
+- pkgPath := string(metas[0].ForTest)
+-
+- // create output
+- buf := &bytes.Buffer{}
+- ew := progress.NewEventWriter(ctx, "test")
+- out := io.MultiWriter(ew, progress.NewWorkDoneWriter(ctx, work), buf)
+-
+- // Run `go test -run Func` on each test.
+- var failedTests int
+- for _, funcName := range tests {
+- inv := &gocommand.Invocation{
+- Verb: "test",
+- Args: []string{pkgPath, "-v", "-count=1", "-run", fmt.Sprintf("^%s$", funcName)},
+- WorkingDir: filepath.Dir(uri.SpanURI().Filename()),
+- }
+- if err := snapshot.RunGoCommandPiped(ctx, source.Normal, inv, out, out); err != nil {
+- if errors.Is(err, context.Canceled) {
+- return err
+- }
+- failedTests++
+- }
+- }
+-
+- // Run `go test -run=^$ -bench Func` on each test.
+- var failedBenchmarks int
+- for _, funcName := range benchmarks {
+- inv := &gocommand.Invocation{
+- Verb: "test",
+- Args: []string{pkgPath, "-v", "-run=^$", "-bench", fmt.Sprintf("^%s$", funcName)},
+- WorkingDir: filepath.Dir(uri.SpanURI().Filename()),
+- }
+- if err := snapshot.RunGoCommandPiped(ctx, source.Normal, inv, out, out); err != nil {
+- if errors.Is(err, context.Canceled) {
+- return err
+- }
+- failedBenchmarks++
+- }
+- }
+-
+- var title string
+- if len(tests) > 0 && len(benchmarks) > 0 {
+- title = "tests and benchmarks"
+- } else if len(tests) > 0 {
+- title = "tests"
+- } else if len(benchmarks) > 0 {
+- title = "benchmarks"
+- } else {
+- return errors.New("No functions were provided")
+- }
+- message := fmt.Sprintf("all %s passed", title)
+- if failedTests > 0 && failedBenchmarks > 0 {
+- message = fmt.Sprintf("%d / %d tests failed and %d / %d benchmarks failed", failedTests, len(tests), failedBenchmarks, len(benchmarks))
+- } else if failedTests > 0 {
+- message = fmt.Sprintf("%d / %d tests failed", failedTests, len(tests))
+- } else if failedBenchmarks > 0 {
+- message = fmt.Sprintf("%d / %d benchmarks failed", failedBenchmarks, len(benchmarks))
+- }
+- if failedTests > 0 || failedBenchmarks > 0 {
+- message += "\n" + buf.String()
+- }
+-
+- return c.s.client.ShowMessage(ctx, &protocol.ShowMessageParams{
+- Type: protocol.Info,
+- Message: message,
+- })
+-}
+-
+-func (c *commandHandler) Generate(ctx context.Context, args command.GenerateArgs) error {
+- title := "Running go generate ."
+- if args.Recursive {
+- title = "Running go generate ./..."
+- }
+- return c.run(ctx, commandConfig{
+- requireSave: true,
+- progress: title,
+- forURI: args.Dir,
+- }, func(ctx context.Context, deps commandDeps) error {
+- er := progress.NewEventWriter(ctx, "generate")
+-
+- pattern := "."
+- if args.Recursive {
+- pattern = "./..."
+- }
+- inv := &gocommand.Invocation{
+- Verb: "generate",
+- Args: []string{"-x", pattern},
+- WorkingDir: args.Dir.SpanURI().Filename(),
+- }
+- stderr := io.MultiWriter(er, progress.NewWorkDoneWriter(ctx, deps.work))
+- if err := deps.snapshot.RunGoCommandPiped(ctx, source.Normal, inv, er, stderr); err != nil {
+- return err
+- }
+- return nil
+- })
+-}
+-
+-func (c *commandHandler) GoGetPackage(ctx context.Context, args command.GoGetPackageArgs) error {
+- return c.run(ctx, commandConfig{
+- forURI: args.URI,
+- progress: "Running go get",
+- }, func(ctx context.Context, deps commandDeps) error {
+- // Run on a throwaway go.mod, otherwise it'll write to the real one.
+- stdout, err := deps.snapshot.RunGoCommandDirect(ctx, source.WriteTemporaryModFile|source.AllowNetwork, &gocommand.Invocation{
+- Verb: "list",
+- Args: []string{"-f", "{{.Module.Path}}@{{.Module.Version}}", args.Pkg},
+- WorkingDir: filepath.Dir(args.URI.SpanURI().Filename()),
+- })
+- if err != nil {
+- return err
+- }
+- ver := strings.TrimSpace(stdout.String())
+- return c.s.runGoModUpdateCommands(ctx, deps.snapshot, args.URI.SpanURI(), func(invoke func(...string) (*bytes.Buffer, error)) error {
+- if args.AddRequire {
+- if err := addModuleRequire(invoke, []string{ver}); err != nil {
+- return err
+- }
+- }
+- _, err := invoke(append([]string{"get", "-d"}, args.Pkg)...)
+- return err
+- })
+- })
+-}
+-
+-func (s *Server) runGoModUpdateCommands(ctx context.Context, snapshot source.Snapshot, uri span.URI, run func(invoke func(...string) (*bytes.Buffer, error)) error) error {
+- tmpModfile, newModBytes, newSumBytes, err := snapshot.RunGoCommands(ctx, true, filepath.Dir(uri.Filename()), run)
+- if err != nil {
+- return err
+- }
+- if !tmpModfile {
+- return nil
+- }
+- modURI := snapshot.GoModForFile(uri)
+- sumURI := span.URIFromPath(strings.TrimSuffix(modURI.Filename(), ".mod") + ".sum")
+- modEdits, err := applyFileEdits(ctx, snapshot, modURI, newModBytes)
+- if err != nil {
+- return err
+- }
+- sumEdits, err := applyFileEdits(ctx, snapshot, sumURI, newSumBytes)
+- if err != nil {
+- return err
+- }
+- changes := append(sumEdits, modEdits...)
+- if len(changes) == 0 {
+- return nil
+- }
+- var documentChanges []protocol.DocumentChanges
+- for _, change := range changes {
+- change := change
+- documentChanges = append(documentChanges, protocol.DocumentChanges{
+- TextDocumentEdit: &change,
+- })
+- }
+- response, err := s.client.ApplyEdit(ctx, &protocol.ApplyWorkspaceEditParams{
+- Edit: protocol.WorkspaceEdit{
+- DocumentChanges: documentChanges,
+- },
+- })
+- if err != nil {
+- return err
+- }
+- if !response.Applied {
+- return fmt.Errorf("edits not applied because of %s", response.FailureReason)
+- }
+- return nil
+-}
+-
+-func applyFileEdits(ctx context.Context, snapshot source.Snapshot, uri span.URI, newContent []byte) ([]protocol.TextDocumentEdit, error) {
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return nil, err
+- }
+- oldContent, err := fh.Read()
+- if err != nil && !os.IsNotExist(err) {
+- return nil, err
+- }
+- if bytes.Equal(oldContent, newContent) {
+- return nil, nil
+- }
+-
+- // Sending a workspace edit to a closed file causes VS Code to open the
+- // file and leave it unsaved. We would rather apply the changes directly,
+- // especially to go.sum, which should be mostly invisible to the user.
+- if !snapshot.IsOpen(uri) {
+- err := ioutil.WriteFile(uri.Filename(), newContent, 0666)
+- return nil, err
+- }
+-
+- m := protocol.NewMapper(fh.URI(), oldContent)
+- diff := snapshot.View().Options().ComputeEdits(string(oldContent), string(newContent))
+- edits, err := source.ToProtocolEdits(m, diff)
+- if err != nil {
+- return nil, err
+- }
+- return []protocol.TextDocumentEdit{{
+- TextDocument: protocol.OptionalVersionedTextDocumentIdentifier{
+- Version: fh.Version(),
+- TextDocumentIdentifier: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- },
+- Edits: edits,
+- }}, nil
+-}
+-
+-func runGoGetModule(invoke func(...string) (*bytes.Buffer, error), addRequire bool, args []string) error {
+- if addRequire {
+- if err := addModuleRequire(invoke, args); err != nil {
+- return err
+- }
+- }
+- _, err := invoke(append([]string{"get", "-d"}, args...)...)
+- return err
+-}
+-
+-func addModuleRequire(invoke func(...string) (*bytes.Buffer, error), args []string) error {
+- // Using go get to create a new dependency results in an
+- // `// indirect` comment we may not want. The only way to avoid it
+- // is to add the require as direct first. Then we can use go get to
+- // update go.sum and tidy up.
+- _, err := invoke(append([]string{"mod", "edit", "-require"}, args...)...)
+- return err
+-}
+-
+-func (s *Server) getUpgrades(ctx context.Context, snapshot source.Snapshot, uri span.URI, modules []string) (map[string]string, error) {
+- stdout, err := snapshot.RunGoCommandDirect(ctx, source.Normal|source.AllowNetwork, &gocommand.Invocation{
+- Verb: "list",
+- Args: append([]string{"-m", "-u", "-json"}, modules...),
+- WorkingDir: filepath.Dir(uri.Filename()),
+- ModFlag: "readonly",
+- })
+- if err != nil {
+- return nil, err
+- }
+-
+- upgrades := map[string]string{}
+- for dec := json.NewDecoder(stdout); dec.More(); {
+- mod := &gocommand.ModuleJSON{}
+- if err := dec.Decode(mod); err != nil {
+- return nil, err
+- }
+- if mod.Update == nil {
+- continue
+- }
+- upgrades[mod.Path] = mod.Update.Version
+- }
+- return upgrades, nil
+-}
+-
+-func (c *commandHandler) GCDetails(ctx context.Context, uri protocol.DocumentURI) error {
+- return c.ToggleGCDetails(ctx, command.URIArg{URI: uri})
+-}
+-
+-func (c *commandHandler) ToggleGCDetails(ctx context.Context, args command.URIArg) error {
+- return c.run(ctx, commandConfig{
+- requireSave: true,
+- progress: "Toggling GC Details",
+- forURI: args.URI,
+- }, func(ctx context.Context, deps commandDeps) error {
+- metas, err := deps.snapshot.MetadataForFile(ctx, deps.fh.URI())
+- if err != nil {
+- return err
+- }
+- id := metas[0].ID // 0 => narrowest package
+- c.s.gcOptimizationDetailsMu.Lock()
+- if _, ok := c.s.gcOptimizationDetails[id]; ok {
+- delete(c.s.gcOptimizationDetails, id)
+- c.s.clearDiagnosticSource(gcDetailsSource)
+- } else {
+- c.s.gcOptimizationDetails[id] = struct{}{}
+- }
+- c.s.gcOptimizationDetailsMu.Unlock()
+- c.s.diagnoseSnapshot(deps.snapshot, nil, false)
+- return nil
+- })
+-}
+-
+-func (c *commandHandler) ListKnownPackages(ctx context.Context, args command.URIArg) (command.ListKnownPackagesResult, error) {
+- var result command.ListKnownPackagesResult
+- err := c.run(ctx, commandConfig{
+- progress: "Listing packages",
+- forURI: args.URI,
+- }, func(ctx context.Context, deps commandDeps) error {
+- pkgs, err := source.KnownPackagePaths(ctx, deps.snapshot, deps.fh)
+- for _, pkg := range pkgs {
+- result.Packages = append(result.Packages, string(pkg))
+- }
+- return err
+- })
+- return result, err
+-}
+-
+-func (c *commandHandler) ListImports(ctx context.Context, args command.URIArg) (command.ListImportsResult, error) {
+- var result command.ListImportsResult
+- err := c.run(ctx, commandConfig{
+- forURI: args.URI,
+- }, func(ctx context.Context, deps commandDeps) error {
+- fh, err := deps.snapshot.GetFile(ctx, args.URI.SpanURI())
+- if err != nil {
+- return err
+- }
+- pgf, err := deps.snapshot.ParseGo(ctx, fh, source.ParseHeader)
+- if err != nil {
+- return err
+- }
+- fset := source.FileSetFor(pgf.Tok)
+- for _, group := range astutil.Imports(fset, pgf.File) {
+- for _, imp := range group {
+- if imp.Path == nil {
+- continue
+- }
+- var name string
+- if imp.Name != nil {
+- name = imp.Name.Name
+- }
+- result.Imports = append(result.Imports, command.FileImport{
+- Path: string(source.UnquoteImportPath(imp)),
+- Name: name,
+- })
+- }
+- }
+- metas, err := deps.snapshot.MetadataForFile(ctx, args.URI.SpanURI())
+- if err != nil {
+- return err // e.g. cancelled
+- }
+- if len(metas) == 0 {
+- return fmt.Errorf("no package containing %v", args.URI.SpanURI())
+- }
+- for pkgPath := range metas[0].DepsByPkgPath { // 0 => narrowest package
+- result.PackageImports = append(result.PackageImports,
+- command.PackageImport{Path: string(pkgPath)})
+- }
+- sort.Slice(result.PackageImports, func(i, j int) bool {
+- return result.PackageImports[i].Path < result.PackageImports[j].Path
+- })
+- return nil
+- })
+- return result, err
+-}
+-
+-func (c *commandHandler) AddImport(ctx context.Context, args command.AddImportArgs) error {
+- return c.run(ctx, commandConfig{
+- progress: "Adding import",
+- forURI: args.URI,
+- }, func(ctx context.Context, deps commandDeps) error {
+- edits, err := source.AddImport(ctx, deps.snapshot, deps.fh, args.ImportPath)
+- if err != nil {
+- return fmt.Errorf("could not add import: %v", err)
+- }
+- if _, err := c.s.client.ApplyEdit(ctx, &protocol.ApplyWorkspaceEditParams{
+- Edit: protocol.WorkspaceEdit{
+- DocumentChanges: documentChanges(deps.fh, edits),
+- },
+- }); err != nil {
+- return fmt.Errorf("could not apply import edits: %v", err)
+- }
+- return nil
+- })
+-}
+-
+-func (c *commandHandler) StartDebugging(ctx context.Context, args command.DebuggingArgs) (result command.DebuggingResult, _ error) {
+- addr := args.Addr
+- if addr == "" {
+- addr = "localhost:0"
+- }
+- di := debug.GetInstance(ctx)
+- if di == nil {
+- return result, errors.New("internal error: server has no debugging instance")
+- }
+- listenedAddr, err := di.Serve(ctx, addr)
+- if err != nil {
+- return result, fmt.Errorf("starting debug server: %w", err)
+- }
+- result.URLs = []string{"http://" + listenedAddr}
+- return result, nil
+-}
+-
+-// Copy of pkgLoadConfig defined in internal/lsp/cmd/vulncheck.go
+-// TODO(hyangah): decide where to define this.
+-type pkgLoadConfig struct {
+- // BuildFlags is a list of command-line flags to be passed through to
+- // the build system's query tool.
+- BuildFlags []string
+-
+- // If Tests is set, the loader includes related test packages.
+- Tests bool
+-}
+-
+-func (c *commandHandler) FetchVulncheckResult(ctx context.Context, arg command.URIArg) (map[protocol.DocumentURI]*govulncheck.Result, error) {
+- ret := map[protocol.DocumentURI]*govulncheck.Result{}
+- err := c.run(ctx, commandConfig{forURI: arg.URI}, func(ctx context.Context, deps commandDeps) error {
+- if deps.snapshot.View().Options().Vulncheck == source.ModeVulncheckImports {
+- for _, modfile := range deps.snapshot.ModFiles() {
+- res, err := deps.snapshot.ModVuln(ctx, modfile)
+- if err != nil {
+- return err
+- }
+- ret[protocol.URIFromSpanURI(modfile)] = res
+- }
+- }
+- // Overwrite if there is any govulncheck-based result.
+- for modfile, result := range deps.snapshot.View().Vulnerabilities() {
+- ret[protocol.URIFromSpanURI(modfile)] = result
+- }
+- return nil
+- })
+- return ret, err
+-}
+-
+-func (c *commandHandler) RunGovulncheck(ctx context.Context, args command.VulncheckArgs) (command.RunVulncheckResult, error) {
+- if args.URI == "" {
+- return command.RunVulncheckResult{}, errors.New("VulncheckArgs is missing URI field")
+- }
+-
+- // Return the workdone token so that clients can identify when this
+- // vulncheck invocation is complete.
+- //
+- // Since the run function executes asynchronously, we use a channel to
+- // synchronize the start of the run and return the token.
+- tokenChan := make(chan protocol.ProgressToken, 1)
+- err := c.run(ctx, commandConfig{
+- async: true, // need to be async to be cancellable
+- progress: "govulncheck",
+- requireSave: true,
+- forURI: args.URI,
+- }, func(ctx context.Context, deps commandDeps) error {
+- tokenChan <- deps.work.Token()
+-
+- view := deps.snapshot.View()
+- opts := view.Options()
+- // quickly test if gopls is compiled to support govulncheck
+- // by checking vulncheck.Main. Alternatively, we can continue and
+- // let the `gopls vulncheck` command fail. This is lighter-weight.
+- if vulncheck.Main == nil {
+- return errors.New("vulncheck feature is not available")
+- }
+-
+- cmd := exec.CommandContext(ctx, os.Args[0], "vulncheck", "-config", args.Pattern)
+- cmd.Dir = filepath.Dir(args.URI.SpanURI().Filename())
+-
+- var viewEnv []string
+- if e := opts.EnvSlice(); e != nil {
+- viewEnv = append(os.Environ(), e...)
+- }
+- cmd.Env = viewEnv
+-
+- // stdin: gopls vulncheck expects JSON-encoded configuration from STDIN when -config flag is set.
+- var stdin bytes.Buffer
+- cmd.Stdin = &stdin
+-
+- if err := json.NewEncoder(&stdin).Encode(pkgLoadConfig{
+- BuildFlags: opts.BuildFlags,
+- // TODO(hyangah): add `tests` flag in command.VulncheckArgs
+- }); err != nil {
+- return fmt.Errorf("failed to pass package load config: %v", err)
+- }
+-
+- // stderr: stream gopls vulncheck's STDERR as progress reports
+- er := progress.NewEventWriter(ctx, "vulncheck")
+- stderr := io.MultiWriter(er, progress.NewWorkDoneWriter(ctx, deps.work))
+- cmd.Stderr = stderr
+- // TODO: can we stream stdout?
+- stdout, err := cmd.Output()
+- if err != nil {
+- return fmt.Errorf("failed to run govulncheck: %v", err)
+- }
+-
+- var result govulncheck.Result
+- if err := json.Unmarshal(stdout, &result); err != nil {
+- // TODO: for easy debugging, log the failed stdout somewhere?
+- return fmt.Errorf("failed to parse govulncheck output: %v", err)
+- }
+- result.Mode = govulncheck.ModeGovulncheck
+- result.AsOf = time.Now()
+- deps.snapshot.View().SetVulnerabilities(args.URI.SpanURI(), &result)
+-
+- c.s.diagnoseSnapshot(deps.snapshot, nil, false)
+- vulns := result.Vulns
+- affecting := make([]string, 0, len(vulns))
+- for _, v := range vulns {
+- if v.IsCalled() {
+- affecting = append(affecting, v.OSV.ID)
+- }
+- }
+- if len(affecting) == 0 {
+- return c.s.client.ShowMessage(ctx, &protocol.ShowMessageParams{
+- Type: protocol.Info,
+- Message: "No vulnerabilities found",
+- })
+- }
+- sort.Strings(affecting)
+- return c.s.client.ShowMessage(ctx, &protocol.ShowMessageParams{
+- Type: protocol.Warning,
+- Message: fmt.Sprintf("Found %v", strings.Join(affecting, ", ")),
+- })
+- })
+- if err != nil {
+- return command.RunVulncheckResult{}, err
+- }
+- select {
+- case <-ctx.Done():
+- return command.RunVulncheckResult{}, ctx.Err()
+- case token := <-tokenChan:
+- return command.RunVulncheckResult{Token: token}, nil
+- }
+-}
+-
+-// MemStats implements the MemStats command. It returns an error as a
+-// future-proof API, but the resulting error is currently always nil.
+-func (c *commandHandler) MemStats(ctx context.Context) (command.MemStatsResult, error) {
+- // GC a few times for stable results.
+- runtime.GC()
+- runtime.GC()
+- runtime.GC()
+- var m runtime.MemStats
+- runtime.ReadMemStats(&m)
+- return command.MemStatsResult{
+- HeapAlloc: m.HeapAlloc,
+- HeapInUse: m.HeapInuse,
+- }, nil
+-}
+diff -urN a/gopls/internal/lsp/completion.go b/gopls/internal/lsp/completion.go
+--- a/gopls/internal/lsp/completion.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/completion.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,140 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+- "fmt"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/source/completion"
+- "golang.org/x/tools/gopls/internal/lsp/template"
+- "golang.org/x/tools/gopls/internal/lsp/work"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+-)
+-
+-func (s *Server) completion(ctx context.Context, params *protocol.CompletionParams) (*protocol.CompletionList, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.UnknownKind)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+- var candidates []completion.CompletionItem
+- var surrounding *completion.Selection
+- switch snapshot.View().FileKind(fh) {
+- case source.Go:
+- candidates, surrounding, err = completion.Completion(ctx, snapshot, fh, params.Position, params.Context)
+- case source.Mod:
+- candidates, surrounding = nil, nil
+- case source.Work:
+- cl, err := work.Completion(ctx, snapshot, fh, params.Position)
+- if err != nil {
+- break
+- }
+- return cl, nil
+- case source.Tmpl:
+- var cl *protocol.CompletionList
+- cl, err = template.Completion(ctx, snapshot, fh, params.Position, params.Context)
+- if err != nil {
+- break // use common error handling, candidates==nil
+- }
+- return cl, nil
+- }
+- if err != nil {
+- event.Error(ctx, "no completions found", err, tag.Position.Of(params.Position))
+- }
+- if candidates == nil {
+- return &protocol.CompletionList{
+- IsIncomplete: true,
+- Items: []protocol.CompletionItem{},
+- }, nil
+- }
+-
+- rng, err := surrounding.Range()
+- if err != nil {
+- return nil, err
+- }
+-
+- // When using deep completions/fuzzy matching, report results as incomplete so
+- // client fetches updated completions after every key stroke.
+- options := snapshot.View().Options()
+- incompleteResults := options.DeepCompletion || options.Matcher == source.Fuzzy
+-
+- items := toProtocolCompletionItems(candidates, rng, options)
+-
+- return &protocol.CompletionList{
+- IsIncomplete: incompleteResults,
+- Items: items,
+- }, nil
+-}
+-
+-func toProtocolCompletionItems(candidates []completion.CompletionItem, rng protocol.Range, options *source.Options) []protocol.CompletionItem {
+- var (
+- items = make([]protocol.CompletionItem, 0, len(candidates))
+- numDeepCompletionsSeen int
+- )
+- for i, candidate := range candidates {
+- // Limit the number of deep completions to not overwhelm the user in cases
+- // with dozens of deep completion matches.
+- if candidate.Depth > 0 {
+- if !options.DeepCompletion {
+- continue
+- }
+- if numDeepCompletionsSeen >= completion.MaxDeepCompletions {
+- continue
+- }
+- numDeepCompletionsSeen++
+- }
+- insertText := candidate.InsertText
+- if options.InsertTextFormat == protocol.SnippetTextFormat {
+- insertText = candidate.Snippet()
+- }
+-
+- // This can happen if the client has snippets disabled but the
+- // candidate only supports snippet insertion.
+- if insertText == "" {
+- continue
+- }
+-
+- doc := &protocol.Or_CompletionItem_documentation{
+- Value: protocol.MarkupContent{
+- Kind: protocol.Markdown,
+- Value: source.CommentToMarkdown(candidate.Documentation, options),
+- },
+- }
+- if options.PreferredContentFormat != protocol.Markdown {
+- doc.Value = candidate.Documentation
+- }
+- item := protocol.CompletionItem{
+- Label: candidate.Label,
+- Detail: candidate.Detail,
+- Kind: candidate.Kind,
+- TextEdit: &protocol.TextEdit{
+- NewText: insertText,
+- Range: rng,
+- },
+- InsertTextFormat: &options.InsertTextFormat,
+- AdditionalTextEdits: candidate.AdditionalTextEdits,
+- // This is a hack so that the client sorts completion results in the order
+- // according to their score. This can be removed upon the resolution of
+- // https://github.com/Microsoft/language-server-protocol/issues/348.
+- SortText: fmt.Sprintf("%05d", i),
+-
+- // Trim operators (VSCode doesn't like weird characters in
+- // filterText).
+- FilterText: strings.TrimLeft(candidate.InsertText, "&*"),
+-
+- Preselect: i == 0,
+- Documentation: doc,
+- Tags: candidate.Tags,
+- Deprecated: candidate.Deprecated,
+- }
+- items = append(items, item)
+- }
+- return items
+-}
+diff -urN a/gopls/internal/lsp/completion_test.go b/gopls/internal/lsp/completion_test.go
+--- a/gopls/internal/lsp/completion_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/completion_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,176 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "fmt"
+- "strings"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/source/completion"
+- "golang.org/x/tools/gopls/internal/lsp/tests"
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-func (r *runner) Completion(t *testing.T, src span.Span, test tests.Completion, items tests.CompletionItems) {
+- got := r.callCompletion(t, src, func(opts *source.Options) {
+- opts.DeepCompletion = false
+- opts.Matcher = source.CaseInsensitive
+- opts.CompleteUnimported = false
+- opts.InsertTextFormat = protocol.SnippetTextFormat
+- opts.LiteralCompletions = strings.Contains(string(src.URI()), "literal")
+- opts.ExperimentalPostfixCompletions = strings.Contains(string(src.URI()), "postfix")
+- })
+- got = tests.FilterBuiltins(src, got)
+- want := expected(t, test, items)
+- if diff := tests.DiffCompletionItems(want, got); diff != "" {
+- t.Errorf("mismatching completion items (-want +got):\n%s", diff)
+- }
+-}
+-
+-func (r *runner) CompletionSnippet(t *testing.T, src span.Span, expected tests.CompletionSnippet, placeholders bool, items tests.CompletionItems) {
+- list := r.callCompletion(t, src, func(opts *source.Options) {
+- opts.UsePlaceholders = placeholders
+- opts.DeepCompletion = true
+- opts.Matcher = source.Fuzzy
+- opts.CompleteUnimported = false
+- })
+- got := tests.FindItem(list, *items[expected.CompletionItem])
+- want := expected.PlainSnippet
+- if placeholders {
+- want = expected.PlaceholderSnippet
+- }
+- if diff := tests.DiffSnippets(want, got); diff != "" {
+- t.Errorf("%s", diff)
+- }
+-}
+-
+-func (r *runner) UnimportedCompletion(t *testing.T, src span.Span, test tests.Completion, items tests.CompletionItems) {
+- got := r.callCompletion(t, src, func(opts *source.Options) {})
+- got = tests.FilterBuiltins(src, got)
+- want := expected(t, test, items)
+- if diff := tests.CheckCompletionOrder(want, got, false); diff != "" {
+- t.Errorf("%s", diff)
+- }
+-}
+-
+-func (r *runner) DeepCompletion(t *testing.T, src span.Span, test tests.Completion, items tests.CompletionItems) {
+- got := r.callCompletion(t, src, func(opts *source.Options) {
+- opts.DeepCompletion = true
+- opts.Matcher = source.CaseInsensitive
+- opts.CompleteUnimported = false
+- })
+- got = tests.FilterBuiltins(src, got)
+- want := expected(t, test, items)
+- if diff := tests.DiffCompletionItems(want, got); diff != "" {
+- t.Errorf("mismatching completion items (-want +got):\n%s", diff)
+- }
+-}
+-
+-func (r *runner) FuzzyCompletion(t *testing.T, src span.Span, test tests.Completion, items tests.CompletionItems) {
+- got := r.callCompletion(t, src, func(opts *source.Options) {
+- opts.DeepCompletion = true
+- opts.Matcher = source.Fuzzy
+- opts.CompleteUnimported = false
+- })
+- got = tests.FilterBuiltins(src, got)
+- want := expected(t, test, items)
+- if diff := tests.DiffCompletionItems(want, got); diff != "" {
+- t.Errorf("mismatching completion items (-want +got):\n%s", diff)
+- }
+-}
+-
+-func (r *runner) CaseSensitiveCompletion(t *testing.T, src span.Span, test tests.Completion, items tests.CompletionItems) {
+- got := r.callCompletion(t, src, func(opts *source.Options) {
+- opts.Matcher = source.CaseSensitive
+- opts.CompleteUnimported = false
+- })
+- got = tests.FilterBuiltins(src, got)
+- want := expected(t, test, items)
+- if diff := tests.DiffCompletionItems(want, got); diff != "" {
+- t.Errorf("mismatching completion items (-want +got):\n%s", diff)
+- }
+-}
+-
+-func (r *runner) RankCompletion(t *testing.T, src span.Span, test tests.Completion, items tests.CompletionItems) {
+- got := r.callCompletion(t, src, func(opts *source.Options) {
+- opts.DeepCompletion = true
+- opts.Matcher = source.Fuzzy
+- opts.CompleteUnimported = false
+- opts.LiteralCompletions = true
+- opts.ExperimentalPostfixCompletions = true
+- })
+- want := expected(t, test, items)
+- if msg := tests.CheckCompletionOrder(want, got, true); msg != "" {
+- t.Errorf("%s", msg)
+- }
+-}
+-
+-func expected(t *testing.T, test tests.Completion, items tests.CompletionItems) []protocol.CompletionItem {
+- t.Helper()
+-
+- toProtocolCompletionItem := func(item *completion.CompletionItem) protocol.CompletionItem {
+- pItem := protocol.CompletionItem{
+- Label: item.Label,
+- Kind: item.Kind,
+- Detail: item.Detail,
+- Documentation: &protocol.Or_CompletionItem_documentation{
+- Value: item.Documentation,
+- },
+- InsertText: item.InsertText,
+- TextEdit: &protocol.TextEdit{
+- NewText: item.Snippet(),
+- },
+- // Negate score so best score has lowest sort text like real API.
+- SortText: fmt.Sprint(-item.Score),
+- }
+- if pItem.InsertText == "" {
+- pItem.InsertText = pItem.Label
+- }
+- return pItem
+- }
+-
+- var want []protocol.CompletionItem
+- for _, pos := range test.CompletionItems {
+- want = append(want, toProtocolCompletionItem(items[pos]))
+- }
+- return want
+-}
+-
+-func (r *runner) callCompletion(t *testing.T, src span.Span, options func(*source.Options)) []protocol.CompletionItem {
+- t.Helper()
+-
+- view, err := r.server.session.ViewOf(src.URI())
+- if err != nil {
+- t.Fatal(err)
+- }
+- original := view.Options()
+- modified := view.Options().Clone()
+- options(modified)
+- view, err = r.server.session.SetViewOptions(r.ctx, view, modified)
+- if err != nil {
+- t.Error(err)
+- return nil
+- }
+- defer r.server.session.SetViewOptions(r.ctx, view, original)
+-
+- list, err := r.server.Completion(r.ctx, &protocol.CompletionParams{
+- TextDocumentPositionParams: protocol.TextDocumentPositionParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(src.URI()),
+- },
+- Position: protocol.Position{
+- Line: uint32(src.Start().Line() - 1),
+- Character: uint32(src.Start().Column() - 1),
+- },
+- },
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- return list.Items
+-}
+diff -urN a/gopls/internal/lsp/debounce.go b/gopls/internal/lsp/debounce.go
+--- a/gopls/internal/lsp/debounce.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/debounce.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,71 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "sync"
+- "time"
+-)
+-
+-type debounceEvent struct {
+- order uint64
+- done chan struct{}
+-}
+-
+-type debouncer struct {
+- mu sync.Mutex
+- events map[string]*debounceEvent
+-}
+-
+-func newDebouncer() *debouncer {
+- return &debouncer{
+- events: make(map[string]*debounceEvent),
+- }
+-}
+-
+-// debounce returns a channel that receives a boolean reporting whether,
+-// by the time the delay channel receives a value, this call is (or will be)
+-// the most recent call with the highest order number for its key.
+-func (d *debouncer) debounce(key string, order uint64, delay <-chan time.Time) <-chan bool {
+- okc := make(chan bool, 1)
+-
+- d.mu.Lock()
+- if prev, ok := d.events[key]; ok {
+- if prev.order > order {
+- // If we have a logical ordering of events (as is the case for snapshots),
+- // don't overwrite a later event with an earlier event.
+- d.mu.Unlock()
+- okc <- false
+- return okc
+- }
+- close(prev.done)
+- }
+- done := make(chan struct{})
+- next := &debounceEvent{
+- order: order,
+- done: done,
+- }
+- d.events[key] = next
+- d.mu.Unlock()
+-
+- go func() {
+- ok := false
+- select {
+- case <-delay:
+- d.mu.Lock()
+- if d.events[key] == next {
+- ok = true
+- delete(d.events, key)
+- } else {
+- // The event was superseded before we acquired d.mu.
+- }
+- d.mu.Unlock()
+- case <-done:
+- }
+- okc <- ok
+- }()
+-
+- return okc
+-}
+diff -urN a/gopls/internal/lsp/debounce_test.go b/gopls/internal/lsp/debounce_test.go
+--- a/gopls/internal/lsp/debounce_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/debounce_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,81 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "testing"
+- "time"
+-)
+-
+-func TestDebouncer(t *testing.T) {
+- t.Parallel()
+-
+- type event struct {
+- key string
+- order uint64
+- wantFired bool
+- }
+- tests := []struct {
+- label string
+- events []*event
+- }{
+- {
+- label: "overridden",
+- events: []*event{
+- {key: "a", order: 1, wantFired: false},
+- {key: "a", order: 2, wantFired: true},
+- },
+- },
+- {
+- label: "distinct labels",
+- events: []*event{
+- {key: "a", order: 1, wantFired: true},
+- {key: "b", order: 2, wantFired: true},
+- },
+- },
+- {
+- label: "reverse order",
+- events: []*event{
+- {key: "a", order: 2, wantFired: true},
+- {key: "a", order: 1, wantFired: false},
+- },
+- },
+- {
+- label: "multiple overrides",
+- events: []*event{
+- {key: "a", order: 1, wantFired: false},
+- {key: "a", order: 2, wantFired: false},
+- {key: "a", order: 3, wantFired: false},
+- {key: "a", order: 4, wantFired: false},
+- {key: "a", order: 5, wantFired: true},
+- },
+- },
+- }
+- for _, test := range tests {
+- test := test
+- t.Run(test.label, func(t *testing.T) {
+- d := newDebouncer()
+-
+- delays := make([]chan time.Time, len(test.events))
+- okcs := make([]<-chan bool, len(test.events))
+-
+- // Register the events in deterministic order, synchronously.
+- for i, e := range test.events {
+- delays[i] = make(chan time.Time, 1)
+- okcs[i] = d.debounce(e.key, e.order, delays[i])
+- }
+-
+- // Now see which event fired.
+- for i, okc := range okcs {
+- event := test.events[i]
+- delays[i] <- time.Now()
+- fired := <-okc
+- if fired != event.wantFired {
+- t.Errorf("[key: %q, order: %d]: fired = %t, want %t", event.key, event.order, fired, event.wantFired)
+- }
+- }
+- })
+- }
+-}
+diff -urN a/gopls/internal/lsp/debug/buildinfo_go1.12.go b/gopls/internal/lsp/debug/buildinfo_go1.12.go
+--- a/gopls/internal/lsp/debug/buildinfo_go1.12.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/debug/buildinfo_go1.12.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,29 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build !go1.18
+-// +build !go1.18
+-
+-package debug
+-
+-import (
+- "runtime"
+- "runtime/debug"
+-)
+-
+-type BuildInfo struct {
+- debug.BuildInfo
+- GoVersion string // Version of Go that produced this binary
+-}
+-
+-func readBuildInfo() (*BuildInfo, bool) {
+- rinfo, ok := debug.ReadBuildInfo()
+- if !ok {
+- return nil, false
+- }
+- return &BuildInfo{
+- GoVersion: runtime.Version(),
+- BuildInfo: *rinfo,
+- }, true
+-}
+diff -urN a/gopls/internal/lsp/debug/buildinfo_go1.18.go b/gopls/internal/lsp/debug/buildinfo_go1.18.go
+--- a/gopls/internal/lsp/debug/buildinfo_go1.18.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/debug/buildinfo_go1.18.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,19 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package debug
+-
+-import (
+- "runtime/debug"
+-)
+-
+-type BuildInfo debug.BuildInfo
+-
+-func readBuildInfo() (*BuildInfo, bool) {
+- info, ok := debug.ReadBuildInfo()
+- return (*BuildInfo)(info), ok
+-}
+diff -urN a/gopls/internal/lsp/debug/info.go b/gopls/internal/lsp/debug/info.go
+--- a/gopls/internal/lsp/debug/info.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/debug/info.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,254 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package debug exports debug information for gopls.
+-package debug
+-
+-import (
+- "context"
+- "encoding/json"
+- "fmt"
+- "io"
+- "reflect"
+- "runtime"
+- "runtime/debug"
+- "sort"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-type PrintMode int
+-
+-const (
+- PlainText = PrintMode(iota)
+- Markdown
+- HTML
+- JSON
+-)
+-
+-// Version is a manually-updated mechanism for tracking versions.
+-const Version = "master"
+-
+-// ServerVersion is the format used by gopls to report its version to the
+-// client. This format is structured so that the client can parse it easily.
+-type ServerVersion struct {
+- *BuildInfo
+- Version string
+-}
+-
+-// VersionInfo returns the build info for the gopls process. If it was not
+-// built in module mode, we return a GOPATH-specific message with the
+-// hardcoded version.
+-func VersionInfo() *ServerVersion {
+- if info, ok := readBuildInfo(); ok {
+- return getVersion(info)
+- }
+- buildInfo := &BuildInfo{}
+- // go1.17 or earlier, part of s.BuildInfo are embedded fields.
+- buildInfo.Path = "gopls, built in GOPATH mode"
+- buildInfo.GoVersion = runtime.Version()
+- return &ServerVersion{
+- Version: Version,
+- BuildInfo: buildInfo,
+- }
+-}
+-
+-func getVersion(info *BuildInfo) *ServerVersion {
+- return &ServerVersion{
+- Version: Version,
+- BuildInfo: info,
+- }
+-}
+-
+-// PrintServerInfo writes HTML debug info to w for the Instance.
+-func (i *Instance) PrintServerInfo(ctx context.Context, w io.Writer) {
+- section(w, HTML, "Server Instance", func() {
+- fmt.Fprintf(w, "Start time: %v\n", i.StartTime)
+- fmt.Fprintf(w, "LogFile: %s\n", i.Logfile)
+- fmt.Fprintf(w, "Working directory: %s\n", i.Workdir)
+- fmt.Fprintf(w, "Address: %s\n", i.ServerAddress)
+- fmt.Fprintf(w, "Debug address: %s\n", i.DebugAddress())
+- })
+- PrintVersionInfo(ctx, w, true, HTML)
+- section(w, HTML, "Command Line", func() {
+- fmt.Fprintf(w, "<a href=/debug/pprof/cmdline>cmdline</a>")
+- })
+-}
+-
+-// PrintVersionInfo writes version information to w, using the output format
+-// specified by mode. verbose controls whether additional information is
+-// written, including section headers.
+-func PrintVersionInfo(_ context.Context, w io.Writer, verbose bool, mode PrintMode) error {
+- info := VersionInfo()
+- if mode == JSON {
+- return printVersionInfoJSON(w, info)
+- }
+-
+- if !verbose {
+- printBuildInfo(w, info, false, mode)
+- return nil
+- }
+- section(w, mode, "Build info", func() {
+- printBuildInfo(w, info, true, mode)
+- })
+- return nil
+-}
+-
+-func printVersionInfoJSON(w io.Writer, info *ServerVersion) error {
+- js, err := json.MarshalIndent(info, "", "\t")
+- if err != nil {
+- return err
+- }
+- _, err = fmt.Fprint(w, string(js))
+- return err
+-}
+-
+-func section(w io.Writer, mode PrintMode, title string, body func()) {
+- switch mode {
+- case PlainText:
+- fmt.Fprintln(w, title)
+- fmt.Fprintln(w, strings.Repeat("-", len(title)))
+- body()
+- case Markdown:
+- fmt.Fprintf(w, "#### %s\n\n```\n", title)
+- body()
+- fmt.Fprintf(w, "```\n")
+- case HTML:
+- fmt.Fprintf(w, "<h3>%s</h3>\n<pre>\n", title)
+- body()
+- fmt.Fprint(w, "</pre>\n")
+- }
+-}
+-
+-func printBuildInfo(w io.Writer, info *ServerVersion, verbose bool, mode PrintMode) {
+- fmt.Fprintf(w, "%v %v\n", info.Path, Version)
+- printModuleInfo(w, info.Main, mode)
+- if !verbose {
+- return
+- }
+- for _, dep := range info.Deps {
+- printModuleInfo(w, *dep, mode)
+- }
+- fmt.Fprintf(w, "go: %v\n", info.GoVersion)
+-}
+-
+-func printModuleInfo(w io.Writer, m debug.Module, _ PrintMode) {
+- fmt.Fprintf(w, " %s@%s", m.Path, m.Version)
+- if m.Sum != "" {
+- fmt.Fprintf(w, " %s", m.Sum)
+- }
+- if m.Replace != nil {
+- fmt.Fprintf(w, " => %v", m.Replace.Path)
+- }
+- fmt.Fprintf(w, "\n")
+-}
+-
+-type field struct {
+- index []int
+-}
+-
+-var fields []field
+-
+-// find all the options. The presumption is that the Options are nested structs
+-// and that pointers don't need to be dereferenced
+-func swalk(t reflect.Type, ix []int, indent string) {
+- switch t.Kind() {
+- case reflect.Struct:
+- for i := 0; i < t.NumField(); i++ {
+- fld := t.Field(i)
+- ixx := append(append([]int{}, ix...), i)
+- swalk(fld.Type, ixx, indent+". ")
+- }
+- default:
+- // everything is either a struct or a field (that's an assumption about Options)
+- fields = append(fields, field{ix})
+- }
+-}
+-
+-type sessionOption struct {
+- Name string
+- Type string
+- Current string
+- Default string
+-}
+-
+-func showOptions(o *source.Options) []sessionOption {
+- var out []sessionOption
+- t := reflect.TypeOf(*o)
+- swalk(t, []int{}, "")
+- v := reflect.ValueOf(*o)
+- do := reflect.ValueOf(*source.DefaultOptions())
+- for _, f := range fields {
+- val := v.FieldByIndex(f.index)
+- def := do.FieldByIndex(f.index)
+- tx := t.FieldByIndex(f.index)
+- is := strVal(val)
+- was := strVal(def)
+- out = append(out, sessionOption{
+- Name: tx.Name,
+- Type: tx.Type.String(),
+- Current: is,
+- Default: was,
+- })
+- }
+- sort.Slice(out, func(i, j int) bool {
+- rd := out[i].Current == out[i].Default
+- ld := out[j].Current == out[j].Default
+- if rd != ld {
+- return ld
+- }
+- return out[i].Name < out[j].Name
+- })
+- return out
+-}
+-
+-func strVal(val reflect.Value) string {
+- switch val.Kind() {
+- case reflect.Bool:
+- return fmt.Sprintf("%v", val.Interface())
+- case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
+- return fmt.Sprintf("%v", val.Interface())
+- case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64:
+- return fmt.Sprintf("%v", val.Interface())
+- case reflect.Uintptr, reflect.UnsafePointer:
+- return fmt.Sprintf("0x%x", val.Pointer())
+- case reflect.Complex64, reflect.Complex128:
+- return fmt.Sprintf("%v", val.Complex())
+- case reflect.Array, reflect.Slice:
+- ans := []string{}
+- for i := 0; i < val.Len(); i++ {
+- ans = append(ans, strVal(val.Index(i)))
+- }
+- sort.Strings(ans)
+- return fmt.Sprintf("%v", ans)
+- case reflect.Chan, reflect.Func, reflect.Ptr:
+- return val.Kind().String()
+- case reflect.Struct:
+- var x source.Analyzer
+- if val.Type() != reflect.TypeOf(x) {
+- return val.Kind().String()
+- }
+- // this is sort of ugly, but usable
+- str := val.FieldByName("Analyzer").Elem().FieldByName("Doc").String()
+- ix := strings.Index(str, "\n")
+- if ix == -1 {
+- ix = len(str)
+- }
+- return str[:ix]
+- case reflect.String:
+- return fmt.Sprintf("%q", val.Interface())
+- case reflect.Map:
+- ans := []string{}
+- iter := val.MapRange()
+- for iter.Next() {
+- k := iter.Key()
+- v := iter.Value()
+- ans = append(ans, fmt.Sprintf("%s:%s, ", strVal(k), strVal(v)))
+- }
+- sort.Strings(ans)
+- return fmt.Sprintf("%v", ans)
+- }
+- return fmt.Sprintf("??%s??", val.Type())
+-}
+diff -urN a/gopls/internal/lsp/debug/info_test.go b/gopls/internal/lsp/debug/info_test.go
+--- a/gopls/internal/lsp/debug/info_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/debug/info_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,47 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package debug exports debug information for gopls.
+-package debug
+-
+-import (
+- "bytes"
+- "context"
+- "encoding/json"
+- "runtime"
+- "testing"
+-)
+-
+-func TestPrintVersionInfoJSON(t *testing.T) {
+- buf := new(bytes.Buffer)
+- if err := PrintVersionInfo(context.Background(), buf, true, JSON); err != nil {
+- t.Fatalf("PrintVersionInfo failed: %v", err)
+- }
+- res := buf.Bytes()
+-
+- var got ServerVersion
+- if err := json.Unmarshal(res, &got); err != nil {
+- t.Fatalf("unexpected output: %v\n%s", err, res)
+- }
+- if g, w := got.GoVersion, runtime.Version(); g != w {
+- t.Errorf("go version = %v, want %v", g, w)
+- }
+- if g, w := got.Version, Version; g != w {
+- t.Errorf("gopls version = %v, want %v", g, w)
+- }
+- // Other fields of BuildInfo may not be available during test.
+-}
+-
+-func TestPrintVersionInfoPlainText(t *testing.T) {
+- buf := new(bytes.Buffer)
+- if err := PrintVersionInfo(context.Background(), buf, true, PlainText); err != nil {
+- t.Fatalf("PrintVersionInfo failed: %v", err)
+- }
+- res := buf.Bytes()
+-
+- // Other fields of BuildInfo may not be available during test.
+- if !bytes.Contains(res, []byte(Version)) || !bytes.Contains(res, []byte(runtime.Version())) {
+- t.Errorf("plaintext output = %q,\nwant (version: %v, go: %v)", res, Version, runtime.Version())
+- }
+-}
+diff -urN a/gopls/internal/lsp/debug/log/log.go b/gopls/internal/lsp/debug/log/log.go
+--- a/gopls/internal/lsp/debug/log/log.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/debug/log/log.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,43 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package log provides helper methods for exporting log events to the
+-// internal/event package.
+-package log
+-
+-import (
+- "context"
+- "fmt"
+-
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/label"
+- "golang.org/x/tools/internal/event/tag"
+-)
+-
+-// Level parameterizes log severity.
+-type Level int
+-
+-const (
+- _ Level = iota
+- Error
+- Warning
+- Info
+- Debug
+- Trace
+-)
+-
+-// Log exports a log event labeled with level l.
+-func (l Level) Log(ctx context.Context, msg string) {
+- event.Log(ctx, msg, tag.Level.Of(int(l)))
+-}
+-
+-// Logf formats and exports a log event labeled with level l.
+-func (l Level) Logf(ctx context.Context, format string, args ...interface{}) {
+- l.Log(ctx, fmt.Sprintf(format, args...))
+-}
+-
+-// LabeledLevel extracts the labeled log l
+-func LabeledLevel(lm label.Map) Level {
+- return Level(tag.Level.Get(lm))
+-}
+diff -urN a/gopls/internal/lsp/debug/metrics.go b/gopls/internal/lsp/debug/metrics.go
+--- a/gopls/internal/lsp/debug/metrics.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/debug/metrics.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,58 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package debug
+-
+-import (
+- "golang.org/x/tools/internal/event/export/metric"
+- "golang.org/x/tools/internal/event/label"
+- "golang.org/x/tools/internal/event/tag"
+-)
+-
+-var (
+- // the distributions we use for histograms
+- bytesDistribution = []int64{1 << 10, 1 << 11, 1 << 12, 1 << 14, 1 << 16, 1 << 20}
+- millisecondsDistribution = []float64{0.1, 0.5, 1, 2, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000, 100000}
+-
+- receivedBytes = metric.HistogramInt64{
+- Name: "received_bytes",
+- Description: "Distribution of received bytes, by method.",
+- Keys: []label.Key{tag.RPCDirection, tag.Method},
+- Buckets: bytesDistribution,
+- }
+-
+- sentBytes = metric.HistogramInt64{
+- Name: "sent_bytes",
+- Description: "Distribution of sent bytes, by method.",
+- Keys: []label.Key{tag.RPCDirection, tag.Method},
+- Buckets: bytesDistribution,
+- }
+-
+- latency = metric.HistogramFloat64{
+- Name: "latency",
+- Description: "Distribution of latency in milliseconds, by method.",
+- Keys: []label.Key{tag.RPCDirection, tag.Method},
+- Buckets: millisecondsDistribution,
+- }
+-
+- started = metric.Scalar{
+- Name: "started",
+- Description: "Count of RPCs started by method.",
+- Keys: []label.Key{tag.RPCDirection, tag.Method},
+- }
+-
+- completed = metric.Scalar{
+- Name: "completed",
+- Description: "Count of RPCs completed by method and status.",
+- Keys: []label.Key{tag.RPCDirection, tag.Method, tag.StatusCode},
+- }
+-)
+-
+-func registerMetrics(m *metric.Config) {
+- receivedBytes.Record(m, tag.ReceivedBytes)
+- sentBytes.Record(m, tag.SentBytes)
+- latency.Record(m, tag.Latency)
+- started.Count(m, tag.Started)
+- completed.Count(m, tag.Latency)
+-}
+diff -urN a/gopls/internal/lsp/debug/rpc.go b/gopls/internal/lsp/debug/rpc.go
+--- a/gopls/internal/lsp/debug/rpc.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/debug/rpc.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,239 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package debug
+-
+-import (
+- "context"
+- "fmt"
+- "html/template"
+- "net/http"
+- "sort"
+- "sync"
+- "time"
+-
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/core"
+- "golang.org/x/tools/internal/event/export"
+- "golang.org/x/tools/internal/event/label"
+- "golang.org/x/tools/internal/event/tag"
+-)
+-
+-var RPCTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse(`
+-{{define "title"}}RPC Information{{end}}
+-{{define "body"}}
+- <H2>Inbound</H2>
+- {{template "rpcSection" .Inbound}}
+- <H2>Outbound</H2>
+- {{template "rpcSection" .Outbound}}
+-{{end}}
+-{{define "rpcSection"}}
+- {{range .}}<P>
+- <b>{{.Method}}</b> {{.Started}} <a href="/trace/{{.Method}}">traces</a> ({{.InProgress}} in progress)
+- <br>
+- <i>Latency</i> {{with .Latency}}{{.Mean}} ({{.Min}}<{{.Max}}){{end}}
+- <i>By bucket</i> 0s {{range .Latency.Values}}{{if gt .Count 0}}<b>{{.Count}}</b> {{.Limit}} {{end}}{{end}}
+- <br>
+- <i>Received</i> {{.Received}} (avg. {{.ReceivedMean}})
+- <i>Sent</i> {{.Sent}} (avg. {{.SentMean}})
+- <br>
+- <i>Result codes</i> {{range .Codes}}{{.Key}}={{.Count}} {{end}}
+- </P>
+- {{end}}
+-{{end}}
+-`))
+-
+-type Rpcs struct { // exported for testing
+- mu sync.Mutex
+- Inbound []*rpcStats // stats for incoming lsp rpcs sorted by method name
+- Outbound []*rpcStats // stats for outgoing lsp rpcs sorted by method name
+-}
+-
+-type rpcStats struct {
+- Method string
+- Started int64
+- Completed int64
+-
+- Latency rpcTimeHistogram
+- Received byteUnits
+- Sent byteUnits
+- Codes []*rpcCodeBucket
+-}
+-
+-type rpcTimeHistogram struct {
+- Sum timeUnits
+- Count int64
+- Min timeUnits
+- Max timeUnits
+- Values []rpcTimeBucket
+-}
+-
+-type rpcTimeBucket struct {
+- Limit timeUnits
+- Count int64
+-}
+-
+-type rpcCodeBucket struct {
+- Key string
+- Count int64
+-}
+-
+-func (r *Rpcs) ProcessEvent(ctx context.Context, ev core.Event, lm label.Map) context.Context {
+- r.mu.Lock()
+- defer r.mu.Unlock()
+- switch {
+- case event.IsStart(ev):
+- if _, stats := r.getRPCSpan(ctx, ev); stats != nil {
+- stats.Started++
+- }
+- case event.IsEnd(ev):
+- span, stats := r.getRPCSpan(ctx, ev)
+- if stats != nil {
+- endRPC(ctx, ev, span, stats)
+- }
+- case event.IsMetric(ev):
+- sent := byteUnits(tag.SentBytes.Get(lm))
+- rec := byteUnits(tag.ReceivedBytes.Get(lm))
+- if sent != 0 || rec != 0 {
+- if _, stats := r.getRPCSpan(ctx, ev); stats != nil {
+- stats.Sent += sent
+- stats.Received += rec
+- }
+- }
+- }
+- return ctx
+-}
+-
+-func endRPC(ctx context.Context, ev core.Event, span *export.Span, stats *rpcStats) {
+- // update the basic counts
+- stats.Completed++
+-
+- // get and record the status code
+- if status := getStatusCode(span); status != "" {
+- var b *rpcCodeBucket
+- for c, entry := range stats.Codes {
+- if entry.Key == status {
+- b = stats.Codes[c]
+- break
+- }
+- }
+- if b == nil {
+- b = &rpcCodeBucket{Key: status}
+- stats.Codes = append(stats.Codes, b)
+- sort.Slice(stats.Codes, func(i int, j int) bool {
+- return stats.Codes[i].Key < stats.Codes[j].Key
+- })
+- }
+- b.Count++
+- }
+-
+- // calculate latency if this was an rpc span
+- elapsedTime := span.Finish().At().Sub(span.Start().At())
+- latencyMillis := timeUnits(elapsedTime) / timeUnits(time.Millisecond)
+- if stats.Latency.Count == 0 {
+- stats.Latency.Min = latencyMillis
+- stats.Latency.Max = latencyMillis
+- } else {
+- if stats.Latency.Min > latencyMillis {
+- stats.Latency.Min = latencyMillis
+- }
+- if stats.Latency.Max < latencyMillis {
+- stats.Latency.Max = latencyMillis
+- }
+- }
+- stats.Latency.Count++
+- stats.Latency.Sum += latencyMillis
+- for i := range stats.Latency.Values {
+- if stats.Latency.Values[i].Limit > latencyMillis {
+- stats.Latency.Values[i].Count++
+- break
+- }
+- }
+-}
+-
+-func (r *Rpcs) getRPCSpan(ctx context.Context, ev core.Event) (*export.Span, *rpcStats) {
+- // get the span
+- span := export.GetSpan(ctx)
+- if span == nil {
+- return nil, nil
+- }
+- // use the span start event look up the correct stats block
+- // we do this because it prevents us matching a sub span
+- return span, r.getRPCStats(span.Start())
+-}
+-
+-func (r *Rpcs) getRPCStats(lm label.Map) *rpcStats {
+- method := tag.Method.Get(lm)
+- if method == "" {
+- return nil
+- }
+- set := &r.Inbound
+- if tag.RPCDirection.Get(lm) != tag.Inbound {
+- set = &r.Outbound
+- }
+- // get the record for this method
+- index := sort.Search(len(*set), func(i int) bool {
+- return (*set)[i].Method >= method
+- })
+-
+- if index < len(*set) && (*set)[index].Method == method {
+- return (*set)[index]
+- }
+-
+- old := *set
+- *set = make([]*rpcStats, len(old)+1)
+- copy(*set, old[:index])
+- copy((*set)[index+1:], old[index:])
+- stats := &rpcStats{Method: method}
+- stats.Latency.Values = make([]rpcTimeBucket, len(millisecondsDistribution))
+- for i, m := range millisecondsDistribution {
+- stats.Latency.Values[i].Limit = timeUnits(m)
+- }
+- (*set)[index] = stats
+- return stats
+-}
+-
+-func (s *rpcStats) InProgress() int64 { return s.Started - s.Completed }
+-func (s *rpcStats) SentMean() byteUnits { return s.Sent / byteUnits(s.Started) }
+-func (s *rpcStats) ReceivedMean() byteUnits { return s.Received / byteUnits(s.Started) }
+-
+-func (h *rpcTimeHistogram) Mean() timeUnits { return h.Sum / timeUnits(h.Count) }
+-
+-func getStatusCode(span *export.Span) string {
+- for _, ev := range span.Events() {
+- if status := tag.StatusCode.Get(ev); status != "" {
+- return status
+- }
+- }
+- return ""
+-}
+-
+-func (r *Rpcs) getData(req *http.Request) interface{} {
+- return r
+-}
+-
+-func units(v float64, suffixes []string) string {
+- s := ""
+- for _, s = range suffixes {
+- n := v / 1000
+- if n < 1 {
+- break
+- }
+- v = n
+- }
+- return fmt.Sprintf("%.2f%s", v, s)
+-}
+-
+-type timeUnits float64
+-
+-func (v timeUnits) String() string {
+- v = v * 1000 * 1000
+- return units(float64(v), []string{"ns", "μs", "ms", "s"})
+-}
+-
+-type byteUnits float64
+-
+-func (v byteUnits) String() string {
+- return units(float64(v), []string{"B", "KB", "MB", "GB", "TB"})
+-}
+diff -urN a/gopls/internal/lsp/debug/serve.go b/gopls/internal/lsp/debug/serve.go
+--- a/gopls/internal/lsp/debug/serve.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/debug/serve.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,909 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package debug
+-
+-import (
+- "archive/zip"
+- "bytes"
+- "context"
+- "errors"
+- "fmt"
+- "html/template"
+- "io"
+- stdlog "log"
+- "net"
+- "net/http"
+- "net/http/pprof"
+- "os"
+- "path"
+- "path/filepath"
+- "runtime"
+- rpprof "runtime/pprof"
+- "strconv"
+- "strings"
+- "sync"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/lsp/cache"
+- "golang.org/x/tools/gopls/internal/lsp/debug/log"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/core"
+- "golang.org/x/tools/internal/event/export"
+- "golang.org/x/tools/internal/event/export/metric"
+- "golang.org/x/tools/internal/event/export/ocagent"
+- "golang.org/x/tools/internal/event/export/prometheus"
+- "golang.org/x/tools/internal/event/keys"
+- "golang.org/x/tools/internal/event/label"
+- "golang.org/x/tools/internal/event/tag"
+-)
+-
+-type contextKeyType int
+-
+-const (
+- instanceKey contextKeyType = iota
+- traceKey
+-)
+-
+-// An Instance holds all debug information associated with a gopls instance.
+-type Instance struct {
+- Logfile string
+- StartTime time.Time
+- ServerAddress string
+- Workdir string
+- OCAgentConfig string
+-
+- LogWriter io.Writer
+-
+- exporter event.Exporter
+-
+- ocagent *ocagent.Exporter
+- prometheus *prometheus.Exporter
+- rpcs *Rpcs
+- traces *traces
+- State *State
+-
+- serveMu sync.Mutex
+- debugAddress string
+- listenedDebugAddress string
+-}
+-
+-// State holds debugging information related to the server state.
+-type State struct {
+- mu sync.Mutex
+- clients []*Client
+- servers []*Server
+-}
+-
+-func (st *State) Bugs() []bug.Bug {
+- return bug.List()
+-}
+-
+-// Caches returns the set of Cache objects currently being served.
+-func (st *State) Caches() []*cache.Cache {
+- var caches []*cache.Cache
+- seen := make(map[string]struct{})
+- for _, client := range st.Clients() {
+- cache := client.Session.Cache()
+- if _, found := seen[cache.ID()]; found {
+- continue
+- }
+- seen[cache.ID()] = struct{}{}
+- caches = append(caches, cache)
+- }
+- return caches
+-}
+-
+-// Cache returns the Cache that matches the supplied id.
+-func (st *State) Cache(id string) *cache.Cache {
+- for _, c := range st.Caches() {
+- if c.ID() == id {
+- return c
+- }
+- }
+- return nil
+-}
+-
+-// Sessions returns the set of Session objects currently being served.
+-func (st *State) Sessions() []*cache.Session {
+- var sessions []*cache.Session
+- for _, client := range st.Clients() {
+- sessions = append(sessions, client.Session)
+- }
+- return sessions
+-}
+-
+-// Session returns the Session that matches the supplied id.
+-func (st *State) Session(id string) *cache.Session {
+- for _, s := range st.Sessions() {
+- if s.ID() == id {
+- return s
+- }
+- }
+- return nil
+-}
+-
+-// Views returns the set of View objects currently being served.
+-func (st *State) Views() []*cache.View {
+- var views []*cache.View
+- for _, s := range st.Sessions() {
+- views = append(views, s.Views()...)
+- }
+- return views
+-}
+-
+-// View returns the View that matches the supplied id.
+-func (st *State) View(id string) *cache.View {
+- for _, v := range st.Views() {
+- if v.ID() == id {
+- return v
+- }
+- }
+- return nil
+-}
+-
+-// Clients returns the set of Clients currently being served.
+-func (st *State) Clients() []*Client {
+- st.mu.Lock()
+- defer st.mu.Unlock()
+- clients := make([]*Client, len(st.clients))
+- copy(clients, st.clients)
+- return clients
+-}
+-
+-// Client returns the Client matching the supplied id.
+-func (st *State) Client(id string) *Client {
+- for _, c := range st.Clients() {
+- if c.Session.ID() == id {
+- return c
+- }
+- }
+- return nil
+-}
+-
+-// Servers returns the set of Servers the instance is currently connected to.
+-func (st *State) Servers() []*Server {
+- st.mu.Lock()
+- defer st.mu.Unlock()
+- servers := make([]*Server, len(st.servers))
+- copy(servers, st.servers)
+- return servers
+-}
+-
+-// A Client is an incoming connection from a remote client.
+-type Client struct {
+- Session *cache.Session
+- DebugAddress string
+- Logfile string
+- GoplsPath string
+- ServerID string
+- Service protocol.Server
+-}
+-
+-// A Server is an outgoing connection to a remote LSP server.
+-type Server struct {
+- ID string
+- DebugAddress string
+- Logfile string
+- GoplsPath string
+- ClientID string
+-}
+-
+-// addClient adds a client to the set being served.
+-func (st *State) addClient(session *cache.Session) {
+- st.mu.Lock()
+- defer st.mu.Unlock()
+- st.clients = append(st.clients, &Client{Session: session})
+-}
+-
+-// dropClient removes a client from the set being served.
+-func (st *State) dropClient(session *cache.Session) {
+- st.mu.Lock()
+- defer st.mu.Unlock()
+- for i, c := range st.clients {
+- if c.Session == session {
+- copy(st.clients[i:], st.clients[i+1:])
+- st.clients[len(st.clients)-1] = nil
+- st.clients = st.clients[:len(st.clients)-1]
+- return
+- }
+- }
+-}
+-
+-// updateServer updates a server to the set being queried. In practice, there should
+-// be at most one remote server.
+-func (st *State) updateServer(server *Server) {
+- st.mu.Lock()
+- defer st.mu.Unlock()
+- for i, existing := range st.servers {
+- if existing.ID == server.ID {
+- // Replace, rather than mutate, to avoid a race.
+- newServers := make([]*Server, len(st.servers))
+- copy(newServers, st.servers[:i])
+- newServers[i] = server
+- copy(newServers[i+1:], st.servers[i+1:])
+- st.servers = newServers
+- return
+- }
+- }
+- st.servers = append(st.servers, server)
+-}
+-
+-// dropServer drops a server from the set being queried.
+-func (st *State) dropServer(id string) {
+- st.mu.Lock()
+- defer st.mu.Unlock()
+- for i, s := range st.servers {
+- if s.ID == id {
+- copy(st.servers[i:], st.servers[i+1:])
+- st.servers[len(st.servers)-1] = nil
+- st.servers = st.servers[:len(st.servers)-1]
+- return
+- }
+- }
+-}
+-
+-// an http.ResponseWriter that filters writes
+-type filterResponse struct {
+- w http.ResponseWriter
+- edit func([]byte) []byte
+-}
+-
+-func (c filterResponse) Header() http.Header {
+- return c.w.Header()
+-}
+-
+-func (c filterResponse) Write(buf []byte) (int, error) {
+- ans := c.edit(buf)
+- return c.w.Write(ans)
+-}
+-
+-func (c filterResponse) WriteHeader(n int) {
+- c.w.WriteHeader(n)
+-}
+-
+-// replace annoying nuls by spaces
+-func cmdline(w http.ResponseWriter, r *http.Request) {
+- fake := filterResponse{
+- w: w,
+- edit: func(buf []byte) []byte {
+- return bytes.ReplaceAll(buf, []byte{0}, []byte{' '})
+- },
+- }
+- pprof.Cmdline(fake, r)
+-}
+-
+-func (i *Instance) getCache(r *http.Request) interface{} {
+- return i.State.Cache(path.Base(r.URL.Path))
+-}
+-
+-func (i *Instance) getSession(r *http.Request) interface{} {
+- return i.State.Session(path.Base(r.URL.Path))
+-}
+-
+-func (i *Instance) getClient(r *http.Request) interface{} {
+- return i.State.Client(path.Base(r.URL.Path))
+-}
+-
+-func (i *Instance) getServer(r *http.Request) interface{} {
+- i.State.mu.Lock()
+- defer i.State.mu.Unlock()
+- id := path.Base(r.URL.Path)
+- for _, s := range i.State.servers {
+- if s.ID == id {
+- return s
+- }
+- }
+- return nil
+-}
+-
+-func (i *Instance) getView(r *http.Request) interface{} {
+- return i.State.View(path.Base(r.URL.Path))
+-}
+-
+-func (i *Instance) getFile(r *http.Request) interface{} {
+- identifier := path.Base(r.URL.Path)
+- sid := path.Base(path.Dir(r.URL.Path))
+- s := i.State.Session(sid)
+- if s == nil {
+- return nil
+- }
+- for _, o := range s.Overlays() {
+- // TODO(adonovan): understand and document this comparison.
+- if o.FileIdentity().Hash.String() == identifier {
+- return o
+- }
+- }
+- return nil
+-}
+-
+-func (i *Instance) getInfo(r *http.Request) interface{} {
+- buf := &bytes.Buffer{}
+- i.PrintServerInfo(r.Context(), buf)
+- return template.HTML(buf.String())
+-}
+-
+-func (i *Instance) AddService(s protocol.Server, session *cache.Session) {
+- for _, c := range i.State.clients {
+- if c.Session == session {
+- c.Service = s
+- return
+- }
+- }
+- stdlog.Printf("unable to find a Client to add the protocol.Server to")
+-}
+-
+-func getMemory(_ *http.Request) interface{} {
+- var m runtime.MemStats
+- runtime.ReadMemStats(&m)
+- return m
+-}
+-
+-func init() {
+- event.SetExporter(makeGlobalExporter(os.Stderr))
+-}
+-
+-func GetInstance(ctx context.Context) *Instance {
+- if ctx == nil {
+- return nil
+- }
+- v := ctx.Value(instanceKey)
+- if v == nil {
+- return nil
+- }
+- return v.(*Instance)
+-}
+-
+-// WithInstance creates debug instance ready for use using the supplied
+-// configuration and stores it in the returned context.
+-func WithInstance(ctx context.Context, workdir, agent string) context.Context {
+- i := &Instance{
+- StartTime: time.Now(),
+- Workdir: workdir,
+- OCAgentConfig: agent,
+- }
+- i.LogWriter = os.Stderr
+- ocConfig := ocagent.Discover()
+- //TODO: we should not need to adjust the discovered configuration
+- ocConfig.Address = i.OCAgentConfig
+- i.ocagent = ocagent.Connect(ocConfig)
+- i.prometheus = prometheus.New()
+- i.rpcs = &Rpcs{}
+- i.traces = &traces{}
+- i.State = &State{}
+- i.exporter = makeInstanceExporter(i)
+- return context.WithValue(ctx, instanceKey, i)
+-}
+-
+-// SetLogFile sets the logfile for use with this instance.
+-func (i *Instance) SetLogFile(logfile string, isDaemon bool) (func(), error) {
+- // TODO: probably a better solution for deferring closure to the caller would
+- // be for the debug instance to itself be closed, but this fixes the
+- // immediate bug of logs not being captured.
+- closeLog := func() {}
+- if logfile != "" {
+- if logfile == "auto" {
+- if isDaemon {
+- logfile = filepath.Join(os.TempDir(), fmt.Sprintf("gopls-daemon-%d.log", os.Getpid()))
+- } else {
+- logfile = filepath.Join(os.TempDir(), fmt.Sprintf("gopls-%d.log", os.Getpid()))
+- }
+- }
+- f, err := os.Create(logfile)
+- if err != nil {
+- return nil, fmt.Errorf("unable to create log file: %w", err)
+- }
+- closeLog = func() {
+- defer f.Close()
+- }
+- stdlog.SetOutput(io.MultiWriter(os.Stderr, f))
+- i.LogWriter = f
+- }
+- i.Logfile = logfile
+- return closeLog, nil
+-}
+-
+-// Serve starts and runs a debug server in the background on the given addr.
+-// It also logs the port the server starts on, to allow for :0 auto assigned
+-// ports.
+-func (i *Instance) Serve(ctx context.Context, addr string) (string, error) {
+- stdlog.SetFlags(stdlog.Lshortfile)
+- if addr == "" {
+- return "", nil
+- }
+- i.serveMu.Lock()
+- defer i.serveMu.Unlock()
+-
+- if i.listenedDebugAddress != "" {
+- // Already serving. Return the bound address.
+- return i.listenedDebugAddress, nil
+- }
+-
+- i.debugAddress = addr
+- listener, err := net.Listen("tcp", i.debugAddress)
+- if err != nil {
+- return "", err
+- }
+- i.listenedDebugAddress = listener.Addr().String()
+-
+- port := listener.Addr().(*net.TCPAddr).Port
+- if strings.HasSuffix(i.debugAddress, ":0") {
+- stdlog.Printf("debug server listening at http://localhost:%d", port)
+- }
+- event.Log(ctx, "Debug serving", tag.Port.Of(port))
+- go func() {
+- mux := http.NewServeMux()
+- mux.HandleFunc("/", render(MainTmpl, func(*http.Request) interface{} { return i }))
+- mux.HandleFunc("/debug/", render(DebugTmpl, nil))
+- mux.HandleFunc("/debug/pprof/", pprof.Index)
+- mux.HandleFunc("/debug/pprof/cmdline", cmdline)
+- mux.HandleFunc("/debug/pprof/profile", pprof.Profile)
+- mux.HandleFunc("/debug/pprof/symbol", pprof.Symbol)
+- mux.HandleFunc("/debug/pprof/trace", pprof.Trace)
+- if i.prometheus != nil {
+- mux.HandleFunc("/metrics/", i.prometheus.Serve)
+- }
+- if i.rpcs != nil {
+- mux.HandleFunc("/rpc/", render(RPCTmpl, i.rpcs.getData))
+- }
+- if i.traces != nil {
+- mux.HandleFunc("/trace/", render(TraceTmpl, i.traces.getData))
+- }
+- mux.HandleFunc("/cache/", render(CacheTmpl, i.getCache))
+- mux.HandleFunc("/session/", render(SessionTmpl, i.getSession))
+- mux.HandleFunc("/view/", render(ViewTmpl, i.getView))
+- mux.HandleFunc("/client/", render(ClientTmpl, i.getClient))
+- mux.HandleFunc("/server/", render(ServerTmpl, i.getServer))
+- mux.HandleFunc("/file/", render(FileTmpl, i.getFile))
+- mux.HandleFunc("/info", render(InfoTmpl, i.getInfo))
+- mux.HandleFunc("/memory", render(MemoryTmpl, getMemory))
+-
+- // Internal debugging helpers.
+- mux.HandleFunc("/_dogc", func(w http.ResponseWriter, r *http.Request) {
+- runtime.GC()
+- runtime.GC()
+- runtime.GC()
+- http.Error(w, "OK", 200)
+- })
+- mux.HandleFunc("/_makeabug", func(w http.ResponseWriter, r *http.Request) {
+- bug.Report("bug here", nil)
+- http.Error(w, "made a bug", http.StatusOK)
+- })
+-
+- if err := http.Serve(listener, mux); err != nil {
+- event.Error(ctx, "Debug server failed", err)
+- return
+- }
+- event.Log(ctx, "Debug server finished")
+- }()
+- return i.listenedDebugAddress, nil
+-}
+-
+-func (i *Instance) DebugAddress() string {
+- i.serveMu.Lock()
+- defer i.serveMu.Unlock()
+- return i.debugAddress
+-}
+-
+-func (i *Instance) ListenedDebugAddress() string {
+- i.serveMu.Lock()
+- defer i.serveMu.Unlock()
+- return i.listenedDebugAddress
+-}
+-
+-// MonitorMemory starts recording memory statistics each second.
+-func (i *Instance) MonitorMemory(ctx context.Context) {
+- tick := time.NewTicker(time.Second)
+- nextThresholdGiB := uint64(1)
+- go func() {
+- for {
+- <-tick.C
+- var mem runtime.MemStats
+- runtime.ReadMemStats(&mem)
+- if mem.HeapAlloc < nextThresholdGiB*1<<30 {
+- continue
+- }
+- if err := i.writeMemoryDebug(nextThresholdGiB, true); err != nil {
+- event.Error(ctx, "writing memory debug info", err)
+- }
+- if err := i.writeMemoryDebug(nextThresholdGiB, false); err != nil {
+- event.Error(ctx, "writing memory debug info", err)
+- }
+- event.Log(ctx, fmt.Sprintf("Wrote memory usage debug info to %v", os.TempDir()))
+- nextThresholdGiB++
+- }
+- }()
+-}
+-
+-func (i *Instance) writeMemoryDebug(threshold uint64, withNames bool) error {
+- suffix := "withnames"
+- if !withNames {
+- suffix = "nonames"
+- }
+-
+- filename := fmt.Sprintf("gopls.%d-%dGiB-%s.zip", os.Getpid(), threshold, suffix)
+- zipf, err := os.OpenFile(filepath.Join(os.TempDir(), filename), os.O_CREATE|os.O_RDWR, 0644)
+- if err != nil {
+- return err
+- }
+- zipw := zip.NewWriter(zipf)
+-
+- f, err := zipw.Create("heap.pb.gz")
+- if err != nil {
+- return err
+- }
+- if err := rpprof.Lookup("heap").WriteTo(f, 0); err != nil {
+- return err
+- }
+-
+- f, err = zipw.Create("goroutines.txt")
+- if err != nil {
+- return err
+- }
+- if err := rpprof.Lookup("goroutine").WriteTo(f, 1); err != nil {
+- return err
+- }
+-
+- if err := zipw.Close(); err != nil {
+- return err
+- }
+- return zipf.Close()
+-}
+-
+-func makeGlobalExporter(stderr io.Writer) event.Exporter {
+- p := export.Printer{}
+- var pMu sync.Mutex
+- return func(ctx context.Context, ev core.Event, lm label.Map) context.Context {
+- i := GetInstance(ctx)
+-
+- if event.IsLog(ev) {
+- // Don't log context cancellation errors.
+- if err := keys.Err.Get(ev); errors.Is(err, context.Canceled) {
+- return ctx
+- }
+- // Make sure any log messages without an instance go to stderr.
+- if i == nil {
+- pMu.Lock()
+- p.WriteEvent(stderr, ev, lm)
+- pMu.Unlock()
+- }
+- level := log.LabeledLevel(lm)
+- // Exclude trace logs from LSP logs.
+- if level < log.Trace {
+- ctx = protocol.LogEvent(ctx, ev, lm, messageType(level))
+- }
+- }
+- if i == nil {
+- return ctx
+- }
+- return i.exporter(ctx, ev, lm)
+- }
+-}
+-
+-func messageType(l log.Level) protocol.MessageType {
+- switch l {
+- case log.Error:
+- return protocol.Error
+- case log.Warning:
+- return protocol.Warning
+- case log.Debug:
+- return protocol.Log
+- }
+- return protocol.Info
+-}
+-
+-func makeInstanceExporter(i *Instance) event.Exporter {
+- exporter := func(ctx context.Context, ev core.Event, lm label.Map) context.Context {
+- if i.ocagent != nil {
+- ctx = i.ocagent.ProcessEvent(ctx, ev, lm)
+- }
+- if i.prometheus != nil {
+- ctx = i.prometheus.ProcessEvent(ctx, ev, lm)
+- }
+- if i.rpcs != nil {
+- ctx = i.rpcs.ProcessEvent(ctx, ev, lm)
+- }
+- if i.traces != nil {
+- ctx = i.traces.ProcessEvent(ctx, ev, lm)
+- }
+- if event.IsLog(ev) {
+- if s := cache.KeyCreateSession.Get(ev); s != nil {
+- i.State.addClient(s)
+- }
+- if sid := tag.NewServer.Get(ev); sid != "" {
+- i.State.updateServer(&Server{
+- ID: sid,
+- Logfile: tag.Logfile.Get(ev),
+- DebugAddress: tag.DebugAddress.Get(ev),
+- GoplsPath: tag.GoplsPath.Get(ev),
+- ClientID: tag.ClientID.Get(ev),
+- })
+- }
+- if s := cache.KeyShutdownSession.Get(ev); s != nil {
+- i.State.dropClient(s)
+- }
+- if sid := tag.EndServer.Get(ev); sid != "" {
+- i.State.dropServer(sid)
+- }
+- if s := cache.KeyUpdateSession.Get(ev); s != nil {
+- if c := i.State.Client(s.ID()); c != nil {
+- c.DebugAddress = tag.DebugAddress.Get(ev)
+- c.Logfile = tag.Logfile.Get(ev)
+- c.ServerID = tag.ServerID.Get(ev)
+- c.GoplsPath = tag.GoplsPath.Get(ev)
+- }
+- }
+- }
+- return ctx
+- }
+- // StdTrace must be above export.Spans below (by convention, export
+- // middleware applies its wrapped exporter last).
+- exporter = StdTrace(exporter)
+- metrics := metric.Config{}
+- registerMetrics(&metrics)
+- exporter = metrics.Exporter(exporter)
+- exporter = export.Spans(exporter)
+- exporter = export.Labels(exporter)
+- return exporter
+-}
+-
+-type dataFunc func(*http.Request) interface{}
+-
+-func render(tmpl *template.Template, fun dataFunc) func(http.ResponseWriter, *http.Request) {
+- return func(w http.ResponseWriter, r *http.Request) {
+- var data interface{}
+- if fun != nil {
+- data = fun(r)
+- }
+- if err := tmpl.Execute(w, data); err != nil {
+- event.Error(context.Background(), "", err)
+- http.Error(w, err.Error(), http.StatusInternalServerError)
+- }
+- }
+-}
+-
+-func commas(s string) string {
+- for i := len(s); i > 3; {
+- i -= 3
+- s = s[:i] + "," + s[i:]
+- }
+- return s
+-}
+-
+-func fuint64(v uint64) string {
+- return commas(strconv.FormatUint(v, 10))
+-}
+-
+-func fuint32(v uint32) string {
+- return commas(strconv.FormatUint(uint64(v), 10))
+-}
+-
+-func fcontent(v []byte) string {
+- return string(v)
+-}
+-
+-var BaseTemplate = template.Must(template.New("").Parse(`
+-<html>
+-<head>
+-<title>{{template "title" .}}</title>
+-<style>
+-.profile-name{
+- display:inline-block;
+- width:6rem;
+-}
+-td.value {
+- text-align: right;
+-}
+-ul.events {
+- list-style-type: none;
+-}
+-
+-</style>
+-{{block "head" .}}{{end}}
+-</head>
+-<body>
+-<a href="/">Main</a>
+-<a href="/info">Info</a>
+-<a href="/memory">Memory</a>
+-<a href="/metrics">Metrics</a>
+-<a href="/rpc">RPC</a>
+-<a href="/trace">Trace</a>
+-<hr>
+-<h1>{{template "title" .}}</h1>
+-{{block "body" .}}
+-Unknown page
+-{{end}}
+-</body>
+-</html>
+-
+-{{define "cachelink"}}<a href="/cache/{{.}}">Cache {{.}}</a>{{end}}
+-{{define "clientlink"}}<a href="/client/{{.}}">Client {{.}}</a>{{end}}
+-{{define "serverlink"}}<a href="/server/{{.}}">Server {{.}}</a>{{end}}
+-{{define "sessionlink"}}<a href="/session/{{.}}">Session {{.}}</a>{{end}}
+-{{define "viewlink"}}<a href="/view/{{.}}">View {{.}}</a>{{end}}
+-`)).Funcs(template.FuncMap{
+- "fuint64": fuint64,
+- "fuint32": fuint32,
+- "fcontent": fcontent,
+- "localAddress": func(s string) string {
+- // Try to translate loopback addresses to localhost, both for cosmetics and
+- // because unspecified ipv6 addresses can break links on Windows.
+- //
+- // TODO(rfindley): In the future, it would be better not to assume the
+- // server is running on localhost, and instead construct this address using
+- // the remote host.
+- host, port, err := net.SplitHostPort(s)
+- if err != nil {
+- return s
+- }
+- ip := net.ParseIP(host)
+- if ip == nil {
+- return s
+- }
+- if ip.IsLoopback() || ip.IsUnspecified() {
+- return "localhost:" + port
+- }
+- return s
+- },
+- "options": func(s *cache.Session) []sessionOption {
+- return showOptions(s.Options())
+- },
+-})
+-
+-var MainTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse(`
+-{{define "title"}}GoPls server information{{end}}
+-{{define "body"}}
+-<h2>Caches</h2>
+-<ul>{{range .State.Caches}}<li>{{template "cachelink" .ID}}</li>{{end}}</ul>
+-<h2>Sessions</h2>
+-<ul>{{range .State.Sessions}}<li>{{template "sessionlink" .ID}} from {{template "cachelink" .Cache.ID}}</li>{{end}}</ul>
+-<h2>Clients</h2>
+-<ul>{{range .State.Clients}}<li>{{template "clientlink" .Session.ID}}</li>{{end}}</ul>
+-<h2>Servers</h2>
+-<ul>{{range .State.Servers}}<li>{{template "serverlink" .ID}}</li>{{end}}</ul>
+-<h2>Bug reports</h2>
+-<dl>{{range .State.Bugs}}<dt>{{.Key}}</dt><dd>{{.Description}}</dd>{{end}}</dl>
+-{{end}}
+-`))
+-
+-var InfoTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse(`
+-{{define "title"}}GoPls version information{{end}}
+-{{define "body"}}
+-{{.}}
+-{{end}}
+-`))
+-
+-var MemoryTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse(`
+-{{define "title"}}GoPls memory usage{{end}}
+-{{define "head"}}<meta http-equiv="refresh" content="5">{{end}}
+-{{define "body"}}
+-<h2>Stats</h2>
+-<table>
+-<tr><td class="label">Allocated bytes</td><td class="value">{{fuint64 .HeapAlloc}}</td></tr>
+-<tr><td class="label">Total allocated bytes</td><td class="value">{{fuint64 .TotalAlloc}}</td></tr>
+-<tr><td class="label">System bytes</td><td class="value">{{fuint64 .Sys}}</td></tr>
+-<tr><td class="label">Heap system bytes</td><td class="value">{{fuint64 .HeapSys}}</td></tr>
+-<tr><td class="label">Malloc calls</td><td class="value">{{fuint64 .Mallocs}}</td></tr>
+-<tr><td class="label">Frees</td><td class="value">{{fuint64 .Frees}}</td></tr>
+-<tr><td class="label">Idle heap bytes</td><td class="value">{{fuint64 .HeapIdle}}</td></tr>
+-<tr><td class="label">In use bytes</td><td class="value">{{fuint64 .HeapInuse}}</td></tr>
+-<tr><td class="label">Released to system bytes</td><td class="value">{{fuint64 .HeapReleased}}</td></tr>
+-<tr><td class="label">Heap object count</td><td class="value">{{fuint64 .HeapObjects}}</td></tr>
+-<tr><td class="label">Stack in use bytes</td><td class="value">{{fuint64 .StackInuse}}</td></tr>
+-<tr><td class="label">Stack from system bytes</td><td class="value">{{fuint64 .StackSys}}</td></tr>
+-<tr><td class="label">Bucket hash bytes</td><td class="value">{{fuint64 .BuckHashSys}}</td></tr>
+-<tr><td class="label">GC metadata bytes</td><td class="value">{{fuint64 .GCSys}}</td></tr>
+-<tr><td class="label">Off heap bytes</td><td class="value">{{fuint64 .OtherSys}}</td></tr>
+-</table>
+-<h2>By size</h2>
+-<table>
+-<tr><th>Size</th><th>Mallocs</th><th>Frees</th></tr>
+-{{range .BySize}}<tr><td class="value">{{fuint32 .Size}}</td><td class="value">{{fuint64 .Mallocs}}</td><td class="value">{{fuint64 .Frees}}</td></tr>{{end}}
+-</table>
+-{{end}}
+-`))
+-
+-var DebugTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse(`
+-{{define "title"}}GoPls Debug pages{{end}}
+-{{define "body"}}
+-<a href="/debug/pprof">Profiling</a>
+-{{end}}
+-`))
+-
+-var CacheTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse(`
+-{{define "title"}}Cache {{.ID}}{{end}}
+-{{define "body"}}
+-<h2>memoize.Store entries</h2>
+-<ul>{{range $k,$v := .MemStats}}<li>{{$k}} - {{$v}}</li>{{end}}</ul>
+-{{end}}
+-`))
+-
+-var ClientTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse(`
+-{{define "title"}}Client {{.Session.ID}}{{end}}
+-{{define "body"}}
+-Using session: <b>{{template "sessionlink" .Session.ID}}</b><br>
+-{{if .DebugAddress}}Debug this client at: <a href="http://{{localAddress .DebugAddress}}">{{localAddress .DebugAddress}}</a><br>{{end}}
+-Logfile: {{.Logfile}}<br>
+-Gopls Path: {{.GoplsPath}}<br>
+-<h2>Diagnostics</h2>
+-{{/*Service: []protocol.Server; each server has map[uri]fileReports;
+- each fileReport: map[diagnosticSoure]diagnosticReport
+- diagnosticSource is one of 5 source
+- diagnosticReport: snapshotID and map[hash]*source.Diagnostic
+- sourceDiagnostic: struct {
+- Range protocol.Range
+- Message string
+- Source string
+- Code string
+- CodeHref string
+- Severity protocol.DiagnosticSeverity
+- Tags []protocol.DiagnosticTag
+-
+- Related []RelatedInformation
+- }
+- RelatedInformation: struct {
+- URI span.URI
+- Range protocol.Range
+- Message string
+- }
+- */}}
+-<ul>{{range $k, $v := .Service.Diagnostics}}<li>{{$k}}:<ol>{{range $v}}<li>{{.}}</li>{{end}}</ol></li>{{end}}</ul>
+-{{end}}
+-`))
+-
+-var ServerTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse(`
+-{{define "title"}}Server {{.ID}}{{end}}
+-{{define "body"}}
+-{{if .DebugAddress}}Debug this server at: <a href="http://{{localAddress .DebugAddress}}">{{localAddress .DebugAddress}}</a><br>{{end}}
+-Logfile: {{.Logfile}}<br>
+-Gopls Path: {{.GoplsPath}}<br>
+-{{end}}
+-`))
+-
+-var SessionTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse(`
+-{{define "title"}}Session {{.ID}}{{end}}
+-{{define "body"}}
+-From: <b>{{template "cachelink" .Cache.ID}}</b><br>
+-<h2>Views</h2>
+-<ul>{{range .Views}}<li>{{.Name}} is {{template "viewlink" .ID}} in {{.Folder}}</li>{{end}}</ul>
+-<h2>Overlays</h2>
+-{{$session := .}}
+-<ul>{{range .Overlays}}
+-<li>
+-<a href="/file/{{$session.ID}}/{{.FileIdentity.Hash}}">{{.FileIdentity.URI}}</a>
+-</li>{{end}}</ul>
+-<h2>Options</h2>
+-{{range options .}}
+-<p><b>{{.Name}}</b> {{.Type}}</p>
+-<p><i>default:</i> {{.Default}}</p>
+-{{if ne .Default .Current}}<p><i>current:</i> {{.Current}}</p>{{end}}
+-{{end}}
+-{{end}}
+-`))
+-
+-var ViewTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse(`
+-{{define "title"}}View {{.ID}}{{end}}
+-{{define "body"}}
+-Name: <b>{{.Name}}</b><br>
+-Folder: <b>{{.Folder}}</b><br>
+-<h2>Environment</h2>
+-<ul>{{range .Options.Env}}<li>{{.}}</li>{{end}}</ul>
+-{{end}}
+-`))
+-
+-var FileTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse(`
+-{{define "title"}}Overlay {{.FileIdentity.Hash}}{{end}}
+-{{define "body"}}
+-{{with .}}
+- URI: <b>{{.URI}}</b><br>
+- Identifier: <b>{{.FileIdentity.Hash}}</b><br>
+- Version: <b>{{.Version}}</b><br>
+- Kind: <b>{{.Kind}}</b><br>
+-{{end}}
+-<h3>Contents</h3>
+-<pre>{{fcontent .Read}}</pre>
+-{{end}}
+-`))
+diff -urN a/gopls/internal/lsp/debug/trace.go b/gopls/internal/lsp/debug/trace.go
+--- a/gopls/internal/lsp/debug/trace.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/debug/trace.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,233 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package debug
+-
+-import (
+- "bytes"
+- "context"
+- "fmt"
+- "html/template"
+- "net/http"
+- "runtime/trace"
+- "sort"
+- "strings"
+- "sync"
+- "time"
+-
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/core"
+- "golang.org/x/tools/internal/event/export"
+- "golang.org/x/tools/internal/event/label"
+-)
+-
+-var TraceTmpl = template.Must(template.Must(BaseTemplate.Clone()).Parse(`
+-{{define "title"}}Trace Information{{end}}
+-{{define "body"}}
+- {{range .Traces}}<a href="/trace/{{.Name}}">{{.Name}}</a> last: {{.Last.Duration}}, longest: {{.Longest.Duration}}<br>{{end}}
+- {{if .Selected}}
+- <H2>{{.Selected.Name}}</H2>
+- {{if .Selected.Last}}<H3>Last</H3><ul>{{template "details" .Selected.Last}}</ul>{{end}}
+- {{if .Selected.Longest}}<H3>Longest</H3><ul>{{template "details" .Selected.Longest}}</ul>{{end}}
+- {{end}}
+-{{end}}
+-{{define "details"}}
+- <li>{{.Offset}} {{.Name}} {{.Duration}} {{.Tags}}</li>
+- {{if .Events}}<ul class=events>{{range .Events}}<li>{{.Offset}} {{.Tags}}</li>{{end}}</ul>{{end}}
+- {{if .Children}}<ul>{{range .Children}}{{template "details" .}}{{end}}</ul>{{end}}
+-{{end}}
+-`))
+-
+-type traces struct {
+- mu sync.Mutex
+- sets map[string]*traceSet
+- unfinished map[export.SpanContext]*traceData
+-}
+-
+-type TraceResults struct { // exported for testing
+- Traces []*traceSet
+- Selected *traceSet
+-}
+-
+-type traceSet struct {
+- Name string
+- Last *traceData
+- Longest *traceData
+-}
+-
+-type traceData struct {
+- TraceID export.TraceID
+- SpanID export.SpanID
+- ParentID export.SpanID
+- Name string
+- Start time.Time
+- Finish time.Time
+- Offset time.Duration
+- Duration time.Duration
+- Tags string
+- Events []traceEvent
+- Children []*traceData
+-}
+-
+-type traceEvent struct {
+- Time time.Time
+- Offset time.Duration
+- Tags string
+-}
+-
+-func StdTrace(exporter event.Exporter) event.Exporter {
+- return func(ctx context.Context, ev core.Event, lm label.Map) context.Context {
+- span := export.GetSpan(ctx)
+- if span == nil {
+- return exporter(ctx, ev, lm)
+- }
+- switch {
+- case event.IsStart(ev):
+- if span.ParentID.IsValid() {
+- region := trace.StartRegion(ctx, span.Name)
+- ctx = context.WithValue(ctx, traceKey, region)
+- } else {
+- var task *trace.Task
+- ctx, task = trace.NewTask(ctx, span.Name)
+- ctx = context.WithValue(ctx, traceKey, task)
+- }
+- // Log the start event as it may contain useful labels.
+- msg := formatEvent(ctx, ev, lm)
+- trace.Log(ctx, "start", msg)
+- case event.IsLog(ev):
+- category := ""
+- if event.IsError(ev) {
+- category = "error"
+- }
+- msg := formatEvent(ctx, ev, lm)
+- trace.Log(ctx, category, msg)
+- case event.IsEnd(ev):
+- if v := ctx.Value(traceKey); v != nil {
+- v.(interface{ End() }).End()
+- }
+- }
+- return exporter(ctx, ev, lm)
+- }
+-}
+-
+-func formatEvent(ctx context.Context, ev core.Event, lm label.Map) string {
+- buf := &bytes.Buffer{}
+- p := export.Printer{}
+- p.WriteEvent(buf, ev, lm)
+- return buf.String()
+-}
+-
+-func (t *traces) ProcessEvent(ctx context.Context, ev core.Event, lm label.Map) context.Context {
+- span := export.GetSpan(ctx)
+- if span == nil {
+- return ctx
+- }
+-
+- switch {
+- case event.IsStart(ev):
+- // Just starting: add it to the unfinished map.
+- // Allocate before the critical section.
+- td := &traceData{
+- TraceID: span.ID.TraceID,
+- SpanID: span.ID.SpanID,
+- ParentID: span.ParentID,
+- Name: span.Name,
+- Start: span.Start().At(),
+- Tags: renderLabels(span.Start()),
+- }
+-
+- t.mu.Lock()
+- defer t.mu.Unlock()
+- if t.sets == nil {
+- t.sets = make(map[string]*traceSet)
+- t.unfinished = make(map[export.SpanContext]*traceData)
+- }
+- t.unfinished[span.ID] = td
+- // and wire up parents if we have them
+- if !span.ParentID.IsValid() {
+- return ctx
+- }
+- parentID := export.SpanContext{TraceID: span.ID.TraceID, SpanID: span.ParentID}
+- parent, found := t.unfinished[parentID]
+- if !found {
+- // trace had an invalid parent, so it cannot itself be valid
+- return ctx
+- }
+- parent.Children = append(parent.Children, td)
+-
+- case event.IsEnd(ev):
+- // Finishing: must be already in the map.
+- // Allocate events before the critical section.
+- events := span.Events()
+- tdEvents := make([]traceEvent, len(events))
+- for i, event := range events {
+- tdEvents[i] = traceEvent{
+- Time: event.At(),
+- Tags: renderLabels(event),
+- }
+- }
+-
+- t.mu.Lock()
+- defer t.mu.Unlock()
+- td, found := t.unfinished[span.ID]
+- if !found {
+- return ctx // if this happens we are in a bad place
+- }
+- delete(t.unfinished, span.ID)
+-
+- td.Finish = span.Finish().At()
+- td.Duration = span.Finish().At().Sub(span.Start().At())
+- td.Events = tdEvents
+-
+- set, ok := t.sets[span.Name]
+- if !ok {
+- set = &traceSet{Name: span.Name}
+- t.sets[span.Name] = set
+- }
+- set.Last = td
+- if set.Longest == nil || set.Last.Duration > set.Longest.Duration {
+- set.Longest = set.Last
+- }
+- if !td.ParentID.IsValid() {
+- fillOffsets(td, td.Start)
+- }
+- }
+- return ctx
+-}
+-
+-func (t *traces) getData(req *http.Request) interface{} {
+- if len(t.sets) == 0 {
+- return nil
+- }
+- data := TraceResults{}
+- data.Traces = make([]*traceSet, 0, len(t.sets))
+- for _, set := range t.sets {
+- data.Traces = append(data.Traces, set)
+- }
+- sort.Slice(data.Traces, func(i, j int) bool { return data.Traces[i].Name < data.Traces[j].Name })
+- if bits := strings.SplitN(req.URL.Path, "/trace/", 2); len(bits) > 1 {
+- data.Selected = t.sets[bits[1]]
+- }
+- return data
+-}
+-
+-func fillOffsets(td *traceData, start time.Time) {
+- td.Offset = td.Start.Sub(start)
+- for i := range td.Events {
+- td.Events[i].Offset = td.Events[i].Time.Sub(start)
+- }
+- for _, child := range td.Children {
+- fillOffsets(child, start)
+- }
+-}
+-
+-func renderLabels(labels label.List) string {
+- buf := &bytes.Buffer{}
+- for index := 0; labels.Valid(index); index++ {
+- if l := labels.Label(index); l.Valid() {
+- fmt.Fprintf(buf, "%v ", l)
+- }
+- }
+- return buf.String()
+-}
+diff -urN a/gopls/internal/lsp/definition.go b/gopls/internal/lsp/definition.go
+--- a/gopls/internal/lsp/definition.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/definition.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,52 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+- "errors"
+- "fmt"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/template"
+-)
+-
+-func (s *Server) definition(ctx context.Context, params *protocol.DefinitionParams) ([]protocol.Location, error) {
+- // TODO(rfindley): definition requests should be multiplexed across all views.
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.UnknownKind)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+- switch kind := snapshot.View().FileKind(fh); kind {
+- case source.Tmpl:
+- return template.Definition(snapshot, fh, params.Position)
+- case source.Go:
+- // Partial support for jumping from linkname directive (position at 2nd argument).
+- locations, err := source.LinknameDefinition(ctx, snapshot, fh, params.Position)
+- if !errors.Is(err, source.ErrNoLinkname) {
+- return locations, err
+- }
+- return source.Definition(ctx, snapshot, fh, params.Position)
+- default:
+- return nil, fmt.Errorf("can't find definitions for file type %s", kind)
+- }
+-}
+-
+-func (s *Server) typeDefinition(ctx context.Context, params *protocol.TypeDefinitionParams) ([]protocol.Location, error) {
+- // TODO(rfindley): type definition requests should be multiplexed across all views.
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.Go)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+- switch kind := snapshot.View().FileKind(fh); kind {
+- case source.Go:
+- return source.TypeDefinition(ctx, snapshot, fh, params.Position)
+- default:
+- return nil, fmt.Errorf("can't find type definitions for file type %s", kind)
+- }
+-}
+diff -urN a/gopls/internal/lsp/diagnostics.go b/gopls/internal/lsp/diagnostics.go
+--- a/gopls/internal/lsp/diagnostics.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/diagnostics.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,764 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+- "crypto/sha256"
+- "errors"
+- "fmt"
+- "os"
+- "path/filepath"
+- "strings"
+- "sync"
+- "time"
+-
+- "golang.org/x/sync/errgroup"
+- "golang.org/x/tools/gopls/internal/lsp/debug/log"
+- "golang.org/x/tools/gopls/internal/lsp/mod"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/template"
+- "golang.org/x/tools/gopls/internal/lsp/work"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+- "golang.org/x/tools/internal/xcontext"
+-)
+-
+-// diagnosticSource differentiates different sources of diagnostics.
+-type diagnosticSource int
+-
+-const (
+- modSource diagnosticSource = iota
+- gcDetailsSource
+- analysisSource
+- typeCheckSource
+- orphanedSource
+- workSource
+- modCheckUpgradesSource
+- modVulncheckSource // source.Govulncheck + source.Vulncheck
+-)
+-
+-// A diagnosticReport holds results for a single diagnostic source.
+-type diagnosticReport struct {
+- snapshotID source.GlobalSnapshotID // global snapshot ID on which the report was computed
+- publishedHash string // last published hash for this (URI, source)
+- diags map[string]*source.Diagnostic
+-}
+-
+-// fileReports holds a collection of diagnostic reports for a single file, as
+-// well as the hash of the last published set of diagnostics.
+-type fileReports struct {
+- // publishedSnapshotID is the last snapshot ID for which we have "published"
+- // diagnostics (though the publishDiagnostics notification may not have
+- // actually been sent, if nothing changed).
+- //
+- // Specifically, publishedSnapshotID is updated to a later snapshot ID when
+- // we either:
+- // (1) publish diagnostics for the file for a snapshot, or
+- // (2) determine that published diagnostics are valid for a new snapshot.
+- //
+- // Notably publishedSnapshotID may not match the snapshot id on individual reports in
+- // the reports map:
+- // - we may have published partial diagnostics from only a subset of
+- // diagnostic sources for which new results have been computed, or
+- // - we may have started computing reports for an even new snapshot, but not
+- // yet published.
+- //
+- // This prevents gopls from publishing stale diagnostics.
+- publishedSnapshotID source.GlobalSnapshotID
+-
+- // publishedHash is a hash of the latest diagnostics published for the file.
+- publishedHash string
+-
+- // If set, mustPublish marks diagnostics as needing publication, independent
+- // of whether their publishedHash has changed.
+- mustPublish bool
+-
+- // The last stored diagnostics for each diagnostic source.
+- reports map[diagnosticSource]diagnosticReport
+-}
+-
+-func (d diagnosticSource) String() string {
+- switch d {
+- case modSource:
+- return "FromSource"
+- case gcDetailsSource:
+- return "FromGCDetails"
+- case analysisSource:
+- return "FromAnalysis"
+- case typeCheckSource:
+- return "FromTypeChecking"
+- case orphanedSource:
+- return "FromOrphans"
+- case workSource:
+- return "FromGoWork"
+- case modCheckUpgradesSource:
+- return "FromCheckForUpgrades"
+- case modVulncheckSource:
+- return "FromModVulncheck"
+- default:
+- return fmt.Sprintf("From?%d?", d)
+- }
+-}
+-
+-// hashDiagnostics computes a hash to identify diags.
+-func hashDiagnostics(diags ...*source.Diagnostic) string {
+- source.SortDiagnostics(diags)
+- h := sha256.New()
+- for _, d := range diags {
+- for _, t := range d.Tags {
+- fmt.Fprintf(h, "%s", t)
+- }
+- for _, r := range d.Related {
+- fmt.Fprintf(h, "%s%s%s", r.Location.URI.SpanURI(), r.Message, r.Location.Range)
+- }
+- fmt.Fprintf(h, "%s%s%s%s", d.Message, d.Range, d.Severity, d.Source)
+- }
+- return fmt.Sprintf("%x", h.Sum(nil))
+-}
+-
+-func (s *Server) diagnoseDetached(snapshot source.Snapshot) {
+- ctx := snapshot.BackgroundContext()
+- ctx = xcontext.Detach(ctx)
+- s.diagnose(ctx, snapshot, false)
+- s.publishDiagnostics(ctx, true, snapshot)
+-}
+-
+-func (s *Server) diagnoseSnapshots(snapshots map[source.Snapshot][]span.URI, onDisk bool) {
+- var diagnosticWG sync.WaitGroup
+- for snapshot, uris := range snapshots {
+- diagnosticWG.Add(1)
+- go func(snapshot source.Snapshot, uris []span.URI) {
+- defer diagnosticWG.Done()
+- s.diagnoseSnapshot(snapshot, uris, onDisk)
+- }(snapshot, uris)
+- }
+- diagnosticWG.Wait()
+-}
+-
+-func (s *Server) diagnoseSnapshot(snapshot source.Snapshot, changedURIs []span.URI, onDisk bool) {
+- ctx := snapshot.BackgroundContext()
+- ctx, done := event.Start(ctx, "Server.diagnoseSnapshot", source.SnapshotLabels(snapshot)...)
+- defer done()
+-
+- delay := snapshot.View().Options().DiagnosticsDelay
+- if delay > 0 {
+- // 2-phase diagnostics.
+- //
+- // The first phase just parses and type-checks (but
+- // does not analyze) packages directly affected by
+- // file modifications.
+- //
+- // The second phase runs analysis on the entire snapshot,
+- // and is debounced by the configured delay.
+- s.diagnoseChangedFiles(ctx, snapshot, changedURIs, onDisk)
+- s.publishDiagnostics(ctx, false, snapshot)
+-
+- // We debounce diagnostics separately for each view, using the snapshot
+- // local ID as logical ordering.
+- //
+- // TODO(rfindley): it would be cleaner to simply put the diagnostic
+- // debouncer on the view, and remove the "key" argument to debouncing.
+- if ok := <-s.diagDebouncer.debounce(snapshot.View().Name(), snapshot.SequenceID(), time.After(delay)); ok {
+- s.diagnose(ctx, snapshot, false)
+- s.publishDiagnostics(ctx, true, snapshot)
+- }
+- return
+- }
+-
+- // Ignore possible workspace configuration warnings in the normal flow.
+- s.diagnose(ctx, snapshot, false)
+- s.publishDiagnostics(ctx, true, snapshot)
+-}
+-
+-func (s *Server) diagnoseChangedFiles(ctx context.Context, snapshot source.Snapshot, uris []span.URI, onDisk bool) {
+- ctx, done := event.Start(ctx, "Server.diagnoseChangedFiles", source.SnapshotLabels(snapshot)...)
+- defer done()
+-
+- // TODO(adonovan): safety: refactor so that group.Go is called
+- // in a second loop, so that if we should later add an early
+- // return to the first loop, we don't leak goroutines.
+- var group errgroup.Group
+- seen := make(map[*source.Metadata]bool)
+- for _, uri := range uris {
+- // If the change is only on-disk and the file is not open, don't
+- // directly request its package. It may not be a workspace package.
+- if onDisk && !snapshot.IsOpen(uri) {
+- continue
+- }
+- // If the file is not known to the snapshot (e.g., if it was deleted),
+- // don't diagnose it.
+- if snapshot.FindFile(uri) == nil {
+- continue
+- }
+-
+- // Don't request type-checking for builtin.go: it's not a real package.
+- if snapshot.IsBuiltin(ctx, uri) {
+- continue
+- }
+-
+- // Find all packages that include this file and diagnose them in parallel.
+- metas, err := snapshot.MetadataForFile(ctx, uri)
+- if err != nil {
+- // TODO(findleyr): we should probably do something with the error here,
+- // but as of now this can fail repeatedly if load fails, so can be too
+- // noisy to log (and we'll handle things later in the slow pass).
+- continue
+- }
+- for _, m := range metas {
+- if m.IsIntermediateTestVariant() {
+- continue
+- }
+- if !seen[m] {
+- seen[m] = true
+- m := m
+- group.Go(func() error {
+- s.diagnosePkg(ctx, snapshot, m, false)
+- return nil // error result is ignored
+- })
+- }
+- }
+- }
+- group.Wait() // ignore error
+-}
+-
+-// diagnose is a helper function for running diagnostics with a given context.
+-// Do not call it directly. forceAnalysis is only true for testing purposes.
+-func (s *Server) diagnose(ctx context.Context, snapshot source.Snapshot, forceAnalysis bool) {
+- ctx, done := event.Start(ctx, "Server.diagnose", source.SnapshotLabels(snapshot)...)
+- defer done()
+-
+- // Wait for a free diagnostics slot.
+- // TODO(adonovan): opt: shouldn't it be the analysis implementation's
+- // job to de-dup and limit resource consumption? In any case this
+- // this function spends most its time waiting for awaitLoaded, at
+- // least initially.
+- select {
+- case <-ctx.Done():
+- return
+- case s.diagnosticsSema <- struct{}{}:
+- }
+- defer func() {
+- <-s.diagnosticsSema
+- }()
+-
+- // common code for dispatching diagnostics
+- store := func(dsource diagnosticSource, operation string, diagsByFile map[span.URI][]*source.Diagnostic, err error, merge bool) {
+- if err != nil {
+- event.Error(ctx, "warning: while "+operation, err, source.SnapshotLabels(snapshot)...)
+- }
+- for uri, diags := range diagsByFile {
+- if uri == "" {
+- event.Error(ctx, "missing URI while "+operation, fmt.Errorf("empty URI"), tag.Directory.Of(snapshot.View().Folder().Filename()))
+- continue
+- }
+- s.storeDiagnostics(snapshot, uri, dsource, diags, merge)
+- }
+- }
+-
+- // Diagnose go.mod upgrades.
+- upgradeReports, upgradeErr := mod.UpgradeDiagnostics(ctx, snapshot)
+- if ctx.Err() != nil {
+- log.Trace.Log(ctx, "diagnose cancelled")
+- return
+- }
+- store(modCheckUpgradesSource, "diagnosing go.mod upgrades", upgradeReports, upgradeErr, true)
+-
+- // Diagnose go.work file.
+- workReports, workErr := work.Diagnostics(ctx, snapshot)
+- if ctx.Err() != nil {
+- log.Trace.Log(ctx, "diagnose cancelled")
+- return
+- }
+- store(workSource, "diagnosing go.work file", workReports, workErr, true)
+-
+- // Diagnose go.mod file.
+- // (This step demands type checking of all active packages:
+- // the bottleneck in the startup sequence for a big workspace.)
+- modReports, modErr := mod.Diagnostics(ctx, snapshot)
+- if ctx.Err() != nil {
+- log.Trace.Log(ctx, "diagnose cancelled")
+- return
+- }
+- store(modSource, "diagnosing go.mod file", modReports, modErr, true)
+-
+- // Diagnose vulnerabilities.
+- vulnReports, vulnErr := mod.VulnerabilityDiagnostics(ctx, snapshot)
+- if ctx.Err() != nil {
+- log.Trace.Log(ctx, "diagnose cancelled")
+- return
+- }
+- store(modVulncheckSource, "diagnosing vulnerabilities", vulnReports, vulnErr, false)
+-
+- activeMetas, activeErr := snapshot.ActiveMetadata(ctx)
+- if s.shouldIgnoreError(ctx, snapshot, activeErr) {
+- return
+- }
+- criticalErr := snapshot.GetCriticalError(ctx)
+- if ctx.Err() != nil { // must check ctx after GetCriticalError
+- return
+- }
+-
+- // Show the error as a progress error report so that it appears in the
+- // status bar. If a client doesn't support progress reports, the error
+- // will still be shown as a ShowMessage. If there is no error, any running
+- // error progress reports will be closed.
+- s.showCriticalErrorStatus(ctx, snapshot, criticalErr)
+-
+- // Diagnose template (.tmpl) files.
+- for _, f := range snapshot.Templates() {
+- diags := template.Diagnose(f)
+- s.storeDiagnostics(snapshot, f.URI(), typeCheckSource, diags, true)
+- }
+-
+- // If there are no workspace packages, there is nothing to diagnose and
+- // there are no orphaned files.
+- if len(activeMetas) == 0 {
+- return
+- }
+-
+- // Run go/analysis diagnosis of packages in parallel.
+- // TODO(adonovan): opt: it may be more efficient to
+- // have diagnosePkg take a set of packages.
+- //
+- // TODO(adonovan): opt: since the new analysis driver does its
+- // own type checking, we could strength-reduce pkg to
+- // PackageID and get this step started as soon as the set of
+- // active package IDs are known, without waiting for them to load.
+- var (
+- wg sync.WaitGroup
+- seen = map[span.URI]struct{}{}
+- )
+- for _, m := range activeMetas {
+- for _, uri := range m.CompiledGoFiles {
+- seen[uri] = struct{}{}
+- }
+-
+- wg.Add(1)
+- go func(m *source.Metadata) {
+- defer wg.Done()
+- s.diagnosePkg(ctx, snapshot, m, forceAnalysis)
+- }(m)
+- }
+- wg.Wait()
+-
+- // Orphaned files.
+- // Confirm that every opened file belongs to a package (if any exist in
+- // the workspace). Otherwise, add a diagnostic to the file.
+- for _, o := range s.session.Overlays() {
+- if _, ok := seen[o.URI()]; ok {
+- continue
+- }
+- diagnostic := s.checkForOrphanedFile(ctx, snapshot, o)
+- if diagnostic == nil {
+- continue
+- }
+- s.storeDiagnostics(snapshot, o.URI(), orphanedSource, []*source.Diagnostic{diagnostic}, true)
+- }
+-}
+-
+-func (s *Server) diagnosePkg(ctx context.Context, snapshot source.Snapshot, m *source.Metadata, alwaysAnalyze bool) {
+- ctx, done := event.Start(ctx, "Server.diagnosePkg", append(source.SnapshotLabels(snapshot), tag.Package.Of(string(m.ID)))...)
+- defer done()
+- enableDiagnostics := false
+- includeAnalysis := alwaysAnalyze // only run analyses for packages with open files
+- for _, uri := range m.CompiledGoFiles {
+- enableDiagnostics = enableDiagnostics || !snapshot.IgnoredFile(uri)
+- includeAnalysis = includeAnalysis || snapshot.IsOpen(uri)
+- }
+- // Don't show any diagnostics on ignored files.
+- if !enableDiagnostics {
+- return
+- }
+-
+- diags, err := snapshot.PackageDiagnostics(ctx, m.ID)
+- if err != nil {
+- event.Error(ctx, "warning: diagnostics failed", err, append(source.SnapshotLabels(snapshot), tag.Package.Of(string(m.ID)))...)
+- return
+- }
+-
+- // Get diagnostics from analysis framework.
+- // This includes type-error analyzers, which suggest fixes to compiler errors.
+- var analysisDiags map[span.URI][]*source.Diagnostic
+- if includeAnalysis {
+- diags, err := source.Analyze(ctx, snapshot, m.ID, false)
+- if err != nil {
+- event.Error(ctx, "warning: analyzing package", err, append(source.SnapshotLabels(snapshot), tag.Package.Of(string(m.ID)))...)
+- return
+- }
+- analysisDiags = diags
+- }
+-
+- // For each file, update the server's diagnostics state.
+- for _, uri := range m.CompiledGoFiles {
+- // builtin.go exists only for documentation purposes and
+- // is not valid Go code. Don't report distracting errors.
+- if snapshot.IsBuiltin(ctx, uri) {
+- continue
+- }
+-
+- pkgDiags := diags[uri]
+- var tdiags, adiags []*source.Diagnostic
+- source.CombineDiagnostics(pkgDiags, analysisDiags[uri], &tdiags, &adiags)
+- s.storeDiagnostics(snapshot, uri, typeCheckSource, tdiags, true)
+- s.storeDiagnostics(snapshot, uri, analysisSource, adiags, true)
+- }
+-
+- // If gc optimization details are requested, add them to the
+- // diagnostic reports.
+- s.gcOptimizationDetailsMu.Lock()
+- _, enableGCDetails := s.gcOptimizationDetails[m.ID]
+- s.gcOptimizationDetailsMu.Unlock()
+- if enableGCDetails {
+- gcReports, err := source.GCOptimizationDetails(ctx, snapshot, m)
+- if err != nil {
+- event.Error(ctx, "warning: gc details", err, append(source.SnapshotLabels(snapshot), tag.Package.Of(string(m.ID)))...)
+- }
+- s.gcOptimizationDetailsMu.Lock()
+- _, enableGCDetails := s.gcOptimizationDetails[m.ID]
+-
+- // NOTE(golang/go#44826): hold the gcOptimizationDetails lock, and re-check
+- // whether gc optimization details are enabled, while storing gc_details
+- // results. This ensures that the toggling of GC details and clearing of
+- // diagnostics does not race with storing the results here.
+- if enableGCDetails {
+- for uri, diags := range gcReports {
+- fh := snapshot.FindFile(uri)
+- // Don't publish gc details for unsaved buffers, since the underlying
+- // logic operates on the file on disk.
+- if fh == nil || !fh.Saved() {
+- continue
+- }
+- s.storeDiagnostics(snapshot, uri, gcDetailsSource, diags, true)
+- }
+- }
+- s.gcOptimizationDetailsMu.Unlock()
+- }
+-}
+-
+-// mustPublishDiagnostics marks the uri as needing publication, independent of
+-// whether the published contents have changed.
+-//
+-// This can be used for ensuring gopls publishes diagnostics after certain file
+-// events.
+-func (s *Server) mustPublishDiagnostics(uri span.URI) {
+- s.diagnosticsMu.Lock()
+- defer s.diagnosticsMu.Unlock()
+-
+- if s.diagnostics[uri] == nil {
+- s.diagnostics[uri] = &fileReports{
+- publishedHash: hashDiagnostics(), // Hash for 0 diagnostics.
+- reports: map[diagnosticSource]diagnosticReport{},
+- }
+- }
+- s.diagnostics[uri].mustPublish = true
+-}
+-
+-// storeDiagnostics stores results from a single diagnostic source. If merge is
+-// true, it merges results into any existing results for this snapshot.
+-//
+-// TODO(hyangah): investigate whether we can unconditionally overwrite previous report.diags
+-// with the new diags and eliminate the need for the `merge` flag.
+-func (s *Server) storeDiagnostics(snapshot source.Snapshot, uri span.URI, dsource diagnosticSource, diags []*source.Diagnostic, merge bool) {
+- // Safeguard: ensure that the file actually exists in the snapshot
+- // (see golang.org/issues/38602).
+- fh := snapshot.FindFile(uri)
+- if fh == nil {
+- return
+- }
+-
+- s.diagnosticsMu.Lock()
+- defer s.diagnosticsMu.Unlock()
+- if s.diagnostics[uri] == nil {
+- s.diagnostics[uri] = &fileReports{
+- publishedHash: hashDiagnostics(), // Hash for 0 diagnostics.
+- reports: map[diagnosticSource]diagnosticReport{},
+- }
+- }
+- report := s.diagnostics[uri].reports[dsource]
+- // Don't set obsolete diagnostics.
+- if report.snapshotID > snapshot.GlobalID() {
+- return
+- }
+- if report.diags == nil || report.snapshotID != snapshot.GlobalID() || !merge {
+- report.diags = map[string]*source.Diagnostic{}
+- }
+- report.snapshotID = snapshot.GlobalID()
+- for _, d := range diags {
+- report.diags[hashDiagnostics(d)] = d
+- }
+- s.diagnostics[uri].reports[dsource] = report
+-}
+-
+-// clearDiagnosticSource clears all diagnostics for a given source type. It is
+-// necessary for cases where diagnostics have been invalidated by something
+-// other than a snapshot change, for example when gc_details is toggled.
+-func (s *Server) clearDiagnosticSource(dsource diagnosticSource) {
+- s.diagnosticsMu.Lock()
+- defer s.diagnosticsMu.Unlock()
+- for _, reports := range s.diagnostics {
+- delete(reports.reports, dsource)
+- }
+-}
+-
+-const WorkspaceLoadFailure = "Error loading workspace"
+-
+-// showCriticalErrorStatus shows the error as a progress report.
+-// If the error is nil, it clears any existing error progress report.
+-func (s *Server) showCriticalErrorStatus(ctx context.Context, snapshot source.Snapshot, err *source.CriticalError) {
+- s.criticalErrorStatusMu.Lock()
+- defer s.criticalErrorStatusMu.Unlock()
+-
+- // Remove all newlines so that the error message can be formatted in a
+- // status bar.
+- var errMsg string
+- if err != nil {
+- event.Error(ctx, "errors loading workspace", err.MainError, source.SnapshotLabels(snapshot)...)
+- for _, d := range err.Diagnostics {
+- s.storeDiagnostics(snapshot, d.URI, modSource, []*source.Diagnostic{d}, true)
+- }
+- errMsg = strings.ReplaceAll(err.MainError.Error(), "\n", " ")
+- }
+-
+- if s.criticalErrorStatus == nil {
+- if errMsg != "" {
+- s.criticalErrorStatus = s.progress.Start(ctx, WorkspaceLoadFailure, errMsg, nil, nil)
+- }
+- return
+- }
+-
+- // If an error is already shown to the user, update it or mark it as
+- // resolved.
+- if errMsg == "" {
+- s.criticalErrorStatus.End(ctx, "Done.")
+- s.criticalErrorStatus = nil
+- } else {
+- s.criticalErrorStatus.Report(ctx, errMsg, 0)
+- }
+-}
+-
+-// checkForOrphanedFile checks that the given URIs can be mapped to packages.
+-// If they cannot and the workspace is not otherwise unloaded, it also surfaces
+-// a warning, suggesting that the user check the file for build tags.
+-func (s *Server) checkForOrphanedFile(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle) *source.Diagnostic {
+- // TODO(rfindley): this function may fail to produce a diagnostic for a
+- // variety of reasons, some of which should probably not be ignored. For
+- // example, should this function be tolerant of the case where fh does not
+- // exist, or does not have a package name?
+- //
+- // It would be better to panic or report a bug in several of the cases below,
+- // so that we can move toward guaranteeing we show the user a meaningful
+- // error whenever it makes sense.
+- if snapshot.View().FileKind(fh) != source.Go {
+- return nil
+- }
+- // builtin files won't have a package, but they are never orphaned.
+- if snapshot.IsBuiltin(ctx, fh.URI()) {
+- return nil
+- }
+-
+- // This call has the effect of inserting fh into snapshot.files,
+- // where for better or worse (actually: just worse) it influences
+- // the sets of open, known, and orphaned files.
+- snapshot.GetFile(ctx, fh.URI())
+-
+- metas, _ := snapshot.MetadataForFile(ctx, fh.URI())
+- if len(metas) > 0 || ctx.Err() != nil {
+- return nil // no package, or cancelled
+- }
+- // Inv: file does not belong to a package we know about.
+- pgf, err := snapshot.ParseGo(ctx, fh, source.ParseHeader)
+- if err != nil {
+- return nil
+- }
+- if !pgf.File.Name.Pos().IsValid() {
+- return nil
+- }
+- rng, err := pgf.NodeRange(pgf.File.Name)
+- if err != nil {
+- return nil
+- }
+- // If the file no longer has a name ending in .go, this diagnostic is wrong
+- if filepath.Ext(fh.URI().Filename()) != ".go" {
+- return nil
+- }
+- // TODO(rstambler): We should be able to parse the build tags in the
+- // file and show a more specific error message. For now, put the diagnostic
+- // on the package declaration.
+- return &source.Diagnostic{
+- URI: fh.URI(),
+- Range: rng,
+- Severity: protocol.SeverityWarning,
+- Source: source.ListError,
+- Message: fmt.Sprintf(`No packages found for open file %s: %v.
+-If this file contains build tags, try adding "-tags=<build tag>" to your gopls "buildFlags" configuration (see (https://github.com/golang/tools/blob/master/gopls/doc/settings.md#buildflags-string).
+-Otherwise, see the troubleshooting guidelines for help investigating (https://github.com/golang/tools/blob/master/gopls/doc/troubleshooting.md).
+-`, fh.URI().Filename(), err),
+- }
+-}
+-
+-// publishDiagnostics collects and publishes any unpublished diagnostic reports.
+-func (s *Server) publishDiagnostics(ctx context.Context, final bool, snapshot source.Snapshot) {
+- ctx, done := event.Start(ctx, "Server.publishDiagnostics", source.SnapshotLabels(snapshot)...)
+- defer done()
+-
+- s.diagnosticsMu.Lock()
+- defer s.diagnosticsMu.Unlock()
+-
+- for uri, r := range s.diagnostics {
+- // Global snapshot IDs are monotonic, so we use them to enforce an ordering
+- // for diagnostics.
+- //
+- // If we've already delivered diagnostics for a future snapshot for this
+- // file, do not deliver them. See golang/go#42837 for an example of why
+- // this is necessary.
+- //
+- // TODO(rfindley): even using a global snapshot ID, this mechanism is
+- // potentially racy: elsewhere in the code (e.g. invalidateContent) we
+- // allow for multiple views track a given file. In this case, we should
+- // either only report diagnostics for snapshots from the "best" view of a
+- // URI, or somehow merge diagnostics from multiple views.
+- if r.publishedSnapshotID > snapshot.GlobalID() {
+- continue
+- }
+-
+- anyReportsChanged := false
+- reportHashes := map[diagnosticSource]string{}
+- var diags []*source.Diagnostic
+- for dsource, report := range r.reports {
+- if report.snapshotID != snapshot.GlobalID() {
+- continue
+- }
+- var reportDiags []*source.Diagnostic
+- for _, d := range report.diags {
+- diags = append(diags, d)
+- reportDiags = append(reportDiags, d)
+- }
+- hash := hashDiagnostics(reportDiags...)
+- if hash != report.publishedHash {
+- anyReportsChanged = true
+- }
+- reportHashes[dsource] = hash
+- }
+-
+- if !final && !anyReportsChanged {
+- // Don't invalidate existing reports on the client if we haven't got any
+- // new information.
+- continue
+- }
+-
+- source.SortDiagnostics(diags)
+- hash := hashDiagnostics(diags...)
+- if hash == r.publishedHash && !r.mustPublish {
+- // Update snapshotID to be the latest snapshot for which this diagnostic
+- // hash is valid.
+- r.publishedSnapshotID = snapshot.GlobalID()
+- continue
+- }
+- var version int32
+- if fh := snapshot.FindFile(uri); fh != nil { // file may have been deleted
+- version = fh.Version()
+- }
+- if err := s.client.PublishDiagnostics(ctx, &protocol.PublishDiagnosticsParams{
+- Diagnostics: toProtocolDiagnostics(diags),
+- URI: protocol.URIFromSpanURI(uri),
+- Version: version,
+- }); err == nil {
+- r.publishedHash = hash
+- r.mustPublish = false // diagnostics have been successfully published
+- r.publishedSnapshotID = snapshot.GlobalID()
+- for dsource, hash := range reportHashes {
+- report := r.reports[dsource]
+- report.publishedHash = hash
+- r.reports[dsource] = report
+- }
+- } else {
+- if ctx.Err() != nil {
+- // Publish may have failed due to a cancelled context.
+- log.Trace.Log(ctx, "publish cancelled")
+- return
+- }
+- event.Error(ctx, "publishReports: failed to deliver diagnostic", err, tag.URI.Of(uri))
+- }
+- }
+-}
+-
+-func toProtocolDiagnostics(diagnostics []*source.Diagnostic) []protocol.Diagnostic {
+- reports := []protocol.Diagnostic{}
+- for _, diag := range diagnostics {
+- pdiag := protocol.Diagnostic{
+- // diag.Message might start with \n or \t
+- Message: strings.TrimSpace(diag.Message),
+- Range: diag.Range,
+- Severity: diag.Severity,
+- Source: string(diag.Source),
+- Tags: diag.Tags,
+- RelatedInformation: diag.Related,
+- }
+- if diag.Code != "" {
+- pdiag.Code = diag.Code
+- }
+- if diag.CodeHref != "" {
+- pdiag.CodeDescription = &protocol.CodeDescription{Href: diag.CodeHref}
+- }
+- reports = append(reports, pdiag)
+- }
+- return reports
+-}
+-
+-func (s *Server) shouldIgnoreError(ctx context.Context, snapshot source.Snapshot, err error) bool {
+- if err == nil { // if there is no error at all
+- return false
+- }
+- if errors.Is(err, context.Canceled) {
+- return true
+- }
+- // If the folder has no Go code in it, we shouldn't spam the user with a warning.
+- var hasGo bool
+- _ = filepath.Walk(snapshot.View().Folder().Filename(), func(path string, info os.FileInfo, err error) error {
+- if err != nil {
+- return err
+- }
+- if !strings.HasSuffix(info.Name(), ".go") {
+- return nil
+- }
+- hasGo = true
+- return errors.New("done")
+- })
+- return !hasGo
+-}
+-
+-// Diagnostics formattedfor the debug server
+-// (all the relevant fields of Server are private)
+-// (The alternative is to export them)
+-func (s *Server) Diagnostics() map[string][]string {
+- ans := make(map[string][]string)
+- s.diagnosticsMu.Lock()
+- defer s.diagnosticsMu.Unlock()
+- for k, v := range s.diagnostics {
+- fn := k.Filename()
+- for typ, d := range v.reports {
+- if len(d.diags) == 0 {
+- continue
+- }
+- for _, dx := range d.diags {
+- ans[fn] = append(ans[fn], auxStr(dx, d, typ))
+- }
+- }
+- }
+- return ans
+-}
+-
+-func auxStr(v *source.Diagnostic, d diagnosticReport, typ diagnosticSource) string {
+- // Tags? RelatedInformation?
+- msg := fmt.Sprintf("(%s)%q(source:%q,code:%q,severity:%s,snapshot:%d,type:%s)",
+- v.Range, v.Message, v.Source, v.Code, v.Severity, d.snapshotID, typ)
+- for _, r := range v.Related {
+- msg += fmt.Sprintf(" [%s:%s,%q]", r.Location.URI.SpanURI().Filename(), r.Location.Range, r.Message)
+- }
+- return msg
+-}
+diff -urN a/gopls/internal/lsp/fake/client.go b/gopls/internal/lsp/fake/client.go
+--- a/gopls/internal/lsp/fake/client.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/fake/client.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,187 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fake
+-
+-import (
+- "context"
+- "encoding/json"
+- "fmt"
+-
+- "golang.org/x/tools/gopls/internal/lsp/glob"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-// ClientHooks are a set of optional hooks called during handling of
+-// the corresponding client method (see protocol.Client for the the
+-// LSP server-to-client RPCs) in order to make test expectations
+-// awaitable.
+-type ClientHooks struct {
+- OnLogMessage func(context.Context, *protocol.LogMessageParams) error
+- OnDiagnostics func(context.Context, *protocol.PublishDiagnosticsParams) error
+- OnWorkDoneProgressCreate func(context.Context, *protocol.WorkDoneProgressCreateParams) error
+- OnProgress func(context.Context, *protocol.ProgressParams) error
+- OnShowMessage func(context.Context, *protocol.ShowMessageParams) error
+- OnShowMessageRequest func(context.Context, *protocol.ShowMessageRequestParams) error
+- OnRegisterCapability func(context.Context, *protocol.RegistrationParams) error
+- OnUnregisterCapability func(context.Context, *protocol.UnregistrationParams) error
+- OnApplyEdit func(context.Context, *protocol.ApplyWorkspaceEditParams) error
+-}
+-
+-// Client is an adapter that converts an *Editor into an LSP Client. It mostly
+-// delegates functionality to hooks that can be configured by tests.
+-type Client struct {
+- editor *Editor
+- hooks ClientHooks
+- skipApplyEdits bool // don't apply edits from ApplyEdit downcalls to Editor
+-}
+-
+-func (c *Client) CodeLensRefresh(context.Context) error { return nil }
+-
+-func (c *Client) InlayHintRefresh(context.Context) error { return nil }
+-
+-func (c *Client) DiagnosticRefresh(context.Context) error { return nil }
+-
+-func (c *Client) InlineValueRefresh(context.Context) error { return nil }
+-
+-func (c *Client) SemanticTokensRefresh(context.Context) error { return nil }
+-
+-func (c *Client) LogTrace(context.Context, *protocol.LogTraceParams) error { return nil }
+-
+-func (c *Client) ShowMessage(ctx context.Context, params *protocol.ShowMessageParams) error {
+- if c.hooks.OnShowMessage != nil {
+- return c.hooks.OnShowMessage(ctx, params)
+- }
+- return nil
+-}
+-
+-func (c *Client) ShowMessageRequest(ctx context.Context, params *protocol.ShowMessageRequestParams) (*protocol.MessageActionItem, error) {
+- if c.hooks.OnShowMessageRequest != nil {
+- if err := c.hooks.OnShowMessageRequest(ctx, params); err != nil {
+- return nil, err
+- }
+- }
+- if len(params.Actions) == 0 || len(params.Actions) > 1 {
+- return nil, fmt.Errorf("fake editor cannot handle multiple action items")
+- }
+- return &params.Actions[0], nil
+-}
+-
+-func (c *Client) LogMessage(ctx context.Context, params *protocol.LogMessageParams) error {
+- if c.hooks.OnLogMessage != nil {
+- return c.hooks.OnLogMessage(ctx, params)
+- }
+- return nil
+-}
+-
+-func (c *Client) Event(ctx context.Context, event *interface{}) error {
+- return nil
+-}
+-
+-func (c *Client) PublishDiagnostics(ctx context.Context, params *protocol.PublishDiagnosticsParams) error {
+- if c.hooks.OnDiagnostics != nil {
+- return c.hooks.OnDiagnostics(ctx, params)
+- }
+- return nil
+-}
+-
+-func (c *Client) WorkspaceFolders(context.Context) ([]protocol.WorkspaceFolder, error) {
+- return []protocol.WorkspaceFolder{}, nil
+-}
+-
+-func (c *Client) Configuration(_ context.Context, p *protocol.ParamConfiguration) ([]interface{}, error) {
+- results := make([]interface{}, len(p.Items))
+- for i, item := range p.Items {
+- if item.Section == "gopls" {
+- c.editor.mu.Lock()
+- results[i] = c.editor.settingsLocked()
+- c.editor.mu.Unlock()
+- }
+- }
+- return results, nil
+-}
+-
+-func (c *Client) RegisterCapability(ctx context.Context, params *protocol.RegistrationParams) error {
+- if c.hooks.OnRegisterCapability != nil {
+- if err := c.hooks.OnRegisterCapability(ctx, params); err != nil {
+- return err
+- }
+- }
+- // Update file watching patterns.
+- //
+- // TODO(rfindley): We could verify more here, like verify that the
+- // registration ID is distinct, and that the capability is not currently
+- // registered.
+- for _, registration := range params.Registrations {
+- if registration.Method == "workspace/didChangeWatchedFiles" {
+- // Marshal and unmarshal to interpret RegisterOptions as
+- // DidChangeWatchedFilesRegistrationOptions.
+- raw, err := json.Marshal(registration.RegisterOptions)
+- if err != nil {
+- return fmt.Errorf("marshaling registration options: %v", err)
+- }
+- var opts protocol.DidChangeWatchedFilesRegistrationOptions
+- if err := json.Unmarshal(raw, &opts); err != nil {
+- return fmt.Errorf("unmarshaling registration options: %v", err)
+- }
+- var globs []*glob.Glob
+- for _, watcher := range opts.Watchers {
+- // TODO(rfindley): honor the watch kind.
+- g, err := glob.Parse(watcher.GlobPattern)
+- if err != nil {
+- return fmt.Errorf("error parsing glob pattern %q: %v", watcher.GlobPattern, err)
+- }
+- globs = append(globs, g)
+- }
+- c.editor.mu.Lock()
+- c.editor.watchPatterns = globs
+- c.editor.mu.Unlock()
+- }
+- }
+- return nil
+-}
+-
+-func (c *Client) UnregisterCapability(ctx context.Context, params *protocol.UnregistrationParams) error {
+- if c.hooks.OnUnregisterCapability != nil {
+- return c.hooks.OnUnregisterCapability(ctx, params)
+- }
+- return nil
+-}
+-
+-func (c *Client) Progress(ctx context.Context, params *protocol.ProgressParams) error {
+- if c.hooks.OnProgress != nil {
+- return c.hooks.OnProgress(ctx, params)
+- }
+- return nil
+-}
+-
+-func (c *Client) WorkDoneProgressCreate(ctx context.Context, params *protocol.WorkDoneProgressCreateParams) error {
+- if c.hooks.OnWorkDoneProgressCreate != nil {
+- return c.hooks.OnWorkDoneProgressCreate(ctx, params)
+- }
+- return nil
+-}
+-
+-func (c *Client) ShowDocument(context.Context, *protocol.ShowDocumentParams) (*protocol.ShowDocumentResult, error) {
+- return nil, nil
+-}
+-
+-func (c *Client) ApplyEdit(ctx context.Context, params *protocol.ApplyWorkspaceEditParams) (*protocol.ApplyWorkspaceEditResult, error) {
+- if len(params.Edit.Changes) != 0 {
+- return &protocol.ApplyWorkspaceEditResult{FailureReason: "Edit.Changes is unsupported"}, nil
+- }
+- if c.hooks.OnApplyEdit != nil {
+- if err := c.hooks.OnApplyEdit(ctx, params); err != nil {
+- return nil, err
+- }
+- }
+- if !c.skipApplyEdits {
+- for _, change := range params.Edit.DocumentChanges {
+- if err := c.editor.applyDocumentChange(ctx, change); err != nil {
+- return nil, err
+- }
+- }
+- }
+- return &protocol.ApplyWorkspaceEditResult{Applied: true}, nil
+-}
+diff -urN a/gopls/internal/lsp/fake/doc.go b/gopls/internal/lsp/fake/doc.go
+--- a/gopls/internal/lsp/fake/doc.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/fake/doc.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,19 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package fake provides fake implementations of a text editor, LSP client
+-// plugin, and Sandbox environment for use in tests.
+-//
+-// The Editor type provides a high level API for text editor operations
+-// (open/modify/save/close a buffer, jump to definition, etc.), and the Client
+-// type exposes an LSP client for the editor that can be connected to a
+-// language server. By default, the Editor and Client should be compliant with
+-// the LSP spec: their intended use is to verify server compliance with the
+-// spec in a variety of environment. Possible future enhancements of these
+-// types may allow them to misbehave in configurable ways, but that is not
+-// their primary use.
+-//
+-// The Sandbox type provides a facility for executing tests with a temporary
+-// directory, module proxy, and GOPATH.
+-package fake
+diff -urN a/gopls/internal/lsp/fake/edit.go b/gopls/internal/lsp/fake/edit.go
+--- a/gopls/internal/lsp/fake/edit.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/fake/edit.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,51 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fake
+-
+-import (
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/diff"
+-)
+-
+-// NewEdit creates an edit replacing all content between the 0-based
+-// (startLine, startColumn) and (endLine, endColumn) with text.
+-//
+-// Columns measure UTF-16 codes.
+-func NewEdit(startLine, startColumn, endLine, endColumn uint32, text string) protocol.TextEdit {
+- return protocol.TextEdit{
+- Range: protocol.Range{
+- Start: protocol.Position{Line: startLine, Character: startColumn},
+- End: protocol.Position{Line: endLine, Character: endColumn},
+- },
+- NewText: text,
+- }
+-}
+-
+-func EditToChangeEvent(e protocol.TextEdit) protocol.TextDocumentContentChangeEvent {
+- var rng protocol.Range = e.Range
+- return protocol.TextDocumentContentChangeEvent{
+- Range: &rng,
+- Text: e.NewText,
+- }
+-}
+-
+-// applyEdits applies the edits to a file with the specified lines,
+-// and returns a new slice containing the lines of the patched file.
+-// It is a wrapper around diff.Apply; see that function for preconditions.
+-func applyEdits(mapper *protocol.Mapper, edits []protocol.TextEdit, windowsLineEndings bool) ([]byte, error) {
+- diffEdits, err := source.FromProtocolEdits(mapper, edits)
+- if err != nil {
+- return nil, err
+- }
+- patched, err := diff.ApplyBytes(mapper.Content, diffEdits)
+- if err != nil {
+- return nil, err
+- }
+- if windowsLineEndings {
+- patched = toWindowsLineEndings(patched)
+- }
+- return patched, nil
+-}
+diff -urN a/gopls/internal/lsp/fake/editor.go b/gopls/internal/lsp/fake/editor.go
+--- a/gopls/internal/lsp/fake/editor.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/fake/editor.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1464 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fake
+-
+-import (
+- "bytes"
+- "context"
+- "errors"
+- "fmt"
+- "os"
+- "path"
+- "path/filepath"
+- "regexp"
+- "strings"
+- "sync"
+-
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/glob"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/jsonrpc2"
+- "golang.org/x/tools/internal/jsonrpc2/servertest"
+- "golang.org/x/tools/internal/xcontext"
+-)
+-
+-// Editor is a fake editor client. It keeps track of client state and can be
+-// used for writing LSP tests.
+-type Editor struct {
+-
+- // Server, client, and sandbox are concurrency safe and written only
+- // at construction time, so do not require synchronization.
+- Server protocol.Server
+- cancelConn func()
+- serverConn jsonrpc2.Conn
+- client *Client
+- sandbox *Sandbox
+- defaultEnv map[string]string
+-
+- // TODO(adonovan): buffers should be keyed by protocol.DocumentURI.
+- mu sync.Mutex
+- config EditorConfig // editor configuration
+- buffers map[string]buffer // open buffers (relative path -> buffer content)
+- serverCapabilities protocol.ServerCapabilities // capabilities / options
+- watchPatterns []*glob.Glob // glob patterns to watch
+-
+- // Call metrics for the purpose of expectations. This is done in an ad-hoc
+- // manner for now. Perhaps in the future we should do something more
+- // systematic. Guarded with a separate mutex as calls may need to be accessed
+- // asynchronously via callbacks into the Editor.
+- callsMu sync.Mutex
+- calls CallCounts
+-}
+-
+-// CallCounts tracks the number of protocol notifications of different types.
+-type CallCounts struct {
+- DidOpen, DidChange, DidSave, DidChangeWatchedFiles, DidClose uint64
+-}
+-
+-// buffer holds information about an open buffer in the editor.
+-type buffer struct {
+- version int // monotonic version; incremented on edits
+- path string // relative path in the workspace
+- mapper *protocol.Mapper // buffer content
+- dirty bool // if true, content is unsaved (TODO(rfindley): rename this field)
+-}
+-
+-func (b buffer) text() string {
+- return string(b.mapper.Content)
+-}
+-
+-// EditorConfig configures the editor's LSP session. This is similar to
+-// source.UserOptions, but we use a separate type here so that we expose only
+-// that configuration which we support.
+-//
+-// The zero value for EditorConfig should correspond to its defaults.
+-type EditorConfig struct {
+- // Env holds environment variables to apply on top of the default editor
+- // environment. When applying these variables, the special string
+- // $SANDBOX_WORKDIR is replaced by the absolute path to the sandbox working
+- // directory.
+- Env map[string]string
+-
+- // WorkspaceFolders is the workspace folders to configure on the LSP server,
+- // relative to the sandbox workdir.
+- //
+- // As a special case, if WorkspaceFolders is nil the editor defaults to
+- // configuring a single workspace folder corresponding to the workdir root.
+- // To explicitly send no workspace folders, use an empty (non-nil) slice.
+- WorkspaceFolders []string
+-
+- // Whether to edit files with windows line endings.
+- WindowsLineEndings bool
+-
+- // Map of language ID -> regexp to match, used to set the file type of new
+- // buffers. Applied as an overlay on top of the following defaults:
+- // "go" -> ".*\.go"
+- // "go.mod" -> "go\.mod"
+- // "go.sum" -> "go\.sum"
+- // "gotmpl" -> ".*tmpl"
+- FileAssociations map[string]string
+-
+- // Settings holds user-provided configuration for the LSP server.
+- Settings map[string]interface{}
+-}
+-
+-// NewEditor creates a new Editor.
+-func NewEditor(sandbox *Sandbox, config EditorConfig) *Editor {
+- return &Editor{
+- buffers: make(map[string]buffer),
+- sandbox: sandbox,
+- defaultEnv: sandbox.GoEnv(),
+- config: config,
+- }
+-}
+-
+-// Connect configures the editor to communicate with an LSP server on conn. It
+-// is not concurrency safe, and should be called at most once, before using the
+-// editor.
+-//
+-// It returns the editor, so that it may be called as follows:
+-//
+-// editor, err := NewEditor(s).Connect(ctx, conn, hooks)
+-func (e *Editor) Connect(ctx context.Context, connector servertest.Connector, hooks ClientHooks, skipApplyEdits bool) (*Editor, error) {
+- bgCtx, cancelConn := context.WithCancel(xcontext.Detach(ctx))
+- conn := connector.Connect(bgCtx)
+- e.cancelConn = cancelConn
+-
+- e.serverConn = conn
+- e.Server = protocol.ServerDispatcher(conn)
+- e.client = &Client{editor: e, hooks: hooks, skipApplyEdits: skipApplyEdits}
+- conn.Go(bgCtx,
+- protocol.Handlers(
+- protocol.ClientHandler(e.client,
+- jsonrpc2.MethodNotFound)))
+-
+- if err := e.initialize(ctx); err != nil {
+- return nil, err
+- }
+- e.sandbox.Workdir.AddWatcher(e.onFileChanges)
+- return e, nil
+-}
+-
+-func (e *Editor) Stats() CallCounts {
+- e.callsMu.Lock()
+- defer e.callsMu.Unlock()
+- return e.calls
+-}
+-
+-// Shutdown issues the 'shutdown' LSP notification.
+-func (e *Editor) Shutdown(ctx context.Context) error {
+- if e.Server != nil {
+- if err := e.Server.Shutdown(ctx); err != nil {
+- return fmt.Errorf("Shutdown: %w", err)
+- }
+- }
+- return nil
+-}
+-
+-// Exit issues the 'exit' LSP notification.
+-func (e *Editor) Exit(ctx context.Context) error {
+- if e.Server != nil {
+- // Not all LSP clients issue the exit RPC, but we do so here to ensure that
+- // we gracefully handle it on multi-session servers.
+- if err := e.Server.Exit(ctx); err != nil {
+- return fmt.Errorf("Exit: %w", err)
+- }
+- }
+- return nil
+-}
+-
+-// Close issues the shutdown and exit sequence an editor should.
+-func (e *Editor) Close(ctx context.Context) error {
+- if err := e.Shutdown(ctx); err != nil {
+- return err
+- }
+- if err := e.Exit(ctx); err != nil {
+- return err
+- }
+- defer func() {
+- e.cancelConn()
+- }()
+-
+- // called close on the editor should result in the connection closing
+- select {
+- case <-e.serverConn.Done():
+- // connection closed itself
+- return nil
+- case <-ctx.Done():
+- return fmt.Errorf("connection not closed: %w", ctx.Err())
+- }
+-}
+-
+-// Client returns the LSP client for this editor.
+-func (e *Editor) Client() *Client {
+- return e.client
+-}
+-
+-// settingsLocked builds the settings map for use in LSP settings RPCs.
+-//
+-// e.mu must be held while calling this function.
+-func (e *Editor) settingsLocked() map[string]interface{} {
+- env := make(map[string]string)
+- for k, v := range e.defaultEnv {
+- env[k] = v
+- }
+- for k, v := range e.config.Env {
+- env[k] = v
+- }
+- for k, v := range env {
+- v = strings.ReplaceAll(v, "$SANDBOX_WORKDIR", e.sandbox.Workdir.RootURI().SpanURI().Filename())
+- env[k] = v
+- }
+-
+- settings := map[string]interface{}{
+- "env": env,
+-
+- // Use verbose progress reporting so that regtests can assert on
+- // asynchronous operations being completed (such as diagnosing a snapshot).
+- "verboseWorkDoneProgress": true,
+-
+- // Set a generous completion budget, so that tests don't flake because
+- // completions are too slow.
+- "completionBudget": "10s",
+-
+- // Shorten the diagnostic delay to speed up test execution (else we'd add
+- // the default delay to each assertion about diagnostics)
+- "diagnosticsDelay": "10ms",
+- }
+-
+- for k, v := range e.config.Settings {
+- if k == "env" {
+- panic("must not provide env via the EditorConfig.Settings field: use the EditorConfig.Env field instead")
+- }
+- settings[k] = v
+- }
+-
+- return settings
+-}
+-
+-func (e *Editor) initialize(ctx context.Context) error {
+- params := &protocol.ParamInitialize{}
+- params.ClientInfo = &protocol.Msg_XInitializeParams_clientInfo{}
+- params.ClientInfo.Name = "fakeclient"
+- params.ClientInfo.Version = "v1.0.0"
+- e.mu.Lock()
+- params.WorkspaceFolders = e.makeWorkspaceFoldersLocked()
+- params.InitializationOptions = e.settingsLocked()
+- e.mu.Unlock()
+- params.Capabilities.Workspace.Configuration = true
+- params.Capabilities.Window.WorkDoneProgress = true
+-
+- // TODO: set client capabilities
+- params.Capabilities.TextDocument.Completion.CompletionItem.TagSupport.ValueSet = []protocol.CompletionItemTag{protocol.ComplDeprecated}
+-
+- params.Capabilities.TextDocument.Completion.CompletionItem.SnippetSupport = true
+- params.Capabilities.TextDocument.SemanticTokens.Requests.Full.Value = true
+- // copied from lsp/semantic.go to avoid import cycle in tests
+- params.Capabilities.TextDocument.SemanticTokens.TokenTypes = []string{
+- "namespace", "type", "class", "enum", "interface",
+- "struct", "typeParameter", "parameter", "variable", "property", "enumMember",
+- "event", "function", "method", "macro", "keyword", "modifier", "comment",
+- "string", "number", "regexp", "operator",
+- }
+- params.Capabilities.TextDocument.SemanticTokens.TokenModifiers = []string{
+- "declaration", "definition", "readonly", "static",
+- "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary",
+- }
+-
+- // This is a bit of a hack, since the fake editor doesn't actually support
+- // watching changed files that match a specific glob pattern. However, the
+- // editor does send didChangeWatchedFiles notifications, so set this to
+- // true.
+- params.Capabilities.Workspace.DidChangeWatchedFiles.DynamicRegistration = true
+- params.Capabilities.Workspace.WorkspaceEdit = &protocol.WorkspaceEditClientCapabilities{
+- ResourceOperations: []protocol.ResourceOperationKind{
+- "rename",
+- },
+- }
+-
+- trace := protocol.TraceValues("messages")
+- params.Trace = &trace
+- // TODO: support workspace folders.
+- if e.Server != nil {
+- resp, err := e.Server.Initialize(ctx, params)
+- if err != nil {
+- return fmt.Errorf("initialize: %w", err)
+- }
+- e.mu.Lock()
+- e.serverCapabilities = resp.Capabilities
+- e.mu.Unlock()
+-
+- if err := e.Server.Initialized(ctx, &protocol.InitializedParams{}); err != nil {
+- return fmt.Errorf("initialized: %w", err)
+- }
+- }
+- // TODO: await initial configuration here, or expect gopls to manage that?
+- return nil
+-}
+-
+-// makeWorkspaceFoldersLocked creates a slice of workspace folders to use for
+-// this editing session, based on the editor configuration.
+-//
+-// e.mu must be held while calling this function.
+-func (e *Editor) makeWorkspaceFoldersLocked() (folders []protocol.WorkspaceFolder) {
+- paths := e.config.WorkspaceFolders
+- if len(paths) == 0 {
+- paths = append(paths, string(e.sandbox.Workdir.RelativeTo))
+- }
+-
+- for _, path := range paths {
+- uri := string(e.sandbox.Workdir.URI(path))
+- folders = append(folders, protocol.WorkspaceFolder{
+- URI: uri,
+- Name: filepath.Base(uri),
+- })
+- }
+-
+- return folders
+-}
+-
+-// onFileChanges is registered to be called by the Workdir on any writes that
+-// go through the Workdir API. It is called synchronously by the Workdir.
+-func (e *Editor) onFileChanges(ctx context.Context, evts []protocol.FileEvent) {
+- if e.Server == nil {
+- return
+- }
+-
+- // e may be locked when onFileChanges is called, but it is important that we
+- // synchronously increment this counter so that we can subsequently assert on
+- // the number of expected DidChangeWatchedFiles calls.
+- e.callsMu.Lock()
+- e.calls.DidChangeWatchedFiles++
+- e.callsMu.Unlock()
+-
+- // Since e may be locked, we must run this mutation asynchronously.
+- go func() {
+- e.mu.Lock()
+- defer e.mu.Unlock()
+- for _, evt := range evts {
+- // Always send an on-disk change, even for events that seem useless
+- // because they're shadowed by an open buffer.
+- path := e.sandbox.Workdir.URIToPath(evt.URI)
+- if buf, ok := e.buffers[path]; ok {
+- // Following VS Code, don't honor deletions or changes to dirty buffers.
+- if buf.dirty || evt.Type == protocol.Deleted {
+- continue
+- }
+-
+- content, err := e.sandbox.Workdir.ReadFile(path)
+- if err != nil {
+- continue // A race with some other operation.
+- }
+- // No need to update if the buffer content hasn't changed.
+- if string(content) == buf.text() {
+- continue
+- }
+- // During shutdown, this call will fail. Ignore the error.
+- _ = e.setBufferContentLocked(ctx, path, false, content, nil)
+- }
+- }
+- var matchedEvts []protocol.FileEvent
+- for _, evt := range evts {
+- filename := filepath.ToSlash(evt.URI.SpanURI().Filename())
+- for _, g := range e.watchPatterns {
+- if g.Match(filename) {
+- matchedEvts = append(matchedEvts, evt)
+- break
+- }
+- }
+- }
+-
+- // TODO(rfindley): don't send notifications while locked.
+- e.Server.DidChangeWatchedFiles(ctx, &protocol.DidChangeWatchedFilesParams{
+- Changes: matchedEvts,
+- })
+- }()
+-}
+-
+-// OpenFile creates a buffer for the given workdir-relative file.
+-//
+-// If the file is already open, it is a no-op.
+-func (e *Editor) OpenFile(ctx context.Context, path string) error {
+- if e.HasBuffer(path) {
+- return nil
+- }
+- content, err := e.sandbox.Workdir.ReadFile(path)
+- if err != nil {
+- return err
+- }
+- if e.Config().WindowsLineEndings {
+- content = toWindowsLineEndings(content)
+- }
+- return e.createBuffer(ctx, path, false, content)
+-}
+-
+-// toWindowsLineEndings checks whether content has windows line endings.
+-//
+-// If so, it returns content unmodified. If not, it returns a new byte slice modified to use CRLF line endings.
+-func toWindowsLineEndings(content []byte) []byte {
+- abnormal := false
+- for i, b := range content {
+- if b == '\n' && (i == 0 || content[i-1] != '\r') {
+- abnormal = true
+- break
+- }
+- }
+- if !abnormal {
+- return content
+- }
+- var buf bytes.Buffer
+- for i, b := range content {
+- if b == '\n' && (i == 0 || content[i-1] != '\r') {
+- buf.WriteByte('\r')
+- }
+- buf.WriteByte(b)
+- }
+- return buf.Bytes()
+-}
+-
+-// CreateBuffer creates a new unsaved buffer corresponding to the workdir path,
+-// containing the given textual content.
+-func (e *Editor) CreateBuffer(ctx context.Context, path, content string) error {
+- return e.createBuffer(ctx, path, true, []byte(content))
+-}
+-
+-func (e *Editor) createBuffer(ctx context.Context, path string, dirty bool, content []byte) error {
+- e.mu.Lock()
+-
+- if _, ok := e.buffers[path]; ok {
+- e.mu.Unlock()
+- return fmt.Errorf("buffer %q already exists", path)
+- }
+-
+- uri := e.sandbox.Workdir.URI(path).SpanURI()
+- buf := buffer{
+- version: 1,
+- path: path,
+- mapper: protocol.NewMapper(uri, content),
+- dirty: dirty,
+- }
+- e.buffers[path] = buf
+-
+- item := e.textDocumentItem(buf)
+- e.mu.Unlock()
+-
+- return e.sendDidOpen(ctx, item)
+-}
+-
+-// textDocumentItem builds a protocol.TextDocumentItem for the given buffer.
+-//
+-// Precondition: e.mu must be held.
+-func (e *Editor) textDocumentItem(buf buffer) protocol.TextDocumentItem {
+- return protocol.TextDocumentItem{
+- URI: e.sandbox.Workdir.URI(buf.path),
+- LanguageID: languageID(buf.path, e.config.FileAssociations),
+- Version: int32(buf.version),
+- Text: buf.text(),
+- }
+-}
+-
+-func (e *Editor) sendDidOpen(ctx context.Context, item protocol.TextDocumentItem) error {
+- if e.Server != nil {
+- if err := e.Server.DidOpen(ctx, &protocol.DidOpenTextDocumentParams{
+- TextDocument: item,
+- }); err != nil {
+- return fmt.Errorf("DidOpen: %w", err)
+- }
+- e.callsMu.Lock()
+- e.calls.DidOpen++
+- e.callsMu.Unlock()
+- }
+- return nil
+-}
+-
+-var defaultFileAssociations = map[string]*regexp.Regexp{
+- "go": regexp.MustCompile(`^.*\.go$`), // '$' is important: don't match .gotmpl!
+- "go.mod": regexp.MustCompile(`^go\.mod$`),
+- "go.sum": regexp.MustCompile(`^go(\.work)?\.sum$`),
+- "go.work": regexp.MustCompile(`^go\.work$`),
+- "gotmpl": regexp.MustCompile(`^.*tmpl$`),
+-}
+-
+-// languageID returns the language identifier for the path p given the user
+-// configured fileAssociations.
+-func languageID(p string, fileAssociations map[string]string) string {
+- base := path.Base(p)
+- for lang, re := range fileAssociations {
+- re := regexp.MustCompile(re)
+- if re.MatchString(base) {
+- return lang
+- }
+- }
+- for lang, re := range defaultFileAssociations {
+- if re.MatchString(base) {
+- return lang
+- }
+- }
+- return ""
+-}
+-
+-// CloseBuffer removes the current buffer (regardless of whether it is saved).
+-func (e *Editor) CloseBuffer(ctx context.Context, path string) error {
+- e.mu.Lock()
+- _, ok := e.buffers[path]
+- if !ok {
+- e.mu.Unlock()
+- return ErrUnknownBuffer
+- }
+- delete(e.buffers, path)
+- e.mu.Unlock()
+-
+- return e.sendDidClose(ctx, e.TextDocumentIdentifier(path))
+-}
+-
+-func (e *Editor) sendDidClose(ctx context.Context, doc protocol.TextDocumentIdentifier) error {
+- if e.Server != nil {
+- if err := e.Server.DidClose(ctx, &protocol.DidCloseTextDocumentParams{
+- TextDocument: doc,
+- }); err != nil {
+- return fmt.Errorf("DidClose: %w", err)
+- }
+- e.callsMu.Lock()
+- e.calls.DidClose++
+- e.callsMu.Unlock()
+- }
+- return nil
+-}
+-
+-func (e *Editor) TextDocumentIdentifier(path string) protocol.TextDocumentIdentifier {
+- return protocol.TextDocumentIdentifier{
+- URI: e.sandbox.Workdir.URI(path),
+- }
+-}
+-
+-// SaveBuffer writes the content of the buffer specified by the given path to
+-// the filesystem.
+-func (e *Editor) SaveBuffer(ctx context.Context, path string) error {
+- if err := e.OrganizeImports(ctx, path); err != nil {
+- return fmt.Errorf("organizing imports before save: %w", err)
+- }
+- if err := e.FormatBuffer(ctx, path); err != nil {
+- return fmt.Errorf("formatting before save: %w", err)
+- }
+- return e.SaveBufferWithoutActions(ctx, path)
+-}
+-
+-func (e *Editor) SaveBufferWithoutActions(ctx context.Context, path string) error {
+- e.mu.Lock()
+- defer e.mu.Unlock()
+- buf, ok := e.buffers[path]
+- if !ok {
+- return fmt.Errorf(fmt.Sprintf("unknown buffer: %q", path))
+- }
+- content := buf.text()
+- includeText := false
+- syncOptions, ok := e.serverCapabilities.TextDocumentSync.(protocol.TextDocumentSyncOptions)
+- if ok {
+- includeText = syncOptions.Save.IncludeText
+- }
+-
+- docID := e.TextDocumentIdentifier(buf.path)
+- if e.Server != nil {
+- if err := e.Server.WillSave(ctx, &protocol.WillSaveTextDocumentParams{
+- TextDocument: docID,
+- Reason: protocol.Manual,
+- }); err != nil {
+- return fmt.Errorf("WillSave: %w", err)
+- }
+- }
+- if err := e.sandbox.Workdir.WriteFile(ctx, path, content); err != nil {
+- return fmt.Errorf("writing %q: %w", path, err)
+- }
+-
+- buf.dirty = false
+- e.buffers[path] = buf
+-
+- if e.Server != nil {
+- params := &protocol.DidSaveTextDocumentParams{
+- TextDocument: docID,
+- }
+- if includeText {
+- params.Text = &content
+- }
+- if err := e.Server.DidSave(ctx, params); err != nil {
+- return fmt.Errorf("DidSave: %w", err)
+- }
+- e.callsMu.Lock()
+- e.calls.DidSave++
+- e.callsMu.Unlock()
+- }
+- return nil
+-}
+-
+-// ErrNoMatch is returned if a regexp search fails.
+-var (
+- ErrNoMatch = errors.New("no match")
+- ErrUnknownBuffer = errors.New("unknown buffer")
+-)
+-
+-// regexpLocation returns the location of the first occurrence of either re
+-// or its singular subgroup. It returns ErrNoMatch if the regexp doesn't match.
+-func regexpLocation(mapper *protocol.Mapper, re string) (protocol.Location, error) {
+- var start, end int
+- rec, err := regexp.Compile(re)
+- if err != nil {
+- return protocol.Location{}, err
+- }
+- indexes := rec.FindSubmatchIndex(mapper.Content)
+- if indexes == nil {
+- return protocol.Location{}, ErrNoMatch
+- }
+- switch len(indexes) {
+- case 2:
+- // no subgroups: return the range of the regexp expression
+- start, end = indexes[0], indexes[1]
+- case 4:
+- // one subgroup: return its range
+- start, end = indexes[2], indexes[3]
+- default:
+- return protocol.Location{}, fmt.Errorf("invalid search regexp %q: expect either 0 or 1 subgroups, got %d", re, len(indexes)/2-1)
+- }
+- return mapper.OffsetLocation(start, end)
+-}
+-
+-// RegexpSearch returns the Location of the first match for re in the buffer
+-// bufName. For convenience, RegexpSearch supports the following two modes:
+-// 1. If re has no subgroups, return the position of the match for re itself.
+-// 2. If re has one subgroup, return the position of the first subgroup.
+-//
+-// It returns an error re is invalid, has more than one subgroup, or doesn't
+-// match the buffer.
+-func (e *Editor) RegexpSearch(bufName, re string) (protocol.Location, error) {
+- e.mu.Lock()
+- buf, ok := e.buffers[bufName]
+- e.mu.Unlock()
+- if !ok {
+- return protocol.Location{}, ErrUnknownBuffer
+- }
+- return regexpLocation(buf.mapper, re)
+-}
+-
+-// RegexpReplace edits the buffer corresponding to path by replacing the first
+-// instance of re, or its first subgroup, with the replace text. See
+-// RegexpSearch for more explanation of these two modes.
+-// It returns an error if re is invalid, has more than one subgroup, or doesn't
+-// match the buffer.
+-func (e *Editor) RegexpReplace(ctx context.Context, path, re, replace string) error {
+- e.mu.Lock()
+- defer e.mu.Unlock()
+- buf, ok := e.buffers[path]
+- if !ok {
+- return ErrUnknownBuffer
+- }
+- loc, err := regexpLocation(buf.mapper, re)
+- if err != nil {
+- return err
+- }
+- edits := []protocol.TextEdit{{
+- Range: loc.Range,
+- NewText: replace,
+- }}
+- patched, err := applyEdits(buf.mapper, edits, e.config.WindowsLineEndings)
+- if err != nil {
+- return fmt.Errorf("editing %q: %v", path, err)
+- }
+- return e.setBufferContentLocked(ctx, path, true, patched, edits)
+-}
+-
+-// EditBuffer applies the given test edits to the buffer identified by path.
+-func (e *Editor) EditBuffer(ctx context.Context, path string, edits []protocol.TextEdit) error {
+- e.mu.Lock()
+- defer e.mu.Unlock()
+- return e.editBufferLocked(ctx, path, edits)
+-}
+-
+-func (e *Editor) SetBufferContent(ctx context.Context, path, content string) error {
+- e.mu.Lock()
+- defer e.mu.Unlock()
+- return e.setBufferContentLocked(ctx, path, true, []byte(content), nil)
+-}
+-
+-// HasBuffer reports whether the file name is open in the editor.
+-func (e *Editor) HasBuffer(name string) bool {
+- e.mu.Lock()
+- defer e.mu.Unlock()
+- _, ok := e.buffers[name]
+- return ok
+-}
+-
+-// BufferText returns the content of the buffer with the given name, or "" if
+-// the file at that path is not open. The second return value reports whether
+-// the file is open.
+-func (e *Editor) BufferText(name string) (string, bool) {
+- e.mu.Lock()
+- defer e.mu.Unlock()
+- buf, ok := e.buffers[name]
+- if !ok {
+- return "", false
+- }
+- return buf.text(), true
+-}
+-
+-// Mapper returns the protocol.Mapper for the given buffer name, if it is open.
+-func (e *Editor) Mapper(name string) (*protocol.Mapper, error) {
+- e.mu.Lock()
+- defer e.mu.Unlock()
+- buf, ok := e.buffers[name]
+- if !ok {
+- return nil, fmt.Errorf("no mapper for %q", name)
+- }
+- return buf.mapper, nil
+-}
+-
+-// BufferVersion returns the current version of the buffer corresponding to
+-// name (or 0 if it is not being edited).
+-func (e *Editor) BufferVersion(name string) int {
+- e.mu.Lock()
+- defer e.mu.Unlock()
+- return e.buffers[name].version
+-}
+-
+-func (e *Editor) editBufferLocked(ctx context.Context, path string, edits []protocol.TextEdit) error {
+- buf, ok := e.buffers[path]
+- if !ok {
+- return fmt.Errorf("unknown buffer %q", path)
+- }
+- content, err := applyEdits(buf.mapper, edits, e.config.WindowsLineEndings)
+- if err != nil {
+- return fmt.Errorf("editing %q: %v; edits:\n%v", path, err, edits)
+- }
+- return e.setBufferContentLocked(ctx, path, true, content, edits)
+-}
+-
+-func (e *Editor) setBufferContentLocked(ctx context.Context, path string, dirty bool, content []byte, fromEdits []protocol.TextEdit) error {
+- buf, ok := e.buffers[path]
+- if !ok {
+- return fmt.Errorf("unknown buffer %q", path)
+- }
+- buf.mapper = protocol.NewMapper(buf.mapper.URI, content)
+- buf.version++
+- buf.dirty = dirty
+- e.buffers[path] = buf
+- // A simple heuristic: if there is only one edit, send it incrementally.
+- // Otherwise, send the entire content.
+- var evts []protocol.TextDocumentContentChangeEvent
+- if len(fromEdits) == 1 {
+- evts = append(evts, EditToChangeEvent(fromEdits[0]))
+- } else {
+- evts = append(evts, protocol.TextDocumentContentChangeEvent{
+- Text: buf.text(),
+- })
+- }
+- params := &protocol.DidChangeTextDocumentParams{
+- TextDocument: protocol.VersionedTextDocumentIdentifier{
+- Version: int32(buf.version),
+- TextDocumentIdentifier: e.TextDocumentIdentifier(buf.path),
+- },
+- ContentChanges: evts,
+- }
+- if e.Server != nil {
+- if err := e.Server.DidChange(ctx, params); err != nil {
+- return fmt.Errorf("DidChange: %w", err)
+- }
+- e.callsMu.Lock()
+- e.calls.DidChange++
+- e.callsMu.Unlock()
+- }
+- return nil
+-}
+-
+-// GoToDefinition jumps to the definition of the symbol at the given position
+-// in an open buffer. It returns the location of the resulting jump.
+-//
+-// TODO(rfindley): rename to "Definition", to be consistent with LSP
+-// terminology.
+-func (e *Editor) GoToDefinition(ctx context.Context, loc protocol.Location) (protocol.Location, error) {
+- if err := e.checkBufferLocation(loc); err != nil {
+- return protocol.Location{}, err
+- }
+- params := &protocol.DefinitionParams{}
+- params.TextDocument.URI = loc.URI
+- params.Position = loc.Range.Start
+-
+- resp, err := e.Server.Definition(ctx, params)
+- if err != nil {
+- return protocol.Location{}, fmt.Errorf("definition: %w", err)
+- }
+- return e.extractFirstLocation(ctx, resp)
+-}
+-
+-// GoToTypeDefinition jumps to the type definition of the symbol at the given location
+-// in an open buffer.
+-func (e *Editor) GoToTypeDefinition(ctx context.Context, loc protocol.Location) (protocol.Location, error) {
+- if err := e.checkBufferLocation(loc); err != nil {
+- return protocol.Location{}, err
+- }
+- params := &protocol.TypeDefinitionParams{}
+- params.TextDocument.URI = loc.URI
+- params.Position = loc.Range.Start
+-
+- resp, err := e.Server.TypeDefinition(ctx, params)
+- if err != nil {
+- return protocol.Location{}, fmt.Errorf("type definition: %w", err)
+- }
+- return e.extractFirstLocation(ctx, resp)
+-}
+-
+-// extractFirstLocation returns the first location.
+-// It opens the file if needed.
+-func (e *Editor) extractFirstLocation(ctx context.Context, locs []protocol.Location) (protocol.Location, error) {
+- if len(locs) == 0 {
+- return protocol.Location{}, nil
+- }
+-
+- newPath := e.sandbox.Workdir.URIToPath(locs[0].URI)
+- if !e.HasBuffer(newPath) {
+- if err := e.OpenFile(ctx, newPath); err != nil {
+- return protocol.Location{}, fmt.Errorf("OpenFile: %w", err)
+- }
+- }
+- return locs[0], nil
+-}
+-
+-// Symbol performs a workspace symbol search using query
+-func (e *Editor) Symbol(ctx context.Context, query string) ([]protocol.SymbolInformation, error) {
+- params := &protocol.WorkspaceSymbolParams{Query: query}
+- return e.Server.Symbol(ctx, params)
+-}
+-
+-// OrganizeImports requests and performs the source.organizeImports codeAction.
+-func (e *Editor) OrganizeImports(ctx context.Context, path string) error {
+- loc := protocol.Location{URI: e.sandbox.Workdir.URI(path)} // zero Range => whole file
+- _, err := e.applyCodeActions(ctx, loc, nil, protocol.SourceOrganizeImports)
+- return err
+-}
+-
+-// RefactorRewrite requests and performs the source.refactorRewrite codeAction.
+-func (e *Editor) RefactorRewrite(ctx context.Context, loc protocol.Location) error {
+- applied, err := e.applyCodeActions(ctx, loc, nil, protocol.RefactorRewrite)
+- if err != nil {
+- return err
+- }
+- if applied == 0 {
+- return fmt.Errorf("no refactorings were applied")
+- }
+- return nil
+-}
+-
+-// ApplyQuickFixes requests and performs the quickfix codeAction.
+-func (e *Editor) ApplyQuickFixes(ctx context.Context, loc protocol.Location, diagnostics []protocol.Diagnostic) error {
+- applied, err := e.applyCodeActions(ctx, loc, diagnostics, protocol.SourceFixAll, protocol.QuickFix)
+- if applied == 0 {
+- return fmt.Errorf("no quick fixes were applied")
+- }
+- return err
+-}
+-
+-// ApplyCodeAction applies the given code action.
+-func (e *Editor) ApplyCodeAction(ctx context.Context, action protocol.CodeAction) error {
+- if action.Edit != nil {
+- for _, change := range action.Edit.DocumentChanges {
+- if change.TextDocumentEdit != nil {
+- path := e.sandbox.Workdir.URIToPath(change.TextDocumentEdit.TextDocument.URI)
+- if int32(e.buffers[path].version) != change.TextDocumentEdit.TextDocument.Version {
+- // Skip edits for old versions.
+- continue
+- }
+- if err := e.EditBuffer(ctx, path, change.TextDocumentEdit.Edits); err != nil {
+- return fmt.Errorf("editing buffer %q: %w", path, err)
+- }
+- }
+- }
+- }
+- // Execute any commands. The specification says that commands are
+- // executed after edits are applied.
+- if action.Command != nil {
+- if _, err := e.ExecuteCommand(ctx, &protocol.ExecuteCommandParams{
+- Command: action.Command.Command,
+- Arguments: action.Command.Arguments,
+- }); err != nil {
+- return err
+- }
+- }
+- // Some commands may edit files on disk.
+- return e.sandbox.Workdir.CheckForFileChanges(ctx)
+-}
+-
+-// GetQuickFixes returns the available quick fix code actions.
+-func (e *Editor) GetQuickFixes(ctx context.Context, loc protocol.Location, diagnostics []protocol.Diagnostic) ([]protocol.CodeAction, error) {
+- return e.getCodeActions(ctx, loc, diagnostics, protocol.QuickFix, protocol.SourceFixAll)
+-}
+-
+-func (e *Editor) applyCodeActions(ctx context.Context, loc protocol.Location, diagnostics []protocol.Diagnostic, only ...protocol.CodeActionKind) (int, error) {
+- actions, err := e.getCodeActions(ctx, loc, diagnostics, only...)
+- if err != nil {
+- return 0, err
+- }
+- applied := 0
+- for _, action := range actions {
+- if action.Title == "" {
+- return 0, fmt.Errorf("empty title for code action")
+- }
+- var match bool
+- for _, o := range only {
+- if action.Kind == o {
+- match = true
+- break
+- }
+- }
+- if !match {
+- continue
+- }
+- applied++
+- if err := e.ApplyCodeAction(ctx, action); err != nil {
+- return 0, err
+- }
+- }
+- return applied, nil
+-}
+-
+-func (e *Editor) getCodeActions(ctx context.Context, loc protocol.Location, diagnostics []protocol.Diagnostic, only ...protocol.CodeActionKind) ([]protocol.CodeAction, error) {
+- if e.Server == nil {
+- return nil, nil
+- }
+- params := &protocol.CodeActionParams{}
+- params.TextDocument.URI = loc.URI
+- params.Context.Only = only
+- params.Range = loc.Range // may be zero => whole file
+- if diagnostics != nil {
+- params.Context.Diagnostics = diagnostics
+- }
+- return e.Server.CodeAction(ctx, params)
+-}
+-
+-func (e *Editor) ExecuteCommand(ctx context.Context, params *protocol.ExecuteCommandParams) (interface{}, error) {
+- if e.Server == nil {
+- return nil, nil
+- }
+- var match bool
+- if e.serverCapabilities.ExecuteCommandProvider != nil {
+- // Ensure that this command was actually listed as a supported command.
+- for _, command := range e.serverCapabilities.ExecuteCommandProvider.Commands {
+- if command == params.Command {
+- match = true
+- break
+- }
+- }
+- }
+- if !match {
+- return nil, fmt.Errorf("unsupported command %q", params.Command)
+- }
+- result, err := e.Server.ExecuteCommand(ctx, params)
+- if err != nil {
+- return nil, err
+- }
+- // Some commands use the go command, which writes directly to disk.
+- // For convenience, check for those changes.
+- if err := e.sandbox.Workdir.CheckForFileChanges(ctx); err != nil {
+- return nil, fmt.Errorf("checking for file changes: %v", err)
+- }
+- return result, nil
+-}
+-
+-// FormatBuffer gofmts a Go file.
+-func (e *Editor) FormatBuffer(ctx context.Context, path string) error {
+- if e.Server == nil {
+- return nil
+- }
+- e.mu.Lock()
+- version := e.buffers[path].version
+- e.mu.Unlock()
+- params := &protocol.DocumentFormattingParams{}
+- params.TextDocument.URI = e.sandbox.Workdir.URI(path)
+- edits, err := e.Server.Formatting(ctx, params)
+- if err != nil {
+- return fmt.Errorf("textDocument/formatting: %w", err)
+- }
+- e.mu.Lock()
+- defer e.mu.Unlock()
+- if versionAfter := e.buffers[path].version; versionAfter != version {
+- return fmt.Errorf("before receipt of formatting edits, buffer version changed from %d to %d", version, versionAfter)
+- }
+- if len(edits) == 0 {
+- return nil
+- }
+- return e.editBufferLocked(ctx, path, edits)
+-}
+-
+-func (e *Editor) checkBufferLocation(loc protocol.Location) error {
+- e.mu.Lock()
+- defer e.mu.Unlock()
+- path := e.sandbox.Workdir.URIToPath(loc.URI)
+- buf, ok := e.buffers[path]
+- if !ok {
+- return fmt.Errorf("buffer %q is not open", path)
+- }
+-
+- _, _, err := buf.mapper.RangeOffsets(loc.Range)
+- return err
+-}
+-
+-// RunGenerate runs `go generate` non-recursively in the workdir-relative dir
+-// path. It does not report any resulting file changes as a watched file
+-// change, so must be followed by a call to Workdir.CheckForFileChanges once
+-// the generate command has completed.
+-// TODO(rFindley): this shouldn't be necessary anymore. Delete it.
+-func (e *Editor) RunGenerate(ctx context.Context, dir string) error {
+- if e.Server == nil {
+- return nil
+- }
+- absDir := e.sandbox.Workdir.AbsPath(dir)
+- cmd, err := command.NewGenerateCommand("", command.GenerateArgs{
+- Dir: protocol.URIFromSpanURI(span.URIFromPath(absDir)),
+- Recursive: false,
+- })
+- if err != nil {
+- return err
+- }
+- params := &protocol.ExecuteCommandParams{
+- Command: cmd.Command,
+- Arguments: cmd.Arguments,
+- }
+- if _, err := e.ExecuteCommand(ctx, params); err != nil {
+- return fmt.Errorf("running generate: %v", err)
+- }
+- // Unfortunately we can't simply poll the workdir for file changes here,
+- // because server-side command may not have completed. In regtests, we can
+- // Await this state change, but here we must delegate that responsibility to
+- // the caller.
+- return nil
+-}
+-
+-// CodeLens executes a codelens request on the server.
+-func (e *Editor) CodeLens(ctx context.Context, path string) ([]protocol.CodeLens, error) {
+- if e.Server == nil {
+- return nil, nil
+- }
+- e.mu.Lock()
+- _, ok := e.buffers[path]
+- e.mu.Unlock()
+- if !ok {
+- return nil, fmt.Errorf("buffer %q is not open", path)
+- }
+- params := &protocol.CodeLensParams{
+- TextDocument: e.TextDocumentIdentifier(path),
+- }
+- lens, err := e.Server.CodeLens(ctx, params)
+- if err != nil {
+- return nil, err
+- }
+- return lens, nil
+-}
+-
+-// Completion executes a completion request on the server.
+-func (e *Editor) Completion(ctx context.Context, loc protocol.Location) (*protocol.CompletionList, error) {
+- if e.Server == nil {
+- return nil, nil
+- }
+- path := e.sandbox.Workdir.URIToPath(loc.URI)
+- e.mu.Lock()
+- _, ok := e.buffers[path]
+- e.mu.Unlock()
+- if !ok {
+- return nil, fmt.Errorf("buffer %q is not open", path)
+- }
+- params := &protocol.CompletionParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+- completions, err := e.Server.Completion(ctx, params)
+- if err != nil {
+- return nil, err
+- }
+- return completions, nil
+-}
+-
+-// AcceptCompletion accepts a completion for the given item at the given
+-// position.
+-func (e *Editor) AcceptCompletion(ctx context.Context, loc protocol.Location, item protocol.CompletionItem) error {
+- if e.Server == nil {
+- return nil
+- }
+- e.mu.Lock()
+- defer e.mu.Unlock()
+- path := e.sandbox.Workdir.URIToPath(loc.URI)
+- _, ok := e.buffers[path]
+- if !ok {
+- return fmt.Errorf("buffer %q is not open", path)
+- }
+- return e.editBufferLocked(ctx, path, append([]protocol.TextEdit{
+- *item.TextEdit,
+- }, item.AdditionalTextEdits...))
+-}
+-
+-// Symbols executes a workspace/symbols request on the server.
+-func (e *Editor) Symbols(ctx context.Context, sym string) ([]protocol.SymbolInformation, error) {
+- if e.Server == nil {
+- return nil, nil
+- }
+- params := &protocol.WorkspaceSymbolParams{Query: sym}
+- ans, err := e.Server.Symbol(ctx, params)
+- return ans, err
+-}
+-
+-// CodeLens executes a codelens request on the server.
+-func (e *Editor) InlayHint(ctx context.Context, path string) ([]protocol.InlayHint, error) {
+- if e.Server == nil {
+- return nil, nil
+- }
+- e.mu.Lock()
+- _, ok := e.buffers[path]
+- e.mu.Unlock()
+- if !ok {
+- return nil, fmt.Errorf("buffer %q is not open", path)
+- }
+- params := &protocol.InlayHintParams{
+- TextDocument: e.TextDocumentIdentifier(path),
+- }
+- hints, err := e.Server.InlayHint(ctx, params)
+- if err != nil {
+- return nil, err
+- }
+- return hints, nil
+-}
+-
+-// References returns references to the object at loc, as returned by
+-// the connected LSP server. If no server is connected, it returns (nil, nil).
+-func (e *Editor) References(ctx context.Context, loc protocol.Location) ([]protocol.Location, error) {
+- if e.Server == nil {
+- return nil, nil
+- }
+- path := e.sandbox.Workdir.URIToPath(loc.URI)
+- e.mu.Lock()
+- _, ok := e.buffers[path]
+- e.mu.Unlock()
+- if !ok {
+- return nil, fmt.Errorf("buffer %q is not open", path)
+- }
+- params := &protocol.ReferenceParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- Context: protocol.ReferenceContext{
+- IncludeDeclaration: true,
+- },
+- }
+- locations, err := e.Server.References(ctx, params)
+- if err != nil {
+- return nil, err
+- }
+- return locations, nil
+-}
+-
+-// Rename performs a rename of the object at loc to newName, using the
+-// connected LSP server. If no server is connected, it returns nil.
+-func (e *Editor) Rename(ctx context.Context, loc protocol.Location, newName string) error {
+- if e.Server == nil {
+- return nil
+- }
+- path := e.sandbox.Workdir.URIToPath(loc.URI)
+-
+- // Verify that PrepareRename succeeds.
+- prepareParams := &protocol.PrepareRenameParams{}
+- prepareParams.TextDocument = e.TextDocumentIdentifier(path)
+- prepareParams.Position = loc.Range.Start
+- if _, err := e.Server.PrepareRename(ctx, prepareParams); err != nil {
+- return fmt.Errorf("preparing rename: %v", err)
+- }
+-
+- params := &protocol.RenameParams{
+- TextDocument: e.TextDocumentIdentifier(path),
+- Position: loc.Range.Start,
+- NewName: newName,
+- }
+- wsEdits, err := e.Server.Rename(ctx, params)
+- if err != nil {
+- return err
+- }
+- for _, change := range wsEdits.DocumentChanges {
+- if err := e.applyDocumentChange(ctx, change); err != nil {
+- return err
+- }
+- }
+- return nil
+-}
+-
+-// Implementations returns implementations for the object at loc, as
+-// returned by the connected LSP server. If no server is connected, it returns
+-// (nil, nil).
+-func (e *Editor) Implementations(ctx context.Context, loc protocol.Location) ([]protocol.Location, error) {
+- if e.Server == nil {
+- return nil, nil
+- }
+- path := e.sandbox.Workdir.URIToPath(loc.URI)
+- e.mu.Lock()
+- _, ok := e.buffers[path]
+- e.mu.Unlock()
+- if !ok {
+- return nil, fmt.Errorf("buffer %q is not open", path)
+- }
+- params := &protocol.ImplementationParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+- return e.Server.Implementation(ctx, params)
+-}
+-
+-func (e *Editor) SignatureHelp(ctx context.Context, loc protocol.Location) (*protocol.SignatureHelp, error) {
+- if e.Server == nil {
+- return nil, nil
+- }
+- path := e.sandbox.Workdir.URIToPath(loc.URI)
+- e.mu.Lock()
+- _, ok := e.buffers[path]
+- e.mu.Unlock()
+- if !ok {
+- return nil, fmt.Errorf("buffer %q is not open", path)
+- }
+- params := &protocol.SignatureHelpParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+- return e.Server.SignatureHelp(ctx, params)
+-}
+-
+-func (e *Editor) RenameFile(ctx context.Context, oldPath, newPath string) error {
+- closed, opened, err := e.renameBuffers(ctx, oldPath, newPath)
+- if err != nil {
+- return err
+- }
+-
+- for _, c := range closed {
+- if err := e.sendDidClose(ctx, c); err != nil {
+- return err
+- }
+- }
+- for _, o := range opened {
+- if err := e.sendDidOpen(ctx, o); err != nil {
+- return err
+- }
+- }
+-
+- // Finally, perform the renaming on disk.
+- if err := e.sandbox.Workdir.RenameFile(ctx, oldPath, newPath); err != nil {
+- return fmt.Errorf("renaming sandbox file: %w", err)
+- }
+- return nil
+-}
+-
+-// renameBuffers renames in-memory buffers affected by the renaming of
+-// oldPath->newPath, returning the resulting text documents that must be closed
+-// and opened over the LSP.
+-func (e *Editor) renameBuffers(ctx context.Context, oldPath, newPath string) (closed []protocol.TextDocumentIdentifier, opened []protocol.TextDocumentItem, _ error) {
+- e.mu.Lock()
+- defer e.mu.Unlock()
+-
+- // In case either oldPath or newPath is absolute, convert to absolute paths
+- // before checking for containment.
+- oldAbs := e.sandbox.Workdir.AbsPath(oldPath)
+- newAbs := e.sandbox.Workdir.AbsPath(newPath)
+-
+- // Collect buffers that are affected by the given file or directory renaming.
+- buffersToRename := make(map[string]string) // old path -> new path
+-
+- for path := range e.buffers {
+- abs := e.sandbox.Workdir.AbsPath(path)
+- if oldAbs == abs || source.InDir(oldAbs, abs) {
+- rel, err := filepath.Rel(oldAbs, abs)
+- if err != nil {
+- return nil, nil, fmt.Errorf("filepath.Rel(%q, %q): %v", oldAbs, abs, err)
+- }
+- nabs := filepath.Join(newAbs, rel)
+- newPath := e.sandbox.Workdir.RelPath(nabs)
+- buffersToRename[path] = newPath
+- }
+- }
+-
+- // Update buffers, and build protocol changes.
+- for old, new := range buffersToRename {
+- buf := e.buffers[old]
+- delete(e.buffers, old)
+- buf.version = 1
+- buf.path = new
+- e.buffers[new] = buf
+-
+- closed = append(closed, e.TextDocumentIdentifier(old))
+- opened = append(opened, e.textDocumentItem(buf))
+- }
+-
+- return closed, opened, nil
+-}
+-
+-func (e *Editor) applyDocumentChange(ctx context.Context, change protocol.DocumentChanges) error {
+- if change.RenameFile != nil {
+- oldPath := e.sandbox.Workdir.URIToPath(change.RenameFile.OldURI)
+- newPath := e.sandbox.Workdir.URIToPath(change.RenameFile.NewURI)
+-
+- return e.RenameFile(ctx, oldPath, newPath)
+- }
+- if change.TextDocumentEdit != nil {
+- return e.applyTextDocumentEdit(ctx, *change.TextDocumentEdit)
+- }
+- panic("Internal error: one of RenameFile or TextDocumentEdit must be set")
+-}
+-
+-func (e *Editor) applyTextDocumentEdit(ctx context.Context, change protocol.TextDocumentEdit) error {
+- path := e.sandbox.Workdir.URIToPath(change.TextDocument.URI)
+- if ver := int32(e.BufferVersion(path)); ver != change.TextDocument.Version {
+- return fmt.Errorf("buffer versions for %q do not match: have %d, editing %d", path, ver, change.TextDocument.Version)
+- }
+- if !e.HasBuffer(path) {
+- err := e.OpenFile(ctx, path)
+- if os.IsNotExist(err) {
+- // TODO: it's unclear if this is correct. Here we create the buffer (with
+- // version 1), then apply edits. Perhaps we should apply the edits before
+- // sending the didOpen notification.
+- e.CreateBuffer(ctx, path, "")
+- err = nil
+- }
+- if err != nil {
+- return err
+- }
+- }
+- return e.EditBuffer(ctx, path, change.Edits)
+-}
+-
+-// Config returns the current editor configuration.
+-func (e *Editor) Config() EditorConfig {
+- e.mu.Lock()
+- defer e.mu.Unlock()
+- return e.config
+-}
+-
+-// ChangeConfiguration sets the new editor configuration, and if applicable
+-// sends a didChangeConfiguration notification.
+-//
+-// An error is returned if the change notification failed to send.
+-func (e *Editor) ChangeConfiguration(ctx context.Context, newConfig EditorConfig) error {
+- e.mu.Lock()
+- e.config = newConfig
+- e.mu.Unlock() // don't hold e.mu during server calls
+- if e.Server != nil {
+- var params protocol.DidChangeConfigurationParams // empty: gopls ignores the Settings field
+- if err := e.Server.DidChangeConfiguration(ctx, &params); err != nil {
+- return err
+- }
+- }
+- return nil
+-}
+-
+-// ChangeWorkspaceFolders sets the new workspace folders, and sends a
+-// didChangeWorkspaceFolders notification to the server.
+-//
+-// The given folders must all be unique.
+-func (e *Editor) ChangeWorkspaceFolders(ctx context.Context, folders []string) error {
+- // capture existing folders so that we can compute the change.
+- e.mu.Lock()
+- oldFolders := e.makeWorkspaceFoldersLocked()
+- e.config.WorkspaceFolders = folders
+- newFolders := e.makeWorkspaceFoldersLocked()
+- e.mu.Unlock()
+-
+- if e.Server == nil {
+- return nil
+- }
+-
+- var params protocol.DidChangeWorkspaceFoldersParams
+-
+- // Keep track of old workspace folders that must be removed.
+- toRemove := make(map[protocol.URI]protocol.WorkspaceFolder)
+- for _, folder := range oldFolders {
+- toRemove[folder.URI] = folder
+- }
+-
+- // Sanity check: if we see a folder twice the algorithm below doesn't work,
+- // so track seen folders to ensure that we panic in that case.
+- seen := make(map[protocol.URI]protocol.WorkspaceFolder)
+- for _, folder := range newFolders {
+- if _, ok := seen[folder.URI]; ok {
+- panic(fmt.Sprintf("folder %s seen twice", folder.URI))
+- }
+-
+- // If this folder already exists, we don't want to remove it.
+- // Otherwise, we need to add it.
+- if _, ok := toRemove[folder.URI]; ok {
+- delete(toRemove, folder.URI)
+- } else {
+- params.Event.Added = append(params.Event.Added, folder)
+- }
+- }
+-
+- for _, v := range toRemove {
+- params.Event.Removed = append(params.Event.Removed, v)
+- }
+-
+- return e.Server.DidChangeWorkspaceFolders(ctx, &params)
+-}
+-
+-// CodeAction executes a codeAction request on the server.
+-// If loc.Range is zero, the whole file is implied.
+-func (e *Editor) CodeAction(ctx context.Context, loc protocol.Location, diagnostics []protocol.Diagnostic) ([]protocol.CodeAction, error) {
+- if e.Server == nil {
+- return nil, nil
+- }
+- path := e.sandbox.Workdir.URIToPath(loc.URI)
+- e.mu.Lock()
+- _, ok := e.buffers[path]
+- e.mu.Unlock()
+- if !ok {
+- return nil, fmt.Errorf("buffer %q is not open", path)
+- }
+- params := &protocol.CodeActionParams{
+- TextDocument: e.TextDocumentIdentifier(path),
+- Context: protocol.CodeActionContext{
+- Diagnostics: diagnostics,
+- },
+- Range: loc.Range, // may be zero
+- }
+- lens, err := e.Server.CodeAction(ctx, params)
+- if err != nil {
+- return nil, err
+- }
+- return lens, nil
+-}
+-
+-// Hover triggers a hover at the given position in an open buffer.
+-func (e *Editor) Hover(ctx context.Context, loc protocol.Location) (*protocol.MarkupContent, protocol.Location, error) {
+- if err := e.checkBufferLocation(loc); err != nil {
+- return nil, protocol.Location{}, err
+- }
+- params := &protocol.HoverParams{}
+- params.TextDocument.URI = loc.URI
+- params.Position = loc.Range.Start
+-
+- resp, err := e.Server.Hover(ctx, params)
+- if err != nil {
+- return nil, protocol.Location{}, fmt.Errorf("hover: %w", err)
+- }
+- if resp == nil {
+- return nil, protocol.Location{}, nil
+- }
+- return &resp.Contents, protocol.Location{URI: loc.URI, Range: resp.Range}, nil
+-}
+-
+-func (e *Editor) DocumentLink(ctx context.Context, path string) ([]protocol.DocumentLink, error) {
+- if e.Server == nil {
+- return nil, nil
+- }
+- params := &protocol.DocumentLinkParams{}
+- params.TextDocument.URI = e.sandbox.Workdir.URI(path)
+- return e.Server.DocumentLink(ctx, params)
+-}
+-
+-func (e *Editor) DocumentHighlight(ctx context.Context, loc protocol.Location) ([]protocol.DocumentHighlight, error) {
+- if e.Server == nil {
+- return nil, nil
+- }
+- if err := e.checkBufferLocation(loc); err != nil {
+- return nil, err
+- }
+- params := &protocol.DocumentHighlightParams{}
+- params.TextDocument.URI = loc.URI
+- params.Position = loc.Range.Start
+-
+- return e.Server.DocumentHighlight(ctx, params)
+-}
+diff -urN a/gopls/internal/lsp/fake/editor_test.go b/gopls/internal/lsp/fake/editor_test.go
+--- a/gopls/internal/lsp/fake/editor_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/fake/editor_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,61 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fake
+-
+-import (
+- "context"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-const exampleProgram = `
+--- go.mod --
+-go 1.12
+--- main.go --
+-package main
+-
+-import "fmt"
+-
+-func main() {
+- fmt.Println("Hello World.")
+-}
+-`
+-
+-func TestClientEditing(t *testing.T) {
+- ws, err := NewSandbox(&SandboxConfig{Files: UnpackTxt(exampleProgram)})
+- if err != nil {
+- t.Fatal(err)
+- }
+- defer ws.Close()
+- ctx := context.Background()
+- editor := NewEditor(ws, EditorConfig{})
+- if err := editor.OpenFile(ctx, "main.go"); err != nil {
+- t.Fatal(err)
+- }
+- if err := editor.EditBuffer(ctx, "main.go", []protocol.TextEdit{
+- {
+- Range: protocol.Range{
+- Start: protocol.Position{Line: 5, Character: 14},
+- End: protocol.Position{Line: 5, Character: 26},
+- },
+- NewText: "Hola, mundo.",
+- },
+- }); err != nil {
+- t.Fatal(err)
+- }
+- got := editor.buffers["main.go"].text()
+- want := `package main
+-
+-import "fmt"
+-
+-func main() {
+- fmt.Println("Hola, mundo.")
+-}
+-`
+- if got != want {
+- t.Errorf("got text %q, want %q", got, want)
+- }
+-}
+diff -urN a/gopls/internal/lsp/fake/edit_test.go b/gopls/internal/lsp/fake/edit_test.go
+--- a/gopls/internal/lsp/fake/edit_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/fake/edit_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,96 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fake
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-func TestApplyEdits(t *testing.T) {
+- tests := []struct {
+- label string
+- content string
+- edits []protocol.TextEdit
+- want string
+- wantErr bool
+- }{
+- {
+- label: "empty content",
+- },
+- {
+- label: "empty edit",
+- content: "hello",
+- edits: []protocol.TextEdit{},
+- want: "hello",
+- },
+- {
+- label: "unicode edit",
+- content: "hello, 日本語",
+- edits: []protocol.TextEdit{
+- NewEdit(0, 7, 0, 10, "world"),
+- },
+- want: "hello, world",
+- },
+- {
+- label: "range edit",
+- content: "ABC\nDEF\nGHI\nJKL",
+- edits: []protocol.TextEdit{
+- NewEdit(1, 1, 2, 3, "12\n345"),
+- },
+- want: "ABC\nD12\n345\nJKL",
+- },
+- {
+- label: "regression test for issue #57627",
+- content: "go 1.18\nuse moda/a",
+- edits: []protocol.TextEdit{
+- NewEdit(1, 0, 1, 0, "\n"),
+- NewEdit(2, 0, 2, 0, "\n"),
+- },
+- want: "go 1.18\n\nuse moda/a\n",
+- },
+- {
+- label: "end before start",
+- content: "ABC\nDEF\nGHI\nJKL",
+- edits: []protocol.TextEdit{
+- NewEdit(2, 3, 1, 1, "12\n345"),
+- },
+- wantErr: true,
+- },
+- {
+- label: "out of bounds line",
+- content: "ABC\nDEF\nGHI\nJKL",
+- edits: []protocol.TextEdit{
+- NewEdit(1, 1, 4, 3, "12\n345"),
+- },
+- wantErr: true,
+- },
+- {
+- label: "out of bounds column",
+- content: "ABC\nDEF\nGHI\nJKL",
+- edits: []protocol.TextEdit{
+- NewEdit(1, 4, 2, 3, "12\n345"),
+- },
+- wantErr: true,
+- },
+- }
+-
+- for _, test := range tests {
+- test := test
+- t.Run(test.label, func(t *testing.T) {
+- got, err := applyEdits(protocol.NewMapper("", []byte(test.content)), test.edits, false)
+- if (err != nil) != test.wantErr {
+- t.Errorf("got err %v, want error: %t", err, test.wantErr)
+- }
+- if err != nil {
+- return
+- }
+- if got := string(got); got != test.want {
+- t.Errorf("got %q, want %q", got, test.want)
+- }
+- })
+- }
+-}
+diff -urN a/gopls/internal/lsp/fake/proxy.go b/gopls/internal/lsp/fake/proxy.go
+--- a/gopls/internal/lsp/fake/proxy.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/fake/proxy.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,35 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fake
+-
+-import (
+- "fmt"
+-
+- "golang.org/x/tools/internal/proxydir"
+-)
+-
+-// WriteProxy creates a new proxy file tree using the txtar-encoded content,
+-// and returns its URL.
+-func WriteProxy(tmpdir string, files map[string][]byte) (string, error) {
+- type moduleVersion struct {
+- modulePath, version string
+- }
+- // Transform into the format expected by the proxydir package.
+- filesByModule := make(map[moduleVersion]map[string][]byte)
+- for name, data := range files {
+- modulePath, version, suffix := splitModuleVersionPath(name)
+- mv := moduleVersion{modulePath, version}
+- if _, ok := filesByModule[mv]; !ok {
+- filesByModule[mv] = make(map[string][]byte)
+- }
+- filesByModule[mv][suffix] = data
+- }
+- for mv, files := range filesByModule {
+- if err := proxydir.WriteModuleVersion(tmpdir, mv.modulePath, mv.version, files); err != nil {
+- return "", fmt.Errorf("error writing %s@%s: %v", mv.modulePath, mv.version, err)
+- }
+- }
+- return proxydir.ToURL(tmpdir), nil
+-}
+diff -urN a/gopls/internal/lsp/fake/sandbox.go b/gopls/internal/lsp/fake/sandbox.go
+--- a/gopls/internal/lsp/fake/sandbox.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/fake/sandbox.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,299 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fake
+-
+-import (
+- "context"
+- "errors"
+- "fmt"
+- "io/ioutil"
+- "os"
+- "path/filepath"
+- "strings"
+-
+- "golang.org/x/tools/internal/gocommand"
+- "golang.org/x/tools/internal/robustio"
+- "golang.org/x/tools/internal/testenv"
+- "golang.org/x/tools/txtar"
+-)
+-
+-// Sandbox holds a collection of temporary resources to use for working with Go
+-// code in tests.
+-type Sandbox struct {
+- gopath string
+- rootdir string
+- goproxy string
+- Workdir *Workdir
+- goCommandRunner gocommand.Runner
+-}
+-
+-// SandboxConfig controls the behavior of a test sandbox. The zero value
+-// defines a reasonable default.
+-type SandboxConfig struct {
+- // RootDir sets the base directory to use when creating temporary
+- // directories. If not specified, defaults to a new temporary directory.
+- RootDir string
+- // Files holds a txtar-encoded archive of files to populate the initial state
+- // of the working directory.
+- //
+- // For convenience, the special substring "$SANDBOX_WORKDIR" is replaced with
+- // the sandbox's resolved working directory before writing files.
+- Files map[string][]byte
+- // InGoPath specifies that the working directory should be within the
+- // temporary GOPATH.
+- InGoPath bool
+- // Workdir configures the working directory of the Sandbox. It behaves as
+- // follows:
+- // - if set to an absolute path, use that path as the working directory.
+- // - if set to a relative path, create and use that path relative to the
+- // sandbox.
+- // - if unset, default to a the 'work' subdirectory of the sandbox.
+- //
+- // This option is incompatible with InGoPath or Files.
+- Workdir string
+- // ProxyFiles holds a txtar-encoded archive of files to populate a file-based
+- // Go proxy.
+- ProxyFiles map[string][]byte
+- // GOPROXY is the explicit GOPROXY value that should be used for the sandbox.
+- //
+- // This option is incompatible with ProxyFiles.
+- GOPROXY string
+-}
+-
+-// NewSandbox creates a collection of named temporary resources, with a
+-// working directory populated by the txtar-encoded content in srctxt, and a
+-// file-based module proxy populated with the txtar-encoded content in
+-// proxytxt.
+-//
+-// If rootDir is non-empty, it will be used as the root of temporary
+-// directories created for the sandbox. Otherwise, a new temporary directory
+-// will be used as root.
+-//
+-// TODO(rfindley): the sandbox abstraction doesn't seem to carry its weight.
+-// Sandboxes should be composed out of their building-blocks, rather than via a
+-// monolithic configuration.
+-func NewSandbox(config *SandboxConfig) (_ *Sandbox, err error) {
+- if config == nil {
+- config = new(SandboxConfig)
+- }
+- if err := validateConfig(*config); err != nil {
+- return nil, fmt.Errorf("invalid SandboxConfig: %v", err)
+- }
+-
+- sb := &Sandbox{}
+- defer func() {
+- // Clean up if we fail at any point in this constructor.
+- if err != nil {
+- sb.Close()
+- }
+- }()
+-
+- rootDir := config.RootDir
+- if rootDir == "" {
+- rootDir, err = ioutil.TempDir(config.RootDir, "gopls-sandbox-")
+- if err != nil {
+- return nil, fmt.Errorf("creating temporary workdir: %v", err)
+- }
+- }
+- sb.rootdir = rootDir
+- sb.gopath = filepath.Join(sb.rootdir, "gopath")
+- if err := os.Mkdir(sb.gopath, 0755); err != nil {
+- return nil, err
+- }
+- if config.GOPROXY != "" {
+- sb.goproxy = config.GOPROXY
+- } else {
+- proxydir := filepath.Join(sb.rootdir, "proxy")
+- if err := os.Mkdir(proxydir, 0755); err != nil {
+- return nil, err
+- }
+- sb.goproxy, err = WriteProxy(proxydir, config.ProxyFiles)
+- if err != nil {
+- return nil, err
+- }
+- }
+- // Short-circuit writing the workdir if we're given an absolute path, since
+- // this is used for running in an existing directory.
+- // TODO(findleyr): refactor this to be less of a workaround.
+- if filepath.IsAbs(config.Workdir) {
+- sb.Workdir, err = NewWorkdir(config.Workdir, nil)
+- if err != nil {
+- return nil, err
+- }
+- return sb, nil
+- }
+- var workdir string
+- if config.Workdir == "" {
+- if config.InGoPath {
+- // Set the working directory as $GOPATH/src.
+- workdir = filepath.Join(sb.gopath, "src")
+- } else if workdir == "" {
+- workdir = filepath.Join(sb.rootdir, "work")
+- }
+- } else {
+- // relative path
+- workdir = filepath.Join(sb.rootdir, config.Workdir)
+- }
+- if err := os.MkdirAll(workdir, 0755); err != nil {
+- return nil, err
+- }
+- sb.Workdir, err = NewWorkdir(workdir, config.Files)
+- if err != nil {
+- return nil, err
+- }
+- return sb, nil
+-}
+-
+-// Tempdir creates a new temp directory with the given txtar-encoded files. It
+-// is the responsibility of the caller to call os.RemoveAll on the returned
+-// file path when it is no longer needed.
+-func Tempdir(files map[string][]byte) (string, error) {
+- dir, err := ioutil.TempDir("", "gopls-tempdir-")
+- if err != nil {
+- return "", err
+- }
+- for name, data := range files {
+- if err := writeFileData(name, data, RelativeTo(dir)); err != nil {
+- return "", fmt.Errorf("writing to tempdir: %w", err)
+- }
+- }
+- return dir, nil
+-}
+-
+-func UnpackTxt(txt string) map[string][]byte {
+- dataMap := make(map[string][]byte)
+- archive := txtar.Parse([]byte(txt))
+- for _, f := range archive.Files {
+- if _, ok := dataMap[f.Name]; ok {
+- panic(fmt.Sprintf("found file %q twice", f.Name))
+- }
+- dataMap[f.Name] = f.Data
+- }
+- return dataMap
+-}
+-
+-func validateConfig(config SandboxConfig) error {
+- if filepath.IsAbs(config.Workdir) && (len(config.Files) > 0 || config.InGoPath) {
+- return errors.New("absolute Workdir cannot be set in conjunction with Files or InGoPath")
+- }
+- if config.Workdir != "" && config.InGoPath {
+- return errors.New("Workdir cannot be set in conjunction with InGoPath")
+- }
+- if config.GOPROXY != "" && config.ProxyFiles != nil {
+- return errors.New("GOPROXY cannot be set in conjunction with ProxyFiles")
+- }
+- return nil
+-}
+-
+-// splitModuleVersionPath extracts module information from files stored in the
+-// directory structure modulePath@version/suffix.
+-// For example:
+-//
+-// splitModuleVersionPath("mod.com@v1.2.3/package") = ("mod.com", "v1.2.3", "package")
+-func splitModuleVersionPath(path string) (modulePath, version, suffix string) {
+- parts := strings.Split(path, "/")
+- var modulePathParts []string
+- for i, p := range parts {
+- if strings.Contains(p, "@") {
+- mv := strings.SplitN(p, "@", 2)
+- modulePathParts = append(modulePathParts, mv[0])
+- return strings.Join(modulePathParts, "/"), mv[1], strings.Join(parts[i+1:], "/")
+- }
+- modulePathParts = append(modulePathParts, p)
+- }
+- // Default behavior: this is just a module path.
+- return path, "", ""
+-}
+-
+-func (sb *Sandbox) RootDir() string {
+- return sb.rootdir
+-}
+-
+-// GOPATH returns the value of the Sandbox GOPATH.
+-func (sb *Sandbox) GOPATH() string {
+- return sb.gopath
+-}
+-
+-// GoEnv returns the default environment variables that can be used for
+-// invoking Go commands in the sandbox.
+-func (sb *Sandbox) GoEnv() map[string]string {
+- vars := map[string]string{
+- "GOPATH": sb.GOPATH(),
+- "GOPROXY": sb.goproxy,
+- "GO111MODULE": "",
+- "GOSUMDB": "off",
+- "GOPACKAGESDRIVER": "off",
+- }
+- if testenv.Go1Point() >= 5 {
+- vars["GOMODCACHE"] = ""
+- }
+- return vars
+-}
+-
+-// goCommandInvocation returns a new gocommand.Invocation initialized with the
+-// sandbox environment variables and working directory.
+-func (sb *Sandbox) goCommandInvocation() gocommand.Invocation {
+- var vars []string
+- for k, v := range sb.GoEnv() {
+- vars = append(vars, fmt.Sprintf("%s=%s", k, v))
+- }
+- inv := gocommand.Invocation{
+- Env: vars,
+- }
+- // sb.Workdir may be nil if we exited the constructor with errors (we call
+- // Close to clean up any partial state from the constructor, which calls
+- // RunGoCommand).
+- if sb.Workdir != nil {
+- inv.WorkingDir = string(sb.Workdir.RelativeTo)
+- }
+- return inv
+-}
+-
+-// RunGoCommand executes a go command in the sandbox. If checkForFileChanges is
+-// true, the sandbox scans the working directory and emits file change events
+-// for any file changes it finds.
+-func (sb *Sandbox) RunGoCommand(ctx context.Context, dir, verb string, args []string, checkForFileChanges bool) error {
+- inv := sb.goCommandInvocation()
+- inv.Verb = verb
+- inv.Args = args
+- if dir != "" {
+- inv.WorkingDir = sb.Workdir.AbsPath(dir)
+- }
+- stdout, stderr, _, err := sb.goCommandRunner.RunRaw(ctx, inv)
+- if err != nil {
+- return fmt.Errorf("go command failed (stdout: %s) (stderr: %s): %v", stdout.String(), stderr.String(), err)
+- }
+- // Since running a go command may result in changes to workspace files,
+- // check if we need to send any any "watched" file events.
+- //
+- // TODO(rFindley): this side-effect can impact the usability of the sandbox
+- // for benchmarks. Consider refactoring.
+- if sb.Workdir != nil && checkForFileChanges {
+- if err := sb.Workdir.CheckForFileChanges(ctx); err != nil {
+- return fmt.Errorf("checking for file changes: %w", err)
+- }
+- }
+- return nil
+-}
+-
+-// GoVersion checks the version of the go command.
+-// It returns the X in Go 1.X.
+-func (sb *Sandbox) GoVersion(ctx context.Context) (int, error) {
+- inv := sb.goCommandInvocation()
+- return gocommand.GoVersion(ctx, inv, &sb.goCommandRunner)
+-}
+-
+-// Close removes all state associated with the sandbox.
+-func (sb *Sandbox) Close() error {
+- var goCleanErr error
+- if sb.gopath != "" {
+- goCleanErr = sb.RunGoCommand(context.Background(), "", "clean", []string{"-modcache"}, false)
+- }
+- err := robustio.RemoveAll(sb.rootdir)
+- if err != nil || goCleanErr != nil {
+- return fmt.Errorf("error(s) cleaning sandbox: cleaning modcache: %v; removing files: %v", goCleanErr, err)
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/fake/workdir.go b/gopls/internal/lsp/fake/workdir.go
+--- a/gopls/internal/lsp/fake/workdir.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/fake/workdir.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,438 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fake
+-
+-import (
+- "bytes"
+- "context"
+- "crypto/sha256"
+- "fmt"
+- "io/fs"
+- "io/ioutil"
+- "os"
+- "path/filepath"
+- "runtime"
+- "sort"
+- "strings"
+- "sync"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/robustio"
+-)
+-
+-// RelativeTo is a helper for operations relative to a given directory.
+-type RelativeTo string
+-
+-// AbsPath returns an absolute filesystem path for the workdir-relative path.
+-func (r RelativeTo) AbsPath(path string) string {
+- fp := filepath.FromSlash(path)
+- if filepath.IsAbs(fp) {
+- return fp
+- }
+- return filepath.Join(string(r), filepath.FromSlash(path))
+-}
+-
+-// RelPath returns a '/'-encoded path relative to the working directory (or an
+-// absolute path if the file is outside of workdir)
+-func (r RelativeTo) RelPath(fp string) string {
+- root := string(r)
+- if rel, err := filepath.Rel(root, fp); err == nil && !strings.HasPrefix(rel, "..") {
+- return filepath.ToSlash(rel)
+- }
+- return filepath.ToSlash(fp)
+-}
+-
+-// writeFileData writes content to the relative path, replacing the special
+-// token $SANDBOX_WORKDIR with the relative root given by rel. It does not
+-// trigger any file events.
+-func writeFileData(path string, content []byte, rel RelativeTo) error {
+- content = bytes.ReplaceAll(content, []byte("$SANDBOX_WORKDIR"), []byte(rel))
+- fp := rel.AbsPath(path)
+- if err := os.MkdirAll(filepath.Dir(fp), 0755); err != nil {
+- return fmt.Errorf("creating nested directory: %w", err)
+- }
+- backoff := 1 * time.Millisecond
+- for {
+- err := ioutil.WriteFile(fp, []byte(content), 0644)
+- if err != nil {
+- // This lock file violation is not handled by the robustio package, as it
+- // indicates a real race condition that could be avoided.
+- if isWindowsErrLockViolation(err) {
+- time.Sleep(backoff)
+- backoff *= 2
+- continue
+- }
+- return fmt.Errorf("writing %q: %w", path, err)
+- }
+- return nil
+- }
+-}
+-
+-// isWindowsErrLockViolation reports whether err is ERROR_LOCK_VIOLATION
+-// on Windows.
+-var isWindowsErrLockViolation = func(err error) bool { return false }
+-
+-// Workdir is a temporary working directory for tests. It exposes file
+-// operations in terms of relative paths, and fakes file watching by triggering
+-// events on file operations.
+-type Workdir struct {
+- RelativeTo
+-
+- watcherMu sync.Mutex
+- watchers []func(context.Context, []protocol.FileEvent)
+-
+- fileMu sync.Mutex
+- // File identities we know about, for the purpose of detecting changes.
+- //
+- // Since files is only used for detecting _changes_, we are tolerant of
+- // fileIDs that may have hash and mtime coming from different states of the
+- // file: if either are out of sync, then the next poll should detect a
+- // discrepancy. It is OK if we detect too many changes, but not OK if we miss
+- // changes.
+- //
+- // For that matter, this mechanism for detecting changes can still be flaky
+- // on platforms where mtime is very coarse (such as older versions of WSL).
+- // It would be much better to use a proper fs event library, but we can't
+- // currently import those into x/tools.
+- //
+- // TODO(golang/go#52284): replace this polling mechanism with a
+- // cross-platform library for filesystem notifications.
+- files map[string]fileID
+-}
+-
+-// NewWorkdir writes the txtar-encoded file data in txt to dir, and returns a
+-// Workir for operating on these files using
+-func NewWorkdir(dir string, files map[string][]byte) (*Workdir, error) {
+- w := &Workdir{RelativeTo: RelativeTo(dir)}
+- for name, data := range files {
+- if err := writeFileData(name, data, w.RelativeTo); err != nil {
+- return nil, fmt.Errorf("writing to workdir: %w", err)
+- }
+- }
+- _, err := w.pollFiles() // poll files to populate the files map.
+- return w, err
+-}
+-
+-// fileID identifies a file version on disk.
+-type fileID struct {
+- mtime time.Time
+- hash string // empty if mtime is old enough to be reliabe; otherwise a file digest
+-}
+-
+-func hashFile(data []byte) string {
+- return fmt.Sprintf("%x", sha256.Sum256(data))
+-}
+-
+-// RootURI returns the root URI for this working directory of this scratch
+-// environment.
+-func (w *Workdir) RootURI() protocol.DocumentURI {
+- return toURI(string(w.RelativeTo))
+-}
+-
+-// AddWatcher registers the given func to be called on any file change.
+-func (w *Workdir) AddWatcher(watcher func(context.Context, []protocol.FileEvent)) {
+- w.watcherMu.Lock()
+- w.watchers = append(w.watchers, watcher)
+- w.watcherMu.Unlock()
+-}
+-
+-// URI returns the URI to a the workdir-relative path.
+-func (w *Workdir) URI(path string) protocol.DocumentURI {
+- return toURI(w.AbsPath(path))
+-}
+-
+-// URIToPath converts a uri to a workdir-relative path (or an absolute path,
+-// if the uri is outside of the workdir).
+-func (w *Workdir) URIToPath(uri protocol.DocumentURI) string {
+- fp := uri.SpanURI().Filename()
+- return w.RelPath(fp)
+-}
+-
+-func toURI(fp string) protocol.DocumentURI {
+- return protocol.DocumentURI(span.URIFromPath(fp))
+-}
+-
+-// ReadFile reads a text file specified by a workdir-relative path.
+-func (w *Workdir) ReadFile(path string) ([]byte, error) {
+- backoff := 1 * time.Millisecond
+- for {
+- b, err := ioutil.ReadFile(w.AbsPath(path))
+- if err != nil {
+- if runtime.GOOS == "plan9" && strings.HasSuffix(err.Error(), " exclusive use file already open") {
+- // Plan 9 enforces exclusive access to locked files.
+- // Give the owner time to unlock it and retry.
+- time.Sleep(backoff)
+- backoff *= 2
+- continue
+- }
+- return nil, err
+- }
+- return b, nil
+- }
+-}
+-
+-// RegexpSearch searches the file corresponding to path for the first position
+-// matching re.
+-func (w *Workdir) RegexpSearch(path string, re string) (protocol.Location, error) {
+- content, err := w.ReadFile(path)
+- if err != nil {
+- return protocol.Location{}, err
+- }
+- mapper := protocol.NewMapper(w.URI(path).SpanURI(), content)
+- return regexpLocation(mapper, re)
+-}
+-
+-// RemoveFile removes a workdir-relative file path and notifies watchers of the
+-// change.
+-func (w *Workdir) RemoveFile(ctx context.Context, path string) error {
+- fp := w.AbsPath(path)
+- if err := robustio.RemoveAll(fp); err != nil {
+- return fmt.Errorf("removing %q: %w", path, err)
+- }
+-
+- return w.CheckForFileChanges(ctx)
+-}
+-
+-// WriteFiles writes the text file content to workdir-relative paths and
+-// notifies watchers of the changes.
+-func (w *Workdir) WriteFiles(ctx context.Context, files map[string]string) error {
+- for path, content := range files {
+- fp := w.AbsPath(path)
+- _, err := os.Stat(fp)
+- if err != nil && !os.IsNotExist(err) {
+- return fmt.Errorf("checking if %q exists: %w", path, err)
+- }
+- if err := writeFileData(path, []byte(content), w.RelativeTo); err != nil {
+- return err
+- }
+- }
+- return w.CheckForFileChanges(ctx)
+-}
+-
+-// WriteFile writes text file content to a workdir-relative path and notifies
+-// watchers of the change.
+-func (w *Workdir) WriteFile(ctx context.Context, path, content string) error {
+- return w.WriteFiles(ctx, map[string]string{path: content})
+-}
+-
+-func (w *Workdir) fileEvent(path string, changeType protocol.FileChangeType) protocol.FileEvent {
+- return protocol.FileEvent{
+- URI: w.URI(path),
+- Type: changeType,
+- }
+-}
+-
+-// RenameFile performs an on disk-renaming of the workdir-relative oldPath to
+-// workdir-relative newPath, and notifies watchers of the changes.
+-//
+-// oldPath must either be a regular file or in the same directory as newPath.
+-func (w *Workdir) RenameFile(ctx context.Context, oldPath, newPath string) error {
+- oldAbs := w.AbsPath(oldPath)
+- newAbs := w.AbsPath(newPath)
+-
+- // For os.Rename, “OS-specific restrictions may apply when oldpath and newpath
+- // are in different directories.” If that applies here, we may fall back to
+- // ReadFile, WriteFile, and RemoveFile to perform the rename non-atomically.
+- //
+- // However, the fallback path only works for regular files: renaming a
+- // directory would be much more complex and isn't needed for our tests.
+- fallbackOk := false
+- if filepath.Dir(oldAbs) != filepath.Dir(newAbs) {
+- fi, err := os.Stat(oldAbs)
+- if err == nil && !fi.Mode().IsRegular() {
+- return &os.PathError{
+- Op: "RenameFile",
+- Path: oldPath,
+- Err: fmt.Errorf("%w: file is not regular and not in the same directory as %s", os.ErrInvalid, newPath),
+- }
+- }
+- fallbackOk = true
+- }
+-
+- var renameErr error
+- const debugFallback = false
+- if fallbackOk && debugFallback {
+- renameErr = fmt.Errorf("%w: debugging fallback path", os.ErrInvalid)
+- } else {
+- renameErr = robustio.Rename(oldAbs, newAbs)
+- }
+- if renameErr != nil {
+- if !fallbackOk {
+- return renameErr // The OS-specific Rename restrictions do not apply.
+- }
+-
+- content, err := w.ReadFile(oldPath)
+- if err != nil {
+- // If we can't even read the file, the error from Rename may be accurate.
+- return renameErr
+- }
+- fi, err := os.Stat(newAbs)
+- if err == nil {
+- if fi.IsDir() {
+- // “If newpath already exists and is not a directory, Rename replaces it.”
+- // But if it is a directory, maybe not?
+- return renameErr
+- }
+- // On most platforms, Rename replaces the named file with a new file,
+- // rather than overwriting the existing file it in place. Mimic that
+- // behavior here.
+- if err := robustio.RemoveAll(newAbs); err != nil {
+- // Maybe we don't have permission to replace newPath?
+- return renameErr
+- }
+- } else if !os.IsNotExist(err) {
+- // If the destination path already exists or there is some problem with it,
+- // the error from Rename may be accurate.
+- return renameErr
+- }
+- if writeErr := writeFileData(newPath, []byte(content), w.RelativeTo); writeErr != nil {
+- // At this point we have tried to actually write the file.
+- // If it still doesn't exist, assume that the error from Rename was accurate:
+- // for example, maybe we don't have permission to create the new path.
+- // Otherwise, return the error from the write, which may indicate some
+- // other problem (such as a full disk).
+- if _, statErr := os.Stat(newAbs); !os.IsNotExist(statErr) {
+- return writeErr
+- }
+- return renameErr
+- }
+- if err := robustio.RemoveAll(oldAbs); err != nil {
+- // If we failed to remove the old file, that may explain the Rename error too.
+- // Make a best effort to back out the write to the new path.
+- robustio.RemoveAll(newAbs)
+- return renameErr
+- }
+- }
+-
+- return w.CheckForFileChanges(ctx)
+-}
+-
+-// ListFiles returns a new sorted list of the relative paths of files in dir,
+-// recursively.
+-func (w *Workdir) ListFiles(dir string) ([]string, error) {
+- absDir := w.AbsPath(dir)
+- var paths []string
+- if err := filepath.Walk(absDir, func(fp string, info os.FileInfo, err error) error {
+- if err != nil {
+- return err
+- }
+- if info.Mode()&(fs.ModeDir|fs.ModeSymlink) == 0 {
+- paths = append(paths, w.RelPath(fp))
+- }
+- return nil
+- }); err != nil {
+- return nil, err
+- }
+- sort.Strings(paths)
+- return paths, nil
+-}
+-
+-// CheckForFileChanges walks the working directory and checks for any files
+-// that have changed since the last poll.
+-func (w *Workdir) CheckForFileChanges(ctx context.Context) error {
+- evts, err := w.pollFiles()
+- if err != nil {
+- return err
+- }
+- if len(evts) == 0 {
+- return nil
+- }
+- w.watcherMu.Lock()
+- watchers := make([]func(context.Context, []protocol.FileEvent), len(w.watchers))
+- copy(watchers, w.watchers)
+- w.watcherMu.Unlock()
+- for _, w := range watchers {
+- w(ctx, evts)
+- }
+- return nil
+-}
+-
+-// pollFiles updates w.files and calculates FileEvents corresponding to file
+-// state changes since the last poll. It does not call sendEvents.
+-func (w *Workdir) pollFiles() ([]protocol.FileEvent, error) {
+- w.fileMu.Lock()
+- defer w.fileMu.Unlock()
+-
+- newFiles := make(map[string]fileID)
+- var evts []protocol.FileEvent
+- if err := filepath.Walk(string(w.RelativeTo), func(fp string, info os.FileInfo, err error) error {
+- if err != nil {
+- return err
+- }
+- // Skip directories and symbolic links (which may be links to directories).
+- //
+- // The latter matters for repos like Kubernetes, which use symlinks.
+- if info.Mode()&(fs.ModeDir|fs.ModeSymlink) != 0 {
+- return nil
+- }
+-
+- // Opt: avoid reading the file if mtime is sufficently old to be reliable.
+- //
+- // If mtime is recent, it may not sufficiently identify the file contents:
+- // a subsequent write could result in the same mtime. For these cases, we
+- // must read the file contents.
+- id := fileID{mtime: info.ModTime()}
+- if time.Since(info.ModTime()) < 2*time.Second {
+- data, err := ioutil.ReadFile(fp)
+- if err != nil {
+- return err
+- }
+- id.hash = hashFile(data)
+- }
+- path := w.RelPath(fp)
+- newFiles[path] = id
+-
+- if w.files != nil {
+- oldID, ok := w.files[path]
+- delete(w.files, path)
+- switch {
+- case !ok:
+- evts = append(evts, protocol.FileEvent{
+- URI: w.URI(path),
+- Type: protocol.Created,
+- })
+- case oldID != id:
+- changed := true
+-
+- // Check whether oldID and id do not match because oldID was polled at
+- // a recent enough to time such as to require hashing.
+- //
+- // In this case, read the content to check whether the file actually
+- // changed.
+- if oldID.mtime.Equal(id.mtime) && oldID.hash != "" && id.hash == "" {
+- data, err := ioutil.ReadFile(fp)
+- if err != nil {
+- return err
+- }
+- if hashFile(data) == oldID.hash {
+- changed = false
+- }
+- }
+- if changed {
+- evts = append(evts, protocol.FileEvent{
+- URI: w.URI(path),
+- Type: protocol.Changed,
+- })
+- }
+- }
+- }
+-
+- return nil
+- }); err != nil {
+- return nil, err
+- }
+-
+- // Any remaining files must have been deleted.
+- for path := range w.files {
+- evts = append(evts, protocol.FileEvent{
+- URI: w.URI(path),
+- Type: protocol.Deleted,
+- })
+- }
+- w.files = newFiles
+- return evts, nil
+-}
+diff -urN a/gopls/internal/lsp/fake/workdir_test.go b/gopls/internal/lsp/fake/workdir_test.go
+--- a/gopls/internal/lsp/fake/workdir_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/fake/workdir_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,220 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fake
+-
+-import (
+- "context"
+- "io/ioutil"
+- "os"
+- "sync"
+- "testing"
+-
+- "github.com/google/go-cmp/cmp"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-const sharedData = `
+--- go.mod --
+-go 1.12
+--- nested/README.md --
+-Hello World!
+-`
+-
+-// newWorkdir sets up a temporary Workdir with the given txtar-encoded content.
+-// It also configures an eventBuffer to receive file event notifications. These
+-// notifications are sent synchronously for each operation, such that once a
+-// workdir file operation has returned the caller can expect that any relevant
+-// file notifications are present in the buffer.
+-//
+-// It is the caller's responsibility to call the returned cleanup function.
+-func newWorkdir(t *testing.T, txt string) (*Workdir, *eventBuffer, func()) {
+- t.Helper()
+-
+- tmpdir, err := ioutil.TempDir("", "goplstest-workdir-")
+- if err != nil {
+- t.Fatal(err)
+- }
+- wd, err := NewWorkdir(tmpdir, UnpackTxt(txt))
+- if err != nil {
+- t.Fatal(err)
+- }
+- cleanup := func() {
+- if err := os.RemoveAll(tmpdir); err != nil {
+- t.Error(err)
+- }
+- }
+-
+- buf := new(eventBuffer)
+- wd.AddWatcher(buf.onEvents)
+- return wd, buf, cleanup
+-}
+-
+-// eventBuffer collects events from a file watcher.
+-type eventBuffer struct {
+- mu sync.Mutex
+- events []protocol.FileEvent
+-}
+-
+-// onEvents collects adds events to the buffer; to be used with Workdir.AddWatcher.
+-func (c *eventBuffer) onEvents(_ context.Context, events []protocol.FileEvent) {
+- c.mu.Lock()
+- defer c.mu.Unlock()
+-
+- c.events = append(c.events, events...)
+-}
+-
+-// take empties the buffer, returning its previous contents.
+-func (c *eventBuffer) take() []protocol.FileEvent {
+- c.mu.Lock()
+- defer c.mu.Unlock()
+-
+- evts := c.events
+- c.events = nil
+- return evts
+-}
+-
+-func TestWorkdir_ReadFile(t *testing.T) {
+- wd, _, cleanup := newWorkdir(t, sharedData)
+- defer cleanup()
+-
+- got, err := wd.ReadFile("nested/README.md")
+- if err != nil {
+- t.Fatal(err)
+- }
+- want := "Hello World!\n"
+- if got := string(got); got != want {
+- t.Errorf("reading workdir file, got %q, want %q", got, want)
+- }
+-}
+-
+-func TestWorkdir_WriteFile(t *testing.T) {
+- wd, events, cleanup := newWorkdir(t, sharedData)
+- defer cleanup()
+- ctx := context.Background()
+-
+- tests := []struct {
+- path string
+- wantType protocol.FileChangeType
+- }{
+- {"data.txt", protocol.Created},
+- {"nested/README.md", protocol.Changed},
+- }
+-
+- for _, test := range tests {
+- if err := wd.WriteFile(ctx, test.path, "42"); err != nil {
+- t.Fatal(err)
+- }
+- es := events.take()
+- if got := len(es); got != 1 {
+- t.Fatalf("len(events) = %d, want 1", got)
+- }
+- path := wd.URIToPath(es[0].URI)
+- if path != test.path {
+- t.Errorf("event path = %q, want %q", path, test.path)
+- }
+- if es[0].Type != test.wantType {
+- t.Errorf("event type = %v, want %v", es[0].Type, test.wantType)
+- }
+- got, err := wd.ReadFile(test.path)
+- if err != nil {
+- t.Fatal(err)
+- }
+- want := "42"
+- if got := string(got); got != want {
+- t.Errorf("ws.ReadFile(%q) = %q, want %q", test.path, got, want)
+- }
+- }
+-}
+-
+-// Test for file notifications following file operations.
+-func TestWorkdir_FileWatching(t *testing.T) {
+- wd, events, cleanup := newWorkdir(t, "")
+- defer cleanup()
+- ctx := context.Background()
+-
+- must := func(err error) {
+- if err != nil {
+- t.Fatal(err)
+- }
+- }
+-
+- type changeMap map[string]protocol.FileChangeType
+- checkEvent := func(wantChanges changeMap) {
+- gotChanges := make(changeMap)
+- for _, e := range events.take() {
+- gotChanges[wd.URIToPath(e.URI)] = e.Type
+- }
+- if diff := cmp.Diff(wantChanges, gotChanges); diff != "" {
+- t.Errorf("mismatching file events (-want +got):\n%s", diff)
+- }
+- }
+-
+- must(wd.WriteFile(ctx, "foo.go", "package foo"))
+- checkEvent(changeMap{"foo.go": protocol.Created})
+-
+- must(wd.RenameFile(ctx, "foo.go", "bar.go"))
+- checkEvent(changeMap{"foo.go": protocol.Deleted, "bar.go": protocol.Created})
+-
+- must(wd.RemoveFile(ctx, "bar.go"))
+- checkEvent(changeMap{"bar.go": protocol.Deleted})
+-}
+-
+-func TestWorkdir_CheckForFileChanges(t *testing.T) {
+- t.Skip("broken on darwin-amd64-10_12")
+- wd, events, cleanup := newWorkdir(t, sharedData)
+- defer cleanup()
+- ctx := context.Background()
+-
+- checkChange := func(wantPath string, wantType protocol.FileChangeType) {
+- if err := wd.CheckForFileChanges(ctx); err != nil {
+- t.Fatal(err)
+- }
+- ev := events.take()
+- if len(ev) == 0 {
+- t.Fatal("no file events received")
+- }
+- gotEvt := ev[0]
+- gotPath := wd.URIToPath(gotEvt.URI)
+- // Only check relative path and Type
+- if gotPath != wantPath || gotEvt.Type != wantType {
+- t.Errorf("file events: got %v, want {Path: %s, Type: %v}", gotEvt, wantPath, wantType)
+- }
+- }
+- // Sleep some positive amount of time to ensure a distinct mtime.
+- if err := writeFileData("go.mod", []byte("module foo.test\n"), wd.RelativeTo); err != nil {
+- t.Fatal(err)
+- }
+- checkChange("go.mod", protocol.Changed)
+- if err := writeFileData("newFile", []byte("something"), wd.RelativeTo); err != nil {
+- t.Fatal(err)
+- }
+- checkChange("newFile", protocol.Created)
+- fp := wd.AbsPath("newFile")
+- if err := os.Remove(fp); err != nil {
+- t.Fatal(err)
+- }
+- checkChange("newFile", protocol.Deleted)
+-}
+-
+-func TestSplitModuleVersionPath(t *testing.T) {
+- tests := []struct {
+- path string
+- wantModule, wantVersion, wantSuffix string
+- }{
+- {"foo.com@v1.2.3/bar", "foo.com", "v1.2.3", "bar"},
+- {"foo.com/module@v1.2.3/bar", "foo.com/module", "v1.2.3", "bar"},
+- {"foo.com@v1.2.3", "foo.com", "v1.2.3", ""},
+- {"std@v1.14.0", "std", "v1.14.0", ""},
+- {"another/module/path", "another/module/path", "", ""},
+- }
+-
+- for _, test := range tests {
+- module, version, suffix := splitModuleVersionPath(test.path)
+- if module != test.wantModule || version != test.wantVersion || suffix != test.wantSuffix {
+- t.Errorf("splitModuleVersionPath(%q) =\n\t(%q, %q, %q)\nwant\n\t(%q, %q, %q)",
+- test.path, module, version, suffix, test.wantModule, test.wantVersion, test.wantSuffix)
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/fake/workdir_windows.go b/gopls/internal/lsp/fake/workdir_windows.go
+--- a/gopls/internal/lsp/fake/workdir_windows.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/fake/workdir_windows.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,21 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fake
+-
+-import (
+- "errors"
+- "syscall"
+-)
+-
+-func init() {
+- // constants copied from GOROOT/src/internal/syscall/windows/syscall_windows.go
+- const (
+- ERROR_LOCK_VIOLATION syscall.Errno = 33
+- )
+-
+- isWindowsErrLockViolation = func(err error) bool {
+- return errors.Is(err, ERROR_LOCK_VIOLATION)
+- }
+-}
+diff -urN a/gopls/internal/lsp/filecache/filecache.go b/gopls/internal/lsp/filecache/filecache.go
+--- a/gopls/internal/lsp/filecache/filecache.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/filecache/filecache.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,369 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// The filecache package provides a file-based shared durable blob cache.
+-//
+-// The cache is a machine-global mapping from (kind string, key
+-// [32]byte) to []byte, where kind is an identifier describing the
+-// namespace or purpose (e.g. "analysis"), and key is a SHA-256 digest
+-// of the recipe of the value. (It need not be the digest of the value
+-// itself, so you can query the cache without knowing what value the
+-// recipe would produce.)
+-//
+-// The space budget of the cache can be controlled by [SetBudget].
+-// Cache entries may be evicted at any time or in any order.
+-// Note that "du -sh $GOPLSCACHE" may report a disk usage
+-// figure that is rather larger (e.g. 50%) than the budget because
+-// it rounds up partial disk blocks.
+-//
+-// The Get and Set operations are concurrency-safe.
+-package filecache
+-
+-import (
+- "bytes"
+- "crypto/sha256"
+- "encoding/binary"
+- "errors"
+- "fmt"
+- "io"
+- "log"
+- "os"
+- "path/filepath"
+- "sort"
+- "sync"
+- "sync/atomic"
+- "time"
+-
+- "golang.org/x/tools/internal/lockedfile"
+-)
+-
+-// Get retrieves from the cache and returns a newly allocated
+-// copy of the value most recently supplied to Set(kind, key),
+-// possibly by another process.
+-// Get returns ErrNotFound if the value was not found.
+-func Get(kind string, key [32]byte) ([]byte, error) {
+- name := filename(kind, key)
+- data, err := lockedfile.Read(name)
+- if err != nil {
+- if errors.Is(err, os.ErrNotExist) {
+- return nil, ErrNotFound
+- }
+- return nil, err
+- }
+-
+- // Verify that the Write was complete
+- // by checking the recorded length.
+- if len(data) < 8 {
+- return nil, ErrNotFound // cache entry is incomplete
+- }
+- if length := binary.LittleEndian.Uint64(data); int(length) != len(data)-8 {
+- return nil, ErrNotFound // cache entry is incomplete (or too long!)
+- }
+- data = data[8:]
+-
+- // Update file time for use by LRU eviction.
+- // (This turns every read into a write operation.
+- // If this is a performance problem, we should
+- // touch the files aynchronously.)
+- //
+- // (Traditionally the access time would be updated
+- // automatically, but for efficiency most POSIX systems have
+- // for many years set the noatime mount option to avoid every
+- // open or read operation entailing a metadata write.)
+- now := time.Now()
+- if err := os.Chtimes(name, now, now); err != nil {
+- return nil, fmt.Errorf("failed to update access time: %w", err)
+- }
+-
+- return data, nil
+-}
+-
+-// ErrNotFound is the distinguished error
+-// returned by Get when the key is not found.
+-var ErrNotFound = fmt.Errorf("not found")
+-
+-// Set updates the value in the cache.
+-func Set(kind string, key [32]byte, value []byte) error {
+- name := filename(kind, key)
+- if err := os.MkdirAll(filepath.Dir(name), 0700); err != nil {
+- return err
+- }
+-
+- // In the unlikely event of a short write (e.g. ENOSPC)
+- // followed by process termination (e.g. a power cut), we
+- // don't want a reader to see a short file, so we record
+- // the expected length first and verify it in Get.
+- var length [8]byte
+- binary.LittleEndian.PutUint64(length[:], uint64(len(value)))
+- header := bytes.NewReader(length[:])
+- payload := bytes.NewReader(value)
+-
+- // Windows doesn't support atomic rename--we tried MoveFile,
+- // MoveFileEx, ReplaceFileEx, and SetFileInformationByHandle
+- // of RenameFileInfo, all to no avail--so instead we use
+- // advisory file locking, which is only about 2x slower even
+- // on POSIX platforms with atomic rename.
+- return lockedfile.Write(name, io.MultiReader(header, payload), 0600)
+-}
+-
+-var budget int64 = 1e9 // 1GB
+-
+-// SetBudget sets a soft limit on disk usage of the cache (in bytes)
+-// and returns the previous value. Supplying a negative value queries
+-// the current value without changing it.
+-//
+-// If two gopls processes have different budgets, the one with the
+-// lower budget will collect garbage more actively, but both will
+-// observe the effect.
+-func SetBudget(new int64) (old int64) {
+- if new < 0 {
+- return atomic.LoadInt64(&budget)
+- }
+- return atomic.SwapInt64(&budget, new)
+-}
+-
+-// --- implementation ----
+-
+-// filename returns the cache entry of the specified kind and key.
+-//
+-// A typical cache entry is a file name such as:
+-//
+-// $HOME/Library/Caches / gopls / VVVVVVVV / kind / KK / KKKK...KKKK
+-//
+-// The portions separated by spaces are as follows:
+-// - The user's preferred cache directory; the default value varies by OS.
+-// - The constant "gopls".
+-// - The "version", 32 bits of the digest of the gopls executable.
+-// - The kind or purpose of this cache subtree (e.g. "analysis").
+-// - The first 8 bits of the key, to avoid huge directories.
+-// - The full 256 bits of the key.
+-//
+-// Once a file is written its contents are never modified, though it
+-// may be atomically replaced or removed.
+-//
+-// New versions of gopls are free to reorganize the contents of the
+-// version directory as needs evolve. But all versions of gopls must
+-// in perpetuity treat the "gopls" directory in a common fashion.
+-//
+-// In particular, each gopls process attempts to garbage collect
+-// the entire gopls directory so that newer binaries can clean up
+-// after older ones: in the development cycle especially, new
+-// new versions may be created frequently.
+-func filename(kind string, key [32]byte) string {
+- hex := fmt.Sprintf("%x", key)
+- return filepath.Join(getCacheDir(), kind, hex[:2], hex)
+-}
+-
+-// getCacheDir returns the persistent cache directory of all processes
+-// running this version of the gopls executable.
+-//
+-// It must incorporate the hash of the executable so that we needn't
+-// worry about incompatible changes to the file format or changes to
+-// the algorithm that produced the index.
+-func getCacheDir() string {
+- cacheDirOnce.Do(func() {
+- // Use user's preferred cache directory.
+- userDir := os.Getenv("GOPLSCACHE")
+- if userDir == "" {
+- var err error
+- userDir, err = os.UserCacheDir()
+- if err != nil {
+- userDir = os.TempDir()
+- }
+- }
+- goplsDir := filepath.Join(userDir, "gopls")
+-
+- // UserCacheDir may return a nonexistent directory
+- // (in which case we must create it, which may fail),
+- // or it may return a non-writable directory, in
+- // which case we should ideally respect the user's express
+- // wishes (e.g. XDG_CACHE_HOME) and not write somewhere else.
+- // Sadly UserCacheDir doesn't currently let us distinguish
+- // such intent from accidental misconfiguraton such as HOME=/
+- // in a CI builder. So, we check whether the gopls subdirectory
+- // can be created (or already exists) and not fall back to /tmp.
+- // See also https://github.com/golang/go/issues/57638.
+- if os.MkdirAll(goplsDir, 0700) != nil {
+- goplsDir = filepath.Join(os.TempDir(), "gopls")
+- }
+-
+- // Start the garbage collector.
+- go gc(goplsDir)
+-
+- // Compute the hash of this executable (~20ms) and create a subdirectory.
+- hash, err := hashExecutable()
+- if err != nil {
+- log.Fatalf("can't hash gopls executable: %v", err)
+- }
+- // Use only 32 bits of the digest to avoid unwieldy filenames.
+- // It's not an adversarial situation.
+- cacheDir = filepath.Join(goplsDir, fmt.Sprintf("%x", hash[:4]))
+- if err := os.MkdirAll(cacheDir, 0700); err != nil {
+- log.Fatalf("can't create cache: %v", err)
+- }
+- })
+- return cacheDir
+-}
+-
+-var (
+- cacheDirOnce sync.Once
+- cacheDir string // only accessed by getCacheDir
+-)
+-
+-func hashExecutable() (hash [32]byte, err error) {
+- exe, err := os.Executable()
+- if err != nil {
+- return hash, err
+- }
+- f, err := os.Open(exe)
+- if err != nil {
+- return hash, err
+- }
+- defer f.Close()
+- h := sha256.New()
+- if _, err := io.Copy(h, f); err != nil {
+- return hash, fmt.Errorf("can't read executable: %w", err)
+- }
+- h.Sum(hash[:0])
+- return hash, nil
+-}
+-
+-// gc runs forever, periodically deleting files from the gopls
+-// directory until the space budget is no longer exceeded, and also
+-// deleting files older than the maximum age, regardless of budget.
+-//
+-// One gopls process may delete garbage created by a different gopls
+-// process, possibly running a different version of gopls, possibly
+-// running concurrently.
+-func gc(goplsDir string) {
+- const period = 1 * time.Minute // period between collections
+- // Sleep statDelay*batchSize between stats to smooth out I/O.
+- //
+- // The constants below were chosen using the following heuristics:
+- // - 1GB of filecache is on the order of ~100-200k files, in which case
+- // 100μs delay per file introduces 10-20s of additional walk time, less
+- // than the 1m gc period.
+- // - Processing batches of stats at once is much more efficient than
+- // sleeping after every stat (due to OS optimizations).
+- const statDelay = 100 * time.Microsecond // average delay between stats, to smooth out I/O
+- const batchSize = 1000 // # of stats to process before sleeping
+- const maxAge = 5 * 24 * time.Hour // max time since last access before file is deleted
+-
+- // The macOS filesystem is strikingly slow, at least on some machines.
+- // /usr/bin/find achieves only about 25,000 stats per second
+- // at full speed (no pause between items), meaning a large
+- // cache may take several minutes to scan.
+- // We must ensure that short-lived processes (crucially,
+- // tests) are able to make progress sweeping garbage.
+- //
+- // (gopls' caches should never actually get this big in
+- // practice: the example mentioned above resulted from a bug
+- // that caused filecache to fail to delete any files.)
+-
+- const debug = false
+-
+- // Names of all directories found in first pass; nil thereafter.
+- dirs := make(map[string]bool)
+-
+- for {
+- // Enumerate all files in the cache.
+- type item struct {
+- path string
+- stat os.FileInfo
+- }
+- var files []item
+- start := time.Now()
+- var total int64 // bytes
+- _ = filepath.Walk(goplsDir, func(path string, stat os.FileInfo, err error) error {
+- if err != nil {
+- return nil // ignore errors
+- }
+- if stat.IsDir() {
+- // Collect (potentially empty) directories.
+- if dirs != nil {
+- dirs[path] = true
+- }
+- } else {
+- // Unconditionally delete files we haven't used in ages.
+- // (We do this here, not in the second loop, so that we
+- // perform age-based collection even in short-lived processes.)
+- age := time.Since(stat.ModTime())
+- if age > maxAge {
+- if debug {
+- log.Printf("age: deleting stale file %s (%dB, age %v)",
+- path, stat.Size(), age)
+- }
+- os.Remove(path) // ignore error
+- } else {
+- files = append(files, item{path, stat})
+- total += stat.Size()
+- if debug && len(files)%1000 == 0 {
+- log.Printf("filecache: checked %d files in %v", len(files), time.Since(start))
+- }
+- if len(files)%batchSize == 0 {
+- time.Sleep(batchSize * statDelay)
+- }
+- }
+- }
+- return nil
+- })
+-
+- // Sort oldest files first.
+- sort.Slice(files, func(i, j int) bool {
+- return files[i].stat.ModTime().Before(files[j].stat.ModTime())
+- })
+-
+- // Delete oldest files until we're under budget.
+- budget := atomic.LoadInt64(&budget)
+- for _, file := range files {
+- if total < budget {
+- break
+- }
+- if debug {
+- age := time.Since(file.stat.ModTime())
+- log.Printf("budget: deleting stale file %s (%dB, age %v)",
+- file.path, file.stat.Size(), age)
+- }
+- os.Remove(file.path) // ignore error
+- total -= file.stat.Size()
+- }
+-
+- time.Sleep(period)
+-
+- // Once only, delete all directories.
+- // This will succeed only for the empty ones,
+- // and ensures that stale directories (whose
+- // files have been deleted) are removed eventually.
+- // They don't take up much space but they do slow
+- // down the traversal.
+- //
+- // We do this after the sleep to minimize the
+- // race against Set, which may create a directory
+- // that is momentarily empty.
+- //
+- // (Test processes don't live that long, so
+- // this may not be reached on the CI builders.)
+- if dirs != nil {
+- dirnames := make([]string, 0, len(dirs))
+- for dir := range dirs {
+- dirnames = append(dirnames, dir)
+- }
+- dirs = nil
+-
+- // Descending length order => children before parents.
+- sort.Slice(dirnames, func(i, j int) bool {
+- return len(dirnames[i]) > len(dirnames[j])
+- })
+- var deleted int
+- for _, dir := range dirnames {
+- if os.Remove(dir) == nil { // ignore error
+- deleted++
+- }
+- }
+- if debug {
+- log.Printf("deleted %d empty directories", deleted)
+- }
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/filecache/filecache_test.go b/gopls/internal/lsp/filecache/filecache_test.go
+--- a/gopls/internal/lsp/filecache/filecache_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/filecache/filecache_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,215 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package filecache_test
+-
+-// This file defines tests of the API of the filecache package.
+-//
+-// Some properties (e.g. garbage collection) cannot be exercised
+-// through the API, so this test does not attempt to do so.
+-
+-import (
+- "bytes"
+- cryptorand "crypto/rand"
+- "fmt"
+- "log"
+- mathrand "math/rand"
+- "os"
+- "os/exec"
+- "strconv"
+- "testing"
+-
+- "golang.org/x/sync/errgroup"
+- "golang.org/x/tools/gopls/internal/lsp/filecache"
+-)
+-
+-func TestBasics(t *testing.T) {
+- const kind = "TestBasics"
+- key := uniqueKey() // never used before
+- value := []byte("hello")
+-
+- // Get of a never-seen key returns not found.
+- if _, err := filecache.Get(kind, key); err != filecache.ErrNotFound {
+- t.Errorf("Get of random key returned err=%q, want not found", err)
+- }
+-
+- // Set of a never-seen key and a small value succeeds.
+- if err := filecache.Set(kind, key, value); err != nil {
+- t.Errorf("Set failed: %v", err)
+- }
+-
+- // Get of the key returns a copy of the value.
+- if got, err := filecache.Get(kind, key); err != nil {
+- t.Errorf("Get after Set failed: %v", err)
+- } else if string(got) != string(value) {
+- t.Errorf("Get after Set returned different value: got %q, want %q", got, value)
+- }
+-
+- // The kind is effectively part of the key.
+- if _, err := filecache.Get("different-kind", key); err != filecache.ErrNotFound {
+- t.Errorf("Get with wrong kind returned err=%q, want not found", err)
+- }
+-}
+-
+-// TestConcurrency exercises concurrent access to the same entry.
+-func TestConcurrency(t *testing.T) {
+- const kind = "TestConcurrency"
+- key := uniqueKey()
+- const N = 100 // concurrency level
+-
+- // Construct N distinct values, each larger
+- // than a typical 4KB OS file buffer page.
+- var values [N][8192]byte
+- for i := range values {
+- if _, err := mathrand.Read(values[i][:]); err != nil {
+- t.Fatalf("rand: %v", err)
+- }
+- }
+-
+- // get calls Get and verifies that the cache entry
+- // matches one of the values passed to Set.
+- get := func(mustBeFound bool) error {
+- got, err := filecache.Get(kind, key)
+- if err != nil {
+- if err == filecache.ErrNotFound && !mustBeFound {
+- return nil // not found
+- }
+- return err
+- }
+- for _, want := range values {
+- if bytes.Equal(want[:], got) {
+- return nil // a match
+- }
+- }
+- return fmt.Errorf("Get returned a value that was never Set")
+- }
+-
+- // Perform N concurrent calls to Set and Get.
+- // All sets must succeed.
+- // All gets must return nothing, or one of the Set values;
+- // there is no third possibility.
+- var group errgroup.Group
+- for i := range values {
+- i := i
+- group.Go(func() error { return filecache.Set(kind, key, values[i][:]) })
+- group.Go(func() error { return get(false) })
+- }
+- if err := group.Wait(); err != nil {
+- t.Fatal(err)
+- }
+-
+- // A final Get must report one of the values that was Set.
+- if err := get(true); err != nil {
+- t.Fatalf("final Get failed: %v", err)
+- }
+-}
+-
+-const (
+- testIPCKind = "TestIPC"
+- testIPCValueA = "hello"
+- testIPCValueB = "world"
+-)
+-
+-// TestIPC exercises interprocess communication through the cache.
+-// It calls Set(A) in the parent, { Get(A); Set(B) } in the child
+-// process, then Get(B) in the parent.
+-func TestIPC(t *testing.T) {
+- keyA := uniqueKey()
+- keyB := uniqueKey()
+- value := []byte(testIPCValueA)
+-
+- // Set keyA.
+- if err := filecache.Set(testIPCKind, keyA, value); err != nil {
+- t.Fatalf("Set: %v", err)
+- }
+-
+- // Call ipcChild in a child process,
+- // passing it the keys in the environment
+- // (quoted, to avoid NUL termination of C strings).
+- // It will Get(A) then Set(B).
+- cmd := exec.Command(os.Args[0], os.Args[1:]...)
+- cmd.Env = append(os.Environ(),
+- "ENTRYPOINT=ipcChild",
+- fmt.Sprintf("KEYA=%q", keyA),
+- fmt.Sprintf("KEYB=%q", keyB))
+- cmd.Stdout = os.Stderr
+- cmd.Stderr = os.Stderr
+- if err := cmd.Run(); err != nil {
+- t.Fatal(err)
+- }
+-
+- // Verify keyB.
+- got, err := filecache.Get(testIPCKind, keyB)
+- if err != nil {
+- t.Fatal(err)
+- }
+- if string(got) != "world" {
+- t.Fatalf("Get(keyB) = %q, want %q", got, "world")
+- }
+-}
+-
+-// We define our own main function so that portions of
+-// some tests can run in a separate (child) process.
+-func TestMain(m *testing.M) {
+- switch os.Getenv("ENTRYPOINT") {
+- case "ipcChild":
+- ipcChild()
+- default:
+- os.Exit(m.Run())
+- }
+-}
+-
+-// ipcChild is the portion of TestIPC that runs in a child process.
+-func ipcChild() {
+- getenv := func(name string) (key [32]byte) {
+- s, _ := strconv.Unquote(os.Getenv(name))
+- copy(key[:], []byte(s))
+- return
+- }
+-
+- // Verify key A.
+- got, err := filecache.Get(testIPCKind, getenv("KEYA"))
+- if err != nil || string(got) != testIPCValueA {
+- log.Fatalf("child: Get(key) = %q, %v; want %q", got, err, testIPCValueA)
+- }
+-
+- // Set key B.
+- if err := filecache.Set(testIPCKind, getenv("KEYB"), []byte(testIPCValueB)); err != nil {
+- log.Fatalf("child: Set(keyB) failed: %v", err)
+- }
+-}
+-
+-// uniqueKey returns a key that has never been used before.
+-func uniqueKey() (key [32]byte) {
+- if _, err := cryptorand.Read(key[:]); err != nil {
+- log.Fatalf("rand: %v", err)
+- }
+- return
+-}
+-
+-func BenchmarkUncontendedGet(b *testing.B) {
+- const kind = "BenchmarkUncontendedGet"
+- key := uniqueKey()
+-
+- var value [8192]byte
+- if _, err := mathrand.Read(value[:]); err != nil {
+- b.Fatalf("rand: %v", err)
+- }
+- if err := filecache.Set(kind, key, value[:]); err != nil {
+- b.Fatal(err)
+- }
+- b.ResetTimer()
+-
+- var group errgroup.Group
+- group.SetLimit(50)
+- for i := 0; i < b.N; i++ {
+- group.Go(func() error {
+- _, err := filecache.Get(kind, key)
+- return err
+- })
+- }
+- if err := group.Wait(); err != nil {
+- b.Fatal(err)
+- }
+-}
+diff -urN a/gopls/internal/lsp/folding_range.go b/gopls/internal/lsp/folding_range.go
+--- a/gopls/internal/lsp/folding_range.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/folding_range.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,41 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-func (s *Server) foldingRange(ctx context.Context, params *protocol.FoldingRangeParams) ([]protocol.FoldingRange, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.Go)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+-
+- ranges, err := source.FoldingRange(ctx, snapshot, fh, snapshot.View().Options().LineFoldingOnly)
+- if err != nil {
+- return nil, err
+- }
+- return toProtocolFoldingRanges(ranges)
+-}
+-
+-func toProtocolFoldingRanges(ranges []*source.FoldingRangeInfo) ([]protocol.FoldingRange, error) {
+- result := make([]protocol.FoldingRange, 0, len(ranges))
+- for _, info := range ranges {
+- rng := info.MappedRange.Range()
+- result = append(result, protocol.FoldingRange{
+- StartLine: rng.Start.Line,
+- StartCharacter: rng.Start.Character,
+- EndLine: rng.End.Line,
+- EndCharacter: rng.End.Character,
+- Kind: string(info.Kind),
+- })
+- }
+- return result, nil
+-}
+diff -urN a/gopls/internal/lsp/format.go b/gopls/internal/lsp/format.go
+--- a/gopls/internal/lsp/format.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/format.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,31 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/mod"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/work"
+-)
+-
+-func (s *Server) formatting(ctx context.Context, params *protocol.DocumentFormattingParams) ([]protocol.TextEdit, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.UnknownKind)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+- switch snapshot.View().FileKind(fh) {
+- case source.Mod:
+- return mod.Format(ctx, snapshot, fh)
+- case source.Go:
+- return source.Format(ctx, snapshot, fh)
+- case source.Work:
+- return work.Format(ctx, snapshot, fh)
+- }
+- return nil, nil
+-}
+diff -urN a/gopls/internal/lsp/general.go b/gopls/internal/lsp/general.go
+--- a/gopls/internal/lsp/general.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/general.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,619 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+- "encoding/json"
+- "fmt"
+- "log"
+- "os"
+- "path"
+- "path/filepath"
+- "sort"
+- "strings"
+- "sync"
+-
+- "golang.org/x/tools/gopls/internal/lsp/debug"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/jsonrpc2"
+-)
+-
+-func (s *Server) initialize(ctx context.Context, params *protocol.ParamInitialize) (*protocol.InitializeResult, error) {
+- s.stateMu.Lock()
+- if s.state >= serverInitializing {
+- defer s.stateMu.Unlock()
+- return nil, fmt.Errorf("%w: initialize called while server in %v state", jsonrpc2.ErrInvalidRequest, s.state)
+- }
+- s.state = serverInitializing
+- s.stateMu.Unlock()
+-
+- // For uniqueness, use the gopls PID rather than params.ProcessID (the client
+- // pid). Some clients might start multiple gopls servers, though they
+- // probably shouldn't.
+- pid := os.Getpid()
+- s.tempDir = filepath.Join(os.TempDir(), fmt.Sprintf("gopls-%d.%s", pid, s.session.ID()))
+- err := os.Mkdir(s.tempDir, 0700)
+- if err != nil {
+- // MkdirTemp could fail due to permissions issues. This is a problem with
+- // the user's environment, but should not block gopls otherwise behaving.
+- // All usage of s.tempDir should be predicated on having a non-empty
+- // s.tempDir.
+- event.Error(ctx, "creating temp dir", err)
+- s.tempDir = ""
+- }
+- s.progress.SetSupportsWorkDoneProgress(params.Capabilities.Window.WorkDoneProgress)
+-
+- options := s.session.Options()
+- defer func() { s.session.SetOptions(options) }()
+-
+- if err := s.handleOptionResults(ctx, source.SetOptions(options, params.InitializationOptions)); err != nil {
+- return nil, err
+- }
+- options.ForClientCapabilities(params.Capabilities)
+-
+- if options.ShowBugReports {
+- // Report the next bug that occurs on the server.
+- bugCh := bug.Notify()
+- go func() {
+- b := <-bugCh
+- msg := &protocol.ShowMessageParams{
+- Type: protocol.Error,
+- Message: fmt.Sprintf("A bug occurred on the server: %s\nLocation:%s", b.Description, b.Key),
+- }
+- if err := s.eventuallyShowMessage(context.Background(), msg); err != nil {
+- log.Printf("error showing bug: %v", err)
+- }
+- }()
+- }
+-
+- folders := params.WorkspaceFolders
+- if len(folders) == 0 {
+- if params.RootURI != "" {
+- folders = []protocol.WorkspaceFolder{{
+- URI: string(params.RootURI),
+- Name: path.Base(params.RootURI.SpanURI().Filename()),
+- }}
+- }
+- }
+- for _, folder := range folders {
+- uri := span.URIFromURI(folder.URI)
+- if !uri.IsFile() {
+- continue
+- }
+- s.pendingFolders = append(s.pendingFolders, folder)
+- }
+- // gopls only supports URIs with a file:// scheme, so if we have no
+- // workspace folders with a supported scheme, fail to initialize.
+- if len(folders) > 0 && len(s.pendingFolders) == 0 {
+- return nil, fmt.Errorf("unsupported URI schemes: %v (gopls only supports file URIs)", folders)
+- }
+-
+- var codeActionProvider interface{} = true
+- if ca := params.Capabilities.TextDocument.CodeAction; len(ca.CodeActionLiteralSupport.CodeActionKind.ValueSet) > 0 {
+- // If the client has specified CodeActionLiteralSupport,
+- // send the code actions we support.
+- //
+- // Using CodeActionOptions is only valid if codeActionLiteralSupport is set.
+- codeActionProvider = &protocol.CodeActionOptions{
+- CodeActionKinds: s.getSupportedCodeActions(),
+- }
+- }
+- var renameOpts interface{} = true
+- if r := params.Capabilities.TextDocument.Rename; r != nil && r.PrepareSupport {
+- renameOpts = protocol.RenameOptions{
+- PrepareProvider: r.PrepareSupport,
+- }
+- }
+-
+- versionInfo := debug.VersionInfo()
+-
+- // golang/go#45732: Warn users who've installed sergi/go-diff@v1.2.0, since
+- // it will corrupt the formatting of their files.
+- for _, dep := range versionInfo.Deps {
+- if dep.Path == "github.com/sergi/go-diff" && dep.Version == "v1.2.0" {
+- if err := s.eventuallyShowMessage(ctx, &protocol.ShowMessageParams{
+- Message: `It looks like you have a bad gopls installation.
+-Please reinstall gopls by running 'GO111MODULE=on go install golang.org/x/tools/gopls@latest'.
+-See https://github.com/golang/go/issues/45732 for more information.`,
+- Type: protocol.Error,
+- }); err != nil {
+- return nil, err
+- }
+- }
+- }
+-
+- goplsVersion, err := json.Marshal(versionInfo)
+- if err != nil {
+- return nil, err
+- }
+-
+- return &protocol.InitializeResult{
+- Capabilities: protocol.ServerCapabilities{
+- CallHierarchyProvider: &protocol.Or_ServerCapabilities_callHierarchyProvider{Value: true},
+- CodeActionProvider: codeActionProvider,
+- CodeLensProvider: &protocol.CodeLensOptions{}, // must be non-nil to enable the code lens capability
+- CompletionProvider: &protocol.CompletionOptions{
+- TriggerCharacters: []string{"."},
+- },
+- DefinitionProvider: &protocol.Or_ServerCapabilities_definitionProvider{Value: true},
+- TypeDefinitionProvider: &protocol.Or_ServerCapabilities_typeDefinitionProvider{Value: true},
+- ImplementationProvider: &protocol.Or_ServerCapabilities_implementationProvider{Value: true},
+- DocumentFormattingProvider: &protocol.Or_ServerCapabilities_documentFormattingProvider{Value: true},
+- DocumentSymbolProvider: &protocol.Or_ServerCapabilities_documentSymbolProvider{Value: true},
+- WorkspaceSymbolProvider: &protocol.Or_ServerCapabilities_workspaceSymbolProvider{Value: true},
+- ExecuteCommandProvider: &protocol.ExecuteCommandOptions{
+- Commands: options.SupportedCommands,
+- },
+- FoldingRangeProvider: &protocol.Or_ServerCapabilities_foldingRangeProvider{Value: true},
+- HoverProvider: &protocol.Or_ServerCapabilities_hoverProvider{Value: true},
+- DocumentHighlightProvider: &protocol.Or_ServerCapabilities_documentHighlightProvider{Value: true},
+- DocumentLinkProvider: &protocol.DocumentLinkOptions{},
+- InlayHintProvider: protocol.InlayHintOptions{},
+- ReferencesProvider: &protocol.Or_ServerCapabilities_referencesProvider{Value: true},
+- RenameProvider: renameOpts,
+- SelectionRangeProvider: &protocol.Or_ServerCapabilities_selectionRangeProvider{Value: true},
+- SemanticTokensProvider: protocol.SemanticTokensOptions{
+- Range: &protocol.Or_SemanticTokensOptions_range{Value: true},
+- Full: &protocol.Or_SemanticTokensOptions_full{Value: true},
+- Legend: protocol.SemanticTokensLegend{
+- TokenTypes: s.session.Options().SemanticTypes,
+- TokenModifiers: s.session.Options().SemanticMods,
+- },
+- },
+- SignatureHelpProvider: &protocol.SignatureHelpOptions{
+- TriggerCharacters: []string{"(", ","},
+- },
+- TextDocumentSync: &protocol.TextDocumentSyncOptions{
+- Change: protocol.Incremental,
+- OpenClose: true,
+- Save: &protocol.SaveOptions{
+- IncludeText: false,
+- },
+- },
+- Workspace: &protocol.Workspace6Gn{
+- WorkspaceFolders: &protocol.WorkspaceFolders5Gn{
+- Supported: true,
+- ChangeNotifications: "workspace/didChangeWorkspaceFolders",
+- },
+- },
+- },
+- ServerInfo: &protocol.PServerInfoMsg_initialize{
+- Name: "gopls",
+- Version: string(goplsVersion),
+- },
+- }, nil
+-}
+-
+-func (s *Server) initialized(ctx context.Context, params *protocol.InitializedParams) error {
+- s.stateMu.Lock()
+- if s.state >= serverInitialized {
+- defer s.stateMu.Unlock()
+- return fmt.Errorf("%w: initialized called while server in %v state", jsonrpc2.ErrInvalidRequest, s.state)
+- }
+- s.state = serverInitialized
+- s.stateMu.Unlock()
+-
+- for _, not := range s.notifications {
+- s.client.ShowMessage(ctx, not)
+- }
+- s.notifications = nil
+-
+- options := s.session.Options()
+- defer func() { s.session.SetOptions(options) }()
+-
+- if err := s.addFolders(ctx, s.pendingFolders); err != nil {
+- return err
+- }
+- s.pendingFolders = nil
+- s.checkViewGoVersions()
+-
+- var registrations []protocol.Registration
+- if options.ConfigurationSupported && options.DynamicConfigurationSupported {
+- registrations = append(registrations, protocol.Registration{
+- ID: "workspace/didChangeConfiguration",
+- Method: "workspace/didChangeConfiguration",
+- })
+- }
+- if len(registrations) > 0 {
+- if err := s.client.RegisterCapability(ctx, &protocol.RegistrationParams{
+- Registrations: registrations,
+- }); err != nil {
+- return err
+- }
+- }
+- return nil
+-}
+-
+-// GoVersionTable maps Go versions to the gopls version in which support will
+-// be deprecated, and the final gopls version supporting them without warnings.
+-// Keep this in sync with gopls/README.md
+-//
+-// Must be sorted in ascending order of Go version.
+-//
+-// Mutable for testing.
+-var GoVersionTable = []GoVersionSupport{
+- {12, "", "v0.7.5"},
+- {15, "v0.11.0", "v0.9.5"},
+-}
+-
+-// GoVersionSupport holds information about end-of-life Go version support.
+-type GoVersionSupport struct {
+- GoVersion int
+- DeprecatedVersion string // if unset, the version is already deprecated
+- InstallGoplsVersion string
+-}
+-
+-// OldestSupportedGoVersion is the last X in Go 1.X that this version of gopls
+-// supports.
+-func OldestSupportedGoVersion() int {
+- return GoVersionTable[len(GoVersionTable)-1].GoVersion + 1
+-}
+-
+-// versionMessage returns the warning/error message to display if the user is
+-// on the given Go version, if any. The goVersion variable is the X in Go 1.X.
+-//
+-// If goVersion is invalid (< 0), it returns "", 0.
+-func versionMessage(goVersion int) (string, protocol.MessageType) {
+- if goVersion < 0 {
+- return "", 0
+- }
+-
+- for _, v := range GoVersionTable {
+- if goVersion <= v.GoVersion {
+- var msgBuilder strings.Builder
+-
+- mType := protocol.Error
+- fmt.Fprintf(&msgBuilder, "Found Go version 1.%d", goVersion)
+- if v.DeprecatedVersion != "" {
+- // not deprecated yet, just a warning
+- fmt.Fprintf(&msgBuilder, ", which will be unsupported by gopls %s. ", v.DeprecatedVersion)
+- mType = protocol.Warning
+- } else {
+- fmt.Fprint(&msgBuilder, ", which is not supported by this version of gopls. ")
+- }
+- fmt.Fprintf(&msgBuilder, "Please upgrade to Go 1.%d or later and reinstall gopls. ", OldestSupportedGoVersion())
+- fmt.Fprintf(&msgBuilder, "If you can't upgrade and want this message to go away, please install gopls %s. ", v.InstallGoplsVersion)
+- fmt.Fprint(&msgBuilder, "See https://go.dev/s/gopls-support-policy for more details.")
+-
+- return msgBuilder.String(), mType
+- }
+- }
+- return "", 0
+-}
+-
+-// checkViewGoVersions checks whether any Go version used by a view is too old,
+-// raising a showMessage notification if so.
+-//
+-// It should be called after views change.
+-func (s *Server) checkViewGoVersions() {
+- oldestVersion := -1
+- for _, view := range s.session.Views() {
+- viewVersion := view.GoVersion()
+- if oldestVersion == -1 || viewVersion < oldestVersion {
+- oldestVersion = viewVersion
+- }
+- }
+-
+- if msg, mType := versionMessage(oldestVersion); msg != "" {
+- s.eventuallyShowMessage(context.Background(), &protocol.ShowMessageParams{
+- Type: mType,
+- Message: msg,
+- })
+- }
+-}
+-
+-func (s *Server) addFolders(ctx context.Context, folders []protocol.WorkspaceFolder) error {
+- originalViews := len(s.session.Views())
+- viewErrors := make(map[span.URI]error)
+-
+- var ndiagnose sync.WaitGroup // number of unfinished diagnose calls
+- if s.session.Options().VerboseWorkDoneProgress {
+- work := s.progress.Start(ctx, DiagnosticWorkTitle(FromInitialWorkspaceLoad), "Calculating diagnostics for initial workspace load...", nil, nil)
+- defer func() {
+- go func() {
+- ndiagnose.Wait()
+- work.End(ctx, "Done.")
+- }()
+- }()
+- }
+- // Only one view gets to have a workspace.
+- var nsnapshots sync.WaitGroup // number of unfinished snapshot initializations
+- for _, folder := range folders {
+- uri := span.URIFromURI(folder.URI)
+- // Ignore non-file URIs.
+- if !uri.IsFile() {
+- continue
+- }
+- work := s.progress.Start(ctx, "Setting up workspace", "Loading packages...", nil, nil)
+- snapshot, release, err := s.addView(ctx, folder.Name, uri)
+- if err != nil {
+- if err == source.ErrViewExists {
+- continue
+- }
+- viewErrors[uri] = err
+- work.End(ctx, fmt.Sprintf("Error loading packages: %s", err))
+- continue
+- }
+- // Inv: release() must be called once.
+-
+- // Initialize snapshot asynchronously.
+- initialized := make(chan struct{})
+- nsnapshots.Add(1)
+- go func() {
+- snapshot.AwaitInitialized(ctx)
+- work.End(ctx, "Finished loading packages.")
+- nsnapshots.Done()
+- close(initialized) // signal
+- }()
+-
+- // Diagnose the newly created view asynchronously.
+- ndiagnose.Add(1)
+- go func() {
+- s.diagnoseDetached(snapshot)
+- <-initialized
+- release()
+- ndiagnose.Done()
+- }()
+- }
+-
+- // Wait for snapshots to be initialized so that all files are known.
+- // (We don't need to wait for diagnosis to finish.)
+- nsnapshots.Wait()
+-
+- // Register for file watching notifications, if they are supported.
+- if err := s.updateWatchedDirectories(ctx); err != nil {
+- event.Error(ctx, "failed to register for file watching notifications", err)
+- }
+-
+- if len(viewErrors) > 0 {
+- errMsg := fmt.Sprintf("Error loading workspace folders (expected %v, got %v)\n", len(folders), len(s.session.Views())-originalViews)
+- for uri, err := range viewErrors {
+- errMsg += fmt.Sprintf("failed to load view for %s: %v\n", uri, err)
+- }
+- return s.client.ShowMessage(ctx, &protocol.ShowMessageParams{
+- Type: protocol.Error,
+- Message: errMsg,
+- })
+- }
+- return nil
+-}
+-
+-// updateWatchedDirectories compares the current set of directories to watch
+-// with the previously registered set of directories. If the set of directories
+-// has changed, we unregister and re-register for file watching notifications.
+-// updatedSnapshots is the set of snapshots that have been updated.
+-func (s *Server) updateWatchedDirectories(ctx context.Context) error {
+- patterns := s.session.FileWatchingGlobPatterns(ctx)
+-
+- s.watchedGlobPatternsMu.Lock()
+- defer s.watchedGlobPatternsMu.Unlock()
+-
+- // Nothing to do if the set of workspace directories is unchanged.
+- if equalURISet(s.watchedGlobPatterns, patterns) {
+- return nil
+- }
+-
+- // If the set of directories to watch has changed, register the updates and
+- // unregister the previously watched directories. This ordering avoids a
+- // period where no files are being watched. Still, if a user makes on-disk
+- // changes before these updates are complete, we may miss them for the new
+- // directories.
+- prevID := s.watchRegistrationCount - 1
+- if err := s.registerWatchedDirectoriesLocked(ctx, patterns); err != nil {
+- return err
+- }
+- if prevID >= 0 {
+- return s.client.UnregisterCapability(ctx, &protocol.UnregistrationParams{
+- Unregisterations: []protocol.Unregistration{{
+- ID: watchedFilesCapabilityID(prevID),
+- Method: "workspace/didChangeWatchedFiles",
+- }},
+- })
+- }
+- return nil
+-}
+-
+-func watchedFilesCapabilityID(id int) string {
+- return fmt.Sprintf("workspace/didChangeWatchedFiles-%d", id)
+-}
+-
+-func equalURISet(m1, m2 map[string]struct{}) bool {
+- if len(m1) != len(m2) {
+- return false
+- }
+- for k := range m1 {
+- _, ok := m2[k]
+- if !ok {
+- return false
+- }
+- }
+- return true
+-}
+-
+-// registerWatchedDirectoriesLocked sends the workspace/didChangeWatchedFiles
+-// registrations to the client and updates s.watchedDirectories.
+-func (s *Server) registerWatchedDirectoriesLocked(ctx context.Context, patterns map[string]struct{}) error {
+- if !s.session.Options().DynamicWatchedFilesSupported {
+- return nil
+- }
+- for k := range s.watchedGlobPatterns {
+- delete(s.watchedGlobPatterns, k)
+- }
+- var watchers []protocol.FileSystemWatcher
+- val := protocol.WatchChange | protocol.WatchDelete | protocol.WatchCreate
+- for pattern := range patterns {
+- watchers = append(watchers, protocol.FileSystemWatcher{
+- GlobPattern: pattern,
+- Kind: &val,
+- })
+- }
+-
+- if err := s.client.RegisterCapability(ctx, &protocol.RegistrationParams{
+- Registrations: []protocol.Registration{{
+- ID: watchedFilesCapabilityID(s.watchRegistrationCount),
+- Method: "workspace/didChangeWatchedFiles",
+- RegisterOptions: protocol.DidChangeWatchedFilesRegistrationOptions{
+- Watchers: watchers,
+- },
+- }},
+- }); err != nil {
+- return err
+- }
+- s.watchRegistrationCount++
+-
+- for k, v := range patterns {
+- s.watchedGlobPatterns[k] = v
+- }
+- return nil
+-}
+-
+-func (s *Server) fetchConfig(ctx context.Context, name string, folder span.URI, o *source.Options) error {
+- if !s.session.Options().ConfigurationSupported {
+- return nil
+- }
+- configs, err := s.client.Configuration(ctx, &protocol.ParamConfiguration{
+- Items: []protocol.ConfigurationItem{{
+- ScopeURI: string(folder),
+- Section: "gopls",
+- }},
+- },
+- )
+- if err != nil {
+- return fmt.Errorf("failed to get workspace configuration from client (%s): %v", folder, err)
+- }
+- for _, config := range configs {
+- if err := s.handleOptionResults(ctx, source.SetOptions(o, config)); err != nil {
+- return err
+- }
+- }
+- return nil
+-}
+-
+-func (s *Server) eventuallyShowMessage(ctx context.Context, msg *protocol.ShowMessageParams) error {
+- s.stateMu.Lock()
+- defer s.stateMu.Unlock()
+- if s.state == serverInitialized {
+- return s.client.ShowMessage(ctx, msg)
+- }
+- s.notifications = append(s.notifications, msg)
+- return nil
+-}
+-
+-func (s *Server) handleOptionResults(ctx context.Context, results source.OptionResults) error {
+- var warnings, errors []string
+- for _, result := range results {
+- switch result.Error.(type) {
+- case nil:
+- // nothing to do
+- case *source.SoftError:
+- warnings = append(warnings, result.Error.Error())
+- default:
+- errors = append(errors, result.Error.Error())
+- }
+- }
+-
+- // Sort messages, but put errors first.
+- //
+- // Having stable content for the message allows clients to de-duplicate. This
+- // matters because we may send duplicate warnings for clients that support
+- // dynamic configuration: one for the initial settings, and then more for the
+- // individual view settings.
+- var msgs []string
+- msgType := protocol.Warning
+- if len(errors) > 0 {
+- msgType = protocol.Error
+- sort.Strings(errors)
+- msgs = append(msgs, errors...)
+- }
+- if len(warnings) > 0 {
+- sort.Strings(warnings)
+- msgs = append(msgs, warnings...)
+- }
+-
+- if len(msgs) > 0 {
+- // Settings
+- combined := "Invalid settings: " + strings.Join(msgs, "; ")
+- params := &protocol.ShowMessageParams{
+- Type: msgType,
+- Message: combined,
+- }
+- return s.eventuallyShowMessage(ctx, params)
+- }
+-
+- return nil
+-}
+-
+-// beginFileRequest checks preconditions for a file-oriented request and routes
+-// it to a snapshot.
+-// We don't want to return errors for benign conditions like wrong file type,
+-// so callers should do if !ok { return err } rather than if err != nil.
+-// The returned cleanup function is non-nil even in case of false/error result.
+-func (s *Server) beginFileRequest(ctx context.Context, pURI protocol.DocumentURI, expectKind source.FileKind) (source.Snapshot, source.FileHandle, bool, func(), error) {
+- uri := pURI.SpanURI()
+- if !uri.IsFile() {
+- // Not a file URI. Stop processing the request, but don't return an error.
+- return nil, nil, false, func() {}, nil
+- }
+- view, err := s.session.ViewOf(uri)
+- if err != nil {
+- return nil, nil, false, func() {}, err
+- }
+- snapshot, release, err := view.Snapshot()
+- if err != nil {
+- return nil, nil, false, func() {}, err
+- }
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- release()
+- return nil, nil, false, func() {}, err
+- }
+- if expectKind != source.UnknownKind && view.FileKind(fh) != expectKind {
+- // Wrong kind of file. Nothing to do.
+- release()
+- return nil, nil, false, func() {}, nil
+- }
+- return snapshot, fh, true, release, nil
+-}
+-
+-// shutdown implements the 'shutdown' LSP handler. It releases resources
+-// associated with the server and waits for all ongoing work to complete.
+-func (s *Server) shutdown(ctx context.Context) error {
+- s.stateMu.Lock()
+- defer s.stateMu.Unlock()
+- if s.state < serverInitialized {
+- event.Log(ctx, "server shutdown without initialization")
+- }
+- if s.state != serverShutDown {
+- // drop all the active views
+- s.session.Shutdown(ctx)
+- s.state = serverShutDown
+- if s.tempDir != "" {
+- if err := os.RemoveAll(s.tempDir); err != nil {
+- event.Error(ctx, "removing temp dir", err)
+- }
+- }
+- }
+- return nil
+-}
+-
+-func (s *Server) exit(ctx context.Context) error {
+- s.stateMu.Lock()
+- defer s.stateMu.Unlock()
+-
+- s.client.Close()
+-
+- if s.state != serverShutDown {
+- // TODO: We should be able to do better than this.
+- os.Exit(1)
+- }
+- // we don't terminate the process on a normal exit, we just allow it to
+- // close naturally if needed after the connection is closed.
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/general_test.go b/gopls/internal/lsp/general_test.go
+--- a/gopls/internal/lsp/general_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/general_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,44 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "strings"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-func TestVersionMessage(t *testing.T) {
+- tests := []struct {
+- goVersion int
+- wantContains []string // string fragments that we expect to see
+- wantType protocol.MessageType
+- }{
+- {-1, nil, 0},
+- {12, []string{"1.12", "not supported", "upgrade to Go 1.16", "install gopls v0.7.5"}, protocol.Error},
+- {13, []string{"1.13", "will be unsupported by gopls v0.11.0", "upgrade to Go 1.16", "install gopls v0.9.5"}, protocol.Warning},
+- {15, []string{"1.15", "will be unsupported by gopls v0.11.0", "upgrade to Go 1.16", "install gopls v0.9.5"}, protocol.Warning},
+- {16, nil, 0},
+- }
+-
+- for _, test := range tests {
+- gotMsg, gotType := versionMessage(test.goVersion)
+-
+- if len(test.wantContains) == 0 && gotMsg != "" {
+- t.Errorf("versionMessage(%d) = %q, want \"\"", test.goVersion, gotMsg)
+- }
+-
+- for _, want := range test.wantContains {
+- if !strings.Contains(gotMsg, want) {
+- t.Errorf("versionMessage(%d) = %q, want containing %q", test.goVersion, gotMsg, want)
+- }
+- }
+-
+- if gotType != test.wantType {
+- t.Errorf("versionMessage(%d) = returned message type %d, want %d", test.goVersion, gotType, test.wantType)
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/glob/glob.go b/gopls/internal/lsp/glob/glob.go
+--- a/gopls/internal/lsp/glob/glob.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/glob/glob.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,349 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package glob implements an LSP-compliant glob pattern matcher for testing.
+-package glob
+-
+-import (
+- "errors"
+- "fmt"
+- "strings"
+- "unicode/utf8"
+-)
+-
+-// A Glob is an LSP-compliant glob pattern, as defined by the spec:
+-// https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#documentFilter
+-//
+-// NOTE: this implementation is currently only intended for testing. In order
+-// to make it production ready, we'd need to:
+-// - verify it against the VS Code implementation
+-// - add more tests
+-// - microbenchmark, likely avoiding the element interface
+-// - resolve the question of what is meant by "character". If it's a UTF-16
+-// code (as we suspect) it'll be a bit more work.
+-//
+-// Quoting from the spec:
+-// Glob patterns can have the following syntax:
+-// - `*` to match one or more characters in a path segment
+-// - `?` to match on one character in a path segment
+-// - `**` to match any number of path segments, including none
+-// - `{}` to group sub patterns into an OR expression. (e.g. `**/*.{ts,js}`
+-// matches all TypeScript and JavaScript files)
+-// - `[]` to declare a range of characters to match in a path segment
+-// (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
+-// - `[!...]` to negate a range of characters to match in a path segment
+-// (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but
+-// not `example.0`)
+-//
+-// Expanding on this:
+-// - '/' matches one or more literal slashes.
+-// - any other character matches itself literally.
+-type Glob struct {
+- elems []element // pattern elements
+-}
+-
+-// Parse builds a Glob for the given pattern, returning an error if the pattern
+-// is invalid.
+-func Parse(pattern string) (*Glob, error) {
+- g, _, err := parse(pattern, false)
+- return g, err
+-}
+-
+-func parse(pattern string, nested bool) (*Glob, string, error) {
+- g := new(Glob)
+- for len(pattern) > 0 {
+- switch pattern[0] {
+- case '/':
+- pattern = pattern[1:]
+- g.elems = append(g.elems, slash{})
+-
+- case '*':
+- if len(pattern) > 1 && pattern[1] == '*' {
+- if (len(g.elems) > 0 && g.elems[len(g.elems)-1] != slash{}) || (len(pattern) > 2 && pattern[2] != '/') {
+- return nil, "", errors.New("** may only be adjacent to '/'")
+- }
+- pattern = pattern[2:]
+- g.elems = append(g.elems, starStar{})
+- break
+- }
+- pattern = pattern[1:]
+- g.elems = append(g.elems, star{})
+-
+- case '?':
+- pattern = pattern[1:]
+- g.elems = append(g.elems, anyChar{})
+-
+- case '{':
+- var gs group
+- for pattern[0] != '}' {
+- pattern = pattern[1:]
+- g, pat, err := parse(pattern, true)
+- if err != nil {
+- return nil, "", err
+- }
+- if len(pat) == 0 {
+- return nil, "", errors.New("unmatched '{'")
+- }
+- pattern = pat
+- gs = append(gs, g)
+- }
+- pattern = pattern[1:]
+- g.elems = append(g.elems, gs)
+-
+- case '}', ',':
+- if nested {
+- return g, pattern, nil
+- }
+- pattern = g.parseLiteral(pattern, false)
+-
+- case '[':
+- pattern = pattern[1:]
+- if len(pattern) == 0 {
+- return nil, "", errBadRange
+- }
+- negate := false
+- if pattern[0] == '!' {
+- pattern = pattern[1:]
+- negate = true
+- }
+- low, sz, err := readRangeRune(pattern)
+- if err != nil {
+- return nil, "", err
+- }
+- pattern = pattern[sz:]
+- if len(pattern) == 0 || pattern[0] != '-' {
+- return nil, "", errBadRange
+- }
+- pattern = pattern[1:]
+- high, sz, err := readRangeRune(pattern)
+- if err != nil {
+- return nil, "", err
+- }
+- pattern = pattern[sz:]
+- if len(pattern) == 0 || pattern[0] != ']' {
+- return nil, "", errBadRange
+- }
+- pattern = pattern[1:]
+- g.elems = append(g.elems, charRange{negate, low, high})
+-
+- default:
+- pattern = g.parseLiteral(pattern, nested)
+- }
+- }
+- return g, "", nil
+-}
+-
+-// helper for decoding a rune in range elements, e.g. [a-z]
+-func readRangeRune(input string) (rune, int, error) {
+- r, sz := utf8.DecodeRuneInString(input)
+- var err error
+- if r == utf8.RuneError {
+- // See the documentation for DecodeRuneInString.
+- switch sz {
+- case 0:
+- err = errBadRange
+- case 1:
+- err = errInvalidUTF8
+- }
+- }
+- return r, sz, err
+-}
+-
+-var (
+- errBadRange = errors.New("'[' patterns must be of the form [x-y]")
+- errInvalidUTF8 = errors.New("invalid UTF-8 encoding")
+-)
+-
+-func (g *Glob) parseLiteral(pattern string, nested bool) string {
+- var specialChars string
+- if nested {
+- specialChars = "*?{[/},"
+- } else {
+- specialChars = "*?{[/"
+- }
+- end := strings.IndexAny(pattern, specialChars)
+- if end == -1 {
+- end = len(pattern)
+- }
+- g.elems = append(g.elems, literal(pattern[:end]))
+- return pattern[end:]
+-}
+-
+-func (g *Glob) String() string {
+- var b strings.Builder
+- for _, e := range g.elems {
+- fmt.Fprint(&b, e)
+- }
+- return b.String()
+-}
+-
+-// element holds a glob pattern element, as defined below.
+-type element fmt.Stringer
+-
+-// element types.
+-type (
+- slash struct{} // One or more '/' separators
+- literal string // string literal, not containing /, *, ?, {}, or []
+- star struct{} // *
+- anyChar struct{} // ?
+- starStar struct{} // **
+- group []*Glob // {foo, bar, ...} grouping
+- charRange struct { // [a-z] character range
+- negate bool
+- low, high rune
+- }
+-)
+-
+-func (s slash) String() string { return "/" }
+-func (l literal) String() string { return string(l) }
+-func (s star) String() string { return "*" }
+-func (a anyChar) String() string { return "?" }
+-func (s starStar) String() string { return "**" }
+-func (g group) String() string {
+- var parts []string
+- for _, g := range g {
+- parts = append(parts, g.String())
+- }
+- return "{" + strings.Join(parts, ",") + "}"
+-}
+-func (r charRange) String() string {
+- return "[" + string(r.low) + "-" + string(r.high) + "]"
+-}
+-
+-// Match reports whether the input string matches the glob pattern.
+-func (g *Glob) Match(input string) bool {
+- return match(g.elems, input)
+-}
+-
+-func match(elems []element, input string) (ok bool) {
+- var elem interface{}
+- for len(elems) > 0 {
+- elem, elems = elems[0], elems[1:]
+- switch elem := elem.(type) {
+- case slash:
+- if len(input) == 0 || input[0] != '/' {
+- return false
+- }
+- for input[0] == '/' {
+- input = input[1:]
+- }
+-
+- case starStar:
+- // Special cases:
+- // - **/a matches "a"
+- // - **/ matches everything
+- //
+- // Note that if ** is followed by anything, it must be '/' (this is
+- // enforced by Parse).
+- if len(elems) > 0 {
+- elems = elems[1:]
+- }
+-
+- // A trailing ** matches anything.
+- if len(elems) == 0 {
+- return true
+- }
+-
+- // Backtracking: advance pattern segments until the remaining pattern
+- // elements match.
+- for len(input) != 0 {
+- if match(elems, input) {
+- return true
+- }
+- _, input = split(input)
+- }
+- return false
+-
+- case literal:
+- if !strings.HasPrefix(input, string(elem)) {
+- return false
+- }
+- input = input[len(elem):]
+-
+- case star:
+- var segInput string
+- segInput, input = split(input)
+-
+- elemEnd := len(elems)
+- for i, e := range elems {
+- if e == (slash{}) {
+- elemEnd = i
+- break
+- }
+- }
+- segElems := elems[:elemEnd]
+- elems = elems[elemEnd:]
+-
+- // A trailing * matches the entire segment.
+- if len(segElems) == 0 {
+- break
+- }
+-
+- // Backtracking: advance characters until remaining subpattern elements
+- // match.
+- matched := false
+- for i := range segInput {
+- if match(segElems, segInput[i:]) {
+- matched = true
+- break
+- }
+- }
+- if !matched {
+- return false
+- }
+-
+- case anyChar:
+- if len(input) == 0 || input[0] == '/' {
+- return false
+- }
+- input = input[1:]
+-
+- case group:
+- // Append remaining pattern elements to each group member looking for a
+- // match.
+- var branch []element
+- for _, m := range elem {
+- branch = branch[:0]
+- branch = append(branch, m.elems...)
+- branch = append(branch, elems...)
+- if match(branch, input) {
+- return true
+- }
+- }
+- return false
+-
+- case charRange:
+- if len(input) == 0 || input[0] == '/' {
+- return false
+- }
+- c, sz := utf8.DecodeRuneInString(input)
+- if c < elem.low || c > elem.high {
+- return false
+- }
+- input = input[sz:]
+-
+- default:
+- panic(fmt.Sprintf("segment type %T not implemented", elem))
+- }
+- }
+-
+- return len(input) == 0
+-}
+-
+-// split returns the portion before and after the first slash
+-// (or sequence of consecutive slashes). If there is no slash
+-// it returns (input, nil).
+-func split(input string) (first, rest string) {
+- i := strings.IndexByte(input, '/')
+- if i < 0 {
+- return input, ""
+- }
+- first = input[:i]
+- for j := i; j < len(input); j++ {
+- if input[j] != '/' {
+- return first, input[j:]
+- }
+- }
+- return first, ""
+-}
+diff -urN a/gopls/internal/lsp/glob/glob_test.go b/gopls/internal/lsp/glob/glob_test.go
+--- a/gopls/internal/lsp/glob/glob_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/glob/glob_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,118 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package glob_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/glob"
+-)
+-
+-func TestParseErrors(t *testing.T) {
+- tests := []string{
+- "***",
+- "ab{c",
+- "[]",
+- "[a-]",
+- "ab{c{d}",
+- }
+-
+- for _, test := range tests {
+- _, err := glob.Parse(test)
+- if err == nil {
+- t.Errorf("Parse(%q) succeeded unexpectedly", test)
+- }
+- }
+-}
+-
+-func TestMatch(t *testing.T) {
+- tests := []struct {
+- pattern, input string
+- want bool
+- }{
+- // Basic cases.
+- {"", "", true},
+- {"", "a", false},
+- {"", "/", false},
+- {"abc", "abc", true},
+-
+- // ** behavior
+- {"**", "abc", true},
+- {"**/abc", "abc", true},
+- {"**", "abc/def", true},
+- {"{a/**/c,a/**/d}", "a/b/c", true},
+- {"{a/**/c,a/**/d}", "a/b/c/d", true},
+- {"{a/**/c,a/**/e}", "a/b/c/d", false},
+- {"{a/**/c,a/**/e,a/**/d}", "a/b/c/d", true},
+- {"{/a/**/c,a/**/e,a/**/d}", "a/b/c/d", true},
+- {"{/a/**/c,a/**/e,a/**/d}", "/a/b/c/d", false},
+- {"{/a/**/c,a/**/e,a/**/d}", "/a/b/c", true},
+- {"{/a/**/e,a/**/e,a/**/d}", "/a/b/c", false},
+-
+- // * and ? behavior
+- {"/*", "/a", true},
+- {"*", "foo", true},
+- {"*o", "foo", true},
+- {"*o", "foox", false},
+- {"f*o", "foo", true},
+- {"f*o", "fo", true},
+- {"fo?", "foo", true},
+- {"fo?", "fox", true},
+- {"fo?", "fooo", false},
+- {"fo?", "fo", false},
+- {"?", "a", true},
+- {"?", "ab", false},
+- {"?", "", false},
+- {"*?", "", false},
+- {"?b", "ab", true},
+- {"?c", "ab", false},
+-
+- // {} behavior
+- {"ab{c,d}e", "abce", true},
+- {"ab{c,d}e", "abde", true},
+- {"ab{c,d}e", "abxe", false},
+- {"ab{c,d}e", "abe", false},
+- {"{a,b}c", "ac", true},
+- {"{a,b}c", "bc", true},
+- {"{a,b}c", "ab", false},
+- {"a{b,c}", "ab", true},
+- {"a{b,c}", "ac", true},
+- {"a{b,c}", "bc", false},
+- {"ab{c{1,2},d}e", "abc1e", true},
+- {"ab{c{1,2},d}e", "abde", true},
+- {"ab{c{1,2},d}e", "abc1f", false},
+- {"ab{c{1,2},d}e", "abce", false},
+- {"ab{c[}-~]}d", "abc}d", true},
+- {"ab{c[}-~]}d", "abc~d", true},
+- {"ab{c[}-~],y}d", "abcxd", false},
+- {"ab{c[}-~],y}d", "abyd", true},
+- {"ab{c[}-~],y}d", "abd", false},
+- {"{a/b/c,d/e/f}", "a/b/c", true},
+- {"/ab{/c,d}e", "/ab/ce", true},
+- {"/ab{/c,d}e", "/ab/cf", false},
+-
+- // [-] behavior
+- {"[a-c]", "a", true},
+- {"[a-c]", "b", true},
+- {"[a-c]", "c", true},
+- {"[a-c]", "d", false},
+- {"[a-c]", " ", false},
+-
+- // Realistic examples.
+- {"**/*.{ts,js}", "path/to/foo.ts", true},
+- {"**/*.{ts,js}", "path/to/foo.js", true},
+- {"**/*.{ts,js}", "path/to/foo.go", false},
+- }
+-
+- for _, test := range tests {
+- g, err := glob.Parse(test.pattern)
+- if err != nil {
+- t.Fatalf("New(%q) failed unexpectedly: %v", test.pattern, err)
+- }
+- if got := g.Match(test.input); got != test.want {
+- t.Errorf("New(%q).Match(%q) = %t, want %t", test.pattern, test.input, got, test.want)
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/helper/helper.go b/gopls/internal/lsp/helper/helper.go
+--- a/gopls/internal/lsp/helper/helper.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/helper/helper.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,264 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// The helper command generates the declaration of the concrete
+-// 'server' type that implements the abstract Server interface defined
+-// in protocol/tsserver.go (which is itself generated from the LSP
+-// protocol).
+-//
+-// To run, invoke "go generate" in the parent (lsp) directory.
+-//
+-// TODO(adonovan): merge this into the main LSP generator.
+-package main
+-
+-import (
+- "bytes"
+- "flag"
+- "fmt"
+- "go/ast"
+- "go/format"
+- "go/parser"
+- "go/token"
+- "log"
+- "os"
+- "sort"
+- "strings"
+- "text/template"
+-)
+-
+-var (
+- typ = flag.String("t", "Server", "generate code for this type")
+- def = flag.String("d", "", "the file the type is defined in") // this relies on punning
+- use = flag.String("u", "", "look for uses in this package")
+- out = flag.String("o", "", "where to write the generated file")
+-)
+-
+-func main() {
+- log.SetFlags(log.Lshortfile)
+- flag.Parse()
+- if *typ == "" || *def == "" || *use == "" || *out == "" {
+- flag.PrintDefaults()
+- os.Exit(1)
+- }
+- // read the type definition and see what methods we're looking for
+- doTypes()
+-
+- // parse the package and see which methods are defined
+- doUses()
+-
+- output()
+-}
+-
+-// replace "\\\n" with nothing before using
+-var tmpl = `// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-// code generated by helper. DO NOT EDIT.
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-{{range $key, $v := .Stuff}}
+-func (s *{{$.Type}}) {{$v.Name}}({{.Param}}) {{.Result}} {
+- {{if ne .Found ""}} return s.{{.Internal}}({{.Invoke}})\
+- {{else}}return {{if lt 1 (len .Results)}}nil, {{end}}notImplemented("{{.Name}}"){{end}}
+-}
+-{{end}}
+-`
+-
+-func output() {
+- // put in empty param names as needed
+- for _, t := range types {
+- if t.paramnames == nil {
+- t.paramnames = make([]string, len(t.paramtypes))
+- }
+- for i, p := range t.paramtypes {
+- cm := ""
+- if i > 0 {
+- cm = ", "
+- }
+- t.Param += fmt.Sprintf("%s%s %s", cm, t.paramnames[i], p)
+- this := t.paramnames[i]
+- if this == "_" {
+- this = "nil"
+- }
+- t.Invoke += fmt.Sprintf("%s%s", cm, this)
+- }
+- if len(t.Results) > 1 {
+- t.Result = "("
+- }
+- for i, r := range t.Results {
+- cm := ""
+- if i > 0 {
+- cm = ", "
+- }
+- t.Result += fmt.Sprintf("%s%s", cm, r)
+- }
+- if len(t.Results) > 1 {
+- t.Result += ")"
+- }
+- }
+-
+- fd, err := os.Create(*out)
+- if err != nil {
+- log.Fatal(err)
+- }
+- t, err := template.New("foo").Parse(tmpl)
+- if err != nil {
+- log.Fatal(err)
+- }
+- type par struct {
+- Type string
+- Stuff []*Function
+- }
+- p := par{*typ, types}
+- if false { // debugging the template
+- t.Execute(os.Stderr, &p)
+- }
+- buf := bytes.NewBuffer(nil)
+- err = t.Execute(buf, &p)
+- if err != nil {
+- log.Fatal(err)
+- }
+- ans, err := format.Source(bytes.Replace(buf.Bytes(), []byte("\\\n"), []byte{}, -1))
+- if err != nil {
+- log.Fatal(err)
+- }
+- fd.Write(ans)
+-}
+-
+-func doUses() {
+- fset := token.NewFileSet()
+- pkgs, err := parser.ParseDir(fset, *use, nil, 0)
+- if err != nil {
+- log.Fatalf("%q:%v", *use, err)
+- }
+- pkg := pkgs["lsp"] // CHECK
+- files := pkg.Files
+- for fname, f := range files {
+- for _, d := range f.Decls {
+- fd, ok := d.(*ast.FuncDecl)
+- if !ok {
+- continue
+- }
+- nm := fd.Name.String()
+- if ast.IsExported(nm) {
+- // we're looking for things like didChange
+- continue
+- }
+- if fx, ok := byname[nm]; ok {
+- if fx.Found != "" {
+- log.Fatalf("found %s in %s and %s", fx.Internal, fx.Found, fname)
+- }
+- fx.Found = fname
+- // and the Paramnames
+- ft := fd.Type
+- for _, f := range ft.Params.List {
+- nm := ""
+- if len(f.Names) > 0 {
+- nm = f.Names[0].String()
+- if nm == "_" {
+- nm = "_gen"
+- }
+- }
+- fx.paramnames = append(fx.paramnames, nm)
+- }
+- }
+- }
+- }
+- if false {
+- for i, f := range types {
+- log.Printf("%d %s %s", i, f.Internal, f.Found)
+- }
+- }
+-}
+-
+-type Function struct {
+- Name string
+- Internal string // first letter lower case
+- paramtypes []string
+- paramnames []string
+- Results []string
+- Param string
+- Result string // do it in code, easier than in a template
+- Invoke string
+- Found string // file it was found in
+-}
+-
+-var types []*Function
+-var byname = map[string]*Function{} // internal names
+-
+-func doTypes() {
+- fset := token.NewFileSet()
+- f, err := parser.ParseFile(fset, *def, nil, 0)
+- if err != nil {
+- log.Fatal(err)
+- }
+- fd, err := os.Create("/tmp/ast")
+- if err != nil {
+- log.Fatal(err)
+- }
+- ast.Fprint(fd, fset, f, ast.NotNilFilter)
+- ast.Inspect(f, inter)
+- sort.Slice(types, func(i, j int) bool { return types[i].Name < types[j].Name })
+- if false {
+- for i, f := range types {
+- log.Printf("%d %s(%v) %v", i, f.Name, f.paramtypes, f.Results)
+- }
+- }
+-}
+-
+-func inter(n ast.Node) bool {
+- x, ok := n.(*ast.TypeSpec)
+- if !ok || x.Name.Name != *typ {
+- return true
+- }
+- m := x.Type.(*ast.InterfaceType).Methods.List
+- for _, fld := range m {
+- fn := fld.Type.(*ast.FuncType)
+- p := fn.Params.List
+- r := fn.Results.List
+- fx := &Function{
+- Name: fld.Names[0].String(),
+- }
+- fx.Internal = strings.ToLower(fx.Name[:1]) + fx.Name[1:]
+- for _, f := range p {
+- fx.paramtypes = append(fx.paramtypes, whatis(f.Type))
+- }
+- for _, f := range r {
+- fx.Results = append(fx.Results, whatis(f.Type))
+- }
+- types = append(types, fx)
+- byname[fx.Internal] = fx
+- }
+- return false
+-}
+-
+-func whatis(x ast.Expr) string {
+- switch n := x.(type) {
+- case *ast.SelectorExpr:
+- return whatis(n.X) + "." + n.Sel.String()
+- case *ast.StarExpr:
+- return "*" + whatis(n.X)
+- case *ast.Ident:
+- if ast.IsExported(n.Name) {
+- // these are from package protocol
+- return "protocol." + n.Name
+- }
+- return n.Name
+- case *ast.ArrayType:
+- return "[]" + whatis(n.Elt)
+- case *ast.InterfaceType:
+- return "interface{}"
+- default:
+- log.Fatalf("Fatal %T", x)
+- return fmt.Sprintf("%T", x)
+- }
+-}
+diff -urN a/gopls/internal/lsp/helper/README.md b/gopls/internal/lsp/helper/README.md
+--- a/gopls/internal/lsp/helper/README.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/helper/README.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,35 +0,0 @@
+-# Generate server_gen.go
+-
+-`helper` generates the file `../server_gen.go` (in package
+-`internal/lsp`) which contains stub declarations of server methods.
+-
+-To invoke it, run `go generate` in the `gopls/internal/lsp` directory.
+-
+-It is derived from `gopls/internal/lsp/protocol/tsserver.go`, which
+-itself is generated from the protocol downloaded from VSCode, so be
+-sure to run `go generate` in the protocol first. Or run `go generate
+-./...` twice in the gopls directory.
+-
+-It decides what stubs are needed and their signatures
+-by looking at the `Server` interface (`-t` flag). These all look somewhat like
+-`Resolve(context.Context, *CompletionItem) (*CompletionItem, error)`.
+-
+-It then parses the `lsp` directory (`-u` flag) to see if there is a corresponding
+-implementation function (which in this case would be named `resolve`). If so
+-it discovers the parameter names needed, and generates (in `server_gen.go`) code
+-like
+-
+-``` go
+-func (s *Server) resolve(ctx context.Context, params *protocol.CompletionItem) (*protocol.CompletionItem, error) {
+- return s.resolve(ctx, params)
+-}
+-```
+-
+-If `resolve` is not defined (and it is not), then the body of the generated function is
+-
+-```go
+- return nil, notImplemented("resolve")
+-```
+-
+-So to add a capability currently not implemented, just define it somewhere in `lsp`.
+-In this case, just define `func (s *Server) resolve(...)` and re-generate `server_gen.go`.
+diff -urN a/gopls/internal/lsp/highlight.go b/gopls/internal/lsp/highlight.go
+--- a/gopls/internal/lsp/highlight.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/highlight.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,45 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/template"
+-)
+-
+-func (s *Server) documentHighlight(ctx context.Context, params *protocol.DocumentHighlightParams) ([]protocol.DocumentHighlight, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.Go)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+-
+- if snapshot.View().FileKind(fh) == source.Tmpl {
+- return template.Highlight(ctx, snapshot, fh, params.Position)
+- }
+-
+- rngs, err := source.Highlight(ctx, snapshot, fh, params.Position)
+- if err != nil {
+- event.Error(ctx, "no highlight", err, tag.URI.Of(params.TextDocument.URI))
+- }
+- return toProtocolHighlight(rngs), nil
+-}
+-
+-func toProtocolHighlight(rngs []protocol.Range) []protocol.DocumentHighlight {
+- result := make([]protocol.DocumentHighlight, 0, len(rngs))
+- kind := protocol.Text
+- for _, rng := range rngs {
+- result = append(result, protocol.DocumentHighlight{
+- Kind: kind,
+- Range: rng,
+- })
+- }
+- return result
+-}
+diff -urN a/gopls/internal/lsp/hover.go b/gopls/internal/lsp/hover.go
+--- a/gopls/internal/lsp/hover.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/hover.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,34 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/mod"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/template"
+- "golang.org/x/tools/gopls/internal/lsp/work"
+-)
+-
+-func (s *Server) hover(ctx context.Context, params *protocol.HoverParams) (*protocol.Hover, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.UnknownKind)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+- switch snapshot.View().FileKind(fh) {
+- case source.Mod:
+- return mod.Hover(ctx, snapshot, fh, params.Position)
+- case source.Go:
+- return source.Hover(ctx, snapshot, fh, params.Position)
+- case source.Tmpl:
+- return template.Hover(ctx, snapshot, fh, params.Position)
+- case source.Work:
+- return work.Hover(ctx, snapshot, fh, params.Position)
+- }
+- return nil, nil
+-}
+diff -urN a/gopls/internal/lsp/implementation.go b/gopls/internal/lsp/implementation.go
+--- a/gopls/internal/lsp/implementation.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/implementation.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,21 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-func (s *Server) implementation(ctx context.Context, params *protocol.ImplementationParams) ([]protocol.Location, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.Go)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+- return source.Implementation(ctx, snapshot, fh, params.Position)
+-}
+diff -urN a/gopls/internal/lsp/inlay_hint.go b/gopls/internal/lsp/inlay_hint.go
+--- a/gopls/internal/lsp/inlay_hint.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/inlay_hint.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,21 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-func (s *Server) inlayHint(ctx context.Context, params *protocol.InlayHintParams) ([]protocol.InlayHint, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.Go)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+- return source.InlayHint(ctx, snapshot, fh, params.Range)
+-}
+diff -urN a/gopls/internal/lsp/link.go b/gopls/internal/lsp/link.go
+--- a/gopls/internal/lsp/link.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/link.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,278 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "bytes"
+- "context"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "net/url"
+- "regexp"
+- "strings"
+- "sync"
+-
+- "golang.org/x/mod/modfile"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+-)
+-
+-func (s *Server) documentLink(ctx context.Context, params *protocol.DocumentLinkParams) (links []protocol.DocumentLink, err error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.UnknownKind)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+- switch snapshot.View().FileKind(fh) {
+- case source.Mod:
+- links, err = modLinks(ctx, snapshot, fh)
+- case source.Go:
+- links, err = goLinks(ctx, snapshot, fh)
+- }
+- // Don't return errors for document links.
+- if err != nil {
+- event.Error(ctx, "failed to compute document links", err, tag.URI.Of(fh.URI()))
+- return nil, nil
+- }
+- return links, nil
+-}
+-
+-func modLinks(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle) ([]protocol.DocumentLink, error) {
+- pm, err := snapshot.ParseMod(ctx, fh)
+- if err != nil {
+- return nil, err
+- }
+-
+- var links []protocol.DocumentLink
+- for _, req := range pm.File.Require {
+- if req.Syntax == nil {
+- continue
+- }
+- // See golang/go#36998: don't link to modules matching GOPRIVATE.
+- if snapshot.View().IsGoPrivatePath(req.Mod.Path) {
+- continue
+- }
+- dep := []byte(req.Mod.Path)
+- start, end := req.Syntax.Start.Byte, req.Syntax.End.Byte
+- i := bytes.Index(pm.Mapper.Content[start:end], dep)
+- if i == -1 {
+- continue
+- }
+- // Shift the start position to the location of the
+- // dependency within the require statement.
+- target := source.BuildLink(snapshot.View().Options().LinkTarget, "mod/"+req.Mod.String(), "")
+- l, err := toProtocolLink(pm.Mapper, target, start+i, start+i+len(dep))
+- if err != nil {
+- return nil, err
+- }
+- links = append(links, l)
+- }
+- // TODO(ridersofrohan): handle links for replace and exclude directives.
+- if syntax := pm.File.Syntax; syntax == nil {
+- return links, nil
+- }
+-
+- // Get all the links that are contained in the comments of the file.
+- urlRegexp := snapshot.View().Options().URLRegexp
+- for _, expr := range pm.File.Syntax.Stmt {
+- comments := expr.Comment()
+- if comments == nil {
+- continue
+- }
+- for _, section := range [][]modfile.Comment{comments.Before, comments.Suffix, comments.After} {
+- for _, comment := range section {
+- l, err := findLinksInString(urlRegexp, comment.Token, comment.Start.Byte, pm.Mapper)
+- if err != nil {
+- return nil, err
+- }
+- links = append(links, l...)
+- }
+- }
+- }
+- return links, nil
+-}
+-
+-// goLinks returns the set of hyperlink annotations for the specified Go file.
+-func goLinks(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle) ([]protocol.DocumentLink, error) {
+- view := snapshot.View()
+-
+- pgf, err := snapshot.ParseGo(ctx, fh, source.ParseFull)
+- if err != nil {
+- return nil, err
+- }
+-
+- var links []protocol.DocumentLink
+-
+- // Create links for import specs.
+- if view.Options().ImportShortcut.ShowLinks() {
+-
+- // If links are to pkg.go.dev, append module version suffixes.
+- // This requires the import map from the package metadata. Ignore errors.
+- var depsByImpPath map[source.ImportPath]source.PackageID
+- if strings.ToLower(view.Options().LinkTarget) == "pkg.go.dev" {
+- if metas, _ := snapshot.MetadataForFile(ctx, fh.URI()); len(metas) > 0 {
+- depsByImpPath = metas[0].DepsByImpPath // 0 => narrowest package
+- }
+- }
+-
+- for _, imp := range pgf.File.Imports {
+- importPath := source.UnquoteImportPath(imp)
+- if importPath == "" {
+- continue // bad import
+- }
+- // See golang/go#36998: don't link to modules matching GOPRIVATE.
+- if view.IsGoPrivatePath(string(importPath)) {
+- continue
+- }
+-
+- urlPath := string(importPath)
+-
+- // For pkg.go.dev, append module version suffix to package import path.
+- if m := snapshot.Metadata(depsByImpPath[importPath]); m != nil && m.Module != nil && m.Module.Path != "" && m.Module.Version != "" {
+- urlPath = strings.Replace(urlPath, m.Module.Path, m.Module.Path+"@"+m.Module.Version, 1)
+- }
+-
+- start, end, err := safetoken.Offsets(pgf.Tok, imp.Path.Pos(), imp.Path.End())
+- if err != nil {
+- return nil, err
+- }
+- targetURL := source.BuildLink(view.Options().LinkTarget, urlPath, "")
+- // Account for the quotation marks in the positions.
+- l, err := toProtocolLink(pgf.Mapper, targetURL, start+len(`"`), end-len(`"`))
+- if err != nil {
+- return nil, err
+- }
+- links = append(links, l)
+- }
+- }
+-
+- urlRegexp := snapshot.View().Options().URLRegexp
+-
+- // Gather links found in string literals.
+- var str []*ast.BasicLit
+- ast.Inspect(pgf.File, func(node ast.Node) bool {
+- switch n := node.(type) {
+- case *ast.ImportSpec:
+- return false // don't process import strings again
+- case *ast.BasicLit:
+- if n.Kind == token.STRING {
+- str = append(str, n)
+- }
+- }
+- return true
+- })
+- for _, s := range str {
+- strOffset, err := safetoken.Offset(pgf.Tok, s.Pos())
+- if err != nil {
+- return nil, err
+- }
+- l, err := findLinksInString(urlRegexp, s.Value, strOffset, pgf.Mapper)
+- if err != nil {
+- return nil, err
+- }
+- links = append(links, l...)
+- }
+-
+- // Gather links found in comments.
+- for _, commentGroup := range pgf.File.Comments {
+- for _, comment := range commentGroup.List {
+- commentOffset, err := safetoken.Offset(pgf.Tok, comment.Pos())
+- if err != nil {
+- return nil, err
+- }
+- l, err := findLinksInString(urlRegexp, comment.Text, commentOffset, pgf.Mapper)
+- if err != nil {
+- return nil, err
+- }
+- links = append(links, l...)
+- }
+- }
+-
+- return links, nil
+-}
+-
+-// acceptedSchemes controls the schemes that URLs must have to be shown to the
+-// user. Other schemes can't be opened by LSP clients, so linkifying them is
+-// distracting. See golang/go#43990.
+-var acceptedSchemes = map[string]bool{
+- "http": true,
+- "https": true,
+-}
+-
+-// urlRegexp is the user-supplied regular expression to match URL.
+-// srcOffset is the start offset of 'src' within m's file.
+-func findLinksInString(urlRegexp *regexp.Regexp, src string, srcOffset int, m *protocol.Mapper) ([]protocol.DocumentLink, error) {
+- var links []protocol.DocumentLink
+- for _, index := range urlRegexp.FindAllIndex([]byte(src), -1) {
+- start, end := index[0], index[1]
+- link := src[start:end]
+- linkURL, err := url.Parse(link)
+- // Fallback: Linkify IP addresses as suggested in golang/go#18824.
+- if err != nil {
+- linkURL, err = url.Parse("//" + link)
+- // Not all potential links will be valid, so don't return this error.
+- if err != nil {
+- continue
+- }
+- }
+- // If the URL has no scheme, use https.
+- if linkURL.Scheme == "" {
+- linkURL.Scheme = "https"
+- }
+- if !acceptedSchemes[linkURL.Scheme] {
+- continue
+- }
+-
+- l, err := toProtocolLink(m, linkURL.String(), srcOffset+start, srcOffset+end)
+- if err != nil {
+- return nil, err
+- }
+- links = append(links, l)
+- }
+- // Handle golang/go#1234-style links.
+- r := getIssueRegexp()
+- for _, index := range r.FindAllIndex([]byte(src), -1) {
+- start, end := index[0], index[1]
+- matches := r.FindStringSubmatch(src)
+- if len(matches) < 4 {
+- continue
+- }
+- org, repo, number := matches[1], matches[2], matches[3]
+- targetURL := fmt.Sprintf("https://github.com/%s/%s/issues/%s", org, repo, number)
+- l, err := toProtocolLink(m, targetURL, srcOffset+start, srcOffset+end)
+- if err != nil {
+- return nil, err
+- }
+- links = append(links, l)
+- }
+- return links, nil
+-}
+-
+-func getIssueRegexp() *regexp.Regexp {
+- once.Do(func() {
+- issueRegexp = regexp.MustCompile(`(\w+)/([\w-]+)#([0-9]+)`)
+- })
+- return issueRegexp
+-}
+-
+-var (
+- once sync.Once
+- issueRegexp *regexp.Regexp
+-)
+-
+-func toProtocolLink(m *protocol.Mapper, targetURL string, start, end int) (protocol.DocumentLink, error) {
+- rng, err := m.OffsetRange(start, end)
+- if err != nil {
+- return protocol.DocumentLink{}, err
+- }
+- return protocol.DocumentLink{
+- Range: rng,
+- Target: targetURL,
+- }, nil
+-}
+diff -urN a/gopls/internal/lsp/lsprpc/autostart_default.go b/gopls/internal/lsp/lsprpc/autostart_default.go
+--- a/gopls/internal/lsp/lsprpc/autostart_default.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/lsprpc/autostart_default.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,39 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsprpc
+-
+-import (
+- "fmt"
+-
+- exec "golang.org/x/sys/execabs"
+-)
+-
+-var (
+- daemonize = func(*exec.Cmd) {}
+- autoNetworkAddress = autoNetworkAddressDefault
+- verifyRemoteOwnership = verifyRemoteOwnershipDefault
+-)
+-
+-func runRemote(cmd *exec.Cmd) error {
+- daemonize(cmd)
+- if err := cmd.Start(); err != nil {
+- return fmt.Errorf("starting remote gopls: %w", err)
+- }
+- return nil
+-}
+-
+-// autoNetworkAddressDefault returns the default network and address for the
+-// automatically-started gopls remote. See autostart_posix.go for more
+-// information.
+-func autoNetworkAddressDefault(goplsPath, id string) (network string, address string) {
+- if id != "" {
+- panic("identified remotes are not supported on windows")
+- }
+- return "tcp", "localhost:37374"
+-}
+-
+-func verifyRemoteOwnershipDefault(network, address string) (bool, error) {
+- return true, nil
+-}
+diff -urN a/gopls/internal/lsp/lsprpc/autostart_posix.go b/gopls/internal/lsp/lsprpc/autostart_posix.go
+--- a/gopls/internal/lsp/lsprpc/autostart_posix.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/lsprpc/autostart_posix.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,97 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
+-// +build darwin dragonfly freebsd linux netbsd openbsd solaris
+-
+-package lsprpc
+-
+-import (
+- "crypto/sha256"
+- "errors"
+- "fmt"
+- "log"
+- "os"
+- "os/user"
+- "path/filepath"
+- "strconv"
+- "syscall"
+-
+- exec "golang.org/x/sys/execabs"
+-)
+-
+-func init() {
+- daemonize = daemonizePosix
+- autoNetworkAddress = autoNetworkAddressPosix
+- verifyRemoteOwnership = verifyRemoteOwnershipPosix
+-}
+-
+-func daemonizePosix(cmd *exec.Cmd) {
+- cmd.SysProcAttr = &syscall.SysProcAttr{
+- Setsid: true,
+- }
+-}
+-
+-// autoNetworkAddressPosix resolves an id on the 'auto' pseduo-network to a
+-// real network and address. On unix, this uses unix domain sockets.
+-func autoNetworkAddressPosix(goplsPath, id string) (network string, address string) {
+- // Especially when doing local development or testing, it's important that
+- // the remote gopls instance we connect to is running the same binary as our
+- // forwarder. So we encode a short hash of the binary path into the daemon
+- // socket name. If possible, we also include the buildid in this hash, to
+- // account for long-running processes where the binary has been subsequently
+- // rebuilt.
+- h := sha256.New()
+- cmd := exec.Command("go", "tool", "buildid", goplsPath)
+- cmd.Stdout = h
+- var pathHash []byte
+- if err := cmd.Run(); err == nil {
+- pathHash = h.Sum(nil)
+- } else {
+- log.Printf("error getting current buildid: %v", err)
+- sum := sha256.Sum256([]byte(goplsPath))
+- pathHash = sum[:]
+- }
+- shortHash := fmt.Sprintf("%x", pathHash)[:6]
+- user := os.Getenv("USER")
+- if user == "" {
+- user = "shared"
+- }
+- basename := filepath.Base(goplsPath)
+- idComponent := ""
+- if id != "" {
+- idComponent = "-" + id
+- }
+- runtimeDir := os.TempDir()
+- if xdg := os.Getenv("XDG_RUNTIME_DIR"); xdg != "" {
+- runtimeDir = xdg
+- }
+- return "unix", filepath.Join(runtimeDir, fmt.Sprintf("%s-%s-daemon.%s%s", basename, shortHash, user, idComponent))
+-}
+-
+-func verifyRemoteOwnershipPosix(network, address string) (bool, error) {
+- if network != "unix" {
+- return true, nil
+- }
+- fi, err := os.Stat(address)
+- if err != nil {
+- if os.IsNotExist(err) {
+- return true, nil
+- }
+- return false, fmt.Errorf("checking socket owner: %w", err)
+- }
+- stat, ok := fi.Sys().(*syscall.Stat_t)
+- if !ok {
+- return false, errors.New("fi.Sys() is not a Stat_t")
+- }
+- user, err := user.Current()
+- if err != nil {
+- return false, fmt.Errorf("checking current user: %w", err)
+- }
+- uid, err := strconv.ParseUint(user.Uid, 10, 32)
+- if err != nil {
+- return false, fmt.Errorf("parsing current UID: %w", err)
+- }
+- return stat.Uid == uint32(uid), nil
+-}
+diff -urN a/gopls/internal/lsp/lsprpc/binder.go b/gopls/internal/lsp/lsprpc/binder.go
+--- a/gopls/internal/lsp/lsprpc/binder.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/lsprpc/binder.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,148 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsprpc
+-
+-import (
+- "context"
+- "encoding/json"
+- "fmt"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/event"
+- jsonrpc2_v2 "golang.org/x/tools/internal/jsonrpc2_v2"
+- "golang.org/x/tools/internal/xcontext"
+-)
+-
+-// The BinderFunc type adapts a bind function to implement the jsonrpc2.Binder
+-// interface.
+-type BinderFunc func(ctx context.Context, conn *jsonrpc2_v2.Connection) jsonrpc2_v2.ConnectionOptions
+-
+-func (f BinderFunc) Bind(ctx context.Context, conn *jsonrpc2_v2.Connection) jsonrpc2_v2.ConnectionOptions {
+- return f(ctx, conn)
+-}
+-
+-// Middleware defines a transformation of jsonrpc2 Binders, that may be
+-// composed to build jsonrpc2 servers.
+-type Middleware func(jsonrpc2_v2.Binder) jsonrpc2_v2.Binder
+-
+-// A ServerFunc is used to construct an LSP server for a given client.
+-type ServerFunc func(context.Context, protocol.ClientCloser) protocol.Server
+-
+-// ServerBinder binds incoming connections to a new server.
+-type ServerBinder struct {
+- newServer ServerFunc
+-}
+-
+-func NewServerBinder(newServer ServerFunc) *ServerBinder {
+- return &ServerBinder{newServer: newServer}
+-}
+-
+-func (b *ServerBinder) Bind(ctx context.Context, conn *jsonrpc2_v2.Connection) jsonrpc2_v2.ConnectionOptions {
+- client := protocol.ClientDispatcherV2(conn)
+- server := b.newServer(ctx, client)
+- serverHandler := protocol.ServerHandlerV2(server)
+- // Wrap the server handler to inject the client into each request context, so
+- // that log events are reflected back to the client.
+- wrapped := jsonrpc2_v2.HandlerFunc(func(ctx context.Context, req *jsonrpc2_v2.Request) (interface{}, error) {
+- ctx = protocol.WithClient(ctx, client)
+- return serverHandler.Handle(ctx, req)
+- })
+- preempter := &canceler{
+- conn: conn,
+- }
+- return jsonrpc2_v2.ConnectionOptions{
+- Handler: wrapped,
+- Preempter: preempter,
+- }
+-}
+-
+-type canceler struct {
+- conn *jsonrpc2_v2.Connection
+-}
+-
+-func (c *canceler) Preempt(ctx context.Context, req *jsonrpc2_v2.Request) (interface{}, error) {
+- if req.Method != "$/cancelRequest" {
+- return nil, jsonrpc2_v2.ErrNotHandled
+- }
+- var params protocol.CancelParams
+- if err := json.Unmarshal(req.Params, &params); err != nil {
+- return nil, fmt.Errorf("%w: %v", jsonrpc2_v2.ErrParse, err)
+- }
+- var id jsonrpc2_v2.ID
+- switch raw := params.ID.(type) {
+- case float64:
+- id = jsonrpc2_v2.Int64ID(int64(raw))
+- case string:
+- id = jsonrpc2_v2.StringID(raw)
+- default:
+- return nil, fmt.Errorf("%w: invalid ID type %T", jsonrpc2_v2.ErrParse, params.ID)
+- }
+- c.conn.Cancel(id)
+- return nil, nil
+-}
+-
+-type ForwardBinder struct {
+- dialer jsonrpc2_v2.Dialer
+- onBind func(*jsonrpc2_v2.Connection)
+-}
+-
+-func NewForwardBinder(dialer jsonrpc2_v2.Dialer) *ForwardBinder {
+- return &ForwardBinder{
+- dialer: dialer,
+- }
+-}
+-
+-func (b *ForwardBinder) Bind(ctx context.Context, conn *jsonrpc2_v2.Connection) (opts jsonrpc2_v2.ConnectionOptions) {
+- client := protocol.ClientDispatcherV2(conn)
+- clientBinder := NewClientBinder(func(context.Context, protocol.Server) protocol.Client { return client })
+-
+- serverConn, err := jsonrpc2_v2.Dial(context.Background(), b.dialer, clientBinder)
+- if err != nil {
+- return jsonrpc2_v2.ConnectionOptions{
+- Handler: jsonrpc2_v2.HandlerFunc(func(context.Context, *jsonrpc2_v2.Request) (interface{}, error) {
+- return nil, fmt.Errorf("%w: %v", jsonrpc2_v2.ErrInternal, err)
+- }),
+- }
+- }
+-
+- if b.onBind != nil {
+- b.onBind(serverConn)
+- }
+- server := protocol.ServerDispatcherV2(serverConn)
+- preempter := &canceler{
+- conn: conn,
+- }
+- detached := xcontext.Detach(ctx)
+- go func() {
+- conn.Wait()
+- if err := serverConn.Close(); err != nil {
+- event.Log(detached, fmt.Sprintf("closing remote connection: %v", err))
+- }
+- }()
+- return jsonrpc2_v2.ConnectionOptions{
+- Handler: protocol.ServerHandlerV2(server),
+- Preempter: preempter,
+- }
+-}
+-
+-// A ClientFunc is used to construct an LSP client for a given server.
+-type ClientFunc func(context.Context, protocol.Server) protocol.Client
+-
+-// ClientBinder binds an LSP client to an incoming connection.
+-type ClientBinder struct {
+- newClient ClientFunc
+-}
+-
+-func NewClientBinder(newClient ClientFunc) *ClientBinder {
+- return &ClientBinder{newClient}
+-}
+-
+-func (b *ClientBinder) Bind(ctx context.Context, conn *jsonrpc2_v2.Connection) jsonrpc2_v2.ConnectionOptions {
+- server := protocol.ServerDispatcherV2(conn)
+- client := b.newClient(ctx, server)
+- return jsonrpc2_v2.ConnectionOptions{
+- Handler: protocol.ClientHandlerV2(client),
+- }
+-}
+diff -urN a/gopls/internal/lsp/lsprpc/binder_test.go b/gopls/internal/lsp/lsprpc/binder_test.go
+--- a/gopls/internal/lsp/lsprpc/binder_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/lsprpc/binder_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,147 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsprpc_test
+-
+-import (
+- "context"
+- "regexp"
+- "strings"
+- "testing"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- jsonrpc2_v2 "golang.org/x/tools/internal/jsonrpc2_v2"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/lsprpc"
+-)
+-
+-type TestEnv struct {
+- Conns []*jsonrpc2_v2.Connection
+- Servers []*jsonrpc2_v2.Server
+-}
+-
+-func (e *TestEnv) Shutdown(t *testing.T) {
+- for _, s := range e.Servers {
+- s.Shutdown()
+- }
+- for _, c := range e.Conns {
+- if err := c.Close(); err != nil {
+- t.Error(err)
+- }
+- }
+- for _, s := range e.Servers {
+- if err := s.Wait(); err != nil {
+- t.Error(err)
+- }
+- }
+-}
+-
+-func (e *TestEnv) serve(ctx context.Context, t *testing.T, server jsonrpc2_v2.Binder) (jsonrpc2_v2.Listener, *jsonrpc2_v2.Server) {
+- l, err := jsonrpc2_v2.NetPipeListener(ctx)
+- if err != nil {
+- t.Fatal(err)
+- }
+- s := jsonrpc2_v2.NewServer(ctx, l, server)
+- e.Servers = append(e.Servers, s)
+- return l, s
+-}
+-
+-func (e *TestEnv) dial(ctx context.Context, t *testing.T, dialer jsonrpc2_v2.Dialer, client jsonrpc2_v2.Binder, forwarded bool) *jsonrpc2_v2.Connection {
+- if forwarded {
+- l, _ := e.serve(ctx, t, NewForwardBinder(dialer))
+- dialer = l.Dialer()
+- }
+- conn, err := jsonrpc2_v2.Dial(ctx, dialer, client)
+- if err != nil {
+- t.Fatal(err)
+- }
+- e.Conns = append(e.Conns, conn)
+- return conn
+-}
+-
+-func staticClientBinder(client protocol.Client) jsonrpc2_v2.Binder {
+- f := func(context.Context, protocol.Server) protocol.Client { return client }
+- return NewClientBinder(f)
+-}
+-
+-func staticServerBinder(server protocol.Server) jsonrpc2_v2.Binder {
+- f := func(ctx context.Context, client protocol.ClientCloser) protocol.Server {
+- return server
+- }
+- return NewServerBinder(f)
+-}
+-
+-func TestClientLoggingV2(t *testing.T) {
+- ctx := context.Background()
+-
+- for name, forwarded := range map[string]bool{
+- "forwarded": true,
+- "standalone": false,
+- } {
+- t.Run(name, func(t *testing.T) {
+- client := FakeClient{Logs: make(chan string, 10)}
+- env := new(TestEnv)
+- defer env.Shutdown(t)
+- l, _ := env.serve(ctx, t, staticServerBinder(PingServer{}))
+- conn := env.dial(ctx, t, l.Dialer(), staticClientBinder(client), forwarded)
+-
+- if err := protocol.ServerDispatcherV2(conn).DidOpen(ctx, &protocol.DidOpenTextDocumentParams{}); err != nil {
+- t.Errorf("DidOpen: %v", err)
+- }
+- select {
+- case got := <-client.Logs:
+- want := "ping"
+- matched, err := regexp.MatchString(want, got)
+- if err != nil {
+- t.Fatal(err)
+- }
+- if !matched {
+- t.Errorf("got log %q, want a log containing %q", got, want)
+- }
+- case <-time.After(1 * time.Second):
+- t.Error("timeout waiting for client log")
+- }
+- })
+- }
+-}
+-
+-func TestRequestCancellationV2(t *testing.T) {
+- ctx := context.Background()
+-
+- for name, forwarded := range map[string]bool{
+- "forwarded": true,
+- "standalone": false,
+- } {
+- t.Run(name, func(t *testing.T) {
+- server := WaitableServer{
+- Started: make(chan struct{}),
+- Completed: make(chan error),
+- }
+- env := new(TestEnv)
+- defer env.Shutdown(t)
+- l, _ := env.serve(ctx, t, staticServerBinder(server))
+- client := FakeClient{Logs: make(chan string, 10)}
+- conn := env.dial(ctx, t, l.Dialer(), staticClientBinder(client), forwarded)
+-
+- sd := protocol.ServerDispatcherV2(conn)
+- ctx, cancel := context.WithCancel(ctx)
+-
+- result := make(chan error)
+- go func() {
+- _, err := sd.Hover(ctx, &protocol.HoverParams{})
+- result <- err
+- }()
+- // Wait for the Hover request to start.
+- <-server.Started
+- cancel()
+- if err := <-result; err == nil {
+- t.Error("nil error for cancelled Hover(), want non-nil")
+- }
+- if err := <-server.Completed; err == nil || !strings.Contains(err.Error(), "cancelled hover") {
+- t.Errorf("Hover(): unexpected server-side error %v", err)
+- }
+- })
+- }
+-}
+diff -urN a/gopls/internal/lsp/lsprpc/commandinterceptor.go b/gopls/internal/lsp/lsprpc/commandinterceptor.go
+--- a/gopls/internal/lsp/lsprpc/commandinterceptor.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/lsprpc/commandinterceptor.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,44 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsprpc
+-
+-import (
+- "context"
+- "encoding/json"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- jsonrpc2_v2 "golang.org/x/tools/internal/jsonrpc2_v2"
+-)
+-
+-// HandlerMiddleware is a middleware that only modifies the jsonrpc2 handler.
+-type HandlerMiddleware func(jsonrpc2_v2.Handler) jsonrpc2_v2.Handler
+-
+-// BindHandler transforms a HandlerMiddleware into a Middleware.
+-func BindHandler(hmw HandlerMiddleware) Middleware {
+- return Middleware(func(binder jsonrpc2_v2.Binder) jsonrpc2_v2.Binder {
+- return BinderFunc(func(ctx context.Context, conn *jsonrpc2_v2.Connection) jsonrpc2_v2.ConnectionOptions {
+- opts := binder.Bind(ctx, conn)
+- opts.Handler = hmw(opts.Handler)
+- return opts
+- })
+- })
+-}
+-
+-func CommandInterceptor(command string, run func(*protocol.ExecuteCommandParams) (interface{}, error)) Middleware {
+- return BindHandler(func(delegate jsonrpc2_v2.Handler) jsonrpc2_v2.Handler {
+- return jsonrpc2_v2.HandlerFunc(func(ctx context.Context, req *jsonrpc2_v2.Request) (interface{}, error) {
+- if req.Method == "workspace/executeCommand" {
+- var params protocol.ExecuteCommandParams
+- if err := json.Unmarshal(req.Params, &params); err == nil {
+- if params.Command == command {
+- return run(&params)
+- }
+- }
+- }
+-
+- return delegate.Handle(ctx, req)
+- })
+- })
+-}
+diff -urN a/gopls/internal/lsp/lsprpc/commandinterceptor_test.go b/gopls/internal/lsp/lsprpc/commandinterceptor_test.go
+--- a/gopls/internal/lsp/lsprpc/commandinterceptor_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/lsprpc/commandinterceptor_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,42 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsprpc_test
+-
+-import (
+- "context"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/lsprpc"
+-)
+-
+-func TestCommandInterceptor(t *testing.T) {
+- const command = "foo"
+- caught := false
+- intercept := func(_ *protocol.ExecuteCommandParams) (interface{}, error) {
+- caught = true
+- return map[string]interface{}{}, nil
+- }
+-
+- ctx := context.Background()
+- env := new(TestEnv)
+- defer env.Shutdown(t)
+- mw := CommandInterceptor(command, intercept)
+- l, _ := env.serve(ctx, t, mw(noopBinder))
+- conn := env.dial(ctx, t, l.Dialer(), noopBinder, false)
+-
+- params := &protocol.ExecuteCommandParams{
+- Command: command,
+- }
+- var res interface{}
+- err := conn.Call(ctx, "workspace/executeCommand", params).Await(ctx, &res)
+- if err != nil {
+- t.Fatal(err)
+- }
+- if !caught {
+- t.Errorf("workspace/executeCommand was not intercepted")
+- }
+-}
+diff -urN a/gopls/internal/lsp/lsprpc/dialer.go b/gopls/internal/lsp/lsprpc/dialer.go
+--- a/gopls/internal/lsp/lsprpc/dialer.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/lsprpc/dialer.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,114 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsprpc
+-
+-import (
+- "context"
+- "fmt"
+- "io"
+- "net"
+- "os"
+- "time"
+-
+- exec "golang.org/x/sys/execabs"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-// AutoNetwork is the pseudo network type used to signal that gopls should use
+-// automatic discovery to resolve a remote address.
+-const AutoNetwork = "auto"
+-
+-// An AutoDialer is a jsonrpc2 dialer that understands the 'auto' network.
+-type AutoDialer struct {
+- network, addr string // the 'real' network and address
+- isAuto bool // whether the server is on the 'auto' network
+-
+- executable string
+- argFunc func(network, addr string) []string
+-}
+-
+-func NewAutoDialer(rawAddr string, argFunc func(network, addr string) []string) (*AutoDialer, error) {
+- d := AutoDialer{
+- argFunc: argFunc,
+- }
+- d.network, d.addr = ParseAddr(rawAddr)
+- if d.network == AutoNetwork {
+- d.isAuto = true
+- bin, err := os.Executable()
+- if err != nil {
+- return nil, fmt.Errorf("getting executable: %w", err)
+- }
+- d.executable = bin
+- d.network, d.addr = autoNetworkAddress(bin, d.addr)
+- }
+- return &d, nil
+-}
+-
+-// Dial implements the jsonrpc2.Dialer interface.
+-func (d *AutoDialer) Dial(ctx context.Context) (io.ReadWriteCloser, error) {
+- conn, err := d.dialNet(ctx)
+- return conn, err
+-}
+-
+-// TODO(rFindley): remove this once we no longer need to integrate with v1 of
+-// the jsonrpc2 package.
+-func (d *AutoDialer) dialNet(ctx context.Context) (net.Conn, error) {
+- // Attempt to verify that we own the remote. This is imperfect, but if we can
+- // determine that the remote is owned by a different user, we should fail.
+- ok, err := verifyRemoteOwnership(d.network, d.addr)
+- if err != nil {
+- // If the ownership check itself failed, we fail open but log an error to
+- // the user.
+- event.Error(ctx, "unable to check daemon socket owner, failing open", err)
+- } else if !ok {
+- // We successfully checked that the socket is not owned by us, we fail
+- // closed.
+- return nil, fmt.Errorf("socket %q is owned by a different user", d.addr)
+- }
+- const dialTimeout = 1 * time.Second
+- // Try dialing our remote once, in case it is already running.
+- netConn, err := net.DialTimeout(d.network, d.addr, dialTimeout)
+- if err == nil {
+- return netConn, nil
+- }
+- if d.isAuto && d.argFunc != nil {
+- if d.network == "unix" {
+- // Sometimes the socketfile isn't properly cleaned up when the server
+- // shuts down. Since we have already tried and failed to dial this
+- // address, it should *usually* be safe to remove the socket before
+- // binding to the address.
+- // TODO(rfindley): there is probably a race here if multiple server
+- // instances are simultaneously starting up.
+- if _, err := os.Stat(d.addr); err == nil {
+- if err := os.Remove(d.addr); err != nil {
+- return nil, fmt.Errorf("removing remote socket file: %w", err)
+- }
+- }
+- }
+- args := d.argFunc(d.network, d.addr)
+- cmd := exec.Command(d.executable, args...)
+- if err := runRemote(cmd); err != nil {
+- return nil, err
+- }
+- }
+-
+- const retries = 5
+- // It can take some time for the newly started server to bind to our address,
+- // so we retry for a bit.
+- for retry := 0; retry < retries; retry++ {
+- startDial := time.Now()
+- netConn, err = net.DialTimeout(d.network, d.addr, dialTimeout)
+- if err == nil {
+- return netConn, nil
+- }
+- event.Log(ctx, fmt.Sprintf("failed attempt #%d to connect to remote: %v\n", retry+2, err))
+- // In case our failure was a fast-failure, ensure we wait at least
+- // f.dialTimeout before trying again.
+- if retry != retries-1 {
+- time.Sleep(dialTimeout - time.Since(startDial))
+- }
+- }
+- return nil, fmt.Errorf("dialing remote: %w", err)
+-}
+diff -urN a/gopls/internal/lsp/lsprpc/goenv.go b/gopls/internal/lsp/lsprpc/goenv.go
+--- a/gopls/internal/lsp/lsprpc/goenv.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/lsprpc/goenv.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,96 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsprpc
+-
+-import (
+- "context"
+- "encoding/json"
+- "fmt"
+- "os"
+-
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/gocommand"
+- jsonrpc2_v2 "golang.org/x/tools/internal/jsonrpc2_v2"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-func GoEnvMiddleware() (Middleware, error) {
+- return BindHandler(func(delegate jsonrpc2_v2.Handler) jsonrpc2_v2.Handler {
+- return jsonrpc2_v2.HandlerFunc(func(ctx context.Context, req *jsonrpc2_v2.Request) (interface{}, error) {
+- if req.Method == "initialize" {
+- if err := addGoEnvToInitializeRequestV2(ctx, req); err != nil {
+- event.Error(ctx, "adding go env to initialize", err)
+- }
+- }
+- return delegate.Handle(ctx, req)
+- })
+- }), nil
+-}
+-
+-func addGoEnvToInitializeRequestV2(ctx context.Context, req *jsonrpc2_v2.Request) error {
+- var params protocol.ParamInitialize
+- if err := json.Unmarshal(req.Params, &params); err != nil {
+- return err
+- }
+- var opts map[string]interface{}
+- switch v := params.InitializationOptions.(type) {
+- case nil:
+- opts = make(map[string]interface{})
+- case map[string]interface{}:
+- opts = v
+- default:
+- return fmt.Errorf("unexpected type for InitializationOptions: %T", v)
+- }
+- envOpt, ok := opts["env"]
+- if !ok {
+- envOpt = make(map[string]interface{})
+- }
+- env, ok := envOpt.(map[string]interface{})
+- if !ok {
+- return fmt.Errorf("env option is %T, expected a map", envOpt)
+- }
+- goenv, err := getGoEnv(ctx, env)
+- if err != nil {
+- return err
+- }
+- // We don't want to propagate GOWORK unless explicitly set since that could mess with
+- // path inference during cmd/go invocations, see golang/go#51825.
+- _, goworkSet := os.LookupEnv("GOWORK")
+- for govar, value := range goenv {
+- if govar == "GOWORK" && !goworkSet {
+- continue
+- }
+- env[govar] = value
+- }
+- opts["env"] = env
+- params.InitializationOptions = opts
+- raw, err := json.Marshal(params)
+- if err != nil {
+- return fmt.Errorf("marshaling updated options: %v", err)
+- }
+- req.Params = json.RawMessage(raw)
+- return nil
+-}
+-
+-func getGoEnv(ctx context.Context, env map[string]interface{}) (map[string]string, error) {
+- var runEnv []string
+- for k, v := range env {
+- runEnv = append(runEnv, fmt.Sprintf("%s=%s", k, v))
+- }
+- runner := gocommand.Runner{}
+- output, err := runner.Run(ctx, gocommand.Invocation{
+- Verb: "env",
+- Args: []string{"-json"},
+- Env: runEnv,
+- })
+- if err != nil {
+- return nil, err
+- }
+- envmap := make(map[string]string)
+- if err := json.Unmarshal(output.Bytes(), &envmap); err != nil {
+- return nil, err
+- }
+- return envmap, nil
+-}
+diff -urN a/gopls/internal/lsp/lsprpc/goenv_test.go b/gopls/internal/lsp/lsprpc/goenv_test.go
+--- a/gopls/internal/lsp/lsprpc/goenv_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/lsprpc/goenv_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,65 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsprpc_test
+-
+-import (
+- "context"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/lsprpc"
+-)
+-
+-type initServer struct {
+- protocol.Server
+-
+- params *protocol.ParamInitialize
+-}
+-
+-func (s *initServer) Initialize(ctx context.Context, params *protocol.ParamInitialize) (*protocol.InitializeResult, error) {
+- s.params = params
+- return &protocol.InitializeResult{}, nil
+-}
+-
+-func TestGoEnvMiddleware(t *testing.T) {
+- ctx := context.Background()
+-
+- server := &initServer{}
+- env := new(TestEnv)
+- defer env.Shutdown(t)
+- l, _ := env.serve(ctx, t, staticServerBinder(server))
+- mw, err := GoEnvMiddleware()
+- if err != nil {
+- t.Fatal(err)
+- }
+- binder := mw(NewForwardBinder(l.Dialer()))
+- l, _ = env.serve(ctx, t, binder)
+- conn := env.dial(ctx, t, l.Dialer(), noopBinder, true)
+- dispatch := protocol.ServerDispatcherV2(conn)
+- initParams := &protocol.ParamInitialize{}
+- initParams.InitializationOptions = map[string]interface{}{
+- "env": map[string]interface{}{
+- "GONOPROXY": "example.com",
+- },
+- }
+- if _, err := dispatch.Initialize(ctx, initParams); err != nil {
+- t.Fatal(err)
+- }
+-
+- if server.params == nil {
+- t.Fatalf("initialize params are unset")
+- }
+- envOpts := server.params.InitializationOptions.(map[string]interface{})["env"].(map[string]interface{})
+-
+- // Check for an arbitrary Go variable. It should be set.
+- if _, ok := envOpts["GOPRIVATE"]; !ok {
+- t.Errorf("Go environment variable GOPRIVATE unset in initialization options")
+- }
+- // Check that the variable present in our user config was not overwritten.
+- if got, want := envOpts["GONOPROXY"], "example.com"; got != want {
+- t.Errorf("GONOPROXY=%q, want %q", got, want)
+- }
+-}
+diff -urN a/gopls/internal/lsp/lsprpc/lsprpc.go b/gopls/internal/lsp/lsprpc/lsprpc.go
+--- a/gopls/internal/lsp/lsprpc/lsprpc.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/lsprpc/lsprpc.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,543 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package lsprpc implements a jsonrpc2.StreamServer that may be used to
+-// serve the LSP on a jsonrpc2 channel.
+-package lsprpc
+-
+-import (
+- "context"
+- "encoding/json"
+- "fmt"
+- "log"
+- "net"
+- "os"
+- "strconv"
+- "strings"
+- "sync"
+- "sync/atomic"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/lsp"
+- "golang.org/x/tools/gopls/internal/lsp/cache"
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/debug"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+- "golang.org/x/tools/internal/jsonrpc2"
+-)
+-
+-// Unique identifiers for client/server.
+-var serverIndex int64
+-
+-// The StreamServer type is a jsonrpc2.StreamServer that handles incoming
+-// streams as a new LSP session, using a shared cache.
+-type StreamServer struct {
+- cache *cache.Cache
+- // daemon controls whether or not to log new connections.
+- daemon bool
+-
+- // optionsOverrides is passed to newly created sessions.
+- optionsOverrides func(*source.Options)
+-
+- // serverForTest may be set to a test fake for testing.
+- serverForTest protocol.Server
+-}
+-
+-// NewStreamServer creates a StreamServer using the shared cache. If
+-// withTelemetry is true, each session is instrumented with telemetry that
+-// records RPC statistics.
+-func NewStreamServer(cache *cache.Cache, daemon bool, optionsFunc func(*source.Options)) *StreamServer {
+- return &StreamServer{cache: cache, daemon: daemon, optionsOverrides: optionsFunc}
+-}
+-
+-func (s *StreamServer) Binder() *ServerBinder {
+- newServer := func(ctx context.Context, client protocol.ClientCloser) protocol.Server {
+- session := cache.NewSession(ctx, s.cache, s.optionsOverrides)
+- server := s.serverForTest
+- if server == nil {
+- server = lsp.NewServer(session, client)
+- if instance := debug.GetInstance(ctx); instance != nil {
+- instance.AddService(server, session)
+- }
+- }
+- return server
+- }
+- return NewServerBinder(newServer)
+-}
+-
+-// ServeStream implements the jsonrpc2.StreamServer interface, by handling
+-// incoming streams using a new lsp server.
+-func (s *StreamServer) ServeStream(ctx context.Context, conn jsonrpc2.Conn) error {
+- client := protocol.ClientDispatcher(conn)
+- session := cache.NewSession(ctx, s.cache, s.optionsOverrides)
+- server := s.serverForTest
+- if server == nil {
+- server = lsp.NewServer(session, client)
+- if instance := debug.GetInstance(ctx); instance != nil {
+- instance.AddService(server, session)
+- }
+- }
+- // Clients may or may not send a shutdown message. Make sure the server is
+- // shut down.
+- // TODO(rFindley): this shutdown should perhaps be on a disconnected context.
+- defer func() {
+- if err := server.Shutdown(ctx); err != nil {
+- event.Error(ctx, "error shutting down", err)
+- }
+- }()
+- executable, err := os.Executable()
+- if err != nil {
+- log.Printf("error getting gopls path: %v", err)
+- executable = ""
+- }
+- ctx = protocol.WithClient(ctx, client)
+- conn.Go(ctx,
+- protocol.Handlers(
+- handshaker(session, executable, s.daemon,
+- protocol.ServerHandler(server,
+- jsonrpc2.MethodNotFound))))
+- if s.daemon {
+- log.Printf("Session %s: connected", session.ID())
+- defer log.Printf("Session %s: exited", session.ID())
+- }
+- <-conn.Done()
+- return conn.Err()
+-}
+-
+-// A Forwarder is a jsonrpc2.StreamServer that handles an LSP stream by
+-// forwarding it to a remote. This is used when the gopls process started by
+-// the editor is in the `-remote` mode, which means it finds and connects to a
+-// separate gopls daemon. In these cases, we still want the forwarder gopls to
+-// be instrumented with telemetry, and want to be able to in some cases hijack
+-// the jsonrpc2 connection with the daemon.
+-type Forwarder struct {
+- dialer *AutoDialer
+-
+- mu sync.Mutex
+- // Hold on to the server connection so that we can redo the handshake if any
+- // information changes.
+- serverConn jsonrpc2.Conn
+- serverID string
+-}
+-
+-// NewForwarder creates a new Forwarder, ready to forward connections to the
+-// remote server specified by rawAddr. If provided and rawAddr indicates an
+-// 'automatic' address (starting with 'auto;'), argFunc may be used to start a
+-// remote server for the auto-discovered address.
+-func NewForwarder(rawAddr string, argFunc func(network, address string) []string) (*Forwarder, error) {
+- dialer, err := NewAutoDialer(rawAddr, argFunc)
+- if err != nil {
+- return nil, err
+- }
+- fwd := &Forwarder{
+- dialer: dialer,
+- }
+- return fwd, nil
+-}
+-
+-// QueryServerState queries the server state of the current server.
+-func QueryServerState(ctx context.Context, addr string) (*ServerState, error) {
+- serverConn, err := dialRemote(ctx, addr)
+- if err != nil {
+- return nil, err
+- }
+- var state ServerState
+- if err := protocol.Call(ctx, serverConn, sessionsMethod, nil, &state); err != nil {
+- return nil, fmt.Errorf("querying server state: %w", err)
+- }
+- return &state, nil
+-}
+-
+-// dialRemote is used for making calls into the gopls daemon. addr should be a
+-// URL, possibly on the synthetic 'auto' network (e.g. tcp://..., unix://...,
+-// or auto://...).
+-func dialRemote(ctx context.Context, addr string) (jsonrpc2.Conn, error) {
+- network, address := ParseAddr(addr)
+- if network == AutoNetwork {
+- gp, err := os.Executable()
+- if err != nil {
+- return nil, fmt.Errorf("getting gopls path: %w", err)
+- }
+- network, address = autoNetworkAddress(gp, address)
+- }
+- netConn, err := net.DialTimeout(network, address, 5*time.Second)
+- if err != nil {
+- return nil, fmt.Errorf("dialing remote: %w", err)
+- }
+- serverConn := jsonrpc2.NewConn(jsonrpc2.NewHeaderStream(netConn))
+- serverConn.Go(ctx, jsonrpc2.MethodNotFound)
+- return serverConn, nil
+-}
+-
+-func ExecuteCommand(ctx context.Context, addr string, id string, request, result interface{}) error {
+- serverConn, err := dialRemote(ctx, addr)
+- if err != nil {
+- return err
+- }
+- args, err := command.MarshalArgs(request)
+- if err != nil {
+- return err
+- }
+- params := protocol.ExecuteCommandParams{
+- Command: id,
+- Arguments: args,
+- }
+- return protocol.Call(ctx, serverConn, "workspace/executeCommand", params, result)
+-}
+-
+-// ServeStream dials the forwarder remote and binds the remote to serve the LSP
+-// on the incoming stream.
+-func (f *Forwarder) ServeStream(ctx context.Context, clientConn jsonrpc2.Conn) error {
+- client := protocol.ClientDispatcher(clientConn)
+-
+- netConn, err := f.dialer.dialNet(ctx)
+- if err != nil {
+- return fmt.Errorf("forwarder: connecting to remote: %w", err)
+- }
+- serverConn := jsonrpc2.NewConn(jsonrpc2.NewHeaderStream(netConn))
+- server := protocol.ServerDispatcher(serverConn)
+-
+- // Forward between connections.
+- serverConn.Go(ctx,
+- protocol.Handlers(
+- protocol.ClientHandler(client,
+- jsonrpc2.MethodNotFound)))
+-
+- // Don't run the clientConn yet, so that we can complete the handshake before
+- // processing any client messages.
+-
+- // Do a handshake with the server instance to exchange debug information.
+- index := atomic.AddInt64(&serverIndex, 1)
+- f.mu.Lock()
+- f.serverConn = serverConn
+- f.serverID = strconv.FormatInt(index, 10)
+- f.mu.Unlock()
+- f.handshake(ctx)
+- clientConn.Go(ctx,
+- protocol.Handlers(
+- f.handler(
+- protocol.ServerHandler(server,
+- jsonrpc2.MethodNotFound))))
+-
+- select {
+- case <-serverConn.Done():
+- clientConn.Close()
+- case <-clientConn.Done():
+- serverConn.Close()
+- }
+-
+- err = nil
+- if serverConn.Err() != nil {
+- err = fmt.Errorf("remote disconnected: %v", serverConn.Err())
+- } else if clientConn.Err() != nil {
+- err = fmt.Errorf("client disconnected: %v", clientConn.Err())
+- }
+- event.Log(ctx, fmt.Sprintf("forwarder: exited with error: %v", err))
+- return err
+-}
+-
+-// TODO(rfindley): remove this handshaking in favor of middleware.
+-func (f *Forwarder) handshake(ctx context.Context) {
+- // This call to os.Executable is redundant, and will be eliminated by the
+- // transition to the V2 API.
+- goplsPath, err := os.Executable()
+- if err != nil {
+- event.Error(ctx, "getting executable for handshake", err)
+- goplsPath = ""
+- }
+- var (
+- hreq = handshakeRequest{
+- ServerID: f.serverID,
+- GoplsPath: goplsPath,
+- }
+- hresp handshakeResponse
+- )
+- if di := debug.GetInstance(ctx); di != nil {
+- hreq.Logfile = di.Logfile
+- hreq.DebugAddr = di.ListenedDebugAddress()
+- }
+- if err := protocol.Call(ctx, f.serverConn, handshakeMethod, hreq, &hresp); err != nil {
+- // TODO(rfindley): at some point in the future we should return an error
+- // here. Handshakes have become functional in nature.
+- event.Error(ctx, "forwarder: gopls handshake failed", err)
+- }
+- if hresp.GoplsPath != goplsPath {
+- event.Error(ctx, "", fmt.Errorf("forwarder: gopls path mismatch: forwarder is %q, remote is %q", goplsPath, hresp.GoplsPath))
+- }
+- event.Log(ctx, "New server",
+- tag.NewServer.Of(f.serverID),
+- tag.Logfile.Of(hresp.Logfile),
+- tag.DebugAddress.Of(hresp.DebugAddr),
+- tag.GoplsPath.Of(hresp.GoplsPath),
+- tag.ClientID.Of(hresp.SessionID),
+- )
+-}
+-
+-func ConnectToRemote(ctx context.Context, addr string) (net.Conn, error) {
+- dialer, err := NewAutoDialer(addr, nil)
+- if err != nil {
+- return nil, err
+- }
+- return dialer.dialNet(ctx)
+-}
+-
+-// handler intercepts messages to the daemon to enrich them with local
+-// information.
+-func (f *Forwarder) handler(handler jsonrpc2.Handler) jsonrpc2.Handler {
+- return func(ctx context.Context, reply jsonrpc2.Replier, r jsonrpc2.Request) error {
+- // Intercept certain messages to add special handling.
+- switch r.Method() {
+- case "initialize":
+- if newr, err := addGoEnvToInitializeRequest(ctx, r); err == nil {
+- r = newr
+- } else {
+- log.Printf("unable to add local env to initialize request: %v", err)
+- }
+- case "workspace/executeCommand":
+- var params protocol.ExecuteCommandParams
+- if err := json.Unmarshal(r.Params(), &params); err == nil {
+- if params.Command == command.StartDebugging.ID() {
+- var args command.DebuggingArgs
+- if err := command.UnmarshalArgs(params.Arguments, &args); err == nil {
+- reply = f.replyWithDebugAddress(ctx, reply, args)
+- } else {
+- event.Error(ctx, "unmarshaling debugging args", err)
+- }
+- }
+- } else {
+- event.Error(ctx, "intercepting executeCommand request", err)
+- }
+- }
+- // The gopls workspace environment defaults to the process environment in
+- // which gopls daemon was started. To avoid discrepancies in Go environment
+- // between the editor and daemon, inject any unset variables in `go env`
+- // into the options sent by initialize.
+- //
+- // See also golang.org/issue/37830.
+- return handler(ctx, reply, r)
+- }
+-}
+-
+-// addGoEnvToInitializeRequest builds a new initialize request in which we set
+-// any environment variables output by `go env` and not already present in the
+-// request.
+-//
+-// It returns an error if r is not an initialize request, or is otherwise
+-// malformed.
+-func addGoEnvToInitializeRequest(ctx context.Context, r jsonrpc2.Request) (jsonrpc2.Request, error) {
+- var params protocol.ParamInitialize
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return nil, err
+- }
+- var opts map[string]interface{}
+- switch v := params.InitializationOptions.(type) {
+- case nil:
+- opts = make(map[string]interface{})
+- case map[string]interface{}:
+- opts = v
+- default:
+- return nil, fmt.Errorf("unexpected type for InitializationOptions: %T", v)
+- }
+- envOpt, ok := opts["env"]
+- if !ok {
+- envOpt = make(map[string]interface{})
+- }
+- env, ok := envOpt.(map[string]interface{})
+- if !ok {
+- return nil, fmt.Errorf(`env option is %T, expected a map`, envOpt)
+- }
+- goenv, err := getGoEnv(ctx, env)
+- if err != nil {
+- return nil, err
+- }
+- // We don't want to propagate GOWORK unless explicitly set since that could mess with
+- // path inference during cmd/go invocations, see golang/go#51825.
+- _, goworkSet := os.LookupEnv("GOWORK")
+- for govar, value := range goenv {
+- if govar == "GOWORK" && !goworkSet {
+- continue
+- }
+- env[govar] = value
+- }
+- opts["env"] = env
+- params.InitializationOptions = opts
+- call, ok := r.(*jsonrpc2.Call)
+- if !ok {
+- return nil, fmt.Errorf("%T is not a *jsonrpc2.Call", r)
+- }
+- return jsonrpc2.NewCall(call.ID(), "initialize", params)
+-}
+-
+-func (f *Forwarder) replyWithDebugAddress(outerCtx context.Context, r jsonrpc2.Replier, args command.DebuggingArgs) jsonrpc2.Replier {
+- di := debug.GetInstance(outerCtx)
+- if di == nil {
+- event.Log(outerCtx, "no debug instance to start")
+- return r
+- }
+- return func(ctx context.Context, result interface{}, outerErr error) error {
+- if outerErr != nil {
+- return r(ctx, result, outerErr)
+- }
+- // Enrich the result with our own debugging information. Since we're an
+- // intermediary, the jsonrpc2 package has deserialized the result into
+- // maps, by default. Re-do the unmarshalling.
+- raw, err := json.Marshal(result)
+- if err != nil {
+- event.Error(outerCtx, "marshaling intermediate command result", err)
+- return r(ctx, result, err)
+- }
+- var modified command.DebuggingResult
+- if err := json.Unmarshal(raw, &modified); err != nil {
+- event.Error(outerCtx, "unmarshaling intermediate command result", err)
+- return r(ctx, result, err)
+- }
+- addr := args.Addr
+- if addr == "" {
+- addr = "localhost:0"
+- }
+- addr, err = di.Serve(outerCtx, addr)
+- if err != nil {
+- event.Error(outerCtx, "starting debug server", err)
+- return r(ctx, result, outerErr)
+- }
+- urls := []string{"http://" + addr}
+- modified.URLs = append(urls, modified.URLs...)
+- go f.handshake(ctx)
+- return r(ctx, modified, nil)
+- }
+-}
+-
+-// A handshakeRequest identifies a client to the LSP server.
+-type handshakeRequest struct {
+- // ServerID is the ID of the server on the client. This should usually be 0.
+- ServerID string `json:"serverID"`
+- // Logfile is the location of the clients log file.
+- Logfile string `json:"logfile"`
+- // DebugAddr is the client debug address.
+- DebugAddr string `json:"debugAddr"`
+- // GoplsPath is the path to the Gopls binary running the current client
+- // process.
+- GoplsPath string `json:"goplsPath"`
+-}
+-
+-// A handshakeResponse is returned by the LSP server to tell the LSP client
+-// information about its session.
+-type handshakeResponse struct {
+- // SessionID is the server session associated with the client.
+- SessionID string `json:"sessionID"`
+- // Logfile is the location of the server logs.
+- Logfile string `json:"logfile"`
+- // DebugAddr is the server debug address.
+- DebugAddr string `json:"debugAddr"`
+- // GoplsPath is the path to the Gopls binary running the current server
+- // process.
+- GoplsPath string `json:"goplsPath"`
+-}
+-
+-// ClientSession identifies a current client LSP session on the server. Note
+-// that it looks similar to handshakeResposne, but in fact 'Logfile' and
+-// 'DebugAddr' now refer to the client.
+-type ClientSession struct {
+- SessionID string `json:"sessionID"`
+- Logfile string `json:"logfile"`
+- DebugAddr string `json:"debugAddr"`
+-}
+-
+-// ServerState holds information about the gopls daemon process, including its
+-// debug information and debug information of all of its current connected
+-// clients.
+-type ServerState struct {
+- Logfile string `json:"logfile"`
+- DebugAddr string `json:"debugAddr"`
+- GoplsPath string `json:"goplsPath"`
+- CurrentClientID string `json:"currentClientID"`
+- Clients []ClientSession `json:"clients"`
+-}
+-
+-const (
+- handshakeMethod = "gopls/handshake"
+- sessionsMethod = "gopls/sessions"
+-)
+-
+-func handshaker(session *cache.Session, goplsPath string, logHandshakes bool, handler jsonrpc2.Handler) jsonrpc2.Handler {
+- return func(ctx context.Context, reply jsonrpc2.Replier, r jsonrpc2.Request) error {
+- switch r.Method() {
+- case handshakeMethod:
+- // We log.Printf in this handler, rather than event.Log when we want logs
+- // to go to the daemon log rather than being reflected back to the
+- // client.
+- var req handshakeRequest
+- if err := json.Unmarshal(r.Params(), &req); err != nil {
+- if logHandshakes {
+- log.Printf("Error processing handshake for session %s: %v", session.ID(), err)
+- }
+- sendError(ctx, reply, err)
+- return nil
+- }
+- if logHandshakes {
+- log.Printf("Session %s: got handshake. Logfile: %q, Debug addr: %q", session.ID(), req.Logfile, req.DebugAddr)
+- }
+- event.Log(ctx, "Handshake session update",
+- cache.KeyUpdateSession.Of(session),
+- tag.DebugAddress.Of(req.DebugAddr),
+- tag.Logfile.Of(req.Logfile),
+- tag.ServerID.Of(req.ServerID),
+- tag.GoplsPath.Of(req.GoplsPath),
+- )
+- resp := handshakeResponse{
+- SessionID: session.ID(),
+- GoplsPath: goplsPath,
+- }
+- if di := debug.GetInstance(ctx); di != nil {
+- resp.Logfile = di.Logfile
+- resp.DebugAddr = di.ListenedDebugAddress()
+- }
+- return reply(ctx, resp, nil)
+-
+- case sessionsMethod:
+- resp := ServerState{
+- GoplsPath: goplsPath,
+- CurrentClientID: session.ID(),
+- }
+- if di := debug.GetInstance(ctx); di != nil {
+- resp.Logfile = di.Logfile
+- resp.DebugAddr = di.ListenedDebugAddress()
+- for _, c := range di.State.Clients() {
+- resp.Clients = append(resp.Clients, ClientSession{
+- SessionID: c.Session.ID(),
+- Logfile: c.Logfile,
+- DebugAddr: c.DebugAddress,
+- })
+- }
+- }
+- return reply(ctx, resp, nil)
+- }
+- return handler(ctx, reply, r)
+- }
+-}
+-
+-func sendError(ctx context.Context, reply jsonrpc2.Replier, err error) {
+- err = fmt.Errorf("%v: %w", err, jsonrpc2.ErrParse)
+- if err := reply(ctx, nil, err); err != nil {
+- event.Error(ctx, "", err)
+- }
+-}
+-
+-// ParseAddr parses the address of a gopls remote.
+-// TODO(rFindley): further document this syntax, and allow URI-style remote
+-// addresses such as "auto://...".
+-func ParseAddr(listen string) (network string, address string) {
+- // Allow passing just -remote=auto, as a shorthand for using automatic remote
+- // resolution.
+- if listen == AutoNetwork {
+- return AutoNetwork, ""
+- }
+- if parts := strings.SplitN(listen, ";", 2); len(parts) == 2 {
+- return parts[0], parts[1]
+- }
+- return "tcp", listen
+-}
+diff -urN a/gopls/internal/lsp/lsprpc/lsprpc_test.go b/gopls/internal/lsp/lsprpc/lsprpc_test.go
+--- a/gopls/internal/lsp/lsprpc/lsprpc_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/lsprpc/lsprpc_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,345 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsprpc
+-
+-import (
+- "context"
+- "errors"
+- "regexp"
+- "strings"
+- "testing"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/lsp/cache"
+- "golang.org/x/tools/gopls/internal/lsp/debug"
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/jsonrpc2"
+- "golang.org/x/tools/internal/jsonrpc2/servertest"
+-)
+-
+-type FakeClient struct {
+- protocol.Client
+-
+- Logs chan string
+-}
+-
+-func (c FakeClient) LogMessage(ctx context.Context, params *protocol.LogMessageParams) error {
+- c.Logs <- params.Message
+- return nil
+-}
+-
+-// fakeServer is intended to be embedded in the test fakes below, to trivially
+-// implement Shutdown.
+-type fakeServer struct {
+- protocol.Server
+-}
+-
+-func (fakeServer) Shutdown(ctx context.Context) error {
+- return nil
+-}
+-
+-type PingServer struct{ fakeServer }
+-
+-func (s PingServer) DidOpen(ctx context.Context, params *protocol.DidOpenTextDocumentParams) error {
+- event.Log(ctx, "ping")
+- return nil
+-}
+-
+-func TestClientLogging(t *testing.T) {
+- ctx, cancel := context.WithCancel(context.Background())
+- defer cancel()
+-
+- server := PingServer{}
+- client := FakeClient{Logs: make(chan string, 10)}
+-
+- ctx = debug.WithInstance(ctx, "", "")
+- ss := NewStreamServer(cache.New(nil), false, nil)
+- ss.serverForTest = server
+- ts := servertest.NewPipeServer(ss, nil)
+- defer checkClose(t, ts.Close)
+- cc := ts.Connect(ctx)
+- cc.Go(ctx, protocol.ClientHandler(client, jsonrpc2.MethodNotFound))
+-
+- if err := protocol.ServerDispatcher(cc).DidOpen(ctx, &protocol.DidOpenTextDocumentParams{}); err != nil {
+- t.Errorf("DidOpen: %v", err)
+- }
+-
+- select {
+- case got := <-client.Logs:
+- want := "ping"
+- matched, err := regexp.MatchString(want, got)
+- if err != nil {
+- t.Fatal(err)
+- }
+- if !matched {
+- t.Errorf("got log %q, want a log containing %q", got, want)
+- }
+- case <-time.After(1 * time.Second):
+- t.Error("timeout waiting for client log")
+- }
+-}
+-
+-// WaitableServer instruments LSP request so that we can control their timing.
+-// The requests chosen are arbitrary: we simply needed one that blocks, and
+-// another that doesn't.
+-type WaitableServer struct {
+- fakeServer
+-
+- Started chan struct{}
+- Completed chan error
+-}
+-
+-func (s WaitableServer) Hover(ctx context.Context, _ *protocol.HoverParams) (_ *protocol.Hover, err error) {
+- s.Started <- struct{}{}
+- defer func() {
+- s.Completed <- err
+- }()
+- select {
+- case <-ctx.Done():
+- return nil, errors.New("cancelled hover")
+- case <-time.After(10 * time.Second):
+- }
+- return &protocol.Hover{}, nil
+-}
+-
+-func (s WaitableServer) ResolveCompletionItem(_ context.Context, item *protocol.CompletionItem) (*protocol.CompletionItem, error) {
+- return item, nil
+-}
+-
+-func checkClose(t *testing.T, closer func() error) {
+- t.Helper()
+- if err := closer(); err != nil {
+- t.Errorf("closing: %v", err)
+- }
+-}
+-
+-func setupForwarding(ctx context.Context, t *testing.T, s protocol.Server) (direct, forwarded servertest.Connector, cleanup func()) {
+- t.Helper()
+- serveCtx := debug.WithInstance(ctx, "", "")
+- ss := NewStreamServer(cache.New(nil), false, nil)
+- ss.serverForTest = s
+- tsDirect := servertest.NewTCPServer(serveCtx, ss, nil)
+-
+- forwarder, err := NewForwarder("tcp;"+tsDirect.Addr, nil)
+- if err != nil {
+- t.Fatal(err)
+- }
+- tsForwarded := servertest.NewPipeServer(forwarder, nil)
+- return tsDirect, tsForwarded, func() {
+- checkClose(t, tsDirect.Close)
+- checkClose(t, tsForwarded.Close)
+- }
+-}
+-
+-func TestRequestCancellation(t *testing.T) {
+- ctx := context.Background()
+- server := WaitableServer{
+- Started: make(chan struct{}),
+- Completed: make(chan error),
+- }
+- tsDirect, tsForwarded, cleanup := setupForwarding(ctx, t, server)
+- defer cleanup()
+- tests := []struct {
+- serverType string
+- ts servertest.Connector
+- }{
+- {"direct", tsDirect},
+- {"forwarder", tsForwarded},
+- }
+-
+- for _, test := range tests {
+- t.Run(test.serverType, func(t *testing.T) {
+- cc := test.ts.Connect(ctx)
+- sd := protocol.ServerDispatcher(cc)
+- cc.Go(ctx,
+- protocol.Handlers(
+- jsonrpc2.MethodNotFound))
+-
+- ctx := context.Background()
+- ctx, cancel := context.WithCancel(ctx)
+-
+- result := make(chan error)
+- go func() {
+- _, err := sd.Hover(ctx, &protocol.HoverParams{})
+- result <- err
+- }()
+- // Wait for the Hover request to start.
+- <-server.Started
+- cancel()
+- if err := <-result; err == nil {
+- t.Error("nil error for cancelled Hover(), want non-nil")
+- }
+- if err := <-server.Completed; err == nil || !strings.Contains(err.Error(), "cancelled hover") {
+- t.Errorf("Hover(): unexpected server-side error %v", err)
+- }
+- })
+- }
+-}
+-
+-const exampleProgram = `
+--- go.mod --
+-module mod
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-import "fmt"
+-
+-func main() {
+- fmt.Println("Hello World.")
+-}`
+-
+-func TestDebugInfoLifecycle(t *testing.T) {
+- sb, err := fake.NewSandbox(&fake.SandboxConfig{Files: fake.UnpackTxt(exampleProgram)})
+- if err != nil {
+- t.Fatal(err)
+- }
+- defer func() {
+- if err := sb.Close(); err != nil {
+- // TODO(golang/go#38490): we can't currently make this an error because
+- // it fails on Windows: the workspace directory is still locked by a
+- // separate Go process.
+- // Once we have a reliable way to wait for proper shutdown, make this an
+- // error.
+- t.Logf("closing workspace failed: %v", err)
+- }
+- }()
+-
+- baseCtx, cancel := context.WithCancel(context.Background())
+- defer cancel()
+- clientCtx := debug.WithInstance(baseCtx, "", "")
+- serverCtx := debug.WithInstance(baseCtx, "", "")
+-
+- cache := cache.New(nil)
+- ss := NewStreamServer(cache, false, nil)
+- tsBackend := servertest.NewTCPServer(serverCtx, ss, nil)
+-
+- forwarder, err := NewForwarder("tcp;"+tsBackend.Addr, nil)
+- if err != nil {
+- t.Fatal(err)
+- }
+- tsForwarder := servertest.NewPipeServer(forwarder, nil)
+-
+- const skipApplyEdits = false
+- ed1, err := fake.NewEditor(sb, fake.EditorConfig{}).Connect(clientCtx, tsForwarder, fake.ClientHooks{}, skipApplyEdits)
+- if err != nil {
+- t.Fatal(err)
+- }
+- defer ed1.Close(clientCtx)
+- ed2, err := fake.NewEditor(sb, fake.EditorConfig{}).Connect(baseCtx, tsBackend, fake.ClientHooks{}, skipApplyEdits)
+- if err != nil {
+- t.Fatal(err)
+- }
+- defer ed2.Close(baseCtx)
+-
+- serverDebug := debug.GetInstance(serverCtx)
+- if got, want := len(serverDebug.State.Clients()), 2; got != want {
+- t.Errorf("len(server:Clients) = %d, want %d", got, want)
+- }
+- if got, want := len(serverDebug.State.Sessions()), 2; got != want {
+- t.Errorf("len(server:Sessions) = %d, want %d", got, want)
+- }
+- clientDebug := debug.GetInstance(clientCtx)
+- if got, want := len(clientDebug.State.Servers()), 1; got != want {
+- t.Errorf("len(client:Servers) = %d, want %d", got, want)
+- }
+- // Close one of the connections to verify that the client and session were
+- // dropped.
+- if err := ed1.Close(clientCtx); err != nil {
+- t.Fatal(err)
+- }
+- /*TODO: at this point we have verified the editor is closed
+- However there is no way currently to wait for all associated go routines to
+- go away, and we need to wait for those to trigger the client drop
+- for now we just give it a little bit of time, but we need to fix this
+- in a principled way
+- */
+- start := time.Now()
+- delay := time.Millisecond
+- const maxWait = time.Second
+- for len(serverDebug.State.Clients()) > 1 {
+- if time.Since(start) > maxWait {
+- break
+- }
+- time.Sleep(delay)
+- delay *= 2
+- }
+- if got, want := len(serverDebug.State.Clients()), 1; got != want {
+- t.Errorf("len(server:Clients) = %d, want %d", got, want)
+- }
+- if got, want := len(serverDebug.State.Sessions()), 1; got != want {
+- t.Errorf("len(server:Sessions()) = %d, want %d", got, want)
+- }
+-}
+-
+-type initServer struct {
+- fakeServer
+-
+- params *protocol.ParamInitialize
+-}
+-
+-func (s *initServer) Initialize(ctx context.Context, params *protocol.ParamInitialize) (*protocol.InitializeResult, error) {
+- s.params = params
+- return &protocol.InitializeResult{}, nil
+-}
+-
+-func TestEnvForwarding(t *testing.T) {
+- ctx := context.Background()
+-
+- server := &initServer{}
+- _, tsForwarded, cleanup := setupForwarding(ctx, t, server)
+- defer cleanup()
+-
+- conn := tsForwarded.Connect(ctx)
+- conn.Go(ctx, jsonrpc2.MethodNotFound)
+- dispatch := protocol.ServerDispatcher(conn)
+- initParams := &protocol.ParamInitialize{}
+- initParams.InitializationOptions = map[string]interface{}{
+- "env": map[string]interface{}{
+- "GONOPROXY": "example.com",
+- },
+- }
+- _, err := dispatch.Initialize(ctx, initParams)
+- if err != nil {
+- t.Fatal(err)
+- }
+- if server.params == nil {
+- t.Fatalf("initialize params are unset")
+- }
+- env := server.params.InitializationOptions.(map[string]interface{})["env"].(map[string]interface{})
+-
+- // Check for an arbitrary Go variable. It should be set.
+- if _, ok := env["GOPRIVATE"]; !ok {
+- t.Errorf("Go environment variable GOPRIVATE unset in initialization options")
+- }
+- // Check that the variable present in our user config was not overwritten.
+- if v := env["GONOPROXY"]; v != "example.com" {
+- t.Errorf("GONOPROXY environment variable was overwritten")
+- }
+-}
+-
+-func TestListenParsing(t *testing.T) {
+- tests := []struct {
+- input, wantNetwork, wantAddr string
+- }{
+- {"127.0.0.1:0", "tcp", "127.0.0.1:0"},
+- {"unix;/tmp/sock", "unix", "/tmp/sock"},
+- {"auto", "auto", ""},
+- {"auto;foo", "auto", "foo"},
+- }
+-
+- for _, test := range tests {
+- gotNetwork, gotAddr := ParseAddr(test.input)
+- if gotNetwork != test.wantNetwork {
+- t.Errorf("network = %q, want %q", gotNetwork, test.wantNetwork)
+- }
+- if gotAddr != test.wantAddr {
+- t.Errorf("addr = %q, want %q", gotAddr, test.wantAddr)
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/lsprpc/middleware.go b/gopls/internal/lsp/lsprpc/middleware.go
+--- a/gopls/internal/lsp/lsprpc/middleware.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/lsprpc/middleware.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,142 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsprpc
+-
+-import (
+- "context"
+- "encoding/json"
+- "fmt"
+- "sync"
+-
+- "golang.org/x/tools/internal/event"
+- jsonrpc2_v2 "golang.org/x/tools/internal/jsonrpc2_v2"
+-)
+-
+-// Metadata holds arbitrary data transferred between jsonrpc2 peers.
+-type Metadata map[string]interface{}
+-
+-// PeerInfo holds information about a peering between jsonrpc2 servers.
+-type PeerInfo struct {
+- // RemoteID is the identity of the current server on its peer.
+- RemoteID int64
+-
+- // LocalID is the identity of the peer on the server.
+- LocalID int64
+-
+- // IsClient reports whether the peer is a client. If false, the peer is a
+- // server.
+- IsClient bool
+-
+- // Metadata holds arbitrary information provided by the peer.
+- Metadata Metadata
+-}
+-
+-// Handshaker handles both server and client handshaking over jsonrpc2. To
+-// instrument server-side handshaking, use Handshaker.Middleware. To instrument
+-// client-side handshaking, call Handshaker.ClientHandshake for any new
+-// client-side connections.
+-type Handshaker struct {
+- // Metadata will be shared with peers via handshaking.
+- Metadata Metadata
+-
+- mu sync.Mutex
+- prevID int64
+- peers map[int64]PeerInfo
+-}
+-
+-// Peers returns the peer info this handshaker knows about by way of either the
+-// server-side handshake middleware, or client-side handshakes.
+-func (h *Handshaker) Peers() []PeerInfo {
+- h.mu.Lock()
+- defer h.mu.Unlock()
+-
+- var c []PeerInfo
+- for _, v := range h.peers {
+- c = append(c, v)
+- }
+- return c
+-}
+-
+-// Middleware is a jsonrpc2 middleware function to augment connection binding
+-// to handle the handshake method, and record disconnections.
+-func (h *Handshaker) Middleware(inner jsonrpc2_v2.Binder) jsonrpc2_v2.Binder {
+- return BinderFunc(func(ctx context.Context, conn *jsonrpc2_v2.Connection) jsonrpc2_v2.ConnectionOptions {
+- opts := inner.Bind(ctx, conn)
+-
+- localID := h.nextID()
+- info := &PeerInfo{
+- RemoteID: localID,
+- Metadata: h.Metadata,
+- }
+-
+- // Wrap the delegated handler to accept the handshake.
+- delegate := opts.Handler
+- opts.Handler = jsonrpc2_v2.HandlerFunc(func(ctx context.Context, req *jsonrpc2_v2.Request) (interface{}, error) {
+- if req.Method == handshakeMethod {
+- var peerInfo PeerInfo
+- if err := json.Unmarshal(req.Params, &peerInfo); err != nil {
+- return nil, fmt.Errorf("%w: unmarshaling client info: %v", jsonrpc2_v2.ErrInvalidParams, err)
+- }
+- peerInfo.LocalID = localID
+- peerInfo.IsClient = true
+- h.recordPeer(peerInfo)
+- return info, nil
+- }
+- return delegate.Handle(ctx, req)
+- })
+-
+- // Record the dropped client.
+- go h.cleanupAtDisconnect(conn, localID)
+-
+- return opts
+- })
+-}
+-
+-// ClientHandshake performs a client-side handshake with the server at the
+-// other end of conn, recording the server's peer info and watching for conn's
+-// disconnection.
+-func (h *Handshaker) ClientHandshake(ctx context.Context, conn *jsonrpc2_v2.Connection) {
+- localID := h.nextID()
+- info := &PeerInfo{
+- RemoteID: localID,
+- Metadata: h.Metadata,
+- }
+-
+- call := conn.Call(ctx, handshakeMethod, info)
+- var serverInfo PeerInfo
+- if err := call.Await(ctx, &serverInfo); err != nil {
+- event.Error(ctx, "performing handshake", err)
+- return
+- }
+- serverInfo.LocalID = localID
+- h.recordPeer(serverInfo)
+-
+- go h.cleanupAtDisconnect(conn, localID)
+-}
+-
+-func (h *Handshaker) nextID() int64 {
+- h.mu.Lock()
+- defer h.mu.Unlock()
+-
+- h.prevID++
+- return h.prevID
+-}
+-
+-func (h *Handshaker) cleanupAtDisconnect(conn *jsonrpc2_v2.Connection, peerID int64) {
+- conn.Wait()
+-
+- h.mu.Lock()
+- defer h.mu.Unlock()
+- delete(h.peers, peerID)
+-}
+-
+-func (h *Handshaker) recordPeer(info PeerInfo) {
+- h.mu.Lock()
+- defer h.mu.Unlock()
+- if h.peers == nil {
+- h.peers = make(map[int64]PeerInfo)
+- }
+- h.peers[info.LocalID] = info
+-}
+diff -urN a/gopls/internal/lsp/lsprpc/middleware_test.go b/gopls/internal/lsp/lsprpc/middleware_test.go
+--- a/gopls/internal/lsp/lsprpc/middleware_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/lsprpc/middleware_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,93 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsprpc_test
+-
+-import (
+- "context"
+- "errors"
+- "fmt"
+- "testing"
+- "time"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/lsprpc"
+- jsonrpc2_v2 "golang.org/x/tools/internal/jsonrpc2_v2"
+-)
+-
+-var noopBinder = BinderFunc(func(context.Context, *jsonrpc2_v2.Connection) jsonrpc2_v2.ConnectionOptions {
+- return jsonrpc2_v2.ConnectionOptions{}
+-})
+-
+-func TestHandshakeMiddleware(t *testing.T) {
+- sh := &Handshaker{
+- Metadata: Metadata{
+- "answer": 42,
+- },
+- }
+- ctx := context.Background()
+- env := new(TestEnv)
+- defer env.Shutdown(t)
+- l, _ := env.serve(ctx, t, sh.Middleware(noopBinder))
+- conn := env.dial(ctx, t, l.Dialer(), noopBinder, false)
+- ch := &Handshaker{
+- Metadata: Metadata{
+- "question": 6 * 9,
+- },
+- }
+-
+- check := func(connected bool) error {
+- clients := sh.Peers()
+- servers := ch.Peers()
+- want := 0
+- if connected {
+- want = 1
+- }
+- if got := len(clients); got != want {
+- return fmt.Errorf("got %d clients on the server, want %d", got, want)
+- }
+- if got := len(servers); got != want {
+- return fmt.Errorf("got %d servers on the client, want %d", got, want)
+- }
+- if !connected {
+- return nil
+- }
+- client := clients[0]
+- server := servers[0]
+- if _, ok := client.Metadata["question"]; !ok {
+- return errors.New("no client metadata")
+- }
+- if _, ok := server.Metadata["answer"]; !ok {
+- return errors.New("no server metadata")
+- }
+- if client.LocalID != server.RemoteID {
+- return fmt.Errorf("client.LocalID == %d, server.PeerID == %d", client.LocalID, server.RemoteID)
+- }
+- if client.RemoteID != server.LocalID {
+- return fmt.Errorf("client.PeerID == %d, server.LocalID == %d", client.RemoteID, server.LocalID)
+- }
+- return nil
+- }
+-
+- if err := check(false); err != nil {
+- t.Fatalf("before handshake: %v", err)
+- }
+- ch.ClientHandshake(ctx, conn)
+- if err := check(true); err != nil {
+- t.Fatalf("after handshake: %v", err)
+- }
+- conn.Close()
+- // Wait for up to ~2s for connections to get cleaned up.
+- delay := 25 * time.Millisecond
+- for retries := 3; retries >= 0; retries-- {
+- time.Sleep(delay)
+- err := check(false)
+- if err == nil {
+- return
+- }
+- if retries == 0 {
+- t.Fatalf("after closing connection: %v", err)
+- }
+- delay *= 4
+- }
+-}
+diff -urN a/gopls/internal/lsp/lsp_test.go b/gopls/internal/lsp/lsp_test.go
+--- a/gopls/internal/lsp/lsp_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/lsp_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1360 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "bytes"
+- "context"
+- "fmt"
+- "os"
+- "os/exec"
+- "path/filepath"
+- "sort"
+- "strings"
+- "testing"
+-
+- "github.com/google/go-cmp/cmp"
+- "github.com/google/go-cmp/cmp/cmpopts"
+- "golang.org/x/tools/gopls/internal/lsp/cache"
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/tests"
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/diff"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-func TestMain(m *testing.M) {
+- bug.PanicOnBugs = true
+- testenv.ExitIfSmallMachine()
+-
+- // Set the global exporter to nil so that we don't log to stderr. This avoids
+- // a lot of misleading noise in test output.
+- //
+- // TODO(rfindley): investigate whether we can/should capture logs scoped to
+- // individual tests by passing in a context with a local exporter.
+- event.SetExporter(nil)
+-
+- os.Exit(m.Run())
+-}
+-
+-// TestLSP runs the marker tests in files beneath testdata/ using
+-// implementations of each of the marker operations (e.g. @codelens) that
+-// make LSP RPCs (e.g. textDocument/codeLens) to a gopls server.
+-func TestLSP(t *testing.T) {
+- tests.RunTests(t, "testdata", true, testLSP)
+-}
+-
+-func testLSP(t *testing.T, datum *tests.Data) {
+- ctx := tests.Context(t)
+-
+- session := cache.NewSession(ctx, cache.New(nil), nil)
+- options := source.DefaultOptions().Clone()
+- tests.DefaultOptions(options)
+- session.SetOptions(options)
+- options.SetEnvSlice(datum.Config.Env)
+- view, snapshot, release, err := session.NewView(ctx, datum.Config.Dir, span.URIFromPath(datum.Config.Dir), options)
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- defer session.RemoveView(view)
+-
+- // Enable type error analyses for tests.
+- // TODO(golang/go#38212): Delete this once they are enabled by default.
+- tests.EnableAllAnalyzers(options)
+- session.SetViewOptions(ctx, view, options)
+-
+- // Enable all inlay hints for tests.
+- tests.EnableAllInlayHints(options)
+-
+- // Only run the -modfile specific tests in module mode with Go 1.14 or above.
+- datum.ModfileFlagAvailable = len(snapshot.ModFiles()) > 0 && testenv.Go1Point() >= 14
+- release()
+-
+- // Open all files for performance reasons. This is done because gopls only
+- // keeps active packages in memory for open files.
+- //
+- // In practice clients will only send document-oriented requests for open
+- // files.
+- var modifications []source.FileModification
+- for _, module := range datum.Exported.Modules {
+- for name := range module.Files {
+- filename := datum.Exported.File(module.Name, name)
+- if filepath.Ext(filename) != ".go" {
+- continue
+- }
+- content, err := datum.Exported.FileContents(filename)
+- if err != nil {
+- t.Fatal(err)
+- }
+- modifications = append(modifications, source.FileModification{
+- URI: span.URIFromPath(filename),
+- Action: source.Open,
+- Version: -1,
+- Text: content,
+- LanguageID: "go",
+- })
+- }
+- }
+- for filename, content := range datum.Config.Overlay {
+- if filepath.Ext(filename) != ".go" {
+- continue
+- }
+- modifications = append(modifications, source.FileModification{
+- URI: span.URIFromPath(filename),
+- Action: source.Open,
+- Version: -1,
+- Text: content,
+- LanguageID: "go",
+- })
+- }
+- if err := session.ModifyFiles(ctx, modifications); err != nil {
+- t.Fatal(err)
+- }
+- r := &runner{
+- data: datum,
+- ctx: ctx,
+- normalizers: tests.CollectNormalizers(datum.Exported),
+- editRecv: make(chan map[span.URI][]byte, 1),
+- }
+-
+- r.server = NewServer(session, testClient{runner: r})
+- tests.Run(t, r, datum)
+-}
+-
+-// runner implements tests.Tests by making LSP RPCs to a gopls server.
+-type runner struct {
+- server *Server
+- data *tests.Data
+- diagnostics map[span.URI][]*source.Diagnostic
+- ctx context.Context
+- normalizers []tests.Normalizer
+- editRecv chan map[span.URI][]byte
+-}
+-
+-// testClient stubs any client functions that may be called by LSP functions.
+-type testClient struct {
+- protocol.Client
+- runner *runner
+-}
+-
+-func (c testClient) Close() error {
+- return nil
+-}
+-
+-// Trivially implement PublishDiagnostics so that we can call
+-// server.publishReports below to de-dup sent diagnostics.
+-func (c testClient) PublishDiagnostics(context.Context, *protocol.PublishDiagnosticsParams) error {
+- return nil
+-}
+-
+-func (c testClient) ShowMessage(context.Context, *protocol.ShowMessageParams) error {
+- return nil
+-}
+-
+-func (c testClient) ApplyEdit(ctx context.Context, params *protocol.ApplyWorkspaceEditParams) (*protocol.ApplyWorkspaceEditResult, error) {
+- res, err := applyTextDocumentEdits(c.runner, params.Edit.DocumentChanges)
+- if err != nil {
+- return nil, err
+- }
+- c.runner.editRecv <- res
+- return &protocol.ApplyWorkspaceEditResult{Applied: true}, nil
+-}
+-
+-func (r *runner) CallHierarchy(t *testing.T, spn span.Span, expectedCalls *tests.CallHierarchyResult) {
+- mapper, err := r.data.Mapper(spn.URI())
+- if err != nil {
+- t.Fatal(err)
+- }
+- loc, err := mapper.SpanLocation(spn)
+- if err != nil {
+- t.Fatalf("failed for %v: %v", spn, err)
+- }
+-
+- params := &protocol.CallHierarchyPrepareParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+-
+- items, err := r.server.PrepareCallHierarchy(r.ctx, params)
+- if err != nil {
+- t.Fatal(err)
+- }
+- if len(items) == 0 {
+- t.Fatalf("expected call hierarchy item to be returned for identifier at %v\n", loc.Range)
+- }
+-
+- callLocation := protocol.Location{
+- URI: items[0].URI,
+- Range: items[0].Range,
+- }
+- if callLocation != loc {
+- t.Fatalf("expected server.PrepareCallHierarchy to return identifier at %v but got %v\n", loc, callLocation)
+- }
+-
+- incomingCalls, err := r.server.IncomingCalls(r.ctx, &protocol.CallHierarchyIncomingCallsParams{Item: items[0]})
+- if err != nil {
+- t.Error(err)
+- }
+- var incomingCallItems []protocol.CallHierarchyItem
+- for _, item := range incomingCalls {
+- incomingCallItems = append(incomingCallItems, item.From)
+- }
+- msg := tests.DiffCallHierarchyItems(incomingCallItems, expectedCalls.IncomingCalls)
+- if msg != "" {
+- t.Error(fmt.Sprintf("incoming calls: %s", msg))
+- }
+-
+- outgoingCalls, err := r.server.OutgoingCalls(r.ctx, &protocol.CallHierarchyOutgoingCallsParams{Item: items[0]})
+- if err != nil {
+- t.Error(err)
+- }
+- var outgoingCallItems []protocol.CallHierarchyItem
+- for _, item := range outgoingCalls {
+- outgoingCallItems = append(outgoingCallItems, item.To)
+- }
+- msg = tests.DiffCallHierarchyItems(outgoingCallItems, expectedCalls.OutgoingCalls)
+- if msg != "" {
+- t.Error(fmt.Sprintf("outgoing calls: %s", msg))
+- }
+-}
+-
+-func (r *runner) CodeLens(t *testing.T, uri span.URI, want []protocol.CodeLens) {
+- if !strings.HasSuffix(uri.Filename(), "go.mod") {
+- return
+- }
+- got, err := r.server.codeLens(r.ctx, &protocol.CodeLensParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.DocumentURI(uri),
+- },
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- if diff := tests.DiffCodeLens(uri, want, got); diff != "" {
+- t.Errorf("%s: %s", uri, diff)
+- }
+-}
+-
+-func (r *runner) Diagnostics(t *testing.T, uri span.URI, want []*source.Diagnostic) {
+- // Get the diagnostics for this view if we have not done it before.
+- v := r.server.session.View(r.data.Config.Dir)
+- r.collectDiagnostics(v)
+- tests.CompareDiagnostics(t, uri, want, r.diagnostics[uri])
+-}
+-
+-func (r *runner) FoldingRanges(t *testing.T, spn span.Span) {
+- uri := spn.URI()
+- view, err := r.server.session.ViewOf(uri)
+- if err != nil {
+- t.Fatal(err)
+- }
+- original := view.Options()
+- modified := original
+- defer r.server.session.SetViewOptions(r.ctx, view, original)
+-
+- for _, test := range []struct {
+- lineFoldingOnly bool
+- prefix string
+- }{
+- {false, "foldingRange"},
+- {true, "foldingRange-lineFolding"},
+- } {
+- modified.LineFoldingOnly = test.lineFoldingOnly
+- view, err = r.server.session.SetViewOptions(r.ctx, view, modified)
+- if err != nil {
+- t.Error(err)
+- continue
+- }
+- ranges, err := r.server.FoldingRange(r.ctx, &protocol.FoldingRangeParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- })
+- if err != nil {
+- t.Error(err)
+- continue
+- }
+- r.foldingRanges(t, test.prefix, uri, ranges)
+- }
+-}
+-
+-func (r *runner) foldingRanges(t *testing.T, prefix string, uri span.URI, ranges []protocol.FoldingRange) {
+- m, err := r.data.Mapper(uri)
+- if err != nil {
+- t.Fatal(err)
+- }
+- // Fold all ranges.
+- nonOverlapping := nonOverlappingRanges(ranges)
+- for i, rngs := range nonOverlapping {
+- got, err := foldRanges(m, string(m.Content), rngs)
+- if err != nil {
+- t.Error(err)
+- continue
+- }
+- tag := fmt.Sprintf("%s-%d", prefix, i)
+- want := string(r.data.Golden(t, tag, uri.Filename(), func() ([]byte, error) {
+- return []byte(got), nil
+- }))
+-
+- if want != got {
+- t.Errorf("%s: foldingRanges failed for %s, expected:\n%v\ngot:\n%v", tag, uri.Filename(), want, got)
+- }
+- }
+-
+- // Filter by kind.
+- kinds := []protocol.FoldingRangeKind{protocol.Imports, protocol.Comment}
+- for _, kind := range kinds {
+- var kindOnly []protocol.FoldingRange
+- for _, fRng := range ranges {
+- if fRng.Kind == string(kind) {
+- kindOnly = append(kindOnly, fRng)
+- }
+- }
+-
+- nonOverlapping := nonOverlappingRanges(kindOnly)
+- for i, rngs := range nonOverlapping {
+- got, err := foldRanges(m, string(m.Content), rngs)
+- if err != nil {
+- t.Error(err)
+- continue
+- }
+- tag := fmt.Sprintf("%s-%s-%d", prefix, kind, i)
+- want := string(r.data.Golden(t, tag, uri.Filename(), func() ([]byte, error) {
+- return []byte(got), nil
+- }))
+-
+- if want != got {
+- t.Errorf("%s: foldingRanges failed for %s, expected:\n%v\ngot:\n%v", tag, uri.Filename(), want, got)
+- }
+- }
+-
+- }
+-}
+-
+-func nonOverlappingRanges(ranges []protocol.FoldingRange) (res [][]protocol.FoldingRange) {
+- for _, fRng := range ranges {
+- setNum := len(res)
+- for i := 0; i < len(res); i++ {
+- canInsert := true
+- for _, rng := range res[i] {
+- if conflict(rng, fRng) {
+- canInsert = false
+- break
+- }
+- }
+- if canInsert {
+- setNum = i
+- break
+- }
+- }
+- if setNum == len(res) {
+- res = append(res, []protocol.FoldingRange{})
+- }
+- res[setNum] = append(res[setNum], fRng)
+- }
+- return res
+-}
+-
+-func conflict(a, b protocol.FoldingRange) bool {
+- // a start position is <= b start positions
+- return (a.StartLine < b.StartLine || (a.StartLine == b.StartLine && a.StartCharacter <= b.StartCharacter)) &&
+- (a.EndLine > b.StartLine || (a.EndLine == b.StartLine && a.EndCharacter > b.StartCharacter))
+-}
+-
+-func foldRanges(m *protocol.Mapper, contents string, ranges []protocol.FoldingRange) (string, error) {
+- foldedText := "<>"
+- res := contents
+- // Apply the edits from the end of the file forward
+- // to preserve the offsets
+- // TODO(adonovan): factor to use diff.ApplyEdits, which validates the input.
+- for i := len(ranges) - 1; i >= 0; i-- {
+- r := ranges[i]
+- start, err := m.PositionPoint(protocol.Position{Line: r.StartLine, Character: r.StartCharacter})
+- if err != nil {
+- return "", err
+- }
+- end, err := m.PositionPoint(protocol.Position{Line: r.EndLine, Character: r.EndCharacter})
+- if err != nil {
+- return "", err
+- }
+- res = res[:start.Offset()] + foldedText + res[end.Offset():]
+- }
+- return res, nil
+-}
+-
+-func (r *runner) Format(t *testing.T, spn span.Span) {
+- uri := spn.URI()
+- filename := uri.Filename()
+- gofmted := r.data.Golden(t, "gofmt", filename, func() ([]byte, error) {
+- cmd := exec.Command("gofmt", filename)
+- out, _ := cmd.Output() // ignore error, sometimes we have intentionally ungofmt-able files
+- return out, nil
+- })
+-
+- edits, err := r.server.Formatting(r.ctx, &protocol.DocumentFormattingParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- })
+- if err != nil {
+- if len(gofmted) > 0 {
+- t.Error(err)
+- }
+- return
+- }
+- m, err := r.data.Mapper(uri)
+- if err != nil {
+- t.Fatal(err)
+- }
+- got, _, err := source.ApplyProtocolEdits(m, edits)
+- if err != nil {
+- t.Error(err)
+- }
+- if diff := compare.Bytes(gofmted, got); diff != "" {
+- t.Errorf("format failed for %s (-want +got):\n%s", filename, diff)
+- }
+-}
+-
+-func (r *runner) SemanticTokens(t *testing.T, spn span.Span) {
+- uri := spn.URI()
+- filename := uri.Filename()
+- // this is called solely for coverage in semantic.go
+- _, err := r.server.semanticTokensFull(r.ctx, &protocol.SemanticTokensParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- })
+- if err != nil {
+- t.Errorf("%v for %s", err, filename)
+- }
+- _, err = r.server.semanticTokensRange(r.ctx, &protocol.SemanticTokensRangeParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- // any legal range. Just to exercise the call.
+- Range: protocol.Range{
+- Start: protocol.Position{
+- Line: 0,
+- Character: 0,
+- },
+- End: protocol.Position{
+- Line: 2,
+- Character: 0,
+- },
+- },
+- })
+- if err != nil {
+- t.Errorf("%v for Range %s", err, filename)
+- }
+-}
+-
+-func (r *runner) Import(t *testing.T, spn span.Span) {
+- // Invokes textDocument/codeAction and applies all the "goimports" edits.
+-
+- uri := spn.URI()
+- filename := uri.Filename()
+- actions, err := r.server.CodeAction(r.ctx, &protocol.CodeActionParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- m, err := r.data.Mapper(uri)
+- if err != nil {
+- t.Fatal(err)
+- }
+- got := m.Content
+- if len(actions) > 0 {
+- res, err := applyTextDocumentEdits(r, actions[0].Edit.DocumentChanges)
+- if err != nil {
+- t.Fatal(err)
+- }
+- got = res[uri]
+- }
+- want := r.data.Golden(t, "goimports", filename, func() ([]byte, error) {
+- return got, nil
+- })
+- if diff := compare.Bytes(want, got); diff != "" {
+- t.Errorf("import failed for %s:\n%s", filename, diff)
+- }
+-}
+-
+-func (r *runner) SuggestedFix(t *testing.T, spn span.Span, actionKinds []tests.SuggestedFix, expectedActions int) {
+- uri := spn.URI()
+- view, err := r.server.session.ViewOf(uri)
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- m, err := r.data.Mapper(uri)
+- if err != nil {
+- t.Fatal(err)
+- }
+- rng, err := m.SpanRange(spn)
+- if err != nil {
+- t.Fatal(err)
+- }
+- // Get the diagnostics for this view if we have not done it before.
+- r.collectDiagnostics(view)
+- var diagnostics []protocol.Diagnostic
+- for _, d := range r.diagnostics[uri] {
+- // Compare the start positions rather than the entire range because
+- // some diagnostics have a range with the same start and end position (8:1-8:1).
+- // The current marker functionality prevents us from having a range of 0 length.
+- if protocol.ComparePosition(d.Range.Start, rng.Start) == 0 {
+- diagnostics = append(diagnostics, toProtocolDiagnostics([]*source.Diagnostic{d})...)
+- break
+- }
+- }
+- var codeActionKinds []protocol.CodeActionKind
+- for _, k := range actionKinds {
+- codeActionKinds = append(codeActionKinds, protocol.CodeActionKind(k.ActionKind))
+- }
+- allActions, err := r.server.CodeAction(r.ctx, &protocol.CodeActionParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- Range: rng,
+- Context: protocol.CodeActionContext{
+- Only: codeActionKinds,
+- Diagnostics: diagnostics,
+- },
+- })
+- if err != nil {
+- t.Fatalf("CodeAction %s failed: %v", spn, err)
+- }
+- var actions []protocol.CodeAction
+- for _, action := range allActions {
+- for _, fix := range actionKinds {
+- if strings.Contains(action.Title, fix.Title) {
+- actions = append(actions, action)
+- break
+- }
+- }
+-
+- }
+- if len(actions) != expectedActions {
+- var summaries []string
+- for _, a := range actions {
+- summaries = append(summaries, fmt.Sprintf("%q (%s)", a.Title, a.Kind))
+- }
+- t.Fatalf("CodeAction(...): got %d code actions (%v), want %d", len(actions), summaries, expectedActions)
+- }
+- action := actions[0]
+- var match bool
+- for _, k := range codeActionKinds {
+- if action.Kind == k {
+- match = true
+- break
+- }
+- }
+- if !match {
+- t.Fatalf("unexpected kind for code action %s, got %v, want one of %v", action.Title, action.Kind, codeActionKinds)
+- }
+- var res map[span.URI][]byte
+- if cmd := action.Command; cmd != nil {
+- _, err := r.server.ExecuteCommand(r.ctx, &protocol.ExecuteCommandParams{
+- Command: action.Command.Command,
+- Arguments: action.Command.Arguments,
+- })
+- if err != nil {
+- t.Fatalf("error converting command %q to edits: %v", action.Command.Command, err)
+- }
+- res = <-r.editRecv
+- } else {
+- res, err = applyTextDocumentEdits(r, action.Edit.DocumentChanges)
+- if err != nil {
+- t.Fatal(err)
+- }
+- }
+- for u, got := range res {
+- want := r.data.Golden(t, "suggestedfix_"+tests.SpanName(spn), u.Filename(), func() ([]byte, error) {
+- return got, nil
+- })
+- if diff := compare.Bytes(want, got); diff != "" {
+- t.Errorf("suggested fixes failed for %s:\n%s", u.Filename(), diff)
+- }
+- }
+-}
+-
+-func (r *runner) FunctionExtraction(t *testing.T, start span.Span, end span.Span) {
+- uri := start.URI()
+- m, err := r.data.Mapper(uri)
+- if err != nil {
+- t.Fatal(err)
+- }
+- spn := span.New(start.URI(), start.Start(), end.End())
+- rng, err := m.SpanRange(spn)
+- if err != nil {
+- t.Fatal(err)
+- }
+- actionsRaw, err := r.server.CodeAction(r.ctx, &protocol.CodeActionParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- Range: rng,
+- Context: protocol.CodeActionContext{
+- Only: []protocol.CodeActionKind{"refactor.extract"},
+- },
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- var actions []protocol.CodeAction
+- for _, action := range actionsRaw {
+- if action.Command.Title == "Extract function" {
+- actions = append(actions, action)
+- }
+- }
+- // Hack: We assume that we only get one code action per range.
+- // TODO(rstambler): Support multiple code actions per test.
+- if len(actions) == 0 || len(actions) > 1 {
+- t.Fatalf("unexpected number of code actions, want 1, got %v", len(actions))
+- }
+- _, err = r.server.ExecuteCommand(r.ctx, &protocol.ExecuteCommandParams{
+- Command: actions[0].Command.Command,
+- Arguments: actions[0].Command.Arguments,
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- res := <-r.editRecv
+- for u, got := range res {
+- want := r.data.Golden(t, "functionextraction_"+tests.SpanName(spn), u.Filename(), func() ([]byte, error) {
+- return got, nil
+- })
+- if diff := compare.Bytes(want, got); diff != "" {
+- t.Errorf("function extraction failed for %s:\n%s", u.Filename(), diff)
+- }
+- }
+-}
+-
+-func (r *runner) MethodExtraction(t *testing.T, start span.Span, end span.Span) {
+- uri := start.URI()
+- m, err := r.data.Mapper(uri)
+- if err != nil {
+- t.Fatal(err)
+- }
+- spn := span.New(start.URI(), start.Start(), end.End())
+- rng, err := m.SpanRange(spn)
+- if err != nil {
+- t.Fatal(err)
+- }
+- actionsRaw, err := r.server.CodeAction(r.ctx, &protocol.CodeActionParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- Range: rng,
+- Context: protocol.CodeActionContext{
+- Only: []protocol.CodeActionKind{"refactor.extract"},
+- },
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- var actions []protocol.CodeAction
+- for _, action := range actionsRaw {
+- if action.Command.Title == "Extract method" {
+- actions = append(actions, action)
+- }
+- }
+- // Hack: We assume that we only get one matching code action per range.
+- // TODO(rstambler): Support multiple code actions per test.
+- if len(actions) == 0 || len(actions) > 1 {
+- t.Fatalf("unexpected number of code actions, want 1, got %v", len(actions))
+- }
+- _, err = r.server.ExecuteCommand(r.ctx, &protocol.ExecuteCommandParams{
+- Command: actions[0].Command.Command,
+- Arguments: actions[0].Command.Arguments,
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- res := <-r.editRecv
+- for u, got := range res {
+- want := r.data.Golden(t, "methodextraction_"+tests.SpanName(spn), u.Filename(), func() ([]byte, error) {
+- return got, nil
+- })
+- if diff := compare.Bytes(want, got); diff != "" {
+- t.Errorf("method extraction failed for %s:\n%s", u.Filename(), diff)
+- }
+- }
+-}
+-
+-// TODO(rfindley): This handler needs more work. The output is still a bit hard
+-// to read (range diffs do not format nicely), and it is too entangled with hover.
+-func (r *runner) Definition(t *testing.T, _ span.Span, d tests.Definition) {
+- sm, err := r.data.Mapper(d.Src.URI())
+- if err != nil {
+- t.Fatal(err)
+- }
+- loc, err := sm.SpanLocation(d.Src)
+- if err != nil {
+- t.Fatalf("failed for %v: %v", d.Src, err)
+- }
+- tdpp := protocol.LocationTextDocumentPositionParams(loc)
+- var got []protocol.Location
+- var hover *protocol.Hover
+- if d.IsType {
+- params := &protocol.TypeDefinitionParams{
+- TextDocumentPositionParams: tdpp,
+- }
+- got, err = r.server.TypeDefinition(r.ctx, params)
+- } else {
+- params := &protocol.DefinitionParams{
+- TextDocumentPositionParams: tdpp,
+- }
+- got, err = r.server.Definition(r.ctx, params)
+- if err != nil {
+- t.Fatalf("failed for %v: %+v", d.Src, err)
+- }
+- v := &protocol.HoverParams{
+- TextDocumentPositionParams: tdpp,
+- }
+- hover, err = r.server.Hover(r.ctx, v)
+- }
+- if err != nil {
+- t.Fatalf("failed for %v: %v", d.Src, err)
+- }
+- dm, err := r.data.Mapper(d.Def.URI())
+- if err != nil {
+- t.Fatal(err)
+- }
+- def, err := dm.SpanLocation(d.Def)
+- if err != nil {
+- t.Fatal(err)
+- }
+- if !d.OnlyHover {
+- want := []protocol.Location{def}
+- if diff := cmp.Diff(want, got); diff != "" {
+- t.Fatalf("Definition(%s) mismatch (-want +got):\n%s", d.Src, diff)
+- }
+- }
+- didSomething := false
+- if hover != nil {
+- didSomething = true
+- tag := fmt.Sprintf("%s-hoverdef", d.Name)
+- want := string(r.data.Golden(t, tag, d.Src.URI().Filename(), func() ([]byte, error) {
+- return []byte(hover.Contents.Value), nil
+- }))
+- got := hover.Contents.Value
+- if diff := tests.DiffMarkdown(want, got); diff != "" {
+- t.Errorf("%s: markdown mismatch:\n%s", d.Src, diff)
+- }
+- }
+- if !d.OnlyHover {
+- didSomething = true
+- locURI := got[0].URI.SpanURI()
+- lm, err := r.data.Mapper(locURI)
+- if err != nil {
+- t.Fatal(err)
+- }
+- if def, err := lm.LocationSpan(got[0]); err != nil {
+- t.Fatalf("failed for %v: %v", got[0], err)
+- } else if def != d.Def {
+- t.Errorf("for %v got %v want %v", d.Src, def, d.Def)
+- }
+- }
+- if !didSomething {
+- t.Errorf("no tests ran for %s", d.Src.URI())
+- }
+-}
+-
+-func (r *runner) Implementation(t *testing.T, spn span.Span, wantSpans []span.Span) {
+- sm, err := r.data.Mapper(spn.URI())
+- if err != nil {
+- t.Fatal(err)
+- }
+- loc, err := sm.SpanLocation(spn)
+- if err != nil {
+- t.Fatal(err)
+- }
+- gotImpls, err := r.server.Implementation(r.ctx, &protocol.ImplementationParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- })
+- if err != nil {
+- t.Fatalf("Server.Implementation(%s): %v", spn, err)
+- }
+- gotLocs, err := tests.LocationsToSpans(r.data, gotImpls)
+- if err != nil {
+- t.Fatal(err)
+- }
+- sanitize := func(s string) string {
+- return strings.ReplaceAll(s, r.data.Config.Dir, "gopls/internal/lsp/testdata")
+- }
+- want := sanitize(tests.SortAndFormatSpans(wantSpans))
+- got := sanitize(tests.SortAndFormatSpans(gotLocs))
+- if got != want {
+- t.Errorf("implementations(%s):\n%s", sanitize(fmt.Sprint(spn)), diff.Unified("want", "got", want, got))
+- }
+-}
+-
+-func (r *runner) Highlight(t *testing.T, src span.Span, spans []span.Span) {
+- m, err := r.data.Mapper(src.URI())
+- if err != nil {
+- t.Fatal(err)
+- }
+- loc, err := m.SpanLocation(src)
+- if err != nil {
+- t.Fatal(err)
+- }
+- params := &protocol.DocumentHighlightParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+- highlights, err := r.server.DocumentHighlight(r.ctx, params)
+- if err != nil {
+- t.Fatalf("DocumentHighlight(%v) failed: %v", params, err)
+- }
+- var got []protocol.Range
+- for _, h := range highlights {
+- got = append(got, h.Range)
+- }
+-
+- var want []protocol.Range
+- for _, s := range spans {
+- rng, err := m.SpanRange(s)
+- if err != nil {
+- t.Fatalf("Mapper.SpanRange(%v) failed: %v", s, err)
+- }
+- want = append(want, rng)
+- }
+-
+- sortRanges := func(s []protocol.Range) {
+- sort.Slice(s, func(i, j int) bool {
+- return protocol.CompareRange(s[i], s[j]) < 0
+- })
+- }
+-
+- sortRanges(got)
+- sortRanges(want)
+-
+- if diff := cmp.Diff(want, got); diff != "" {
+- t.Errorf("DocumentHighlight(%v) mismatch (-want +got):\n%s", src, diff)
+- }
+-}
+-
+-func (r *runner) References(t *testing.T, src span.Span, itemList []span.Span) {
+- // This test is substantially the same as (*runner).References in source/source_test.go.
+- // TODO(adonovan): Factor (and remove fluff). Where should the common code live?
+-
+- sm, err := r.data.Mapper(src.URI())
+- if err != nil {
+- t.Fatal(err)
+- }
+- loc, err := sm.SpanLocation(src)
+- if err != nil {
+- t.Fatalf("failed for %v: %v", src, err)
+- }
+- for _, includeDeclaration := range []bool{true, false} {
+- t.Run(fmt.Sprintf("refs-declaration-%v", includeDeclaration), func(t *testing.T) {
+- want := make(map[protocol.Location]bool)
+- for i, pos := range itemList {
+- // We don't want the first result if we aren't including the declaration.
+- // TODO(adonovan): don't assume a single declaration:
+- // there may be >1 if corresponding methods are considered.
+- if i == 0 && !includeDeclaration {
+- continue
+- }
+- m, err := r.data.Mapper(pos.URI())
+- if err != nil {
+- t.Fatal(err)
+- }
+- loc, err := m.SpanLocation(pos)
+- if err != nil {
+- t.Fatalf("failed for %v: %v", src, err)
+- }
+- want[loc] = true
+- }
+- params := &protocol.ReferenceParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- Context: protocol.ReferenceContext{
+- IncludeDeclaration: includeDeclaration,
+- },
+- }
+- got, err := r.server.References(r.ctx, params)
+- if err != nil {
+- t.Fatalf("failed for %v: %v", src, err)
+- }
+-
+- sanitize := func(s string) string {
+- // In practice, CONFIGDIR means "gopls/internal/lsp/testdata".
+- return strings.ReplaceAll(s, r.data.Config.Dir, "CONFIGDIR")
+- }
+- formatLocation := func(loc protocol.Location) string {
+- return fmt.Sprintf("%s:%d.%d-%d.%d",
+- sanitize(string(loc.URI)),
+- loc.Range.Start.Line+1,
+- loc.Range.Start.Character+1,
+- loc.Range.End.Line+1,
+- loc.Range.End.Character+1)
+- }
+- toSlice := func(set map[protocol.Location]bool) []protocol.Location {
+- // TODO(adonovan): use generic maps.Keys(), someday.
+- list := make([]protocol.Location, 0, len(set))
+- for key := range set {
+- list = append(list, key)
+- }
+- return list
+- }
+- toString := func(locs []protocol.Location) string {
+- // TODO(adonovan): use generic JoinValues(locs, formatLocation).
+- strs := make([]string, len(locs))
+- for i, loc := range locs {
+- strs[i] = formatLocation(loc)
+- }
+- sort.Strings(strs)
+- return strings.Join(strs, "\n")
+- }
+- gotStr := toString(got)
+- wantStr := toString(toSlice(want))
+- if gotStr != wantStr {
+- t.Errorf("incorrect references (got %d, want %d) at %s:\n%s",
+- len(got), len(want),
+- formatLocation(loc),
+- diff.Unified("want", "got", wantStr, gotStr))
+- }
+- })
+- }
+-}
+-
+-func (r *runner) InlayHints(t *testing.T, spn span.Span) {
+- uri := spn.URI()
+- filename := uri.Filename()
+-
+- hints, err := r.server.InlayHint(r.ctx, &protocol.InlayHintParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- // TODO: add Range
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- // Map inlay hints to text edits.
+- edits := make([]protocol.TextEdit, len(hints))
+- for i, hint := range hints {
+- var paddingLeft, paddingRight string
+- if hint.PaddingLeft {
+- paddingLeft = " "
+- }
+- if hint.PaddingRight {
+- paddingRight = " "
+- }
+- edits[i] = protocol.TextEdit{
+- Range: protocol.Range{Start: hint.Position, End: hint.Position},
+- NewText: fmt.Sprintf("<%s%s%s>", paddingLeft, hint.Label[0].Value, paddingRight),
+- }
+- }
+-
+- m, err := r.data.Mapper(uri)
+- if err != nil {
+- t.Fatal(err)
+- }
+- got, _, err := source.ApplyProtocolEdits(m, edits)
+- if err != nil {
+- t.Error(err)
+- }
+-
+- withinlayHints := r.data.Golden(t, "inlayHint", filename, func() ([]byte, error) {
+- return got, nil
+- })
+-
+- if !bytes.Equal(withinlayHints, got) {
+- t.Errorf("inlay hints failed for %s, expected:\n%s\ngot:\n%s", filename, withinlayHints, got)
+- }
+-}
+-
+-func (r *runner) Rename(t *testing.T, spn span.Span, newText string) {
+- tag := fmt.Sprintf("%s-rename", newText)
+-
+- uri := spn.URI()
+- filename := uri.Filename()
+- sm, err := r.data.Mapper(uri)
+- if err != nil {
+- t.Fatal(err)
+- }
+- loc, err := sm.SpanLocation(spn)
+- if err != nil {
+- t.Fatalf("failed for %v: %v", spn, err)
+- }
+-
+- wedit, err := r.server.Rename(r.ctx, &protocol.RenameParams{
+- TextDocument: protocol.TextDocumentIdentifier{URI: loc.URI},
+- Position: loc.Range.Start,
+- NewName: newText,
+- })
+- if err != nil {
+- renamed := string(r.data.Golden(t, tag, filename, func() ([]byte, error) {
+- return []byte(err.Error()), nil
+- }))
+- if err.Error() != renamed {
+- t.Errorf("%s: rename failed for %s, expected:\n%v\ngot:\n%v\n", spn, newText, renamed, err)
+- }
+- return
+- }
+- res, err := applyTextDocumentEdits(r, wedit.DocumentChanges)
+- if err != nil {
+- t.Fatal(err)
+- }
+- var orderedURIs []string
+- for uri := range res {
+- orderedURIs = append(orderedURIs, string(uri))
+- }
+- sort.Strings(orderedURIs)
+-
+- // Print the name and content of each modified file,
+- // concatenated, and compare against the golden.
+- var buf bytes.Buffer
+- for i := 0; i < len(res); i++ {
+- if i != 0 {
+- buf.WriteByte('\n')
+- }
+- uri := span.URIFromURI(orderedURIs[i])
+- if len(res) > 1 {
+- buf.WriteString(filepath.Base(uri.Filename()))
+- buf.WriteString(":\n")
+- }
+- buf.Write(res[uri])
+- }
+- got := buf.Bytes()
+- want := r.data.Golden(t, tag, filename, func() ([]byte, error) {
+- return got, nil
+- })
+- if diff := compare.Bytes(want, got); diff != "" {
+- t.Errorf("rename failed for %s:\n%s", newText, diff)
+- }
+-}
+-
+-func (r *runner) PrepareRename(t *testing.T, src span.Span, want *source.PrepareItem) {
+- m, err := r.data.Mapper(src.URI())
+- if err != nil {
+- t.Fatal(err)
+- }
+- loc, err := m.SpanLocation(src)
+- if err != nil {
+- t.Fatalf("failed for %v: %v", src, err)
+- }
+- params := &protocol.PrepareRenameParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+- got, err := r.server.PrepareRename(context.Background(), params)
+- if err != nil {
+- t.Errorf("prepare rename failed for %v: got error: %v", src, err)
+- return
+- }
+-
+- // TODO(rfindley): can we consolidate on a single representation for
+- // PrepareRename results, and use cmp.Diff here?
+-
+- // PrepareRename may fail with no error if there was no object found at the
+- // position.
+- if got == nil {
+- if want.Text != "" { // expected an ident.
+- t.Errorf("prepare rename failed for %v: got nil", src)
+- }
+- return
+- }
+- if got.Range.Start == got.Range.End {
+- // Special case for 0-length ranges. Marks can't specify a 0-length range,
+- // so just compare the start.
+- if got.Range.Start != want.Range.Start {
+- t.Errorf("prepare rename failed: incorrect point, got %v want %v", got.Range.Start, want.Range.Start)
+- }
+- } else {
+- if got.Range != want.Range {
+- t.Errorf("prepare rename failed: incorrect range got %v want %v", got.Range, want.Range)
+- }
+- }
+- if got.Placeholder != want.Text {
+- t.Errorf("prepare rename failed: incorrect text got %v want %v", got.Placeholder, want.Text)
+- }
+-}
+-
+-func applyTextDocumentEdits(r *runner, edits []protocol.DocumentChanges) (map[span.URI][]byte, error) {
+- res := make(map[span.URI][]byte)
+- for _, docEdits := range edits {
+- if docEdits.TextDocumentEdit != nil {
+- uri := docEdits.TextDocumentEdit.TextDocument.URI.SpanURI()
+- var m *protocol.Mapper
+- // If we have already edited this file, we use the edited version (rather than the
+- // file in its original state) so that we preserve our initial changes.
+- if content, ok := res[uri]; ok {
+- m = protocol.NewMapper(uri, content)
+- } else {
+- var err error
+- if m, err = r.data.Mapper(uri); err != nil {
+- return nil, err
+- }
+- }
+- patched, _, err := source.ApplyProtocolEdits(m, docEdits.TextDocumentEdit.Edits)
+- if err != nil {
+- return nil, err
+- }
+- res[uri] = patched
+- }
+- }
+- return res, nil
+-}
+-
+-func (r *runner) Symbols(t *testing.T, uri span.URI, expectedSymbols []protocol.DocumentSymbol) {
+- params := &protocol.DocumentSymbolParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- }
+- got, err := r.server.DocumentSymbol(r.ctx, params)
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- symbols := make([]protocol.DocumentSymbol, len(got))
+- for i, s := range got {
+- s, ok := s.(protocol.DocumentSymbol)
+- if !ok {
+- t.Fatalf("%v: wanted []DocumentSymbols but got %v", uri, got)
+- }
+- symbols[i] = s
+- }
+-
+- // Sort by position to make it easier to find errors.
+- sortSymbols := func(s []protocol.DocumentSymbol) {
+- sort.Slice(s, func(i, j int) bool {
+- return protocol.CompareRange(s[i].SelectionRange, s[j].SelectionRange) < 0
+- })
+- }
+- sortSymbols(expectedSymbols)
+- sortSymbols(symbols)
+-
+- // Ignore 'Range' here as it is difficult (impossible?) to express
+- // multi-line ranges in the packagestest framework.
+- ignoreRange := cmpopts.IgnoreFields(protocol.DocumentSymbol{}, "Range")
+- if diff := cmp.Diff(expectedSymbols, symbols, ignoreRange); diff != "" {
+- t.Errorf("mismatching symbols (-want +got)\n%s", diff)
+- }
+-}
+-
+-func (r *runner) WorkspaceSymbols(t *testing.T, uri span.URI, query string, typ tests.WorkspaceSymbolsTestType) {
+- matcher := tests.WorkspaceSymbolsTestTypeToMatcher(typ)
+-
+- original := r.server.session.Options()
+- modified := original
+- modified.SymbolMatcher = matcher
+- r.server.session.SetOptions(modified)
+- defer r.server.session.SetOptions(original)
+-
+- params := &protocol.WorkspaceSymbolParams{
+- Query: query,
+- }
+- gotSymbols, err := r.server.Symbol(r.ctx, params)
+- if err != nil {
+- t.Fatal(err)
+- }
+- got, err := tests.WorkspaceSymbolsString(r.ctx, r.data, uri, gotSymbols)
+- if err != nil {
+- t.Fatal(err)
+- }
+- got = filepath.ToSlash(tests.Normalize(got, r.normalizers))
+- want := string(r.data.Golden(t, fmt.Sprintf("workspace_symbol-%s-%s", strings.ToLower(string(matcher)), query), uri.Filename(), func() ([]byte, error) {
+- return []byte(got), nil
+- }))
+- if diff := compare.Text(want, got); diff != "" {
+- t.Error(diff)
+- }
+-}
+-
+-func (r *runner) SignatureHelp(t *testing.T, spn span.Span, want *protocol.SignatureHelp) {
+- m, err := r.data.Mapper(spn.URI())
+- if err != nil {
+- t.Fatal(err)
+- }
+- loc, err := m.SpanLocation(spn)
+- if err != nil {
+- t.Fatalf("failed for %v: %v", loc, err)
+- }
+- params := &protocol.SignatureHelpParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+- got, err := r.server.SignatureHelp(r.ctx, params)
+- if err != nil {
+- // Only fail if we got an error we did not expect.
+- if want != nil {
+- t.Fatal(err)
+- }
+- return
+- }
+- if want == nil {
+- if got != nil {
+- t.Errorf("expected no signature, got %v", got)
+- }
+- return
+- }
+- if got == nil {
+- t.Fatalf("expected %v, got nil", want)
+- }
+- if diff := tests.DiffSignatures(spn, want, got); diff != "" {
+- t.Error(diff)
+- }
+-}
+-
+-func (r *runner) Link(t *testing.T, uri span.URI, wantLinks []tests.Link) {
+- m, err := r.data.Mapper(uri)
+- if err != nil {
+- t.Fatal(err)
+- }
+- got, err := r.server.DocumentLink(r.ctx, &protocol.DocumentLinkParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- if diff := tests.DiffLinks(m, wantLinks, got); diff != "" {
+- t.Error(diff)
+- }
+-}
+-
+-func (r *runner) AddImport(t *testing.T, uri span.URI, expectedImport string) {
+- cmd, err := command.NewListKnownPackagesCommand("List Known Packages", command.URIArg{
+- URI: protocol.URIFromSpanURI(uri),
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- resp, err := r.server.executeCommand(r.ctx, &protocol.ExecuteCommandParams{
+- Command: cmd.Command,
+- Arguments: cmd.Arguments,
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- res := resp.(command.ListKnownPackagesResult)
+- var hasPkg bool
+- for _, p := range res.Packages {
+- if p == expectedImport {
+- hasPkg = true
+- break
+- }
+- }
+- if !hasPkg {
+- t.Fatalf("%s: got %v packages\nwant contains %q", command.ListKnownPackages, res.Packages, expectedImport)
+- }
+- cmd, err = command.NewAddImportCommand("Add Imports", command.AddImportArgs{
+- URI: protocol.URIFromSpanURI(uri),
+- ImportPath: expectedImport,
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- _, err = r.server.executeCommand(r.ctx, &protocol.ExecuteCommandParams{
+- Command: cmd.Command,
+- Arguments: cmd.Arguments,
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- got := (<-r.editRecv)[uri]
+- want := r.data.Golden(t, "addimport", uri.Filename(), func() ([]byte, error) {
+- return []byte(got), nil
+- })
+- if want == nil {
+- t.Fatalf("golden file %q not found", uri.Filename())
+- }
+- if diff := compare.Bytes(want, got); diff != "" {
+- t.Errorf("%s mismatch\n%s", command.AddImport, diff)
+- }
+-}
+-
+-func (r *runner) SelectionRanges(t *testing.T, spn span.Span) {
+- uri := spn.URI()
+- sm, err := r.data.Mapper(uri)
+- if err != nil {
+- t.Fatal(err)
+- }
+- loc, err := sm.SpanLocation(spn)
+- if err != nil {
+- t.Error(err)
+- }
+-
+- ranges, err := r.server.selectionRange(r.ctx, &protocol.SelectionRangeParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(uri),
+- },
+- Positions: []protocol.Position{loc.Range.Start},
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- sb := &strings.Builder{}
+- for i, path := range ranges {
+- fmt.Fprintf(sb, "Ranges %d: ", i)
+- rng := path
+- for {
+- s, e, err := sm.RangeOffsets(rng.Range)
+- if err != nil {
+- t.Error(err)
+- }
+-
+- var snippet string
+- if e-s < 30 {
+- snippet = string(sm.Content[s:e])
+- } else {
+- snippet = string(sm.Content[s:s+15]) + "..." + string(sm.Content[e-15:e])
+- }
+-
+- fmt.Fprintf(sb, "\n\t%v %q", rng.Range, strings.ReplaceAll(snippet, "\n", "\\n"))
+-
+- if rng.Parent == nil {
+- break
+- }
+- rng = *rng.Parent
+- }
+- sb.WriteRune('\n')
+- }
+- got := sb.String()
+-
+- testName := "selectionrange_" + tests.SpanName(spn)
+- want := r.data.Golden(t, testName, uri.Filename(), func() ([]byte, error) {
+- return []byte(got), nil
+- })
+- if want == nil {
+- t.Fatalf("golden file %q not found", uri.Filename())
+- }
+- if diff := compare.Text(got, string(want)); diff != "" {
+- t.Errorf("%s mismatch\n%s", testName, diff)
+- }
+-}
+-
+-func (r *runner) collectDiagnostics(view *cache.View) {
+- if r.diagnostics != nil {
+- return
+- }
+- r.diagnostics = make(map[span.URI][]*source.Diagnostic)
+-
+- snapshot, release, err := view.Snapshot()
+- if err != nil {
+- panic(err)
+- }
+- defer release()
+-
+- // Always run diagnostics with analysis.
+- r.server.diagnose(r.ctx, snapshot, true)
+- for uri, reports := range r.server.diagnostics {
+- for _, report := range reports.reports {
+- for _, d := range report.diags {
+- r.diagnostics[uri] = append(r.diagnostics[uri], d)
+- }
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/mod/code_lens.go b/gopls/internal/lsp/mod/code_lens.go
+--- a/gopls/internal/lsp/mod/code_lens.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/mod/code_lens.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,191 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package mod
+-
+-import (
+- "context"
+- "fmt"
+- "os"
+- "path/filepath"
+-
+- "golang.org/x/mod/modfile"
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-// LensFuncs returns the supported lensFuncs for go.mod files.
+-func LensFuncs() map[command.Command]source.LensFunc {
+- return map[command.Command]source.LensFunc{
+- command.UpgradeDependency: upgradeLenses,
+- command.Tidy: tidyLens,
+- command.Vendor: vendorLens,
+- command.RunGovulncheck: vulncheckLenses,
+- }
+-}
+-
+-func upgradeLenses(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle) ([]protocol.CodeLens, error) {
+- pm, err := snapshot.ParseMod(ctx, fh)
+- if err != nil || pm.File == nil {
+- return nil, err
+- }
+- uri := protocol.URIFromSpanURI(fh.URI())
+- reset, err := command.NewResetGoModDiagnosticsCommand("Reset go.mod diagnostics", command.ResetGoModDiagnosticsArgs{URIArg: command.URIArg{URI: uri}})
+- if err != nil {
+- return nil, err
+- }
+- // Put the `Reset go.mod diagnostics` codelens on the module statement.
+- modrng, err := moduleStmtRange(fh, pm)
+- if err != nil {
+- return nil, err
+- }
+- lenses := []protocol.CodeLens{{Range: modrng, Command: &reset}}
+- if len(pm.File.Require) == 0 {
+- // Nothing to upgrade.
+- return lenses, nil
+- }
+- var requires []string
+- for _, req := range pm.File.Require {
+- requires = append(requires, req.Mod.Path)
+- }
+- checkUpgrade, err := command.NewCheckUpgradesCommand("Check for upgrades", command.CheckUpgradesArgs{
+- URI: uri,
+- Modules: requires,
+- })
+- if err != nil {
+- return nil, err
+- }
+- upgradeTransitive, err := command.NewUpgradeDependencyCommand("Upgrade transitive dependencies", command.DependencyArgs{
+- URI: uri,
+- AddRequire: false,
+- GoCmdArgs: []string{"-d", "-u", "-t", "./..."},
+- })
+- if err != nil {
+- return nil, err
+- }
+- upgradeDirect, err := command.NewUpgradeDependencyCommand("Upgrade direct dependencies", command.DependencyArgs{
+- URI: uri,
+- AddRequire: false,
+- GoCmdArgs: append([]string{"-d"}, requires...),
+- })
+- if err != nil {
+- return nil, err
+- }
+-
+- // Put the upgrade code lenses above the first require block or statement.
+- rng, err := firstRequireRange(fh, pm)
+- if err != nil {
+- return nil, err
+- }
+-
+- return append(lenses, []protocol.CodeLens{
+- {Range: rng, Command: &checkUpgrade},
+- {Range: rng, Command: &upgradeTransitive},
+- {Range: rng, Command: &upgradeDirect},
+- }...), nil
+-}
+-
+-func tidyLens(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle) ([]protocol.CodeLens, error) {
+- pm, err := snapshot.ParseMod(ctx, fh)
+- if err != nil || pm.File == nil {
+- return nil, err
+- }
+- uri := protocol.URIFromSpanURI(fh.URI())
+- cmd, err := command.NewTidyCommand("Run go mod tidy", command.URIArgs{URIs: []protocol.DocumentURI{uri}})
+- if err != nil {
+- return nil, err
+- }
+- rng, err := moduleStmtRange(fh, pm)
+- if err != nil {
+- return nil, err
+- }
+- return []protocol.CodeLens{{
+- Range: rng,
+- Command: &cmd,
+- }}, nil
+-}
+-
+-func vendorLens(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle) ([]protocol.CodeLens, error) {
+- pm, err := snapshot.ParseMod(ctx, fh)
+- if err != nil || pm.File == nil {
+- return nil, err
+- }
+- if len(pm.File.Require) == 0 {
+- // Nothing to vendor.
+- return nil, nil
+- }
+- rng, err := moduleStmtRange(fh, pm)
+- if err != nil {
+- return nil, err
+- }
+- title := "Create vendor directory"
+- uri := protocol.URIFromSpanURI(fh.URI())
+- cmd, err := command.NewVendorCommand(title, command.URIArg{URI: uri})
+- if err != nil {
+- return nil, err
+- }
+- // Change the message depending on whether or not the module already has a
+- // vendor directory.
+- vendorDir := filepath.Join(filepath.Dir(fh.URI().Filename()), "vendor")
+- if info, _ := os.Stat(vendorDir); info != nil && info.IsDir() {
+- title = "Sync vendor directory"
+- }
+- return []protocol.CodeLens{{Range: rng, Command: &cmd}}, nil
+-}
+-
+-func moduleStmtRange(fh source.FileHandle, pm *source.ParsedModule) (protocol.Range, error) {
+- if pm.File == nil || pm.File.Module == nil || pm.File.Module.Syntax == nil {
+- return protocol.Range{}, fmt.Errorf("no module statement in %s", fh.URI())
+- }
+- syntax := pm.File.Module.Syntax
+- return pm.Mapper.OffsetRange(syntax.Start.Byte, syntax.End.Byte)
+-}
+-
+-// firstRequireRange returns the range for the first "require" in the given
+-// go.mod file. This is either a require block or an individual require line.
+-func firstRequireRange(fh source.FileHandle, pm *source.ParsedModule) (protocol.Range, error) {
+- if len(pm.File.Require) == 0 {
+- return protocol.Range{}, fmt.Errorf("no requires in the file %s", fh.URI())
+- }
+- var start, end modfile.Position
+- for _, stmt := range pm.File.Syntax.Stmt {
+- if b, ok := stmt.(*modfile.LineBlock); ok && len(b.Token) == 1 && b.Token[0] == "require" {
+- start, end = b.Span()
+- break
+- }
+- }
+-
+- firstRequire := pm.File.Require[0].Syntax
+- if start.Byte == 0 || firstRequire.Start.Byte < start.Byte {
+- start, end = firstRequire.Start, firstRequire.End
+- }
+- return pm.Mapper.OffsetRange(start.Byte, end.Byte)
+-}
+-
+-func vulncheckLenses(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle) ([]protocol.CodeLens, error) {
+- pm, err := snapshot.ParseMod(ctx, fh)
+- if err != nil || pm.File == nil {
+- return nil, err
+- }
+- // Place the codelenses near the module statement.
+- // A module may not have the require block,
+- // but vulnerabilities can exist in standard libraries.
+- uri := protocol.URIFromSpanURI(fh.URI())
+- rng, err := moduleStmtRange(fh, pm)
+- if err != nil {
+- return nil, err
+- }
+-
+- vulncheck, err := command.NewRunGovulncheckCommand("Run govulncheck", command.VulncheckArgs{
+- URI: uri,
+- Pattern: "./...",
+- })
+- if err != nil {
+- return nil, err
+- }
+- return []protocol.CodeLens{
+- {Range: rng, Command: &vulncheck},
+- }, nil
+-}
+diff -urN a/gopls/internal/lsp/mod/diagnostics.go b/gopls/internal/lsp/mod/diagnostics.go
+--- a/gopls/internal/lsp/mod/diagnostics.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/mod/diagnostics.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,561 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package mod provides core features related to go.mod file
+-// handling for use by Go editors and tools.
+-package mod
+-
+-import (
+- "context"
+- "fmt"
+- "sort"
+- "strings"
+-
+- "golang.org/x/mod/modfile"
+- "golang.org/x/mod/semver"
+- "golang.org/x/tools/gopls/internal/govulncheck"
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/vuln/osv"
+-)
+-
+-// Diagnostics returns diagnostics for the modules in the workspace.
+-//
+-// It waits for completion of type-checking of all active packages.
+-func Diagnostics(ctx context.Context, snapshot source.Snapshot) (map[span.URI][]*source.Diagnostic, error) {
+- ctx, done := event.Start(ctx, "mod.Diagnostics", source.SnapshotLabels(snapshot)...)
+- defer done()
+-
+- return collectDiagnostics(ctx, snapshot, ModDiagnostics)
+-}
+-
+-// UpgradeDiagnostics returns upgrade diagnostics for the modules in the
+-// workspace with known upgrades.
+-func UpgradeDiagnostics(ctx context.Context, snapshot source.Snapshot) (map[span.URI][]*source.Diagnostic, error) {
+- ctx, done := event.Start(ctx, "mod.UpgradeDiagnostics", source.SnapshotLabels(snapshot)...)
+- defer done()
+-
+- return collectDiagnostics(ctx, snapshot, ModUpgradeDiagnostics)
+-}
+-
+-// VulnerabilityDiagnostics returns vulnerability diagnostics for the active modules in the
+-// workspace with known vulnerabilities.
+-func VulnerabilityDiagnostics(ctx context.Context, snapshot source.Snapshot) (map[span.URI][]*source.Diagnostic, error) {
+- ctx, done := event.Start(ctx, "mod.VulnerabilityDiagnostics", source.SnapshotLabels(snapshot)...)
+- defer done()
+-
+- return collectDiagnostics(ctx, snapshot, ModVulnerabilityDiagnostics)
+-}
+-
+-func collectDiagnostics(ctx context.Context, snapshot source.Snapshot, diagFn func(context.Context, source.Snapshot, source.FileHandle) ([]*source.Diagnostic, error)) (map[span.URI][]*source.Diagnostic, error) {
+- reports := make(map[span.URI][]*source.Diagnostic)
+- for _, uri := range snapshot.ModFiles() {
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return nil, err
+- }
+- reports[fh.URI()] = []*source.Diagnostic{}
+- diagnostics, err := diagFn(ctx, snapshot, fh)
+- if err != nil {
+- return nil, err
+- }
+- for _, d := range diagnostics {
+- fh, err := snapshot.GetFile(ctx, d.URI)
+- if err != nil {
+- return nil, err
+- }
+- reports[fh.URI()] = append(reports[fh.URI()], d)
+- }
+- }
+- return reports, nil
+-}
+-
+-// ModDiagnostics waits for completion of type-checking of all active
+-// packages, then returns diagnostics from diagnosing the packages in
+-// the workspace and from tidying the go.mod file.
+-func ModDiagnostics(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle) (diagnostics []*source.Diagnostic, err error) {
+- pm, err := snapshot.ParseMod(ctx, fh)
+- if err != nil {
+- if pm == nil || len(pm.ParseErrors) == 0 {
+- return nil, err
+- }
+- return pm.ParseErrors, nil
+- }
+-
+- // Packages in the workspace can contribute diagnostics to go.mod files.
+- // TODO(rfindley): Try to avoid type checking all packages in the workspace here,
+- // for every go.mod file. If gc_details is enabled, it looks like this could lead to extra
+- // go command invocations (as gc details is not memoized).
+- active, err := snapshot.ActiveMetadata(ctx)
+- if err != nil && !source.IsNonFatalGoModError(err) {
+- event.Error(ctx, fmt.Sprintf("workspace packages: diagnosing %s", pm.URI), err)
+- }
+- if err == nil {
+- // Note: the call to PackageDiagnostics below may be the first operation
+- // after the initial metadata load, and therefore result in type-checking
+- // or loading many packages.
+- ids := make([]source.PackageID, len(active))
+- for i, meta := range active {
+- ids[i] = meta.ID
+- }
+- diags, err := snapshot.PackageDiagnostics(ctx, ids...)
+- if err != nil {
+- return nil, err
+- }
+- diagnostics = append(diagnostics, diags[fh.URI()]...)
+- }
+-
+- tidied, err := snapshot.ModTidy(ctx, pm)
+- if err != nil && !source.IsNonFatalGoModError(err) {
+- event.Error(ctx, fmt.Sprintf("tidy: diagnosing %s", pm.URI), err)
+- }
+- if err == nil {
+- for _, d := range tidied.Diagnostics {
+- if d.URI != fh.URI() {
+- continue
+- }
+- diagnostics = append(diagnostics, d)
+- }
+- }
+- return diagnostics, nil
+-}
+-
+-// ModUpgradeDiagnostics adds upgrade quick fixes for individual modules if the upgrades
+-// are recorded in the view.
+-func ModUpgradeDiagnostics(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle) (upgradeDiagnostics []*source.Diagnostic, err error) {
+- pm, err := snapshot.ParseMod(ctx, fh)
+- if err != nil {
+- // Don't return an error if there are parse error diagnostics to be shown, but also do not
+- // continue since we won't be able to show the upgrade diagnostics.
+- if pm != nil && len(pm.ParseErrors) != 0 {
+- return nil, nil
+- }
+- return nil, err
+- }
+-
+- upgrades := snapshot.View().ModuleUpgrades(fh.URI())
+- for _, req := range pm.File.Require {
+- ver, ok := upgrades[req.Mod.Path]
+- if !ok || req.Mod.Version == ver {
+- continue
+- }
+- rng, err := pm.Mapper.OffsetRange(req.Syntax.Start.Byte, req.Syntax.End.Byte)
+- if err != nil {
+- return nil, err
+- }
+- // Upgrade to the exact version we offer the user, not the most recent.
+- title := fmt.Sprintf("%s%v", upgradeCodeActionPrefix, ver)
+- cmd, err := command.NewUpgradeDependencyCommand(title, command.DependencyArgs{
+- URI: protocol.URIFromSpanURI(fh.URI()),
+- AddRequire: false,
+- GoCmdArgs: []string{req.Mod.Path + "@" + ver},
+- })
+- if err != nil {
+- return nil, err
+- }
+- upgradeDiagnostics = append(upgradeDiagnostics, &source.Diagnostic{
+- URI: fh.URI(),
+- Range: rng,
+- Severity: protocol.SeverityInformation,
+- Source: source.UpgradeNotification,
+- Message: fmt.Sprintf("%v can be upgraded", req.Mod.Path),
+- SuggestedFixes: []source.SuggestedFix{source.SuggestedFixFromCommand(cmd, protocol.QuickFix)},
+- })
+- }
+-
+- return upgradeDiagnostics, nil
+-}
+-
+-const upgradeCodeActionPrefix = "Upgrade to "
+-
+-// ModVulnerabilityDiagnostics adds diagnostics for vulnerabilities in individual modules
+-// if the vulnerability is recorded in the view.
+-func ModVulnerabilityDiagnostics(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle) (vulnDiagnostics []*source.Diagnostic, err error) {
+- pm, err := snapshot.ParseMod(ctx, fh)
+- if err != nil {
+- // Don't return an error if there are parse error diagnostics to be shown, but also do not
+- // continue since we won't be able to show the vulnerability diagnostics.
+- if pm != nil && len(pm.ParseErrors) != 0 {
+- return nil, nil
+- }
+- return nil, err
+- }
+-
+- diagSource := source.Govulncheck
+- vs := snapshot.View().Vulnerabilities(fh.URI())[fh.URI()]
+- if vs == nil && snapshot.View().Options().Vulncheck == source.ModeVulncheckImports {
+- vs, err = snapshot.ModVuln(ctx, fh.URI())
+- if err != nil {
+- return nil, err
+- }
+- diagSource = source.Vulncheck
+- }
+- if vs == nil || len(vs.Vulns) == 0 {
+- return nil, nil
+- }
+-
+- suggestRunOrResetGovulncheck, err := suggestGovulncheckAction(diagSource == source.Govulncheck, fh.URI())
+- if err != nil {
+- // must not happen
+- return nil, err // TODO: bug report
+- }
+- type modVuln struct {
+- mod *govulncheck.Module
+- vuln *govulncheck.Vuln
+- }
+- vulnsByModule := make(map[string][]modVuln)
+- for _, vuln := range vs.Vulns {
+- for _, mod := range vuln.Modules {
+- vulnsByModule[mod.Path] = append(vulnsByModule[mod.Path], modVuln{mod, vuln})
+- }
+- }
+-
+- for _, req := range pm.File.Require {
+- vulns := vulnsByModule[req.Mod.Path]
+- if len(vulns) == 0 {
+- continue
+- }
+- // note: req.Syntax is the line corresponding to 'require', which means
+- // req.Syntax.Start can point to the beginning of the "require" keyword
+- // for a single line require (e.g. "require golang.org/x/mod v0.0.0").
+- start := req.Syntax.Start.Byte
+- if len(req.Syntax.Token) == 3 {
+- start += len("require ")
+- }
+- rng, err := pm.Mapper.OffsetRange(start, req.Syntax.End.Byte)
+- if err != nil {
+- return nil, err
+- }
+- // Map affecting vulns to 'warning' level diagnostics,
+- // others to 'info' level diagnostics.
+- // Fixes will include only the upgrades for warning level diagnostics.
+- var warningFixes, infoFixes []source.SuggestedFix
+- var warning, info []string
+- var relatedInfo []protocol.DiagnosticRelatedInformation
+- for _, mv := range vulns {
+- mod, vuln := mv.mod, mv.vuln
+- // It is possible that the source code was changed since the last
+- // govulncheck run and information in the `vulns` info is stale.
+- // For example, imagine that a user is in the middle of updating
+- // problematic modules detected by the govulncheck run by applying
+- // quick fixes. Stale diagnostics can be confusing and prevent the
+- // user from quickly locating the next module to fix.
+- // Ideally we should rerun the analysis with the updated module
+- // dependencies or any other code changes, but we are not yet
+- // in the position of automatically triggering the analysis
+- // (govulncheck can take a while). We also don't know exactly what
+- // part of source code was changed since `vulns` was computed.
+- // As a heuristic, we assume that a user upgrades the affecting
+- // module to the version with the fix or the latest one, and if the
+- // version in the require statement is equal to or higher than the
+- // fixed version, skip generating a diagnostic about the vulnerability.
+- // Eventually, the user has to rerun govulncheck.
+- if mod.FixedVersion != "" && semver.IsValid(req.Mod.Version) && semver.Compare(mod.FixedVersion, req.Mod.Version) <= 0 {
+- continue
+- }
+- if !vuln.IsCalled() {
+- info = append(info, vuln.OSV.ID)
+- } else {
+- warning = append(warning, vuln.OSV.ID)
+- relatedInfo = append(relatedInfo, listRelatedInfo(ctx, snapshot, vuln)...)
+- }
+- // Upgrade to the exact version we offer the user, not the most recent.
+- if fixedVersion := mod.FixedVersion; semver.IsValid(fixedVersion) && semver.Compare(req.Mod.Version, fixedVersion) < 0 {
+- cmd, err := getUpgradeCodeAction(fh, req, fixedVersion)
+- if err != nil {
+- return nil, err // TODO: bug report
+- }
+- sf := source.SuggestedFixFromCommand(cmd, protocol.QuickFix)
+- if !vuln.IsCalled() {
+- infoFixes = append(infoFixes, sf)
+- } else {
+- warningFixes = append(warningFixes, sf)
+- }
+- }
+- }
+-
+- if len(warning) == 0 && len(info) == 0 {
+- continue
+- }
+- // Add an upgrade for module@latest.
+- // TODO(suzmue): verify if latest is the same as fixedVersion.
+- latest, err := getUpgradeCodeAction(fh, req, "latest")
+- if err != nil {
+- return nil, err // TODO: bug report
+- }
+- sf := source.SuggestedFixFromCommand(latest, protocol.QuickFix)
+- if len(warningFixes) > 0 {
+- warningFixes = append(warningFixes, sf)
+- }
+- if len(infoFixes) > 0 {
+- infoFixes = append(infoFixes, sf)
+- }
+-
+- sort.Strings(warning)
+- sort.Strings(info)
+-
+- if len(warning) > 0 {
+- warningFixes = append(warningFixes, suggestRunOrResetGovulncheck)
+- vulnDiagnostics = append(vulnDiagnostics, &source.Diagnostic{
+- URI: fh.URI(),
+- Range: rng,
+- Severity: protocol.SeverityWarning,
+- Source: diagSource,
+- Message: getVulnMessage(req.Mod.Path, warning, true, diagSource == source.Govulncheck),
+- SuggestedFixes: warningFixes,
+- Related: relatedInfo,
+- })
+- }
+- if len(info) > 0 {
+- infoFixes = append(infoFixes, suggestRunOrResetGovulncheck)
+- vulnDiagnostics = append(vulnDiagnostics, &source.Diagnostic{
+- URI: fh.URI(),
+- Range: rng,
+- Severity: protocol.SeverityInformation,
+- Source: diagSource,
+- Message: getVulnMessage(req.Mod.Path, info, false, diagSource == source.Govulncheck),
+- SuggestedFixes: infoFixes,
+- Related: relatedInfo,
+- })
+- }
+- }
+-
+- // TODO(hyangah): place this diagnostic on the `go` directive or `toolchain` directive
+- // after https://go.dev/issue/57001.
+- const diagnoseStdLib = false
+- if diagnoseStdLib {
+- // Add standard library vulnerabilities.
+- stdlibVulns := vulnsByModule["stdlib"]
+- if len(stdlibVulns) == 0 {
+- return vulnDiagnostics, nil
+- }
+-
+- // Put the standard library diagnostic on the module declaration.
+- rng, err := pm.Mapper.OffsetRange(pm.File.Module.Syntax.Start.Byte, pm.File.Module.Syntax.End.Byte)
+- if err != nil {
+- return vulnDiagnostics, nil // TODO: bug report
+- }
+-
+- stdlib := stdlibVulns[0].mod.FoundVersion
+- var warning, info []string
+- var relatedInfo []protocol.DiagnosticRelatedInformation
+- for _, mv := range stdlibVulns {
+- vuln := mv.vuln
+- stdlib = mv.mod.FoundVersion
+- if !vuln.IsCalled() {
+- info = append(info, vuln.OSV.ID)
+- } else {
+- warning = append(warning, vuln.OSV.ID)
+- relatedInfo = append(relatedInfo, listRelatedInfo(ctx, snapshot, vuln)...)
+- }
+- }
+- if len(warning) > 0 {
+- fixes := []source.SuggestedFix{suggestRunOrResetGovulncheck}
+- vulnDiagnostics = append(vulnDiagnostics, &source.Diagnostic{
+- URI: fh.URI(),
+- Range: rng,
+- Severity: protocol.SeverityWarning,
+- Source: diagSource,
+- Message: getVulnMessage(stdlib, warning, true, diagSource == source.Govulncheck),
+- SuggestedFixes: fixes,
+- Related: relatedInfo,
+- })
+- }
+- if len(info) > 0 {
+- fixes := []source.SuggestedFix{suggestRunOrResetGovulncheck}
+- vulnDiagnostics = append(vulnDiagnostics, &source.Diagnostic{
+- URI: fh.URI(),
+- Range: rng,
+- Severity: protocol.SeverityInformation,
+- Source: diagSource,
+- Message: getVulnMessage(stdlib, info, false, diagSource == source.Govulncheck),
+- SuggestedFixes: fixes,
+- Related: relatedInfo,
+- })
+- }
+- }
+-
+- return vulnDiagnostics, nil
+-}
+-
+-// suggestGovulncheckAction returns a code action that suggests either run govulncheck
+-// for more accurate investigation (if the present vulncheck diagnostics are based on
+-// analysis less accurate than govulncheck) or reset the existing govulncheck result
+-// (if the present vulncheck diagnostics are already based on govulncheck run).
+-func suggestGovulncheckAction(fromGovulncheck bool, uri span.URI) (source.SuggestedFix, error) {
+- if fromGovulncheck {
+- resetVulncheck, err := command.NewResetGoModDiagnosticsCommand("Reset govulncheck result", command.ResetGoModDiagnosticsArgs{
+- URIArg: command.URIArg{URI: protocol.DocumentURI(uri)},
+- DiagnosticSource: string(source.Govulncheck),
+- })
+- if err != nil {
+- return source.SuggestedFix{}, err
+- }
+- return source.SuggestedFixFromCommand(resetVulncheck, protocol.QuickFix), nil
+- }
+- vulncheck, err := command.NewRunGovulncheckCommand("Run govulncheck to verify", command.VulncheckArgs{
+- URI: protocol.DocumentURI(uri),
+- Pattern: "./...",
+- })
+- if err != nil {
+- return source.SuggestedFix{}, err
+- }
+- return source.SuggestedFixFromCommand(vulncheck, protocol.QuickFix), nil
+-}
+-
+-func getVulnMessage(mod string, vulns []string, used, fromGovulncheck bool) string {
+- var b strings.Builder
+- if used {
+- switch len(vulns) {
+- case 1:
+- fmt.Fprintf(&b, "%v has a vulnerability used in the code: %v.", mod, vulns[0])
+- default:
+- fmt.Fprintf(&b, "%v has vulnerabilities used in the code: %v.", mod, strings.Join(vulns, ", "))
+- }
+- } else {
+- if fromGovulncheck {
+- switch len(vulns) {
+- case 1:
+- fmt.Fprintf(&b, "%v has a vulnerability %v that is not used in the code.", mod, vulns[0])
+- default:
+- fmt.Fprintf(&b, "%v has known vulnerabilities %v that are not used in the code.", mod, strings.Join(vulns, ", "))
+- }
+- } else {
+- switch len(vulns) {
+- case 1:
+- fmt.Fprintf(&b, "%v has a vulnerability %v.", mod, vulns[0])
+- default:
+- fmt.Fprintf(&b, "%v has known vulnerabilities %v.", mod, strings.Join(vulns, ", "))
+- }
+- }
+- }
+- return b.String()
+-}
+-
+-func listRelatedInfo(ctx context.Context, snapshot source.Snapshot, vuln *govulncheck.Vuln) []protocol.DiagnosticRelatedInformation {
+- var ri []protocol.DiagnosticRelatedInformation
+- for _, m := range vuln.Modules {
+- for _, p := range m.Packages {
+- for _, c := range p.CallStacks {
+- if len(c.Frames) == 0 {
+- continue
+- }
+- entry := c.Frames[0]
+- pos := entry.Position
+- if pos.Filename == "" {
+- continue // token.Position Filename is an optional field.
+- }
+- uri := span.URIFromPath(pos.Filename)
+- startPos := protocol.Position{
+- Line: uint32(pos.Line) - 1,
+- // We need to read the file contents to precisesly map
+- // token.Position (pos) to the UTF16-based column offset
+- // protocol.Position requires. That can be expensive.
+- // We need this related info to just help users to open
+- // the entry points of the callstack and once the file is
+- // open, we will compute the precise location based on the
+- // open file contents. So, use the beginning of the line
+- // as the position here instead of precise UTF16-based
+- // position computation.
+- Character: 0,
+- }
+- ri = append(ri, protocol.DiagnosticRelatedInformation{
+- Location: protocol.Location{
+- URI: protocol.URIFromSpanURI(uri),
+- Range: protocol.Range{
+- Start: startPos,
+- End: startPos,
+- },
+- },
+- Message: fmt.Sprintf("[%v] %v -> %v.%v", vuln.OSV.ID, entry.Name(), p.Path, c.Symbol),
+- })
+- }
+- }
+- }
+- return ri
+-}
+-
+-func formatMessage(v *govulncheck.Vuln) string {
+- details := []byte(v.OSV.Details)
+- // Remove any new lines that are not preceded or followed by a new line.
+- for i, r := range details {
+- if r == '\n' && i > 0 && details[i-1] != '\n' && i+1 < len(details) && details[i+1] != '\n' {
+- details[i] = ' '
+- }
+- }
+- return strings.TrimSpace(strings.Replace(string(details), "\n\n", "\n\n ", -1))
+-}
+-
+-// href returns the url for the vulnerability information.
+-// Eventually we should retrieve the url embedded in the osv.Entry.
+-// While vuln.go.dev is under development, this always returns
+-// the page in pkg.go.dev.
+-func href(vuln *osv.Entry) string {
+- return fmt.Sprintf("https://pkg.go.dev/vuln/%s", vuln.ID)
+-}
+-
+-func getUpgradeCodeAction(fh source.FileHandle, req *modfile.Require, version string) (protocol.Command, error) {
+- cmd, err := command.NewUpgradeDependencyCommand(upgradeTitle(version), command.DependencyArgs{
+- URI: protocol.URIFromSpanURI(fh.URI()),
+- AddRequire: false,
+- GoCmdArgs: []string{req.Mod.Path + "@" + version},
+- })
+- if err != nil {
+- return protocol.Command{}, err
+- }
+- return cmd, nil
+-}
+-
+-func upgradeTitle(fixedVersion string) string {
+- title := fmt.Sprintf("%s%v", upgradeCodeActionPrefix, fixedVersion)
+- return title
+-}
+-
+-// SelectUpgradeCodeActions takes a list of code actions for a required module
+-// and returns a more selective list of upgrade code actions,
+-// where the code actions have been deduped. Code actions unrelated to upgrade
+-// are deduplicated by the name.
+-func SelectUpgradeCodeActions(actions []protocol.CodeAction) []protocol.CodeAction {
+- if len(actions) <= 1 {
+- return actions // return early if no sorting necessary
+- }
+- var versionedUpgrade, latestUpgrade, resetAction protocol.CodeAction
+- var chosenVersionedUpgrade string
+- var selected []protocol.CodeAction
+-
+- seen := make(map[string]bool)
+-
+- for _, action := range actions {
+- if strings.HasPrefix(action.Title, upgradeCodeActionPrefix) {
+- if v := getUpgradeVersion(action); v == "latest" && latestUpgrade.Title == "" {
+- latestUpgrade = action
+- } else if versionedUpgrade.Title == "" || semver.Compare(v, chosenVersionedUpgrade) > 0 {
+- chosenVersionedUpgrade = v
+- versionedUpgrade = action
+- }
+- } else if strings.HasPrefix(action.Title, "Reset govulncheck") {
+- resetAction = action
+- } else if !seen[action.Command.Title] {
+- seen[action.Command.Title] = true
+- selected = append(selected, action)
+- }
+- }
+- if versionedUpgrade.Title != "" {
+- selected = append(selected, versionedUpgrade)
+- }
+- if latestUpgrade.Title != "" {
+- selected = append(selected, latestUpgrade)
+- }
+- if resetAction.Title != "" {
+- selected = append(selected, resetAction)
+- }
+- return selected
+-}
+-
+-func getUpgradeVersion(p protocol.CodeAction) string {
+- return strings.TrimPrefix(p.Title, upgradeCodeActionPrefix)
+-}
+diff -urN a/gopls/internal/lsp/mod/format.go b/gopls/internal/lsp/mod/format.go
+--- a/gopls/internal/lsp/mod/format.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/mod/format.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,30 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package mod
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-func Format(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle) ([]protocol.TextEdit, error) {
+- ctx, done := event.Start(ctx, "mod.Format")
+- defer done()
+-
+- pm, err := snapshot.ParseMod(ctx, fh)
+- if err != nil {
+- return nil, err
+- }
+- formatted, err := pm.File.Format()
+- if err != nil {
+- return nil, err
+- }
+- // Calculate the edits to be made due to the change.
+- diffs := snapshot.View().Options().ComputeEdits(string(pm.Mapper.Content), string(formatted))
+- return source.ToProtocolEdits(pm.Mapper, diffs)
+-}
+diff -urN a/gopls/internal/lsp/mod/hover.go b/gopls/internal/lsp/mod/hover.go
+--- a/gopls/internal/lsp/mod/hover.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/mod/hover.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,358 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package mod
+-
+-import (
+- "bytes"
+- "context"
+- "fmt"
+- "sort"
+- "strings"
+-
+- "golang.org/x/mod/modfile"
+- "golang.org/x/mod/semver"
+- "golang.org/x/tools/gopls/internal/govulncheck"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-func Hover(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle, position protocol.Position) (*protocol.Hover, error) {
+- var found bool
+- for _, uri := range snapshot.ModFiles() {
+- if fh.URI() == uri {
+- found = true
+- break
+- }
+- }
+-
+- // We only provide hover information for the view's go.mod files.
+- if !found {
+- return nil, nil
+- }
+-
+- ctx, done := event.Start(ctx, "mod.Hover")
+- defer done()
+-
+- // Get the position of the cursor.
+- pm, err := snapshot.ParseMod(ctx, fh)
+- if err != nil {
+- return nil, fmt.Errorf("getting modfile handle: %w", err)
+- }
+- offset, err := pm.Mapper.PositionOffset(position)
+- if err != nil {
+- return nil, fmt.Errorf("computing cursor position: %w", err)
+- }
+-
+- // If the cursor position is on a module statement
+- if hover, ok := hoverOnModuleStatement(ctx, pm, offset, snapshot, fh); ok {
+- return hover, nil
+- }
+- return hoverOnRequireStatement(ctx, pm, offset, snapshot, fh)
+-}
+-
+-func hoverOnRequireStatement(ctx context.Context, pm *source.ParsedModule, offset int, snapshot source.Snapshot, fh source.FileHandle) (*protocol.Hover, error) {
+- // Confirm that the cursor is at the position of a require statement.
+- var req *modfile.Require
+- var startOffset, endOffset int
+- for _, r := range pm.File.Require {
+- dep := []byte(r.Mod.Path)
+- s, e := r.Syntax.Start.Byte, r.Syntax.End.Byte
+- i := bytes.Index(pm.Mapper.Content[s:e], dep)
+- if i == -1 {
+- continue
+- }
+- // Shift the start position to the location of the
+- // dependency within the require statement.
+- startOffset, endOffset = s+i, e
+- if startOffset <= offset && offset <= endOffset {
+- req = r
+- break
+- }
+- }
+- // TODO(hyangah): find position for info about vulnerabilities in Go
+-
+- // The cursor position is not on a require statement.
+- if req == nil {
+- return nil, nil
+- }
+-
+- // Get the vulnerability info.
+- fromGovulncheck := true
+- vs := snapshot.View().Vulnerabilities(fh.URI())[fh.URI()]
+- if vs == nil && snapshot.View().Options().Vulncheck == source.ModeVulncheckImports {
+- var err error
+- vs, err = snapshot.ModVuln(ctx, fh.URI())
+- if err != nil {
+- return nil, err
+- }
+- fromGovulncheck = false
+- }
+- affecting, nonaffecting := lookupVulns(vs, req.Mod.Path, req.Mod.Version)
+-
+- // Get the `go mod why` results for the given file.
+- why, err := snapshot.ModWhy(ctx, fh)
+- if err != nil {
+- return nil, err
+- }
+- explanation, ok := why[req.Mod.Path]
+- if !ok {
+- return nil, nil
+- }
+-
+- // Get the range to highlight for the hover.
+- // TODO(hyangah): adjust the hover range to include the version number
+- // to match the diagnostics' range.
+- rng, err := pm.Mapper.OffsetRange(startOffset, endOffset)
+- if err != nil {
+- return nil, err
+- }
+- options := snapshot.View().Options()
+- isPrivate := snapshot.View().IsGoPrivatePath(req.Mod.Path)
+- header := formatHeader(req.Mod.Path, options)
+- explanation = formatExplanation(explanation, req, options, isPrivate)
+- vulns := formatVulnerabilities(req.Mod.Path, affecting, nonaffecting, options, fromGovulncheck)
+-
+- return &protocol.Hover{
+- Contents: protocol.MarkupContent{
+- Kind: options.PreferredContentFormat,
+- Value: header + vulns + explanation,
+- },
+- Range: rng,
+- }, nil
+-}
+-
+-func hoverOnModuleStatement(ctx context.Context, pm *source.ParsedModule, offset int, snapshot source.Snapshot, fh source.FileHandle) (*protocol.Hover, bool) {
+- module := pm.File.Module
+- if module == nil {
+- return nil, false // no module stmt
+- }
+- if offset < module.Syntax.Start.Byte || offset > module.Syntax.End.Byte {
+- return nil, false // cursor not in module stmt
+- }
+-
+- rng, err := pm.Mapper.OffsetRange(module.Syntax.Start.Byte, module.Syntax.End.Byte)
+- if err != nil {
+- return nil, false
+- }
+- fromGovulncheck := true
+- vs := snapshot.View().Vulnerabilities(fh.URI())[fh.URI()]
+-
+- if vs == nil && snapshot.View().Options().Vulncheck == source.ModeVulncheckImports {
+- vs, err = snapshot.ModVuln(ctx, fh.URI())
+- if err != nil {
+- return nil, false
+- }
+- fromGovulncheck = false
+- }
+- modpath := "stdlib"
+- goVersion := snapshot.View().GoVersionString()
+- affecting, nonaffecting := lookupVulns(vs, modpath, goVersion)
+- options := snapshot.View().Options()
+- vulns := formatVulnerabilities(modpath, affecting, nonaffecting, options, fromGovulncheck)
+-
+- return &protocol.Hover{
+- Contents: protocol.MarkupContent{
+- Kind: options.PreferredContentFormat,
+- Value: vulns,
+- },
+- Range: rng,
+- }, true
+-}
+-
+-func formatHeader(modpath string, options *source.Options) string {
+- var b strings.Builder
+- // Write the heading as an H3.
+- b.WriteString("#### " + modpath)
+- if options.PreferredContentFormat == protocol.Markdown {
+- b.WriteString("\n\n")
+- } else {
+- b.WriteRune('\n')
+- }
+- return b.String()
+-}
+-
+-func lookupVulns(vulns *govulncheck.Result, modpath, version string) (affecting, nonaffecting []*govulncheck.Vuln) {
+- if vulns == nil {
+- return nil, nil
+- }
+- for _, vuln := range vulns.Vulns {
+- for _, mod := range vuln.Modules {
+- if mod.Path != modpath {
+- continue
+- }
+- // It is possible that the source code was changed since the last
+- // govulncheck run and information in the `vulns` info is stale.
+- // For example, imagine that a user is in the middle of updating
+- // problematic modules detected by the govulncheck run by applying
+- // quick fixes. Stale diagnostics can be confusing and prevent the
+- // user from quickly locating the next module to fix.
+- // Ideally we should rerun the analysis with the updated module
+- // dependencies or any other code changes, but we are not yet
+- // in the position of automatically triggering the analysis
+- // (govulncheck can take a while). We also don't know exactly what
+- // part of source code was changed since `vulns` was computed.
+- // As a heuristic, we assume that a user upgrades the affecting
+- // module to the version with the fix or the latest one, and if the
+- // version in the require statement is equal to or higher than the
+- // fixed version, skip the vulnerability information in the hover.
+- // Eventually, the user has to rerun govulncheck.
+- if mod.FixedVersion != "" && semver.IsValid(version) && semver.Compare(mod.FixedVersion, version) <= 0 {
+- continue
+- }
+- if vuln.IsCalled() {
+- affecting = append(affecting, vuln)
+- } else {
+- nonaffecting = append(nonaffecting, vuln)
+- }
+- }
+- }
+- sort.Slice(nonaffecting, func(i, j int) bool { return nonaffecting[i].OSV.ID < nonaffecting[j].OSV.ID })
+- sort.Slice(affecting, func(i, j int) bool { return affecting[i].OSV.ID < affecting[j].OSV.ID })
+- return affecting, nonaffecting
+-}
+-
+-func formatVulnerabilities(modPath string, affecting, nonaffecting []*govulncheck.Vuln, options *source.Options, fromGovulncheck bool) string {
+- if len(affecting) == 0 && len(nonaffecting) == 0 {
+- return ""
+- }
+-
+- // TODO(hyangah): can we use go templates to generate hover messages?
+- // Then, we can use a different template for markdown case.
+- useMarkdown := options.PreferredContentFormat == protocol.Markdown
+-
+- var b strings.Builder
+-
+- if len(affecting) > 0 {
+- // TODO(hyangah): make the message more eyecatching (icon/codicon/color)
+- if len(affecting) == 1 {
+- b.WriteString(fmt.Sprintf("\n**WARNING:** Found %d reachable vulnerability.\n", len(affecting)))
+- } else {
+- b.WriteString(fmt.Sprintf("\n**WARNING:** Found %d reachable vulnerabilities.\n", len(affecting)))
+- }
+- }
+- for _, v := range affecting {
+- fix := fixedVersionInfo(v, modPath)
+- pkgs := vulnerablePkgsInfo(v, modPath, useMarkdown)
+-
+- if useMarkdown {
+- fmt.Fprintf(&b, "- [**%v**](%v) %v%v%v\n", v.OSV.ID, href(v.OSV), formatMessage(v), pkgs, fix)
+- } else {
+- fmt.Fprintf(&b, " - [%v] %v (%v) %v%v\n", v.OSV.ID, formatMessage(v), href(v.OSV), pkgs, fix)
+- }
+- }
+- if len(nonaffecting) > 0 {
+- if fromGovulncheck {
+- fmt.Fprintf(&b, "\n**Note:** The project imports packages with known vulnerabilities, but does not call the vulnerable code.\n")
+- } else {
+- fmt.Fprintf(&b, "\n**Note:** The project imports packages with known vulnerabilities. Use `govulncheck` to check if the project uses vulnerable symbols.\n")
+- }
+- }
+- for _, v := range nonaffecting {
+- fix := fixedVersionInfo(v, modPath)
+- pkgs := vulnerablePkgsInfo(v, modPath, useMarkdown)
+- if useMarkdown {
+- fmt.Fprintf(&b, "- [%v](%v) %v%v%v\n", v.OSV.ID, href(v.OSV), formatMessage(v), pkgs, fix)
+- } else {
+- fmt.Fprintf(&b, " - [%v] %v (%v) %v%v\n", v.OSV.ID, formatMessage(v), href(v.OSV), pkgs, fix)
+- }
+- }
+- b.WriteString("\n")
+- return b.String()
+-}
+-
+-func vulnerablePkgsInfo(v *govulncheck.Vuln, modPath string, useMarkdown bool) string {
+- var b bytes.Buffer
+- for _, m := range v.Modules {
+- if m.Path != modPath {
+- continue
+- }
+- if c := len(m.Packages); c == 1 {
+- b.WriteString("\n Vulnerable package is:")
+- } else if c > 1 {
+- b.WriteString("\n Vulnerable packages are:")
+- }
+- for _, pkg := range m.Packages {
+- if useMarkdown {
+- b.WriteString("\n * `")
+- } else {
+- b.WriteString("\n ")
+- }
+- b.WriteString(pkg.Path)
+- if useMarkdown {
+- b.WriteString("`")
+- }
+- }
+- }
+- if b.Len() == 0 {
+- return ""
+- }
+- return b.String()
+-}
+-func fixedVersionInfo(v *govulncheck.Vuln, modPath string) string {
+- fix := "\n\n **No fix is available.**"
+- for _, m := range v.Modules {
+- if m.Path != modPath {
+- continue
+- }
+- if m.FixedVersion != "" {
+- fix = "\n\n Fixed in " + m.FixedVersion + "."
+- }
+- break
+- }
+- return fix
+-}
+-
+-func formatExplanation(text string, req *modfile.Require, options *source.Options, isPrivate bool) string {
+- text = strings.TrimSuffix(text, "\n")
+- splt := strings.Split(text, "\n")
+- length := len(splt)
+-
+- var b strings.Builder
+-
+- // If the explanation is 2 lines, then it is of the form:
+- // # golang.org/x/text/encoding
+- // (main module does not need package golang.org/x/text/encoding)
+- if length == 2 {
+- b.WriteString(splt[1])
+- return b.String()
+- }
+-
+- imp := splt[length-1] // import path
+- reference := imp
+- // See golang/go#36998: don't link to modules matching GOPRIVATE.
+- if !isPrivate && options.PreferredContentFormat == protocol.Markdown {
+- target := imp
+- if strings.ToLower(options.LinkTarget) == "pkg.go.dev" {
+- target = strings.Replace(target, req.Mod.Path, req.Mod.String(), 1)
+- }
+- reference = fmt.Sprintf("[%s](%s)", imp, source.BuildLink(options.LinkTarget, target, ""))
+- }
+- b.WriteString("This module is necessary because " + reference + " is imported in")
+-
+- // If the explanation is 3 lines, then it is of the form:
+- // # golang.org/x/tools
+- // modtest
+- // golang.org/x/tools/go/packages
+- if length == 3 {
+- msg := fmt.Sprintf(" `%s`.", splt[1])
+- b.WriteString(msg)
+- return b.String()
+- }
+-
+- // If the explanation is more than 3 lines, then it is of the form:
+- // # golang.org/x/text/language
+- // rsc.io/quote
+- // rsc.io/sampler
+- // golang.org/x/text/language
+- b.WriteString(":\n```text")
+- dash := ""
+- for _, imp := range splt[1 : length-1] {
+- dash += "-"
+- b.WriteString("\n" + dash + " " + imp)
+- }
+- b.WriteString("\n```")
+- return b.String()
+-}
+diff -urN a/gopls/internal/lsp/mod/mod_test.go b/gopls/internal/lsp/mod/mod_test.go
+--- a/gopls/internal/lsp/mod/mod_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/mod/mod_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,57 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package mod
+-
+-import (
+- "io/ioutil"
+- "os"
+- "path/filepath"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/cache"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/tests"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-func TestMain(m *testing.M) {
+- testenv.ExitIfSmallMachine()
+- os.Exit(m.Run())
+-}
+-
+-func TestModfileRemainsUnchanged(t *testing.T) {
+- ctx := tests.Context(t)
+- session := cache.NewSession(ctx, cache.New(nil), nil)
+- options := source.DefaultOptions().Clone()
+- tests.DefaultOptions(options)
+- options.TempModfile = true
+- options.Env = map[string]string{"GOPACKAGESDRIVER": "off", "GOROOT": ""}
+-
+- // Make sure to copy the test directory to a temporary directory so we do not
+- // modify the test code or add go.sum files when we run the tests.
+- folder, err := tests.CopyFolderToTempDir(filepath.Join("testdata", "unchanged"))
+- if err != nil {
+- t.Fatal(err)
+- }
+- defer os.RemoveAll(folder)
+-
+- before, err := ioutil.ReadFile(filepath.Join(folder, "go.mod"))
+- if err != nil {
+- t.Fatal(err)
+- }
+- _, _, release, err := session.NewView(ctx, "diagnostics_test", span.URIFromPath(folder), options)
+- if err != nil {
+- t.Fatal(err)
+- }
+- release()
+- after, err := ioutil.ReadFile(filepath.Join(folder, "go.mod"))
+- if err != nil {
+- t.Fatal(err)
+- }
+- if string(before) != string(after) {
+- t.Errorf("the real go.mod file was changed even when tempModfile=true")
+- }
+-}
+diff -urN a/gopls/internal/lsp/mod/testdata/unchanged/go.mod b/gopls/internal/lsp/mod/testdata/unchanged/go.mod
+--- a/gopls/internal/lsp/mod/testdata/unchanged/go.mod 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/mod/testdata/unchanged/go.mod 1970-01-01 00:00:00.000000000 +0000
+@@ -1 +0,0 @@
+-module unchanged
+diff -urN a/gopls/internal/lsp/mod/testdata/unchanged/main.go b/gopls/internal/lsp/mod/testdata/unchanged/main.go
+--- a/gopls/internal/lsp/mod/testdata/unchanged/main.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/mod/testdata/unchanged/main.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-// Package unchanged does something
+-package unchanged
+-
+-func Yo() {
+- println("yo")
+-}
+diff -urN a/gopls/internal/lsp/progress/progress.go b/gopls/internal/lsp/progress/progress.go
+--- a/gopls/internal/lsp/progress/progress.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/progress/progress.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,271 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package progress
+-
+-import (
+- "context"
+- "fmt"
+- "math/rand"
+- "strconv"
+- "strings"
+- "sync"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+- "golang.org/x/tools/internal/xcontext"
+-)
+-
+-type Tracker struct {
+- client protocol.Client
+- supportsWorkDoneProgress bool
+-
+- mu sync.Mutex
+- inProgress map[protocol.ProgressToken]*WorkDone
+-}
+-
+-func NewTracker(client protocol.Client) *Tracker {
+- return &Tracker{
+- client: client,
+- inProgress: make(map[protocol.ProgressToken]*WorkDone),
+- }
+-}
+-
+-func (tracker *Tracker) SetSupportsWorkDoneProgress(b bool) {
+- tracker.supportsWorkDoneProgress = b
+-}
+-
+-// Start notifies the client of work being done on the server. It uses either
+-// ShowMessage RPCs or $/progress messages, depending on the capabilities of
+-// the client. The returned WorkDone handle may be used to report incremental
+-// progress, and to report work completion. In particular, it is an error to
+-// call start and not call end(...) on the returned WorkDone handle.
+-//
+-// If token is empty, a token will be randomly generated.
+-//
+-// The progress item is considered cancellable if the given cancel func is
+-// non-nil. In this case, cancel is called when the work done
+-//
+-// Example:
+-//
+-// func Generate(ctx) (err error) {
+-// ctx, cancel := context.WithCancel(ctx)
+-// defer cancel()
+-// work := s.progress.start(ctx, "generate", "running go generate", cancel)
+-// defer func() {
+-// if err != nil {
+-// work.end(ctx, fmt.Sprintf("generate failed: %v", err))
+-// } else {
+-// work.end(ctx, "done")
+-// }
+-// }()
+-// // Do the work...
+-// }
+-func (t *Tracker) Start(ctx context.Context, title, message string, token protocol.ProgressToken, cancel func()) *WorkDone {
+- ctx = xcontext.Detach(ctx) // progress messages should not be cancelled
+- wd := &WorkDone{
+- client: t.client,
+- token: token,
+- cancel: cancel,
+- }
+- if !t.supportsWorkDoneProgress {
+- // Previous iterations of this fallback attempted to retain cancellation
+- // support by using ShowMessageCommand with a 'Cancel' button, but this is
+- // not ideal as the 'Cancel' dialog stays open even after the command
+- // completes.
+- //
+- // Just show a simple message. Clients can implement workDone progress
+- // reporting to get cancellation support.
+- if err := wd.client.ShowMessage(ctx, &protocol.ShowMessageParams{
+- Type: protocol.Log,
+- Message: message,
+- }); err != nil {
+- event.Error(ctx, "showing start message for "+title, err)
+- }
+- return wd
+- }
+- if wd.token == nil {
+- token = strconv.FormatInt(rand.Int63(), 10)
+- err := wd.client.WorkDoneProgressCreate(ctx, &protocol.WorkDoneProgressCreateParams{
+- Token: token,
+- })
+- if err != nil {
+- wd.err = err
+- event.Error(ctx, "starting work for "+title, err)
+- return wd
+- }
+- wd.token = token
+- }
+- // At this point we have a token that the client knows about. Store the token
+- // before starting work.
+- t.mu.Lock()
+- t.inProgress[wd.token] = wd
+- t.mu.Unlock()
+- wd.cleanup = func() {
+- t.mu.Lock()
+- delete(t.inProgress, token)
+- t.mu.Unlock()
+- }
+- err := wd.client.Progress(ctx, &protocol.ProgressParams{
+- Token: wd.token,
+- Value: &protocol.WorkDoneProgressBegin{
+- Kind: "begin",
+- Cancellable: wd.cancel != nil,
+- Message: message,
+- Title: title,
+- },
+- })
+- if err != nil {
+- event.Error(ctx, "progress begin", err)
+- }
+- return wd
+-}
+-
+-func (t *Tracker) Cancel(token protocol.ProgressToken) error {
+- t.mu.Lock()
+- defer t.mu.Unlock()
+- wd, ok := t.inProgress[token]
+- if !ok {
+- return fmt.Errorf("token %q not found in progress", token)
+- }
+- if wd.cancel == nil {
+- return fmt.Errorf("work %q is not cancellable", token)
+- }
+- wd.doCancel()
+- return nil
+-}
+-
+-// WorkDone represents a unit of work that is reported to the client via the
+-// progress API.
+-type WorkDone struct {
+- client protocol.Client
+- // If token is nil, this workDone object uses the ShowMessage API, rather
+- // than $/progress.
+- token protocol.ProgressToken
+- // err is set if progress reporting is broken for some reason (for example,
+- // if there was an initial error creating a token).
+- err error
+-
+- cancelMu sync.Mutex
+- cancelled bool
+- cancel func()
+-
+- cleanup func()
+-}
+-
+-func (wd *WorkDone) Token() protocol.ProgressToken {
+- return wd.token
+-}
+-
+-func (wd *WorkDone) doCancel() {
+- wd.cancelMu.Lock()
+- defer wd.cancelMu.Unlock()
+- if !wd.cancelled {
+- wd.cancel()
+- }
+-}
+-
+-// Report reports an update on WorkDone report back to the client.
+-func (wd *WorkDone) Report(ctx context.Context, message string, percentage float64) {
+- ctx = xcontext.Detach(ctx) // progress messages should not be cancelled
+- if wd == nil {
+- return
+- }
+- wd.cancelMu.Lock()
+- cancelled := wd.cancelled
+- wd.cancelMu.Unlock()
+- if cancelled {
+- return
+- }
+- if wd.err != nil || wd.token == nil {
+- // Not using the workDone API, so we do nothing. It would be far too spammy
+- // to send incremental messages.
+- return
+- }
+- message = strings.TrimSuffix(message, "\n")
+- err := wd.client.Progress(ctx, &protocol.ProgressParams{
+- Token: wd.token,
+- Value: &protocol.WorkDoneProgressReport{
+- Kind: "report",
+- // Note that in the LSP spec, the value of Cancellable may be changed to
+- // control whether the cancel button in the UI is enabled. Since we don't
+- // yet use this feature, the value is kept constant here.
+- Cancellable: wd.cancel != nil,
+- Message: message,
+- Percentage: uint32(percentage),
+- },
+- })
+- if err != nil {
+- event.Error(ctx, "reporting progress", err)
+- }
+-}
+-
+-// End reports a workdone completion back to the client.
+-func (wd *WorkDone) End(ctx context.Context, message string) {
+- ctx = xcontext.Detach(ctx) // progress messages should not be cancelled
+- if wd == nil {
+- return
+- }
+- var err error
+- switch {
+- case wd.err != nil:
+- // There is a prior error.
+- case wd.token == nil:
+- // We're falling back to message-based reporting.
+- err = wd.client.ShowMessage(ctx, &protocol.ShowMessageParams{
+- Type: protocol.Info,
+- Message: message,
+- })
+- default:
+- err = wd.client.Progress(ctx, &protocol.ProgressParams{
+- Token: wd.token,
+- Value: &protocol.WorkDoneProgressEnd{
+- Kind: "end",
+- Message: message,
+- },
+- })
+- }
+- if err != nil {
+- event.Error(ctx, "ending work", err)
+- }
+- if wd.cleanup != nil {
+- wd.cleanup()
+- }
+-}
+-
+-// EventWriter writes every incoming []byte to
+-// event.Print with the operation=generate tag
+-// to distinguish its logs from others.
+-type EventWriter struct {
+- ctx context.Context
+- operation string
+-}
+-
+-func NewEventWriter(ctx context.Context, operation string) *EventWriter {
+- return &EventWriter{ctx: ctx, operation: operation}
+-}
+-
+-func (ew *EventWriter) Write(p []byte) (n int, err error) {
+- event.Log(ew.ctx, string(p), tag.Operation.Of(ew.operation))
+- return len(p), nil
+-}
+-
+-// WorkDoneWriter wraps a workDone handle to provide a Writer interface,
+-// so that workDone reporting can more easily be hooked into commands.
+-type WorkDoneWriter struct {
+- // In order to implement the io.Writer interface, we must close over ctx.
+- ctx context.Context
+- wd *WorkDone
+-}
+-
+-func NewWorkDoneWriter(ctx context.Context, wd *WorkDone) *WorkDoneWriter {
+- return &WorkDoneWriter{ctx: ctx, wd: wd}
+-}
+-
+-func (wdw *WorkDoneWriter) Write(p []byte) (n int, err error) {
+- wdw.wd.Report(wdw.ctx, string(p), 0)
+- // Don't fail just because of a failure to report progress.
+- return len(p), nil
+-}
+diff -urN a/gopls/internal/lsp/progress/progress_test.go b/gopls/internal/lsp/progress/progress_test.go
+--- a/gopls/internal/lsp/progress/progress_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/progress/progress_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,161 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package progress
+-
+-import (
+- "context"
+- "fmt"
+- "sync"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-type fakeClient struct {
+- protocol.Client
+-
+- token protocol.ProgressToken
+-
+- mu sync.Mutex
+- created, begun, reported, messages, ended int
+-}
+-
+-func (c *fakeClient) checkToken(token protocol.ProgressToken) {
+- if token == nil {
+- panic("nil token in progress message")
+- }
+- if c.token != nil && c.token != token {
+- panic(fmt.Errorf("invalid token in progress message: got %v, want %v", token, c.token))
+- }
+-}
+-
+-func (c *fakeClient) WorkDoneProgressCreate(ctx context.Context, params *protocol.WorkDoneProgressCreateParams) error {
+- c.mu.Lock()
+- defer c.mu.Unlock()
+- c.checkToken(params.Token)
+- c.created++
+- return nil
+-}
+-
+-func (c *fakeClient) Progress(ctx context.Context, params *protocol.ProgressParams) error {
+- c.mu.Lock()
+- defer c.mu.Unlock()
+- c.checkToken(params.Token)
+- switch params.Value.(type) {
+- case *protocol.WorkDoneProgressBegin:
+- c.begun++
+- case *protocol.WorkDoneProgressReport:
+- c.reported++
+- case *protocol.WorkDoneProgressEnd:
+- c.ended++
+- default:
+- panic(fmt.Errorf("unknown progress value %T", params.Value))
+- }
+- return nil
+-}
+-
+-func (c *fakeClient) ShowMessage(context.Context, *protocol.ShowMessageParams) error {
+- c.mu.Lock()
+- defer c.mu.Unlock()
+- c.messages++
+- return nil
+-}
+-
+-func setup(token protocol.ProgressToken) (context.Context, *Tracker, *fakeClient) {
+- c := &fakeClient{}
+- tracker := NewTracker(c)
+- tracker.SetSupportsWorkDoneProgress(true)
+- return context.Background(), tracker, c
+-}
+-
+-func TestProgressTracker_Reporting(t *testing.T) {
+- for _, test := range []struct {
+- name string
+- supported bool
+- token protocol.ProgressToken
+- wantReported, wantCreated, wantBegun, wantEnded int
+- wantMessages int
+- }{
+- {
+- name: "unsupported",
+- wantMessages: 2,
+- },
+- {
+- name: "random token",
+- supported: true,
+- wantCreated: 1,
+- wantBegun: 1,
+- wantReported: 1,
+- wantEnded: 1,
+- },
+- {
+- name: "string token",
+- supported: true,
+- token: "token",
+- wantBegun: 1,
+- wantReported: 1,
+- wantEnded: 1,
+- },
+- {
+- name: "numeric token",
+- supported: true,
+- token: 1,
+- wantReported: 1,
+- wantBegun: 1,
+- wantEnded: 1,
+- },
+- } {
+- test := test
+- t.Run(test.name, func(t *testing.T) {
+- ctx, tracker, client := setup(test.token)
+- ctx, cancel := context.WithCancel(ctx)
+- defer cancel()
+- tracker.supportsWorkDoneProgress = test.supported
+- work := tracker.Start(ctx, "work", "message", test.token, nil)
+- client.mu.Lock()
+- gotCreated, gotBegun := client.created, client.begun
+- client.mu.Unlock()
+- if gotCreated != test.wantCreated {
+- t.Errorf("got %d created tokens, want %d", gotCreated, test.wantCreated)
+- }
+- if gotBegun != test.wantBegun {
+- t.Errorf("got %d work begun, want %d", gotBegun, test.wantBegun)
+- }
+- // Ignore errors: this is just testing the reporting behavior.
+- work.Report(ctx, "report", 50)
+- client.mu.Lock()
+- gotReported := client.reported
+- client.mu.Unlock()
+- if gotReported != test.wantReported {
+- t.Errorf("got %d progress reports, want %d", gotReported, test.wantCreated)
+- }
+- work.End(ctx, "done")
+- client.mu.Lock()
+- gotEnded, gotMessages := client.ended, client.messages
+- client.mu.Unlock()
+- if gotEnded != test.wantEnded {
+- t.Errorf("got %d ended reports, want %d", gotEnded, test.wantEnded)
+- }
+- if gotMessages != test.wantMessages {
+- t.Errorf("got %d messages, want %d", gotMessages, test.wantMessages)
+- }
+- })
+- }
+-}
+-
+-func TestProgressTracker_Cancellation(t *testing.T) {
+- for _, token := range []protocol.ProgressToken{nil, 1, "a"} {
+- ctx, tracker, _ := setup(token)
+- var canceled bool
+- cancel := func() { canceled = true }
+- work := tracker.Start(ctx, "work", "message", token, cancel)
+- if err := tracker.Cancel(work.Token()); err != nil {
+- t.Fatal(err)
+- }
+- if !canceled {
+- t.Errorf("tracker.cancel(...): cancel not called")
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/protocol/codeactionkind.go b/gopls/internal/lsp/protocol/codeactionkind.go
+--- a/gopls/internal/lsp/protocol/codeactionkind.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/codeactionkind.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package protocol
+-
+-// Custom code actions that aren't explicitly stated in LSP
+-const (
+- GoTest CodeActionKind = "goTest"
+- // TODO: Add GoGenerate, RegenerateCgo etc.
+-)
+diff -urN a/gopls/internal/lsp/protocol/context.go b/gopls/internal/lsp/protocol/context.go
+--- a/gopls/internal/lsp/protocol/context.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/context.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,43 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package protocol
+-
+-import (
+- "bytes"
+- "context"
+-
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/core"
+- "golang.org/x/tools/internal/event/export"
+- "golang.org/x/tools/internal/event/label"
+- "golang.org/x/tools/internal/xcontext"
+-)
+-
+-type contextKey int
+-
+-const (
+- clientKey = contextKey(iota)
+-)
+-
+-func WithClient(ctx context.Context, client Client) context.Context {
+- return context.WithValue(ctx, clientKey, client)
+-}
+-
+-func LogEvent(ctx context.Context, ev core.Event, lm label.Map, mt MessageType) context.Context {
+- client, ok := ctx.Value(clientKey).(Client)
+- if !ok {
+- return ctx
+- }
+- buf := &bytes.Buffer{}
+- p := export.Printer{}
+- p.WriteEvent(buf, ev, lm)
+- msg := &LogMessageParams{Type: mt, Message: buf.String()}
+- // Handle messages generated via event.Error, which won't have a level Label.
+- if event.IsError(ev) {
+- msg.Type = Error
+- }
+- go client.LogMessage(xcontext.Detach(ctx), msg)
+- return ctx
+-}
+diff -urN a/gopls/internal/lsp/protocol/doc.go b/gopls/internal/lsp/protocol/doc.go
+--- a/gopls/internal/lsp/protocol/doc.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/doc.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:generate go run ./generate
+-
+-// Package protocol contains the structs that map directly to the
+-// request and response messages of the Language Server Protocol.
+-//
+-// It is a literal transcription, with unmodified comments, and only the changes
+-// required to make it go code.
+-// Names are uppercased to export them.
+-// All fields have JSON tags added to correct the names.
+-// Fields marked with a ? are also marked as "omitempty"
+-// Fields that are "|| null" are made pointers
+-// Fields that are string or number are left as string
+-// Fields that are type "number" are made float64
+-package protocol
+diff -urN a/gopls/internal/lsp/protocol/enums.go b/gopls/internal/lsp/protocol/enums.go
+--- a/gopls/internal/lsp/protocol/enums.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/enums.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,231 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package protocol
+-
+-import (
+- "fmt"
+-)
+-
+-var (
+- namesTextDocumentSyncKind [int(Incremental) + 1]string
+- namesMessageType [int(Log) + 1]string
+- namesFileChangeType [int(Deleted) + 1]string
+- namesWatchKind [int(WatchDelete) + 1]string
+- namesCompletionTriggerKind [int(TriggerForIncompleteCompletions) + 1]string
+- namesDiagnosticSeverity [int(SeverityHint) + 1]string
+- namesDiagnosticTag [int(Unnecessary) + 1]string
+- namesCompletionItemKind [int(TypeParameterCompletion) + 1]string
+- namesInsertTextFormat [int(SnippetTextFormat) + 1]string
+- namesDocumentHighlightKind [int(Write) + 1]string
+- namesSymbolKind [int(TypeParameter) + 1]string
+- namesTextDocumentSaveReason [int(FocusOut) + 1]string
+-)
+-
+-func init() {
+- namesTextDocumentSyncKind[int(None)] = "None"
+- namesTextDocumentSyncKind[int(Full)] = "Full"
+- namesTextDocumentSyncKind[int(Incremental)] = "Incremental"
+-
+- namesMessageType[int(Error)] = "Error"
+- namesMessageType[int(Warning)] = "Warning"
+- namesMessageType[int(Info)] = "Info"
+- namesMessageType[int(Log)] = "Log"
+-
+- namesFileChangeType[int(Created)] = "Created"
+- namesFileChangeType[int(Changed)] = "Changed"
+- namesFileChangeType[int(Deleted)] = "Deleted"
+-
+- namesWatchKind[int(WatchCreate)] = "WatchCreate"
+- namesWatchKind[int(WatchChange)] = "WatchChange"
+- namesWatchKind[int(WatchDelete)] = "WatchDelete"
+-
+- namesCompletionTriggerKind[int(Invoked)] = "Invoked"
+- namesCompletionTriggerKind[int(TriggerCharacter)] = "TriggerCharacter"
+- namesCompletionTriggerKind[int(TriggerForIncompleteCompletions)] = "TriggerForIncompleteCompletions"
+-
+- namesDiagnosticSeverity[int(SeverityError)] = "Error"
+- namesDiagnosticSeverity[int(SeverityWarning)] = "Warning"
+- namesDiagnosticSeverity[int(SeverityInformation)] = "Information"
+- namesDiagnosticSeverity[int(SeverityHint)] = "Hint"
+-
+- namesDiagnosticTag[int(Unnecessary)] = "Unnecessary"
+-
+- namesCompletionItemKind[int(TextCompletion)] = "text"
+- namesCompletionItemKind[int(MethodCompletion)] = "method"
+- namesCompletionItemKind[int(FunctionCompletion)] = "func"
+- namesCompletionItemKind[int(ConstructorCompletion)] = "constructor"
+- namesCompletionItemKind[int(FieldCompletion)] = "field"
+- namesCompletionItemKind[int(VariableCompletion)] = "var"
+- namesCompletionItemKind[int(ClassCompletion)] = "type"
+- namesCompletionItemKind[int(InterfaceCompletion)] = "interface"
+- namesCompletionItemKind[int(ModuleCompletion)] = "package"
+- namesCompletionItemKind[int(PropertyCompletion)] = "property"
+- namesCompletionItemKind[int(UnitCompletion)] = "unit"
+- namesCompletionItemKind[int(ValueCompletion)] = "value"
+- namesCompletionItemKind[int(EnumCompletion)] = "enum"
+- namesCompletionItemKind[int(KeywordCompletion)] = "keyword"
+- namesCompletionItemKind[int(SnippetCompletion)] = "snippet"
+- namesCompletionItemKind[int(ColorCompletion)] = "color"
+- namesCompletionItemKind[int(FileCompletion)] = "file"
+- namesCompletionItemKind[int(ReferenceCompletion)] = "reference"
+- namesCompletionItemKind[int(FolderCompletion)] = "folder"
+- namesCompletionItemKind[int(EnumMemberCompletion)] = "enumMember"
+- namesCompletionItemKind[int(ConstantCompletion)] = "const"
+- namesCompletionItemKind[int(StructCompletion)] = "struct"
+- namesCompletionItemKind[int(EventCompletion)] = "event"
+- namesCompletionItemKind[int(OperatorCompletion)] = "operator"
+- namesCompletionItemKind[int(TypeParameterCompletion)] = "typeParam"
+-
+- namesInsertTextFormat[int(PlainTextTextFormat)] = "PlainText"
+- namesInsertTextFormat[int(SnippetTextFormat)] = "Snippet"
+-
+- namesDocumentHighlightKind[int(Text)] = "Text"
+- namesDocumentHighlightKind[int(Read)] = "Read"
+- namesDocumentHighlightKind[int(Write)] = "Write"
+-
+- namesSymbolKind[int(File)] = "File"
+- namesSymbolKind[int(Module)] = "Module"
+- namesSymbolKind[int(Namespace)] = "Namespace"
+- namesSymbolKind[int(Package)] = "Package"
+- namesSymbolKind[int(Class)] = "Class"
+- namesSymbolKind[int(Method)] = "Method"
+- namesSymbolKind[int(Property)] = "Property"
+- namesSymbolKind[int(Field)] = "Field"
+- namesSymbolKind[int(Constructor)] = "Constructor"
+- namesSymbolKind[int(Enum)] = "Enum"
+- namesSymbolKind[int(Interface)] = "Interface"
+- namesSymbolKind[int(Function)] = "Function"
+- namesSymbolKind[int(Variable)] = "Variable"
+- namesSymbolKind[int(Constant)] = "Constant"
+- namesSymbolKind[int(String)] = "String"
+- namesSymbolKind[int(Number)] = "Number"
+- namesSymbolKind[int(Boolean)] = "Boolean"
+- namesSymbolKind[int(Array)] = "Array"
+- namesSymbolKind[int(Object)] = "Object"
+- namesSymbolKind[int(Key)] = "Key"
+- namesSymbolKind[int(Null)] = "Null"
+- namesSymbolKind[int(EnumMember)] = "EnumMember"
+- namesSymbolKind[int(Struct)] = "Struct"
+- namesSymbolKind[int(Event)] = "Event"
+- namesSymbolKind[int(Operator)] = "Operator"
+- namesSymbolKind[int(TypeParameter)] = "TypeParameter"
+-
+- namesTextDocumentSaveReason[int(Manual)] = "Manual"
+- namesTextDocumentSaveReason[int(AfterDelay)] = "AfterDelay"
+- namesTextDocumentSaveReason[int(FocusOut)] = "FocusOut"
+-}
+-
+-func formatEnum(f fmt.State, c rune, i int, names []string, unknown string) {
+- s := ""
+- if i >= 0 && i < len(names) {
+- s = names[i]
+- }
+- if s != "" {
+- fmt.Fprint(f, s)
+- } else {
+- fmt.Fprintf(f, "%s(%d)", unknown, i)
+- }
+-}
+-
+-func parseEnum(s string, names []string) int {
+- for i, name := range names {
+- if s == name {
+- return i
+- }
+- }
+- return 0
+-}
+-
+-func (e TextDocumentSyncKind) Format(f fmt.State, c rune) {
+- formatEnum(f, c, int(e), namesTextDocumentSyncKind[:], "TextDocumentSyncKind")
+-}
+-
+-func ParseTextDocumentSyncKind(s string) TextDocumentSyncKind {
+- return TextDocumentSyncKind(parseEnum(s, namesTextDocumentSyncKind[:]))
+-}
+-
+-func (e MessageType) Format(f fmt.State, c rune) {
+- formatEnum(f, c, int(e), namesMessageType[:], "MessageType")
+-}
+-
+-func ParseMessageType(s string) MessageType {
+- return MessageType(parseEnum(s, namesMessageType[:]))
+-}
+-
+-func (e FileChangeType) Format(f fmt.State, c rune) {
+- formatEnum(f, c, int(e), namesFileChangeType[:], "FileChangeType")
+-}
+-
+-func ParseFileChangeType(s string) FileChangeType {
+- return FileChangeType(parseEnum(s, namesFileChangeType[:]))
+-}
+-
+-func ParseWatchKind(s string) WatchKind {
+- return WatchKind(parseEnum(s, namesWatchKind[:]))
+-}
+-
+-func (e CompletionTriggerKind) Format(f fmt.State, c rune) {
+- formatEnum(f, c, int(e), namesCompletionTriggerKind[:], "CompletionTriggerKind")
+-}
+-
+-func ParseCompletionTriggerKind(s string) CompletionTriggerKind {
+- return CompletionTriggerKind(parseEnum(s, namesCompletionTriggerKind[:]))
+-}
+-
+-func (e DiagnosticSeverity) Format(f fmt.State, c rune) {
+- formatEnum(f, c, int(e), namesDiagnosticSeverity[:], "DiagnosticSeverity")
+-}
+-
+-func ParseDiagnosticSeverity(s string) DiagnosticSeverity {
+- return DiagnosticSeverity(parseEnum(s, namesDiagnosticSeverity[:]))
+-}
+-
+-func (e DiagnosticTag) Format(f fmt.State, c rune) {
+- formatEnum(f, c, int(e), namesDiagnosticTag[:], "DiagnosticTag")
+-}
+-
+-func ParseDiagnosticTag(s string) DiagnosticTag {
+- return DiagnosticTag(parseEnum(s, namesDiagnosticTag[:]))
+-}
+-
+-func (e CompletionItemKind) Format(f fmt.State, c rune) {
+- formatEnum(f, c, int(e), namesCompletionItemKind[:], "CompletionItemKind")
+-}
+-
+-func ParseCompletionItemKind(s string) CompletionItemKind {
+- return CompletionItemKind(parseEnum(s, namesCompletionItemKind[:]))
+-}
+-
+-func (e InsertTextFormat) Format(f fmt.State, c rune) {
+- formatEnum(f, c, int(e), namesInsertTextFormat[:], "InsertTextFormat")
+-}
+-
+-func ParseInsertTextFormat(s string) InsertTextFormat {
+- return InsertTextFormat(parseEnum(s, namesInsertTextFormat[:]))
+-}
+-
+-func (e DocumentHighlightKind) Format(f fmt.State, c rune) {
+- formatEnum(f, c, int(e), namesDocumentHighlightKind[:], "DocumentHighlightKind")
+-}
+-
+-func ParseDocumentHighlightKind(s string) DocumentHighlightKind {
+- return DocumentHighlightKind(parseEnum(s, namesDocumentHighlightKind[:]))
+-}
+-
+-func (e SymbolKind) Format(f fmt.State, c rune) {
+- formatEnum(f, c, int(e), namesSymbolKind[:], "SymbolKind")
+-}
+-
+-func ParseSymbolKind(s string) SymbolKind {
+- return SymbolKind(parseEnum(s, namesSymbolKind[:]))
+-}
+-
+-func (e TextDocumentSaveReason) Format(f fmt.State, c rune) {
+- formatEnum(f, c, int(e), namesTextDocumentSaveReason[:], "TextDocumentSaveReason")
+-}
+-
+-func ParseTextDocumentSaveReason(s string) TextDocumentSaveReason {
+- return TextDocumentSaveReason(parseEnum(s, namesTextDocumentSaveReason[:]))
+-}
+diff -urN a/gopls/internal/lsp/protocol/generate/generate.go b/gopls/internal/lsp/protocol/generate/generate.go
+--- a/gopls/internal/lsp/protocol/generate/generate.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/generate/generate.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,121 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.19
+-// +build go1.19
+-
+-package main
+-
+-import (
+- "bytes"
+- "fmt"
+- "log"
+- "strings"
+-)
+-
+-// a newType is a type that needs a name and a definition
+-// These are the various types that the json specification doesn't name
+-type newType struct {
+- name string
+- properties Properties // for struct/literal types
+- items []*Type // for other types ("and", "tuple")
+- line int
+- kind string // Or, And, Tuple, Lit, Map
+- typ *Type
+-}
+-
+-func generateDoc(out *bytes.Buffer, doc string) {
+- if doc == "" {
+- return
+- }
+-
+- if !strings.Contains(doc, "\n") {
+- fmt.Fprintf(out, "// %s\n", doc)
+- return
+- }
+- var list bool
+- for _, line := range strings.Split(doc, "\n") {
+- // Lists in metaModel.json start with a dash.
+- // To make a go doc list they have to be preceded
+- // by a blank line, and indented.
+- // (see type TextDccumentFilter in protocol.go)
+- if len(line) > 0 && line[0] == '-' {
+- if !list {
+- list = true
+- fmt.Fprintf(out, "//\n")
+- }
+- fmt.Fprintf(out, "// %s\n", line)
+- } else {
+- if len(line) == 0 {
+- list = false
+- }
+- fmt.Fprintf(out, "// %s\n", line)
+- }
+- }
+-}
+-
+-// decide if a property is optional, and if it needs a *
+-// return ",omitempty" if it is optional, and "*" if it needs a pointer
+-func propStar(name string, t NameType, gotype string) (string, string) {
+- var opt, star string
+- if t.Optional {
+- star = "*"
+- opt = ",omitempty"
+- }
+- if strings.HasPrefix(gotype, "[]") || strings.HasPrefix(gotype, "map[") {
+- star = "" // passed by reference, so no need for *
+- } else {
+- switch gotype {
+- case "bool", "uint32", "int32", "string", "interface{}":
+- star = "" // gopls compatibility if t.Optional
+- }
+- }
+- ostar, oopt := star, opt
+- if newStar, ok := goplsStar[prop{name, t.Name}]; ok {
+- switch newStar {
+- case nothing:
+- star, opt = "", ""
+- case wantStar:
+- star, opt = "*", ""
+- case wantOpt:
+- star, opt = "", ",omitempty"
+- case wantOptStar:
+- star, opt = "*", ",omitempty"
+- }
+- if star == ostar && opt == oopt { // no change
+- log.Printf("goplsStar[ {%q, %q} ](%d) useless %s/%s %s/%s", name, t.Name, t.Line, ostar, star, oopt, opt)
+- }
+- usedGoplsStar[prop{name, t.Name}] = true
+- }
+-
+- return opt, star
+-}
+-
+-func goName(s string) string {
+- // Go naming conventions
+- if strings.HasSuffix(s, "Id") {
+- s = s[:len(s)-len("Id")] + "ID"
+- } else if strings.HasSuffix(s, "Uri") {
+- s = s[:len(s)-3] + "URI"
+- } else if s == "uri" {
+- s = "URI"
+- } else if s == "id" {
+- s = "ID"
+- }
+-
+- // renames for temporary GOPLS compatibility
+- if news := goplsType[s]; news != "" {
+- usedGoplsType[s] = true
+- s = news
+- }
+- // Names beginning _ are not exported
+- if strings.HasPrefix(s, "_") {
+- s = strings.Replace(s, "_", "X", 1)
+- }
+- if s != "string" { // base types are unchanged (textDocuemnt/diagnostic)
+- // Title is deprecated, but a) s is only one word, b) replacement is too heavy-weight
+- s = strings.Title(s)
+- }
+- return s
+-}
+diff -urN a/gopls/internal/lsp/protocol/generate/main.go b/gopls/internal/lsp/protocol/generate/main.go
+--- a/gopls/internal/lsp/protocol/generate/main.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/generate/main.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,387 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.19
+-// +build go1.19
+-
+-// The generate command generates Go declarations from VSCode's
+-// description of the Language Server Protocol.
+-//
+-// To run it, type 'go generate' in the parent (protocol) directory.
+-package main
+-
+-import (
+- "bytes"
+- "encoding/json"
+- "flag"
+- "fmt"
+- "go/format"
+- "log"
+- "os"
+- "os/exec"
+- "path/filepath"
+- "strings"
+-)
+-
+-const vscodeRepo = "https://github.com/microsoft/vscode-languageserver-node"
+-
+-// lspGitRef names a branch or tag in vscodeRepo.
+-// It implicitly determines the protocol version of the LSP used by gopls.
+-// For example, tag release/protocol/3.17.3 of the repo defines protocol version 3.17.0.
+-// (Point releases are reflected in the git tag version even when they are cosmetic
+-// and don't change the protocol.)
+-var lspGitRef = "release/protocol/3.17.3-next.6"
+-
+-var (
+- repodir = flag.String("d", "", "directory containing clone of "+vscodeRepo)
+- outputdir = flag.String("o", ".", "output directory")
+- // PJW: not for real code
+- cmpdir = flag.String("c", "", "directory of earlier code")
+- doboth = flag.String("b", "", "generate and compare")
+-)
+-
+-func main() {
+- log.SetFlags(log.Lshortfile) // log file name and line number, not time
+- flag.Parse()
+-
+- processinline()
+-}
+-
+-func processinline() {
+- // A local repository may be specified during debugging.
+- // The default behavior is to download the canonical version.
+- if *repodir == "" {
+- tmpdir, err := os.MkdirTemp("", "")
+- if err != nil {
+- log.Fatal(err)
+- }
+- defer os.RemoveAll(tmpdir) // ignore error
+-
+- // Clone the repository.
+- cmd := exec.Command("git", "clone", "--quiet", "--depth=1", "-c", "advice.detachedHead=false", vscodeRepo, "--branch="+lspGitRef, "--single-branch", tmpdir)
+- cmd.Stdout = os.Stderr
+- cmd.Stderr = os.Stderr
+- if err := cmd.Run(); err != nil {
+- log.Fatal(err)
+- }
+-
+- *repodir = tmpdir
+- } else {
+- lspGitRef = fmt.Sprintf("(not git, local dir %s)", *repodir)
+- }
+-
+- model := parse(filepath.Join(*repodir, "protocol/metaModel.json"))
+-
+- findTypeNames(model)
+- generateOutput(model)
+-
+- fileHdr = fileHeader(model)
+-
+- // write the files
+- writeclient()
+- writeserver()
+- writeprotocol()
+- writejsons()
+-
+- checkTables()
+-}
+-
+-// common file header for output files
+-var fileHdr string
+-
+-func writeclient() {
+- out := new(bytes.Buffer)
+- fmt.Fprintln(out, fileHdr)
+- out.WriteString(
+- `import (
+- "context"
+- "encoding/json"
+-
+- "golang.org/x/tools/internal/jsonrpc2"
+-)
+-`)
+- out.WriteString("type Client interface {\n")
+- for _, k := range cdecls.keys() {
+- out.WriteString(cdecls[k])
+- }
+- out.WriteString("}\n\n")
+- out.WriteString("func clientDispatch(ctx context.Context, client Client, reply jsonrpc2.Replier, r jsonrpc2.Request) (bool, error) {\n")
+- out.WriteString("\tswitch r.Method() {\n")
+- for _, k := range ccases.keys() {
+- out.WriteString(ccases[k])
+- }
+- out.WriteString(("\tdefault:\n\t\treturn false, nil\n\t}\n}\n\n"))
+- for _, k := range cfuncs.keys() {
+- out.WriteString(cfuncs[k])
+- }
+-
+- x, err := format.Source(out.Bytes())
+- if err != nil {
+- os.WriteFile("/tmp/a.go", out.Bytes(), 0644)
+- log.Fatalf("tsclient.go: %v", err)
+- }
+-
+- if err := os.WriteFile(filepath.Join(*outputdir, "tsclient.go"), x, 0644); err != nil {
+- log.Fatalf("%v writing tsclient.go", err)
+- }
+-}
+-
+-func writeserver() {
+- out := new(bytes.Buffer)
+- fmt.Fprintln(out, fileHdr)
+- out.WriteString(
+- `import (
+- "context"
+- "encoding/json"
+-
+- "golang.org/x/tools/internal/jsonrpc2"
+-)
+-`)
+- out.WriteString("type Server interface {\n")
+- for _, k := range sdecls.keys() {
+- out.WriteString(sdecls[k])
+- }
+- out.WriteString(` NonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error)
+-}
+-
+-func serverDispatch(ctx context.Context, server Server, reply jsonrpc2.Replier, r jsonrpc2.Request) (bool, error) {
+- switch r.Method() {
+-`)
+- for _, k := range scases.keys() {
+- out.WriteString(scases[k])
+- }
+- out.WriteString(("\tdefault:\n\t\treturn false, nil\n\t}\n}\n\n"))
+- for _, k := range sfuncs.keys() {
+- out.WriteString(sfuncs[k])
+- }
+- out.WriteString(`func (s *serverDispatcher) NonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error) {
+- var result interface{}
+- if err := s.sender.Call(ctx, method, params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-`)
+-
+- x, err := format.Source(out.Bytes())
+- if err != nil {
+- os.WriteFile("/tmp/a.go", out.Bytes(), 0644)
+- log.Fatalf("tsserver.go: %v", err)
+- }
+-
+- if err := os.WriteFile(filepath.Join(*outputdir, "tsserver.go"), x, 0644); err != nil {
+- log.Fatalf("%v writing tsserver.go", err)
+- }
+-}
+-
+-func writeprotocol() {
+- out := new(bytes.Buffer)
+- fmt.Fprintln(out, fileHdr)
+- out.WriteString("import \"encoding/json\"\n\n")
+-
+- // The followiing are unneeded, but make the new code a superset of the old
+- hack := func(newer, existing string) {
+- if _, ok := types[existing]; !ok {
+- log.Fatalf("types[%q] not found", existing)
+- }
+- types[newer] = strings.Replace(types[existing], existing, newer, 1)
+- }
+- hack("ConfigurationParams", "ParamConfiguration")
+- hack("InitializeParams", "ParamInitialize")
+- hack("PreviousResultId", "PreviousResultID")
+- hack("WorkspaceFoldersServerCapabilities", "WorkspaceFolders5Gn")
+- hack("_InitializeParams", "XInitializeParams")
+- // and some aliases to make the new code contain the old
+- types["PrepareRename2Gn"] = "type PrepareRename2Gn = Msg_PrepareRename2Gn // (alias) line 13927\n"
+- types["PrepareRenameResult"] = "type PrepareRenameResult = Msg_PrepareRename2Gn // (alias) line 13927\n"
+- for _, k := range types.keys() {
+- if k == "WatchKind" {
+- types[k] = "type WatchKind = uint32 // line 13505" // strict gopls compatibility needs the '='
+- }
+- out.WriteString(types[k])
+- }
+-
+- out.WriteString("\nconst (\n")
+- for _, k := range consts.keys() {
+- out.WriteString(consts[k])
+- }
+- out.WriteString(")\n\n")
+- x, err := format.Source(out.Bytes())
+- if err != nil {
+- os.WriteFile("/tmp/a.go", out.Bytes(), 0644)
+- log.Fatalf("tsprotocol.go: %v", err)
+- }
+- if err := os.WriteFile(filepath.Join(*outputdir, "tsprotocol.go"), x, 0644); err != nil {
+- log.Fatalf("%v writing tsprotocol.go", err)
+- }
+-}
+-
+-func writejsons() {
+- out := new(bytes.Buffer)
+- fmt.Fprintln(out, fileHdr)
+- out.WriteString("import \"encoding/json\"\n\n")
+- out.WriteString("import \"fmt\"\n")
+-
+- out.WriteString(`
+-// UnmarshalError indicates that a JSON value did not conform to
+-// one of the expected cases of an LSP union type.
+-type UnmarshalError struct {
+- msg string
+-}
+-
+-func (e UnmarshalError) Error() string {
+- return e.msg
+-}
+-`)
+-
+- for _, k := range jsons.keys() {
+- out.WriteString(jsons[k])
+- }
+- x, err := format.Source(out.Bytes())
+- if err != nil {
+- os.WriteFile("/tmp/a.go", out.Bytes(), 0644)
+- log.Fatalf("tsjson.go: %v", err)
+- }
+- if err := os.WriteFile(filepath.Join(*outputdir, "tsjson.go"), x, 0644); err != nil {
+- log.Fatalf("%v writing tsjson.go", err)
+- }
+-}
+-
+-// create the common file header for the output files
+-func fileHeader(model Model) string {
+- fname := filepath.Join(*repodir, ".git", "HEAD")
+- buf, err := os.ReadFile(fname)
+- if err != nil {
+- log.Fatal(err)
+- }
+- buf = bytes.TrimSpace(buf)
+- var githash string
+- if len(buf) == 40 {
+- githash = string(buf[:40])
+- } else if bytes.HasPrefix(buf, []byte("ref: ")) {
+- fname = filepath.Join(*repodir, ".git", string(buf[5:]))
+- buf, err = os.ReadFile(fname)
+- if err != nil {
+- log.Fatal(err)
+- }
+- githash = string(buf[:40])
+- } else {
+- log.Fatalf("githash cannot be recovered from %s", fname)
+- }
+-
+- format := `// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Code generated for LSP. DO NOT EDIT.
+-
+-package protocol
+-
+-// Code generated from %[1]s at ref %[2]s (hash %[3]s).
+-// %[4]s/blob/%[2]s/%[1]s
+-// LSP metaData.version = %[5]s.
+-
+-`
+- return fmt.Sprintf(format,
+- "protocol/metaModel.json", // 1
+- lspGitRef, // 2
+- githash, // 3
+- vscodeRepo, // 4
+- model.Version.Version) // 5
+-}
+-
+-func parse(fname string) Model {
+- buf, err := os.ReadFile(fname)
+- if err != nil {
+- log.Fatal(err)
+- }
+- buf = addLineNumbers(buf)
+- var model Model
+- if err := json.Unmarshal(buf, &model); err != nil {
+- log.Fatal(err)
+- }
+- return model
+-}
+-
+-// Type.Value has to be treated specially for literals and maps
+-func (t *Type) UnmarshalJSON(data []byte) error {
+- // First unmarshal only the unambiguous fields.
+- var x struct {
+- Kind string `json:"kind"`
+- Items []*Type `json:"items"`
+- Element *Type `json:"element"`
+- Name string `json:"name"`
+- Key *Type `json:"key"`
+- Value any `json:"value"`
+- Line int `json:"line"`
+- }
+- if err := json.Unmarshal(data, &x); err != nil {
+- return err
+- }
+- *t = Type{
+- Kind: x.Kind,
+- Items: x.Items,
+- Element: x.Element,
+- Name: x.Name,
+- Value: x.Value,
+- Line: x.Line,
+- }
+-
+- // Then unmarshal the 'value' field based on the kind.
+- // This depends on Unmarshal ignoring fields it doesn't know about.
+- switch x.Kind {
+- case "map":
+- var x struct {
+- Key *Type `json:"key"`
+- Value *Type `json:"value"`
+- }
+- if err := json.Unmarshal(data, &x); err != nil {
+- return fmt.Errorf("Type.kind=map: %v", err)
+- }
+- t.Key = x.Key
+- t.Value = x.Value
+-
+- case "literal":
+- var z struct {
+- Value ParseLiteral `json:"value"`
+- }
+-
+- if err := json.Unmarshal(data, &z); err != nil {
+- return fmt.Errorf("Type.kind=literal: %v", err)
+- }
+- t.Value = z.Value
+-
+- case "base", "reference", "array", "and", "or", "tuple",
+- "stringLiteral":
+- // no-op. never seen integerLiteral or booleanLiteral.
+-
+- default:
+- return fmt.Errorf("cannot decode Type.kind %q: %s", x.Kind, data)
+- }
+- return nil
+-}
+-
+-// which table entries were not used
+-func checkTables() {
+- for k := range disambiguate {
+- if !usedDisambiguate[k] {
+- log.Printf("disambiguate[%v] unused", k)
+- }
+- }
+- for k := range renameProp {
+- if !usedRenameProp[k] {
+- log.Printf("renameProp {%q, %q} unused", k[0], k[1])
+- }
+- }
+- for k := range goplsStar {
+- if !usedGoplsStar[k] {
+- log.Printf("goplsStar {%q, %q} unused", k[0], k[1])
+- }
+- }
+- for k := range goplsType {
+- if !usedGoplsType[k] {
+- log.Printf("unused goplsType[%q]->%s", k, goplsType[k])
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/protocol/generate/main_test.go b/gopls/internal/lsp/protocol/generate/main_test.go
+--- a/gopls/internal/lsp/protocol/generate/main_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/generate/main_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,118 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.19
+-// +build go1.19
+-
+-package main
+-
+-import (
+- "encoding/json"
+- "fmt"
+- "log"
+- "os"
+- "testing"
+-)
+-
+-// These tests require the result of
+-//"git clone https://github.com/microsoft/vscode-languageserver-node" in the HOME directory
+-
+-// this is not a test, but a way to get code coverage,
+-// (in vscode, just run the test with "go.coverOnSingleTest": true)
+-func TestAll(t *testing.T) {
+- t.Skip("needs vscode-languageserver-node repository")
+- log.SetFlags(log.Lshortfile)
+- main()
+-}
+-
+-// check that the parsed file includes all the information
+-// from the json file. This test will fail if the spec
+-// introduces new fields. (one can test this test by
+-// commenting out the version field in Model.)
+-func TestParseContents(t *testing.T) {
+- t.Skip("needs vscode-languageserver-node repository")
+- log.SetFlags(log.Lshortfile)
+-
+- // compute our parse of the specification
+- dir := os.Getenv("HOME") + "/vscode-languageserver-node"
+- fname := dir + "/protocol/metaModel.json"
+- v := parse(fname)
+- out, err := json.Marshal(v)
+- if err != nil {
+- t.Fatal(err)
+- }
+- var our interface{}
+- if err := json.Unmarshal(out, &our); err != nil {
+- t.Fatal(err)
+- }
+-
+- // process the json file
+- buf, err := os.ReadFile(fname)
+- if err != nil {
+- t.Fatalf("could not read metaModel.json: %v", err)
+- }
+- var raw interface{}
+- if err := json.Unmarshal(buf, &raw); err != nil {
+- t.Fatal(err)
+- }
+-
+- // convert to strings showing the fields
+- them := flatten(raw)
+- us := flatten(our)
+-
+- // everything in them should be in us
+- lesser := make(sortedMap[bool])
+- for _, s := range them {
+- lesser[s] = true
+- }
+- greater := make(sortedMap[bool]) // set of fields we have
+- for _, s := range us {
+- greater[s] = true
+- }
+- for _, k := range lesser.keys() { // set if fields they have
+- if !greater[k] {
+- t.Errorf("missing %s", k)
+- }
+- }
+-}
+-
+-// flatten(nil) = "nil"
+-// flatten(v string) = fmt.Sprintf("%q", v)
+-// flatten(v float64)= fmt.Sprintf("%g", v)
+-// flatten(v bool) = fmt.Sprintf("%v", v)
+-// flatten(v []any) = []string{"[0]"flatten(v[0]), "[1]"flatten(v[1]), ...}
+-// flatten(v map[string]any) = {"key1": flatten(v["key1"]), "key2": flatten(v["key2"]), ...}
+-func flatten(x any) []string {
+- switch v := x.(type) {
+- case nil:
+- return []string{"nil"}
+- case string:
+- return []string{fmt.Sprintf("%q", v)}
+- case float64:
+- return []string{fmt.Sprintf("%g", v)}
+- case bool:
+- return []string{fmt.Sprintf("%v", v)}
+- case []any:
+- var ans []string
+- for i, x := range v {
+- idx := fmt.Sprintf("[%.3d]", i)
+- for _, s := range flatten(x) {
+- ans = append(ans, idx+s)
+- }
+- }
+- return ans
+- case map[string]any:
+- var ans []string
+- for k, x := range v {
+- idx := fmt.Sprintf("%q:", k)
+- for _, s := range flatten(x) {
+- ans = append(ans, idx+s)
+- }
+- }
+- return ans
+- default:
+- log.Fatalf("unexpected type %T", x)
+- return nil
+- }
+-}
+diff -urN a/gopls/internal/lsp/protocol/generate/output.go b/gopls/internal/lsp/protocol/generate/output.go
+--- a/gopls/internal/lsp/protocol/generate/output.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/generate/output.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,420 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.19
+-// +build go1.19
+-
+-package main
+-
+-import (
+- "bytes"
+- "fmt"
+- "log"
+- "sort"
+- "strings"
+-)
+-
+-var (
+- // tsclient.go has 3 sections
+- cdecls = make(sortedMap[string])
+- ccases = make(sortedMap[string])
+- cfuncs = make(sortedMap[string])
+- // tsserver.go has 3 sections
+- sdecls = make(sortedMap[string])
+- scases = make(sortedMap[string])
+- sfuncs = make(sortedMap[string])
+- // tsprotocol.go has 2 sections
+- types = make(sortedMap[string])
+- consts = make(sortedMap[string])
+- // tsjson has 1 section
+- jsons = make(sortedMap[string])
+-)
+-
+-func generateOutput(model Model) {
+- for _, r := range model.Requests {
+- genDecl(r.Method, r.Params, r.Result, r.Direction)
+- genCase(r.Method, r.Params, r.Result, r.Direction)
+- genFunc(r.Method, r.Params, r.Result, r.Direction, false)
+- }
+- for _, n := range model.Notifications {
+- if n.Method == "$/cancelRequest" {
+- continue // handled internally by jsonrpc2
+- }
+- genDecl(n.Method, n.Params, nil, n.Direction)
+- genCase(n.Method, n.Params, nil, n.Direction)
+- genFunc(n.Method, n.Params, nil, n.Direction, true)
+- }
+- genStructs(model)
+- genAliases(model)
+- genGenTypes() // generate the unnamed types
+- genConsts(model)
+- genMarshal()
+-}
+-
+-func genDecl(method string, param, result *Type, dir string) {
+- fname := methodNames[method]
+- p := ""
+- if notNil(param) {
+- p = ", *" + goplsName(param)
+- }
+- ret := "error"
+- if notNil(result) {
+- tp := goplsName(result)
+- if !hasNilValue(tp) {
+- tp = "*" + tp
+- }
+- ret = fmt.Sprintf("(%s, error)", tp)
+- }
+- // special gopls compatibility case (PJW: still needed?)
+- switch method {
+- case "workspace/configuration":
+- // was And_Param_workspace_configuration, but the type substitution doesn't work,
+- // as ParamConfiguration is embedded in And_Param_workspace_configuration
+- p = ", *ParamConfiguration"
+- ret = "([]LSPAny, error)"
+- }
+- msg := fmt.Sprintf("\t%s(context.Context%s) %s // %s\n", fname, p, ret, method)
+- switch dir {
+- case "clientToServer":
+- sdecls[method] = msg
+- case "serverToClient":
+- cdecls[method] = msg
+- case "both":
+- sdecls[method] = msg
+- cdecls[method] = msg
+- default:
+- log.Fatalf("impossible direction %q", dir)
+- }
+-}
+-
+-func genCase(method string, param, result *Type, dir string) {
+- out := new(bytes.Buffer)
+- fmt.Fprintf(out, "\tcase %q:\n", method)
+- var p string
+- fname := methodNames[method]
+- if notNil(param) {
+- nm := goplsName(param)
+- if method == "workspace/configuration" { // gopls compatibility
+- // was And_Param_workspace_configuration, which contains ParamConfiguration
+- // so renaming the type leads to circular definitions
+- nm = "ParamConfiguration" // gopls compatibility
+- }
+- fmt.Fprintf(out, "\t\tvar params %s\n", nm)
+- fmt.Fprintf(out, "\t\tif err := json.Unmarshal(r.Params(), &params); err != nil {\n")
+- fmt.Fprintf(out, "\t\t\treturn true, sendParseError(ctx, reply, err)\n\t\t}\n")
+- p = ", &params"
+- }
+- if notNil(result) {
+- fmt.Fprintf(out, "\t\tresp, err := %%s.%s(ctx%s)\n", fname, p)
+- out.WriteString("\t\tif err != nil {\n")
+- out.WriteString("\t\t\treturn true, reply(ctx, nil, err)\n")
+- out.WriteString("\t\t}\n")
+- out.WriteString("\t\treturn true, reply(ctx, resp, nil)\n")
+- } else {
+- fmt.Fprintf(out, "\t\terr := %%s.%s(ctx%s)\n", fname, p)
+- out.WriteString("\t\treturn true, reply(ctx, nil, err)\n")
+- }
+- msg := out.String()
+- switch dir {
+- case "clientToServer":
+- scases[method] = fmt.Sprintf(msg, "server")
+- case "serverToClient":
+- ccases[method] = fmt.Sprintf(msg, "client")
+- case "both":
+- scases[method] = fmt.Sprintf(msg, "server")
+- ccases[method] = fmt.Sprintf(msg, "client")
+- default:
+- log.Fatalf("impossible direction %q", dir)
+- }
+-}
+-
+-func genFunc(method string, param, result *Type, dir string, isnotify bool) {
+- out := new(bytes.Buffer)
+- var p, r string
+- var goResult string
+- if notNil(param) {
+- p = ", params *" + goplsName(param)
+- }
+- if notNil(result) {
+- goResult = goplsName(result)
+- if !hasNilValue(goResult) {
+- goResult = "*" + goResult
+- }
+- r = fmt.Sprintf("(%s, error)", goResult)
+- } else {
+- r = "error"
+- }
+- // special gopls compatibility case
+- switch method {
+- case "workspace/configuration":
+- // was And_Param_workspace_configuration, but the type substitution doesn't work,
+- // as ParamConfiguration is embedded in And_Param_workspace_configuration
+- p = ", params *ParamConfiguration"
+- r = "([]LSPAny, error)"
+- goResult = "[]LSPAny"
+- }
+- fname := methodNames[method]
+- fmt.Fprintf(out, "func (s *%%sDispatcher) %s(ctx context.Context%s) %s {\n",
+- fname, p, r)
+-
+- if !notNil(result) {
+- if isnotify {
+- if notNil(param) {
+- fmt.Fprintf(out, "\treturn s.sender.Notify(ctx, %q, params)\n", method)
+- } else {
+- fmt.Fprintf(out, "\treturn s.sender.Notify(ctx, %q, nil)\n", method)
+- }
+- } else {
+- if notNil(param) {
+- fmt.Fprintf(out, "\treturn s.sender.Call(ctx, %q, params, nil)\n", method)
+- } else {
+- fmt.Fprintf(out, "\treturn s.sender.Call(ctx, %q, nil, nil)\n", method)
+- }
+- }
+- } else {
+- fmt.Fprintf(out, "\tvar result %s\n", goResult)
+- if isnotify {
+- if notNil(param) {
+- fmt.Fprintf(out, "\ts.sender.Notify(ctx, %q, params)\n", method)
+- } else {
+- fmt.Fprintf(out, "\t\tif err := s.sender.Notify(ctx, %q, nil); err != nil {\n", method)
+- }
+- } else {
+- if notNil(param) {
+- fmt.Fprintf(out, "\t\tif err := s.sender.Call(ctx, %q, params, &result); err != nil {\n", method)
+- } else {
+- fmt.Fprintf(out, "\t\tif err := s.sender.Call(ctx, %q, nil, &result); err != nil {\n", method)
+- }
+- }
+- fmt.Fprintf(out, "\t\treturn nil, err\n\t}\n\treturn result, nil\n")
+- }
+- out.WriteString("}\n")
+- msg := out.String()
+- switch dir {
+- case "clientToServer":
+- sfuncs[method] = fmt.Sprintf(msg, "server")
+- case "serverToClient":
+- cfuncs[method] = fmt.Sprintf(msg, "client")
+- case "both":
+- sfuncs[method] = fmt.Sprintf(msg, "server")
+- cfuncs[method] = fmt.Sprintf(msg, "client")
+- default:
+- log.Fatalf("impossible direction %q", dir)
+- }
+-}
+-
+-func genStructs(model Model) {
+- structures := make(map[string]*Structure) // for expanding Extends
+- for _, s := range model.Structures {
+- structures[s.Name] = s
+- }
+- for _, s := range model.Structures {
+- out := new(bytes.Buffer)
+- generateDoc(out, s.Documentation)
+- nm := goName(s.Name)
+- if nm == "string" { // an unacceptable strut name
+- // a weird case, and needed only so the generated code contains the old gopls code
+- nm = "DocumentDiagnosticParams"
+- }
+- fmt.Fprintf(out, "type %s struct { // line %d\n", nm, s.Line)
+- // for gpls compatibilitye, embed most extensions, but expand the rest some day
+- props := append([]NameType{}, s.Properties...)
+- if s.Name == "SymbolInformation" { // but expand this one
+- for _, ex := range s.Extends {
+- fmt.Fprintf(out, "\t// extends %s\n", ex.Name)
+- props = append(props, structures[ex.Name].Properties...)
+- }
+- genProps(out, props, nm)
+- } else {
+- genProps(out, props, nm)
+- for _, ex := range s.Extends {
+- fmt.Fprintf(out, "\t%s\n", goName(ex.Name))
+- }
+- }
+- for _, ex := range s.Mixins {
+- fmt.Fprintf(out, "\t%s\n", goName(ex.Name))
+- }
+- out.WriteString("}\n")
+- types[nm] = out.String()
+- }
+- // base types
+- types["DocumentURI"] = "type DocumentURI string\n"
+- types["URI"] = "type URI = string\n"
+-
+- types["LSPAny"] = "type LSPAny = interface{}\n"
+- // A special case, the only previously existing Or type
+- types["DocumentDiagnosticReport"] = "type DocumentDiagnosticReport = Or_DocumentDiagnosticReport // (alias) line 13909\n"
+-
+-}
+-
+-func genProps(out *bytes.Buffer, props []NameType, name string) {
+- for _, p := range props {
+- tp := goplsName(p.Type)
+- if newNm, ok := renameProp[prop{name, p.Name}]; ok {
+- usedRenameProp[prop{name, p.Name}] = true
+- if tp == newNm {
+- log.Printf("renameProp useless {%q, %q} for %s", name, p.Name, tp)
+- }
+- tp = newNm
+- }
+- // it's a pointer if it is optional, or for gopls compatibility
+- opt, star := propStar(name, p, tp)
+- json := fmt.Sprintf(" `json:\"%s%s\"`", p.Name, opt)
+- generateDoc(out, p.Documentation)
+- fmt.Fprintf(out, "\t%s %s%s %s\n", goName(p.Name), star, tp, json)
+- }
+-}
+-
+-func genAliases(model Model) {
+- for _, ta := range model.TypeAliases {
+- out := new(bytes.Buffer)
+- generateDoc(out, ta.Documentation)
+- nm := goName(ta.Name)
+- if nm != ta.Name {
+- continue // renamed the type, e.g., "DocumentDiagnosticReport", an or-type to "string"
+- }
+- tp := goplsName(ta.Type)
+- fmt.Fprintf(out, "type %s = %s // (alias) line %d\n", nm, tp, ta.Line)
+- types[nm] = out.String()
+- }
+-}
+-
+-func genGenTypes() {
+- for _, nt := range genTypes {
+- out := new(bytes.Buffer)
+- nm := goplsName(nt.typ)
+- switch nt.kind {
+- case "literal":
+- fmt.Fprintf(out, "// created for Literal (%s)\n", nt.name)
+- fmt.Fprintf(out, "type %s struct { // line %d\n", nm, nt.line+1)
+- genProps(out, nt.properties, nt.name) // systematic name, not gopls name; is this a good choice?
+- case "or":
+- if !strings.HasPrefix(nm, "Or") {
+- // It was replaced by a narrower type defined elsewhere
+- continue
+- }
+- names := []string{}
+- for _, t := range nt.items {
+- if notNil(t) {
+- names = append(names, goplsName(t))
+- }
+- }
+- sort.Strings(names)
+- fmt.Fprintf(out, "// created for Or %v\n", names)
+- fmt.Fprintf(out, "type %s struct { // line %d\n", nm, nt.line+1)
+- fmt.Fprintf(out, "\tValue interface{} `json:\"value\"`\n")
+- case "and":
+- fmt.Fprintf(out, "// created for And\n")
+- fmt.Fprintf(out, "type %s struct { // line %d\n", nm, nt.line+1)
+- for _, x := range nt.items {
+- nm := goplsName(x)
+- fmt.Fprintf(out, "\t%s\n", nm)
+- }
+- case "tuple": // there's only this one
+- nt.name = "UIntCommaUInt"
+- fmt.Fprintf(out, "//created for Tuple\ntype %s struct { // line %d\n", nm, nt.line+1)
+- fmt.Fprintf(out, "\tFld0 uint32 `json:\"fld0\"`\n")
+- fmt.Fprintf(out, "\tFld1 uint32 `json:\"fld1\"`\n")
+- default:
+- log.Fatalf("%s not handled", nt.kind)
+- }
+- out.WriteString("}\n")
+- types[nm] = out.String()
+- }
+-}
+-func genConsts(model Model) {
+- for _, e := range model.Enumerations {
+- out := new(bytes.Buffer)
+- generateDoc(out, e.Documentation)
+- tp := goplsName(e.Type)
+- nm := goName(e.Name)
+- fmt.Fprintf(out, "type %s %s // line %d\n", nm, tp, e.Line)
+- types[nm] = out.String()
+- vals := new(bytes.Buffer)
+- generateDoc(vals, e.Documentation)
+- for _, v := range e.Values {
+- generateDoc(vals, v.Documentation)
+- nm := goName(v.Name)
+- more, ok := disambiguate[e.Name]
+- if ok {
+- usedDisambiguate[e.Name] = true
+- nm = more.prefix + nm + more.suffix
+- nm = goName(nm) // stringType
+- }
+- var val string
+- switch v := v.Value.(type) {
+- case string:
+- val = fmt.Sprintf("%q", v)
+- case float64:
+- val = fmt.Sprintf("%d", int(v))
+- default:
+- log.Fatalf("impossible type %T", v)
+- }
+- fmt.Fprintf(vals, "\t%s %s = %s // line %d\n", nm, e.Name, val, v.Line)
+- }
+- consts[nm] = vals.String()
+- }
+-}
+-func genMarshal() {
+- for _, nt := range genTypes {
+- nm := goplsName(nt.typ)
+- if !strings.HasPrefix(nm, "Or") {
+- continue
+- }
+- names := []string{}
+- for _, t := range nt.items {
+- if notNil(t) {
+- names = append(names, goplsName(t))
+- }
+- }
+- sort.Strings(names)
+- var buf bytes.Buffer
+- fmt.Fprintf(&buf, "// from line %d\n", nt.line)
+- fmt.Fprintf(&buf, "func (t %s) MarshalJSON() ([]byte, error) {\n", nm)
+- buf.WriteString("\tswitch x := t.Value.(type){\n")
+- for _, nmx := range names {
+- fmt.Fprintf(&buf, "\tcase %s:\n", nmx)
+- fmt.Fprintf(&buf, "\t\treturn json.Marshal(x)\n")
+- }
+- buf.WriteString("\tcase nil:\n\t\treturn []byte(\"null\"), nil\n\t}\n")
+- fmt.Fprintf(&buf, "\treturn nil, fmt.Errorf(\"type %%T not one of %v\", t)\n", names)
+- buf.WriteString("}\n\n")
+-
+- fmt.Fprintf(&buf, "func (t *%s) UnmarshalJSON(x []byte) error {\n", nm)
+- buf.WriteString("\tif string(x) == \"null\" {\n\t\tt.Value = nil\n\t\t\treturn nil\n\t}\n")
+- for i, nmx := range names {
+- fmt.Fprintf(&buf, "\tvar h%d %s\n", i, nmx)
+- fmt.Fprintf(&buf, "\tif err := json.Unmarshal(x, &h%d); err == nil {\n\t\tt.Value = h%d\n\t\t\treturn nil\n\t\t}\n", i, i)
+- }
+- fmt.Fprintf(&buf, "return &UnmarshalError{\"unmarshal failed to match one of %v\"}", names)
+- buf.WriteString("}\n\n")
+- jsons[nm] = buf.String()
+- }
+-}
+-
+-func goplsName(t *Type) string {
+- nm := typeNames[t]
+- // translate systematic name to gopls name
+- if newNm, ok := goplsType[nm]; ok {
+- usedGoplsType[nm] = true
+- nm = newNm
+- }
+- return nm
+-}
+-
+-func notNil(t *Type) bool { // shutdwon is the special case that needs this
+- return t != nil && (t.Kind != "base" || t.Name != "null")
+-}
+-
+-func hasNilValue(t string) bool {
+- // this may be unreliable, and need a supplementary table
+- if strings.HasPrefix(t, "[]") || strings.HasPrefix(t, "*") {
+- return true
+- }
+- if t == "interface{}" || t == "any" {
+- return true
+- }
+- // that's all the cases that occur currently
+- return false
+-}
+diff -urN a/gopls/internal/lsp/protocol/generate/README.md b/gopls/internal/lsp/protocol/generate/README.md
+--- a/gopls/internal/lsp/protocol/generate/README.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/generate/README.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,136 +0,0 @@
+-# LSP Support for gopls
+-
+-## The protocol
+-
+-The LSP protocol exchanges json-encoded messages between the client and the server.
+-(gopls is the server.) The messages are either Requests, which require Responses, or
+-Notifications, which generate no response. Each Request or Notification has a method name
+-such as "textDocument/hover" that indicates its meaning and determines which function in the server will handle it.
+-The protocol is described in a
+-[web page](https://microsoft.github.io/language-server-protocol/specifications/lsp/3.18/specification/),
+-in words, and in a json file (metaModel.json) available either linked towards the bottom of the
+-web page, or in the vscode-languageserver-node repository. This code uses the latter so the
+-exact version can be tied to a githash. By default, the command will download the `github.com/microsoft/vscode-languageserver-node` repository to a temporary directory.
+-
+-The specification has five sections
+-1. Requests, which describe the Request and Response types for request methods (e.g., *textDocument/didChange*),
+-2. Notifications, which describe the Request types for notification methods,
+-3. Structures, which describe named struct-like types,
+-4. TypeAliases, which describe type aliases,
+-5. Enumerations, which describe named constants.
+-
+-Requests and Notifications are tagged with a Method (e.g., `"textDocument/hover"`).
+-The specification does not specify the names of the functions that handle the messages. These
+-names are specified by the `methodNames` map. Enumerations generate Go `const`s, but
+-in Typescript they are scoped to namespaces, while in Go they are scoped to a package, so the Go names
+-may need to be modified to avoid name collisions. (See the `disambiguate` map, and its use.)
+-
+-Finally, the specified types are Typescript types, which are quite different from Go types.
+-
+-### Optionality
+-The specification can mark fields in structs as Optional. The client distinguishes between missing
+-fields and `null` fields in some cases. The Go translation for an optional type
+-should be making sure the field's value
+-can be `nil`, and adding the json tag `,omitempty`. The former condition would be satisfied by
+-adding `*` to the field's type if the type is not a reference type.
+-
+-### Types
+-The specification uses a number of different types, only a few of which correspond directly to Go types.
+-The specification's types are "base", "reference", "map", "literal", "stringLiteral", "tuple", "and", "or".
+-The "base" types correspond directly to Go types, although some Go types needs to be chosen for `URI` and `DocumentUri`. (The "base" types`RegExp`, `BooleanLiteral`, `NumericLiteral` never occur.)
+-
+-"reference" types are the struct-like types in the Structures section of the specification. The given
+-names are suitable for Go to use, except the code needs to change names like `_Initialze` to `XInitialize` so
+-they are exported for json marshaling and unmarshaling.
+-
+-"map" types are just like Go. (The key type in all of them is `DocumentUri`.)
+-
+-"stringLiteral" types are types whose type name and value are a single string. The chosen Go equivalent
+-is to make the type `string` and the value a constant. (The alternative would be to generate a new
+-named type, which seemed redundant.)
+-
+-"literal" types are like Go anonymous structs, so they have to be given a name. (All instances
+-of the remaining types have to be given names. One approach is to construct the name from the components
+-of the type, but this leads to misleading punning, and is unstable if components are added. The other approach
+-is to construct the name from the context of the definition, that is, from the types it is defined within.
+-For instance `Lit__InitializeParams_clientInfo` is the "literal" type at the
+-`clientInfo` field in the `_InitializeParams`
+-struct. Although this choice is sensitive to the ordering of the components, the code uses this approach,
+-presuming that reordering components is an unlikely protocol change.)
+-
+-"tuple" types are generated as Go structs. (There is only one, with two `uint32` fields.)
+-
+-"and" types are Go structs with embedded type names. (There is only one, `And_Param_workspace_configuration`.)
+-
+-"or" types are the most complicated. There are a lot of them and there is no simple Go equivalent.
+-They are defined as structs with a single `Value interface{}` field and custom json marshaling
+-and unmarshaling code. Users can assign anything to `Value` but the type will be checked, and
+-correctly marshaled, by the custom marshaling code. The unmarshaling code checks types, so `Value`
+-will have one of the permitted types. (`nil` is always allowed.) There are about 40 "or" types that
+-have a single non-null component, and these are converted to the component type.
+-
+-## Processing
+-The code parses the json specification file, and scans all the types. It assigns names, as described
+-above, to the types that are unnamed in the specification, and constructs Go equivalents as required.
+-(Most of this code is in typenames.go.)
+-
+-There are four output files. tsclient.go and tsserver.go contain the definition and implementation
+-of the `protocol.Client` and `protocol.Server` types and the code that dispatches on the Method
+-of the Request or Notification. tsjson.go contains the custom marshaling and unmarshaling code.
+-And tsprotocol.go contains the type and const definitions.
+-
+-### Accommodating gopls
+-As the code generates output, mostly in generateoutput.go and main.go,
+-it makes adjustments so that no changes are required to the existing Go code.
+-(Organizing the computation this way makes the code's structure simpler, but results in
+-a lot of unused types.)
+-There are three major classes of these adjustments, and leftover special cases.
+-
+-The first major
+-adjustment is to change generated type names to the ones gopls expects. Some of these don't change the
+-semantics of the type, just the name.
+-But for historical reasons a lot of them replace "or" types by a single
+-component of the type. (Until fairly recently Go only saw or used only one of components.)
+-The `goplsType` map in tables.go controls this process.
+-
+-The second major adjustment is to the types of fields of structs, which is done using the
+-`renameProp` map in tables.go.
+-
+-The third major adjustment handles optionality, controlling `*` and `,omitempty` placement when
+-the default rules don't match what gopls is expecting. (The map is `goplsStar`, also in tables.go)
+-(If the intermediate components in expressions of the form `A.B.C.S` were optional, the code would need
+-a lot of useless checking for nils. Typescript has a language construct to avoid most checks.)
+-
+-Then there are some additional special cases. There are a few places with adjustments to avoid
+-recursive types. For instance `LSPArray` is `[]LSPAny`, but `LSPAny` is an "or" type including `LSPArray`.
+-The solution is to make `LSPAny` an `interface{}`. Another instance is `_InitializeParams.trace`
+-whose type is an "or" of 3 stringLiterals, which just becomes a `string`.
+-
+-### Checking
+-`TestAll(t *testing.T)` checks that there are no unexpected fields in the json specification.
+-
+-While the code is executing, it checks that all the entries in the maps in tables.go are used.
+-It also checks that the entries in `renameProp` and `goplsStar` are not redundant.
+-
+-As a one-time check on the first release of this code, diff-ing the existing and generated tsclient.go
+-and tsserver.go code results in only whitespace and comment diffs. The existing and generated
+-tsprotocol.go differ in whitespace and comments, and in a substantial number of new type definitions
+-that the older, more heuristic, code did not generate. (And the unused type `_InitializeParams` differs
+-slightly between the new and the old, and is not worth fixing.)
+-
+-### Some history
+-The original stub code was written by hand, but with the protocol under active development, that
+-couldn't last. The web page existed before the json specification, but it lagged the implementation
+-and was hard to process by machine. So the earlier version of the generating code was written in Typescript, and
+-used the Typescript compiler's API to parse the protocol code in the repository.
+-It then used a set of heuristics
+-to pick out the elements of the protocol, and another set of overlapping heuristics to create the Go code.
+-The output was functional, but idiosyncratic, and the code was fragile and barely maintainable.
+-
+-### The future
+-Most of the adjustments using the maps in tables.go could be removed by making changes, mostly to names,
+-in the gopls code. Using more "or" types in gopls requires more elaborate, but stereotyped, changes.
+-But even without all the adjustments, making this its own module would face problems; a number of
+-dependencies would have to be factored out. And, it is fragile. The custom unmarshaling code knows what
+-types it expects. A design that return an 'any' on unexpected types would match the json
+-'ignore unexpected values' philosophy better, but the the Go code would need extra checking.
+diff -urN a/gopls/internal/lsp/protocol/generate/tables.go b/gopls/internal/lsp/protocol/generate/tables.go
+--- a/gopls/internal/lsp/protocol/generate/tables.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/generate/tables.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,327 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.19
+-// +build go1.19
+-
+-package main
+-
+-// prop combines the name of a property with the name of the structure it is in.
+-type prop [2]string
+-
+-const (
+- nothing = iota
+- wantStar
+- wantOpt
+- wantOptStar
+-)
+-
+-// goplsStar records the optionality of each field in the protocol.
+-// The comments are vague hints as to why removing the line is not trivial.
+-// A.B.C.D means that one of B or C would change to a pointer
+-// so a test or initialization would be needed
+-var goplsStar = map[prop]int{
+- {"ClientCapabilities", "textDocument"}: wantOpt, // A.B.C.D at fake/editor.go:255
+- {"ClientCapabilities", "window"}: wantOpt, // regtest failures
+- {"ClientCapabilities", "workspace"}: wantOpt, // regtest failures
+- {"CodeAction", "kind"}: wantOpt, // A.B.C.D
+-
+- {"CodeActionClientCapabilities", "codeActionLiteralSupport"}: wantOpt, // regtest failures
+-
+- {"CompletionClientCapabilities", "completionItem"}: wantOpt, // A.B.C.D
+- {"CompletionClientCapabilities", "insertTextMode"}: wantOpt, // A.B.C.D
+- {"CompletionItem", "kind"}: wantOpt, // need temporary variables
+- {"CompletionParams", "context"}: wantOpt, // needs nil checks
+-
+- {"Diagnostic", "severity"}: wantOpt, // nil checks or more careful thought
+- {"DidSaveTextDocumentParams", "text"}: wantOptStar, // capabilities_test.go:112 logic
+- {"DocumentHighlight", "kind"}: wantOpt, // need temporary variables
+- {"Hover", "range"}: wantOpt, // complex expressions
+- {"InlayHint", "kind"}: wantOpt, // temporary variables
+-
+- {"Lit_CompletionClientCapabilities_completionItem", "tagSupport"}: nothing, // A.B.C.
+- {"Lit_SemanticTokensClientCapabilities_requests", "full"}: nothing, // A.B.C.D
+- {"Lit_SemanticTokensClientCapabilities_requests", "range"}: nothing, // A.B.C.D
+- {"Lit_SemanticTokensClientCapabilities_requests_full_Item1", "delta"}: nothing, // A.B.C.D
+- {"Lit_SemanticTokensOptions_full_Item1", "delta"}: nothing, // A.B.C.
+-
+- {"Lit_TextDocumentContentChangeEvent_Item0", "range"}: wantStar, // == nil test
+-
+- {"TextDocumentClientCapabilities", "codeAction"}: wantOpt, // A.B.C.D
+- {"TextDocumentClientCapabilities", "completion"}: wantOpt, // A.B.C.D
+- {"TextDocumentClientCapabilities", "documentSymbol"}: wantOpt, // A.B.C.D
+- {"TextDocumentClientCapabilities", "publishDiagnostics"}: wantOpt, //A.B.C.D
+- {"TextDocumentClientCapabilities", "semanticTokens"}: wantOpt, // A.B.C.D
+- {"TextDocumentSyncOptions", "change"}: wantOpt, // &constant
+- {"WorkDoneProgressParams", "workDoneToken"}: wantOpt, // regtest
+- {"WorkspaceClientCapabilities", "didChangeConfiguration"}: wantOpt, // A.B.C.D
+- {"WorkspaceClientCapabilities", "didChangeWatchedFiles"}: wantOpt, // A.B.C.D
+-}
+-
+-// keep track of which entries in goplsStar are used
+-var usedGoplsStar = make(map[prop]bool)
+-
+-// For gopls compatibility, use a different, typically more restrictive, type for some fields.
+-var renameProp = map[prop]string{
+- {"CancelParams", "id"}: "interface{}",
+- {"Command", "arguments"}: "[]json.RawMessage",
+- {"CompletionItem", "textEdit"}: "TextEdit",
+- {"Diagnostic", "code"}: "interface{}",
+-
+- {"DocumentDiagnosticReportPartialResult", "relatedDocuments"}: "map[DocumentURI]interface{}",
+-
+- {"ExecuteCommandParams", "arguments"}: "[]json.RawMessage",
+- {"FoldingRange", "kind"}: "string",
+- {"Hover", "contents"}: "MarkupContent",
+- {"InlayHint", "label"}: "[]InlayHintLabelPart",
+-
+- {"RelatedFullDocumentDiagnosticReport", "relatedDocuments"}: "map[DocumentURI]interface{}",
+- {"RelatedUnchangedDocumentDiagnosticReport", "relatedDocuments"}: "map[DocumentURI]interface{}",
+-
+- // PJW: this one is tricky.
+- {"ServerCapabilities", "codeActionProvider"}: "interface{}",
+-
+- {"ServerCapabilities", "inlayHintProvider"}: "interface{}",
+- // slightly tricky
+- {"ServerCapabilities", "renameProvider"}: "interface{}",
+- // slightly tricky
+- {"ServerCapabilities", "semanticTokensProvider"}: "interface{}",
+- // slightly tricky
+- {"ServerCapabilities", "textDocumentSync"}: "interface{}",
+- {"TextDocumentEdit", "edits"}: "[]TextEdit",
+- {"TextDocumentSyncOptions", "save"}: "SaveOptions",
+- {"WorkspaceEdit", "documentChanges"}: "[]DocumentChanges",
+-}
+-
+-// which entries of renameProp were used
+-var usedRenameProp = make(map[prop]bool)
+-
+-type adjust struct {
+- prefix, suffix string
+-}
+-
+-// disambiguate specifies prefixes or suffixes to add to all values of
+-// some enum types to avoid name conflicts
+-var disambiguate = map[string]adjust{
+- "CodeActionTriggerKind": {"CodeAction", ""},
+- "CompletionItemKind": {"", "Completion"},
+- "CompletionItemTag": {"Compl", ""},
+- "DiagnosticSeverity": {"Severity", ""},
+- "DocumentDiagnosticReportKind": {"Diagnostic", ""},
+- "FileOperationPatternKind": {"", "Pattern"},
+- "InsertTextFormat": {"", "TextFormat"},
+- "SemanticTokenModifiers": {"Mod", ""},
+- "SemanticTokenTypes": {"", "Type"},
+- "SignatureHelpTriggerKind": {"Sig", ""},
+- "SymbolTag": {"", "Symbol"},
+- "WatchKind": {"Watch", ""},
+-}
+-
+-// which entries of disambiguate got used
+-var usedDisambiguate = make(map[string]bool)
+-
+-// for gopls compatibility, replace generated type names with existing ones
+-var goplsType = map[string]string{
+- "And_RegOpt_textDocument_colorPresentation": "WorkDoneProgressOptionsAndTextDocumentRegistrationOptions",
+- "ConfigurationParams": "ParamConfiguration",
+- "DocumentDiagnosticParams": "string",
+- "DocumentDiagnosticReport": "string",
+- "DocumentUri": "DocumentURI",
+- "InitializeParams": "ParamInitialize",
+- "LSPAny": "interface{}",
+-
+- "Lit_CodeActionClientCapabilities_codeActionLiteralSupport": "PCodeActionLiteralSupportPCodeAction",
+- "Lit_CodeActionClientCapabilities_codeActionLiteralSupport_codeActionKind": "FCodeActionKindPCodeActionLiteralSupport",
+-
+- "Lit_CodeActionClientCapabilities_resolveSupport": "PResolveSupportPCodeAction",
+- "Lit_CodeAction_disabled": "PDisabledMsg_textDocument_codeAction",
+- "Lit_CompletionClientCapabilities_completionItem": "PCompletionItemPCompletion",
+- "Lit_CompletionClientCapabilities_completionItemKind": "PCompletionItemKindPCompletion",
+-
+- "Lit_CompletionClientCapabilities_completionItem_insertTextModeSupport": "FInsertTextModeSupportPCompletionItem",
+-
+- "Lit_CompletionClientCapabilities_completionItem_resolveSupport": "FResolveSupportPCompletionItem",
+- "Lit_CompletionClientCapabilities_completionItem_tagSupport": "FTagSupportPCompletionItem",
+-
+- "Lit_CompletionClientCapabilities_completionList": "PCompletionListPCompletion",
+- "Lit_CompletionList_itemDefaults": "PItemDefaultsMsg_textDocument_completion",
+- "Lit_CompletionList_itemDefaults_editRange_Item1": "FEditRangePItemDefaults",
+- "Lit_CompletionOptions_completionItem": "PCompletionItemPCompletionProvider",
+- "Lit_DocumentSymbolClientCapabilities_symbolKind": "PSymbolKindPDocumentSymbol",
+- "Lit_DocumentSymbolClientCapabilities_tagSupport": "PTagSupportPDocumentSymbol",
+- "Lit_FoldingRangeClientCapabilities_foldingRange": "PFoldingRangePFoldingRange",
+- "Lit_FoldingRangeClientCapabilities_foldingRangeKind": "PFoldingRangeKindPFoldingRange",
+- "Lit_GeneralClientCapabilities_staleRequestSupport": "PStaleRequestSupportPGeneral",
+- "Lit_InitializeResult_serverInfo": "PServerInfoMsg_initialize",
+- "Lit_InlayHintClientCapabilities_resolveSupport": "PResolveSupportPInlayHint",
+- "Lit_MarkedString_Item1": "Msg_MarkedString",
+- "Lit_NotebookDocumentChangeEvent_cells": "PCellsPChange",
+- "Lit_NotebookDocumentChangeEvent_cells_structure": "FStructurePCells",
+- "Lit_NotebookDocumentFilter_Item0": "Msg_NotebookDocumentFilter",
+-
+- "Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0": "PNotebookSelectorPNotebookDocumentSync",
+-
+- "Lit_PrepareRenameResult_Item1": "Msg_PrepareRename2Gn",
+-
+- "Lit_PublishDiagnosticsClientCapabilities_tagSupport": "PTagSupportPPublishDiagnostics",
+- "Lit_SemanticTokensClientCapabilities_requests": "PRequestsPSemanticTokens",
+- "Lit_SemanticTokensClientCapabilities_requests_full_Item1": "FFullPRequests",
+- "Lit_SemanticTokensClientCapabilities_requests_range_Item1": "FRangePRequests",
+-
+- "Lit_SemanticTokensOptions_full_Item1": "PFullESemanticTokensOptions",
+- "Lit_SemanticTokensOptions_range_Item1": "PRangeESemanticTokensOptions",
+- "Lit_ServerCapabilities_workspace": "Workspace6Gn",
+-
+- "Lit_ShowMessageRequestClientCapabilities_messageActionItem": "PMessageActionItemPShowMessage",
+- "Lit_SignatureHelpClientCapabilities_signatureInformation": "PSignatureInformationPSignatureHelp",
+-
+- "Lit_SignatureHelpClientCapabilities_signatureInformation_parameterInformation": "FParameterInformationPSignatureInformation",
+-
+- "Lit_TextDocumentContentChangeEvent_Item0": "Msg_TextDocumentContentChangeEvent",
+- "Lit_TextDocumentFilter_Item0": "Msg_TextDocumentFilter",
+- "Lit_TextDocumentFilter_Item1": "Msg_TextDocumentFilter",
+- "Lit_WorkspaceEditClientCapabilities_changeAnnotationSupport": "PChangeAnnotationSupportPWorkspaceEdit",
+- "Lit_WorkspaceSymbolClientCapabilities_resolveSupport": "PResolveSupportPSymbol",
+- "Lit_WorkspaceSymbolClientCapabilities_symbolKind": "PSymbolKindPSymbol",
+- "Lit_WorkspaceSymbolClientCapabilities_tagSupport": "PTagSupportPSymbol",
+- "Lit_WorkspaceSymbol_location_Item1": "PLocationMsg_workspace_symbol",
+- "Lit__InitializeParams_clientInfo": "Msg_XInitializeParams_clientInfo",
+- "Or_CompletionList_itemDefaults_editRange": "OrFEditRangePItemDefaults",
+- "Or_Declaration": "[]Location",
+- "Or_DidChangeConfigurationRegistrationOptions_section": "OrPSection_workspace_didChangeConfiguration",
+- "Or_GlobPattern": "string",
+- "Or_InlayHintLabelPart_tooltip": "OrPTooltipPLabel",
+- "Or_InlayHint_tooltip": "OrPTooltip_textDocument_inlayHint",
+- "Or_LSPAny": "interface{}",
+- "Or_NotebookDocumentFilter": "Msg_NotebookDocumentFilter",
+- "Or_NotebookDocumentSyncOptions_notebookSelector_Elem": "PNotebookSelectorPNotebookDocumentSync",
+-
+- "Or_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0_notebook": "OrFNotebookPNotebookSelector",
+-
+- "Or_ParameterInformation_documentation": "string",
+- "Or_ParameterInformation_label": "string",
+- "Or_PrepareRenameResult": "Msg_PrepareRename2Gn",
+- "Or_ProgressToken": "interface{}",
+- "Or_Result_textDocument_completion": "CompletionList",
+- "Or_Result_textDocument_declaration": "Or_textDocument_declaration",
+- "Or_Result_textDocument_definition": "[]Location",
+- "Or_Result_textDocument_documentSymbol": "[]interface{}",
+- "Or_Result_textDocument_implementation": "[]Location",
+- "Or_Result_textDocument_semanticTokens_full_delta": "interface{}",
+- "Or_Result_textDocument_typeDefinition": "[]Location",
+- "Or_Result_workspace_symbol": "[]SymbolInformation",
+- "Or_TextDocumentContentChangeEvent": "Msg_TextDocumentContentChangeEvent",
+- "Or_TextDocumentFilter": "Msg_TextDocumentFilter",
+- "Or_WorkspaceFoldersServerCapabilities_changeNotifications": "string",
+- "Or_WorkspaceSymbol_location": "OrPLocation_workspace_symbol",
+- "PrepareRenameResult": "PrepareRename2Gn",
+- "Tuple_ParameterInformation_label_Item1": "UIntCommaUInt",
+- "WorkspaceFoldersServerCapabilities": "WorkspaceFolders5Gn",
+- "[]LSPAny": "[]interface{}",
+- "[]Or_NotebookDocumentSyncOptions_notebookSelector_Elem": "[]PNotebookSelectorPNotebookDocumentSync",
+- "[]Or_Result_textDocument_codeAction_Item0_Elem": "[]CodeAction",
+- "[]PreviousResultId": "[]PreviousResultID",
+- "[]uinteger": "[]uint32",
+- "boolean": "bool",
+- "decimal": "float64",
+- "integer": "int32",
+- "map[DocumentUri][]TextEdit": "map[DocumentURI][]TextEdit",
+- "uinteger": "uint32",
+-}
+-
+-var usedGoplsType = make(map[string]bool)
+-
+-// methodNames is a map from the method to the name of the function that handles it
+-var methodNames = map[string]string{
+- "$/cancelRequest": "CancelRequest",
+- "$/logTrace": "LogTrace",
+- "$/progress": "Progress",
+- "$/setTrace": "SetTrace",
+- "callHierarchy/incomingCalls": "IncomingCalls",
+- "callHierarchy/outgoingCalls": "OutgoingCalls",
+- "client/registerCapability": "RegisterCapability",
+- "client/unregisterCapability": "UnregisterCapability",
+- "codeAction/resolve": "ResolveCodeAction",
+- "codeLens/resolve": "ResolveCodeLens",
+- "completionItem/resolve": "ResolveCompletionItem",
+- "documentLink/resolve": "ResolveDocumentLink",
+- "exit": "Exit",
+- "initialize": "Initialize",
+- "initialized": "Initialized",
+- "inlayHint/resolve": "Resolve",
+- "notebookDocument/didChange": "DidChangeNotebookDocument",
+- "notebookDocument/didClose": "DidCloseNotebookDocument",
+- "notebookDocument/didOpen": "DidOpenNotebookDocument",
+- "notebookDocument/didSave": "DidSaveNotebookDocument",
+- "shutdown": "Shutdown",
+- "telemetry/event": "Event",
+- "textDocument/codeAction": "CodeAction",
+- "textDocument/codeLens": "CodeLens",
+- "textDocument/colorPresentation": "ColorPresentation",
+- "textDocument/completion": "Completion",
+- "textDocument/declaration": "Declaration",
+- "textDocument/definition": "Definition",
+- "textDocument/diagnostic": "Diagnostic",
+- "textDocument/didChange": "DidChange",
+- "textDocument/didClose": "DidClose",
+- "textDocument/didOpen": "DidOpen",
+- "textDocument/didSave": "DidSave",
+- "textDocument/documentColor": "DocumentColor",
+- "textDocument/documentHighlight": "DocumentHighlight",
+- "textDocument/documentLink": "DocumentLink",
+- "textDocument/documentSymbol": "DocumentSymbol",
+- "textDocument/foldingRange": "FoldingRange",
+- "textDocument/formatting": "Formatting",
+- "textDocument/hover": "Hover",
+- "textDocument/implementation": "Implementation",
+- "textDocument/inlayHint": "InlayHint",
+- "textDocument/inlineValue": "InlineValue",
+- "textDocument/linkedEditingRange": "LinkedEditingRange",
+- "textDocument/moniker": "Moniker",
+- "textDocument/onTypeFormatting": "OnTypeFormatting",
+- "textDocument/prepareCallHierarchy": "PrepareCallHierarchy",
+- "textDocument/prepareRename": "PrepareRename",
+- "textDocument/prepareTypeHierarchy": "PrepareTypeHierarchy",
+- "textDocument/publishDiagnostics": "PublishDiagnostics",
+- "textDocument/rangeFormatting": "RangeFormatting",
+- "textDocument/references": "References",
+- "textDocument/rename": "Rename",
+- "textDocument/selectionRange": "SelectionRange",
+- "textDocument/semanticTokens/full": "SemanticTokensFull",
+- "textDocument/semanticTokens/full/delta": "SemanticTokensFullDelta",
+- "textDocument/semanticTokens/range": "SemanticTokensRange",
+- "textDocument/signatureHelp": "SignatureHelp",
+- "textDocument/typeDefinition": "TypeDefinition",
+- "textDocument/willSave": "WillSave",
+- "textDocument/willSaveWaitUntil": "WillSaveWaitUntil",
+- "typeHierarchy/subtypes": "Subtypes",
+- "typeHierarchy/supertypes": "Supertypes",
+- "window/logMessage": "LogMessage",
+- "window/showDocument": "ShowDocument",
+- "window/showMessage": "ShowMessage",
+- "window/showMessageRequest": "ShowMessageRequest",
+- "window/workDoneProgress/cancel": "WorkDoneProgressCancel",
+- "window/workDoneProgress/create": "WorkDoneProgressCreate",
+- "workspace/applyEdit": "ApplyEdit",
+- "workspace/codeLens/refresh": "CodeLensRefresh",
+- "workspace/configuration": "Configuration",
+- "workspace/diagnostic": "DiagnosticWorkspace",
+- "workspace/diagnostic/refresh": "DiagnosticRefresh",
+- "workspace/didChangeConfiguration": "DidChangeConfiguration",
+- "workspace/didChangeWatchedFiles": "DidChangeWatchedFiles",
+- "workspace/didChangeWorkspaceFolders": "DidChangeWorkspaceFolders",
+- "workspace/didCreateFiles": "DidCreateFiles",
+- "workspace/didDeleteFiles": "DidDeleteFiles",
+- "workspace/didRenameFiles": "DidRenameFiles",
+- "workspace/executeCommand": "ExecuteCommand",
+- "workspace/inlayHint/refresh": "InlayHintRefresh",
+- "workspace/inlineValue/refresh": "InlineValueRefresh",
+- "workspace/semanticTokens/refresh": "SemanticTokensRefresh",
+- "workspace/symbol": "Symbol",
+- "workspace/willCreateFiles": "WillCreateFiles",
+- "workspace/willDeleteFiles": "WillDeleteFiles",
+- "workspace/willRenameFiles": "WillRenameFiles",
+- "workspace/workspaceFolders": "WorkspaceFolders",
+- "workspaceSymbol/resolve": "ResolveWorkspaceSymbol",
+-}
+diff -urN a/gopls/internal/lsp/protocol/generate/typenames.go b/gopls/internal/lsp/protocol/generate/typenames.go
+--- a/gopls/internal/lsp/protocol/generate/typenames.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/generate/typenames.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,184 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.19
+-// +build go1.19
+-
+-package main
+-
+-import (
+- "fmt"
+- "log"
+- "strings"
+-)
+-
+-var typeNames = make(map[*Type]string)
+-var genTypes []*newType
+-
+-func findTypeNames(model Model) {
+- for _, s := range model.Structures {
+- for _, e := range s.Extends {
+- nameType(e, nil) // all references
+- }
+- for _, m := range s.Mixins {
+- nameType(m, nil) // all references
+- }
+- for _, p := range s.Properties {
+- nameType(p.Type, []string{s.Name, p.Name})
+- }
+- }
+- for _, t := range model.Enumerations {
+- nameType(t.Type, []string{t.Name})
+- }
+- for _, t := range model.TypeAliases {
+- nameType(t.Type, []string{t.Name})
+- }
+- for _, r := range model.Requests {
+- nameType(r.Params, []string{"Param", r.Method})
+- nameType(r.Result, []string{"Result", r.Method})
+- nameType(r.RegistrationOptions, []string{"RegOpt", r.Method})
+- }
+- for _, n := range model.Notifications {
+- nameType(n.Params, []string{"Param", n.Method})
+- nameType(n.RegistrationOptions, []string{"RegOpt", n.Method})
+- }
+-}
+-
+-// nameType populates typeNames[t] with the computed name of the type.
+-// path is the list of enclosing constructs in the JSON model.
+-func nameType(t *Type, path []string) string {
+- if t == nil || typeNames[t] != "" {
+- return ""
+- }
+- switch t.Kind {
+- case "base":
+- typeNames[t] = t.Name
+- return t.Name
+- case "reference":
+- typeNames[t] = t.Name
+- return t.Name
+- case "array":
+- nm := "[]" + nameType(t.Element, append(path, "Elem"))
+- typeNames[t] = nm
+- return nm
+- case "map":
+- key := nameType(t.Key, nil) // never a generated type
+- value := nameType(t.Value.(*Type), append(path, "Value"))
+- nm := "map[" + key + "]" + value
+- typeNames[t] = nm
+- return nm
+- // generated types
+- case "and":
+- nm := nameFromPath("And", path)
+- typeNames[t] = nm
+- for _, it := range t.Items {
+- nameType(it, append(path, "Item"))
+- }
+- genTypes = append(genTypes, &newType{
+- name: nm,
+- typ: t,
+- kind: "and",
+- items: t.Items,
+- line: t.Line,
+- })
+- return nm
+- case "literal":
+- nm := nameFromPath("Lit", path)
+- typeNames[t] = nm
+- for _, p := range t.Value.(ParseLiteral).Properties {
+- nameType(p.Type, append(path, p.Name))
+- }
+- genTypes = append(genTypes, &newType{
+- name: nm,
+- typ: t,
+- kind: "literal",
+- properties: t.Value.(ParseLiteral).Properties,
+- line: t.Line,
+- })
+- return nm
+- case "tuple":
+- nm := nameFromPath("Tuple", path)
+- typeNames[t] = nm
+- for _, it := range t.Items {
+- nameType(it, append(path, "Item"))
+- }
+- genTypes = append(genTypes, &newType{
+- name: nm,
+- typ: t,
+- kind: "tuple",
+- items: t.Items,
+- line: t.Line,
+- })
+- return nm
+- case "or":
+- nm := nameFromPath("Or", path)
+- typeNames[t] = nm
+- for i, it := range t.Items {
+- // these names depend on the ordering within the "or" type
+- nameType(it, append(path, fmt.Sprintf("Item%d", i)))
+- }
+- // this code handles an "or" of stringLiterals (_InitializeParams.trace)
+- names := make(map[string]int)
+- msg := ""
+- for _, it := range t.Items {
+- if line, ok := names[typeNames[it]]; ok {
+- // duplicate component names are bad
+- msg += fmt.Sprintf("lines %d %d dup, %s for %s\n", line, it.Line, typeNames[it], nm)
+- }
+- names[typeNames[it]] = t.Line
+- }
+- // this code handles an "or" of stringLiterals (_InitializeParams.trace)
+- if len(names) == 1 {
+- var solekey string
+- for k := range names {
+- solekey = k // the sole name
+- }
+- if solekey == "string" { // _InitializeParams.trace
+- typeNames[t] = "string"
+- return "string"
+- }
+- // otherwise unexpected
+- log.Printf("unexpected: single-case 'or' type has non-string key %s: %s", nm, solekey)
+- log.Fatal(msg)
+- } else if len(names) == 2 {
+- // if one of the names is null, just use the other, rather than generating an "or".
+- // This removes about 40 types from the generated code. An entry in goplsStar
+- // could be added to handle the null case, if necessary.
+- newNm := ""
+- sawNull := false
+- for k := range names {
+- if k == "null" {
+- sawNull = true
+- } else {
+- newNm = k
+- }
+- }
+- if sawNull {
+- typeNames[t] = newNm
+- return newNm
+- }
+- }
+- genTypes = append(genTypes, &newType{
+- name: nm,
+- typ: t,
+- kind: "or",
+- items: t.Items,
+- line: t.Line,
+- })
+- return nm
+- case "stringLiteral": // a single type, like 'kind' or 'rename'
+- typeNames[t] = "string"
+- return "string"
+- default:
+- log.Fatalf("nameType: %T unexpected, line:%d path:%v", t, t.Line, path)
+- panic("unreachable in nameType")
+- }
+-}
+-
+-func nameFromPath(prefix string, path []string) string {
+- nm := prefix + "_" + strings.Join(path, "_")
+- // methods have slashes
+- nm = strings.ReplaceAll(nm, "/", "_")
+- return nm
+-}
+diff -urN a/gopls/internal/lsp/protocol/generate/types.go b/gopls/internal/lsp/protocol/generate/types.go
+--- a/gopls/internal/lsp/protocol/generate/types.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/generate/types.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,170 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.19
+-// +build go1.19
+-
+-package main
+-
+-import (
+- "fmt"
+- "sort"
+-)
+-
+-// Model contains the parsed version of the spec
+-type Model struct {
+- Version Metadata `json:"metaData"`
+- Requests []*Request `json:"requests"`
+- Notifications []*Notification `json:"notifications"`
+- Structures []*Structure `json:"structures"`
+- Enumerations []*Enumeration `json:"enumerations"`
+- TypeAliases []*TypeAlias `json:"typeAliases"`
+- Line int `json:"line"`
+-}
+-
+-// Metadata is information about the version of the spec
+-type Metadata struct {
+- Version string `json:"version"`
+- Line int `json:"line"`
+-}
+-
+-// A Request is the parsed version of an LSP request
+-type Request struct {
+- Documentation string `json:"documentation"`
+- ErrorData *Type `json:"errorData"`
+- Direction string `json:"messageDirection"`
+- Method string `json:"method"`
+- Params *Type `json:"params"`
+- PartialResult *Type `json:"partialResult"`
+- Proposed bool `json:"proposed"`
+- RegistrationMethod string `json:"registrationMethod"`
+- RegistrationOptions *Type `json:"registrationOptions"`
+- Result *Type `json:"result"`
+- Since string `json:"since"`
+- Line int `json:"line"`
+-}
+-
+-// A Notificatin is the parsed version of an LSP notification
+-type Notification struct {
+- Documentation string `json:"documentation"`
+- Direction string `json:"messageDirection"`
+- Method string `json:"method"`
+- Params *Type `json:"params"`
+- Proposed bool `json:"proposed"`
+- RegistrationMethod string `json:"registrationMethod"`
+- RegistrationOptions *Type `json:"registrationOptions"`
+- Since string `json:"since"`
+- Line int `json:"line"`
+-}
+-
+-// A Structure is the parsed version of an LSP structure from the spec
+-type Structure struct {
+- Documentation string `json:"documentation"`
+- Extends []*Type `json:"extends"`
+- Mixins []*Type `json:"mixins"`
+- Name string `json:"name"`
+- Properties []NameType `json:"properties"`
+- Proposed bool `json:"proposed"`
+- Since string `json:"since"`
+- Line int `json:"line"`
+-}
+-
+-// An enumeration is the parsed version of an LSP enumeration from the spec
+-type Enumeration struct {
+- Documentation string `json:"documentation"`
+- Name string `json:"name"`
+- Proposed bool `json:"proposed"`
+- Since string `json:"since"`
+- SupportsCustomValues bool `json:"supportsCustomValues"`
+- Type *Type `json:"type"`
+- Values []NameValue `json:"values"`
+- Line int `json:"line"`
+-}
+-
+-// A TypeAlias is the parsed version of an LSP type alias from the spec
+-type TypeAlias struct {
+- Documentation string `json:"documentation"`
+- Deprecated string `json:"deprecated"`
+- Name string `json:"name"`
+- Proposed bool `json:"proposed"`
+- Since string `json:"since"`
+- Type *Type `json:"type"`
+- Line int `json:"line"`
+-}
+-
+-// A NameValue describes an enumeration constant
+-type NameValue struct {
+- Documentation string `json:"documentation"`
+- Name string `json:"name"`
+- Proposed bool `json:"proposed"`
+- Since string `json:"since"`
+- Value any `json:"value"` // number or string
+- Line int `json:"line"`
+-}
+-
+-// A Type is the parsed version of an LSP type from the spec,
+-// or a Type the code constructs
+-type Type struct {
+- Kind string `json:"kind"` // -- which kind goes with which field --
+- Items []*Type `json:"items"` // "and", "or", "tuple"
+- Element *Type `json:"element"` // "array"
+- Name string `json:"name"` // "base", "reference"
+- Key *Type `json:"key"` // "map"
+- Value any `json:"value"` // "map", "stringLiteral", "literal"
+- Line int `json:"line"` // JSON source line
+-}
+-
+-// ParsedLiteral is Type.Value when Type.Kind is "literal"
+-type ParseLiteral struct {
+- Properties `json:"properties"`
+-}
+-
+-// A NameType represents the name and type of a structure element
+-type NameType struct {
+- Name string `json:"name"`
+- Type *Type `json:"type"`
+- Optional bool `json:"optional"`
+- Documentation string `json:"documentation"`
+- Deprecated string `json:"deprecated"`
+- Since string `json:"since"`
+- Proposed bool `json:"proposed"`
+- Line int `json:"line"`
+-}
+-
+-// Properties are the collection of structure fields
+-type Properties []NameType
+-
+-// addLineNumbers adds a "line" field to each object in the JSON.
+-func addLineNumbers(buf []byte) []byte {
+- var ans []byte
+- // In the specification .json file, the delimiter '{' is
+- // always followed by a newline. There are other {s embedded in strings.
+- // json.Token does not return \n, or :, or , so using it would
+- // require parsing the json to reconstruct the missing information.
+- for linecnt, i := 1, 0; i < len(buf); i++ {
+- ans = append(ans, buf[i])
+- switch buf[i] {
+- case '{':
+- if buf[i+1] == '\n' {
+- ans = append(ans, fmt.Sprintf(`"line": %d, `, linecnt)...)
+- // warning: this would fail if the spec file had
+- // `"value": {\n}`, but it does not, as comma is a separator.
+- }
+- case '\n':
+- linecnt++
+- }
+- }
+- return ans
+-}
+-
+-type sortedMap[T any] map[string]T
+-
+-func (s sortedMap[T]) keys() []string {
+- var keys []string
+- for k := range s {
+- keys = append(keys, k)
+- }
+- sort.Strings(keys)
+- return keys
+-}
+diff -urN a/gopls/internal/lsp/protocol/log.go b/gopls/internal/lsp/protocol/log.go
+--- a/gopls/internal/lsp/protocol/log.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/log.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,136 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package protocol
+-
+-import (
+- "context"
+- "fmt"
+- "io"
+- "strings"
+- "sync"
+- "time"
+-
+- "golang.org/x/tools/internal/jsonrpc2"
+-)
+-
+-type loggingStream struct {
+- stream jsonrpc2.Stream
+- logMu sync.Mutex
+- log io.Writer
+-}
+-
+-// LoggingStream returns a stream that does LSP protocol logging too
+-func LoggingStream(str jsonrpc2.Stream, w io.Writer) jsonrpc2.Stream {
+- return &loggingStream{stream: str, log: w}
+-}
+-
+-func (s *loggingStream) Read(ctx context.Context) (jsonrpc2.Message, int64, error) {
+- msg, count, err := s.stream.Read(ctx)
+- if err == nil {
+- s.logCommon(msg, true)
+- }
+- return msg, count, err
+-}
+-
+-func (s *loggingStream) Write(ctx context.Context, msg jsonrpc2.Message) (int64, error) {
+- s.logCommon(msg, false)
+- count, err := s.stream.Write(ctx, msg)
+- return count, err
+-}
+-
+-func (s *loggingStream) Close() error {
+- return s.stream.Close()
+-}
+-
+-type req struct {
+- method string
+- start time.Time
+-}
+-
+-type mapped struct {
+- mu sync.Mutex
+- clientCalls map[string]req
+- serverCalls map[string]req
+-}
+-
+-var maps = &mapped{
+- sync.Mutex{},
+- make(map[string]req),
+- make(map[string]req),
+-}
+-
+-// these 4 methods are each used exactly once, but it seemed
+-// better to have the encapsulation rather than ad hoc mutex
+-// code in 4 places
+-func (m *mapped) client(id string) req {
+- m.mu.Lock()
+- defer m.mu.Unlock()
+- v := m.clientCalls[id]
+- delete(m.clientCalls, id)
+- return v
+-}
+-
+-func (m *mapped) server(id string) req {
+- m.mu.Lock()
+- defer m.mu.Unlock()
+- v := m.serverCalls[id]
+- delete(m.serverCalls, id)
+- return v
+-}
+-
+-func (m *mapped) setClient(id string, r req) {
+- m.mu.Lock()
+- defer m.mu.Unlock()
+- m.clientCalls[id] = r
+-}
+-
+-func (m *mapped) setServer(id string, r req) {
+- m.mu.Lock()
+- defer m.mu.Unlock()
+- m.serverCalls[id] = r
+-}
+-
+-const eor = "\r\n\r\n\r\n"
+-
+-func (s *loggingStream) logCommon(msg jsonrpc2.Message, isRead bool) {
+- s.logMu.Lock()
+- defer s.logMu.Unlock()
+- direction, pastTense := "Received", "Received"
+- get, set := maps.client, maps.setServer
+- if isRead {
+- direction, pastTense = "Sending", "Sent"
+- get, set = maps.server, maps.setClient
+- }
+- if msg == nil || s.log == nil {
+- return
+- }
+- tm := time.Now()
+- tmfmt := tm.Format("15:04:05.000 PM")
+-
+- buf := strings.Builder{}
+- fmt.Fprintf(&buf, "[Trace - %s] ", tmfmt) // common beginning
+- switch msg := msg.(type) {
+- case *jsonrpc2.Call:
+- id := fmt.Sprint(msg.ID())
+- fmt.Fprintf(&buf, "%s request '%s - (%s)'.\n", direction, msg.Method(), id)
+- fmt.Fprintf(&buf, "Params: %s%s", msg.Params(), eor)
+- set(id, req{method: msg.Method(), start: tm})
+- case *jsonrpc2.Notification:
+- fmt.Fprintf(&buf, "%s notification '%s'.\n", direction, msg.Method())
+- fmt.Fprintf(&buf, "Params: %s%s", msg.Params(), eor)
+- case *jsonrpc2.Response:
+- id := fmt.Sprint(msg.ID())
+- if err := msg.Err(); err != nil {
+- fmt.Fprintf(s.log, "[Error - %s] %s #%s %s%s", pastTense, tmfmt, id, err, eor)
+- return
+- }
+- cc := get(id)
+- elapsed := tm.Sub(cc.start)
+- fmt.Fprintf(&buf, "%s response '%s - (%s)' in %dms.\n",
+- direction, cc.method, id, elapsed/time.Millisecond)
+- fmt.Fprintf(&buf, "Result: %s%s", msg.Result(), eor)
+- }
+- s.log.Write([]byte(buf.String()))
+-}
+diff -urN a/gopls/internal/lsp/protocol/mapper.go b/gopls/internal/lsp/protocol/mapper.go
+--- a/gopls/internal/lsp/protocol/mapper.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/mapper.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,529 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package protocol
+-
+-// This file defines Mapper, which wraps a file content buffer
+-// ([]byte) and provides efficient conversion between every kind of
+-// position representation.
+-//
+-// gopls uses four main representations of position:
+-//
+-// 1. byte offsets, e.g. (start, end int), starting from zero.
+-//
+-// 2. go/token notation. Use these types when interacting directly
+-// with the go/* syntax packages:
+-//
+-// token.Pos
+-// token.FileSet
+-// token.File
+-//
+-// Because File.Offset and File.Pos panic on invalid inputs,
+-// we do not call them directly and instead use the safetoken package
+-// for these conversions. This is enforced by a static check.
+-//
+-// Beware also that the methods of token.File have two bugs for which
+-// safetoken contains workarounds:
+-// - #57490, whereby the parser may create ast.Nodes during error
+-// recovery whose computed positions are out of bounds (EOF+1).
+-// - #41029, whereby the wrong line number is returned for the EOF position.
+-//
+-// 3. the span package.
+-//
+-// span.Point = (line, col8, offset).
+-// span.Span = (uri URI, start, end span.Point)
+-//
+-// Line and column are 1-based.
+-// Columns are measured in bytes (UTF-8 codes).
+-// All fields are optional.
+-//
+-// These types are useful as intermediate conversions of validated
+-// ranges (though MappedRange is superior as it is self contained
+-// and universally convertible). Since their fields are optional
+-// they are also useful for parsing user-provided positions (e.g. in
+-// the CLI) before we have access to file contents.
+-//
+-// 4. protocol, the LSP RPC message format.
+-//
+-// protocol.Position = (Line, Character uint32)
+-// protocol.Range = (start, end Position)
+-// protocol.Location = (URI, protocol.Range)
+-//
+-// Line and Character are 0-based.
+-// Characters (columns) are measured in UTF-16 codes.
+-//
+-// protocol.Mapper holds the (URI, Content) of a file, enabling
+-// efficient mapping between byte offsets, span ranges, and
+-// protocol ranges.
+-//
+-// protocol.MappedRange holds a protocol.Mapper and valid (start,
+-// end int) byte offsets, enabling infallible, efficient conversion
+-// to any other format.
+-
+-import (
+- "bytes"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "path/filepath"
+- "sort"
+- "strings"
+- "sync"
+- "unicode/utf8"
+-
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/bug"
+-)
+-
+-// A Mapper wraps the content of a file and provides mapping
+-// between byte offsets and notations of position such as:
+-//
+-// - (line, col8) pairs, where col8 is a 1-based UTF-8 column number
+-// (bytes), as used by the go/token and span packages.
+-//
+-// - (line, col16) pairs, where col16 is a 1-based UTF-16 column
+-// number, as used by the LSP protocol.
+-//
+-// All conversion methods are named "FromTo", where From and To are the two types.
+-// For example, the PointPosition method converts from a Point to a Position.
+-//
+-// Mapper does not intrinsically depend on go/token-based
+-// representations. Use safetoken to map between token.Pos <=> byte
+-// offsets, or the convenience methods such as PosPosition,
+-// NodePosition, or NodeRange.
+-//
+-// See overview comments at top of this file.
+-type Mapper struct {
+- URI span.URI
+- Content []byte
+-
+- // Line-number information is requested only for a tiny
+- // fraction of Mappers, so we compute it lazily.
+- // Call initLines() before accessing fields below.
+- linesOnce sync.Once
+- lineStart []int // byte offset of start of ith line (0-based); last=EOF iff \n-terminated
+- nonASCII bool
+-
+- // TODO(adonovan): adding an extra lineStart entry for EOF
+- // might simplify every method that accesses it. Try it out.
+-}
+-
+-// NewMapper creates a new mapper for the given URI and content.
+-func NewMapper(uri span.URI, content []byte) *Mapper {
+- return &Mapper{URI: uri, Content: content}
+-}
+-
+-// initLines populates the lineStart table.
+-func (m *Mapper) initLines() {
+- m.linesOnce.Do(func() {
+- nlines := bytes.Count(m.Content, []byte("\n"))
+- m.lineStart = make([]int, 1, nlines+1) // initially []int{0}
+- for offset, b := range m.Content {
+- if b == '\n' {
+- m.lineStart = append(m.lineStart, offset+1)
+- }
+- if b >= utf8.RuneSelf {
+- m.nonASCII = true
+- }
+- }
+- })
+-}
+-
+-// -- conversions from span (UTF-8) domain --
+-
+-// SpanLocation converts a (UTF-8) span to a protocol (UTF-16) range.
+-// Precondition: the URIs of SpanLocation and Mapper match.
+-func (m *Mapper) SpanLocation(s span.Span) (Location, error) {
+- rng, err := m.SpanRange(s)
+- if err != nil {
+- return Location{}, err
+- }
+- return m.RangeLocation(rng), nil
+-}
+-
+-// SpanRange converts a (UTF-8) span to a protocol (UTF-16) range.
+-// Precondition: the URIs of Span and Mapper match.
+-func (m *Mapper) SpanRange(s span.Span) (Range, error) {
+- // Assert that we aren't using the wrong mapper.
+- // We check only the base name, and case insensitively,
+- // because we can't assume clean paths, no symbolic links,
+- // case-sensitive directories. The authoritative answer
+- // requires querying the file system, and we don't want
+- // to do that.
+- if !strings.EqualFold(filepath.Base(string(m.URI)), filepath.Base(string(s.URI()))) {
+- return Range{}, bug.Errorf("mapper is for file %q instead of %q", m.URI, s.URI())
+- }
+- start, err := m.PointPosition(s.Start())
+- if err != nil {
+- return Range{}, fmt.Errorf("start: %w", err)
+- }
+- end, err := m.PointPosition(s.End())
+- if err != nil {
+- return Range{}, fmt.Errorf("end: %w", err)
+- }
+- return Range{Start: start, End: end}, nil
+-}
+-
+-// PointPosition converts a valid span (UTF-8) point to a protocol (UTF-16) position.
+-func (m *Mapper) PointPosition(p span.Point) (Position, error) {
+- if p.HasPosition() {
+- line, col8 := p.Line()-1, p.Column()-1 // both 0-based
+- m.initLines()
+- if line >= len(m.lineStart) {
+- return Position{}, fmt.Errorf("line number %d out of range (max %d)", line, len(m.lineStart))
+- }
+- offset := m.lineStart[line]
+- end := offset + col8
+-
+- // Validate column.
+- if end > len(m.Content) {
+- return Position{}, fmt.Errorf("column is beyond end of file")
+- } else if line+1 < len(m.lineStart) && end >= m.lineStart[line+1] {
+- return Position{}, fmt.Errorf("column is beyond end of line")
+- }
+-
+- char := UTF16Len(m.Content[offset:end])
+- return Position{Line: uint32(line), Character: uint32(char)}, nil
+- }
+- if p.HasOffset() {
+- return m.OffsetPosition(p.Offset())
+- }
+- return Position{}, fmt.Errorf("point has neither offset nor line/column")
+-}
+-
+-// -- conversions from byte offsets --
+-
+-// OffsetLocation converts a byte-offset interval to a protocol (UTF-16) location.
+-func (m *Mapper) OffsetLocation(start, end int) (Location, error) {
+- rng, err := m.OffsetRange(start, end)
+- if err != nil {
+- return Location{}, err
+- }
+- return m.RangeLocation(rng), nil
+-}
+-
+-// OffsetRange converts a byte-offset interval to a protocol (UTF-16) range.
+-func (m *Mapper) OffsetRange(start, end int) (Range, error) {
+- if start > end {
+- return Range{}, fmt.Errorf("start offset (%d) > end (%d)", start, end)
+- }
+- startPosition, err := m.OffsetPosition(start)
+- if err != nil {
+- return Range{}, fmt.Errorf("start: %v", err)
+- }
+- endPosition, err := m.OffsetPosition(end)
+- if err != nil {
+- return Range{}, fmt.Errorf("end: %v", err)
+- }
+- return Range{Start: startPosition, End: endPosition}, nil
+-}
+-
+-// OffsetSpan converts a byte-offset interval to a (UTF-8) span.
+-// The resulting span contains line, column, and offset information.
+-func (m *Mapper) OffsetSpan(start, end int) (span.Span, error) {
+- if start > end {
+- return span.Span{}, fmt.Errorf("start offset (%d) > end (%d)", start, end)
+- }
+- startPoint, err := m.OffsetPoint(start)
+- if err != nil {
+- return span.Span{}, fmt.Errorf("start: %v", err)
+- }
+- endPoint, err := m.OffsetPoint(end)
+- if err != nil {
+- return span.Span{}, fmt.Errorf("end: %v", err)
+- }
+- return span.New(m.URI, startPoint, endPoint), nil
+-}
+-
+-// OffsetPosition converts a byte offset to a protocol (UTF-16) position.
+-func (m *Mapper) OffsetPosition(offset int) (Position, error) {
+- if !(0 <= offset && offset <= len(m.Content)) {
+- return Position{}, fmt.Errorf("invalid offset %d (want 0-%d)", offset, len(m.Content))
+- }
+- // No error may be returned after this point,
+- // even if the offset does not fall at a rune boundary.
+- // (See panic in MappedRange.Range reachable.)
+-
+- line, col16 := m.lineCol16(offset)
+- return Position{Line: uint32(line), Character: uint32(col16)}, nil
+-}
+-
+-// lineCol16 converts a valid byte offset to line and UTF-16 column numbers, both 0-based.
+-func (m *Mapper) lineCol16(offset int) (int, int) {
+- line, start, cr := m.line(offset)
+- var col16 int
+- if m.nonASCII {
+- col16 = UTF16Len(m.Content[start:offset])
+- } else {
+- col16 = offset - start
+- }
+- if cr {
+- col16-- // retreat from \r at line end
+- }
+- return line, col16
+-}
+-
+-// lineCol8 converts a valid byte offset to line and UTF-8 column numbers, both 0-based.
+-func (m *Mapper) lineCol8(offset int) (int, int) {
+- line, start, cr := m.line(offset)
+- col8 := offset - start
+- if cr {
+- col8-- // retreat from \r at line end
+- }
+- return line, col8
+-}
+-
+-// line returns:
+-// - the 0-based index of the line that encloses the (valid) byte offset;
+-// - the start offset of that line; and
+-// - whether the offset denotes a carriage return (\r) at line end.
+-func (m *Mapper) line(offset int) (int, int, bool) {
+- m.initLines()
+- // In effect, binary search returns a 1-based result.
+- line := sort.Search(len(m.lineStart), func(i int) bool {
+- return offset < m.lineStart[i]
+- })
+-
+- // Adjustment for line-endings: \r|\n is the same as |\r\n.
+- var eol int
+- if line == len(m.lineStart) {
+- eol = len(m.Content) // EOF
+- } else {
+- eol = m.lineStart[line] - 1
+- }
+- cr := offset == eol && offset > 0 && m.Content[offset-1] == '\r'
+-
+- line-- // 0-based
+-
+- return line, m.lineStart[line], cr
+-}
+-
+-// OffsetPoint converts a byte offset to a span (UTF-8) point.
+-// The resulting point contains line, column, and offset information.
+-func (m *Mapper) OffsetPoint(offset int) (span.Point, error) {
+- if !(0 <= offset && offset <= len(m.Content)) {
+- return span.Point{}, fmt.Errorf("invalid offset %d (want 0-%d)", offset, len(m.Content))
+- }
+- line, col8 := m.lineCol8(offset)
+- return span.NewPoint(line+1, col8+1, offset), nil
+-}
+-
+-// OffsetMappedRange returns a MappedRange for the given byte offsets.
+-// A MappedRange can be converted to any other form.
+-func (m *Mapper) OffsetMappedRange(start, end int) (MappedRange, error) {
+- if !(0 <= start && start <= end && end <= len(m.Content)) {
+- return MappedRange{}, fmt.Errorf("invalid offsets (%d, %d) (file %s has size %d)", start, end, m.URI, len(m.Content))
+- }
+- return MappedRange{m, start, end}, nil
+-}
+-
+-// -- conversions from protocol (UTF-16) domain --
+-
+-// LocationSpan converts a protocol (UTF-16) Location to a (UTF-8) span.
+-// Precondition: the URIs of Location and Mapper match.
+-func (m *Mapper) LocationSpan(l Location) (span.Span, error) {
+- // TODO(adonovan): check that l.URI matches m.URI.
+- return m.RangeSpan(l.Range)
+-}
+-
+-// RangeSpan converts a protocol (UTF-16) range to a (UTF-8) span.
+-// The resulting span has valid Positions and Offsets.
+-func (m *Mapper) RangeSpan(r Range) (span.Span, error) {
+- start, end, err := m.RangeOffsets(r)
+- if err != nil {
+- return span.Span{}, err
+- }
+- return m.OffsetSpan(start, end)
+-}
+-
+-// RangeOffsets converts a protocol (UTF-16) range to start/end byte offsets.
+-func (m *Mapper) RangeOffsets(r Range) (int, int, error) {
+- start, err := m.PositionOffset(r.Start)
+- if err != nil {
+- return 0, 0, err
+- }
+- end, err := m.PositionOffset(r.End)
+- if err != nil {
+- return 0, 0, err
+- }
+- return start, end, nil
+-}
+-
+-// PositionOffset converts a protocol (UTF-16) position to a byte offset.
+-func (m *Mapper) PositionOffset(p Position) (int, error) {
+- m.initLines()
+-
+- // Validate line number.
+- if p.Line > uint32(len(m.lineStart)) {
+- return 0, fmt.Errorf("line number %d out of range 0-%d", p.Line, len(m.lineStart))
+- } else if p.Line == uint32(len(m.lineStart)) {
+- if p.Character == 0 {
+- return len(m.Content), nil // EOF
+- }
+- return 0, fmt.Errorf("column is beyond end of file")
+- }
+-
+- offset := m.lineStart[p.Line]
+- content := m.Content[offset:] // rest of file from start of enclosing line
+-
+- // Advance bytes up to the required number of UTF-16 codes.
+- col8 := 0
+- for col16 := 0; col16 < int(p.Character); col16++ {
+- r, sz := utf8.DecodeRune(content)
+- if sz == 0 {
+- return 0, fmt.Errorf("column is beyond end of file")
+- }
+- if r == '\n' {
+- return 0, fmt.Errorf("column is beyond end of line")
+- }
+- if sz == 1 && r == utf8.RuneError {
+- return 0, fmt.Errorf("buffer contains invalid UTF-8 text")
+- }
+- content = content[sz:]
+-
+- if r >= 0x10000 {
+- col16++ // rune was encoded by a pair of surrogate UTF-16 codes
+-
+- if col16 == int(p.Character) {
+- break // requested position is in the middle of a rune
+- }
+- }
+- col8 += sz
+- }
+- return offset + col8, nil
+-}
+-
+-// PositionPoint converts a protocol (UTF-16) position to a span (UTF-8) point.
+-// The resulting point has a valid Position and Offset.
+-func (m *Mapper) PositionPoint(p Position) (span.Point, error) {
+- offset, err := m.PositionOffset(p)
+- if err != nil {
+- return span.Point{}, err
+- }
+- line, col8 := m.lineCol8(offset)
+-
+- return span.NewPoint(line+1, col8+1, offset), nil
+-}
+-
+-// -- go/token domain convenience methods --
+-
+-// PosPosition converts a token pos to a protocol (UTF-16) position.
+-func (m *Mapper) PosPosition(tf *token.File, pos token.Pos) (Position, error) {
+- offset, err := safetoken.Offset(tf, pos)
+- if err != nil {
+- return Position{}, err
+- }
+- return m.OffsetPosition(offset)
+-}
+-
+-// PosLocation converts a token range to a protocol (UTF-16) location.
+-func (m *Mapper) PosLocation(tf *token.File, start, end token.Pos) (Location, error) {
+- startOffset, endOffset, err := safetoken.Offsets(tf, start, end)
+- if err != nil {
+- return Location{}, err
+- }
+- rng, err := m.OffsetRange(startOffset, endOffset)
+- if err != nil {
+- return Location{}, err
+- }
+- return m.RangeLocation(rng), nil
+-}
+-
+-// PosRange converts a token range to a protocol (UTF-16) range.
+-func (m *Mapper) PosRange(tf *token.File, start, end token.Pos) (Range, error) {
+- startOffset, endOffset, err := safetoken.Offsets(tf, start, end)
+- if err != nil {
+- return Range{}, err
+- }
+- return m.OffsetRange(startOffset, endOffset)
+-}
+-
+-// NodeRange converts a syntax node range to a protocol (UTF-16) range.
+-func (m *Mapper) NodeRange(tf *token.File, node ast.Node) (Range, error) {
+- return m.PosRange(tf, node.Pos(), node.End())
+-}
+-
+-// RangeLocation pairs a protocol Range with its URI, in a Location.
+-func (m *Mapper) RangeLocation(rng Range) Location {
+- return Location{URI: URIFromSpanURI(m.URI), Range: rng}
+-}
+-
+-// PosMappedRange returns a MappedRange for the given token.Pos range.
+-func (m *Mapper) PosMappedRange(tf *token.File, start, end token.Pos) (MappedRange, error) {
+- startOffset, endOffset, err := safetoken.Offsets(tf, start, end)
+- if err != nil {
+- return MappedRange{}, nil
+- }
+- return m.OffsetMappedRange(startOffset, endOffset)
+-}
+-
+-// NodeMappedRange returns a MappedRange for the given node range.
+-func (m *Mapper) NodeMappedRange(tf *token.File, node ast.Node) (MappedRange, error) {
+- return m.PosMappedRange(tf, node.Pos(), node.End())
+-}
+-
+-// -- MappedRange --
+-
+-// A MappedRange represents a valid byte-offset range of a file.
+-// Through its Mapper it can be converted into other forms such
+-// as protocol.Range or span.Span.
+-//
+-// Construct one by calling Mapper.OffsetMappedRange with start/end offsets.
+-// From the go/token domain, call safetoken.Offsets first,
+-// or use a helper such as ParsedGoFile.MappedPosRange.
+-//
+-// Two MappedRanges produced the same Mapper are equal if and only if they
+-// denote the same range. Two MappedRanges produced by different Mappers
+-// are unequal even when they represent the same range of the same file.
+-type MappedRange struct {
+- Mapper *Mapper
+- start, end int // valid byte offsets: 0 <= start <= end <= len(Mapper.Content)
+-}
+-
+-// Offsets returns the (start, end) byte offsets of this range.
+-func (mr MappedRange) Offsets() (start, end int) { return mr.start, mr.end }
+-
+-// -- convenience functions --
+-
+-// URI returns the URI of the range's file.
+-func (mr MappedRange) URI() span.URI {
+- return mr.Mapper.URI
+-}
+-
+-// Range returns the range in protocol (UTF-16) form.
+-func (mr MappedRange) Range() Range {
+- rng, err := mr.Mapper.OffsetRange(mr.start, mr.end)
+- if err != nil {
+- panic(err) // can't happen
+- }
+- return rng
+-}
+-
+-// Location returns the range in protocol location (UTF-16) form.
+-func (mr MappedRange) Location() Location {
+- return mr.Mapper.RangeLocation(mr.Range())
+-}
+-
+-// Span returns the range in span (UTF-8) form.
+-func (mr MappedRange) Span() span.Span {
+- spn, err := mr.Mapper.OffsetSpan(mr.start, mr.end)
+- if err != nil {
+- panic(err) // can't happen
+- }
+- return spn
+-}
+-
+-// String formats the range in span (UTF-8) notation.
+-func (mr MappedRange) String() string {
+- return fmt.Sprint(mr.Span())
+-}
+-
+-// LocationTextDocumentPositionParams converts its argument to its result.
+-func LocationTextDocumentPositionParams(loc Location) TextDocumentPositionParams {
+- return TextDocumentPositionParams{
+- TextDocument: TextDocumentIdentifier{URI: loc.URI},
+- Position: loc.Range.Start,
+- }
+-}
+diff -urN a/gopls/internal/lsp/protocol/mapper_test.go b/gopls/internal/lsp/protocol/mapper_test.go
+--- a/gopls/internal/lsp/protocol/mapper_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/mapper_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,441 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package protocol_test
+-
+-import (
+- "fmt"
+- "strings"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-// This file tests Mapper's logic for converting between
+-// span.Point and UTF-16 columns. (The strange form attests to an
+-// earlier abstraction.)
+-
+-// 𐐀 is U+10400 = [F0 90 90 80] in UTF-8, [D801 DC00] in UTF-16.
+-var funnyString = []byte("𐐀23\n𐐀45")
+-
+-var toUTF16Tests = []struct {
+- scenario string
+- input []byte
+- line int // 1-indexed count
+- col int // 1-indexed byte position in line
+- offset int // 0-indexed byte offset into input
+- resUTF16col int // 1-indexed UTF-16 col number
+- pre string // everything before the cursor on the line
+- post string // everything from the cursor onwards
+- err string // expected error string in call to ToUTF16Column
+- issue *bool
+-}{
+- {
+- scenario: "cursor missing content",
+- input: nil,
+- offset: -1,
+- err: "point has neither offset nor line/column",
+- },
+- {
+- scenario: "cursor missing position",
+- input: funnyString,
+- line: -1,
+- col: -1,
+- offset: -1,
+- err: "point has neither offset nor line/column",
+- },
+- {
+- scenario: "zero length input; cursor at first col, first line",
+- input: []byte(""),
+- line: 1,
+- col: 1,
+- offset: 0,
+- resUTF16col: 1,
+- },
+- {
+- scenario: "cursor before funny character; first line",
+- input: funnyString,
+- line: 1,
+- col: 1,
+- offset: 0,
+- resUTF16col: 1,
+- pre: "",
+- post: "𐐀23",
+- },
+- {
+- scenario: "cursor after funny character; first line",
+- input: funnyString,
+- line: 1,
+- col: 5, // 4 + 1 (1-indexed)
+- offset: 4, // (unused since we have line+col)
+- resUTF16col: 3, // 2 + 1 (1-indexed)
+- pre: "𐐀",
+- post: "23",
+- },
+- {
+- scenario: "cursor after last character on first line",
+- input: funnyString,
+- line: 1,
+- col: 7, // 4 + 1 + 1 + 1 (1-indexed)
+- offset: 6, // 4 + 1 + 1 (unused since we have line+col)
+- resUTF16col: 5, // 2 + 1 + 1 + 1 (1-indexed)
+- pre: "𐐀23",
+- post: "",
+- },
+- {
+- scenario: "cursor before funny character; second line",
+- input: funnyString,
+- line: 2,
+- col: 1,
+- offset: 7, // length of first line (unused since we have line+col)
+- resUTF16col: 1,
+- pre: "",
+- post: "𐐀45",
+- },
+- {
+- scenario: "cursor after funny character; second line",
+- input: funnyString,
+- line: 1,
+- col: 5, // 4 + 1 (1-indexed)
+- offset: 11, // 7 (length of first line) + 4 (unused since we have line+col)
+- resUTF16col: 3, // 2 + 1 (1-indexed)
+- pre: "𐐀",
+- post: "45",
+- },
+- {
+- scenario: "cursor after last character on second line",
+- input: funnyString,
+- line: 2,
+- col: 7, // 4 + 1 + 1 + 1 (1-indexed)
+- offset: 13, // 7 (length of first line) + 4 + 1 + 1 (unused since we have line+col)
+- resUTF16col: 5, // 2 + 1 + 1 + 1 (1-indexed)
+- pre: "𐐀45",
+- post: "",
+- },
+- {
+- scenario: "cursor beyond end of file",
+- input: funnyString,
+- line: 2,
+- col: 8, // 4 + 1 + 1 + 1 + 1 (1-indexed)
+- offset: 14, // 4 + 1 + 1 + 1 (unused since we have line+col)
+- err: "column is beyond end of file",
+- },
+-}
+-
+-var fromUTF16Tests = []struct {
+- scenario string
+- input []byte
+- line int // 1-indexed line number (isn't actually used)
+- utf16col int // 1-indexed UTF-16 col number
+- resCol int // 1-indexed byte position in line
+- resOffset int // 0-indexed byte offset into input
+- pre string // everything before the cursor on the line
+- post string // everything from the cursor onwards
+- err string // expected error string in call to ToUTF16Column
+-}{
+- {
+- scenario: "zero length input; cursor at first col, first line",
+- input: []byte(""),
+- line: 1,
+- utf16col: 1,
+- resCol: 1,
+- resOffset: 0,
+- pre: "",
+- post: "",
+- },
+- {
+- scenario: "cursor before funny character",
+- input: funnyString,
+- line: 1,
+- utf16col: 1,
+- resCol: 1,
+- resOffset: 0,
+- pre: "",
+- post: "𐐀23",
+- },
+- {
+- scenario: "cursor after funny character",
+- input: funnyString,
+- line: 1,
+- utf16col: 3,
+- resCol: 5,
+- resOffset: 4,
+- pre: "𐐀",
+- post: "23",
+- },
+- {
+- scenario: "cursor after last character on line",
+- input: funnyString,
+- line: 1,
+- utf16col: 5,
+- resCol: 7,
+- resOffset: 6,
+- pre: "𐐀23",
+- post: "",
+- },
+- {
+- scenario: "cursor beyond last character on line",
+- input: funnyString,
+- line: 1,
+- utf16col: 6,
+- resCol: 7,
+- resOffset: 6,
+- pre: "𐐀23",
+- post: "",
+- err: "column is beyond end of line",
+- },
+- {
+- scenario: "cursor before funny character; second line",
+- input: funnyString,
+- line: 2,
+- utf16col: 1,
+- resCol: 1,
+- resOffset: 7,
+- pre: "",
+- post: "𐐀45",
+- },
+- {
+- scenario: "cursor after funny character; second line",
+- input: funnyString,
+- line: 2,
+- utf16col: 3, // 2 + 1 (1-indexed)
+- resCol: 5, // 4 + 1 (1-indexed)
+- resOffset: 11, // 7 (length of first line) + 4
+- pre: "𐐀",
+- post: "45",
+- },
+- {
+- scenario: "cursor after last character on second line",
+- input: funnyString,
+- line: 2,
+- utf16col: 5, // 2 + 1 + 1 + 1 (1-indexed)
+- resCol: 7, // 4 + 1 + 1 + 1 (1-indexed)
+- resOffset: 13, // 7 (length of first line) + 4 + 1 + 1
+- pre: "𐐀45",
+- post: "",
+- },
+- {
+- scenario: "cursor beyond end of file",
+- input: funnyString,
+- line: 2,
+- utf16col: 6, // 2 + 1 + 1 + 1 + 1(1-indexed)
+- resCol: 8, // 4 + 1 + 1 + 1 + 1 (1-indexed)
+- resOffset: 14, // 7 (length of first line) + 4 + 1 + 1 + 1
+- err: "column is beyond end of file",
+- },
+-}
+-
+-func TestToUTF16(t *testing.T) {
+- for _, e := range toUTF16Tests {
+- t.Run(e.scenario, func(t *testing.T) {
+- if e.issue != nil && !*e.issue {
+- t.Skip("expected to fail")
+- }
+- p := span.NewPoint(e.line, e.col, e.offset)
+- m := protocol.NewMapper("", e.input)
+- pos, err := m.PointPosition(p)
+- if err != nil {
+- if err.Error() != e.err {
+- t.Fatalf("expected error %v; got %v", e.err, err)
+- }
+- return
+- }
+- if e.err != "" {
+- t.Fatalf("unexpected success; wanted %v", e.err)
+- }
+- got := int(pos.Character) + 1
+- if got != e.resUTF16col {
+- t.Fatalf("expected result %v; got %v", e.resUTF16col, got)
+- }
+- pre, post := getPrePost(e.input, p.Offset())
+- if string(pre) != e.pre {
+- t.Fatalf("expected #%d pre %q; got %q", p.Offset(), e.pre, pre)
+- }
+- if string(post) != e.post {
+- t.Fatalf("expected #%d, post %q; got %q", p.Offset(), e.post, post)
+- }
+- })
+- }
+-}
+-
+-func TestFromUTF16(t *testing.T) {
+- for _, e := range fromUTF16Tests {
+- t.Run(e.scenario, func(t *testing.T) {
+- m := protocol.NewMapper("", []byte(e.input))
+- p, err := m.PositionPoint(protocol.Position{
+- Line: uint32(e.line - 1),
+- Character: uint32(e.utf16col - 1),
+- })
+- if err != nil {
+- if err.Error() != e.err {
+- t.Fatalf("expected error %v; got %v", e.err, err)
+- }
+- return
+- }
+- if e.err != "" {
+- t.Fatalf("unexpected success; wanted %v", e.err)
+- }
+- if p.Column() != e.resCol {
+- t.Fatalf("expected resulting col %v; got %v", e.resCol, p.Column())
+- }
+- if p.Offset() != e.resOffset {
+- t.Fatalf("expected resulting offset %v; got %v", e.resOffset, p.Offset())
+- }
+- pre, post := getPrePost(e.input, p.Offset())
+- if string(pre) != e.pre {
+- t.Fatalf("expected #%d pre %q; got %q", p.Offset(), e.pre, pre)
+- }
+- if string(post) != e.post {
+- t.Fatalf("expected #%d post %q; got %q", p.Offset(), e.post, post)
+- }
+- })
+- }
+-}
+-
+-func getPrePost(content []byte, offset int) (string, string) {
+- pre, post := string(content)[:offset], string(content)[offset:]
+- if i := strings.LastIndex(pre, "\n"); i >= 0 {
+- pre = pre[i+1:]
+- }
+- if i := strings.IndexRune(post, '\n'); i >= 0 {
+- post = post[:i]
+- }
+- return pre, post
+-}
+-
+-// -- these are the historical lsppos tests --
+-
+-type testCase struct {
+- content string // input text
+- substrOrOffset interface{} // explicit integer offset, or a substring
+- wantLine, wantChar int // expected LSP position information
+-}
+-
+-// offset returns the test case byte offset
+-func (c testCase) offset() int {
+- switch x := c.substrOrOffset.(type) {
+- case int:
+- return x
+- case string:
+- i := strings.Index(c.content, x)
+- if i < 0 {
+- panic(fmt.Sprintf("%q does not contain substring %q", c.content, x))
+- }
+- return i
+- }
+- panic("substrOrIndex must be an integer or string")
+-}
+-
+-var tests = []testCase{
+- {"a𐐀b", "a", 0, 0},
+- {"a𐐀b", "𐐀", 0, 1},
+- {"a𐐀b", "b", 0, 3},
+- {"a𐐀b\n", "\n", 0, 4},
+- {"a𐐀b\r\n", "\n", 0, 4}, // \r|\n is not a valid position, so we move back to the end of the first line.
+- {"a𐐀b\r\nx", "x", 1, 0},
+- {"a𐐀b\r\nx\ny", "y", 2, 0},
+-
+- // Testing EOL and EOF positions
+- {"", 0, 0, 0}, // 0th position of an empty buffer is (0, 0)
+- {"abc", "c", 0, 2},
+- {"abc", 3, 0, 3},
+- {"abc\n", "\n", 0, 3},
+- {"abc\n", 4, 1, 0}, // position after a newline is on the next line
+-}
+-
+-func TestLineChar(t *testing.T) {
+- for _, test := range tests {
+- m := protocol.NewMapper("", []byte(test.content))
+- offset := test.offset()
+- posn, _ := m.OffsetPosition(offset)
+- gotLine, gotChar := int(posn.Line), int(posn.Character)
+- if gotLine != test.wantLine || gotChar != test.wantChar {
+- t.Errorf("LineChar(%d) = (%d,%d), want (%d,%d)", offset, gotLine, gotChar, test.wantLine, test.wantChar)
+- }
+- }
+-}
+-
+-func TestInvalidOffset(t *testing.T) {
+- content := []byte("a𐐀b\r\nx\ny")
+- m := protocol.NewMapper("", content)
+- for _, offset := range []int{-1, 100} {
+- posn, err := m.OffsetPosition(offset)
+- if err == nil {
+- t.Errorf("OffsetPosition(%d) = %s, want error", offset, posn)
+- }
+- }
+-}
+-
+-func TestPosition(t *testing.T) {
+- for _, test := range tests {
+- m := protocol.NewMapper("", []byte(test.content))
+- offset := test.offset()
+- got, err := m.OffsetPosition(offset)
+- if err != nil {
+- t.Errorf("OffsetPosition(%d) failed: %v", offset, err)
+- continue
+- }
+- want := protocol.Position{Line: uint32(test.wantLine), Character: uint32(test.wantChar)}
+- if got != want {
+- t.Errorf("Position(%d) = %v, want %v", offset, got, want)
+- }
+- }
+-}
+-
+-func TestRange(t *testing.T) {
+- for _, test := range tests {
+- m := protocol.NewMapper("", []byte(test.content))
+- offset := test.offset()
+- got, err := m.OffsetRange(0, offset)
+- if err != nil {
+- t.Fatal(err)
+- }
+- want := protocol.Range{
+- End: protocol.Position{Line: uint32(test.wantLine), Character: uint32(test.wantChar)},
+- }
+- if got != want {
+- t.Errorf("Range(%d) = %v, want %v", offset, got, want)
+- }
+- }
+-}
+-
+-func TestBytesOffset(t *testing.T) {
+- tests := []struct {
+- text string
+- pos protocol.Position
+- want int
+- }{
+- // U+10400 encodes as [F0 90 90 80] in UTF-8 and [D801 DC00] in UTF-16.
+- {text: `a𐐀b`, pos: protocol.Position{Line: 0, Character: 0}, want: 0},
+- {text: `a𐐀b`, pos: protocol.Position{Line: 0, Character: 1}, want: 1},
+- {text: `a𐐀b`, pos: protocol.Position{Line: 0, Character: 2}, want: 1},
+- {text: `a𐐀b`, pos: protocol.Position{Line: 0, Character: 3}, want: 5},
+- {text: `a𐐀b`, pos: protocol.Position{Line: 0, Character: 4}, want: 6},
+- {text: `a𐐀b`, pos: protocol.Position{Line: 0, Character: 5}, want: -1},
+- {text: "aaa\nbbb\n", pos: protocol.Position{Line: 0, Character: 3}, want: 3},
+- {text: "aaa\nbbb\n", pos: protocol.Position{Line: 0, Character: 4}, want: -1},
+- {text: "aaa\nbbb\n", pos: protocol.Position{Line: 1, Character: 0}, want: 4},
+- {text: "aaa\nbbb\n", pos: protocol.Position{Line: 1, Character: 3}, want: 7},
+- {text: "aaa\nbbb\n", pos: protocol.Position{Line: 1, Character: 4}, want: -1},
+- {text: "aaa\nbbb\n", pos: protocol.Position{Line: 2, Character: 0}, want: 8},
+- {text: "aaa\nbbb\n", pos: protocol.Position{Line: 2, Character: 1}, want: -1},
+- {text: "aaa\nbbb\n\n", pos: protocol.Position{Line: 2, Character: 0}, want: 8},
+- }
+-
+- for i, test := range tests {
+- fname := fmt.Sprintf("test %d", i)
+- uri := span.URIFromPath(fname)
+- mapper := protocol.NewMapper(uri, []byte(test.text))
+- got, err := mapper.PositionPoint(test.pos)
+- if err != nil && test.want != -1 {
+- t.Errorf("%d: unexpected error: %v", i, err)
+- }
+- if err == nil && got.Offset() != test.want {
+- t.Errorf("want %d for %q(Line:%d,Character:%d), but got %d", test.want, test.text, int(test.pos.Line), int(test.pos.Character), got.Offset())
+- }
+- }
+-}
+-
+-// -- end --
+diff -urN a/gopls/internal/lsp/protocol/protocol.go b/gopls/internal/lsp/protocol/protocol.go
+--- a/gopls/internal/lsp/protocol/protocol.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/protocol.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,284 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package protocol
+-
+-import (
+- "context"
+- "encoding/json"
+- "fmt"
+- "io"
+-
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/jsonrpc2"
+- jsonrpc2_v2 "golang.org/x/tools/internal/jsonrpc2_v2"
+- "golang.org/x/tools/internal/xcontext"
+-)
+-
+-var (
+- // RequestCancelledError should be used when a request is cancelled early.
+- RequestCancelledError = jsonrpc2.NewError(-32800, "JSON RPC cancelled")
+- RequestCancelledErrorV2 = jsonrpc2_v2.NewError(-32800, "JSON RPC cancelled")
+-)
+-
+-type ClientCloser interface {
+- Client
+- io.Closer
+-}
+-
+-type connSender interface {
+- io.Closer
+-
+- Notify(ctx context.Context, method string, params interface{}) error
+- Call(ctx context.Context, method string, params, result interface{}) error
+-}
+-
+-type clientDispatcher struct {
+- sender connSender
+-}
+-
+-func (c *clientDispatcher) Close() error {
+- return c.sender.Close()
+-}
+-
+-// ClientDispatcher returns a Client that dispatches LSP requests across the
+-// given jsonrpc2 connection.
+-func ClientDispatcher(conn jsonrpc2.Conn) ClientCloser {
+- return &clientDispatcher{sender: clientConn{conn}}
+-}
+-
+-type clientConn struct {
+- conn jsonrpc2.Conn
+-}
+-
+-func (c clientConn) Close() error {
+- return c.conn.Close()
+-}
+-
+-func (c clientConn) Notify(ctx context.Context, method string, params interface{}) error {
+- return c.conn.Notify(ctx, method, params)
+-}
+-
+-func (c clientConn) Call(ctx context.Context, method string, params interface{}, result interface{}) error {
+- id, err := c.conn.Call(ctx, method, params, result)
+- if ctx.Err() != nil {
+- cancelCall(ctx, c, id)
+- }
+- return err
+-}
+-
+-func ClientDispatcherV2(conn *jsonrpc2_v2.Connection) ClientCloser {
+- return &clientDispatcher{clientConnV2{conn}}
+-}
+-
+-type clientConnV2 struct {
+- conn *jsonrpc2_v2.Connection
+-}
+-
+-func (c clientConnV2) Close() error {
+- return c.conn.Close()
+-}
+-
+-func (c clientConnV2) Notify(ctx context.Context, method string, params interface{}) error {
+- return c.conn.Notify(ctx, method, params)
+-}
+-
+-func (c clientConnV2) Call(ctx context.Context, method string, params interface{}, result interface{}) error {
+- call := c.conn.Call(ctx, method, params)
+- err := call.Await(ctx, result)
+- if ctx.Err() != nil {
+- detached := xcontext.Detach(ctx)
+- c.conn.Notify(detached, "$/cancelRequest", &CancelParams{ID: call.ID().Raw()})
+- }
+- return err
+-}
+-
+-// ServerDispatcher returns a Server that dispatches LSP requests across the
+-// given jsonrpc2 connection.
+-func ServerDispatcher(conn jsonrpc2.Conn) Server {
+- return &serverDispatcher{sender: clientConn{conn}}
+-}
+-
+-func ServerDispatcherV2(conn *jsonrpc2_v2.Connection) Server {
+- return &serverDispatcher{sender: clientConnV2{conn}}
+-}
+-
+-type serverDispatcher struct {
+- sender connSender
+-}
+-
+-func ClientHandler(client Client, handler jsonrpc2.Handler) jsonrpc2.Handler {
+- return func(ctx context.Context, reply jsonrpc2.Replier, req jsonrpc2.Request) error {
+- if ctx.Err() != nil {
+- ctx := xcontext.Detach(ctx)
+- return reply(ctx, nil, RequestCancelledError)
+- }
+- handled, err := clientDispatch(ctx, client, reply, req)
+- if handled || err != nil {
+- return err
+- }
+- return handler(ctx, reply, req)
+- }
+-}
+-
+-func ClientHandlerV2(client Client) jsonrpc2_v2.Handler {
+- return jsonrpc2_v2.HandlerFunc(func(ctx context.Context, req *jsonrpc2_v2.Request) (interface{}, error) {
+- if ctx.Err() != nil {
+- return nil, RequestCancelledErrorV2
+- }
+- req1 := req2to1(req)
+- var (
+- result interface{}
+- resErr error
+- )
+- replier := func(_ context.Context, res interface{}, err error) error {
+- if err != nil {
+- resErr = err
+- return nil
+- }
+- result = res
+- return nil
+- }
+- _, err := clientDispatch(ctx, client, replier, req1)
+- if err != nil {
+- return nil, err
+- }
+- return result, resErr
+- })
+-}
+-
+-func ServerHandler(server Server, handler jsonrpc2.Handler) jsonrpc2.Handler {
+- return func(ctx context.Context, reply jsonrpc2.Replier, req jsonrpc2.Request) error {
+- if ctx.Err() != nil {
+- ctx := xcontext.Detach(ctx)
+- return reply(ctx, nil, RequestCancelledError)
+- }
+- handled, err := serverDispatch(ctx, server, reply, req)
+- if handled || err != nil {
+- return err
+- }
+- //TODO: This code is wrong, it ignores handler and assumes non standard
+- // request handles everything
+- // non standard request should just be a layered handler.
+- var params interface{}
+- if err := json.Unmarshal(req.Params(), &params); err != nil {
+- return sendParseError(ctx, reply, err)
+- }
+- resp, err := server.NonstandardRequest(ctx, req.Method(), params)
+- return reply(ctx, resp, err)
+-
+- }
+-}
+-
+-func ServerHandlerV2(server Server) jsonrpc2_v2.Handler {
+- return jsonrpc2_v2.HandlerFunc(func(ctx context.Context, req *jsonrpc2_v2.Request) (interface{}, error) {
+- if ctx.Err() != nil {
+- return nil, RequestCancelledErrorV2
+- }
+- req1 := req2to1(req)
+- var (
+- result interface{}
+- resErr error
+- )
+- replier := func(_ context.Context, res interface{}, err error) error {
+- if err != nil {
+- resErr = err
+- return nil
+- }
+- result = res
+- return nil
+- }
+- _, err := serverDispatch(ctx, server, replier, req1)
+- if err != nil {
+- return nil, err
+- }
+- return result, resErr
+- })
+-}
+-
+-func req2to1(req2 *jsonrpc2_v2.Request) jsonrpc2.Request {
+- if req2.ID.IsValid() {
+- raw := req2.ID.Raw()
+- var idv1 jsonrpc2.ID
+- switch v := raw.(type) {
+- case int64:
+- idv1 = jsonrpc2.NewIntID(v)
+- case string:
+- idv1 = jsonrpc2.NewStringID(v)
+- default:
+- panic(fmt.Sprintf("unsupported ID type %T", raw))
+- }
+- req1, err := jsonrpc2.NewCall(idv1, req2.Method, req2.Params)
+- if err != nil {
+- panic(err)
+- }
+- return req1
+- }
+- req1, err := jsonrpc2.NewNotification(req2.Method, req2.Params)
+- if err != nil {
+- panic(err)
+- }
+- return req1
+-}
+-
+-func Handlers(handler jsonrpc2.Handler) jsonrpc2.Handler {
+- return CancelHandler(
+- jsonrpc2.AsyncHandler(
+- jsonrpc2.MustReplyHandler(handler)))
+-}
+-
+-func CancelHandler(handler jsonrpc2.Handler) jsonrpc2.Handler {
+- handler, canceller := jsonrpc2.CancelHandler(handler)
+- return func(ctx context.Context, reply jsonrpc2.Replier, req jsonrpc2.Request) error {
+- if req.Method() != "$/cancelRequest" {
+- // TODO(iancottrell): See if we can generate a reply for the request to be cancelled
+- // at the point of cancellation rather than waiting for gopls to naturally reply.
+- // To do that, we need to keep track of whether a reply has been sent already and
+- // be careful about racing between the two paths.
+- // TODO(iancottrell): Add a test that watches the stream and verifies the response
+- // for the cancelled request flows.
+- replyWithDetachedContext := func(ctx context.Context, resp interface{}, err error) error {
+- // https://microsoft.github.io/language-server-protocol/specifications/specification-current/#cancelRequest
+- if ctx.Err() != nil && err == nil {
+- err = RequestCancelledError
+- }
+- ctx = xcontext.Detach(ctx)
+- return reply(ctx, resp, err)
+- }
+- return handler(ctx, replyWithDetachedContext, req)
+- }
+- var params CancelParams
+- if err := json.Unmarshal(req.Params(), &params); err != nil {
+- return sendParseError(ctx, reply, err)
+- }
+- if n, ok := params.ID.(float64); ok {
+- canceller(jsonrpc2.NewIntID(int64(n)))
+- } else if s, ok := params.ID.(string); ok {
+- canceller(jsonrpc2.NewStringID(s))
+- } else {
+- return sendParseError(ctx, reply, fmt.Errorf("request ID %v malformed", params.ID))
+- }
+- return reply(ctx, nil, nil)
+- }
+-}
+-
+-func Call(ctx context.Context, conn jsonrpc2.Conn, method string, params interface{}, result interface{}) error {
+- id, err := conn.Call(ctx, method, params, result)
+- if ctx.Err() != nil {
+- cancelCall(ctx, clientConn{conn}, id)
+- }
+- return err
+-}
+-
+-func cancelCall(ctx context.Context, sender connSender, id jsonrpc2.ID) {
+- ctx = xcontext.Detach(ctx)
+- ctx, done := event.Start(ctx, "protocol.canceller")
+- defer done()
+- // Note that only *jsonrpc2.ID implements json.Marshaler.
+- sender.Notify(ctx, "$/cancelRequest", &CancelParams{ID: &id})
+-}
+-
+-func sendParseError(ctx context.Context, reply jsonrpc2.Replier, err error) error {
+- return reply(ctx, nil, fmt.Errorf("%w: %s", jsonrpc2.ErrParse, err))
+-}
+diff -urN a/gopls/internal/lsp/protocol/span.go b/gopls/internal/lsp/protocol/span.go
+--- a/gopls/internal/lsp/protocol/span.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/span.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,118 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package protocol
+-
+-import (
+- "fmt"
+- "unicode/utf8"
+-
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-func URIFromSpanURI(uri span.URI) DocumentURI {
+- return DocumentURI(uri) // simple conversion
+-}
+-
+-func URIFromPath(path string) DocumentURI {
+- return URIFromSpanURI(span.URIFromPath(path)) // normalizing conversion
+-}
+-
+-func (u DocumentURI) SpanURI() span.URI {
+- return span.URIFromURI(string(u)) // normalizing conversion
+-}
+-
+-func IsPoint(r Range) bool {
+- return r.Start.Line == r.End.Line && r.Start.Character == r.End.Character
+-}
+-
+-// CompareLocation defines a three-valued comparison over locations,
+-// lexicographically ordered by (URI, Range).
+-func CompareLocation(x, y Location) int {
+- if x.URI != y.URI {
+- if x.URI < y.URI {
+- return -1
+- } else {
+- return +1
+- }
+- }
+- return CompareRange(x.Range, y.Range)
+-}
+-
+-// CompareRange returns -1 if a is before b, 0 if a == b, and 1 if a is after b.
+-//
+-// A range a is defined to be 'before' b if a.Start is before b.Start, or
+-// a.Start == b.Start and a.End is before b.End.
+-func CompareRange(a, b Range) int {
+- if r := ComparePosition(a.Start, b.Start); r != 0 {
+- return r
+- }
+- return ComparePosition(a.End, b.End)
+-}
+-
+-// ComparePosition returns -1 if a is before b, 0 if a == b, and 1 if a is after b.
+-func ComparePosition(a, b Position) int {
+- if a.Line != b.Line {
+- if a.Line < b.Line {
+- return -1
+- } else {
+- return +1
+- }
+- }
+- if a.Character != b.Character {
+- if a.Character < b.Character {
+- return -1
+- } else {
+- return +1
+- }
+- }
+- return 0
+-}
+-
+-func Intersect(a, b Range) bool {
+- if a.Start.Line > b.End.Line || a.End.Line < b.Start.Line {
+- return false
+- }
+- return !((a.Start.Line == b.End.Line) && a.Start.Character > b.End.Character ||
+- (a.End.Line == b.Start.Line) && a.End.Character < b.Start.Character)
+-}
+-
+-// Format implements fmt.Formatter.
+-//
+-// Note: Formatter is implemented instead of Stringer (presumably) for
+-// performance reasons, though it is not clear that it matters in practice.
+-func (r Range) Format(f fmt.State, _ rune) {
+- fmt.Fprintf(f, "%v-%v", r.Start, r.End)
+-}
+-
+-// Format implements fmt.Formatter.
+-//
+-// See Range.Format for discussion of why the Formatter interface is
+-// implemented rather than Stringer.
+-func (p Position) Format(f fmt.State, _ rune) {
+- fmt.Fprintf(f, "%v:%v", p.Line, p.Character)
+-}
+-
+-// -- implementation helpers --
+-
+-// UTF16Len returns the number of codes in the UTF-16 transcoding of s.
+-func UTF16Len(s []byte) int {
+- var n int
+- for len(s) > 0 {
+- n++
+-
+- // Fast path for ASCII.
+- if s[0] < 0x80 {
+- s = s[1:]
+- continue
+- }
+-
+- r, size := utf8.DecodeRune(s)
+- if r >= 0x10000 {
+- n++ // surrogate pair
+- }
+- s = s[size:]
+- }
+- return n
+-}
+diff -urN a/gopls/internal/lsp/protocol/tsclient.go b/gopls/internal/lsp/protocol/tsclient.go
+--- a/gopls/internal/lsp/protocol/tsclient.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/tsclient.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,249 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Code generated for LSP. DO NOT EDIT.
+-
+-package protocol
+-
+-// Code generated from protocol/metaModel.json at ref release/protocol/3.17.3-next.6 (hash 56c23c557e3568a9f56f42435fd5a80f9458957f).
+-// https://github.com/microsoft/vscode-languageserver-node/blob/release/protocol/3.17.3-next.6/protocol/metaModel.json
+-// LSP metaData.version = 3.17.0.
+-
+-import (
+- "context"
+- "encoding/json"
+-
+- "golang.org/x/tools/internal/jsonrpc2"
+-)
+-
+-type Client interface {
+- LogTrace(context.Context, *LogTraceParams) error // $/logTrace
+- Progress(context.Context, *ProgressParams) error // $/progress
+- RegisterCapability(context.Context, *RegistrationParams) error // client/registerCapability
+- UnregisterCapability(context.Context, *UnregistrationParams) error // client/unregisterCapability
+- Event(context.Context, *interface{}) error // telemetry/event
+- PublishDiagnostics(context.Context, *PublishDiagnosticsParams) error // textDocument/publishDiagnostics
+- LogMessage(context.Context, *LogMessageParams) error // window/logMessage
+- ShowDocument(context.Context, *ShowDocumentParams) (*ShowDocumentResult, error) // window/showDocument
+- ShowMessage(context.Context, *ShowMessageParams) error // window/showMessage
+- ShowMessageRequest(context.Context, *ShowMessageRequestParams) (*MessageActionItem, error) // window/showMessageRequest
+- WorkDoneProgressCreate(context.Context, *WorkDoneProgressCreateParams) error // window/workDoneProgress/create
+- ApplyEdit(context.Context, *ApplyWorkspaceEditParams) (*ApplyWorkspaceEditResult, error) // workspace/applyEdit
+- CodeLensRefresh(context.Context) error // workspace/codeLens/refresh
+- Configuration(context.Context, *ParamConfiguration) ([]LSPAny, error) // workspace/configuration
+- DiagnosticRefresh(context.Context) error // workspace/diagnostic/refresh
+- InlayHintRefresh(context.Context) error // workspace/inlayHint/refresh
+- InlineValueRefresh(context.Context) error // workspace/inlineValue/refresh
+- SemanticTokensRefresh(context.Context) error // workspace/semanticTokens/refresh
+- WorkspaceFolders(context.Context) ([]WorkspaceFolder, error) // workspace/workspaceFolders
+-}
+-
+-func clientDispatch(ctx context.Context, client Client, reply jsonrpc2.Replier, r jsonrpc2.Request) (bool, error) {
+- switch r.Method() {
+- case "$/logTrace":
+- var params LogTraceParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := client.LogTrace(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "$/progress":
+- var params ProgressParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := client.Progress(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "client/registerCapability":
+- var params RegistrationParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := client.RegisterCapability(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "client/unregisterCapability":
+- var params UnregistrationParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := client.UnregisterCapability(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "telemetry/event":
+- var params interface{}
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := client.Event(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "textDocument/publishDiagnostics":
+- var params PublishDiagnosticsParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := client.PublishDiagnostics(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "window/logMessage":
+- var params LogMessageParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := client.LogMessage(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "window/showDocument":
+- var params ShowDocumentParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := client.ShowDocument(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "window/showMessage":
+- var params ShowMessageParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := client.ShowMessage(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "window/showMessageRequest":
+- var params ShowMessageRequestParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := client.ShowMessageRequest(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "window/workDoneProgress/create":
+- var params WorkDoneProgressCreateParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := client.WorkDoneProgressCreate(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "workspace/applyEdit":
+- var params ApplyWorkspaceEditParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := client.ApplyEdit(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "workspace/codeLens/refresh":
+- err := client.CodeLensRefresh(ctx)
+- return true, reply(ctx, nil, err)
+- case "workspace/configuration":
+- var params ParamConfiguration
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := client.Configuration(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "workspace/diagnostic/refresh":
+- err := client.DiagnosticRefresh(ctx)
+- return true, reply(ctx, nil, err)
+- case "workspace/inlayHint/refresh":
+- err := client.InlayHintRefresh(ctx)
+- return true, reply(ctx, nil, err)
+- case "workspace/inlineValue/refresh":
+- err := client.InlineValueRefresh(ctx)
+- return true, reply(ctx, nil, err)
+- case "workspace/semanticTokens/refresh":
+- err := client.SemanticTokensRefresh(ctx)
+- return true, reply(ctx, nil, err)
+- case "workspace/workspaceFolders":
+- resp, err := client.WorkspaceFolders(ctx)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- default:
+- return false, nil
+- }
+-}
+-
+-func (s *clientDispatcher) LogTrace(ctx context.Context, params *LogTraceParams) error {
+- return s.sender.Notify(ctx, "$/logTrace", params)
+-}
+-func (s *clientDispatcher) Progress(ctx context.Context, params *ProgressParams) error {
+- return s.sender.Notify(ctx, "$/progress", params)
+-}
+-func (s *clientDispatcher) RegisterCapability(ctx context.Context, params *RegistrationParams) error {
+- return s.sender.Call(ctx, "client/registerCapability", params, nil)
+-}
+-func (s *clientDispatcher) UnregisterCapability(ctx context.Context, params *UnregistrationParams) error {
+- return s.sender.Call(ctx, "client/unregisterCapability", params, nil)
+-}
+-func (s *clientDispatcher) Event(ctx context.Context, params *interface{}) error {
+- return s.sender.Notify(ctx, "telemetry/event", params)
+-}
+-func (s *clientDispatcher) PublishDiagnostics(ctx context.Context, params *PublishDiagnosticsParams) error {
+- return s.sender.Notify(ctx, "textDocument/publishDiagnostics", params)
+-}
+-func (s *clientDispatcher) LogMessage(ctx context.Context, params *LogMessageParams) error {
+- return s.sender.Notify(ctx, "window/logMessage", params)
+-}
+-func (s *clientDispatcher) ShowDocument(ctx context.Context, params *ShowDocumentParams) (*ShowDocumentResult, error) {
+- var result *ShowDocumentResult
+- if err := s.sender.Call(ctx, "window/showDocument", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *clientDispatcher) ShowMessage(ctx context.Context, params *ShowMessageParams) error {
+- return s.sender.Notify(ctx, "window/showMessage", params)
+-}
+-func (s *clientDispatcher) ShowMessageRequest(ctx context.Context, params *ShowMessageRequestParams) (*MessageActionItem, error) {
+- var result *MessageActionItem
+- if err := s.sender.Call(ctx, "window/showMessageRequest", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *clientDispatcher) WorkDoneProgressCreate(ctx context.Context, params *WorkDoneProgressCreateParams) error {
+- return s.sender.Call(ctx, "window/workDoneProgress/create", params, nil)
+-}
+-func (s *clientDispatcher) ApplyEdit(ctx context.Context, params *ApplyWorkspaceEditParams) (*ApplyWorkspaceEditResult, error) {
+- var result *ApplyWorkspaceEditResult
+- if err := s.sender.Call(ctx, "workspace/applyEdit", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *clientDispatcher) CodeLensRefresh(ctx context.Context) error {
+- return s.sender.Call(ctx, "workspace/codeLens/refresh", nil, nil)
+-}
+-func (s *clientDispatcher) Configuration(ctx context.Context, params *ParamConfiguration) ([]LSPAny, error) {
+- var result []LSPAny
+- if err := s.sender.Call(ctx, "workspace/configuration", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *clientDispatcher) DiagnosticRefresh(ctx context.Context) error {
+- return s.sender.Call(ctx, "workspace/diagnostic/refresh", nil, nil)
+-}
+-func (s *clientDispatcher) InlayHintRefresh(ctx context.Context) error {
+- return s.sender.Call(ctx, "workspace/inlayHint/refresh", nil, nil)
+-}
+-func (s *clientDispatcher) InlineValueRefresh(ctx context.Context) error {
+- return s.sender.Call(ctx, "workspace/inlineValue/refresh", nil, nil)
+-}
+-func (s *clientDispatcher) SemanticTokensRefresh(ctx context.Context) error {
+- return s.sender.Call(ctx, "workspace/semanticTokens/refresh", nil, nil)
+-}
+-func (s *clientDispatcher) WorkspaceFolders(ctx context.Context) ([]WorkspaceFolder, error) {
+- var result []WorkspaceFolder
+- if err := s.sender.Call(ctx, "workspace/workspaceFolders", nil, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+diff -urN a/gopls/internal/lsp/protocol/tsdocument_changes.go b/gopls/internal/lsp/protocol/tsdocument_changes.go
+--- a/gopls/internal/lsp/protocol/tsdocument_changes.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/tsdocument_changes.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,42 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package protocol
+-
+-import (
+- "encoding/json"
+- "fmt"
+-)
+-
+-// DocumentChanges is a union of a file edit and directory rename operations
+-// for package renaming feature. At most one field of this struct is non-nil.
+-type DocumentChanges struct {
+- TextDocumentEdit *TextDocumentEdit
+- RenameFile *RenameFile
+-}
+-
+-func (d *DocumentChanges) UnmarshalJSON(data []byte) error {
+- var m map[string]interface{}
+-
+- if err := json.Unmarshal(data, &m); err != nil {
+- return err
+- }
+-
+- if _, ok := m["textDocument"]; ok {
+- d.TextDocumentEdit = new(TextDocumentEdit)
+- return json.Unmarshal(data, d.TextDocumentEdit)
+- }
+-
+- d.RenameFile = new(RenameFile)
+- return json.Unmarshal(data, d.RenameFile)
+-}
+-
+-func (d *DocumentChanges) MarshalJSON() ([]byte, error) {
+- if d.TextDocumentEdit != nil {
+- return json.Marshal(d.TextDocumentEdit)
+- } else if d.RenameFile != nil {
+- return json.Marshal(d.RenameFile)
+- }
+- return nil, fmt.Errorf("Empty DocumentChanges union value")
+-}
+diff -urN a/gopls/internal/lsp/protocol/tsjson.go b/gopls/internal/lsp/protocol/tsjson.go
+--- a/gopls/internal/lsp/protocol/tsjson.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/tsjson.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1997 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Code generated for LSP. DO NOT EDIT.
+-
+-package protocol
+-
+-// Code generated from protocol/metaModel.json at ref release/protocol/3.17.3-next.6 (hash 56c23c557e3568a9f56f42435fd5a80f9458957f).
+-// https://github.com/microsoft/vscode-languageserver-node/blob/release/protocol/3.17.3-next.6/protocol/metaModel.json
+-// LSP metaData.version = 3.17.0.
+-
+-import "encoding/json"
+-
+-import "fmt"
+-
+-// UnmarshalError indicates that a JSON value did not conform to
+-// one of the expected cases of an LSP union type.
+-type UnmarshalError struct {
+- msg string
+-}
+-
+-func (e UnmarshalError) Error() string {
+- return e.msg
+-}
+-
+-// from line 4769
+-func (t OrFEditRangePItemDefaults) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case FEditRangePItemDefaults:
+- return json.Marshal(x)
+- case Range:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [FEditRangePItemDefaults Range]", t)
+-}
+-
+-func (t *OrFEditRangePItemDefaults) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 FEditRangePItemDefaults
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 Range
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [FEditRangePItemDefaults Range]"}
+-}
+-
+-// from line 9811
+-func (t OrFNotebookPNotebookSelector) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case NotebookDocumentFilter:
+- return json.Marshal(x)
+- case string:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilter string]", t)
+-}
+-
+-func (t *OrFNotebookPNotebookSelector) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 NotebookDocumentFilter
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 string
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilter string]"}
+-}
+-
+-// from line 5520
+-func (t OrPLocation_workspace_symbol) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case Location:
+- return json.Marshal(x)
+- case PLocationMsg_workspace_symbol:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [Location PLocationMsg_workspace_symbol]", t)
+-}
+-
+-func (t *OrPLocation_workspace_symbol) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 Location
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 PLocationMsg_workspace_symbol
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [Location PLocationMsg_workspace_symbol]"}
+-}
+-
+-// from line 4163
+-func (t OrPSection_workspace_didChangeConfiguration) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case []string:
+- return json.Marshal(x)
+- case string:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [[]string string]", t)
+-}
+-
+-func (t *OrPSection_workspace_didChangeConfiguration) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 []string
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 string
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [[]string string]"}
+-}
+-
+-// from line 7075
+-func (t OrPTooltipPLabel) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case MarkupContent:
+- return json.Marshal(x)
+- case string:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
+-}
+-
+-func (t *OrPTooltipPLabel) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 MarkupContent
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 string
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
+-}
+-
+-// from line 3699
+-func (t OrPTooltip_textDocument_inlayHint) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case MarkupContent:
+- return json.Marshal(x)
+- case string:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
+-}
+-
+-func (t *OrPTooltip_textDocument_inlayHint) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 MarkupContent
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 string
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
+-}
+-
+-// from line 6184
+-func (t Or_CancelParams_id) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case int32:
+- return json.Marshal(x)
+- case string:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [int32 string]", t)
+-}
+-
+-func (t *Or_CancelParams_id) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 int32
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 string
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [int32 string]"}
+-}
+-
+-// from line 4582
+-func (t Or_CompletionItem_documentation) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case MarkupContent:
+- return json.Marshal(x)
+- case string:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
+-}
+-
+-func (t *Or_CompletionItem_documentation) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 MarkupContent
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 string
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
+-}
+-
+-// from line 4665
+-func (t Or_CompletionItem_textEdit) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case InsertReplaceEdit:
+- return json.Marshal(x)
+- case TextEdit:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [InsertReplaceEdit TextEdit]", t)
+-}
+-
+-func (t *Or_CompletionItem_textEdit) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 InsertReplaceEdit
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 TextEdit
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [InsertReplaceEdit TextEdit]"}
+-}
+-
+-// from line 13753
+-func (t Or_Definition) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case Location:
+- return json.Marshal(x)
+- case []Location:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [Location []Location]", t)
+-}
+-
+-func (t *Or_Definition) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 Location
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 []Location
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [Location []Location]"}
+-}
+-
+-// from line 8547
+-func (t Or_Diagnostic_code) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case int32:
+- return json.Marshal(x)
+- case string:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [int32 string]", t)
+-}
+-
+-func (t *Or_Diagnostic_code) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 int32
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 string
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [int32 string]"}
+-}
+-
+-// from line 13885
+-func (t Or_DocumentDiagnosticReport) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case RelatedFullDocumentDiagnosticReport:
+- return json.Marshal(x)
+- case RelatedUnchangedDocumentDiagnosticReport:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [RelatedFullDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport]", t)
+-}
+-
+-func (t *Or_DocumentDiagnosticReport) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 RelatedFullDocumentDiagnosticReport
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 RelatedUnchangedDocumentDiagnosticReport
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [RelatedFullDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport]"}
+-}
+-
+-// from line 3822
+-func (t Or_DocumentDiagnosticReportPartialResult_relatedDocuments_Value) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case FullDocumentDiagnosticReport:
+- return json.Marshal(x)
+- case UnchangedDocumentDiagnosticReport:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]", t)
+-}
+-
+-func (t *Or_DocumentDiagnosticReportPartialResult_relatedDocuments_Value) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 FullDocumentDiagnosticReport
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 UnchangedDocumentDiagnosticReport
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]"}
+-}
+-
+-// from line 14095
+-func (t Or_DocumentFilter) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case NotebookCellTextDocumentFilter:
+- return json.Marshal(x)
+- case TextDocumentFilter:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [NotebookCellTextDocumentFilter TextDocumentFilter]", t)
+-}
+-
+-func (t *Or_DocumentFilter) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 NotebookCellTextDocumentFilter
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 TextDocumentFilter
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [NotebookCellTextDocumentFilter TextDocumentFilter]"}
+-}
+-
+-// from line 4891
+-func (t Or_Hover_contents) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case MarkedString:
+- return json.Marshal(x)
+- case MarkupContent:
+- return json.Marshal(x)
+- case []MarkedString:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [MarkedString MarkupContent []MarkedString]", t)
+-}
+-
+-func (t *Or_Hover_contents) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 MarkedString
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 MarkupContent
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- var h2 []MarkedString
+- if err := json.Unmarshal(x, &h2); err == nil {
+- t.Value = h2
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [MarkedString MarkupContent []MarkedString]"}
+-}
+-
+-// from line 3658
+-func (t Or_InlayHint_label) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case []InlayHintLabelPart:
+- return json.Marshal(x)
+- case string:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [[]InlayHintLabelPart string]", t)
+-}
+-
+-func (t *Or_InlayHint_label) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 []InlayHintLabelPart
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 string
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [[]InlayHintLabelPart string]"}
+-}
+-
+-// from line 13863
+-func (t Or_InlineValue) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case InlineValueEvaluatableExpression:
+- return json.Marshal(x)
+- case InlineValueText:
+- return json.Marshal(x)
+- case InlineValueVariableLookup:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [InlineValueEvaluatableExpression InlineValueText InlineValueVariableLookup]", t)
+-}
+-
+-func (t *Or_InlineValue) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 InlineValueEvaluatableExpression
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 InlineValueText
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- var h2 InlineValueVariableLookup
+- if err := json.Unmarshal(x, &h2); err == nil {
+- t.Value = h2
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [InlineValueEvaluatableExpression InlineValueText InlineValueVariableLookup]"}
+-}
+-
+-// from line 14060
+-func (t Or_MarkedString) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case Msg_MarkedString:
+- return json.Marshal(x)
+- case string:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [Msg_MarkedString string]", t)
+-}
+-
+-func (t *Or_MarkedString) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 Msg_MarkedString
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 string
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [Msg_MarkedString string]"}
+-}
+-
+-// from line 10118
+-func (t Or_NotebookCellTextDocumentFilter_notebook) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case NotebookDocumentFilter:
+- return json.Marshal(x)
+- case string:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilter string]", t)
+-}
+-
+-func (t *Or_NotebookCellTextDocumentFilter_notebook) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 NotebookDocumentFilter
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 string
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilter string]"}
+-}
+-
+-// from line 9857
+-func (t Or_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1_notebook) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case NotebookDocumentFilter:
+- return json.Marshal(x)
+- case string:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [NotebookDocumentFilter string]", t)
+-}
+-
+-func (t *Or_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1_notebook) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 NotebookDocumentFilter
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 string
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentFilter string]"}
+-}
+-
+-// from line 7168
+-func (t Or_RelatedFullDocumentDiagnosticReport_relatedDocuments_Value) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case FullDocumentDiagnosticReport:
+- return json.Marshal(x)
+- case UnchangedDocumentDiagnosticReport:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]", t)
+-}
+-
+-func (t *Or_RelatedFullDocumentDiagnosticReport_relatedDocuments_Value) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 FullDocumentDiagnosticReport
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 UnchangedDocumentDiagnosticReport
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]"}
+-}
+-
+-// from line 7207
+-func (t Or_RelatedUnchangedDocumentDiagnosticReport_relatedDocuments_Value) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case FullDocumentDiagnosticReport:
+- return json.Marshal(x)
+- case UnchangedDocumentDiagnosticReport:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]", t)
+-}
+-
+-func (t *Or_RelatedUnchangedDocumentDiagnosticReport_relatedDocuments_Value) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 FullDocumentDiagnosticReport
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 UnchangedDocumentDiagnosticReport
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]"}
+-}
+-
+-// from line 10741
+-func (t Or_RelativePattern_baseUri) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case URI:
+- return json.Marshal(x)
+- case WorkspaceFolder:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [URI WorkspaceFolder]", t)
+-}
+-
+-func (t *Or_RelativePattern_baseUri) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 URI
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 WorkspaceFolder
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [URI WorkspaceFolder]"}
+-}
+-
+-// from line 1371
+-func (t Or_Result_textDocument_codeAction_Item0_Elem) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case CodeAction:
+- return json.Marshal(x)
+- case Command:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [CodeAction Command]", t)
+-}
+-
+-func (t *Or_Result_textDocument_codeAction_Item0_Elem) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 CodeAction
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 Command
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [CodeAction Command]"}
+-}
+-
+-// from line 12197
+-func (t Or_SemanticTokensClientCapabilities_requests_full) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case FFullPRequests:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [FFullPRequests bool]", t)
+-}
+-
+-func (t *Or_SemanticTokensClientCapabilities_requests_full) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 FFullPRequests
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 bool
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [FFullPRequests bool]"}
+-}
+-
+-// from line 12177
+-func (t Or_SemanticTokensClientCapabilities_requests_range) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case FRangePRequests:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [FRangePRequests bool]", t)
+-}
+-
+-func (t *Or_SemanticTokensClientCapabilities_requests_range) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 FRangePRequests
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 bool
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [FRangePRequests bool]"}
+-}
+-
+-// from line 6579
+-func (t Or_SemanticTokensOptions_full) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case PFullESemanticTokensOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [PFullESemanticTokensOptions bool]", t)
+-}
+-
+-func (t *Or_SemanticTokensOptions_full) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 PFullESemanticTokensOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 bool
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [PFullESemanticTokensOptions bool]"}
+-}
+-
+-// from line 6559
+-func (t Or_SemanticTokensOptions_range) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case PRangeESemanticTokensOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [PRangeESemanticTokensOptions bool]", t)
+-}
+-
+-func (t *Or_SemanticTokensOptions_range) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 PRangeESemanticTokensOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 bool
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [PRangeESemanticTokensOptions bool]"}
+-}
+-
+-// from line 8227
+-func (t Or_ServerCapabilities_callHierarchyProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case CallHierarchyOptions:
+- return json.Marshal(x)
+- case CallHierarchyRegistrationOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [CallHierarchyOptions CallHierarchyRegistrationOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_callHierarchyProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 CallHierarchyOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 CallHierarchyRegistrationOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- var h2 bool
+- if err := json.Unmarshal(x, &h2); err == nil {
+- t.Value = h2
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [CallHierarchyOptions CallHierarchyRegistrationOptions bool]"}
+-}
+-
+-// from line 8035
+-func (t Or_ServerCapabilities_codeActionProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case CodeActionOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [CodeActionOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_codeActionProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 CodeActionOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 bool
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [CodeActionOptions bool]"}
+-}
+-
+-// from line 8071
+-func (t Or_ServerCapabilities_colorProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case DocumentColorOptions:
+- return json.Marshal(x)
+- case DocumentColorRegistrationOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [DocumentColorOptions DocumentColorRegistrationOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_colorProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 DocumentColorOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 DocumentColorRegistrationOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- var h2 bool
+- if err := json.Unmarshal(x, &h2); err == nil {
+- t.Value = h2
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [DocumentColorOptions DocumentColorRegistrationOptions bool]"}
+-}
+-
+-// from line 7897
+-func (t Or_ServerCapabilities_declarationProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case DeclarationOptions:
+- return json.Marshal(x)
+- case DeclarationRegistrationOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [DeclarationOptions DeclarationRegistrationOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_declarationProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 DeclarationOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 DeclarationRegistrationOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- var h2 bool
+- if err := json.Unmarshal(x, &h2); err == nil {
+- t.Value = h2
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [DeclarationOptions DeclarationRegistrationOptions bool]"}
+-}
+-
+-// from line 7919
+-func (t Or_ServerCapabilities_definitionProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case DefinitionOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [DefinitionOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_definitionProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 DefinitionOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 bool
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [DefinitionOptions bool]"}
+-}
+-
+-// from line 8384
+-func (t Or_ServerCapabilities_diagnosticProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case DiagnosticOptions:
+- return json.Marshal(x)
+- case DiagnosticRegistrationOptions:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [DiagnosticOptions DiagnosticRegistrationOptions]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_diagnosticProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 DiagnosticOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 DiagnosticRegistrationOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [DiagnosticOptions DiagnosticRegistrationOptions]"}
+-}
+-
+-// from line 8111
+-func (t Or_ServerCapabilities_documentFormattingProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case DocumentFormattingOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [DocumentFormattingOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_documentFormattingProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 DocumentFormattingOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 bool
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [DocumentFormattingOptions bool]"}
+-}
+-
+-// from line 7999
+-func (t Or_ServerCapabilities_documentHighlightProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case DocumentHighlightOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [DocumentHighlightOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_documentHighlightProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 DocumentHighlightOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 bool
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [DocumentHighlightOptions bool]"}
+-}
+-
+-// from line 8129
+-func (t Or_ServerCapabilities_documentRangeFormattingProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case DocumentRangeFormattingOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [DocumentRangeFormattingOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_documentRangeFormattingProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 DocumentRangeFormattingOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 bool
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [DocumentRangeFormattingOptions bool]"}
+-}
+-
+-// from line 8017
+-func (t Or_ServerCapabilities_documentSymbolProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case DocumentSymbolOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [DocumentSymbolOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_documentSymbolProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 DocumentSymbolOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 bool
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [DocumentSymbolOptions bool]"}
+-}
+-
+-// from line 8174
+-func (t Or_ServerCapabilities_foldingRangeProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case FoldingRangeOptions:
+- return json.Marshal(x)
+- case FoldingRangeRegistrationOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [FoldingRangeOptions FoldingRangeRegistrationOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_foldingRangeProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 FoldingRangeOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 FoldingRangeRegistrationOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- var h2 bool
+- if err := json.Unmarshal(x, &h2); err == nil {
+- t.Value = h2
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [FoldingRangeOptions FoldingRangeRegistrationOptions bool]"}
+-}
+-
+-// from line 7870
+-func (t Or_ServerCapabilities_hoverProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case HoverOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [HoverOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_hoverProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 HoverOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 bool
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [HoverOptions bool]"}
+-}
+-
+-// from line 7959
+-func (t Or_ServerCapabilities_implementationProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case ImplementationOptions:
+- return json.Marshal(x)
+- case ImplementationRegistrationOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [ImplementationOptions ImplementationRegistrationOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_implementationProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 ImplementationOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 ImplementationRegistrationOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- var h2 bool
+- if err := json.Unmarshal(x, &h2); err == nil {
+- t.Value = h2
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [ImplementationOptions ImplementationRegistrationOptions bool]"}
+-}
+-
+-// from line 8361
+-func (t Or_ServerCapabilities_inlayHintProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case InlayHintOptions:
+- return json.Marshal(x)
+- case InlayHintRegistrationOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [InlayHintOptions InlayHintRegistrationOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_inlayHintProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 InlayHintOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 InlayHintRegistrationOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- var h2 bool
+- if err := json.Unmarshal(x, &h2); err == nil {
+- t.Value = h2
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [InlayHintOptions InlayHintRegistrationOptions bool]"}
+-}
+-
+-// from line 8338
+-func (t Or_ServerCapabilities_inlineValueProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case InlineValueOptions:
+- return json.Marshal(x)
+- case InlineValueRegistrationOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [InlineValueOptions InlineValueRegistrationOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_inlineValueProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 InlineValueOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 InlineValueRegistrationOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- var h2 bool
+- if err := json.Unmarshal(x, &h2); err == nil {
+- t.Value = h2
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [InlineValueOptions InlineValueRegistrationOptions bool]"}
+-}
+-
+-// from line 8250
+-func (t Or_ServerCapabilities_linkedEditingRangeProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case LinkedEditingRangeOptions:
+- return json.Marshal(x)
+- case LinkedEditingRangeRegistrationOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_linkedEditingRangeProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 LinkedEditingRangeOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 LinkedEditingRangeRegistrationOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- var h2 bool
+- if err := json.Unmarshal(x, &h2); err == nil {
+- t.Value = h2
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions bool]"}
+-}
+-
+-// from line 8292
+-func (t Or_ServerCapabilities_monikerProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case MonikerOptions:
+- return json.Marshal(x)
+- case MonikerRegistrationOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [MonikerOptions MonikerRegistrationOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_monikerProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 MonikerOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 MonikerRegistrationOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- var h2 bool
+- if err := json.Unmarshal(x, &h2); err == nil {
+- t.Value = h2
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [MonikerOptions MonikerRegistrationOptions bool]"}
+-}
+-
+-// from line 7842
+-func (t Or_ServerCapabilities_notebookDocumentSync) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case NotebookDocumentSyncOptions:
+- return json.Marshal(x)
+- case NotebookDocumentSyncRegistrationOptions:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [NotebookDocumentSyncOptions NotebookDocumentSyncRegistrationOptions]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_notebookDocumentSync) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 NotebookDocumentSyncOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 NotebookDocumentSyncRegistrationOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [NotebookDocumentSyncOptions NotebookDocumentSyncRegistrationOptions]"}
+-}
+-
+-// from line 7981
+-func (t Or_ServerCapabilities_referencesProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case ReferenceOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [ReferenceOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_referencesProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 ReferenceOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 bool
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [ReferenceOptions bool]"}
+-}
+-
+-// from line 8156
+-func (t Or_ServerCapabilities_renameProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case RenameOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [RenameOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_renameProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 RenameOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 bool
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [RenameOptions bool]"}
+-}
+-
+-// from line 8196
+-func (t Or_ServerCapabilities_selectionRangeProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case SelectionRangeOptions:
+- return json.Marshal(x)
+- case SelectionRangeRegistrationOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [SelectionRangeOptions SelectionRangeRegistrationOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_selectionRangeProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 SelectionRangeOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 SelectionRangeRegistrationOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- var h2 bool
+- if err := json.Unmarshal(x, &h2); err == nil {
+- t.Value = h2
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [SelectionRangeOptions SelectionRangeRegistrationOptions bool]"}
+-}
+-
+-// from line 8273
+-func (t Or_ServerCapabilities_semanticTokensProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case SemanticTokensOptions:
+- return json.Marshal(x)
+- case SemanticTokensRegistrationOptions:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [SemanticTokensOptions SemanticTokensRegistrationOptions]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_semanticTokensProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 SemanticTokensOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 SemanticTokensRegistrationOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [SemanticTokensOptions SemanticTokensRegistrationOptions]"}
+-}
+-
+-// from line 7824
+-func (t Or_ServerCapabilities_textDocumentSync) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case TextDocumentSyncKind:
+- return json.Marshal(x)
+- case TextDocumentSyncOptions:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [TextDocumentSyncKind TextDocumentSyncOptions]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_textDocumentSync) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 TextDocumentSyncKind
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 TextDocumentSyncOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [TextDocumentSyncKind TextDocumentSyncOptions]"}
+-}
+-
+-// from line 7937
+-func (t Or_ServerCapabilities_typeDefinitionProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case TypeDefinitionOptions:
+- return json.Marshal(x)
+- case TypeDefinitionRegistrationOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [TypeDefinitionOptions TypeDefinitionRegistrationOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_typeDefinitionProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 TypeDefinitionOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 TypeDefinitionRegistrationOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- var h2 bool
+- if err := json.Unmarshal(x, &h2); err == nil {
+- t.Value = h2
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [TypeDefinitionOptions TypeDefinitionRegistrationOptions bool]"}
+-}
+-
+-// from line 8315
+-func (t Or_ServerCapabilities_typeHierarchyProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case TypeHierarchyOptions:
+- return json.Marshal(x)
+- case TypeHierarchyRegistrationOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [TypeHierarchyOptions TypeHierarchyRegistrationOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_typeHierarchyProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 TypeHierarchyOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 TypeHierarchyRegistrationOptions
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- var h2 bool
+- if err := json.Unmarshal(x, &h2); err == nil {
+- t.Value = h2
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [TypeHierarchyOptions TypeHierarchyRegistrationOptions bool]"}
+-}
+-
+-// from line 8093
+-func (t Or_ServerCapabilities_workspaceSymbolProvider) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case WorkspaceSymbolOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [WorkspaceSymbolOptions bool]", t)
+-}
+-
+-func (t *Or_ServerCapabilities_workspaceSymbolProvider) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 WorkspaceSymbolOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 bool
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [WorkspaceSymbolOptions bool]"}
+-}
+-
+-// from line 8841
+-func (t Or_SignatureInformation_documentation) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case MarkupContent:
+- return json.Marshal(x)
+- case string:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [MarkupContent string]", t)
+-}
+-
+-func (t *Or_SignatureInformation_documentation) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 MarkupContent
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 string
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [MarkupContent string]"}
+-}
+-
+-// from line 6692
+-func (t Or_TextDocumentEdit_edits_Elem) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case AnnotatedTextEdit:
+- return json.Marshal(x)
+- case TextEdit:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [AnnotatedTextEdit TextEdit]", t)
+-}
+-
+-func (t *Or_TextDocumentEdit_edits_Elem) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 AnnotatedTextEdit
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 TextEdit
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [AnnotatedTextEdit TextEdit]"}
+-}
+-
+-// from line 9777
+-func (t Or_TextDocumentSyncOptions_save) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case SaveOptions:
+- return json.Marshal(x)
+- case bool:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [SaveOptions bool]", t)
+-}
+-
+-func (t *Or_TextDocumentSyncOptions_save) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 SaveOptions
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 bool
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [SaveOptions bool]"}
+-}
+-
+-// from line 13986
+-func (t Or_WorkspaceDocumentDiagnosticReport) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case WorkspaceFullDocumentDiagnosticReport:
+- return json.Marshal(x)
+- case WorkspaceUnchangedDocumentDiagnosticReport:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [WorkspaceFullDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport]", t)
+-}
+-
+-func (t *Or_WorkspaceDocumentDiagnosticReport) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 WorkspaceFullDocumentDiagnosticReport
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 WorkspaceUnchangedDocumentDiagnosticReport
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [WorkspaceFullDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport]"}
+-}
+-
+-// from line 3219
+-func (t Or_WorkspaceEdit_documentChanges_Elem) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case CreateFile:
+- return json.Marshal(x)
+- case DeleteFile:
+- return json.Marshal(x)
+- case RenameFile:
+- return json.Marshal(x)
+- case TextDocumentEdit:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [CreateFile DeleteFile RenameFile TextDocumentEdit]", t)
+-}
+-
+-func (t *Or_WorkspaceEdit_documentChanges_Elem) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 CreateFile
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 DeleteFile
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- var h2 RenameFile
+- if err := json.Unmarshal(x, &h2); err == nil {
+- t.Value = h2
+- return nil
+- }
+- var h3 TextDocumentEdit
+- if err := json.Unmarshal(x, &h3); err == nil {
+- t.Value = h3
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [CreateFile DeleteFile RenameFile TextDocumentEdit]"}
+-}
+-
+-// from line 248
+-func (t Or_textDocument_declaration) MarshalJSON() ([]byte, error) {
+- switch x := t.Value.(type) {
+- case Declaration:
+- return json.Marshal(x)
+- case []DeclarationLink:
+- return json.Marshal(x)
+- case nil:
+- return []byte("null"), nil
+- }
+- return nil, fmt.Errorf("type %T not one of [Declaration []DeclarationLink]", t)
+-}
+-
+-func (t *Or_textDocument_declaration) UnmarshalJSON(x []byte) error {
+- if string(x) == "null" {
+- t.Value = nil
+- return nil
+- }
+- var h0 Declaration
+- if err := json.Unmarshal(x, &h0); err == nil {
+- t.Value = h0
+- return nil
+- }
+- var h1 []DeclarationLink
+- if err := json.Unmarshal(x, &h1); err == nil {
+- t.Value = h1
+- return nil
+- }
+- return &UnmarshalError{"unmarshal failed to match one of [Declaration []DeclarationLink]"}
+-}
+diff -urN a/gopls/internal/lsp/protocol/tsprotocol.go b/gopls/internal/lsp/protocol/tsprotocol.go
+--- a/gopls/internal/lsp/protocol/tsprotocol.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/tsprotocol.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,5450 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Code generated for LSP. DO NOT EDIT.
+-
+-package protocol
+-
+-// Code generated from protocol/metaModel.json at ref release/protocol/3.17.3-next.6 (hash 56c23c557e3568a9f56f42435fd5a80f9458957f).
+-// https://github.com/microsoft/vscode-languageserver-node/blob/release/protocol/3.17.3-next.6/protocol/metaModel.json
+-// LSP metaData.version = 3.17.0.
+-
+-import "encoding/json"
+-
+-// A special text edit with an additional change annotation.
+-//
+-// @since 3.16.0.
+-type AnnotatedTextEdit struct { // line 9372
+- // The actual identifier of the change annotation
+- AnnotationID ChangeAnnotationIdentifier `json:"annotationId"`
+- TextEdit
+-}
+-
+-// The parameters passed via a apply workspace edit request.
+-type ApplyWorkspaceEditParams struct { // line 5984
+- // An optional label of the workspace edit. This label is
+- // presented in the user interface for example on an undo
+- // stack to undo the workspace edit.
+- Label string `json:"label,omitempty"`
+- // The edits to apply.
+- Edit WorkspaceEdit `json:"edit"`
+-}
+-
+-// The result returned from the apply workspace edit request.
+-//
+-// @since 3.17 renamed from ApplyWorkspaceEditResponse
+-type ApplyWorkspaceEditResult struct { // line 6007
+- // Indicates whether the edit was applied or not.
+- Applied bool `json:"applied"`
+- // An optional textual description for why the edit was not applied.
+- // This may be used by the server for diagnostic logging or to provide
+- // a suitable error for a request that triggered the edit.
+- FailureReason string `json:"failureReason,omitempty"`
+- // Depending on the client's failure handling strategy `failedChange` might
+- // contain the index of the change that failed. This property is only available
+- // if the client signals a `failureHandlingStrategy` in its client capabilities.
+- FailedChange uint32 `json:"failedChange,omitempty"`
+-}
+-
+-// A base for all symbol information.
+-type BaseSymbolInformation struct { // line 8966
+- // The name of this symbol.
+- Name string `json:"name"`
+- // The kind of this symbol.
+- Kind SymbolKind `json:"kind"`
+- // Tags for this symbol.
+- //
+- // @since 3.16.0
+- Tags []SymbolTag `json:"tags,omitempty"`
+- // The name of the symbol containing this symbol. This information is for
+- // user interface purposes (e.g. to render a qualifier in the user interface
+- // if necessary). It can't be used to re-infer a hierarchy for the document
+- // symbols.
+- ContainerName string `json:"containerName,omitempty"`
+-}
+-
+-// @since 3.16.0
+-type CallHierarchyClientCapabilities struct { // line 12141
+- // Whether implementation supports dynamic registration. If this is set to `true`
+- // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
+- // return value for the corresponding server capability as well.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+-}
+-
+-// Represents an incoming call, e.g. a caller of a method or constructor.
+-//
+-// @since 3.16.0
+-type CallHierarchyIncomingCall struct { // line 2779
+- // The item that makes the call.
+- From CallHierarchyItem `json:"from"`
+- // The ranges at which the calls appear. This is relative to the caller
+- // denoted by {@link CallHierarchyIncomingCall.from `this.from`}.
+- FromRanges []Range `json:"fromRanges"`
+-}
+-
+-// The parameter of a `callHierarchy/incomingCalls` request.
+-//
+-// @since 3.16.0
+-type CallHierarchyIncomingCallsParams struct { // line 2755
+- Item CallHierarchyItem `json:"item"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// Represents programming constructs like functions or constructors in the context
+-// of call hierarchy.
+-//
+-// @since 3.16.0
+-type CallHierarchyItem struct { // line 2656
+- // The name of this item.
+- Name string `json:"name"`
+- // The kind of this item.
+- Kind SymbolKind `json:"kind"`
+- // Tags for this item.
+- Tags []SymbolTag `json:"tags,omitempty"`
+- // More detail for this item, e.g. the signature of a function.
+- Detail string `json:"detail,omitempty"`
+- // The resource identifier of this item.
+- URI DocumentURI `json:"uri"`
+- // The range enclosing this symbol not including leading/trailing whitespace but everything else, e.g. comments and code.
+- Range Range `json:"range"`
+- // The range that should be selected and revealed when this symbol is being picked, e.g. the name of a function.
+- // Must be contained by the {@link CallHierarchyItem.range `range`}.
+- SelectionRange Range `json:"selectionRange"`
+- // A data entry field that is preserved between a call hierarchy prepare and
+- // incoming calls or outgoing calls requests.
+- Data interface{} `json:"data,omitempty"`
+-}
+-
+-// Call hierarchy options used during static registration.
+-//
+-// @since 3.16.0
+-type CallHierarchyOptions struct { // line 6534
+- WorkDoneProgressOptions
+-}
+-
+-// Represents an outgoing call, e.g. calling a getter from a method or a method from a constructor etc.
+-//
+-// @since 3.16.0
+-type CallHierarchyOutgoingCall struct { // line 2829
+- // The item that is called.
+- To CallHierarchyItem `json:"to"`
+- // The range at which this item is called. This is the range relative to the caller, e.g the item
+- // passed to {@link CallHierarchyItemProvider.provideCallHierarchyOutgoingCalls `provideCallHierarchyOutgoingCalls`}
+- // and not {@link CallHierarchyOutgoingCall.to `this.to`}.
+- FromRanges []Range `json:"fromRanges"`
+-}
+-
+-// The parameter of a `callHierarchy/outgoingCalls` request.
+-//
+-// @since 3.16.0
+-type CallHierarchyOutgoingCallsParams struct { // line 2805
+- Item CallHierarchyItem `json:"item"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// The parameter of a `textDocument/prepareCallHierarchy` request.
+-//
+-// @since 3.16.0
+-type CallHierarchyPrepareParams struct { // line 2638
+- TextDocumentPositionParams
+- WorkDoneProgressParams
+-}
+-
+-// Call hierarchy options used during static or dynamic registration.
+-//
+-// @since 3.16.0
+-type CallHierarchyRegistrationOptions struct { // line 2733
+- TextDocumentRegistrationOptions
+- CallHierarchyOptions
+- StaticRegistrationOptions
+-}
+-type CancelParams struct { // line 6179
+- // The request id to cancel.
+- ID interface{} `json:"id"`
+-}
+-
+-// Additional information that describes document changes.
+-//
+-// @since 3.16.0
+-type ChangeAnnotation struct { // line 6831
+- // A human-readable string describing the actual change. The string
+- // is rendered prominent in the user interface.
+- Label string `json:"label"`
+- // A flag which indicates that user confirmation is needed
+- // before applying the change.
+- NeedsConfirmation bool `json:"needsConfirmation,omitempty"`
+- // A human-readable string which is rendered less prominent in
+- // the user interface.
+- Description string `json:"description,omitempty"`
+-}
+-
+-// An identifier to refer to a change annotation stored with a workspace edit.
+-type ChangeAnnotationIdentifier = string // (alias) line 13976
+-// Defines the capabilities provided by the client.
+-type ClientCapabilities struct { // line 9674
+- // Workspace specific client capabilities.
+- Workspace WorkspaceClientCapabilities `json:"workspace,omitempty"`
+- // Text document specific client capabilities.
+- TextDocument TextDocumentClientCapabilities `json:"textDocument,omitempty"`
+- // Capabilities specific to the notebook document support.
+- //
+- // @since 3.17.0
+- NotebookDocument *NotebookDocumentClientCapabilities `json:"notebookDocument,omitempty"`
+- // Window specific client capabilities.
+- Window WindowClientCapabilities `json:"window,omitempty"`
+- // General client capabilities.
+- //
+- // @since 3.16.0
+- General *GeneralClientCapabilities `json:"general,omitempty"`
+- // Experimental client capabilities.
+- Experimental interface{} `json:"experimental,omitempty"`
+-}
+-
+-// A code action represents a change that can be performed in code, e.g. to fix a problem or
+-// to refactor code.
+-//
+-// A CodeAction must set either `edit` and/or a `command`. If both are supplied, the `edit` is applied first, then the `command` is executed.
+-type CodeAction struct { // line 5382
+- // A short, human-readable, title for this code action.
+- Title string `json:"title"`
+- // The kind of the code action.
+- //
+- // Used to filter code actions.
+- Kind CodeActionKind `json:"kind,omitempty"`
+- // The diagnostics that this code action resolves.
+- Diagnostics []Diagnostic `json:"diagnostics,omitempty"`
+- // Marks this as a preferred action. Preferred actions are used by the `auto fix` command and can be targeted
+- // by keybindings.
+- //
+- // A quick fix should be marked preferred if it properly addresses the underlying error.
+- // A refactoring should be marked preferred if it is the most reasonable choice of actions to take.
+- //
+- // @since 3.15.0
+- IsPreferred bool `json:"isPreferred,omitempty"`
+- // Marks that the code action cannot currently be applied.
+- //
+- // Clients should follow the following guidelines regarding disabled code actions:
+- //
+- // - Disabled code actions are not shown in automatic [lightbulbs](https://code.visualstudio.com/docs/editor/editingevolved#_code-action)
+- // code action menus.
+- //
+- // - Disabled actions are shown as faded out in the code action menu when the user requests a more specific type
+- // of code action, such as refactorings.
+- //
+- // - If the user has a [keybinding](https://code.visualstudio.com/docs/editor/refactoring#_keybindings-for-code-actions)
+- // that auto applies a code action and only disabled code actions are returned, the client should show the user an
+- // error message with `reason` in the editor.
+- //
+- // @since 3.16.0
+- Disabled *PDisabledMsg_textDocument_codeAction `json:"disabled,omitempty"`
+- // The workspace edit this code action performs.
+- Edit *WorkspaceEdit `json:"edit,omitempty"`
+- // A command this code action executes. If a code action
+- // provides an edit and a command, first the edit is
+- // executed and then the command.
+- Command *Command `json:"command,omitempty"`
+- // A data entry field that is preserved on a code action between
+- // a `textDocument/codeAction` and a `codeAction/resolve` request.
+- //
+- // @since 3.16.0
+- Data interface{} `json:"data,omitempty"`
+-}
+-
+-// The Client Capabilities of a {@link CodeActionRequest}.
+-type CodeActionClientCapabilities struct { // line 11721
+- // Whether code action supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // The client support code action literals of type `CodeAction` as a valid
+- // response of the `textDocument/codeAction` request. If the property is not
+- // set the request can only return `Command` literals.
+- //
+- // @since 3.8.0
+- CodeActionLiteralSupport PCodeActionLiteralSupportPCodeAction `json:"codeActionLiteralSupport,omitempty"`
+- // Whether code action supports the `isPreferred` property.
+- //
+- // @since 3.15.0
+- IsPreferredSupport bool `json:"isPreferredSupport,omitempty"`
+- // Whether code action supports the `disabled` property.
+- //
+- // @since 3.16.0
+- DisabledSupport bool `json:"disabledSupport,omitempty"`
+- // Whether code action supports the `data` property which is
+- // preserved between a `textDocument/codeAction` and a
+- // `codeAction/resolve` request.
+- //
+- // @since 3.16.0
+- DataSupport bool `json:"dataSupport,omitempty"`
+- // Whether the client supports resolving additional code action
+- // properties via a separate `codeAction/resolve` request.
+- //
+- // @since 3.16.0
+- ResolveSupport *PResolveSupportPCodeAction `json:"resolveSupport,omitempty"`
+- // Whether the client honors the change annotations in
+- // text edits and resource operations returned via the
+- // `CodeAction#edit` property by for example presenting
+- // the workspace edit in the user interface and asking
+- // for confirmation.
+- //
+- // @since 3.16.0
+- HonorsChangeAnnotations bool `json:"honorsChangeAnnotations,omitempty"`
+-}
+-
+-// Contains additional diagnostic information about the context in which
+-// a {@link CodeActionProvider.provideCodeActions code action} is run.
+-type CodeActionContext struct { // line 9032
+- // An array of diagnostics known on the client side overlapping the range provided to the
+- // `textDocument/codeAction` request. They are provided so that the server knows which
+- // errors are currently presented to the user for the given range. There is no guarantee
+- // that these accurately reflect the error state of the resource. The primary parameter
+- // to compute code actions is the provided range.
+- Diagnostics []Diagnostic `json:"diagnostics"`
+- // Requested kind of actions to return.
+- //
+- // Actions not of this kind are filtered out by the client before being shown. So servers
+- // can omit computing them.
+- Only []CodeActionKind `json:"only,omitempty"`
+- // The reason why code actions were requested.
+- //
+- // @since 3.17.0
+- TriggerKind *CodeActionTriggerKind `json:"triggerKind,omitempty"`
+-}
+-
+-// A set of predefined code action kinds
+-type CodeActionKind string // line 13326
+-// Provider options for a {@link CodeActionRequest}.
+-type CodeActionOptions struct { // line 9071
+- // CodeActionKinds that this server may return.
+- //
+- // The list of kinds may be generic, such as `CodeActionKind.Refactor`, or the server
+- // may list out every specific kind they provide.
+- CodeActionKinds []CodeActionKind `json:"codeActionKinds,omitempty"`
+- // The server provides support to resolve additional
+- // information for a code action.
+- //
+- // @since 3.16.0
+- ResolveProvider bool `json:"resolveProvider,omitempty"`
+- WorkDoneProgressOptions
+-}
+-
+-// The parameters of a {@link CodeActionRequest}.
+-type CodeActionParams struct { // line 5308
+- // The document in which the command was invoked.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- // The range for which the command was invoked.
+- Range Range `json:"range"`
+- // Context carrying additional information.
+- Context CodeActionContext `json:"context"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// Registration options for a {@link CodeActionRequest}.
+-type CodeActionRegistrationOptions struct { // line 5476
+- TextDocumentRegistrationOptions
+- CodeActionOptions
+-}
+-
+-// The reason why code actions were requested.
+-//
+-// @since 3.17.0
+-type CodeActionTriggerKind uint32 // line 13606
+-// Structure to capture a description for an error code.
+-//
+-// @since 3.16.0
+-type CodeDescription struct { // line 10026
+- // An URI to open with more information about the diagnostic error.
+- Href URI `json:"href"`
+-}
+-
+-// A code lens represents a {@link Command command} that should be shown along with
+-// source text, like the number of references, a way to run tests, etc.
+-//
+-// A code lens is _unresolved_ when no command is associated to it. For performance
+-// reasons the creation of a code lens and resolving should be done in two stages.
+-type CodeLens struct { // line 5599
+- // The range in which this code lens is valid. Should only span a single line.
+- Range Range `json:"range"`
+- // The command this code lens represents.
+- Command *Command `json:"command,omitempty"`
+- // A data entry field that is preserved on a code lens item between
+- // a {@link CodeLensRequest} and a [CodeLensResolveRequest]
+- // (#CodeLensResolveRequest)
+- Data interface{} `json:"data,omitempty"`
+-}
+-
+-// The client capabilities of a {@link CodeLensRequest}.
+-type CodeLensClientCapabilities struct { // line 11835
+- // Whether code lens supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+-}
+-
+-// Code Lens provider options of a {@link CodeLensRequest}.
+-type CodeLensOptions struct { // line 9127
+- // Code lens has a resolve provider as well.
+- ResolveProvider bool `json:"resolveProvider,omitempty"`
+- WorkDoneProgressOptions
+-}
+-
+-// The parameters of a {@link CodeLensRequest}.
+-type CodeLensParams struct { // line 5575
+- // The document to request code lens for.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// Registration options for a {@link CodeLensRequest}.
+-type CodeLensRegistrationOptions struct { // line 5631
+- TextDocumentRegistrationOptions
+- CodeLensOptions
+-}
+-
+-// @since 3.16.0
+-type CodeLensWorkspaceClientCapabilities struct { // line 10993
+- // Whether the client implementation supports a refresh request sent from the
+- // server to the client.
+- //
+- // Note that this event is global and will force the client to refresh all
+- // code lenses currently shown. It should be used with absolute care and is
+- // useful for situation where a server for example detect a project wide
+- // change that requires such a calculation.
+- RefreshSupport bool `json:"refreshSupport,omitempty"`
+-}
+-
+-// Represents a color in RGBA space.
+-type Color struct { // line 6433
+- // The red component of this color in the range [0-1].
+- Red float64 `json:"red"`
+- // The green component of this color in the range [0-1].
+- Green float64 `json:"green"`
+- // The blue component of this color in the range [0-1].
+- Blue float64 `json:"blue"`
+- // The alpha component of this color in the range [0-1].
+- Alpha float64 `json:"alpha"`
+-}
+-
+-// Represents a color range from a document.
+-type ColorInformation struct { // line 2239
+- // The range in the document where this color appears.
+- Range Range `json:"range"`
+- // The actual color value for this color range.
+- Color Color `json:"color"`
+-}
+-type ColorPresentation struct { // line 2321
+- // The label of this color presentation. It will be shown on the color
+- // picker header. By default this is also the text that is inserted when selecting
+- // this color presentation.
+- Label string `json:"label"`
+- // An {@link TextEdit edit} which is applied to a document when selecting
+- // this presentation for the color. When `falsy` the {@link ColorPresentation.label label}
+- // is used.
+- TextEdit *TextEdit `json:"textEdit,omitempty"`
+- // An optional array of additional {@link TextEdit text edits} that are applied when
+- // selecting this color presentation. Edits must not overlap with the main {@link ColorPresentation.textEdit edit} nor with themselves.
+- AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"`
+-}
+-
+-// Parameters for a {@link ColorPresentationRequest}.
+-type ColorPresentationParams struct { // line 2281
+- // The text document.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- // The color to request presentations for.
+- Color Color `json:"color"`
+- // The range where the color would be inserted. Serves as a context.
+- Range Range `json:"range"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// Represents a reference to a command. Provides a title which
+-// will be used to represent a command in the UI and, optionally,
+-// an array of arguments which will be passed to the command handler
+-// function when invoked.
+-type Command struct { // line 5348
+- // Title of the command, like `save`.
+- Title string `json:"title"`
+- // The identifier of the actual command handler.
+- Command string `json:"command"`
+- // Arguments that the command handler should be
+- // invoked with.
+- Arguments []json.RawMessage `json:"arguments,omitempty"`
+-}
+-
+-// Completion client capabilities
+-type CompletionClientCapabilities struct { // line 11168
+- // Whether completion supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // The client supports the following `CompletionItem` specific
+- // capabilities.
+- CompletionItem PCompletionItemPCompletion `json:"completionItem,omitempty"`
+- CompletionItemKind *PCompletionItemKindPCompletion `json:"completionItemKind,omitempty"`
+- // Defines how the client handles whitespace and indentation
+- // when accepting a completion item that uses multi line
+- // text in either `insertText` or `textEdit`.
+- //
+- // @since 3.17.0
+- InsertTextMode InsertTextMode `json:"insertTextMode,omitempty"`
+- // The client supports to send additional context information for a
+- // `textDocument/completion` request.
+- ContextSupport bool `json:"contextSupport,omitempty"`
+- // The client supports the following `CompletionList` specific
+- // capabilities.
+- //
+- // @since 3.17.0
+- CompletionList *PCompletionListPCompletion `json:"completionList,omitempty"`
+-}
+-
+-// Contains additional information about the context in which a completion request is triggered.
+-type CompletionContext struct { // line 8628
+- // How the completion was triggered.
+- TriggerKind CompletionTriggerKind `json:"triggerKind"`
+- // The trigger character (a single character) that has trigger code complete.
+- // Is undefined if `triggerKind !== CompletionTriggerKind.TriggerCharacter`
+- TriggerCharacter string `json:"triggerCharacter,omitempty"`
+-}
+-
+-// A completion item represents a text snippet that is
+-// proposed to complete text that is being typed.
+-type CompletionItem struct { // line 4528
+- // The label of this completion item.
+- //
+- // The label property is also by default the text that
+- // is inserted when selecting this completion.
+- //
+- // If label details are provided the label itself should
+- // be an unqualified name of the completion item.
+- Label string `json:"label"`
+- // Additional details for the label
+- //
+- // @since 3.17.0
+- LabelDetails *CompletionItemLabelDetails `json:"labelDetails,omitempty"`
+- // The kind of this completion item. Based of the kind
+- // an icon is chosen by the editor.
+- Kind CompletionItemKind `json:"kind,omitempty"`
+- // Tags for this completion item.
+- //
+- // @since 3.15.0
+- Tags []CompletionItemTag `json:"tags,omitempty"`
+- // A human-readable string with additional information
+- // about this item, like type or symbol information.
+- Detail string `json:"detail,omitempty"`
+- // A human-readable string that represents a doc-comment.
+- Documentation *Or_CompletionItem_documentation `json:"documentation,omitempty"`
+- // Indicates if this item is deprecated.
+- // @deprecated Use `tags` instead.
+- Deprecated bool `json:"deprecated,omitempty"`
+- // Select this item when showing.
+- //
+- // *Note* that only one completion item can be selected and that the
+- // tool / client decides which item that is. The rule is that the *first*
+- // item of those that match best is selected.
+- Preselect bool `json:"preselect,omitempty"`
+- // A string that should be used when comparing this item
+- // with other items. When `falsy` the {@link CompletionItem.label label}
+- // is used.
+- SortText string `json:"sortText,omitempty"`
+- // A string that should be used when filtering a set of
+- // completion items. When `falsy` the {@link CompletionItem.label label}
+- // is used.
+- FilterText string `json:"filterText,omitempty"`
+- // A string that should be inserted into a document when selecting
+- // this completion. When `falsy` the {@link CompletionItem.label label}
+- // is used.
+- //
+- // The `insertText` is subject to interpretation by the client side.
+- // Some tools might not take the string literally. For example
+- // VS Code when code complete is requested in this example
+- // `con<cursor position>` and a completion item with an `insertText` of
+- // `console` is provided it will only insert `sole`. Therefore it is
+- // recommended to use `textEdit` instead since it avoids additional client
+- // side interpretation.
+- InsertText string `json:"insertText,omitempty"`
+- // The format of the insert text. The format applies to both the
+- // `insertText` property and the `newText` property of a provided
+- // `textEdit`. If omitted defaults to `InsertTextFormat.PlainText`.
+- //
+- // Please note that the insertTextFormat doesn't apply to
+- // `additionalTextEdits`.
+- InsertTextFormat *InsertTextFormat `json:"insertTextFormat,omitempty"`
+- // How whitespace and indentation is handled during completion
+- // item insertion. If not provided the clients default value depends on
+- // the `textDocument.completion.insertTextMode` client capability.
+- //
+- // @since 3.16.0
+- InsertTextMode *InsertTextMode `json:"insertTextMode,omitempty"`
+- // An {@link TextEdit edit} which is applied to a document when selecting
+- // this completion. When an edit is provided the value of
+- // {@link CompletionItem.insertText insertText} is ignored.
+- //
+- // Most editors support two different operations when accepting a completion
+- // item. One is to insert a completion text and the other is to replace an
+- // existing text with a completion text. Since this can usually not be
+- // predetermined by a server it can report both ranges. Clients need to
+- // signal support for `InsertReplaceEdits` via the
+- // `textDocument.completion.insertReplaceSupport` client capability
+- // property.
+- //
+- // *Note 1:* The text edit's range as well as both ranges from an insert
+- // replace edit must be a [single line] and they must contain the position
+- // at which completion has been requested.
+- // *Note 2:* If an `InsertReplaceEdit` is returned the edit's insert range
+- // must be a prefix of the edit's replace range, that means it must be
+- // contained and starting at the same position.
+- //
+- // @since 3.16.0 additional type `InsertReplaceEdit`
+- TextEdit *TextEdit `json:"textEdit,omitempty"`
+- // The edit text used if the completion item is part of a CompletionList and
+- // CompletionList defines an item default for the text edit range.
+- //
+- // Clients will only honor this property if they opt into completion list
+- // item defaults using the capability `completionList.itemDefaults`.
+- //
+- // If not provided and a list's default range is provided the label
+- // property is used as a text.
+- //
+- // @since 3.17.0
+- TextEditText string `json:"textEditText,omitempty"`
+- // An optional array of additional {@link TextEdit text edits} that are applied when
+- // selecting this completion. Edits must not overlap (including the same insert position)
+- // with the main {@link CompletionItem.textEdit edit} nor with themselves.
+- //
+- // Additional text edits should be used to change text unrelated to the current cursor position
+- // (for example adding an import statement at the top of the file if the completion item will
+- // insert an unqualified type).
+- AdditionalTextEdits []TextEdit `json:"additionalTextEdits,omitempty"`
+- // An optional set of characters that when pressed while this completion is active will accept it first and
+- // then type that character. *Note* that all commit characters should have `length=1` and that superfluous
+- // characters will be ignored.
+- CommitCharacters []string `json:"commitCharacters,omitempty"`
+- // An optional {@link Command command} that is executed *after* inserting this completion. *Note* that
+- // additional modifications to the current document should be described with the
+- // {@link CompletionItem.additionalTextEdits additionalTextEdits}-property.
+- Command *Command `json:"command,omitempty"`
+- // A data entry field that is preserved on a completion item between a
+- // {@link CompletionRequest} and a {@link CompletionResolveRequest}.
+- Data interface{} `json:"data,omitempty"`
+-}
+-
+-// The kind of a completion entry.
+-type CompletionItemKind uint32 // line 13134
+-// Additional details for a completion item label.
+-//
+-// @since 3.17.0
+-type CompletionItemLabelDetails struct { // line 8651
+- // An optional string which is rendered less prominently directly after {@link CompletionItem.label label},
+- // without any spacing. Should be used for function signatures and type annotations.
+- Detail string `json:"detail,omitempty"`
+- // An optional string which is rendered less prominently after {@link CompletionItem.detail}. Should be used
+- // for fully qualified names and file paths.
+- Description string `json:"description,omitempty"`
+-}
+-
+-// Completion item tags are extra annotations that tweak the rendering of a completion
+-// item.
+-//
+-// @since 3.15.0
+-type CompletionItemTag uint32 // line 13244
+-// Represents a collection of {@link CompletionItem completion items} to be presented
+-// in the editor.
+-type CompletionList struct { // line 4737
+- // This list it not complete. Further typing results in recomputing this list.
+- //
+- // Recomputed lists have all their items replaced (not appended) in the
+- // incomplete completion sessions.
+- IsIncomplete bool `json:"isIncomplete"`
+- // In many cases the items of an actual completion result share the same
+- // value for properties like `commitCharacters` or the range of a text
+- // edit. A completion list can therefore define item defaults which will
+- // be used if a completion item itself doesn't specify the value.
+- //
+- // If a completion list specifies a default value and a completion item
+- // also specifies a corresponding value the one from the item is used.
+- //
+- // Servers are only allowed to return default values if the client
+- // signals support for this via the `completionList.itemDefaults`
+- // capability.
+- //
+- // @since 3.17.0
+- ItemDefaults *PItemDefaultsMsg_textDocument_completion `json:"itemDefaults,omitempty"`
+- // The completion items.
+- Items []CompletionItem `json:"items"`
+-}
+-
+-// Completion options.
+-type CompletionOptions struct { // line 8707
+- // Most tools trigger completion request automatically without explicitly requesting
+- // it using a keyboard shortcut (e.g. Ctrl+Space). Typically they do so when the user
+- // starts to type an identifier. For example if the user types `c` in a JavaScript file
+- // code complete will automatically pop up present `console` besides others as a
+- // completion item. Characters that make up identifiers don't need to be listed here.
+- //
+- // If code complete should automatically be trigger on characters not being valid inside
+- // an identifier (for example `.` in JavaScript) list them in `triggerCharacters`.
+- TriggerCharacters []string `json:"triggerCharacters,omitempty"`
+- // The list of all possible characters that commit a completion. This field can be used
+- // if clients don't support individual commit characters per completion item. See
+- // `ClientCapabilities.textDocument.completion.completionItem.commitCharactersSupport`
+- //
+- // If a server provides both `allCommitCharacters` and commit characters on an individual
+- // completion item the ones on the completion item win.
+- //
+- // @since 3.2.0
+- AllCommitCharacters []string `json:"allCommitCharacters,omitempty"`
+- // The server provides support to resolve additional
+- // information for a completion item.
+- ResolveProvider bool `json:"resolveProvider,omitempty"`
+- // The server supports the following `CompletionItem` specific
+- // capabilities.
+- //
+- // @since 3.17.0
+- CompletionItem *PCompletionItemPCompletionProvider `json:"completionItem,omitempty"`
+- WorkDoneProgressOptions
+-}
+-
+-// Completion parameters
+-type CompletionParams struct { // line 4497
+- // The completion context. This is only available it the client specifies
+- // to send this using the client capability `textDocument.completion.contextSupport === true`
+- Context CompletionContext `json:"context,omitempty"`
+- TextDocumentPositionParams
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// Registration options for a {@link CompletionRequest}.
+-type CompletionRegistrationOptions struct { // line 4854
+- TextDocumentRegistrationOptions
+- CompletionOptions
+-}
+-
+-// How a completion was triggered
+-type CompletionTriggerKind uint32 // line 13555
+-type ConfigurationItem struct { // line 6396
+- // The scope to get the configuration section for.
+- ScopeURI string `json:"scopeUri,omitempty"`
+- // The configuration section asked for.
+- Section string `json:"section,omitempty"`
+-}
+-
+-// The parameters of a configuration request.
+-type ConfigurationParams struct { // line 2199
+- Items []ConfigurationItem `json:"items"`
+-}
+-
+-// Create file operation.
+-type CreateFile struct { // line 6712
+- // A create
+- Kind string `json:"kind"`
+- // The resource to create.
+- URI DocumentURI `json:"uri"`
+- // Additional options
+- Options *CreateFileOptions `json:"options,omitempty"`
+- ResourceOperation
+-}
+-
+-// Options to create a file.
+-type CreateFileOptions struct { // line 9417
+- // Overwrite existing file. Overwrite wins over `ignoreIfExists`
+- Overwrite bool `json:"overwrite,omitempty"`
+- // Ignore if exists.
+- IgnoreIfExists bool `json:"ignoreIfExists,omitempty"`
+-}
+-
+-// The parameters sent in notifications/requests for user-initiated creation of
+-// files.
+-//
+-// @since 3.16.0
+-type CreateFilesParams struct { // line 3175
+- // An array of all files/folders created in this operation.
+- Files []FileCreate `json:"files"`
+-}
+-
+-// The declaration of a symbol representation as one or many {@link Location locations}.
+-type Declaration = []Location // (alias) line 13833
+-// @since 3.14.0
+-type DeclarationClientCapabilities struct { // line 11509
+- // Whether declaration supports dynamic registration. If this is set to `true`
+- // the client supports the new `DeclarationRegistrationOptions` return value
+- // for the corresponding server capability as well.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // The client supports additional metadata in the form of declaration links.
+- LinkSupport bool `json:"linkSupport,omitempty"`
+-}
+-
+-// Information about where a symbol is declared.
+-//
+-// Provides additional metadata over normal {@link Location location} declarations, including the range of
+-// the declaring symbol.
+-//
+-// Servers should prefer returning `DeclarationLink` over `Declaration` if supported
+-// by the client.
+-type DeclarationLink = LocationLink // (alias) line 13853
+-type DeclarationOptions struct { // line 6491
+- WorkDoneProgressOptions
+-}
+-type DeclarationParams struct { // line 2494
+- TextDocumentPositionParams
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-type DeclarationRegistrationOptions struct { // line 2514
+- DeclarationOptions
+- TextDocumentRegistrationOptions
+- StaticRegistrationOptions
+-}
+-
+-// The definition of a symbol represented as one or many {@link Location locations}.
+-// For most programming languages there is only one location at which a symbol is
+-// defined.
+-//
+-// Servers should prefer returning `DefinitionLink` over `Definition` if supported
+-// by the client.
+-type Definition = Or_Definition // (alias) line 13751
+-// Client Capabilities for a {@link DefinitionRequest}.
+-type DefinitionClientCapabilities struct { // line 11534
+- // Whether definition supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // The client supports additional metadata in the form of definition links.
+- //
+- // @since 3.14.0
+- LinkSupport bool `json:"linkSupport,omitempty"`
+-}
+-
+-// Information about where a symbol is defined.
+-//
+-// Provides additional metadata over normal {@link Location location} definitions, including the range of
+-// the defining symbol
+-type DefinitionLink = LocationLink // (alias) line 13771
+-// Server Capabilities for a {@link DefinitionRequest}.
+-type DefinitionOptions struct { // line 8919
+- WorkDoneProgressOptions
+-}
+-
+-// Parameters for a {@link DefinitionRequest}.
+-type DefinitionParams struct { // line 5018
+- TextDocumentPositionParams
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// Registration options for a {@link DefinitionRequest}.
+-type DefinitionRegistrationOptions struct { // line 5039
+- TextDocumentRegistrationOptions
+- DefinitionOptions
+-}
+-
+-// Delete file operation
+-type DeleteFile struct { // line 6794
+- // A delete
+- Kind string `json:"kind"`
+- // The file to delete.
+- URI DocumentURI `json:"uri"`
+- // Delete options.
+- Options *DeleteFileOptions `json:"options,omitempty"`
+- ResourceOperation
+-}
+-
+-// Delete file options
+-type DeleteFileOptions struct { // line 9465
+- // Delete the content recursively if a folder is denoted.
+- Recursive bool `json:"recursive,omitempty"`
+- // Ignore the operation if the file doesn't exist.
+- IgnoreIfNotExists bool `json:"ignoreIfNotExists,omitempty"`
+-}
+-
+-// The parameters sent in notifications/requests for user-initiated deletes of
+-// files.
+-//
+-// @since 3.16.0
+-type DeleteFilesParams struct { // line 3300
+- // An array of all files/folders deleted in this operation.
+- Files []FileDelete `json:"files"`
+-}
+-
+-// Represents a diagnostic, such as a compiler error or warning. Diagnostic objects
+-// are only valid in the scope of a resource.
+-type Diagnostic struct { // line 8525
+- // The range at which the message applies
+- Range Range `json:"range"`
+- // The diagnostic's severity. Can be omitted. If omitted it is up to the
+- // client to interpret diagnostics as error, warning, info or hint.
+- Severity DiagnosticSeverity `json:"severity,omitempty"`
+- // The diagnostic's code, which usually appear in the user interface.
+- Code interface{} `json:"code,omitempty"`
+- // An optional property to describe the error code.
+- // Requires the code field (above) to be present/not null.
+- //
+- // @since 3.16.0
+- CodeDescription *CodeDescription `json:"codeDescription,omitempty"`
+- // A human-readable string describing the source of this
+- // diagnostic, e.g. 'typescript' or 'super lint'. It usually
+- // appears in the user interface.
+- Source string `json:"source,omitempty"`
+- // The diagnostic's message. It usually appears in the user interface
+- Message string `json:"message"`
+- // Additional metadata about the diagnostic.
+- //
+- // @since 3.15.0
+- Tags []DiagnosticTag `json:"tags,omitempty"`
+- // An array of related diagnostic information, e.g. when symbol-names within
+- // a scope collide all definitions can be marked via this property.
+- RelatedInformation []DiagnosticRelatedInformation `json:"relatedInformation,omitempty"`
+- // A data entry field that is preserved between a `textDocument/publishDiagnostics`
+- // notification and `textDocument/codeAction` request.
+- //
+- // @since 3.16.0
+- Data interface{} `json:"data,omitempty"`
+-}
+-
+-// Client capabilities specific to diagnostic pull requests.
+-//
+-// @since 3.17.0
+-type DiagnosticClientCapabilities struct { // line 12408
+- // Whether implementation supports dynamic registration. If this is set to `true`
+- // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
+- // return value for the corresponding server capability as well.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // Whether the clients supports related documents for document diagnostic pulls.
+- RelatedDocumentSupport bool `json:"relatedDocumentSupport,omitempty"`
+-}
+-
+-// Diagnostic options.
+-//
+-// @since 3.17.0
+-type DiagnosticOptions struct { // line 7293
+- // An optional identifier under which the diagnostics are
+- // managed by the client.
+- Identifier string `json:"identifier,omitempty"`
+- // Whether the language has inter file dependencies meaning that
+- // editing code in one file can result in a different diagnostic
+- // set in another file. Inter file dependencies are common for
+- // most programming languages and typically uncommon for linters.
+- InterFileDependencies bool `json:"interFileDependencies"`
+- // The server provides support for workspace diagnostics as well.
+- WorkspaceDiagnostics bool `json:"workspaceDiagnostics"`
+- WorkDoneProgressOptions
+-}
+-
+-// Diagnostic registration options.
+-//
+-// @since 3.17.0
+-type DiagnosticRegistrationOptions struct { // line 3855
+- TextDocumentRegistrationOptions
+- DiagnosticOptions
+- StaticRegistrationOptions
+-}
+-
+-// Represents a related message and source code location for a diagnostic. This should be
+-// used to point to code locations that cause or related to a diagnostics, e.g when duplicating
+-// a symbol in a scope.
+-type DiagnosticRelatedInformation struct { // line 10041
+- // The location of this related diagnostic information.
+- Location Location `json:"location"`
+- // The message of this related diagnostic information.
+- Message string `json:"message"`
+-}
+-
+-// Cancellation data returned from a diagnostic request.
+-//
+-// @since 3.17.0
+-type DiagnosticServerCancellationData struct { // line 3841
+- RetriggerRequest bool `json:"retriggerRequest"`
+-}
+-
+-// The diagnostic's severity.
+-type DiagnosticSeverity uint32 // line 13504
+-// The diagnostic tags.
+-//
+-// @since 3.15.0
+-type DiagnosticTag uint32 // line 13534
+-// Workspace client capabilities specific to diagnostic pull requests.
+-//
+-// @since 3.17.0
+-type DiagnosticWorkspaceClientCapabilities struct { // line 11111
+- // Whether the client implementation supports a refresh request sent from
+- // the server to the client.
+- //
+- // Note that this event is global and will force the client to refresh all
+- // pulled diagnostics currently shown. It should be used with absolute care and
+- // is useful for situation where a server for example detects a project wide
+- // change that requires such a calculation.
+- RefreshSupport bool `json:"refreshSupport,omitempty"`
+-}
+-type DidChangeConfigurationClientCapabilities struct { // line 10837
+- // Did change configuration notification supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+-}
+-
+-// The parameters of a change configuration notification.
+-type DidChangeConfigurationParams struct { // line 4144
+- // The actual changed settings
+- Settings interface{} `json:"settings"`
+-}
+-type DidChangeConfigurationRegistrationOptions struct { // line 4158
+- Section *OrPSection_workspace_didChangeConfiguration `json:"section,omitempty"`
+-}
+-
+-// The params sent in a change notebook document notification.
+-//
+-// @since 3.17.0
+-type DidChangeNotebookDocumentParams struct { // line 3974
+- // The notebook document that did change. The version number points
+- // to the version after all provided changes have been applied. If
+- // only the text document content of a cell changes the notebook version
+- // doesn't necessarily have to change.
+- NotebookDocument VersionedNotebookDocumentIdentifier `json:"notebookDocument"`
+- // The actual changes to the notebook document.
+- //
+- // The changes describe single state changes to the notebook document.
+- // So if there are two changes c1 (at array index 0) and c2 (at array
+- // index 1) for a notebook in state S then c1 moves the notebook from
+- // S to S' and c2 from S' to S''. So c1 is computed on the state S and
+- // c2 is computed on the state S'.
+- //
+- // To mirror the content of a notebook using change events use the following approach:
+- //
+- // - start with the same initial content
+- // - apply the 'notebookDocument/didChange' notifications in the order you receive them.
+- // - apply the `NotebookChangeEvent`s in a single notification in the order
+- // you receive them.
+- Change NotebookDocumentChangeEvent `json:"change"`
+-}
+-
+-// The change text document notification's parameters.
+-type DidChangeTextDocumentParams struct { // line 4287
+- // The document that did change. The version number points
+- // to the version after all provided content changes have
+- // been applied.
+- TextDocument VersionedTextDocumentIdentifier `json:"textDocument"`
+- // The actual content changes. The content changes describe single state changes
+- // to the document. So if there are two content changes c1 (at array index 0) and
+- // c2 (at array index 1) for a document in state S then c1 moves the document from
+- // S to S' and c2 from S' to S''. So c1 is computed on the state S and c2 is computed
+- // on the state S'.
+- //
+- // To mirror the content of a document using change events use the following approach:
+- //
+- // - start with the same initial content
+- // - apply the 'textDocument/didChange' notifications in the order you receive them.
+- // - apply the `TextDocumentContentChangeEvent`s in a single notification in the order
+- // you receive them.
+- ContentChanges []TextDocumentContentChangeEvent `json:"contentChanges"`
+-}
+-type DidChangeWatchedFilesClientCapabilities struct { // line 10851
+- // Did change watched files notification supports dynamic registration. Please note
+- // that the current protocol doesn't support static configuration for file changes
+- // from the server side.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // Whether the client has support for {@link RelativePattern relative pattern}
+- // or not.
+- //
+- // @since 3.17.0
+- RelativePatternSupport bool `json:"relativePatternSupport,omitempty"`
+-}
+-
+-// The watched files change notification's parameters.
+-type DidChangeWatchedFilesParams struct { // line 4428
+- // The actual file events.
+- Changes []FileEvent `json:"changes"`
+-}
+-
+-// Describe options to be used when registered for text document change events.
+-type DidChangeWatchedFilesRegistrationOptions struct { // line 4445
+- // The watchers to register.
+- Watchers []FileSystemWatcher `json:"watchers"`
+-}
+-
+-// The parameters of a `workspace/didChangeWorkspaceFolders` notification.
+-type DidChangeWorkspaceFoldersParams struct { // line 2185
+- // The actual workspace folder change event.
+- Event WorkspaceFoldersChangeEvent `json:"event"`
+-}
+-
+-// The params sent in a close notebook document notification.
+-//
+-// @since 3.17.0
+-type DidCloseNotebookDocumentParams struct { // line 4012
+- // The notebook document that got closed.
+- NotebookDocument NotebookDocumentIdentifier `json:"notebookDocument"`
+- // The text documents that represent the content
+- // of a notebook cell that got closed.
+- CellTextDocuments []TextDocumentIdentifier `json:"cellTextDocuments"`
+-}
+-
+-// The parameters sent in a close text document notification
+-type DidCloseTextDocumentParams struct { // line 4332
+- // The document that was closed.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+-}
+-
+-// The params sent in an open notebook document notification.
+-//
+-// @since 3.17.0
+-type DidOpenNotebookDocumentParams struct { // line 3948
+- // The notebook document that got opened.
+- NotebookDocument NotebookDocument `json:"notebookDocument"`
+- // The text documents that represent the content
+- // of a notebook cell.
+- CellTextDocuments []TextDocumentItem `json:"cellTextDocuments"`
+-}
+-
+-// The parameters sent in an open text document notification
+-type DidOpenTextDocumentParams struct { // line 4273
+- // The document that was opened.
+- TextDocument TextDocumentItem `json:"textDocument"`
+-}
+-
+-// The params sent in a save notebook document notification.
+-//
+-// @since 3.17.0
+-type DidSaveNotebookDocumentParams struct { // line 3997
+- // The notebook document that got saved.
+- NotebookDocument NotebookDocumentIdentifier `json:"notebookDocument"`
+-}
+-
+-// The parameters sent in a save text document notification
+-type DidSaveTextDocumentParams struct { // line 4346
+- // The document that was saved.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- // Optional the content when saved. Depends on the includeText value
+- // when the save notification was requested.
+- Text *string `json:"text,omitempty"`
+-}
+-type DocumentColorClientCapabilities struct { // line 11875
+- // Whether implementation supports dynamic registration. If this is set to `true`
+- // the client supports the new `DocumentColorRegistrationOptions` return value
+- // for the corresponding server capability as well.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+-}
+-type DocumentColorOptions struct { // line 6471
+- WorkDoneProgressOptions
+-}
+-
+-// Parameters for a {@link DocumentColorRequest}.
+-type DocumentColorParams struct { // line 2215
+- // The text document.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-type DocumentColorRegistrationOptions struct { // line 2261
+- TextDocumentRegistrationOptions
+- DocumentColorOptions
+- StaticRegistrationOptions
+-}
+-
+-// Parameters of the document diagnostic request.
+-//
+-// @since 3.17.0
+-type DocumentDiagnosticParams struct { // line 3768
+- // The text document.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- // The additional identifier provided during registration.
+- Identifier string `json:"identifier,omitempty"`
+- // The result id of a previous response if provided.
+- PreviousResultID string `json:"previousResultId,omitempty"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-type DocumentDiagnosticReport = Or_DocumentDiagnosticReport // (alias) line 13909
+-// The document diagnostic report kinds.
+-//
+-// @since 3.17.0
+-type DocumentDiagnosticReportKind string // line 12722
+-// A partial result for a document diagnostic report.
+-//
+-// @since 3.17.0
+-type DocumentDiagnosticReportPartialResult struct { // line 3811
+- RelatedDocuments map[DocumentURI]interface{} `json:"relatedDocuments"`
+-}
+-
+-// A document filter describes a top level text document or
+-// a notebook cell document.
+-//
+-// @since 3.17.0 - proposed support for NotebookCellTextDocumentFilter.
+-type DocumentFilter = Or_DocumentFilter // (alias) line 14093
+-// Client capabilities of a {@link DocumentFormattingRequest}.
+-type DocumentFormattingClientCapabilities struct { // line 11889
+- // Whether formatting supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+-}
+-
+-// Provider options for a {@link DocumentFormattingRequest}.
+-type DocumentFormattingOptions struct { // line 9221
+- WorkDoneProgressOptions
+-}
+-
+-// The parameters of a {@link DocumentFormattingRequest}.
+-type DocumentFormattingParams struct { // line 5727
+- // The document to format.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- // The format options.
+- Options FormattingOptions `json:"options"`
+- WorkDoneProgressParams
+-}
+-
+-// Registration options for a {@link DocumentFormattingRequest}.
+-type DocumentFormattingRegistrationOptions struct { // line 5755
+- TextDocumentRegistrationOptions
+- DocumentFormattingOptions
+-}
+-
+-// A document highlight is a range inside a text document which deserves
+-// special attention. Usually a document highlight is visualized by changing
+-// the background color of its range.
+-type DocumentHighlight struct { // line 5119
+- // The range this highlight applies to.
+- Range Range `json:"range"`
+- // The highlight kind, default is {@link DocumentHighlightKind.Text text}.
+- Kind DocumentHighlightKind `json:"kind,omitempty"`
+-}
+-
+-// Client Capabilities for a {@link DocumentHighlightRequest}.
+-type DocumentHighlightClientCapabilities struct { // line 11624
+- // Whether document highlight supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+-}
+-
+-// A document highlight kind.
+-type DocumentHighlightKind uint32 // line 13301
+-// Provider options for a {@link DocumentHighlightRequest}.
+-type DocumentHighlightOptions struct { // line 8955
+- WorkDoneProgressOptions
+-}
+-
+-// Parameters for a {@link DocumentHighlightRequest}.
+-type DocumentHighlightParams struct { // line 5098
+- TextDocumentPositionParams
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// Registration options for a {@link DocumentHighlightRequest}.
+-type DocumentHighlightRegistrationOptions struct { // line 5142
+- TextDocumentRegistrationOptions
+- DocumentHighlightOptions
+-}
+-
+-// A document link is a range in a text document that links to an internal or external resource, like another
+-// text document or a web site.
+-type DocumentLink struct { // line 5670
+- // The range this link applies to.
+- Range Range `json:"range"`
+- // The uri this link points to. If missing a resolve request is sent later.
+- Target string `json:"target,omitempty"`
+- // The tooltip text when you hover over this link.
+- //
+- // If a tooltip is provided, is will be displayed in a string that includes instructions on how to
+- // trigger the link, such as `{0} (ctrl + click)`. The specific instructions vary depending on OS,
+- // user settings, and localization.
+- //
+- // @since 3.15.0
+- Tooltip string `json:"tooltip,omitempty"`
+- // A data entry field that is preserved on a document link between a
+- // DocumentLinkRequest and a DocumentLinkResolveRequest.
+- Data interface{} `json:"data,omitempty"`
+-}
+-
+-// The client capabilities of a {@link DocumentLinkRequest}.
+-type DocumentLinkClientCapabilities struct { // line 11850
+- // Whether document link supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // Whether the client supports the `tooltip` property on `DocumentLink`.
+- //
+- // @since 3.15.0
+- TooltipSupport bool `json:"tooltipSupport,omitempty"`
+-}
+-
+-// Provider options for a {@link DocumentLinkRequest}.
+-type DocumentLinkOptions struct { // line 9148
+- // Document links have a resolve provider as well.
+- ResolveProvider bool `json:"resolveProvider,omitempty"`
+- WorkDoneProgressOptions
+-}
+-
+-// The parameters of a {@link DocumentLinkRequest}.
+-type DocumentLinkParams struct { // line 5646
+- // The document to provide document links for.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// Registration options for a {@link DocumentLinkRequest}.
+-type DocumentLinkRegistrationOptions struct { // line 5712
+- TextDocumentRegistrationOptions
+- DocumentLinkOptions
+-}
+-
+-// Client capabilities of a {@link DocumentOnTypeFormattingRequest}.
+-type DocumentOnTypeFormattingClientCapabilities struct { // line 11919
+- // Whether on type formatting supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+-}
+-
+-// Provider options for a {@link DocumentOnTypeFormattingRequest}.
+-type DocumentOnTypeFormattingOptions struct { // line 9243
+- // A character on which formatting should be triggered, like `{`.
+- FirstTriggerCharacter string `json:"firstTriggerCharacter"`
+- // More trigger characters.
+- MoreTriggerCharacter []string `json:"moreTriggerCharacter,omitempty"`
+-}
+-
+-// The parameters of a {@link DocumentOnTypeFormattingRequest}.
+-type DocumentOnTypeFormattingParams struct { // line 5821
+- // The document to format.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- // The position around which the on type formatting should happen.
+- // This is not necessarily the exact position where the character denoted
+- // by the property `ch` got typed.
+- Position Position `json:"position"`
+- // The character that has been typed that triggered the formatting
+- // on type request. That is not necessarily the last character that
+- // got inserted into the document since the client could auto insert
+- // characters as well (e.g. like automatic brace completion).
+- Ch string `json:"ch"`
+- // The formatting options.
+- Options FormattingOptions `json:"options"`
+-}
+-
+-// Registration options for a {@link DocumentOnTypeFormattingRequest}.
+-type DocumentOnTypeFormattingRegistrationOptions struct { // line 5859
+- TextDocumentRegistrationOptions
+- DocumentOnTypeFormattingOptions
+-}
+-
+-// Client capabilities of a {@link DocumentRangeFormattingRequest}.
+-type DocumentRangeFormattingClientCapabilities struct { // line 11904
+- // Whether range formatting supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+-}
+-
+-// Provider options for a {@link DocumentRangeFormattingRequest}.
+-type DocumentRangeFormattingOptions struct { // line 9232
+- WorkDoneProgressOptions
+-}
+-
+-// The parameters of a {@link DocumentRangeFormattingRequest}.
+-type DocumentRangeFormattingParams struct { // line 5770
+- // The document to format.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- // The range to format
+- Range Range `json:"range"`
+- // The format options
+- Options FormattingOptions `json:"options"`
+- WorkDoneProgressParams
+-}
+-
+-// Registration options for a {@link DocumentRangeFormattingRequest}.
+-type DocumentRangeFormattingRegistrationOptions struct { // line 5806
+- TextDocumentRegistrationOptions
+- DocumentRangeFormattingOptions
+-}
+-
+-// A document selector is the combination of one or many document filters.
+-//
+-// @sample `let sel:DocumentSelector = [{ language: 'typescript' }, { language: 'json', pattern: '**∕tsconfig.json' }]`;
+-//
+-// The use of a string as a document filter is deprecated @since 3.16.0.
+-type DocumentSelector = []DocumentFilter // (alias) line 13948
+-// Represents programming constructs like variables, classes, interfaces etc.
+-// that appear in a document. Document symbols can be hierarchical and they
+-// have two ranges: one that encloses its definition and one that points to
+-// its most interesting range, e.g. the range of an identifier.
+-type DocumentSymbol struct { // line 5211
+- // The name of this symbol. Will be displayed in the user interface and therefore must not be
+- // an empty string or a string only consisting of white spaces.
+- Name string `json:"name"`
+- // More detail for this symbol, e.g the signature of a function.
+- Detail string `json:"detail,omitempty"`
+- // The kind of this symbol.
+- Kind SymbolKind `json:"kind"`
+- // Tags for this document symbol.
+- //
+- // @since 3.16.0
+- Tags []SymbolTag `json:"tags,omitempty"`
+- // Indicates if this symbol is deprecated.
+- //
+- // @deprecated Use tags instead
+- Deprecated bool `json:"deprecated,omitempty"`
+- // The range enclosing this symbol not including leading/trailing whitespace but everything else
+- // like comments. This information is typically used to determine if the clients cursor is
+- // inside the symbol to reveal in the symbol in the UI.
+- Range Range `json:"range"`
+- // The range that should be selected and revealed when this symbol is being picked, e.g the name of a function.
+- // Must be contained by the `range`.
+- SelectionRange Range `json:"selectionRange"`
+- // Children of this symbol, e.g. properties of a class.
+- Children []DocumentSymbol `json:"children,omitempty"`
+-}
+-
+-// Client Capabilities for a {@link DocumentSymbolRequest}.
+-type DocumentSymbolClientCapabilities struct { // line 11639
+- // Whether document symbol supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // Specific capabilities for the `SymbolKind` in the
+- // `textDocument/documentSymbol` request.
+- SymbolKind *PSymbolKindPDocumentSymbol `json:"symbolKind,omitempty"`
+- // The client supports hierarchical document symbols.
+- HierarchicalDocumentSymbolSupport bool `json:"hierarchicalDocumentSymbolSupport,omitempty"`
+- // The client supports tags on `SymbolInformation`. Tags are supported on
+- // `DocumentSymbol` if `hierarchicalDocumentSymbolSupport` is set to true.
+- // Clients supporting tags have to handle unknown tags gracefully.
+- //
+- // @since 3.16.0
+- TagSupport *PTagSupportPDocumentSymbol `json:"tagSupport,omitempty"`
+- // The client supports an additional label presented in the UI when
+- // registering a document symbol provider.
+- //
+- // @since 3.16.0
+- LabelSupport bool `json:"labelSupport,omitempty"`
+-}
+-
+-// Provider options for a {@link DocumentSymbolRequest}.
+-type DocumentSymbolOptions struct { // line 9010
+- // A human-readable string that is shown when multiple outlines trees
+- // are shown for the same document.
+- //
+- // @since 3.16.0
+- Label string `json:"label,omitempty"`
+- WorkDoneProgressOptions
+-}
+-
+-// Parameters for a {@link DocumentSymbolRequest}.
+-type DocumentSymbolParams struct { // line 5157
+- // The text document.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// Registration options for a {@link DocumentSymbolRequest}.
+-type DocumentSymbolRegistrationOptions struct { // line 5293
+- TextDocumentRegistrationOptions
+- DocumentSymbolOptions
+-}
+-type DocumentURI string
+-
+-// Predefined error codes.
+-type ErrorCodes int32 // line 12743
+-// The client capabilities of a {@link ExecuteCommandRequest}.
+-type ExecuteCommandClientCapabilities struct { // line 10962
+- // Execute command supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+-}
+-
+-// The server capabilities of a {@link ExecuteCommandRequest}.
+-type ExecuteCommandOptions struct { // line 9291
+- // The commands to be executed on the server
+- Commands []string `json:"commands"`
+- WorkDoneProgressOptions
+-}
+-
+-// The parameters of a {@link ExecuteCommandRequest}.
+-type ExecuteCommandParams struct { // line 5941
+- // The identifier of the actual command handler.
+- Command string `json:"command"`
+- // Arguments that the command should be invoked with.
+- Arguments []json.RawMessage `json:"arguments,omitempty"`
+- WorkDoneProgressParams
+-}
+-
+-// Registration options for a {@link ExecuteCommandRequest}.
+-type ExecuteCommandRegistrationOptions struct { // line 5973
+- ExecuteCommandOptions
+-}
+-type ExecutionSummary struct { // line 10162
+- // A strict monotonically increasing value
+- // indicating the execution order of a cell
+- // inside a notebook.
+- ExecutionOrder uint32 `json:"executionOrder"`
+- // Whether the execution was successful or
+- // not if known by the client.
+- Success bool `json:"success,omitempty"`
+-}
+-
+-// created for Literal (Lit_CodeActionClientCapabilities_codeActionLiteralSupport_codeActionKind)
+-type FCodeActionKindPCodeActionLiteralSupport struct { // line 11742
+- // The code action kind values the client supports. When this
+- // property exists the client also guarantees that it will
+- // handle values outside its set gracefully and falls back
+- // to a default value when unknown.
+- ValueSet []CodeActionKind `json:"valueSet"`
+-}
+-
+-// created for Literal (Lit_CompletionList_itemDefaults_editRange_Item1)
+-type FEditRangePItemDefaults struct { // line 4777
+- Insert Range `json:"insert"`
+- Replace Range `json:"replace"`
+-}
+-
+-// created for Literal (Lit_SemanticTokensClientCapabilities_requests_full_Item1)
+-type FFullPRequests struct { // line 12205
+- // The client will send the `textDocument/semanticTokens/full/delta` request if
+- // the server provides a corresponding handler.
+- Delta bool `json:"delta"`
+-}
+-
+-// created for Literal (Lit_CompletionClientCapabilities_completionItem_insertTextModeSupport)
+-type FInsertTextModeSupportPCompletionItem struct { // line 11295
+- ValueSet []InsertTextMode `json:"valueSet"`
+-}
+-
+-// created for Literal (Lit_SignatureHelpClientCapabilities_signatureInformation_parameterInformation)
+-type FParameterInformationPSignatureInformation struct { // line 11461
+- // The client supports processing label offsets instead of a
+- // simple label string.
+- //
+- // @since 3.14.0
+- LabelOffsetSupport bool `json:"labelOffsetSupport,omitempty"`
+-}
+-
+-// created for Literal (Lit_SemanticTokensClientCapabilities_requests_range_Item1)
+-type FRangePRequests struct { // line 12185
+-}
+-
+-// created for Literal (Lit_CompletionClientCapabilities_completionItem_resolveSupport)
+-type FResolveSupportPCompletionItem struct { // line 11271
+- // The properties that a client can resolve lazily.
+- Properties []string `json:"properties"`
+-}
+-
+-// created for Literal (Lit_NotebookDocumentChangeEvent_cells_structure)
+-type FStructurePCells struct { // line 7487
+- // The change to the cell array.
+- Array NotebookCellArrayChange `json:"array"`
+- // Additional opened cell text documents.
+- DidOpen []TextDocumentItem `json:"didOpen,omitempty"`
+- // Additional closed cell text documents.
+- DidClose []TextDocumentIdentifier `json:"didClose,omitempty"`
+-}
+-
+-// created for Literal (Lit_CompletionClientCapabilities_completionItem_tagSupport)
+-type FTagSupportPCompletionItem struct { // line 11237
+- // The tags supported by the client.
+- ValueSet []CompletionItemTag `json:"valueSet"`
+-}
+-type FailureHandlingKind string // line 13693
+-// The file event type
+-type FileChangeType uint32 // line 13454
+-// Represents information on a file/folder create.
+-//
+-// @since 3.16.0
+-type FileCreate struct { // line 6662
+- // A file:// URI for the location of the file/folder being created.
+- URI string `json:"uri"`
+-}
+-
+-// Represents information on a file/folder delete.
+-//
+-// @since 3.16.0
+-type FileDelete struct { // line 6911
+- // A file:// URI for the location of the file/folder being deleted.
+- URI string `json:"uri"`
+-}
+-
+-// An event describing a file change.
+-type FileEvent struct { // line 8480
+- // The file's uri.
+- URI DocumentURI `json:"uri"`
+- // The change type.
+- Type FileChangeType `json:"type"`
+-}
+-
+-// Capabilities relating to events from file operations by the user in the client.
+-//
+-// These events do not come from the file system, they come from user operations
+-// like renaming a file in the UI.
+-//
+-// @since 3.16.0
+-type FileOperationClientCapabilities struct { // line 11009
+- // Whether the client supports dynamic registration for file requests/notifications.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // The client has support for sending didCreateFiles notifications.
+- DidCreate bool `json:"didCreate,omitempty"`
+- // The client has support for sending willCreateFiles requests.
+- WillCreate bool `json:"willCreate,omitempty"`
+- // The client has support for sending didRenameFiles notifications.
+- DidRename bool `json:"didRename,omitempty"`
+- // The client has support for sending willRenameFiles requests.
+- WillRename bool `json:"willRename,omitempty"`
+- // The client has support for sending didDeleteFiles notifications.
+- DidDelete bool `json:"didDelete,omitempty"`
+- // The client has support for sending willDeleteFiles requests.
+- WillDelete bool `json:"willDelete,omitempty"`
+-}
+-
+-// A filter to describe in which file operation requests or notifications
+-// the server is interested in receiving.
+-//
+-// @since 3.16.0
+-type FileOperationFilter struct { // line 6864
+- // A Uri scheme like `file` or `untitled`.
+- Scheme string `json:"scheme,omitempty"`
+- // The actual file operation pattern.
+- Pattern FileOperationPattern `json:"pattern"`
+-}
+-
+-// Options for notifications/requests for user operations on files.
+-//
+-// @since 3.16.0
+-type FileOperationOptions struct { // line 9965
+- // The server is interested in receiving didCreateFiles notifications.
+- DidCreate *FileOperationRegistrationOptions `json:"didCreate,omitempty"`
+- // The server is interested in receiving willCreateFiles requests.
+- WillCreate *FileOperationRegistrationOptions `json:"willCreate,omitempty"`
+- // The server is interested in receiving didRenameFiles notifications.
+- DidRename *FileOperationRegistrationOptions `json:"didRename,omitempty"`
+- // The server is interested in receiving willRenameFiles requests.
+- WillRename *FileOperationRegistrationOptions `json:"willRename,omitempty"`
+- // The server is interested in receiving didDeleteFiles file notifications.
+- DidDelete *FileOperationRegistrationOptions `json:"didDelete,omitempty"`
+- // The server is interested in receiving willDeleteFiles file requests.
+- WillDelete *FileOperationRegistrationOptions `json:"willDelete,omitempty"`
+-}
+-
+-// A pattern to describe in which file operation requests or notifications
+-// the server is interested in receiving.
+-//
+-// @since 3.16.0
+-type FileOperationPattern struct { // line 9489
+- // The glob pattern to match. Glob patterns can have the following syntax:
+- //
+- // - `*` to match one or more characters in a path segment
+- // - `?` to match on one character in a path segment
+- // - `**` to match any number of path segments, including none
+- // - `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)
+- // - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
+- // - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
+- Glob string `json:"glob"`
+- // Whether to match files or folders with this pattern.
+- //
+- // Matches both if undefined.
+- Matches *FileOperationPatternKind `json:"matches,omitempty"`
+- // Additional options used during matching.
+- Options *FileOperationPatternOptions `json:"options,omitempty"`
+-}
+-
+-// A pattern kind describing if a glob pattern matches a file a folder or
+-// both.
+-//
+-// @since 3.16.0
+-type FileOperationPatternKind string // line 13627
+-// Matching options for the file operation pattern.
+-//
+-// @since 3.16.0
+-type FileOperationPatternOptions struct { // line 10146
+- // The pattern should be matched ignoring casing.
+- IgnoreCase bool `json:"ignoreCase,omitempty"`
+-}
+-
+-// The options to register for file operations.
+-//
+-// @since 3.16.0
+-type FileOperationRegistrationOptions struct { // line 3264
+- // The actual filters.
+- Filters []FileOperationFilter `json:"filters"`
+-}
+-
+-// Represents information on a file/folder rename.
+-//
+-// @since 3.16.0
+-type FileRename struct { // line 6888
+- // A file:// URI for the original location of the file/folder being renamed.
+- OldURI string `json:"oldUri"`
+- // A file:// URI for the new location of the file/folder being renamed.
+- NewURI string `json:"newUri"`
+-}
+-type FileSystemWatcher struct { // line 8502
+- // The glob pattern to watch. See {@link GlobPattern glob pattern} for more detail.
+- //
+- // @since 3.17.0 support for relative patterns.
+- GlobPattern GlobPattern `json:"globPattern"`
+- // The kind of events of interest. If omitted it defaults
+- // to WatchKind.Create | WatchKind.Change | WatchKind.Delete
+- // which is 7.
+- Kind *WatchKind `json:"kind,omitempty"`
+-}
+-
+-// Represents a folding range. To be valid, start and end line must be bigger than zero and smaller
+-// than the number of lines in the document. Clients are free to ignore invalid ranges.
+-type FoldingRange struct { // line 2415
+- // The zero-based start line of the range to fold. The folded area starts after the line's last character.
+- // To be valid, the end must be zero or larger and smaller than the number of lines in the document.
+- StartLine uint32 `json:"startLine"`
+- // The zero-based character offset from where the folded range starts. If not defined, defaults to the length of the start line.
+- StartCharacter uint32 `json:"startCharacter,omitempty"`
+- // The zero-based end line of the range to fold. The folded area ends with the line's last character.
+- // To be valid, the end must be zero or larger and smaller than the number of lines in the document.
+- EndLine uint32 `json:"endLine"`
+- // The zero-based character offset before the folded range ends. If not defined, defaults to the length of the end line.
+- EndCharacter uint32 `json:"endCharacter,omitempty"`
+- // Describes the kind of the folding range such as `comment' or 'region'. The kind
+- // is used to categorize folding ranges and used by commands like 'Fold all comments'.
+- // See {@link FoldingRangeKind} for an enumeration of standardized kinds.
+- Kind string `json:"kind,omitempty"`
+- // The text that the client should show when the specified range is
+- // collapsed. If not defined or not supported by the client, a default
+- // will be chosen by the client.
+- //
+- // @since 3.17.0
+- CollapsedText string `json:"collapsedText,omitempty"`
+-}
+-type FoldingRangeClientCapabilities struct { // line 11978
+- // Whether implementation supports dynamic registration for folding range
+- // providers. If this is set to `true` the client supports the new
+- // `FoldingRangeRegistrationOptions` return value for the corresponding
+- // server capability as well.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // The maximum number of folding ranges that the client prefers to receive
+- // per document. The value serves as a hint, servers are free to follow the
+- // limit.
+- RangeLimit uint32 `json:"rangeLimit,omitempty"`
+- // If set, the client signals that it only supports folding complete lines.
+- // If set, client will ignore specified `startCharacter` and `endCharacter`
+- // properties in a FoldingRange.
+- LineFoldingOnly bool `json:"lineFoldingOnly,omitempty"`
+- // Specific options for the folding range kind.
+- //
+- // @since 3.17.0
+- FoldingRangeKind *PFoldingRangeKindPFoldingRange `json:"foldingRangeKind,omitempty"`
+- // Specific options for the folding range.
+- //
+- // @since 3.17.0
+- FoldingRange *PFoldingRangePFoldingRange `json:"foldingRange,omitempty"`
+-}
+-
+-// A set of predefined range kinds.
+-type FoldingRangeKind string // line 12815
+-type FoldingRangeOptions struct { // line 6481
+- WorkDoneProgressOptions
+-}
+-
+-// Parameters for a {@link FoldingRangeRequest}.
+-type FoldingRangeParams struct { // line 2391
+- // The text document.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-type FoldingRangeRegistrationOptions struct { // line 2474
+- TextDocumentRegistrationOptions
+- FoldingRangeOptions
+- StaticRegistrationOptions
+-}
+-
+-// Value-object describing what options formatting should use.
+-type FormattingOptions struct { // line 9169
+- // Size of a tab in spaces.
+- TabSize uint32 `json:"tabSize"`
+- // Prefer spaces over tabs.
+- InsertSpaces bool `json:"insertSpaces"`
+- // Trim trailing whitespace on a line.
+- //
+- // @since 3.15.0
+- TrimTrailingWhitespace bool `json:"trimTrailingWhitespace,omitempty"`
+- // Insert a newline character at the end of the file if one does not exist.
+- //
+- // @since 3.15.0
+- InsertFinalNewline bool `json:"insertFinalNewline,omitempty"`
+- // Trim all newlines after the final newline at the end of the file.
+- //
+- // @since 3.15.0
+- TrimFinalNewlines bool `json:"trimFinalNewlines,omitempty"`
+-}
+-
+-// A diagnostic report with a full set of problems.
+-//
+-// @since 3.17.0
+-type FullDocumentDiagnosticReport struct { // line 7235
+- // A full document diagnostic report.
+- Kind string `json:"kind"`
+- // An optional result id. If provided it will
+- // be sent on the next diagnostic request for the
+- // same document.
+- ResultID string `json:"resultId,omitempty"`
+- // The actual items.
+- Items []Diagnostic `json:"items"`
+-}
+-
+-// General client capabilities.
+-//
+-// @since 3.16.0
+-type GeneralClientCapabilities struct { // line 10664
+- // Client capability that signals how the client
+- // handles stale requests (e.g. a request
+- // for which the client will not process the response
+- // anymore since the information is outdated).
+- //
+- // @since 3.17.0
+- StaleRequestSupport *PStaleRequestSupportPGeneral `json:"staleRequestSupport,omitempty"`
+- // Client capabilities specific to regular expressions.
+- //
+- // @since 3.16.0
+- RegularExpressions *RegularExpressionsClientCapabilities `json:"regularExpressions,omitempty"`
+- // Client capabilities specific to the client's markdown parser.
+- //
+- // @since 3.16.0
+- Markdown *MarkdownClientCapabilities `json:"markdown,omitempty"`
+- // The position encodings supported by the client. Client and server
+- // have to agree on the same position encoding to ensure that offsets
+- // (e.g. character position in a line) are interpreted the same on both
+- // sides.
+- //
+- // To keep the protocol backwards compatible the following applies: if
+- // the value 'utf-16' is missing from the array of position encodings
+- // servers can assume that the client supports UTF-16. UTF-16 is
+- // therefore a mandatory encoding.
+- //
+- // If omitted it defaults to ['utf-16'].
+- //
+- // Implementation considerations: since the conversion from one encoding
+- // into another requires the content of the file / line the conversion
+- // is best done where the file is read which is usually on the server
+- // side.
+- //
+- // @since 3.17.0
+- PositionEncodings []PositionEncodingKind `json:"positionEncodings,omitempty"`
+-}
+-
+-// The glob pattern. Either a string pattern or a relative pattern.
+-//
+-// @since 3.17.0
+-type GlobPattern = string // (alias) line 14127
+-// The result of a hover request.
+-type Hover struct { // line 4886
+- // The hover's content
+- Contents MarkupContent `json:"contents"`
+- // An optional range inside the text document that is used to
+- // visualize the hover, e.g. by changing the background color.
+- Range Range `json:"range,omitempty"`
+-}
+-type HoverClientCapabilities struct { // line 11402
+- // Whether hover supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // Client supports the following content formats for the content
+- // property. The order describes the preferred format of the client.
+- ContentFormat []MarkupKind `json:"contentFormat,omitempty"`
+-}
+-
+-// Hover options.
+-type HoverOptions struct { // line 8776
+- WorkDoneProgressOptions
+-}
+-
+-// Parameters for a {@link HoverRequest}.
+-type HoverParams struct { // line 4869
+- TextDocumentPositionParams
+- WorkDoneProgressParams
+-}
+-
+-// Registration options for a {@link HoverRequest}.
+-type HoverRegistrationOptions struct { // line 4925
+- TextDocumentRegistrationOptions
+- HoverOptions
+-}
+-
+-// @since 3.6.0
+-type ImplementationClientCapabilities struct { // line 11583
+- // Whether implementation supports dynamic registration. If this is set to `true`
+- // the client supports the new `ImplementationRegistrationOptions` return value
+- // for the corresponding server capability as well.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // The client supports additional metadata in the form of definition links.
+- //
+- // @since 3.14.0
+- LinkSupport bool `json:"linkSupport,omitempty"`
+-}
+-type ImplementationOptions struct { // line 6333
+- WorkDoneProgressOptions
+-}
+-type ImplementationParams struct { // line 2063
+- TextDocumentPositionParams
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-type ImplementationRegistrationOptions struct { // line 2103
+- TextDocumentRegistrationOptions
+- ImplementationOptions
+- StaticRegistrationOptions
+-}
+-
+-// The data type of the ResponseError if the
+-// initialize request fails.
+-type InitializeError struct { // line 4126
+- // Indicates whether the client execute the following retry logic:
+- // (1) show the message provided by the ResponseError to the user
+- // (2) user selects retry or cancel
+- // (3) if user selected retry the initialize method is sent again.
+- Retry bool `json:"retry"`
+-}
+-type InitializeParams struct { // line 4068
+- XInitializeParams
+- WorkspaceFoldersInitializeParams
+-}
+-
+-// The result returned from an initialize request.
+-type InitializeResult struct { // line 4082
+- // The capabilities the language server provides.
+- Capabilities ServerCapabilities `json:"capabilities"`
+- // Information about the server.
+- //
+- // @since 3.15.0
+- ServerInfo *PServerInfoMsg_initialize `json:"serverInfo,omitempty"`
+-}
+-type InitializedParams struct { // line 4140
+-}
+-
+-// Inlay hint information.
+-//
+-// @since 3.17.0
+-type InlayHint struct { // line 3645
+- // The position of this hint.
+- Position Position `json:"position"`
+- // The label of this hint. A human readable string or an array of
+- // InlayHintLabelPart label parts.
+- //
+- // *Note* that neither the string nor the label part can be empty.
+- Label []InlayHintLabelPart `json:"label"`
+- // The kind of this hint. Can be omitted in which case the client
+- // should fall back to a reasonable default.
+- Kind InlayHintKind `json:"kind,omitempty"`
+- // Optional text edits that are performed when accepting this inlay hint.
+- //
+- // *Note* that edits are expected to change the document so that the inlay
+- // hint (or its nearest variant) is now part of the document and the inlay
+- // hint itself is now obsolete.
+- TextEdits []TextEdit `json:"textEdits,omitempty"`
+- // The tooltip text when you hover over this item.
+- Tooltip *OrPTooltip_textDocument_inlayHint `json:"tooltip,omitempty"`
+- // Render padding before the hint.
+- //
+- // Note: Padding should use the editor's background color, not the
+- // background color of the hint itself. That means padding can be used
+- // to visually align/separate an inlay hint.
+- PaddingLeft bool `json:"paddingLeft,omitempty"`
+- // Render padding after the hint.
+- //
+- // Note: Padding should use the editor's background color, not the
+- // background color of the hint itself. That means padding can be used
+- // to visually align/separate an inlay hint.
+- PaddingRight bool `json:"paddingRight,omitempty"`
+- // A data entry field that is preserved on an inlay hint between
+- // a `textDocument/inlayHint` and a `inlayHint/resolve` request.
+- Data interface{} `json:"data,omitempty"`
+-}
+-
+-// Inlay hint client capabilities.
+-//
+-// @since 3.17.0
+-type InlayHintClientCapabilities struct { // line 12369
+- // Whether inlay hints support dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // Indicates which properties a client can resolve lazily on an inlay
+- // hint.
+- ResolveSupport *PResolveSupportPInlayHint `json:"resolveSupport,omitempty"`
+-}
+-
+-// Inlay hint kinds.
+-//
+-// @since 3.17.0
+-type InlayHintKind uint32 // line 13033
+-// An inlay hint label part allows for interactive and composite labels
+-// of inlay hints.
+-//
+-// @since 3.17.0
+-type InlayHintLabelPart struct { // line 7062
+- // The value of this label part.
+- Value string `json:"value"`
+- // The tooltip text when you hover over this label part. Depending on
+- // the client capability `inlayHint.resolveSupport` clients might resolve
+- // this property late using the resolve request.
+- Tooltip *OrPTooltipPLabel `json:"tooltip,omitempty"`
+- // An optional source code location that represents this
+- // label part.
+- //
+- // The editor will use this location for the hover and for code navigation
+- // features: This part will become a clickable link that resolves to the
+- // definition of the symbol at the given location (not necessarily the
+- // location itself), it shows the hover that shows at the given location,
+- // and it shows a context menu with further code navigation commands.
+- //
+- // Depending on the client capability `inlayHint.resolveSupport` clients
+- // might resolve this property late using the resolve request.
+- Location *Location `json:"location,omitempty"`
+- // An optional command for this label part.
+- //
+- // Depending on the client capability `inlayHint.resolveSupport` clients
+- // might resolve this property late using the resolve request.
+- Command *Command `json:"command,omitempty"`
+-}
+-
+-// Inlay hint options used during static registration.
+-//
+-// @since 3.17.0
+-type InlayHintOptions struct { // line 7135
+- // The server provides support to resolve additional
+- // information for an inlay hint item.
+- ResolveProvider bool `json:"resolveProvider,omitempty"`
+- WorkDoneProgressOptions
+-}
+-
+-// A parameter literal used in inlay hint requests.
+-//
+-// @since 3.17.0
+-type InlayHintParams struct { // line 3616
+- // The text document.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- // The document range for which inlay hints should be computed.
+- Range Range `json:"range"`
+- WorkDoneProgressParams
+-}
+-
+-// Inlay hint options used during static or dynamic registration.
+-//
+-// @since 3.17.0
+-type InlayHintRegistrationOptions struct { // line 3746
+- InlayHintOptions
+- TextDocumentRegistrationOptions
+- StaticRegistrationOptions
+-}
+-
+-// Client workspace capabilities specific to inlay hints.
+-//
+-// @since 3.17.0
+-type InlayHintWorkspaceClientCapabilities struct { // line 11095
+- // Whether the client implementation supports a refresh request sent from
+- // the server to the client.
+- //
+- // Note that this event is global and will force the client to refresh all
+- // inlay hints currently shown. It should be used with absolute care and
+- // is useful for situation where a server for example detects a project wide
+- // change that requires such a calculation.
+- RefreshSupport bool `json:"refreshSupport,omitempty"`
+-}
+-
+-// Inline value information can be provided by different means:
+-//
+-// - directly as a text value (class InlineValueText).
+-// - as a name to use for a variable lookup (class InlineValueVariableLookup)
+-// - as an evaluatable expression (class InlineValueEvaluatableExpression)
+-//
+-// The InlineValue types combines all inline value types into one type.
+-//
+-// @since 3.17.0
+-type InlineValue = Or_InlineValue // (alias) line 13861
+-// Client capabilities specific to inline values.
+-//
+-// @since 3.17.0
+-type InlineValueClientCapabilities struct { // line 12353
+- // Whether implementation supports dynamic registration for inline value providers.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+-}
+-
+-// @since 3.17.0
+-type InlineValueContext struct { // line 6948
+- // The stack frame (as a DAP Id) where the execution has stopped.
+- FrameID int32 `json:"frameId"`
+- // The document range where execution has stopped.
+- // Typically the end position of the range denotes the line where the inline values are shown.
+- StoppedLocation Range `json:"stoppedLocation"`
+-}
+-
+-// Provide an inline value through an expression evaluation.
+-// If only a range is specified, the expression will be extracted from the underlying document.
+-// An optional expression can be used to override the extracted expression.
+-//
+-// @since 3.17.0
+-type InlineValueEvaluatableExpression struct { // line 7026
+- // The document range for which the inline value applies.
+- // The range is used to extract the evaluatable expression from the underlying document.
+- Range Range `json:"range"`
+- // If specified the expression overrides the extracted expression.
+- Expression string `json:"expression,omitempty"`
+-}
+-
+-// Inline value options used during static registration.
+-//
+-// @since 3.17.0
+-type InlineValueOptions struct { // line 7050
+- WorkDoneProgressOptions
+-}
+-
+-// A parameter literal used in inline value requests.
+-//
+-// @since 3.17.0
+-type InlineValueParams struct { // line 3557
+- // The text document.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- // The document range for which inline values should be computed.
+- Range Range `json:"range"`
+- // Additional information about the context in which inline values were
+- // requested.
+- Context InlineValueContext `json:"context"`
+- WorkDoneProgressParams
+-}
+-
+-// Inline value options used during static or dynamic registration.
+-//
+-// @since 3.17.0
+-type InlineValueRegistrationOptions struct { // line 3594
+- InlineValueOptions
+- TextDocumentRegistrationOptions
+- StaticRegistrationOptions
+-}
+-
+-// Provide inline value as text.
+-//
+-// @since 3.17.0
+-type InlineValueText struct { // line 6971
+- // The document range for which the inline value applies.
+- Range Range `json:"range"`
+- // The text of the inline value.
+- Text string `json:"text"`
+-}
+-
+-// Provide inline value through a variable lookup.
+-// If only a range is specified, the variable name will be extracted from the underlying document.
+-// An optional variable name can be used to override the extracted name.
+-//
+-// @since 3.17.0
+-type InlineValueVariableLookup struct { // line 6994
+- // The document range for which the inline value applies.
+- // The range is used to extract the variable name from the underlying document.
+- Range Range `json:"range"`
+- // If specified the name of the variable to look up.
+- VariableName string `json:"variableName,omitempty"`
+- // How to perform the lookup.
+- CaseSensitiveLookup bool `json:"caseSensitiveLookup"`
+-}
+-
+-// Client workspace capabilities specific to inline values.
+-//
+-// @since 3.17.0
+-type InlineValueWorkspaceClientCapabilities struct { // line 11079
+- // Whether the client implementation supports a refresh request sent from the
+- // server to the client.
+- //
+- // Note that this event is global and will force the client to refresh all
+- // inline values currently shown. It should be used with absolute care and is
+- // useful for situation where a server for example detects a project wide
+- // change that requires such a calculation.
+- RefreshSupport bool `json:"refreshSupport,omitempty"`
+-}
+-
+-// A special text edit to provide an insert and a replace operation.
+-//
+-// @since 3.16.0
+-type InsertReplaceEdit struct { // line 8676
+- // The string to be inserted.
+- NewText string `json:"newText"`
+- // The range if the insert is requested
+- Insert Range `json:"insert"`
+- // The range if the replace is requested.
+- Replace Range `json:"replace"`
+-}
+-
+-// Defines whether the insert text in a completion item should be interpreted as
+-// plain text or a snippet.
+-type InsertTextFormat uint32 // line 13260
+-// How whitespace and indentation is handled during completion
+-// item insertion.
+-//
+-// @since 3.16.0
+-type InsertTextMode uint32 // line 13280
+-type LSPAny = interface{}
+-
+-// LSP arrays.
+-// @since 3.17.0
+-type LSPArray = []interface{} // (alias) line 13779
+-type LSPErrorCodes int32 // line 12783
+-// LSP object definition.
+-// @since 3.17.0
+-type LSPObject = map[string]LSPAny // (alias) line 14111
+-// Client capabilities for the linked editing range request.
+-//
+-// @since 3.16.0
+-type LinkedEditingRangeClientCapabilities struct { // line 12305
+- // Whether implementation supports dynamic registration. If this is set to `true`
+- // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
+- // return value for the corresponding server capability as well.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+-}
+-type LinkedEditingRangeOptions struct { // line 6652
+- WorkDoneProgressOptions
+-}
+-type LinkedEditingRangeParams struct { // line 3112
+- TextDocumentPositionParams
+- WorkDoneProgressParams
+-}
+-type LinkedEditingRangeRegistrationOptions struct { // line 3155
+- TextDocumentRegistrationOptions
+- LinkedEditingRangeOptions
+- StaticRegistrationOptions
+-}
+-
+-// The result of a linked editing range request.
+-//
+-// @since 3.16.0
+-type LinkedEditingRanges struct { // line 3128
+- // A list of ranges that can be edited together. The ranges must have
+- // identical length and contain identical text content. The ranges cannot overlap.
+- Ranges []Range `json:"ranges"`
+- // An optional word pattern (regular expression) that describes valid contents for
+- // the given ranges. If no pattern is provided, the client configuration's word
+- // pattern will be used.
+- WordPattern string `json:"wordPattern,omitempty"`
+-}
+-
+-// created for Literal (Lit_NotebookDocumentChangeEvent_cells_textContent_Elem)
+-type Lit_NotebookDocumentChangeEvent_cells_textContent_Elem struct { // line 7545
+- Document VersionedTextDocumentIdentifier `json:"document"`
+- Changes []TextDocumentContentChangeEvent `json:"changes"`
+-}
+-
+-// created for Literal (Lit_NotebookDocumentFilter_Item1)
+-type Lit_NotebookDocumentFilter_Item1 struct { // line 14293
+- // The type of the enclosing notebook.
+- NotebookType string `json:"notebookType,omitempty"`
+- // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
+- Scheme string `json:"scheme"`
+- // A glob pattern.
+- Pattern string `json:"pattern,omitempty"`
+-}
+-
+-// created for Literal (Lit_NotebookDocumentFilter_Item2)
+-type Lit_NotebookDocumentFilter_Item2 struct { // line 14326
+- // The type of the enclosing notebook.
+- NotebookType string `json:"notebookType,omitempty"`
+- // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
+- Scheme string `json:"scheme,omitempty"`
+- // A glob pattern.
+- Pattern string `json:"pattern"`
+-}
+-
+-// created for Literal (Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0_cells_Elem)
+-type Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0_cells_Elem struct { // line 9831
+- Language string `json:"language"`
+-}
+-
+-// created for Literal (Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1)
+-type Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1 struct { // line 9852
+- // The notebook to be synced If a string
+- // value is provided it matches against the
+- // notebook type. '*' matches every notebook.
+- Notebook *Or_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1_notebook `json:"notebook,omitempty"`
+- // The cells of the matching notebook to be synced.
+- Cells []Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1_cells_Elem `json:"cells"`
+-}
+-
+-// created for Literal (Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1_cells_Elem)
+-type Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1_cells_Elem struct { // line 9878
+- Language string `json:"language"`
+-}
+-
+-// created for Literal (Lit_PrepareRenameResult_Item2)
+-type Lit_PrepareRenameResult_Item2 struct { // line 13932
+- DefaultBehavior bool `json:"defaultBehavior"`
+-}
+-
+-// created for Literal (Lit_TextDocumentContentChangeEvent_Item1)
+-type Lit_TextDocumentContentChangeEvent_Item1 struct { // line 14040
+- // The new text of the whole document.
+- Text string `json:"text"`
+-}
+-
+-// created for Literal (Lit_TextDocumentFilter_Item2)
+-type Lit_TextDocumentFilter_Item2 struct { // line 14217
+- // A language id, like `typescript`.
+- Language string `json:"language,omitempty"`
+- // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
+- Scheme string `json:"scheme,omitempty"`
+- // A glob pattern, like `*.{ts,js}`.
+- Pattern string `json:"pattern"`
+-}
+-
+-// Represents a location inside a resource, such as a line
+-// inside a text file.
+-type Location struct { // line 2083
+- URI DocumentURI `json:"uri"`
+- Range Range `json:"range"`
+-}
+-
+-// Represents the connection of two locations. Provides additional metadata over normal {@link Location locations},
+-// including an origin range.
+-type LocationLink struct { // line 6272
+- // Span of the origin of this link.
+- //
+- // Used as the underlined span for mouse interaction. Defaults to the word range at
+- // the definition position.
+- OriginSelectionRange *Range `json:"originSelectionRange,omitempty"`
+- // The target resource identifier of this link.
+- TargetURI DocumentURI `json:"targetUri"`
+- // The full target range of this link. If the target for example is a symbol then target range is the
+- // range enclosing this symbol not including leading/trailing whitespace but everything else
+- // like comments. This information is typically used to highlight the range in the editor.
+- TargetRange Range `json:"targetRange"`
+- // The range that should be selected and revealed when this link is being followed, e.g the name of a function.
+- // Must be contained by the `targetRange`. See also `DocumentSymbol#range`
+- TargetSelectionRange Range `json:"targetSelectionRange"`
+-}
+-
+-// The log message parameters.
+-type LogMessageParams struct { // line 4251
+- // The message type. See {@link MessageType}
+- Type MessageType `json:"type"`
+- // The actual message.
+- Message string `json:"message"`
+-}
+-type LogTraceParams struct { // line 6159
+- Message string `json:"message"`
+- Verbose string `json:"verbose,omitempty"`
+-}
+-
+-// Client capabilities specific to the used markdown parser.
+-//
+-// @since 3.16.0
+-type MarkdownClientCapabilities struct { // line 12524
+- // The name of the parser.
+- Parser string `json:"parser"`
+- // The version of the parser.
+- Version string `json:"version,omitempty"`
+- // A list of HTML tags that the client allows / supports in
+- // Markdown.
+- //
+- // @since 3.17.0
+- AllowedTags []string `json:"allowedTags,omitempty"`
+-}
+-
+-// MarkedString can be used to render human readable text. It is either a markdown string
+-// or a code-block that provides a language and a code snippet. The language identifier
+-// is semantically equal to the optional language identifier in fenced code blocks in GitHub
+-// issues. See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
+-//
+-// The pair of a language and a value is an equivalent to markdown:
+-// ```${language}
+-// ${value}
+-// ```
+-//
+-// Note that markdown strings will be sanitized - that means html will be escaped.
+-// @deprecated use MarkupContent instead.
+-type MarkedString = Or_MarkedString // (alias) line 14058
+-// A `MarkupContent` literal represents a string value which content is interpreted base on its
+-// kind flag. Currently the protocol supports `plaintext` and `markdown` as markup kinds.
+-//
+-// If the kind is `markdown` then the value can contain fenced code blocks like in GitHub issues.
+-// See https://help.github.com/articles/creating-and-highlighting-code-blocks/#syntax-highlighting
+-//
+-// Here is an example how such a string can be constructed using JavaScript / TypeScript:
+-// ```ts
+-//
+-// let markdown: MarkdownContent = {
+-// kind: MarkupKind.Markdown,
+-// value: [
+-// '# Header',
+-// 'Some text',
+-// '```typescript',
+-// 'someCode();',
+-// '```'
+-// ].join('\n')
+-// };
+-//
+-// ```
+-//
+-// *Please Note* that clients might sanitize the return markdown. A client could decide to
+-// remove HTML from the markdown to avoid script execution.
+-type MarkupContent struct { // line 7113
+- // The type of the Markup
+- Kind MarkupKind `json:"kind"`
+- // The content itself
+- Value string `json:"value"`
+-}
+-
+-// Describes the content type that a client supports in various
+-// result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
+-//
+-// Please note that `MarkupKinds` must not start with a `$`. This kinds
+-// are reserved for internal usage.
+-type MarkupKind string // line 13407
+-type MessageActionItem struct { // line 4238
+- // A short title like 'Retry', 'Open Log' etc.
+- Title string `json:"title"`
+-}
+-
+-// The message type
+-type MessageType uint32 // line 13054
+-// Moniker definition to match LSIF 0.5 moniker definition.
+-//
+-// @since 3.16.0
+-type Moniker struct { // line 3338
+- // The scheme of the moniker. For example tsc or .Net
+- Scheme string `json:"scheme"`
+- // The identifier of the moniker. The value is opaque in LSIF however
+- // schema owners are allowed to define the structure if they want.
+- Identifier string `json:"identifier"`
+- // The scope in which the moniker is unique
+- Unique UniquenessLevel `json:"unique"`
+- // The moniker kind if known.
+- Kind *MonikerKind `json:"kind,omitempty"`
+-}
+-
+-// Client capabilities specific to the moniker request.
+-//
+-// @since 3.16.0
+-type MonikerClientCapabilities struct { // line 12321
+- // Whether moniker supports dynamic registration. If this is set to `true`
+- // the client supports the new `MonikerRegistrationOptions` return value
+- // for the corresponding server capability as well.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+-}
+-
+-// The moniker kind.
+-//
+-// @since 3.16.0
+-type MonikerKind string // line 13007
+-type MonikerOptions struct { // line 6926
+- WorkDoneProgressOptions
+-}
+-type MonikerParams struct { // line 3318
+- TextDocumentPositionParams
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-type MonikerRegistrationOptions struct { // line 3378
+- TextDocumentRegistrationOptions
+- MonikerOptions
+-}
+-
+-// created for Literal (Lit_MarkedString_Item1)
+-type Msg_MarkedString struct { // line 14068
+- Language string `json:"language"`
+- Value string `json:"value"`
+-}
+-
+-// created for Literal (Lit_NotebookDocumentFilter_Item0)
+-type Msg_NotebookDocumentFilter struct { // line 14260
+- // The type of the enclosing notebook.
+- NotebookType string `json:"notebookType"`
+- // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
+- Scheme string `json:"scheme,omitempty"`
+- // A glob pattern.
+- Pattern string `json:"pattern,omitempty"`
+-}
+-
+-// created for Literal (Lit_PrepareRenameResult_Item1)
+-type Msg_PrepareRename2Gn struct { // line 13911
+- Range Range `json:"range"`
+- Placeholder string `json:"placeholder"`
+-}
+-
+-// created for Literal (Lit_TextDocumentContentChangeEvent_Item0)
+-type Msg_TextDocumentContentChangeEvent struct { // line 14008
+- // The range of the document that changed.
+- Range *Range `json:"range"`
+- // The optional length of the range that got replaced.
+- //
+- // @deprecated use range instead.
+- RangeLength uint32 `json:"rangeLength,omitempty"`
+- // The new text for the provided range.
+- Text string `json:"text"`
+-}
+-
+-// created for Literal (Lit_TextDocumentFilter_Item1)
+-type Msg_TextDocumentFilter struct { // line 14184
+- // A language id, like `typescript`.
+- Language string `json:"language,omitempty"`
+- // A Uri {@link Uri.scheme scheme}, like `file` or `untitled`.
+- Scheme string `json:"scheme"`
+- // A glob pattern, like `*.{ts,js}`.
+- Pattern string `json:"pattern,omitempty"`
+-}
+-
+-// created for Literal (Lit__InitializeParams_clientInfo)
+-type Msg_XInitializeParams_clientInfo struct { // line 7673
+- // The name of the client as defined by the client.
+- Name string `json:"name"`
+- // The client's version as defined by the client.
+- Version string `json:"version,omitempty"`
+-}
+-
+-// A notebook cell.
+-//
+-// A cell's document URI must be unique across ALL notebook
+-// cells and can therefore be used to uniquely identify a
+-// notebook cell or the cell's text document.
+-//
+-// @since 3.17.0
+-type NotebookCell struct { // line 9598
+- // The cell's kind
+- Kind NotebookCellKind `json:"kind"`
+- // The URI of the cell's text document
+- // content.
+- Document DocumentURI `json:"document"`
+- // Additional metadata stored with the cell.
+- //
+- // Note: should always be an object literal (e.g. LSPObject)
+- Metadata *LSPObject `json:"metadata,omitempty"`
+- // Additional execution summary information
+- // if supported by the client.
+- ExecutionSummary *ExecutionSummary `json:"executionSummary,omitempty"`
+-}
+-
+-// A change describing how to move a `NotebookCell`
+-// array from state S to S'.
+-//
+-// @since 3.17.0
+-type NotebookCellArrayChange struct { // line 9639
+- // The start oftest of the cell that changed.
+- Start uint32 `json:"start"`
+- // The deleted cells
+- DeleteCount uint32 `json:"deleteCount"`
+- // The new cells, if any
+- Cells []NotebookCell `json:"cells,omitempty"`
+-}
+-
+-// A notebook cell kind.
+-//
+-// @since 3.17.0
+-type NotebookCellKind uint32 // line 13648
+-// A notebook cell text document filter denotes a cell text
+-// document by different properties.
+-//
+-// @since 3.17.0
+-type NotebookCellTextDocumentFilter struct { // line 10113
+- // A filter that matches against the notebook
+- // containing the notebook cell. If a string
+- // value is provided it matches against the
+- // notebook type. '*' matches every notebook.
+- Notebook Or_NotebookCellTextDocumentFilter_notebook `json:"notebook"`
+- // A language id like `python`.
+- //
+- // Will be matched against the language id of the
+- // notebook cell document. '*' matches every language.
+- Language string `json:"language,omitempty"`
+-}
+-
+-// A notebook document.
+-//
+-// @since 3.17.0
+-type NotebookDocument struct { // line 7354
+- // The notebook document's uri.
+- URI URI `json:"uri"`
+- // The type of the notebook.
+- NotebookType string `json:"notebookType"`
+- // The version number of this document (it will increase after each
+- // change, including undo/redo).
+- Version int32 `json:"version"`
+- // Additional metadata stored with the notebook
+- // document.
+- //
+- // Note: should always be an object literal (e.g. LSPObject)
+- Metadata *LSPObject `json:"metadata,omitempty"`
+- // The cells of a notebook.
+- Cells []NotebookCell `json:"cells"`
+-}
+-
+-// A change event for a notebook document.
+-//
+-// @since 3.17.0
+-type NotebookDocumentChangeEvent struct { // line 7466
+- // The changed meta data if any.
+- //
+- // Note: should always be an object literal (e.g. LSPObject)
+- Metadata *LSPObject `json:"metadata,omitempty"`
+- // Changes to cells
+- Cells *PCellsPChange `json:"cells,omitempty"`
+-}
+-
+-// Capabilities specific to the notebook document support.
+-//
+-// @since 3.17.0
+-type NotebookDocumentClientCapabilities struct { // line 10613
+- // Capabilities specific to notebook document synchronization
+- //
+- // @since 3.17.0
+- Synchronization NotebookDocumentSyncClientCapabilities `json:"synchronization"`
+-}
+-
+-// A notebook document filter denotes a notebook document by
+-// different properties. The properties will be match
+-// against the notebook's URI (same as with documents)
+-//
+-// @since 3.17.0
+-type NotebookDocumentFilter = Msg_NotebookDocumentFilter // (alias) line 14254
+-// A literal to identify a notebook document in the client.
+-//
+-// @since 3.17.0
+-type NotebookDocumentIdentifier struct { // line 7582
+- // The notebook document's uri.
+- URI URI `json:"uri"`
+-}
+-
+-// Notebook specific client capabilities.
+-//
+-// @since 3.17.0
+-type NotebookDocumentSyncClientCapabilities struct { // line 12433
+- // Whether implementation supports dynamic registration. If this is
+- // set to `true` the client supports the new
+- // `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
+- // return value for the corresponding server capability as well.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // The client supports sending execution summary data per cell.
+- ExecutionSummarySupport bool `json:"executionSummarySupport,omitempty"`
+-}
+-
+-// Options specific to a notebook plus its cells
+-// to be synced to the server.
+-//
+-// If a selector provides a notebook document
+-// filter but no cell selector all cells of a
+-// matching notebook document will be synced.
+-//
+-// If a selector provides no notebook document
+-// filter but only a cell selector all notebook
+-// document that contain at least one matching
+-// cell will be synced.
+-//
+-// @since 3.17.0
+-type NotebookDocumentSyncOptions struct { // line 9795
+- // The notebooks to be synced
+- NotebookSelector []PNotebookSelectorPNotebookDocumentSync `json:"notebookSelector"`
+- // Whether save notification should be forwarded to
+- // the server. Will only be honored if mode === `notebook`.
+- Save bool `json:"save,omitempty"`
+-}
+-
+-// Registration options specific to a notebook.
+-//
+-// @since 3.17.0
+-type NotebookDocumentSyncRegistrationOptions struct { // line 9915
+- NotebookDocumentSyncOptions
+- StaticRegistrationOptions
+-}
+-
+-// A text document identifier to optionally denote a specific version of a text document.
+-type OptionalVersionedTextDocumentIdentifier struct { // line 9343
+- // The version number of this document. If a versioned text document identifier
+- // is sent from the server to the client and the file is not open in the editor
+- // (the server has not received an open notification before) the server can send
+- // `null` to indicate that the version is unknown and the content on disk is the
+- // truth (as specified with document content ownership).
+- Version int32 `json:"version"`
+- TextDocumentIdentifier
+-}
+-
+-// created for Or [FEditRangePItemDefaults Range]
+-type OrFEditRangePItemDefaults struct { // line 4770
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [NotebookDocumentFilter string]
+-type OrFNotebookPNotebookSelector struct { // line 9812
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [Location PLocationMsg_workspace_symbol]
+-type OrPLocation_workspace_symbol struct { // line 5521
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [[]string string]
+-type OrPSection_workspace_didChangeConfiguration struct { // line 4164
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [MarkupContent string]
+-type OrPTooltipPLabel struct { // line 7076
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [MarkupContent string]
+-type OrPTooltip_textDocument_inlayHint struct { // line 3700
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [int32 string]
+-type Or_CancelParams_id struct { // line 6185
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [MarkupContent string]
+-type Or_CompletionItem_documentation struct { // line 4583
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [InsertReplaceEdit TextEdit]
+-type Or_CompletionItem_textEdit struct { // line 4666
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [Location []Location]
+-type Or_Definition struct { // line 13754
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [int32 string]
+-type Or_Diagnostic_code struct { // line 8548
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [RelatedFullDocumentDiagnosticReport RelatedUnchangedDocumentDiagnosticReport]
+-type Or_DocumentDiagnosticReport struct { // line 13886
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]
+-type Or_DocumentDiagnosticReportPartialResult_relatedDocuments_Value struct { // line 3823
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [NotebookCellTextDocumentFilter TextDocumentFilter]
+-type Or_DocumentFilter struct { // line 14096
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [MarkedString MarkupContent []MarkedString]
+-type Or_Hover_contents struct { // line 4892
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [[]InlayHintLabelPart string]
+-type Or_InlayHint_label struct { // line 3659
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [InlineValueEvaluatableExpression InlineValueText InlineValueVariableLookup]
+-type Or_InlineValue struct { // line 13864
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [Msg_MarkedString string]
+-type Or_MarkedString struct { // line 14061
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [NotebookDocumentFilter string]
+-type Or_NotebookCellTextDocumentFilter_notebook struct { // line 10119
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [NotebookDocumentFilter string]
+-type Or_NotebookDocumentSyncOptions_notebookSelector_Elem_Item1_notebook struct { // line 9858
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]
+-type Or_RelatedFullDocumentDiagnosticReport_relatedDocuments_Value struct { // line 7169
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [FullDocumentDiagnosticReport UnchangedDocumentDiagnosticReport]
+-type Or_RelatedUnchangedDocumentDiagnosticReport_relatedDocuments_Value struct { // line 7208
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [URI WorkspaceFolder]
+-type Or_RelativePattern_baseUri struct { // line 10742
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [CodeAction Command]
+-type Or_Result_textDocument_codeAction_Item0_Elem struct { // line 1372
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [FFullPRequests bool]
+-type Or_SemanticTokensClientCapabilities_requests_full struct { // line 12198
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [FRangePRequests bool]
+-type Or_SemanticTokensClientCapabilities_requests_range struct { // line 12178
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [PFullESemanticTokensOptions bool]
+-type Or_SemanticTokensOptions_full struct { // line 6580
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [PRangeESemanticTokensOptions bool]
+-type Or_SemanticTokensOptions_range struct { // line 6560
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [CallHierarchyOptions CallHierarchyRegistrationOptions bool]
+-type Or_ServerCapabilities_callHierarchyProvider struct { // line 8228
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [CodeActionOptions bool]
+-type Or_ServerCapabilities_codeActionProvider struct { // line 8036
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [DocumentColorOptions DocumentColorRegistrationOptions bool]
+-type Or_ServerCapabilities_colorProvider struct { // line 8072
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [DeclarationOptions DeclarationRegistrationOptions bool]
+-type Or_ServerCapabilities_declarationProvider struct { // line 7898
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [DefinitionOptions bool]
+-type Or_ServerCapabilities_definitionProvider struct { // line 7920
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [DiagnosticOptions DiagnosticRegistrationOptions]
+-type Or_ServerCapabilities_diagnosticProvider struct { // line 8385
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [DocumentFormattingOptions bool]
+-type Or_ServerCapabilities_documentFormattingProvider struct { // line 8112
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [DocumentHighlightOptions bool]
+-type Or_ServerCapabilities_documentHighlightProvider struct { // line 8000
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [DocumentRangeFormattingOptions bool]
+-type Or_ServerCapabilities_documentRangeFormattingProvider struct { // line 8130
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [DocumentSymbolOptions bool]
+-type Or_ServerCapabilities_documentSymbolProvider struct { // line 8018
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [FoldingRangeOptions FoldingRangeRegistrationOptions bool]
+-type Or_ServerCapabilities_foldingRangeProvider struct { // line 8175
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [HoverOptions bool]
+-type Or_ServerCapabilities_hoverProvider struct { // line 7871
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [ImplementationOptions ImplementationRegistrationOptions bool]
+-type Or_ServerCapabilities_implementationProvider struct { // line 7960
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [InlayHintOptions InlayHintRegistrationOptions bool]
+-type Or_ServerCapabilities_inlayHintProvider struct { // line 8362
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [InlineValueOptions InlineValueRegistrationOptions bool]
+-type Or_ServerCapabilities_inlineValueProvider struct { // line 8339
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [LinkedEditingRangeOptions LinkedEditingRangeRegistrationOptions bool]
+-type Or_ServerCapabilities_linkedEditingRangeProvider struct { // line 8251
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [MonikerOptions MonikerRegistrationOptions bool]
+-type Or_ServerCapabilities_monikerProvider struct { // line 8293
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [NotebookDocumentSyncOptions NotebookDocumentSyncRegistrationOptions]
+-type Or_ServerCapabilities_notebookDocumentSync struct { // line 7843
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [ReferenceOptions bool]
+-type Or_ServerCapabilities_referencesProvider struct { // line 7982
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [RenameOptions bool]
+-type Or_ServerCapabilities_renameProvider struct { // line 8157
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [SelectionRangeOptions SelectionRangeRegistrationOptions bool]
+-type Or_ServerCapabilities_selectionRangeProvider struct { // line 8197
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [SemanticTokensOptions SemanticTokensRegistrationOptions]
+-type Or_ServerCapabilities_semanticTokensProvider struct { // line 8274
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [TextDocumentSyncKind TextDocumentSyncOptions]
+-type Or_ServerCapabilities_textDocumentSync struct { // line 7825
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [TypeDefinitionOptions TypeDefinitionRegistrationOptions bool]
+-type Or_ServerCapabilities_typeDefinitionProvider struct { // line 7938
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [TypeHierarchyOptions TypeHierarchyRegistrationOptions bool]
+-type Or_ServerCapabilities_typeHierarchyProvider struct { // line 8316
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [WorkspaceSymbolOptions bool]
+-type Or_ServerCapabilities_workspaceSymbolProvider struct { // line 8094
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [MarkupContent string]
+-type Or_SignatureInformation_documentation struct { // line 8842
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [AnnotatedTextEdit TextEdit]
+-type Or_TextDocumentEdit_edits_Elem struct { // line 6693
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [SaveOptions bool]
+-type Or_TextDocumentSyncOptions_save struct { // line 9778
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [WorkspaceFullDocumentDiagnosticReport WorkspaceUnchangedDocumentDiagnosticReport]
+-type Or_WorkspaceDocumentDiagnosticReport struct { // line 13987
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [CreateFile DeleteFile RenameFile TextDocumentEdit]
+-type Or_WorkspaceEdit_documentChanges_Elem struct { // line 3220
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Or [Declaration []DeclarationLink]
+-type Or_textDocument_declaration struct { // line 249
+- Value interface{} `json:"value"`
+-}
+-
+-// created for Literal (Lit_NotebookDocumentChangeEvent_cells)
+-type PCellsPChange struct { // line 7481
+- // Changes to the cell structure to add or
+- // remove cells.
+- Structure *FStructurePCells `json:"structure,omitempty"`
+- // Changes to notebook cells properties like its
+- // kind, execution summary or metadata.
+- Data []NotebookCell `json:"data,omitempty"`
+- // Changes to the text content of notebook cells.
+- TextContent []Lit_NotebookDocumentChangeEvent_cells_textContent_Elem `json:"textContent,omitempty"`
+-}
+-
+-// created for Literal (Lit_WorkspaceEditClientCapabilities_changeAnnotationSupport)
+-type PChangeAnnotationSupportPWorkspaceEdit struct { // line 10816
+- // Whether the client groups edits with equal labels into tree nodes,
+- // for instance all edits labelled with "Changes in Strings" would
+- // be a tree node.
+- GroupsOnLabel bool `json:"groupsOnLabel,omitempty"`
+-}
+-
+-// created for Literal (Lit_CodeActionClientCapabilities_codeActionLiteralSupport)
+-type PCodeActionLiteralSupportPCodeAction struct { // line 11736
+- // The code action kind is support with the following value
+- // set.
+- CodeActionKind FCodeActionKindPCodeActionLiteralSupport `json:"codeActionKind"`
+-}
+-
+-// created for Literal (Lit_CompletionClientCapabilities_completionItemKind)
+-type PCompletionItemKindPCompletion struct { // line 11334
+- // The completion item kind values the client supports. When this
+- // property exists the client also guarantees that it will
+- // handle values outside its set gracefully and falls back
+- // to a default value when unknown.
+- //
+- // If this property is not present the client only supports
+- // the completion items kinds from `Text` to `Reference` as defined in
+- // the initial version of the protocol.
+- ValueSet []CompletionItemKind `json:"valueSet,omitempty"`
+-}
+-
+-// created for Literal (Lit_CompletionClientCapabilities_completionItem)
+-type PCompletionItemPCompletion struct { // line 11183
+- // Client supports snippets as insert text.
+- //
+- // A snippet can define tab stops and placeholders with `$1`, `$2`
+- // and `${3:foo}`. `$0` defines the final tab stop, it defaults to
+- // the end of the snippet. Placeholders with equal identifiers are linked,
+- // that is typing in one will update others too.
+- SnippetSupport bool `json:"snippetSupport,omitempty"`
+- // Client supports commit characters on a completion item.
+- CommitCharactersSupport bool `json:"commitCharactersSupport,omitempty"`
+- // Client supports the following content formats for the documentation
+- // property. The order describes the preferred format of the client.
+- DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"`
+- // Client supports the deprecated property on a completion item.
+- DeprecatedSupport bool `json:"deprecatedSupport,omitempty"`
+- // Client supports the preselect property on a completion item.
+- PreselectSupport bool `json:"preselectSupport,omitempty"`
+- // Client supports the tag property on a completion item. Clients supporting
+- // tags have to handle unknown tags gracefully. Clients especially need to
+- // preserve unknown tags when sending a completion item back to the server in
+- // a resolve call.
+- //
+- // @since 3.15.0
+- TagSupport FTagSupportPCompletionItem `json:"tagSupport"`
+- // Client support insert replace edit to control different behavior if a
+- // completion item is inserted in the text or should replace text.
+- //
+- // @since 3.16.0
+- InsertReplaceSupport bool `json:"insertReplaceSupport,omitempty"`
+- // Indicates which properties a client can resolve lazily on a completion
+- // item. Before version 3.16.0 only the predefined properties `documentation`
+- // and `details` could be resolved lazily.
+- //
+- // @since 3.16.0
+- ResolveSupport *FResolveSupportPCompletionItem `json:"resolveSupport,omitempty"`
+- // The client supports the `insertTextMode` property on
+- // a completion item to override the whitespace handling mode
+- // as defined by the client (see `insertTextMode`).
+- //
+- // @since 3.16.0
+- InsertTextModeSupport *FInsertTextModeSupportPCompletionItem `json:"insertTextModeSupport,omitempty"`
+- // The client has support for completion item label
+- // details (see also `CompletionItemLabelDetails`).
+- //
+- // @since 3.17.0
+- LabelDetailsSupport bool `json:"labelDetailsSupport,omitempty"`
+-}
+-
+-// created for Literal (Lit_CompletionOptions_completionItem)
+-type PCompletionItemPCompletionProvider struct { // line 8747
+- // The server has support for completion item label
+- // details (see also `CompletionItemLabelDetails`) when
+- // receiving a completion item in a resolve call.
+- //
+- // @since 3.17.0
+- LabelDetailsSupport bool `json:"labelDetailsSupport,omitempty"`
+-}
+-
+-// created for Literal (Lit_CompletionClientCapabilities_completionList)
+-type PCompletionListPCompletion struct { // line 11376
+- // The client supports the following itemDefaults on
+- // a completion list.
+- //
+- // The value lists the supported property names of the
+- // `CompletionList.itemDefaults` object. If omitted
+- // no properties are supported.
+- //
+- // @since 3.17.0
+- ItemDefaults []string `json:"itemDefaults,omitempty"`
+-}
+-
+-// created for Literal (Lit_CodeAction_disabled)
+-type PDisabledMsg_textDocument_codeAction struct { // line 5427
+- // Human readable description of why the code action is currently disabled.
+- //
+- // This is displayed in the code actions UI.
+- Reason string `json:"reason"`
+-}
+-
+-// created for Literal (Lit_FoldingRangeClientCapabilities_foldingRangeKind)
+-type PFoldingRangeKindPFoldingRange struct { // line 12011
+- // The folding range kind values the client supports. When this
+- // property exists the client also guarantees that it will
+- // handle values outside its set gracefully and falls back
+- // to a default value when unknown.
+- ValueSet []FoldingRangeKind `json:"valueSet,omitempty"`
+-}
+-
+-// created for Literal (Lit_FoldingRangeClientCapabilities_foldingRange)
+-type PFoldingRangePFoldingRange struct { // line 12036
+- // If set, the client signals that it supports setting collapsedText on
+- // folding ranges to display custom labels instead of the default text.
+- //
+- // @since 3.17.0
+- CollapsedText bool `json:"collapsedText,omitempty"`
+-}
+-
+-// created for Literal (Lit_SemanticTokensOptions_full_Item1)
+-type PFullESemanticTokensOptions struct { // line 6587
+- // The server supports deltas for full documents.
+- Delta bool `json:"delta"`
+-}
+-
+-// created for Literal (Lit_CompletionList_itemDefaults)
+-type PItemDefaultsMsg_textDocument_completion struct { // line 4751
+- // A default commit character set.
+- //
+- // @since 3.17.0
+- CommitCharacters []string `json:"commitCharacters,omitempty"`
+- // A default edit range.
+- //
+- // @since 3.17.0
+- EditRange *OrFEditRangePItemDefaults `json:"editRange,omitempty"`
+- // A default insert text format.
+- //
+- // @since 3.17.0
+- InsertTextFormat *InsertTextFormat `json:"insertTextFormat,omitempty"`
+- // A default insert text mode.
+- //
+- // @since 3.17.0
+- InsertTextMode *InsertTextMode `json:"insertTextMode,omitempty"`
+- // A default data value.
+- //
+- // @since 3.17.0
+- Data interface{} `json:"data,omitempty"`
+-}
+-
+-// created for Literal (Lit_WorkspaceSymbol_location_Item1)
+-type PLocationMsg_workspace_symbol struct { // line 5528
+- URI DocumentURI `json:"uri"`
+-}
+-
+-// created for Literal (Lit_ShowMessageRequestClientCapabilities_messageActionItem)
+-type PMessageActionItemPShowMessage struct { // line 12464
+- // Whether the client supports additional attributes which
+- // are preserved and send back to the server in the
+- // request's response.
+- AdditionalPropertiesSupport bool `json:"additionalPropertiesSupport,omitempty"`
+-}
+-
+-// created for Literal (Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0)
+-type PNotebookSelectorPNotebookDocumentSync struct { // line 9806
+- // The notebook to be synced If a string
+- // value is provided it matches against the
+- // notebook type. '*' matches every notebook.
+- Notebook OrFNotebookPNotebookSelector `json:"notebook"`
+- // The cells of the matching notebook to be synced.
+- Cells []Lit_NotebookDocumentSyncOptions_notebookSelector_Elem_Item0_cells_Elem `json:"cells,omitempty"`
+-}
+-
+-// created for Literal (Lit_SemanticTokensOptions_range_Item1)
+-type PRangeESemanticTokensOptions struct { // line 6567
+-}
+-
+-// created for Literal (Lit_SemanticTokensClientCapabilities_requests)
+-type PRequestsPSemanticTokens struct { // line 12172
+- // The client will send the `textDocument/semanticTokens/range` request if
+- // the server provides a corresponding handler.
+- Range Or_SemanticTokensClientCapabilities_requests_range `json:"range"`
+- // The client will send the `textDocument/semanticTokens/full` request if
+- // the server provides a corresponding handler.
+- Full Or_SemanticTokensClientCapabilities_requests_full `json:"full"`
+-}
+-
+-// created for Literal (Lit_CodeActionClientCapabilities_resolveSupport)
+-type PResolveSupportPCodeAction struct { // line 11801
+- // The properties that a client can resolve lazily.
+- Properties []string `json:"properties"`
+-}
+-
+-// created for Literal (Lit_InlayHintClientCapabilities_resolveSupport)
+-type PResolveSupportPInlayHint struct { // line 12384
+- // The properties that a client can resolve lazily.
+- Properties []string `json:"properties"`
+-}
+-
+-// created for Literal (Lit_WorkspaceSymbolClientCapabilities_resolveSupport)
+-type PResolveSupportPSymbol struct { // line 10938
+- // The properties that a client can resolve lazily. Usually
+- // `location.range`
+- Properties []string `json:"properties"`
+-}
+-
+-// created for Literal (Lit_InitializeResult_serverInfo)
+-type PServerInfoMsg_initialize struct { // line 4096
+- // The name of the server as defined by the server.
+- Name string `json:"name"`
+- // The server's version as defined by the server.
+- Version string `json:"version,omitempty"`
+-}
+-
+-// created for Literal (Lit_SignatureHelpClientCapabilities_signatureInformation)
+-type PSignatureInformationPSignatureHelp struct { // line 11443
+- // Client supports the following content formats for the documentation
+- // property. The order describes the preferred format of the client.
+- DocumentationFormat []MarkupKind `json:"documentationFormat,omitempty"`
+- // Client capabilities specific to parameter information.
+- ParameterInformation *FParameterInformationPSignatureInformation `json:"parameterInformation,omitempty"`
+- // The client supports the `activeParameter` property on `SignatureInformation`
+- // literal.
+- //
+- // @since 3.16.0
+- ActiveParameterSupport bool `json:"activeParameterSupport,omitempty"`
+-}
+-
+-// created for Literal (Lit_GeneralClientCapabilities_staleRequestSupport)
+-type PStaleRequestSupportPGeneral struct { // line 10670
+- // The client will actively cancel the request.
+- Cancel bool `json:"cancel"`
+- // The list of requests for which the client
+- // will retry the request if it receives a
+- // response with error code `ContentModified`
+- RetryOnContentModified []string `json:"retryOnContentModified"`
+-}
+-
+-// created for Literal (Lit_DocumentSymbolClientCapabilities_symbolKind)
+-type PSymbolKindPDocumentSymbol struct { // line 11654
+- // The symbol kind values the client supports. When this
+- // property exists the client also guarantees that it will
+- // handle values outside its set gracefully and falls back
+- // to a default value when unknown.
+- //
+- // If this property is not present the client only supports
+- // the symbol kinds from `File` to `Array` as defined in
+- // the initial version of the protocol.
+- ValueSet []SymbolKind `json:"valueSet,omitempty"`
+-}
+-
+-// created for Literal (Lit_WorkspaceSymbolClientCapabilities_symbolKind)
+-type PSymbolKindPSymbol struct { // line 10890
+- // The symbol kind values the client supports. When this
+- // property exists the client also guarantees that it will
+- // handle values outside its set gracefully and falls back
+- // to a default value when unknown.
+- //
+- // If this property is not present the client only supports
+- // the symbol kinds from `File` to `Array` as defined in
+- // the initial version of the protocol.
+- ValueSet []SymbolKind `json:"valueSet,omitempty"`
+-}
+-
+-// created for Literal (Lit_DocumentSymbolClientCapabilities_tagSupport)
+-type PTagSupportPDocumentSymbol struct { // line 11687
+- // The tags supported by the client.
+- ValueSet []SymbolTag `json:"valueSet"`
+-}
+-
+-// created for Literal (Lit_PublishDiagnosticsClientCapabilities_tagSupport)
+-type PTagSupportPPublishDiagnostics struct { // line 12087
+- // The tags supported by the client.
+- ValueSet []DiagnosticTag `json:"valueSet"`
+-}
+-
+-// created for Literal (Lit_WorkspaceSymbolClientCapabilities_tagSupport)
+-type PTagSupportPSymbol struct { // line 10914
+- // The tags supported by the client.
+- ValueSet []SymbolTag `json:"valueSet"`
+-}
+-
+-// The parameters of a configuration request.
+-type ParamConfiguration struct { // line 2199
+- Items []ConfigurationItem `json:"items"`
+-}
+-type ParamInitialize struct { // line 4068
+- XInitializeParams
+- WorkspaceFoldersInitializeParams
+-}
+-
+-// Represents a parameter of a callable-signature. A parameter can
+-// have a label and a doc-comment.
+-type ParameterInformation struct { // line 10063
+- // The label of this parameter information.
+- //
+- // Either a string or an inclusive start and exclusive end offsets within its containing
+- // signature label. (see SignatureInformation.label). The offsets are based on a UTF-16
+- // string representation as `Position` and `Range` does.
+- //
+- // *Note*: a label of type string should be a substring of its containing signature label.
+- // Its intended use case is to highlight the parameter label part in the `SignatureInformation.label`.
+- Label string `json:"label"`
+- // The human-readable doc-comment of this parameter. Will be shown
+- // in the UI but can be omitted.
+- Documentation string `json:"documentation,omitempty"`
+-}
+-type PartialResultParams struct { // line 6258
+- // An optional token that a server can use to report partial results (e.g. streaming) to
+- // the client.
+- PartialResultToken *ProgressToken `json:"partialResultToken,omitempty"`
+-}
+-
+-// The glob pattern to watch relative to the base path. Glob patterns can have the following syntax:
+-//
+-// - `*` to match one or more characters in a path segment
+-// - `?` to match on one character in a path segment
+-// - `**` to match any number of path segments, including none
+-// - `{}` to group conditions (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)
+-// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
+-// - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
+-//
+-// @since 3.17.0
+-type Pattern = string // (alias) line 14363
+-// Position in a text document expressed as zero-based line and character
+-// offset. Prior to 3.17 the offsets were always based on a UTF-16 string
+-// representation. So a string of the form `a𐐀b` the character offset of the
+-// character `a` is 0, the character offset of `𐐀` is 1 and the character
+-// offset of b is 3 since `𐐀` is represented using two code units in UTF-16.
+-// Since 3.17 clients and servers can agree on a different string encoding
+-// representation (e.g. UTF-8). The client announces it's supported encoding
+-// via the client capability [`general.positionEncodings`](#clientCapabilities).
+-// The value is an array of position encodings the client supports, with
+-// decreasing preference (e.g. the encoding at index `0` is the most preferred
+-// one). To stay backwards compatible the only mandatory encoding is UTF-16
+-// represented via the string `utf-16`. The server can pick one of the
+-// encodings offered by the client and signals that encoding back to the
+-// client via the initialize result's property
+-// [`capabilities.positionEncoding`](#serverCapabilities). If the string value
+-// `utf-16` is missing from the client's capability `general.positionEncodings`
+-// servers can safely assume that the client supports UTF-16. If the server
+-// omits the position encoding in its initialize result the encoding defaults
+-// to the string value `utf-16`. Implementation considerations: since the
+-// conversion from one encoding into another requires the content of the
+-// file / line the conversion is best done where the file is read which is
+-// usually on the server side.
+-//
+-// Positions are line end character agnostic. So you can not specify a position
+-// that denotes `\r|\n` or `\n|` where `|` represents the character offset.
+-//
+-// @since 3.17.0 - support for negotiated position encoding.
+-type Position struct { // line 6501
+- // Line position in a document (zero-based).
+- //
+- // If a line number is greater than the number of lines in a document, it defaults back to the number of lines in the document.
+- // If a line number is negative, it defaults to 0.
+- Line uint32 `json:"line"`
+- // Character offset on a line in a document (zero-based).
+- //
+- // The meaning of this offset is determined by the negotiated
+- // `PositionEncodingKind`.
+- //
+- // If the character value is greater than the line length it defaults back to the
+- // line length.
+- Character uint32 `json:"character"`
+-}
+-
+-// A set of predefined position encoding kinds.
+-//
+-// @since 3.17.0
+-type PositionEncodingKind string // line 13427
+-type PrepareRename2Gn = Msg_PrepareRename2Gn // (alias) line 13927
+-type PrepareRenameParams struct { // line 5925
+- TextDocumentPositionParams
+- WorkDoneProgressParams
+-}
+-type PrepareRenameResult = Msg_PrepareRename2Gn // (alias) line 13927
+-type PrepareSupportDefaultBehavior uint32 // line 13722
+-// A previous result id in a workspace pull request.
+-//
+-// @since 3.17.0
+-type PreviousResultID struct { // line 7331
+- // The URI for which the client knowns a
+- // result id.
+- URI DocumentURI `json:"uri"`
+- // The value of the previous result id.
+- Value string `json:"value"`
+-}
+-
+-// A previous result id in a workspace pull request.
+-//
+-// @since 3.17.0
+-type PreviousResultId struct { // line 7331
+- // The URI for which the client knowns a
+- // result id.
+- URI DocumentURI `json:"uri"`
+- // The value of the previous result id.
+- Value string `json:"value"`
+-}
+-type ProgressParams struct { // line 6201
+- // The progress token provided by the client or server.
+- Token ProgressToken `json:"token"`
+- // The progress data.
+- Value interface{} `json:"value"`
+-}
+-type ProgressToken = interface{} // (alias) line 13960
+-// The publish diagnostic client capabilities.
+-type PublishDiagnosticsClientCapabilities struct { // line 12072
+- // Whether the clients accepts diagnostics with related information.
+- RelatedInformation bool `json:"relatedInformation,omitempty"`
+- // Client supports the tag property to provide meta data about a diagnostic.
+- // Clients supporting tags have to handle unknown tags gracefully.
+- //
+- // @since 3.15.0
+- TagSupport *PTagSupportPPublishDiagnostics `json:"tagSupport,omitempty"`
+- // Whether the client interprets the version property of the
+- // `textDocument/publishDiagnostics` notification's parameter.
+- //
+- // @since 3.15.0
+- VersionSupport bool `json:"versionSupport,omitempty"`
+- // Client supports a codeDescription property
+- //
+- // @since 3.16.0
+- CodeDescriptionSupport bool `json:"codeDescriptionSupport,omitempty"`
+- // Whether code action supports the `data` property which is
+- // preserved between a `textDocument/publishDiagnostics` and
+- // `textDocument/codeAction` request.
+- //
+- // @since 3.16.0
+- DataSupport bool `json:"dataSupport,omitempty"`
+-}
+-
+-// The publish diagnostic notification's parameters.
+-type PublishDiagnosticsParams struct { // line 4462
+- // The URI for which diagnostic information is reported.
+- URI DocumentURI `json:"uri"`
+- // Optional the version number of the document the diagnostics are published for.
+- //
+- // @since 3.15.0
+- Version int32 `json:"version,omitempty"`
+- // An array of diagnostic information items.
+- Diagnostics []Diagnostic `json:"diagnostics"`
+-}
+-
+-// A range in a text document expressed as (zero-based) start and end positions.
+-//
+-// If you want to specify a range that contains a line including the line ending
+-// character(s) then use an end position denoting the start of the next line.
+-// For example:
+-// ```ts
+-//
+-// {
+-// start: { line: 5, character: 23 }
+-// end : { line 6, character : 0 }
+-// }
+-//
+-// ```
+-type Range struct { // line 6311
+- // The range's start position.
+- Start Position `json:"start"`
+- // The range's end position.
+- End Position `json:"end"`
+-}
+-
+-// Client Capabilities for a {@link ReferencesRequest}.
+-type ReferenceClientCapabilities struct { // line 11609
+- // Whether references supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+-}
+-
+-// Value-object that contains additional information when
+-// requesting references.
+-type ReferenceContext struct { // line 8930
+- // Include the declaration of the current symbol.
+- IncludeDeclaration bool `json:"includeDeclaration"`
+-}
+-
+-// Reference options.
+-type ReferenceOptions struct { // line 8944
+- WorkDoneProgressOptions
+-}
+-
+-// Parameters for a {@link ReferencesRequest}.
+-type ReferenceParams struct { // line 5054
+- Context ReferenceContext `json:"context"`
+- TextDocumentPositionParams
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// Registration options for a {@link ReferencesRequest}.
+-type ReferenceRegistrationOptions struct { // line 5083
+- TextDocumentRegistrationOptions
+- ReferenceOptions
+-}
+-
+-// General parameters to to register for an notification or to register a provider.
+-type Registration struct { // line 7597
+- // The id used to register the request. The id can be used to deregister
+- // the request again.
+- ID string `json:"id"`
+- // The method / capability to register for.
+- Method string `json:"method"`
+- // Options necessary for the registration.
+- RegisterOptions interface{} `json:"registerOptions,omitempty"`
+-}
+-type RegistrationParams struct { // line 4038
+- Registrations []Registration `json:"registrations"`
+-}
+-
+-// Client capabilities specific to regular expressions.
+-//
+-// @since 3.16.0
+-type RegularExpressionsClientCapabilities struct { // line 12500
+- // The engine's name.
+- Engine string `json:"engine"`
+- // The engine's version.
+- Version string `json:"version,omitempty"`
+-}
+-
+-// A full diagnostic report with a set of related documents.
+-//
+-// @since 3.17.0
+-type RelatedFullDocumentDiagnosticReport struct { // line 7157
+- // Diagnostics of related documents. This information is useful
+- // in programming languages where code in a file A can generate
+- // diagnostics in a file B which A depends on. An example of
+- // such a language is C/C++ where marco definitions in a file
+- // a.cpp and result in errors in a header file b.hpp.
+- //
+- // @since 3.17.0
+- RelatedDocuments map[DocumentURI]interface{} `json:"relatedDocuments,omitempty"`
+- FullDocumentDiagnosticReport
+-}
+-
+-// An unchanged diagnostic report with a set of related documents.
+-//
+-// @since 3.17.0
+-type RelatedUnchangedDocumentDiagnosticReport struct { // line 7196
+- // Diagnostics of related documents. This information is useful
+- // in programming languages where code in a file A can generate
+- // diagnostics in a file B which A depends on. An example of
+- // such a language is C/C++ where marco definitions in a file
+- // a.cpp and result in errors in a header file b.hpp.
+- //
+- // @since 3.17.0
+- RelatedDocuments map[DocumentURI]interface{} `json:"relatedDocuments,omitempty"`
+- UnchangedDocumentDiagnosticReport
+-}
+-
+-// A relative pattern is a helper to construct glob patterns that are matched
+-// relatively to a base URI. The common value for a `baseUri` is a workspace
+-// folder root, but it can be another absolute URI as well.
+-//
+-// @since 3.17.0
+-type RelativePattern struct { // line 10736
+- // A workspace folder or a base URI to which this pattern will be matched
+- // against relatively.
+- BaseURI Or_RelativePattern_baseUri `json:"baseUri"`
+- // The actual glob pattern;
+- Pattern Pattern `json:"pattern"`
+-}
+-type RenameClientCapabilities struct { // line 11934
+- // Whether rename supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // Client supports testing for validity of rename operations
+- // before execution.
+- //
+- // @since 3.12.0
+- PrepareSupport bool `json:"prepareSupport,omitempty"`
+- // Client supports the default behavior result.
+- //
+- // The value indicates the default behavior used by the
+- // client.
+- //
+- // @since 3.16.0
+- PrepareSupportDefaultBehavior *PrepareSupportDefaultBehavior `json:"prepareSupportDefaultBehavior,omitempty"`
+- // Whether the client honors the change annotations in
+- // text edits and resource operations returned via the
+- // rename request's workspace edit by for example presenting
+- // the workspace edit in the user interface and asking
+- // for confirmation.
+- //
+- // @since 3.16.0
+- HonorsChangeAnnotations bool `json:"honorsChangeAnnotations,omitempty"`
+-}
+-
+-// Rename file operation
+-type RenameFile struct { // line 6749
+- // A rename
+- Kind string `json:"kind"`
+- // The old (existing) location.
+- OldURI DocumentURI `json:"oldUri"`
+- // The new location.
+- NewURI DocumentURI `json:"newUri"`
+- // Rename options.
+- Options *RenameFileOptions `json:"options,omitempty"`
+- ResourceOperation
+-}
+-
+-// Rename file options
+-type RenameFileOptions struct { // line 9441
+- // Overwrite target if existing. Overwrite wins over `ignoreIfExists`
+- Overwrite bool `json:"overwrite,omitempty"`
+- // Ignores if target exists.
+- IgnoreIfExists bool `json:"ignoreIfExists,omitempty"`
+-}
+-
+-// The parameters sent in notifications/requests for user-initiated renames of
+-// files.
+-//
+-// @since 3.16.0
+-type RenameFilesParams struct { // line 3282
+- // An array of all files/folders renamed in this operation. When a folder is renamed, only
+- // the folder will be included, and not its children.
+- Files []FileRename `json:"files"`
+-}
+-
+-// Provider options for a {@link RenameRequest}.
+-type RenameOptions struct { // line 9269
+- // Renames should be checked and tested before being executed.
+- //
+- // @since version 3.12.0
+- PrepareProvider bool `json:"prepareProvider,omitempty"`
+- WorkDoneProgressOptions
+-}
+-
+-// The parameters of a {@link RenameRequest}.
+-type RenameParams struct { // line 5874
+- // The document to rename.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- // The position at which this request was sent.
+- Position Position `json:"position"`
+- // The new name of the symbol. If the given name is not valid the
+- // request must return a {@link ResponseError} with an
+- // appropriate message set.
+- NewName string `json:"newName"`
+- WorkDoneProgressParams
+-}
+-
+-// Registration options for a {@link RenameRequest}.
+-type RenameRegistrationOptions struct { // line 5910
+- TextDocumentRegistrationOptions
+- RenameOptions
+-}
+-
+-// A generic resource operation.
+-type ResourceOperation struct { // line 9393
+- // The resource operation kind.
+- Kind string `json:"kind"`
+- // An optional annotation identifier describing the operation.
+- //
+- // @since 3.16.0
+- AnnotationID *ChangeAnnotationIdentifier `json:"annotationId,omitempty"`
+-}
+-type ResourceOperationKind string // line 13669
+-// Save options.
+-type SaveOptions struct { // line 8465
+- // The client is supposed to include the content on save.
+- IncludeText bool `json:"includeText,omitempty"`
+-}
+-
+-// A selection range represents a part of a selection hierarchy. A selection range
+-// may have a parent selection range that contains it.
+-type SelectionRange struct { // line 2569
+- // The {@link Range range} of this selection range.
+- Range Range `json:"range"`
+- // The parent selection range containing this range. Therefore `parent.range` must contain `this.range`.
+- Parent *SelectionRange `json:"parent,omitempty"`
+-}
+-type SelectionRangeClientCapabilities struct { // line 12058
+- // Whether implementation supports dynamic registration for selection range providers. If this is set to `true`
+- // the client supports the new `SelectionRangeRegistrationOptions` return value for the corresponding server
+- // capability as well.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+-}
+-type SelectionRangeOptions struct { // line 6524
+- WorkDoneProgressOptions
+-}
+-
+-// A parameter literal used in selection range requests.
+-type SelectionRangeParams struct { // line 2534
+- // The text document.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- // The positions inside the text document.
+- Positions []Position `json:"positions"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-type SelectionRangeRegistrationOptions struct { // line 2592
+- SelectionRangeOptions
+- TextDocumentRegistrationOptions
+- StaticRegistrationOptions
+-}
+-
+-// A set of predefined token modifiers. This set is not fixed
+-// an clients can specify additional token types via the
+-// corresponding client capabilities.
+-//
+-// @since 3.16.0
+-type SemanticTokenModifiers string // line 12670
+-// A set of predefined token types. This set is not fixed
+-// an clients can specify additional token types via the
+-// corresponding client capabilities.
+-//
+-// @since 3.16.0
+-type SemanticTokenTypes string // line 12563
+-// @since 3.16.0
+-type SemanticTokens struct { // line 2880
+- // An optional result id. If provided and clients support delta updating
+- // the client will include the result id in the next semantic token request.
+- // A server can then instead of computing all semantic tokens again simply
+- // send a delta.
+- ResultID string `json:"resultId,omitempty"`
+- // The actual tokens.
+- Data []uint32 `json:"data"`
+-}
+-
+-// @since 3.16.0
+-type SemanticTokensClientCapabilities struct { // line 12157
+- // Whether implementation supports dynamic registration. If this is set to `true`
+- // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
+- // return value for the corresponding server capability as well.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // Which requests the client supports and might send to the server
+- // depending on the server's capability. Please note that clients might not
+- // show semantic tokens or degrade some of the user experience if a range
+- // or full request is advertised by the client but not provided by the
+- // server. If for example the client capability `requests.full` and
+- // `request.range` are both set to true but the server only provides a
+- // range provider the client might not render a minimap correctly or might
+- // even decide to not show any semantic tokens at all.
+- Requests PRequestsPSemanticTokens `json:"requests"`
+- // The token types that the client supports.
+- TokenTypes []string `json:"tokenTypes"`
+- // The token modifiers that the client supports.
+- TokenModifiers []string `json:"tokenModifiers"`
+- // The token formats the clients supports.
+- Formats []TokenFormat `json:"formats"`
+- // Whether the client supports tokens that can overlap each other.
+- OverlappingTokenSupport bool `json:"overlappingTokenSupport,omitempty"`
+- // Whether the client supports tokens that can span multiple lines.
+- MultilineTokenSupport bool `json:"multilineTokenSupport,omitempty"`
+- // Whether the client allows the server to actively cancel a
+- // semantic token request, e.g. supports returning
+- // LSPErrorCodes.ServerCancelled. If a server does the client
+- // needs to retrigger the request.
+- //
+- // @since 3.17.0
+- ServerCancelSupport bool `json:"serverCancelSupport,omitempty"`
+- // Whether the client uses semantic tokens to augment existing
+- // syntax tokens. If set to `true` client side created syntax
+- // tokens and semantic tokens are both used for colorization. If
+- // set to `false` the client only uses the returned semantic tokens
+- // for colorization.
+- //
+- // If the value is `undefined` then the client behavior is not
+- // specified.
+- //
+- // @since 3.17.0
+- AugmentsSyntaxTokens bool `json:"augmentsSyntaxTokens,omitempty"`
+-}
+-
+-// @since 3.16.0
+-type SemanticTokensDelta struct { // line 2979
+- ResultID string `json:"resultId,omitempty"`
+- // The semantic token edits to transform a previous result into a new result.
+- Edits []SemanticTokensEdit `json:"edits"`
+-}
+-
+-// @since 3.16.0
+-type SemanticTokensDeltaParams struct { // line 2946
+- // The text document.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- // The result id of a previous response. The result Id can either point to a full response
+- // or a delta response depending on what was received last.
+- PreviousResultID string `json:"previousResultId"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// @since 3.16.0
+-type SemanticTokensDeltaPartialResult struct { // line 3005
+- Edits []SemanticTokensEdit `json:"edits"`
+-}
+-
+-// @since 3.16.0
+-type SemanticTokensEdit struct { // line 6617
+- // The start offset of the edit.
+- Start uint32 `json:"start"`
+- // The count of elements to remove.
+- DeleteCount uint32 `json:"deleteCount"`
+- // The elements to insert.
+- Data []uint32 `json:"data,omitempty"`
+-}
+-
+-// @since 3.16.0
+-type SemanticTokensLegend struct { // line 9314
+- // The token types a server uses.
+- TokenTypes []string `json:"tokenTypes"`
+- // The token modifiers a server uses.
+- TokenModifiers []string `json:"tokenModifiers"`
+-}
+-
+-// @since 3.16.0
+-type SemanticTokensOptions struct { // line 6546
+- // The legend used by the server
+- Legend SemanticTokensLegend `json:"legend"`
+- // Server supports providing semantic tokens for a specific range
+- // of a document.
+- Range *Or_SemanticTokensOptions_range `json:"range,omitempty"`
+- // Server supports providing semantic tokens for a full document.
+- Full *Or_SemanticTokensOptions_full `json:"full,omitempty"`
+- WorkDoneProgressOptions
+-}
+-
+-// @since 3.16.0
+-type SemanticTokensParams struct { // line 2855
+- // The text document.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// @since 3.16.0
+-type SemanticTokensPartialResult struct { // line 2907
+- Data []uint32 `json:"data"`
+-}
+-
+-// @since 3.16.0
+-type SemanticTokensRangeParams struct { // line 3022
+- // The text document.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- // The range the semantic tokens are requested for.
+- Range Range `json:"range"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// @since 3.16.0
+-type SemanticTokensRegistrationOptions struct { // line 2924
+- TextDocumentRegistrationOptions
+- SemanticTokensOptions
+- StaticRegistrationOptions
+-}
+-
+-// @since 3.16.0
+-type SemanticTokensWorkspaceClientCapabilities struct { // line 10977
+- // Whether the client implementation supports a refresh request sent from
+- // the server to the client.
+- //
+- // Note that this event is global and will force the client to refresh all
+- // semantic tokens currently shown. It should be used with absolute care
+- // and is useful for situation where a server for example detects a project
+- // wide change that requires such a calculation.
+- RefreshSupport bool `json:"refreshSupport,omitempty"`
+-}
+-
+-// Defines the capabilities provided by a language
+-// server.
+-type ServerCapabilities struct { // line 7809
+- // The position encoding the server picked from the encodings offered
+- // by the client via the client capability `general.positionEncodings`.
+- //
+- // If the client didn't provide any position encodings the only valid
+- // value that a server can return is 'utf-16'.
+- //
+- // If omitted it defaults to 'utf-16'.
+- //
+- // @since 3.17.0
+- PositionEncoding *PositionEncodingKind `json:"positionEncoding,omitempty"`
+- // Defines how text documents are synced. Is either a detailed structure
+- // defining each notification or for backwards compatibility the
+- // TextDocumentSyncKind number.
+- TextDocumentSync interface{} `json:"textDocumentSync,omitempty"`
+- // Defines how notebook documents are synced.
+- //
+- // @since 3.17.0
+- NotebookDocumentSync *Or_ServerCapabilities_notebookDocumentSync `json:"notebookDocumentSync,omitempty"`
+- // The server provides completion support.
+- CompletionProvider *CompletionOptions `json:"completionProvider,omitempty"`
+- // The server provides hover support.
+- HoverProvider *Or_ServerCapabilities_hoverProvider `json:"hoverProvider,omitempty"`
+- // The server provides signature help support.
+- SignatureHelpProvider *SignatureHelpOptions `json:"signatureHelpProvider,omitempty"`
+- // The server provides Goto Declaration support.
+- DeclarationProvider *Or_ServerCapabilities_declarationProvider `json:"declarationProvider,omitempty"`
+- // The server provides goto definition support.
+- DefinitionProvider *Or_ServerCapabilities_definitionProvider `json:"definitionProvider,omitempty"`
+- // The server provides Goto Type Definition support.
+- TypeDefinitionProvider *Or_ServerCapabilities_typeDefinitionProvider `json:"typeDefinitionProvider,omitempty"`
+- // The server provides Goto Implementation support.
+- ImplementationProvider *Or_ServerCapabilities_implementationProvider `json:"implementationProvider,omitempty"`
+- // The server provides find references support.
+- ReferencesProvider *Or_ServerCapabilities_referencesProvider `json:"referencesProvider,omitempty"`
+- // The server provides document highlight support.
+- DocumentHighlightProvider *Or_ServerCapabilities_documentHighlightProvider `json:"documentHighlightProvider,omitempty"`
+- // The server provides document symbol support.
+- DocumentSymbolProvider *Or_ServerCapabilities_documentSymbolProvider `json:"documentSymbolProvider,omitempty"`
+- // The server provides code actions. CodeActionOptions may only be
+- // specified if the client states that it supports
+- // `codeActionLiteralSupport` in its initial `initialize` request.
+- CodeActionProvider interface{} `json:"codeActionProvider,omitempty"`
+- // The server provides code lens.
+- CodeLensProvider *CodeLensOptions `json:"codeLensProvider,omitempty"`
+- // The server provides document link support.
+- DocumentLinkProvider *DocumentLinkOptions `json:"documentLinkProvider,omitempty"`
+- // The server provides color provider support.
+- ColorProvider *Or_ServerCapabilities_colorProvider `json:"colorProvider,omitempty"`
+- // The server provides workspace symbol support.
+- WorkspaceSymbolProvider *Or_ServerCapabilities_workspaceSymbolProvider `json:"workspaceSymbolProvider,omitempty"`
+- // The server provides document formatting.
+- DocumentFormattingProvider *Or_ServerCapabilities_documentFormattingProvider `json:"documentFormattingProvider,omitempty"`
+- // The server provides document range formatting.
+- DocumentRangeFormattingProvider *Or_ServerCapabilities_documentRangeFormattingProvider `json:"documentRangeFormattingProvider,omitempty"`
+- // The server provides document formatting on typing.
+- DocumentOnTypeFormattingProvider *DocumentOnTypeFormattingOptions `json:"documentOnTypeFormattingProvider,omitempty"`
+- // The server provides rename support. RenameOptions may only be
+- // specified if the client states that it supports
+- // `prepareSupport` in its initial `initialize` request.
+- RenameProvider interface{} `json:"renameProvider,omitempty"`
+- // The server provides folding provider support.
+- FoldingRangeProvider *Or_ServerCapabilities_foldingRangeProvider `json:"foldingRangeProvider,omitempty"`
+- // The server provides selection range support.
+- SelectionRangeProvider *Or_ServerCapabilities_selectionRangeProvider `json:"selectionRangeProvider,omitempty"`
+- // The server provides execute command support.
+- ExecuteCommandProvider *ExecuteCommandOptions `json:"executeCommandProvider,omitempty"`
+- // The server provides call hierarchy support.
+- //
+- // @since 3.16.0
+- CallHierarchyProvider *Or_ServerCapabilities_callHierarchyProvider `json:"callHierarchyProvider,omitempty"`
+- // The server provides linked editing range support.
+- //
+- // @since 3.16.0
+- LinkedEditingRangeProvider *Or_ServerCapabilities_linkedEditingRangeProvider `json:"linkedEditingRangeProvider,omitempty"`
+- // The server provides semantic tokens support.
+- //
+- // @since 3.16.0
+- SemanticTokensProvider interface{} `json:"semanticTokensProvider,omitempty"`
+- // The server provides moniker support.
+- //
+- // @since 3.16.0
+- MonikerProvider *Or_ServerCapabilities_monikerProvider `json:"monikerProvider,omitempty"`
+- // The server provides type hierarchy support.
+- //
+- // @since 3.17.0
+- TypeHierarchyProvider *Or_ServerCapabilities_typeHierarchyProvider `json:"typeHierarchyProvider,omitempty"`
+- // The server provides inline values.
+- //
+- // @since 3.17.0
+- InlineValueProvider *Or_ServerCapabilities_inlineValueProvider `json:"inlineValueProvider,omitempty"`
+- // The server provides inlay hints.
+- //
+- // @since 3.17.0
+- InlayHintProvider interface{} `json:"inlayHintProvider,omitempty"`
+- // The server has support for pull model diagnostics.
+- //
+- // @since 3.17.0
+- DiagnosticProvider *Or_ServerCapabilities_diagnosticProvider `json:"diagnosticProvider,omitempty"`
+- // Workspace specific server capabilities.
+- Workspace *Workspace6Gn `json:"workspace,omitempty"`
+- // Experimental server capabilities.
+- Experimental interface{} `json:"experimental,omitempty"`
+-}
+-type SetTraceParams struct { // line 6147
+- Value TraceValues `json:"value"`
+-}
+-
+-// Client capabilities for the showDocument request.
+-//
+-// @since 3.16.0
+-type ShowDocumentClientCapabilities struct { // line 12485
+- // The client has support for the showDocument
+- // request.
+- Support bool `json:"support"`
+-}
+-
+-// Params to show a document.
+-//
+-// @since 3.16.0
+-type ShowDocumentParams struct { // line 3055
+- // The document uri to show.
+- URI URI `json:"uri"`
+- // Indicates to show the resource in an external program.
+- // To show for example `https://code.visualstudio.com/`
+- // in the default WEB browser set `external` to `true`.
+- External bool `json:"external,omitempty"`
+- // An optional property to indicate whether the editor
+- // showing the document should take focus or not.
+- // Clients might ignore this property if an external
+- // program is started.
+- TakeFocus bool `json:"takeFocus,omitempty"`
+- // An optional selection range if the document is a text
+- // document. Clients might ignore the property if an
+- // external program is started or the file is not a text
+- // file.
+- Selection *Range `json:"selection,omitempty"`
+-}
+-
+-// The result of a showDocument request.
+-//
+-// @since 3.16.0
+-type ShowDocumentResult struct { // line 3097
+- // A boolean indicating if the show was successful.
+- Success bool `json:"success"`
+-}
+-
+-// The parameters of a notification message.
+-type ShowMessageParams struct { // line 4183
+- // The message type. See {@link MessageType}
+- Type MessageType `json:"type"`
+- // The actual message.
+- Message string `json:"message"`
+-}
+-
+-// Show message request client capabilities
+-type ShowMessageRequestClientCapabilities struct { // line 12458
+- // Capabilities specific to the `MessageActionItem` type.
+- MessageActionItem *PMessageActionItemPShowMessage `json:"messageActionItem,omitempty"`
+-}
+-type ShowMessageRequestParams struct { // line 4205
+- // The message type. See {@link MessageType}
+- Type MessageType `json:"type"`
+- // The actual message.
+- Message string `json:"message"`
+- // The message action items to present.
+- Actions []MessageActionItem `json:"actions,omitempty"`
+-}
+-
+-// Signature help represents the signature of something
+-// callable. There can be multiple signature but only one
+-// active and only one active parameter.
+-type SignatureHelp struct { // line 4968
+- // One or more signatures.
+- Signatures []SignatureInformation `json:"signatures"`
+- // The active signature. If omitted or the value lies outside the
+- // range of `signatures` the value defaults to zero or is ignored if
+- // the `SignatureHelp` has no signatures.
+- //
+- // Whenever possible implementors should make an active decision about
+- // the active signature and shouldn't rely on a default value.
+- //
+- // In future version of the protocol this property might become
+- // mandatory to better express this.
+- ActiveSignature uint32 `json:"activeSignature,omitempty"`
+- // The active parameter of the active signature. If omitted or the value
+- // lies outside the range of `signatures[activeSignature].parameters`
+- // defaults to 0 if the active signature has parameters. If
+- // the active signature has no parameters it is ignored.
+- // In future version of the protocol this property might become
+- // mandatory to better express the active parameter if the
+- // active signature does have any.
+- ActiveParameter uint32 `json:"activeParameter,omitempty"`
+-}
+-
+-// Client Capabilities for a {@link SignatureHelpRequest}.
+-type SignatureHelpClientCapabilities struct { // line 11428
+- // Whether signature help supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // The client supports the following `SignatureInformation`
+- // specific properties.
+- SignatureInformation *PSignatureInformationPSignatureHelp `json:"signatureInformation,omitempty"`
+- // The client supports to send additional context information for a
+- // `textDocument/signatureHelp` request. A client that opts into
+- // contextSupport will also support the `retriggerCharacters` on
+- // `SignatureHelpOptions`.
+- //
+- // @since 3.15.0
+- ContextSupport bool `json:"contextSupport,omitempty"`
+-}
+-
+-// Additional information about the context in which a signature help request was triggered.
+-//
+-// @since 3.15.0
+-type SignatureHelpContext struct { // line 8787
+- // Action that caused signature help to be triggered.
+- TriggerKind SignatureHelpTriggerKind `json:"triggerKind"`
+- // Character that caused signature help to be triggered.
+- //
+- // This is undefined when `triggerKind !== SignatureHelpTriggerKind.TriggerCharacter`
+- TriggerCharacter string `json:"triggerCharacter,omitempty"`
+- // `true` if signature help was already showing when it was triggered.
+- //
+- // Retriggers occurs when the signature help is already active and can be caused by actions such as
+- // typing a trigger character, a cursor move, or document content changes.
+- IsRetrigger bool `json:"isRetrigger"`
+- // The currently active `SignatureHelp`.
+- //
+- // The `activeSignatureHelp` has its `SignatureHelp.activeSignature` field updated based on
+- // the user navigating through available signatures.
+- ActiveSignatureHelp *SignatureHelp `json:"activeSignatureHelp,omitempty"`
+-}
+-
+-// Server Capabilities for a {@link SignatureHelpRequest}.
+-type SignatureHelpOptions struct { // line 8882
+- // List of characters that trigger signature help automatically.
+- TriggerCharacters []string `json:"triggerCharacters,omitempty"`
+- // List of characters that re-trigger signature help.
+- //
+- // These trigger characters are only active when signature help is already showing. All trigger characters
+- // are also counted as re-trigger characters.
+- //
+- // @since 3.15.0
+- RetriggerCharacters []string `json:"retriggerCharacters,omitempty"`
+- WorkDoneProgressOptions
+-}
+-
+-// Parameters for a {@link SignatureHelpRequest}.
+-type SignatureHelpParams struct { // line 4940
+- // The signature help context. This is only available if the client specifies
+- // to send this using the client capability `textDocument.signatureHelp.contextSupport === true`
+- //
+- // @since 3.15.0
+- Context *SignatureHelpContext `json:"context,omitempty"`
+- TextDocumentPositionParams
+- WorkDoneProgressParams
+-}
+-
+-// Registration options for a {@link SignatureHelpRequest}.
+-type SignatureHelpRegistrationOptions struct { // line 5003
+- TextDocumentRegistrationOptions
+- SignatureHelpOptions
+-}
+-
+-// How a signature help was triggered.
+-//
+-// @since 3.15.0
+-type SignatureHelpTriggerKind uint32 // line 13580
+-// Represents the signature of something callable. A signature
+-// can have a label, like a function-name, a doc-comment, and
+-// a set of parameters.
+-type SignatureInformation struct { // line 8828
+- // The label of this signature. Will be shown in
+- // the UI.
+- Label string `json:"label"`
+- // The human-readable doc-comment of this signature. Will be shown
+- // in the UI but can be omitted.
+- Documentation *Or_SignatureInformation_documentation `json:"documentation,omitempty"`
+- // The parameters of this signature.
+- Parameters []ParameterInformation `json:"parameters,omitempty"`
+- // The index of the active parameter.
+- //
+- // If provided, this is used in place of `SignatureHelp.activeParameter`.
+- //
+- // @since 3.16.0
+- ActiveParameter uint32 `json:"activeParameter,omitempty"`
+-}
+-
+-// Static registration options to be returned in the initialize
+-// request.
+-type StaticRegistrationOptions struct { // line 6343
+- // The id used to register the request. The id can be used to deregister
+- // the request again. See also Registration#id.
+- ID string `json:"id,omitempty"`
+-}
+-
+-// Represents information about programming constructs like variables, classes,
+-// interfaces etc.
+-type SymbolInformation struct { // line 5181
+- // extends BaseSymbolInformation
+- // Indicates if this symbol is deprecated.
+- //
+- // @deprecated Use tags instead
+- Deprecated bool `json:"deprecated,omitempty"`
+- // The location of this symbol. The location's range is used by a tool
+- // to reveal the location in the editor. If the symbol is selected in the
+- // tool the range's start information is used to position the cursor. So
+- // the range usually spans more than the actual symbol's name and does
+- // normally include things like visibility modifiers.
+- //
+- // The range doesn't have to denote a node range in the sense of an abstract
+- // syntax tree. It can therefore not be used to re-construct a hierarchy of
+- // the symbols.
+- Location Location `json:"location"`
+- // The name of this symbol.
+- Name string `json:"name"`
+- // The kind of this symbol.
+- Kind SymbolKind `json:"kind"`
+- // Tags for this symbol.
+- //
+- // @since 3.16.0
+- Tags []SymbolTag `json:"tags,omitempty"`
+- // The name of the symbol containing this symbol. This information is for
+- // user interface purposes (e.g. to render a qualifier in the user interface
+- // if necessary). It can't be used to re-infer a hierarchy for the document
+- // symbols.
+- ContainerName string `json:"containerName,omitempty"`
+-}
+-
+-// A symbol kind.
+-type SymbolKind uint32 // line 12841
+-// Symbol tags are extra annotations that tweak the rendering of a symbol.
+-//
+-// @since 3.16
+-type SymbolTag uint32 // line 12955
+-// Describe options to be used when registered for text document change events.
+-type TextDocumentChangeRegistrationOptions struct { // line 4312
+- // How documents are synced to the server.
+- SyncKind TextDocumentSyncKind `json:"syncKind"`
+- TextDocumentRegistrationOptions
+-}
+-
+-// Text document specific client capabilities.
+-type TextDocumentClientCapabilities struct { // line 10323
+- // Defines which synchronization capabilities the client supports.
+- Synchronization *TextDocumentSyncClientCapabilities `json:"synchronization,omitempty"`
+- // Capabilities specific to the `textDocument/completion` request.
+- Completion CompletionClientCapabilities `json:"completion,omitempty"`
+- // Capabilities specific to the `textDocument/hover` request.
+- Hover *HoverClientCapabilities `json:"hover,omitempty"`
+- // Capabilities specific to the `textDocument/signatureHelp` request.
+- SignatureHelp *SignatureHelpClientCapabilities `json:"signatureHelp,omitempty"`
+- // Capabilities specific to the `textDocument/declaration` request.
+- //
+- // @since 3.14.0
+- Declaration *DeclarationClientCapabilities `json:"declaration,omitempty"`
+- // Capabilities specific to the `textDocument/definition` request.
+- Definition *DefinitionClientCapabilities `json:"definition,omitempty"`
+- // Capabilities specific to the `textDocument/typeDefinition` request.
+- //
+- // @since 3.6.0
+- TypeDefinition *TypeDefinitionClientCapabilities `json:"typeDefinition,omitempty"`
+- // Capabilities specific to the `textDocument/implementation` request.
+- //
+- // @since 3.6.0
+- Implementation *ImplementationClientCapabilities `json:"implementation,omitempty"`
+- // Capabilities specific to the `textDocument/references` request.
+- References *ReferenceClientCapabilities `json:"references,omitempty"`
+- // Capabilities specific to the `textDocument/documentHighlight` request.
+- DocumentHighlight *DocumentHighlightClientCapabilities `json:"documentHighlight,omitempty"`
+- // Capabilities specific to the `textDocument/documentSymbol` request.
+- DocumentSymbol DocumentSymbolClientCapabilities `json:"documentSymbol,omitempty"`
+- // Capabilities specific to the `textDocument/codeAction` request.
+- CodeAction CodeActionClientCapabilities `json:"codeAction,omitempty"`
+- // Capabilities specific to the `textDocument/codeLens` request.
+- CodeLens *CodeLensClientCapabilities `json:"codeLens,omitempty"`
+- // Capabilities specific to the `textDocument/documentLink` request.
+- DocumentLink *DocumentLinkClientCapabilities `json:"documentLink,omitempty"`
+- // Capabilities specific to the `textDocument/documentColor` and the
+- // `textDocument/colorPresentation` request.
+- //
+- // @since 3.6.0
+- ColorProvider *DocumentColorClientCapabilities `json:"colorProvider,omitempty"`
+- // Capabilities specific to the `textDocument/formatting` request.
+- Formatting *DocumentFormattingClientCapabilities `json:"formatting,omitempty"`
+- // Capabilities specific to the `textDocument/rangeFormatting` request.
+- RangeFormatting *DocumentRangeFormattingClientCapabilities `json:"rangeFormatting,omitempty"`
+- // Capabilities specific to the `textDocument/onTypeFormatting` request.
+- OnTypeFormatting *DocumentOnTypeFormattingClientCapabilities `json:"onTypeFormatting,omitempty"`
+- // Capabilities specific to the `textDocument/rename` request.
+- Rename *RenameClientCapabilities `json:"rename,omitempty"`
+- // Capabilities specific to the `textDocument/foldingRange` request.
+- //
+- // @since 3.10.0
+- FoldingRange *FoldingRangeClientCapabilities `json:"foldingRange,omitempty"`
+- // Capabilities specific to the `textDocument/selectionRange` request.
+- //
+- // @since 3.15.0
+- SelectionRange *SelectionRangeClientCapabilities `json:"selectionRange,omitempty"`
+- // Capabilities specific to the `textDocument/publishDiagnostics` notification.
+- PublishDiagnostics PublishDiagnosticsClientCapabilities `json:"publishDiagnostics,omitempty"`
+- // Capabilities specific to the various call hierarchy requests.
+- //
+- // @since 3.16.0
+- CallHierarchy *CallHierarchyClientCapabilities `json:"callHierarchy,omitempty"`
+- // Capabilities specific to the various semantic token request.
+- //
+- // @since 3.16.0
+- SemanticTokens SemanticTokensClientCapabilities `json:"semanticTokens,omitempty"`
+- // Capabilities specific to the `textDocument/linkedEditingRange` request.
+- //
+- // @since 3.16.0
+- LinkedEditingRange *LinkedEditingRangeClientCapabilities `json:"linkedEditingRange,omitempty"`
+- // Client capabilities specific to the `textDocument/moniker` request.
+- //
+- // @since 3.16.0
+- Moniker *MonikerClientCapabilities `json:"moniker,omitempty"`
+- // Capabilities specific to the various type hierarchy requests.
+- //
+- // @since 3.17.0
+- TypeHierarchy *TypeHierarchyClientCapabilities `json:"typeHierarchy,omitempty"`
+- // Capabilities specific to the `textDocument/inlineValue` request.
+- //
+- // @since 3.17.0
+- InlineValue *InlineValueClientCapabilities `json:"inlineValue,omitempty"`
+- // Capabilities specific to the `textDocument/inlayHint` request.
+- //
+- // @since 3.17.0
+- InlayHint *InlayHintClientCapabilities `json:"inlayHint,omitempty"`
+- // Capabilities specific to the diagnostic pull model.
+- //
+- // @since 3.17.0
+- Diagnostic *DiagnosticClientCapabilities `json:"diagnostic,omitempty"`
+-}
+-
+-// An event describing a change to a text document. If only a text is provided
+-// it is considered to be the full content of the document.
+-type TextDocumentContentChangeEvent = Msg_TextDocumentContentChangeEvent // (alias) line 14002
+-// Describes textual changes on a text document. A TextDocumentEdit describes all changes
+-// on a document version Si and after they are applied move the document to version Si+1.
+-// So the creator of a TextDocumentEdit doesn't need to sort the array of edits or do any
+-// kind of ordering. However the edits must be non overlapping.
+-type TextDocumentEdit struct { // line 6677
+- // The text document to change.
+- TextDocument OptionalVersionedTextDocumentIdentifier `json:"textDocument"`
+- // The edits to be applied.
+- //
+- // @since 3.16.0 - support for AnnotatedTextEdit. This is guarded using a
+- // client capability.
+- Edits []TextEdit `json:"edits"`
+-}
+-
+-// A document filter denotes a document by different properties like
+-// the {@link TextDocument.languageId language}, the {@link Uri.scheme scheme} of
+-// its resource, or a glob-pattern that is applied to the {@link TextDocument.fileName path}.
+-//
+-// Glob patterns can have the following syntax:
+-//
+-// - `*` to match one or more characters in a path segment
+-// - `?` to match on one character in a path segment
+-// - `**` to match any number of path segments, including none
+-// - `{}` to group sub patterns into an OR expression. (e.g. `**​/*.{ts,js}` matches all TypeScript and JavaScript files)
+-// - `[]` to declare a range of characters to match in a path segment (e.g., `example.[0-9]` to match on `example.0`, `example.1`, …)
+-// - `[!...]` to negate a range of characters to match in a path segment (e.g., `example.[!0-9]` to match on `example.a`, `example.b`, but not `example.0`)
+-//
+-// @sample A language filter that applies to typescript files on disk: `{ language: 'typescript', scheme: 'file' }`
+-// @sample A language filter that applies to all package.json paths: `{ language: 'json', pattern: '**package.json' }`
+-//
+-// @since 3.17.0
+-type TextDocumentFilter = Msg_TextDocumentFilter // (alias) line 14145
+-// A literal to identify a text document in the client.
+-type TextDocumentIdentifier struct { // line 6419
+- // The text document's uri.
+- URI DocumentURI `json:"uri"`
+-}
+-
+-// An item to transfer a text document from the client to the
+-// server.
+-type TextDocumentItem struct { // line 7405
+- // The text document's uri.
+- URI DocumentURI `json:"uri"`
+- // The text document's language identifier.
+- LanguageID string `json:"languageId"`
+- // The version number of this document (it will increase after each
+- // change, including undo/redo).
+- Version int32 `json:"version"`
+- // The content of the opened text document.
+- Text string `json:"text"`
+-}
+-
+-// A parameter literal used in requests to pass a text document and a position inside that
+-// document.
+-type TextDocumentPositionParams struct { // line 6222
+- // The text document.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- // The position inside the text document.
+- Position Position `json:"position"`
+-}
+-
+-// General text document registration options.
+-type TextDocumentRegistrationOptions struct { // line 2368
+- // A document selector to identify the scope of the registration. If set to null
+- // the document selector provided on the client side will be used.
+- DocumentSelector DocumentSelector `json:"documentSelector"`
+-}
+-
+-// Represents reasons why a text document is saved.
+-type TextDocumentSaveReason uint32 // line 13109
+-// Save registration options.
+-type TextDocumentSaveRegistrationOptions struct { // line 4369
+- TextDocumentRegistrationOptions
+- SaveOptions
+-}
+-type TextDocumentSyncClientCapabilities struct { // line 11127
+- // Whether text document synchronization supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // The client supports sending will save notifications.
+- WillSave bool `json:"willSave,omitempty"`
+- // The client supports sending a will save request and
+- // waits for a response providing text edits which will
+- // be applied to the document before it is saved.
+- WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"`
+- // The client supports did save notifications.
+- DidSave bool `json:"didSave,omitempty"`
+-}
+-
+-// Defines how the host (editor) should sync
+-// document changes to the language server.
+-type TextDocumentSyncKind uint32 // line 13084
+-type TextDocumentSyncOptions struct { // line 9736
+- // Open and close notifications are sent to the server. If omitted open close notification should not
+- // be sent.
+- OpenClose bool `json:"openClose,omitempty"`
+- // Change notifications are sent to the server. See TextDocumentSyncKind.None, TextDocumentSyncKind.Full
+- // and TextDocumentSyncKind.Incremental. If omitted it defaults to TextDocumentSyncKind.None.
+- Change TextDocumentSyncKind `json:"change,omitempty"`
+- // If present will save notifications are sent to the server. If omitted the notification should not be
+- // sent.
+- WillSave bool `json:"willSave,omitempty"`
+- // If present will save wait until requests are sent to the server. If omitted the request should not be
+- // sent.
+- WillSaveWaitUntil bool `json:"willSaveWaitUntil,omitempty"`
+- // If present save notifications are sent to the server. If omitted the notification should not be
+- // sent.
+- Save *SaveOptions `json:"save,omitempty"`
+-}
+-
+-// A text edit applicable to a text document.
+-type TextEdit struct { // line 4406
+- // The range of the text document to be manipulated. To insert
+- // text into a document create a range where start === end.
+- Range Range `json:"range"`
+- // The string to be inserted. For delete operations use an
+- // empty string.
+- NewText string `json:"newText"`
+-}
+-type TokenFormat string // line 13736
+-type TraceValues string // line 13383
+-// Since 3.6.0
+-type TypeDefinitionClientCapabilities struct { // line 11559
+- // Whether implementation supports dynamic registration. If this is set to `true`
+- // the client supports the new `TypeDefinitionRegistrationOptions` return value
+- // for the corresponding server capability as well.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // The client supports additional metadata in the form of definition links.
+- //
+- // Since 3.14.0
+- LinkSupport bool `json:"linkSupport,omitempty"`
+-}
+-type TypeDefinitionOptions struct { // line 6358
+- WorkDoneProgressOptions
+-}
+-type TypeDefinitionParams struct { // line 2123
+- TextDocumentPositionParams
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-type TypeDefinitionRegistrationOptions struct { // line 2143
+- TextDocumentRegistrationOptions
+- TypeDefinitionOptions
+- StaticRegistrationOptions
+-}
+-
+-// @since 3.17.0
+-type TypeHierarchyClientCapabilities struct { // line 12337
+- // Whether implementation supports dynamic registration. If this is set to `true`
+- // the client supports the new `(TextDocumentRegistrationOptions & StaticRegistrationOptions)`
+- // return value for the corresponding server capability as well.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+-}
+-
+-// @since 3.17.0
+-type TypeHierarchyItem struct { // line 3410
+- // The name of this item.
+- Name string `json:"name"`
+- // The kind of this item.
+- Kind SymbolKind `json:"kind"`
+- // Tags for this item.
+- Tags []SymbolTag `json:"tags,omitempty"`
+- // More detail for this item, e.g. the signature of a function.
+- Detail string `json:"detail,omitempty"`
+- // The resource identifier of this item.
+- URI DocumentURI `json:"uri"`
+- // The range enclosing this symbol not including leading/trailing whitespace
+- // but everything else, e.g. comments and code.
+- Range Range `json:"range"`
+- // The range that should be selected and revealed when this symbol is being
+- // picked, e.g. the name of a function. Must be contained by the
+- // {@link TypeHierarchyItem.range `range`}.
+- SelectionRange Range `json:"selectionRange"`
+- // A data entry field that is preserved between a type hierarchy prepare and
+- // supertypes or subtypes requests. It could also be used to identify the
+- // type hierarchy in the server, helping improve the performance on
+- // resolving supertypes and subtypes.
+- Data interface{} `json:"data,omitempty"`
+-}
+-
+-// Type hierarchy options used during static registration.
+-//
+-// @since 3.17.0
+-type TypeHierarchyOptions struct { // line 6936
+- WorkDoneProgressOptions
+-}
+-
+-// The parameter of a `textDocument/prepareTypeHierarchy` request.
+-//
+-// @since 3.17.0
+-type TypeHierarchyPrepareParams struct { // line 3392
+- TextDocumentPositionParams
+- WorkDoneProgressParams
+-}
+-
+-// Type hierarchy options used during static or dynamic registration.
+-//
+-// @since 3.17.0
+-type TypeHierarchyRegistrationOptions struct { // line 3487
+- TextDocumentRegistrationOptions
+- TypeHierarchyOptions
+- StaticRegistrationOptions
+-}
+-
+-// The parameter of a `typeHierarchy/subtypes` request.
+-//
+-// @since 3.17.0
+-type TypeHierarchySubtypesParams struct { // line 3533
+- Item TypeHierarchyItem `json:"item"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// The parameter of a `typeHierarchy/supertypes` request.
+-//
+-// @since 3.17.0
+-type TypeHierarchySupertypesParams struct { // line 3509
+- Item TypeHierarchyItem `json:"item"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// created for Tuple
+-type UIntCommaUInt struct { // line 10076
+- Fld0 uint32 `json:"fld0"`
+- Fld1 uint32 `json:"fld1"`
+-}
+-type URI = string
+-
+-// A diagnostic report indicating that the last returned
+-// report is still accurate.
+-//
+-// @since 3.17.0
+-type UnchangedDocumentDiagnosticReport struct { // line 7270
+- // A document diagnostic report indicating
+- // no changes to the last result. A server can
+- // only return `unchanged` if result ids are
+- // provided.
+- Kind string `json:"kind"`
+- // A result id which will be sent on the next
+- // diagnostic request for the same document.
+- ResultID string `json:"resultId"`
+-}
+-
+-// Moniker uniqueness level to define scope of the moniker.
+-//
+-// @since 3.16.0
+-type UniquenessLevel string // line 12971
+-// General parameters to unregister a request or notification.
+-type Unregistration struct { // line 7628
+- // The id used to unregister the request or notification. Usually an id
+- // provided during the register request.
+- ID string `json:"id"`
+- // The method to unregister for.
+- Method string `json:"method"`
+-}
+-type UnregistrationParams struct { // line 4053
+- Unregisterations []Unregistration `json:"unregisterations"`
+-}
+-
+-// A versioned notebook document identifier.
+-//
+-// @since 3.17.0
+-type VersionedNotebookDocumentIdentifier struct { // line 7443
+- // The version number of this notebook document.
+- Version int32 `json:"version"`
+- // The notebook document's uri.
+- URI URI `json:"uri"`
+-}
+-
+-// A text document identifier to denote a specific version of a text document.
+-type VersionedTextDocumentIdentifier struct { // line 8445
+- // The version number of this document.
+- Version int32 `json:"version"`
+- TextDocumentIdentifier
+-}
+-type WatchKind = uint32 // line 13505// The parameters sent in a will save text document notification.
+-type WillSaveTextDocumentParams struct { // line 4384
+- // The document that will be saved.
+- TextDocument TextDocumentIdentifier `json:"textDocument"`
+- // The 'TextDocumentSaveReason'.
+- Reason TextDocumentSaveReason `json:"reason"`
+-}
+-type WindowClientCapabilities struct { // line 10629
+- // It indicates whether the client supports server initiated
+- // progress using the `window/workDoneProgress/create` request.
+- //
+- // The capability also controls Whether client supports handling
+- // of progress notifications. If set servers are allowed to report a
+- // `workDoneProgress` property in the request specific server
+- // capabilities.
+- //
+- // @since 3.15.0
+- WorkDoneProgress bool `json:"workDoneProgress,omitempty"`
+- // Capabilities specific to the showMessage request.
+- //
+- // @since 3.16.0
+- ShowMessage *ShowMessageRequestClientCapabilities `json:"showMessage,omitempty"`
+- // Capabilities specific to the showDocument request.
+- //
+- // @since 3.16.0
+- ShowDocument *ShowDocumentClientCapabilities `json:"showDocument,omitempty"`
+-}
+-type WorkDoneProgressBegin struct { // line 6040
+- Kind string `json:"kind"`
+- // Mandatory title of the progress operation. Used to briefly inform about
+- // the kind of operation being performed.
+- //
+- // Examples: "Indexing" or "Linking dependencies".
+- Title string `json:"title"`
+- // Controls if a cancel button should show to allow the user to cancel the
+- // long running operation. Clients that don't support cancellation are allowed
+- // to ignore the setting.
+- Cancellable bool `json:"cancellable,omitempty"`
+- // Optional, more detailed associated progress message. Contains
+- // complementary information to the `title`.
+- //
+- // Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
+- // If unset, the previous progress message (if any) is still valid.
+- Message string `json:"message,omitempty"`
+- // Optional progress percentage to display (value 100 is considered 100%).
+- // If not provided infinite progress is assumed and clients are allowed
+- // to ignore the `percentage` value in subsequent in report notifications.
+- //
+- // The value should be steadily rising. Clients are free to ignore values
+- // that are not following this rule. The value range is [0, 100].
+- Percentage uint32 `json:"percentage,omitempty"`
+-}
+-type WorkDoneProgressCancelParams struct { // line 2625
+- // The token to be used to report progress.
+- Token ProgressToken `json:"token"`
+-}
+-type WorkDoneProgressCreateParams struct { // line 2612
+- // The token to be used to report progress.
+- Token ProgressToken `json:"token"`
+-}
+-type WorkDoneProgressEnd struct { // line 6126
+- Kind string `json:"kind"`
+- // Optional, a final message indicating to for example indicate the outcome
+- // of the operation.
+- Message string `json:"message,omitempty"`
+-}
+-type WorkDoneProgressOptions struct { // line 2355
+- WorkDoneProgress bool `json:"workDoneProgress,omitempty"`
+-}
+-
+-// created for And
+-type WorkDoneProgressOptionsAndTextDocumentRegistrationOptions struct { // line 196
+- WorkDoneProgressOptions
+- TextDocumentRegistrationOptions
+-}
+-type WorkDoneProgressParams struct { // line 6244
+- // An optional token that a server can use to report work done progress.
+- WorkDoneToken ProgressToken `json:"workDoneToken,omitempty"`
+-}
+-type WorkDoneProgressReport struct { // line 6087
+- Kind string `json:"kind"`
+- // Controls enablement state of a cancel button.
+- //
+- // Clients that don't support cancellation or don't support controlling the button's
+- // enablement state are allowed to ignore the property.
+- Cancellable bool `json:"cancellable,omitempty"`
+- // Optional, more detailed associated progress message. Contains
+- // complementary information to the `title`.
+- //
+- // Examples: "3/25 files", "project/src/module2", "node_modules/some_dep".
+- // If unset, the previous progress message (if any) is still valid.
+- Message string `json:"message,omitempty"`
+- // Optional progress percentage to display (value 100 is considered 100%).
+- // If not provided infinite progress is assumed and clients are allowed
+- // to ignore the `percentage` value in subsequent in report notifications.
+- //
+- // The value should be steadily rising. Clients are free to ignore values
+- // that are not following this rule. The value range is [0, 100]
+- Percentage uint32 `json:"percentage,omitempty"`
+-}
+-
+-// created for Literal (Lit_ServerCapabilities_workspace)
+-type Workspace6Gn struct { // line 8404
+- // The server supports workspace folder.
+- //
+- // @since 3.6.0
+- WorkspaceFolders *WorkspaceFolders5Gn `json:"workspaceFolders,omitempty"`
+- // The server is interested in notifications/requests for operations on files.
+- //
+- // @since 3.16.0
+- FileOperations *FileOperationOptions `json:"fileOperations,omitempty"`
+-}
+-
+-// Workspace specific client capabilities.
+-type WorkspaceClientCapabilities struct { // line 10184
+- // The client supports applying batch edits
+- // to the workspace by supporting the request
+- // 'workspace/applyEdit'
+- ApplyEdit bool `json:"applyEdit,omitempty"`
+- // Capabilities specific to `WorkspaceEdit`s.
+- WorkspaceEdit *WorkspaceEditClientCapabilities `json:"workspaceEdit,omitempty"`
+- // Capabilities specific to the `workspace/didChangeConfiguration` notification.
+- DidChangeConfiguration DidChangeConfigurationClientCapabilities `json:"didChangeConfiguration,omitempty"`
+- // Capabilities specific to the `workspace/didChangeWatchedFiles` notification.
+- DidChangeWatchedFiles DidChangeWatchedFilesClientCapabilities `json:"didChangeWatchedFiles,omitempty"`
+- // Capabilities specific to the `workspace/symbol` request.
+- Symbol *WorkspaceSymbolClientCapabilities `json:"symbol,omitempty"`
+- // Capabilities specific to the `workspace/executeCommand` request.
+- ExecuteCommand *ExecuteCommandClientCapabilities `json:"executeCommand,omitempty"`
+- // The client has support for workspace folders.
+- //
+- // @since 3.6.0
+- WorkspaceFolders bool `json:"workspaceFolders,omitempty"`
+- // The client supports `workspace/configuration` requests.
+- //
+- // @since 3.6.0
+- Configuration bool `json:"configuration,omitempty"`
+- // Capabilities specific to the semantic token requests scoped to the
+- // workspace.
+- //
+- // @since 3.16.0.
+- SemanticTokens *SemanticTokensWorkspaceClientCapabilities `json:"semanticTokens,omitempty"`
+- // Capabilities specific to the code lens requests scoped to the
+- // workspace.
+- //
+- // @since 3.16.0.
+- CodeLens *CodeLensWorkspaceClientCapabilities `json:"codeLens,omitempty"`
+- // The client has support for file notifications/requests for user operations on files.
+- //
+- // Since 3.16.0
+- FileOperations *FileOperationClientCapabilities `json:"fileOperations,omitempty"`
+- // Capabilities specific to the inline values requests scoped to the
+- // workspace.
+- //
+- // @since 3.17.0.
+- InlineValue *InlineValueWorkspaceClientCapabilities `json:"inlineValue,omitempty"`
+- // Capabilities specific to the inlay hint requests scoped to the
+- // workspace.
+- //
+- // @since 3.17.0.
+- InlayHint *InlayHintWorkspaceClientCapabilities `json:"inlayHint,omitempty"`
+- // Capabilities specific to the diagnostic requests scoped to the
+- // workspace.
+- //
+- // @since 3.17.0.
+- Diagnostics *DiagnosticWorkspaceClientCapabilities `json:"diagnostics,omitempty"`
+-}
+-
+-// Parameters of the workspace diagnostic request.
+-//
+-// @since 3.17.0
+-type WorkspaceDiagnosticParams struct { // line 3877
+- // The additional identifier provided during registration.
+- Identifier string `json:"identifier,omitempty"`
+- // The currently known diagnostic reports with their
+- // previous result ids.
+- PreviousResultIds []PreviousResultID `json:"previousResultIds"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// A workspace diagnostic report.
+-//
+-// @since 3.17.0
+-type WorkspaceDiagnosticReport struct { // line 3914
+- Items []WorkspaceDocumentDiagnosticReport `json:"items"`
+-}
+-
+-// A partial result for a workspace diagnostic report.
+-//
+-// @since 3.17.0
+-type WorkspaceDiagnosticReportPartialResult struct { // line 3931
+- Items []WorkspaceDocumentDiagnosticReport `json:"items"`
+-}
+-
+-// A workspace diagnostic document report.
+-//
+-// @since 3.17.0
+-type WorkspaceDocumentDiagnosticReport = Or_WorkspaceDocumentDiagnosticReport // (alias) line 13984
+-// A workspace edit represents changes to many resources managed in the workspace. The edit
+-// should either provide `changes` or `documentChanges`. If documentChanges are present
+-// they are preferred over `changes` if the client can handle versioned document edits.
+-//
+-// Since version 3.13.0 a workspace edit can contain resource operations as well. If resource
+-// operations are present clients need to execute the operations in the order in which they
+-// are provided. So a workspace edit for example can consist of the following two changes:
+-// (1) a create file a.txt and (2) a text document edit which insert text into file a.txt.
+-//
+-// An invalid sequence (e.g. (1) delete file a.txt and (2) insert text into file a.txt) will
+-// cause failure of the operation. How the client recovers from the failure is described by
+-// the client capability: `workspace.workspaceEdit.failureHandling`
+-type WorkspaceEdit struct { // line 3193
+- // Holds changes to existing resources.
+- Changes map[DocumentURI][]TextEdit `json:"changes,omitempty"`
+- // Depending on the client capability `workspace.workspaceEdit.resourceOperations` document changes
+- // are either an array of `TextDocumentEdit`s to express changes to n different text documents
+- // where each text document edit addresses a specific version of a text document. Or it can contain
+- // above `TextDocumentEdit`s mixed with create, rename and delete file / folder operations.
+- //
+- // Whether a client supports versioned document edits is expressed via
+- // `workspace.workspaceEdit.documentChanges` client capability.
+- //
+- // If a client neither supports `documentChanges` nor `workspace.workspaceEdit.resourceOperations` then
+- // only plain `TextEdit`s using the `changes` property are supported.
+- DocumentChanges []DocumentChanges `json:"documentChanges,omitempty"`
+- // A map of change annotations that can be referenced in `AnnotatedTextEdit`s or create, rename and
+- // delete file / folder operations.
+- //
+- // Whether clients honor this property depends on the client capability `workspace.changeAnnotationSupport`.
+- //
+- // @since 3.16.0
+- ChangeAnnotations map[ChangeAnnotationIdentifier]ChangeAnnotation `json:"changeAnnotations,omitempty"`
+-}
+-type WorkspaceEditClientCapabilities struct { // line 10768
+- // The client supports versioned document changes in `WorkspaceEdit`s
+- DocumentChanges bool `json:"documentChanges,omitempty"`
+- // The resource operations the client supports. Clients should at least
+- // support 'create', 'rename' and 'delete' files and folders.
+- //
+- // @since 3.13.0
+- ResourceOperations []ResourceOperationKind `json:"resourceOperations,omitempty"`
+- // The failure handling strategy of a client if applying the workspace edit
+- // fails.
+- //
+- // @since 3.13.0
+- FailureHandling *FailureHandlingKind `json:"failureHandling,omitempty"`
+- // Whether the client normalizes line endings to the client specific
+- // setting.
+- // If set to `true` the client will normalize line ending characters
+- // in a workspace edit to the client-specified new line
+- // character.
+- //
+- // @since 3.16.0
+- NormalizesLineEndings bool `json:"normalizesLineEndings,omitempty"`
+- // Whether the client in general supports change annotations on text edits,
+- // create file, rename file and delete file changes.
+- //
+- // @since 3.16.0
+- ChangeAnnotationSupport *PChangeAnnotationSupportPWorkspaceEdit `json:"changeAnnotationSupport,omitempty"`
+-}
+-
+-// A workspace folder inside a client.
+-type WorkspaceFolder struct { // line 2163
+- // The associated URI for this workspace folder.
+- URI URI `json:"uri"`
+- // The name of the workspace folder. Used to refer to this
+- // workspace folder in the user interface.
+- Name string `json:"name"`
+-}
+-type WorkspaceFolders5Gn struct { // line 9933
+- // The server has support for workspace folders
+- Supported bool `json:"supported,omitempty"`
+- // Whether the server wants to receive workspace folder
+- // change notifications.
+- //
+- // If a string is provided the string is treated as an ID
+- // under which the notification is registered on the client
+- // side. The ID can be used to unregister for these events
+- // using the `client/unregisterCapability` request.
+- ChangeNotifications string `json:"changeNotifications,omitempty"`
+-}
+-
+-// The workspace folder change event.
+-type WorkspaceFoldersChangeEvent struct { // line 6368
+- // The array of added workspace folders
+- Added []WorkspaceFolder `json:"added"`
+- // The array of the removed workspace folders
+- Removed []WorkspaceFolder `json:"removed"`
+-}
+-type WorkspaceFoldersInitializeParams struct { // line 7782
+- // The workspace folders configured in the client when the server starts.
+- //
+- // This property is only available if the client supports workspace folders.
+- // It can be `null` if the client supports workspace folders but none are
+- // configured.
+- //
+- // @since 3.6.0
+- WorkspaceFolders []WorkspaceFolder `json:"workspaceFolders,omitempty"`
+-}
+-type WorkspaceFoldersServerCapabilities struct { // line 9933
+- // The server has support for workspace folders
+- Supported bool `json:"supported,omitempty"`
+- // Whether the server wants to receive workspace folder
+- // change notifications.
+- //
+- // If a string is provided the string is treated as an ID
+- // under which the notification is registered on the client
+- // side. The ID can be used to unregister for these events
+- // using the `client/unregisterCapability` request.
+- ChangeNotifications string `json:"changeNotifications,omitempty"`
+-}
+-
+-// A full document diagnostic report for a workspace diagnostic result.
+-//
+-// @since 3.17.0
+-type WorkspaceFullDocumentDiagnosticReport struct { // line 9522
+- // The URI for which diagnostic information is reported.
+- URI DocumentURI `json:"uri"`
+- // The version number for which the diagnostics are reported.
+- // If the document is not marked as open `null` can be provided.
+- Version int32 `json:"version"`
+- FullDocumentDiagnosticReport
+-}
+-
+-// A special workspace symbol that supports locations without a range.
+-//
+-// See also SymbolInformation.
+-//
+-// @since 3.17.0
+-type WorkspaceSymbol struct { // line 5515
+- // The location of the symbol. Whether a server is allowed to
+- // return a location without a range depends on the client
+- // capability `workspace.symbol.resolveSupport`.
+- //
+- // See SymbolInformation#location for more details.
+- Location OrPLocation_workspace_symbol `json:"location"`
+- // A data entry field that is preserved on a workspace symbol between a
+- // workspace symbol request and a workspace symbol resolve request.
+- Data interface{} `json:"data,omitempty"`
+- BaseSymbolInformation
+-}
+-
+-// Client capabilities for a {@link WorkspaceSymbolRequest}.
+-type WorkspaceSymbolClientCapabilities struct { // line 10875
+- // Symbol request supports dynamic registration.
+- DynamicRegistration bool `json:"dynamicRegistration,omitempty"`
+- // Specific capabilities for the `SymbolKind` in the `workspace/symbol` request.
+- SymbolKind *PSymbolKindPSymbol `json:"symbolKind,omitempty"`
+- // The client supports tags on `SymbolInformation`.
+- // Clients supporting tags have to handle unknown tags gracefully.
+- //
+- // @since 3.16.0
+- TagSupport *PTagSupportPSymbol `json:"tagSupport,omitempty"`
+- // The client support partial workspace symbols. The client will send the
+- // request `workspaceSymbol/resolve` to the server to resolve additional
+- // properties.
+- //
+- // @since 3.17.0
+- ResolveSupport *PResolveSupportPSymbol `json:"resolveSupport,omitempty"`
+-}
+-
+-// Server capabilities for a {@link WorkspaceSymbolRequest}.
+-type WorkspaceSymbolOptions struct { // line 9105
+- // The server provides support to resolve additional
+- // information for a workspace symbol.
+- //
+- // @since 3.17.0
+- ResolveProvider bool `json:"resolveProvider,omitempty"`
+- WorkDoneProgressOptions
+-}
+-
+-// The parameters of a {@link WorkspaceSymbolRequest}.
+-type WorkspaceSymbolParams struct { // line 5491
+- // A query string to filter symbols by. Clients may send an empty
+- // string here to request all symbols.
+- Query string `json:"query"`
+- WorkDoneProgressParams
+- PartialResultParams
+-}
+-
+-// Registration options for a {@link WorkspaceSymbolRequest}.
+-type WorkspaceSymbolRegistrationOptions struct { // line 5564
+- WorkspaceSymbolOptions
+-}
+-
+-// An unchanged document diagnostic report for a workspace diagnostic result.
+-//
+-// @since 3.17.0
+-type WorkspaceUnchangedDocumentDiagnosticReport struct { // line 9560
+- // The URI for which diagnostic information is reported.
+- URI DocumentURI `json:"uri"`
+- // The version number for which the diagnostics are reported.
+- // If the document is not marked as open `null` can be provided.
+- Version int32 `json:"version"`
+- UnchangedDocumentDiagnosticReport
+-}
+-
+-// The initialize parameters
+-type XInitializeParams struct { // line 7650
+- // The process Id of the parent process that started
+- // the server.
+- //
+- // Is `null` if the process has not been started by another process.
+- // If the parent process is not alive then the server should exit.
+- ProcessID int32 `json:"processId"`
+- // Information about the client
+- //
+- // @since 3.15.0
+- ClientInfo *Msg_XInitializeParams_clientInfo `json:"clientInfo,omitempty"`
+- // The locale the client is currently showing the user interface
+- // in. This must not necessarily be the locale of the operating
+- // system.
+- //
+- // Uses IETF language tags as the value's syntax
+- // (See https://en.wikipedia.org/wiki/IETF_language_tag)
+- //
+- // @since 3.16.0
+- Locale string `json:"locale,omitempty"`
+- // The rootPath of the workspace. Is null
+- // if no folder is open.
+- //
+- // @deprecated in favour of rootUri.
+- RootPath string `json:"rootPath,omitempty"`
+- // The rootUri of the workspace. Is null if no
+- // folder is open. If both `rootPath` and `rootUri` are set
+- // `rootUri` wins.
+- //
+- // @deprecated in favour of workspaceFolders.
+- RootURI DocumentURI `json:"rootUri"`
+- // The capabilities provided by the client (editor or tool)
+- Capabilities ClientCapabilities `json:"capabilities"`
+- // User provided initialization options.
+- InitializationOptions interface{} `json:"initializationOptions,omitempty"`
+- // The initial trace setting. If omitted trace is disabled ('off').
+- Trace *TraceValues `json:"trace,omitempty"`
+- WorkDoneProgressParams
+-}
+-
+-// The initialize parameters
+-type _InitializeParams struct { // line 7650
+- // The process Id of the parent process that started
+- // the server.
+- //
+- // Is `null` if the process has not been started by another process.
+- // If the parent process is not alive then the server should exit.
+- ProcessID int32 `json:"processId"`
+- // Information about the client
+- //
+- // @since 3.15.0
+- ClientInfo *Msg_XInitializeParams_clientInfo `json:"clientInfo,omitempty"`
+- // The locale the client is currently showing the user interface
+- // in. This must not necessarily be the locale of the operating
+- // system.
+- //
+- // Uses IETF language tags as the value's syntax
+- // (See https://en.wikipedia.org/wiki/IETF_language_tag)
+- //
+- // @since 3.16.0
+- Locale string `json:"locale,omitempty"`
+- // The rootPath of the workspace. Is null
+- // if no folder is open.
+- //
+- // @deprecated in favour of rootUri.
+- RootPath string `json:"rootPath,omitempty"`
+- // The rootUri of the workspace. Is null if no
+- // folder is open. If both `rootPath` and `rootUri` are set
+- // `rootUri` wins.
+- //
+- // @deprecated in favour of workspaceFolders.
+- RootURI DocumentURI `json:"rootUri"`
+- // The capabilities provided by the client (editor or tool)
+- Capabilities ClientCapabilities `json:"capabilities"`
+- // User provided initialization options.
+- InitializationOptions interface{} `json:"initializationOptions,omitempty"`
+- // The initial trace setting. If omitted trace is disabled ('off').
+- Trace *TraceValues `json:"trace,omitempty"`
+- WorkDoneProgressParams
+-}
+-
+-const (
+- // A set of predefined code action kinds
+- // Empty kind.
+- Empty CodeActionKind = "" // line 13333
+- // Base kind for quickfix actions: 'quickfix'
+- QuickFix CodeActionKind = "quickfix" // line 13338
+- // Base kind for refactoring actions: 'refactor'
+- Refactor CodeActionKind = "refactor" // line 13343
+- // Base kind for refactoring extraction actions: 'refactor.extract'
+- //
+- // Example extract actions:
+- //
+- //
+- // - Extract method
+- // - Extract function
+- // - Extract variable
+- // - Extract interface from class
+- // - ...
+- RefactorExtract CodeActionKind = "refactor.extract" // line 13348
+- // Base kind for refactoring inline actions: 'refactor.inline'
+- //
+- // Example inline actions:
+- //
+- //
+- // - Inline function
+- // - Inline variable
+- // - Inline constant
+- // - ...
+- RefactorInline CodeActionKind = "refactor.inline" // line 13353
+- // Base kind for refactoring rewrite actions: 'refactor.rewrite'
+- //
+- // Example rewrite actions:
+- //
+- //
+- // - Convert JavaScript function to class
+- // - Add or remove parameter
+- // - Encapsulate field
+- // - Make method static
+- // - Move method to base class
+- // - ...
+- RefactorRewrite CodeActionKind = "refactor.rewrite" // line 13358
+- // Base kind for source actions: `source`
+- //
+- // Source code actions apply to the entire file.
+- Source CodeActionKind = "source" // line 13363
+- // Base kind for an organize imports source action: `source.organizeImports`
+- SourceOrganizeImports CodeActionKind = "source.organizeImports" // line 13368
+- // Base kind for auto-fix source actions: `source.fixAll`.
+- //
+- // Fix all actions automatically fix errors that have a clear fix that do not require user input.
+- // They should not suppress errors or perform unsafe fixes such as generating new types or classes.
+- //
+- // @since 3.15.0
+- SourceFixAll CodeActionKind = "source.fixAll" // line 13373
+- // The reason why code actions were requested.
+- //
+- // @since 3.17.0
+- // Code actions were explicitly requested by the user or by an extension.
+- CodeActionInvoked CodeActionTriggerKind = 1 // line 13613
+- // Code actions were requested automatically.
+- //
+- // This typically happens when current selection in a file changes, but can
+- // also be triggered when file content changes.
+- CodeActionAutomatic CodeActionTriggerKind = 2 // line 13618
+- // The kind of a completion entry.
+- TextCompletion CompletionItemKind = 1 // line 13141
+- MethodCompletion CompletionItemKind = 2 // line 13145
+- FunctionCompletion CompletionItemKind = 3 // line 13149
+- ConstructorCompletion CompletionItemKind = 4 // line 13153
+- FieldCompletion CompletionItemKind = 5 // line 13157
+- VariableCompletion CompletionItemKind = 6 // line 13161
+- ClassCompletion CompletionItemKind = 7 // line 13165
+- InterfaceCompletion CompletionItemKind = 8 // line 13169
+- ModuleCompletion CompletionItemKind = 9 // line 13173
+- PropertyCompletion CompletionItemKind = 10 // line 13177
+- UnitCompletion CompletionItemKind = 11 // line 13181
+- ValueCompletion CompletionItemKind = 12 // line 13185
+- EnumCompletion CompletionItemKind = 13 // line 13189
+- KeywordCompletion CompletionItemKind = 14 // line 13193
+- SnippetCompletion CompletionItemKind = 15 // line 13197
+- ColorCompletion CompletionItemKind = 16 // line 13201
+- FileCompletion CompletionItemKind = 17 // line 13205
+- ReferenceCompletion CompletionItemKind = 18 // line 13209
+- FolderCompletion CompletionItemKind = 19 // line 13213
+- EnumMemberCompletion CompletionItemKind = 20 // line 13217
+- ConstantCompletion CompletionItemKind = 21 // line 13221
+- StructCompletion CompletionItemKind = 22 // line 13225
+- EventCompletion CompletionItemKind = 23 // line 13229
+- OperatorCompletion CompletionItemKind = 24 // line 13233
+- TypeParameterCompletion CompletionItemKind = 25 // line 13237
+- // Completion item tags are extra annotations that tweak the rendering of a completion
+- // item.
+- //
+- // @since 3.15.0
+- // Render a completion as obsolete, usually using a strike-out.
+- ComplDeprecated CompletionItemTag = 1 // line 13251
+- // How a completion was triggered
+- // Completion was triggered by typing an identifier (24x7 code
+- // complete), manual invocation (e.g Ctrl+Space) or via API.
+- Invoked CompletionTriggerKind = 1 // line 13562
+- // Completion was triggered by a trigger character specified by
+- // the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
+- TriggerCharacter CompletionTriggerKind = 2 // line 13567
+- // Completion was re-triggered as current completion list is incomplete
+- TriggerForIncompleteCompletions CompletionTriggerKind = 3 // line 13572
+- // The diagnostic's severity.
+- // Reports an error.
+- SeverityError DiagnosticSeverity = 1 // line 13511
+- // Reports a warning.
+- SeverityWarning DiagnosticSeverity = 2 // line 13516
+- // Reports an information.
+- SeverityInformation DiagnosticSeverity = 3 // line 13521
+- // Reports a hint.
+- SeverityHint DiagnosticSeverity = 4 // line 13526
+- // The diagnostic tags.
+- //
+- // @since 3.15.0
+- // Unused or unnecessary code.
+- //
+- // Clients are allowed to render diagnostics with this tag faded out instead of having
+- // an error squiggle.
+- Unnecessary DiagnosticTag = 1 // line 13541
+- // Deprecated or obsolete code.
+- //
+- // Clients are allowed to rendered diagnostics with this tag strike through.
+- Deprecated DiagnosticTag = 2 // line 13546
+- // The document diagnostic report kinds.
+- //
+- // @since 3.17.0
+- // A diagnostic report with a full
+- // set of problems.
+- DiagnosticFull DocumentDiagnosticReportKind = "full" // line 12729
+- // A report indicating that the last
+- // returned report is still accurate.
+- DiagnosticUnchanged DocumentDiagnosticReportKind = "unchanged" // line 12734
+- // A document highlight kind.
+- // A textual occurrence.
+- Text DocumentHighlightKind = 1 // line 13308
+- // Read-access of a symbol, like reading a variable.
+- Read DocumentHighlightKind = 2 // line 13313
+- // Write-access of a symbol, like writing to a variable.
+- Write DocumentHighlightKind = 3 // line 13318
+- // Predefined error codes.
+- ParseError ErrorCodes = -32700 // line 12750
+- InvalidRequest ErrorCodes = -32600 // line 12754
+- MethodNotFound ErrorCodes = -32601 // line 12758
+- InvalidParams ErrorCodes = -32602 // line 12762
+- InternalError ErrorCodes = -32603 // line 12766
+- // Error code indicating that a server received a notification or
+- // request before the server has received the `initialize` request.
+- ServerNotInitialized ErrorCodes = -32002 // line 12770
+- UnknownErrorCode ErrorCodes = -32001 // line 12775
+- // Applying the workspace change is simply aborted if one of the changes provided
+- // fails. All operations executed before the failing operation stay executed.
+- Abort FailureHandlingKind = "abort" // line 13700
+- // All operations are executed transactional. That means they either all
+- // succeed or no changes at all are applied to the workspace.
+- Transactional FailureHandlingKind = "transactional" // line 13705
+- // If the workspace edit contains only textual file changes they are executed transactional.
+- // If resource changes (create, rename or delete file) are part of the change the failure
+- // handling strategy is abort.
+- TextOnlyTransactional FailureHandlingKind = "textOnlyTransactional" // line 13710
+- // The client tries to undo the operations already executed. But there is no
+- // guarantee that this is succeeding.
+- Undo FailureHandlingKind = "undo" // line 13715
+- // The file event type
+- // The file got created.
+- Created FileChangeType = 1 // line 13461
+- // The file got changed.
+- Changed FileChangeType = 2 // line 13466
+- // The file got deleted.
+- Deleted FileChangeType = 3 // line 13471
+- // A pattern kind describing if a glob pattern matches a file a folder or
+- // both.
+- //
+- // @since 3.16.0
+- // The pattern matches a file only.
+- FilePattern FileOperationPatternKind = "file" // line 13634
+- // The pattern matches a folder only.
+- FolderPattern FileOperationPatternKind = "folder" // line 13639
+- // A set of predefined range kinds.
+- // Folding range for a comment
+- Comment FoldingRangeKind = "comment" // line 12822
+- // Folding range for an import or include
+- Imports FoldingRangeKind = "imports" // line 12827
+- // Folding range for a region (e.g. `#region`)
+- Region FoldingRangeKind = "region" // line 12832
+- // Inlay hint kinds.
+- //
+- // @since 3.17.0
+- // An inlay hint that for a type annotation.
+- Type InlayHintKind = 1 // line 13040
+- // An inlay hint that is for a parameter.
+- Parameter InlayHintKind = 2 // line 13045
+- // Defines whether the insert text in a completion item should be interpreted as
+- // plain text or a snippet.
+- // The primary text to be inserted is treated as a plain string.
+- PlainTextTextFormat InsertTextFormat = 1 // line 13267
+- // The primary text to be inserted is treated as a snippet.
+- //
+- // A snippet can define tab stops and placeholders with `$1`, `$2`
+- // and `${3:foo}`. `$0` defines the final tab stop, it defaults to
+- // the end of the snippet. Placeholders with equal identifiers are linked,
+- // that is typing in one will update others too.
+- //
+- // See also: https://microsoft.github.io/language-server-protocol/specifications/specification-current/#snippet_syntax
+- SnippetTextFormat InsertTextFormat = 2 // line 13272
+- // How whitespace and indentation is handled during completion
+- // item insertion.
+- //
+- // @since 3.16.0
+- // The insertion or replace strings is taken as it is. If the
+- // value is multi line the lines below the cursor will be
+- // inserted using the indentation defined in the string value.
+- // The client will not apply any kind of adjustments to the
+- // string.
+- AsIs InsertTextMode = 1 // line 13287
+- // The editor adjusts leading whitespace of new lines so that
+- // they match the indentation up to the cursor of the line for
+- // which the item is accepted.
+- //
+- // Consider a line like this: <2tabs><cursor><3tabs>foo. Accepting a
+- // multi line completion item is indented using 2 tabs and all
+- // following lines inserted will be indented using 2 tabs as well.
+- AdjustIndentation InsertTextMode = 2 // line 13292
+- // A request failed but it was syntactically correct, e.g the
+- // method name was known and the parameters were valid. The error
+- // message should contain human readable information about why
+- // the request failed.
+- //
+- // @since 3.17.0
+- RequestFailed LSPErrorCodes = -32803 // line 12790
+- // The server cancelled the request. This error code should
+- // only be used for requests that explicitly support being
+- // server cancellable.
+- //
+- // @since 3.17.0
+- ServerCancelled LSPErrorCodes = -32802 // line 12796
+- // The server detected that the content of a document got
+- // modified outside normal conditions. A server should
+- // NOT send this error code if it detects a content change
+- // in it unprocessed messages. The result even computed
+- // on an older state might still be useful for the client.
+- //
+- // If a client decides that a result is not of any use anymore
+- // the client should cancel the request.
+- ContentModified LSPErrorCodes = -32801 // line 12802
+- // The client has canceled a request and a server as detected
+- // the cancel.
+- RequestCancelled LSPErrorCodes = -32800 // line 12807
+- // Describes the content type that a client supports in various
+- // result literals like `Hover`, `ParameterInfo` or `CompletionItem`.
+- //
+- // Please note that `MarkupKinds` must not start with a `$`. This kinds
+- // are reserved for internal usage.
+- // Plain text is supported as a content format
+- PlainText MarkupKind = "plaintext" // line 13414
+- // Markdown is supported as a content format
+- Markdown MarkupKind = "markdown" // line 13419
+- // The message type
+- // An error message.
+- Error MessageType = 1 // line 13061
+- // A warning message.
+- Warning MessageType = 2 // line 13066
+- // An information message.
+- Info MessageType = 3 // line 13071
+- // A log message.
+- Log MessageType = 4 // line 13076
+- // The moniker kind.
+- //
+- // @since 3.16.0
+- // The moniker represent a symbol that is imported into a project
+- Import MonikerKind = "import" // line 13014
+- // The moniker represents a symbol that is exported from a project
+- Export MonikerKind = "export" // line 13019
+- // The moniker represents a symbol that is local to a project (e.g. a local
+- // variable of a function, a class not visible outside the project, ...)
+- Local MonikerKind = "local" // line 13024
+- // A notebook cell kind.
+- //
+- // @since 3.17.0
+- // A markup-cell is formatted source that is used for display.
+- Markup NotebookCellKind = 1 // line 13655
+- // A code-cell is source code.
+- Code NotebookCellKind = 2 // line 13660
+- // A set of predefined position encoding kinds.
+- //
+- // @since 3.17.0
+- // Character offsets count UTF-8 code units.
+- UTF8 PositionEncodingKind = "utf-8" // line 13434
+- // Character offsets count UTF-16 code units.
+- //
+- // This is the default and must always be supported
+- // by servers
+- UTF16 PositionEncodingKind = "utf-16" // line 13439
+- // Character offsets count UTF-32 code units.
+- //
+- // Implementation note: these are the same as Unicode code points,
+- // so this `PositionEncodingKind` may also be used for an
+- // encoding-agnostic representation of character offsets.
+- UTF32 PositionEncodingKind = "utf-32" // line 13444
+- // The client's default behavior is to select the identifier
+- // according the to language's syntax rule.
+- Identifier PrepareSupportDefaultBehavior = 1 // line 13729
+- // Supports creating new files and folders.
+- Create ResourceOperationKind = "create" // line 13676
+- // Supports renaming existing files and folders.
+- Rename ResourceOperationKind = "rename" // line 13681
+- // Supports deleting existing files and folders.
+- Delete ResourceOperationKind = "delete" // line 13686
+- // A set of predefined token modifiers. This set is not fixed
+- // an clients can specify additional token types via the
+- // corresponding client capabilities.
+- //
+- // @since 3.16.0
+- ModDeclaration SemanticTokenModifiers = "declaration" // line 12677
+- ModDefinition SemanticTokenModifiers = "definition" // line 12681
+- ModReadonly SemanticTokenModifiers = "readonly" // line 12685
+- ModStatic SemanticTokenModifiers = "static" // line 12689
+- ModDeprecated SemanticTokenModifiers = "deprecated" // line 12693
+- ModAbstract SemanticTokenModifiers = "abstract" // line 12697
+- ModAsync SemanticTokenModifiers = "async" // line 12701
+- ModModification SemanticTokenModifiers = "modification" // line 12705
+- ModDocumentation SemanticTokenModifiers = "documentation" // line 12709
+- ModDefaultLibrary SemanticTokenModifiers = "defaultLibrary" // line 12713
+- // A set of predefined token types. This set is not fixed
+- // an clients can specify additional token types via the
+- // corresponding client capabilities.
+- //
+- // @since 3.16.0
+- NamespaceType SemanticTokenTypes = "namespace" // line 12570
+- // Represents a generic type. Acts as a fallback for types which can't be mapped to
+- // a specific type like class or enum.
+- TypeType SemanticTokenTypes = "type" // line 12574
+- ClassType SemanticTokenTypes = "class" // line 12579
+- EnumType SemanticTokenTypes = "enum" // line 12583
+- InterfaceType SemanticTokenTypes = "interface" // line 12587
+- StructType SemanticTokenTypes = "struct" // line 12591
+- TypeParameterType SemanticTokenTypes = "typeParameter" // line 12595
+- ParameterType SemanticTokenTypes = "parameter" // line 12599
+- VariableType SemanticTokenTypes = "variable" // line 12603
+- PropertyType SemanticTokenTypes = "property" // line 12607
+- EnumMemberType SemanticTokenTypes = "enumMember" // line 12611
+- EventType SemanticTokenTypes = "event" // line 12615
+- FunctionType SemanticTokenTypes = "function" // line 12619
+- MethodType SemanticTokenTypes = "method" // line 12623
+- MacroType SemanticTokenTypes = "macro" // line 12627
+- KeywordType SemanticTokenTypes = "keyword" // line 12631
+- ModifierType SemanticTokenTypes = "modifier" // line 12635
+- CommentType SemanticTokenTypes = "comment" // line 12639
+- StringType SemanticTokenTypes = "string" // line 12643
+- NumberType SemanticTokenTypes = "number" // line 12647
+- RegexpType SemanticTokenTypes = "regexp" // line 12651
+- OperatorType SemanticTokenTypes = "operator" // line 12655
+- // @since 3.17.0
+- DecoratorType SemanticTokenTypes = "decorator" // line 12659
+- // How a signature help was triggered.
+- //
+- // @since 3.15.0
+- // Signature help was invoked manually by the user or by a command.
+- SigInvoked SignatureHelpTriggerKind = 1 // line 13587
+- // Signature help was triggered by a trigger character.
+- SigTriggerCharacter SignatureHelpTriggerKind = 2 // line 13592
+- // Signature help was triggered by the cursor moving or by the document content changing.
+- SigContentChange SignatureHelpTriggerKind = 3 // line 13597
+- // A symbol kind.
+- File SymbolKind = 1 // line 12848
+- Module SymbolKind = 2 // line 12852
+- Namespace SymbolKind = 3 // line 12856
+- Package SymbolKind = 4 // line 12860
+- Class SymbolKind = 5 // line 12864
+- Method SymbolKind = 6 // line 12868
+- Property SymbolKind = 7 // line 12872
+- Field SymbolKind = 8 // line 12876
+- Constructor SymbolKind = 9 // line 12880
+- Enum SymbolKind = 10 // line 12884
+- Interface SymbolKind = 11 // line 12888
+- Function SymbolKind = 12 // line 12892
+- Variable SymbolKind = 13 // line 12896
+- Constant SymbolKind = 14 // line 12900
+- String SymbolKind = 15 // line 12904
+- Number SymbolKind = 16 // line 12908
+- Boolean SymbolKind = 17 // line 12912
+- Array SymbolKind = 18 // line 12916
+- Object SymbolKind = 19 // line 12920
+- Key SymbolKind = 20 // line 12924
+- Null SymbolKind = 21 // line 12928
+- EnumMember SymbolKind = 22 // line 12932
+- Struct SymbolKind = 23 // line 12936
+- Event SymbolKind = 24 // line 12940
+- Operator SymbolKind = 25 // line 12944
+- TypeParameter SymbolKind = 26 // line 12948
+- // Symbol tags are extra annotations that tweak the rendering of a symbol.
+- //
+- // @since 3.16
+- // Render a symbol as obsolete, usually using a strike-out.
+- DeprecatedSymbol SymbolTag = 1 // line 12962
+- // Represents reasons why a text document is saved.
+- // Manually triggered, e.g. by the user pressing save, by starting debugging,
+- // or by an API call.
+- Manual TextDocumentSaveReason = 1 // line 13116
+- // Automatic after a delay.
+- AfterDelay TextDocumentSaveReason = 2 // line 13121
+- // When the editor lost focus.
+- FocusOut TextDocumentSaveReason = 3 // line 13126
+- // Defines how the host (editor) should sync
+- // document changes to the language server.
+- // Documents should not be synced at all.
+- None TextDocumentSyncKind = 0 // line 13091
+- // Documents are synced by always sending the full content
+- // of the document.
+- Full TextDocumentSyncKind = 1 // line 13096
+- // Documents are synced by sending the full content on open.
+- // After that only incremental updates to the document are
+- // send.
+- Incremental TextDocumentSyncKind = 2 // line 13101
+- Relative TokenFormat = "relative" // line 13743
+- // Turn tracing off.
+- Off TraceValues = "off" // line 13390
+- // Trace messages only.
+- Messages TraceValues = "messages" // line 13395
+- // Verbose message tracing.
+- Verbose TraceValues = "verbose" // line 13400
+- // Moniker uniqueness level to define scope of the moniker.
+- //
+- // @since 3.16.0
+- // The moniker is only unique inside a document
+- Document UniquenessLevel = "document" // line 12978
+- // The moniker is unique inside a project for which a dump got created
+- Project UniquenessLevel = "project" // line 12983
+- // The moniker is unique inside the group to which a project belongs
+- Group UniquenessLevel = "group" // line 12988
+- // The moniker is unique inside the moniker scheme.
+- Scheme UniquenessLevel = "scheme" // line 12993
+- // The moniker is globally unique
+- Global UniquenessLevel = "global" // line 12998
+- // Interested in create events.
+- WatchCreate WatchKind = 1 // line 13486
+- // Interested in change events
+- WatchChange WatchKind = 2 // line 13491
+- // Interested in delete events
+- WatchDelete WatchKind = 4 // line 13496
+-)
+diff -urN a/gopls/internal/lsp/protocol/tsserver.go b/gopls/internal/lsp/protocol/tsserver.go
+--- a/gopls/internal/lsp/protocol/tsserver.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/protocol/tsserver.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1160 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Code generated for LSP. DO NOT EDIT.
+-
+-package protocol
+-
+-// Code generated from protocol/metaModel.json at ref release/protocol/3.17.3-next.6 (hash 56c23c557e3568a9f56f42435fd5a80f9458957f).
+-// https://github.com/microsoft/vscode-languageserver-node/blob/release/protocol/3.17.3-next.6/protocol/metaModel.json
+-// LSP metaData.version = 3.17.0.
+-
+-import (
+- "context"
+- "encoding/json"
+-
+- "golang.org/x/tools/internal/jsonrpc2"
+-)
+-
+-type Server interface {
+- Progress(context.Context, *ProgressParams) error // $/progress
+- SetTrace(context.Context, *SetTraceParams) error // $/setTrace
+- IncomingCalls(context.Context, *CallHierarchyIncomingCallsParams) ([]CallHierarchyIncomingCall, error) // callHierarchy/incomingCalls
+- OutgoingCalls(context.Context, *CallHierarchyOutgoingCallsParams) ([]CallHierarchyOutgoingCall, error) // callHierarchy/outgoingCalls
+- ResolveCodeAction(context.Context, *CodeAction) (*CodeAction, error) // codeAction/resolve
+- ResolveCodeLens(context.Context, *CodeLens) (*CodeLens, error) // codeLens/resolve
+- ResolveCompletionItem(context.Context, *CompletionItem) (*CompletionItem, error) // completionItem/resolve
+- ResolveDocumentLink(context.Context, *DocumentLink) (*DocumentLink, error) // documentLink/resolve
+- Exit(context.Context) error // exit
+- Initialize(context.Context, *ParamInitialize) (*InitializeResult, error) // initialize
+- Initialized(context.Context, *InitializedParams) error // initialized
+- Resolve(context.Context, *InlayHint) (*InlayHint, error) // inlayHint/resolve
+- DidChangeNotebookDocument(context.Context, *DidChangeNotebookDocumentParams) error // notebookDocument/didChange
+- DidCloseNotebookDocument(context.Context, *DidCloseNotebookDocumentParams) error // notebookDocument/didClose
+- DidOpenNotebookDocument(context.Context, *DidOpenNotebookDocumentParams) error // notebookDocument/didOpen
+- DidSaveNotebookDocument(context.Context, *DidSaveNotebookDocumentParams) error // notebookDocument/didSave
+- Shutdown(context.Context) error // shutdown
+- CodeAction(context.Context, *CodeActionParams) ([]CodeAction, error) // textDocument/codeAction
+- CodeLens(context.Context, *CodeLensParams) ([]CodeLens, error) // textDocument/codeLens
+- ColorPresentation(context.Context, *ColorPresentationParams) ([]ColorPresentation, error) // textDocument/colorPresentation
+- Completion(context.Context, *CompletionParams) (*CompletionList, error) // textDocument/completion
+- Declaration(context.Context, *DeclarationParams) (*Or_textDocument_declaration, error) // textDocument/declaration
+- Definition(context.Context, *DefinitionParams) ([]Location, error) // textDocument/definition
+- Diagnostic(context.Context, *string) (*string, error) // textDocument/diagnostic
+- DidChange(context.Context, *DidChangeTextDocumentParams) error // textDocument/didChange
+- DidClose(context.Context, *DidCloseTextDocumentParams) error // textDocument/didClose
+- DidOpen(context.Context, *DidOpenTextDocumentParams) error // textDocument/didOpen
+- DidSave(context.Context, *DidSaveTextDocumentParams) error // textDocument/didSave
+- DocumentColor(context.Context, *DocumentColorParams) ([]ColorInformation, error) // textDocument/documentColor
+- DocumentHighlight(context.Context, *DocumentHighlightParams) ([]DocumentHighlight, error) // textDocument/documentHighlight
+- DocumentLink(context.Context, *DocumentLinkParams) ([]DocumentLink, error) // textDocument/documentLink
+- DocumentSymbol(context.Context, *DocumentSymbolParams) ([]interface{}, error) // textDocument/documentSymbol
+- FoldingRange(context.Context, *FoldingRangeParams) ([]FoldingRange, error) // textDocument/foldingRange
+- Formatting(context.Context, *DocumentFormattingParams) ([]TextEdit, error) // textDocument/formatting
+- Hover(context.Context, *HoverParams) (*Hover, error) // textDocument/hover
+- Implementation(context.Context, *ImplementationParams) ([]Location, error) // textDocument/implementation
+- InlayHint(context.Context, *InlayHintParams) ([]InlayHint, error) // textDocument/inlayHint
+- InlineValue(context.Context, *InlineValueParams) ([]InlineValue, error) // textDocument/inlineValue
+- LinkedEditingRange(context.Context, *LinkedEditingRangeParams) (*LinkedEditingRanges, error) // textDocument/linkedEditingRange
+- Moniker(context.Context, *MonikerParams) ([]Moniker, error) // textDocument/moniker
+- OnTypeFormatting(context.Context, *DocumentOnTypeFormattingParams) ([]TextEdit, error) // textDocument/onTypeFormatting
+- PrepareCallHierarchy(context.Context, *CallHierarchyPrepareParams) ([]CallHierarchyItem, error) // textDocument/prepareCallHierarchy
+- PrepareRename(context.Context, *PrepareRenameParams) (*PrepareRename2Gn, error) // textDocument/prepareRename
+- PrepareTypeHierarchy(context.Context, *TypeHierarchyPrepareParams) ([]TypeHierarchyItem, error) // textDocument/prepareTypeHierarchy
+- RangeFormatting(context.Context, *DocumentRangeFormattingParams) ([]TextEdit, error) // textDocument/rangeFormatting
+- References(context.Context, *ReferenceParams) ([]Location, error) // textDocument/references
+- Rename(context.Context, *RenameParams) (*WorkspaceEdit, error) // textDocument/rename
+- SelectionRange(context.Context, *SelectionRangeParams) ([]SelectionRange, error) // textDocument/selectionRange
+- SemanticTokensFull(context.Context, *SemanticTokensParams) (*SemanticTokens, error) // textDocument/semanticTokens/full
+- SemanticTokensFullDelta(context.Context, *SemanticTokensDeltaParams) (interface{}, error) // textDocument/semanticTokens/full/delta
+- SemanticTokensRange(context.Context, *SemanticTokensRangeParams) (*SemanticTokens, error) // textDocument/semanticTokens/range
+- SignatureHelp(context.Context, *SignatureHelpParams) (*SignatureHelp, error) // textDocument/signatureHelp
+- TypeDefinition(context.Context, *TypeDefinitionParams) ([]Location, error) // textDocument/typeDefinition
+- WillSave(context.Context, *WillSaveTextDocumentParams) error // textDocument/willSave
+- WillSaveWaitUntil(context.Context, *WillSaveTextDocumentParams) ([]TextEdit, error) // textDocument/willSaveWaitUntil
+- Subtypes(context.Context, *TypeHierarchySubtypesParams) ([]TypeHierarchyItem, error) // typeHierarchy/subtypes
+- Supertypes(context.Context, *TypeHierarchySupertypesParams) ([]TypeHierarchyItem, error) // typeHierarchy/supertypes
+- WorkDoneProgressCancel(context.Context, *WorkDoneProgressCancelParams) error // window/workDoneProgress/cancel
+- DiagnosticWorkspace(context.Context, *WorkspaceDiagnosticParams) (*WorkspaceDiagnosticReport, error) // workspace/diagnostic
+- DidChangeConfiguration(context.Context, *DidChangeConfigurationParams) error // workspace/didChangeConfiguration
+- DidChangeWatchedFiles(context.Context, *DidChangeWatchedFilesParams) error // workspace/didChangeWatchedFiles
+- DidChangeWorkspaceFolders(context.Context, *DidChangeWorkspaceFoldersParams) error // workspace/didChangeWorkspaceFolders
+- DidCreateFiles(context.Context, *CreateFilesParams) error // workspace/didCreateFiles
+- DidDeleteFiles(context.Context, *DeleteFilesParams) error // workspace/didDeleteFiles
+- DidRenameFiles(context.Context, *RenameFilesParams) error // workspace/didRenameFiles
+- ExecuteCommand(context.Context, *ExecuteCommandParams) (interface{}, error) // workspace/executeCommand
+- Symbol(context.Context, *WorkspaceSymbolParams) ([]SymbolInformation, error) // workspace/symbol
+- WillCreateFiles(context.Context, *CreateFilesParams) (*WorkspaceEdit, error) // workspace/willCreateFiles
+- WillDeleteFiles(context.Context, *DeleteFilesParams) (*WorkspaceEdit, error) // workspace/willDeleteFiles
+- WillRenameFiles(context.Context, *RenameFilesParams) (*WorkspaceEdit, error) // workspace/willRenameFiles
+- ResolveWorkspaceSymbol(context.Context, *WorkspaceSymbol) (*WorkspaceSymbol, error) // workspaceSymbol/resolve
+- NonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error)
+-}
+-
+-func serverDispatch(ctx context.Context, server Server, reply jsonrpc2.Replier, r jsonrpc2.Request) (bool, error) {
+- switch r.Method() {
+- case "$/progress":
+- var params ProgressParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.Progress(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "$/setTrace":
+- var params SetTraceParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.SetTrace(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "callHierarchy/incomingCalls":
+- var params CallHierarchyIncomingCallsParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.IncomingCalls(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "callHierarchy/outgoingCalls":
+- var params CallHierarchyOutgoingCallsParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.OutgoingCalls(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "codeAction/resolve":
+- var params CodeAction
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.ResolveCodeAction(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "codeLens/resolve":
+- var params CodeLens
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.ResolveCodeLens(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "completionItem/resolve":
+- var params CompletionItem
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.ResolveCompletionItem(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "documentLink/resolve":
+- var params DocumentLink
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.ResolveDocumentLink(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "exit":
+- err := server.Exit(ctx)
+- return true, reply(ctx, nil, err)
+- case "initialize":
+- var params ParamInitialize
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.Initialize(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "initialized":
+- var params InitializedParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.Initialized(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "inlayHint/resolve":
+- var params InlayHint
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.Resolve(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "notebookDocument/didChange":
+- var params DidChangeNotebookDocumentParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.DidChangeNotebookDocument(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "notebookDocument/didClose":
+- var params DidCloseNotebookDocumentParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.DidCloseNotebookDocument(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "notebookDocument/didOpen":
+- var params DidOpenNotebookDocumentParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.DidOpenNotebookDocument(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "notebookDocument/didSave":
+- var params DidSaveNotebookDocumentParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.DidSaveNotebookDocument(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "shutdown":
+- err := server.Shutdown(ctx)
+- return true, reply(ctx, nil, err)
+- case "textDocument/codeAction":
+- var params CodeActionParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.CodeAction(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/codeLens":
+- var params CodeLensParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.CodeLens(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/colorPresentation":
+- var params ColorPresentationParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.ColorPresentation(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/completion":
+- var params CompletionParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.Completion(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/declaration":
+- var params DeclarationParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.Declaration(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/definition":
+- var params DefinitionParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.Definition(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/diagnostic":
+- var params string
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.Diagnostic(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/didChange":
+- var params DidChangeTextDocumentParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.DidChange(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "textDocument/didClose":
+- var params DidCloseTextDocumentParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.DidClose(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "textDocument/didOpen":
+- var params DidOpenTextDocumentParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.DidOpen(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "textDocument/didSave":
+- var params DidSaveTextDocumentParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.DidSave(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "textDocument/documentColor":
+- var params DocumentColorParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.DocumentColor(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/documentHighlight":
+- var params DocumentHighlightParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.DocumentHighlight(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/documentLink":
+- var params DocumentLinkParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.DocumentLink(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/documentSymbol":
+- var params DocumentSymbolParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.DocumentSymbol(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/foldingRange":
+- var params FoldingRangeParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.FoldingRange(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/formatting":
+- var params DocumentFormattingParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.Formatting(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/hover":
+- var params HoverParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.Hover(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/implementation":
+- var params ImplementationParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.Implementation(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/inlayHint":
+- var params InlayHintParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.InlayHint(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/inlineValue":
+- var params InlineValueParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.InlineValue(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/linkedEditingRange":
+- var params LinkedEditingRangeParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.LinkedEditingRange(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/moniker":
+- var params MonikerParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.Moniker(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/onTypeFormatting":
+- var params DocumentOnTypeFormattingParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.OnTypeFormatting(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/prepareCallHierarchy":
+- var params CallHierarchyPrepareParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.PrepareCallHierarchy(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/prepareRename":
+- var params PrepareRenameParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.PrepareRename(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/prepareTypeHierarchy":
+- var params TypeHierarchyPrepareParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.PrepareTypeHierarchy(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/rangeFormatting":
+- var params DocumentRangeFormattingParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.RangeFormatting(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/references":
+- var params ReferenceParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.References(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/rename":
+- var params RenameParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.Rename(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/selectionRange":
+- var params SelectionRangeParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.SelectionRange(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/semanticTokens/full":
+- var params SemanticTokensParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.SemanticTokensFull(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/semanticTokens/full/delta":
+- var params SemanticTokensDeltaParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.SemanticTokensFullDelta(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/semanticTokens/range":
+- var params SemanticTokensRangeParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.SemanticTokensRange(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/signatureHelp":
+- var params SignatureHelpParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.SignatureHelp(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/typeDefinition":
+- var params TypeDefinitionParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.TypeDefinition(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "textDocument/willSave":
+- var params WillSaveTextDocumentParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.WillSave(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "textDocument/willSaveWaitUntil":
+- var params WillSaveTextDocumentParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.WillSaveWaitUntil(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "typeHierarchy/subtypes":
+- var params TypeHierarchySubtypesParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.Subtypes(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "typeHierarchy/supertypes":
+- var params TypeHierarchySupertypesParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.Supertypes(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "window/workDoneProgress/cancel":
+- var params WorkDoneProgressCancelParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.WorkDoneProgressCancel(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "workspace/diagnostic":
+- var params WorkspaceDiagnosticParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.DiagnosticWorkspace(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "workspace/didChangeConfiguration":
+- var params DidChangeConfigurationParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.DidChangeConfiguration(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "workspace/didChangeWatchedFiles":
+- var params DidChangeWatchedFilesParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.DidChangeWatchedFiles(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "workspace/didChangeWorkspaceFolders":
+- var params DidChangeWorkspaceFoldersParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.DidChangeWorkspaceFolders(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "workspace/didCreateFiles":
+- var params CreateFilesParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.DidCreateFiles(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "workspace/didDeleteFiles":
+- var params DeleteFilesParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.DidDeleteFiles(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "workspace/didRenameFiles":
+- var params RenameFilesParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- err := server.DidRenameFiles(ctx, &params)
+- return true, reply(ctx, nil, err)
+- case "workspace/executeCommand":
+- var params ExecuteCommandParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.ExecuteCommand(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "workspace/symbol":
+- var params WorkspaceSymbolParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.Symbol(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "workspace/willCreateFiles":
+- var params CreateFilesParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.WillCreateFiles(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "workspace/willDeleteFiles":
+- var params DeleteFilesParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.WillDeleteFiles(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "workspace/willRenameFiles":
+- var params RenameFilesParams
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.WillRenameFiles(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- case "workspaceSymbol/resolve":
+- var params WorkspaceSymbol
+- if err := json.Unmarshal(r.Params(), &params); err != nil {
+- return true, sendParseError(ctx, reply, err)
+- }
+- resp, err := server.ResolveWorkspaceSymbol(ctx, &params)
+- if err != nil {
+- return true, reply(ctx, nil, err)
+- }
+- return true, reply(ctx, resp, nil)
+- default:
+- return false, nil
+- }
+-}
+-
+-func (s *serverDispatcher) Progress(ctx context.Context, params *ProgressParams) error {
+- return s.sender.Notify(ctx, "$/progress", params)
+-}
+-func (s *serverDispatcher) SetTrace(ctx context.Context, params *SetTraceParams) error {
+- return s.sender.Notify(ctx, "$/setTrace", params)
+-}
+-func (s *serverDispatcher) IncomingCalls(ctx context.Context, params *CallHierarchyIncomingCallsParams) ([]CallHierarchyIncomingCall, error) {
+- var result []CallHierarchyIncomingCall
+- if err := s.sender.Call(ctx, "callHierarchy/incomingCalls", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) OutgoingCalls(ctx context.Context, params *CallHierarchyOutgoingCallsParams) ([]CallHierarchyOutgoingCall, error) {
+- var result []CallHierarchyOutgoingCall
+- if err := s.sender.Call(ctx, "callHierarchy/outgoingCalls", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) ResolveCodeAction(ctx context.Context, params *CodeAction) (*CodeAction, error) {
+- var result *CodeAction
+- if err := s.sender.Call(ctx, "codeAction/resolve", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) ResolveCodeLens(ctx context.Context, params *CodeLens) (*CodeLens, error) {
+- var result *CodeLens
+- if err := s.sender.Call(ctx, "codeLens/resolve", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) ResolveCompletionItem(ctx context.Context, params *CompletionItem) (*CompletionItem, error) {
+- var result *CompletionItem
+- if err := s.sender.Call(ctx, "completionItem/resolve", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) ResolveDocumentLink(ctx context.Context, params *DocumentLink) (*DocumentLink, error) {
+- var result *DocumentLink
+- if err := s.sender.Call(ctx, "documentLink/resolve", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) Exit(ctx context.Context) error {
+- return s.sender.Notify(ctx, "exit", nil)
+-}
+-func (s *serverDispatcher) Initialize(ctx context.Context, params *ParamInitialize) (*InitializeResult, error) {
+- var result *InitializeResult
+- if err := s.sender.Call(ctx, "initialize", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) Initialized(ctx context.Context, params *InitializedParams) error {
+- return s.sender.Notify(ctx, "initialized", params)
+-}
+-func (s *serverDispatcher) Resolve(ctx context.Context, params *InlayHint) (*InlayHint, error) {
+- var result *InlayHint
+- if err := s.sender.Call(ctx, "inlayHint/resolve", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) DidChangeNotebookDocument(ctx context.Context, params *DidChangeNotebookDocumentParams) error {
+- return s.sender.Notify(ctx, "notebookDocument/didChange", params)
+-}
+-func (s *serverDispatcher) DidCloseNotebookDocument(ctx context.Context, params *DidCloseNotebookDocumentParams) error {
+- return s.sender.Notify(ctx, "notebookDocument/didClose", params)
+-}
+-func (s *serverDispatcher) DidOpenNotebookDocument(ctx context.Context, params *DidOpenNotebookDocumentParams) error {
+- return s.sender.Notify(ctx, "notebookDocument/didOpen", params)
+-}
+-func (s *serverDispatcher) DidSaveNotebookDocument(ctx context.Context, params *DidSaveNotebookDocumentParams) error {
+- return s.sender.Notify(ctx, "notebookDocument/didSave", params)
+-}
+-func (s *serverDispatcher) Shutdown(ctx context.Context) error {
+- return s.sender.Call(ctx, "shutdown", nil, nil)
+-}
+-func (s *serverDispatcher) CodeAction(ctx context.Context, params *CodeActionParams) ([]CodeAction, error) {
+- var result []CodeAction
+- if err := s.sender.Call(ctx, "textDocument/codeAction", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) CodeLens(ctx context.Context, params *CodeLensParams) ([]CodeLens, error) {
+- var result []CodeLens
+- if err := s.sender.Call(ctx, "textDocument/codeLens", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) ColorPresentation(ctx context.Context, params *ColorPresentationParams) ([]ColorPresentation, error) {
+- var result []ColorPresentation
+- if err := s.sender.Call(ctx, "textDocument/colorPresentation", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) Completion(ctx context.Context, params *CompletionParams) (*CompletionList, error) {
+- var result *CompletionList
+- if err := s.sender.Call(ctx, "textDocument/completion", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) Declaration(ctx context.Context, params *DeclarationParams) (*Or_textDocument_declaration, error) {
+- var result *Or_textDocument_declaration
+- if err := s.sender.Call(ctx, "textDocument/declaration", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) Definition(ctx context.Context, params *DefinitionParams) ([]Location, error) {
+- var result []Location
+- if err := s.sender.Call(ctx, "textDocument/definition", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) Diagnostic(ctx context.Context, params *string) (*string, error) {
+- var result *string
+- if err := s.sender.Call(ctx, "textDocument/diagnostic", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) DidChange(ctx context.Context, params *DidChangeTextDocumentParams) error {
+- return s.sender.Notify(ctx, "textDocument/didChange", params)
+-}
+-func (s *serverDispatcher) DidClose(ctx context.Context, params *DidCloseTextDocumentParams) error {
+- return s.sender.Notify(ctx, "textDocument/didClose", params)
+-}
+-func (s *serverDispatcher) DidOpen(ctx context.Context, params *DidOpenTextDocumentParams) error {
+- return s.sender.Notify(ctx, "textDocument/didOpen", params)
+-}
+-func (s *serverDispatcher) DidSave(ctx context.Context, params *DidSaveTextDocumentParams) error {
+- return s.sender.Notify(ctx, "textDocument/didSave", params)
+-}
+-func (s *serverDispatcher) DocumentColor(ctx context.Context, params *DocumentColorParams) ([]ColorInformation, error) {
+- var result []ColorInformation
+- if err := s.sender.Call(ctx, "textDocument/documentColor", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) DocumentHighlight(ctx context.Context, params *DocumentHighlightParams) ([]DocumentHighlight, error) {
+- var result []DocumentHighlight
+- if err := s.sender.Call(ctx, "textDocument/documentHighlight", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) DocumentLink(ctx context.Context, params *DocumentLinkParams) ([]DocumentLink, error) {
+- var result []DocumentLink
+- if err := s.sender.Call(ctx, "textDocument/documentLink", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) DocumentSymbol(ctx context.Context, params *DocumentSymbolParams) ([]interface{}, error) {
+- var result []interface{}
+- if err := s.sender.Call(ctx, "textDocument/documentSymbol", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) FoldingRange(ctx context.Context, params *FoldingRangeParams) ([]FoldingRange, error) {
+- var result []FoldingRange
+- if err := s.sender.Call(ctx, "textDocument/foldingRange", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) Formatting(ctx context.Context, params *DocumentFormattingParams) ([]TextEdit, error) {
+- var result []TextEdit
+- if err := s.sender.Call(ctx, "textDocument/formatting", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) Hover(ctx context.Context, params *HoverParams) (*Hover, error) {
+- var result *Hover
+- if err := s.sender.Call(ctx, "textDocument/hover", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) Implementation(ctx context.Context, params *ImplementationParams) ([]Location, error) {
+- var result []Location
+- if err := s.sender.Call(ctx, "textDocument/implementation", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) InlayHint(ctx context.Context, params *InlayHintParams) ([]InlayHint, error) {
+- var result []InlayHint
+- if err := s.sender.Call(ctx, "textDocument/inlayHint", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) InlineValue(ctx context.Context, params *InlineValueParams) ([]InlineValue, error) {
+- var result []InlineValue
+- if err := s.sender.Call(ctx, "textDocument/inlineValue", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) LinkedEditingRange(ctx context.Context, params *LinkedEditingRangeParams) (*LinkedEditingRanges, error) {
+- var result *LinkedEditingRanges
+- if err := s.sender.Call(ctx, "textDocument/linkedEditingRange", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) Moniker(ctx context.Context, params *MonikerParams) ([]Moniker, error) {
+- var result []Moniker
+- if err := s.sender.Call(ctx, "textDocument/moniker", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) OnTypeFormatting(ctx context.Context, params *DocumentOnTypeFormattingParams) ([]TextEdit, error) {
+- var result []TextEdit
+- if err := s.sender.Call(ctx, "textDocument/onTypeFormatting", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) PrepareCallHierarchy(ctx context.Context, params *CallHierarchyPrepareParams) ([]CallHierarchyItem, error) {
+- var result []CallHierarchyItem
+- if err := s.sender.Call(ctx, "textDocument/prepareCallHierarchy", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) PrepareRename(ctx context.Context, params *PrepareRenameParams) (*PrepareRename2Gn, error) {
+- var result *PrepareRename2Gn
+- if err := s.sender.Call(ctx, "textDocument/prepareRename", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) PrepareTypeHierarchy(ctx context.Context, params *TypeHierarchyPrepareParams) ([]TypeHierarchyItem, error) {
+- var result []TypeHierarchyItem
+- if err := s.sender.Call(ctx, "textDocument/prepareTypeHierarchy", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) RangeFormatting(ctx context.Context, params *DocumentRangeFormattingParams) ([]TextEdit, error) {
+- var result []TextEdit
+- if err := s.sender.Call(ctx, "textDocument/rangeFormatting", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) References(ctx context.Context, params *ReferenceParams) ([]Location, error) {
+- var result []Location
+- if err := s.sender.Call(ctx, "textDocument/references", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) Rename(ctx context.Context, params *RenameParams) (*WorkspaceEdit, error) {
+- var result *WorkspaceEdit
+- if err := s.sender.Call(ctx, "textDocument/rename", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) SelectionRange(ctx context.Context, params *SelectionRangeParams) ([]SelectionRange, error) {
+- var result []SelectionRange
+- if err := s.sender.Call(ctx, "textDocument/selectionRange", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) SemanticTokensFull(ctx context.Context, params *SemanticTokensParams) (*SemanticTokens, error) {
+- var result *SemanticTokens
+- if err := s.sender.Call(ctx, "textDocument/semanticTokens/full", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) SemanticTokensFullDelta(ctx context.Context, params *SemanticTokensDeltaParams) (interface{}, error) {
+- var result interface{}
+- if err := s.sender.Call(ctx, "textDocument/semanticTokens/full/delta", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) SemanticTokensRange(ctx context.Context, params *SemanticTokensRangeParams) (*SemanticTokens, error) {
+- var result *SemanticTokens
+- if err := s.sender.Call(ctx, "textDocument/semanticTokens/range", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) SignatureHelp(ctx context.Context, params *SignatureHelpParams) (*SignatureHelp, error) {
+- var result *SignatureHelp
+- if err := s.sender.Call(ctx, "textDocument/signatureHelp", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) TypeDefinition(ctx context.Context, params *TypeDefinitionParams) ([]Location, error) {
+- var result []Location
+- if err := s.sender.Call(ctx, "textDocument/typeDefinition", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) WillSave(ctx context.Context, params *WillSaveTextDocumentParams) error {
+- return s.sender.Notify(ctx, "textDocument/willSave", params)
+-}
+-func (s *serverDispatcher) WillSaveWaitUntil(ctx context.Context, params *WillSaveTextDocumentParams) ([]TextEdit, error) {
+- var result []TextEdit
+- if err := s.sender.Call(ctx, "textDocument/willSaveWaitUntil", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) Subtypes(ctx context.Context, params *TypeHierarchySubtypesParams) ([]TypeHierarchyItem, error) {
+- var result []TypeHierarchyItem
+- if err := s.sender.Call(ctx, "typeHierarchy/subtypes", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) Supertypes(ctx context.Context, params *TypeHierarchySupertypesParams) ([]TypeHierarchyItem, error) {
+- var result []TypeHierarchyItem
+- if err := s.sender.Call(ctx, "typeHierarchy/supertypes", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) WorkDoneProgressCancel(ctx context.Context, params *WorkDoneProgressCancelParams) error {
+- return s.sender.Notify(ctx, "window/workDoneProgress/cancel", params)
+-}
+-func (s *serverDispatcher) DiagnosticWorkspace(ctx context.Context, params *WorkspaceDiagnosticParams) (*WorkspaceDiagnosticReport, error) {
+- var result *WorkspaceDiagnosticReport
+- if err := s.sender.Call(ctx, "workspace/diagnostic", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) DidChangeConfiguration(ctx context.Context, params *DidChangeConfigurationParams) error {
+- return s.sender.Notify(ctx, "workspace/didChangeConfiguration", params)
+-}
+-func (s *serverDispatcher) DidChangeWatchedFiles(ctx context.Context, params *DidChangeWatchedFilesParams) error {
+- return s.sender.Notify(ctx, "workspace/didChangeWatchedFiles", params)
+-}
+-func (s *serverDispatcher) DidChangeWorkspaceFolders(ctx context.Context, params *DidChangeWorkspaceFoldersParams) error {
+- return s.sender.Notify(ctx, "workspace/didChangeWorkspaceFolders", params)
+-}
+-func (s *serverDispatcher) DidCreateFiles(ctx context.Context, params *CreateFilesParams) error {
+- return s.sender.Notify(ctx, "workspace/didCreateFiles", params)
+-}
+-func (s *serverDispatcher) DidDeleteFiles(ctx context.Context, params *DeleteFilesParams) error {
+- return s.sender.Notify(ctx, "workspace/didDeleteFiles", params)
+-}
+-func (s *serverDispatcher) DidRenameFiles(ctx context.Context, params *RenameFilesParams) error {
+- return s.sender.Notify(ctx, "workspace/didRenameFiles", params)
+-}
+-func (s *serverDispatcher) ExecuteCommand(ctx context.Context, params *ExecuteCommandParams) (interface{}, error) {
+- var result interface{}
+- if err := s.sender.Call(ctx, "workspace/executeCommand", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) Symbol(ctx context.Context, params *WorkspaceSymbolParams) ([]SymbolInformation, error) {
+- var result []SymbolInformation
+- if err := s.sender.Call(ctx, "workspace/symbol", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) WillCreateFiles(ctx context.Context, params *CreateFilesParams) (*WorkspaceEdit, error) {
+- var result *WorkspaceEdit
+- if err := s.sender.Call(ctx, "workspace/willCreateFiles", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) WillDeleteFiles(ctx context.Context, params *DeleteFilesParams) (*WorkspaceEdit, error) {
+- var result *WorkspaceEdit
+- if err := s.sender.Call(ctx, "workspace/willDeleteFiles", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) WillRenameFiles(ctx context.Context, params *RenameFilesParams) (*WorkspaceEdit, error) {
+- var result *WorkspaceEdit
+- if err := s.sender.Call(ctx, "workspace/willRenameFiles", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) ResolveWorkspaceSymbol(ctx context.Context, params *WorkspaceSymbol) (*WorkspaceSymbol, error) {
+- var result *WorkspaceSymbol
+- if err := s.sender.Call(ctx, "workspaceSymbol/resolve", params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+-func (s *serverDispatcher) NonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error) {
+- var result interface{}
+- if err := s.sender.Call(ctx, method, params, &result); err != nil {
+- return nil, err
+- }
+- return result, nil
+-}
+diff -urN a/gopls/internal/lsp/README.md b/gopls/internal/lsp/README.md
+--- a/gopls/internal/lsp/README.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/README.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-# lsp
+-
+-internal/lsp provides much of the Language Server Protocol (lsp) implementation
+-for gopls.
+-
+-Documentation for users and contributors can be found in the
+-[`gopls/doc`](../../gopls/doc) directory.
+diff -urN a/gopls/internal/lsp/references.go b/gopls/internal/lsp/references.go
+--- a/gopls/internal/lsp/references.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/references.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,25 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/template"
+-)
+-
+-func (s *Server) references(ctx context.Context, params *protocol.ReferenceParams) ([]protocol.Location, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.UnknownKind)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+- if snapshot.View().FileKind(fh) == source.Tmpl {
+- return template.References(ctx, snapshot, fh, params)
+- }
+- return source.References(ctx, snapshot, fh, params.Position, params.Context.IncludeDeclaration)
+-}
+diff -urN a/gopls/internal/lsp/regtest/doc.go b/gopls/internal/lsp/regtest/doc.go
+--- a/gopls/internal/lsp/regtest/doc.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/regtest/doc.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,157 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package regtest provides a framework for writing gopls regression tests.
+-//
+-// User reported regressions are often expressed in terms of editor
+-// interactions. For example: "When I open my editor in this directory,
+-// navigate to this file, and change this line, I get a diagnostic that doesn't
+-// make sense". In these cases reproducing, diagnosing, and writing a test to
+-// protect against this regression can be difficult.
+-//
+-// The regtest package provides an API for developers to express these types of
+-// user interactions in ordinary Go tests, validate them, and run them in a
+-// variety of execution modes.
+-//
+-// # Test package setup
+-//
+-// The regression test package uses a couple of uncommon patterns to reduce
+-// boilerplate in test bodies. First, it is intended to be imported as "." so
+-// that helpers do not need to be qualified. Second, it requires some setup
+-// that is currently implemented in the regtest.Main function, which must be
+-// invoked by TestMain. Therefore, a minimal regtest testing package looks
+-// like this:
+-//
+-// package lsptests
+-//
+-// import (
+-// "fmt"
+-// "testing"
+-//
+-// "golang.org/x/tools/gopls/internal/hooks"
+-// . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-// )
+-//
+-// func TestMain(m *testing.M) {
+-// Main(m, hooks.Options)
+-// }
+-//
+-// # Writing a simple regression test
+-//
+-// To run a regression test use the regtest.Run function, which accepts a
+-// txtar-encoded archive defining the initial workspace state. This function
+-// sets up the workspace in a temporary directory, creates a fake text editor,
+-// starts gopls, and initializes an LSP session. It then invokes the provided
+-// test function with an *Env handle encapsulating the newly created
+-// environment. Because gopls may be run in various modes (as a sidecar or
+-// daemon process, with different settings), the test runner may perform this
+-// process multiple times, re-running the test function each time with a new
+-// environment.
+-//
+-// func TestOpenFile(t *testing.T) {
+-// const files = `
+-// -- go.mod --
+-// module mod.com
+-//
+-// go 1.12
+-// -- foo.go --
+-// package foo
+-// `
+-// Run(t, files, func(t *testing.T, env *Env) {
+-// env.OpenFile("foo.go")
+-// })
+-// }
+-//
+-// # Configuring Regtest Execution
+-//
+-// The regtest package exposes several options that affect the setup process
+-// described above. To use these options, use the WithOptions function:
+-//
+-// WithOptions(opts...).Run(...)
+-//
+-// See options.go for a full list of available options.
+-//
+-// # Operating on editor state
+-//
+-// To operate on editor state within the test body, the Env type provides
+-// access to the workspace directory (Env.SandBox), text editor (Env.Editor),
+-// LSP server (Env.Server), and 'awaiter' (Env.Awaiter).
+-//
+-// In most cases, operations on these primitive building blocks of the
+-// regression test environment expect a Context (which should be a child of
+-// env.Ctx), and return an error. To avoid boilerplate, the Env exposes a set
+-// of wrappers in wrappers.go for use in scripting:
+-//
+-// env.CreateBuffer("c/c.go", "")
+-// env.EditBuffer("c/c.go", fake.Edit{
+-// Text: `package c`,
+-// })
+-//
+-// These wrappers thread through Env.Ctx, and call t.Fatal on any errors.
+-//
+-// # Expressing expectations
+-//
+-// The general pattern for a regression test is to script interactions with the
+-// fake editor and sandbox, and assert that gopls behaves correctly after each
+-// state change. Unfortunately, this is complicated by the fact that state
+-// changes are communicated to gopls via unidirectional client->server
+-// notifications (didOpen, didChange, etc.), and resulting gopls behavior such
+-// as diagnostics, logs, or messages is communicated back via server->client
+-// notifications. Therefore, within regression tests we must be able to say "do
+-// this, and then eventually gopls should do that". To achieve this, the
+-// regtest package provides a framework for expressing conditions that must
+-// eventually be met, in terms of the Expectation type.
+-//
+-// To express the assertion that "eventually gopls must meet these
+-// expectations", use env.Await(...):
+-//
+-// env.RegexpReplace("x/x.go", `package x`, `package main`)
+-// env.Await(env.DiagnosticAtRegexp("x/main.go", `fmt`))
+-//
+-// Await evaluates the provided expectations atomically, whenever the client
+-// receives a state-changing notification from gopls. See expectation.go for a
+-// full list of available expectations.
+-//
+-// A fundamental problem with this model is that if gopls never meets the
+-// provided expectations, the test runner will hang until the test timeout
+-// (which defaults to 10m). There are two ways to work around this poor
+-// behavior:
+-//
+-// 1. Use a precondition to define precisely when we expect conditions to be
+-// met. Gopls provides the OnceMet(precondition, expectations...) pattern
+-// to express ("once this precondition is met, the following expectations
+-// must all hold"). To instrument preconditions, gopls uses verbose
+-// progress notifications to inform the client about ongoing work (see
+-// CompletedWork). The most common precondition is to wait for gopls to be
+-// done processing all change notifications, for which the regtest package
+-// provides the AfterChange helper. For example:
+-//
+-// // We expect diagnostics to be cleared after gopls is done processing the
+-// // didSave notification.
+-// env.SaveBuffer("a/go.mod")
+-// env.AfterChange(EmptyDiagnostics("a/go.mod"))
+-//
+-// 2. Set a shorter timeout during development, if you expect to be breaking
+-// tests. By setting the environment variable GOPLS_REGTEST_TIMEOUT=5s,
+-// regression tests will time out after 5 seconds.
+-//
+-// # Tips & Tricks
+-//
+-// Here are some tips and tricks for working with regression tests:
+-//
+-// 1. Set the environment variable GOPLS_REGTEST_TIMEOUT=5s during development.
+-// 2. Run tests with -short. This will only run regression tests in the
+-// default gopls execution mode.
+-// 3. Use capture groups to narrow regexp positions. All regular-expression
+-// based positions (such as DiagnosticAtRegexp) will match the position of
+-// the first capture group, if any are provided. This can be used to
+-// identify a specific position in the code for a pattern that may occur in
+-// multiple places. For example `var (mu) sync.Mutex` matches the position
+-// of "mu" within the variable declaration.
+-// 4. Read diagnostics into a variable to implement more complicated
+-// assertions about diagnostic state in the editor. To do this, use the
+-// pattern OnceMet(precondition, ReadDiagnostics("file.go", &d)) to capture
+-// the current diagnostics as soon as the precondition is met. This is
+-// preferable to accessing the diagnostics directly, as it avoids races.
+-package regtest
+diff -urN a/gopls/internal/lsp/regtest/env.go b/gopls/internal/lsp/regtest/env.go
+--- a/gopls/internal/lsp/regtest/env.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/regtest/env.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,391 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package regtest
+-
+-import (
+- "context"
+- "fmt"
+- "strings"
+- "sync"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/jsonrpc2/servertest"
+-)
+-
+-// Env holds the building blocks of an editor testing environment, providing
+-// wrapper methods that hide the boilerplate of plumbing contexts and checking
+-// errors.
+-type Env struct {
+- T testing.TB // TODO(rfindley): rename to TB
+- Ctx context.Context
+-
+- // Most tests should not need to access the scratch area, editor, server, or
+- // connection, but they are available if needed.
+- Sandbox *fake.Sandbox
+- Server servertest.Connector
+-
+- // Editor is owned by the Env, and shut down
+- Editor *fake.Editor
+-
+- Awaiter *Awaiter
+-}
+-
+-// An Awaiter keeps track of relevant LSP state, so that it may be asserted
+-// upon with Expectations.
+-//
+-// Wire it into a fake.Editor using Awaiter.Hooks().
+-//
+-// TODO(rfindley): consider simply merging Awaiter with the fake.Editor. It
+-// probably is not worth its own abstraction.
+-type Awaiter struct {
+- workdir *fake.Workdir
+-
+- mu sync.Mutex
+- // For simplicity, each waiter gets a unique ID.
+- nextWaiterID int
+- state State
+- waiters map[int]*condition
+-}
+-
+-func NewAwaiter(workdir *fake.Workdir) *Awaiter {
+- return &Awaiter{
+- workdir: workdir,
+- state: State{
+- diagnostics: make(map[string]*protocol.PublishDiagnosticsParams),
+- work: make(map[protocol.ProgressToken]*workProgress),
+- },
+- waiters: make(map[int]*condition),
+- }
+-}
+-
+-// Hooks returns LSP client hooks required for awaiting asynchronous expectations.
+-func (a *Awaiter) Hooks() fake.ClientHooks {
+- return fake.ClientHooks{
+- OnDiagnostics: a.onDiagnostics,
+- OnLogMessage: a.onLogMessage,
+- OnWorkDoneProgressCreate: a.onWorkDoneProgressCreate,
+- OnProgress: a.onProgress,
+- OnShowMessage: a.onShowMessage,
+- OnShowMessageRequest: a.onShowMessageRequest,
+- OnRegisterCapability: a.onRegisterCapability,
+- OnUnregisterCapability: a.onUnregisterCapability,
+- OnApplyEdit: a.onApplyEdit,
+- }
+-}
+-
+-// State encapsulates the server state TODO: explain more
+-type State struct {
+- // diagnostics are a map of relative path->diagnostics params
+- diagnostics map[string]*protocol.PublishDiagnosticsParams
+- logs []*protocol.LogMessageParams
+- showMessage []*protocol.ShowMessageParams
+- showMessageRequest []*protocol.ShowMessageRequestParams
+-
+- registrations []*protocol.RegistrationParams
+- registeredCapabilities map[string]protocol.Registration
+- unregistrations []*protocol.UnregistrationParams
+- documentChanges []protocol.DocumentChanges // collected from ApplyEdit downcalls
+-
+- // outstandingWork is a map of token->work summary. All tokens are assumed to
+- // be string, though the spec allows for numeric tokens as well. When work
+- // completes, it is deleted from this map.
+- work map[protocol.ProgressToken]*workProgress
+-}
+-
+-// outstandingWork counts started but not complete work items by title.
+-func (s State) outstandingWork() map[string]uint64 {
+- outstanding := make(map[string]uint64)
+- for _, work := range s.work {
+- if !work.complete {
+- outstanding[work.title]++
+- }
+- }
+- return outstanding
+-}
+-
+-// completedWork counts complete work items by title.
+-func (s State) completedWork() map[string]uint64 {
+- completed := make(map[string]uint64)
+- for _, work := range s.work {
+- if work.complete {
+- completed[work.title]++
+- }
+- }
+- return completed
+-}
+-
+-// startedWork counts started (and possibly complete) work items.
+-func (s State) startedWork() map[string]uint64 {
+- started := make(map[string]uint64)
+- for _, work := range s.work {
+- started[work.title]++
+- }
+- return started
+-}
+-
+-type workProgress struct {
+- title, msg, endMsg string
+- percent float64
+- complete bool // seen 'end'.
+-}
+-
+-// This method, provided for debugging, accesses mutable fields without a lock,
+-// so it must not be called concurrent with any State mutation.
+-func (s State) String() string {
+- var b strings.Builder
+- b.WriteString("#### log messages (see RPC logs for full text):\n")
+- for _, msg := range s.logs {
+- summary := fmt.Sprintf("%v: %q", msg.Type, msg.Message)
+- if len(summary) > 60 {
+- summary = summary[:57] + "..."
+- }
+- // Some logs are quite long, and since they should be reproduced in the RPC
+- // logs on any failure we include here just a short summary.
+- fmt.Fprint(&b, "\t"+summary+"\n")
+- }
+- b.WriteString("\n")
+- b.WriteString("#### diagnostics:\n")
+- for name, params := range s.diagnostics {
+- fmt.Fprintf(&b, "\t%s (version %d):\n", name, int(params.Version))
+- for _, d := range params.Diagnostics {
+- fmt.Fprintf(&b, "\t\t(%d, %d) [%s]: %s\n", int(d.Range.Start.Line), int(d.Range.Start.Character), d.Source, d.Message)
+- }
+- }
+- b.WriteString("\n")
+- b.WriteString("#### outstanding work:\n")
+- for token, state := range s.work {
+- if state.complete {
+- continue
+- }
+- name := state.title
+- if name == "" {
+- name = fmt.Sprintf("!NO NAME(token: %s)", token)
+- }
+- fmt.Fprintf(&b, "\t%s: %.2f\n", name, state.percent)
+- }
+- b.WriteString("#### completed work:\n")
+- for name, count := range s.completedWork() {
+- fmt.Fprintf(&b, "\t%s: %d\n", name, count)
+- }
+- return b.String()
+-}
+-
+-// A condition is satisfied when all expectations are simultaneously
+-// met. At that point, the 'met' channel is closed. On any failure, err is set
+-// and the failed channel is closed.
+-type condition struct {
+- expectations []Expectation
+- verdict chan Verdict
+-}
+-
+-func (a *Awaiter) onApplyEdit(_ context.Context, params *protocol.ApplyWorkspaceEditParams) error {
+- a.mu.Lock()
+- defer a.mu.Unlock()
+-
+- a.state.documentChanges = append(a.state.documentChanges, params.Edit.DocumentChanges...)
+- a.checkConditionsLocked()
+- return nil
+-}
+-
+-func (a *Awaiter) onDiagnostics(_ context.Context, d *protocol.PublishDiagnosticsParams) error {
+- a.mu.Lock()
+- defer a.mu.Unlock()
+-
+- pth := a.workdir.URIToPath(d.URI)
+- a.state.diagnostics[pth] = d
+- a.checkConditionsLocked()
+- return nil
+-}
+-
+-func (a *Awaiter) onShowMessage(_ context.Context, m *protocol.ShowMessageParams) error {
+- a.mu.Lock()
+- defer a.mu.Unlock()
+-
+- a.state.showMessage = append(a.state.showMessage, m)
+- a.checkConditionsLocked()
+- return nil
+-}
+-
+-func (a *Awaiter) onShowMessageRequest(_ context.Context, m *protocol.ShowMessageRequestParams) error {
+- a.mu.Lock()
+- defer a.mu.Unlock()
+-
+- a.state.showMessageRequest = append(a.state.showMessageRequest, m)
+- a.checkConditionsLocked()
+- return nil
+-}
+-
+-func (a *Awaiter) onLogMessage(_ context.Context, m *protocol.LogMessageParams) error {
+- a.mu.Lock()
+- defer a.mu.Unlock()
+-
+- a.state.logs = append(a.state.logs, m)
+- a.checkConditionsLocked()
+- return nil
+-}
+-
+-func (a *Awaiter) onWorkDoneProgressCreate(_ context.Context, m *protocol.WorkDoneProgressCreateParams) error {
+- a.mu.Lock()
+- defer a.mu.Unlock()
+-
+- a.state.work[m.Token] = &workProgress{}
+- return nil
+-}
+-
+-func (a *Awaiter) onProgress(_ context.Context, m *protocol.ProgressParams) error {
+- a.mu.Lock()
+- defer a.mu.Unlock()
+- work, ok := a.state.work[m.Token]
+- if !ok {
+- panic(fmt.Sprintf("got progress report for unknown report %v: %v", m.Token, m))
+- }
+- v := m.Value.(map[string]interface{})
+- switch kind := v["kind"]; kind {
+- case "begin":
+- work.title = v["title"].(string)
+- if msg, ok := v["message"]; ok {
+- work.msg = msg.(string)
+- }
+- case "report":
+- if pct, ok := v["percentage"]; ok {
+- work.percent = pct.(float64)
+- }
+- if msg, ok := v["message"]; ok {
+- work.msg = msg.(string)
+- }
+- case "end":
+- work.complete = true
+- if msg, ok := v["message"]; ok {
+- work.endMsg = msg.(string)
+- }
+- }
+- a.checkConditionsLocked()
+- return nil
+-}
+-
+-func (a *Awaiter) onRegisterCapability(_ context.Context, m *protocol.RegistrationParams) error {
+- a.mu.Lock()
+- defer a.mu.Unlock()
+-
+- a.state.registrations = append(a.state.registrations, m)
+- if a.state.registeredCapabilities == nil {
+- a.state.registeredCapabilities = make(map[string]protocol.Registration)
+- }
+- for _, reg := range m.Registrations {
+- a.state.registeredCapabilities[reg.Method] = reg
+- }
+- a.checkConditionsLocked()
+- return nil
+-}
+-
+-func (a *Awaiter) onUnregisterCapability(_ context.Context, m *protocol.UnregistrationParams) error {
+- a.mu.Lock()
+- defer a.mu.Unlock()
+-
+- a.state.unregistrations = append(a.state.unregistrations, m)
+- a.checkConditionsLocked()
+- return nil
+-}
+-
+-func (a *Awaiter) checkConditionsLocked() {
+- for id, condition := range a.waiters {
+- if v, _ := checkExpectations(a.state, condition.expectations); v != Unmet {
+- delete(a.waiters, id)
+- condition.verdict <- v
+- }
+- }
+-}
+-
+-// takeDocumentChanges returns any accumulated document changes (from
+-// server ApplyEdit RPC downcalls) and resets the list.
+-func (a *Awaiter) takeDocumentChanges() []protocol.DocumentChanges {
+- a.mu.Lock()
+- defer a.mu.Unlock()
+-
+- res := a.state.documentChanges
+- a.state.documentChanges = nil
+- return res
+-}
+-
+-// checkExpectations reports whether s meets all expectations.
+-func checkExpectations(s State, expectations []Expectation) (Verdict, string) {
+- finalVerdict := Met
+- var summary strings.Builder
+- for _, e := range expectations {
+- v := e.Check(s)
+- if v > finalVerdict {
+- finalVerdict = v
+- }
+- fmt.Fprintf(&summary, "%v: %s\n", v, e.Description)
+- }
+- return finalVerdict, summary.String()
+-}
+-
+-// Await blocks until the given expectations are all simultaneously met.
+-//
+-// Generally speaking Await should be avoided because it blocks indefinitely if
+-// gopls ends up in a state where the expectations are never going to be met.
+-// Use AfterChange or OnceMet instead, so that the runner knows when to stop
+-// waiting.
+-func (e *Env) Await(expectations ...Expectation) {
+- e.T.Helper()
+- if err := e.Awaiter.Await(e.Ctx, expectations...); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// OnceMet blocks until the precondition is met by the state or becomes
+-// unmeetable. If it was met, OnceMet checks that the state meets all
+-// expectations in mustMeets.
+-func (e *Env) OnceMet(precondition Expectation, mustMeets ...Expectation) {
+- e.Await(OnceMet(precondition, mustMeets...))
+-}
+-
+-// Await waits for all expectations to simultaneously be met. It should only be
+-// called from the main test goroutine.
+-func (a *Awaiter) Await(ctx context.Context, expectations ...Expectation) error {
+- a.mu.Lock()
+- // Before adding the waiter, we check if the condition is currently met or
+- // failed to avoid a race where the condition was realized before Await was
+- // called.
+- switch verdict, summary := checkExpectations(a.state, expectations); verdict {
+- case Met:
+- a.mu.Unlock()
+- return nil
+- case Unmeetable:
+- err := fmt.Errorf("unmeetable expectations:\n%s\nstate:\n%v", summary, a.state)
+- a.mu.Unlock()
+- return err
+- }
+- cond := &condition{
+- expectations: expectations,
+- verdict: make(chan Verdict),
+- }
+- a.waiters[a.nextWaiterID] = cond
+- a.nextWaiterID++
+- a.mu.Unlock()
+-
+- var err error
+- select {
+- case <-ctx.Done():
+- err = ctx.Err()
+- case v := <-cond.verdict:
+- if v != Met {
+- err = fmt.Errorf("condition has final verdict %v", v)
+- }
+- }
+- a.mu.Lock()
+- defer a.mu.Unlock()
+- _, summary := checkExpectations(a.state, expectations)
+-
+- // Debugging an unmet expectation can be tricky, so we put some effort into
+- // nicely formatting the failure.
+- if err != nil {
+- return fmt.Errorf("waiting on:\n%s\nerr:%v\n\nstate:\n%v", summary, err, a.state)
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/regtest/env_test.go b/gopls/internal/lsp/regtest/env_test.go
+--- a/gopls/internal/lsp/regtest/env_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/regtest/env_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,66 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package regtest
+-
+-import (
+- "context"
+- "encoding/json"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-func TestProgressUpdating(t *testing.T) {
+- a := &Awaiter{
+- state: State{
+- work: make(map[protocol.ProgressToken]*workProgress),
+- },
+- }
+- ctx := context.Background()
+- if err := a.onWorkDoneProgressCreate(ctx, &protocol.WorkDoneProgressCreateParams{
+- Token: "foo",
+- }); err != nil {
+- t.Fatal(err)
+- }
+- if err := a.onWorkDoneProgressCreate(ctx, &protocol.WorkDoneProgressCreateParams{
+- Token: "bar",
+- }); err != nil {
+- t.Fatal(err)
+- }
+- updates := []struct {
+- token string
+- value interface{}
+- }{
+- {"foo", protocol.WorkDoneProgressBegin{Kind: "begin", Title: "foo work"}},
+- {"bar", protocol.WorkDoneProgressBegin{Kind: "begin", Title: "bar work"}},
+- {"foo", protocol.WorkDoneProgressEnd{Kind: "end"}},
+- {"bar", protocol.WorkDoneProgressReport{Kind: "report", Percentage: 42}},
+- }
+- for _, update := range updates {
+- params := &protocol.ProgressParams{
+- Token: update.token,
+- Value: update.value,
+- }
+- data, err := json.Marshal(params)
+- if err != nil {
+- t.Fatal(err)
+- }
+- var unmarshaled protocol.ProgressParams
+- if err := json.Unmarshal(data, &unmarshaled); err != nil {
+- t.Fatal(err)
+- }
+- if err := a.onProgress(ctx, &unmarshaled); err != nil {
+- t.Fatal(err)
+- }
+- }
+- if !a.state.work["foo"].complete {
+- t.Error("work entry \"foo\" is incomplete, want complete")
+- }
+- got := *a.state.work["bar"]
+- want := workProgress{title: "bar work", percent: 42}
+- if got != want {
+- t.Errorf("work progress for \"bar\": %v, want %v", got, want)
+- }
+-}
+diff -urN a/gopls/internal/lsp/regtest/expectation.go b/gopls/internal/lsp/regtest/expectation.go
+--- a/gopls/internal/lsp/regtest/expectation.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/regtest/expectation.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,769 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package regtest
+-
+-import (
+- "fmt"
+- "regexp"
+- "sort"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-var (
+- // InitialWorkspaceLoad is an expectation that the workspace initial load has
+- // completed. It is verified via workdone reporting.
+- InitialWorkspaceLoad = CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromInitialWorkspaceLoad), 1, false)
+-)
+-
+-// A Verdict is the result of checking an expectation against the current
+-// editor state.
+-type Verdict int
+-
+-// Order matters for the following constants: verdicts are sorted in order of
+-// decisiveness.
+-const (
+- // Met indicates that an expectation is satisfied by the current state.
+- Met Verdict = iota
+- // Unmet indicates that an expectation is not currently met, but could be met
+- // in the future.
+- Unmet
+- // Unmeetable indicates that an expectation cannot be satisfied in the
+- // future.
+- Unmeetable
+-)
+-
+-func (v Verdict) String() string {
+- switch v {
+- case Met:
+- return "Met"
+- case Unmet:
+- return "Unmet"
+- case Unmeetable:
+- return "Unmeetable"
+- }
+- return fmt.Sprintf("unrecognized verdict %d", v)
+-}
+-
+-// An Expectation is an expected property of the state of the LSP client.
+-// The Check function reports whether the property is met.
+-//
+-// Expectations are combinators. By composing them, tests may express
+-// complex expectations in terms of simpler ones.
+-//
+-// TODO(rfindley): as expectations are combined, it becomes harder to identify
+-// why they failed. A better signature for Check would be
+-//
+-// func(State) (Verdict, string)
+-//
+-// returning a reason for the verdict that can be composed similarly to
+-// descriptions.
+-type Expectation struct {
+- Check func(State) Verdict
+-
+- // Description holds a noun-phrase identifying what the expectation checks.
+- //
+- // TODO(rfindley): revisit existing descriptions to ensure they compose nicely.
+- Description string
+-}
+-
+-// OnceMet returns an Expectation that, once the precondition is met, asserts
+-// that mustMeet is met.
+-func OnceMet(precondition Expectation, mustMeets ...Expectation) Expectation {
+- check := func(s State) Verdict {
+- switch pre := precondition.Check(s); pre {
+- case Unmeetable:
+- return Unmeetable
+- case Met:
+- for _, mustMeet := range mustMeets {
+- verdict := mustMeet.Check(s)
+- if verdict != Met {
+- return Unmeetable
+- }
+- }
+- return Met
+- default:
+- return Unmet
+- }
+- }
+- description := describeExpectations(mustMeets...)
+- return Expectation{
+- Check: check,
+- Description: fmt.Sprintf("once %q is met, must have:\n%s", precondition.Description, description),
+- }
+-}
+-
+-func describeExpectations(expectations ...Expectation) string {
+- var descriptions []string
+- for _, e := range expectations {
+- descriptions = append(descriptions, e.Description)
+- }
+- return strings.Join(descriptions, "\n")
+-}
+-
+-// AnyOf returns an expectation that is satisfied when any of the given
+-// expectations is met.
+-func AnyOf(anyOf ...Expectation) Expectation {
+- check := func(s State) Verdict {
+- for _, e := range anyOf {
+- verdict := e.Check(s)
+- if verdict == Met {
+- return Met
+- }
+- }
+- return Unmet
+- }
+- description := describeExpectations(anyOf...)
+- return Expectation{
+- Check: check,
+- Description: fmt.Sprintf("Any of:\n%s", description),
+- }
+-}
+-
+-// AllOf expects that all given expectations are met.
+-//
+-// TODO(rfindley): the problem with these types of combinators (OnceMet, AnyOf
+-// and AllOf) is that we lose the information of *why* they failed: the Awaiter
+-// is not smart enough to look inside.
+-//
+-// Refactor the API such that the Check function is responsible for explaining
+-// why an expectation failed. This should allow us to significantly improve
+-// test output: we won't need to summarize state at all, as the verdict
+-// explanation itself should describe clearly why the expectation not met.
+-func AllOf(allOf ...Expectation) Expectation {
+- check := func(s State) Verdict {
+- verdict := Met
+- for _, e := range allOf {
+- if v := e.Check(s); v > verdict {
+- verdict = v
+- }
+- }
+- return verdict
+- }
+- description := describeExpectations(allOf...)
+- return Expectation{
+- Check: check,
+- Description: fmt.Sprintf("All of:\n%s", description),
+- }
+-}
+-
+-// ReadDiagnostics is an Expectation that stores the current diagnostics for
+-// fileName in into, whenever it is evaluated.
+-//
+-// It can be used in combination with OnceMet or AfterChange to capture the
+-// state of diagnostics when other expectations are satisfied.
+-func ReadDiagnostics(fileName string, into *protocol.PublishDiagnosticsParams) Expectation {
+- check := func(s State) Verdict {
+- diags, ok := s.diagnostics[fileName]
+- if !ok {
+- return Unmeetable
+- }
+- *into = *diags
+- return Met
+- }
+- return Expectation{
+- Check: check,
+- Description: fmt.Sprintf("read diagnostics for %q", fileName),
+- }
+-}
+-
+-// ReadAllDiagnostics is an expectation that stores all published diagnostics
+-// into the provided map, whenever it is evaluated.
+-//
+-// It can be used in combination with OnceMet or AfterChange to capture the
+-// state of diagnostics when other expectations are satisfied.
+-func ReadAllDiagnostics(into *map[string]*protocol.PublishDiagnosticsParams) Expectation {
+- check := func(s State) Verdict {
+- allDiags := make(map[string]*protocol.PublishDiagnosticsParams)
+- for name, diags := range s.diagnostics {
+- allDiags[name] = diags
+- }
+- *into = allDiags
+- return Met
+- }
+- return Expectation{
+- Check: check,
+- Description: "read all diagnostics",
+- }
+-}
+-
+-// NoOutstandingWork asserts that there is no work initiated using the LSP
+-// $/progress API that has not completed.
+-func NoOutstandingWork() Expectation {
+- check := func(s State) Verdict {
+- if len(s.outstandingWork()) == 0 {
+- return Met
+- }
+- return Unmet
+- }
+- return Expectation{
+- Check: check,
+- Description: "no outstanding work",
+- }
+-}
+-
+-// NoShownMessage asserts that the editor has not received a ShowMessage.
+-func NoShownMessage(subString string) Expectation {
+- check := func(s State) Verdict {
+- for _, m := range s.showMessage {
+- if strings.Contains(m.Message, subString) {
+- return Unmeetable
+- }
+- }
+- return Met
+- }
+- return Expectation{
+- Check: check,
+- Description: fmt.Sprintf("no ShowMessage received containing %q", subString),
+- }
+-}
+-
+-// ShownMessage asserts that the editor has received a ShowMessageRequest
+-// containing the given substring.
+-func ShownMessage(containing string) Expectation {
+- check := func(s State) Verdict {
+- for _, m := range s.showMessage {
+- if strings.Contains(m.Message, containing) {
+- return Met
+- }
+- }
+- return Unmet
+- }
+- return Expectation{
+- Check: check,
+- Description: "received ShowMessage",
+- }
+-}
+-
+-// ShowMessageRequest asserts that the editor has received a ShowMessageRequest
+-// with an action item that has the given title.
+-func ShowMessageRequest(title string) Expectation {
+- check := func(s State) Verdict {
+- if len(s.showMessageRequest) == 0 {
+- return Unmet
+- }
+- // Only check the most recent one.
+- m := s.showMessageRequest[len(s.showMessageRequest)-1]
+- if len(m.Actions) == 0 || len(m.Actions) > 1 {
+- return Unmet
+- }
+- if m.Actions[0].Title == title {
+- return Met
+- }
+- return Unmet
+- }
+- return Expectation{
+- Check: check,
+- Description: "received ShowMessageRequest",
+- }
+-}
+-
+-// DoneDiagnosingChanges expects that diagnostics are complete from common
+-// change notifications: didOpen, didChange, didSave, didChangeWatchedFiles,
+-// and didClose.
+-//
+-// This can be used when multiple notifications may have been sent, such as
+-// when a didChange is immediately followed by a didSave. It is insufficient to
+-// simply await NoOutstandingWork, because the LSP client has no control over
+-// when the server starts processing a notification. Therefore, we must keep
+-// track of
+-func (e *Env) DoneDiagnosingChanges() Expectation {
+- stats := e.Editor.Stats()
+- statsBySource := map[lsp.ModificationSource]uint64{
+- lsp.FromDidOpen: stats.DidOpen,
+- lsp.FromDidChange: stats.DidChange,
+- lsp.FromDidSave: stats.DidSave,
+- lsp.FromDidChangeWatchedFiles: stats.DidChangeWatchedFiles,
+- lsp.FromDidClose: stats.DidClose,
+- }
+-
+- var expected []lsp.ModificationSource
+- for k, v := range statsBySource {
+- if v > 0 {
+- expected = append(expected, k)
+- }
+- }
+-
+- // Sort for stability.
+- sort.Slice(expected, func(i, j int) bool {
+- return expected[i] < expected[j]
+- })
+-
+- var all []Expectation
+- for _, source := range expected {
+- all = append(all, CompletedWork(lsp.DiagnosticWorkTitle(source), statsBySource[source], true))
+- }
+-
+- return AllOf(all...)
+-}
+-
+-// AfterChange expects that the given expectations will be met after all
+-// state-changing notifications have been processed by the server.
+-//
+-// It awaits the completion of all anticipated work before checking the given
+-// expectations.
+-func (e *Env) AfterChange(expectations ...Expectation) {
+- e.T.Helper()
+- e.OnceMet(
+- e.DoneDiagnosingChanges(),
+- expectations...,
+- )
+-}
+-
+-// DoneWithOpen expects all didOpen notifications currently sent by the editor
+-// to be completely processed.
+-func (e *Env) DoneWithOpen() Expectation {
+- opens := e.Editor.Stats().DidOpen
+- return CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidOpen), opens, true)
+-}
+-
+-// StartedChange expects that the server has at least started processing all
+-// didChange notifications sent from the client.
+-func (e *Env) StartedChange() Expectation {
+- changes := e.Editor.Stats().DidChange
+- return StartedWork(lsp.DiagnosticWorkTitle(lsp.FromDidChange), changes)
+-}
+-
+-// DoneWithChange expects all didChange notifications currently sent by the
+-// editor to be completely processed.
+-func (e *Env) DoneWithChange() Expectation {
+- changes := e.Editor.Stats().DidChange
+- return CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidChange), changes, true)
+-}
+-
+-// DoneWithSave expects all didSave notifications currently sent by the editor
+-// to be completely processed.
+-func (e *Env) DoneWithSave() Expectation {
+- saves := e.Editor.Stats().DidSave
+- return CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidSave), saves, true)
+-}
+-
+-// StartedChangeWatchedFiles expects that the server has at least started
+-// processing all didChangeWatchedFiles notifications sent from the client.
+-func (e *Env) StartedChangeWatchedFiles() Expectation {
+- changes := e.Editor.Stats().DidChangeWatchedFiles
+- return StartedWork(lsp.DiagnosticWorkTitle(lsp.FromDidChangeWatchedFiles), changes)
+-}
+-
+-// DoneWithChangeWatchedFiles expects all didChangeWatchedFiles notifications
+-// currently sent by the editor to be completely processed.
+-func (e *Env) DoneWithChangeWatchedFiles() Expectation {
+- changes := e.Editor.Stats().DidChangeWatchedFiles
+- return CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidChangeWatchedFiles), changes, true)
+-}
+-
+-// DoneWithClose expects all didClose notifications currently sent by the
+-// editor to be completely processed.
+-func (e *Env) DoneWithClose() Expectation {
+- changes := e.Editor.Stats().DidClose
+- return CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidClose), changes, true)
+-}
+-
+-// StartedWork expect a work item to have been started >= atLeast times.
+-//
+-// See CompletedWork.
+-func StartedWork(title string, atLeast uint64) Expectation {
+- check := func(s State) Verdict {
+- if s.startedWork()[title] >= atLeast {
+- return Met
+- }
+- return Unmet
+- }
+- return Expectation{
+- Check: check,
+- Description: fmt.Sprintf("started work %q at least %d time(s)", title, atLeast),
+- }
+-}
+-
+-// CompletedWork expects a work item to have been completed >= atLeast times.
+-//
+-// Since the Progress API doesn't include any hidden metadata, we must use the
+-// progress notification title to identify the work we expect to be completed.
+-func CompletedWork(title string, count uint64, atLeast bool) Expectation {
+- check := func(s State) Verdict {
+- completed := s.completedWork()
+- if completed[title] == count || atLeast && completed[title] > count {
+- return Met
+- }
+- return Unmet
+- }
+- desc := fmt.Sprintf("completed work %q %v times", title, count)
+- if atLeast {
+- desc = fmt.Sprintf("completed work %q at least %d time(s)", title, count)
+- }
+- return Expectation{
+- Check: check,
+- Description: desc,
+- }
+-}
+-
+-type WorkStatus struct {
+- // Last seen message from either `begin` or `report` progress.
+- Msg string
+- // Message sent with `end` progress message.
+- EndMsg string
+-}
+-
+-// CompletedProgress expects that workDone progress is complete for the given
+-// progress token. When non-nil WorkStatus is provided, it will be filled
+-// when the expectation is met.
+-//
+-// If the token is not a progress token that the client has seen, this
+-// expectation is Unmeetable.
+-func CompletedProgress(token protocol.ProgressToken, into *WorkStatus) Expectation {
+- check := func(s State) Verdict {
+- work, ok := s.work[token]
+- if !ok {
+- return Unmeetable // TODO(rfindley): refactor to allow the verdict to explain this result
+- }
+- if work.complete {
+- if into != nil {
+- into.Msg = work.msg
+- into.EndMsg = work.endMsg
+- }
+- return Met
+- }
+- return Unmet
+- }
+- desc := fmt.Sprintf("completed work for token %v", token)
+- return Expectation{
+- Check: check,
+- Description: desc,
+- }
+-}
+-
+-// OutstandingWork expects a work item to be outstanding. The given title must
+-// be an exact match, whereas the given msg must only be contained in the work
+-// item's message.
+-func OutstandingWork(title, msg string) Expectation {
+- check := func(s State) Verdict {
+- for _, work := range s.work {
+- if work.complete {
+- continue
+- }
+- if work.title == title && strings.Contains(work.msg, msg) {
+- return Met
+- }
+- }
+- return Unmet
+- }
+- return Expectation{
+- Check: check,
+- Description: fmt.Sprintf("outstanding work: %q containing %q", title, msg),
+- }
+-}
+-
+-// NoErrorLogs asserts that the client has not received any log messages of
+-// error severity.
+-func NoErrorLogs() Expectation {
+- return NoLogMatching(protocol.Error, "")
+-}
+-
+-// LogMatching asserts that the client has received a log message
+-// of type typ matching the regexp re a certain number of times.
+-//
+-// The count argument specifies the expected number of matching logs. If
+-// atLeast is set, this is a lower bound, otherwise there must be exactly count
+-// matching logs.
+-func LogMatching(typ protocol.MessageType, re string, count int, atLeast bool) Expectation {
+- rec, err := regexp.Compile(re)
+- if err != nil {
+- panic(err)
+- }
+- check := func(state State) Verdict {
+- var found int
+- for _, msg := range state.logs {
+- if msg.Type == typ && rec.Match([]byte(msg.Message)) {
+- found++
+- }
+- }
+- // Check for an exact or "at least" match.
+- if found == count || (found >= count && atLeast) {
+- return Met
+- }
+- return Unmet
+- }
+- desc := fmt.Sprintf("log message matching %q expected %v times", re, count)
+- if atLeast {
+- desc = fmt.Sprintf("log message matching %q expected at least %v times", re, count)
+- }
+- return Expectation{
+- Check: check,
+- Description: desc,
+- }
+-}
+-
+-// NoLogMatching asserts that the client has not received a log message
+-// of type typ matching the regexp re. If re is an empty string, any log
+-// message is considered a match.
+-func NoLogMatching(typ protocol.MessageType, re string) Expectation {
+- var r *regexp.Regexp
+- if re != "" {
+- var err error
+- r, err = regexp.Compile(re)
+- if err != nil {
+- panic(err)
+- }
+- }
+- check := func(state State) Verdict {
+- for _, msg := range state.logs {
+- if msg.Type != typ {
+- continue
+- }
+- if r == nil || r.Match([]byte(msg.Message)) {
+- return Unmeetable
+- }
+- }
+- return Met
+- }
+- return Expectation{
+- Check: check,
+- Description: fmt.Sprintf("no log message matching %q", re),
+- }
+-}
+-
+-// FileWatchMatching expects that a file registration matches re.
+-func FileWatchMatching(re string) Expectation {
+- return Expectation{
+- Check: checkFileWatch(re, Met, Unmet),
+- Description: fmt.Sprintf("file watch matching %q", re),
+- }
+-}
+-
+-// NoFileWatchMatching expects that no file registration matches re.
+-func NoFileWatchMatching(re string) Expectation {
+- return Expectation{
+- Check: checkFileWatch(re, Unmet, Met),
+- Description: fmt.Sprintf("no file watch matching %q", re),
+- }
+-}
+-
+-func checkFileWatch(re string, onMatch, onNoMatch Verdict) func(State) Verdict {
+- rec := regexp.MustCompile(re)
+- return func(s State) Verdict {
+- r := s.registeredCapabilities["workspace/didChangeWatchedFiles"]
+- watchers := jsonProperty(r.RegisterOptions, "watchers").([]interface{})
+- for _, watcher := range watchers {
+- pattern := jsonProperty(watcher, "globPattern").(string)
+- if rec.MatchString(pattern) {
+- return onMatch
+- }
+- }
+- return onNoMatch
+- }
+-}
+-
+-// jsonProperty extracts a value from a path of JSON property names, assuming
+-// the default encoding/json unmarshaling to the empty interface (i.e.: that
+-// JSON objects are unmarshalled as map[string]interface{})
+-//
+-// For example, if obj is unmarshalled from the following json:
+-//
+-// {
+-// "foo": { "bar": 3 }
+-// }
+-//
+-// Then jsonProperty(obj, "foo", "bar") will be 3.
+-func jsonProperty(obj interface{}, path ...string) interface{} {
+- if len(path) == 0 || obj == nil {
+- return obj
+- }
+- m := obj.(map[string]interface{})
+- return jsonProperty(m[path[0]], path[1:]...)
+-}
+-
+-// RegistrationMatching asserts that the client has received a capability
+-// registration matching the given regexp.
+-//
+-// TODO(rfindley): remove this once TestWatchReplaceTargets has been revisited.
+-//
+-// Deprecated: use (No)FileWatchMatching
+-func RegistrationMatching(re string) Expectation {
+- rec := regexp.MustCompile(re)
+- check := func(s State) Verdict {
+- for _, p := range s.registrations {
+- for _, r := range p.Registrations {
+- if rec.Match([]byte(r.Method)) {
+- return Met
+- }
+- }
+- }
+- return Unmet
+- }
+- return Expectation{
+- Check: check,
+- Description: fmt.Sprintf("registration matching %q", re),
+- }
+-}
+-
+-// UnregistrationMatching asserts that the client has received an
+-// unregistration whose ID matches the given regexp.
+-func UnregistrationMatching(re string) Expectation {
+- rec := regexp.MustCompile(re)
+- check := func(s State) Verdict {
+- for _, p := range s.unregistrations {
+- for _, r := range p.Unregisterations {
+- if rec.Match([]byte(r.Method)) {
+- return Met
+- }
+- }
+- }
+- return Unmet
+- }
+- return Expectation{
+- Check: check,
+- Description: fmt.Sprintf("unregistration matching %q", re),
+- }
+-}
+-
+-// Diagnostics asserts that there is at least one diagnostic matching the given
+-// filters.
+-func Diagnostics(filters ...DiagnosticFilter) Expectation {
+- check := func(s State) Verdict {
+- diags := flattenDiagnostics(s)
+- for _, filter := range filters {
+- var filtered []flatDiagnostic
+- for _, d := range diags {
+- if filter.check(d.name, d.diag) {
+- filtered = append(filtered, d)
+- }
+- }
+- if len(filtered) == 0 {
+- // TODO(rfindley): if/when expectations describe their own failure, we
+- // can provide more useful information here as to which filter caused
+- // the failure.
+- return Unmet
+- }
+- diags = filtered
+- }
+- return Met
+- }
+- var descs []string
+- for _, filter := range filters {
+- descs = append(descs, filter.desc)
+- }
+- return Expectation{
+- Check: check,
+- Description: "any diagnostics " + strings.Join(descs, ", "),
+- }
+-}
+-
+-// NoDiagnostics asserts that there are no diagnostics matching the given
+-// filters. Notably, if no filters are supplied this assertion checks that
+-// there are no diagnostics at all, for any file.
+-func NoDiagnostics(filters ...DiagnosticFilter) Expectation {
+- check := func(s State) Verdict {
+- diags := flattenDiagnostics(s)
+- for _, filter := range filters {
+- var filtered []flatDiagnostic
+- for _, d := range diags {
+- if filter.check(d.name, d.diag) {
+- filtered = append(filtered, d)
+- }
+- }
+- diags = filtered
+- }
+- if len(diags) > 0 {
+- return Unmet
+- }
+- return Met
+- }
+- var descs []string
+- for _, filter := range filters {
+- descs = append(descs, filter.desc)
+- }
+- return Expectation{
+- Check: check,
+- Description: "no diagnostics " + strings.Join(descs, ", "),
+- }
+-}
+-
+-type flatDiagnostic struct {
+- name string
+- diag protocol.Diagnostic
+-}
+-
+-func flattenDiagnostics(state State) []flatDiagnostic {
+- var result []flatDiagnostic
+- for name, diags := range state.diagnostics {
+- for _, diag := range diags.Diagnostics {
+- result = append(result, flatDiagnostic{name, diag})
+- }
+- }
+- return result
+-}
+-
+-// -- Diagnostic filters --
+-
+-// A DiagnosticFilter filters the set of diagnostics, for assertion with
+-// Diagnostics or NoDiagnostics.
+-type DiagnosticFilter struct {
+- desc string
+- check func(name string, _ protocol.Diagnostic) bool
+-}
+-
+-// ForFile filters to diagnostics matching the sandbox-relative file name.
+-func ForFile(name string) DiagnosticFilter {
+- return DiagnosticFilter{
+- desc: fmt.Sprintf("for file %q", name),
+- check: func(diagName string, _ protocol.Diagnostic) bool {
+- return diagName == name
+- },
+- }
+-}
+-
+-// FromSource filters to diagnostics matching the given diagnostics source.
+-func FromSource(source string) DiagnosticFilter {
+- return DiagnosticFilter{
+- desc: fmt.Sprintf("with source %q", source),
+- check: func(_ string, d protocol.Diagnostic) bool {
+- return d.Source == source
+- },
+- }
+-}
+-
+-// AtRegexp filters to diagnostics in the file with sandbox-relative path name,
+-// at the first position matching the given regexp pattern.
+-//
+-// TODO(rfindley): pass in the editor to expectations, so that they may depend
+-// on editor state and AtRegexp can be a function rather than a method.
+-func (e *Env) AtRegexp(name, pattern string) DiagnosticFilter {
+- loc := e.RegexpSearch(name, pattern)
+- return DiagnosticFilter{
+- desc: fmt.Sprintf("at the first position matching %#q in %q", pattern, name),
+- check: func(diagName string, d protocol.Diagnostic) bool {
+- return diagName == name && d.Range.Start == loc.Range.Start
+- },
+- }
+-}
+-
+-// AtPosition filters to diagnostics at location name:line:character, for a
+-// sandbox-relative path name.
+-//
+-// Line and character are 0-based, and character measures UTF-16 codes.
+-//
+-// Note: prefer the more readable AtRegexp.
+-func AtPosition(name string, line, character uint32) DiagnosticFilter {
+- pos := protocol.Position{Line: line, Character: character}
+- return DiagnosticFilter{
+- desc: fmt.Sprintf("at %s:%d:%d", name, line, character),
+- check: func(diagName string, d protocol.Diagnostic) bool {
+- return diagName == name && d.Range.Start == pos
+- },
+- }
+-}
+-
+-// WithMessage filters to diagnostics whose message contains the given
+-// substring.
+-func WithMessage(substring string) DiagnosticFilter {
+- return DiagnosticFilter{
+- desc: fmt.Sprintf("with message containing %q", substring),
+- check: func(_ string, d protocol.Diagnostic) bool {
+- return strings.Contains(d.Message, substring)
+- },
+- }
+-}
+diff -urN a/gopls/internal/lsp/regtest/marker.go b/gopls/internal/lsp/regtest/marker.go
+--- a/gopls/internal/lsp/regtest/marker.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/regtest/marker.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1273 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package regtest
+-
+-import (
+- "bytes"
+- "context"
+- "encoding/json"
+- "flag"
+- "fmt"
+- "go/token"
+- "io/fs"
+- "os"
+- "path"
+- "path/filepath"
+- "reflect"
+- "regexp"
+- "sort"
+- "strings"
+- "testing"
+-
+- "golang.org/x/tools/go/expect"
+- "golang.org/x/tools/gopls/internal/hooks"
+- "golang.org/x/tools/gopls/internal/lsp/cache"
+- "golang.org/x/tools/gopls/internal/lsp/debug"
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/lsprpc"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/tests"
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+- "golang.org/x/tools/internal/jsonrpc2"
+- "golang.org/x/tools/internal/jsonrpc2/servertest"
+- "golang.org/x/tools/internal/testenv"
+- "golang.org/x/tools/txtar"
+-)
+-
+-var update = flag.Bool("update", false, "if set, update test data during marker tests")
+-
+-// RunMarkerTests runs "marker" tests in the given test data directory.
+-//
+-// A marker test uses the '//@' marker syntax of the x/tools/go/expect package
+-// to annotate source code with various information such as locations and
+-// arguments of LSP operations to be executed by the test. The syntax following
+-// '@' is parsed as a comma-separated list of ordinary Go function calls, for
+-// example
+-//
+-// //@foo(a, "b", 3),bar(0)
+-//
+-// and delegates to a corresponding function to perform LSP-related operations.
+-// See the Marker types documentation below for a list of supported markers.
+-//
+-// Each call argument is converted to the type of the corresponding parameter of
+-// the designated function. The conversion logic may use the surrounding context,
+-// such as the position or nearby text. See the Argument conversion section below
+-// for the full set of special conversions. As a special case, the blank
+-// identifier '_' is treated as the zero value of the parameter type.
+-//
+-// The test runner collects test cases by searching the given directory for
+-// files with the .txt extension. Each file is interpreted as a txtar archive,
+-// which is extracted to a temporary directory. The relative path to the .txt
+-// file is used as the subtest name. The preliminary section of the file
+-// (before the first archive entry) is a free-form comment.
+-//
+-// These tests were inspired by (and in many places copied from) a previous
+-// iteration of the marker tests built on top of the packagestest framework.
+-// Key design decisions motivating this reimplementation are as follows:
+-// - The old tests had a single global session, causing interaction at a
+-// distance and several awkward workarounds.
+-// - The old tests could not be safely parallelized, because certain tests
+-// manipulated the server options
+-// - Relatedly, the old tests did not have a logic grouping of assertions into
+-// a single unit, resulting in clusters of files serving clusters of
+-// entangled assertions.
+-// - The old tests used locations in the source as test names and as the
+-// identity of golden content, meaning that a single edit could change the
+-// name of an arbitrary number of subtests, and making it difficult to
+-// manually edit golden content.
+-// - The old tests did not hew closely to LSP concepts, resulting in, for
+-// example, each marker implementation doing its own position
+-// transformations, and inventing its own mechanism for configuration.
+-// - The old tests had an ad-hoc session initialization process. The regtest
+-// environment has had more time devoted to its initialization, and has a
+-// more convenient API.
+-// - The old tests lacked documentation, and often had failures that were hard
+-// to understand. By starting from scratch, we can revisit these aspects.
+-//
+-// # Special files
+-//
+-// There are three types of file within the test archive that are given special
+-// treatment by the test runner:
+-// - "flags": this file is treated as a whitespace-separated list of flags
+-// that configure the MarkerTest instance. For example, -min_go=go1.18 sets
+-// the minimum required Go version for the test.
+-// TODO(rfindley): support flag values containing whitespace.
+-// - "settings.json": this file is parsed as JSON, and used as the
+-// session configuration (see gopls/doc/settings.md)
+-// - "env": this file is parsed as a list of VAR=VALUE fields specifying the
+-// editor environment.
+-// - Golden files: Within the archive, file names starting with '@' are
+-// treated as "golden" content, and are not written to disk, but instead are
+-// made available to test methods expecting an argument of type *Golden,
+-// using the identifier following '@'. For example, if the first parameter of
+-// Foo were of type *Golden, the test runner would convert the identifier a
+-// in the call @foo(a, "b", 3) into a *Golden by collecting golden file
+-// data starting with "@a/".
+-//
+-// # Marker types
+-//
+-// The following markers are supported within marker tests:
+-//
+-// - diag(location, regexp): specifies an expected diagnostic matching the
+-// given regexp at the given location. The test runner requires
+-// a 1:1 correspondence between observed diagnostics and diag annotations
+-//
+-// - def(src, dst location): perform a textDocument/definition request at
+-// the src location, and check the the result points to the dst location.
+-//
+-// - hover(src, dst location, g Golden): perform a textDocument/hover at the
+-// src location, and checks that the result is the dst location, with hover
+-// content matching "hover.md" in the golden data g.
+-//
+-// - loc(name, location): specifies the name for a location in the source. These
+-// locations may be referenced by other markers.
+-//
+-// - rename(location, new, golden): specifies a renaming of the
+-// identifier at the specified location to the new name.
+-// The golden directory contains the transformed files.
+-//
+-// - renameerr(location, new, wantError): specifies a renaming that
+-// fails with an error that matches the expectation.
+-//
+-// - suggestedfix(location, regexp, kind, golden): like diag, the location and
+-// regexp identify an expected diagnostic. This diagnostic must
+-// to have exactly one associated code action of the specified kind.
+-// This action is executed for its editing effects on the source files.
+-// Like rename, the golden directory contains the expected transformed files.
+-//
+-// # Argument conversion
+-//
+-// Marker arguments are first parsed by the go/expect package, which accepts
+-// the following tokens as defined by the Go spec:
+-// - string, int64, float64, and rune literals
+-// - true and false
+-// - nil
+-// - identifiers (type expect.Identifier)
+-// - regular expressions, denoted the two tokens re"abc" (type *regexp.Regexp)
+-//
+-// These values are passed as arguments to the corresponding parameter of the
+-// test function. Additional value conversions may occur for these argument ->
+-// parameter type pairs:
+-// - string->regexp: the argument is parsed as a regular expressions.
+-// - string->location: the argument is converted to the location of the first
+-// instance of the argument in the partial line preceding the note.
+-// - regexp->location: the argument is converted to the location of the first
+-// match for the argument in the partial line preceding the note. If the
+-// regular expression contains exactly one subgroup, the position of the
+-// subgroup is used rather than the position of the submatch.
+-// - name->location: the argument is replaced by the named location.
+-// - name->Golden: the argument is used to look up golden content prefixed by
+-// @<argument>.
+-// - {string,regexp,identifier}->wantError: a wantError type specifies
+-// an expected error message, either in the form of a substring that
+-// must be present, a regular expression that it must match, or an
+-// identifier (e.g. foo) such that the archive entry @foo
+-// exists and contains the exact expected error.
+-//
+-// # Example
+-//
+-// Here is a complete example:
+-//
+-// -- a.go --
+-// package a
+-//
+-// const abc = 0x2a //@hover("b", "abc", abc),hover(" =", "abc", abc)
+-// -- @abc/hover.md --
+-// ```go
+-// const abc untyped int = 42
+-// ```
+-//
+-// @hover("b", "abc", abc),hover(" =", "abc", abc)
+-//
+-// In this example, the @hover annotation tells the test runner to run the
+-// hoverMarker function, which has parameters:
+-//
+-// (mark marker, src, dsc protocol.Location, g *Golden).
+-//
+-// The first argument holds the test context, including fake editor with open
+-// files, and sandboxed directory.
+-//
+-// Argument converters translate the "b" and "abc" arguments into locations by
+-// interpreting each one as a regular expression and finding the location of
+-// its first match on the preceding portion of the line, and the abc identifier
+-// into a dictionary of golden content containing "hover.md". Then the
+-// hoverMarker method executes a textDocument/hover LSP request at the src
+-// position, and ensures the result spans "abc", with the markdown content from
+-// hover.md. (Note that the markdown content includes the expect annotation as
+-// the doc comment.)
+-//
+-// The next hover on the same line asserts the same result, but initiates the
+-// hover immediately after "abc" in the source. This tests that we find the
+-// preceding identifier when hovering.
+-//
+-// # Updating golden files
+-//
+-// To update golden content in the test archive, it is easier to regenerate
+-// content automatically rather than edit it by hand. To do this, run the
+-// tests with the -update flag. Only tests that actually run will be updated.
+-//
+-// In some cases, golden content will vary by Go version (for example, gopls
+-// produces different markdown at Go versions before the 1.19 go/doc update).
+-// By convention, the golden content in test archives should match the output
+-// at Go tip. Each test function can normalize golden content for older Go
+-// versions.
+-//
+-// Note that -update does not cause missing @diag or @loc markers to be added.
+-//
+-// # TODO
+-//
+-// This API is a work-in-progress, as we migrate existing marker tests from
+-// internal/lsp/tests.
+-//
+-// Remaining TODO:
+-// - parallelize/optimize test execution
+-// - reorganize regtest packages (and rename to just 'test'?)
+-// - Rename the files .txtar.
+-//
+-// Existing marker tests to port:
+-// - CallHierarchy
+-// - CodeLens
+-// - Diagnostics
+-// - CompletionItems
+-// - Completions
+-// - CompletionSnippets
+-// - UnimportedCompletions
+-// - DeepCompletions
+-// - FuzzyCompletions
+-// - CaseSensitiveCompletions
+-// - RankCompletions
+-// - FoldingRanges
+-// - Formats
+-// - Imports
+-// - SemanticTokens
+-// - SuggestedFixes
+-// - FunctionExtractions
+-// - MethodExtractions
+-// - Definitions
+-// - Implementations
+-// - Highlights
+-// - References
+-// - Renames
+-// - PrepareRenames
+-// - Symbols
+-// - InlayHints
+-// - WorkspaceSymbols
+-// - Signatures
+-// - Links
+-// - AddImport
+-// - SelectionRanges
+-func RunMarkerTests(t *testing.T, dir string) {
+- // The marker tests must be able to run go/packages.Load.
+- testenv.NeedsGoPackages(t)
+-
+- tests, err := loadMarkerTests(dir)
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- // Opt: use a shared cache.
+- // TODO(rfindley): opt: use a memoize store with no eviction.
+- cache := cache.New(nil)
+-
+- for _, test := range tests {
+- t.Run(test.name, func(t *testing.T) {
+- // TODO(rfindley): it may be more useful to have full support for build
+- // constraints.
+- if test.minGoVersion != "" {
+- var go1point int
+- if _, err := fmt.Sscanf(test.minGoVersion, "go1.%d", &go1point); err != nil {
+- t.Fatalf("parsing -min_go version: %v", err)
+- }
+- testenv.NeedsGo1Point(t, 18)
+- }
+- config := fake.EditorConfig{
+- Settings: test.settings,
+- Env: test.env,
+- }
+- run := &markerTestRun{
+- test: test,
+- env: newEnv(t, cache, test.files, config),
+-
+- locations: make(map[expect.Identifier]protocol.Location),
+- diags: make(map[protocol.Location][]protocol.Diagnostic),
+- }
+- // TODO(rfindley): make it easier to clean up the regtest environment.
+- defer run.env.Editor.Shutdown(context.Background()) // ignore error
+- defer run.env.Sandbox.Close() // ignore error
+-
+- // Open all files so that we operate consistently with LSP clients, and
+- // (pragmatically) so that we have a Mapper available via the fake
+- // editor.
+- //
+- // This also allows avoiding mutating the editor state in tests.
+- for file := range test.files {
+- run.env.OpenFile(file)
+- }
+-
+- // Pre-process locations.
+- var markers []marker
+- for _, note := range test.notes {
+- mark := marker{run: run, note: note}
+- switch note.Name {
+- case "loc":
+- mark.execute()
+- default:
+- markers = append(markers, mark)
+- }
+- }
+-
+- // Wait for the didOpen notifications to be processed, then collect
+- // diagnostics.
+- var diags map[string]*protocol.PublishDiagnosticsParams
+- run.env.AfterChange(ReadAllDiagnostics(&diags))
+- for path, params := range diags {
+- uri := run.env.Sandbox.Workdir.URI(path)
+- for _, diag := range params.Diagnostics {
+- loc := protocol.Location{
+- URI: uri,
+- Range: diag.Range,
+- }
+- run.diags[loc] = append(run.diags[loc], diag)
+- }
+- }
+-
+- // Invoke each remaining marker in the test.
+- for _, mark := range markers {
+- mark.execute()
+- }
+-
+- // Any remaining (un-eliminated) diagnostics are an error.
+- for loc, diags := range run.diags {
+- for _, diag := range diags {
+- t.Errorf("%s: unexpected diagnostic: %q", run.fmtLoc(loc), diag.Message)
+- }
+- }
+-
+- formatted, err := formatTest(test)
+- if err != nil {
+- t.Errorf("formatTest: %v", err)
+- } else if *update {
+- filename := filepath.Join(dir, test.name)
+- if err := os.WriteFile(filename, formatted, 0644); err != nil {
+- t.Error(err)
+- }
+- } else {
+- // On go 1.19 and later, verify that the testdata has not changed.
+- //
+- // On earlier Go versions, the golden test data varies due to different
+- // markdown escaping.
+- //
+- // Only check this if the test hasn't already failed, otherwise we'd
+- // report duplicate mismatches of golden data.
+- if testenv.Go1Point() >= 19 && !t.Failed() {
+- // Otherwise, verify that formatted content matches.
+- if diff := compare.NamedText("formatted", "on-disk", string(formatted), string(test.content)); diff != "" {
+- t.Errorf("formatted test does not match on-disk content:\n%s", diff)
+- }
+- }
+- }
+- })
+- }
+-}
+-
+-// A marker holds state for the execution of a single @marker
+-// annotation in the source.
+-type marker struct {
+- run *markerTestRun
+- note *expect.Note
+-}
+-
+-// errorf reports an error with a prefix indicating the position of the marker note.
+-func (mark marker) errorf(format string, args ...interface{}) {
+- msg := fmt.Sprintf(format, args...)
+- // TODO(adonovan): consider using fmt.Fprintf(os.Stderr)+t.Fail instead of
+- // t.Errorf to avoid reporting uninteresting positions in the Go source of
+- // the driver. However, this loses the order of stderr wrt "FAIL: TestFoo"
+- // subtest dividers.
+- mark.run.env.T.Errorf("%s: %s", mark.run.fmtPos(mark.note.Pos), msg)
+-}
+-
+-// execute invokes the marker's function with the arguments from note.
+-func (mark marker) execute() {
+- fn, ok := markerFuncs[mark.note.Name]
+- if !ok {
+- mark.errorf("no marker function named %s", mark.note.Name)
+- return
+- }
+-
+- // The first converter corresponds to the *Env argument.
+- // All others must be converted from the marker syntax.
+- if got, want := len(mark.note.Args), len(fn.converters); got != want {
+- mark.errorf("got %d arguments to %s, expect %d", got, mark.note.Name, want)
+- return
+- }
+-
+- args := []reflect.Value{reflect.ValueOf(mark)}
+- for i, in := range mark.note.Args {
+- // Special handling for the blank identifier: treat it as the zero
+- // value.
+- if ident, ok := in.(expect.Identifier); ok && ident == "_" {
+- zero := reflect.Zero(fn.paramTypes[i])
+- args = append(args, zero)
+- continue
+- }
+- out, err := fn.converters[i](mark, in)
+- if err != nil {
+- mark.errorf("converting argument #%d of %s (%v): %v", i, mark.note.Name, in, err)
+- return
+- }
+- args = append(args, reflect.ValueOf(out))
+- }
+-
+- fn.fn.Call(args)
+-}
+-
+-// Supported marker functions.
+-//
+-// Each marker function must accept a marker as its first argument, with
+-// subsequent arguments converted from the marker arguments.
+-//
+-// Marker funcs should not mutate the test environment (e.g. via opening files
+-// or applying edits in the editor).
+-var markerFuncs = map[string]markerFunc{
+- "def": makeMarkerFunc(defMarker),
+- "diag": makeMarkerFunc(diagMarker),
+- "hover": makeMarkerFunc(hoverMarker),
+- "loc": makeMarkerFunc(locMarker),
+- "rename": makeMarkerFunc(renameMarker),
+- "renameerr": makeMarkerFunc(renameErrMarker),
+- "suggestedfix": makeMarkerFunc(suggestedfixMarker),
+-}
+-
+-// markerTest holds all the test data extracted from a test txtar archive.
+-//
+-// See the documentation for RunMarkerTests for more information on the archive
+-// format.
+-type markerTest struct {
+- name string // relative path to the txtar file in the testdata dir
+- fset *token.FileSet // fileset used for parsing notes
+- content []byte // raw test content
+- archive *txtar.Archive // original test archive
+- settings map[string]interface{} // gopls settings
+- env map[string]string // editor environment
+- files map[string][]byte // data files from the archive (excluding special files)
+- notes []*expect.Note // extracted notes from data files
+- golden map[string]*Golden // extracted golden content, by identifier name
+-
+- // flags holds flags extracted from the special "flags" archive file.
+- flags []string
+- // Parsed flags values.
+- minGoVersion string
+-}
+-
+-// flagSet returns the flagset used for parsing the special "flags" file in the
+-// test archive.
+-func (t *markerTest) flagSet() *flag.FlagSet {
+- flags := flag.NewFlagSet(t.name, flag.ContinueOnError)
+- flags.StringVar(&t.minGoVersion, "min_go", "", "if set, the minimum go1.X version required for this test")
+- return flags
+-}
+-
+-func (t *markerTest) getGolden(id string) *Golden {
+- golden, ok := t.golden[id]
+- // If there was no golden content for this identifier, we must create one
+- // to handle the case where -update is set: we need a place to store
+- // the updated content.
+- if !ok {
+- golden = &Golden{id: id}
+-
+- // TODO(adonovan): the separation of markerTest (the
+- // static aspects) from markerTestRun (the dynamic
+- // ones) is evidently bogus because here we modify
+- // markerTest during execution. Let's merge the two.
+- t.golden[id] = golden
+- }
+- return golden
+-}
+-
+-// Golden holds extracted golden content for a single @<name> prefix.
+-//
+-// When -update is set, golden captures the updated golden contents for later
+-// writing.
+-type Golden struct {
+- id string
+- data map[string][]byte // key "" => @id itself
+- updated map[string][]byte
+-}
+-
+-// Get returns golden content for the given name, which corresponds to the
+-// relative path following the golden prefix @<name>/. For example, to access
+-// the content of @foo/path/to/result.json from the Golden associated with
+-// @foo, name should be "path/to/result.json".
+-//
+-// If -update is set, the given update function will be called to get the
+-// updated golden content that should be written back to testdata.
+-//
+-// Marker functions must use this method instead of accessing data entries
+-// directly otherwise the -update operation will delete those entries.
+-//
+-// TODO(rfindley): rethink the logic here. We may want to separate Get and Set,
+-// and not delete golden content that isn't set.
+-func (g *Golden) Get(t testing.TB, name string, updated []byte) ([]byte, bool) {
+- if existing, ok := g.updated[name]; ok {
+- // Multiple tests may reference the same golden data, but if they do they
+- // must agree about its expected content.
+- if diff := compare.NamedText("existing", "updated", string(existing), string(updated)); diff != "" {
+- t.Errorf("conflicting updates for golden data %s/%s:\n%s", g.id, name, diff)
+- }
+- }
+- if g.updated == nil {
+- g.updated = make(map[string][]byte)
+- }
+- g.updated[name] = updated
+- if *update {
+- return updated, true
+- }
+-
+- res, ok := g.data[name]
+- return res, ok
+-}
+-
+-// loadMarkerTests walks the given dir looking for .txt files, which it
+-// interprets as a txtar archive.
+-//
+-// See the documentation for RunMarkerTests for more details on the test data
+-// archive.
+-//
+-// TODO(rfindley): this test could sanity check the results. For example, it is
+-// too easy to write "// @" instead of "//@", which we will happy skip silently.
+-func loadMarkerTests(dir string) ([]*markerTest, error) {
+- var tests []*markerTest
+- err := filepath.WalkDir(dir, func(path string, d fs.DirEntry, err error) error {
+- if strings.HasSuffix(path, ".txt") {
+- content, err := os.ReadFile(path)
+- if err != nil {
+- return err
+- }
+- name := strings.TrimPrefix(path, dir+string(filepath.Separator))
+- test, err := loadMarkerTest(name, content)
+- if err != nil {
+- return fmt.Errorf("%s: %v", path, err)
+- }
+- tests = append(tests, test)
+- }
+- return nil
+- })
+- return tests, err
+-}
+-
+-func loadMarkerTest(name string, content []byte) (*markerTest, error) {
+- archive := txtar.Parse(content)
+- test := &markerTest{
+- name: name,
+- fset: token.NewFileSet(),
+- content: content,
+- archive: archive,
+- files: make(map[string][]byte),
+- golden: make(map[string]*Golden),
+- }
+- for _, file := range archive.Files {
+- switch {
+- case file.Name == "flags":
+- test.flags = strings.Fields(string(file.Data))
+- if err := test.flagSet().Parse(test.flags); err != nil {
+- return nil, fmt.Errorf("parsing flags: %v", err)
+- }
+-
+- case file.Name == "settings.json":
+- if err := json.Unmarshal(file.Data, &test.settings); err != nil {
+- return nil, err
+- }
+-
+- case file.Name == "env":
+- test.env = make(map[string]string)
+- fields := strings.Fields(string(file.Data))
+- for _, field := range fields {
+- // TODO: use strings.Cut once we are on 1.18+.
+- key, value, ok := cut(field, "=")
+- if !ok {
+- return nil, fmt.Errorf("env vars must be formatted as var=value, got %q", field)
+- }
+- test.env[key] = value
+- }
+-
+- case strings.HasPrefix(file.Name, "@"): // golden content
+- id, name, _ := cut(file.Name[len("@"):], "/")
+- // Note that a file.Name of just "@id" gives (id, name) = ("id", "").
+- if _, ok := test.golden[id]; !ok {
+- test.golden[id] = &Golden{
+- id: id,
+- data: make(map[string][]byte),
+- }
+- }
+- test.golden[id].data[name] = file.Data
+-
+- default: // ordinary file content
+- notes, err := expect.Parse(test.fset, file.Name, file.Data)
+- if err != nil {
+- return nil, fmt.Errorf("parsing notes in %q: %v", file.Name, err)
+- }
+- test.notes = append(test.notes, notes...)
+- test.files[file.Name] = file.Data
+- }
+- }
+-
+- return test, nil
+-}
+-
+-// cut is a copy of strings.Cut.
+-//
+-// TODO: once we only support Go 1.18+, just use strings.Cut.
+-func cut(s, sep string) (before, after string, found bool) {
+- if i := strings.Index(s, sep); i >= 0 {
+- return s[:i], s[i+len(sep):], true
+- }
+- return s, "", false
+-}
+-
+-// formatTest formats the test as a txtar archive.
+-func formatTest(test *markerTest) ([]byte, error) {
+- arch := &txtar.Archive{
+- Comment: test.archive.Comment,
+- }
+-
+- updatedGolden := make(map[string][]byte)
+- for id, g := range test.golden {
+- for name, data := range g.updated {
+- filename := "@" + path.Join(id, name) // name may be ""
+- updatedGolden[filename] = data
+- }
+- }
+-
+- // Preserve the original ordering of archive files.
+- for _, file := range test.archive.Files {
+- switch file.Name {
+- // Preserve configuration files exactly as they were. They must have parsed
+- // if we got this far.
+- case "flags", "settings.json", "env":
+- arch.Files = append(arch.Files, file)
+- default:
+- if _, ok := test.files[file.Name]; ok { // ordinary file
+- arch.Files = append(arch.Files, file)
+- } else if data, ok := updatedGolden[file.Name]; ok { // golden file
+- arch.Files = append(arch.Files, txtar.File{Name: file.Name, Data: data})
+- delete(updatedGolden, file.Name)
+- }
+- }
+- }
+-
+- // ...followed by any new golden files.
+- var newGoldenFiles []txtar.File
+- for filename, data := range updatedGolden {
+- newGoldenFiles = append(newGoldenFiles, txtar.File{Name: filename, Data: data})
+- }
+- // Sort new golden files lexically.
+- sort.Slice(newGoldenFiles, func(i, j int) bool {
+- return newGoldenFiles[i].Name < newGoldenFiles[j].Name
+- })
+- arch.Files = append(arch.Files, newGoldenFiles...)
+-
+- return txtar.Format(arch), nil
+-}
+-
+-// newEnv creates a new environment for a marker test.
+-//
+-// TODO(rfindley): simplify and refactor the construction of testing
+-// environments across regtests, marker tests, and benchmarks.
+-func newEnv(t *testing.T, cache *cache.Cache, files map[string][]byte, config fake.EditorConfig) *Env {
+- sandbox, err := fake.NewSandbox(&fake.SandboxConfig{
+- RootDir: t.TempDir(),
+- GOPROXY: "https://proxy.golang.org",
+- Files: files,
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- // Put a debug instance in the context to prevent logging to stderr.
+- // See associated TODO in runner.go: we should revisit this pattern.
+- ctx := context.Background()
+- ctx = debug.WithInstance(ctx, "", "off")
+-
+- awaiter := NewAwaiter(sandbox.Workdir)
+- ss := lsprpc.NewStreamServer(cache, false, hooks.Options)
+- server := servertest.NewPipeServer(ss, jsonrpc2.NewRawStream)
+- const skipApplyEdits = true // capture edits but don't apply them
+- editor, err := fake.NewEditor(sandbox, config).Connect(ctx, server, awaiter.Hooks(), skipApplyEdits)
+- if err != nil {
+- sandbox.Close() // ignore error
+- t.Fatal(err)
+- }
+- if err := awaiter.Await(ctx, InitialWorkspaceLoad); err != nil {
+- sandbox.Close() // ignore error
+- t.Fatal(err)
+- }
+- return &Env{
+- T: t,
+- Ctx: ctx,
+- Editor: editor,
+- Sandbox: sandbox,
+- Awaiter: awaiter,
+- }
+-}
+-
+-// A markerFunc is a reflectively callable @mark implementation function.
+-type markerFunc struct {
+- fn reflect.Value // the func to invoke
+- paramTypes []reflect.Type // parameter types, for zero values
+- converters []converter // to convert non-blank arguments
+-}
+-
+-// A markerTestRun holds the state of one run of a marker test archive.
+-type markerTestRun struct {
+- test *markerTest
+- env *Env
+-
+- // Collected information.
+- // Each @diag/@suggestedfix marker eliminates an entry from diags.
+- locations map[expect.Identifier]protocol.Location
+- diags map[protocol.Location][]protocol.Diagnostic
+-}
+-
+-// fmtLoc formats the given pos in the context of the test, using
+-// archive-relative paths for files and including the line number in the full
+-// archive file.
+-func (run *markerTestRun) fmtPos(pos token.Pos) string {
+- file := run.test.fset.File(pos)
+- if file == nil {
+- run.env.T.Errorf("position %d not in test fileset", pos)
+- return "<invalid location>"
+- }
+- m, err := run.env.Editor.Mapper(file.Name())
+- if err != nil {
+- run.env.T.Errorf("%s", err)
+- return "<invalid location>"
+- }
+- loc, err := m.PosLocation(file, pos, pos)
+- if err != nil {
+- run.env.T.Errorf("Mapper(%s).PosLocation failed: %v", file.Name(), err)
+- }
+- return run.fmtLoc(loc)
+-}
+-
+-// fmtLoc formats the given location in the context of the test, using
+-// archive-relative paths for files and including the line number in the full
+-// archive file.
+-func (run *markerTestRun) fmtLoc(loc protocol.Location) string {
+- if loc == (protocol.Location{}) {
+- return "<missing location>"
+- }
+- lines := bytes.Count(run.test.archive.Comment, []byte("\n"))
+- var name string
+- for _, f := range run.test.archive.Files {
+- lines++ // -- separator --
+- uri := run.env.Sandbox.Workdir.URI(f.Name)
+- if uri == loc.URI {
+- name = f.Name
+- break
+- }
+- lines += bytes.Count(f.Data, []byte("\n"))
+- }
+- if name == "" {
+- run.env.T.Errorf("unable to find %s in test archive", loc)
+- return "<invalid location>"
+- }
+- m, err := run.env.Editor.Mapper(name)
+- if err != nil {
+- run.env.T.Errorf("internal error: %v", err)
+- return "<invalid location>"
+- }
+- s, err := m.LocationSpan(loc)
+- if err != nil {
+- run.env.T.Errorf("error formatting location %s: %v", loc, err)
+- return "<invalid location>"
+- }
+-
+- innerSpan := fmt.Sprintf("%d:%d", s.Start().Line(), s.Start().Column()) // relative to the embedded file
+- outerSpan := fmt.Sprintf("%d:%d", lines+s.Start().Line(), s.Start().Column()) // relative to the archive file
+- if s.Start() != s.End() {
+- if s.End().Line() == s.Start().Line() {
+- innerSpan += fmt.Sprintf("-%d", s.End().Column())
+- outerSpan += fmt.Sprintf("-%d", s.End().Column())
+- } else {
+- innerSpan += fmt.Sprintf("-%d:%d", s.End().Line(), s.End().Column())
+- innerSpan += fmt.Sprintf("-%d:%d", lines+s.End().Line(), s.End().Column())
+- }
+- }
+-
+- return fmt.Sprintf("%s:%s (%s:%s)", name, innerSpan, run.test.name, outerSpan)
+-}
+-
+-// makeMarkerFunc uses reflection to create a markerFunc for the given func value.
+-func makeMarkerFunc(fn interface{}) markerFunc {
+- mi := markerFunc{
+- fn: reflect.ValueOf(fn),
+- }
+- mtyp := mi.fn.Type()
+- if mtyp.NumIn() == 0 || mtyp.In(0) != markerType {
+- panic(fmt.Sprintf("marker function %#v must accept marker as its first argument", mi.fn))
+- }
+- if mtyp.NumOut() != 0 {
+- panic(fmt.Sprintf("marker function %#v must not have results", mi.fn))
+- }
+- for a := 1; a < mtyp.NumIn(); a++ {
+- in := mtyp.In(a)
+- mi.paramTypes = append(mi.paramTypes, in)
+- c := makeConverter(in)
+- mi.converters = append(mi.converters, c)
+- }
+- return mi
+-}
+-
+-// ---- converters ----
+-
+-// converter is the signature of argument converters.
+-// A converter should return an error rather than calling marker.errorf().
+-type converter func(marker, interface{}) (interface{}, error)
+-
+-// Types with special conversions.
+-var (
+- goldenType = reflect.TypeOf(&Golden{})
+- locationType = reflect.TypeOf(protocol.Location{})
+- markerType = reflect.TypeOf(marker{})
+- regexpType = reflect.TypeOf(&regexp.Regexp{})
+- wantErrorType = reflect.TypeOf(wantError{})
+-)
+-
+-func makeConverter(paramType reflect.Type) converter {
+- switch paramType {
+- case goldenType:
+- return goldenConverter
+- case locationType:
+- return locationConverter
+- case wantErrorType:
+- return wantErrorConverter
+- default:
+- return func(_ marker, arg interface{}) (interface{}, error) {
+- if argType := reflect.TypeOf(arg); argType != paramType {
+- return nil, fmt.Errorf("cannot convert type %s to %s", argType, paramType)
+- }
+- return arg, nil
+- }
+- }
+-}
+-
+-// locationConverter converts a string argument into the protocol location
+-// corresponding to the first position of the string in the line preceding the
+-// note.
+-func locationConverter(mark marker, arg interface{}) (interface{}, error) {
+- switch arg := arg.(type) {
+- case string:
+- startOff, preceding, m, err := linePreceding(mark.run, mark.note.Pos)
+- if err != nil {
+- return protocol.Location{}, err
+- }
+- idx := bytes.Index(preceding, []byte(arg))
+- if idx < 0 {
+- return nil, fmt.Errorf("substring %q not found in %q", arg, preceding)
+- }
+- off := startOff + idx
+- return m.OffsetLocation(off, off+len(arg))
+- case *regexp.Regexp:
+- return findRegexpInLine(mark.run, mark.note.Pos, arg)
+- case expect.Identifier:
+- loc, ok := mark.run.locations[arg]
+- if !ok {
+- return nil, fmt.Errorf("no location named %q", arg)
+- }
+- return loc, nil
+- default:
+- return nil, fmt.Errorf("cannot convert argument type %T to location (must be a string to match the preceding line)", arg)
+- }
+-}
+-
+-// findRegexpInLine searches the partial line preceding pos for a match for the
+-// regular expression re, returning a location spanning the first match. If re
+-// contains exactly one subgroup, the position of this subgroup match is
+-// returned rather than the position of the full match.
+-func findRegexpInLine(run *markerTestRun, pos token.Pos, re *regexp.Regexp) (protocol.Location, error) {
+- startOff, preceding, m, err := linePreceding(run, pos)
+- if err != nil {
+- return protocol.Location{}, err
+- }
+-
+- matches := re.FindSubmatchIndex(preceding)
+- if len(matches) == 0 {
+- return protocol.Location{}, fmt.Errorf("no match for regexp %q found in %q", re, string(preceding))
+- }
+- var start, end int
+- switch len(matches) {
+- case 2:
+- // no subgroups: return the range of the regexp expression
+- start, end = matches[0], matches[1]
+- case 4:
+- // one subgroup: return its range
+- start, end = matches[2], matches[3]
+- default:
+- return protocol.Location{}, fmt.Errorf("invalid location regexp %q: expect either 0 or 1 subgroups, got %d", re, len(matches)/2-1)
+- }
+-
+- return m.OffsetLocation(start+startOff, end+startOff)
+-}
+-
+-func linePreceding(run *markerTestRun, pos token.Pos) (int, []byte, *protocol.Mapper, error) {
+- file := run.test.fset.File(pos)
+- posn := safetoken.Position(file, pos)
+- lineStart := file.LineStart(posn.Line)
+- startOff, endOff, err := safetoken.Offsets(file, lineStart, pos)
+- if err != nil {
+- return 0, nil, nil, err
+- }
+- m, err := run.env.Editor.Mapper(file.Name())
+- if err != nil {
+- return 0, nil, nil, err
+- }
+- return startOff, m.Content[startOff:endOff], m, nil
+-}
+-
+-// wantErrorConverter converts a string, regexp, or identifier
+-// argument into a wantError. The string is a substring of the
+-// expected error, the regexp is a pattern than matches the expected
+-// error, and the identifier is a golden file containing the expected
+-// error.
+-func wantErrorConverter(mark marker, arg interface{}) (interface{}, error) {
+- switch arg := arg.(type) {
+- case string:
+- return wantError{substr: arg}, nil
+- case *regexp.Regexp:
+- return wantError{pattern: arg}, nil
+- case expect.Identifier:
+- golden := mark.run.test.getGolden(string(arg))
+- return wantError{golden: golden}, nil
+- default:
+- return nil, fmt.Errorf("cannot convert %T to wantError (want: string, regexp, or identifier)", arg)
+- }
+-}
+-
+-// A wantError represents an expectation of a specific error message.
+-//
+-// It may be indicated in one of three ways, in 'expect' notation:
+-// - an identifier 'foo', to compare with the contents of the golden section @foo;
+-// - a pattern expression re"ab.*c", to match against a regular expression;
+-// - a string literal "abc", to check for a substring.
+-type wantError struct {
+- golden *Golden
+- pattern *regexp.Regexp
+- substr string
+-}
+-
+-func (we wantError) String() string {
+- if we.golden != nil {
+- return fmt.Sprintf("error from @%s entry", we.golden.id)
+- } else if we.pattern != nil {
+- return fmt.Sprintf("error matching %#q", we.pattern)
+- } else {
+- return fmt.Sprintf("error with substring %q", we.substr)
+- }
+-}
+-
+-// check asserts that 'err' matches the wantError's expectations.
+-func (we wantError) check(mark marker, err error) {
+- if err == nil {
+- mark.errorf("@%s succeeded unexpectedly, want %v", mark.note.Name, we)
+- return
+- }
+- got := err.Error()
+-
+- if we.golden != nil {
+- // Error message must match @id golden file.
+- wantBytes, ok := we.golden.Get(mark.run.env.T, "", []byte(got))
+- if !ok {
+- mark.errorf("@%s: missing @%s entry", mark.note.Name, we.golden.id)
+- return
+- }
+- want := strings.TrimSpace(string(wantBytes))
+- if got != want {
+- // (ignore leading/trailing space)
+- mark.errorf("@%s failed with wrong error: got:\n%s\nwant:\n%s\ndiff:\n%s",
+- mark.note.Name, got, want, compare.Text(want, got))
+- }
+-
+- } else if we.pattern != nil {
+- // Error message must match regular expression pattern.
+- if !we.pattern.MatchString(got) {
+- mark.errorf("got error %q, does not match pattern %#q", got, we.pattern)
+- }
+-
+- } else if !strings.Contains(got, we.substr) {
+- // Error message must contain expected substring.
+- mark.errorf("got error %q, want substring %q", got, we.substr)
+- }
+-}
+-
+-// goldenConverter converts an identifier into the Golden directory of content
+-// prefixed by @<ident> in the test archive file.
+-func goldenConverter(mark marker, arg interface{}) (interface{}, error) {
+- switch arg := arg.(type) {
+- case expect.Identifier:
+- return mark.run.test.getGolden(string(arg)), nil
+- default:
+- return nil, fmt.Errorf("invalid input type %T: golden key must be an identifier", arg)
+- }
+-}
+-
+-// checkChangedFiles compares the files changed by an operation with their expected (golden) state.
+-func checkChangedFiles(mark marker, changed map[string][]byte, golden *Golden) {
+- // Check changed files match expectations.
+- for filename, got := range changed {
+- if want, ok := golden.Get(mark.run.env.T, filename, got); !ok {
+- mark.errorf("%s: unexpected change to file %s; got:\n%s",
+- mark.note.Name, filename, got)
+-
+- } else if string(got) != string(want) {
+- mark.errorf("%s: wrong file content for %s: got:\n%s\nwant:\n%s\ndiff:\n%s",
+- mark.note.Name, filename, got, want,
+- compare.Bytes(want, got))
+- }
+- }
+-
+- // Report unmet expectations.
+- for filename := range golden.data {
+- if _, ok := changed[filename]; !ok {
+- want, _ := golden.Get(mark.run.env.T, filename, nil)
+- mark.errorf("%s: missing change to file %s; want:\n%s",
+- mark.note.Name, filename, want)
+- }
+- }
+-}
+-
+-// ---- marker functions ----
+-
+-// defMarker implements the @godef marker, running textDocument/definition at
+-// the given src location and asserting that there is exactly one resulting
+-// location, matching dst.
+-//
+-// TODO(rfindley): support a variadic destination set.
+-func defMarker(mark marker, src, dst protocol.Location) {
+- got := mark.run.env.GoToDefinition(src)
+- if got != dst {
+- mark.errorf("definition location does not match:\n\tgot: %s\n\twant %s",
+- mark.run.fmtLoc(got), mark.run.fmtLoc(dst))
+- }
+-}
+-
+-// hoverMarker implements the @hover marker, running textDocument/hover at the
+-// given src location and asserting that the resulting hover is over the dst
+-// location (typically a span surrounding src), and that the markdown content
+-// matches the golden content.
+-func hoverMarker(mark marker, src, dst protocol.Location, golden *Golden) {
+- content, gotDst := mark.run.env.Hover(src)
+- if gotDst != dst {
+- mark.errorf("hover location does not match:\n\tgot: %s\n\twant %s)", mark.run.fmtLoc(gotDst), mark.run.fmtLoc(dst))
+- }
+- gotMD := ""
+- if content != nil {
+- gotMD = content.Value
+- }
+- wantMD := ""
+- if golden != nil {
+- wantBytes, _ := golden.Get(mark.run.env.T, "hover.md", []byte(gotMD))
+- wantMD = string(wantBytes)
+- }
+- // Normalize newline termination: archive files can't express non-newline
+- // terminated files.
+- if strings.HasSuffix(wantMD, "\n") && !strings.HasSuffix(gotMD, "\n") {
+- gotMD += "\n"
+- }
+- if diff := tests.DiffMarkdown(wantMD, gotMD); diff != "" {
+- mark.errorf("hover markdown mismatch (-want +got):\n%s", diff)
+- }
+-}
+-
+-// locMarker implements the @loc marker. It is executed before other
+-// markers, so that locations are available.
+-func locMarker(mark marker, name expect.Identifier, loc protocol.Location) {
+- mark.run.locations[name] = loc
+-}
+-
+-// diagMarker implements the @diag marker. It eliminates diagnostics from
+-// the observed set in mark.test.
+-func diagMarker(mark marker, loc protocol.Location, re *regexp.Regexp) {
+- if _, err := removeDiagnostic(mark, loc, re); err != nil {
+- mark.errorf("%v", err)
+- }
+-}
+-
+-func removeDiagnostic(mark marker, loc protocol.Location, re *regexp.Regexp) (protocol.Diagnostic, error) {
+- diags := mark.run.diags[loc]
+- for i, diag := range diags {
+- if re.MatchString(diag.Message) {
+- mark.run.diags[loc] = append(diags[:i], diags[i+1:]...)
+- return diag, nil
+- }
+- }
+- return protocol.Diagnostic{}, fmt.Errorf("no diagnostic matches %q", re)
+-}
+-
+-// renameMarker implements the @rename(location, new, golden) marker.
+-func renameMarker(mark marker, loc protocol.Location, newName expect.Identifier, golden *Golden) {
+- changed, err := rename(mark.run.env, loc, string(newName))
+- if err != nil {
+- mark.errorf("rename failed: %v. (Use @renameerr for expected errors.)", err)
+- return
+- }
+- checkChangedFiles(mark, changed, golden)
+-}
+-
+-// renameErrMarker implements the @renamererr(location, new, error) marker.
+-func renameErrMarker(mark marker, loc protocol.Location, newName expect.Identifier, wantErr wantError) {
+- _, err := rename(mark.run.env, loc, string(newName))
+- wantErr.check(mark, err)
+-}
+-
+-// rename returns the new contents of the files that would be modified
+-// by renaming the identifier at loc to newName.
+-func rename(env *Env, loc protocol.Location, newName string) (map[string][]byte, error) {
+- // We call Server.Rename directly, instead of
+- // env.Editor.Rename(env.Ctx, loc, newName)
+- // to isolate Rename from PrepareRename, and because we don't
+- // want to modify the file system in a scenario with multiple
+- // @rename markers.
+-
+- editMap, err := env.Editor.Server.Rename(env.Ctx, &protocol.RenameParams{
+- TextDocument: protocol.TextDocumentIdentifier{URI: loc.URI},
+- Position: loc.Range.Start,
+- NewName: string(newName),
+- })
+- if err != nil {
+- return nil, err
+- }
+-
+- return applyDocumentChanges(env, editMap.DocumentChanges)
+-}
+-
+-// applyDocumentChanges returns the effect of applying the document
+-// changes to the contents of the Editor buffers. The actual editor
+-// buffers are unchanged.
+-func applyDocumentChanges(env *Env, changes []protocol.DocumentChanges) (map[string][]byte, error) {
+- result := make(map[string][]byte)
+- for _, change := range changes {
+- if change.RenameFile != nil {
+- // rename
+- oldFile := env.Sandbox.Workdir.URIToPath(change.RenameFile.OldURI)
+- newFile := env.Sandbox.Workdir.URIToPath(change.RenameFile.NewURI)
+- mapper, err := env.Editor.Mapper(oldFile)
+- if err != nil {
+- return nil, err
+- }
+- result[newFile] = mapper.Content
+-
+- } else {
+- // edit
+- filename := env.Sandbox.Workdir.URIToPath(change.TextDocumentEdit.TextDocument.URI)
+- mapper, err := env.Editor.Mapper(filename)
+- if err != nil {
+- return nil, err
+- }
+- patched, _, err := source.ApplyProtocolEdits(mapper, change.TextDocumentEdit.Edits)
+- if err != nil {
+- return nil, err
+- }
+- result[filename] = patched
+- }
+- }
+-
+- return result, nil
+-}
+-
+-// suggestedfixMarker implements the @suggestedfix(location, regexp,
+-// kind, golden) marker. It acts like @diag(location, regexp), to set
+-// the expectation of a diagnostic, but then it applies the first code
+-// action of the specified kind suggested by the matched diagnostic.
+-func suggestedfixMarker(mark marker, loc protocol.Location, re *regexp.Regexp, actionKind string, golden *Golden) {
+- // Find and remove the matching diagnostic.
+- diag, err := removeDiagnostic(mark, loc, re)
+- if err != nil {
+- mark.errorf("%v", err)
+- return
+- }
+-
+- // Apply the fix it suggests.
+- changed, err := suggestedfix(mark.run.env, loc, diag, actionKind)
+- if err != nil {
+- mark.errorf("suggestedfix failed: %v. (Use @suggestedfixerr for expected errors.)", err)
+- return
+- }
+-
+- // Check the file state.
+- checkChangedFiles(mark, changed, golden)
+-}
+-
+-func suggestedfix(env *Env, loc protocol.Location, diag protocol.Diagnostic, actionKind string) (map[string][]byte, error) {
+-
+- // Request all code actions that apply to the diagnostic.
+- // (The protocol supports filtering using Context.Only={actionKind}
+- // but we can give a better error if we don't filter.)
+- actions, err := env.Editor.Server.CodeAction(env.Ctx, &protocol.CodeActionParams{
+- TextDocument: protocol.TextDocumentIdentifier{URI: loc.URI},
+- Range: diag.Range,
+- Context: protocol.CodeActionContext{
+- Only: nil, // => all kinds
+- Diagnostics: []protocol.Diagnostic{diag},
+- },
+- })
+- if err != nil {
+- return nil, err
+- }
+-
+- // Find the sole candidates CodeAction of the specified kind (e.g. refactor.rewrite).
+- var candidates []protocol.CodeAction
+- for _, act := range actions {
+- if act.Kind == protocol.CodeActionKind(actionKind) {
+- candidates = append(candidates, act)
+- }
+- }
+- if len(candidates) != 1 {
+- for _, act := range actions {
+- env.T.Logf("found CodeAction Kind=%s Title=%q", act.Kind, act.Title)
+- }
+- return nil, fmt.Errorf("found %d CodeActions of kind %s for this diagnostic, want 1", len(candidates), actionKind)
+- }
+- action := candidates[0]
+-
+- // An action may specify an edit and/or a command, to be
+- // applied in that order. But since applyDocumentChanges(env,
+- // action.Edit.DocumentChanges) doesn't compose, for now we
+- // assert that all commands used in the @suggestedfix tests
+- // return only a command.
+- if action.Edit.DocumentChanges != nil {
+- env.T.Errorf("internal error: discarding unexpected CodeAction{Kind=%s, Title=%q}.Edit.DocumentChanges", action.Kind, action.Title)
+- }
+- if action.Command == nil {
+- return nil, fmt.Errorf("missing CodeAction{Kind=%s, Title=%q}.Command", action.Kind, action.Title)
+- }
+-
+- // This is a typical CodeAction command:
+- //
+- // Title: "Implement error"
+- // Command: gopls.apply_fix
+- // Arguments: [{"Fix":"stub_methods","URI":".../a.go","Range":...}}]
+- //
+- // The client makes an ExecuteCommand RPC to the server,
+- // which dispatches it to the ApplyFix handler.
+- // ApplyFix dispatches to the "stub_methods" suggestedfix hook (the meat).
+- // The server then makes an ApplyEdit RPC to the client,
+- // whose Awaiter hook gathers the edits instead of applying them.
+-
+- _ = env.Awaiter.takeDocumentChanges() // reset (assuming Env is confined to this thread)
+-
+- if _, err := env.Editor.Server.ExecuteCommand(env.Ctx, &protocol.ExecuteCommandParams{
+- Command: action.Command.Command,
+- Arguments: action.Command.Arguments,
+- }); err != nil {
+- env.T.Fatalf("error converting command %q to edits: %v", action.Command.Command, err)
+- }
+-
+- return applyDocumentChanges(env, env.Awaiter.takeDocumentChanges())
+-}
+-
+-// TODO(adonovan): suggestedfixerr
+diff -urN a/gopls/internal/lsp/regtest/options.go b/gopls/internal/lsp/regtest/options.go
+--- a/gopls/internal/lsp/regtest/options.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/regtest/options.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,105 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package regtest
+-
+-import "golang.org/x/tools/gopls/internal/lsp/fake"
+-
+-type runConfig struct {
+- editor fake.EditorConfig
+- sandbox fake.SandboxConfig
+- modes Mode
+- skipHooks bool
+-}
+-
+-// A RunOption augments the behavior of the test runner.
+-type RunOption interface {
+- set(*runConfig)
+-}
+-
+-type optionSetter func(*runConfig)
+-
+-func (f optionSetter) set(opts *runConfig) {
+- f(opts)
+-}
+-
+-// ProxyFiles configures a file proxy using the given txtar-encoded string.
+-func ProxyFiles(txt string) RunOption {
+- return optionSetter(func(opts *runConfig) {
+- opts.sandbox.ProxyFiles = fake.UnpackTxt(txt)
+- })
+-}
+-
+-// Modes configures the execution modes that the test should run in.
+-//
+-// By default, modes are configured by the test runner. If this option is set,
+-// it overrides the set of default modes and the test runs in exactly these
+-// modes.
+-func Modes(modes Mode) RunOption {
+- return optionSetter(func(opts *runConfig) {
+- if opts.modes != 0 {
+- panic("modes set more than once")
+- }
+- opts.modes = modes
+- })
+-}
+-
+-// WindowsLineEndings configures the editor to use windows line endings.
+-func WindowsLineEndings() RunOption {
+- return optionSetter(func(opts *runConfig) {
+- opts.editor.WindowsLineEndings = true
+- })
+-}
+-
+-// Settings is a RunOption that sets user-provided configuration for the LSP
+-// server.
+-//
+-// As a special case, the env setting must not be provided via Settings: use
+-// EnvVars instead.
+-type Settings map[string]interface{}
+-
+-func (s Settings) set(opts *runConfig) {
+- if opts.editor.Settings == nil {
+- opts.editor.Settings = make(map[string]interface{})
+- }
+- for k, v := range s {
+- opts.editor.Settings[k] = v
+- }
+-}
+-
+-// WorkspaceFolders configures the workdir-relative workspace folders to send
+-// to the LSP server. By default the editor sends a single workspace folder
+-// corresponding to the workdir root. To explicitly configure no workspace
+-// folders, use WorkspaceFolders with no arguments.
+-func WorkspaceFolders(relFolders ...string) RunOption {
+- if len(relFolders) == 0 {
+- // Use an empty non-nil slice to signal explicitly no folders.
+- relFolders = []string{}
+- }
+- return optionSetter(func(opts *runConfig) {
+- opts.editor.WorkspaceFolders = relFolders
+- })
+-}
+-
+-// EnvVars sets environment variables for the LSP session. When applying these
+-// variables to the session, the special string $SANDBOX_WORKDIR is replaced by
+-// the absolute path to the sandbox working directory.
+-type EnvVars map[string]string
+-
+-func (e EnvVars) set(opts *runConfig) {
+- if opts.editor.Env == nil {
+- opts.editor.Env = make(map[string]string)
+- }
+- for k, v := range e {
+- opts.editor.Env[k] = v
+- }
+-}
+-
+-// InGOPATH configures the workspace working directory to be GOPATH, rather
+-// than a separate working directory for use with modules.
+-func InGOPATH() RunOption {
+- return optionSetter(func(opts *runConfig) {
+- opts.sandbox.InGoPath = true
+- })
+-}
+diff -urN a/gopls/internal/lsp/regtest/regtest.go b/gopls/internal/lsp/regtest/regtest.go
+--- a/gopls/internal/lsp/regtest/regtest.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/regtest/regtest.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,153 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package regtest
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+- "io/ioutil"
+- "os"
+- "runtime"
+- "testing"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/lsp/cmd"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/gocommand"
+- "golang.org/x/tools/internal/memoize"
+- "golang.org/x/tools/internal/testenv"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-var (
+- runSubprocessTests = flag.Bool("enable_gopls_subprocess_tests", false, "run regtests against a gopls subprocess")
+- goplsBinaryPath = flag.String("gopls_test_binary", "", "path to the gopls binary for use as a remote, for use with the -enable_gopls_subprocess_tests flag")
+- regtestTimeout = flag.Duration("regtest_timeout", defaultRegtestTimeout(), "if nonzero, default timeout for each regtest; defaults to GOPLS_REGTEST_TIMEOUT")
+- skipCleanup = flag.Bool("regtest_skip_cleanup", false, "whether to skip cleaning up temp directories")
+- printGoroutinesOnFailure = flag.Bool("regtest_print_goroutines", false, "whether to print goroutines info on failure")
+- printLogs = flag.Bool("regtest_print_logs", false, "whether to print LSP logs")
+-)
+-
+-func defaultRegtestTimeout() time.Duration {
+- s := os.Getenv("GOPLS_REGTEST_TIMEOUT")
+- if s == "" {
+- return 0
+- }
+- d, err := time.ParseDuration(s)
+- if err != nil {
+- fmt.Fprintf(os.Stderr, "invalid GOPLS_REGTEST_TIMEOUT %q: %v\n", s, err)
+- os.Exit(2)
+- }
+- return d
+-}
+-
+-var runner *Runner
+-
+-type regtestRunner interface {
+- Run(t *testing.T, files string, f TestFunc)
+-}
+-
+-func Run(t *testing.T, files string, f TestFunc) {
+- runner.Run(t, files, f)
+-}
+-
+-func WithOptions(opts ...RunOption) configuredRunner {
+- return configuredRunner{opts: opts}
+-}
+-
+-type configuredRunner struct {
+- opts []RunOption
+-}
+-
+-func (r configuredRunner) Run(t *testing.T, files string, f TestFunc) {
+- runner.Run(t, files, f, r.opts...)
+-}
+-
+-type RunMultiple []struct {
+- Name string
+- Runner regtestRunner
+-}
+-
+-func (r RunMultiple) Run(t *testing.T, files string, f TestFunc) {
+- for _, runner := range r {
+- t.Run(runner.Name, func(t *testing.T) {
+- runner.Runner.Run(t, files, f)
+- })
+- }
+-}
+-
+-// DefaultModes returns the default modes to run for each regression test (they
+-// may be reconfigured by the tests themselves).
+-func DefaultModes() Mode {
+- modes := Default
+- if !testing.Short() {
+- modes |= Experimental | Forwarded
+- }
+- if *runSubprocessTests {
+- modes |= SeparateProcess
+- }
+- return modes
+-}
+-
+-// Main sets up and tears down the shared regtest state.
+-func Main(m *testing.M, hook func(*source.Options)) {
+- // golang/go#54461: enable additional debugging around hanging Go commands.
+- gocommand.DebugHangingGoCommands = true
+-
+- // If this magic environment variable is set, run gopls instead of the test
+- // suite. See the documentation for runTestAsGoplsEnvvar for more details.
+- if os.Getenv(runTestAsGoplsEnvvar) == "true" {
+- tool.Main(context.Background(), cmd.New("gopls", "", nil, hook), os.Args[1:])
+- os.Exit(0)
+- }
+-
+- testenv.ExitIfSmallMachine()
+-
+- // Disable GOPACKAGESDRIVER, as it can cause spurious test failures.
+- os.Setenv("GOPACKAGESDRIVER", "off")
+-
+- flag.Parse()
+-
+- runner = &Runner{
+- DefaultModes: DefaultModes(),
+- Timeout: *regtestTimeout,
+- PrintGoroutinesOnFailure: *printGoroutinesOnFailure,
+- SkipCleanup: *skipCleanup,
+- OptionsHook: hook,
+- store: memoize.NewStore(memoize.NeverEvict),
+- }
+-
+- runner.goplsPath = *goplsBinaryPath
+- if runner.goplsPath == "" {
+- var err error
+- runner.goplsPath, err = os.Executable()
+- if err != nil {
+- panic(fmt.Sprintf("finding test binary path: %v", err))
+- }
+- }
+-
+- dir, err := ioutil.TempDir("", "gopls-regtest-")
+- if err != nil {
+- panic(fmt.Errorf("creating regtest temp directory: %v", err))
+- }
+- runner.tempDir = dir
+-
+- var code int
+- defer func() {
+- if err := runner.Close(); err != nil {
+- fmt.Fprintf(os.Stderr, "closing test runner: %v\n", err)
+- // Regtest cleanup is broken in go1.12 and earlier, and sometimes flakes on
+- // Windows due to file locking, but this is OK for our CI.
+- //
+- // Fail on go1.13+, except for windows and android which have shutdown problems.
+- if testenv.Go1Point() >= 13 && runtime.GOOS != "windows" && runtime.GOOS != "android" {
+- os.Exit(1)
+- }
+- }
+- os.Exit(code)
+- }()
+- code = m.Run()
+-}
+diff -urN a/gopls/internal/lsp/regtest/runner.go b/gopls/internal/lsp/regtest/runner.go
+--- a/gopls/internal/lsp/regtest/runner.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/regtest/runner.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,437 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package regtest
+-
+-import (
+- "bytes"
+- "context"
+- "fmt"
+- "io"
+- "io/ioutil"
+- "net"
+- "os"
+- "path/filepath"
+- "runtime"
+- "runtime/pprof"
+- "strings"
+- "sync"
+- "testing"
+- "time"
+-
+- exec "golang.org/x/sys/execabs"
+-
+- "golang.org/x/tools/gopls/internal/lsp/cache"
+- "golang.org/x/tools/gopls/internal/lsp/debug"
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/lsprpc"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/jsonrpc2"
+- "golang.org/x/tools/internal/jsonrpc2/servertest"
+- "golang.org/x/tools/internal/memoize"
+- "golang.org/x/tools/internal/testenv"
+- "golang.org/x/tools/internal/xcontext"
+-)
+-
+-// Mode is a bitmask that defines for which execution modes a test should run.
+-//
+-// Each mode controls several aspects of gopls' configuration:
+-// - Which server options to use for gopls sessions
+-// - Whether to use a shared cache
+-// - Whether to use a shared server
+-// - Whether to run the server in-process or in a separate process
+-//
+-// The behavior of each mode with respect to these aspects is summarized below.
+-// TODO(rfindley, cleanup): rather than using arbitrary names for these modes,
+-// we can compose them explicitly out of the features described here, allowing
+-// individual tests more freedom in constructing problematic execution modes.
+-// For example, a test could assert on a certain behavior when running with
+-// experimental options on a separate process. Moreover, we could unify 'Modes'
+-// with 'Options', and use RunMultiple rather than a hard-coded loop through
+-// modes.
+-//
+-// Mode | Options | Shared Cache? | Shared Server? | In-process?
+-// ---------------------------------------------------------------------------
+-// Default | Default | Y | N | Y
+-// Forwarded | Default | Y | Y | Y
+-// SeparateProcess | Default | Y | Y | N
+-// Experimental | Experimental | N | N | Y
+-type Mode int
+-
+-const (
+- // Default mode runs gopls with the default options, communicating over pipes
+- // to emulate the lsp sidecar execution mode, which communicates over
+- // stdin/stdout.
+- //
+- // It uses separate servers for each test, but a shared cache, to avoid
+- // duplicating work when processing GOROOT.
+- Default Mode = 1 << iota
+-
+- // Forwarded uses the default options, but forwards connections to a shared
+- // in-process gopls server.
+- Forwarded
+-
+- // SeparateProcess uses the default options, but forwards connection to an
+- // external gopls daemon.
+- //
+- // Only supported on GOOS=linux.
+- SeparateProcess
+-
+- // Experimental enables all of the experimental configurations that are
+- // being developed, and runs gopls in sidecar mode.
+- //
+- // It uses a separate cache for each test, to exercise races that may only
+- // appear with cache misses.
+- Experimental
+-)
+-
+-func (m Mode) String() string {
+- switch m {
+- case Default:
+- return "default"
+- case Forwarded:
+- return "forwarded"
+- case SeparateProcess:
+- return "separate process"
+- case Experimental:
+- return "experimental"
+- default:
+- return "unknown mode"
+- }
+-}
+-
+-// A Runner runs tests in gopls execution environments, as specified by its
+-// modes. For modes that share state (for example, a shared cache or common
+-// remote), any tests that execute on the same Runner will share the same
+-// state.
+-type Runner struct {
+- // Configuration
+- DefaultModes Mode // modes to run for each test
+- Timeout time.Duration // per-test timeout, if set
+- PrintGoroutinesOnFailure bool // whether to dump goroutines on test failure
+- SkipCleanup bool // if set, don't delete test data directories when the test exits
+- OptionsHook func(*source.Options) // if set, use these options when creating gopls sessions
+-
+- // Immutable state shared across test invocations
+- goplsPath string // path to the gopls executable (for SeparateProcess mode)
+- tempDir string // shared parent temp directory
+- store *memoize.Store // shared store
+-
+- // Lazily allocated resources
+- tsOnce sync.Once
+- ts *servertest.TCPServer // shared in-process test server ("forwarded" mode)
+-
+- startRemoteOnce sync.Once
+- remoteSocket string // unix domain socket for shared daemon ("separate process" mode)
+- remoteErr error
+- cancelRemote func()
+-}
+-
+-type TestFunc func(t *testing.T, env *Env)
+-
+-// Run executes the test function in the default configured gopls execution
+-// modes. For each a test run, a new workspace is created containing the
+-// un-txtared files specified by filedata.
+-func (r *Runner) Run(t *testing.T, files string, test TestFunc, opts ...RunOption) {
+- // TODO(rfindley): this function has gotten overly complicated, and warrants
+- // refactoring.
+- t.Helper()
+- checkBuilder(t)
+- testenv.NeedsGoPackages(t)
+-
+- tests := []struct {
+- name string
+- mode Mode
+- getServer func(func(*source.Options)) jsonrpc2.StreamServer
+- }{
+- {"default", Default, r.defaultServer},
+- {"forwarded", Forwarded, r.forwardedServer},
+- {"separate_process", SeparateProcess, r.separateProcessServer},
+- {"experimental", Experimental, r.experimentalServer},
+- }
+-
+- for _, tc := range tests {
+- tc := tc
+- var config runConfig
+- for _, opt := range opts {
+- opt.set(&config)
+- }
+- modes := r.DefaultModes
+- if config.modes != 0 {
+- modes = config.modes
+- }
+- if modes&tc.mode == 0 {
+- continue
+- }
+-
+- t.Run(tc.name, func(t *testing.T) {
+- // TODO(rfindley): once jsonrpc2 shutdown is fixed, we should not leak
+- // goroutines in this test function.
+- // stacktest.NoLeak(t)
+-
+- ctx := context.Background()
+- if r.Timeout != 0 {
+- var cancel context.CancelFunc
+- ctx, cancel = context.WithTimeout(ctx, r.Timeout)
+- defer cancel()
+- } else if d, ok := testenv.Deadline(t); ok {
+- timeout := time.Until(d) * 19 / 20 // Leave an arbitrary 5% for cleanup.
+- var cancel context.CancelFunc
+- ctx, cancel = context.WithTimeout(ctx, timeout)
+- defer cancel()
+- }
+-
+- // TODO(rfindley): do we need an instance at all? Can it be removed?
+- ctx = debug.WithInstance(ctx, "", "off")
+-
+- rootDir := filepath.Join(r.tempDir, filepath.FromSlash(t.Name()))
+- if err := os.MkdirAll(rootDir, 0755); err != nil {
+- t.Fatal(err)
+- }
+-
+- files := fake.UnpackTxt(files)
+- if config.editor.WindowsLineEndings {
+- for name, data := range files {
+- files[name] = bytes.ReplaceAll(data, []byte("\n"), []byte("\r\n"))
+- }
+- }
+- config.sandbox.Files = files
+- config.sandbox.RootDir = rootDir
+- sandbox, err := fake.NewSandbox(&config.sandbox)
+- if err != nil {
+- t.Fatal(err)
+- }
+- defer func() {
+- if !r.SkipCleanup {
+- if err := sandbox.Close(); err != nil {
+- pprof.Lookup("goroutine").WriteTo(os.Stderr, 1)
+- t.Errorf("closing the sandbox: %v", err)
+- }
+- }
+- }()
+-
+- ss := tc.getServer(r.OptionsHook)
+-
+- framer := jsonrpc2.NewRawStream
+- ls := &loggingFramer{}
+- framer = ls.framer(jsonrpc2.NewRawStream)
+- ts := servertest.NewPipeServer(ss, framer)
+-
+- awaiter := NewAwaiter(sandbox.Workdir)
+- const skipApplyEdits = false
+- editor, err := fake.NewEditor(sandbox, config.editor).Connect(ctx, ts, awaiter.Hooks(), skipApplyEdits)
+- if err != nil {
+- t.Fatal(err)
+- }
+- env := &Env{
+- T: t,
+- Ctx: ctx,
+- Sandbox: sandbox,
+- Editor: editor,
+- Server: ts,
+- Awaiter: awaiter,
+- }
+- defer func() {
+- if t.Failed() && r.PrintGoroutinesOnFailure {
+- pprof.Lookup("goroutine").WriteTo(os.Stderr, 1)
+- }
+- if t.Failed() || *printLogs {
+- ls.printBuffers(t.Name(), os.Stderr)
+- }
+- // For tests that failed due to a timeout, don't fail to shutdown
+- // because ctx is done.
+- //
+- // There is little point to setting an arbitrary timeout for closing
+- // the editor: in general we want to clean up before proceeding to the
+- // next test, and if there is a deadlock preventing closing it will
+- // eventually be handled by the `go test` timeout.
+- if err := editor.Close(xcontext.Detach(ctx)); err != nil {
+- t.Errorf("closing editor: %v", err)
+- }
+- }()
+- // Always await the initial workspace load.
+- env.Await(InitialWorkspaceLoad)
+- test(t, env)
+- })
+- }
+-}
+-
+-// longBuilders maps builders that are skipped when -short is set to a
+-// (possibly empty) justification.
+-var longBuilders = map[string]string{
+- "openbsd-amd64-64": "golang.org/issues/42789",
+- "openbsd-386-64": "golang.org/issues/42789",
+- "openbsd-386-68": "golang.org/issues/42789",
+- "openbsd-amd64-68": "golang.org/issues/42789",
+- "darwin-amd64-10_12": "",
+- "freebsd-amd64-race": "",
+- "illumos-amd64": "",
+- "netbsd-arm-bsiegert": "",
+- "solaris-amd64-oraclerel": "",
+- "windows-arm-zx2c4": "",
+-}
+-
+-func checkBuilder(t *testing.T) {
+- t.Helper()
+- builder := os.Getenv("GO_BUILDER_NAME")
+- if reason, ok := longBuilders[builder]; ok && testing.Short() {
+- if reason != "" {
+- t.Skipf("Skipping %s with -short due to %s", builder, reason)
+- } else {
+- t.Skipf("Skipping %s with -short", builder)
+- }
+- }
+-}
+-
+-type loggingFramer struct {
+- mu sync.Mutex
+- buf *safeBuffer
+-}
+-
+-// safeBuffer is a threadsafe buffer for logs.
+-type safeBuffer struct {
+- mu sync.Mutex
+- buf bytes.Buffer
+-}
+-
+-func (b *safeBuffer) Write(p []byte) (int, error) {
+- b.mu.Lock()
+- defer b.mu.Unlock()
+- return b.buf.Write(p)
+-}
+-
+-func (s *loggingFramer) framer(f jsonrpc2.Framer) jsonrpc2.Framer {
+- return func(nc net.Conn) jsonrpc2.Stream {
+- s.mu.Lock()
+- framed := false
+- if s.buf == nil {
+- s.buf = &safeBuffer{buf: bytes.Buffer{}}
+- framed = true
+- }
+- s.mu.Unlock()
+- stream := f(nc)
+- if framed {
+- return protocol.LoggingStream(stream, s.buf)
+- }
+- return stream
+- }
+-}
+-
+-func (s *loggingFramer) printBuffers(testname string, w io.Writer) {
+- s.mu.Lock()
+- defer s.mu.Unlock()
+-
+- if s.buf == nil {
+- return
+- }
+- fmt.Fprintf(os.Stderr, "#### Start Gopls Test Logs for %q\n", testname)
+- s.buf.mu.Lock()
+- io.Copy(w, &s.buf.buf)
+- s.buf.mu.Unlock()
+- fmt.Fprintf(os.Stderr, "#### End Gopls Test Logs for %q\n", testname)
+-}
+-
+-// defaultServer handles the Default execution mode.
+-func (r *Runner) defaultServer(optsHook func(*source.Options)) jsonrpc2.StreamServer {
+- return lsprpc.NewStreamServer(cache.New(r.store), false, optsHook)
+-}
+-
+-// experimentalServer handles the Experimental execution mode.
+-func (r *Runner) experimentalServer(optsHook func(*source.Options)) jsonrpc2.StreamServer {
+- options := func(o *source.Options) {
+- optsHook(o)
+- o.EnableAllExperiments()
+- }
+- return lsprpc.NewStreamServer(cache.New(nil), false, options)
+-}
+-
+-// forwardedServer handles the Forwarded execution mode.
+-func (r *Runner) forwardedServer(optsHook func(*source.Options)) jsonrpc2.StreamServer {
+- r.tsOnce.Do(func() {
+- ctx := context.Background()
+- ctx = debug.WithInstance(ctx, "", "off")
+- ss := lsprpc.NewStreamServer(cache.New(nil), false, optsHook)
+- r.ts = servertest.NewTCPServer(ctx, ss, nil)
+- })
+- return newForwarder("tcp", r.ts.Addr)
+-}
+-
+-// runTestAsGoplsEnvvar triggers TestMain to run gopls instead of running
+-// tests. It's a trick to allow tests to find a binary to use to start a gopls
+-// subprocess.
+-const runTestAsGoplsEnvvar = "_GOPLS_TEST_BINARY_RUN_AS_GOPLS"
+-
+-// separateProcessServer handles the SeparateProcess execution mode.
+-func (r *Runner) separateProcessServer(optsHook func(*source.Options)) jsonrpc2.StreamServer {
+- if runtime.GOOS != "linux" {
+- panic("separate process execution mode is only supported on linux")
+- }
+-
+- r.startRemoteOnce.Do(func() {
+- socketDir, err := ioutil.TempDir(r.tempDir, "gopls-regtest-socket")
+- if err != nil {
+- r.remoteErr = err
+- return
+- }
+- r.remoteSocket = filepath.Join(socketDir, "gopls-test-daemon")
+-
+- // The server should be killed by when the test runner exits, but to be
+- // conservative also set a listen timeout.
+- args := []string{"serve", "-listen", "unix;" + r.remoteSocket, "-listen.timeout", "1m"}
+-
+- ctx, cancel := context.WithCancel(context.Background())
+- cmd := exec.CommandContext(ctx, r.goplsPath, args...)
+- cmd.Env = append(os.Environ(), runTestAsGoplsEnvvar+"=true")
+-
+- // Start the external gopls process. This is still somewhat racy, as we
+- // don't know when gopls binds to the socket, but the gopls forwarder
+- // client has built-in retry behavior that should mostly mitigate this
+- // problem (and if it doesn't, we probably want to improve the retry
+- // behavior).
+- if err := cmd.Start(); err != nil {
+- cancel()
+- r.remoteSocket = ""
+- r.remoteErr = err
+- } else {
+- r.cancelRemote = cancel
+- // Spin off a goroutine to wait, so that we free up resources when the
+- // server exits.
+- go cmd.Wait()
+- }
+- })
+-
+- return newForwarder("unix", r.remoteSocket)
+-}
+-
+-func newForwarder(network, address string) *lsprpc.Forwarder {
+- server, err := lsprpc.NewForwarder(network+";"+address, nil)
+- if err != nil {
+- // This should never happen, as we are passing an explicit address.
+- panic(fmt.Sprintf("internal error: unable to create forwarder: %v", err))
+- }
+- return server
+-}
+-
+-// Close cleans up resource that have been allocated to this workspace.
+-func (r *Runner) Close() error {
+- var errmsgs []string
+- if r.ts != nil {
+- if err := r.ts.Close(); err != nil {
+- errmsgs = append(errmsgs, err.Error())
+- }
+- }
+- if r.cancelRemote != nil {
+- r.cancelRemote()
+- }
+- if !r.SkipCleanup {
+- if err := os.RemoveAll(r.tempDir); err != nil {
+- errmsgs = append(errmsgs, err.Error())
+- }
+- }
+- if len(errmsgs) > 0 {
+- return fmt.Errorf("errors closing the test runner:\n\t%s", strings.Join(errmsgs, "\n\t"))
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/regtest/wrappers.go b/gopls/internal/lsp/regtest/wrappers.go
+--- a/gopls/internal/lsp/regtest/wrappers.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/regtest/wrappers.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,489 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package regtest
+-
+-import (
+- "encoding/json"
+- "path"
+-
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/xcontext"
+-)
+-
+-// RemoveWorkspaceFile deletes a file on disk but does nothing in the
+-// editor. It calls t.Fatal on any error.
+-func (e *Env) RemoveWorkspaceFile(name string) {
+- e.T.Helper()
+- if err := e.Sandbox.Workdir.RemoveFile(e.Ctx, name); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// ReadWorkspaceFile reads a file from the workspace, calling t.Fatal on any
+-// error.
+-func (e *Env) ReadWorkspaceFile(name string) string {
+- e.T.Helper()
+- content, err := e.Sandbox.Workdir.ReadFile(name)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return string(content)
+-}
+-
+-// WriteWorkspaceFile writes a file to disk but does nothing in the editor.
+-// It calls t.Fatal on any error.
+-func (e *Env) WriteWorkspaceFile(name, content string) {
+- e.T.Helper()
+- if err := e.Sandbox.Workdir.WriteFile(e.Ctx, name, content); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// WriteWorkspaceFiles deletes a file on disk but does nothing in the
+-// editor. It calls t.Fatal on any error.
+-func (e *Env) WriteWorkspaceFiles(files map[string]string) {
+- e.T.Helper()
+- if err := e.Sandbox.Workdir.WriteFiles(e.Ctx, files); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// ListFiles lists relative paths to files in the given directory.
+-// It calls t.Fatal on any error.
+-func (e *Env) ListFiles(dir string) []string {
+- e.T.Helper()
+- paths, err := e.Sandbox.Workdir.ListFiles(dir)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return paths
+-}
+-
+-// OpenFile opens a file in the editor, calling t.Fatal on any error.
+-func (e *Env) OpenFile(name string) {
+- e.T.Helper()
+- if err := e.Editor.OpenFile(e.Ctx, name); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// CreateBuffer creates a buffer in the editor, calling t.Fatal on any error.
+-func (e *Env) CreateBuffer(name string, content string) {
+- e.T.Helper()
+- if err := e.Editor.CreateBuffer(e.Ctx, name, content); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// BufferText returns the current buffer contents for the file with the given
+-// relative path, calling t.Fatal if the file is not open in a buffer.
+-func (e *Env) BufferText(name string) string {
+- e.T.Helper()
+- text, ok := e.Editor.BufferText(name)
+- if !ok {
+- e.T.Fatalf("buffer %q is not open", name)
+- }
+- return text
+-}
+-
+-// CloseBuffer closes an editor buffer without saving, calling t.Fatal on any
+-// error.
+-func (e *Env) CloseBuffer(name string) {
+- e.T.Helper()
+- if err := e.Editor.CloseBuffer(e.Ctx, name); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// EditBuffer applies edits to an editor buffer, calling t.Fatal on any error.
+-func (e *Env) EditBuffer(name string, edits ...protocol.TextEdit) {
+- e.T.Helper()
+- if err := e.Editor.EditBuffer(e.Ctx, name, edits); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-func (e *Env) SetBufferContent(name string, content string) {
+- e.T.Helper()
+- if err := e.Editor.SetBufferContent(e.Ctx, name, content); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// RegexpSearch returns the starting position of the first match for re in the
+-// buffer specified by name, calling t.Fatal on any error. It first searches
+-// for the position in open buffers, then in workspace files.
+-func (e *Env) RegexpSearch(name, re string) protocol.Location {
+- e.T.Helper()
+- loc, err := e.Editor.RegexpSearch(name, re)
+- if err == fake.ErrUnknownBuffer {
+- loc, err = e.Sandbox.Workdir.RegexpSearch(name, re)
+- }
+- if err != nil {
+- e.T.Fatalf("RegexpSearch: %v, %v for %q", name, err, re)
+- }
+- return loc
+-}
+-
+-// RegexpReplace replaces the first group in the first match of regexpStr with
+-// the replace text, calling t.Fatal on any error.
+-func (e *Env) RegexpReplace(name, regexpStr, replace string) {
+- e.T.Helper()
+- if err := e.Editor.RegexpReplace(e.Ctx, name, regexpStr, replace); err != nil {
+- e.T.Fatalf("RegexpReplace: %v", err)
+- }
+-}
+-
+-// SaveBuffer saves an editor buffer, calling t.Fatal on any error.
+-func (e *Env) SaveBuffer(name string) {
+- e.T.Helper()
+- if err := e.Editor.SaveBuffer(e.Ctx, name); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-func (e *Env) SaveBufferWithoutActions(name string) {
+- e.T.Helper()
+- if err := e.Editor.SaveBufferWithoutActions(e.Ctx, name); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// GoToDefinition goes to definition in the editor, calling t.Fatal on any
+-// error. It returns the path and position of the resulting jump.
+-func (e *Env) GoToDefinition(loc protocol.Location) protocol.Location {
+- e.T.Helper()
+- loc, err := e.Editor.GoToDefinition(e.Ctx, loc)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return loc
+-}
+-
+-// FormatBuffer formats the editor buffer, calling t.Fatal on any error.
+-func (e *Env) FormatBuffer(name string) {
+- e.T.Helper()
+- if err := e.Editor.FormatBuffer(e.Ctx, name); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// OrganizeImports processes the source.organizeImports codeAction, calling
+-// t.Fatal on any error.
+-func (e *Env) OrganizeImports(name string) {
+- e.T.Helper()
+- if err := e.Editor.OrganizeImports(e.Ctx, name); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// ApplyQuickFixes processes the quickfix codeAction, calling t.Fatal on any error.
+-func (e *Env) ApplyQuickFixes(path string, diagnostics []protocol.Diagnostic) {
+- e.T.Helper()
+- loc := protocol.Location{URI: e.Sandbox.Workdir.URI(path)} // zero Range => whole file
+- if err := e.Editor.ApplyQuickFixes(e.Ctx, loc, diagnostics); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// ApplyCodeAction applies the given code action.
+-func (e *Env) ApplyCodeAction(action protocol.CodeAction) {
+- e.T.Helper()
+- if err := e.Editor.ApplyCodeAction(e.Ctx, action); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// GetQuickFixes returns the available quick fix code actions.
+-func (e *Env) GetQuickFixes(path string, diagnostics []protocol.Diagnostic) []protocol.CodeAction {
+- e.T.Helper()
+- loc := protocol.Location{URI: e.Sandbox.Workdir.URI(path)} // zero Range => whole file
+- actions, err := e.Editor.GetQuickFixes(e.Ctx, loc, diagnostics)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return actions
+-}
+-
+-// Hover in the editor, calling t.Fatal on any error.
+-func (e *Env) Hover(loc protocol.Location) (*protocol.MarkupContent, protocol.Location) {
+- e.T.Helper()
+- c, loc, err := e.Editor.Hover(e.Ctx, loc)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return c, loc
+-}
+-
+-func (e *Env) DocumentLink(name string) []protocol.DocumentLink {
+- e.T.Helper()
+- links, err := e.Editor.DocumentLink(e.Ctx, name)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return links
+-}
+-
+-func (e *Env) DocumentHighlight(loc protocol.Location) []protocol.DocumentHighlight {
+- e.T.Helper()
+- highlights, err := e.Editor.DocumentHighlight(e.Ctx, loc)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return highlights
+-}
+-
+-// RunGenerate runs "go generate" in the given dir, calling t.Fatal on any error.
+-// It waits for the generate command to complete and checks for file changes
+-// before returning.
+-func (e *Env) RunGenerate(dir string) {
+- e.T.Helper()
+- if err := e.Editor.RunGenerate(e.Ctx, dir); err != nil {
+- e.T.Fatal(err)
+- }
+- e.Await(NoOutstandingWork())
+- // Ideally the fake.Workspace would handle all synthetic file watching, but
+- // we help it out here as we need to wait for the generate command to
+- // complete before checking the filesystem.
+- e.CheckForFileChanges()
+-}
+-
+-// RunGoCommand runs the given command in the sandbox's default working
+-// directory.
+-func (e *Env) RunGoCommand(verb string, args ...string) {
+- e.T.Helper()
+- if err := e.Sandbox.RunGoCommand(e.Ctx, "", verb, args, true); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// RunGoCommandInDir is like RunGoCommand, but executes in the given
+-// relative directory of the sandbox.
+-func (e *Env) RunGoCommandInDir(dir, verb string, args ...string) {
+- e.T.Helper()
+- if err := e.Sandbox.RunGoCommand(e.Ctx, dir, verb, args, true); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// GoVersion checks the version of the go command.
+-// It returns the X in Go 1.X.
+-func (e *Env) GoVersion() int {
+- e.T.Helper()
+- v, err := e.Sandbox.GoVersion(e.Ctx)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return v
+-}
+-
+-// DumpGoSum prints the correct go.sum contents for dir in txtar format,
+-// for use in creating regtests.
+-func (e *Env) DumpGoSum(dir string) {
+- e.T.Helper()
+-
+- if err := e.Sandbox.RunGoCommand(e.Ctx, dir, "list", []string{"-mod=mod", "..."}, true); err != nil {
+- e.T.Fatal(err)
+- }
+- sumFile := path.Join(dir, "/go.sum")
+- e.T.Log("\n\n-- " + sumFile + " --\n" + e.ReadWorkspaceFile(sumFile))
+- e.T.Fatal("see contents above")
+-}
+-
+-// CheckForFileChanges triggers a manual poll of the workspace for any file
+-// changes since creation, or since last polling. It is a workaround for the
+-// lack of true file watching support in the fake workspace.
+-func (e *Env) CheckForFileChanges() {
+- e.T.Helper()
+- if err := e.Sandbox.Workdir.CheckForFileChanges(e.Ctx); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// CodeLens calls textDocument/codeLens for the given path, calling t.Fatal on
+-// any error.
+-func (e *Env) CodeLens(path string) []protocol.CodeLens {
+- e.T.Helper()
+- lens, err := e.Editor.CodeLens(e.Ctx, path)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return lens
+-}
+-
+-// ExecuteCodeLensCommand executes the command for the code lens matching the
+-// given command name.
+-func (e *Env) ExecuteCodeLensCommand(path string, cmd command.Command, result interface{}) {
+- e.T.Helper()
+- lenses := e.CodeLens(path)
+- var lens protocol.CodeLens
+- var found bool
+- for _, l := range lenses {
+- if l.Command.Command == cmd.ID() {
+- lens = l
+- found = true
+- }
+- }
+- if !found {
+- e.T.Fatalf("found no command with the ID %s", cmd.ID())
+- }
+- e.ExecuteCommand(&protocol.ExecuteCommandParams{
+- Command: lens.Command.Command,
+- Arguments: lens.Command.Arguments,
+- }, result)
+-}
+-
+-func (e *Env) ExecuteCommand(params *protocol.ExecuteCommandParams, result interface{}) {
+- e.T.Helper()
+- response, err := e.Editor.ExecuteCommand(e.Ctx, params)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- if result == nil {
+- return
+- }
+- // Hack: The result of an executeCommand request will be unmarshaled into
+- // maps. Re-marshal and unmarshal into the type we expect.
+- //
+- // This could be improved by generating a jsonrpc2 command client from the
+- // command.Interface, but that should only be done if we're consolidating
+- // this part of the tsprotocol generation.
+- data, err := json.Marshal(response)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- if err := json.Unmarshal(data, result); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// InlayHints calls textDocument/inlayHints for the given path, calling t.Fatal on
+-// any error.
+-func (e *Env) InlayHints(path string) []protocol.InlayHint {
+- e.T.Helper()
+- hints, err := e.Editor.InlayHint(e.Ctx, path)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return hints
+-}
+-
+-// Symbol calls workspace/symbol
+-func (e *Env) Symbol(query string) []protocol.SymbolInformation {
+- e.T.Helper()
+- ans, err := e.Editor.Symbols(e.Ctx, query)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return ans
+-}
+-
+-// References wraps Editor.References, calling t.Fatal on any error.
+-func (e *Env) References(loc protocol.Location) []protocol.Location {
+- e.T.Helper()
+- locations, err := e.Editor.References(e.Ctx, loc)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return locations
+-}
+-
+-// Rename wraps Editor.Rename, calling t.Fatal on any error.
+-func (e *Env) Rename(loc protocol.Location, newName string) {
+- e.T.Helper()
+- if err := e.Editor.Rename(e.Ctx, loc, newName); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// Implementations wraps Editor.Implementations, calling t.Fatal on any error.
+-func (e *Env) Implementations(loc protocol.Location) []protocol.Location {
+- e.T.Helper()
+- locations, err := e.Editor.Implementations(e.Ctx, loc)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return locations
+-}
+-
+-// RenameFile wraps Editor.RenameFile, calling t.Fatal on any error.
+-func (e *Env) RenameFile(oldPath, newPath string) {
+- e.T.Helper()
+- if err := e.Editor.RenameFile(e.Ctx, oldPath, newPath); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// SignatureHelp wraps Editor.SignatureHelp, calling t.Fatal on error
+-func (e *Env) SignatureHelp(loc protocol.Location) *protocol.SignatureHelp {
+- e.T.Helper()
+- sighelp, err := e.Editor.SignatureHelp(e.Ctx, loc)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return sighelp
+-}
+-
+-// Completion executes a completion request on the server.
+-func (e *Env) Completion(loc protocol.Location) *protocol.CompletionList {
+- e.T.Helper()
+- completions, err := e.Editor.Completion(e.Ctx, loc)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return completions
+-}
+-
+-// AcceptCompletion accepts a completion for the given item at the given
+-// position.
+-func (e *Env) AcceptCompletion(loc protocol.Location, item protocol.CompletionItem) {
+- e.T.Helper()
+- if err := e.Editor.AcceptCompletion(e.Ctx, loc, item); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// CodeAction calls testDocument/codeAction for the given path, and calls
+-// t.Fatal if there are errors.
+-func (e *Env) CodeAction(path string, diagnostics []protocol.Diagnostic) []protocol.CodeAction {
+- e.T.Helper()
+- loc := protocol.Location{URI: e.Sandbox.Workdir.URI(path)} // no Range => whole file
+- actions, err := e.Editor.CodeAction(e.Ctx, loc, diagnostics)
+- if err != nil {
+- e.T.Fatal(err)
+- }
+- return actions
+-}
+-
+-// ChangeConfiguration updates the editor config, calling t.Fatal on any error.
+-func (e *Env) ChangeConfiguration(newConfig fake.EditorConfig) {
+- e.T.Helper()
+- if err := e.Editor.ChangeConfiguration(e.Ctx, newConfig); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// ChangeWorkspaceFolders updates the editor workspace folders, calling t.Fatal
+-// on any error.
+-func (e *Env) ChangeWorkspaceFolders(newFolders ...string) {
+- e.T.Helper()
+- if err := e.Editor.ChangeWorkspaceFolders(e.Ctx, newFolders); err != nil {
+- e.T.Fatal(err)
+- }
+-}
+-
+-// Close shuts down the editor session and cleans up the sandbox directory,
+-// calling t.Error on any error.
+-func (e *Env) Close() {
+- ctx := xcontext.Detach(e.Ctx)
+- if err := e.Editor.Close(ctx); err != nil {
+- e.T.Errorf("closing editor: %v", err)
+- }
+- if err := e.Sandbox.Close(); err != nil {
+- e.T.Errorf("cleaning up sandbox: %v", err)
+- }
+-}
+diff -urN a/gopls/internal/lsp/rename.go b/gopls/internal/lsp/rename.go
+--- a/gopls/internal/lsp/rename.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/rename.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,78 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+- "path/filepath"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-func (s *Server) rename(ctx context.Context, params *protocol.RenameParams) (*protocol.WorkspaceEdit, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.Go)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+- // Because we don't handle directory renaming within source.Rename, source.Rename returns
+- // boolean value isPkgRenaming to determine whether an DocumentChanges of type RenameFile should
+- // be added to the return protocol.WorkspaceEdit value.
+- edits, isPkgRenaming, err := source.Rename(ctx, snapshot, fh, params.Position, params.NewName)
+- if err != nil {
+- return nil, err
+- }
+-
+- var docChanges []protocol.DocumentChanges
+- for uri, e := range edits {
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return nil, err
+- }
+- docChanges = append(docChanges, documentChanges(fh, e)...)
+- }
+- if isPkgRenaming {
+- // Update the last component of the file's enclosing directory.
+- oldBase := filepath.Dir(fh.URI().Filename())
+- newURI := filepath.Join(filepath.Dir(oldBase), params.NewName)
+- docChanges = append(docChanges, protocol.DocumentChanges{
+- RenameFile: &protocol.RenameFile{
+- Kind: "rename",
+- OldURI: protocol.URIFromPath(oldBase),
+- NewURI: protocol.URIFromPath(newURI),
+- },
+- })
+- }
+- return &protocol.WorkspaceEdit{
+- DocumentChanges: docChanges,
+- }, nil
+-}
+-
+-// prepareRename implements the textDocument/prepareRename handler. It may
+-// return (nil, nil) if there is no rename at the cursor position, but it is
+-// not desirable to display an error to the user.
+-//
+-// TODO(rfindley): why wouldn't we want to show an error to the user, if the
+-// user initiated a rename request at the cursor?
+-func (s *Server) prepareRename(ctx context.Context, params *protocol.PrepareRenameParams) (*protocol.PrepareRename2Gn, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.Go)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+- // Do not return errors here, as it adds clutter.
+- // Returning a nil result means there is not a valid rename.
+- item, usererr, err := source.PrepareRename(ctx, snapshot, fh, params.Position)
+- if err != nil {
+- // Return usererr here rather than err, to avoid cluttering the UI with
+- // internal error details.
+- return nil, usererr
+- }
+- return &protocol.PrepareRename2Gn{
+- Range: item.Range,
+- Placeholder: item.Text,
+- }, nil
+-}
+diff -urN a/gopls/internal/lsp/reset_golden.sh b/gopls/internal/lsp/reset_golden.sh
+--- a/gopls/internal/lsp/reset_golden.sh 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/reset_golden.sh 1970-01-01 00:00:00.000000000 +0000
+@@ -1,30 +0,0 @@
+-#!/bin/bash
+-#
+-# Copyright 2022 The Go Authors. All rights reserved.
+-# Use of this source code is governed by a BSD-style
+-# license that can be found in the LICENSE file.
+-#
+-# Updates the *.golden files ... to match the tests' current behavior.
+-
+-set -eu
+-
+-GO117BIN="go1.17.9"
+-
+-command -v $GO117BIN >/dev/null 2>&1 || {
+- go install golang.org/dl/$GO117BIN@latest
+- $GO117BIN download
+-}
+-
+-find ./internal/lsp/testdata -name *.golden ! -name summary*.txt.golden -delete
+-# Here we intentionally do not run the ./internal/lsp/source tests with
+-# -golden. Eventually these tests will be deleted, and in the meantime they are
+-# redundant with the ./internal/lsp tests.
+-#
+-# Note: go1.17.9 tests must be run *before* go tests, as by convention the
+-# golden output should match the output of gopls built with the most recent
+-# version of Go. If output differs at 1.17, tests must be tolerant of the 1.17
+-# output.
+-$GO117BIN test ./internal/lsp -golden
+-go test ./internal/lsp -golden
+-$GO117BIN test ./test -golden
+-go test ./test -golden
+diff -urN a/gopls/internal/lsp/safetoken/safetoken.go b/gopls/internal/lsp/safetoken/safetoken.go
+--- a/gopls/internal/lsp/safetoken/safetoken.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/safetoken/safetoken.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,122 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package safetoken provides wrappers around methods in go/token,
+-// that return errors rather than panicking.
+-//
+-// It also provides a central place for workarounds in the underlying
+-// packages. The use of this package's functions instead of methods of
+-// token.File (such as Offset, Position, and PositionFor) is mandatory
+-// throughout the gopls codebase and enforced by a static check.
+-package safetoken
+-
+-import (
+- "fmt"
+- "go/token"
+-)
+-
+-// Offset returns f.Offset(pos), but first checks that the file
+-// contains the pos.
+-//
+-// The definition of "contains" here differs from that of token.File
+-// in order to work around a bug in the parser (issue #57490): during
+-// error recovery, the parser may create syntax nodes whose computed
+-// End position is 1 byte beyond EOF, which would cause
+-// token.File.Offset to panic. The workaround is that this function
+-// accepts a Pos that is exactly 1 byte beyond EOF and maps it to the
+-// EOF offset.
+-func Offset(f *token.File, pos token.Pos) (int, error) {
+- if !inRange(f, pos) {
+- // Accept a Pos that is 1 byte beyond EOF,
+- // and map it to the EOF offset.
+- // (Workaround for #57490.)
+- if int(pos) == f.Base()+f.Size()+1 {
+- return f.Size(), nil
+- }
+-
+- return -1, fmt.Errorf("pos %d is not in range [%d:%d] of file %s",
+- pos, f.Base(), f.Base()+f.Size(), f.Name())
+- }
+- return int(pos) - f.Base(), nil
+-}
+-
+-// Offsets returns Offset(start) and Offset(end).
+-func Offsets(f *token.File, start, end token.Pos) (int, int, error) {
+- startOffset, err := Offset(f, start)
+- if err != nil {
+- return 0, 0, fmt.Errorf("start: %v", err)
+- }
+- endOffset, err := Offset(f, end)
+- if err != nil {
+- return 0, 0, fmt.Errorf("end: %v", err)
+- }
+- return startOffset, endOffset, nil
+-}
+-
+-// Pos returns f.Pos(offset), but first checks that the offset is
+-// non-negative and not larger than the size of the file.
+-func Pos(f *token.File, offset int) (token.Pos, error) {
+- if !(0 <= offset && offset <= f.Size()) {
+- return token.NoPos, fmt.Errorf("offset %d is not in range for file %s of size %d", offset, f.Name(), f.Size())
+- }
+- return token.Pos(f.Base() + offset), nil
+-}
+-
+-// inRange reports whether file f contains position pos,
+-// according to the invariants of token.File.
+-//
+-// This function is not public because of the ambiguity it would
+-// create w.r.t. the definition of "contains". Use Offset instead.
+-func inRange(f *token.File, pos token.Pos) bool {
+- return token.Pos(f.Base()) <= pos && pos <= token.Pos(f.Base()+f.Size())
+-}
+-
+-// Position returns the Position for the pos value in the given file.
+-//
+-// p must be NoPos, a valid Pos in the range of f, or exactly 1 byte
+-// beyond the end of f. (See [Offset] for explanation.)
+-// Any other value causes a panic.
+-//
+-// Line directives (//line comments) are ignored.
+-func Position(f *token.File, pos token.Pos) token.Position {
+- // Work around issue #57490.
+- if int(pos) == f.Base()+f.Size()+1 {
+- pos--
+- }
+-
+- // TODO(adonovan): centralize the workaround for
+- // golang/go#41029 (newline at EOF) here too.
+-
+- return f.PositionFor(pos, false)
+-}
+-
+-// StartPosition converts a start Pos in the FileSet into a Position.
+-//
+-// Call this function only if start represents the start of a token or
+-// parse tree, such as the result of Node.Pos(). If start is the end of
+-// an interval, such as Node.End(), call EndPosition instead, as it
+-// may need the correction described at [Position].
+-func StartPosition(fset *token.FileSet, start token.Pos) (_ token.Position) {
+- if f := fset.File(start); f != nil {
+- return Position(f, start)
+- }
+- return
+-}
+-
+-// EndPosition converts an end Pos in the FileSet into a Position.
+-//
+-// Call this function only if pos represents the end of
+-// a non-empty interval, such as the result of Node.End().
+-func EndPosition(fset *token.FileSet, end token.Pos) (_ token.Position) {
+- if f := fset.File(end); f != nil && int(end) > f.Base() {
+- return Position(f, end)
+- }
+-
+- // Work around issue #57490.
+- if f := fset.File(end - 1); f != nil {
+- return Position(f, end)
+- }
+-
+- return
+-}
+diff -urN a/gopls/internal/lsp/safetoken/safetoken_test.go b/gopls/internal/lsp/safetoken/safetoken_test.go
+--- a/gopls/internal/lsp/safetoken/safetoken_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/safetoken/safetoken_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,121 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package safetoken_test
+-
+-import (
+- "fmt"
+- "go/parser"
+- "go/token"
+- "go/types"
+- "os"
+- "testing"
+-
+- "golang.org/x/tools/go/packages"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-func TestWorkaroundIssue57490(t *testing.T) {
+- // During error recovery the parser synthesizes various close
+- // tokens at EOF, causing the End position of incomplete
+- // syntax nodes, computed as Rbrace+len("}"), to be beyond EOF.
+- src := `package p; func f() { var x struct`
+- fset := token.NewFileSet()
+- file, _ := parser.ParseFile(fset, "a.go", src, 0)
+- tf := fset.File(file.Pos())
+-
+- // Add another file to the FileSet.
+- file2, _ := parser.ParseFile(fset, "b.go", "package q", 0)
+-
+- // This is the ambiguity of #57490...
+- if file.End() != file2.Pos() {
+- t.Errorf("file.End() %d != %d file2.Pos()", file.End(), file2.Pos())
+- }
+- // ...which causes these statements to panic.
+- if false {
+- tf.Offset(file.End()) // panic: invalid Pos value 36 (should be in [1, 35])
+- tf.Position(file.End()) // panic: invalid Pos value 36 (should be in [1, 35])
+- }
+-
+- // The offset of the EOF position is the file size.
+- offset, err := safetoken.Offset(tf, file.End()-1)
+- if err != nil || offset != tf.Size() {
+- t.Errorf("Offset(EOF) = (%d, %v), want token.File.Size %d", offset, err, tf.Size())
+- }
+-
+- // The offset of the file.End() position, 1 byte beyond EOF,
+- // is also the size of the file.
+- offset, err = safetoken.Offset(tf, file.End())
+- if err != nil || offset != tf.Size() {
+- t.Errorf("Offset(ast.File.End()) = (%d, %v), want token.File.Size %d", offset, err, tf.Size())
+- }
+-
+- if got, want := safetoken.Position(tf, file.End()).String(), "a.go:1:35"; got != want {
+- t.Errorf("Position(ast.File.End()) = %s, want %s", got, want)
+- }
+-
+- if got, want := safetoken.EndPosition(fset, file.End()).String(), "a.go:1:35"; got != want {
+- t.Errorf("EndPosition(ast.File.End()) = %s, want %s", got, want)
+- }
+-
+- // Note that calling StartPosition on an end may yield the wrong file:
+- if got, want := safetoken.StartPosition(fset, file.End()).String(), "b.go:1:1"; got != want {
+- t.Errorf("StartPosition(ast.File.End()) = %s, want %s", got, want)
+- }
+-}
+-
+-// To reduce the risk of panic, or bugs for which this package
+-// provides a workaround, this test statically reports references to
+-// forbidden methods of token.File or FileSet throughout gopls and
+-// suggests alternatives.
+-func TestGoplsSourceDoesNotCallTokenFileMethods(t *testing.T) {
+- testenv.NeedsGoPackages(t)
+-
+- pkgs, err := packages.Load(&packages.Config{
+- Mode: packages.NeedName | packages.NeedModule | packages.NeedCompiledGoFiles | packages.NeedTypes | packages.NeedTypesInfo | packages.NeedSyntax | packages.NeedImports | packages.NeedDeps,
+- }, "go/token", "golang.org/x/tools/gopls/...")
+- if err != nil {
+- t.Fatal(err)
+- }
+- var tokenPkg *packages.Package
+- for _, pkg := range pkgs {
+- if pkg.PkgPath == "go/token" {
+- tokenPkg = pkg
+- break
+- }
+- }
+- if tokenPkg == nil {
+- t.Fatal("missing package go/token")
+- }
+-
+- File := tokenPkg.Types.Scope().Lookup("File")
+- FileSet := tokenPkg.Types.Scope().Lookup("FileSet")
+-
+- alternative := make(map[types.Object]string)
+- setAlternative := func(recv types.Object, old, new string) {
+- oldMethod, _, _ := types.LookupFieldOrMethod(recv.Type(), true, recv.Pkg(), old)
+- alternative[oldMethod] = new
+- }
+- setAlternative(File, "Offset", "safetoken.Offset")
+- setAlternative(File, "Position", "safetoken.Position")
+- setAlternative(File, "PositionFor", "safetoken.Position")
+- setAlternative(FileSet, "Position", "safetoken.StartPosition or EndPosition")
+- setAlternative(FileSet, "PositionFor", "safetoken.StartPosition or EndPosition")
+-
+- for _, pkg := range pkgs {
+- switch pkg.PkgPath {
+- case "go/token", "golang.org/x/tools/gopls/internal/lsp/safetoken":
+- continue // allow calls within these packages
+- }
+-
+- for ident, obj := range pkg.TypesInfo.Uses {
+- if alt, ok := alternative[obj]; ok {
+- posn := safetoken.StartPosition(pkg.Fset, ident.Pos())
+- fmt.Fprintf(os.Stderr, "%s: forbidden use of %v; use %s instead.\n", posn, obj, alt)
+- t.Fail()
+- }
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/selection_range.go b/gopls/internal/lsp/selection_range.go
+--- a/gopls/internal/lsp/selection_range.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/selection_range.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,69 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-// selectionRange defines the textDocument/selectionRange feature,
+-// which, given a list of positions within a file,
+-// reports a linked list of enclosing syntactic blocks, innermost first.
+-//
+-// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_selectionRange.
+-//
+-// This feature can be used by a client to implement "expand selection" in a
+-// language-aware fashion. Multiple input positions are supported to allow
+-// for multiple cursors, and the entire path up to the whole document is
+-// returned for each cursor to avoid multiple round-trips when the user is
+-// likely to issue this command multiple times in quick succession.
+-func (s *Server) selectionRange(ctx context.Context, params *protocol.SelectionRangeParams) ([]protocol.SelectionRange, error) {
+- ctx, done := event.Start(ctx, "lsp.Server.documentSymbol")
+- defer done()
+-
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.UnknownKind)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+-
+- pgf, err := snapshot.ParseGo(ctx, fh, source.ParseFull)
+- if err != nil {
+- return nil, err
+- }
+-
+- result := make([]protocol.SelectionRange, len(params.Positions))
+- for i, protocolPos := range params.Positions {
+- pos, err := pgf.PositionPos(protocolPos)
+- if err != nil {
+- return nil, err
+- }
+-
+- path, _ := astutil.PathEnclosingInterval(pgf.File, pos, pos)
+-
+- tail := &result[i] // tail of the Parent linked list, built head first
+-
+- for j, node := range path {
+- rng, err := pgf.NodeRange(node)
+- if err != nil {
+- return nil, err
+- }
+-
+- // Add node to tail.
+- if j > 0 {
+- tail.Parent = &protocol.SelectionRange{}
+- tail = tail.Parent
+- }
+- tail.Range = rng
+- }
+- }
+-
+- return result, nil
+-}
+diff -urN a/gopls/internal/lsp/semantic.go b/gopls/internal/lsp/semantic.go
+--- a/gopls/internal/lsp/semantic.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/semantic.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1003 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "bytes"
+- "context"
+- "errors"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "log"
+- "path/filepath"
+- "sort"
+- "strings"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/template"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-// The LSP says that errors for the semantic token requests should only be returned
+-// for exceptions (a word not otherwise defined). This code treats a too-large file
+-// as an exception. On parse errors, the code does what it can.
+-
+-// reject full semantic token requests for large files
+-const maxFullFileSize int = 100000
+-
+-// to control comprehensive logging of decisions (gopls semtok foo.go > /dev/null shows log output)
+-// semDebug should NEVER be true in checked-in code
+-const semDebug = false
+-
+-func (s *Server) semanticTokensFull(ctx context.Context, p *protocol.SemanticTokensParams) (*protocol.SemanticTokens, error) {
+- ret, err := s.computeSemanticTokens(ctx, p.TextDocument, nil)
+- return ret, err
+-}
+-
+-func (s *Server) semanticTokensFullDelta(ctx context.Context, p *protocol.SemanticTokensDeltaParams) (interface{}, error) {
+- return nil, fmt.Errorf("implement SemanticTokensFullDelta")
+-}
+-
+-func (s *Server) semanticTokensRange(ctx context.Context, p *protocol.SemanticTokensRangeParams) (*protocol.SemanticTokens, error) {
+- ret, err := s.computeSemanticTokens(ctx, p.TextDocument, &p.Range)
+- return ret, err
+-}
+-
+-func (s *Server) semanticTokensRefresh(ctx context.Context) error {
+- // in the code, but not in the protocol spec
+- return fmt.Errorf("implement SemanticTokensRefresh")
+-}
+-
+-func (s *Server) computeSemanticTokens(ctx context.Context, td protocol.TextDocumentIdentifier, rng *protocol.Range) (*protocol.SemanticTokens, error) {
+- ans := protocol.SemanticTokens{
+- Data: []uint32{},
+- }
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, td.URI, source.UnknownKind)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+- vv := snapshot.View()
+- if !vv.Options().SemanticTokens {
+- // return an error, so if the option changes
+- // the client won't remember the wrong answer
+- return nil, fmt.Errorf("semantictokens are disabled")
+- }
+- kind := snapshot.View().FileKind(fh)
+- if kind == source.Tmpl {
+- // this is a little cumbersome to avoid both exporting 'encoded' and its methods
+- // and to avoid import cycles
+- e := &encoded{
+- ctx: ctx,
+- metadataSource: snapshot,
+- rng: rng,
+- tokTypes: s.session.Options().SemanticTypes,
+- tokMods: s.session.Options().SemanticMods,
+- }
+- add := func(line, start uint32, len uint32) {
+- e.add(line, start, len, tokMacro, nil)
+- }
+- data := func() []uint32 {
+- return e.Data()
+- }
+- return template.SemanticTokens(ctx, snapshot, fh.URI(), add, data)
+- }
+- if kind != source.Go {
+- return nil, nil
+- }
+- pkg, pgf, err := source.PackageForFile(ctx, snapshot, fh.URI(), source.NarrowestPackage)
+- if err != nil {
+- return nil, err
+- }
+-
+- if rng == nil && len(pgf.Src) > maxFullFileSize {
+- err := fmt.Errorf("semantic tokens: file %s too large for full (%d>%d)",
+- fh.URI().Filename(), len(pgf.Src), maxFullFileSize)
+- return nil, err
+- }
+- e := &encoded{
+- ctx: ctx,
+- metadataSource: snapshot,
+- pgf: pgf,
+- rng: rng,
+- ti: pkg.GetTypesInfo(),
+- pkg: pkg,
+- fset: pkg.FileSet(),
+- tokTypes: s.session.Options().SemanticTypes,
+- tokMods: s.session.Options().SemanticMods,
+- noStrings: vv.Options().NoSemanticString,
+- noNumbers: vv.Options().NoSemanticNumber,
+- }
+- if err := e.init(); err != nil {
+- // e.init should never return an error, unless there's some
+- // seemingly impossible race condition
+- return nil, err
+- }
+- e.semantics()
+- ans.Data = e.Data()
+- // For delta requests, but we've never seen any.
+- ans.ResultID = fmt.Sprintf("%v", time.Now())
+- return &ans, nil
+-}
+-
+-func (e *encoded) semantics() {
+- f := e.pgf.File
+- // may not be in range, but harmless
+- e.token(f.Package, len("package"), tokKeyword, nil)
+- e.token(f.Name.NamePos, len(f.Name.Name), tokNamespace, nil)
+- inspect := func(n ast.Node) bool {
+- return e.inspector(n)
+- }
+- for _, d := range f.Decls {
+- // only look at the decls that overlap the range
+- start, end := d.Pos(), d.End()
+- if end <= e.start || start >= e.end {
+- continue
+- }
+- ast.Inspect(d, inspect)
+- }
+- for _, cg := range f.Comments {
+- for _, c := range cg.List {
+- if !strings.Contains(c.Text, "\n") {
+- e.token(c.Pos(), len(c.Text), tokComment, nil)
+- continue
+- }
+- e.multiline(c.Pos(), c.End(), c.Text, tokComment)
+- }
+- }
+-}
+-
+-type tokenType string
+-
+-const (
+- tokNamespace tokenType = "namespace"
+- tokType tokenType = "type"
+- tokInterface tokenType = "interface"
+- tokTypeParam tokenType = "typeParameter"
+- tokParameter tokenType = "parameter"
+- tokVariable tokenType = "variable"
+- tokMethod tokenType = "method"
+- tokFunction tokenType = "function"
+- tokKeyword tokenType = "keyword"
+- tokComment tokenType = "comment"
+- tokString tokenType = "string"
+- tokNumber tokenType = "number"
+- tokOperator tokenType = "operator"
+-
+- tokMacro tokenType = "macro" // for templates
+-)
+-
+-func (e *encoded) token(start token.Pos, leng int, typ tokenType, mods []string) {
+- if !start.IsValid() {
+- // This is not worth reporting. TODO(pjw): does it still happen?
+- return
+- }
+- if start >= e.end || start+token.Pos(leng) <= e.start {
+- return
+- }
+- // want a line and column from start (in LSP coordinates). Ignore line directives.
+- lspRange, err := e.pgf.PosRange(start, start+token.Pos(leng))
+- if err != nil {
+- event.Error(e.ctx, "failed to convert to range", err)
+- return
+- }
+- if lspRange.End.Line != lspRange.Start.Line {
+- // this happens if users are typing at the end of the file, but report nothing
+- return
+- }
+- // token is all on one line
+- length := lspRange.End.Character - lspRange.Start.Character
+- e.add(lspRange.Start.Line, lspRange.Start.Character, length, typ, mods)
+-}
+-
+-func (e *encoded) add(line, start uint32, len uint32, tok tokenType, mod []string) {
+- x := semItem{line, start, len, tok, mod}
+- e.items = append(e.items, x)
+-}
+-
+-// semItem represents a token found walking the parse tree
+-type semItem struct {
+- line, start uint32
+- len uint32
+- typeStr tokenType
+- mods []string
+-}
+-
+-type encoded struct {
+- // the generated data
+- items []semItem
+-
+- noStrings bool
+- noNumbers bool
+-
+- ctx context.Context
+- // metadataSource is used to resolve imports
+- metadataSource source.MetadataSource
+- tokTypes, tokMods []string
+- pgf *source.ParsedGoFile
+- rng *protocol.Range
+- ti *types.Info
+- pkg source.Package
+- fset *token.FileSet
+- // allowed starting and ending token.Pos, set by init
+- // used to avoid looking at declarations not in range
+- start, end token.Pos
+- // path from the root of the parse tree, used for debugging
+- stack []ast.Node
+-}
+-
+-// convert the stack to a string, for debugging
+-func (e *encoded) strStack() string {
+- msg := []string{"["}
+- for i := len(e.stack) - 1; i >= 0; i-- {
+- s := e.stack[i]
+- msg = append(msg, fmt.Sprintf("%T", s)[5:])
+- }
+- if len(e.stack) > 0 {
+- loc := e.stack[len(e.stack)-1].Pos()
+- if _, err := safetoken.Offset(e.pgf.Tok, loc); err != nil {
+- msg = append(msg, fmt.Sprintf("invalid position %v for %s", loc, e.pgf.URI))
+- } else {
+- add := safetoken.Position(e.pgf.Tok, loc)
+- nm := filepath.Base(add.Filename)
+- msg = append(msg, fmt.Sprintf("(%s:%d,col:%d)", nm, add.Line, add.Column))
+- }
+- }
+- msg = append(msg, "]")
+- return strings.Join(msg, " ")
+-}
+-
+-// find the line in the source
+-func (e *encoded) srcLine(x ast.Node) string {
+- file := e.pgf.Tok
+- line := file.Line(x.Pos())
+- start, err := safetoken.Offset(file, file.LineStart(line))
+- if err != nil {
+- return ""
+- }
+- end := start
+- for ; end < len(e.pgf.Src) && e.pgf.Src[end] != '\n'; end++ {
+-
+- }
+- ans := e.pgf.Src[start:end]
+- return string(ans)
+-}
+-
+-func (e *encoded) inspector(n ast.Node) bool {
+- pop := func() {
+- e.stack = e.stack[:len(e.stack)-1]
+- }
+- if n == nil {
+- pop()
+- return true
+- }
+- e.stack = append(e.stack, n)
+- switch x := n.(type) {
+- case *ast.ArrayType:
+- case *ast.AssignStmt:
+- e.token(x.TokPos, len(x.Tok.String()), tokOperator, nil)
+- case *ast.BasicLit:
+- if strings.Contains(x.Value, "\n") {
+- // has to be a string.
+- e.multiline(x.Pos(), x.End(), x.Value, tokString)
+- break
+- }
+- ln := len(x.Value)
+- what := tokNumber
+- if x.Kind == token.STRING {
+- what = tokString
+- }
+- e.token(x.Pos(), ln, what, nil)
+- case *ast.BinaryExpr:
+- e.token(x.OpPos, len(x.Op.String()), tokOperator, nil)
+- case *ast.BlockStmt:
+- case *ast.BranchStmt:
+- e.token(x.TokPos, len(x.Tok.String()), tokKeyword, nil)
+- // There's no semantic encoding for labels
+- case *ast.CallExpr:
+- if x.Ellipsis != token.NoPos {
+- e.token(x.Ellipsis, len("..."), tokOperator, nil)
+- }
+- case *ast.CaseClause:
+- iam := "case"
+- if x.List == nil {
+- iam = "default"
+- }
+- e.token(x.Case, len(iam), tokKeyword, nil)
+- case *ast.ChanType:
+- // chan | chan <- | <- chan
+- switch {
+- case x.Arrow == token.NoPos:
+- e.token(x.Begin, len("chan"), tokKeyword, nil)
+- case x.Arrow == x.Begin:
+- e.token(x.Arrow, 2, tokOperator, nil)
+- pos := e.findKeyword("chan", x.Begin+2, x.Value.Pos())
+- e.token(pos, len("chan"), tokKeyword, nil)
+- case x.Arrow != x.Begin:
+- e.token(x.Begin, len("chan"), tokKeyword, nil)
+- e.token(x.Arrow, 2, tokOperator, nil)
+- }
+- case *ast.CommClause:
+- iam := len("case")
+- if x.Comm == nil {
+- iam = len("default")
+- }
+- e.token(x.Case, iam, tokKeyword, nil)
+- case *ast.CompositeLit:
+- case *ast.DeclStmt:
+- case *ast.DeferStmt:
+- e.token(x.Defer, len("defer"), tokKeyword, nil)
+- case *ast.Ellipsis:
+- e.token(x.Ellipsis, len("..."), tokOperator, nil)
+- case *ast.EmptyStmt:
+- case *ast.ExprStmt:
+- case *ast.Field:
+- case *ast.FieldList:
+- case *ast.ForStmt:
+- e.token(x.For, len("for"), tokKeyword, nil)
+- case *ast.FuncDecl:
+- case *ast.FuncLit:
+- case *ast.FuncType:
+- if x.Func != token.NoPos {
+- e.token(x.Func, len("func"), tokKeyword, nil)
+- }
+- case *ast.GenDecl:
+- e.token(x.TokPos, len(x.Tok.String()), tokKeyword, nil)
+- case *ast.GoStmt:
+- e.token(x.Go, len("go"), tokKeyword, nil)
+- case *ast.Ident:
+- e.ident(x)
+- case *ast.IfStmt:
+- e.token(x.If, len("if"), tokKeyword, nil)
+- if x.Else != nil {
+- // x.Body.End() or x.Body.End()+1, not that it matters
+- pos := e.findKeyword("else", x.Body.End(), x.Else.Pos())
+- e.token(pos, len("else"), tokKeyword, nil)
+- }
+- case *ast.ImportSpec:
+- e.importSpec(x)
+- pop()
+- return false
+- case *ast.IncDecStmt:
+- e.token(x.TokPos, len(x.Tok.String()), tokOperator, nil)
+- case *ast.IndexExpr:
+- case *typeparams.IndexListExpr:
+- case *ast.InterfaceType:
+- e.token(x.Interface, len("interface"), tokKeyword, nil)
+- case *ast.KeyValueExpr:
+- case *ast.LabeledStmt:
+- case *ast.MapType:
+- e.token(x.Map, len("map"), tokKeyword, nil)
+- case *ast.ParenExpr:
+- case *ast.RangeStmt:
+- e.token(x.For, len("for"), tokKeyword, nil)
+- // x.TokPos == token.NoPos is legal (for range foo {})
+- offset := x.TokPos
+- if offset == token.NoPos {
+- offset = x.For
+- }
+- pos := e.findKeyword("range", offset, x.X.Pos())
+- e.token(pos, len("range"), tokKeyword, nil)
+- case *ast.ReturnStmt:
+- e.token(x.Return, len("return"), tokKeyword, nil)
+- case *ast.SelectStmt:
+- e.token(x.Select, len("select"), tokKeyword, nil)
+- case *ast.SelectorExpr:
+- case *ast.SendStmt:
+- e.token(x.Arrow, len("<-"), tokOperator, nil)
+- case *ast.SliceExpr:
+- case *ast.StarExpr:
+- e.token(x.Star, len("*"), tokOperator, nil)
+- case *ast.StructType:
+- e.token(x.Struct, len("struct"), tokKeyword, nil)
+- case *ast.SwitchStmt:
+- e.token(x.Switch, len("switch"), tokKeyword, nil)
+- case *ast.TypeAssertExpr:
+- if x.Type == nil {
+- pos := e.findKeyword("type", x.Lparen, x.Rparen)
+- e.token(pos, len("type"), tokKeyword, nil)
+- }
+- case *ast.TypeSpec:
+- case *ast.TypeSwitchStmt:
+- e.token(x.Switch, len("switch"), tokKeyword, nil)
+- case *ast.UnaryExpr:
+- e.token(x.OpPos, len(x.Op.String()), tokOperator, nil)
+- case *ast.ValueSpec:
+- // things only seen with parsing or type errors, so ignore them
+- case *ast.BadDecl, *ast.BadExpr, *ast.BadStmt:
+- return true
+- // not going to see these
+- case *ast.File, *ast.Package:
+- e.unexpected(fmt.Sprintf("implement %T %s", x, safetoken.Position(e.pgf.Tok, x.Pos())))
+- // other things we knowingly ignore
+- case *ast.Comment, *ast.CommentGroup:
+- pop()
+- return false
+- default:
+- e.unexpected(fmt.Sprintf("failed to implement %T", x))
+- }
+- return true
+-}
+-
+-func (e *encoded) ident(x *ast.Ident) {
+- if e.ti == nil {
+- what, mods := e.unkIdent(x)
+- if what != "" {
+- e.token(x.Pos(), len(x.String()), what, mods)
+- }
+- if semDebug {
+- log.Printf(" nil %s/nil/nil %q %v %s", x.String(), what, mods, e.strStack())
+- }
+- return
+- }
+- def := e.ti.Defs[x]
+- if def != nil {
+- what, mods := e.definitionFor(x, def)
+- if what != "" {
+- e.token(x.Pos(), len(x.String()), what, mods)
+- }
+- if semDebug {
+- log.Printf(" for %s/%T/%T got %s %v (%s)", x.String(), def, def.Type(), what, mods, e.strStack())
+- }
+- return
+- }
+- use := e.ti.Uses[x]
+- tok := func(pos token.Pos, lng int, tok tokenType, mods []string) {
+- e.token(pos, lng, tok, mods)
+- q := "nil"
+- if use != nil {
+- q = fmt.Sprintf("%T", use.Type())
+- }
+- if semDebug {
+- log.Printf(" use %s/%T/%s got %s %v (%s)", x.String(), use, q, tok, mods, e.strStack())
+- }
+- }
+-
+- switch y := use.(type) {
+- case nil:
+- what, mods := e.unkIdent(x)
+- if what != "" {
+- tok(x.Pos(), len(x.String()), what, mods)
+- } else if semDebug {
+- // tok() wasn't called, so didn't log
+- log.Printf(" nil %s/%T/nil %q %v (%s)", x.String(), use, what, mods, e.strStack())
+- }
+- return
+- case *types.Builtin:
+- tok(x.NamePos, len(x.Name), tokFunction, []string{"defaultLibrary"})
+- case *types.Const:
+- mods := []string{"readonly"}
+- tt := y.Type()
+- if _, ok := tt.(*types.Basic); ok {
+- tok(x.Pos(), len(x.String()), tokVariable, mods)
+- break
+- }
+- if ttx, ok := tt.(*types.Named); ok {
+- if x.String() == "iota" {
+- e.unexpected(fmt.Sprintf("iota:%T", ttx))
+- }
+- if _, ok := ttx.Underlying().(*types.Basic); ok {
+- tok(x.Pos(), len(x.String()), tokVariable, mods)
+- break
+- }
+- e.unexpected(fmt.Sprintf("%q/%T", x.String(), tt))
+- }
+- // can this happen? Don't think so
+- e.unexpected(fmt.Sprintf("%s %T %#v", x.String(), tt, tt))
+- case *types.Func:
+- tok(x.Pos(), len(x.Name), tokFunction, nil)
+- case *types.Label:
+- // nothing to map it to
+- case *types.Nil:
+- // nil is a predeclared identifier
+- tok(x.Pos(), len("nil"), tokVariable, []string{"readonly", "defaultLibrary"})
+- case *types.PkgName:
+- tok(x.Pos(), len(x.Name), tokNamespace, nil)
+- case *types.TypeName: // could be a tokTpeParam
+- var mods []string
+- if _, ok := y.Type().(*types.Basic); ok {
+- mods = []string{"defaultLibrary"}
+- } else if _, ok := y.Type().(*typeparams.TypeParam); ok {
+- tok(x.Pos(), len(x.String()), tokTypeParam, mods)
+- break
+- }
+- tok(x.Pos(), len(x.String()), tokType, mods)
+- case *types.Var:
+- if isSignature(y) {
+- tok(x.Pos(), len(x.Name), tokFunction, nil)
+- } else if e.isParam(use.Pos()) {
+- // variable, unless use.pos is the pos of a Field in an ancestor FuncDecl
+- // or FuncLit and then it's a parameter
+- tok(x.Pos(), len(x.Name), tokParameter, nil)
+- } else {
+- tok(x.Pos(), len(x.Name), tokVariable, nil)
+- }
+-
+- default:
+- // can't happen
+- if use == nil {
+- msg := fmt.Sprintf("%#v %#v %#v", x, e.ti.Defs[x], e.ti.Uses[x])
+- e.unexpected(msg)
+- }
+- if use.Type() != nil {
+- e.unexpected(fmt.Sprintf("%s %T/%T,%#v", x.String(), use, use.Type(), use))
+- } else {
+- e.unexpected(fmt.Sprintf("%s %T", x.String(), use))
+- }
+- }
+-}
+-
+-func (e *encoded) isParam(pos token.Pos) bool {
+- for i := len(e.stack) - 1; i >= 0; i-- {
+- switch n := e.stack[i].(type) {
+- case *ast.FuncDecl:
+- for _, f := range n.Type.Params.List {
+- for _, id := range f.Names {
+- if id.Pos() == pos {
+- return true
+- }
+- }
+- }
+- case *ast.FuncLit:
+- for _, f := range n.Type.Params.List {
+- for _, id := range f.Names {
+- if id.Pos() == pos {
+- return true
+- }
+- }
+- }
+- }
+- }
+- return false
+-}
+-
+-func isSignature(use types.Object) bool {
+- if _, ok := use.(*types.Var); !ok {
+- return false
+- }
+- v := use.Type()
+- if v == nil {
+- return false
+- }
+- if _, ok := v.(*types.Signature); ok {
+- return true
+- }
+- return false
+-}
+-
+-// both e.ti.Defs and e.ti.Uses are nil. use the parse stack.
+-// a lot of these only happen when the package doesn't compile
+-// but in that case it is all best-effort from the parse tree
+-func (e *encoded) unkIdent(x *ast.Ident) (tokenType, []string) {
+- def := []string{"definition"}
+- n := len(e.stack) - 2 // parent of Ident
+- if n < 0 {
+- e.unexpected("no stack?")
+- return "", nil
+- }
+- switch nd := e.stack[n].(type) {
+- case *ast.BinaryExpr, *ast.UnaryExpr, *ast.ParenExpr, *ast.StarExpr,
+- *ast.IncDecStmt, *ast.SliceExpr, *ast.ExprStmt, *ast.IndexExpr,
+- *ast.ReturnStmt, *ast.ChanType, *ast.SendStmt,
+- *ast.ForStmt, // possibly incomplete
+- *ast.IfStmt, /* condition */
+- *ast.KeyValueExpr: // either key or value
+- return tokVariable, nil
+- case *typeparams.IndexListExpr:
+- return tokVariable, nil
+- case *ast.Ellipsis:
+- return tokType, nil
+- case *ast.CaseClause:
+- if n-2 >= 0 {
+- if _, ok := e.stack[n-2].(*ast.TypeSwitchStmt); ok {
+- return tokType, nil
+- }
+- }
+- return tokVariable, nil
+- case *ast.ArrayType:
+- if x == nd.Len {
+- // or maybe a Type Param, but we can't just from the parse tree
+- return tokVariable, nil
+- } else {
+- return tokType, nil
+- }
+- case *ast.MapType:
+- return tokType, nil
+- case *ast.CallExpr:
+- if x == nd.Fun {
+- return tokFunction, nil
+- }
+- return tokVariable, nil
+- case *ast.SwitchStmt:
+- return tokVariable, nil
+- case *ast.TypeAssertExpr:
+- if x == nd.X {
+- return tokVariable, nil
+- } else if x == nd.Type {
+- return tokType, nil
+- }
+- case *ast.ValueSpec:
+- for _, p := range nd.Names {
+- if p == x {
+- return tokVariable, def
+- }
+- }
+- for _, p := range nd.Values {
+- if p == x {
+- return tokVariable, nil
+- }
+- }
+- return tokType, nil
+- case *ast.SelectorExpr: // e.ti.Selections[nd] is nil, so no help
+- if n-1 >= 0 {
+- if ce, ok := e.stack[n-1].(*ast.CallExpr); ok {
+- // ... CallExpr SelectorExpr Ident (_.x())
+- if ce.Fun == nd && nd.Sel == x {
+- return tokFunction, nil
+- }
+- }
+- }
+- return tokVariable, nil
+- case *ast.AssignStmt:
+- for _, p := range nd.Lhs {
+- // x := ..., or x = ...
+- if p == x {
+- if nd.Tok != token.DEFINE {
+- def = nil
+- }
+- return tokVariable, def // '_' in _ = ...
+- }
+- }
+- // RHS, = x
+- return tokVariable, nil
+- case *ast.TypeSpec: // it's a type if it is either the Name or the Type
+- if x == nd.Type {
+- def = nil
+- }
+- return tokType, def
+- case *ast.Field:
+- // ident could be type in a field, or a method in an interface type, or a variable
+- if x == nd.Type {
+- return tokType, nil
+- }
+- if n-2 >= 0 {
+- _, okit := e.stack[n-2].(*ast.InterfaceType)
+- _, okfl := e.stack[n-1].(*ast.FieldList)
+- if okit && okfl {
+- return tokMethod, def
+- }
+- }
+- return tokVariable, nil
+- case *ast.LabeledStmt, *ast.BranchStmt:
+- // nothing to report
+- case *ast.CompositeLit:
+- if nd.Type == x {
+- return tokType, nil
+- }
+- return tokVariable, nil
+- case *ast.RangeStmt:
+- if nd.Tok != token.DEFINE {
+- def = nil
+- }
+- return tokVariable, def
+- case *ast.FuncDecl:
+- return tokFunction, def
+- default:
+- msg := fmt.Sprintf("%T undexpected: %s %s%q", nd, x.Name, e.strStack(), e.srcLine(x))
+- e.unexpected(msg)
+- }
+- return "", nil
+-}
+-
+-func isDeprecated(n *ast.CommentGroup) bool {
+- if n == nil {
+- return false
+- }
+- for _, c := range n.List {
+- if strings.HasPrefix(c.Text, "// Deprecated") {
+- return true
+- }
+- }
+- return false
+-}
+-
+-func (e *encoded) definitionFor(x *ast.Ident, def types.Object) (tokenType, []string) {
+- // PJW: def == types.Label? probably a nothing
+- // PJW: look into replacing these syntactic tests with types more generally
+- mods := []string{"definition"}
+- for i := len(e.stack) - 1; i >= 0; i-- {
+- s := e.stack[i]
+- switch y := s.(type) {
+- case *ast.AssignStmt, *ast.RangeStmt:
+- if x.Name == "_" {
+- return "", nil // not really a variable
+- }
+- return tokVariable, mods
+- case *ast.GenDecl:
+- if isDeprecated(y.Doc) {
+- mods = append(mods, "deprecated")
+- }
+- if y.Tok == token.CONST {
+- mods = append(mods, "readonly")
+- }
+- return tokVariable, mods
+- case *ast.FuncDecl:
+- // If x is immediately under a FuncDecl, it is a function or method
+- if i == len(e.stack)-2 {
+- if isDeprecated(y.Doc) {
+- mods = append(mods, "deprecated")
+- }
+- if y.Recv != nil {
+- return tokMethod, mods
+- }
+- return tokFunction, mods
+- }
+- // if x < ... < FieldList < FuncDecl, this is the receiver, a variable
+- // PJW: maybe not. it might be a typeparameter in the type of the receiver
+- if _, ok := e.stack[i+1].(*ast.FieldList); ok {
+- if _, ok := def.(*types.TypeName); ok {
+- return tokTypeParam, mods
+- }
+- return tokVariable, nil
+- }
+- // if x < ... < FieldList < FuncType < FuncDecl, this is a param
+- return tokParameter, mods
+- case *ast.FuncType: // is it in the TypeParams?
+- if isTypeParam(x, y) {
+- return tokTypeParam, mods
+- }
+- return tokParameter, mods
+- case *ast.InterfaceType:
+- return tokMethod, mods
+- case *ast.TypeSpec:
+- // GenDecl/Typespec/FuncType/FieldList/Field/Ident
+- // (type A func(b uint64)) (err error)
+- // b and err should not be tokType, but tokVaraible
+- // and in GenDecl/TpeSpec/StructType/FieldList/Field/Ident
+- // (type A struct{b uint64}
+- // but on type B struct{C}), C is a type, but is not being defined.
+- // GenDecl/TypeSpec/FieldList/Field/Ident is a typeParam
+- if _, ok := e.stack[i+1].(*ast.FieldList); ok {
+- return tokTypeParam, mods
+- }
+- fldm := e.stack[len(e.stack)-2]
+- if fld, ok := fldm.(*ast.Field); ok {
+- // if len(fld.names) == 0 this is a tokType, being used
+- if len(fld.Names) == 0 {
+- return tokType, nil
+- }
+- return tokVariable, mods
+- }
+- return tokType, mods
+- }
+- }
+- // can't happen
+- msg := fmt.Sprintf("failed to find the decl for %s", safetoken.Position(e.pgf.Tok, x.Pos()))
+- e.unexpected(msg)
+- return "", []string{""}
+-}
+-
+-func isTypeParam(x *ast.Ident, y *ast.FuncType) bool {
+- tp := typeparams.ForFuncType(y)
+- if tp == nil {
+- return false
+- }
+- for _, p := range tp.List {
+- for _, n := range p.Names {
+- if x == n {
+- return true
+- }
+- }
+- }
+- return false
+-}
+-
+-func (e *encoded) multiline(start, end token.Pos, val string, tok tokenType) {
+- f := e.fset.File(start)
+- // the hard part is finding the lengths of lines. include the \n
+- leng := func(line int) int {
+- n := f.LineStart(line)
+- if line >= f.LineCount() {
+- return f.Size() - int(n)
+- }
+- return int(f.LineStart(line+1) - n)
+- }
+- spos := safetoken.StartPosition(e.fset, start)
+- epos := safetoken.EndPosition(e.fset, end)
+- sline := spos.Line
+- eline := epos.Line
+- // first line is from spos.Column to end
+- e.token(start, leng(sline)-spos.Column, tok, nil) // leng(sline)-1 - (spos.Column-1)
+- for i := sline + 1; i < eline; i++ {
+- // intermediate lines are from 1 to end
+- e.token(f.LineStart(i), leng(i)-1, tok, nil) // avoid the newline
+- }
+- // last line is from 1 to epos.Column
+- e.token(f.LineStart(eline), epos.Column-1, tok, nil) // columns are 1-based
+-}
+-
+-// findKeyword finds a keyword rather than guessing its location
+-func (e *encoded) findKeyword(keyword string, start, end token.Pos) token.Pos {
+- offset := int(start) - e.pgf.Tok.Base()
+- last := int(end) - e.pgf.Tok.Base()
+- buf := e.pgf.Src
+- idx := bytes.Index(buf[offset:last], []byte(keyword))
+- if idx != -1 {
+- return start + token.Pos(idx)
+- }
+- //(in unparsable programs: type _ <-<-chan int)
+- e.unexpected(fmt.Sprintf("not found:%s %v", keyword, safetoken.StartPosition(e.fset, start)))
+- return token.NoPos
+-}
+-
+-func (e *encoded) init() error {
+- e.start = token.Pos(e.pgf.Tok.Base())
+- e.end = e.start + token.Pos(e.pgf.Tok.Size())
+- if e.rng == nil {
+- return nil
+- }
+- span, err := e.pgf.Mapper.RangeSpan(*e.rng)
+- if err != nil {
+- return fmt.Errorf("range span (%w) error for %s", err, e.pgf.File.Name)
+- }
+- e.end = e.start + token.Pos(span.End().Offset())
+- e.start += token.Pos(span.Start().Offset())
+- return nil
+-}
+-
+-func (e *encoded) Data() []uint32 {
+- // binary operators, at least, will be out of order
+- sort.Slice(e.items, func(i, j int) bool {
+- if e.items[i].line != e.items[j].line {
+- return e.items[i].line < e.items[j].line
+- }
+- return e.items[i].start < e.items[j].start
+- })
+- typeMap, modMap := e.maps()
+- // each semantic token needs five values
+- // (see Integer Encoding for Tokens in the LSP spec)
+- x := make([]uint32, 5*len(e.items))
+- var j int
+- var last semItem
+- for i := 0; i < len(e.items); i++ {
+- item := e.items[i]
+- typ, ok := typeMap[item.typeStr]
+- if !ok {
+- continue // client doesn't want typeStr
+- }
+- if item.typeStr == tokString && e.noStrings {
+- continue
+- }
+- if item.typeStr == tokNumber && e.noNumbers {
+- continue
+- }
+- if j == 0 {
+- x[0] = e.items[0].line
+- } else {
+- x[j] = item.line - last.line
+- }
+- x[j+1] = item.start
+- if j > 0 && x[j] == 0 {
+- x[j+1] = item.start - last.start
+- }
+- x[j+2] = item.len
+- x[j+3] = uint32(typ)
+- mask := 0
+- for _, s := range item.mods {
+- // modMap[s] is 0 if the client doesn't want this modifier
+- mask |= modMap[s]
+- }
+- x[j+4] = uint32(mask)
+- j += 5
+- last = item
+- }
+- return x[:j]
+-}
+-
+-func (e *encoded) importSpec(d *ast.ImportSpec) {
+- // a local package name or the last component of the Path
+- if d.Name != nil {
+- nm := d.Name.String()
+- if nm != "_" && nm != "." {
+- e.token(d.Name.Pos(), len(nm), tokNamespace, nil)
+- }
+- return // don't mark anything for . or _
+- }
+- importPath := source.UnquoteImportPath(d)
+- if importPath == "" {
+- return
+- }
+- // Import strings are implementation defined. Try to match with parse information.
+- depID := e.pkg.Metadata().DepsByImpPath[importPath]
+- if depID == "" {
+- return
+- }
+- depMD := e.metadataSource.Metadata(depID)
+- if depMD == nil {
+- // unexpected, but impact is that maybe some import is not colored
+- return
+- }
+- // Check whether the original literal contains the package's declared name.
+- j := strings.LastIndex(d.Path.Value, string(depMD.Name))
+- if j == -1 {
+- // Package name does not match import path, so there is nothing to report.
+- return
+- }
+- // Report virtual declaration at the position of the substring.
+- start := d.Path.Pos() + token.Pos(j)
+- e.token(start, len(depMD.Name), tokNamespace, nil)
+-}
+-
+-// log unexpected state
+-func (e *encoded) unexpected(msg string) {
+- if semDebug {
+- panic(msg)
+- }
+- event.Error(e.ctx, e.strStack(), errors.New(msg))
+-}
+-
+-// SemType returns a string equivalent of the type, for gopls semtok
+-func SemType(n int) string {
+- tokTypes := SemanticTypes()
+- tokMods := SemanticModifiers()
+- if n >= 0 && n < len(tokTypes) {
+- return tokTypes[n]
+- }
+- // not found for some reason
+- return fmt.Sprintf("?%d[%d,%d]?", n, len(tokTypes), len(tokMods))
+-}
+-
+-// SemMods returns the []string equivalent of the mods, for gopls semtok.
+-func SemMods(n int) []string {
+- tokMods := SemanticModifiers()
+- mods := []string{}
+- for i := 0; i < len(tokMods); i++ {
+- if (n & (1 << uint(i))) != 0 {
+- mods = append(mods, tokMods[i])
+- }
+- }
+- return mods
+-}
+-
+-func (e *encoded) maps() (map[tokenType]int, map[string]int) {
+- tmap := make(map[tokenType]int)
+- mmap := make(map[string]int)
+- for i, t := range e.tokTypes {
+- tmap[tokenType(t)] = i
+- }
+- for i, m := range e.tokMods {
+- mmap[m] = 1 << uint(i) // go 1.12 compatibility
+- }
+- return tmap, mmap
+-}
+-
+-// SemanticTypes to use in case there is no client, as in the command line, or tests
+-func SemanticTypes() []string {
+- return semanticTypes[:]
+-}
+-
+-// SemanticModifiers to use in case there is no client.
+-func SemanticModifiers() []string {
+- return semanticModifiers[:]
+-}
+-
+-var (
+- semanticTypes = [...]string{
+- "namespace", "type", "class", "enum", "interface",
+- "struct", "typeParameter", "parameter", "variable", "property", "enumMember",
+- "event", "function", "method", "macro", "keyword", "modifier", "comment",
+- "string", "number", "regexp", "operator",
+- }
+- semanticModifiers = [...]string{
+- "declaration", "definition", "readonly", "static",
+- "deprecated", "abstract", "async", "modification", "documentation", "defaultLibrary",
+- }
+-)
+diff -urN a/gopls/internal/lsp/server_gen.go b/gopls/internal/lsp/server_gen.go
+--- a/gopls/internal/lsp/server_gen.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/server_gen.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,301 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-// code generated by helper. DO NOT EDIT.
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-func (s *Server) CodeAction(ctx context.Context, params *protocol.CodeActionParams) ([]protocol.CodeAction, error) {
+- return s.codeAction(ctx, params)
+-}
+-
+-func (s *Server) CodeLens(ctx context.Context, params *protocol.CodeLensParams) ([]protocol.CodeLens, error) {
+- return s.codeLens(ctx, params)
+-}
+-
+-func (s *Server) ColorPresentation(context.Context, *protocol.ColorPresentationParams) ([]protocol.ColorPresentation, error) {
+- return nil, notImplemented("ColorPresentation")
+-}
+-
+-func (s *Server) Completion(ctx context.Context, params *protocol.CompletionParams) (*protocol.CompletionList, error) {
+- return s.completion(ctx, params)
+-}
+-
+-func (s *Server) Declaration(context.Context, *protocol.DeclarationParams) (*protocol.Or_textDocument_declaration, error) {
+- return nil, notImplemented("Declaration")
+-}
+-
+-func (s *Server) Definition(ctx context.Context, params *protocol.DefinitionParams) ([]protocol.Location, error) {
+- return s.definition(ctx, params)
+-}
+-
+-func (s *Server) Diagnostic(context.Context, *string) (*string, error) {
+- return nil, notImplemented("Diagnostic")
+-}
+-
+-func (s *Server) DiagnosticWorkspace(context.Context, *protocol.WorkspaceDiagnosticParams) (*protocol.WorkspaceDiagnosticReport, error) {
+- return nil, notImplemented("DiagnosticWorkspace")
+-}
+-
+-func (s *Server) DidChange(ctx context.Context, params *protocol.DidChangeTextDocumentParams) error {
+- return s.didChange(ctx, params)
+-}
+-
+-func (s *Server) DidChangeConfiguration(ctx context.Context, _gen *protocol.DidChangeConfigurationParams) error {
+- return s.didChangeConfiguration(ctx, _gen)
+-}
+-
+-func (s *Server) DidChangeNotebookDocument(context.Context, *protocol.DidChangeNotebookDocumentParams) error {
+- return notImplemented("DidChangeNotebookDocument")
+-}
+-
+-func (s *Server) DidChangeWatchedFiles(ctx context.Context, params *protocol.DidChangeWatchedFilesParams) error {
+- return s.didChangeWatchedFiles(ctx, params)
+-}
+-
+-func (s *Server) DidChangeWorkspaceFolders(ctx context.Context, params *protocol.DidChangeWorkspaceFoldersParams) error {
+- return s.didChangeWorkspaceFolders(ctx, params)
+-}
+-
+-func (s *Server) DidClose(ctx context.Context, params *protocol.DidCloseTextDocumentParams) error {
+- return s.didClose(ctx, params)
+-}
+-
+-func (s *Server) DidCloseNotebookDocument(context.Context, *protocol.DidCloseNotebookDocumentParams) error {
+- return notImplemented("DidCloseNotebookDocument")
+-}
+-
+-func (s *Server) DidCreateFiles(context.Context, *protocol.CreateFilesParams) error {
+- return notImplemented("DidCreateFiles")
+-}
+-
+-func (s *Server) DidDeleteFiles(context.Context, *protocol.DeleteFilesParams) error {
+- return notImplemented("DidDeleteFiles")
+-}
+-
+-func (s *Server) DidOpen(ctx context.Context, params *protocol.DidOpenTextDocumentParams) error {
+- return s.didOpen(ctx, params)
+-}
+-
+-func (s *Server) DidOpenNotebookDocument(context.Context, *protocol.DidOpenNotebookDocumentParams) error {
+- return notImplemented("DidOpenNotebookDocument")
+-}
+-
+-func (s *Server) DidRenameFiles(context.Context, *protocol.RenameFilesParams) error {
+- return notImplemented("DidRenameFiles")
+-}
+-
+-func (s *Server) DidSave(ctx context.Context, params *protocol.DidSaveTextDocumentParams) error {
+- return s.didSave(ctx, params)
+-}
+-
+-func (s *Server) DidSaveNotebookDocument(context.Context, *protocol.DidSaveNotebookDocumentParams) error {
+- return notImplemented("DidSaveNotebookDocument")
+-}
+-
+-func (s *Server) DocumentColor(context.Context, *protocol.DocumentColorParams) ([]protocol.ColorInformation, error) {
+- return nil, notImplemented("DocumentColor")
+-}
+-
+-func (s *Server) DocumentHighlight(ctx context.Context, params *protocol.DocumentHighlightParams) ([]protocol.DocumentHighlight, error) {
+- return s.documentHighlight(ctx, params)
+-}
+-
+-func (s *Server) DocumentLink(ctx context.Context, params *protocol.DocumentLinkParams) ([]protocol.DocumentLink, error) {
+- return s.documentLink(ctx, params)
+-}
+-
+-func (s *Server) DocumentSymbol(ctx context.Context, params *protocol.DocumentSymbolParams) ([]interface{}, error) {
+- return s.documentSymbol(ctx, params)
+-}
+-
+-func (s *Server) ExecuteCommand(ctx context.Context, params *protocol.ExecuteCommandParams) (interface{}, error) {
+- return s.executeCommand(ctx, params)
+-}
+-
+-func (s *Server) Exit(ctx context.Context) error {
+- return s.exit(ctx)
+-}
+-
+-func (s *Server) FoldingRange(ctx context.Context, params *protocol.FoldingRangeParams) ([]protocol.FoldingRange, error) {
+- return s.foldingRange(ctx, params)
+-}
+-
+-func (s *Server) Formatting(ctx context.Context, params *protocol.DocumentFormattingParams) ([]protocol.TextEdit, error) {
+- return s.formatting(ctx, params)
+-}
+-
+-func (s *Server) Hover(ctx context.Context, params *protocol.HoverParams) (*protocol.Hover, error) {
+- return s.hover(ctx, params)
+-}
+-
+-func (s *Server) Implementation(ctx context.Context, params *protocol.ImplementationParams) ([]protocol.Location, error) {
+- return s.implementation(ctx, params)
+-}
+-
+-func (s *Server) IncomingCalls(ctx context.Context, params *protocol.CallHierarchyIncomingCallsParams) ([]protocol.CallHierarchyIncomingCall, error) {
+- return s.incomingCalls(ctx, params)
+-}
+-
+-func (s *Server) Initialize(ctx context.Context, params *protocol.ParamInitialize) (*protocol.InitializeResult, error) {
+- return s.initialize(ctx, params)
+-}
+-
+-func (s *Server) Initialized(ctx context.Context, params *protocol.InitializedParams) error {
+- return s.initialized(ctx, params)
+-}
+-
+-func (s *Server) InlayHint(ctx context.Context, params *protocol.InlayHintParams) ([]protocol.InlayHint, error) {
+- return s.inlayHint(ctx, params)
+-}
+-
+-func (s *Server) InlineValue(context.Context, *protocol.InlineValueParams) ([]protocol.InlineValue, error) {
+- return nil, notImplemented("InlineValue")
+-}
+-
+-func (s *Server) LinkedEditingRange(context.Context, *protocol.LinkedEditingRangeParams) (*protocol.LinkedEditingRanges, error) {
+- return nil, notImplemented("LinkedEditingRange")
+-}
+-
+-func (s *Server) Moniker(context.Context, *protocol.MonikerParams) ([]protocol.Moniker, error) {
+- return nil, notImplemented("Moniker")
+-}
+-
+-func (s *Server) NonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error) {
+- return s.nonstandardRequest(ctx, method, params)
+-}
+-
+-func (s *Server) OnTypeFormatting(context.Context, *protocol.DocumentOnTypeFormattingParams) ([]protocol.TextEdit, error) {
+- return nil, notImplemented("OnTypeFormatting")
+-}
+-
+-func (s *Server) OutgoingCalls(ctx context.Context, params *protocol.CallHierarchyOutgoingCallsParams) ([]protocol.CallHierarchyOutgoingCall, error) {
+- return s.outgoingCalls(ctx, params)
+-}
+-
+-func (s *Server) PrepareCallHierarchy(ctx context.Context, params *protocol.CallHierarchyPrepareParams) ([]protocol.CallHierarchyItem, error) {
+- return s.prepareCallHierarchy(ctx, params)
+-}
+-
+-func (s *Server) PrepareRename(ctx context.Context, params *protocol.PrepareRenameParams) (*protocol.PrepareRename2Gn, error) {
+- return s.prepareRename(ctx, params)
+-}
+-
+-func (s *Server) PrepareTypeHierarchy(context.Context, *protocol.TypeHierarchyPrepareParams) ([]protocol.TypeHierarchyItem, error) {
+- return nil, notImplemented("PrepareTypeHierarchy")
+-}
+-
+-func (s *Server) Progress(context.Context, *protocol.ProgressParams) error {
+- return notImplemented("Progress")
+-}
+-
+-func (s *Server) RangeFormatting(context.Context, *protocol.DocumentRangeFormattingParams) ([]protocol.TextEdit, error) {
+- return nil, notImplemented("RangeFormatting")
+-}
+-
+-func (s *Server) References(ctx context.Context, params *protocol.ReferenceParams) ([]protocol.Location, error) {
+- return s.references(ctx, params)
+-}
+-
+-func (s *Server) Rename(ctx context.Context, params *protocol.RenameParams) (*protocol.WorkspaceEdit, error) {
+- return s.rename(ctx, params)
+-}
+-
+-func (s *Server) Resolve(context.Context, *protocol.InlayHint) (*protocol.InlayHint, error) {
+- return nil, notImplemented("Resolve")
+-}
+-
+-func (s *Server) ResolveCodeAction(context.Context, *protocol.CodeAction) (*protocol.CodeAction, error) {
+- return nil, notImplemented("ResolveCodeAction")
+-}
+-
+-func (s *Server) ResolveCodeLens(context.Context, *protocol.CodeLens) (*protocol.CodeLens, error) {
+- return nil, notImplemented("ResolveCodeLens")
+-}
+-
+-func (s *Server) ResolveCompletionItem(context.Context, *protocol.CompletionItem) (*protocol.CompletionItem, error) {
+- return nil, notImplemented("ResolveCompletionItem")
+-}
+-
+-func (s *Server) ResolveDocumentLink(context.Context, *protocol.DocumentLink) (*protocol.DocumentLink, error) {
+- return nil, notImplemented("ResolveDocumentLink")
+-}
+-
+-func (s *Server) ResolveWorkspaceSymbol(context.Context, *protocol.WorkspaceSymbol) (*protocol.WorkspaceSymbol, error) {
+- return nil, notImplemented("ResolveWorkspaceSymbol")
+-}
+-
+-func (s *Server) SelectionRange(ctx context.Context, params *protocol.SelectionRangeParams) ([]protocol.SelectionRange, error) {
+- return s.selectionRange(ctx, params)
+-}
+-
+-func (s *Server) SemanticTokensFull(ctx context.Context, p *protocol.SemanticTokensParams) (*protocol.SemanticTokens, error) {
+- return s.semanticTokensFull(ctx, p)
+-}
+-
+-func (s *Server) SemanticTokensFullDelta(ctx context.Context, p *protocol.SemanticTokensDeltaParams) (interface{}, error) {
+- return s.semanticTokensFullDelta(ctx, p)
+-}
+-
+-func (s *Server) SemanticTokensRange(ctx context.Context, p *protocol.SemanticTokensRangeParams) (*protocol.SemanticTokens, error) {
+- return s.semanticTokensRange(ctx, p)
+-}
+-
+-func (s *Server) SetTrace(context.Context, *protocol.SetTraceParams) error {
+- return notImplemented("SetTrace")
+-}
+-
+-func (s *Server) Shutdown(ctx context.Context) error {
+- return s.shutdown(ctx)
+-}
+-
+-func (s *Server) SignatureHelp(ctx context.Context, params *protocol.SignatureHelpParams) (*protocol.SignatureHelp, error) {
+- return s.signatureHelp(ctx, params)
+-}
+-
+-func (s *Server) Subtypes(context.Context, *protocol.TypeHierarchySubtypesParams) ([]protocol.TypeHierarchyItem, error) {
+- return nil, notImplemented("Subtypes")
+-}
+-
+-func (s *Server) Supertypes(context.Context, *protocol.TypeHierarchySupertypesParams) ([]protocol.TypeHierarchyItem, error) {
+- return nil, notImplemented("Supertypes")
+-}
+-
+-func (s *Server) Symbol(ctx context.Context, params *protocol.WorkspaceSymbolParams) ([]protocol.SymbolInformation, error) {
+- return s.symbol(ctx, params)
+-}
+-
+-func (s *Server) TypeDefinition(ctx context.Context, params *protocol.TypeDefinitionParams) ([]protocol.Location, error) {
+- return s.typeDefinition(ctx, params)
+-}
+-
+-func (s *Server) WillCreateFiles(context.Context, *protocol.CreateFilesParams) (*protocol.WorkspaceEdit, error) {
+- return nil, notImplemented("WillCreateFiles")
+-}
+-
+-func (s *Server) WillDeleteFiles(context.Context, *protocol.DeleteFilesParams) (*protocol.WorkspaceEdit, error) {
+- return nil, notImplemented("WillDeleteFiles")
+-}
+-
+-func (s *Server) WillRenameFiles(context.Context, *protocol.RenameFilesParams) (*protocol.WorkspaceEdit, error) {
+- return nil, notImplemented("WillRenameFiles")
+-}
+-
+-func (s *Server) WillSave(context.Context, *protocol.WillSaveTextDocumentParams) error {
+- return notImplemented("WillSave")
+-}
+-
+-func (s *Server) WillSaveWaitUntil(context.Context, *protocol.WillSaveTextDocumentParams) ([]protocol.TextEdit, error) {
+- return nil, notImplemented("WillSaveWaitUntil")
+-}
+-
+-func (s *Server) WorkDoneProgressCancel(ctx context.Context, params *protocol.WorkDoneProgressCancelParams) error {
+- return s.workDoneProgressCancel(ctx, params)
+-}
+diff -urN a/gopls/internal/lsp/server.go b/gopls/internal/lsp/server.go
+--- a/gopls/internal/lsp/server.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/server.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,158 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:generate go run ./helper -d protocol/tsserver.go -o server_gen.go -u .
+-
+-// Package lsp implements LSP for gopls.
+-package lsp
+-
+-import (
+- "context"
+- "fmt"
+- "sync"
+-
+- "golang.org/x/tools/gopls/internal/lsp/cache"
+- "golang.org/x/tools/gopls/internal/lsp/progress"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/jsonrpc2"
+-)
+-
+-const concurrentAnalyses = 1
+-
+-// NewServer creates an LSP server and binds it to handle incoming client
+-// messages on on the supplied stream.
+-func NewServer(session *cache.Session, client protocol.ClientCloser) *Server {
+- return &Server{
+- diagnostics: map[span.URI]*fileReports{},
+- gcOptimizationDetails: make(map[source.PackageID]struct{}),
+- watchedGlobPatterns: make(map[string]struct{}),
+- changedFiles: make(map[span.URI]struct{}),
+- session: session,
+- client: client,
+- diagnosticsSema: make(chan struct{}, concurrentAnalyses),
+- progress: progress.NewTracker(client),
+- diagDebouncer: newDebouncer(),
+- }
+-}
+-
+-type serverState int
+-
+-const (
+- serverCreated = serverState(iota)
+- serverInitializing // set once the server has received "initialize" request
+- serverInitialized // set once the server has received "initialized" request
+- serverShutDown
+-)
+-
+-func (s serverState) String() string {
+- switch s {
+- case serverCreated:
+- return "created"
+- case serverInitializing:
+- return "initializing"
+- case serverInitialized:
+- return "initialized"
+- case serverShutDown:
+- return "shutDown"
+- }
+- return fmt.Sprintf("(unknown state: %d)", int(s))
+-}
+-
+-// Server implements the protocol.Server interface.
+-type Server struct {
+- client protocol.ClientCloser
+-
+- stateMu sync.Mutex
+- state serverState
+- // notifications generated before serverInitialized
+- notifications []*protocol.ShowMessageParams
+-
+- session *cache.Session
+-
+- tempDir string
+-
+- // changedFiles tracks files for which there has been a textDocument/didChange.
+- changedFilesMu sync.Mutex
+- changedFiles map[span.URI]struct{}
+-
+- // folders is only valid between initialize and initialized, and holds the
+- // set of folders to build views for when we are ready
+- pendingFolders []protocol.WorkspaceFolder
+-
+- // watchedGlobPatterns is the set of glob patterns that we have requested
+- // the client watch on disk. It will be updated as the set of directories
+- // that the server should watch changes.
+- watchedGlobPatternsMu sync.Mutex
+- watchedGlobPatterns map[string]struct{}
+- watchRegistrationCount int
+-
+- diagnosticsMu sync.Mutex
+- diagnostics map[span.URI]*fileReports
+-
+- // gcOptimizationDetails describes the packages for which we want
+- // optimization details to be included in the diagnostics. The key is the
+- // ID of the package.
+- gcOptimizationDetailsMu sync.Mutex
+- gcOptimizationDetails map[source.PackageID]struct{}
+-
+- // diagnosticsSema limits the concurrency of diagnostics runs, which can be
+- // expensive.
+- diagnosticsSema chan struct{}
+-
+- progress *progress.Tracker
+-
+- // diagDebouncer is used for debouncing diagnostics.
+- diagDebouncer *debouncer
+-
+- // When the workspace fails to load, we show its status through a progress
+- // report with an error message.
+- criticalErrorStatusMu sync.Mutex
+- criticalErrorStatus *progress.WorkDone
+-}
+-
+-func (s *Server) workDoneProgressCancel(ctx context.Context, params *protocol.WorkDoneProgressCancelParams) error {
+- return s.progress.Cancel(params.Token)
+-}
+-
+-func (s *Server) nonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error) {
+- switch method {
+- case "gopls/diagnoseFiles":
+- paramMap := params.(map[string]interface{})
+- // TODO(adonovan): opt: parallelize FileDiagnostics(URI...), either
+- // by calling it in multiple goroutines or, better, by making
+- // the relevant APIs accept a set of URIs/packages.
+- for _, file := range paramMap["files"].([]interface{}) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, protocol.DocumentURI(file.(string)), source.UnknownKind)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+-
+- fileID, diagnostics, err := source.FileDiagnostics(ctx, snapshot, fh.URI())
+- if err != nil {
+- return nil, err
+- }
+- if err := s.client.PublishDiagnostics(ctx, &protocol.PublishDiagnosticsParams{
+- URI: protocol.URIFromSpanURI(fh.URI()),
+- Diagnostics: toProtocolDiagnostics(diagnostics),
+- Version: fileID.Version(),
+- }); err != nil {
+- return nil, err
+- }
+- }
+- if err := s.client.PublishDiagnostics(ctx, &protocol.PublishDiagnosticsParams{
+- URI: "gopls://diagnostics-done",
+- }); err != nil {
+- return nil, err
+- }
+- return struct{}{}, nil
+- }
+- return nil, notImplemented(method)
+-}
+-
+-func notImplemented(method string) error {
+- return fmt.Errorf("%w: %q not yet implemented", jsonrpc2.ErrMethodNotFound, method)
+-}
+diff -urN a/gopls/internal/lsp/signature_help.go b/gopls/internal/lsp/signature_help.go
+--- a/gopls/internal/lsp/signature_help.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/signature_help.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,31 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+-)
+-
+-func (s *Server) signatureHelp(ctx context.Context, params *protocol.SignatureHelpParams) (*protocol.SignatureHelp, error) {
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.Go)
+- defer release()
+- if !ok {
+- return nil, err
+- }
+- info, activeParameter, err := source.SignatureHelp(ctx, snapshot, fh, params.Position)
+- if err != nil {
+- event.Error(ctx, "no signature help", err, tag.Position.Of(params.Position))
+- return nil, nil // sic? There could be many reasons for failure.
+- }
+- return &protocol.SignatureHelp{
+- Signatures: []protocol.SignatureInformation{*info},
+- ActiveParameter: uint32(activeParameter),
+- }, nil
+-}
+diff -urN a/gopls/internal/lsp/snippet/snippet_builder.go b/gopls/internal/lsp/snippet/snippet_builder.go
+--- a/gopls/internal/lsp/snippet/snippet_builder.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/snippet/snippet_builder.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,111 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package snippet implements the specification for the LSP snippet format.
+-//
+-// Snippets are "tab stop" templates returned as an optional attribute of LSP
+-// completion candidates. As the user presses tab, they cycle through a series of
+-// tab stops defined in the snippet. Each tab stop can optionally have placeholder
+-// text, which can be pre-selected by editors. For a full description of syntax
+-// and features, see "Snippet Syntax" at
+-// https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#textDocument_completion.
+-//
+-// A typical snippet looks like "foo(${1:i int}, ${2:s string})".
+-package snippet
+-
+-import (
+- "fmt"
+- "strings"
+-)
+-
+-// A Builder is used to build an LSP snippet piecemeal.
+-// The zero value is ready to use. Do not copy a non-zero Builder.
+-type Builder struct {
+- // currentTabStop is the index of the previous tab stop. The
+- // next tab stop will be currentTabStop+1.
+- currentTabStop int
+- sb strings.Builder
+-}
+-
+-// Escape characters defined in https://microsoft.github.io/language-server-protocol/specifications/specification-3-14/#textDocument_completion under "Grammar".
+-var replacer = strings.NewReplacer(
+- `\`, `\\`,
+- `}`, `\}`,
+- `$`, `\$`,
+-)
+-
+-func (b *Builder) WriteText(s string) {
+- replacer.WriteString(&b.sb, s)
+-}
+-
+-func (b *Builder) PrependText(s string) {
+- rawSnip := b.String()
+- b.sb.Reset()
+- b.WriteText(s)
+- b.sb.WriteString(rawSnip)
+-}
+-
+-func (b *Builder) Write(data []byte) (int, error) {
+- return b.sb.Write(data)
+-}
+-
+-// WritePlaceholder writes a tab stop and placeholder value to the Builder.
+-// The callback style allows for creating nested placeholders. To write an
+-// empty tab stop, provide a nil callback.
+-func (b *Builder) WritePlaceholder(fn func(*Builder)) {
+- fmt.Fprintf(&b.sb, "${%d:", b.nextTabStop())
+- if fn != nil {
+- fn(b)
+- }
+- b.sb.WriteByte('}')
+-}
+-
+-// WriteFinalTabstop marks where cursor ends up after the user has
+-// cycled through all the normal tab stops. It defaults to the
+-// character after the snippet.
+-func (b *Builder) WriteFinalTabstop() {
+- fmt.Fprint(&b.sb, "$0")
+-}
+-
+-// In addition to '\', '}', and '$', snippet choices also use '|' and ',' as
+-// meta characters, so they must be escaped within the choices.
+-var choiceReplacer = strings.NewReplacer(
+- `\`, `\\`,
+- `}`, `\}`,
+- `$`, `\$`,
+- `|`, `\|`,
+- `,`, `\,`,
+-)
+-
+-// WriteChoice writes a tab stop and list of text choices to the Builder.
+-// The user's editor will prompt the user to choose one of the choices.
+-func (b *Builder) WriteChoice(choices []string) {
+- fmt.Fprintf(&b.sb, "${%d|", b.nextTabStop())
+- for i, c := range choices {
+- if i != 0 {
+- b.sb.WriteByte(',')
+- }
+- choiceReplacer.WriteString(&b.sb, c)
+- }
+- b.sb.WriteString("|}")
+-}
+-
+-// String returns the built snippet string.
+-func (b *Builder) String() string {
+- return b.sb.String()
+-}
+-
+-// Clone returns a copy of b.
+-func (b *Builder) Clone() *Builder {
+- var clone Builder
+- clone.sb.WriteString(b.String())
+- return &clone
+-}
+-
+-// nextTabStop returns the next tab stop index for a new placeholder.
+-func (b *Builder) nextTabStop() int {
+- // Tab stops start from 1, so increment before returning.
+- b.currentTabStop++
+- return b.currentTabStop
+-}
+diff -urN a/gopls/internal/lsp/snippet/snippet_builder_test.go b/gopls/internal/lsp/snippet/snippet_builder_test.go
+--- a/gopls/internal/lsp/snippet/snippet_builder_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/snippet/snippet_builder_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,62 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package snippet
+-
+-import (
+- "testing"
+-)
+-
+-func TestSnippetBuilder(t *testing.T) {
+- expect := func(expected string, fn func(*Builder)) {
+- t.Helper()
+-
+- var b Builder
+- fn(&b)
+- if got := b.String(); got != expected {
+- t.Errorf("got %q, expected %q", got, expected)
+- }
+- }
+-
+- expect("", func(b *Builder) {})
+-
+- expect(`hi { \} \$ | " , / \\`, func(b *Builder) {
+- b.WriteText(`hi { } $ | " , / \`)
+- })
+-
+- expect("${1:}", func(b *Builder) {
+- b.WritePlaceholder(nil)
+- })
+-
+- expect("hi ${1:there}", func(b *Builder) {
+- b.WriteText("hi ")
+- b.WritePlaceholder(func(b *Builder) {
+- b.WriteText("there")
+- })
+- })
+-
+- expect(`${1:id=${2:{your id\}}}`, func(b *Builder) {
+- b.WritePlaceholder(func(b *Builder) {
+- b.WriteText("id=")
+- b.WritePlaceholder(func(b *Builder) {
+- b.WriteText("{your id}")
+- })
+- })
+- })
+-
+- expect(`${1|one,{ \} \$ \| " \, / \\,three|}`, func(b *Builder) {
+- b.WriteChoice([]string{"one", `{ } $ | " , / \`, "three"})
+- })
+-
+- expect("$0 hello", func(b *Builder) {
+- b.WriteFinalTabstop()
+- b.WriteText(" hello")
+- })
+-
+- expect(`prepended \$5 ${1:} hello`, func(b *Builder) {
+- b.WritePlaceholder(nil)
+- b.WriteText(" hello")
+- b.PrependText("prepended $5 ")
+- })
+-}
+diff -urN a/gopls/internal/lsp/source/add_import.go b/gopls/internal/lsp/source/add_import.go
+--- a/gopls/internal/lsp/source/add_import.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/add_import.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,26 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/imports"
+-)
+-
+-// AddImport adds a single import statement to the given file
+-func AddImport(ctx context.Context, snapshot Snapshot, fh FileHandle, importPath string) ([]protocol.TextEdit, error) {
+- pgf, err := snapshot.ParseGo(ctx, fh, ParseFull)
+- if err != nil {
+- return nil, err
+- }
+- return ComputeOneImportFixEdits(snapshot, pgf, &imports.ImportFix{
+- StmtInfo: imports.ImportInfo{
+- ImportPath: importPath,
+- },
+- FixType: imports.AddImport,
+- })
+-}
+diff -urN a/gopls/internal/lsp/source/api_json.go b/gopls/internal/lsp/source/api_json.go
+--- a/gopls/internal/lsp/source/api_json.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/api_json.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1118 +0,0 @@
+-// Code generated by "golang.org/x/tools/gopls/doc/generate"; DO NOT EDIT.
+-
+-package source
+-
+-var GeneratedAPIJSON = &APIJSON{
+- Options: map[string][]*OptionJSON{
+- "User": {
+- {
+- Name: "buildFlags",
+- Type: "[]string",
+- Doc: "buildFlags is the set of flags passed on to the build system when invoked.\nIt is applied to queries like `go list`, which is used when discovering files.\nThe most common use is to set `-tags`.\n",
+- Default: "[]",
+- Hierarchy: "build",
+- },
+- {
+- Name: "env",
+- Type: "map[string]string",
+- Doc: "env adds environment variables to external commands run by `gopls`, most notably `go list`.\n",
+- Default: "{}",
+- Hierarchy: "build",
+- },
+- {
+- Name: "directoryFilters",
+- Type: "[]string",
+- Doc: "directoryFilters can be used to exclude unwanted directories from the\nworkspace. By default, all directories are included. Filters are an\noperator, `+` to include and `-` to exclude, followed by a path prefix\nrelative to the workspace folder. They are evaluated in order, and\nthe last filter that applies to a path controls whether it is included.\nThe path prefix can be empty, so an initial `-` excludes everything.\n\nDirectoryFilters also supports the `**` operator to match 0 or more directories.\n\nExamples:\n\nExclude node_modules at current depth: `-node_modules`\n\nExclude node_modules at any depth: `-**/node_modules`\n\nInclude only project_a: `-` (exclude everything), `+project_a`\n\nInclude only project_a, but not node_modules inside it: `-`, `+project_a`, `-project_a/node_modules`\n",
+- Default: "[\"-**/node_modules\"]",
+- Hierarchy: "build",
+- },
+- {
+- Name: "templateExtensions",
+- Type: "[]string",
+- Doc: "templateExtensions gives the extensions of file names that are treateed\nas template files. (The extension\nis the part of the file name after the final dot.)\n",
+- Default: "[]",
+- Hierarchy: "build",
+- },
+- {
+- Name: "memoryMode",
+- Type: "enum",
+- Doc: "memoryMode controls the tradeoff `gopls` makes between memory usage and\ncorrectness.\n\nValues other than `Normal` are untested and may break in surprising ways.\n",
+- EnumValues: []EnumValue{
+- {
+- Value: "\"DegradeClosed\"",
+- Doc: "`\"DegradeClosed\"`: In DegradeClosed mode, `gopls` will collect less information about\npackages without open files. As a result, features like Find\nReferences and Rename will miss results in such packages.\n",
+- },
+- {Value: "\"Normal\""},
+- },
+- Default: "\"Normal\"",
+- Status: "experimental",
+- Hierarchy: "build",
+- },
+- {
+- Name: "expandWorkspaceToModule",
+- Type: "bool",
+- Doc: "expandWorkspaceToModule instructs `gopls` to adjust the scope of the\nworkspace to find the best available module root. `gopls` first looks for\na go.mod file in any parent directory of the workspace folder, expanding\nthe scope to that directory if it exists. If no viable parent directory is\nfound, gopls will check if there is exactly one child directory containing\na go.mod file, narrowing the scope to that directory if it exists.\n",
+- Default: "true",
+- Status: "experimental",
+- Hierarchy: "build",
+- },
+- {
+- Name: "allowModfileModifications",
+- Type: "bool",
+- Doc: "allowModfileModifications disables -mod=readonly, allowing imports from\nout-of-scope modules. This option will eventually be removed.\n",
+- Default: "false",
+- Status: "experimental",
+- Hierarchy: "build",
+- },
+- {
+- Name: "allowImplicitNetworkAccess",
+- Type: "bool",
+- Doc: "allowImplicitNetworkAccess disables GOPROXY=off, allowing implicit module\ndownloads rather than requiring user action. This option will eventually\nbe removed.\n",
+- Default: "false",
+- Status: "experimental",
+- Hierarchy: "build",
+- },
+- {
+- Name: "standaloneTags",
+- Type: "[]string",
+- Doc: "standaloneTags specifies a set of build constraints that identify\nindividual Go source files that make up the entire main package of an\nexecutable.\n\nA common example of standalone main files is the convention of using the\ndirective `//go:build ignore` to denote files that are not intended to be\nincluded in any package, for example because they are invoked directly by\nthe developer using `go run`.\n\nGopls considers a file to be a standalone main file if and only if it has\npackage name \"main\" and has a build directive of the exact form\n\"//go:build tag\" or \"// +build tag\", where tag is among the list of tags\nconfigured by this setting. Notably, if the build constraint is more\ncomplicated than a simple tag (such as the composite constraint\n`//go:build tag && go1.18`), the file is not considered to be a standalone\nmain file.\n\nThis setting is only supported when gopls is built with Go 1.16 or later.\n",
+- Default: "[\"ignore\"]",
+- Hierarchy: "build",
+- },
+- {
+- Name: "hoverKind",
+- Type: "enum",
+- Doc: "hoverKind controls the information that appears in the hover text.\nSingleLine and Structured are intended for use only by authors of editor plugins.\n",
+- EnumValues: []EnumValue{
+- {Value: "\"FullDocumentation\""},
+- {Value: "\"NoDocumentation\""},
+- {Value: "\"SingleLine\""},
+- {
+- Value: "\"Structured\"",
+- Doc: "`\"Structured\"` is an experimental setting that returns a structured hover format.\nThis format separates the signature from the documentation, so that the client\ncan do more manipulation of these fields.\n\nThis should only be used by clients that support this behavior.\n",
+- },
+- {Value: "\"SynopsisDocumentation\""},
+- },
+- Default: "\"FullDocumentation\"",
+- Hierarchy: "ui.documentation",
+- },
+- {
+- Name: "linkTarget",
+- Type: "string",
+- Doc: "linkTarget controls where documentation links go.\nIt might be one of:\n\n* `\"godoc.org\"`\n* `\"pkg.go.dev\"`\n\nIf company chooses to use its own `godoc.org`, its address can be used as well.\n\nModules matching the GOPRIVATE environment variable will not have\ndocumentation links in hover.\n",
+- Default: "\"pkg.go.dev\"",
+- Hierarchy: "ui.documentation",
+- },
+- {
+- Name: "linksInHover",
+- Type: "bool",
+- Doc: "linksInHover toggles the presence of links to documentation in hover.\n",
+- Default: "true",
+- Hierarchy: "ui.documentation",
+- },
+- {
+- Name: "usePlaceholders",
+- Type: "bool",
+- Doc: "placeholders enables placeholders for function parameters or struct\nfields in completion responses.\n",
+- Default: "false",
+- Hierarchy: "ui.completion",
+- },
+- {
+- Name: "completionBudget",
+- Type: "time.Duration",
+- Doc: "completionBudget is the soft latency goal for completion requests. Most\nrequests finish in a couple milliseconds, but in some cases deep\ncompletions can take much longer. As we use up our budget we\ndynamically reduce the search scope to ensure we return timely\nresults. Zero means unlimited.\n",
+- Default: "\"100ms\"",
+- Status: "debug",
+- Hierarchy: "ui.completion",
+- },
+- {
+- Name: "matcher",
+- Type: "enum",
+- Doc: "matcher sets the algorithm that is used when calculating completion\ncandidates.\n",
+- EnumValues: []EnumValue{
+- {Value: "\"CaseInsensitive\""},
+- {Value: "\"CaseSensitive\""},
+- {Value: "\"Fuzzy\""},
+- },
+- Default: "\"Fuzzy\"",
+- Status: "advanced",
+- Hierarchy: "ui.completion",
+- },
+- {
+- Name: "experimentalPostfixCompletions",
+- Type: "bool",
+- Doc: "experimentalPostfixCompletions enables artificial method snippets\nsuch as \"someSlice.sort!\".\n",
+- Default: "true",
+- Status: "experimental",
+- Hierarchy: "ui.completion",
+- },
+- {
+- Name: "importShortcut",
+- Type: "enum",
+- Doc: "importShortcut specifies whether import statements should link to\ndocumentation or go to definitions.\n",
+- EnumValues: []EnumValue{
+- {Value: "\"Both\""},
+- {Value: "\"Definition\""},
+- {Value: "\"Link\""},
+- },
+- Default: "\"Both\"",
+- Hierarchy: "ui.navigation",
+- },
+- {
+- Name: "symbolMatcher",
+- Type: "enum",
+- Doc: "symbolMatcher sets the algorithm that is used when finding workspace symbols.\n",
+- EnumValues: []EnumValue{
+- {Value: "\"CaseInsensitive\""},
+- {Value: "\"CaseSensitive\""},
+- {Value: "\"FastFuzzy\""},
+- {Value: "\"Fuzzy\""},
+- },
+- Default: "\"FastFuzzy\"",
+- Status: "advanced",
+- Hierarchy: "ui.navigation",
+- },
+- {
+- Name: "symbolStyle",
+- Type: "enum",
+- Doc: "symbolStyle controls how symbols are qualified in symbol responses.\n\nExample Usage:\n\n```json5\n\"gopls\": {\n...\n \"symbolStyle\": \"Dynamic\",\n...\n}\n```\n",
+- EnumValues: []EnumValue{
+- {
+- Value: "\"Dynamic\"",
+- Doc: "`\"Dynamic\"` uses whichever qualifier results in the highest scoring\nmatch for the given symbol query. Here a \"qualifier\" is any \"/\" or \".\"\ndelimited suffix of the fully qualified symbol. i.e. \"to/pkg.Foo.Field\" or\njust \"Foo.Field\".\n",
+- },
+- {
+- Value: "\"Full\"",
+- Doc: "`\"Full\"` is fully qualified symbols, i.e.\n\"path/to/pkg.Foo.Field\".\n",
+- },
+- {
+- Value: "\"Package\"",
+- Doc: "`\"Package\"` is package qualified symbols i.e.\n\"pkg.Foo.Field\".\n",
+- },
+- },
+- Default: "\"Dynamic\"",
+- Status: "advanced",
+- Hierarchy: "ui.navigation",
+- },
+- {
+- Name: "analyses",
+- Type: "map[string]bool",
+- Doc: "analyses specify analyses that the user would like to enable or disable.\nA map of the names of analysis passes that should be enabled/disabled.\nA full list of analyzers that gopls uses can be found in\n[analyzers.md](https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md).\n\nExample Usage:\n\n```json5\n...\n\"analyses\": {\n \"unreachable\": false, // Disable the unreachable analyzer.\n \"unusedparams\": true // Enable the unusedparams analyzer.\n}\n...\n```\n",
+- EnumKeys: EnumKeys{
+- ValueType: "bool",
+- Keys: []EnumKey{
+- {
+- Name: "\"asmdecl\"",
+- Doc: "report mismatches between assembly files and Go declarations",
+- Default: "true",
+- },
+- {
+- Name: "\"assign\"",
+- Doc: "check for useless assignments\n\nThis checker reports assignments of the form x = x or a[i] = a[i].\nThese are almost always useless, and even when they aren't they are\nusually a mistake.",
+- Default: "true",
+- },
+- {
+- Name: "\"atomic\"",
+- Doc: "check for common mistakes using the sync/atomic package\n\nThe atomic checker looks for assignment statements of the form:\n\n\tx = atomic.AddUint64(&x, 1)\n\nwhich are not atomic.",
+- Default: "true",
+- },
+- {
+- Name: "\"atomicalign\"",
+- Doc: "check for non-64-bits-aligned arguments to sync/atomic functions",
+- Default: "true",
+- },
+- {
+- Name: "\"bools\"",
+- Doc: "check for common mistakes involving boolean operators",
+- Default: "true",
+- },
+- {
+- Name: "\"buildtag\"",
+- Doc: "check //go:build and // +build directives",
+- Default: "true",
+- },
+- {
+- Name: "\"cgocall\"",
+- Doc: "detect some violations of the cgo pointer passing rules\n\nCheck for invalid cgo pointer passing.\nThis looks for code that uses cgo to call C code passing values\nwhose types are almost always invalid according to the cgo pointer\nsharing rules.\nSpecifically, it warns about attempts to pass a Go chan, map, func,\nor slice to C, either directly, or via a pointer, array, or struct.",
+- Default: "true",
+- },
+- {
+- Name: "\"composites\"",
+- Doc: "check for unkeyed composite literals\n\nThis analyzer reports a diagnostic for composite literals of struct\ntypes imported from another package that do not use the field-keyed\nsyntax. Such literals are fragile because the addition of a new field\n(even if unexported) to the struct will cause compilation to fail.\n\nAs an example,\n\n\terr = &net.DNSConfigError{err}\n\nshould be replaced by:\n\n\terr = &net.DNSConfigError{Err: err}\n",
+- Default: "true",
+- },
+- {
+- Name: "\"copylocks\"",
+- Doc: "check for locks erroneously passed by value\n\nInadvertently copying a value containing a lock, such as sync.Mutex or\nsync.WaitGroup, may cause both copies to malfunction. Generally such\nvalues should be referred to through a pointer.",
+- Default: "true",
+- },
+- {
+- Name: "\"deepequalerrors\"",
+- Doc: "check for calls of reflect.DeepEqual on error values\n\nThe deepequalerrors checker looks for calls of the form:\n\n reflect.DeepEqual(err1, err2)\n\nwhere err1 and err2 are errors. Using reflect.DeepEqual to compare\nerrors is discouraged.",
+- Default: "true",
+- },
+- {
+- Name: "\"directive\"",
+- Doc: "check Go toolchain directives such as //go:debug\n\nThis analyzer checks for problems with known Go toolchain directives\nin all Go source files in a package directory, even those excluded by\n//go:build constraints, and all non-Go source files too.\n\nFor //go:debug (see https://go.dev/doc/godebug), the analyzer checks\nthat the directives are placed only in Go source files, only above the\npackage comment, and only in package main or *_test.go files.\n\nSupport for other known directives may be added in the future.\n\nThis analyzer does not check //go:build, which is handled by the\nbuildtag analyzer.\n",
+- Default: "true",
+- },
+- {
+- Name: "\"embed\"",
+- Doc: "check for //go:embed directive import\n\nThis analyzer checks that the embed package is imported when source code contains //go:embed comment directives.\nThe embed package must be imported for //go:embed directives to function.import _ \"embed\".",
+- Default: "true",
+- },
+- {
+- Name: "\"errorsas\"",
+- Doc: "report passing non-pointer or non-error values to errors.As\n\nThe errorsas analysis reports calls to errors.As where the type\nof the second argument is not a pointer to a type implementing error.",
+- Default: "true",
+- },
+- {
+- Name: "\"fieldalignment\"",
+- Doc: "find structs that would use less memory if their fields were sorted\n\nThis analyzer find structs that can be rearranged to use less memory, and provides\na suggested edit with the most compact order.\n\nNote that there are two different diagnostics reported. One checks struct size,\nand the other reports \"pointer bytes\" used. Pointer bytes is how many bytes of the\nobject that the garbage collector has to potentially scan for pointers, for example:\n\n\tstruct { uint32; string }\n\nhave 16 pointer bytes because the garbage collector has to scan up through the string's\ninner pointer.\n\n\tstruct { string; *uint32 }\n\nhas 24 pointer bytes because it has to scan further through the *uint32.\n\n\tstruct { string; uint32 }\n\nhas 8 because it can stop immediately after the string pointer.\n\nBe aware that the most compact order is not always the most efficient.\nIn rare cases it may cause two variables each updated by its own goroutine\nto occupy the same CPU cache line, inducing a form of memory contention\nknown as \"false sharing\" that slows down both goroutines.\n",
+- Default: "false",
+- },
+- {
+- Name: "\"httpresponse\"",
+- Doc: "check for mistakes using HTTP responses\n\nA common mistake when using the net/http package is to defer a function\ncall to close the http.Response Body before checking the error that\ndetermines whether the response is valid:\n\n\tresp, err := http.Head(url)\n\tdefer resp.Body.Close()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// (defer statement belongs here)\n\nThis checker helps uncover latent nil dereference bugs by reporting a\ndiagnostic for such mistakes.",
+- Default: "true",
+- },
+- {
+- Name: "\"ifaceassert\"",
+- Doc: "detect impossible interface-to-interface type assertions\n\nThis checker flags type assertions v.(T) and corresponding type-switch cases\nin which the static type V of v is an interface that cannot possibly implement\nthe target interface T. This occurs when V and T contain methods with the same\nname but different signatures. Example:\n\n\tvar v interface {\n\t\tRead()\n\t}\n\t_ = v.(io.Reader)\n\nThe Read method in v has a different signature than the Read method in\nio.Reader, so this assertion cannot succeed.\n",
+- Default: "true",
+- },
+- {
+- Name: "\"infertypeargs\"",
+- Doc: "check for unnecessary type arguments in call expressions\n\nExplicit type arguments may be omitted from call expressions if they can be\ninferred from function arguments, or from other type arguments:\n\n\tfunc f[T any](T) {}\n\t\n\tfunc _() {\n\t\tf[string](\"foo\") // string could be inferred\n\t}\n",
+- Default: "true",
+- },
+- {
+- Name: "\"loopclosure\"",
+- Doc: "check references to loop variables from within nested functions\n\nThis analyzer reports places where a function literal references the\niteration variable of an enclosing loop, and the loop calls the function\nin such a way (e.g. with go or defer) that it may outlive the loop\niteration and possibly observe the wrong value of the variable.\n\nIn this example, all the deferred functions run after the loop has\ncompleted, so all observe the final value of v.\n\n for _, v := range list {\n defer func() {\n use(v) // incorrect\n }()\n }\n\nOne fix is to create a new variable for each iteration of the loop:\n\n for _, v := range list {\n v := v // new var per iteration\n defer func() {\n use(v) // ok\n }()\n }\n\nThe next example uses a go statement and has a similar problem.\nIn addition, it has a data race because the loop updates v\nconcurrent with the goroutines accessing it.\n\n for _, v := range elem {\n go func() {\n use(v) // incorrect, and a data race\n }()\n }\n\nA fix is the same as before. The checker also reports problems\nin goroutines started by golang.org/x/sync/errgroup.Group.\nA hard-to-spot variant of this form is common in parallel tests:\n\n func Test(t *testing.T) {\n for _, test := range tests {\n t.Run(test.name, func(t *testing.T) {\n t.Parallel()\n use(test) // incorrect, and a data race\n })\n }\n }\n\nThe t.Parallel() call causes the rest of the function to execute\nconcurrent with the loop.\n\nThe analyzer reports references only in the last statement,\nas it is not deep enough to understand the effects of subsequent\nstatements that might render the reference benign.\n(\"Last statement\" is defined recursively in compound\nstatements such as if, switch, and select.)\n\nSee: https://golang.org/doc/go_faq.html#closures_and_goroutines",
+- Default: "true",
+- },
+- {
+- Name: "\"lostcancel\"",
+- Doc: "check cancel func returned by context.WithCancel is called\n\nThe cancellation function returned by context.WithCancel, WithTimeout,\nand WithDeadline must be called or the new context will remain live\nuntil its parent context is cancelled.\n(The background context is never cancelled.)",
+- Default: "true",
+- },
+- {
+- Name: "\"nilfunc\"",
+- Doc: "check for useless comparisons between functions and nil\n\nA useless comparison is one like f == nil as opposed to f() == nil.",
+- Default: "true",
+- },
+- {
+- Name: "\"nilness\"",
+- Doc: "check for redundant or impossible nil comparisons\n\nThe nilness checker inspects the control-flow graph of each function in\na package and reports nil pointer dereferences, degenerate nil\npointers, and panics with nil values. A degenerate comparison is of the form\nx==nil or x!=nil where x is statically known to be nil or non-nil. These are\noften a mistake, especially in control flow related to errors. Panics with nil\nvalues are checked because they are not detectable by\n\n\tif r := recover(); r != nil {\n\nThis check reports conditions such as:\n\n\tif f == nil { // impossible condition (f is a function)\n\t}\n\nand:\n\n\tp := &v\n\t...\n\tif p != nil { // tautological condition\n\t}\n\nand:\n\n\tif p == nil {\n\t\tprint(*p) // nil dereference\n\t}\n\nand:\n\n\tif p == nil {\n\t\tpanic(p)\n\t}\n",
+- Default: "false",
+- },
+- {
+- Name: "\"printf\"",
+- Doc: "check consistency of Printf format strings and arguments\n\nThe check applies to known functions (for example, those in package fmt)\nas well as any detected wrappers of known functions.\n\nA function that wants to avail itself of printf checking but is not\nfound by this analyzer's heuristics (for example, due to use of\ndynamic calls) can insert a bogus call:\n\n\tif false {\n\t\t_ = fmt.Sprintf(format, args...) // enable printf checking\n\t}\n\nThe -funcs flag specifies a comma-separated list of names of additional\nknown formatting functions or methods. If the name contains a period,\nit must denote a specific function using one of the following forms:\n\n\tdir/pkg.Function\n\tdir/pkg.Type.Method\n\t(*dir/pkg.Type).Method\n\nOtherwise the name is interpreted as a case-insensitive unqualified\nidentifier such as \"errorf\". Either way, if a listed name ends in f, the\nfunction is assumed to be Printf-like, taking a format string before the\nargument list. Otherwise it is assumed to be Print-like, taking a list\nof arguments with no format string.\n",
+- Default: "true",
+- },
+- {
+- Name: "\"shadow\"",
+- Doc: "check for possible unintended shadowing of variables\n\nThis analyzer check for shadowed variables.\nA shadowed variable is a variable declared in an inner scope\nwith the same name and type as a variable in an outer scope,\nand where the outer variable is mentioned after the inner one\nis declared.\n\n(This definition can be refined; the module generates too many\nfalse positives and is not yet enabled by default.)\n\nFor example:\n\n\tfunc BadRead(f *os.File, buf []byte) error {\n\t\tvar err error\n\t\tfor {\n\t\t\tn, err := f.Read(buf) // shadows the function variable 'err'\n\t\t\tif err != nil {\n\t\t\t\tbreak // causes return of wrong value\n\t\t\t}\n\t\t\tfoo(buf)\n\t\t}\n\t\treturn err\n\t}\n",
+- Default: "false",
+- },
+- {
+- Name: "\"shift\"",
+- Doc: "check for shifts that equal or exceed the width of the integer",
+- Default: "true",
+- },
+- {
+- Name: "\"simplifycompositelit\"",
+- Doc: "check for composite literal simplifications\n\nAn array, slice, or map composite literal of the form:\n\t[]T{T{}, T{}}\nwill be simplified to:\n\t[]T{{}, {}}\n\nThis is one of the simplifications that \"gofmt -s\" applies.",
+- Default: "true",
+- },
+- {
+- Name: "\"simplifyrange\"",
+- Doc: "check for range statement simplifications\n\nA range of the form:\n\tfor x, _ = range v {...}\nwill be simplified to:\n\tfor x = range v {...}\n\nA range of the form:\n\tfor _ = range v {...}\nwill be simplified to:\n\tfor range v {...}\n\nThis is one of the simplifications that \"gofmt -s\" applies.",
+- Default: "true",
+- },
+- {
+- Name: "\"simplifyslice\"",
+- Doc: "check for slice simplifications\n\nA slice expression of the form:\n\ts[a:len(s)]\nwill be simplified to:\n\ts[a:]\n\nThis is one of the simplifications that \"gofmt -s\" applies.",
+- Default: "true",
+- },
+- {
+- Name: "\"sortslice\"",
+- Doc: "check the argument type of sort.Slice\n\nsort.Slice requires an argument of a slice type. Check that\nthe interface{} value passed to sort.Slice is actually a slice.",
+- Default: "true",
+- },
+- {
+- Name: "\"stdmethods\"",
+- Doc: "check signature of methods of well-known interfaces\n\nSometimes a type may be intended to satisfy an interface but may fail to\ndo so because of a mistake in its method signature.\nFor example, the result of this WriteTo method should be (int64, error),\nnot error, to satisfy io.WriterTo:\n\n\ttype myWriterTo struct{...}\n func (myWriterTo) WriteTo(w io.Writer) error { ... }\n\nThis check ensures that each method whose name matches one of several\nwell-known interface methods from the standard library has the correct\nsignature for that interface.\n\nChecked method names include:\n\tFormat GobEncode GobDecode MarshalJSON MarshalXML\n\tPeek ReadByte ReadFrom ReadRune Scan Seek\n\tUnmarshalJSON UnreadByte UnreadRune WriteByte\n\tWriteTo\n",
+- Default: "true",
+- },
+- {
+- Name: "\"stringintconv\"",
+- Doc: "check for string(int) conversions\n\nThis checker flags conversions of the form string(x) where x is an integer\n(but not byte or rune) type. Such conversions are discouraged because they\nreturn the UTF-8 representation of the Unicode code point x, and not a decimal\nstring representation of x as one might expect. Furthermore, if x denotes an\ninvalid code point, the conversion cannot be statically rejected.\n\nFor conversions that intend on using the code point, consider replacing them\nwith string(rune(x)). Otherwise, strconv.Itoa and its equivalents return the\nstring representation of the value in the desired base.\n",
+- Default: "true",
+- },
+- {
+- Name: "\"structtag\"",
+- Doc: "check that struct field tags conform to reflect.StructTag.Get\n\nAlso report certain struct tags (json, xml) used with unexported fields.",
+- Default: "true",
+- },
+- {
+- Name: "\"testinggoroutine\"",
+- Doc: "report calls to (*testing.T).Fatal from goroutines started by a test.\n\nFunctions that abruptly terminate a test, such as the Fatal, Fatalf, FailNow, and\nSkip{,f,Now} methods of *testing.T, must be called from the test goroutine itself.\nThis checker detects calls to these functions that occur within a goroutine\nstarted by the test. For example:\n\nfunc TestFoo(t *testing.T) {\n go func() {\n t.Fatal(\"oops\") // error: (*T).Fatal called from non-test goroutine\n }()\n}\n",
+- Default: "true",
+- },
+- {
+- Name: "\"tests\"",
+- Doc: "check for common mistaken usages of tests and examples\n\nThe tests checker walks Test, Benchmark and Example functions checking\nmalformed names, wrong signatures and examples documenting non-existent\nidentifiers.\n\nPlease see the documentation for package testing in golang.org/pkg/testing\nfor the conventions that are enforced for Tests, Benchmarks, and Examples.",
+- Default: "true",
+- },
+- {
+- Name: "\"timeformat\"",
+- Doc: "check for calls of (time.Time).Format or time.Parse with 2006-02-01\n\nThe timeformat checker looks for time formats with the 2006-02-01 (yyyy-dd-mm)\nformat. Internationally, \"yyyy-dd-mm\" does not occur in common calendar date\nstandards, and so it is more likely that 2006-01-02 (yyyy-mm-dd) was intended.\n",
+- Default: "true",
+- },
+- {
+- Name: "\"unmarshal\"",
+- Doc: "report passing non-pointer or non-interface values to unmarshal\n\nThe unmarshal analysis reports calls to functions such as json.Unmarshal\nin which the argument type is not a pointer or an interface.",
+- Default: "true",
+- },
+- {
+- Name: "\"unreachable\"",
+- Doc: "check for unreachable code\n\nThe unreachable analyzer finds statements that execution can never reach\nbecause they are preceded by an return statement, a call to panic, an\ninfinite loop, or similar constructs.",
+- Default: "true",
+- },
+- {
+- Name: "\"unsafeptr\"",
+- Doc: "check for invalid conversions of uintptr to unsafe.Pointer\n\nThe unsafeptr analyzer reports likely incorrect uses of unsafe.Pointer\nto convert integers to pointers. A conversion from uintptr to\nunsafe.Pointer is invalid if it implies that there is a uintptr-typed\nword in memory that holds a pointer value, because that word will be\ninvisible to stack copying and to the garbage collector.",
+- Default: "true",
+- },
+- {
+- Name: "\"unusedparams\"",
+- Doc: "check for unused parameters of functions\n\nThe unusedparams analyzer checks functions to see if there are\nany parameters that are not being used.\n\nTo reduce false positives it ignores:\n- methods\n- parameters that do not have a name or are underscored\n- functions in test files\n- functions with empty bodies or those with just a return stmt",
+- Default: "false",
+- },
+- {
+- Name: "\"unusedresult\"",
+- Doc: "check for unused results of calls to some functions\n\nSome functions like fmt.Errorf return a result and have no side effects,\nso it is always a mistake to discard the result. This analyzer reports\ncalls to certain functions in which the result of the call is ignored.\n\nThe set of functions may be controlled using flags.",
+- Default: "true",
+- },
+- {
+- Name: "\"unusedwrite\"",
+- Doc: "checks for unused writes\n\nThe analyzer reports instances of writes to struct fields and\narrays that are never read. Specifically, when a struct object\nor an array is copied, its elements are copied implicitly by\nthe compiler, and any element write to this copy does nothing\nwith the original object.\n\nFor example:\n\n\ttype T struct { x int }\n\tfunc f(input []T) {\n\t\tfor i, v := range input { // v is a copy\n\t\t\tv.x = i // unused write to field x\n\t\t}\n\t}\n\nAnother example is about non-pointer receiver:\n\n\ttype T struct { x int }\n\tfunc (t T) f() { // t is a copy\n\t\tt.x = i // unused write to field x\n\t}\n",
+- Default: "false",
+- },
+- {
+- Name: "\"useany\"",
+- Doc: "check for constraints that could be simplified to \"any\"",
+- Default: "false",
+- },
+- {
+- Name: "\"fillreturns\"",
+- Doc: "suggest fixes for errors due to an incorrect number of return values\n\nThis checker provides suggested fixes for type errors of the\ntype \"wrong number of return values (want %d, got %d)\". For example:\n\tfunc m() (int, string, *bool, error) {\n\t\treturn\n\t}\nwill turn into\n\tfunc m() (int, string, *bool, error) {\n\t\treturn 0, \"\", nil, nil\n\t}\n\nThis functionality is similar to https://github.com/sqs/goreturns.\n",
+- Default: "true",
+- },
+- {
+- Name: "\"nonewvars\"",
+- Doc: "suggested fixes for \"no new vars on left side of :=\"\n\nThis checker provides suggested fixes for type errors of the\ntype \"no new vars on left side of :=\". For example:\n\tz := 1\n\tz := 2\nwill turn into\n\tz := 1\n\tz = 2\n",
+- Default: "true",
+- },
+- {
+- Name: "\"noresultvalues\"",
+- Doc: "suggested fixes for unexpected return values\n\nThis checker provides suggested fixes for type errors of the\ntype \"no result values expected\" or \"too many return values\".\nFor example:\n\tfunc z() { return nil }\nwill turn into\n\tfunc z() { return }\n",
+- Default: "true",
+- },
+- {
+- Name: "\"undeclaredname\"",
+- Doc: "suggested fixes for \"undeclared name: <>\"\n\nThis checker provides suggested fixes for type errors of the\ntype \"undeclared name: <>\". It will either insert a new statement,\nsuch as:\n\n\"<> := \"\n\nor a new function declaration, such as:\n\nfunc <>(inferred parameters) {\n\tpanic(\"implement me!\")\n}\n",
+- Default: "true",
+- },
+- {
+- Name: "\"unusedvariable\"",
+- Doc: "check for unused variables\n\nThe unusedvariable analyzer suggests fixes for unused variables errors.\n",
+- Default: "false",
+- },
+- {
+- Name: "\"fillstruct\"",
+- Doc: "note incomplete struct initializations\n\nThis analyzer provides diagnostics for any struct literals that do not have\nany fields initialized. Because the suggested fix for this analysis is\nexpensive to compute, callers should compute it separately, using the\nSuggestedFix function below.\n",
+- Default: "true",
+- },
+- {
+- Name: "\"stubmethods\"",
+- Doc: "stub methods analyzer\n\nThis analyzer generates method stubs for concrete types\nin order to implement a target interface",
+- Default: "true",
+- },
+- },
+- },
+- Default: "{}",
+- Hierarchy: "ui.diagnostic",
+- },
+- {
+- Name: "staticcheck",
+- Type: "bool",
+- Doc: "staticcheck enables additional analyses from staticcheck.io.\nThese analyses are documented on\n[Staticcheck's website](https://staticcheck.io/docs/checks/).\n",
+- Default: "false",
+- Status: "experimental",
+- Hierarchy: "ui.diagnostic",
+- },
+- {
+- Name: "annotations",
+- Type: "map[string]bool",
+- Doc: "annotations specifies the various kinds of optimization diagnostics\nthat should be reported by the gc_details command.\n",
+- EnumKeys: EnumKeys{
+- ValueType: "bool",
+- Keys: []EnumKey{
+- {
+- Name: "\"bounds\"",
+- Doc: "`\"bounds\"` controls bounds checking diagnostics.\n",
+- Default: "true",
+- },
+- {
+- Name: "\"escape\"",
+- Doc: "`\"escape\"` controls diagnostics about escape choices.\n",
+- Default: "true",
+- },
+- {
+- Name: "\"inline\"",
+- Doc: "`\"inline\"` controls diagnostics about inlining choices.\n",
+- Default: "true",
+- },
+- {
+- Name: "\"nil\"",
+- Doc: "`\"nil\"` controls nil checks.\n",
+- Default: "true",
+- },
+- },
+- },
+- Default: "{\"bounds\":true,\"escape\":true,\"inline\":true,\"nil\":true}",
+- Status: "experimental",
+- Hierarchy: "ui.diagnostic",
+- },
+- {
+- Name: "vulncheck",
+- Type: "enum",
+- Doc: "vulncheck enables vulnerability scanning.\n",
+- EnumValues: []EnumValue{
+- {
+- Value: "\"Imports\"",
+- Doc: "`\"Imports\"`: In Imports mode, `gopls` will report vulnerabilities that affect packages\ndirectly and indirectly used by the analyzed main module.\n",
+- },
+- {
+- Value: "\"Off\"",
+- Doc: "`\"Off\"`: Disable vulnerability analysis.\n",
+- },
+- },
+- Default: "\"Off\"",
+- Status: "experimental",
+- Hierarchy: "ui.diagnostic",
+- },
+- {
+- Name: "diagnosticsDelay",
+- Type: "time.Duration",
+- Doc: "diagnosticsDelay controls the amount of time that gopls waits\nafter the most recent file modification before computing deep diagnostics.\nSimple diagnostics (parsing and type-checking) are always run immediately\non recently modified packages.\n\nThis option must be set to a valid duration string, for example `\"250ms\"`.\n",
+- Default: "\"250ms\"",
+- Status: "advanced",
+- Hierarchy: "ui.diagnostic",
+- },
+- {
+- Name: "hints",
+- Type: "map[string]bool",
+- Doc: "hints specify inlay hints that users want to see. A full list of hints\nthat gopls uses can be found in\n[inlayHints.md](https://github.com/golang/tools/blob/master/gopls/doc/inlayHints.md).\n",
+- EnumKeys: EnumKeys{Keys: []EnumKey{
+- {
+- Name: "\"assignVariableTypes\"",
+- Doc: "Enable/disable inlay hints for variable types in assign statements:\n```go\n\ti/* int*/, j/* int*/ := 0, len(r)-1\n```",
+- Default: "false",
+- },
+- {
+- Name: "\"compositeLiteralFields\"",
+- Doc: "Enable/disable inlay hints for composite literal field names:\n```go\n\t{/*in: */\"Hello, world\", /*want: */\"dlrow ,olleH\"}\n```",
+- Default: "false",
+- },
+- {
+- Name: "\"compositeLiteralTypes\"",
+- Doc: "Enable/disable inlay hints for composite literal types:\n```go\n\tfor _, c := range []struct {\n\t\tin, want string\n\t}{\n\t\t/*struct{ in string; want string }*/{\"Hello, world\", \"dlrow ,olleH\"},\n\t}\n```",
+- Default: "false",
+- },
+- {
+- Name: "\"constantValues\"",
+- Doc: "Enable/disable inlay hints for constant values:\n```go\n\tconst (\n\t\tKindNone Kind = iota/* = 0*/\n\t\tKindPrint/* = 1*/\n\t\tKindPrintf/* = 2*/\n\t\tKindErrorf/* = 3*/\n\t)\n```",
+- Default: "false",
+- },
+- {
+- Name: "\"functionTypeParameters\"",
+- Doc: "Enable/disable inlay hints for implicit type parameters on generic functions:\n```go\n\tmyFoo/*[int, string]*/(1, \"hello\")\n```",
+- Default: "false",
+- },
+- {
+- Name: "\"parameterNames\"",
+- Doc: "Enable/disable inlay hints for parameter names:\n```go\n\tparseInt(/* str: */ \"123\", /* radix: */ 8)\n```",
+- Default: "false",
+- },
+- {
+- Name: "\"rangeVariableTypes\"",
+- Doc: "Enable/disable inlay hints for variable types in range statements:\n```go\n\tfor k/* int*/, v/* string*/ := range []string{} {\n\t\tfmt.Println(k, v)\n\t}\n```",
+- Default: "false",
+- },
+- }},
+- Default: "{}",
+- Status: "experimental",
+- Hierarchy: "ui.inlayhint",
+- },
+- {
+- Name: "codelenses",
+- Type: "map[string]bool",
+- Doc: "codelenses overrides the enabled/disabled state of code lenses. See the\n\"Code Lenses\" section of the\n[Settings page](https://github.com/golang/tools/blob/master/gopls/doc/settings.md#code-lenses)\nfor the list of supported lenses.\n\nExample Usage:\n\n```json5\n\"gopls\": {\n...\n \"codelenses\": {\n \"generate\": false, // Don't show the `go generate` lens.\n \"gc_details\": true // Show a code lens toggling the display of gc's choices.\n }\n...\n}\n```\n",
+- EnumKeys: EnumKeys{
+- ValueType: "bool",
+- Keys: []EnumKey{
+- {
+- Name: "\"gc_details\"",
+- Doc: "Toggle the calculation of gc annotations.",
+- Default: "false",
+- },
+- {
+- Name: "\"generate\"",
+- Doc: "Runs `go generate` for a given directory.",
+- Default: "true",
+- },
+- {
+- Name: "\"regenerate_cgo\"",
+- Doc: "Regenerates cgo definitions.",
+- Default: "true",
+- },
+- {
+- Name: "\"run_govulncheck\"",
+- Doc: "Run vulnerability check (`govulncheck`).",
+- Default: "false",
+- },
+- {
+- Name: "\"test\"",
+- Doc: "Runs `go test` for a specific set of test or benchmark functions.",
+- Default: "false",
+- },
+- {
+- Name: "\"tidy\"",
+- Doc: "Runs `go mod tidy` for a module.",
+- Default: "true",
+- },
+- {
+- Name: "\"upgrade_dependency\"",
+- Doc: "Upgrades a dependency in the go.mod file for a module.",
+- Default: "true",
+- },
+- {
+- Name: "\"vendor\"",
+- Doc: "Runs `go mod vendor` for a module.",
+- Default: "true",
+- },
+- },
+- },
+- Default: "{\"gc_details\":false,\"generate\":true,\"regenerate_cgo\":true,\"tidy\":true,\"upgrade_dependency\":true,\"vendor\":true}",
+- Hierarchy: "ui",
+- },
+- {
+- Name: "semanticTokens",
+- Type: "bool",
+- Doc: "semanticTokens controls whether the LSP server will send\nsemantic tokens to the client.\n",
+- Default: "false",
+- Status: "experimental",
+- Hierarchy: "ui",
+- },
+- {
+- Name: "noSemanticString",
+- Type: "bool",
+- Doc: "noSemanticString turns off the sending of the semantic token 'string'\n",
+- Default: "false",
+- Status: "experimental",
+- Hierarchy: "ui",
+- },
+- {
+- Name: "noSemanticNumber",
+- Type: "bool",
+- Doc: "noSemanticNumber turns off the sending of the semantic token 'number'\n",
+- Default: "false",
+- Status: "experimental",
+- Hierarchy: "ui",
+- },
+- {
+- Name: "local",
+- Type: "string",
+- Doc: "local is the equivalent of the `goimports -local` flag, which puts\nimports beginning with this string after third-party packages. It should\nbe the prefix of the import path whose imports should be grouped\nseparately.\n",
+- Default: "\"\"",
+- Hierarchy: "formatting",
+- },
+- {
+- Name: "gofumpt",
+- Type: "bool",
+- Doc: "gofumpt indicates if we should run gofumpt formatting.\n",
+- Default: "false",
+- Hierarchy: "formatting",
+- },
+- {
+- Name: "verboseOutput",
+- Type: "bool",
+- Doc: "verboseOutput enables additional debug logging.\n",
+- Default: "false",
+- Status: "debug",
+- },
+- },
+- },
+- Commands: []*CommandJSON{
+- {
+- Command: "gopls.add_dependency",
+- Title: "Add a dependency",
+- Doc: "Adds a dependency to the go.mod file for a module.",
+- ArgDoc: "{\n\t// The go.mod file URI.\n\t\"URI\": string,\n\t// Additional args to pass to the go command.\n\t\"GoCmdArgs\": []string,\n\t// Whether to add a require directive.\n\t\"AddRequire\": bool,\n}",
+- },
+- {
+- Command: "gopls.add_import",
+- Title: "Add an import",
+- Doc: "Ask the server to add an import path to a given Go file. The method will\ncall applyEdit on the client so that clients don't have to apply the edit\nthemselves.",
+- ArgDoc: "{\n\t// ImportPath is the target import path that should\n\t// be added to the URI file\n\t\"ImportPath\": string,\n\t// URI is the file that the ImportPath should be\n\t// added to\n\t\"URI\": string,\n}",
+- },
+- {
+- Command: "gopls.apply_fix",
+- Title: "Apply a fix",
+- Doc: "Applies a fix to a region of source code.",
+- ArgDoc: "{\n\t// The fix to apply.\n\t\"Fix\": string,\n\t// The file URI for the document to fix.\n\t\"URI\": string,\n\t// The document range to scan for fixes.\n\t\"Range\": {\n\t\t\"start\": {\n\t\t\t\"line\": uint32,\n\t\t\t\"character\": uint32,\n\t\t},\n\t\t\"end\": {\n\t\t\t\"line\": uint32,\n\t\t\t\"character\": uint32,\n\t\t},\n\t},\n}",
+- },
+- {
+- Command: "gopls.check_upgrades",
+- Title: "Check for upgrades",
+- Doc: "Checks for module upgrades.",
+- ArgDoc: "{\n\t// The go.mod file URI.\n\t\"URI\": string,\n\t// The modules to check.\n\t\"Modules\": []string,\n}",
+- },
+- {
+- Command: "gopls.edit_go_directive",
+- Title: "Run go mod edit -go=version",
+- Doc: "Runs `go mod edit -go=version` for a module.",
+- ArgDoc: "{\n\t// Any document URI within the relevant module.\n\t\"URI\": string,\n\t// The version to pass to `go mod edit -go`.\n\t\"Version\": string,\n}",
+- },
+- {
+- Command: "gopls.fetch_vulncheck_result",
+- Title: "Get known vulncheck result",
+- Doc: "Fetch the result of latest vulnerability check (`govulncheck`).",
+- ArgDoc: "{\n\t// The file URI.\n\t\"URI\": string,\n}",
+- ResultDoc: "map[golang.org/x/tools/gopls/internal/lsp/protocol.DocumentURI]*golang.org/x/tools/gopls/internal/govulncheck.Result",
+- },
+- {
+- Command: "gopls.gc_details",
+- Title: "Toggle gc_details",
+- Doc: "Toggle the calculation of gc annotations.",
+- ArgDoc: "string",
+- },
+- {
+- Command: "gopls.generate",
+- Title: "Run go generate",
+- Doc: "Runs `go generate` for a given directory.",
+- ArgDoc: "{\n\t// URI for the directory to generate.\n\t\"Dir\": string,\n\t// Whether to generate recursively (go generate ./...)\n\t\"Recursive\": bool,\n}",
+- },
+- {
+- Command: "gopls.go_get_package",
+- Title: "go get a package",
+- Doc: "Runs `go get` to fetch a package.",
+- ArgDoc: "{\n\t// Any document URI within the relevant module.\n\t\"URI\": string,\n\t// The package to go get.\n\t\"Pkg\": string,\n\t\"AddRequire\": bool,\n}",
+- },
+- {
+- Command: "gopls.list_imports",
+- Title: "List imports of a file and its package",
+- Doc: "Retrieve a list of imports in the given Go file, and the package it\nbelongs to.",
+- ArgDoc: "{\n\t// The file URI.\n\t\"URI\": string,\n}",
+- ResultDoc: "{\n\t// Imports is a list of imports in the requested file.\n\t\"Imports\": []{\n\t\t\"Path\": string,\n\t\t\"Name\": string,\n\t},\n\t// PackageImports is a list of all imports in the requested file's package.\n\t\"PackageImports\": []{\n\t\t\"Path\": string,\n\t},\n}",
+- },
+- {
+- Command: "gopls.list_known_packages",
+- Title: "List known packages",
+- Doc: "Retrieve a list of packages that are importable from the given URI.",
+- ArgDoc: "{\n\t// The file URI.\n\t\"URI\": string,\n}",
+- ResultDoc: "{\n\t// Packages is a list of packages relative\n\t// to the URIArg passed by the command request.\n\t// In other words, it omits paths that are already\n\t// imported or cannot be imported due to compiler\n\t// restrictions.\n\t\"Packages\": []string,\n}",
+- },
+- {
+- Command: "gopls.mem_stats",
+- Title: "fetch memory statistics",
+- Doc: "Call runtime.GC multiple times and return memory statistics as reported by\nruntime.MemStats.\n\nThis command is used for benchmarking, and may change in the future.",
+- ResultDoc: "{\n\t\"HeapAlloc\": uint64,\n\t\"HeapInUse\": uint64,\n}",
+- },
+- {
+- Command: "gopls.regenerate_cgo",
+- Title: "Regenerate cgo",
+- Doc: "Regenerates cgo definitions.",
+- ArgDoc: "{\n\t// The file URI.\n\t\"URI\": string,\n}",
+- },
+- {
+- Command: "gopls.remove_dependency",
+- Title: "Remove a dependency",
+- Doc: "Removes a dependency from the go.mod file of a module.",
+- ArgDoc: "{\n\t// The go.mod file URI.\n\t\"URI\": string,\n\t// The module path to remove.\n\t\"ModulePath\": string,\n\t\"OnlyDiagnostic\": bool,\n}",
+- },
+- {
+- Command: "gopls.reset_go_mod_diagnostics",
+- Title: "Reset go.mod diagnostics",
+- Doc: "Reset diagnostics in the go.mod file of a module.",
+- ArgDoc: "{\n\t\"URIArg\": {\n\t\t\"URI\": string,\n\t},\n\t// Optional: source of the diagnostics to reset.\n\t// If not set, all resettable go.mod diagnostics will be cleared.\n\t\"DiagnosticSource\": string,\n}",
+- },
+- {
+- Command: "gopls.run_govulncheck",
+- Title: "Run govulncheck.",
+- Doc: "Run vulnerability check (`govulncheck`).",
+- ArgDoc: "{\n\t// Any document in the directory from which govulncheck will run.\n\t\"URI\": string,\n\t// Package pattern. E.g. \"\", \".\", \"./...\".\n\t\"Pattern\": string,\n}",
+- ResultDoc: "{\n\t// Token holds the progress token for LSP workDone reporting of the vulncheck\n\t// invocation.\n\t\"Token\": interface{},\n}",
+- },
+- {
+- Command: "gopls.run_tests",
+- Title: "Run test(s)",
+- Doc: "Runs `go test` for a specific set of test or benchmark functions.",
+- ArgDoc: "{\n\t// The test file containing the tests to run.\n\t\"URI\": string,\n\t// Specific test names to run, e.g. TestFoo.\n\t\"Tests\": []string,\n\t// Specific benchmarks to run, e.g. BenchmarkFoo.\n\t\"Benchmarks\": []string,\n}",
+- },
+- {
+- Command: "gopls.start_debugging",
+- Title: "Start the gopls debug server",
+- Doc: "Start the gopls debug server if it isn't running, and return the debug\naddress.",
+- ArgDoc: "{\n\t// Optional: the address (including port) for the debug server to listen on.\n\t// If not provided, the debug server will bind to \"localhost:0\", and the\n\t// full debug URL will be contained in the result.\n\t// \n\t// If there is more than one gopls instance along the serving path (i.e. you\n\t// are using a daemon), each gopls instance will attempt to start debugging.\n\t// If Addr specifies a port, only the daemon will be able to bind to that\n\t// port, and each intermediate gopls instance will fail to start debugging.\n\t// For this reason it is recommended not to specify a port (or equivalently,\n\t// to specify \":0\").\n\t// \n\t// If the server was already debugging this field has no effect, and the\n\t// result will contain the previously configured debug URL(s).\n\t\"Addr\": string,\n}",
+- ResultDoc: "{\n\t// The URLs to use to access the debug servers, for all gopls instances in\n\t// the serving path. For the common case of a single gopls instance (i.e. no\n\t// daemon), this will be exactly one address.\n\t// \n\t// In the case of one or more gopls instances forwarding the LSP to a daemon,\n\t// URLs will contain debug addresses for each server in the serving path, in\n\t// serving order. The daemon debug address will be the last entry in the\n\t// slice. If any intermediate gopls instance fails to start debugging, no\n\t// error will be returned but the debug URL for that server in the URLs slice\n\t// will be empty.\n\t\"URLs\": []string,\n}",
+- },
+- {
+- Command: "gopls.test",
+- Title: "Run test(s) (legacy)",
+- Doc: "Runs `go test` for a specific set of test or benchmark functions.",
+- ArgDoc: "string,\n[]string,\n[]string",
+- },
+- {
+- Command: "gopls.tidy",
+- Title: "Run go mod tidy",
+- Doc: "Runs `go mod tidy` for a module.",
+- ArgDoc: "{\n\t// The file URIs.\n\t\"URIs\": []string,\n}",
+- },
+- {
+- Command: "gopls.toggle_gc_details",
+- Title: "Toggle gc_details",
+- Doc: "Toggle the calculation of gc annotations.",
+- ArgDoc: "{\n\t// The file URI.\n\t\"URI\": string,\n}",
+- },
+- {
+- Command: "gopls.update_go_sum",
+- Title: "Update go.sum",
+- Doc: "Updates the go.sum file for a module.",
+- ArgDoc: "{\n\t// The file URIs.\n\t\"URIs\": []string,\n}",
+- },
+- {
+- Command: "gopls.upgrade_dependency",
+- Title: "Upgrade a dependency",
+- Doc: "Upgrades a dependency in the go.mod file for a module.",
+- ArgDoc: "{\n\t// The go.mod file URI.\n\t\"URI\": string,\n\t// Additional args to pass to the go command.\n\t\"GoCmdArgs\": []string,\n\t// Whether to add a require directive.\n\t\"AddRequire\": bool,\n}",
+- },
+- {
+- Command: "gopls.vendor",
+- Title: "Run go mod vendor",
+- Doc: "Runs `go mod vendor` for a module.",
+- ArgDoc: "{\n\t// The file URI.\n\t\"URI\": string,\n}",
+- },
+- },
+- Lenses: []*LensJSON{
+- {
+- Lens: "gc_details",
+- Title: "Toggle gc_details",
+- Doc: "Toggle the calculation of gc annotations.",
+- },
+- {
+- Lens: "generate",
+- Title: "Run go generate",
+- Doc: "Runs `go generate` for a given directory.",
+- },
+- {
+- Lens: "regenerate_cgo",
+- Title: "Regenerate cgo",
+- Doc: "Regenerates cgo definitions.",
+- },
+- {
+- Lens: "run_govulncheck",
+- Title: "Run govulncheck.",
+- Doc: "Run vulnerability check (`govulncheck`).",
+- },
+- {
+- Lens: "test",
+- Title: "Run test(s) (legacy)",
+- Doc: "Runs `go test` for a specific set of test or benchmark functions.",
+- },
+- {
+- Lens: "tidy",
+- Title: "Run go mod tidy",
+- Doc: "Runs `go mod tidy` for a module.",
+- },
+- {
+- Lens: "upgrade_dependency",
+- Title: "Upgrade a dependency",
+- Doc: "Upgrades a dependency in the go.mod file for a module.",
+- },
+- {
+- Lens: "vendor",
+- Title: "Run go mod vendor",
+- Doc: "Runs `go mod vendor` for a module.",
+- },
+- },
+- Analyzers: []*AnalyzerJSON{
+- {
+- Name: "asmdecl",
+- Doc: "report mismatches between assembly files and Go declarations",
+- Default: true,
+- },
+- {
+- Name: "assign",
+- Doc: "check for useless assignments\n\nThis checker reports assignments of the form x = x or a[i] = a[i].\nThese are almost always useless, and even when they aren't they are\nusually a mistake.",
+- Default: true,
+- },
+- {
+- Name: "atomic",
+- Doc: "check for common mistakes using the sync/atomic package\n\nThe atomic checker looks for assignment statements of the form:\n\n\tx = atomic.AddUint64(&x, 1)\n\nwhich are not atomic.",
+- Default: true,
+- },
+- {
+- Name: "atomicalign",
+- Doc: "check for non-64-bits-aligned arguments to sync/atomic functions",
+- Default: true,
+- },
+- {
+- Name: "bools",
+- Doc: "check for common mistakes involving boolean operators",
+- Default: true,
+- },
+- {
+- Name: "buildtag",
+- Doc: "check //go:build and // +build directives",
+- Default: true,
+- },
+- {
+- Name: "cgocall",
+- Doc: "detect some violations of the cgo pointer passing rules\n\nCheck for invalid cgo pointer passing.\nThis looks for code that uses cgo to call C code passing values\nwhose types are almost always invalid according to the cgo pointer\nsharing rules.\nSpecifically, it warns about attempts to pass a Go chan, map, func,\nor slice to C, either directly, or via a pointer, array, or struct.",
+- Default: true,
+- },
+- {
+- Name: "composites",
+- Doc: "check for unkeyed composite literals\n\nThis analyzer reports a diagnostic for composite literals of struct\ntypes imported from another package that do not use the field-keyed\nsyntax. Such literals are fragile because the addition of a new field\n(even if unexported) to the struct will cause compilation to fail.\n\nAs an example,\n\n\terr = &net.DNSConfigError{err}\n\nshould be replaced by:\n\n\terr = &net.DNSConfigError{Err: err}\n",
+- Default: true,
+- },
+- {
+- Name: "copylocks",
+- Doc: "check for locks erroneously passed by value\n\nInadvertently copying a value containing a lock, such as sync.Mutex or\nsync.WaitGroup, may cause both copies to malfunction. Generally such\nvalues should be referred to through a pointer.",
+- Default: true,
+- },
+- {
+- Name: "deepequalerrors",
+- Doc: "check for calls of reflect.DeepEqual on error values\n\nThe deepequalerrors checker looks for calls of the form:\n\n reflect.DeepEqual(err1, err2)\n\nwhere err1 and err2 are errors. Using reflect.DeepEqual to compare\nerrors is discouraged.",
+- Default: true,
+- },
+- {
+- Name: "directive",
+- Doc: "check Go toolchain directives such as //go:debug\n\nThis analyzer checks for problems with known Go toolchain directives\nin all Go source files in a package directory, even those excluded by\n//go:build constraints, and all non-Go source files too.\n\nFor //go:debug (see https://go.dev/doc/godebug), the analyzer checks\nthat the directives are placed only in Go source files, only above the\npackage comment, and only in package main or *_test.go files.\n\nSupport for other known directives may be added in the future.\n\nThis analyzer does not check //go:build, which is handled by the\nbuildtag analyzer.\n",
+- Default: true,
+- },
+- {
+- Name: "embed",
+- Doc: "check for //go:embed directive import\n\nThis analyzer checks that the embed package is imported when source code contains //go:embed comment directives.\nThe embed package must be imported for //go:embed directives to function.import _ \"embed\".",
+- Default: true,
+- },
+- {
+- Name: "errorsas",
+- Doc: "report passing non-pointer or non-error values to errors.As\n\nThe errorsas analysis reports calls to errors.As where the type\nof the second argument is not a pointer to a type implementing error.",
+- Default: true,
+- },
+- {
+- Name: "fieldalignment",
+- Doc: "find structs that would use less memory if their fields were sorted\n\nThis analyzer find structs that can be rearranged to use less memory, and provides\na suggested edit with the most compact order.\n\nNote that there are two different diagnostics reported. One checks struct size,\nand the other reports \"pointer bytes\" used. Pointer bytes is how many bytes of the\nobject that the garbage collector has to potentially scan for pointers, for example:\n\n\tstruct { uint32; string }\n\nhave 16 pointer bytes because the garbage collector has to scan up through the string's\ninner pointer.\n\n\tstruct { string; *uint32 }\n\nhas 24 pointer bytes because it has to scan further through the *uint32.\n\n\tstruct { string; uint32 }\n\nhas 8 because it can stop immediately after the string pointer.\n\nBe aware that the most compact order is not always the most efficient.\nIn rare cases it may cause two variables each updated by its own goroutine\nto occupy the same CPU cache line, inducing a form of memory contention\nknown as \"false sharing\" that slows down both goroutines.\n",
+- },
+- {
+- Name: "httpresponse",
+- Doc: "check for mistakes using HTTP responses\n\nA common mistake when using the net/http package is to defer a function\ncall to close the http.Response Body before checking the error that\ndetermines whether the response is valid:\n\n\tresp, err := http.Head(url)\n\tdefer resp.Body.Close()\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\t// (defer statement belongs here)\n\nThis checker helps uncover latent nil dereference bugs by reporting a\ndiagnostic for such mistakes.",
+- Default: true,
+- },
+- {
+- Name: "ifaceassert",
+- Doc: "detect impossible interface-to-interface type assertions\n\nThis checker flags type assertions v.(T) and corresponding type-switch cases\nin which the static type V of v is an interface that cannot possibly implement\nthe target interface T. This occurs when V and T contain methods with the same\nname but different signatures. Example:\n\n\tvar v interface {\n\t\tRead()\n\t}\n\t_ = v.(io.Reader)\n\nThe Read method in v has a different signature than the Read method in\nio.Reader, so this assertion cannot succeed.\n",
+- Default: true,
+- },
+- {
+- Name: "infertypeargs",
+- Doc: "check for unnecessary type arguments in call expressions\n\nExplicit type arguments may be omitted from call expressions if they can be\ninferred from function arguments, or from other type arguments:\n\n\tfunc f[T any](T) {}\n\t\n\tfunc _() {\n\t\tf[string](\"foo\") // string could be inferred\n\t}\n",
+- Default: true,
+- },
+- {
+- Name: "loopclosure",
+- Doc: "check references to loop variables from within nested functions\n\nThis analyzer reports places where a function literal references the\niteration variable of an enclosing loop, and the loop calls the function\nin such a way (e.g. with go or defer) that it may outlive the loop\niteration and possibly observe the wrong value of the variable.\n\nIn this example, all the deferred functions run after the loop has\ncompleted, so all observe the final value of v.\n\n for _, v := range list {\n defer func() {\n use(v) // incorrect\n }()\n }\n\nOne fix is to create a new variable for each iteration of the loop:\n\n for _, v := range list {\n v := v // new var per iteration\n defer func() {\n use(v) // ok\n }()\n }\n\nThe next example uses a go statement and has a similar problem.\nIn addition, it has a data race because the loop updates v\nconcurrent with the goroutines accessing it.\n\n for _, v := range elem {\n go func() {\n use(v) // incorrect, and a data race\n }()\n }\n\nA fix is the same as before. The checker also reports problems\nin goroutines started by golang.org/x/sync/errgroup.Group.\nA hard-to-spot variant of this form is common in parallel tests:\n\n func Test(t *testing.T) {\n for _, test := range tests {\n t.Run(test.name, func(t *testing.T) {\n t.Parallel()\n use(test) // incorrect, and a data race\n })\n }\n }\n\nThe t.Parallel() call causes the rest of the function to execute\nconcurrent with the loop.\n\nThe analyzer reports references only in the last statement,\nas it is not deep enough to understand the effects of subsequent\nstatements that might render the reference benign.\n(\"Last statement\" is defined recursively in compound\nstatements such as if, switch, and select.)\n\nSee: https://golang.org/doc/go_faq.html#closures_and_goroutines",
+- Default: true,
+- },
+- {
+- Name: "lostcancel",
+- Doc: "check cancel func returned by context.WithCancel is called\n\nThe cancellation function returned by context.WithCancel, WithTimeout,\nand WithDeadline must be called or the new context will remain live\nuntil its parent context is cancelled.\n(The background context is never cancelled.)",
+- Default: true,
+- },
+- {
+- Name: "nilfunc",
+- Doc: "check for useless comparisons between functions and nil\n\nA useless comparison is one like f == nil as opposed to f() == nil.",
+- Default: true,
+- },
+- {
+- Name: "nilness",
+- Doc: "check for redundant or impossible nil comparisons\n\nThe nilness checker inspects the control-flow graph of each function in\na package and reports nil pointer dereferences, degenerate nil\npointers, and panics with nil values. A degenerate comparison is of the form\nx==nil or x!=nil where x is statically known to be nil or non-nil. These are\noften a mistake, especially in control flow related to errors. Panics with nil\nvalues are checked because they are not detectable by\n\n\tif r := recover(); r != nil {\n\nThis check reports conditions such as:\n\n\tif f == nil { // impossible condition (f is a function)\n\t}\n\nand:\n\n\tp := &v\n\t...\n\tif p != nil { // tautological condition\n\t}\n\nand:\n\n\tif p == nil {\n\t\tprint(*p) // nil dereference\n\t}\n\nand:\n\n\tif p == nil {\n\t\tpanic(p)\n\t}\n",
+- },
+- {
+- Name: "printf",
+- Doc: "check consistency of Printf format strings and arguments\n\nThe check applies to known functions (for example, those in package fmt)\nas well as any detected wrappers of known functions.\n\nA function that wants to avail itself of printf checking but is not\nfound by this analyzer's heuristics (for example, due to use of\ndynamic calls) can insert a bogus call:\n\n\tif false {\n\t\t_ = fmt.Sprintf(format, args...) // enable printf checking\n\t}\n\nThe -funcs flag specifies a comma-separated list of names of additional\nknown formatting functions or methods. If the name contains a period,\nit must denote a specific function using one of the following forms:\n\n\tdir/pkg.Function\n\tdir/pkg.Type.Method\n\t(*dir/pkg.Type).Method\n\nOtherwise the name is interpreted as a case-insensitive unqualified\nidentifier such as \"errorf\". Either way, if a listed name ends in f, the\nfunction is assumed to be Printf-like, taking a format string before the\nargument list. Otherwise it is assumed to be Print-like, taking a list\nof arguments with no format string.\n",
+- Default: true,
+- },
+- {
+- Name: "shadow",
+- Doc: "check for possible unintended shadowing of variables\n\nThis analyzer check for shadowed variables.\nA shadowed variable is a variable declared in an inner scope\nwith the same name and type as a variable in an outer scope,\nand where the outer variable is mentioned after the inner one\nis declared.\n\n(This definition can be refined; the module generates too many\nfalse positives and is not yet enabled by default.)\n\nFor example:\n\n\tfunc BadRead(f *os.File, buf []byte) error {\n\t\tvar err error\n\t\tfor {\n\t\t\tn, err := f.Read(buf) // shadows the function variable 'err'\n\t\t\tif err != nil {\n\t\t\t\tbreak // causes return of wrong value\n\t\t\t}\n\t\t\tfoo(buf)\n\t\t}\n\t\treturn err\n\t}\n",
+- },
+- {
+- Name: "shift",
+- Doc: "check for shifts that equal or exceed the width of the integer",
+- Default: true,
+- },
+- {
+- Name: "simplifycompositelit",
+- Doc: "check for composite literal simplifications\n\nAn array, slice, or map composite literal of the form:\n\t[]T{T{}, T{}}\nwill be simplified to:\n\t[]T{{}, {}}\n\nThis is one of the simplifications that \"gofmt -s\" applies.",
+- Default: true,
+- },
+- {
+- Name: "simplifyrange",
+- Doc: "check for range statement simplifications\n\nA range of the form:\n\tfor x, _ = range v {...}\nwill be simplified to:\n\tfor x = range v {...}\n\nA range of the form:\n\tfor _ = range v {...}\nwill be simplified to:\n\tfor range v {...}\n\nThis is one of the simplifications that \"gofmt -s\" applies.",
+- Default: true,
+- },
+- {
+- Name: "simplifyslice",
+- Doc: "check for slice simplifications\n\nA slice expression of the form:\n\ts[a:len(s)]\nwill be simplified to:\n\ts[a:]\n\nThis is one of the simplifications that \"gofmt -s\" applies.",
+- Default: true,
+- },
+- {
+- Name: "sortslice",
+- Doc: "check the argument type of sort.Slice\n\nsort.Slice requires an argument of a slice type. Check that\nthe interface{} value passed to sort.Slice is actually a slice.",
+- Default: true,
+- },
+- {
+- Name: "stdmethods",
+- Doc: "check signature of methods of well-known interfaces\n\nSometimes a type may be intended to satisfy an interface but may fail to\ndo so because of a mistake in its method signature.\nFor example, the result of this WriteTo method should be (int64, error),\nnot error, to satisfy io.WriterTo:\n\n\ttype myWriterTo struct{...}\n func (myWriterTo) WriteTo(w io.Writer) error { ... }\n\nThis check ensures that each method whose name matches one of several\nwell-known interface methods from the standard library has the correct\nsignature for that interface.\n\nChecked method names include:\n\tFormat GobEncode GobDecode MarshalJSON MarshalXML\n\tPeek ReadByte ReadFrom ReadRune Scan Seek\n\tUnmarshalJSON UnreadByte UnreadRune WriteByte\n\tWriteTo\n",
+- Default: true,
+- },
+- {
+- Name: "stringintconv",
+- Doc: "check for string(int) conversions\n\nThis checker flags conversions of the form string(x) where x is an integer\n(but not byte or rune) type. Such conversions are discouraged because they\nreturn the UTF-8 representation of the Unicode code point x, and not a decimal\nstring representation of x as one might expect. Furthermore, if x denotes an\ninvalid code point, the conversion cannot be statically rejected.\n\nFor conversions that intend on using the code point, consider replacing them\nwith string(rune(x)). Otherwise, strconv.Itoa and its equivalents return the\nstring representation of the value in the desired base.\n",
+- Default: true,
+- },
+- {
+- Name: "structtag",
+- Doc: "check that struct field tags conform to reflect.StructTag.Get\n\nAlso report certain struct tags (json, xml) used with unexported fields.",
+- Default: true,
+- },
+- {
+- Name: "testinggoroutine",
+- Doc: "report calls to (*testing.T).Fatal from goroutines started by a test.\n\nFunctions that abruptly terminate a test, such as the Fatal, Fatalf, FailNow, and\nSkip{,f,Now} methods of *testing.T, must be called from the test goroutine itself.\nThis checker detects calls to these functions that occur within a goroutine\nstarted by the test. For example:\n\nfunc TestFoo(t *testing.T) {\n go func() {\n t.Fatal(\"oops\") // error: (*T).Fatal called from non-test goroutine\n }()\n}\n",
+- Default: true,
+- },
+- {
+- Name: "tests",
+- Doc: "check for common mistaken usages of tests and examples\n\nThe tests checker walks Test, Benchmark and Example functions checking\nmalformed names, wrong signatures and examples documenting non-existent\nidentifiers.\n\nPlease see the documentation for package testing in golang.org/pkg/testing\nfor the conventions that are enforced for Tests, Benchmarks, and Examples.",
+- Default: true,
+- },
+- {
+- Name: "timeformat",
+- Doc: "check for calls of (time.Time).Format or time.Parse with 2006-02-01\n\nThe timeformat checker looks for time formats with the 2006-02-01 (yyyy-dd-mm)\nformat. Internationally, \"yyyy-dd-mm\" does not occur in common calendar date\nstandards, and so it is more likely that 2006-01-02 (yyyy-mm-dd) was intended.\n",
+- Default: true,
+- },
+- {
+- Name: "unmarshal",
+- Doc: "report passing non-pointer or non-interface values to unmarshal\n\nThe unmarshal analysis reports calls to functions such as json.Unmarshal\nin which the argument type is not a pointer or an interface.",
+- Default: true,
+- },
+- {
+- Name: "unreachable",
+- Doc: "check for unreachable code\n\nThe unreachable analyzer finds statements that execution can never reach\nbecause they are preceded by an return statement, a call to panic, an\ninfinite loop, or similar constructs.",
+- Default: true,
+- },
+- {
+- Name: "unsafeptr",
+- Doc: "check for invalid conversions of uintptr to unsafe.Pointer\n\nThe unsafeptr analyzer reports likely incorrect uses of unsafe.Pointer\nto convert integers to pointers. A conversion from uintptr to\nunsafe.Pointer is invalid if it implies that there is a uintptr-typed\nword in memory that holds a pointer value, because that word will be\ninvisible to stack copying and to the garbage collector.",
+- Default: true,
+- },
+- {
+- Name: "unusedparams",
+- Doc: "check for unused parameters of functions\n\nThe unusedparams analyzer checks functions to see if there are\nany parameters that are not being used.\n\nTo reduce false positives it ignores:\n- methods\n- parameters that do not have a name or are underscored\n- functions in test files\n- functions with empty bodies or those with just a return stmt",
+- },
+- {
+- Name: "unusedresult",
+- Doc: "check for unused results of calls to some functions\n\nSome functions like fmt.Errorf return a result and have no side effects,\nso it is always a mistake to discard the result. This analyzer reports\ncalls to certain functions in which the result of the call is ignored.\n\nThe set of functions may be controlled using flags.",
+- Default: true,
+- },
+- {
+- Name: "unusedwrite",
+- Doc: "checks for unused writes\n\nThe analyzer reports instances of writes to struct fields and\narrays that are never read. Specifically, when a struct object\nor an array is copied, its elements are copied implicitly by\nthe compiler, and any element write to this copy does nothing\nwith the original object.\n\nFor example:\n\n\ttype T struct { x int }\n\tfunc f(input []T) {\n\t\tfor i, v := range input { // v is a copy\n\t\t\tv.x = i // unused write to field x\n\t\t}\n\t}\n\nAnother example is about non-pointer receiver:\n\n\ttype T struct { x int }\n\tfunc (t T) f() { // t is a copy\n\t\tt.x = i // unused write to field x\n\t}\n",
+- },
+- {
+- Name: "useany",
+- Doc: "check for constraints that could be simplified to \"any\"",
+- },
+- {
+- Name: "fillreturns",
+- Doc: "suggest fixes for errors due to an incorrect number of return values\n\nThis checker provides suggested fixes for type errors of the\ntype \"wrong number of return values (want %d, got %d)\". For example:\n\tfunc m() (int, string, *bool, error) {\n\t\treturn\n\t}\nwill turn into\n\tfunc m() (int, string, *bool, error) {\n\t\treturn 0, \"\", nil, nil\n\t}\n\nThis functionality is similar to https://github.com/sqs/goreturns.\n",
+- Default: true,
+- },
+- {
+- Name: "nonewvars",
+- Doc: "suggested fixes for \"no new vars on left side of :=\"\n\nThis checker provides suggested fixes for type errors of the\ntype \"no new vars on left side of :=\". For example:\n\tz := 1\n\tz := 2\nwill turn into\n\tz := 1\n\tz = 2\n",
+- Default: true,
+- },
+- {
+- Name: "noresultvalues",
+- Doc: "suggested fixes for unexpected return values\n\nThis checker provides suggested fixes for type errors of the\ntype \"no result values expected\" or \"too many return values\".\nFor example:\n\tfunc z() { return nil }\nwill turn into\n\tfunc z() { return }\n",
+- Default: true,
+- },
+- {
+- Name: "undeclaredname",
+- Doc: "suggested fixes for \"undeclared name: <>\"\n\nThis checker provides suggested fixes for type errors of the\ntype \"undeclared name: <>\". It will either insert a new statement,\nsuch as:\n\n\"<> := \"\n\nor a new function declaration, such as:\n\nfunc <>(inferred parameters) {\n\tpanic(\"implement me!\")\n}\n",
+- Default: true,
+- },
+- {
+- Name: "unusedvariable",
+- Doc: "check for unused variables\n\nThe unusedvariable analyzer suggests fixes for unused variables errors.\n",
+- },
+- {
+- Name: "fillstruct",
+- Doc: "note incomplete struct initializations\n\nThis analyzer provides diagnostics for any struct literals that do not have\nany fields initialized. Because the suggested fix for this analysis is\nexpensive to compute, callers should compute it separately, using the\nSuggestedFix function below.\n",
+- Default: true,
+- },
+- {
+- Name: "stubmethods",
+- Doc: "stub methods analyzer\n\nThis analyzer generates method stubs for concrete types\nin order to implement a target interface",
+- Default: true,
+- },
+- },
+- Hints: []*HintJSON{
+- {
+- Name: "assignVariableTypes",
+- Doc: "Enable/disable inlay hints for variable types in assign statements:\n```go\n\ti/* int*/, j/* int*/ := 0, len(r)-1\n```",
+- },
+- {
+- Name: "compositeLiteralFields",
+- Doc: "Enable/disable inlay hints for composite literal field names:\n```go\n\t{/*in: */\"Hello, world\", /*want: */\"dlrow ,olleH\"}\n```",
+- },
+- {
+- Name: "compositeLiteralTypes",
+- Doc: "Enable/disable inlay hints for composite literal types:\n```go\n\tfor _, c := range []struct {\n\t\tin, want string\n\t}{\n\t\t/*struct{ in string; want string }*/{\"Hello, world\", \"dlrow ,olleH\"},\n\t}\n```",
+- },
+- {
+- Name: "constantValues",
+- Doc: "Enable/disable inlay hints for constant values:\n```go\n\tconst (\n\t\tKindNone Kind = iota/* = 0*/\n\t\tKindPrint/* = 1*/\n\t\tKindPrintf/* = 2*/\n\t\tKindErrorf/* = 3*/\n\t)\n```",
+- },
+- {
+- Name: "functionTypeParameters",
+- Doc: "Enable/disable inlay hints for implicit type parameters on generic functions:\n```go\n\tmyFoo/*[int, string]*/(1, \"hello\")\n```",
+- },
+- {
+- Name: "parameterNames",
+- Doc: "Enable/disable inlay hints for parameter names:\n```go\n\tparseInt(/* str: */ \"123\", /* radix: */ 8)\n```",
+- },
+- {
+- Name: "rangeVariableTypes",
+- Doc: "Enable/disable inlay hints for variable types in range statements:\n```go\n\tfor k/* int*/, v/* string*/ := range []string{} {\n\t\tfmt.Println(k, v)\n\t}\n```",
+- },
+- },
+-}
+diff -urN a/gopls/internal/lsp/source/call_hierarchy.go b/gopls/internal/lsp/source/call_hierarchy.go
+--- a/gopls/internal/lsp/source/call_hierarchy.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/call_hierarchy.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,311 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "errors"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "path/filepath"
+-
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+-)
+-
+-// PrepareCallHierarchy returns an array of CallHierarchyItem for a file and the position within the file.
+-func PrepareCallHierarchy(ctx context.Context, snapshot Snapshot, fh FileHandle, pp protocol.Position) ([]protocol.CallHierarchyItem, error) {
+- ctx, done := event.Start(ctx, "source.PrepareCallHierarchy")
+- defer done()
+-
+- pkg, pgf, err := PackageForFile(ctx, snapshot, fh.URI(), NarrowestPackage)
+- if err != nil {
+- return nil, err
+- }
+- pos, err := pgf.PositionPos(pp)
+- if err != nil {
+- return nil, err
+- }
+-
+- _, obj, _ := referencedObject(pkg, pgf, pos)
+- if obj == nil {
+- return nil, nil
+- }
+-
+- if _, ok := obj.Type().Underlying().(*types.Signature); !ok {
+- return nil, nil
+- }
+-
+- declLoc, err := mapPosition(ctx, pkg.FileSet(), snapshot, obj.Pos(), adjustedObjEnd(obj))
+- if err != nil {
+- return nil, err
+- }
+- rng := declLoc.Range
+-
+- callHierarchyItem := protocol.CallHierarchyItem{
+- Name: obj.Name(),
+- Kind: protocol.Function,
+- Tags: []protocol.SymbolTag{},
+- Detail: fmt.Sprintf("%s • %s", obj.Pkg().Path(), filepath.Base(declLoc.URI.SpanURI().Filename())),
+- URI: declLoc.URI,
+- Range: rng,
+- SelectionRange: rng,
+- }
+- return []protocol.CallHierarchyItem{callHierarchyItem}, nil
+-}
+-
+-// IncomingCalls returns an array of CallHierarchyIncomingCall for a file and the position within the file.
+-func IncomingCalls(ctx context.Context, snapshot Snapshot, fh FileHandle, pos protocol.Position) ([]protocol.CallHierarchyIncomingCall, error) {
+- ctx, done := event.Start(ctx, "source.IncomingCalls")
+- defer done()
+-
+- refs, err := references(ctx, snapshot, fh, pos, false)
+- if err != nil {
+- if errors.Is(err, ErrNoIdentFound) || errors.Is(err, errNoObjectFound) {
+- return nil, nil
+- }
+- return nil, err
+- }
+-
+- // Group references by their enclosing function declaration.
+- incomingCalls := make(map[protocol.Location]*protocol.CallHierarchyIncomingCall)
+- for _, ref := range refs {
+- callItem, err := enclosingNodeCallItem(ctx, snapshot, ref.pkgPath, ref.location)
+- if err != nil {
+- event.Error(ctx, "error getting enclosing node", err, tag.Method.Of(string(ref.pkgPath)))
+- continue
+- }
+- loc := protocol.Location{
+- URI: callItem.URI,
+- Range: callItem.Range,
+- }
+- call, ok := incomingCalls[loc]
+- if !ok {
+- call = &protocol.CallHierarchyIncomingCall{From: callItem}
+- incomingCalls[loc] = call
+- }
+- call.FromRanges = append(call.FromRanges, ref.location.Range)
+- }
+-
+- // Flatten the map of pointers into a slice of values.
+- incomingCallItems := make([]protocol.CallHierarchyIncomingCall, 0, len(incomingCalls))
+- for _, callItem := range incomingCalls {
+- incomingCallItems = append(incomingCallItems, *callItem)
+- }
+- return incomingCallItems, nil
+-}
+-
+-// enclosingNodeCallItem creates a CallHierarchyItem representing the function call at loc.
+-func enclosingNodeCallItem(ctx context.Context, snapshot Snapshot, pkgPath PackagePath, loc protocol.Location) (protocol.CallHierarchyItem, error) {
+- // Parse the file containing the reference.
+- fh, err := snapshot.GetFile(ctx, loc.URI.SpanURI())
+- if err != nil {
+- return protocol.CallHierarchyItem{}, err
+- }
+- // TODO(adonovan): opt: before parsing, trim the bodies of functions
+- // that don't contain the reference, using either a scanner-based
+- // implementation such as https://go.dev/play/p/KUrObH1YkX8
+- // (~31% speedup), or a byte-oriented implementation (2x speedup).
+- pgf, err := snapshot.ParseGo(ctx, fh, ParseFull)
+- if err != nil {
+- return protocol.CallHierarchyItem{}, err
+- }
+- start, end, err := pgf.RangePos(loc.Range)
+- if err != nil {
+- return protocol.CallHierarchyItem{}, err
+- }
+-
+- // Find the enclosing function, if any, and the number of func literals in between.
+- var funcDecl *ast.FuncDecl
+- var funcLit *ast.FuncLit // innermost function literal
+- var litCount int
+- path, _ := astutil.PathEnclosingInterval(pgf.File, start, end)
+-outer:
+- for _, node := range path {
+- switch n := node.(type) {
+- case *ast.FuncDecl:
+- funcDecl = n
+- break outer
+- case *ast.FuncLit:
+- litCount++
+- if litCount > 1 {
+- continue
+- }
+- funcLit = n
+- }
+- }
+-
+- nameIdent := path[len(path)-1].(*ast.File).Name
+- kind := protocol.Package
+- if funcDecl != nil {
+- nameIdent = funcDecl.Name
+- kind = protocol.Function
+- }
+-
+- nameStart, nameEnd := nameIdent.Pos(), nameIdent.End()
+- if funcLit != nil {
+- nameStart, nameEnd = funcLit.Type.Func, funcLit.Type.Params.Pos()
+- kind = protocol.Function
+- }
+- rng, err := pgf.PosRange(nameStart, nameEnd)
+- if err != nil {
+- return protocol.CallHierarchyItem{}, err
+- }
+-
+- name := nameIdent.Name
+- for i := 0; i < litCount; i++ {
+- name += ".func()"
+- }
+-
+- return protocol.CallHierarchyItem{
+- Name: name,
+- Kind: kind,
+- Tags: []protocol.SymbolTag{},
+- Detail: fmt.Sprintf("%s • %s", pkgPath, filepath.Base(fh.URI().Filename())),
+- URI: loc.URI,
+- Range: rng,
+- SelectionRange: rng,
+- }, nil
+-}
+-
+-// OutgoingCalls returns an array of CallHierarchyOutgoingCall for a file and the position within the file.
+-func OutgoingCalls(ctx context.Context, snapshot Snapshot, fh FileHandle, pp protocol.Position) ([]protocol.CallHierarchyOutgoingCall, error) {
+- ctx, done := event.Start(ctx, "source.OutgoingCalls")
+- defer done()
+-
+- pkg, pgf, err := PackageForFile(ctx, snapshot, fh.URI(), NarrowestPackage)
+- if err != nil {
+- return nil, err
+- }
+- pos, err := pgf.PositionPos(pp)
+- if err != nil {
+- return nil, err
+- }
+-
+- _, obj, _ := referencedObject(pkg, pgf, pos)
+- if obj == nil {
+- return nil, nil
+- }
+-
+- if _, ok := obj.Type().Underlying().(*types.Signature); !ok {
+- return nil, nil
+- }
+-
+- // Skip builtins.
+- if obj.Pkg() == nil {
+- return nil, nil
+- }
+-
+- if !obj.Pos().IsValid() {
+- return nil, bug.Errorf("internal error: object %s.%s missing position", obj.Pkg().Path(), obj.Name())
+- }
+-
+- declFile := pkg.FileSet().File(obj.Pos())
+- if declFile == nil {
+- return nil, bug.Errorf("file not found for %d", obj.Pos())
+- }
+-
+- uri := span.URIFromPath(declFile.Name())
+- offset, err := safetoken.Offset(declFile, obj.Pos())
+- if err != nil {
+- return nil, err
+- }
+-
+- // Use TypecheckFull as we want to inspect the body of the function declaration.
+- declPkg, declPGF, err := PackageForFile(ctx, snapshot, uri, NarrowestPackage)
+- if err != nil {
+- return nil, err
+- }
+-
+- declPos, err := safetoken.Pos(declPGF.Tok, offset)
+- if err != nil {
+- return nil, err
+- }
+-
+- declNode, _, _ := findDeclInfo([]*ast.File{declPGF.File}, declPos)
+- if declNode == nil {
+- // TODO(rfindley): why don't we return an error here, or even bug.Errorf?
+- return nil, nil
+- // return nil, bug.Errorf("failed to find declaration for object %s.%s", obj.Pkg().Path(), obj.Name())
+- }
+-
+- type callRange struct {
+- start, end token.Pos
+- }
+- callRanges := []callRange{}
+- ast.Inspect(declNode, func(n ast.Node) bool {
+- if call, ok := n.(*ast.CallExpr); ok {
+- var start, end token.Pos
+- switch n := call.Fun.(type) {
+- case *ast.SelectorExpr:
+- start, end = n.Sel.NamePos, call.Lparen
+- case *ast.Ident:
+- start, end = n.NamePos, call.Lparen
+- case *ast.FuncLit:
+- // while we don't add the function literal as an 'outgoing' call
+- // we still want to traverse into it
+- return true
+- default:
+- // ignore any other kind of call expressions
+- // for ex: direct function literal calls since that's not an 'outgoing' call
+- return false
+- }
+- callRanges = append(callRanges, callRange{start: start, end: end})
+- }
+- return true
+- })
+-
+- outgoingCalls := map[token.Pos]*protocol.CallHierarchyOutgoingCall{}
+- for _, callRange := range callRanges {
+- _, obj, _ := referencedObject(declPkg, declPGF, callRange.start)
+- if obj == nil {
+- continue
+- }
+-
+- // ignore calls to builtin functions
+- if obj.Pkg() == nil {
+- continue
+- }
+-
+- outgoingCall, ok := outgoingCalls[obj.Pos()]
+- if !ok {
+- loc, err := mapPosition(ctx, declPkg.FileSet(), snapshot, obj.Pos(), obj.Pos()+token.Pos(len(obj.Name())))
+- if err != nil {
+- return nil, err
+- }
+- outgoingCall = &protocol.CallHierarchyOutgoingCall{
+- To: protocol.CallHierarchyItem{
+- Name: obj.Name(),
+- Kind: protocol.Function,
+- Tags: []protocol.SymbolTag{},
+- Detail: fmt.Sprintf("%s • %s", obj.Pkg().Path(), filepath.Base(loc.URI.SpanURI().Filename())),
+- URI: loc.URI,
+- Range: loc.Range,
+- SelectionRange: loc.Range,
+- },
+- }
+- outgoingCalls[obj.Pos()] = outgoingCall
+- }
+-
+- rng, err := declPGF.PosRange(callRange.start, callRange.end)
+- if err != nil {
+- return nil, err
+- }
+- outgoingCall.FromRanges = append(outgoingCall.FromRanges, rng)
+- }
+-
+- outgoingCallItems := make([]protocol.CallHierarchyOutgoingCall, 0, len(outgoingCalls))
+- for _, callItem := range outgoingCalls {
+- outgoingCallItems = append(outgoingCallItems, *callItem)
+- }
+- return outgoingCallItems, nil
+-}
+diff -urN a/gopls/internal/lsp/source/code_lens.go b/gopls/internal/lsp/source/code_lens.go
+--- a/gopls/internal/lsp/source/code_lens.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/code_lens.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,248 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "path/filepath"
+- "regexp"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-type LensFunc func(context.Context, Snapshot, FileHandle) ([]protocol.CodeLens, error)
+-
+-// LensFuncs returns the supported lensFuncs for Go files.
+-func LensFuncs() map[command.Command]LensFunc {
+- return map[command.Command]LensFunc{
+- command.Generate: goGenerateCodeLens,
+- command.Test: runTestCodeLens,
+- command.RegenerateCgo: regenerateCgoLens,
+- command.GCDetails: toggleDetailsCodeLens,
+- }
+-}
+-
+-var (
+- testRe = regexp.MustCompile("^Test[^a-z]")
+- benchmarkRe = regexp.MustCompile("^Benchmark[^a-z]")
+-)
+-
+-func runTestCodeLens(ctx context.Context, snapshot Snapshot, fh FileHandle) ([]protocol.CodeLens, error) {
+- codeLens := make([]protocol.CodeLens, 0)
+-
+- fns, err := TestsAndBenchmarks(ctx, snapshot, fh)
+- if err != nil {
+- return nil, err
+- }
+- puri := protocol.URIFromSpanURI(fh.URI())
+- for _, fn := range fns.Tests {
+- cmd, err := command.NewTestCommand("run test", puri, []string{fn.Name}, nil)
+- if err != nil {
+- return nil, err
+- }
+- rng := protocol.Range{Start: fn.Rng.Start, End: fn.Rng.Start}
+- codeLens = append(codeLens, protocol.CodeLens{Range: rng, Command: &cmd})
+- }
+-
+- for _, fn := range fns.Benchmarks {
+- cmd, err := command.NewTestCommand("run benchmark", puri, nil, []string{fn.Name})
+- if err != nil {
+- return nil, err
+- }
+- rng := protocol.Range{Start: fn.Rng.Start, End: fn.Rng.Start}
+- codeLens = append(codeLens, protocol.CodeLens{Range: rng, Command: &cmd})
+- }
+-
+- if len(fns.Benchmarks) > 0 {
+- pgf, err := snapshot.ParseGo(ctx, fh, ParseFull)
+- if err != nil {
+- return nil, err
+- }
+- // add a code lens to the top of the file which runs all benchmarks in the file
+- rng, err := pgf.PosRange(pgf.File.Package, pgf.File.Package)
+- if err != nil {
+- return nil, err
+- }
+- var benches []string
+- for _, fn := range fns.Benchmarks {
+- benches = append(benches, fn.Name)
+- }
+- cmd, err := command.NewTestCommand("run file benchmarks", puri, nil, benches)
+- if err != nil {
+- return nil, err
+- }
+- codeLens = append(codeLens, protocol.CodeLens{Range: rng, Command: &cmd})
+- }
+- return codeLens, nil
+-}
+-
+-type testFn struct {
+- Name string
+- Rng protocol.Range
+-}
+-
+-type testFns struct {
+- Tests []testFn
+- Benchmarks []testFn
+-}
+-
+-func TestsAndBenchmarks(ctx context.Context, snapshot Snapshot, fh FileHandle) (testFns, error) {
+- var out testFns
+-
+- if !strings.HasSuffix(fh.URI().Filename(), "_test.go") {
+- return out, nil
+- }
+- pkg, pgf, err := PackageForFile(ctx, snapshot, fh.URI(), NarrowestPackage)
+- if err != nil {
+- return out, err
+- }
+-
+- for _, d := range pgf.File.Decls {
+- fn, ok := d.(*ast.FuncDecl)
+- if !ok {
+- continue
+- }
+-
+- rng, err := pgf.NodeRange(fn)
+- if err != nil {
+- return out, err
+- }
+-
+- if matchTestFunc(fn, pkg, testRe, "T") {
+- out.Tests = append(out.Tests, testFn{fn.Name.Name, rng})
+- }
+-
+- if matchTestFunc(fn, pkg, benchmarkRe, "B") {
+- out.Benchmarks = append(out.Benchmarks, testFn{fn.Name.Name, rng})
+- }
+- }
+-
+- return out, nil
+-}
+-
+-func matchTestFunc(fn *ast.FuncDecl, pkg Package, nameRe *regexp.Regexp, paramID string) bool {
+- // Make sure that the function name matches a test function.
+- if !nameRe.MatchString(fn.Name.Name) {
+- return false
+- }
+- info := pkg.GetTypesInfo()
+- if info == nil {
+- return false
+- }
+- obj := info.ObjectOf(fn.Name)
+- if obj == nil {
+- return false
+- }
+- sig, ok := obj.Type().(*types.Signature)
+- if !ok {
+- return false
+- }
+- // Test functions should have only one parameter.
+- if sig.Params().Len() != 1 {
+- return false
+- }
+-
+- // Check the type of the only parameter
+- paramTyp, ok := sig.Params().At(0).Type().(*types.Pointer)
+- if !ok {
+- return false
+- }
+- named, ok := paramTyp.Elem().(*types.Named)
+- if !ok {
+- return false
+- }
+- namedObj := named.Obj()
+- if namedObj.Pkg().Path() != "testing" {
+- return false
+- }
+- return namedObj.Id() == paramID
+-}
+-
+-func goGenerateCodeLens(ctx context.Context, snapshot Snapshot, fh FileHandle) ([]protocol.CodeLens, error) {
+- pgf, err := snapshot.ParseGo(ctx, fh, ParseFull)
+- if err != nil {
+- return nil, err
+- }
+- const ggDirective = "//go:generate"
+- for _, c := range pgf.File.Comments {
+- for _, l := range c.List {
+- if !strings.HasPrefix(l.Text, ggDirective) {
+- continue
+- }
+- rng, err := pgf.PosRange(l.Pos(), l.Pos()+token.Pos(len(ggDirective)))
+- if err != nil {
+- return nil, err
+- }
+- dir := protocol.URIFromSpanURI(span.URIFromPath(filepath.Dir(fh.URI().Filename())))
+- nonRecursiveCmd, err := command.NewGenerateCommand("run go generate", command.GenerateArgs{Dir: dir, Recursive: false})
+- if err != nil {
+- return nil, err
+- }
+- recursiveCmd, err := command.NewGenerateCommand("run go generate ./...", command.GenerateArgs{Dir: dir, Recursive: true})
+- if err != nil {
+- return nil, err
+- }
+- return []protocol.CodeLens{
+- {Range: rng, Command: &recursiveCmd},
+- {Range: rng, Command: &nonRecursiveCmd},
+- }, nil
+-
+- }
+- }
+- return nil, nil
+-}
+-
+-func regenerateCgoLens(ctx context.Context, snapshot Snapshot, fh FileHandle) ([]protocol.CodeLens, error) {
+- pgf, err := snapshot.ParseGo(ctx, fh, ParseFull)
+- if err != nil {
+- return nil, err
+- }
+- var c *ast.ImportSpec
+- for _, imp := range pgf.File.Imports {
+- if imp.Path.Value == `"C"` {
+- c = imp
+- }
+- }
+- if c == nil {
+- return nil, nil
+- }
+- rng, err := pgf.NodeRange(c)
+- if err != nil {
+- return nil, err
+- }
+- puri := protocol.URIFromSpanURI(fh.URI())
+- cmd, err := command.NewRegenerateCgoCommand("regenerate cgo definitions", command.URIArg{URI: puri})
+- if err != nil {
+- return nil, err
+- }
+- return []protocol.CodeLens{{Range: rng, Command: &cmd}}, nil
+-}
+-
+-func toggleDetailsCodeLens(ctx context.Context, snapshot Snapshot, fh FileHandle) ([]protocol.CodeLens, error) {
+- pgf, err := snapshot.ParseGo(ctx, fh, ParseFull)
+- if err != nil {
+- return nil, err
+- }
+- if !pgf.File.Package.IsValid() {
+- // Without a package name we have nowhere to put the codelens, so give up.
+- return nil, nil
+- }
+- rng, err := pgf.PosRange(pgf.File.Package, pgf.File.Package)
+- if err != nil {
+- return nil, err
+- }
+- puri := protocol.URIFromSpanURI(fh.URI())
+- cmd, err := command.NewGCDetailsCommand("Toggle gc annotation details", puri)
+- if err != nil {
+- return nil, err
+- }
+- return []protocol.CodeLens{{Range: rng, Command: &cmd}}, nil
+-}
+diff -urN a/gopls/internal/lsp/source/comment.go b/gopls/internal/lsp/source/comment.go
+--- a/gopls/internal/lsp/source/comment.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/comment.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,384 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build !go1.19
+-// +build !go1.19
+-
+-package source
+-
+-import (
+- "bytes"
+- "io"
+- "regexp"
+- "strings"
+- "unicode"
+- "unicode/utf8"
+-)
+-
+-// CommentToMarkdown converts comment text to formatted markdown.
+-// The comment was prepared by DocReader,
+-// so it is known not to have leading, trailing blank lines
+-// nor to have trailing spaces at the end of lines.
+-// The comment markers have already been removed.
+-//
+-// Each line is converted into a markdown line and empty lines are just converted to
+-// newlines. Heading are prefixed with `### ` to make it a markdown heading.
+-//
+-// A span of indented lines retains a 4 space prefix block, with the common indent
+-// prefix removed unless empty, in which case it will be converted to a newline.
+-//
+-// URLs in the comment text are converted into links.
+-func CommentToMarkdown(text string, _ *Options) string {
+- buf := &bytes.Buffer{}
+- commentToMarkdown(buf, text)
+- return buf.String()
+-}
+-
+-var (
+- mdNewline = []byte("\n")
+- mdHeader = []byte("### ")
+- mdIndent = []byte(" ")
+- mdLinkStart = []byte("[")
+- mdLinkDiv = []byte("](")
+- mdLinkEnd = []byte(")")
+-)
+-
+-func commentToMarkdown(w io.Writer, text string) {
+- blocks := blocks(text)
+- for i, b := range blocks {
+- switch b.op {
+- case opPara:
+- for _, line := range b.lines {
+- emphasize(w, line, true)
+- }
+- case opHead:
+- // The header block can consist of only one line.
+- // However, check the number of lines, just in case.
+- if len(b.lines) == 0 {
+- // Skip this block.
+- continue
+- }
+- header := b.lines[0]
+-
+- w.Write(mdHeader)
+- commentEscape(w, header, true)
+- // Header doesn't end with \n unlike the lines of other blocks.
+- w.Write(mdNewline)
+- case opPre:
+- for _, line := range b.lines {
+- if isBlank(line) {
+- w.Write(mdNewline)
+- continue
+- }
+- w.Write(mdIndent)
+- w.Write([]byte(line))
+- }
+- }
+-
+- if i < len(blocks)-1 {
+- w.Write(mdNewline)
+- }
+- }
+-}
+-
+-const (
+- ulquo = "“"
+- urquo = "”"
+-)
+-
+-var (
+- markdownEscape = regexp.MustCompile(`([\\\x60*{}[\]()#+\-.!_>~|"$%&'\/:;<=?@^])`)
+-
+- unicodeQuoteReplacer = strings.NewReplacer("``", ulquo, "''", urquo)
+-)
+-
+-// commentEscape escapes comment text for markdown. If nice is set,
+-// also turn double ` and ' into “ and ”.
+-func commentEscape(w io.Writer, text string, nice bool) {
+- if nice {
+- text = convertQuotes(text)
+- }
+- text = escapeRegex(text)
+- w.Write([]byte(text))
+-}
+-
+-func convertQuotes(text string) string {
+- return unicodeQuoteReplacer.Replace(text)
+-}
+-
+-func escapeRegex(text string) string {
+- return markdownEscape.ReplaceAllString(text, `\$1`)
+-}
+-
+-func emphasize(w io.Writer, line string, nice bool) {
+- for {
+- m := matchRx.FindStringSubmatchIndex(line)
+- if m == nil {
+- break
+- }
+- // m >= 6 (two parenthesized sub-regexps in matchRx, 1st one is urlRx)
+-
+- // write text before match
+- commentEscape(w, line[0:m[0]], nice)
+-
+- // adjust match for URLs
+- match := line[m[0]:m[1]]
+- if strings.Contains(match, "://") {
+- m0, m1 := m[0], m[1]
+- for _, s := range []string{"()", "{}", "[]"} {
+- open, close := s[:1], s[1:] // E.g., "(" and ")"
+- // require opening parentheses before closing parentheses (#22285)
+- if i := strings.Index(match, close); i >= 0 && i < strings.Index(match, open) {
+- m1 = m0 + i
+- match = line[m0:m1]
+- }
+- // require balanced pairs of parentheses (#5043)
+- for i := 0; strings.Count(match, open) != strings.Count(match, close) && i < 10; i++ {
+- m1 = strings.LastIndexAny(line[:m1], s)
+- match = line[m0:m1]
+- }
+- }
+- if m1 != m[1] {
+- // redo matching with shortened line for correct indices
+- m = matchRx.FindStringSubmatchIndex(line[:m[0]+len(match)])
+- }
+- }
+-
+- // Following code has been modified from go/doc since words is always
+- // nil. All html formatting has also been transformed into markdown formatting
+-
+- // analyze match
+- url := ""
+- if m[2] >= 0 {
+- url = match
+- }
+-
+- // write match
+- if len(url) > 0 {
+- w.Write(mdLinkStart)
+- }
+-
+- commentEscape(w, match, nice)
+-
+- if len(url) > 0 {
+- w.Write(mdLinkDiv)
+- w.Write([]byte(urlReplacer.Replace(url)))
+- w.Write(mdLinkEnd)
+- }
+-
+- // advance
+- line = line[m[1]:]
+- }
+- commentEscape(w, line, nice)
+-}
+-
+-// Everything from here on is a copy of go/doc/comment.go
+-
+-const (
+- // Regexp for Go identifiers
+- identRx = `[\pL_][\pL_0-9]*`
+-
+- // Regexp for URLs
+- // Match parens, and check later for balance - see #5043, #22285
+- // Match .,:;?! within path, but not at end - see #18139, #16565
+- // This excludes some rare yet valid urls ending in common punctuation
+- // in order to allow sentences ending in URLs.
+-
+- // protocol (required) e.g. http
+- protoPart = `(https?|ftp|file|gopher|mailto|nntp)`
+- // host (required) e.g. www.example.com or [::1]:8080
+- hostPart = `([a-zA-Z0-9_@\-.\[\]:]+)`
+- // path+query+fragment (optional) e.g. /path/index.html?q=foo#bar
+- pathPart = `([.,:;?!]*[a-zA-Z0-9$'()*+&#=@~_/\-\[\]%])*`
+-
+- urlRx = protoPart + `://` + hostPart + pathPart
+-)
+-
+-var (
+- matchRx = regexp.MustCompile(`(` + urlRx + `)|(` + identRx + `)`)
+- urlReplacer = strings.NewReplacer(`(`, `\(`, `)`, `\)`)
+-)
+-
+-func indentLen(s string) int {
+- i := 0
+- for i < len(s) && (s[i] == ' ' || s[i] == '\t') {
+- i++
+- }
+- return i
+-}
+-
+-func isBlank(s string) bool {
+- return len(s) == 0 || (len(s) == 1 && s[0] == '\n')
+-}
+-
+-func commonPrefix(a, b string) string {
+- i := 0
+- for i < len(a) && i < len(b) && a[i] == b[i] {
+- i++
+- }
+- return a[0:i]
+-}
+-
+-func unindent(block []string) {
+- if len(block) == 0 {
+- return
+- }
+-
+- // compute maximum common white prefix
+- prefix := block[0][0:indentLen(block[0])]
+- for _, line := range block {
+- if !isBlank(line) {
+- prefix = commonPrefix(prefix, line)
+- }
+- }
+- n := len(prefix)
+-
+- // remove
+- for i, line := range block {
+- if !isBlank(line) {
+- block[i] = line[n:]
+- }
+- }
+-}
+-
+-// heading returns the trimmed line if it passes as a section heading;
+-// otherwise it returns the empty string.
+-func heading(line string) string {
+- line = strings.TrimSpace(line)
+- if len(line) == 0 {
+- return ""
+- }
+-
+- // a heading must start with an uppercase letter
+- r, _ := utf8.DecodeRuneInString(line)
+- if !unicode.IsLetter(r) || !unicode.IsUpper(r) {
+- return ""
+- }
+-
+- // it must end in a letter or digit:
+- r, _ = utf8.DecodeLastRuneInString(line)
+- if !unicode.IsLetter(r) && !unicode.IsDigit(r) {
+- return ""
+- }
+-
+- // exclude lines with illegal characters. we allow "(),"
+- if strings.ContainsAny(line, ";:!?+*/=[]{}_^°&§~%#@<\">\\") {
+- return ""
+- }
+-
+- // allow "'" for possessive "'s" only
+- for b := line; ; {
+- i := strings.IndexRune(b, '\'')
+- if i < 0 {
+- break
+- }
+- if i+1 >= len(b) || b[i+1] != 's' || (i+2 < len(b) && b[i+2] != ' ') {
+- return "" // not followed by "s "
+- }
+- b = b[i+2:]
+- }
+-
+- // allow "." when followed by non-space
+- for b := line; ; {
+- i := strings.IndexRune(b, '.')
+- if i < 0 {
+- break
+- }
+- if i+1 >= len(b) || b[i+1] == ' ' {
+- return "" // not followed by non-space
+- }
+- b = b[i+1:]
+- }
+-
+- return line
+-}
+-
+-type op int
+-
+-const (
+- opPara op = iota
+- opHead
+- opPre
+-)
+-
+-type block struct {
+- op op
+- lines []string
+-}
+-
+-func blocks(text string) []block {
+- var (
+- out []block
+- para []string
+-
+- lastWasBlank = false
+- lastWasHeading = false
+- )
+-
+- close := func() {
+- if para != nil {
+- out = append(out, block{opPara, para})
+- para = nil
+- }
+- }
+-
+- lines := strings.SplitAfter(text, "\n")
+- unindent(lines)
+- for i := 0; i < len(lines); {
+- line := lines[i]
+- if isBlank(line) {
+- // close paragraph
+- close()
+- i++
+- lastWasBlank = true
+- continue
+- }
+- if indentLen(line) > 0 {
+- // close paragraph
+- close()
+-
+- // count indented or blank lines
+- j := i + 1
+- for j < len(lines) && (isBlank(lines[j]) || indentLen(lines[j]) > 0) {
+- j++
+- }
+- // but not trailing blank lines
+- for j > i && isBlank(lines[j-1]) {
+- j--
+- }
+- pre := lines[i:j]
+- i = j
+-
+- unindent(pre)
+-
+- // put those lines in a pre block
+- out = append(out, block{opPre, pre})
+- lastWasHeading = false
+- continue
+- }
+-
+- if lastWasBlank && !lastWasHeading && i+2 < len(lines) &&
+- isBlank(lines[i+1]) && !isBlank(lines[i+2]) && indentLen(lines[i+2]) == 0 {
+- // current line is non-blank, surrounded by blank lines
+- // and the next non-blank line is not indented: this
+- // might be a heading.
+- if head := heading(line); head != "" {
+- close()
+- out = append(out, block{opHead, []string{head}})
+- i += 2
+- lastWasHeading = true
+- continue
+- }
+- }
+-
+- // open paragraph
+- lastWasBlank = false
+- lastWasHeading = false
+- para = append(para, lines[i])
+- i++
+- }
+- close()
+-
+- return out
+-}
+diff -urN a/gopls/internal/lsp/source/comment_go118_test.go b/gopls/internal/lsp/source/comment_go118_test.go
+--- a/gopls/internal/lsp/source/comment_go118_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/comment_go118_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,371 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build !go1.19
+-// +build !go1.19
+-
+-package source
+-
+-import (
+- "bytes"
+- "reflect"
+- "strings"
+- "testing"
+-)
+-
+-// This file is a copy of go/doc/comment_test.go with the exception for
+-// the test cases for TestEmphasize and TestCommentEscape
+-
+-var headingTests = []struct {
+- line string
+- ok bool
+-}{
+- {"Section", true},
+- {"A typical usage", true},
+- {"ΔΛΞ is Greek", true},
+- {"Foo 42", true},
+- {"", false},
+- {"section", false},
+- {"A typical usage:", false},
+- {"This code:", false},
+- {"δ is Greek", false},
+- {"Foo §", false},
+- {"Fermat's Last Sentence", true},
+- {"Fermat's", true},
+- {"'sX", false},
+- {"Ted 'Too' Bar", false},
+- {"Use n+m", false},
+- {"Scanning:", false},
+- {"N:M", false},
+-}
+-
+-func TestIsHeading(t *testing.T) {
+- for _, tt := range headingTests {
+- if h := heading(tt.line); (len(h) > 0) != tt.ok {
+- t.Errorf("isHeading(%q) = %v, want %v", tt.line, h, tt.ok)
+- }
+- }
+-}
+-
+-var blocksTests = []struct {
+- in string
+- out []block
+- text string
+-}{
+- {
+- in: `Para 1.
+-Para 1 line 2.
+-
+-Para 2.
+-
+-Section
+-
+-Para 3.
+-
+- pre
+- pre1
+-
+-Para 4.
+-
+- pre
+- pre1
+-
+- pre2
+-
+-Para 5.
+-
+-
+- pre
+-
+-
+- pre1
+- pre2
+-
+-Para 6.
+- pre
+- pre2
+-`,
+- out: []block{
+- {opPara, []string{"Para 1.\n", "Para 1 line 2.\n"}},
+- {opPara, []string{"Para 2.\n"}},
+- {opHead, []string{"Section"}},
+- {opPara, []string{"Para 3.\n"}},
+- {opPre, []string{"pre\n", "pre1\n"}},
+- {opPara, []string{"Para 4.\n"}},
+- {opPre, []string{"pre\n", "pre1\n", "\n", "pre2\n"}},
+- {opPara, []string{"Para 5.\n"}},
+- {opPre, []string{"pre\n", "\n", "\n", "pre1\n", "pre2\n"}},
+- {opPara, []string{"Para 6.\n"}},
+- {opPre, []string{"pre\n", "pre2\n"}},
+- },
+- text: `. Para 1. Para 1 line 2.
+-
+-. Para 2.
+-
+-
+-. Section
+-
+-. Para 3.
+-
+-$ pre
+-$ pre1
+-
+-. Para 4.
+-
+-$ pre
+-$ pre1
+-
+-$ pre2
+-
+-. Para 5.
+-
+-$ pre
+-
+-
+-$ pre1
+-$ pre2
+-
+-. Para 6.
+-
+-$ pre
+-$ pre2
+-`,
+- },
+- {
+- in: "Para.\n\tshould not be ``escaped''",
+- out: []block{
+- {opPara, []string{"Para.\n"}},
+- {opPre, []string{"should not be ``escaped''"}},
+- },
+- text: ". Para.\n\n$ should not be ``escaped''",
+- },
+- {
+- in: "// A very long line of 46 char for line wrapping.",
+- out: []block{
+- {opPara, []string{"// A very long line of 46 char for line wrapping."}},
+- },
+- text: `. // A very long line of 46 char for line
+-. // wrapping.
+-`,
+- },
+- {
+- in: `/* A very long line of 46 char for line wrapping.
+-A very long line of 46 char for line wrapping. */`,
+- out: []block{
+- {opPara, []string{"/* A very long line of 46 char for line wrapping.\n", "A very long line of 46 char for line wrapping. */"}},
+- },
+- text: `. /* A very long line of 46 char for line
+-. wrapping. A very long line of 46 char
+-. for line wrapping. */
+-`,
+- },
+-}
+-
+-func TestBlocks(t *testing.T) {
+- for i, tt := range blocksTests {
+- b := blocks(tt.in)
+- if !reflect.DeepEqual(b, tt.out) {
+- t.Errorf("#%d: mismatch\nhave: %v\nwant: %v", i, b, tt.out)
+- }
+- }
+-}
+-
+-// This has been modified from go/doc to use markdown links instead of html ones
+-// and use markdown escaping instead oh html
+-var emphasizeTests = []struct {
+- in, out string
+-}{
+- {"", ""},
+- {"http://[::1]:8080/foo.txt", `[http\:\/\/\[\:\:1\]\:8080\/foo\.txt](http://[::1]:8080/foo.txt)`},
+- {"before (https://www.google.com) after", `before \([https\:\/\/www\.google\.com](https://www.google.com)\) after`},
+- {"before https://www.google.com:30/x/y/z:b::c. After", `before [https\:\/\/www\.google\.com\:30\/x\/y\/z\:b\:\:c](https://www.google.com:30/x/y/z:b::c)\. After`},
+- {"http://www.google.com/path/:;!-/?query=%34b#093124", `[http\:\/\/www\.google\.com\/path\/\:\;\!\-\/\?query\=\%34b\#093124](http://www.google.com/path/:;!-/?query=%34b#093124)`},
+- {"http://www.google.com/path/:;!-/?query=%34bar#093124", `[http\:\/\/www\.google\.com\/path\/\:\;\!\-\/\?query\=\%34bar\#093124](http://www.google.com/path/:;!-/?query=%34bar#093124)`},
+- {"http://www.google.com/index.html! After", `[http\:\/\/www\.google\.com\/index\.html](http://www.google.com/index.html)\! After`},
+- {"http://www.google.com/", `[http\:\/\/www\.google\.com\/](http://www.google.com/)`},
+- {"https://www.google.com/", `[https\:\/\/www\.google\.com\/](https://www.google.com/)`},
+- {"http://www.google.com/path.", `[http\:\/\/www\.google\.com\/path](http://www.google.com/path)\.`},
+- {"http://en.wikipedia.org/wiki/Camellia_(cipher)", `[http\:\/\/en\.wikipedia\.org\/wiki\/Camellia\_\(cipher\)](http://en.wikipedia.org/wiki/Camellia_\(cipher\))`},
+- {"(http://www.google.com/)", `\([http\:\/\/www\.google\.com\/](http://www.google.com/)\)`},
+- {"http://gmail.com)", `[http\:\/\/gmail\.com](http://gmail.com)\)`},
+- {"((http://gmail.com))", `\(\([http\:\/\/gmail\.com](http://gmail.com)\)\)`},
+- {"http://gmail.com ((http://gmail.com)) ()", `[http\:\/\/gmail\.com](http://gmail.com) \(\([http\:\/\/gmail\.com](http://gmail.com)\)\) \(\)`},
+- {"Foo bar http://example.com/ quux!", `Foo bar [http\:\/\/example\.com\/](http://example.com/) quux\!`},
+- {"Hello http://example.com/%2f/ /world.", `Hello [http\:\/\/example\.com\/\%2f\/](http://example.com/%2f/) \/world\.`},
+- {"Lorem http: ipsum //host/path", `Lorem http\: ipsum \/\/host\/path`},
+- {"javascript://is/not/linked", `javascript\:\/\/is\/not\/linked`},
+- {"http://foo", `[http\:\/\/foo](http://foo)`},
+- {"art by [[https://www.example.com/person/][Person Name]]", `art by \[\[[https\:\/\/www\.example\.com\/person\/](https://www.example.com/person/)\]\[Person Name\]\]`},
+- {"please visit (http://golang.org/)", `please visit \([http\:\/\/golang\.org\/](http://golang.org/)\)`},
+- {"please visit http://golang.org/hello())", `please visit [http\:\/\/golang\.org\/hello\(\)](http://golang.org/hello\(\))\)`},
+- {"http://git.qemu.org/?p=qemu.git;a=blob;f=qapi-schema.json;hb=HEAD", `[http\:\/\/git\.qemu\.org\/\?p\=qemu\.git\;a\=blob\;f\=qapi\-schema\.json\;hb\=HEAD](http://git.qemu.org/?p=qemu.git;a=blob;f=qapi-schema.json;hb=HEAD)`},
+- {"https://foo.bar/bal/x(])", `[https\:\/\/foo\.bar\/bal\/x\(](https://foo.bar/bal/x\()\]\)`},
+- {"foo [ http://bar(])", `foo \[ [http\:\/\/bar\(](http://bar\()\]\)`},
+-}
+-
+-func TestEmphasize(t *testing.T) {
+- for i, tt := range emphasizeTests {
+- var buf bytes.Buffer
+- emphasize(&buf, tt.in, true)
+- out := buf.String()
+- if out != tt.out {
+- t.Errorf("#%d: mismatch\nhave: %v\nwant: %v", i, out, tt.out)
+- }
+- }
+-}
+-
+-func TestCommentEscape(t *testing.T) {
+- //ldquo -> ulquo and rdquo -> urquo
+- commentTests := []struct {
+- in, out string
+- }{
+- {"typically invoked as ``go tool asm'',", "typically invoked as " + ulquo + "go tool asm" + urquo + ","},
+- {"For more detail, run ``go help test'' and ``go help testflag''", "For more detail, run " + ulquo + "go help test" + urquo + " and " + ulquo + "go help testflag" + urquo}}
+- for i, tt := range commentTests {
+- var buf strings.Builder
+- commentEscape(&buf, tt.in, true)
+- out := buf.String()
+- if out != tt.out {
+- t.Errorf("#%d: mismatch\nhave: %q\nwant: %q", i, out, tt.out)
+- }
+- }
+-}
+-
+-func TestCommentToMarkdown(t *testing.T) {
+- tests := []struct {
+- in, out string
+- }{
+- {
+- in: "F declaration.\n",
+- out: "F declaration\\.\n",
+- },
+- {
+- in: `
+-F declaration. Lorem ipsum dolor sit amet.
+-Etiam mattis eros at orci mollis molestie.
+-`,
+- out: `
+-F declaration\. Lorem ipsum dolor sit amet\.
+-Etiam mattis eros at orci mollis molestie\.
+-`,
+- },
+- {
+- in: `
+-F declaration.
+-
+-Lorem ipsum dolor sit amet.
+-Sed id dui turpis.
+-
+-
+-
+-
+-Aenean tempus velit non auctor eleifend.
+-Aenean efficitur a sem id ultricies.
+-
+-
+-Phasellus efficitur mauris et viverra bibendum.
+-`,
+- out: `
+-F declaration\.
+-
+-Lorem ipsum dolor sit amet\.
+-Sed id dui turpis\.
+-
+-Aenean tempus velit non auctor eleifend\.
+-Aenean efficitur a sem id ultricies\.
+-
+-Phasellus efficitur mauris et viverra bibendum\.
+-`,
+- },
+- {
+- in: `
+-F declaration.
+-
+-Aenean tempus velit non auctor eleifend.
+-
+-Section
+-
+-Lorem ipsum dolor sit amet, consectetur adipiscing elit.
+-
+- func foo() {}
+-
+-
+- func bar() {}
+-
+-Fusce lorem lacus.
+-
+- func foo() {}
+-
+- func bar() {}
+-
+-Maecenas in lobortis lectus.
+-
+- func foo() {}
+-
+- func bar() {}
+-
+-Phasellus efficitur mauris et viverra bibendum.
+-`,
+- out: `
+-F declaration\.
+-
+-Aenean tempus velit non auctor eleifend\.
+-
+-### Section
+-
+-Lorem ipsum dolor sit amet, consectetur adipiscing elit\.
+-
+- func foo() {}
+-
+-
+- func bar() {}
+-
+-Fusce lorem lacus\.
+-
+- func foo() {}
+-
+- func bar() {}
+-
+-Maecenas in lobortis lectus\.
+-
+- func foo() {}
+-
+- func bar() {}
+-
+-Phasellus efficitur mauris et viverra bibendum\.
+-`,
+- },
+- {
+- in: `
+-F declaration.
+-
+- func foo() {
+- fmt.Println("foo")
+- }
+- func bar() {
+- fmt.Println("bar")
+- }
+-`,
+- out: `
+-F declaration\.
+-
+- func foo() {
+- fmt.Println("foo")
+- }
+- func bar() {
+- fmt.Println("bar")
+- }
+-`,
+- },
+- }
+- for i, tt := range tests {
+- // Comments start with new lines for better readability. So, we should trim them.
+- tt.in = strings.TrimPrefix(tt.in, "\n")
+- tt.out = strings.TrimPrefix(tt.out, "\n")
+-
+- if out := CommentToMarkdown(tt.in, nil); out != tt.out {
+- t.Errorf("#%d: mismatch\nhave: %q\nwant: %q", i, out, tt.out)
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/source/comment_go119.go b/gopls/internal/lsp/source/comment_go119.go
+--- a/gopls/internal/lsp/source/comment_go119.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/comment_go119.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,56 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.19
+-// +build go1.19
+-
+-package source
+-
+-// Starting with go1.19, the formatting of comments has changed, and there
+-// is a new package (go/doc/comment) for processing them.
+-// As long as gopls has to compile under earlier versions, tests
+-// have to pass with both the old and new code, which produce
+-// slightly different results. (cmd/test/definition.go, source/comment_test.go,
+-// and source/source_test.go) Each of the test files checks the results
+-// with a function, tests.CheckSameMarkdown, that accepts both the old and the new
+-// results. (The old code escapes many characters the new code does not,
+-// and the new code sometimes adds a blank line.)
+-
+-// When gopls no longer needs to compile with go1.18, the old comment.go should
+-// be replaced by this file, the golden test files should be updated.
+-// (and checkSameMarkdown() could be replaced by a simple comparison.)
+-
+-import (
+- "fmt"
+- "go/doc/comment"
+-)
+-
+-// CommentToMarkdown converts comment text to formatted markdown.
+-// The comment was prepared by DocReader,
+-// so it is known not to have leading, trailing blank lines
+-// nor to have trailing spaces at the end of lines.
+-// The comment markers have already been removed.
+-func CommentToMarkdown(text string, options *Options) string {
+- var p comment.Parser
+- doc := p.Parse(text)
+- var pr comment.Printer
+- // The default produces {#Hdr-...} tags for headings.
+- // vscode displays thems, which is undesirable.
+- // The godoc for comment.Printer says the tags
+- // avoid a security problem.
+- pr.HeadingID = func(*comment.Heading) string { return "" }
+- pr.DocLinkURL = func(link *comment.DocLink) string {
+- msg := fmt.Sprintf("https://%s/%s", options.LinkTarget, link.ImportPath)
+- if link.Name != "" {
+- msg += "#"
+- if link.Recv != "" {
+- msg += link.Recv + "."
+- }
+- msg += link.Name
+- }
+- return msg
+- }
+- easy := pr.Markdown(doc)
+- return string(easy)
+-}
+diff -urN a/gopls/internal/lsp/source/completion/builtin.go b/gopls/internal/lsp/source/completion/builtin.go
+--- a/gopls/internal/lsp/source/completion/builtin.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/builtin.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,147 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "context"
+- "go/ast"
+- "go/types"
+-)
+-
+-// builtinArgKind determines the expected object kind for a builtin
+-// argument. It attempts to use the AST hints from builtin.go where
+-// possible.
+-func (c *completer) builtinArgKind(ctx context.Context, obj types.Object, call *ast.CallExpr) objKind {
+- builtin, err := c.snapshot.BuiltinFile(ctx)
+- if err != nil {
+- return 0
+- }
+- exprIdx := exprAtPos(c.pos, call.Args)
+-
+- builtinObj := builtin.File.Scope.Lookup(obj.Name())
+- if builtinObj == nil {
+- return 0
+- }
+- decl, ok := builtinObj.Decl.(*ast.FuncDecl)
+- if !ok || exprIdx >= len(decl.Type.Params.List) {
+- return 0
+- }
+-
+- switch ptyp := decl.Type.Params.List[exprIdx].Type.(type) {
+- case *ast.ChanType:
+- return kindChan
+- case *ast.ArrayType:
+- return kindSlice
+- case *ast.MapType:
+- return kindMap
+- case *ast.Ident:
+- switch ptyp.Name {
+- case "Type":
+- switch obj.Name() {
+- case "make":
+- return kindChan | kindSlice | kindMap
+- case "len":
+- return kindSlice | kindMap | kindArray | kindString | kindChan
+- case "cap":
+- return kindSlice | kindArray | kindChan
+- }
+- }
+- }
+-
+- return 0
+-}
+-
+-// builtinArgType infers the type of an argument to a builtin
+-// function. parentInf is the inferred type info for the builtin
+-// call's parent node.
+-func (c *completer) builtinArgType(obj types.Object, call *ast.CallExpr, parentInf candidateInference) candidateInference {
+- var (
+- exprIdx = exprAtPos(c.pos, call.Args)
+-
+- // Propagate certain properties from our parent's inference.
+- inf = candidateInference{
+- typeName: parentInf.typeName,
+- modifiers: parentInf.modifiers,
+- }
+- )
+-
+- switch obj.Name() {
+- case "append":
+- if exprIdx <= 0 {
+- // Infer first append() arg type as apparent return type of
+- // append().
+- inf.objType = parentInf.objType
+- if parentInf.variadic {
+- inf.objType = types.NewSlice(inf.objType)
+- }
+- break
+- }
+-
+- // For non-initial append() args, infer slice type from the first
+- // append() arg, or from parent context.
+- if len(call.Args) > 0 {
+- inf.objType = c.pkg.GetTypesInfo().TypeOf(call.Args[0])
+- }
+- if inf.objType == nil {
+- inf.objType = parentInf.objType
+- }
+- if inf.objType == nil {
+- break
+- }
+-
+- inf.objType = deslice(inf.objType)
+-
+- // Check if we are completing the variadic append() param.
+- inf.variadic = exprIdx == 1 && len(call.Args) <= 2
+-
+- // Penalize the first append() argument as a candidate. You
+- // don't normally append a slice to itself.
+- if sliceChain := objChain(c.pkg.GetTypesInfo(), call.Args[0]); len(sliceChain) > 0 {
+- inf.penalized = append(inf.penalized, penalizedObj{objChain: sliceChain, penalty: 0.9})
+- }
+- case "delete":
+- if exprIdx > 0 && len(call.Args) > 0 {
+- // Try to fill in expected type of map key.
+- firstArgType := c.pkg.GetTypesInfo().TypeOf(call.Args[0])
+- if firstArgType != nil {
+- if mt, ok := firstArgType.Underlying().(*types.Map); ok {
+- inf.objType = mt.Key()
+- }
+- }
+- }
+- case "copy":
+- var t1, t2 types.Type
+- if len(call.Args) > 0 {
+- t1 = c.pkg.GetTypesInfo().TypeOf(call.Args[0])
+- if len(call.Args) > 1 {
+- t2 = c.pkg.GetTypesInfo().TypeOf(call.Args[1])
+- }
+- }
+-
+- // Fill in expected type of either arg if the other is already present.
+- if exprIdx == 1 && t1 != nil {
+- inf.objType = t1
+- } else if exprIdx == 0 && t2 != nil {
+- inf.objType = t2
+- }
+- case "new":
+- inf.typeName.wantTypeName = true
+- if parentInf.objType != nil {
+- // Expected type for "new" is the de-pointered parent type.
+- if ptr, ok := parentInf.objType.Underlying().(*types.Pointer); ok {
+- inf.objType = ptr.Elem()
+- }
+- }
+- case "make":
+- if exprIdx == 0 {
+- inf.typeName.wantTypeName = true
+- inf.objType = parentInf.objType
+- } else {
+- inf.objType = types.Typ[types.UntypedInt]
+- }
+- }
+-
+- return inf
+-}
+diff -urN a/gopls/internal/lsp/source/completion/completion.go b/gopls/internal/lsp/source/completion/completion.go
+--- a/gopls/internal/lsp/source/completion/completion.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/completion.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,3252 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package completion provides core functionality for code completion in Go
+-// editors and tools.
+-package completion
+-
+-import (
+- "bytes"
+- "context"
+- "fmt"
+- "go/ast"
+- "go/constant"
+- "go/parser"
+- "go/scanner"
+- "go/token"
+- "go/types"
+- "math"
+- "sort"
+- "strconv"
+- "strings"
+- "sync"
+- "sync/atomic"
+- "time"
+- "unicode"
+-
+- "golang.org/x/sync/errgroup"
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/lsp/snippet"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/fuzzy"
+- "golang.org/x/tools/internal/imports"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-// A CompletionItem represents a possible completion suggested by the algorithm.
+-type CompletionItem struct {
+-
+- // Invariant: CompletionItem does not refer to syntax or types.
+-
+- // Label is the primary text the user sees for this completion item.
+- Label string
+-
+- // Detail is supplemental information to present to the user.
+- // This often contains the type or return type of the completion item.
+- Detail string
+-
+- // InsertText is the text to insert if this item is selected.
+- // Any of the prefix that has already been typed is not trimmed.
+- // The insert text does not contain snippets.
+- InsertText string
+-
+- Kind protocol.CompletionItemKind
+- Tags []protocol.CompletionItemTag
+- Deprecated bool // Deprecated, prefer Tags if available
+-
+- // An optional array of additional TextEdits that are applied when
+- // selecting this completion.
+- //
+- // Additional text edits should be used to change text unrelated to the current cursor position
+- // (for example adding an import statement at the top of the file if the completion item will
+- // insert an unqualified type).
+- AdditionalTextEdits []protocol.TextEdit
+-
+- // Depth is how many levels were searched to find this completion.
+- // For example when completing "foo<>", "fooBar" is depth 0, and
+- // "fooBar.Baz" is depth 1.
+- Depth int
+-
+- // Score is the internal relevance score.
+- // A higher score indicates that this completion item is more relevant.
+- Score float64
+-
+- // snippet is the LSP snippet for the completion item. The LSP
+- // specification contains details about LSP snippets. For example, a
+- // snippet for a function with the following signature:
+- //
+- // func foo(a, b, c int)
+- //
+- // would be:
+- //
+- // foo(${1:a int}, ${2: b int}, ${3: c int})
+- //
+- // If Placeholders is false in the CompletionOptions, the above
+- // snippet would instead be:
+- //
+- // foo(${1:})
+- snippet *snippet.Builder
+-
+- // Documentation is the documentation for the completion item.
+- Documentation string
+-
+- // isSlice reports whether the underlying type of the object
+- // from which this candidate was derived is a slice.
+- // (Used to complete append() calls.)
+- isSlice bool
+-}
+-
+-// completionOptions holds completion specific configuration.
+-type completionOptions struct {
+- unimported bool
+- documentation bool
+- fullDocumentation bool
+- placeholders bool
+- literal bool
+- snippets bool
+- postfix bool
+- matcher source.Matcher
+- budget time.Duration
+-}
+-
+-// Snippet is a convenience returns the snippet if available, otherwise
+-// the InsertText.
+-// used for an item, depending on if the callee wants placeholders or not.
+-func (i *CompletionItem) Snippet() string {
+- if i.snippet != nil {
+- return i.snippet.String()
+- }
+- return i.InsertText
+-}
+-
+-// Scoring constants are used for weighting the relevance of different candidates.
+-const (
+- // stdScore is the base score for all completion items.
+- stdScore float64 = 1.0
+-
+- // highScore indicates a very relevant completion item.
+- highScore float64 = 10.0
+-
+- // lowScore indicates an irrelevant or not useful completion item.
+- lowScore float64 = 0.01
+-)
+-
+-// matcher matches a candidate's label against the user input. The
+-// returned score reflects the quality of the match. A score of zero
+-// indicates no match, and a score of one means a perfect match.
+-type matcher interface {
+- Score(candidateLabel string) (score float32)
+-}
+-
+-// prefixMatcher implements case sensitive prefix matching.
+-type prefixMatcher string
+-
+-func (pm prefixMatcher) Score(candidateLabel string) float32 {
+- if strings.HasPrefix(candidateLabel, string(pm)) {
+- return 1
+- }
+- return -1
+-}
+-
+-// insensitivePrefixMatcher implements case insensitive prefix matching.
+-type insensitivePrefixMatcher string
+-
+-func (ipm insensitivePrefixMatcher) Score(candidateLabel string) float32 {
+- if strings.HasPrefix(strings.ToLower(candidateLabel), string(ipm)) {
+- return 1
+- }
+- return -1
+-}
+-
+-// completer contains the necessary information for a single completion request.
+-type completer struct {
+- snapshot source.Snapshot
+- pkg source.Package
+- qf types.Qualifier // for qualifying typed expressions
+- mq source.MetadataQualifier // for syntactic qualifying
+- opts *completionOptions
+-
+- // completionContext contains information about the trigger for this
+- // completion request.
+- completionContext completionContext
+-
+- // fh is a handle to the file associated with this completion request.
+- fh source.FileHandle
+-
+- // filename is the name of the file associated with this completion request.
+- filename string
+-
+- // file is the AST of the file associated with this completion request.
+- file *ast.File
+-
+- // (tokFile, pos) is the position at which the request was triggered.
+- tokFile *token.File
+- pos token.Pos
+-
+- // path is the path of AST nodes enclosing the position.
+- path []ast.Node
+-
+- // seen is the map that ensures we do not return duplicate results.
+- seen map[types.Object]bool
+-
+- // items is the list of completion items returned.
+- items []CompletionItem
+-
+- // completionCallbacks is a list of callbacks to collect completions that
+- // require expensive operations. This includes operations where we search
+- // through the entire module cache.
+- completionCallbacks []func(opts *imports.Options) error
+-
+- // surrounding describes the identifier surrounding the position.
+- surrounding *Selection
+-
+- // inference contains information we've inferred about ideal
+- // candidates such as the candidate's type.
+- inference candidateInference
+-
+- // enclosingFunc contains information about the function enclosing
+- // the position.
+- enclosingFunc *funcInfo
+-
+- // enclosingCompositeLiteral contains information about the composite literal
+- // enclosing the position.
+- enclosingCompositeLiteral *compLitInfo
+-
+- // deepState contains the current state of our deep completion search.
+- deepState deepCompletionState
+-
+- // matcher matches the candidates against the surrounding prefix.
+- matcher matcher
+-
+- // methodSetCache caches the types.NewMethodSet call, which is relatively
+- // expensive and can be called many times for the same type while searching
+- // for deep completions.
+- methodSetCache map[methodSetKey]*types.MethodSet
+-
+- // mapper converts the positions in the file from which the completion originated.
+- mapper *protocol.Mapper
+-
+- // startTime is when we started processing this completion request. It does
+- // not include any time the request spent in the queue.
+- startTime time.Time
+-
+- // scopes contains all scopes defined by nodes in our path,
+- // including nil values for nodes that don't defined a scope. It
+- // also includes our package scope and the universal scope at the
+- // end.
+- scopes []*types.Scope
+-}
+-
+-// funcInfo holds info about a function object.
+-type funcInfo struct {
+- // sig is the function declaration enclosing the position.
+- sig *types.Signature
+-
+- // body is the function's body.
+- body *ast.BlockStmt
+-}
+-
+-type compLitInfo struct {
+- // cl is the *ast.CompositeLit enclosing the position.
+- cl *ast.CompositeLit
+-
+- // clType is the type of cl.
+- clType types.Type
+-
+- // kv is the *ast.KeyValueExpr enclosing the position, if any.
+- kv *ast.KeyValueExpr
+-
+- // inKey is true if we are certain the position is in the key side
+- // of a key-value pair.
+- inKey bool
+-
+- // maybeInFieldName is true if inKey is false and it is possible
+- // we are completing a struct field name. For example,
+- // "SomeStruct{<>}" will be inKey=false, but maybeInFieldName=true
+- // because we _could_ be completing a field name.
+- maybeInFieldName bool
+-}
+-
+-type importInfo struct {
+- importPath string
+- name string
+-}
+-
+-type methodSetKey struct {
+- typ types.Type
+- addressable bool
+-}
+-
+-type completionContext struct {
+- // triggerCharacter is the character used to trigger completion at current
+- // position, if any.
+- triggerCharacter string
+-
+- // triggerKind is information about how a completion was triggered.
+- triggerKind protocol.CompletionTriggerKind
+-
+- // commentCompletion is true if we are completing a comment.
+- commentCompletion bool
+-
+- // packageCompletion is true if we are completing a package name.
+- packageCompletion bool
+-}
+-
+-// A Selection represents the cursor position and surrounding identifier.
+-type Selection struct {
+- content string
+- tokFile *token.File
+- start, end, cursor token.Pos // relative to rng.TokFile
+- mapper *protocol.Mapper
+-}
+-
+-func (p Selection) Content() string {
+- return p.content
+-}
+-
+-func (p Selection) Range() (protocol.Range, error) {
+- return p.mapper.PosRange(p.tokFile, p.start, p.end)
+-}
+-
+-func (p Selection) Prefix() string {
+- return p.content[:p.cursor-p.start]
+-}
+-
+-func (p Selection) Suffix() string {
+- return p.content[p.cursor-p.start:]
+-}
+-
+-func (c *completer) setSurrounding(ident *ast.Ident) {
+- if c.surrounding != nil {
+- return
+- }
+- if !(ident.Pos() <= c.pos && c.pos <= ident.End()) {
+- return
+- }
+-
+- c.surrounding = &Selection{
+- content: ident.Name,
+- cursor: c.pos,
+- // Overwrite the prefix only.
+- tokFile: c.tokFile,
+- start: ident.Pos(),
+- end: ident.End(),
+- mapper: c.mapper,
+- }
+-
+- c.setMatcherFromPrefix(c.surrounding.Prefix())
+-}
+-
+-func (c *completer) setMatcherFromPrefix(prefix string) {
+- switch c.opts.matcher {
+- case source.Fuzzy:
+- c.matcher = fuzzy.NewMatcher(prefix)
+- case source.CaseSensitive:
+- c.matcher = prefixMatcher(prefix)
+- default:
+- c.matcher = insensitivePrefixMatcher(strings.ToLower(prefix))
+- }
+-}
+-
+-func (c *completer) getSurrounding() *Selection {
+- if c.surrounding == nil {
+- c.surrounding = &Selection{
+- content: "",
+- cursor: c.pos,
+- tokFile: c.tokFile,
+- start: c.pos,
+- end: c.pos,
+- mapper: c.mapper,
+- }
+- }
+- return c.surrounding
+-}
+-
+-// candidate represents a completion candidate.
+-type candidate struct {
+- // obj is the types.Object to complete to.
+- // TODO(adonovan): eliminate dependence on go/types throughout this struct.
+- obj types.Object
+-
+- // score is used to rank candidates.
+- score float64
+-
+- // name is the deep object name path, e.g. "foo.bar"
+- name string
+-
+- // detail is additional information about this item. If not specified,
+- // defaults to type string for the object.
+- detail string
+-
+- // path holds the path from the search root (excluding the candidate
+- // itself) for a deep candidate.
+- path []types.Object
+-
+- // pathInvokeMask is a bit mask tracking whether each entry in path
+- // should be formatted with "()" (i.e. whether it is a function
+- // invocation).
+- pathInvokeMask uint16
+-
+- // mods contains modifications that should be applied to the
+- // candidate when inserted. For example, "foo" may be inserted as
+- // "*foo" or "foo()".
+- mods []typeModKind
+-
+- // addressable is true if a pointer can be taken to the candidate.
+- addressable bool
+-
+- // convertTo is a type that this candidate should be cast to. For
+- // example, if convertTo is float64, "foo" should be formatted as
+- // "float64(foo)".
+- convertTo types.Type
+-
+- // imp is the import that needs to be added to this package in order
+- // for this candidate to be valid. nil if no import needed.
+- imp *importInfo
+-}
+-
+-func (c candidate) hasMod(mod typeModKind) bool {
+- for _, m := range c.mods {
+- if m == mod {
+- return true
+- }
+- }
+- return false
+-}
+-
+-// ErrIsDefinition is an error that informs the user they got no
+-// completions because they tried to complete the name of a new object
+-// being defined.
+-type ErrIsDefinition struct {
+- objStr string
+-}
+-
+-func (e ErrIsDefinition) Error() string {
+- msg := "this is a definition"
+- if e.objStr != "" {
+- msg += " of " + e.objStr
+- }
+- return msg
+-}
+-
+-// Completion returns a list of possible candidates for completion, given a
+-// a file and a position.
+-//
+-// The selection is computed based on the preceding identifier and can be used by
+-// the client to score the quality of the completion. For instance, some clients
+-// may tolerate imperfect matches as valid completion results, since users may make typos.
+-func Completion(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle, protoPos protocol.Position, protoContext protocol.CompletionContext) ([]CompletionItem, *Selection, error) {
+- ctx, done := event.Start(ctx, "completion.Completion")
+- defer done()
+-
+- startTime := time.Now()
+-
+- pkg, pgf, err := source.PackageForFile(ctx, snapshot, fh.URI(), source.NarrowestPackage)
+- if err != nil || pgf.File.Package == token.NoPos {
+- // If we can't parse this file or find position for the package
+- // keyword, it may be missing a package declaration. Try offering
+- // suggestions for the package declaration.
+- // Note that this would be the case even if the keyword 'package' is
+- // present but no package name exists.
+- items, surrounding, innerErr := packageClauseCompletions(ctx, snapshot, fh, protoPos)
+- if innerErr != nil {
+- // return the error for GetParsedFile since it's more relevant in this situation.
+- return nil, nil, fmt.Errorf("getting file %s for Completion: %w (package completions: %v)", fh.URI(), err, innerErr)
+- }
+- return items, surrounding, nil
+- }
+- pos, err := pgf.PositionPos(protoPos)
+- if err != nil {
+- return nil, nil, err
+- }
+- // Completion is based on what precedes the cursor.
+- // Find the path to the position before pos.
+- path, _ := astutil.PathEnclosingInterval(pgf.File, pos-1, pos-1)
+- if path == nil {
+- return nil, nil, fmt.Errorf("cannot find node enclosing position")
+- }
+-
+- // Check if completion at this position is valid. If not, return early.
+- switch n := path[0].(type) {
+- case *ast.BasicLit:
+- // Skip completion inside literals except for ImportSpec
+- if len(path) > 1 {
+- if _, ok := path[1].(*ast.ImportSpec); ok {
+- break
+- }
+- }
+- return nil, nil, nil
+- case *ast.CallExpr:
+- if n.Ellipsis.IsValid() && pos > n.Ellipsis && pos <= n.Ellipsis+token.Pos(len("...")) {
+- // Don't offer completions inside or directly after "...". For
+- // example, don't offer completions at "<>" in "foo(bar...<>").
+- return nil, nil, nil
+- }
+- case *ast.Ident:
+- // reject defining identifiers
+- if obj, ok := pkg.GetTypesInfo().Defs[n]; ok {
+- if v, ok := obj.(*types.Var); ok && v.IsField() && v.Embedded() {
+- // An anonymous field is also a reference to a type.
+- } else if pgf.File.Name == n {
+- // Don't skip completions if Ident is for package name.
+- break
+- } else {
+- objStr := ""
+- if obj != nil {
+- qual := types.RelativeTo(pkg.GetTypes())
+- objStr = types.ObjectString(obj, qual)
+- }
+- ans, sel := definition(path, obj, pgf)
+- if ans != nil {
+- sort.Slice(ans, func(i, j int) bool {
+- return ans[i].Score > ans[j].Score
+- })
+- return ans, sel, nil
+- }
+- return nil, nil, ErrIsDefinition{objStr: objStr}
+- }
+- }
+- }
+-
+- // Collect all surrounding scopes, innermost first.
+- scopes := source.CollectScopes(pkg.GetTypesInfo(), path, pos)
+- scopes = append(scopes, pkg.GetTypes().Scope(), types.Universe)
+-
+- opts := snapshot.View().Options()
+- c := &completer{
+- pkg: pkg,
+- snapshot: snapshot,
+- qf: source.Qualifier(pgf.File, pkg.GetTypes(), pkg.GetTypesInfo()),
+- mq: source.MetadataQualifierForFile(snapshot, pgf.File, pkg.Metadata()),
+- completionContext: completionContext{
+- triggerCharacter: protoContext.TriggerCharacter,
+- triggerKind: protoContext.TriggerKind,
+- },
+- fh: fh,
+- filename: fh.URI().Filename(),
+- tokFile: pgf.Tok,
+- file: pgf.File,
+- path: path,
+- pos: pos,
+- seen: make(map[types.Object]bool),
+- enclosingFunc: enclosingFunction(path, pkg.GetTypesInfo()),
+- enclosingCompositeLiteral: enclosingCompositeLiteral(path, pos, pkg.GetTypesInfo()),
+- deepState: deepCompletionState{
+- enabled: opts.DeepCompletion,
+- },
+- opts: &completionOptions{
+- matcher: opts.Matcher,
+- unimported: opts.CompleteUnimported,
+- documentation: opts.CompletionDocumentation && opts.HoverKind != source.NoDocumentation,
+- fullDocumentation: opts.HoverKind == source.FullDocumentation,
+- placeholders: opts.UsePlaceholders,
+- literal: opts.LiteralCompletions && opts.InsertTextFormat == protocol.SnippetTextFormat,
+- budget: opts.CompletionBudget,
+- snippets: opts.InsertTextFormat == protocol.SnippetTextFormat,
+- postfix: opts.ExperimentalPostfixCompletions,
+- },
+- // default to a matcher that always matches
+- matcher: prefixMatcher(""),
+- methodSetCache: make(map[methodSetKey]*types.MethodSet),
+- mapper: pgf.Mapper,
+- startTime: startTime,
+- scopes: scopes,
+- }
+-
+- var cancel context.CancelFunc
+- if c.opts.budget == 0 {
+- ctx, cancel = context.WithCancel(ctx)
+- } else {
+- // timeoutDuration is the completion budget remaining. If less than
+- // 10ms, set to 10ms
+- timeoutDuration := time.Until(c.startTime.Add(c.opts.budget))
+- if timeoutDuration < 10*time.Millisecond {
+- timeoutDuration = 10 * time.Millisecond
+- }
+- ctx, cancel = context.WithTimeout(ctx, timeoutDuration)
+- }
+- defer cancel()
+-
+- if surrounding := c.containingIdent(pgf.Src); surrounding != nil {
+- c.setSurrounding(surrounding)
+- }
+-
+- c.inference = expectedCandidate(ctx, c)
+-
+- err = c.collectCompletions(ctx)
+- if err != nil {
+- return nil, nil, err
+- }
+-
+- // Deep search collected candidates and their members for more candidates.
+- c.deepSearch(ctx)
+-
+- for _, callback := range c.completionCallbacks {
+- if err := c.snapshot.RunProcessEnvFunc(ctx, callback); err != nil {
+- return nil, nil, err
+- }
+- }
+-
+- // Search candidates populated by expensive operations like
+- // unimportedMembers etc. for more completion items.
+- c.deepSearch(ctx)
+-
+- // Statement candidates offer an entire statement in certain contexts, as
+- // opposed to a single object. Add statement candidates last because they
+- // depend on other candidates having already been collected.
+- c.addStatementCandidates()
+-
+- c.sortItems()
+- return c.items, c.getSurrounding(), nil
+-}
+-
+-// collectCompletions adds possible completion candidates to either the deep
+-// search queue or completion items directly for different completion contexts.
+-func (c *completer) collectCompletions(ctx context.Context) error {
+- // Inside import blocks, return completions for unimported packages.
+- for _, importSpec := range c.file.Imports {
+- if !(importSpec.Path.Pos() <= c.pos && c.pos <= importSpec.Path.End()) {
+- continue
+- }
+- return c.populateImportCompletions(ctx, importSpec)
+- }
+-
+- // Inside comments, offer completions for the name of the relevant symbol.
+- for _, comment := range c.file.Comments {
+- if comment.Pos() < c.pos && c.pos <= comment.End() {
+- c.populateCommentCompletions(ctx, comment)
+- return nil
+- }
+- }
+-
+- // Struct literals are handled entirely separately.
+- if c.wantStructFieldCompletions() {
+- // If we are definitely completing a struct field name, deep completions
+- // don't make sense.
+- if c.enclosingCompositeLiteral.inKey {
+- c.deepState.enabled = false
+- }
+- return c.structLiteralFieldName(ctx)
+- }
+-
+- if lt := c.wantLabelCompletion(); lt != labelNone {
+- c.labels(lt)
+- return nil
+- }
+-
+- if c.emptySwitchStmt() {
+- // Empty switch statements only admit "default" and "case" keywords.
+- c.addKeywordItems(map[string]bool{}, highScore, CASE, DEFAULT)
+- return nil
+- }
+-
+- switch n := c.path[0].(type) {
+- case *ast.Ident:
+- if c.file.Name == n {
+- return c.packageNameCompletions(ctx, c.fh.URI(), n)
+- } else if sel, ok := c.path[1].(*ast.SelectorExpr); ok && sel.Sel == n {
+- // Is this the Sel part of a selector?
+- return c.selector(ctx, sel)
+- }
+- return c.lexical(ctx)
+- // The function name hasn't been typed yet, but the parens are there:
+- // recv.‸(arg)
+- case *ast.TypeAssertExpr:
+- // Create a fake selector expression.
+- return c.selector(ctx, &ast.SelectorExpr{X: n.X})
+- case *ast.SelectorExpr:
+- return c.selector(ctx, n)
+- // At the file scope, only keywords are allowed.
+- case *ast.BadDecl, *ast.File:
+- c.addKeywordCompletions()
+- default:
+- // fallback to lexical completions
+- return c.lexical(ctx)
+- }
+-
+- return nil
+-}
+-
+-// containingIdent returns the *ast.Ident containing pos, if any. It
+-// synthesizes an *ast.Ident to allow completion in the face of
+-// certain syntax errors.
+-func (c *completer) containingIdent(src []byte) *ast.Ident {
+- // In the normal case, our leaf AST node is the identifier being completed.
+- if ident, ok := c.path[0].(*ast.Ident); ok {
+- return ident
+- }
+-
+- pos, tkn, lit := c.scanToken(src)
+- if !pos.IsValid() {
+- return nil
+- }
+-
+- fakeIdent := &ast.Ident{Name: lit, NamePos: pos}
+-
+- if _, isBadDecl := c.path[0].(*ast.BadDecl); isBadDecl {
+- // You don't get *ast.Idents at the file level, so look for bad
+- // decls and use the manually extracted token.
+- return fakeIdent
+- } else if c.emptySwitchStmt() {
+- // Only keywords are allowed in empty switch statements.
+- // *ast.Idents are not parsed, so we must use the manually
+- // extracted token.
+- return fakeIdent
+- } else if tkn.IsKeyword() {
+- // Otherwise, manually extract the prefix if our containing token
+- // is a keyword. This improves completion after an "accidental
+- // keyword", e.g. completing to "variance" in "someFunc(var<>)".
+- return fakeIdent
+- }
+-
+- return nil
+-}
+-
+-// scanToken scans pgh's contents for the token containing pos.
+-func (c *completer) scanToken(contents []byte) (token.Pos, token.Token, string) {
+- tok := c.pkg.FileSet().File(c.pos)
+-
+- var s scanner.Scanner
+- s.Init(tok, contents, nil, 0)
+- for {
+- tknPos, tkn, lit := s.Scan()
+- if tkn == token.EOF || tknPos >= c.pos {
+- return token.NoPos, token.ILLEGAL, ""
+- }
+-
+- if len(lit) > 0 && tknPos <= c.pos && c.pos <= tknPos+token.Pos(len(lit)) {
+- return tknPos, tkn, lit
+- }
+- }
+-}
+-
+-func (c *completer) sortItems() {
+- sort.SliceStable(c.items, func(i, j int) bool {
+- // Sort by score first.
+- if c.items[i].Score != c.items[j].Score {
+- return c.items[i].Score > c.items[j].Score
+- }
+-
+- // Then sort by label so order stays consistent. This also has the
+- // effect of preferring shorter candidates.
+- return c.items[i].Label < c.items[j].Label
+- })
+-}
+-
+-// emptySwitchStmt reports whether pos is in an empty switch or select
+-// statement.
+-func (c *completer) emptySwitchStmt() bool {
+- block, ok := c.path[0].(*ast.BlockStmt)
+- if !ok || len(block.List) > 0 || len(c.path) == 1 {
+- return false
+- }
+-
+- switch c.path[1].(type) {
+- case *ast.SwitchStmt, *ast.TypeSwitchStmt, *ast.SelectStmt:
+- return true
+- default:
+- return false
+- }
+-}
+-
+-// populateImportCompletions yields completions for an import path around the cursor.
+-//
+-// Completions are suggested at the directory depth of the given import path so
+-// that we don't overwhelm the user with a large list of possibilities. As an
+-// example, a completion for the prefix "golang" results in "golang.org/".
+-// Completions for "golang.org/" yield its subdirectories
+-// (i.e. "golang.org/x/"). The user is meant to accept completion suggestions
+-// until they reach a complete import path.
+-func (c *completer) populateImportCompletions(ctx context.Context, searchImport *ast.ImportSpec) error {
+- if !strings.HasPrefix(searchImport.Path.Value, `"`) {
+- return nil
+- }
+-
+- // deepSearch is not valuable for import completions.
+- c.deepState.enabled = false
+-
+- importPath := searchImport.Path.Value
+-
+- // Extract the text between the quotes (if any) in an import spec.
+- // prefix is the part of import path before the cursor.
+- prefixEnd := c.pos - searchImport.Path.Pos()
+- prefix := strings.Trim(importPath[:prefixEnd], `"`)
+-
+- // The number of directories in the import path gives us the depth at
+- // which to search.
+- depth := len(strings.Split(prefix, "/")) - 1
+-
+- content := importPath
+- start, end := searchImport.Path.Pos(), searchImport.Path.End()
+- namePrefix, nameSuffix := `"`, `"`
+- // If a starting quote is present, adjust surrounding to either after the
+- // cursor or after the first slash (/), except if cursor is at the starting
+- // quote. Otherwise we provide a completion including the starting quote.
+- if strings.HasPrefix(importPath, `"`) && c.pos > searchImport.Path.Pos() {
+- content = content[1:]
+- start++
+- if depth > 0 {
+- // Adjust textEdit start to replacement range. For ex: if current
+- // path was "golang.or/x/to<>ols/internal/", where <> is the cursor
+- // position, start of the replacement range would be after
+- // "golang.org/x/".
+- path := strings.SplitAfter(prefix, "/")
+- numChars := len(strings.Join(path[:len(path)-1], ""))
+- content = content[numChars:]
+- start += token.Pos(numChars)
+- }
+- namePrefix = ""
+- }
+-
+- // We won't provide an ending quote if one is already present, except if
+- // cursor is after the ending quote but still in import spec. This is
+- // because cursor has to be in our textEdit range.
+- if strings.HasSuffix(importPath, `"`) && c.pos < searchImport.Path.End() {
+- end--
+- content = content[:len(content)-1]
+- nameSuffix = ""
+- }
+-
+- c.surrounding = &Selection{
+- content: content,
+- cursor: c.pos,
+- tokFile: c.tokFile,
+- start: start,
+- end: end,
+- mapper: c.mapper,
+- }
+-
+- seenImports := make(map[string]struct{})
+- for _, importSpec := range c.file.Imports {
+- if importSpec.Path.Value == importPath {
+- continue
+- }
+- seenImportPath, err := strconv.Unquote(importSpec.Path.Value)
+- if err != nil {
+- return err
+- }
+- seenImports[seenImportPath] = struct{}{}
+- }
+-
+- var mu sync.Mutex // guard c.items locally, since searchImports is called in parallel
+- seen := make(map[string]struct{})
+- searchImports := func(pkg imports.ImportFix) {
+- path := pkg.StmtInfo.ImportPath
+- if _, ok := seenImports[path]; ok {
+- return
+- }
+-
+- // Any package path containing fewer directories than the search
+- // prefix is not a match.
+- pkgDirList := strings.Split(path, "/")
+- if len(pkgDirList) < depth+1 {
+- return
+- }
+- pkgToConsider := strings.Join(pkgDirList[:depth+1], "/")
+-
+- name := pkgDirList[depth]
+- // if we're adding an opening quote to completion too, set name to full
+- // package path since we'll need to overwrite that range.
+- if namePrefix == `"` {
+- name = pkgToConsider
+- }
+-
+- score := pkg.Relevance
+- if len(pkgDirList)-1 == depth {
+- score *= highScore
+- } else {
+- // For incomplete package paths, add a terminal slash to indicate that the
+- // user should keep triggering completions.
+- name += "/"
+- pkgToConsider += "/"
+- }
+-
+- if _, ok := seen[pkgToConsider]; ok {
+- return
+- }
+- seen[pkgToConsider] = struct{}{}
+-
+- mu.Lock()
+- defer mu.Unlock()
+-
+- name = namePrefix + name + nameSuffix
+- obj := types.NewPkgName(0, nil, name, types.NewPackage(pkgToConsider, name))
+- c.deepState.enqueue(candidate{
+- obj: obj,
+- detail: fmt.Sprintf("%q", pkgToConsider),
+- score: score,
+- })
+- }
+-
+- c.completionCallbacks = append(c.completionCallbacks, func(opts *imports.Options) error {
+- return imports.GetImportPaths(ctx, searchImports, prefix, c.filename, c.pkg.GetTypes().Name(), opts.Env)
+- })
+- return nil
+-}
+-
+-// populateCommentCompletions yields completions for comments preceding or in declarations.
+-func (c *completer) populateCommentCompletions(ctx context.Context, comment *ast.CommentGroup) {
+- // If the completion was triggered by a period, ignore it. These types of
+- // completions will not be useful in comments.
+- if c.completionContext.triggerCharacter == "." {
+- return
+- }
+-
+- // Using the comment position find the line after
+- file := c.pkg.FileSet().File(comment.End())
+- if file == nil {
+- return
+- }
+-
+- // Deep completion doesn't work properly in comments since we don't
+- // have a type object to complete further.
+- c.deepState.enabled = false
+- c.completionContext.commentCompletion = true
+-
+- // Documentation isn't useful in comments, since it might end up being the
+- // comment itself.
+- c.opts.documentation = false
+-
+- commentLine := file.Line(comment.End())
+-
+- // comment is valid, set surrounding as word boundaries around cursor
+- c.setSurroundingForComment(comment)
+-
+- // Using the next line pos, grab and parse the exported symbol on that line
+- for _, n := range c.file.Decls {
+- declLine := file.Line(n.Pos())
+- // if the comment is not in, directly above or on the same line as a declaration
+- if declLine != commentLine && declLine != commentLine+1 &&
+- !(n.Pos() <= comment.Pos() && comment.End() <= n.End()) {
+- continue
+- }
+- switch node := n.(type) {
+- // handle const, vars, and types
+- case *ast.GenDecl:
+- for _, spec := range node.Specs {
+- switch spec := spec.(type) {
+- case *ast.ValueSpec:
+- for _, name := range spec.Names {
+- if name.String() == "_" {
+- continue
+- }
+- obj := c.pkg.GetTypesInfo().ObjectOf(name)
+- c.deepState.enqueue(candidate{obj: obj, score: stdScore})
+- }
+- case *ast.TypeSpec:
+- // add TypeSpec fields to completion
+- switch typeNode := spec.Type.(type) {
+- case *ast.StructType:
+- c.addFieldItems(ctx, typeNode.Fields)
+- case *ast.FuncType:
+- c.addFieldItems(ctx, typeNode.Params)
+- c.addFieldItems(ctx, typeNode.Results)
+- case *ast.InterfaceType:
+- c.addFieldItems(ctx, typeNode.Methods)
+- }
+-
+- if spec.Name.String() == "_" {
+- continue
+- }
+-
+- obj := c.pkg.GetTypesInfo().ObjectOf(spec.Name)
+- // Type name should get a higher score than fields but not highScore by default
+- // since field near a comment cursor gets a highScore
+- score := stdScore * 1.1
+- // If type declaration is on the line after comment, give it a highScore.
+- if declLine == commentLine+1 {
+- score = highScore
+- }
+-
+- c.deepState.enqueue(candidate{obj: obj, score: score})
+- }
+- }
+- // handle functions
+- case *ast.FuncDecl:
+- c.addFieldItems(ctx, node.Recv)
+- c.addFieldItems(ctx, node.Type.Params)
+- c.addFieldItems(ctx, node.Type.Results)
+-
+- // collect receiver struct fields
+- if node.Recv != nil {
+- for _, fields := range node.Recv.List {
+- for _, name := range fields.Names {
+- obj := c.pkg.GetTypesInfo().ObjectOf(name)
+- if obj == nil {
+- continue
+- }
+-
+- recvType := obj.Type().Underlying()
+- if ptr, ok := recvType.(*types.Pointer); ok {
+- recvType = ptr.Elem()
+- }
+- recvStruct, ok := recvType.Underlying().(*types.Struct)
+- if !ok {
+- continue
+- }
+- for i := 0; i < recvStruct.NumFields(); i++ {
+- field := recvStruct.Field(i)
+- c.deepState.enqueue(candidate{obj: field, score: lowScore})
+- }
+- }
+- }
+- }
+-
+- if node.Name.String() == "_" {
+- continue
+- }
+-
+- obj := c.pkg.GetTypesInfo().ObjectOf(node.Name)
+- if obj == nil || obj.Pkg() != nil && obj.Pkg() != c.pkg.GetTypes() {
+- continue
+- }
+-
+- c.deepState.enqueue(candidate{obj: obj, score: highScore})
+- }
+- }
+-}
+-
+-// sets word boundaries surrounding a cursor for a comment
+-func (c *completer) setSurroundingForComment(comments *ast.CommentGroup) {
+- var cursorComment *ast.Comment
+- for _, comment := range comments.List {
+- if c.pos >= comment.Pos() && c.pos <= comment.End() {
+- cursorComment = comment
+- break
+- }
+- }
+- // if cursor isn't in the comment
+- if cursorComment == nil {
+- return
+- }
+-
+- // index of cursor in comment text
+- cursorOffset := int(c.pos - cursorComment.Pos())
+- start, end := cursorOffset, cursorOffset
+- for start > 0 && isValidIdentifierChar(cursorComment.Text[start-1]) {
+- start--
+- }
+- for end < len(cursorComment.Text) && isValidIdentifierChar(cursorComment.Text[end]) {
+- end++
+- }
+-
+- c.surrounding = &Selection{
+- content: cursorComment.Text[start:end],
+- cursor: c.pos,
+- tokFile: c.tokFile,
+- start: token.Pos(int(cursorComment.Slash) + start),
+- end: token.Pos(int(cursorComment.Slash) + end),
+- mapper: c.mapper,
+- }
+- c.setMatcherFromPrefix(c.surrounding.Prefix())
+-}
+-
+-// isValidIdentifierChar returns true if a byte is a valid go identifier
+-// character, i.e. unicode letter or digit or underscore.
+-func isValidIdentifierChar(char byte) bool {
+- charRune := rune(char)
+- return unicode.In(charRune, unicode.Letter, unicode.Digit) || char == '_'
+-}
+-
+-// adds struct fields, interface methods, function declaration fields to completion
+-func (c *completer) addFieldItems(ctx context.Context, fields *ast.FieldList) {
+- if fields == nil {
+- return
+- }
+-
+- cursor := c.surrounding.cursor
+- for _, field := range fields.List {
+- for _, name := range field.Names {
+- if name.String() == "_" {
+- continue
+- }
+- obj := c.pkg.GetTypesInfo().ObjectOf(name)
+- if obj == nil {
+- continue
+- }
+-
+- // if we're in a field comment/doc, score that field as more relevant
+- score := stdScore
+- if field.Comment != nil && field.Comment.Pos() <= cursor && cursor <= field.Comment.End() {
+- score = highScore
+- } else if field.Doc != nil && field.Doc.Pos() <= cursor && cursor <= field.Doc.End() {
+- score = highScore
+- }
+-
+- c.deepState.enqueue(candidate{obj: obj, score: score})
+- }
+- }
+-}
+-
+-func (c *completer) wantStructFieldCompletions() bool {
+- clInfo := c.enclosingCompositeLiteral
+- if clInfo == nil {
+- return false
+- }
+-
+- return clInfo.isStruct() && (clInfo.inKey || clInfo.maybeInFieldName)
+-}
+-
+-func (c *completer) wantTypeName() bool {
+- return !c.completionContext.commentCompletion && c.inference.typeName.wantTypeName
+-}
+-
+-// See https://golang.org/issue/36001. Unimported completions are expensive.
+-const (
+- maxUnimportedPackageNames = 5
+- unimportedMemberTarget = 100
+-)
+-
+-// selector finds completions for the specified selector expression.
+-func (c *completer) selector(ctx context.Context, sel *ast.SelectorExpr) error {
+- c.inference.objChain = objChain(c.pkg.GetTypesInfo(), sel.X)
+-
+- // True selector?
+- if tv, ok := c.pkg.GetTypesInfo().Types[sel.X]; ok {
+- c.methodsAndFields(tv.Type, tv.Addressable(), nil, c.deepState.enqueue)
+- c.addPostfixSnippetCandidates(ctx, sel)
+- return nil
+- }
+-
+- id, ok := sel.X.(*ast.Ident)
+- if !ok {
+- return nil
+- }
+-
+- // Treat sel as a qualified identifier.
+- var filter func(*source.Metadata) bool
+- needImport := false
+- if pkgName, ok := c.pkg.GetTypesInfo().Uses[id].(*types.PkgName); ok {
+- // Qualified identifier with import declaration.
+- imp := pkgName.Imported()
+-
+- // Known direct dependency? Expand using type information.
+- if _, ok := c.pkg.Metadata().DepsByPkgPath[source.PackagePath(imp.Path())]; ok {
+- c.packageMembers(imp, stdScore, nil, c.deepState.enqueue)
+- return nil
+- }
+-
+- // Imported declaration with missing type information.
+- // Fall through to shallow completion of unimported package members.
+- // Match candidate packages by path.
+- // TODO(adonovan): simplify by merging with else case and matching on name only?
+- filter = func(m *source.Metadata) bool {
+- return strings.TrimPrefix(string(m.PkgPath), "vendor/") == imp.Path()
+- }
+- } else {
+- // Qualified identifier without import declaration.
+- // Match candidate packages by name.
+- filter = func(m *source.Metadata) bool {
+- return string(m.Name) == id.Name
+- }
+- needImport = true
+- }
+-
+- // Search unimported packages.
+- if !c.opts.unimported {
+- return nil // feature disabled
+- }
+-
+- // The deep completion algorithm is exceedingly complex and
+- // deeply coupled to the now obsolete notions that all
+- // token.Pos values can be interpreted by as a single FileSet
+- // belonging to the Snapshot and that all types.Object values
+- // are canonicalized by a single types.Importer mapping.
+- // These invariants are no longer true now that gopls uses
+- // an incremental approach, parsing and type-checking each
+- // package separately.
+- //
+- // Consequently, completion of symbols defined in packages that
+- // are not currently imported by the query file cannot use the
+- // deep completion machinery which is based on type information.
+- // Instead it must use only syntax information from a quick
+- // parse of top-level declarations (but not function bodies).
+- //
+- // TODO(adonovan): rewrite the deep completion machinery to
+- // not assume global Pos/Object realms and then use export
+- // data instead of the quick parse approach taken here.
+-
+- // First, we search among packages in the workspace.
+- // We'll use a fast parse to extract package members
+- // from those that match the name/path criterion.
+- all, err := c.snapshot.AllMetadata(ctx)
+- if err != nil {
+- return err
+- }
+- var paths []string
+- known := make(map[source.PackagePath][]*source.Metadata) // may include test variant
+- for _, m := range all {
+- if m.IsIntermediateTestVariant() || m.Name == "main" || !filter(m) {
+- continue
+- }
+- known[m.PkgPath] = append(known[m.PkgPath], m)
+- paths = append(paths, string(m.PkgPath))
+- }
+-
+- // Rank import paths as goimports would.
+- var relevances map[string]float64
+- if len(paths) > 0 {
+- if err := c.snapshot.RunProcessEnvFunc(ctx, func(opts *imports.Options) error {
+- var err error
+- relevances, err = imports.ScoreImportPaths(ctx, opts.Env, paths)
+- return err
+- }); err != nil {
+- return err
+- }
+- sort.Slice(paths, func(i, j int) bool {
+- return relevances[paths[i]] > relevances[paths[j]]
+- })
+- }
+-
+- // quickParse does a quick parse of a single file of package m,
+- // extracts exported package members and adds candidates to c.items.
+- var itemsMu sync.Mutex // guards c.items
+- var enough int32 // atomic bool
+- quickParse := func(uri span.URI, m *source.Metadata) error {
+- if atomic.LoadInt32(&enough) != 0 {
+- return nil
+- }
+-
+- fh, err := c.snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return err
+- }
+- content, err := fh.Read()
+- if err != nil {
+- return err
+- }
+- path := string(m.PkgPath)
+- forEachPackageMember(content, func(tok token.Token, id *ast.Ident, fn *ast.FuncDecl) {
+- if atomic.LoadInt32(&enough) != 0 {
+- return
+- }
+-
+- if !id.IsExported() ||
+- sel.Sel.Name != "_" && !strings.HasPrefix(id.Name, sel.Sel.Name) {
+- return // not a match
+- }
+-
+- // The only detail is the kind and package: `var (from "example.com/foo")`
+- // TODO(adonovan): pretty-print FuncDecl.FuncType or TypeSpec.Type?
+- item := CompletionItem{
+- Label: id.Name,
+- Detail: fmt.Sprintf("%s (from %q)", strings.ToLower(tok.String()), m.PkgPath),
+- InsertText: id.Name,
+- Score: unimportedScore(relevances[path]),
+- }
+- switch tok {
+- case token.FUNC:
+- item.Kind = protocol.FunctionCompletion
+- case token.VAR:
+- item.Kind = protocol.VariableCompletion
+- case token.CONST:
+- item.Kind = protocol.ConstantCompletion
+- case token.TYPE:
+- // Without types, we can't distinguish Class from Interface.
+- item.Kind = protocol.ClassCompletion
+- }
+-
+- if needImport {
+- imp := &importInfo{importPath: path}
+- if imports.ImportPathToAssumedName(path) != string(m.Name) {
+- imp.name = string(m.Name)
+- }
+- item.AdditionalTextEdits, _ = c.importEdits(imp)
+- }
+-
+- // For functions, add a parameter snippet.
+- if fn != nil {
+- var sn snippet.Builder
+- sn.WriteText(id.Name)
+- sn.WriteText("(")
+- var nparams int
+- for _, field := range fn.Type.Params.List {
+- if field.Names != nil {
+- nparams += len(field.Names)
+- } else {
+- nparams++
+- }
+- }
+- for i := 0; i < nparams; i++ {
+- if i > 0 {
+- sn.WriteText(", ")
+- }
+- sn.WritePlaceholder(nil)
+- }
+- sn.WriteText(")")
+- item.snippet = &sn
+- }
+-
+- itemsMu.Lock()
+- c.items = append(c.items, item)
+- if len(c.items) >= unimportedMemberTarget {
+- atomic.StoreInt32(&enough, 1)
+- }
+- itemsMu.Unlock()
+- })
+- return nil
+- }
+-
+- // Extract the package-level candidates using a quick parse.
+- var g errgroup.Group
+- for _, path := range paths {
+- for _, m := range known[source.PackagePath(path)] {
+- m := m
+- for _, uri := range m.CompiledGoFiles {
+- uri := uri
+- g.Go(func() error {
+- return quickParse(uri, m)
+- })
+- }
+- }
+- }
+- if err := g.Wait(); err != nil {
+- return err
+- }
+-
+- // In addition, we search in the module cache using goimports.
+- ctx, cancel := context.WithCancel(ctx)
+- var mu sync.Mutex
+- add := func(pkgExport imports.PackageExport) {
+- mu.Lock()
+- defer mu.Unlock()
+- // TODO(adonovan): what if the actual package has a vendor/ prefix?
+- if _, ok := known[source.PackagePath(pkgExport.Fix.StmtInfo.ImportPath)]; ok {
+- return // We got this one above.
+- }
+-
+- // Continue with untyped proposals.
+- pkg := types.NewPackage(pkgExport.Fix.StmtInfo.ImportPath, pkgExport.Fix.IdentName)
+- for _, export := range pkgExport.Exports {
+- score := unimportedScore(pkgExport.Fix.Relevance)
+- c.deepState.enqueue(candidate{
+- obj: types.NewVar(0, pkg, export, nil),
+- score: score,
+- imp: &importInfo{
+- importPath: pkgExport.Fix.StmtInfo.ImportPath,
+- name: pkgExport.Fix.StmtInfo.Name,
+- },
+- })
+- }
+- if len(c.items) >= unimportedMemberTarget {
+- cancel()
+- }
+- }
+-
+- c.completionCallbacks = append(c.completionCallbacks, func(opts *imports.Options) error {
+- defer cancel()
+- return imports.GetPackageExports(ctx, add, id.Name, c.filename, c.pkg.GetTypes().Name(), opts.Env)
+- })
+- return nil
+-}
+-
+-// unimportedScore returns a score for an unimported package that is generally
+-// lower than other candidates.
+-func unimportedScore(relevance float64) float64 {
+- return (stdScore + .1*relevance) / 2
+-}
+-
+-func (c *completer) packageMembers(pkg *types.Package, score float64, imp *importInfo, cb func(candidate)) {
+- scope := pkg.Scope()
+- for _, name := range scope.Names() {
+- obj := scope.Lookup(name)
+- cb(candidate{
+- obj: obj,
+- score: score,
+- imp: imp,
+- addressable: isVar(obj),
+- })
+- }
+-}
+-
+-func (c *completer) methodsAndFields(typ types.Type, addressable bool, imp *importInfo, cb func(candidate)) {
+- mset := c.methodSetCache[methodSetKey{typ, addressable}]
+- if mset == nil {
+- if addressable && !types.IsInterface(typ) && !isPointer(typ) {
+- // Add methods of *T, which includes methods with receiver T.
+- mset = types.NewMethodSet(types.NewPointer(typ))
+- } else {
+- // Add methods of T.
+- mset = types.NewMethodSet(typ)
+- }
+- c.methodSetCache[methodSetKey{typ, addressable}] = mset
+- }
+-
+- if isStarTestingDotF(typ) && addressable {
+- // is that a sufficient test? (or is more care needed?)
+- if c.fuzz(typ, mset, imp, cb, c.pkg.FileSet()) {
+- return
+- }
+- }
+-
+- for i := 0; i < mset.Len(); i++ {
+- cb(candidate{
+- obj: mset.At(i).Obj(),
+- score: stdScore,
+- imp: imp,
+- addressable: addressable || isPointer(typ),
+- })
+- }
+-
+- // Add fields of T.
+- eachField(typ, func(v *types.Var) {
+- cb(candidate{
+- obj: v,
+- score: stdScore - 0.01,
+- imp: imp,
+- addressable: addressable || isPointer(typ),
+- })
+- })
+-}
+-
+-// isStarTestingDotF reports whether typ is *testing.F.
+-func isStarTestingDotF(typ types.Type) bool {
+- ptr, _ := typ.(*types.Pointer)
+- if ptr == nil {
+- return false
+- }
+- named, _ := ptr.Elem().(*types.Named)
+- if named == nil {
+- return false
+- }
+- obj := named.Obj()
+- // obj.Pkg is nil for the error type.
+- return obj != nil && obj.Pkg() != nil && obj.Pkg().Path() == "testing" && obj.Name() == "F"
+-}
+-
+-// lexical finds completions in the lexical environment.
+-func (c *completer) lexical(ctx context.Context) error {
+- var (
+- builtinIota = types.Universe.Lookup("iota")
+- builtinNil = types.Universe.Lookup("nil")
+-
+- // TODO(rfindley): only allow "comparable" where it is valid (in constraint
+- // position or embedded in interface declarations).
+- // builtinComparable = types.Universe.Lookup("comparable")
+- )
+-
+- // Track seen variables to avoid showing completions for shadowed variables.
+- // This works since we look at scopes from innermost to outermost.
+- seen := make(map[string]struct{})
+-
+- // Process scopes innermost first.
+- for i, scope := range c.scopes {
+- if scope == nil {
+- continue
+- }
+-
+- Names:
+- for _, name := range scope.Names() {
+- declScope, obj := scope.LookupParent(name, c.pos)
+- if declScope != scope {
+- continue // Name was declared in some enclosing scope, or not at all.
+- }
+-
+- // If obj's type is invalid, find the AST node that defines the lexical block
+- // containing the declaration of obj. Don't resolve types for packages.
+- if !isPkgName(obj) && !typeIsValid(obj.Type()) {
+- // Match the scope to its ast.Node. If the scope is the package scope,
+- // use the *ast.File as the starting node.
+- var node ast.Node
+- if i < len(c.path) {
+- node = c.path[i]
+- } else if i == len(c.path) { // use the *ast.File for package scope
+- node = c.path[i-1]
+- }
+- if node != nil {
+- if resolved := resolveInvalid(c.pkg.FileSet(), obj, node, c.pkg.GetTypesInfo()); resolved != nil {
+- obj = resolved
+- }
+- }
+- }
+-
+- // Don't use LHS of decl in RHS.
+- for _, ident := range enclosingDeclLHS(c.path) {
+- if obj.Pos() == ident.Pos() {
+- continue Names
+- }
+- }
+-
+- // Don't suggest "iota" outside of const decls.
+- if obj == builtinIota && !c.inConstDecl() {
+- continue
+- }
+-
+- // Rank outer scopes lower than inner.
+- score := stdScore * math.Pow(.99, float64(i))
+-
+- // Dowrank "nil" a bit so it is ranked below more interesting candidates.
+- if obj == builtinNil {
+- score /= 2
+- }
+-
+- // If we haven't already added a candidate for an object with this name.
+- if _, ok := seen[obj.Name()]; !ok {
+- seen[obj.Name()] = struct{}{}
+- c.deepState.enqueue(candidate{
+- obj: obj,
+- score: score,
+- addressable: isVar(obj),
+- })
+- }
+- }
+- }
+-
+- if c.inference.objType != nil {
+- if named, _ := source.Deref(c.inference.objType).(*types.Named); named != nil {
+- // If we expected a named type, check the type's package for
+- // completion items. This is useful when the current file hasn't
+- // imported the type's package yet.
+-
+- if named.Obj() != nil && named.Obj().Pkg() != nil {
+- pkg := named.Obj().Pkg()
+-
+- // Make sure the package name isn't already in use by another
+- // object, and that this file doesn't import the package yet.
+- // TODO(adonovan): what if pkg.Path has vendor/ prefix?
+- if _, ok := seen[pkg.Name()]; !ok && pkg != c.pkg.GetTypes() && !alreadyImports(c.file, source.ImportPath(pkg.Path())) {
+- seen[pkg.Name()] = struct{}{}
+- obj := types.NewPkgName(0, nil, pkg.Name(), pkg)
+- imp := &importInfo{
+- importPath: pkg.Path(),
+- }
+- if imports.ImportPathToAssumedName(pkg.Path()) != pkg.Name() {
+- imp.name = pkg.Name()
+- }
+- c.deepState.enqueue(candidate{
+- obj: obj,
+- score: stdScore,
+- imp: imp,
+- })
+- }
+- }
+- }
+- }
+-
+- if c.opts.unimported {
+- if err := c.unimportedPackages(ctx, seen); err != nil {
+- return err
+- }
+- }
+-
+- if c.inference.typeName.isTypeParam {
+- // If we are completing a type param, offer each structural type.
+- // This ensures we suggest "[]int" and "[]float64" for a constraint
+- // with type union "[]int | []float64".
+- if t, _ := c.inference.objType.(*types.Interface); t != nil {
+- terms, _ := typeparams.InterfaceTermSet(t)
+- for _, term := range terms {
+- c.injectType(ctx, term.Type())
+- }
+- }
+- } else {
+- c.injectType(ctx, c.inference.objType)
+- }
+-
+- // Add keyword completion items appropriate in the current context.
+- c.addKeywordCompletions()
+-
+- return nil
+-}
+-
+-// injectType manufactures candidates based on the given type. This is
+-// intended for types not discoverable via lexical search, such as
+-// composite and/or generic types. For example, if the type is "[]int",
+-// this method makes sure you get candidates "[]int{}" and "[]int"
+-// (the latter applies when completing a type name).
+-func (c *completer) injectType(ctx context.Context, t types.Type) {
+- if t == nil {
+- return
+- }
+-
+- t = source.Deref(t)
+-
+- // If we have an expected type and it is _not_ a named type, handle
+- // it specially. Non-named types like "[]int" will never be
+- // considered via a lexical search, so we need to directly inject
+- // them. Also allow generic types since lexical search does not
+- // infer instantiated versions of them.
+- if named, _ := t.(*types.Named); named == nil || typeparams.ForNamed(named).Len() > 0 {
+- // If our expected type is "[]int", this will add a literal
+- // candidate of "[]int{}".
+- c.literal(ctx, t, nil)
+-
+- if _, isBasic := t.(*types.Basic); !isBasic {
+- // If we expect a non-basic type name (e.g. "[]int"), hack up
+- // a named type whose name is literally "[]int". This allows
+- // us to reuse our object based completion machinery.
+- fakeNamedType := candidate{
+- obj: types.NewTypeName(token.NoPos, nil, types.TypeString(t, c.qf), t),
+- score: stdScore,
+- }
+- // Make sure the type name matches before considering
+- // candidate. This cuts down on useless candidates.
+- if c.matchingTypeName(&fakeNamedType) {
+- c.deepState.enqueue(fakeNamedType)
+- }
+- }
+- }
+-}
+-
+-func (c *completer) unimportedPackages(ctx context.Context, seen map[string]struct{}) error {
+- var prefix string
+- if c.surrounding != nil {
+- prefix = c.surrounding.Prefix()
+- }
+-
+- // Don't suggest unimported packages if we have absolutely nothing
+- // to go on.
+- if prefix == "" {
+- return nil
+- }
+-
+- count := 0
+-
+- // Search packages across the entire workspace.
+- all, err := c.snapshot.AllMetadata(ctx)
+- if err != nil {
+- return err
+- }
+- pkgNameByPath := make(map[source.PackagePath]string)
+- var paths []string // actually PackagePaths
+- for _, m := range all {
+- if m.ForTest != "" {
+- continue // skip all test variants
+- }
+- if m.Name == "main" {
+- continue // main is non-importable
+- }
+- if !strings.HasPrefix(string(m.Name), prefix) {
+- continue // not a match
+- }
+- paths = append(paths, string(m.PkgPath))
+- pkgNameByPath[m.PkgPath] = string(m.Name)
+- }
+-
+- // Rank candidates using goimports' algorithm.
+- var relevances map[string]float64
+- if len(paths) != 0 {
+- if err := c.snapshot.RunProcessEnvFunc(ctx, func(opts *imports.Options) error {
+- var err error
+- relevances, err = imports.ScoreImportPaths(ctx, opts.Env, paths)
+- return err
+- }); err != nil {
+- return err
+- }
+- }
+- sort.Slice(paths, func(i, j int) bool {
+- if relevances[paths[i]] != relevances[paths[j]] {
+- return relevances[paths[i]] > relevances[paths[j]]
+- }
+-
+- // Fall back to lexical sort to keep truncated set of candidates
+- // in a consistent order.
+- return paths[i] < paths[j]
+- })
+-
+- for _, path := range paths {
+- name := pkgNameByPath[source.PackagePath(path)]
+- if _, ok := seen[name]; ok {
+- continue
+- }
+- imp := &importInfo{
+- importPath: path,
+- }
+- if imports.ImportPathToAssumedName(path) != name {
+- imp.name = name
+- }
+- if count >= maxUnimportedPackageNames {
+- return nil
+- }
+- c.deepState.enqueue(candidate{
+- // Pass an empty *types.Package to disable deep completions.
+- obj: types.NewPkgName(0, nil, name, types.NewPackage(path, name)),
+- score: unimportedScore(relevances[path]),
+- imp: imp,
+- })
+- count++
+- }
+-
+- ctx, cancel := context.WithCancel(ctx)
+-
+- var mu sync.Mutex
+- add := func(pkg imports.ImportFix) {
+- mu.Lock()
+- defer mu.Unlock()
+- if _, ok := seen[pkg.IdentName]; ok {
+- return
+- }
+- if _, ok := relevances[pkg.StmtInfo.ImportPath]; ok {
+- return
+- }
+-
+- if count >= maxUnimportedPackageNames {
+- cancel()
+- return
+- }
+-
+- // Do not add the unimported packages to seen, since we can have
+- // multiple packages of the same name as completion suggestions, since
+- // only one will be chosen.
+- obj := types.NewPkgName(0, nil, pkg.IdentName, types.NewPackage(pkg.StmtInfo.ImportPath, pkg.IdentName))
+- c.deepState.enqueue(candidate{
+- obj: obj,
+- score: unimportedScore(pkg.Relevance),
+- imp: &importInfo{
+- importPath: pkg.StmtInfo.ImportPath,
+- name: pkg.StmtInfo.Name,
+- },
+- })
+- count++
+- }
+- c.completionCallbacks = append(c.completionCallbacks, func(opts *imports.Options) error {
+- defer cancel()
+- return imports.GetAllCandidates(ctx, add, prefix, c.filename, c.pkg.GetTypes().Name(), opts.Env)
+- })
+- return nil
+-}
+-
+-// alreadyImports reports whether f has an import with the specified path.
+-func alreadyImports(f *ast.File, path source.ImportPath) bool {
+- for _, s := range f.Imports {
+- if source.UnquoteImportPath(s) == path {
+- return true
+- }
+- }
+- return false
+-}
+-
+-func (c *completer) inConstDecl() bool {
+- for _, n := range c.path {
+- if decl, ok := n.(*ast.GenDecl); ok && decl.Tok == token.CONST {
+- return true
+- }
+- }
+- return false
+-}
+-
+-// structLiteralFieldName finds completions for struct field names inside a struct literal.
+-func (c *completer) structLiteralFieldName(ctx context.Context) error {
+- clInfo := c.enclosingCompositeLiteral
+-
+- // Mark fields of the composite literal that have already been set,
+- // except for the current field.
+- addedFields := make(map[*types.Var]bool)
+- for _, el := range clInfo.cl.Elts {
+- if kvExpr, ok := el.(*ast.KeyValueExpr); ok {
+- if clInfo.kv == kvExpr {
+- continue
+- }
+-
+- if key, ok := kvExpr.Key.(*ast.Ident); ok {
+- if used, ok := c.pkg.GetTypesInfo().Uses[key]; ok {
+- if usedVar, ok := used.(*types.Var); ok {
+- addedFields[usedVar] = true
+- }
+- }
+- }
+- }
+- }
+-
+- deltaScore := 0.0001
+- switch t := clInfo.clType.(type) {
+- case *types.Struct:
+- for i := 0; i < t.NumFields(); i++ {
+- field := t.Field(i)
+- if !addedFields[field] {
+- c.deepState.enqueue(candidate{
+- obj: field,
+- score: highScore - float64(i)*deltaScore,
+- })
+- }
+- }
+-
+- // Add lexical completions if we aren't certain we are in the key part of a
+- // key-value pair.
+- if clInfo.maybeInFieldName {
+- return c.lexical(ctx)
+- }
+- default:
+- return c.lexical(ctx)
+- }
+-
+- return nil
+-}
+-
+-func (cl *compLitInfo) isStruct() bool {
+- _, ok := cl.clType.(*types.Struct)
+- return ok
+-}
+-
+-// enclosingCompositeLiteral returns information about the composite literal enclosing the
+-// position.
+-func enclosingCompositeLiteral(path []ast.Node, pos token.Pos, info *types.Info) *compLitInfo {
+- for _, n := range path {
+- switch n := n.(type) {
+- case *ast.CompositeLit:
+- // The enclosing node will be a composite literal if the user has just
+- // opened the curly brace (e.g. &x{<>) or the completion request is triggered
+- // from an already completed composite literal expression (e.g. &x{foo: 1, <>})
+- //
+- // The position is not part of the composite literal unless it falls within the
+- // curly braces (e.g. "foo.Foo<>Struct{}").
+- if !(n.Lbrace < pos && pos <= n.Rbrace) {
+- // Keep searching since we may yet be inside a composite literal.
+- // For example "Foo{B: Ba<>{}}".
+- break
+- }
+-
+- tv, ok := info.Types[n]
+- if !ok {
+- return nil
+- }
+-
+- clInfo := compLitInfo{
+- cl: n,
+- clType: source.Deref(tv.Type).Underlying(),
+- }
+-
+- var (
+- expr ast.Expr
+- hasKeys bool
+- )
+- for _, el := range n.Elts {
+- // Remember the expression that the position falls in, if any.
+- if el.Pos() <= pos && pos <= el.End() {
+- expr = el
+- }
+-
+- if kv, ok := el.(*ast.KeyValueExpr); ok {
+- hasKeys = true
+- // If expr == el then we know the position falls in this expression,
+- // so also record kv as the enclosing *ast.KeyValueExpr.
+- if expr == el {
+- clInfo.kv = kv
+- break
+- }
+- }
+- }
+-
+- if clInfo.kv != nil {
+- // If in a *ast.KeyValueExpr, we know we are in the key if the position
+- // is to the left of the colon (e.g. "Foo{F<>: V}".
+- clInfo.inKey = pos <= clInfo.kv.Colon
+- } else if hasKeys {
+- // If we aren't in a *ast.KeyValueExpr but the composite literal has
+- // other *ast.KeyValueExprs, we must be on the key side of a new
+- // *ast.KeyValueExpr (e.g. "Foo{F: V, <>}").
+- clInfo.inKey = true
+- } else {
+- switch clInfo.clType.(type) {
+- case *types.Struct:
+- if len(n.Elts) == 0 {
+- // If the struct literal is empty, next could be a struct field
+- // name or an expression (e.g. "Foo{<>}" could become "Foo{F:}"
+- // or "Foo{someVar}").
+- clInfo.maybeInFieldName = true
+- } else if len(n.Elts) == 1 {
+- // If there is one expression and the position is in that expression
+- // and the expression is an identifier, we may be writing a field
+- // name or an expression (e.g. "Foo{F<>}").
+- _, clInfo.maybeInFieldName = expr.(*ast.Ident)
+- }
+- case *types.Map:
+- // If we aren't in a *ast.KeyValueExpr we must be adding a new key
+- // to the map.
+- clInfo.inKey = true
+- }
+- }
+-
+- return &clInfo
+- default:
+- if breaksExpectedTypeInference(n, pos) {
+- return nil
+- }
+- }
+- }
+-
+- return nil
+-}
+-
+-// enclosingFunction returns the signature and body of the function
+-// enclosing the given position.
+-func enclosingFunction(path []ast.Node, info *types.Info) *funcInfo {
+- for _, node := range path {
+- switch t := node.(type) {
+- case *ast.FuncDecl:
+- if obj, ok := info.Defs[t.Name]; ok {
+- return &funcInfo{
+- sig: obj.Type().(*types.Signature),
+- body: t.Body,
+- }
+- }
+- case *ast.FuncLit:
+- if typ, ok := info.Types[t]; ok {
+- if sig, _ := typ.Type.(*types.Signature); sig == nil {
+- // golang/go#49397: it should not be possible, but we somehow arrived
+- // here with a non-signature type, most likely due to AST mangling
+- // such that node.Type is not a FuncType.
+- return nil
+- }
+- return &funcInfo{
+- sig: typ.Type.(*types.Signature),
+- body: t.Body,
+- }
+- }
+- }
+- }
+- return nil
+-}
+-
+-func (c *completer) expectedCompositeLiteralType() types.Type {
+- clInfo := c.enclosingCompositeLiteral
+- switch t := clInfo.clType.(type) {
+- case *types.Slice:
+- if clInfo.inKey {
+- return types.Typ[types.UntypedInt]
+- }
+- return t.Elem()
+- case *types.Array:
+- if clInfo.inKey {
+- return types.Typ[types.UntypedInt]
+- }
+- return t.Elem()
+- case *types.Map:
+- if clInfo.inKey {
+- return t.Key()
+- }
+- return t.Elem()
+- case *types.Struct:
+- // If we are completing a key (i.e. field name), there is no expected type.
+- if clInfo.inKey {
+- return nil
+- }
+-
+- // If we are in a key-value pair, but not in the key, then we must be on the
+- // value side. The expected type of the value will be determined from the key.
+- if clInfo.kv != nil {
+- if key, ok := clInfo.kv.Key.(*ast.Ident); ok {
+- for i := 0; i < t.NumFields(); i++ {
+- if field := t.Field(i); field.Name() == key.Name {
+- return field.Type()
+- }
+- }
+- }
+- } else {
+- // If we aren't in a key-value pair and aren't in the key, we must be using
+- // implicit field names.
+-
+- // The order of the literal fields must match the order in the struct definition.
+- // Find the element that the position belongs to and suggest that field's type.
+- if i := exprAtPos(c.pos, clInfo.cl.Elts); i < t.NumFields() {
+- return t.Field(i).Type()
+- }
+- }
+- }
+- return nil
+-}
+-
+-// typeMod represents an operator that changes the expected type.
+-type typeMod struct {
+- mod typeModKind
+- arrayLen int64
+-}
+-
+-type typeModKind int
+-
+-const (
+- dereference typeModKind = iota // pointer indirection: "*"
+- reference // adds level of pointer: "&" for values, "*" for type names
+- chanRead // channel read operator: "<-"
+- sliceType // make a slice type: "[]" in "[]int"
+- arrayType // make an array type: "[2]" in "[2]int"
+- invoke // make a function call: "()" in "foo()"
+- takeSlice // take slice of array: "[:]" in "foo[:]"
+- takeDotDotDot // turn slice into variadic args: "..." in "foo..."
+- index // index into slice/array: "[0]" in "foo[0]"
+-)
+-
+-type objKind int
+-
+-const (
+- kindAny objKind = 0
+- kindArray objKind = 1 << iota
+- kindSlice
+- kindChan
+- kindMap
+- kindStruct
+- kindString
+- kindInt
+- kindBool
+- kindBytes
+- kindPtr
+- kindFloat
+- kindComplex
+- kindError
+- kindStringer
+- kindFunc
+-)
+-
+-// penalizedObj represents an object that should be disfavored as a
+-// completion candidate.
+-type penalizedObj struct {
+- // objChain is the full "chain", e.g. "foo.bar().baz" becomes
+- // []types.Object{foo, bar, baz}.
+- objChain []types.Object
+- // penalty is score penalty in the range (0, 1).
+- penalty float64
+-}
+-
+-// candidateInference holds information we have inferred about a type that can be
+-// used at the current position.
+-type candidateInference struct {
+- // objType is the desired type of an object used at the query position.
+- objType types.Type
+-
+- // objKind is a mask of expected kinds of types such as "map", "slice", etc.
+- objKind objKind
+-
+- // variadic is true if we are completing the initial variadic
+- // parameter. For example:
+- // append([]T{}, <>) // objType=T variadic=true
+- // append([]T{}, T{}, <>) // objType=T variadic=false
+- variadic bool
+-
+- // modifiers are prefixes such as "*", "&" or "<-" that influence how
+- // a candidate type relates to the expected type.
+- modifiers []typeMod
+-
+- // convertibleTo is a type our candidate type must be convertible to.
+- convertibleTo types.Type
+-
+- // typeName holds information about the expected type name at
+- // position, if any.
+- typeName typeNameInference
+-
+- // assignees are the types that would receive a function call's
+- // results at the position. For example:
+- //
+- // foo := 123
+- // foo, bar := <>
+- //
+- // at "<>", the assignees are [int, <invalid>].
+- assignees []types.Type
+-
+- // variadicAssignees is true if we could be completing an inner
+- // function call that fills out an outer function call's variadic
+- // params. For example:
+- //
+- // func foo(int, ...string) {}
+- //
+- // foo(<>) // variadicAssignees=true
+- // foo(bar<>) // variadicAssignees=true
+- // foo(bar, baz<>) // variadicAssignees=false
+- variadicAssignees bool
+-
+- // penalized holds expressions that should be disfavored as
+- // candidates. For example, it tracks expressions already used in a
+- // switch statement's other cases. Each expression is tracked using
+- // its entire object "chain" allowing differentiation between
+- // "a.foo" and "b.foo" when "a" and "b" are the same type.
+- penalized []penalizedObj
+-
+- // objChain contains the chain of objects representing the
+- // surrounding *ast.SelectorExpr. For example, if we are completing
+- // "foo.bar.ba<>", objChain will contain []types.Object{foo, bar}.
+- objChain []types.Object
+-}
+-
+-// typeNameInference holds information about the expected type name at
+-// position.
+-type typeNameInference struct {
+- // wantTypeName is true if we expect the name of a type.
+- wantTypeName bool
+-
+- // modifiers are prefixes such as "*", "&" or "<-" that influence how
+- // a candidate type relates to the expected type.
+- modifiers []typeMod
+-
+- // assertableFrom is a type that must be assertable to our candidate type.
+- assertableFrom types.Type
+-
+- // wantComparable is true if we want a comparable type.
+- wantComparable bool
+-
+- // seenTypeSwitchCases tracks types that have already been used by
+- // the containing type switch.
+- seenTypeSwitchCases []types.Type
+-
+- // compLitType is true if we are completing a composite literal type
+- // name, e.g "foo<>{}".
+- compLitType bool
+-
+- // isTypeParam is true if we are completing a type instantiation parameter
+- isTypeParam bool
+-}
+-
+-// expectedCandidate returns information about the expected candidate
+-// for an expression at the query position.
+-func expectedCandidate(ctx context.Context, c *completer) (inf candidateInference) {
+- inf.typeName = expectTypeName(c)
+-
+- if c.enclosingCompositeLiteral != nil {
+- inf.objType = c.expectedCompositeLiteralType()
+- }
+-
+-Nodes:
+- for i, node := range c.path {
+- switch node := node.(type) {
+- case *ast.BinaryExpr:
+- // Determine if query position comes from left or right of op.
+- e := node.X
+- if c.pos < node.OpPos {
+- e = node.Y
+- }
+- if tv, ok := c.pkg.GetTypesInfo().Types[e]; ok {
+- switch node.Op {
+- case token.LAND, token.LOR:
+- // Don't infer "bool" type for "&&" or "||". Often you want
+- // to compose a boolean expression from non-boolean
+- // candidates.
+- default:
+- inf.objType = tv.Type
+- }
+- break Nodes
+- }
+- case *ast.AssignStmt:
+- // Only rank completions if you are on the right side of the token.
+- if c.pos > node.TokPos {
+- i := exprAtPos(c.pos, node.Rhs)
+- if i >= len(node.Lhs) {
+- i = len(node.Lhs) - 1
+- }
+- if tv, ok := c.pkg.GetTypesInfo().Types[node.Lhs[i]]; ok {
+- inf.objType = tv.Type
+- }
+-
+- // If we have a single expression on the RHS, record the LHS
+- // assignees so we can favor multi-return function calls with
+- // matching result values.
+- if len(node.Rhs) <= 1 {
+- for _, lhs := range node.Lhs {
+- inf.assignees = append(inf.assignees, c.pkg.GetTypesInfo().TypeOf(lhs))
+- }
+- } else {
+- // Otherwise, record our single assignee, even if its type is
+- // not available. We use this info to downrank functions
+- // with the wrong number of result values.
+- inf.assignees = append(inf.assignees, c.pkg.GetTypesInfo().TypeOf(node.Lhs[i]))
+- }
+- }
+- return inf
+- case *ast.ValueSpec:
+- if node.Type != nil && c.pos > node.Type.End() {
+- inf.objType = c.pkg.GetTypesInfo().TypeOf(node.Type)
+- }
+- return inf
+- case *ast.CallExpr:
+- // Only consider CallExpr args if position falls between parens.
+- if node.Lparen < c.pos && c.pos <= node.Rparen {
+- // For type conversions like "int64(foo)" we can only infer our
+- // desired type is convertible to int64.
+- if typ := typeConversion(node, c.pkg.GetTypesInfo()); typ != nil {
+- inf.convertibleTo = typ
+- break Nodes
+- }
+-
+- sig, _ := c.pkg.GetTypesInfo().Types[node.Fun].Type.(*types.Signature)
+-
+- if sig != nil && typeparams.ForSignature(sig).Len() > 0 {
+- // If we are completing a generic func call, re-check the call expression.
+- // This allows type param inference to work in cases like:
+- //
+- // func foo[T any](T) {}
+- // foo[int](<>) // <- get "int" completions instead of "T"
+- //
+- // TODO: remove this after https://go.dev/issue/52503
+- info := &types.Info{Types: make(map[ast.Expr]types.TypeAndValue)}
+- types.CheckExpr(c.pkg.FileSet(), c.pkg.GetTypes(), node.Fun.Pos(), node.Fun, info)
+- sig, _ = info.Types[node.Fun].Type.(*types.Signature)
+- }
+-
+- if sig != nil {
+- inf = c.expectedCallParamType(inf, node, sig)
+- }
+-
+- if funIdent, ok := node.Fun.(*ast.Ident); ok {
+- obj := c.pkg.GetTypesInfo().ObjectOf(funIdent)
+-
+- if obj != nil && obj.Parent() == types.Universe {
+- // Defer call to builtinArgType so we can provide it the
+- // inferred type from its parent node.
+- defer func() {
+- inf = c.builtinArgType(obj, node, inf)
+- inf.objKind = c.builtinArgKind(ctx, obj, node)
+- }()
+-
+- // The expected type of builtin arguments like append() is
+- // the expected type of the builtin call itself. For
+- // example:
+- //
+- // var foo []int = append(<>)
+- //
+- // To find the expected type at <> we "skip" the append()
+- // node and get the expected type one level up, which is
+- // []int.
+- continue Nodes
+- }
+- }
+-
+- return inf
+- }
+- case *ast.ReturnStmt:
+- if c.enclosingFunc != nil {
+- sig := c.enclosingFunc.sig
+- // Find signature result that corresponds to our return statement.
+- if resultIdx := exprAtPos(c.pos, node.Results); resultIdx < len(node.Results) {
+- if resultIdx < sig.Results().Len() {
+- inf.objType = sig.Results().At(resultIdx).Type()
+- }
+- }
+- }
+- return inf
+- case *ast.CaseClause:
+- if swtch, ok := findSwitchStmt(c.path[i+1:], c.pos, node).(*ast.SwitchStmt); ok {
+- if tv, ok := c.pkg.GetTypesInfo().Types[swtch.Tag]; ok {
+- inf.objType = tv.Type
+-
+- // Record which objects have already been used in the case
+- // statements so we don't suggest them again.
+- for _, cc := range swtch.Body.List {
+- for _, caseExpr := range cc.(*ast.CaseClause).List {
+- // Don't record the expression we are currently completing.
+- if caseExpr.Pos() < c.pos && c.pos <= caseExpr.End() {
+- continue
+- }
+-
+- if objs := objChain(c.pkg.GetTypesInfo(), caseExpr); len(objs) > 0 {
+- inf.penalized = append(inf.penalized, penalizedObj{objChain: objs, penalty: 0.1})
+- }
+- }
+- }
+- }
+- }
+- return inf
+- case *ast.SliceExpr:
+- // Make sure position falls within the brackets (e.g. "foo[a:<>]").
+- if node.Lbrack < c.pos && c.pos <= node.Rbrack {
+- inf.objType = types.Typ[types.UntypedInt]
+- }
+- return inf
+- case *ast.IndexExpr:
+- // Make sure position falls within the brackets (e.g. "foo[<>]").
+- if node.Lbrack < c.pos && c.pos <= node.Rbrack {
+- if tv, ok := c.pkg.GetTypesInfo().Types[node.X]; ok {
+- switch t := tv.Type.Underlying().(type) {
+- case *types.Map:
+- inf.objType = t.Key()
+- case *types.Slice, *types.Array:
+- inf.objType = types.Typ[types.UntypedInt]
+- }
+-
+- if ct := expectedConstraint(tv.Type, 0); ct != nil {
+- inf.objType = ct
+- inf.typeName.wantTypeName = true
+- inf.typeName.isTypeParam = true
+- }
+- }
+- }
+- return inf
+- case *typeparams.IndexListExpr:
+- if node.Lbrack < c.pos && c.pos <= node.Rbrack {
+- if tv, ok := c.pkg.GetTypesInfo().Types[node.X]; ok {
+- if ct := expectedConstraint(tv.Type, exprAtPos(c.pos, node.Indices)); ct != nil {
+- inf.objType = ct
+- inf.typeName.wantTypeName = true
+- inf.typeName.isTypeParam = true
+- }
+- }
+- }
+- return inf
+- case *ast.SendStmt:
+- // Make sure we are on right side of arrow (e.g. "foo <- <>").
+- if c.pos > node.Arrow+1 {
+- if tv, ok := c.pkg.GetTypesInfo().Types[node.Chan]; ok {
+- if ch, ok := tv.Type.Underlying().(*types.Chan); ok {
+- inf.objType = ch.Elem()
+- }
+- }
+- }
+- return inf
+- case *ast.RangeStmt:
+- if source.NodeContains(node.X, c.pos) {
+- inf.objKind |= kindSlice | kindArray | kindMap | kindString
+- if node.Value == nil {
+- inf.objKind |= kindChan
+- }
+- }
+- return inf
+- case *ast.StarExpr:
+- inf.modifiers = append(inf.modifiers, typeMod{mod: dereference})
+- case *ast.UnaryExpr:
+- switch node.Op {
+- case token.AND:
+- inf.modifiers = append(inf.modifiers, typeMod{mod: reference})
+- case token.ARROW:
+- inf.modifiers = append(inf.modifiers, typeMod{mod: chanRead})
+- }
+- case *ast.DeferStmt, *ast.GoStmt:
+- inf.objKind |= kindFunc
+- return inf
+- default:
+- if breaksExpectedTypeInference(node, c.pos) {
+- return inf
+- }
+- }
+- }
+-
+- return inf
+-}
+-
+-func (c *completer) expectedCallParamType(inf candidateInference, node *ast.CallExpr, sig *types.Signature) candidateInference {
+- numParams := sig.Params().Len()
+- if numParams == 0 {
+- return inf
+- }
+-
+- exprIdx := exprAtPos(c.pos, node.Args)
+-
+- // If we have one or zero arg expressions, we may be
+- // completing to a function call that returns multiple
+- // values, in turn getting passed in to the surrounding
+- // call. Record the assignees so we can favor function
+- // calls that return matching values.
+- if len(node.Args) <= 1 && exprIdx == 0 {
+- for i := 0; i < sig.Params().Len(); i++ {
+- inf.assignees = append(inf.assignees, sig.Params().At(i).Type())
+- }
+-
+- // Record that we may be completing into variadic parameters.
+- inf.variadicAssignees = sig.Variadic()
+- }
+-
+- // Make sure not to run past the end of expected parameters.
+- if exprIdx >= numParams {
+- inf.objType = sig.Params().At(numParams - 1).Type()
+- } else {
+- inf.objType = sig.Params().At(exprIdx).Type()
+- }
+-
+- if sig.Variadic() && exprIdx >= (numParams-1) {
+- // If we are completing a variadic param, deslice the variadic type.
+- inf.objType = deslice(inf.objType)
+- // Record whether we are completing the initial variadic param.
+- inf.variadic = exprIdx == numParams-1 && len(node.Args) <= numParams
+-
+- // Check if we can infer object kind from printf verb.
+- inf.objKind |= printfArgKind(c.pkg.GetTypesInfo(), node, exprIdx)
+- }
+-
+- // If our expected type is an uninstantiated generic type param,
+- // swap to the constraint which will do a decent job filtering
+- // candidates.
+- if tp, _ := inf.objType.(*typeparams.TypeParam); tp != nil {
+- inf.objType = tp.Constraint()
+- }
+-
+- return inf
+-}
+-
+-func expectedConstraint(t types.Type, idx int) types.Type {
+- var tp *typeparams.TypeParamList
+- if named, _ := t.(*types.Named); named != nil {
+- tp = typeparams.ForNamed(named)
+- } else if sig, _ := t.Underlying().(*types.Signature); sig != nil {
+- tp = typeparams.ForSignature(sig)
+- }
+- if tp == nil || idx >= tp.Len() {
+- return nil
+- }
+- return tp.At(idx).Constraint()
+-}
+-
+-// objChain decomposes e into a chain of objects if possible. For
+-// example, "foo.bar().baz" will yield []types.Object{foo, bar, baz}.
+-// If any part can't be turned into an object, return nil.
+-func objChain(info *types.Info, e ast.Expr) []types.Object {
+- var objs []types.Object
+-
+- for e != nil {
+- switch n := e.(type) {
+- case *ast.Ident:
+- obj := info.ObjectOf(n)
+- if obj == nil {
+- return nil
+- }
+- objs = append(objs, obj)
+- e = nil
+- case *ast.SelectorExpr:
+- obj := info.ObjectOf(n.Sel)
+- if obj == nil {
+- return nil
+- }
+- objs = append(objs, obj)
+- e = n.X
+- case *ast.CallExpr:
+- if len(n.Args) > 0 {
+- return nil
+- }
+- e = n.Fun
+- default:
+- return nil
+- }
+- }
+-
+- // Reverse order so the layout matches the syntactic order.
+- for i := 0; i < len(objs)/2; i++ {
+- objs[i], objs[len(objs)-1-i] = objs[len(objs)-1-i], objs[i]
+- }
+-
+- return objs
+-}
+-
+-// applyTypeModifiers applies the list of type modifiers to a type.
+-// It returns nil if the modifiers could not be applied.
+-func (ci candidateInference) applyTypeModifiers(typ types.Type, addressable bool) types.Type {
+- for _, mod := range ci.modifiers {
+- switch mod.mod {
+- case dereference:
+- // For every "*" indirection operator, remove a pointer layer
+- // from candidate type.
+- if ptr, ok := typ.Underlying().(*types.Pointer); ok {
+- typ = ptr.Elem()
+- } else {
+- return nil
+- }
+- case reference:
+- // For every "&" address operator, add another pointer layer to
+- // candidate type, if the candidate is addressable.
+- if addressable {
+- typ = types.NewPointer(typ)
+- } else {
+- return nil
+- }
+- case chanRead:
+- // For every "<-" operator, remove a layer of channelness.
+- if ch, ok := typ.(*types.Chan); ok {
+- typ = ch.Elem()
+- } else {
+- return nil
+- }
+- }
+- }
+-
+- return typ
+-}
+-
+-// applyTypeNameModifiers applies the list of type modifiers to a type name.
+-func (ci candidateInference) applyTypeNameModifiers(typ types.Type) types.Type {
+- for _, mod := range ci.typeName.modifiers {
+- switch mod.mod {
+- case reference:
+- typ = types.NewPointer(typ)
+- case arrayType:
+- typ = types.NewArray(typ, mod.arrayLen)
+- case sliceType:
+- typ = types.NewSlice(typ)
+- }
+- }
+- return typ
+-}
+-
+-// matchesVariadic returns true if we are completing a variadic
+-// parameter and candType is a compatible slice type.
+-func (ci candidateInference) matchesVariadic(candType types.Type) bool {
+- return ci.variadic && ci.objType != nil && assignableTo(candType, types.NewSlice(ci.objType))
+-}
+-
+-// findSwitchStmt returns an *ast.CaseClause's corresponding *ast.SwitchStmt or
+-// *ast.TypeSwitchStmt. path should start from the case clause's first ancestor.
+-func findSwitchStmt(path []ast.Node, pos token.Pos, c *ast.CaseClause) ast.Stmt {
+- // Make sure position falls within a "case <>:" clause.
+- if exprAtPos(pos, c.List) >= len(c.List) {
+- return nil
+- }
+- // A case clause is always nested within a block statement in a switch statement.
+- if len(path) < 2 {
+- return nil
+- }
+- if _, ok := path[0].(*ast.BlockStmt); !ok {
+- return nil
+- }
+- switch s := path[1].(type) {
+- case *ast.SwitchStmt:
+- return s
+- case *ast.TypeSwitchStmt:
+- return s
+- default:
+- return nil
+- }
+-}
+-
+-// breaksExpectedTypeInference reports if an expression node's type is unrelated
+-// to its child expression node types. For example, "Foo{Bar: x.Baz(<>)}" should
+-// expect a function argument, not a composite literal value.
+-func breaksExpectedTypeInference(n ast.Node, pos token.Pos) bool {
+- switch n := n.(type) {
+- case *ast.CompositeLit:
+- // Doesn't break inference if pos is in type name.
+- // For example: "Foo<>{Bar: 123}"
+- return !source.NodeContains(n.Type, pos)
+- case *ast.CallExpr:
+- // Doesn't break inference if pos is in func name.
+- // For example: "Foo<>(123)"
+- return !source.NodeContains(n.Fun, pos)
+- case *ast.FuncLit, *ast.IndexExpr, *ast.SliceExpr:
+- return true
+- default:
+- return false
+- }
+-}
+-
+-// expectTypeName returns information about the expected type name at position.
+-func expectTypeName(c *completer) typeNameInference {
+- var inf typeNameInference
+-
+-Nodes:
+- for i, p := range c.path {
+- switch n := p.(type) {
+- case *ast.FieldList:
+- // Expect a type name if pos is in a FieldList. This applies to
+- // FuncType params/results, FuncDecl receiver, StructType, and
+- // InterfaceType. We don't need to worry about the field name
+- // because completion bails out early if pos is in an *ast.Ident
+- // that defines an object.
+- inf.wantTypeName = true
+- break Nodes
+- case *ast.CaseClause:
+- // Expect type names in type switch case clauses.
+- if swtch, ok := findSwitchStmt(c.path[i+1:], c.pos, n).(*ast.TypeSwitchStmt); ok {
+- // The case clause types must be assertable from the type switch parameter.
+- ast.Inspect(swtch.Assign, func(n ast.Node) bool {
+- if ta, ok := n.(*ast.TypeAssertExpr); ok {
+- inf.assertableFrom = c.pkg.GetTypesInfo().TypeOf(ta.X)
+- return false
+- }
+- return true
+- })
+- inf.wantTypeName = true
+-
+- // Track the types that have already been used in this
+- // switch's case statements so we don't recommend them.
+- for _, e := range swtch.Body.List {
+- for _, typeExpr := range e.(*ast.CaseClause).List {
+- // Skip if type expression contains pos. We don't want to
+- // count it as already used if the user is completing it.
+- if typeExpr.Pos() < c.pos && c.pos <= typeExpr.End() {
+- continue
+- }
+-
+- if t := c.pkg.GetTypesInfo().TypeOf(typeExpr); t != nil {
+- inf.seenTypeSwitchCases = append(inf.seenTypeSwitchCases, t)
+- }
+- }
+- }
+-
+- break Nodes
+- }
+- return typeNameInference{}
+- case *ast.TypeAssertExpr:
+- // Expect type names in type assert expressions.
+- if n.Lparen < c.pos && c.pos <= n.Rparen {
+- // The type in parens must be assertable from the expression type.
+- inf.assertableFrom = c.pkg.GetTypesInfo().TypeOf(n.X)
+- inf.wantTypeName = true
+- break Nodes
+- }
+- return typeNameInference{}
+- case *ast.StarExpr:
+- inf.modifiers = append(inf.modifiers, typeMod{mod: reference})
+- case *ast.CompositeLit:
+- // We want a type name if position is in the "Type" part of a
+- // composite literal (e.g. "Foo<>{}").
+- if n.Type != nil && n.Type.Pos() <= c.pos && c.pos <= n.Type.End() {
+- inf.wantTypeName = true
+- inf.compLitType = true
+-
+- if i < len(c.path)-1 {
+- // Track preceding "&" operator. Technically it applies to
+- // the composite literal and not the type name, but if
+- // affects our type completion nonetheless.
+- if u, ok := c.path[i+1].(*ast.UnaryExpr); ok && u.Op == token.AND {
+- inf.modifiers = append(inf.modifiers, typeMod{mod: reference})
+- }
+- }
+- }
+- break Nodes
+- case *ast.ArrayType:
+- // If we are inside the "Elt" part of an array type, we want a type name.
+- if n.Elt.Pos() <= c.pos && c.pos <= n.Elt.End() {
+- inf.wantTypeName = true
+- if n.Len == nil {
+- // No "Len" expression means a slice type.
+- inf.modifiers = append(inf.modifiers, typeMod{mod: sliceType})
+- } else {
+- // Try to get the array type using the constant value of "Len".
+- tv, ok := c.pkg.GetTypesInfo().Types[n.Len]
+- if ok && tv.Value != nil && tv.Value.Kind() == constant.Int {
+- if arrayLen, ok := constant.Int64Val(tv.Value); ok {
+- inf.modifiers = append(inf.modifiers, typeMod{mod: arrayType, arrayLen: arrayLen})
+- }
+- }
+- }
+-
+- // ArrayTypes can be nested, so keep going if our parent is an
+- // ArrayType.
+- if i < len(c.path)-1 {
+- if _, ok := c.path[i+1].(*ast.ArrayType); ok {
+- continue Nodes
+- }
+- }
+-
+- break Nodes
+- }
+- case *ast.MapType:
+- inf.wantTypeName = true
+- if n.Key != nil {
+- inf.wantComparable = source.NodeContains(n.Key, c.pos)
+- } else {
+- // If the key is empty, assume we are completing the key if
+- // pos is directly after the "map[".
+- inf.wantComparable = c.pos == n.Pos()+token.Pos(len("map["))
+- }
+- break Nodes
+- case *ast.ValueSpec:
+- inf.wantTypeName = source.NodeContains(n.Type, c.pos)
+- break Nodes
+- case *ast.TypeSpec:
+- inf.wantTypeName = source.NodeContains(n.Type, c.pos)
+- default:
+- if breaksExpectedTypeInference(p, c.pos) {
+- return typeNameInference{}
+- }
+- }
+- }
+-
+- return inf
+-}
+-
+-func (c *completer) fakeObj(T types.Type) *types.Var {
+- return types.NewVar(token.NoPos, c.pkg.GetTypes(), "", T)
+-}
+-
+-// derivableTypes iterates types you can derive from t. For example,
+-// from "foo" we might derive "&foo", and "foo()".
+-func derivableTypes(t types.Type, addressable bool, f func(t types.Type, addressable bool, mod typeModKind) bool) bool {
+- switch t := t.Underlying().(type) {
+- case *types.Signature:
+- // If t is a func type with a single result, offer the result type.
+- if t.Results().Len() == 1 && f(t.Results().At(0).Type(), false, invoke) {
+- return true
+- }
+- case *types.Array:
+- if f(t.Elem(), true, index) {
+- return true
+- }
+- // Try converting array to slice.
+- if f(types.NewSlice(t.Elem()), false, takeSlice) {
+- return true
+- }
+- case *types.Pointer:
+- if f(t.Elem(), false, dereference) {
+- return true
+- }
+- case *types.Slice:
+- if f(t.Elem(), true, index) {
+- return true
+- }
+- case *types.Map:
+- if f(t.Elem(), false, index) {
+- return true
+- }
+- case *types.Chan:
+- if f(t.Elem(), false, chanRead) {
+- return true
+- }
+- }
+-
+- // Check if c is addressable and a pointer to c matches our type inference.
+- if addressable && f(types.NewPointer(t), false, reference) {
+- return true
+- }
+-
+- return false
+-}
+-
+-// anyCandType reports whether f returns true for any candidate type
+-// derivable from c. It searches up to three levels of type
+-// modification. For example, given "foo" we could discover "***foo"
+-// or "*foo()".
+-func (c *candidate) anyCandType(f func(t types.Type, addressable bool) bool) bool {
+- if c.obj == nil || c.obj.Type() == nil {
+- return false
+- }
+-
+- const maxDepth = 3
+-
+- var searchTypes func(t types.Type, addressable bool, mods []typeModKind) bool
+- searchTypes = func(t types.Type, addressable bool, mods []typeModKind) bool {
+- if f(t, addressable) {
+- if len(mods) > 0 {
+- newMods := make([]typeModKind, len(mods)+len(c.mods))
+- copy(newMods, mods)
+- copy(newMods[len(mods):], c.mods)
+- c.mods = newMods
+- }
+- return true
+- }
+-
+- if len(mods) == maxDepth {
+- return false
+- }
+-
+- return derivableTypes(t, addressable, func(t types.Type, addressable bool, mod typeModKind) bool {
+- return searchTypes(t, addressable, append(mods, mod))
+- })
+- }
+-
+- return searchTypes(c.obj.Type(), c.addressable, make([]typeModKind, 0, maxDepth))
+-}
+-
+-// matchingCandidate reports whether cand matches our type inferences.
+-// It mutates cand's score in certain cases.
+-func (c *completer) matchingCandidate(cand *candidate) bool {
+- if c.completionContext.commentCompletion {
+- return false
+- }
+-
+- // Bail out early if we are completing a field name in a composite literal.
+- if v, ok := cand.obj.(*types.Var); ok && v.IsField() && c.wantStructFieldCompletions() {
+- return true
+- }
+-
+- if isTypeName(cand.obj) {
+- return c.matchingTypeName(cand)
+- } else if c.wantTypeName() {
+- // If we want a type, a non-type object never matches.
+- return false
+- }
+-
+- if c.inference.candTypeMatches(cand) {
+- return true
+- }
+-
+- candType := cand.obj.Type()
+- if candType == nil {
+- return false
+- }
+-
+- if sig, ok := candType.Underlying().(*types.Signature); ok {
+- if c.inference.assigneesMatch(cand, sig) {
+- // Invoke the candidate if its results are multi-assignable.
+- cand.mods = append(cand.mods, invoke)
+- return true
+- }
+- }
+-
+- // Default to invoking *types.Func candidates. This is so function
+- // completions in an empty statement (or other cases with no expected type)
+- // are invoked by default.
+- if isFunc(cand.obj) {
+- cand.mods = append(cand.mods, invoke)
+- }
+-
+- return false
+-}
+-
+-// candTypeMatches reports whether cand makes a good completion
+-// candidate given the candidate inference. cand's score may be
+-// mutated to downrank the candidate in certain situations.
+-func (ci *candidateInference) candTypeMatches(cand *candidate) bool {
+- var (
+- expTypes = make([]types.Type, 0, 2)
+- variadicType types.Type
+- )
+- if ci.objType != nil {
+- expTypes = append(expTypes, ci.objType)
+-
+- if ci.variadic {
+- variadicType = types.NewSlice(ci.objType)
+- expTypes = append(expTypes, variadicType)
+- }
+- }
+-
+- return cand.anyCandType(func(candType types.Type, addressable bool) bool {
+- // Take into account any type modifiers on the expected type.
+- candType = ci.applyTypeModifiers(candType, addressable)
+- if candType == nil {
+- return false
+- }
+-
+- if ci.convertibleTo != nil && convertibleTo(candType, ci.convertibleTo) {
+- return true
+- }
+-
+- for _, expType := range expTypes {
+- if isEmptyInterface(expType) {
+- continue
+- }
+-
+- matches := ci.typeMatches(expType, candType)
+- if !matches {
+- // If candType doesn't otherwise match, consider if we can
+- // convert candType directly to expType.
+- if considerTypeConversion(candType, expType, cand.path) {
+- cand.convertTo = expType
+- // Give a major score penalty so we always prefer directly
+- // assignable candidates, all else equal.
+- cand.score *= 0.5
+- return true
+- }
+-
+- continue
+- }
+-
+- if expType == variadicType {
+- cand.mods = append(cand.mods, takeDotDotDot)
+- }
+-
+- // Lower candidate score for untyped conversions. This avoids
+- // ranking untyped constants above candidates with an exact type
+- // match. Don't lower score of builtin constants, e.g. "true".
+- if isUntyped(candType) && !types.Identical(candType, expType) && cand.obj.Parent() != types.Universe {
+- // Bigger penalty for deep completions into other packages to
+- // avoid random constants from other packages popping up all
+- // the time.
+- if len(cand.path) > 0 && isPkgName(cand.path[0]) {
+- cand.score *= 0.5
+- } else {
+- cand.score *= 0.75
+- }
+- }
+-
+- return true
+- }
+-
+- // If we don't have a specific expected type, fall back to coarser
+- // object kind checks.
+- if ci.objType == nil || isEmptyInterface(ci.objType) {
+- // If we were able to apply type modifiers to our candidate type,
+- // count that as a match. For example:
+- //
+- // var foo chan int
+- // <-fo<>
+- //
+- // We were able to apply the "<-" type modifier to "foo", so "foo"
+- // matches.
+- if len(ci.modifiers) > 0 {
+- return true
+- }
+-
+- // If we didn't have an exact type match, check if our object kind
+- // matches.
+- if ci.kindMatches(candType) {
+- if ci.objKind == kindFunc {
+- cand.mods = append(cand.mods, invoke)
+- }
+- return true
+- }
+- }
+-
+- return false
+- })
+-}
+-
+-// considerTypeConversion returns true if we should offer a completion
+-// automatically converting "from" to "to".
+-func considerTypeConversion(from, to types.Type, path []types.Object) bool {
+- // Don't offer to convert deep completions from other packages.
+- // Otherwise there are many random package level consts/vars that
+- // pop up as candidates all the time.
+- if len(path) > 0 && isPkgName(path[0]) {
+- return false
+- }
+-
+- if _, ok := from.(*typeparams.TypeParam); ok {
+- return false
+- }
+-
+- if !convertibleTo(from, to) {
+- return false
+- }
+-
+- // Don't offer to convert ints to strings since that probably
+- // doesn't do what the user wants.
+- if isBasicKind(from, types.IsInteger) && isBasicKind(to, types.IsString) {
+- return false
+- }
+-
+- return true
+-}
+-
+-// typeMatches reports whether an object of candType makes a good
+-// completion candidate given the expected type expType.
+-func (ci *candidateInference) typeMatches(expType, candType types.Type) bool {
+- // Handle untyped values specially since AssignableTo gives false negatives
+- // for them (see https://golang.org/issue/32146).
+- if candBasic, ok := candType.Underlying().(*types.Basic); ok {
+- if expBasic, ok := expType.Underlying().(*types.Basic); ok {
+- // Note that the candidate and/or the expected can be untyped.
+- // In "fo<> == 100" the expected type is untyped, and the
+- // candidate could also be an untyped constant.
+-
+- // Sort by is_untyped and then by is_int to simplify below logic.
+- a, b := candBasic.Info(), expBasic.Info()
+- if a&types.IsUntyped == 0 || (b&types.IsInteger > 0 && b&types.IsUntyped > 0) {
+- a, b = b, a
+- }
+-
+- // If at least one is untyped...
+- if a&types.IsUntyped > 0 {
+- switch {
+- // Untyped integers are compatible with floats.
+- case a&types.IsInteger > 0 && b&types.IsFloat > 0:
+- return true
+-
+- // Check if their constant kind (bool|int|float|complex|string) matches.
+- // This doesn't take into account the constant value, so there will be some
+- // false positives due to integer sign and overflow.
+- case a&types.IsConstType == b&types.IsConstType:
+- return true
+- }
+- }
+- }
+- }
+-
+- // AssignableTo covers the case where the types are equal, but also handles
+- // cases like assigning a concrete type to an interface type.
+- return assignableTo(candType, expType)
+-}
+-
+-// kindMatches reports whether candType's kind matches our expected
+-// kind (e.g. slice, map, etc.).
+-func (ci *candidateInference) kindMatches(candType types.Type) bool {
+- return ci.objKind > 0 && ci.objKind&candKind(candType) > 0
+-}
+-
+-// assigneesMatch reports whether an invocation of sig matches the
+-// number and type of any assignees.
+-func (ci *candidateInference) assigneesMatch(cand *candidate, sig *types.Signature) bool {
+- if len(ci.assignees) == 0 {
+- return false
+- }
+-
+- // Uniresult functions are always usable and are handled by the
+- // normal, non-assignees type matching logic.
+- if sig.Results().Len() == 1 {
+- return false
+- }
+-
+- // Don't prefer completing into func(...interface{}) calls since all
+- // functions would match.
+- if ci.variadicAssignees && len(ci.assignees) == 1 && isEmptyInterface(deslice(ci.assignees[0])) {
+- return false
+- }
+-
+- var numberOfResultsCouldMatch bool
+- if ci.variadicAssignees {
+- numberOfResultsCouldMatch = sig.Results().Len() >= len(ci.assignees)-1
+- } else {
+- numberOfResultsCouldMatch = sig.Results().Len() == len(ci.assignees)
+- }
+-
+- // If our signature doesn't return the right number of values, it's
+- // not a match, so downrank it. For example:
+- //
+- // var foo func() (int, int)
+- // a, b, c := <> // downrank "foo()" since it only returns two values
+- if !numberOfResultsCouldMatch {
+- cand.score /= 2
+- return false
+- }
+-
+- // If at least one assignee has a valid type, and all valid
+- // assignees match the corresponding sig result value, the signature
+- // is a match.
+- allMatch := false
+- for i := 0; i < sig.Results().Len(); i++ {
+- var assignee types.Type
+-
+- // If we are completing into variadic parameters, deslice the
+- // expected variadic type.
+- if ci.variadicAssignees && i >= len(ci.assignees)-1 {
+- assignee = ci.assignees[len(ci.assignees)-1]
+- if elem := deslice(assignee); elem != nil {
+- assignee = elem
+- }
+- } else {
+- assignee = ci.assignees[i]
+- }
+-
+- if assignee == nil || assignee == types.Typ[types.Invalid] {
+- continue
+- }
+-
+- allMatch = ci.typeMatches(assignee, sig.Results().At(i).Type())
+- if !allMatch {
+- break
+- }
+- }
+- return allMatch
+-}
+-
+-func (c *completer) matchingTypeName(cand *candidate) bool {
+- if !c.wantTypeName() {
+- return false
+- }
+-
+- typeMatches := func(candType types.Type) bool {
+- // Take into account any type name modifier prefixes.
+- candType = c.inference.applyTypeNameModifiers(candType)
+-
+- if from := c.inference.typeName.assertableFrom; from != nil {
+- // Don't suggest the starting type in type assertions. For example,
+- // if "foo" is an io.Writer, don't suggest "foo.(io.Writer)".
+- if types.Identical(from, candType) {
+- return false
+- }
+-
+- if intf, ok := from.Underlying().(*types.Interface); ok {
+- if !types.AssertableTo(intf, candType) {
+- return false
+- }
+- }
+- }
+-
+- if c.inference.typeName.wantComparable && !types.Comparable(candType) {
+- return false
+- }
+-
+- // Skip this type if it has already been used in another type
+- // switch case.
+- for _, seen := range c.inference.typeName.seenTypeSwitchCases {
+- if types.Identical(candType, seen) {
+- return false
+- }
+- }
+-
+- // We can expect a type name and have an expected type in cases like:
+- //
+- // var foo []int
+- // foo = []i<>
+- //
+- // Where our expected type is "[]int", and we expect a type name.
+- if c.inference.objType != nil {
+- return assignableTo(candType, c.inference.objType)
+- }
+-
+- // Default to saying any type name is a match.
+- return true
+- }
+-
+- t := cand.obj.Type()
+-
+- if typeMatches(t) {
+- return true
+- }
+-
+- if !types.IsInterface(t) && typeMatches(types.NewPointer(t)) {
+- if c.inference.typeName.compLitType {
+- // If we are completing a composite literal type as in
+- // "foo<>{}", to make a pointer we must prepend "&".
+- cand.mods = append(cand.mods, reference)
+- } else {
+- // If we are completing a normal type name such as "foo<>", to
+- // make a pointer we must prepend "*".
+- cand.mods = append(cand.mods, dereference)
+- }
+- return true
+- }
+-
+- return false
+-}
+-
+-var (
+- // "interface { Error() string }" (i.e. error)
+- errorIntf = types.Universe.Lookup("error").Type().Underlying().(*types.Interface)
+-
+- // "interface { String() string }" (i.e. fmt.Stringer)
+- stringerIntf = types.NewInterfaceType([]*types.Func{
+- types.NewFunc(token.NoPos, nil, "String", types.NewSignature(
+- nil,
+- nil,
+- types.NewTuple(types.NewParam(token.NoPos, nil, "", types.Typ[types.String])),
+- false,
+- )),
+- }, nil).Complete()
+-
+- byteType = types.Universe.Lookup("byte").Type()
+-)
+-
+-// candKind returns the objKind of candType, if any.
+-func candKind(candType types.Type) objKind {
+- var kind objKind
+-
+- switch t := candType.Underlying().(type) {
+- case *types.Array:
+- kind |= kindArray
+- if t.Elem() == byteType {
+- kind |= kindBytes
+- }
+- case *types.Slice:
+- kind |= kindSlice
+- if t.Elem() == byteType {
+- kind |= kindBytes
+- }
+- case *types.Chan:
+- kind |= kindChan
+- case *types.Map:
+- kind |= kindMap
+- case *types.Pointer:
+- kind |= kindPtr
+-
+- // Some builtins handle array pointers as arrays, so just report a pointer
+- // to an array as an array.
+- if _, isArray := t.Elem().Underlying().(*types.Array); isArray {
+- kind |= kindArray
+- }
+- case *types.Basic:
+- switch info := t.Info(); {
+- case info&types.IsString > 0:
+- kind |= kindString
+- case info&types.IsInteger > 0:
+- kind |= kindInt
+- case info&types.IsFloat > 0:
+- kind |= kindFloat
+- case info&types.IsComplex > 0:
+- kind |= kindComplex
+- case info&types.IsBoolean > 0:
+- kind |= kindBool
+- }
+- case *types.Signature:
+- return kindFunc
+- }
+-
+- if types.Implements(candType, errorIntf) {
+- kind |= kindError
+- }
+-
+- if types.Implements(candType, stringerIntf) {
+- kind |= kindStringer
+- }
+-
+- return kind
+-}
+-
+-// innermostScope returns the innermost scope for c.pos.
+-func (c *completer) innermostScope() *types.Scope {
+- for _, s := range c.scopes {
+- if s != nil {
+- return s
+- }
+- }
+- return nil
+-}
+-
+-// isSlice reports whether the object's underlying type is a slice.
+-func isSlice(obj types.Object) bool {
+- if obj != nil && obj.Type() != nil {
+- if _, ok := obj.Type().Underlying().(*types.Slice); ok {
+- return true
+- }
+- }
+- return false
+-}
+-
+-// forEachPackageMember calls f(tok, id, fn) for each package-level
+-// TYPE/VAR/CONST/FUNC declaration in the Go source file, based on a
+-// quick partial parse. fn is non-nil only for function declarations.
+-// The AST position information is garbage.
+-func forEachPackageMember(content []byte, f func(tok token.Token, id *ast.Ident, fn *ast.FuncDecl)) {
+- purged := purgeFuncBodies(content)
+- file, _ := parser.ParseFile(token.NewFileSet(), "", purged, 0)
+- for _, decl := range file.Decls {
+- switch decl := decl.(type) {
+- case *ast.GenDecl:
+- for _, spec := range decl.Specs {
+- switch spec := spec.(type) {
+- case *ast.ValueSpec: // var/const
+- for _, id := range spec.Names {
+- f(decl.Tok, id, nil)
+- }
+- case *ast.TypeSpec:
+- f(decl.Tok, spec.Name, nil)
+- }
+- }
+- case *ast.FuncDecl:
+- if decl.Recv == nil {
+- f(token.FUNC, decl.Name, decl)
+- }
+- }
+- }
+-}
+-
+-// purgeFuncBodies returns a copy of src in which the contents of each
+-// outermost {...} region except struct and interface types have been
+-// deleted. It does not preserve newlines. This reduces the amount of
+-// work required to parse the top-level declarations.
+-func purgeFuncBodies(src []byte) []byte {
+- // Destroy the content of any {...}-bracketed regions that are
+- // not immediately preceded by a "struct" or "interface"
+- // token. That includes function bodies, composite literals,
+- // switch/select bodies, and all blocks of statements.
+- // This will lead to non-void functions that don't have return
+- // statements, which of course is a type error, but that's ok.
+-
+- var out bytes.Buffer
+- file := token.NewFileSet().AddFile("", -1, len(src))
+- var sc scanner.Scanner
+- sc.Init(file, src, nil, 0)
+- var prev token.Token
+- var cursor int // last consumed src offset
+- var braces []token.Pos // stack of unclosed braces or -1 for struct/interface type
+- for {
+- pos, tok, _ := sc.Scan()
+- if tok == token.EOF {
+- break
+- }
+- switch tok {
+- case token.COMMENT:
+- // TODO(adonovan): opt: skip, to save an estimated 20% of time.
+-
+- case token.LBRACE:
+- if prev == token.STRUCT || prev == token.INTERFACE {
+- pos = -1
+- }
+- braces = append(braces, pos)
+-
+- case token.RBRACE:
+- if last := len(braces) - 1; last >= 0 {
+- top := braces[last]
+- braces = braces[:last]
+- if top < 0 {
+- // struct/interface type: leave alone
+- } else if len(braces) == 0 { // toplevel only
+- // Delete {...} body.
+- start, _ := safetoken.Offset(file, top)
+- end, _ := safetoken.Offset(file, pos)
+- out.Write(src[cursor : start+len("{")])
+- cursor = end
+- }
+- }
+- }
+- prev = tok
+- }
+- out.Write(src[cursor:])
+- return out.Bytes()
+-}
+diff -urN a/gopls/internal/lsp/source/completion/deep_completion.go b/gopls/internal/lsp/source/completion/deep_completion.go
+--- a/gopls/internal/lsp/source/completion/deep_completion.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/deep_completion.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,362 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "context"
+- "go/types"
+- "strings"
+- "time"
+-)
+-
+-// MaxDeepCompletions limits deep completion results because in most cases
+-// there are too many to be useful.
+-const MaxDeepCompletions = 3
+-
+-// deepCompletionState stores our state as we search for deep completions.
+-// "deep completion" refers to searching into objects' fields and methods to
+-// find more completion candidates.
+-type deepCompletionState struct {
+- // enabled indicates whether deep completion is permitted.
+- enabled bool
+-
+- // queueClosed is used to disable adding new sub-fields to search queue
+- // once we're running out of our time budget.
+- queueClosed bool
+-
+- // thisQueue holds the current breadth first search queue.
+- thisQueue []candidate
+-
+- // nextQueue holds the next breadth first search iteration's queue.
+- nextQueue []candidate
+-
+- // highScores tracks the highest deep candidate scores we have found
+- // so far. This is used to avoid work for low scoring deep candidates.
+- highScores [MaxDeepCompletions]float64
+-
+- // candidateCount is the count of unique deep candidates encountered
+- // so far.
+- candidateCount int
+-}
+-
+-// enqueue adds a candidate to the search queue.
+-func (s *deepCompletionState) enqueue(cand candidate) {
+- s.nextQueue = append(s.nextQueue, cand)
+-}
+-
+-// dequeue removes and returns the leftmost element from the search queue.
+-func (s *deepCompletionState) dequeue() *candidate {
+- var cand *candidate
+- cand, s.thisQueue = &s.thisQueue[len(s.thisQueue)-1], s.thisQueue[:len(s.thisQueue)-1]
+- return cand
+-}
+-
+-// scorePenalty computes a deep candidate score penalty. A candidate is
+-// penalized based on depth to favor shallower candidates. We also give a
+-// slight bonus to unexported objects and a slight additional penalty to
+-// function objects.
+-func (s *deepCompletionState) scorePenalty(cand *candidate) float64 {
+- var deepPenalty float64
+- for _, dc := range cand.path {
+- deepPenalty++
+-
+- if !dc.Exported() {
+- deepPenalty -= 0.1
+- }
+-
+- if _, isSig := dc.Type().Underlying().(*types.Signature); isSig {
+- deepPenalty += 0.1
+- }
+- }
+-
+- // Normalize penalty to a max depth of 10.
+- return deepPenalty / 10
+-}
+-
+-// isHighScore returns whether score is among the top MaxDeepCompletions deep
+-// candidate scores encountered so far. If so, it adds score to highScores,
+-// possibly displacing an existing high score.
+-func (s *deepCompletionState) isHighScore(score float64) bool {
+- // Invariant: s.highScores is sorted with highest score first. Unclaimed
+- // positions are trailing zeros.
+-
+- // If we beat an existing score then take its spot.
+- for i, deepScore := range s.highScores {
+- if score <= deepScore {
+- continue
+- }
+-
+- if deepScore != 0 && i != len(s.highScores)-1 {
+- // If this wasn't an empty slot then we need to scooch everyone
+- // down one spot.
+- copy(s.highScores[i+1:], s.highScores[i:])
+- }
+- s.highScores[i] = score
+- return true
+- }
+-
+- return false
+-}
+-
+-// newPath returns path from search root for an object following a given
+-// candidate.
+-func (s *deepCompletionState) newPath(cand candidate, obj types.Object) []types.Object {
+- path := make([]types.Object, len(cand.path)+1)
+- copy(path, cand.path)
+- path[len(path)-1] = obj
+-
+- return path
+-}
+-
+-// deepSearch searches a candidate and its subordinate objects for completion
+-// items if deep completion is enabled and adds the valid candidates to
+-// completion items.
+-func (c *completer) deepSearch(ctx context.Context) {
+- defer func() {
+- // We can return early before completing the search, so be sure to
+- // clear out our queues to not impact any further invocations.
+- c.deepState.thisQueue = c.deepState.thisQueue[:0]
+- c.deepState.nextQueue = c.deepState.nextQueue[:0]
+- }()
+-
+- for len(c.deepState.nextQueue) > 0 {
+- c.deepState.thisQueue, c.deepState.nextQueue = c.deepState.nextQueue, c.deepState.thisQueue[:0]
+-
+- outer:
+- for _, cand := range c.deepState.thisQueue {
+- obj := cand.obj
+-
+- if obj == nil {
+- continue
+- }
+-
+- // At the top level, dedupe by object.
+- if len(cand.path) == 0 {
+- if c.seen[obj] {
+- continue
+- }
+- c.seen[obj] = true
+- }
+-
+- // If obj is not accessible because it lives in another package and is
+- // not exported, don't treat it as a completion candidate unless it's
+- // a package completion candidate.
+- if !c.completionContext.packageCompletion &&
+- obj.Pkg() != nil && obj.Pkg() != c.pkg.GetTypes() && !obj.Exported() {
+- continue
+- }
+-
+- // If we want a type name, don't offer non-type name candidates.
+- // However, do offer package names since they can contain type names,
+- // and do offer any candidate without a type since we aren't sure if it
+- // is a type name or not (i.e. unimported candidate).
+- if c.wantTypeName() && obj.Type() != nil && !isTypeName(obj) && !isPkgName(obj) {
+- continue
+- }
+-
+- // When searching deep, make sure we don't have a cycle in our chain.
+- // We don't dedupe by object because we want to allow both "foo.Baz"
+- // and "bar.Baz" even though "Baz" is represented the same types.Object
+- // in both.
+- for _, seenObj := range cand.path {
+- if seenObj == obj {
+- continue outer
+- }
+- }
+-
+- c.addCandidate(ctx, &cand)
+-
+- c.deepState.candidateCount++
+- if c.opts.budget > 0 && c.deepState.candidateCount%100 == 0 {
+- spent := float64(time.Since(c.startTime)) / float64(c.opts.budget)
+- select {
+- case <-ctx.Done():
+- return
+- default:
+- // If we are almost out of budgeted time, no further elements
+- // should be added to the queue. This ensures remaining time is
+- // used for processing current queue.
+- if !c.deepState.queueClosed && spent >= 0.85 {
+- c.deepState.queueClosed = true
+- }
+- }
+- }
+-
+- // if deep search is disabled, don't add any more candidates.
+- if !c.deepState.enabled || c.deepState.queueClosed {
+- continue
+- }
+-
+- // Searching members for a type name doesn't make sense.
+- if isTypeName(obj) {
+- continue
+- }
+- if obj.Type() == nil {
+- continue
+- }
+-
+- // Don't search embedded fields because they were already included in their
+- // parent's fields.
+- if v, ok := obj.(*types.Var); ok && v.Embedded() {
+- continue
+- }
+-
+- if sig, ok := obj.Type().Underlying().(*types.Signature); ok {
+- // If obj is a function that takes no arguments and returns one
+- // value, keep searching across the function call.
+- if sig.Params().Len() == 0 && sig.Results().Len() == 1 {
+- path := c.deepState.newPath(cand, obj)
+- // The result of a function call is not addressable.
+- c.methodsAndFields(sig.Results().At(0).Type(), false, cand.imp, func(newCand candidate) {
+- newCand.pathInvokeMask = cand.pathInvokeMask | (1 << uint64(len(cand.path)))
+- newCand.path = path
+- c.deepState.enqueue(newCand)
+- })
+- }
+- }
+-
+- path := c.deepState.newPath(cand, obj)
+- switch obj := obj.(type) {
+- case *types.PkgName:
+- c.packageMembers(obj.Imported(), stdScore, cand.imp, func(newCand candidate) {
+- newCand.pathInvokeMask = cand.pathInvokeMask
+- newCand.path = path
+- c.deepState.enqueue(newCand)
+- })
+- default:
+- c.methodsAndFields(obj.Type(), cand.addressable, cand.imp, func(newCand candidate) {
+- newCand.pathInvokeMask = cand.pathInvokeMask
+- newCand.path = path
+- c.deepState.enqueue(newCand)
+- })
+- }
+- }
+- }
+-}
+-
+-// addCandidate adds a completion candidate to suggestions, without searching
+-// its members for more candidates.
+-func (c *completer) addCandidate(ctx context.Context, cand *candidate) {
+- obj := cand.obj
+- if c.matchingCandidate(cand) {
+- cand.score *= highScore
+-
+- if p := c.penalty(cand); p > 0 {
+- cand.score *= (1 - p)
+- }
+- } else if isTypeName(obj) {
+- // If obj is a *types.TypeName that didn't otherwise match, check
+- // if a literal object of this type makes a good candidate.
+-
+- // We only care about named types (i.e. don't want builtin types).
+- if _, isNamed := obj.Type().(*types.Named); isNamed {
+- c.literal(ctx, obj.Type(), cand.imp)
+- }
+- }
+-
+- // Lower score of method calls so we prefer fields and vars over calls.
+- if cand.hasMod(invoke) {
+- if sig, ok := obj.Type().Underlying().(*types.Signature); ok && sig.Recv() != nil {
+- cand.score *= 0.9
+- }
+- }
+-
+- // Prefer private objects over public ones.
+- if !obj.Exported() && obj.Parent() != types.Universe {
+- cand.score *= 1.1
+- }
+-
+- // Slight penalty for index modifier (e.g. changing "foo" to
+- // "foo[]") to curb false positives.
+- if cand.hasMod(index) {
+- cand.score *= 0.9
+- }
+-
+- // Favor shallow matches by lowering score according to depth.
+- cand.score -= cand.score * c.deepState.scorePenalty(cand)
+-
+- if cand.score < 0 {
+- cand.score = 0
+- }
+-
+- cand.name = deepCandName(cand)
+- if item, err := c.item(ctx, *cand); err == nil {
+- c.items = append(c.items, item)
+- }
+-}
+-
+-// deepCandName produces the full candidate name including any
+-// ancestor objects. For example, "foo.bar().baz" for candidate "baz".
+-func deepCandName(cand *candidate) string {
+- totalLen := len(cand.obj.Name())
+- for i, obj := range cand.path {
+- totalLen += len(obj.Name()) + 1
+- if cand.pathInvokeMask&(1<<uint16(i)) > 0 {
+- totalLen += 2
+- }
+- }
+-
+- var buf strings.Builder
+- buf.Grow(totalLen)
+-
+- for i, obj := range cand.path {
+- buf.WriteString(obj.Name())
+- if cand.pathInvokeMask&(1<<uint16(i)) > 0 {
+- buf.WriteByte('(')
+- buf.WriteByte(')')
+- }
+- buf.WriteByte('.')
+- }
+-
+- buf.WriteString(cand.obj.Name())
+-
+- return buf.String()
+-}
+-
+-// penalty reports a score penalty for cand in the range (0, 1).
+-// For example, a candidate is penalized if it has already been used
+-// in another switch case statement.
+-func (c *completer) penalty(cand *candidate) float64 {
+- for _, p := range c.inference.penalized {
+- if c.objChainMatches(cand, p.objChain) {
+- return p.penalty
+- }
+- }
+-
+- return 0
+-}
+-
+-// objChainMatches reports whether cand combined with the surrounding
+-// object prefix matches chain.
+-func (c *completer) objChainMatches(cand *candidate, chain []types.Object) bool {
+- // For example, when completing:
+- //
+- // foo.ba<>
+- //
+- // If we are considering the deep candidate "bar.baz", cand is baz,
+- // objChain is [foo] and deepChain is [bar]. We would match the
+- // chain [foo, bar, baz].
+- if len(chain) != len(c.inference.objChain)+len(cand.path)+1 {
+- return false
+- }
+-
+- if chain[len(chain)-1] != cand.obj {
+- return false
+- }
+-
+- for i, o := range c.inference.objChain {
+- if chain[i] != o {
+- return false
+- }
+- }
+-
+- for i, o := range cand.path {
+- if chain[i+len(c.inference.objChain)] != o {
+- return false
+- }
+- }
+-
+- return true
+-}
+diff -urN a/gopls/internal/lsp/source/completion/deep_completion_test.go b/gopls/internal/lsp/source/completion/deep_completion_test.go
+--- a/gopls/internal/lsp/source/completion/deep_completion_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/deep_completion_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,33 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "testing"
+-)
+-
+-func TestDeepCompletionIsHighScore(t *testing.T) {
+- // Test that deepCompletionState.isHighScore properly tracks the top
+- // N=MaxDeepCompletions scores.
+-
+- var s deepCompletionState
+-
+- if !s.isHighScore(1) {
+- // No other scores yet, anything is a winner.
+- t.Error("1 should be high score")
+- }
+-
+- // Fill up with higher scores.
+- for i := 0; i < MaxDeepCompletions; i++ {
+- if !s.isHighScore(10) {
+- t.Error("10 should be high score")
+- }
+- }
+-
+- // High scores should be filled with 10s so 2 is not a high score.
+- if s.isHighScore(2) {
+- t.Error("2 shouldn't be high score")
+- }
+-}
+diff -urN a/gopls/internal/lsp/source/completion/definition.go b/gopls/internal/lsp/source/completion/definition.go
+--- a/gopls/internal/lsp/source/completion/definition.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/definition.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,160 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "go/ast"
+- "go/types"
+- "strings"
+- "unicode"
+- "unicode/utf8"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/snippet"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-// some function definitions in test files can be completed
+-// So far, TestFoo(t *testing.T), TestMain(m *testing.M)
+-// BenchmarkFoo(b *testing.B), FuzzFoo(f *testing.F)
+-
+-// path[0] is known to be *ast.Ident
+-func definition(path []ast.Node, obj types.Object, pgf *source.ParsedGoFile) ([]CompletionItem, *Selection) {
+- if _, ok := obj.(*types.Func); !ok {
+- return nil, nil // not a function at all
+- }
+- if !strings.HasSuffix(pgf.URI.Filename(), "_test.go") {
+- return nil, nil // not a test file
+- }
+-
+- name := path[0].(*ast.Ident).Name
+- if len(name) == 0 {
+- // can't happen
+- return nil, nil
+- }
+- start := path[0].Pos()
+- end := path[0].End()
+- sel := &Selection{
+- content: "",
+- cursor: start,
+- tokFile: pgf.Tok,
+- start: start,
+- end: end,
+- mapper: pgf.Mapper,
+- }
+- var ans []CompletionItem
+- var hasParens bool
+- n, ok := path[1].(*ast.FuncDecl)
+- if !ok {
+- return nil, nil // can't happen
+- }
+- if n.Recv != nil {
+- return nil, nil // a method, not a function
+- }
+- t := n.Type.Params
+- if t.Closing != t.Opening {
+- hasParens = true
+- }
+-
+- // Always suggest TestMain, if possible
+- if strings.HasPrefix("TestMain", name) {
+- if hasParens {
+- ans = append(ans, defItem("TestMain", obj))
+- } else {
+- ans = append(ans, defItem("TestMain(m *testing.M)", obj))
+- }
+- }
+-
+- // If a snippet is possible, suggest it
+- if strings.HasPrefix("Test", name) {
+- if hasParens {
+- ans = append(ans, defItem("Test", obj))
+- } else {
+- ans = append(ans, defSnippet("Test", "(t *testing.T)", obj))
+- }
+- return ans, sel
+- } else if strings.HasPrefix("Benchmark", name) {
+- if hasParens {
+- ans = append(ans, defItem("Benchmark", obj))
+- } else {
+- ans = append(ans, defSnippet("Benchmark", "(b *testing.B)", obj))
+- }
+- return ans, sel
+- } else if strings.HasPrefix("Fuzz", name) {
+- if hasParens {
+- ans = append(ans, defItem("Fuzz", obj))
+- } else {
+- ans = append(ans, defSnippet("Fuzz", "(f *testing.F)", obj))
+- }
+- return ans, sel
+- }
+-
+- // Fill in the argument for what the user has already typed
+- if got := defMatches(name, "Test", path, "(t *testing.T)"); got != "" {
+- ans = append(ans, defItem(got, obj))
+- } else if got := defMatches(name, "Benchmark", path, "(b *testing.B)"); got != "" {
+- ans = append(ans, defItem(got, obj))
+- } else if got := defMatches(name, "Fuzz", path, "(f *testing.F)"); got != "" {
+- ans = append(ans, defItem(got, obj))
+- }
+- return ans, sel
+-}
+-
+-// defMatches returns text for defItem, never for defSnippet
+-func defMatches(name, pat string, path []ast.Node, arg string) string {
+- if !strings.HasPrefix(name, pat) {
+- return ""
+- }
+- c, _ := utf8.DecodeRuneInString(name[len(pat):])
+- if unicode.IsLower(c) {
+- return ""
+- }
+- fd, ok := path[1].(*ast.FuncDecl)
+- if !ok {
+- // we don't know what's going on
+- return ""
+- }
+- fp := fd.Type.Params
+- if len(fp.List) > 0 {
+- // signature already there, nothing to suggest
+- return ""
+- }
+- if fp.Opening != fp.Closing {
+- // nothing: completion works on words, not easy to insert arg
+- return ""
+- }
+- // suggesting signature too
+- return name + arg
+-}
+-
+-func defSnippet(prefix, suffix string, obj types.Object) CompletionItem {
+- var sn snippet.Builder
+- sn.WriteText(prefix)
+- sn.WritePlaceholder(func(b *snippet.Builder) { b.WriteText("Xxx") })
+- sn.WriteText(suffix + " {\n\t")
+- sn.WriteFinalTabstop()
+- sn.WriteText("\n}")
+- return CompletionItem{
+- Label: prefix + "Xxx" + suffix,
+- Detail: "tab, type the rest of the name, then tab",
+- Kind: protocol.FunctionCompletion,
+- Depth: 0,
+- Score: 10,
+- snippet: &sn,
+- Documentation: prefix + " test function",
+- isSlice: isSlice(obj),
+- }
+-}
+-func defItem(val string, obj types.Object) CompletionItem {
+- return CompletionItem{
+- Label: val,
+- InsertText: val,
+- Kind: protocol.FunctionCompletion,
+- Depth: 0,
+- Score: 9, // prefer the snippets when available
+- Documentation: "complete the function name",
+- isSlice: isSlice(obj),
+- }
+-}
+diff -urN a/gopls/internal/lsp/source/completion/format.go b/gopls/internal/lsp/source/completion/format.go
+--- a/gopls/internal/lsp/source/completion/format.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/format.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,338 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "context"
+- "errors"
+- "fmt"
+- "go/ast"
+- "go/doc"
+- "go/types"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/lsp/snippet"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/imports"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-var (
+- errNoMatch = errors.New("not a surrounding match")
+- errLowScore = errors.New("not a high scoring candidate")
+-)
+-
+-// item formats a candidate to a CompletionItem.
+-func (c *completer) item(ctx context.Context, cand candidate) (CompletionItem, error) {
+- obj := cand.obj
+-
+- // if the object isn't a valid match against the surrounding, return early.
+- matchScore := c.matcher.Score(cand.name)
+- if matchScore <= 0 {
+- return CompletionItem{}, errNoMatch
+- }
+- cand.score *= float64(matchScore)
+-
+- // Ignore deep candidates that won't be in the MaxDeepCompletions anyway.
+- if len(cand.path) != 0 && !c.deepState.isHighScore(cand.score) {
+- return CompletionItem{}, errLowScore
+- }
+-
+- // Handle builtin types separately.
+- if obj.Parent() == types.Universe {
+- return c.formatBuiltin(ctx, cand)
+- }
+-
+- var (
+- label = cand.name
+- detail = types.TypeString(obj.Type(), c.qf)
+- insert = label
+- kind = protocol.TextCompletion
+- snip snippet.Builder
+- protocolEdits []protocol.TextEdit
+- )
+- if obj.Type() == nil {
+- detail = ""
+- }
+- if isTypeName(obj) && c.wantTypeParams() {
+- x := cand.obj.(*types.TypeName)
+- if named, ok := x.Type().(*types.Named); ok {
+- tp := typeparams.ForNamed(named)
+- label += source.FormatTypeParams(tp)
+- insert = label // maintain invariant above (label == insert)
+- }
+- }
+-
+- snip.WriteText(insert)
+-
+- switch obj := obj.(type) {
+- case *types.TypeName:
+- detail, kind = source.FormatType(obj.Type(), c.qf)
+- case *types.Const:
+- kind = protocol.ConstantCompletion
+- case *types.Var:
+- if _, ok := obj.Type().(*types.Struct); ok {
+- detail = "struct{...}" // for anonymous structs
+- } else if obj.IsField() {
+- var err error
+- detail, err = source.FormatVarType(ctx, c.snapshot, c.pkg, obj, c.qf, c.mq)
+- if err != nil {
+- return CompletionItem{}, err
+- }
+- }
+- if obj.IsField() {
+- kind = protocol.FieldCompletion
+- c.structFieldSnippet(cand, detail, &snip)
+- } else {
+- kind = protocol.VariableCompletion
+- }
+- if obj.Type() == nil {
+- break
+- }
+- case *types.Func:
+- sig, ok := obj.Type().Underlying().(*types.Signature)
+- if !ok {
+- break
+- }
+- kind = protocol.FunctionCompletion
+- if sig != nil && sig.Recv() != nil {
+- kind = protocol.MethodCompletion
+- }
+- case *types.PkgName:
+- kind = protocol.ModuleCompletion
+- detail = fmt.Sprintf("%q", obj.Imported().Path())
+- case *types.Label:
+- kind = protocol.ConstantCompletion
+- detail = "label"
+- }
+-
+- var prefix string
+- for _, mod := range cand.mods {
+- switch mod {
+- case reference:
+- prefix = "&" + prefix
+- case dereference:
+- prefix = "*" + prefix
+- case chanRead:
+- prefix = "<-" + prefix
+- }
+- }
+-
+- var (
+- suffix string
+- funcType = obj.Type()
+- )
+-Suffixes:
+- for _, mod := range cand.mods {
+- switch mod {
+- case invoke:
+- if sig, ok := funcType.Underlying().(*types.Signature); ok {
+- s, err := source.NewSignature(ctx, c.snapshot, c.pkg, sig, nil, c.qf, c.mq)
+- if err != nil {
+- return CompletionItem{}, err
+- }
+- c.functionCallSnippet("", s.TypeParams(), s.Params(), &snip)
+- if sig.Results().Len() == 1 {
+- funcType = sig.Results().At(0).Type()
+- }
+- detail = "func" + s.Format()
+- }
+-
+- if !c.opts.snippets {
+- // Without snippets the candidate will not include "()". Don't
+- // add further suffixes since they will be invalid. For
+- // example, with snippets "foo()..." would become "foo..."
+- // without snippets if we added the dotDotDot.
+- break Suffixes
+- }
+- case takeSlice:
+- suffix += "[:]"
+- case takeDotDotDot:
+- suffix += "..."
+- case index:
+- snip.WriteText("[")
+- snip.WritePlaceholder(nil)
+- snip.WriteText("]")
+- }
+- }
+-
+- // If this candidate needs an additional import statement,
+- // add the additional text edits needed.
+- if cand.imp != nil {
+- addlEdits, err := c.importEdits(cand.imp)
+-
+- if err != nil {
+- return CompletionItem{}, err
+- }
+-
+- protocolEdits = append(protocolEdits, addlEdits...)
+- if kind != protocol.ModuleCompletion {
+- if detail != "" {
+- detail += " "
+- }
+- detail += fmt.Sprintf("(from %q)", cand.imp.importPath)
+- }
+- }
+-
+- if cand.convertTo != nil {
+- typeName := types.TypeString(cand.convertTo, c.qf)
+-
+- switch cand.convertTo.(type) {
+- // We need extra parens when casting to these types. For example,
+- // we need "(*int)(foo)", not "*int(foo)".
+- case *types.Pointer, *types.Signature:
+- typeName = "(" + typeName + ")"
+- }
+-
+- prefix = typeName + "(" + prefix
+- suffix = ")"
+- }
+-
+- if prefix != "" {
+- // If we are in a selector, add an edit to place prefix before selector.
+- if sel := enclosingSelector(c.path, c.pos); sel != nil {
+- edits, err := c.editText(sel.Pos(), sel.Pos(), prefix)
+- if err != nil {
+- return CompletionItem{}, err
+- }
+- protocolEdits = append(protocolEdits, edits...)
+- } else {
+- // If there is no selector, just stick the prefix at the start.
+- insert = prefix + insert
+- snip.PrependText(prefix)
+- }
+- }
+-
+- if suffix != "" {
+- insert += suffix
+- snip.WriteText(suffix)
+- }
+-
+- detail = strings.TrimPrefix(detail, "untyped ")
+- // override computed detail with provided detail, if something is provided.
+- if cand.detail != "" {
+- detail = cand.detail
+- }
+- item := CompletionItem{
+- Label: label,
+- InsertText: insert,
+- AdditionalTextEdits: protocolEdits,
+- Detail: detail,
+- Kind: kind,
+- Score: cand.score,
+- Depth: len(cand.path),
+- snippet: &snip,
+- isSlice: isSlice(obj),
+- }
+- // If the user doesn't want documentation for completion items.
+- if !c.opts.documentation {
+- return item, nil
+- }
+- pos := safetoken.StartPosition(c.pkg.FileSet(), obj.Pos())
+-
+- // We ignore errors here, because some types, like "unsafe" or "error",
+- // may not have valid positions that we can use to get documentation.
+- if !pos.IsValid() {
+- return item, nil
+- }
+-
+- comment, err := source.HoverDocForObject(ctx, c.snapshot, c.pkg.FileSet(), obj)
+- if err != nil {
+- event.Error(ctx, fmt.Sprintf("failed to find Hover for %q", obj.Name()), err)
+- return item, nil
+- }
+- if c.opts.fullDocumentation {
+- item.Documentation = comment.Text()
+- } else {
+- item.Documentation = doc.Synopsis(comment.Text())
+- }
+- // The desired pattern is `^// Deprecated`, but the prefix has been removed
+- // TODO(rfindley): It doesn't look like this does the right thing for
+- // multi-line comments.
+- if strings.HasPrefix(comment.Text(), "Deprecated") {
+- if c.snapshot.View().Options().CompletionTags {
+- item.Tags = []protocol.CompletionItemTag{protocol.ComplDeprecated}
+- } else if c.snapshot.View().Options().CompletionDeprecated {
+- item.Deprecated = true
+- }
+- }
+-
+- return item, nil
+-}
+-
+-// importEdits produces the text edits necessary to add the given import to the current file.
+-func (c *completer) importEdits(imp *importInfo) ([]protocol.TextEdit, error) {
+- if imp == nil {
+- return nil, nil
+- }
+-
+- pgf, err := c.pkg.File(span.URIFromPath(c.filename))
+- if err != nil {
+- return nil, err
+- }
+-
+- return source.ComputeOneImportFixEdits(c.snapshot, pgf, &imports.ImportFix{
+- StmtInfo: imports.ImportInfo{
+- ImportPath: imp.importPath,
+- Name: imp.name,
+- },
+- // IdentName is unused on this path and is difficult to get.
+- FixType: imports.AddImport,
+- })
+-}
+-
+-func (c *completer) formatBuiltin(ctx context.Context, cand candidate) (CompletionItem, error) {
+- obj := cand.obj
+- item := CompletionItem{
+- Label: obj.Name(),
+- InsertText: obj.Name(),
+- Score: cand.score,
+- }
+- switch obj.(type) {
+- case *types.Const:
+- item.Kind = protocol.ConstantCompletion
+- case *types.Builtin:
+- item.Kind = protocol.FunctionCompletion
+- sig, err := source.NewBuiltinSignature(ctx, c.snapshot, obj.Name())
+- if err != nil {
+- return CompletionItem{}, err
+- }
+- item.Detail = "func" + sig.Format()
+- item.snippet = &snippet.Builder{}
+- c.functionCallSnippet(obj.Name(), sig.TypeParams(), sig.Params(), item.snippet)
+- case *types.TypeName:
+- if types.IsInterface(obj.Type()) {
+- item.Kind = protocol.InterfaceCompletion
+- } else {
+- item.Kind = protocol.ClassCompletion
+- }
+- case *types.Nil:
+- item.Kind = protocol.VariableCompletion
+- }
+- return item, nil
+-}
+-
+-// decide if the type params (if any) should be part of the completion
+-// which only possible for types.Named and types.Signature
+-// (so far, only in receivers, e.g.; func (s *GENERIC[K, V])..., which is a types.Named)
+-func (c *completer) wantTypeParams() bool {
+- // Need to be lexically in a receiver, and a child of an IndexListExpr
+- // (but IndexListExpr only exists with go1.18)
+- start := c.path[0].Pos()
+- for i, nd := range c.path {
+- if fd, ok := nd.(*ast.FuncDecl); ok {
+- if i > 0 && fd.Recv != nil && start < fd.Recv.End() {
+- return true
+- } else {
+- return false
+- }
+- }
+- }
+- return false
+-}
+diff -urN a/gopls/internal/lsp/source/completion/fuzz.go b/gopls/internal/lsp/source/completion/fuzz.go
+--- a/gopls/internal/lsp/source/completion/fuzz.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/fuzz.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,142 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-// golang/go#51089
+-// *testing.F deserves special treatment as member use is constrained:
+-// The arguments to f.Fuzz are determined by the arguments to a previous f.Add
+-// Inside f.Fuzz only f.Failed and f.Name are allowed.
+-// PJW: are there other packages where we can deduce usage constraints?
+-
+-// if we find fuzz completions, then return true, as those are the only completions to offer
+-func (c *completer) fuzz(typ types.Type, mset *types.MethodSet, imp *importInfo, cb func(candidate), fset *token.FileSet) bool {
+- // 1. inside f.Fuzz? (only f.Failed and f.Name)
+- // 2. possible completing f.Fuzz?
+- // [Ident,SelectorExpr,Callexpr,ExprStmt,BlockiStmt,FuncDecl(Fuzz...)]
+- // 3. before f.Fuzz, same (for 2., offer choice when looking at an F)
+-
+- // does the path contain FuncLit as arg to f.Fuzz CallExpr?
+- inside := false
+-Loop:
+- for i, n := range c.path {
+- switch v := n.(type) {
+- case *ast.CallExpr:
+- if len(v.Args) != 1 {
+- continue Loop
+- }
+- if _, ok := v.Args[0].(*ast.FuncLit); !ok {
+- continue
+- }
+- if s, ok := v.Fun.(*ast.SelectorExpr); !ok || s.Sel.Name != "Fuzz" {
+- continue
+- }
+- if i > 2 { // avoid t.Fuzz itself in tests
+- inside = true
+- break Loop
+- }
+- }
+- }
+- if inside {
+- for i := 0; i < mset.Len(); i++ {
+- o := mset.At(i).Obj()
+- if o.Name() == "Failed" || o.Name() == "Name" {
+- cb(candidate{
+- obj: o,
+- score: stdScore,
+- imp: imp,
+- addressable: true,
+- })
+- }
+- }
+- return true
+- }
+- // if it could be t.Fuzz, look for the preceding t.Add
+- id, ok := c.path[0].(*ast.Ident)
+- if ok && strings.HasPrefix("Fuzz", id.Name) {
+- var add *ast.CallExpr
+- f := func(n ast.Node) bool {
+- if n == nil {
+- return true
+- }
+- call, ok := n.(*ast.CallExpr)
+- if !ok {
+- return true
+- }
+- s, ok := call.Fun.(*ast.SelectorExpr)
+- if !ok {
+- return true
+- }
+- if s.Sel.Name != "Add" {
+- return true
+- }
+- // Sel.X should be of type *testing.F
+- got := c.pkg.GetTypesInfo().Types[s.X]
+- if got.Type.String() == "*testing.F" {
+- add = call
+- }
+- return false // because we're done...
+- }
+- // look at the enclosing FuzzFoo functions
+- if len(c.path) < 2 {
+- return false
+- }
+- n := c.path[len(c.path)-2]
+- if _, ok := n.(*ast.FuncDecl); !ok {
+- // the path should start with ast.File, ast.FuncDecl, ...
+- // but it didn't, so give up
+- return false
+- }
+- ast.Inspect(n, f)
+- if add == nil {
+- // looks like f.Fuzz without a preceding f.Add.
+- // let the regular completion handle it.
+- return false
+- }
+-
+- lbl := "Fuzz(func(t *testing.T"
+- for i, a := range add.Args {
+- info := c.pkg.GetTypesInfo().TypeOf(a)
+- if info == nil {
+- return false // How could this happen, but better safe than panic.
+- }
+- lbl += fmt.Sprintf(", %c %s", 'a'+i, info)
+- }
+- lbl += ")"
+- xx := CompletionItem{
+- Label: lbl,
+- InsertText: lbl,
+- Kind: protocol.FunctionCompletion,
+- Depth: 0,
+- Score: 10, // pretty confident the user should see this
+- Documentation: "argument types from f.Add",
+- isSlice: false,
+- }
+- c.items = append(c.items, xx)
+- for i := 0; i < mset.Len(); i++ {
+- o := mset.At(i).Obj()
+- if o.Name() != "Fuzz" {
+- cb(candidate{
+- obj: o,
+- score: stdScore,
+- imp: imp,
+- addressable: true,
+- })
+- }
+- }
+- return true // done
+- }
+- // let the standard processing take care of it instead
+- return false
+-}
+diff -urN a/gopls/internal/lsp/source/completion/keywords.go b/gopls/internal/lsp/source/completion/keywords.go
+--- a/gopls/internal/lsp/source/completion/keywords.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/keywords.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,154 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "go/ast"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-const (
+- BREAK = "break"
+- CASE = "case"
+- CHAN = "chan"
+- CONST = "const"
+- CONTINUE = "continue"
+- DEFAULT = "default"
+- DEFER = "defer"
+- ELSE = "else"
+- FALLTHROUGH = "fallthrough"
+- FOR = "for"
+- FUNC = "func"
+- GO = "go"
+- GOTO = "goto"
+- IF = "if"
+- IMPORT = "import"
+- INTERFACE = "interface"
+- MAP = "map"
+- PACKAGE = "package"
+- RANGE = "range"
+- RETURN = "return"
+- SELECT = "select"
+- STRUCT = "struct"
+- SWITCH = "switch"
+- TYPE = "type"
+- VAR = "var"
+-)
+-
+-// addKeywordCompletions offers keyword candidates appropriate at the position.
+-func (c *completer) addKeywordCompletions() {
+- seen := make(map[string]bool)
+-
+- if c.wantTypeName() && c.inference.objType == nil {
+- // If we want a type name but don't have an expected obj type,
+- // include "interface", "struct", "func", "chan", and "map".
+-
+- // "interface" and "struct" are more common declaring named types.
+- // Give them a higher score if we are in a type declaration.
+- structIntf, funcChanMap := stdScore, highScore
+- if len(c.path) > 1 {
+- if _, namedDecl := c.path[1].(*ast.TypeSpec); namedDecl {
+- structIntf, funcChanMap = highScore, stdScore
+- }
+- }
+-
+- c.addKeywordItems(seen, structIntf, STRUCT, INTERFACE)
+- c.addKeywordItems(seen, funcChanMap, FUNC, CHAN, MAP)
+- }
+-
+- // If we are at the file scope, only offer decl keywords. We don't
+- // get *ast.Idents at the file scope because non-keyword identifiers
+- // turn into *ast.BadDecl, not *ast.Ident.
+- if len(c.path) == 1 || isASTFile(c.path[1]) {
+- c.addKeywordItems(seen, stdScore, TYPE, CONST, VAR, FUNC, IMPORT)
+- return
+- } else if _, ok := c.path[0].(*ast.Ident); !ok {
+- // Otherwise only offer keywords if the client is completing an identifier.
+- return
+- }
+-
+- if len(c.path) > 2 {
+- // Offer "range" if we are in ast.ForStmt.Init. This is what the
+- // AST looks like before "range" is typed, e.g. "for i := r<>".
+- if loop, ok := c.path[2].(*ast.ForStmt); ok && source.NodeContains(loop.Init, c.pos) {
+- c.addKeywordItems(seen, stdScore, RANGE)
+- }
+- }
+-
+- // Only suggest keywords if we are beginning a statement.
+- switch n := c.path[1].(type) {
+- case *ast.BlockStmt, *ast.ExprStmt:
+- // OK - our ident must be at beginning of statement.
+- case *ast.CommClause:
+- // Make sure we aren't in the Comm statement.
+- if !n.Colon.IsValid() || c.pos <= n.Colon {
+- return
+- }
+- case *ast.CaseClause:
+- // Make sure we aren't in the case List.
+- if !n.Colon.IsValid() || c.pos <= n.Colon {
+- return
+- }
+- default:
+- return
+- }
+-
+- // Filter out keywords depending on scope
+- // Skip the first one because we want to look at the enclosing scopes
+- path := c.path[1:]
+- for i, n := range path {
+- switch node := n.(type) {
+- case *ast.CaseClause:
+- // only recommend "fallthrough" and "break" within the bodies of a case clause
+- if c.pos > node.Colon {
+- c.addKeywordItems(seen, stdScore, BREAK)
+- // "fallthrough" is only valid in switch statements.
+- // A case clause is always nested within a block statement in a switch statement,
+- // that block statement is nested within either a TypeSwitchStmt or a SwitchStmt.
+- if i+2 >= len(path) {
+- continue
+- }
+- if _, ok := path[i+2].(*ast.SwitchStmt); ok {
+- c.addKeywordItems(seen, stdScore, FALLTHROUGH)
+- }
+- }
+- case *ast.CommClause:
+- if c.pos > node.Colon {
+- c.addKeywordItems(seen, stdScore, BREAK)
+- }
+- case *ast.TypeSwitchStmt, *ast.SelectStmt, *ast.SwitchStmt:
+- c.addKeywordItems(seen, stdScore, CASE, DEFAULT)
+- case *ast.ForStmt, *ast.RangeStmt:
+- c.addKeywordItems(seen, stdScore, BREAK, CONTINUE)
+- // This is a bit weak, functions allow for many keywords
+- case *ast.FuncDecl:
+- if node.Body != nil && c.pos > node.Body.Lbrace {
+- c.addKeywordItems(seen, stdScore, DEFER, RETURN, FOR, GO, SWITCH, SELECT, IF, ELSE, VAR, CONST, GOTO, TYPE)
+- }
+- }
+- }
+-}
+-
+-// addKeywordItems dedupes and adds completion items for the specified
+-// keywords with the specified score.
+-func (c *completer) addKeywordItems(seen map[string]bool, score float64, kws ...string) {
+- for _, kw := range kws {
+- if seen[kw] {
+- continue
+- }
+- seen[kw] = true
+-
+- if matchScore := c.matcher.Score(kw); matchScore > 0 {
+- c.items = append(c.items, CompletionItem{
+- Label: kw,
+- Kind: protocol.KeywordCompletion,
+- InsertText: kw,
+- Score: score * float64(matchScore),
+- })
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/source/completion/labels.go b/gopls/internal/lsp/source/completion/labels.go
+--- a/gopls/internal/lsp/source/completion/labels.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/labels.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,112 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "go/ast"
+- "go/token"
+- "math"
+-)
+-
+-type labelType int
+-
+-const (
+- labelNone labelType = iota
+- labelBreak
+- labelContinue
+- labelGoto
+-)
+-
+-// wantLabelCompletion returns true if we want (only) label
+-// completions at the position.
+-func (c *completer) wantLabelCompletion() labelType {
+- if _, ok := c.path[0].(*ast.Ident); ok && len(c.path) > 1 {
+- // We want a label if we are an *ast.Ident child of a statement
+- // that accepts a label, e.g. "break Lo<>".
+- return takesLabel(c.path[1])
+- }
+-
+- return labelNone
+-}
+-
+-// takesLabel returns the corresponding labelType if n is a statement
+-// that accepts a label, otherwise labelNone.
+-func takesLabel(n ast.Node) labelType {
+- if bs, ok := n.(*ast.BranchStmt); ok {
+- switch bs.Tok {
+- case token.BREAK:
+- return labelBreak
+- case token.CONTINUE:
+- return labelContinue
+- case token.GOTO:
+- return labelGoto
+- }
+- }
+- return labelNone
+-}
+-
+-// labels adds completion items for labels defined in the enclosing
+-// function.
+-func (c *completer) labels(lt labelType) {
+- if c.enclosingFunc == nil {
+- return
+- }
+-
+- addLabel := func(score float64, l *ast.LabeledStmt) {
+- labelObj := c.pkg.GetTypesInfo().ObjectOf(l.Label)
+- if labelObj != nil {
+- c.deepState.enqueue(candidate{obj: labelObj, score: score})
+- }
+- }
+-
+- switch lt {
+- case labelBreak, labelContinue:
+- // "break" and "continue" only accept labels from enclosing statements.
+-
+- for i, p := range c.path {
+- switch p := p.(type) {
+- case *ast.FuncLit:
+- // Labels are function scoped, so don't continue out of functions.
+- return
+- case *ast.LabeledStmt:
+- switch p.Stmt.(type) {
+- case *ast.ForStmt, *ast.RangeStmt:
+- // Loop labels can be used for "break" or "continue".
+- addLabel(highScore*math.Pow(.99, float64(i)), p)
+- case *ast.SwitchStmt, *ast.SelectStmt, *ast.TypeSwitchStmt:
+- // Switch and select labels can be used only for "break".
+- if lt == labelBreak {
+- addLabel(highScore*math.Pow(.99, float64(i)), p)
+- }
+- }
+- }
+- }
+- case labelGoto:
+- // Goto accepts any label in the same function not in a nested
+- // block. It also doesn't take labels that would jump across
+- // variable definitions, but ignore that case for now.
+- ast.Inspect(c.enclosingFunc.body, func(n ast.Node) bool {
+- if n == nil {
+- return false
+- }
+-
+- switch n := n.(type) {
+- // Only search into block-like nodes enclosing our "goto".
+- // This prevents us from finding labels in nested blocks.
+- case *ast.BlockStmt, *ast.CommClause, *ast.CaseClause:
+- for _, p := range c.path {
+- if n == p {
+- return true
+- }
+- }
+- return false
+- case *ast.LabeledStmt:
+- addLabel(highScore, n)
+- }
+-
+- return true
+- })
+- }
+-}
+diff -urN a/gopls/internal/lsp/source/completion/literal.go b/gopls/internal/lsp/source/completion/literal.go
+--- a/gopls/internal/lsp/source/completion/literal.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/literal.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,592 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "context"
+- "fmt"
+- "go/types"
+- "strings"
+- "unicode"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/snippet"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-// literal generates composite literal, function literal, and make()
+-// completion items.
+-func (c *completer) literal(ctx context.Context, literalType types.Type, imp *importInfo) {
+- if !c.opts.literal {
+- return
+- }
+-
+- expType := c.inference.objType
+-
+- if c.inference.matchesVariadic(literalType) {
+- // Don't offer literal slice candidates for variadic arguments.
+- // For example, don't offer "[]interface{}{}" in "fmt.Print(<>)".
+- return
+- }
+-
+- // Avoid literal candidates if the expected type is an empty
+- // interface. It isn't very useful to suggest a literal candidate of
+- // every possible type.
+- if expType != nil && isEmptyInterface(expType) {
+- return
+- }
+-
+- // We handle unnamed literal completions explicitly before searching
+- // for candidates. Avoid named-type literal completions for
+- // unnamed-type expected type since that results in duplicate
+- // candidates. For example, in
+- //
+- // type mySlice []int
+- // var []int = <>
+- //
+- // don't offer "mySlice{}" since we have already added a candidate
+- // of "[]int{}".
+- if _, named := literalType.(*types.Named); named && expType != nil {
+- if _, named := source.Deref(expType).(*types.Named); !named {
+- return
+- }
+- }
+-
+- // Check if an object of type literalType would match our expected type.
+- cand := candidate{
+- obj: c.fakeObj(literalType),
+- }
+-
+- switch literalType.Underlying().(type) {
+- // These literal types are addressable (e.g. "&[]int{}"), others are
+- // not (e.g. can't do "&(func(){})").
+- case *types.Struct, *types.Array, *types.Slice, *types.Map:
+- cand.addressable = true
+- }
+-
+- if !c.matchingCandidate(&cand) || cand.convertTo != nil {
+- return
+- }
+-
+- var (
+- qf = c.qf
+- sel = enclosingSelector(c.path, c.pos)
+- )
+-
+- // Don't qualify the type name if we are in a selector expression
+- // since the package name is already present.
+- if sel != nil {
+- qf = func(_ *types.Package) string { return "" }
+- }
+-
+- snip, typeName := c.typeNameSnippet(literalType, qf)
+-
+- // A type name of "[]int" doesn't work very will with the matcher
+- // since "[" isn't a valid identifier prefix. Here we strip off the
+- // slice (and array) prefix yielding just "int".
+- matchName := typeName
+- switch t := literalType.(type) {
+- case *types.Slice:
+- matchName = types.TypeString(t.Elem(), qf)
+- case *types.Array:
+- matchName = types.TypeString(t.Elem(), qf)
+- }
+-
+- addlEdits, err := c.importEdits(imp)
+- if err != nil {
+- event.Error(ctx, "error adding import for literal candidate", err)
+- return
+- }
+-
+- // If prefix matches the type name, client may want a composite literal.
+- if score := c.matcher.Score(matchName); score > 0 {
+- if cand.hasMod(reference) {
+- if sel != nil {
+- // If we are in a selector we must place the "&" before the selector.
+- // For example, "foo.B<>" must complete to "&foo.Bar{}", not
+- // "foo.&Bar{}".
+- edits, err := c.editText(sel.Pos(), sel.Pos(), "&")
+- if err != nil {
+- event.Error(ctx, "error making edit for literal pointer completion", err)
+- return
+- }
+- addlEdits = append(addlEdits, edits...)
+- } else {
+- // Otherwise we can stick the "&" directly before the type name.
+- typeName = "&" + typeName
+- snip.PrependText("&")
+- }
+- }
+-
+- switch t := literalType.Underlying().(type) {
+- case *types.Struct, *types.Array, *types.Slice, *types.Map:
+- c.compositeLiteral(t, snip.Clone(), typeName, float64(score), addlEdits)
+- case *types.Signature:
+- // Add a literal completion for a signature type that implements
+- // an interface. For example, offer "http.HandlerFunc()" when
+- // expected type is "http.Handler".
+- if expType != nil && types.IsInterface(expType) {
+- c.basicLiteral(t, snip.Clone(), typeName, float64(score), addlEdits)
+- }
+- case *types.Basic:
+- // Add a literal completion for basic types that implement our
+- // expected interface (e.g. named string type http.Dir
+- // implements http.FileSystem), or are identical to our expected
+- // type (i.e. yielding a type conversion such as "float64()").
+- if expType != nil && (types.IsInterface(expType) || types.Identical(expType, literalType)) {
+- c.basicLiteral(t, snip.Clone(), typeName, float64(score), addlEdits)
+- }
+- }
+- }
+-
+- // If prefix matches "make", client may want a "make()"
+- // invocation. We also include the type name to allow for more
+- // flexible fuzzy matching.
+- if score := c.matcher.Score("make." + matchName); !cand.hasMod(reference) && score > 0 {
+- switch literalType.Underlying().(type) {
+- case *types.Slice:
+- // The second argument to "make()" for slices is required, so default to "0".
+- c.makeCall(snip.Clone(), typeName, "0", float64(score), addlEdits)
+- case *types.Map, *types.Chan:
+- // Maps and channels don't require the second argument, so omit
+- // to keep things simple for now.
+- c.makeCall(snip.Clone(), typeName, "", float64(score), addlEdits)
+- }
+- }
+-
+- // If prefix matches "func", client may want a function literal.
+- if score := c.matcher.Score("func"); !cand.hasMod(reference) && score > 0 && (expType == nil || !types.IsInterface(expType)) {
+- switch t := literalType.Underlying().(type) {
+- case *types.Signature:
+- c.functionLiteral(ctx, t, float64(score))
+- }
+- }
+-}
+-
+-// literalCandidateScore is the base score for literal candidates.
+-// Literal candidates match the expected type so they should be high
+-// scoring, but we want them ranked below lexical objects of the
+-// correct type, so scale down highScore.
+-const literalCandidateScore = highScore / 2
+-
+-// functionLiteral adds a function literal completion item for the
+-// given signature.
+-func (c *completer) functionLiteral(ctx context.Context, sig *types.Signature, matchScore float64) {
+- snip := &snippet.Builder{}
+- snip.WriteText("func(")
+-
+- // First we generate names for each param and keep a seen count so
+- // we know if we need to uniquify param names. For example,
+- // "func(int)" will become "func(i int)", but "func(int, int64)"
+- // will become "func(i1 int, i2 int64)".
+- var (
+- paramNames = make([]string, sig.Params().Len())
+- paramNameCount = make(map[string]int)
+- hasTypeParams bool
+- )
+- for i := 0; i < sig.Params().Len(); i++ {
+- var (
+- p = sig.Params().At(i)
+- name = p.Name()
+- )
+-
+- if tp, _ := p.Type().(*typeparams.TypeParam); tp != nil && !c.typeParamInScope(tp) {
+- hasTypeParams = true
+- }
+-
+- if name == "" {
+- // If the param has no name in the signature, guess a name based
+- // on the type. Use an empty qualifier to ignore the package.
+- // For example, we want to name "http.Request" "r", not "hr".
+- typeName, err := source.FormatVarType(ctx, c.snapshot, c.pkg, p,
+- func(p *types.Package) string { return "" },
+- func(source.PackageName, source.ImportPath, source.PackagePath) string { return "" })
+- if err != nil {
+- // In general, the only error we should encounter while formatting is
+- // context cancellation.
+- if ctx.Err() == nil {
+- event.Error(ctx, "formatting var type", err)
+- }
+- return
+- }
+- name = abbreviateTypeName(typeName)
+- }
+- paramNames[i] = name
+- if name != "_" {
+- paramNameCount[name]++
+- }
+- }
+-
+- for n, c := range paramNameCount {
+- // Any names we saw more than once will need a unique suffix added
+- // on. Reset the count to 1 to act as the suffix for the first
+- // name.
+- if c >= 2 {
+- paramNameCount[n] = 1
+- } else {
+- delete(paramNameCount, n)
+- }
+- }
+-
+- for i := 0; i < sig.Params().Len(); i++ {
+- if hasTypeParams && !c.opts.placeholders {
+- // If there are type params in the args then the user must
+- // choose the concrete types. If placeholders are disabled just
+- // drop them between the parens and let them fill things in.
+- snip.WritePlaceholder(nil)
+- break
+- }
+-
+- if i > 0 {
+- snip.WriteText(", ")
+- }
+-
+- var (
+- p = sig.Params().At(i)
+- name = paramNames[i]
+- )
+-
+- // Uniquify names by adding on an incrementing numeric suffix.
+- if idx, found := paramNameCount[name]; found {
+- paramNameCount[name]++
+- name = fmt.Sprintf("%s%d", name, idx)
+- }
+-
+- if name != p.Name() && c.opts.placeholders {
+- // If we didn't use the signature's param name verbatim then we
+- // may have chosen a poor name. Give the user a placeholder so
+- // they can easily fix the name.
+- snip.WritePlaceholder(func(b *snippet.Builder) {
+- b.WriteText(name)
+- })
+- } else {
+- snip.WriteText(name)
+- }
+-
+- // If the following param's type is identical to this one, omit
+- // this param's type string. For example, emit "i, j int" instead
+- // of "i int, j int".
+- if i == sig.Params().Len()-1 || !types.Identical(p.Type(), sig.Params().At(i+1).Type()) {
+- snip.WriteText(" ")
+- typeStr, err := source.FormatVarType(ctx, c.snapshot, c.pkg, p, c.qf, c.mq)
+- if err != nil {
+- // In general, the only error we should encounter while formatting is
+- // context cancellation.
+- if ctx.Err() == nil {
+- event.Error(ctx, "formatting var type", err)
+- }
+- return
+- }
+- if sig.Variadic() && i == sig.Params().Len()-1 {
+- typeStr = strings.Replace(typeStr, "[]", "...", 1)
+- }
+-
+- if tp, _ := p.Type().(*typeparams.TypeParam); tp != nil && !c.typeParamInScope(tp) {
+- snip.WritePlaceholder(func(snip *snippet.Builder) {
+- snip.WriteText(typeStr)
+- })
+- } else {
+- snip.WriteText(typeStr)
+- }
+- }
+- }
+- snip.WriteText(")")
+-
+- results := sig.Results()
+- if results.Len() > 0 {
+- snip.WriteText(" ")
+- }
+-
+- resultsNeedParens := results.Len() > 1 ||
+- results.Len() == 1 && results.At(0).Name() != ""
+-
+- var resultHasTypeParams bool
+- for i := 0; i < results.Len(); i++ {
+- if tp, _ := results.At(i).Type().(*typeparams.TypeParam); tp != nil && !c.typeParamInScope(tp) {
+- resultHasTypeParams = true
+- }
+- }
+-
+- if resultsNeedParens {
+- snip.WriteText("(")
+- }
+- for i := 0; i < results.Len(); i++ {
+- if resultHasTypeParams && !c.opts.placeholders {
+- // Leave an empty tabstop if placeholders are disabled and there
+- // are type args that need specificying.
+- snip.WritePlaceholder(nil)
+- break
+- }
+-
+- if i > 0 {
+- snip.WriteText(", ")
+- }
+- r := results.At(i)
+- if name := r.Name(); name != "" {
+- snip.WriteText(name + " ")
+- }
+-
+- text, err := source.FormatVarType(ctx, c.snapshot, c.pkg, r, c.qf, c.mq)
+- if err != nil {
+- // In general, the only error we should encounter while formatting is
+- // context cancellation.
+- if ctx.Err() == nil {
+- event.Error(ctx, "formatting var type", err)
+- }
+- return
+- }
+- if tp, _ := r.Type().(*typeparams.TypeParam); tp != nil && !c.typeParamInScope(tp) {
+- snip.WritePlaceholder(func(snip *snippet.Builder) {
+- snip.WriteText(text)
+- })
+- } else {
+- snip.WriteText(text)
+- }
+- }
+- if resultsNeedParens {
+- snip.WriteText(")")
+- }
+-
+- snip.WriteText(" {")
+- snip.WriteFinalTabstop()
+- snip.WriteText("}")
+-
+- c.items = append(c.items, CompletionItem{
+- Label: "func(...) {}",
+- Score: matchScore * literalCandidateScore,
+- Kind: protocol.VariableCompletion,
+- snippet: snip,
+- })
+-}
+-
+-// conventionalAcronyms contains conventional acronyms for type names
+-// in lower case. For example, "ctx" for "context" and "err" for "error".
+-var conventionalAcronyms = map[string]string{
+- "context": "ctx",
+- "error": "err",
+- "tx": "tx",
+- "responsewriter": "w",
+-}
+-
+-// abbreviateTypeName abbreviates type names into acronyms. For
+-// example, "fooBar" is abbreviated "fb". Care is taken to ignore
+-// non-identifier runes. For example, "[]int" becomes "i", and
+-// "struct { i int }" becomes "s".
+-func abbreviateTypeName(s string) string {
+- var (
+- b strings.Builder
+- useNextUpper bool
+- )
+-
+- // Trim off leading non-letters. We trim everything between "[" and
+- // "]" to handle array types like "[someConst]int".
+- var inBracket bool
+- s = strings.TrimFunc(s, func(r rune) bool {
+- if inBracket {
+- inBracket = r != ']'
+- return true
+- }
+-
+- if r == '[' {
+- inBracket = true
+- }
+-
+- return !unicode.IsLetter(r)
+- })
+-
+- if acr, ok := conventionalAcronyms[strings.ToLower(s)]; ok {
+- return acr
+- }
+-
+- for i, r := range s {
+- // Stop if we encounter a non-identifier rune.
+- if !unicode.IsLetter(r) && !unicode.IsNumber(r) {
+- break
+- }
+-
+- if i == 0 {
+- b.WriteRune(unicode.ToLower(r))
+- }
+-
+- if unicode.IsUpper(r) {
+- if useNextUpper {
+- b.WriteRune(unicode.ToLower(r))
+- useNextUpper = false
+- }
+- } else {
+- useNextUpper = true
+- }
+- }
+-
+- return b.String()
+-}
+-
+-// compositeLiteral adds a composite literal completion item for the given typeName.
+-func (c *completer) compositeLiteral(T types.Type, snip *snippet.Builder, typeName string, matchScore float64, edits []protocol.TextEdit) {
+- snip.WriteText("{")
+- // Don't put the tab stop inside the composite literal curlies "{}"
+- // for structs that have no accessible fields.
+- if strct, ok := T.(*types.Struct); !ok || fieldsAccessible(strct, c.pkg.GetTypes()) {
+- snip.WriteFinalTabstop()
+- }
+- snip.WriteText("}")
+-
+- nonSnippet := typeName + "{}"
+-
+- c.items = append(c.items, CompletionItem{
+- Label: nonSnippet,
+- InsertText: nonSnippet,
+- Score: matchScore * literalCandidateScore,
+- Kind: protocol.VariableCompletion,
+- AdditionalTextEdits: edits,
+- snippet: snip,
+- })
+-}
+-
+-// basicLiteral adds a literal completion item for the given basic
+-// type name typeName.
+-func (c *completer) basicLiteral(T types.Type, snip *snippet.Builder, typeName string, matchScore float64, edits []protocol.TextEdit) {
+- // Never give type conversions like "untyped int()".
+- if isUntyped(T) {
+- return
+- }
+-
+- snip.WriteText("(")
+- snip.WriteFinalTabstop()
+- snip.WriteText(")")
+-
+- nonSnippet := typeName + "()"
+-
+- c.items = append(c.items, CompletionItem{
+- Label: nonSnippet,
+- InsertText: nonSnippet,
+- Detail: T.String(),
+- Score: matchScore * literalCandidateScore,
+- Kind: protocol.VariableCompletion,
+- AdditionalTextEdits: edits,
+- snippet: snip,
+- })
+-}
+-
+-// makeCall adds a completion item for a "make()" call given a specific type.
+-func (c *completer) makeCall(snip *snippet.Builder, typeName string, secondArg string, matchScore float64, edits []protocol.TextEdit) {
+- // Keep it simple and don't add any placeholders for optional "make()" arguments.
+-
+- snip.PrependText("make(")
+- if secondArg != "" {
+- snip.WriteText(", ")
+- snip.WritePlaceholder(func(b *snippet.Builder) {
+- if c.opts.placeholders {
+- b.WriteText(secondArg)
+- }
+- })
+- }
+- snip.WriteText(")")
+-
+- var nonSnippet strings.Builder
+- nonSnippet.WriteString("make(" + typeName)
+- if secondArg != "" {
+- nonSnippet.WriteString(", ")
+- nonSnippet.WriteString(secondArg)
+- }
+- nonSnippet.WriteByte(')')
+-
+- c.items = append(c.items, CompletionItem{
+- Label: nonSnippet.String(),
+- InsertText: nonSnippet.String(),
+- Score: matchScore * literalCandidateScore,
+- Kind: protocol.FunctionCompletion,
+- AdditionalTextEdits: edits,
+- snippet: snip,
+- })
+-}
+-
+-// Create a snippet for a type name where type params become placeholders.
+-func (c *completer) typeNameSnippet(literalType types.Type, qf types.Qualifier) (*snippet.Builder, string) {
+- var (
+- snip snippet.Builder
+- typeName string
+- named, _ = literalType.(*types.Named)
+- )
+-
+- if named != nil && named.Obj() != nil && typeparams.ForNamed(named).Len() > 0 && !c.fullyInstantiated(named) {
+- // We are not "fully instantiated" meaning we have type params that must be specified.
+- if pkg := qf(named.Obj().Pkg()); pkg != "" {
+- typeName = pkg + "."
+- }
+-
+- // We do this to get "someType" instead of "someType[T]".
+- typeName += named.Obj().Name()
+- snip.WriteText(typeName + "[")
+-
+- if c.opts.placeholders {
+- for i := 0; i < typeparams.ForNamed(named).Len(); i++ {
+- if i > 0 {
+- snip.WriteText(", ")
+- }
+- snip.WritePlaceholder(func(snip *snippet.Builder) {
+- snip.WriteText(types.TypeString(typeparams.ForNamed(named).At(i), qf))
+- })
+- }
+- } else {
+- snip.WritePlaceholder(nil)
+- }
+- snip.WriteText("]")
+- typeName += "[...]"
+- } else {
+- // We don't have unspecified type params so use default type formatting.
+- typeName = types.TypeString(literalType, qf)
+- snip.WriteText(typeName)
+- }
+-
+- return &snip, typeName
+-}
+-
+-// fullyInstantiated reports whether all of t's type params have
+-// specified type args.
+-func (c *completer) fullyInstantiated(t *types.Named) bool {
+- tps := typeparams.ForNamed(t)
+- tas := typeparams.NamedTypeArgs(t)
+-
+- if tps.Len() != tas.Len() {
+- return false
+- }
+-
+- for i := 0; i < tas.Len(); i++ {
+- switch ta := tas.At(i).(type) {
+- case *typeparams.TypeParam:
+- // A *TypeParam only counts as specified if it is currently in
+- // scope (i.e. we are in a generic definition).
+- if !c.typeParamInScope(ta) {
+- return false
+- }
+- case *types.Named:
+- if !c.fullyInstantiated(ta) {
+- return false
+- }
+- }
+- }
+- return true
+-}
+-
+-// typeParamInScope returns whether tp's object is in scope at c.pos.
+-// This tells you whether you are in a generic definition and can
+-// assume tp has been specified.
+-func (c *completer) typeParamInScope(tp *typeparams.TypeParam) bool {
+- obj := tp.Obj()
+- if obj == nil {
+- return false
+- }
+-
+- scope := c.innermostScope()
+- if scope == nil {
+- return false
+- }
+-
+- _, foundObj := scope.LookupParent(obj.Name(), c.pos)
+- return obj == foundObj
+-}
+diff -urN a/gopls/internal/lsp/source/completion/package.go b/gopls/internal/lsp/source/completion/package.go
+--- a/gopls/internal/lsp/source/completion/package.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/package.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,351 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "bytes"
+- "context"
+- "errors"
+- "fmt"
+- "go/ast"
+- "go/parser"
+- "go/scanner"
+- "go/token"
+- "go/types"
+- "path/filepath"
+- "strings"
+- "unicode"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/fuzzy"
+-)
+-
+-// packageClauseCompletions offers completions for a package declaration when
+-// one is not present in the given file.
+-func packageClauseCompletions(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle, position protocol.Position) ([]CompletionItem, *Selection, error) {
+- // We know that the AST for this file will be empty due to the missing
+- // package declaration, but parse it anyway to get a mapper.
+- // TODO(adonovan): opt: there's no need to parse just to get a mapper.
+- pgf, err := snapshot.ParseGo(ctx, fh, source.ParseFull)
+- if err != nil {
+- return nil, nil, err
+- }
+-
+- offset, err := pgf.Mapper.PositionOffset(position)
+- if err != nil {
+- return nil, nil, err
+- }
+- surrounding, err := packageCompletionSurrounding(pgf, offset)
+- if err != nil {
+- return nil, nil, fmt.Errorf("invalid position for package completion: %w", err)
+- }
+-
+- packageSuggestions, err := packageSuggestions(ctx, snapshot, fh.URI(), "")
+- if err != nil {
+- return nil, nil, err
+- }
+-
+- var items []CompletionItem
+- for _, pkg := range packageSuggestions {
+- insertText := fmt.Sprintf("package %s", pkg.name)
+- items = append(items, CompletionItem{
+- Label: insertText,
+- Kind: protocol.ModuleCompletion,
+- InsertText: insertText,
+- Score: pkg.score,
+- })
+- }
+-
+- return items, surrounding, nil
+-}
+-
+-// packageCompletionSurrounding returns surrounding for package completion if a
+-// package completions can be suggested at a given cursor offset. A valid location
+-// for package completion is above any declarations or import statements.
+-func packageCompletionSurrounding(pgf *source.ParsedGoFile, offset int) (*Selection, error) {
+- m := pgf.Mapper
+- // If the file lacks a package declaration, the parser will return an empty
+- // AST. As a work-around, try to parse an expression from the file contents.
+- fset := token.NewFileSet()
+- expr, _ := parser.ParseExprFrom(fset, m.URI.Filename(), pgf.Src, parser.Mode(0))
+- if expr == nil {
+- return nil, fmt.Errorf("unparseable file (%s)", m.URI)
+- }
+- tok := fset.File(expr.Pos())
+- cursor := tok.Pos(offset)
+-
+- // If we were able to parse out an identifier as the first expression from
+- // the file, it may be the beginning of a package declaration ("pack ").
+- // We can offer package completions if the cursor is in the identifier.
+- if name, ok := expr.(*ast.Ident); ok {
+- if cursor >= name.Pos() && cursor <= name.End() {
+- if !strings.HasPrefix(PACKAGE, name.Name) {
+- return nil, fmt.Errorf("cursor in non-matching ident")
+- }
+- return &Selection{
+- content: name.Name,
+- cursor: cursor,
+- tokFile: tok,
+- start: name.Pos(),
+- end: name.End(),
+- mapper: m,
+- }, nil
+- }
+- }
+-
+- // The file is invalid, but it contains an expression that we were able to
+- // parse. We will use this expression to construct the cursor's
+- // "surrounding".
+-
+- // First, consider the possibility that we have a valid "package" keyword
+- // with an empty package name ("package "). "package" is parsed as an
+- // *ast.BadDecl since it is a keyword. This logic would allow "package" to
+- // appear on any line of the file as long as it's the first code expression
+- // in the file.
+- lines := strings.Split(string(pgf.Src), "\n")
+- cursorLine := tok.Line(cursor)
+- if cursorLine <= 0 || cursorLine > len(lines) {
+- return nil, fmt.Errorf("invalid line number")
+- }
+- if safetoken.StartPosition(fset, expr.Pos()).Line == cursorLine {
+- words := strings.Fields(lines[cursorLine-1])
+- if len(words) > 0 && words[0] == PACKAGE {
+- content := PACKAGE
+- // Account for spaces if there are any.
+- if len(words) > 1 {
+- content += " "
+- }
+-
+- start := expr.Pos()
+- end := token.Pos(int(expr.Pos()) + len(content) + 1)
+- // We have verified that we have a valid 'package' keyword as our
+- // first expression. Ensure that cursor is in this keyword or
+- // otherwise fallback to the general case.
+- if cursor >= start && cursor <= end {
+- return &Selection{
+- content: content,
+- cursor: cursor,
+- tokFile: tok,
+- start: start,
+- end: end,
+- mapper: m,
+- }, nil
+- }
+- }
+- }
+-
+- // If the cursor is after the start of the expression, no package
+- // declaration will be valid.
+- if cursor > expr.Pos() {
+- return nil, fmt.Errorf("cursor after expression")
+- }
+-
+- // If the cursor is in a comment, don't offer any completions.
+- if cursorInComment(tok, cursor, m.Content) {
+- return nil, fmt.Errorf("cursor in comment")
+- }
+-
+- // The surrounding range in this case is the cursor.
+- return &Selection{
+- content: "",
+- tokFile: tok,
+- start: cursor,
+- end: cursor,
+- cursor: cursor,
+- mapper: m,
+- }, nil
+-}
+-
+-func cursorInComment(file *token.File, cursor token.Pos, src []byte) bool {
+- var s scanner.Scanner
+- s.Init(file, src, func(_ token.Position, _ string) {}, scanner.ScanComments)
+- for {
+- pos, tok, lit := s.Scan()
+- if pos <= cursor && cursor <= token.Pos(int(pos)+len(lit)) {
+- return tok == token.COMMENT
+- }
+- if tok == token.EOF {
+- break
+- }
+- }
+- return false
+-}
+-
+-// packageNameCompletions returns name completions for a package clause using
+-// the current name as prefix.
+-func (c *completer) packageNameCompletions(ctx context.Context, fileURI span.URI, name *ast.Ident) error {
+- cursor := int(c.pos - name.NamePos)
+- if cursor < 0 || cursor > len(name.Name) {
+- return errors.New("cursor is not in package name identifier")
+- }
+-
+- c.completionContext.packageCompletion = true
+-
+- prefix := name.Name[:cursor]
+- packageSuggestions, err := packageSuggestions(ctx, c.snapshot, fileURI, prefix)
+- if err != nil {
+- return err
+- }
+-
+- for _, pkg := range packageSuggestions {
+- c.deepState.enqueue(pkg)
+- }
+- return nil
+-}
+-
+-// packageSuggestions returns a list of packages from workspace packages that
+-// have the given prefix and are used in the same directory as the given
+-// file. This also includes test packages for these packages (<pkg>_test) and
+-// the directory name itself.
+-func packageSuggestions(ctx context.Context, snapshot source.Snapshot, fileURI span.URI, prefix string) (packages []candidate, err error) {
+- active, err := snapshot.ActiveMetadata(ctx)
+- if err != nil {
+- return nil, err
+- }
+-
+- toCandidate := func(name string, score float64) candidate {
+- obj := types.NewPkgName(0, nil, name, types.NewPackage("", name))
+- return candidate{obj: obj, name: name, detail: name, score: score}
+- }
+-
+- matcher := fuzzy.NewMatcher(prefix)
+-
+- // Always try to suggest a main package
+- defer func() {
+- if score := float64(matcher.Score("main")); score > 0 {
+- packages = append(packages, toCandidate("main", score*lowScore))
+- }
+- }()
+-
+- dirPath := filepath.Dir(fileURI.Filename())
+- dirName := filepath.Base(dirPath)
+- if !isValidDirName(dirName) {
+- return packages, nil
+- }
+- pkgName := convertDirNameToPkgName(dirName)
+-
+- seenPkgs := make(map[source.PackageName]struct{})
+-
+- // The `go` command by default only allows one package per directory but we
+- // support multiple package suggestions since gopls is build system agnostic.
+- for _, m := range active {
+- if m.Name == "main" || m.Name == "" {
+- continue
+- }
+- if _, ok := seenPkgs[m.Name]; ok {
+- continue
+- }
+-
+- // Only add packages that are previously used in the current directory.
+- var relevantPkg bool
+- for _, uri := range m.CompiledGoFiles {
+- if filepath.Dir(uri.Filename()) == dirPath {
+- relevantPkg = true
+- break
+- }
+- }
+- if !relevantPkg {
+- continue
+- }
+-
+- // Add a found package used in current directory as a high relevance
+- // suggestion and the test package for it as a medium relevance
+- // suggestion.
+- if score := float64(matcher.Score(string(m.Name))); score > 0 {
+- packages = append(packages, toCandidate(string(m.Name), score*highScore))
+- }
+- seenPkgs[m.Name] = struct{}{}
+-
+- testPkgName := m.Name + "_test"
+- if _, ok := seenPkgs[testPkgName]; ok || strings.HasSuffix(string(m.Name), "_test") {
+- continue
+- }
+- if score := float64(matcher.Score(string(testPkgName))); score > 0 {
+- packages = append(packages, toCandidate(string(testPkgName), score*stdScore))
+- }
+- seenPkgs[testPkgName] = struct{}{}
+- }
+-
+- // Add current directory name as a low relevance suggestion.
+- if _, ok := seenPkgs[pkgName]; !ok {
+- if score := float64(matcher.Score(string(pkgName))); score > 0 {
+- packages = append(packages, toCandidate(string(pkgName), score*lowScore))
+- }
+-
+- testPkgName := pkgName + "_test"
+- if score := float64(matcher.Score(string(testPkgName))); score > 0 {
+- packages = append(packages, toCandidate(string(testPkgName), score*lowScore))
+- }
+- }
+-
+- return packages, nil
+-}
+-
+-// isValidDirName checks whether the passed directory name can be used in
+-// a package path. Requirements for a package path can be found here:
+-// https://golang.org/ref/mod#go-mod-file-ident.
+-func isValidDirName(dirName string) bool {
+- if dirName == "" {
+- return false
+- }
+-
+- for i, ch := range dirName {
+- if isLetter(ch) || isDigit(ch) {
+- continue
+- }
+- if i == 0 {
+- // Directory name can start only with '_'. '.' is not allowed in module paths.
+- // '-' and '~' are not allowed because elements of package paths must be
+- // safe command-line arguments.
+- if ch == '_' {
+- continue
+- }
+- } else {
+- // Modules path elements can't end with '.'
+- if isAllowedPunctuation(ch) && (i != len(dirName)-1 || ch != '.') {
+- continue
+- }
+- }
+-
+- return false
+- }
+- return true
+-}
+-
+-// convertDirNameToPkgName converts a valid directory name to a valid package name.
+-// It leaves only letters and digits. All letters are mapped to lower case.
+-func convertDirNameToPkgName(dirName string) source.PackageName {
+- var buf bytes.Buffer
+- for _, ch := range dirName {
+- switch {
+- case isLetter(ch):
+- buf.WriteRune(unicode.ToLower(ch))
+-
+- case buf.Len() != 0 && isDigit(ch):
+- buf.WriteRune(ch)
+- }
+- }
+- return source.PackageName(buf.String())
+-}
+-
+-// isLetter and isDigit allow only ASCII characters because
+-// "Each path element is a non-empty string made of up ASCII letters,
+-// ASCII digits, and limited ASCII punctuation"
+-// (see https://golang.org/ref/mod#go-mod-file-ident).
+-
+-func isLetter(ch rune) bool {
+- return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z'
+-}
+-
+-func isDigit(ch rune) bool {
+- return '0' <= ch && ch <= '9'
+-}
+-
+-func isAllowedPunctuation(ch rune) bool {
+- return ch == '_' || ch == '-' || ch == '~' || ch == '.'
+-}
+diff -urN a/gopls/internal/lsp/source/completion/package_test.go b/gopls/internal/lsp/source/completion/package_test.go
+--- a/gopls/internal/lsp/source/completion/package_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/package_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,81 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-func TestIsValidDirName(t *testing.T) {
+- tests := []struct {
+- dirName string
+- valid bool
+- }{
+- {dirName: "", valid: false},
+- //
+- {dirName: "a", valid: true},
+- {dirName: "abcdef", valid: true},
+- {dirName: "AbCdEf", valid: true},
+- //
+- {dirName: "1a35", valid: true},
+- {dirName: "a16", valid: true},
+- //
+- {dirName: "_a", valid: true},
+- {dirName: "a_", valid: true},
+- //
+- {dirName: "~a", valid: false},
+- {dirName: "a~", valid: true},
+- //
+- {dirName: "-a", valid: false},
+- {dirName: "a-", valid: true},
+- //
+- {dirName: ".a", valid: false},
+- {dirName: "a.", valid: false},
+- //
+- {dirName: "a~_b--c.-e", valid: true},
+- {dirName: "~a~_b--c.-e", valid: false},
+- {dirName: "a~_b--c.-e--~", valid: true},
+- {dirName: "a~_b--2134dc42.-e6--~", valid: true},
+- {dirName: "abc`def", valid: false},
+- {dirName: "тест", valid: false},
+- {dirName: "你好", valid: false},
+- }
+- for _, tt := range tests {
+- valid := isValidDirName(tt.dirName)
+- if tt.valid != valid {
+- t.Errorf("%s: expected %v, got %v", tt.dirName, tt.valid, valid)
+- }
+- }
+-}
+-
+-func TestConvertDirNameToPkgName(t *testing.T) {
+- tests := []struct {
+- dirName string
+- pkgName source.PackageName
+- }{
+- {dirName: "a", pkgName: "a"},
+- {dirName: "abcdef", pkgName: "abcdef"},
+- {dirName: "AbCdEf", pkgName: "abcdef"},
+- {dirName: "1a35", pkgName: "a35"},
+- {dirName: "14a35", pkgName: "a35"},
+- {dirName: "a16", pkgName: "a16"},
+- {dirName: "_a", pkgName: "a"},
+- {dirName: "a_", pkgName: "a"},
+- {dirName: "a~", pkgName: "a"},
+- {dirName: "a-", pkgName: "a"},
+- {dirName: "a~_b--c.-e", pkgName: "abce"},
+- {dirName: "a~_b--c.-e--~", pkgName: "abce"},
+- {dirName: "a~_b--2134dc42.-e6--~", pkgName: "ab2134dc42e6"},
+- }
+- for _, tt := range tests {
+- pkgName := convertDirNameToPkgName(tt.dirName)
+- if tt.pkgName != pkgName {
+- t.Errorf("%s: expected %v, got %v", tt.dirName, tt.pkgName, pkgName)
+- continue
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/source/completion/postfix_snippets.go b/gopls/internal/lsp/source/completion/postfix_snippets.go
+--- a/gopls/internal/lsp/source/completion/postfix_snippets.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/postfix_snippets.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,471 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "context"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "log"
+- "reflect"
+- "strings"
+- "sync"
+- "text/template"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/snippet"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/imports"
+-)
+-
+-// Postfix snippets are artificial methods that allow the user to
+-// compose common operations in an "argument oriented" fashion. For
+-// example, instead of "sort.Slice(someSlice, ...)" a user can expand
+-// "someSlice.sort!".
+-
+-// postfixTmpl represents a postfix snippet completion candidate.
+-type postfixTmpl struct {
+- // label is the completion candidate's label presented to the user.
+- label string
+-
+- // details is passed along to the client as the candidate's details.
+- details string
+-
+- // body is the template text. See postfixTmplArgs for details on the
+- // facilities available to the template.
+- body string
+-
+- tmpl *template.Template
+-}
+-
+-// postfixTmplArgs are the template execution arguments available to
+-// the postfix snippet templates.
+-type postfixTmplArgs struct {
+- // StmtOK is true if it is valid to replace the selector with a
+- // statement. For example:
+- //
+- // func foo() {
+- // bar.sort! // statement okay
+- //
+- // someMethod(bar.sort!) // statement not okay
+- // }
+- StmtOK bool
+-
+- // X is the textual SelectorExpr.X. For example, when completing
+- // "foo.bar.print!", "X" is "foo.bar".
+- X string
+-
+- // Obj is the types.Object of SelectorExpr.X, if any.
+- Obj types.Object
+-
+- // Type is the type of "foo.bar" in "foo.bar.print!".
+- Type types.Type
+-
+- scope *types.Scope
+- snip snippet.Builder
+- importIfNeeded func(pkgPath string, scope *types.Scope) (name string, edits []protocol.TextEdit, err error)
+- edits []protocol.TextEdit
+- qf types.Qualifier
+- varNames map[string]bool
+-}
+-
+-var postfixTmpls = []postfixTmpl{{
+- label: "sort",
+- details: "sort.Slice()",
+- body: `{{if and (eq .Kind "slice") .StmtOK -}}
+-{{.Import "sort"}}.Slice({{.X}}, func({{.VarName nil "i"}}, {{.VarName nil "j"}} int) bool {
+- {{.Cursor}}
+-})
+-{{- end}}`,
+-}, {
+- label: "last",
+- details: "s[len(s)-1]",
+- body: `{{if and (eq .Kind "slice") .Obj -}}
+-{{.X}}[len({{.X}})-1]
+-{{- end}}`,
+-}, {
+- label: "reverse",
+- details: "reverse slice",
+- body: `{{if and (eq .Kind "slice") .StmtOK -}}
+-{{$i := .VarName nil "i"}}{{$j := .VarName nil "j" -}}
+-for {{$i}}, {{$j}} := 0, len({{.X}})-1; {{$i}} < {{$j}}; {{$i}}, {{$j}} = {{$i}}+1, {{$j}}-1 {
+- {{.X}}[{{$i}}], {{.X}}[{{$j}}] = {{.X}}[{{$j}}], {{.X}}[{{$i}}]
+-}
+-{{end}}`,
+-}, {
+- label: "range",
+- details: "range over slice",
+- body: `{{if and (eq .Kind "slice") .StmtOK -}}
+-for {{.VarName nil "i"}}, {{.VarName .ElemType "v"}} := range {{.X}} {
+- {{.Cursor}}
+-}
+-{{- end}}`,
+-}, {
+- label: "append",
+- details: "append and re-assign slice",
+- body: `{{if and (eq .Kind "slice") .StmtOK .Obj -}}
+-{{.X}} = append({{.X}}, {{.Cursor}})
+-{{- end}}`,
+-}, {
+- label: "append",
+- details: "append to slice",
+- body: `{{if and (eq .Kind "slice") (not .StmtOK) -}}
+-append({{.X}}, {{.Cursor}})
+-{{- end}}`,
+-}, {
+- label: "copy",
+- details: "duplicate slice",
+- body: `{{if and (eq .Kind "slice") .StmtOK .Obj -}}
+-{{$v := (.VarName nil (printf "%sCopy" .X))}}{{$v}} := make([]{{.TypeName .ElemType}}, len({{.X}}))
+-copy({{$v}}, {{.X}})
+-{{end}}`,
+-}, {
+- label: "range",
+- details: "range over map",
+- body: `{{if and (eq .Kind "map") .StmtOK -}}
+-for {{.VarName .KeyType "k"}}, {{.VarName .ElemType "v"}} := range {{.X}} {
+- {{.Cursor}}
+-}
+-{{- end}}`,
+-}, {
+- label: "clear",
+- details: "clear map contents",
+- body: `{{if and (eq .Kind "map") .StmtOK -}}
+-{{$k := (.VarName .KeyType "k")}}for {{$k}} := range {{.X}} {
+- delete({{.X}}, {{$k}})
+-}
+-{{end}}`,
+-}, {
+- label: "keys",
+- details: "create slice of keys",
+- body: `{{if and (eq .Kind "map") .StmtOK -}}
+-{{$keysVar := (.VarName nil "keys")}}{{$keysVar}} := make([]{{.TypeName .KeyType}}, 0, len({{.X}}))
+-{{$k := (.VarName .KeyType "k")}}for {{$k}} := range {{.X}} {
+- {{$keysVar}} = append({{$keysVar}}, {{$k}})
+-}
+-{{end}}`,
+-}, {
+- label: "range",
+- details: "range over channel",
+- body: `{{if and (eq .Kind "chan") .StmtOK -}}
+-for {{.VarName .ElemType "e"}} := range {{.X}} {
+- {{.Cursor}}
+-}
+-{{- end}}`,
+-}, {
+- label: "var",
+- details: "assign to variables",
+- body: `{{if and (eq .Kind "tuple") .StmtOK -}}
+-{{$a := .}}{{range $i, $v := .Tuple}}{{if $i}}, {{end}}{{$a.VarName $v.Type $v.Name}}{{end}} := {{.X}}
+-{{- end}}`,
+-}, {
+- label: "var",
+- details: "assign to variable",
+- body: `{{if and (ne .Kind "tuple") .StmtOK -}}
+-{{.VarName .Type ""}} := {{.X}}
+-{{- end}}`,
+-}, {
+- label: "print",
+- details: "print to stdout",
+- body: `{{if and (ne .Kind "tuple") .StmtOK -}}
+-{{.Import "fmt"}}.Printf("{{.EscapeQuotes .X}}: %v\n", {{.X}})
+-{{- end}}`,
+-}, {
+- label: "print",
+- details: "print to stdout",
+- body: `{{if and (eq .Kind "tuple") .StmtOK -}}
+-{{.Import "fmt"}}.Println({{.X}})
+-{{- end}}`,
+-}, {
+- label: "split",
+- details: "split string",
+- body: `{{if (eq (.TypeName .Type) "string") -}}
+-{{.Import "strings"}}.Split({{.X}}, "{{.Cursor}}")
+-{{- end}}`,
+-}, {
+- label: "join",
+- details: "join string slice",
+- body: `{{if and (eq .Kind "slice") (eq (.TypeName .ElemType) "string") -}}
+-{{.Import "strings"}}.Join({{.X}}, "{{.Cursor}}")
+-{{- end}}`,
+-}}
+-
+-// Cursor indicates where the client's cursor should end up after the
+-// snippet is done.
+-func (a *postfixTmplArgs) Cursor() string {
+- a.snip.WriteFinalTabstop()
+- return ""
+-}
+-
+-// Import makes sure the package corresponding to path is imported,
+-// returning the identifier to use to refer to the package.
+-func (a *postfixTmplArgs) Import(path string) (string, error) {
+- name, edits, err := a.importIfNeeded(path, a.scope)
+- if err != nil {
+- return "", fmt.Errorf("couldn't import %q: %w", path, err)
+- }
+- a.edits = append(a.edits, edits...)
+- return name, nil
+-}
+-
+-func (a *postfixTmplArgs) EscapeQuotes(v string) string {
+- return strings.ReplaceAll(v, `"`, `\\"`)
+-}
+-
+-// ElemType returns the Elem() type of xType, if applicable.
+-func (a *postfixTmplArgs) ElemType() types.Type {
+- if e, _ := a.Type.(interface{ Elem() types.Type }); e != nil {
+- return e.Elem()
+- }
+- return nil
+-}
+-
+-// Kind returns the underlying kind of type, e.g. "slice", "struct",
+-// etc.
+-func (a *postfixTmplArgs) Kind() string {
+- t := reflect.TypeOf(a.Type.Underlying())
+- return strings.ToLower(strings.TrimPrefix(t.String(), "*types."))
+-}
+-
+-// KeyType returns the type of X's key. KeyType panics if X is not a
+-// map.
+-func (a *postfixTmplArgs) KeyType() types.Type {
+- return a.Type.Underlying().(*types.Map).Key()
+-}
+-
+-// Tuple returns the tuple result vars if X is a call expression.
+-func (a *postfixTmplArgs) Tuple() []*types.Var {
+- tuple, _ := a.Type.(*types.Tuple)
+- if tuple == nil {
+- return nil
+- }
+-
+- typs := make([]*types.Var, 0, tuple.Len())
+- for i := 0; i < tuple.Len(); i++ {
+- typs = append(typs, tuple.At(i))
+- }
+- return typs
+-}
+-
+-// TypeName returns the textual representation of type t.
+-func (a *postfixTmplArgs) TypeName(t types.Type) (string, error) {
+- if t == nil || t == types.Typ[types.Invalid] {
+- return "", fmt.Errorf("invalid type: %v", t)
+- }
+- return types.TypeString(t, a.qf), nil
+-}
+-
+-// VarName returns a suitable variable name for the type t. If t
+-// implements the error interface, "err" is used. If t is not a named
+-// type then nonNamedDefault is used. Otherwise a name is made by
+-// abbreviating the type name. If the resultant name is already in
+-// scope, an integer is appended to make a unique name.
+-func (a *postfixTmplArgs) VarName(t types.Type, nonNamedDefault string) string {
+- if t == nil {
+- t = types.Typ[types.Invalid]
+- }
+-
+- var name string
+- // go/types predicates are undefined on types.Typ[types.Invalid].
+- if !types.Identical(t, types.Typ[types.Invalid]) && types.Implements(t, errorIntf) {
+- name = "err"
+- } else if _, isNamed := source.Deref(t).(*types.Named); !isNamed {
+- name = nonNamedDefault
+- }
+-
+- if name == "" {
+- name = types.TypeString(t, func(p *types.Package) string {
+- return ""
+- })
+- name = abbreviateTypeName(name)
+- }
+-
+- if dot := strings.LastIndex(name, "."); dot > -1 {
+- name = name[dot+1:]
+- }
+-
+- uniqueName := name
+- for i := 2; ; i++ {
+- if s, _ := a.scope.LookupParent(uniqueName, token.NoPos); s == nil && !a.varNames[uniqueName] {
+- break
+- }
+- uniqueName = fmt.Sprintf("%s%d", name, i)
+- }
+-
+- a.varNames[uniqueName] = true
+-
+- return uniqueName
+-}
+-
+-func (c *completer) addPostfixSnippetCandidates(ctx context.Context, sel *ast.SelectorExpr) {
+- if !c.opts.postfix {
+- return
+- }
+-
+- initPostfixRules()
+-
+- if sel == nil || sel.Sel == nil {
+- return
+- }
+-
+- selType := c.pkg.GetTypesInfo().TypeOf(sel.X)
+- if selType == nil {
+- return
+- }
+-
+- // Skip empty tuples since there is no value to operate on.
+- if tuple, ok := selType.Underlying().(*types.Tuple); ok && tuple == nil {
+- return
+- }
+-
+- tokFile := c.pkg.FileSet().File(c.pos)
+-
+- // Only replace sel with a statement if sel is already a statement.
+- var stmtOK bool
+- for i, n := range c.path {
+- if n == sel && i < len(c.path)-1 {
+- switch p := c.path[i+1].(type) {
+- case *ast.ExprStmt:
+- stmtOK = true
+- case *ast.AssignStmt:
+- // In cases like:
+- //
+- // foo.<>
+- // bar = 123
+- //
+- // detect that "foo." makes up the entire statement since the
+- // apparent selector spans lines.
+- stmtOK = tokFile.Line(c.pos) < tokFile.Line(p.TokPos)
+- }
+- break
+- }
+- }
+-
+- scope := c.pkg.GetTypes().Scope().Innermost(c.pos)
+- if scope == nil {
+- return
+- }
+-
+- // afterDot is the position after selector dot, e.g. "|" in
+- // "foo.|print".
+- afterDot := sel.Sel.Pos()
+-
+- // We must detect dangling selectors such as:
+- //
+- // foo.<>
+- // bar
+- //
+- // and adjust afterDot so that we don't mistakenly delete the
+- // newline thinking "bar" is part of our selector.
+- if startLine := tokFile.Line(sel.Pos()); startLine != tokFile.Line(afterDot) {
+- if tokFile.Line(c.pos) != startLine {
+- return
+- }
+- afterDot = c.pos
+- }
+-
+- for _, rule := range postfixTmpls {
+- // When completing foo.print<>, "print" is naturally overwritten,
+- // but we need to also remove "foo." so the snippet has a clean
+- // slate.
+- edits, err := c.editText(sel.Pos(), afterDot, "")
+- if err != nil {
+- event.Error(ctx, "error calculating postfix edits", err)
+- return
+- }
+-
+- tmplArgs := postfixTmplArgs{
+- X: source.FormatNode(c.pkg.FileSet(), sel.X),
+- StmtOK: stmtOK,
+- Obj: exprObj(c.pkg.GetTypesInfo(), sel.X),
+- Type: selType,
+- qf: c.qf,
+- importIfNeeded: c.importIfNeeded,
+- scope: scope,
+- varNames: make(map[string]bool),
+- }
+-
+- // Feed the template straight into the snippet builder. This
+- // allows templates to build snippets as they are executed.
+- err = rule.tmpl.Execute(&tmplArgs.snip, &tmplArgs)
+- if err != nil {
+- event.Error(ctx, "error executing postfix template", err)
+- continue
+- }
+-
+- if strings.TrimSpace(tmplArgs.snip.String()) == "" {
+- continue
+- }
+-
+- score := c.matcher.Score(rule.label)
+- if score <= 0 {
+- continue
+- }
+-
+- c.items = append(c.items, CompletionItem{
+- Label: rule.label + "!",
+- Detail: rule.details,
+- Score: float64(score) * 0.01,
+- Kind: protocol.SnippetCompletion,
+- snippet: &tmplArgs.snip,
+- AdditionalTextEdits: append(edits, tmplArgs.edits...),
+- })
+- }
+-}
+-
+-var postfixRulesOnce sync.Once
+-
+-func initPostfixRules() {
+- postfixRulesOnce.Do(func() {
+- var idx int
+- for _, rule := range postfixTmpls {
+- var err error
+- rule.tmpl, err = template.New("postfix_snippet").Parse(rule.body)
+- if err != nil {
+- log.Panicf("error parsing postfix snippet template: %v", err)
+- }
+- postfixTmpls[idx] = rule
+- idx++
+- }
+- postfixTmpls = postfixTmpls[:idx]
+- })
+-}
+-
+-// importIfNeeded returns the package identifier and any necessary
+-// edits to import package pkgPath.
+-func (c *completer) importIfNeeded(pkgPath string, scope *types.Scope) (string, []protocol.TextEdit, error) {
+- defaultName := imports.ImportPathToAssumedName(pkgPath)
+-
+- // Check if file already imports pkgPath.
+- for _, s := range c.file.Imports {
+- // TODO(adonovan): what if pkgPath has a vendor/ suffix?
+- // This may be the cause of go.dev/issue/56291.
+- if source.UnquoteImportPath(s) == source.ImportPath(pkgPath) {
+- if s.Name == nil {
+- return defaultName, nil, nil
+- }
+- if s.Name.Name != "_" {
+- return s.Name.Name, nil, nil
+- }
+- }
+- }
+-
+- // Give up if the package's name is already in use by another object.
+- if _, obj := scope.LookupParent(defaultName, token.NoPos); obj != nil {
+- return "", nil, fmt.Errorf("import name %q of %q already in use", defaultName, pkgPath)
+- }
+-
+- edits, err := c.importEdits(&importInfo{
+- importPath: pkgPath,
+- })
+- if err != nil {
+- return "", nil, err
+- }
+-
+- return defaultName, edits, nil
+-}
+diff -urN a/gopls/internal/lsp/source/completion/printf.go b/gopls/internal/lsp/source/completion/printf.go
+--- a/gopls/internal/lsp/source/completion/printf.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/printf.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,172 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "go/ast"
+- "go/constant"
+- "go/types"
+- "strconv"
+- "strings"
+- "unicode/utf8"
+-)
+-
+-// printfArgKind returns the expected objKind when completing a
+-// printf-like operand. call is the printf-like function call, and
+-// argIdx is the index of call.Args being completed.
+-func printfArgKind(info *types.Info, call *ast.CallExpr, argIdx int) objKind {
+- // Printf-like function name must end in "f".
+- fn := exprObj(info, call.Fun)
+- if fn == nil || !strings.HasSuffix(fn.Name(), "f") {
+- return kindAny
+- }
+-
+- sig, _ := fn.Type().(*types.Signature)
+- if sig == nil {
+- return kindAny
+- }
+-
+- // Must be variadic and take at least two params.
+- numParams := sig.Params().Len()
+- if !sig.Variadic() || numParams < 2 || argIdx < numParams-1 {
+- return kindAny
+- }
+-
+- // Param preceding variadic args must be a (format) string.
+- if !types.Identical(sig.Params().At(numParams-2).Type(), types.Typ[types.String]) {
+- return kindAny
+- }
+-
+- // Format string must be a constant.
+- strArg := info.Types[call.Args[numParams-2]].Value
+- if strArg == nil || strArg.Kind() != constant.String {
+- return kindAny
+- }
+-
+- return formatOperandKind(constant.StringVal(strArg), argIdx-(numParams-1)+1)
+-}
+-
+-// formatOperandKind returns the objKind corresponding to format's
+-// operandIdx'th operand.
+-func formatOperandKind(format string, operandIdx int) objKind {
+- var (
+- prevOperandIdx int
+- kind = kindAny
+- )
+- for {
+- i := strings.Index(format, "%")
+- if i == -1 {
+- break
+- }
+-
+- var operands []formatOperand
+- format, operands = parsePrintfVerb(format[i+1:], prevOperandIdx)
+-
+- // Check if any this verb's operands correspond to our target
+- // operandIdx.
+- for _, v := range operands {
+- if v.idx == operandIdx {
+- if kind == kindAny {
+- kind = v.kind
+- } else if v.kind != kindAny {
+- // If multiple verbs refer to the same operand, take the
+- // intersection of their kinds.
+- kind &= v.kind
+- }
+- }
+-
+- prevOperandIdx = v.idx
+- }
+- }
+- return kind
+-}
+-
+-type formatOperand struct {
+- // idx is the one-based printf operand index.
+- idx int
+- // kind is a mask of expected kinds of objects for this operand.
+- kind objKind
+-}
+-
+-// parsePrintfVerb parses the leading printf verb in f. The opening
+-// "%" must already be trimmed from f. prevIdx is the previous
+-// operand's index, or zero if this is the first verb. The format
+-// string is returned with the leading verb removed. Multiple operands
+-// can be returned in the case of dynamic widths such as "%*.*f".
+-func parsePrintfVerb(f string, prevIdx int) (string, []formatOperand) {
+- var verbs []formatOperand
+-
+- addVerb := func(k objKind) {
+- verbs = append(verbs, formatOperand{
+- idx: prevIdx + 1,
+- kind: k,
+- })
+- prevIdx++
+- }
+-
+- for len(f) > 0 {
+- // Trim first rune off of f so we are guaranteed to make progress.
+- r, l := utf8.DecodeRuneInString(f)
+- f = f[l:]
+-
+- // We care about three things:
+- // 1. The verb, which maps directly to object kind.
+- // 2. Explicit operand indices like "%[2]s".
+- // 3. Dynamic widths using "*".
+- switch r {
+- case '%':
+- return f, nil
+- case '*':
+- addVerb(kindInt)
+- continue
+- case '[':
+- // Parse operand index as in "%[2]s".
+- i := strings.Index(f, "]")
+- if i == -1 {
+- return f, nil
+- }
+-
+- idx, err := strconv.Atoi(f[:i])
+- f = f[i+1:]
+- if err != nil {
+- return f, nil
+- }
+-
+- prevIdx = idx - 1
+- continue
+- case 'v', 'T':
+- addVerb(kindAny)
+- case 't':
+- addVerb(kindBool)
+- case 'c', 'd', 'o', 'O', 'U':
+- addVerb(kindInt)
+- case 'e', 'E', 'f', 'F', 'g', 'G':
+- addVerb(kindFloat | kindComplex)
+- case 'b':
+- addVerb(kindInt | kindFloat | kindComplex | kindBytes)
+- case 'q', 's':
+- addVerb(kindString | kindBytes | kindStringer | kindError)
+- case 'x', 'X':
+- // Omit kindStringer and kindError though technically allowed.
+- addVerb(kindString | kindBytes | kindInt | kindFloat | kindComplex)
+- case 'p':
+- addVerb(kindPtr | kindSlice)
+- case 'w':
+- addVerb(kindError)
+- case '+', '-', '#', ' ', '.', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9':
+- // Flag or numeric width/precision value.
+- continue
+- default:
+- // Assume unrecognized rune is a custom fmt.Formatter verb.
+- addVerb(kindAny)
+- }
+-
+- if len(verbs) > 0 {
+- break
+- }
+- }
+-
+- return f, verbs
+-}
+diff -urN a/gopls/internal/lsp/source/completion/printf_test.go b/gopls/internal/lsp/source/completion/printf_test.go
+--- a/gopls/internal/lsp/source/completion/printf_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/printf_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,72 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "fmt"
+- "testing"
+-)
+-
+-func TestFormatOperandKind(t *testing.T) {
+- cases := []struct {
+- f string
+- idx int
+- kind objKind
+- }{
+- {"", 1, kindAny},
+- {"%", 1, kindAny},
+- {"%%%", 1, kindAny},
+- {"%[1", 1, kindAny},
+- {"%[?%s", 2, kindAny},
+- {"%[abc]v", 1, kindAny},
+-
+- {"%v", 1, kindAny},
+- {"%T", 1, kindAny},
+- {"%t", 1, kindBool},
+- {"%d", 1, kindInt},
+- {"%c", 1, kindInt},
+- {"%o", 1, kindInt},
+- {"%O", 1, kindInt},
+- {"%U", 1, kindInt},
+- {"%e", 1, kindFloat | kindComplex},
+- {"%E", 1, kindFloat | kindComplex},
+- {"%f", 1, kindFloat | kindComplex},
+- {"%F", 1, kindFloat | kindComplex},
+- {"%g", 1, kindFloat | kindComplex},
+- {"%G", 1, kindFloat | kindComplex},
+- {"%b", 1, kindInt | kindFloat | kindComplex | kindBytes},
+- {"%q", 1, kindString | kindBytes | kindStringer | kindError},
+- {"%s", 1, kindString | kindBytes | kindStringer | kindError},
+- {"%x", 1, kindString | kindBytes | kindInt | kindFloat | kindComplex},
+- {"%X", 1, kindString | kindBytes | kindInt | kindFloat | kindComplex},
+- {"%p", 1, kindPtr | kindSlice},
+- {"%w", 1, kindError},
+-
+- {"%1.2f", 1, kindFloat | kindComplex},
+- {"%*f", 1, kindInt},
+- {"%*f", 2, kindFloat | kindComplex},
+- {"%*.*f", 1, kindInt},
+- {"%*.*f", 2, kindInt},
+- {"%*.*f", 3, kindFloat | kindComplex},
+- {"%[3]*.[2]*[1]f", 1, kindFloat | kindComplex},
+- {"%[3]*.[2]*[1]f", 2, kindInt},
+- {"%[3]*.[2]*[1]f", 3, kindInt},
+-
+- {"foo %% %d", 1, kindInt},
+- {"%#-12.34f", 1, kindFloat | kindComplex},
+- {"% d", 1, kindInt},
+-
+- {"%s %[1]X %d", 1, kindString | kindBytes},
+- {"%s %[1]X %d", 2, kindInt},
+- }
+-
+- for _, c := range cases {
+- t.Run(fmt.Sprintf("%q#%d", c.f, c.idx), func(t *testing.T) {
+- if got := formatOperandKind(c.f, c.idx); got != c.kind {
+- t.Errorf("expected %d (%[1]b), got %d (%[2]b)", c.kind, got)
+- }
+- })
+- }
+-}
+diff -urN a/gopls/internal/lsp/source/completion/snippet.go b/gopls/internal/lsp/source/completion/snippet.go
+--- a/gopls/internal/lsp/source/completion/snippet.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/snippet.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,116 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "go/ast"
+-
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/lsp/snippet"
+-)
+-
+-// structFieldSnippet calculates the snippet for struct literal field names.
+-func (c *completer) structFieldSnippet(cand candidate, detail string, snip *snippet.Builder) {
+- if !c.wantStructFieldCompletions() {
+- return
+- }
+-
+- // If we are in a deep completion then we can't be completing a field
+- // name (e.g. "Foo{f<>}" completing to "Foo{f.Bar}" should not generate
+- // a snippet).
+- if len(cand.path) > 0 {
+- return
+- }
+-
+- clInfo := c.enclosingCompositeLiteral
+-
+- // If we are already in a key-value expression, we don't want a snippet.
+- if clInfo.kv != nil {
+- return
+- }
+-
+- // A plain snippet turns "Foo{Ba<>" into "Foo{Bar: <>".
+- snip.WriteText(": ")
+- snip.WritePlaceholder(func(b *snippet.Builder) {
+- // A placeholder snippet turns "Foo{Ba<>" into "Foo{Bar: <*int*>".
+- if c.opts.placeholders {
+- b.WriteText(detail)
+- }
+- })
+-
+- fset := c.pkg.FileSet()
+-
+- // If the cursor position is on a different line from the literal's opening brace,
+- // we are in a multiline literal. Ignore line directives.
+- if safetoken.StartPosition(fset, c.pos).Line != safetoken.StartPosition(fset, clInfo.cl.Lbrace).Line {
+- snip.WriteText(",")
+- }
+-}
+-
+-// functionCallSnippet calculates the snippet for function calls.
+-func (c *completer) functionCallSnippet(name string, tparams, params []string, snip *snippet.Builder) {
+- // If there is no suffix then we need to reuse existing call parens
+- // "()" if present. If there is an identifier suffix then we always
+- // need to include "()" since we don't overwrite the suffix.
+- if c.surrounding != nil && c.surrounding.Suffix() == "" && len(c.path) > 1 {
+- // If we are the left side (i.e. "Fun") part of a call expression,
+- // we don't want a snippet since there are already parens present.
+- switch n := c.path[1].(type) {
+- case *ast.CallExpr:
+- // The Lparen != Rparen check detects fudged CallExprs we
+- // inserted when fixing the AST. In this case, we do still need
+- // to insert the calling "()" parens.
+- if n.Fun == c.path[0] && n.Lparen != n.Rparen {
+- return
+- }
+- case *ast.SelectorExpr:
+- if len(c.path) > 2 {
+- if call, ok := c.path[2].(*ast.CallExpr); ok && call.Fun == c.path[1] && call.Lparen != call.Rparen {
+- return
+- }
+- }
+- }
+- }
+-
+- snip.WriteText(name)
+-
+- if len(tparams) > 0 {
+- snip.WriteText("[")
+- if c.opts.placeholders {
+- for i, tp := range tparams {
+- if i > 0 {
+- snip.WriteText(", ")
+- }
+- snip.WritePlaceholder(func(b *snippet.Builder) {
+- b.WriteText(tp)
+- })
+- }
+- } else {
+- snip.WritePlaceholder(nil)
+- }
+- snip.WriteText("]")
+- }
+-
+- snip.WriteText("(")
+-
+- if c.opts.placeholders {
+- // A placeholder snippet turns "someFun<>" into "someFunc(<*i int*>, *s string*)".
+- for i, p := range params {
+- if i > 0 {
+- snip.WriteText(", ")
+- }
+- snip.WritePlaceholder(func(b *snippet.Builder) {
+- b.WriteText(p)
+- })
+- }
+- } else {
+- // A plain snippet turns "someFun<>" into "someFunc(<>)".
+- if len(params) > 0 {
+- snip.WritePlaceholder(nil)
+- }
+- }
+-
+- snip.WriteText(")")
+-}
+diff -urN a/gopls/internal/lsp/source/completion/statements.go b/gopls/internal/lsp/source/completion/statements.go
+--- a/gopls/internal/lsp/source/completion/statements.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/statements.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,361 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/snippet"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-// addStatementCandidates adds full statement completion candidates
+-// appropriate for the current context.
+-func (c *completer) addStatementCandidates() {
+- c.addErrCheck()
+- c.addAssignAppend()
+-}
+-
+-// addAssignAppend offers a completion candidate of the form:
+-//
+-// someSlice = append(someSlice, )
+-//
+-// It will offer the "append" completion in either of two situations:
+-//
+-// 1. Position is in RHS of assign, prefix matches "append", and
+-// corresponding LHS object is a slice. For example,
+-// "foo = ap<>" completes to "foo = append(foo, )".
+-//
+-// 2. Prefix is an ident or selector in an *ast.ExprStmt (i.e.
+-// beginning of statement), and our best matching candidate is a
+-// slice. For example: "foo.ba" completes to "foo.bar = append(foo.bar, )".
+-func (c *completer) addAssignAppend() {
+- if len(c.path) < 3 {
+- return
+- }
+-
+- ident, _ := c.path[0].(*ast.Ident)
+- if ident == nil {
+- return
+- }
+-
+- var (
+- // sliceText is the full name of our slice object, e.g. "s.abc" in
+- // "s.abc = app<>".
+- sliceText string
+- // needsLHS is true if we need to prepend the LHS slice name and
+- // "=" to our candidate.
+- needsLHS = false
+- fset = c.pkg.FileSet()
+- )
+-
+- switch n := c.path[1].(type) {
+- case *ast.AssignStmt:
+- // We are already in an assignment. Make sure our prefix matches "append".
+- if c.matcher.Score("append") <= 0 {
+- return
+- }
+-
+- exprIdx := exprAtPos(c.pos, n.Rhs)
+- if exprIdx == len(n.Rhs) || exprIdx > len(n.Lhs)-1 {
+- return
+- }
+-
+- lhsType := c.pkg.GetTypesInfo().TypeOf(n.Lhs[exprIdx])
+- if lhsType == nil {
+- return
+- }
+-
+- // Make sure our corresponding LHS object is a slice.
+- if _, isSlice := lhsType.Underlying().(*types.Slice); !isSlice {
+- return
+- }
+-
+- // The name or our slice is whatever's in the LHS expression.
+- sliceText = source.FormatNode(fset, n.Lhs[exprIdx])
+- case *ast.SelectorExpr:
+- // Make sure we are a selector at the beginning of a statement.
+- if _, parentIsExprtStmt := c.path[2].(*ast.ExprStmt); !parentIsExprtStmt {
+- return
+- }
+-
+- // So far we only know the first part of our slice name. For
+- // example in "s.a<>" we only know our slice begins with "s."
+- // since the user could still be typing.
+- sliceText = source.FormatNode(fset, n.X) + "."
+- needsLHS = true
+- case *ast.ExprStmt:
+- needsLHS = true
+- default:
+- return
+- }
+-
+- var (
+- label string
+- snip snippet.Builder
+- score = highScore
+- )
+-
+- if needsLHS {
+- // Offer the long form assign + append candidate if our best
+- // candidate is a slice.
+- bestItem := c.topCandidate()
+- if bestItem == nil || !bestItem.isSlice {
+- return
+- }
+-
+- // Don't rank the full form assign + append candidate above the
+- // slice itself.
+- score = bestItem.Score - 0.01
+-
+- // Fill in rest of sliceText now that we have the object name.
+- sliceText += bestItem.Label
+-
+- // Fill in the candidate's LHS bits.
+- label = fmt.Sprintf("%s = ", bestItem.Label)
+- snip.WriteText(label)
+- }
+-
+- snip.WriteText(fmt.Sprintf("append(%s, ", sliceText))
+- snip.WritePlaceholder(nil)
+- snip.WriteText(")")
+-
+- c.items = append(c.items, CompletionItem{
+- Label: label + fmt.Sprintf("append(%s, )", sliceText),
+- Kind: protocol.FunctionCompletion,
+- Score: score,
+- snippet: &snip,
+- })
+-}
+-
+-// topCandidate returns the strictly highest scoring candidate
+-// collected so far. If the top two candidates have the same score,
+-// nil is returned.
+-func (c *completer) topCandidate() *CompletionItem {
+- var bestItem, secondBestItem *CompletionItem
+- for i := range c.items {
+- if bestItem == nil || c.items[i].Score > bestItem.Score {
+- bestItem = &c.items[i]
+- } else if secondBestItem == nil || c.items[i].Score > secondBestItem.Score {
+- secondBestItem = &c.items[i]
+- }
+- }
+-
+- // If secondBestItem has the same score, bestItem isn't
+- // the strict best.
+- if secondBestItem != nil && secondBestItem.Score == bestItem.Score {
+- return nil
+- }
+-
+- return bestItem
+-}
+-
+-// addErrCheck offers a completion candidate of the form:
+-//
+-// if err != nil {
+-// return nil, err
+-// }
+-//
+-// In the case of test functions, it offers a completion candidate of the form:
+-//
+-// if err != nil {
+-// t.Fatal(err)
+-// }
+-//
+-// The position must be in a function that returns an error, and the
+-// statement preceding the position must be an assignment where the
+-// final LHS object is an error. addErrCheck will synthesize
+-// zero values as necessary to make the return statement valid.
+-func (c *completer) addErrCheck() {
+- if len(c.path) < 2 || c.enclosingFunc == nil || !c.opts.placeholders {
+- return
+- }
+-
+- var (
+- errorType = types.Universe.Lookup("error").Type()
+- result = c.enclosingFunc.sig.Results()
+- testVar = getTestVar(c.enclosingFunc, c.pkg)
+- isTest = testVar != ""
+- doesNotReturnErr = result.Len() == 0 || !types.Identical(result.At(result.Len()-1).Type(), errorType)
+- )
+- // Make sure our enclosing function is a Test func or returns an error.
+- if !isTest && doesNotReturnErr {
+- return
+- }
+-
+- prevLine := prevStmt(c.pos, c.path)
+- if prevLine == nil {
+- return
+- }
+-
+- // Make sure our preceding statement was as assignment.
+- assign, _ := prevLine.(*ast.AssignStmt)
+- if assign == nil || len(assign.Lhs) == 0 {
+- return
+- }
+-
+- lastAssignee := assign.Lhs[len(assign.Lhs)-1]
+-
+- // Make sure the final assignee is an error.
+- if !types.Identical(c.pkg.GetTypesInfo().TypeOf(lastAssignee), errorType) {
+- return
+- }
+-
+- var (
+- // errVar is e.g. "err" in "foo, err := bar()".
+- errVar = source.FormatNode(c.pkg.FileSet(), lastAssignee)
+-
+- // Whether we need to include the "if" keyword in our candidate.
+- needsIf = true
+- )
+-
+- // If the returned error from the previous statement is "_", it is not a real object.
+- // If we don't have an error, and the function signature takes a testing.TB that is either ignored
+- // or an "_", then we also can't call t.Fatal(err).
+- if errVar == "_" {
+- return
+- }
+-
+- // Below we try to detect if the user has already started typing "if
+- // err" so we can replace what they've typed with our complete
+- // statement.
+- switch n := c.path[0].(type) {
+- case *ast.Ident:
+- switch c.path[1].(type) {
+- case *ast.ExprStmt:
+- // This handles:
+- //
+- // f, err := os.Open("foo")
+- // i<>
+-
+- // Make sure they are typing "if".
+- if c.matcher.Score("if") <= 0 {
+- return
+- }
+- case *ast.IfStmt:
+- // This handles:
+- //
+- // f, err := os.Open("foo")
+- // if er<>
+-
+- // Make sure they are typing the error's name.
+- if c.matcher.Score(errVar) <= 0 {
+- return
+- }
+-
+- needsIf = false
+- default:
+- return
+- }
+- case *ast.IfStmt:
+- // This handles:
+- //
+- // f, err := os.Open("foo")
+- // if <>
+-
+- // Avoid false positives by ensuring the if's cond is a bad
+- // expression. For example, don't offer the completion in cases
+- // like "if <> somethingElse".
+- if _, bad := n.Cond.(*ast.BadExpr); !bad {
+- return
+- }
+-
+- // If "if" is our direct prefix, we need to include it in our
+- // candidate since the existing "if" will be overwritten.
+- needsIf = c.pos == n.Pos()+token.Pos(len("if"))
+- }
+-
+- // Build up a snippet that looks like:
+- //
+- // if err != nil {
+- // return <zero value>, ..., ${1:err}
+- // }
+- //
+- // We make the error a placeholder so it is easy to alter the error.
+- var snip snippet.Builder
+- if needsIf {
+- snip.WriteText("if ")
+- }
+- snip.WriteText(fmt.Sprintf("%s != nil {\n\t", errVar))
+-
+- var label string
+- if isTest {
+- snip.WriteText(fmt.Sprintf("%s.Fatal(%s)", testVar, errVar))
+- label = fmt.Sprintf("%[1]s != nil { %[2]s.Fatal(%[1]s) }", errVar, testVar)
+- } else {
+- snip.WriteText("return ")
+- for i := 0; i < result.Len()-1; i++ {
+- snip.WriteText(formatZeroValue(result.At(i).Type(), c.qf))
+- snip.WriteText(", ")
+- }
+- snip.WritePlaceholder(func(b *snippet.Builder) {
+- b.WriteText(errVar)
+- })
+- label = fmt.Sprintf("%[1]s != nil { return %[1]s }", errVar)
+- }
+-
+- snip.WriteText("\n}")
+-
+- if needsIf {
+- label = "if " + label
+- }
+-
+- c.items = append(c.items, CompletionItem{
+- Label: label,
+- // There doesn't seem to be a more appropriate kind.
+- Kind: protocol.KeywordCompletion,
+- Score: highScore,
+- snippet: &snip,
+- })
+-}
+-
+-// getTestVar checks the function signature's input parameters and returns
+-// the name of the first parameter that implements "testing.TB". For example,
+-// func someFunc(t *testing.T) returns the string "t", func someFunc(b *testing.B)
+-// returns "b" etc. An empty string indicates that the function signature
+-// does not take a testing.TB parameter or does so but is ignored such
+-// as func someFunc(*testing.T).
+-func getTestVar(enclosingFunc *funcInfo, pkg source.Package) string {
+- if enclosingFunc == nil || enclosingFunc.sig == nil {
+- return ""
+- }
+-
+- var testingPkg *types.Package
+- for _, p := range pkg.GetTypes().Imports() {
+- if p.Path() == "testing" {
+- testingPkg = p
+- break
+- }
+- }
+- if testingPkg == nil {
+- return ""
+- }
+- tbObj := testingPkg.Scope().Lookup("TB")
+- if tbObj == nil {
+- return ""
+- }
+- iface, ok := tbObj.Type().Underlying().(*types.Interface)
+- if !ok {
+- return ""
+- }
+-
+- sig := enclosingFunc.sig
+- for i := 0; i < sig.Params().Len(); i++ {
+- param := sig.Params().At(i)
+- if param.Name() == "_" {
+- continue
+- }
+- if !types.Implements(param.Type(), iface) {
+- continue
+- }
+- return param.Name()
+- }
+-
+- return ""
+-}
+diff -urN a/gopls/internal/lsp/source/completion/util.go b/gopls/internal/lsp/source/completion/util.go
+--- a/gopls/internal/lsp/source/completion/util.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/util.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,344 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "go/ast"
+- "go/token"
+- "go/types"
+-
+- "golang.org/x/tools/go/types/typeutil"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/diff"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-// exprAtPos returns the index of the expression containing pos.
+-func exprAtPos(pos token.Pos, args []ast.Expr) int {
+- for i, expr := range args {
+- if expr.Pos() <= pos && pos <= expr.End() {
+- return i
+- }
+- }
+- return len(args)
+-}
+-
+-// eachField invokes fn for each field that can be selected from a
+-// value of type T.
+-func eachField(T types.Type, fn func(*types.Var)) {
+- // TODO(adonovan): this algorithm doesn't exclude ambiguous
+- // selections that match more than one field/method.
+- // types.NewSelectionSet should do that for us.
+-
+- // for termination on recursive types
+- var seen typeutil.Map
+-
+- var visit func(T types.Type)
+- visit = func(T types.Type) {
+- if T, ok := source.Deref(T).Underlying().(*types.Struct); ok {
+- if seen.At(T) != nil {
+- return
+- }
+-
+- for i := 0; i < T.NumFields(); i++ {
+- f := T.Field(i)
+- fn(f)
+- if f.Anonymous() {
+- seen.Set(T, true)
+- visit(f.Type())
+- }
+- }
+- }
+- }
+- visit(T)
+-}
+-
+-// typeIsValid reports whether typ doesn't contain any Invalid types.
+-func typeIsValid(typ types.Type) bool {
+- // Check named types separately, because we don't want
+- // to call Underlying() on them to avoid problems with recursive types.
+- if _, ok := typ.(*types.Named); ok {
+- return true
+- }
+-
+- switch typ := typ.Underlying().(type) {
+- case *types.Basic:
+- return typ.Kind() != types.Invalid
+- case *types.Array:
+- return typeIsValid(typ.Elem())
+- case *types.Slice:
+- return typeIsValid(typ.Elem())
+- case *types.Pointer:
+- return typeIsValid(typ.Elem())
+- case *types.Map:
+- return typeIsValid(typ.Key()) && typeIsValid(typ.Elem())
+- case *types.Chan:
+- return typeIsValid(typ.Elem())
+- case *types.Signature:
+- return typeIsValid(typ.Params()) && typeIsValid(typ.Results())
+- case *types.Tuple:
+- for i := 0; i < typ.Len(); i++ {
+- if !typeIsValid(typ.At(i).Type()) {
+- return false
+- }
+- }
+- return true
+- case *types.Struct, *types.Interface:
+- // Don't bother checking structs, interfaces for validity.
+- return true
+- default:
+- return false
+- }
+-}
+-
+-// resolveInvalid traverses the node of the AST that defines the scope
+-// containing the declaration of obj, and attempts to find a user-friendly
+-// name for its invalid type. The resulting Object and its Type are fake.
+-func resolveInvalid(fset *token.FileSet, obj types.Object, node ast.Node, info *types.Info) types.Object {
+- var resultExpr ast.Expr
+- ast.Inspect(node, func(node ast.Node) bool {
+- switch n := node.(type) {
+- case *ast.ValueSpec:
+- for _, name := range n.Names {
+- if info.Defs[name] == obj {
+- resultExpr = n.Type
+- }
+- }
+- return false
+- case *ast.Field: // This case handles parameters and results of a FuncDecl or FuncLit.
+- for _, name := range n.Names {
+- if info.Defs[name] == obj {
+- resultExpr = n.Type
+- }
+- }
+- return false
+- default:
+- return true
+- }
+- })
+- // Construct a fake type for the object and return a fake object with this type.
+- typename := source.FormatNode(fset, resultExpr)
+- typ := types.NewNamed(types.NewTypeName(token.NoPos, obj.Pkg(), typename, nil), types.Typ[types.Invalid], nil)
+- return types.NewVar(obj.Pos(), obj.Pkg(), obj.Name(), typ)
+-}
+-
+-func isPointer(T types.Type) bool {
+- _, ok := T.(*types.Pointer)
+- return ok
+-}
+-
+-func isVar(obj types.Object) bool {
+- _, ok := obj.(*types.Var)
+- return ok
+-}
+-
+-func isTypeName(obj types.Object) bool {
+- _, ok := obj.(*types.TypeName)
+- return ok
+-}
+-
+-func isFunc(obj types.Object) bool {
+- _, ok := obj.(*types.Func)
+- return ok
+-}
+-
+-func isEmptyInterface(T types.Type) bool {
+- intf, _ := T.(*types.Interface)
+- return intf != nil && intf.NumMethods() == 0 && typeparams.IsMethodSet(intf)
+-}
+-
+-func isUntyped(T types.Type) bool {
+- if basic, ok := T.(*types.Basic); ok {
+- return basic.Info()&types.IsUntyped > 0
+- }
+- return false
+-}
+-
+-func isPkgName(obj types.Object) bool {
+- _, ok := obj.(*types.PkgName)
+- return ok
+-}
+-
+-func isASTFile(n ast.Node) bool {
+- _, ok := n.(*ast.File)
+- return ok
+-}
+-
+-func deslice(T types.Type) types.Type {
+- if slice, ok := T.Underlying().(*types.Slice); ok {
+- return slice.Elem()
+- }
+- return nil
+-}
+-
+-// isSelector returns the enclosing *ast.SelectorExpr when pos is in the
+-// selector.
+-func enclosingSelector(path []ast.Node, pos token.Pos) *ast.SelectorExpr {
+- if len(path) == 0 {
+- return nil
+- }
+-
+- if sel, ok := path[0].(*ast.SelectorExpr); ok {
+- return sel
+- }
+-
+- if _, ok := path[0].(*ast.Ident); ok && len(path) > 1 {
+- if sel, ok := path[1].(*ast.SelectorExpr); ok && pos >= sel.Sel.Pos() {
+- return sel
+- }
+- }
+-
+- return nil
+-}
+-
+-// enclosingDeclLHS returns LHS idents from containing value spec or
+-// assign statement.
+-func enclosingDeclLHS(path []ast.Node) []*ast.Ident {
+- for _, n := range path {
+- switch n := n.(type) {
+- case *ast.ValueSpec:
+- return n.Names
+- case *ast.AssignStmt:
+- ids := make([]*ast.Ident, 0, len(n.Lhs))
+- for _, e := range n.Lhs {
+- if id, ok := e.(*ast.Ident); ok {
+- ids = append(ids, id)
+- }
+- }
+- return ids
+- }
+- }
+-
+- return nil
+-}
+-
+-// exprObj returns the types.Object associated with the *ast.Ident or
+-// *ast.SelectorExpr e.
+-func exprObj(info *types.Info, e ast.Expr) types.Object {
+- var ident *ast.Ident
+- switch expr := e.(type) {
+- case *ast.Ident:
+- ident = expr
+- case *ast.SelectorExpr:
+- ident = expr.Sel
+- default:
+- return nil
+- }
+-
+- return info.ObjectOf(ident)
+-}
+-
+-// typeConversion returns the type being converted to if call is a type
+-// conversion expression.
+-func typeConversion(call *ast.CallExpr, info *types.Info) types.Type {
+- // Type conversion (e.g. "float64(foo)").
+- if fun, _ := exprObj(info, call.Fun).(*types.TypeName); fun != nil {
+- return fun.Type()
+- }
+-
+- return nil
+-}
+-
+-// fieldsAccessible returns whether s has at least one field accessible by p.
+-func fieldsAccessible(s *types.Struct, p *types.Package) bool {
+- for i := 0; i < s.NumFields(); i++ {
+- f := s.Field(i)
+- if f.Exported() || f.Pkg() == p {
+- return true
+- }
+- }
+- return false
+-}
+-
+-// prevStmt returns the statement that precedes the statement containing pos.
+-// For example:
+-//
+-// foo := 1
+-// bar(1 + 2<>)
+-//
+-// If "<>" is pos, prevStmt returns "foo := 1"
+-func prevStmt(pos token.Pos, path []ast.Node) ast.Stmt {
+- var blockLines []ast.Stmt
+- for i := 0; i < len(path) && blockLines == nil; i++ {
+- switch n := path[i].(type) {
+- case *ast.BlockStmt:
+- blockLines = n.List
+- case *ast.CommClause:
+- blockLines = n.Body
+- case *ast.CaseClause:
+- blockLines = n.Body
+- }
+- }
+-
+- for i := len(blockLines) - 1; i >= 0; i-- {
+- if blockLines[i].End() < pos {
+- return blockLines[i]
+- }
+- }
+-
+- return nil
+-}
+-
+-// formatZeroValue produces Go code representing the zero value of T. It
+-// returns the empty string if T is invalid.
+-func formatZeroValue(T types.Type, qf types.Qualifier) string {
+- switch u := T.Underlying().(type) {
+- case *types.Basic:
+- switch {
+- case u.Info()&types.IsNumeric > 0:
+- return "0"
+- case u.Info()&types.IsString > 0:
+- return `""`
+- case u.Info()&types.IsBoolean > 0:
+- return "false"
+- default:
+- return ""
+- }
+- case *types.Pointer, *types.Interface, *types.Chan, *types.Map, *types.Slice, *types.Signature:
+- return "nil"
+- default:
+- return types.TypeString(T, qf) + "{}"
+- }
+-}
+-
+-// isBasicKind returns whether t is a basic type of kind k.
+-func isBasicKind(t types.Type, k types.BasicInfo) bool {
+- b, _ := t.Underlying().(*types.Basic)
+- return b != nil && b.Info()&k > 0
+-}
+-
+-func (c *completer) editText(from, to token.Pos, newText string) ([]protocol.TextEdit, error) {
+- start, end, err := safetoken.Offsets(c.tokFile, from, to)
+- if err != nil {
+- return nil, err // can't happen: from/to came from c
+- }
+- return source.ToProtocolEdits(c.mapper, []diff.Edit{{
+- Start: start,
+- End: end,
+- New: newText,
+- }})
+-}
+-
+-// assignableTo is like types.AssignableTo, but returns false if
+-// either type is invalid.
+-func assignableTo(x, to types.Type) bool {
+- if x == types.Typ[types.Invalid] || to == types.Typ[types.Invalid] {
+- return false
+- }
+-
+- return types.AssignableTo(x, to)
+-}
+-
+-// convertibleTo is like types.ConvertibleTo, but returns false if
+-// either type is invalid.
+-func convertibleTo(x, to types.Type) bool {
+- if x == types.Typ[types.Invalid] || to == types.Typ[types.Invalid] {
+- return false
+- }
+-
+- return types.ConvertibleTo(x, to)
+-}
+diff -urN a/gopls/internal/lsp/source/completion/util_test.go b/gopls/internal/lsp/source/completion/util_test.go
+--- a/gopls/internal/lsp/source/completion/util_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/completion/util_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,28 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "go/types"
+- "testing"
+-)
+-
+-func TestFormatZeroValue(t *testing.T) {
+- tests := []struct {
+- typ types.Type
+- want string
+- }{
+- {types.Typ[types.String], `""`},
+- {types.Typ[types.Byte], "0"},
+- {types.Typ[types.Invalid], ""},
+- {types.Universe.Lookup("error").Type(), "nil"},
+- }
+-
+- for _, test := range tests {
+- if got := formatZeroValue(test.typ, nil); got != test.want {
+- t.Errorf("formatZeroValue(%v) = %q, want %q", test.typ, got, test.want)
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/source/definition.go b/gopls/internal/lsp/source/definition.go
+--- a/gopls/internal/lsp/source/definition.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/definition.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,229 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-// Definition handles the textDocument/definition request for Go files.
+-func Definition(ctx context.Context, snapshot Snapshot, fh FileHandle, position protocol.Position) ([]protocol.Location, error) {
+- ctx, done := event.Start(ctx, "source.Definition")
+- defer done()
+-
+- pkg, pgf, err := PackageForFile(ctx, snapshot, fh.URI(), NarrowestPackage)
+- if err != nil {
+- return nil, err
+- }
+- pos, err := pgf.PositionPos(position)
+- if err != nil {
+- return nil, err
+- }
+-
+- // Handle the case where the cursor is in an import.
+- importLocations, err := importDefinition(ctx, snapshot, pkg, pgf, pos)
+- if err != nil {
+- return nil, err
+- }
+- if len(importLocations) > 0 {
+- return importLocations, nil
+- }
+-
+- // Handle the case where the cursor is in the package name.
+- // We use "<= End" to accept a query immediately after the package name.
+- if pgf.File != nil && pgf.File.Name.Pos() <= pos && pos <= pgf.File.Name.End() {
+- // If there's no package documentation, just use current file.
+- declFile := pgf
+- for _, pgf := range pkg.CompiledGoFiles() {
+- if pgf.File.Name != nil && pgf.File.Doc != nil {
+- declFile = pgf
+- break
+- }
+- }
+- loc, err := declFile.NodeLocation(declFile.File.Name)
+- if err != nil {
+- return nil, err
+- }
+- return []protocol.Location{loc}, nil
+- }
+-
+- // The general case: the cursor is on an identifier.
+- _, obj, _ := referencedObject(pkg, pgf, pos)
+- if obj == nil {
+- return nil, nil
+- }
+-
+- // Handle built-in identifiers.
+- if obj.Parent() == types.Universe {
+- builtin, err := snapshot.BuiltinFile(ctx)
+- if err != nil {
+- return nil, err
+- }
+- // Note that builtinObj is an ast.Object, not types.Object :)
+- builtinObj := builtin.File.Scope.Lookup(obj.Name())
+- if builtinObj == nil {
+- // Every builtin should have documentation.
+- return nil, bug.Errorf("internal error: no builtin object for %s", obj.Name())
+- }
+- decl, ok := builtinObj.Decl.(ast.Node)
+- if !ok {
+- return nil, bug.Errorf("internal error: no declaration for %s", obj.Name())
+- }
+- // The builtin package isn't in the dependency graph, so the usual
+- // utilities won't work here.
+- loc, err := builtin.PosLocation(decl.Pos(), decl.Pos()+token.Pos(len(obj.Name())))
+- if err != nil {
+- return nil, err
+- }
+- return []protocol.Location{loc}, nil
+- }
+-
+- // Finally, map the object position.
+- var locs []protocol.Location
+- if !obj.Pos().IsValid() {
+- return nil, bug.Errorf("internal error: no position for %v", obj.Name())
+- }
+- loc, err := mapPosition(ctx, pkg.FileSet(), snapshot, obj.Pos(), adjustedObjEnd(obj))
+- if err != nil {
+- return nil, err
+- }
+- locs = append(locs, loc)
+- return locs, nil
+-}
+-
+-// referencedObject returns the identifier and object referenced at the
+-// specified position, which must be within the file pgf, for the purposes of
+-// definition/hover/call hierarchy operations. It returns a nil object if no
+-// object was found at the given position.
+-//
+-// If the returned identifier is a type-switch implicit (i.e. the x in x :=
+-// e.(type)), the third result will be the type of the expression being
+-// switched on (the type of e in the example). This facilitates workarounds for
+-// limitations of the go/types API, which does not report an object for the
+-// identifier x.
+-//
+-// For embedded fields, referencedObject returns the type name object rather
+-// than the var (field) object.
+-//
+-// TODO(rfindley): this function exists to preserve the pre-existing behavior
+-// of source.Identifier. Eliminate this helper in favor of sharing
+-// functionality with objectsAt, after choosing suitable primitives.
+-func referencedObject(pkg Package, pgf *ParsedGoFile, pos token.Pos) (*ast.Ident, types.Object, types.Type) {
+- path := pathEnclosingObjNode(pgf.File, pos)
+- if len(path) == 0 {
+- return nil, nil, nil
+- }
+- var obj types.Object
+- info := pkg.GetTypesInfo()
+- switch n := path[0].(type) {
+- case *ast.Ident:
+- obj = info.ObjectOf(n)
+- // If n is the var's declaring ident in a type switch
+- // [i.e. the x in x := foo.(type)], it will not have an object. In this
+- // case, set obj to the first implicit object (if any), and return the type
+- // of the expression being switched on.
+- //
+- // The type switch may have no case clauses and thus no
+- // implicit objects; this is a type error ("unused x"),
+- if obj == nil {
+- if implicits, typ := typeSwitchImplicits(info, path); len(implicits) > 0 {
+- return n, implicits[0], typ
+- }
+- }
+-
+- // If the original position was an embedded field, we want to jump
+- // to the field's type definition, not the field's definition.
+- if v, ok := obj.(*types.Var); ok && v.Embedded() {
+- // types.Info.Uses contains the embedded field's *types.TypeName.
+- if typeName := info.Uses[n]; typeName != nil {
+- obj = typeName
+- }
+- }
+- return n, obj, nil
+- }
+- return nil, nil, nil
+-}
+-
+-// importDefinition returns locations defining a package referenced by the
+-// import spec containing pos.
+-//
+-// If pos is not inside an import spec, it returns nil, nil.
+-func importDefinition(ctx context.Context, s Snapshot, pkg Package, pgf *ParsedGoFile, pos token.Pos) ([]protocol.Location, error) {
+- var imp *ast.ImportSpec
+- for _, spec := range pgf.File.Imports {
+- // We use "<= End" to accept a query immediately after an ImportSpec.
+- if spec.Path.Pos() <= pos && pos <= spec.Path.End() {
+- imp = spec
+- }
+- }
+- if imp == nil {
+- return nil, nil
+- }
+-
+- importPath := UnquoteImportPath(imp)
+- impID := pkg.Metadata().DepsByImpPath[importPath]
+- if impID == "" {
+- return nil, fmt.Errorf("failed to resolve import %q", importPath)
+- }
+- impMetadata := s.Metadata(impID)
+- if impMetadata == nil {
+- return nil, fmt.Errorf("missing information for package %q", impID)
+- }
+-
+- var locs []protocol.Location
+- for _, f := range impMetadata.CompiledGoFiles {
+- fh, err := s.GetFile(ctx, f)
+- if err != nil {
+- if ctx.Err() != nil {
+- return nil, ctx.Err()
+- }
+- continue
+- }
+- pgf, err := s.ParseGo(ctx, fh, ParseHeader)
+- if err != nil {
+- if ctx.Err() != nil {
+- return nil, ctx.Err()
+- }
+- continue
+- }
+- loc, err := pgf.NodeLocation(pgf.File)
+- if err != nil {
+- return nil, err
+- }
+- locs = append(locs, loc)
+- }
+-
+- if len(locs) == 0 {
+- return nil, fmt.Errorf("package %q has no readable files", impID) // incl. unsafe
+- }
+-
+- return locs, nil
+-}
+-
+-// TODO(rfindley): avoid the duplicate column mapping here, by associating a
+-// column mapper with each file handle.
+-func mapPosition(ctx context.Context, fset *token.FileSet, s FileSource, start, end token.Pos) (protocol.Location, error) {
+- file := fset.File(start)
+- uri := span.URIFromPath(file.Name())
+- fh, err := s.GetFile(ctx, uri)
+- if err != nil {
+- return protocol.Location{}, err
+- }
+- content, err := fh.Read()
+- if err != nil {
+- return protocol.Location{}, err
+- }
+- m := protocol.NewMapper(fh.URI(), content)
+- return m.PosLocation(file, start, end)
+-}
+diff -urN a/gopls/internal/lsp/source/diagnostics.go b/gopls/internal/lsp/source/diagnostics.go
+--- a/gopls/internal/lsp/source/diagnostics.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/diagnostics.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,138 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-type SuggestedFix struct {
+- Title string
+- Edits map[span.URI][]protocol.TextEdit
+- Command *protocol.Command
+- ActionKind protocol.CodeActionKind
+-}
+-
+-// Analyze reports go/analysis-framework diagnostics in the specified package.
+-func Analyze(ctx context.Context, snapshot Snapshot, pkgid PackageID, includeConvenience bool) (map[span.URI][]*Diagnostic, error) {
+- // Exit early if the context has been canceled. This also protects us
+- // from a race on Options, see golang/go#36699.
+- if ctx.Err() != nil {
+- return nil, ctx.Err()
+- }
+-
+- options := snapshot.View().Options()
+- categories := []map[string]*Analyzer{
+- options.DefaultAnalyzers,
+- options.StaticcheckAnalyzers,
+- options.TypeErrorAnalyzers,
+- }
+- if includeConvenience { // e.g. for codeAction
+- categories = append(categories, options.ConvenienceAnalyzers) // e.g. fillstruct
+- }
+-
+- var analyzers []*Analyzer
+- for _, cat := range categories {
+- for _, a := range cat {
+- analyzers = append(analyzers, a)
+- }
+- }
+-
+- analysisDiagnostics, err := snapshot.Analyze(ctx, pkgid, analyzers)
+- if err != nil {
+- return nil, err
+- }
+-
+- // Report diagnostics and errors from root analyzers.
+- reports := make(map[span.URI][]*Diagnostic)
+- for _, diag := range analysisDiagnostics {
+- reports[diag.URI] = append(reports[diag.URI], diag)
+- }
+- return reports, nil
+-}
+-
+-// FileDiagnostics reports diagnostics in the specified file,
+-// as used by the "gopls check" command.
+-//
+-// TODO(adonovan): factor in common with (*Server).codeAction, which
+-// executes { PackageForFile; Analyze } too?
+-//
+-// TODO(adonovan): opt: this function is called in a loop from the
+-// "gopls/diagnoseFiles" nonstandard request handler. It would be more
+-// efficient to compute the set of packages and TypeCheck and
+-// Analyze them all at once.
+-func FileDiagnostics(ctx context.Context, snapshot Snapshot, uri span.URI) (FileHandle, []*Diagnostic, error) {
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return nil, nil, err
+- }
+- pkg, _, err := PackageForFile(ctx, snapshot, uri, NarrowestPackage)
+- if err != nil {
+- return nil, nil, err
+- }
+- pkgDiags, err := pkg.DiagnosticsForFile(ctx, snapshot, uri)
+- if err != nil {
+- return nil, nil, err
+- }
+- adiags, err := Analyze(ctx, snapshot, pkg.Metadata().ID, false)
+- if err != nil {
+- return nil, nil, err
+- }
+- var fileDiags []*Diagnostic // combine load/parse/type + analysis diagnostics
+- CombineDiagnostics(pkgDiags, adiags[uri], &fileDiags, &fileDiags)
+- return fh, fileDiags, nil
+-}
+-
+-// CombineDiagnostics combines and filters list/parse/type diagnostics from
+-// tdiags with adiags, and appends the two lists to *outT and *outA,
+-// respectively.
+-//
+-// Type-error analyzers produce diagnostics that are redundant
+-// with type checker diagnostics, but more detailed (e.g. fixes).
+-// Rather than report two diagnostics for the same problem,
+-// we combine them by augmenting the type-checker diagnostic
+-// and discarding the analyzer diagnostic.
+-//
+-// If an analysis diagnostic has the same range and message as
+-// a list/parse/type diagnostic, the suggested fix information
+-// (et al) of the latter is merged into a copy of the former.
+-// This handles the case where a type-error analyzer suggests
+-// a fix to a type error, and avoids duplication.
+-//
+-// The use of out-slices, though irregular, allows the caller to
+-// easily choose whether to keep the results separate or combined.
+-//
+-// The arguments are not modified.
+-func CombineDiagnostics(tdiags []*Diagnostic, adiags []*Diagnostic, outT, outA *[]*Diagnostic) {
+-
+- // Build index of (list+parse+)type errors.
+- type key struct {
+- Range protocol.Range
+- message string
+- }
+- index := make(map[key]int) // maps (Range,Message) to index in tdiags slice
+- for i, diag := range tdiags {
+- index[key{diag.Range, diag.Message}] = i
+- }
+-
+- // Filter out analysis diagnostics that match type errors,
+- // retaining their suggested fix (etc) fields.
+- for _, diag := range adiags {
+- if i, ok := index[key{diag.Range, diag.Message}]; ok {
+- copy := *tdiags[i]
+- copy.SuggestedFixes = diag.SuggestedFixes
+- copy.Tags = diag.Tags
+- tdiags[i] = &copy
+- continue
+- }
+-
+- *outA = append(*outA, diag)
+- }
+-
+- *outT = append(*outT, tdiags...)
+-}
+diff -urN a/gopls/internal/lsp/source/extract.go b/gopls/internal/lsp/source/extract.go
+--- a/gopls/internal/lsp/source/extract.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/extract.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1331 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "bytes"
+- "fmt"
+- "go/ast"
+- "go/format"
+- "go/parser"
+- "go/token"
+- "go/types"
+- "sort"
+- "strings"
+- "text/scanner"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/internal/analysisinternal"
+- "golang.org/x/tools/internal/bug"
+-)
+-
+-func extractVariable(fset *token.FileSet, start, end token.Pos, src []byte, file *ast.File, _ *types.Package, info *types.Info) (*analysis.SuggestedFix, error) {
+- tokFile := fset.File(file.Pos())
+- expr, path, ok, err := CanExtractVariable(start, end, file)
+- if !ok {
+- return nil, fmt.Errorf("extractVariable: cannot extract %s: %v", safetoken.StartPosition(fset, start), err)
+- }
+-
+- // Create new AST node for extracted code.
+- var lhsNames []string
+- switch expr := expr.(type) {
+- // TODO: stricter rules for selectorExpr.
+- case *ast.BasicLit, *ast.CompositeLit, *ast.IndexExpr, *ast.SliceExpr,
+- *ast.UnaryExpr, *ast.BinaryExpr, *ast.SelectorExpr:
+- lhsName, _ := generateAvailableIdentifier(expr.Pos(), file, path, info, "x", 0)
+- lhsNames = append(lhsNames, lhsName)
+- case *ast.CallExpr:
+- tup, ok := info.TypeOf(expr).(*types.Tuple)
+- if !ok {
+- // If the call expression only has one return value, we can treat it the
+- // same as our standard extract variable case.
+- lhsName, _ := generateAvailableIdentifier(expr.Pos(), file, path, info, "x", 0)
+- lhsNames = append(lhsNames, lhsName)
+- break
+- }
+- idx := 0
+- for i := 0; i < tup.Len(); i++ {
+- // Generate a unique variable for each return value.
+- var lhsName string
+- lhsName, idx = generateAvailableIdentifier(expr.Pos(), file, path, info, "x", idx)
+- lhsNames = append(lhsNames, lhsName)
+- }
+- default:
+- return nil, fmt.Errorf("cannot extract %T", expr)
+- }
+-
+- insertBeforeStmt := analysisinternal.StmtToInsertVarBefore(path)
+- if insertBeforeStmt == nil {
+- return nil, fmt.Errorf("cannot find location to insert extraction")
+- }
+- indent, err := calculateIndentation(src, tokFile, insertBeforeStmt)
+- if err != nil {
+- return nil, err
+- }
+- newLineIndent := "\n" + indent
+-
+- lhs := strings.Join(lhsNames, ", ")
+- assignStmt := &ast.AssignStmt{
+- Lhs: []ast.Expr{ast.NewIdent(lhs)},
+- Tok: token.DEFINE,
+- Rhs: []ast.Expr{expr},
+- }
+- var buf bytes.Buffer
+- if err := format.Node(&buf, fset, assignStmt); err != nil {
+- return nil, err
+- }
+- assignment := strings.ReplaceAll(buf.String(), "\n", newLineIndent) + newLineIndent
+-
+- return &analysis.SuggestedFix{
+- TextEdits: []analysis.TextEdit{
+- {
+- Pos: insertBeforeStmt.Pos(),
+- End: insertBeforeStmt.Pos(),
+- NewText: []byte(assignment),
+- },
+- {
+- Pos: start,
+- End: end,
+- NewText: []byte(lhs),
+- },
+- },
+- }, nil
+-}
+-
+-// CanExtractVariable reports whether the code in the given range can be
+-// extracted to a variable.
+-func CanExtractVariable(start, end token.Pos, file *ast.File) (ast.Expr, []ast.Node, bool, error) {
+- if start == end {
+- return nil, nil, false, fmt.Errorf("start and end are equal")
+- }
+- path, _ := astutil.PathEnclosingInterval(file, start, end)
+- if len(path) == 0 {
+- return nil, nil, false, fmt.Errorf("no path enclosing interval")
+- }
+- for _, n := range path {
+- if _, ok := n.(*ast.ImportSpec); ok {
+- return nil, nil, false, fmt.Errorf("cannot extract variable in an import block")
+- }
+- }
+- node := path[0]
+- if start != node.Pos() || end != node.End() {
+- return nil, nil, false, fmt.Errorf("range does not map to an AST node")
+- }
+- expr, ok := node.(ast.Expr)
+- if !ok {
+- return nil, nil, false, fmt.Errorf("node is not an expression")
+- }
+- switch expr.(type) {
+- case *ast.BasicLit, *ast.CompositeLit, *ast.IndexExpr, *ast.CallExpr,
+- *ast.SliceExpr, *ast.UnaryExpr, *ast.BinaryExpr, *ast.SelectorExpr:
+- return expr, path, true, nil
+- }
+- return nil, nil, false, fmt.Errorf("cannot extract an %T to a variable", expr)
+-}
+-
+-// Calculate indentation for insertion.
+-// When inserting lines of code, we must ensure that the lines have consistent
+-// formatting (i.e. the proper indentation). To do so, we observe the indentation on the
+-// line of code on which the insertion occurs.
+-func calculateIndentation(content []byte, tok *token.File, insertBeforeStmt ast.Node) (string, error) {
+- line := tok.Line(insertBeforeStmt.Pos())
+- lineOffset, stmtOffset, err := safetoken.Offsets(tok, tok.LineStart(line), insertBeforeStmt.Pos())
+- if err != nil {
+- return "", err
+- }
+- return string(content[lineOffset:stmtOffset]), nil
+-}
+-
+-// generateAvailableIdentifier adjusts the new function name until there are no collisions in scope.
+-// Possible collisions include other function and variable names. Returns the next index to check for prefix.
+-func generateAvailableIdentifier(pos token.Pos, file *ast.File, path []ast.Node, info *types.Info, prefix string, idx int) (string, int) {
+- scopes := CollectScopes(info, path, pos)
+- return generateIdentifier(idx, prefix, func(name string) bool {
+- return file.Scope.Lookup(name) != nil || !isValidName(name, scopes)
+- })
+-}
+-
+-func generateIdentifier(idx int, prefix string, hasCollision func(string) bool) (string, int) {
+- name := prefix
+- if idx != 0 {
+- name += fmt.Sprintf("%d", idx)
+- }
+- for hasCollision(name) {
+- idx++
+- name = fmt.Sprintf("%v%d", prefix, idx)
+- }
+- return name, idx + 1
+-}
+-
+-// isValidName checks for variable collision in scope.
+-func isValidName(name string, scopes []*types.Scope) bool {
+- for _, scope := range scopes {
+- if scope == nil {
+- continue
+- }
+- if scope.Lookup(name) != nil {
+- return false
+- }
+- }
+- return true
+-}
+-
+-// returnVariable keeps track of the information we need to properly introduce a new variable
+-// that we will return in the extracted function.
+-type returnVariable struct {
+- // name is the identifier that is used on the left-hand side of the call to
+- // the extracted function.
+- name ast.Expr
+- // decl is the declaration of the variable. It is used in the type signature of the
+- // extracted function and for variable declarations.
+- decl *ast.Field
+- // zeroVal is the "zero value" of the type of the variable. It is used in a return
+- // statement in the extracted function.
+- zeroVal ast.Expr
+-}
+-
+-// extractMethod refactors the selected block of code into a new method.
+-func extractMethod(fset *token.FileSet, start, end token.Pos, src []byte, file *ast.File, pkg *types.Package, info *types.Info) (*analysis.SuggestedFix, error) {
+- return extractFunctionMethod(fset, start, end, src, file, pkg, info, true)
+-}
+-
+-// extractFunction refactors the selected block of code into a new function.
+-func extractFunction(fset *token.FileSet, start, end token.Pos, src []byte, file *ast.File, pkg *types.Package, info *types.Info) (*analysis.SuggestedFix, error) {
+- return extractFunctionMethod(fset, start, end, src, file, pkg, info, false)
+-}
+-
+-// extractFunctionMethod refactors the selected block of code into a new function/method.
+-// It also replaces the selected block of code with a call to the extracted
+-// function. First, we manually adjust the selection range. We remove trailing
+-// and leading whitespace characters to ensure the range is precisely bounded
+-// by AST nodes. Next, we determine the variables that will be the parameters
+-// and return values of the extracted function/method. Lastly, we construct the call
+-// of the function/method and insert this call as well as the extracted function/method into
+-// their proper locations.
+-func extractFunctionMethod(fset *token.FileSet, start, end token.Pos, src []byte, file *ast.File, pkg *types.Package, info *types.Info, isMethod bool) (*analysis.SuggestedFix, error) {
+- errorPrefix := "extractFunction"
+- if isMethod {
+- errorPrefix = "extractMethod"
+- }
+-
+- tok := fset.File(file.Pos())
+- if tok == nil {
+- return nil, bug.Errorf("no file for position")
+- }
+- p, ok, methodOk, err := CanExtractFunction(tok, start, end, src, file)
+- if (!ok && !isMethod) || (!methodOk && isMethod) {
+- return nil, fmt.Errorf("%s: cannot extract %s: %v", errorPrefix,
+- safetoken.StartPosition(fset, start), err)
+- }
+- tok, path, start, end, outer, node := p.tok, p.path, p.start, p.end, p.outer, p.node
+- fileScope := info.Scopes[file]
+- if fileScope == nil {
+- return nil, fmt.Errorf("%s: file scope is empty", errorPrefix)
+- }
+- pkgScope := fileScope.Parent()
+- if pkgScope == nil {
+- return nil, fmt.Errorf("%s: package scope is empty", errorPrefix)
+- }
+-
+- // A return statement is non-nested if its parent node is equal to the parent node
+- // of the first node in the selection. These cases must be handled separately because
+- // non-nested return statements are guaranteed to execute.
+- var retStmts []*ast.ReturnStmt
+- var hasNonNestedReturn bool
+- startParent := findParent(outer, node)
+- ast.Inspect(outer, func(n ast.Node) bool {
+- if n == nil {
+- return false
+- }
+- if n.Pos() < start || n.End() > end {
+- return n.Pos() <= end
+- }
+- ret, ok := n.(*ast.ReturnStmt)
+- if !ok {
+- return true
+- }
+- if findParent(outer, n) == startParent {
+- hasNonNestedReturn = true
+- }
+- retStmts = append(retStmts, ret)
+- return false
+- })
+- containsReturnStatement := len(retStmts) > 0
+-
+- // Now that we have determined the correct range for the selection block,
+- // we must determine the signature of the extracted function. We will then replace
+- // the block with an assignment statement that calls the extracted function with
+- // the appropriate parameters and return values.
+- variables, err := collectFreeVars(info, file, fileScope, pkgScope, start, end, path[0])
+- if err != nil {
+- return nil, err
+- }
+-
+- var (
+- receiverUsed bool
+- receiver *ast.Field
+- receiverName string
+- receiverObj types.Object
+- )
+- if isMethod {
+- if outer == nil || outer.Recv == nil || len(outer.Recv.List) == 0 {
+- return nil, fmt.Errorf("%s: cannot extract need method receiver", errorPrefix)
+- }
+- receiver = outer.Recv.List[0]
+- if len(receiver.Names) == 0 || receiver.Names[0] == nil {
+- return nil, fmt.Errorf("%s: cannot extract need method receiver name", errorPrefix)
+- }
+- recvName := receiver.Names[0]
+- receiverName = recvName.Name
+- receiverObj = info.ObjectOf(recvName)
+- }
+-
+- var (
+- params, returns []ast.Expr // used when calling the extracted function
+- paramTypes, returnTypes []*ast.Field // used in the signature of the extracted function
+- uninitialized []types.Object // vars we will need to initialize before the call
+- )
+-
+- // Avoid duplicates while traversing vars and uninitialized.
+- seenVars := make(map[types.Object]ast.Expr)
+- seenUninitialized := make(map[types.Object]struct{})
+-
+- // Some variables on the left-hand side of our assignment statement may be free. If our
+- // selection begins in the same scope in which the free variable is defined, we can
+- // redefine it in our assignment statement. See the following example, where 'b' and
+- // 'err' (both free variables) can be redefined in the second funcCall() while maintaining
+- // correctness.
+- //
+- //
+- // Not Redefined:
+- //
+- // a, err := funcCall()
+- // var b int
+- // b, err = funcCall()
+- //
+- // Redefined:
+- //
+- // a, err := funcCall()
+- // b, err := funcCall()
+- //
+- // We track the number of free variables that can be redefined to maintain our preference
+- // of using "x, y, z := fn()" style assignment statements.
+- var canRedefineCount int
+-
+- // Each identifier in the selected block must become (1) a parameter to the
+- // extracted function, (2) a return value of the extracted function, or (3) a local
+- // variable in the extracted function. Determine the outcome(s) for each variable
+- // based on whether it is free, altered within the selected block, and used outside
+- // of the selected block.
+- for _, v := range variables {
+- if _, ok := seenVars[v.obj]; ok {
+- continue
+- }
+- if v.obj.Name() == "_" {
+- // The blank identifier is always a local variable
+- continue
+- }
+- typ := analysisinternal.TypeExpr(file, pkg, v.obj.Type())
+- if typ == nil {
+- return nil, fmt.Errorf("nil AST expression for type: %v", v.obj.Name())
+- }
+- seenVars[v.obj] = typ
+- identifier := ast.NewIdent(v.obj.Name())
+- // An identifier must meet three conditions to become a return value of the
+- // extracted function. (1) its value must be defined or reassigned within
+- // the selection (isAssigned), (2) it must be used at least once after the
+- // selection (isUsed), and (3) its first use after the selection
+- // cannot be its own reassignment or redefinition (objOverriden).
+- if v.obj.Parent() == nil {
+- return nil, fmt.Errorf("parent nil")
+- }
+- isUsed, firstUseAfter := objUsed(info, end, v.obj.Parent().End(), v.obj)
+- if v.assigned && isUsed && !varOverridden(info, firstUseAfter, v.obj, v.free, outer) {
+- returnTypes = append(returnTypes, &ast.Field{Type: typ})
+- returns = append(returns, identifier)
+- if !v.free {
+- uninitialized = append(uninitialized, v.obj)
+- } else if v.obj.Parent().Pos() == startParent.Pos() {
+- canRedefineCount++
+- }
+- }
+- // An identifier must meet two conditions to become a parameter of the
+- // extracted function. (1) it must be free (isFree), and (2) its first
+- // use within the selection cannot be its own definition (isDefined).
+- if v.free && !v.defined {
+- // Skip the selector for a method.
+- if isMethod && v.obj == receiverObj {
+- receiverUsed = true
+- continue
+- }
+- params = append(params, identifier)
+- paramTypes = append(paramTypes, &ast.Field{
+- Names: []*ast.Ident{identifier},
+- Type: typ,
+- })
+- }
+- }
+-
+- // Find the function literal that encloses the selection. The enclosing function literal
+- // may not be the enclosing function declaration (i.e. 'outer'). For example, in the
+- // following block:
+- //
+- // func main() {
+- // ast.Inspect(node, func(n ast.Node) bool {
+- // v := 1 // this line extracted
+- // return true
+- // })
+- // }
+- //
+- // 'outer' is main(). However, the extracted selection most directly belongs to
+- // the anonymous function literal, the second argument of ast.Inspect(). We use the
+- // enclosing function literal to determine the proper return types for return statements
+- // within the selection. We still need the enclosing function declaration because this is
+- // the top-level declaration. We inspect the top-level declaration to look for variables
+- // as well as for code replacement.
+- enclosing := outer.Type
+- for _, p := range path {
+- if p == enclosing {
+- break
+- }
+- if fl, ok := p.(*ast.FuncLit); ok {
+- enclosing = fl.Type
+- break
+- }
+- }
+-
+- // We put the selection in a constructed file. We can then traverse and edit
+- // the extracted selection without modifying the original AST.
+- startOffset, endOffset, err := safetoken.Offsets(tok, start, end)
+- if err != nil {
+- return nil, err
+- }
+- selection := src[startOffset:endOffset]
+- extractedBlock, err := parseBlockStmt(fset, selection)
+- if err != nil {
+- return nil, err
+- }
+-
+- // We need to account for return statements in the selected block, as they will complicate
+- // the logical flow of the extracted function. See the following example, where ** denotes
+- // the range to be extracted.
+- //
+- // Before:
+- //
+- // func _() int {
+- // a := 1
+- // b := 2
+- // **if a == b {
+- // return a
+- // }**
+- // ...
+- // }
+- //
+- // After:
+- //
+- // func _() int {
+- // a := 1
+- // b := 2
+- // cond0, ret0 := x0(a, b)
+- // if cond0 {
+- // return ret0
+- // }
+- // ...
+- // }
+- //
+- // func x0(a int, b int) (bool, int) {
+- // if a == b {
+- // return true, a
+- // }
+- // return false, 0
+- // }
+- //
+- // We handle returns by adding an additional boolean return value to the extracted function.
+- // This bool reports whether the original function would have returned. Because the
+- // extracted selection contains a return statement, we must also add the types in the
+- // return signature of the enclosing function to the return signature of the
+- // extracted function. We then add an extra if statement checking this boolean value
+- // in the original function. If the condition is met, the original function should
+- // return a value, mimicking the functionality of the original return statement(s)
+- // in the selection.
+- //
+- // If there is a return that is guaranteed to execute (hasNonNestedReturns=true), then
+- // we don't need to include this additional condition check and can simply return.
+- //
+- // Before:
+- //
+- // func _() int {
+- // a := 1
+- // b := 2
+- // **if a == b {
+- // return a
+- // }
+- // return b**
+- // }
+- //
+- // After:
+- //
+- // func _() int {
+- // a := 1
+- // b := 2
+- // return x0(a, b)
+- // }
+- //
+- // func x0(a int, b int) int {
+- // if a == b {
+- // return a
+- // }
+- // return b
+- // }
+-
+- var retVars []*returnVariable
+- var ifReturn *ast.IfStmt
+- if containsReturnStatement {
+- if !hasNonNestedReturn {
+- // The selected block contained return statements, so we have to modify the
+- // signature of the extracted function as described above. Adjust all of
+- // the return statements in the extracted function to reflect this change in
+- // signature.
+- if err := adjustReturnStatements(returnTypes, seenVars, fset, file,
+- pkg, extractedBlock); err != nil {
+- return nil, err
+- }
+- }
+- // Collect the additional return values and types needed to accommodate return
+- // statements in the selection. Update the type signature of the extracted
+- // function and construct the if statement that will be inserted in the enclosing
+- // function.
+- retVars, ifReturn, err = generateReturnInfo(enclosing, pkg, path, file, info, fset, start, hasNonNestedReturn)
+- if err != nil {
+- return nil, err
+- }
+- }
+-
+- // Add a return statement to the end of the new function. This return statement must include
+- // the values for the types of the original extracted function signature and (if a return
+- // statement is present in the selection) enclosing function signature.
+- // This only needs to be done if the selections does not have a non-nested return, otherwise
+- // it already terminates with a return statement.
+- hasReturnValues := len(returns)+len(retVars) > 0
+- if hasReturnValues && !hasNonNestedReturn {
+- extractedBlock.List = append(extractedBlock.List, &ast.ReturnStmt{
+- Results: append(returns, getZeroVals(retVars)...),
+- })
+- }
+-
+- // Construct the appropriate call to the extracted function.
+- // We must meet two conditions to use ":=" instead of '='. (1) there must be at least
+- // one variable on the lhs that is uninitialized (non-free) prior to the assignment.
+- // (2) all of the initialized (free) variables on the lhs must be able to be redefined.
+- sym := token.ASSIGN
+- canDefineCount := len(uninitialized) + canRedefineCount
+- canDefine := len(uninitialized)+len(retVars) > 0 && canDefineCount == len(returns)
+- if canDefine {
+- sym = token.DEFINE
+- }
+- var name, funName string
+- if isMethod {
+- name = "newMethod"
+- // TODO(suzmue): generate a name that does not conflict for "newMethod".
+- funName = name
+- } else {
+- name = "newFunction"
+- funName, _ = generateAvailableIdentifier(start, file, path, info, name, 0)
+- }
+- extractedFunCall := generateFuncCall(hasNonNestedReturn, hasReturnValues, params,
+- append(returns, getNames(retVars)...), funName, sym, receiverName)
+-
+- // Build the extracted function.
+- newFunc := &ast.FuncDecl{
+- Name: ast.NewIdent(funName),
+- Type: &ast.FuncType{
+- Params: &ast.FieldList{List: paramTypes},
+- Results: &ast.FieldList{List: append(returnTypes, getDecls(retVars)...)},
+- },
+- Body: extractedBlock,
+- }
+- if isMethod {
+- var names []*ast.Ident
+- if receiverUsed {
+- names = append(names, ast.NewIdent(receiverName))
+- }
+- newFunc.Recv = &ast.FieldList{
+- List: []*ast.Field{{
+- Names: names,
+- Type: receiver.Type,
+- }},
+- }
+- }
+-
+- // Create variable declarations for any identifiers that need to be initialized prior to
+- // calling the extracted function. We do not manually initialize variables if every return
+- // value is uninitialized. We can use := to initialize the variables in this situation.
+- var declarations []ast.Stmt
+- if canDefineCount != len(returns) {
+- declarations = initializeVars(uninitialized, retVars, seenUninitialized, seenVars)
+- }
+-
+- var declBuf, replaceBuf, newFuncBuf, ifBuf, commentBuf bytes.Buffer
+- if err := format.Node(&declBuf, fset, declarations); err != nil {
+- return nil, err
+- }
+- if err := format.Node(&replaceBuf, fset, extractedFunCall); err != nil {
+- return nil, err
+- }
+- if ifReturn != nil {
+- if err := format.Node(&ifBuf, fset, ifReturn); err != nil {
+- return nil, err
+- }
+- }
+- if err := format.Node(&newFuncBuf, fset, newFunc); err != nil {
+- return nil, err
+- }
+- // Find all the comments within the range and print them to be put somewhere.
+- // TODO(suzmue): print these in the extracted function at the correct place.
+- for _, cg := range file.Comments {
+- if cg.Pos().IsValid() && cg.Pos() < end && cg.Pos() >= start {
+- for _, c := range cg.List {
+- fmt.Fprintln(&commentBuf, c.Text)
+- }
+- }
+- }
+-
+- // We're going to replace the whole enclosing function,
+- // so preserve the text before and after the selected block.
+- outerStart, outerEnd, err := safetoken.Offsets(tok, outer.Pos(), outer.End())
+- if err != nil {
+- return nil, err
+- }
+- before := src[outerStart:startOffset]
+- after := src[endOffset:outerEnd]
+- indent, err := calculateIndentation(src, tok, node)
+- if err != nil {
+- return nil, err
+- }
+- newLineIndent := "\n" + indent
+-
+- var fullReplacement strings.Builder
+- fullReplacement.Write(before)
+- if commentBuf.Len() > 0 {
+- comments := strings.ReplaceAll(commentBuf.String(), "\n", newLineIndent)
+- fullReplacement.WriteString(comments)
+- }
+- if declBuf.Len() > 0 { // add any initializations, if needed
+- initializations := strings.ReplaceAll(declBuf.String(), "\n", newLineIndent) +
+- newLineIndent
+- fullReplacement.WriteString(initializations)
+- }
+- fullReplacement.Write(replaceBuf.Bytes()) // call the extracted function
+- if ifBuf.Len() > 0 { // add the if statement below the function call, if needed
+- ifstatement := newLineIndent +
+- strings.ReplaceAll(ifBuf.String(), "\n", newLineIndent)
+- fullReplacement.WriteString(ifstatement)
+- }
+- fullReplacement.Write(after)
+- fullReplacement.WriteString("\n\n") // add newlines after the enclosing function
+- fullReplacement.Write(newFuncBuf.Bytes()) // insert the extracted function
+-
+- return &analysis.SuggestedFix{
+- TextEdits: []analysis.TextEdit{{
+- Pos: outer.Pos(),
+- End: outer.End(),
+- NewText: []byte(fullReplacement.String()),
+- }},
+- }, nil
+-}
+-
+-// adjustRangeForCommentsAndWhiteSpace adjusts the given range to exclude unnecessary leading or
+-// trailing whitespace characters from selection as well as leading or trailing comments.
+-// In the following example, each line of the if statement is indented once. There are also two
+-// extra spaces after the sclosing bracket before the line break and a comment.
+-//
+-// \tif (true) {
+-// \t _ = 1
+-// \t} // hello \n
+-//
+-// By default, a valid range begins at 'if' and ends at the first whitespace character
+-// after the '}'. But, users are likely to highlight full lines rather than adjusting
+-// their cursors for whitespace. To support this use case, we must manually adjust the
+-// ranges to match the correct AST node. In this particular example, we would adjust
+-// rng.Start forward to the start of 'if' and rng.End backward to after '}'.
+-func adjustRangeForCommentsAndWhiteSpace(tok *token.File, start, end token.Pos, content []byte, file *ast.File) (token.Pos, token.Pos, error) {
+- // Adjust the end of the range to after leading whitespace and comments.
+- prevStart := token.NoPos
+- startComment := sort.Search(len(file.Comments), func(i int) bool {
+- // Find the index for the first comment that ends after range start.
+- return file.Comments[i].End() > start
+- })
+- for prevStart != start {
+- prevStart = start
+- // If start is within a comment, move start to the end
+- // of the comment group.
+- if startComment < len(file.Comments) && file.Comments[startComment].Pos() <= start && start < file.Comments[startComment].End() {
+- start = file.Comments[startComment].End()
+- startComment++
+- }
+- // Move forwards to find a non-whitespace character.
+- offset, err := safetoken.Offset(tok, start)
+- if err != nil {
+- return 0, 0, err
+- }
+- for offset < len(content) && isGoWhiteSpace(content[offset]) {
+- offset++
+- }
+- start = tok.Pos(offset)
+- }
+-
+- // Adjust the end of the range to before trailing whitespace and comments.
+- prevEnd := token.NoPos
+- endComment := sort.Search(len(file.Comments), func(i int) bool {
+- // Find the index for the first comment that ends after the range end.
+- return file.Comments[i].End() >= end
+- })
+- // Search will return n if not found, so we need to adjust if there are no
+- // comments that would match.
+- if endComment == len(file.Comments) {
+- endComment = -1
+- }
+- for prevEnd != end {
+- prevEnd = end
+- // If end is within a comment, move end to the start
+- // of the comment group.
+- if endComment >= 0 && file.Comments[endComment].Pos() < end && end <= file.Comments[endComment].End() {
+- end = file.Comments[endComment].Pos()
+- endComment--
+- }
+- // Move backwards to find a non-whitespace character.
+- offset, err := safetoken.Offset(tok, end)
+- if err != nil {
+- return 0, 0, err
+- }
+- for offset > 0 && isGoWhiteSpace(content[offset-1]) {
+- offset--
+- }
+- end = tok.Pos(offset)
+- }
+-
+- return start, end, nil
+-}
+-
+-// isGoWhiteSpace returns true if b is a considered white space in
+-// Go as defined by scanner.GoWhitespace.
+-func isGoWhiteSpace(b byte) bool {
+- return uint64(scanner.GoWhitespace)&(1<<uint(b)) != 0
+-}
+-
+-// findParent finds the parent AST node of the given target node, if the target is a
+-// descendant of the starting node.
+-func findParent(start ast.Node, target ast.Node) ast.Node {
+- var parent ast.Node
+- analysisinternal.WalkASTWithParent(start, func(n, p ast.Node) bool {
+- if n == target {
+- parent = p
+- return false
+- }
+- return true
+- })
+- return parent
+-}
+-
+-// variable describes the status of a variable within a selection.
+-type variable struct {
+- obj types.Object
+-
+- // free reports whether the variable is a free variable, meaning it should
+- // be a parameter to the extracted function.
+- free bool
+-
+- // assigned reports whether the variable is assigned to in the selection.
+- assigned bool
+-
+- // defined reports whether the variable is defined in the selection.
+- defined bool
+-}
+-
+-// collectFreeVars maps each identifier in the given range to whether it is "free."
+-// Given a range, a variable in that range is defined as "free" if it is declared
+-// outside of the range and neither at the file scope nor package scope. These free
+-// variables will be used as arguments in the extracted function. It also returns a
+-// list of identifiers that may need to be returned by the extracted function.
+-// Some of the code in this function has been adapted from tools/cmd/guru/freevars.go.
+-func collectFreeVars(info *types.Info, file *ast.File, fileScope, pkgScope *types.Scope, start, end token.Pos, node ast.Node) ([]*variable, error) {
+- // id returns non-nil if n denotes an object that is referenced by the span
+- // and defined either within the span or in the lexical environment. The bool
+- // return value acts as an indicator for where it was defined.
+- id := func(n *ast.Ident) (types.Object, bool) {
+- obj := info.Uses[n]
+- if obj == nil {
+- return info.Defs[n], false
+- }
+- if obj.Name() == "_" {
+- return nil, false // exclude objects denoting '_'
+- }
+- if _, ok := obj.(*types.PkgName); ok {
+- return nil, false // imported package
+- }
+- if !(file.Pos() <= obj.Pos() && obj.Pos() <= file.End()) {
+- return nil, false // not defined in this file
+- }
+- scope := obj.Parent()
+- if scope == nil {
+- return nil, false // e.g. interface method, struct field
+- }
+- if scope == fileScope || scope == pkgScope {
+- return nil, false // defined at file or package scope
+- }
+- if start <= obj.Pos() && obj.Pos() <= end {
+- return obj, false // defined within selection => not free
+- }
+- return obj, true
+- }
+- // sel returns non-nil if n denotes a selection o.x.y that is referenced by the
+- // span and defined either within the span or in the lexical environment. The bool
+- // return value acts as an indicator for where it was defined.
+- var sel func(n *ast.SelectorExpr) (types.Object, bool)
+- sel = func(n *ast.SelectorExpr) (types.Object, bool) {
+- switch x := astutil.Unparen(n.X).(type) {
+- case *ast.SelectorExpr:
+- return sel(x)
+- case *ast.Ident:
+- return id(x)
+- }
+- return nil, false
+- }
+- seen := make(map[types.Object]*variable)
+- firstUseIn := make(map[types.Object]token.Pos)
+- var vars []types.Object
+- ast.Inspect(node, func(n ast.Node) bool {
+- if n == nil {
+- return false
+- }
+- if start <= n.Pos() && n.End() <= end {
+- var obj types.Object
+- var isFree, prune bool
+- switch n := n.(type) {
+- case *ast.Ident:
+- obj, isFree = id(n)
+- case *ast.SelectorExpr:
+- obj, isFree = sel(n)
+- prune = true
+- }
+- if obj != nil {
+- seen[obj] = &variable{
+- obj: obj,
+- free: isFree,
+- }
+- vars = append(vars, obj)
+- // Find the first time that the object is used in the selection.
+- first, ok := firstUseIn[obj]
+- if !ok || n.Pos() < first {
+- firstUseIn[obj] = n.Pos()
+- }
+- if prune {
+- return false
+- }
+- }
+- }
+- return n.Pos() <= end
+- })
+-
+- // Find identifiers that are initialized or whose values are altered at some
+- // point in the selected block. For example, in a selected block from lines 2-4,
+- // variables x, y, and z are included in assigned. However, in a selected block
+- // from lines 3-4, only variables y and z are included in assigned.
+- //
+- // 1: var a int
+- // 2: var x int
+- // 3: y := 3
+- // 4: z := x + a
+- //
+- ast.Inspect(node, func(n ast.Node) bool {
+- if n == nil {
+- return false
+- }
+- if n.Pos() < start || n.End() > end {
+- return n.Pos() <= end
+- }
+- switch n := n.(type) {
+- case *ast.AssignStmt:
+- for _, assignment := range n.Lhs {
+- lhs, ok := assignment.(*ast.Ident)
+- if !ok {
+- continue
+- }
+- obj, _ := id(lhs)
+- if obj == nil {
+- continue
+- }
+- if _, ok := seen[obj]; !ok {
+- continue
+- }
+- seen[obj].assigned = true
+- if n.Tok != token.DEFINE {
+- continue
+- }
+- // Find identifiers that are defined prior to being used
+- // elsewhere in the selection.
+- // TODO: Include identifiers that are assigned prior to being
+- // used elsewhere in the selection. Then, change the assignment
+- // to a definition in the extracted function.
+- if firstUseIn[obj] != lhs.Pos() {
+- continue
+- }
+- // Ensure that the object is not used in its own re-definition.
+- // For example:
+- // var f float64
+- // f, e := math.Frexp(f)
+- for _, expr := range n.Rhs {
+- if referencesObj(info, expr, obj) {
+- continue
+- }
+- if _, ok := seen[obj]; !ok {
+- continue
+- }
+- seen[obj].defined = true
+- break
+- }
+- }
+- return false
+- case *ast.DeclStmt:
+- gen, ok := n.Decl.(*ast.GenDecl)
+- if !ok {
+- return false
+- }
+- for _, spec := range gen.Specs {
+- vSpecs, ok := spec.(*ast.ValueSpec)
+- if !ok {
+- continue
+- }
+- for _, vSpec := range vSpecs.Names {
+- obj, _ := id(vSpec)
+- if obj == nil {
+- continue
+- }
+- if _, ok := seen[obj]; !ok {
+- continue
+- }
+- seen[obj].assigned = true
+- }
+- }
+- return false
+- case *ast.IncDecStmt:
+- if ident, ok := n.X.(*ast.Ident); !ok {
+- return false
+- } else if obj, _ := id(ident); obj == nil {
+- return false
+- } else {
+- if _, ok := seen[obj]; !ok {
+- return false
+- }
+- seen[obj].assigned = true
+- }
+- }
+- return true
+- })
+- var variables []*variable
+- for _, obj := range vars {
+- v, ok := seen[obj]
+- if !ok {
+- return nil, fmt.Errorf("no seen types.Object for %v", obj)
+- }
+- variables = append(variables, v)
+- }
+- return variables, nil
+-}
+-
+-// referencesObj checks whether the given object appears in the given expression.
+-func referencesObj(info *types.Info, expr ast.Expr, obj types.Object) bool {
+- var hasObj bool
+- ast.Inspect(expr, func(n ast.Node) bool {
+- if n == nil {
+- return false
+- }
+- ident, ok := n.(*ast.Ident)
+- if !ok {
+- return true
+- }
+- objUse := info.Uses[ident]
+- if obj == objUse {
+- hasObj = true
+- return false
+- }
+- return false
+- })
+- return hasObj
+-}
+-
+-type fnExtractParams struct {
+- tok *token.File
+- start, end token.Pos
+- path []ast.Node
+- outer *ast.FuncDecl
+- node ast.Node
+-}
+-
+-// CanExtractFunction reports whether the code in the given range can be
+-// extracted to a function.
+-func CanExtractFunction(tok *token.File, start, end token.Pos, src []byte, file *ast.File) (*fnExtractParams, bool, bool, error) {
+- if start == end {
+- return nil, false, false, fmt.Errorf("start and end are equal")
+- }
+- var err error
+- start, end, err = adjustRangeForCommentsAndWhiteSpace(tok, start, end, src, file)
+- if err != nil {
+- return nil, false, false, err
+- }
+- path, _ := astutil.PathEnclosingInterval(file, start, end)
+- if len(path) == 0 {
+- return nil, false, false, fmt.Errorf("no path enclosing interval")
+- }
+- // Node that encloses the selection must be a statement.
+- // TODO: Support function extraction for an expression.
+- _, ok := path[0].(ast.Stmt)
+- if !ok {
+- return nil, false, false, fmt.Errorf("node is not a statement")
+- }
+-
+- // Find the function declaration that encloses the selection.
+- var outer *ast.FuncDecl
+- for _, p := range path {
+- if p, ok := p.(*ast.FuncDecl); ok {
+- outer = p
+- break
+- }
+- }
+- if outer == nil {
+- return nil, false, false, fmt.Errorf("no enclosing function")
+- }
+-
+- // Find the nodes at the start and end of the selection.
+- var startNode, endNode ast.Node
+- ast.Inspect(outer, func(n ast.Node) bool {
+- if n == nil {
+- return false
+- }
+- // Do not override 'start' with a node that begins at the same location
+- // but is nested further from 'outer'.
+- if startNode == nil && n.Pos() == start && n.End() <= end {
+- startNode = n
+- }
+- if endNode == nil && n.End() == end && n.Pos() >= start {
+- endNode = n
+- }
+- return n.Pos() <= end
+- })
+- if startNode == nil || endNode == nil {
+- return nil, false, false, fmt.Errorf("range does not map to AST nodes")
+- }
+- // If the region is a blockStmt, use the first and last nodes in the block
+- // statement.
+- // <rng.start>{ ... }<rng.end> => { <rng.start>...<rng.end> }
+- if blockStmt, ok := startNode.(*ast.BlockStmt); ok {
+- if len(blockStmt.List) == 0 {
+- return nil, false, false, fmt.Errorf("range maps to empty block statement")
+- }
+- startNode, endNode = blockStmt.List[0], blockStmt.List[len(blockStmt.List)-1]
+- start, end = startNode.Pos(), endNode.End()
+- }
+- return &fnExtractParams{
+- tok: tok,
+- start: start,
+- end: end,
+- path: path,
+- outer: outer,
+- node: startNode,
+- }, true, outer.Recv != nil, nil
+-}
+-
+-// objUsed checks if the object is used within the range. It returns the first
+-// occurrence of the object in the range, if it exists.
+-func objUsed(info *types.Info, start, end token.Pos, obj types.Object) (bool, *ast.Ident) {
+- var firstUse *ast.Ident
+- for id, objUse := range info.Uses {
+- if obj != objUse {
+- continue
+- }
+- if id.Pos() < start || id.End() > end {
+- continue
+- }
+- if firstUse == nil || id.Pos() < firstUse.Pos() {
+- firstUse = id
+- }
+- }
+- return firstUse != nil, firstUse
+-}
+-
+-// varOverridden traverses the given AST node until we find the given identifier. Then, we
+-// examine the occurrence of the given identifier and check for (1) whether the identifier
+-// is being redefined. If the identifier is free, we also check for (2) whether the identifier
+-// is being reassigned. We will not include an identifier in the return statement of the
+-// extracted function if it meets one of the above conditions.
+-func varOverridden(info *types.Info, firstUse *ast.Ident, obj types.Object, isFree bool, node ast.Node) bool {
+- var isOverriden bool
+- ast.Inspect(node, func(n ast.Node) bool {
+- if n == nil {
+- return false
+- }
+- assignment, ok := n.(*ast.AssignStmt)
+- if !ok {
+- return true
+- }
+- // A free variable is initialized prior to the selection. We can always reassign
+- // this variable after the selection because it has already been defined.
+- // Conversely, a non-free variable is initialized within the selection. Thus, we
+- // cannot reassign this variable after the selection unless it is initialized and
+- // returned by the extracted function.
+- if !isFree && assignment.Tok == token.ASSIGN {
+- return false
+- }
+- for _, assigned := range assignment.Lhs {
+- ident, ok := assigned.(*ast.Ident)
+- // Check if we found the first use of the identifier.
+- if !ok || ident != firstUse {
+- continue
+- }
+- objUse := info.Uses[ident]
+- if objUse == nil || objUse != obj {
+- continue
+- }
+- // Ensure that the object is not used in its own definition.
+- // For example:
+- // var f float64
+- // f, e := math.Frexp(f)
+- for _, expr := range assignment.Rhs {
+- if referencesObj(info, expr, obj) {
+- return false
+- }
+- }
+- isOverriden = true
+- return false
+- }
+- return false
+- })
+- return isOverriden
+-}
+-
+-// parseBlockStmt generates an AST file from the given text. We then return the portion of the
+-// file that represents the text.
+-func parseBlockStmt(fset *token.FileSet, src []byte) (*ast.BlockStmt, error) {
+- text := "package main\nfunc _() { " + string(src) + " }"
+- extract, err := parser.ParseFile(fset, "", text, 0)
+- if err != nil {
+- return nil, err
+- }
+- if len(extract.Decls) == 0 {
+- return nil, fmt.Errorf("parsed file does not contain any declarations")
+- }
+- decl, ok := extract.Decls[0].(*ast.FuncDecl)
+- if !ok {
+- return nil, fmt.Errorf("parsed file does not contain expected function declaration")
+- }
+- if decl.Body == nil {
+- return nil, fmt.Errorf("extracted function has no body")
+- }
+- return decl.Body, nil
+-}
+-
+-// generateReturnInfo generates the information we need to adjust the return statements and
+-// signature of the extracted function. We prepare names, signatures, and "zero values" that
+-// represent the new variables. We also use this information to construct the if statement that
+-// is inserted below the call to the extracted function.
+-func generateReturnInfo(enclosing *ast.FuncType, pkg *types.Package, path []ast.Node, file *ast.File, info *types.Info, fset *token.FileSet, pos token.Pos, hasNonNestedReturns bool) ([]*returnVariable, *ast.IfStmt, error) {
+- var retVars []*returnVariable
+- var cond *ast.Ident
+- if !hasNonNestedReturns {
+- // Generate information for the added bool value.
+- name, _ := generateAvailableIdentifier(pos, file, path, info, "shouldReturn", 0)
+- cond = &ast.Ident{Name: name}
+- retVars = append(retVars, &returnVariable{
+- name: cond,
+- decl: &ast.Field{Type: ast.NewIdent("bool")},
+- zeroVal: ast.NewIdent("false"),
+- })
+- }
+- // Generate information for the values in the return signature of the enclosing function.
+- if enclosing.Results != nil {
+- idx := 0
+- for _, field := range enclosing.Results.List {
+- typ := info.TypeOf(field.Type)
+- if typ == nil {
+- return nil, nil, fmt.Errorf(
+- "failed type conversion, AST expression: %T", field.Type)
+- }
+- expr := analysisinternal.TypeExpr(file, pkg, typ)
+- if expr == nil {
+- return nil, nil, fmt.Errorf("nil AST expression")
+- }
+- var name string
+- name, idx = generateAvailableIdentifier(pos, file,
+- path, info, "returnValue", idx)
+- retVars = append(retVars, &returnVariable{
+- name: ast.NewIdent(name),
+- decl: &ast.Field{Type: expr},
+- zeroVal: analysisinternal.ZeroValue(file, pkg, typ),
+- })
+- }
+- }
+- var ifReturn *ast.IfStmt
+- if !hasNonNestedReturns {
+- // Create the return statement for the enclosing function. We must exclude the variable
+- // for the condition of the if statement (cond) from the return statement.
+- ifReturn = &ast.IfStmt{
+- Cond: cond,
+- Body: &ast.BlockStmt{
+- List: []ast.Stmt{&ast.ReturnStmt{Results: getNames(retVars)[1:]}},
+- },
+- }
+- }
+- return retVars, ifReturn, nil
+-}
+-
+-// adjustReturnStatements adds "zero values" of the given types to each return statement
+-// in the given AST node.
+-func adjustReturnStatements(returnTypes []*ast.Field, seenVars map[types.Object]ast.Expr, fset *token.FileSet, file *ast.File, pkg *types.Package, extractedBlock *ast.BlockStmt) error {
+- var zeroVals []ast.Expr
+- // Create "zero values" for each type.
+- for _, returnType := range returnTypes {
+- var val ast.Expr
+- for obj, typ := range seenVars {
+- if typ != returnType.Type {
+- continue
+- }
+- val = analysisinternal.ZeroValue(file, pkg, obj.Type())
+- break
+- }
+- if val == nil {
+- return fmt.Errorf(
+- "could not find matching AST expression for %T", returnType.Type)
+- }
+- zeroVals = append(zeroVals, val)
+- }
+- // Add "zero values" to each return statement.
+- // The bool reports whether the enclosing function should return after calling the
+- // extracted function. We set the bool to 'true' because, if these return statements
+- // execute, the extracted function terminates early, and the enclosing function must
+- // return as well.
+- zeroVals = append(zeroVals, ast.NewIdent("true"))
+- ast.Inspect(extractedBlock, func(n ast.Node) bool {
+- if n == nil {
+- return false
+- }
+- if n, ok := n.(*ast.ReturnStmt); ok {
+- n.Results = append(zeroVals, n.Results...)
+- return false
+- }
+- return true
+- })
+- return nil
+-}
+-
+-// generateFuncCall constructs a call expression for the extracted function, described by the
+-// given parameters and return variables.
+-func generateFuncCall(hasNonNestedReturn, hasReturnVals bool, params, returns []ast.Expr, name string, token token.Token, selector string) ast.Node {
+- var replace ast.Node
+- callExpr := &ast.CallExpr{
+- Fun: ast.NewIdent(name),
+- Args: params,
+- }
+- if selector != "" {
+- callExpr = &ast.CallExpr{
+- Fun: &ast.SelectorExpr{
+- X: ast.NewIdent(selector),
+- Sel: ast.NewIdent(name),
+- },
+- Args: params,
+- }
+- }
+- if hasReturnVals {
+- if hasNonNestedReturn {
+- // Create a return statement that returns the result of the function call.
+- replace = &ast.ReturnStmt{
+- Return: 0,
+- Results: []ast.Expr{callExpr},
+- }
+- } else {
+- // Assign the result of the function call.
+- replace = &ast.AssignStmt{
+- Lhs: returns,
+- Tok: token,
+- Rhs: []ast.Expr{callExpr},
+- }
+- }
+- } else {
+- replace = callExpr
+- }
+- return replace
+-}
+-
+-// initializeVars creates variable declarations, if needed.
+-// Our preference is to replace the selected block with an "x, y, z := fn()" style
+-// assignment statement. We can use this style when all of the variables in the
+-// extracted function's return statement are either not defined prior to the extracted block
+-// or can be safely redefined. However, for example, if z is already defined
+-// in a different scope, we replace the selected block with:
+-//
+-// var x int
+-// var y string
+-// x, y, z = fn()
+-func initializeVars(uninitialized []types.Object, retVars []*returnVariable, seenUninitialized map[types.Object]struct{}, seenVars map[types.Object]ast.Expr) []ast.Stmt {
+- var declarations []ast.Stmt
+- for _, obj := range uninitialized {
+- if _, ok := seenUninitialized[obj]; ok {
+- continue
+- }
+- seenUninitialized[obj] = struct{}{}
+- valSpec := &ast.ValueSpec{
+- Names: []*ast.Ident{ast.NewIdent(obj.Name())},
+- Type: seenVars[obj],
+- }
+- genDecl := &ast.GenDecl{
+- Tok: token.VAR,
+- Specs: []ast.Spec{valSpec},
+- }
+- declarations = append(declarations, &ast.DeclStmt{Decl: genDecl})
+- }
+- // Each variable added from a return statement in the selection
+- // must be initialized.
+- for i, retVar := range retVars {
+- n := retVar.name.(*ast.Ident)
+- valSpec := &ast.ValueSpec{
+- Names: []*ast.Ident{n},
+- Type: retVars[i].decl.Type,
+- }
+- genDecl := &ast.GenDecl{
+- Tok: token.VAR,
+- Specs: []ast.Spec{valSpec},
+- }
+- declarations = append(declarations, &ast.DeclStmt{Decl: genDecl})
+- }
+- return declarations
+-}
+-
+-// getNames returns the names from the given list of returnVariable.
+-func getNames(retVars []*returnVariable) []ast.Expr {
+- var names []ast.Expr
+- for _, retVar := range retVars {
+- names = append(names, retVar.name)
+- }
+- return names
+-}
+-
+-// getZeroVals returns the "zero values" from the given list of returnVariable.
+-func getZeroVals(retVars []*returnVariable) []ast.Expr {
+- var zvs []ast.Expr
+- for _, retVar := range retVars {
+- zvs = append(zvs, retVar.zeroVal)
+- }
+- return zvs
+-}
+-
+-// getDecls returns the declarations from the given list of returnVariable.
+-func getDecls(retVars []*returnVariable) []*ast.Field {
+- var decls []*ast.Field
+- for _, retVar := range retVars {
+- decls = append(decls, retVar.decl)
+- }
+- return decls
+-}
+diff -urN a/gopls/internal/lsp/source/fix.go b/gopls/internal/lsp/source/fix.go
+--- a/gopls/internal/lsp/source/fix.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/fix.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,138 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/fillstruct"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/undeclaredname"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/bug"
+-)
+-
+-type (
+- // SuggestedFixFunc is a function used to get the suggested fixes for a given
+- // gopls command, some of which are provided by go/analysis.Analyzers. Some of
+- // the analyzers in internal/lsp/analysis are not efficient enough to include
+- // suggested fixes with their diagnostics, so we have to compute them
+- // separately. Such analyzers should provide a function with a signature of
+- // SuggestedFixFunc.
+- //
+- // The returned FileSet must map all token.Pos found in the suggested text
+- // edits.
+- SuggestedFixFunc func(ctx context.Context, snapshot Snapshot, fh FileHandle, pRng protocol.Range) (*token.FileSet, *analysis.SuggestedFix, error)
+- singleFileFixFunc func(fset *token.FileSet, start, end token.Pos, src []byte, file *ast.File, pkg *types.Package, info *types.Info) (*analysis.SuggestedFix, error)
+-)
+-
+-const (
+- FillStruct = "fill_struct"
+- StubMethods = "stub_methods"
+- UndeclaredName = "undeclared_name"
+- ExtractVariable = "extract_variable"
+- ExtractFunction = "extract_function"
+- ExtractMethod = "extract_method"
+-)
+-
+-// suggestedFixes maps a suggested fix command id to its handler.
+-var suggestedFixes = map[string]SuggestedFixFunc{
+- FillStruct: singleFile(fillstruct.SuggestedFix),
+- UndeclaredName: singleFile(undeclaredname.SuggestedFix),
+- ExtractVariable: singleFile(extractVariable),
+- ExtractFunction: singleFile(extractFunction),
+- ExtractMethod: singleFile(extractMethod),
+- StubMethods: stubSuggestedFixFunc,
+-}
+-
+-// singleFile calls analyzers that expect inputs for a single file
+-func singleFile(sf singleFileFixFunc) SuggestedFixFunc {
+- return func(ctx context.Context, snapshot Snapshot, fh FileHandle, pRng protocol.Range) (*token.FileSet, *analysis.SuggestedFix, error) {
+- pkg, pgf, err := PackageForFile(ctx, snapshot, fh.URI(), NarrowestPackage)
+- if err != nil {
+- return nil, nil, err
+- }
+- start, end, err := pgf.RangePos(pRng)
+- if err != nil {
+- return nil, nil, err
+- }
+- fix, err := sf(pkg.FileSet(), start, end, pgf.Src, pgf.File, pkg.GetTypes(), pkg.GetTypesInfo())
+- return pkg.FileSet(), fix, err
+- }
+-}
+-
+-func SuggestedFixFromCommand(cmd protocol.Command, kind protocol.CodeActionKind) SuggestedFix {
+- return SuggestedFix{
+- Title: cmd.Title,
+- Command: &cmd,
+- ActionKind: kind,
+- }
+-}
+-
+-// ApplyFix applies the command's suggested fix to the given file and
+-// range, returning the resulting edits.
+-func ApplyFix(ctx context.Context, fix string, snapshot Snapshot, fh FileHandle, pRng protocol.Range) ([]protocol.TextDocumentEdit, error) {
+- handler, ok := suggestedFixes[fix]
+- if !ok {
+- return nil, fmt.Errorf("no suggested fix function for %s", fix)
+- }
+- fset, suggestion, err := handler(ctx, snapshot, fh, pRng)
+- if err != nil {
+- return nil, err
+- }
+- if suggestion == nil {
+- return nil, nil
+- }
+- editsPerFile := map[span.URI]*protocol.TextDocumentEdit{}
+- for _, edit := range suggestion.TextEdits {
+- tokFile := fset.File(edit.Pos)
+- if tokFile == nil {
+- return nil, bug.Errorf("no file for edit position")
+- }
+- end := edit.End
+- if !end.IsValid() {
+- end = edit.Pos
+- }
+- fh, err := snapshot.GetFile(ctx, span.URIFromPath(tokFile.Name()))
+- if err != nil {
+- return nil, err
+- }
+- te, ok := editsPerFile[fh.URI()]
+- if !ok {
+- te = &protocol.TextDocumentEdit{
+- TextDocument: protocol.OptionalVersionedTextDocumentIdentifier{
+- Version: fh.Version(),
+- TextDocumentIdentifier: protocol.TextDocumentIdentifier{
+- URI: protocol.URIFromSpanURI(fh.URI()),
+- },
+- },
+- }
+- editsPerFile[fh.URI()] = te
+- }
+- content, err := fh.Read()
+- if err != nil {
+- return nil, err
+- }
+- m := protocol.NewMapper(fh.URI(), content)
+- rng, err := m.PosRange(tokFile, edit.Pos, end)
+- if err != nil {
+- return nil, err
+- }
+- te.Edits = append(te.Edits, protocol.TextEdit{
+- Range: rng,
+- NewText: string(edit.NewText),
+- })
+- }
+- var edits []protocol.TextDocumentEdit
+- for _, edit := range editsPerFile {
+- edits = append(edits, *edit)
+- }
+- return edits, nil
+-}
+diff -urN a/gopls/internal/lsp/source/folding_range.go b/gopls/internal/lsp/source/folding_range.go
+--- a/gopls/internal/lsp/source/folding_range.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/folding_range.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,193 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "go/ast"
+- "go/token"
+- "sort"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/bug"
+-)
+-
+-// FoldingRangeInfo holds range and kind info of folding for an ast.Node
+-type FoldingRangeInfo struct {
+- MappedRange protocol.MappedRange
+- Kind protocol.FoldingRangeKind
+-}
+-
+-// FoldingRange gets all of the folding range for f.
+-func FoldingRange(ctx context.Context, snapshot Snapshot, fh FileHandle, lineFoldingOnly bool) (ranges []*FoldingRangeInfo, err error) {
+- // TODO(suzmue): consider limiting the number of folding ranges returned, and
+- // implement a way to prioritize folding ranges in that case.
+- pgf, err := snapshot.ParseGo(ctx, fh, ParseFull)
+- if err != nil {
+- return nil, err
+- }
+-
+- // With parse errors, we wouldn't be able to produce accurate folding info.
+- // LSP protocol (3.16) currently does not have a way to handle this case
+- // (https://github.com/microsoft/language-server-protocol/issues/1200).
+- // We cannot return an error either because we are afraid some editors
+- // may not handle errors nicely. As a workaround, we now return an empty
+- // result and let the client handle this case by double check the file
+- // contents (i.e. if the file is not empty and the folding range result
+- // is empty, raise an internal error).
+- if pgf.ParseErr != nil {
+- return nil, nil
+- }
+-
+- // Get folding ranges for comments separately as they are not walked by ast.Inspect.
+- ranges = append(ranges, commentsFoldingRange(pgf)...)
+-
+- visit := func(n ast.Node) bool {
+- rng := foldingRangeFunc(pgf, n, lineFoldingOnly)
+- if rng != nil {
+- ranges = append(ranges, rng)
+- }
+- return true
+- }
+- // Walk the ast and collect folding ranges.
+- ast.Inspect(pgf.File, visit)
+-
+- sort.Slice(ranges, func(i, j int) bool {
+- irng := ranges[i].MappedRange.Range()
+- jrng := ranges[j].MappedRange.Range()
+- return protocol.CompareRange(irng, jrng) < 0
+- })
+-
+- return ranges, nil
+-}
+-
+-// foldingRangeFunc calculates the line folding range for ast.Node n
+-func foldingRangeFunc(pgf *ParsedGoFile, n ast.Node, lineFoldingOnly bool) *FoldingRangeInfo {
+- // TODO(suzmue): include trailing empty lines before the closing
+- // parenthesis/brace.
+- var kind protocol.FoldingRangeKind
+- var start, end token.Pos
+- switch n := n.(type) {
+- case *ast.BlockStmt:
+- // Fold between positions of or lines between "{" and "}".
+- var startList, endList token.Pos
+- if num := len(n.List); num != 0 {
+- startList, endList = n.List[0].Pos(), n.List[num-1].End()
+- }
+- start, end = validLineFoldingRange(pgf.Tok, n.Lbrace, n.Rbrace, startList, endList, lineFoldingOnly)
+- case *ast.CaseClause:
+- // Fold from position of ":" to end.
+- start, end = n.Colon+1, n.End()
+- case *ast.CommClause:
+- // Fold from position of ":" to end.
+- start, end = n.Colon+1, n.End()
+- case *ast.CallExpr:
+- // Fold from position of "(" to position of ")".
+- start, end = n.Lparen+1, n.Rparen
+- case *ast.FieldList:
+- // Fold between positions of or lines between opening parenthesis/brace and closing parenthesis/brace.
+- var startList, endList token.Pos
+- if num := len(n.List); num != 0 {
+- startList, endList = n.List[0].Pos(), n.List[num-1].End()
+- }
+- start, end = validLineFoldingRange(pgf.Tok, n.Opening, n.Closing, startList, endList, lineFoldingOnly)
+- case *ast.GenDecl:
+- // If this is an import declaration, set the kind to be protocol.Imports.
+- if n.Tok == token.IMPORT {
+- kind = protocol.Imports
+- }
+- // Fold between positions of or lines between "(" and ")".
+- var startSpecs, endSpecs token.Pos
+- if num := len(n.Specs); num != 0 {
+- startSpecs, endSpecs = n.Specs[0].Pos(), n.Specs[num-1].End()
+- }
+- start, end = validLineFoldingRange(pgf.Tok, n.Lparen, n.Rparen, startSpecs, endSpecs, lineFoldingOnly)
+- case *ast.BasicLit:
+- // Fold raw string literals from position of "`" to position of "`".
+- if n.Kind == token.STRING && len(n.Value) >= 2 && n.Value[0] == '`' && n.Value[len(n.Value)-1] == '`' {
+- start, end = n.Pos(), n.End()
+- }
+- case *ast.CompositeLit:
+- // Fold between positions of or lines between "{" and "}".
+- var startElts, endElts token.Pos
+- if num := len(n.Elts); num != 0 {
+- startElts, endElts = n.Elts[0].Pos(), n.Elts[num-1].End()
+- }
+- start, end = validLineFoldingRange(pgf.Tok, n.Lbrace, n.Rbrace, startElts, endElts, lineFoldingOnly)
+- }
+-
+- // Check that folding positions are valid.
+- if !start.IsValid() || !end.IsValid() {
+- return nil
+- }
+- // in line folding mode, do not fold if the start and end lines are the same.
+- if lineFoldingOnly && pgf.Tok.Line(start) == pgf.Tok.Line(end) {
+- return nil
+- }
+- mrng, err := pgf.PosMappedRange(start, end)
+- if err != nil {
+- bug.Errorf("%w", err) // can't happen
+- }
+- return &FoldingRangeInfo{
+- MappedRange: mrng,
+- Kind: kind,
+- }
+-}
+-
+-// validLineFoldingRange returns start and end token.Pos for folding range if the range is valid.
+-// returns token.NoPos otherwise, which fails token.IsValid check
+-func validLineFoldingRange(tokFile *token.File, open, close, start, end token.Pos, lineFoldingOnly bool) (token.Pos, token.Pos) {
+- if lineFoldingOnly {
+- if !open.IsValid() || !close.IsValid() {
+- return token.NoPos, token.NoPos
+- }
+-
+- // Don't want to fold if the start/end is on the same line as the open/close
+- // as an example, the example below should *not* fold:
+- // var x = [2]string{"d",
+- // "e" }
+- if tokFile.Line(open) == tokFile.Line(start) ||
+- tokFile.Line(close) == tokFile.Line(end) {
+- return token.NoPos, token.NoPos
+- }
+-
+- return open + 1, end
+- }
+- return open + 1, close
+-}
+-
+-// commentsFoldingRange returns the folding ranges for all comment blocks in file.
+-// The folding range starts at the end of the first line of the comment block, and ends at the end of the
+-// comment block and has kind protocol.Comment.
+-func commentsFoldingRange(pgf *ParsedGoFile) (comments []*FoldingRangeInfo) {
+- tokFile := pgf.Tok
+- for _, commentGrp := range pgf.File.Comments {
+- startGrpLine, endGrpLine := tokFile.Line(commentGrp.Pos()), tokFile.Line(commentGrp.End())
+- if startGrpLine == endGrpLine {
+- // Don't fold single line comments.
+- continue
+- }
+-
+- firstComment := commentGrp.List[0]
+- startPos, endLinePos := firstComment.Pos(), firstComment.End()
+- startCmmntLine, endCmmntLine := tokFile.Line(startPos), tokFile.Line(endLinePos)
+- if startCmmntLine != endCmmntLine {
+- // If the first comment spans multiple lines, then we want to have the
+- // folding range start at the end of the first line.
+- endLinePos = token.Pos(int(startPos) + len(strings.Split(firstComment.Text, "\n")[0]))
+- }
+- mrng, err := pgf.PosMappedRange(endLinePos, commentGrp.End())
+- if err != nil {
+- bug.Errorf("%w", err) // can't happen
+- }
+- comments = append(comments, &FoldingRangeInfo{
+- // Fold from the end of the first line comment to the end of the comment block.
+- MappedRange: mrng,
+- Kind: protocol.Comment,
+- })
+- }
+- return comments
+-}
+diff -urN a/gopls/internal/lsp/source/format.go b/gopls/internal/lsp/source/format.go
+--- a/gopls/internal/lsp/source/format.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/format.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,391 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package source provides core features for use by Go editors and tools.
+-package source
+-
+-import (
+- "bytes"
+- "context"
+- "fmt"
+- "go/ast"
+- "go/format"
+- "go/parser"
+- "go/token"
+- "strings"
+- "text/scanner"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/internal/diff"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/imports"
+-)
+-
+-// Format formats a file with a given range.
+-func Format(ctx context.Context, snapshot Snapshot, fh FileHandle) ([]protocol.TextEdit, error) {
+- ctx, done := event.Start(ctx, "source.Format")
+- defer done()
+-
+- // Generated files shouldn't be edited. So, don't format them
+- if IsGenerated(ctx, snapshot, fh.URI()) {
+- return nil, fmt.Errorf("can't format %q: file is generated", fh.URI().Filename())
+- }
+-
+- pgf, err := snapshot.ParseGo(ctx, fh, ParseFull)
+- if err != nil {
+- return nil, err
+- }
+- // Even if this file has parse errors, it might still be possible to format it.
+- // Using format.Node on an AST with errors may result in code being modified.
+- // Attempt to format the source of this file instead.
+- if pgf.ParseErr != nil {
+- formatted, err := formatSource(ctx, fh)
+- if err != nil {
+- return nil, err
+- }
+- return computeTextEdits(ctx, snapshot, pgf, string(formatted))
+- }
+-
+- // format.Node changes slightly from one release to another, so the version
+- // of Go used to build the LSP server will determine how it formats code.
+- // This should be acceptable for all users, who likely be prompted to rebuild
+- // the LSP server on each Go release.
+- buf := &bytes.Buffer{}
+- fset := FileSetFor(pgf.Tok)
+- if err := format.Node(buf, fset, pgf.File); err != nil {
+- return nil, err
+- }
+- formatted := buf.String()
+-
+- // Apply additional formatting, if any is supported. Currently, the only
+- // supported additional formatter is gofumpt.
+- if format := snapshot.View().Options().GofumptFormat; snapshot.View().Options().Gofumpt && format != nil {
+- // gofumpt can customize formatting based on language version and module
+- // path, if available.
+- //
+- // Try to derive this information, but fall-back on the default behavior.
+- //
+- // TODO: under which circumstances can we fail to find module information?
+- // Can this, for example, result in inconsistent formatting across saves,
+- // due to pending calls to packages.Load?
+- var langVersion, modulePath string
+- mds, err := snapshot.MetadataForFile(ctx, fh.URI())
+- if err == nil && len(mds) > 0 {
+- if mi := mds[0].Module; mi != nil {
+- langVersion = mi.GoVersion
+- modulePath = mi.Path
+- }
+- }
+- b, err := format(ctx, langVersion, modulePath, buf.Bytes())
+- if err != nil {
+- return nil, err
+- }
+- formatted = string(b)
+- }
+- return computeTextEdits(ctx, snapshot, pgf, formatted)
+-}
+-
+-func formatSource(ctx context.Context, fh FileHandle) ([]byte, error) {
+- _, done := event.Start(ctx, "source.formatSource")
+- defer done()
+-
+- data, err := fh.Read()
+- if err != nil {
+- return nil, err
+- }
+- return format.Source(data)
+-}
+-
+-type ImportFix struct {
+- Fix *imports.ImportFix
+- Edits []protocol.TextEdit
+-}
+-
+-// AllImportsFixes formats f for each possible fix to the imports.
+-// In addition to returning the result of applying all edits,
+-// it returns a list of fixes that could be applied to the file, with the
+-// corresponding TextEdits that would be needed to apply that fix.
+-func AllImportsFixes(ctx context.Context, snapshot Snapshot, fh FileHandle) (allFixEdits []protocol.TextEdit, editsPerFix []*ImportFix, err error) {
+- ctx, done := event.Start(ctx, "source.AllImportsFixes")
+- defer done()
+-
+- pgf, err := snapshot.ParseGo(ctx, fh, ParseFull)
+- if err != nil {
+- return nil, nil, err
+- }
+- if err := snapshot.RunProcessEnvFunc(ctx, func(opts *imports.Options) error {
+- allFixEdits, editsPerFix, err = computeImportEdits(snapshot, pgf, opts)
+- return err
+- }); err != nil {
+- return nil, nil, fmt.Errorf("AllImportsFixes: %v", err)
+- }
+- return allFixEdits, editsPerFix, nil
+-}
+-
+-// computeImportEdits computes a set of edits that perform one or all of the
+-// necessary import fixes.
+-func computeImportEdits(snapshot Snapshot, pgf *ParsedGoFile, options *imports.Options) (allFixEdits []protocol.TextEdit, editsPerFix []*ImportFix, err error) {
+- filename := pgf.URI.Filename()
+-
+- // Build up basic information about the original file.
+- allFixes, err := imports.FixImports(filename, pgf.Src, options)
+- if err != nil {
+- return nil, nil, err
+- }
+-
+- allFixEdits, err = computeFixEdits(snapshot, pgf, options, allFixes)
+- if err != nil {
+- return nil, nil, err
+- }
+-
+- // Apply all of the import fixes to the file.
+- // Add the edits for each fix to the result.
+- for _, fix := range allFixes {
+- edits, err := computeFixEdits(snapshot, pgf, options, []*imports.ImportFix{fix})
+- if err != nil {
+- return nil, nil, err
+- }
+- editsPerFix = append(editsPerFix, &ImportFix{
+- Fix: fix,
+- Edits: edits,
+- })
+- }
+- return allFixEdits, editsPerFix, nil
+-}
+-
+-// ComputeOneImportFixEdits returns text edits for a single import fix.
+-func ComputeOneImportFixEdits(snapshot Snapshot, pgf *ParsedGoFile, fix *imports.ImportFix) ([]protocol.TextEdit, error) {
+- options := &imports.Options{
+- LocalPrefix: snapshot.View().Options().Local,
+- // Defaults.
+- AllErrors: true,
+- Comments: true,
+- Fragment: true,
+- FormatOnly: false,
+- TabIndent: true,
+- TabWidth: 8,
+- }
+- return computeFixEdits(snapshot, pgf, options, []*imports.ImportFix{fix})
+-}
+-
+-func computeFixEdits(snapshot Snapshot, pgf *ParsedGoFile, options *imports.Options, fixes []*imports.ImportFix) ([]protocol.TextEdit, error) {
+- // trim the original data to match fixedData
+- left, err := importPrefix(pgf.Src)
+- if err != nil {
+- return nil, err
+- }
+- extra := !strings.Contains(left, "\n") // one line may have more than imports
+- if extra {
+- left = string(pgf.Src)
+- }
+- if len(left) > 0 && left[len(left)-1] != '\n' {
+- left += "\n"
+- }
+- // Apply the fixes and re-parse the file so that we can locate the
+- // new imports.
+- flags := parser.ImportsOnly
+- if extra {
+- // used all of origData above, use all of it here too
+- flags = 0
+- }
+- fixedData, err := imports.ApplyFixes(fixes, "", pgf.Src, options, flags)
+- if err != nil {
+- return nil, err
+- }
+- if fixedData == nil || fixedData[len(fixedData)-1] != '\n' {
+- fixedData = append(fixedData, '\n') // ApplyFixes may miss the newline, go figure.
+- }
+- edits := snapshot.View().Options().ComputeEdits(left, string(fixedData))
+- return protocolEditsFromSource([]byte(left), edits)
+-}
+-
+-// importPrefix returns the prefix of the given file content through the final
+-// import statement. If there are no imports, the prefix is the package
+-// statement and any comment groups below it.
+-func importPrefix(src []byte) (string, error) {
+- fset := token.NewFileSet()
+- // do as little parsing as possible
+- f, err := parser.ParseFile(fset, "", src, parser.ImportsOnly|parser.ParseComments)
+- if err != nil { // This can happen if 'package' is misspelled
+- return "", fmt.Errorf("importPrefix: failed to parse: %s", err)
+- }
+- tok := fset.File(f.Pos())
+- var importEnd int
+- for _, d := range f.Decls {
+- if x, ok := d.(*ast.GenDecl); ok && x.Tok == token.IMPORT {
+- if e, err := safetoken.Offset(tok, d.End()); err != nil {
+- return "", fmt.Errorf("importPrefix: %s", err)
+- } else if e > importEnd {
+- importEnd = e
+- }
+- }
+- }
+-
+- maybeAdjustToLineEnd := func(pos token.Pos, isCommentNode bool) int {
+- offset, err := safetoken.Offset(tok, pos)
+- if err != nil {
+- return -1
+- }
+-
+- // Don't go past the end of the file.
+- if offset > len(src) {
+- offset = len(src)
+- }
+- // The go/ast package does not account for different line endings, and
+- // specifically, in the text of a comment, it will strip out \r\n line
+- // endings in favor of \n. To account for these differences, we try to
+- // return a position on the next line whenever possible.
+- switch line := tok.Line(tok.Pos(offset)); {
+- case line < tok.LineCount():
+- nextLineOffset, err := safetoken.Offset(tok, tok.LineStart(line+1))
+- if err != nil {
+- return -1
+- }
+- // If we found a position that is at the end of a line, move the
+- // offset to the start of the next line.
+- if offset+1 == nextLineOffset {
+- offset = nextLineOffset
+- }
+- case isCommentNode, offset+1 == tok.Size():
+- // If the last line of the file is a comment, or we are at the end
+- // of the file, the prefix is the entire file.
+- offset = len(src)
+- }
+- return offset
+- }
+- if importEnd == 0 {
+- pkgEnd := f.Name.End()
+- importEnd = maybeAdjustToLineEnd(pkgEnd, false)
+- }
+- for _, cgroup := range f.Comments {
+- for _, c := range cgroup.List {
+- if end, err := safetoken.Offset(tok, c.End()); err != nil {
+- return "", err
+- } else if end > importEnd {
+- startLine := safetoken.Position(tok, c.Pos()).Line
+- endLine := safetoken.Position(tok, c.End()).Line
+-
+- // Work around golang/go#41197 by checking if the comment might
+- // contain "\r", and if so, find the actual end position of the
+- // comment by scanning the content of the file.
+- startOffset, err := safetoken.Offset(tok, c.Pos())
+- if err != nil {
+- return "", err
+- }
+- if startLine != endLine && bytes.Contains(src[startOffset:], []byte("\r")) {
+- if commentEnd := scanForCommentEnd(src[startOffset:]); commentEnd > 0 {
+- end = startOffset + commentEnd
+- }
+- }
+- importEnd = maybeAdjustToLineEnd(tok.Pos(end), true)
+- }
+- }
+- }
+- if importEnd > len(src) {
+- importEnd = len(src)
+- }
+- return string(src[:importEnd]), nil
+-}
+-
+-// scanForCommentEnd returns the offset of the end of the multi-line comment
+-// at the start of the given byte slice.
+-func scanForCommentEnd(src []byte) int {
+- var s scanner.Scanner
+- s.Init(bytes.NewReader(src))
+- s.Mode ^= scanner.SkipComments
+-
+- t := s.Scan()
+- if t == scanner.Comment {
+- return s.Pos().Offset
+- }
+- return 0
+-}
+-
+-func computeTextEdits(ctx context.Context, snapshot Snapshot, pgf *ParsedGoFile, formatted string) ([]protocol.TextEdit, error) {
+- _, done := event.Start(ctx, "source.computeTextEdits")
+- defer done()
+-
+- edits := snapshot.View().Options().ComputeEdits(string(pgf.Src), formatted)
+- return ToProtocolEdits(pgf.Mapper, edits)
+-}
+-
+-// protocolEditsFromSource converts text edits to LSP edits using the original
+-// source.
+-func protocolEditsFromSource(src []byte, edits []diff.Edit) ([]protocol.TextEdit, error) {
+- m := protocol.NewMapper("", src)
+- var result []protocol.TextEdit
+- for _, edit := range edits {
+- rng, err := m.OffsetRange(edit.Start, edit.End)
+- if err != nil {
+- return nil, err
+- }
+-
+- if rng.Start == rng.End && edit.New == "" {
+- // Degenerate case, which may result from a diff tool wanting to delete
+- // '\r' in line endings. Filter it out.
+- continue
+- }
+- result = append(result, protocol.TextEdit{
+- Range: rng,
+- NewText: edit.New,
+- })
+- }
+- return result, nil
+-}
+-
+-// ToProtocolEdits converts diff.Edits to LSP TextEdits.
+-// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textEditArray
+-func ToProtocolEdits(m *protocol.Mapper, edits []diff.Edit) ([]protocol.TextEdit, error) {
+- // LSP doesn't require TextEditArray to be sorted:
+- // this is the receiver's concern. But govim, and perhaps
+- // other clients have historically relied on the order.
+- edits = append([]diff.Edit(nil), edits...)
+- diff.SortEdits(edits)
+-
+- result := make([]protocol.TextEdit, len(edits))
+- for i, edit := range edits {
+- rng, err := m.OffsetRange(edit.Start, edit.End)
+- if err != nil {
+- return nil, err
+- }
+- result[i] = protocol.TextEdit{
+- Range: rng,
+- NewText: edit.New,
+- }
+- }
+- return result, nil
+-}
+-
+-// FromProtocolEdits converts LSP TextEdits to diff.Edits.
+-// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textEditArray
+-func FromProtocolEdits(m *protocol.Mapper, edits []protocol.TextEdit) ([]diff.Edit, error) {
+- if edits == nil {
+- return nil, nil
+- }
+- result := make([]diff.Edit, len(edits))
+- for i, edit := range edits {
+- start, end, err := m.RangeOffsets(edit.Range)
+- if err != nil {
+- return nil, err
+- }
+- result[i] = diff.Edit{
+- Start: start,
+- End: end,
+- New: edit.NewText,
+- }
+- }
+- return result, nil
+-}
+-
+-// ApplyProtocolEdits applies the patch (edits) to m.Content and returns the result.
+-// It also returns the edits converted to diff-package form.
+-func ApplyProtocolEdits(m *protocol.Mapper, edits []protocol.TextEdit) ([]byte, []diff.Edit, error) {
+- diffEdits, err := FromProtocolEdits(m, edits)
+- if err != nil {
+- return nil, nil, err
+- }
+- out, err := diff.ApplyBytes(m.Content, diffEdits)
+- return out, diffEdits, err
+-}
+diff -urN a/gopls/internal/lsp/source/format_test.go b/gopls/internal/lsp/source/format_test.go
+--- a/gopls/internal/lsp/source/format_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/format_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,75 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "strings"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+-)
+-
+-func TestImportPrefix(t *testing.T) {
+- for i, tt := range []struct {
+- input, want string
+- }{
+- {"package foo", "package foo"},
+- {"package foo\n", "package foo\n"},
+- {"package foo\n\nfunc f(){}\n", "package foo\n"},
+- {"package foo\n\nimport \"fmt\"\n", "package foo\n\nimport \"fmt\""},
+- {"package foo\nimport (\n\"fmt\"\n)\n", "package foo\nimport (\n\"fmt\"\n)"},
+- {"\n\n\npackage foo\n", "\n\n\npackage foo\n"},
+- {"// hi \n\npackage foo //xx\nfunc _(){}\n", "// hi \n\npackage foo //xx\n"},
+- {"package foo //hi\n", "package foo //hi\n"},
+- {"//hi\npackage foo\n//a\n\n//b\n", "//hi\npackage foo\n//a\n\n//b\n"},
+- {
+- "package a\n\nimport (\n \"fmt\"\n)\n//hi\n",
+- "package a\n\nimport (\n \"fmt\"\n)\n//hi\n",
+- },
+- {`package a /*hi*/`, `package a /*hi*/`},
+- {"package main\r\n\r\nimport \"go/types\"\r\n\r\n/*\r\n\r\n */\r\n", "package main\r\n\r\nimport \"go/types\"\r\n\r\n/*\r\n\r\n */\r\n"},
+- {"package x; import \"os\"; func f() {}\n\n", "package x; import \"os\""},
+- {"package x; func f() {fmt.Println()}\n\n", "package x"},
+- } {
+- got, err := importPrefix([]byte(tt.input))
+- if err != nil {
+- t.Fatal(err)
+- }
+- if d := compare.Text(tt.want, got); d != "" {
+- t.Errorf("%d: failed for %q:\n%s", i, tt.input, d)
+- }
+- }
+-}
+-
+-func TestCRLFFile(t *testing.T) {
+- for i, tt := range []struct {
+- input, want string
+- }{
+- {
+- input: `package main
+-
+-/*
+-Hi description
+-*/
+-func Hi() {
+-}
+-`,
+- want: `package main
+-
+-/*
+-Hi description
+-*/`,
+- },
+- } {
+- got, err := importPrefix([]byte(strings.ReplaceAll(tt.input, "\n", "\r\n")))
+- if err != nil {
+- t.Fatal(err)
+- }
+- want := strings.ReplaceAll(tt.want, "\n", "\r\n")
+- if d := compare.Text(want, got); d != "" {
+- t.Errorf("%d: failed for %q:\n%s", i, tt.input, d)
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/source/gc_annotations.go b/gopls/internal/lsp/source/gc_annotations.go
+--- a/gopls/internal/lsp/source/gc_annotations.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/gc_annotations.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,221 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "bytes"
+- "context"
+- "encoding/json"
+- "fmt"
+- "io/ioutil"
+- "os"
+- "path/filepath"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/gocommand"
+-)
+-
+-type Annotation string
+-
+-const (
+- // Nil controls nil checks.
+- Nil Annotation = "nil"
+-
+- // Escape controls diagnostics about escape choices.
+- Escape Annotation = "escape"
+-
+- // Inline controls diagnostics about inlining choices.
+- Inline Annotation = "inline"
+-
+- // Bounds controls bounds checking diagnostics.
+- Bounds Annotation = "bounds"
+-)
+-
+-func GCOptimizationDetails(ctx context.Context, snapshot Snapshot, m *Metadata) (map[span.URI][]*Diagnostic, error) {
+- if len(m.CompiledGoFiles) == 0 {
+- return nil, nil
+- }
+- pkgDir := filepath.Dir(m.CompiledGoFiles[0].Filename())
+- outDir := filepath.Join(os.TempDir(), fmt.Sprintf("gopls-%d.details", os.Getpid()))
+-
+- if err := os.MkdirAll(outDir, 0700); err != nil {
+- return nil, err
+- }
+- tmpFile, err := ioutil.TempFile(os.TempDir(), "gopls-x")
+- if err != nil {
+- return nil, err
+- }
+- defer os.Remove(tmpFile.Name())
+-
+- outDirURI := span.URIFromPath(outDir)
+- // GC details doesn't handle Windows URIs in the form of "file:///C:/...",
+- // so rewrite them to "file://C:/...". See golang/go#41614.
+- if !strings.HasPrefix(outDir, "/") {
+- outDirURI = span.URI(strings.Replace(string(outDirURI), "file:///", "file://", 1))
+- }
+- inv := &gocommand.Invocation{
+- Verb: "build",
+- Args: []string{
+- fmt.Sprintf("-gcflags=-json=0,%s", outDirURI),
+- fmt.Sprintf("-o=%s", tmpFile.Name()),
+- ".",
+- },
+- WorkingDir: pkgDir,
+- }
+- _, err = snapshot.RunGoCommandDirect(ctx, Normal, inv)
+- if err != nil {
+- return nil, err
+- }
+- files, err := findJSONFiles(outDir)
+- if err != nil {
+- return nil, err
+- }
+- reports := make(map[span.URI][]*Diagnostic)
+- opts := snapshot.View().Options()
+- var parseError error
+- for _, fn := range files {
+- uri, diagnostics, err := parseDetailsFile(fn, opts)
+- if err != nil {
+- // expect errors for all the files, save 1
+- parseError = err
+- }
+- fh := snapshot.FindFile(uri)
+- if fh == nil {
+- continue
+- }
+- if pkgDir != filepath.Dir(fh.URI().Filename()) {
+- // https://github.com/golang/go/issues/42198
+- // sometimes the detail diagnostics generated for files
+- // outside the package can never be taken back.
+- continue
+- }
+- reports[fh.URI()] = diagnostics
+- }
+- return reports, parseError
+-}
+-
+-func parseDetailsFile(filename string, options *Options) (span.URI, []*Diagnostic, error) {
+- buf, err := ioutil.ReadFile(filename)
+- if err != nil {
+- return "", nil, err
+- }
+- var (
+- uri span.URI
+- i int
+- diagnostics []*Diagnostic
+- )
+- type metadata struct {
+- File string `json:"file,omitempty"`
+- }
+- for dec := json.NewDecoder(bytes.NewReader(buf)); dec.More(); {
+- // The first element always contains metadata.
+- if i == 0 {
+- i++
+- m := new(metadata)
+- if err := dec.Decode(m); err != nil {
+- return "", nil, err
+- }
+- if !strings.HasSuffix(m.File, ".go") {
+- continue // <autogenerated>
+- }
+- uri = span.URIFromPath(m.File)
+- continue
+- }
+- d := new(protocol.Diagnostic)
+- if err := dec.Decode(d); err != nil {
+- return "", nil, err
+- }
+- msg := d.Code.(string)
+- if msg != "" {
+- msg = fmt.Sprintf("%s(%s)", msg, d.Message)
+- }
+- if !showDiagnostic(msg, d.Source, options) {
+- continue
+- }
+- var related []protocol.DiagnosticRelatedInformation
+- for _, ri := range d.RelatedInformation {
+- // TODO(rfindley): The compiler uses LSP-like JSON to encode gc details,
+- // however the positions it uses are 1-based UTF-8:
+- // https://github.com/golang/go/blob/master/src/cmd/compile/internal/logopt/log_opts.go
+- //
+- // Here, we adjust for 0-based positions, but do not translate UTF-8 to UTF-16.
+- related = append(related, protocol.DiagnosticRelatedInformation{
+- Location: protocol.Location{
+- URI: ri.Location.URI,
+- Range: zeroIndexedRange(ri.Location.Range),
+- },
+- Message: ri.Message,
+- })
+- }
+- diagnostic := &Diagnostic{
+- URI: uri,
+- Range: zeroIndexedRange(d.Range),
+- Message: msg,
+- Severity: d.Severity,
+- Source: OptimizationDetailsError, // d.Source is always "go compiler" as of 1.16, use our own
+- Tags: d.Tags,
+- Related: related,
+- }
+- diagnostics = append(diagnostics, diagnostic)
+- i++
+- }
+- return uri, diagnostics, nil
+-}
+-
+-// showDiagnostic reports whether a given diagnostic should be shown to the end
+-// user, given the current options.
+-func showDiagnostic(msg, source string, o *Options) bool {
+- if source != "go compiler" {
+- return false
+- }
+- if o.Annotations == nil {
+- return true
+- }
+- switch {
+- case strings.HasPrefix(msg, "canInline") ||
+- strings.HasPrefix(msg, "cannotInline") ||
+- strings.HasPrefix(msg, "inlineCall"):
+- return o.Annotations[Inline]
+- case strings.HasPrefix(msg, "escape") || msg == "leak":
+- return o.Annotations[Escape]
+- case strings.HasPrefix(msg, "nilcheck"):
+- return o.Annotations[Nil]
+- case strings.HasPrefix(msg, "isInBounds") ||
+- strings.HasPrefix(msg, "isSliceInBounds"):
+- return o.Annotations[Bounds]
+- }
+- return false
+-}
+-
+-// The range produced by the compiler is 1-indexed, so subtract range by 1.
+-func zeroIndexedRange(rng protocol.Range) protocol.Range {
+- return protocol.Range{
+- Start: protocol.Position{
+- Line: rng.Start.Line - 1,
+- Character: rng.Start.Character - 1,
+- },
+- End: protocol.Position{
+- Line: rng.End.Line - 1,
+- Character: rng.End.Character - 1,
+- },
+- }
+-}
+-
+-func findJSONFiles(dir string) ([]string, error) {
+- ans := []string{}
+- f := func(path string, fi os.FileInfo, _ error) error {
+- if fi.IsDir() {
+- return nil
+- }
+- if strings.HasSuffix(path, ".json") {
+- ans = append(ans, path)
+- }
+- return nil
+- }
+- err := filepath.Walk(dir, f)
+- return ans, err
+-}
+diff -urN a/gopls/internal/lsp/source/highlight.go b/gopls/internal/lsp/source/highlight.go
+--- a/gopls/internal/lsp/source/highlight.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/highlight.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,484 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "strings"
+-
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-func Highlight(ctx context.Context, snapshot Snapshot, fh FileHandle, position protocol.Position) ([]protocol.Range, error) {
+- ctx, done := event.Start(ctx, "source.Highlight")
+- defer done()
+-
+- // We always want fully parsed files for highlight, regardless
+- // of whether the file belongs to a workspace package.
+- pkg, pgf, err := PackageForFile(ctx, snapshot, fh.URI(), NarrowestPackage)
+- if err != nil {
+- return nil, fmt.Errorf("getting package for Highlight: %w", err)
+- }
+-
+- pos, err := pgf.PositionPos(position)
+- if err != nil {
+- return nil, err
+- }
+- path, _ := astutil.PathEnclosingInterval(pgf.File, pos, pos)
+- if len(path) == 0 {
+- return nil, fmt.Errorf("no enclosing position found for %v:%v", position.Line, position.Character)
+- }
+- // If start == end for astutil.PathEnclosingInterval, the 1-char interval
+- // following start is used instead. As a result, we might not get an exact
+- // match so we should check the 1-char interval to the left of the passed
+- // in position to see if that is an exact match.
+- if _, ok := path[0].(*ast.Ident); !ok {
+- if p, _ := astutil.PathEnclosingInterval(pgf.File, pos-1, pos-1); p != nil {
+- switch p[0].(type) {
+- case *ast.Ident, *ast.SelectorExpr:
+- path = p // use preceding ident/selector
+- }
+- }
+- }
+- result, err := highlightPath(path, pgf.File, pkg.GetTypesInfo())
+- if err != nil {
+- return nil, err
+- }
+- var ranges []protocol.Range
+- for rng := range result {
+- rng, err := pgf.PosRange(rng.start, rng.end)
+- if err != nil {
+- return nil, err
+- }
+- ranges = append(ranges, rng)
+- }
+- return ranges, nil
+-}
+-
+-func highlightPath(path []ast.Node, file *ast.File, info *types.Info) (map[posRange]struct{}, error) {
+- result := make(map[posRange]struct{})
+- switch node := path[0].(type) {
+- case *ast.BasicLit:
+- if len(path) > 1 {
+- if _, ok := path[1].(*ast.ImportSpec); ok {
+- err := highlightImportUses(path, info, result)
+- return result, err
+- }
+- }
+- highlightFuncControlFlow(path, result)
+- case *ast.ReturnStmt, *ast.FuncDecl, *ast.FuncType:
+- highlightFuncControlFlow(path, result)
+- case *ast.Ident:
+- // Check if ident is inside return or func decl.
+- highlightFuncControlFlow(path, result)
+- highlightIdentifier(node, file, info, result)
+- case *ast.ForStmt, *ast.RangeStmt:
+- highlightLoopControlFlow(path, info, result)
+- case *ast.SwitchStmt:
+- highlightSwitchFlow(path, info, result)
+- case *ast.BranchStmt:
+- // BREAK can exit a loop, switch or select, while CONTINUE exit a loop so
+- // these need to be handled separately. They can also be embedded in any
+- // other loop/switch/select if they have a label. TODO: add support for
+- // GOTO and FALLTHROUGH as well.
+- switch node.Tok {
+- case token.BREAK:
+- if node.Label != nil {
+- highlightLabeledFlow(path, info, node, result)
+- } else {
+- highlightUnlabeledBreakFlow(path, info, result)
+- }
+- case token.CONTINUE:
+- if node.Label != nil {
+- highlightLabeledFlow(path, info, node, result)
+- } else {
+- highlightLoopControlFlow(path, info, result)
+- }
+- }
+- default:
+- // If the cursor is in an unidentified area, return empty results.
+- return nil, nil
+- }
+- return result, nil
+-}
+-
+-type posRange struct {
+- start, end token.Pos
+-}
+-
+-func highlightFuncControlFlow(path []ast.Node, result map[posRange]struct{}) {
+- var enclosingFunc ast.Node
+- var returnStmt *ast.ReturnStmt
+- var resultsList *ast.FieldList
+- inReturnList := false
+-
+-Outer:
+- // Reverse walk the path till we get to the func block.
+- for i, n := range path {
+- switch node := n.(type) {
+- case *ast.KeyValueExpr:
+- // If cursor is in a key: value expr, we don't want control flow highlighting
+- return
+- case *ast.CallExpr:
+- // If cursor is an arg in a callExpr, we don't want control flow highlighting.
+- if i > 0 {
+- for _, arg := range node.Args {
+- if arg == path[i-1] {
+- return
+- }
+- }
+- }
+- case *ast.Field:
+- inReturnList = true
+- case *ast.FuncLit:
+- enclosingFunc = n
+- resultsList = node.Type.Results
+- break Outer
+- case *ast.FuncDecl:
+- enclosingFunc = n
+- resultsList = node.Type.Results
+- break Outer
+- case *ast.ReturnStmt:
+- returnStmt = node
+- // If the cursor is not directly in a *ast.ReturnStmt, then
+- // we need to know if it is within one of the values that is being returned.
+- inReturnList = inReturnList || path[0] != returnStmt
+- }
+- }
+- // Cursor is not in a function.
+- if enclosingFunc == nil {
+- return
+- }
+- // If the cursor is on a "return" or "func" keyword, we should highlight all of the exit
+- // points of the function, including the "return" and "func" keywords.
+- highlightAllReturnsAndFunc := path[0] == returnStmt || path[0] == enclosingFunc
+- switch path[0].(type) {
+- case *ast.Ident, *ast.BasicLit:
+- // Cursor is in an identifier and not in a return statement or in the results list.
+- if returnStmt == nil && !inReturnList {
+- return
+- }
+- case *ast.FuncType:
+- highlightAllReturnsAndFunc = true
+- }
+- // The user's cursor may be within the return statement of a function,
+- // or within the result section of a function's signature.
+- // index := -1
+- var nodes []ast.Node
+- if returnStmt != nil {
+- for _, n := range returnStmt.Results {
+- nodes = append(nodes, n)
+- }
+- } else if resultsList != nil {
+- for _, n := range resultsList.List {
+- nodes = append(nodes, n)
+- }
+- }
+- _, index := nodeAtPos(nodes, path[0].Pos())
+-
+- // Highlight the correct argument in the function declaration return types.
+- if resultsList != nil && -1 < index && index < len(resultsList.List) {
+- rng := posRange{
+- start: resultsList.List[index].Pos(),
+- end: resultsList.List[index].End(),
+- }
+- result[rng] = struct{}{}
+- }
+- // Add the "func" part of the func declaration.
+- if highlightAllReturnsAndFunc {
+- r := posRange{
+- start: enclosingFunc.Pos(),
+- end: enclosingFunc.Pos() + token.Pos(len("func")),
+- }
+- result[r] = struct{}{}
+- }
+- ast.Inspect(enclosingFunc, func(n ast.Node) bool {
+- // Don't traverse any other functions.
+- switch n.(type) {
+- case *ast.FuncDecl, *ast.FuncLit:
+- return enclosingFunc == n
+- }
+- ret, ok := n.(*ast.ReturnStmt)
+- if !ok {
+- return true
+- }
+- var toAdd ast.Node
+- // Add the entire return statement, applies when highlight the word "return" or "func".
+- if highlightAllReturnsAndFunc {
+- toAdd = n
+- }
+- // Add the relevant field within the entire return statement.
+- if -1 < index && index < len(ret.Results) {
+- toAdd = ret.Results[index]
+- }
+- if toAdd != nil {
+- result[posRange{start: toAdd.Pos(), end: toAdd.End()}] = struct{}{}
+- }
+- return false
+- })
+-}
+-
+-// highlightUnlabeledBreakFlow highlights the innermost enclosing for/range/switch or swlect
+-func highlightUnlabeledBreakFlow(path []ast.Node, info *types.Info, result map[posRange]struct{}) {
+- // Reverse walk the path until we find closest loop, select, or switch.
+- for _, n := range path {
+- switch n.(type) {
+- case *ast.ForStmt, *ast.RangeStmt:
+- highlightLoopControlFlow(path, info, result)
+- return // only highlight the innermost statement
+- case *ast.SwitchStmt:
+- highlightSwitchFlow(path, info, result)
+- return
+- case *ast.SelectStmt:
+- // TODO: add highlight when breaking a select.
+- return
+- }
+- }
+-}
+-
+-// highlightLabeledFlow highlights the enclosing labeled for, range,
+-// or switch statement denoted by a labeled break or continue stmt.
+-func highlightLabeledFlow(path []ast.Node, info *types.Info, stmt *ast.BranchStmt, result map[posRange]struct{}) {
+- use := info.Uses[stmt.Label]
+- if use == nil {
+- return
+- }
+- for _, n := range path {
+- if label, ok := n.(*ast.LabeledStmt); ok && info.Defs[label.Label] == use {
+- switch label.Stmt.(type) {
+- case *ast.ForStmt, *ast.RangeStmt:
+- highlightLoopControlFlow([]ast.Node{label.Stmt, label}, info, result)
+- case *ast.SwitchStmt:
+- highlightSwitchFlow([]ast.Node{label.Stmt, label}, info, result)
+- }
+- return
+- }
+- }
+-}
+-
+-func labelFor(path []ast.Node) *ast.Ident {
+- if len(path) > 1 {
+- if n, ok := path[1].(*ast.LabeledStmt); ok {
+- return n.Label
+- }
+- }
+- return nil
+-}
+-
+-func highlightLoopControlFlow(path []ast.Node, info *types.Info, result map[posRange]struct{}) {
+- var loop ast.Node
+- var loopLabel *ast.Ident
+- stmtLabel := labelFor(path)
+-Outer:
+- // Reverse walk the path till we get to the for loop.
+- for i := range path {
+- switch n := path[i].(type) {
+- case *ast.ForStmt, *ast.RangeStmt:
+- loopLabel = labelFor(path[i:])
+-
+- if stmtLabel == nil || loopLabel == stmtLabel {
+- loop = n
+- break Outer
+- }
+- }
+- }
+- if loop == nil {
+- return
+- }
+-
+- // Add the for statement.
+- rng := posRange{
+- start: loop.Pos(),
+- end: loop.Pos() + token.Pos(len("for")),
+- }
+- result[rng] = struct{}{}
+-
+- // Traverse AST to find branch statements within the same for-loop.
+- ast.Inspect(loop, func(n ast.Node) bool {
+- switch n.(type) {
+- case *ast.ForStmt, *ast.RangeStmt:
+- return loop == n
+- case *ast.SwitchStmt, *ast.SelectStmt:
+- return false
+- }
+- b, ok := n.(*ast.BranchStmt)
+- if !ok {
+- return true
+- }
+- if b.Label == nil || info.Uses[b.Label] == info.Defs[loopLabel] {
+- result[posRange{start: b.Pos(), end: b.End()}] = struct{}{}
+- }
+- return true
+- })
+-
+- // Find continue statements in the same loop or switches/selects.
+- ast.Inspect(loop, func(n ast.Node) bool {
+- switch n.(type) {
+- case *ast.ForStmt, *ast.RangeStmt:
+- return loop == n
+- }
+-
+- if n, ok := n.(*ast.BranchStmt); ok && n.Tok == token.CONTINUE {
+- result[posRange{start: n.Pos(), end: n.End()}] = struct{}{}
+- }
+- return true
+- })
+-
+- // We don't need to check other for loops if we aren't looking for labeled statements.
+- if loopLabel == nil {
+- return
+- }
+-
+- // Find labeled branch statements in any loop.
+- ast.Inspect(loop, func(n ast.Node) bool {
+- b, ok := n.(*ast.BranchStmt)
+- if !ok {
+- return true
+- }
+- // statement with labels that matches the loop
+- if b.Label != nil && info.Uses[b.Label] == info.Defs[loopLabel] {
+- result[posRange{start: b.Pos(), end: b.End()}] = struct{}{}
+- }
+- return true
+- })
+-}
+-
+-func highlightSwitchFlow(path []ast.Node, info *types.Info, result map[posRange]struct{}) {
+- var switchNode ast.Node
+- var switchNodeLabel *ast.Ident
+- stmtLabel := labelFor(path)
+-Outer:
+- // Reverse walk the path till we get to the switch statement.
+- for i := range path {
+- switch n := path[i].(type) {
+- case *ast.SwitchStmt:
+- switchNodeLabel = labelFor(path[i:])
+- if stmtLabel == nil || switchNodeLabel == stmtLabel {
+- switchNode = n
+- break Outer
+- }
+- }
+- }
+- // Cursor is not in a switch statement
+- if switchNode == nil {
+- return
+- }
+-
+- // Add the switch statement.
+- rng := posRange{
+- start: switchNode.Pos(),
+- end: switchNode.Pos() + token.Pos(len("switch")),
+- }
+- result[rng] = struct{}{}
+-
+- // Traverse AST to find break statements within the same switch.
+- ast.Inspect(switchNode, func(n ast.Node) bool {
+- switch n.(type) {
+- case *ast.SwitchStmt:
+- return switchNode == n
+- case *ast.ForStmt, *ast.RangeStmt, *ast.SelectStmt:
+- return false
+- }
+-
+- b, ok := n.(*ast.BranchStmt)
+- if !ok || b.Tok != token.BREAK {
+- return true
+- }
+-
+- if b.Label == nil || info.Uses[b.Label] == info.Defs[switchNodeLabel] {
+- result[posRange{start: b.Pos(), end: b.End()}] = struct{}{}
+- }
+- return true
+- })
+-
+- // We don't need to check other switches if we aren't looking for labeled statements.
+- if switchNodeLabel == nil {
+- return
+- }
+-
+- // Find labeled break statements in any switch
+- ast.Inspect(switchNode, func(n ast.Node) bool {
+- b, ok := n.(*ast.BranchStmt)
+- if !ok || b.Tok != token.BREAK {
+- return true
+- }
+-
+- if b.Label != nil && info.Uses[b.Label] == info.Defs[switchNodeLabel] {
+- result[posRange{start: b.Pos(), end: b.End()}] = struct{}{}
+- }
+-
+- return true
+- })
+-}
+-
+-func highlightImportUses(path []ast.Node, info *types.Info, result map[posRange]struct{}) error {
+- basicLit, ok := path[0].(*ast.BasicLit)
+- if !ok {
+- return fmt.Errorf("highlightImportUses called with an ast.Node of type %T", basicLit)
+- }
+- ast.Inspect(path[len(path)-1], func(node ast.Node) bool {
+- if imp, ok := node.(*ast.ImportSpec); ok && imp.Path == basicLit {
+- result[posRange{start: node.Pos(), end: node.End()}] = struct{}{}
+- return false
+- }
+- n, ok := node.(*ast.Ident)
+- if !ok {
+- return true
+- }
+- obj, ok := info.ObjectOf(n).(*types.PkgName)
+- if !ok {
+- return true
+- }
+- if !strings.Contains(basicLit.Value, obj.Name()) {
+- return true
+- }
+- result[posRange{start: n.Pos(), end: n.End()}] = struct{}{}
+- return false
+- })
+- return nil
+-}
+-
+-func highlightIdentifier(id *ast.Ident, file *ast.File, info *types.Info, result map[posRange]struct{}) {
+- // TODO(rfindley): idObj may be nil. Note that returning early in this case
+- // causes tests to fail (because the nObj == idObj check below was succeeded
+- // for nil == nil!)
+- //
+- // Revisit this. If ObjectOf is nil, there are type errors, and it seems
+- // reasonable for identifier highlighting not to work.
+- idObj := info.ObjectOf(id)
+- pkgObj, isImported := idObj.(*types.PkgName)
+- ast.Inspect(file, func(node ast.Node) bool {
+- if imp, ok := node.(*ast.ImportSpec); ok && isImported {
+- highlightImport(pkgObj, imp, result)
+- }
+- n, ok := node.(*ast.Ident)
+- if !ok {
+- return true
+- }
+- if n.Name != id.Name {
+- return false
+- }
+- if nObj := info.ObjectOf(n); nObj == idObj {
+- result[posRange{start: n.Pos(), end: n.End()}] = struct{}{}
+- }
+- return false
+- })
+-}
+-
+-func highlightImport(obj *types.PkgName, imp *ast.ImportSpec, result map[posRange]struct{}) {
+- if imp.Name != nil || imp.Path == nil {
+- return
+- }
+- if !strings.Contains(imp.Path.Value, obj.Name()) {
+- return
+- }
+- result[posRange{start: imp.Path.Pos(), end: imp.Path.End()}] = struct{}{}
+-}
+diff -urN a/gopls/internal/lsp/source/hover.go b/gopls/internal/lsp/source/hover.go
+--- a/gopls/internal/lsp/source/hover.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/hover.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,951 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "encoding/json"
+- "fmt"
+- "go/ast"
+- "go/constant"
+- "go/doc"
+- "go/format"
+- "go/token"
+- "go/types"
+- "strconv"
+- "strings"
+- "time"
+- "unicode/utf8"
+-
+- "golang.org/x/text/unicode/runenames"
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/go/types/typeutil"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-// HoverJSON contains information used by hover. It is also the JSON returned
+-// for the "structured" hover format
+-type HoverJSON struct {
+- // Synopsis is a single sentence synopsis of the symbol's documentation.
+- Synopsis string `json:"synopsis"`
+-
+- // FullDocumentation is the symbol's full documentation.
+- FullDocumentation string `json:"fullDocumentation"`
+-
+- // Signature is the symbol's signature.
+- Signature string `json:"signature"`
+-
+- // SingleLine is a single line describing the symbol.
+- // This is recommended only for use in clients that show a single line for hover.
+- SingleLine string `json:"singleLine"`
+-
+- // SymbolName is the human-readable name to use for the symbol in links.
+- SymbolName string `json:"symbolName"`
+-
+- // LinkPath is the pkg.go.dev link for the given symbol.
+- // For example, the "go/ast" part of "pkg.go.dev/go/ast#Node".
+- LinkPath string `json:"linkPath"`
+-
+- // LinkAnchor is the pkg.go.dev link anchor for the given symbol.
+- // For example, the "Node" part of "pkg.go.dev/go/ast#Node".
+- LinkAnchor string `json:"linkAnchor"`
+-}
+-
+-// Hover implements the "textDocument/hover" RPC for Go files.
+-func Hover(ctx context.Context, snapshot Snapshot, fh FileHandle, position protocol.Position) (*protocol.Hover, error) {
+- ctx, done := event.Start(ctx, "source.Hover")
+- defer done()
+-
+- rng, h, err := hover(ctx, snapshot, fh, position)
+- if err != nil {
+- return nil, err
+- }
+- if h == nil {
+- return nil, nil
+- }
+- hover, err := formatHover(h, snapshot.View().Options())
+- if err != nil {
+- return nil, err
+- }
+- return &protocol.Hover{
+- Contents: protocol.MarkupContent{
+- Kind: snapshot.View().Options().PreferredContentFormat,
+- Value: hover,
+- },
+- Range: rng,
+- }, nil
+-}
+-
+-// hover computes hover information at the given position. If we do not support
+-// hovering at the position, it returns _, nil, nil: an error is only returned
+-// if the position is valid but we fail to compute hover information.
+-func hover(ctx context.Context, snapshot Snapshot, fh FileHandle, pp protocol.Position) (protocol.Range, *HoverJSON, error) {
+- pkg, pgf, err := PackageForFile(ctx, snapshot, fh.URI(), NarrowestPackage)
+- if err != nil {
+- return protocol.Range{}, nil, err
+- }
+- pos, err := pgf.PositionPos(pp)
+- if err != nil {
+- return protocol.Range{}, nil, err
+- }
+-
+- // Handle hovering over import paths, which do not have an associated
+- // identifier.
+- for _, spec := range pgf.File.Imports {
+- // We are inclusive of the end point here to allow hovering when the cursor
+- // is just after the import path.
+- if spec.Path.Pos() <= pos && pos <= spec.Path.End() {
+- return hoverImport(ctx, snapshot, pkg, pgf, spec)
+- }
+- }
+-
+- // Handle hovering over the package name, which does not have an associated
+- // object.
+- // As with import paths, we allow hovering just after the package name.
+- if pgf.File.Name != nil && pgf.File.Name.Pos() <= pos && pos <= pgf.File.Name.Pos() {
+- return hoverPackageName(pkg, pgf)
+- }
+-
+- // Handle hovering over (non-import-path) literals.
+- if path, _ := astutil.PathEnclosingInterval(pgf.File, pos, pos); len(path) > 0 {
+- if lit, _ := path[0].(*ast.BasicLit); lit != nil {
+- return hoverLit(pgf, lit, pos)
+- }
+- }
+-
+- // The general case: compute hover information for the object referenced by
+- // the identifier at pos.
+- ident, obj, selectedType := referencedObject(pkg, pgf, pos)
+- if obj == nil || ident == nil {
+- return protocol.Range{}, nil, nil // no object to hover
+- }
+-
+- rng, err := pgf.NodeRange(ident)
+- if err != nil {
+- return protocol.Range{}, nil, err
+- }
+-
+- // By convention, we qualify hover information relative to the package
+- // from which the request originated.
+- qf := Qualifier(pgf.File, pkg.GetTypes(), pkg.GetTypesInfo())
+-
+- // Handle type switch identifiers as a special case, since they don't have an
+- // object.
+- //
+- // There's not much useful information to provide.
+- if selectedType != nil {
+- fakeObj := types.NewVar(obj.Pos(), obj.Pkg(), obj.Name(), selectedType)
+- signature := objectString(fakeObj, qf, nil)
+- return rng, &HoverJSON{
+- Signature: signature,
+- SingleLine: signature,
+- SymbolName: fakeObj.Name(),
+- }, nil
+- }
+-
+- // Handle builtins, which don't have a package or position.
+- if obj.Pkg() == nil {
+- h, err := hoverBuiltin(ctx, snapshot, obj)
+- return rng, h, err
+- }
+-
+- // For all other objects, consider the full syntax of their declaration in
+- // order to correctly compute their documentation, signature, and link.
+- declPGF, declPos, err := parseFull(ctx, snapshot, pkg.FileSet(), obj.Pos())
+- if err != nil {
+- return protocol.Range{}, nil, fmt.Errorf("re-parsing declaration of %s: %v", obj.Name(), err)
+- }
+- decl, spec, field := findDeclInfo([]*ast.File{declPGF.File}, declPos)
+- comment := chooseDocComment(decl, spec, field)
+- docText := comment.Text()
+-
+- // By default, types.ObjectString provides a reasonable signature.
+- signature := objectString(obj, qf, nil)
+- // TODO(rfindley): we could do much better for inferred signatures.
+- if inferred := inferredSignature(pkg.GetTypesInfo(), ident); inferred != nil {
+- signature = objectString(obj, qf, inferred)
+- }
+-
+- // For "objects defined by a type spec", the signature produced by
+- // objectString is insufficient:
+- // (1) large structs are formatted poorly, with no newlines
+- // (2) we lose inline comments
+- //
+- // Furthermore, we include a summary of their method set.
+- //
+- // TODO(rfindley): this should use FormatVarType to get proper qualification
+- // of identifiers, and we should revisit the formatting of method set.
+- _, isTypeName := obj.(*types.TypeName)
+- _, isTypeParam := obj.Type().(*typeparams.TypeParam)
+- if isTypeName && !isTypeParam {
+- spec, ok := spec.(*ast.TypeSpec)
+- if !ok {
+- return protocol.Range{}, nil, bug.Errorf("type name %q without type spec", obj.Name())
+- }
+- spec2 := *spec
+- // Don't duplicate comments when formatting type specs.
+- spec2.Doc = nil
+- spec2.Comment = nil
+- var b strings.Builder
+- b.WriteString("type ")
+- fset := FileSetFor(declPGF.Tok)
+- if err := format.Node(&b, fset, &spec2); err != nil {
+- return protocol.Range{}, nil, err
+- }
+-
+- // Display the declared methods accessible from the identifier.
+- //
+- // (The format.Node call above displays any struct fields, public
+- // or private, in syntactic form. We choose not to recursively
+- // enumerate any fields and methods promoted from them.)
+- if !types.IsInterface(obj.Type()) {
+- sep := "\n\n"
+- for _, m := range typeutil.IntuitiveMethodSet(obj.Type(), nil) {
+- // Show direct methods that are either exported, or defined in the
+- // current package.
+- if (m.Obj().Exported() || m.Obj().Pkg() == pkg.GetTypes()) && len(m.Index()) == 1 {
+- b.WriteString(sep)
+- sep = "\n"
+- b.WriteString(objectString(m.Obj(), qf, nil))
+- }
+- }
+- }
+- signature = b.String()
+- }
+-
+- // Compute link data (on pkg.go.dev or other documentation host).
+- //
+- // If linkPath is empty, the symbol is not linkable.
+- var (
+- linkName string // => link title, always non-empty
+- linkPath string // => link path
+- anchor string // link anchor
+- linkMeta *Metadata // metadata for the linked package
+- )
+- {
+- linkMeta = findFileInDeps(snapshot, pkg.Metadata(), declPGF.URI)
+- if linkMeta == nil {
+- return protocol.Range{}, nil, bug.Errorf("no metadata for %s", declPGF.URI)
+- }
+-
+- // For package names, we simply link to their imported package.
+- if pkgName, ok := obj.(*types.PkgName); ok {
+- linkName = pkgName.Name()
+- linkPath = pkgName.Imported().Path()
+- impID := linkMeta.DepsByPkgPath[PackagePath(pkgName.Imported().Path())]
+- linkMeta = snapshot.Metadata(impID)
+- if linkMeta == nil {
+- return protocol.Range{}, nil, bug.Errorf("no metadata for %s", declPGF.URI)
+- }
+- } else {
+- // For all others, check whether the object is in the package scope, or
+- // an exported field or method of an object in the package scope.
+- //
+- // We try to match pkgsite's heuristics for what is linkable, and what is
+- // not.
+- var recv types.Object
+- switch obj := obj.(type) {
+- case *types.Func:
+- sig := obj.Type().(*types.Signature)
+- if sig.Recv() != nil {
+- tname := typeToObject(sig.Recv().Type())
+- if tname != nil { // beware typed nil
+- recv = tname
+- }
+- }
+- case *types.Var:
+- if obj.IsField() {
+- if spec, ok := spec.(*ast.TypeSpec); ok {
+- typeName := spec.Name
+- scopeObj, _ := obj.Pkg().Scope().Lookup(typeName.Name).(*types.TypeName)
+- if scopeObj != nil {
+- if st, _ := scopeObj.Type().Underlying().(*types.Struct); st != nil {
+- for i := 0; i < st.NumFields(); i++ {
+- if obj == st.Field(i) {
+- recv = scopeObj
+- }
+- }
+- }
+- }
+- }
+- }
+- }
+-
+- // Even if the object is not available in package documentation, it may
+- // be embedded in a documented receiver. Detect this by searching
+- // enclosing selector expressions.
+- //
+- // TODO(rfindley): pkgsite doesn't document fields from embedding, just
+- // methods.
+- if recv == nil || !recv.Exported() {
+- path := pathEnclosingObjNode(pgf.File, pos)
+- if enclosing := searchForEnclosing(pkg.GetTypesInfo(), path); enclosing != nil {
+- recv = enclosing
+- } else {
+- recv = nil // note: just recv = ... could result in a typed nil.
+- }
+- }
+-
+- pkg := obj.Pkg()
+- if recv != nil {
+- linkName = fmt.Sprintf("(%s.%s).%s", pkg.Name(), recv.Name(), obj.Name())
+- if obj.Exported() && recv.Exported() && pkg.Scope().Lookup(recv.Name()) == recv {
+- linkPath = pkg.Path()
+- anchor = fmt.Sprintf("%s.%s", recv.Name(), obj.Name())
+- }
+- } else {
+- linkName = fmt.Sprintf("%s.%s", pkg.Name(), obj.Name())
+- if obj.Exported() && pkg.Scope().Lookup(obj.Name()) == obj {
+- linkPath = pkg.Path()
+- anchor = obj.Name()
+- }
+- }
+- }
+- }
+-
+- if snapshot.View().IsGoPrivatePath(linkPath) || linkMeta.ForTest != "" {
+- linkPath = ""
+- } else if linkMeta.Module != nil && linkMeta.Module.Version != "" {
+- mod := linkMeta.Module
+- linkPath = strings.Replace(linkPath, mod.Path, mod.Path+"@"+mod.Version, 1)
+- }
+-
+- return rng, &HoverJSON{
+- Synopsis: doc.Synopsis(docText),
+- FullDocumentation: docText,
+- SingleLine: objectString(obj, qf, nil),
+- SymbolName: linkName,
+- Signature: signature,
+- LinkPath: linkPath,
+- LinkAnchor: anchor,
+- }, nil
+-}
+-
+-// hoverBuiltin computes hover information when hovering over a builtin
+-// identifier.
+-func hoverBuiltin(ctx context.Context, snapshot Snapshot, obj types.Object) (*HoverJSON, error) {
+- // TODO(rfindley): link to the correct version of Go documentation.
+- builtin, err := snapshot.BuiltinFile(ctx)
+- if err != nil {
+- return nil, err
+- }
+-
+- // TODO(rfindley): add a test for jump to definition of error.Error (which is
+- // probably failing, considering it lacks special handling).
+- if obj.Name() == "Error" {
+- signature := obj.String()
+- return &HoverJSON{
+- Signature: signature,
+- SingleLine: signature,
+- // TODO(rfindley): these are better than the current behavior.
+- // SymbolName: "(error).Error",
+- // LinkPath: "builtin",
+- // LinkAnchor: "error.Error",
+- }, nil
+- }
+-
+- builtinObj := builtin.File.Scope.Lookup(obj.Name())
+- if builtinObj == nil {
+- // All builtins should have a declaration in the builtin file.
+- return nil, bug.Errorf("no builtin object for %s", obj.Name())
+- }
+- node, _ := builtinObj.Decl.(ast.Node)
+- if node == nil {
+- return nil, bug.Errorf("no declaration for %s", obj.Name())
+- }
+-
+- var comment *ast.CommentGroup
+- path, _ := astutil.PathEnclosingInterval(builtin.File, node.Pos(), node.End())
+- for _, n := range path {
+- switch n := n.(type) {
+- case *ast.GenDecl:
+- // Separate documentation and signature.
+- comment = n.Doc
+- node2 := *n
+- node2.Doc = nil
+- node = &node2
+- case *ast.FuncDecl:
+- // Ditto.
+- comment = n.Doc
+- node2 := *n
+- node2.Doc = nil
+- node = &node2
+- }
+- }
+-
+- signature := FormatNodeFile(builtin.Tok, node)
+- // Replace fake types with their common equivalent.
+- // TODO(rfindley): we should instead use obj.Type(), which would have the
+- // *actual* types of the builtin call.
+- signature = replacer.Replace(signature)
+-
+- docText := comment.Text()
+- return &HoverJSON{
+- Synopsis: doc.Synopsis(docText),
+- FullDocumentation: docText,
+- Signature: signature,
+- SingleLine: obj.String(),
+- SymbolName: obj.Name(),
+- LinkPath: "builtin",
+- LinkAnchor: obj.Name(),
+- }, nil
+-}
+-
+-// hoverImport computes hover information when hovering over the import path of
+-// imp in the file pgf of pkg.
+-//
+-// If we do not have metadata for the hovered import, it returns _
+-func hoverImport(ctx context.Context, snapshot Snapshot, pkg Package, pgf *ParsedGoFile, imp *ast.ImportSpec) (protocol.Range, *HoverJSON, error) {
+- rng, err := pgf.NodeRange(imp.Path)
+- if err != nil {
+- return protocol.Range{}, nil, err
+- }
+-
+- importPath := UnquoteImportPath(imp)
+- if importPath == "" {
+- return protocol.Range{}, nil, fmt.Errorf("invalid import path")
+- }
+- impID := pkg.Metadata().DepsByImpPath[importPath]
+- if impID == "" {
+- return protocol.Range{}, nil, fmt.Errorf("no package data for import %q", importPath)
+- }
+- impMetadata := snapshot.Metadata(impID)
+- if impMetadata == nil {
+- return protocol.Range{}, nil, bug.Errorf("failed to resolve import ID %q", impID)
+- }
+-
+- // Find the first file with a package doc comment.
+- var comment *ast.CommentGroup
+- for _, f := range impMetadata.CompiledGoFiles {
+- fh, err := snapshot.GetFile(ctx, f)
+- if err != nil {
+- if ctx.Err() != nil {
+- return protocol.Range{}, nil, ctx.Err()
+- }
+- continue
+- }
+- pgf, err := snapshot.ParseGo(ctx, fh, ParseHeader)
+- if err != nil {
+- if ctx.Err() != nil {
+- return protocol.Range{}, nil, ctx.Err()
+- }
+- continue
+- }
+- if pgf.File.Doc != nil {
+- comment = pgf.File.Doc
+- break
+- }
+- }
+-
+- docText := comment.Text()
+- return rng, &HoverJSON{
+- Synopsis: doc.Synopsis(docText),
+- FullDocumentation: docText,
+- }, nil
+-}
+-
+-// hoverPackageName computes hover information for the package name of the file
+-// pgf in pkg.
+-func hoverPackageName(pkg Package, pgf *ParsedGoFile) (protocol.Range, *HoverJSON, error) {
+- var comment *ast.CommentGroup
+- for _, pgf := range pkg.CompiledGoFiles() {
+- if pgf.File.Doc != nil {
+- comment = pgf.File.Doc
+- break
+- }
+- }
+- rng, err := pgf.NodeRange(pgf.File.Name)
+- if err != nil {
+- return protocol.Range{}, nil, err
+- }
+- docText := comment.Text()
+- return rng, &HoverJSON{
+- Synopsis: doc.Synopsis(docText),
+- FullDocumentation: docText,
+- // Note: including a signature is redundant, since the cursor is already on the
+- // package name.
+- }, nil
+-}
+-
+-// hoverLit computes hover information when hovering over the basic literal lit
+-// in the file pgf. The provided pos must be the exact position of the cursor,
+-// as it is used to extract the hovered rune in strings.
+-//
+-// For example, hovering over "\u2211" in "foo \u2211 bar" yields:
+-//
+-// '∑', U+2211, N-ARY SUMMATION
+-func hoverLit(pgf *ParsedGoFile, lit *ast.BasicLit, pos token.Pos) (protocol.Range, *HoverJSON, error) {
+- var r rune
+- var start, end token.Pos
+- // Extract a rune from the current position.
+- // 'Ω', "...Ω...", or 0x03A9 => 'Ω', U+03A9, GREEK CAPITAL LETTER OMEGA
+- switch lit.Kind {
+- case token.CHAR:
+- s, err := strconv.Unquote(lit.Value)
+- if err != nil {
+- // If the conversion fails, it's because of an invalid syntax, therefore
+- // there is no rune to be found.
+- return protocol.Range{}, nil, nil
+- }
+- r, _ = utf8.DecodeRuneInString(s)
+- if r == utf8.RuneError {
+- return protocol.Range{}, nil, fmt.Errorf("rune error")
+- }
+- start, end = lit.Pos(), lit.End()
+- case token.INT:
+- // TODO(rfindley): add support for hex/octal/binary->int conversion here.
+-
+- // It's an integer, scan only if it is a hex literal whose bitsize in
+- // ranging from 8 to 32.
+- if !(strings.HasPrefix(lit.Value, "0x") && len(lit.Value[2:]) >= 2 && len(lit.Value[2:]) <= 8) {
+- return protocol.Range{}, nil, nil
+- }
+- v, err := strconv.ParseUint(lit.Value[2:], 16, 32)
+- if err != nil {
+- return protocol.Range{}, nil, fmt.Errorf("parsing int: %v", err)
+- }
+- r = rune(v)
+- if r == utf8.RuneError {
+- return protocol.Range{}, nil, fmt.Errorf("rune error")
+- }
+- start, end = lit.Pos(), lit.End()
+- case token.STRING:
+- // It's a string, scan only if it contains a unicode escape sequence under or before the
+- // current cursor position.
+- litOffset, err := safetoken.Offset(pgf.Tok, lit.Pos())
+- if err != nil {
+- return protocol.Range{}, nil, err
+- }
+- offset, err := safetoken.Offset(pgf.Tok, pos)
+- if err != nil {
+- return protocol.Range{}, nil, err
+- }
+- for i := offset - litOffset; i > 0; i-- {
+- // Start at the cursor position and search backward for the beginning of a rune escape sequence.
+- rr, _ := utf8.DecodeRuneInString(lit.Value[i:])
+- if rr == utf8.RuneError {
+- return protocol.Range{}, nil, fmt.Errorf("rune error")
+- }
+- if rr == '\\' {
+- // Got the beginning, decode it.
+- var tail string
+- r, _, tail, err = strconv.UnquoteChar(lit.Value[i:], '"')
+- if err != nil {
+- // If the conversion fails, it's because of an invalid syntax,
+- // therefore is no rune to be found.
+- return protocol.Range{}, nil, nil
+- }
+- // Only the rune escape sequence part of the string has to be highlighted, recompute the range.
+- runeLen := len(lit.Value) - (int(i) + len(tail))
+- start = token.Pos(int(lit.Pos()) + int(i))
+- end = token.Pos(int(start) + runeLen)
+- break
+- }
+- }
+- }
+- if r == 0 {
+- return protocol.Range{}, nil, nil
+- }
+- rng, err := pgf.PosRange(start, end)
+- if err != nil {
+- return protocol.Range{}, nil, err
+- }
+-
+- var desc string
+- runeName := runenames.Name(r)
+- if len(runeName) > 0 && runeName[0] == '<' {
+- // Check if the rune looks like an HTML tag. If so, trim the surrounding <>
+- // characters to work around https://github.com/microsoft/vscode/issues/124042.
+- runeName = strings.TrimRight(runeName[1:], ">")
+- }
+- if strconv.IsPrint(r) {
+- desc = fmt.Sprintf("'%s', U+%04X, %s", string(r), uint32(r), runeName)
+- } else {
+- desc = fmt.Sprintf("U+%04X, %s", uint32(r), runeName)
+- }
+- return rng, &HoverJSON{
+- Synopsis: desc,
+- FullDocumentation: desc,
+- }, nil
+-}
+-
+-// objectString is a wrapper around the types.ObjectString function.
+-// It handles adding more information to the object string.
+-//
+-// TODO(rfindley): this function does too much. We should lift the special
+-// handling to callsites.
+-func objectString(obj types.Object, qf types.Qualifier, inferred *types.Signature) string {
+- // If the signature type was inferred, prefer the inferred signature with a
+- // comment showing the generic signature.
+- if sig, _ := obj.Type().(*types.Signature); sig != nil && typeparams.ForSignature(sig).Len() > 0 && inferred != nil {
+- obj2 := types.NewFunc(obj.Pos(), obj.Pkg(), obj.Name(), inferred)
+- str := types.ObjectString(obj2, qf)
+- // Try to avoid overly long lines.
+- if len(str) > 60 {
+- str += "\n"
+- } else {
+- str += " "
+- }
+- str += "// " + types.TypeString(sig, qf)
+- return str
+- }
+- str := types.ObjectString(obj, qf)
+- switch obj := obj.(type) {
+- case *types.Const:
+- str = fmt.Sprintf("%s = %s", str, obj.Val())
+-
+- // Try to add a formatted duration as an inline comment
+- typ, ok := obj.Type().(*types.Named)
+- if !ok {
+- break
+- }
+- pkg := typ.Obj().Pkg()
+- if pkg.Path() == "time" && typ.Obj().Name() == "Duration" {
+- if d, ok := constant.Int64Val(obj.Val()); ok {
+- str += " // " + time.Duration(d).String()
+- }
+- }
+- }
+- return str
+-}
+-
+-// HoverDocForObject returns the best doc comment for obj (for which
+-// fset provides file/line information).
+-//
+-// TODO(rfindley): there appears to be zero(!) tests for this functionality.
+-func HoverDocForObject(ctx context.Context, snapshot Snapshot, fset *token.FileSet, obj types.Object) (*ast.CommentGroup, error) {
+- if _, isTypeName := obj.(*types.TypeName); isTypeName {
+- if _, isTypeParam := obj.Type().(*typeparams.TypeParam); isTypeParam {
+- return nil, nil
+- }
+- }
+-
+- pgf, pos, err := parseFull(ctx, snapshot, fset, obj.Pos())
+- if err != nil {
+- return nil, fmt.Errorf("re-parsing: %v", err)
+- }
+-
+- decl, spec, field := findDeclInfo([]*ast.File{pgf.File}, pos)
+- return chooseDocComment(decl, spec, field), nil
+-}
+-
+-func chooseDocComment(decl ast.Decl, spec ast.Spec, field *ast.Field) *ast.CommentGroup {
+- if field != nil {
+- if field.Doc != nil {
+- return field.Doc
+- }
+- if field.Comment != nil {
+- return field.Comment
+- }
+- return nil
+- }
+- switch decl := decl.(type) {
+- case *ast.FuncDecl:
+- return decl.Doc
+- case *ast.GenDecl:
+- switch spec := spec.(type) {
+- case *ast.ValueSpec:
+- if spec.Doc != nil {
+- return spec.Doc
+- }
+- if decl.Doc != nil {
+- return decl.Doc
+- }
+- return spec.Comment
+- case *ast.TypeSpec:
+- if spec.Doc != nil {
+- return spec.Doc
+- }
+- if decl.Doc != nil {
+- return decl.Doc
+- }
+- return spec.Comment
+- }
+- }
+- return nil
+-}
+-
+-// parseFull fully parses the file corresponding to position pos (for
+-// which fset provides file/line information).
+-//
+-// It returns the resulting ParsedGoFile as well as new pos contained in the
+-// parsed file.
+-func parseFull(ctx context.Context, snapshot Snapshot, fset *token.FileSet, pos token.Pos) (*ParsedGoFile, token.Pos, error) {
+- f := fset.File(pos)
+- if f == nil {
+- return nil, 0, bug.Errorf("internal error: no file for position %d", pos)
+- }
+-
+- uri := span.URIFromPath(f.Name())
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return nil, 0, err
+- }
+-
+- pgf, err := snapshot.ParseGo(ctx, fh, ParseFull)
+- if err != nil {
+- return nil, 0, err
+- }
+-
+- offset, err := safetoken.Offset(f, pos)
+- if err != nil {
+- return nil, 0, bug.Errorf("offset out of bounds in %q", uri)
+- }
+-
+- fullPos, err := safetoken.Pos(pgf.Tok, offset)
+- if err != nil {
+- return nil, 0, err
+- }
+-
+- return pgf, fullPos, nil
+-}
+-
+-// extractFieldList recursively tries to extract a field list.
+-// If it is not found, nil is returned.
+-func extractFieldList(specType ast.Expr) *ast.FieldList {
+- switch t := specType.(type) {
+- case *ast.StructType:
+- return t.Fields
+- case *ast.InterfaceType:
+- return t.Methods
+- case *ast.ArrayType:
+- return extractFieldList(t.Elt)
+- case *ast.MapType:
+- // Map value has a greater chance to be a struct
+- if fields := extractFieldList(t.Value); fields != nil {
+- return fields
+- }
+- return extractFieldList(t.Key)
+- case *ast.ChanType:
+- return extractFieldList(t.Value)
+- }
+- return nil
+-}
+-
+-func formatHover(h *HoverJSON, options *Options) (string, error) {
+- signature := formatSignature(h, options)
+-
+- switch options.HoverKind {
+- case SingleLine:
+- return h.SingleLine, nil
+- case NoDocumentation:
+- return signature, nil
+- case Structured:
+- b, err := json.Marshal(h)
+- if err != nil {
+- return "", err
+- }
+- return string(b), nil
+- }
+-
+- link := formatLink(h, options)
+- doc := formatDoc(h, options)
+-
+- var b strings.Builder
+- parts := []string{signature, doc, link}
+- for i, el := range parts {
+- if el != "" {
+- b.WriteString(el)
+-
+- // If any elements of the remainder of the list are non-empty,
+- // write an extra newline.
+- if anyNonEmpty(parts[i+1:]) {
+- if options.PreferredContentFormat == protocol.Markdown {
+- b.WriteString("\n\n")
+- } else {
+- b.WriteRune('\n')
+- }
+- }
+- }
+- }
+- return b.String(), nil
+-}
+-
+-func formatSignature(h *HoverJSON, options *Options) string {
+- signature := h.Signature
+- if signature != "" && options.PreferredContentFormat == protocol.Markdown {
+- signature = fmt.Sprintf("```go\n%s\n```", signature)
+- }
+- return signature
+-}
+-
+-func formatLink(h *HoverJSON, options *Options) string {
+- if !options.LinksInHover || options.LinkTarget == "" || h.LinkPath == "" {
+- return ""
+- }
+- plainLink := BuildLink(options.LinkTarget, h.LinkPath, h.LinkAnchor)
+- switch options.PreferredContentFormat {
+- case protocol.Markdown:
+- return fmt.Sprintf("[`%s` on %s](%s)", h.SymbolName, options.LinkTarget, plainLink)
+- case protocol.PlainText:
+- return ""
+- default:
+- return plainLink
+- }
+-}
+-
+-// BuildLink constructs a URL with the given target, path, and anchor.
+-func BuildLink(target, path, anchor string) string {
+- link := fmt.Sprintf("https://%s/%s", target, path)
+- if anchor == "" {
+- return link
+- }
+- return link + "#" + anchor
+-}
+-
+-func formatDoc(h *HoverJSON, options *Options) string {
+- var doc string
+- switch options.HoverKind {
+- case SynopsisDocumentation:
+- doc = h.Synopsis
+- case FullDocumentation:
+- doc = h.FullDocumentation
+- }
+- if options.PreferredContentFormat == protocol.Markdown {
+- return CommentToMarkdown(doc, options)
+- }
+- return doc
+-}
+-
+-func anyNonEmpty(x []string) bool {
+- for _, el := range x {
+- if el != "" {
+- return true
+- }
+- }
+- return false
+-}
+-
+-// findDeclInfo returns the syntax nodes involved in the declaration of the
+-// types.Object with position pos, searching the given list of file syntax
+-// trees.
+-//
+-// Pos may be the position of the name-defining identifier in a FuncDecl,
+-// ValueSpec, TypeSpec, Field, or as a special case the position of
+-// Ellipsis.Elt in an ellipsis field.
+-//
+-// If found, the resulting decl, spec, and field will be the inner-most
+-// instance of each node type surrounding pos.
+-//
+-// If field is non-nil, pos is the position of a field Var. If field is nil and
+-// spec is non-nil, pos is the position of a Var, Const, or TypeName object. If
+-// both field and spec are nil and decl is non-nil, pos is the position of a
+-// Func object.
+-//
+-// It returns a nil decl if no object-defining node is found at pos.
+-//
+-// TODO(rfindley): this function has tricky semantics, and may be worth unit
+-// testing and/or refactoring.
+-func findDeclInfo(files []*ast.File, pos token.Pos) (decl ast.Decl, spec ast.Spec, field *ast.Field) {
+- // panic(found{}) breaks off the traversal and
+- // causes the function to return normally.
+- type found struct{}
+- defer func() {
+- switch x := recover().(type) {
+- case nil:
+- case found:
+- default:
+- panic(x)
+- }
+- }()
+-
+- // Visit the files in search of the node at pos.
+- stack := make([]ast.Node, 0, 20)
+- // Allocate the closure once, outside the loop.
+- f := func(n ast.Node) bool {
+- if n != nil {
+- stack = append(stack, n) // push
+- } else {
+- stack = stack[:len(stack)-1] // pop
+- return false
+- }
+-
+- // Skip subtrees (incl. files) that don't contain the search point.
+- if !(n.Pos() <= pos && pos < n.End()) {
+- return false
+- }
+-
+- switch n := n.(type) {
+- case *ast.Field:
+- findEnclosingDeclAndSpec := func() {
+- for i := len(stack) - 1; i >= 0; i-- {
+- switch n := stack[i].(type) {
+- case ast.Spec:
+- spec = n
+- case ast.Decl:
+- decl = n
+- return
+- }
+- }
+- }
+-
+- // Check each field name since you can have
+- // multiple names for the same type expression.
+- for _, id := range n.Names {
+- if id.Pos() == pos {
+- field = n
+- findEnclosingDeclAndSpec()
+- panic(found{})
+- }
+- }
+-
+- // Check *ast.Field itself. This handles embedded
+- // fields which have no associated *ast.Ident name.
+- if n.Pos() == pos {
+- field = n
+- findEnclosingDeclAndSpec()
+- panic(found{})
+- }
+-
+- // Also check "X" in "...X". This makes it easy to format variadic
+- // signature params properly.
+- //
+- // TODO(rfindley): I don't understand this comment. How does finding the
+- // field in this case make it easier to format variadic signature params?
+- if ell, ok := n.Type.(*ast.Ellipsis); ok && ell.Elt != nil && ell.Elt.Pos() == pos {
+- field = n
+- findEnclosingDeclAndSpec()
+- panic(found{})
+- }
+-
+- case *ast.FuncDecl:
+- if n.Name.Pos() == pos {
+- decl = n
+- panic(found{})
+- }
+-
+- case *ast.GenDecl:
+- for _, s := range n.Specs {
+- switch s := s.(type) {
+- case *ast.TypeSpec:
+- if s.Name.Pos() == pos {
+- decl = n
+- spec = s
+- panic(found{})
+- }
+- case *ast.ValueSpec:
+- for _, id := range s.Names {
+- if id.Pos() == pos {
+- decl = n
+- spec = s
+- panic(found{})
+- }
+- }
+- }
+- }
+- }
+- return true
+- }
+- for _, file := range files {
+- ast.Inspect(file, f)
+- }
+-
+- return nil, nil, nil
+-}
+diff -urN a/gopls/internal/lsp/source/identifier.go b/gopls/internal/lsp/source/identifier.go
+--- a/gopls/internal/lsp/source/identifier.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/identifier.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,174 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "errors"
+- "go/ast"
+- "go/types"
+-
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-// ErrNoIdentFound is error returned when no identifier is found at a particular position
+-var ErrNoIdentFound = errors.New("no identifier found")
+-
+-// inferredSignature determines the resolved non-generic signature for an
+-// identifier in an instantiation expression.
+-//
+-// If no such signature exists, it returns nil.
+-func inferredSignature(info *types.Info, id *ast.Ident) *types.Signature {
+- inst := typeparams.GetInstances(info)[id]
+- sig, _ := inst.Type.(*types.Signature)
+- return sig
+-}
+-
+-func searchForEnclosing(info *types.Info, path []ast.Node) *types.TypeName {
+- for _, n := range path {
+- switch n := n.(type) {
+- case *ast.SelectorExpr:
+- if sel, ok := info.Selections[n]; ok {
+- recv := Deref(sel.Recv())
+-
+- // Keep track of the last exported type seen.
+- var exported *types.TypeName
+- if named, ok := recv.(*types.Named); ok && named.Obj().Exported() {
+- exported = named.Obj()
+- }
+- // We don't want the last element, as that's the field or
+- // method itself.
+- for _, index := range sel.Index()[:len(sel.Index())-1] {
+- if r, ok := recv.Underlying().(*types.Struct); ok {
+- recv = Deref(r.Field(index).Type())
+- if named, ok := recv.(*types.Named); ok && named.Obj().Exported() {
+- exported = named.Obj()
+- }
+- }
+- }
+- return exported
+- }
+- }
+- }
+- return nil
+-}
+-
+-// typeToObject returns the relevant type name for the given type, after
+-// unwrapping pointers, arrays, slices, channels, and function signatures with
+-// a single non-error result.
+-func typeToObject(typ types.Type) *types.TypeName {
+- switch typ := typ.(type) {
+- case *types.Named:
+- // TODO(rfindley): this should use typeparams.NamedTypeOrigin.
+- return typ.Obj()
+- case *types.Pointer:
+- return typeToObject(typ.Elem())
+- case *types.Array:
+- return typeToObject(typ.Elem())
+- case *types.Slice:
+- return typeToObject(typ.Elem())
+- case *types.Chan:
+- return typeToObject(typ.Elem())
+- case *types.Signature:
+- // Try to find a return value of a named type. If there's only one
+- // such value, jump to its type definition.
+- var res *types.TypeName
+-
+- results := typ.Results()
+- for i := 0; i < results.Len(); i++ {
+- obj := typeToObject(results.At(i).Type())
+- if obj == nil || hasErrorType(obj) {
+- // Skip builtins.
+- continue
+- }
+- if res != nil {
+- // The function/method must have only one return value of a named type.
+- return nil
+- }
+-
+- res = obj
+- }
+- return res
+- default:
+- return nil
+- }
+-}
+-
+-func hasErrorType(obj types.Object) bool {
+- return types.IsInterface(obj.Type()) && obj.Pkg() == nil && obj.Name() == "error"
+-}
+-
+-// typeSwitchImplicits returns all the implicit type switch objects that
+-// correspond to the leaf *ast.Ident. It also returns the original type
+-// associated with the identifier (outside of a case clause).
+-func typeSwitchImplicits(info *types.Info, path []ast.Node) ([]types.Object, types.Type) {
+- ident, _ := path[0].(*ast.Ident)
+- if ident == nil {
+- return nil, nil
+- }
+-
+- var (
+- ts *ast.TypeSwitchStmt
+- assign *ast.AssignStmt
+- cc *ast.CaseClause
+- obj = info.ObjectOf(ident)
+- )
+-
+- // Walk our ancestors to determine if our leaf ident refers to a
+- // type switch variable, e.g. the "a" from "switch a := b.(type)".
+-Outer:
+- for i := 1; i < len(path); i++ {
+- switch n := path[i].(type) {
+- case *ast.AssignStmt:
+- // Check if ident is the "a" in "a := foo.(type)". The "a" in
+- // this case has no types.Object, so check for ident equality.
+- if len(n.Lhs) == 1 && n.Lhs[0] == ident {
+- assign = n
+- }
+- case *ast.CaseClause:
+- // Check if ident is a use of "a" within a case clause. Each
+- // case clause implicitly maps "a" to a different types.Object,
+- // so check if ident's object is the case clause's implicit
+- // object.
+- if obj != nil && info.Implicits[n] == obj {
+- cc = n
+- }
+- case *ast.TypeSwitchStmt:
+- // Look for the type switch that owns our previously found
+- // *ast.AssignStmt or *ast.CaseClause.
+- if n.Assign == assign {
+- ts = n
+- break Outer
+- }
+-
+- for _, stmt := range n.Body.List {
+- if stmt == cc {
+- ts = n
+- break Outer
+- }
+- }
+- }
+- }
+- if ts == nil {
+- return nil, nil
+- }
+- // Our leaf ident refers to a type switch variable. Fan out to the
+- // type switch's implicit case clause objects.
+- var objs []types.Object
+- for _, cc := range ts.Body.List {
+- if ccObj := info.Implicits[cc]; ccObj != nil {
+- objs = append(objs, ccObj)
+- }
+- }
+- // The right-hand side of a type switch should only have one
+- // element, and we need to track its type in order to generate
+- // hover information for implicit type switch variables.
+- var typ types.Type
+- if assign, ok := ts.Assign.(*ast.AssignStmt); ok && len(assign.Rhs) == 1 {
+- if rhs := assign.Rhs[0].(*ast.TypeAssertExpr); ok {
+- typ = info.TypeOf(rhs.X)
+- }
+- }
+- return objs, typ
+-}
+diff -urN a/gopls/internal/lsp/source/identifier_test.go b/gopls/internal/lsp/source/identifier_test.go
+--- a/gopls/internal/lsp/source/identifier_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/identifier_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,103 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "bytes"
+- "go/ast"
+- "go/parser"
+- "go/token"
+- "go/types"
+- "testing"
+-)
+-
+-func TestSearchForEnclosing(t *testing.T) {
+- tests := []struct {
+- desc string
+- // For convenience, consider the first occurrence of the identifier "X" in
+- // src.
+- src string
+- // By convention, "" means no type found.
+- wantTypeName string
+- }{
+- {
+- // TODO(rFindley): is this correct, or do we want to resolve I2 here?
+- desc: "embedded interface in interface",
+- src: `package a; var y = i1.X; type i1 interface {I2}; type I2 interface{X()}`,
+- wantTypeName: "",
+- },
+- {
+- desc: "embedded interface in struct",
+- src: `package a; var y = t.X; type t struct {I}; type I interface{X()}`,
+- wantTypeName: "I",
+- },
+- {
+- desc: "double embedding",
+- src: `package a; var y = t1.X; type t1 struct {t2}; type t2 struct {I}; type I interface{X()}`,
+- wantTypeName: "I",
+- },
+- }
+-
+- for _, test := range tests {
+- test := test
+- t.Run(test.desc, func(t *testing.T) {
+- fset := token.NewFileSet()
+- file, err := parser.ParseFile(fset, "a.go", test.src, parser.AllErrors)
+- if err != nil {
+- t.Fatal(err)
+- }
+- column := 1 + bytes.IndexRune([]byte(test.src), 'X')
+- pos := posAt(1, column, fset, "a.go")
+- path := pathEnclosingObjNode(file, pos)
+- if path == nil {
+- t.Fatalf("no ident found at (1, %d)", column)
+- }
+- info := newInfo()
+- if _, err = (*types.Config)(nil).Check("p", fset, []*ast.File{file}, info); err != nil {
+- t.Fatal(err)
+- }
+- obj := searchForEnclosing(info, path)
+- if obj == nil {
+- if test.wantTypeName != "" {
+- t.Errorf("searchForEnclosing(...) = <nil>, want %q", test.wantTypeName)
+- }
+- return
+- }
+- if got := obj.Name(); got != test.wantTypeName {
+- t.Errorf("searchForEnclosing(...) = %q, want %q", got, test.wantTypeName)
+- }
+- })
+- }
+-}
+-
+-// posAt returns the token.Pos corresponding to the 1-based (line, column)
+-// coordinates in the file fname of fset.
+-func posAt(line, column int, fset *token.FileSet, fname string) token.Pos {
+- var tok *token.File
+- fset.Iterate(func(tf *token.File) bool {
+- if tf.Name() == fname {
+- tok = tf
+- return false
+- }
+- return true
+- })
+- if tok == nil {
+- return token.NoPos
+- }
+- start := tok.LineStart(line)
+- return start + token.Pos(column-1)
+-}
+-
+-// newInfo returns a types.Info with all maps populated.
+-func newInfo() *types.Info {
+- return &types.Info{
+- Types: make(map[ast.Expr]types.TypeAndValue),
+- Defs: make(map[*ast.Ident]types.Object),
+- Uses: make(map[*ast.Ident]types.Object),
+- Implicits: make(map[ast.Node]types.Object),
+- Selections: make(map[*ast.SelectorExpr]*types.Selection),
+- Scopes: make(map[ast.Node]*types.Scope),
+- }
+-}
+diff -urN a/gopls/internal/lsp/source/implementation.go b/gopls/internal/lsp/source/implementation.go
+--- a/gopls/internal/lsp/source/implementation.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/implementation.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,482 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "errors"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "reflect"
+- "sort"
+- "strings"
+- "sync"
+-
+- "golang.org/x/sync/errgroup"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/lsp/source/methodsets"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-// This file defines the new implementation of the 'implementation'
+-// operator that does not require type-checker data structures for an
+-// unbounded number of packages.
+-//
+-// TODO(adonovan):
+-// - Audit to ensure robustness in face of type errors.
+-// - Support 'error' and 'error.Error', which were also lacking from the old implementation.
+-// - Eliminate false positives due to 'tricky' cases of the global algorithm.
+-// - Ensure we have test coverage of:
+-// type aliases
+-// nil, PkgName, Builtin (all errors)
+-// any (empty result)
+-// method of unnamed interface type (e.g. var x interface { f() })
+-// (the global algorithm may find implementations of this type
+-// but will not include it in the index.)
+-
+-// Implementation returns a new sorted array of locations of
+-// declarations of types that implement (or are implemented by) the
+-// type referred to at the given position.
+-//
+-// If the position denotes a method, the computation is applied to its
+-// receiver type and then its corresponding methods are returned.
+-func Implementation(ctx context.Context, snapshot Snapshot, f FileHandle, pp protocol.Position) ([]protocol.Location, error) {
+- ctx, done := event.Start(ctx, "source.Implementation")
+- defer done()
+-
+- locs, err := implementations2(ctx, snapshot, f, pp)
+- if err != nil {
+- return nil, err
+- }
+-
+- // Sort and de-duplicate locations.
+- sort.Slice(locs, func(i, j int) bool {
+- return protocol.CompareLocation(locs[i], locs[j]) < 0
+- })
+- out := locs[:0]
+- for _, loc := range locs {
+- if len(out) == 0 || out[len(out)-1] != loc {
+- out = append(out, loc)
+- }
+- }
+- locs = out
+-
+- return locs, nil
+-}
+-
+-func implementations2(ctx context.Context, snapshot Snapshot, fh FileHandle, pp protocol.Position) ([]protocol.Location, error) {
+-
+- // Type-check the query package, find the query identifier,
+- // and locate the type or method declaration it refers to.
+- declPosn, err := typeDeclPosition(ctx, snapshot, fh.URI(), pp)
+- if err != nil {
+- return nil, err
+- }
+-
+- // Type-check the declaring package (incl. variants) for use
+- // by the "local" search, which uses type information to
+- // enumerate all types within the package that satisfy the
+- // query type, even those defined local to a function.
+- declURI := span.URIFromPath(declPosn.Filename)
+- declMetas, err := snapshot.MetadataForFile(ctx, declURI)
+- if err != nil {
+- return nil, err
+- }
+- if len(declMetas) == 0 {
+- return nil, fmt.Errorf("no packages for file %s", declURI)
+- }
+- ids := make([]PackageID, len(declMetas))
+- for i, m := range declMetas {
+- ids[i] = m.ID
+- }
+- localPkgs, err := snapshot.TypeCheck(ctx, ids...)
+- if err != nil {
+- return nil, err
+- }
+- // The narrowest package will do, since the local search is based
+- // on position and the global search is based on fingerprint.
+- // (Neither is based on object identity.)
+- declPkg := localPkgs[0]
+- declFile, err := declPkg.File(declURI)
+- if err != nil {
+- return nil, err // "can't happen"
+- }
+-
+- // Find declaration of corresponding object
+- // in this package based on (URI, offset).
+- pos, err := safetoken.Pos(declFile.Tok, declPosn.Offset)
+- if err != nil {
+- return nil, err
+- }
+- // TODO(adonovan): simplify: use objectsAt?
+- path := pathEnclosingObjNode(declFile.File, pos)
+- if path == nil {
+- return nil, ErrNoIdentFound // checked earlier
+- }
+- id, ok := path[0].(*ast.Ident)
+- if !ok {
+- return nil, ErrNoIdentFound // checked earlier
+- }
+- obj := declPkg.GetTypesInfo().ObjectOf(id) // may be nil
+-
+- // Is the selected identifier a type name or method?
+- // (For methods, report the corresponding method names.)
+- var queryType types.Type
+- var queryMethodID string
+- switch obj := obj.(type) {
+- case *types.TypeName:
+- queryType = obj.Type()
+- case *types.Func:
+- // For methods, use the receiver type, which may be anonymous.
+- if recv := obj.Type().(*types.Signature).Recv(); recv != nil {
+- queryType = recv.Type()
+- queryMethodID = obj.Id()
+- }
+- }
+- if queryType == nil {
+- return nil, fmt.Errorf("%s is not a type or method", id.Name)
+- }
+-
+- // Compute the method-set fingerprint used as a key to the global search.
+- key, hasMethods := methodsets.KeyOf(queryType)
+- if !hasMethods {
+- // A type with no methods yields an empty result.
+- // (No point reporting that every type satisfies 'any'.)
+- return nil, nil
+- }
+-
+- // The global search needs to look at every package in the workspace;
+- // see package ./methodsets.
+- //
+- // For now we do all the type checking before beginning the search.
+- // TODO(adonovan): opt: search in parallel topological order
+- // so that we can overlap index lookup with typechecking.
+- // I suspect a number of algorithms on the result of TypeCheck could
+- // be optimized by being applied as soon as each package is available.
+- globalMetas, err := snapshot.AllMetadata(ctx)
+- if err != nil {
+- return nil, err
+- }
+- globalIDs := make([]PackageID, 0, len(globalMetas))
+- for _, m := range globalMetas {
+- if m.PkgPath == declPkg.Metadata().PkgPath {
+- continue // declaring package is handled by local implementation
+- }
+- globalIDs = append(globalIDs, m.ID)
+- }
+- indexes, err := snapshot.MethodSets(ctx, globalIDs...)
+- if err != nil {
+- return nil, err
+- }
+-
+- // Search local and global packages in parallel.
+- var (
+- group errgroup.Group
+- locsMu sync.Mutex
+- locs []protocol.Location
+- )
+- // local search
+- for _, localPkg := range localPkgs {
+- localPkg := localPkg
+- group.Go(func() error {
+- localLocs, err := localImplementations(ctx, snapshot, localPkg, queryType, queryMethodID)
+- if err != nil {
+- return err
+- }
+- locsMu.Lock()
+- locs = append(locs, localLocs...)
+- locsMu.Unlock()
+- return nil
+- })
+- }
+- // global search
+- for _, index := range indexes {
+- index := index
+- group.Go(func() error {
+- for _, res := range index.Search(key, queryMethodID) {
+- loc := res.Location
+- // Map offsets to protocol.Locations in parallel (may involve I/O).
+- group.Go(func() error {
+- ploc, err := offsetToLocation(ctx, snapshot, loc.Filename, loc.Start, loc.End)
+- if err != nil {
+- return err
+- }
+- locsMu.Lock()
+- locs = append(locs, ploc)
+- locsMu.Unlock()
+- return nil
+- })
+- }
+- return nil
+- })
+- }
+- if err := group.Wait(); err != nil {
+- return nil, err
+- }
+-
+- return locs, nil
+-}
+-
+-// offsetToLocation converts an offset-based position to a protocol.Location,
+-// which requires reading the file.
+-func offsetToLocation(ctx context.Context, snapshot Snapshot, filename string, start, end int) (protocol.Location, error) {
+- uri := span.URIFromPath(filename)
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return protocol.Location{}, err // cancelled, perhaps
+- }
+- content, err := fh.Read()
+- if err != nil {
+- return protocol.Location{}, err // nonexistent or deleted ("can't happen")
+- }
+- m := protocol.NewMapper(uri, content)
+- return m.OffsetLocation(start, end)
+-}
+-
+-// typeDeclPosition returns the position of the declaration of the
+-// type (or one of its methods) referred to at (uri, ppos).
+-func typeDeclPosition(ctx context.Context, snapshot Snapshot, uri span.URI, ppos protocol.Position) (token.Position, error) {
+- var noPosn token.Position
+-
+- pkg, pgf, err := PackageForFile(ctx, snapshot, uri, WidestPackage)
+- if err != nil {
+- return noPosn, err
+- }
+- pos, err := pgf.PositionPos(ppos)
+- if err != nil {
+- return noPosn, err
+- }
+-
+- // This function inherits the limitation of its predecessor in
+- // requiring the selection to be an identifier (of a type or
+- // method). But there's no fundamental reason why one could
+- // not pose this query about any selected piece of syntax that
+- // has a type and thus a method set.
+- // (If LSP was more thorough about passing text selections as
+- // intervals to queries, you could ask about the method set of a
+- // subexpression such as x.f().)
+-
+- // TODO(adonovan): simplify: use objectsAt?
+- path := pathEnclosingObjNode(pgf.File, pos)
+- if path == nil {
+- return noPosn, ErrNoIdentFound
+- }
+- id, ok := path[0].(*ast.Ident)
+- if !ok {
+- return noPosn, ErrNoIdentFound
+- }
+-
+- // Is the object a type or method? Reject other kinds.
+- obj := pkg.GetTypesInfo().Uses[id]
+- if obj == nil {
+- // Check uses first (unlike ObjectOf) so that T in
+- // struct{T} is treated as a reference to a type,
+- // not a declaration of a field.
+- obj = pkg.GetTypesInfo().Defs[id]
+- }
+- switch obj := obj.(type) {
+- case *types.TypeName:
+- // ok
+- case *types.Func:
+- if obj.Type().(*types.Signature).Recv() == nil {
+- return noPosn, fmt.Errorf("%s is a function, not a method", id.Name)
+- }
+- case nil:
+- return noPosn, fmt.Errorf("%s denotes unknown object", id.Name)
+- default:
+- // e.g. *types.Var -> "var".
+- kind := strings.ToLower(strings.TrimPrefix(reflect.TypeOf(obj).String(), "*types."))
+- return noPosn, fmt.Errorf("%s is a %s, not a type", id.Name, kind)
+- }
+-
+- declPosn := safetoken.StartPosition(pkg.FileSet(), obj.Pos())
+- return declPosn, nil
+-}
+-
+-// localImplementations searches within pkg for declarations of all
+-// types that are assignable to/from the query type, and returns a new
+-// unordered array of their locations.
+-//
+-// If methodID is non-empty, the function instead returns the location
+-// of each type's method (if any) of that ID.
+-//
+-// ("Local" refers to the search within the same package, but this
+-// function's results may include type declarations that are local to
+-// a function body. The global search index excludes such types
+-// because reliably naming such types is hard.)
+-func localImplementations(ctx context.Context, snapshot Snapshot, pkg Package, queryType types.Type, methodID string) ([]protocol.Location, error) {
+- queryType = methodsets.EnsurePointer(queryType)
+-
+- // Scan through all type declarations in the syntax.
+- var locs []protocol.Location
+- var methodLocs []methodsets.Location
+- for _, pgf := range pkg.CompiledGoFiles() {
+- ast.Inspect(pgf.File, func(n ast.Node) bool {
+- spec, ok := n.(*ast.TypeSpec)
+- if !ok {
+- return true // not a type declaration
+- }
+- def := pkg.GetTypesInfo().Defs[spec.Name]
+- if def == nil {
+- return true // "can't happen" for types
+- }
+- if def.(*types.TypeName).IsAlias() {
+- return true // skip type aliases to avoid duplicate reporting
+- }
+- candidateType := methodsets.EnsurePointer(def.Type())
+-
+- // The historical behavior enshrined by this
+- // function rejects cases where both are
+- // (nontrivial) interface types?
+- // That seems like useful information.
+- // TODO(adonovan): UX: report I/I pairs too?
+- // The same question appears in the global algorithm (methodsets).
+- if !concreteImplementsIntf(candidateType, queryType) {
+- return true // not assignable
+- }
+-
+- // Ignore types with empty method sets.
+- // (No point reporting that every type satisfies 'any'.)
+- mset := types.NewMethodSet(candidateType)
+- if mset.Len() == 0 {
+- return true
+- }
+-
+- if methodID == "" {
+- // Found matching type.
+- locs = append(locs, mustLocation(pgf, spec.Name))
+- return true
+- }
+-
+- // Find corresponding method.
+- //
+- // We can't use LookupFieldOrMethod because it requires
+- // the methodID's types.Package, which we don't know.
+- // We could recursively search pkg.Imports for it,
+- // but it's easier to walk the method set.
+- for i := 0; i < mset.Len(); i++ {
+- method := mset.At(i).Obj()
+- if method.Id() == methodID {
+- posn := safetoken.StartPosition(pkg.FileSet(), method.Pos())
+- methodLocs = append(methodLocs, methodsets.Location{
+- Filename: posn.Filename,
+- Start: posn.Offset,
+- End: posn.Offset + len(method.Name()),
+- })
+- break
+- }
+- }
+- return true
+- })
+- }
+-
+- // Finally convert method positions to protocol form by reading the files.
+- for _, mloc := range methodLocs {
+- loc, err := offsetToLocation(ctx, snapshot, mloc.Filename, mloc.Start, mloc.End)
+- if err != nil {
+- return nil, err
+- }
+- locs = append(locs, loc)
+- }
+-
+- return locs, nil
+-}
+-
+-// concreteImplementsIntf returns true if a is an interface type implemented by
+-// concrete type b, or vice versa.
+-func concreteImplementsIntf(a, b types.Type) bool {
+- aIsIntf, bIsIntf := types.IsInterface(a), types.IsInterface(b)
+-
+- // Make sure exactly one is an interface type.
+- if aIsIntf == bIsIntf {
+- return false
+- }
+-
+- // Rearrange if needed so "a" is the concrete type.
+- if aIsIntf {
+- a, b = b, a
+- }
+-
+- // TODO(adonovan): this should really use GenericAssignableTo
+- // to report (e.g.) "ArrayList[T] implements List[T]", but
+- // GenericAssignableTo doesn't work correctly on pointers to
+- // generic named types. Thus the legacy implementation and the
+- // "local" part of implementation2 fail to report generics.
+- // The global algorithm based on subsets does the right thing.
+- return types.AssignableTo(a, b)
+-}
+-
+-var (
+- // TODO(adonovan): why do various RPC handlers related to
+- // IncomingCalls return (nil, nil) on the protocol in response
+- // to this error? That seems like a violation of the protocol.
+- // Is it perhaps a workaround for VSCode behavior?
+- errNoObjectFound = errors.New("no object found")
+-)
+-
+-// pathEnclosingObjNode returns the AST path to the object-defining
+-// node associated with pos. "Object-defining" means either an
+-// *ast.Ident mapped directly to a types.Object or an ast.Node mapped
+-// implicitly to a types.Object.
+-func pathEnclosingObjNode(f *ast.File, pos token.Pos) []ast.Node {
+- var (
+- path []ast.Node
+- found bool
+- )
+-
+- ast.Inspect(f, func(n ast.Node) bool {
+- if found {
+- return false
+- }
+-
+- if n == nil {
+- path = path[:len(path)-1]
+- return false
+- }
+-
+- path = append(path, n)
+-
+- switch n := n.(type) {
+- case *ast.Ident:
+- // Include the position directly after identifier. This handles
+- // the common case where the cursor is right after the
+- // identifier the user is currently typing. Previously we
+- // handled this by calling astutil.PathEnclosingInterval twice,
+- // once for "pos" and once for "pos-1".
+- found = n.Pos() <= pos && pos <= n.End()
+- case *ast.ImportSpec:
+- if n.Path.Pos() <= pos && pos < n.Path.End() {
+- found = true
+- // If import spec has a name, add name to path even though
+- // position isn't in the name.
+- if n.Name != nil {
+- path = append(path, n.Name)
+- }
+- }
+- case *ast.StarExpr:
+- // Follow star expressions to the inner identifier.
+- if pos == n.Star {
+- pos = n.X.Pos()
+- }
+- }
+-
+- return !found
+- })
+-
+- if len(path) == 0 {
+- return nil
+- }
+-
+- // Reverse path so leaf is first element.
+- for i := 0; i < len(path)/2; i++ {
+- path[i], path[len(path)-1-i] = path[len(path)-1-i], path[i]
+- }
+-
+- return path
+-}
+diff -urN a/gopls/internal/lsp/source/inlay_hint.go b/gopls/internal/lsp/source/inlay_hint.go
+--- a/gopls/internal/lsp/source/inlay_hint.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/inlay_hint.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,394 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "fmt"
+- "go/ast"
+- "go/constant"
+- "go/token"
+- "go/types"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-const (
+- maxLabelLength = 28
+-)
+-
+-type InlayHintFunc func(node ast.Node, m *protocol.Mapper, tf *token.File, info *types.Info, q *types.Qualifier) []protocol.InlayHint
+-
+-type Hint struct {
+- Name string
+- Doc string
+- Run InlayHintFunc
+-}
+-
+-const (
+- ParameterNames = "parameterNames"
+- AssignVariableTypes = "assignVariableTypes"
+- ConstantValues = "constantValues"
+- RangeVariableTypes = "rangeVariableTypes"
+- CompositeLiteralTypes = "compositeLiteralTypes"
+- CompositeLiteralFieldNames = "compositeLiteralFields"
+- FunctionTypeParameters = "functionTypeParameters"
+-)
+-
+-var AllInlayHints = map[string]*Hint{
+- AssignVariableTypes: {
+- Name: AssignVariableTypes,
+- Doc: "Enable/disable inlay hints for variable types in assign statements:\n```go\n\ti/* int*/, j/* int*/ := 0, len(r)-1\n```",
+- Run: assignVariableTypes,
+- },
+- ParameterNames: {
+- Name: ParameterNames,
+- Doc: "Enable/disable inlay hints for parameter names:\n```go\n\tparseInt(/* str: */ \"123\", /* radix: */ 8)\n```",
+- Run: parameterNames,
+- },
+- ConstantValues: {
+- Name: ConstantValues,
+- Doc: "Enable/disable inlay hints for constant values:\n```go\n\tconst (\n\t\tKindNone Kind = iota/* = 0*/\n\t\tKindPrint/* = 1*/\n\t\tKindPrintf/* = 2*/\n\t\tKindErrorf/* = 3*/\n\t)\n```",
+- Run: constantValues,
+- },
+- RangeVariableTypes: {
+- Name: RangeVariableTypes,
+- Doc: "Enable/disable inlay hints for variable types in range statements:\n```go\n\tfor k/* int*/, v/* string*/ := range []string{} {\n\t\tfmt.Println(k, v)\n\t}\n```",
+- Run: rangeVariableTypes,
+- },
+- CompositeLiteralTypes: {
+- Name: CompositeLiteralTypes,
+- Doc: "Enable/disable inlay hints for composite literal types:\n```go\n\tfor _, c := range []struct {\n\t\tin, want string\n\t}{\n\t\t/*struct{ in string; want string }*/{\"Hello, world\", \"dlrow ,olleH\"},\n\t}\n```",
+- Run: compositeLiteralTypes,
+- },
+- CompositeLiteralFieldNames: {
+- Name: CompositeLiteralFieldNames,
+- Doc: "Enable/disable inlay hints for composite literal field names:\n```go\n\t{/*in: */\"Hello, world\", /*want: */\"dlrow ,olleH\"}\n```",
+- Run: compositeLiteralFields,
+- },
+- FunctionTypeParameters: {
+- Name: FunctionTypeParameters,
+- Doc: "Enable/disable inlay hints for implicit type parameters on generic functions:\n```go\n\tmyFoo/*[int, string]*/(1, \"hello\")\n```",
+- Run: funcTypeParams,
+- },
+-}
+-
+-func InlayHint(ctx context.Context, snapshot Snapshot, fh FileHandle, pRng protocol.Range) ([]protocol.InlayHint, error) {
+- ctx, done := event.Start(ctx, "source.InlayHint")
+- defer done()
+-
+- pkg, pgf, err := PackageForFile(ctx, snapshot, fh.URI(), NarrowestPackage)
+- if err != nil {
+- return nil, fmt.Errorf("getting file for InlayHint: %w", err)
+- }
+-
+- // Collect a list of the inlay hints that are enabled.
+- inlayHintOptions := snapshot.View().Options().InlayHintOptions
+- var enabledHints []InlayHintFunc
+- for hint, enabled := range inlayHintOptions.Hints {
+- if !enabled {
+- continue
+- }
+- if h, ok := AllInlayHints[hint]; ok {
+- enabledHints = append(enabledHints, h.Run)
+- }
+- }
+- if len(enabledHints) == 0 {
+- return nil, nil
+- }
+-
+- info := pkg.GetTypesInfo()
+- q := Qualifier(pgf.File, pkg.GetTypes(), info)
+-
+- // Set the range to the full file if the range is not valid.
+- start, end := pgf.File.Pos(), pgf.File.End()
+- if pRng.Start.Line < pRng.End.Line || pRng.Start.Character < pRng.End.Character {
+- // Adjust start and end for the specified range.
+- var err error
+- start, end, err = pgf.RangePos(pRng)
+- if err != nil {
+- return nil, err
+- }
+- }
+-
+- var hints []protocol.InlayHint
+- ast.Inspect(pgf.File, func(node ast.Node) bool {
+- // If not in range, we can stop looking.
+- if node == nil || node.End() < start || node.Pos() > end {
+- return false
+- }
+- for _, fn := range enabledHints {
+- hints = append(hints, fn(node, pgf.Mapper, pgf.Tok, info, &q)...)
+- }
+- return true
+- })
+- return hints, nil
+-}
+-
+-func parameterNames(node ast.Node, m *protocol.Mapper, tf *token.File, info *types.Info, _ *types.Qualifier) []protocol.InlayHint {
+- callExpr, ok := node.(*ast.CallExpr)
+- if !ok {
+- return nil
+- }
+- signature, ok := info.TypeOf(callExpr.Fun).(*types.Signature)
+- if !ok {
+- return nil
+- }
+-
+- var hints []protocol.InlayHint
+- for i, v := range callExpr.Args {
+- start, err := m.PosPosition(tf, v.Pos())
+- if err != nil {
+- continue
+- }
+- params := signature.Params()
+- // When a function has variadic params, we skip args after
+- // params.Len().
+- if i > params.Len()-1 {
+- break
+- }
+- param := params.At(i)
+- // param.Name is empty for built-ins like append
+- if param.Name() == "" {
+- continue
+- }
+- // Skip the parameter name hint if the arg matches the
+- // the parameter name.
+- if i, ok := v.(*ast.Ident); ok && i.Name == param.Name() {
+- continue
+- }
+-
+- label := param.Name()
+- if signature.Variadic() && i == params.Len()-1 {
+- label = label + "..."
+- }
+- hints = append(hints, protocol.InlayHint{
+- Position: start,
+- Label: buildLabel(label + ":"),
+- Kind: protocol.Parameter,
+- PaddingRight: true,
+- })
+- }
+- return hints
+-}
+-
+-func funcTypeParams(node ast.Node, m *protocol.Mapper, tf *token.File, info *types.Info, _ *types.Qualifier) []protocol.InlayHint {
+- ce, ok := node.(*ast.CallExpr)
+- if !ok {
+- return nil
+- }
+- id, ok := ce.Fun.(*ast.Ident)
+- if !ok {
+- return nil
+- }
+- inst := typeparams.GetInstances(info)[id]
+- if inst.TypeArgs == nil {
+- return nil
+- }
+- start, err := m.PosPosition(tf, id.End())
+- if err != nil {
+- return nil
+- }
+- var args []string
+- for i := 0; i < inst.TypeArgs.Len(); i++ {
+- args = append(args, inst.TypeArgs.At(i).String())
+- }
+- if len(args) == 0 {
+- return nil
+- }
+- return []protocol.InlayHint{{
+- Position: start,
+- Label: buildLabel("[" + strings.Join(args, ", ") + "]"),
+- Kind: protocol.Type,
+- }}
+-}
+-
+-func assignVariableTypes(node ast.Node, m *protocol.Mapper, tf *token.File, info *types.Info, q *types.Qualifier) []protocol.InlayHint {
+- stmt, ok := node.(*ast.AssignStmt)
+- if !ok || stmt.Tok != token.DEFINE {
+- return nil
+- }
+-
+- var hints []protocol.InlayHint
+- for _, v := range stmt.Lhs {
+- if h := variableType(v, m, tf, info, q); h != nil {
+- hints = append(hints, *h)
+- }
+- }
+- return hints
+-}
+-
+-func rangeVariableTypes(node ast.Node, m *protocol.Mapper, tf *token.File, info *types.Info, q *types.Qualifier) []protocol.InlayHint {
+- rStmt, ok := node.(*ast.RangeStmt)
+- if !ok {
+- return nil
+- }
+- var hints []protocol.InlayHint
+- if h := variableType(rStmt.Key, m, tf, info, q); h != nil {
+- hints = append(hints, *h)
+- }
+- if h := variableType(rStmt.Value, m, tf, info, q); h != nil {
+- hints = append(hints, *h)
+- }
+- return hints
+-}
+-
+-func variableType(e ast.Expr, m *protocol.Mapper, tf *token.File, info *types.Info, q *types.Qualifier) *protocol.InlayHint {
+- typ := info.TypeOf(e)
+- if typ == nil {
+- return nil
+- }
+- end, err := m.PosPosition(tf, e.End())
+- if err != nil {
+- return nil
+- }
+- return &protocol.InlayHint{
+- Position: end,
+- Label: buildLabel(types.TypeString(typ, *q)),
+- Kind: protocol.Type,
+- PaddingLeft: true,
+- }
+-}
+-
+-func constantValues(node ast.Node, m *protocol.Mapper, tf *token.File, info *types.Info, _ *types.Qualifier) []protocol.InlayHint {
+- genDecl, ok := node.(*ast.GenDecl)
+- if !ok || genDecl.Tok != token.CONST {
+- return nil
+- }
+-
+- var hints []protocol.InlayHint
+- for _, v := range genDecl.Specs {
+- spec, ok := v.(*ast.ValueSpec)
+- if !ok {
+- continue
+- }
+- end, err := m.PosPosition(tf, v.End())
+- if err != nil {
+- continue
+- }
+- // Show hints when values are missing or at least one value is not
+- // a basic literal.
+- showHints := len(spec.Values) == 0
+- checkValues := len(spec.Names) == len(spec.Values)
+- var values []string
+- for i, w := range spec.Names {
+- obj, ok := info.ObjectOf(w).(*types.Const)
+- if !ok || obj.Val().Kind() == constant.Unknown {
+- return nil
+- }
+- if checkValues {
+- switch spec.Values[i].(type) {
+- case *ast.BadExpr:
+- return nil
+- case *ast.BasicLit:
+- default:
+- if obj.Val().Kind() != constant.Bool {
+- showHints = true
+- }
+- }
+- }
+- values = append(values, fmt.Sprintf("%v", obj.Val()))
+- }
+- if !showHints || len(values) == 0 {
+- continue
+- }
+- hints = append(hints, protocol.InlayHint{
+- Position: end,
+- Label: buildLabel("= " + strings.Join(values, ", ")),
+- PaddingLeft: true,
+- })
+- }
+- return hints
+-}
+-
+-func compositeLiteralFields(node ast.Node, m *protocol.Mapper, tf *token.File, info *types.Info, q *types.Qualifier) []protocol.InlayHint {
+- compLit, ok := node.(*ast.CompositeLit)
+- if !ok {
+- return nil
+- }
+- typ := info.TypeOf(compLit)
+- if typ == nil {
+- return nil
+- }
+- if t, ok := typ.(*types.Pointer); ok {
+- typ = t.Elem()
+- }
+- strct, ok := typ.Underlying().(*types.Struct)
+- if !ok {
+- return nil
+- }
+-
+- var hints []protocol.InlayHint
+- var allEdits []protocol.TextEdit
+- for i, v := range compLit.Elts {
+- if _, ok := v.(*ast.KeyValueExpr); !ok {
+- start, err := m.PosPosition(tf, v.Pos())
+- if err != nil {
+- continue
+- }
+- if i > strct.NumFields()-1 {
+- break
+- }
+- hints = append(hints, protocol.InlayHint{
+- Position: start,
+- Label: buildLabel(strct.Field(i).Name() + ":"),
+- Kind: protocol.Parameter,
+- PaddingRight: true,
+- })
+- allEdits = append(allEdits, protocol.TextEdit{
+- Range: protocol.Range{Start: start, End: start},
+- NewText: strct.Field(i).Name() + ": ",
+- })
+- }
+- }
+- // It is not allowed to have a mix of keyed and unkeyed fields, so
+- // have the text edits add keys to all fields.
+- for i := range hints {
+- hints[i].TextEdits = allEdits
+- }
+- return hints
+-}
+-
+-func compositeLiteralTypes(node ast.Node, m *protocol.Mapper, tf *token.File, info *types.Info, q *types.Qualifier) []protocol.InlayHint {
+- compLit, ok := node.(*ast.CompositeLit)
+- if !ok {
+- return nil
+- }
+- typ := info.TypeOf(compLit)
+- if typ == nil {
+- return nil
+- }
+- if compLit.Type != nil {
+- return nil
+- }
+- prefix := ""
+- if t, ok := typ.(*types.Pointer); ok {
+- typ = t.Elem()
+- prefix = "&"
+- }
+- // The type for this composite literal is implicit, add an inlay hint.
+- start, err := m.PosPosition(tf, compLit.Lbrace)
+- if err != nil {
+- return nil
+- }
+- return []protocol.InlayHint{{
+- Position: start,
+- Label: buildLabel(fmt.Sprintf("%s%s", prefix, types.TypeString(typ, *q))),
+- Kind: protocol.Type,
+- }}
+-}
+-
+-func buildLabel(s string) []protocol.InlayHintLabelPart {
+- label := protocol.InlayHintLabelPart{
+- Value: s,
+- }
+- if len(s) > maxLabelLength+len("...") {
+- label.Value = s[:maxLabelLength] + "..."
+- }
+- return []protocol.InlayHintLabelPart{label}
+-}
+diff -urN a/gopls/internal/lsp/source/known_packages.go b/gopls/internal/lsp/source/known_packages.go
+--- a/gopls/internal/lsp/source/known_packages.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/known_packages.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,140 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "fmt"
+- "go/parser"
+- "go/token"
+- "sort"
+- "strings"
+- "sync"
+- "time"
+-
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/imports"
+-)
+-
+-// KnownPackagePaths returns a new list of package paths of all known
+-// packages in the package graph that could potentially be imported by
+-// the given file. The list is ordered lexicographically, except that
+-// all dot-free paths (standard packages) appear before dotful ones.
+-//
+-// It is part of the gopls.list_known_packages command.
+-func KnownPackagePaths(ctx context.Context, snapshot Snapshot, fh FileHandle) ([]PackagePath, error) {
+- // This algorithm is expressed in terms of Metadata, not Packages,
+- // so it doesn't cause or wait for type checking.
+-
+- // Find a Metadata containing the file.
+- metas, err := snapshot.MetadataForFile(ctx, fh.URI())
+- if err != nil {
+- return nil, err // e.g. context cancelled
+- }
+- if len(metas) == 0 {
+- return nil, fmt.Errorf("no loaded package contain file %s", fh.URI())
+- }
+- current := metas[0] // pick one arbitrarily (they should all have the same package path)
+-
+- // Parse the file's imports so we can compute which
+- // PackagePaths are imported by this specific file.
+- src, err := fh.Read()
+- if err != nil {
+- return nil, err
+- }
+- file, err := parser.ParseFile(token.NewFileSet(), fh.URI().Filename(), src, parser.ImportsOnly)
+- if err != nil {
+- return nil, err
+- }
+- imported := make(map[PackagePath]bool)
+- for _, imp := range file.Imports {
+- if id := current.DepsByImpPath[UnquoteImportPath(imp)]; id != "" {
+- if m := snapshot.Metadata(id); m != nil {
+- imported[m.PkgPath] = true
+- }
+- }
+- }
+-
+- // Now find candidates among known packages.
+- knownPkgs, err := snapshot.AllMetadata(ctx)
+- if err != nil {
+- return nil, err
+- }
+- seen := make(map[PackagePath]bool)
+- for _, knownPkg := range knownPkgs {
+- // package main cannot be imported
+- if knownPkg.Name == "main" {
+- continue
+- }
+- // test packages cannot be imported
+- if knownPkg.ForTest != "" {
+- continue
+- }
+- // No need to import what the file already imports.
+- // This check is based on PackagePath, not PackageID,
+- // so that all test variants are filtered out too.
+- if imported[knownPkg.PkgPath] {
+- continue
+- }
+- // make sure internal packages are importable by the file
+- if !IsValidImport(current.PkgPath, knownPkg.PkgPath) {
+- continue
+- }
+- // naive check on cyclical imports
+- if isDirectlyCyclical(current, knownPkg) {
+- continue
+- }
+- // AllMetadata may have multiple variants of a pkg.
+- seen[knownPkg.PkgPath] = true
+- }
+-
+- // Augment the set by invoking the goimports algorithm.
+- if err := snapshot.RunProcessEnvFunc(ctx, func(o *imports.Options) error {
+- ctx, cancel := context.WithTimeout(ctx, time.Millisecond*80)
+- defer cancel()
+- var seenMu sync.Mutex
+- wrapped := func(ifix imports.ImportFix) {
+- seenMu.Lock()
+- defer seenMu.Unlock()
+- // TODO(adonovan): what if the actual package path has a vendor/ prefix?
+- seen[PackagePath(ifix.StmtInfo.ImportPath)] = true
+- }
+- return imports.GetAllCandidates(ctx, wrapped, "", fh.URI().Filename(), string(current.Name), o.Env)
+- }); err != nil {
+- // If goimports failed, proceed with just the candidates from the metadata.
+- event.Error(ctx, "imports.GetAllCandidates", err)
+- }
+-
+- // Sort lexicographically, but with std before non-std packages.
+- paths := make([]PackagePath, 0, len(seen))
+- for path := range seen {
+- paths = append(paths, path)
+- }
+- sort.Slice(paths, func(i, j int) bool {
+- importI, importJ := paths[i], paths[j]
+- iHasDot := strings.Contains(string(importI), ".")
+- jHasDot := strings.Contains(string(importJ), ".")
+- if iHasDot != jHasDot {
+- return jHasDot // dot-free paths (standard packages) compare less
+- }
+- return importI < importJ
+- })
+-
+- return paths, nil
+-}
+-
+-// isDirectlyCyclical checks if imported directly imports pkg.
+-// It does not (yet) offer a full cyclical check because showing a user
+-// a list of importable packages already generates a very large list
+-// and having a few false positives in there could be worth the
+-// performance snappiness.
+-//
+-// TODO(adonovan): ensure that metadata graph is always cyclic!
+-// Many algorithms will get confused or even stuck in the
+-// presence of cycles. Then replace this function by 'false'.
+-func isDirectlyCyclical(pkg, imported *Metadata) bool {
+- _, ok := imported.DepsByPkgPath[pkg.PkgPath]
+- return ok
+-}
+diff -urN a/gopls/internal/lsp/source/linkname.go b/gopls/internal/lsp/source/linkname.go
+--- a/gopls/internal/lsp/source/linkname.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/linkname.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,136 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "errors"
+- "fmt"
+- "go/token"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-// ErrNoLinkname is returned by LinknameDefinition when no linkname
+-// directive is found at a particular position.
+-// As such it indicates that other definitions could be worth checking.
+-var ErrNoLinkname = errors.New("no linkname directive found")
+-
+-// LinknameDefinition finds the definition of the linkname directive in fh at pos.
+-// If there is no linkname directive at pos, returns ErrNoLinkname.
+-func LinknameDefinition(ctx context.Context, snapshot Snapshot, fh FileHandle, pos protocol.Position) ([]protocol.Location, error) {
+- pkgPath, name := parseLinkname(ctx, snapshot, fh, pos)
+- if pkgPath == "" {
+- return nil, ErrNoLinkname
+- }
+- return findLinkname(ctx, snapshot, fh, pos, PackagePath(pkgPath), name)
+-}
+-
+-// parseLinkname attempts to parse a go:linkname declaration at the given pos.
+-// If successful, it returns the package path and object name referenced by the second
+-// argument of the linkname directive.
+-//
+-// If the position is not in the second argument of a go:linkname directive, or parsing fails, it returns "", "".
+-func parseLinkname(ctx context.Context, snapshot Snapshot, fh FileHandle, pos protocol.Position) (pkgPath, name string) {
+- pgf, err := snapshot.ParseGo(ctx, fh, ParseFull)
+- if err != nil {
+- return "", ""
+- }
+-
+- span, err := pgf.Mapper.PositionPoint(pos)
+- if err != nil {
+- return "", ""
+- }
+- atLine := span.Line()
+- atColumn := span.Column()
+-
+- // Looking for pkgpath in '//go:linkname f pkgpath.g'.
+- // (We ignore 1-arg linkname directives.)
+- directive, column := findLinknameOnLine(pgf, atLine)
+- parts := strings.Fields(directive)
+- if len(parts) != 3 {
+- return "", ""
+- }
+-
+- // Inside 2nd arg [start, end]?
+- end := column + len(directive)
+- start := end - len(parts[2])
+- if !(start <= atColumn && atColumn <= end) {
+- return "", ""
+- }
+- linkname := parts[2]
+-
+- // Split the pkg path from the name.
+- dot := strings.LastIndexByte(linkname, '.')
+- if dot < 0 {
+- return "", ""
+- }
+- return linkname[:dot], linkname[dot+1:]
+-}
+-
+-// findLinknameOnLine returns the first linkname directive on line and the column it starts at.
+-// Returns "", 0 if no linkname directive is found on the line.
+-func findLinknameOnLine(pgf *ParsedGoFile, line int) (string, int) {
+- for _, grp := range pgf.File.Comments {
+- for _, com := range grp.List {
+- if strings.HasPrefix(com.Text, "//go:linkname") {
+- p := safetoken.Position(pgf.Tok, com.Pos())
+- if p.Line == line {
+- return com.Text, p.Column
+- }
+- }
+- }
+- }
+- return "", 0
+-}
+-
+-// findLinkname searches dependencies of packages containing fh for an object
+-// with linker name matching the given package path and name.
+-func findLinkname(ctx context.Context, snapshot Snapshot, fh FileHandle, pos protocol.Position, pkgPath PackagePath, name string) ([]protocol.Location, error) {
+- // Typically the linkname refers to a forward dependency
+- // or a reverse dependency, but in general it may refer
+- // to any package in the workspace.
+- var pkgMeta *Metadata
+- metas, err := snapshot.AllMetadata(ctx)
+- if err != nil {
+- return nil, err
+- }
+- metas = RemoveIntermediateTestVariants(metas)
+- for _, meta := range metas {
+- if meta.PkgPath == pkgPath {
+- pkgMeta = meta
+- break
+- }
+- }
+- if pkgMeta == nil {
+- return nil, fmt.Errorf("cannot find package %q", pkgPath)
+- }
+-
+- // When found, type check the desired package (snapshot.TypeCheck in TypecheckFull mode),
+- pkgs, err := snapshot.TypeCheck(ctx, pkgMeta.ID)
+- if err != nil {
+- return nil, err
+- }
+- pkg := pkgs[0]
+-
+- obj := pkg.GetTypes().Scope().Lookup(name)
+- if obj == nil {
+- return nil, fmt.Errorf("package %q does not define %s", pkgPath, name)
+- }
+-
+- objURI := safetoken.StartPosition(pkg.FileSet(), obj.Pos())
+- pgf, err := pkg.File(span.URIFromPath(objURI.Filename))
+- if err != nil {
+- return nil, err
+- }
+- loc, err := pgf.PosLocation(obj.Pos(), obj.Pos()+token.Pos(len(name)))
+- if err != nil {
+- return nil, err
+- }
+- return []protocol.Location{loc}, nil
+-}
+diff -urN a/gopls/internal/lsp/source/methodsets/methodsets.go b/gopls/internal/lsp/source/methodsets/methodsets.go
+--- a/gopls/internal/lsp/source/methodsets/methodsets.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/methodsets/methodsets.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,508 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package methodsets defines an incremental, serializable index of
+-// method-set information that allows efficient 'implements' queries
+-// across packages of the workspace without using the type checker.
+-//
+-// This package provides only the "global" (all workspace) search; the
+-// "local" search within a given package uses a different
+-// implementation based on type-checker data structures for a single
+-// package plus variants; see ../implementation2.go.
+-// The local algorithm is more precise as it tests function-local types too.
+-//
+-// A global index of function-local types is challenging since they
+-// may reference other local types, for which we would need to invent
+-// stable names, an unsolved problem described in passing in Go issue
+-// 57497. The global algorithm also does not index anonymous interface
+-// types, even outside function bodies.
+-//
+-// Consequently, global results are not symmetric: applying the
+-// operation twice may not get you back where you started.
+-package methodsets
+-
+-// DESIGN
+-//
+-// See https://go.dev/cl/452060 for a minimal exposition of the algorithm.
+-//
+-// For each method, we compute a fingerprint: a string representing
+-// the method name and type such that equal fingerprint strings mean
+-// identical method types.
+-//
+-// For efficiency, the fingerprint is reduced to a single bit
+-// of a uint64, so that the method set can be represented as
+-// the union of those method bits (a uint64 bitmask).
+-// Assignability thus reduces to a subset check on bitmasks
+-// followed by equality checks on fingerprints.
+-//
+-// In earlier experiments, using 128-bit masks instead of 64 reduced
+-// the number of candidates by about 2x. Using (like a Bloom filter) a
+-// different hash function to compute a second 64-bit mask and
+-// performing a second mask test reduced it by about 4x.
+-// Neither had much effect on the running time, presumably because a
+-// single 64-bit mask is quite effective. See CL 452060 for details.
+-
+-import (
+- "bytes"
+- "encoding/gob"
+- "fmt"
+- "go/token"
+- "go/types"
+- "hash/crc32"
+- "log"
+- "strconv"
+- "strings"
+-
+- "golang.org/x/tools/go/types/objectpath"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/internal/typeparams"
+- "golang.org/x/tools/internal/typesinternal"
+-)
+-
+-// An Index records the non-empty method sets of all package-level
+-// types in a package in a form that permits assignability queries
+-// without the type checker.
+-type Index struct {
+- pkg gobPackage
+-}
+-
+-// Decode decodes the given gob-encoded data as an Index.
+-func Decode(data []byte) *Index {
+- var pkg gobPackage
+- mustDecode(data, &pkg)
+- return &Index{pkg}
+-}
+-
+-// Encode encodes the receiver as gob-encoded data.
+-func (index *Index) Encode() []byte {
+- return mustEncode(index.pkg)
+-}
+-
+-func mustEncode(x interface{}) []byte {
+- var buf bytes.Buffer
+- if err := gob.NewEncoder(&buf).Encode(x); err != nil {
+- log.Fatalf("internal error encoding %T: %v", x, err)
+- }
+- return buf.Bytes()
+-}
+-
+-func mustDecode(data []byte, ptr interface{}) {
+- if err := gob.NewDecoder(bytes.NewReader(data)).Decode(ptr); err != nil {
+- log.Fatalf("internal error decoding %T: %v", ptr, err)
+- }
+-}
+-
+-// NewIndex returns a new index of method-set information for all
+-// package-level types in the specified package.
+-func NewIndex(fset *token.FileSet, pkg *types.Package) *Index {
+- return new(indexBuilder).build(fset, pkg)
+-}
+-
+-// A Location records the extent of an identifier in byte-offset form.
+-//
+-// Conversion to protocol (UTF-16) form is done by the caller after a
+-// search, not during index construction.
+-type Location struct {
+- Filename string
+- Start, End int // byte offsets
+-}
+-
+-// A Key represents the method set of a given type in a form suitable
+-// to pass to the (*Index).Search method of many different Indexes.
+-type Key struct {
+- mset gobMethodSet // note: lacks position information
+-}
+-
+-// KeyOf returns the search key for the method sets of a given type.
+-// It returns false if the type has no methods.
+-func KeyOf(t types.Type) (Key, bool) {
+- mset := methodSetInfo(t, nil)
+- if mset.Mask == 0 {
+- return Key{}, false // no methods
+- }
+- return Key{mset}, true
+-}
+-
+-// A Result reports a matching type or method in a method-set search.
+-type Result struct {
+- Location Location // location of the type or method
+-
+- // methods only:
+- PkgPath string // path of declaring package (may differ due to embedding)
+- ObjectPath objectpath.Path // path of method within declaring package
+-}
+-
+-// Search reports each type that implements (or is implemented by) the
+-// type that produced the search key. If methodID is nonempty, only
+-// that method of each type is reported.
+-//
+-// The result does not include the error.Error method.
+-// TODO(adonovan): give this special case a more systematic treatment.
+-func (index *Index) Search(key Key, methodID string) []Result {
+- var results []Result
+- for _, candidate := range index.pkg.MethodSets {
+- // Traditionally this feature doesn't report
+- // interface/interface elements of the relation.
+- // I think that's a mistake.
+- // TODO(adonovan): UX: change it, here and in the local implementation.
+- if candidate.IsInterface && key.mset.IsInterface {
+- continue
+- }
+- if !satisfies(candidate, key.mset) && !satisfies(key.mset, candidate) {
+- continue
+- }
+-
+- if candidate.Tricky {
+- // If any interface method is tricky then extra
+- // checking may be needed to eliminate a false positive.
+- // TODO(adonovan): implement it.
+- }
+-
+- if methodID == "" {
+- results = append(results, Result{Location: index.location(candidate.Posn)})
+- } else {
+- for _, m := range candidate.Methods {
+- // Here we exploit knowledge of the shape of the fingerprint string.
+- if strings.HasPrefix(m.Fingerprint, methodID) &&
+- m.Fingerprint[len(methodID)] == '(' {
+-
+- // Don't report error.Error among the results:
+- // it has no true source location, no package,
+- // and is excluded from the xrefs index.
+- if m.PkgPath == 0 || m.ObjectPath == 0 {
+- if methodID != "Error" {
+- panic("missing info for" + methodID)
+- }
+- continue
+- }
+-
+- results = append(results, Result{
+- Location: index.location(m.Posn),
+- PkgPath: index.pkg.Strings[m.PkgPath],
+- ObjectPath: objectpath.Path(index.pkg.Strings[m.ObjectPath]),
+- })
+- break
+- }
+- }
+- }
+- }
+- return results
+-}
+-
+-// satisfies does a fast check for whether x satisfies y.
+-func satisfies(x, y gobMethodSet) bool {
+- return y.IsInterface && x.Mask&y.Mask == y.Mask && subset(y, x)
+-}
+-
+-// subset reports whether method set x is a subset of y.
+-func subset(x, y gobMethodSet) bool {
+-outer:
+- for _, mx := range x.Methods {
+- for _, my := range y.Methods {
+- if mx.Sum == my.Sum && mx.Fingerprint == my.Fingerprint {
+- continue outer // found; try next x method
+- }
+- }
+- return false // method of x not found in y
+- }
+- return true // all methods of x found in y
+-}
+-
+-func (index *Index) location(posn gobPosition) Location {
+- return Location{
+- Filename: index.pkg.Strings[posn.File],
+- Start: posn.Offset,
+- End: posn.Offset + posn.Len,
+- }
+-}
+-
+-// An indexBuilder builds an index for a single package.
+-type indexBuilder struct {
+- gobPackage
+- stringIndex map[string]int
+-}
+-
+-// build adds to the index all package-level named types of the specified package.
+-func (b *indexBuilder) build(fset *token.FileSet, pkg *types.Package) *Index {
+- _ = b.string("") // 0 => ""
+-
+- objectPos := func(obj types.Object) gobPosition {
+- posn := safetoken.StartPosition(fset, obj.Pos())
+- return gobPosition{b.string(posn.Filename), posn.Offset, len(obj.Name())}
+- }
+-
+- objectpathFor := typesinternal.NewObjectpathFunc()
+-
+- // setindexInfo sets the (Posn, PkgPath, ObjectPath) fields for each method declaration.
+- setIndexInfo := func(m *gobMethod, method *types.Func) {
+- // error.Error has empty Position, PkgPath, and ObjectPath.
+- if method.Pkg() == nil {
+- return
+- }
+-
+- m.Posn = objectPos(method)
+- m.PkgPath = b.string(method.Pkg().Path())
+-
+- // Instantiations of generic methods don't have an
+- // object path, so we use the generic.
+- if p, err := objectpathFor(typeparams.OriginMethod(method)); err != nil {
+- panic(err) // can't happen for a method of a package-level type
+- } else {
+- m.ObjectPath = b.string(string(p))
+- }
+- }
+-
+- // We ignore aliases, though in principle they could define a
+- // struct{...} or interface{...} type, or an instantiation of
+- // a generic, that has a novel method set.
+- scope := pkg.Scope()
+- for _, name := range scope.Names() {
+- if tname, ok := scope.Lookup(name).(*types.TypeName); ok && !tname.IsAlias() {
+- if mset := methodSetInfo(tname.Type(), setIndexInfo); mset.Mask != 0 {
+- mset.Posn = objectPos(tname)
+- // Only record types with non-trivial method sets.
+- b.MethodSets = append(b.MethodSets, mset)
+- }
+- }
+- }
+-
+- return &Index{pkg: b.gobPackage}
+-}
+-
+-// string returns a small integer that encodes the string.
+-func (b *indexBuilder) string(s string) int {
+- i, ok := b.stringIndex[s]
+- if !ok {
+- i = len(b.Strings)
+- if b.stringIndex == nil {
+- b.stringIndex = make(map[string]int)
+- }
+- b.stringIndex[s] = i
+- b.Strings = append(b.Strings, s)
+- }
+- return i
+-}
+-
+-// methodSetInfo returns the method-set fingerprint of a type.
+-// It calls the optional setIndexInfo function for each gobMethod.
+-// This is used during index construction, but not search (KeyOf),
+-// to store extra information.
+-func methodSetInfo(t types.Type, setIndexInfo func(*gobMethod, *types.Func)) gobMethodSet {
+- // For non-interface types, use *T
+- // (if T is not already a pointer)
+- // since it may have more methods.
+- mset := types.NewMethodSet(EnsurePointer(t))
+-
+- // Convert the method set into a compact summary.
+- var mask uint64
+- tricky := false
+- methods := make([]gobMethod, mset.Len())
+- for i := 0; i < mset.Len(); i++ {
+- m := mset.At(i).Obj().(*types.Func)
+- fp, isTricky := fingerprint(m)
+- if isTricky {
+- tricky = true
+- }
+- sum := crc32.ChecksumIEEE([]byte(fp))
+- methods[i] = gobMethod{Fingerprint: fp, Sum: sum}
+- if setIndexInfo != nil {
+- setIndexInfo(&methods[i], m) // set Position, PkgPath, ObjectPath
+- }
+- mask |= 1 << uint64(((sum>>24)^(sum>>16)^(sum>>8)^sum)&0x3f)
+- }
+- return gobMethodSet{
+- IsInterface: types.IsInterface(t),
+- Tricky: tricky,
+- Mask: mask,
+- Methods: methods,
+- }
+-}
+-
+-// EnsurePointer wraps T in a types.Pointer if T is a named, non-interface type.
+-// This is useful to make sure you consider a named type's full method set.
+-func EnsurePointer(T types.Type) types.Type {
+- if _, ok := T.(*types.Named); ok && !types.IsInterface(T) {
+- return types.NewPointer(T)
+- }
+-
+- return T
+-}
+-
+-// fingerprint returns an encoding of a method signature such that two
+-// methods with equal encodings have identical types, except for a few
+-// tricky types whose encodings may spuriously match and whose exact
+-// identity computation requires the type checker to eliminate false
+-// positives (which are rare). The boolean result indicates whether
+-// the result was one of these tricky types.
+-//
+-// In the standard library, 99.8% of package-level types have a
+-// non-tricky method-set. The most common exceptions are due to type
+-// parameters.
+-//
+-// The fingerprint string starts with method.Id() + "(".
+-func fingerprint(method *types.Func) (string, bool) {
+- var buf strings.Builder
+- tricky := false
+- var fprint func(t types.Type)
+- fprint = func(t types.Type) {
+- switch t := t.(type) {
+- case *types.Named:
+- tname := t.Obj()
+- if tname.Pkg() != nil {
+- buf.WriteString(strconv.Quote(tname.Pkg().Path()))
+- buf.WriteByte('.')
+- } else if tname.Name() != "error" {
+- panic(tname) // error is the only named type with no package
+- }
+- buf.WriteString(tname.Name())
+-
+- case *types.Array:
+- fmt.Fprintf(&buf, "[%d]", t.Len())
+- fprint(t.Elem())
+-
+- case *types.Slice:
+- buf.WriteString("[]")
+- fprint(t.Elem())
+-
+- case *types.Pointer:
+- buf.WriteByte('*')
+- fprint(t.Elem())
+-
+- case *types.Map:
+- buf.WriteString("map[")
+- fprint(t.Key())
+- buf.WriteByte(']')
+- fprint(t.Elem())
+-
+- case *types.Chan:
+- switch t.Dir() {
+- case types.SendRecv:
+- buf.WriteString("chan ")
+- case types.SendOnly:
+- buf.WriteString("<-chan ")
+- case types.RecvOnly:
+- buf.WriteString("chan<- ")
+- }
+- fprint(t.Elem())
+-
+- case *types.Tuple:
+- buf.WriteByte('(')
+- for i := 0; i < t.Len(); i++ {
+- if i > 0 {
+- buf.WriteByte(',')
+- }
+- fprint(t.At(i).Type())
+- }
+- buf.WriteByte(')')
+-
+- case *types.Basic:
+- // Use canonical names for uint8 and int32 aliases.
+- switch t.Kind() {
+- case types.Byte:
+- buf.WriteString("byte")
+- case types.Rune:
+- buf.WriteString("rune")
+- default:
+- buf.WriteString(t.String())
+- }
+-
+- case *types.Signature:
+- buf.WriteString("func")
+- fprint(t.Params())
+- if t.Variadic() {
+- buf.WriteString("...") // not quite Go syntax
+- }
+- fprint(t.Results())
+-
+- case *types.Struct:
+- // Non-empty unnamed struct types in method
+- // signatures are vanishingly rare.
+- buf.WriteString("struct{")
+- for i := 0; i < t.NumFields(); i++ {
+- if i > 0 {
+- buf.WriteByte(';')
+- }
+- f := t.Field(i)
+- // This isn't quite right for embedded type aliases.
+- // (See types.TypeString(StructType) and #44410 for context.)
+- // But this is vanishingly rare.
+- if !f.Embedded() {
+- buf.WriteString(f.Id())
+- buf.WriteByte(' ')
+- }
+- fprint(f.Type())
+- if tag := t.Tag(i); tag != "" {
+- buf.WriteByte(' ')
+- buf.WriteString(strconv.Quote(tag))
+- }
+- }
+- buf.WriteString("}")
+-
+- case *types.Interface:
+- if t.NumMethods() == 0 {
+- buf.WriteString("any") // common case
+- } else {
+- // Interface assignability is particularly
+- // tricky due to the possibility of recursion.
+- tricky = true
+- // We could still give more disambiguating precision
+- // than "..." if we wanted to.
+- buf.WriteString("interface{...}")
+- }
+-
+- case *typeparams.TypeParam:
+- tricky = true
+- // TODO(adonovan): refine this by adding a numeric suffix
+- // indicating the index among the receiver type's parameters.
+- buf.WriteByte('?')
+-
+- default: // incl. *types.Union
+- panic(t)
+- }
+- }
+-
+- buf.WriteString(method.Id()) // e.g. "pkg.Type"
+- sig := method.Type().(*types.Signature)
+- fprint(sig.Params())
+- fprint(sig.Results())
+- return buf.String(), tricky
+-}
+-
+-// -- serial format of index --
+-
+-// The cost of gob encoding and decoding for most packages in x/tools
+-// is under 50us, with occasional peaks of around 1-3ms.
+-// The encoded indexes are around 1KB-50KB.
+-
+-// A gobPackage records the method set of each package-level type for a single package.
+-type gobPackage struct {
+- Strings []string // index of strings used by gobPosition.File, gobMethod.{Pkg,Object}Path
+- MethodSets []gobMethodSet
+-}
+-
+-// A gobMethodSet records the method set of a single type.
+-type gobMethodSet struct {
+- Posn gobPosition
+- IsInterface bool
+- Tricky bool // at least one method is tricky; assignability requires go/types
+- Mask uint64 // mask with 1 bit from each of methods[*].sum
+- Methods []gobMethod
+-}
+-
+-// A gobMethod records the name, type, and position of a single method.
+-type gobMethod struct {
+- Fingerprint string // string of form "methodID(params...)(results)"
+- Sum uint32 // checksum of fingerprint
+-
+- // index records only (zero in KeyOf; also for index of error.Error).
+- Posn gobPosition // location of method declaration
+- PkgPath int // path of package containing method declaration
+- ObjectPath int // object path of method relative to PkgPath
+-}
+-
+-// A gobPosition records the file, offset, and length of an identifier.
+-type gobPosition struct {
+- File int // index into gobPackage.Strings
+- Offset, Len int // in bytes
+-}
+diff -urN a/gopls/internal/lsp/source/options.go b/gopls/internal/lsp/source/options.go
+--- a/gopls/internal/lsp/source/options.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/options.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1631 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "fmt"
+- "io"
+- "path/filepath"
+- "regexp"
+- "runtime"
+- "strings"
+- "sync"
+- "time"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/analysis/passes/asmdecl"
+- "golang.org/x/tools/go/analysis/passes/assign"
+- "golang.org/x/tools/go/analysis/passes/atomic"
+- "golang.org/x/tools/go/analysis/passes/atomicalign"
+- "golang.org/x/tools/go/analysis/passes/bools"
+- "golang.org/x/tools/go/analysis/passes/buildtag"
+- "golang.org/x/tools/go/analysis/passes/cgocall"
+- "golang.org/x/tools/go/analysis/passes/composite"
+- "golang.org/x/tools/go/analysis/passes/copylock"
+- "golang.org/x/tools/go/analysis/passes/deepequalerrors"
+- "golang.org/x/tools/go/analysis/passes/directive"
+- "golang.org/x/tools/go/analysis/passes/errorsas"
+- "golang.org/x/tools/go/analysis/passes/fieldalignment"
+- "golang.org/x/tools/go/analysis/passes/httpresponse"
+- "golang.org/x/tools/go/analysis/passes/ifaceassert"
+- "golang.org/x/tools/go/analysis/passes/loopclosure"
+- "golang.org/x/tools/go/analysis/passes/lostcancel"
+- "golang.org/x/tools/go/analysis/passes/nilfunc"
+- "golang.org/x/tools/go/analysis/passes/nilness"
+- "golang.org/x/tools/go/analysis/passes/printf"
+- "golang.org/x/tools/go/analysis/passes/shadow"
+- "golang.org/x/tools/go/analysis/passes/shift"
+- "golang.org/x/tools/go/analysis/passes/sortslice"
+- "golang.org/x/tools/go/analysis/passes/stdmethods"
+- "golang.org/x/tools/go/analysis/passes/stringintconv"
+- "golang.org/x/tools/go/analysis/passes/structtag"
+- "golang.org/x/tools/go/analysis/passes/testinggoroutine"
+- "golang.org/x/tools/go/analysis/passes/tests"
+- "golang.org/x/tools/go/analysis/passes/timeformat"
+- "golang.org/x/tools/go/analysis/passes/unmarshal"
+- "golang.org/x/tools/go/analysis/passes/unreachable"
+- "golang.org/x/tools/go/analysis/passes/unsafeptr"
+- "golang.org/x/tools/go/analysis/passes/unusedresult"
+- "golang.org/x/tools/go/analysis/passes/unusedwrite"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/embeddirective"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/fillreturns"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/fillstruct"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/infertypeargs"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/nonewvars"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/noresultvalues"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/simplifycompositelit"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/simplifyrange"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/simplifyslice"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/stubmethods"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/undeclaredname"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/unusedparams"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/unusedvariable"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/useany"
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/diff"
+- "golang.org/x/tools/internal/diff/myers"
+-)
+-
+-var (
+- optionsOnce sync.Once
+- defaultOptions *Options
+-)
+-
+-// DefaultOptions is the options that are used for Gopls execution independent
+-// of any externally provided configuration (LSP initialization, command
+-// invocation, etc.).
+-func DefaultOptions() *Options {
+- optionsOnce.Do(func() {
+- var commands []string
+- for _, c := range command.Commands {
+- commands = append(commands, c.ID())
+- }
+- defaultOptions = &Options{
+- ClientOptions: ClientOptions{
+- InsertTextFormat: protocol.PlainTextTextFormat,
+- PreferredContentFormat: protocol.Markdown,
+- ConfigurationSupported: true,
+- DynamicConfigurationSupported: true,
+- DynamicRegistrationSemanticTokensSupported: true,
+- DynamicWatchedFilesSupported: true,
+- LineFoldingOnly: false,
+- HierarchicalDocumentSymbolSupport: true,
+- },
+- ServerOptions: ServerOptions{
+- SupportedCodeActions: map[FileKind]map[protocol.CodeActionKind]bool{
+- Go: {
+- protocol.SourceFixAll: true,
+- protocol.SourceOrganizeImports: true,
+- protocol.QuickFix: true,
+- protocol.RefactorRewrite: true,
+- protocol.RefactorExtract: true,
+- },
+- Mod: {
+- protocol.SourceOrganizeImports: true,
+- protocol.QuickFix: true,
+- },
+- Work: {},
+- Sum: {},
+- Tmpl: {},
+- },
+- SupportedCommands: commands,
+- },
+- UserOptions: UserOptions{
+- BuildOptions: BuildOptions{
+- ExpandWorkspaceToModule: true,
+- MemoryMode: ModeNormal,
+- DirectoryFilters: []string{"-**/node_modules"},
+- TemplateExtensions: []string{},
+- StandaloneTags: []string{"ignore"},
+- },
+- UIOptions: UIOptions{
+- DiagnosticOptions: DiagnosticOptions{
+- DiagnosticsDelay: 250 * time.Millisecond,
+- Annotations: map[Annotation]bool{
+- Bounds: true,
+- Escape: true,
+- Inline: true,
+- Nil: true,
+- },
+- Vulncheck: ModeVulncheckOff,
+- },
+- InlayHintOptions: InlayHintOptions{},
+- DocumentationOptions: DocumentationOptions{
+- HoverKind: FullDocumentation,
+- LinkTarget: "pkg.go.dev",
+- LinksInHover: true,
+- },
+- NavigationOptions: NavigationOptions{
+- ImportShortcut: BothShortcuts,
+- SymbolMatcher: SymbolFastFuzzy,
+- SymbolStyle: DynamicSymbols,
+- },
+- CompletionOptions: CompletionOptions{
+- Matcher: Fuzzy,
+- CompletionBudget: 100 * time.Millisecond,
+- ExperimentalPostfixCompletions: true,
+- },
+- Codelenses: map[string]bool{
+- string(command.Generate): true,
+- string(command.RegenerateCgo): true,
+- string(command.Tidy): true,
+- string(command.GCDetails): false,
+- string(command.UpgradeDependency): true,
+- string(command.Vendor): true,
+- // TODO(hyangah): enable command.RunGovulncheck.
+- },
+- },
+- },
+- InternalOptions: InternalOptions{
+- LiteralCompletions: true,
+- TempModfile: true,
+- CompleteUnimported: true,
+- CompletionDocumentation: true,
+- DeepCompletion: true,
+- ChattyDiagnostics: true,
+- NewDiff: "both",
+- },
+- Hooks: Hooks{
+- // TODO(adonovan): switch to new diff.Strings implementation.
+- ComputeEdits: myers.ComputeEdits,
+- URLRegexp: urlRegexp(),
+- DefaultAnalyzers: defaultAnalyzers(),
+- TypeErrorAnalyzers: typeErrorAnalyzers(),
+- ConvenienceAnalyzers: convenienceAnalyzers(),
+- StaticcheckAnalyzers: map[string]*Analyzer{},
+- GoDiff: true,
+- },
+- }
+- })
+- return defaultOptions
+-}
+-
+-// Options holds various configuration that affects Gopls execution, organized
+-// by the nature or origin of the settings.
+-type Options struct {
+- ClientOptions
+- ServerOptions
+- UserOptions
+- InternalOptions
+- Hooks
+-}
+-
+-// ClientOptions holds LSP-specific configuration that is provided by the
+-// client.
+-type ClientOptions struct {
+- InsertTextFormat protocol.InsertTextFormat
+- ConfigurationSupported bool
+- DynamicConfigurationSupported bool
+- DynamicRegistrationSemanticTokensSupported bool
+- DynamicWatchedFilesSupported bool
+- PreferredContentFormat protocol.MarkupKind
+- LineFoldingOnly bool
+- HierarchicalDocumentSymbolSupport bool
+- SemanticTypes []string
+- SemanticMods []string
+- RelatedInformationSupported bool
+- CompletionTags bool
+- CompletionDeprecated bool
+- SupportedResourceOperations []protocol.ResourceOperationKind
+-}
+-
+-// ServerOptions holds LSP-specific configuration that is provided by the
+-// server.
+-type ServerOptions struct {
+- SupportedCodeActions map[FileKind]map[protocol.CodeActionKind]bool
+- SupportedCommands []string
+-}
+-
+-type BuildOptions struct {
+- // BuildFlags is the set of flags passed on to the build system when invoked.
+- // It is applied to queries like `go list`, which is used when discovering files.
+- // The most common use is to set `-tags`.
+- BuildFlags []string
+-
+- // Env adds environment variables to external commands run by `gopls`, most notably `go list`.
+- Env map[string]string
+-
+- // DirectoryFilters can be used to exclude unwanted directories from the
+- // workspace. By default, all directories are included. Filters are an
+- // operator, `+` to include and `-` to exclude, followed by a path prefix
+- // relative to the workspace folder. They are evaluated in order, and
+- // the last filter that applies to a path controls whether it is included.
+- // The path prefix can be empty, so an initial `-` excludes everything.
+- //
+- // DirectoryFilters also supports the `**` operator to match 0 or more directories.
+- //
+- // Examples:
+- //
+- // Exclude node_modules at current depth: `-node_modules`
+- //
+- // Exclude node_modules at any depth: `-**/node_modules`
+- //
+- // Include only project_a: `-` (exclude everything), `+project_a`
+- //
+- // Include only project_a, but not node_modules inside it: `-`, `+project_a`, `-project_a/node_modules`
+- DirectoryFilters []string
+-
+- // TemplateExtensions gives the extensions of file names that are treateed
+- // as template files. (The extension
+- // is the part of the file name after the final dot.)
+- TemplateExtensions []string
+-
+- // MemoryMode controls the tradeoff `gopls` makes between memory usage and
+- // correctness.
+- //
+- // Values other than `Normal` are untested and may break in surprising ways.
+- MemoryMode MemoryMode `status:"experimental"`
+-
+- // ExpandWorkspaceToModule instructs `gopls` to adjust the scope of the
+- // workspace to find the best available module root. `gopls` first looks for
+- // a go.mod file in any parent directory of the workspace folder, expanding
+- // the scope to that directory if it exists. If no viable parent directory is
+- // found, gopls will check if there is exactly one child directory containing
+- // a go.mod file, narrowing the scope to that directory if it exists.
+- ExpandWorkspaceToModule bool `status:"experimental"`
+-
+- // AllowModfileModifications disables -mod=readonly, allowing imports from
+- // out-of-scope modules. This option will eventually be removed.
+- AllowModfileModifications bool `status:"experimental"`
+-
+- // AllowImplicitNetworkAccess disables GOPROXY=off, allowing implicit module
+- // downloads rather than requiring user action. This option will eventually
+- // be removed.
+- AllowImplicitNetworkAccess bool `status:"experimental"`
+-
+- // StandaloneTags specifies a set of build constraints that identify
+- // individual Go source files that make up the entire main package of an
+- // executable.
+- //
+- // A common example of standalone main files is the convention of using the
+- // directive `//go:build ignore` to denote files that are not intended to be
+- // included in any package, for example because they are invoked directly by
+- // the developer using `go run`.
+- //
+- // Gopls considers a file to be a standalone main file if and only if it has
+- // package name "main" and has a build directive of the exact form
+- // "//go:build tag" or "// +build tag", where tag is among the list of tags
+- // configured by this setting. Notably, if the build constraint is more
+- // complicated than a simple tag (such as the composite constraint
+- // `//go:build tag && go1.18`), the file is not considered to be a standalone
+- // main file.
+- //
+- // This setting is only supported when gopls is built with Go 1.16 or later.
+- StandaloneTags []string
+-}
+-
+-type UIOptions struct {
+- DocumentationOptions
+- CompletionOptions
+- NavigationOptions
+- DiagnosticOptions
+- InlayHintOptions
+-
+- // Codelenses overrides the enabled/disabled state of code lenses. See the
+- // "Code Lenses" section of the
+- // [Settings page](https://github.com/golang/tools/blob/master/gopls/doc/settings.md#code-lenses)
+- // for the list of supported lenses.
+- //
+- // Example Usage:
+- //
+- // ```json5
+- // "gopls": {
+- // ...
+- // "codelenses": {
+- // "generate": false, // Don't show the `go generate` lens.
+- // "gc_details": true // Show a code lens toggling the display of gc's choices.
+- // }
+- // ...
+- // }
+- // ```
+- Codelenses map[string]bool
+-
+- // SemanticTokens controls whether the LSP server will send
+- // semantic tokens to the client.
+- SemanticTokens bool `status:"experimental"`
+-
+- // NoSemanticString turns off the sending of the semantic token 'string'
+- NoSemanticString bool `status:"experimental"`
+-
+- // NoSemanticNumber turns off the sending of the semantic token 'number'
+- NoSemanticNumber bool `status:"experimental"`
+-}
+-
+-type CompletionOptions struct {
+- // Placeholders enables placeholders for function parameters or struct
+- // fields in completion responses.
+- UsePlaceholders bool
+-
+- // CompletionBudget is the soft latency goal for completion requests. Most
+- // requests finish in a couple milliseconds, but in some cases deep
+- // completions can take much longer. As we use up our budget we
+- // dynamically reduce the search scope to ensure we return timely
+- // results. Zero means unlimited.
+- CompletionBudget time.Duration `status:"debug"`
+-
+- // Matcher sets the algorithm that is used when calculating completion
+- // candidates.
+- Matcher Matcher `status:"advanced"`
+-
+- // ExperimentalPostfixCompletions enables artificial method snippets
+- // such as "someSlice.sort!".
+- ExperimentalPostfixCompletions bool `status:"experimental"`
+-}
+-
+-type DocumentationOptions struct {
+- // HoverKind controls the information that appears in the hover text.
+- // SingleLine and Structured are intended for use only by authors of editor plugins.
+- HoverKind HoverKind
+-
+- // LinkTarget controls where documentation links go.
+- // It might be one of:
+- //
+- // * `"godoc.org"`
+- // * `"pkg.go.dev"`
+- //
+- // If company chooses to use its own `godoc.org`, its address can be used as well.
+- //
+- // Modules matching the GOPRIVATE environment variable will not have
+- // documentation links in hover.
+- LinkTarget string
+-
+- // LinksInHover toggles the presence of links to documentation in hover.
+- LinksInHover bool
+-}
+-
+-type FormattingOptions struct {
+- // Local is the equivalent of the `goimports -local` flag, which puts
+- // imports beginning with this string after third-party packages. It should
+- // be the prefix of the import path whose imports should be grouped
+- // separately.
+- Local string
+-
+- // Gofumpt indicates if we should run gofumpt formatting.
+- Gofumpt bool
+-}
+-
+-type DiagnosticOptions struct {
+- // Analyses specify analyses that the user would like to enable or disable.
+- // A map of the names of analysis passes that should be enabled/disabled.
+- // A full list of analyzers that gopls uses can be found in
+- // [analyzers.md](https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md).
+- //
+- // Example Usage:
+- //
+- // ```json5
+- // ...
+- // "analyses": {
+- // "unreachable": false, // Disable the unreachable analyzer.
+- // "unusedparams": true // Enable the unusedparams analyzer.
+- // }
+- // ...
+- // ```
+- Analyses map[string]bool
+-
+- // Staticcheck enables additional analyses from staticcheck.io.
+- // These analyses are documented on
+- // [Staticcheck's website](https://staticcheck.io/docs/checks/).
+- Staticcheck bool `status:"experimental"`
+-
+- // Annotations specifies the various kinds of optimization diagnostics
+- // that should be reported by the gc_details command.
+- Annotations map[Annotation]bool `status:"experimental"`
+-
+- // Vulncheck enables vulnerability scanning.
+- Vulncheck VulncheckMode `status:"experimental"`
+-
+- // DiagnosticsDelay controls the amount of time that gopls waits
+- // after the most recent file modification before computing deep diagnostics.
+- // Simple diagnostics (parsing and type-checking) are always run immediately
+- // on recently modified packages.
+- //
+- // This option must be set to a valid duration string, for example `"250ms"`.
+- DiagnosticsDelay time.Duration `status:"advanced"`
+-}
+-
+-type InlayHintOptions struct {
+- // Hints specify inlay hints that users want to see. A full list of hints
+- // that gopls uses can be found in
+- // [inlayHints.md](https://github.com/golang/tools/blob/master/gopls/doc/inlayHints.md).
+- Hints map[string]bool `status:"experimental"`
+-}
+-
+-type NavigationOptions struct {
+- // ImportShortcut specifies whether import statements should link to
+- // documentation or go to definitions.
+- ImportShortcut ImportShortcut
+-
+- // SymbolMatcher sets the algorithm that is used when finding workspace symbols.
+- SymbolMatcher SymbolMatcher `status:"advanced"`
+-
+- // SymbolStyle controls how symbols are qualified in symbol responses.
+- //
+- // Example Usage:
+- //
+- // ```json5
+- // "gopls": {
+- // ...
+- // "symbolStyle": "Dynamic",
+- // ...
+- // }
+- // ```
+- SymbolStyle SymbolStyle `status:"advanced"`
+-}
+-
+-// UserOptions holds custom Gopls configuration (not part of the LSP) that is
+-// modified by the client.
+-type UserOptions struct {
+- BuildOptions
+- UIOptions
+- FormattingOptions
+-
+- // VerboseOutput enables additional debug logging.
+- VerboseOutput bool `status:"debug"`
+-}
+-
+-// EnvSlice returns Env as a slice of k=v strings.
+-func (u *UserOptions) EnvSlice() []string {
+- var result []string
+- for k, v := range u.Env {
+- result = append(result, fmt.Sprintf("%v=%v", k, v))
+- }
+- return result
+-}
+-
+-// SetEnvSlice sets Env from a slice of k=v strings.
+-func (u *UserOptions) SetEnvSlice(env []string) {
+- u.Env = map[string]string{}
+- for _, kv := range env {
+- split := strings.SplitN(kv, "=", 2)
+- if len(split) != 2 {
+- continue
+- }
+- u.Env[split[0]] = split[1]
+- }
+-}
+-
+-// DiffFunction is the type for a function that produces a set of edits that
+-// convert from the before content to the after content.
+-type DiffFunction func(before, after string) []diff.Edit
+-
+-// Hooks contains configuration that is provided to the Gopls command by the
+-// main package.
+-type Hooks struct {
+- // LicensesText holds third party licenses for software used by gopls.
+- LicensesText string
+-
+- // GoDiff is used in gopls/hooks to get Myers' diff
+- GoDiff bool
+-
+- // Whether staticcheck is supported.
+- StaticcheckSupported bool
+-
+- // ComputeEdits is used to compute edits between file versions.
+- ComputeEdits DiffFunction
+-
+- // URLRegexp is used to find potential URLs in comments/strings.
+- //
+- // Not all matches are shown to the user: if the matched URL is not detected
+- // as valid, it will be skipped.
+- URLRegexp *regexp.Regexp
+-
+- // GofumptFormat allows the gopls module to wire-in a call to
+- // gofumpt/format.Source. langVersion and modulePath are used for some
+- // Gofumpt formatting rules -- see the Gofumpt documentation for details.
+- GofumptFormat func(ctx context.Context, langVersion, modulePath string, src []byte) ([]byte, error)
+-
+- DefaultAnalyzers map[string]*Analyzer
+- TypeErrorAnalyzers map[string]*Analyzer
+- ConvenienceAnalyzers map[string]*Analyzer
+- StaticcheckAnalyzers map[string]*Analyzer
+-}
+-
+-// InternalOptions contains settings that are not intended for use by the
+-// average user. These may be settings used by tests or outdated settings that
+-// will soon be deprecated. Some of these settings may not even be configurable
+-// by the user.
+-type InternalOptions struct {
+- // LiteralCompletions controls whether literal candidates such as
+- // "&someStruct{}" are offered. Tests disable this flag to simplify
+- // their expected values.
+- LiteralCompletions bool
+-
+- // VerboseWorkDoneProgress controls whether the LSP server should send
+- // progress reports for all work done outside the scope of an RPC.
+- // Used by the regression tests.
+- VerboseWorkDoneProgress bool
+-
+- // The following options were previously available to users, but they
+- // really shouldn't be configured by anyone other than "power users".
+-
+- // CompletionDocumentation enables documentation with completion results.
+- CompletionDocumentation bool
+-
+- // CompleteUnimported enables completion for packages that you do not
+- // currently import.
+- CompleteUnimported bool
+-
+- // DeepCompletion enables the ability to return completions from deep
+- // inside relevant entities, rather than just the locally accessible ones.
+- //
+- // Consider this example:
+- //
+- // ```go
+- // package main
+- //
+- // import "fmt"
+- //
+- // type wrapString struct {
+- // str string
+- // }
+- //
+- // func main() {
+- // x := wrapString{"hello world"}
+- // fmt.Printf(<>)
+- // }
+- // ```
+- //
+- // At the location of the `<>` in this program, deep completion would suggest
+- // the result `x.str`.
+- DeepCompletion bool
+-
+- // TempModfile controls the use of the -modfile flag in Go 1.14.
+- TempModfile bool
+-
+- // ShowBugReports causes a message to be shown when the first bug is reported
+- // on the server.
+- // This option applies only during initialization.
+- ShowBugReports bool
+-
+- // NewDiff controls the choice of the new diff implementation. It can be
+- // 'new', 'old', or 'both', which is the default. 'both' computes diffs with
+- // both algorithms, checks that the new algorithm has worked, and write some
+- // summary statistics to a file in os.TmpDir().
+- NewDiff string
+-
+- // ChattyDiagnostics controls whether to report file diagnostics for each
+- // file change. If unset, gopls only reports diagnostics when they change, or
+- // when a file is opened or closed.
+- ChattyDiagnostics bool
+-}
+-
+-type ImportShortcut string
+-
+-const (
+- BothShortcuts ImportShortcut = "Both"
+- LinkShortcut ImportShortcut = "Link"
+- DefinitionShortcut ImportShortcut = "Definition"
+-)
+-
+-func (s ImportShortcut) ShowLinks() bool {
+- return s == BothShortcuts || s == LinkShortcut
+-}
+-
+-func (s ImportShortcut) ShowDefinition() bool {
+- return s == BothShortcuts || s == DefinitionShortcut
+-}
+-
+-type Matcher string
+-
+-const (
+- Fuzzy Matcher = "Fuzzy"
+- CaseInsensitive Matcher = "CaseInsensitive"
+- CaseSensitive Matcher = "CaseSensitive"
+-)
+-
+-type SymbolMatcher string
+-
+-const (
+- SymbolFuzzy SymbolMatcher = "Fuzzy"
+- SymbolFastFuzzy SymbolMatcher = "FastFuzzy"
+- SymbolCaseInsensitive SymbolMatcher = "CaseInsensitive"
+- SymbolCaseSensitive SymbolMatcher = "CaseSensitive"
+-)
+-
+-type SymbolStyle string
+-
+-const (
+- // PackageQualifiedSymbols is package qualified symbols i.e.
+- // "pkg.Foo.Field".
+- PackageQualifiedSymbols SymbolStyle = "Package"
+- // FullyQualifiedSymbols is fully qualified symbols, i.e.
+- // "path/to/pkg.Foo.Field".
+- FullyQualifiedSymbols SymbolStyle = "Full"
+- // DynamicSymbols uses whichever qualifier results in the highest scoring
+- // match for the given symbol query. Here a "qualifier" is any "/" or "."
+- // delimited suffix of the fully qualified symbol. i.e. "to/pkg.Foo.Field" or
+- // just "Foo.Field".
+- DynamicSymbols SymbolStyle = "Dynamic"
+-)
+-
+-type HoverKind string
+-
+-const (
+- SingleLine HoverKind = "SingleLine"
+- NoDocumentation HoverKind = "NoDocumentation"
+- SynopsisDocumentation HoverKind = "SynopsisDocumentation"
+- FullDocumentation HoverKind = "FullDocumentation"
+-
+- // Structured is an experimental setting that returns a structured hover format.
+- // This format separates the signature from the documentation, so that the client
+- // can do more manipulation of these fields.
+- //
+- // This should only be used by clients that support this behavior.
+- Structured HoverKind = "Structured"
+-)
+-
+-type MemoryMode string
+-
+-const (
+- ModeNormal MemoryMode = "Normal"
+- // In DegradeClosed mode, `gopls` will collect less information about
+- // packages without open files. As a result, features like Find
+- // References and Rename will miss results in such packages.
+- ModeDegradeClosed MemoryMode = "DegradeClosed"
+-)
+-
+-type VulncheckMode string
+-
+-const (
+- // Disable vulnerability analysis.
+- ModeVulncheckOff VulncheckMode = "Off"
+- // In Imports mode, `gopls` will report vulnerabilities that affect packages
+- // directly and indirectly used by the analyzed main module.
+- ModeVulncheckImports VulncheckMode = "Imports"
+-
+- // TODO: VulncheckRequire, VulncheckCallgraph
+-)
+-
+-type OptionResults []OptionResult
+-
+-type OptionResult struct {
+- Name string
+- Value interface{}
+- Error error
+-}
+-
+-func SetOptions(options *Options, opts interface{}) OptionResults {
+- var results OptionResults
+- switch opts := opts.(type) {
+- case nil:
+- case map[string]interface{}:
+- // If the user's settings contains "allExperiments", set that first,
+- // and then let them override individual settings independently.
+- var enableExperiments bool
+- for name, value := range opts {
+- if b, ok := value.(bool); name == "allExperiments" && ok && b {
+- enableExperiments = true
+- options.EnableAllExperiments()
+- }
+- }
+- seen := map[string]struct{}{}
+- for name, value := range opts {
+- results = append(results, options.set(name, value, seen))
+- }
+- // Finally, enable any experimental features that are specified in
+- // maps, which allows users to individually toggle them on or off.
+- if enableExperiments {
+- options.enableAllExperimentMaps()
+- }
+- default:
+- results = append(results, OptionResult{
+- Value: opts,
+- Error: fmt.Errorf("Invalid options type %T", opts),
+- })
+- }
+- return results
+-}
+-
+-func (o *Options) ForClientCapabilities(caps protocol.ClientCapabilities) {
+- // Check if the client supports snippets in completion items.
+- if caps.Workspace.WorkspaceEdit != nil {
+- o.SupportedResourceOperations = caps.Workspace.WorkspaceEdit.ResourceOperations
+- }
+- if c := caps.TextDocument.Completion; c.CompletionItem.SnippetSupport {
+- o.InsertTextFormat = protocol.SnippetTextFormat
+- }
+- // Check if the client supports configuration messages.
+- o.ConfigurationSupported = caps.Workspace.Configuration
+- o.DynamicConfigurationSupported = caps.Workspace.DidChangeConfiguration.DynamicRegistration
+- o.DynamicRegistrationSemanticTokensSupported = caps.TextDocument.SemanticTokens.DynamicRegistration
+- o.DynamicWatchedFilesSupported = caps.Workspace.DidChangeWatchedFiles.DynamicRegistration
+-
+- // Check which types of content format are supported by this client.
+- if hover := caps.TextDocument.Hover; hover != nil && len(hover.ContentFormat) > 0 {
+- o.PreferredContentFormat = hover.ContentFormat[0]
+- }
+- // Check if the client supports only line folding.
+-
+- if fr := caps.TextDocument.FoldingRange; fr != nil {
+- o.LineFoldingOnly = fr.LineFoldingOnly
+- }
+- // Check if the client supports hierarchical document symbols.
+- o.HierarchicalDocumentSymbolSupport = caps.TextDocument.DocumentSymbol.HierarchicalDocumentSymbolSupport
+-
+- // Client's semantic tokens
+- o.SemanticTypes = caps.TextDocument.SemanticTokens.TokenTypes
+- o.SemanticMods = caps.TextDocument.SemanticTokens.TokenModifiers
+- // we don't need Requests, as we support full functionality
+- // we don't need Formats, as there is only one, for now
+-
+- // Check if the client supports diagnostic related information.
+- o.RelatedInformationSupported = caps.TextDocument.PublishDiagnostics.RelatedInformation
+- // Check if the client completion support includes tags (preferred) or deprecation
+- if caps.TextDocument.Completion.CompletionItem.TagSupport.ValueSet != nil {
+- o.CompletionTags = true
+- } else if caps.TextDocument.Completion.CompletionItem.DeprecatedSupport {
+- o.CompletionDeprecated = true
+- }
+-}
+-
+-func (o *Options) Clone() *Options {
+- // TODO(rfindley): has this function gone stale? It appears that there are
+- // settings that are incorrectly cloned here (such as TemplateExtensions).
+- result := &Options{
+- ClientOptions: o.ClientOptions,
+- InternalOptions: o.InternalOptions,
+- Hooks: Hooks{
+- GoDiff: o.GoDiff,
+- StaticcheckSupported: o.StaticcheckSupported,
+- ComputeEdits: o.ComputeEdits,
+- GofumptFormat: o.GofumptFormat,
+- URLRegexp: o.URLRegexp,
+- },
+- ServerOptions: o.ServerOptions,
+- UserOptions: o.UserOptions,
+- }
+- // Fully clone any slice or map fields. Only Hooks, ExperimentalOptions,
+- // and UserOptions can be modified.
+- copyStringMap := func(src map[string]bool) map[string]bool {
+- dst := make(map[string]bool)
+- for k, v := range src {
+- dst[k] = v
+- }
+- return dst
+- }
+- result.Analyses = copyStringMap(o.Analyses)
+- result.Codelenses = copyStringMap(o.Codelenses)
+-
+- copySlice := func(src []string) []string {
+- dst := make([]string, len(src))
+- copy(dst, src)
+- return dst
+- }
+- result.SetEnvSlice(o.EnvSlice())
+- result.BuildFlags = copySlice(o.BuildFlags)
+- result.DirectoryFilters = copySlice(o.DirectoryFilters)
+- result.StandaloneTags = copySlice(o.StandaloneTags)
+-
+- copyAnalyzerMap := func(src map[string]*Analyzer) map[string]*Analyzer {
+- dst := make(map[string]*Analyzer)
+- for k, v := range src {
+- dst[k] = v
+- }
+- return dst
+- }
+- result.DefaultAnalyzers = copyAnalyzerMap(o.DefaultAnalyzers)
+- result.TypeErrorAnalyzers = copyAnalyzerMap(o.TypeErrorAnalyzers)
+- result.ConvenienceAnalyzers = copyAnalyzerMap(o.ConvenienceAnalyzers)
+- result.StaticcheckAnalyzers = copyAnalyzerMap(o.StaticcheckAnalyzers)
+- return result
+-}
+-
+-func (o *Options) AddStaticcheckAnalyzer(a *analysis.Analyzer, enabled bool, severity protocol.DiagnosticSeverity) {
+- o.StaticcheckAnalyzers[a.Name] = &Analyzer{
+- Analyzer: a,
+- Enabled: enabled,
+- Severity: severity,
+- }
+-}
+-
+-// EnableAllExperiments turns on all of the experimental "off-by-default"
+-// features offered by gopls. Any experimental features specified in maps
+-// should be enabled in enableAllExperimentMaps.
+-func (o *Options) EnableAllExperiments() {
+- o.SemanticTokens = true
+-}
+-
+-func (o *Options) enableAllExperimentMaps() {
+- if _, ok := o.Codelenses[string(command.GCDetails)]; !ok {
+- o.Codelenses[string(command.GCDetails)] = true
+- }
+- if _, ok := o.Codelenses[string(command.RunGovulncheck)]; !ok {
+- o.Codelenses[string(command.RunGovulncheck)] = true
+- }
+- if _, ok := o.Analyses[unusedparams.Analyzer.Name]; !ok {
+- o.Analyses[unusedparams.Analyzer.Name] = true
+- }
+- if _, ok := o.Analyses[unusedvariable.Analyzer.Name]; !ok {
+- o.Analyses[unusedvariable.Analyzer.Name] = true
+- }
+-}
+-
+-// validateDirectoryFilter validates if the filter string
+-// - is not empty
+-// - start with either + or -
+-// - doesn't contain currently unsupported glob operators: *, ?
+-func validateDirectoryFilter(ifilter string) (string, error) {
+- filter := fmt.Sprint(ifilter)
+- if filter == "" || (filter[0] != '+' && filter[0] != '-') {
+- return "", fmt.Errorf("invalid filter %v, must start with + or -", filter)
+- }
+- segs := strings.Split(filter[1:], "/")
+- unsupportedOps := [...]string{"?", "*"}
+- for _, seg := range segs {
+- if seg != "**" {
+- for _, op := range unsupportedOps {
+- if strings.Contains(seg, op) {
+- return "", fmt.Errorf("invalid filter %v, operator %v not supported. If you want to have this operator supported, consider filing an issue.", filter, op)
+- }
+- }
+- }
+- }
+-
+- return strings.TrimRight(filepath.FromSlash(filter), "/"), nil
+-}
+-
+-func (o *Options) set(name string, value interface{}, seen map[string]struct{}) OptionResult {
+- // Flatten the name in case we get options with a hierarchy.
+- split := strings.Split(name, ".")
+- name = split[len(split)-1]
+-
+- result := OptionResult{Name: name, Value: value}
+- if _, ok := seen[name]; ok {
+- result.parseErrorf("duplicate configuration for %s", name)
+- }
+- seen[name] = struct{}{}
+-
+- switch name {
+- case "env":
+- menv, ok := value.(map[string]interface{})
+- if !ok {
+- result.parseErrorf("invalid type %T, expect map", value)
+- break
+- }
+- if o.Env == nil {
+- o.Env = make(map[string]string)
+- }
+- for k, v := range menv {
+- o.Env[k] = fmt.Sprint(v)
+- }
+-
+- case "buildFlags":
+- // TODO(rfindley): use asStringSlice.
+- iflags, ok := value.([]interface{})
+- if !ok {
+- result.parseErrorf("invalid type %T, expect list", value)
+- break
+- }
+- flags := make([]string, 0, len(iflags))
+- for _, flag := range iflags {
+- flags = append(flags, fmt.Sprintf("%s", flag))
+- }
+- o.BuildFlags = flags
+-
+- case "directoryFilters":
+- // TODO(rfindley): use asStringSlice.
+- ifilters, ok := value.([]interface{})
+- if !ok {
+- result.parseErrorf("invalid type %T, expect list", value)
+- break
+- }
+- var filters []string
+- for _, ifilter := range ifilters {
+- filter, err := validateDirectoryFilter(fmt.Sprintf("%v", ifilter))
+- if err != nil {
+- result.parseErrorf("%v", err)
+- return result
+- }
+- filters = append(filters, strings.TrimRight(filepath.FromSlash(filter), "/"))
+- }
+- o.DirectoryFilters = filters
+-
+- case "memoryMode":
+- if s, ok := result.asOneOf(
+- string(ModeNormal),
+- string(ModeDegradeClosed),
+- ); ok {
+- o.MemoryMode = MemoryMode(s)
+- }
+- case "completionDocumentation":
+- result.setBool(&o.CompletionDocumentation)
+- case "usePlaceholders":
+- result.setBool(&o.UsePlaceholders)
+- case "deepCompletion":
+- result.setBool(&o.DeepCompletion)
+- case "completeUnimported":
+- result.setBool(&o.CompleteUnimported)
+- case "completionBudget":
+- result.setDuration(&o.CompletionBudget)
+- case "matcher":
+- if s, ok := result.asOneOf(
+- string(Fuzzy),
+- string(CaseSensitive),
+- string(CaseInsensitive),
+- ); ok {
+- o.Matcher = Matcher(s)
+- }
+-
+- case "symbolMatcher":
+- if s, ok := result.asOneOf(
+- string(SymbolFuzzy),
+- string(SymbolFastFuzzy),
+- string(SymbolCaseInsensitive),
+- string(SymbolCaseSensitive),
+- ); ok {
+- o.SymbolMatcher = SymbolMatcher(s)
+- }
+-
+- case "symbolStyle":
+- if s, ok := result.asOneOf(
+- string(FullyQualifiedSymbols),
+- string(PackageQualifiedSymbols),
+- string(DynamicSymbols),
+- ); ok {
+- o.SymbolStyle = SymbolStyle(s)
+- }
+-
+- case "hoverKind":
+- if s, ok := result.asOneOf(
+- string(NoDocumentation),
+- string(SingleLine),
+- string(SynopsisDocumentation),
+- string(FullDocumentation),
+- string(Structured),
+- ); ok {
+- o.HoverKind = HoverKind(s)
+- }
+-
+- case "linkTarget":
+- result.setString(&o.LinkTarget)
+-
+- case "linksInHover":
+- result.setBool(&o.LinksInHover)
+-
+- case "importShortcut":
+- if s, ok := result.asOneOf(string(BothShortcuts), string(LinkShortcut), string(DefinitionShortcut)); ok {
+- o.ImportShortcut = ImportShortcut(s)
+- }
+-
+- case "analyses":
+- result.setBoolMap(&o.Analyses)
+-
+- case "hints":
+- result.setBoolMap(&o.Hints)
+-
+- case "annotations":
+- result.setAnnotationMap(&o.Annotations)
+-
+- case "vulncheck":
+- if s, ok := result.asOneOf(
+- string(ModeVulncheckOff),
+- string(ModeVulncheckImports),
+- ); ok {
+- o.Vulncheck = VulncheckMode(s)
+- }
+-
+- case "codelenses", "codelens":
+- var lensOverrides map[string]bool
+- result.setBoolMap(&lensOverrides)
+- if result.Error == nil {
+- if o.Codelenses == nil {
+- o.Codelenses = make(map[string]bool)
+- }
+- for lens, enabled := range lensOverrides {
+- o.Codelenses[lens] = enabled
+- }
+- }
+-
+- // codelens is deprecated, but still works for now.
+- // TODO(rstambler): Remove this for the gopls/v0.7.0 release.
+- if name == "codelens" {
+- result.deprecated("codelenses")
+- }
+-
+- case "staticcheck":
+- if v, ok := result.asBool(); ok {
+- o.Staticcheck = v
+- if v && !o.StaticcheckSupported {
+- result.Error = fmt.Errorf("applying setting %q: staticcheck is not supported at %s;"+
+- " rebuild gopls with a more recent version of Go", result.Name, runtime.Version())
+- }
+- }
+-
+- case "local":
+- result.setString(&o.Local)
+-
+- case "verboseOutput":
+- result.setBool(&o.VerboseOutput)
+-
+- case "verboseWorkDoneProgress":
+- result.setBool(&o.VerboseWorkDoneProgress)
+-
+- case "tempModfile":
+- result.setBool(&o.TempModfile)
+-
+- case "showBugReports":
+- result.setBool(&o.ShowBugReports)
+-
+- case "gofumpt":
+- if v, ok := result.asBool(); ok {
+- o.Gofumpt = v
+- if v && o.GofumptFormat == nil {
+- result.Error = fmt.Errorf("applying setting %q: gofumpt is not supported at %s;"+
+- " rebuild gopls with a more recent version of Go", result.Name, runtime.Version())
+- }
+- }
+-
+- case "semanticTokens":
+- result.setBool(&o.SemanticTokens)
+-
+- case "noSemanticString":
+- result.setBool(&o.NoSemanticString)
+-
+- case "noSemanticNumber":
+- result.setBool(&o.NoSemanticNumber)
+-
+- case "expandWorkspaceToModule":
+- result.setBool(&o.ExpandWorkspaceToModule)
+-
+- case "experimentalPostfixCompletions":
+- result.setBool(&o.ExperimentalPostfixCompletions)
+-
+- case "experimentalWorkspaceModule":
+- result.deprecated("")
+-
+- case "experimentalTemplateSupport": // TODO(pjw): remove after June 2022
+- result.deprecated("")
+-
+- case "templateExtensions":
+- if iexts, ok := value.([]interface{}); ok {
+- ans := []string{}
+- for _, x := range iexts {
+- ans = append(ans, fmt.Sprint(x))
+- }
+- o.TemplateExtensions = ans
+- break
+- }
+- if value == nil {
+- o.TemplateExtensions = nil
+- break
+- }
+- result.parseErrorf("unexpected type %T not []string", value)
+-
+- case "experimentalDiagnosticsDelay":
+- result.deprecated("diagnosticsDelay")
+-
+- case "diagnosticsDelay":
+- result.setDuration(&o.DiagnosticsDelay)
+-
+- case "experimentalWatchedFileDelay":
+- result.deprecated("")
+-
+- case "experimentalPackageCacheKey":
+- result.deprecated("")
+-
+- case "allowModfileModifications":
+- result.setBool(&o.AllowModfileModifications)
+-
+- case "allowImplicitNetworkAccess":
+- result.setBool(&o.AllowImplicitNetworkAccess)
+-
+- case "experimentalUseInvalidMetadata":
+- result.deprecated("")
+-
+- case "standaloneTags":
+- result.setStringSlice(&o.StandaloneTags)
+-
+- case "allExperiments":
+- // This setting should be handled before all of the other options are
+- // processed, so do nothing here.
+-
+- case "newDiff":
+- result.setString(&o.NewDiff)
+-
+- case "chattyDiagnostics":
+- result.setBool(&o.ChattyDiagnostics)
+-
+- // Replaced settings.
+- case "experimentalDisabledAnalyses":
+- result.deprecated("analyses")
+-
+- case "disableDeepCompletion":
+- result.deprecated("deepCompletion")
+-
+- case "disableFuzzyMatching":
+- result.deprecated("fuzzyMatching")
+-
+- case "wantCompletionDocumentation":
+- result.deprecated("completionDocumentation")
+-
+- case "wantUnimportedCompletions":
+- result.deprecated("completeUnimported")
+-
+- case "fuzzyMatching":
+- result.deprecated("matcher")
+-
+- case "caseSensitiveCompletion":
+- result.deprecated("matcher")
+-
+- // Deprecated settings.
+- case "wantSuggestedFixes":
+- result.deprecated("")
+-
+- case "noIncrementalSync":
+- result.deprecated("")
+-
+- case "watchFileChanges":
+- result.deprecated("")
+-
+- case "go-diff":
+- result.deprecated("")
+-
+- default:
+- result.unexpected()
+- }
+- return result
+-}
+-
+-// parseErrorf reports an error parsing the current configuration value.
+-func (r *OptionResult) parseErrorf(msg string, values ...interface{}) {
+- if false {
+- _ = fmt.Sprintf(msg, values...) // this causes vet to check this like printf
+- }
+- prefix := fmt.Sprintf("parsing setting %q: ", r.Name)
+- r.Error = fmt.Errorf(prefix+msg, values...)
+-}
+-
+-// A SoftError is an error that does not affect the functionality of gopls.
+-type SoftError struct {
+- msg string
+-}
+-
+-func (e *SoftError) Error() string {
+- return e.msg
+-}
+-
+-// softErrorf reports an error that does not affect the functionality of gopls
+-// (a warning in the UI).
+-// The formatted message will be shown to the user unmodified.
+-func (r *OptionResult) softErrorf(format string, values ...interface{}) {
+- msg := fmt.Sprintf(format, values...)
+- r.Error = &SoftError{msg}
+-}
+-
+-// deprecated reports the current setting as deprecated. If 'replacement' is
+-// non-nil, it is suggested to the user.
+-func (r *OptionResult) deprecated(replacement string) {
+- msg := fmt.Sprintf("gopls setting %q is deprecated", r.Name)
+- if replacement != "" {
+- msg = fmt.Sprintf("%s, use %q instead", msg, replacement)
+- }
+- r.Error = &SoftError{msg}
+-}
+-
+-// unexpected reports that the current setting is not known to gopls.
+-func (r *OptionResult) unexpected() {
+- r.Error = fmt.Errorf("unexpected gopls setting %q", r.Name)
+-}
+-
+-func (r *OptionResult) asBool() (bool, bool) {
+- b, ok := r.Value.(bool)
+- if !ok {
+- r.parseErrorf("invalid type %T, expect bool", r.Value)
+- return false, false
+- }
+- return b, true
+-}
+-
+-func (r *OptionResult) setBool(b *bool) {
+- if v, ok := r.asBool(); ok {
+- *b = v
+- }
+-}
+-
+-func (r *OptionResult) setDuration(d *time.Duration) {
+- if v, ok := r.asString(); ok {
+- parsed, err := time.ParseDuration(v)
+- if err != nil {
+- r.parseErrorf("failed to parse duration %q: %v", v, err)
+- return
+- }
+- *d = parsed
+- }
+-}
+-
+-func (r *OptionResult) setBoolMap(bm *map[string]bool) {
+- m := r.asBoolMap()
+- *bm = m
+-}
+-
+-func (r *OptionResult) setAnnotationMap(bm *map[Annotation]bool) {
+- all := r.asBoolMap()
+- if all == nil {
+- return
+- }
+- // Default to everything enabled by default.
+- m := make(map[Annotation]bool)
+- for k, enabled := range all {
+- a, err := asOneOf(
+- k,
+- string(Nil),
+- string(Escape),
+- string(Inline),
+- string(Bounds),
+- )
+- if err != nil {
+- // In case of an error, process any legacy values.
+- switch k {
+- case "noEscape":
+- m[Escape] = false
+- r.parseErrorf(`"noEscape" is deprecated, set "Escape: false" instead`)
+- case "noNilcheck":
+- m[Nil] = false
+- r.parseErrorf(`"noNilcheck" is deprecated, set "Nil: false" instead`)
+- case "noInline":
+- m[Inline] = false
+- r.parseErrorf(`"noInline" is deprecated, set "Inline: false" instead`)
+- case "noBounds":
+- m[Bounds] = false
+- r.parseErrorf(`"noBounds" is deprecated, set "Bounds: false" instead`)
+- default:
+- r.parseErrorf("%v", err)
+- }
+- continue
+- }
+- m[Annotation(a)] = enabled
+- }
+- *bm = m
+-}
+-
+-func (r *OptionResult) asBoolMap() map[string]bool {
+- all, ok := r.Value.(map[string]interface{})
+- if !ok {
+- r.parseErrorf("invalid type %T for map[string]bool option", r.Value)
+- return nil
+- }
+- m := make(map[string]bool)
+- for a, enabled := range all {
+- if e, ok := enabled.(bool); ok {
+- m[a] = e
+- } else {
+- r.parseErrorf("invalid type %T for map key %q", enabled, a)
+- return m
+- }
+- }
+- return m
+-}
+-
+-func (r *OptionResult) asString() (string, bool) {
+- b, ok := r.Value.(string)
+- if !ok {
+- r.parseErrorf("invalid type %T, expect string", r.Value)
+- return "", false
+- }
+- return b, true
+-}
+-
+-func (r *OptionResult) asStringSlice() ([]string, bool) {
+- iList, ok := r.Value.([]interface{})
+- if !ok {
+- r.parseErrorf("invalid type %T, expect list", r.Value)
+- return nil, false
+- }
+- var list []string
+- for _, elem := range iList {
+- s, ok := elem.(string)
+- if !ok {
+- r.parseErrorf("invalid element type %T, expect string", elem)
+- return nil, false
+- }
+- list = append(list, s)
+- }
+- return list, true
+-}
+-
+-func (r *OptionResult) asOneOf(options ...string) (string, bool) {
+- s, ok := r.asString()
+- if !ok {
+- return "", false
+- }
+- s, err := asOneOf(s, options...)
+- if err != nil {
+- r.parseErrorf("%v", err)
+- }
+- return s, err == nil
+-}
+-
+-func asOneOf(str string, options ...string) (string, error) {
+- lower := strings.ToLower(str)
+- for _, opt := range options {
+- if strings.ToLower(opt) == lower {
+- return opt, nil
+- }
+- }
+- return "", fmt.Errorf("invalid option %q for enum", str)
+-}
+-
+-func (r *OptionResult) setString(s *string) {
+- if v, ok := r.asString(); ok {
+- *s = v
+- }
+-}
+-
+-func (r *OptionResult) setStringSlice(s *[]string) {
+- if v, ok := r.asStringSlice(); ok {
+- *s = v
+- }
+-}
+-
+-func typeErrorAnalyzers() map[string]*Analyzer {
+- return map[string]*Analyzer{
+- fillreturns.Analyzer.Name: {
+- Analyzer: fillreturns.Analyzer,
+- ActionKind: []protocol.CodeActionKind{protocol.SourceFixAll, protocol.QuickFix},
+- Enabled: true,
+- },
+- nonewvars.Analyzer.Name: {
+- Analyzer: nonewvars.Analyzer,
+- Enabled: true,
+- },
+- noresultvalues.Analyzer.Name: {
+- Analyzer: noresultvalues.Analyzer,
+- Enabled: true,
+- },
+- undeclaredname.Analyzer.Name: {
+- Analyzer: undeclaredname.Analyzer,
+- Fix: UndeclaredName,
+- Enabled: true,
+- },
+- unusedvariable.Analyzer.Name: {
+- Analyzer: unusedvariable.Analyzer,
+- Enabled: false,
+- },
+- }
+-}
+-
+-func convenienceAnalyzers() map[string]*Analyzer {
+- return map[string]*Analyzer{
+- fillstruct.Analyzer.Name: {
+- Analyzer: fillstruct.Analyzer,
+- Fix: FillStruct,
+- Enabled: true,
+- ActionKind: []protocol.CodeActionKind{protocol.RefactorRewrite},
+- },
+- stubmethods.Analyzer.Name: {
+- Analyzer: stubmethods.Analyzer,
+- ActionKind: []protocol.CodeActionKind{protocol.RefactorRewrite},
+- Fix: StubMethods,
+- Enabled: true,
+- },
+- }
+-}
+-
+-func defaultAnalyzers() map[string]*Analyzer {
+- return map[string]*Analyzer{
+- // The traditional vet suite:
+- asmdecl.Analyzer.Name: {Analyzer: asmdecl.Analyzer, Enabled: true},
+- assign.Analyzer.Name: {Analyzer: assign.Analyzer, Enabled: true},
+- atomic.Analyzer.Name: {Analyzer: atomic.Analyzer, Enabled: true},
+- bools.Analyzer.Name: {Analyzer: bools.Analyzer, Enabled: true},
+- buildtag.Analyzer.Name: {Analyzer: buildtag.Analyzer, Enabled: true},
+- cgocall.Analyzer.Name: {Analyzer: cgocall.Analyzer, Enabled: true},
+- composite.Analyzer.Name: {Analyzer: composite.Analyzer, Enabled: true},
+- copylock.Analyzer.Name: {Analyzer: copylock.Analyzer, Enabled: true},
+- directive.Analyzer.Name: {Analyzer: directive.Analyzer, Enabled: true},
+- errorsas.Analyzer.Name: {Analyzer: errorsas.Analyzer, Enabled: true},
+- httpresponse.Analyzer.Name: {Analyzer: httpresponse.Analyzer, Enabled: true},
+- ifaceassert.Analyzer.Name: {Analyzer: ifaceassert.Analyzer, Enabled: true},
+- loopclosure.Analyzer.Name: {Analyzer: loopclosure.Analyzer, Enabled: true},
+- lostcancel.Analyzer.Name: {Analyzer: lostcancel.Analyzer, Enabled: true},
+- nilfunc.Analyzer.Name: {Analyzer: nilfunc.Analyzer, Enabled: true},
+- printf.Analyzer.Name: {Analyzer: printf.Analyzer, Enabled: true},
+- shift.Analyzer.Name: {Analyzer: shift.Analyzer, Enabled: true},
+- stdmethods.Analyzer.Name: {Analyzer: stdmethods.Analyzer, Enabled: true},
+- stringintconv.Analyzer.Name: {Analyzer: stringintconv.Analyzer, Enabled: true},
+- structtag.Analyzer.Name: {Analyzer: structtag.Analyzer, Enabled: true},
+- tests.Analyzer.Name: {Analyzer: tests.Analyzer, Enabled: true},
+- unmarshal.Analyzer.Name: {Analyzer: unmarshal.Analyzer, Enabled: true},
+- unreachable.Analyzer.Name: {Analyzer: unreachable.Analyzer, Enabled: true},
+- unsafeptr.Analyzer.Name: {Analyzer: unsafeptr.Analyzer, Enabled: true},
+- unusedresult.Analyzer.Name: {Analyzer: unusedresult.Analyzer, Enabled: true},
+-
+- // Non-vet analyzers:
+- atomicalign.Analyzer.Name: {Analyzer: atomicalign.Analyzer, Enabled: true},
+- deepequalerrors.Analyzer.Name: {Analyzer: deepequalerrors.Analyzer, Enabled: true},
+- fieldalignment.Analyzer.Name: {Analyzer: fieldalignment.Analyzer, Enabled: false},
+- nilness.Analyzer.Name: {Analyzer: nilness.Analyzer, Enabled: false},
+- shadow.Analyzer.Name: {Analyzer: shadow.Analyzer, Enabled: false},
+- sortslice.Analyzer.Name: {Analyzer: sortslice.Analyzer, Enabled: true},
+- testinggoroutine.Analyzer.Name: {Analyzer: testinggoroutine.Analyzer, Enabled: true},
+- unusedparams.Analyzer.Name: {Analyzer: unusedparams.Analyzer, Enabled: false},
+- unusedwrite.Analyzer.Name: {Analyzer: unusedwrite.Analyzer, Enabled: false},
+- useany.Analyzer.Name: {Analyzer: useany.Analyzer, Enabled: false},
+- infertypeargs.Analyzer.Name: {Analyzer: infertypeargs.Analyzer, Enabled: true},
+- embeddirective.Analyzer.Name: {Analyzer: embeddirective.Analyzer, Enabled: true},
+- timeformat.Analyzer.Name: {Analyzer: timeformat.Analyzer, Enabled: true},
+-
+- // gofmt -s suite:
+- simplifycompositelit.Analyzer.Name: {
+- Analyzer: simplifycompositelit.Analyzer,
+- Enabled: true,
+- ActionKind: []protocol.CodeActionKind{protocol.SourceFixAll, protocol.QuickFix},
+- },
+- simplifyrange.Analyzer.Name: {
+- Analyzer: simplifyrange.Analyzer,
+- Enabled: true,
+- ActionKind: []protocol.CodeActionKind{protocol.SourceFixAll, protocol.QuickFix},
+- },
+- simplifyslice.Analyzer.Name: {
+- Analyzer: simplifyslice.Analyzer,
+- Enabled: true,
+- ActionKind: []protocol.CodeActionKind{protocol.SourceFixAll, protocol.QuickFix},
+- },
+- }
+-}
+-
+-func urlRegexp() *regexp.Regexp {
+- // Ensure links are matched as full words, not anywhere.
+- re := regexp.MustCompile(`\b(http|ftp|https)://([\w_-]+(?:(?:\.[\w_-]+)+))([\w.,@?^=%&:/~+#-]*[\w@?^=%&/~+#-])?\b`)
+- re.Longest()
+- return re
+-}
+-
+-type APIJSON struct {
+- Options map[string][]*OptionJSON
+- Commands []*CommandJSON
+- Lenses []*LensJSON
+- Analyzers []*AnalyzerJSON
+- Hints []*HintJSON
+-}
+-
+-type OptionJSON struct {
+- Name string
+- Type string
+- Doc string
+- EnumKeys EnumKeys
+- EnumValues []EnumValue
+- Default string
+- Status string
+- Hierarchy string
+-}
+-
+-func (o *OptionJSON) String() string {
+- return o.Name
+-}
+-
+-func (o *OptionJSON) Write(w io.Writer) {
+- fmt.Fprintf(w, "**%v** *%v*\n\n", o.Name, o.Type)
+- writeStatus(w, o.Status)
+- enumValues := collectEnums(o)
+- fmt.Fprintf(w, "%v%v\nDefault: `%v`.\n\n", o.Doc, enumValues, o.Default)
+-}
+-
+-func writeStatus(section io.Writer, status string) {
+- switch status {
+- case "":
+- case "advanced":
+- fmt.Fprint(section, "**This is an advanced setting and should not be configured by most `gopls` users.**\n\n")
+- case "debug":
+- fmt.Fprint(section, "**This setting is for debugging purposes only.**\n\n")
+- case "experimental":
+- fmt.Fprint(section, "**This setting is experimental and may be deleted.**\n\n")
+- default:
+- fmt.Fprintf(section, "**Status: %s.**\n\n", status)
+- }
+-}
+-
+-var parBreakRE = regexp.MustCompile("\n{2,}")
+-
+-func collectEnums(opt *OptionJSON) string {
+- var b strings.Builder
+- write := func(name, doc string, index, len int) {
+- if doc != "" {
+- unbroken := parBreakRE.ReplaceAllString(doc, "\\\n")
+- fmt.Fprintf(&b, "* %s\n", strings.TrimSpace(unbroken))
+- } else {
+- fmt.Fprintf(&b, "* `%s`\n", name)
+- }
+- }
+- if len(opt.EnumValues) > 0 && opt.Type == "enum" {
+- b.WriteString("\nMust be one of:\n\n")
+- for i, val := range opt.EnumValues {
+- write(val.Value, val.Doc, i, len(opt.EnumValues))
+- }
+- } else if len(opt.EnumKeys.Keys) > 0 && shouldShowEnumKeysInSettings(opt.Name) {
+- b.WriteString("\nCan contain any of:\n\n")
+- for i, val := range opt.EnumKeys.Keys {
+- write(val.Name, val.Doc, i, len(opt.EnumKeys.Keys))
+- }
+- }
+- return b.String()
+-}
+-
+-func shouldShowEnumKeysInSettings(name string) bool {
+- // These fields have too many possible options to print.
+- return !(name == "analyses" || name == "codelenses" || name == "hints")
+-}
+-
+-type EnumKeys struct {
+- ValueType string
+- Keys []EnumKey
+-}
+-
+-type EnumKey struct {
+- Name string
+- Doc string
+- Default string
+-}
+-
+-type EnumValue struct {
+- Value string
+- Doc string
+-}
+-
+-type CommandJSON struct {
+- Command string
+- Title string
+- Doc string
+- ArgDoc string
+- ResultDoc string
+-}
+-
+-func (c *CommandJSON) String() string {
+- return c.Command
+-}
+-
+-func (c *CommandJSON) Write(w io.Writer) {
+- fmt.Fprintf(w, "### **%v**\nIdentifier: `%v`\n\n%v\n\n", c.Title, c.Command, c.Doc)
+- if c.ArgDoc != "" {
+- fmt.Fprintf(w, "Args:\n\n```\n%s\n```\n\n", c.ArgDoc)
+- }
+- if c.ResultDoc != "" {
+- fmt.Fprintf(w, "Result:\n\n```\n%s\n```\n\n", c.ResultDoc)
+- }
+-}
+-
+-type LensJSON struct {
+- Lens string
+- Title string
+- Doc string
+-}
+-
+-func (l *LensJSON) String() string {
+- return l.Title
+-}
+-
+-func (l *LensJSON) Write(w io.Writer) {
+- fmt.Fprintf(w, "%s (%s): %s", l.Title, l.Lens, l.Doc)
+-}
+-
+-type AnalyzerJSON struct {
+- Name string
+- Doc string
+- Default bool
+-}
+-
+-func (a *AnalyzerJSON) String() string {
+- return a.Name
+-}
+-
+-func (a *AnalyzerJSON) Write(w io.Writer) {
+- fmt.Fprintf(w, "%s (%s): %v", a.Name, a.Doc, a.Default)
+-}
+-
+-type HintJSON struct {
+- Name string
+- Doc string
+- Default bool
+-}
+-
+-func (h *HintJSON) String() string {
+- return h.Name
+-}
+-
+-func (h *HintJSON) Write(w io.Writer) {
+- fmt.Fprintf(w, "%s (%s): %v", h.Name, h.Doc, h.Default)
+-}
+diff -urN a/gopls/internal/lsp/source/options_test.go b/gopls/internal/lsp/source/options_test.go
+--- a/gopls/internal/lsp/source/options_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/options_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,206 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "testing"
+- "time"
+-)
+-
+-func TestSetOption(t *testing.T) {
+- tests := []struct {
+- name string
+- value interface{}
+- wantError bool
+- check func(Options) bool
+- }{
+- {
+- name: "symbolStyle",
+- value: "Dynamic",
+- check: func(o Options) bool { return o.SymbolStyle == DynamicSymbols },
+- },
+- {
+- name: "symbolStyle",
+- value: "",
+- wantError: true,
+- check: func(o Options) bool { return o.SymbolStyle == "" },
+- },
+- {
+- name: "symbolStyle",
+- value: false,
+- wantError: true,
+- check: func(o Options) bool { return o.SymbolStyle == "" },
+- },
+- {
+- name: "symbolMatcher",
+- value: "caseInsensitive",
+- check: func(o Options) bool { return o.SymbolMatcher == SymbolCaseInsensitive },
+- },
+- {
+- name: "completionBudget",
+- value: "2s",
+- check: func(o Options) bool { return o.CompletionBudget == 2*time.Second },
+- },
+- {
+- name: "staticcheck",
+- value: true,
+- check: func(o Options) bool { return o.Staticcheck == true },
+- wantError: true, // o.StaticcheckSupported is unset
+- },
+- {
+- name: "codelenses",
+- value: map[string]interface{}{"generate": true},
+- check: func(o Options) bool { return o.Codelenses["generate"] },
+- },
+- {
+- name: "allExperiments",
+- value: true,
+- check: func(o Options) bool {
+- return true // just confirm that we handle this setting
+- },
+- },
+- {
+- name: "hoverKind",
+- value: "FullDocumentation",
+- check: func(o Options) bool {
+- return o.HoverKind == FullDocumentation
+- },
+- },
+- {
+- name: "hoverKind",
+- value: "NoDocumentation",
+- check: func(o Options) bool {
+- return o.HoverKind == NoDocumentation
+- },
+- },
+- {
+- name: "hoverKind",
+- value: "SingleLine",
+- check: func(o Options) bool {
+- return o.HoverKind == SingleLine
+- },
+- },
+- {
+- name: "hoverKind",
+- value: "Structured",
+- check: func(o Options) bool {
+- return o.HoverKind == Structured
+- },
+- },
+- {
+- name: "ui.documentation.hoverKind",
+- value: "Structured",
+- check: func(o Options) bool {
+- return o.HoverKind == Structured
+- },
+- },
+- {
+- name: "matcher",
+- value: "Fuzzy",
+- check: func(o Options) bool {
+- return o.Matcher == Fuzzy
+- },
+- },
+- {
+- name: "matcher",
+- value: "CaseSensitive",
+- check: func(o Options) bool {
+- return o.Matcher == CaseSensitive
+- },
+- },
+- {
+- name: "matcher",
+- value: "CaseInsensitive",
+- check: func(o Options) bool {
+- return o.Matcher == CaseInsensitive
+- },
+- },
+- {
+- name: "env",
+- value: map[string]interface{}{"testing": "true"},
+- check: func(o Options) bool {
+- v, found := o.Env["testing"]
+- return found && v == "true"
+- },
+- },
+- {
+- name: "env",
+- value: []string{"invalid", "input"},
+- wantError: true,
+- check: func(o Options) bool {
+- return o.Env == nil
+- },
+- },
+- {
+- name: "directoryFilters",
+- value: []interface{}{"-node_modules", "+project_a"},
+- check: func(o Options) bool {
+- return len(o.DirectoryFilters) == 2
+- },
+- },
+- {
+- name: "directoryFilters",
+- value: []interface{}{"invalid"},
+- wantError: true,
+- check: func(o Options) bool {
+- return len(o.DirectoryFilters) == 0
+- },
+- },
+- {
+- name: "directoryFilters",
+- value: []string{"-invalid", "+type"},
+- wantError: true,
+- check: func(o Options) bool {
+- return len(o.DirectoryFilters) == 0
+- },
+- },
+- {
+- name: "annotations",
+- value: map[string]interface{}{
+- "Nil": false,
+- "noBounds": true,
+- },
+- wantError: true,
+- check: func(o Options) bool {
+- return !o.Annotations[Nil] && !o.Annotations[Bounds]
+- },
+- },
+- {
+- name: "vulncheck",
+- value: []interface{}{"invalid"},
+- wantError: true,
+- check: func(o Options) bool {
+- return o.Vulncheck == "" // For invalid value, default to 'off'.
+- },
+- },
+- {
+- name: "vulncheck",
+- value: "Imports",
+- check: func(o Options) bool {
+- return o.Vulncheck == ModeVulncheckImports // For invalid value, default to 'off'.
+- },
+- },
+- {
+- name: "vulncheck",
+- value: "imports",
+- check: func(o Options) bool {
+- return o.Vulncheck == ModeVulncheckImports
+- },
+- },
+- }
+-
+- for _, test := range tests {
+- var opts Options
+- result := opts.set(test.name, test.value, map[string]struct{}{})
+- if (result.Error != nil) != test.wantError {
+- t.Fatalf("Options.set(%q, %v): result.Error = %v, want error: %t", test.name, test.value, result.Error, test.wantError)
+- }
+- // TODO: this could be made much better using cmp.Diff, if that becomes
+- // available in this module.
+- if !test.check(opts) {
+- t.Errorf("Options.set(%q, %v): unexpected result %+v", test.name, test.value, opts)
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/source/references.go b/gopls/internal/lsp/source/references.go
+--- a/gopls/internal/lsp/source/references.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/references.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,582 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-// This file defines the 'references' query based on a serializable
+-// index constructed during type checking, thus avoiding the need to
+-// type-check packages at search time.
+-//
+-// See the ./xrefs/ subpackage for the index construction and lookup.
+-//
+-// This implementation does not intermingle objects from distinct
+-// calls to TypeCheck.
+-
+-import (
+- "context"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "sort"
+- "strings"
+- "sync"
+-
+- "golang.org/x/sync/errgroup"
+- "golang.org/x/tools/go/types/objectpath"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/lsp/source/methodsets"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-// References returns a list of all references (sorted with
+-// definitions before uses) to the object denoted by the identifier at
+-// the given file/position, searching the entire workspace.
+-func References(ctx context.Context, snapshot Snapshot, fh FileHandle, pp protocol.Position, includeDeclaration bool) ([]protocol.Location, error) {
+- references, err := references(ctx, snapshot, fh, pp, includeDeclaration)
+- if err != nil {
+- return nil, err
+- }
+- locations := make([]protocol.Location, len(references))
+- for i, ref := range references {
+- locations[i] = ref.location
+- }
+- return locations, nil
+-}
+-
+-// A reference describes an identifier that refers to the same
+-// object as the subject of a References query.
+-type reference struct {
+- isDeclaration bool
+- location protocol.Location
+- pkgPath PackagePath // of declaring package (same for all elements of the slice)
+-}
+-
+-// references returns a list of all references (sorted with
+-// definitions before uses) to the object denoted by the identifier at
+-// the given file/position, searching the entire workspace.
+-func references(ctx context.Context, snapshot Snapshot, f FileHandle, pp protocol.Position, includeDeclaration bool) ([]reference, error) {
+- ctx, done := event.Start(ctx, "source.References2")
+- defer done()
+-
+- // Is the cursor within the package name declaration?
+- _, inPackageName, err := parsePackageNameDecl(ctx, snapshot, f, pp)
+- if err != nil {
+- return nil, err
+- }
+-
+- var refs []reference
+- if inPackageName {
+- refs, err = packageReferences(ctx, snapshot, f.URI())
+- } else {
+- refs, err = ordinaryReferences(ctx, snapshot, f.URI(), pp)
+- }
+- if err != nil {
+- return nil, err
+- }
+-
+- sort.Slice(refs, func(i, j int) bool {
+- x, y := refs[i], refs[j]
+- if x.isDeclaration != y.isDeclaration {
+- return x.isDeclaration // decls < refs
+- }
+- return protocol.CompareLocation(x.location, y.location) < 0
+- })
+-
+- // De-duplicate by location, and optionally remove declarations.
+- out := refs[:0]
+- for _, ref := range refs {
+- if !includeDeclaration && ref.isDeclaration {
+- continue
+- }
+- if len(out) == 0 || out[len(out)-1].location != ref.location {
+- out = append(out, ref)
+- }
+- }
+- refs = out
+-
+- return refs, nil
+-}
+-
+-// packageReferences returns a list of references to the package
+-// declaration of the specified name and uri by searching among the
+-// import declarations of all packages that directly import the target
+-// package.
+-func packageReferences(ctx context.Context, snapshot Snapshot, uri span.URI) ([]reference, error) {
+- metas, err := snapshot.MetadataForFile(ctx, uri)
+- if err != nil {
+- return nil, err
+- }
+- if len(metas) == 0 {
+- return nil, fmt.Errorf("found no package containing %s", uri)
+- }
+-
+- var refs []reference
+-
+- // Find external references to the package declaration
+- // from each direct import of the package.
+- //
+- // The narrowest package is the most broadly imported,
+- // so we choose it for the external references.
+- //
+- // But if the file ends with _test.go then we need to
+- // find the package it is testing; there's no direct way
+- // to do that, so pick a file from the same package that
+- // doesn't end in _test.go and start over.
+- narrowest := metas[0]
+- if narrowest.ForTest != "" && strings.HasSuffix(string(uri), "_test.go") {
+- for _, f := range narrowest.CompiledGoFiles {
+- if !strings.HasSuffix(string(f), "_test.go") {
+- return packageReferences(ctx, snapshot, f)
+- }
+- }
+- // This package has no non-test files.
+- // Skip the search for external references.
+- // (Conceivably one could blank-import an empty package, but why?)
+- } else {
+- rdeps, err := snapshot.ReverseDependencies(ctx, narrowest.ID, false) // direct
+- if err != nil {
+- return nil, err
+- }
+- for _, rdep := range rdeps {
+- for _, uri := range rdep.CompiledGoFiles {
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return nil, err
+- }
+- f, err := snapshot.ParseGo(ctx, fh, ParseHeader)
+- if err != nil {
+- return nil, err
+- }
+- for _, imp := range f.File.Imports {
+- if rdep.DepsByImpPath[UnquoteImportPath(imp)] == narrowest.ID {
+- refs = append(refs, reference{
+- isDeclaration: false,
+- location: mustLocation(f, imp),
+- pkgPath: narrowest.PkgPath,
+- })
+- }
+- }
+- }
+- }
+- }
+-
+- // Find internal "references" to the package from
+- // of each package declaration in the target package itself.
+- //
+- // The widest package (possibly a test variant) has the
+- // greatest number of files and thus we choose it for the
+- // "internal" references.
+- widest := metas[len(metas)-1]
+- for _, uri := range widest.CompiledGoFiles {
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return nil, err
+- }
+- f, err := snapshot.ParseGo(ctx, fh, ParseHeader)
+- if err != nil {
+- return nil, err
+- }
+- refs = append(refs, reference{
+- isDeclaration: true, // (one of many)
+- location: mustLocation(f, f.File.Name),
+- pkgPath: widest.PkgPath,
+- })
+- }
+-
+- return refs, nil
+-}
+-
+-// ordinaryReferences computes references for all ordinary objects (not package declarations).
+-func ordinaryReferences(ctx context.Context, snapshot Snapshot, uri span.URI, pp protocol.Position) ([]reference, error) {
+- // Strategy: use the reference information computed by the
+- // type checker to find the declaration. First type-check this
+- // package to find the declaration, then type check the
+- // declaring package (which may be different), plus variants,
+- // to find local (in-package) references.
+- // Global references are satisfied by the index.
+-
+- // Strictly speaking, a wider package could provide a different
+- // declaration (e.g. because the _test.go files can change the
+- // meaning of a field or method selection), but the narrower
+- // package reports the more broadly referenced object.
+- pkg, pgf, err := PackageForFile(ctx, snapshot, uri, NarrowestPackage)
+- if err != nil {
+- return nil, err
+- }
+-
+- // Find the selected object (declaration or reference).
+- pos, err := pgf.PositionPos(pp)
+- if err != nil {
+- return nil, err
+- }
+- candidates, _, err := objectsAt(pkg.GetTypesInfo(), pgf.File, pos)
+- if err != nil {
+- return nil, err
+- }
+-
+- // Pick first object arbitrarily.
+- // The case variables of a type switch have different
+- // types but that difference is immaterial here.
+- var obj types.Object
+- for obj = range candidates {
+- break
+- }
+- if obj == nil {
+- return nil, ErrNoIdentFound // can't happen
+- }
+-
+- // nil, error, error.Error, iota, or other built-in?
+- if obj.Pkg() == nil {
+- // For some reason, existing tests require that iota has no references,
+- // nor an error. TODO(adonovan): do something more principled.
+- if obj.Name() == "iota" {
+- return nil, nil
+- }
+-
+- return nil, fmt.Errorf("references to builtin %q are not supported", obj.Name())
+- }
+-
+- // Find metadata of all packages containing the object's defining file.
+- // This may include the query pkg, and possibly other variants.
+- declPosn := safetoken.StartPosition(pkg.FileSet(), obj.Pos())
+- declURI := span.URIFromPath(declPosn.Filename)
+- variants, err := snapshot.MetadataForFile(ctx, declURI)
+- if err != nil {
+- return nil, err
+- }
+- if len(variants) == 0 {
+- return nil, fmt.Errorf("no packages for file %q", declURI) // can't happen
+- }
+-
+- // Is object exported?
+- // If so, compute scope and targets of the global search.
+- var (
+- globalScope = make(map[PackageID]*Metadata)
+- globalTargets map[PackagePath]map[objectpath.Path]unit
+- )
+- // TODO(adonovan): what about generic functions. Need to consider both
+- // uninstantiated and instantiated. The latter have no objectpath. Use Origin?
+- if path, err := objectpath.For(obj); err == nil && obj.Exported() {
+- pkgPath := variants[0].PkgPath // (all variants have same package path)
+- globalTargets = map[PackagePath]map[objectpath.Path]unit{
+- pkgPath: {path: {}}, // primary target
+- }
+-
+- // How far need we search?
+- // For package-level objects, we need only search the direct importers.
+- // For fields and methods, we must search transitively.
+- transitive := obj.Pkg().Scope().Lookup(obj.Name()) != obj
+-
+- // The scope is the union of rdeps of each variant.
+- // (Each set is disjoint so there's no benefit to
+- // to combining the metadata graph traversals.)
+- for _, m := range variants {
+- rdeps, err := snapshot.ReverseDependencies(ctx, m.ID, transitive)
+- if err != nil {
+- return nil, err
+- }
+- for id, rdep := range rdeps {
+- globalScope[id] = rdep
+- }
+- }
+-
+- // Is object a method?
+- //
+- // If so, expand the search so that the targets include
+- // all methods that correspond to it through interface
+- // satisfaction, and the scope includes the rdeps of
+- // the package that declares each corresponding type.
+- if recv := effectiveReceiver(obj); recv != nil {
+- if err := expandMethodSearch(ctx, snapshot, obj.(*types.Func), recv, globalScope, globalTargets); err != nil {
+- return nil, err
+- }
+- }
+- }
+-
+- // The search functions will call report(loc) for each hit.
+- var (
+- refsMu sync.Mutex
+- refs []reference
+- )
+- report := func(loc protocol.Location, isDecl bool) {
+- ref := reference{
+- isDeclaration: isDecl,
+- location: loc,
+- pkgPath: pkg.Metadata().PkgPath,
+- }
+- refsMu.Lock()
+- refs = append(refs, ref)
+- refsMu.Unlock()
+- }
+-
+- // Loop over the variants of the declaring package,
+- // and perform both the local (in-package) and global
+- // (cross-package) searches, in parallel.
+- //
+- // TODO(adonovan): opt: support LSP reference streaming. See:
+- // - https://github.com/microsoft/vscode-languageserver-node/pull/164
+- // - https://github.com/microsoft/language-server-protocol/pull/182
+- //
+- // Careful: this goroutine must not return before group.Wait.
+- var group errgroup.Group
+-
+- // Compute local references for each variant.
+- for _, m := range variants {
+- // We want the ordinary importable package,
+- // plus any test-augmented variants, since
+- // declarations in _test.go files may change
+- // the reference of a selection, or even a
+- // field into a method or vice versa.
+- //
+- // But we don't need intermediate test variants,
+- // as their local references will be covered
+- // already by other variants.
+- if m.IsIntermediateTestVariant() {
+- continue
+- }
+- m := m
+- group.Go(func() error {
+- return localReferences(ctx, snapshot, declURI, declPosn.Offset, m, report)
+- })
+- }
+-
+- // Compute global references for selected reverse dependencies.
+- group.Go(func() error {
+- var globalIDs []PackageID
+- for id := range globalScope {
+- globalIDs = append(globalIDs, id)
+- }
+- indexes, err := snapshot.References(ctx, globalIDs...)
+- if err != nil {
+- return err
+- }
+- for _, index := range indexes {
+- for _, loc := range index.Lookup(globalTargets) {
+- report(loc, false)
+- }
+- }
+- return nil
+- })
+-
+- if err := group.Wait(); err != nil {
+- return nil, err
+- }
+- return refs, nil
+-}
+-
+-// expandMethodSearch expands the scope and targets of a global search
+-// for an exported method to include all methods that correspond to
+-// it through interface satisfaction.
+-//
+-// recv is the method's effective receiver type, for method-set computations.
+-func expandMethodSearch(ctx context.Context, snapshot Snapshot, method *types.Func, recv types.Type, scope map[PackageID]*Metadata, targets map[PackagePath]map[objectpath.Path]unit) error {
+- // Compute the method-set fingerprint used as a key to the global search.
+- key, hasMethods := methodsets.KeyOf(recv)
+- if !hasMethods {
+- return bug.Errorf("KeyOf(%s)={} yet %s is a method", recv, method)
+- }
+- metas, err := snapshot.AllMetadata(ctx)
+- if err != nil {
+- return err
+- }
+- allIDs := make([]PackageID, 0, len(metas))
+- for _, m := range metas {
+- allIDs = append(allIDs, m.ID)
+- }
+- // Search the methodset index of each package in the workspace.
+- indexes, err := snapshot.MethodSets(ctx, allIDs...)
+- if err != nil {
+- return err
+- }
+- var mu sync.Mutex // guards scope and targets
+- var group errgroup.Group
+- for i, index := range indexes {
+- i := i
+- index := index
+- group.Go(func() error {
+- // Consult index for matching methods.
+- results := index.Search(key, method.Name())
+- if len(results) == 0 {
+- return nil
+- }
+-
+- // Expand global search scope to include rdeps of this pkg.
+- rdeps, err := snapshot.ReverseDependencies(ctx, allIDs[i], true)
+- if err != nil {
+- return err
+- }
+- mu.Lock()
+- defer mu.Unlock()
+- for _, rdep := range rdeps {
+- scope[rdep.ID] = rdep
+- }
+-
+- // Add each corresponding method the to set of global search targets.
+- for _, res := range results {
+- methodPkg := PackagePath(res.PkgPath)
+- opaths, ok := targets[methodPkg]
+- if !ok {
+- opaths = make(map[objectpath.Path]unit)
+- targets[methodPkg] = opaths
+- }
+- opaths[res.ObjectPath] = unit{}
+- }
+- return nil
+- })
+- }
+- return group.Wait()
+-}
+-
+-// localReferences reports each reference to the object
+-// declared at the specified URI/offset within its enclosing package m.
+-func localReferences(ctx context.Context, snapshot Snapshot, declURI span.URI, declOffset int, m *Metadata, report func(loc protocol.Location, isDecl bool)) error {
+- pkgs, err := snapshot.TypeCheck(ctx, m.ID)
+- if err != nil {
+- return err
+- }
+- pkg := pkgs[0] // narrowest
+-
+- // Find declaration of corresponding object
+- // in this package based on (URI, offset).
+- pgf, err := pkg.File(declURI)
+- if err != nil {
+- return err
+- }
+- pos, err := safetoken.Pos(pgf.Tok, declOffset)
+- if err != nil {
+- return err
+- }
+- targets, _, err := objectsAt(pkg.GetTypesInfo(), pgf.File, pos)
+- if err != nil {
+- return err // unreachable? (probably caught earlier)
+- }
+-
+- // Report the locations of the declaration(s).
+- // TODO(adonovan): what about for corresponding methods? Add tests.
+- for _, node := range targets {
+- report(mustLocation(pgf, node), true)
+- }
+-
+- // If we're searching for references to a method, broaden the
+- // search to include references to corresponding methods of
+- // mutually assignable receiver types.
+- // (We use a slice, but objectsAt never returns >1 methods.)
+- var methodRecvs []types.Type
+- var methodName string // name of an arbitrary target, iff a method
+- for obj := range targets {
+- if t := effectiveReceiver(obj); t != nil {
+- methodRecvs = append(methodRecvs, t)
+- methodName = obj.Name()
+- }
+- }
+-
+- // matches reports whether obj either is or corresponds to a target.
+- // (Correspondence is defined as usual for interface methods.)
+- matches := func(obj types.Object) bool {
+- if targets[obj] != nil {
+- return true
+- } else if methodRecvs != nil && obj.Name() == methodName {
+- if orecv := effectiveReceiver(obj); orecv != nil {
+- for _, mrecv := range methodRecvs {
+- if concreteImplementsIntf(orecv, mrecv) {
+- return true
+- }
+- }
+- }
+- }
+- return false
+- }
+-
+- // Scan through syntax looking for uses of one of the target objects.
+- for _, pgf := range pkg.CompiledGoFiles() {
+- ast.Inspect(pgf.File, func(n ast.Node) bool {
+- if id, ok := n.(*ast.Ident); ok {
+- if obj, ok := pkg.GetTypesInfo().Uses[id]; ok && matches(obj) {
+- report(mustLocation(pgf, id), false)
+- }
+- }
+- return true
+- })
+- }
+- return nil
+-}
+-
+-// effectiveReceiver returns the effective receiver type for method-set
+-// comparisons for obj, if it is a method, or nil otherwise.
+-func effectiveReceiver(obj types.Object) types.Type {
+- if fn, ok := obj.(*types.Func); ok {
+- if recv := fn.Type().(*types.Signature).Recv(); recv != nil {
+- return methodsets.EnsurePointer(recv.Type())
+- }
+- }
+- return nil
+-}
+-
+-// objectsAt returns the non-empty set of objects denoted (def or use)
+-// by the specified position within a file syntax tree, or an error if
+-// none were found.
+-//
+-// The result may contain more than one element because all case
+-// variables of a type switch appear to be declared at the same
+-// position.
+-//
+-// Each object is mapped to the syntax node that was treated as an
+-// identifier, which is not always an ast.Ident. The second component
+-// of the result is the innermost node enclosing pos.
+-//
+-// TODO(adonovan): factor in common with referencedObject.
+-func objectsAt(info *types.Info, file *ast.File, pos token.Pos) (map[types.Object]ast.Node, ast.Node, error) {
+- path := pathEnclosingObjNode(file, pos)
+- if path == nil {
+- return nil, nil, ErrNoIdentFound
+- }
+-
+- targets := make(map[types.Object]ast.Node)
+-
+- switch leaf := path[0].(type) {
+- case *ast.Ident:
+- // If leaf represents an implicit type switch object or the type
+- // switch "assign" variable, expand to all of the type switch's
+- // implicit objects.
+- if implicits, _ := typeSwitchImplicits(info, path); len(implicits) > 0 {
+- for _, obj := range implicits {
+- targets[obj] = leaf
+- }
+- } else {
+- obj := info.ObjectOf(leaf)
+- if obj == nil {
+- return nil, nil, fmt.Errorf("%w for %q", errNoObjectFound, leaf.Name)
+- }
+- targets[obj] = leaf
+- }
+- case *ast.ImportSpec:
+- // Look up the implicit *types.PkgName.
+- obj := info.Implicits[leaf]
+- if obj == nil {
+- return nil, nil, fmt.Errorf("%w for import %s", errNoObjectFound, UnquoteImportPath(leaf))
+- }
+- targets[obj] = leaf
+- }
+-
+- if len(targets) == 0 {
+- return nil, nil, fmt.Errorf("objectAt: internal error: no targets") // can't happen
+- }
+- return targets, path[0], nil
+-}
+-
+-// mustLocation reports the location interval a syntax node,
+-// which must belong to m.File.
+-//
+-// Safe for use only by references2 and implementations2.
+-func mustLocation(pgf *ParsedGoFile, n ast.Node) protocol.Location {
+- loc, err := pgf.NodeLocation(n)
+- if err != nil {
+- panic(err) // can't happen in references2 or implementations2
+- }
+- return loc
+-}
+diff -urN a/gopls/internal/lsp/source/rename_check.go b/gopls/internal/lsp/source/rename_check.go
+--- a/gopls/internal/lsp/source/rename_check.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/rename_check.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,921 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-//
+-// Taken from golang.org/x/tools/refactor/rename.
+-
+-package source
+-
+-// This file defines the conflict-checking portion of the rename operation.
+-//
+-// The renamer works on a single package of type-checked syntax, and
+-// is called in parallel for all necessary packages in the workspace,
+-// possibly up to the transitive reverse dependencies of the
+-// declaration. Finally the union of all edits and errors is computed.
+-//
+-// Renaming one object may entail renaming of others. For example:
+-//
+-// - An embedded field couples a Var (field) and a TypeName.
+-// So, renaming either one requires renaming the other.
+-// If the initial object is an embedded field, we must add its
+-// TypeName (and its enclosing package) to the renaming set;
+-// this is easily discovered at the outset.
+-//
+-// Conversely, if the initial object is a TypeName, we must observe
+-// whether any of its references (from directly importing packages)
+-// is coincident with an embedded field Var and, if so, initiate a
+-// renaming of it.
+-//
+-// - A method of an interface type is coupled to all corresponding
+-// methods of types that are assigned to the interface (as
+-// discovered by the 'satisfy' pass). As a matter of usability, we
+-// require that such renamings be initiated from the interface
+-// method, not the concrete method.
+-
+-import (
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "path/filepath"
+- "reflect"
+- "strings"
+- "unicode"
+-
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/refactor/satisfy"
+-)
+-
+-// errorf reports an error (e.g. conflict) and prevents file modification.
+-func (r *renamer) errorf(pos token.Pos, format string, args ...interface{}) {
+- // Conflict error messages in the old gorename tool (whence this
+- // logic originated) contain rich information associated with
+- // multiple source lines, such as:
+- //
+- // p/a.go:1:2: renaming "x" to "y" here
+- // p/b.go:3:4: \t would cause this reference to "y"
+- // p/c.go:5:5: \t to become shadowed by this intervening declaration.
+- //
+- // Unfortunately LSP provides no means to transmit the
+- // structure of this error, so we format the positions briefly
+- // using dir/file.go where dir is the base name of the parent
+- // directory.
+-
+- var conflict strings.Builder
+-
+- // Add prefix of (truncated) position.
+- if pos != token.NoPos {
+- // TODO(adonovan): skip position of first error if it is
+- // on the same line as the renaming itself.
+- posn := safetoken.StartPosition(r.pkg.FileSet(), pos).String()
+- segments := strings.Split(filepath.ToSlash(posn), "/")
+- if n := len(segments); n > 2 {
+- segments = segments[n-2:]
+- }
+- posn = strings.Join(segments, "/")
+- fmt.Fprintf(&conflict, "%s:", posn)
+-
+- if !strings.HasPrefix(format, "\t") {
+- conflict.WriteByte(' ')
+- }
+- }
+-
+- fmt.Fprintf(&conflict, format, args...)
+- r.conflicts = append(r.conflicts, conflict.String())
+-}
+-
+-// check performs safety checks of the renaming of the 'from' object to r.to.
+-func (r *renamer) check(from types.Object) {
+- if r.objsToUpdate[from] {
+- return
+- }
+- r.objsToUpdate[from] = true
+-
+- // NB: order of conditions is important.
+- if from_, ok := from.(*types.PkgName); ok {
+- r.checkInFileBlock(from_)
+- } else if from_, ok := from.(*types.Label); ok {
+- r.checkLabel(from_)
+- } else if isPackageLevel(from) {
+- r.checkInPackageBlock(from)
+- } else if v, ok := from.(*types.Var); ok && v.IsField() {
+- r.checkStructField(v)
+- } else if f, ok := from.(*types.Func); ok && recv(f) != nil {
+- r.checkMethod(f)
+- } else if isLocal(from) {
+- r.checkInLexicalScope(from)
+- } else {
+- r.errorf(from.Pos(), "unexpected %s object %q (please report a bug)\n",
+- objectKind(from), from)
+- }
+-}
+-
+-// checkInFileBlock performs safety checks for renames of objects in the file block,
+-// i.e. imported package names.
+-func (r *renamer) checkInFileBlock(from *types.PkgName) {
+- // Check import name is not "init".
+- if r.to == "init" {
+- r.errorf(from.Pos(), "%q is not a valid imported package name", r.to)
+- }
+-
+- // Check for conflicts between file and package block.
+- if prev := from.Pkg().Scope().Lookup(r.to); prev != nil {
+- r.errorf(from.Pos(), "renaming this %s %q to %q would conflict",
+- objectKind(from), from.Name(), r.to)
+- r.errorf(prev.Pos(), "\twith this package member %s",
+- objectKind(prev))
+- return // since checkInPackageBlock would report redundant errors
+- }
+-
+- // Check for conflicts in lexical scope.
+- r.checkInLexicalScope(from)
+-}
+-
+-// checkInPackageBlock performs safety checks for renames of
+-// func/var/const/type objects in the package block.
+-func (r *renamer) checkInPackageBlock(from types.Object) {
+- // Check that there are no references to the name from another
+- // package if the renaming would make it unexported.
+- if typ := r.pkg.GetTypes(); typ != from.Pkg() && ast.IsExported(r.from) && !ast.IsExported(r.to) {
+- if id := someUse(r.pkg.GetTypesInfo(), from); id != nil {
+- r.checkExport(id, typ, from)
+- }
+- }
+-
+- // Check that in the package block, "init" is a function, and never referenced.
+- if r.to == "init" {
+- kind := objectKind(from)
+- if kind == "func" {
+- // Reject if intra-package references to it exist.
+- for id, obj := range r.pkg.GetTypesInfo().Uses {
+- if obj == from {
+- r.errorf(from.Pos(),
+- "renaming this func %q to %q would make it a package initializer",
+- from.Name(), r.to)
+- r.errorf(id.Pos(), "\tbut references to it exist")
+- break
+- }
+- }
+- } else {
+- r.errorf(from.Pos(), "you cannot have a %s at package level named %q",
+- kind, r.to)
+- }
+- }
+-
+- // Check for conflicts between package block and all file blocks.
+- for _, f := range r.pkg.GetSyntax() {
+- fileScope := r.pkg.GetTypesInfo().Scopes[f]
+- b, prev := fileScope.LookupParent(r.to, token.NoPos)
+- if b == fileScope {
+- r.errorf(from.Pos(), "renaming this %s %q to %q would conflict", objectKind(from), from.Name(), r.to)
+- var prevPos token.Pos
+- if prev != nil {
+- prevPos = prev.Pos()
+- }
+- r.errorf(prevPos, "\twith this %s", objectKind(prev))
+- return // since checkInPackageBlock would report redundant errors
+- }
+- }
+-
+- // Check for conflicts in lexical scope.
+- r.checkInLexicalScope(from)
+-}
+-
+-// checkInLexicalScope performs safety checks that a renaming does not
+-// change the lexical reference structure of the specified package.
+-//
+-// For objects in lexical scope, there are three kinds of conflicts:
+-// same-, sub-, and super-block conflicts. We will illustrate all three
+-// using this example:
+-//
+-// var x int
+-// var z int
+-//
+-// func f(y int) {
+-// print(x)
+-// print(y)
+-// }
+-//
+-// Renaming x to z encounters a "same-block conflict", because an object
+-// with the new name already exists, defined in the same lexical block
+-// as the old object.
+-//
+-// Renaming x to y encounters a "sub-block conflict", because there exists
+-// a reference to x from within (what would become) a hole in its scope.
+-// The definition of y in an (inner) sub-block would cast a shadow in
+-// the scope of the renamed variable.
+-//
+-// Renaming y to x encounters a "super-block conflict". This is the
+-// converse situation: there is an existing definition of the new name
+-// (x) in an (enclosing) super-block, and the renaming would create a
+-// hole in its scope, within which there exist references to it. The
+-// new name shadows the existing definition of x in the super-block.
+-//
+-// Removing the old name (and all references to it) is always safe, and
+-// requires no checks.
+-func (r *renamer) checkInLexicalScope(from types.Object) {
+- b := from.Parent() // the block defining the 'from' object
+- if b != nil {
+- toBlock, to := b.LookupParent(r.to, from.Parent().End())
+- if toBlock == b {
+- // same-block conflict
+- r.errorf(from.Pos(), "renaming this %s %q to %q",
+- objectKind(from), from.Name(), r.to)
+- r.errorf(to.Pos(), "\tconflicts with %s in same block",
+- objectKind(to))
+- return
+- } else if toBlock != nil {
+- // Check for super-block conflict.
+- // The name r.to is defined in a superblock.
+- // Is that name referenced from within this block?
+- forEachLexicalRef(r.pkg, to, func(id *ast.Ident, block *types.Scope) bool {
+- _, obj := block.LookupParent(from.Name(), id.Pos())
+- if obj == from {
+- // super-block conflict
+- r.errorf(from.Pos(), "renaming this %s %q to %q",
+- objectKind(from), from.Name(), r.to)
+- r.errorf(id.Pos(), "\twould shadow this reference")
+- r.errorf(to.Pos(), "\tto the %s declared here",
+- objectKind(to))
+- return false // stop
+- }
+- return true
+- })
+- }
+- }
+- // Check for sub-block conflict.
+- // Is there an intervening definition of r.to between
+- // the block defining 'from' and some reference to it?
+- forEachLexicalRef(r.pkg, from, func(id *ast.Ident, block *types.Scope) bool {
+- // Find the block that defines the found reference.
+- // It may be an ancestor.
+- fromBlock, _ := block.LookupParent(from.Name(), id.Pos())
+- // See what r.to would resolve to in the same scope.
+- toBlock, to := block.LookupParent(r.to, id.Pos())
+- if to != nil {
+- // sub-block conflict
+- if deeper(toBlock, fromBlock) {
+- r.errorf(from.Pos(), "renaming this %s %q to %q",
+- objectKind(from), from.Name(), r.to)
+- r.errorf(id.Pos(), "\twould cause this reference to become shadowed")
+- r.errorf(to.Pos(), "\tby this intervening %s definition",
+- objectKind(to))
+- return false // stop
+- }
+- }
+- return true
+- })
+-
+- // Renaming a type that is used as an embedded field
+- // requires renaming the field too. e.g.
+- // type T int // if we rename this to U..
+- // var s struct {T}
+- // print(s.T) // ...this must change too
+- if _, ok := from.(*types.TypeName); ok {
+- for id, obj := range r.pkg.GetTypesInfo().Uses {
+- if obj == from {
+- if field := r.pkg.GetTypesInfo().Defs[id]; field != nil {
+- r.check(field)
+- }
+- }
+- }
+- }
+-}
+-
+-// deeper reports whether block x is lexically deeper than y.
+-func deeper(x, y *types.Scope) bool {
+- if x == y || x == nil {
+- return false
+- } else if y == nil {
+- return true
+- } else {
+- return deeper(x.Parent(), y.Parent())
+- }
+-}
+-
+-// forEachLexicalRef calls fn(id, block) for each identifier id in package
+-// pkg that is a reference to obj in lexical scope. block is the
+-// lexical block enclosing the reference. If fn returns false the
+-// iteration is terminated and findLexicalRefs returns false.
+-func forEachLexicalRef(pkg Package, obj types.Object, fn func(id *ast.Ident, block *types.Scope) bool) bool {
+- ok := true
+- var stack []ast.Node
+-
+- var visit func(n ast.Node) bool
+- visit = func(n ast.Node) bool {
+- if n == nil {
+- stack = stack[:len(stack)-1] // pop
+- return false
+- }
+- if !ok {
+- return false // bail out
+- }
+-
+- stack = append(stack, n) // push
+- switch n := n.(type) {
+- case *ast.Ident:
+- if pkg.GetTypesInfo().Uses[n] == obj {
+- block := enclosingBlock(pkg.GetTypesInfo(), stack)
+- if !fn(n, block) {
+- ok = false
+- }
+- }
+- return visit(nil) // pop stack
+-
+- case *ast.SelectorExpr:
+- // don't visit n.Sel
+- ast.Inspect(n.X, visit)
+- return visit(nil) // pop stack, don't descend
+-
+- case *ast.CompositeLit:
+- // Handle recursion ourselves for struct literals
+- // so we don't visit field identifiers.
+- tv, ok := pkg.GetTypesInfo().Types[n]
+- if !ok {
+- return visit(nil) // pop stack, don't descend
+- }
+- if _, ok := Deref(tv.Type).Underlying().(*types.Struct); ok {
+- if n.Type != nil {
+- ast.Inspect(n.Type, visit)
+- }
+- for _, elt := range n.Elts {
+- if kv, ok := elt.(*ast.KeyValueExpr); ok {
+- ast.Inspect(kv.Value, visit)
+- } else {
+- ast.Inspect(elt, visit)
+- }
+- }
+- return visit(nil) // pop stack, don't descend
+- }
+- }
+- return true
+- }
+-
+- for _, f := range pkg.GetSyntax() {
+- ast.Inspect(f, visit)
+- if len(stack) != 0 {
+- panic(stack)
+- }
+- if !ok {
+- break
+- }
+- }
+- return ok
+-}
+-
+-// enclosingBlock returns the innermost block enclosing the specified
+-// AST node, specified in the form of a path from the root of the file,
+-// [file...n].
+-func enclosingBlock(info *types.Info, stack []ast.Node) *types.Scope {
+- for i := range stack {
+- n := stack[len(stack)-1-i]
+- // For some reason, go/types always associates a
+- // function's scope with its FuncType.
+- // TODO(adonovan): feature or a bug?
+- switch f := n.(type) {
+- case *ast.FuncDecl:
+- n = f.Type
+- case *ast.FuncLit:
+- n = f.Type
+- }
+- if b := info.Scopes[n]; b != nil {
+- return b
+- }
+- }
+- panic("no Scope for *ast.File")
+-}
+-
+-func (r *renamer) checkLabel(label *types.Label) {
+- // Check there are no identical labels in the function's label block.
+- // (Label blocks don't nest, so this is easy.)
+- if prev := label.Parent().Lookup(r.to); prev != nil {
+- r.errorf(label.Pos(), "renaming this label %q to %q", label.Name(), prev.Name())
+- r.errorf(prev.Pos(), "\twould conflict with this one")
+- }
+-}
+-
+-// checkStructField checks that the field renaming will not cause
+-// conflicts at its declaration, or ambiguity or changes to any selection.
+-func (r *renamer) checkStructField(from *types.Var) {
+- // Check that the struct declaration is free of field conflicts,
+- // and field/method conflicts.
+-
+- // go/types offers no easy way to get from a field (or interface
+- // method) to its declaring struct (or interface), so we must
+- // ascend the AST.
+- pgf, ok := enclosingFile(r.pkg, from.Pos())
+- if !ok {
+- return // not declared by syntax of this package
+- }
+- path, _ := astutil.PathEnclosingInterval(pgf.File, from.Pos(), from.Pos())
+- // path matches this pattern:
+- // [Ident SelectorExpr? StarExpr? Field FieldList StructType ParenExpr* ... File]
+-
+- // Ascend to FieldList.
+- var i int
+- for {
+- if _, ok := path[i].(*ast.FieldList); ok {
+- break
+- }
+- i++
+- }
+- i++
+- tStruct := path[i].(*ast.StructType)
+- i++
+- // Ascend past parens (unlikely).
+- for {
+- _, ok := path[i].(*ast.ParenExpr)
+- if !ok {
+- break
+- }
+- i++
+- }
+- if spec, ok := path[i].(*ast.TypeSpec); ok {
+- // This struct is also a named type.
+- // We must check for direct (non-promoted) field/field
+- // and method/field conflicts.
+- named := r.pkg.GetTypesInfo().Defs[spec.Name].Type()
+- prev, indices, _ := types.LookupFieldOrMethod(named, true, r.pkg.GetTypes(), r.to)
+- if len(indices) == 1 {
+- r.errorf(from.Pos(), "renaming this field %q to %q",
+- from.Name(), r.to)
+- r.errorf(prev.Pos(), "\twould conflict with this %s",
+- objectKind(prev))
+- return // skip checkSelections to avoid redundant errors
+- }
+- } else {
+- // This struct is not a named type.
+- // We need only check for direct (non-promoted) field/field conflicts.
+- T := r.pkg.GetTypesInfo().Types[tStruct].Type.Underlying().(*types.Struct)
+- for i := 0; i < T.NumFields(); i++ {
+- if prev := T.Field(i); prev.Name() == r.to {
+- r.errorf(from.Pos(), "renaming this field %q to %q",
+- from.Name(), r.to)
+- r.errorf(prev.Pos(), "\twould conflict with this field")
+- return // skip checkSelections to avoid redundant errors
+- }
+- }
+- }
+-
+- // Renaming an anonymous field requires renaming the type too. e.g.
+- // print(s.T) // if we rename T to U,
+- // type T int // this and
+- // var s struct {T} // this must change too.
+- if from.Anonymous() {
+- if named, ok := from.Type().(*types.Named); ok {
+- r.check(named.Obj())
+- } else if named, ok := Deref(from.Type()).(*types.Named); ok {
+- r.check(named.Obj())
+- }
+- }
+-
+- // Check integrity of existing (field and method) selections.
+- r.checkSelections(from)
+-}
+-
+-// checkSelections checks that all uses and selections that resolve to
+-// the specified object would continue to do so after the renaming.
+-func (r *renamer) checkSelections(from types.Object) {
+- pkg := r.pkg
+- typ := pkg.GetTypes()
+- {
+- if id := someUse(pkg.GetTypesInfo(), from); id != nil {
+- if !r.checkExport(id, typ, from) {
+- return
+- }
+- }
+-
+- for syntax, sel := range pkg.GetTypesInfo().Selections {
+- // There may be extant selections of only the old
+- // name or only the new name, so we must check both.
+- // (If neither, the renaming is sound.)
+- //
+- // In both cases, we wish to compare the lengths
+- // of the implicit field path (Selection.Index)
+- // to see if the renaming would change it.
+- //
+- // If a selection that resolves to 'from', when renamed,
+- // would yield a path of the same or shorter length,
+- // this indicates ambiguity or a changed referent,
+- // analogous to same- or sub-block lexical conflict.
+- //
+- // If a selection using the name 'to' would
+- // yield a path of the same or shorter length,
+- // this indicates ambiguity or shadowing,
+- // analogous to same- or super-block lexical conflict.
+-
+- // TODO(adonovan): fix: derive from Types[syntax.X].Mode
+- // TODO(adonovan): test with pointer, value, addressable value.
+- isAddressable := true
+-
+- if sel.Obj() == from {
+- if obj, indices, _ := types.LookupFieldOrMethod(sel.Recv(), isAddressable, from.Pkg(), r.to); obj != nil {
+- // Renaming this existing selection of
+- // 'from' may block access to an existing
+- // type member named 'to'.
+- delta := len(indices) - len(sel.Index())
+- if delta > 0 {
+- continue // no ambiguity
+- }
+- r.selectionConflict(from, delta, syntax, obj)
+- return
+- }
+- } else if sel.Obj().Name() == r.to {
+- if obj, indices, _ := types.LookupFieldOrMethod(sel.Recv(), isAddressable, from.Pkg(), from.Name()); obj == from {
+- // Renaming 'from' may cause this existing
+- // selection of the name 'to' to change
+- // its meaning.
+- delta := len(indices) - len(sel.Index())
+- if delta > 0 {
+- continue // no ambiguity
+- }
+- r.selectionConflict(from, -delta, syntax, sel.Obj())
+- return
+- }
+- }
+- }
+- }
+-}
+-
+-func (r *renamer) selectionConflict(from types.Object, delta int, syntax *ast.SelectorExpr, obj types.Object) {
+- r.errorf(from.Pos(), "renaming this %s %q to %q",
+- objectKind(from), from.Name(), r.to)
+-
+- switch {
+- case delta < 0:
+- // analogous to sub-block conflict
+- r.errorf(syntax.Sel.Pos(),
+- "\twould change the referent of this selection")
+- r.errorf(obj.Pos(), "\tof this %s", objectKind(obj))
+- case delta == 0:
+- // analogous to same-block conflict
+- r.errorf(syntax.Sel.Pos(),
+- "\twould make this reference ambiguous")
+- r.errorf(obj.Pos(), "\twith this %s", objectKind(obj))
+- case delta > 0:
+- // analogous to super-block conflict
+- r.errorf(syntax.Sel.Pos(),
+- "\twould shadow this selection")
+- r.errorf(obj.Pos(), "\tof the %s declared here",
+- objectKind(obj))
+- }
+-}
+-
+-// checkMethod performs safety checks for renaming a method.
+-// There are three hazards:
+-// - declaration conflicts
+-// - selection ambiguity/changes
+-// - entailed renamings of assignable concrete/interface types.
+-//
+-// We reject renamings initiated at concrete methods if it would
+-// change the assignability relation. For renamings of abstract
+-// methods, we rename all methods transitively coupled to it via
+-// assignability.
+-func (r *renamer) checkMethod(from *types.Func) {
+- // e.g. error.Error
+- if from.Pkg() == nil {
+- r.errorf(from.Pos(), "you cannot rename built-in method %s", from)
+- return
+- }
+-
+- // ASSIGNABILITY: We reject renamings of concrete methods that
+- // would break a 'satisfy' constraint; but renamings of abstract
+- // methods are allowed to proceed, and we rename affected
+- // concrete and abstract methods as necessary. It is the
+- // initial method that determines the policy.
+-
+- // Check for conflict at point of declaration.
+- // Check to ensure preservation of assignability requirements.
+- R := recv(from).Type()
+- if types.IsInterface(R) {
+- // Abstract method
+-
+- // declaration
+- prev, _, _ := types.LookupFieldOrMethod(R, false, from.Pkg(), r.to)
+- if prev != nil {
+- r.errorf(from.Pos(), "renaming this interface method %q to %q",
+- from.Name(), r.to)
+- r.errorf(prev.Pos(), "\twould conflict with this method")
+- return
+- }
+-
+- // Check all interfaces that embed this one for
+- // declaration conflicts too.
+- {
+- // Start with named interface types (better errors)
+- for _, obj := range r.pkg.GetTypesInfo().Defs {
+- if obj, ok := obj.(*types.TypeName); ok && types.IsInterface(obj.Type()) {
+- f, _, _ := types.LookupFieldOrMethod(
+- obj.Type(), false, from.Pkg(), from.Name())
+- if f == nil {
+- continue
+- }
+- t, _, _ := types.LookupFieldOrMethod(
+- obj.Type(), false, from.Pkg(), r.to)
+- if t == nil {
+- continue
+- }
+- r.errorf(from.Pos(), "renaming this interface method %q to %q",
+- from.Name(), r.to)
+- r.errorf(t.Pos(), "\twould conflict with this method")
+- r.errorf(obj.Pos(), "\tin named interface type %q", obj.Name())
+- }
+- }
+-
+- // Now look at all literal interface types (includes named ones again).
+- for e, tv := range r.pkg.GetTypesInfo().Types {
+- if e, ok := e.(*ast.InterfaceType); ok {
+- _ = e
+- _ = tv.Type.(*types.Interface)
+- // TODO(adonovan): implement same check as above.
+- }
+- }
+- }
+-
+- // assignability
+- //
+- // Find the set of concrete or abstract methods directly
+- // coupled to abstract method 'from' by some
+- // satisfy.Constraint, and rename them too.
+- for key := range r.satisfy() {
+- // key = (lhs, rhs) where lhs is always an interface.
+-
+- lsel := r.msets.MethodSet(key.LHS).Lookup(from.Pkg(), from.Name())
+- if lsel == nil {
+- continue
+- }
+- rmethods := r.msets.MethodSet(key.RHS)
+- rsel := rmethods.Lookup(from.Pkg(), from.Name())
+- if rsel == nil {
+- continue
+- }
+-
+- // If both sides have a method of this name,
+- // and one of them is m, the other must be coupled.
+- var coupled *types.Func
+- switch from {
+- case lsel.Obj():
+- coupled = rsel.Obj().(*types.Func)
+- case rsel.Obj():
+- coupled = lsel.Obj().(*types.Func)
+- default:
+- continue
+- }
+-
+- // We must treat concrete-to-interface
+- // constraints like an implicit selection C.f of
+- // each interface method I.f, and check that the
+- // renaming leaves the selection unchanged and
+- // unambiguous.
+- //
+- // Fun fact: the implicit selection of C.f
+- // type I interface{f()}
+- // type C struct{I}
+- // func (C) g()
+- // var _ I = C{} // here
+- // yields abstract method I.f. This can make error
+- // messages less than obvious.
+- //
+- if !types.IsInterface(key.RHS) {
+- // The logic below was derived from checkSelections.
+-
+- rtosel := rmethods.Lookup(from.Pkg(), r.to)
+- if rtosel != nil {
+- rto := rtosel.Obj().(*types.Func)
+- delta := len(rsel.Index()) - len(rtosel.Index())
+- if delta < 0 {
+- continue // no ambiguity
+- }
+-
+- // TODO(adonovan): record the constraint's position.
+- keyPos := token.NoPos
+-
+- r.errorf(from.Pos(), "renaming this method %q to %q",
+- from.Name(), r.to)
+- if delta == 0 {
+- // analogous to same-block conflict
+- r.errorf(keyPos, "\twould make the %s method of %s invoked via interface %s ambiguous",
+- r.to, key.RHS, key.LHS)
+- r.errorf(rto.Pos(), "\twith (%s).%s",
+- recv(rto).Type(), r.to)
+- } else {
+- // analogous to super-block conflict
+- r.errorf(keyPos, "\twould change the %s method of %s invoked via interface %s",
+- r.to, key.RHS, key.LHS)
+- r.errorf(coupled.Pos(), "\tfrom (%s).%s",
+- recv(coupled).Type(), r.to)
+- r.errorf(rto.Pos(), "\tto (%s).%s",
+- recv(rto).Type(), r.to)
+- }
+- return // one error is enough
+- }
+- }
+-
+- if !r.changeMethods {
+- // This should be unreachable.
+- r.errorf(from.Pos(), "internal error: during renaming of abstract method %s", from)
+- r.errorf(coupled.Pos(), "\tchangedMethods=false, coupled method=%s", coupled)
+- r.errorf(from.Pos(), "\tPlease file a bug report")
+- return
+- }
+-
+- // Rename the coupled method to preserve assignability.
+- r.check(coupled)
+- }
+- } else {
+- // Concrete method
+-
+- // declaration
+- prev, indices, _ := types.LookupFieldOrMethod(R, true, from.Pkg(), r.to)
+- if prev != nil && len(indices) == 1 {
+- r.errorf(from.Pos(), "renaming this method %q to %q",
+- from.Name(), r.to)
+- r.errorf(prev.Pos(), "\twould conflict with this %s",
+- objectKind(prev))
+- return
+- }
+-
+- // assignability
+- //
+- // Find the set of abstract methods coupled to concrete
+- // method 'from' by some satisfy.Constraint, and rename
+- // them too.
+- //
+- // Coupling may be indirect, e.g. I.f <-> C.f via type D.
+- //
+- // type I interface {f()}
+- // type C int
+- // type (C) f()
+- // type D struct{C}
+- // var _ I = D{}
+- //
+- for key := range r.satisfy() {
+- // key = (lhs, rhs) where lhs is always an interface.
+- if types.IsInterface(key.RHS) {
+- continue
+- }
+- rsel := r.msets.MethodSet(key.RHS).Lookup(from.Pkg(), from.Name())
+- if rsel == nil || rsel.Obj() != from {
+- continue // rhs does not have the method
+- }
+- lsel := r.msets.MethodSet(key.LHS).Lookup(from.Pkg(), from.Name())
+- if lsel == nil {
+- continue
+- }
+- imeth := lsel.Obj().(*types.Func)
+-
+- // imeth is the abstract method (e.g. I.f)
+- // and key.RHS is the concrete coupling type (e.g. D).
+- if !r.changeMethods {
+- r.errorf(from.Pos(), "renaming this method %q to %q",
+- from.Name(), r.to)
+- var pos token.Pos
+- var iface string
+-
+- I := recv(imeth).Type()
+- if named, ok := I.(*types.Named); ok {
+- pos = named.Obj().Pos()
+- iface = "interface " + named.Obj().Name()
+- } else {
+- pos = from.Pos()
+- iface = I.String()
+- }
+- r.errorf(pos, "\twould make %s no longer assignable to %s",
+- key.RHS, iface)
+- r.errorf(imeth.Pos(), "\t(rename %s.%s if you intend to change both types)",
+- I, from.Name())
+- return // one error is enough
+- }
+-
+- // Rename the coupled interface method to preserve assignability.
+- r.check(imeth)
+- }
+- }
+-
+- // Check integrity of existing (field and method) selections.
+- // We skip this if there were errors above, to avoid redundant errors.
+- r.checkSelections(from)
+-}
+-
+-func (r *renamer) checkExport(id *ast.Ident, pkg *types.Package, from types.Object) bool {
+- // Reject cross-package references if r.to is unexported.
+- // (Such references may be qualified identifiers or field/method
+- // selections.)
+- if !ast.IsExported(r.to) && pkg != from.Pkg() {
+- r.errorf(from.Pos(),
+- "renaming %q to %q would make it unexported",
+- from.Name(), r.to)
+- r.errorf(id.Pos(), "\tbreaking references from packages such as %q",
+- pkg.Path())
+- return false
+- }
+- return true
+-}
+-
+-// satisfy returns the set of interface satisfaction constraints.
+-func (r *renamer) satisfy() map[satisfy.Constraint]bool {
+- if r.satisfyConstraints == nil {
+- // Compute on demand: it's expensive.
+- var f satisfy.Finder
+- pkg := r.pkg
+- {
+- // From satisfy.Finder documentation:
+- //
+- // The package must be free of type errors, and
+- // info.{Defs,Uses,Selections,Types} must have been populated by the
+- // type-checker.
+- //
+- // Only proceed if all packages have no errors.
+- if pkg.HasParseErrors() || pkg.HasTypeErrors() {
+- r.errorf(token.NoPos, // we don't have a position for this error.
+- "renaming %q to %q not possible because %q has errors",
+- r.from, r.to, pkg.Metadata().PkgPath)
+- return nil
+- }
+- f.Find(pkg.GetTypesInfo(), pkg.GetSyntax())
+- }
+- r.satisfyConstraints = f.Result
+- }
+- return r.satisfyConstraints
+-}
+-
+-// -- helpers ----------------------------------------------------------
+-
+-// recv returns the method's receiver.
+-func recv(meth *types.Func) *types.Var {
+- return meth.Type().(*types.Signature).Recv()
+-}
+-
+-// someUse returns an arbitrary use of obj within info.
+-func someUse(info *types.Info, obj types.Object) *ast.Ident {
+- for id, o := range info.Uses {
+- if o == obj {
+- return id
+- }
+- }
+- return nil
+-}
+-
+-func objectKind(obj types.Object) string {
+- if obj == nil {
+- return "nil object"
+- }
+- switch obj := obj.(type) {
+- case *types.PkgName:
+- return "imported package name"
+- case *types.TypeName:
+- return "type"
+- case *types.Var:
+- if obj.IsField() {
+- return "field"
+- }
+- case *types.Func:
+- if obj.Type().(*types.Signature).Recv() != nil {
+- return "method"
+- }
+- }
+- // label, func, var, const
+- return strings.ToLower(strings.TrimPrefix(reflect.TypeOf(obj).String(), "*types."))
+-}
+-
+-// NB: for renamings, blank is not considered valid.
+-func isValidIdentifier(id string) bool {
+- if id == "" || id == "_" {
+- return false
+- }
+- for i, r := range id {
+- if !isLetter(r) && (i == 0 || !isDigit(r)) {
+- return false
+- }
+- }
+- return token.Lookup(id) == token.IDENT
+-}
+-
+-// isLocal reports whether obj is local to some function.
+-// Precondition: not a struct field or interface method.
+-func isLocal(obj types.Object) bool {
+- // [... 5=stmt 4=func 3=file 2=pkg 1=universe]
+- var depth int
+- for scope := obj.Parent(); scope != nil; scope = scope.Parent() {
+- depth++
+- }
+- return depth >= 4
+-}
+-
+-func isPackageLevel(obj types.Object) bool {
+- if obj == nil {
+- return false
+- }
+- return obj.Pkg().Scope().Lookup(obj.Name()) == obj
+-}
+-
+-// -- Plundered from go/scanner: ---------------------------------------
+-
+-func isLetter(ch rune) bool {
+- return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= 0x80 && unicode.IsLetter(ch)
+-}
+-
+-func isDigit(ch rune) bool {
+- return '0' <= ch && ch <= '9' || ch >= 0x80 && unicode.IsDigit(ch)
+-}
+diff -urN a/gopls/internal/lsp/source/rename.go b/gopls/internal/lsp/source/rename.go
+--- a/gopls/internal/lsp/source/rename.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/rename.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1244 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-// TODO(adonovan):
+-//
+-// - method of generic concrete type -> arbitrary instances of same
+-//
+-// - make satisfy work across packages.
+-//
+-// - tests, tests, tests:
+-// - play with renamings in the k8s tree.
+-// - generics
+-// - error cases (e.g. conflicts)
+-// - renaming a symbol declared in the module cache
+-// (currently proceeds with half of the renaming!)
+-// - make sure all tests have both a local and a cross-package analogue.
+-// - look at coverage
+-// - special cases: embedded fields, interfaces, test variants,
+-// function-local things with uppercase names;
+-// packages with type errors (currently 'satisfy' rejects them),
+-// pakage with missing imports;
+-//
+-// - measure performance in k8s.
+-//
+-// - The original gorename tool assumed well-typedness, but the gopls feature
+-// does no such check (which actually makes it much more useful).
+-// Audit to ensure it is safe on ill-typed code.
+-//
+-// - Generics support was no doubt buggy before but incrementalization
+-// may have exacerbated it. If the problem were just about objects,
+-// defs and uses it would be fairly simple, but type assignability
+-// comes into play in the 'satisfy' check for method renamings.
+-// De-instantiating Vector[int] to Vector[T] changes its type.
+-// We need to come up with a theory for the satisfy check that
+-// works with generics, and across packages. We currently have no
+-// simple way to pass types between packages (think: objectpath for
+-// types), though presumably exportdata could be pressed into service.
+-//
+-// - FileID-based de-duplication of edits to different URIs for the same file.
+-
+-import (
+- "context"
+- "errors"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "path"
+- "path/filepath"
+- "regexp"
+- "sort"
+- "strconv"
+- "strings"
+-
+- "golang.org/x/mod/modfile"
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/go/types/objectpath"
+- "golang.org/x/tools/go/types/typeutil"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/diff"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/typeparams"
+- "golang.org/x/tools/refactor/satisfy"
+-)
+-
+-// A renamer holds state of a single call to renameObj, which renames
+-// an object (or several coupled objects) within a single type-checked
+-// syntax package.
+-type renamer struct {
+- pkg Package // the syntax package in which the renaming is applied
+- objsToUpdate map[types.Object]bool // records progress of calls to check
+- hadConflicts bool
+- conflicts []string
+- from, to string
+- satisfyConstraints map[satisfy.Constraint]bool
+- msets typeutil.MethodSetCache
+- changeMethods bool
+-}
+-
+-// A PrepareItem holds the result of a "prepare rename" operation:
+-// the source range and value of a selected identifier.
+-type PrepareItem struct {
+- Range protocol.Range
+- Text string
+-}
+-
+-// PrepareRename searches for a valid renaming at position pp.
+-//
+-// The returned usererr is intended to be displayed to the user to explain why
+-// the prepare fails. Probably we could eliminate the redundancy in returning
+-// two errors, but for now this is done defensively.
+-func PrepareRename(ctx context.Context, snapshot Snapshot, f FileHandle, pp protocol.Position) (_ *PrepareItem, usererr, err error) {
+- ctx, done := event.Start(ctx, "source.PrepareRename")
+- defer done()
+-
+- // Is the cursor within the package name declaration?
+- if pgf, inPackageName, err := parsePackageNameDecl(ctx, snapshot, f, pp); err != nil {
+- return nil, err, err
+- } else if inPackageName {
+- item, err := prepareRenamePackageName(ctx, snapshot, pgf)
+- return item, err, err
+- }
+-
+- // Ordinary (non-package) renaming.
+- //
+- // Type-check the current package, locate the reference at the position,
+- // validate the object, and report its name and range.
+- //
+- // TODO(adonovan): in all cases below, we return usererr=nil,
+- // which means we return (nil, nil) at the protocol
+- // layer. This seems like a bug, or at best an exploitation of
+- // knowledge of VSCode-specific behavior. Can we avoid that?
+- pkg, pgf, err := PackageForFile(ctx, snapshot, f.URI(), NarrowestPackage)
+- if err != nil {
+- return nil, nil, err
+- }
+- pos, err := pgf.PositionPos(pp)
+- if err != nil {
+- return nil, nil, err
+- }
+- targets, node, err := objectsAt(pkg.GetTypesInfo(), pgf.File, pos)
+- if err != nil {
+- return nil, nil, err
+- }
+- var obj types.Object
+- for obj = range targets {
+- break // pick one arbitrarily
+- }
+- if err := checkRenamable(obj); err != nil {
+- return nil, nil, err
+- }
+- rng, err := pgf.NodeRange(node)
+- if err != nil {
+- return nil, nil, err
+- }
+- if _, isImport := node.(*ast.ImportSpec); isImport {
+- // We're not really renaming the import path.
+- rng.End = rng.Start
+- }
+- return &PrepareItem{
+- Range: rng,
+- Text: obj.Name(),
+- }, nil, nil
+-}
+-
+-func prepareRenamePackageName(ctx context.Context, snapshot Snapshot, pgf *ParsedGoFile) (*PrepareItem, error) {
+- // Does the client support file renaming?
+- fileRenameSupported := false
+- for _, op := range snapshot.View().Options().SupportedResourceOperations {
+- if op == protocol.Rename {
+- fileRenameSupported = true
+- break
+- }
+- }
+- if !fileRenameSupported {
+- return nil, errors.New("can't rename package: LSP client does not support file renaming")
+- }
+-
+- // Check validity of the metadata for the file's containing package.
+- fileMeta, err := snapshot.MetadataForFile(ctx, pgf.URI)
+- if err != nil {
+- return nil, err
+- }
+- if len(fileMeta) == 0 {
+- return nil, fmt.Errorf("no packages found for file %q", pgf.URI)
+- }
+- meta := fileMeta[0]
+- if meta.Name == "main" {
+- return nil, fmt.Errorf("can't rename package \"main\"")
+- }
+- if strings.HasSuffix(string(meta.Name), "_test") {
+- return nil, fmt.Errorf("can't rename x_test packages")
+- }
+- if meta.Module == nil {
+- return nil, fmt.Errorf("can't rename package: missing module information for package %q", meta.PkgPath)
+- }
+- if meta.Module.Path == string(meta.PkgPath) {
+- return nil, fmt.Errorf("can't rename package: package path %q is the same as module path %q", meta.PkgPath, meta.Module.Path)
+- }
+-
+- // Return the location of the package declaration.
+- rng, err := pgf.NodeRange(pgf.File.Name)
+- if err != nil {
+- return nil, err
+- }
+- return &PrepareItem{
+- Range: rng,
+- Text: string(meta.Name),
+- }, nil
+-}
+-
+-func checkRenamable(obj types.Object) error {
+- switch obj := obj.(type) {
+- case *types.Var:
+- if obj.Embedded() {
+- return fmt.Errorf("can't rename embedded fields: rename the type directly or name the field")
+- }
+- case *types.Builtin, *types.Nil:
+- return fmt.Errorf("%s is built in and cannot be renamed", obj.Name())
+- }
+- if obj.Pkg() == nil || obj.Pkg().Path() == "unsafe" {
+- // e.g. error.Error, unsafe.Pointer
+- return fmt.Errorf("%s is built in and cannot be renamed", obj.Name())
+- }
+- if obj.Name() == "_" {
+- return errors.New("can't rename \"_\"")
+- }
+- return nil
+-}
+-
+-// Rename returns a map of TextEdits for each file modified when renaming a
+-// given identifier within a package and a boolean value of true for renaming
+-// package and false otherwise.
+-func Rename(ctx context.Context, snapshot Snapshot, f FileHandle, pp protocol.Position, newName string) (map[span.URI][]protocol.TextEdit, bool, error) {
+- ctx, done := event.Start(ctx, "source.Rename")
+- defer done()
+-
+- if !isValidIdentifier(newName) {
+- return nil, false, fmt.Errorf("invalid identifier to rename: %q", newName)
+- }
+-
+- // Cursor within package name declaration?
+- _, inPackageName, err := parsePackageNameDecl(ctx, snapshot, f, pp)
+- if err != nil {
+- return nil, false, err
+- }
+-
+- var editMap map[span.URI][]diff.Edit
+- if inPackageName {
+- editMap, err = renamePackageName(ctx, snapshot, f, PackageName(newName))
+- } else {
+- editMap, err = renameOrdinary(ctx, snapshot, f, pp, newName)
+- }
+- if err != nil {
+- return nil, false, err
+- }
+-
+- // Convert edits to protocol form.
+- result := make(map[span.URI][]protocol.TextEdit)
+- for uri, edits := range editMap {
+- // Sort and de-duplicate edits.
+- //
+- // Overlapping edits may arise in local renamings (due
+- // to type switch implicits) and globals ones (due to
+- // processing multiple package variants).
+- //
+- // We assume renaming produces diffs that are all
+- // replacements (no adjacent insertions that might
+- // become reordered) and that are either identical or
+- // non-overlapping.
+- diff.SortEdits(edits)
+- filtered := edits[:0]
+- for i, edit := range edits {
+- if i == 0 || edit != filtered[len(filtered)-1] {
+- filtered = append(filtered, edit)
+- }
+- }
+- edits = filtered
+-
+- // TODO(adonovan): the logic above handles repeat edits to the
+- // same file URI (e.g. as a member of package p and p_test) but
+- // is not sufficient to handle file-system level aliasing arising
+- // from symbolic or hard links. For that, we should use a
+- // robustio-FileID-keyed map.
+- // See https://go.dev/cl/457615 for example.
+- // This really occurs in practice, e.g. kubernetes has
+- // vendor/k8s.io/kubectl -> ../../staging/src/k8s.io/kubectl.
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return nil, false, err
+- }
+- data, err := fh.Read()
+- if err != nil {
+- return nil, false, err
+- }
+- m := protocol.NewMapper(uri, data)
+- protocolEdits, err := ToProtocolEdits(m, edits)
+- if err != nil {
+- return nil, false, err
+- }
+- result[uri] = protocolEdits
+- }
+-
+- return result, inPackageName, nil
+-}
+-
+-// renameOrdinary renames an ordinary (non-package) name throughout the workspace.
+-func renameOrdinary(ctx context.Context, snapshot Snapshot, f FileHandle, pp protocol.Position, newName string) (map[span.URI][]diff.Edit, error) {
+- // Type-check the referring package and locate the object(s).
+- // We choose the widest variant as, for non-exported
+- // identifiers, it is the only package we need.
+- pkg, pgf, err := PackageForFile(ctx, snapshot, f.URI(), WidestPackage)
+- if err != nil {
+- return nil, err
+- }
+- pos, err := pgf.PositionPos(pp)
+- if err != nil {
+- return nil, err
+- }
+- targets, _, err := objectsAt(pkg.GetTypesInfo(), pgf.File, pos)
+- if err != nil {
+- return nil, err
+- }
+-
+- // Pick a representative object arbitrarily.
+- // (All share the same name, pos, and kind.)
+- var obj types.Object
+- for obj = range targets {
+- break
+- }
+- if obj.Name() == newName {
+- return nil, fmt.Errorf("old and new names are the same: %s", newName)
+- }
+- if err := checkRenamable(obj); err != nil {
+- return nil, err
+- }
+-
+- // Find objectpath, if object is exported ("" otherwise).
+- var declObjPath objectpath.Path
+- if obj.Exported() {
+- // objectpath.For requires the origin of a generic
+- // function or type, not an instantiation (a bug?).
+- // Unfortunately we can't call {Func,TypeName}.Origin
+- // as these are not available in go/types@go1.18.
+- // So we take a scenic route.
+- switch obj.(type) { // avoid "obj :=" since cases reassign the var
+- case *types.TypeName:
+- if named, ok := obj.Type().(*types.Named); ok {
+- obj = named.Obj()
+- }
+- case *types.Func:
+- obj = funcOrigin(obj.(*types.Func))
+- case *types.Var:
+- // TODO(adonovan): do vars need the origin treatment too? (issue #58462)
+- }
+- if path, err := objectpath.For(obj); err == nil {
+- declObjPath = path
+- }
+- }
+-
+- // Nonexported? Search locally.
+- if declObjPath == "" {
+- var objects []types.Object
+- for obj := range targets {
+- objects = append(objects, obj)
+- }
+- editMap, _, err := renameObjects(ctx, snapshot, newName, pkg, objects...)
+- return editMap, err
+- }
+-
+- // Exported: search globally.
+- //
+- // For exported package-level var/const/func/type objects, the
+- // search scope is just the direct importers.
+- //
+- // For exported fields and methods, the scope is the
+- // transitive rdeps. (The exportedness of the field's struct
+- // or method's receiver is irrelevant.)
+- transitive := false
+- switch obj.(type) {
+- case *types.TypeName:
+- // Renaming an exported package-level type
+- // requires us to inspect all transitive rdeps
+- // in the event that the type is embedded.
+- //
+- // TODO(adonovan): opt: this is conservative
+- // but inefficient. Instead, expand the scope
+- // of the search only if we actually encounter
+- // an embedding of the type, and only then to
+- // the rdeps of the embedding package.
+- if obj.Parent() == obj.Pkg().Scope() {
+- transitive = true
+- }
+-
+- case *types.Var:
+- if obj.(*types.Var).IsField() {
+- transitive = true // field
+- }
+-
+- // TODO(adonovan): opt: process only packages that
+- // contain a reference (xrefs) to the target field.
+-
+- case *types.Func:
+- if obj.Type().(*types.Signature).Recv() != nil {
+- transitive = true // method
+- }
+-
+- // It's tempting to optimize by skipping
+- // packages that don't contain a reference to
+- // the method in the xrefs index, but we still
+- // need to apply the satisfy check to those
+- // packages to find assignment statements that
+- // might expands the scope of the renaming.
+- }
+-
+- // Type-check all the packages to inspect.
+- declURI := span.URIFromPath(pkg.FileSet().File(obj.Pos()).Name())
+- pkgs, err := typeCheckReverseDependencies(ctx, snapshot, declURI, transitive)
+- if err != nil {
+- return nil, err
+- }
+-
+- // Apply the renaming to the (initial) object.
+- declPkgPath := PackagePath(obj.Pkg().Path())
+- return renameExported(ctx, snapshot, pkgs, declPkgPath, declObjPath, newName)
+-}
+-
+-// funcOrigin is a go1.18-portable implementation of (*types.Func).Origin.
+-func funcOrigin(fn *types.Func) *types.Func {
+- // Method?
+- if fn.Type().(*types.Signature).Recv() != nil {
+- return typeparams.OriginMethod(fn)
+- }
+-
+- // Package-level function?
+- // (Assume the origin has the same position.)
+- gen := fn.Pkg().Scope().Lookup(fn.Name())
+- if gen != nil && gen.Pos() == fn.Pos() {
+- return gen.(*types.Func)
+- }
+-
+- return fn
+-}
+-
+-// typeCheckReverseDependencies returns the type-checked packages for
+-// the reverse dependencies of all packages variants containing
+-// file declURI. The packages are in some topological order.
+-//
+-// It includes all variants (even intermediate test variants) for the
+-// purposes of computing reverse dependencies, but discards ITVs for
+-// the actual renaming work.
+-//
+-// (This neglects obscure edge cases where a _test.go file changes the
+-// selectors used only in an ITV, but life is short. Also sin must be
+-// punished.)
+-func typeCheckReverseDependencies(ctx context.Context, snapshot Snapshot, declURI span.URI, transitive bool) ([]Package, error) {
+- variants, err := snapshot.MetadataForFile(ctx, declURI)
+- if err != nil {
+- return nil, err
+- }
+- allRdeps := make(map[PackageID]*Metadata)
+- for _, variant := range variants {
+- rdeps, err := snapshot.ReverseDependencies(ctx, variant.ID, transitive)
+- if err != nil {
+- return nil, err
+- }
+- allRdeps[variant.ID] = variant // include self
+- for id, meta := range rdeps {
+- allRdeps[id] = meta
+- }
+- }
+- var ids []PackageID
+- for id, meta := range allRdeps {
+- if meta.IsIntermediateTestVariant() {
+- continue
+- }
+- ids = append(ids, id)
+- }
+-
+- // Sort the packages into some topological order of the
+- // (unfiltered) metadata graph.
+- SortPostOrder(snapshot, ids)
+-
+- // Dependencies must be visited first since they can expand
+- // the search set. Ideally we would process the (filtered) set
+- // of packages in the parallel postorder of the snapshot's
+- // (unfiltered) metadata graph, but this is quite tricky
+- // without a good graph abstraction.
+- //
+- // For now, we visit packages sequentially in order of
+- // ascending height, like an inverted breadth-first search.
+- //
+- // Type checking is by far the dominant cost, so
+- // overlapping it with renaming may not be worthwhile.
+- return snapshot.TypeCheck(ctx, ids...)
+-}
+-
+-// SortPostOrder sorts the IDs so that if x depends on y, then y appears before x.
+-func SortPostOrder(meta MetadataSource, ids []PackageID) {
+- postorder := make(map[PackageID]int)
+- order := 0
+- var visit func(PackageID)
+- visit = func(id PackageID) {
+- if _, ok := postorder[id]; !ok {
+- postorder[id] = -1 // break recursion
+- if m := meta.Metadata(id); m != nil {
+- for _, depID := range m.DepsByPkgPath {
+- visit(depID)
+- }
+- }
+- order++
+- postorder[id] = order
+- }
+- }
+- for _, id := range ids {
+- visit(id)
+- }
+- sort.Slice(ids, func(i, j int) bool {
+- return postorder[ids[i]] < postorder[ids[j]]
+- })
+-}
+-
+-// renameExported renames the object denoted by (pkgPath, objPath)
+-// within the specified packages, along with any other objects that
+-// must be renamed as a consequence. The slice of packages must be
+-// topologically ordered.
+-func renameExported(ctx context.Context, snapshot Snapshot, pkgs []Package, declPkgPath PackagePath, declObjPath objectpath.Path, newName string) (map[span.URI][]diff.Edit, error) {
+-
+- // A target is a name for an object that is stable across types.Packages.
+- type target struct {
+- pkg PackagePath
+- obj objectpath.Path
+- }
+-
+- // Populate the initial set of target objects.
+- // This set may grow as we discover the consequences of each renaming.
+- //
+- // TODO(adonovan): strictly, each cone of reverse dependencies
+- // of a single variant should have its own target map that
+- // monotonically expands as we go up the import graph, because
+- // declarations in test files can alter the set of
+- // package-level names and change the meaning of field and
+- // method selectors. So if we parallelize the graph
+- // visitation (see above), we should also compute the targets
+- // as a union of dependencies.
+- //
+- // Or we could decide that the logic below is fast enough not
+- // to need parallelism. In small measurements so far the
+- // type-checking step is about 95% and the renaming only 5%.
+- targets := map[target]bool{{declPkgPath, declObjPath}: true}
+-
+- // Apply the renaming operation to each package.
+- allEdits := make(map[span.URI][]diff.Edit)
+- for _, pkg := range pkgs {
+-
+- // Resolved target objects within package pkg.
+- var objects []types.Object
+- for t := range targets {
+- p := pkg.DependencyTypes(t.pkg)
+- if p == nil {
+- continue // indirect dependency of no consequence
+- }
+- obj, err := objectpath.Object(p, t.obj)
+- if err != nil {
+- // Though this can happen with regular export data
+- // due to trimming of inconsequential objects,
+- // it can't happen if we load dependencies from full
+- // syntax (as today) or shallow export data (soon),
+- // as both are complete.
+- bug.Reportf("objectpath.Object(%v, %v) failed: %v", p, t.obj, err)
+- continue
+- }
+- objects = append(objects, obj)
+- }
+- if len(objects) == 0 {
+- continue // no targets of consequence to this package
+- }
+-
+- // Apply the renaming.
+- editMap, moreObjects, err := renameObjects(ctx, snapshot, newName, pkg, objects...)
+- if err != nil {
+- return nil, err
+- }
+-
+- // It is safe to concatenate the edits as they are non-overlapping
+- // (or identical, in which case they will be de-duped by Rename).
+- for uri, edits := range editMap {
+- allEdits[uri] = append(allEdits[uri], edits...)
+- }
+-
+- // Expand the search set?
+- for obj := range moreObjects {
+- objpath, err := objectpath.For(obj)
+- if err != nil {
+- continue // not exported
+- }
+- target := target{PackagePath(obj.Pkg().Path()), objpath}
+- targets[target] = true
+-
+- // TODO(adonovan): methods requires dynamic
+- // programming of the product targets x
+- // packages as any package might add a new
+- // target (from a foward dep) as a
+- // consequence, and any target might imply a
+- // new set of rdeps. See golang/go#58461.
+- }
+- }
+-
+- return allEdits, nil
+-}
+-
+-// renamePackageName renames package declarations, imports, and go.mod files.
+-func renamePackageName(ctx context.Context, s Snapshot, f FileHandle, newName PackageName) (map[span.URI][]diff.Edit, error) {
+- // Rename the package decl and all imports.
+- renamingEdits, err := renamePackage(ctx, s, f, newName)
+- if err != nil {
+- return nil, err
+- }
+-
+- // Update the last component of the file's enclosing directory.
+- oldBase := filepath.Dir(f.URI().Filename())
+- newPkgDir := filepath.Join(filepath.Dir(oldBase), string(newName))
+-
+- // Update any affected replace directives in go.mod files.
+- // TODO(adonovan): extract into its own function.
+- //
+- // TODO: should this operate on all go.mod files, irrespective of whether they are included in the workspace?
+- // Get all active mod files in the workspace
+- modFiles := s.ModFiles()
+- for _, m := range modFiles {
+- fh, err := s.GetFile(ctx, m)
+- if err != nil {
+- return nil, err
+- }
+- pm, err := s.ParseMod(ctx, fh)
+- if err != nil {
+- return nil, err
+- }
+-
+- modFileDir := filepath.Dir(pm.URI.Filename())
+- affectedReplaces := []*modfile.Replace{}
+-
+- // Check if any replace directives need to be fixed
+- for _, r := range pm.File.Replace {
+- if !strings.HasPrefix(r.New.Path, "/") && !strings.HasPrefix(r.New.Path, "./") && !strings.HasPrefix(r.New.Path, "../") {
+- continue
+- }
+-
+- replacedPath := r.New.Path
+- if strings.HasPrefix(r.New.Path, "./") || strings.HasPrefix(r.New.Path, "../") {
+- replacedPath = filepath.Join(modFileDir, r.New.Path)
+- }
+-
+- // TODO: Is there a risk of converting a '\' delimited replacement to a '/' delimited replacement?
+- if !strings.HasPrefix(filepath.ToSlash(replacedPath)+"/", filepath.ToSlash(oldBase)+"/") {
+- continue // not affected by the package renaming
+- }
+-
+- affectedReplaces = append(affectedReplaces, r)
+- }
+-
+- if len(affectedReplaces) == 0 {
+- continue
+- }
+- copied, err := modfile.Parse("", pm.Mapper.Content, nil)
+- if err != nil {
+- return nil, err
+- }
+-
+- for _, r := range affectedReplaces {
+- replacedPath := r.New.Path
+- if strings.HasPrefix(r.New.Path, "./") || strings.HasPrefix(r.New.Path, "../") {
+- replacedPath = filepath.Join(modFileDir, r.New.Path)
+- }
+-
+- suffix := strings.TrimPrefix(replacedPath, string(oldBase))
+-
+- newReplacedPath, err := filepath.Rel(modFileDir, newPkgDir+suffix)
+- if err != nil {
+- return nil, err
+- }
+-
+- newReplacedPath = filepath.ToSlash(newReplacedPath)
+-
+- if !strings.HasPrefix(newReplacedPath, "/") && !strings.HasPrefix(newReplacedPath, "../") {
+- newReplacedPath = "./" + newReplacedPath
+- }
+-
+- if err := copied.AddReplace(r.Old.Path, "", newReplacedPath, ""); err != nil {
+- return nil, err
+- }
+- }
+-
+- copied.Cleanup()
+- newContent, err := copied.Format()
+- if err != nil {
+- return nil, err
+- }
+-
+- // Calculate the edits to be made due to the change.
+- edits := s.View().Options().ComputeEdits(string(pm.Mapper.Content), string(newContent))
+- renamingEdits[pm.URI] = append(renamingEdits[pm.URI], edits...)
+- }
+-
+- return renamingEdits, nil
+-}
+-
+-// renamePackage computes all workspace edits required to rename the package
+-// described by the given metadata, to newName, by renaming its package
+-// directory.
+-//
+-// It updates package clauses and import paths for the renamed package as well
+-// as any other packages affected by the directory renaming among packages
+-// described by allMetadata.
+-func renamePackage(ctx context.Context, s Snapshot, f FileHandle, newName PackageName) (map[span.URI][]diff.Edit, error) {
+- if strings.HasSuffix(string(newName), "_test") {
+- return nil, fmt.Errorf("cannot rename to _test package")
+- }
+-
+- // We need metadata for the relevant package and module paths.
+- // These should be the same for all packages containing the file.
+- metas, err := s.MetadataForFile(ctx, f.URI())
+- if err != nil {
+- return nil, err
+- }
+- if len(metas) == 0 {
+- return nil, fmt.Errorf("no packages found for file %q", f.URI())
+- }
+- meta := metas[0] // narrowest
+-
+- oldPkgPath := meta.PkgPath
+- if meta.Module == nil {
+- return nil, fmt.Errorf("cannot rename package: missing module information for package %q", meta.PkgPath)
+- }
+- modulePath := PackagePath(meta.Module.Path)
+- if modulePath == oldPkgPath {
+- return nil, fmt.Errorf("cannot rename package: module path %q is the same as the package path, so renaming the package directory would have no effect", modulePath)
+- }
+-
+- newPathPrefix := path.Join(path.Dir(string(oldPkgPath)), string(newName))
+-
+- // We must inspect all packages, not just direct importers,
+- // because we also rename subpackages, which may be unrelated.
+- // (If the renamed package imports a subpackage it may require
+- // edits to both its package and import decls.)
+- allMetadata, err := s.AllMetadata(ctx)
+- if err != nil {
+- return nil, err
+- }
+-
+- // Rename package and import declarations in all relevant packages.
+- edits := make(map[span.URI][]diff.Edit)
+- for _, m := range allMetadata {
+- // Special case: x_test packages for the renamed package will not have the
+- // package path as as a dir prefix, but still need their package clauses
+- // renamed.
+- if m.PkgPath == oldPkgPath+"_test" {
+- if err := renamePackageClause(ctx, m, s, newName+"_test", edits); err != nil {
+- return nil, err
+- }
+- continue
+- }
+-
+- // Subtle: check this condition before checking for valid module info
+- // below, because we should not fail this operation if unrelated packages
+- // lack module info.
+- if !strings.HasPrefix(string(m.PkgPath)+"/", string(oldPkgPath)+"/") {
+- continue // not affected by the package renaming
+- }
+-
+- if m.Module == nil {
+- // This check will always fail under Bazel.
+- return nil, fmt.Errorf("cannot rename package: missing module information for package %q", m.PkgPath)
+- }
+-
+- if modulePath != PackagePath(m.Module.Path) {
+- continue // don't edit imports if nested package and renaming package have different module paths
+- }
+-
+- // Renaming a package consists of changing its import path and package name.
+- suffix := strings.TrimPrefix(string(m.PkgPath), string(oldPkgPath))
+- newPath := newPathPrefix + suffix
+-
+- pkgName := m.Name
+- if m.PkgPath == oldPkgPath {
+- pkgName = PackageName(newName)
+-
+- if err := renamePackageClause(ctx, m, s, newName, edits); err != nil {
+- return nil, err
+- }
+- }
+-
+- imp := ImportPath(newPath) // TODO(adonovan): what if newPath has vendor/ prefix?
+- if err := renameImports(ctx, s, m, imp, pkgName, edits); err != nil {
+- return nil, err
+- }
+- }
+-
+- return edits, nil
+-}
+-
+-// renamePackageClause computes edits renaming the package clause of files in
+-// the package described by the given metadata, to newName.
+-//
+-// Edits are written into the edits map.
+-func renamePackageClause(ctx context.Context, m *Metadata, snapshot Snapshot, newName PackageName, edits map[span.URI][]diff.Edit) error {
+- // Rename internal references to the package in the renaming package.
+- for _, uri := range m.CompiledGoFiles {
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return err
+- }
+- f, err := snapshot.ParseGo(ctx, fh, ParseHeader)
+- if err != nil {
+- return err
+- }
+- if f.File.Name == nil {
+- continue // no package declaration
+- }
+-
+- edit, err := posEdit(f.Tok, f.File.Name.Pos(), f.File.Name.End(), string(newName))
+- if err != nil {
+- return err
+- }
+- edits[f.URI] = append(edits[f.URI], edit)
+- }
+-
+- return nil
+-}
+-
+-// renameImports computes the set of edits to imports resulting from renaming
+-// the package described by the given metadata, to a package with import path
+-// newPath and name newName.
+-//
+-// Edits are written into the edits map.
+-func renameImports(ctx context.Context, snapshot Snapshot, m *Metadata, newPath ImportPath, newName PackageName, allEdits map[span.URI][]diff.Edit) error {
+- rdeps, err := snapshot.ReverseDependencies(ctx, m.ID, false) // find direct importers
+- if err != nil {
+- return err
+- }
+-
+- // Pass 1: rename import paths in import declarations.
+- needsTypeCheck := make(map[PackageID][]span.URI)
+- for _, rdep := range rdeps {
+- if rdep.IsIntermediateTestVariant() {
+- continue // for renaming, these variants are redundant
+- }
+-
+- for _, uri := range rdep.CompiledGoFiles {
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return err
+- }
+- f, err := snapshot.ParseGo(ctx, fh, ParseHeader)
+- if err != nil {
+- return err
+- }
+- if f.File.Name == nil {
+- continue // no package declaration
+- }
+- for _, imp := range f.File.Imports {
+- if rdep.DepsByImpPath[UnquoteImportPath(imp)] != m.ID {
+- continue // not the import we're looking for
+- }
+-
+- // If the import does not explicitly specify
+- // a local name, then we need to invoke the
+- // type checker to locate references to update.
+- //
+- // TODO(adonovan): is this actually true?
+- // Renaming an import with a local name can still
+- // cause conflicts: shadowing of built-ins, or of
+- // package-level decls in the same or another file.
+- if imp.Name == nil {
+- needsTypeCheck[rdep.ID] = append(needsTypeCheck[rdep.ID], uri)
+- }
+-
+- // Create text edit for the import path (string literal).
+- edit, err := posEdit(f.Tok, imp.Path.Pos(), imp.Path.End(), strconv.Quote(string(newPath)))
+- if err != nil {
+- return err
+- }
+- allEdits[uri] = append(allEdits[uri], edit)
+- }
+- }
+- }
+-
+- // If the imported package's name hasn't changed,
+- // we don't need to rename references within each file.
+- if newName == m.Name {
+- return nil
+- }
+-
+- // Pass 2: rename local name (types.PkgName) of imported
+- // package throughout one or more files of the package.
+- ids := make([]PackageID, 0, len(needsTypeCheck))
+- for id := range needsTypeCheck {
+- ids = append(ids, id)
+- }
+- pkgs, err := snapshot.TypeCheck(ctx, ids...)
+- if err != nil {
+- return err
+- }
+- for i, id := range ids {
+- pkg := pkgs[i]
+- for _, uri := range needsTypeCheck[id] {
+- f, err := pkg.File(uri)
+- if err != nil {
+- return err
+- }
+- for _, imp := range f.File.Imports {
+- if imp.Name != nil {
+- continue // has explicit local name
+- }
+- if rdeps[id].DepsByImpPath[UnquoteImportPath(imp)] != m.ID {
+- continue // not the import we're looking for
+- }
+-
+- pkgname := pkg.GetTypesInfo().Implicits[imp].(*types.PkgName)
+-
+- pkgScope := pkg.GetTypes().Scope()
+- fileScope := pkg.GetTypesInfo().Scopes[f.File]
+-
+- localName := string(newName)
+- try := 0
+-
+- // Keep trying with fresh names until one succeeds.
+- //
+- // TODO(adonovan): fix: this loop is not sufficient to choose a name
+- // that is guaranteed to be conflict-free; renameObj may still fail.
+- // So the retry loop should be around renameObj, and we shouldn't
+- // bother with scopes here.
+- for fileScope.Lookup(localName) != nil || pkgScope.Lookup(localName) != nil {
+- try++
+- localName = fmt.Sprintf("%s%d", newName, try)
+- }
+-
+- // renameObj detects various conflicts, including:
+- // - new name conflicts with a package-level decl in this file;
+- // - new name hides a package-level decl in another file that
+- // is actually referenced in this file;
+- // - new name hides a built-in that is actually referenced
+- // in this file;
+- // - a reference in this file to the old package name would
+- // become shadowed by an intervening declaration that
+- // uses the new name.
+- // It returns the edits if no conflict was detected.
+- editMap, _, err := renameObjects(ctx, snapshot, localName, pkg, pkgname)
+- if err != nil {
+- return err
+- }
+-
+- // If the chosen local package name matches the package's
+- // new name, delete the change that would have inserted
+- // an explicit local name, which is always the lexically
+- // first change.
+- if localName == string(newName) {
+- edits, ok := editMap[uri]
+- if !ok {
+- return fmt.Errorf("internal error: no changes for %s", uri)
+- }
+- diff.SortEdits(edits)
+- editMap[uri] = edits[1:]
+- }
+- for uri, edits := range editMap {
+- allEdits[uri] = append(allEdits[uri], edits...)
+- }
+- }
+- }
+- }
+- return nil
+-}
+-
+-// renameObjects computes the edits to the type-checked syntax package pkg
+-// required to rename a set of target objects to newName.
+-//
+-// It also returns the set of objects that were found (due to
+-// corresponding methods and embedded fields) to require renaming as a
+-// consequence of the requested renamings.
+-//
+-// It returns an error if the renaming would cause a conflict.
+-func renameObjects(ctx context.Context, snapshot Snapshot, newName string, pkg Package, targets ...types.Object) (map[span.URI][]diff.Edit, map[types.Object]bool, error) {
+- r := renamer{
+- pkg: pkg,
+- objsToUpdate: make(map[types.Object]bool),
+- from: targets[0].Name(),
+- to: newName,
+- }
+-
+- // A renaming initiated at an interface method indicates the
+- // intention to rename abstract and concrete methods as needed
+- // to preserve assignability.
+- // TODO(adonovan): pull this into the caller.
+- for _, obj := range targets {
+- if obj, ok := obj.(*types.Func); ok {
+- recv := obj.Type().(*types.Signature).Recv()
+- if recv != nil && types.IsInterface(recv.Type().Underlying()) {
+- r.changeMethods = true
+- break
+- }
+- }
+- }
+-
+- // Check that the renaming of the identifier is ok.
+- for _, obj := range targets {
+- r.check(obj)
+- if len(r.conflicts) > 0 {
+- // Stop at first error.
+- return nil, nil, fmt.Errorf("%s", strings.Join(r.conflicts, "\n"))
+- }
+- }
+-
+- editMap, err := r.update()
+- if err != nil {
+- return nil, nil, err
+- }
+-
+- // Remove initial targets so that only 'consequences' remain.
+- for _, obj := range targets {
+- delete(r.objsToUpdate, obj)
+- }
+- return editMap, r.objsToUpdate, nil
+-}
+-
+-// Rename all references to the target objects.
+-func (r *renamer) update() (map[span.URI][]diff.Edit, error) {
+- result := make(map[span.URI][]diff.Edit)
+-
+- // shouldUpdate reports whether obj is one of (or an
+- // instantiation of one of) the target objects.
+- shouldUpdate := func(obj types.Object) bool {
+- if r.objsToUpdate[obj] {
+- return true
+- }
+- if fn, ok := obj.(*types.Func); ok && r.objsToUpdate[funcOrigin(fn)] {
+- return true
+- }
+- return false
+- }
+-
+- // Find all identifiers in the package that define or use a
+- // renamed object. We iterate over info as it is more efficent
+- // than calling ast.Inspect for each of r.pkg.CompiledGoFiles().
+- type item struct {
+- node ast.Node // Ident, ImportSpec (obj=PkgName), or CaseClause (obj=Var)
+- obj types.Object
+- isDef bool
+- }
+- var items []item
+- info := r.pkg.GetTypesInfo()
+- for id, obj := range info.Uses {
+- if shouldUpdate(obj) {
+- items = append(items, item{id, obj, false})
+- }
+- }
+- for id, obj := range info.Defs {
+- if shouldUpdate(obj) {
+- items = append(items, item{id, obj, true})
+- }
+- }
+- for node, obj := range info.Implicits {
+- if shouldUpdate(obj) {
+- switch node.(type) {
+- case *ast.ImportSpec, *ast.CaseClause:
+- items = append(items, item{node, obj, true})
+- }
+- }
+- }
+- sort.Slice(items, func(i, j int) bool {
+- return items[i].node.Pos() < items[j].node.Pos()
+- })
+-
+- // Update each identifier.
+- for _, item := range items {
+- pgf, ok := enclosingFile(r.pkg, item.node.Pos())
+- if !ok {
+- bug.Reportf("edit does not belong to syntax of package %q", r.pkg)
+- continue
+- }
+-
+- // Renaming a types.PkgName may result in the addition or removal of an identifier,
+- // so we deal with this separately.
+- if pkgName, ok := item.obj.(*types.PkgName); ok && item.isDef {
+- edit, err := r.updatePkgName(pgf, pkgName)
+- if err != nil {
+- return nil, err
+- }
+- result[pgf.URI] = append(result[pgf.URI], edit)
+- continue
+- }
+-
+- // Workaround the unfortunate lack of a Var object
+- // for x in "switch x := expr.(type) {}" by adjusting
+- // the case clause to the switch ident.
+- // This may result in duplicate edits, but we de-dup later.
+- if _, ok := item.node.(*ast.CaseClause); ok {
+- path, _ := astutil.PathEnclosingInterval(pgf.File, item.obj.Pos(), item.obj.Pos())
+- item.node = path[0].(*ast.Ident)
+- }
+-
+- // Replace the identifier with r.to.
+- edit, err := posEdit(pgf.Tok, item.node.Pos(), item.node.End(), r.to)
+- if err != nil {
+- return nil, err
+- }
+-
+- result[pgf.URI] = append(result[pgf.URI], edit)
+-
+- if !item.isDef { // uses do not have doc comments to update.
+- continue
+- }
+-
+- doc := docComment(pgf, item.node.(*ast.Ident))
+- if doc == nil {
+- continue
+- }
+-
+- // Perform the rename in doc comments declared in the original package.
+- // go/parser strips out \r\n returns from the comment text, so go
+- // line-by-line through the comment text to get the correct positions.
+- docRegexp := regexp.MustCompile(`\b` + r.from + `\b`) // valid identifier => valid regexp
+- for _, comment := range doc.List {
+- if isDirective(comment.Text) {
+- continue
+- }
+- // TODO(adonovan): why are we looping over lines?
+- // Just run the loop body once over the entire multiline comment.
+- lines := strings.Split(comment.Text, "\n")
+- tokFile := pgf.Tok
+- commentLine := tokFile.Line(comment.Pos())
+- uri := span.URIFromPath(tokFile.Name())
+- for i, line := range lines {
+- lineStart := comment.Pos()
+- if i > 0 {
+- lineStart = tokFile.LineStart(commentLine + i)
+- }
+- for _, locs := range docRegexp.FindAllIndex([]byte(line), -1) {
+- edit, err := posEdit(tokFile, lineStart+token.Pos(locs[0]), lineStart+token.Pos(locs[1]), r.to)
+- if err != nil {
+- return nil, err // can't happen
+- }
+- result[uri] = append(result[uri], edit)
+- }
+- }
+- }
+- }
+-
+- return result, nil
+-}
+-
+-// docComment returns the doc for an identifier within the specified file.
+-func docComment(pgf *ParsedGoFile, id *ast.Ident) *ast.CommentGroup {
+- nodes, _ := astutil.PathEnclosingInterval(pgf.File, id.Pos(), id.End())
+- for _, node := range nodes {
+- switch decl := node.(type) {
+- case *ast.FuncDecl:
+- return decl.Doc
+- case *ast.Field:
+- return decl.Doc
+- case *ast.GenDecl:
+- return decl.Doc
+- // For {Type,Value}Spec, if the doc on the spec is absent,
+- // search for the enclosing GenDecl
+- case *ast.TypeSpec:
+- if decl.Doc != nil {
+- return decl.Doc
+- }
+- case *ast.ValueSpec:
+- if decl.Doc != nil {
+- return decl.Doc
+- }
+- case *ast.Ident:
+- case *ast.AssignStmt:
+- // *ast.AssignStmt doesn't have an associated comment group.
+- // So, we try to find a comment just before the identifier.
+-
+- // Try to find a comment group only for short variable declarations (:=).
+- if decl.Tok != token.DEFINE {
+- return nil
+- }
+-
+- identLine := pgf.Tok.Line(id.Pos())
+- for _, comment := range nodes[len(nodes)-1].(*ast.File).Comments {
+- if comment.Pos() > id.Pos() {
+- // Comment is after the identifier.
+- continue
+- }
+-
+- lastCommentLine := pgf.Tok.Line(comment.End())
+- if lastCommentLine+1 == identLine {
+- return comment
+- }
+- }
+- default:
+- return nil
+- }
+- }
+- return nil
+-}
+-
+-// updatePkgName returns the updates to rename a pkgName in the import spec by
+-// only modifying the package name portion of the import declaration.
+-func (r *renamer) updatePkgName(pgf *ParsedGoFile, pkgName *types.PkgName) (diff.Edit, error) {
+- // Modify ImportSpec syntax to add or remove the Name as needed.
+- path, _ := astutil.PathEnclosingInterval(pgf.File, pkgName.Pos(), pkgName.Pos())
+- if len(path) < 2 {
+- return diff.Edit{}, fmt.Errorf("no path enclosing interval for %s", pkgName.Name())
+- }
+- spec, ok := path[1].(*ast.ImportSpec)
+- if !ok {
+- return diff.Edit{}, fmt.Errorf("failed to update PkgName for %s", pkgName.Name())
+- }
+-
+- newText := ""
+- if pkgName.Imported().Name() != r.to {
+- newText = r.to + " "
+- }
+-
+- // Replace the portion (possibly empty) of the spec before the path:
+- // local "path" or "path"
+- // -> <- -><-
+- return posEdit(pgf.Tok, spec.Pos(), spec.Path.Pos(), newText)
+-}
+-
+-// parsePackageNameDecl is a convenience function that parses and
+-// returns the package name declaration of file fh, and reports
+-// whether the position ppos lies within it.
+-//
+-// Note: also used by references2.
+-func parsePackageNameDecl(ctx context.Context, snapshot Snapshot, fh FileHandle, ppos protocol.Position) (*ParsedGoFile, bool, error) {
+- pgf, err := snapshot.ParseGo(ctx, fh, ParseHeader)
+- if err != nil {
+- return nil, false, err
+- }
+- // Careful: because we used ParseHeader,
+- // pgf.Pos(ppos) may be beyond EOF => (0, err).
+- pos, _ := pgf.PositionPos(ppos)
+- return pgf, pgf.File.Name.Pos() <= pos && pos <= pgf.File.Name.End(), nil
+-}
+-
+-// enclosingFile returns the CompiledGoFile of pkg that contains the specified position.
+-func enclosingFile(pkg Package, pos token.Pos) (*ParsedGoFile, bool) {
+- for _, pgf := range pkg.CompiledGoFiles() {
+- if pgf.File.Pos() <= pos && pos <= pgf.File.End() {
+- return pgf, true
+- }
+- }
+- return nil, false
+-}
+-
+-// posEdit returns an edit to replace the (start, end) range of tf with 'new'.
+-func posEdit(tf *token.File, start, end token.Pos, new string) (diff.Edit, error) {
+- startOffset, endOffset, err := safetoken.Offsets(tf, start, end)
+- if err != nil {
+- return diff.Edit{}, err
+- }
+- return diff.Edit{Start: startOffset, End: endOffset, New: new}, nil
+-}
+diff -urN a/gopls/internal/lsp/source/signature_help.go b/gopls/internal/lsp/source/signature_help.go
+--- a/gopls/internal/lsp/source/signature_help.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/signature_help.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,185 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+- "strings"
+-
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-func SignatureHelp(ctx context.Context, snapshot Snapshot, fh FileHandle, position protocol.Position) (*protocol.SignatureInformation, int, error) {
+- ctx, done := event.Start(ctx, "source.SignatureHelp")
+- defer done()
+-
+- // We need full type-checking here, as we must type-check function bodies in
+- // order to provide signature help at the requested position.
+- pkg, pgf, err := PackageForFile(ctx, snapshot, fh.URI(), NarrowestPackage)
+- if err != nil {
+- return nil, 0, fmt.Errorf("getting file for SignatureHelp: %w", err)
+- }
+- pos, err := pgf.PositionPos(position)
+- if err != nil {
+- return nil, 0, err
+- }
+- // Find a call expression surrounding the query position.
+- var callExpr *ast.CallExpr
+- path, _ := astutil.PathEnclosingInterval(pgf.File, pos, pos)
+- if path == nil {
+- return nil, 0, fmt.Errorf("cannot find node enclosing position")
+- }
+-FindCall:
+- for _, node := range path {
+- switch node := node.(type) {
+- case *ast.CallExpr:
+- if pos >= node.Lparen && pos <= node.Rparen {
+- callExpr = node
+- break FindCall
+- }
+- case *ast.FuncLit, *ast.FuncType:
+- // The user is within an anonymous function,
+- // which may be the parameter to the *ast.CallExpr.
+- // Don't show signature help in this case.
+- return nil, 0, fmt.Errorf("no signature help within a function declaration")
+- case *ast.BasicLit:
+- if node.Kind == token.STRING {
+- return nil, 0, fmt.Errorf("no signature help within a string literal")
+- }
+- }
+-
+- }
+- if callExpr == nil || callExpr.Fun == nil {
+- return nil, 0, fmt.Errorf("cannot find an enclosing function")
+- }
+-
+- qf := Qualifier(pgf.File, pkg.GetTypes(), pkg.GetTypesInfo())
+-
+- // Get the object representing the function, if available.
+- // There is no object in certain cases such as calling a function returned by
+- // a function (e.g. "foo()()").
+- var obj types.Object
+- switch t := callExpr.Fun.(type) {
+- case *ast.Ident:
+- obj = pkg.GetTypesInfo().ObjectOf(t)
+- case *ast.SelectorExpr:
+- obj = pkg.GetTypesInfo().ObjectOf(t.Sel)
+- }
+-
+- // Handle builtin functions separately.
+- if obj, ok := obj.(*types.Builtin); ok {
+- return builtinSignature(ctx, snapshot, callExpr, obj.Name(), pos)
+- }
+-
+- // Get the type information for the function being called.
+- sigType := pkg.GetTypesInfo().TypeOf(callExpr.Fun)
+- if sigType == nil {
+- return nil, 0, fmt.Errorf("cannot get type for Fun %[1]T (%[1]v)", callExpr.Fun)
+- }
+-
+- sig, _ := sigType.Underlying().(*types.Signature)
+- if sig == nil {
+- return nil, 0, fmt.Errorf("cannot find signature for Fun %[1]T (%[1]v)", callExpr.Fun)
+- }
+-
+- activeParam := activeParameter(callExpr, sig.Params().Len(), sig.Variadic(), pos)
+-
+- var (
+- name string
+- comment *ast.CommentGroup
+- )
+- if obj != nil {
+- d, err := HoverDocForObject(ctx, snapshot, pkg.FileSet(), obj)
+- if err != nil {
+- return nil, 0, err
+- }
+- name = obj.Name()
+- comment = d
+- } else {
+- name = "func"
+- }
+- mq := MetadataQualifierForFile(snapshot, pgf.File, pkg.Metadata())
+- s, err := NewSignature(ctx, snapshot, pkg, sig, comment, qf, mq)
+- if err != nil {
+- return nil, 0, err
+- }
+- paramInfo := make([]protocol.ParameterInformation, 0, len(s.params))
+- for _, p := range s.params {
+- paramInfo = append(paramInfo, protocol.ParameterInformation{Label: p})
+- }
+- return &protocol.SignatureInformation{
+- Label: name + s.Format(),
+- Documentation: stringToSigInfoDocumentation(s.doc, snapshot.View().Options()),
+- Parameters: paramInfo,
+- }, activeParam, nil
+-}
+-
+-func builtinSignature(ctx context.Context, snapshot Snapshot, callExpr *ast.CallExpr, name string, pos token.Pos) (*protocol.SignatureInformation, int, error) {
+- sig, err := NewBuiltinSignature(ctx, snapshot, name)
+- if err != nil {
+- return nil, 0, err
+- }
+- paramInfo := make([]protocol.ParameterInformation, 0, len(sig.params))
+- for _, p := range sig.params {
+- paramInfo = append(paramInfo, protocol.ParameterInformation{Label: p})
+- }
+- activeParam := activeParameter(callExpr, len(sig.params), sig.variadic, pos)
+- return &protocol.SignatureInformation{
+- Label: sig.name + sig.Format(),
+- Documentation: stringToSigInfoDocumentation(sig.doc, snapshot.View().Options()),
+- Parameters: paramInfo,
+- }, activeParam, nil
+-
+-}
+-
+-func activeParameter(callExpr *ast.CallExpr, numParams int, variadic bool, pos token.Pos) (activeParam int) {
+- if len(callExpr.Args) == 0 {
+- return 0
+- }
+- // First, check if the position is even in the range of the arguments.
+- start, end := callExpr.Lparen, callExpr.Rparen
+- if !(start <= pos && pos <= end) {
+- return 0
+- }
+- for _, expr := range callExpr.Args {
+- if start == token.NoPos {
+- start = expr.Pos()
+- }
+- end = expr.End()
+- if start <= pos && pos <= end {
+- break
+- }
+- // Don't advance the active parameter for the last parameter of a variadic function.
+- if !variadic || activeParam < numParams-1 {
+- activeParam++
+- }
+- start = expr.Pos() + 1 // to account for commas
+- }
+- return activeParam
+-}
+-
+-func stringToSigInfoDocumentation(s string, options *Options) *protocol.Or_SignatureInformation_documentation {
+- v := s
+- k := protocol.PlainText
+- if options.PreferredContentFormat == protocol.Markdown {
+- v = CommentToMarkdown(s, options)
+- // whether or not content is newline terminated may not matter for LSP clients,
+- // but our tests expect trailing newlines to be stripped.
+- v = strings.TrimSuffix(v, "\n") // TODO(pjw): change the golden files
+- k = protocol.Markdown
+- }
+- return &protocol.Or_SignatureInformation_documentation{
+- Value: protocol.MarkupContent{
+- Kind: k,
+- Value: v,
+- },
+- }
+-}
+diff -urN a/gopls/internal/lsp/source/stub.go b/gopls/internal/lsp/source/stub.go
+--- a/gopls/internal/lsp/source/stub.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/stub.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,238 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "bytes"
+- "context"
+- "fmt"
+- "go/format"
+- "go/parser"
+- "go/token"
+- "go/types"
+- "io"
+- "path"
+- "strings"
+-
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/ast/astutil"
+- "golang.org/x/tools/gopls/internal/lsp/analysis/stubmethods"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-// stubSuggestedFixFunc returns a suggested fix to declare the missing
+-// methods of the concrete type that is assigned to an interface type
+-// at the cursor position.
+-func stubSuggestedFixFunc(ctx context.Context, snapshot Snapshot, fh FileHandle, rng protocol.Range) (*token.FileSet, *analysis.SuggestedFix, error) {
+- pkg, pgf, err := PackageForFile(ctx, snapshot, fh.URI(), NarrowestPackage)
+- if err != nil {
+- return nil, nil, fmt.Errorf("GetTypedFile: %w", err)
+- }
+- start, end, err := pgf.RangePos(rng)
+- if err != nil {
+- return nil, nil, err
+- }
+- nodes, _ := astutil.PathEnclosingInterval(pgf.File, start, end)
+- si := stubmethods.GetStubInfo(pkg.FileSet(), pkg.GetTypesInfo(), nodes, start)
+- if si == nil {
+- return nil, nil, fmt.Errorf("nil interface request")
+- }
+- return stub(ctx, snapshot, si)
+-}
+-
+-// stub returns a suggested fix to declare the missing methods of si.Concrete.
+-func stub(ctx context.Context, snapshot Snapshot, si *stubmethods.StubInfo) (*token.FileSet, *analysis.SuggestedFix, error) {
+- // A function-local type cannot be stubbed
+- // since there's nowhere to put the methods.
+- conc := si.Concrete.Obj()
+- if conc.Parent() != conc.Pkg().Scope() {
+- return nil, nil, fmt.Errorf("local type %q cannot be stubbed", conc.Name())
+- }
+-
+- // Parse the file declaring the concrete type.
+- declPGF, _, err := parseFull(ctx, snapshot, si.Fset, conc.Pos())
+- if err != nil {
+- return nil, nil, fmt.Errorf("failed to parse file %q declaring implementation type: %w", declPGF.URI, err)
+- }
+- if declPGF.Fixed {
+- return nil, nil, fmt.Errorf("file contains parse errors: %s", declPGF.URI)
+- }
+-
+- // Build import environment for the declaring file.
+- importEnv := make(map[ImportPath]string) // value is local name
+- for _, imp := range declPGF.File.Imports {
+- importPath := UnquoteImportPath(imp)
+- var name string
+- if imp.Name != nil {
+- name = imp.Name.Name
+- if name == "_" {
+- continue
+- } else if name == "." {
+- name = "" // see types.Qualifier
+- }
+- } else {
+- // TODO(adonovan): may omit a vendor/ prefix; consult the Metadata.
+- name = path.Base(string(importPath))
+- }
+- importEnv[importPath] = name // latest alias wins
+- }
+-
+- // Find subset of interface methods that the concrete type lacks.
+- var missing []*types.Func
+- ifaceType := si.Interface.Type().Underlying().(*types.Interface)
+- for i := 0; i < ifaceType.NumMethods(); i++ {
+- imethod := ifaceType.Method(i)
+- cmethod, _, _ := types.LookupFieldOrMethod(si.Concrete, si.Pointer, imethod.Pkg(), imethod.Name())
+- if cmethod == nil {
+- missing = append(missing, imethod)
+- continue
+- }
+-
+- if _, ok := cmethod.(*types.Var); ok {
+- // len(LookupFieldOrMethod.index) = 1 => conflict, >1 => shadow.
+- return nil, nil, fmt.Errorf("adding method %s.%s would conflict with (or shadow) existing field",
+- conc.Name(), imethod.Name())
+- }
+-
+- if !types.Identical(cmethod.Type(), imethod.Type()) {
+- return nil, nil, fmt.Errorf("method %s.%s already exists but has the wrong type: got %s, want %s",
+- conc.Name(), imethod.Name(), cmethod.Type(), imethod.Type())
+- }
+- }
+- if len(missing) == 0 {
+- return nil, nil, fmt.Errorf("no missing methods found")
+- }
+-
+- // Create a package name qualifier that uses the
+- // locally appropriate imported package name.
+- // It records any needed new imports.
+- // TODO(adonovan): factor with source.FormatVarType, stubmethods.RelativeToFiles?
+- //
+- // Prior to CL 469155 this logic preserved any renaming
+- // imports from the file that declares the interface
+- // method--ostensibly the preferred name for imports of
+- // frequently renamed packages such as protobufs.
+- // Now we use the package's declared name. If this turns out
+- // to be a mistake, then use parseHeader(si.iface.Pos()).
+- //
+- type newImport struct{ name, importPath string }
+- var newImports []newImport // for AddNamedImport
+- qual := func(pkg *types.Package) string {
+- // TODO(adonovan): don't ignore vendor prefix.
+- importPath := ImportPath(pkg.Path())
+- name, ok := importEnv[importPath]
+- if !ok {
+- // Insert new import using package's declared name.
+- //
+- // TODO(adonovan): resolve conflict between declared
+- // name and existing file-level (declPGF.File.Imports)
+- // or package-level (si.Concrete.Pkg.Scope) decls by
+- // generating a fresh name.
+- name = pkg.Name()
+- importEnv[importPath] = name
+- new := newImport{importPath: string(importPath)}
+- // For clarity, use a renaming import whenever the
+- // local name does not match the path's last segment.
+- if name != path.Base(new.importPath) {
+- new.name = name
+- }
+- newImports = append(newImports, new)
+- }
+- return name
+- }
+-
+- // Format interface name (used only in a comment).
+- iface := si.Interface.Name()
+- if ipkg := si.Interface.Pkg(); ipkg != nil && ipkg != conc.Pkg() {
+- iface = ipkg.Name() + "." + iface
+- }
+-
+- // Pointer receiver?
+- var star string
+- if si.Pointer {
+- star = "*"
+- }
+-
+- // Format the new methods.
+- var newMethods bytes.Buffer
+- for _, method := range missing {
+- fmt.Fprintf(&newMethods, `// %s implements %s
+-func (%s%s%s) %s%s {
+- panic("unimplemented")
+-}
+-`,
+- method.Name(),
+- iface,
+- star,
+- si.Concrete.Obj().Name(),
+- FormatTypeParams(typeparams.ForNamed(si.Concrete)),
+- method.Name(),
+- strings.TrimPrefix(types.TypeString(method.Type(), qual), "func"))
+- }
+-
+- // Compute insertion point for new methods:
+- // after the top-level declaration enclosing the (package-level) type.
+- insertOffset, err := safetoken.Offset(declPGF.Tok, declPGF.File.End())
+- if err != nil {
+- return nil, nil, bug.Errorf("internal error: end position outside file bounds: %v", err)
+- }
+- concOffset, err := safetoken.Offset(si.Fset.File(conc.Pos()), conc.Pos())
+- if err != nil {
+- return nil, nil, bug.Errorf("internal error: finding type decl offset: %v", err)
+- }
+- for _, decl := range declPGF.File.Decls {
+- declEndOffset, err := safetoken.Offset(declPGF.Tok, decl.End())
+- if err != nil {
+- return nil, nil, bug.Errorf("internal error: finding decl offset: %v", err)
+- }
+- if declEndOffset > concOffset {
+- insertOffset = declEndOffset
+- break
+- }
+- }
+-
+- // Splice the new methods into the file content.
+- var buf bytes.Buffer
+- input := declPGF.Mapper.Content // unfixed content of file
+- buf.Write(input[:insertOffset])
+- buf.WriteByte('\n')
+- io.Copy(&buf, &newMethods)
+- buf.Write(input[insertOffset:])
+-
+- // Re-parse the file.
+- fset := token.NewFileSet()
+- newF, err := parser.ParseFile(fset, declPGF.File.Name.Name, buf.Bytes(), parser.ParseComments)
+- if err != nil {
+- return nil, nil, fmt.Errorf("could not reparse file: %w", err)
+- }
+-
+- // Splice the new imports into the syntax tree.
+- for _, imp := range newImports {
+- astutil.AddNamedImport(fset, newF, imp.name, imp.importPath)
+- }
+-
+- // Pretty-print.
+- var output strings.Builder
+- if err := format.Node(&output, fset, newF); err != nil {
+- return nil, nil, fmt.Errorf("format.Node: %w", err)
+- }
+-
+- // Report the diff.
+- diffs := snapshot.View().Options().ComputeEdits(string(input), output.String())
+- var edits []analysis.TextEdit
+- for _, edit := range diffs {
+- edits = append(edits, analysis.TextEdit{
+- Pos: declPGF.Tok.Pos(edit.Start),
+- End: declPGF.Tok.Pos(edit.End),
+- NewText: []byte(edit.New),
+- })
+- }
+- return FileSetFor(declPGF.Tok), // edits use declPGF.Tok
+- &analysis.SuggestedFix{TextEdits: edits},
+- nil
+-}
+diff -urN a/gopls/internal/lsp/source/symbols.go b/gopls/internal/lsp/source/symbols.go
+--- a/gopls/internal/lsp/source/symbols.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/symbols.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,227 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "go/types"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-func DocumentSymbols(ctx context.Context, snapshot Snapshot, fh FileHandle) ([]protocol.DocumentSymbol, error) {
+- ctx, done := event.Start(ctx, "source.DocumentSymbols")
+- defer done()
+-
+- pgf, err := snapshot.ParseGo(ctx, fh, ParseFull)
+- if err != nil {
+- return nil, fmt.Errorf("getting file for DocumentSymbols: %w", err)
+- }
+-
+- // Build symbols for file declarations. When encountering a declaration with
+- // errors (typically because positions are invalid), we skip the declaration
+- // entirely. VS Code fails to show any symbols if one of the top-level
+- // symbols is missing position information.
+- var symbols []protocol.DocumentSymbol
+- for _, decl := range pgf.File.Decls {
+- switch decl := decl.(type) {
+- case *ast.FuncDecl:
+- if decl.Name.Name == "_" {
+- continue
+- }
+- fs, err := funcSymbol(pgf.Mapper, pgf.Tok, decl)
+- if err == nil {
+- // If function is a method, prepend the type of the method.
+- if decl.Recv != nil && len(decl.Recv.List) > 0 {
+- fs.Name = fmt.Sprintf("(%s).%s", types.ExprString(decl.Recv.List[0].Type), fs.Name)
+- }
+- symbols = append(symbols, fs)
+- }
+- case *ast.GenDecl:
+- for _, spec := range decl.Specs {
+- switch spec := spec.(type) {
+- case *ast.TypeSpec:
+- if spec.Name.Name == "_" {
+- continue
+- }
+- ts, err := typeSymbol(pgf.Mapper, pgf.Tok, spec)
+- if err == nil {
+- symbols = append(symbols, ts)
+- }
+- case *ast.ValueSpec:
+- for _, name := range spec.Names {
+- if name.Name == "_" {
+- continue
+- }
+- vs, err := varSymbol(pgf.Mapper, pgf.Tok, spec, name, decl.Tok == token.CONST)
+- if err == nil {
+- symbols = append(symbols, vs)
+- }
+- }
+- }
+- }
+- }
+- }
+- return symbols, nil
+-}
+-
+-func funcSymbol(m *protocol.Mapper, tf *token.File, decl *ast.FuncDecl) (protocol.DocumentSymbol, error) {
+- s := protocol.DocumentSymbol{
+- Name: decl.Name.Name,
+- Kind: protocol.Function,
+- }
+- if decl.Recv != nil {
+- s.Kind = protocol.Method
+- }
+- var err error
+- s.Range, err = m.NodeRange(tf, decl)
+- if err != nil {
+- return protocol.DocumentSymbol{}, err
+- }
+- s.SelectionRange, err = m.NodeRange(tf, decl.Name)
+- if err != nil {
+- return protocol.DocumentSymbol{}, err
+- }
+- s.Detail = types.ExprString(decl.Type)
+- return s, nil
+-}
+-
+-func typeSymbol(m *protocol.Mapper, tf *token.File, spec *ast.TypeSpec) (protocol.DocumentSymbol, error) {
+- s := protocol.DocumentSymbol{
+- Name: spec.Name.Name,
+- }
+- var err error
+- s.Range, err = m.NodeRange(tf, spec)
+- if err != nil {
+- return protocol.DocumentSymbol{}, err
+- }
+- s.SelectionRange, err = m.NodeRange(tf, spec.Name)
+- if err != nil {
+- return protocol.DocumentSymbol{}, err
+- }
+- s.Kind, s.Detail, s.Children = typeDetails(m, tf, spec.Type)
+- return s, nil
+-}
+-
+-func typeDetails(m *protocol.Mapper, tf *token.File, typExpr ast.Expr) (kind protocol.SymbolKind, detail string, children []protocol.DocumentSymbol) {
+- switch typExpr := typExpr.(type) {
+- case *ast.StructType:
+- kind = protocol.Struct
+- children = fieldListSymbols(m, tf, typExpr.Fields, protocol.Field)
+- if len(children) > 0 {
+- detail = "struct{...}"
+- } else {
+- detail = "struct{}"
+- }
+-
+- // Find interface methods and embedded types.
+- case *ast.InterfaceType:
+- kind = protocol.Interface
+- children = fieldListSymbols(m, tf, typExpr.Methods, protocol.Method)
+- if len(children) > 0 {
+- detail = "interface{...}"
+- } else {
+- detail = "interface{}"
+- }
+-
+- case *ast.FuncType:
+- kind = protocol.Function
+- detail = types.ExprString(typExpr)
+-
+- default:
+- kind = protocol.Class // catch-all, for cases where we don't know the kind syntactically
+- detail = types.ExprString(typExpr)
+- }
+- return
+-}
+-
+-func fieldListSymbols(m *protocol.Mapper, tf *token.File, fields *ast.FieldList, fieldKind protocol.SymbolKind) []protocol.DocumentSymbol {
+- if fields == nil {
+- return nil
+- }
+-
+- var symbols []protocol.DocumentSymbol
+- for _, field := range fields.List {
+- detail, children := "", []protocol.DocumentSymbol(nil)
+- if field.Type != nil {
+- _, detail, children = typeDetails(m, tf, field.Type)
+- }
+- if len(field.Names) == 0 { // embedded interface or struct field
+- // By default, use the formatted type details as the name of this field.
+- // This handles potentially invalid syntax, as well as type embeddings in
+- // interfaces.
+- child := protocol.DocumentSymbol{
+- Name: detail,
+- Kind: protocol.Field, // consider all embeddings to be fields
+- Children: children,
+- }
+-
+- // If the field is a valid embedding, promote the type name to field
+- // name.
+- selection := field.Type
+- if id := embeddedIdent(field.Type); id != nil {
+- child.Name = id.Name
+- child.Detail = detail
+- selection = id
+- }
+-
+- if rng, err := m.NodeRange(tf, field.Type); err == nil {
+- child.Range = rng
+- }
+- if rng, err := m.NodeRange(tf, selection); err == nil {
+- child.SelectionRange = rng
+- }
+-
+- symbols = append(symbols, child)
+- } else {
+- for _, name := range field.Names {
+- child := protocol.DocumentSymbol{
+- Name: name.Name,
+- Kind: fieldKind,
+- Detail: detail,
+- Children: children,
+- }
+-
+- if rng, err := m.NodeRange(tf, field); err == nil {
+- child.Range = rng
+- }
+- if rng, err := m.NodeRange(tf, name); err == nil {
+- child.SelectionRange = rng
+- }
+-
+- symbols = append(symbols, child)
+- }
+- }
+-
+- }
+- return symbols
+-}
+-
+-func varSymbol(m *protocol.Mapper, tf *token.File, spec *ast.ValueSpec, name *ast.Ident, isConst bool) (protocol.DocumentSymbol, error) {
+- s := protocol.DocumentSymbol{
+- Name: name.Name,
+- Kind: protocol.Variable,
+- }
+- if isConst {
+- s.Kind = protocol.Constant
+- }
+- var err error
+- s.Range, err = m.NodeRange(tf, spec)
+- if err != nil {
+- return protocol.DocumentSymbol{}, err
+- }
+- s.SelectionRange, err = m.NodeRange(tf, name)
+- if err != nil {
+- return protocol.DocumentSymbol{}, err
+- }
+- if spec.Type != nil { // type may be missing from the syntax
+- _, s.Detail, s.Children = typeDetails(m, tf, spec.Type)
+- }
+- return s, nil
+-}
+diff -urN a/gopls/internal/lsp/source/type_definition.go b/gopls/internal/lsp/source/type_definition.go
+--- a/gopls/internal/lsp/source/type_definition.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/type_definition.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,55 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "fmt"
+- "go/token"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-// TypeDefinition handles the textDocument/typeDefinition request for Go files.
+-func TypeDefinition(ctx context.Context, snapshot Snapshot, fh FileHandle, position protocol.Position) ([]protocol.Location, error) {
+- ctx, done := event.Start(ctx, "source.TypeDefinition")
+- defer done()
+-
+- pkg, pgf, err := PackageForFile(ctx, snapshot, fh.URI(), NarrowestPackage)
+- if err != nil {
+- return nil, err
+- }
+- pos, err := pgf.PositionPos(position)
+- if err != nil {
+- return nil, err
+- }
+-
+- // TODO(rfindley): handle type switch implicits correctly here: if the user
+- // jumps to the type definition of x in x := y.(type), it makes sense to jump
+- // to the type of y.
+- _, obj, _ := referencedObject(pkg, pgf, pos)
+- if obj == nil {
+- return nil, nil
+- }
+-
+- typObj := typeToObject(obj.Type())
+- if typObj == nil {
+- return nil, fmt.Errorf("no type definition for %s", obj.Name())
+- }
+-
+- // Identifiers with the type "error" are a special case with no position.
+- if hasErrorType(typObj) {
+- // TODO(rfindley): we can do better here, returning a link to the builtin
+- // file.
+- return nil, nil
+- }
+-
+- loc, err := mapPosition(ctx, pkg.FileSet(), snapshot, typObj.Pos(), typObj.Pos()+token.Pos(len(typObj.Name())))
+- if err != nil {
+- return nil, err
+- }
+- return []protocol.Location{loc}, nil
+-}
+diff -urN a/gopls/internal/lsp/source/types_format.go b/gopls/internal/lsp/source/types_format.go
+--- a/gopls/internal/lsp/source/types_format.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/types_format.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,517 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "bytes"
+- "context"
+- "fmt"
+- "go/ast"
+- "go/doc"
+- "go/printer"
+- "go/token"
+- "go/types"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-// FormatType returns the detail and kind for a types.Type.
+-func FormatType(typ types.Type, qf types.Qualifier) (detail string, kind protocol.CompletionItemKind) {
+- if types.IsInterface(typ) {
+- detail = "interface{...}"
+- kind = protocol.InterfaceCompletion
+- } else if _, ok := typ.(*types.Struct); ok {
+- detail = "struct{...}"
+- kind = protocol.StructCompletion
+- } else if typ != typ.Underlying() {
+- detail, kind = FormatType(typ.Underlying(), qf)
+- } else {
+- detail = types.TypeString(typ, qf)
+- kind = protocol.ClassCompletion
+- }
+- return detail, kind
+-}
+-
+-type signature struct {
+- name, doc string
+- typeParams, params, results []string
+- variadic bool
+- needResultParens bool
+-}
+-
+-func (s *signature) Format() string {
+- var b strings.Builder
+- b.WriteByte('(')
+- for i, p := range s.params {
+- if i > 0 {
+- b.WriteString(", ")
+- }
+- b.WriteString(p)
+- }
+- b.WriteByte(')')
+-
+- // Add space between parameters and results.
+- if len(s.results) > 0 {
+- b.WriteByte(' ')
+- }
+- if s.needResultParens {
+- b.WriteByte('(')
+- }
+- for i, r := range s.results {
+- if i > 0 {
+- b.WriteString(", ")
+- }
+- b.WriteString(r)
+- }
+- if s.needResultParens {
+- b.WriteByte(')')
+- }
+- return b.String()
+-}
+-
+-func (s *signature) TypeParams() []string {
+- return s.typeParams
+-}
+-
+-func (s *signature) Params() []string {
+- return s.params
+-}
+-
+-// NewBuiltinSignature returns signature for the builtin object with a given
+-// name, if a builtin object with the name exists.
+-func NewBuiltinSignature(ctx context.Context, s Snapshot, name string) (*signature, error) {
+- builtin, err := s.BuiltinFile(ctx)
+- if err != nil {
+- return nil, err
+- }
+- obj := builtin.File.Scope.Lookup(name)
+- if obj == nil {
+- return nil, fmt.Errorf("no builtin object for %s", name)
+- }
+- decl, ok := obj.Decl.(*ast.FuncDecl)
+- if !ok {
+- return nil, fmt.Errorf("no function declaration for builtin: %s", name)
+- }
+- if decl.Type == nil {
+- return nil, fmt.Errorf("no type for builtin decl %s", decl.Name)
+- }
+- var variadic bool
+- if decl.Type.Params.List != nil {
+- numParams := len(decl.Type.Params.List)
+- lastParam := decl.Type.Params.List[numParams-1]
+- if _, ok := lastParam.Type.(*ast.Ellipsis); ok {
+- variadic = true
+- }
+- }
+- fset := FileSetFor(builtin.Tok)
+- params, _ := formatFieldList(ctx, fset, decl.Type.Params, variadic)
+- results, needResultParens := formatFieldList(ctx, fset, decl.Type.Results, false)
+- d := decl.Doc.Text()
+- switch s.View().Options().HoverKind {
+- case SynopsisDocumentation:
+- d = doc.Synopsis(d)
+- case NoDocumentation:
+- d = ""
+- }
+- return &signature{
+- doc: d,
+- name: name,
+- needResultParens: needResultParens,
+- params: params,
+- results: results,
+- variadic: variadic,
+- }, nil
+-}
+-
+-// replacer replaces some synthetic "type classes" used in the builtin file
+-// with their most common constituent type.
+-var replacer = strings.NewReplacer(
+- `ComplexType`, `complex128`,
+- `FloatType`, `float64`,
+- `IntegerType`, `int`,
+-)
+-
+-func formatFieldList(ctx context.Context, fset *token.FileSet, list *ast.FieldList, variadic bool) ([]string, bool) {
+- if list == nil {
+- return nil, false
+- }
+- var writeResultParens bool
+- var result []string
+- for i := 0; i < len(list.List); i++ {
+- if i >= 1 {
+- writeResultParens = true
+- }
+- p := list.List[i]
+- cfg := printer.Config{Mode: printer.UseSpaces | printer.TabIndent, Tabwidth: 4}
+- b := &bytes.Buffer{}
+- if err := cfg.Fprint(b, fset, p.Type); err != nil {
+- event.Error(ctx, "unable to print type", nil, tag.Type.Of(p.Type))
+- continue
+- }
+- typ := replacer.Replace(b.String())
+- if len(p.Names) == 0 {
+- result = append(result, typ)
+- }
+- for _, name := range p.Names {
+- if name.Name != "" {
+- if i == 0 {
+- writeResultParens = true
+- }
+- result = append(result, fmt.Sprintf("%s %s", name.Name, typ))
+- } else {
+- result = append(result, typ)
+- }
+- }
+- }
+- if variadic {
+- result[len(result)-1] = strings.Replace(result[len(result)-1], "[]", "...", 1)
+- }
+- return result, writeResultParens
+-}
+-
+-// FormatTypeParams turns TypeParamList into its Go representation, such as:
+-// [T, Y]. Note that it does not print constraints as this is mainly used for
+-// formatting type params in method receivers.
+-func FormatTypeParams(tparams *typeparams.TypeParamList) string {
+- if tparams == nil || tparams.Len() == 0 {
+- return ""
+- }
+- var buf bytes.Buffer
+- buf.WriteByte('[')
+- for i := 0; i < tparams.Len(); i++ {
+- if i > 0 {
+- buf.WriteString(", ")
+- }
+- buf.WriteString(tparams.At(i).Obj().Name())
+- }
+- buf.WriteByte(']')
+- return buf.String()
+-}
+-
+-// NewSignature returns formatted signature for a types.Signature struct.
+-func NewSignature(ctx context.Context, s Snapshot, pkg Package, sig *types.Signature, comment *ast.CommentGroup, qf types.Qualifier, mq MetadataQualifier) (*signature, error) {
+- var tparams []string
+- tpList := typeparams.ForSignature(sig)
+- for i := 0; i < tpList.Len(); i++ {
+- tparam := tpList.At(i)
+- // TODO: is it possible to reuse the logic from FormatVarType here?
+- s := tparam.Obj().Name() + " " + tparam.Constraint().String()
+- tparams = append(tparams, s)
+- }
+-
+- params := make([]string, 0, sig.Params().Len())
+- for i := 0; i < sig.Params().Len(); i++ {
+- el := sig.Params().At(i)
+- typ, err := FormatVarType(ctx, s, pkg, el, qf, mq)
+- if err != nil {
+- return nil, err
+- }
+- p := typ
+- if el.Name() != "" {
+- p = el.Name() + " " + typ
+- }
+- params = append(params, p)
+- }
+-
+- var needResultParens bool
+- results := make([]string, 0, sig.Results().Len())
+- for i := 0; i < sig.Results().Len(); i++ {
+- if i >= 1 {
+- needResultParens = true
+- }
+- el := sig.Results().At(i)
+- typ, err := FormatVarType(ctx, s, pkg, el, qf, mq)
+- if err != nil {
+- return nil, err
+- }
+- if el.Name() == "" {
+- results = append(results, typ)
+- } else {
+- if i == 0 {
+- needResultParens = true
+- }
+- results = append(results, el.Name()+" "+typ)
+- }
+- }
+- var d string
+- if comment != nil {
+- d = comment.Text()
+- }
+- switch s.View().Options().HoverKind {
+- case SynopsisDocumentation:
+- d = doc.Synopsis(d)
+- case NoDocumentation:
+- d = ""
+- }
+- return &signature{
+- doc: d,
+- typeParams: tparams,
+- params: params,
+- results: results,
+- variadic: sig.Variadic(),
+- needResultParens: needResultParens,
+- }, nil
+-}
+-
+-// FormatVarType formats a *types.Var, accounting for type aliases.
+-// To do this, it looks in the AST of the file in which the object is declared.
+-// On any errors, it always falls back to types.TypeString.
+-//
+-// TODO(rfindley): this function could return the actual name used in syntax,
+-// for better parameter names.
+-func FormatVarType(ctx context.Context, snapshot Snapshot, srcpkg Package, obj *types.Var, qf types.Qualifier, mq MetadataQualifier) (string, error) {
+- // TODO(rfindley): This looks wrong. The previous comment said:
+- // "If the given expr refers to a type parameter, then use the
+- // object's Type instead of the type parameter declaration. This helps
+- // format the instantiated type as opposed to the original undeclared
+- // generic type".
+- //
+- // But of course, if obj is a type param, we are formatting a generic type
+- // and not an instantiated type. Handling for instantiated types must be done
+- // at a higher level.
+- //
+- // Left this during refactoring in order to preserve pre-existing logic.
+- if typeparams.IsTypeParam(obj.Type()) {
+- return types.TypeString(obj.Type(), qf), nil
+- }
+-
+- if obj.Pkg() == nil || !obj.Pos().IsValid() {
+- // This is defensive, though it is extremely unlikely we'll ever have a
+- // builtin var.
+- return types.TypeString(obj.Type(), qf), nil
+- }
+-
+- targetpgf, pos, err := parseFull(ctx, snapshot, srcpkg.FileSet(), obj.Pos())
+- if err != nil {
+- return "", err // e.g. ctx cancelled
+- }
+-
+- targetMeta := findFileInDeps(snapshot, srcpkg.Metadata(), targetpgf.URI)
+- if targetMeta == nil {
+- // If we have an object from type-checking, it should exist in a file in
+- // the forward transitive closure.
+- return "", bug.Errorf("failed to find file %q in deps of %q", targetpgf.URI, srcpkg.Metadata().ID)
+- }
+-
+- decl, spec, field := findDeclInfo([]*ast.File{targetpgf.File}, pos)
+-
+- // We can't handle type parameters correctly, so we fall back on TypeString
+- // for parameterized decls.
+- if decl, _ := decl.(*ast.FuncDecl); decl != nil {
+- if typeparams.ForFuncType(decl.Type).NumFields() > 0 {
+- return types.TypeString(obj.Type(), qf), nil // in generic function
+- }
+- if decl.Recv != nil && len(decl.Recv.List) > 0 {
+- if x, _, _, _ := typeparams.UnpackIndexExpr(decl.Recv.List[0].Type); x != nil {
+- return types.TypeString(obj.Type(), qf), nil // in method of generic type
+- }
+- }
+- }
+- if spec, _ := spec.(*ast.TypeSpec); spec != nil && typeparams.ForTypeSpec(spec).NumFields() > 0 {
+- return types.TypeString(obj.Type(), qf), nil // in generic type decl
+- }
+-
+- if field == nil {
+- // TODO(rfindley): we should never reach here from an ordinary var, so
+- // should probably return an error here.
+- return types.TypeString(obj.Type(), qf), nil
+- }
+- expr := field.Type
+-
+- rq := requalifier(snapshot, targetpgf.File, targetMeta, mq)
+-
+- // The type names in the AST may not be correctly qualified.
+- // Determine the package name to use based on the package that originated
+- // the query and the package in which the type is declared.
+- // We then qualify the value by cloning the AST node and editing it.
+- expr = qualifyTypeExpr(expr, rq)
+-
+- // If the request came from a different package than the one in which the
+- // types are defined, we may need to modify the qualifiers.
+- return FormatNodeFile(targetpgf.Tok, expr), nil
+-}
+-
+-// qualifyTypeExpr clones the type expression expr after re-qualifying type
+-// names using the given function, which accepts the current syntactic
+-// qualifier (possibly "" for unqualified idents), and returns a new qualifier
+-// (again, possibly "" if the identifier should be unqualified).
+-//
+-// The resulting expression may be inaccurate: without type-checking we don't
+-// properly account for "." imported identifiers or builtins.
+-//
+-// TODO(rfindley): add many more tests for this function.
+-func qualifyTypeExpr(expr ast.Expr, qf func(string) string) ast.Expr {
+- switch expr := expr.(type) {
+- case *ast.ArrayType:
+- return &ast.ArrayType{
+- Lbrack: expr.Lbrack,
+- Elt: qualifyTypeExpr(expr.Elt, qf),
+- Len: expr.Len,
+- }
+-
+- case *ast.BinaryExpr:
+- if expr.Op != token.OR {
+- return expr
+- }
+- return &ast.BinaryExpr{
+- X: qualifyTypeExpr(expr.X, qf),
+- OpPos: expr.OpPos,
+- Op: expr.Op,
+- Y: qualifyTypeExpr(expr.Y, qf),
+- }
+-
+- case *ast.ChanType:
+- return &ast.ChanType{
+- Arrow: expr.Arrow,
+- Begin: expr.Begin,
+- Dir: expr.Dir,
+- Value: qualifyTypeExpr(expr.Value, qf),
+- }
+-
+- case *ast.Ellipsis:
+- return &ast.Ellipsis{
+- Ellipsis: expr.Ellipsis,
+- Elt: qualifyTypeExpr(expr.Elt, qf),
+- }
+-
+- case *ast.FuncType:
+- return &ast.FuncType{
+- Func: expr.Func,
+- Params: qualifyFieldList(expr.Params, qf),
+- Results: qualifyFieldList(expr.Results, qf),
+- }
+-
+- case *ast.Ident:
+- // Unqualified type (builtin, package local, or dot-imported).
+-
+- // Don't qualify names that look like builtins.
+- //
+- // Without type-checking this may be inaccurate. It could be made accurate
+- // by doing syntactic object resolution for the entire package, but that
+- // does not seem worthwhile and we generally want to avoid using
+- // ast.Object, which may be inaccurate.
+- if obj := types.Universe.Lookup(expr.Name); obj != nil {
+- return expr
+- }
+-
+- newName := qf("")
+- if newName != "" {
+- return &ast.SelectorExpr{
+- X: &ast.Ident{
+- NamePos: expr.Pos(),
+- Name: newName,
+- },
+- Sel: expr,
+- }
+- }
+- return expr
+-
+- case *ast.IndexExpr:
+- return &ast.IndexExpr{
+- X: qualifyTypeExpr(expr.X, qf),
+- Lbrack: expr.Lbrack,
+- Index: qualifyTypeExpr(expr.Index, qf),
+- Rbrack: expr.Rbrack,
+- }
+-
+- case *typeparams.IndexListExpr:
+- indices := make([]ast.Expr, len(expr.Indices))
+- for i, idx := range expr.Indices {
+- indices[i] = qualifyTypeExpr(idx, qf)
+- }
+- return &typeparams.IndexListExpr{
+- X: qualifyTypeExpr(expr.X, qf),
+- Lbrack: expr.Lbrack,
+- Indices: indices,
+- Rbrack: expr.Rbrack,
+- }
+-
+- case *ast.InterfaceType:
+- return &ast.InterfaceType{
+- Interface: expr.Interface,
+- Methods: qualifyFieldList(expr.Methods, qf),
+- Incomplete: expr.Incomplete,
+- }
+-
+- case *ast.MapType:
+- return &ast.MapType{
+- Map: expr.Map,
+- Key: qualifyTypeExpr(expr.Key, qf),
+- Value: qualifyTypeExpr(expr.Value, qf),
+- }
+-
+- case *ast.ParenExpr:
+- return &ast.ParenExpr{
+- Lparen: expr.Lparen,
+- Rparen: expr.Rparen,
+- X: qualifyTypeExpr(expr.X, qf),
+- }
+-
+- case *ast.SelectorExpr:
+- if id, ok := expr.X.(*ast.Ident); ok {
+- // qualified type
+- newName := qf(id.Name)
+- if newName == "" {
+- return expr.Sel
+- }
+- return &ast.SelectorExpr{
+- X: &ast.Ident{
+- NamePos: id.NamePos,
+- Name: newName,
+- },
+- Sel: expr.Sel,
+- }
+- }
+- return expr
+-
+- case *ast.StarExpr:
+- return &ast.StarExpr{
+- Star: expr.Star,
+- X: qualifyTypeExpr(expr.X, qf),
+- }
+-
+- case *ast.StructType:
+- return &ast.StructType{
+- Struct: expr.Struct,
+- Fields: qualifyFieldList(expr.Fields, qf),
+- Incomplete: expr.Incomplete,
+- }
+-
+- default:
+- return expr
+- }
+-}
+-
+-func qualifyFieldList(fl *ast.FieldList, qf func(string) string) *ast.FieldList {
+- if fl == nil {
+- return nil
+- }
+- if fl.List == nil {
+- return &ast.FieldList{
+- Closing: fl.Closing,
+- Opening: fl.Opening,
+- }
+- }
+- list := make([]*ast.Field, 0, len(fl.List))
+- for _, f := range fl.List {
+- list = append(list, &ast.Field{
+- Comment: f.Comment,
+- Doc: f.Doc,
+- Names: f.Names,
+- Tag: f.Tag,
+- Type: qualifyTypeExpr(f.Type, qf),
+- })
+- }
+- return &ast.FieldList{
+- Closing: fl.Closing,
+- Opening: fl.Opening,
+- List: list,
+- }
+-}
+diff -urN a/gopls/internal/lsp/source/util.go b/gopls/internal/lsp/source/util.go
+--- a/gopls/internal/lsp/source/util.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/util.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,555 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "go/ast"
+- "go/printer"
+- "go/token"
+- "go/types"
+- "path/filepath"
+- "regexp"
+- "sort"
+- "strconv"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/tokeninternal"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-// IsGenerated gets and reads the file denoted by uri and reports
+-// whether it contains a "generated file" comment as described at
+-// https://golang.org/s/generatedcode.
+-//
+-// TODO(adonovan): opt: this function does too much.
+-// Move snapshot.GetFile into the caller (most of which have already done it).
+-func IsGenerated(ctx context.Context, snapshot Snapshot, uri span.URI) bool {
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return false
+- }
+- pgf, err := snapshot.ParseGo(ctx, fh, ParseHeader)
+- if err != nil {
+- return false
+- }
+- for _, commentGroup := range pgf.File.Comments {
+- for _, comment := range commentGroup.List {
+- if matched := generatedRx.MatchString(comment.Text); matched {
+- // Check if comment is at the beginning of the line in source.
+- if safetoken.Position(pgf.Tok, comment.Slash).Column == 1 {
+- return true
+- }
+- }
+- }
+- }
+- return false
+-}
+-
+-// adjustedObjEnd returns the end position of obj, possibly modified for
+-// package names.
+-//
+-// TODO(rfindley): eliminate this function, by inlining it at callsites where
+-// it makes sense.
+-func adjustedObjEnd(obj types.Object) token.Pos {
+- nameLen := len(obj.Name())
+- if pkgName, ok := obj.(*types.PkgName); ok {
+- // An imported Go package has a package-local, unqualified name.
+- // When the name matches the imported package name, there is no
+- // identifier in the import spec with the local package name.
+- //
+- // For example:
+- // import "go/ast" // name "ast" matches package name
+- // import a "go/ast" // name "a" does not match package name
+- //
+- // When the identifier does not appear in the source, have the range
+- // of the object be the import path, including quotes.
+- if pkgName.Imported().Name() == pkgName.Name() {
+- nameLen = len(pkgName.Imported().Path()) + len(`""`)
+- }
+- }
+- return obj.Pos() + token.Pos(nameLen)
+-}
+-
+-// Matches cgo generated comment as well as the proposed standard:
+-//
+-// https://golang.org/s/generatedcode
+-var generatedRx = regexp.MustCompile(`// .*DO NOT EDIT\.?`)
+-
+-// FileKindForLang returns the file kind associated with the given language ID,
+-// or UnknownKind if the language ID is not recognized.
+-func FileKindForLang(langID string) FileKind {
+- switch langID {
+- case "go":
+- return Go
+- case "go.mod":
+- return Mod
+- case "go.sum":
+- return Sum
+- case "tmpl", "gotmpl":
+- return Tmpl
+- case "go.work":
+- return Work
+- default:
+- return UnknownKind
+- }
+-}
+-
+-// nodeAtPos returns the index and the node whose position is contained inside
+-// the node list.
+-func nodeAtPos(nodes []ast.Node, pos token.Pos) (ast.Node, int) {
+- if nodes == nil {
+- return nil, -1
+- }
+- for i, node := range nodes {
+- if node.Pos() <= pos && pos <= node.End() {
+- return node, i
+- }
+- }
+- return nil, -1
+-}
+-
+-// FormatNode returns the "pretty-print" output for an ast node.
+-func FormatNode(fset *token.FileSet, n ast.Node) string {
+- var buf strings.Builder
+- if err := printer.Fprint(&buf, fset, n); err != nil {
+- return ""
+- }
+- return buf.String()
+-}
+-
+-// FormatNodeFile is like FormatNode, but requires only the token.File for the
+-// syntax containing the given ast node.
+-func FormatNodeFile(file *token.File, n ast.Node) string {
+- fset := FileSetFor(file)
+- return FormatNode(fset, n)
+-}
+-
+-// FileSetFor returns a new FileSet containing a sequence of new Files with
+-// the same base, size, and line as the input files, for use in APIs that
+-// require a FileSet.
+-//
+-// Precondition: the input files must be non-overlapping, and sorted in order
+-// of their Base.
+-func FileSetFor(files ...*token.File) *token.FileSet {
+- fset := token.NewFileSet()
+- for _, f := range files {
+- f2 := fset.AddFile(f.Name(), f.Base(), f.Size())
+- lines := tokeninternal.GetLines(f)
+- f2.SetLines(lines)
+- }
+- return fset
+-}
+-
+-// Deref returns a pointer's element type, traversing as many levels as needed.
+-// Otherwise it returns typ.
+-//
+-// It can return a pointer type for cyclic types (see golang/go#45510).
+-func Deref(typ types.Type) types.Type {
+- var seen map[types.Type]struct{}
+- for {
+- p, ok := typ.Underlying().(*types.Pointer)
+- if !ok {
+- return typ
+- }
+- if _, ok := seen[p.Elem()]; ok {
+- return typ
+- }
+-
+- typ = p.Elem()
+-
+- if seen == nil {
+- seen = make(map[types.Type]struct{})
+- }
+- seen[typ] = struct{}{}
+- }
+-}
+-
+-func SortDiagnostics(d []*Diagnostic) {
+- sort.Slice(d, func(i int, j int) bool {
+- return CompareDiagnostic(d[i], d[j]) < 0
+- })
+-}
+-
+-func CompareDiagnostic(a, b *Diagnostic) int {
+- if r := protocol.CompareRange(a.Range, b.Range); r != 0 {
+- return r
+- }
+- if a.Source < b.Source {
+- return -1
+- }
+- if a.Source > b.Source {
+- return +1
+- }
+- if a.Message < b.Message {
+- return -1
+- }
+- if a.Message > b.Message {
+- return +1
+- }
+- return 0
+-}
+-
+-// findFileInDeps finds package metadata containing URI in the transitive
+-// dependencies of m. When using the Go command, the answer is unique.
+-//
+-// TODO(rfindley): refactor to share logic with findPackageInDeps?
+-func findFileInDeps(s MetadataSource, m *Metadata, uri span.URI) *Metadata {
+- seen := make(map[PackageID]bool)
+- var search func(*Metadata) *Metadata
+- search = func(m *Metadata) *Metadata {
+- if seen[m.ID] {
+- return nil
+- }
+- seen[m.ID] = true
+- for _, cgf := range m.CompiledGoFiles {
+- if cgf == uri {
+- return m
+- }
+- }
+- for _, dep := range m.DepsByPkgPath {
+- m := s.Metadata(dep)
+- if m == nil {
+- bug.Reportf("nil metadata for %q", dep)
+- continue
+- }
+- if found := search(m); found != nil {
+- return found
+- }
+- }
+- return nil
+- }
+- return search(m)
+-}
+-
+-// UnquoteImportPath returns the unquoted import path of s,
+-// or "" if the path is not properly quoted.
+-func UnquoteImportPath(s *ast.ImportSpec) ImportPath {
+- path, err := strconv.Unquote(s.Path.Value)
+- if err != nil {
+- return ""
+- }
+- return ImportPath(path)
+-}
+-
+-// NodeContains returns true if a node encloses a given position pos.
+-func NodeContains(n ast.Node, pos token.Pos) bool {
+- return n != nil && n.Pos() <= pos && pos <= n.End()
+-}
+-
+-// CollectScopes returns all scopes in an ast path, ordered as innermost scope
+-// first.
+-func CollectScopes(info *types.Info, path []ast.Node, pos token.Pos) []*types.Scope {
+- // scopes[i], where i<len(path), is the possibly nil Scope of path[i].
+- var scopes []*types.Scope
+- for _, n := range path {
+- // Include *FuncType scope if pos is inside the function body.
+- switch node := n.(type) {
+- case *ast.FuncDecl:
+- if node.Body != nil && NodeContains(node.Body, pos) {
+- n = node.Type
+- }
+- case *ast.FuncLit:
+- if node.Body != nil && NodeContains(node.Body, pos) {
+- n = node.Type
+- }
+- }
+- scopes = append(scopes, info.Scopes[n])
+- }
+- return scopes
+-}
+-
+-// Qualifier returns a function that appropriately formats a types.PkgName
+-// appearing in a *ast.File.
+-func Qualifier(f *ast.File, pkg *types.Package, info *types.Info) types.Qualifier {
+- // Construct mapping of import paths to their defined or implicit names.
+- imports := make(map[*types.Package]string)
+- for _, imp := range f.Imports {
+- var obj types.Object
+- if imp.Name != nil {
+- obj = info.Defs[imp.Name]
+- } else {
+- obj = info.Implicits[imp]
+- }
+- if pkgname, ok := obj.(*types.PkgName); ok {
+- imports[pkgname.Imported()] = pkgname.Name()
+- }
+- }
+- // Define qualifier to replace full package paths with names of the imports.
+- return func(p *types.Package) string {
+- if p == pkg {
+- return ""
+- }
+- if name, ok := imports[p]; ok {
+- if name == "." {
+- return ""
+- }
+- return name
+- }
+- return p.Name()
+- }
+-}
+-
+-// requalifier returns a function that re-qualifies identifiers and qualified
+-// identifiers contained in targetFile using the given metadata qualifier.
+-func requalifier(s MetadataSource, targetFile *ast.File, targetMeta *Metadata, mq MetadataQualifier) func(string) string {
+- qm := map[string]string{
+- "": mq(targetMeta.Name, "", targetMeta.PkgPath),
+- }
+-
+- // Construct mapping of import paths to their defined or implicit names.
+- for _, imp := range targetFile.Imports {
+- name, pkgName, impPath, pkgPath := importInfo(s, imp, targetMeta)
+-
+- // Re-map the target name for the source file.
+- qm[name] = mq(pkgName, impPath, pkgPath)
+- }
+-
+- return func(name string) string {
+- if newName, ok := qm[name]; ok {
+- return newName
+- }
+- return name
+- }
+-}
+-
+-// A MetadataQualifier is a function that qualifies an identifier declared in a
+-// package with the given package name, import path, and package path.
+-//
+-// In scenarios where metadata is missing the provided PackageName and
+-// PackagePath may be empty, but ImportPath must always be non-empty.
+-type MetadataQualifier func(PackageName, ImportPath, PackagePath) string
+-
+-// MetadataQualifierForFile returns a metadata qualifier that chooses the best
+-// qualification of an imported package relative to the file f in package with
+-// metadata m.
+-func MetadataQualifierForFile(s MetadataSource, f *ast.File, m *Metadata) MetadataQualifier {
+- // Record local names for import paths.
+- localNames := make(map[ImportPath]string) // local names for imports in f
+- for _, imp := range f.Imports {
+- name, _, impPath, _ := importInfo(s, imp, m)
+- localNames[impPath] = name
+- }
+-
+- // Record a package path -> import path mapping.
+- inverseDeps := make(map[PackageID]PackagePath)
+- for path, id := range m.DepsByPkgPath {
+- inverseDeps[id] = path
+- }
+- importsByPkgPath := make(map[PackagePath]ImportPath) // best import paths by pkgPath
+- for impPath, id := range m.DepsByImpPath {
+- if id == "" {
+- continue
+- }
+- pkgPath := inverseDeps[id]
+- _, hasPath := importsByPkgPath[pkgPath]
+- _, hasImp := localNames[impPath]
+- // In rare cases, there may be multiple import paths with the same package
+- // path. In such scenarios, prefer an import path that already exists in
+- // the file.
+- if !hasPath || hasImp {
+- importsByPkgPath[pkgPath] = impPath
+- }
+- }
+-
+- return func(pkgName PackageName, impPath ImportPath, pkgPath PackagePath) string {
+- // If supplied, translate the package path to an import path in the source
+- // package.
+- if pkgPath != "" {
+- if srcImp := importsByPkgPath[pkgPath]; srcImp != "" {
+- impPath = srcImp
+- }
+- if pkgPath == m.PkgPath {
+- return ""
+- }
+- }
+- if localName, ok := localNames[impPath]; ok && impPath != "" {
+- return string(localName)
+- }
+- if pkgName != "" {
+- return string(pkgName)
+- }
+- idx := strings.LastIndexByte(string(impPath), '/')
+- return string(impPath[idx+1:])
+- }
+-}
+-
+-// importInfo collects information about the import specified by imp,
+-// extracting its file-local name, package name, import path, and package path.
+-//
+-// If metadata is missing for the import, the resulting package name and
+-// package path may be empty, and the file local name may be guessed based on
+-// the import path.
+-//
+-// Note: previous versions of this helper used a PackageID->PackagePath map
+-// extracted from m, for extracting package path even in the case where
+-// metadata for a dep was missing. This should not be necessary, as we should
+-// always have metadata for IDs contained in DepsByPkgPath.
+-func importInfo(s MetadataSource, imp *ast.ImportSpec, m *Metadata) (string, PackageName, ImportPath, PackagePath) {
+- var (
+- name string // local name
+- pkgName PackageName
+- impPath = UnquoteImportPath(imp)
+- pkgPath PackagePath
+- )
+-
+- // If the import has a local name, use it.
+- if imp.Name != nil {
+- name = imp.Name.Name
+- }
+-
+- // Try to find metadata for the import. If successful and there is no local
+- // name, the package name is the local name.
+- if depID := m.DepsByImpPath[impPath]; depID != "" {
+- if depm := s.Metadata(depID); depm != nil {
+- if name == "" {
+- name = string(depm.Name)
+- }
+- pkgName = depm.Name
+- pkgPath = depm.PkgPath
+- }
+- }
+-
+- // If the local name is still unknown, guess it based on the import path.
+- if name == "" {
+- idx := strings.LastIndexByte(string(impPath), '/')
+- name = string(impPath[idx+1:])
+- }
+- return name, pkgName, impPath, pkgPath
+-}
+-
+-// isDirective reports whether c is a comment directive.
+-//
+-// Copied and adapted from go/src/go/ast/ast.go.
+-func isDirective(c string) bool {
+- if len(c) < 3 {
+- return false
+- }
+- if c[1] != '/' {
+- return false
+- }
+- //-style comment (no newline at the end)
+- c = c[2:]
+- if len(c) == 0 {
+- // empty line
+- return false
+- }
+- // "//line " is a line directive.
+- // (The // has been removed.)
+- if strings.HasPrefix(c, "line ") {
+- return true
+- }
+-
+- // "//[a-z0-9]+:[a-z0-9]"
+- // (The // has been removed.)
+- colon := strings.Index(c, ":")
+- if colon <= 0 || colon+1 >= len(c) {
+- return false
+- }
+- for i := 0; i <= colon+1; i++ {
+- if i == colon {
+- continue
+- }
+- b := c[i]
+- if !('a' <= b && b <= 'z' || '0' <= b && b <= '9') {
+- return false
+- }
+- }
+- return true
+-}
+-
+-// InDir checks whether path is in the file tree rooted at dir.
+-// It checks only the lexical form of the file names.
+-// It does not consider symbolic links.
+-//
+-// Copied from go/src/cmd/go/internal/search/search.go.
+-func InDir(dir, path string) bool {
+- pv := strings.ToUpper(filepath.VolumeName(path))
+- dv := strings.ToUpper(filepath.VolumeName(dir))
+- path = path[len(pv):]
+- dir = dir[len(dv):]
+- switch {
+- default:
+- return false
+- case pv != dv:
+- return false
+- case len(path) == len(dir):
+- if path == dir {
+- return true
+- }
+- return false
+- case dir == "":
+- return path != ""
+- case len(path) > len(dir):
+- if dir[len(dir)-1] == filepath.Separator {
+- if path[:len(dir)] == dir {
+- return path[len(dir):] != ""
+- }
+- return false
+- }
+- if path[len(dir)] == filepath.Separator && path[:len(dir)] == dir {
+- if len(path) == len(dir)+1 {
+- return true
+- }
+- return path[len(dir)+1:] != ""
+- }
+- return false
+- }
+-}
+-
+-// IsValidImport returns whether importPkgPath is importable
+-// by pkgPath
+-func IsValidImport(pkgPath, importPkgPath PackagePath) bool {
+- i := strings.LastIndex(string(importPkgPath), "/internal/")
+- if i == -1 {
+- return true
+- }
+- // TODO(rfindley): this looks wrong: IsCommandLineArguments is meant to
+- // operate on package IDs, not package paths.
+- if IsCommandLineArguments(PackageID(pkgPath)) {
+- return true
+- }
+- // TODO(rfindley): this is wrong. mod.testx/p should not be able to
+- // import mod.test/internal: https://go.dev/play/p/-Ca6P-E4V4q
+- return strings.HasPrefix(string(pkgPath), string(importPkgPath[:i]))
+-}
+-
+-// IsCommandLineArguments reports whether a given value denotes
+-// "command-line-arguments" package, which is a package with an unknown ID
+-// created by the go command. It can have a test variant, which is why callers
+-// should not check that a value equals "command-line-arguments" directly.
+-func IsCommandLineArguments(id PackageID) bool {
+- return strings.Contains(string(id), "command-line-arguments")
+-}
+-
+-// embeddedIdent returns the type name identifier for an embedding x, if x in a
+-// valid embedding. Otherwise, it returns nil.
+-//
+-// Spec: An embedded field must be specified as a type name T or as a pointer
+-// to a non-interface type name *T
+-func embeddedIdent(x ast.Expr) *ast.Ident {
+- if star, ok := x.(*ast.StarExpr); ok {
+- x = star.X
+- }
+- switch ix := x.(type) { // check for instantiated receivers
+- case *ast.IndexExpr:
+- x = ix.X
+- case *typeparams.IndexListExpr:
+- x = ix.X
+- }
+- switch x := x.(type) {
+- case *ast.Ident:
+- return x
+- case *ast.SelectorExpr:
+- if _, ok := x.X.(*ast.Ident); ok {
+- return x.Sel
+- }
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/lsp/source/view.go b/gopls/internal/lsp/source/view.go
+--- a/gopls/internal/lsp/source/view.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/view.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,857 +0,0 @@
+-// Copyright 2018 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "bytes"
+- "context"
+- "crypto/sha256"
+- "errors"
+- "fmt"
+- "go/ast"
+- "go/scanner"
+- "go/token"
+- "go/types"
+- "io"
+-
+- "golang.org/x/mod/modfile"
+- "golang.org/x/tools/go/analysis"
+- "golang.org/x/tools/go/packages"
+- "golang.org/x/tools/go/types/objectpath"
+- "golang.org/x/tools/gopls/internal/govulncheck"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/lsp/source/methodsets"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/event/label"
+- "golang.org/x/tools/internal/event/tag"
+- "golang.org/x/tools/internal/gocommand"
+- "golang.org/x/tools/internal/imports"
+- "golang.org/x/tools/internal/packagesinternal"
+-)
+-
+-// A GlobalSnapshotID uniquely identifies a snapshot within this process and
+-// increases monotonically with snapshot creation time.
+-//
+-// We use a distinct integral type for global IDs to help enforce correct
+-// usage.
+-type GlobalSnapshotID uint64
+-
+-// Snapshot represents the current state for the given view.
+-type Snapshot interface {
+- // SequenceID is the sequence id of this snapshot within its containing
+- // view.
+- //
+- // Relative to their view sequence ids are monotonically increasing, but this
+- // does not hold globally: when new views are created their initial snapshot
+- // has sequence ID 0. For operations that span multiple views, use global
+- // IDs.
+- SequenceID() uint64
+-
+- // GlobalID is a globally unique identifier for this snapshot. Global IDs are
+- // monotonic: subsequent snapshots will have higher global ID, though
+- // subsequent snapshots in a view may not have adjacent global IDs.
+- GlobalID() GlobalSnapshotID
+-
+- // View returns the View associated with this snapshot.
+- View() View
+-
+- // BackgroundContext returns a context used for all background processing
+- // on behalf of this snapshot.
+- BackgroundContext() context.Context
+-
+- // ValidBuildConfiguration returns true if there is some error in the
+- // user's workspace. In particular, if they are both outside of a module
+- // and their GOPATH.
+- ValidBuildConfiguration() bool
+-
+- // FindFile returns the FileHandle for the given URI, if it is already
+- // in the given snapshot.
+- FindFile(uri span.URI) FileHandle
+-
+- // GetFile returns the FileHandle for a given URI, initializing it if it is
+- // not already part of the snapshot.
+- GetFile(ctx context.Context, uri span.URI) (FileHandle, error)
+-
+- // AwaitInitialized waits until the snapshot's view is initialized.
+- AwaitInitialized(ctx context.Context)
+-
+- // IsOpen returns whether the editor currently has a file open.
+- IsOpen(uri span.URI) bool
+-
+- // IgnoredFile reports if a file would be ignored by a `go list` of the whole
+- // workspace.
+- IgnoredFile(uri span.URI) bool
+-
+- // Templates returns the .tmpl files
+- Templates() map[span.URI]FileHandle
+-
+- // ParseGo returns the parsed AST for the file.
+- // If the file is not available, returns nil and an error.
+- // Position information is added to FileSet().
+- ParseGo(ctx context.Context, fh FileHandle, mode ParseMode) (*ParsedGoFile, error)
+-
+- // Analyze runs the specified analyzers on the given package at this snapshot.
+- Analyze(ctx context.Context, id PackageID, analyzers []*Analyzer) ([]*Diagnostic, error)
+-
+- // RunGoCommandPiped runs the given `go` command, writing its output
+- // to stdout and stderr. Verb, Args, and WorkingDir must be specified.
+- //
+- // RunGoCommandPiped runs the command serially using gocommand.RunPiped,
+- // enforcing that this command executes exclusively to other commands on the
+- // server.
+- RunGoCommandPiped(ctx context.Context, mode InvocationFlags, inv *gocommand.Invocation, stdout, stderr io.Writer) error
+-
+- // RunGoCommandDirect runs the given `go` command. Verb, Args, and
+- // WorkingDir must be specified.
+- RunGoCommandDirect(ctx context.Context, mode InvocationFlags, inv *gocommand.Invocation) (*bytes.Buffer, error)
+-
+- // RunGoCommands runs a series of `go` commands that updates the go.mod
+- // and go.sum file for wd, and returns their updated contents.
+- RunGoCommands(ctx context.Context, allowNetwork bool, wd string, run func(invoke func(...string) (*bytes.Buffer, error)) error) (bool, []byte, []byte, error)
+-
+- // RunProcessEnvFunc runs fn with the process env for this snapshot's view.
+- // Note: the process env contains cached module and filesystem state.
+- RunProcessEnvFunc(ctx context.Context, fn func(*imports.Options) error) error
+-
+- // ModFiles are the go.mod files enclosed in the snapshot's view and known
+- // to the snapshot.
+- ModFiles() []span.URI
+-
+- // ParseMod is used to parse go.mod files.
+- ParseMod(ctx context.Context, fh FileHandle) (*ParsedModule, error)
+-
+- // ModWhy returns the results of `go mod why` for the module specified by
+- // the given go.mod file.
+- ModWhy(ctx context.Context, fh FileHandle) (map[string]string, error)
+-
+- // ModTidy returns the results of `go mod tidy` for the module specified by
+- // the given go.mod file.
+- ModTidy(ctx context.Context, pm *ParsedModule) (*TidiedModule, error)
+-
+- // ModVuln returns import vulnerability analysis for the given go.mod URI.
+- // Concurrent requests are combined into a single command.
+- ModVuln(ctx context.Context, modURI span.URI) (*govulncheck.Result, error)
+-
+- // GoModForFile returns the URI of the go.mod file for the given URI.
+- GoModForFile(uri span.URI) span.URI
+-
+- // WorkFile, if non-empty, is the go.work file for the workspace.
+- WorkFile() span.URI
+-
+- // ParseWork is used to parse go.work files.
+- ParseWork(ctx context.Context, fh FileHandle) (*ParsedWorkFile, error)
+-
+- // BuiltinFile returns information about the special builtin package.
+- BuiltinFile(ctx context.Context) (*ParsedGoFile, error)
+-
+- // IsBuiltin reports whether uri is part of the builtin package.
+- IsBuiltin(ctx context.Context, uri span.URI) bool
+-
+- // ReverseDependencies returns a new mapping whose entries are
+- // the ID and Metadata of each package in the workspace that
+- // directly or transitively depend on the package denoted by id,
+- // excluding id itself.
+- ReverseDependencies(ctx context.Context, id PackageID, transitive bool) (map[PackageID]*Metadata, error)
+-
+- // ActiveMetadata returns a new, unordered slice containing
+- // metadata for all packages considered 'active' in the workspace.
+- //
+- // In normal memory mode, this is all workspace packages. In degraded memory
+- // mode, this is just the reverse transitive closure of open packages.
+- ActiveMetadata(ctx context.Context) ([]*Metadata, error)
+-
+- // AllMetadata returns a new unordered array of metadata for all packages in the workspace.
+- AllMetadata(ctx context.Context) ([]*Metadata, error)
+-
+- // Symbols returns all symbols in the snapshot.
+- Symbols(ctx context.Context) (map[span.URI][]Symbol, error)
+-
+- // Metadata returns the metadata for the specified package,
+- // or nil if it was not found.
+- Metadata(id PackageID) *Metadata
+-
+- // MetadataForFile returns a new slice containing metadata for each
+- // package containing the Go file identified by uri, ordered by the
+- // number of CompiledGoFiles (i.e. "narrowest" to "widest" package).
+- // The result may include tests and intermediate test variants of
+- // importable packages.
+- // It returns an error if the context was cancelled.
+- MetadataForFile(ctx context.Context, uri span.URI) ([]*Metadata, error)
+-
+- // TypeCheck parses and type-checks the specified packages,
+- // and returns them in the same order as the ids.
+- // The resulting packages' types may belong to different importers,
+- // so types from different packages are incommensurable.
+- TypeCheck(ctx context.Context, ids ...PackageID) ([]Package, error)
+-
+- // PackageDiagnostics returns diagnostics for files contained in specified
+- // packages.
+- //
+- // If these diagnostics cannot be loaded from cache, the requested packages
+- // may be type-checked.
+- PackageDiagnostics(ctx context.Context, ids ...PackageID) (map[span.URI][]*Diagnostic, error)
+-
+- // References returns cross-references indexes for the specified packages.
+- //
+- // If these indexes cannot be loaded from cache, the requested packages may
+- // be type-checked.
+- References(ctx context.Context, ids ...PackageID) ([]XrefIndex, error)
+-
+- // MethodSets returns method-set indexes for the specified packages.
+- //
+- // If these indexes cannot be loaded from cache, the requested packages may
+- // be type-checked.
+- MethodSets(ctx context.Context, ids ...PackageID) ([]*methodsets.Index, error)
+-
+- // GetCriticalError returns any critical errors in the workspace.
+- //
+- // A nil result may mean success, or context cancellation.
+- GetCriticalError(ctx context.Context) *CriticalError
+-}
+-
+-type XrefIndex interface {
+- Lookup(targets map[PackagePath]map[objectpath.Path]struct{}) (locs []protocol.Location)
+-}
+-
+-// SnapshotLabels returns a new slice of labels that should be used for events
+-// related to a snapshot.
+-func SnapshotLabels(snapshot Snapshot) []label.Label {
+- return []label.Label{tag.Snapshot.Of(snapshot.SequenceID()), tag.Directory.Of(snapshot.View().Folder())}
+-}
+-
+-// PackageForFile is a convenience function that selects a package to
+-// which this file belongs (narrowest or widest), type-checks it in
+-// the requested mode (full or workspace), and returns it, along with
+-// the parse tree of that file.
+-//
+-// Type-checking is expensive. Call snapshot.ParseGo if all you need
+-// is a parse tree, or snapshot.MetadataForFile if you only need metadata.
+-func PackageForFile(ctx context.Context, snapshot Snapshot, uri span.URI, pkgSel PackageSelector) (Package, *ParsedGoFile, error) {
+- metas, err := snapshot.MetadataForFile(ctx, uri)
+- if err != nil {
+- return nil, nil, err
+- }
+- if len(metas) == 0 {
+- return nil, nil, fmt.Errorf("no package metadata for file %s", uri)
+- }
+- switch pkgSel {
+- case NarrowestPackage:
+- metas = metas[:1]
+- case WidestPackage:
+- metas = metas[len(metas)-1:]
+- }
+- pkgs, err := snapshot.TypeCheck(ctx, metas[0].ID)
+- if err != nil {
+- return nil, nil, err
+- }
+- pkg := pkgs[0]
+- pgf, err := pkg.File(uri)
+- if err != nil {
+- return nil, nil, err // "can't happen"
+- }
+- return pkg, pgf, err
+-}
+-
+-// PackageSelector sets how a package is selected out from a set of packages
+-// containing a given file.
+-type PackageSelector int
+-
+-const (
+- // NarrowestPackage picks the "narrowest" package for a given file.
+- // By "narrowest" package, we mean the package with the fewest number of
+- // files that includes the given file. This solves the problem of test
+- // variants, as the test will have more files than the non-test package.
+- NarrowestPackage PackageSelector = iota
+-
+- // WidestPackage returns the Package containing the most files.
+- // This is useful for something like diagnostics, where we'd prefer to
+- // offer diagnostics for as many files as possible.
+- WidestPackage
+-)
+-
+-// InvocationFlags represents the settings of a particular go command invocation.
+-// It is a mode, plus a set of flag bits.
+-type InvocationFlags int
+-
+-const (
+- // Normal is appropriate for commands that might be run by a user and don't
+- // deliberately modify go.mod files, e.g. `go test`.
+- Normal InvocationFlags = iota
+- // WriteTemporaryModFile is for commands that need information from a
+- // modified version of the user's go.mod file, e.g. `go mod tidy` used to
+- // generate diagnostics.
+- WriteTemporaryModFile
+- // LoadWorkspace is for packages.Load, and other operations that should
+- // consider the whole workspace at once.
+- LoadWorkspace
+-
+- // AllowNetwork is a flag bit that indicates the invocation should be
+- // allowed to access the network.
+- AllowNetwork InvocationFlags = 1 << 10
+-)
+-
+-func (m InvocationFlags) Mode() InvocationFlags {
+- return m & (AllowNetwork - 1)
+-}
+-
+-func (m InvocationFlags) AllowNetwork() bool {
+- return m&AllowNetwork != 0
+-}
+-
+-// View represents a single workspace.
+-// This is the level at which we maintain configuration like working directory
+-// and build tags.
+-type View interface {
+- // Name returns the name this view was constructed with.
+- Name() string
+-
+- // Folder returns the folder with which this view was created.
+- Folder() span.URI
+-
+- // Options returns a copy of the Options for this view.
+- Options() *Options
+-
+- // Snapshot returns the current snapshot for the view, and a
+- // release function that must be called when the Snapshot is
+- // no longer needed.
+- //
+- // If the view is shut down, the resulting error will be non-nil, and the
+- // release function need not be called.
+- Snapshot() (Snapshot, func(), error)
+-
+- // IsGoPrivatePath reports whether target is a private import path, as identified
+- // by the GOPRIVATE environment variable.
+- IsGoPrivatePath(path string) bool
+-
+- // ModuleUpgrades returns known module upgrades for the dependencies of
+- // modfile.
+- ModuleUpgrades(modfile span.URI) map[string]string
+-
+- // RegisterModuleUpgrades registers that upgrades exist for the given modules
+- // required by modfile.
+- RegisterModuleUpgrades(modfile span.URI, upgrades map[string]string)
+-
+- // ClearModuleUpgrades clears all upgrades for the modules in modfile.
+- ClearModuleUpgrades(modfile span.URI)
+-
+- // Vulnerabilities returns known vulnerabilities for the given modfile.
+- // TODO(suzmue): replace command.Vuln with a different type, maybe
+- // https://pkg.go.dev/golang.org/x/vuln/cmd/govulncheck/govulnchecklib#Summary?
+- Vulnerabilities(modfile ...span.URI) map[span.URI]*govulncheck.Result
+-
+- // SetVulnerabilities resets the list of vulnerabilities that exists for the given modules
+- // required by modfile.
+- SetVulnerabilities(modfile span.URI, vulncheckResult *govulncheck.Result)
+-
+- // FileKind returns the type of a file.
+- //
+- // We can't reliably deduce the kind from the file name alone,
+- // as some editors can be told to interpret a buffer as
+- // language different from the file name heuristic, e.g. that
+- // an .html file actually contains Go "html/template" syntax,
+- // or even that a .go file contains Python.
+- FileKind(FileHandle) FileKind
+-
+- // GoVersion returns the configured Go version for this view.
+- GoVersion() int
+-
+- // GoVersionString returns the go version string configured for this view.
+- // Unlike [GoVersion], this encodes the minor version and commit hash information.
+- GoVersionString() string
+-}
+-
+-// A FileSource maps uris to FileHandles.
+-type FileSource interface {
+- // GetFile returns the FileHandle for a given URI.
+- GetFile(ctx context.Context, uri span.URI) (FileHandle, error)
+-}
+-
+-// A MetadataSource maps package IDs to metadata.
+-//
+-// TODO(rfindley): replace this with a concrete metadata graph, once it is
+-// exposed from the snapshot.
+-type MetadataSource interface {
+- // Metadata returns Metadata for the given package ID, or nil if it does not
+- // exist.
+- Metadata(PackageID) *Metadata
+-}
+-
+-// A ParsedGoFile contains the results of parsing a Go file.
+-type ParsedGoFile struct {
+- URI span.URI
+- Mode ParseMode
+- File *ast.File
+- Tok *token.File
+- // Source code used to build the AST. It may be different from the
+- // actual content of the file if we have fixed the AST.
+- Src []byte
+- Fixed bool
+- Mapper *protocol.Mapper // may map fixed Src, not file content
+- ParseErr scanner.ErrorList
+-}
+-
+-// -- go/token domain convenience helpers --
+-
+-// PositionPos returns the token.Pos of protocol position p within the file.
+-func (pgf *ParsedGoFile) PositionPos(p protocol.Position) (token.Pos, error) {
+- offset, err := pgf.Mapper.PositionOffset(p)
+- if err != nil {
+- return token.NoPos, err
+- }
+- return safetoken.Pos(pgf.Tok, offset)
+-}
+-
+-// PosRange returns a protocol Range for the token.Pos interval in this file.
+-func (pgf *ParsedGoFile) PosRange(start, end token.Pos) (protocol.Range, error) {
+- return pgf.Mapper.PosRange(pgf.Tok, start, end)
+-}
+-
+-// PosMappedRange returns a MappedRange for the token.Pos interval in this file.
+-// A MappedRange can be converted to any other form.
+-func (pgf *ParsedGoFile) PosMappedRange(start, end token.Pos) (protocol.MappedRange, error) {
+- return pgf.Mapper.PosMappedRange(pgf.Tok, start, end)
+-}
+-
+-// PosLocation returns a protocol Location for the token.Pos interval in this file.
+-func (pgf *ParsedGoFile) PosLocation(start, end token.Pos) (protocol.Location, error) {
+- return pgf.Mapper.PosLocation(pgf.Tok, start, end)
+-}
+-
+-// NodeRange returns a protocol Range for the ast.Node interval in this file.
+-func (pgf *ParsedGoFile) NodeRange(node ast.Node) (protocol.Range, error) {
+- return pgf.Mapper.NodeRange(pgf.Tok, node)
+-}
+-
+-// NodeMappedRange returns a MappedRange for the ast.Node interval in this file.
+-// A MappedRange can be converted to any other form.
+-func (pgf *ParsedGoFile) NodeMappedRange(node ast.Node) (protocol.MappedRange, error) {
+- return pgf.Mapper.NodeMappedRange(pgf.Tok, node)
+-}
+-
+-// NodeLocation returns a protocol Location for the ast.Node interval in this file.
+-func (pgf *ParsedGoFile) NodeLocation(node ast.Node) (protocol.Location, error) {
+- return pgf.Mapper.PosLocation(pgf.Tok, node.Pos(), node.End())
+-}
+-
+-// RangePos parses a protocol Range back into the go/token domain.
+-func (pgf *ParsedGoFile) RangePos(r protocol.Range) (token.Pos, token.Pos, error) {
+- start, end, err := pgf.Mapper.RangeOffsets(r)
+- if err != nil {
+- return token.NoPos, token.NoPos, err
+- }
+- return pgf.Tok.Pos(start), pgf.Tok.Pos(end), nil
+-}
+-
+-// A ParsedModule contains the results of parsing a go.mod file.
+-type ParsedModule struct {
+- URI span.URI
+- File *modfile.File
+- Mapper *protocol.Mapper
+- ParseErrors []*Diagnostic
+-}
+-
+-// A ParsedWorkFile contains the results of parsing a go.work file.
+-type ParsedWorkFile struct {
+- URI span.URI
+- File *modfile.WorkFile
+- Mapper *protocol.Mapper
+- ParseErrors []*Diagnostic
+-}
+-
+-// A TidiedModule contains the results of running `go mod tidy` on a module.
+-type TidiedModule struct {
+- // Diagnostics representing changes made by `go mod tidy`.
+- Diagnostics []*Diagnostic
+- // The bytes of the go.mod file after it was tidied.
+- TidiedContent []byte
+-}
+-
+-// Metadata represents package metadata retrieved from go/packages.
+-type Metadata struct {
+- ID PackageID
+- PkgPath PackagePath
+- Name PackageName
+- GoFiles []span.URI
+- CompiledGoFiles []span.URI
+- ForTest PackagePath // package path under test, or ""
+- TypesSizes types.Sizes
+- Errors []packages.Error
+- DepsByImpPath map[ImportPath]PackageID // may contain dups; empty ID => missing
+- DepsByPkgPath map[PackagePath]PackageID // values are unique and non-empty
+- Module *packages.Module
+- DepsErrors []*packagesinternal.PackageError
+- Diagnostics []*Diagnostic // processed diagnostics from 'go list'
+- LoadDir string // directory from which go/packages was run
+-}
+-
+-func (m *Metadata) String() string { return string(m.ID) }
+-
+-// IsIntermediateTestVariant reports whether the given package is an
+-// intermediate test variant, e.g. "net/http [net/url.test]".
+-//
+-// Such test variants arise when an x_test package (in this case net/url_test)
+-// imports a package (in this case net/http) that itself imports the the
+-// non-x_test package (in this case net/url).
+-//
+-// This is done so that the forward transitive closure of net/url_test has
+-// only one package for the "net/url" import.
+-// The intermediate test variant exists to hold the test variant import:
+-//
+-// net/url_test [net/url.test]
+-//
+-// | "net/http" -> net/http [net/url.test]
+-// | "net/url" -> net/url [net/url.test]
+-// | ...
+-//
+-// net/http [net/url.test]
+-//
+-// | "net/url" -> net/url [net/url.test]
+-// | ...
+-//
+-// This restriction propagates throughout the import graph of net/http: for
+-// every package imported by net/http that imports net/url, there must be an
+-// intermediate test variant that instead imports "net/url [net/url.test]".
+-//
+-// As one can see from the example of net/url and net/http, intermediate test
+-// variants can result in many additional packages that are essentially (but
+-// not quite) identical. For this reason, we filter these variants wherever
+-// possible.
+-func (m *Metadata) IsIntermediateTestVariant() bool {
+- return m.ForTest != "" && m.ForTest != m.PkgPath && m.ForTest+"_test" != m.PkgPath
+-}
+-
+-// RemoveIntermediateTestVariants removes intermediate test variants, modifying the array.
+-func RemoveIntermediateTestVariants(metas []*Metadata) []*Metadata {
+- res := metas[:0]
+- for _, m := range metas {
+- if !m.IsIntermediateTestVariant() {
+- res = append(res, m)
+- }
+- }
+- return res
+-}
+-
+-var ErrViewExists = errors.New("view already exists for session")
+-
+-// FileModification represents a modification to a file.
+-type FileModification struct {
+- URI span.URI
+- Action FileAction
+-
+- // OnDisk is true if a watched file is changed on disk.
+- // If true, Version will be -1 and Text will be nil.
+- OnDisk bool
+-
+- // Version will be -1 and Text will be nil when they are not supplied,
+- // specifically on textDocument/didClose and for on-disk changes.
+- Version int32
+- Text []byte
+-
+- // LanguageID is only sent from the language client on textDocument/didOpen.
+- LanguageID string
+-}
+-
+-type FileAction int
+-
+-const (
+- UnknownFileAction = FileAction(iota)
+- Open
+- Change
+- Close
+- Save
+- Create
+- Delete
+- InvalidateMetadata
+-)
+-
+-func (a FileAction) String() string {
+- switch a {
+- case Open:
+- return "Open"
+- case Change:
+- return "Change"
+- case Close:
+- return "Close"
+- case Save:
+- return "Save"
+- case Create:
+- return "Create"
+- case Delete:
+- return "Delete"
+- case InvalidateMetadata:
+- return "InvalidateMetadata"
+- default:
+- return "Unknown"
+- }
+-}
+-
+-var ErrTmpModfileUnsupported = errors.New("-modfile is unsupported for this Go version")
+-var ErrNoModOnDisk = errors.New("go.mod file is not on disk")
+-
+-func IsNonFatalGoModError(err error) bool {
+- return err == ErrTmpModfileUnsupported || err == ErrNoModOnDisk
+-}
+-
+-// ParseMode controls the content of the AST produced when parsing a source file.
+-type ParseMode int
+-
+-const (
+- // ParseHeader specifies that the main package declaration and imports are needed.
+- // This is the mode used when attempting to examine the package graph structure.
+- ParseHeader ParseMode = iota
+-
+- // ParseFull specifies the full AST is needed.
+- // This is used for files of direct interest where the entire contents must
+- // be considered.
+- ParseFull
+-)
+-
+-// A FileHandle is an interface to files tracked by the LSP session, which may
+-// be either files read from disk, or open in the editor session (overlays).
+-type FileHandle interface {
+- // URI is the URI for this file handle.
+- // TODO(rfindley): this is not actually well-defined. In some cases, there
+- // may be more than one URI that resolve to the same FileHandle. Which one is
+- // this?
+- URI() span.URI
+- // FileIdentity returns a FileIdentity for the file, even if there was an
+- // error reading it.
+- FileIdentity() FileIdentity
+- // Saved reports whether the file has the same content on disk.
+- // For on-disk files, this is trivially true.
+- Saved() bool
+- // Version returns the file version, as defined by the LSP client.
+- // For on-disk file handles, Version returns 0.
+- Version() int32
+- // Read reads the contents of a file.
+- // If the file is not available, returns a nil slice and an error.
+- Read() ([]byte, error)
+-}
+-
+-// A Hash is a cryptographic digest of the contents of a file.
+-// (Although at 32B it is larger than a 16B string header, it is smaller
+-// and has better locality than the string header + 64B of hex digits.)
+-type Hash [sha256.Size]byte
+-
+-// HashOf returns the hash of some data.
+-func HashOf(data []byte) Hash {
+- return Hash(sha256.Sum256(data))
+-}
+-
+-// Hashf returns the hash of a printf-formatted string.
+-func Hashf(format string, args ...interface{}) Hash {
+- // Although this looks alloc-heavy, it is faster than using
+- // Fprintf on sha256.New() because the allocations don't escape.
+- return HashOf([]byte(fmt.Sprintf(format, args...)))
+-}
+-
+-// String returns the digest as a string of hex digits.
+-func (h Hash) String() string {
+- return fmt.Sprintf("%64x", [sha256.Size]byte(h))
+-}
+-
+-// Less returns true if the given hash is less than the other.
+-func (h Hash) Less(other Hash) bool {
+- return bytes.Compare(h[:], other[:]) < 0
+-}
+-
+-// XORWith updates *h to *h XOR h2.
+-func (h *Hash) XORWith(h2 Hash) {
+- // Small enough that we don't need crypto/subtle.XORBytes.
+- for i := range h {
+- h[i] ^= h2[i]
+- }
+-}
+-
+-// FileIdentity uniquely identifies a file at a version from a FileSystem.
+-type FileIdentity struct {
+- URI span.URI
+- Hash Hash // digest of file contents
+-}
+-
+-func (id FileIdentity) String() string {
+- return fmt.Sprintf("%s%s", id.URI, id.Hash)
+-}
+-
+-// FileKind describes the kind of the file in question.
+-// It can be one of Go,mod, Sum, or Tmpl.
+-type FileKind int
+-
+-const (
+- // UnknownKind is a file type we don't know about.
+- UnknownKind = FileKind(iota)
+-
+- // Go is a normal go source file.
+- Go
+- // Mod is a go.mod file.
+- Mod
+- // Sum is a go.sum file.
+- Sum
+- // Tmpl is a template file.
+- Tmpl
+- // Work is a go.work file.
+- Work
+-)
+-
+-func (k FileKind) String() string {
+- switch k {
+- case Go:
+- return "go"
+- case Mod:
+- return "go.mod"
+- case Sum:
+- return "go.sum"
+- case Tmpl:
+- return "tmpl"
+- case Work:
+- return "go.work"
+- default:
+- return fmt.Sprintf("internal error: unknown file kind %d", k)
+- }
+-}
+-
+-// Analyzer represents a go/analysis analyzer with some boolean properties
+-// that let the user know how to use the analyzer.
+-type Analyzer struct {
+- Analyzer *analysis.Analyzer
+-
+- // Enabled reports whether the analyzer is enabled. This value can be
+- // configured per-analysis in user settings. For staticcheck analyzers,
+- // the value of the Staticcheck setting overrides this field.
+- //
+- // Most clients should use the IsEnabled method.
+- Enabled bool
+-
+- // Fix is the name of the suggested fix name used to invoke the suggested
+- // fixes for the analyzer. It is non-empty if we expect this analyzer to
+- // provide its fix separately from its diagnostics. That is, we should apply
+- // the analyzer's suggested fixes through a Command, not a TextEdit.
+- Fix string
+-
+- // ActionKind is the kind of code action this analyzer produces. If
+- // unspecified the type defaults to quickfix.
+- ActionKind []protocol.CodeActionKind
+-
+- // Severity is the severity set for diagnostics reported by this
+- // analyzer. If left unset it defaults to Warning.
+- Severity protocol.DiagnosticSeverity
+-}
+-
+-func (a *Analyzer) String() string { return a.Analyzer.String() }
+-
+-// IsEnabled reports whether this analyzer is enabled by the given options.
+-func (a Analyzer) IsEnabled(options *Options) bool {
+- // Staticcheck analyzers can only be enabled when staticcheck is on.
+- if _, ok := options.StaticcheckAnalyzers[a.Analyzer.Name]; ok {
+- if !options.Staticcheck {
+- return false
+- }
+- }
+- if enabled, ok := options.Analyses[a.Analyzer.Name]; ok {
+- return enabled
+- }
+- return a.Enabled
+-}
+-
+-// Declare explicit types for package paths, names, and IDs to ensure that we
+-// never use an ID where a path belongs, and vice versa. If we confused these,
+-// it would result in confusing errors because package IDs often look like
+-// package paths.
+-type (
+- PackageID string // go list's unique identifier for a package (e.g. "vendor/example.com/foo [vendor/example.com/bar.test]")
+- PackagePath string // name used to prefix linker symbols (e.g. "vendor/example.com/foo")
+- PackageName string // identifier in 'package' declaration (e.g. "foo")
+- ImportPath string // path that appears in an import declaration (e.g. "example.com/foo")
+-)
+-
+-// Package represents a Go package that has been parsed and type-checked.
+-//
+-// By design, there is no way to reach from a Package to the Package
+-// representing one of its dependencies.
+-//
+-// Callers must not assume that two Packages share the same
+-// token.FileSet or types.Importer and thus have commensurable
+-// token.Pos values or types.Objects. Instead, use stable naming
+-// schemes, such as (URI, byte offset) for positions, or (PackagePath,
+-// objectpath.Path) for exported declarations.
+-type Package interface {
+- Metadata() *Metadata
+-
+- // Results of parsing:
+- FileSet() *token.FileSet
+- ParseMode() ParseMode
+- CompiledGoFiles() []*ParsedGoFile // (borrowed)
+- File(uri span.URI) (*ParsedGoFile, error)
+- GetSyntax() []*ast.File // (borrowed)
+- HasParseErrors() bool
+-
+- // Results of type checking:
+- GetTypes() *types.Package
+- GetTypesInfo() *types.Info
+- DependencyTypes(PackagePath) *types.Package // nil for indirect dependency of no consequence
+- HasTypeErrors() bool
+- DiagnosticsForFile(ctx context.Context, s Snapshot, uri span.URI) ([]*Diagnostic, error)
+-}
+-
+-type unit = struct{}
+-
+-// A CriticalError is a workspace-wide error that generally prevents gopls from
+-// functioning correctly. In the presence of critical errors, other diagnostics
+-// in the workspace may not make sense.
+-type CriticalError struct {
+- // MainError is the primary error. Must be non-nil.
+- MainError error
+-
+- // Diagnostics contains any supplemental (structured) diagnostics.
+- Diagnostics []*Diagnostic
+-}
+-
+-// An Diagnostic corresponds to an LSP Diagnostic.
+-// https://microsoft.github.io/language-server-protocol/specification#diagnostic
+-type Diagnostic struct {
+- URI span.URI
+- Range protocol.Range
+- Severity protocol.DiagnosticSeverity
+- Code string
+- CodeHref string
+-
+- // Source is a human-readable description of the source of the error.
+- // Diagnostics generated by an analysis.Analyzer set it to Analyzer.Name.
+- Source DiagnosticSource
+-
+- Message string
+-
+- Tags []protocol.DiagnosticTag
+- Related []protocol.DiagnosticRelatedInformation
+-
+- // Fields below are used internally to generate quick fixes. They aren't
+- // part of the LSP spec and don't leave the server.
+- SuggestedFixes []SuggestedFix
+-}
+-
+-func (d *Diagnostic) String() string {
+- return fmt.Sprintf("%v: %s", d.Range, d.Message)
+-}
+-
+-type DiagnosticSource string
+-
+-const (
+- UnknownError DiagnosticSource = "<Unknown source>"
+- ListError DiagnosticSource = "go list"
+- ParseError DiagnosticSource = "syntax"
+- TypeError DiagnosticSource = "compiler"
+- ModTidyError DiagnosticSource = "go mod tidy"
+- OptimizationDetailsError DiagnosticSource = "optimizer details"
+- UpgradeNotification DiagnosticSource = "upgrade available"
+- Vulncheck DiagnosticSource = "vulncheck imports"
+- Govulncheck DiagnosticSource = "govulncheck"
+- TemplateError DiagnosticSource = "template"
+- WorkFileError DiagnosticSource = "go.work file"
+-)
+-
+-func AnalyzerErrorKind(name string) DiagnosticSource {
+- return DiagnosticSource(name)
+-}
+diff -urN a/gopls/internal/lsp/source/workspace_symbol.go b/gopls/internal/lsp/source/workspace_symbol.go
+--- a/gopls/internal/lsp/source/workspace_symbol.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/workspace_symbol.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,632 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "context"
+- "fmt"
+- "go/types"
+- "path"
+- "path/filepath"
+- "regexp"
+- "runtime"
+- "sort"
+- "strings"
+- "unicode"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/fuzzy"
+-)
+-
+-// Symbol holds a precomputed symbol value. Note: we avoid using the
+-// protocol.SymbolInformation struct here in order to reduce the size of each
+-// symbol.
+-type Symbol struct {
+- Name string
+- Kind protocol.SymbolKind
+- Range protocol.Range
+-}
+-
+-// maxSymbols defines the maximum number of symbol results that should ever be
+-// sent in response to a client.
+-const maxSymbols = 100
+-
+-// WorkspaceSymbols matches symbols across all views using the given query,
+-// according to the match semantics parameterized by matcherType and style.
+-//
+-// The workspace symbol method is defined in the spec as follows:
+-//
+-// The workspace symbol request is sent from the client to the server to
+-// list project-wide symbols matching the query string.
+-//
+-// It is unclear what "project-wide" means here, but given the parameters of
+-// workspace/symbol do not include any workspace identifier, then it has to be
+-// assumed that "project-wide" means "across all workspaces". Hence why
+-// WorkspaceSymbols receives the views []View.
+-//
+-// However, it then becomes unclear what it would mean to call WorkspaceSymbols
+-// with a different configured SymbolMatcher per View. Therefore we assume that
+-// Session level configuration will define the SymbolMatcher to be used for the
+-// WorkspaceSymbols method.
+-func WorkspaceSymbols(ctx context.Context, matcher SymbolMatcher, style SymbolStyle, views []View, query string) ([]protocol.SymbolInformation, error) {
+- ctx, done := event.Start(ctx, "source.WorkspaceSymbols")
+- defer done()
+- if query == "" {
+- return nil, nil
+- }
+-
+- var s symbolizer
+- switch style {
+- case DynamicSymbols:
+- s = dynamicSymbolMatch
+- case FullyQualifiedSymbols:
+- s = fullyQualifiedSymbolMatch
+- case PackageQualifiedSymbols:
+- s = packageSymbolMatch
+- default:
+- panic(fmt.Errorf("unknown symbol style: %v", style))
+- }
+-
+- return collectSymbols(ctx, views, matcher, s, query)
+-}
+-
+-// A matcherFunc returns the index and score of a symbol match.
+-//
+-// See the comment for symbolCollector for more information.
+-type matcherFunc func(chunks []string) (int, float64)
+-
+-// A symbolizer returns the best symbol match for a name with pkg, according to
+-// some heuristic. The symbol name is passed as the slice nameParts of logical
+-// name pieces. For example, for myType.field the caller can pass either
+-// []string{"myType.field"} or []string{"myType.", "field"}.
+-//
+-// See the comment for symbolCollector for more information.
+-//
+-// The space argument is an empty slice with spare capacity that may be used
+-// to allocate the result.
+-type symbolizer func(space []string, name string, pkg *Metadata, m matcherFunc) ([]string, float64)
+-
+-func fullyQualifiedSymbolMatch(space []string, name string, pkg *Metadata, matcher matcherFunc) ([]string, float64) {
+- if _, score := dynamicSymbolMatch(space, name, pkg, matcher); score > 0 {
+- return append(space, string(pkg.PkgPath), ".", name), score
+- }
+- return nil, 0
+-}
+-
+-func dynamicSymbolMatch(space []string, name string, pkg *Metadata, matcher matcherFunc) ([]string, float64) {
+- if IsCommandLineArguments(pkg.ID) {
+- // command-line-arguments packages have a non-sensical package path, so
+- // just use their package name.
+- return packageSymbolMatch(space, name, pkg, matcher)
+- }
+-
+- var score float64
+-
+- endsInPkgName := strings.HasSuffix(string(pkg.PkgPath), string(pkg.Name))
+-
+- // If the package path does not end in the package name, we need to check the
+- // package-qualified symbol as an extra pass first.
+- if !endsInPkgName {
+- pkgQualified := append(space, string(pkg.Name), ".", name)
+- idx, score := matcher(pkgQualified)
+- nameStart := len(pkg.Name) + 1
+- if score > 0 {
+- // If our match is contained entirely within the unqualified portion,
+- // just return that.
+- if idx >= nameStart {
+- return append(space, name), score
+- }
+- // Lower the score for matches that include the package name.
+- return pkgQualified, score * 0.8
+- }
+- }
+-
+- // Now try matching the fully qualified symbol.
+- fullyQualified := append(space, string(pkg.PkgPath), ".", name)
+- idx, score := matcher(fullyQualified)
+-
+- // As above, check if we matched just the unqualified symbol name.
+- nameStart := len(pkg.PkgPath) + 1
+- if idx >= nameStart {
+- return append(space, name), score
+- }
+-
+- // If our package path ends in the package name, we'll have skipped the
+- // initial pass above, so check if we matched just the package-qualified
+- // name.
+- if endsInPkgName && idx >= 0 {
+- pkgStart := len(pkg.PkgPath) - len(pkg.Name)
+- if idx >= pkgStart {
+- return append(space, string(pkg.Name), ".", name), score
+- }
+- }
+-
+- // Our match was not contained within the unqualified or package qualified
+- // symbol. Return the fully qualified symbol but discount the score.
+- return fullyQualified, score * 0.6
+-}
+-
+-func packageSymbolMatch(space []string, name string, pkg *Metadata, matcher matcherFunc) ([]string, float64) {
+- qualified := append(space, string(pkg.Name), ".", name)
+- if _, s := matcher(qualified); s > 0 {
+- return qualified, s
+- }
+- return nil, 0
+-}
+-
+-func buildMatcher(matcher SymbolMatcher, query string) matcherFunc {
+- switch matcher {
+- case SymbolFuzzy:
+- return parseQuery(query, newFuzzyMatcher)
+- case SymbolFastFuzzy:
+- return parseQuery(query, func(query string) matcherFunc {
+- return fuzzy.NewSymbolMatcher(query).Match
+- })
+- case SymbolCaseSensitive:
+- return matchExact(query)
+- case SymbolCaseInsensitive:
+- q := strings.ToLower(query)
+- exact := matchExact(q)
+- wrapper := []string{""}
+- return func(chunks []string) (int, float64) {
+- s := strings.Join(chunks, "")
+- wrapper[0] = strings.ToLower(s)
+- return exact(wrapper)
+- }
+- }
+- panic(fmt.Errorf("unknown symbol matcher: %v", matcher))
+-}
+-
+-func newFuzzyMatcher(query string) matcherFunc {
+- fm := fuzzy.NewMatcher(query)
+- return func(chunks []string) (int, float64) {
+- score := float64(fm.ScoreChunks(chunks))
+- ranges := fm.MatchedRanges()
+- if len(ranges) > 0 {
+- return ranges[0], score
+- }
+- return -1, score
+- }
+-}
+-
+-// parseQuery parses a field-separated symbol query, extracting the special
+-// characters listed below, and returns a matcherFunc corresponding to the AND
+-// of all field queries.
+-//
+-// Special characters:
+-//
+-// ^ match exact prefix
+-// $ match exact suffix
+-// ' match exact
+-//
+-// In all three of these special queries, matches are 'smart-cased', meaning
+-// they are case sensitive if the symbol query contains any upper-case
+-// characters, and case insensitive otherwise.
+-func parseQuery(q string, newMatcher func(string) matcherFunc) matcherFunc {
+- fields := strings.Fields(q)
+- if len(fields) == 0 {
+- return func([]string) (int, float64) { return -1, 0 }
+- }
+- var funcs []matcherFunc
+- for _, field := range fields {
+- var f matcherFunc
+- switch {
+- case strings.HasPrefix(field, "^"):
+- prefix := field[1:]
+- f = smartCase(prefix, func(chunks []string) (int, float64) {
+- s := strings.Join(chunks, "")
+- if strings.HasPrefix(s, prefix) {
+- return 0, 1
+- }
+- return -1, 0
+- })
+- case strings.HasPrefix(field, "'"):
+- exact := field[1:]
+- f = smartCase(exact, matchExact(exact))
+- case strings.HasSuffix(field, "$"):
+- suffix := field[0 : len(field)-1]
+- f = smartCase(suffix, func(chunks []string) (int, float64) {
+- s := strings.Join(chunks, "")
+- if strings.HasSuffix(s, suffix) {
+- return len(s) - len(suffix), 1
+- }
+- return -1, 0
+- })
+- default:
+- f = newMatcher(field)
+- }
+- funcs = append(funcs, f)
+- }
+- if len(funcs) == 1 {
+- return funcs[0]
+- }
+- return comboMatcher(funcs).match
+-}
+-
+-func matchExact(exact string) matcherFunc {
+- return func(chunks []string) (int, float64) {
+- s := strings.Join(chunks, "")
+- if idx := strings.LastIndex(s, exact); idx >= 0 {
+- return idx, 1
+- }
+- return -1, 0
+- }
+-}
+-
+-// smartCase returns a matcherFunc that is case-sensitive if q contains any
+-// upper-case characters, and case-insensitive otherwise.
+-func smartCase(q string, m matcherFunc) matcherFunc {
+- insensitive := strings.ToLower(q) == q
+- wrapper := []string{""}
+- return func(chunks []string) (int, float64) {
+- s := strings.Join(chunks, "")
+- if insensitive {
+- s = strings.ToLower(s)
+- }
+- wrapper[0] = s
+- return m(wrapper)
+- }
+-}
+-
+-type comboMatcher []matcherFunc
+-
+-func (c comboMatcher) match(chunks []string) (int, float64) {
+- score := 1.0
+- first := 0
+- for _, f := range c {
+- idx, s := f(chunks)
+- if idx < first {
+- first = idx
+- }
+- score *= s
+- }
+- return first, score
+-}
+-
+-// collectSymbols calls snapshot.Symbols to walk the syntax trees of
+-// all files in the views' current snapshots, and returns a sorted,
+-// scored list of symbols that best match the parameters.
+-//
+-// How it matches symbols is parameterized by two interfaces:
+-// - A matcherFunc determines how well a string symbol matches a query. It
+-// returns a non-negative score indicating the quality of the match. A score
+-// of zero indicates no match.
+-// - A symbolizer determines how we extract the symbol for an object. This
+-// enables the 'symbolStyle' configuration option.
+-func collectSymbols(ctx context.Context, views []View, matcherType SymbolMatcher, symbolizer symbolizer, query string) ([]protocol.SymbolInformation, error) {
+- // Extract symbols from all files.
+- var work []symbolFile
+- var roots []string
+- seen := make(map[span.URI]bool)
+- // TODO(adonovan): opt: parallelize this loop? How often is len > 1?
+- for _, v := range views {
+- snapshot, release, err := v.Snapshot()
+- if err != nil {
+- continue // view is shut down; continue with others
+- }
+- defer release()
+-
+- // Use the root view URIs for determining (lexically)
+- // whether a URI is in any open workspace.
+- roots = append(roots, strings.TrimRight(string(v.Folder()), "/"))
+-
+- filters := v.Options().DirectoryFilters
+- filterer := NewFilterer(filters)
+- folder := filepath.ToSlash(v.Folder().Filename())
+- symbols, err := snapshot.Symbols(ctx)
+- if err != nil {
+- return nil, err
+- }
+- for uri, syms := range symbols {
+- norm := filepath.ToSlash(uri.Filename())
+- nm := strings.TrimPrefix(norm, folder)
+- if filterer.Disallow(nm) {
+- continue
+- }
+- // Only scan each file once.
+- if seen[uri] {
+- continue
+- }
+- mds, err := snapshot.MetadataForFile(ctx, uri)
+- if err != nil {
+- event.Error(ctx, fmt.Sprintf("missing metadata for %q", uri), err)
+- continue
+- }
+- if len(mds) == 0 {
+- // TODO: should use the bug reporting API
+- continue
+- }
+- seen[uri] = true
+- work = append(work, symbolFile{uri, mds[0], syms})
+- }
+- }
+-
+- // Match symbols in parallel.
+- // Each worker has its own symbolStore,
+- // which we merge at the end.
+- nmatchers := runtime.GOMAXPROCS(-1) // matching is CPU bound
+- results := make(chan *symbolStore)
+- for i := 0; i < nmatchers; i++ {
+- go func(i int) {
+- matcher := buildMatcher(matcherType, query)
+- store := new(symbolStore)
+- // Assign files to workers in round-robin fashion.
+- for j := i; j < len(work); j += nmatchers {
+- matchFile(store, symbolizer, matcher, roots, work[j])
+- }
+- results <- store
+- }(i)
+- }
+-
+- // Gather and merge results as they arrive.
+- var unified symbolStore
+- for i := 0; i < nmatchers; i++ {
+- store := <-results
+- for _, syms := range store.res {
+- unified.store(syms)
+- }
+- }
+- return unified.results(), nil
+-}
+-
+-type Filterer struct {
+- // Whether a filter is excluded depends on the operator (first char of the raw filter).
+- // Slices filters and excluded then should have the same length.
+- filters []*regexp.Regexp
+- excluded []bool
+-}
+-
+-// NewFilterer computes regular expression form of all raw filters
+-func NewFilterer(rawFilters []string) *Filterer {
+- var f Filterer
+- for _, filter := range rawFilters {
+- filter = path.Clean(filepath.ToSlash(filter))
+- // TODO(dungtuanle): fix: validate [+-] prefix.
+- op, prefix := filter[0], filter[1:]
+- // convertFilterToRegexp adds "/" at the end of prefix to handle cases where a filter is a prefix of another filter.
+- // For example, it prevents [+foobar, -foo] from excluding "foobar".
+- f.filters = append(f.filters, convertFilterToRegexp(filepath.ToSlash(prefix)))
+- f.excluded = append(f.excluded, op == '-')
+- }
+-
+- return &f
+-}
+-
+-// Disallow return true if the path is excluded from the filterer's filters.
+-func (f *Filterer) Disallow(path string) bool {
+- // Ensure trailing but not leading slash.
+- path = strings.TrimPrefix(path, "/")
+- if !strings.HasSuffix(path, "/") {
+- path += "/"
+- }
+-
+- // TODO(adonovan): opt: iterate in reverse and break at first match.
+- excluded := false
+- for i, filter := range f.filters {
+- if filter.MatchString(path) {
+- excluded = f.excluded[i] // last match wins
+- }
+- }
+- return excluded
+-}
+-
+-// convertFilterToRegexp replaces glob-like operator substrings in a string file path to their equivalent regex forms.
+-// Supporting glob-like operators:
+-// - **: match zero or more complete path segments
+-func convertFilterToRegexp(filter string) *regexp.Regexp {
+- if filter == "" {
+- return regexp.MustCompile(".*")
+- }
+- var ret strings.Builder
+- ret.WriteString("^")
+- segs := strings.Split(filter, "/")
+- for _, seg := range segs {
+- // Inv: seg != "" since path is clean.
+- if seg == "**" {
+- ret.WriteString(".*")
+- } else {
+- ret.WriteString(regexp.QuoteMeta(seg))
+- }
+- ret.WriteString("/")
+- }
+- pattern := ret.String()
+-
+- // Remove unnecessary "^.*" prefix, which increased
+- // BenchmarkWorkspaceSymbols time by ~20% (even though
+- // filter CPU time increased by only by ~2.5%) when the
+- // default filter was changed to "**/node_modules".
+- pattern = strings.TrimPrefix(pattern, "^.*")
+-
+- return regexp.MustCompile(pattern)
+-}
+-
+-// symbolFile holds symbol information for a single file.
+-type symbolFile struct {
+- uri span.URI
+- md *Metadata
+- syms []Symbol
+-}
+-
+-// matchFile scans a symbol file and adds matching symbols to the store.
+-func matchFile(store *symbolStore, symbolizer symbolizer, matcher matcherFunc, roots []string, i symbolFile) {
+- space := make([]string, 0, 3)
+- for _, sym := range i.syms {
+- symbolParts, score := symbolizer(space, sym.Name, i.md, matcher)
+-
+- // Check if the score is too low before applying any downranking.
+- if store.tooLow(score) {
+- continue
+- }
+-
+- // Factors to apply to the match score for the purpose of downranking
+- // results.
+- //
+- // These numbers were crudely calibrated based on trial-and-error using a
+- // small number of sample queries. Adjust as necessary.
+- //
+- // All factors are multiplicative, meaning if more than one applies they are
+- // multiplied together.
+- const (
+- // nonWorkspaceFactor is applied to symbols outside of any active
+- // workspace. Developers are less likely to want to jump to code that they
+- // are not actively working on.
+- nonWorkspaceFactor = 0.5
+- // nonWorkspaceUnexportedFactor is applied to unexported symbols outside of
+- // any active workspace. Since one wouldn't usually jump to unexported
+- // symbols to understand a package API, they are particularly irrelevant.
+- nonWorkspaceUnexportedFactor = 0.5
+- // every field or method nesting level to access the field decreases
+- // the score by a factor of 1.0 - depth*depthFactor, up to a depth of
+- // 3.
+- depthFactor = 0.2
+- )
+-
+- startWord := true
+- exported := true
+- depth := 0.0
+- for _, r := range sym.Name {
+- if startWord && !unicode.IsUpper(r) {
+- exported = false
+- }
+- if r == '.' {
+- startWord = true
+- depth++
+- } else {
+- startWord = false
+- }
+- }
+-
+- inWorkspace := false
+- for _, root := range roots {
+- if strings.HasPrefix(string(i.uri), root) {
+- inWorkspace = true
+- break
+- }
+- }
+-
+- // Apply downranking based on workspace position.
+- if !inWorkspace {
+- score *= nonWorkspaceFactor
+- if !exported {
+- score *= nonWorkspaceUnexportedFactor
+- }
+- }
+-
+- // Apply downranking based on symbol depth.
+- if depth > 3 {
+- depth = 3
+- }
+- score *= 1.0 - depth*depthFactor
+-
+- if store.tooLow(score) {
+- continue
+- }
+-
+- si := symbolInformation{
+- score: score,
+- symbol: strings.Join(symbolParts, ""),
+- kind: sym.Kind,
+- uri: i.uri,
+- rng: sym.Range,
+- container: string(i.md.PkgPath),
+- }
+- store.store(si)
+- }
+-}
+-
+-type symbolStore struct {
+- res [maxSymbols]symbolInformation
+-}
+-
+-// store inserts si into the sorted results, if si has a high enough score.
+-func (sc *symbolStore) store(si symbolInformation) {
+- if sc.tooLow(si.score) {
+- return
+- }
+- insertAt := sort.Search(len(sc.res), func(i int) bool {
+- // Sort by score, then symbol length, and finally lexically.
+- if sc.res[i].score != si.score {
+- return sc.res[i].score < si.score
+- }
+- if len(sc.res[i].symbol) != len(si.symbol) {
+- return len(sc.res[i].symbol) > len(si.symbol)
+- }
+- return sc.res[i].symbol > si.symbol
+- })
+- if insertAt < len(sc.res)-1 {
+- copy(sc.res[insertAt+1:], sc.res[insertAt:len(sc.res)-1])
+- }
+- sc.res[insertAt] = si
+-}
+-
+-func (sc *symbolStore) tooLow(score float64) bool {
+- return score <= sc.res[len(sc.res)-1].score
+-}
+-
+-func (sc *symbolStore) results() []protocol.SymbolInformation {
+- var res []protocol.SymbolInformation
+- for _, si := range sc.res {
+- if si.score <= 0 {
+- return res
+- }
+- res = append(res, si.asProtocolSymbolInformation())
+- }
+- return res
+-}
+-
+-func typeToKind(typ types.Type) protocol.SymbolKind {
+- switch typ := typ.Underlying().(type) {
+- case *types.Interface:
+- return protocol.Interface
+- case *types.Struct:
+- return protocol.Struct
+- case *types.Signature:
+- if typ.Recv() != nil {
+- return protocol.Method
+- }
+- return protocol.Function
+- case *types.Named:
+- return typeToKind(typ.Underlying())
+- case *types.Basic:
+- i := typ.Info()
+- switch {
+- case i&types.IsNumeric != 0:
+- return protocol.Number
+- case i&types.IsBoolean != 0:
+- return protocol.Boolean
+- case i&types.IsString != 0:
+- return protocol.String
+- }
+- }
+- return protocol.Variable
+-}
+-
+-// symbolInformation is a cut-down version of protocol.SymbolInformation that
+-// allows struct values of this type to be used as map keys.
+-type symbolInformation struct {
+- score float64
+- symbol string
+- container string
+- kind protocol.SymbolKind
+- uri span.URI
+- rng protocol.Range
+-}
+-
+-// asProtocolSymbolInformation converts s to a protocol.SymbolInformation value.
+-//
+-// TODO: work out how to handle tags if/when they are needed.
+-func (s symbolInformation) asProtocolSymbolInformation() protocol.SymbolInformation {
+- return protocol.SymbolInformation{
+- Name: s.symbol,
+- Kind: s.kind,
+- Location: protocol.Location{
+- URI: protocol.URIFromSpanURI(s.uri),
+- Range: s.rng,
+- },
+- ContainerName: s.container,
+- }
+-}
+diff -urN a/gopls/internal/lsp/source/workspace_symbol_test.go b/gopls/internal/lsp/source/workspace_symbol_test.go
+--- a/gopls/internal/lsp/source/workspace_symbol_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/workspace_symbol_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,136 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package source
+-
+-import (
+- "testing"
+-)
+-
+-func TestParseQuery(t *testing.T) {
+- tests := []struct {
+- query, s string
+- wantMatch bool
+- }{
+- {"", "anything", false},
+- {"any", "anything", true},
+- {"any$", "anything", false},
+- {"ing$", "anything", true},
+- {"ing$", "anythinG", true},
+- {"inG$", "anything", false},
+- {"^any", "anything", true},
+- {"^any", "Anything", true},
+- {"^Any", "anything", false},
+- {"at", "anything", true},
+- // TODO: this appears to be a bug in the fuzzy matching algorithm. 'At'
+- // should cause a case-sensitive match.
+- // {"At", "anything", false},
+- {"At", "Anything", true},
+- {"'yth", "Anything", true},
+- {"'yti", "Anything", false},
+- {"'any 'thing", "Anything", true},
+- {"anythn nythg", "Anything", true},
+- {"ntx", "Anything", false},
+- {"anythn", "anything", true},
+- {"ing", "anything", true},
+- {"anythn nythgx", "anything", false},
+- }
+-
+- for _, test := range tests {
+- matcher := parseQuery(test.query, newFuzzyMatcher)
+- if _, score := matcher([]string{test.s}); score > 0 != test.wantMatch {
+- t.Errorf("parseQuery(%q) match for %q: %.2g, want match: %t", test.query, test.s, score, test.wantMatch)
+- }
+- }
+-}
+-
+-func TestFiltererDisallow(t *testing.T) {
+- tests := []struct {
+- filters []string
+- included []string
+- excluded []string
+- }{
+- {
+- []string{"+**/c.go"},
+- []string{"a/c.go", "a/b/c.go"},
+- []string{},
+- },
+- {
+- []string{"+a/**/c.go"},
+- []string{"a/b/c.go", "a/b/d/c.go", "a/c.go"},
+- []string{},
+- },
+- {
+- []string{"-a/c.go", "+a/**"},
+- []string{"a/c.go"},
+- []string{},
+- },
+- {
+- []string{"+a/**/c.go", "-**/c.go"},
+- []string{},
+- []string{"a/b/c.go"},
+- },
+- {
+- []string{"+a/**/c.go", "-a/**"},
+- []string{},
+- []string{"a/b/c.go"},
+- },
+- {
+- []string{"+**/c.go", "-a/**/c.go"},
+- []string{},
+- []string{"a/b/c.go"},
+- },
+- {
+- []string{"+foobar", "-foo"},
+- []string{"foobar", "foobar/a"},
+- []string{"foo", "foo/a"},
+- },
+- {
+- []string{"+", "-"},
+- []string{},
+- []string{"foobar", "foobar/a", "foo", "foo/a"},
+- },
+- {
+- []string{"-", "+"},
+- []string{"foobar", "foobar/a", "foo", "foo/a"},
+- []string{},
+- },
+- {
+- []string{"-a/**/b/**/c.go"},
+- []string{},
+- []string{"a/x/y/z/b/f/g/h/c.go"},
+- },
+- // tests for unsupported glob operators
+- {
+- []string{"+**/c.go", "-a/*/c.go"},
+- []string{"a/b/c.go"},
+- []string{},
+- },
+- {
+- []string{"+**/c.go", "-a/?/c.go"},
+- []string{"a/b/c.go"},
+- []string{},
+- },
+- {
+- []string{"-b"}, // should only filter paths prefixed with the "b" directory
+- []string{"a/b/c.go", "bb"},
+- []string{"b/c/d.go", "b"},
+- },
+- }
+-
+- for _, test := range tests {
+- filterer := NewFilterer(test.filters)
+- for _, inc := range test.included {
+- if filterer.Disallow(inc) {
+- t.Errorf("Filters %v excluded %v, wanted included", test.filters, inc)
+- }
+- }
+-
+- for _, exc := range test.excluded {
+- if !filterer.Disallow(exc) {
+- t.Errorf("Filters %v included %v, wanted excluded", test.filters, exc)
+- }
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/source/xrefs/xrefs.go b/gopls/internal/lsp/source/xrefs/xrefs.go
+--- a/gopls/internal/lsp/source/xrefs/xrefs.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/source/xrefs/xrefs.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,216 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package xrefs defines the serializable index of cross-package
+-// references that is computed during type checking.
+-//
+-// See ../references2.go for the 'references' query.
+-package xrefs
+-
+-import (
+- "bytes"
+- "encoding/gob"
+- "go/ast"
+- "go/types"
+- "log"
+- "sort"
+-
+- "golang.org/x/tools/go/types/objectpath"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/typesinternal"
+-)
+-
+-// Index constructs a serializable index of outbound cross-references
+-// for the specified type-checked package.
+-func Index(files []*source.ParsedGoFile, pkg *types.Package, info *types.Info) []byte {
+- // pkgObjects maps each referenced package Q to a mapping:
+- // from each referenced symbol in Q to the ordered list
+- // of references to that symbol from this package.
+- // A nil types.Object indicates a reference
+- // to the package as a whole: an import.
+- pkgObjects := make(map[*types.Package]map[types.Object]*gobObject)
+-
+- // getObjects returns the object-to-references mapping for a package.
+- getObjects := func(pkg *types.Package) map[types.Object]*gobObject {
+- objects, ok := pkgObjects[pkg]
+- if !ok {
+- objects = make(map[types.Object]*gobObject)
+- pkgObjects[pkg] = objects
+- }
+- return objects
+- }
+-
+- objectpathFor := typesinternal.NewObjectpathFunc()
+-
+- for fileIndex, pgf := range files {
+-
+- nodeRange := func(n ast.Node) protocol.Range {
+- rng, err := pgf.PosRange(n.Pos(), n.End())
+- if err != nil {
+- panic(err) // can't fail
+- }
+- return rng
+- }
+-
+- ast.Inspect(pgf.File, func(n ast.Node) bool {
+- switch n := n.(type) {
+- case *ast.Ident:
+- // Report a reference for each identifier that
+- // uses a symbol exported from another package.
+- // (The built-in error.Error method has no package.)
+- if n.IsExported() {
+- if obj, ok := info.Uses[n]; ok &&
+- obj.Pkg() != nil &&
+- obj.Pkg() != pkg {
+-
+- objects := getObjects(obj.Pkg())
+- gobObj, ok := objects[obj]
+- if !ok {
+- path, err := objectpathFor(obj)
+- if err != nil {
+- // Capitalized but not exported
+- // (e.g. local const/var/type).
+- return true
+- }
+- gobObj = &gobObject{Path: path}
+- objects[obj] = gobObj
+- }
+-
+- gobObj.Refs = append(gobObj.Refs, gobRef{
+- FileIndex: fileIndex,
+- Range: nodeRange(n),
+- })
+- }
+- }
+-
+- case *ast.ImportSpec:
+- // Report a reference from each import path
+- // string to the imported package.
+- var obj types.Object
+- if n.Name != nil {
+- obj = info.Defs[n.Name]
+- } else {
+- obj = info.Implicits[n]
+- }
+- if obj == nil {
+- return true // missing import
+- }
+- objects := getObjects(obj.(*types.PkgName).Imported())
+- gobObj, ok := objects[nil]
+- if !ok {
+- gobObj = &gobObject{Path: ""}
+- objects[nil] = gobObj
+- }
+- gobObj.Refs = append(gobObj.Refs, gobRef{
+- FileIndex: fileIndex,
+- Range: nodeRange(n.Path),
+- })
+- }
+- return true
+- })
+- }
+-
+- // Flatten the maps into slices, and sort for determinism.
+- var packages []*gobPackage
+- for p := range pkgObjects {
+- objects := pkgObjects[p]
+- gp := &gobPackage{
+- PkgPath: source.PackagePath(p.Path()),
+- Objects: make([]*gobObject, 0, len(objects)),
+- }
+- for _, gobObj := range objects {
+- gp.Objects = append(gp.Objects, gobObj)
+- }
+- sort.Slice(gp.Objects, func(i, j int) bool {
+- return gp.Objects[i].Path < gp.Objects[j].Path
+- })
+- packages = append(packages, gp)
+- }
+- sort.Slice(packages, func(i, j int) bool {
+- return packages[i].PkgPath < packages[j].PkgPath
+- })
+-
+- return mustEncode(packages)
+-}
+-
+-// Lookup searches a serialized index produced by an indexPackage
+-// operation on m, and returns the locations of all references from m
+-// to any object in the target set. Each object is denoted by a pair
+-// of (package path, object path).
+-func Lookup(m *source.Metadata, data []byte, targets map[source.PackagePath]map[objectpath.Path]struct{}) (locs []protocol.Location) {
+-
+- // TODO(adonovan): opt: evaluate whether it would be faster to decode
+- // in two passes, first with struct { PkgPath string; Objects BLOB }
+- // to find the relevant record without decoding the Objects slice,
+- // then decode just the desired BLOB into a slice. BLOB would be a
+- // type whose Unmarshal method just retains (a copy of) the bytes.
+- var packages []gobPackage
+- mustDecode(data, &packages)
+-
+- for _, gp := range packages {
+- if objectSet, ok := targets[gp.PkgPath]; ok {
+- for _, gobObj := range gp.Objects {
+- if _, ok := objectSet[gobObj.Path]; ok {
+- for _, ref := range gobObj.Refs {
+- uri := m.CompiledGoFiles[ref.FileIndex]
+- locs = append(locs, protocol.Location{
+- URI: protocol.URIFromSpanURI(uri),
+- Range: ref.Range,
+- })
+- }
+- }
+- }
+- }
+- }
+-
+- return locs
+-}
+-
+-// -- serialized representation --
+-
+-// The cross-reference index records the location of all references
+-// from one package to symbols defined in other packages
+-// (dependencies). It does not record within-package references.
+-// The index for package P consists of a list of gopPackage records,
+-// each enumerating references to symbols defined a single dependency, Q.
+-
+-// TODO(adonovan): opt: choose a more compact encoding. Gzip reduces
+-// the gob output to about one third its size, so clearly there's room
+-// to improve. The gobRef.Range field is the obvious place to begin.
+-// Even a zero-length slice gob-encodes to ~285 bytes.
+-
+-// A gobPackage records the set of outgoing references from the index
+-// package to symbols defined in a dependency package.
+-type gobPackage struct {
+- PkgPath source.PackagePath // defining package (Q)
+- Objects []*gobObject // set of Q objects referenced by P
+-}
+-
+-// A gobObject records all references to a particular symbol.
+-type gobObject struct {
+- Path objectpath.Path // symbol name within package; "" => import of package itself
+- Refs []gobRef // locations of references within P, in lexical order
+-}
+-
+-type gobRef struct {
+- FileIndex int // index of enclosing file within P's CompiledGoFiles
+- Range protocol.Range // source range of reference
+-}
+-
+-// -- duplicated from ../../cache/analysis.go --
+-
+-func mustEncode(x interface{}) []byte {
+- var buf bytes.Buffer
+- if err := gob.NewEncoder(&buf).Encode(x); err != nil {
+- log.Fatalf("internal error encoding %T: %v", x, err)
+- }
+- return buf.Bytes()
+-}
+-
+-func mustDecode(data []byte, ptr interface{}) {
+- if err := gob.NewDecoder(bytes.NewReader(data)).Decode(ptr); err != nil {
+- log.Fatalf("internal error decoding %T: %v", ptr, err)
+- }
+-}
+diff -urN a/gopls/internal/lsp/symbols.go b/gopls/internal/lsp/symbols.go
+--- a/gopls/internal/lsp/symbols.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/symbols.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,60 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/template"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/event/tag"
+-)
+-
+-func (s *Server) documentSymbol(ctx context.Context, params *protocol.DocumentSymbolParams) ([]interface{}, error) {
+- ctx, done := event.Start(ctx, "lsp.Server.documentSymbol")
+- defer done()
+-
+- snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.UnknownKind)
+- defer release()
+- if !ok {
+- return []interface{}{}, err
+- }
+- var docSymbols []protocol.DocumentSymbol
+- switch snapshot.View().FileKind(fh) {
+- case source.Tmpl:
+- docSymbols, err = template.DocumentSymbols(snapshot, fh)
+- case source.Go:
+- docSymbols, err = source.DocumentSymbols(ctx, snapshot, fh)
+- default:
+- return []interface{}{}, nil
+- }
+- if err != nil {
+- event.Error(ctx, "DocumentSymbols failed", err, tag.URI.Of(fh.URI()))
+- return []interface{}{}, nil
+- }
+- // Convert the symbols to an interface array.
+- // TODO: Remove this once the lsp deprecates SymbolInformation.
+- symbols := make([]interface{}, len(docSymbols))
+- for i, s := range docSymbols {
+- if snapshot.View().Options().HierarchicalDocumentSymbolSupport {
+- symbols[i] = s
+- continue
+- }
+- // If the client does not support hierarchical document symbols, then
+- // we need to be backwards compatible for now and return SymbolInformation.
+- symbols[i] = protocol.SymbolInformation{
+- Name: s.Name,
+- Kind: s.Kind,
+- Deprecated: s.Deprecated,
+- Location: protocol.Location{
+- URI: params.TextDocument.URI,
+- Range: s.Range,
+- },
+- }
+- }
+- return symbols, nil
+-}
+diff -urN a/gopls/internal/lsp/template/completion.go b/gopls/internal/lsp/template/completion.go
+--- a/gopls/internal/lsp/template/completion.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/template/completion.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,287 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package template
+-
+-import (
+- "bytes"
+- "context"
+- "fmt"
+- "go/scanner"
+- "go/token"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-// information needed for completion
+-type completer struct {
+- p *Parsed
+- pos protocol.Position
+- offset int // offset of the start of the Token
+- ctx protocol.CompletionContext
+- syms map[string]symbol
+-}
+-
+-func Completion(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle, pos protocol.Position, context protocol.CompletionContext) (*protocol.CompletionList, error) {
+- all := New(snapshot.Templates())
+- var start int // the beginning of the Token (completed or not)
+- syms := make(map[string]symbol)
+- var p *Parsed
+- for fn, fc := range all.files {
+- // collect symbols from all template files
+- filterSyms(syms, fc.symbols)
+- if fn.Filename() != fh.URI().Filename() {
+- continue
+- }
+- if start = inTemplate(fc, pos); start == -1 {
+- return nil, nil
+- }
+- p = fc
+- }
+- if p == nil {
+- // this cannot happen unless the search missed a template file
+- return nil, fmt.Errorf("%s not found", fh.FileIdentity().URI.Filename())
+- }
+- c := completer{
+- p: p,
+- pos: pos,
+- offset: start + len(Left),
+- ctx: context,
+- syms: syms,
+- }
+- return c.complete()
+-}
+-
+-func filterSyms(syms map[string]symbol, ns []symbol) {
+- for _, xsym := range ns {
+- switch xsym.kind {
+- case protocol.Method, protocol.Package, protocol.Boolean, protocol.Namespace,
+- protocol.Function:
+- syms[xsym.name] = xsym // we don't care which symbol we get
+- case protocol.Variable:
+- if xsym.name != "dot" {
+- syms[xsym.name] = xsym
+- }
+- case protocol.Constant:
+- if xsym.name == "nil" {
+- syms[xsym.name] = xsym
+- }
+- }
+- }
+-}
+-
+-// return the starting position of the enclosing token, or -1 if none
+-func inTemplate(fc *Parsed, pos protocol.Position) int {
+- // pos is the pos-th character. if the cursor is at the beginning
+- // of the file, pos is 0. That is, we've only seen characters before pos
+- // 1. pos might be in a Token, return tk.Start
+- // 2. pos might be after an elided but before a Token, return elided
+- // 3. return -1 for false
+- offset := fc.FromPosition(pos)
+- // this could be a binary search, as the tokens are ordered
+- for _, tk := range fc.tokens {
+- if tk.Start < offset && offset <= tk.End {
+- return tk.Start
+- }
+- }
+- for _, x := range fc.elided {
+- if x > offset {
+- // fc.elided is sorted
+- break
+- }
+- // If the interval [x,offset] does not contain Left or Right
+- // then provide completions. (do we need the test for Right?)
+- if !bytes.Contains(fc.buf[x:offset], []byte(Left)) && !bytes.Contains(fc.buf[x:offset], []byte(Right)) {
+- return x
+- }
+- }
+- return -1
+-}
+-
+-var (
+- keywords = []string{"if", "with", "else", "block", "range", "template", "end}}", "end"}
+- globals = []string{"and", "call", "html", "index", "slice", "js", "len", "not", "or",
+- "urlquery", "printf", "println", "print", "eq", "ne", "le", "lt", "ge", "gt"}
+-)
+-
+-// find the completions. start is the offset of either the Token enclosing pos, or where
+-// the incomplete token starts.
+-// The error return is always nil.
+-func (c *completer) complete() (*protocol.CompletionList, error) {
+- ans := &protocol.CompletionList{IsIncomplete: true, Items: []protocol.CompletionItem{}}
+- start := c.p.FromPosition(c.pos)
+- sofar := c.p.buf[c.offset:start]
+- if len(sofar) == 0 || sofar[len(sofar)-1] == ' ' || sofar[len(sofar)-1] == '\t' {
+- return ans, nil
+- }
+- // sofar could be parsed by either c.analyzer() or scan(). The latter is precise
+- // and slower, but fast enough
+- words := scan(sofar)
+- // 1. if pattern starts $, show variables
+- // 2. if pattern starts ., show methods (and . by itself?)
+- // 3. if len(words) == 1, show firstWords (but if it were a |, show functions and globals)
+- // 4. ...? (parenthetical expressions, arguments, ...) (packages, namespaces, nil?)
+- if len(words) == 0 {
+- return nil, nil // if this happens, why were we called?
+- }
+- pattern := string(words[len(words)-1])
+- if pattern[0] == '$' {
+- // should we also return a raw "$"?
+- for _, s := range c.syms {
+- if s.kind == protocol.Variable && weakMatch(s.name, pattern) > 0 {
+- ans.Items = append(ans.Items, protocol.CompletionItem{
+- Label: s.name,
+- Kind: protocol.VariableCompletion,
+- Detail: "Variable",
+- })
+- }
+- }
+- return ans, nil
+- }
+- if pattern[0] == '.' {
+- for _, s := range c.syms {
+- if s.kind == protocol.Method && weakMatch("."+s.name, pattern) > 0 {
+- ans.Items = append(ans.Items, protocol.CompletionItem{
+- Label: s.name,
+- Kind: protocol.MethodCompletion,
+- Detail: "Method/member",
+- })
+- }
+- }
+- return ans, nil
+- }
+- // could we get completion attempts in strings or numbers, and if so, do we care?
+- // globals
+- for _, kw := range globals {
+- if weakMatch(kw, string(pattern)) != 0 {
+- ans.Items = append(ans.Items, protocol.CompletionItem{
+- Label: kw,
+- Kind: protocol.KeywordCompletion,
+- Detail: "Function",
+- })
+- }
+- }
+- // and functions
+- for _, s := range c.syms {
+- if s.kind == protocol.Function && weakMatch(s.name, pattern) != 0 {
+- ans.Items = append(ans.Items, protocol.CompletionItem{
+- Label: s.name,
+- Kind: protocol.FunctionCompletion,
+- Detail: "Function",
+- })
+- }
+- }
+- // keywords if we're at the beginning
+- if len(words) <= 1 || len(words[len(words)-2]) == 1 && words[len(words)-2][0] == '|' {
+- for _, kw := range keywords {
+- if weakMatch(kw, string(pattern)) != 0 {
+- ans.Items = append(ans.Items, protocol.CompletionItem{
+- Label: kw,
+- Kind: protocol.KeywordCompletion,
+- Detail: "keyword",
+- })
+- }
+- }
+- }
+- return ans, nil
+-}
+-
+-// someday think about comments, strings, backslashes, etc
+-// this would repeat some of the template parsing, but because the user is typing
+-// there may be no parse tree here.
+-// (go/scanner will report 2 tokens for $a, as $ is not a legal go identifier character)
+-// (go/scanner is about 2.7 times more expensive)
+-func (c *completer) analyze(buf []byte) [][]byte {
+- // we want to split on whitespace and before dots
+- var working []byte
+- var ans [][]byte
+- for _, ch := range buf {
+- if ch == '.' && len(working) > 0 {
+- ans = append(ans, working)
+- working = []byte{'.'}
+- continue
+- }
+- if ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' {
+- if len(working) > 0 {
+- ans = append(ans, working)
+- working = []byte{}
+- continue
+- }
+- }
+- working = append(working, ch)
+- }
+- if len(working) > 0 {
+- ans = append(ans, working)
+- }
+- ch := buf[len(buf)-1]
+- if ch == ' ' || ch == '\t' {
+- // avoid completing on whitespace
+- ans = append(ans, []byte{ch})
+- }
+- return ans
+-}
+-
+-// version of c.analyze that uses go/scanner.
+-func scan(buf []byte) []string {
+- fset := token.NewFileSet()
+- fp := fset.AddFile("", -1, len(buf))
+- var sc scanner.Scanner
+- sc.Init(fp, buf, func(pos token.Position, msg string) {}, scanner.ScanComments)
+- ans := make([]string, 0, 10) // preallocating gives a measurable savings
+- for {
+- _, tok, lit := sc.Scan() // tok is an int
+- if tok == token.EOF {
+- break // done
+- } else if tok == token.SEMICOLON && lit == "\n" {
+- continue // don't care, but probably can't happen
+- } else if tok == token.PERIOD {
+- ans = append(ans, ".") // lit is empty
+- } else if tok == token.IDENT && len(ans) > 0 && ans[len(ans)-1] == "." {
+- ans[len(ans)-1] = "." + lit
+- } else if tok == token.IDENT && len(ans) > 0 && ans[len(ans)-1] == "$" {
+- ans[len(ans)-1] = "$" + lit
+- } else if lit != "" {
+- ans = append(ans, lit)
+- }
+- }
+- return ans
+-}
+-
+-// pattern is what the user has typed
+-func weakMatch(choice, pattern string) float64 {
+- lower := strings.ToLower(choice)
+- // for now, use only lower-case everywhere
+- pattern = strings.ToLower(pattern)
+- // The first char has to match
+- if pattern[0] != lower[0] {
+- return 0
+- }
+- // If they start with ., then the second char has to match
+- from := 1
+- if pattern[0] == '.' {
+- if len(pattern) < 2 {
+- return 1 // pattern just a ., so it matches
+- }
+- if pattern[1] != lower[1] {
+- return 0
+- }
+- from = 2
+- }
+- // check that all the characters of pattern occur as a subsequence of choice
+- i, j := from, from
+- for ; i < len(lower) && j < len(pattern); j++ {
+- if pattern[j] == lower[i] {
+- i++
+- if i >= len(lower) {
+- return 0
+- }
+- }
+- }
+- if j < len(pattern) {
+- return 0
+- }
+- return 1
+-}
+diff -urN a/gopls/internal/lsp/template/completion_test.go b/gopls/internal/lsp/template/completion_test.go
+--- a/gopls/internal/lsp/template/completion_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/template/completion_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,102 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package template
+-
+-import (
+- "log"
+- "sort"
+- "strings"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-func init() {
+- log.SetFlags(log.Lshortfile)
+-}
+-
+-type tparse struct {
+- marked string // ^ shows where to ask for completions. (The user just typed the following character.)
+- wanted []string // expected completions
+-}
+-
+-// Test completions in templates that parse enough (if completion needs symbols)
+-// Seen characters up to the ^
+-func TestParsed(t *testing.T) {
+- var tests = []tparse{
+- {"{{x}}{{12. xx^", nil}, // https://github.com/golang/go/issues/50430
+- {`<table class="chroma" data-new-comment-url="{{if $.PageIsPullFiles}}{{$.Issue.HTMLURL}}/files/reviews/new_comment{{else}}{{$.CommitHTML}}/new_comment^{{end}}">`, nil},
+- {"{{i^f}}", []string{"index", "if"}},
+- {"{{if .}}{{e^ {{end}}", []string{"eq", "end}}", "else", "end"}},
+- {"{{foo}}{{f^", []string{"foo"}},
+- {"{{$^}}", []string{"$"}},
+- {"{{$x:=4}}{{$^", []string{"$x"}},
+- {"{{$x:=4}}{{$ ^ ", []string{}},
+- {"{{len .Modified}}{{.^Mo", []string{"Modified"}},
+- {"{{len .Modified}}{{.mf^", []string{"Modified"}},
+- {"{{$^ }}", []string{"$"}},
+- {"{{$a =3}}{{$^", []string{"$a"}},
+- // .two is not good here: fix someday
+- {`{{.Modified}}{{.^{{if $.one.two}}xxx{{end}}`, []string{"Modified", "one", "two"}},
+- {`{{.Modified}}{{.o^{{if $.one.two}}xxx{{end}}`, []string{"one"}},
+- {"{{.Modiifed}}{{.one.t^{{if $.one.two}}xxx{{end}}", []string{"two"}},
+- {`{{block "foo" .}}{{i^`, []string{"index", "if"}},
+- {"{{in^{{Internal}}", []string{"index", "Internal", "if"}},
+- // simple number has no completions
+- {"{{4^e", []string{}},
+- // simple string has no completions
+- {"{{`e^", []string{}},
+- {"{{`No i^", []string{}}, // example of why go/scanner is used
+- {"{{xavier}}{{12. x^", []string{"xavier"}},
+- }
+- for _, tx := range tests {
+- c := testCompleter(t, tx)
+- var v []string
+- if c != nil {
+- ans, _ := c.complete()
+- for _, a := range ans.Items {
+- v = append(v, a.Label)
+- }
+- }
+- if len(v) != len(tx.wanted) {
+- t.Errorf("%q: got %q, wanted %q %d,%d", tx.marked, v, tx.wanted, len(v), len(tx.wanted))
+- continue
+- }
+- sort.Strings(tx.wanted)
+- sort.Strings(v)
+- for i := 0; i < len(v); i++ {
+- if tx.wanted[i] != v[i] {
+- t.Errorf("%q at %d: got %v, wanted %v", tx.marked, i, v, tx.wanted)
+- break
+- }
+- }
+- }
+-}
+-
+-func testCompleter(t *testing.T, tx tparse) *completer {
+- t.Helper()
+- // seen chars up to ^
+- col := strings.Index(tx.marked, "^")
+- buf := strings.Replace(tx.marked, "^", "", 1)
+- p := parseBuffer([]byte(buf))
+- pos := protocol.Position{Line: 0, Character: uint32(col)}
+- if p.ParseErr != nil {
+- log.Printf("%q: %v", tx.marked, p.ParseErr)
+- }
+- offset := inTemplate(p, pos)
+- if offset == -1 {
+- return nil
+- }
+- syms := make(map[string]symbol)
+- filterSyms(syms, p.symbols)
+- c := &completer{
+- p: p,
+- pos: protocol.Position{Line: 0, Character: uint32(col)},
+- offset: offset + len(Left),
+- ctx: protocol.CompletionContext{TriggerKind: protocol.Invoked},
+- syms: syms,
+- }
+- return c
+-}
+diff -urN a/gopls/internal/lsp/template/highlight.go b/gopls/internal/lsp/template/highlight.go
+--- a/gopls/internal/lsp/template/highlight.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/template/highlight.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,96 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package template
+-
+-import (
+- "context"
+- "fmt"
+- "regexp"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-func Highlight(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle, loc protocol.Position) ([]protocol.DocumentHighlight, error) {
+- buf, err := fh.Read()
+- if err != nil {
+- return nil, err
+- }
+- p := parseBuffer(buf)
+- pos := p.FromPosition(loc)
+- var ans []protocol.DocumentHighlight
+- if p.ParseErr == nil {
+- for _, s := range p.symbols {
+- if s.start <= pos && pos < s.start+s.length {
+- return markSymbols(p, s)
+- }
+- }
+- }
+- // these tokens exist whether or not there was a parse error
+- // (symbols require a successful parse)
+- for _, tok := range p.tokens {
+- if tok.Start <= pos && pos < tok.End {
+- wordAt := findWordAt(p, pos)
+- if len(wordAt) > 0 {
+- return markWordInToken(p, wordAt)
+- }
+- }
+- }
+- // find the 'word' at pos, etc: someday
+- // until then we get the default action, which doesn't respect word boundaries
+- return ans, nil
+-}
+-
+-func markSymbols(p *Parsed, sym symbol) ([]protocol.DocumentHighlight, error) {
+- var ans []protocol.DocumentHighlight
+- for _, s := range p.symbols {
+- if s.name == sym.name {
+- kind := protocol.Read
+- if s.vardef {
+- kind = protocol.Write
+- }
+- ans = append(ans, protocol.DocumentHighlight{
+- Range: p.Range(s.start, s.length),
+- Kind: kind,
+- })
+- }
+- }
+- return ans, nil
+-}
+-
+-// A token is {{...}}, and this marks words in the token that equal the give word
+-func markWordInToken(p *Parsed, wordAt string) ([]protocol.DocumentHighlight, error) {
+- var ans []protocol.DocumentHighlight
+- pat, err := regexp.Compile(fmt.Sprintf(`\b%s\b`, wordAt))
+- if err != nil {
+- return nil, fmt.Errorf("%q: unmatchable word (%v)", wordAt, err)
+- }
+- for _, tok := range p.tokens {
+- got := pat.FindAllIndex(p.buf[tok.Start:tok.End], -1)
+- for i := 0; i < len(got); i++ {
+- ans = append(ans, protocol.DocumentHighlight{
+- Range: p.Range(got[i][0], got[i][1]-got[i][0]),
+- Kind: protocol.Text,
+- })
+- }
+- }
+- return ans, nil
+-}
+-
+-var wordRe = regexp.MustCompile(`[$]?\w+$`)
+-var moreRe = regexp.MustCompile(`^[$]?\w+`)
+-
+-// findWordAt finds the word the cursor is in (meaning in or just before)
+-func findWordAt(p *Parsed, pos int) string {
+- if pos >= len(p.buf) {
+- return "" // can't happen, as we are called with pos < tok.End
+- }
+- after := moreRe.Find(p.buf[pos:])
+- if len(after) == 0 {
+- return "" // end of the word
+- }
+- got := wordRe.Find(p.buf[:pos+len(after)])
+- return string(got)
+-}
+diff -urN a/gopls/internal/lsp/template/implementations.go b/gopls/internal/lsp/template/implementations.go
+--- a/gopls/internal/lsp/template/implementations.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/template/implementations.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,189 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package template
+-
+-import (
+- "context"
+- "fmt"
+- "regexp"
+- "strconv"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-// line number (1-based) and message
+-var errRe = regexp.MustCompile(`template.*:(\d+): (.*)`)
+-
+-// Diagnose returns parse errors. There is only one.
+-// The errors are not always helpful. For instance { {end}}
+-// will likely point to the end of the file.
+-func Diagnose(f source.FileHandle) []*source.Diagnostic {
+- // no need for skipTemplate check, as Diagnose is called on the
+- // snapshot's template files
+- buf, err := f.Read()
+- if err != nil {
+- // Is a Diagnostic with no Range useful? event.Error also?
+- msg := fmt.Sprintf("failed to read %s (%v)", f.URI().Filename(), err)
+- d := source.Diagnostic{Message: msg, Severity: protocol.SeverityError, URI: f.URI(),
+- Source: source.TemplateError}
+- return []*source.Diagnostic{&d}
+- }
+- p := parseBuffer(buf)
+- if p.ParseErr == nil {
+- return nil
+- }
+- unknownError := func(msg string) []*source.Diagnostic {
+- s := fmt.Sprintf("malformed template error %q: %s", p.ParseErr.Error(), msg)
+- d := source.Diagnostic{
+- Message: s, Severity: protocol.SeverityError, Range: p.Range(p.nls[0], 1),
+- URI: f.URI(), Source: source.TemplateError}
+- return []*source.Diagnostic{&d}
+- }
+- // errors look like `template: :40: unexpected "}" in operand`
+- // so the string needs to be parsed
+- matches := errRe.FindStringSubmatch(p.ParseErr.Error())
+- if len(matches) != 3 {
+- msg := fmt.Sprintf("expected 3 matches, got %d (%v)", len(matches), matches)
+- return unknownError(msg)
+- }
+- lineno, err := strconv.Atoi(matches[1])
+- if err != nil {
+- msg := fmt.Sprintf("couldn't convert %q to int, %v", matches[1], err)
+- return unknownError(msg)
+- }
+- msg := matches[2]
+- d := source.Diagnostic{Message: msg, Severity: protocol.SeverityError,
+- Source: source.TemplateError}
+- start := p.nls[lineno-1]
+- if lineno < len(p.nls) {
+- size := p.nls[lineno] - start
+- d.Range = p.Range(start, size)
+- } else {
+- d.Range = p.Range(start, 1)
+- }
+- return []*source.Diagnostic{&d}
+-}
+-
+-// Definition finds the definitions of the symbol at loc. It
+-// does not understand scoping (if any) in templates. This code is
+-// for definitions, type definitions, and implementations.
+-// Results only for variables and templates.
+-func Definition(snapshot source.Snapshot, fh source.FileHandle, loc protocol.Position) ([]protocol.Location, error) {
+- x, _, err := symAtPosition(fh, loc)
+- if err != nil {
+- return nil, err
+- }
+- sym := x.name
+- ans := []protocol.Location{}
+- // PJW: this is probably a pattern to abstract
+- a := New(snapshot.Templates())
+- for k, p := range a.files {
+- for _, s := range p.symbols {
+- if !s.vardef || s.name != sym {
+- continue
+- }
+- ans = append(ans, protocol.Location{URI: protocol.DocumentURI(k), Range: p.Range(s.start, s.length)})
+- }
+- }
+- return ans, nil
+-}
+-
+-func Hover(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle, position protocol.Position) (*protocol.Hover, error) {
+- sym, p, err := symAtPosition(fh, position)
+- if sym == nil || err != nil {
+- return nil, err
+- }
+- ans := protocol.Hover{Range: p.Range(sym.start, sym.length), Contents: protocol.MarkupContent{Kind: protocol.Markdown}}
+- switch sym.kind {
+- case protocol.Function:
+- ans.Contents.Value = fmt.Sprintf("function: %s", sym.name)
+- case protocol.Variable:
+- ans.Contents.Value = fmt.Sprintf("variable: %s", sym.name)
+- case protocol.Constant:
+- ans.Contents.Value = fmt.Sprintf("constant %s", sym.name)
+- case protocol.Method: // field or method
+- ans.Contents.Value = fmt.Sprintf("%s: field or method", sym.name)
+- case protocol.Package: // template use, template def (PJW: do we want two?)
+- ans.Contents.Value = fmt.Sprintf("template %s\n(add definition)", sym.name)
+- case protocol.Namespace:
+- ans.Contents.Value = fmt.Sprintf("template %s defined", sym.name)
+- case protocol.Number:
+- ans.Contents.Value = "number"
+- case protocol.String:
+- ans.Contents.Value = "string"
+- case protocol.Boolean:
+- ans.Contents.Value = "boolean"
+- default:
+- ans.Contents.Value = fmt.Sprintf("oops, sym=%#v", sym)
+- }
+- return &ans, nil
+-}
+-
+-func References(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle, params *protocol.ReferenceParams) ([]protocol.Location, error) {
+- sym, _, err := symAtPosition(fh, params.Position)
+- if sym == nil || err != nil || sym.name == "" {
+- return nil, err
+- }
+- ans := []protocol.Location{}
+-
+- a := New(snapshot.Templates())
+- for k, p := range a.files {
+- for _, s := range p.symbols {
+- if s.name != sym.name {
+- continue
+- }
+- if s.vardef && !params.Context.IncludeDeclaration {
+- continue
+- }
+- ans = append(ans, protocol.Location{URI: protocol.DocumentURI(k), Range: p.Range(s.start, s.length)})
+- }
+- }
+- // do these need to be sorted? (a.files is a map)
+- return ans, nil
+-}
+-
+-func SemanticTokens(ctx context.Context, snapshot source.Snapshot, spn span.URI, add func(line, start, len uint32), d func() []uint32) (*protocol.SemanticTokens, error) {
+- fh, err := snapshot.GetFile(ctx, spn)
+- if err != nil {
+- return nil, err
+- }
+- buf, err := fh.Read()
+- if err != nil {
+- return nil, err
+- }
+- p := parseBuffer(buf)
+-
+- for _, t := range p.Tokens() {
+- if t.Multiline {
+- la, ca := p.LineCol(t.Start)
+- lb, cb := p.LineCol(t.End)
+- add(la, ca, p.RuneCount(la, ca, 0))
+- for l := la + 1; l < lb; l++ {
+- add(l, 0, p.RuneCount(l, 0, 0))
+- }
+- add(lb, 0, p.RuneCount(lb, 0, cb))
+- continue
+- }
+- sz, err := p.TokenSize(t)
+- if err != nil {
+- return nil, err
+- }
+- line, col := p.LineCol(t.Start)
+- add(line, col, uint32(sz))
+- }
+- data := d()
+- ans := &protocol.SemanticTokens{
+- Data: data,
+- // for small cache, some day. for now, the LSP client ignores this
+- // (that is, when the LSP client starts returning these, we can cache)
+- ResultID: fmt.Sprintf("%v", time.Now()),
+- }
+- return ans, nil
+-}
+-
+-// still need to do rename, etc
+diff -urN a/gopls/internal/lsp/template/parse.go b/gopls/internal/lsp/template/parse.go
+--- a/gopls/internal/lsp/template/parse.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/template/parse.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,508 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package template contains code for dealing with templates
+-package template
+-
+-// template files are small enough that the code reprocesses them each time
+-// this may be a bad choice for projects with lots of template files.
+-
+-// This file contains the parsing code, some debugging printing, and
+-// implementations for Diagnose, Definition, Hover, References
+-
+-import (
+- "bytes"
+- "context"
+- "fmt"
+- "io"
+- "log"
+- "regexp"
+- "runtime"
+- "sort"
+- "text/template"
+- "text/template/parse"
+- "unicode/utf8"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-var (
+- Left = []byte("{{")
+- Right = []byte("}}")
+-)
+-
+-type Parsed struct {
+- buf []byte //contents
+- lines [][]byte // needed?, other than for debugging?
+- elided []int // offsets where Left was replaced by blanks
+-
+- // tokens are matched Left-Right pairs, computed before trying to parse
+- tokens []Token
+-
+- // result of parsing
+- named []*template.Template // the template and embedded templates
+- ParseErr error
+- symbols []symbol
+- stack []parse.Node // used while computing symbols
+-
+- // for mapping from offsets in buf to LSP coordinates
+- // See FromPosition() and LineCol()
+- nls []int // offset of newlines before each line (nls[0]==-1)
+- lastnl int // last line seen
+- check int // used to decide whether to use lastnl or search through nls
+- nonASCII bool // are there any non-ascii runes in buf?
+-}
+-
+-// Token is a single {{...}}. More precisely, Left...Right
+-type Token struct {
+- Start, End int // offset from start of template
+- Multiline bool
+-}
+-
+-// All contains the Parse of all the template files
+-type All struct {
+- files map[span.URI]*Parsed
+-}
+-
+-// New returns the Parses of the snapshot's tmpl files
+-// (maybe cache these, but then avoiding import cycles needs code rearrangements)
+-func New(tmpls map[span.URI]source.FileHandle) *All {
+- all := make(map[span.URI]*Parsed)
+- for k, v := range tmpls {
+- buf, err := v.Read()
+- if err != nil { // PJW: decide what to do with these errors
+- log.Printf("failed to read %s (%v)", v.URI().Filename(), err)
+- continue
+- }
+- all[k] = parseBuffer(buf)
+- }
+- return &All{files: all}
+-}
+-
+-func parseBuffer(buf []byte) *Parsed {
+- ans := &Parsed{
+- buf: buf,
+- check: -1,
+- nls: []int{-1},
+- }
+- if len(buf) == 0 {
+- return ans
+- }
+- // how to compute allAscii...
+- for _, b := range buf {
+- if b >= utf8.RuneSelf {
+- ans.nonASCII = true
+- break
+- }
+- }
+- if buf[len(buf)-1] != '\n' {
+- ans.buf = append(buf, '\n')
+- }
+- for i, p := range ans.buf {
+- if p == '\n' {
+- ans.nls = append(ans.nls, i)
+- }
+- }
+- ans.setTokens() // ans.buf may be a new []byte
+- ans.lines = bytes.Split(ans.buf, []byte{'\n'})
+- t, err := template.New("").Parse(string(ans.buf))
+- if err != nil {
+- funcs := make(template.FuncMap)
+- for t == nil && ans.ParseErr == nil {
+- // in 1.17 it may be possible to avoid getting this error
+- // template: :2: function "foo" not defined
+- matches := parseErrR.FindStringSubmatch(err.Error())
+- if len(matches) == 2 {
+- // suppress the error by giving it a function with the right name
+- funcs[matches[1]] = func() interface{} { return nil }
+- t, err = template.New("").Funcs(funcs).Parse(string(ans.buf))
+- continue
+- }
+- ans.ParseErr = err // unfixed error
+- return ans
+- }
+- }
+- ans.named = t.Templates()
+- // set the symbols
+- for _, t := range ans.named {
+- ans.stack = append(ans.stack, t.Root)
+- ans.findSymbols()
+- if t.Name() != "" {
+- // defining a template. The pos is just after {{define...}} (or {{block...}}?)
+- at, sz := ans.FindLiteralBefore(int(t.Root.Pos))
+- s := symbol{start: at, length: sz, name: t.Name(), kind: protocol.Namespace, vardef: true}
+- ans.symbols = append(ans.symbols, s)
+- }
+- }
+-
+- sort.Slice(ans.symbols, func(i, j int) bool {
+- left, right := ans.symbols[i], ans.symbols[j]
+- if left.start != right.start {
+- return left.start < right.start
+- }
+- if left.vardef != right.vardef {
+- return left.vardef
+- }
+- return left.kind < right.kind
+- })
+- return ans
+-}
+-
+-// FindLiteralBefore locates the first preceding string literal
+-// returning its position and length in buf
+-// or returns -1 if there is none.
+-// Assume double-quoted string rather than backquoted string for now.
+-func (p *Parsed) FindLiteralBefore(pos int) (int, int) {
+- left, right := -1, -1
+- for i := pos - 1; i >= 0; i-- {
+- if p.buf[i] != '"' {
+- continue
+- }
+- if right == -1 {
+- right = i
+- continue
+- }
+- left = i
+- break
+- }
+- if left == -1 {
+- return -1, 0
+- }
+- return left + 1, right - left - 1
+-}
+-
+-var (
+- parseErrR = regexp.MustCompile(`template:.*function "([^"]+)" not defined`)
+-)
+-
+-func (p *Parsed) setTokens() {
+- const (
+- // InRaw and InString only occur inside an action (SeenLeft)
+- Start = iota
+- InRaw
+- InString
+- SeenLeft
+- )
+- state := Start
+- var left, oldState int
+- for n := 0; n < len(p.buf); n++ {
+- c := p.buf[n]
+- switch state {
+- case InRaw:
+- if c == '`' {
+- state = oldState
+- }
+- case InString:
+- if c == '"' && !isEscaped(p.buf[:n]) {
+- state = oldState
+- }
+- case SeenLeft:
+- if c == '`' {
+- oldState = state // it's SeenLeft, but a little clearer this way
+- state = InRaw
+- continue
+- }
+- if c == '"' {
+- oldState = state
+- state = InString
+- continue
+- }
+- if bytes.HasPrefix(p.buf[n:], Right) {
+- right := n + len(Right)
+- tok := Token{Start: left,
+- End: right,
+- Multiline: bytes.Contains(p.buf[left:right], []byte{'\n'}),
+- }
+- p.tokens = append(p.tokens, tok)
+- state = Start
+- }
+- // If we see (unquoted) Left then the original left is probably the user
+- // typing. Suppress the original left
+- if bytes.HasPrefix(p.buf[n:], Left) {
+- p.elideAt(left)
+- left = n
+- n += len(Left) - 1 // skip the rest
+- }
+- case Start:
+- if bytes.HasPrefix(p.buf[n:], Left) {
+- left = n
+- state = SeenLeft
+- n += len(Left) - 1 // skip the rest (avoids {{{ bug)
+- }
+- }
+- }
+- // this error occurs after typing {{ at the end of the file
+- if state != Start {
+- // Unclosed Left. remove the Left at left
+- p.elideAt(left)
+- }
+-}
+-
+-func (p *Parsed) elideAt(left int) {
+- if p.elided == nil {
+- // p.buf is the same buffer that v.Read() returns, so copy it.
+- // (otherwise the next time it's parsed, elided information is lost)
+- b := make([]byte, len(p.buf))
+- copy(b, p.buf)
+- p.buf = b
+- }
+- for i := 0; i < len(Left); i++ {
+- p.buf[left+i] = ' '
+- }
+- p.elided = append(p.elided, left)
+-}
+-
+-// isEscaped reports whether the byte after buf is escaped
+-func isEscaped(buf []byte) bool {
+- backSlashes := 0
+- for j := len(buf) - 1; j >= 0 && buf[j] == '\\'; j-- {
+- backSlashes++
+- }
+- return backSlashes%2 == 1
+-}
+-
+-func (p *Parsed) Tokens() []Token {
+- return p.tokens
+-}
+-
+-// TODO(adonovan): the next 100 lines could perhaps replaced by use of protocol.Mapper.
+-
+-func (p *Parsed) utf16len(buf []byte) int {
+- cnt := 0
+- if !p.nonASCII {
+- return len(buf)
+- }
+- // we need a utf16len(rune), but we don't have it
+- for _, r := range string(buf) {
+- cnt++
+- if r >= 1<<16 {
+- cnt++
+- }
+- }
+- return cnt
+-}
+-
+-func (p *Parsed) TokenSize(t Token) (int, error) {
+- if t.Multiline {
+- return -1, fmt.Errorf("TokenSize called with Multiline token %#v", t)
+- }
+- ans := p.utf16len(p.buf[t.Start:t.End])
+- return ans, nil
+-}
+-
+-// RuneCount counts runes in line l, from col s to e
+-// (e==0 for end of line. called only for multiline tokens)
+-func (p *Parsed) RuneCount(l, s, e uint32) uint32 {
+- start := p.nls[l] + 1 + int(s)
+- end := p.nls[l] + 1 + int(e)
+- if e == 0 || end > p.nls[l+1] {
+- end = p.nls[l+1]
+- }
+- return uint32(utf8.RuneCount(p.buf[start:end]))
+-}
+-
+-// LineCol converts from a 0-based byte offset to 0-based line, col. col in runes
+-func (p *Parsed) LineCol(x int) (uint32, uint32) {
+- if x < p.check {
+- p.lastnl = 0
+- }
+- p.check = x
+- for i := p.lastnl; i < len(p.nls); i++ {
+- if p.nls[i] <= x {
+- continue
+- }
+- p.lastnl = i
+- var count int
+- if i > 0 && x == p.nls[i-1] { // \n
+- count = 0
+- } else {
+- count = p.utf16len(p.buf[p.nls[i-1]+1 : x])
+- }
+- return uint32(i - 1), uint32(count)
+- }
+- if x == len(p.buf)-1 { // trailing \n
+- return uint32(len(p.nls) - 1), 0
+- }
+- // shouldn't happen
+- for i := 1; i < 4; i++ {
+- _, f, l, ok := runtime.Caller(i)
+- if !ok {
+- break
+- }
+- log.Printf("%d: %s:%d", i, f, l)
+- }
+-
+- msg := fmt.Errorf("LineCol off the end, %d of %d, nls=%v, %q", x, len(p.buf), p.nls, p.buf[x:])
+- event.Error(context.Background(), "internal error", msg)
+- return 0, 0
+-}
+-
+-// Position produces a protocol.Position from an offset in the template
+-func (p *Parsed) Position(pos int) protocol.Position {
+- line, col := p.LineCol(pos)
+- return protocol.Position{Line: line, Character: col}
+-}
+-
+-func (p *Parsed) Range(x, length int) protocol.Range {
+- line, col := p.LineCol(x)
+- ans := protocol.Range{
+- Start: protocol.Position{Line: line, Character: col},
+- End: protocol.Position{Line: line, Character: col + uint32(length)},
+- }
+- return ans
+-}
+-
+-// FromPosition translates a protocol.Position into an offset into the template
+-func (p *Parsed) FromPosition(x protocol.Position) int {
+- l, c := int(x.Line), int(x.Character)
+- if l >= len(p.nls) || p.nls[l]+1 >= len(p.buf) {
+- // paranoia to avoid panic. return the largest offset
+- return len(p.buf)
+- }
+- line := p.buf[p.nls[l]+1:]
+- cnt := 0
+- for w := range string(line) {
+- if cnt >= c {
+- return w + p.nls[l] + 1
+- }
+- cnt++
+- }
+- // do we get here? NO
+- pos := int(x.Character) + p.nls[int(x.Line)] + 1
+- event.Error(context.Background(), "internal error", fmt.Errorf("surprise %#v", x))
+- return pos
+-}
+-
+-func symAtPosition(fh source.FileHandle, loc protocol.Position) (*symbol, *Parsed, error) {
+- buf, err := fh.Read()
+- if err != nil {
+- return nil, nil, err
+- }
+- p := parseBuffer(buf)
+- pos := p.FromPosition(loc)
+- syms := p.SymsAtPos(pos)
+- if len(syms) == 0 {
+- return nil, p, fmt.Errorf("no symbol found")
+- }
+- if len(syms) > 1 {
+- log.Printf("Hover: %d syms, not 1 %v", len(syms), syms)
+- }
+- sym := syms[0]
+- return &sym, p, nil
+-}
+-
+-func (p *Parsed) SymsAtPos(pos int) []symbol {
+- ans := []symbol{}
+- for _, s := range p.symbols {
+- if s.start <= pos && pos < s.start+s.length {
+- ans = append(ans, s)
+- }
+- }
+- return ans
+-}
+-
+-type wrNode struct {
+- p *Parsed
+- w io.Writer
+-}
+-
+-// WriteNode is for debugging
+-func (p *Parsed) WriteNode(w io.Writer, n parse.Node) {
+- wr := wrNode{p: p, w: w}
+- wr.writeNode(n, "")
+-}
+-
+-func (wr wrNode) writeNode(n parse.Node, indent string) {
+- if n == nil {
+- return
+- }
+- at := func(pos parse.Pos) string {
+- line, col := wr.p.LineCol(int(pos))
+- return fmt.Sprintf("(%d)%v:%v", pos, line, col)
+- }
+- switch x := n.(type) {
+- case *parse.ActionNode:
+- fmt.Fprintf(wr.w, "%sActionNode at %s\n", indent, at(x.Pos))
+- wr.writeNode(x.Pipe, indent+". ")
+- case *parse.BoolNode:
+- fmt.Fprintf(wr.w, "%sBoolNode at %s, %v\n", indent, at(x.Pos), x.True)
+- case *parse.BranchNode:
+- fmt.Fprintf(wr.w, "%sBranchNode at %s\n", indent, at(x.Pos))
+- wr.writeNode(x.Pipe, indent+"Pipe. ")
+- wr.writeNode(x.List, indent+"List. ")
+- wr.writeNode(x.ElseList, indent+"Else. ")
+- case *parse.ChainNode:
+- fmt.Fprintf(wr.w, "%sChainNode at %s, %v\n", indent, at(x.Pos), x.Field)
+- case *parse.CommandNode:
+- fmt.Fprintf(wr.w, "%sCommandNode at %s, %d children\n", indent, at(x.Pos), len(x.Args))
+- for _, a := range x.Args {
+- wr.writeNode(a, indent+". ")
+- }
+- //case *parse.CommentNode: // 1.16
+- case *parse.DotNode:
+- fmt.Fprintf(wr.w, "%sDotNode at %s\n", indent, at(x.Pos))
+- case *parse.FieldNode:
+- fmt.Fprintf(wr.w, "%sFieldNode at %s, %v\n", indent, at(x.Pos), x.Ident)
+- case *parse.IdentifierNode:
+- fmt.Fprintf(wr.w, "%sIdentifierNode at %s, %v\n", indent, at(x.Pos), x.Ident)
+- case *parse.IfNode:
+- fmt.Fprintf(wr.w, "%sIfNode at %s\n", indent, at(x.Pos))
+- wr.writeNode(&x.BranchNode, indent+". ")
+- case *parse.ListNode:
+- if x == nil {
+- return // nil BranchNode.ElseList
+- }
+- fmt.Fprintf(wr.w, "%sListNode at %s, %d children\n", indent, at(x.Pos), len(x.Nodes))
+- for _, n := range x.Nodes {
+- wr.writeNode(n, indent+". ")
+- }
+- case *parse.NilNode:
+- fmt.Fprintf(wr.w, "%sNilNode at %s\n", indent, at(x.Pos))
+- case *parse.NumberNode:
+- fmt.Fprintf(wr.w, "%sNumberNode at %s, %s\n", indent, at(x.Pos), x.Text)
+- case *parse.PipeNode:
+- if x == nil {
+- return // {{template "xxx"}}
+- }
+- fmt.Fprintf(wr.w, "%sPipeNode at %s, %d vars, %d cmds, IsAssign:%v\n",
+- indent, at(x.Pos), len(x.Decl), len(x.Cmds), x.IsAssign)
+- for _, d := range x.Decl {
+- wr.writeNode(d, indent+"Decl. ")
+- }
+- for _, c := range x.Cmds {
+- wr.writeNode(c, indent+"Cmd. ")
+- }
+- case *parse.RangeNode:
+- fmt.Fprintf(wr.w, "%sRangeNode at %s\n", indent, at(x.Pos))
+- wr.writeNode(&x.BranchNode, indent+". ")
+- case *parse.StringNode:
+- fmt.Fprintf(wr.w, "%sStringNode at %s, %s\n", indent, at(x.Pos), x.Quoted)
+- case *parse.TemplateNode:
+- fmt.Fprintf(wr.w, "%sTemplateNode at %s, %s\n", indent, at(x.Pos), x.Name)
+- wr.writeNode(x.Pipe, indent+". ")
+- case *parse.TextNode:
+- fmt.Fprintf(wr.w, "%sTextNode at %s, len %d\n", indent, at(x.Pos), len(x.Text))
+- case *parse.VariableNode:
+- fmt.Fprintf(wr.w, "%sVariableNode at %s, %v\n", indent, at(x.Pos), x.Ident)
+- case *parse.WithNode:
+- fmt.Fprintf(wr.w, "%sWithNode at %s\n", indent, at(x.Pos))
+- wr.writeNode(&x.BranchNode, indent+". ")
+- }
+-}
+-
+-var kindNames = []string{"", "File", "Module", "Namespace", "Package", "Class", "Method", "Property",
+- "Field", "Constructor", "Enum", "Interface", "Function", "Variable", "Constant", "String",
+- "Number", "Boolean", "Array", "Object", "Key", "Null", "EnumMember", "Struct", "Event",
+- "Operator", "TypeParameter"}
+-
+-func kindStr(k protocol.SymbolKind) string {
+- n := int(k)
+- if n < 1 || n >= len(kindNames) {
+- return fmt.Sprintf("?SymbolKind %d?", n)
+- }
+- return kindNames[n]
+-}
+diff -urN a/gopls/internal/lsp/template/parse_test.go b/gopls/internal/lsp/template/parse_test.go
+--- a/gopls/internal/lsp/template/parse_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/template/parse_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,238 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package template
+-
+-import (
+- "strings"
+- "testing"
+-)
+-
+-type datum struct {
+- buf string
+- cnt int
+- syms []string // the symbols in the parse of buf
+-}
+-
+-var tmpl = []datum{{`
+-{{if (foo .X.Y)}}{{$A := "hi"}}{{.Z $A}}{{else}}
+-{{$A.X 12}}
+-{{foo (.X.Y) 23 ($A.Zü)}}
+-{{end}}`, 1, []string{"{7,3,foo,Function,false}", "{12,1,X,Method,false}",
+- "{14,1,Y,Method,false}", "{21,2,$A,Variable,true}", "{26,2,,String,false}",
+- "{35,1,Z,Method,false}", "{38,2,$A,Variable,false}",
+- "{53,2,$A,Variable,false}", "{56,1,X,Method,false}", "{57,2,,Number,false}",
+- "{64,3,foo,Function,false}", "{70,1,X,Method,false}",
+- "{72,1,Y,Method,false}", "{75,2,,Number,false}", "{80,2,$A,Variable,false}",
+- "{83,2,Zü,Method,false}", "{94,3,,Constant,false}"}},
+-
+- {`{{define "zzz"}}{{.}}{{end}}
+-{{template "zzz"}}`, 2, []string{"{10,3,zzz,Namespace,true}", "{18,1,dot,Variable,false}",
+- "{41,3,zzz,Package,false}"}},
+-
+- {`{{block "aaa" foo}}b{{end}}`, 2, []string{"{9,3,aaa,Namespace,true}",
+- "{9,3,aaa,Package,false}", "{14,3,foo,Function,false}", "{19,1,,Constant,false}"}},
+- {"", 0, nil},
+-}
+-
+-func TestSymbols(t *testing.T) {
+- for i, x := range tmpl {
+- got := parseBuffer([]byte(x.buf))
+- if got.ParseErr != nil {
+- t.Errorf("error:%v", got.ParseErr)
+- continue
+- }
+- if len(got.named) != x.cnt {
+- t.Errorf("%d: got %d, expected %d", i, len(got.named), x.cnt)
+- }
+- for n, s := range got.symbols {
+- if s.String() != x.syms[n] {
+- t.Errorf("%d: got %s, expected %s", i, s.String(), x.syms[n])
+- }
+- }
+- }
+-}
+-
+-func TestWordAt(t *testing.T) {
+- want := []string{"", "", "$A", "$A", "", "", "", "", "", "",
+- "", "", "", "if", "if", "", "$A", "$A", "", "",
+- "B", "", "", "end", "end", "end", "", "", ""}
+- p := parseBuffer([]byte("{{$A := .}}{{if $A}}B{{end}}"))
+- for i := 0; i < len(p.buf); i++ {
+- got := findWordAt(p, i)
+- if got != want[i] {
+- t.Errorf("for %d, got %q, wanted %q", i, got, want[i])
+- }
+- }
+-}
+-
+-func TestNLS(t *testing.T) {
+- buf := `{{if (foÜx .X.Y)}}{{$A := "hi"}}{{.Z $A}}{{else}}
+- {{$A.X 12}}
+- {{foo (.X.Y) 23 ($A.Z)}}
+- {{end}}
+- `
+- p := parseBuffer([]byte(buf))
+- if p.ParseErr != nil {
+- t.Fatal(p.ParseErr)
+- }
+- // line 0 doesn't have a \n in front of it
+- for i := 1; i < len(p.nls)-1; i++ {
+- if buf[p.nls[i]] != '\n' {
+- t.Errorf("line %d got %c", i, buf[p.nls[i]])
+- }
+- }
+- // fake line at end of file
+- if p.nls[len(p.nls)-1] != len(buf) {
+- t.Errorf("got %d expected %d", p.nls[len(p.nls)-1], len(buf))
+- }
+-}
+-
+-func TestLineCol(t *testing.T) {
+- buf := `{{if (foÜx .X.Y)}}{{$A := "hi"}}{{.Z $A}}{{else}}
+- {{$A.X 12}}
+- {{foo (.X.Y) 23 ($A.Z)}}
+- {{end}}`
+- if false {
+- t.Error(buf)
+- }
+- for n, cx := range tmpl {
+- buf := cx.buf
+- p := parseBuffer([]byte(buf))
+- if p.ParseErr != nil {
+- t.Fatal(p.ParseErr)
+- }
+- type loc struct {
+- offset int
+- l, c uint32
+- }
+- saved := []loc{}
+- // forwards
+- var lastl, lastc uint32
+- for offset := range buf {
+- l, c := p.LineCol(offset)
+- saved = append(saved, loc{offset, l, c})
+- if l > lastl {
+- lastl = l
+- if c != 0 {
+- t.Errorf("line %d, got %d instead of 0", l, c)
+- }
+- }
+- if c > lastc {
+- lastc = c
+- }
+- }
+- lines := strings.Split(buf, "\n")
+- mxlen := -1
+- for _, l := range lines {
+- if len(l) > mxlen {
+- mxlen = len(l)
+- }
+- }
+- if int(lastl) != len(lines)-1 && int(lastc) != mxlen {
+- // lastl is 0 if there is only 1 line(?)
+- t.Errorf("expected %d, %d, got %d, %d for case %d", len(lines)-1, mxlen, lastl, lastc, n)
+- }
+- // backwards
+- for j := len(saved) - 1; j >= 0; j-- {
+- s := saved[j]
+- xl, xc := p.LineCol(s.offset)
+- if xl != s.l || xc != s.c {
+- t.Errorf("at offset %d(%d), got (%d,%d), expected (%d,%d)", s.offset, j, xl, xc, s.l, s.c)
+- }
+- }
+- }
+-}
+-
+-func TestLineColNL(t *testing.T) {
+- buf := "\n\n\n\n\n"
+- p := parseBuffer([]byte(buf))
+- if p.ParseErr != nil {
+- t.Fatal(p.ParseErr)
+- }
+- for i := 0; i < len(buf); i++ {
+- l, c := p.LineCol(i)
+- if c != 0 || int(l) != i+1 {
+- t.Errorf("got (%d,%d), expected (%d,0)", l, c, i)
+- }
+- }
+-}
+-
+-func TestPos(t *testing.T) {
+- buf := `
+- {{if (foÜx .X.Y)}}{{$A := "hi"}}{{.Z $A}}{{else}}
+- {{$A.X 12}}
+- {{foo (.X.Y) 23 ($A.Z)}}
+- {{end}}`
+- p := parseBuffer([]byte(buf))
+- if p.ParseErr != nil {
+- t.Fatal(p.ParseErr)
+- }
+- for pos, r := range buf {
+- if r == '\n' {
+- continue
+- }
+- x := p.Position(pos)
+- n := p.FromPosition(x)
+- if n != pos {
+- // once it's wrong, it will be wrong forever
+- t.Fatalf("at pos %d (rune %c) got %d {%#v]", pos, r, n, x)
+- }
+-
+- }
+-}
+-func TestLen(t *testing.T) {
+- data := []struct {
+- cnt int
+- v string
+- }{{1, "a"}, {1, "膈"}, {4, "😆🥸"}, {7, "3😀4567"}}
+- p := &Parsed{nonASCII: true}
+- for _, d := range data {
+- got := p.utf16len([]byte(d.v))
+- if got != d.cnt {
+- t.Errorf("%v, got %d wanted %d", d, got, d.cnt)
+- }
+- }
+-}
+-
+-func TestUtf16(t *testing.T) {
+- buf := `
+- {{if (foÜx .X.Y)}}😀{{$A := "hi"}}{{.Z $A}}{{else}}
+- {{$A.X 12}}
+- {{foo (.X.Y) 23 ($A.Z)}}
+- {{end}}`
+- p := parseBuffer([]byte(buf))
+- if p.nonASCII == false {
+- t.Error("expected nonASCII to be true")
+- }
+-}
+-
+-type ttest struct {
+- tmpl string
+- tokCnt int
+- elidedCnt int8
+-}
+-
+-func TestQuotes(t *testing.T) {
+- tsts := []ttest{
+- {"{{- /*comment*/ -}}", 1, 0},
+- {"{{/*`\ncomment\n`*/}}", 1, 0},
+- //{"{{foo\nbar}}\n", 1, 0}, // this action spanning lines parses in 1.16
+- {"{{\"{{foo}}{{\"}}", 1, 0},
+- {"{{\n{{- when}}", 1, 1}, // corrected
+- {"{{{{if .}}xx{{\n{{end}}", 2, 2}, // corrected
+- }
+- for _, s := range tsts {
+- p := parseBuffer([]byte(s.tmpl))
+- if len(p.tokens) != s.tokCnt {
+- t.Errorf("%q: got %d tokens, expected %d", s, len(p.tokens), s.tokCnt)
+- }
+- if p.ParseErr != nil {
+- t.Errorf("%q: %v", string(p.buf), p.ParseErr)
+- }
+- if len(p.elided) != int(s.elidedCnt) {
+- t.Errorf("%q: elided %d, expected %d", s, len(p.elided), s.elidedCnt)
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/template/symbols.go b/gopls/internal/lsp/template/symbols.go
+--- a/gopls/internal/lsp/template/symbols.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/template/symbols.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,230 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package template
+-
+-import (
+- "bytes"
+- "context"
+- "fmt"
+- "text/template/parse"
+- "unicode/utf8"
+-
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-// in local coordinates, to be translated to protocol.DocumentSymbol
+-type symbol struct {
+- start int // for sorting
+- length int // in runes (unicode code points)
+- name string
+- kind protocol.SymbolKind
+- vardef bool // is this a variable definition?
+- // do we care about selection range, or children?
+- // no children yet, and selection range is the same as range
+-}
+-
+-func (s symbol) String() string {
+- return fmt.Sprintf("{%d,%d,%s,%s,%v}", s.start, s.length, s.name, s.kind, s.vardef)
+-}
+-
+-// for FieldNode or VariableNode (or ChainNode?)
+-func (p *Parsed) fields(flds []string, x parse.Node) []symbol {
+- ans := []symbol{}
+- // guessing that there are no embedded blanks allowed. The doc is unclear
+- lookfor := ""
+- switch x.(type) {
+- case *parse.FieldNode:
+- for _, f := range flds {
+- lookfor += "." + f // quadratic, but probably ok
+- }
+- case *parse.VariableNode:
+- lookfor = flds[0]
+- for i := 1; i < len(flds); i++ {
+- lookfor += "." + flds[i]
+- }
+- case *parse.ChainNode: // PJW, what are these?
+- for _, f := range flds {
+- lookfor += "." + f // quadratic, but probably ok
+- }
+- default:
+- // If these happen they will happen even if gopls is restarted
+- // and the users does the same thing, so it is better not to panic.
+- // context.Background() is used because we don't have access
+- // to any other context. [we could, but it would be complicated]
+- event.Log(context.Background(), fmt.Sprintf("%T unexpected in fields()", x))
+- return nil
+- }
+- if len(lookfor) == 0 {
+- event.Log(context.Background(), fmt.Sprintf("no strings in fields() %#v", x))
+- return nil
+- }
+- startsAt := int(x.Position())
+- ix := bytes.Index(p.buf[startsAt:], []byte(lookfor)) // HasPrefix? PJW?
+- if ix < 0 || ix > len(lookfor) { // lookfor expected to be at start (or so)
+- // probably golang.go/#43388, so back up
+- startsAt -= len(flds[0]) + 1
+- ix = bytes.Index(p.buf[startsAt:], []byte(lookfor)) // ix might be 1? PJW
+- if ix < 0 {
+- return ans
+- }
+- }
+- at := ix + startsAt
+- for _, f := range flds {
+- at += 1 // .
+- kind := protocol.Method
+- if f[0] == '$' {
+- kind = protocol.Variable
+- }
+- sym := symbol{name: f, kind: kind, start: at, length: utf8.RuneCount([]byte(f))}
+- if kind == protocol.Variable && len(p.stack) > 1 {
+- if pipe, ok := p.stack[len(p.stack)-2].(*parse.PipeNode); ok {
+- for _, y := range pipe.Decl {
+- if x == y {
+- sym.vardef = true
+- }
+- }
+- }
+- }
+- ans = append(ans, sym)
+- at += len(f)
+- }
+- return ans
+-}
+-
+-func (p *Parsed) findSymbols() {
+- if len(p.stack) == 0 {
+- return
+- }
+- n := p.stack[len(p.stack)-1]
+- pop := func() {
+- p.stack = p.stack[:len(p.stack)-1]
+- }
+- if n == nil { // allowing nil simplifies the code
+- pop()
+- return
+- }
+- nxt := func(nd parse.Node) {
+- p.stack = append(p.stack, nd)
+- p.findSymbols()
+- }
+- switch x := n.(type) {
+- case *parse.ActionNode:
+- nxt(x.Pipe)
+- case *parse.BoolNode:
+- // need to compute the length from the value
+- msg := fmt.Sprintf("%v", x.True)
+- p.symbols = append(p.symbols, symbol{start: int(x.Pos), length: len(msg), kind: protocol.Boolean})
+- case *parse.BranchNode:
+- nxt(x.Pipe)
+- nxt(x.List)
+- nxt(x.ElseList)
+- case *parse.ChainNode:
+- p.symbols = append(p.symbols, p.fields(x.Field, x)...)
+- nxt(x.Node)
+- case *parse.CommandNode:
+- for _, a := range x.Args {
+- nxt(a)
+- }
+- //case *parse.CommentNode: // go 1.16
+- // log.Printf("implement %d", x.Type())
+- case *parse.DotNode:
+- sym := symbol{name: "dot", kind: protocol.Variable, start: int(x.Pos), length: 1}
+- p.symbols = append(p.symbols, sym)
+- case *parse.FieldNode:
+- p.symbols = append(p.symbols, p.fields(x.Ident, x)...)
+- case *parse.IdentifierNode:
+- sym := symbol{name: x.Ident, kind: protocol.Function, start: int(x.Pos),
+- length: utf8.RuneCount([]byte(x.Ident))}
+- p.symbols = append(p.symbols, sym)
+- case *parse.IfNode:
+- nxt(&x.BranchNode)
+- case *parse.ListNode:
+- if x != nil { // wretched typed nils. Node should have an IfNil
+- for _, nd := range x.Nodes {
+- nxt(nd)
+- }
+- }
+- case *parse.NilNode:
+- sym := symbol{name: "nil", kind: protocol.Constant, start: int(x.Pos), length: 3}
+- p.symbols = append(p.symbols, sym)
+- case *parse.NumberNode:
+- // no name; ascii
+- p.symbols = append(p.symbols, symbol{start: int(x.Pos), length: len(x.Text), kind: protocol.Number})
+- case *parse.PipeNode:
+- if x == nil { // {{template "foo"}}
+- return
+- }
+- for _, d := range x.Decl {
+- nxt(d)
+- }
+- for _, c := range x.Cmds {
+- nxt(c)
+- }
+- case *parse.RangeNode:
+- nxt(&x.BranchNode)
+- case *parse.StringNode:
+- // no name
+- sz := utf8.RuneCount([]byte(x.Text))
+- p.symbols = append(p.symbols, symbol{start: int(x.Pos), length: sz, kind: protocol.String})
+- case *parse.TemplateNode: // invoking a template
+- // x.Pos points to the quote before the name
+- p.symbols = append(p.symbols, symbol{name: x.Name, kind: protocol.Package, start: int(x.Pos) + 1,
+- length: utf8.RuneCount([]byte(x.Name))})
+- nxt(x.Pipe)
+- case *parse.TextNode:
+- if len(x.Text) == 1 && x.Text[0] == '\n' {
+- break
+- }
+- // nothing to report, but build one for hover
+- sz := utf8.RuneCount([]byte(x.Text))
+- p.symbols = append(p.symbols, symbol{start: int(x.Pos), length: sz, kind: protocol.Constant})
+- case *parse.VariableNode:
+- p.symbols = append(p.symbols, p.fields(x.Ident, x)...)
+- case *parse.WithNode:
+- nxt(&x.BranchNode)
+-
+- }
+- pop()
+-}
+-
+-// DocumentSymbols returns a hierarchy of the symbols defined in a template file.
+-// (The hierarchy is flat. SymbolInformation might be better.)
+-func DocumentSymbols(snapshot source.Snapshot, fh source.FileHandle) ([]protocol.DocumentSymbol, error) {
+- buf, err := fh.Read()
+- if err != nil {
+- return nil, err
+- }
+- p := parseBuffer(buf)
+- if p.ParseErr != nil {
+- return nil, p.ParseErr
+- }
+- var ans []protocol.DocumentSymbol
+- for _, s := range p.symbols {
+- if s.kind == protocol.Constant {
+- continue
+- }
+- d := kindStr(s.kind)
+- if d == "Namespace" {
+- d = "Template"
+- }
+- if s.vardef {
+- d += "(def)"
+- } else {
+- d += "(use)"
+- }
+- r := p.Range(s.start, s.length)
+- y := protocol.DocumentSymbol{
+- Name: s.name,
+- Detail: d,
+- Kind: s.kind,
+- Range: r,
+- SelectionRange: r, // or should this be the entire {{...}}?
+- }
+- ans = append(ans, y)
+- }
+- return ans, nil
+-}
+diff -urN a/gopls/internal/lsp/testdata/addimport/addimport.go.golden b/gopls/internal/lsp/testdata/addimport/addimport.go.golden
+--- a/gopls/internal/lsp/testdata/addimport/addimport.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/addimport/addimport.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+--- addimport --
+-package addimport //@addimport("", "bytes")
+-
+-import "bytes"
+-
+-func main() {}
+-
+diff -urN a/gopls/internal/lsp/testdata/addimport/addimport.go.in b/gopls/internal/lsp/testdata/addimport/addimport.go.in
+--- a/gopls/internal/lsp/testdata/addimport/addimport.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/addimport/addimport.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,3 +0,0 @@
+-package addimport //@addimport("", "bytes")
+-
+-func main() {}
+diff -urN a/gopls/internal/lsp/testdata/address/address.go b/gopls/internal/lsp/testdata/address/address.go
+--- a/gopls/internal/lsp/testdata/address/address.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/address/address.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,78 +0,0 @@
+-package address
+-
+-func wantsPtr(*int) {}
+-func wantsVariadicPtr(...*int) {}
+-
+-func wantsVariadic(...int) {}
+-
+-type foo struct{ c int } //@item(addrFieldC, "c", "int", "field")
+-
+-func _() {
+- var (
+- a string //@item(addrA, "a", "string", "var")
+- b int //@item(addrB, "b", "int", "var")
+- )
+-
+- wantsPtr() //@rank(")", addrB, addrA),snippet(")", addrB, "&b", "&b")
+- wantsPtr(&b) //@snippet(")", addrB, "b", "b")
+-
+- wantsVariadicPtr() //@rank(")", addrB, addrA),snippet(")", addrB, "&b", "&b")
+-
+- var s foo
+- s.c //@item(addrDeepC, "s.c", "int", "field")
+- wantsPtr() //@snippet(")", addrDeepC, "&s.c", "&s.c")
+- wantsPtr(s) //@snippet(")", addrDeepC, "&s.c", "&s.c")
+- wantsPtr(&s) //@snippet(")", addrDeepC, "s.c", "s.c")
+-
+- // don't add "&" in item (it gets added as an additional edit)
+- wantsPtr(&s.c) //@snippet(")", addrFieldC, "c", "c")
+-
+- // check dereferencing as well
+- var c *int //@item(addrCPtr, "c", "*int", "var")
+- var _ int = _ //@rank("_ //", addrCPtr, addrA),snippet("_ //", addrCPtr, "*c", "*c")
+-
+- wantsVariadic() //@rank(")", addrCPtr, addrA),snippet(")", addrCPtr, "*c", "*c")
+-
+- var d **int //@item(addrDPtr, "d", "**int", "var")
+- var _ int = _ //@rank("_ //", addrDPtr, addrA),snippet("_ //", addrDPtr, "**d", "**d")
+-
+- type namedPtr *int
+- var np namedPtr //@item(addrNamedPtr, "np", "namedPtr", "var")
+-
+- var _ int = _ //@rank("_ //", addrNamedPtr, addrA)
+-
+- // don't get tripped up by recursive pointer type
+- type dontMessUp *dontMessUp
+- var dmu *dontMessUp //@item(addrDMU, "dmu", "*dontMessUp", "var")
+-
+- var _ int = dmu //@complete(" //", addrDMU)
+-}
+-
+-func (f foo) ptr() *foo { return &f }
+-
+-func _() {
+- getFoo := func() foo { return foo{} }
+-
+- // not addressable
+- getFoo().c //@item(addrGetFooC, "getFoo().c", "int", "field")
+-
+- // addressable
+- getFoo().ptr().c //@item(addrGetFooPtrC, "getFoo().ptr().c", "int", "field")
+-
+- wantsPtr() //@rank(addrGetFooPtrC, addrGetFooC),snippet(")", addrGetFooPtrC, "&getFoo().ptr().c", "&getFoo().ptr().c")
+- wantsPtr(&g) //@rank(addrGetFooPtrC, addrGetFooC),snippet(")", addrGetFooPtrC, "getFoo().ptr().c", "getFoo().ptr().c")
+-}
+-
+-type nested struct {
+- f foo
+-}
+-
+-func _() {
+- getNested := func() nested { return nested{} }
+-
+- getNested().f.c //@item(addrNestedC, "getNested().f.c", "int", "field")
+- getNested().f.ptr().c //@item(addrNestedPtrC, "getNested().f.ptr().c", "int", "field")
+-
+- // addrNestedC is not addressable, so rank lower
+- wantsPtr(getNestedfc) //@fuzzy(")", addrNestedPtrC, addrNestedC)
+-}
+diff -urN a/gopls/internal/lsp/testdata/analyzer/bad_test.go b/gopls/internal/lsp/testdata/analyzer/bad_test.go
+--- a/gopls/internal/lsp/testdata/analyzer/bad_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/analyzer/bad_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+-package analyzer
+-
+-import (
+- "fmt"
+- "sync"
+- "testing"
+- "time"
+-)
+-
+-func Testbad(t *testing.T) { //@diag("", "tests", "Testbad has malformed name: first letter after 'Test' must not be lowercase", "warning")
+- var x sync.Mutex
+- _ = x //@diag("x", "copylocks", "assignment copies lock value to _: sync.Mutex", "warning")
+-
+- printfWrapper("%s") //@diag(re`printfWrapper\(.*\)`, "printf", "golang.org/lsptests/analyzer.printfWrapper format %s reads arg #1, but call has 0 args", "warning")
+-}
+-
+-func printfWrapper(format string, args ...interface{}) {
+- fmt.Printf(format, args...)
+-}
+-
+-func _() {
+- now := time.Now()
+- fmt.Println(now.Format("2006-02-01")) //@diag("2006-02-01", "timeformat", "2006-02-01 should be 2006-01-02", "warning")
+-}
+diff -urN a/gopls/internal/lsp/testdata/anon/anon.go.in b/gopls/internal/lsp/testdata/anon/anon.go.in
+--- a/gopls/internal/lsp/testdata/anon/anon.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/anon/anon.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,23 +0,0 @@
+-package anon
+-
+-func _() {
+- for _, _ := range []struct {
+- i, j int //@item(anonI, "i", "int", "field"),item(anonJ, "j", "int", "field")
+- }{
+- {
+- i: 1,
+- //@complete("", anonJ)
+- },
+- {
+- //@complete("", anonI, anonJ)
+- },
+- } {
+- continue
+- }
+-
+- s := struct{ f int }{ } //@item(anonF, "f", "int", "field"),item(structS, "s", "struct{...}", "var"),complete(" }", anonF)
+-
+- _ = map[struct{ x int }]int{ //@item(anonX, "x", "int", "field")
+- struct{ x int }{ }: 1, //@complete(" }", anonX, structS)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/append/append2.go.in b/gopls/internal/lsp/testdata/append/append2.go.in
+--- a/gopls/internal/lsp/testdata/append/append2.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/append/append2.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,5 +0,0 @@
+-package append
+-
+-func _() {
+- _ = append(a, struct) //@complete(")")
+-}
+\ No newline at end of file
+diff -urN a/gopls/internal/lsp/testdata/append/append.go b/gopls/internal/lsp/testdata/append/append.go
+--- a/gopls/internal/lsp/testdata/append/append.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/append/append.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,38 +0,0 @@
+-package append
+-
+-func foo([]string) {}
+-func bar(...string) {}
+-
+-func _() {
+- var (
+- aInt []int //@item(appendInt, "aInt", "[]int", "var")
+- aStrings []string //@item(appendStrings, "aStrings", "[]string", "var")
+- aString string //@item(appendString, "aString", "string", "var")
+- )
+-
+- append(aStrings, a) //@rank(")", appendString, appendInt)
+- var _ interface{} = append(aStrings, a) //@rank(")", appendString, appendInt)
+- var _ []string = append(oops, a) //@rank(")", appendString, appendInt)
+-
+- foo(append()) //@rank("))", appendStrings, appendInt),rank("))", appendStrings, appendString)
+- foo(append([]string{}, a)) //@rank("))", appendStrings, appendInt),rank("))", appendString, appendInt),snippet("))", appendStrings, "aStrings...", "aStrings...")
+- foo(append([]string{}, "", a)) //@rank("))", appendString, appendInt),rank("))", appendString, appendStrings)
+-
+- // Don't add "..." to append() argument.
+- bar(append()) //@snippet("))", appendStrings, "aStrings", "aStrings")
+-
+- type baz struct{}
+- baz{} //@item(appendBazLiteral, "baz{}", "", "var")
+- var bazzes []baz //@item(appendBazzes, "bazzes", "[]baz", "var")
+- var bazzy baz //@item(appendBazzy, "bazzy", "baz", "var")
+- bazzes = append(bazzes, ba) //@rank(")", appendBazzy, appendBazLiteral, appendBazzes)
+-
+- var b struct{ b []baz }
+- b.b //@item(appendNestedBaz, "b.b", "[]baz", "field")
+- b.b = append(b.b, b) //@rank(")", appendBazzy, appendBazLiteral, appendNestedBaz)
+-
+- var aStringsPtr *[]string //@item(appendStringsPtr, "aStringsPtr", "*[]string", "var")
+- foo(append([]string{}, a)) //@snippet("))", appendStringsPtr, "*aStringsPtr...", "*aStringsPtr...")
+-
+- foo(append([]string{}, *a)) //@snippet("))", appendStringsPtr, "aStringsPtr...", "aStringsPtr...")
+-}
+diff -urN a/gopls/internal/lsp/testdata/arraytype/array_type.go.in b/gopls/internal/lsp/testdata/arraytype/array_type.go.in
+--- a/gopls/internal/lsp/testdata/arraytype/array_type.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/arraytype/array_type.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,50 +0,0 @@
+-package arraytype
+-
+-import (
+- "golang.org/lsptests/foo"
+-)
+-
+-func _() {
+- var (
+- val string //@item(atVal, "val", "string", "var")
+- )
+-
+- // disabled - see issue #54822
+- [] // complete(" //", PackageFoo)
+-
+- []val //@complete(" //")
+-
+- []foo.StructFoo //@complete(" //", StructFoo)
+-
+- []foo.StructFoo(nil) //@complete("(", StructFoo)
+-
+- []*foo.StructFoo //@complete(" //", StructFoo)
+-
+- [...]foo.StructFoo //@complete(" //", StructFoo)
+-
+- [2][][4]foo.StructFoo //@complete(" //", StructFoo)
+-
+- []struct { f []foo.StructFoo } //@complete(" }", StructFoo)
+-}
+-
+-func _() {
+- type myInt int //@item(atMyInt, "myInt", "int", "type")
+-
+- var mark []myInt //@item(atMark, "mark", "[]myInt", "var")
+-
+- var s []myInt //@item(atS, "s", "[]myInt", "var")
+- s = []m //@complete(" //", atMyInt)
+- // disabled - see issue #54822
+- s = [] // complete(" //", atMyInt, PackageFoo)
+-
+- var a [1]myInt
+- a = [1]m //@complete(" //", atMyInt)
+-
+- var ds [][]myInt
+- ds = [][]m //@complete(" //", atMyInt)
+-}
+-
+-func _() {
+- var b [0]byte //@item(atByte, "b", "[0]byte", "var")
+- var _ []byte = b //@snippet(" //", atByte, "b[:]", "b[:]")
+-}
+diff -urN a/gopls/internal/lsp/testdata/assign/assign.go.in b/gopls/internal/lsp/testdata/assign/assign.go.in
+--- a/gopls/internal/lsp/testdata/assign/assign.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/assign/assign.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,26 +0,0 @@
+-package assign
+-
+-import "golang.org/lsptests/assign/internal/secret"
+-
+-func _() {
+- secret.Hello()
+- var (
+- myInt int //@item(assignInt, "myInt", "int", "var")
+- myStr string //@item(assignStr, "myStr", "string", "var")
+- )
+-
+- var _ string = my //@rank(" //", assignStr, assignInt)
+- var _ string = //@rank(" //", assignStr, assignInt)
+-}
+-
+-func _() {
+- var a string = a //@complete(" //")
+-}
+-
+-func _() {
+- fooBar := fooBa //@complete(" //"),item(assignFooBar, "fooBar", "", "var")
+- abc, fooBar := 123, fooBa //@complete(" //", assignFooBar)
+- {
+- fooBar := fooBa //@complete(" //", assignFooBar)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/assign/internal/secret/secret.go b/gopls/internal/lsp/testdata/assign/internal/secret/secret.go
+--- a/gopls/internal/lsp/testdata/assign/internal/secret/secret.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/assign/internal/secret/secret.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,3 +0,0 @@
+-package secret
+-
+-func Hello() {}
+\ No newline at end of file
+diff -urN a/gopls/internal/lsp/testdata/bad/bad0.go b/gopls/internal/lsp/testdata/bad/bad0.go
+--- a/gopls/internal/lsp/testdata/bad/bad0.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/bad/bad0.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+-//go:build go1.11
+-// +build go1.11
+-
+-package bad
+-
+-import _ "golang.org/lsptests/assign/internal/secret" //@diag("\"golang.org/lsptests/assign/internal/secret\"", "compiler", "could not import golang.org/lsptests/assign/internal/secret \\(invalid use of internal package \"golang.org/lsptests/assign/internal/secret\"\\)", "error")
+-
+-func stuff() { //@item(stuff, "stuff", "func()", "func")
+- x := "heeeeyyyy"
+- random2(x) //@diag("x", "compiler", "cannot use x \\(variable of type string\\) as int value in argument to random2", "error")
+- random2(1) //@complete("dom", random, random2, random3)
+- y := 3 //@diag("y", "compiler", "y declared (and|but) not used", "error")
+-}
+-
+-type bob struct { //@item(bob, "bob", "struct{...}", "struct")
+- x int
+-}
+-
+-func _() {
+- var q int
+- _ = &bob{
+- f: q, //@diag("f: q", "compiler", "unknown field f in struct literal", "error")
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/bad/bad1.go b/gopls/internal/lsp/testdata/bad/bad1.go
+--- a/gopls/internal/lsp/testdata/bad/bad1.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/bad/bad1.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,34 +0,0 @@
+-//go:build go1.11
+-// +build go1.11
+-
+-package bad
+-
+-// See #36637
+-type stateFunc func() stateFunc //@item(stateFunc, "stateFunc", "func() stateFunc", "type")
+-
+-var a unknown //@item(global_a, "a", "unknown", "var"),diag("unknown", "compiler", "(undeclared name|undefined): unknown", "error")
+-
+-func random() int { //@item(random, "random", "func() int", "func")
+- //@complete("", global_a, bob, random, random2, random3, stateFunc, stuff)
+- return 0
+-}
+-
+-func random2(y int) int { //@item(random2, "random2", "func(y int) int", "func"),item(bad_y_param, "y", "int", "var")
+- x := 6 //@item(x, "x", "int", "var"),diag("x", "compiler", "x declared (and|but) not used", "error")
+- var q blah //@item(q, "q", "blah", "var"),diag("q", "compiler", "q declared (and|but) not used", "error"),diag("blah", "compiler", "(undeclared name|undefined): blah", "error")
+- var t **blob //@item(t, "t", "**blob", "var"),diag("t", "compiler", "t declared (and|but) not used", "error"),diag("blob", "compiler", "(undeclared name|undefined): blob", "error")
+- //@complete("", q, t, x, bad_y_param, global_a, bob, random, random2, random3, stateFunc, stuff)
+-
+- return y
+-}
+-
+-func random3(y ...int) { //@item(random3, "random3", "func(y ...int)", "func"),item(y_variadic_param, "y", "[]int", "var")
+- //@complete("", y_variadic_param, global_a, bob, random, random2, random3, stateFunc, stuff)
+-
+- var ch chan (favType1) //@item(ch, "ch", "chan (favType1)", "var"),diag("ch", "compiler", "ch declared (and|but) not used", "error"),diag("favType1", "compiler", "(undeclared name|undefined): favType1", "error")
+- var m map[keyType]int //@item(m, "m", "map[keyType]int", "var"),diag("m", "compiler", "m declared (and|but) not used", "error"),diag("keyType", "compiler", "(undeclared name|undefined): keyType", "error")
+- var arr []favType2 //@item(arr, "arr", "[]favType2", "var"),diag("arr", "compiler", "arr declared (and|but) not used", "error"),diag("favType2", "compiler", "(undeclared name|undefined): favType2", "error")
+- var fn1 func() badResult //@item(fn1, "fn1", "func() badResult", "var"),diag("fn1", "compiler", "fn1 declared (and|but) not used", "error"),diag("badResult", "compiler", "(undeclared name|undefined): badResult", "error")
+- var fn2 func(badParam) //@item(fn2, "fn2", "func(badParam)", "var"),diag("fn2", "compiler", "fn2 declared (and|but) not used", "error"),diag("badParam", "compiler", "(undeclared name|undefined): badParam", "error")
+- //@complete("", arr, ch, fn1, fn2, m, y_variadic_param, global_a, bob, random, random2, random3, stateFunc, stuff)
+-}
+diff -urN a/gopls/internal/lsp/testdata/badstmt/badstmt_2.go.in b/gopls/internal/lsp/testdata/badstmt/badstmt_2.go.in
+--- a/gopls/internal/lsp/testdata/badstmt/badstmt_2.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/badstmt/badstmt_2.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package badstmt
+-
+-import (
+- "golang.org/lsptests/foo"
+-)
+-
+-func _() {
+- defer func() { foo. } //@rank(" }", Foo)
+-}
+diff -urN a/gopls/internal/lsp/testdata/badstmt/badstmt_3.go.in b/gopls/internal/lsp/testdata/badstmt/badstmt_3.go.in
+--- a/gopls/internal/lsp/testdata/badstmt/badstmt_3.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/badstmt/badstmt_3.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package badstmt
+-
+-import (
+- "golang.org/lsptests/foo"
+-)
+-
+-func _() {
+- go foo. //@rank(" //", Foo, IntFoo),snippet(" //", Foo, "Foo()", "Foo()")
+-}
+diff -urN a/gopls/internal/lsp/testdata/badstmt/badstmt_4.go.in b/gopls/internal/lsp/testdata/badstmt/badstmt_4.go.in
+--- a/gopls/internal/lsp/testdata/badstmt/badstmt_4.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/badstmt/badstmt_4.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-package badstmt
+-
+-import (
+- "golang.org/lsptests/foo"
+-)
+-
+-func _() {
+- go func() {
+- defer foo. //@rank(" //", Foo, IntFoo)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/badstmt/badstmt.go.in b/gopls/internal/lsp/testdata/badstmt/badstmt.go.in
+--- a/gopls/internal/lsp/testdata/badstmt/badstmt.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/badstmt/badstmt.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,29 +0,0 @@
+-package badstmt
+-
+-import (
+- "golang.org/lsptests/foo"
+-)
+-
+-// The nonewvars expectation asserts that the go/analysis framework ran.
+-// See comments in noparse.
+-
+-func _(x int) {
+- defer foo.F //@complete(" //", Foo),diag(" //", "syntax", "function must be invoked in defer statement|expression in defer must be function call", "error")
+- defer foo.F //@complete(" //", Foo)
+- x := 123 //@diag(":=", "nonewvars", "no new variables", "warning")
+-}
+-
+-func _() {
+- switch true {
+- case true:
+- go foo.F //@complete(" //", Foo)
+- }
+-}
+-
+-func _() {
+- defer func() {
+- foo.F //@complete(" //", Foo),snippet(" //", Foo, "Foo()", "Foo()")
+-
+- foo. //@rank(" //", Foo)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/bar/bar.go.in b/gopls/internal/lsp/testdata/bar/bar.go.in
+--- a/gopls/internal/lsp/testdata/bar/bar.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/bar/bar.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,47 +0,0 @@
+-// +build go1.11
+-
+-package bar
+-
+-import (
+- "golang.org/lsptests/foo" //@item(foo, "foo", "\"golang.org/lsptests/foo\"", "package")
+-)
+-
+-func helper(i foo.IntFoo) {} //@item(helper, "helper", "func(i foo.IntFoo)", "func")
+-
+-func _() {
+- help //@complete("l", helper)
+- _ = foo.StructFoo{} //@complete("S", IntFoo, StructFoo)
+-}
+-
+-// Bar is a function.
+-func Bar() { //@item(Bar, "Bar", "func()", "func", "Bar is a function.")
+- foo.Foo() //@complete("F", Foo, IntFoo, StructFoo)
+- var _ foo.IntFoo //@complete("I", IntFoo, StructFoo)
+- foo.() //@complete("(", Foo, IntFoo, StructFoo)
+-}
+-
+-func _() {
+- var Valentine int //@item(Valentine, "Valentine", "int", "var")
+-
+- _ = foo.StructFoo{
+- Valu //@complete(" //", Value)
+- }
+- _ = foo.StructFoo{
+- Va //@complete("a", Value, Valentine)
+- }
+- _ = foo.StructFoo{
+- Value: 5, //@complete("a", Value)
+- }
+- _ = foo.StructFoo{
+- //@complete("", Value, Valentine, foo, helper, Bar)
+- }
+- _ = foo.StructFoo{
+- Value: Valen //@complete("le", Valentine)
+- }
+- _ = foo.StructFoo{
+- Value: //@complete(" //", Valentine, foo, helper, Bar)
+- }
+- _ = foo.StructFoo{
+- Value: //@complete(" ", Valentine, foo, helper, Bar)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/basiclit/basiclit.go b/gopls/internal/lsp/testdata/basiclit/basiclit.go
+--- a/gopls/internal/lsp/testdata/basiclit/basiclit.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/basiclit/basiclit.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-package basiclit
+-
+-func _() {
+- var a int // something for lexical completions
+-
+- _ = "hello." //@complete(".")
+-
+- _ = 1 //@complete(" //")
+-
+- _ = 1. //@complete(".")
+-
+- _ = 'a' //@complete("' ")
+-}
+diff -urN a/gopls/internal/lsp/testdata/baz/baz.go.in b/gopls/internal/lsp/testdata/baz/baz.go.in
+--- a/gopls/internal/lsp/testdata/baz/baz.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/baz/baz.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,33 +0,0 @@
+-// +build go1.11
+-
+-package baz
+-
+-import (
+- "golang.org/lsptests/bar"
+-
+- f "golang.org/lsptests/foo"
+-)
+-
+-var FooStruct f.StructFoo
+-
+-func Baz() {
+- defer bar.Bar() //@complete("B", Bar)
+- // TODO(rstambler): Test completion here.
+- defer bar.B
+- var x f.IntFoo //@complete("n", IntFoo),typdef("x", IntFoo)
+- bar.Bar() //@complete("B", Bar)
+-}
+-
+-func _() {
+- bob := f.StructFoo{Value: 5}
+- if x := bob. //@complete(" //", Value)
+- switch true == false {
+- case true:
+- if x := bob. //@complete(" //", Value)
+- case false:
+- }
+- if x := bob.Va //@complete("a", Value)
+- switch true == true {
+- default:
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/builtins/builtin_args.go b/gopls/internal/lsp/testdata/builtins/builtin_args.go
+--- a/gopls/internal/lsp/testdata/builtins/builtin_args.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/builtins/builtin_args.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,62 +0,0 @@
+-package builtins
+-
+-func _() {
+- var (
+- aSlice []int //@item(builtinSlice, "aSlice", "[]int", "var")
+- aMap map[string]int //@item(builtinMap, "aMap", "map[string]int", "var")
+- aString string //@item(builtinString, "aString", "string", "var")
+- aArray [0]int //@item(builtinArray, "aArray", "[0]int", "var")
+- aArrayPtr *[0]int //@item(builtinArrayPtr, "aArrayPtr", "*[0]int", "var")
+- aChan chan int //@item(builtinChan, "aChan", "chan int", "var")
+- aPtr *int //@item(builtinPtr, "aPtr", "*int", "var")
+- aInt int //@item(builtinInt, "aInt", "int", "var")
+- )
+-
+- type (
+- aSliceType []int //@item(builtinSliceType, "aSliceType", "[]int", "type")
+- aChanType chan int //@item(builtinChanType, "aChanType", "chan int", "type")
+- aMapType map[string]int //@item(builtinMapType, "aMapType", "map[string]int", "type")
+- )
+-
+- close() //@rank(")", builtinChan, builtinSlice)
+-
+- append() //@rank(")", builtinSlice, builtinChan)
+-
+- var _ []byte = append([]byte(nil), ""...) //@rank(") //")
+-
+- copy() //@rank(")", builtinSlice, builtinChan)
+- copy(aSlice, aS) //@rank(")", builtinSlice, builtinString)
+- copy(aS, aSlice) //@rank(",", builtinSlice, builtinString)
+-
+- delete() //@rank(")", builtinMap, builtinChan)
+- delete(aMap, aS) //@rank(")", builtinString, builtinSlice)
+-
+- aMapFunc := func() map[int]int { //@item(builtinMapFunc, "aMapFunc", "func() map[int]int", "var")
+- return nil
+- }
+- delete() //@rank(")", builtinMapFunc, builtinSlice)
+-
+- len() //@rank(")", builtinSlice, builtinInt),rank(")", builtinMap, builtinInt),rank(")", builtinString, builtinInt),rank(")", builtinArray, builtinInt),rank(")", builtinArrayPtr, builtinPtr),rank(")", builtinChan, builtinInt)
+-
+- cap() //@rank(")", builtinSlice, builtinMap),rank(")", builtinArray, builtinString),rank(")", builtinArrayPtr, builtinPtr),rank(")", builtinChan, builtinInt)
+-
+- make() //@rank(")", builtinMapType, int),rank(")", builtinChanType, int),rank(")", builtinSliceType, int),rank(")", builtinMapType, int)
+- make(aSliceType, a) //@rank(")", builtinInt, builtinSlice)
+-
+- type myInt int
+- var mi myInt //@item(builtinMyInt, "mi", "myInt", "var")
+- make(aSliceType, m) //@snippet(")", builtinMyInt, "mi", "mi")
+-
+- var _ []int = make() //@rank(")", builtinSliceType, builtinMapType)
+-
+- type myStruct struct{} //@item(builtinStructType, "myStruct", "struct{...}", "struct")
+- var _ *myStruct = new() //@rank(")", builtinStructType, int)
+-
+- for k := range a { //@rank(" {", builtinSlice, builtinInt),rank(" {", builtinString, builtinInt),rank(" {", builtinChan, builtinInt),rank(" {", builtinArray, builtinInt),rank(" {", builtinArrayPtr, builtinInt),rank(" {", builtinMap, builtinInt),
+- }
+-
+- for k, v := range a { //@rank(" {", builtinSlice, builtinChan)
+- }
+-
+- <-a //@rank(" //", builtinChan, builtinInt)
+-}
+diff -urN a/gopls/internal/lsp/testdata/builtins/builtin_go117.go b/gopls/internal/lsp/testdata/builtins/builtin_go117.go
+--- a/gopls/internal/lsp/testdata/builtins/builtin_go117.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/builtins/builtin_go117.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-//go:build !go1.18
+-// +build !go1.18
+-
+-package builtins
+-
+-func _() {
+- //@complete("", append, bool, byte, cap, close, complex, complex128, complex64, copy, delete, error, _false, float32, float64, imag, int, int16, int32, int64, int8, len, make, new, panic, print, println, real, recover, rune, string, _true, uint, uint16, uint32, uint64, uint8, uintptr, _nil)
+-}
+diff -urN a/gopls/internal/lsp/testdata/builtins/builtin_go118.go b/gopls/internal/lsp/testdata/builtins/builtin_go118.go
+--- a/gopls/internal/lsp/testdata/builtins/builtin_go118.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/builtins/builtin_go118.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-//go:build go1.18 && !go1.21
+-// +build go1.18,!go1.21
+-
+-package builtins
+-
+-func _() {
+- //@complete("", any, append, bool, byte, cap, close, comparable, complex, complex128, complex64, copy, delete, error, _false, float32, float64, imag, int, int16, int32, int64, int8, len, make, new, panic, print, println, real, recover, rune, string, _true, uint, uint16, uint32, uint64, uint8, uintptr, _nil)
+-}
+diff -urN a/gopls/internal/lsp/testdata/builtins/builtin_go121.go b/gopls/internal/lsp/testdata/builtins/builtin_go121.go
+--- a/gopls/internal/lsp/testdata/builtins/builtin_go121.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/builtins/builtin_go121.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-//go:build go1.21
+-// +build go1.21
+-
+-package builtins
+-
+-func _() {
+- //@complete("", any, append, bool, byte, cap, clear, close, comparable, complex, complex128, complex64, copy, delete, error, _false, float32, float64, imag, int, int16, int32, int64, int8, len, make, new, panic, print, println, real, recover, rune, string, _true, uint, uint16, uint32, uint64, uint8, uintptr, _nil)
+-}
+diff -urN a/gopls/internal/lsp/testdata/builtins/builtins.go b/gopls/internal/lsp/testdata/builtins/builtins.go
+--- a/gopls/internal/lsp/testdata/builtins/builtins.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/builtins/builtins.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,47 +0,0 @@
+-package builtins
+-
+-// Definitions of builtin completion items.
+-
+-/* any */ //@item(any, "any", "", "interface")
+-/* Create markers for builtin types. Only for use by this test.
+-/* append(slice []Type, elems ...Type) []Type */ //@item(append, "append", "func(slice []Type, elems ...Type) []Type", "func")
+-/* bool */ //@item(bool, "bool", "", "type")
+-/* byte */ //@item(byte, "byte", "", "type")
+-/* cap(v Type) int */ //@item(cap, "cap", "func(v Type) int", "func")
+-/* clear[T interface{ ~[]Type | ~map[Type]Type1 }](t T) */ //@item(clear, "clear", "func(t T)", "func")
+-/* close(c chan<- Type) */ //@item(close, "close", "func(c chan<- Type)", "func")
+-/* comparable */ //@item(comparable, "comparable", "", "interface")
+-/* complex(r float64, i float64) */ //@item(complex, "complex", "func(r float64, i float64) complex128", "func")
+-/* complex128 */ //@item(complex128, "complex128", "", "type")
+-/* complex64 */ //@item(complex64, "complex64", "", "type")
+-/* copy(dst []Type, src []Type) int */ //@item(copy, "copy", "func(dst []Type, src []Type) int", "func")
+-/* delete(m map[Type]Type1, key Type) */ //@item(delete, "delete", "func(m map[Type]Type1, key Type)", "func")
+-/* error */ //@item(error, "error", "", "interface")
+-/* false */ //@item(_false, "false", "", "const")
+-/* float32 */ //@item(float32, "float32", "", "type")
+-/* float64 */ //@item(float64, "float64", "", "type")
+-/* imag(c complex128) float64 */ //@item(imag, "imag", "func(c complex128) float64", "func")
+-/* int */ //@item(int, "int", "", "type")
+-/* int16 */ //@item(int16, "int16", "", "type")
+-/* int32 */ //@item(int32, "int32", "", "type")
+-/* int64 */ //@item(int64, "int64", "", "type")
+-/* int8 */ //@item(int8, "int8", "", "type")
+-/* iota */ //@item(iota, "iota", "", "const")
+-/* len(v Type) int */ //@item(len, "len", "func(v Type) int", "func")
+-/* make(t Type, size ...int) Type */ //@item(make, "make", "func(t Type, size ...int) Type", "func")
+-/* new(Type) *Type */ //@item(new, "new", "func(Type) *Type", "func")
+-/* nil */ //@item(_nil, "nil", "", "var")
+-/* panic(v interface{}) */ //@item(panic, "panic", "func(v interface{})", "func")
+-/* print(args ...Type) */ //@item(print, "print", "func(args ...Type)", "func")
+-/* println(args ...Type) */ //@item(println, "println", "func(args ...Type)", "func")
+-/* real(c complex128) float64 */ //@item(real, "real", "func(c complex128) float64", "func")
+-/* recover() interface{} */ //@item(recover, "recover", "func() interface{}", "func")
+-/* rune */ //@item(rune, "rune", "", "type")
+-/* string */ //@item(string, "string", "", "type")
+-/* true */ //@item(_true, "true", "", "const")
+-/* uint */ //@item(uint, "uint", "", "type")
+-/* uint16 */ //@item(uint16, "uint16", "", "type")
+-/* uint32 */ //@item(uint32, "uint32", "", "type")
+-/* uint64 */ //@item(uint64, "uint64", "", "type")
+-/* uint8 */ //@item(uint8, "uint8", "", "type")
+-/* uintptr */ //@item(uintptr, "uintptr", "", "type")
+diff -urN a/gopls/internal/lsp/testdata/builtins/builtin_types.go b/gopls/internal/lsp/testdata/builtins/builtin_types.go
+--- a/gopls/internal/lsp/testdata/builtins/builtin_types.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/builtins/builtin_types.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-package builtins
+-
+-func _() {
+- var _ []bool //@item(builtinBoolSliceType, "[]bool", "[]bool", "type")
+-
+- var _ []bool = make() //@rank(")", builtinBoolSliceType, int)
+-
+- var _ []bool = make([], 0) //@rank(",", bool, int)
+-
+- var _ [][]bool = make([][], 0) //@rank(",", bool, int)
+-}
+diff -urN a/gopls/internal/lsp/testdata/builtins/constants.go b/gopls/internal/lsp/testdata/builtins/constants.go
+--- a/gopls/internal/lsp/testdata/builtins/constants.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/builtins/constants.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,19 +0,0 @@
+-package builtins
+-
+-func _() {
+- const (
+- foo = iota //@complete(" //", iota)
+- )
+-
+- iota //@complete(" //")
+-
+- var iota int //@item(iotaVar, "iota", "int", "var")
+-
+- iota //@complete(" //", iotaVar)
+-}
+-
+-func _() {
+- var twoRedUpEnd bool //@item(TRUEVar, "twoRedUpEnd", "bool", "var")
+-
+- var _ bool = true //@rank(" //", _true, TRUEVar)
+-}
+diff -urN a/gopls/internal/lsp/testdata/callhierarchy/callhierarchy.go b/gopls/internal/lsp/testdata/callhierarchy/callhierarchy.go
+--- a/gopls/internal/lsp/testdata/callhierarchy/callhierarchy.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/callhierarchy/callhierarchy.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,70 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package callhierarchy
+-
+-import "golang.org/lsptests/callhierarchy/outgoing"
+-
+-func a() { //@mark(hierarchyA, "a")
+- D()
+-}
+-
+-func b() { //@mark(hierarchyB, "b")
+- D()
+-}
+-
+-// C is an exported function
+-func C() { //@mark(hierarchyC, "C")
+- D()
+- D()
+-}
+-
+-// To test hierarchy across function literals
+-var x = func() { //@mark(hierarchyLiteral, "func"),mark(hierarchyLiteralOut, "x")
+- D()
+-}
+-
+-// D is exported to test incoming/outgoing calls across packages
+-func D() { //@mark(hierarchyD, "D"),incomingcalls(hierarchyD, hierarchyA, hierarchyB, hierarchyC, hierarchyLiteral, incomingA),outgoingcalls(hierarchyD, hierarchyE, hierarchyF, hierarchyG, hierarchyLiteralOut, outgoingB, hierarchyFoo, hierarchyH, hierarchyI, hierarchyJ, hierarchyK)
+- e()
+- x()
+- F()
+- outgoing.B()
+- foo := func() {} //@mark(hierarchyFoo, "foo"),incomingcalls(hierarchyFoo, hierarchyD),outgoingcalls(hierarchyFoo)
+- foo()
+-
+- func() {
+- g()
+- }()
+-
+- var i Interface = impl{}
+- i.H()
+- i.I()
+-
+- s := Struct{}
+- s.J()
+- s.K()
+-}
+-
+-func e() {} //@mark(hierarchyE, "e")
+-
+-// F is an exported function
+-func F() {} //@mark(hierarchyF, "F")
+-
+-func g() {} //@mark(hierarchyG, "g")
+-
+-type Interface interface {
+- H() //@mark(hierarchyH, "H")
+- I() //@mark(hierarchyI, "I")
+-}
+-
+-type impl struct{}
+-
+-func (i impl) H() {}
+-func (i impl) I() {}
+-
+-type Struct struct {
+- J func() //@mark(hierarchyJ, "J")
+- K func() //@mark(hierarchyK, "K")
+-}
+diff -urN a/gopls/internal/lsp/testdata/callhierarchy/incoming/incoming.go b/gopls/internal/lsp/testdata/callhierarchy/incoming/incoming.go
+--- a/gopls/internal/lsp/testdata/callhierarchy/incoming/incoming.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/callhierarchy/incoming/incoming.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package incoming
+-
+-import "golang.org/lsptests/callhierarchy"
+-
+-// A is exported to test incoming calls across packages
+-func A() { //@mark(incomingA, "A")
+- callhierarchy.D()
+-}
+diff -urN a/gopls/internal/lsp/testdata/callhierarchy/outgoing/outgoing.go b/gopls/internal/lsp/testdata/callhierarchy/outgoing/outgoing.go
+--- a/gopls/internal/lsp/testdata/callhierarchy/outgoing/outgoing.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/callhierarchy/outgoing/outgoing.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package outgoing
+-
+-// B is exported to test outgoing calls across packages
+-func B() { //@mark(outgoingB, "B")
+-}
+diff -urN a/gopls/internal/lsp/testdata/casesensitive/casesensitive.go b/gopls/internal/lsp/testdata/casesensitive/casesensitive.go
+--- a/gopls/internal/lsp/testdata/casesensitive/casesensitive.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/casesensitive/casesensitive.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package casesensitive
+-
+-func _() {
+- var lower int //@item(lower, "lower", "int", "var")
+- var Upper int //@item(upper, "Upper", "int", "var")
+-
+- l //@casesensitive(" //", lower)
+- U //@casesensitive(" //", upper)
+-
+- L //@casesensitive(" //")
+- u //@casesensitive(" //")
+-}
+diff -urN a/gopls/internal/lsp/testdata/cast/cast.go.in b/gopls/internal/lsp/testdata/cast/cast.go.in
+--- a/gopls/internal/lsp/testdata/cast/cast.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/cast/cast.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-package cast
+-
+-func _() {
+- foo := struct{x int}{x: 1} //@item(x_field, "x", "int", "field")
+- _ = float64(foo.x) //@complete("x", x_field)
+-}
+-
+-func _() {
+- foo := struct{x int}{x: 1}
+- _ = float64(foo. //@complete(" /", x_field)
+-}
+\ No newline at end of file
+diff -urN a/gopls/internal/lsp/testdata/cgo/declarecgo.go b/gopls/internal/lsp/testdata/cgo/declarecgo.go
+--- a/gopls/internal/lsp/testdata/cgo/declarecgo.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/cgo/declarecgo.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,27 +0,0 @@
+-package cgo
+-
+-/*
+-#include <stdio.h>
+-#include <stdlib.h>
+-
+-void myprint(char* s) {
+- printf("%s\n", s);
+-}
+-*/
+-import "C"
+-
+-import (
+- "fmt"
+- "unsafe"
+-)
+-
+-func Example() { //@mark(funccgoexample, "Example"),item(funccgoexample, "Example", "func()", "func")
+- fmt.Println()
+- cs := C.CString("Hello from stdio\n")
+- C.myprint(cs)
+- C.free(unsafe.Pointer(cs))
+-}
+-
+-func _() {
+- Example() //@godef("ample", funccgoexample),complete("ample", funccgoexample)
+-}
+diff -urN a/gopls/internal/lsp/testdata/cgo/declarecgo.go.golden b/gopls/internal/lsp/testdata/cgo/declarecgo.go.golden
+--- a/gopls/internal/lsp/testdata/cgo/declarecgo.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/cgo/declarecgo.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,30 +0,0 @@
+--- funccgoexample-definition --
+-cgo/declarecgo.go:18:6-13: defined here as ```go
+-func Example()
+-```
+-
+-[`cgo.Example` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/cgo#Example)
+--- funccgoexample-definition-json --
+-{
+- "span": {
+- "uri": "file://cgo/declarecgo.go",
+- "start": {
+- "line": 18,
+- "column": 6,
+- "offset": 151
+- },
+- "end": {
+- "line": 18,
+- "column": 13,
+- "offset": 158
+- }
+- },
+- "description": "```go\nfunc Example()\n```\n\n[`cgo.Example` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/cgo#Example)"
+-}
+-
+--- funccgoexample-hoverdef --
+-```go
+-func Example()
+-```
+-
+-[`cgo.Example` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/cgo#Example)
+diff -urN a/gopls/internal/lsp/testdata/cgo/declarecgo_nocgo.go b/gopls/internal/lsp/testdata/cgo/declarecgo_nocgo.go
+--- a/gopls/internal/lsp/testdata/cgo/declarecgo_nocgo.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/cgo/declarecgo_nocgo.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-//+build !cgo
+-
+-package cgo
+-
+-// Set a dummy marker to keep the test framework happy. The tests should be skipped.
+-var _ = "Example" //@mark(funccgoexample, "Example"),godef("ample", funccgoexample),complete("ample", funccgoexample)
+diff -urN a/gopls/internal/lsp/testdata/cgoimport/usecgo.go.golden b/gopls/internal/lsp/testdata/cgoimport/usecgo.go.golden
+--- a/gopls/internal/lsp/testdata/cgoimport/usecgo.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/cgoimport/usecgo.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,30 +0,0 @@
+--- funccgoexample-definition --
+-cgo/declarecgo.go:18:6-13: defined here as ```go
+-func cgo.Example()
+-```
+-
+-[`cgo.Example` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/cgo#Example)
+--- funccgoexample-definition-json --
+-{
+- "span": {
+- "uri": "file://cgo/declarecgo.go",
+- "start": {
+- "line": 18,
+- "column": 6,
+- "offset": 151
+- },
+- "end": {
+- "line": 18,
+- "column": 13,
+- "offset": 158
+- }
+- },
+- "description": "```go\nfunc cgo.Example()\n```\n\n[`cgo.Example` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/cgo#Example)"
+-}
+-
+--- funccgoexample-hoverdef --
+-```go
+-func cgo.Example()
+-```
+-
+-[`cgo.Example` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/cgo#Example)
+diff -urN a/gopls/internal/lsp/testdata/cgoimport/usecgo.go.in b/gopls/internal/lsp/testdata/cgoimport/usecgo.go.in
+--- a/gopls/internal/lsp/testdata/cgoimport/usecgo.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/cgoimport/usecgo.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package cgoimport
+-
+-import (
+- "golang.org/lsptests/cgo"
+-)
+-
+-func _() {
+- cgo.Example() //@godef("ample", funccgoexample),complete("ample", funccgoexample)
+-}
+diff -urN a/gopls/internal/lsp/testdata/channel/channel.go b/gopls/internal/lsp/testdata/channel/channel.go
+--- a/gopls/internal/lsp/testdata/channel/channel.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/channel/channel.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,25 +0,0 @@
+-package channel
+-
+-func _() {
+- var (
+- aa = "123" //@item(channelAA, "aa", "string", "var")
+- ab = 123 //@item(channelAB, "ab", "int", "var")
+- )
+-
+- {
+- type myChan chan int
+- var mc myChan
+- mc <- a //@complete(" //", channelAB, channelAA)
+- }
+-
+- {
+- var ac chan int //@item(channelAC, "ac", "chan int", "var")
+- a <- a //@complete(" <-", channelAC, channelAA, channelAB)
+- }
+-
+- {
+- var foo chan int //@item(channelFoo, "foo", "chan int", "var")
+- wantsInt := func(int) {} //@item(channelWantsInt, "wantsInt", "func(int)", "var")
+- wantsInt(<-) //@rank(")", channelFoo, channelAB)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/codelens/codelens_test.go b/gopls/internal/lsp/testdata/codelens/codelens_test.go
+--- a/gopls/internal/lsp/testdata/codelens/codelens_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/codelens/codelens_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+-package codelens //@codelens("package codelens", "run file benchmarks", "test")
+-
+-import "testing"
+-
+-func TestMain(m *testing.M) {} // no code lens for TestMain
+-
+-func TestFuncWithCodeLens(t *testing.T) { //@codelens("func", "run test", "test")
+-}
+-
+-func thisShouldNotHaveACodeLens(t *testing.T) {
+-}
+-
+-func BenchmarkFuncWithCodeLens(b *testing.B) { //@codelens("func", "run benchmark", "test")
+-}
+-
+-func helper() {} // expect no code lens
+diff -urN a/gopls/internal/lsp/testdata/comment_completion/comment_completion.go.in b/gopls/internal/lsp/testdata/comment_completion/comment_completion.go.in
+--- a/gopls/internal/lsp/testdata/comment_completion/comment_completion.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/comment_completion/comment_completion.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,70 +0,0 @@
+-package comment_completion
+-
+-var p bool
+-
+-//@complete(re"$")
+-
+-func _() {
+- var a int
+-
+- switch a {
+- case 1:
+- //@complete(re"$")
+- _ = a
+- }
+-
+- var b chan int
+- select {
+- case <-b:
+- //@complete(re"$")
+- _ = b
+- }
+-
+- var (
+- //@complete(re"$")
+- _ = a
+- )
+-}
+-
+-// //@complete(" ", variableC)
+-var C string //@item(variableC, "C", "string", "var") //@complete(" ", variableC)
+-
+-// //@complete(" ", constant)
+-const Constant = "example" //@item(constant, "Constant", "string", "const") //@complete(" ", constant)
+-
+-// //@complete(" ", structType, fieldB, fieldA)
+-type StructType struct { //@item(structType, "StructType", "struct{...}", "struct") //@complete(" ", structType, fieldA, fieldB)
+- // //@complete(" ", fieldA, structType, fieldB)
+- A string //@item(fieldA, "A", "string", "field") //@complete(" ", fieldA, structType, fieldB)
+- b int //@item(fieldB, "b", "int", "field") //@complete(" ", fieldB, structType, fieldA)
+-}
+-
+-// //@complete(" ", method, structRecv, paramX, resultY, fieldB, fieldA)
+-func (structType *StructType) Method(X int) (Y int) { //@item(structRecv, "structType", "*StructType", "var"),item(method, "Method", "func(X int) (Y int)", "method"),item(paramX, "X", "int", "var"),item(resultY, "Y", "int", "var")
+- // //@complete(" ", method, structRecv, paramX, resultY, fieldB, fieldA)
+- return
+-}
+-
+-// //@complete(" ", newType)
+-type NewType string //@item(newType, "NewType", "string", "type") //@complete(" ", newType)
+-
+-// //@complete(" ", testInterface, testA, testB)
+-type TestInterface interface { //@item(testInterface, "TestInterface", "interface{...}", "interface")
+- // //@complete(" ", testA, testInterface, testB)
+- TestA(L string) (M int) //@item(testA, "TestA", "func(L string) (M int)", "method"),item(paramL, "L", "var", "string"),item(resM, "M", "var", "int") //@complete(" ", testA, testInterface, testB)
+- TestB(N int) bool //@item(testB, "TestB", "func(N int) bool", "method"),item(paramN, "N", "var", "int") //@complete(" ", testB, testInterface, testA)
+-}
+-
+-// //@complete(" ", function)
+-func Function() int { //@item(function, "Function", "func() int", "func") //@complete(" ", function)
+- // //@complete(" ", function)
+- return 0
+-}
+-
+-// This tests multiline block comments and completion with prefix
+-// Lorem Ipsum Multili//@complete("Multi", multiline)
+-// Lorem ipsum dolor sit ametom
+-func Multiline() int { //@item(multiline, "Multiline", "func() int", "func")
+- // //@complete(" ", multiline)
+- return 0
+-}
+diff -urN a/gopls/internal/lsp/testdata/complit/complit.go.in b/gopls/internal/lsp/testdata/complit/complit.go.in
+--- a/gopls/internal/lsp/testdata/complit/complit.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/complit/complit.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,90 +0,0 @@
+-package complit
+-
+-// general completions
+-
+-type position struct { //@item(structPosition, "position", "struct{...}", "struct")
+- X, Y int //@item(fieldX, "X", "int", "field"),item(fieldY, "Y", "int", "field")
+-}
+-
+-func _() {
+- _ = position{
+- //@complete("", fieldX, fieldY, structPosition)
+- }
+- _ = position{
+- X: 1,
+- //@complete("", fieldY)
+- }
+- _ = position{
+- //@complete("", fieldX)
+- Y: 1,
+- }
+- _ = []*position{
+- {
+- //@complete("", fieldX, fieldY, structPosition)
+- },
+- }
+-}
+-
+-func _() {
+- var (
+- aa string //@item(aaVar, "aa", "string", "var")
+- ab int //@item(abVar, "ab", "int", "var")
+- )
+-
+- _ = map[int]int{
+- a: a, //@complete(":", abVar, aaVar),complete(",", abVar, aaVar)
+- }
+-
+- _ = map[int]int{
+- //@complete("", abVar, aaVar, structPosition)
+- }
+-
+- _ = []string{a: ""} //@complete(":", abVar, aaVar)
+- _ = [1]string{a: ""} //@complete(":", abVar, aaVar)
+-
+- _ = position{X: a} //@complete("}", abVar, aaVar)
+- _ = position{a} //@complete("}", abVar, aaVar)
+- _ = position{a, } //@complete("}", abVar, aaVar, structPosition)
+-
+- _ = []int{a} //@complete("}", abVar, aaVar)
+- _ = [1]int{a} //@complete("}", abVar, aaVar)
+-
+- type myStruct struct {
+- AA int //@item(fieldAA, "AA", "int", "field")
+- AB string //@item(fieldAB, "AB", "string", "field")
+- }
+-
+- _ = myStruct{
+- AB: a, //@complete(",", aaVar, abVar)
+- }
+-
+- var s myStruct
+-
+- _ = map[int]string{1: "" + s.A} //@complete("}", fieldAB, fieldAA)
+- _ = map[int]string{1: (func(i int) string { return "" })(s.A)} //@complete(")}", fieldAA, fieldAB)
+- _ = map[int]string{1: func() string { s.A }} //@complete(" }", fieldAA, fieldAB)
+-
+- _ = position{s.A} //@complete("}", fieldAA, fieldAB)
+-
+- var X int //@item(varX, "X", "int", "var")
+- _ = position{X} //@complete("}", fieldX, varX)
+-}
+-
+-func _() {
+- type foo struct{} //@item(complitFoo, "foo", "struct{...}", "struct")
+-
+- var _ *foo = &fo{} //@snippet("{", complitFoo, "foo", "foo")
+- var _ *foo = fo{} //@snippet("{", complitFoo, "&foo", "&foo")
+-
+- struct { a, b *foo }{
+- a: &fo{}, //@rank("{", complitFoo)
+- b: fo{}, //@snippet("{", complitFoo, "&foo", "&foo")
+- }
+-}
+-
+-func _() {
+- _ := position{
+- X: 1, //@complete("X", fieldX),complete(" 1", structPosition)
+- Y: , //@complete(":", fieldY),complete(" ,", structPosition)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/constant/constant.go b/gopls/internal/lsp/testdata/constant/constant.go
+--- a/gopls/internal/lsp/testdata/constant/constant.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/constant/constant.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+-package constant
+-
+-const x = 1 //@item(constX, "x", "int", "const")
+-
+-const (
+- a int = iota << 2 //@item(constA, "a", "int", "const")
+- b //@item(constB, "b", "int", "const")
+- c //@item(constC, "c", "int", "const")
+-)
+-
+-func _() {
+- const y = "hi" //@item(constY, "y", "string", "const")
+- //@complete("", constY, constA, constB, constC, constX)
+-}
+diff -urN a/gopls/internal/lsp/testdata/danglingstmt/dangling_for.go b/gopls/internal/lsp/testdata/danglingstmt/dangling_for.go
+--- a/gopls/internal/lsp/testdata/danglingstmt/dangling_for.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/danglingstmt/dangling_for.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package danglingstmt
+-
+-func _() {
+- for bar //@rank(" //", danglingBar)
+-}
+-
+-func bar() bool { //@item(danglingBar, "bar", "func() bool", "func")
+- return true
+-}
+diff -urN a/gopls/internal/lsp/testdata/danglingstmt/dangling_for_init_cond.go b/gopls/internal/lsp/testdata/danglingstmt/dangling_for_init_cond.go
+--- a/gopls/internal/lsp/testdata/danglingstmt/dangling_for_init_cond.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/danglingstmt/dangling_for_init_cond.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package danglingstmt
+-
+-func _() {
+- for i := bar3(); i > bar //@rank(" //", danglingBar3)
+-}
+-
+-func bar3() int { //@item(danglingBar3, "bar3", "func() int", "func")
+- return 0
+-}
+diff -urN a/gopls/internal/lsp/testdata/danglingstmt/dangling_for_init_cond_post.go b/gopls/internal/lsp/testdata/danglingstmt/dangling_for_init_cond_post.go
+--- a/gopls/internal/lsp/testdata/danglingstmt/dangling_for_init_cond_post.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/danglingstmt/dangling_for_init_cond_post.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package danglingstmt
+-
+-func _() {
+- for i := bar4(); i > bar4(); i += bar //@rank(" //", danglingBar4)
+-}
+-
+-func bar4() int { //@item(danglingBar4, "bar4", "func() int", "func")
+- return 0
+-}
+diff -urN a/gopls/internal/lsp/testdata/danglingstmt/dangling_for_init.go b/gopls/internal/lsp/testdata/danglingstmt/dangling_for_init.go
+--- a/gopls/internal/lsp/testdata/danglingstmt/dangling_for_init.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/danglingstmt/dangling_for_init.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package danglingstmt
+-
+-func _() {
+- for i := bar //@rank(" //", danglingBar2)
+-}
+-
+-func bar2() int { //@item(danglingBar2, "bar2", "func() int", "func")
+- return 0
+-}
+diff -urN a/gopls/internal/lsp/testdata/danglingstmt/dangling_if_eof.go b/gopls/internal/lsp/testdata/danglingstmt/dangling_if_eof.go
+--- a/gopls/internal/lsp/testdata/danglingstmt/dangling_if_eof.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/danglingstmt/dangling_if_eof.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-package danglingstmt
+-
+-func bar5() bool { //@item(danglingBar5, "bar5", "func() bool", "func")
+- return true
+-}
+-
+-func _() {
+- if b //@rank(" //", danglingBar5)
+diff -urN a/gopls/internal/lsp/testdata/danglingstmt/dangling_if.go b/gopls/internal/lsp/testdata/danglingstmt/dangling_if.go
+--- a/gopls/internal/lsp/testdata/danglingstmt/dangling_if.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/danglingstmt/dangling_if.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package danglingstmt
+-
+-func _() {
+- if foo //@rank(" //", danglingFoo)
+-}
+-
+-func foo() bool { //@item(danglingFoo, "foo", "func() bool", "func")
+- return true
+-}
+diff -urN a/gopls/internal/lsp/testdata/danglingstmt/dangling_if_init_cond.go b/gopls/internal/lsp/testdata/danglingstmt/dangling_if_init_cond.go
+--- a/gopls/internal/lsp/testdata/danglingstmt/dangling_if_init_cond.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/danglingstmt/dangling_if_init_cond.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package danglingstmt
+-
+-func _() {
+- if i := 123; foo //@rank(" //", danglingFoo3)
+-}
+-
+-func foo3() bool { //@item(danglingFoo3, "foo3", "func() bool", "func")
+- return true
+-}
+diff -urN a/gopls/internal/lsp/testdata/danglingstmt/dangling_if_init.go b/gopls/internal/lsp/testdata/danglingstmt/dangling_if_init.go
+--- a/gopls/internal/lsp/testdata/danglingstmt/dangling_if_init.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/danglingstmt/dangling_if_init.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package danglingstmt
+-
+-func _() {
+- if i := foo //@rank(" //", danglingFoo2)
+-}
+-
+-func foo2() bool { //@item(danglingFoo2, "foo2", "func() bool", "func")
+- return true
+-}
+diff -urN a/gopls/internal/lsp/testdata/danglingstmt/dangling_multiline_if.go b/gopls/internal/lsp/testdata/danglingstmt/dangling_multiline_if.go
+--- a/gopls/internal/lsp/testdata/danglingstmt/dangling_multiline_if.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/danglingstmt/dangling_multiline_if.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-package danglingstmt
+-
+-func walrus() bool { //@item(danglingWalrus, "walrus", "func() bool", "func")
+- return true
+-}
+-
+-func _() {
+- if true &&
+- walrus //@complete(" //", danglingWalrus)
+-}
+diff -urN a/gopls/internal/lsp/testdata/danglingstmt/dangling_selector_1.go b/gopls/internal/lsp/testdata/danglingstmt/dangling_selector_1.go
+--- a/gopls/internal/lsp/testdata/danglingstmt/dangling_selector_1.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/danglingstmt/dangling_selector_1.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-package danglingstmt
+-
+-func _() {
+- x. //@rank(" //", danglingI)
+-}
+-
+-var x struct { i int } //@item(danglingI, "i", "int", "field")
+diff -urN a/gopls/internal/lsp/testdata/danglingstmt/dangling_selector_2.go b/gopls/internal/lsp/testdata/danglingstmt/dangling_selector_2.go
+--- a/gopls/internal/lsp/testdata/danglingstmt/dangling_selector_2.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/danglingstmt/dangling_selector_2.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-package danglingstmt
+-
+-import "golang.org/lsptests/foo"
+-
+-func _() {
+- foo. //@rank(" //", Foo)
+- var _ = []string{foo.} //@rank("}", Foo)
+-}
+diff -urN a/gopls/internal/lsp/testdata/danglingstmt/dangling_switch_init.go b/gopls/internal/lsp/testdata/danglingstmt/dangling_switch_init.go
+--- a/gopls/internal/lsp/testdata/danglingstmt/dangling_switch_init.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/danglingstmt/dangling_switch_init.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package danglingstmt
+-
+-func _() {
+- switch i := baz //@rank(" //", danglingBaz)
+-}
+-
+-func baz() int { //@item(danglingBaz, "baz", "func() int", "func")
+- return 0
+-}
+diff -urN a/gopls/internal/lsp/testdata/danglingstmt/dangling_switch_init_tag.go b/gopls/internal/lsp/testdata/danglingstmt/dangling_switch_init_tag.go
+--- a/gopls/internal/lsp/testdata/danglingstmt/dangling_switch_init_tag.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/danglingstmt/dangling_switch_init_tag.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package danglingstmt
+-
+-func _() {
+- switch i := 0; baz //@rank(" //", danglingBaz2)
+-}
+-
+-func baz2() int { //@item(danglingBaz2, "baz2", "func() int", "func")
+- return 0
+-}
+diff -urN a/gopls/internal/lsp/testdata/deep/deep.go b/gopls/internal/lsp/testdata/deep/deep.go
+--- a/gopls/internal/lsp/testdata/deep/deep.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/deep/deep.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,142 +0,0 @@
+-package deep
+-
+-import "context"
+-
+-type deepA struct {
+- b deepB //@item(deepBField, "b", "deepB", "field")
+-}
+-
+-type deepB struct {
+-}
+-
+-func wantsDeepB(deepB) {}
+-
+-func _() {
+- var a deepA //@item(deepAVar, "a", "deepA", "var")
+- a.b //@item(deepABField, "a.b", "deepB", "field")
+- wantsDeepB(a) //@deep(")", deepABField, deepAVar)
+-
+- deepA{a} //@snippet("}", deepABField, "a.b", "a.b")
+-}
+-
+-func wantsContext(context.Context) {}
+-
+-func _() {
+- context.Background() //@item(ctxBackground, "context.Background", "func() context.Context", "func", "Background returns a non-nil, empty Context.")
+- context.TODO() //@item(ctxTODO, "context.TODO", "func() context.Context", "func", "TODO returns a non-nil, empty Context.")
+-
+- wantsContext(c) //@rank(")", ctxBackground),rank(")", ctxTODO)
+-}
+-
+-func _() {
+- var cork struct{ err error }
+- cork.err //@item(deepCorkErr, "cork.err", "error", "field")
+- context //@item(deepContextPkg, "context", "\"context\"", "package")
+- var _ error = co //@rank(" //", deepCorkErr, deepContextPkg)
+-}
+-
+-func _() {
+- // deepCircle is circular.
+- type deepCircle struct {
+- *deepCircle
+- }
+- var circle deepCircle //@item(deepCircle, "circle", "deepCircle", "var")
+- circle.deepCircle //@item(deepCircleField, "circle.deepCircle", "*deepCircle", "field")
+- var _ deepCircle = circ //@deep(" //", deepCircle, deepCircleField),snippet(" //", deepCircleField, "*circle.deepCircle", "*circle.deepCircle")
+-}
+-
+-func _() {
+- type deepEmbedC struct {
+- }
+- type deepEmbedB struct {
+- deepEmbedC
+- }
+- type deepEmbedA struct {
+- deepEmbedB
+- }
+-
+- wantsC := func(deepEmbedC) {}
+-
+- var a deepEmbedA //@item(deepEmbedA, "a", "deepEmbedA", "var")
+- a.deepEmbedB //@item(deepEmbedB, "a.deepEmbedB", "deepEmbedB", "field")
+- a.deepEmbedC //@item(deepEmbedC, "a.deepEmbedC", "deepEmbedC", "field")
+- wantsC(a) //@deep(")", deepEmbedC, deepEmbedA, deepEmbedB)
+-}
+-
+-func _() {
+- type nested struct {
+- a int
+- n *nested //@item(deepNestedField, "n", "*nested", "field")
+- }
+-
+- nested{
+- a: 123, //@deep(" //", deepNestedField)
+- }
+-}
+-
+-func _() {
+- var a struct {
+- b struct {
+- c int
+- }
+- d int
+- }
+-
+- a.d //@item(deepAD, "a.d", "int", "field")
+- a.b.c //@item(deepABC, "a.b.c", "int", "field")
+- a.b //@item(deepAB, "a.b", "struct{...}", "field")
+- a //@item(deepA, "a", "struct{...}", "var")
+-
+- // "a.d" should be ranked above the deeper "a.b.c"
+- var i int
+- i = a //@deep(" //", deepAD, deepABC, deepA, deepAB)
+-}
+-
+-type foo struct {
+- b bar
+-}
+-
+-func (f foo) bar() bar {
+- return f.b
+-}
+-
+-func (f foo) barPtr() *bar {
+- return &f.b
+-}
+-
+-type bar struct{}
+-
+-func (b bar) valueReceiver() int {
+- return 0
+-}
+-
+-func (b *bar) ptrReceiver() int {
+- return 0
+-}
+-
+-func _() {
+- var (
+- i int
+- f foo
+- )
+-
+- f.bar().valueReceiver //@item(deepBarValue, "f.bar().valueReceiver", "func() int", "method")
+- f.barPtr().ptrReceiver //@item(deepBarPtrPtr, "f.barPtr().ptrReceiver", "func() int", "method")
+- f.barPtr().valueReceiver //@item(deepBarPtrValue, "f.barPtr().valueReceiver", "func() int", "method")
+-
+- i = fbar //@fuzzy(" //", deepBarValue, deepBarPtrPtr, deepBarPtrValue)
+-}
+-
+-func (b baz) Thing() struct{ val int } {
+- return b.thing
+-}
+-
+-type baz struct {
+- thing struct{ val int }
+-}
+-
+-func (b baz) _() {
+- b.Thing().val //@item(deepBazMethVal, "b.Thing().val", "int", "field")
+- b.thing.val //@item(deepBazFieldVal, "b.thing.val", "int", "field")
+- var _ int = bval //@rank(" //", deepBazFieldVal, deepBazMethVal)
+-}
+diff -urN a/gopls/internal/lsp/testdata/errors/errors.go b/gopls/internal/lsp/testdata/errors/errors.go
+--- a/gopls/internal/lsp/testdata/errors/errors.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/errors/errors.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-package errors
+-
+-import (
+- "golang.org/lsptests/types"
+-)
+-
+-func _() {
+- bob.Bob() //@complete(".")
+- types.b //@complete(" //", Bob_interface)
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_args_returns.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_args_returns.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_args_returns.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_args_returns.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-package extract
+-
+-func _() {
+- a := 1
+- a = 5 //@mark(exSt0, "a")
+- a = a + 2 //@mark(exEn0, "2")
+- //@extractfunc(exSt0, exEn0)
+- b := a * 2 //@mark(exB, " b")
+- _ = 3 + 4 //@mark(exEnd, "4")
+- //@extractfunc(exB, exEnd)
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_args_returns.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_args_returns.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_args_returns.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_args_returns.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,37 +0,0 @@
+--- functionextraction_extract_args_returns_5_2 --
+-package extract
+-
+-func _() {
+- a := 1
+- //@mark(exSt0, "a")
+- a = newFunction(a) //@mark(exEn0, "2")
+- //@extractfunc(exSt0, exEn0)
+- b := a * 2 //@mark(exB, " b")
+- _ = 3 + 4 //@mark(exEnd, "4")
+- //@extractfunc(exB, exEnd)
+-}
+-
+-func newFunction(a int) int {
+- a = 5
+- a = a + 2
+- return a
+-}
+-
+--- functionextraction_extract_args_returns_8_1 --
+-package extract
+-
+-func _() {
+- a := 1
+- a = 5 //@mark(exSt0, "a")
+- a = a + 2 //@mark(exEn0, "2")
+- //@extractfunc(exSt0, exEn0)
+- //@mark(exB, " b")
+- newFunction(a) //@mark(exEnd, "4")
+- //@extractfunc(exB, exEnd)
+-}
+-
+-func newFunction(a int) {
+- b := a * 2
+- _ = 3 + 4
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_basic_comment.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_basic_comment.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_basic_comment.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_basic_comment.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+-package extract
+-
+-func _() {
+- a := /* comment in the middle of a line */ 1 //@mark(exSt18, "a")
+- // Comment on its own line //@mark(exSt19, "Comment")
+- _ = 3 + 4 //@mark(exEn18, "4"),mark(exEn19, "4"),mark(exSt20, "_")
+- // Comment right after 3 + 4
+-
+- // Comment after with space //@mark(exEn20, "Comment")
+-
+- //@extractfunc(exSt18, exEn18),extractfunc(exSt19, exEn19),extractfunc(exSt20, exEn20)
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_basic_comment.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_basic_comment.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_basic_comment.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_basic_comment.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,57 +0,0 @@
+--- functionextraction_extract_basic_comment_4_2 --
+-package extract
+-
+-func _() {
+- /* comment in the middle of a line */
+- //@mark(exSt18, "a")
+- // Comment on its own line //@mark(exSt19, "Comment")
+- newFunction() //@mark(exEn18, "4"),mark(exEn19, "4"),mark(exSt20, "_")
+- // Comment right after 3 + 4
+-
+- // Comment after with space //@mark(exEn20, "Comment")
+-
+- //@extractfunc(exSt18, exEn18),extractfunc(exSt19, exEn19),extractfunc(exSt20, exEn20)
+-}
+-
+-func newFunction() {
+- a := 1
+-
+- _ = 3 + 4
+-}
+-
+--- functionextraction_extract_basic_comment_5_5 --
+-package extract
+-
+-func _() {
+- a := /* comment in the middle of a line */ 1 //@mark(exSt18, "a")
+- // Comment on its own line //@mark(exSt19, "Comment")
+- newFunction() //@mark(exEn18, "4"),mark(exEn19, "4"),mark(exSt20, "_")
+- // Comment right after 3 + 4
+-
+- // Comment after with space //@mark(exEn20, "Comment")
+-
+- //@extractfunc(exSt18, exEn18),extractfunc(exSt19, exEn19),extractfunc(exSt20, exEn20)
+-}
+-
+-func newFunction() {
+- _ = 3 + 4
+-}
+-
+--- functionextraction_extract_basic_comment_6_2 --
+-package extract
+-
+-func _() {
+- a := /* comment in the middle of a line */ 1 //@mark(exSt18, "a")
+- // Comment on its own line //@mark(exSt19, "Comment")
+- newFunction() //@mark(exEn18, "4"),mark(exEn19, "4"),mark(exSt20, "_")
+- // Comment right after 3 + 4
+-
+- // Comment after with space //@mark(exEn20, "Comment")
+-
+- //@extractfunc(exSt18, exEn18),extractfunc(exSt19, exEn19),extractfunc(exSt20, exEn20)
+-}
+-
+-func newFunction() {
+- _ = 3 + 4
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_basic.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_basic.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_basic.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_basic.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-package extract
+-
+-func _() { //@mark(exSt25, "{")
+- a := 1 //@mark(exSt1, "a")
+- _ = 3 + 4 //@mark(exEn1, "4")
+- //@extractfunc(exSt1, exEn1)
+- //@extractfunc(exSt25, exEn25)
+-} //@mark(exEn25, "}")
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_basic.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_basic.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_basic.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_basic.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,30 +0,0 @@
+--- functionextraction_extract_basic_3_10 --
+-package extract
+-
+-func _() { //@mark(exSt25, "{")
+- //@mark(exSt1, "a")
+- newFunction() //@mark(exEn1, "4")
+- //@extractfunc(exSt1, exEn1)
+- //@extractfunc(exSt25, exEn25)
+-}
+-
+-func newFunction() {
+- a := 1
+- _ = 3 + 4
+-} //@mark(exEn25, "}")
+-
+--- functionextraction_extract_basic_4_2 --
+-package extract
+-
+-func _() { //@mark(exSt25, "{")
+- //@mark(exSt1, "a")
+- newFunction() //@mark(exEn1, "4")
+- //@extractfunc(exSt1, exEn1)
+- //@extractfunc(exSt25, exEn25)
+-}
+-
+-func newFunction() {
+- a := 1
+- _ = 3 + 4
+-} //@mark(exEn25, "}")
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_issue_44813.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_issue_44813.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_issue_44813.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_issue_44813.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-package extract
+-
+-import "fmt"
+-
+-func main() {
+- x := []rune{} //@mark(exSt9, "x")
+- s := "HELLO"
+- for _, c := range s {
+- x = append(x, c)
+- } //@mark(exEn9, "}")
+- //@extractfunc(exSt9, exEn9)
+- fmt.Printf("%x\n", x)
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_issue_44813.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_issue_44813.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_issue_44813.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_issue_44813.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,21 +0,0 @@
+--- functionextraction_extract_issue_44813_6_2 --
+-package extract
+-
+-import "fmt"
+-
+-func main() {
+- //@mark(exSt9, "x")
+- x := newFunction() //@mark(exEn9, "}")
+- //@extractfunc(exSt9, exEn9)
+- fmt.Printf("%x\n", x)
+-}
+-
+-func newFunction() []rune {
+- x := []rune{}
+- s := "HELLO"
+- for _, c := range s {
+- x = append(x, c)
+- }
+- return x
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_redefine.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_redefine.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_redefine.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_redefine.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-package extract
+-
+-import "strconv"
+-
+-func _() {
+- i, err := strconv.Atoi("1")
+- u, err := strconv.Atoi("2") //@extractfunc("u", ")")
+- if i == u || err == nil {
+- return
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_redefine.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_redefine.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_redefine.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_redefine.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+--- functionextraction_extract_redefine_7_2 --
+-package extract
+-
+-import "strconv"
+-
+-func _() {
+- i, err := strconv.Atoi("1")
+- u, err := newFunction() //@extractfunc("u", ")")
+- if i == u || err == nil {
+- return
+- }
+-}
+-
+-func newFunction() (int, error) {
+- u, err := strconv.Atoi("2")
+- return u, err
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-package extract
+-
+-func _() bool {
+- x := 1
+- if x == 0 { //@mark(exSt2, "if")
+- return true
+- } //@mark(exEn2, "}")
+- return false
+- //@extractfunc(exSt2, exEn2)
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,21 +0,0 @@
+--- functionextraction_extract_return_basic_5_2 --
+-package extract
+-
+-func _() bool {
+- x := 1
+- //@mark(exSt2, "if")
+- shouldReturn, returnValue := newFunction(x)
+- if shouldReturn {
+- return returnValue
+- } //@mark(exEn2, "}")
+- return false
+- //@extractfunc(exSt2, exEn2)
+-}
+-
+-func newFunction(x int) (bool, bool) {
+- if x == 0 {
+- return true, true
+- }
+- return false, false
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic_nonnested.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic_nonnested.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic_nonnested.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic_nonnested.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-package extract
+-
+-func _() bool {
+- x := 1 //@mark(exSt13, "x")
+- if x == 0 {
+- return true
+- }
+- return false //@mark(exEn13, "false")
+- //@extractfunc(exSt13, exEn13)
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic_nonnested.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic_nonnested.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic_nonnested.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_basic_nonnested.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,17 +0,0 @@
+--- functionextraction_extract_return_basic_nonnested_4_2 --
+-package extract
+-
+-func _() bool {
+- //@mark(exSt13, "x")
+- return newFunction() //@mark(exEn13, "false")
+- //@extractfunc(exSt13, exEn13)
+-}
+-
+-func newFunction() bool {
+- x := 1
+- if x == 0 {
+- return true
+- }
+- return false
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,17 +0,0 @@
+-package extract
+-
+-import "fmt"
+-
+-func _() (int, string, error) {
+- x := 1
+- y := "hello"
+- z := "bye" //@mark(exSt3, "z")
+- if y == z {
+- return x, y, fmt.Errorf("same")
+- } else {
+- z = "hi"
+- return x, z, nil
+- } //@mark(exEn3, "}")
+- return x, z, nil
+- //@extractfunc(exSt3, exEn3)
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,28 +0,0 @@
+--- functionextraction_extract_return_complex_8_2 --
+-package extract
+-
+-import "fmt"
+-
+-func _() (int, string, error) {
+- x := 1
+- y := "hello"
+- //@mark(exSt3, "z")
+- z, shouldReturn, returnValue, returnValue1, returnValue2 := newFunction(y, x)
+- if shouldReturn {
+- return returnValue, returnValue1, returnValue2
+- } //@mark(exEn3, "}")
+- return x, z, nil
+- //@extractfunc(exSt3, exEn3)
+-}
+-
+-func newFunction(y string, x int) (string, bool, int, string, error) {
+- z := "bye"
+- if y == z {
+- return "", true, x, y, fmt.Errorf("same")
+- } else {
+- z = "hi"
+- return "", true, x, z, nil
+- }
+- return z, false, 0, "", nil
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex_nonnested.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex_nonnested.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex_nonnested.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex_nonnested.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,17 +0,0 @@
+-package extract
+-
+-import "fmt"
+-
+-func _() (int, string, error) {
+- x := 1
+- y := "hello"
+- z := "bye" //@mark(exSt10, "z")
+- if y == z {
+- return x, y, fmt.Errorf("same")
+- } else {
+- z = "hi"
+- return x, z, nil
+- }
+- return x, z, nil //@mark(exEn10, "nil")
+- //@extractfunc(exSt10, exEn10)
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex_nonnested.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex_nonnested.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex_nonnested.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_complex_nonnested.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+--- functionextraction_extract_return_complex_nonnested_8_2 --
+-package extract
+-
+-import "fmt"
+-
+-func _() (int, string, error) {
+- x := 1
+- y := "hello"
+- //@mark(exSt10, "z")
+- return newFunction(y, x) //@mark(exEn10, "nil")
+- //@extractfunc(exSt10, exEn10)
+-}
+-
+-func newFunction(y string, x int) (int, string, error) {
+- z := "bye"
+- if y == z {
+- return x, y, fmt.Errorf("same")
+- } else {
+- z = "hi"
+- return x, z, nil
+- }
+- return x, z, nil
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-package extract
+-
+-import "go/ast"
+-
+-func _() {
+- ast.Inspect(ast.NewIdent("a"), func(n ast.Node) bool {
+- if n == nil { //@mark(exSt4, "if")
+- return true
+- } //@mark(exEn4, "}")
+- return false
+- })
+- //@extractfunc(exSt4, exEn4)
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+--- functionextraction_extract_return_func_lit_7_3 --
+-package extract
+-
+-import "go/ast"
+-
+-func _() {
+- ast.Inspect(ast.NewIdent("a"), func(n ast.Node) bool {
+- //@mark(exSt4, "if")
+- shouldReturn, returnValue := newFunction(n)
+- if shouldReturn {
+- return returnValue
+- } //@mark(exEn4, "}")
+- return false
+- })
+- //@extractfunc(exSt4, exEn4)
+-}
+-
+-func newFunction(n ast.Node) (bool, bool) {
+- if n == nil {
+- return true, true
+- }
+- return false, false
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit_nonnested.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit_nonnested.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit_nonnested.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit_nonnested.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-package extract
+-
+-import "go/ast"
+-
+-func _() {
+- ast.Inspect(ast.NewIdent("a"), func(n ast.Node) bool {
+- if n == nil { //@mark(exSt11, "if")
+- return true
+- }
+- return false //@mark(exEn11, "false")
+- })
+- //@extractfunc(exSt11, exEn11)
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit_nonnested.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit_nonnested.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit_nonnested.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_func_lit_nonnested.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,20 +0,0 @@
+--- functionextraction_extract_return_func_lit_nonnested_7_3 --
+-package extract
+-
+-import "go/ast"
+-
+-func _() {
+- ast.Inspect(ast.NewIdent("a"), func(n ast.Node) bool {
+- //@mark(exSt11, "if")
+- return newFunction(n) //@mark(exEn11, "false")
+- })
+- //@extractfunc(exSt11, exEn11)
+-}
+-
+-func newFunction(n ast.Node) bool {
+- if n == nil {
+- return true
+- }
+- return false
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+-package extract
+-
+-func _() string {
+- x := 1
+- if x == 0 { //@mark(exSt5, "if")
+- x = 3
+- return "a"
+- } //@mark(exEn5, "}")
+- x = 2
+- return "b"
+- //@extractfunc(exSt5, exEn5)
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,23 +0,0 @@
+--- functionextraction_extract_return_init_5_2 --
+-package extract
+-
+-func _() string {
+- x := 1
+- //@mark(exSt5, "if")
+- shouldReturn, returnValue := newFunction(x)
+- if shouldReturn {
+- return returnValue
+- } //@mark(exEn5, "}")
+- x = 2
+- return "b"
+- //@extractfunc(exSt5, exEn5)
+-}
+-
+-func newFunction(x int) (bool, string) {
+- if x == 0 {
+- x = 3
+- return true, "a"
+- }
+- return false, ""
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init_nonnested.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init_nonnested.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init_nonnested.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init_nonnested.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+-package extract
+-
+-func _() string {
+- x := 1
+- if x == 0 { //@mark(exSt12, "if")
+- x = 3
+- return "a"
+- }
+- x = 2
+- return "b" //@mark(exEn12, "\"b\"")
+- //@extractfunc(exSt12, exEn12)
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init_nonnested.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init_nonnested.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init_nonnested.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_return_init_nonnested.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,19 +0,0 @@
+--- functionextraction_extract_return_init_nonnested_5_2 --
+-package extract
+-
+-func _() string {
+- x := 1
+- //@mark(exSt12, "if")
+- return newFunction(x) //@mark(exEn12, "\"b\"")
+- //@extractfunc(exSt12, exEn12)
+-}
+-
+-func newFunction(x int) string {
+- if x == 0 {
+- x = 3
+- return "a"
+- }
+- x = 2
+- return "b"
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_scope.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_scope.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_scope.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_scope.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-package extract
+-
+-func _() {
+- newFunction := 1
+- a := newFunction //@extractfunc("a", "newFunction")
+-}
+-
+-func newFunction1() int {
+- return 1
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_scope.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_scope.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_scope.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_scope.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+--- functionextraction_extract_scope_5_2 --
+-package extract
+-
+-func _() {
+- newFunction := 1
+- newFunction2(newFunction) //@extractfunc("a", "newFunction")
+-}
+-
+-func newFunction2(newFunction int) {
+- a := newFunction
+-}
+-
+-func newFunction1() int {
+- return 1
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_initialization.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_initialization.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_initialization.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_initialization.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package extract
+-
+-func _() {
+- var a []int
+- a = append(a, 2) //@mark(exSt6, "a")
+- b := 4 //@mark(exEn6, "4")
+- //@extractfunc(exSt6, exEn6)
+- a = append(a, b)
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_initialization.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_initialization.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_initialization.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_initialization.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,17 +0,0 @@
+--- functionextraction_extract_smart_initialization_5_2 --
+-package extract
+-
+-func _() {
+- var a []int
+- //@mark(exSt6, "a")
+- a, b := newFunction(a) //@mark(exEn6, "4")
+- //@extractfunc(exSt6, exEn6)
+- a = append(a, b)
+-}
+-
+-func newFunction(a []int) ([]int, int) {
+- a = append(a, 2)
+- b := 4
+- return a, b
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_return.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_return.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_return.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_return.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-package extract
+-
+-func _() {
+- var b []int
+- var a int
+- a = 2 //@mark(exSt7, "a")
+- b = []int{}
+- b = append(b, a) //@mark(exEn7, ")")
+- b[0] = 1
+- //@extractfunc(exSt7, exEn7)
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_return.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_return.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_return.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_smart_return.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,19 +0,0 @@
+--- functionextraction_extract_smart_return_6_2 --
+-package extract
+-
+-func _() {
+- var b []int
+- var a int
+- //@mark(exSt7, "a")
+- b = newFunction(a, b) //@mark(exEn7, ")")
+- b[0] = 1
+- //@extractfunc(exSt7, exEn7)
+-}
+-
+-func newFunction(a int, b []int) []int {
+- a = 2
+- b = []int{}
+- b = append(b, a)
+- return b
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_unnecessary_param.go b/gopls/internal/lsp/testdata/extract/extract_function/extract_unnecessary_param.go
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_unnecessary_param.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_unnecessary_param.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+-package extract
+-
+-func _() {
+- var b []int
+- var a int
+- a := 2 //@mark(exSt8, "a")
+- b = []int{}
+- b = append(b, a) //@mark(exEn8, ")")
+- b[0] = 1
+- if a == 2 {
+- return
+- }
+- //@extractfunc(exSt8, exEn8)
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_function/extract_unnecessary_param.go.golden b/gopls/internal/lsp/testdata/extract/extract_function/extract_unnecessary_param.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_function/extract_unnecessary_param.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_function/extract_unnecessary_param.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,22 +0,0 @@
+--- functionextraction_extract_unnecessary_param_6_2 --
+-package extract
+-
+-func _() {
+- var b []int
+- var a int
+- //@mark(exSt8, "a")
+- a, b = newFunction(b) //@mark(exEn8, ")")
+- b[0] = 1
+- if a == 2 {
+- return
+- }
+- //@extractfunc(exSt8, exEn8)
+-}
+-
+-func newFunction(b []int) (int, []int) {
+- a := 2
+- b = []int{}
+- b = append(b, a)
+- return a, b
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_method/extract_basic.go b/gopls/internal/lsp/testdata/extract/extract_method/extract_basic.go
+--- a/gopls/internal/lsp/testdata/extract/extract_method/extract_basic.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_method/extract_basic.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+-package extract
+-
+-type A struct {
+- x int
+- y int
+-}
+-
+-func (a *A) XLessThanYP() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a *A) AddP() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func (a A) XLessThanY() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a A) Add() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_method/extract_basic.go.golden b/gopls/internal/lsp/testdata/extract/extract_method/extract_basic.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_method/extract_basic.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_method/extract_basic.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,364 +0,0 @@
+--- functionextraction_extract_basic_13_2 --
+-package extract
+-
+-type A struct {
+- x int
+- y int
+-}
+-
+-func (a *A) XLessThanYP() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a *A) AddP() int {
+- sum := newFunction(a) //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func newFunction(a *A) int {
+- sum := a.x + a.y
+- return sum
+-}
+-
+-func (a A) XLessThanY() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a A) Add() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+--- functionextraction_extract_basic_14_2 --
+-package extract
+-
+-type A struct {
+- x int
+- y int
+-}
+-
+-func (a *A) XLessThanYP() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a *A) AddP() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return newFunction(sum) //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func newFunction(sum int) int {
+- return sum
+-}
+-
+-func (a A) XLessThanY() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a A) Add() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+--- functionextraction_extract_basic_18_2 --
+-package extract
+-
+-type A struct {
+- x int
+- y int
+-}
+-
+-func (a *A) XLessThanYP() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a *A) AddP() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func (a A) XLessThanY() bool {
+- return newFunction(a) //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func newFunction(a A) bool {
+- return a.x < a.y
+-}
+-
+-func (a A) Add() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+--- functionextraction_extract_basic_22_2 --
+-package extract
+-
+-type A struct {
+- x int
+- y int
+-}
+-
+-func (a *A) XLessThanYP() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a *A) AddP() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func (a A) XLessThanY() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a A) Add() int {
+- sum := newFunction(a) //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func newFunction(a A) int {
+- sum := a.x + a.y
+- return sum
+-}
+-
+--- functionextraction_extract_basic_23_2 --
+-package extract
+-
+-type A struct {
+- x int
+- y int
+-}
+-
+-func (a *A) XLessThanYP() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a *A) AddP() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func (a A) XLessThanY() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a A) Add() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return newFunction(sum) //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func newFunction(sum int) int {
+- return sum
+-}
+-
+--- functionextraction_extract_basic_9_2 --
+-package extract
+-
+-type A struct {
+- x int
+- y int
+-}
+-
+-func (a *A) XLessThanYP() bool {
+- return newFunction(a) //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func newFunction(a *A) bool {
+- return a.x < a.y
+-}
+-
+-func (a *A) AddP() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func (a A) XLessThanY() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a A) Add() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+--- methodextraction_extract_basic_13_2 --
+-package extract
+-
+-type A struct {
+- x int
+- y int
+-}
+-
+-func (a *A) XLessThanYP() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a *A) AddP() int {
+- sum := a.newMethod() //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func (a *A) newMethod() int {
+- sum := a.x + a.y
+- return sum
+-}
+-
+-func (a A) XLessThanY() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a A) Add() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+--- methodextraction_extract_basic_14_2 --
+-package extract
+-
+-type A struct {
+- x int
+- y int
+-}
+-
+-func (a *A) XLessThanYP() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a *A) AddP() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return a.newMethod(sum) //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func (*A) newMethod(sum int) int {
+- return sum
+-}
+-
+-func (a A) XLessThanY() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a A) Add() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+--- methodextraction_extract_basic_18_2 --
+-package extract
+-
+-type A struct {
+- x int
+- y int
+-}
+-
+-func (a *A) XLessThanYP() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a *A) AddP() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func (a A) XLessThanY() bool {
+- return a.newMethod() //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a A) newMethod() bool {
+- return a.x < a.y
+-}
+-
+-func (a A) Add() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+--- methodextraction_extract_basic_22_2 --
+-package extract
+-
+-type A struct {
+- x int
+- y int
+-}
+-
+-func (a *A) XLessThanYP() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a *A) AddP() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func (a A) XLessThanY() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a A) Add() int {
+- sum := a.newMethod() //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func (a A) newMethod() int {
+- sum := a.x + a.y
+- return sum
+-}
+-
+--- methodextraction_extract_basic_23_2 --
+-package extract
+-
+-type A struct {
+- x int
+- y int
+-}
+-
+-func (a *A) XLessThanYP() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a *A) AddP() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func (a A) XLessThanY() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a A) Add() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return a.newMethod(sum) //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func (A) newMethod(sum int) int {
+- return sum
+-}
+-
+--- methodextraction_extract_basic_9_2 --
+-package extract
+-
+-type A struct {
+- x int
+- y int
+-}
+-
+-func (a *A) XLessThanYP() bool {
+- return a.newMethod() //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a *A) newMethod() bool {
+- return a.x < a.y
+-}
+-
+-func (a *A) AddP() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+-func (a A) XLessThanY() bool {
+- return a.x < a.y //@extractmethod("return", "a.y"),extractfunc("return", "a.y")
+-}
+-
+-func (a A) Add() int {
+- sum := a.x + a.y //@extractmethod("sum", "a.y"),extractfunc("sum", "a.y")
+- return sum //@extractmethod("return", "sum"),extractfunc("return", "sum")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_variable/extract_basic_lit.go b/gopls/internal/lsp/testdata/extract/extract_variable/extract_basic_lit.go
+--- a/gopls/internal/lsp/testdata/extract/extract_variable/extract_basic_lit.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_variable/extract_basic_lit.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-package extract
+-
+-func _() {
+- var _ = 1 + 2 //@suggestedfix("1", "refactor.extract", "")
+- var _ = 3 + 4 //@suggestedfix("3 + 4", "refactor.extract", "")
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_variable/extract_basic_lit.go.golden b/gopls/internal/lsp/testdata/extract/extract_variable/extract_basic_lit.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_variable/extract_basic_lit.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_variable/extract_basic_lit.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+--- suggestedfix_extract_basic_lit_4_10 --
+-package extract
+-
+-func _() {
+- x := 1
+- var _ = x + 2 //@suggestedfix("1", "refactor.extract", "")
+- var _ = 3 + 4 //@suggestedfix("3 + 4", "refactor.extract", "")
+-}
+-
+--- suggestedfix_extract_basic_lit_5_10 --
+-package extract
+-
+-func _() {
+- var _ = 1 + 2 //@suggestedfix("1", "refactor.extract", "")
+- x := 3 + 4
+- var _ = x //@suggestedfix("3 + 4", "refactor.extract", "")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_variable/extract_func_call.go b/gopls/internal/lsp/testdata/extract/extract_variable/extract_func_call.go
+--- a/gopls/internal/lsp/testdata/extract/extract_variable/extract_func_call.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_variable/extract_func_call.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package extract
+-
+-import "strconv"
+-
+-func _() {
+- x0 := append([]int{}, 1) //@suggestedfix("append([]int{}, 1)", "refactor.extract", "")
+- str := "1"
+- b, err := strconv.Atoi(str) //@suggestedfix("strconv.Atoi(str)", "refactor.extract", "")
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_variable/extract_func_call.go.golden b/gopls/internal/lsp/testdata/extract/extract_variable/extract_func_call.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_variable/extract_func_call.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_variable/extract_func_call.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+--- suggestedfix_extract_func_call_6_8 --
+-package extract
+-
+-import "strconv"
+-
+-func _() {
+- x := append([]int{}, 1)
+- x0 := x //@suggestedfix("append([]int{}, 1)", "refactor.extract", "")
+- str := "1"
+- b, err := strconv.Atoi(str) //@suggestedfix("strconv.Atoi(str)", "refactor.extract", "")
+-}
+-
+--- suggestedfix_extract_func_call_8_12 --
+-package extract
+-
+-import "strconv"
+-
+-func _() {
+- x0 := append([]int{}, 1) //@suggestedfix("append([]int{}, 1)", "refactor.extract", "")
+- str := "1"
+- x, x1 := strconv.Atoi(str)
+- b, err := x, x1 //@suggestedfix("strconv.Atoi(str)", "refactor.extract", "")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_variable/extract_scope.go b/gopls/internal/lsp/testdata/extract/extract_variable/extract_scope.go
+--- a/gopls/internal/lsp/testdata/extract/extract_variable/extract_scope.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_variable/extract_scope.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-package extract
+-
+-import "go/ast"
+-
+-func _() {
+- x0 := 0
+- if true {
+- y := ast.CompositeLit{} //@suggestedfix("ast.CompositeLit{}", "refactor.extract", "")
+- }
+- if true {
+- x1 := !false //@suggestedfix("!false", "refactor.extract", "")
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/extract/extract_variable/extract_scope.go.golden b/gopls/internal/lsp/testdata/extract/extract_variable/extract_scope.go.golden
+--- a/gopls/internal/lsp/testdata/extract/extract_variable/extract_scope.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/extract/extract_variable/extract_scope.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,32 +0,0 @@
+--- suggestedfix_extract_scope_11_9 --
+-package extract
+-
+-import "go/ast"
+-
+-func _() {
+- x0 := 0
+- if true {
+- y := ast.CompositeLit{} //@suggestedfix("ast.CompositeLit{}", "refactor.extract", "")
+- }
+- if true {
+- x := !false
+- x1 := x //@suggestedfix("!false", "refactor.extract", "")
+- }
+-}
+-
+--- suggestedfix_extract_scope_8_8 --
+-package extract
+-
+-import "go/ast"
+-
+-func _() {
+- x0 := 0
+- if true {
+- x := ast.CompositeLit{}
+- y := x //@suggestedfix("ast.CompositeLit{}", "refactor.extract", "")
+- }
+- if true {
+- x1 := !false //@suggestedfix("!false", "refactor.extract", "")
+- }
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/fieldlist/field_list.go b/gopls/internal/lsp/testdata/fieldlist/field_list.go
+--- a/gopls/internal/lsp/testdata/fieldlist/field_list.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fieldlist/field_list.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,27 +0,0 @@
+-package fieldlist
+-
+-var myInt int //@item(flVar, "myInt", "int", "var")
+-type myType int //@item(flType, "myType", "int", "type")
+-
+-func (my) _() {} //@complete(") _", flType)
+-func (my my) _() {} //@complete(" my)"),complete(") _", flType)
+-
+-func (myType) _() {} //@complete(") {", flType)
+-
+-func (myType) _(my my) {} //@complete(" my)"),complete(") {", flType)
+-
+-func (myType) _() my {} //@complete(" {", flType)
+-
+-func (myType) _() (my my) {} //@complete(" my"),complete(") {", flType)
+-
+-func _() {
+- var _ struct {
+- //@complete("", flType)
+- m my //@complete(" my"),complete(" //", flType)
+- }
+-
+- var _ interface {
+- //@complete("", flType)
+- m() my //@complete("("),complete(" //", flType)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/a2.go b/gopls/internal/lsp/testdata/fillstruct/a2.go
+--- a/gopls/internal/lsp/testdata/fillstruct/a2.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/a2.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,29 +0,0 @@
+-package fillstruct
+-
+-type typedStruct struct {
+- m map[string]int
+- s []int
+- c chan int
+- c1 <-chan int
+- a [2]string
+-}
+-
+-var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type funStruct struct {
+- fn func(i int) int
+-}
+-
+-var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type funStructCompex struct {
+- fn func(i int, s string) (string, int)
+-}
+-
+-var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type funStructEmpty struct {
+- fn func()
+-}
+-
+-var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/a2.go.golden b/gopls/internal/lsp/testdata/fillstruct/a2.go.golden
+--- a/gopls/internal/lsp/testdata/fillstruct/a2.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/a2.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,139 +0,0 @@
+--- suggestedfix_a2_11_21 --
+-package fillstruct
+-
+-type typedStruct struct {
+- m map[string]int
+- s []int
+- c chan int
+- c1 <-chan int
+- a [2]string
+-}
+-
+-var _ = typedStruct{
+- m: map[string]int{},
+- s: []int{},
+- c: make(chan int),
+- c1: make(<-chan int),
+- a: [2]string{},
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type funStruct struct {
+- fn func(i int) int
+-}
+-
+-var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type funStructCompex struct {
+- fn func(i int, s string) (string, int)
+-}
+-
+-var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type funStructEmpty struct {
+- fn func()
+-}
+-
+-var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+--- suggestedfix_a2_17_19 --
+-package fillstruct
+-
+-type typedStruct struct {
+- m map[string]int
+- s []int
+- c chan int
+- c1 <-chan int
+- a [2]string
+-}
+-
+-var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type funStruct struct {
+- fn func(i int) int
+-}
+-
+-var _ = funStruct{
+- fn: func(i int) int {
+- },
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type funStructCompex struct {
+- fn func(i int, s string) (string, int)
+-}
+-
+-var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type funStructEmpty struct {
+- fn func()
+-}
+-
+-var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+--- suggestedfix_a2_23_25 --
+-package fillstruct
+-
+-type typedStruct struct {
+- m map[string]int
+- s []int
+- c chan int
+- c1 <-chan int
+- a [2]string
+-}
+-
+-var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type funStruct struct {
+- fn func(i int) int
+-}
+-
+-var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type funStructCompex struct {
+- fn func(i int, s string) (string, int)
+-}
+-
+-var _ = funStructCompex{
+- fn: func(i int, s string) (string, int) {
+- },
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type funStructEmpty struct {
+- fn func()
+-}
+-
+-var _ = funStructEmpty{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+--- suggestedfix_a2_29_24 --
+-package fillstruct
+-
+-type typedStruct struct {
+- m map[string]int
+- s []int
+- c chan int
+- c1 <-chan int
+- a [2]string
+-}
+-
+-var _ = typedStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type funStruct struct {
+- fn func(i int) int
+-}
+-
+-var _ = funStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type funStructCompex struct {
+- fn func(i int, s string) (string, int)
+-}
+-
+-var _ = funStructCompex{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type funStructEmpty struct {
+- fn func()
+-}
+-
+-var _ = funStructEmpty{
+- fn: func() {
+- },
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/a3.go b/gopls/internal/lsp/testdata/fillstruct/a3.go
+--- a/gopls/internal/lsp/testdata/fillstruct/a3.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/a3.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,42 +0,0 @@
+-package fillstruct
+-
+-import (
+- "go/ast"
+- "go/token"
+-)
+-
+-type Foo struct {
+- A int
+-}
+-
+-type Bar struct {
+- X *Foo
+- Y *Foo
+-}
+-
+-var _ = Bar{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type importedStruct struct {
+- m map[*ast.CompositeLit]ast.Field
+- s []ast.BadExpr
+- a [3]token.Token
+- c chan ast.EmptyStmt
+- fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+- st ast.CompositeLit
+-}
+-
+-var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type pointerBuiltinStruct struct {
+- b *bool
+- s *string
+- i *int
+-}
+-
+-var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = []ast.BasicLit{
+- {}, //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+-var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite", "Fill")
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/a3.go.golden b/gopls/internal/lsp/testdata/fillstruct/a3.go.golden
+--- a/gopls/internal/lsp/testdata/fillstruct/a3.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/a3.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,243 +0,0 @@
+--- suggestedfix_a3_17_13 --
+-package fillstruct
+-
+-import (
+- "go/ast"
+- "go/token"
+-)
+-
+-type Foo struct {
+- A int
+-}
+-
+-type Bar struct {
+- X *Foo
+- Y *Foo
+-}
+-
+-var _ = Bar{
+- X: &Foo{},
+- Y: &Foo{},
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type importedStruct struct {
+- m map[*ast.CompositeLit]ast.Field
+- s []ast.BadExpr
+- a [3]token.Token
+- c chan ast.EmptyStmt
+- fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+- st ast.CompositeLit
+-}
+-
+-var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type pointerBuiltinStruct struct {
+- b *bool
+- s *string
+- i *int
+-}
+-
+-var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = []ast.BasicLit{
+- {}, //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+-var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+--- suggestedfix_a3_28_24 --
+-package fillstruct
+-
+-import (
+- "go/ast"
+- "go/token"
+-)
+-
+-type Foo struct {
+- A int
+-}
+-
+-type Bar struct {
+- X *Foo
+- Y *Foo
+-}
+-
+-var _ = Bar{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type importedStruct struct {
+- m map[*ast.CompositeLit]ast.Field
+- s []ast.BadExpr
+- a [3]token.Token
+- c chan ast.EmptyStmt
+- fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+- st ast.CompositeLit
+-}
+-
+-var _ = importedStruct{
+- m: map[*ast.CompositeLit]ast.Field{},
+- s: []ast.BadExpr{},
+- a: [3]token.Token{},
+- c: make(chan ast.EmptyStmt),
+- fn: func(ast_decl ast.DeclStmt) ast.Ellipsis {
+- },
+- st: ast.CompositeLit{},
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type pointerBuiltinStruct struct {
+- b *bool
+- s *string
+- i *int
+-}
+-
+-var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = []ast.BasicLit{
+- {}, //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+-var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+--- suggestedfix_a3_36_30 --
+-package fillstruct
+-
+-import (
+- "go/ast"
+- "go/token"
+-)
+-
+-type Foo struct {
+- A int
+-}
+-
+-type Bar struct {
+- X *Foo
+- Y *Foo
+-}
+-
+-var _ = Bar{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type importedStruct struct {
+- m map[*ast.CompositeLit]ast.Field
+- s []ast.BadExpr
+- a [3]token.Token
+- c chan ast.EmptyStmt
+- fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+- st ast.CompositeLit
+-}
+-
+-var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type pointerBuiltinStruct struct {
+- b *bool
+- s *string
+- i *int
+-}
+-
+-var _ = pointerBuiltinStruct{
+- b: new(bool),
+- s: new(string),
+- i: new(int),
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = []ast.BasicLit{
+- {}, //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+-var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+--- suggestedfix_a3_39_3 --
+-package fillstruct
+-
+-import (
+- "go/ast"
+- "go/token"
+-)
+-
+-type Foo struct {
+- A int
+-}
+-
+-type Bar struct {
+- X *Foo
+- Y *Foo
+-}
+-
+-var _ = Bar{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type importedStruct struct {
+- m map[*ast.CompositeLit]ast.Field
+- s []ast.BadExpr
+- a [3]token.Token
+- c chan ast.EmptyStmt
+- fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+- st ast.CompositeLit
+-}
+-
+-var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type pointerBuiltinStruct struct {
+- b *bool
+- s *string
+- i *int
+-}
+-
+-var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = []ast.BasicLit{
+- {
+- ValuePos: 0,
+- Kind: 0,
+- Value: "",
+- }, //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+-var _ = []ast.BasicLit{{}} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+--- suggestedfix_a3_42_25 --
+-package fillstruct
+-
+-import (
+- "go/ast"
+- "go/token"
+-)
+-
+-type Foo struct {
+- A int
+-}
+-
+-type Bar struct {
+- X *Foo
+- Y *Foo
+-}
+-
+-var _ = Bar{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type importedStruct struct {
+- m map[*ast.CompositeLit]ast.Field
+- s []ast.BadExpr
+- a [3]token.Token
+- c chan ast.EmptyStmt
+- fn func(ast_decl ast.DeclStmt) ast.Ellipsis
+- st ast.CompositeLit
+-}
+-
+-var _ = importedStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type pointerBuiltinStruct struct {
+- b *bool
+- s *string
+- i *int
+-}
+-
+-var _ = pointerBuiltinStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = []ast.BasicLit{
+- {}, //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+-var _ = []ast.BasicLit{{
+- ValuePos: 0,
+- Kind: 0,
+- Value: "",
+-}} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/a4.go b/gopls/internal/lsp/testdata/fillstruct/a4.go
+--- a/gopls/internal/lsp/testdata/fillstruct/a4.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/a4.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,39 +0,0 @@
+-package fillstruct
+-
+-import "go/ast"
+-
+-type iStruct struct {
+- X int
+-}
+-
+-type sStruct struct {
+- str string
+-}
+-
+-type multiFill struct {
+- num int
+- strin string
+- arr []int
+-}
+-
+-type assignStruct struct {
+- n ast.Node
+-}
+-
+-func fill() {
+- var x int
+- var _ = iStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+- var s string
+- var _ = sStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+- var n int
+- _ = []int{}
+- if true {
+- arr := []int{1, 2}
+- }
+- var _ = multiFill{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+- var node *ast.CompositeLit
+- var _ = assignStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/a4.go.golden b/gopls/internal/lsp/testdata/fillstruct/a4.go.golden
+--- a/gopls/internal/lsp/testdata/fillstruct/a4.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/a4.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,174 +0,0 @@
+--- suggestedfix_a4_25_18 --
+-package fillstruct
+-
+-import "go/ast"
+-
+-type iStruct struct {
+- X int
+-}
+-
+-type sStruct struct {
+- str string
+-}
+-
+-type multiFill struct {
+- num int
+- strin string
+- arr []int
+-}
+-
+-type assignStruct struct {
+- n ast.Node
+-}
+-
+-func fill() {
+- var x int
+- var _ = iStruct{
+- X: x,
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+- var s string
+- var _ = sStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+- var n int
+- _ = []int{}
+- if true {
+- arr := []int{1, 2}
+- }
+- var _ = multiFill{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+- var node *ast.CompositeLit
+- var _ = assignStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+--- suggestedfix_a4_28_18 --
+-package fillstruct
+-
+-import "go/ast"
+-
+-type iStruct struct {
+- X int
+-}
+-
+-type sStruct struct {
+- str string
+-}
+-
+-type multiFill struct {
+- num int
+- strin string
+- arr []int
+-}
+-
+-type assignStruct struct {
+- n ast.Node
+-}
+-
+-func fill() {
+- var x int
+- var _ = iStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+- var s string
+- var _ = sStruct{
+- str: s,
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+- var n int
+- _ = []int{}
+- if true {
+- arr := []int{1, 2}
+- }
+- var _ = multiFill{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+- var node *ast.CompositeLit
+- var _ = assignStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+--- suggestedfix_a4_35_20 --
+-package fillstruct
+-
+-import "go/ast"
+-
+-type iStruct struct {
+- X int
+-}
+-
+-type sStruct struct {
+- str string
+-}
+-
+-type multiFill struct {
+- num int
+- strin string
+- arr []int
+-}
+-
+-type assignStruct struct {
+- n ast.Node
+-}
+-
+-func fill() {
+- var x int
+- var _ = iStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+- var s string
+- var _ = sStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+- var n int
+- _ = []int{}
+- if true {
+- arr := []int{1, 2}
+- }
+- var _ = multiFill{
+- num: n,
+- strin: s,
+- arr: []int{},
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+- var node *ast.CompositeLit
+- var _ = assignStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+--- suggestedfix_a4_38_23 --
+-package fillstruct
+-
+-import "go/ast"
+-
+-type iStruct struct {
+- X int
+-}
+-
+-type sStruct struct {
+- str string
+-}
+-
+-type multiFill struct {
+- num int
+- strin string
+- arr []int
+-}
+-
+-type assignStruct struct {
+- n ast.Node
+-}
+-
+-func fill() {
+- var x int
+- var _ = iStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+- var s string
+- var _ = sStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+- var n int
+- _ = []int{}
+- if true {
+- arr := []int{1, 2}
+- }
+- var _ = multiFill{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+- var node *ast.CompositeLit
+- var _ = assignStruct{
+- n: node,
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/a.go b/gopls/internal/lsp/testdata/fillstruct/a.go
+--- a/gopls/internal/lsp/testdata/fillstruct/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,27 +0,0 @@
+-package fillstruct
+-
+-import (
+- "golang.org/lsptests/fillstruct/data"
+-)
+-
+-type basicStruct struct {
+- foo int
+-}
+-
+-var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type twoArgStruct struct {
+- foo int
+- bar string
+-}
+-
+-var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type nestedStruct struct {
+- bar string
+- basic basicStruct
+-}
+-
+-var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = data.B{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/a.go.golden b/gopls/internal/lsp/testdata/fillstruct/a.go.golden
+--- a/gopls/internal/lsp/testdata/fillstruct/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,126 +0,0 @@
+--- suggestedfix_a_11_21 --
+-package fillstruct
+-
+-import (
+- "golang.org/lsptests/fillstruct/data"
+-)
+-
+-type basicStruct struct {
+- foo int
+-}
+-
+-var _ = basicStruct{
+- foo: 0,
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type twoArgStruct struct {
+- foo int
+- bar string
+-}
+-
+-var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type nestedStruct struct {
+- bar string
+- basic basicStruct
+-}
+-
+-var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = data.B{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+--- suggestedfix_a_18_22 --
+-package fillstruct
+-
+-import (
+- "golang.org/lsptests/fillstruct/data"
+-)
+-
+-type basicStruct struct {
+- foo int
+-}
+-
+-var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type twoArgStruct struct {
+- foo int
+- bar string
+-}
+-
+-var _ = twoArgStruct{
+- foo: 0,
+- bar: "",
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type nestedStruct struct {
+- bar string
+- basic basicStruct
+-}
+-
+-var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = data.B{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+--- suggestedfix_a_25_22 --
+-package fillstruct
+-
+-import (
+- "golang.org/lsptests/fillstruct/data"
+-)
+-
+-type basicStruct struct {
+- foo int
+-}
+-
+-var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type twoArgStruct struct {
+- foo int
+- bar string
+-}
+-
+-var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type nestedStruct struct {
+- bar string
+- basic basicStruct
+-}
+-
+-var _ = nestedStruct{
+- bar: "",
+- basic: basicStruct{},
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = data.B{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+--- suggestedfix_a_27_16 --
+-package fillstruct
+-
+-import (
+- "golang.org/lsptests/fillstruct/data"
+-)
+-
+-type basicStruct struct {
+- foo int
+-}
+-
+-var _ = basicStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type twoArgStruct struct {
+- foo int
+- bar string
+-}
+-
+-var _ = twoArgStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type nestedStruct struct {
+- bar string
+- basic basicStruct
+-}
+-
+-var _ = nestedStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = data.B{
+- ExportedInt: 0,
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/data/a.go b/gopls/internal/lsp/testdata/fillstruct/data/a.go
+--- a/gopls/internal/lsp/testdata/fillstruct/data/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/data/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-package data
+-
+-type B struct {
+- ExportedInt int
+- unexportedInt int
+-}
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/fill_struct_anon.go b/gopls/internal/lsp/testdata/fillstruct/fill_struct_anon.go
+--- a/gopls/internal/lsp/testdata/fillstruct/fill_struct_anon.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/fill_struct_anon.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+-package fillstruct
+-
+-type StructAnon struct {
+- a struct{}
+- b map[string]interface{}
+- c map[string]struct {
+- d int
+- e bool
+- }
+-}
+-
+-func fill() {
+- _ := StructAnon{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/fill_struct_anon.go.golden b/gopls/internal/lsp/testdata/fillstruct/fill_struct_anon.go.golden
+--- a/gopls/internal/lsp/testdata/fillstruct/fill_struct_anon.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/fill_struct_anon.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,20 +0,0 @@
+--- suggestedfix_fill_struct_anon_13_18 --
+-package fillstruct
+-
+-type StructAnon struct {
+- a struct{}
+- b map[string]interface{}
+- c map[string]struct {
+- d int
+- e bool
+- }
+-}
+-
+-func fill() {
+- _ := StructAnon{
+- a: struct{}{},
+- b: map[string]interface{}{},
+- c: map[string]struct{d int; e bool}{},
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/fill_struct.go b/gopls/internal/lsp/testdata/fillstruct/fill_struct.go
+--- a/gopls/internal/lsp/testdata/fillstruct/fill_struct.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/fill_struct.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,26 +0,0 @@
+-package fillstruct
+-
+-type StructA struct {
+- unexportedIntField int
+- ExportedIntField int
+- MapA map[int]string
+- Array []int
+- StructB
+-}
+-
+-type StructA2 struct {
+- B *StructB
+-}
+-
+-type StructA3 struct {
+- B StructB
+-}
+-
+-func fill() {
+- a := StructA{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- b := StructA2{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- c := StructA3{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- if true {
+- _ = StructA3{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/fill_struct.go.golden b/gopls/internal/lsp/testdata/fillstruct/fill_struct.go.golden
+--- a/gopls/internal/lsp/testdata/fillstruct/fill_struct.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/fill_struct.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,124 +0,0 @@
+--- suggestedfix_fill_struct_20_15 --
+-package fillstruct
+-
+-type StructA struct {
+- unexportedIntField int
+- ExportedIntField int
+- MapA map[int]string
+- Array []int
+- StructB
+-}
+-
+-type StructA2 struct {
+- B *StructB
+-}
+-
+-type StructA3 struct {
+- B StructB
+-}
+-
+-func fill() {
+- a := StructA{
+- unexportedIntField: 0,
+- ExportedIntField: 0,
+- MapA: map[int]string{},
+- Array: []int{},
+- StructB: StructB{},
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+- b := StructA2{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- c := StructA3{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- if true {
+- _ = StructA3{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- }
+-}
+-
+--- suggestedfix_fill_struct_21_16 --
+-package fillstruct
+-
+-type StructA struct {
+- unexportedIntField int
+- ExportedIntField int
+- MapA map[int]string
+- Array []int
+- StructB
+-}
+-
+-type StructA2 struct {
+- B *StructB
+-}
+-
+-type StructA3 struct {
+- B StructB
+-}
+-
+-func fill() {
+- a := StructA{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- b := StructA2{
+- B: &StructB{},
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+- c := StructA3{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- if true {
+- _ = StructA3{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- }
+-}
+-
+--- suggestedfix_fill_struct_22_16 --
+-package fillstruct
+-
+-type StructA struct {
+- unexportedIntField int
+- ExportedIntField int
+- MapA map[int]string
+- Array []int
+- StructB
+-}
+-
+-type StructA2 struct {
+- B *StructB
+-}
+-
+-type StructA3 struct {
+- B StructB
+-}
+-
+-func fill() {
+- a := StructA{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- b := StructA2{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- c := StructA3{
+- B: StructB{},
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+- if true {
+- _ = StructA3{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- }
+-}
+-
+--- suggestedfix_fill_struct_24_16 --
+-package fillstruct
+-
+-type StructA struct {
+- unexportedIntField int
+- ExportedIntField int
+- MapA map[int]string
+- Array []int
+- StructB
+-}
+-
+-type StructA2 struct {
+- B *StructB
+-}
+-
+-type StructA3 struct {
+- B StructB
+-}
+-
+-func fill() {
+- a := StructA{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- b := StructA2{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- c := StructA3{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- if true {
+- _ = StructA3{
+- B: StructB{},
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+- }
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/fill_struct_nested.go b/gopls/internal/lsp/testdata/fillstruct/fill_struct_nested.go
+--- a/gopls/internal/lsp/testdata/fillstruct/fill_struct_nested.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/fill_struct_nested.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,15 +0,0 @@
+-package fillstruct
+-
+-type StructB struct {
+- StructC
+-}
+-
+-type StructC struct {
+- unexportedInt int
+-}
+-
+-func nested() {
+- c := StructB{
+- StructC: StructC{}, //@suggestedfix("}", "refactor.rewrite", "Fill")
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/fill_struct_nested.go.golden b/gopls/internal/lsp/testdata/fillstruct/fill_struct_nested.go.golden
+--- a/gopls/internal/lsp/testdata/fillstruct/fill_struct_nested.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/fill_struct_nested.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,19 +0,0 @@
+--- suggestedfix_fill_struct_nested_13_20 --
+-package fillstruct
+-
+-type StructB struct {
+- StructC
+-}
+-
+-type StructC struct {
+- unexportedInt int
+-}
+-
+-func nested() {
+- c := StructB{
+- StructC: StructC{
+- unexportedInt: 0,
+- }, //@suggestedfix("}", "refactor.rewrite", "Fill")
+- }
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/fill_struct_package.go b/gopls/internal/lsp/testdata/fillstruct/fill_struct_package.go
+--- a/gopls/internal/lsp/testdata/fillstruct/fill_struct_package.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/fill_struct_package.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+-package fillstruct
+-
+-import (
+- h2 "net/http"
+-
+- "golang.org/lsptests/fillstruct/data"
+-)
+-
+-func unexported() {
+- a := data.B{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- _ = h2.Client{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/fill_struct_package.go.golden b/gopls/internal/lsp/testdata/fillstruct/fill_struct_package.go.golden
+--- a/gopls/internal/lsp/testdata/fillstruct/fill_struct_package.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/fill_struct_package.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,36 +0,0 @@
+--- suggestedfix_fill_struct_package_10_14 --
+-package fillstruct
+-
+-import (
+- h2 "net/http"
+-
+- "golang.org/lsptests/fillstruct/data"
+-)
+-
+-func unexported() {
+- a := data.B{
+- ExportedInt: 0,
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+- _ = h2.Client{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+--- suggestedfix_fill_struct_package_11_16 --
+-package fillstruct
+-
+-import (
+- h2 "net/http"
+-
+- "golang.org/lsptests/fillstruct/data"
+-)
+-
+-func unexported() {
+- a := data.B{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+- _ = h2.Client{
+- Transport: nil,
+- CheckRedirect: func(req *h2.Request, via []*h2.Request) error {
+- },
+- Jar: nil,
+- Timeout: 0,
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/fill_struct_partial.go b/gopls/internal/lsp/testdata/fillstruct/fill_struct_partial.go
+--- a/gopls/internal/lsp/testdata/fillstruct/fill_struct_partial.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/fill_struct_partial.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+-package fillstruct
+-
+-type StructPartialA struct {
+- PrefilledInt int
+- UnfilledInt int
+- StructPartialB
+-}
+-
+-type StructPartialB struct {
+- PrefilledInt int
+- UnfilledInt int
+-}
+-
+-func fill() {
+- a := StructPartialA{
+- PrefilledInt: 5,
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+- b := StructPartialB{
+- /* this comment should disappear */
+- PrefilledInt: 7, // This comment should be blown away.
+- /* As should
+- this one */
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/fill_struct_partial.go.golden b/gopls/internal/lsp/testdata/fillstruct/fill_struct_partial.go.golden
+--- a/gopls/internal/lsp/testdata/fillstruct/fill_struct_partial.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/fill_struct_partial.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,52 +0,0 @@
+--- suggestedfix_fill_struct_partial_17_2 --
+-package fillstruct
+-
+-type StructPartialA struct {
+- PrefilledInt int
+- UnfilledInt int
+- StructPartialB
+-}
+-
+-type StructPartialB struct {
+- PrefilledInt int
+- UnfilledInt int
+-}
+-
+-func fill() {
+- a := StructPartialA{
+- PrefilledInt: 5,
+- UnfilledInt: 0,
+- StructPartialB: StructPartialB{},
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+- b := StructPartialB{
+- /* this comment should disappear */
+- PrefilledInt: 7, // This comment should be blown away.
+- /* As should
+- this one */
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+--- suggestedfix_fill_struct_partial_23_2 --
+-package fillstruct
+-
+-type StructPartialA struct {
+- PrefilledInt int
+- UnfilledInt int
+- StructPartialB
+-}
+-
+-type StructPartialB struct {
+- PrefilledInt int
+- UnfilledInt int
+-}
+-
+-func fill() {
+- a := StructPartialA{
+- PrefilledInt: 5,
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+- b := StructPartialB{
+- PrefilledInt: 7,
+- UnfilledInt: 0,
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/fill_struct_spaces.go b/gopls/internal/lsp/testdata/fillstruct/fill_struct_spaces.go
+--- a/gopls/internal/lsp/testdata/fillstruct/fill_struct_spaces.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/fill_struct_spaces.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package fillstruct
+-
+-type StructD struct {
+- ExportedIntField int
+-}
+-
+-func spaces() {
+- d := StructD{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/fill_struct_spaces.go.golden b/gopls/internal/lsp/testdata/fillstruct/fill_struct_spaces.go.golden
+--- a/gopls/internal/lsp/testdata/fillstruct/fill_struct_spaces.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/fill_struct_spaces.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+--- suggestedfix_fill_struct_spaces_8_15 --
+-package fillstruct
+-
+-type StructD struct {
+- ExportedIntField int
+-}
+-
+-func spaces() {
+- d := StructD{
+- ExportedIntField: 0,
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/fill_struct_unsafe.go b/gopls/internal/lsp/testdata/fillstruct/fill_struct_unsafe.go
+--- a/gopls/internal/lsp/testdata/fillstruct/fill_struct_unsafe.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/fill_struct_unsafe.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+-package fillstruct
+-
+-import "unsafe"
+-
+-type unsafeStruct struct {
+- x int
+- p unsafe.Pointer
+-}
+-
+-func fill() {
+- _ := unsafeStruct{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/fill_struct_unsafe.go.golden b/gopls/internal/lsp/testdata/fillstruct/fill_struct_unsafe.go.golden
+--- a/gopls/internal/lsp/testdata/fillstruct/fill_struct_unsafe.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/fill_struct_unsafe.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,17 +0,0 @@
+--- suggestedfix_fill_struct_unsafe_11_20 --
+-package fillstruct
+-
+-import "unsafe"
+-
+-type unsafeStruct struct {
+- x int
+- p unsafe.Pointer
+-}
+-
+-func fill() {
+- _ := unsafeStruct{
+- x: 0,
+- p: nil,
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/typeparams.go b/gopls/internal/lsp/testdata/fillstruct/typeparams.go
+--- a/gopls/internal/lsp/testdata/fillstruct/typeparams.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/typeparams.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,37 +0,0 @@
+-//go:build go1.18
+-// +build go1.18
+-
+-package fillstruct
+-
+-type emptyStructWithTypeParams[A any] struct{}
+-
+-var _ = emptyStructWithTypeParams[int]{} // no suggested fix
+-
+-type basicStructWithTypeParams[T any] struct {
+- foo T
+-}
+-
+-var _ = basicStructWithTypeParams[int]{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type twoArgStructWithTypeParams[F, B any] struct {
+- foo F
+- bar B
+-}
+-
+-var _ = twoArgStructWithTypeParams[string, int]{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = twoArgStructWithTypeParams[int, string]{
+- bar: "bar",
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type nestedStructWithTypeParams struct {
+- bar string
+- basic basicStructWithTypeParams[int]
+-}
+-
+-var _ = nestedStructWithTypeParams{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-func _[T any]() {
+- type S struct{ t T }
+- _ = S{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+diff -urN a/gopls/internal/lsp/testdata/fillstruct/typeparams.go.golden b/gopls/internal/lsp/testdata/fillstruct/typeparams.go.golden
+--- a/gopls/internal/lsp/testdata/fillstruct/typeparams.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fillstruct/typeparams.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,206 +0,0 @@
+--- suggestedfix_typeparams_14_40 --
+-//go:build go1.18
+-// +build go1.18
+-
+-package fillstruct
+-
+-type emptyStructWithTypeParams[A any] struct{}
+-
+-var _ = emptyStructWithTypeParams[int]{} // no suggested fix
+-
+-type basicStructWithTypeParams[T any] struct {
+- foo T
+-}
+-
+-var _ = basicStructWithTypeParams[int]{
+- foo: 0,
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type twoArgStructWithTypeParams[F, B any] struct {
+- foo F
+- bar B
+-}
+-
+-var _ = twoArgStructWithTypeParams[string, int]{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = twoArgStructWithTypeParams[int, string]{
+- bar: "bar",
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type nestedStructWithTypeParams struct {
+- bar string
+- basic basicStructWithTypeParams[int]
+-}
+-
+-var _ = nestedStructWithTypeParams{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-func _[T any]() {
+- type S struct{ t T }
+- _ = S{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+--- suggestedfix_typeparams_21_49 --
+-//go:build go1.18
+-// +build go1.18
+-
+-package fillstruct
+-
+-type emptyStructWithTypeParams[A any] struct{}
+-
+-var _ = emptyStructWithTypeParams[int]{} // no suggested fix
+-
+-type basicStructWithTypeParams[T any] struct {
+- foo T
+-}
+-
+-var _ = basicStructWithTypeParams[int]{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type twoArgStructWithTypeParams[F, B any] struct {
+- foo F
+- bar B
+-}
+-
+-var _ = twoArgStructWithTypeParams[string, int]{
+- foo: "",
+- bar: 0,
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = twoArgStructWithTypeParams[int, string]{
+- bar: "bar",
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type nestedStructWithTypeParams struct {
+- bar string
+- basic basicStructWithTypeParams[int]
+-}
+-
+-var _ = nestedStructWithTypeParams{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-func _[T any]() {
+- type S struct{ t T }
+- _ = S{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+--- suggestedfix_typeparams_25_1 --
+-//go:build go1.18
+-// +build go1.18
+-
+-package fillstruct
+-
+-type emptyStructWithTypeParams[A any] struct{}
+-
+-var _ = emptyStructWithTypeParams[int]{} // no suggested fix
+-
+-type basicStructWithTypeParams[T any] struct {
+- foo T
+-}
+-
+-var _ = basicStructWithTypeParams[int]{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type twoArgStructWithTypeParams[F, B any] struct {
+- foo F
+- bar B
+-}
+-
+-var _ = twoArgStructWithTypeParams[string, int]{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = twoArgStructWithTypeParams[int, string]{
+- foo: 0,
+- bar: "bar",
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type nestedStructWithTypeParams struct {
+- bar string
+- basic basicStructWithTypeParams[int]
+-}
+-
+-var _ = nestedStructWithTypeParams{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-func _[T any]() {
+- type S struct{ t T }
+- _ = S{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+--- suggestedfix_typeparams_32_36 --
+-//go:build go1.18
+-// +build go1.18
+-
+-package fillstruct
+-
+-type emptyStructWithTypeParams[A any] struct{}
+-
+-var _ = emptyStructWithTypeParams[int]{} // no suggested fix
+-
+-type basicStructWithTypeParams[T any] struct {
+- foo T
+-}
+-
+-var _ = basicStructWithTypeParams[int]{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type twoArgStructWithTypeParams[F, B any] struct {
+- foo F
+- bar B
+-}
+-
+-var _ = twoArgStructWithTypeParams[string, int]{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = twoArgStructWithTypeParams[int, string]{
+- bar: "bar",
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type nestedStructWithTypeParams struct {
+- bar string
+- basic basicStructWithTypeParams[int]
+-}
+-
+-var _ = nestedStructWithTypeParams{
+- bar: "",
+- basic: basicStructWithTypeParams{},
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-func _[T any]() {
+- type S struct{ t T }
+- _ = S{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+--- suggestedfix_typeparams_36_8 --
+-//go:build go1.18
+-// +build go1.18
+-
+-package fillstruct
+-
+-type emptyStructWithTypeParams[A any] struct{}
+-
+-var _ = emptyStructWithTypeParams[int]{} // no suggested fix
+-
+-type basicStructWithTypeParams[T any] struct {
+- foo T
+-}
+-
+-var _ = basicStructWithTypeParams[int]{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type twoArgStructWithTypeParams[F, B any] struct {
+- foo F
+- bar B
+-}
+-
+-var _ = twoArgStructWithTypeParams[string, int]{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-var _ = twoArgStructWithTypeParams[int, string]{
+- bar: "bar",
+-} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-type nestedStructWithTypeParams struct {
+- bar string
+- basic basicStructWithTypeParams[int]
+-}
+-
+-var _ = nestedStructWithTypeParams{} //@suggestedfix("}", "refactor.rewrite", "Fill")
+-
+-func _[T any]() {
+- type S struct{ t T }
+- _ = S{
+- t: *new(T),
+- } //@suggestedfix("}", "refactor.rewrite", "Fill")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/folding/a.go b/gopls/internal/lsp/testdata/folding/a.go
+--- a/gopls/internal/lsp/testdata/folding/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/folding/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,75 +0,0 @@
+-package folding //@fold("package")
+-
+-import (
+- "fmt"
+- _ "log"
+-)
+-
+-import _ "os"
+-
+-// bar is a function.
+-// With a multiline doc comment.
+-func bar() string {
+- /* This is a single line comment */
+- switch {
+- case true:
+- if true {
+- fmt.Println("true")
+- } else {
+- fmt.Println("false")
+- }
+- case false:
+- fmt.Println("false")
+- default:
+- fmt.Println("default")
+- }
+- /* This is a multiline
+- block
+- comment */
+-
+- /* This is a multiline
+- block
+- comment */
+- // Followed by another comment.
+- _ = []int{
+- 1,
+- 2,
+- 3,
+- }
+- _ = [2]string{"d",
+- "e",
+- }
+- _ = map[string]int{
+- "a": 1,
+- "b": 2,
+- "c": 3,
+- }
+- type T struct {
+- f string
+- g int
+- h string
+- }
+- _ = T{
+- f: "j",
+- g: 4,
+- h: "i",
+- }
+- x, y := make(chan bool), make(chan bool)
+- select {
+- case val := <-x:
+- if val {
+- fmt.Println("true from x")
+- } else {
+- fmt.Println("false from x")
+- }
+- case <-y:
+- fmt.Println("y")
+- default:
+- fmt.Println("default")
+- }
+- // This is a multiline comment
+- // that is not a doc comment.
+- return `
+-this string
+-is not indented`
+-}
+diff -urN a/gopls/internal/lsp/testdata/folding/a.go.golden b/gopls/internal/lsp/testdata/folding/a.go.golden
+--- a/gopls/internal/lsp/testdata/folding/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/folding/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,722 +0,0 @@
+--- foldingRange-0 --
+-package folding //@fold("package")
+-
+-import (<>)
+-
+-import _ "os"
+-
+-// bar is a function.<>
+-func bar(<>) string {<>}
+-
+--- foldingRange-1 --
+-package folding //@fold("package")
+-
+-import (
+- "fmt"
+- _ "log"
+-)
+-
+-import _ "os"
+-
+-// bar is a function.
+-// With a multiline doc comment.
+-func bar() string {
+- /* This is a single line comment */
+- switch {<>}
+- /* This is a multiline<>
+-
+- /* This is a multiline<>
+- _ = []int{<>}
+- _ = [2]string{<>}
+- _ = map[string]int{<>}
+- type T struct {<>}
+- _ = T{<>}
+- x, y := make(<>), make(<>)
+- select {<>}
+- // This is a multiline comment<>
+- return <>
+-}
+-
+--- foldingRange-2 --
+-package folding //@fold("package")
+-
+-import (
+- "fmt"
+- _ "log"
+-)
+-
+-import _ "os"
+-
+-// bar is a function.
+-// With a multiline doc comment.
+-func bar() string {
+- /* This is a single line comment */
+- switch {
+- case true:<>
+- case false:<>
+- default:<>
+- }
+- /* This is a multiline
+- block
+- comment */
+-
+- /* This is a multiline
+- block
+- comment */
+- // Followed by another comment.
+- _ = []int{
+- 1,
+- 2,
+- 3,
+- }
+- _ = [2]string{"d",
+- "e",
+- }
+- _ = map[string]int{
+- "a": 1,
+- "b": 2,
+- "c": 3,
+- }
+- type T struct {
+- f string
+- g int
+- h string
+- }
+- _ = T{
+- f: "j",
+- g: 4,
+- h: "i",
+- }
+- x, y := make(chan bool), make(chan bool)
+- select {
+- case val := <-x:<>
+- case <-y:<>
+- default:<>
+- }
+- // This is a multiline comment
+- // that is not a doc comment.
+- return `
+-this string
+-is not indented`
+-}
+-
+--- foldingRange-3 --
+-package folding //@fold("package")
+-
+-import (
+- "fmt"
+- _ "log"
+-)
+-
+-import _ "os"
+-
+-// bar is a function.
+-// With a multiline doc comment.
+-func bar() string {
+- /* This is a single line comment */
+- switch {
+- case true:
+- if true {<>} else {<>}
+- case false:
+- fmt.Println(<>)
+- default:
+- fmt.Println(<>)
+- }
+- /* This is a multiline
+- block
+- comment */
+-
+- /* This is a multiline
+- block
+- comment */
+- // Followed by another comment.
+- _ = []int{
+- 1,
+- 2,
+- 3,
+- }
+- _ = [2]string{"d",
+- "e",
+- }
+- _ = map[string]int{
+- "a": 1,
+- "b": 2,
+- "c": 3,
+- }
+- type T struct {
+- f string
+- g int
+- h string
+- }
+- _ = T{
+- f: "j",
+- g: 4,
+- h: "i",
+- }
+- x, y := make(chan bool), make(chan bool)
+- select {
+- case val := <-x:
+- if val {<>} else {<>}
+- case <-y:
+- fmt.Println(<>)
+- default:
+- fmt.Println(<>)
+- }
+- // This is a multiline comment
+- // that is not a doc comment.
+- return `
+-this string
+-is not indented`
+-}
+-
+--- foldingRange-4 --
+-package folding //@fold("package")
+-
+-import (
+- "fmt"
+- _ "log"
+-)
+-
+-import _ "os"
+-
+-// bar is a function.
+-// With a multiline doc comment.
+-func bar() string {
+- /* This is a single line comment */
+- switch {
+- case true:
+- if true {
+- fmt.Println(<>)
+- } else {
+- fmt.Println(<>)
+- }
+- case false:
+- fmt.Println("false")
+- default:
+- fmt.Println("default")
+- }
+- /* This is a multiline
+- block
+- comment */
+-
+- /* This is a multiline
+- block
+- comment */
+- // Followed by another comment.
+- _ = []int{
+- 1,
+- 2,
+- 3,
+- }
+- _ = [2]string{"d",
+- "e",
+- }
+- _ = map[string]int{
+- "a": 1,
+- "b": 2,
+- "c": 3,
+- }
+- type T struct {
+- f string
+- g int
+- h string
+- }
+- _ = T{
+- f: "j",
+- g: 4,
+- h: "i",
+- }
+- x, y := make(chan bool), make(chan bool)
+- select {
+- case val := <-x:
+- if val {
+- fmt.Println(<>)
+- } else {
+- fmt.Println(<>)
+- }
+- case <-y:
+- fmt.Println("y")
+- default:
+- fmt.Println("default")
+- }
+- // This is a multiline comment
+- // that is not a doc comment.
+- return `
+-this string
+-is not indented`
+-}
+-
+--- foldingRange-comment-0 --
+-package folding //@fold("package")
+-
+-import (
+- "fmt"
+- _ "log"
+-)
+-
+-import _ "os"
+-
+-// bar is a function.<>
+-func bar() string {
+- /* This is a single line comment */
+- switch {
+- case true:
+- if true {
+- fmt.Println("true")
+- } else {
+- fmt.Println("false")
+- }
+- case false:
+- fmt.Println("false")
+- default:
+- fmt.Println("default")
+- }
+- /* This is a multiline<>
+-
+- /* This is a multiline<>
+- _ = []int{
+- 1,
+- 2,
+- 3,
+- }
+- _ = [2]string{"d",
+- "e",
+- }
+- _ = map[string]int{
+- "a": 1,
+- "b": 2,
+- "c": 3,
+- }
+- type T struct {
+- f string
+- g int
+- h string
+- }
+- _ = T{
+- f: "j",
+- g: 4,
+- h: "i",
+- }
+- x, y := make(chan bool), make(chan bool)
+- select {
+- case val := <-x:
+- if val {
+- fmt.Println("true from x")
+- } else {
+- fmt.Println("false from x")
+- }
+- case <-y:
+- fmt.Println("y")
+- default:
+- fmt.Println("default")
+- }
+- // This is a multiline comment<>
+- return `
+-this string
+-is not indented`
+-}
+-
+--- foldingRange-imports-0 --
+-package folding //@fold("package")
+-
+-import (<>)
+-
+-import _ "os"
+-
+-// bar is a function.
+-// With a multiline doc comment.
+-func bar() string {
+- /* This is a single line comment */
+- switch {
+- case true:
+- if true {
+- fmt.Println("true")
+- } else {
+- fmt.Println("false")
+- }
+- case false:
+- fmt.Println("false")
+- default:
+- fmt.Println("default")
+- }
+- /* This is a multiline
+- block
+- comment */
+-
+- /* This is a multiline
+- block
+- comment */
+- // Followed by another comment.
+- _ = []int{
+- 1,
+- 2,
+- 3,
+- }
+- _ = [2]string{"d",
+- "e",
+- }
+- _ = map[string]int{
+- "a": 1,
+- "b": 2,
+- "c": 3,
+- }
+- type T struct {
+- f string
+- g int
+- h string
+- }
+- _ = T{
+- f: "j",
+- g: 4,
+- h: "i",
+- }
+- x, y := make(chan bool), make(chan bool)
+- select {
+- case val := <-x:
+- if val {
+- fmt.Println("true from x")
+- } else {
+- fmt.Println("false from x")
+- }
+- case <-y:
+- fmt.Println("y")
+- default:
+- fmt.Println("default")
+- }
+- // This is a multiline comment
+- // that is not a doc comment.
+- return `
+-this string
+-is not indented`
+-}
+-
+--- foldingRange-lineFolding-0 --
+-package folding //@fold("package")
+-
+-import (<>
+-)
+-
+-import _ "os"
+-
+-// bar is a function.<>
+-func bar() string {<>
+-}
+-
+--- foldingRange-lineFolding-1 --
+-package folding //@fold("package")
+-
+-import (
+- "fmt"
+- _ "log"
+-)
+-
+-import _ "os"
+-
+-// bar is a function.
+-// With a multiline doc comment.
+-func bar() string {
+- /* This is a single line comment */
+- switch {<>
+- }
+- /* This is a multiline<>
+-
+- /* This is a multiline<>
+- _ = []int{<>,
+- }
+- _ = [2]string{"d",
+- "e",
+- }
+- _ = map[string]int{<>,
+- }
+- type T struct {<>
+- }
+- _ = T{<>,
+- }
+- x, y := make(chan bool), make(chan bool)
+- select {<>
+- }
+- // This is a multiline comment<>
+- return <>
+-}
+-
+--- foldingRange-lineFolding-2 --
+-package folding //@fold("package")
+-
+-import (
+- "fmt"
+- _ "log"
+-)
+-
+-import _ "os"
+-
+-// bar is a function.
+-// With a multiline doc comment.
+-func bar() string {
+- /* This is a single line comment */
+- switch {
+- case true:<>
+- case false:<>
+- default:<>
+- }
+- /* This is a multiline
+- block
+- comment */
+-
+- /* This is a multiline
+- block
+- comment */
+- // Followed by another comment.
+- _ = []int{
+- 1,
+- 2,
+- 3,
+- }
+- _ = [2]string{"d",
+- "e",
+- }
+- _ = map[string]int{
+- "a": 1,
+- "b": 2,
+- "c": 3,
+- }
+- type T struct {
+- f string
+- g int
+- h string
+- }
+- _ = T{
+- f: "j",
+- g: 4,
+- h: "i",
+- }
+- x, y := make(chan bool), make(chan bool)
+- select {
+- case val := <-x:<>
+- case <-y:<>
+- default:<>
+- }
+- // This is a multiline comment
+- // that is not a doc comment.
+- return `
+-this string
+-is not indented`
+-}
+-
+--- foldingRange-lineFolding-3 --
+-package folding //@fold("package")
+-
+-import (
+- "fmt"
+- _ "log"
+-)
+-
+-import _ "os"
+-
+-// bar is a function.
+-// With a multiline doc comment.
+-func bar() string {
+- /* This is a single line comment */
+- switch {
+- case true:
+- if true {<>
+- } else {<>
+- }
+- case false:
+- fmt.Println("false")
+- default:
+- fmt.Println("default")
+- }
+- /* This is a multiline
+- block
+- comment */
+-
+- /* This is a multiline
+- block
+- comment */
+- // Followed by another comment.
+- _ = []int{
+- 1,
+- 2,
+- 3,
+- }
+- _ = [2]string{"d",
+- "e",
+- }
+- _ = map[string]int{
+- "a": 1,
+- "b": 2,
+- "c": 3,
+- }
+- type T struct {
+- f string
+- g int
+- h string
+- }
+- _ = T{
+- f: "j",
+- g: 4,
+- h: "i",
+- }
+- x, y := make(chan bool), make(chan bool)
+- select {
+- case val := <-x:
+- if val {<>
+- } else {<>
+- }
+- case <-y:
+- fmt.Println("y")
+- default:
+- fmt.Println("default")
+- }
+- // This is a multiline comment
+- // that is not a doc comment.
+- return `
+-this string
+-is not indented`
+-}
+-
+--- foldingRange-lineFolding-comment-0 --
+-package folding //@fold("package")
+-
+-import (
+- "fmt"
+- _ "log"
+-)
+-
+-import _ "os"
+-
+-// bar is a function.<>
+-func bar() string {
+- /* This is a single line comment */
+- switch {
+- case true:
+- if true {
+- fmt.Println("true")
+- } else {
+- fmt.Println("false")
+- }
+- case false:
+- fmt.Println("false")
+- default:
+- fmt.Println("default")
+- }
+- /* This is a multiline<>
+-
+- /* This is a multiline<>
+- _ = []int{
+- 1,
+- 2,
+- 3,
+- }
+- _ = [2]string{"d",
+- "e",
+- }
+- _ = map[string]int{
+- "a": 1,
+- "b": 2,
+- "c": 3,
+- }
+- type T struct {
+- f string
+- g int
+- h string
+- }
+- _ = T{
+- f: "j",
+- g: 4,
+- h: "i",
+- }
+- x, y := make(chan bool), make(chan bool)
+- select {
+- case val := <-x:
+- if val {
+- fmt.Println("true from x")
+- } else {
+- fmt.Println("false from x")
+- }
+- case <-y:
+- fmt.Println("y")
+- default:
+- fmt.Println("default")
+- }
+- // This is a multiline comment<>
+- return `
+-this string
+-is not indented`
+-}
+-
+--- foldingRange-lineFolding-imports-0 --
+-package folding //@fold("package")
+-
+-import (<>
+-)
+-
+-import _ "os"
+-
+-// bar is a function.
+-// With a multiline doc comment.
+-func bar() string {
+- /* This is a single line comment */
+- switch {
+- case true:
+- if true {
+- fmt.Println("true")
+- } else {
+- fmt.Println("false")
+- }
+- case false:
+- fmt.Println("false")
+- default:
+- fmt.Println("default")
+- }
+- /* This is a multiline
+- block
+- comment */
+-
+- /* This is a multiline
+- block
+- comment */
+- // Followed by another comment.
+- _ = []int{
+- 1,
+- 2,
+- 3,
+- }
+- _ = [2]string{"d",
+- "e",
+- }
+- _ = map[string]int{
+- "a": 1,
+- "b": 2,
+- "c": 3,
+- }
+- type T struct {
+- f string
+- g int
+- h string
+- }
+- _ = T{
+- f: "j",
+- g: 4,
+- h: "i",
+- }
+- x, y := make(chan bool), make(chan bool)
+- select {
+- case val := <-x:
+- if val {
+- fmt.Println("true from x")
+- } else {
+- fmt.Println("false from x")
+- }
+- case <-y:
+- fmt.Println("y")
+- default:
+- fmt.Println("default")
+- }
+- // This is a multiline comment
+- // that is not a doc comment.
+- return `
+-this string
+-is not indented`
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/folding/bad.go.golden b/gopls/internal/lsp/testdata/folding/bad.go.golden
+--- a/gopls/internal/lsp/testdata/folding/bad.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/folding/bad.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,81 +0,0 @@
+--- foldingRange-0 --
+-package folding //@fold("package")
+-
+-import (<>)
+-
+-import (<>)
+-
+-// badBar is a function.
+-func badBar(<>) string {<>}
+-
+--- foldingRange-1 --
+-package folding //@fold("package")
+-
+-import ( "fmt"
+- _ "log"
+-)
+-
+-import (
+- _ "os" )
+-
+-// badBar is a function.
+-func badBar() string { x := true
+- if x {<>} else {<>}
+- return
+-}
+-
+--- foldingRange-2 --
+-package folding //@fold("package")
+-
+-import ( "fmt"
+- _ "log"
+-)
+-
+-import (
+- _ "os" )
+-
+-// badBar is a function.
+-func badBar() string { x := true
+- if x {
+- // This is the only foldable thing in this file when lineFoldingOnly
+- fmt.Println(<>)
+- } else {
+- fmt.Println(<>) }
+- return
+-}
+-
+--- foldingRange-imports-0 --
+-package folding //@fold("package")
+-
+-import (<>)
+-
+-import (<>)
+-
+-// badBar is a function.
+-func badBar() string { x := true
+- if x {
+- // This is the only foldable thing in this file when lineFoldingOnly
+- fmt.Println("true")
+- } else {
+- fmt.Println("false") }
+- return
+-}
+-
+--- foldingRange-lineFolding-0 --
+-package folding //@fold("package")
+-
+-import ( "fmt"
+- _ "log"
+-)
+-
+-import (
+- _ "os" )
+-
+-// badBar is a function.
+-func badBar() string { x := true
+- if x {<>
+- } else {
+- fmt.Println("false") }
+- return
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/folding/bad.go.in b/gopls/internal/lsp/testdata/folding/bad.go.in
+--- a/gopls/internal/lsp/testdata/folding/bad.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/folding/bad.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+-package folding //@fold("package")
+-
+-import ( "fmt"
+- _ "log"
+-)
+-
+-import (
+- _ "os" )
+-
+-// badBar is a function.
+-func badBar() string { x := true
+- if x {
+- // This is the only foldable thing in this file when lineFoldingOnly
+- fmt.Println("true")
+- } else {
+- fmt.Println("false") }
+- return
+-}
+diff -urN a/gopls/internal/lsp/testdata/foo/foo.go b/gopls/internal/lsp/testdata/foo/foo.go
+--- a/gopls/internal/lsp/testdata/foo/foo.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/foo/foo.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,30 +0,0 @@
+-package foo //@mark(PackageFoo, "foo"),item(PackageFoo, "foo", "\"golang.org/lsptests/foo\"", "package")
+-
+-type StructFoo struct { //@item(StructFoo, "StructFoo", "struct{...}", "struct")
+- Value int //@item(Value, "Value", "int", "field")
+-}
+-
+-// Pre-set this marker, as we don't have a "source" for it in this package.
+-/* Error() */ //@item(Error, "Error", "func() string", "method")
+-
+-func Foo() { //@item(Foo, "Foo", "func()", "func")
+- var err error
+- err.Error() //@complete("E", Error)
+-}
+-
+-func _() {
+- var sFoo StructFoo //@mark(sFoo1, "sFoo"),complete("t", StructFoo)
+- if x := sFoo; x.Value == 1 { //@mark(sFoo2, "sFoo"),complete("V", Value),typdef("sFoo", StructFoo),refs("sFo", sFoo1, sFoo2)
+- return
+- }
+-}
+-
+-func _() {
+- shadowed := 123
+- {
+- shadowed := "hi" //@item(shadowed, "shadowed", "string", "var"),refs("shadowed", shadowed)
+- sha //@complete("a", shadowed)
+- }
+-}
+-
+-type IntFoo int //@item(IntFoo, "IntFoo", "int", "type")
+diff -urN a/gopls/internal/lsp/testdata/format/bad_format.go.golden b/gopls/internal/lsp/testdata/format/bad_format.go.golden
+--- a/gopls/internal/lsp/testdata/format/bad_format.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/format/bad_format.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,21 +0,0 @@
+--- gofmt --
+-package format //@format("package")
+-
+-import (
+- "fmt"
+- "log"
+- "runtime"
+-)
+-
+-func hello() {
+-
+- var x int //@diag("x", "compiler", "x declared (and|but) not used", "error")
+-}
+-
+-func hi() {
+- runtime.GOROOT()
+- fmt.Printf("")
+-
+- log.Printf("")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/format/bad_format.go.in b/gopls/internal/lsp/testdata/format/bad_format.go.in
+--- a/gopls/internal/lsp/testdata/format/bad_format.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/format/bad_format.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,22 +0,0 @@
+-package format //@format("package")
+-
+-import (
+- "runtime"
+- "fmt"
+- "log"
+-)
+-
+-func hello() {
+-
+-
+-
+-
+- var x int //@diag("x", "compiler", "x declared (and|but) not used", "error")
+-}
+-
+-func hi() {
+- runtime.GOROOT()
+- fmt.Printf("")
+-
+- log.Printf("")
+-}
+diff -urN a/gopls/internal/lsp/testdata/format/good_format.go b/gopls/internal/lsp/testdata/format/good_format.go
+--- a/gopls/internal/lsp/testdata/format/good_format.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/format/good_format.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package format //@format("package")
+-
+-import (
+- "log"
+-)
+-
+-func goodbye() {
+- log.Printf("byeeeee")
+-}
+diff -urN a/gopls/internal/lsp/testdata/format/good_format.go.golden b/gopls/internal/lsp/testdata/format/good_format.go.golden
+--- a/gopls/internal/lsp/testdata/format/good_format.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/format/good_format.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+--- gofmt --
+-package format //@format("package")
+-
+-import (
+- "log"
+-)
+-
+-func goodbye() {
+- log.Printf("byeeeee")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/format/newline_format.go.golden b/gopls/internal/lsp/testdata/format/newline_format.go.golden
+--- a/gopls/internal/lsp/testdata/format/newline_format.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/format/newline_format.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,4 +0,0 @@
+--- gofmt --
+-package format //@format("package")
+-func _() {}
+-
+diff -urN a/gopls/internal/lsp/testdata/format/newline_format.go.in b/gopls/internal/lsp/testdata/format/newline_format.go.in
+--- a/gopls/internal/lsp/testdata/format/newline_format.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/format/newline_format.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,2 +0,0 @@
+-package format //@format("package")
+-func _() {}
+\ No newline at end of file
+diff -urN a/gopls/internal/lsp/testdata/format/one_line.go.golden b/gopls/internal/lsp/testdata/format/one_line.go.golden
+--- a/gopls/internal/lsp/testdata/format/one_line.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/format/one_line.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,3 +0,0 @@
+--- gofmt --
+-package format //@format("package")
+-
+diff -urN a/gopls/internal/lsp/testdata/format/one_line.go.in b/gopls/internal/lsp/testdata/format/one_line.go.in
+--- a/gopls/internal/lsp/testdata/format/one_line.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/format/one_line.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1 +0,0 @@
+-package format //@format("package")
+\ No newline at end of file
+diff -urN a/gopls/internal/lsp/testdata/func_rank/func_rank.go.in b/gopls/internal/lsp/testdata/func_rank/func_rank.go.in
+--- a/gopls/internal/lsp/testdata/func_rank/func_rank.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/func_rank/func_rank.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,70 +0,0 @@
+-package func_rank
+-
+-import "net/http"
+-
+-var stringAVar = "var" //@item(stringAVar, "stringAVar", "string", "var")
+-func stringBFunc() string { return "str" } //@item(stringBFunc, "stringBFunc", "func() string", "func")
+-type stringer struct{} //@item(stringer, "stringer", "struct{...}", "struct")
+-
+-func _() stringer //@complete("tr", stringer)
+-
+-func _(val stringer) {} //@complete("tr", stringer)
+-
+-func (stringer) _() {} //@complete("tr", stringer)
+-
+-func _() {
+- var s struct {
+- AA int //@item(rankAA, "AA", "int", "field")
+- AB string //@item(rankAB, "AB", "string", "field")
+- AC int //@item(rankAC, "AC", "int", "field")
+- }
+- fnStr := func(string) {}
+- fnStr(s.A) //@complete(")", rankAB, rankAA, rankAC)
+- fnStr("" + s.A) //@complete(")", rankAB, rankAA, rankAC)
+-
+- fnInt := func(int) {}
+- fnInt(-s.A) //@complete(")", rankAA, rankAC, rankAB)
+-
+- // no expected type
+- fnInt(func() int { s.A }) //@complete(" }", rankAA, rankAB, rankAC)
+- fnInt(s.A()) //@complete("()", rankAA, rankAC, rankAB)
+- fnInt([]int{}[s.A]) //@complete("])", rankAA, rankAC, rankAB)
+- fnInt([]int{}[:s.A]) //@complete("])", rankAA, rankAC, rankAB)
+-
+- fnInt(s.A.(int)) //@complete(".(", rankAA, rankAC, rankAB)
+-
+- fnPtr := func(*string) {}
+- fnPtr(&s.A) //@complete(")", rankAB, rankAA, rankAC)
+-
+- var aaPtr *string //@item(rankAAPtr, "aaPtr", "*string", "var")
+- var abPtr *int //@item(rankABPtr, "abPtr", "*int", "var")
+- fnInt(*a) //@complete(")", rankABPtr, rankAAPtr)
+-
+- _ = func() string {
+- return s.A //@complete(" //", rankAB, rankAA, rankAC)
+- }
+-}
+-
+-type foo struct {
+- fooPrivateField int //@item(rankFooPrivField, "fooPrivateField", "int", "field")
+- FooPublicField int //@item(rankFooPubField, "FooPublicField", "int", "field")
+-}
+-
+-func (foo) fooPrivateMethod() int { //@item(rankFooPrivMeth, "fooPrivateMethod", "func() int", "method")
+- return 0
+-}
+-
+-func (foo) FooPublicMethod() int { //@item(rankFooPubMeth, "FooPublicMethod", "func() int", "method")
+- return 0
+-}
+-
+-func _() {
+- var _ int = foo{}. //@rank(" //", rankFooPrivField, rankFooPubField),rank(" //", rankFooPrivMeth, rankFooPubMeth),rank(" //", rankFooPrivField, rankFooPrivMeth)
+-}
+-
+-func _() {
+- HandleFunc //@item(httpHandleFunc, "HandleFunc", "func(pattern string, handler func(http.ResponseWriter, *http.Request))", "func")
+- HandlerFunc //@item(httpHandlerFunc, "HandlerFunc", "func(http.ResponseWriter, *http.Request)", "type")
+-
+- http.HandleFunc //@rank(" //", httpHandleFunc, httpHandlerFunc)
+-}
+diff -urN a/gopls/internal/lsp/testdata/funcsig/func_sig.go b/gopls/internal/lsp/testdata/funcsig/func_sig.go
+--- a/gopls/internal/lsp/testdata/funcsig/func_sig.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/funcsig/func_sig.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package funcsig
+-
+-type someType int //@item(sigSomeType, "someType", "int", "type")
+-
+-// Don't complete "foo" in signature.
+-func (foo someType) _() { //@item(sigFoo, "foo", "someType", "var"),complete(") {", sigSomeType)
+-
+- //@complete("", sigFoo, sigSomeType)
+-}
+diff -urN a/gopls/internal/lsp/testdata/funcvalue/func_value.go b/gopls/internal/lsp/testdata/funcvalue/func_value.go
+--- a/gopls/internal/lsp/testdata/funcvalue/func_value.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/funcvalue/func_value.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,27 +0,0 @@
+-package funcvalue
+-
+-func fooFunc() int { //@item(fvFooFunc, "fooFunc", "func() int", "func")
+- return 0
+-}
+-
+-var _ = fooFunc() //@item(fvFooFuncCall, "fooFunc", "func() int", "func")
+-
+-var fooVar = func() int { //@item(fvFooVar, "fooVar", "func() int", "var")
+- return 0
+-}
+-
+-var _ = fooVar() //@item(fvFooVarCall, "fooVar", "func() int", "var")
+-
+-type myFunc func() int
+-
+-var fooType myFunc = fooVar //@item(fvFooType, "fooType", "myFunc", "var")
+-
+-var _ = fooType() //@item(fvFooTypeCall, "fooType", "func() int", "var")
+-
+-func _() {
+- var f func() int
+- f = foo //@complete(" //", fvFooFunc, fvFooType, fvFooVar)
+-
+- var i int
+- i = foo //@complete(" //", fvFooFuncCall, fvFooTypeCall, fvFooVarCall)
+-}
+diff -urN a/gopls/internal/lsp/testdata/fuzzymatch/fuzzymatch.go b/gopls/internal/lsp/testdata/fuzzymatch/fuzzymatch.go
+--- a/gopls/internal/lsp/testdata/fuzzymatch/fuzzymatch.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/fuzzymatch/fuzzymatch.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,48 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package fuzzy
+-
+-func _() {
+- var a struct {
+- fabar int
+- fooBar string
+- }
+-
+- a.fabar //@item(fuzzFabarField, "a.fabar", "int", "field")
+- a.fooBar //@item(fuzzFooBarField, "a.fooBar", "string", "field")
+-
+- afa //@fuzzy(" //", fuzzFabarField, fuzzFooBarField)
+- afb //@fuzzy(" //", fuzzFooBarField, fuzzFabarField)
+-
+- fab //@fuzzy(" //", fuzzFabarField)
+-
+- var myString string
+- myString = af //@fuzzy(" //", fuzzFooBarField, fuzzFabarField)
+-
+- var b struct {
+- c struct {
+- d struct {
+- e struct {
+- abc string
+- }
+- abc float32
+- }
+- abc bool
+- }
+- abc int
+- }
+-
+- b.abc //@item(fuzzABCInt, "b.abc", "int", "field")
+- b.c.abc //@item(fuzzABCbool, "b.c.abc", "bool", "field")
+- b.c.d.abc //@item(fuzzABCfloat, "b.c.d.abc", "float32", "field")
+- b.c.d.e.abc //@item(fuzzABCstring, "b.c.d.e.abc", "string", "field")
+-
+- // in depth order by default
+- abc //@fuzzy(" //", fuzzABCInt, fuzzABCbool, fuzzABCfloat)
+-
+- // deep candidate that matches expected type should still ranked first
+- var s string
+- s = abc //@fuzzy(" //", fuzzABCstring, fuzzABCInt, fuzzABCbool)
+-}
+diff -urN a/gopls/internal/lsp/testdata/generate/generate.go b/gopls/internal/lsp/testdata/generate/generate.go
+--- a/gopls/internal/lsp/testdata/generate/generate.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/generate/generate.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,4 +0,0 @@
+-package generate
+-
+-//go:generate echo Hi //@ codelens("//go:generate", "run go generate", "generate"), codelens("//go:generate", "run go generate ./...", "generate")
+-//go:generate echo I shall have no CodeLens
+diff -urN a/gopls/internal/lsp/testdata/generated/generated.go b/gopls/internal/lsp/testdata/generated/generated.go
+--- a/gopls/internal/lsp/testdata/generated/generated.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/generated/generated.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-package generated
+-
+-// Code generated by generator.go. DO NOT EDIT.
+-
+-func _() {
+- var y int //@diag("y", "compiler", "y declared (and|but) not used", "error")
+-}
+diff -urN a/gopls/internal/lsp/testdata/generated/generator.go b/gopls/internal/lsp/testdata/generated/generator.go
+--- a/gopls/internal/lsp/testdata/generated/generator.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/generated/generator.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,5 +0,0 @@
+-package generated
+-
+-func _() {
+- var x int //@diag("x", "compiler", "x declared (and|but) not used", "error")
+-}
+diff -urN a/gopls/internal/lsp/testdata/godef/a/a_x_test.go b/gopls/internal/lsp/testdata/godef/a/a_x_test.go
+--- a/gopls/internal/lsp/testdata/godef/a/a_x_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/godef/a/a_x_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package a_test
+-
+-import (
+- "testing"
+-)
+-
+-func TestA2(t *testing.T) { //@TestA2,godef(TestA2, TestA2)
+- Nonexistant() //@diag("Nonexistant", "compiler", "(undeclared name|undefined): Nonexistant", "error")
+-}
+diff -urN a/gopls/internal/lsp/testdata/godef/a/a_x_test.go.golden b/gopls/internal/lsp/testdata/godef/a/a_x_test.go.golden
+--- a/gopls/internal/lsp/testdata/godef/a/a_x_test.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/godef/a/a_x_test.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,26 +0,0 @@
+--- TestA2-definition --
+-godef/a/a_x_test.go:7:6-12: defined here as ```go
+-func TestA2(t *testing.T)
+-```
+--- TestA2-definition-json --
+-{
+- "span": {
+- "uri": "file://godef/a/a_x_test.go",
+- "start": {
+- "line": 7,
+- "column": 6,
+- "offset": 44
+- },
+- "end": {
+- "line": 7,
+- "column": 12,
+- "offset": 50
+- }
+- },
+- "description": "```go\nfunc TestA2(t *testing.T)\n```"
+-}
+-
+--- TestA2-hoverdef --
+-```go
+-func TestA2(t *testing.T)
+-```
+diff -urN a/gopls/internal/lsp/testdata/godef/a/d.go b/gopls/internal/lsp/testdata/godef/a/d.go
+--- a/gopls/internal/lsp/testdata/godef/a/d.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/godef/a/d.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,69 +0,0 @@
+-package a //@mark(a, "a "),hoverdef("a ", a)
+-
+-import "fmt"
+-
+-type Thing struct { //@Thing
+- Member string //@Member
+-}
+-
+-var Other Thing //@Other
+-
+-func Things(val []string) []Thing { //@Things
+- return nil
+-}
+-
+-func (t Thing) Method(i int) string { //@Method
+- return t.Member
+-}
+-
+-func (t Thing) Method3() {
+-}
+-
+-func (t *Thing) Method2(i int, j int) (error, string) {
+- return nil, t.Member
+-}
+-
+-func (t *Thing) private() {
+-}
+-
+-func useThings() {
+- t := Thing{ //@mark(aStructType, "ing")
+- Member: "string", //@mark(fMember, "ember")
+- }
+- fmt.Print(t.Member) //@mark(aMember, "ember")
+- fmt.Print(Other) //@mark(aVar, "ther")
+- Things() //@mark(aFunc, "ings")
+- t.Method() //@mark(aMethod, "eth")
+-}
+-
+-type NextThing struct { //@NextThing
+- Thing
+- Value int
+-}
+-
+-func (n NextThing) another() string {
+- return n.Member
+-}
+-
+-// Shadows Thing.Method3
+-func (n *NextThing) Method3() int {
+- return n.Value
+-}
+-
+-var nextThing NextThing //@hoverdef("NextThing", NextThing)
+-
+-/*@
+-godef(aStructType, Thing)
+-godef(aMember, Member)
+-godef(aVar, Other)
+-godef(aFunc, Things)
+-godef(aMethod, Method)
+-godef(fMember, Member)
+-godef(Member, Member)
+-
+-//param
+-//package name
+-//const
+-//anon field
+-
+-*/
+diff -urN a/gopls/internal/lsp/testdata/godef/a/d.go.golden b/gopls/internal/lsp/testdata/godef/a/d.go.golden
+--- a/gopls/internal/lsp/testdata/godef/a/d.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/godef/a/d.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,191 +0,0 @@
+--- Member-definition --
+-godef/a/d.go:6:2-8: defined here as ```go
+-field Member string
+-```
+-
+-@Member
+-
+-
+-[`(a.Thing).Member` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing.Member)
+--- Member-definition-json --
+-{
+- "span": {
+- "uri": "file://godef/a/d.go",
+- "start": {
+- "line": 6,
+- "column": 2,
+- "offset": 90
+- },
+- "end": {
+- "line": 6,
+- "column": 8,
+- "offset": 96
+- }
+- },
+- "description": "```go\nfield Member string\n```\n\n@Member\n\n\n[`(a.Thing).Member` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing.Member)"
+-}
+-
+--- Member-hoverdef --
+-```go
+-field Member string
+-```
+-
+-@Member
+-
+-
+-[`(a.Thing).Member` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing.Member)
+--- Method-definition --
+-godef/a/d.go:15:16-22: defined here as ```go
+-func (Thing).Method(i int) string
+-```
+-
+-[`(a.Thing).Method` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing.Method)
+--- Method-definition-json --
+-{
+- "span": {
+- "uri": "file://godef/a/d.go",
+- "start": {
+- "line": 15,
+- "column": 16,
+- "offset": 219
+- },
+- "end": {
+- "line": 15,
+- "column": 22,
+- "offset": 225
+- }
+- },
+- "description": "```go\nfunc (Thing).Method(i int) string\n```\n\n[`(a.Thing).Method` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing.Method)"
+-}
+-
+--- Method-hoverdef --
+-```go
+-func (Thing).Method(i int) string
+-```
+-
+-[`(a.Thing).Method` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing.Method)
+--- NextThing-hoverdef --
+-```go
+-type NextThing struct {
+- Thing
+- Value int
+-}
+-
+-func (*NextThing).Method3() int
+-func (NextThing).another() string
+-```
+-
+-[`a.NextThing` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#NextThing)
+--- Other-definition --
+-godef/a/d.go:9:5-10: defined here as ```go
+-var Other Thing
+-```
+-
+-@Other
+-
+-
+-[`a.Other` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Other)
+--- Other-definition-json --
+-{
+- "span": {
+- "uri": "file://godef/a/d.go",
+- "start": {
+- "line": 9,
+- "column": 5,
+- "offset": 121
+- },
+- "end": {
+- "line": 9,
+- "column": 10,
+- "offset": 126
+- }
+- },
+- "description": "```go\nvar Other Thing\n```\n\n@Other\n\n\n[`a.Other` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Other)"
+-}
+-
+--- Other-hoverdef --
+-```go
+-var Other Thing
+-```
+-
+-@Other
+-
+-
+-[`a.Other` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Other)
+--- Thing-definition --
+-godef/a/d.go:5:6-11: defined here as ```go
+-type Thing struct {
+- Member string //@Member
+-}
+-
+-func (Thing).Method(i int) string
+-func (*Thing).Method2(i int, j int) (error, string)
+-func (Thing).Method3()
+-func (*Thing).private()
+-```
+-
+-[`a.Thing` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing)
+--- Thing-definition-json --
+-{
+- "span": {
+- "uri": "file://godef/a/d.go",
+- "start": {
+- "line": 5,
+- "column": 6,
+- "offset": 65
+- },
+- "end": {
+- "line": 5,
+- "column": 11,
+- "offset": 70
+- }
+- },
+- "description": "```go\ntype Thing struct {\n\tMember string //@Member\n}\n\nfunc (Thing).Method(i int) string\nfunc (*Thing).Method2(i int, j int) (error, string)\nfunc (Thing).Method3()\nfunc (*Thing).private()\n```\n\n[`a.Thing` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing)"
+-}
+-
+--- Thing-hoverdef --
+-```go
+-type Thing struct {
+- Member string //@Member
+-}
+-
+-func (Thing).Method(i int) string
+-func (*Thing).Method2(i int, j int) (error, string)
+-func (Thing).Method3()
+-func (*Thing).private()
+-```
+-
+-[`a.Thing` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing)
+--- Things-definition --
+-godef/a/d.go:11:6-12: defined here as ```go
+-func Things(val []string) []Thing
+-```
+-
+-[`a.Things` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Things)
+--- Things-definition-json --
+-{
+- "span": {
+- "uri": "file://godef/a/d.go",
+- "start": {
+- "line": 11,
+- "column": 6,
+- "offset": 148
+- },
+- "end": {
+- "line": 11,
+- "column": 12,
+- "offset": 154
+- }
+- },
+- "description": "```go\nfunc Things(val []string) []Thing\n```\n\n[`a.Things` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Things)"
+-}
+-
+--- Things-hoverdef --
+-```go
+-func Things(val []string) []Thing
+-```
+-
+-[`a.Things` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Things)
+--- a-hoverdef --
+-Package a is a package for testing go to definition.
+-
+diff -urN a/gopls/internal/lsp/testdata/godef/a/f.go b/gopls/internal/lsp/testdata/godef/a/f.go
+--- a/gopls/internal/lsp/testdata/godef/a/f.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/godef/a/f.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+-// Package a is a package for testing go to definition.
+-package a
+-
+-import "fmt"
+-
+-func TypeStuff() { //@Stuff
+- var x string
+-
+- switch y := interface{}(x).(type) { //@mark(switchY, "y"),godef("y", switchY)
+- case int: //@mark(intY, "int")
+- fmt.Printf("%v", y) //@hoverdef("y", intY)
+- case string: //@mark(stringY, "string")
+- fmt.Printf("%v", y) //@hoverdef("y", stringY)
+- }
+-
+-}
+diff -urN a/gopls/internal/lsp/testdata/godef/a/f.go.golden b/gopls/internal/lsp/testdata/godef/a/f.go.golden
+--- a/gopls/internal/lsp/testdata/godef/a/f.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/godef/a/f.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,34 +0,0 @@
+--- intY-hoverdef --
+-```go
+-var y int
+-```
+--- stringY-hoverdef --
+-```go
+-var y string
+-```
+--- switchY-definition --
+-godef/a/f.go:8:9-10: defined here as ```go
+-var y interface{}
+-```
+--- switchY-definition-json --
+-{
+- "span": {
+- "uri": "file://godef/a/f.go",
+- "start": {
+- "line": 8,
+- "column": 9,
+- "offset": 76
+- },
+- "end": {
+- "line": 8,
+- "column": 10,
+- "offset": 77
+- }
+- },
+- "description": "```go\nvar y interface{}\n```"
+-}
+-
+--- switchY-hoverdef --
+-```go
+-var y interface{}
+-```
+diff -urN a/gopls/internal/lsp/testdata/godef/a/g.go b/gopls/internal/lsp/testdata/godef/a/g.go
+--- a/gopls/internal/lsp/testdata/godef/a/g.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/godef/a/g.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-package a
+-
+-import "time"
+-
+-// dur is a constant of type time.Duration.
+-const dur = 15*time.Minute + 10*time.Second + 350*time.Millisecond //@dur,hoverdef("dur", dur)
+diff -urN a/gopls/internal/lsp/testdata/godef/a/g.go.golden b/gopls/internal/lsp/testdata/godef/a/g.go.golden
+--- a/gopls/internal/lsp/testdata/godef/a/g.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/godef/a/g.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+--- dur-hoverdef --
+-```go
+-const dur time.Duration = 910350000000 // 15m10.35s
+-```
+-
+-dur is a constant of type time.Duration.
+-
+diff -urN a/gopls/internal/lsp/testdata/godef/a/h.go b/gopls/internal/lsp/testdata/godef/a/h.go
+--- a/gopls/internal/lsp/testdata/godef/a/h.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/godef/a/h.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,147 +0,0 @@
+-package a
+-
+-func _() {
+- type s struct {
+- nested struct {
+- // nested number
+- number int64 //@mark(nestedNumber, "number")
+- }
+- nested2 []struct {
+- // nested string
+- str string //@mark(nestedString, "str")
+- }
+- x struct {
+- x struct {
+- x struct {
+- x struct {
+- x struct {
+- // nested map
+- m map[string]float64 //@mark(nestedMap, "m")
+- }
+- }
+- }
+- }
+- }
+- }
+-
+- var t s
+- _ = t.nested.number //@hoverdef("number", nestedNumber)
+- _ = t.nested2[0].str //@hoverdef("str", nestedString)
+- _ = t.x.x.x.x.x.m //@hoverdef("m", nestedMap)
+-}
+-
+-func _() {
+- var s struct {
+- // a field
+- a int //@mark(structA, "a")
+- // b nested struct
+- b struct { //@mark(structB, "b")
+- // c field of nested struct
+- c int //@mark(structC, "c")
+- }
+- }
+- _ = s.a //@hoverdef("a", structA)
+- _ = s.b //@hoverdef("b", structB)
+- _ = s.b.c //@hoverdef("c", structC)
+-
+- var arr []struct {
+- // d field
+- d int //@mark(arrD, "d")
+- // e nested struct
+- e struct { //@mark(arrE, "e")
+- // f field of nested struct
+- f int //@mark(arrF, "f")
+- }
+- }
+- _ = arr[0].d //@hoverdef("d", arrD)
+- _ = arr[0].e //@hoverdef("e", arrE)
+- _ = arr[0].e.f //@hoverdef("f", arrF)
+-
+- var complex []struct {
+- c <-chan map[string][]struct {
+- // h field
+- h int //@mark(complexH, "h")
+- // i nested struct
+- i struct { //@mark(complexI, "i")
+- // j field of nested struct
+- j int //@mark(complexJ, "j")
+- }
+- }
+- }
+- _ = (<-complex[0].c)["0"][0].h //@hoverdef("h", complexH)
+- _ = (<-complex[0].c)["0"][0].i //@hoverdef("i", complexI)
+- _ = (<-complex[0].c)["0"][0].i.j //@hoverdef("j", complexJ)
+-
+- var mapWithStructKey map[struct {
+- // X key field
+- x []string //@mark(mapStructKeyX, "x")
+- }]int
+- for k := range mapWithStructKey {
+- _ = k.x //@hoverdef("x", mapStructKeyX)
+- }
+-
+- var mapWithStructKeyAndValue map[struct {
+- // Y key field
+- y string //@mark(mapStructKeyY, "y")
+- }]struct {
+- // X value field
+- x string //@mark(mapStructValueX, "x")
+- }
+- for k, v := range mapWithStructKeyAndValue {
+- // TODO: we don't show docs for y field because both map key and value
+- // are structs. And in this case, we parse only map value
+- _ = k.y //@hoverdef("y", mapStructKeyY)
+- _ = v.x //@hoverdef("x", mapStructValueX)
+- }
+-
+- var i []map[string]interface {
+- // open method comment
+- open() error //@mark(openMethod, "open")
+- }
+- i[0]["1"].open() //@hoverdef("open", openMethod)
+-}
+-
+-func _() {
+- test := struct {
+- // test description
+- desc string //@mark(testDescription, "desc")
+- }{}
+- _ = test.desc //@hoverdef("desc", testDescription)
+-
+- for _, tt := range []struct {
+- // test input
+- in map[string][]struct { //@mark(testInput, "in")
+- // test key
+- key string //@mark(testInputKey, "key")
+- // test value
+- value interface{} //@mark(testInputValue, "value")
+- }
+- result struct {
+- v <-chan struct {
+- // expected test value
+- value int //@mark(testResultValue, "value")
+- }
+- }
+- }{} {
+- _ = tt.in //@hoverdef("in", testInput)
+- _ = tt.in["0"][0].key //@hoverdef("key", testInputKey)
+- _ = tt.in["0"][0].value //@hoverdef("value", testInputValue)
+-
+- _ = (<-tt.result.v).value //@hoverdef("value", testResultValue)
+- }
+-}
+-
+-func _() {
+- getPoints := func() []struct {
+- // X coord
+- x int //@mark(returnX, "x")
+- // Y coord
+- y int //@mark(returnY, "y")
+- } {
+- return nil
+- }
+-
+- r := getPoints()
+- r[0].x //@hoverdef("x", returnX)
+- r[0].y //@hoverdef("y", returnY)
+-}
+diff -urN a/gopls/internal/lsp/testdata/godef/a/h.go.golden b/gopls/internal/lsp/testdata/godef/a/h.go.golden
+--- a/gopls/internal/lsp/testdata/godef/a/h.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/godef/a/h.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,161 +0,0 @@
+--- arrD-hoverdef --
+-```go
+-field d int
+-```
+-
+-d field
+-
+--- arrE-hoverdef --
+-```go
+-field e struct{f int}
+-```
+-
+-e nested struct
+-
+--- arrF-hoverdef --
+-```go
+-field f int
+-```
+-
+-f field of nested struct
+-
+--- complexH-hoverdef --
+-```go
+-field h int
+-```
+-
+-h field
+-
+--- complexI-hoverdef --
+-```go
+-field i struct{j int}
+-```
+-
+-i nested struct
+-
+--- complexJ-hoverdef --
+-```go
+-field j int
+-```
+-
+-j field of nested struct
+-
+--- mapStructKeyX-hoverdef --
+-```go
+-field x []string
+-```
+-
+-X key field
+-
+--- mapStructKeyY-hoverdef --
+-```go
+-field y string
+-```
+-
+-Y key field
+-
+--- mapStructValueX-hoverdef --
+-```go
+-field x string
+-```
+-
+-X value field
+-
+--- nestedMap-hoverdef --
+-```go
+-field m map[string]float64
+-```
+-
+-nested map
+-
+--- nestedNumber-hoverdef --
+-```go
+-field number int64
+-```
+-
+-nested number
+-
+--- nestedString-hoverdef --
+-```go
+-field str string
+-```
+-
+-nested string
+-
+--- openMethod-hoverdef --
+-```go
+-func (interface).open() error
+-```
+-
+-open method comment
+-
+--- returnX-hoverdef --
+-```go
+-field x int
+-```
+-
+-X coord
+-
+--- returnY-hoverdef --
+-```go
+-field y int
+-```
+-
+-Y coord
+-
+--- structA-hoverdef --
+-```go
+-field a int
+-```
+-
+-a field
+-
+--- structB-hoverdef --
+-```go
+-field b struct{c int}
+-```
+-
+-b nested struct
+-
+--- structC-hoverdef --
+-```go
+-field c int
+-```
+-
+-c field of nested struct
+-
+--- testDescription-hoverdef --
+-```go
+-field desc string
+-```
+-
+-test description
+-
+--- testInput-hoverdef --
+-```go
+-field in map[string][]struct{key string; value interface{}}
+-```
+-
+-test input
+-
+--- testInputKey-hoverdef --
+-```go
+-field key string
+-```
+-
+-test key
+-
+--- testInputValue-hoverdef --
+-```go
+-field value interface{}
+-```
+-
+-test value
+-
+--- testResultValue-hoverdef --
+-```go
+-field value int
+-```
+-
+-expected test value
+-
+diff -urN a/gopls/internal/lsp/testdata/godef/b/e.go b/gopls/internal/lsp/testdata/godef/b/e.go
+--- a/gopls/internal/lsp/testdata/godef/b/e.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/godef/b/e.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,31 +0,0 @@
+-package b
+-
+-import (
+- "fmt"
+-
+- "golang.org/lsptests/godef/a"
+-)
+-
+-func useThings() {
+- t := a.Thing{} //@mark(bStructType, "ing")
+- fmt.Print(t.Member) //@mark(bMember, "ember")
+- fmt.Print(a.Other) //@mark(bVar, "ther")
+- a.Things() //@mark(bFunc, "ings")
+-}
+-
+-/*@
+-godef(bStructType, Thing)
+-godef(bMember, Member)
+-godef(bVar, Other)
+-godef(bFunc, Things)
+-*/
+-
+-func _() {
+- var x interface{} //@mark(eInterface, "interface{}")
+- switch x := x.(type) { //@hoverdef("x", eInterface)
+- case string: //@mark(eString, "string")
+- fmt.Println(x) //@hoverdef("x", eString)
+- case int: //@mark(eInt, "int")
+- fmt.Println(x) //@hoverdef("x", eInt)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/godef/b/e.go.golden b/gopls/internal/lsp/testdata/godef/b/e.go.golden
+--- a/gopls/internal/lsp/testdata/godef/b/e.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/godef/b/e.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,156 +0,0 @@
+--- Member-definition --
+-godef/a/d.go:6:2-8: defined here as ```go
+-field Member string
+-```
+-
+-@Member
+-
+-
+-[`(a.Thing).Member` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing.Member)
+--- Member-definition-json --
+-{
+- "span": {
+- "uri": "file://godef/a/d.go",
+- "start": {
+- "line": 6,
+- "column": 2,
+- "offset": 90
+- },
+- "end": {
+- "line": 6,
+- "column": 8,
+- "offset": 96
+- }
+- },
+- "description": "```go\nfield Member string\n```\n\n@Member\n\n\n[`(a.Thing).Member` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing.Member)"
+-}
+-
+--- Member-hoverdef --
+-```go
+-field Member string
+-```
+-
+-@Member
+-
+-
+-[`(a.Thing).Member` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing.Member)
+--- Other-definition --
+-godef/a/d.go:9:5-10: defined here as ```go
+-var a.Other a.Thing
+-```
+-
+-@Other
+-
+-
+-[`a.Other` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Other)
+--- Other-definition-json --
+-{
+- "span": {
+- "uri": "file://godef/a/d.go",
+- "start": {
+- "line": 9,
+- "column": 5,
+- "offset": 121
+- },
+- "end": {
+- "line": 9,
+- "column": 10,
+- "offset": 126
+- }
+- },
+- "description": "```go\nvar a.Other a.Thing\n```\n\n@Other\n\n\n[`a.Other` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Other)"
+-}
+-
+--- Other-hoverdef --
+-```go
+-var a.Other a.Thing
+-```
+-
+-@Other
+-
+-
+-[`a.Other` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Other)
+--- Thing-definition --
+-godef/a/d.go:5:6-11: defined here as ```go
+-type Thing struct {
+- Member string //@Member
+-}
+-
+-func (a.Thing).Method(i int) string
+-func (*a.Thing).Method2(i int, j int) (error, string)
+-func (a.Thing).Method3()
+-```
+-
+-[`a.Thing` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing)
+--- Thing-definition-json --
+-{
+- "span": {
+- "uri": "file://godef/a/d.go",
+- "start": {
+- "line": 5,
+- "column": 6,
+- "offset": 65
+- },
+- "end": {
+- "line": 5,
+- "column": 11,
+- "offset": 70
+- }
+- },
+- "description": "```go\ntype Thing struct {\n\tMember string //@Member\n}\n\nfunc (a.Thing).Method(i int) string\nfunc (*a.Thing).Method2(i int, j int) (error, string)\nfunc (a.Thing).Method3()\n```\n\n[`a.Thing` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing)"
+-}
+-
+--- Thing-hoverdef --
+-```go
+-type Thing struct {
+- Member string //@Member
+-}
+-
+-func (a.Thing).Method(i int) string
+-func (*a.Thing).Method2(i int, j int) (error, string)
+-func (a.Thing).Method3()
+-```
+-
+-[`a.Thing` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Thing)
+--- Things-definition --
+-godef/a/d.go:11:6-12: defined here as ```go
+-func a.Things(val []string) []a.Thing
+-```
+-
+-[`a.Things` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Things)
+--- Things-definition-json --
+-{
+- "span": {
+- "uri": "file://godef/a/d.go",
+- "start": {
+- "line": 11,
+- "column": 6,
+- "offset": 148
+- },
+- "end": {
+- "line": 11,
+- "column": 12,
+- "offset": 154
+- }
+- },
+- "description": "```go\nfunc a.Things(val []string) []a.Thing\n```\n\n[`a.Things` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Things)"
+-}
+-
+--- Things-hoverdef --
+-```go
+-func a.Things(val []string) []a.Thing
+-```
+-
+-[`a.Things` on pkg.go.dev](https://pkg.go.dev/golang.org/lsptests/godef/a#Things)
+--- eInt-hoverdef --
+-```go
+-var x int
+-```
+--- eInterface-hoverdef --
+-```go
+-var x interface{}
+-```
+--- eString-hoverdef --
+-```go
+-var x string
+-```
+diff -urN a/gopls/internal/lsp/testdata/godef/broken/unclosedIf.go.golden b/gopls/internal/lsp/testdata/godef/broken/unclosedIf.go.golden
+--- a/gopls/internal/lsp/testdata/godef/broken/unclosedIf.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/godef/broken/unclosedIf.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,31 +0,0 @@
+--- myUnclosedIf-definition --
+-godef/broken/unclosedIf.go:7:7-19: defined here as ```go
+-var myUnclosedIf string
+-```
+-
+-@myUnclosedIf
+--- myUnclosedIf-definition-json --
+-{
+- "span": {
+- "uri": "file://godef/broken/unclosedIf.go",
+- "start": {
+- "line": 7,
+- "column": 7,
+- "offset": 68
+- },
+- "end": {
+- "line": 7,
+- "column": 19,
+- "offset": 80
+- }
+- },
+- "description": "```go\nvar myUnclosedIf string\n```\n\n@myUnclosedIf"
+-}
+-
+--- myUnclosedIf-hoverdef --
+-```go
+-var myUnclosedIf string
+-```
+-
+-@myUnclosedIf
+-
+diff -urN a/gopls/internal/lsp/testdata/godef/broken/unclosedIf.go.in b/gopls/internal/lsp/testdata/godef/broken/unclosedIf.go.in
+--- a/gopls/internal/lsp/testdata/godef/broken/unclosedIf.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/godef/broken/unclosedIf.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package broken
+-
+-import "fmt"
+-
+-func unclosedIf() {
+- if false {
+- var myUnclosedIf string //@myUnclosedIf
+- fmt.Printf("s = %v\n", myUnclosedIf) //@godef("my", myUnclosedIf)
+-}
+diff -urN a/gopls/internal/lsp/testdata/good/good0.go b/gopls/internal/lsp/testdata/good/good0.go
+--- a/gopls/internal/lsp/testdata/good/good0.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/good/good0.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-package good //@diag("package", "no_diagnostics", "", "error")
+-
+-func stuff() { //@item(good_stuff, "stuff", "func()", "func"),prepare("stu", "stuff", "stuff")
+- x := 5
+- random2(x) //@prepare("dom", "random2", "random2")
+-}
+diff -urN a/gopls/internal/lsp/testdata/good/good1.go b/gopls/internal/lsp/testdata/good/good1.go
+--- a/gopls/internal/lsp/testdata/good/good1.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/good/good1.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,21 +0,0 @@
+-package good //@diag("package", "no_diagnostics", "", "error")
+-
+-import (
+- "golang.org/lsptests/types" //@item(types_import, "types", "\"golang.org/lsptests/types\"", "package")
+-)
+-
+-func random() int { //@item(good_random, "random", "func() int", "func")
+- _ = "random() int" //@prepare("random", "", "")
+- y := 6 + 7 //@prepare("7", "", "")
+- return y //@prepare("return", "","")
+-}
+-
+-func random2(y int) int { //@item(good_random2, "random2", "func(y int) int", "func"),item(good_y_param, "y", "int", "var")
+- //@complete("", good_y_param, types_import, good_random, good_random2, good_stuff)
+- var b types.Bob = &types.X{} //@prepare("ypes","types", "types")
+- if _, ok := b.(*types.X); ok { //@complete("X", X_struct, Y_struct, Bob_interface, CoolAlias)
+- _ = 0 // suppress "empty branch" diagnostic
+- }
+-
+- return y
+-}
+diff -urN a/gopls/internal/lsp/testdata/highlights/highlights.go b/gopls/internal/lsp/testdata/highlights/highlights.go
+--- a/gopls/internal/lsp/testdata/highlights/highlights.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/highlights/highlights.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,151 +0,0 @@
+-package highlights
+-
+-import (
+- "fmt" //@mark(fmtImp, "\"fmt\""),highlight(fmtImp, fmtImp, fmt1, fmt2, fmt3, fmt4)
+- h2 "net/http" //@mark(hImp, "h2"),highlight(hImp, hImp, hUse)
+- "sort"
+-)
+-
+-type F struct{ bar int } //@mark(barDeclaration, "bar"),highlight(barDeclaration, barDeclaration, bar1, bar2, bar3)
+-
+-func _() F {
+- return F{
+- bar: 123, //@mark(bar1, "bar"),highlight(bar1, barDeclaration, bar1, bar2, bar3)
+- }
+-}
+-
+-var foo = F{bar: 52} //@mark(fooDeclaration, "foo"),mark(bar2, "bar"),highlight(fooDeclaration, fooDeclaration, fooUse),highlight(bar2, barDeclaration, bar1, bar2, bar3)
+-
+-func Print() { //@mark(printFunc, "Print"),highlight(printFunc, printFunc, printTest)
+- _ = h2.Client{} //@mark(hUse, "h2"),highlight(hUse, hImp, hUse)
+-
+- fmt.Println(foo) //@mark(fooUse, "foo"),highlight(fooUse, fooDeclaration, fooUse),mark(fmt1, "fmt"),highlight(fmt1, fmtImp, fmt1, fmt2, fmt3, fmt4)
+- fmt.Print("yo") //@mark(printSep, "Print"),highlight(printSep, printSep, print1, print2),mark(fmt2, "fmt"),highlight(fmt2, fmtImp, fmt1, fmt2, fmt3, fmt4)
+-}
+-
+-func (x *F) Inc() { //@mark(xRightDecl, "x"),mark(xLeftDecl, " *"),highlight(xRightDecl, xRightDecl, xUse),highlight(xLeftDecl, xRightDecl, xUse)
+- x.bar++ //@mark(xUse, "x"),mark(bar3, "bar"),highlight(xUse, xRightDecl, xUse),highlight(bar3, barDeclaration, bar1, bar2, bar3)
+-}
+-
+-func testFunctions() {
+- fmt.Print("main start") //@mark(print1, "Print"),highlight(print1, printSep, print1, print2),mark(fmt3, "fmt"),highlight(fmt3, fmtImp, fmt1, fmt2, fmt3, fmt4)
+- fmt.Print("ok") //@mark(print2, "Print"),highlight(print2, printSep, print1, print2),mark(fmt4, "fmt"),highlight(fmt4, fmtImp, fmt1, fmt2, fmt3, fmt4)
+- Print() //@mark(printTest, "Print"),highlight(printTest, printFunc, printTest)
+-}
+-
+-func toProtocolHighlight(rngs []int) []DocumentHighlight { //@mark(doc1, "DocumentHighlight"),mark(docRet1, "[]DocumentHighlight"),highlight(doc1, docRet1, doc1, doc2, doc3, result)
+- result := make([]DocumentHighlight, 0, len(rngs)) //@mark(doc2, "DocumentHighlight"),highlight(doc2, doc1, doc2, doc3)
+- for _, rng := range rngs {
+- result = append(result, DocumentHighlight{ //@mark(doc3, "DocumentHighlight"),highlight(doc3, doc1, doc2, doc3)
+- Range: rng,
+- })
+- }
+- return result //@mark(result, "result")
+-}
+-
+-func testForLoops() {
+- for i := 0; i < 10; i++ { //@mark(forDecl1, "for"),highlight(forDecl1, forDecl1, brk1, cont1)
+- if i > 8 {
+- break //@mark(brk1, "break"),highlight(brk1, forDecl1, brk1, cont1)
+- }
+- if i < 2 {
+- for j := 1; j < 10; j++ { //@mark(forDecl2, "for"),highlight(forDecl2, forDecl2, cont2)
+- if j < 3 {
+- for k := 1; k < 10; k++ { //@mark(forDecl3, "for"),highlight(forDecl3, forDecl3, cont3)
+- if k < 3 {
+- continue //@mark(cont3, "continue"),highlight(cont3, forDecl3, cont3)
+- }
+- }
+- continue //@mark(cont2, "continue"),highlight(cont2, forDecl2, cont2)
+- }
+- }
+- continue //@mark(cont1, "continue"),highlight(cont1, forDecl1, brk1, cont1)
+- }
+- }
+-
+- arr := []int{}
+- for i := range arr { //@mark(forDecl4, "for"),highlight(forDecl4, forDecl4, brk4, cont4)
+- if i > 8 {
+- break //@mark(brk4, "break"),highlight(brk4, forDecl4, brk4, cont4)
+- }
+- if i < 4 {
+- continue //@mark(cont4, "continue"),highlight(cont4, forDecl4, brk4, cont4)
+- }
+- }
+-
+-Outer:
+- for i := 0; i < 10; i++ { //@mark(forDecl5, "for"),highlight(forDecl5, forDecl5, brk5, brk6, brk8)
+- break //@mark(brk5, "break"),highlight(brk5, forDecl5, brk5, brk6, brk8)
+- for { //@mark(forDecl6, "for"),highlight(forDecl6, forDecl6, cont5)
+- if i == 1 {
+- break Outer //@mark(brk6, "break Outer"),highlight(brk6, forDecl5, brk5, brk6, brk8)
+- }
+- switch i { //@mark(switch1, "switch"),highlight(switch1, switch1, brk7)
+- case 5:
+- break //@mark(brk7, "break"),highlight(brk7, switch1, brk7)
+- case 6:
+- continue //@mark(cont5, "continue"),highlight(cont5, forDecl6, cont5)
+- case 7:
+- break Outer //@mark(brk8, "break Outer"),highlight(brk8, forDecl5, brk5, brk6, brk8)
+- }
+- }
+- }
+-}
+-
+-func testSwitch() {
+- var i, j int
+-
+-L1:
+- for { //@mark(forDecl7, "for"),highlight(forDecl7, forDecl7, brk10, cont6)
+- L2:
+- switch i { //@mark(switch2, "switch"),highlight(switch2, switch2, brk11, brk12, brk13)
+- case 1:
+- switch j { //@mark(switch3, "switch"),highlight(switch3, switch3, brk9)
+- case 1:
+- break //@mark(brk9, "break"),highlight(brk9, switch3, brk9)
+- case 2:
+- break L1 //@mark(brk10, "break L1"),highlight(brk10, forDecl7, brk10, cont6)
+- case 3:
+- break L2 //@mark(brk11, "break L2"),highlight(brk11, switch2, brk11, brk12, brk13)
+- default:
+- continue //@mark(cont6, "continue"),highlight(cont6, forDecl7, brk10, cont6)
+- }
+- case 2:
+- break //@mark(brk12, "break"),highlight(brk12, switch2, brk11, brk12, brk13)
+- default:
+- break L2 //@mark(brk13, "break L2"),highlight(brk13, switch2, brk11, brk12, brk13)
+- }
+- }
+-}
+-
+-func testReturn() bool { //@mark(func1, "func"),mark(bool1, "bool"),highlight(func1, func1, fullRet11, fullRet12),highlight(bool1, bool1, false1, bool2, true1)
+- if 1 < 2 {
+- return false //@mark(ret11, "return"),mark(fullRet11, "return false"),mark(false1, "false"),highlight(ret11, func1, fullRet11, fullRet12)
+- }
+- candidates := []int{}
+- sort.SliceStable(candidates, func(i, j int) bool { //@mark(func2, "func"),mark(bool2, "bool"),highlight(func2, func2, fullRet2)
+- return candidates[i] > candidates[j] //@mark(ret2, "return"),mark(fullRet2, "return candidates[i] > candidates[j]"),highlight(ret2, func2, fullRet2)
+- })
+- return true //@mark(ret12, "return"),mark(fullRet12, "return true"),mark(true1, "true"),highlight(ret12, func1, fullRet11, fullRet12)
+-}
+-
+-func testReturnFields() float64 { //@mark(retVal1, "float64"),highlight(retVal1, retVal1, retVal11, retVal21)
+- if 1 < 2 {
+- return 20.1 //@mark(retVal11, "20.1"),highlight(retVal11, retVal1, retVal11, retVal21)
+- }
+- z := 4.3 //@mark(zDecl, "z")
+- return z //@mark(retVal21, "z"),highlight(retVal21, retVal1, retVal11, zDecl, retVal21)
+-}
+-
+-func testReturnMultipleFields() (float32, string) { //@mark(retVal31, "float32"),mark(retVal32, "string"),highlight(retVal31, retVal31, retVal41, retVal51),highlight(retVal32, retVal32, retVal42, retVal52)
+- y := "im a var" //@mark(yDecl, "y"),
+- if 1 < 2 {
+- return 20.1, y //@mark(retVal41, "20.1"),mark(retVal42, "y"),highlight(retVal41, retVal31, retVal41, retVal51),highlight(retVal42, retVal32, yDecl, retVal42, retVal52)
+- }
+- return 4.9, "test" //@mark(retVal51, "4.9"),mark(retVal52, "\"test\""),highlight(retVal51, retVal31, retVal41, retVal51),highlight(retVal52, retVal32, retVal42, retVal52)
+-}
+-
+-func testReturnFunc() int32 { //@mark(retCall, "int32")
+- mulch := 1 //@mark(mulchDec, "mulch"),highlight(mulchDec, mulchDec, mulchRet)
+- return int32(mulch) //@mark(mulchRet, "mulch"),mark(retFunc, "int32"),mark(retTotal, "int32(mulch)"),highlight(mulchRet, mulchDec, mulchRet),highlight(retFunc, retCall, retFunc, retTotal)
+-}
+diff -urN a/gopls/internal/lsp/testdata/implementation/implementation_generics.go b/gopls/internal/lsp/testdata/implementation/implementation_generics.go
+--- a/gopls/internal/lsp/testdata/implementation/implementation_generics.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/implementation/implementation_generics.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+-//go:build go1.18
+-// +build go1.18
+-
+-package implementation
+-
+-// -- generics --
+-
+-type GenIface[T any] interface { //@mark(GenIface, "GenIface"),implementations("GenIface", GC)
+- F(int, string, T) //@mark(GenIfaceF, "F"),implementations("F", GCF)
+-}
+-
+-type GenConc[U any] int //@mark(GenConc, "GenConc"),implementations("GenConc", GI)
+-
+-func (GenConc[V]) F(int, string, V) {} //@mark(GenConcF, "F"),implementations("F", GIF)
+-
+-type GenConcString struct{ GenConc[string] } //@mark(GenConcString, "GenConcString"),implementations(GenConcString, GIString)
+diff -urN a/gopls/internal/lsp/testdata/implementation/implementation.go b/gopls/internal/lsp/testdata/implementation/implementation.go
+--- a/gopls/internal/lsp/testdata/implementation/implementation.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/implementation/implementation.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,37 +0,0 @@
+-package implementation
+-
+-import "golang.org/lsptests/implementation/other"
+-
+-type ImpP struct{} //@ImpP,implementations("ImpP", Laugher, OtherLaugher)
+-
+-func (*ImpP) Laugh() { //@mark(LaughP, "Laugh"),implementations("Laugh", Laugh, OtherLaugh)
+-}
+-
+-type ImpS struct{} //@ImpS,implementations("ImpS", Laugher, OtherLaugher)
+-
+-func (ImpS) Laugh() { //@mark(LaughS, "Laugh"),implementations("Laugh", Laugh, OtherLaugh)
+-}
+-
+-type Laugher interface { //@Laugher,implementations("Laugher", ImpP, OtherImpP, ImpS, OtherImpS, embedsImpP)
+- Laugh() //@Laugh,implementations("Laugh", LaughP, OtherLaughP, LaughS, OtherLaughS)
+-}
+-
+-type Foo struct { //@implementations("Foo", Joker)
+- other.Foo
+-}
+-
+-type Joker interface { //@Joker
+- Joke() //@Joke,implementations("Joke", ImpJoker)
+-}
+-
+-type cryer int //@implementations("cryer", Cryer)
+-
+-func (cryer) Cry(other.CryType) {} //@mark(CryImpl, "Cry"),implementations("Cry", Cry)
+-
+-type Empty interface{} //@implementations("Empty")
+-
+-var _ interface{ Joke() } //@implementations("Joke", ImpJoker)
+-
+-type embedsImpP struct { //@embedsImpP
+- ImpP //@implementations("ImpP", Laugher, OtherLaugher)
+-}
+diff -urN a/gopls/internal/lsp/testdata/implementation/other/other_generics.go b/gopls/internal/lsp/testdata/implementation/other/other_generics.go
+--- a/gopls/internal/lsp/testdata/implementation/other/other_generics.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/implementation/other/other_generics.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+-//go:build go1.18
+-// +build go1.18
+-
+-package other
+-
+-// -- generics (limited support) --
+-
+-type GI[T any] interface { //@mark(GI, "GI"),implementations("GI", GenConc)
+- F(int, string, T) //@mark(GIF, "F"),implementations("F", GenConcF)
+-}
+-
+-type GIString GI[string] //@mark(GIString, "GIString"),implementations("GIString", GenConcString)
+-
+-type GC[U any] int //@mark(GC, "GC"),implementations("GC", GenIface)
+-
+-func (GC[V]) F(int, string, V) {} //@mark(GCF, "F"),implementations("F", GenIfaceF)
+diff -urN a/gopls/internal/lsp/testdata/implementation/other/other.go b/gopls/internal/lsp/testdata/implementation/other/other.go
+--- a/gopls/internal/lsp/testdata/implementation/other/other.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/implementation/other/other.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,27 +0,0 @@
+-package other
+-
+-type ImpP struct{} //@mark(OtherImpP, "ImpP")
+-
+-func (*ImpP) Laugh() { //@mark(OtherLaughP, "Laugh")
+-}
+-
+-type ImpS struct{} //@mark(OtherImpS, "ImpS")
+-
+-func (ImpS) Laugh() { //@mark(OtherLaughS, "Laugh")
+-}
+-
+-type ImpI interface { //@mark(OtherLaugher, "ImpI")
+- Laugh() //@mark(OtherLaugh, "Laugh")
+-}
+-
+-type Foo struct { //@implementations("Foo", Joker)
+-}
+-
+-func (Foo) Joke() { //@mark(ImpJoker, "Joke"),implementations("Joke", Joke)
+-}
+-
+-type CryType int
+-
+-type Cryer interface { //@Cryer
+- Cry(CryType) //@Cry,implementations("Cry", CryImpl)
+-}
+diff -urN a/gopls/internal/lsp/testdata/implementation/other/other_test.go b/gopls/internal/lsp/testdata/implementation/other/other_test.go
+--- a/gopls/internal/lsp/testdata/implementation/other/other_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/implementation/other/other_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-package other
+-
+-import (
+- "testing"
+-)
+-
+-// This exists so the other.test package comes into existence.
+-
+-func TestOther(t *testing.T) {
+-}
+diff -urN a/gopls/internal/lsp/testdata/importedcomplit/imported_complit.go.in b/gopls/internal/lsp/testdata/importedcomplit/imported_complit.go.in
+--- a/gopls/internal/lsp/testdata/importedcomplit/imported_complit.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/importedcomplit/imported_complit.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,42 +0,0 @@
+-package importedcomplit
+-
+-import (
+- "golang.org/lsptests/foo"
+-
+- // import completions
+- "fm" //@complete("\" //", fmtImport)
+- "go/pars" //@complete("\" //", parserImport)
+- "golang.org/lsptests/signa" //@complete("na\" //", signatureImport)
+- "golang.org/lspte" //@complete("\" //", lsptestsImport)
+- "crypto/elli" //@complete("\" //", cryptoImport)
+- "golang.org/lsptests/sign" //@complete("\" //", signatureImport)
+- "golang.org/lsptests/sign" //@complete("ests", lsptestsImport)
+- namedParser "go/pars" //@complete("\" //", parserImport)
+-)
+-
+-func _() {
+- var V int //@item(icVVar, "V", "int", "var")
+- _ = foo.StructFoo{V} //@complete("}", Value, icVVar)
+-}
+-
+-func _() {
+- var (
+- aa string //@item(icAAVar, "aa", "string", "var")
+- ab int //@item(icABVar, "ab", "int", "var")
+- )
+-
+- _ = foo.StructFoo{a} //@complete("}", abVar, aaVar)
+-
+- var s struct {
+- AA string //@item(icFieldAA, "AA", "string", "field")
+- AB int //@item(icFieldAB, "AB", "int", "field")
+- }
+-
+- _ = foo.StructFoo{s.} //@complete("}", icFieldAB, icFieldAA)
+-}
+-
+-/* "fmt" */ //@item(fmtImport, "fmt", "\"fmt\"", "package")
+-/* "go/parser" */ //@item(parserImport, "parser", "\"go/parser\"", "package")
+-/* "golang.org/lsptests/signature" */ //@item(signatureImport, "signature", "\"golang.org/lsptests/signature\"", "package")
+-/* "golang.org/lsptests/" */ //@item(lsptestsImport, "lsptests/", "\"golang.org/lsptests/\"", "package")
+-/* "crypto/elliptic" */ //@item(cryptoImport, "elliptic", "\"crypto/elliptic\"", "package")
+diff -urN a/gopls/internal/lsp/testdata/imports/add_import.go.golden b/gopls/internal/lsp/testdata/imports/add_import.go.golden
+--- a/gopls/internal/lsp/testdata/imports/add_import.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/add_import.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+--- goimports --
+-package imports //@import("package")
+-
+-import (
+- "bytes"
+- "fmt"
+-)
+-
+-func _() {
+- fmt.Println("")
+- bytes.NewBuffer(nil)
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/imports/add_import.go.in b/gopls/internal/lsp/testdata/imports/add_import.go.in
+--- a/gopls/internal/lsp/testdata/imports/add_import.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/add_import.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-package imports //@import("package")
+-
+-import (
+- "fmt"
+-)
+-
+-func _() {
+- fmt.Println("")
+- bytes.NewBuffer(nil)
+-}
+diff -urN a/gopls/internal/lsp/testdata/imports/good_imports.go.golden b/gopls/internal/lsp/testdata/imports/good_imports.go.golden
+--- a/gopls/internal/lsp/testdata/imports/good_imports.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/good_imports.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+--- goimports --
+-package imports //@import("package")
+-
+-import "fmt"
+-
+-func _() {
+-fmt.Println("")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/imports/good_imports.go.in b/gopls/internal/lsp/testdata/imports/good_imports.go.in
+--- a/gopls/internal/lsp/testdata/imports/good_imports.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/good_imports.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-package imports //@import("package")
+-
+-import "fmt"
+-
+-func _() {
+-fmt.Println("")
+-}
+diff -urN a/gopls/internal/lsp/testdata/imports/issue35458.go.golden b/gopls/internal/lsp/testdata/imports/issue35458.go.golden
+--- a/gopls/internal/lsp/testdata/imports/issue35458.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/issue35458.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,20 +0,0 @@
+--- goimports --
+-// package doc
+-package imports //@import("package")
+-
+-
+-
+-
+-
+-
+-func _() {
+- println("Hello, world!")
+-}
+-
+-
+-
+-
+-
+-
+-
+-
+diff -urN a/gopls/internal/lsp/testdata/imports/issue35458.go.in b/gopls/internal/lsp/testdata/imports/issue35458.go.in
+--- a/gopls/internal/lsp/testdata/imports/issue35458.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/issue35458.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,23 +0,0 @@
+-
+-
+-
+-
+-
+-// package doc
+-package imports //@import("package")
+-
+-
+-
+-
+-
+-
+-func _() {
+- println("Hello, world!")
+-}
+-
+-
+-
+-
+-
+-
+-
+diff -urN a/gopls/internal/lsp/testdata/imports/multiple_blocks.go.golden b/gopls/internal/lsp/testdata/imports/multiple_blocks.go.golden
+--- a/gopls/internal/lsp/testdata/imports/multiple_blocks.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/multiple_blocks.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+--- goimports --
+-package imports //@import("package")
+-
+-import "fmt"
+-
+-func _() {
+- fmt.Println("")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/imports/multiple_blocks.go.in b/gopls/internal/lsp/testdata/imports/multiple_blocks.go.in
+--- a/gopls/internal/lsp/testdata/imports/multiple_blocks.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/multiple_blocks.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package imports //@import("package")
+-
+-import "fmt"
+-
+-import "bytes"
+-
+-func _() {
+- fmt.Println("")
+-}
+diff -urN a/gopls/internal/lsp/testdata/imports/needs_imports.go.golden b/gopls/internal/lsp/testdata/imports/needs_imports.go.golden
+--- a/gopls/internal/lsp/testdata/imports/needs_imports.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/needs_imports.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+--- goimports --
+-package imports //@import("package")
+-
+-import (
+- "fmt"
+- "log"
+-)
+-
+-func goodbye() {
+- fmt.Printf("HI")
+- log.Printf("byeeeee")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/imports/needs_imports.go.in b/gopls/internal/lsp/testdata/imports/needs_imports.go.in
+--- a/gopls/internal/lsp/testdata/imports/needs_imports.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/needs_imports.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-package imports //@import("package")
+-
+-func goodbye() {
+- fmt.Printf("HI")
+- log.Printf("byeeeee")
+-}
+diff -urN a/gopls/internal/lsp/testdata/imports/remove_import.go.golden b/gopls/internal/lsp/testdata/imports/remove_import.go.golden
+--- a/gopls/internal/lsp/testdata/imports/remove_import.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/remove_import.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+--- goimports --
+-package imports //@import("package")
+-
+-import (
+- "fmt"
+-)
+-
+-func _() {
+- fmt.Println("")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/imports/remove_import.go.in b/gopls/internal/lsp/testdata/imports/remove_import.go.in
+--- a/gopls/internal/lsp/testdata/imports/remove_import.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/remove_import.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-package imports //@import("package")
+-
+-import (
+- "bytes"
+- "fmt"
+-)
+-
+-func _() {
+- fmt.Println("")
+-}
+diff -urN a/gopls/internal/lsp/testdata/imports/remove_imports.go.golden b/gopls/internal/lsp/testdata/imports/remove_imports.go.golden
+--- a/gopls/internal/lsp/testdata/imports/remove_imports.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/remove_imports.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+--- goimports --
+-package imports //@import("package")
+-
+-func _() {
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/imports/remove_imports.go.in b/gopls/internal/lsp/testdata/imports/remove_imports.go.in
+--- a/gopls/internal/lsp/testdata/imports/remove_imports.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/remove_imports.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package imports //@import("package")
+-
+-import (
+- "bytes"
+- "fmt"
+-)
+-
+-func _() {
+-}
+diff -urN a/gopls/internal/lsp/testdata/imports/two_lines.go.golden b/gopls/internal/lsp/testdata/imports/two_lines.go.golden
+--- a/gopls/internal/lsp/testdata/imports/two_lines.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/two_lines.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,4 +0,0 @@
+--- goimports --
+-package main
+-func main() {} //@import("main")
+-
+diff -urN a/gopls/internal/lsp/testdata/imports/two_lines.go.in b/gopls/internal/lsp/testdata/imports/two_lines.go.in
+--- a/gopls/internal/lsp/testdata/imports/two_lines.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/imports/two_lines.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,2 +0,0 @@
+-package main
+-func main() {} //@import("main")
+diff -urN a/gopls/internal/lsp/testdata/index/index.go b/gopls/internal/lsp/testdata/index/index.go
+--- a/gopls/internal/lsp/testdata/index/index.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/index/index.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,25 +0,0 @@
+-package index
+-
+-func _() {
+- var (
+- aa = "123" //@item(indexAA, "aa", "string", "var")
+- ab = 123 //@item(indexAB, "ab", "int", "var")
+- )
+-
+- var foo [1]int
+- foo[a] //@complete("]", indexAB, indexAA)
+- foo[:a] //@complete("]", indexAB, indexAA)
+- a[:a] //@complete("[", indexAA, indexAB)
+- a[a] //@complete("[", indexAA, indexAB)
+-
+- var bar map[string]int
+- bar[a] //@complete("]", indexAA, indexAB)
+-
+- type myMap map[string]int
+- var baz myMap
+- baz[a] //@complete("]", indexAA, indexAB)
+-
+- type myInt int
+- var mi myInt //@item(indexMyInt, "mi", "myInt", "var")
+- foo[m] //@snippet("]", indexMyInt, "mi", "mi")
+-}
+diff -urN a/gopls/internal/lsp/testdata/inlay_hint/composite_literals.go b/gopls/internal/lsp/testdata/inlay_hint/composite_literals.go
+--- a/gopls/internal/lsp/testdata/inlay_hint/composite_literals.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/inlay_hint/composite_literals.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,27 +0,0 @@
+-package inlayHint //@inlayHint("package")
+-
+-import "fmt"
+-
+-func fieldNames() {
+- for _, c := range []struct {
+- in, want string
+- }{
+- struct{ in, want string }{"Hello, world", "dlrow ,olleH"},
+- {"Hello, 世界", "界世 ,olleH"},
+- {"", ""},
+- } {
+- fmt.Println(c.in == c.want)
+- }
+-}
+-
+-func fieldNamesPointers() {
+- for _, c := range []*struct {
+- in, want string
+- }{
+- &struct{ in, want string }{"Hello, world", "dlrow ,olleH"},
+- {"Hello, 世界", "界世 ,olleH"},
+- {"", ""},
+- } {
+- fmt.Println(c.in == c.want)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/inlay_hint/composite_literals.go.golden b/gopls/internal/lsp/testdata/inlay_hint/composite_literals.go.golden
+--- a/gopls/internal/lsp/testdata/inlay_hint/composite_literals.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/inlay_hint/composite_literals.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,29 +0,0 @@
+--- inlayHint --
+-package inlayHint //@inlayHint("package")
+-
+-import "fmt"
+-
+-func fieldNames() {
+- for _< int>, c< struct{in string; want string}> := range []struct {
+- in, want string
+- }{
+- struct{ in, want string }{<in: >"Hello, world", <want: >"dlrow ,olleH"},
+- <struct{in string; want string}>{<in: >"Hello, 世界", <want: >"界世 ,olleH"},
+- <struct{in string; want string}>{<in: >"", <want: >""},
+- } {
+- fmt.Println(<a...: >c.in == c.want)
+- }
+-}
+-
+-func fieldNamesPointers() {
+- for _< int>, c< *struct{in string; want string}> := range []*struct {
+- in, want string
+- }{
+- &struct{ in, want string }{<in: >"Hello, world", <want: >"dlrow ,olleH"},
+- <&struct{in string; want string}>{<in: >"Hello, 世界", <want: >"界世 ,olleH"},
+- <&struct{in string; want string}>{<in: >"", <want: >""},
+- } {
+- fmt.Println(<a...: >c.in == c.want)
+- }
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/inlay_hint/constant_values.go b/gopls/internal/lsp/testdata/inlay_hint/constant_values.go
+--- a/gopls/internal/lsp/testdata/inlay_hint/constant_values.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/inlay_hint/constant_values.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,45 +0,0 @@
+-package inlayHint //@inlayHint("package")
+-
+-const True = true
+-
+-type Kind int
+-
+-const (
+- KindNone Kind = iota
+- KindPrint
+- KindPrintf
+- KindErrorf
+-)
+-
+-const (
+- u = iota * 4
+- v float64 = iota * 42
+- w = iota * 42
+-)
+-
+-const (
+- a, b = 1, 2
+- c, d
+- e, f = 5 * 5, "hello" + "world"
+- g, h
+- i, j = true, f
+-)
+-
+-// No hint
+-const (
+- Int = 3
+- Float = 3.14
+- Bool = true
+- Rune = '3'
+- Complex = 2.7i
+- String = "Hello, world!"
+-)
+-
+-var (
+- varInt = 3
+- varFloat = 3.14
+- varBool = true
+- varRune = '3' + '4'
+- varComplex = 2.7i
+- varString = "Hello, world!"
+-)
+diff -urN a/gopls/internal/lsp/testdata/inlay_hint/constant_values.go.golden b/gopls/internal/lsp/testdata/inlay_hint/constant_values.go.golden
+--- a/gopls/internal/lsp/testdata/inlay_hint/constant_values.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/inlay_hint/constant_values.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,47 +0,0 @@
+--- inlayHint --
+-package inlayHint //@inlayHint("package")
+-
+-const True = true
+-
+-type Kind int
+-
+-const (
+- KindNone Kind = iota< = 0>
+- KindPrint< = 1>
+- KindPrintf< = 2>
+- KindErrorf< = 3>
+-)
+-
+-const (
+- u = iota * 4< = 0>
+- v float64 = iota * 42< = 42>
+- w = iota * 42< = 84>
+-)
+-
+-const (
+- a, b = 1, 2
+- c, d< = 1, 2>
+- e, f = 5 * 5, "hello" + "world"< = 25, "helloworld">
+- g, h< = 25, "helloworld">
+- i, j = true, f< = true, "helloworld">
+-)
+-
+-// No hint
+-const (
+- Int = 3
+- Float = 3.14
+- Bool = true
+- Rune = '3'
+- Complex = 2.7i
+- String = "Hello, world!"
+-)
+-
+-var (
+- varInt = 3
+- varFloat = 3.14
+- varBool = true
+- varRune = '3' + '4'
+- varComplex = 2.7i
+- varString = "Hello, world!"
+-)
+-
+diff -urN a/gopls/internal/lsp/testdata/inlay_hint/parameter_names.go b/gopls/internal/lsp/testdata/inlay_hint/parameter_names.go
+--- a/gopls/internal/lsp/testdata/inlay_hint/parameter_names.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/inlay_hint/parameter_names.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,50 +0,0 @@
+-package inlayHint //@inlayHint("package")
+-
+-import "fmt"
+-
+-func hello(name string) string {
+- return "Hello " + name
+-}
+-
+-func helloWorld() string {
+- return hello("World")
+-}
+-
+-type foo struct{}
+-
+-func (*foo) bar(baz string, qux int) int {
+- if baz != "" {
+- return qux + 1
+- }
+- return qux
+-}
+-
+-func kase(foo int, bar bool, baz ...string) {
+- fmt.Println(foo, bar, baz)
+-}
+-
+-func kipp(foo string, bar, baz string) {
+- fmt.Println(foo, bar, baz)
+-}
+-
+-func plex(foo, bar string, baz string) {
+- fmt.Println(foo, bar, baz)
+-}
+-
+-func tars(foo string, bar, baz string) {
+- fmt.Println(foo, bar, baz)
+-}
+-
+-func foobar() {
+- var x foo
+- x.bar("", 1)
+- kase(0, true, "c", "d", "e")
+- kipp("a", "b", "c")
+- plex("a", "b", "c")
+- tars("a", "b", "c")
+- foo, bar, baz := "a", "b", "c"
+- kipp(foo, bar, baz)
+- plex("a", bar, baz)
+- tars(foo+foo, (bar), "c")
+-
+-}
+diff -urN a/gopls/internal/lsp/testdata/inlay_hint/parameter_names.go.golden b/gopls/internal/lsp/testdata/inlay_hint/parameter_names.go.golden
+--- a/gopls/internal/lsp/testdata/inlay_hint/parameter_names.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/inlay_hint/parameter_names.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,52 +0,0 @@
+--- inlayHint --
+-package inlayHint //@inlayHint("package")
+-
+-import "fmt"
+-
+-func hello(name string) string {
+- return "Hello " + name
+-}
+-
+-func helloWorld() string {
+- return hello(<name: >"World")
+-}
+-
+-type foo struct{}
+-
+-func (*foo) bar(baz string, qux int) int {
+- if baz != "" {
+- return qux + 1
+- }
+- return qux
+-}
+-
+-func kase(foo int, bar bool, baz ...string) {
+- fmt.Println(<a...: >foo, bar, baz)
+-}
+-
+-func kipp(foo string, bar, baz string) {
+- fmt.Println(<a...: >foo, bar, baz)
+-}
+-
+-func plex(foo, bar string, baz string) {
+- fmt.Println(<a...: >foo, bar, baz)
+-}
+-
+-func tars(foo string, bar, baz string) {
+- fmt.Println(<a...: >foo, bar, baz)
+-}
+-
+-func foobar() {
+- var x foo
+- x.bar(<baz: >"", <qux: >1)
+- kase(<foo: >0, <bar: >true, <baz...: >"c", "d", "e")
+- kipp(<foo: >"a", <bar: >"b", <baz: >"c")
+- plex(<foo: >"a", <bar: >"b", <baz: >"c")
+- tars(<foo: >"a", <bar: >"b", <baz: >"c")
+- foo< string>, bar< string>, baz< string> := "a", "b", "c"
+- kipp(foo, bar, baz)
+- plex(<foo: >"a", bar, baz)
+- tars(<foo: >foo+foo, <bar: >(bar), <baz: >"c")
+-
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/inlay_hint/type_params.go b/gopls/internal/lsp/testdata/inlay_hint/type_params.go
+--- a/gopls/internal/lsp/testdata/inlay_hint/type_params.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/inlay_hint/type_params.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,45 +0,0 @@
+-//go:build go1.18
+-// +build go1.18
+-
+-package inlayHint //@inlayHint("package")
+-
+-func main() {
+- ints := map[string]int64{
+- "first": 34,
+- "second": 12,
+- }
+-
+- floats := map[string]float64{
+- "first": 35.98,
+- "second": 26.99,
+- }
+-
+- SumIntsOrFloats[string, int64](ints)
+- SumIntsOrFloats[string, float64](floats)
+-
+- SumIntsOrFloats(ints)
+- SumIntsOrFloats(floats)
+-
+- SumNumbers(ints)
+- SumNumbers(floats)
+-}
+-
+-type Number interface {
+- int64 | float64
+-}
+-
+-func SumIntsOrFloats[K comparable, V int64 | float64](m map[K]V) V {
+- var s V
+- for _, v := range m {
+- s += v
+- }
+- return s
+-}
+-
+-func SumNumbers[K comparable, V Number](m map[K]V) V {
+- var s V
+- for _, v := range m {
+- s += v
+- }
+- return s
+-}
+diff -urN a/gopls/internal/lsp/testdata/inlay_hint/type_params.go.golden b/gopls/internal/lsp/testdata/inlay_hint/type_params.go.golden
+--- a/gopls/internal/lsp/testdata/inlay_hint/type_params.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/inlay_hint/type_params.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,47 +0,0 @@
+--- inlayHint --
+-//go:build go1.18
+-// +build go1.18
+-
+-package inlayHint //@inlayHint("package")
+-
+-func main() {
+- ints< map[string]int64> := map[string]int64{
+- "first": 34,
+- "second": 12,
+- }
+-
+- floats< map[string]float64> := map[string]float64{
+- "first": 35.98,
+- "second": 26.99,
+- }
+-
+- SumIntsOrFloats[string, int64](<m: >ints)
+- SumIntsOrFloats[string, float64](<m: >floats)
+-
+- SumIntsOrFloats<[string, int64]>(<m: >ints)
+- SumIntsOrFloats<[string, float64]>(<m: >floats)
+-
+- SumNumbers<[string, int64]>(<m: >ints)
+- SumNumbers<[string, float64]>(<m: >floats)
+-}
+-
+-type Number interface {
+- int64 | float64
+-}
+-
+-func SumIntsOrFloats[K comparable, V int64 | float64](m map[K]V) V {
+- var s V
+- for _< K>, v< V> := range m {
+- s += v
+- }
+- return s
+-}
+-
+-func SumNumbers[K comparable, V Number](m map[K]V) V {
+- var s V
+- for _< K>, v< V> := range m {
+- s += v
+- }
+- return s
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/inlay_hint/variable_types.go b/gopls/internal/lsp/testdata/inlay_hint/variable_types.go
+--- a/gopls/internal/lsp/testdata/inlay_hint/variable_types.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/inlay_hint/variable_types.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,20 +0,0 @@
+-package inlayHint //@inlayHint("package")
+-
+-func assignTypes() {
+- i, j := 0, len([]string{})-1
+- println(i, j)
+-}
+-
+-func rangeTypes() {
+- for k, v := range []string{} {
+- println(k, v)
+- }
+-}
+-
+-func funcLitType() {
+- myFunc := func(a string) string { return "" }
+-}
+-
+-func compositeLitType() {
+- foo := map[string]interface{}{"": ""}
+-}
+diff -urN a/gopls/internal/lsp/testdata/inlay_hint/variable_types.go.golden b/gopls/internal/lsp/testdata/inlay_hint/variable_types.go.golden
+--- a/gopls/internal/lsp/testdata/inlay_hint/variable_types.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/inlay_hint/variable_types.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,22 +0,0 @@
+--- inlayHint --
+-package inlayHint //@inlayHint("package")
+-
+-func assignTypes() {
+- i< int>, j< int> := 0, len([]string{})-1
+- println(i, j)
+-}
+-
+-func rangeTypes() {
+- for k< int>, v< string> := range []string{} {
+- println(k, v)
+- }
+-}
+-
+-func funcLitType() {
+- myFunc< func(a string) string> := func(a string) string { return "" }
+-}
+-
+-func compositeLitType() {
+- foo< map[string]interface{}> := map[string]interface{}{"": ""}
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/interfacerank/interface_rank.go b/gopls/internal/lsp/testdata/interfacerank/interface_rank.go
+--- a/gopls/internal/lsp/testdata/interfacerank/interface_rank.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/interfacerank/interface_rank.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,23 +0,0 @@
+-package interfacerank
+-
+-type foo interface {
+- foo()
+-}
+-
+-type fooImpl int
+-
+-func (*fooImpl) foo() {}
+-
+-func wantsFoo(foo) {}
+-
+-func _() {
+- var (
+- aa string //@item(irAA, "aa", "string", "var")
+- ab *fooImpl //@item(irAB, "ab", "*fooImpl", "var")
+- )
+-
+- wantsFoo(a) //@complete(")", irAB, irAA)
+-
+- var ac fooImpl //@item(irAC, "ac", "fooImpl", "var")
+- wantsFoo(&a) //@complete(")", irAC, irAA, irAB)
+-}
+diff -urN a/gopls/internal/lsp/testdata/issues/issue56505.go b/gopls/internal/lsp/testdata/issues/issue56505.go
+--- a/gopls/internal/lsp/testdata/issues/issue56505.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/issues/issue56505.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-package issues
+-
+-// Test for golang/go#56505: completion on variables of type *error should not
+-// panic.
+-func _() {
+- var e *error
+- e.x //@complete(" //")
+-}
+diff -urN a/gopls/internal/lsp/testdata/keywords/accidental_keywords.go.in b/gopls/internal/lsp/testdata/keywords/accidental_keywords.go.in
+--- a/gopls/internal/lsp/testdata/keywords/accidental_keywords.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/keywords/accidental_keywords.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,31 +0,0 @@
+-package keywords
+-
+-// non-matching candidate - shouldn't show up as completion
+-var apple = "apple"
+-
+-func _() {
+- foo.bar() // insert some extra statements to exercise our AST surgery
+- variance := 123 //@item(kwVariance, "variance", "int", "var")
+- foo.bar()
+- println(var) //@complete(")", kwVariance)
+-}
+-
+-func _() {
+- foo.bar()
+- var s struct { variance int } //@item(kwVarianceField, "variance", "int", "field")
+- foo.bar()
+- s.var //@complete(" //", kwVarianceField)
+-}
+-
+-func _() {
+- channel := 123 //@item(kwChannel, "channel", "int", "var")
+- chan //@complete(" //", kwChannel)
+- foo.bar()
+-}
+-
+-func _() {
+- foo.bar()
+- var typeName string //@item(kwTypeName, "typeName", "string", "var")
+- foo.bar()
+- type //@complete(" //", kwTypeName)
+-}
+diff -urN a/gopls/internal/lsp/testdata/keywords/empty_select.go b/gopls/internal/lsp/testdata/keywords/empty_select.go
+--- a/gopls/internal/lsp/testdata/keywords/empty_select.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/keywords/empty_select.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-package keywords
+-
+-func _() {
+- select {
+- c //@complete(" //", case)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/keywords/empty_switch.go b/gopls/internal/lsp/testdata/keywords/empty_switch.go
+--- a/gopls/internal/lsp/testdata/keywords/empty_switch.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/keywords/empty_switch.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-package keywords
+-
+-func _() {
+- switch {
+- //@complete("", case, default)
+- }
+-
+- switch test.(type) {
+- d //@complete(" //", default)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/keywords/keywords.go b/gopls/internal/lsp/testdata/keywords/keywords.go
+--- a/gopls/internal/lsp/testdata/keywords/keywords.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/keywords/keywords.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,100 +0,0 @@
+-package keywords
+-
+-//@rank("", type),rank("", func),rank("", var),rank("", const),rank("", import)
+-
+-func _() {
+- var test int //@rank(" //", int, interface)
+- var tChan chan int
+- var _ m //@complete(" //", map)
+- var _ f //@complete(" //", func)
+- var _ c //@complete(" //", chan)
+-
+- var _ str //@rank(" //", string, struct)
+-
+- type _ int //@rank(" //", interface, int)
+-
+- type _ str //@rank(" //", struct, string)
+-
+- switch test {
+- case 1: // TODO: trying to complete case here will break because the parser won't return *ast.Ident
+- b //@complete(" //", break)
+- case 2:
+- f //@complete(" //", fallthrough, for)
+- r //@complete(" //", return)
+- d //@complete(" //", default, defer)
+- c //@complete(" //", case, const)
+- }
+-
+- switch test.(type) {
+- case fo: //@complete(":")
+- case int:
+- b //@complete(" //", break)
+- case int32:
+- f //@complete(" //", for)
+- d //@complete(" //", default, defer)
+- r //@complete(" //", return)
+- c //@complete(" //", case, const)
+- }
+-
+- select {
+- case <-tChan:
+- b //@complete(" //", break)
+- c //@complete(" //", case, const)
+- }
+-
+- for index := 0; index < test; index++ {
+- c //@complete(" //", const, continue)
+- b //@complete(" //", break)
+- }
+-
+- for range []int{} {
+- c //@complete(" //", const, continue)
+- b //@complete(" //", break)
+- }
+-
+- // Test function level keywords
+-
+- //Using 2 characters to test because map output order is random
+- sw //@complete(" //", switch)
+- se //@complete(" //", select)
+-
+- f //@complete(" //", for)
+- d //@complete(" //", defer)
+- g //@rank(" //", go),rank(" //", goto)
+- r //@complete(" //", return)
+- i //@complete(" //", if)
+- e //@complete(" //", else)
+- v //@complete(" //", var)
+- c //@complete(" //", const)
+-
+- for i := r //@complete(" //", range)
+-}
+-
+-/* package */ //@item(package, "package", "", "keyword")
+-/* import */ //@item(import, "import", "", "keyword")
+-/* func */ //@item(func, "func", "", "keyword")
+-/* type */ //@item(type, "type", "", "keyword")
+-/* var */ //@item(var, "var", "", "keyword")
+-/* const */ //@item(const, "const", "", "keyword")
+-/* break */ //@item(break, "break", "", "keyword")
+-/* default */ //@item(default, "default", "", "keyword")
+-/* case */ //@item(case, "case", "", "keyword")
+-/* defer */ //@item(defer, "defer", "", "keyword")
+-/* go */ //@item(go, "go", "", "keyword")
+-/* for */ //@item(for, "for", "", "keyword")
+-/* if */ //@item(if, "if", "", "keyword")
+-/* else */ //@item(else, "else", "", "keyword")
+-/* switch */ //@item(switch, "switch", "", "keyword")
+-/* select */ //@item(select, "select", "", "keyword")
+-/* fallthrough */ //@item(fallthrough, "fallthrough", "", "keyword")
+-/* continue */ //@item(continue, "continue", "", "keyword")
+-/* return */ //@item(return, "return", "", "keyword")
+-/* var */ //@item(var, "var", "", "keyword")
+-/* const */ //@item(const, "const", "", "keyword")
+-/* goto */ //@item(goto, "goto", "", "keyword")
+-/* struct */ //@item(struct, "struct", "", "keyword")
+-/* interface */ //@item(interface, "interface", "", "keyword")
+-/* map */ //@item(map, "map", "", "keyword")
+-/* func */ //@item(func, "func", "", "keyword")
+-/* chan */ //@item(chan, "chan", "", "keyword")
+-/* range */ //@item(range, "range", "", "keyword")
+diff -urN a/gopls/internal/lsp/testdata/labels/labels.go b/gopls/internal/lsp/testdata/labels/labels.go
+--- a/gopls/internal/lsp/testdata/labels/labels.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/labels/labels.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,49 +0,0 @@
+-package labels
+-
+-func _() {
+- goto F //@complete(" //", label1, label5)
+-
+-Foo1: //@item(label1, "Foo1", "label", "const")
+- for a, b := range []int{} {
+- Foo2: //@item(label2, "Foo2", "label", "const")
+- switch {
+- case true:
+- break F //@complete(" //", label2, label1)
+-
+- continue F //@complete(" //", label1)
+-
+- {
+- FooUnjumpable:
+- }
+-
+- goto F //@complete(" //", label1, label2, label4, label5)
+-
+- func() {
+- goto F //@complete(" //", label3)
+-
+- break F //@complete(" //")
+-
+- continue F //@complete(" //")
+-
+- Foo3: //@item(label3, "Foo3", "label", "const")
+- }()
+- }
+-
+- Foo4: //@item(label4, "Foo4", "label", "const")
+- switch interface{}(a).(type) {
+- case int:
+- break F //@complete(" //", label4, label1)
+- }
+- }
+-
+- break F //@complete(" //")
+-
+- continue F //@complete(" //")
+-
+-Foo5: //@item(label5, "Foo5", "label", "const")
+- for {
+- break F //@complete(" //", label5)
+- }
+-
+- return
+-}
+diff -urN a/gopls/internal/lsp/testdata/links/links.go b/gopls/internal/lsp/testdata/links/links.go
+--- a/gopls/internal/lsp/testdata/links/links.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/links/links.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,26 +0,0 @@
+-package links
+-
+-import (
+- "fmt" //@link(`fmt`,"https://pkg.go.dev/fmt")
+-
+- "golang.org/lsptests/foo" //@link(`golang.org/lsptests/foo`,`https://pkg.go.dev/golang.org/lsptests/foo`)
+-
+- _ "database/sql" //@link(`database/sql`, `https://pkg.go.dev/database/sql`)
+-)
+-
+-var (
+- _ fmt.Formatter
+- _ foo.StructFoo
+- _ errors.Formatter
+-)
+-
+-// Foo function
+-func Foo() string {
+- /*https://example.com/comment */ //@link("https://example.com/comment","https://example.com/comment")
+-
+- url := "https://example.com/string_literal" //@link("https://example.com/string_literal","https://example.com/string_literal")
+- return url
+-
+- // TODO(golang/go#1234): Link the relevant issue. //@link("golang/go#1234", "https://github.com/golang/go/issues/1234")
+- // TODO(microsoft/vscode-go#12): Another issue. //@link("microsoft/vscode-go#12", "https://github.com/microsoft/vscode-go/issues/12")
+-}
+diff -urN a/gopls/internal/lsp/testdata/maps/maps.go.in b/gopls/internal/lsp/testdata/maps/maps.go.in
+--- a/gopls/internal/lsp/testdata/maps/maps.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/maps/maps.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+-package maps
+-
+-func _() {
+- var aVar int //@item(mapVar, "aVar", "int", "var")
+-
+- // not comparabale
+- type aSlice []int //@item(mapSliceType, "aSlice", "[]int", "type")
+-
+- *aSlice //@item(mapSliceTypePtr, "*aSlice", "[]int", "type")
+-
+- // comparable
+- type aStruct struct{} //@item(mapStructType, "aStruct", "struct{...}", "struct")
+-
+- map[]a{} //@complete("]", mapSliceType, mapStructType),snippet("]", mapSliceType, "*aSlice", "*aSlice")
+-
+- map[a]a{} //@complete("]", mapSliceType, mapStructType)
+- map[a]a{} //@complete("{", mapSliceType, mapStructType)
+-}
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/channels.go b/gopls/internal/lsp/testdata/missingfunction/channels.go
+--- a/gopls/internal/lsp/testdata/missingfunction/channels.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/channels.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package missingfunction
+-
+-func channels(s string) {
+- undefinedChannels(c()) //@suggestedfix("undefinedChannels", "quickfix", "")
+-}
+-
+-func c() (<-chan string, chan string) {
+- return make(<-chan string), make(chan string)
+-}
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/channels.go.golden b/gopls/internal/lsp/testdata/missingfunction/channels.go.golden
+--- a/gopls/internal/lsp/testdata/missingfunction/channels.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/channels.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,15 +0,0 @@
+--- suggestedfix_channels_4_2 --
+-package missingfunction
+-
+-func channels(s string) {
+- undefinedChannels(c()) //@suggestedfix("undefinedChannels", "quickfix", "")
+-}
+-
+-func undefinedChannels(ch1 <-chan string, ch2 chan string) {
+- panic("unimplemented")
+-}
+-
+-func c() (<-chan string, chan string) {
+- return make(<-chan string), make(chan string)
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/consecutive_params.go b/gopls/internal/lsp/testdata/missingfunction/consecutive_params.go
+--- a/gopls/internal/lsp/testdata/missingfunction/consecutive_params.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/consecutive_params.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-package missingfunction
+-
+-func consecutiveParams() {
+- var s string
+- undefinedConsecutiveParams(s, s) //@suggestedfix("undefinedConsecutiveParams", "quickfix", "")
+-}
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/consecutive_params.go.golden b/gopls/internal/lsp/testdata/missingfunction/consecutive_params.go.golden
+--- a/gopls/internal/lsp/testdata/missingfunction/consecutive_params.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/consecutive_params.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+--- suggestedfix_consecutive_params_5_2 --
+-package missingfunction
+-
+-func consecutiveParams() {
+- var s string
+- undefinedConsecutiveParams(s, s) //@suggestedfix("undefinedConsecutiveParams", "quickfix", "")
+-}
+-
+-func undefinedConsecutiveParams(s1, s2 string) {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/error_param.go b/gopls/internal/lsp/testdata/missingfunction/error_param.go
+--- a/gopls/internal/lsp/testdata/missingfunction/error_param.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/error_param.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-package missingfunction
+-
+-func errorParam() {
+- var err error
+- undefinedErrorParam(err) //@suggestedfix("undefinedErrorParam", "quickfix", "")
+-}
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/error_param.go.golden b/gopls/internal/lsp/testdata/missingfunction/error_param.go.golden
+--- a/gopls/internal/lsp/testdata/missingfunction/error_param.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/error_param.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+--- suggestedfix_error_param_5_2 --
+-package missingfunction
+-
+-func errorParam() {
+- var err error
+- undefinedErrorParam(err) //@suggestedfix("undefinedErrorParam", "quickfix", "")
+-}
+-
+-func undefinedErrorParam(err error) {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/literals.go b/gopls/internal/lsp/testdata/missingfunction/literals.go
+--- a/gopls/internal/lsp/testdata/missingfunction/literals.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/literals.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-package missingfunction
+-
+-type T struct{}
+-
+-func literals() {
+- undefinedLiterals("hey compiler", T{}, &T{}) //@suggestedfix("undefinedLiterals", "quickfix", "")
+-}
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/literals.go.golden b/gopls/internal/lsp/testdata/missingfunction/literals.go.golden
+--- a/gopls/internal/lsp/testdata/missingfunction/literals.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/literals.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+--- suggestedfix_literals_6_2 --
+-package missingfunction
+-
+-type T struct{}
+-
+-func literals() {
+- undefinedLiterals("hey compiler", T{}, &T{}) //@suggestedfix("undefinedLiterals", "quickfix", "")
+-}
+-
+-func undefinedLiterals(s string, t1 T, t2 *T) {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/operation.go b/gopls/internal/lsp/testdata/missingfunction/operation.go
+--- a/gopls/internal/lsp/testdata/missingfunction/operation.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/operation.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-package missingfunction
+-
+-import "time"
+-
+-func operation() {
+- undefinedOperation(10 * time.Second) //@suggestedfix("undefinedOperation", "quickfix", "")
+-}
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/operation.go.golden b/gopls/internal/lsp/testdata/missingfunction/operation.go.golden
+--- a/gopls/internal/lsp/testdata/missingfunction/operation.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/operation.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+--- suggestedfix_operation_6_2 --
+-package missingfunction
+-
+-import "time"
+-
+-func operation() {
+- undefinedOperation(10 * time.Second) //@suggestedfix("undefinedOperation", "quickfix", "")
+-}
+-
+-func undefinedOperation(duration time.Duration) {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/selector.go b/gopls/internal/lsp/testdata/missingfunction/selector.go
+--- a/gopls/internal/lsp/testdata/missingfunction/selector.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/selector.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-package missingfunction
+-
+-func selector() {
+- m := map[int]bool{}
+- undefinedSelector(m[1]) //@suggestedfix("undefinedSelector", "quickfix", "")
+-}
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/selector.go.golden b/gopls/internal/lsp/testdata/missingfunction/selector.go.golden
+--- a/gopls/internal/lsp/testdata/missingfunction/selector.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/selector.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+--- suggestedfix_selector_5_2 --
+-package missingfunction
+-
+-func selector() {
+- m := map[int]bool{}
+- undefinedSelector(m[1]) //@suggestedfix("undefinedSelector", "quickfix", "")
+-}
+-
+-func undefinedSelector(b bool) {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/slice.go b/gopls/internal/lsp/testdata/missingfunction/slice.go
+--- a/gopls/internal/lsp/testdata/missingfunction/slice.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/slice.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,5 +0,0 @@
+-package missingfunction
+-
+-func slice() {
+- undefinedSlice([]int{1, 2}) //@suggestedfix("undefinedSlice", "quickfix", "")
+-}
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/slice.go.golden b/gopls/internal/lsp/testdata/missingfunction/slice.go.golden
+--- a/gopls/internal/lsp/testdata/missingfunction/slice.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/slice.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+--- suggestedfix_slice_4_2 --
+-package missingfunction
+-
+-func slice() {
+- undefinedSlice([]int{1, 2}) //@suggestedfix("undefinedSlice", "quickfix", "")
+-}
+-
+-func undefinedSlice(i []int) {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/tuple.go b/gopls/internal/lsp/testdata/missingfunction/tuple.go
+--- a/gopls/internal/lsp/testdata/missingfunction/tuple.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/tuple.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package missingfunction
+-
+-func tuple() {
+- undefinedTuple(b()) //@suggestedfix("undefinedTuple", "quickfix", "")
+-}
+-
+-func b() (string, error) {
+- return "", nil
+-}
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/tuple.go.golden b/gopls/internal/lsp/testdata/missingfunction/tuple.go.golden
+--- a/gopls/internal/lsp/testdata/missingfunction/tuple.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/tuple.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,15 +0,0 @@
+--- suggestedfix_tuple_4_2 --
+-package missingfunction
+-
+-func tuple() {
+- undefinedTuple(b()) //@suggestedfix("undefinedTuple", "quickfix", "")
+-}
+-
+-func undefinedTuple(s string, err error) {
+- panic("unimplemented")
+-}
+-
+-func b() (string, error) {
+- return "", nil
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/unique_params.go b/gopls/internal/lsp/testdata/missingfunction/unique_params.go
+--- a/gopls/internal/lsp/testdata/missingfunction/unique_params.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/unique_params.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-package missingfunction
+-
+-func uniqueArguments() {
+- var s string
+- var i int
+- undefinedUniqueArguments(s, i, s) //@suggestedfix("undefinedUniqueArguments", "quickfix", "")
+-}
+diff -urN a/gopls/internal/lsp/testdata/missingfunction/unique_params.go.golden b/gopls/internal/lsp/testdata/missingfunction/unique_params.go.golden
+--- a/gopls/internal/lsp/testdata/missingfunction/unique_params.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/missingfunction/unique_params.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+--- suggestedfix_unique_params_6_2 --
+-package missingfunction
+-
+-func uniqueArguments() {
+- var s string
+- var i int
+- undefinedUniqueArguments(s, i, s) //@suggestedfix("undefinedUniqueArguments", "quickfix", "")
+-}
+-
+-func undefinedUniqueArguments(s1 string, i int, s2 string) {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/multireturn/multi_return.go.in b/gopls/internal/lsp/testdata/multireturn/multi_return.go.in
+--- a/gopls/internal/lsp/testdata/multireturn/multi_return.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/multireturn/multi_return.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,48 +0,0 @@
+-package multireturn
+-
+-func f0() {} //@item(multiF0, "f0", "func()", "func")
+-
+-func f1(int) int { return 0 } //@item(multiF1, "f1", "func(int) int", "func")
+-
+-func f2(int, int) (int, int) { return 0, 0 } //@item(multiF2, "f2", "func(int, int) (int, int)", "func")
+-
+-func f2Str(string, string) (string, string) { return "", "" } //@item(multiF2Str, "f2Str", "func(string, string) (string, string)", "func")
+-
+-func f3(int, int, int) (int, int, int) { return 0, 0, 0 } //@item(multiF3, "f3", "func(int, int, int) (int, int, int)", "func")
+-
+-func _() {
+- _ := f //@rank(" //", multiF1, multiF2)
+-
+- _, _ := f //@rank(" //", multiF2, multiF0),rank(" //", multiF1, multiF0)
+-
+- _, _ := _, f //@rank(" //", multiF1, multiF2),rank(" //", multiF1, multiF0)
+-
+- _, _ := f, abc //@rank(", abc", multiF1, multiF2)
+-
+- f1() //@rank(")", multiF1, multiF0)
+- f1(f) //@rank(")", multiF1, multiF2)
+- f2(f) //@rank(")", multiF2, multiF3),rank(")", multiF1, multiF3)
+- f2(1, f) //@rank(")", multiF1, multiF2),rank(")", multiF1, multiF0)
+- f2(1, ) //@rank(")", multiF1, multiF2),rank(")", multiF1, multiF0)
+- f2Str() //@rank(")", multiF2Str, multiF2)
+-
+- var i int
+- i, _ := f //@rank(" //", multiF2, multiF2Str)
+-
+- var s string
+- _, s := f //@rank(" //", multiF2Str, multiF2)
+-
+- banana, s = f //@rank(" //", multiF2, multiF3)
+-
+- var variadic func(int, ...int)
+- variadic() //@rank(")", multiF1, multiF0),rank(")", multiF2, multiF0),rank(")", multiF3, multiF0)
+-}
+-
+-func _() {
+- var baz func(...interface{})
+-
+- var otterNap func() (int, int) //@item(multiTwo, "otterNap", "func() (int, int)", "var")
+- var one int //@item(multiOne, "one", "int", "var")
+-
+- baz(on) //@rank(")", multiOne, multiTwo)
+-}
+diff -urN a/gopls/internal/lsp/testdata/nested_complit/nested_complit.go.in b/gopls/internal/lsp/testdata/nested_complit/nested_complit.go.in
+--- a/gopls/internal/lsp/testdata/nested_complit/nested_complit.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/nested_complit/nested_complit.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,15 +0,0 @@
+-package nested_complit
+-
+-type ncFoo struct {} //@item(structNCFoo, "ncFoo", "struct{...}", "struct")
+-
+-type ncBar struct { //@item(structNCBar, "ncBar", "struct{...}", "struct")
+- baz []ncFoo
+-}
+-
+-func _() {
+- []ncFoo{} //@item(litNCFoo, "[]ncFoo{}", "", "var")
+- _ := ncBar{
+- // disabled - see issue #54822
+- baz: [] // complete(" //", structNCFoo, structNCBar)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/nodisk/empty b/gopls/internal/lsp/testdata/nodisk/empty
+--- a/gopls/internal/lsp/testdata/nodisk/empty 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/nodisk/empty 1970-01-01 00:00:00.000000000 +0000
+@@ -1 +0,0 @@
+-an empty file so that this directory exists
+\ No newline at end of file
+diff -urN a/gopls/internal/lsp/testdata/nodisk/nodisk.overlay.go b/gopls/internal/lsp/testdata/nodisk/nodisk.overlay.go
+--- a/gopls/internal/lsp/testdata/nodisk/nodisk.overlay.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/nodisk/nodisk.overlay.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package nodisk
+-
+-import (
+- "golang.org/lsptests/foo"
+-)
+-
+-func _() {
+- foo.Foo() //@complete("F", Foo, IntFoo, StructFoo)
+-}
+diff -urN a/gopls/internal/lsp/testdata/noparse/noparse.go.in b/gopls/internal/lsp/testdata/noparse/noparse.go.in
+--- a/gopls/internal/lsp/testdata/noparse/noparse.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/noparse/noparse.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+-package noparse
+-
+-// The type error was chosen carefully to exercise a type-error analyzer.
+-// We use the 'nonewvars' analyzer because the other candidates are tricky:
+-//
+-// - The 'unusedvariable' analyzer is disabled by default, so it is not
+-// consistently enabled across Test{LSP,CommandLine} tests, which
+-// both process this file.
+-// - The 'undeclaredname' analyzer depends on the text of the go/types
+-// "undeclared name" error, which changed in go1.20.
+-// - The 'noresultvalues' analyzer produces a diagnostic containing newlines,
+-// which breaks the parser used by TestCommandLine.
+-//
+-// This comment is all that remains of my afternoon.
+-
+-func bye(x int) {
+- x := 123 //@diag(":=", "nonewvars", "no new variables", "warning")
+-}
+-
+-func stuff() {
+-
+-}
+-
+-func .() {} //@diag(".", "syntax", "expected 'IDENT', found '.'", "error")
+diff -urN a/gopls/internal/lsp/testdata/noparse_format/noparse_format.go.golden b/gopls/internal/lsp/testdata/noparse_format/noparse_format.go.golden
+--- a/gopls/internal/lsp/testdata/noparse_format/noparse_format.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/noparse_format/noparse_format.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,2 +0,0 @@
+--- gofmt --
+-
+diff -urN a/gopls/internal/lsp/testdata/noparse_format/noparse_format.go.in b/gopls/internal/lsp/testdata/noparse_format/noparse_format.go.in
+--- a/gopls/internal/lsp/testdata/noparse_format/noparse_format.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/noparse_format/noparse_format.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+-// +build go1.11
+-
+-package noparse_format //@format("package")
+-
+-// The nonewvars expectation asserts that the go/analysis framework ran.
+-// See comments in badstmt.
+-
+-func what() {
+- var hi func()
+- if { hi() //@diag("{", "syntax", "missing condition in if statement", "error")
+- }
+- hi := nil //@diag(":=", "nonewvars", "no new variables", "warning")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/noparse_format/parse_format.go.golden b/gopls/internal/lsp/testdata/noparse_format/parse_format.go.golden
+--- a/gopls/internal/lsp/testdata/noparse_format/parse_format.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/noparse_format/parse_format.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+--- gofmt --
+-package noparse_format //@format("package")
+-
+-func _() {
+- f()
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/noparse_format/parse_format.go.in b/gopls/internal/lsp/testdata/noparse_format/parse_format.go.in
+--- a/gopls/internal/lsp/testdata/noparse_format/parse_format.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/noparse_format/parse_format.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,5 +0,0 @@
+-package noparse_format //@format("package")
+-
+-func _() {
+-f()
+-}
+\ No newline at end of file
+diff -urN a/gopls/internal/lsp/testdata/%percent/perc%ent.go b/gopls/internal/lsp/testdata/%percent/perc%ent.go
+--- a/gopls/internal/lsp/testdata/%percent/perc%ent.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/%percent/perc%ent.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1 +0,0 @@
+-package percent
+diff -urN a/gopls/internal/lsp/testdata/printf/printf.go b/gopls/internal/lsp/testdata/printf/printf.go
+--- a/gopls/internal/lsp/testdata/printf/printf.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/printf/printf.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,33 +0,0 @@
+-package printf
+-
+-import "fmt"
+-
+-func myPrintf(string, ...interface{}) {}
+-
+-func _() {
+- var (
+- aInt int //@item(printfInt, "aInt", "int", "var")
+- aFloat float64 //@item(printfFloat, "aFloat", "float64", "var")
+- aString string //@item(printfString, "aString", "string", "var")
+- aBytes []byte //@item(printfBytes, "aBytes", "[]byte", "var")
+- aStringer fmt.Stringer //@item(printfStringer, "aStringer", "fmt.Stringer", "var")
+- aError error //@item(printfError, "aError", "error", "var")
+- aBool bool //@item(printfBool, "aBool", "bool", "var")
+- )
+-
+- myPrintf("%d", a) //@rank(")", printfInt, printfFloat)
+- myPrintf("%s", a) //@rank(")", printfString, printfInt),rank(")", printfBytes, printfInt),rank(")", printfStringer, printfInt),rank(")", printfError, printfInt)
+- myPrintf("%w", a) //@rank(")", printfError, printfInt)
+- myPrintf("%x %[1]b", a) //@rank(")", printfInt, printfString)
+-
+- fmt.Printf("%t", a) //@rank(")", printfBool, printfInt)
+-
+- fmt.Fprintf(nil, "%f", a) //@rank(")", printfFloat, printfInt)
+-
+- fmt.Sprintf("%[2]q %[1]*.[3]*[4]f",
+- a, //@rank(",", printfInt, printfFloat)
+- a, //@rank(",", printfString, printfFloat)
+- a, //@rank(",", printfInt, printfFloat)
+- a, //@rank(",", printfFloat, printfInt)
+- )
+-}
+diff -urN a/gopls/internal/lsp/testdata/rank/assign_rank.go.in b/gopls/internal/lsp/testdata/rank/assign_rank.go.in
+--- a/gopls/internal/lsp/testdata/rank/assign_rank.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rank/assign_rank.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,19 +0,0 @@
+-package rank
+-
+-var (
+- apple int = 3 //@item(apple, "apple", "int", "var")
+- pear string = "hello" //@item(pear, "pear", "string", "var")
+-)
+-
+-func _() {
+- orange := 1 //@item(orange, "orange", "int", "var")
+- grape := "hello" //@item(grape, "grape", "string", "var")
+- orange, grape = 2, "hello" //@complete(" \"", grape, pear, orange, apple)
+-}
+-
+-func _() {
+- var pineapple int //@item(pineapple, "pineapple", "int", "var")
+- pineapple = 1 //@complete(" 1", pineapple, apple, pear)
+-
+- y := //@complete(" /", pineapple, apple, pear)
+-}
+diff -urN a/gopls/internal/lsp/testdata/rank/binexpr_rank.go.in b/gopls/internal/lsp/testdata/rank/binexpr_rank.go.in
+--- a/gopls/internal/lsp/testdata/rank/binexpr_rank.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rank/binexpr_rank.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-package rank
+-
+-func _() {
+- _ = 5 + ; //@complete(" ;", apple, pear)
+- y := + 5; //@complete(" +", apple, pear)
+-
+- if 6 == {} //@complete(" {", apple, pear)
+-}
+diff -urN a/gopls/internal/lsp/testdata/rank/boolexpr_rank.go b/gopls/internal/lsp/testdata/rank/boolexpr_rank.go
+--- a/gopls/internal/lsp/testdata/rank/boolexpr_rank.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rank/boolexpr_rank.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-package rank
+-
+-func _() {
+- someRandomBoolFunc := func() bool { //@item(boolExprFunc, "someRandomBoolFunc", "func() bool", "var")
+- return true
+- }
+-
+- var foo, bar int //@item(boolExprBar, "bar", "int", "var")
+- if foo == 123 && b { //@rank(" {", boolExprBar, boolExprFunc)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/rank/convert_rank.go.in b/gopls/internal/lsp/testdata/rank/convert_rank.go.in
+--- a/gopls/internal/lsp/testdata/rank/convert_rank.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rank/convert_rank.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,54 +0,0 @@
+-package rank
+-
+-import "time"
+-
+-func _() {
+- type strList []string
+- wantsStrList := func(strList) {}
+-
+- var (
+- convA string //@item(convertA, "convA", "string", "var")
+- convB []string //@item(convertB, "convB", "[]string", "var")
+- )
+- wantsStrList(strList(conv)) //@complete("))", convertB, convertA)
+-}
+-
+-func _() {
+- type myInt int
+-
+- const (
+- convC = "hi" //@item(convertC, "convC", "string", "const")
+- convD = 123 //@item(convertD, "convD", "int", "const")
+- convE int = 123 //@item(convertE, "convE", "int", "const")
+- convF string = "there" //@item(convertF, "convF", "string", "const")
+- convG myInt = 123 //@item(convertG, "convG", "myInt", "const")
+- )
+-
+- var foo int
+- foo = conv //@rank(" //", convertE, convertD)
+-
+- var mi myInt
+- mi = conv //@rank(" //", convertG, convertD, convertE)
+- mi + conv //@rank(" //", convertG, convertD, convertE)
+-
+- 1 + conv //@rank(" //", convertD, convertC),rank(" //", convertE, convertC),rank(" //", convertG, convertC)
+-
+- type myString string
+- var ms myString
+- ms = conv //@rank(" //", convertC, convertF)
+-
+- type myUint uint32
+- var mu myUint
+- mu = conv //@rank(" //", convertD, convertE)
+-
+- // don't downrank constants when assigning to interface{}
+- var _ interface{} = c //@rank(" //", convertD, complex)
+-
+- var _ time.Duration = conv //@rank(" //", convertD, convertE),snippet(" //", convertE, "time.Duration(convE)", "time.Duration(convE)")
+-
+- var convP myInt //@item(convertP, "convP", "myInt", "var")
+- var _ *int = conv //@snippet(" //", convertP, "(*int)(&convP)", "(*int)(&convP)")
+-
+- var ff float64 //@item(convertFloat, "ff", "float64", "var")
+- f == convD //@snippet(" =", convertFloat, "ff", "ff")
+-}
+diff -urN a/gopls/internal/lsp/testdata/rank/struct/struct_rank.go b/gopls/internal/lsp/testdata/rank/struct/struct_rank.go
+--- a/gopls/internal/lsp/testdata/rank/struct/struct_rank.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rank/struct/struct_rank.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-package struct_rank
+-
+-type foo struct {
+- c int //@item(c_rank, "c", "int", "field")
+- b int //@item(b_rank, "b", "int", "field")
+- a int //@item(a_rank, "a", "int", "field")
+-}
+-
+-func f() {
+- foo := foo{} //@rank("}", c_rank, b_rank, a_rank)
+-}
+diff -urN a/gopls/internal/lsp/testdata/rank/switch_rank.go.in b/gopls/internal/lsp/testdata/rank/switch_rank.go.in
+--- a/gopls/internal/lsp/testdata/rank/switch_rank.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rank/switch_rank.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,29 +0,0 @@
+-package rank
+-
+-import "time"
+-
+-func _() {
+- switch pear {
+- case _: //@rank("_", pear, apple)
+- }
+-
+- time.Monday //@item(timeMonday, "time.Monday", "time.Weekday", "const"),item(monday ,"Monday", "time.Weekday", "const")
+- time.Friday //@item(timeFriday, "time.Friday", "time.Weekday", "const"),item(friday ,"Friday", "time.Weekday", "const")
+-
+- now := time.Now()
+- now.Weekday //@item(nowWeekday, "now.Weekday", "func() time.Weekday", "method")
+-
+- then := time.Now()
+- then.Weekday //@item(thenWeekday, "then.Weekday", "func() time.Weekday", "method")
+-
+- switch time.Weekday(0) {
+- case time.Monday, time.Tuesday:
+- case time.Wednesday, time.Thursday:
+- case time.Saturday, time.Sunday:
+- case t: //@rank(":", timeFriday, timeMonday)
+- case time.: //@rank(":", friday, monday)
+-
+- case now.Weekday():
+- case week: //@rank(":", thenWeekday, nowWeekday)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/rank/type_assert_rank.go.in b/gopls/internal/lsp/testdata/rank/type_assert_rank.go.in
+--- a/gopls/internal/lsp/testdata/rank/type_assert_rank.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rank/type_assert_rank.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-package rank
+-
+-func _() {
+- type flower int //@item(flower, "flower", "int", "type")
+- var fig string //@item(fig, "fig", "string", "var")
+-
+- _ = interface{}(nil).(f) //@complete(") //", flower)
+-}
+diff -urN a/gopls/internal/lsp/testdata/rank/type_switch_rank.go.in b/gopls/internal/lsp/testdata/rank/type_switch_rank.go.in
+--- a/gopls/internal/lsp/testdata/rank/type_switch_rank.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rank/type_switch_rank.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,31 +0,0 @@
+-package rank
+-
+-import (
+- "fmt"
+- "go/ast"
+-)
+-
+-func _() {
+- type basket int //@item(basket, "basket", "int", "type")
+- var banana string //@item(banana, "banana", "string", "var")
+-
+- switch interface{}(pear).(type) {
+- case b: //@complete(":", basket)
+- b //@complete(" //", banana, basket)
+- }
+-
+- Ident //@item(astIdent, "Ident", "struct{...}", "struct")
+- IfStmt //@item(astIfStmt, "IfStmt", "struct{...}", "struct")
+-
+- switch ast.Node(nil).(type) {
+- case *ast.Ident:
+- case *ast.I: //@rank(":", astIfStmt, astIdent)
+- }
+-
+- Stringer //@item(fmtStringer, "Stringer", "interface{...}", "interface")
+- GoStringer //@item(fmtGoStringer, "GoStringer", "interface{...}", "interface")
+-
+- switch interface{}(nil).(type) {
+- case fmt.Stringer: //@rank(":", fmtStringer, fmtGoStringer)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/references/another/another.go b/gopls/internal/lsp/testdata/references/another/another.go
+--- a/gopls/internal/lsp/testdata/references/another/another.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/references/another/another.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-// Package another has another type.
+-package another
+-
+-import (
+- other "golang.org/lsptests/references/other"
+-)
+-
+-func _() {
+- xes := other.GetXes()
+- for _, x := range xes { //@mark(defX, "x")
+- _ = x.Y //@mark(useX, "x"),mark(anotherXY, "Y"),refs("Y", typeXY, anotherXY, GetXesY),refs(".", defX, useX),refs("x", defX, useX)
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/references/interfaces/interfaces.go b/gopls/internal/lsp/testdata/references/interfaces/interfaces.go
+--- a/gopls/internal/lsp/testdata/references/interfaces/interfaces.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/references/interfaces/interfaces.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,34 +0,0 @@
+-package interfaces
+-
+-type first interface {
+- common() //@mark(firCommon, "common"),refs("common", firCommon, xCommon, zCommon)
+- firstMethod() //@mark(firMethod, "firstMethod"),refs("firstMethod", firMethod, xfMethod, zfMethod)
+-}
+-
+-type second interface {
+- common() //@mark(secCommon, "common"),refs("common", secCommon, yCommon, zCommon)
+- secondMethod() //@mark(secMethod, "secondMethod"),refs("secondMethod", secMethod, ysMethod, zsMethod)
+-}
+-
+-type s struct {}
+-
+-func (*s) common() {} //@mark(sCommon, "common"),refs("common", sCommon, xCommon, yCommon, zCommon)
+-
+-func (*s) firstMethod() {} //@mark(sfMethod, "firstMethod"),refs("firstMethod", sfMethod, xfMethod, zfMethod)
+-
+-func (*s) secondMethod() {} //@mark(ssMethod, "secondMethod"),refs("secondMethod", ssMethod, ysMethod, zsMethod)
+-
+-func main() {
+- var x first = &s{}
+- var y second = &s{}
+-
+- x.common() //@mark(xCommon, "common"),refs("common", firCommon, xCommon, zCommon)
+- x.firstMethod() //@mark(xfMethod, "firstMethod"),refs("firstMethod", firMethod, xfMethod, zfMethod)
+- y.common() //@mark(yCommon, "common"),refs("common", secCommon, yCommon, zCommon)
+- y.secondMethod() //@mark(ysMethod, "secondMethod"),refs("secondMethod", secMethod, ysMethod, zsMethod)
+-
+- var z *s = &s{}
+- z.firstMethod() //@mark(zfMethod, "firstMethod"),refs("firstMethod", sfMethod, xfMethod, zfMethod)
+- z.secondMethod() //@mark(zsMethod, "secondMethod"),refs("secondMethod", ssMethod, ysMethod, zsMethod)
+- z.common() //@mark(zCommon, "common"),refs("common", sCommon, xCommon, yCommon, zCommon)
+-}
+diff -urN a/gopls/internal/lsp/testdata/references/other/other.go b/gopls/internal/lsp/testdata/references/other/other.go
+--- a/gopls/internal/lsp/testdata/references/other/other.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/references/other/other.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,19 +0,0 @@
+-package other
+-
+-import (
+- references "golang.org/lsptests/references"
+-)
+-
+-func GetXes() []references.X {
+- return []references.X{
+- {
+- Y: 1, //@mark(GetXesY, "Y"),refs("Y", typeXY, GetXesY, anotherXY)
+- },
+- }
+-}
+-
+-func _() {
+- references.Q = "hello" //@mark(assignExpQ, "Q")
+- bob := func(_ string) {}
+- bob(references.Q) //@mark(bobExpQ, "Q")
+-}
+diff -urN a/gopls/internal/lsp/testdata/references/refs.go b/gopls/internal/lsp/testdata/references/refs.go
+--- a/gopls/internal/lsp/testdata/references/refs.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/references/refs.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,53 +0,0 @@
+-// Package refs is a package used to test find references.
+-package refs
+-
+-import "os" //@mark(osDecl, `"os"`),refs("os", osDecl, osUse)
+-
+-type i int //@mark(typeI, "i"),refs("i", typeI, argI, returnI, embeddedI)
+-
+-type X struct {
+- Y int //@mark(typeXY, "Y")
+-}
+-
+-func _(_ i) []bool { //@mark(argI, "i")
+- return nil
+-}
+-
+-func _(_ []byte) i { //@mark(returnI, "i")
+- return 0
+-}
+-
+-var q string //@mark(declQ, "q"),refs("q", declQ, assignQ, bobQ)
+-
+-var Q string //@mark(declExpQ, "Q"),refs("Q", declExpQ, assignExpQ, bobExpQ)
+-
+-func _() {
+- q = "hello" //@mark(assignQ, "q")
+- bob := func(_ string) {}
+- bob(q) //@mark(bobQ, "q")
+-}
+-
+-type e struct {
+- i //@mark(embeddedI, "i"),refs("i", embeddedI, embeddedIUse)
+-}
+-
+-func _() {
+- _ = e{}.i //@mark(embeddedIUse, "i")
+-}
+-
+-const (
+- foo = iota //@refs("iota")
+-)
+-
+-func _(x interface{}) {
+- // We use the _ prefix because the markers inhabit a single
+- // namespace and yDecl is already used in ../highlights/highlights.go.
+- switch _y := x.(type) { //@mark(_yDecl, "_y"),refs("_y", _yDecl, _yInt, _yDefault)
+- case int:
+- println(_y) //@mark(_yInt, "_y"),refs("_y", _yDecl, _yInt, _yDefault)
+- default:
+- println(_y) //@mark(_yDefault, "_y")
+- }
+-
+- os.Getwd() //@mark(osUse, "os")
+-}
+diff -urN a/gopls/internal/lsp/testdata/references/refs_test.go b/gopls/internal/lsp/testdata/references/refs_test.go
+--- a/gopls/internal/lsp/testdata/references/refs_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/references/refs_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-package references
+-
+-import (
+- "testing"
+-)
+-
+-// This test exists to bring the test package into existence.
+-
+-func TestReferences(t *testing.T) {
+-}
+diff -urN a/gopls/internal/lsp/testdata/rename/a/random.go.golden b/gopls/internal/lsp/testdata/rename/a/random.go.golden
+--- a/gopls/internal/lsp/testdata/rename/a/random.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/a/random.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,616 +0,0 @@
+--- GetSum-rename --
+-package a
+-
+-import (
+- lg "log"
+- "fmt" //@rename("fmt", "fmty")
+- f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
+-)
+-
+-func Random() int {
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(y int) int { //@rename("y", "z")
+- return y
+-}
+-
+-type Pos struct {
+- x, y int
+-}
+-
+-func (p *Pos) GetSum() int {
+- return p.x + p.y //@rename("x", "myX")
+-}
+-
+-func _() {
+- var p Pos //@rename("p", "pos")
+- _ = p.GetSum() //@rename("Sum", "GetSum")
+-}
+-
+-func sw() {
+- var x interface{}
+-
+- switch y := x.(type) { //@rename("y", "y0")
+- case int:
+- fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format")
+- case string:
+- lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log")
+- default:
+- f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2")
+- }
+-}
+-
+--- f2name-rename --
+-package a
+-
+-import (
+- lg "log"
+- "fmt" //@rename("fmt", "fmty")
+- f2name "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
+-)
+-
+-func Random() int {
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(y int) int { //@rename("y", "z")
+- return y
+-}
+-
+-type Pos struct {
+- x, y int
+-}
+-
+-func (p *Pos) Sum() int {
+- return p.x + p.y //@rename("x", "myX")
+-}
+-
+-func _() {
+- var p Pos //@rename("p", "pos")
+- _ = p.Sum() //@rename("Sum", "GetSum")
+-}
+-
+-func sw() {
+- var x interface{}
+-
+- switch y := x.(type) { //@rename("y", "y0")
+- case int:
+- fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format")
+- case string:
+- lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log")
+- default:
+- f2name.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2")
+- }
+-}
+-
+--- f2y-rename --
+-package a
+-
+-import (
+- lg "log"
+- "fmt" //@rename("fmt", "fmty")
+- f2y "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
+-)
+-
+-func Random() int {
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(y int) int { //@rename("y", "z")
+- return y
+-}
+-
+-type Pos struct {
+- x, y int
+-}
+-
+-func (p *Pos) Sum() int {
+- return p.x + p.y //@rename("x", "myX")
+-}
+-
+-func _() {
+- var p Pos //@rename("p", "pos")
+- _ = p.Sum() //@rename("Sum", "GetSum")
+-}
+-
+-func sw() {
+- var x interface{}
+-
+- switch y := x.(type) { //@rename("y", "y0")
+- case int:
+- fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format")
+- case string:
+- lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log")
+- default:
+- f2y.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2")
+- }
+-}
+-
+--- fmt2-rename --
+-package a
+-
+-import (
+- lg "log"
+- "fmt" //@rename("fmt", "fmty")
+- fmt2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
+-)
+-
+-func Random() int {
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(y int) int { //@rename("y", "z")
+- return y
+-}
+-
+-type Pos struct {
+- x, y int
+-}
+-
+-func (p *Pos) Sum() int {
+- return p.x + p.y //@rename("x", "myX")
+-}
+-
+-func _() {
+- var p Pos //@rename("p", "pos")
+- _ = p.Sum() //@rename("Sum", "GetSum")
+-}
+-
+-func sw() {
+- var x interface{}
+-
+- switch y := x.(type) { //@rename("y", "y0")
+- case int:
+- fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format")
+- case string:
+- lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log")
+- default:
+- fmt2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2")
+- }
+-}
+-
+--- fmty-rename --
+-package a
+-
+-import (
+- lg "log"
+- fmty "fmt" //@rename("fmt", "fmty")
+- f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
+-)
+-
+-func Random() int {
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(y int) int { //@rename("y", "z")
+- return y
+-}
+-
+-type Pos struct {
+- x, y int
+-}
+-
+-func (p *Pos) Sum() int {
+- return p.x + p.y //@rename("x", "myX")
+-}
+-
+-func _() {
+- var p Pos //@rename("p", "pos")
+- _ = p.Sum() //@rename("Sum", "GetSum")
+-}
+-
+-func sw() {
+- var x interface{}
+-
+- switch y := x.(type) { //@rename("y", "y0")
+- case int:
+- fmty.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format")
+- case string:
+- lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log")
+- default:
+- f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2")
+- }
+-}
+-
+--- format-rename --
+-package a
+-
+-import (
+- lg "log"
+- format "fmt" //@rename("fmt", "fmty")
+- f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
+-)
+-
+-func Random() int {
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(y int) int { //@rename("y", "z")
+- return y
+-}
+-
+-type Pos struct {
+- x, y int
+-}
+-
+-func (p *Pos) Sum() int {
+- return p.x + p.y //@rename("x", "myX")
+-}
+-
+-func _() {
+- var p Pos //@rename("p", "pos")
+- _ = p.Sum() //@rename("Sum", "GetSum")
+-}
+-
+-func sw() {
+- var x interface{}
+-
+- switch y := x.(type) { //@rename("y", "y0")
+- case int:
+- format.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format")
+- case string:
+- lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log")
+- default:
+- f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2")
+- }
+-}
+-
+--- log-rename --
+-package a
+-
+-import (
+- "log"
+- "fmt" //@rename("fmt", "fmty")
+- f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
+-)
+-
+-func Random() int {
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(y int) int { //@rename("y", "z")
+- return y
+-}
+-
+-type Pos struct {
+- x, y int
+-}
+-
+-func (p *Pos) Sum() int {
+- return p.x + p.y //@rename("x", "myX")
+-}
+-
+-func _() {
+- var p Pos //@rename("p", "pos")
+- _ = p.Sum() //@rename("Sum", "GetSum")
+-}
+-
+-func sw() {
+- var x interface{}
+-
+- switch y := x.(type) { //@rename("y", "y0")
+- case int:
+- fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format")
+- case string:
+- log.Printf("%s", y) //@rename("y", "y2"),rename("lg","log")
+- default:
+- f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2")
+- }
+-}
+-
+--- myX-rename --
+-package a
+-
+-import (
+- lg "log"
+- "fmt" //@rename("fmt", "fmty")
+- f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
+-)
+-
+-func Random() int {
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(y int) int { //@rename("y", "z")
+- return y
+-}
+-
+-type Pos struct {
+- myX, y int
+-}
+-
+-func (p *Pos) Sum() int {
+- return p.myX + p.y //@rename("x", "myX")
+-}
+-
+-func _() {
+- var p Pos //@rename("p", "pos")
+- _ = p.Sum() //@rename("Sum", "GetSum")
+-}
+-
+-func sw() {
+- var x interface{}
+-
+- switch y := x.(type) { //@rename("y", "y0")
+- case int:
+- fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format")
+- case string:
+- lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log")
+- default:
+- f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2")
+- }
+-}
+-
+--- pos-rename --
+-package a
+-
+-import (
+- lg "log"
+- "fmt" //@rename("fmt", "fmty")
+- f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
+-)
+-
+-func Random() int {
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(y int) int { //@rename("y", "z")
+- return y
+-}
+-
+-type Pos struct {
+- x, y int
+-}
+-
+-func (p *Pos) Sum() int {
+- return p.x + p.y //@rename("x", "myX")
+-}
+-
+-func _() {
+- var pos Pos //@rename("p", "pos")
+- _ = pos.Sum() //@rename("Sum", "GetSum")
+-}
+-
+-func sw() {
+- var x interface{}
+-
+- switch y := x.(type) { //@rename("y", "y0")
+- case int:
+- fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format")
+- case string:
+- lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log")
+- default:
+- f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2")
+- }
+-}
+-
+--- y0-rename --
+-package a
+-
+-import (
+- lg "log"
+- "fmt" //@rename("fmt", "fmty")
+- f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
+-)
+-
+-func Random() int {
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(y int) int { //@rename("y", "z")
+- return y
+-}
+-
+-type Pos struct {
+- x, y int
+-}
+-
+-func (p *Pos) Sum() int {
+- return p.x + p.y //@rename("x", "myX")
+-}
+-
+-func _() {
+- var p Pos //@rename("p", "pos")
+- _ = p.Sum() //@rename("Sum", "GetSum")
+-}
+-
+-func sw() {
+- var x interface{}
+-
+- switch y0 := x.(type) { //@rename("y", "y0")
+- case int:
+- fmt.Printf("%d", y0) //@rename("y", "y1"),rename("fmt", "format")
+- case string:
+- lg.Printf("%s", y0) //@rename("y", "y2"),rename("lg","log")
+- default:
+- f2.Printf("%v", y0) //@rename("y", "y3"),rename("f2","fmt2")
+- }
+-}
+-
+--- y1-rename --
+-package a
+-
+-import (
+- lg "log"
+- "fmt" //@rename("fmt", "fmty")
+- f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
+-)
+-
+-func Random() int {
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(y int) int { //@rename("y", "z")
+- return y
+-}
+-
+-type Pos struct {
+- x, y int
+-}
+-
+-func (p *Pos) Sum() int {
+- return p.x + p.y //@rename("x", "myX")
+-}
+-
+-func _() {
+- var p Pos //@rename("p", "pos")
+- _ = p.Sum() //@rename("Sum", "GetSum")
+-}
+-
+-func sw() {
+- var x interface{}
+-
+- switch y1 := x.(type) { //@rename("y", "y0")
+- case int:
+- fmt.Printf("%d", y1) //@rename("y", "y1"),rename("fmt", "format")
+- case string:
+- lg.Printf("%s", y1) //@rename("y", "y2"),rename("lg","log")
+- default:
+- f2.Printf("%v", y1) //@rename("y", "y3"),rename("f2","fmt2")
+- }
+-}
+-
+--- y2-rename --
+-package a
+-
+-import (
+- lg "log"
+- "fmt" //@rename("fmt", "fmty")
+- f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
+-)
+-
+-func Random() int {
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(y int) int { //@rename("y", "z")
+- return y
+-}
+-
+-type Pos struct {
+- x, y int
+-}
+-
+-func (p *Pos) Sum() int {
+- return p.x + p.y //@rename("x", "myX")
+-}
+-
+-func _() {
+- var p Pos //@rename("p", "pos")
+- _ = p.Sum() //@rename("Sum", "GetSum")
+-}
+-
+-func sw() {
+- var x interface{}
+-
+- switch y2 := x.(type) { //@rename("y", "y0")
+- case int:
+- fmt.Printf("%d", y2) //@rename("y", "y1"),rename("fmt", "format")
+- case string:
+- lg.Printf("%s", y2) //@rename("y", "y2"),rename("lg","log")
+- default:
+- f2.Printf("%v", y2) //@rename("y", "y3"),rename("f2","fmt2")
+- }
+-}
+-
+--- y3-rename --
+-package a
+-
+-import (
+- lg "log"
+- "fmt" //@rename("fmt", "fmty")
+- f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
+-)
+-
+-func Random() int {
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(y int) int { //@rename("y", "z")
+- return y
+-}
+-
+-type Pos struct {
+- x, y int
+-}
+-
+-func (p *Pos) Sum() int {
+- return p.x + p.y //@rename("x", "myX")
+-}
+-
+-func _() {
+- var p Pos //@rename("p", "pos")
+- _ = p.Sum() //@rename("Sum", "GetSum")
+-}
+-
+-func sw() {
+- var x interface{}
+-
+- switch y3 := x.(type) { //@rename("y", "y0")
+- case int:
+- fmt.Printf("%d", y3) //@rename("y", "y1"),rename("fmt", "format")
+- case string:
+- lg.Printf("%s", y3) //@rename("y", "y2"),rename("lg","log")
+- default:
+- f2.Printf("%v", y3) //@rename("y", "y3"),rename("f2","fmt2")
+- }
+-}
+-
+--- z-rename --
+-package a
+-
+-import (
+- lg "log"
+- "fmt" //@rename("fmt", "fmty")
+- f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
+-)
+-
+-func Random() int {
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(z int) int { //@rename("y", "z")
+- return z
+-}
+-
+-type Pos struct {
+- x, y int
+-}
+-
+-func (p *Pos) Sum() int {
+- return p.x + p.y //@rename("x", "myX")
+-}
+-
+-func _() {
+- var p Pos //@rename("p", "pos")
+- _ = p.Sum() //@rename("Sum", "GetSum")
+-}
+-
+-func sw() {
+- var x interface{}
+-
+- switch y := x.(type) { //@rename("y", "y0")
+- case int:
+- fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format")
+- case string:
+- lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log")
+- default:
+- f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2")
+- }
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/rename/a/random.go.in b/gopls/internal/lsp/testdata/rename/a/random.go.in
+--- a/gopls/internal/lsp/testdata/rename/a/random.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/a/random.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,42 +0,0 @@
+-package a
+-
+-import (
+- lg "log"
+- "fmt" //@rename("fmt", "fmty")
+- f2 "fmt" //@rename("f2", "f2name"),rename("fmt","f2y")
+-)
+-
+-func Random() int {
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(y int) int { //@rename("y", "z")
+- return y
+-}
+-
+-type Pos struct {
+- x, y int
+-}
+-
+-func (p *Pos) Sum() int {
+- return p.x + p.y //@rename("x", "myX")
+-}
+-
+-func _() {
+- var p Pos //@rename("p", "pos")
+- _ = p.Sum() //@rename("Sum", "GetSum")
+-}
+-
+-func sw() {
+- var x interface{}
+-
+- switch y := x.(type) { //@rename("y", "y0")
+- case int:
+- fmt.Printf("%d", y) //@rename("y", "y1"),rename("fmt", "format")
+- case string:
+- lg.Printf("%s", y) //@rename("y", "y2"),rename("lg","log")
+- default:
+- f2.Printf("%v", y) //@rename("y", "y3"),rename("f2","fmt2")
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/rename/b/b.go b/gopls/internal/lsp/testdata/rename/b/b.go
+--- a/gopls/internal/lsp/testdata/rename/b/b.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/b/b.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,20 +0,0 @@
+-package b
+-
+-var c int //@rename("int", "uint")
+-
+-func _() {
+- a := 1 //@rename("a", "error")
+- a = 2
+- _ = a
+-}
+-
+-var (
+- // Hello there.
+- // Foo does the thing.
+- Foo int //@rename("Foo", "Bob")
+-)
+-
+-/*
+-Hello description
+-*/
+-func Hello() {} //@rename("Hello", "Goodbye")
+diff -urN a/gopls/internal/lsp/testdata/rename/b/b.go.golden b/gopls/internal/lsp/testdata/rename/b/b.go.golden
+--- a/gopls/internal/lsp/testdata/rename/b/b.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/b/b.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,78 +0,0 @@
+--- Bob-rename --
+-package b
+-
+-var c int //@rename("int", "uint")
+-
+-func _() {
+- a := 1 //@rename("a", "error")
+- a = 2
+- _ = a
+-}
+-
+-var (
+- // Hello there.
+- // Bob does the thing.
+- Bob int //@rename("Foo", "Bob")
+-)
+-
+-/*
+-Hello description
+-*/
+-func Hello() {} //@rename("Hello", "Goodbye")
+-
+--- Goodbye-rename --
+-b.go:
+-package b
+-
+-var c int //@rename("int", "uint")
+-
+-func _() {
+- a := 1 //@rename("a", "error")
+- a = 2
+- _ = a
+-}
+-
+-var (
+- // Hello there.
+- // Foo does the thing.
+- Foo int //@rename("Foo", "Bob")
+-)
+-
+-/*
+-Goodbye description
+-*/
+-func Goodbye() {} //@rename("Hello", "Goodbye")
+-
+-c.go:
+-package c
+-
+-import "golang.org/lsptests/rename/b"
+-
+-func _() {
+- b.Goodbye() //@rename("Hello", "Goodbye")
+-}
+-
+--- error-rename --
+-package b
+-
+-var c int //@rename("int", "uint")
+-
+-func _() {
+- error := 1 //@rename("a", "error")
+- error = 2
+- _ = error
+-}
+-
+-var (
+- // Hello there.
+- // Foo does the thing.
+- Foo int //@rename("Foo", "Bob")
+-)
+-
+-/*
+-Hello description
+-*/
+-func Hello() {} //@rename("Hello", "Goodbye")
+-
+--- uint-rename --
+-int is built in and cannot be renamed
+diff -urN a/gopls/internal/lsp/testdata/rename/bad/bad.go.golden b/gopls/internal/lsp/testdata/rename/bad/bad.go.golden
+--- a/gopls/internal/lsp/testdata/rename/bad/bad.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/bad/bad.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,2 +0,0 @@
+--- rFunc-rename --
+-renaming "sFunc" to "rFunc" not possible because "golang.org/lsptests/rename/bad" has errors
+diff -urN a/gopls/internal/lsp/testdata/rename/bad/bad.go.in b/gopls/internal/lsp/testdata/rename/bad/bad.go.in
+--- a/gopls/internal/lsp/testdata/rename/bad/bad.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/bad/bad.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-package bad
+-
+-type myStruct struct {
+-}
+-
+-func (s *myStruct) sFunc() bool { //@rename("sFunc", "rFunc")
+- return s.Bad
+-}
+diff -urN a/gopls/internal/lsp/testdata/rename/bad/bad_test.go.in b/gopls/internal/lsp/testdata/rename/bad/bad_test.go.in
+--- a/gopls/internal/lsp/testdata/rename/bad/bad_test.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/bad/bad_test.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1 +0,0 @@
+-package bad
+\ No newline at end of file
+diff -urN a/gopls/internal/lsp/testdata/rename/c/c2.go b/gopls/internal/lsp/testdata/rename/c/c2.go
+--- a/gopls/internal/lsp/testdata/rename/c/c2.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/c/c2.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,4 +0,0 @@
+-package c
+-
+-//go:embed Static/*
+-var Static embed.FS //@rename("Static", "static")
+\ No newline at end of file
+diff -urN a/gopls/internal/lsp/testdata/rename/c/c2.go.golden b/gopls/internal/lsp/testdata/rename/c/c2.go.golden
+--- a/gopls/internal/lsp/testdata/rename/c/c2.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/c/c2.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,5 +0,0 @@
+--- static-rename --
+-package c
+-
+-//go:embed Static/*
+-var static embed.FS //@rename("Static", "static")
+diff -urN a/gopls/internal/lsp/testdata/rename/c/c.go b/gopls/internal/lsp/testdata/rename/c/c.go
+--- a/gopls/internal/lsp/testdata/rename/c/c.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/c/c.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-package c
+-
+-import "golang.org/lsptests/rename/b"
+-
+-func _() {
+- b.Hello() //@rename("Hello", "Goodbye")
+-}
+diff -urN a/gopls/internal/lsp/testdata/rename/c/c.go.golden b/gopls/internal/lsp/testdata/rename/c/c.go.golden
+--- a/gopls/internal/lsp/testdata/rename/c/c.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/c/c.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,32 +0,0 @@
+--- Goodbye-rename --
+-b.go:
+-package b
+-
+-var c int //@rename("int", "uint")
+-
+-func _() {
+- a := 1 //@rename("a", "error")
+- a = 2
+- _ = a
+-}
+-
+-var (
+- // Hello there.
+- // Foo does the thing.
+- Foo int //@rename("Foo", "Bob")
+-)
+-
+-/*
+-Goodbye description
+-*/
+-func Goodbye() {} //@rename("Hello", "Goodbye")
+-
+-c.go:
+-package c
+-
+-import "golang.org/lsptests/rename/b"
+-
+-func _() {
+- b.Goodbye() //@rename("Hello", "Goodbye")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/rename/crosspkg/another/another.go b/gopls/internal/lsp/testdata/rename/crosspkg/another/another.go
+--- a/gopls/internal/lsp/testdata/rename/crosspkg/another/another.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/crosspkg/another/another.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-package another
+-
+-type (
+- I interface{ F() }
+- C struct{ I }
+-)
+-
+-func (C) g()
+-
+-func _() {
+- var x I = C{}
+- x.F() //@rename("F", "G")
+-}
+diff -urN a/gopls/internal/lsp/testdata/rename/crosspkg/another/another.go.golden b/gopls/internal/lsp/testdata/rename/crosspkg/another/another.go.golden
+--- a/gopls/internal/lsp/testdata/rename/crosspkg/another/another.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/crosspkg/another/another.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,15 +0,0 @@
+--- G-rename --
+-package another
+-
+-type (
+- I interface{ G() }
+- C struct{ I }
+-)
+-
+-func (C) g()
+-
+-func _() {
+- var x I = C{}
+- x.G() //@rename("F", "G")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/rename/crosspkg/crosspkg.go b/gopls/internal/lsp/testdata/rename/crosspkg/crosspkg.go
+--- a/gopls/internal/lsp/testdata/rename/crosspkg/crosspkg.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/crosspkg/crosspkg.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-package crosspkg
+-
+-func Foo() { //@rename("Foo", "Dolphin")
+-
+-}
+-
+-var Bar int //@rename("Bar", "Tomato")
+diff -urN a/gopls/internal/lsp/testdata/rename/crosspkg/crosspkg.go.golden b/gopls/internal/lsp/testdata/rename/crosspkg/crosspkg.go.golden
+--- a/gopls/internal/lsp/testdata/rename/crosspkg/crosspkg.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/crosspkg/crosspkg.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,40 +0,0 @@
+--- Dolphin-rename --
+-crosspkg.go:
+-package crosspkg
+-
+-func Dolphin() { //@rename("Foo", "Dolphin")
+-
+-}
+-
+-var Bar int //@rename("Bar", "Tomato")
+-
+-other.go:
+-package other
+-
+-import "golang.org/lsptests/rename/crosspkg"
+-
+-func Other() {
+- crosspkg.Bar
+- crosspkg.Dolphin() //@rename("Foo", "Flamingo")
+-}
+-
+--- Tomato-rename --
+-crosspkg.go:
+-package crosspkg
+-
+-func Foo() { //@rename("Foo", "Dolphin")
+-
+-}
+-
+-var Tomato int //@rename("Bar", "Tomato")
+-
+-other.go:
+-package other
+-
+-import "golang.org/lsptests/rename/crosspkg"
+-
+-func Other() {
+- crosspkg.Tomato
+- crosspkg.Foo() //@rename("Foo", "Flamingo")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/rename/crosspkg/other/other.go b/gopls/internal/lsp/testdata/rename/crosspkg/other/other.go
+--- a/gopls/internal/lsp/testdata/rename/crosspkg/other/other.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/crosspkg/other/other.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-package other
+-
+-import "golang.org/lsptests/rename/crosspkg"
+-
+-func Other() {
+- crosspkg.Bar
+- crosspkg.Foo() //@rename("Foo", "Flamingo")
+-}
+diff -urN a/gopls/internal/lsp/testdata/rename/crosspkg/other/other.go.golden b/gopls/internal/lsp/testdata/rename/crosspkg/other/other.go.golden
+--- a/gopls/internal/lsp/testdata/rename/crosspkg/other/other.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/crosspkg/other/other.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,20 +0,0 @@
+--- Flamingo-rename --
+-crosspkg.go:
+-package crosspkg
+-
+-func Flamingo() { //@rename("Foo", "Dolphin")
+-
+-}
+-
+-var Bar int //@rename("Bar", "Tomato")
+-
+-other.go:
+-package other
+-
+-import "golang.org/lsptests/rename/crosspkg"
+-
+-func Other() {
+- crosspkg.Bar
+- crosspkg.Flamingo() //@rename("Foo", "Flamingo")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/rename/generics/embedded.go b/gopls/internal/lsp/testdata/rename/generics/embedded.go
+--- a/gopls/internal/lsp/testdata/rename/generics/embedded.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/generics/embedded.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-//go:build go1.18
+-// +build go1.18
+-
+-package generics
+-
+-type foo[P any] int //@rename("foo","bar")
+-
+-var x struct{ foo[int] }
+-
+-var _ = x.foo
+diff -urN a/gopls/internal/lsp/testdata/rename/generics/embedded.go.golden b/gopls/internal/lsp/testdata/rename/generics/embedded.go.golden
+--- a/gopls/internal/lsp/testdata/rename/generics/embedded.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/generics/embedded.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+--- bar-rename --
+-//go:build go1.18
+-// +build go1.18
+-
+-package generics
+-
+-type bar[P any] int //@rename("foo","bar")
+-
+-var x struct{ bar[int] }
+-
+-var _ = x.bar
+-
+diff -urN a/gopls/internal/lsp/testdata/rename/generics/generics.go b/gopls/internal/lsp/testdata/rename/generics/generics.go
+--- a/gopls/internal/lsp/testdata/rename/generics/generics.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/generics/generics.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,25 +0,0 @@
+-//go:build go1.18
+-// +build go1.18
+-
+-package generics
+-
+-type G[P any] struct {
+- F int
+-}
+-
+-func (G[_]) M() {}
+-
+-func F[P any](P) {
+- var p P //@rename("P", "Q")
+- _ = p
+-}
+-
+-func _() {
+- var x G[int] //@rename("G", "H")
+- _ = x.F //@rename("F", "K")
+- x.M() //@rename("M", "N")
+-
+- var y G[string]
+- _ = y.F
+- y.M()
+-}
+diff -urN a/gopls/internal/lsp/testdata/rename/generics/generics.go.golden b/gopls/internal/lsp/testdata/rename/generics/generics.go.golden
+--- a/gopls/internal/lsp/testdata/rename/generics/generics.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/generics/generics.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,108 +0,0 @@
+--- H-rename --
+-//go:build go1.18
+-// +build go1.18
+-
+-package generics
+-
+-type H[P any] struct {
+- F int
+-}
+-
+-func (H[_]) M() {}
+-
+-func F[P any](P) {
+- var p P //@rename("P", "Q")
+- _ = p
+-}
+-
+-func _() {
+- var x H[int] //@rename("G", "H")
+- _ = x.F //@rename("F", "K")
+- x.M() //@rename("M", "N")
+-
+- var y H[string]
+- _ = y.F
+- y.M()
+-}
+-
+--- K-rename --
+-//go:build go1.18
+-// +build go1.18
+-
+-package generics
+-
+-type G[P any] struct {
+- K int
+-}
+-
+-func (G[_]) M() {}
+-
+-func F[P any](P) {
+- var p P //@rename("P", "Q")
+- _ = p
+-}
+-
+-func _() {
+- var x G[int] //@rename("G", "H")
+- _ = x.K //@rename("F", "K")
+- x.M() //@rename("M", "N")
+-
+- var y G[string]
+- _ = y.K
+- y.M()
+-}
+-
+--- N-rename --
+-//go:build go1.18
+-// +build go1.18
+-
+-package generics
+-
+-type G[P any] struct {
+- F int
+-}
+-
+-func (G[_]) N() {}
+-
+-func F[P any](P) {
+- var p P //@rename("P", "Q")
+- _ = p
+-}
+-
+-func _() {
+- var x G[int] //@rename("G", "H")
+- _ = x.F //@rename("F", "K")
+- x.N() //@rename("M", "N")
+-
+- var y G[string]
+- _ = y.F
+- y.N()
+-}
+-
+--- Q-rename --
+-//go:build go1.18
+-// +build go1.18
+-
+-package generics
+-
+-type G[P any] struct {
+- F int
+-}
+-
+-func (G[_]) M() {}
+-
+-func F[Q any](Q) {
+- var p Q //@rename("P", "Q")
+- _ = p
+-}
+-
+-func _() {
+- var x G[int] //@rename("G", "H")
+- _ = x.F //@rename("F", "K")
+- x.M() //@rename("M", "N")
+-
+- var y G[string]
+- _ = y.F
+- y.M()
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/rename/generics/unions.go b/gopls/internal/lsp/testdata/rename/generics/unions.go
+--- a/gopls/internal/lsp/testdata/rename/generics/unions.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/generics/unions.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-//go:build go1.18
+-// +build go1.18
+-
+-package generics
+-
+-type T string //@rename("T", "R")
+-
+-type C interface {
+- T | ~int //@rename("T", "S")
+-}
+diff -urN a/gopls/internal/lsp/testdata/rename/generics/unions.go.golden b/gopls/internal/lsp/testdata/rename/generics/unions.go.golden
+--- a/gopls/internal/lsp/testdata/rename/generics/unions.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/generics/unions.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+--- R-rename --
+-//go:build go1.18
+-// +build go1.18
+-
+-package generics
+-
+-type R string //@rename("T", "R")
+-
+-type C interface {
+- R | ~int //@rename("T", "S")
+-}
+-
+--- S-rename --
+-//go:build go1.18
+-// +build go1.18
+-
+-package generics
+-
+-type S string //@rename("T", "R")
+-
+-type C interface {
+- S | ~int //@rename("T", "S")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/rename/issue39614/issue39614.go.golden b/gopls/internal/lsp/testdata/rename/issue39614/issue39614.go.golden
+--- a/gopls/internal/lsp/testdata/rename/issue39614/issue39614.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/issue39614/issue39614.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+--- bar-rename --
+-package issue39614
+-
+-func fn() {
+- var bar bool //@rename("foo","bar")
+- make(map[string]bool
+- if true {
+- }
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/rename/issue39614/issue39614.go.in b/gopls/internal/lsp/testdata/rename/issue39614/issue39614.go.in
+--- a/gopls/internal/lsp/testdata/rename/issue39614/issue39614.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/issue39614/issue39614.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-package issue39614
+-
+-func fn() {
+- var foo bool //@rename("foo","bar")
+- make(map[string]bool
+- if true {
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/rename/issue42134/1.go b/gopls/internal/lsp/testdata/rename/issue42134/1.go
+--- a/gopls/internal/lsp/testdata/rename/issue42134/1.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/issue42134/1.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-package issue42134
+-
+-func _() {
+- // foo computes things.
+- foo := func() {}
+-
+- foo() //@rename("foo", "bar")
+-}
+diff -urN a/gopls/internal/lsp/testdata/rename/issue42134/1.go.golden b/gopls/internal/lsp/testdata/rename/issue42134/1.go.golden
+--- a/gopls/internal/lsp/testdata/rename/issue42134/1.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/issue42134/1.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+--- bar-rename --
+-package issue42134
+-
+-func _() {
+- // bar computes things.
+- bar := func() {}
+-
+- bar() //@rename("foo", "bar")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/rename/issue42134/2.go b/gopls/internal/lsp/testdata/rename/issue42134/2.go
+--- a/gopls/internal/lsp/testdata/rename/issue42134/2.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/issue42134/2.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+-package issue42134
+-
+-import "fmt"
+-
+-func _() {
+- // minNumber is a min number.
+- // Second line.
+- minNumber := min(1, 2)
+- fmt.Println(minNumber) //@rename("minNumber", "res")
+-}
+-
+-func min(a, b int) int { return a }
+diff -urN a/gopls/internal/lsp/testdata/rename/issue42134/2.go.golden b/gopls/internal/lsp/testdata/rename/issue42134/2.go.golden
+--- a/gopls/internal/lsp/testdata/rename/issue42134/2.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/issue42134/2.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+--- res-rename --
+-package issue42134
+-
+-import "fmt"
+-
+-func _() {
+- // res is a min number.
+- // Second line.
+- res := min(1, 2)
+- fmt.Println(res) //@rename("minNumber", "res")
+-}
+-
+-func min(a, b int) int { return a }
+-
+diff -urN a/gopls/internal/lsp/testdata/rename/issue42134/3.go b/gopls/internal/lsp/testdata/rename/issue42134/3.go
+--- a/gopls/internal/lsp/testdata/rename/issue42134/3.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/issue42134/3.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-package issue42134
+-
+-func _() {
+- /*
+- tests contains test cases
+- */
+- tests := []struct { //@rename("tests", "testCases")
+- in, out string
+- }{}
+- _ = tests
+-}
+diff -urN a/gopls/internal/lsp/testdata/rename/issue42134/3.go.golden b/gopls/internal/lsp/testdata/rename/issue42134/3.go.golden
+--- a/gopls/internal/lsp/testdata/rename/issue42134/3.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/issue42134/3.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+--- testCases-rename --
+-package issue42134
+-
+-func _() {
+- /*
+- testCases contains test cases
+- */
+- testCases := []struct { //@rename("tests", "testCases")
+- in, out string
+- }{}
+- _ = testCases
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/rename/issue42134/4.go b/gopls/internal/lsp/testdata/rename/issue42134/4.go
+--- a/gopls/internal/lsp/testdata/rename/issue42134/4.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/issue42134/4.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-package issue42134
+-
+-func _() {
+- // a is equal to 5. Comment must stay the same
+-
+- a := 5
+- _ = a //@rename("a", "b")
+-}
+diff -urN a/gopls/internal/lsp/testdata/rename/issue42134/4.go.golden b/gopls/internal/lsp/testdata/rename/issue42134/4.go.golden
+--- a/gopls/internal/lsp/testdata/rename/issue42134/4.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/issue42134/4.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+--- b-rename --
+-package issue42134
+-
+-func _() {
+- // a is equal to 5. Comment must stay the same
+-
+- b := 5
+- _ = b //@rename("a", "b")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/rename/issue43616/issue43616.go.golden b/gopls/internal/lsp/testdata/rename/issue43616/issue43616.go.golden
+--- a/gopls/internal/lsp/testdata/rename/issue43616/issue43616.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/issue43616/issue43616.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+--- bar-rename --
+-package issue43616
+-
+-type bar int //@rename("foo","bar"),prepare("oo","foo","foo")
+-
+-var x struct{ bar } //@rename("foo","baz")
+-
+-var _ = x.bar //@rename("foo","quux")
+-
+--- baz-rename --
+-can't rename embedded fields: rename the type directly or name the field
+--- quux-rename --
+-can't rename embedded fields: rename the type directly or name the field
+diff -urN a/gopls/internal/lsp/testdata/rename/issue43616/issue43616.go.in b/gopls/internal/lsp/testdata/rename/issue43616/issue43616.go.in
+--- a/gopls/internal/lsp/testdata/rename/issue43616/issue43616.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/issue43616/issue43616.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-package issue43616
+-
+-type foo int //@rename("foo","bar"),prepare("oo","foo","foo")
+-
+-var x struct{ foo } //@rename("foo","baz")
+-
+-var _ = x.foo //@rename("foo","quux")
+diff -urN a/gopls/internal/lsp/testdata/rename/shadow/shadow.go b/gopls/internal/lsp/testdata/rename/shadow/shadow.go
+--- a/gopls/internal/lsp/testdata/rename/shadow/shadow.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/shadow/shadow.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,20 +0,0 @@
+-package shadow
+-
+-func _() {
+- a := true
+- b, c, _ := A(), B(), D() //@rename("A", "a"),rename("B", "b"),rename("b", "c"),rename("D", "d")
+- d := false
+- _, _, _, _ = a, b, c, d
+-}
+-
+-func A() int {
+- return 0
+-}
+-
+-func B() int {
+- return 0
+-}
+-
+-func D() int {
+- return 0
+-}
+diff -urN a/gopls/internal/lsp/testdata/rename/shadow/shadow.go.golden b/gopls/internal/lsp/testdata/rename/shadow/shadow.go.golden
+--- a/gopls/internal/lsp/testdata/rename/shadow/shadow.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/shadow/shadow.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,51 +0,0 @@
+--- a-rename --
+-shadow/shadow.go:10:6: renaming this func "A" to "a"
+-shadow/shadow.go:5:13: would cause this reference to become shadowed
+-shadow/shadow.go:4:2: by this intervening var definition
+--- b-rename --
+-package shadow
+-
+-func _() {
+- a := true
+- b, c, _ := A(), b(), D() //@rename("A", "a"),rename("B", "b"),rename("b", "c"),rename("D", "d")
+- d := false
+- _, _, _, _ = a, b, c, d
+-}
+-
+-func A() int {
+- return 0
+-}
+-
+-func b() int {
+- return 0
+-}
+-
+-func D() int {
+- return 0
+-}
+-
+--- c-rename --
+-shadow/shadow.go:5:2: renaming this var "b" to "c"
+-shadow/shadow.go:5:5: conflicts with var in same block
+--- d-rename --
+-package shadow
+-
+-func _() {
+- a := true
+- b, c, _ := A(), B(), d() //@rename("A", "a"),rename("B", "b"),rename("b", "c"),rename("D", "d")
+- d := false
+- _, _, _, _ = a, b, c, d
+-}
+-
+-func A() int {
+- return 0
+-}
+-
+-func B() int {
+- return 0
+-}
+-
+-func d() int {
+- return 0
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/rename/testy/testy.go b/gopls/internal/lsp/testdata/rename/testy/testy.go
+--- a/gopls/internal/lsp/testdata/rename/testy/testy.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/testy/testy.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-package testy
+-
+-type tt int //@rename("tt", "testyType")
+-
+-func a() {
+- foo := 42 //@rename("foo", "bar")
+-}
+diff -urN a/gopls/internal/lsp/testdata/rename/testy/testy.go.golden b/gopls/internal/lsp/testdata/rename/testy/testy.go.golden
+--- a/gopls/internal/lsp/testdata/rename/testy/testy.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/testy/testy.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+--- bar-rename --
+-package testy
+-
+-type tt int //@rename("tt", "testyType")
+-
+-func a() {
+- bar := 42 //@rename("foo", "bar")
+-}
+-
+--- testyType-rename --
+-package testy
+-
+-type testyType int //@rename("tt", "testyType")
+-
+-func a() {
+- foo := 42 //@rename("foo", "bar")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/rename/testy/testy_test.go b/gopls/internal/lsp/testdata/rename/testy/testy_test.go
+--- a/gopls/internal/lsp/testdata/rename/testy/testy_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/testy/testy_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,8 +0,0 @@
+-package testy
+-
+-import "testing"
+-
+-func TestSomething(t *testing.T) {
+- var x int //@rename("x", "testyX")
+- a() //@rename("a", "b")
+-}
+diff -urN a/gopls/internal/lsp/testdata/rename/testy/testy_test.go.golden b/gopls/internal/lsp/testdata/rename/testy/testy_test.go.golden
+--- a/gopls/internal/lsp/testdata/rename/testy/testy_test.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rename/testy/testy_test.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,30 +0,0 @@
+--- b-rename --
+-testy.go:
+-package testy
+-
+-type tt int //@rename("tt", "testyType")
+-
+-func b() {
+- foo := 42 //@rename("foo", "bar")
+-}
+-
+-testy_test.go:
+-package testy
+-
+-import "testing"
+-
+-func TestSomething(t *testing.T) {
+- var x int //@rename("x", "testyX")
+- b() //@rename("a", "b")
+-}
+-
+--- testyX-rename --
+-package testy
+-
+-import "testing"
+-
+-func TestSomething(t *testing.T) {
+- var testyX int //@rename("x", "testyX")
+- a() //@rename("a", "b")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/rundespiteerrors/rundespiteerrors.go b/gopls/internal/lsp/testdata/rundespiteerrors/rundespiteerrors.go
+--- a/gopls/internal/lsp/testdata/rundespiteerrors/rundespiteerrors.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/rundespiteerrors/rundespiteerrors.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+-package rundespiteerrors
+-
+-// This test verifies that analyzers without RunDespiteErrors are not
+-// executed on a package containing type errors (see issue #54762).
+-func _() {
+- // A type error.
+- _ = 1 + "" //@diag("1", "compiler", "mismatched types|cannot convert", "error")
+-
+- // A violation of an analyzer for which RunDespiteErrors=false:
+- // no diagnostic is produced; the diag comment is merely illustrative.
+- for _ = range "" { //diag("for _", "simplifyrange", "simplify range expression", "warning")
+-
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/selectionrange/foo.go b/gopls/internal/lsp/testdata/selectionrange/foo.go
+--- a/gopls/internal/lsp/testdata/selectionrange/foo.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/selectionrange/foo.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-package foo
+-
+-import "time"
+-
+-func Bar(x, y int, t time.Time) int {
+- zs := []int{1, 2, 3} //@selectionrange("1")
+-
+- for _, z := range zs {
+- x = x + z + y + zs[1] //@selectionrange("1")
+- }
+-
+- return x + y //@selectionrange("+")
+-}
+diff -urN a/gopls/internal/lsp/testdata/selectionrange/foo.go.golden b/gopls/internal/lsp/testdata/selectionrange/foo.go.golden
+--- a/gopls/internal/lsp/testdata/selectionrange/foo.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/selectionrange/foo.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,29 +0,0 @@
+--- selectionrange_foo_12_11 --
+-Ranges 0:
+- 11:8-11:13 "x + y"
+- 11:1-11:13 "return x + y"
+- 4:36-12:1 "{\\n\tzs := []int{...ionrange(\"+\")\\n}"
+- 4:0-12:1 "func Bar(x, y i...ionrange(\"+\")\\n}"
+- 0:0-12:1 "package foo\\n\\nim...ionrange(\"+\")\\n}"
+-
+--- selectionrange_foo_6_14 --
+-Ranges 0:
+- 5:13-5:14 "1"
+- 5:7-5:21 "[]int{1, 2, 3}"
+- 5:1-5:21 "zs := []int{1, 2, 3}"
+- 4:36-12:1 "{\\n\tzs := []int{...ionrange(\"+\")\\n}"
+- 4:0-12:1 "func Bar(x, y i...ionrange(\"+\")\\n}"
+- 0:0-12:1 "package foo\\n\\nim...ionrange(\"+\")\\n}"
+-
+--- selectionrange_foo_9_22 --
+-Ranges 0:
+- 8:21-8:22 "1"
+- 8:18-8:23 "zs[1]"
+- 8:6-8:23 "x + z + y + zs[1]"
+- 8:2-8:23 "x = x + z + y + zs[1]"
+- 7:22-9:2 "{\\n\t\tx = x + z +...onrange(\"1\")\\n\t}"
+- 7:1-9:2 "for _, z := ran...onrange(\"1\")\\n\t}"
+- 4:36-12:1 "{\\n\tzs := []int{...ionrange(\"+\")\\n}"
+- 4:0-12:1 "func Bar(x, y i...ionrange(\"+\")\\n}"
+- 0:0-12:1 "package foo\\n\\nim...ionrange(\"+\")\\n}"
+-
+diff -urN a/gopls/internal/lsp/testdata/selector/selector.go.in b/gopls/internal/lsp/testdata/selector/selector.go.in
+--- a/gopls/internal/lsp/testdata/selector/selector.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/selector/selector.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,66 +0,0 @@
+-// +build go1.11
+-
+-package selector
+-
+-import (
+- "golang.org/lsptests/bar"
+-)
+-
+-type S struct {
+- B, A, C int //@item(Bf, "B", "int", "field"),item(Af, "A", "int", "field"),item(Cf, "C", "int", "field")
+-}
+-
+-func _() {
+- _ = S{}.; //@complete(";", Af, Bf, Cf)
+-}
+-
+-type bob struct { a int } //@item(a, "a", "int", "field")
+-type george struct { b int }
+-type jack struct { c int } //@item(c, "c", "int", "field")
+-type jill struct { d int }
+-
+-func (b *bob) george() *george {} //@item(george, "george", "func() *george", "method")
+-func (g *george) jack() *jack {}
+-func (j *jack) jill() *jill {} //@item(jill, "jill", "func() *jill", "method")
+-
+-func _() {
+- b := &bob{}
+- y := b.george().
+- jack();
+- y.; //@complete(";", c, jill)
+-}
+-
+-func _() {
+- bar. //@complete(" /", Bar)
+- x := 5
+-
+- var b *bob
+- b. //@complete(" /", a, george)
+- y, z := 5, 6
+-
+- b. //@complete(" /", a, george)
+- y, z, a, b, c := 5, 6
+-}
+-
+-func _() {
+- bar. //@complete(" /", Bar)
+- bar.Bar()
+-
+- bar. //@complete(" /", Bar)
+- go f()
+-}
+-
+-func _() {
+- var b *bob
+- if y != b. //@complete(" /", a, george)
+- z := 5
+-
+- if z + y + 1 + b. //@complete(" /", a, george)
+- r, s, t := 4, 5
+-
+- if y != b. //@complete(" /", a, george)
+- z = 5
+-
+- if z + y + 1 + b. //@complete(" /", a, george)
+- r = 4
+-}
+diff -urN a/gopls/internal/lsp/testdata/semantic/a.go b/gopls/internal/lsp/testdata/semantic/a.go
+--- a/gopls/internal/lsp/testdata/semantic/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/semantic/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,81 +0,0 @@
+-package semantictokens //@ semantic("")
+-
+-import (
+- _ "encoding/utf8"
+- utf "encoding/utf8"
+- "fmt" //@ semantic("fmt")
+- . "fmt"
+- "unicode/utf8"
+-)
+-
+-var (
+- a = fmt.Print
+- b []string = []string{"foo"}
+- c1 chan int
+- c2 <-chan int
+- c3 = make([]chan<- int)
+- b = A{X: 23}
+- m map[bool][3]*float64
+-)
+-
+-const (
+- xx F = iota
+- yy = xx + 3
+- zz = ""
+- ww = "not " + zz
+-)
+-
+-type A struct {
+- X int `foof`
+-}
+-type B interface {
+- A
+- sad(int) bool
+-}
+-
+-type F int
+-
+-func (a *A) f() bool {
+- var z string
+- x := "foo"
+- a(x)
+- y := "bar" + x
+- switch z {
+- case "xx":
+- default:
+- }
+- select {
+- case z := <-c3[0]:
+- default:
+- }
+- for k, v := range m {
+- return (!k) && v[0] == nil
+- }
+- c2 <- A.X
+- w := b[4:]
+- j := len(x)
+- j--
+- q := []interface{}{j, 23i, &y}
+- g(q...)
+- return true
+-}
+-
+-func g(vv ...interface{}) {
+- ff := func() {}
+- defer ff()
+- go utf.RuneCount("")
+- go utf8.RuneCount(vv.(string))
+- if true {
+- } else {
+- }
+-Never:
+- for i := 0; i < 10; {
+- break Never
+- }
+- _, ok := vv[0].(A)
+- if !ok {
+- switch x := vv[0].(type) {
+- }
+- goto Never
+- }
+-}
+diff -urN a/gopls/internal/lsp/testdata/semantic/a.go.golden b/gopls/internal/lsp/testdata/semantic/a.go.golden
+--- a/gopls/internal/lsp/testdata/semantic/a.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/semantic/a.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,83 +0,0 @@
+--- semantic --
+-/*⇒7,keyword,[]*/package /*⇒14,namespace,[]*/semantictokens /*⇒16,comment,[]*///@ semantic("")
+-
+-/*⇒6,keyword,[]*/import (
+- _ "encoding/utf8"
+- /*⇒3,namespace,[]*/utf "encoding/utf8"
+- "fmt"/*⇐3,namespace,[]*/ /*⇒19,comment,[]*///@ semantic("fmt")
+- . "fmt"
+- "unicode/utf8"/*⇐4,namespace,[]*/
+-)
+-
+-/*⇒3,keyword,[]*/var (
+- /*⇒1,variable,[definition]*/a = /*⇒3,namespace,[]*/fmt./*⇒5,function,[]*/Print
+- /*⇒1,variable,[definition]*/b []/*⇒6,type,[defaultLibrary]*/string = []/*⇒6,type,[defaultLibrary]*/string{/*⇒5,string,[]*/"foo"}
+- /*⇒2,variable,[definition]*/c1 /*⇒4,keyword,[]*/chan /*⇒3,type,[defaultLibrary]*/int
+- /*⇒2,variable,[definition]*/c2 /*⇒2,operator,[]*/<-/*⇒4,keyword,[]*/chan /*⇒3,type,[defaultLibrary]*/int
+- /*⇒2,variable,[definition]*/c3 = /*⇒4,function,[defaultLibrary]*/make([]/*⇒4,keyword,[]*/chan/*⇒2,operator,[]*/<- /*⇒3,type,[defaultLibrary]*/int)
+- /*⇒1,variable,[definition]*/b = /*⇒1,type,[]*/A{/*⇒1,variable,[]*/X: /*⇒2,number,[]*/23}
+- /*⇒1,variable,[definition]*/m /*⇒3,keyword,[]*/map[/*⇒4,type,[defaultLibrary]*/bool][/*⇒1,number,[]*/3]/*⇒1,operator,[]*/*/*⇒7,type,[defaultLibrary]*/float64
+-)
+-
+-/*⇒5,keyword,[]*/const (
+- /*⇒2,variable,[definition readonly]*/xx /*⇒1,type,[]*/F = /*⇒4,variable,[readonly]*/iota
+- /*⇒2,variable,[definition readonly]*/yy = /*⇒2,variable,[readonly]*/xx /*⇒1,operator,[]*/+ /*⇒1,number,[]*/3
+- /*⇒2,variable,[definition readonly]*/zz = /*⇒2,string,[]*/""
+- /*⇒2,variable,[definition readonly]*/ww = /*⇒6,string,[]*/"not " /*⇒1,operator,[]*/+ /*⇒2,variable,[readonly]*/zz
+-)
+-
+-/*⇒4,keyword,[]*/type /*⇒1,type,[definition]*/A /*⇒6,keyword,[]*/struct {
+- /*⇒1,variable,[definition]*/X /*⇒3,type,[defaultLibrary]*/int /*⇒6,string,[]*/`foof`
+-}
+-/*⇒4,keyword,[]*/type /*⇒1,type,[definition]*/B /*⇒9,keyword,[]*/interface {
+- /*⇒1,type,[]*/A
+- /*⇒3,method,[definition]*/sad(/*⇒3,type,[defaultLibrary]*/int) /*⇒4,type,[defaultLibrary]*/bool
+-}
+-
+-/*⇒4,keyword,[]*/type /*⇒1,type,[definition]*/F /*⇒3,type,[defaultLibrary]*/int
+-
+-/*⇒4,keyword,[]*/func (/*⇒1,variable,[]*/a /*⇒1,operator,[]*/*/*⇒1,type,[]*/A) /*⇒1,method,[definition]*/f() /*⇒4,type,[defaultLibrary]*/bool {
+- /*⇒3,keyword,[]*/var /*⇒1,variable,[definition]*/z /*⇒6,type,[defaultLibrary]*/string
+- /*⇒1,variable,[definition]*/x /*⇒2,operator,[]*/:= /*⇒5,string,[]*/"foo"
+- /*⇒1,variable,[]*/a(/*⇒1,variable,[]*/x)
+- /*⇒1,variable,[definition]*/y /*⇒2,operator,[]*/:= /*⇒5,string,[]*/"bar" /*⇒1,operator,[]*/+ /*⇒1,variable,[]*/x
+- /*⇒6,keyword,[]*/switch /*⇒1,variable,[]*/z {
+- /*⇒4,keyword,[]*/case /*⇒4,string,[]*/"xx":
+- /*⇒7,keyword,[]*/default:
+- }
+- /*⇒6,keyword,[]*/select {
+- /*⇒4,keyword,[]*/case /*⇒1,variable,[definition]*/z /*⇒2,operator,[]*/:= /*⇒2,operator,[]*/<-/*⇒2,variable,[]*/c3[/*⇒1,number,[]*/0]:
+- /*⇒7,keyword,[]*/default:
+- }
+- /*⇒3,keyword,[]*/for /*⇒1,variable,[definition]*/k, /*⇒1,variable,[definition]*/v := /*⇒5,keyword,[]*/range /*⇒1,variable,[]*/m {
+- /*⇒6,keyword,[]*/return (/*⇒1,operator,[]*/!/*⇒1,variable,[]*/k) /*⇒2,operator,[]*/&& /*⇒1,variable,[]*/v[/*⇒1,number,[]*/0] /*⇒2,operator,[]*/== /*⇒3,variable,[readonly defaultLibrary]*/nil
+- }
+- /*⇒2,variable,[]*/c2 /*⇒2,operator,[]*/<- /*⇒1,type,[]*/A./*⇒1,variable,[]*/X
+- /*⇒1,variable,[definition]*/w /*⇒2,operator,[]*/:= /*⇒1,variable,[]*/b[/*⇒1,number,[]*/4:]
+- /*⇒1,variable,[definition]*/j /*⇒2,operator,[]*/:= /*⇒3,function,[defaultLibrary]*/len(/*⇒1,variable,[]*/x)
+- /*⇒1,variable,[]*/j/*⇒2,operator,[]*/--
+- /*⇒1,variable,[definition]*/q /*⇒2,operator,[]*/:= []/*⇒9,keyword,[]*/interface{}{/*⇒1,variable,[]*/j, /*⇒3,number,[]*/23i, /*⇒1,operator,[]*/&/*⇒1,variable,[]*/y}
+- /*⇒1,function,[]*/g(/*⇒1,variable,[]*/q/*⇒3,operator,[]*/...)
+- /*⇒6,keyword,[]*/return /*⇒4,variable,[readonly]*/true
+-}
+-
+-/*⇒4,keyword,[]*/func /*⇒1,function,[definition]*/g(/*⇒2,parameter,[definition]*/vv /*⇒3,operator,[]*/.../*⇒9,keyword,[]*/interface{}) {
+- /*⇒2,variable,[definition]*/ff /*⇒2,operator,[]*/:= /*⇒4,keyword,[]*/func() {}
+- /*⇒5,keyword,[]*/defer /*⇒2,function,[]*/ff()
+- /*⇒2,keyword,[]*/go /*⇒3,namespace,[]*/utf./*⇒9,function,[]*/RuneCount(/*⇒2,string,[]*/"")
+- /*⇒2,keyword,[]*/go /*⇒4,namespace,[]*/utf8./*⇒9,function,[]*/RuneCount(/*⇒2,parameter,[]*/vv.(/*⇒6,type,[]*/string))
+- /*⇒2,keyword,[]*/if /*⇒4,variable,[readonly]*/true {
+- } /*⇒4,keyword,[]*/else {
+- }
+-/*⇒5,parameter,[definition]*/Never:
+- /*⇒3,keyword,[]*/for /*⇒1,variable,[definition]*/i /*⇒2,operator,[]*/:= /*⇒1,number,[]*/0; /*⇒1,variable,[]*/i /*⇒1,operator,[]*/< /*⇒2,number,[]*/10; {
+- /*⇒5,keyword,[]*/break Never
+- }
+- _, /*⇒2,variable,[definition]*/ok /*⇒2,operator,[]*/:= /*⇒2,parameter,[]*/vv[/*⇒1,number,[]*/0].(/*⇒1,type,[]*/A)
+- /*⇒2,keyword,[]*/if /*⇒1,operator,[]*/!/*⇒2,variable,[]*/ok {
+- /*⇒6,keyword,[]*/switch /*⇒1,variable,[definition]*/x /*⇒2,operator,[]*/:= /*⇒2,parameter,[]*/vv[/*⇒1,number,[]*/0].(/*⇒4,keyword,[]*/type) {
+- }
+- /*⇒4,keyword,[]*/goto Never
+- }
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/semantic/b.go b/gopls/internal/lsp/testdata/semantic/b.go
+--- a/gopls/internal/lsp/testdata/semantic/b.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/semantic/b.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,38 +0,0 @@
+-package semantictokens //@ semantic("")
+-
+-func f(x ...interface{}) {
+-}
+-
+-func weirⰀd() { /*😀*/ // comment
+- const (
+- snil = nil
+- nil = true
+- true = false
+- false = snil
+- cmd = `foof`
+- double = iota
+- iota = copy
+- four = (len(cmd)/2 < 5)
+- five = four
+- )
+- f(cmd, nil, double, iota)
+-}
+-
+-/*
+-
+-multiline */ /*
+-multiline
+-*/
+-type AA int
+-type BB struct {
+- AA
+-}
+-type CC struct {
+- AA int
+-}
+-type D func(aa AA) (BB error)
+-type E func(AA) BB
+-
+-var a chan<- chan int
+-var b chan<- <-chan int
+-var c <-chan <-chan int
+diff -urN a/gopls/internal/lsp/testdata/semantic/b.go.golden b/gopls/internal/lsp/testdata/semantic/b.go.golden
+--- a/gopls/internal/lsp/testdata/semantic/b.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/semantic/b.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,40 +0,0 @@
+--- semantic --
+-/*⇒7,keyword,[]*/package /*⇒14,namespace,[]*/semantictokens /*⇒16,comment,[]*///@ semantic("")
+-
+-/*⇒4,keyword,[]*/func /*⇒1,function,[definition]*/f(/*⇒1,parameter,[definition]*/x /*⇒3,operator,[]*/.../*⇒9,keyword,[]*/interface{}) {
+-}
+-
+-/*⇒4,keyword,[]*/func /*⇒6,function,[definition]*/weirⰀd() { /*⇒5,comment,[]*//*😀*/ /*⇒10,comment,[]*/// comment
+- /*⇒5,keyword,[]*/const (
+- /*⇒4,variable,[definition readonly]*/snil = /*⇒3,variable,[readonly defaultLibrary]*/nil
+- /*⇒3,variable,[definition readonly]*/nil = /*⇒4,variable,[readonly]*/true
+- /*⇒4,variable,[definition readonly]*/true = /*⇒5,variable,[readonly]*/false
+- /*⇒5,variable,[definition readonly]*/false = /*⇒4,variable,[readonly]*/snil
+- /*⇒3,variable,[definition readonly]*/cmd = /*⇒6,string,[]*/`foof`
+- /*⇒6,variable,[definition readonly]*/double = /*⇒4,variable,[readonly]*/iota
+- /*⇒4,variable,[definition readonly]*/iota = /*⇒4,function,[defaultLibrary]*/copy
+- /*⇒4,variable,[definition readonly]*/four = (/*⇒3,function,[defaultLibrary]*/len(/*⇒3,variable,[readonly]*/cmd)/*⇒1,operator,[]*// /*⇒1,number,[]*/2 /*⇒1,operator,[]*/< /*⇒1,number,[]*/5)
+- /*⇒4,variable,[definition readonly]*/five = /*⇒4,variable,[readonly]*/four
+- )
+- /*⇒1,function,[]*/f(/*⇒3,variable,[readonly]*/cmd, /*⇒3,variable,[readonly]*/nil, /*⇒6,variable,[readonly]*/double, /*⇒4,variable,[readonly]*/iota)
+-}
+-
+-/*⇒2,comment,[]*//*
+-/*⇒0,comment,[]*/
+-/*⇒12,comment,[]*/multiline */ /*⇒2,comment,[]*//*
+-/*⇒9,comment,[]*/multiline
+-/*⇒2,comment,[]*/*/
+-/*⇒4,keyword,[]*/type /*⇒2,type,[definition]*/AA /*⇒3,type,[defaultLibrary]*/int
+-/*⇒4,keyword,[]*/type /*⇒2,type,[definition]*/BB /*⇒6,keyword,[]*/struct {
+- /*⇒2,type,[]*/AA
+-}
+-/*⇒4,keyword,[]*/type /*⇒2,type,[definition]*/CC /*⇒6,keyword,[]*/struct {
+- /*⇒2,variable,[definition]*/AA /*⇒3,type,[defaultLibrary]*/int
+-}
+-/*⇒4,keyword,[]*/type /*⇒1,type,[definition]*/D /*⇒4,keyword,[]*/func(/*⇒2,parameter,[definition]*/aa /*⇒2,type,[]*/AA) (/*⇒2,parameter,[definition]*/BB /*⇒5,type,[]*/error)
+-/*⇒4,keyword,[]*/type /*⇒1,type,[definition]*/E /*⇒4,keyword,[]*/func(/*⇒2,type,[]*/AA) /*⇒2,type,[]*/BB
+-
+-/*⇒3,keyword,[]*/var /*⇒1,variable,[definition]*/a /*⇒4,keyword,[]*/chan/*⇒2,operator,[]*/<- /*⇒4,keyword,[]*/chan /*⇒3,type,[defaultLibrary]*/int
+-/*⇒3,keyword,[]*/var /*⇒1,variable,[definition]*/b /*⇒4,keyword,[]*/chan/*⇒2,operator,[]*/<- /*⇒2,operator,[]*/<-/*⇒4,keyword,[]*/chan /*⇒3,type,[defaultLibrary]*/int
+-/*⇒3,keyword,[]*/var /*⇒1,variable,[definition]*/c /*⇒2,operator,[]*/<-/*⇒4,keyword,[]*/chan /*⇒2,operator,[]*/<-/*⇒4,keyword,[]*/chan /*⇒3,type,[defaultLibrary]*/int
+-
+diff -urN a/gopls/internal/lsp/testdata/semantic/README.md b/gopls/internal/lsp/testdata/semantic/README.md
+--- a/gopls/internal/lsp/testdata/semantic/README.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/semantic/README.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,2 +0,0 @@
+-The golden files are the output of `gopls semtok <src-file>`, with `-- semantic --`
+-inserted as the first line (the spaces are mandatory) and an extra newline at the end.
+diff -urN a/gopls/internal/lsp/testdata/semantic/semantic_test.go b/gopls/internal/lsp/testdata/semantic/semantic_test.go
+--- a/gopls/internal/lsp/testdata/semantic/semantic_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/semantic/semantic_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-package semantictokens
+-
+-import (
+- "os"
+- "testing"
+-)
+-
+-func TestSemanticTokens(t *testing.T) {
+- a, _ := os.Getwd()
+- // climb up to find internal/lsp
+- // find all the .go files
+-
+-}
+diff -urN a/gopls/internal/lsp/testdata/signature/signature2.go.golden b/gopls/internal/lsp/testdata/signature/signature2.go.golden
+--- a/gopls/internal/lsp/testdata/signature/signature2.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/signature/signature2.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,3 +0,0 @@
+--- Foo(a string, b int) (c bool)-signature --
+-Foo(a string, b int) (c bool)
+-
+diff -urN a/gopls/internal/lsp/testdata/signature/signature2.go.in b/gopls/internal/lsp/testdata/signature/signature2.go.in
+--- a/gopls/internal/lsp/testdata/signature/signature2.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/signature/signature2.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,5 +0,0 @@
+-package signature
+-
+-func _() {
+- Foo(//@signature("//", "Foo(a string, b int) (c bool)", 0)
+-}
+diff -urN a/gopls/internal/lsp/testdata/signature/signature3.go.golden b/gopls/internal/lsp/testdata/signature/signature3.go.golden
+--- a/gopls/internal/lsp/testdata/signature/signature3.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/signature/signature3.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,3 +0,0 @@
+--- Foo(a string, b int) (c bool)-signature --
+-Foo(a string, b int) (c bool)
+-
+diff -urN a/gopls/internal/lsp/testdata/signature/signature3.go.in b/gopls/internal/lsp/testdata/signature/signature3.go.in
+--- a/gopls/internal/lsp/testdata/signature/signature3.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/signature/signature3.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,5 +0,0 @@
+-package signature
+-
+-func _() {
+- Foo("hello",//@signature("//", "Foo(a string, b int) (c bool)", 1)
+-}
+\ No newline at end of file
+diff -urN a/gopls/internal/lsp/testdata/signature/signature.go b/gopls/internal/lsp/testdata/signature/signature.go
+--- a/gopls/internal/lsp/testdata/signature/signature.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/signature/signature.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,85 +0,0 @@
+-// Package signature has tests for signature help.
+-package signature
+-
+-import (
+- "bytes"
+- "encoding/json"
+- "math/big"
+-)
+-
+-func Foo(a string, b int) (c bool) {
+- return
+-}
+-
+-func Bar(float64, ...byte) {
+-}
+-
+-type myStruct struct{}
+-
+-func (*myStruct) foo(e *json.Decoder) (*big.Int, error) {
+- return nil, nil
+-}
+-
+-type MyType struct{}
+-
+-type MyFunc func(foo int) string
+-
+-type Alias = int
+-type OtherAlias = int
+-type StringAlias = string
+-
+-func AliasSlice(a []*Alias) (b Alias) { return 0 }
+-func AliasMap(a map[*Alias]StringAlias) (b, c map[*Alias]StringAlias) { return nil, nil }
+-func OtherAliasMap(a, b map[Alias]OtherAlias) map[Alias]OtherAlias { return nil }
+-
+-func Qux() {
+- Foo("foo", 123) //@signature("(", "Foo(a string, b int) (c bool)", 0)
+- Foo("foo", 123) //@signature("123", "Foo(a string, b int) (c bool)", 1)
+- Foo("foo", 123) //@signature(",", "Foo(a string, b int) (c bool)", 0)
+- Foo("foo", 123) //@signature(" 1", "Foo(a string, b int) (c bool)", 1)
+- Foo("foo", 123) //@signature(")", "Foo(a string, b int) (c bool)", 1)
+-
+- Bar(13.37, 0x13) //@signature("13.37", "Bar(float64, ...byte)", 0)
+- Bar(13.37, 0x37) //@signature("0x37", "Bar(float64, ...byte)", 1)
+- Bar(13.37, 1, 2, 3, 4) //@signature("4", "Bar(float64, ...byte)", 1)
+-
+- fn := func(hi, there string) func(i int) rune {
+- return func(int) rune { return 0 }
+- }
+-
+- fn("hi", "there") //@signature("hi", "", 0)
+- fn("hi", "there") //@signature(",", "fn(hi string, there string) func(i int) rune", 0)
+- fn("hi", "there")(1) //@signature("1", "func(i int) rune", 0)
+-
+- fnPtr := &fn
+- (*fnPtr)("hi", "there") //@signature(",", "func(hi string, there string) func(i int) rune", 0)
+-
+- var fnIntf interface{} = Foo
+- fnIntf.(func(string, int) bool)("hi", 123) //@signature("123", "func(string, int) bool", 1)
+-
+- (&bytes.Buffer{}).Next(2) //@signature("2", "Next(n int) []byte", 0)
+-
+- myFunc := MyFunc(func(n int) string { return "" })
+- myFunc(123) //@signature("123", "myFunc(foo int) string", 0)
+-
+- var ms myStruct
+- ms.foo(nil) //@signature("nil", "foo(e *json.Decoder) (*big.Int, error)", 0)
+-
+- _ = make([]int, 1, 2) //@signature("2", "make(t Type, size ...int) Type", 1)
+-
+- Foo(myFunc(123), 456) //@signature("myFunc", "Foo(a string, b int) (c bool)", 0)
+- Foo(myFunc(123), 456) //@signature("123", "myFunc(foo int) string", 0)
+-
+- panic("oops!") //@signature(")", "panic(v interface{})", 0)
+- println("hello", "world") //@signature(",", "println(args ...Type)", 0)
+-
+- Hello(func() {
+- //@signature("//", "", 0)
+- })
+-
+- AliasSlice() //@signature(")", "AliasSlice(a []*Alias) (b Alias)", 0)
+- AliasMap() //@signature(")", "AliasMap(a map[*Alias]StringAlias) (b map[*Alias]StringAlias, c map[*Alias]StringAlias)", 0)
+- OtherAliasMap() //@signature(")", "OtherAliasMap(a map[Alias]OtherAlias, b map[Alias]OtherAlias) map[Alias]OtherAlias", 0)
+-}
+-
+-func Hello(func()) {}
+diff -urN a/gopls/internal/lsp/testdata/signature/signature.go.golden b/gopls/internal/lsp/testdata/signature/signature.go.golden
+--- a/gopls/internal/lsp/testdata/signature/signature.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/signature/signature.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,53 +0,0 @@
+--- AliasMap(a map[*Alias]StringAlias) (b map[*Alias]StringAlias, c map[*Alias]StringAlias)-signature --
+-AliasMap(a map[*Alias]StringAlias) (b map[*Alias]StringAlias, c map[*Alias]StringAlias)
+-
+--- AliasSlice(a []*Alias) (b Alias)-signature --
+-AliasSlice(a []*Alias) (b Alias)
+-
+--- Bar(float64, ...byte)-signature --
+-Bar(float64, ...byte)
+-
+--- Foo(a string, b int) (c bool)-signature --
+-Foo(a string, b int) (c bool)
+-
+--- Next(n int) []byte-signature --
+-Next(n int) []byte
+-
+-Next returns a slice containing the next n bytes from the buffer, advancing the buffer as if the bytes had been returned by Read.
+-
+--- OtherAliasMap(a map[Alias]OtherAlias, b map[Alias]OtherAlias) map[Alias]OtherAlias-signature --
+-OtherAliasMap(a map[Alias]OtherAlias, b map[Alias]OtherAlias) map[Alias]OtherAlias
+-
+--- fn(hi string, there string) func(i int) rune-signature --
+-fn(hi string, there string) func(i int) rune
+-
+--- foo(e *json.Decoder) (*big.Int, error)-signature --
+-foo(e *json.Decoder) (*big.Int, error)
+-
+--- func(hi string, there string) func(i int) rune-signature --
+-func(hi string, there string) func(i int) rune
+-
+--- func(i int) rune-signature --
+-func(i int) rune
+-
+--- func(string, int) bool-signature --
+-func(string, int) bool
+-
+--- make(t Type, size ...int) Type-signature --
+-make(t Type, size ...int) Type
+-
+-The make built-in function allocates and initializes an object of type slice, map, or chan (only).
+-
+--- myFunc(foo int) string-signature --
+-myFunc(foo int) string
+-
+--- panic(v interface{})-signature --
+-panic(v any)
+-
+-The panic built-in function stops normal execution of the current goroutine.
+-
+--- println(args ...Type)-signature --
+-println(args ...Type)
+-
+-The println built-in function formats its arguments in an implementation-specific way and writes the result to standard error.
+-
+diff -urN a/gopls/internal/lsp/testdata/signature/signature_test.go b/gopls/internal/lsp/testdata/signature/signature_test.go
+--- a/gopls/internal/lsp/testdata/signature/signature_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/signature/signature_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-package signature_test
+-
+-import (
+- "testing"
+-
+- sig "golang.org/lsptests/signature"
+-)
+-
+-func TestSignature(t *testing.T) {
+- sig.AliasSlice() //@signature(")", "AliasSlice(a []*sig.Alias) (b sig.Alias)", 0)
+- sig.AliasMap() //@signature(")", "AliasMap(a map[*sig.Alias]sig.StringAlias) (b map[*sig.Alias]sig.StringAlias, c map[*sig.Alias]sig.StringAlias)", 0)
+- sig.OtherAliasMap() //@signature(")", "OtherAliasMap(a map[sig.Alias]sig.OtherAlias, b map[sig.Alias]sig.OtherAlias) map[sig.Alias]sig.OtherAlias", 0)
+-}
+diff -urN a/gopls/internal/lsp/testdata/signature/signature_test.go.golden b/gopls/internal/lsp/testdata/signature/signature_test.go.golden
+--- a/gopls/internal/lsp/testdata/signature/signature_test.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/signature/signature_test.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+--- AliasMap(a map[*sig.Alias]sig.StringAlias) (b map[*sig.Alias]sig.StringAlias, c map[*sig.Alias]sig.StringAlias)-signature --
+-AliasMap(a map[*sig.Alias]sig.StringAlias) (b map[*sig.Alias]sig.StringAlias, c map[*sig.Alias]sig.StringAlias)
+-
+--- AliasSlice(a []*sig.Alias) (b sig.Alias)-signature --
+-AliasSlice(a []*sig.Alias) (b sig.Alias)
+-
+--- OtherAliasMap(a map[sig.Alias]sig.OtherAlias, b map[sig.Alias]sig.OtherAlias) map[sig.Alias]sig.OtherAlias-signature --
+-OtherAliasMap(a map[sig.Alias]sig.OtherAlias, b map[sig.Alias]sig.OtherAlias) map[sig.Alias]sig.OtherAlias
+-
+diff -urN a/gopls/internal/lsp/testdata/snippets/func_snippets118.go.in b/gopls/internal/lsp/testdata/snippets/func_snippets118.go.in
+--- a/gopls/internal/lsp/testdata/snippets/func_snippets118.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/snippets/func_snippets118.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,19 +0,0 @@
+-// +build go1.18
+-//go:build go1.18
+-
+-package snippets
+-
+-type SyncMap[K comparable, V any] struct{}
+-
+-func NewSyncMap[K comparable, V any]() (result *SyncMap[K, V]) { //@item(NewSyncMap, "NewSyncMap", "", "")
+- return
+-}
+-
+-func Identity[P ~int](p P) P { //@item(Identity, "Identity", "", "")
+- return p
+-}
+-
+-func _() {
+- _ = NewSyncM //@snippet(" //", NewSyncMap, "NewSyncMap[${1:}]()", "NewSyncMap[${1:K comparable}, ${2:V any}]()")
+- _ = Identi //@snippet(" //", Identity, "Identity[${1:}](${2:})", "Identity[${1:P ~int}](${2:p P})")
+-}
+diff -urN a/gopls/internal/lsp/testdata/snippets/literal.go b/gopls/internal/lsp/testdata/snippets/literal.go
+--- a/gopls/internal/lsp/testdata/snippets/literal.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/snippets/literal.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,22 +0,0 @@
+-package snippets
+-
+-import (
+- "golang.org/lsptests/signature"
+- t "golang.org/lsptests/types"
+-)
+-
+-type structy struct {
+- x signature.MyType
+-}
+-
+-func X(_ map[signature.Alias]t.CoolAlias) (map[signature.Alias]t.CoolAlias) {
+- return nil
+-}
+-
+-func _() {
+- X() //@signature(")", "X(_ map[signature.Alias]t.CoolAlias) map[signature.Alias]t.CoolAlias", 0)
+- _ = signature.MyType{} //@item(literalMyType, "signature.MyType{}", "", "var")
+- s := structy{
+- x: //@snippet(" //", literalMyType, "signature.MyType{\\}", "signature.MyType{\\}")
+- }
+-}
+\ No newline at end of file
+diff -urN a/gopls/internal/lsp/testdata/snippets/literal.go.golden b/gopls/internal/lsp/testdata/snippets/literal.go.golden
+--- a/gopls/internal/lsp/testdata/snippets/literal.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/snippets/literal.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,3 +0,0 @@
+--- X(_ map[signature.Alias]t.CoolAlias) map[signature.Alias]t.CoolAlias-signature --
+-X(_ map[signature.Alias]t.CoolAlias) map[signature.Alias]t.CoolAlias
+-
+diff -urN a/gopls/internal/lsp/testdata/snippets/literal_snippets118.go.in b/gopls/internal/lsp/testdata/snippets/literal_snippets118.go.in
+--- a/gopls/internal/lsp/testdata/snippets/literal_snippets118.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/snippets/literal_snippets118.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+-// +build go1.18
+-//go:build go1.18
+-
+-package snippets
+-
+-type Tree[T any] struct{}
+-
+-func (tree Tree[T]) Do(f func(s T)) {}
+-
+-func _() {
+- _ = "func(...) {}" //@item(litFunc, "func(...) {}", "", "var")
+- var t Tree[string]
+- t.Do(fun) //@complete(")", litFunc),snippet(")", litFunc, "func(s string) {$0\\}", "func(s string) {$0\\}")
+-}
+diff -urN a/gopls/internal/lsp/testdata/snippets/literal_snippets.go.in b/gopls/internal/lsp/testdata/snippets/literal_snippets.go.in
+--- a/gopls/internal/lsp/testdata/snippets/literal_snippets.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/snippets/literal_snippets.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,233 +0,0 @@
+-package snippets
+-
+-import (
+- "bytes"
+- "context"
+- "go/ast"
+- "net/http"
+- "sort"
+-
+- "golang.org/lsptests/foo"
+-)
+-
+-func _() {
+- []int{} //@item(litIntSlice, "[]int{}", "", "var")
+- &[]int{} //@item(litIntSliceAddr, "&[]int{}", "", "var")
+- make([]int, 0) //@item(makeIntSlice, "make([]int, 0)", "", "func")
+-
+- var _ *[]int = in //@snippet(" //", litIntSliceAddr, "&[]int{$0\\}", "&[]int{$0\\}")
+- var _ **[]int = in //@complete(" //")
+-
+- var slice []int
+- slice = i //@snippet(" //", litIntSlice, "[]int{$0\\}", "[]int{$0\\}")
+- slice = m //@snippet(" //", makeIntSlice, "make([]int, ${1:})", "make([]int, ${1:0})")
+-}
+-
+-func _() {
+- type namedInt []int
+-
+- namedInt{} //@item(litNamedSlice, "namedInt{}", "", "var")
+- make(namedInt, 0) //@item(makeNamedSlice, "make(namedInt, 0)", "", "func")
+-
+- var namedSlice namedInt
+- namedSlice = n //@snippet(" //", litNamedSlice, "namedInt{$0\\}", "namedInt{$0\\}")
+- namedSlice = m //@snippet(" //", makeNamedSlice, "make(namedInt, ${1:})", "make(namedInt, ${1:0})")
+-}
+-
+-func _() {
+- make(chan int) //@item(makeChan, "make(chan int)", "", "func")
+-
+- var ch chan int
+- ch = m //@snippet(" //", makeChan, "make(chan int)", "make(chan int)")
+-}
+-
+-func _() {
+- map[string]struct{}{} //@item(litMap, "map[string]struct{}{}", "", "var")
+- make(map[string]struct{}) //@item(makeMap, "make(map[string]struct{})", "", "func")
+-
+- var m map[string]struct{}
+- m = m //@snippet(" //", litMap, "map[string]struct{\\}{$0\\}", "map[string]struct{\\}{$0\\}")
+- m = m //@snippet(" //", makeMap, "make(map[string]struct{\\})", "make(map[string]struct{\\})")
+-
+- struct{}{} //@item(litEmptyStruct, "struct{}{}", "", "var")
+-
+- m["hi"] = s //@snippet(" //", litEmptyStruct, "struct{\\}{\\}", "struct{\\}{\\}")
+-}
+-
+-func _() {
+- type myStruct struct{ i int } //@item(myStructType, "myStruct", "struct{...}", "struct")
+-
+- myStruct{} //@item(litStruct, "myStruct{}", "", "var")
+- &myStruct{} //@item(litStructPtr, "&myStruct{}", "", "var")
+-
+- var ms myStruct
+- ms = m //@snippet(" //", litStruct, "myStruct{$0\\}", "myStruct{$0\\}")
+-
+- var msPtr *myStruct
+- msPtr = m //@snippet(" //", litStructPtr, "&myStruct{$0\\}", "&myStruct{$0\\}")
+-
+- msPtr = &m //@snippet(" //", litStruct, "myStruct{$0\\}", "myStruct{$0\\}")
+-
+- type myStructCopy struct { i int } //@item(myStructCopyType, "myStructCopy", "struct{...}", "struct")
+-
+- // Don't offer literal completion for convertible structs.
+- ms = myStruct //@complete(" //", litStruct, myStructType, myStructCopyType)
+-}
+-
+-type myImpl struct{}
+-
+-func (myImpl) foo() {}
+-
+-func (*myImpl) bar() {}
+-
+-type myBasicImpl string
+-
+-func (myBasicImpl) foo() {}
+-
+-func _() {
+- type myIntf interface {
+- foo()
+- }
+-
+- myImpl{} //@item(litImpl, "myImpl{}", "", "var")
+-
+- var mi myIntf
+- mi = m //@snippet(" //", litImpl, "myImpl{\\}", "myImpl{\\}")
+-
+- myBasicImpl() //@item(litBasicImpl, "myBasicImpl()", "string", "var")
+-
+- mi = m //@snippet(" //", litBasicImpl, "myBasicImpl($0)", "myBasicImpl($0)")
+-
+- // only satisfied by pointer to myImpl
+- type myPtrIntf interface {
+- bar()
+- }
+-
+- &myImpl{} //@item(litImplPtr, "&myImpl{}", "", "var")
+-
+- var mpi myPtrIntf
+- mpi = m //@snippet(" //", litImplPtr, "&myImpl{\\}", "&myImpl{\\}")
+-}
+-
+-func _() {
+- var s struct{ i []int } //@item(litSliceField, "i", "[]int", "field")
+- var foo []int
+- // no literal completions after selector
+- foo = s.i //@complete(" //", litSliceField)
+-}
+-
+-func _() {
+- type myStruct struct{ i int } //@item(litMyStructType, "myStruct", "struct{...}", "struct")
+- myStruct{} //@item(litMyStruct, "myStruct{}", "", "var")
+-
+- foo := func(s string, args ...myStruct) {}
+- // Don't give literal slice candidate for variadic arg.
+- // Do give literal candidates for variadic element.
+- foo("", myStruct) //@complete(")", litMyStruct, litMyStructType)
+-}
+-
+-func _() {
+- Buffer{} //@item(litBuffer, "Buffer{}", "", "var")
+-
+- var b *bytes.Buffer
+- b = bytes.Bu //@snippet(" //", litBuffer, "Buffer{\\}", "Buffer{\\}")
+-}
+-
+-func _() {
+- _ = "func(...) {}" //@item(litFunc, "func(...) {}", "", "var")
+-
+- sort.Slice(nil, fun) //@complete(")", litFunc),snippet(")", litFunc, "func(i, j int) bool {$0\\}", "func(i, j int) bool {$0\\}")
+-
+- http.HandleFunc("", f) //@snippet(")", litFunc, "func(w http.ResponseWriter, r *http.Request) {$0\\}", "func(${1:w} http.ResponseWriter, ${2:r} *http.Request) {$0\\}")
+-
+- // no literal "func" completions
+- http.Handle("", fun) //@complete(")")
+-
+- http.HandlerFunc() //@item(handlerFunc, "http.HandlerFunc()", "", "var")
+- http.Handle("", h) //@snippet(")", handlerFunc, "http.HandlerFunc($0)", "http.HandlerFunc($0)")
+- http.Handle("", http.HandlerFunc()) //@snippet("))", litFunc, "func(w http.ResponseWriter, r *http.Request) {$0\\}", "func(${1:w} http.ResponseWriter, ${2:r} *http.Request) {$0\\}")
+-
+- var namedReturn func(s string) (b bool)
+- namedReturn = f //@snippet(" //", litFunc, "func(s string) (b bool) {$0\\}", "func(s string) (b bool) {$0\\}")
+-
+- var multiReturn func() (bool, int)
+- multiReturn = f //@snippet(" //", litFunc, "func() (bool, int) {$0\\}", "func() (bool, int) {$0\\}")
+-
+- var multiNamedReturn func() (b bool, i int)
+- multiNamedReturn = f //@snippet(" //", litFunc, "func() (b bool, i int) {$0\\}", "func() (b bool, i int) {$0\\}")
+-
+- var duplicateParams func(myImpl, int, myImpl)
+- duplicateParams = f //@snippet(" //", litFunc, "func(mi1 myImpl, i int, mi2 myImpl) {$0\\}", "func(${1:mi1} myImpl, ${2:i} int, ${3:mi2} myImpl) {$0\\}")
+-
+- type aliasImpl = myImpl
+- var aliasParams func(aliasImpl) aliasImpl
+- aliasParams = f //@snippet(" //", litFunc, "func(ai aliasImpl) aliasImpl {$0\\}", "func(${1:ai} aliasImpl) aliasImpl {$0\\}")
+-
+- const two = 2
+- var builtinTypes func([]int, [two]bool, map[string]string, struct{ i int }, interface{ foo() }, <-chan int)
+- builtinTypes = f //@snippet(" //", litFunc, "func(i1 []int, b [two]bool, m map[string]string, s struct{ i int \\}, i2 interface{ foo() \\}, c <-chan int) {$0\\}", "func(${1:i1} []int, ${2:b} [two]bool, ${3:m} map[string]string, ${4:s} struct{ i int \\}, ${5:i2} interface{ foo() \\}, ${6:c} <-chan int) {$0\\}")
+-
+- var _ func(ast.Node) = f //@snippet(" //", litFunc, "func(n ast.Node) {$0\\}", "func(${1:n} ast.Node) {$0\\}")
+- var _ func(error) = f //@snippet(" //", litFunc, "func(err error) {$0\\}", "func(${1:err} error) {$0\\}")
+- var _ func(context.Context) = f //@snippet(" //", litFunc, "func(ctx context.Context) {$0\\}", "func(${1:ctx} context.Context) {$0\\}")
+-
+- type context struct {}
+- var _ func(context) = f //@snippet(" //", litFunc, "func(ctx context) {$0\\}", "func(${1:ctx} context) {$0\\}")
+-}
+-
+-func _() {
+- StructFoo{} //@item(litStructFoo, "StructFoo{}", "struct{...}", "struct")
+-
+- var sfp *foo.StructFoo
+- // Don't insert the "&" before "StructFoo{}".
+- sfp = foo.Str //@snippet(" //", litStructFoo, "StructFoo{$0\\}", "StructFoo{$0\\}")
+-
+- var sf foo.StructFoo
+- sf = foo.Str //@snippet(" //", litStructFoo, "StructFoo{$0\\}", "StructFoo{$0\\}")
+- sf = foo. //@snippet(" //", litStructFoo, "StructFoo{$0\\}", "StructFoo{$0\\}")
+-}
+-
+-func _() {
+- float64() //@item(litFloat64, "float64()", "float64", "var")
+-
+- // don't complete to "&float64()"
+- var _ *float64 = float64 //@complete(" //")
+-
+- var f float64
+- f = fl //@complete(" //", litFloat64),snippet(" //", litFloat64, "float64($0)", "float64($0)")
+-
+- type myInt int
+- myInt() //@item(litMyInt, "myInt()", "", "var")
+-
+- var mi myInt
+- mi = my //@snippet(" //", litMyInt, "myInt($0)", "myInt($0)")
+-}
+-
+-func _() {
+- type ptrStruct struct {
+- p *ptrStruct
+- }
+-
+- ptrStruct{} //@item(litPtrStruct, "ptrStruct{}", "", "var")
+-
+- ptrStruct{
+- p: &ptrSt, //@rank(",", litPtrStruct)
+- }
+-
+- &ptrStruct{} //@item(litPtrStructPtr, "&ptrStruct{}", "", "var")
+-
+- &ptrStruct{
+- p: ptrSt, //@rank(",", litPtrStructPtr)
+- }
+-}
+-
+-func _() {
+- f := func(...[]int) {}
+- f() //@snippet(")", litIntSlice, "[]int{$0\\}", "[]int{$0\\}")
+-}
+-
+-
+-func _() {
+- // don't complete to "untyped int()"
+- []int{}[untyped] //@complete("] //")
+-}
+diff -urN a/gopls/internal/lsp/testdata/snippets/postfix.go b/gopls/internal/lsp/testdata/snippets/postfix.go
+--- a/gopls/internal/lsp/testdata/snippets/postfix.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/snippets/postfix.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,42 +0,0 @@
+-package snippets
+-
+-// These tests check that postfix completions do and do not show up in
+-// certain cases. Tests for the postfix completion contents are under
+-// regtest.
+-
+-func _() {
+- /* append! */ //@item(postfixAppend, "append!", "append and re-assign slice", "snippet")
+- var foo []int
+- foo.append //@rank(" //", postfixAppend)
+-
+- []int{}.append //@complete(" //")
+-
+- []int{}.last //@complete(" //")
+-
+- /* copy! */ //@item(postfixCopy, "copy!", "duplicate slice", "snippet")
+-
+- foo.copy //@rank(" //", postfixCopy)
+-
+- var s struct{ i []int }
+- s.i.copy //@rank(" //", postfixCopy)
+-
+- var _ []int = s.i.copy //@complete(" //")
+-
+- var blah func() []int
+- blah().append //@complete(" //")
+-}
+-
+-func _() {
+- /* append! */ //@item(postfixAppend, "append!", "append and re-assign slice", "snippet")
+- /* last! */ //@item(postfixLast, "last!", "s[len(s)-1]", "snippet")
+- /* print! */ //@item(postfixPrint, "print!", "print to stdout", "snippet")
+- /* range! */ //@item(postfixRange, "range!", "range over slice", "snippet")
+- /* reverse! */ //@item(postfixReverse, "reverse!", "reverse slice", "snippet")
+- /* sort! */ //@item(postfixSort, "sort!", "sort.Slice()", "snippet")
+- /* var! */ //@item(postfixVar, "var!", "assign to variable", "snippet")
+-
+- var foo []int
+- foo. //@complete(" //", postfixAppend, postfixCopy, postfixLast, postfixPrint, postfixRange, postfixReverse, postfixSort, postfixVar)
+-
+- foo = nil
+-}
+diff -urN a/gopls/internal/lsp/testdata/snippets/snippets.go.golden b/gopls/internal/lsp/testdata/snippets/snippets.go.golden
+--- a/gopls/internal/lsp/testdata/snippets/snippets.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/snippets/snippets.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,3 +0,0 @@
+--- baz(at AliasType, b bool)-signature --
+-baz(at AliasType, b bool)
+-
+diff -urN a/gopls/internal/lsp/testdata/snippets/snippets.go.in b/gopls/internal/lsp/testdata/snippets/snippets.go.in
+--- a/gopls/internal/lsp/testdata/snippets/snippets.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/snippets/snippets.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,61 +0,0 @@
+-package snippets
+-
+-type AliasType = int //@item(sigAliasType, "AliasType", "AliasType", "type")
+-
+-func foo(i int, b bool) {} //@item(snipFoo, "foo", "func(i int, b bool)", "func")
+-func bar(fn func()) func() {} //@item(snipBar, "bar", "func(fn func())", "func")
+-func baz(at AliasType, b bool) {} //@item(snipBaz, "baz", "func(at AliasType, b bool)", "func")
+-
+-type Foo struct {
+- Bar int //@item(snipFieldBar, "Bar", "int", "field")
+- Func func(at AliasType) error //@item(snipFieldFunc, "Func", "func(at AliasType) error", "field")
+-}
+-
+-func (Foo) Baz() func() {} //@item(snipMethodBaz, "Baz", "func() func()", "method")
+-func (Foo) BazBar() func() {} //@item(snipMethodBazBar, "BazBar", "func() func()", "method")
+-func (Foo) BazBaz(at AliasType) func() {} //@item(snipMethodBazBaz, "BazBaz", "func(at AliasType) func()", "method")
+-
+-func _() {
+- f //@snippet(" //", snipFoo, "foo(${1:})", "foo(${1:i int}, ${2:b bool})")
+-
+- bar //@snippet(" //", snipBar, "bar(${1:})", "bar(${1:fn func()})")
+-
+- baz //@snippet(" //", snipBaz, "baz(${1:})", "baz(${1:at AliasType}, ${2:b bool})")
+- baz() //@signature("(", "baz(at AliasType, b bool)", 0)
+-
+- bar(nil) //@snippet("(", snipBar, "bar", "bar")
+- bar(ba) //@snippet(")", snipBar, "bar(${1:})", "bar(${1:fn func()})")
+- var f Foo
+- bar(f.Ba) //@snippet(")", snipMethodBaz, "Baz()", "Baz()")
+- (bar)(nil) //@snippet(")", snipBar, "bar(${1:})", "bar(${1:fn func()})")
+- (f.Ba)() //@snippet(")", snipMethodBaz, "Baz()", "Baz()")
+-
+- Foo{
+- B //@snippet(" //", snipFieldBar, "Bar: ${1:},", "Bar: ${1:int},")
+- }
+-
+- Foo{
+- F //@snippet(" //", snipFieldFunc, "Func: ${1:},", "Func: ${1:func(at AliasType) error},")
+- }
+-
+- Foo{B} //@snippet("}", snipFieldBar, "Bar: ${1:}", "Bar: ${1:int}")
+- Foo{} //@snippet("}", snipFieldBar, "Bar: ${1:}", "Bar: ${1:int}")
+-
+- Foo{Foo{}.B} //@snippet("} ", snipFieldBar, "Bar", "Bar")
+-
+- var err error
+- err.Error() //@snippet("E", Error, "Error()", "Error()")
+- f.Baz() //@snippet("B", snipMethodBaz, "Baz()", "Baz()")
+-
+- f.Baz() //@snippet("(", snipMethodBazBar, "BazBar", "BazBar")
+-
+- f.Baz() //@snippet("B", snipMethodBazBaz, "BazBaz(${1:})", "BazBaz(${1:at AliasType})")
+-}
+-
+-func _() {
+- type bar struct {
+- a int
+- b float64 //@item(snipBarB, "b", "float64", "field")
+- }
+- bar{b} //@snippet("}", snipBarB, "b: ${1:}", "b: ${1:float64}")
+-}
+diff -urN a/gopls/internal/lsp/testdata/statements/append.go b/gopls/internal/lsp/testdata/statements/append.go
+--- a/gopls/internal/lsp/testdata/statements/append.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/statements/append.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,42 +0,0 @@
+-package statements
+-
+-func _() {
+- type mySlice []int
+-
+- var (
+- abc []int //@item(stmtABC, "abc", "[]int", "var")
+- abcdef mySlice //@item(stmtABCDEF, "abcdef", "mySlice", "var")
+- )
+-
+- /* abcdef = append(abcdef, ) */ //@item(stmtABCDEFAssignAppend, "abcdef = append(abcdef, )", "", "func")
+-
+- // don't offer "abc = append(abc, )" because "abc" isn't necessarily
+- // better than "abcdef".
+- abc //@complete(" //", stmtABC, stmtABCDEF)
+-
+- abcdef //@complete(" //", stmtABCDEF, stmtABCDEFAssignAppend)
+-
+- /* append(abc, ) */ //@item(stmtABCAppend, "append(abc, )", "", "func")
+-
+- abc = app //@snippet(" //", stmtABCAppend, "append(abc, ${1:})", "append(abc, ${1:})")
+-}
+-
+-func _() {
+- var s struct{ xyz []int }
+-
+- /* xyz = append(s.xyz, ) */ //@item(stmtXYZAppend, "xyz = append(s.xyz, )", "", "func")
+-
+- s.x //@snippet(" //", stmtXYZAppend, "xyz = append(s.xyz, ${1:})", "xyz = append(s.xyz, ${1:})")
+-
+- /* s.xyz = append(s.xyz, ) */ //@item(stmtDeepXYZAppend, "s.xyz = append(s.xyz, )", "", "func")
+-
+- sx //@snippet(" //", stmtDeepXYZAppend, "s.xyz = append(s.xyz, ${1:})", "s.xyz = append(s.xyz, ${1:})")
+-}
+-
+-func _() {
+- var foo [][]int
+-
+- /* append(foo[0], ) */ //@item(stmtFooAppend, "append(foo[0], )", "", "func")
+-
+- foo[0] = app //@complete(" //"),snippet(" //", stmtFooAppend, "append(foo[0], ${1:})", "append(foo[0], ${1:})")
+-}
+diff -urN a/gopls/internal/lsp/testdata/statements/if_err_check_return_2.go b/gopls/internal/lsp/testdata/statements/if_err_check_return_2.go
+--- a/gopls/internal/lsp/testdata/statements/if_err_check_return_2.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/statements/if_err_check_return_2.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+-package statements
+-
+-import "os"
+-
+-func two() error {
+- var s struct{ err error }
+-
+- /* if s.err != nil { return s.err } */ //@item(stmtTwoIfErrReturn, "if s.err != nil { return s.err }", "", "")
+-
+- _, s.err = os.Open("foo")
+- //@snippet("", stmtTwoIfErrReturn, "", "if s.err != nil {\n\treturn ${1:s.err}\n\\}")
+-}
+diff -urN a/gopls/internal/lsp/testdata/statements/if_err_check_return.go b/gopls/internal/lsp/testdata/statements/if_err_check_return.go
+--- a/gopls/internal/lsp/testdata/statements/if_err_check_return.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/statements/if_err_check_return.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,27 +0,0 @@
+-package statements
+-
+-import (
+- "bytes"
+- "io"
+- "os"
+-)
+-
+-func one() (int, float32, io.Writer, *int, []int, bytes.Buffer, error) {
+- /* if err != nil { return err } */ //@item(stmtOneIfErrReturn, "if err != nil { return err }", "", "")
+- /* err != nil { return err } */ //@item(stmtOneErrReturn, "err != nil { return err }", "", "")
+-
+- _, err := os.Open("foo")
+- //@snippet("", stmtOneIfErrReturn, "", "if err != nil {\n\treturn 0, 0, nil, nil, nil, bytes.Buffer{\\}, ${1:err}\n\\}")
+-
+- _, err = os.Open("foo")
+- i //@snippet(" //", stmtOneIfErrReturn, "", "if err != nil {\n\treturn 0, 0, nil, nil, nil, bytes.Buffer{\\}, ${1:err}\n\\}")
+-
+- _, err = os.Open("foo")
+- if er //@snippet(" //", stmtOneErrReturn, "", "err != nil {\n\treturn 0, 0, nil, nil, nil, bytes.Buffer{\\}, ${1:err}\n\\}")
+-
+- _, err = os.Open("foo")
+- if //@snippet(" //", stmtOneIfErrReturn, "", "if err != nil {\n\treturn 0, 0, nil, nil, nil, bytes.Buffer{\\}, ${1:err}\n\\}")
+-
+- _, err = os.Open("foo")
+- if //@snippet("//", stmtOneIfErrReturn, "", "if err != nil {\n\treturn 0, 0, nil, nil, nil, bytes.Buffer{\\}, ${1:err}\n\\}")
+-}
+diff -urN a/gopls/internal/lsp/testdata/statements/if_err_check_test.go b/gopls/internal/lsp/testdata/statements/if_err_check_test.go
+--- a/gopls/internal/lsp/testdata/statements/if_err_check_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/statements/if_err_check_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,20 +0,0 @@
+-package statements
+-
+-import (
+- "os"
+- "testing"
+-)
+-
+-func TestErr(t *testing.T) {
+- /* if err != nil { t.Fatal(err) } */ //@item(stmtOneIfErrTFatal, "if err != nil { t.Fatal(err) }", "", "")
+-
+- _, err := os.Open("foo")
+- //@snippet("", stmtOneIfErrTFatal, "", "if err != nil {\n\tt.Fatal(err)\n\\}")
+-}
+-
+-func BenchmarkErr(b *testing.B) {
+- /* if err != nil { b.Fatal(err) } */ //@item(stmtOneIfErrBFatal, "if err != nil { b.Fatal(err) }", "", "")
+-
+- _, err := os.Open("foo")
+- //@snippet("", stmtOneIfErrBFatal, "", "if err != nil {\n\tb.Fatal(err)\n\\}")
+-}
+diff -urN a/gopls/internal/lsp/testdata/stub/other/other.go b/gopls/internal/lsp/testdata/stub/other/other.go
+--- a/gopls/internal/lsp/testdata/stub/other/other.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/other/other.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-package other
+-
+-import (
+- "bytes"
+- renamed_context "context"
+-)
+-
+-type Interface interface {
+- Get(renamed_context.Context) *bytes.Buffer
+-}
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_add_selector.go b/gopls/internal/lsp/testdata/stub/stub_add_selector.go
+--- a/gopls/internal/lsp/testdata/stub/stub_add_selector.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_add_selector.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+-package stub
+-
+-import "io"
+-
+-// This file tests that if an interface
+-// method references a type from its own package
+-// then our implementation must add the import/package selector
+-// in the concrete method if the concrete type is outside of the interface
+-// package
+-var _ io.ReaderFrom = &readerFrom{} //@suggestedfix("&readerFrom", "refactor.rewrite", "")
+-
+-type readerFrom struct{}
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_add_selector.go.golden b/gopls/internal/lsp/testdata/stub/stub_add_selector.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_add_selector.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_add_selector.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,19 +0,0 @@
+--- suggestedfix_stub_add_selector_10_23 --
+-package stub
+-
+-import "io"
+-
+-// This file tests that if an interface
+-// method references a type from its own package
+-// then our implementation must add the import/package selector
+-// in the concrete method if the concrete type is outside of the interface
+-// package
+-var _ io.ReaderFrom = &readerFrom{} //@suggestedfix("&readerFrom", "refactor.rewrite", "")
+-
+-type readerFrom struct{}
+-
+-// ReadFrom implements io.ReaderFrom
+-func (*readerFrom) ReadFrom(r io.Reader) (n int64, err error) {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_assign.go b/gopls/internal/lsp/testdata/stub/stub_assign.go
+--- a/gopls/internal/lsp/testdata/stub/stub_assign.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_assign.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-package stub
+-
+-import "io"
+-
+-func main() {
+- var br io.ByteWriter
+- br = &byteWriter{} //@suggestedfix("&", "refactor.rewrite", "")
+-}
+-
+-type byteWriter struct{}
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_assign.go.golden b/gopls/internal/lsp/testdata/stub/stub_assign.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_assign.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_assign.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,17 +0,0 @@
+--- suggestedfix_stub_assign_7_7 --
+-package stub
+-
+-import "io"
+-
+-func main() {
+- var br io.ByteWriter
+- br = &byteWriter{} //@suggestedfix("&", "refactor.rewrite", "")
+-}
+-
+-type byteWriter struct{}
+-
+-// WriteByte implements io.ByteWriter
+-func (*byteWriter) WriteByte(c byte) error {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_assign_multivars.go b/gopls/internal/lsp/testdata/stub/stub_assign_multivars.go
+--- a/gopls/internal/lsp/testdata/stub/stub_assign_multivars.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_assign_multivars.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-package stub
+-
+-import "io"
+-
+-func main() {
+- var br io.ByteWriter
+- var i int
+- i, br = 1, &multiByteWriter{} //@suggestedfix("&", "refactor.rewrite", "")
+-}
+-
+-type multiByteWriter struct{}
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_assign_multivars.go.golden b/gopls/internal/lsp/testdata/stub/stub_assign_multivars.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_assign_multivars.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_assign_multivars.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+--- suggestedfix_stub_assign_multivars_8_13 --
+-package stub
+-
+-import "io"
+-
+-func main() {
+- var br io.ByteWriter
+- var i int
+- i, br = 1, &multiByteWriter{} //@suggestedfix("&", "refactor.rewrite", "")
+-}
+-
+-type multiByteWriter struct{}
+-
+-// WriteByte implements io.ByteWriter
+-func (*multiByteWriter) WriteByte(c byte) error {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_call_expr.go b/gopls/internal/lsp/testdata/stub/stub_call_expr.go
+--- a/gopls/internal/lsp/testdata/stub/stub_call_expr.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_call_expr.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-package stub
+-
+-func main() {
+- check(&callExpr{}) //@suggestedfix("&", "refactor.rewrite", "")
+-}
+-
+-func check(err error) {
+- if err != nil {
+- panic(err)
+- }
+-}
+-
+-type callExpr struct{}
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_call_expr.go.golden b/gopls/internal/lsp/testdata/stub/stub_call_expr.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_call_expr.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_call_expr.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,20 +0,0 @@
+--- suggestedfix_stub_call_expr_4_8 --
+-package stub
+-
+-func main() {
+- check(&callExpr{}) //@suggestedfix("&", "refactor.rewrite", "")
+-}
+-
+-func check(err error) {
+- if err != nil {
+- panic(err)
+- }
+-}
+-
+-type callExpr struct{}
+-
+-// Error implements error
+-func (*callExpr) Error() string {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_embedded.go b/gopls/internal/lsp/testdata/stub/stub_embedded.go
+--- a/gopls/internal/lsp/testdata/stub/stub_embedded.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_embedded.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,15 +0,0 @@
+-package stub
+-
+-import (
+- "io"
+- "sort"
+-)
+-
+-var _ embeddedInterface = (*embeddedConcrete)(nil) //@suggestedfix("(", "refactor.rewrite", "")
+-
+-type embeddedConcrete struct{}
+-
+-type embeddedInterface interface {
+- sort.Interface
+- io.Reader
+-}
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_embedded.go.golden b/gopls/internal/lsp/testdata/stub/stub_embedded.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_embedded.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_embedded.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,37 +0,0 @@
+--- suggestedfix_stub_embedded_8_27 --
+-package stub
+-
+-import (
+- "io"
+- "sort"
+-)
+-
+-var _ embeddedInterface = (*embeddedConcrete)(nil) //@suggestedfix("(", "refactor.rewrite", "")
+-
+-type embeddedConcrete struct{}
+-
+-// Len implements embeddedInterface
+-func (*embeddedConcrete) Len() int {
+- panic("unimplemented")
+-}
+-
+-// Less implements embeddedInterface
+-func (*embeddedConcrete) Less(i int, j int) bool {
+- panic("unimplemented")
+-}
+-
+-// Read implements embeddedInterface
+-func (*embeddedConcrete) Read(p []byte) (n int, err error) {
+- panic("unimplemented")
+-}
+-
+-// Swap implements embeddedInterface
+-func (*embeddedConcrete) Swap(i int, j int) {
+- panic("unimplemented")
+-}
+-
+-type embeddedInterface interface {
+- sort.Interface
+- io.Reader
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_err.go b/gopls/internal/lsp/testdata/stub/stub_err.go
+--- a/gopls/internal/lsp/testdata/stub/stub_err.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_err.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-package stub
+-
+-func main() {
+- var br error = &customErr{} //@suggestedfix("&", "refactor.rewrite", "")
+-}
+-
+-type customErr struct{}
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_err.go.golden b/gopls/internal/lsp/testdata/stub/stub_err.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_err.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_err.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+--- suggestedfix_stub_err_4_17 --
+-package stub
+-
+-func main() {
+- var br error = &customErr{} //@suggestedfix("&", "refactor.rewrite", "")
+-}
+-
+-type customErr struct{}
+-
+-// Error implements error
+-func (*customErr) Error() string {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_function_return.go b/gopls/internal/lsp/testdata/stub/stub_function_return.go
+--- a/gopls/internal/lsp/testdata/stub/stub_function_return.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_function_return.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-package stub
+-
+-import (
+- "io"
+-)
+-
+-func newCloser() io.Closer {
+- return closer{} //@suggestedfix("c", "refactor.rewrite", "")
+-}
+-
+-type closer struct{}
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_function_return.go.golden b/gopls/internal/lsp/testdata/stub/stub_function_return.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_function_return.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_function_return.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+--- suggestedfix_stub_function_return_8_9 --
+-package stub
+-
+-import (
+- "io"
+-)
+-
+-func newCloser() io.Closer {
+- return closer{} //@suggestedfix("c", "refactor.rewrite", "")
+-}
+-
+-type closer struct{}
+-
+-// Close implements io.Closer
+-func (closer) Close() error {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_generic_receiver.go b/gopls/internal/lsp/testdata/stub/stub_generic_receiver.go
+--- a/gopls/internal/lsp/testdata/stub/stub_generic_receiver.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_generic_receiver.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,15 +0,0 @@
+-//go:build go1.18
+-// +build go1.18
+-
+-package stub
+-
+-import "io"
+-
+-// This file tests that that the stub method generator accounts for concrete
+-// types that have type parameters defined.
+-var _ io.ReaderFrom = &genReader[string, int]{} //@suggestedfix("&genReader", "refactor.rewrite", "Implement io.ReaderFrom")
+-
+-type genReader[T, Y any] struct {
+- T T
+- Y Y
+-}
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_generic_receiver.go.golden b/gopls/internal/lsp/testdata/stub/stub_generic_receiver.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_generic_receiver.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_generic_receiver.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,22 +0,0 @@
+--- suggestedfix_stub_generic_receiver_10_23 --
+-//go:build go1.18
+-// +build go1.18
+-
+-package stub
+-
+-import "io"
+-
+-// This file tests that that the stub method generator accounts for concrete
+-// types that have type parameters defined.
+-var _ io.ReaderFrom = &genReader[string, int]{} //@suggestedfix("&genReader", "refactor.rewrite", "Implement io.ReaderFrom")
+-
+-type genReader[T, Y any] struct {
+- T T
+- Y Y
+-}
+-
+-// ReadFrom implements io.ReaderFrom
+-func (*genReader[T, Y]) ReadFrom(r io.Reader) (n int64, err error) {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_ignored_imports.go b/gopls/internal/lsp/testdata/stub/stub_ignored_imports.go
+--- a/gopls/internal/lsp/testdata/stub/stub_ignored_imports.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_ignored_imports.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+-package stub
+-
+-import (
+- "compress/zlib"
+- . "io"
+- _ "io"
+-)
+-
+-// This file tests that dot-imports and underscore imports
+-// are properly ignored and that a new import is added to
+-// reference method types
+-
+-var (
+- _ Reader
+- _ zlib.Resetter = (*ignoredResetter)(nil) //@suggestedfix("(", "refactor.rewrite", "")
+-)
+-
+-type ignoredResetter struct{}
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_ignored_imports.go.golden b/gopls/internal/lsp/testdata/stub/stub_ignored_imports.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_ignored_imports.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_ignored_imports.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,25 +0,0 @@
+--- suggestedfix_stub_ignored_imports_15_20 --
+-package stub
+-
+-import (
+- "compress/zlib"
+- . "io"
+- _ "io"
+-)
+-
+-// This file tests that dot-imports and underscore imports
+-// are properly ignored and that a new import is added to
+-// reference method types
+-
+-var (
+- _ Reader
+- _ zlib.Resetter = (*ignoredResetter)(nil) //@suggestedfix("(", "refactor.rewrite", "")
+-)
+-
+-type ignoredResetter struct{}
+-
+-// Reset implements zlib.Resetter
+-func (*ignoredResetter) Reset(r Reader, dict []byte) error {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_issue2606.go b/gopls/internal/lsp/testdata/stub/stub_issue2606.go
+--- a/gopls/internal/lsp/testdata/stub/stub_issue2606.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_issue2606.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-package stub
+-
+-type I interface{ error }
+-
+-type C int
+-
+-var _ I = C(0) //@suggestedfix("C", "refactor.rewrite", "")
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_issue2606.go.golden b/gopls/internal/lsp/testdata/stub/stub_issue2606.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_issue2606.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_issue2606.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+--- suggestedfix_stub_issue2606_7_11 --
+-package stub
+-
+-type I interface{ error }
+-
+-type C int
+-
+-// Error implements I
+-func (C) Error() string {
+- panic("unimplemented")
+-}
+-
+-var _ I = C(0) //@suggestedfix("C", "refactor.rewrite", "")
+-
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_multi_var.go b/gopls/internal/lsp/testdata/stub/stub_multi_var.go
+--- a/gopls/internal/lsp/testdata/stub/stub_multi_var.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_multi_var.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-package stub
+-
+-import "io"
+-
+-// This test ensures that a variable declaration that
+-// has multiple values on the same line can still be
+-// analyzed correctly to target the interface implementation
+-// diagnostic.
+-var one, two, three io.Reader = nil, &multiVar{}, nil //@suggestedfix("&", "refactor.rewrite", "")
+-
+-type multiVar struct{}
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_multi_var.go.golden b/gopls/internal/lsp/testdata/stub/stub_multi_var.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_multi_var.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_multi_var.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+--- suggestedfix_stub_multi_var_9_38 --
+-package stub
+-
+-import "io"
+-
+-// This test ensures that a variable declaration that
+-// has multiple values on the same line can still be
+-// analyzed correctly to target the interface implementation
+-// diagnostic.
+-var one, two, three io.Reader = nil, &multiVar{}, nil //@suggestedfix("&", "refactor.rewrite", "")
+-
+-type multiVar struct{}
+-
+-// Read implements io.Reader
+-func (*multiVar) Read(p []byte) (n int, err error) {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_pointer.go b/gopls/internal/lsp/testdata/stub/stub_pointer.go
+--- a/gopls/internal/lsp/testdata/stub/stub_pointer.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_pointer.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package stub
+-
+-import "io"
+-
+-func getReaderFrom() io.ReaderFrom {
+- return &pointerImpl{} //@suggestedfix("&", "refactor.rewrite", "")
+-}
+-
+-type pointerImpl struct{}
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_pointer.go.golden b/gopls/internal/lsp/testdata/stub/stub_pointer.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_pointer.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_pointer.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+--- suggestedfix_stub_pointer_6_9 --
+-package stub
+-
+-import "io"
+-
+-func getReaderFrom() io.ReaderFrom {
+- return &pointerImpl{} //@suggestedfix("&", "refactor.rewrite", "")
+-}
+-
+-type pointerImpl struct{}
+-
+-// ReadFrom implements io.ReaderFrom
+-func (*pointerImpl) ReadFrom(r io.Reader) (n int64, err error) {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_renamed_import.go b/gopls/internal/lsp/testdata/stub/stub_renamed_import.go
+--- a/gopls/internal/lsp/testdata/stub/stub_renamed_import.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_renamed_import.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-package stub
+-
+-import (
+- "compress/zlib"
+- myio "io"
+-)
+-
+-var _ zlib.Resetter = &myIO{} //@suggestedfix("&", "refactor.rewrite", "")
+-var _ myio.Reader
+-
+-type myIO struct{}
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_renamed_import.go.golden b/gopls/internal/lsp/testdata/stub/stub_renamed_import.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_renamed_import.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_renamed_import.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+--- suggestedfix_stub_renamed_import_8_23 --
+-package stub
+-
+-import (
+- "compress/zlib"
+- myio "io"
+-)
+-
+-var _ zlib.Resetter = &myIO{} //@suggestedfix("&", "refactor.rewrite", "")
+-var _ myio.Reader
+-
+-type myIO struct{}
+-
+-// Reset implements zlib.Resetter
+-func (*myIO) Reset(r myio.Reader, dict []byte) error {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_renamed_import_iface.go b/gopls/internal/lsp/testdata/stub/stub_renamed_import_iface.go
+--- a/gopls/internal/lsp/testdata/stub/stub_renamed_import_iface.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_renamed_import_iface.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-package stub
+-
+-import (
+- "golang.org/lsptests/stub/other"
+-)
+-
+-// This file tests that if an interface
+-// method references an import from its own package
+-// that the concrete type does not yet import, and that import happens
+-// to be renamed, then we prefer the renaming of the interface.
+-var _ other.Interface = &otherInterfaceImpl{} //@suggestedfix("&otherInterfaceImpl", "refactor.rewrite", "")
+-
+-type otherInterfaceImpl struct{}
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_renamed_import_iface.go.golden b/gopls/internal/lsp/testdata/stub/stub_renamed_import_iface.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_renamed_import_iface.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_renamed_import_iface.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,22 +0,0 @@
+--- suggestedfix_stub_renamed_import_iface_11_25 --
+-package stub
+-
+-import (
+- "bytes"
+- "context"
+- "golang.org/lsptests/stub/other"
+-)
+-
+-// This file tests that if an interface
+-// method references an import from its own package
+-// that the concrete type does not yet import, and that import happens
+-// to be renamed, then we prefer the renaming of the interface.
+-var _ other.Interface = &otherInterfaceImpl{} //@suggestedfix("&otherInterfaceImpl", "refactor.rewrite", "")
+-
+-type otherInterfaceImpl struct{}
+-
+-// Get implements other.Interface
+-func (*otherInterfaceImpl) Get(context.Context) *bytes.Buffer {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_stdlib.go b/gopls/internal/lsp/testdata/stub/stub_stdlib.go
+--- a/gopls/internal/lsp/testdata/stub/stub_stdlib.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_stdlib.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package stub
+-
+-import (
+- "io"
+-)
+-
+-var _ io.Writer = writer{} //@suggestedfix("w", "refactor.rewrite", "")
+-
+-type writer struct{}
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_stdlib.go.golden b/gopls/internal/lsp/testdata/stub/stub_stdlib.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_stdlib.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_stdlib.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+--- suggestedfix_stub_stdlib_7_19 --
+-package stub
+-
+-import (
+- "io"
+-)
+-
+-var _ io.Writer = writer{} //@suggestedfix("w", "refactor.rewrite", "")
+-
+-type writer struct{}
+-
+-// Write implements io.Writer
+-func (writer) Write(p []byte) (n int, err error) {
+- panic("unimplemented")
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_typedecl_group.go b/gopls/internal/lsp/testdata/stub/stub_typedecl_group.go
+--- a/gopls/internal/lsp/testdata/stub/stub_typedecl_group.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_typedecl_group.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,27 +0,0 @@
+-package stub
+-
+-// Regression test for Issue #56825: file corrupted by insertion of
+-// methods after TypeSpec in a parenthesized TypeDecl.
+-
+-import "io"
+-
+-func newReadCloser() io.ReadCloser {
+- return rdcloser{} //@suggestedfix("rd", "refactor.rewrite", "")
+-}
+-
+-type (
+- A int
+- rdcloser struct{}
+- B int
+-)
+-
+-func _() {
+- // Local types can't be stubbed as there's nowhere to put the methods.
+- // The suggestedfix assertion can't express this yet. TODO(adonovan): support it.
+- type local struct{}
+- var _ io.ReadCloser = local{} // want error: `local type "local" cannot be stubbed`
+-}
+-
+-type (
+- C int
+-)
+diff -urN a/gopls/internal/lsp/testdata/stub/stub_typedecl_group.go.golden b/gopls/internal/lsp/testdata/stub/stub_typedecl_group.go.golden
+--- a/gopls/internal/lsp/testdata/stub/stub_typedecl_group.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/stub/stub_typedecl_group.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,39 +0,0 @@
+--- suggestedfix_stub_typedecl_group_9_9 --
+-package stub
+-
+-// Regression test for Issue #56825: file corrupted by insertion of
+-// methods after TypeSpec in a parenthesized TypeDecl.
+-
+-import "io"
+-
+-func newReadCloser() io.ReadCloser {
+- return rdcloser{} //@suggestedfix("rd", "refactor.rewrite", "")
+-}
+-
+-type (
+- A int
+- rdcloser struct{}
+- B int
+-)
+-
+-// Close implements io.ReadCloser
+-func (rdcloser) Close() error {
+- panic("unimplemented")
+-}
+-
+-// Read implements io.ReadCloser
+-func (rdcloser) Read(p []byte) (n int, err error) {
+- panic("unimplemented")
+-}
+-
+-func _() {
+- // Local types can't be stubbed as there's nowhere to put the methods.
+- // The suggestedfix assertion can't express this yet. TODO(adonovan): support it.
+- type local struct{}
+- var _ io.ReadCloser = local{} // want error: `local type "local" cannot be stubbed`
+-}
+-
+-type (
+- C int
+-)
+-
+diff -urN a/gopls/internal/lsp/testdata/suggestedfix/has_suggested_fix.go b/gopls/internal/lsp/testdata/suggestedfix/has_suggested_fix.go
+--- a/gopls/internal/lsp/testdata/suggestedfix/has_suggested_fix.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/suggestedfix/has_suggested_fix.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,11 +0,0 @@
+-package suggestedfix
+-
+-import (
+- "log"
+-)
+-
+-func goodbye() {
+- s := "hiiiiiii"
+- s = s //@suggestedfix("s = s", "quickfix", "")
+- log.Print(s)
+-}
+diff -urN a/gopls/internal/lsp/testdata/suggestedfix/has_suggested_fix.go.golden b/gopls/internal/lsp/testdata/suggestedfix/has_suggested_fix.go.golden
+--- a/gopls/internal/lsp/testdata/suggestedfix/has_suggested_fix.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/suggestedfix/has_suggested_fix.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+--- suggestedfix_has_suggested_fix_9_2 --
+-package suggestedfix
+-
+-import (
+- "log"
+-)
+-
+-func goodbye() {
+- s := "hiiiiiii"
+- //@suggestedfix("s = s", "quickfix", "")
+- log.Print(s)
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/summary_go1.18.txt.golden b/gopls/internal/lsp/testdata/summary_go1.18.txt.golden
+--- a/gopls/internal/lsp/testdata/summary_go1.18.txt.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/summary_go1.18.txt.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,32 +0,0 @@
+--- summary --
+-CallHierarchyCount = 2
+-CodeLensCount = 5
+-CompletionsCount = 264
+-CompletionSnippetCount = 115
+-UnimportedCompletionsCount = 5
+-DeepCompletionsCount = 5
+-FuzzyCompletionsCount = 8
+-RankedCompletionsCount = 174
+-CaseSensitiveCompletionsCount = 4
+-DiagnosticsCount = 42
+-FoldingRangesCount = 2
+-FormatCount = 6
+-ImportCount = 8
+-SemanticTokenCount = 3
+-SuggestedFixCount = 71
+-FunctionExtractionCount = 27
+-MethodExtractionCount = 6
+-DefinitionsCount = 47
+-TypeDefinitionsCount = 18
+-HighlightsCount = 69
+-InlayHintsCount = 5
+-ReferencesCount = 30
+-RenamesCount = 48
+-PrepareRenamesCount = 7
+-SymbolsCount = 2
+-WorkspaceSymbolsCount = 20
+-SignaturesCount = 33
+-LinksCount = 7
+-ImplementationsCount = 26
+-SelectionRangesCount = 3
+-
+diff -urN a/gopls/internal/lsp/testdata/summary.txt.golden b/gopls/internal/lsp/testdata/summary.txt.golden
+--- a/gopls/internal/lsp/testdata/summary.txt.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/summary.txt.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,32 +0,0 @@
+--- summary --
+-CallHierarchyCount = 2
+-CodeLensCount = 5
+-CompletionsCount = 263
+-CompletionSnippetCount = 106
+-UnimportedCompletionsCount = 5
+-DeepCompletionsCount = 5
+-FuzzyCompletionsCount = 8
+-RankedCompletionsCount = 164
+-CaseSensitiveCompletionsCount = 4
+-DiagnosticsCount = 42
+-FoldingRangesCount = 2
+-FormatCount = 6
+-ImportCount = 8
+-SemanticTokenCount = 3
+-SuggestedFixCount = 65
+-FunctionExtractionCount = 27
+-MethodExtractionCount = 6
+-DefinitionsCount = 47
+-TypeDefinitionsCount = 18
+-HighlightsCount = 69
+-InlayHintsCount = 4
+-ReferencesCount = 30
+-RenamesCount = 41
+-PrepareRenamesCount = 7
+-SymbolsCount = 1
+-WorkspaceSymbolsCount = 20
+-SignaturesCount = 33
+-LinksCount = 7
+-ImplementationsCount = 16
+-SelectionRangesCount = 3
+-
+diff -urN a/gopls/internal/lsp/testdata/symbols/go1.18.go b/gopls/internal/lsp/testdata/symbols/go1.18.go
+--- a/gopls/internal/lsp/testdata/symbols/go1.18.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/symbols/go1.18.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+-//go:build go1.18
+-// +build go1.18
+-
+-package main
+-
+-type T[P any] struct { //@symbol("T", "T", "Struct", "struct{...}", "T", "")
+- F P //@symbol("F", "F", "Field", "P", "", "T")
+-}
+-
+-type Constraint interface { //@symbol("Constraint", "Constraint", "Interface", "interface{...}", "Constraint", "")
+- ~int | struct{ int } //@symbol("~int | struct{int}", "~int | struct{ int }", "Field", "", "", "Constraint")
+-
+- // TODO(rfindley): the selection range below is the entire interface field.
+- // Can we reduce it?
+- interface{ M() } //@symbol("interface{...}", "interface{ M() }", "Field", "", "iFaceField", "Constraint"), symbol("M", "M", "Method", "func()", "", "iFaceField")
+-}
+diff -urN a/gopls/internal/lsp/testdata/symbols/go1.18.go.golden b/gopls/internal/lsp/testdata/symbols/go1.18.go.golden
+--- a/gopls/internal/lsp/testdata/symbols/go1.18.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/symbols/go1.18.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+--- symbols --
+-T Struct 6:6-6:7
+- F Field 7:2-7:3
+-Constraint Interface 10:6-10:16
+- interface{...} Field 15:2-15:18
+- ~int | struct{int} Field 11:2-11:22
+-
+diff -urN a/gopls/internal/lsp/testdata/symbols/main.go b/gopls/internal/lsp/testdata/symbols/main.go
+--- a/gopls/internal/lsp/testdata/symbols/main.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/symbols/main.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,91 +0,0 @@
+-package main
+-
+-import (
+- "io"
+-)
+-
+-// Each symbol marker in this file defines the following information:
+-// symbol(name, selectionSpan, kind, detail, id, parentID)
+-// - name: DocumentSymbol.Name
+-// - selectionSpan: DocumentSymbol.SelectionRange
+-// - kind: DocumentSymbol.Kind
+-// - detail: DocumentSymbol.Detail
+-// - id: if non-empty, a unique identifier for this symbol
+-// - parentID: if non-empty, the id of the parent of this symbol
+-//
+-// This data in aggregate defines a set of document symbols and their
+-// parent-child relationships, which is compared against the DocummentSymbols
+-// response from gopls for the current file.
+-//
+-// TODO(rfindley): the symbol annotations here are complicated and difficult to
+-// maintain. It would be simpler to just write out the full expected response
+-// in the golden file, perhaps as raw JSON.
+-
+-var _ = 1
+-
+-var x = 42 //@symbol("x", "x", "Variable", "", "", "")
+-
+-var nested struct { //@symbol("nested", "nested", "Variable", "struct{...}", "nested", "")
+- nestedField struct { //@symbol("nestedField", "nestedField", "Field", "struct{...}", "nestedField", "nested")
+- f int //@symbol("f", "f", "Field", "int", "", "nestedField")
+- }
+-}
+-
+-const y = 43 //@symbol("y", "y", "Constant", "", "", "")
+-
+-type Number int //@symbol("Number", "Number", "Class", "int", "", "")
+-
+-type Alias = string //@symbol("Alias", "Alias", "Class", "string", "", "")
+-
+-type NumberAlias = Number //@symbol("NumberAlias", "NumberAlias", "Class", "Number", "", "")
+-
+-type (
+- Boolean bool //@symbol("Boolean", "Boolean", "Class", "bool", "", "")
+- BoolAlias = bool //@symbol("BoolAlias", "BoolAlias", "Class", "bool", "", "")
+-)
+-
+-type Foo struct { //@symbol("Foo", "Foo", "Struct", "struct{...}", "Foo", "")
+- Quux //@symbol("Quux", "Quux", "Field", "Quux", "", "Foo")
+- W io.Writer //@symbol("W", "W", "Field", "io.Writer", "", "Foo")
+- Bar int //@symbol("Bar", "Bar", "Field", "int", "", "Foo")
+- baz string //@symbol("baz", "baz", "Field", "string", "", "Foo")
+- funcField func(int) int //@symbol("funcField", "funcField", "Field", "func(int) int", "", "Foo")
+-}
+-
+-type Quux struct { //@symbol("Quux", "Quux", "Struct", "struct{...}", "Quux", "")
+- X, Y float64 //@symbol("X", "X", "Field", "float64", "", "Quux"), symbol("Y", "Y", "Field", "float64", "", "Quux")
+-}
+-
+-type EmptyStruct struct{} //@symbol("EmptyStruct", "EmptyStruct", "Struct", "struct{}", "", "")
+-
+-func (f Foo) Baz() string { //@symbol("(Foo).Baz", "Baz", "Method", "func() string", "", "")
+- return f.baz
+-}
+-
+-func _() {}
+-
+-func (q *Quux) Do() {} //@symbol("(*Quux).Do", "Do", "Method", "func()", "", "")
+-
+-func main() { //@symbol("main", "main", "Function", "func()", "", "")
+-}
+-
+-type Stringer interface { //@symbol("Stringer", "Stringer", "Interface", "interface{...}", "Stringer", "")
+- String() string //@symbol("String", "String", "Method", "func() string", "", "Stringer")
+-}
+-
+-type ABer interface { //@symbol("ABer", "ABer", "Interface", "interface{...}", "ABer", "")
+- B() //@symbol("B", "B", "Method", "func()", "", "ABer")
+- A() string //@symbol("A", "A", "Method", "func() string", "", "ABer")
+-}
+-
+-type WithEmbeddeds interface { //@symbol("WithEmbeddeds", "WithEmbeddeds", "Interface", "interface{...}", "WithEmbeddeds", "")
+- Do() //@symbol("Do", "Do", "Method", "func()", "", "WithEmbeddeds")
+- ABer //@symbol("ABer", "ABer", "Field", "ABer", "", "WithEmbeddeds")
+- io.Writer //@symbol("Writer", "Writer", "Field", "io.Writer", "", "WithEmbeddeds")
+-}
+-
+-type EmptyInterface interface{} //@symbol("EmptyInterface", "EmptyInterface", "Interface", "interface{}", "", "")
+-
+-func Dunk() int { return 0 } //@symbol("Dunk", "Dunk", "Function", "func() int", "", "")
+-
+-func dunk() {} //@symbol("dunk", "dunk", "Function", "func()", "", "")
+diff -urN a/gopls/internal/lsp/testdata/symbols/main.go.golden b/gopls/internal/lsp/testdata/symbols/main.go.golden
+--- a/gopls/internal/lsp/testdata/symbols/main.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/symbols/main.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,36 +0,0 @@
+--- symbols --
+-x Variable 26:5-26:6
+-nested Variable 28:5-28:11
+- nestedField Field 29:2-29:13
+-y Constant 34:7-34:8
+-Number Class 36:6-36:12
+-Alias Class 38:6-38:11
+-NumberAlias Class 40:6-40:17
+-Boolean Class 43:2-43:9
+-BoolAlias Class 44:2-44:11
+-Foo Struct 47:6-47:9
+- Bar Field 50:2-50:5
+- Quux Field 48:2-48:6
+- W Field 49:2-49:3
+- baz Field 51:2-51:5
+- funcField Field 52:2-52:11
+-Quux Struct 55:6-55:10
+- X Field 56:2-56:3
+- Y Field 56:5-56:6
+-EmptyStruct Struct 59:6-59:17
+-(Foo).Baz Method 61:14-61:17
+-(*Quux).Do Method 67:16-67:18
+-main Function 69:6-69:10
+-Stringer Interface 72:6-72:14
+- String Method 73:2-73:8
+-ABer Interface 76:6-76:10
+- A Method 78:2-78:3
+- B Method 77:2-77:3
+-WithEmbeddeds Interface 81:6-81:19
+- ABer Field 83:2-83:6
+- Do Method 82:2-82:4
+- Writer Field 84:5-84:11
+-EmptyInterface Interface 87:6-87:20
+-Dunk Function 89:6-89:10
+-dunk Function 91:6-91:10
+-
+diff -urN a/gopls/internal/lsp/testdata/testy/testy.go b/gopls/internal/lsp/testdata/testy/testy.go
+--- a/gopls/internal/lsp/testdata/testy/testy.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/testy/testy.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,5 +0,0 @@
+-package testy
+-
+-func a() { //@mark(identA, "a"),item(funcA, "a", "func()", "func"),refs("a", identA, testyA)
+- //@complete("", funcA)
+-}
+diff -urN a/gopls/internal/lsp/testdata/testy/testy_test.go b/gopls/internal/lsp/testdata/testy/testy_test.go
+--- a/gopls/internal/lsp/testdata/testy/testy_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/testy/testy_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+-package testy
+-
+-import (
+- "testing"
+-
+- sig "golang.org/lsptests/signature"
+- "golang.org/lsptests/snippets"
+-)
+-
+-func TestSomething(t *testing.T) { //@item(TestSomething, "TestSomething(t *testing.T)", "", "func")
+- var x int //@mark(testyX, "x"),diag("x", "compiler", "x declared (and|but) not used", "error"),refs("x", testyX)
+- a() //@mark(testyA, "a")
+-}
+-
+-func _() {
+- _ = snippets.X(nil) //@signature("nil", "X(_ map[sig.Alias]types.CoolAlias) map[sig.Alias]types.CoolAlias", 0)
+- var _ sig.Alias
+-}
+diff -urN a/gopls/internal/lsp/testdata/testy/testy_test.go.golden b/gopls/internal/lsp/testdata/testy/testy_test.go.golden
+--- a/gopls/internal/lsp/testdata/testy/testy_test.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/testy/testy_test.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,3 +0,0 @@
+--- X(_ map[sig.Alias]types.CoolAlias) map[sig.Alias]types.CoolAlias-signature --
+-X(_ map[sig.Alias]types.CoolAlias) map[sig.Alias]types.CoolAlias
+-
+diff -urN a/gopls/internal/lsp/testdata/typdef/typdef.go b/gopls/internal/lsp/testdata/typdef/typdef.go
+--- a/gopls/internal/lsp/testdata/typdef/typdef.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/typdef/typdef.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,65 +0,0 @@
+-package typdef
+-
+-type Struct struct { //@item(Struct, "Struct", "struct{...}", "struct")
+- Field string
+-}
+-
+-type Int int //@item(Int, "Int", "int", "type")
+-
+-func _() {
+- var (
+- value Struct
+- point *Struct
+- )
+- _ = value //@typdef("value", Struct)
+- _ = point //@typdef("point", Struct)
+-
+- var (
+- array [3]Struct
+- slice []Struct
+- ch chan Struct
+- complex [3]chan *[5][]Int
+- )
+- _ = array //@typdef("array", Struct)
+- _ = slice //@typdef("slice", Struct)
+- _ = ch //@typdef("ch", Struct)
+- _ = complex //@typdef("complex", Int)
+-
+- var s struct {
+- x struct {
+- xx struct {
+- field1 []Struct
+- field2 []Int
+- }
+- }
+- }
+- s.x.xx.field1 //@typdef("field1", Struct)
+- s.x.xx.field2 //@typdef("field2", Int)
+-}
+-
+-func F1() Int { return 0 }
+-func F2() (Int, float64) { return 0, 0 }
+-func F3() (Struct, int, bool, error) { return Struct{}, 0, false, nil }
+-func F4() (**int, Int, bool, *error) { return nil, Struct{}, false, nil }
+-func F5() (int, float64, error, Struct) { return 0, 0, nil, Struct{} }
+-func F6() (int, float64, ***Struct, error) { return 0, 0, nil, nil }
+-
+-func _() {
+- F1() //@typdef("F1", Int)
+- F2() //@typdef("F2", Int)
+- F3() //@typdef("F3", Struct)
+- F4() //@typdef("F4", Int)
+- F5() //@typdef("F5", Struct)
+- F6() //@typdef("F6", Struct)
+-
+- f := func() Int { return 0 }
+- f() //@typdef("f", Int)
+-}
+-
+-// https://github.com/golang/go/issues/38589#issuecomment-620350922
+-func _() {
+- type myFunc func(int) Int //@item(myFunc, "myFunc", "func", "type")
+-
+- var foo myFunc
+- bar := foo() //@typdef("foo", myFunc)
+-}
+diff -urN a/gopls/internal/lsp/testdata/typeassert/type_assert.go b/gopls/internal/lsp/testdata/typeassert/type_assert.go
+--- a/gopls/internal/lsp/testdata/typeassert/type_assert.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/typeassert/type_assert.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+-package typeassert
+-
+-type abc interface { //@item(abcIntf, "abc", "interface{...}", "interface")
+- abc()
+-}
+-
+-type abcImpl struct{} //@item(abcImpl, "abcImpl", "struct{...}", "struct")
+-func (abcImpl) abc()
+-
+-type abcPtrImpl struct{} //@item(abcPtrImpl, "abcPtrImpl", "struct{...}", "struct")
+-func (*abcPtrImpl) abc()
+-
+-type abcNotImpl struct{} //@item(abcNotImpl, "abcNotImpl", "struct{...}", "struct")
+-
+-func _() {
+- var a abc
+- switch a.(type) {
+- case ab: //@complete(":", abcImpl, abcPtrImpl, abcIntf, abcNotImpl)
+- case *ab: //@complete(":", abcImpl, abcPtrImpl, abcIntf, abcNotImpl)
+- }
+-
+- a.(ab) //@complete(")", abcImpl, abcPtrImpl, abcIntf, abcNotImpl)
+- a.(*ab) //@complete(")", abcImpl, abcPtrImpl, abcIntf, abcNotImpl)
+-}
+diff -urN a/gopls/internal/lsp/testdata/typeerrors/noresultvalues.go b/gopls/internal/lsp/testdata/typeerrors/noresultvalues.go
+--- a/gopls/internal/lsp/testdata/typeerrors/noresultvalues.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/typeerrors/noresultvalues.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,5 +0,0 @@
+-package typeerrors
+-
+-func x() { return nil } //@suggestedfix("nil", "quickfix", "")
+-
+-func y() { return nil, "hello" } //@suggestedfix("nil", "quickfix", "")
+diff -urN a/gopls/internal/lsp/testdata/typeerrors/noresultvalues.go.golden b/gopls/internal/lsp/testdata/typeerrors/noresultvalues.go.golden
+--- a/gopls/internal/lsp/testdata/typeerrors/noresultvalues.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/typeerrors/noresultvalues.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+--- suggestedfix_noresultvalues_3_19 --
+-package typeerrors
+-
+-func x() { return } //@suggestedfix("nil", "quickfix", "")
+-
+-func y() { return nil, "hello" } //@suggestedfix("nil", "quickfix", "")
+-
+--- suggestedfix_noresultvalues_5_19 --
+-package typeerrors
+-
+-func x() { return nil } //@suggestedfix("nil", "quickfix", "")
+-
+-func y() { return } //@suggestedfix("nil", "quickfix", "")
+-
+diff -urN a/gopls/internal/lsp/testdata/typemods/type_mods.go b/gopls/internal/lsp/testdata/typemods/type_mods.go
+--- a/gopls/internal/lsp/testdata/typemods/type_mods.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/typemods/type_mods.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,21 +0,0 @@
+-package typemods
+-
+-func fooFunc() func() int { //@item(modFooFunc, "fooFunc", "func() func() int", "func")
+- return func() int {
+- return 0
+- }
+-}
+-
+-func fooPtr() *int { //@item(modFooPtr, "fooPtr", "func() *int", "func")
+- return nil
+-}
+-
+-func _() {
+- var _ int = foo //@snippet(" //", modFooFunc, "fooFunc()()", "fooFunc()()"),snippet(" //", modFooPtr, "*fooPtr()", "*fooPtr()")
+-}
+-
+-func _() {
+- var m map[int][]chan int //@item(modMapChanPtr, "m", "map[int]chan *int", "var")
+-
+- var _ int = m //@snippet(" //", modMapChanPtr, "<-m[${1:}][${2:}]", "<-m[${1:}][${2:}]")
+-}
+diff -urN a/gopls/internal/lsp/testdata/typeparams/type_params.go b/gopls/internal/lsp/testdata/typeparams/type_params.go
+--- a/gopls/internal/lsp/testdata/typeparams/type_params.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/typeparams/type_params.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,61 +0,0 @@
+-//go:build go1.18
+-// +build go1.18
+-
+-package typeparams
+-
+-func one[a int | string]() {}
+-func two[a int | string, b float64 | int]() {}
+-
+-func _() {
+- one[]() //@rank("]", string, float64)
+- two[]() //@rank("]", int, float64)
+- two[int, f]() //@rank("]", float64, float32)
+-}
+-
+-func slices[a []int | []float64]() {} //@item(tpInts, "[]int", "[]int", "type"),item(tpFloats, "[]float64", "[]float64", "type")
+-
+-func _() {
+- slices[]() //@rank("]", tpInts),rank("]", tpFloats)
+-}
+-
+-type s[a int | string] struct{}
+-
+-func _() {
+- s[]{} //@rank("]", int, float64)
+-}
+-
+-func takesGeneric[a int | string](s[a]) {
+- "s[a]{}" //@item(tpInScopeLit, "s[a]{}", "", "var")
+- takesGeneric() //@rank(")", tpInScopeLit),snippet(")", tpInScopeLit, "s[a]{\\}", "s[a]{\\}")
+-}
+-
+-func _() {
+- s[int]{} //@item(tpInstLit, "s[int]{}", "", "var")
+- takesGeneric[int]() //@rank(")", tpInstLit),snippet(")", tpInstLit, "s[int]{\\}", "s[int]{\\}")
+-
+- "s[...]{}" //@item(tpUninstLit, "s[...]{}", "", "var")
+- takesGeneric() //@rank(")", tpUninstLit),snippet(")", tpUninstLit, "s[${1:}]{\\}", "s[${1:a}]{\\}")
+-}
+-
+-func returnTP[A int | float64](a A) A { //@item(returnTP, "returnTP", "something", "func")
+- return a
+-}
+-
+-func _() {
+- // disabled - see issue #54822
+- var _ int = returnTP // snippet(" //", returnTP, "returnTP[${1:}](${2:})", "returnTP[${1:A int|float64}](${2:a A})")
+-
+- var aa int //@item(tpInt, "aa", "int", "var")
+- var ab float64 //@item(tpFloat, "ab", "float64", "var")
+- returnTP[int](a) //@rank(")", tpInt, tpFloat)
+-}
+-
+-func takesFunc[T any](func(T) T) {
+- var _ func(t T) T = f //@snippet(" //", tpLitFunc, "func(t T) T {$0\\}", "func(t T) T {$0\\}")
+-}
+-
+-func _() {
+- _ = "func(...) {}" //@item(tpLitFunc, "func(...) {}", "", "var")
+- takesFunc() //@snippet(")", tpLitFunc, "func(${1:}) ${2:} {$0\\}", "func(${1:t} ${2:T}) ${3:T} {$0\\}")
+- takesFunc[int]() //@snippet(")", tpLitFunc, "func(i int) int {$0\\}", "func(${1:i} int) int {$0\\}")
+-}
+diff -urN a/gopls/internal/lsp/testdata/types/types.go b/gopls/internal/lsp/testdata/types/types.go
+--- a/gopls/internal/lsp/testdata/types/types.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/types/types.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+-package types
+-
+-type CoolAlias = int //@item(CoolAlias, "CoolAlias", "int", "type")
+-
+-type X struct { //@item(X_struct, "X", "struct{...}", "struct")
+- x int
+-}
+-
+-type Y struct { //@item(Y_struct, "Y", "struct{...}", "struct")
+- y int
+-}
+-
+-type Bob interface { //@item(Bob_interface, "Bob", "interface{...}", "interface")
+- Bobby()
+-}
+-
+-func (*X) Bobby() {}
+-func (*Y) Bobby() {}
+diff -urN a/gopls/internal/lsp/testdata/undeclared/var.go b/gopls/internal/lsp/testdata/undeclared/var.go
+--- a/gopls/internal/lsp/testdata/undeclared/var.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/undeclared/var.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,14 +0,0 @@
+-package undeclared
+-
+-func m() int {
+- z, _ := 1+y, 11 //@diag("y", "compiler", "(undeclared name|undefined): y", "error"),suggestedfix("y", "quickfix", "")
+- if 100 < 90 {
+- z = 1
+- } else if 100 > n+2 { //@diag("n", "compiler", "(undeclared name|undefined): n", "error"),suggestedfix("n", "quickfix", "")
+- z = 4
+- }
+- for i < 200 { //@diag("i", "compiler", "(undeclared name|undefined): i", "error"),suggestedfix("i", "quickfix", "")
+- }
+- r() //@diag("r", "compiler", "(undeclared name|undefined): r", "error")
+- return z
+-}
+diff -urN a/gopls/internal/lsp/testdata/undeclared/var.go.golden b/gopls/internal/lsp/testdata/undeclared/var.go.golden
+--- a/gopls/internal/lsp/testdata/undeclared/var.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/undeclared/var.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,51 +0,0 @@
+--- suggestedfix_var_10_6 --
+-package undeclared
+-
+-func m() int {
+- z, _ := 1+y, 11 //@diag("y", "compiler", "(undeclared name|undefined): y", "error"),suggestedfix("y", "quickfix", "")
+- if 100 < 90 {
+- z = 1
+- } else if 100 > n+2 { //@diag("n", "compiler", "(undeclared name|undefined): n", "error"),suggestedfix("n", "quickfix", "")
+- z = 4
+- }
+- i :=
+- for i < 200 { //@diag("i", "compiler", "(undeclared name|undefined): i", "error"),suggestedfix("i", "quickfix", "")
+- }
+- r() //@diag("r", "compiler", "(undeclared name|undefined): r", "error")
+- return z
+-}
+-
+--- suggestedfix_var_4_12 --
+-package undeclared
+-
+-func m() int {
+- y :=
+- z, _ := 1+y, 11 //@diag("y", "compiler", "(undeclared name|undefined): y", "error"),suggestedfix("y", "quickfix", "")
+- if 100 < 90 {
+- z = 1
+- } else if 100 > n+2 { //@diag("n", "compiler", "(undeclared name|undefined): n", "error"),suggestedfix("n", "quickfix", "")
+- z = 4
+- }
+- for i < 200 { //@diag("i", "compiler", "(undeclared name|undefined): i", "error"),suggestedfix("i", "quickfix", "")
+- }
+- r() //@diag("r", "compiler", "(undeclared name|undefined): r", "error")
+- return z
+-}
+-
+--- suggestedfix_var_7_18 --
+-package undeclared
+-
+-func m() int {
+- z, _ := 1+y, 11 //@diag("y", "compiler", "(undeclared name|undefined): y", "error"),suggestedfix("y", "quickfix", "")
+- n :=
+- if 100 < 90 {
+- z = 1
+- } else if 100 > n+2 { //@diag("n", "compiler", "(undeclared name|undefined): n", "error"),suggestedfix("n", "quickfix", "")
+- z = 4
+- }
+- for i < 200 { //@diag("i", "compiler", "(undeclared name|undefined): i", "error"),suggestedfix("i", "quickfix", "")
+- }
+- r() //@diag("r", "compiler", "(undeclared name|undefined): r", "error")
+- return z
+-}
+-
+diff -urN a/gopls/internal/lsp/testdata/unimported/export_test.go b/gopls/internal/lsp/testdata/unimported/export_test.go
+--- a/gopls/internal/lsp/testdata/unimported/export_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/unimported/export_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,3 +0,0 @@
+-package unimported
+-
+-var TestExport int //@item(testexport, "TestExport", "var (from \"golang.org/lsptests/unimported\")", "var")
+diff -urN a/gopls/internal/lsp/testdata/unimported/unimported_cand_type.go b/gopls/internal/lsp/testdata/unimported/unimported_cand_type.go
+--- a/gopls/internal/lsp/testdata/unimported/unimported_cand_type.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/unimported/unimported_cand_type.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,16 +0,0 @@
+-package unimported
+-
+-import (
+- _ "context"
+-
+- "golang.org/lsptests/baz"
+- _ "golang.org/lsptests/signature" // provide type information for unimported completions in the other file
+-)
+-
+-func _() {
+- foo.StructFoo{} //@item(litFooStructFoo, "foo.StructFoo{}", "struct{...}", "struct")
+-
+- // We get the literal completion for "foo.StructFoo{}" even though we haven't
+- // imported "foo" yet.
+- baz.FooStruct = f //@snippet(" //", litFooStructFoo, "foo.StructFoo{$0\\}", "foo.StructFoo{$0\\}")
+-}
+diff -urN a/gopls/internal/lsp/testdata/unimported/unimported.go.in b/gopls/internal/lsp/testdata/unimported/unimported.go.in
+--- a/gopls/internal/lsp/testdata/unimported/unimported.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/unimported/unimported.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,23 +0,0 @@
+-package unimported
+-
+-func _() {
+- http //@unimported("p", nethttp)
+- // container/ring is extremely unlikely to be imported by anything, so shouldn't have type information.
+- ring.Ring //@unimported("Ring", ringring)
+- signature.Foo //@unimported("Foo", signaturefoo)
+-
+- context.Bac //@unimported(" //", contextBackground)
+-}
+-
+-// Create markers for unimported std lib packages. Only for use by this test.
+-/* http */ //@item(nethttp, "http", "\"net/http\"", "package")
+-
+-/* ring.Ring */ //@item(ringring, "Ring", "(from \"container/ring\")", "var")
+-
+-/* signature.Foo */ //@item(signaturefoo, "Foo", "func (from \"golang.org/lsptests/signature\")", "func")
+-
+-/* context.Background */ //@item(contextBackground, "Background", "func (from \"context\")", "func")
+-
+-// Now that we no longer type-check imported completions,
+-// we don't expect the context.Background().Err method (see golang/go#58663).
+-/* context.Background().Err */ //@item(contextBackgroundErr, "Background().Err", "func (from \"context\")", "method")
+diff -urN a/gopls/internal/lsp/testdata/unimported/x_test.go b/gopls/internal/lsp/testdata/unimported/x_test.go
+--- a/gopls/internal/lsp/testdata/unimported/x_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/unimported/x_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package unimported_test
+-
+-import (
+- "testing"
+-)
+-
+-func TestSomething(t *testing.T) {
+- _ = unimported.TestExport //@unimported("TestExport", testexport)
+-}
+diff -urN a/gopls/internal/lsp/testdata/unresolved/unresolved.go.in b/gopls/internal/lsp/testdata/unresolved/unresolved.go.in
+--- a/gopls/internal/lsp/testdata/unresolved/unresolved.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/unresolved/unresolved.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,6 +0,0 @@
+-package unresolved
+-
+-func foo(interface{}) {
+- // don't crash on fake "resolved" type
+- foo(func(i, j f //@complete(" //")
+-}
+diff -urN a/gopls/internal/lsp/testdata/unsafe/unsafe.go b/gopls/internal/lsp/testdata/unsafe/unsafe.go
+--- a/gopls/internal/lsp/testdata/unsafe/unsafe.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/unsafe/unsafe.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-package unsafe
+-
+-import (
+- "unsafe"
+-)
+-
+-// Pre-set this marker, as we don't have a "source" for it in this package.
+-/* unsafe.Sizeof */ //@item(Sizeof, "Sizeof", "invalid type", "text")
+-
+-func _() {
+- x := struct{}{}
+- _ = unsafe.Sizeof(x) //@complete("z", Sizeof)
+-}
+diff -urN a/gopls/internal/lsp/testdata/variadic/variadic.go.in b/gopls/internal/lsp/testdata/variadic/variadic.go.in
+--- a/gopls/internal/lsp/testdata/variadic/variadic.go.in 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/variadic/variadic.go.in 1970-01-01 00:00:00.000000000 +0000
+@@ -1,38 +0,0 @@
+-package variadic
+-
+-func foo(i int, strs ...string) {}
+-
+-func bar() []string { //@item(vFunc, "bar", "func() []string", "func")
+- return nil
+-}
+-
+-func _() {
+- var (
+- i int //@item(vInt, "i", "int", "var")
+- s string //@item(vStr, "s", "string", "var")
+- ss []string //@item(vStrSlice, "ss", "[]string", "var")
+- v interface{} //@item(vIntf, "v", "interface{}", "var")
+- )
+-
+- foo() //@rank(")", vInt, vStr),rank(")", vInt, vStrSlice)
+- foo(123, ) //@rank(")", vStr, vInt),rank(")", vStrSlice, vInt)
+- foo(123, "", ) //@rank(")", vStr, vInt),rank(")", vStr, vStrSlice)
+- foo(123, s, "") //@rank(", \"", vStr, vStrSlice)
+-
+- // snippet will add the "..." for you
+- foo(123, ) //@snippet(")", vStrSlice, "ss...", "ss..."),snippet(")", vFunc, "bar()...", "bar()..."),snippet(")", vStr, "s", "s")
+-
+- // don't add "..." for interface{}
+- foo(123, ) //@snippet(")", vIntf, "v", "v")
+-}
+-
+-func qux(...func()) {}
+-func f() {} //@item(vVarArg, "f", "func()", "func")
+-
+-func _() {
+- qux(f) //@snippet(")", vVarArg, "f", "f")
+-}
+-
+-func _() {
+- foo(0, []string{}...) //@complete(")")
+-}
+diff -urN a/gopls/internal/lsp/testdata/variadic/variadic_intf.go b/gopls/internal/lsp/testdata/variadic/variadic_intf.go
+--- a/gopls/internal/lsp/testdata/variadic/variadic_intf.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/variadic/variadic_intf.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,21 +0,0 @@
+-package variadic
+-
+-type baz interface {
+- baz()
+-}
+-
+-func wantsBaz(...baz) {}
+-
+-type bazImpl int
+-
+-func (bazImpl) baz() {}
+-
+-func _() {
+- var (
+- impls []bazImpl //@item(vImplSlice, "impls", "[]bazImpl", "var")
+- impl bazImpl //@item(vImpl, "impl", "bazImpl", "var")
+- bazes []baz //@item(vIntfSlice, "bazes", "[]baz", "var")
+- )
+-
+- wantsBaz() //@rank(")", vImpl, vImplSlice),rank(")", vIntfSlice, vImplSlice)
+-}
+diff -urN a/gopls/internal/lsp/testdata/workspacesymbol/a/a.go b/gopls/internal/lsp/testdata/workspacesymbol/a/a.go
+--- a/gopls/internal/lsp/testdata/workspacesymbol/a/a.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/workspacesymbol/a/a.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,9 +0,0 @@
+-package a
+-
+-var RandomGopherVariableA = "a"
+-
+-const RandomGopherConstantA = "a"
+-
+-const (
+- randomgopherinvariable = iota
+-)
+diff -urN a/gopls/internal/lsp/testdata/workspacesymbol/a/a_test.go b/gopls/internal/lsp/testdata/workspacesymbol/a/a_test.go
+--- a/gopls/internal/lsp/testdata/workspacesymbol/a/a_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/workspacesymbol/a/a_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,3 +0,0 @@
+-package a
+-
+-var RandomGopherTestVariableA = "a"
+diff -urN a/gopls/internal/lsp/testdata/workspacesymbol/a/a_x_test.go b/gopls/internal/lsp/testdata/workspacesymbol/a/a_x_test.go
+--- a/gopls/internal/lsp/testdata/workspacesymbol/a/a_x_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/workspacesymbol/a/a_x_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,3 +0,0 @@
+-package a_test
+-
+-var RandomGopherXTestVariableA = "a"
+diff -urN a/gopls/internal/lsp/testdata/workspacesymbol/b/b.go b/gopls/internal/lsp/testdata/workspacesymbol/b/b.go
+--- a/gopls/internal/lsp/testdata/workspacesymbol/b/b.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/workspacesymbol/b/b.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,7 +0,0 @@
+-package b
+-
+-var RandomGopherVariableB = "b"
+-
+-type RandomGopherStructB struct {
+- Bar int
+-}
+diff -urN a/gopls/internal/lsp/testdata/workspacesymbol/issue44806.go b/gopls/internal/lsp/testdata/workspacesymbol/issue44806.go
+--- a/gopls/internal/lsp/testdata/workspacesymbol/issue44806.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/workspacesymbol/issue44806.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,10 +0,0 @@
+-package main
+-
+-type T struct{}
+-
+-// We should accept all valid receiver syntax when scanning symbols.
+-func (*(T)) m1() {}
+-func (*T) m2() {}
+-func (T) m3() {}
+-func ((T)) m4() {}
+-func ((*T)) m5() {}
+diff -urN a/gopls/internal/lsp/testdata/workspacesymbol/main.go b/gopls/internal/lsp/testdata/workspacesymbol/main.go
+--- a/gopls/internal/lsp/testdata/workspacesymbol/main.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/workspacesymbol/main.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,47 +0,0 @@
+-package main
+-
+-import (
+- "encoding/json"
+- "fmt"
+-)
+-
+-func main() { // function
+- fmt.Println("Hello")
+-}
+-
+-var myvar int // variable
+-
+-type myType string // basic type
+-
+-type myDecoder json.Decoder // to use the encoding/json import
+-
+-func (m *myType) Blahblah() {} // method
+-
+-type myStruct struct { // struct type
+- myStructField int // struct field
+-}
+-
+-type myInterface interface { // interface
+- DoSomeCoolStuff() string // interface method
+-}
+-
+-type embed struct {
+- myStruct
+-
+- nestedStruct struct {
+- nestedField int
+-
+- nestedStruct2 struct {
+- int
+- }
+- }
+-
+- nestedInterface interface {
+- myInterface
+- nestedMethod()
+- }
+-}
+-
+-func Dunk() int { return 0 }
+-
+-func dunk() {}
+diff -urN a/gopls/internal/lsp/testdata/workspacesymbol/p/p.go b/gopls/internal/lsp/testdata/workspacesymbol/p/p.go
+--- a/gopls/internal/lsp/testdata/workspacesymbol/p/p.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/workspacesymbol/p/p.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,3 +0,0 @@
+-package p
+-
+-const Message = "Hello World." // constant
+diff -urN a/gopls/internal/lsp/testdata/workspacesymbol/query.go b/gopls/internal/lsp/testdata/workspacesymbol/query.go
+--- a/gopls/internal/lsp/testdata/workspacesymbol/query.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/workspacesymbol/query.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,29 +0,0 @@
+-package main
+-
+-// Contains all of the workspace symbol queries.
+-
+-// -- Fuzzy matching --
+-//@workspacesymbolfuzzy("rgop")
+-//@workspacesymbolfuzzy("randoma")
+-//@workspacesymbolfuzzy("randomb")
+-
+-// -- Case sensitive --
+-//@workspacesymbolcasesensitive("main.main")
+-//@workspacesymbolcasesensitive("p.Message")
+-//@workspacesymbolcasesensitive("main.myvar")
+-//@workspacesymbolcasesensitive("main.myType")
+-//@workspacesymbolcasesensitive("main.myType.Blahblah")
+-//@workspacesymbolcasesensitive("main.myStruct")
+-//@workspacesymbolcasesensitive("main.myStruct.myStructField")
+-//@workspacesymbolcasesensitive("main.myInterface")
+-//@workspacesymbolcasesensitive("main.myInterface.DoSomeCoolStuff")
+-//@workspacesymbolcasesensitive("main.embed.myStruct")
+-//@workspacesymbolcasesensitive("main.embed.nestedStruct.nestedStruct2.int")
+-//@workspacesymbolcasesensitive("main.embed.nestedInterface.myInterface")
+-//@workspacesymbolcasesensitive("main.embed.nestedInterface.nestedMethod")
+-//@workspacesymbolcasesensitive("dunk")
+-//@workspacesymbolcasesensitive("Dunk")
+-
+-// -- Standard --
+-//@workspacesymbol("")
+-//@workspacesymbol("randomgophervar")
+diff -urN a/gopls/internal/lsp/testdata/workspacesymbol/query.go.golden b/gopls/internal/lsp/testdata/workspacesymbol/query.go.golden
+--- a/gopls/internal/lsp/testdata/workspacesymbol/query.go.golden 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/testdata/workspacesymbol/query.go.golden 1970-01-01 00:00:00.000000000 +0000
+@@ -1,83 +0,0 @@
+--- workspace_symbol-caseinsensitive- --
+-
+-
+--- workspace_symbol-caseinsensitive-randomgophervar --
+-workspacesymbol/a/a.go:3:5-26 RandomGopherVariableA Variable
+-workspacesymbol/b/b.go:3:5-26 RandomGopherVariableB Variable
+-
+--- workspace_symbol-casesensitive-Dunk --
+-workspacesymbol/main.go:45:6-10 Dunk Function
+-
+--- workspace_symbol-casesensitive-dunk --
+-workspacesymbol/main.go:47:6-10 dunk Function
+-
+--- workspace_symbol-casesensitive-main.embed.myStruct --
+-workspacesymbol/main.go:29:2-10 main.embed.myStruct Field
+-
+--- workspace_symbol-casesensitive-main.embed.nestedInterface.myInterface --
+-workspacesymbol/main.go:40:3-14 main.embed.nestedInterface.myInterface Interface
+-
+--- workspace_symbol-casesensitive-main.embed.nestedInterface.nestedMethod --
+-workspacesymbol/main.go:41:3-15 main.embed.nestedInterface.nestedMethod Method
+-
+--- workspace_symbol-casesensitive-main.embed.nestedStruct.nestedStruct2.int --
+-workspacesymbol/main.go:35:4-7 main.embed.nestedStruct.nestedStruct2.int Field
+-
+--- workspace_symbol-casesensitive-main.main --
+-workspacesymbol/main.go:8:6-10 main.main Function
+-
+--- workspace_symbol-casesensitive-main.myInterface --
+-workspacesymbol/main.go:24:6-17 main.myInterface Interface
+-workspacesymbol/main.go:25:2-17 main.myInterface.DoSomeCoolStuff Method
+-
+--- workspace_symbol-casesensitive-main.myInterface.DoSomeCoolStuff --
+-workspacesymbol/main.go:25:2-17 main.myInterface.DoSomeCoolStuff Method
+-
+--- workspace_symbol-casesensitive-main.myStruct --
+-workspacesymbol/main.go:20:6-14 main.myStruct Struct
+-workspacesymbol/main.go:21:2-15 main.myStruct.myStructField Field
+-
+--- workspace_symbol-casesensitive-main.myStruct.myStructField --
+-workspacesymbol/main.go:21:2-15 main.myStruct.myStructField Field
+-
+--- workspace_symbol-casesensitive-main.myType --
+-workspacesymbol/main.go:14:6-12 main.myType Class
+-workspacesymbol/main.go:18:18-26 main.myType.Blahblah Method
+-
+--- workspace_symbol-casesensitive-main.myType.Blahblah --
+-workspacesymbol/main.go:18:18-26 main.myType.Blahblah Method
+-
+--- workspace_symbol-casesensitive-main.myvar --
+-workspacesymbol/main.go:12:5-10 main.myvar Variable
+-
+--- workspace_symbol-casesensitive-p.Message --
+-workspacesymbol/p/p.go:3:7-14 p.Message Constant
+-
+--- workspace_symbol-fuzzy-randoma --
+-workspacesymbol/a/a.go:3:5-26 RandomGopherVariableA Variable
+-workspacesymbol/a/a.go:5:7-28 RandomGopherConstantA Constant
+-workspacesymbol/a/a.go:8:2-24 randomgopherinvariable Constant
+-workspacesymbol/a/a_test.go:3:5-30 RandomGopherTestVariableA Variable
+-workspacesymbol/a/a_x_test.go:3:5-31 RandomGopherXTestVariableA Variable
+-workspacesymbol/b/b.go:3:5-26 RandomGopherVariableB Variable
+-workspacesymbol/b/b.go:6:2-5 RandomGopherStructB.Bar Field
+-
+--- workspace_symbol-fuzzy-randomb --
+-workspacesymbol/a/a.go:3:5-26 RandomGopherVariableA Variable
+-workspacesymbol/a/a.go:8:2-24 randomgopherinvariable Constant
+-workspacesymbol/a/a_test.go:3:5-30 RandomGopherTestVariableA Variable
+-workspacesymbol/a/a_x_test.go:3:5-31 RandomGopherXTestVariableA Variable
+-workspacesymbol/b/b.go:3:5-26 RandomGopherVariableB Variable
+-workspacesymbol/b/b.go:5:6-25 RandomGopherStructB Struct
+-workspacesymbol/b/b.go:6:2-5 RandomGopherStructB.Bar Field
+-
+--- workspace_symbol-fuzzy-rgop --
+-workspacesymbol/a/a.go:3:5-26 RandomGopherVariableA Variable
+-workspacesymbol/a/a.go:5:7-28 RandomGopherConstantA Constant
+-workspacesymbol/a/a.go:8:2-24 randomgopherinvariable Constant
+-workspacesymbol/a/a_test.go:3:5-30 RandomGopherTestVariableA Variable
+-workspacesymbol/a/a_x_test.go:3:5-31 RandomGopherXTestVariableA Variable
+-workspacesymbol/b/b.go:3:5-26 RandomGopherVariableB Variable
+-workspacesymbol/b/b.go:5:6-25 RandomGopherStructB Struct
+-workspacesymbol/b/b.go:6:2-5 RandomGopherStructB.Bar Field
+-
+diff -urN a/gopls/internal/lsp/tests/compare/text.go b/gopls/internal/lsp/tests/compare/text.go
+--- a/gopls/internal/lsp/tests/compare/text.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/tests/compare/text.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,49 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package compare
+-
+-import (
+- "bytes"
+-
+- "golang.org/x/tools/internal/diff"
+-)
+-
+-// Text returns a formatted unified diff of the edits to go from want to
+-// got, returning "" if and only if want == got.
+-//
+-// This function is intended for use in testing, and panics if any error occurs
+-// while computing the diff. It is not sufficiently tested for production use.
+-func Text(want, got string) string {
+- return NamedText("want", "got", want, got)
+-}
+-
+-// NamedText is like text, but allows passing custom names of the 'want' and
+-// 'got' content.
+-func NamedText(wantName, gotName, want, got string) string {
+- if want == got {
+- return ""
+- }
+-
+- // Add newlines to avoid verbose newline messages ("No newline at end of file").
+- unified := diff.Unified(wantName, gotName, want+"\n", got+"\n")
+-
+- // Defensively assert that we get an actual diff, so that we guarantee the
+- // invariant that we return "" if and only if want == got.
+- //
+- // This is probably unnecessary, but convenient.
+- if unified == "" {
+- panic("empty diff for non-identical input")
+- }
+-
+- return unified
+-}
+-
+-// Bytes is like Text but using byte slices.
+-func Bytes(want, got []byte) string {
+- if bytes.Equal(want, got) {
+- return "" // common case
+- }
+- return Text(string(want), string(got))
+-}
+diff -urN a/gopls/internal/lsp/tests/compare/text_test.go b/gopls/internal/lsp/tests/compare/text_test.go
+--- a/gopls/internal/lsp/tests/compare/text_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/tests/compare/text_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,28 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package compare_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+-)
+-
+-func TestText(t *testing.T) {
+- tests := []struct {
+- got, want, wantDiff string
+- }{
+- {"", "", ""},
+- {"equal", "equal", ""},
+- {"a", "b", "--- want\n+++ got\n@@ -1 +1 @@\n-b\n+a\n"},
+- {"a\nd\nc\n", "a\nb\nc\n", "--- want\n+++ got\n@@ -1,4 +1,4 @@\n a\n-b\n+d\n c\n \n"},
+- }
+-
+- for _, test := range tests {
+- if gotDiff := compare.Text(test.want, test.got); gotDiff != test.wantDiff {
+- t.Errorf("compare.Text(%q, %q) =\n%q, want\n%q", test.want, test.got, gotDiff, test.wantDiff)
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/tests/markdown_go118.go b/gopls/internal/lsp/tests/markdown_go118.go
+--- a/gopls/internal/lsp/tests/markdown_go118.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/tests/markdown_go118.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,69 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build !go1.19
+-// +build !go1.19
+-
+-package tests
+-
+-import (
+- "regexp"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+-)
+-
+-// DiffMarkdown compares two markdown strings produced by parsing go doc
+-// comments.
+-//
+-// For go1.19 and later, markdown conversion is done using go/doc/comment.
+-// Compared to the newer version, the older version has extra escapes, and
+-// treats code blocks slightly differently.
+-func DiffMarkdown(want, got string) string {
+- want = normalizeMarkdown(want)
+- got = normalizeMarkdown(got)
+- return compare.Text(want, got)
+-}
+-
+-// normalizeMarkdown normalizes whitespace and escaping of the input string, to
+-// eliminate differences between the Go 1.18 and Go 1.19 generated markdown for
+-// doc comments. Note that it does not normalize to either the 1.18 or 1.19
+-// formatting: it simplifies both so that they may be compared.
+-//
+-// This function may need to be adjusted as we encounter more differences in
+-// the generated text.
+-//
+-// TODO(rfindley): this function doesn't correctly handle the case of
+-// multi-line docstrings.
+-func normalizeMarkdown(input string) string {
+- input = strings.TrimSpace(input)
+-
+- // For simplicity, eliminate blank lines.
+- input = regexp.MustCompile("\n+").ReplaceAllString(input, "\n")
+-
+- // Replace common escaped characters with their unescaped version.
+- //
+- // This list may not be exhaustive: it was just sufficient to make tests
+- // pass.
+- input = strings.NewReplacer(
+- `\\`, ``,
+- `\@`, `@`,
+- `\(`, `(`,
+- `\)`, `)`,
+- `\{`, `{`,
+- `\}`, `}`,
+- `\"`, `"`,
+- `\.`, `.`,
+- `\-`, `-`,
+- `\'`, `'`,
+- `\+`, `+`,
+- `\~`, `~`,
+- `\=`, `=`,
+- `\:`, `:`,
+- `\?`, `?`,
+- `\n\n\n`, `\n\n`, // Note that these are *escaped* newlines.
+- ).Replace(input)
+-
+- return input
+-}
+diff -urN a/gopls/internal/lsp/tests/markdown_go119.go b/gopls/internal/lsp/tests/markdown_go119.go
+--- a/gopls/internal/lsp/tests/markdown_go119.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/tests/markdown_go119.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,22 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.19
+-// +build go1.19
+-
+-package tests
+-
+-import (
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+-)
+-
+-// DiffMarkdown compares two markdown strings produced by parsing go doc
+-// comments.
+-//
+-// For go1.19 and later, markdown conversion is done using go/doc/comment.
+-// Compared to the newer version, the older version has extra escapes, and
+-// treats code blocks slightly differently.
+-func DiffMarkdown(want, got string) string {
+- return compare.Text(want, got)
+-}
+diff -urN a/gopls/internal/lsp/tests/normalizer.go b/gopls/internal/lsp/tests/normalizer.go
+--- a/gopls/internal/lsp/tests/normalizer.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/tests/normalizer.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,113 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package tests
+-
+-import (
+- "path/filepath"
+- "strconv"
+- "strings"
+-
+- "golang.org/x/tools/go/packages/packagestest"
+-)
+-
+-type Normalizer struct {
+- path string
+- slashed string
+- escaped string
+- fragment string
+-}
+-
+-func CollectNormalizers(exported *packagestest.Exported) []Normalizer {
+- // build the path normalizing patterns
+- var normalizers []Normalizer
+- for _, m := range exported.Modules {
+- for fragment := range m.Files {
+- n := Normalizer{
+- path: exported.File(m.Name, fragment),
+- fragment: fragment,
+- }
+- if n.slashed = filepath.ToSlash(n.path); n.slashed == n.path {
+- n.slashed = ""
+- }
+- quoted := strconv.Quote(n.path)
+- if n.escaped = quoted[1 : len(quoted)-1]; n.escaped == n.path {
+- n.escaped = ""
+- }
+- normalizers = append(normalizers, n)
+- }
+- }
+- return normalizers
+-}
+-
+-// Normalize replaces all paths present in s with just the fragment portion
+-// this is used to make golden files not depend on the temporary paths of the files
+-func Normalize(s string, normalizers []Normalizer) string {
+- type entry struct {
+- path string
+- index int
+- fragment string
+- }
+- var match []entry
+- // collect the initial state of all the matchers
+- for _, n := range normalizers {
+- index := strings.Index(s, n.path)
+- if index >= 0 {
+- match = append(match, entry{n.path, index, n.fragment})
+- }
+- if n.slashed != "" {
+- index := strings.Index(s, n.slashed)
+- if index >= 0 {
+- match = append(match, entry{n.slashed, index, n.fragment})
+- }
+- }
+- if n.escaped != "" {
+- index := strings.Index(s, n.escaped)
+- if index >= 0 {
+- match = append(match, entry{n.escaped, index, n.fragment})
+- }
+- }
+- }
+- // result should be the same or shorter than the input
+- var b strings.Builder
+- last := 0
+- for {
+- // find the nearest path match to the start of the buffer
+- next := -1
+- nearest := len(s)
+- for i, c := range match {
+- if c.index >= 0 && nearest > c.index {
+- nearest = c.index
+- next = i
+- }
+- }
+- // if there are no matches, we copy the rest of the string and are done
+- if next < 0 {
+- b.WriteString(s[last:])
+- return b.String()
+- }
+- // we have a match
+- n := &match[next]
+- // copy up to the start of the match
+- b.WriteString(s[last:n.index])
+- // skip over the filename
+- last = n.index + len(n.path)
+-
+- // Hack: In multi-module mode, we add a "testmodule/" prefix, so trim
+- // it from the fragment.
+- fragment := n.fragment
+- if strings.HasPrefix(fragment, "testmodule") {
+- split := strings.Split(filepath.ToSlash(fragment), "/")
+- fragment = filepath.FromSlash(strings.Join(split[1:], "/"))
+- }
+-
+- // add in the fragment instead
+- b.WriteString(fragment)
+- // see what the next match for this path is
+- n.index = strings.Index(s[last:], n.path)
+- if n.index >= 0 {
+- n.index += last
+- }
+- }
+-}
+diff -urN a/gopls/internal/lsp/tests/README.md b/gopls/internal/lsp/tests/README.md
+--- a/gopls/internal/lsp/tests/README.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/tests/README.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,66 +0,0 @@
+-# Testing
+-
+-LSP has "marker tests" defined in `internal/lsp/testdata`, as well as
+-traditional tests.
+-
+-## Marker tests
+-
+-Marker tests have a standard input file, like
+-`internal/lsp/testdata/foo/bar.go`, and some may have a corresponding golden
+-file, like `internal/lsp/testdata/foo/bar.go.golden`. The former is the "input"
+-and the latter is the expected output.
+-
+-Each input file contains annotations like
+-`//@suggestedfix("}", "refactor.rewrite", "Fill anonymous struct")`. These annotations are interpreted by
+-test runners to perform certain actions. The expected output after those actions
+-is encoded in the golden file.
+-
+-When tests are run, each annotation results in a new subtest, which is encoded
+-in the golden file with a heading like,
+-
+-```bash
+--- suggestedfix_bar_11_21 --
+-// expected contents go here
+--- suggestedfix_bar_13_20 --
+-// expected contents go here
+-```
+-
+-The format of these headings vary: they are defined by the
+-[`Golden`](https://pkg.go.dev/golang.org/x/tools/gopls/internal/lsp/tests#Data.Golden)
+-function for each annotation. In the case above, the format is: annotation
+-name, file name, annotation line location, annotation character location.
+-
+-So, if `internal/lsp/testdata/foo/bar.go` has three `suggestedfix` annotations,
+-the golden file should have three headers with `suggestedfix_bar_xx_yy`
+-headings.
+-
+-To see a list of all available annotations, see the exported "expectations" in
+-[tests.go](https://github.com/golang/tools/blob/299f270db45902e93469b1152fafed034bb3f033/internal/lsp/tests/tests.go#L418-L447).
+-
+-To run marker tests,
+-
+-```bash
+-cd /path/to/tools
+-
+-# The marker tests are located in "internal/lsp", "internal/lsp/cmd, and
+-# "internal/lsp/source".
+-go test ./internal/lsp/...
+-```
+-
+-There are quite a lot of marker tests, so to run one individually, pass the test
+-path and heading into a -run argument:
+-
+-```bash
+-cd /path/to/tools
+-go test ./internal/lsp/... -v -run TestLSP/Modules/SuggestedFix/bar_11_21
+-```
+-
+-## Resetting marker tests
+-
+-Sometimes, a change is made to lsp that requires a change to multiple golden
+-files. When this happens, you can run,
+-
+-```bash
+-cd /path/to/tools
+-./internal/lsp/reset_golden.sh
+-```
+diff -urN a/gopls/internal/lsp/tests/tests.go b/gopls/internal/lsp/tests/tests.go
+--- a/gopls/internal/lsp/tests/tests.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/tests/tests.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1446 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package tests exports functionality to be used across a variety of gopls tests.
+-package tests
+-
+-import (
+- "bytes"
+- "context"
+- "flag"
+- "fmt"
+- "go/ast"
+- "go/token"
+- "io"
+- "io/ioutil"
+- "os"
+- "path/filepath"
+- "regexp"
+- "sort"
+- "strconv"
+- "strings"
+- "sync"
+- "testing"
+- "time"
+-
+- "golang.org/x/tools/go/expect"
+- "golang.org/x/tools/go/packages"
+- "golang.org/x/tools/go/packages/packagestest"
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/source/completion"
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/testenv"
+- "golang.org/x/tools/internal/typeparams"
+- "golang.org/x/tools/txtar"
+-)
+-
+-const (
+- overlayFileSuffix = ".overlay"
+- goldenFileSuffix = ".golden"
+- inFileSuffix = ".in"
+-
+- // The module path containing the testdata packages.
+- //
+- // Warning: the length of this module path matters, as we have bumped up
+- // against command-line limitations on windows (golang/go#54800).
+- testModule = "golang.org/lsptests"
+-)
+-
+-var summaryFile = "summary.txt"
+-
+-func init() {
+- if typeparams.Enabled {
+- summaryFile = "summary_go1.18.txt"
+- }
+-}
+-
+-var UpdateGolden = flag.Bool("golden", false, "Update golden files")
+-
+-// These type names apparently avoid the need to repeat the
+-// type in the field name and the make() expression.
+-type CallHierarchy = map[span.Span]*CallHierarchyResult
+-type CodeLens = map[span.URI][]protocol.CodeLens
+-type Diagnostics = map[span.URI][]*source.Diagnostic
+-type CompletionItems = map[token.Pos]*completion.CompletionItem
+-type Completions = map[span.Span][]Completion
+-type CompletionSnippets = map[span.Span][]CompletionSnippet
+-type UnimportedCompletions = map[span.Span][]Completion
+-type DeepCompletions = map[span.Span][]Completion
+-type FuzzyCompletions = map[span.Span][]Completion
+-type CaseSensitiveCompletions = map[span.Span][]Completion
+-type RankCompletions = map[span.Span][]Completion
+-type FoldingRanges = []span.Span
+-type Formats = []span.Span
+-type Imports = []span.Span
+-type SemanticTokens = []span.Span
+-type SuggestedFixes = map[span.Span][]SuggestedFix
+-type FunctionExtractions = map[span.Span]span.Span
+-type MethodExtractions = map[span.Span]span.Span
+-type Definitions = map[span.Span]Definition
+-type Implementations = map[span.Span][]span.Span
+-type Highlights = map[span.Span][]span.Span
+-type References = map[span.Span][]span.Span
+-type Renames = map[span.Span]string
+-type PrepareRenames = map[span.Span]*source.PrepareItem
+-type Symbols = map[span.URI][]*symbol
+-type InlayHints = []span.Span
+-type WorkspaceSymbols = map[WorkspaceSymbolsTestType]map[span.URI][]string
+-type Signatures = map[span.Span]*protocol.SignatureHelp
+-type Links = map[span.URI][]Link
+-type AddImport = map[span.URI]string
+-type SelectionRanges = []span.Span
+-
+-type Data struct {
+- Config packages.Config
+- Exported *packagestest.Exported
+- CallHierarchy CallHierarchy
+- CodeLens CodeLens
+- Diagnostics Diagnostics
+- CompletionItems CompletionItems
+- Completions Completions
+- CompletionSnippets CompletionSnippets
+- UnimportedCompletions UnimportedCompletions
+- DeepCompletions DeepCompletions
+- FuzzyCompletions FuzzyCompletions
+- CaseSensitiveCompletions CaseSensitiveCompletions
+- RankCompletions RankCompletions
+- FoldingRanges FoldingRanges
+- Formats Formats
+- Imports Imports
+- SemanticTokens SemanticTokens
+- SuggestedFixes SuggestedFixes
+- FunctionExtractions FunctionExtractions
+- MethodExtractions MethodExtractions
+- Definitions Definitions
+- Implementations Implementations
+- Highlights Highlights
+- References References
+- Renames Renames
+- InlayHints InlayHints
+- PrepareRenames PrepareRenames
+- Symbols Symbols
+- WorkspaceSymbols WorkspaceSymbols
+- Signatures Signatures
+- Links Links
+- AddImport AddImport
+- SelectionRanges SelectionRanges
+-
+- fragments map[string]string
+- dir string
+- golden map[string]*Golden
+- mode string
+-
+- ModfileFlagAvailable bool
+-
+- mappersMu sync.Mutex
+- mappers map[span.URI]*protocol.Mapper
+-}
+-
+-// The Tests interface abstracts the LSP-based implementation of the marker
+-// test operators (such as @codelens) appearing in files beneath ../testdata/.
+-//
+-// TODO(adonovan): reduce duplication; see https://github.com/golang/go/issues/54845.
+-// There is only one implementation (*runner in ../lsp_test.go), so
+-// we can abolish the interface now.
+-type Tests interface {
+- CallHierarchy(*testing.T, span.Span, *CallHierarchyResult)
+- CodeLens(*testing.T, span.URI, []protocol.CodeLens)
+- Diagnostics(*testing.T, span.URI, []*source.Diagnostic)
+- Completion(*testing.T, span.Span, Completion, CompletionItems)
+- CompletionSnippet(*testing.T, span.Span, CompletionSnippet, bool, CompletionItems)
+- UnimportedCompletion(*testing.T, span.Span, Completion, CompletionItems)
+- DeepCompletion(*testing.T, span.Span, Completion, CompletionItems)
+- FuzzyCompletion(*testing.T, span.Span, Completion, CompletionItems)
+- CaseSensitiveCompletion(*testing.T, span.Span, Completion, CompletionItems)
+- RankCompletion(*testing.T, span.Span, Completion, CompletionItems)
+- FoldingRanges(*testing.T, span.Span)
+- Format(*testing.T, span.Span)
+- Import(*testing.T, span.Span)
+- SemanticTokens(*testing.T, span.Span)
+- SuggestedFix(*testing.T, span.Span, []SuggestedFix, int)
+- FunctionExtraction(*testing.T, span.Span, span.Span)
+- MethodExtraction(*testing.T, span.Span, span.Span)
+- Definition(*testing.T, span.Span, Definition)
+- Implementation(*testing.T, span.Span, []span.Span)
+- Highlight(*testing.T, span.Span, []span.Span)
+- InlayHints(*testing.T, span.Span)
+- References(*testing.T, span.Span, []span.Span)
+- Rename(*testing.T, span.Span, string)
+- PrepareRename(*testing.T, span.Span, *source.PrepareItem)
+- Symbols(*testing.T, span.URI, []protocol.DocumentSymbol)
+- WorkspaceSymbols(*testing.T, span.URI, string, WorkspaceSymbolsTestType)
+- SignatureHelp(*testing.T, span.Span, *protocol.SignatureHelp)
+- Link(*testing.T, span.URI, []Link)
+- AddImport(*testing.T, span.URI, string)
+- SelectionRanges(*testing.T, span.Span)
+-}
+-
+-type Definition struct {
+- Name string
+- IsType bool
+- OnlyHover bool
+- Src, Def span.Span
+-}
+-
+-type CompletionTestType int
+-
+-const (
+- // Default runs the standard completion tests.
+- CompletionDefault = CompletionTestType(iota)
+-
+- // Unimported tests the autocompletion of unimported packages.
+- CompletionUnimported
+-
+- // Deep tests deep completion.
+- CompletionDeep
+-
+- // Fuzzy tests deep completion and fuzzy matching.
+- CompletionFuzzy
+-
+- // CaseSensitive tests case sensitive completion.
+- CompletionCaseSensitive
+-
+- // CompletionRank candidates in test must be valid and in the right relative order.
+- CompletionRank
+-)
+-
+-type WorkspaceSymbolsTestType int
+-
+-const (
+- // Default runs the standard workspace symbols tests.
+- WorkspaceSymbolsDefault = WorkspaceSymbolsTestType(iota)
+-
+- // Fuzzy tests workspace symbols with fuzzy matching.
+- WorkspaceSymbolsFuzzy
+-
+- // CaseSensitive tests workspace symbols with case sensitive.
+- WorkspaceSymbolsCaseSensitive
+-)
+-
+-type Completion struct {
+- CompletionItems []token.Pos
+-}
+-
+-type CompletionSnippet struct {
+- CompletionItem token.Pos
+- PlainSnippet string
+- PlaceholderSnippet string
+-}
+-
+-type CallHierarchyResult struct {
+- IncomingCalls, OutgoingCalls []protocol.CallHierarchyItem
+-}
+-
+-type Link struct {
+- Src span.Span
+- Target string
+- NotePosition token.Position
+-}
+-
+-type SuggestedFix struct {
+- ActionKind, Title string
+-}
+-
+-// A symbol holds a DocumentSymbol along with its parent-child edge.
+-type symbol struct {
+- pSymbol protocol.DocumentSymbol
+- id, parentID string
+-}
+-
+-type Golden struct {
+- Filename string
+- Archive *txtar.Archive
+- Modified bool
+-}
+-
+-func Context(t testing.TB) context.Context {
+- return context.Background()
+-}
+-
+-func DefaultOptions(o *source.Options) {
+- o.SupportedCodeActions = map[source.FileKind]map[protocol.CodeActionKind]bool{
+- source.Go: {
+- protocol.SourceOrganizeImports: true,
+- protocol.QuickFix: true,
+- protocol.RefactorRewrite: true,
+- protocol.RefactorExtract: true,
+- protocol.SourceFixAll: true,
+- },
+- source.Mod: {
+- protocol.SourceOrganizeImports: true,
+- },
+- source.Sum: {},
+- source.Work: {},
+- source.Tmpl: {},
+- }
+- o.UserOptions.Codelenses[string(command.Test)] = true
+- o.HoverKind = source.SynopsisDocumentation
+- o.InsertTextFormat = protocol.SnippetTextFormat
+- o.CompletionBudget = time.Minute
+- o.HierarchicalDocumentSymbolSupport = true
+- o.SemanticTokens = true
+- o.InternalOptions.NewDiff = "both"
+-}
+-
+-func RunTests(t *testing.T, dataDir string, includeMultiModule bool, f func(*testing.T, *Data)) {
+- t.Helper()
+- modes := []string{"Modules", "GOPATH"}
+- if includeMultiModule {
+- modes = append(modes, "MultiModule")
+- }
+- for _, mode := range modes {
+- t.Run(mode, func(t *testing.T) {
+- datum := load(t, mode, dataDir)
+- t.Helper()
+- f(t, datum)
+- })
+- }
+-}
+-
+-func load(t testing.TB, mode string, dir string) *Data {
+- datum := &Data{
+- CallHierarchy: make(CallHierarchy),
+- CodeLens: make(CodeLens),
+- Diagnostics: make(Diagnostics),
+- CompletionItems: make(CompletionItems),
+- Completions: make(Completions),
+- CompletionSnippets: make(CompletionSnippets),
+- UnimportedCompletions: make(UnimportedCompletions),
+- DeepCompletions: make(DeepCompletions),
+- FuzzyCompletions: make(FuzzyCompletions),
+- RankCompletions: make(RankCompletions),
+- CaseSensitiveCompletions: make(CaseSensitiveCompletions),
+- Definitions: make(Definitions),
+- Implementations: make(Implementations),
+- Highlights: make(Highlights),
+- References: make(References),
+- Renames: make(Renames),
+- PrepareRenames: make(PrepareRenames),
+- SuggestedFixes: make(SuggestedFixes),
+- FunctionExtractions: make(FunctionExtractions),
+- MethodExtractions: make(MethodExtractions),
+- Symbols: make(Symbols),
+- WorkspaceSymbols: make(WorkspaceSymbols),
+- Signatures: make(Signatures),
+- Links: make(Links),
+- AddImport: make(AddImport),
+-
+- dir: dir,
+- fragments: map[string]string{},
+- golden: map[string]*Golden{},
+- mode: mode,
+- mappers: map[span.URI]*protocol.Mapper{},
+- }
+-
+- if !*UpdateGolden {
+- summary := filepath.Join(filepath.FromSlash(dir), summaryFile+goldenFileSuffix)
+- if _, err := os.Stat(summary); os.IsNotExist(err) {
+- t.Fatalf("could not find golden file summary.txt in %#v", dir)
+- }
+- archive, err := txtar.ParseFile(summary)
+- if err != nil {
+- t.Fatalf("could not read golden file %v/%v: %v", dir, summary, err)
+- }
+- datum.golden[summaryFile] = &Golden{
+- Filename: summary,
+- Archive: archive,
+- }
+- }
+-
+- files := packagestest.MustCopyFileTree(dir)
+- // Prune test cases that exercise generics.
+- if !typeparams.Enabled {
+- for name := range files {
+- if strings.Contains(name, "_generics") {
+- delete(files, name)
+- }
+- }
+- }
+- overlays := map[string][]byte{}
+- for fragment, operation := range files {
+- if trimmed := strings.TrimSuffix(fragment, goldenFileSuffix); trimmed != fragment {
+- delete(files, fragment)
+- goldFile := filepath.Join(dir, fragment)
+- archive, err := txtar.ParseFile(goldFile)
+- if err != nil {
+- t.Fatalf("could not read golden file %v: %v", fragment, err)
+- }
+- datum.golden[trimmed] = &Golden{
+- Filename: goldFile,
+- Archive: archive,
+- }
+- } else if trimmed := strings.TrimSuffix(fragment, inFileSuffix); trimmed != fragment {
+- delete(files, fragment)
+- files[trimmed] = operation
+- } else if index := strings.Index(fragment, overlayFileSuffix); index >= 0 {
+- delete(files, fragment)
+- partial := fragment[:index] + fragment[index+len(overlayFileSuffix):]
+- contents, err := ioutil.ReadFile(filepath.Join(dir, fragment))
+- if err != nil {
+- t.Fatal(err)
+- }
+- overlays[partial] = contents
+- }
+- }
+-
+- modules := []packagestest.Module{
+- {
+- Name: testModule,
+- Files: files,
+- Overlay: overlays,
+- },
+- }
+- switch mode {
+- case "Modules":
+- datum.Exported = packagestest.Export(t, packagestest.Modules, modules)
+- case "GOPATH":
+- datum.Exported = packagestest.Export(t, packagestest.GOPATH, modules)
+- case "MultiModule":
+- files := map[string]interface{}{}
+- for k, v := range modules[0].Files {
+- files[filepath.Join("testmodule", k)] = v
+- }
+- modules[0].Files = files
+-
+- overlays := map[string][]byte{}
+- for k, v := range modules[0].Overlay {
+- overlays[filepath.Join("testmodule", k)] = v
+- }
+- modules[0].Overlay = overlays
+-
+- golden := map[string]*Golden{}
+- for k, v := range datum.golden {
+- if k == summaryFile {
+- golden[k] = v
+- } else {
+- golden[filepath.Join("testmodule", k)] = v
+- }
+- }
+- datum.golden = golden
+-
+- datum.Exported = packagestest.Export(t, packagestest.Modules, modules)
+- default:
+- panic("unknown mode " + mode)
+- }
+-
+- for _, m := range modules {
+- for fragment := range m.Files {
+- filename := datum.Exported.File(m.Name, fragment)
+- datum.fragments[filename] = fragment
+- }
+- }
+-
+- // Turn off go/packages debug logging.
+- datum.Exported.Config.Logf = nil
+- datum.Config.Logf = nil
+-
+- // Merge the exported.Config with the view.Config.
+- datum.Config = *datum.Exported.Config
+- datum.Config.Fset = token.NewFileSet()
+- datum.Config.Context = Context(nil)
+- datum.Config.ParseFile = func(fset *token.FileSet, filename string, src []byte) (*ast.File, error) {
+- panic("ParseFile should not be called")
+- }
+-
+- // Do a first pass to collect special markers for completion and workspace symbols.
+- if err := datum.Exported.Expect(map[string]interface{}{
+- "item": func(name string, r packagestest.Range, _ []string) {
+- datum.Exported.Mark(name, r)
+- },
+- "symbol": func(name string, r packagestest.Range, _ []string) {
+- datum.Exported.Mark(name, r)
+- },
+- }); err != nil {
+- t.Fatal(err)
+- }
+-
+- // Collect any data that needs to be used by subsequent tests.
+- if err := datum.Exported.Expect(map[string]interface{}{
+- "codelens": datum.collectCodeLens,
+- "diag": datum.collectDiagnostics,
+- "item": datum.collectCompletionItems,
+- "complete": datum.collectCompletions(CompletionDefault),
+- "unimported": datum.collectCompletions(CompletionUnimported),
+- "deep": datum.collectCompletions(CompletionDeep),
+- "fuzzy": datum.collectCompletions(CompletionFuzzy),
+- "casesensitive": datum.collectCompletions(CompletionCaseSensitive),
+- "rank": datum.collectCompletions(CompletionRank),
+- "snippet": datum.collectCompletionSnippets,
+- "fold": datum.collectFoldingRanges,
+- "format": datum.collectFormats,
+- "import": datum.collectImports,
+- "semantic": datum.collectSemanticTokens,
+- "godef": datum.collectDefinitions,
+- "implementations": datum.collectImplementations,
+- "typdef": datum.collectTypeDefinitions,
+- "hoverdef": datum.collectHoverDefinitions,
+- "highlight": datum.collectHighlights,
+- "inlayHint": datum.collectInlayHints,
+- "refs": datum.collectReferences,
+- "rename": datum.collectRenames,
+- "prepare": datum.collectPrepareRenames,
+- "symbol": datum.collectSymbols,
+- "signature": datum.collectSignatures,
+- "link": datum.collectLinks,
+- "suggestedfix": datum.collectSuggestedFixes,
+- "extractfunc": datum.collectFunctionExtractions,
+- "extractmethod": datum.collectMethodExtractions,
+- "incomingcalls": datum.collectIncomingCalls,
+- "outgoingcalls": datum.collectOutgoingCalls,
+- "addimport": datum.collectAddImports,
+- "selectionrange": datum.collectSelectionRanges,
+- }); err != nil {
+- t.Fatal(err)
+- }
+-
+- // Collect names for the entries that require golden files.
+- if err := datum.Exported.Expect(map[string]interface{}{
+- "godef": datum.collectDefinitionNames,
+- "hoverdef": datum.collectDefinitionNames,
+- "workspacesymbol": datum.collectWorkspaceSymbols(WorkspaceSymbolsDefault),
+- "workspacesymbolfuzzy": datum.collectWorkspaceSymbols(WorkspaceSymbolsFuzzy),
+- "workspacesymbolcasesensitive": datum.collectWorkspaceSymbols(WorkspaceSymbolsCaseSensitive),
+- }); err != nil {
+- t.Fatal(err)
+- }
+- if mode == "MultiModule" {
+- if err := moveFile(filepath.Join(datum.Config.Dir, "go.mod"), filepath.Join(datum.Config.Dir, "testmodule/go.mod")); err != nil {
+- t.Fatal(err)
+- }
+- }
+-
+- return datum
+-}
+-
+-// moveFile moves the file at oldpath to newpath, by renaming if possible
+-// or copying otherwise.
+-func moveFile(oldpath, newpath string) (err error) {
+- renameErr := os.Rename(oldpath, newpath)
+- if renameErr == nil {
+- return nil
+- }
+-
+- src, err := os.Open(oldpath)
+- if err != nil {
+- return err
+- }
+- defer func() {
+- src.Close()
+- if err == nil {
+- err = os.Remove(oldpath)
+- }
+- }()
+-
+- perm := os.ModePerm
+- fi, err := src.Stat()
+- if err == nil {
+- perm = fi.Mode().Perm()
+- }
+-
+- dst, err := os.OpenFile(newpath, os.O_WRONLY|os.O_CREATE|os.O_EXCL, perm)
+- if err != nil {
+- return err
+- }
+-
+- _, err = io.Copy(dst, src)
+- if closeErr := dst.Close(); err == nil {
+- err = closeErr
+- }
+- return err
+-}
+-
+-func Run(t *testing.T, tests Tests, data *Data) {
+- t.Helper()
+- checkData(t, data)
+-
+- eachCompletion := func(t *testing.T, cases map[span.Span][]Completion, test func(*testing.T, span.Span, Completion, CompletionItems)) {
+- t.Helper()
+-
+- for src, exp := range cases {
+- for i, e := range exp {
+- t.Run(SpanName(src)+"_"+strconv.Itoa(i), func(t *testing.T) {
+- t.Helper()
+- if strings.Contains(t.Name(), "cgo") {
+- testenv.NeedsTool(t, "cgo")
+- }
+- test(t, src, e, data.CompletionItems)
+- })
+- }
+-
+- }
+- }
+-
+- t.Run("CallHierarchy", func(t *testing.T) {
+- t.Helper()
+- for spn, callHierarchyResult := range data.CallHierarchy {
+- t.Run(SpanName(spn), func(t *testing.T) {
+- t.Helper()
+- tests.CallHierarchy(t, spn, callHierarchyResult)
+- })
+- }
+- })
+-
+- t.Run("Completion", func(t *testing.T) {
+- t.Helper()
+- eachCompletion(t, data.Completions, tests.Completion)
+- })
+-
+- t.Run("CompletionSnippets", func(t *testing.T) {
+- t.Helper()
+- for _, placeholders := range []bool{true, false} {
+- for src, expecteds := range data.CompletionSnippets {
+- for i, expected := range expecteds {
+- name := SpanName(src) + "_" + strconv.Itoa(i+1)
+- if placeholders {
+- name += "_placeholders"
+- }
+-
+- t.Run(name, func(t *testing.T) {
+- t.Helper()
+- tests.CompletionSnippet(t, src, expected, placeholders, data.CompletionItems)
+- })
+- }
+- }
+- }
+- })
+-
+- t.Run("UnimportedCompletion", func(t *testing.T) {
+- t.Helper()
+- eachCompletion(t, data.UnimportedCompletions, tests.UnimportedCompletion)
+- })
+-
+- t.Run("DeepCompletion", func(t *testing.T) {
+- t.Helper()
+- eachCompletion(t, data.DeepCompletions, tests.DeepCompletion)
+- })
+-
+- t.Run("FuzzyCompletion", func(t *testing.T) {
+- t.Helper()
+- eachCompletion(t, data.FuzzyCompletions, tests.FuzzyCompletion)
+- })
+-
+- t.Run("CaseSensitiveCompletion", func(t *testing.T) {
+- t.Helper()
+- eachCompletion(t, data.CaseSensitiveCompletions, tests.CaseSensitiveCompletion)
+- })
+-
+- t.Run("RankCompletions", func(t *testing.T) {
+- t.Helper()
+- eachCompletion(t, data.RankCompletions, tests.RankCompletion)
+- })
+-
+- t.Run("CodeLens", func(t *testing.T) {
+- t.Helper()
+- for uri, want := range data.CodeLens {
+- // Check if we should skip this URI if the -modfile flag is not available.
+- if shouldSkip(data, uri) {
+- continue
+- }
+- t.Run(uriName(uri), func(t *testing.T) {
+- t.Helper()
+- tests.CodeLens(t, uri, want)
+- })
+- }
+- })
+-
+- t.Run("Diagnostics", func(t *testing.T) {
+- t.Helper()
+- for uri, want := range data.Diagnostics {
+- // Check if we should skip this URI if the -modfile flag is not available.
+- if shouldSkip(data, uri) {
+- continue
+- }
+- t.Run(uriName(uri), func(t *testing.T) {
+- t.Helper()
+- tests.Diagnostics(t, uri, want)
+- })
+- }
+- })
+-
+- t.Run("FoldingRange", func(t *testing.T) {
+- t.Helper()
+- for _, spn := range data.FoldingRanges {
+- t.Run(uriName(spn.URI()), func(t *testing.T) {
+- t.Helper()
+- tests.FoldingRanges(t, spn)
+- })
+- }
+- })
+-
+- t.Run("Format", func(t *testing.T) {
+- t.Helper()
+- for _, spn := range data.Formats {
+- t.Run(uriName(spn.URI()), func(t *testing.T) {
+- t.Helper()
+- tests.Format(t, spn)
+- })
+- }
+- })
+-
+- t.Run("Import", func(t *testing.T) {
+- t.Helper()
+- for _, spn := range data.Imports {
+- t.Run(uriName(spn.URI()), func(t *testing.T) {
+- t.Helper()
+- tests.Import(t, spn)
+- })
+- }
+- })
+-
+- t.Run("SemanticTokens", func(t *testing.T) {
+- t.Helper()
+- for _, spn := range data.SemanticTokens {
+- t.Run(uriName(spn.URI()), func(t *testing.T) {
+- t.Helper()
+- tests.SemanticTokens(t, spn)
+- })
+- }
+- })
+-
+- t.Run("SuggestedFix", func(t *testing.T) {
+- t.Helper()
+- for spn, actionKinds := range data.SuggestedFixes {
+- // Check if we should skip this spn if the -modfile flag is not available.
+- if shouldSkip(data, spn.URI()) {
+- continue
+- }
+- t.Run(SpanName(spn), func(t *testing.T) {
+- t.Helper()
+- tests.SuggestedFix(t, spn, actionKinds, 1)
+- })
+- }
+- })
+-
+- t.Run("FunctionExtraction", func(t *testing.T) {
+- t.Helper()
+- for start, end := range data.FunctionExtractions {
+- // Check if we should skip this spn if the -modfile flag is not available.
+- if shouldSkip(data, start.URI()) {
+- continue
+- }
+- t.Run(SpanName(start), func(t *testing.T) {
+- t.Helper()
+- tests.FunctionExtraction(t, start, end)
+- })
+- }
+- })
+-
+- t.Run("MethodExtraction", func(t *testing.T) {
+- t.Helper()
+- for start, end := range data.MethodExtractions {
+- // Check if we should skip this spn if the -modfile flag is not available.
+- if shouldSkip(data, start.URI()) {
+- continue
+- }
+- t.Run(SpanName(start), func(t *testing.T) {
+- t.Helper()
+- tests.MethodExtraction(t, start, end)
+- })
+- }
+- })
+-
+- t.Run("Definition", func(t *testing.T) {
+- t.Helper()
+- for spn, d := range data.Definitions {
+- t.Run(SpanName(spn), func(t *testing.T) {
+- t.Helper()
+- if strings.Contains(t.Name(), "cgo") {
+- testenv.NeedsTool(t, "cgo")
+- }
+- tests.Definition(t, spn, d)
+- })
+- }
+- })
+-
+- t.Run("Implementation", func(t *testing.T) {
+- t.Helper()
+- for spn, m := range data.Implementations {
+- t.Run(SpanName(spn), func(t *testing.T) {
+- t.Helper()
+- tests.Implementation(t, spn, m)
+- })
+- }
+- })
+-
+- t.Run("Highlight", func(t *testing.T) {
+- t.Helper()
+- for pos, locations := range data.Highlights {
+- t.Run(SpanName(pos), func(t *testing.T) {
+- t.Helper()
+- tests.Highlight(t, pos, locations)
+- })
+- }
+- })
+-
+- t.Run("InlayHints", func(t *testing.T) {
+- t.Helper()
+- for _, src := range data.InlayHints {
+- t.Run(SpanName(src), func(t *testing.T) {
+- t.Helper()
+- tests.InlayHints(t, src)
+- })
+- }
+- })
+-
+- t.Run("References", func(t *testing.T) {
+- t.Helper()
+- for src, itemList := range data.References {
+- t.Run(SpanName(src), func(t *testing.T) {
+- t.Helper()
+- tests.References(t, src, itemList)
+- })
+- }
+- })
+-
+- t.Run("Renames", func(t *testing.T) {
+- t.Helper()
+- for spn, newText := range data.Renames {
+- t.Run(uriName(spn.URI())+"_"+newText, func(t *testing.T) {
+- t.Helper()
+- tests.Rename(t, spn, newText)
+- })
+- }
+- })
+-
+- t.Run("PrepareRenames", func(t *testing.T) {
+- t.Helper()
+- for src, want := range data.PrepareRenames {
+- t.Run(SpanName(src), func(t *testing.T) {
+- t.Helper()
+- tests.PrepareRename(t, src, want)
+- })
+- }
+- })
+-
+- t.Run("Symbols", func(t *testing.T) {
+- t.Helper()
+- for uri, allSymbols := range data.Symbols {
+- byParent := make(map[string][]*symbol)
+- for _, sym := range allSymbols {
+- if sym.parentID != "" {
+- byParent[sym.parentID] = append(byParent[sym.parentID], sym)
+- }
+- }
+-
+- // collectChildren does a depth-first traversal of the symbol tree,
+- // computing children of child nodes before returning to their parent.
+- // This is necessary as the Children field is slice of non-pointer types,
+- // and therefore we need to be careful to mutate children first before
+- // assigning them to their parent.
+- var collectChildren func(id string) []protocol.DocumentSymbol
+- collectChildren = func(id string) []protocol.DocumentSymbol {
+- children := byParent[id]
+- // delete from byParent before recursing, to ensure that
+- // collectChildren terminates even in the presence of cycles.
+- delete(byParent, id)
+- var result []protocol.DocumentSymbol
+- for _, child := range children {
+- child.pSymbol.Children = collectChildren(child.id)
+- result = append(result, child.pSymbol)
+- }
+- return result
+- }
+-
+- var topLevel []protocol.DocumentSymbol
+- for _, sym := range allSymbols {
+- if sym.parentID == "" {
+- sym.pSymbol.Children = collectChildren(sym.id)
+- topLevel = append(topLevel, sym.pSymbol)
+- }
+- }
+-
+- t.Run(uriName(uri), func(t *testing.T) {
+- t.Helper()
+- tests.Symbols(t, uri, topLevel)
+- })
+- }
+- })
+-
+- t.Run("WorkspaceSymbols", func(t *testing.T) {
+- t.Helper()
+-
+- for _, typ := range []WorkspaceSymbolsTestType{
+- WorkspaceSymbolsDefault,
+- WorkspaceSymbolsCaseSensitive,
+- WorkspaceSymbolsFuzzy,
+- } {
+- for uri, cases := range data.WorkspaceSymbols[typ] {
+- for _, query := range cases {
+- name := query
+- if name == "" {
+- name = "EmptyQuery"
+- }
+- t.Run(name, func(t *testing.T) {
+- t.Helper()
+- tests.WorkspaceSymbols(t, uri, query, typ)
+- })
+- }
+- }
+- }
+-
+- })
+-
+- t.Run("SignatureHelp", func(t *testing.T) {
+- t.Helper()
+- for spn, expectedSignature := range data.Signatures {
+- t.Run(SpanName(spn), func(t *testing.T) {
+- t.Helper()
+- tests.SignatureHelp(t, spn, expectedSignature)
+- })
+- }
+- })
+-
+- t.Run("Link", func(t *testing.T) {
+- t.Helper()
+- for uri, wantLinks := range data.Links {
+- // If we are testing GOPATH, then we do not want links with the versions
+- // attached (pkg.go.dev/repoa/moda@v1.1.0/pkg), unless the file is a
+- // go.mod, then we can skip it altogether.
+- if data.Exported.Exporter == packagestest.GOPATH {
+- if strings.HasSuffix(uri.Filename(), ".mod") {
+- continue
+- }
+- re := regexp.MustCompile(`@v\d+\.\d+\.[\w-]+`)
+- for i, link := range wantLinks {
+- wantLinks[i].Target = re.ReplaceAllString(link.Target, "")
+- }
+- }
+- t.Run(uriName(uri), func(t *testing.T) {
+- t.Helper()
+- tests.Link(t, uri, wantLinks)
+- })
+- }
+- })
+-
+- t.Run("AddImport", func(t *testing.T) {
+- t.Helper()
+- for uri, exp := range data.AddImport {
+- t.Run(uriName(uri), func(t *testing.T) {
+- tests.AddImport(t, uri, exp)
+- })
+- }
+- })
+-
+- t.Run("SelectionRanges", func(t *testing.T) {
+- t.Helper()
+- for _, span := range data.SelectionRanges {
+- t.Run(SpanName(span), func(t *testing.T) {
+- tests.SelectionRanges(t, span)
+- })
+- }
+- })
+-
+- if *UpdateGolden {
+- for _, golden := range data.golden {
+- if !golden.Modified {
+- continue
+- }
+- sort.Slice(golden.Archive.Files, func(i, j int) bool {
+- return golden.Archive.Files[i].Name < golden.Archive.Files[j].Name
+- })
+- if err := ioutil.WriteFile(golden.Filename, txtar.Format(golden.Archive), 0666); err != nil {
+- t.Fatal(err)
+- }
+- }
+- }
+-}
+-
+-func checkData(t *testing.T, data *Data) {
+- buf := &bytes.Buffer{}
+- diagnosticsCount := 0
+- for _, want := range data.Diagnostics {
+- diagnosticsCount += len(want)
+- }
+- linksCount := 0
+- for _, want := range data.Links {
+- linksCount += len(want)
+- }
+- definitionCount := 0
+- typeDefinitionCount := 0
+- for _, d := range data.Definitions {
+- if d.IsType {
+- typeDefinitionCount++
+- } else {
+- definitionCount++
+- }
+- }
+-
+- snippetCount := 0
+- for _, want := range data.CompletionSnippets {
+- snippetCount += len(want)
+- }
+-
+- countCompletions := func(c map[span.Span][]Completion) (count int) {
+- for _, want := range c {
+- count += len(want)
+- }
+- return count
+- }
+-
+- countCodeLens := func(c map[span.URI][]protocol.CodeLens) (count int) {
+- for _, want := range c {
+- count += len(want)
+- }
+- return count
+- }
+-
+- countWorkspaceSymbols := func(c map[WorkspaceSymbolsTestType]map[span.URI][]string) (count int) {
+- for _, typs := range c {
+- for _, queries := range typs {
+- count += len(queries)
+- }
+- }
+- return count
+- }
+-
+- fmt.Fprintf(buf, "CallHierarchyCount = %v\n", len(data.CallHierarchy))
+- fmt.Fprintf(buf, "CodeLensCount = %v\n", countCodeLens(data.CodeLens))
+- fmt.Fprintf(buf, "CompletionsCount = %v\n", countCompletions(data.Completions))
+- fmt.Fprintf(buf, "CompletionSnippetCount = %v\n", snippetCount)
+- fmt.Fprintf(buf, "UnimportedCompletionsCount = %v\n", countCompletions(data.UnimportedCompletions))
+- fmt.Fprintf(buf, "DeepCompletionsCount = %v\n", countCompletions(data.DeepCompletions))
+- fmt.Fprintf(buf, "FuzzyCompletionsCount = %v\n", countCompletions(data.FuzzyCompletions))
+- fmt.Fprintf(buf, "RankedCompletionsCount = %v\n", countCompletions(data.RankCompletions))
+- fmt.Fprintf(buf, "CaseSensitiveCompletionsCount = %v\n", countCompletions(data.CaseSensitiveCompletions))
+- fmt.Fprintf(buf, "DiagnosticsCount = %v\n", diagnosticsCount)
+- fmt.Fprintf(buf, "FoldingRangesCount = %v\n", len(data.FoldingRanges))
+- fmt.Fprintf(buf, "FormatCount = %v\n", len(data.Formats))
+- fmt.Fprintf(buf, "ImportCount = %v\n", len(data.Imports))
+- fmt.Fprintf(buf, "SemanticTokenCount = %v\n", len(data.SemanticTokens))
+- fmt.Fprintf(buf, "SuggestedFixCount = %v\n", len(data.SuggestedFixes))
+- fmt.Fprintf(buf, "FunctionExtractionCount = %v\n", len(data.FunctionExtractions))
+- fmt.Fprintf(buf, "MethodExtractionCount = %v\n", len(data.MethodExtractions))
+- fmt.Fprintf(buf, "DefinitionsCount = %v\n", definitionCount)
+- fmt.Fprintf(buf, "TypeDefinitionsCount = %v\n", typeDefinitionCount)
+- fmt.Fprintf(buf, "HighlightsCount = %v\n", len(data.Highlights))
+- fmt.Fprintf(buf, "InlayHintsCount = %v\n", len(data.InlayHints))
+- fmt.Fprintf(buf, "ReferencesCount = %v\n", len(data.References))
+- fmt.Fprintf(buf, "RenamesCount = %v\n", len(data.Renames))
+- fmt.Fprintf(buf, "PrepareRenamesCount = %v\n", len(data.PrepareRenames))
+- fmt.Fprintf(buf, "SymbolsCount = %v\n", len(data.Symbols))
+- fmt.Fprintf(buf, "WorkspaceSymbolsCount = %v\n", countWorkspaceSymbols(data.WorkspaceSymbols))
+- fmt.Fprintf(buf, "SignaturesCount = %v\n", len(data.Signatures))
+- fmt.Fprintf(buf, "LinksCount = %v\n", linksCount)
+- fmt.Fprintf(buf, "ImplementationsCount = %v\n", len(data.Implementations))
+- fmt.Fprintf(buf, "SelectionRangesCount = %v\n", len(data.SelectionRanges))
+-
+- want := string(data.Golden(t, "summary", summaryFile, func() ([]byte, error) {
+- return buf.Bytes(), nil
+- }))
+- got := buf.String()
+- if want != got {
+- // These counters change when assertions are added or removed.
+- // They act as an independent safety net to ensure that the
+- // tests didn't spuriously pass because they did no work.
+- t.Errorf("test summary does not match:\n%s\n(Run with -golden to update golden file; also, there may be one per Go version.)", compare.Text(want, got))
+- }
+-}
+-
+-func (data *Data) Mapper(uri span.URI) (*protocol.Mapper, error) {
+- data.mappersMu.Lock()
+- defer data.mappersMu.Unlock()
+-
+- if _, ok := data.mappers[uri]; !ok {
+- content, err := data.Exported.FileContents(uri.Filename())
+- if err != nil {
+- return nil, err
+- }
+- data.mappers[uri] = protocol.NewMapper(uri, content)
+- }
+- return data.mappers[uri], nil
+-}
+-
+-func (data *Data) Golden(t *testing.T, tag, target string, update func() ([]byte, error)) []byte {
+- t.Helper()
+- fragment, found := data.fragments[target]
+- if !found {
+- if filepath.IsAbs(target) {
+- t.Fatalf("invalid golden file fragment %v", target)
+- }
+- fragment = target
+- }
+- golden := data.golden[fragment]
+- if golden == nil {
+- if !*UpdateGolden {
+- t.Fatalf("could not find golden file %v: %v", fragment, tag)
+- }
+- golden = &Golden{
+- Filename: filepath.Join(data.dir, fragment+goldenFileSuffix),
+- Archive: &txtar.Archive{},
+- Modified: true,
+- }
+- data.golden[fragment] = golden
+- }
+- var file *txtar.File
+- for i := range golden.Archive.Files {
+- f := &golden.Archive.Files[i]
+- if f.Name == tag {
+- file = f
+- break
+- }
+- }
+- if *UpdateGolden {
+- if file == nil {
+- golden.Archive.Files = append(golden.Archive.Files, txtar.File{
+- Name: tag,
+- })
+- file = &golden.Archive.Files[len(golden.Archive.Files)-1]
+- }
+- contents, err := update()
+- if err != nil {
+- t.Fatalf("could not update golden file %v: %v", fragment, err)
+- }
+- file.Data = append(contents, '\n') // add trailing \n for txtar
+- golden.Modified = true
+-
+- }
+- if file == nil {
+- t.Fatalf("could not find golden contents %v: %v", fragment, tag)
+- }
+- if len(file.Data) == 0 {
+- return file.Data
+- }
+- return file.Data[:len(file.Data)-1] // drop the trailing \n
+-}
+-
+-func (data *Data) collectCodeLens(spn span.Span, title, cmd string) {
+- data.CodeLens[spn.URI()] = append(data.CodeLens[spn.URI()], protocol.CodeLens{
+- Range: data.mustRange(spn),
+- Command: &protocol.Command{
+- Title: title,
+- Command: cmd,
+- },
+- })
+-}
+-
+-func (data *Data) collectDiagnostics(spn span.Span, msgSource, msgPattern, msgSeverity string) {
+- severity := protocol.SeverityError
+- switch msgSeverity {
+- case "error":
+- severity = protocol.SeverityError
+- case "warning":
+- severity = protocol.SeverityWarning
+- case "hint":
+- severity = protocol.SeverityHint
+- case "information":
+- severity = protocol.SeverityInformation
+- }
+-
+- data.Diagnostics[spn.URI()] = append(data.Diagnostics[spn.URI()], &source.Diagnostic{
+- Range: data.mustRange(spn),
+- Severity: severity,
+- Source: source.DiagnosticSource(msgSource),
+- Message: msgPattern,
+- })
+-}
+-
+-func (data *Data) collectCompletions(typ CompletionTestType) func(span.Span, []token.Pos) {
+- result := func(m map[span.Span][]Completion, src span.Span, expected []token.Pos) {
+- m[src] = append(m[src], Completion{
+- CompletionItems: expected,
+- })
+- }
+- switch typ {
+- case CompletionDeep:
+- return func(src span.Span, expected []token.Pos) {
+- result(data.DeepCompletions, src, expected)
+- }
+- case CompletionUnimported:
+- return func(src span.Span, expected []token.Pos) {
+- result(data.UnimportedCompletions, src, expected)
+- }
+- case CompletionFuzzy:
+- return func(src span.Span, expected []token.Pos) {
+- result(data.FuzzyCompletions, src, expected)
+- }
+- case CompletionRank:
+- return func(src span.Span, expected []token.Pos) {
+- result(data.RankCompletions, src, expected)
+- }
+- case CompletionCaseSensitive:
+- return func(src span.Span, expected []token.Pos) {
+- result(data.CaseSensitiveCompletions, src, expected)
+- }
+- default:
+- return func(src span.Span, expected []token.Pos) {
+- result(data.Completions, src, expected)
+- }
+- }
+-}
+-
+-func (data *Data) collectCompletionItems(pos token.Pos, label, detail, kind string, args []string) {
+- var documentation string
+- if len(args) > 3 {
+- documentation = args[3]
+- }
+- data.CompletionItems[pos] = &completion.CompletionItem{
+- Label: label,
+- Detail: detail,
+- Kind: protocol.ParseCompletionItemKind(kind),
+- Documentation: documentation,
+- }
+-}
+-
+-func (data *Data) collectFoldingRanges(spn span.Span) {
+- data.FoldingRanges = append(data.FoldingRanges, spn)
+-}
+-
+-func (data *Data) collectFormats(spn span.Span) {
+- data.Formats = append(data.Formats, spn)
+-}
+-
+-func (data *Data) collectImports(spn span.Span) {
+- data.Imports = append(data.Imports, spn)
+-}
+-
+-func (data *Data) collectAddImports(spn span.Span, imp string) {
+- data.AddImport[spn.URI()] = imp
+-}
+-
+-func (data *Data) collectSemanticTokens(spn span.Span) {
+- data.SemanticTokens = append(data.SemanticTokens, spn)
+-}
+-
+-func (data *Data) collectSuggestedFixes(spn span.Span, actionKind, fix string) {
+- data.SuggestedFixes[spn] = append(data.SuggestedFixes[spn], SuggestedFix{actionKind, fix})
+-}
+-
+-func (data *Data) collectFunctionExtractions(start span.Span, end span.Span) {
+- if _, ok := data.FunctionExtractions[start]; !ok {
+- data.FunctionExtractions[start] = end
+- }
+-}
+-
+-func (data *Data) collectMethodExtractions(start span.Span, end span.Span) {
+- if _, ok := data.MethodExtractions[start]; !ok {
+- data.MethodExtractions[start] = end
+- }
+-}
+-
+-func (data *Data) collectDefinitions(src, target span.Span) {
+- data.Definitions[src] = Definition{
+- Src: src,
+- Def: target,
+- }
+-}
+-
+-func (data *Data) collectSelectionRanges(spn span.Span) {
+- data.SelectionRanges = append(data.SelectionRanges, spn)
+-}
+-
+-func (data *Data) collectImplementations(src span.Span, targets []span.Span) {
+- data.Implementations[src] = targets
+-}
+-
+-func (data *Data) collectIncomingCalls(src span.Span, calls []span.Span) {
+- for _, call := range calls {
+- rng := data.mustRange(call)
+- // we're only comparing protocol.range
+- if data.CallHierarchy[src] != nil {
+- data.CallHierarchy[src].IncomingCalls = append(data.CallHierarchy[src].IncomingCalls,
+- protocol.CallHierarchyItem{
+- URI: protocol.DocumentURI(call.URI()),
+- Range: rng,
+- })
+- } else {
+- data.CallHierarchy[src] = &CallHierarchyResult{
+- IncomingCalls: []protocol.CallHierarchyItem{
+- {URI: protocol.DocumentURI(call.URI()), Range: rng},
+- },
+- }
+- }
+- }
+-}
+-
+-func (data *Data) collectOutgoingCalls(src span.Span, calls []span.Span) {
+- if data.CallHierarchy[src] == nil {
+- data.CallHierarchy[src] = &CallHierarchyResult{}
+- }
+- for _, call := range calls {
+- // we're only comparing protocol.range
+- data.CallHierarchy[src].OutgoingCalls = append(data.CallHierarchy[src].OutgoingCalls,
+- protocol.CallHierarchyItem{
+- URI: protocol.DocumentURI(call.URI()),
+- Range: data.mustRange(call),
+- })
+- }
+-}
+-
+-func (data *Data) collectHoverDefinitions(src, target span.Span) {
+- data.Definitions[src] = Definition{
+- Src: src,
+- Def: target,
+- OnlyHover: true,
+- }
+-}
+-
+-func (data *Data) collectTypeDefinitions(src, target span.Span) {
+- data.Definitions[src] = Definition{
+- Src: src,
+- Def: target,
+- IsType: true,
+- }
+-}
+-
+-func (data *Data) collectDefinitionNames(src span.Span, name string) {
+- d := data.Definitions[src]
+- d.Name = name
+- data.Definitions[src] = d
+-}
+-
+-func (data *Data) collectHighlights(src span.Span, expected []span.Span) {
+- // Declaring a highlight in a test file: @highlight(src, expected1, expected2)
+- data.Highlights[src] = append(data.Highlights[src], expected...)
+-}
+-
+-func (data *Data) collectInlayHints(src span.Span) {
+- data.InlayHints = append(data.InlayHints, src)
+-}
+-
+-func (data *Data) collectReferences(src span.Span, expected []span.Span) {
+- data.References[src] = expected
+-}
+-
+-func (data *Data) collectRenames(src span.Span, newText string) {
+- data.Renames[src] = newText
+-}
+-
+-func (data *Data) collectPrepareRenames(src, spn span.Span, placeholder string) {
+- data.PrepareRenames[src] = &source.PrepareItem{
+- Range: data.mustRange(spn),
+- Text: placeholder,
+- }
+-}
+-
+-// collectSymbols is responsible for collecting @symbol annotations.
+-func (data *Data) collectSymbols(name string, selectionRng span.Span, kind, detail, id, parentID string) {
+- // We don't set 'Range' here as it is difficult (impossible?) to express
+- // multi-line ranges in the packagestest framework.
+- uri := selectionRng.URI()
+- data.Symbols[uri] = append(data.Symbols[uri], &symbol{
+- pSymbol: protocol.DocumentSymbol{
+- Name: name,
+- Kind: protocol.ParseSymbolKind(kind),
+- SelectionRange: data.mustRange(selectionRng),
+- Detail: detail,
+- },
+- id: id,
+- parentID: parentID,
+- })
+-}
+-
+-// mustRange converts spn into a protocol.Range, panicking on any error.
+-func (data *Data) mustRange(spn span.Span) protocol.Range {
+- m, err := data.Mapper(spn.URI())
+- rng, err := m.SpanRange(spn)
+- if err != nil {
+- panic(fmt.Sprintf("converting span %s to range: %v", spn, err))
+- }
+- return rng
+-}
+-
+-func (data *Data) collectWorkspaceSymbols(typ WorkspaceSymbolsTestType) func(*expect.Note, string) {
+- return func(note *expect.Note, query string) {
+- if data.WorkspaceSymbols[typ] == nil {
+- data.WorkspaceSymbols[typ] = make(map[span.URI][]string)
+- }
+- pos := safetoken.StartPosition(data.Exported.ExpectFileSet, note.Pos)
+- uri := span.URIFromPath(pos.Filename)
+- data.WorkspaceSymbols[typ][uri] = append(data.WorkspaceSymbols[typ][uri], query)
+- }
+-}
+-
+-func (data *Data) collectSignatures(spn span.Span, signature string, activeParam int64) {
+- data.Signatures[spn] = &protocol.SignatureHelp{
+- Signatures: []protocol.SignatureInformation{
+- {
+- Label: signature,
+- },
+- },
+- ActiveParameter: uint32(activeParam),
+- }
+- // Hardcode special case to test the lack of a signature.
+- if signature == "" && activeParam == 0 {
+- data.Signatures[spn] = nil
+- }
+-}
+-
+-func (data *Data) collectCompletionSnippets(spn span.Span, item token.Pos, plain, placeholder string) {
+- data.CompletionSnippets[spn] = append(data.CompletionSnippets[spn], CompletionSnippet{
+- CompletionItem: item,
+- PlainSnippet: plain,
+- PlaceholderSnippet: placeholder,
+- })
+-}
+-
+-func (data *Data) collectLinks(spn span.Span, link string, note *expect.Note, fset *token.FileSet) {
+- position := safetoken.StartPosition(fset, note.Pos)
+- uri := spn.URI()
+- data.Links[uri] = append(data.Links[uri], Link{
+- Src: spn,
+- Target: link,
+- NotePosition: position,
+- })
+-}
+-
+-func uriName(uri span.URI) string {
+- return filepath.Base(strings.TrimSuffix(uri.Filename(), ".go"))
+-}
+-
+-// TODO(golang/go#54845): improve the formatting here to match standard
+-// line:column position formatting.
+-func SpanName(spn span.Span) string {
+- return fmt.Sprintf("%v_%v_%v", uriName(spn.URI()), spn.Start().Line(), spn.Start().Column())
+-}
+-
+-func CopyFolderToTempDir(folder string) (string, error) {
+- if _, err := os.Stat(folder); err != nil {
+- return "", err
+- }
+- dst, err := ioutil.TempDir("", "modfile_test")
+- if err != nil {
+- return "", err
+- }
+- fds, err := ioutil.ReadDir(folder)
+- if err != nil {
+- return "", err
+- }
+- for _, fd := range fds {
+- srcfp := filepath.Join(folder, fd.Name())
+- stat, err := os.Stat(srcfp)
+- if err != nil {
+- return "", err
+- }
+- if !stat.Mode().IsRegular() {
+- return "", fmt.Errorf("cannot copy non regular file %s", srcfp)
+- }
+- contents, err := ioutil.ReadFile(srcfp)
+- if err != nil {
+- return "", err
+- }
+- if err := ioutil.WriteFile(filepath.Join(dst, fd.Name()), contents, stat.Mode()); err != nil {
+- return "", err
+- }
+- }
+- return dst, nil
+-}
+-
+-func shouldSkip(data *Data, uri span.URI) bool {
+- if data.ModfileFlagAvailable {
+- return false
+- }
+- // If the -modfile flag is not available, then we do not want to run
+- // any tests on the go.mod file.
+- if strings.HasSuffix(uri.Filename(), ".mod") {
+- return true
+- }
+- // If the -modfile flag is not available, then we do not want to test any
+- // uri that contains "go mod tidy".
+- m, err := data.Mapper(uri)
+- return err == nil && strings.Contains(string(m.Content), ", \"go mod tidy\",")
+-}
+diff -urN a/gopls/internal/lsp/tests/util.go b/gopls/internal/lsp/tests/util.go
+--- a/gopls/internal/lsp/tests/util.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/tests/util.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,547 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package tests
+-
+-import (
+- "bytes"
+- "context"
+- "fmt"
+- "go/token"
+- "path"
+- "path/filepath"
+- "regexp"
+- "sort"
+- "strconv"
+- "strings"
+- "testing"
+-
+- "github.com/google/go-cmp/cmp"
+- "github.com/google/go-cmp/cmp/cmpopts"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/source/completion"
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-var builtins = map[string]bool{
+- "append": true,
+- "cap": true,
+- "close": true,
+- "complex": true,
+- "copy": true,
+- "delete": true,
+- "error": true,
+- "false": true,
+- "imag": true,
+- "iota": true,
+- "len": true,
+- "make": true,
+- "new": true,
+- "nil": true,
+- "panic": true,
+- "print": true,
+- "println": true,
+- "real": true,
+- "recover": true,
+- "true": true,
+-}
+-
+-// DiffLinks takes the links we got and checks if they are located within the source or a Note.
+-// If the link is within a Note, the link is removed.
+-// Returns an diff comment if there are differences and empty string if no diffs.
+-func DiffLinks(mapper *protocol.Mapper, wantLinks []Link, gotLinks []protocol.DocumentLink) string {
+- var notePositions []token.Position
+- links := make(map[span.Span]string, len(wantLinks))
+- for _, link := range wantLinks {
+- links[link.Src] = link.Target
+- notePositions = append(notePositions, link.NotePosition)
+- }
+-
+- var msg strings.Builder
+- for _, link := range gotLinks {
+- spn, err := mapper.RangeSpan(link.Range)
+- if err != nil {
+- return fmt.Sprintf("%v", err)
+- }
+- linkInNote := false
+- for _, notePosition := range notePositions {
+- // Drop the links found inside expectation notes arguments as this links are not collected by expect package.
+- if notePosition.Line == spn.Start().Line() &&
+- notePosition.Column <= spn.Start().Column() {
+- delete(links, spn)
+- linkInNote = true
+- }
+- }
+- if linkInNote {
+- continue
+- }
+-
+- if target, ok := links[spn]; ok {
+- delete(links, spn)
+- if target != link.Target {
+- fmt.Fprintf(&msg, "%s: want link with target %q, got %q\n", spn, target, link.Target)
+- }
+- } else {
+- fmt.Fprintf(&msg, "%s: got unexpected link with target %q\n", spn, link.Target)
+- }
+- }
+- for spn, target := range links {
+- fmt.Fprintf(&msg, "%s: expected link with target %q is missing\n", spn, target)
+- }
+- return msg.String()
+-}
+-
+-// CompareDiagnostics reports testing errors to t when the diagnostic set got
+-// does not match want. If the sole expectation has source "no_diagnostics",
+-// the test expects that no diagnostics were received for the given document.
+-func CompareDiagnostics(t *testing.T, uri span.URI, want, got []*source.Diagnostic) {
+- t.Helper()
+- fileName := path.Base(string(uri))
+-
+- // A special case to test that there are no diagnostics for a file.
+- if len(want) == 1 && want[0].Source == "no_diagnostics" {
+- want = nil
+- }
+-
+- // Build a helper function to match an actual diagnostic to an overlapping
+- // expected diagnostic (if any).
+- unmatched := make([]*source.Diagnostic, len(want))
+- copy(unmatched, want)
+- source.SortDiagnostics(unmatched)
+- match := func(g *source.Diagnostic) *source.Diagnostic {
+- // Find the last expected diagnostic d for which start(d) < end(g), and
+- // check to see if it overlaps.
+- i := sort.Search(len(unmatched), func(i int) bool {
+- d := unmatched[i]
+- // See rangeOverlaps: if a range is a single point, we consider End to be
+- // included in the range...
+- if g.Range.Start == g.Range.End {
+- return protocol.ComparePosition(d.Range.Start, g.Range.End) > 0
+- }
+- // ...otherwise the end position of a range is not included.
+- return protocol.ComparePosition(d.Range.Start, g.Range.End) >= 0
+- })
+- if i == 0 {
+- return nil
+- }
+- w := unmatched[i-1]
+- if rangeOverlaps(w.Range, g.Range) {
+- unmatched = append(unmatched[:i-1], unmatched[i:]...)
+- return w
+- }
+- return nil
+- }
+-
+- for _, g := range got {
+- w := match(g)
+- if w == nil {
+- t.Errorf("%s:%s: unexpected diagnostic %q", fileName, g.Range, g.Message)
+- continue
+- }
+- if match, err := regexp.MatchString(w.Message, g.Message); err != nil {
+- t.Errorf("%s:%s: invalid regular expression %q: %v", fileName, w.Range.Start, w.Message, err)
+- } else if !match {
+- t.Errorf("%s:%s: got Message %q, want match for pattern %q", fileName, g.Range.Start, g.Message, w.Message)
+- }
+- if w.Severity != g.Severity {
+- t.Errorf("%s:%s: got Severity %v, want %v", fileName, g.Range.Start, g.Severity, w.Severity)
+- }
+- if w.Source != g.Source {
+- t.Errorf("%s:%s: got Source %v, want %v", fileName, g.Range.Start, g.Source, w.Source)
+- }
+- }
+-
+- for _, w := range unmatched {
+- t.Errorf("%s:%s: unmatched diagnostic pattern %q", fileName, w.Range, w.Message)
+- }
+-}
+-
+-// rangeOverlaps reports whether r1 and r2 overlap.
+-func rangeOverlaps(r1, r2 protocol.Range) bool {
+- if inRange(r2.Start, r1) || inRange(r1.Start, r2) {
+- return true
+- }
+- return false
+-}
+-
+-// inRange reports whether p is contained within [r.Start, r.End), or if p ==
+-// r.Start == r.End (special handling for the case where the range is a single
+-// point).
+-func inRange(p protocol.Position, r protocol.Range) bool {
+- if protocol.IsPoint(r) {
+- return protocol.ComparePosition(r.Start, p) == 0
+- }
+- if protocol.ComparePosition(r.Start, p) <= 0 && protocol.ComparePosition(p, r.End) < 0 {
+- return true
+- }
+- return false
+-}
+-
+-func DiffCodeLens(uri span.URI, want, got []protocol.CodeLens) string {
+- sortCodeLens(want)
+- sortCodeLens(got)
+-
+- if len(got) != len(want) {
+- return summarizeCodeLens(-1, uri, want, got, "different lengths got %v want %v", len(got), len(want))
+- }
+- for i, w := range want {
+- g := got[i]
+- if w.Command.Command != g.Command.Command {
+- return summarizeCodeLens(i, uri, want, got, "incorrect Command Name got %v want %v", g.Command.Command, w.Command.Command)
+- }
+- if w.Command.Title != g.Command.Title {
+- return summarizeCodeLens(i, uri, want, got, "incorrect Command Title got %v want %v", g.Command.Title, w.Command.Title)
+- }
+- if protocol.ComparePosition(w.Range.Start, g.Range.Start) != 0 {
+- return summarizeCodeLens(i, uri, want, got, "incorrect Start got %v want %v", g.Range.Start, w.Range.Start)
+- }
+- if !protocol.IsPoint(g.Range) { // Accept any 'want' range if the codelens returns a zero-length range.
+- if protocol.ComparePosition(w.Range.End, g.Range.End) != 0 {
+- return summarizeCodeLens(i, uri, want, got, "incorrect End got %v want %v", g.Range.End, w.Range.End)
+- }
+- }
+- }
+- return ""
+-}
+-
+-func sortCodeLens(c []protocol.CodeLens) {
+- sort.Slice(c, func(i int, j int) bool {
+- if r := protocol.CompareRange(c[i].Range, c[j].Range); r != 0 {
+- return r < 0
+- }
+- if c[i].Command.Command < c[j].Command.Command {
+- return true
+- } else if c[i].Command.Command == c[j].Command.Command {
+- return c[i].Command.Title < c[j].Command.Title
+- } else {
+- return false
+- }
+- })
+-}
+-
+-func summarizeCodeLens(i int, uri span.URI, want, got []protocol.CodeLens, reason string, args ...interface{}) string {
+- msg := &bytes.Buffer{}
+- fmt.Fprint(msg, "codelens failed")
+- if i >= 0 {
+- fmt.Fprintf(msg, " at %d", i)
+- }
+- fmt.Fprint(msg, " because of ")
+- fmt.Fprintf(msg, reason, args...)
+- fmt.Fprint(msg, ":\nexpected:\n")
+- for _, d := range want {
+- fmt.Fprintf(msg, " %s:%v: %s | %s\n", uri, d.Range, d.Command.Command, d.Command.Title)
+- }
+- fmt.Fprintf(msg, "got:\n")
+- for _, d := range got {
+- fmt.Fprintf(msg, " %s:%v: %s | %s\n", uri, d.Range, d.Command.Command, d.Command.Title)
+- }
+- return msg.String()
+-}
+-
+-func DiffSignatures(spn span.Span, want, got *protocol.SignatureHelp) string {
+- decorate := func(f string, args ...interface{}) string {
+- return fmt.Sprintf("invalid signature at %s: %s", spn, fmt.Sprintf(f, args...))
+- }
+- if len(got.Signatures) != 1 {
+- return decorate("wanted 1 signature, got %d", len(got.Signatures))
+- }
+- if got.ActiveSignature != 0 {
+- return decorate("wanted active signature of 0, got %d", int(got.ActiveSignature))
+- }
+- if want.ActiveParameter != got.ActiveParameter {
+- return decorate("wanted active parameter of %d, got %d", want.ActiveParameter, int(got.ActiveParameter))
+- }
+- g := got.Signatures[0]
+- w := want.Signatures[0]
+- if diff := compare.Text(NormalizeAny(w.Label), NormalizeAny(g.Label)); diff != "" {
+- return decorate("mismatched labels:\n%s", diff)
+- }
+- var paramParts []string
+- for _, p := range g.Parameters {
+- paramParts = append(paramParts, p.Label)
+- }
+- paramsStr := strings.Join(paramParts, ", ")
+- if !strings.Contains(g.Label, paramsStr) {
+- return decorate("expected signature %q to contain params %q", g.Label, paramsStr)
+- }
+- return ""
+-}
+-
+-// NormalizeAny replaces occurrences of interface{} in input with any.
+-//
+-// In Go 1.18, standard library functions were changed to use the 'any'
+-// alias in place of interface{}, which affects their type string.
+-func NormalizeAny(input string) string {
+- return strings.ReplaceAll(input, "interface{}", "any")
+-}
+-
+-// DiffCallHierarchyItems returns the diff between expected and actual call locations for incoming/outgoing call hierarchies
+-func DiffCallHierarchyItems(gotCalls []protocol.CallHierarchyItem, expectedCalls []protocol.CallHierarchyItem) string {
+- expected := make(map[protocol.Location]bool)
+- for _, call := range expectedCalls {
+- expected[protocol.Location{URI: call.URI, Range: call.Range}] = true
+- }
+-
+- got := make(map[protocol.Location]bool)
+- for _, call := range gotCalls {
+- got[protocol.Location{URI: call.URI, Range: call.Range}] = true
+- }
+- if len(got) != len(expected) {
+- return fmt.Sprintf("expected %d calls but got %d", len(expected), len(got))
+- }
+- for spn := range got {
+- if !expected[spn] {
+- return fmt.Sprintf("incorrect calls, expected locations %v but got locations %v", expected, got)
+- }
+- }
+- return ""
+-}
+-
+-func FilterBuiltins(src span.Span, items []protocol.CompletionItem) []protocol.CompletionItem {
+- var (
+- got []protocol.CompletionItem
+- wantBuiltins = strings.Contains(string(src.URI()), "builtins")
+- wantKeywords = strings.Contains(string(src.URI()), "keywords")
+- )
+- for _, item := range items {
+- if !wantBuiltins && isBuiltin(item.Label, item.Detail, item.Kind) {
+- continue
+- }
+-
+- if !wantKeywords && token.Lookup(item.Label).IsKeyword() {
+- continue
+- }
+-
+- got = append(got, item)
+- }
+- return got
+-}
+-
+-func isBuiltin(label, detail string, kind protocol.CompletionItemKind) bool {
+- if detail == "" && kind == protocol.ClassCompletion {
+- return true
+- }
+- // Remaining builtin constants, variables, interfaces, and functions.
+- trimmed := label
+- if i := strings.Index(trimmed, "("); i >= 0 {
+- trimmed = trimmed[:i]
+- }
+- return builtins[trimmed]
+-}
+-
+-func CheckCompletionOrder(want, got []protocol.CompletionItem, strictScores bool) string {
+- var (
+- matchedIdxs []int
+- lastGotIdx int
+- lastGotSort float64
+- inOrder = true
+- errorMsg = "completions out of order"
+- )
+- for _, w := range want {
+- var found bool
+- for i, g := range got {
+- if w.Label == g.Label && NormalizeAny(w.Detail) == NormalizeAny(g.Detail) && w.Kind == g.Kind {
+- matchedIdxs = append(matchedIdxs, i)
+- found = true
+-
+- if i < lastGotIdx {
+- inOrder = false
+- }
+- lastGotIdx = i
+-
+- sort, _ := strconv.ParseFloat(g.SortText, 64)
+- if strictScores && len(matchedIdxs) > 1 && sort <= lastGotSort {
+- inOrder = false
+- errorMsg = "candidate scores not strictly decreasing"
+- }
+- lastGotSort = sort
+-
+- break
+- }
+- }
+- if !found {
+- return summarizeCompletionItems(-1, []protocol.CompletionItem{w}, got, "didn't find expected completion")
+- }
+- }
+-
+- sort.Ints(matchedIdxs)
+- matched := make([]protocol.CompletionItem, 0, len(matchedIdxs))
+- for _, idx := range matchedIdxs {
+- matched = append(matched, got[idx])
+- }
+-
+- if !inOrder {
+- return summarizeCompletionItems(-1, want, matched, errorMsg)
+- }
+-
+- return ""
+-}
+-
+-func DiffSnippets(want string, got *protocol.CompletionItem) string {
+- if want == "" {
+- if got != nil {
+- x := got.TextEdit
+- return fmt.Sprintf("expected no snippet but got %s", x.NewText)
+- }
+- } else {
+- if got == nil {
+- return fmt.Sprintf("couldn't find completion matching %q", want)
+- }
+- x := got.TextEdit
+- if want != x.NewText {
+- return fmt.Sprintf("expected snippet %q, got %q", want, x.NewText)
+- }
+- }
+- return ""
+-}
+-
+-func FindItem(list []protocol.CompletionItem, want completion.CompletionItem) *protocol.CompletionItem {
+- for _, item := range list {
+- if item.Label == want.Label {
+- return &item
+- }
+- }
+- return nil
+-}
+-
+-// DiffCompletionItems prints the diff between expected and actual completion
+-// test results.
+-//
+-// The diff will be formatted using '-' and '+' for want and got, respectively.
+-func DiffCompletionItems(want, got []protocol.CompletionItem) string {
+- // Many fields are not set in the "want" slice.
+- irrelevantFields := []string{
+- "AdditionalTextEdits",
+- "Documentation",
+- "TextEdit",
+- "SortText",
+- "Preselect",
+- "FilterText",
+- "InsertText",
+- "InsertTextFormat",
+- }
+- ignore := cmpopts.IgnoreFields(protocol.CompletionItem{}, irrelevantFields...)
+- normalizeAny := cmpopts.AcyclicTransformer("NormalizeAny", func(item protocol.CompletionItem) protocol.CompletionItem {
+- item.Detail = NormalizeAny(item.Detail)
+- return item
+- })
+- return cmp.Diff(want, got, ignore, normalizeAny)
+-}
+-
+-func summarizeCompletionItems(i int, want, got []protocol.CompletionItem, reason string, args ...interface{}) string {
+- msg := &bytes.Buffer{}
+- fmt.Fprint(msg, "completion failed")
+- if i >= 0 {
+- fmt.Fprintf(msg, " at %d", i)
+- }
+- fmt.Fprint(msg, " because of ")
+- fmt.Fprintf(msg, reason, args...)
+- fmt.Fprint(msg, ":\nexpected:\n")
+- for _, d := range want {
+- fmt.Fprintf(msg, " %v\n", d)
+- }
+- fmt.Fprintf(msg, "got:\n")
+- for _, d := range got {
+- fmt.Fprintf(msg, " %v\n", d)
+- }
+- return msg.String()
+-}
+-
+-func EnableAllAnalyzers(opts *source.Options) {
+- if opts.Analyses == nil {
+- opts.Analyses = make(map[string]bool)
+- }
+- for _, a := range opts.DefaultAnalyzers {
+- if !a.IsEnabled(opts) {
+- opts.Analyses[a.Analyzer.Name] = true
+- }
+- }
+- for _, a := range opts.TypeErrorAnalyzers {
+- if !a.IsEnabled(opts) {
+- opts.Analyses[a.Analyzer.Name] = true
+- }
+- }
+- for _, a := range opts.ConvenienceAnalyzers {
+- if !a.IsEnabled(opts) {
+- opts.Analyses[a.Analyzer.Name] = true
+- }
+- }
+- for _, a := range opts.StaticcheckAnalyzers {
+- if !a.IsEnabled(opts) {
+- opts.Analyses[a.Analyzer.Name] = true
+- }
+- }
+-}
+-
+-func EnableAllInlayHints(opts *source.Options) {
+- if opts.Hints == nil {
+- opts.Hints = make(map[string]bool)
+- }
+- for name := range source.AllInlayHints {
+- opts.Hints[name] = true
+- }
+-}
+-
+-func WorkspaceSymbolsString(ctx context.Context, data *Data, queryURI span.URI, symbols []protocol.SymbolInformation) (string, error) {
+- queryDir := filepath.Dir(queryURI.Filename())
+- var filtered []string
+- for _, s := range symbols {
+- uri := s.Location.URI.SpanURI()
+- dir := filepath.Dir(uri.Filename())
+- if !source.InDir(queryDir, dir) { // assume queries always issue from higher directories
+- continue
+- }
+- m, err := data.Mapper(uri)
+- if err != nil {
+- return "", err
+- }
+- spn, err := m.LocationSpan(s.Location)
+- if err != nil {
+- return "", err
+- }
+- filtered = append(filtered, fmt.Sprintf("%s %s %s", spn, s.Name, s.Kind))
+- }
+- sort.Strings(filtered)
+- return strings.Join(filtered, "\n") + "\n", nil
+-}
+-
+-func WorkspaceSymbolsTestTypeToMatcher(typ WorkspaceSymbolsTestType) source.SymbolMatcher {
+- switch typ {
+- case WorkspaceSymbolsFuzzy:
+- return source.SymbolFuzzy
+- case WorkspaceSymbolsCaseSensitive:
+- return source.SymbolCaseSensitive
+- default:
+- return source.SymbolCaseInsensitive
+- }
+-}
+-
+-// LocationsToSpans converts protocol location into span form for testing.
+-func LocationsToSpans(data *Data, locs []protocol.Location) ([]span.Span, error) {
+- spans := make([]span.Span, len(locs))
+- for i, loc := range locs {
+- m, err := data.Mapper(loc.URI.SpanURI())
+- if err != nil {
+- return nil, err
+- }
+- spn, err := m.LocationSpan(loc)
+- if err != nil {
+- return nil, fmt.Errorf("failed for %v: %w", loc, err)
+- }
+- spans[i] = spn
+- }
+- return spans, nil
+-}
+-
+-// SortAndFormatSpans sorts and formats a list of spans for use in an assertion.
+-func SortAndFormatSpans(spans []span.Span) string {
+- span.SortSpans(spans)
+- var buf strings.Builder
+- for _, spn := range spans {
+- fmt.Fprintf(&buf, "%v\n", spn)
+- }
+- return buf.String()
+-}
+diff -urN a/gopls/internal/lsp/tests/util_go118.go b/gopls/internal/lsp/tests/util_go118.go
+--- a/gopls/internal/lsp/tests/util_go118.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/tests/util_go118.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,13 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package tests
+-
+-func init() {
+- builtins["any"] = true
+- builtins["comparable"] = true
+-}
+diff -urN a/gopls/internal/lsp/tests/util_go121.go b/gopls/internal/lsp/tests/util_go121.go
+--- a/gopls/internal/lsp/tests/util_go121.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/tests/util_go121.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,12 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.21
+-// +build go1.21
+-
+-package tests
+-
+-func init() {
+- builtins["clear"] = true
+-}
+diff -urN a/gopls/internal/lsp/text_synchronization.go b/gopls/internal/lsp/text_synchronization.go
+--- a/gopls/internal/lsp/text_synchronization.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/text_synchronization.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,349 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "bytes"
+- "context"
+- "errors"
+- "fmt"
+- "path/filepath"
+- "sync"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/jsonrpc2"
+-)
+-
+-// ModificationSource identifies the originating cause of a file modification.
+-type ModificationSource int
+-
+-const (
+- // FromDidOpen is a file modification caused by opening a file.
+- FromDidOpen = ModificationSource(iota)
+-
+- // FromDidChange is a file modification caused by changing a file.
+- FromDidChange
+-
+- // FromDidChangeWatchedFiles is a file modification caused by a change to a
+- // watched file.
+- FromDidChangeWatchedFiles
+-
+- // FromDidSave is a file modification caused by a file save.
+- FromDidSave
+-
+- // FromDidClose is a file modification caused by closing a file.
+- FromDidClose
+-
+- // TODO: add FromDidChangeConfiguration, once configuration changes cause a
+- // new snapshot to be created.
+-
+- // FromRegenerateCgo refers to file modifications caused by regenerating
+- // the cgo sources for the workspace.
+- FromRegenerateCgo
+-
+- // FromInitialWorkspaceLoad refers to the loading of all packages in the
+- // workspace when the view is first created.
+- FromInitialWorkspaceLoad
+-)
+-
+-func (m ModificationSource) String() string {
+- switch m {
+- case FromDidOpen:
+- return "opened files"
+- case FromDidChange:
+- return "changed files"
+- case FromDidChangeWatchedFiles:
+- return "files changed on disk"
+- case FromDidSave:
+- return "saved files"
+- case FromDidClose:
+- return "close files"
+- case FromRegenerateCgo:
+- return "regenerate cgo"
+- case FromInitialWorkspaceLoad:
+- return "initial workspace load"
+- default:
+- return "unknown file modification"
+- }
+-}
+-
+-func (s *Server) didOpen(ctx context.Context, params *protocol.DidOpenTextDocumentParams) error {
+- uri := params.TextDocument.URI.SpanURI()
+- if !uri.IsFile() {
+- return nil
+- }
+- // There may not be any matching view in the current session. If that's
+- // the case, try creating a new view based on the opened file path.
+- //
+- // TODO(rstambler): This seems like it would continuously add new
+- // views, but it won't because ViewOf only returns an error when there
+- // are no views in the session. I don't know if that logic should go
+- // here, or if we can continue to rely on that implementation detail.
+- if _, err := s.session.ViewOf(uri); err != nil {
+- dir := filepath.Dir(uri.Filename())
+- if err := s.addFolders(ctx, []protocol.WorkspaceFolder{{
+- URI: string(protocol.URIFromPath(dir)),
+- Name: filepath.Base(dir),
+- }}); err != nil {
+- return err
+- }
+- }
+- return s.didModifyFiles(ctx, []source.FileModification{{
+- URI: uri,
+- Action: source.Open,
+- Version: params.TextDocument.Version,
+- Text: []byte(params.TextDocument.Text),
+- LanguageID: params.TextDocument.LanguageID,
+- }}, FromDidOpen)
+-}
+-
+-func (s *Server) didChange(ctx context.Context, params *protocol.DidChangeTextDocumentParams) error {
+- uri := params.TextDocument.URI.SpanURI()
+- if !uri.IsFile() {
+- return nil
+- }
+-
+- text, err := s.changedText(ctx, uri, params.ContentChanges)
+- if err != nil {
+- return err
+- }
+- c := source.FileModification{
+- URI: uri,
+- Action: source.Change,
+- Version: params.TextDocument.Version,
+- Text: text,
+- }
+- if err := s.didModifyFiles(ctx, []source.FileModification{c}, FromDidChange); err != nil {
+- return err
+- }
+- return s.warnAboutModifyingGeneratedFiles(ctx, uri)
+-}
+-
+-// warnAboutModifyingGeneratedFiles shows a warning if a user tries to edit a
+-// generated file for the first time.
+-func (s *Server) warnAboutModifyingGeneratedFiles(ctx context.Context, uri span.URI) error {
+- s.changedFilesMu.Lock()
+- _, ok := s.changedFiles[uri]
+- if !ok {
+- s.changedFiles[uri] = struct{}{}
+- }
+- s.changedFilesMu.Unlock()
+-
+- // This file has already been edited before.
+- if ok {
+- return nil
+- }
+-
+- // Ideally, we should be able to specify that a generated file should
+- // be opened as read-only. Tell the user that they should not be
+- // editing a generated file.
+- view, err := s.session.ViewOf(uri)
+- if err != nil {
+- return err
+- }
+- snapshot, release, err := view.Snapshot()
+- if err != nil {
+- return err
+- }
+- isGenerated := source.IsGenerated(ctx, snapshot, uri)
+- release()
+-
+- if !isGenerated {
+- return nil
+- }
+- return s.client.ShowMessage(ctx, &protocol.ShowMessageParams{
+- Message: fmt.Sprintf("Do not edit this file! %s is a generated file.", uri.Filename()),
+- Type: protocol.Warning,
+- })
+-}
+-
+-func (s *Server) didChangeWatchedFiles(ctx context.Context, params *protocol.DidChangeWatchedFilesParams) error {
+- var modifications []source.FileModification
+- for _, change := range params.Changes {
+- uri := change.URI.SpanURI()
+- if !uri.IsFile() {
+- continue
+- }
+- action := changeTypeToFileAction(change.Type)
+- modifications = append(modifications, source.FileModification{
+- URI: uri,
+- Action: action,
+- OnDisk: true,
+- })
+- }
+- return s.didModifyFiles(ctx, modifications, FromDidChangeWatchedFiles)
+-}
+-
+-func (s *Server) didSave(ctx context.Context, params *protocol.DidSaveTextDocumentParams) error {
+- uri := params.TextDocument.URI.SpanURI()
+- if !uri.IsFile() {
+- return nil
+- }
+- c := source.FileModification{
+- URI: uri,
+- Action: source.Save,
+- }
+- if params.Text != nil {
+- c.Text = []byte(*params.Text)
+- }
+- return s.didModifyFiles(ctx, []source.FileModification{c}, FromDidSave)
+-}
+-
+-func (s *Server) didClose(ctx context.Context, params *protocol.DidCloseTextDocumentParams) error {
+- uri := params.TextDocument.URI.SpanURI()
+- if !uri.IsFile() {
+- return nil
+- }
+- return s.didModifyFiles(ctx, []source.FileModification{
+- {
+- URI: uri,
+- Action: source.Close,
+- Version: -1,
+- Text: nil,
+- },
+- }, FromDidClose)
+-}
+-
+-func (s *Server) didModifyFiles(ctx context.Context, modifications []source.FileModification, cause ModificationSource) error {
+- // wg guards two conditions:
+- // 1. didModifyFiles is complete
+- // 2. the goroutine diagnosing changes on behalf of didModifyFiles is
+- // complete, if it was started
+- //
+- // Both conditions must be satisfied for the purpose of testing: we don't
+- // want to observe the completion of change processing until we have received
+- // all diagnostics as well as all server->client notifications done on behalf
+- // of this function.
+- var wg sync.WaitGroup
+- wg.Add(1)
+- defer wg.Done()
+-
+- if s.session.Options().VerboseWorkDoneProgress {
+- work := s.progress.Start(ctx, DiagnosticWorkTitle(cause), "Calculating file diagnostics...", nil, nil)
+- go func() {
+- wg.Wait()
+- work.End(ctx, "Done.")
+- }()
+- }
+-
+- onDisk := cause == FromDidChangeWatchedFiles
+-
+- s.stateMu.Lock()
+- if s.state >= serverShutDown {
+- // This state check does not prevent races below, and exists only to
+- // produce a better error message. The actual race to the cache should be
+- // guarded by Session.viewMu.
+- s.stateMu.Unlock()
+- return errors.New("server is shut down")
+- }
+- s.stateMu.Unlock()
+-
+- // If the set of changes included directories, expand those directories
+- // to their files.
+- modifications = s.session.ExpandModificationsToDirectories(ctx, modifications)
+-
+- // Build a lookup map for file modifications, so that we can later join
+- // with the snapshot file associations.
+- modMap := make(map[span.URI]source.FileModification)
+- for _, mod := range modifications {
+- modMap[mod.URI] = mod
+- }
+-
+- snapshots, release, err := s.session.DidModifyFiles(ctx, modifications)
+- if err != nil {
+- return err
+- }
+-
+- // golang/go#50267: diagnostics should be re-sent after an open or close. For
+- // some clients, it may be helpful to re-send after each change.
+- for snapshot, uris := range snapshots {
+- for _, uri := range uris {
+- mod := modMap[uri]
+- if snapshot.View().Options().ChattyDiagnostics || mod.Action == source.Open || mod.Action == source.Close {
+- s.mustPublishDiagnostics(uri)
+- }
+- }
+- }
+-
+- wg.Add(1)
+- go func() {
+- s.diagnoseSnapshots(snapshots, onDisk)
+- release()
+- wg.Done()
+- }()
+-
+- // After any file modifications, we need to update our watched files,
+- // in case something changed. Compute the new set of directories to watch,
+- // and if it differs from the current set, send updated registrations.
+- return s.updateWatchedDirectories(ctx)
+-}
+-
+-// DiagnosticWorkTitle returns the title of the diagnostic work resulting from a
+-// file change originating from the given cause.
+-func DiagnosticWorkTitle(cause ModificationSource) string {
+- return fmt.Sprintf("diagnosing %v", cause)
+-}
+-
+-func (s *Server) changedText(ctx context.Context, uri span.URI, changes []protocol.TextDocumentContentChangeEvent) ([]byte, error) {
+- if len(changes) == 0 {
+- return nil, fmt.Errorf("%w: no content changes provided", jsonrpc2.ErrInternal)
+- }
+-
+- // Check if the client sent the full content of the file.
+- // We accept a full content change even if the server expected incremental changes.
+- if len(changes) == 1 && changes[0].Range == nil && changes[0].RangeLength == 0 {
+- return []byte(changes[0].Text), nil
+- }
+- return s.applyIncrementalChanges(ctx, uri, changes)
+-}
+-
+-func (s *Server) applyIncrementalChanges(ctx context.Context, uri span.URI, changes []protocol.TextDocumentContentChangeEvent) ([]byte, error) {
+- fh, err := s.session.GetFile(ctx, uri)
+- if err != nil {
+- return nil, err
+- }
+- content, err := fh.Read()
+- if err != nil {
+- return nil, fmt.Errorf("%w: file not found (%v)", jsonrpc2.ErrInternal, err)
+- }
+- for _, change := range changes {
+- // TODO(adonovan): refactor to use diff.Apply, which is robust w.r.t.
+- // out-of-order or overlapping changes---and much more efficient.
+-
+- // Make sure to update mapper along with the content.
+- m := protocol.NewMapper(uri, content)
+- if change.Range == nil {
+- return nil, fmt.Errorf("%w: unexpected nil range for change", jsonrpc2.ErrInternal)
+- }
+- spn, err := m.RangeSpan(*change.Range)
+- if err != nil {
+- return nil, err
+- }
+- start, end := spn.Start().Offset(), spn.End().Offset()
+- if end < start {
+- return nil, fmt.Errorf("%w: invalid range for content change", jsonrpc2.ErrInternal)
+- }
+- var buf bytes.Buffer
+- buf.Write(content[:start])
+- buf.WriteString(change.Text)
+- buf.Write(content[end:])
+- content = buf.Bytes()
+- }
+- return content, nil
+-}
+-
+-func changeTypeToFileAction(ct protocol.FileChangeType) source.FileAction {
+- switch ct {
+- case protocol.Changed:
+- return source.Change
+- case protocol.Created:
+- return source.Create
+- case protocol.Deleted:
+- return source.Delete
+- }
+- return source.UnknownFileAction
+-}
+diff -urN a/gopls/internal/lsp/work/completion.go b/gopls/internal/lsp/work/completion.go
+--- a/gopls/internal/lsp/work/completion.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/work/completion.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,154 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package work
+-
+-import (
+- "context"
+- "errors"
+- "fmt"
+- "os"
+- "path/filepath"
+- "sort"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-func Completion(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle, position protocol.Position) (*protocol.CompletionList, error) {
+- ctx, done := event.Start(ctx, "work.Completion")
+- defer done()
+-
+- // Get the position of the cursor.
+- pw, err := snapshot.ParseWork(ctx, fh)
+- if err != nil {
+- return nil, fmt.Errorf("getting go.work file handle: %w", err)
+- }
+- cursor, err := pw.Mapper.PositionOffset(position)
+- if err != nil {
+- return nil, fmt.Errorf("computing cursor offset: %w", err)
+- }
+-
+- // Find the use statement the user is in.
+- use, pathStart, _ := usePath(pw, cursor)
+- if use == nil {
+- return &protocol.CompletionList{}, nil
+- }
+- completingFrom := use.Path[:cursor-pathStart]
+-
+- // We're going to find the completions of the user input
+- // (completingFrom) by doing a walk on the innermost directory
+- // of the given path, and comparing the found paths to make sure
+- // that they match the component of the path after the
+- // innermost directory.
+- //
+- // We'll maintain two paths when doing this: pathPrefixSlash
+- // is essentially the path the user typed in, and pathPrefixAbs
+- // is the path made absolute from the go.work directory.
+-
+- pathPrefixSlash := completingFrom
+- pathPrefixAbs := filepath.FromSlash(pathPrefixSlash)
+- if !filepath.IsAbs(pathPrefixAbs) {
+- pathPrefixAbs = filepath.Join(filepath.Dir(pw.URI.Filename()), pathPrefixAbs)
+- }
+-
+- // pathPrefixDir is the directory that will be walked to find matches.
+- // If pathPrefixSlash is not explicitly a directory boundary (is either equivalent to "." or
+- // ends in a separator) we need to examine its parent directory to find sibling files that
+- // match.
+- depthBound := 5
+- pathPrefixDir, pathPrefixBase := pathPrefixAbs, ""
+- pathPrefixSlashDir := pathPrefixSlash
+- if filepath.Clean(pathPrefixSlash) != "." && !strings.HasSuffix(pathPrefixSlash, "/") {
+- depthBound++
+- pathPrefixDir, pathPrefixBase = filepath.Split(pathPrefixAbs)
+- pathPrefixSlashDir = dirNonClean(pathPrefixSlash)
+- }
+-
+- var completions []string
+- // Stop traversing deeper once we've hit 10k files to try to stay generally under 100ms.
+- const numSeenBound = 10000
+- var numSeen int
+- stopWalking := errors.New("hit numSeenBound")
+- err = filepath.Walk(pathPrefixDir, func(wpath string, info os.FileInfo, err error) error {
+- if numSeen > numSeenBound {
+- // Stop traversing if we hit bound.
+- return stopWalking
+- }
+- numSeen++
+-
+- // rel is the path relative to pathPrefixDir.
+- // Make sure that it has pathPrefixBase as a prefix
+- // otherwise it won't match the beginning of the
+- // base component of the path the user typed in.
+- rel := strings.TrimPrefix(wpath[len(pathPrefixDir):], string(filepath.Separator))
+- if info.IsDir() && wpath != pathPrefixDir && !strings.HasPrefix(rel, pathPrefixBase) {
+- return filepath.SkipDir
+- }
+-
+- // Check for a match (a module directory).
+- if filepath.Base(rel) == "go.mod" {
+- relDir := strings.TrimSuffix(dirNonClean(rel), string(os.PathSeparator))
+- completionPath := join(pathPrefixSlashDir, filepath.ToSlash(relDir))
+-
+- if !strings.HasPrefix(completionPath, completingFrom) {
+- return nil
+- }
+- if strings.HasSuffix(completionPath, "/") {
+- // Don't suggest paths that end in "/". This happens
+- // when the input is a path that ends in "/" and
+- // the completion is empty.
+- return nil
+- }
+- completion := completionPath[len(completingFrom):]
+- if completingFrom == "" && !strings.HasPrefix(completion, "./") {
+- // Bias towards "./" prefixes.
+- completion = join(".", completion)
+- }
+-
+- completions = append(completions, completion)
+- }
+-
+- if depth := strings.Count(rel, string(filepath.Separator)); depth >= depthBound {
+- return filepath.SkipDir
+- }
+- return nil
+- })
+- if err != nil && !errors.Is(err, stopWalking) {
+- return nil, fmt.Errorf("walking to find completions: %w", err)
+- }
+-
+- sort.Strings(completions)
+-
+- var items []protocol.CompletionItem
+- for _, c := range completions {
+- items = append(items, protocol.CompletionItem{
+- Label: c,
+- InsertText: c,
+- })
+- }
+- return &protocol.CompletionList{Items: items}, nil
+-}
+-
+-// dirNonClean is filepath.Dir, without the Clean at the end.
+-func dirNonClean(path string) string {
+- vol := filepath.VolumeName(path)
+- i := len(path) - 1
+- for i >= len(vol) && !os.IsPathSeparator(path[i]) {
+- i--
+- }
+- return path[len(vol) : i+1]
+-}
+-
+-func join(a, b string) string {
+- if a == "" {
+- return b
+- }
+- if b == "" {
+- return a
+- }
+- return strings.TrimSuffix(a, "/") + "/" + b
+-}
+diff -urN a/gopls/internal/lsp/work/diagnostics.go b/gopls/internal/lsp/work/diagnostics.go
+--- a/gopls/internal/lsp/work/diagnostics.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/work/diagnostics.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,92 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package work
+-
+-import (
+- "context"
+- "fmt"
+- "os"
+- "path/filepath"
+-
+- "golang.org/x/mod/modfile"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-func Diagnostics(ctx context.Context, snapshot source.Snapshot) (map[span.URI][]*source.Diagnostic, error) {
+- ctx, done := event.Start(ctx, "work.Diagnostics", source.SnapshotLabels(snapshot)...)
+- defer done()
+-
+- reports := map[span.URI][]*source.Diagnostic{}
+- uri := snapshot.WorkFile()
+- if uri == "" {
+- return nil, nil
+- }
+- fh, err := snapshot.GetFile(ctx, uri)
+- if err != nil {
+- return nil, err
+- }
+- reports[fh.URI()] = []*source.Diagnostic{}
+- diagnostics, err := DiagnosticsForWork(ctx, snapshot, fh)
+- if err != nil {
+- return nil, err
+- }
+- for _, d := range diagnostics {
+- fh, err := snapshot.GetFile(ctx, d.URI)
+- if err != nil {
+- return nil, err
+- }
+- reports[fh.URI()] = append(reports[fh.URI()], d)
+- }
+-
+- return reports, nil
+-}
+-
+-func DiagnosticsForWork(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle) ([]*source.Diagnostic, error) {
+- pw, err := snapshot.ParseWork(ctx, fh)
+- if err != nil {
+- if pw == nil || len(pw.ParseErrors) == 0 {
+- return nil, err
+- }
+- return pw.ParseErrors, nil
+- }
+-
+- // Add diagnostic if a directory does not contain a module.
+- var diagnostics []*source.Diagnostic
+- for _, use := range pw.File.Use {
+- rng, err := pw.Mapper.OffsetRange(use.Syntax.Start.Byte, use.Syntax.End.Byte)
+- if err != nil {
+- return nil, err
+- }
+-
+- modfh, err := snapshot.GetFile(ctx, modFileURI(pw, use))
+- if err != nil {
+- return nil, err
+- }
+- if _, err := modfh.Read(); err != nil && os.IsNotExist(err) {
+- diagnostics = append(diagnostics, &source.Diagnostic{
+- URI: fh.URI(),
+- Range: rng,
+- Severity: protocol.SeverityError,
+- Source: source.WorkFileError,
+- Message: fmt.Sprintf("directory %v does not contain a module", use.Path),
+- })
+- }
+- }
+- return diagnostics, nil
+-}
+-
+-func modFileURI(pw *source.ParsedWorkFile, use *modfile.Use) span.URI {
+- workdir := filepath.Dir(pw.URI.Filename())
+-
+- modroot := filepath.FromSlash(use.Path)
+- if !filepath.IsAbs(modroot) {
+- modroot = filepath.Join(workdir, modroot)
+- }
+-
+- return span.URIFromPath(filepath.Join(modroot, "go.mod"))
+-}
+diff -urN a/gopls/internal/lsp/work/format.go b/gopls/internal/lsp/work/format.go
+--- a/gopls/internal/lsp/work/format.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/work/format.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,28 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package work
+-
+-import (
+- "context"
+-
+- "golang.org/x/mod/modfile"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-func Format(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle) ([]protocol.TextEdit, error) {
+- ctx, done := event.Start(ctx, "work.Format")
+- defer done()
+-
+- pw, err := snapshot.ParseWork(ctx, fh)
+- if err != nil {
+- return nil, err
+- }
+- formatted := modfile.Format(pw.File.Syntax)
+- // Calculate the edits to be made due to the change.
+- diffs := snapshot.View().Options().ComputeEdits(string(pw.Mapper.Content), string(formatted))
+- return source.ToProtocolEdits(pw.Mapper, diffs)
+-}
+diff -urN a/gopls/internal/lsp/work/hover.go b/gopls/internal/lsp/work/hover.go
+--- a/gopls/internal/lsp/work/hover.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/work/hover.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,89 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package work
+-
+-import (
+- "bytes"
+- "context"
+- "fmt"
+-
+- "golang.org/x/mod/modfile"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-func Hover(ctx context.Context, snapshot source.Snapshot, fh source.FileHandle, position protocol.Position) (*protocol.Hover, error) {
+- // We only provide hover information for the view's go.work file.
+- if fh.URI() != snapshot.WorkFile() {
+- return nil, nil
+- }
+-
+- ctx, done := event.Start(ctx, "work.Hover")
+- defer done()
+-
+- // Get the position of the cursor.
+- pw, err := snapshot.ParseWork(ctx, fh)
+- if err != nil {
+- return nil, fmt.Errorf("getting go.work file handle: %w", err)
+- }
+- offset, err := pw.Mapper.PositionOffset(position)
+- if err != nil {
+- return nil, fmt.Errorf("computing cursor offset: %w", err)
+- }
+-
+- // Confirm that the cursor is inside a use statement, and then find
+- // the position of the use statement's directory path.
+- use, pathStart, pathEnd := usePath(pw, offset)
+-
+- // The cursor position is not on a use statement.
+- if use == nil {
+- return nil, nil
+- }
+-
+- // Get the mod file denoted by the use.
+- modfh, err := snapshot.GetFile(ctx, modFileURI(pw, use))
+- if err != nil {
+- return nil, fmt.Errorf("getting modfile handle: %w", err)
+- }
+- pm, err := snapshot.ParseMod(ctx, modfh)
+- if err != nil {
+- return nil, fmt.Errorf("getting modfile handle: %w", err)
+- }
+- mod := pm.File.Module.Mod
+-
+- // Get the range to highlight for the hover.
+- rng, err := pw.Mapper.OffsetRange(pathStart, pathEnd)
+- if err != nil {
+- return nil, err
+- }
+- options := snapshot.View().Options()
+- return &protocol.Hover{
+- Contents: protocol.MarkupContent{
+- Kind: options.PreferredContentFormat,
+- Value: mod.Path,
+- },
+- Range: rng,
+- }, nil
+-}
+-
+-func usePath(pw *source.ParsedWorkFile, offset int) (use *modfile.Use, pathStart, pathEnd int) {
+- for _, u := range pw.File.Use {
+- path := []byte(u.Path)
+- s, e := u.Syntax.Start.Byte, u.Syntax.End.Byte
+- i := bytes.Index(pw.Mapper.Content[s:e], path)
+- if i == -1 {
+- // This should not happen.
+- continue
+- }
+- // Shift the start position to the location of the
+- // module directory within the use statement.
+- pathStart, pathEnd = s+i, s+i+len(path)
+- if pathStart <= offset && offset <= pathEnd {
+- return u, pathStart, pathEnd
+- }
+- }
+- return nil, 0, 0
+-}
+diff -urN a/gopls/internal/lsp/workspace.go b/gopls/internal/lsp/workspace.go
+--- a/gopls/internal/lsp/workspace.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/workspace.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,95 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+- "fmt"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-func (s *Server) didChangeWorkspaceFolders(ctx context.Context, params *protocol.DidChangeWorkspaceFoldersParams) error {
+- event := params.Event
+- for _, folder := range event.Removed {
+- view := s.session.View(folder.Name)
+- if view != nil {
+- s.session.RemoveView(view)
+- } else {
+- return fmt.Errorf("view %s for %v not found", folder.Name, folder.URI)
+- }
+- }
+- return s.addFolders(ctx, event.Added)
+-}
+-
+-// addView returns a Snapshot and a release function that must be
+-// called when it is no longer needed.
+-func (s *Server) addView(ctx context.Context, name string, uri span.URI) (source.Snapshot, func(), error) {
+- s.stateMu.Lock()
+- state := s.state
+- s.stateMu.Unlock()
+- if state < serverInitialized {
+- return nil, nil, fmt.Errorf("addView called before server initialized")
+- }
+- options := s.session.Options().Clone()
+- if err := s.fetchConfig(ctx, name, uri, options); err != nil {
+- return nil, nil, err
+- }
+- _, snapshot, release, err := s.session.NewView(ctx, name, uri, options)
+- return snapshot, release, err
+-}
+-
+-func (s *Server) didChangeConfiguration(ctx context.Context, _ *protocol.DidChangeConfigurationParams) error {
+- // Apply any changes to the session-level settings.
+- options := s.session.Options().Clone()
+- if err := s.fetchConfig(ctx, "", "", options); err != nil {
+- return err
+- }
+- s.session.SetOptions(options)
+-
+- // Go through each view, getting and updating its configuration.
+- for _, view := range s.session.Views() {
+- options := s.session.Options().Clone()
+- if err := s.fetchConfig(ctx, view.Name(), view.Folder(), options); err != nil {
+- return err
+- }
+- view, err := s.session.SetViewOptions(ctx, view, options)
+- if err != nil {
+- return err
+- }
+- go func() {
+- snapshot, release, err := view.Snapshot()
+- if err != nil {
+- return // view is shut down; no need to diagnose
+- }
+- defer release()
+- s.diagnoseDetached(snapshot)
+- }()
+- }
+-
+- // An options change may have affected the detected Go version.
+- s.checkViewGoVersions()
+-
+- return nil
+-}
+-
+-func semanticTokenRegistration(tokenTypes, tokenModifiers []string) protocol.Registration {
+- return protocol.Registration{
+- ID: "textDocument/semanticTokens",
+- Method: "textDocument/semanticTokens",
+- RegisterOptions: &protocol.SemanticTokensOptions{
+- Legend: protocol.SemanticTokensLegend{
+- // TODO(pjw): trim these to what we use (and an unused one
+- // at position 0 of TokTypes, to catch typos)
+- TokenTypes: tokenTypes,
+- TokenModifiers: tokenModifiers,
+- },
+- Full: &protocol.Or_SemanticTokensOptions_full{Value: true},
+- Range: &protocol.Or_SemanticTokensOptions_range{Value: true},
+- },
+- }
+-}
+diff -urN a/gopls/internal/lsp/workspace_symbol.go b/gopls/internal/lsp/workspace_symbol.go
+--- a/gopls/internal/lsp/workspace_symbol.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/lsp/workspace_symbol.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,32 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package lsp
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/event"
+-)
+-
+-func (s *Server) symbol(ctx context.Context, params *protocol.WorkspaceSymbolParams) ([]protocol.SymbolInformation, error) {
+- ctx, done := event.Start(ctx, "lsp.Server.symbol")
+- defer done()
+-
+- views := s.session.Views()
+- matcher := s.session.Options().SymbolMatcher
+- style := s.session.Options().SymbolStyle
+- // TODO(rfindley): it looks wrong that we need to pass views here.
+- //
+- // Evidence:
+- // - this is the only place we convert views to []source.View
+- // - workspace symbols is the only place where we call source.View.Snapshot
+- var sourceViews []source.View
+- for _, v := range views {
+- sourceViews = append(sourceViews, v)
+- }
+- return source.WorkspaceSymbols(ctx, matcher, style, sourceViews, params.Query)
+-}
+diff -urN a/gopls/internal/regtest/bench/bench_test.go b/gopls/internal/regtest/bench/bench_test.go
+--- a/gopls/internal/regtest/bench/bench_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/bench/bench_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,249 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package bench
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+- "io/ioutil"
+- "log"
+- "os"
+- "os/exec"
+- "path/filepath"
+- "sync"
+- "testing"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/hooks"
+- "golang.org/x/tools/gopls/internal/lsp/cmd"
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/event"
+- "golang.org/x/tools/internal/fakenet"
+- "golang.org/x/tools/internal/jsonrpc2"
+- "golang.org/x/tools/internal/jsonrpc2/servertest"
+- "golang.org/x/tools/internal/tool"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-var (
+- goplsPath = flag.String("gopls_path", "", "if set, use this gopls for testing; incompatible with -gopls_commit")
+-
+- installGoplsOnce sync.Once // guards installing gopls at -gopls_commit
+- goplsCommit = flag.String("gopls_commit", "", "if set, install and use gopls at this commit for testing; incompatible with -gopls_path")
+-
+- cpuProfile = flag.String("gopls_cpuprofile", "", "if set, the cpu profile file suffix; see \"Profiling\" in the package doc")
+- memProfile = flag.String("gopls_memprofile", "", "if set, the mem profile file suffix; see \"Profiling\" in the package doc")
+- trace = flag.String("gopls_trace", "", "if set, the trace file suffix; see \"Profiling\" in the package doc")
+-
+- // If non-empty, tempDir is a temporary working dir that was created by this
+- // test suite.
+- makeTempDirOnce sync.Once // guards creation of the temp dir
+- tempDir string
+-)
+-
+-// if runAsGopls is "true", run the gopls command instead of the testing.M.
+-const runAsGopls = "_GOPLS_BENCH_RUN_AS_GOPLS"
+-
+-func TestMain(m *testing.M) {
+- bug.PanicOnBugs = true
+- if os.Getenv(runAsGopls) == "true" {
+- tool.Main(context.Background(), cmd.New("gopls", "", nil, hooks.Options), os.Args[1:])
+- os.Exit(0)
+- }
+- event.SetExporter(nil) // don't log to stderr
+- code := m.Run()
+- if err := cleanup(); err != nil {
+- fmt.Fprintf(os.Stderr, "cleaning up after benchmarks: %v\n", err)
+- if code == 0 {
+- code = 1
+- }
+- }
+- os.Exit(code)
+-}
+-
+-// getTempDir returns the temporary directory to use for benchmark files,
+-// creating it if necessary.
+-func getTempDir() string {
+- makeTempDirOnce.Do(func() {
+- var err error
+- tempDir, err = ioutil.TempDir("", "gopls-bench")
+- if err != nil {
+- log.Fatal(err)
+- }
+- })
+- return tempDir
+-}
+-
+-// shallowClone performs a shallow clone of repo into dir at the given
+-// 'commitish' ref (any commit reference understood by git).
+-//
+-// The directory dir must not already exist.
+-func shallowClone(dir, repo, commitish string) error {
+- if err := os.Mkdir(dir, 0750); err != nil {
+- return fmt.Errorf("creating dir for %s: %v", repo, err)
+- }
+-
+- // Set a timeout for git fetch. If this proves flaky, it can be removed.
+- ctx, cancel := context.WithTimeout(context.Background(), 1*time.Minute)
+- defer cancel()
+-
+- // Use a shallow fetch to download just the relevant commit.
+- shInit := fmt.Sprintf("git init && git fetch --depth=1 %q %q && git checkout FETCH_HEAD", repo, commitish)
+- initCmd := exec.CommandContext(ctx, "/bin/sh", "-c", shInit)
+- initCmd.Dir = dir
+- if output, err := initCmd.CombinedOutput(); err != nil {
+- return fmt.Errorf("checking out %s: %v\n%s", repo, err, output)
+- }
+- return nil
+-}
+-
+-// connectEditor connects a fake editor session in the given dir, using the
+-// given editor config.
+-func connectEditor(dir string, config fake.EditorConfig, ts servertest.Connector) (*fake.Sandbox, *fake.Editor, *Awaiter, error) {
+- s, err := fake.NewSandbox(&fake.SandboxConfig{
+- Workdir: dir,
+- GOPROXY: "https://proxy.golang.org",
+- })
+- if err != nil {
+- return nil, nil, nil, err
+- }
+-
+- a := NewAwaiter(s.Workdir)
+- const skipApplyEdits = false
+- editor, err := fake.NewEditor(s, config).Connect(context.Background(), ts, a.Hooks(), skipApplyEdits)
+- if err != nil {
+- return nil, nil, nil, err
+- }
+-
+- return s, editor, a, nil
+-}
+-
+-// newGoplsServer returns a connector that connects to a new gopls process.
+-func newGoplsServer(name string) (servertest.Connector, error) {
+- if *goplsPath != "" && *goplsCommit != "" {
+- panic("can't set both -gopls_path and -gopls_commit")
+- }
+- var (
+- goplsPath = *goplsPath
+- env []string
+- )
+- if *goplsCommit != "" {
+- goplsPath = getInstalledGopls()
+- }
+- if goplsPath == "" {
+- var err error
+- goplsPath, err = os.Executable()
+- if err != nil {
+- return nil, err
+- }
+- env = []string{fmt.Sprintf("%s=true", runAsGopls)}
+- }
+- var args []string
+- if *cpuProfile != "" {
+- args = append(args, fmt.Sprintf("-profile.cpu=%s", name+"."+*cpuProfile))
+- }
+- if *memProfile != "" {
+- args = append(args, fmt.Sprintf("-profile.mem=%s", name+"."+*memProfile))
+- }
+- if *trace != "" {
+- args = append(args, fmt.Sprintf("-profile.trace=%s", name+"."+*trace))
+- }
+- return &SidecarServer{
+- goplsPath: goplsPath,
+- env: env,
+- args: args,
+- }, nil
+-}
+-
+-// getInstalledGopls builds gopls at the given -gopls_commit, returning the
+-// path to the gopls binary.
+-func getInstalledGopls() string {
+- if *goplsCommit == "" {
+- panic("must provide -gopls_commit")
+- }
+- toolsDir := filepath.Join(getTempDir(), "gopls_build")
+- goplsPath := filepath.Join(toolsDir, "gopls", "gopls")
+-
+- installGoplsOnce.Do(func() {
+- log.Printf("installing gopls: checking out x/tools@%s into %s\n", *goplsCommit, toolsDir)
+- if err := shallowClone(toolsDir, "https://go.googlesource.com/tools", *goplsCommit); err != nil {
+- log.Fatal(err)
+- }
+-
+- log.Println("installing gopls: building...")
+- bld := exec.Command("go", "build", ".")
+- bld.Dir = filepath.Join(toolsDir, "gopls")
+- if output, err := bld.CombinedOutput(); err != nil {
+- log.Fatalf("building gopls: %v\n%s", err, output)
+- }
+-
+- // Confirm that the resulting path now exists.
+- if _, err := os.Stat(goplsPath); err != nil {
+- log.Fatalf("os.Stat(%s): %v", goplsPath, err)
+- }
+- })
+- return goplsPath
+-}
+-
+-// A SidecarServer starts (and connects to) a separate gopls process at the
+-// given path.
+-type SidecarServer struct {
+- goplsPath string
+- env []string // additional environment bindings
+- args []string // command-line arguments
+-}
+-
+-// Connect creates new io.Pipes and binds them to the underlying StreamServer.
+-//
+-// It implements the servertest.Connector interface.
+-func (s *SidecarServer) Connect(ctx context.Context) jsonrpc2.Conn {
+- // Note: don't use CommandContext here, as we want gopls to exit gracefully
+- // in order to write out profile data.
+- //
+- // We close the connection on context cancelation below.
+- cmd := exec.Command(s.goplsPath, s.args...)
+-
+- stdin, err := cmd.StdinPipe()
+- if err != nil {
+- log.Fatal(err)
+- }
+- stdout, err := cmd.StdoutPipe()
+- if err != nil {
+- log.Fatal(err)
+- }
+- cmd.Stderr = os.Stderr
+- cmd.Env = append(os.Environ(), s.env...)
+- if err := cmd.Start(); err != nil {
+- log.Fatalf("starting gopls: %v", err)
+- }
+-
+- go func() {
+- // If we don't log.Fatal here, benchmarks may hang indefinitely if gopls
+- // exits abnormally.
+- //
+- // TODO(rfindley): ideally we would shut down the connection gracefully,
+- // but that doesn't currently work.
+- if err := cmd.Wait(); err != nil {
+- log.Fatalf("gopls invocation failed with error: %v", err)
+- }
+- }()
+-
+- clientStream := jsonrpc2.NewHeaderStream(fakenet.NewConn("stdio", stdout, stdin))
+- clientConn := jsonrpc2.NewConn(clientStream)
+-
+- go func() {
+- select {
+- case <-ctx.Done():
+- clientConn.Close()
+- clientStream.Close()
+- case <-clientConn.Done():
+- }
+- }()
+-
+- return clientConn
+-}
+diff -urN a/gopls/internal/regtest/bench/completion_test.go b/gopls/internal/regtest/bench/completion_test.go
+--- a/gopls/internal/regtest/bench/completion_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/bench/completion_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,173 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package bench
+-
+-import (
+- "fmt"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-// TODO(rfindley): update these completion tests to run on multiple repos.
+-
+-type completionBenchOptions struct {
+- file, locationRegexp string
+-
+- // Hooks to run edits before initial completion
+- setup func(*Env) // run before the benchmark starts
+- beforeCompletion func(*Env) // run before each completion
+-}
+-
+-func benchmarkCompletion(options completionBenchOptions, b *testing.B) {
+- repo := getRepo(b, "tools")
+- env := repo.newEnv(b, "completion.tools", fake.EditorConfig{})
+- defer env.Close()
+-
+- // Run edits required for this completion.
+- if options.setup != nil {
+- options.setup(env)
+- }
+-
+- // Run a completion to make sure the system is warm.
+- loc := env.RegexpSearch(options.file, options.locationRegexp)
+- completions := env.Completion(loc)
+-
+- if testing.Verbose() {
+- fmt.Println("Results:")
+- for i := 0; i < len(completions.Items); i++ {
+- fmt.Printf("\t%d. %v\n", i, completions.Items[i])
+- }
+- }
+-
+- b.Run("tools", func(b *testing.B) {
+- for i := 0; i < b.N; i++ {
+- if options.beforeCompletion != nil {
+- options.beforeCompletion(env)
+- }
+- env.Completion(loc)
+- }
+- })
+-}
+-
+-// endRangeInBuffer returns the position for last character in the buffer for
+-// the given file.
+-func endRangeInBuffer(env *Env, name string) protocol.Range {
+- buffer := env.BufferText(name)
+- m := protocol.NewMapper("", []byte(buffer))
+- rng, err := m.OffsetRange(len(buffer), len(buffer))
+- if err != nil {
+- env.T.Fatal(err)
+- }
+- return rng
+-}
+-
+-// Benchmark struct completion in tools codebase.
+-func BenchmarkStructCompletion(b *testing.B) {
+- file := "internal/lsp/cache/session.go"
+-
+- setup := func(env *Env) {
+- env.OpenFile(file)
+- env.EditBuffer(file, protocol.TextEdit{
+- Range: endRangeInBuffer(env, file),
+- NewText: "\nvar testVariable map[string]bool = Session{}.\n",
+- })
+- }
+-
+- benchmarkCompletion(completionBenchOptions{
+- file: file,
+- locationRegexp: `var testVariable map\[string\]bool = Session{}(\.)`,
+- setup: setup,
+- }, b)
+-}
+-
+-// Benchmark import completion in tools codebase.
+-func BenchmarkImportCompletion(b *testing.B) {
+- const file = "internal/lsp/source/completion/completion.go"
+- benchmarkCompletion(completionBenchOptions{
+- file: file,
+- locationRegexp: `go\/()`,
+- setup: func(env *Env) { env.OpenFile(file) },
+- }, b)
+-}
+-
+-// Benchmark slice completion in tools codebase.
+-func BenchmarkSliceCompletion(b *testing.B) {
+- file := "internal/lsp/cache/session.go"
+-
+- setup := func(env *Env) {
+- env.OpenFile(file)
+- env.EditBuffer(file, protocol.TextEdit{
+- Range: endRangeInBuffer(env, file),
+- NewText: "\nvar testVariable []byte = \n",
+- })
+- }
+-
+- benchmarkCompletion(completionBenchOptions{
+- file: file,
+- locationRegexp: `var testVariable \[\]byte (=)`,
+- setup: setup,
+- }, b)
+-}
+-
+-// Benchmark deep completion in function call in tools codebase.
+-func BenchmarkFuncDeepCompletion(b *testing.B) {
+- file := "internal/lsp/source/completion/completion.go"
+- fileContent := `
+-func (c *completer) _() {
+- c.inference.kindMatches(c.)
+-}
+-`
+- setup := func(env *Env) {
+- env.OpenFile(file)
+- originalBuffer := env.BufferText(file)
+- env.EditBuffer(file, protocol.TextEdit{
+- Range: endRangeInBuffer(env, file),
+- NewText: originalBuffer + fileContent,
+- })
+- }
+-
+- benchmarkCompletion(completionBenchOptions{
+- file: file,
+- locationRegexp: `func \(c \*completer\) _\(\) {\n\tc\.inference\.kindMatches\((c)`,
+- setup: setup,
+- }, b)
+-}
+-
+-// Benchmark completion following an arbitrary edit.
+-//
+-// Edits force type-checked packages to be invalidated, so we want to measure
+-// how long it takes before completion results are available.
+-func BenchmarkCompletionFollowingEdit(b *testing.B) {
+- file := "internal/lsp/source/completion/completion2.go"
+- fileContent := `
+-package completion
+-
+-func (c *completer) _() {
+- c.inference.kindMatches(c.)
+- // __MAGIC_STRING_1
+-}
+-`
+- setup := func(env *Env) {
+- env.CreateBuffer(file, fileContent)
+- }
+-
+- n := 1
+- beforeCompletion := func(env *Env) {
+- old := fmt.Sprintf("__MAGIC_STRING_%d", n)
+- new := fmt.Sprintf("__MAGIC_STRING_%d", n+1)
+- n++
+- env.RegexpReplace(file, old, new)
+- }
+-
+- benchmarkCompletion(completionBenchOptions{
+- file: file,
+- locationRegexp: `func \(c \*completer\) _\(\) {\n\tc\.inference\.kindMatches\((c)`,
+- setup: setup,
+- beforeCompletion: beforeCompletion,
+- }, b)
+-}
+diff -urN a/gopls/internal/regtest/bench/definition_test.go b/gopls/internal/regtest/bench/definition_test.go
+--- a/gopls/internal/regtest/bench/definition_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/bench/definition_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,39 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package bench
+-
+-import (
+- "testing"
+-)
+-
+-func BenchmarkDefinition(b *testing.B) {
+- tests := []struct {
+- repo string
+- file string
+- regexp string
+- }{
+- {"istio", "pkg/config/model.go", `gogotypes\.(MarshalAny)`},
+- {"kubernetes", "pkg/controller/lookup_cache.go", `hashutil\.(DeepHashObject)`},
+- {"kuma", "api/generic/insights.go", `proto\.(Message)`},
+- {"pkgsite", "internal/log/log.go", `derrors\.(Wrap)`},
+- {"starlark", "starlark/eval.go", "prog.compiled.(Encode)"},
+- {"tools", "internal/lsp/cache/check.go", `(snapshot)\) buildKey`},
+- }
+-
+- for _, test := range tests {
+- b.Run(test.repo, func(b *testing.B) {
+- env := getRepo(b, test.repo).sharedEnv(b)
+- env.OpenFile(test.file)
+- loc := env.RegexpSearch(test.file, test.regexp)
+- env.Await(env.DoneWithOpen())
+- env.GoToDefinition(loc) // pre-warm the query, and open the target file
+- b.ResetTimer()
+-
+- for i := 0; i < b.N; i++ {
+- env.GoToDefinition(loc) // pre-warm the query
+- }
+- })
+- }
+-}
+diff -urN a/gopls/internal/regtest/bench/didchange_test.go b/gopls/internal/regtest/bench/didchange_test.go
+--- a/gopls/internal/regtest/bench/didchange_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/bench/didchange_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,99 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package bench
+-
+-import (
+- "fmt"
+- "sync/atomic"
+- "testing"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-// Use a global edit counter as bench function may execute multiple times, and
+-// we want to avoid cache hits. Use time.Now to also avoid cache hits from the
+-// shared file cache.
+-var editID int64 = time.Now().UnixNano()
+-
+-var didChangeTests = []struct {
+- repo string
+- file string
+-}{
+- {"istio", "pkg/fuzz/util.go"},
+- {"kubernetes", "pkg/controller/lookup_cache.go"},
+- {"kuma", "api/generic/insights.go"},
+- {"pkgsite", "internal/frontend/server.go"},
+- {"starlark", "starlark/eval.go"},
+- {"tools", "internal/lsp/cache/snapshot.go"},
+-}
+-
+-// BenchmarkDidChange benchmarks modifications of a single file by making
+-// synthetic modifications in a comment. It controls pacing by waiting for the
+-// server to actually start processing the didChange notification before
+-// proceeding. Notably it does not wait for diagnostics to complete.
+-func BenchmarkDidChange(b *testing.B) {
+- for _, test := range didChangeTests {
+- b.Run(test.repo, func(b *testing.B) {
+- env := getRepo(b, test.repo).sharedEnv(b)
+- env.OpenFile(test.file)
+- // Insert the text we'll be modifying at the top of the file.
+- env.EditBuffer(test.file, protocol.TextEdit{NewText: "// __REGTEST_PLACEHOLDER_0__\n"})
+- env.AfterChange()
+- b.ResetTimer()
+-
+- for i := 0; i < b.N; i++ {
+- edits := atomic.AddInt64(&editID, 1)
+- env.EditBuffer(test.file, protocol.TextEdit{
+- Range: protocol.Range{
+- Start: protocol.Position{Line: 0, Character: 0},
+- End: protocol.Position{Line: 1, Character: 0},
+- },
+- // Increment the placeholder text, to ensure cache misses.
+- NewText: fmt.Sprintf("// __REGTEST_PLACEHOLDER_%d__\n", edits),
+- })
+- env.Await(env.StartedChange())
+- }
+- })
+- }
+-}
+-
+-func BenchmarkDiagnoseChange(b *testing.B) {
+- for _, test := range didChangeTests {
+- b.Run(test.repo, func(b *testing.B) {
+- // Use a new env to avoid the diagnostic delay: we want to measure how
+- // long it takes to produce the diagnostics.
+- env := repos[test.repo].newEnv(b, "diagnoseChange", fake.EditorConfig{
+- Settings: map[string]interface{}{
+- "diagnosticsDelay": "0s",
+- },
+- })
+- env.OpenFile(test.file)
+- // Insert the text we'll be modifying at the top of the file.
+- env.EditBuffer(test.file, protocol.TextEdit{NewText: "// __REGTEST_PLACEHOLDER_0__\n"})
+- env.AfterChange()
+- b.ResetTimer()
+-
+- // We must use an extra subtest layer here, so that we only set up the
+- // shared env once (otherwise we pay additional overhead and the profiling
+- // flags don't work).
+- b.Run("diagnose", func(b *testing.B) {
+- for i := 0; i < b.N; i++ {
+- edits := atomic.AddInt64(&editID, 1)
+- env.EditBuffer(test.file, protocol.TextEdit{
+- Range: protocol.Range{
+- Start: protocol.Position{Line: 0, Character: 0},
+- End: protocol.Position{Line: 1, Character: 0},
+- },
+- // Increment the placeholder text, to ensure cache misses.
+- NewText: fmt.Sprintf("// __REGTEST_PLACEHOLDER_%d__\n", edits),
+- })
+- env.AfterChange()
+- }
+- })
+- })
+- }
+-}
+diff -urN a/gopls/internal/regtest/bench/doc.go b/gopls/internal/regtest/bench/doc.go
+--- a/gopls/internal/regtest/bench/doc.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/bench/doc.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,33 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// The bench package implements benchmarks for various LSP operations.
+-//
+-// Benchmarks check out specific commits of popular and/or exemplary
+-// repositories, and script an external gopls process via a fake text editor.
+-// By default, benchmarks run the test executable as gopls (using a special
+-// "gopls mode" environment variable). A different gopls binary may be used by
+-// setting the -gopls_path or -gopls_commit flags.
+-//
+-// This package is a work in progress.
+-//
+-// # Profiling
+-//
+-// As benchmark functions run gopls in a separate process, the normal test
+-// flags for profiling are not useful. Instead the -gopls_cpuprofile,
+-// -gopls_memprofile, and -gopls_trace flags may be used to pass through
+-// profiling flags to the gopls process. Each of these flags sets a suffix
+-// for the respective gopls profiling flag, which is prefixed with a name
+-// corresponding to the shared repository or (in some cases) benchmark name.
+-// For example, settings -gopls_cpuprofile=cpu.out will result in profiles
+-// named tools.cpu.out, BenchmarkInitialWorkspaceLoad.cpu.out, etc. Here,
+-// tools.cpu.out is the cpu profile for the shared x/tools session, which may
+-// be used by multiple benchmark functions, and BenchmarkInitialWorkspaceLoad
+-// is the cpu profile for the last iteration of the initial workspace load
+-// test, which starts a new editor session for each iteration.
+-//
+-// # TODO
+-// - add more benchmarks, and more repositories
+-// - improve this documentation
+-package bench
+diff -urN a/gopls/internal/regtest/bench/hover_test.go b/gopls/internal/regtest/bench/hover_test.go
+--- a/gopls/internal/regtest/bench/hover_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/bench/hover_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,39 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package bench
+-
+-import (
+- "testing"
+-)
+-
+-func BenchmarkHover(b *testing.B) {
+- tests := []struct {
+- repo string
+- file string
+- regexp string
+- }{
+- {"istio", "pkg/config/model.go", `gogotypes\.(MarshalAny)`},
+- {"kubernetes", "pkg/apis/core/types.go", "type (Pod)"},
+- {"kuma", "api/generic/insights.go", `proto\.(Message)`},
+- {"pkgsite", "internal/log/log.go", `derrors\.(Wrap)`},
+- {"starlark", "starlark/eval.go", "prog.compiled.(Encode)"},
+- {"tools", "internal/lsp/cache/check.go", `(snapshot)\) buildKey`},
+- }
+-
+- for _, test := range tests {
+- b.Run(test.repo, func(b *testing.B) {
+- env := getRepo(b, test.repo).sharedEnv(b)
+- env.OpenFile(test.file)
+- loc := env.RegexpSearch(test.file, test.regexp)
+- env.Await(env.DoneWithOpen())
+- env.Hover(loc) // pre-warm the query
+- b.ResetTimer()
+-
+- for i := 0; i < b.N; i++ {
+- env.Hover(loc) // pre-warm the query
+- }
+- })
+- }
+-}
+diff -urN a/gopls/internal/regtest/bench/implementations_test.go b/gopls/internal/regtest/bench/implementations_test.go
+--- a/gopls/internal/regtest/bench/implementations_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/bench/implementations_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,37 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package bench
+-
+-import "testing"
+-
+-func BenchmarkImplementations(b *testing.B) {
+- tests := []struct {
+- repo string
+- file string
+- regexp string
+- }{
+- {"istio", "pkg/config/mesh/watcher.go", `type (Watcher)`},
+- {"kubernetes", "pkg/controller/lookup_cache.go", `objectWithMeta`},
+- {"kuma", "api/generic/insights.go", `type (Insight)`},
+- {"pkgsite", "internal/datasource.go", `type (DataSource)`},
+- {"starlark", "syntax/syntax.go", `type (Expr)`},
+- {"tools", "internal/lsp/source/view.go", `type (Snapshot)`},
+- }
+-
+- for _, test := range tests {
+- b.Run(test.repo, func(b *testing.B) {
+- env := getRepo(b, test.repo).sharedEnv(b)
+- env.OpenFile(test.file)
+- loc := env.RegexpSearch(test.file, test.regexp)
+- env.Await(env.DoneWithOpen())
+- env.Implementations(loc) // pre-warm the query
+- b.ResetTimer()
+-
+- for i := 0; i < b.N; i++ {
+- env.Implementations(loc)
+- }
+- })
+- }
+-}
+diff -urN a/gopls/internal/regtest/bench/iwl_test.go b/gopls/internal/regtest/bench/iwl_test.go
+--- a/gopls/internal/regtest/bench/iwl_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/bench/iwl_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,77 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package bench
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-// BenchmarkInitialWorkspaceLoad benchmarks the initial workspace load time for
+-// a new editing session.
+-func BenchmarkInitialWorkspaceLoad(b *testing.B) {
+- if testing.Short() {
+- // TODO(rfindley): remove this skip once the released gopls version
+- // supports the memstats command.
+- b.Skip("temporarily skipping as baseline gopls versions do not support the memstats command")
+- }
+- tests := []struct {
+- repo string
+- file string
+- }{
+- {"tools", "internal/lsp/cache/snapshot.go"},
+- {"kubernetes", "pkg/controller/lookup_cache.go"},
+- {"pkgsite", "internal/frontend/server.go"},
+- {"starlark", "starlark/eval.go"},
+- {"istio", "pkg/fuzz/util.go"},
+- {"kuma", "api/generic/insights.go"},
+- }
+-
+- for _, test := range tests {
+- b.Run(test.repo, func(b *testing.B) {
+- repo := getRepo(b, test.repo)
+- // get the (initialized) shared env to ensure the cache is warm.
+- // Reuse its GOPATH so that we get cache hits for things in the module
+- // cache.
+- sharedEnv := repo.sharedEnv(b)
+- b.ResetTimer()
+-
+- for i := 0; i < b.N; i++ {
+- doIWL(b, sharedEnv.Sandbox.GOPATH(), repo, test.file)
+- }
+- })
+- }
+-}
+-
+-func doIWL(b *testing.B, gopath string, repo *repo, file string) {
+- // Exclude the time to set up the env from the benchmark time, as this may
+- // involve installing gopls and/or checking out the repo dir.
+- b.StopTimer()
+- config := fake.EditorConfig{Env: map[string]string{"GOPATH": gopath}}
+- env := repo.newEnv(b, "iwl."+repo.name, config)
+- defer env.Close()
+- b.StartTimer()
+-
+- // Open an arbitrary file to ensure that gopls starts working.
+- //
+- // In the future, this may matter if gopls doesn't eagerly construct
+- // the workspace.
+- env.OpenFile(file)
+-
+- env.Await(InitialWorkspaceLoad)
+- b.StopTimer()
+- params := &protocol.ExecuteCommandParams{
+- Command: command.MemStats.ID(),
+- }
+- var memstats command.MemStatsResult
+- env.ExecuteCommand(params, &memstats)
+- b.ReportMetric(float64(memstats.HeapAlloc), "alloc_bytes")
+- b.ReportMetric(float64(memstats.HeapInUse), "in_use_bytes")
+- b.StartTimer()
+-}
+diff -urN a/gopls/internal/regtest/bench/references_test.go b/gopls/internal/regtest/bench/references_test.go
+--- a/gopls/internal/regtest/bench/references_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/bench/references_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,37 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package bench
+-
+-import "testing"
+-
+-func BenchmarkReferences(b *testing.B) {
+- tests := []struct {
+- repo string
+- file string
+- regexp string
+- }{
+- {"istio", "pkg/config/model.go", "type (Meta)"},
+- {"kubernetes", "pkg/controller/lookup_cache.go", "type (objectWithMeta)"},
+- {"kuma", "pkg/events/interfaces.go", "type (Event)"},
+- {"pkgsite", "internal/log/log.go", "func (Infof)"},
+- {"starlark", "syntax/syntax.go", "type (Ident)"},
+- {"tools", "internal/lsp/source/view.go", "type (Snapshot)"},
+- }
+-
+- for _, test := range tests {
+- b.Run(test.repo, func(b *testing.B) {
+- env := getRepo(b, test.repo).sharedEnv(b)
+- env.OpenFile(test.file)
+- loc := env.RegexpSearch(test.file, test.regexp)
+- env.Await(env.DoneWithOpen())
+- env.References(loc) // pre-warm the query
+- b.ResetTimer()
+-
+- for i := 0; i < b.N; i++ {
+- env.References(loc)
+- }
+- })
+- }
+-}
+diff -urN a/gopls/internal/regtest/bench/rename_test.go b/gopls/internal/regtest/bench/rename_test.go
+--- a/gopls/internal/regtest/bench/rename_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/bench/rename_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,44 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package bench
+-
+-import (
+- "fmt"
+- "testing"
+-)
+-
+-func BenchmarkRename(b *testing.B) {
+- tests := []struct {
+- repo string
+- file string
+- regexp string
+- baseName string
+- }{
+- {"kubernetes", "pkg/controller/lookup_cache.go", `hashutil\.(DeepHashObject)`, "DeepHashObject"},
+- {"kuma", "pkg/events/interfaces.go", `Delete`, "Delete"},
+- {"istio", "pkg/config/model.go", `(Namespace) string`, "Namespace"},
+- {"pkgsite", "internal/log/log.go", `func (Infof)`, "Infof"},
+- {"starlark", "starlark/eval.go", `Program\) (Filename)`, "Filename"},
+- {"tools", "internal/lsp/cache/snapshot.go", `meta \*(metadataGraph)`, "metadataGraph"},
+- }
+-
+- for _, test := range tests {
+- names := 0 // bench function may execute multiple times
+- b.Run(test.repo, func(b *testing.B) {
+- env := getRepo(b, test.repo).sharedEnv(b)
+- env.OpenFile(test.file)
+- loc := env.RegexpSearch(test.file, test.regexp)
+- env.Await(env.DoneWithOpen())
+- env.Rename(loc, test.baseName+"X") // pre-warm the query
+- b.ResetTimer()
+-
+- for i := 0; i < b.N; i++ {
+- names++
+- newName := fmt.Sprintf("%s%d", test.baseName, names)
+- env.Rename(loc, newName)
+- }
+- })
+- }
+-}
+diff -urN a/gopls/internal/regtest/bench/repo_test.go b/gopls/internal/regtest/bench/repo_test.go
+--- a/gopls/internal/regtest/bench/repo_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/bench/repo_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,231 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package bench
+-
+-import (
+- "bytes"
+- "context"
+- "errors"
+- "fmt"
+- "log"
+- "os"
+- "path/filepath"
+- "sync"
+- "testing"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-// repos holds shared repositories for use in benchmarks.
+-//
+-// These repos were selected to represent a variety of different types of
+-// codebases.
+-var repos = map[string]*repo{
+- // Used by x/benchmarks; large.
+- "istio": {
+- name: "istio",
+- url: "https://github.com/istio/istio",
+- commit: "1.17.0",
+- },
+-
+- // Kubernetes is a large repo with many dependencies, and in the past has
+- // been about as large a repo as gopls could handle.
+- "kubernetes": {
+- name: "kubernetes",
+- url: "https://github.com/kubernetes/kubernetes",
+- commit: "v1.24.0",
+- },
+-
+- // A large, industrial application.
+- "kuma": {
+- name: "kuma",
+- url: "https://github.com/kumahq/kuma",
+- commit: "2.1.1",
+- },
+-
+- // x/pkgsite is familiar and represents a common use case (a webserver). It
+- // also has a number of static non-go files and template files.
+- "pkgsite": {
+- name: "pkgsite",
+- url: "https://go.googlesource.com/pkgsite",
+- commit: "81f6f8d4175ad0bf6feaa03543cc433f8b04b19b",
+- short: true,
+- },
+-
+- // A tiny self-contained project.
+- "starlark": {
+- name: "starlark",
+- url: "https://github.com/google/starlark-go",
+- commit: "3f75dec8e4039385901a30981e3703470d77e027",
+- short: true,
+- },
+-
+- // The current repository, which is medium-small and has very few dependencies.
+- "tools": {
+- name: "tools",
+- url: "https://go.googlesource.com/tools",
+- commit: "gopls/v0.9.0",
+- short: true,
+- },
+-}
+-
+-// getRepo gets the requested repo, and skips the test if -short is set and
+-// repo is not configured as a short repo.
+-func getRepo(tb testing.TB, name string) *repo {
+- tb.Helper()
+- repo := repos[name]
+- if repo == nil {
+- tb.Fatalf("repo %s does not exist", name)
+- }
+- if !repo.short && testing.Short() {
+- tb.Skipf("large repo %s does not run whith -short", repo.name)
+- }
+- return repo
+-}
+-
+-// A repo represents a working directory for a repository checked out at a
+-// specific commit.
+-//
+-// Repos are used for sharing state across benchmarks that operate on the same
+-// codebase.
+-type repo struct {
+- // static configuration
+- name string // must be unique, used for subdirectory
+- url string // repo url
+- commit string // full commit hash or tag
+- short bool // whether this repo runs with -short
+-
+- dirOnce sync.Once
+- dir string // directory contaning source code checked out to url@commit
+-
+- // shared editor state
+- editorOnce sync.Once
+- editor *fake.Editor
+- sandbox *fake.Sandbox
+- awaiter *Awaiter
+-}
+-
+-// getDir returns directory containing repo source code, creating it if
+-// necessary. It is safe for concurrent use.
+-func (r *repo) getDir() string {
+- r.dirOnce.Do(func() {
+- r.dir = filepath.Join(getTempDir(), r.name)
+- log.Printf("cloning %s@%s into %s", r.url, r.commit, r.dir)
+- if err := shallowClone(r.dir, r.url, r.commit); err != nil {
+- log.Fatal(err)
+- }
+- })
+- return r.dir
+-}
+-
+-// sharedEnv returns a shared benchmark environment. It is safe for concurrent
+-// use.
+-//
+-// Every call to sharedEnv uses the same editor and sandbox, as a means to
+-// avoid reinitializing the editor for large repos. Calling repo.Close cleans
+-// up the shared environment.
+-//
+-// Repos in the package-local Repos var are closed at the end of the test main
+-// function.
+-func (r *repo) sharedEnv(tb testing.TB) *Env {
+- r.editorOnce.Do(func() {
+- dir := r.getDir()
+-
+- start := time.Now()
+- log.Printf("starting initial workspace load for %s", r.name)
+- ts, err := newGoplsServer(r.name)
+- if err != nil {
+- log.Fatal(err)
+- }
+- r.sandbox, r.editor, r.awaiter, err = connectEditor(dir, fake.EditorConfig{}, ts)
+- if err != nil {
+- log.Fatalf("connecting editor: %v", err)
+- }
+-
+- if err := r.awaiter.Await(context.Background(), InitialWorkspaceLoad); err != nil {
+- log.Fatal(err)
+- }
+- log.Printf("initial workspace load (cold) for %s took %v", r.name, time.Since(start))
+- })
+-
+- return &Env{
+- T: tb,
+- Ctx: context.Background(),
+- Editor: r.editor,
+- Sandbox: r.sandbox,
+- Awaiter: r.awaiter,
+- }
+-}
+-
+-// newEnv returns a new Env connected to a new gopls process communicating
+-// over stdin/stdout. It is safe for concurrent use.
+-//
+-// It is the caller's responsibility to call Close on the resulting Env when it
+-// is no longer needed.
+-func (r *repo) newEnv(tb testing.TB, name string, config fake.EditorConfig) *Env {
+- dir := r.getDir()
+-
+- ts, err := newGoplsServer(name)
+- if err != nil {
+- tb.Fatal(err)
+- }
+- sandbox, editor, awaiter, err := connectEditor(dir, config, ts)
+- if err != nil {
+- log.Fatalf("connecting editor: %v", err)
+- }
+-
+- return &Env{
+- T: tb,
+- Ctx: context.Background(),
+- Editor: editor,
+- Sandbox: sandbox,
+- Awaiter: awaiter,
+- }
+-}
+-
+-// Close cleans up shared state referenced by the repo.
+-func (r *repo) Close() error {
+- var errBuf bytes.Buffer
+- if r.editor != nil {
+- if err := r.editor.Close(context.Background()); err != nil {
+- fmt.Fprintf(&errBuf, "closing editor: %v", err)
+- }
+- }
+- if r.sandbox != nil {
+- if err := r.sandbox.Close(); err != nil {
+- fmt.Fprintf(&errBuf, "closing sandbox: %v", err)
+- }
+- }
+- if r.dir != "" {
+- if err := os.RemoveAll(r.dir); err != nil {
+- fmt.Fprintf(&errBuf, "cleaning dir: %v", err)
+- }
+- }
+- if errBuf.Len() > 0 {
+- return errors.New(errBuf.String())
+- }
+- return nil
+-}
+-
+-// cleanup cleans up state that is shared across benchmark functions.
+-func cleanup() error {
+- var errBuf bytes.Buffer
+- for _, repo := range repos {
+- if err := repo.Close(); err != nil {
+- fmt.Fprintf(&errBuf, "closing %q: %v", repo.name, err)
+- }
+- }
+- if tempDir != "" {
+- if err := os.RemoveAll(tempDir); err != nil {
+- fmt.Fprintf(&errBuf, "cleaning tempDir: %v", err)
+- }
+- }
+- if errBuf.Len() > 0 {
+- return errors.New(errBuf.String())
+- }
+- return nil
+-}
+diff -urN a/gopls/internal/regtest/bench/stress_test.go b/gopls/internal/regtest/bench/stress_test.go
+--- a/gopls/internal/regtest/bench/stress_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/bench/stress_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,94 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package bench
+-
+-import (
+- "context"
+- "flag"
+- "fmt"
+- "testing"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/hooks"
+- "golang.org/x/tools/gopls/internal/lsp/cache"
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/lsprpc"
+- "golang.org/x/tools/internal/jsonrpc2"
+- "golang.org/x/tools/internal/jsonrpc2/servertest"
+-)
+-
+-// github.com/pilosa/pilosa is a repository that has historically caused
+-// significant memory problems for Gopls. We use it for a simple stress test
+-// that types arbitrarily in a file with lots of dependents.
+-
+-var pilosaPath = flag.String("pilosa_path", "", "Path to a directory containing "+
+- "github.com/pilosa/pilosa, for stress testing. Do not set this unless you "+
+- "know what you're doing!")
+-
+-func TestPilosaStress(t *testing.T) {
+- // TODO(rfindley): revisit this test and make it is hermetic: it should check
+- // out pilosa into a directory.
+- //
+- // Note: This stress test has not been run recently, and may no longer
+- // function properly.
+- if *pilosaPath == "" {
+- t.Skip("-pilosa_path not configured")
+- }
+-
+- sandbox, err := fake.NewSandbox(&fake.SandboxConfig{
+- Workdir: *pilosaPath,
+- GOPROXY: "https://proxy.golang.org",
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- server := lsprpc.NewStreamServer(cache.New(nil), false, hooks.Options)
+- ts := servertest.NewPipeServer(server, jsonrpc2.NewRawStream)
+- ctx := context.Background()
+-
+- const skipApplyEdits = false
+- editor, err := fake.NewEditor(sandbox, fake.EditorConfig{}).Connect(ctx, ts, fake.ClientHooks{}, skipApplyEdits)
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- files := []string{
+- "cmd.go",
+- "internal/private.pb.go",
+- "roaring/roaring.go",
+- "roaring/roaring_internal_test.go",
+- "server/handler_test.go",
+- }
+- for _, file := range files {
+- if err := editor.OpenFile(ctx, file); err != nil {
+- t.Fatal(err)
+- }
+- }
+- ctx, cancel := context.WithTimeout(ctx, 10*time.Minute)
+- defer cancel()
+-
+- i := 1
+- // MagicNumber is an identifier that occurs in roaring.go. Just change it
+- // arbitrarily.
+- if err := editor.RegexpReplace(ctx, "roaring/roaring.go", "MagicNumber", fmt.Sprintf("MagicNumber%d", 1)); err != nil {
+- t.Fatal(err)
+- }
+- for {
+- select {
+- case <-ctx.Done():
+- return
+- default:
+- }
+- if err := editor.RegexpReplace(ctx, "roaring/roaring.go", fmt.Sprintf("MagicNumber%d", i), fmt.Sprintf("MagicNumber%d", i+1)); err != nil {
+- t.Fatal(err)
+- }
+- // Simulate (very fast) typing.
+- //
+- // Typing 80 wpm ~150ms per keystroke.
+- time.Sleep(150 * time.Millisecond)
+- i++
+- }
+-}
+diff -urN a/gopls/internal/regtest/bench/workspace_symbols_test.go b/gopls/internal/regtest/bench/workspace_symbols_test.go
+--- a/gopls/internal/regtest/bench/workspace_symbols_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/bench/workspace_symbols_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,37 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package bench
+-
+-import (
+- "flag"
+- "fmt"
+- "testing"
+-)
+-
+-var symbolQuery = flag.String("symbol_query", "test", "symbol query to use in benchmark")
+-
+-// BenchmarkWorkspaceSymbols benchmarks the time to execute a workspace symbols
+-// request (controlled by the -symbol_query flag).
+-func BenchmarkWorkspaceSymbols(b *testing.B) {
+- for name := range repos {
+- b.Run(name, func(b *testing.B) {
+- env := getRepo(b, name).sharedEnv(b)
+- symbols := env.Symbol(*symbolQuery) // warm the cache
+-
+- if testing.Verbose() {
+- fmt.Println("Results:")
+- for i, symbol := range symbols {
+- fmt.Printf("\t%d. %s (%s)\n", i, symbol.Name, symbol.ContainerName)
+- }
+- }
+-
+- b.ResetTimer()
+-
+- for i := 0; i < b.N; i++ {
+- env.Symbol(*symbolQuery)
+- }
+- })
+- }
+-}
+diff -urN a/gopls/internal/regtest/codelens/codelens_test.go b/gopls/internal/regtest/codelens/codelens_test.go
+--- a/gopls/internal/regtest/codelens/codelens_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/codelens/codelens_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,336 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package codelens
+-
+-import (
+- "fmt"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/hooks"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+- "golang.org/x/tools/internal/bug"
+-
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-func TestMain(m *testing.M) {
+- bug.PanicOnBugs = true
+- Main(m, hooks.Options)
+-}
+-
+-func TestDisablingCodeLens(t *testing.T) {
+- const workspace = `
+--- go.mod --
+-module codelens.test
+-
+-go 1.12
+--- lib.go --
+-package lib
+-
+-type Number int
+-
+-const (
+- Zero Number = iota
+- One
+- Two
+-)
+-
+-//` + `go:generate stringer -type=Number
+-`
+- tests := []struct {
+- label string
+- enabled map[string]bool
+- wantCodeLens bool
+- }{
+- {
+- label: "default",
+- wantCodeLens: true,
+- },
+- {
+- label: "generate disabled",
+- enabled: map[string]bool{string(command.Generate): false},
+- wantCodeLens: false,
+- },
+- }
+- for _, test := range tests {
+- t.Run(test.label, func(t *testing.T) {
+- WithOptions(
+- Settings{"codelenses": test.enabled},
+- ).Run(t, workspace, func(t *testing.T, env *Env) {
+- env.OpenFile("lib.go")
+- lens := env.CodeLens("lib.go")
+- if gotCodeLens := len(lens) > 0; gotCodeLens != test.wantCodeLens {
+- t.Errorf("got codeLens: %t, want %t", gotCodeLens, test.wantCodeLens)
+- }
+- })
+- })
+- }
+-}
+-
+-// This test confirms the full functionality of the code lenses for updating
+-// dependencies in a go.mod file. It checks for the code lens that suggests
+-// an update and then executes the command associated with that code lens. A
+-// regression test for golang/go#39446. It also checks that these code lenses
+-// only affect the diagnostics and contents of the containing go.mod file.
+-func TestUpgradeCodelens(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18) // uses go.work
+-
+- const proxyWithLatest = `
+--- golang.org/x/hello@v1.3.3/go.mod --
+-module golang.org/x/hello
+-
+-go 1.12
+--- golang.org/x/hello@v1.3.3/hi/hi.go --
+-package hi
+-
+-var Goodbye error
+--- golang.org/x/hello@v1.2.3/go.mod --
+-module golang.org/x/hello
+-
+-go 1.12
+--- golang.org/x/hello@v1.2.3/hi/hi.go --
+-package hi
+-
+-var Goodbye error
+-`
+-
+- const shouldUpdateDep = `
+--- go.work --
+-go 1.18
+-
+-use (
+- ./a
+- ./b
+-)
+--- a/go.mod --
+-module mod.com/a
+-
+-go 1.14
+-
+-require golang.org/x/hello v1.2.3
+--- a/go.sum --
+-golang.org/x/hello v1.2.3 h1:7Wesfkx/uBd+eFgPrq0irYj/1XfmbvLV8jZ/W7C2Dwg=
+-golang.org/x/hello v1.2.3/go.mod h1:OgtlzsxVMUUdsdQCIDYgaauCTH47B8T8vofouNJfzgY=
+--- a/main.go --
+-package main
+-
+-import "golang.org/x/hello/hi"
+-
+-func main() {
+- _ = hi.Goodbye
+-}
+--- b/go.mod --
+-module mod.com/b
+-
+-go 1.14
+-
+-require golang.org/x/hello v1.2.3
+--- b/go.sum --
+-golang.org/x/hello v1.2.3 h1:7Wesfkx/uBd+eFgPrq0irYj/1XfmbvLV8jZ/W7C2Dwg=
+-golang.org/x/hello v1.2.3/go.mod h1:OgtlzsxVMUUdsdQCIDYgaauCTH47B8T8vofouNJfzgY=
+--- b/main.go --
+-package main
+-
+-import (
+- "golang.org/x/hello/hi"
+-)
+-
+-func main() {
+- _ = hi.Goodbye
+-}
+-`
+-
+- const wantGoModA = `module mod.com/a
+-
+-go 1.14
+-
+-require golang.org/x/hello v1.3.3
+-`
+- // Applying the diagnostics or running the codelenses for a/go.mod
+- // should not change the contents of b/go.mod
+- const wantGoModB = `module mod.com/b
+-
+-go 1.14
+-
+-require golang.org/x/hello v1.2.3
+-`
+-
+- for _, commandTitle := range []string{
+- "Upgrade transitive dependencies",
+- "Upgrade direct dependencies",
+- } {
+- t.Run(commandTitle, func(t *testing.T) {
+- WithOptions(
+- ProxyFiles(proxyWithLatest),
+- ).Run(t, shouldUpdateDep, func(t *testing.T, env *Env) {
+- env.OpenFile("a/go.mod")
+- env.OpenFile("b/go.mod")
+- var lens protocol.CodeLens
+- var found bool
+- for _, l := range env.CodeLens("a/go.mod") {
+- if l.Command.Title == commandTitle {
+- lens = l
+- found = true
+- }
+- }
+- if !found {
+- t.Fatalf("found no command with the title %s", commandTitle)
+- }
+- if _, err := env.Editor.ExecuteCommand(env.Ctx, &protocol.ExecuteCommandParams{
+- Command: lens.Command.Command,
+- Arguments: lens.Command.Arguments,
+- }); err != nil {
+- t.Fatal(err)
+- }
+- env.AfterChange()
+- if got := env.BufferText("a/go.mod"); got != wantGoModA {
+- t.Fatalf("a/go.mod upgrade failed:\n%s", compare.Text(wantGoModA, got))
+- }
+- if got := env.BufferText("b/go.mod"); got != wantGoModB {
+- t.Fatalf("b/go.mod changed unexpectedly:\n%s", compare.Text(wantGoModB, got))
+- }
+- })
+- })
+- }
+- for _, vendoring := range []bool{false, true} {
+- t.Run(fmt.Sprintf("Upgrade individual dependency vendoring=%v", vendoring), func(t *testing.T) {
+- WithOptions(ProxyFiles(proxyWithLatest)).Run(t, shouldUpdateDep, func(t *testing.T, env *Env) {
+- if vendoring {
+- env.RunGoCommandInDir("a", "mod", "vendor")
+- }
+- env.AfterChange()
+- env.OpenFile("a/go.mod")
+- env.OpenFile("b/go.mod")
+- env.ExecuteCodeLensCommand("a/go.mod", command.CheckUpgrades, nil)
+- d := &protocol.PublishDiagnosticsParams{}
+- env.OnceMet(
+- Diagnostics(env.AtRegexp("a/go.mod", `require`), WithMessage("can be upgraded")),
+- ReadDiagnostics("a/go.mod", d),
+- // We do not want there to be a diagnostic for b/go.mod,
+- // but there may be some subtlety in timing here, where this
+- // should always succeed, but may not actually test the correct
+- // behavior.
+- NoDiagnostics(env.AtRegexp("b/go.mod", `require`)),
+- )
+- // Check for upgrades in b/go.mod and then clear them.
+- env.ExecuteCodeLensCommand("b/go.mod", command.CheckUpgrades, nil)
+- env.Await(Diagnostics(env.AtRegexp("b/go.mod", `require`), WithMessage("can be upgraded")))
+- env.ExecuteCodeLensCommand("b/go.mod", command.ResetGoModDiagnostics, nil)
+- env.Await(NoDiagnostics(ForFile("b/go.mod")))
+-
+- // Apply the diagnostics to a/go.mod.
+- env.ApplyQuickFixes("a/go.mod", d.Diagnostics)
+- env.AfterChange()
+- if got := env.BufferText("a/go.mod"); got != wantGoModA {
+- t.Fatalf("a/go.mod upgrade failed:\n%s", compare.Text(wantGoModA, got))
+- }
+- if got := env.BufferText("b/go.mod"); got != wantGoModB {
+- t.Fatalf("b/go.mod changed unexpectedly:\n%s", compare.Text(wantGoModB, got))
+- }
+- })
+- })
+- }
+-}
+-
+-func TestUnusedDependenciesCodelens(t *testing.T) {
+- const proxy = `
+--- golang.org/x/hello@v1.0.0/go.mod --
+-module golang.org/x/hello
+-
+-go 1.14
+--- golang.org/x/hello@v1.0.0/hi/hi.go --
+-package hi
+-
+-var Goodbye error
+--- golang.org/x/unused@v1.0.0/go.mod --
+-module golang.org/x/unused
+-
+-go 1.14
+--- golang.org/x/unused@v1.0.0/nouse/nouse.go --
+-package nouse
+-
+-var NotUsed error
+-`
+-
+- const shouldRemoveDep = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+-
+-require golang.org/x/hello v1.0.0
+-require golang.org/x/unused v1.0.0
+--- go.sum --
+-golang.org/x/hello v1.0.0 h1:qbzE1/qT0/zojAMd/JcPsO2Vb9K4Bkeyq0vB2JGMmsw=
+-golang.org/x/hello v1.0.0/go.mod h1:WW7ER2MRNXWA6c8/4bDIek4Hc/+DofTrMaQQitGXcco=
+-golang.org/x/unused v1.0.0 h1:LecSbCn5P3vTcxubungSt1Pn4D/WocCaiWOPDC0y0rw=
+-golang.org/x/unused v1.0.0/go.mod h1:ihoW8SgWzugwwj0N2SfLfPZCxTB1QOVfhMfB5PWTQ8U=
+--- main.go --
+-package main
+-
+-import "golang.org/x/hello/hi"
+-
+-func main() {
+- _ = hi.Goodbye
+-}
+-`
+- WithOptions(ProxyFiles(proxy)).Run(t, shouldRemoveDep, func(t *testing.T, env *Env) {
+- env.OpenFile("go.mod")
+- env.ExecuteCodeLensCommand("go.mod", command.Tidy, nil)
+- env.Await(env.DoneWithChangeWatchedFiles())
+- got := env.BufferText("go.mod")
+- const wantGoMod = `module mod.com
+-
+-go 1.14
+-
+-require golang.org/x/hello v1.0.0
+-`
+- if got != wantGoMod {
+- t.Fatalf("go.mod tidy failed:\n%s", compare.Text(wantGoMod, got))
+- }
+- })
+-}
+-
+-func TestRegenerateCgo(t *testing.T) {
+- testenv.NeedsTool(t, "cgo")
+- const workspace = `
+--- go.mod --
+-module example.com
+-
+-go 1.12
+--- cgo.go --
+-package x
+-
+-/*
+-int fortythree() { return 42; }
+-*/
+-import "C"
+-
+-func Foo() {
+- print(C.fortytwo())
+-}
+-`
+- Run(t, workspace, func(t *testing.T, env *Env) {
+- // Open the file. We have a nonexistant symbol that will break cgo processing.
+- env.OpenFile("cgo.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("cgo.go", ``), WithMessage("go list failed to return CompiledGoFiles")),
+- )
+-
+- // Fix the C function name. We haven't regenerated cgo, so nothing should be fixed.
+- env.RegexpReplace("cgo.go", `int fortythree`, "int fortytwo")
+- env.SaveBuffer("cgo.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("cgo.go", ``), WithMessage("go list failed to return CompiledGoFiles")),
+- )
+-
+- // Regenerate cgo, fixing the diagnostic.
+- env.ExecuteCodeLensCommand("cgo.go", command.RegenerateCgo, nil)
+- env.Await(NoDiagnostics(ForFile("cgo.go")))
+- })
+-}
+diff -urN a/gopls/internal/regtest/codelens/gcdetails_test.go b/gopls/internal/regtest/codelens/gcdetails_test.go
+--- a/gopls/internal/regtest/codelens/gcdetails_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/codelens/gcdetails_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,127 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package codelens
+-
+-import (
+- "runtime"
+- "strings"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/internal/bug"
+-)
+-
+-func TestGCDetails_Toggle(t *testing.T) {
+- if runtime.GOOS == "android" {
+- t.Skipf("the gc details code lens doesn't work on Android")
+- }
+-
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.15
+--- main.go --
+-package main
+-
+-import "fmt"
+-
+-func main() {
+- fmt.Println(42)
+-}
+-`
+- WithOptions(
+- Settings{
+- "codelenses": map[string]bool{
+- "gc_details": true,
+- },
+- },
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.ExecuteCodeLensCommand("main.go", command.GCDetails, nil)
+- d := &protocol.PublishDiagnosticsParams{}
+- env.OnceMet(
+- Diagnostics(AtPosition("main.go", 5, 13)),
+- ReadDiagnostics("main.go", d),
+- )
+- // Confirm that the diagnostics come from the gc details code lens.
+- var found bool
+- for _, d := range d.Diagnostics {
+- if d.Severity != protocol.SeverityInformation {
+- t.Fatalf("unexpected diagnostic severity %v, wanted Information", d.Severity)
+- }
+- if strings.Contains(d.Message, "42 escapes") {
+- found = true
+- }
+- }
+- if !found {
+- t.Fatalf(`expected to find diagnostic with message "escape(42 escapes to heap)", found none`)
+- }
+-
+- // Editing a buffer should cause gc_details diagnostics to disappear, since
+- // they only apply to saved buffers.
+- env.EditBuffer("main.go", fake.NewEdit(0, 0, 0, 0, "\n\n"))
+- env.AfterChange(NoDiagnostics(ForFile("main.go")))
+-
+- // Saving a buffer should re-format back to the original state, and
+- // re-enable the gc_details diagnostics.
+- env.SaveBuffer("main.go")
+- env.AfterChange(Diagnostics(AtPosition("main.go", 5, 13)))
+-
+- // Toggle the GC details code lens again so now it should be off.
+- env.ExecuteCodeLensCommand("main.go", command.GCDetails, nil)
+- env.Await(NoDiagnostics(ForFile("main.go")))
+- })
+-}
+-
+-// Test for the crasher in golang/go#54199
+-func TestGCDetails_NewFile(t *testing.T) {
+- bug.PanicOnBugs = false
+- const src = `
+--- go.mod --
+-module mod.test
+-
+-go 1.12
+-`
+-
+- WithOptions(
+- Settings{
+- "codelenses": map[string]bool{
+- "gc_details": true,
+- },
+- },
+- ).Run(t, src, func(t *testing.T, env *Env) {
+- env.CreateBuffer("p_test.go", "")
+-
+- const gcDetailsCommand = "gopls." + string(command.GCDetails)
+-
+- hasGCDetails := func() bool {
+- lenses := env.CodeLens("p_test.go") // should not crash
+- for _, lens := range lenses {
+- if lens.Command.Command == gcDetailsCommand {
+- return true
+- }
+- }
+- return false
+- }
+-
+- // With an empty file, we shouldn't get the gc_details codelens because
+- // there is nowhere to position it (it needs a package name).
+- if hasGCDetails() {
+- t.Errorf("got the gc_details codelens for an empty file")
+- }
+-
+- // Edit to provide a package name.
+- env.EditBuffer("p_test.go", fake.NewEdit(0, 0, 0, 0, "package p"))
+-
+- // Now we should get the gc_details codelens.
+- if !hasGCDetails() {
+- t.Errorf("didn't get the gc_details codelens for a valid non-empty Go file")
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/completion/completion18_test.go b/gopls/internal/regtest/completion/completion18_test.go
+--- a/gopls/internal/regtest/completion/completion18_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/completion/completion18_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,124 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package completion
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-// test generic receivers
+-func TestGenericReceiver(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- main.go --
+-package main
+-type SyncMap[K any, V comparable] struct {}
+-func (s *SyncMap[K,V]) f() {}
+-type XX[T any] struct {}
+-type UU[T any] struct {}
+-func (s SyncMap[XX,string]) g(v UU) {}
+-`
+-
+- tests := []struct {
+- pat string
+- want []string
+- }{
+- {"s .Syn", []string{"SyncMap[K, V]"}},
+- {"Map.X", []string{}}, // This is probably wrong, Maybe "XX"?
+- {"v U", []string{"UU", "uint", "uint16", "uint32", "uint64", "uint8", "uintptr"}}, // not U[T]
+- }
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.Await(env.DoneWithOpen())
+- for _, tst := range tests {
+- loc := env.RegexpSearch("main.go", tst.pat)
+- loc.Range.Start.Character += uint32(protocol.UTF16Len([]byte(tst.pat)))
+- completions := env.Completion(loc)
+- result := compareCompletionLabels(tst.want, completions.Items)
+- if result != "" {
+- t.Errorf("%s: wanted %v", result, tst.want)
+- for i, g := range completions.Items {
+- t.Errorf("got %d %s %s", i, g.Label, g.Detail)
+- }
+- }
+- }
+- })
+-}
+-func TestFuzzFunc(t *testing.T) {
+- // use the example from the package documentation
+- modfile := `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+-`
+- part0 := `package foo
+-import "testing"
+-func FuzzNone(f *testing.F) {
+- f.Add(12) // better not find this f.Add
+-}
+-func FuzzHex(f *testing.F) {
+- for _, seed := range [][]byte{{}, {0}, {9}, {0xa}, {0xf}, {1, 2, 3, 4}} {
+- f.Ad`
+- part1 := `d(seed)
+- }
+- f.F`
+- part2 := `uzz(func(t *testing.T, in []byte) {
+- enc := hex.EncodeToString(in)
+- out, err := hex.DecodeString(enc)
+- if err != nil {
+- f.Failed()
+- }
+- if !bytes.Equal(in, out) {
+- t.Fatalf("%v: round trip: %v, %s", in, out, f.Name())
+- }
+- })
+-}
+-`
+- data := modfile + `-- a_test.go --
+-` + part0 + `
+--- b_test.go --
+-` + part0 + part1 + `
+--- c_test.go --
+-` + part0 + part1 + part2
+-
+- tests := []struct {
+- file string
+- pat string
+- offset uint32 // UTF16 length from the beginning of pat to what the user just typed
+- want []string
+- }{
+- {"a_test.go", "f.Ad", 3, []string{"Add"}},
+- {"c_test.go", " f.F", 4, []string{"Failed"}},
+- {"c_test.go", "f.N", 3, []string{"Name"}},
+- {"b_test.go", "f.F", 3, []string{"Fuzz(func(t *testing.T, a []byte)", "Fail", "FailNow",
+- "Failed", "Fatal", "Fatalf"}},
+- }
+- Run(t, data, func(t *testing.T, env *Env) {
+- for _, test := range tests {
+- env.OpenFile(test.file)
+- env.Await(env.DoneWithOpen())
+- loc := env.RegexpSearch(test.file, test.pat)
+- loc.Range.Start.Character += test.offset // character user just typed? will type?
+- completions := env.Completion(loc)
+- result := compareCompletionLabels(test.want, completions.Items)
+- if result != "" {
+- t.Errorf("pat %q %q", test.pat, result)
+- for i, it := range completions.Items {
+- t.Errorf("%d got %q %q", i, it.Label, it.Detail)
+- }
+- }
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/completion/completion_test.go b/gopls/internal/regtest/completion/completion_test.go
+--- a/gopls/internal/regtest/completion/completion_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/completion/completion_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,754 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "fmt"
+- "strings"
+- "testing"
+-
+- "github.com/google/go-cmp/cmp"
+- "golang.org/x/tools/gopls/internal/hooks"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/testenv"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-func TestMain(m *testing.M) {
+- bug.PanicOnBugs = true
+- Main(m, hooks.Options)
+-}
+-
+-const proxy = `
+--- example.com@v1.2.3/go.mod --
+-module example.com
+-
+-go 1.12
+--- example.com@v1.2.3/blah/blah.go --
+-package blah
+-
+-const Name = "Blah"
+--- random.org@v1.2.3/go.mod --
+-module random.org
+-
+-go 1.12
+--- random.org@v1.2.3/blah/blah.go --
+-package hello
+-
+-const Name = "Hello"
+-`
+-
+-func TestPackageCompletion(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- fruits/apple.go --
+-package apple
+-
+-fun apple() int {
+- return 0
+-}
+-
+--- fruits/testfile.go --
+-// this is a comment
+-
+-/*
+- this is a multiline comment
+-*/
+-
+-import "fmt"
+-
+-func test() {}
+-
+--- fruits/testfile2.go --
+-package
+-
+--- fruits/testfile3.go --
+-pac
+--- 123f_r.u~its-123/testfile.go --
+-package
+-
+--- .invalid-dir@-name/testfile.go --
+-package
+-`
+- var (
+- testfile4 = ""
+- testfile5 = "/*a comment*/ "
+- testfile6 = "/*a comment*/\n"
+- )
+- for _, tc := range []struct {
+- name string
+- filename string
+- content *string
+- triggerRegexp string
+- want []string
+- editRegexp string
+- }{
+- {
+- name: "package completion at valid position",
+- filename: "fruits/testfile.go",
+- triggerRegexp: "\n()",
+- want: []string{"package apple", "package apple_test", "package fruits", "package fruits_test", "package main"},
+- editRegexp: "\n()",
+- },
+- {
+- name: "package completion in a comment",
+- filename: "fruits/testfile.go",
+- triggerRegexp: "th(i)s",
+- want: nil,
+- },
+- {
+- name: "package completion in a multiline comment",
+- filename: "fruits/testfile.go",
+- triggerRegexp: `\/\*\n()`,
+- want: nil,
+- },
+- {
+- name: "package completion at invalid position",
+- filename: "fruits/testfile.go",
+- triggerRegexp: "import \"fmt\"\n()",
+- want: nil,
+- },
+- {
+- name: "package completion after keyword 'package'",
+- filename: "fruits/testfile2.go",
+- triggerRegexp: "package()",
+- want: []string{"package apple", "package apple_test", "package fruits", "package fruits_test", "package main"},
+- editRegexp: "package\n",
+- },
+- {
+- name: "package completion with 'pac' prefix",
+- filename: "fruits/testfile3.go",
+- triggerRegexp: "pac()",
+- want: []string{"package apple", "package apple_test", "package fruits", "package fruits_test", "package main"},
+- editRegexp: "pac",
+- },
+- {
+- name: "package completion for empty file",
+- filename: "fruits/testfile4.go",
+- triggerRegexp: "^$",
+- content: &testfile4,
+- want: []string{"package apple", "package apple_test", "package fruits", "package fruits_test", "package main"},
+- editRegexp: "^$",
+- },
+- {
+- name: "package completion without terminal newline",
+- filename: "fruits/testfile5.go",
+- triggerRegexp: `\*\/ ()`,
+- content: &testfile5,
+- want: []string{"package apple", "package apple_test", "package fruits", "package fruits_test", "package main"},
+- editRegexp: `\*\/ ()`,
+- },
+- {
+- name: "package completion on terminal newline",
+- filename: "fruits/testfile6.go",
+- triggerRegexp: `\*\/\n()`,
+- content: &testfile6,
+- want: []string{"package apple", "package apple_test", "package fruits", "package fruits_test", "package main"},
+- editRegexp: `\*\/\n()`,
+- },
+- // Issue golang/go#44680
+- {
+- name: "package completion for dir name with punctuation",
+- filename: "123f_r.u~its-123/testfile.go",
+- triggerRegexp: "package()",
+- want: []string{"package fruits123", "package fruits123_test", "package main"},
+- editRegexp: "package\n",
+- },
+- {
+- name: "package completion for invalid dir name",
+- filename: ".invalid-dir@-name/testfile.go",
+- triggerRegexp: "package()",
+- want: []string{"package main"},
+- editRegexp: "package\n",
+- },
+- } {
+- t.Run(tc.name, func(t *testing.T) {
+- Run(t, files, func(t *testing.T, env *Env) {
+- if tc.content != nil {
+- env.WriteWorkspaceFile(tc.filename, *tc.content)
+- env.Await(env.DoneWithChangeWatchedFiles())
+- }
+- env.OpenFile(tc.filename)
+- completions := env.Completion(env.RegexpSearch(tc.filename, tc.triggerRegexp))
+-
+- // Check that the completion item suggestions are in the range
+- // of the file. {Start,End}.Line are zero-based.
+- lineCount := len(strings.Split(env.BufferText(tc.filename), "\n"))
+- for _, item := range completions.Items {
+- if start := int(item.TextEdit.Range.Start.Line); start > lineCount {
+- t.Fatalf("unexpected text edit range start line number: got %d, want <= %d", start, lineCount)
+- }
+- if end := int(item.TextEdit.Range.End.Line); end > lineCount {
+- t.Fatalf("unexpected text edit range end line number: got %d, want <= %d", end, lineCount)
+- }
+- }
+-
+- if tc.want != nil {
+- expectedLoc := env.RegexpSearch(tc.filename, tc.editRegexp)
+- for _, item := range completions.Items {
+- gotRng := item.TextEdit.Range
+- if expectedLoc.Range != gotRng {
+- t.Errorf("unexpected completion range for completion item %s: got %v, want %v",
+- item.Label, gotRng, expectedLoc.Range)
+- }
+- }
+- }
+-
+- diff := compareCompletionLabels(tc.want, completions.Items)
+- if diff != "" {
+- t.Error(diff)
+- }
+- })
+- })
+- }
+-}
+-
+-func TestPackageNameCompletion(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- math/add.go --
+-package ma
+-`
+-
+- want := []string{"ma", "ma_test", "main", "math", "math_test"}
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("math/add.go")
+- completions := env.Completion(env.RegexpSearch("math/add.go", "package ma()"))
+-
+- diff := compareCompletionLabels(want, completions.Items)
+- if diff != "" {
+- t.Fatal(diff)
+- }
+- })
+-}
+-
+-// TODO(rfindley): audit/clean up call sites for this helper, to ensure
+-// consistent test errors.
+-func compareCompletionLabels(want []string, gotItems []protocol.CompletionItem) string {
+- var got []string
+- for _, item := range gotItems {
+- got = append(got, item.Label)
+- if item.Label != item.InsertText && item.TextEdit == nil {
+- // Label should be the same as InsertText, if InsertText is to be used
+- return fmt.Sprintf("label not the same as InsertText %#v", item)
+- }
+- }
+-
+- if len(got) == 0 && len(want) == 0 {
+- return "" // treat nil and the empty slice as equivalent
+- }
+-
+- if diff := cmp.Diff(want, got); diff != "" {
+- return fmt.Sprintf("completion item mismatch (-want +got):\n%s", diff)
+- }
+- return ""
+-}
+-
+-func TestUnimportedCompletion(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+-
+-require example.com v1.2.3
+--- go.sum --
+-example.com v1.2.3 h1:ihBTGWGjTU3V4ZJ9OmHITkU9WQ4lGdQkMjgyLFk0FaY=
+-example.com v1.2.3/go.mod h1:Y2Rc5rVWjWur0h3pd9aEvK5Pof8YKDANh9gHA2Maujo=
+--- main.go --
+-package main
+-
+-func main() {
+- _ = blah
+-}
+--- main2.go --
+-package main
+-
+-import "example.com/blah"
+-
+-func _() {
+- _ = blah.Hello
+-}
+-`
+- WithOptions(
+- ProxyFiles(proxy),
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- // Make sure the dependency is in the module cache and accessible for
+- // unimported completions, and then remove it before proceeding.
+- env.RemoveWorkspaceFile("main2.go")
+- env.RunGoCommand("mod", "tidy")
+- env.Await(env.DoneWithChangeWatchedFiles())
+-
+- // Trigger unimported completions for the example.com/blah package.
+- env.OpenFile("main.go")
+- env.Await(env.DoneWithOpen())
+- loc := env.RegexpSearch("main.go", "ah")
+- completions := env.Completion(loc)
+- if len(completions.Items) == 0 {
+- t.Fatalf("no completion items")
+- }
+- env.AcceptCompletion(loc, completions.Items[0]) // adds blah import to main.go
+- env.Await(env.DoneWithChange())
+-
+- // Trigger completions once again for the blah.<> selector.
+- env.RegexpReplace("main.go", "_ = blah", "_ = blah.")
+- env.Await(env.DoneWithChange())
+- loc = env.RegexpSearch("main.go", "\n}")
+- completions = env.Completion(loc)
+- if len(completions.Items) != 1 {
+- t.Fatalf("expected 1 completion item, got %v", len(completions.Items))
+- }
+- item := completions.Items[0]
+- if item.Label != "Name" {
+- t.Fatalf("expected completion item blah.Name, got %v", item.Label)
+- }
+- env.AcceptCompletion(loc, item)
+-
+- // Await the diagnostics to add example.com/blah to the go.mod file.
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("main.go", `"example.com/blah"`)),
+- )
+- })
+-}
+-
+-// Test that completions still work with an undownloaded module, golang/go#43333.
+-func TestUndownloadedModule(t *testing.T) {
+- // mod.com depends on example.com, but only in a file that's hidden by a
+- // build tag, so the IWL won't download example.com. That will cause errors
+- // in the go list -m call performed by the imports package.
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+-
+-require example.com v1.2.3
+--- go.sum --
+-example.com v1.2.3 h1:ihBTGWGjTU3V4ZJ9OmHITkU9WQ4lGdQkMjgyLFk0FaY=
+-example.com v1.2.3/go.mod h1:Y2Rc5rVWjWur0h3pd9aEvK5Pof8YKDANh9gHA2Maujo=
+--- useblah.go --
+-// +build hidden
+-
+-package pkg
+-import "example.com/blah"
+-var _ = blah.Name
+--- mainmod/mainmod.go --
+-package mainmod
+-
+-const Name = "mainmod"
+-`
+- WithOptions(ProxyFiles(proxy)).Run(t, files, func(t *testing.T, env *Env) {
+- env.CreateBuffer("import.go", "package pkg\nvar _ = mainmod.Name\n")
+- env.SaveBuffer("import.go")
+- content := env.ReadWorkspaceFile("import.go")
+- if !strings.Contains(content, `import "mod.com/mainmod`) {
+- t.Errorf("expected import of mod.com/mainmod in %q", content)
+- }
+- })
+-}
+-
+-// Test that we can doctor the source code enough so the file is
+-// parseable and completion works as expected.
+-func TestSourceFixup(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- foo.go --
+-package foo
+-
+-func _() {
+- var s S
+- if s.
+-}
+-
+-type S struct {
+- i int
+-}
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("foo.go")
+- completions := env.Completion(env.RegexpSearch("foo.go", `if s\.()`))
+- diff := compareCompletionLabels([]string{"i"}, completions.Items)
+- if diff != "" {
+- t.Fatal(diff)
+- }
+- })
+-}
+-
+-func TestCompletion_Issue45510(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-func _() {
+- type a *a
+- var aaaa1, aaaa2 a
+- var _ a = aaaa
+-
+- type b a
+- var bbbb1, bbbb2 b
+- var _ b = bbbb
+-}
+-
+-type (
+- c *d
+- d *e
+- e **c
+-)
+-
+-func _() {
+- var (
+- xxxxc c
+- xxxxd d
+- xxxxe e
+- )
+-
+- var _ c = xxxx
+- var _ d = xxxx
+- var _ e = xxxx
+-}
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+-
+- tests := []struct {
+- re string
+- want []string
+- }{
+- {`var _ a = aaaa()`, []string{"aaaa1", "aaaa2"}},
+- {`var _ b = bbbb()`, []string{"bbbb1", "bbbb2"}},
+- {`var _ c = xxxx()`, []string{"xxxxc", "xxxxd", "xxxxe"}},
+- {`var _ d = xxxx()`, []string{"xxxxc", "xxxxd", "xxxxe"}},
+- {`var _ e = xxxx()`, []string{"xxxxc", "xxxxd", "xxxxe"}},
+- }
+- for _, tt := range tests {
+- completions := env.Completion(env.RegexpSearch("main.go", tt.re))
+- diff := compareCompletionLabels(tt.want, completions.Items)
+- if diff != "" {
+- t.Errorf("%s: %s", tt.re, diff)
+- }
+- }
+- })
+-}
+-
+-func TestCompletionDeprecation(t *testing.T) {
+- const files = `
+--- go.mod --
+-module test.com
+-
+-go 1.16
+--- prog.go --
+-package waste
+-// Deprecated, use newFoof
+-func fooFunc() bool {
+- return false
+-}
+-
+-// Deprecated
+-const badPi = 3.14
+-
+-func doit() {
+- if fooF
+- panic()
+- x := badP
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("prog.go")
+- loc := env.RegexpSearch("prog.go", "if fooF")
+- loc.Range.Start.Character += uint32(protocol.UTF16Len([]byte("if fooF")))
+- completions := env.Completion(loc)
+- diff := compareCompletionLabels([]string{"fooFunc"}, completions.Items)
+- if diff != "" {
+- t.Error(diff)
+- }
+- if completions.Items[0].Tags == nil {
+- t.Errorf("expected Tags to show deprecation %#v", completions.Items[0].Tags)
+- }
+- loc = env.RegexpSearch("prog.go", "= badP")
+- loc.Range.Start.Character += uint32(protocol.UTF16Len([]byte("= badP")))
+- completions = env.Completion(loc)
+- diff = compareCompletionLabels([]string{"badPi"}, completions.Items)
+- if diff != "" {
+- t.Error(diff)
+- }
+- if completions.Items[0].Tags == nil {
+- t.Errorf("expected Tags to show deprecation %#v", completions.Items[0].Tags)
+- }
+- })
+-}
+-
+-func TestUnimportedCompletion_VSCodeIssue1489(t *testing.T) {
+- const src = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+-
+--- main.go --
+-package main
+-
+-import "fmt"
+-
+-func main() {
+- fmt.Println("a")
+- math.Sqr
+-}
+-`
+- WithOptions(
+- WindowsLineEndings(),
+- ).Run(t, src, func(t *testing.T, env *Env) {
+- // Trigger unimported completions for the mod.com package.
+- env.OpenFile("main.go")
+- env.Await(env.DoneWithOpen())
+- loc := env.RegexpSearch("main.go", "Sqr()")
+- completions := env.Completion(loc)
+- if len(completions.Items) == 0 {
+- t.Fatalf("no completion items")
+- }
+- env.AcceptCompletion(loc, completions.Items[0])
+- env.Await(env.DoneWithChange())
+- got := env.BufferText("main.go")
+- want := "package main\r\n\r\nimport (\r\n\t\"fmt\"\r\n\t\"math\"\r\n)\r\n\r\nfunc main() {\r\n\tfmt.Println(\"a\")\r\n\tmath.Sqrt(${1:})\r\n}\r\n"
+- if diff := cmp.Diff(want, got); diff != "" {
+- t.Errorf("unimported completion (-want +got):\n%s", diff)
+- }
+- })
+-}
+-
+-func TestPackageMemberCompletionAfterSyntaxError(t *testing.T) {
+- // This test documents the current broken behavior due to golang/go#58833.
+- const src = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+-
+--- main.go --
+-package main
+-
+-import "math"
+-
+-func main() {
+- math.Sqrt(,0)
+- math.Ldex
+-}
+-`
+- Run(t, src, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.Await(env.DoneWithOpen())
+- loc := env.RegexpSearch("main.go", "Ldex()")
+- completions := env.Completion(loc)
+- if len(completions.Items) == 0 {
+- t.Fatalf("no completion items")
+- }
+- env.AcceptCompletion(loc, completions.Items[0])
+- env.Await(env.DoneWithChange())
+- got := env.BufferText("main.go")
+- // The completion of math.Ldex after the syntax error on the
+- // previous line is not "math.Ldexp" but "math.Ldexmath.Abs".
+- // (In VSCode, "Abs" wrongly appears in the completion menu.)
+- // This is a consequence of poor error recovery in the parser
+- // causing "math.Ldex" to become a BadExpr.
+- want := "package main\n\nimport \"math\"\n\nfunc main() {\n\tmath.Sqrt(,0)\n\tmath.Ldexmath.Abs(${1:})\n}\n"
+- if diff := cmp.Diff(want, got); diff != "" {
+- t.Errorf("unimported completion (-want +got):\n%s", diff)
+- }
+- })
+-}
+-
+-func TestDefinition(t *testing.T) {
+- testenv.NeedsGo1Point(t, 17) // in go1.16, The FieldList in func x is not empty
+- files := `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- a_test.go --
+-package foo
+-`
+- tests := []struct {
+- line string // the sole line in the buffer after the package statement
+- pat string // the pattern to search for
+- want []string // expected completions
+- }{
+- {"func T", "T", []string{"TestXxx(t *testing.T)", "TestMain(m *testing.M)"}},
+- {"func T()", "T", []string{"TestMain", "Test"}},
+- {"func TestM", "TestM", []string{"TestMain(m *testing.M)", "TestM(t *testing.T)"}},
+- {"func TestM()", "TestM", []string{"TestMain"}},
+- {"func TestMi", "TestMi", []string{"TestMi(t *testing.T)"}},
+- {"func TestMi()", "TestMi", nil},
+- {"func TestG", "TestG", []string{"TestG(t *testing.T)"}},
+- {"func TestG(", "TestG", nil},
+- {"func Ben", "B", []string{"BenchmarkXxx(b *testing.B)"}},
+- {"func Ben(", "Ben", []string{"Benchmark"}},
+- {"func BenchmarkFoo", "BenchmarkFoo", []string{"BenchmarkFoo(b *testing.B)"}},
+- {"func BenchmarkFoo(", "BenchmarkFoo", nil},
+- {"func Fuz", "F", []string{"FuzzXxx(f *testing.F)"}},
+- {"func Fuz(", "Fuz", []string{"Fuzz"}},
+- {"func Testx", "Testx", nil},
+- {"func TestMe(t *testing.T)", "TestMe", nil},
+- {"func Te(t *testing.T)", "Te", []string{"TestMain", "Test"}},
+- }
+- fname := "a_test.go"
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile(fname)
+- env.Await(env.DoneWithOpen())
+- for _, test := range tests {
+- env.SetBufferContent(fname, "package foo\n"+test.line)
+- loc := env.RegexpSearch(fname, test.pat)
+- loc.Range.Start.Character += uint32(protocol.UTF16Len([]byte(test.pat)))
+- completions := env.Completion(loc)
+- if diff := compareCompletionLabels(test.want, completions.Items); diff != "" {
+- t.Error(diff)
+- }
+- }
+- })
+-}
+-
+-// Test that completing a definition replaces source text when applied, golang/go#56852.
+-// Note: With go <= 1.16 the completions does not add parameters and fails these tests.
+-func TestDefinitionReplaceRange(t *testing.T) {
+- testenv.NeedsGo1Point(t, 17)
+-
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.17
+-`
+-
+- tests := []struct {
+- name string
+- before, after string
+- }{
+- {
+- name: "func TestMa",
+- before: `
+-package foo_test
+-
+-func TestMa
+-`,
+- after: `
+-package foo_test
+-
+-func TestMain(m *testing.M)
+-`,
+- },
+- {
+- name: "func TestSome",
+- before: `
+-package foo_test
+-
+-func TestSome
+-`,
+- after: `
+-package foo_test
+-
+-func TestSome(t *testing.T)
+-`,
+- },
+- {
+- name: "func Bench",
+- before: `
+-package foo_test
+-
+-func Bench
+-`,
+- // Note: Snippet with escaped }.
+- after: `
+-package foo_test
+-
+-func Benchmark${1:Xxx}(b *testing.B) {
+- $0
+-\}
+-`,
+- },
+- }
+-
+- Run(t, mod, func(t *testing.T, env *Env) {
+- env.CreateBuffer("foo_test.go", "")
+-
+- for _, tst := range tests {
+- tst.before = strings.Trim(tst.before, "\n")
+- tst.after = strings.Trim(tst.after, "\n")
+- env.SetBufferContent("foo_test.go", tst.before)
+-
+- loc := env.RegexpSearch("foo_test.go", tst.name)
+- loc.Range.Start.Character = uint32(protocol.UTF16Len([]byte(tst.name)))
+- completions := env.Completion(loc)
+- if len(completions.Items) == 0 {
+- t.Fatalf("no completion items")
+- }
+-
+- env.AcceptCompletion(loc, completions.Items[0])
+- env.Await(env.DoneWithChange())
+- if buf := env.BufferText("foo_test.go"); buf != tst.after {
+- t.Errorf("%s:incorrect completion: got %q, want %q", tst.name, buf, tst.after)
+- }
+- }
+- })
+-}
+-
+-func TestGoWorkCompletion(t *testing.T) {
+- const files = `
+--- go.work --
+-go 1.18
+-
+-use ./a
+-use ./a/ba
+-use ./a/b/
+-use ./dir/foo
+-use ./dir/foobar/
+--- a/go.mod --
+--- go.mod --
+--- a/bar/go.mod --
+--- a/b/c/d/e/f/go.mod --
+--- dir/bar --
+--- dir/foobar/go.mod --
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("go.work")
+-
+- tests := []struct {
+- re string
+- want []string
+- }{
+- {`use ()\.`, []string{".", "./a", "./a/bar", "./dir/foobar"}},
+- {`use \.()`, []string{"", "/a", "/a/bar", "/dir/foobar"}},
+- {`use \./()`, []string{"a", "a/bar", "dir/foobar"}},
+- {`use ./a()`, []string{"", "/b/c/d/e/f", "/bar"}},
+- {`use ./a/b()`, []string{"/c/d/e/f", "ar"}},
+- {`use ./a/b/()`, []string{`c/d/e/f`}},
+- {`use ./a/ba()`, []string{"r"}},
+- {`use ./dir/foo()`, []string{"bar"}},
+- {`use ./dir/foobar/()`, []string{}},
+- }
+- for _, tt := range tests {
+- completions := env.Completion(env.RegexpSearch("go.work", tt.re))
+- diff := compareCompletionLabels(tt.want, completions.Items)
+- if diff != "" {
+- t.Errorf("%s: %s", tt.re, diff)
+- }
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/completion/postfix_snippet_test.go b/gopls/internal/regtest/completion/postfix_snippet_test.go
+--- a/gopls/internal/regtest/completion/postfix_snippet_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/completion/postfix_snippet_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,464 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package completion
+-
+-import (
+- "strings"
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-func TestPostfixSnippetCompletion(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+-`
+-
+- cases := []struct {
+- name string
+- before, after string
+- }{
+- {
+- name: "sort",
+- before: `
+-package foo
+-
+-func _() {
+- var foo []int
+- foo.sort
+-}
+-`,
+- after: `
+-package foo
+-
+-import "sort"
+-
+-func _() {
+- var foo []int
+- sort.Slice(foo, func(i, j int) bool {
+- $0
+-})
+-}
+-`,
+- },
+- {
+- name: "sort_renamed_sort_package",
+- before: `
+-package foo
+-
+-import blahsort "sort"
+-
+-var j int
+-
+-func _() {
+- var foo []int
+- foo.sort
+-}
+-`,
+- after: `
+-package foo
+-
+-import blahsort "sort"
+-
+-var j int
+-
+-func _() {
+- var foo []int
+- blahsort.Slice(foo, func(i, j2 int) bool {
+- $0
+-})
+-}
+-`,
+- },
+- {
+- name: "last",
+- before: `
+-package foo
+-
+-func _() {
+- var s struct { i []int }
+- s.i.last
+-}
+-`,
+- after: `
+-package foo
+-
+-func _() {
+- var s struct { i []int }
+- s.i[len(s.i)-1]
+-}
+-`,
+- },
+- {
+- name: "reverse",
+- before: `
+-package foo
+-
+-func _() {
+- var foo []int
+- foo.reverse
+-}
+-`,
+- after: `
+-package foo
+-
+-func _() {
+- var foo []int
+- for i, j := 0, len(foo)-1; i < j; i, j = i+1, j-1 {
+- foo[i], foo[j] = foo[j], foo[i]
+-}
+-
+-}
+-`,
+- },
+- {
+- name: "slice_range",
+- before: `
+-package foo
+-
+-func _() {
+- type myThing struct{}
+- var foo []myThing
+- foo.range
+-}
+-`,
+- after: `
+-package foo
+-
+-func _() {
+- type myThing struct{}
+- var foo []myThing
+- for i, mt := range foo {
+- $0
+-}
+-}
+-`,
+- },
+- {
+- name: "append_stmt",
+- before: `
+-package foo
+-
+-func _() {
+- var foo []int
+- foo.append
+-}
+-`,
+- after: `
+-package foo
+-
+-func _() {
+- var foo []int
+- foo = append(foo, $0)
+-}
+-`,
+- },
+- {
+- name: "append_expr",
+- before: `
+-package foo
+-
+-func _() {
+- var foo []int
+- var _ []int = foo.append
+-}
+-`,
+- after: `
+-package foo
+-
+-func _() {
+- var foo []int
+- var _ []int = append(foo, $0)
+-}
+-`,
+- },
+- {
+- name: "slice_copy",
+- before: `
+-package foo
+-
+-func _() {
+- var foo []int
+- foo.copy
+-}
+-`,
+- after: `
+-package foo
+-
+-func _() {
+- var foo []int
+- fooCopy := make([]int, len(foo))
+-copy(fooCopy, foo)
+-
+-}
+-`,
+- },
+- {
+- name: "map_range",
+- before: `
+-package foo
+-
+-func _() {
+- var foo map[string]int
+- foo.range
+-}
+-`,
+- after: `
+-package foo
+-
+-func _() {
+- var foo map[string]int
+- for k, v := range foo {
+- $0
+-}
+-}
+-`,
+- },
+- {
+- name: "map_clear",
+- before: `
+-package foo
+-
+-func _() {
+- var foo map[string]int
+- foo.clear
+-}
+-`,
+- after: `
+-package foo
+-
+-func _() {
+- var foo map[string]int
+- for k := range foo {
+- delete(foo, k)
+-}
+-
+-}
+-`,
+- },
+- {
+- name: "map_keys",
+- before: `
+-package foo
+-
+-func _() {
+- var foo map[string]int
+- foo.keys
+-}
+-`,
+- after: `
+-package foo
+-
+-func _() {
+- var foo map[string]int
+- keys := make([]string, 0, len(foo))
+-for k := range foo {
+- keys = append(keys, k)
+-}
+-
+-}
+-`,
+- },
+- {
+- name: "channel_range",
+- before: `
+-package foo
+-
+-func _() {
+- foo := make(chan int)
+- foo.range
+-}
+-`,
+- after: `
+-package foo
+-
+-func _() {
+- foo := make(chan int)
+- for e := range foo {
+- $0
+-}
+-}
+-`,
+- },
+- {
+- name: "var",
+- before: `
+-package foo
+-
+-func foo() (int, error) { return 0, nil }
+-
+-func _() {
+- foo().var
+-}
+-`,
+- after: `
+-package foo
+-
+-func foo() (int, error) { return 0, nil }
+-
+-func _() {
+- i, err := foo()
+-}
+-`,
+- },
+- {
+- name: "var_single_value",
+- before: `
+-package foo
+-
+-func foo() error { return nil }
+-
+-func _() {
+- foo().var
+-}
+-`,
+- after: `
+-package foo
+-
+-func foo() error { return nil }
+-
+-func _() {
+- err := foo()
+-}
+-`,
+- },
+- {
+- name: "var_same_type",
+- before: `
+-package foo
+-
+-func foo() (int, int) { return 0, 0 }
+-
+-func _() {
+- foo().var
+-}
+-`,
+- after: `
+-package foo
+-
+-func foo() (int, int) { return 0, 0 }
+-
+-func _() {
+- i, i2 := foo()
+-}
+-`,
+- },
+- {
+- name: "print_scalar",
+- before: `
+-package foo
+-
+-func _() {
+- var foo int
+- foo.print
+-}
+-`,
+- after: `
+-package foo
+-
+-import "fmt"
+-
+-func _() {
+- var foo int
+- fmt.Printf("foo: %v\n", foo)
+-}
+-`,
+- },
+- {
+- name: "print_multi",
+- before: `
+-package foo
+-
+-func foo() (int, error) { return 0, nil }
+-
+-func _() {
+- foo().print
+-}
+-`,
+- after: `
+-package foo
+-
+-import "fmt"
+-
+-func foo() (int, error) { return 0, nil }
+-
+-func _() {
+- fmt.Println(foo())
+-}
+-`,
+- },
+- {
+- name: "string split",
+- before: `
+-package foo
+-
+-func foo() []string {
+- x := "test"
+- return x.split
+-}`,
+- after: `
+-package foo
+-
+-import "strings"
+-
+-func foo() []string {
+- x := "test"
+- return strings.Split(x, "$0")
+-}`,
+- },
+- {
+- name: "string slice join",
+- before: `
+-package foo
+-
+-func foo() string {
+- x := []string{"a", "test"}
+- return x.join
+-}`,
+- after: `
+-package foo
+-
+-import "strings"
+-
+-func foo() string {
+- x := []string{"a", "test"}
+- return strings.Join(x, "$0")
+-}`,
+- },
+- }
+-
+- r := WithOptions(
+- Settings{
+- "experimentalPostfixCompletions": true,
+- },
+- )
+- r.Run(t, mod, func(t *testing.T, env *Env) {
+- env.CreateBuffer("foo.go", "")
+-
+- for _, c := range cases {
+- t.Run(c.name, func(t *testing.T) {
+- c.before = strings.Trim(c.before, "\n")
+- c.after = strings.Trim(c.after, "\n")
+-
+- env.SetBufferContent("foo.go", c.before)
+-
+- loc := env.RegexpSearch("foo.go", "\n}")
+- completions := env.Completion(loc)
+- if len(completions.Items) != 1 {
+- t.Fatalf("expected one completion, got %v", completions.Items)
+- }
+-
+- env.AcceptCompletion(loc, completions.Items[0])
+-
+- if buf := env.BufferText("foo.go"); buf != c.after {
+- t.Errorf("\nGOT:\n%s\nEXPECTED:\n%s", buf, c.after)
+- }
+- })
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/debug/debug_test.go b/gopls/internal/regtest/debug/debug_test.go
+--- a/gopls/internal/regtest/debug/debug_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/debug/debug_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,30 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package debug
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/hooks"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/internal/bug"
+-)
+-
+-func TestMain(m *testing.M) {
+- Main(m, hooks.Options)
+-}
+-
+-func TestBugNotification(t *testing.T) {
+- // Verify that a properly configured session gets notified of a bug on the
+- // server.
+- WithOptions(
+- Modes(Default), // must be in-process to receive the bug report below
+- Settings{"showBugReports": true},
+- ).Run(t, "", func(t *testing.T, env *Env) {
+- const desc = "got a bug"
+- bug.Report(desc, nil)
+- env.Await(ShownMessage(desc))
+- })
+-}
+diff -urN a/gopls/internal/regtest/diagnostics/analysis_test.go b/gopls/internal/regtest/diagnostics/analysis_test.go
+--- a/gopls/internal/regtest/diagnostics/analysis_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/diagnostics/analysis_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,49 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package diagnostics
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-// Test for the timeformat analyzer, following golang/vscode-go#2406.
+-//
+-// This test checks that applying the suggested fix from the analyzer resolves
+-// the diagnostic warning.
+-func TestTimeFormatAnalyzer(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- main.go --
+-package main
+-
+-import (
+- "fmt"
+- "time"
+-)
+-
+-func main() {
+- now := time.Now()
+- fmt.Println(now.Format("2006-02-01"))
+-}`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+-
+- var d protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("main.go", "2006-02-01")),
+- ReadDiagnostics("main.go", &d),
+- )
+-
+- env.ApplyQuickFixes("main.go", d.Diagnostics)
+- env.AfterChange(NoDiagnostics(ForFile("main.go")))
+- })
+-}
+diff -urN a/gopls/internal/regtest/diagnostics/builtin_test.go b/gopls/internal/regtest/diagnostics/builtin_test.go
+--- a/gopls/internal/regtest/diagnostics/builtin_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/diagnostics/builtin_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,35 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package diagnostics
+-
+-import (
+- "strings"
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-func TestIssue44866(t *testing.T) {
+- src := `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- a.go --
+-package a
+-
+-const (
+- c = iota
+-)
+-`
+- Run(t, src, func(t *testing.T, env *Env) {
+- env.OpenFile("a.go")
+- loc := env.GoToDefinition(env.RegexpSearch("a.go", "iota"))
+- if !strings.HasSuffix(string(loc.URI), "builtin.go") {
+- t.Fatalf("jumped to %q, want builtin.go", loc.URI)
+- }
+- env.AfterChange(NoDiagnostics(ForFile("builtin.go")))
+- })
+-}
+diff -urN a/gopls/internal/regtest/diagnostics/diagnostics_test.go b/gopls/internal/regtest/diagnostics/diagnostics_test.go
+--- a/gopls/internal/regtest/diagnostics/diagnostics_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/diagnostics/diagnostics_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,2048 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package diagnostics
+-
+-import (
+- "context"
+- "fmt"
+- "os/exec"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/hooks"
+- "golang.org/x/tools/gopls/internal/lsp"
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-func TestMain(m *testing.M) {
+- bug.PanicOnBugs = true
+- Main(m, hooks.Options)
+-}
+-
+-// Use mod.com for all go.mod files due to golang/go#35230.
+-const exampleProgram = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-import "fmt"
+-
+-func main() {
+- fmt.Println("Hello World.")
+-}`
+-
+-func TestDiagnosticErrorInEditedFile(t *testing.T) {
+- // This test is very basic: start with a clean Go program, make an error, and
+- // get a diagnostic for that error. However, it also demonstrates how to
+- // combine Expectations to await more complex state in the editor.
+- Run(t, exampleProgram, func(t *testing.T, env *Env) {
+- // Deleting the 'n' at the end of Println should generate a single error
+- // diagnostic.
+- env.OpenFile("main.go")
+- env.RegexpReplace("main.go", "Printl(n)", "")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("main.go", "Printl")),
+- // Assert that this test has sent no error logs to the client. This is not
+- // strictly necessary for testing this regression, but is included here
+- // as an example of using the NoErrorLogs() expectation. Feel free to
+- // delete.
+- NoErrorLogs(),
+- )
+- })
+-}
+-
+-func TestMissingImportDiagsClearOnFirstFile(t *testing.T) {
+- const onlyMod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+-`
+- Run(t, onlyMod, func(t *testing.T, env *Env) {
+- env.CreateBuffer("main.go", `package main
+-
+-func m() {
+- log.Println()
+-}
+-`)
+- env.AfterChange(Diagnostics(env.AtRegexp("main.go", "log")))
+- env.SaveBuffer("main.go")
+- env.AfterChange(NoDiagnostics(ForFile("main.go")))
+- })
+-}
+-
+-func TestDiagnosticErrorInNewFile(t *testing.T) {
+- const brokenFile = `package main
+-
+-const Foo = "abc
+-`
+- Run(t, brokenFile, func(t *testing.T, env *Env) {
+- env.CreateBuffer("broken.go", brokenFile)
+- env.AfterChange(Diagnostics(env.AtRegexp("broken.go", "\"abc")))
+- })
+-}
+-
+-// badPackage contains a duplicate definition of the 'a' const.
+-const badPackage = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- a.go --
+-package consts
+-
+-const a = 1
+--- b.go --
+-package consts
+-
+-const a = 2
+-`
+-
+-func TestDiagnosticClearingOnEdit(t *testing.T) {
+- Run(t, badPackage, func(t *testing.T, env *Env) {
+- env.OpenFile("b.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a.go", "a = 1")),
+- Diagnostics(env.AtRegexp("b.go", "a = 2")),
+- )
+-
+- // Fix the error by editing the const name in b.go to `b`.
+- env.RegexpReplace("b.go", "(a) = 2", "b")
+- env.AfterChange(
+- NoDiagnostics(ForFile("a.go")),
+- NoDiagnostics(ForFile("b.go")),
+- )
+- })
+-}
+-
+-func TestDiagnosticClearingOnDelete_Issue37049(t *testing.T) {
+- Run(t, badPackage, func(t *testing.T, env *Env) {
+- env.OpenFile("a.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a.go", "a = 1")),
+- Diagnostics(env.AtRegexp("b.go", "a = 2")),
+- )
+- env.RemoveWorkspaceFile("b.go")
+-
+- env.AfterChange(
+- NoDiagnostics(ForFile("a.go")),
+- NoDiagnostics(ForFile("b.go")),
+- )
+- })
+-}
+-
+-func TestDiagnosticClearingOnClose(t *testing.T) {
+- Run(t, badPackage, func(t *testing.T, env *Env) {
+- env.CreateBuffer("c.go", `package consts
+-
+-const a = 3`)
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a.go", "a = 1")),
+- Diagnostics(env.AtRegexp("b.go", "a = 2")),
+- Diagnostics(env.AtRegexp("c.go", "a = 3")),
+- )
+- env.CloseBuffer("c.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a.go", "a = 1")),
+- Diagnostics(env.AtRegexp("b.go", "a = 2")),
+- NoDiagnostics(ForFile("c.go")),
+- )
+- })
+-}
+-
+-// Tests golang/go#37978.
+-func TestIssue37978(t *testing.T) {
+- Run(t, exampleProgram, func(t *testing.T, env *Env) {
+- // Create a new workspace-level directory and empty file.
+- env.CreateBuffer("c/c.go", "")
+-
+- // Write the file contents with a missing import.
+- env.EditBuffer("c/c.go", protocol.TextEdit{
+- NewText: `package c
+-
+-const a = http.MethodGet
+-`,
+- })
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("c/c.go", "http.MethodGet")),
+- )
+- // Save file, which will organize imports, adding the expected import.
+- // Expect the diagnostics to clear.
+- env.SaveBuffer("c/c.go")
+- env.AfterChange(
+- NoDiagnostics(ForFile("c/c.go")),
+- )
+- })
+-}
+-
+-// Tests golang/go#38878: good a.go, bad a_test.go, remove a_test.go but its errors remain
+-// If the file is open in the editor, this is working as intended
+-// If the file is not open in the editor, the errors go away
+-const test38878 = `
+--- go.mod --
+-module foo
+-
+-go 1.12
+--- a.go --
+-package x
+-
+-// import "fmt"
+-
+-func f() {}
+-
+--- a_test.go --
+-package x
+-
+-import "testing"
+-
+-func TestA(t *testing.T) {
+- f(3)
+-}
+-`
+-
+-// Tests golang/go#38878: deleting a test file should clear its errors, and
+-// not break the workspace.
+-func TestDeleteTestVariant(t *testing.T) {
+- Run(t, test38878, func(t *testing.T, env *Env) {
+- env.AfterChange(Diagnostics(env.AtRegexp("a_test.go", `f\((3)\)`)))
+- env.RemoveWorkspaceFile("a_test.go")
+- env.AfterChange(NoDiagnostics(ForFile("a_test.go")))
+-
+- // Make sure the test variant has been removed from the workspace by
+- // triggering a metadata load.
+- env.OpenFile("a.go")
+- env.RegexpReplace("a.go", `// import`, "import")
+- env.AfterChange(Diagnostics(env.AtRegexp("a.go", `"fmt"`)))
+- })
+-}
+-
+-// Tests golang/go#38878: deleting a test file on disk while it's still open
+-// should not clear its errors.
+-func TestDeleteTestVariant_DiskOnly(t *testing.T) {
+- Run(t, test38878, func(t *testing.T, env *Env) {
+- env.OpenFile("a_test.go")
+- env.AfterChange(Diagnostics(AtPosition("a_test.go", 5, 3)))
+- env.Sandbox.Workdir.RemoveFile(context.Background(), "a_test.go")
+- env.AfterChange(Diagnostics(AtPosition("a_test.go", 5, 3)))
+- })
+-}
+-
+-// TestNoMod confirms that gopls continues to work when a user adds a go.mod
+-// file to their workspace.
+-func TestNoMod(t *testing.T) {
+- const noMod = `
+--- main.go --
+-package main
+-
+-import "mod.com/bob"
+-
+-func main() {
+- bob.Hello()
+-}
+--- bob/bob.go --
+-package bob
+-
+-func Hello() {
+- var x int
+-}
+-`
+-
+- t.Run("manual", func(t *testing.T) {
+- Run(t, noMod, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("main.go", `"mod.com/bob"`)),
+- )
+- env.CreateBuffer("go.mod", `module mod.com
+-
+- go 1.12
+-`)
+- env.SaveBuffer("go.mod")
+- var d protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- Diagnostics(env.AtRegexp("bob/bob.go", "x")),
+- ReadDiagnostics("bob/bob.go", &d),
+- )
+- if len(d.Diagnostics) != 1 {
+- t.Fatalf("expected 1 diagnostic, got %v", len(d.Diagnostics))
+- }
+- })
+- })
+- t.Run("initialized", func(t *testing.T) {
+- Run(t, noMod, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("main.go", `"mod.com/bob"`)),
+- )
+- env.RunGoCommand("mod", "init", "mod.com")
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- Diagnostics(env.AtRegexp("bob/bob.go", "x")),
+- )
+- })
+- })
+-
+- t.Run("without workspace module", func(t *testing.T) {
+- WithOptions(
+- Modes(Default),
+- ).Run(t, noMod, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("main.go", `"mod.com/bob"`)),
+- )
+- if err := env.Sandbox.RunGoCommand(env.Ctx, "", "mod", []string{"init", "mod.com"}, true); err != nil {
+- t.Fatal(err)
+- }
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- Diagnostics(env.AtRegexp("bob/bob.go", "x")),
+- )
+- })
+- })
+-}
+-
+-// Tests golang/go#38267.
+-func TestIssue38267(t *testing.T) {
+- const testPackage = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- lib.go --
+-package lib
+-
+-func Hello(x string) {
+- _ = x
+-}
+--- lib_test.go --
+-package lib
+-
+-import "testing"
+-
+-type testStruct struct{
+- name string
+-}
+-
+-func TestHello(t *testing.T) {
+- testStructs := []*testStruct{
+- &testStruct{"hello"},
+- &testStruct{"goodbye"},
+- }
+- for y := range testStructs {
+- _ = y
+- }
+-}
+-`
+-
+- Run(t, testPackage, func(t *testing.T, env *Env) {
+- env.OpenFile("lib_test.go")
+- env.AfterChange(
+- Diagnostics(AtPosition("lib_test.go", 10, 2)),
+- Diagnostics(AtPosition("lib_test.go", 11, 2)),
+- )
+- env.OpenFile("lib.go")
+- env.RegexpReplace("lib.go", "_ = x", "var y int")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("lib.go", "y int")),
+- NoDiagnostics(ForFile("lib_test.go")),
+- )
+- })
+-}
+-
+-// Tests golang/go#38328.
+-func TestPackageChange_Issue38328(t *testing.T) {
+- const packageChange = `
+--- go.mod --
+-module fake
+-
+-go 1.12
+--- a.go --
+-package foo
+-func main() {}
+-`
+- Run(t, packageChange, func(t *testing.T, env *Env) {
+- env.OpenFile("a.go")
+- env.RegexpReplace("a.go", "foo", "foox")
+- env.AfterChange(
+- NoDiagnostics(ForFile("a.go")),
+- )
+- })
+-}
+-
+-const testPackageWithRequire = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+-
+-require foo.test v1.2.3
+--- go.sum --
+-foo.test v1.2.3 h1:TMA+lyd1ck0TqjSFpNe4T6cf/K6TYkoHwOOcMBMjaEw=
+-foo.test v1.2.3/go.mod h1:Ij3kyLIe5lzjycjh13NL8I2gX0quZuTdW0MnmlwGBL4=
+--- print.go --
+-package lib
+-
+-import (
+- "fmt"
+-
+- "foo.test/bar"
+-)
+-
+-func PrintAnswer() {
+- fmt.Printf("answer: %s", bar.Answer)
+-}
+-`
+-
+-const testPackageWithRequireProxy = `
+--- foo.test@v1.2.3/go.mod --
+-module foo.test
+-
+-go 1.12
+--- foo.test@v1.2.3/bar/const.go --
+-package bar
+-
+-const Answer = 42
+-`
+-
+-func TestResolveDiagnosticWithDownload(t *testing.T) {
+- WithOptions(
+- ProxyFiles(testPackageWithRequireProxy),
+- ).Run(t, testPackageWithRequire, func(t *testing.T, env *Env) {
+- env.OpenFile("print.go")
+- // Check that gopackages correctly loaded this dependency. We should get a
+- // diagnostic for the wrong formatting type.
+- env.AfterChange(
+- Diagnostics(
+- env.AtRegexp("print.go", "fmt.Printf"),
+- WithMessage("wrong type int"),
+- ),
+- )
+- })
+-}
+-
+-func TestMissingDependency(t *testing.T) {
+- Run(t, testPackageWithRequire, func(t *testing.T, env *Env) {
+- env.OpenFile("print.go")
+- env.Await(LogMatching(protocol.Error, "initial workspace load failed", 1, false))
+- })
+-}
+-
+-// Tests golang/go#36951.
+-func TestAdHocPackages_Issue36951(t *testing.T) {
+- const adHoc = `
+--- b/b.go --
+-package b
+-
+-func Hello() {
+- var x int
+-}
+-`
+- Run(t, adHoc, func(t *testing.T, env *Env) {
+- env.OpenFile("b/b.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("b/b.go", "x")),
+- )
+- })
+-}
+-
+-// Tests golang/go#37984: GOPATH should be read from the go command.
+-func TestNoGOPATH_Issue37984(t *testing.T) {
+- const files = `
+--- main.go --
+-package main
+-
+-func _() {
+- fmt.Println("Hello World")
+-}
+-`
+- WithOptions(
+- EnvVars{
+- "GOPATH": "",
+- "GO111MODULE": "off",
+- },
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.AfterChange(Diagnostics(env.AtRegexp("main.go", "fmt")))
+- env.SaveBuffer("main.go")
+- env.AfterChange(NoDiagnostics(ForFile("main.go")))
+- })
+-}
+-
+-// Tests golang/go#38669.
+-func TestEqualInEnv_Issue38669(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-var _ = x.X
+--- x/x.go --
+-package x
+-
+-var X = 0
+-`
+- WithOptions(
+- EnvVars{"GOFLAGS": "-tags=foo"},
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.OrganizeImports("main.go")
+- env.AfterChange(NoDiagnostics(ForFile("main.go")))
+- })
+-}
+-
+-// Tests golang/go#38467.
+-func TestNoSuggestedFixesForGeneratedFiles_Issue38467(t *testing.T) {
+- const generated = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-// Code generated by generator.go. DO NOT EDIT.
+-
+-func _() {
+- for i, _ := range []string{} {
+- _ = i
+- }
+-}
+-`
+- Run(t, generated, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- var d protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- Diagnostics(AtPosition("main.go", 5, 8)),
+- ReadDiagnostics("main.go", &d),
+- )
+- if fixes := env.GetQuickFixes("main.go", d.Diagnostics); len(fixes) != 0 {
+- t.Errorf("got quick fixes %v, wanted none", fixes)
+- }
+- })
+-}
+-
+-// Expect a module/GOPATH error if there is an error in the file at startup.
+-// Tests golang/go#37279.
+-func TestBrokenWorkspace_OutsideModule(t *testing.T) {
+- const noModule = `
+--- a.go --
+-package foo
+-
+-import "mod.com/hello"
+-
+-func f() {
+- hello.Goodbye()
+-}
+-`
+- Run(t, noModule, func(t *testing.T, env *Env) {
+- env.OpenFile("a.go")
+- env.AfterChange(
+- // Expect the adHocPackagesWarning.
+- OutstandingWork(lsp.WorkspaceLoadFailure, "outside of a module"),
+- )
+- // Deleting the import dismisses the warning.
+- env.RegexpReplace("a.go", `import "mod.com/hello"`, "")
+- env.AfterChange(
+- NoOutstandingWork(),
+- )
+- })
+-}
+-
+-func TestNonGoFolder(t *testing.T) {
+- const files = `
+--- hello.txt --
+-hi mom
+-`
+- for _, go111module := range []string{"on", "off", ""} {
+- t.Run(fmt.Sprintf("GO111MODULE_%v", go111module), func(t *testing.T) {
+- WithOptions(
+- EnvVars{"GO111MODULE": go111module},
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- NoOutstandingWork(),
+- )
+- })
+- })
+- }
+-}
+-
+-// Tests the repro case from golang/go#38602. Diagnostics are now handled properly,
+-// which blocks type checking.
+-func TestConflictingMainPackageErrors(t *testing.T) {
+- const collision = `
+--- x/x.go --
+-package x
+-
+-import "x/hello"
+-
+-func Hello() {
+- hello.HiThere()
+-}
+--- x/main.go --
+-package main
+-
+-func main() {
+- fmt.Println("")
+-}
+-`
+- WithOptions(
+- InGOPATH(),
+- EnvVars{"GO111MODULE": "off"},
+- ).Run(t, collision, func(t *testing.T, env *Env) {
+- env.OpenFile("x/x.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("x/x.go", `^`), WithMessage("found packages main (main.go) and x (x.go)")),
+- Diagnostics(env.AtRegexp("x/main.go", `^`), WithMessage("found packages main (main.go) and x (x.go)")),
+- )
+-
+- // We don't recover cleanly from the errors without good overlay support.
+- if testenv.Go1Point() >= 16 {
+- env.RegexpReplace("x/x.go", `package x`, `package main`)
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("x/main.go", `fmt`)),
+- )
+- }
+- })
+-}
+-
+-const ardanLabsProxy = `
+--- github.com/ardanlabs/conf@v1.2.3/go.mod --
+-module github.com/ardanlabs/conf
+-
+-go 1.12
+--- github.com/ardanlabs/conf@v1.2.3/conf.go --
+-package conf
+-
+-var ErrHelpWanted error
+-`
+-
+-// Test for golang/go#38211.
+-func Test_Issue38211(t *testing.T) {
+- const ardanLabs = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- main.go --
+-package main
+-
+-import "github.com/ardanlabs/conf"
+-
+-func main() {
+- _ = conf.ErrHelpWanted
+-}
+-`
+- WithOptions(
+- ProxyFiles(ardanLabsProxy),
+- ).Run(t, ardanLabs, func(t *testing.T, env *Env) {
+- // Expect a diagnostic with a suggested fix to add
+- // "github.com/ardanlabs/conf" to the go.mod file.
+- env.OpenFile("go.mod")
+- env.OpenFile("main.go")
+- var d protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("main.go", `"github.com/ardanlabs/conf"`)),
+- ReadDiagnostics("main.go", &d),
+- )
+- env.ApplyQuickFixes("main.go", d.Diagnostics)
+- env.SaveBuffer("go.mod")
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- )
+- // Comment out the line that depends on conf and expect a
+- // diagnostic and a fix to remove the import.
+- env.RegexpReplace("main.go", "_ = conf.ErrHelpWanted", "//_ = conf.ErrHelpWanted")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("main.go", `"github.com/ardanlabs/conf"`)),
+- )
+- env.SaveBuffer("main.go")
+- // Expect a diagnostic and fix to remove the dependency in the go.mod.
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- Diagnostics(env.AtRegexp("go.mod", "require github.com/ardanlabs/conf"), WithMessage("not used in this module")),
+- ReadDiagnostics("go.mod", &d),
+- )
+- env.ApplyQuickFixes("go.mod", d.Diagnostics)
+- env.SaveBuffer("go.mod")
+- env.AfterChange(
+- NoDiagnostics(ForFile("go.mod")),
+- )
+- // Uncomment the lines and expect a new diagnostic for the import.
+- env.RegexpReplace("main.go", "//_ = conf.ErrHelpWanted", "_ = conf.ErrHelpWanted")
+- env.SaveBuffer("main.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("main.go", `"github.com/ardanlabs/conf"`)),
+- )
+- })
+-}
+-
+-// Test for golang/go#38207.
+-func TestNewModule_Issue38207(t *testing.T) {
+- const emptyFile = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-`
+- WithOptions(
+- ProxyFiles(ardanLabsProxy),
+- ).Run(t, emptyFile, func(t *testing.T, env *Env) {
+- env.CreateBuffer("main.go", `package main
+-
+-import "github.com/ardanlabs/conf"
+-
+-func main() {
+- _ = conf.ErrHelpWanted
+-}
+-`)
+- env.SaveBuffer("main.go")
+- var d protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("main.go", `"github.com/ardanlabs/conf"`), WithMessage("no required module")),
+- ReadDiagnostics("main.go", &d),
+- )
+- env.ApplyQuickFixes("main.go", d.Diagnostics)
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- )
+- })
+-}
+-
+-// Test for golang/go#36960.
+-func TestNewFileBadImports_Issue36960(t *testing.T) {
+- const simplePackage = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- a/a1.go --
+-package a
+-
+-import "fmt"
+-
+-func _() {
+- fmt.Println("hi")
+-}
+-`
+- Run(t, simplePackage, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a1.go")
+- env.CreateBuffer("a/a2.go", ``)
+- env.SaveBufferWithoutActions("a/a2.go")
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a1.go")),
+- )
+- env.EditBuffer("a/a2.go", fake.NewEdit(0, 0, 0, 0, `package a`))
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a1.go")),
+- )
+- })
+-}
+-
+-// This test tries to replicate the workflow of a user creating a new x test.
+-// It also tests golang/go#39315.
+-func TestManuallyCreatingXTest(t *testing.T) {
+- // Create a package that already has a test variant (in-package test).
+- const testVariant = `
+--- go.mod --
+-module mod.com
+-
+-go 1.15
+--- hello/hello.go --
+-package hello
+-
+-func Hello() {
+- var x int
+-}
+--- hello/hello_test.go --
+-package hello
+-
+-import "testing"
+-
+-func TestHello(t *testing.T) {
+- var x int
+- Hello()
+-}
+-`
+- Run(t, testVariant, func(t *testing.T, env *Env) {
+- // Open the file, triggering the workspace load.
+- // There are errors in the code to ensure all is working as expected.
+- env.OpenFile("hello/hello.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("hello/hello.go", "x")),
+- Diagnostics(env.AtRegexp("hello/hello_test.go", "x")),
+- )
+-
+- // Create an empty file with the intention of making it an x test.
+- // This resembles a typical flow in an editor like VS Code, in which
+- // a user would create an empty file and add content, saving
+- // intermittently.
+- // TODO(rstambler): There might be more edge cases here, as file
+- // content can be added incrementally.
+- env.CreateBuffer("hello/hello_x_test.go", ``)
+-
+- // Save the empty file (no actions since formatting will fail).
+- env.SaveBufferWithoutActions("hello/hello_x_test.go")
+-
+- // Add the content. The missing import is for the package under test.
+- env.EditBuffer("hello/hello_x_test.go", fake.NewEdit(0, 0, 0, 0, `package hello_test
+-
+-import (
+- "testing"
+-)
+-
+-func TestHello(t *testing.T) {
+- hello.Hello()
+-}
+-`))
+- // Expect a diagnostic for the missing import. Save, which should
+- // trigger import organization. The diagnostic should clear.
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("hello/hello_x_test.go", "hello.Hello")),
+- )
+- env.SaveBuffer("hello/hello_x_test.go")
+- env.AfterChange(
+- NoDiagnostics(ForFile("hello/hello_x_test.go")),
+- )
+- })
+-}
+-
+-// Reproduce golang/go#40690.
+-func TestCreateOnlyXTest(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- foo/foo.go --
+-package foo
+--- foo/bar_test.go --
+-`
+- Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("foo/bar_test.go")
+- env.EditBuffer("foo/bar_test.go", fake.NewEdit(0, 0, 0, 0, "package foo"))
+- env.Await(env.DoneWithChange())
+- env.RegexpReplace("foo/bar_test.go", "package foo", `package foo_test
+-
+-import "testing"
+-
+-func TestX(t *testing.T) {
+- var x int
+-}
+-`)
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("foo/bar_test.go", "x")),
+- )
+- })
+-}
+-
+-func TestChangePackageName(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- foo/foo.go --
+-package foo
+--- foo/bar_test.go --
+-package foo_
+-`
+- Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("foo/bar_test.go")
+- env.AfterChange()
+- env.RegexpReplace("foo/bar_test.go", "package foo_", "package foo_test")
+- env.AfterChange(
+- NoDiagnostics(ForFile("foo/bar_test.go")),
+- NoDiagnostics(ForFile("foo/foo.go")),
+- )
+- })
+-}
+-
+-func TestIgnoredFiles(t *testing.T) {
+- const ws = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- _foo/x.go --
+-package x
+-
+-var _ = foo.Bar
+-`
+- Run(t, ws, func(t *testing.T, env *Env) {
+- env.OpenFile("_foo/x.go")
+- env.AfterChange(
+- NoDiagnostics(ForFile("_foo/x.go")),
+- )
+- })
+-}
+-
+-// Partially reproduces golang/go#38977, moving a file between packages.
+-// It also gets hit by some go command bug fixed in 1.15, but we don't
+-// care about that so much here.
+-func TestDeletePackage(t *testing.T) {
+- const ws = `
+--- go.mod --
+-module mod.com
+-
+-go 1.15
+--- a/a.go --
+-package a
+-
+-const A = 1
+-
+--- b/b.go --
+-package b
+-
+-import "mod.com/a"
+-
+-const B = a.A
+-
+--- c/c.go --
+-package c
+-
+-import "mod.com/a"
+-
+-const C = a.A
+-`
+- Run(t, ws, func(t *testing.T, env *Env) {
+- env.OpenFile("b/b.go")
+- env.Await(env.DoneWithOpen())
+- // Delete c/c.go, the only file in package c.
+- env.RemoveWorkspaceFile("c/c.go")
+-
+- // We should still get diagnostics for files that exist.
+- env.RegexpReplace("b/b.go", `a.A`, "a.Nonexistant")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("b/b.go", `Nonexistant`)),
+- )
+- })
+-}
+-
+-// This is a copy of the scenario_default/quickfix_empty_files.txt test from
+-// govim. Reproduces golang/go#39646.
+-func TestQuickFixEmptyFiles(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+-`
+- // To fully recreate the govim tests, we create files by inserting
+- // a newline, adding to the file, and then deleting the newline.
+- // Wait for each event to process to avoid cancellations and force
+- // package loads.
+- writeGoVim := func(env *Env, name, content string) {
+- env.WriteWorkspaceFile(name, "")
+- env.Await(env.DoneWithChangeWatchedFiles())
+-
+- env.CreateBuffer(name, "\n")
+- env.Await(env.DoneWithOpen())
+-
+- env.EditBuffer(name, fake.NewEdit(1, 0, 1, 0, content))
+- env.Await(env.DoneWithChange())
+-
+- env.EditBuffer(name, fake.NewEdit(0, 0, 1, 0, ""))
+- env.Await(env.DoneWithChange())
+- }
+-
+- const p = `package p; func DoIt(s string) {};`
+- const main = `package main
+-
+-import "mod.com/p"
+-
+-func main() {
+- p.DoIt(5)
+-}
+-`
+- // A simple version of the test that reproduces most of the problems it
+- // exposes.
+- t.Run("short", func(t *testing.T) {
+- Run(t, mod, func(t *testing.T, env *Env) {
+- writeGoVim(env, "p/p.go", p)
+- writeGoVim(env, "main.go", main)
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("main.go", "5")),
+- )
+- })
+- })
+-
+- // A full version that replicates the whole flow of the test.
+- t.Run("full", func(t *testing.T) {
+- Run(t, mod, func(t *testing.T, env *Env) {
+- writeGoVim(env, "p/p.go", p)
+- writeGoVim(env, "main.go", main)
+- writeGoVim(env, "p/p_test.go", `package p
+-
+-import "testing"
+-
+-func TestDoIt(t *testing.T) {
+- DoIt(5)
+-}
+-`)
+- writeGoVim(env, "p/x_test.go", `package p_test
+-
+-import (
+- "testing"
+-
+- "mod.com/p"
+-)
+-
+-func TestDoIt(t *testing.T) {
+- p.DoIt(5)
+-}
+-`)
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("main.go", "5")),
+- Diagnostics(env.AtRegexp("p/p_test.go", "5")),
+- Diagnostics(env.AtRegexp("p/x_test.go", "5")),
+- )
+- env.RegexpReplace("p/p.go", "s string", "i int")
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- NoDiagnostics(ForFile("p/p_test.go")),
+- NoDiagnostics(ForFile("p/x_test.go")),
+- )
+- })
+- })
+-}
+-
+-func TestSingleFile(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.13
+--- a/a.go --
+-package a
+-
+-func _() {
+- var x int
+-}
+-`
+- WithOptions(
+- // Empty workspace folders.
+- WorkspaceFolders(),
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/a.go", "x")),
+- )
+- })
+-}
+-
+-// Reproduces the case described in
+-// https://github.com/golang/go/issues/39296#issuecomment-652058883.
+-func TestPkgm(t *testing.T) {
+- const basic = `
+--- go.mod --
+-module mod.com
+-
+-go 1.15
+--- foo/foo.go --
+-package foo
+-
+-import "fmt"
+-
+-func Foo() {
+- fmt.Println("")
+-}
+-`
+- Run(t, basic, func(t *testing.T, env *Env) {
+- env.WriteWorkspaceFile("foo/foo_test.go", `package main
+-
+-func main() {
+-
+-}`)
+- env.OpenFile("foo/foo_test.go")
+- env.RegexpReplace("foo/foo_test.go", `package main`, `package foo`)
+- env.AfterChange(NoDiagnostics(ForFile("foo/foo.go")))
+- })
+-}
+-
+-func TestClosingBuffer(t *testing.T) {
+- const basic = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- main.go --
+-package main
+-
+-func main() {}
+-`
+- Run(t, basic, func(t *testing.T, env *Env) {
+- env.Editor.CreateBuffer(env.Ctx, "foo.go", `package main`)
+- env.AfterChange()
+- env.CloseBuffer("foo.go")
+- env.AfterChange(NoLogMatching(protocol.Info, "packages=0"))
+- })
+-}
+-
+-// Reproduces golang/go#38424.
+-func TestCutAndPaste(t *testing.T) {
+- const basic = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- main2.go --
+-package main
+-`
+- Run(t, basic, func(t *testing.T, env *Env) {
+- env.CreateBuffer("main.go", "")
+- env.Await(env.DoneWithOpen())
+-
+- env.SaveBufferWithoutActions("main.go")
+- env.Await(env.DoneWithSave(), env.DoneWithChangeWatchedFiles())
+-
+- env.EditBuffer("main.go", fake.NewEdit(0, 0, 0, 0, `package main
+-
+-func main() {
+-}
+-`))
+- env.Await(env.DoneWithChange())
+-
+- env.SaveBuffer("main.go")
+- env.Await(env.DoneWithSave(), env.DoneWithChangeWatchedFiles())
+-
+- env.EditBuffer("main.go", fake.NewEdit(0, 0, 4, 0, ""))
+- env.Await(env.DoneWithChange())
+-
+- env.EditBuffer("main.go", fake.NewEdit(0, 0, 0, 0, `package main
+-
+-func main() {
+- var x int
+-}
+-`))
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("main.go", "x")),
+- )
+- })
+-}
+-
+-// Reproduces golang/go#39763.
+-func TestInvalidPackageName(t *testing.T) {
+- const pkgDefault = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package default
+-
+-func main() {}
+-`
+- Run(t, pkgDefault, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.AfterChange(
+- Diagnostics(
+- env.AtRegexp("main.go", "default"),
+- WithMessage("expected 'IDENT'"),
+- ),
+- )
+- })
+-}
+-
+-// This tests the functionality of the "limitWorkspaceScope"
+-func TestLimitWorkspaceScope(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- a/main.go --
+-package main
+-
+-func main() {}
+--- main.go --
+-package main
+-
+-func main() {
+- var x int
+-}
+-`
+- WithOptions(
+- WorkspaceFolders("a"),
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("a/main.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("main.go", "x")),
+- )
+- })
+- WithOptions(
+- WorkspaceFolders("a"),
+- Settings{"expandWorkspaceToModule": false},
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("a/main.go")
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- )
+- })
+-}
+-
+-func TestSimplifyCompositeLitDiagnostic(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-import "fmt"
+-
+-type t struct {
+- msg string
+-}
+-
+-func main() {
+- x := []t{t{"msg"}}
+- fmt.Println(x)
+-}
+-`
+-
+- WithOptions(
+- Settings{"staticcheck": true},
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- var d protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("main.go", `t{"msg"}`), WithMessage("redundant type")),
+- ReadDiagnostics("main.go", &d),
+- )
+- if tags := d.Diagnostics[0].Tags; len(tags) == 0 || tags[0] != protocol.Unnecessary {
+- t.Errorf("wanted Unnecessary tag on diagnostic, got %v", tags)
+- }
+- env.ApplyQuickFixes("main.go", d.Diagnostics)
+- env.AfterChange(NoDiagnostics(ForFile("main.go")))
+- })
+-}
+-
+-// Test some secondary diagnostics
+-func TestSecondaryDiagnostics(t *testing.T) {
+- const dir = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-func main() {
+- panic("not here")
+-}
+--- other.go --
+-package main
+-func main() {}
+-`
+- Run(t, dir, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.OpenFile("other.go")
+- var mainDiags, otherDiags protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- ReadDiagnostics("main.go", &mainDiags),
+- ReadDiagnostics("other.go", &otherDiags),
+- )
+- if len(mainDiags.Diagnostics) != 1 {
+- t.Fatalf("main.go, got %d diagnostics, expected 1", len(mainDiags.Diagnostics))
+- }
+- keep := mainDiags.Diagnostics[0]
+- if len(otherDiags.Diagnostics) != 1 {
+- t.Fatalf("other.go: got %d diagnostics, expected 1", len(otherDiags.Diagnostics))
+- }
+- if len(otherDiags.Diagnostics[0].RelatedInformation) != 1 {
+- t.Fatalf("got %d RelatedInformations, expected 1", len(otherDiags.Diagnostics[0].RelatedInformation))
+- }
+- // check that the RelatedInformation matches the error from main.go
+- c := otherDiags.Diagnostics[0].RelatedInformation[0]
+- if c.Location.Range != keep.Range {
+- t.Errorf("locations don't match. Got %v expected %v", c.Location.Range, keep.Range)
+- }
+- })
+-}
+-
+-func TestNotifyOrphanedFiles(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- a/a.go --
+-package a
+-
+-func main() {
+- var x int
+-}
+--- a/a_exclude.go --
+-// +build exclude
+-
+-package a
+-
+-func _() {
+- var x int
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/a.go", "x")),
+- )
+- env.OpenFile("a/a_exclude.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/a_exclude.go", "package (a)")),
+- )
+- })
+-}
+-
+-func TestEnableAllExperiments(t *testing.T) {
+- // Before the oldest supported Go version, gopls sends a warning to upgrade
+- // Go, which fails the expectation below.
+- testenv.NeedsGo1Point(t, lsp.OldestSupportedGoVersion())
+-
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-import "bytes"
+-
+-func b(c bytes.Buffer) {
+- _ = 1
+-}
+-`
+- WithOptions(
+- Settings{"allExperiments": true},
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- // Confirm that the setting doesn't cause any warnings.
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- NoShownMessage(""), // empty substring to match any message
+- )
+- })
+-}
+-
+-func TestSwig(t *testing.T) {
+- // This is fixed in Go 1.17, but not earlier.
+- testenv.NeedsGo1Point(t, 17)
+-
+- if _, err := exec.LookPath("swig"); err != nil {
+- t.Skip("skipping test: swig not available")
+- }
+- if _, err := exec.LookPath("g++"); err != nil {
+- t.Skip("skipping test: g++ not available")
+- }
+-
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- pkg/simple/export_swig.go --
+-package simple
+-
+-func ExportSimple(x, y int) int {
+- return Gcd(x, y)
+-}
+--- pkg/simple/simple.swigcxx --
+-%module simple
+-
+-%inline %{
+-extern int gcd(int x, int y)
+-{
+- int g;
+- g = y;
+- while (x > 0) {
+- g = x;
+- x = y % x;
+- y = g;
+- }
+- return g;
+-}
+-%}
+--- main.go --
+-package a
+-
+-func main() {
+- var x int
+-}
+-`
+- Run(t, mod, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- NoDiagnostics(WithMessage("illegal character U+0023 '#'")),
+- )
+- })
+-}
+-
+-// When foo_test.go is opened, gopls will object to the borked package name.
+-// This test asserts that when the package name is fixed, gopls will soon after
+-// have no more complaints about it.
+-// https://github.com/golang/go/issues/41061
+-func TestRenamePackage(t *testing.T) {
+- const proxy = `
+--- example.com@v1.2.3/go.mod --
+-module example.com
+-
+-go 1.12
+--- example.com@v1.2.3/blah/blah.go --
+-package blah
+-
+-const Name = "Blah"
+--- random.org@v1.2.3/go.mod --
+-module random.org
+-
+-go 1.12
+--- random.org@v1.2.3/blah/blah.go --
+-package hello
+-
+-const Name = "Hello"
+-`
+-
+- const contents = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-import "example.com/blah"
+-
+-func main() {
+- blah.Hello()
+-}
+--- bob.go --
+-package main
+--- foo/foo.go --
+-package foo
+--- foo/foo_test.go --
+-package foo_
+-`
+-
+- WithOptions(
+- ProxyFiles(proxy),
+- InGOPATH(),
+- EnvVars{"GO111MODULE": "off"},
+- ).Run(t, contents, func(t *testing.T, env *Env) {
+- // Simulate typing character by character.
+- env.OpenFile("foo/foo_test.go")
+- env.Await(env.DoneWithOpen())
+- env.RegexpReplace("foo/foo_test.go", "_", "_t")
+- env.Await(env.DoneWithChange())
+- env.RegexpReplace("foo/foo_test.go", "_t", "_test")
+- env.AfterChange(
+- NoDiagnostics(ForFile("foo/foo_test.go")),
+- NoOutstandingWork(),
+- )
+- })
+-}
+-
+-// TestProgressBarErrors confirms that critical workspace load errors are shown
+-// and updated via progress reports.
+-func TestProgressBarErrors(t *testing.T) {
+- const pkg = `
+--- go.mod --
+-modul mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-`
+- Run(t, pkg, func(t *testing.T, env *Env) {
+- env.OpenFile("go.mod")
+- env.AfterChange(
+- OutstandingWork(lsp.WorkspaceLoadFailure, "unknown directive"),
+- )
+- env.EditBuffer("go.mod", fake.NewEdit(0, 0, 3, 0, `module mod.com
+-
+-go 1.hello
+-`))
+- // As of golang/go#42529, go.mod changes do not reload the workspace until
+- // they are saved.
+- env.SaveBufferWithoutActions("go.mod")
+- env.AfterChange(
+- OutstandingWork(lsp.WorkspaceLoadFailure, "invalid go version"),
+- )
+- env.RegexpReplace("go.mod", "go 1.hello", "go 1.12")
+- env.SaveBufferWithoutActions("go.mod")
+- env.AfterChange(
+- NoOutstandingWork(),
+- )
+- })
+-}
+-
+-func TestDeleteDirectory(t *testing.T) {
+- const mod = `
+--- bob/bob.go --
+-package bob
+-
+-func Hello() {
+- var x int
+-}
+--- go.mod --
+-module mod.com
+--- cmd/main.go --
+-package main
+-
+-import "mod.com/bob"
+-
+-func main() {
+- bob.Hello()
+-}
+-`
+- Run(t, mod, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- FileWatchMatching("bob"),
+- )
+- env.RemoveWorkspaceFile("bob")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("cmd/main.go", `"mod.com/bob"`)),
+- NoDiagnostics(ForFile("bob/bob.go")),
+- NoFileWatchMatching("bob"),
+- )
+- })
+-}
+-
+-// Confirms that circular imports are tested and reported.
+-func TestCircularImports(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- self/self.go --
+-package self
+-
+-import _ "mod.com/self"
+-func Hello() {}
+--- double/a/a.go --
+-package a
+-
+-import _ "mod.com/double/b"
+--- double/b/b.go --
+-package b
+-
+-import _ "mod.com/double/a"
+--- triple/a/a.go --
+-package a
+-
+-import _ "mod.com/triple/b"
+--- triple/b/b.go --
+-package b
+-
+-import _ "mod.com/triple/c"
+--- triple/c/c.go --
+-package c
+-
+-import _ "mod.com/triple/a"
+-`
+- Run(t, mod, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("self/self.go", `_ "mod.com/self"`), WithMessage("import cycle not allowed")),
+- Diagnostics(env.AtRegexp("double/a/a.go", `_ "mod.com/double/b"`), WithMessage("import cycle not allowed")),
+- Diagnostics(env.AtRegexp("triple/a/a.go", `_ "mod.com/triple/b"`), WithMessage("import cycle not allowed")),
+- )
+- })
+-}
+-
+-// Tests golang/go#46667: deleting a problematic import path should resolve
+-// import cycle errors.
+-func TestResolveImportCycle(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.test
+-
+-go 1.16
+--- a/a.go --
+-package a
+-
+-import "mod.test/b"
+-
+-const A = b.A
+-const B = 2
+--- b/b.go --
+-package b
+-
+-import "mod.test/a"
+-
+-const A = 1
+-const B = a.B
+- `
+- Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+- env.OpenFile("b/b.go")
+- env.AfterChange(
+- // The Go command sometimes tells us about only one of the import cycle
+- // errors below. For robustness of this test, succeed if we get either.
+- //
+- // TODO(golang/go#52904): we should get *both* of these errors.
+- AnyOf(
+- Diagnostics(env.AtRegexp("a/a.go", `"mod.test/b"`), WithMessage("import cycle")),
+- Diagnostics(env.AtRegexp("b/b.go", `"mod.test/a"`), WithMessage("import cycle")),
+- ),
+- )
+- env.RegexpReplace("b/b.go", `const B = a\.B`, "")
+- env.SaveBuffer("b/b.go")
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")),
+- NoDiagnostics(ForFile("b/b.go")),
+- )
+- })
+-}
+-
+-func TestBadImport(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-import (
+- _ "nosuchpkg"
+-)
+-`
+- t.Run("module", func(t *testing.T) {
+- Run(t, mod, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("main.go", `"nosuchpkg"`), WithMessage(`could not import nosuchpkg (no required module provides package "nosuchpkg"`)),
+- )
+- })
+- })
+- t.Run("GOPATH", func(t *testing.T) {
+- WithOptions(
+- InGOPATH(),
+- EnvVars{"GO111MODULE": "off"},
+- Modes(Default),
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("main.go", `"nosuchpkg"`), WithMessage(`cannot find package "nosuchpkg"`)),
+- )
+- })
+- })
+-}
+-
+-func TestNestedModules(t *testing.T) {
+- const proxy = `
+--- nested.com@v1.0.0/go.mod --
+-module nested.com
+-
+-go 1.12
+--- nested.com@v1.0.0/hello/hello.go --
+-package hello
+-
+-func Hello() {}
+-`
+-
+- const nested = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+-
+-require nested.com v1.0.0
+--- go.sum --
+-nested.com v1.0.0 h1:I6spLE4CgFqMdBPc+wTV2asDO2QJ3tU0YAT+jkLeN1I=
+-nested.com v1.0.0/go.mod h1:ly53UzXQgVjSlV7wicdBB4p8BxfytuGT1Xcyv0ReJfI=
+--- main.go --
+-package main
+-
+-import "nested.com/hello"
+-
+-func main() {
+- hello.Hello()
+-}
+--- nested/go.mod --
+-module nested.com
+-
+--- nested/hello/hello.go --
+-package hello
+-
+-func Hello() {
+- helloHelper()
+-}
+--- nested/hello/hello_helper.go --
+-package hello
+-
+-func helloHelper() {}
+-`
+- WithOptions(
+- ProxyFiles(proxy),
+- Modes(Default),
+- ).Run(t, nested, func(t *testing.T, env *Env) {
+- // Expect a diagnostic in a nested module.
+- env.OpenFile("nested/hello/hello.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("nested/hello/hello.go", "helloHelper")),
+- Diagnostics(env.AtRegexp("nested/hello/hello.go", "package hello"), WithMessage("nested module")),
+- OutstandingWork(lsp.WorkspaceLoadFailure, "nested module"),
+- )
+- })
+-}
+-
+-func TestAdHocPackagesReloading(t *testing.T) {
+- const nomod = `
+--- main.go --
+-package main
+-
+-func main() {}
+-`
+- Run(t, nomod, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.RegexpReplace("main.go", "{}", "{ var x int; }") // simulate typing
+- env.AfterChange(NoLogMatching(protocol.Info, "packages=1"))
+- })
+-}
+-
+-func TestBuildTagChange(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- foo.go --
+-// decoy comment
+-// +build hidden
+-// decoy comment
+-
+-package foo
+-var Foo = 1
+--- bar.go --
+-package foo
+-var Bar = Foo
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("foo.go")
+- env.AfterChange(Diagnostics(env.AtRegexp("bar.go", `Foo`)))
+- env.RegexpReplace("foo.go", `\+build`, "")
+- env.AfterChange(NoDiagnostics(ForFile("bar.go")))
+- })
+-
+-}
+-
+-func TestIssue44736(t *testing.T) {
+- const files = `
+- -- go.mod --
+-module blah.com
+-
+-go 1.16
+--- main.go --
+-package main
+-
+-import "fmt"
+-
+-func main() {
+- asdf
+- fmt.Printf("This is a test %v")
+- fdas
+-}
+--- other.go --
+-package main
+-
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.OpenFile("other.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("main.go", "asdf")),
+- Diagnostics(env.AtRegexp("main.go", "fdas")),
+- )
+- env.SetBufferContent("other.go", "package main\n\nasdf")
+- // The new diagnostic in other.go should not suppress diagnostics in main.go.
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("other.go", "asdf"), WithMessage("expected declaration")),
+- Diagnostics(env.AtRegexp("main.go", "asdf")),
+- )
+- })
+-}
+-
+-func TestInitialization(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.16
+--- main.go --
+-package main
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("go.mod")
+- env.Await(env.DoneWithOpen())
+- env.RegexpReplace("go.mod", "module", "modul")
+- env.SaveBufferWithoutActions("go.mod")
+- env.AfterChange(
+- NoLogMatching(protocol.Error, "initial workspace load failed"),
+- )
+- })
+-}
+-
+-// This test confirms that the view does not reinitialize when a go.mod file is
+-// opened.
+-func TestNoReinitialize(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-func main() {}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("go.mod")
+- env.AfterChange(
+- LogMatching(protocol.Info, `.*query=\[builtin mod.com/...\].*`, 1, false),
+- )
+- })
+-}
+-
+-func TestLangVersion(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18) // Requires types.Config.GoVersion, new in 1.18.
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-const C = 0b10
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("main.go", `0b10`), WithMessage("go1.13 or later")),
+- )
+- env.WriteWorkspaceFile("go.mod", "module mod.com \n\ngo 1.13\n")
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- )
+- })
+-}
+-
+-func TestNoQuickFixForUndeclaredConstraint(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- main.go --
+-package main
+-
+-func F[T C](_ T) {
+-}
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- var d protocol.PublishDiagnosticsParams
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("main.go", `C`)),
+- ReadDiagnostics("main.go", &d),
+- )
+- if fixes := env.GetQuickFixes("main.go", d.Diagnostics); len(fixes) != 0 {
+- t.Errorf("got quick fixes %v, wanted none", fixes)
+- }
+- })
+-}
+-
+-func TestEditGoDirective(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.16
+--- main.go --
+-package main
+-
+-func F[T any](_ T) {
+-}
+-`
+- Run(t, files, func(_ *testing.T, env *Env) { // Create a new workspace-level directory and empty file.
+- var d protocol.PublishDiagnosticsParams
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("main.go", `T any`), WithMessage("type parameter")),
+- ReadDiagnostics("main.go", &d),
+- )
+-
+- env.ApplyQuickFixes("main.go", d.Diagnostics)
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- )
+- })
+-}
+-
+-func TestEditGoDirectiveWorkspace(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.16
+--- go.work --
+-go 1.18
+-
+-use .
+--- main.go --
+-package main
+-
+-func F[T any](_ T) {
+-}
+-`
+- Run(t, files, func(_ *testing.T, env *Env) { // Create a new workspace-level directory and empty file.
+- var d protocol.PublishDiagnosticsParams
+-
+- // We should have a diagnostic because generics are not supported at 1.16.
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("main.go", `T any`), WithMessage("type parameter")),
+- ReadDiagnostics("main.go", &d),
+- )
+-
+- // This diagnostic should have a quick fix to edit the go version.
+- env.ApplyQuickFixes("main.go", d.Diagnostics)
+-
+- // Once the edit is applied, the problematic diagnostics should be
+- // resolved.
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- )
+- })
+-}
+-
+-// This test demonstrates that analysis facts are correctly propagated
+-// across packages.
+-func TestInterpackageAnalysis(t *testing.T) {
+- const src = `
+--- go.mod --
+-module example.com
+--- a/a.go --
+-package a
+-
+-import "example.com/b"
+-
+-func _() {
+- new(b.B).Printf("%d", "s") // printf error
+-}
+-
+--- b/b.go --
+-package b
+-
+-import "example.com/c"
+-
+-type B struct{}
+-
+-func (B) Printf(format string, args ...interface{}) {
+- c.MyPrintf(format, args...)
+-}
+-
+--- c/c.go --
+-package c
+-
+-import "fmt"
+-
+-func MyPrintf(format string, args ...interface{}) {
+- fmt.Printf(format, args...)
+-}
+-`
+- Run(t, src, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+- env.AfterChange(
+- Diagnostics(
+- env.AtRegexp("a/a.go", "new.*Printf"),
+- WithMessage("format %d has arg \"s\" of wrong type string"),
+- ),
+- )
+- })
+-}
+-
+-// This test ensures that only Analyzers with RunDespiteErrors=true
+-// are invoked on a package that would not compile, even if the errors
+-// are distant and localized.
+-func TestErrorsThatPreventAnalysis(t *testing.T) {
+- const src = `
+--- go.mod --
+-module example.com
+--- a/a.go --
+-package a
+-
+-import "fmt"
+-import "sync"
+-import _ "example.com/b"
+-
+-func _() {
+- // The copylocks analyzer (RunDespiteErrors, FactTypes={}) does run.
+- var mu sync.Mutex
+- mu2 := mu // copylocks error, reported
+- _ = &mu2
+-
+- // The printf analyzer (!RunDespiteErrors, FactTypes!={}) does not run:
+- // (c, printf) failed because of type error in c
+- // (b, printf) and (a, printf) do not run because of failed prerequisites.
+- fmt.Printf("%d", "s") // printf error, unreported
+-
+- // The bools analyzer (!RunDespiteErrors, FactTypes={}) does not run:
+- var cond bool
+- _ = cond != true && cond != true // bools error, unreported
+-}
+-
+--- b/b.go --
+-package b
+-
+-import _ "example.com/c"
+-
+--- c/c.go --
+-package c
+-
+-var _ = 1 / "" // type error
+-
+-`
+- Run(t, src, func(t *testing.T, env *Env) {
+- var diags protocol.PublishDiagnosticsParams
+- env.OpenFile("a/a.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/a.go", "mu2 := (mu)"), WithMessage("assignment copies lock value")),
+- ReadDiagnostics("a/a.go", &diags))
+-
+- // Assert that there were no other diagnostics.
+- // In particular:
+- // - "fmt.Printf" does not trigger a [printf] finding;
+- // - "cond != true" does not trigger a [bools] finding.
+- //
+- // We use this check in preference to NoDiagnosticAtRegexp
+- // as it is robust in case of minor mistakes in the position
+- // regexp, and because it reports unexpected diagnostics.
+- if got, want := len(diags.Diagnostics), 1; got != want {
+- t.Errorf("got %d diagnostics in a/a.go, want %d:", got, want)
+- for i, diag := range diags.Diagnostics {
+- t.Logf("Diagnostics[%d] = %+v", i, diag)
+- }
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/diagnostics/golist_test.go b/gopls/internal/regtest/diagnostics/golist_test.go
+--- a/gopls/internal/regtest/diagnostics/golist_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/diagnostics/golist_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,71 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package diagnostics
+-
+-import (
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-func TestGoListErrors(t *testing.T) {
+- testenv.NeedsTool(t, "cgo")
+-
+- const src = `
+--- go.mod --
+-module a.com
+-
+-go 1.18
+--- a/a.go --
+-package a
+-
+-import
+--- c/c.go --
+-package c
+-
+-/*
+-int fortythree() { return 42; }
+-*/
+-import "C"
+-
+-func Foo() {
+- print(C.fortytwo())
+-}
+--- p/p.go --
+-package p
+-
+-import "a.com/q"
+-
+-const P = q.Q + 1
+--- q/q.go --
+-package q
+-
+-import "a.com/p"
+-
+-const Q = p.P + 1
+-`
+-
+- Run(t, src, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(
+- env.AtRegexp("a/a.go", "import\n()"),
+- FromSource(string(source.ParseError)),
+- ),
+- Diagnostics(
+- AtPosition("c/c.go", 0, 0),
+- FromSource(string(source.ListError)),
+- WithMessage("may indicate failure to perform cgo processing"),
+- ),
+- Diagnostics(
+- env.AtRegexp("p/p.go", `"a.com/q"`),
+- FromSource(string(source.ListError)),
+- WithMessage("import cycle not allowed"),
+- ),
+- )
+- })
+-}
+diff -urN a/gopls/internal/regtest/diagnostics/invalidation_test.go b/gopls/internal/regtest/diagnostics/invalidation_test.go
+--- a/gopls/internal/regtest/diagnostics/invalidation_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/diagnostics/invalidation_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,111 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package diagnostics
+-
+-import (
+- "fmt"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-// Test for golang/go#50267: diagnostics should be re-sent after a file is
+-// opened.
+-func TestDiagnosticsAreResentAfterCloseOrOpen(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.16
+--- main.go --
+-package main
+-
+-func _() {
+- x := 2
+-}
+-`
+- Run(t, files, func(_ *testing.T, env *Env) { // Create a new workspace-level directory and empty file.
+- env.OpenFile("main.go")
+- var afterOpen protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- ReadDiagnostics("main.go", &afterOpen),
+- )
+- env.CloseBuffer("main.go")
+- var afterClose protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- ReadDiagnostics("main.go", &afterClose),
+- )
+- if afterOpen.Version == afterClose.Version {
+- t.Errorf("publishDiagnostics: got the same version after closing (%d) as after opening", afterOpen.Version)
+- }
+- env.OpenFile("main.go")
+- var afterReopen protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- ReadDiagnostics("main.go", &afterReopen),
+- )
+- if afterReopen.Version == afterClose.Version {
+- t.Errorf("pubslishDiagnostics: got the same version after reopening (%d) as after closing", afterClose.Version)
+- }
+- })
+-}
+-
+-// Test for the "chattyDiagnostics" setting: we should get re-published
+-// diagnostics after every file change, even if diagnostics did not change.
+-func TestChattyDiagnostics(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.16
+--- main.go --
+-package main
+-
+-func _() {
+- x := 2
+-}
+-
+-// Irrelevant comment #0
+-`
+-
+- WithOptions(
+- Settings{
+- "chattyDiagnostics": true,
+- },
+- ).Run(t, files, func(_ *testing.T, env *Env) { // Create a new workspace-level directory and empty file.
+-
+- env.OpenFile("main.go")
+- var d protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- ReadDiagnostics("main.go", &d),
+- )
+-
+- if len(d.Diagnostics) != 1 {
+- t.Fatalf("len(Diagnostics) = %d, want 1", len(d.Diagnostics))
+- }
+- msg := d.Diagnostics[0].Message
+-
+- for i := 0; i < 5; i++ {
+- before := d.Version
+- env.RegexpReplace("main.go", "Irrelevant comment #.", fmt.Sprintf("Irrelevant comment #%d", i))
+- env.AfterChange(
+- ReadDiagnostics("main.go", &d),
+- )
+-
+- if d.Version == before {
+- t.Errorf("after change, got version %d, want new version", d.Version)
+- }
+-
+- // As a sanity check, make sure we have the same diagnostic.
+- if len(d.Diagnostics) != 1 {
+- t.Fatalf("len(Diagnostics) = %d, want 1", len(d.Diagnostics))
+- }
+- newMsg := d.Diagnostics[0].Message
+- if newMsg != msg {
+- t.Errorf("after change, got message %q, want %q", newMsg, msg)
+- }
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/diagnostics/undeclared_test.go b/gopls/internal/regtest/diagnostics/undeclared_test.go
+--- a/gopls/internal/regtest/diagnostics/undeclared_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/diagnostics/undeclared_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,73 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package diagnostics
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-func TestUndeclaredDiagnostics(t *testing.T) {
+- src := `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- a/a.go --
+-package a
+-
+-func _() int {
+- return x
+-}
+--- b/b.go --
+-package b
+-
+-func _() int {
+- var y int
+- y = y
+- return y
+-}
+-`
+- Run(t, src, func(t *testing.T, env *Env) {
+- isUnnecessary := func(diag protocol.Diagnostic) bool {
+- for _, tag := range diag.Tags {
+- if tag == protocol.Unnecessary {
+- return true
+- }
+- }
+- return false
+- }
+-
+- // 'x' is undeclared, but still necessary.
+- env.OpenFile("a/a.go")
+- var adiags protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/a.go", "x")),
+- ReadDiagnostics("a/a.go", &adiags),
+- )
+- if got := len(adiags.Diagnostics); got != 1 {
+- t.Errorf("len(Diagnostics) = %d, want 1", got)
+- }
+- if diag := adiags.Diagnostics[0]; isUnnecessary(diag) {
+- t.Errorf("%v tagged unnecessary, want necessary", diag)
+- }
+-
+- // 'y = y' is pointless, and should be detected as unnecessary.
+- env.OpenFile("b/b.go")
+- var bdiags protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("b/b.go", "y = y")),
+- ReadDiagnostics("b/b.go", &bdiags),
+- )
+- if got := len(bdiags.Diagnostics); got != 1 {
+- t.Errorf("len(Diagnostics) = %d, want 1", got)
+- }
+- if diag := bdiags.Diagnostics[0]; !isUnnecessary(diag) {
+- t.Errorf("%v tagged necessary, want unnecessary", diag)
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/inlayhints/inlayhints_test.go b/gopls/internal/regtest/inlayhints/inlayhints_test.go
+--- a/gopls/internal/regtest/inlayhints/inlayhints_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/inlayhints/inlayhints_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,69 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-package inlayhint
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/hooks"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/internal/bug"
+-)
+-
+-func TestMain(m *testing.M) {
+- bug.PanicOnBugs = true
+- Main(m, hooks.Options)
+-}
+-
+-func TestEnablingInlayHints(t *testing.T) {
+- const workspace = `
+--- go.mod --
+-module inlayHint.test
+-go 1.12
+--- lib.go --
+-package lib
+-type Number int
+-const (
+- Zero Number = iota
+- One
+- Two
+-)
+-`
+- tests := []struct {
+- label string
+- enabled map[string]bool
+- wantInlayHint bool
+- }{
+- {
+- label: "default",
+- wantInlayHint: false,
+- },
+- {
+- label: "enable const",
+- enabled: map[string]bool{source.ConstantValues: true},
+- wantInlayHint: true,
+- },
+- {
+- label: "enable parameter names",
+- enabled: map[string]bool{source.ParameterNames: true},
+- wantInlayHint: false,
+- },
+- }
+- for _, test := range tests {
+- t.Run(test.label, func(t *testing.T) {
+- WithOptions(
+- Settings{
+- "hints": test.enabled,
+- },
+- ).Run(t, workspace, func(t *testing.T, env *Env) {
+- env.OpenFile("lib.go")
+- lens := env.InlayHints("lib.go")
+- if gotInlayHint := len(lens) > 0; gotInlayHint != test.wantInlayHint {
+- t.Errorf("got inlayHint: %t, want %t", gotInlayHint, test.wantInlayHint)
+- }
+- })
+- })
+- }
+-}
+diff -urN a/gopls/internal/regtest/marker/marker_test.go b/gopls/internal/regtest/marker/marker_test.go
+--- a/gopls/internal/regtest/marker/marker_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/marker_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,21 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package marker
+-
+-import (
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-// Note: we use a separate package for the marker tests so that we can easily
+-// compare their performance to the existing marker tests in ./internal/lsp.
+-
+-// TestMarkers runs the marker tests from the testdata directory.
+-//
+-// See RunMarkerTests for details on how marker tests work.
+-func TestMarkers(t *testing.T) {
+- RunMarkerTests(t, "testdata")
+-}
+diff -urN a/gopls/internal/regtest/marker/testdata/definition/embed.txt b/gopls/internal/regtest/marker/testdata/definition/embed.txt
+--- a/gopls/internal/regtest/marker/testdata/definition/embed.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/definition/embed.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,254 +0,0 @@
+-This test checks definition and hover operations over embedded fields and methods.
+-
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+-
+--- a/a.go --
+-package a
+-
+-type A string //@loc(AString, "A")
+-
+-func (_ A) Hi() {} //@loc(AHi, "Hi")
+-
+-type S struct {
+- Field int //@loc(SField, "Field")
+- R // embed a struct
+- H // embed an interface
+-}
+-
+-type R struct {
+- Field2 int //@loc(RField2, "Field2")
+-}
+-
+-func (_ R) Hey() {} //@loc(RHey, "Hey")
+-
+-type H interface { //@loc(H, "H")
+- Goodbye() //@loc(HGoodbye, "Goodbye")
+-}
+-
+-type I interface { //@loc(I, "I")
+- B() //@loc(IB, "B")
+- J
+-}
+-
+-type J interface { //@loc(J, "J")
+- Hello() //@loc(JHello, "Hello")
+-}
+-
+--- b/b.go --
+-package b
+-
+-import "mod.com/a" //@loc(AImport, re"\".*\"")
+-
+-type embed struct {
+- F int //@loc(F, "F")
+-}
+-
+-func (embed) M() //@loc(M, "M")
+-
+-type Embed struct {
+- embed
+- *a.A
+- a.I
+- a.S
+-}
+-
+-func _() {
+- e := Embed{}
+- e.Hi() //@def("Hi", AHi),hover("Hi", "Hi", AHi)
+- e.B() //@def("B", IB),hover("B", "B", IB)
+- _ = e.Field //@def("Field", SField),hover("Field", "Field", SField)
+- _ = e.Field2 //@def("Field2", RField2),hover("Field2", "Field2", RField2)
+- e.Hello() //@def("Hello", JHello),hover("Hello", "Hello",JHello)
+- e.Hey() //@def("Hey", RHey),hover("Hey", "Hey", RHey)
+- e.Goodbye() //@def("Goodbye", HGoodbye),hover("Goodbye", "Goodbye", HGoodbye)
+- e.M() //@def("M", M),hover("M", "M", M)
+- _ = e.F //@def("F", F),hover("F", "F", F)
+-}
+-
+-type aAlias = a.A //@loc(aAlias, "aAlias")
+-
+-type S1 struct { //@loc(S1, "S1")
+- F1 int //@loc(S1F1, "F1")
+- S2 //@loc(S1S2, "S2"),def("S2", S2),hover("S2", "S2", S2)
+- a.A //@def("A", AString),hover("A", "A", aA)
+- aAlias //@def("a", aAlias),hover("a", "aAlias", aAlias)
+-}
+-
+-type S2 struct { //@loc(S2, "S2")
+- F1 string //@loc(S2F1, "F1")
+- F2 int //@loc(S2F2, "F2")
+- *a.A //@def("A", AString),def("a",AImport)
+-}
+-
+-type S3 struct {
+- F1 struct {
+- a.A //@def("A", AString)
+- }
+-}
+-
+-func Bar() {
+- var x S1 //@def("S1", S1),hover("S1", "S1", S1)
+- _ = x.S2 //@def("S2", S1S2),hover("S2", "S2", S1S2)
+- _ = x.F1 //@def("F1", S1F1),hover("F1", "F1", S1F1)
+- _ = x.F2 //@def("F2", S2F2),hover("F2", "F2", S2F2)
+- _ = x.S2.F1 //@def("F1", S2F1),hover("F1", "F1", S2F1)
+-}
+-
+--- b/c.go --
+-package b
+-
+-var _ = S1{ //@def("S1", S1),hover("S1", "S1", S1)
+- F1: 99, //@def("F1", S1F1),hover("F1", "F1", S1F1)
+-}
+-
+--- @AHi/hover.md --
+-```go
+-func (a.A).Hi()
+-```
+-
+-[`(a.A).Hi` on pkg.go.dev](https://pkg.go.dev/mod.com/a#A.Hi)
+--- @F/hover.md --
+-```go
+-field F int
+-```
+-
+-@loc(F, "F")
+-
+-
+-[`(b.Embed).F` on pkg.go.dev](https://pkg.go.dev/mod.com/b#Embed.F)
+--- @HGoodbye/hover.md --
+-```go
+-func (a.H).Goodbye()
+-```
+-
+-@loc(HGoodbye, "Goodbye")
+-
+-
+-[`(a.H).Goodbye` on pkg.go.dev](https://pkg.go.dev/mod.com/a#H.Goodbye)
+--- @IB/hover.md --
+-```go
+-func (a.I).B()
+-```
+-
+-@loc(IB, "B")
+-
+-
+-[`(a.I).B` on pkg.go.dev](https://pkg.go.dev/mod.com/a#I.B)
+--- @JHello/hover.md --
+-```go
+-func (a.J).Hello()
+-```
+-
+-@loc(JHello, "Hello")
+-
+-
+-[`(a.J).Hello` on pkg.go.dev](https://pkg.go.dev/mod.com/a#J.Hello)
+--- @M/hover.md --
+-```go
+-func (embed).M()
+-```
+-
+-[`(b.Embed).M` on pkg.go.dev](https://pkg.go.dev/mod.com/b#Embed.M)
+--- @RField2/hover.md --
+-```go
+-field Field2 int
+-```
+-
+-@loc(RField2, "Field2")
+-
+-
+-[`(a.R).Field2` on pkg.go.dev](https://pkg.go.dev/mod.com/a#R.Field2)
+--- @RHey/hover.md --
+-```go
+-func (a.R).Hey()
+-```
+-
+-[`(a.R).Hey` on pkg.go.dev](https://pkg.go.dev/mod.com/a#R.Hey)
+--- @S1/hover.md --
+-```go
+-type S1 struct {
+- F1 int //@loc(S1F1, "F1")
+- S2 //@loc(S1S2, "S2"),def("S2", S2),hover("S2", "S2", S2)
+- a.A //@def("A", AString),hover("A", "A", aA)
+- aAlias //@def("a", aAlias),hover("a", "aAlias", aAlias)
+-}
+-```
+-
+-[`b.S1` on pkg.go.dev](https://pkg.go.dev/mod.com/b#S1)
+--- @S1F1/hover.md --
+-```go
+-field F1 int
+-```
+-
+-@loc(S1F1, "F1")
+-
+-
+-[`(b.S1).F1` on pkg.go.dev](https://pkg.go.dev/mod.com/b#S1.F1)
+--- @S1S2/hover.md --
+-```go
+-field S2 S2
+-```
+-
+-@loc(S1S2, "S2"),def("S2", S2),hover("S2", "S2", S2)
+-
+-
+-[`(b.S1).S2` on pkg.go.dev](https://pkg.go.dev/mod.com/b#S1.S2)
+--- @S2/hover.md --
+-```go
+-type S2 struct {
+- F1 string //@loc(S2F1, "F1")
+- F2 int //@loc(S2F2, "F2")
+- *a.A //@def("A", AString),def("a",AImport)
+-}
+-```
+-
+-[`b.S2` on pkg.go.dev](https://pkg.go.dev/mod.com/b#S2)
+--- @S2F1/hover.md --
+-```go
+-field F1 string
+-```
+-
+-@loc(S2F1, "F1")
+-
+-
+-[`(b.S2).F1` on pkg.go.dev](https://pkg.go.dev/mod.com/b#S2.F1)
+--- @S2F2/hover.md --
+-```go
+-field F2 int
+-```
+-
+-@loc(S2F2, "F2")
+-
+-
+-[`(b.S2).F2` on pkg.go.dev](https://pkg.go.dev/mod.com/b#S2.F2)
+--- @SField/hover.md --
+-```go
+-field Field int
+-```
+-
+-@loc(SField, "Field")
+-
+-
+-[`(a.S).Field` on pkg.go.dev](https://pkg.go.dev/mod.com/a#S.Field)
+--- @aA/hover.md --
+-```go
+-type A string
+-
+-func (a.A).Hi()
+-```
+-
+-@loc(AString, "A")
+-
+-
+-[`a.A` on pkg.go.dev](https://pkg.go.dev/mod.com/a#A)
+--- @aAlias/hover.md --
+-```go
+-type aAlias = a.A
+-
+-func (a.A).Hi()
+-```
+-
+-@loc(aAlias, "aAlias")
+diff -urN a/gopls/internal/regtest/marker/testdata/definition/import.txt b/gopls/internal/regtest/marker/testdata/definition/import.txt
+--- a/gopls/internal/regtest/marker/testdata/definition/import.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/definition/import.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,52 +0,0 @@
+-This test checks definition and hover over imports.
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- foo/foo.go --
+-package foo
+-
+-type Foo struct{}
+-
+-// DoFoo does foo.
+-func DoFoo() {} //@loc(DoFoo, "DoFoo")
+--- bar/bar.go --
+-package bar
+-
+-import (
+- myFoo "mod.com/foo" //@loc(myFoo, "myFoo")
+-)
+-
+-var _ *myFoo.Foo //@def("myFoo", myFoo),hover("myFoo", "myFoo", myFoo)
+--- bar/dotimport.go --
+-package bar
+-
+-import . "mod.com/foo"
+-
+-func _() {
+- // variable of type foo.Foo
+- var _ Foo //@hover("_", "_", FooVar)
+-
+- DoFoo() //@hover("DoFoo", "DoFoo", DoFoo)
+-}
+--- @DoFoo/hover.md --
+-```go
+-func DoFoo()
+-```
+-
+-DoFoo does foo.
+-
+-
+-[`foo.DoFoo` on pkg.go.dev](https://pkg.go.dev/mod.com/foo#DoFoo)
+--- @FooVar/hover.md --
+-```go
+-var _ Foo
+-```
+-
+-variable of type foo.Foo
+--- @myFoo/hover.md --
+-```go
+-package myFoo ("mod.com/foo")
+-```
+-
+-[`myFoo` on pkg.go.dev](https://pkg.go.dev/mod.com/foo)
+diff -urN a/gopls/internal/regtest/marker/testdata/definition/misc.txt b/gopls/internal/regtest/marker/testdata/definition/misc.txt
+--- a/gopls/internal/regtest/marker/testdata/definition/misc.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/definition/misc.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,230 +0,0 @@
+-This test exercises miscellaneous definition and hover requests.
+--- go.mod --
+-module mod.com
+-
+-go 1.16
+--- a.go --
+-package a //@loc(aPackage, re"package (a)"),hover(aPackage, aPackage, aPackage)
+-
+-var (
+- // x is a variable.
+- x string //@loc(x, "x"),hover(x, x, hoverx)
+-)
+-
+-// Constant block. When I hover on h, I should see this comment.
+-const (
+- // When I hover on g, I should see this comment.
+- g = 1 //@hover("g", "g", hoverg)
+-
+- h = 2 //@hover("h", "h", hoverh)
+-)
+-
+-// z is a variable too.
+-var z string //@loc(z, "z"),hover(z, z, hoverz)
+-
+-func AStuff() { //@loc(AStuff, "AStuff")
+- x := 5
+- Random2(x) //@def("dom2", Random2)
+- Random() //@def("()", Random)
+-}
+-
+-type H interface { //@loc(H, "H")
+- Goodbye()
+-}
+-
+-type I interface { //@loc(I, "I")
+- B()
+- J
+-}
+-
+-type J interface { //@loc(J, "J")
+- Hello()
+-}
+-
+-func _() {
+- // 1st type declaration block
+- type (
+- a struct { //@hover("a", "a", hoverDeclBlocka)
+- x string
+- }
+- )
+-
+- // 2nd type declaration block
+- type (
+- // b has a comment
+- b struct{} //@hover("b", "b", hoverDeclBlockb)
+- )
+-
+- // 3rd type declaration block
+- type (
+- // c is a struct
+- c struct { //@hover("c", "c", hoverDeclBlockc)
+- f string
+- }
+-
+- d string //@hover("d", "d", hoverDeclBlockd)
+- )
+-
+- type (
+- e struct { //@hover("e", "e", hoverDeclBlocke)
+- f float64
+- } // e has a comment
+- )
+-}
+-
+-var (
+- hh H //@hover("H", "H", hoverH)
+- ii I //@hover("I", "I", hoverI)
+- jj J //@hover("J", "J", hoverJ)
+-)
+--- a_test.go --
+-package a
+-
+-import (
+- "testing"
+-)
+-
+-func TestA(t *testing.T) { //@hover("TestA", "TestA", hoverTestA)
+-}
+--- random.go --
+-package a
+-
+-func Random() int { //@loc(Random, "Random")
+- y := 6 + 7
+- return y
+-}
+-
+-func Random2(y int) int { //@loc(Random2, "Random2"),loc(RandomParamY, "y")
+- return y //@def("y", RandomParamY),hover("y", "y", hovery)
+-}
+-
+-type Pos struct {
+- x, y int //@loc(PosX, "x"),loc(PosY, "y")
+-}
+-
+-// Typ has a comment. Its fields do not.
+-type Typ struct{ field string } //@loc(TypField, "field")
+-
+-func _() {
+- x := &Typ{}
+- _ = x.field //@def("field", TypField),hover("field", "field", hoverfield)
+-}
+-
+-func (p *Pos) Sum() int { //@loc(PosSum, "Sum")
+- return p.x + p.y //@hover("x", "x", hoverpx)
+-}
+-
+-func _() {
+- var p Pos
+- _ = p.Sum() //@def("()", PosSum),hover("()", `Sum`, hoverSum)
+-}
+--- @aPackage/hover.md --
+--- @hoverDeclBlocka/hover.md --
+-```go
+-type a struct {
+- x string
+-}
+-```
+-
+-1st type declaration block
+--- @hoverDeclBlockb/hover.md --
+-```go
+-type b struct{}
+-```
+-
+-b has a comment
+--- @hoverDeclBlockc/hover.md --
+-```go
+-type c struct {
+- f string
+-}
+-```
+-
+-c is a struct
+--- @hoverDeclBlockd/hover.md --
+-```go
+-type d string
+-```
+-
+-3rd type declaration block
+--- @hoverDeclBlocke/hover.md --
+-```go
+-type e struct {
+- f float64
+-}
+-```
+-
+-e has a comment
+--- @hoverH/hover.md --
+-```go
+-type H interface {
+- Goodbye()
+-}
+-```
+-
+-[`a.H` on pkg.go.dev](https://pkg.go.dev/mod.com#H)
+--- @hoverI/hover.md --
+-```go
+-type I interface {
+- B()
+- J
+-}
+-```
+-
+-[`a.I` on pkg.go.dev](https://pkg.go.dev/mod.com#I)
+--- @hoverJ/hover.md --
+-```go
+-type J interface {
+- Hello()
+-}
+-```
+-
+-[`a.J` on pkg.go.dev](https://pkg.go.dev/mod.com#J)
+--- @hoverSum/hover.md --
+-```go
+-func (*Pos).Sum() int
+-```
+-
+-[`(a.Pos).Sum` on pkg.go.dev](https://pkg.go.dev/mod.com#Pos.Sum)
+--- @hoverTestA/hover.md --
+-```go
+-func TestA(t *testing.T)
+-```
+--- @hoverfield/hover.md --
+-```go
+-field field string
+-```
+--- @hoverg/hover.md --
+-```go
+-const g untyped int = 1
+-```
+-
+-When I hover on g, I should see this comment.
+--- @hoverh/hover.md --
+-```go
+-const h untyped int = 2
+-```
+-
+-Constant block. When I hover on h, I should see this comment.
+--- @hoverpx/hover.md --
+-```go
+-field x int
+-```
+-
+-@loc(PosX, "x"),loc(PosY, "y")
+--- @hoverx/hover.md --
+-```go
+-var x string
+-```
+-
+-x is a variable.
+--- @hovery/hover.md --
+-```go
+-var y int
+-```
+--- @hoverz/hover.md --
+-```go
+-var z string
+-```
+-
+-z is a variable too.
+diff -urN a/gopls/internal/regtest/marker/testdata/hover/basiclit.txt b/gopls/internal/regtest/marker/testdata/hover/basiclit.txt
+--- a/gopls/internal/regtest/marker/testdata/hover/basiclit.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/hover/basiclit.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,60 +0,0 @@
+-This test checks gopls behavior when hovering over basic literals.
+--- basiclit.go --
+-package basiclit
+-
+-func _() {
+- _ = 'a' //@hover("'a'", "'a'", latinA)
+- _ = 0x61 //@hover("0x61", "0x61", latinA)
+-
+- _ = '\u2211' //@hover("'\\u2211'", "'\\u2211'", summation)
+- _ = 0x2211 //@hover("0x2211", "0x2211", summation)
+- _ = "foo \u2211 bar" //@hover("\\u2211", "\\u2211", summation)
+-
+- _ = '\a' //@hover("'\\a'", "'\\a'", control)
+- _ = "foo \a bar" //@hover("\\a", "\\a", control)
+-
+- _ = '\U0001F30A' //@hover("'\\U0001F30A'", "'\\U0001F30A'", waterWave)
+- _ = 0x0001F30A //@hover("0x0001F30A", "0x0001F30A", waterWave)
+- _ = "foo \U0001F30A bar" //@hover("\\U0001F30A", "\\U0001F30A", waterWave)
+-
+- _ = '\x7E' //@hover("'\\x7E'", "'\\x7E'", tilde)
+- _ = "foo \x7E bar" //@hover("\\x7E", "\\x7E", tilde)
+- _ = "foo \a bar" //@hover("\\a", "\\a", control)
+-
+- _ = '\173' //@hover("'\\173'", "'\\173'", leftCurly)
+- _ = "foo \173 bar" //@hover("\\173","\\173", leftCurly)
+- _ = "foo \173 bar \u2211 baz" //@hover("\\173","\\173", leftCurly)
+- _ = "foo \173 bar \u2211 baz" //@hover("\\u2211","\\u2211", summation)
+- _ = "foo\173bar\u2211baz" //@hover("\\173","\\173", leftCurly)
+- _ = "foo\173bar\u2211baz" //@hover("\\u2211","\\u2211", summation)
+-
+- // search for runes in string only if there is an escaped sequence
+- _ = "hello" //@hover(`"hello"`, _, _)
+-
+- // incorrect escaped rune sequences
+- _ = '\0' //@hover("'\\0'", _, _),diag(re`\\0()'`, re"illegal character")
+- _ = '\u22111' //@hover("'\\u22111'", _, _)
+- _ = '\U00110000' //@hover("'\\U00110000'", _, _)
+- _ = '\u12e45'//@hover("'\\u12e45'", _, _)
+- _ = '\xa' //@hover("'\\xa'", _, _)
+- _ = 'aa' //@hover("'aa'", _, _)
+-
+- // other basic lits
+- _ = 1 //@hover("1", _, _)
+- _ = 1.2 //@hover("1.2", _, _)
+- _ = 1.2i //@hover("1.2i", _, _)
+- _ = 0123 //@hover("0123", _, _)
+- _ = 0x1234567890 //@hover("0x1234567890", _, _)
+-)
+--- @control/hover.md --
+-U+0007, control
+--- @latinA/hover.md --
+-'a', U+0061, LATIN SMALL LETTER A
+--- @leftCurly/hover.md --
+-'{', U+007B, LEFT CURLY BRACKET
+--- @summation/hover.md --
+-'∑', U+2211, N-ARY SUMMATION
+--- @tilde/hover.md --
+-'~', U+007E, TILDE
+--- @waterWave/hover.md --
+-'🌊', U+1F30A, WATER WAVE
+diff -urN a/gopls/internal/regtest/marker/testdata/hover/const.txt b/gopls/internal/regtest/marker/testdata/hover/const.txt
+--- a/gopls/internal/regtest/marker/testdata/hover/const.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/hover/const.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+-This test checks hovering over constants.
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- c.go --
+-package c
+-
+-const X = 0 //@hover("X", "X", bX)
+--- @bX/hover.md --
+-```go
+-const X untyped int = 0
+-```
+-
+-@hover("X", "X", bX)
+-
+-
+-[`c.X` on pkg.go.dev](https://pkg.go.dev/mod.com#X)
+diff -urN a/gopls/internal/regtest/marker/testdata/hover/generics.txt b/gopls/internal/regtest/marker/testdata/hover/generics.txt
+--- a/gopls/internal/regtest/marker/testdata/hover/generics.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/hover/generics.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,77 +0,0 @@
+-This file contains tests for hovering over generic Go code.
+-
+--- flags --
+--min_go=go1.18
+-
+--- go.mod --
+-// A go.mod is require for correct pkgsite links.
+-// TODO(rfindley): don't link to ad-hoc or command-line-arguments packages!
+-module mod.com
+-
+-go 1.18
+-
+--- generics.go --
+-package generics
+-
+-type value[T any] struct { //hover("lue", "value", value),hover("T", "T", valueT)
+- val T //@hover("T", "T", valuevalT)
+- Q int //@hover("Q", "Q", valueQ)
+-}
+-
+-type Value[T any] struct { //@hover("T", "T", ValueT)
+- val T //@hover("T", "T", ValuevalT)
+- Q int //@hover("Q", "Q", ValueQ)
+-}
+-
+-// disabled - see issue #54822
+-func F[P interface{ ~int | string }]() { // hover("P","P",Ptparam)
+- // disabled - see issue #54822
+- var _ P // hover("P","P",Pvar)
+-}
+-
+--- inferred.go --
+-package generics
+-
+-func app[S interface{ ~[]E }, E interface{}](s S, e E) S {
+- return append(s, e)
+-}
+-
+-func _() {
+- _ = app[[]int] //@hover("app", "app", appint)
+- _ = app[[]int, int] //@hover("app", "app", appint)
+- // TODO(rfindley): eliminate this diagnostic.
+- _ = app[[]int]([]int{}, 0) //@hover("app", "app", appint),diag("[[]int]", re"unnecessary type arguments")
+- _ = app([]int{}, 0) //@hover("app", "app", appint)
+-}
+-
+--- @ValueQ/hover.md --
+-```go
+-field Q int
+-```
+-
+-@hover("Q", "Q", ValueQ)
+-
+-
+-[`(generics.Value).Q` on pkg.go.dev](https://pkg.go.dev/mod.com#Value.Q)
+--- @ValueT/hover.md --
+-```go
+-type parameter T any
+-```
+--- @ValuevalT/hover.md --
+-```go
+-type parameter T any
+-```
+--- @appint/hover.md --
+-```go
+-func app(s []int, e int) []int // func[S interface{~[]E}, E interface{}](s S, e E) S
+-```
+--- @valueQ/hover.md --
+-```go
+-field Q int
+-```
+-
+-@hover("Q", "Q", valueQ)
+--- @valuevalT/hover.md --
+-```go
+-type parameter T any
+-```
+diff -urN a/gopls/internal/regtest/marker/testdata/hover/goprivate.txt b/gopls/internal/regtest/marker/testdata/hover/goprivate.txt
+--- a/gopls/internal/regtest/marker/testdata/hover/goprivate.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/hover/goprivate.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,27 +0,0 @@
+-This test checks that links in hover obey GOPRIVATE.
+--- env --
+-GOPRIVATE=mod.com
+--- go.mod --
+-module mod.com
+--- p.go --
+-package p
+-
+-// T should not be linked, as it is private.
+-type T struct{} //@hover("T", "T", T)
+--- lib/lib.go --
+-package lib
+-
+-// GOPRIVATE should also match nested packages.
+-type L struct{} //@hover("L", "L", L)
+--- @L/hover.md --
+-```go
+-type L struct{}
+-```
+-
+-GOPRIVATE should also match nested packages.
+--- @T/hover.md --
+-```go
+-type T struct{}
+-```
+-
+-T should not be linked, as it is private.
+diff -urN a/gopls/internal/regtest/marker/testdata/hover/hover.txt b/gopls/internal/regtest/marker/testdata/hover/hover.txt
+--- a/gopls/internal/regtest/marker/testdata/hover/hover.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/hover/hover.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,29 +0,0 @@
+-This test demonstrates some features of the new marker test runner.
+--- a.go --
+-package a
+-
+-const abc = 0x2a //@hover("b", "abc", abc),hover(" =", "abc", abc)
+--- typeswitch.go --
+-package a
+-
+-func _() {
+- var y interface{}
+- switch x := y.(type) { //@hover("x", "x", x)
+- case int:
+- println(x) //@hover("x", "x", xint),hover(")", "x", xint)
+- }
+-}
+--- @abc/hover.md --
+-```go
+-const abc untyped int = 42
+-```
+-
+-@hover("b", "abc", abc),hover(" =", "abc", abc)
+--- @x/hover.md --
+-```go
+-var x interface{}
+-```
+--- @xint/hover.md --
+-```go
+-var x int
+-```
+diff -urN a/gopls/internal/regtest/marker/testdata/hover/linkable_generics.txt b/gopls/internal/regtest/marker/testdata/hover/linkable_generics.txt
+--- a/gopls/internal/regtest/marker/testdata/hover/linkable_generics.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/hover/linkable_generics.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,145 +0,0 @@
+-This file contains tests for documentation links to generic code in hover.
+-
+--- flags --
+--min_go=go1.18
+-
+--- go.mod --
+-module mod.com
+-
+-go 1.19
+-
+--- a.go --
+-package a
+-
+-import "mod.com/generic"
+-
+-func _() {
+- // Hovering over instantiated object should produce accurate type
+- // information, but link to the generic declarations.
+-
+- var x generic.GT[int] //@hover("GT", "GT", xGT)
+- _ = x.F //@hover("x", "x", x),hover("F", "F", xF)
+-
+- f := generic.GF[int] //@hover("GF", "GF", fGF)
+- _ = f //@hover("f", "f", f)
+-}
+-
+--- generic/generic.go --
+-package generic
+-
+-// Hovering over type parameters should link to documentation.
+-//
+-// TODO(rfindley): should it? We should probably link to the type.
+-type GT[P any] struct{ //@hover("GT", "GT", GT),hover("P", "P", GTP)
+- F P //@hover("F", "F", F),hover("P", "P", FP)
+-}
+-
+-func (GT[P]) M(p P) { //@hover("GT", "GT", GTrecv),hover("M","M", M),hover(re"p (P)", re"p (P)", pP)
+-}
+-
+-func GF[P any] (p P) { //@hover("GF", "GF", GF)
+-}
+-
+--- @F/hover.md --
+-```go
+-field F P
+-```
+-
+-@hover("F", "F", F),hover("P", "P", FP)
+-
+-
+-[`(generic.GT).F` on pkg.go.dev](https://pkg.go.dev/mod.com/generic#GT.F)
+--- @FP/hover.md --
+-```go
+-type parameter P any
+-```
+--- @GF/hover.md --
+-```go
+-func GF[P any](p P)
+-```
+-
+-[`generic.GF` on pkg.go.dev](https://pkg.go.dev/mod.com/generic#GF)
+--- @GT/hover.md --
+-```go
+-type GT[P any] struct {
+- F P //@hover("F", "F", F),hover("P", "P", FP)
+-}
+-
+-func (GT[P]).M(p P)
+-```
+-
+-Hovering over type parameters should link to documentation.
+-
+-TODO(rfindley): should it? We should probably link to the type.
+-
+-
+-[`generic.GT` on pkg.go.dev](https://pkg.go.dev/mod.com/generic#GT)
+--- @GTP/hover.md --
+-```go
+-type parameter P any
+-```
+--- @GTrecv/hover.md --
+-```go
+-type GT[P any] struct {
+- F P //@hover("F", "F", F),hover("P", "P", FP)
+-}
+-
+-func (GT[P]).M(p P)
+-```
+-
+-Hovering over type parameters should link to documentation.
+-
+-TODO(rfindley): should it? We should probably link to the type.
+-
+-
+-[`generic.GT` on pkg.go.dev](https://pkg.go.dev/mod.com/generic#GT)
+--- @M/hover.md --
+-```go
+-func (GT[P]).M(p P)
+-```
+-
+-[`(generic.GT).M` on pkg.go.dev](https://pkg.go.dev/mod.com/generic#GT.M)
+--- @f/hover.md --
+-```go
+-var f func(p int)
+-```
+--- @fGF/hover.md --
+-```go
+-func generic.GF(p int) // func[P any](p P)
+-```
+-
+-[`generic.GF` on pkg.go.dev](https://pkg.go.dev/mod.com/generic#GF)
+--- @pP/hover.md --
+-```go
+-type parameter P any
+-```
+--- @x/hover.md --
+-```go
+-var x generic.GT[int]
+-```
+-
+-@hover("GT", "GT", xGT)
+--- @xF/hover.md --
+-```go
+-field F int
+-```
+-
+-@hover("F", "F", F),hover("P", "P", FP)
+-
+-
+-[`(generic.GT).F` on pkg.go.dev](https://pkg.go.dev/mod.com/generic#GT.F)
+--- @xGT/hover.md --
+-```go
+-type GT[P any] struct {
+- F P //@hover("F", "F", F),hover("P", "P", FP)
+-}
+-
+-func (generic.GT[P]).M(p P)
+-```
+-
+-Hovering over type parameters should link to documentation.
+-
+-TODO(rfindley): should it? We should probably link to the type.
+-
+-
+-[`generic.GT` on pkg.go.dev](https://pkg.go.dev/mod.com/generic#GT)
+diff -urN a/gopls/internal/regtest/marker/testdata/hover/linkable.txt b/gopls/internal/regtest/marker/testdata/hover/linkable.txt
+--- a/gopls/internal/regtest/marker/testdata/hover/linkable.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/hover/linkable.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,120 +0,0 @@
+-This test checks that we correctly determine pkgsite links for various
+-identifiers.
+-
+-We should only produce links that work, meaning the object is reachable via the
+-package's public API.
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- p.go --
+-package p
+-
+-type E struct {
+- Embed int
+-}
+-
+-// T is in the package scope, and so should be linkable.
+-type T struct{ //@hover("T", "T", T)
+- // Only exported fields should be linkable
+-
+- f int //@hover("f", "f", f)
+- F int //@hover("F", "F", F)
+-
+- E
+-
+- // TODO(rfindley): is the link here correct? It ignores N.
+- N struct {
+- // Nested fields should also be linkable.
+- Nested int //@hover("Nested", "Nested", Nested)
+- }
+-}
+-// M is an exported method, and so should be linkable.
+-func (T) M() {}
+-
+-// m is not exported, and so should not be linkable.
+-func (T) m() {}
+-
+-func _() {
+- var t T
+-
+- // Embedded fields should be linkable.
+- _ = t.Embed //@hover("Embed", "Embed", Embed)
+-
+- // Local variables should not be linkable, even if they are capitalized.
+- var X int //@hover("X", "X", X)
+- _ = X
+-
+- // Local types should not be linkable, even if they are capitalized.
+- type Local struct { //@hover("Local", "Local", Local)
+- E
+- }
+-
+- // But the embedded field should still be linkable.
+- var l Local
+- _ = l.Embed //@hover("Embed", "Embed", Embed)
+-}
+--- @Embed/hover.md --
+-```go
+-field Embed int
+-```
+-
+-[`(p.E).Embed` on pkg.go.dev](https://pkg.go.dev/mod.com#E.Embed)
+--- @F/hover.md --
+-```go
+-field F int
+-```
+-
+-@hover("F", "F", F)
+-
+-
+-[`(p.T).F` on pkg.go.dev](https://pkg.go.dev/mod.com#T.F)
+--- @Local/hover.md --
+-```go
+-type Local struct {
+- E
+-}
+-```
+-
+-Local types should not be linkable, even if they are capitalized.
+--- @Nested/hover.md --
+-```go
+-field Nested int
+-```
+-
+-Nested fields should also be linkable.
+--- @T/hover.md --
+-```go
+-type T struct {
+- f int //@hover("f", "f", f)
+- F int //@hover("F", "F", F)
+-
+- E
+-
+- // TODO(rfindley): is the link here correct? It ignores N.
+- N struct {
+- // Nested fields should also be linkable.
+- Nested int //@hover("Nested", "Nested", Nested)
+- }
+-}
+-
+-func (T).M()
+-func (T).m()
+-```
+-
+-T is in the package scope, and so should be linkable.
+-
+-
+-[`p.T` on pkg.go.dev](https://pkg.go.dev/mod.com#T)
+--- @X/hover.md --
+-```go
+-var X int
+-```
+-
+-Local variables should not be linkable, even if they are capitalized.
+--- @f/hover.md --
+-```go
+-field f int
+-```
+-
+-@hover("f", "f", f)
+diff -urN a/gopls/internal/regtest/marker/testdata/hover/std.txt b/gopls/internal/regtest/marker/testdata/hover/std.txt
+--- a/gopls/internal/regtest/marker/testdata/hover/std.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/hover/std.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,80 +0,0 @@
+-This test checks hover results for built-in or standard library symbols.
+-
+-It uses synopsis documentation as full documentation for some of these
+-built-ins varies across Go versions, where as it just so happens that the
+-synopsis does not.
+-
+-In the future we may need to limit this test to the latest Go version to avoid
+-documentation churn.
+--- settings.json --
+-{
+- "hoverKind": "SynopsisDocumentation"
+-}
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- std.go --
+-package std
+-
+-import (
+- "fmt"
+- "go/types"
+- "sync"
+-)
+-
+-func _() {
+- var err error //@loc(err, "err")
+- fmt.Printf("%v", err) //@def("err", err)
+-
+- var _ string //@hover("string", "string", hoverstring)
+- _ = make([]int, 0) //@hover("make", "make", hovermake)
+-
+- var mu sync.Mutex
+- mu.Lock() //@hover("Lock", "Lock", hoverLock)
+-
+- var typ *types.Named //@hover("types", "types", hoverTypes)
+- typ.Obj().Name() //@hover("Name", "Name", hoverName)
+-}
+--- @hoverLock/hover.md --
+-```go
+-func (*sync.Mutex).Lock()
+-```
+-
+-Lock locks m.
+-
+-
+-[`(sync.Mutex).Lock` on pkg.go.dev](https://pkg.go.dev/sync#Mutex.Lock)
+--- @hoverName/hover.md --
+-```go
+-func (*types.object).Name() string
+-```
+-
+-Name returns the object's (package-local, unqualified) name.
+-
+-
+-[`(types.TypeName).Name` on pkg.go.dev](https://pkg.go.dev/go/types#TypeName.Name)
+--- @hoverTypes/hover.md --
+-```go
+-package types ("go/types")
+-```
+-
+-[`types` on pkg.go.dev](https://pkg.go.dev/go/types)
+--- @hovermake/hover.md --
+-```go
+-func make(t Type, size ...int) Type
+-```
+-
+-The make built-in function allocates and initializes an object of type slice, map, or chan (only).
+-
+-
+-[`make` on pkg.go.dev](https://pkg.go.dev/builtin#make)
+--- @hoverstring/hover.md --
+-```go
+-type string string
+-```
+-
+-string is the set of all strings of 8-bit bytes, conventionally but not necessarily representing UTF-8-encoded text.
+-
+-
+-[`string` on pkg.go.dev](https://pkg.go.dev/builtin#string)
+diff -urN a/gopls/internal/regtest/marker/testdata/rename/basic.txt b/gopls/internal/regtest/marker/testdata/rename/basic.txt
+--- a/gopls/internal/regtest/marker/testdata/rename/basic.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/rename/basic.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,22 +0,0 @@
+-This test performs basic coverage of 'rename' within a single package.
+-
+--- basic.go --
+-package p
+-
+-func f(x int) { println(x) } //@rename("x", y, param_x)
+-
+--- @param_x/basic.go --
+-package p
+-
+-func f(y int) { println(y) } //@rename("x", y, param_x)
+-
+--- errors.go --
+-package p
+-
+-func _(x []int) { //@renameerr("_", blank, `can't rename "_"`)
+- x = append(x, 1) //@renameerr("append", blank, "built in and cannot be renamed")
+- x = nil //@renameerr("nil", blank, "built in and cannot be renamed")
+- x = nil //@renameerr("x", x, "old and new names are the same: x")
+- _ = 1 //@renameerr("1", x, "no identifier found")
+-}
+-
+diff -urN a/gopls/internal/regtest/marker/testdata/rename/conflict.txt b/gopls/internal/regtest/marker/testdata/rename/conflict.txt
+--- a/gopls/internal/regtest/marker/testdata/rename/conflict.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/rename/conflict.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,59 +0,0 @@
+-This test exercises some renaming conflict scenarios
+-and ensures that the errors are informative.
+-
+--- go.mod --
+-module example.com
+-go 1.12
+-
+--- super/p.go --
+-package super
+-
+-var x int
+-
+-func f(y int) {
+- println(x)
+- println(y) //@renameerr("y", x, errSuperBlockConflict)
+-}
+-
+--- @errSuperBlockConflict --
+-super/p.go:5:8: renaming this var "y" to "x"
+-super/p.go:6:10: would shadow this reference
+-super/p.go:3:5: to the var declared here
+--- sub/p.go --
+-package sub
+-
+-var a int
+-
+-func f2(b int) {
+- println(a) //@renameerr("a", b, errSubBlockConflict)
+- println(b)
+-}
+-
+--- @errSubBlockConflict --
+-sub/p.go:3:5: renaming this var "a" to "b"
+-sub/p.go:6:10: would cause this reference to become shadowed
+-sub/p.go:5:9: by this intervening var definition
+--- pkgname/p.go --
+-package pkgname
+-
+-import e1 "errors" //@renameerr("e1", errors, errImportConflict)
+-import "errors"
+-
+-var _ = errors.New
+-var _ = e1.New
+-
+--- @errImportConflict --
+-pkgname/p.go:3:8: renaming this imported package name "e1" to "errors"
+-pkgname/p.go:4:8: conflicts with imported package name in same block
+--- pkgname2/p1.go --
+-package pkgname2
+-var x int
+-
+--- pkgname2/p2.go --
+-package pkgname2
+-import "errors" //@renameerr("errors", x, errImportConflict2)
+-var _ = errors.New
+-
+--- @errImportConflict2 --
+-pkgname2/p2.go:2:8: renaming this imported package name "errors" to "x" would conflict
+-pkgname2/p1.go:2:5: with this package member var
+diff -urN a/gopls/internal/regtest/marker/testdata/rename/embed.txt b/gopls/internal/regtest/marker/testdata/rename/embed.txt
+--- a/gopls/internal/regtest/marker/testdata/rename/embed.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/rename/embed.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,36 +0,0 @@
+-This test exercises renaming of types used as embedded fields.
+-
+--- go.mod --
+-module example.com
+-go 1.12
+-
+--- a/a.go --
+-package a
+-
+-type A int //@rename("A", A2, type)
+-
+--- b/b.go --
+-package b
+-
+-import "example.com/a"
+-
+-type B struct { a.A } //@renameerr("A", A3, errAnonField)
+-
+-var _ = new(B).A //@renameerr("A", A4, errAnonField)
+-
+--- @errAnonField --
+-can't rename embedded fields: rename the type directly or name the field
+--- @type/a/a.go --
+-package a
+-
+-type A2 int //@rename("A", A2, type)
+-
+--- @type/b/b.go --
+-package b
+-
+-import "example.com/a"
+-
+-type B struct { a.A2 } //@renameerr("A", A3, errAnonField)
+-
+-var _ = new(B).A2 //@renameerr("A", A4, errAnonField)
+-
+diff -urN a/gopls/internal/regtest/marker/testdata/rename/methods.txt b/gopls/internal/regtest/marker/testdata/rename/methods.txt
+--- a/gopls/internal/regtest/marker/testdata/rename/methods.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/rename/methods.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,67 +0,0 @@
+-This test exercises renaming of interface methods.
+-
+-The golden is currently wrong due to https://github.com/golang/go/issues/58506:
+-the reference to B.F in package b should be renamed too.
+-
+--- go.mod --
+-module example.com
+-go 1.12
+-
+--- a/a.go --
+-package a
+-
+-type A int
+-
+-func (A) F() {} //@renameerr("F", G, errAfToG)
+-
+--- b/b.go --
+-package b
+-
+-import "example.com/a"
+-import "example.com/c"
+-
+-type B interface { F() } //@rename("F", G, BfToG)
+-
+-var _ B = a.A(0)
+-var _ B = c.C(0)
+-
+--- c/c.go --
+-package c
+-
+-type C int
+-
+-func (C) F() {} //@renameerr("F", G, errCfToG)
+-
+--- d/d.go --
+-package d
+-
+-import "example.com/b"
+-
+-var _ = b.B.F
+-
+--- @errAfToG --
+-a/a.go:5:10: renaming this method "F" to "G"
+-b/b.go:6:6: would make example.com/a.A no longer assignable to interface B
+-b/b.go:6:20: (rename example.com/b.B.F if you intend to change both types)
+--- @BfToG/b/b.go --
+-package b
+-
+-import "example.com/a"
+-import "example.com/c"
+-
+-type B interface { G() } //@rename("F", G, BfToG)
+-
+-var _ B = a.A(0)
+-var _ B = c.C(0)
+-
+--- @BfToG/d/d.go --
+-package d
+-
+-import "example.com/b"
+-
+-var _ = b.B.G
+-
+--- @errCfToG --
+-c/c.go:5:10: renaming this method "F" to "G"
+-b/b.go:6:6: would make example.com/c.C no longer assignable to interface B
+-b/b.go:6:20: (rename example.com/b.B.F if you intend to change both types)
+diff -urN a/gopls/internal/regtest/marker/testdata/rename/typeswitch.txt b/gopls/internal/regtest/marker/testdata/rename/typeswitch.txt
+--- a/gopls/internal/regtest/marker/testdata/rename/typeswitch.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/rename/typeswitch.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,26 +0,0 @@
+-This test covers the special case of renaming a type switch var.
+-
+--- p.go --
+-package p
+-
+-func _(x interface{}) {
+- switch y := x.(type) { //@rename("y", z, yToZ)
+- case string:
+- print(y) //@rename("y", z, yToZ)
+- default:
+- print(y) //@rename("y", z, yToZ)
+- }
+-}
+-
+--- @yToZ/p.go --
+-package p
+-
+-func _(x interface{}) {
+- switch z := x.(type) { //@rename("y", z, yToZ)
+- case string:
+- print(z) //@rename("y", z, yToZ)
+- default:
+- print(z) //@rename("y", z, yToZ)
+- }
+-}
+-
+diff -urN a/gopls/internal/regtest/marker/testdata/stubmethods/basic.txt b/gopls/internal/regtest/marker/testdata/stubmethods/basic.txt
+--- a/gopls/internal/regtest/marker/testdata/stubmethods/basic.txt 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/marker/testdata/stubmethods/basic.txt 1970-01-01 00:00:00.000000000 +0000
+@@ -1,24 +0,0 @@
+-This test exercises basic 'stub methods' functionality.
+-
+--- go.mod --
+-module example.com
+-go 1.12
+-
+--- a/a.go --
+-package a
+-
+-type C int
+-
+-var _ error = C(0) //@suggestedfix(re"C.0.", re"missing method Error", "refactor.rewrite", stub)
+-
+--- @stub/a/a.go --
+-package a
+-
+-type C int
+-
+-// Error implements error
+-func (C) Error() string {
+- panic("unimplemented")
+-}
+-
+-var _ error = C(0) //@suggestedfix(re"C.0.", re"missing method Error", "refactor.rewrite", stub)
+diff -urN a/gopls/internal/regtest/misc/call_hierarchy_test.go b/gopls/internal/regtest/misc/call_hierarchy_test.go
+--- a/gopls/internal/regtest/misc/call_hierarchy_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/call_hierarchy_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,35 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-package misc
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-// Test for golang/go#49125
+-func TestCallHierarchy_Issue49125(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- p.go --
+-package pkg
+-`
+- // TODO(rfindley): this could probably just be a marker test.
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("p.go")
+- loc := env.RegexpSearch("p.go", "pkg")
+-
+- var params protocol.CallHierarchyPrepareParams
+- params.TextDocument.URI = loc.URI
+- params.Position = loc.Range.Start
+-
+- // Check that this doesn't panic.
+- env.Editor.Server.PrepareCallHierarchy(env.Ctx, &params)
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/configuration_test.go b/gopls/internal/regtest/misc/configuration_test.go
+--- a/gopls/internal/regtest/misc/configuration_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/configuration_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,159 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-// Test that enabling and disabling produces the expected results of showing
+-// and hiding staticcheck analysis results.
+-func TestChangeConfiguration(t *testing.T) {
+- // Staticcheck only supports Go versions >= 1.19.
+- // Note: keep this in sync with TestStaticcheckWarning. Below this version we
+- // should get an error when setting staticcheck configuration.
+- testenv.NeedsGo1Point(t, 19)
+-
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- a/a.go --
+-package a
+-
+-import "errors"
+-
+-// FooErr should be called ErrFoo (ST1012)
+-var FooErr = errors.New("foo")
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")),
+- )
+- cfg := env.Editor.Config()
+- cfg.Settings = map[string]interface{}{
+- "staticcheck": true,
+- }
+- // TODO(rfindley): support waiting on diagnostics following a configuration
+- // change.
+- env.ChangeConfiguration(cfg)
+- env.Await(
+- Diagnostics(env.AtRegexp("a/a.go", "var (FooErr)")),
+- )
+- })
+-}
+-
+-// TestMajorOptionsChange is like TestChangeConfiguration, but modifies an
+-// an open buffer before making a major (but inconsequential) change that
+-// causes gopls to recreate the view.
+-//
+-// Gopls should not get confused about buffer content when recreating the view.
+-func TestMajorOptionsChange(t *testing.T) {
+- t.Skip("broken due to golang/go#57934")
+-
+- testenv.NeedsGo1Point(t, 17)
+-
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- a/a.go --
+-package a
+-
+-import "errors"
+-
+-var ErrFoo = errors.New("foo")
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+- // Introduce a staticcheck diagnostic. It should be detected when we enable
+- // staticcheck later.
+- env.RegexpReplace("a/a.go", "ErrFoo", "FooErr")
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")),
+- )
+- cfg := env.Editor.Config()
+- // Any change to environment recreates the view, but this should not cause
+- // gopls to get confused about the content of a/a.go: we should get the
+- // staticcheck diagnostic below.
+- cfg.Env = map[string]string{
+- "AN_ARBITRARY_VAR": "FOO",
+- }
+- cfg.Settings = map[string]interface{}{
+- "staticcheck": true,
+- }
+- // TODO(rfindley): support waiting on diagnostics following a configuration
+- // change.
+- env.ChangeConfiguration(cfg)
+- env.Await(
+- Diagnostics(env.AtRegexp("a/a.go", "var (FooErr)")),
+- )
+- })
+-}
+-
+-func TestStaticcheckWarning(t *testing.T) {
+- // Note: keep this in sync with TestChangeConfiguration.
+- testenv.SkipAfterGo1Point(t, 16)
+-
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- a/a.go --
+-package a
+-
+-import "errors"
+-
+-// FooErr should be called ErrFoo (ST1012)
+-var FooErr = errors.New("foo")
+-`
+-
+- WithOptions(
+- Settings{"staticcheck": true},
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- ShownMessage("staticcheck is not supported"),
+- )
+- })
+-}
+-
+-func TestGofumptWarning(t *testing.T) {
+- testenv.SkipAfterGo1Point(t, 17)
+-
+- WithOptions(
+- Settings{"gofumpt": true},
+- ).Run(t, "", func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- ShownMessage("gofumpt is not supported"),
+- )
+- })
+-}
+-
+-func TestDeprecatedSettings(t *testing.T) {
+- WithOptions(
+- Settings{
+- "experimentalUseInvalidMetadata": true,
+- "experimentalWatchedFileDelay": "1s",
+- "experimentalWorkspaceModule": true,
+- },
+- ).Run(t, "", func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- ShownMessage("experimentalWorkspaceModule"),
+- ShownMessage("experimentalUseInvalidMetadata"),
+- ShownMessage("experimentalWatchedFileDelay"),
+- )
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/debugserver_test.go b/gopls/internal/regtest/misc/debugserver_test.go
+--- a/gopls/internal/regtest/misc/debugserver_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/debugserver_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,46 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "net/http"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-func TestStartDebugging(t *testing.T) {
+- WithOptions(
+- Modes(Forwarded),
+- ).Run(t, "", func(t *testing.T, env *Env) {
+- args, err := command.MarshalArgs(command.DebuggingArgs{})
+- if err != nil {
+- t.Fatal(err)
+- }
+- params := &protocol.ExecuteCommandParams{
+- Command: command.StartDebugging.ID(),
+- Arguments: args,
+- }
+- var result command.DebuggingResult
+- env.ExecuteCommand(params, &result)
+- if got, want := len(result.URLs), 2; got != want {
+- t.Fatalf("got %d urls, want %d; urls: %#v", got, want, result.URLs)
+- }
+- for i, u := range result.URLs {
+- resp, err := http.Get(u)
+- if err != nil {
+- t.Errorf("getting url #%d (%q): %v", i, u, err)
+- continue
+- }
+- defer resp.Body.Close()
+- if got, want := resp.StatusCode, http.StatusOK; got != want {
+- t.Errorf("debug server #%d returned HTTP %d, want %d", i, got, want)
+- }
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/definition_test.go b/gopls/internal/regtest/misc/definition_test.go
+--- a/gopls/internal/regtest/misc/definition_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/definition_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,512 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "os"
+- "path"
+- "path/filepath"
+- "strings"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+-)
+-
+-const internalDefinition = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-import "fmt"
+-
+-func main() {
+- fmt.Println(message)
+-}
+--- const.go --
+-package main
+-
+-const message = "Hello World."
+-`
+-
+-func TestGoToInternalDefinition(t *testing.T) {
+- Run(t, internalDefinition, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- loc := env.GoToDefinition(env.RegexpSearch("main.go", "message"))
+- name := env.Sandbox.Workdir.URIToPath(loc.URI)
+- if want := "const.go"; name != want {
+- t.Errorf("GoToDefinition: got file %q, want %q", name, want)
+- }
+- if want := env.RegexpSearch("const.go", "message"); loc != want {
+- t.Errorf("GoToDefinition: got location %v, want %v", loc, want)
+- }
+- })
+-}
+-
+-const linknameDefinition = `
+--- go.mod --
+-module mod.com
+-
+--- upper/upper.go --
+-package upper
+-
+-import (
+- _ "unsafe"
+-
+- _ "mod.com/middle"
+-)
+-
+-//go:linkname foo mod.com/lower.bar
+-func foo() string
+-
+--- middle/middle.go --
+-package middle
+-
+-import (
+- _ "mod.com/lower"
+-)
+-
+--- lower/lower.s --
+-
+--- lower/lower.go --
+-package lower
+-
+-func bar() string {
+- return "bar as foo"
+-}`
+-
+-func TestGoToLinknameDefinition(t *testing.T) {
+- Run(t, linknameDefinition, func(t *testing.T, env *Env) {
+- env.OpenFile("upper/upper.go")
+-
+- // Jump from directives 2nd arg.
+- start := env.RegexpSearch("upper/upper.go", `lower.bar`)
+- loc := env.GoToDefinition(start)
+- name := env.Sandbox.Workdir.URIToPath(loc.URI)
+- if want := "lower/lower.go"; name != want {
+- t.Errorf("GoToDefinition: got file %q, want %q", name, want)
+- }
+- if want := env.RegexpSearch("lower/lower.go", `bar`); loc != want {
+- t.Errorf("GoToDefinition: got position %v, want %v", loc, want)
+- }
+- })
+-}
+-
+-const linknameDefinitionReverse = `
+--- go.mod --
+-module mod.com
+-
+--- upper/upper.s --
+-
+--- upper/upper.go --
+-package upper
+-
+-import (
+- _ "mod.com/middle"
+-)
+-
+-func foo() string
+-
+--- middle/middle.go --
+-package middle
+-
+-import (
+- _ "mod.com/lower"
+-)
+-
+--- lower/lower.go --
+-package lower
+-
+-import _ "unsafe"
+-
+-//go:linkname bar mod.com/upper.foo
+-func bar() string {
+- return "bar as foo"
+-}`
+-
+-func TestGoToLinknameDefinitionInReverseDep(t *testing.T) {
+- Run(t, linknameDefinitionReverse, func(t *testing.T, env *Env) {
+- env.OpenFile("lower/lower.go")
+-
+- // Jump from directives 2nd arg.
+- start := env.RegexpSearch("lower/lower.go", `upper.foo`)
+- loc := env.GoToDefinition(start)
+- name := env.Sandbox.Workdir.URIToPath(loc.URI)
+- if want := "upper/upper.go"; name != want {
+- t.Errorf("GoToDefinition: got file %q, want %q", name, want)
+- }
+- if want := env.RegexpSearch("upper/upper.go", `foo`); loc != want {
+- t.Errorf("GoToDefinition: got position %v, want %v", loc, want)
+- }
+- })
+-}
+-
+-// The linkname directive connects two packages not related in the import graph.
+-const linknameDefinitionDisconnected = `
+--- go.mod --
+-module mod.com
+-
+--- a/a.go --
+-package a
+-
+-import (
+- _ "unsafe"
+-)
+-
+-//go:linkname foo mod.com/b.bar
+-func foo() string
+-
+--- b/b.go --
+-package b
+-
+-func bar() string {
+- return "bar as foo"
+-}`
+-
+-func TestGoToLinknameDefinitionDisconnected(t *testing.T) {
+- Run(t, linknameDefinitionDisconnected, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+-
+- // Jump from directives 2nd arg.
+- start := env.RegexpSearch("a/a.go", `b.bar`)
+- loc := env.GoToDefinition(start)
+- name := env.Sandbox.Workdir.URIToPath(loc.URI)
+- if want := "b/b.go"; name != want {
+- t.Errorf("GoToDefinition: got file %q, want %q", name, want)
+- }
+- if want := env.RegexpSearch("b/b.go", `bar`); loc != want {
+- t.Errorf("GoToDefinition: got position %v, want %v", loc, want)
+- }
+- })
+-}
+-
+-const stdlibDefinition = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-import "fmt"
+-
+-func main() {
+- fmt.Printf()
+-}`
+-
+-func TestGoToStdlibDefinition_Issue37045(t *testing.T) {
+- Run(t, stdlibDefinition, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- loc := env.GoToDefinition(env.RegexpSearch("main.go", `fmt.(Printf)`))
+- name := env.Sandbox.Workdir.URIToPath(loc.URI)
+- if got, want := path.Base(name), "print.go"; got != want {
+- t.Errorf("GoToDefinition: got file %q, want %q", name, want)
+- }
+-
+- // Test that we can jump to definition from outside our workspace.
+- // See golang.org/issues/37045.
+- newLoc := env.GoToDefinition(loc)
+- newName := env.Sandbox.Workdir.URIToPath(newLoc.URI)
+- if newName != name {
+- t.Errorf("GoToDefinition is not idempotent: got %q, want %q", newName, name)
+- }
+- if newLoc != loc {
+- t.Errorf("GoToDefinition is not idempotent: got %v, want %v", newLoc, loc)
+- }
+- })
+-}
+-
+-func TestUnexportedStdlib_Issue40809(t *testing.T) {
+- Run(t, stdlibDefinition, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- loc := env.GoToDefinition(env.RegexpSearch("main.go", `fmt.(Printf)`))
+- name := env.Sandbox.Workdir.URIToPath(loc.URI)
+-
+- loc = env.RegexpSearch(name, `:=\s*(newPrinter)\(\)`)
+-
+- // Check that we can find references on a reference
+- refs := env.References(loc)
+- if len(refs) < 5 {
+- t.Errorf("expected 5+ references to newPrinter, found: %#v", refs)
+- }
+-
+- loc = env.GoToDefinition(loc)
+- content, _ := env.Hover(loc)
+- if !strings.Contains(content.Value, "newPrinter") {
+- t.Fatal("definition of newPrinter went to the incorrect place")
+- }
+- // And on the definition too.
+- refs = env.References(loc)
+- if len(refs) < 5 {
+- t.Errorf("expected 5+ references to newPrinter, found: %#v", refs)
+- }
+- })
+-}
+-
+-// Test the hover on an error's Error function.
+-// This can't be done via the marker tests because Error is a builtin.
+-func TestHoverOnError(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-func main() {
+- var err error
+- err.Error()
+-}`
+- Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- content, _ := env.Hover(env.RegexpSearch("main.go", "Error"))
+- if content == nil {
+- t.Fatalf("nil hover content for Error")
+- }
+- want := "```go\nfunc (error).Error() string\n```"
+- if content.Value != want {
+- t.Fatalf("hover failed:\n%s", compare.Text(want, content.Value))
+- }
+- })
+-}
+-
+-func TestImportShortcut(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-import "fmt"
+-
+-func main() {}
+-`
+- for _, tt := range []struct {
+- wantLinks int
+- importShortcut string
+- }{
+- {1, "Link"},
+- {0, "Definition"},
+- {1, "Both"},
+- } {
+- t.Run(tt.importShortcut, func(t *testing.T) {
+- WithOptions(
+- Settings{"importShortcut": tt.importShortcut},
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- loc := env.GoToDefinition(env.RegexpSearch("main.go", `"fmt"`))
+- if loc == (protocol.Location{}) {
+- t.Fatalf("expected definition, got none")
+- }
+- links := env.DocumentLink("main.go")
+- if len(links) != tt.wantLinks {
+- t.Fatalf("expected %v links, got %v", tt.wantLinks, len(links))
+- }
+- })
+- })
+- }
+-}
+-
+-func TestGoToTypeDefinition_Issue38589(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-type Int int
+-
+-type Struct struct{}
+-
+-func F1() {}
+-func F2() (int, error) { return 0, nil }
+-func F3() (**Struct, bool, *Int, error) { return nil, false, nil, nil }
+-func F4() (**Struct, bool, *float64, error) { return nil, false, nil, nil }
+-
+-func main() {}
+-`
+-
+- for _, tt := range []struct {
+- re string
+- wantError bool
+- wantTypeRe string
+- }{
+- {re: `F1`, wantError: true},
+- {re: `F2`, wantError: true},
+- {re: `F3`, wantError: true},
+- {re: `F4`, wantError: false, wantTypeRe: `type (Struct)`},
+- } {
+- t.Run(tt.re, func(t *testing.T) {
+- Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+-
+- loc, err := env.Editor.GoToTypeDefinition(env.Ctx, env.RegexpSearch("main.go", tt.re))
+- if tt.wantError {
+- if err == nil {
+- t.Fatal("expected error, got nil")
+- }
+- return
+- }
+- if err != nil {
+- t.Fatalf("expected nil error, got %s", err)
+- }
+-
+- typeLoc := env.RegexpSearch("main.go", tt.wantTypeRe)
+- if loc != typeLoc {
+- t.Errorf("invalid pos: want %+v, got %+v", typeLoc, loc)
+- }
+- })
+- })
+- }
+-}
+-
+-// Test for golang/go#47825.
+-func TestImportTestVariant(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- client/test/role.go --
+-package test
+-
+-import _ "mod.com/client"
+-
+-type RoleSetup struct{}
+--- client/client_role_test.go --
+-package client_test
+-
+-import (
+- "testing"
+- _ "mod.com/client"
+- ctest "mod.com/client/test"
+-)
+-
+-func TestClient(t *testing.T) {
+- _ = ctest.RoleSetup{}
+-}
+--- client/client_test.go --
+-package client
+-
+-import "testing"
+-
+-func TestClient(t *testing.T) {}
+--- client.go --
+-package client
+-`
+- Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("client/client_role_test.go")
+- env.GoToDefinition(env.RegexpSearch("client/client_role_test.go", "RoleSetup"))
+- })
+-}
+-
+-// This test exercises a crashing pattern from golang/go#49223.
+-func TestGoToCrashingDefinition_Issue49223(t *testing.T) {
+- Run(t, "", func(t *testing.T, env *Env) {
+- params := &protocol.DefinitionParams{}
+- params.TextDocument.URI = protocol.DocumentURI("fugitive%3A///Users/user/src/mm/ems/.git//0/pkg/domain/treasury/provider.go")
+- params.Position.Character = 18
+- params.Position.Line = 0
+- env.Editor.Server.Definition(env.Ctx, params)
+- })
+-}
+-
+-// TestVendoringInvalidatesMetadata ensures that gopls uses the
+-// correct metadata even after an external 'go mod vendor' command
+-// causes packages to move; see issue #55995.
+-// See also TestImplementationsInVendor, which tests the same fix.
+-func TestVendoringInvalidatesMetadata(t *testing.T) {
+- t.Skip("golang/go#56169: file watching does not capture vendor dirs")
+-
+- const proxy = `
+--- other.com/b@v1.0.0/go.mod --
+-module other.com/b
+-go 1.14
+-
+--- other.com/b@v1.0.0/b.go --
+-package b
+-const K = 0
+-`
+- const src = `
+--- go.mod --
+-module example.com/a
+-go 1.14
+-require other.com/b v1.0.0
+-
+--- go.sum --
+-other.com/b v1.0.0 h1:1wb3PMGdet5ojzrKl+0iNksRLnOM9Jw+7amBNqmYwqk=
+-other.com/b v1.0.0/go.mod h1:TgHQFucl04oGT+vrUm/liAzukYHNxCwKNkQZEyn3m9g=
+-
+--- a.go --
+-package a
+-import "other.com/b"
+-const _ = b.K
+-
+-`
+- WithOptions(
+- ProxyFiles(proxy),
+- Modes(Default), // fails in 'experimental' mode
+- ).Run(t, src, func(t *testing.T, env *Env) {
+- // Enable to debug go.sum mismatch, which may appear as
+- // "module lookup disabled by GOPROXY=off", confusingly.
+- if false {
+- env.DumpGoSum(".")
+- }
+-
+- env.OpenFile("a.go")
+- refLoc := env.RegexpSearch("a.go", "K") // find "b.K" reference
+-
+- // Initially, b.K is defined in the module cache.
+- gotLoc := env.GoToDefinition(refLoc)
+- gotFile := env.Sandbox.Workdir.URIToPath(gotLoc.URI)
+- wantCache := filepath.ToSlash(env.Sandbox.GOPATH()) + "/pkg/mod/other.com/b@v1.0.0/b.go"
+- if gotFile != wantCache {
+- t.Errorf("GoToDefinition, before: got file %q, want %q", gotFile, wantCache)
+- }
+-
+- // Run 'go mod vendor' outside the editor.
+- if err := env.Sandbox.RunGoCommand(env.Ctx, ".", "mod", []string{"vendor"}, true); err != nil {
+- t.Fatalf("go mod vendor: %v", err)
+- }
+-
+- // Synchronize changes to watched files.
+- env.Await(env.DoneWithChangeWatchedFiles())
+-
+- // Now, b.K is defined in the vendor tree.
+- gotLoc = env.GoToDefinition(refLoc)
+- wantVendor := "vendor/other.com/b/b.go"
+- if gotFile != wantVendor {
+- t.Errorf("GoToDefinition, after go mod vendor: got file %q, want %q", gotFile, wantVendor)
+- }
+-
+- // Delete the vendor tree.
+- if err := os.RemoveAll(env.Sandbox.Workdir.AbsPath("vendor")); err != nil {
+- t.Fatal(err)
+- }
+- // Notify the server of the deletion.
+- if err := env.Sandbox.Workdir.CheckForFileChanges(env.Ctx); err != nil {
+- t.Fatal(err)
+- }
+-
+- // Synchronize again.
+- env.Await(env.DoneWithChangeWatchedFiles())
+-
+- // b.K is once again defined in the module cache.
+- gotLoc = env.GoToDefinition(gotLoc)
+- gotFile = env.Sandbox.Workdir.URIToPath(gotLoc.URI)
+- if gotFile != wantCache {
+- t.Errorf("GoToDefinition, after rm -rf vendor: got file %q, want %q", gotFile, wantCache)
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/embed_test.go b/gopls/internal/regtest/misc/embed_test.go
+--- a/gopls/internal/regtest/misc/embed_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/embed_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,40 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-package misc
+-
+-import (
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-func TestMissingPatternDiagnostic(t *testing.T) {
+- const files = `
+--- go.mod --
+-module example.com
+--- x.go --
+-package x
+-
+-import (
+- _ "embed"
+-)
+-
+-// Issue 47436
+-func F() {}
+-
+-//go:embed NONEXISTENT
+-var foo string
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("x.go")
+- env.AfterChange(
+- Diagnostics(
+- env.AtRegexp("x.go", `NONEXISTENT`),
+- WithMessage("no matching files found"),
+- ),
+- )
+- env.RegexpReplace("x.go", `NONEXISTENT`, "x.go")
+- env.AfterChange(NoDiagnostics(ForFile("x.go")))
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/extract_test.go b/gopls/internal/regtest/misc/extract_test.go
+--- a/gopls/internal/regtest/misc/extract_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/extract_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,65 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-package misc
+-
+-import (
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-func TestExtractFunction(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-func Foo() int {
+- a := 5
+- return a
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- loc := env.RegexpSearch("main.go", `a := 5\n.*return a`)
+- actions, err := env.Editor.CodeAction(env.Ctx, loc, nil)
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- // Find the extract function code action.
+- var extractFunc *protocol.CodeAction
+- for _, action := range actions {
+- if action.Kind == protocol.RefactorExtract && action.Title == "Extract function" {
+- extractFunc = &action
+- break
+- }
+- }
+- if extractFunc == nil {
+- t.Fatal("could not find extract function action")
+- }
+-
+- env.ApplyCodeAction(*extractFunc)
+- want := `package main
+-
+-func Foo() int {
+- return newFunction()
+-}
+-
+-func newFunction() int {
+- a := 5
+- return a
+-}
+-`
+- if got := env.BufferText("main.go"); got != want {
+- t.Fatalf("TestFillStruct failed:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/failures_test.go b/gopls/internal/regtest/misc/failures_test.go
+--- a/gopls/internal/regtest/misc/failures_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/failures_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,84 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+-)
+-
+-// This is a slight variant of TestHoverOnError in definition_test.go
+-// that includes a line directive, which makes no difference since
+-// gopls ignores line directives.
+-func TestHoverFailure(t *testing.T) {
+- t.Skip("line directives //line ")
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- a.y --
+-DWIM(main)
+-
+--- main.go --
+-//line a.y:1
+-package main
+-
+-func main() {
+- var err error
+- err.Error()
+-}`
+- Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- content, _ := env.Hover(env.RegexpSearch("main.go", "Error"))
+- if content == nil {
+- t.Fatalf("Hover('Error') returned nil")
+- }
+- want := "```go\nfunc (error).Error() string\n```"
+- if content.Value != want {
+- t.Fatalf("wrong Hover('Error') content:\n%s", compare.Text(want, content.Value))
+- }
+- })
+-}
+-
+-// This test demonstrates a case where gopls is not at all confused by
+-// line directives, because it completely ignores them.
+-func TestFailingDiagnosticClearingOnEdit(t *testing.T) {
+- t.Skip("line directives //line ")
+- // badPackageDup contains a duplicate definition of the 'a' const.
+- // This is a minor variant of TestDiagnosticClearingOnEdit from
+- // diagnostics_test.go, with a line directive, which makes no difference.
+- const badPackageDup = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- a.go --
+-package consts
+-
+-const a = 1
+--- b.go --
+-package consts
+-//line gen.go:5
+-const a = 2
+-`
+-
+- Run(t, badPackageDup, func(t *testing.T, env *Env) {
+- env.OpenFile("b.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("b.go", `a = 2`), WithMessage("a redeclared")),
+- Diagnostics(env.AtRegexp("a.go", `a = 1`), WithMessage("other declaration")),
+- )
+-
+- // Fix the error by editing the const name in b.go to `b`.
+- env.RegexpReplace("b.go", "(a) = 2", "b")
+- env.AfterChange(
+- NoDiagnostics(ForFile("a.go")),
+- NoDiagnostics(ForFile("b.go")),
+- )
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/fix_test.go b/gopls/internal/regtest/misc/fix_test.go
+--- a/gopls/internal/regtest/misc/fix_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/fix_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,103 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-// A basic test for fillstruct, now that it uses a command.
+-func TestFillStruct(t *testing.T) {
+- const basic = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- main.go --
+-package main
+-
+-type Info struct {
+- WordCounts map[string]int
+- Words []string
+-}
+-
+-func Foo() {
+- _ = Info{}
+-}
+-`
+- Run(t, basic, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- if err := env.Editor.RefactorRewrite(env.Ctx, env.RegexpSearch("main.go", "Info{}")); err != nil {
+- t.Fatal(err)
+- }
+- want := `package main
+-
+-type Info struct {
+- WordCounts map[string]int
+- Words []string
+-}
+-
+-func Foo() {
+- _ = Info{
+- WordCounts: map[string]int{},
+- Words: []string{},
+- }
+-}
+-`
+- if got := env.BufferText("main.go"); got != want {
+- t.Fatalf("TestFillStruct failed:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-func TestFillReturns(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-func Foo() error {
+- return
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- var d protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- // The error message here changed in 1.18; "return values" covers both forms.
+- Diagnostics(env.AtRegexp("main.go", `return`), WithMessage("return values")),
+- ReadDiagnostics("main.go", &d),
+- )
+- codeActions := env.CodeAction("main.go", d.Diagnostics)
+- if len(codeActions) != 2 {
+- t.Fatalf("expected 2 code actions, got %v", len(codeActions))
+- }
+- var foundQuickFix, foundFixAll bool
+- for _, a := range codeActions {
+- if a.Kind == protocol.QuickFix {
+- foundQuickFix = true
+- }
+- if a.Kind == protocol.SourceFixAll {
+- foundFixAll = true
+- }
+- }
+- if !foundQuickFix {
+- t.Fatalf("expected quickfix code action, got none")
+- }
+- if !foundFixAll {
+- t.Fatalf("expected fixall code action, got none")
+- }
+- env.ApplyQuickFixes("main.go", d.Diagnostics)
+- env.AfterChange(NoDiagnostics(ForFile("main.go")))
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/formatting_test.go b/gopls/internal/regtest/misc/formatting_test.go
+--- a/gopls/internal/regtest/misc/formatting_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/formatting_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,368 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "strings"
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-const unformattedProgram = `
+--- main.go --
+-package main
+-import "fmt"
+-func main( ) {
+- fmt.Println("Hello World.")
+-}
+--- main.go.golden --
+-package main
+-
+-import "fmt"
+-
+-func main() {
+- fmt.Println("Hello World.")
+-}
+-`
+-
+-func TestFormatting(t *testing.T) {
+- Run(t, unformattedProgram, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.FormatBuffer("main.go")
+- got := env.BufferText("main.go")
+- want := env.ReadWorkspaceFile("main.go.golden")
+- if got != want {
+- t.Errorf("unexpected formatting result:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-// Tests golang/go#36824.
+-func TestFormattingOneLine36824(t *testing.T) {
+- const onelineProgram = `
+--- a.go --
+-package main; func f() {}
+-
+--- a.go.formatted --
+-package main
+-
+-func f() {}
+-`
+- Run(t, onelineProgram, func(t *testing.T, env *Env) {
+- env.OpenFile("a.go")
+- env.FormatBuffer("a.go")
+- got := env.BufferText("a.go")
+- want := env.ReadWorkspaceFile("a.go.formatted")
+- if got != want {
+- t.Errorf("unexpected formatting result:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-// Tests golang/go#36824.
+-func TestFormattingOneLineImports36824(t *testing.T) {
+- const onelineProgramA = `
+--- a.go --
+-package x; func f() {fmt.Println()}
+-
+--- a.go.imported --
+-package x
+-
+-import "fmt"
+-
+-func f() { fmt.Println() }
+-`
+- Run(t, onelineProgramA, func(t *testing.T, env *Env) {
+- env.OpenFile("a.go")
+- env.OrganizeImports("a.go")
+- got := env.BufferText("a.go")
+- want := env.ReadWorkspaceFile("a.go.imported")
+- if got != want {
+- t.Errorf("unexpected formatting result:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-func TestFormattingOneLineRmImports36824(t *testing.T) {
+- const onelineProgramB = `
+--- a.go --
+-package x; import "os"; func f() {}
+-
+--- a.go.imported --
+-package x
+-
+-func f() {}
+-`
+- Run(t, onelineProgramB, func(t *testing.T, env *Env) {
+- env.OpenFile("a.go")
+- env.OrganizeImports("a.go")
+- got := env.BufferText("a.go")
+- want := env.ReadWorkspaceFile("a.go.imported")
+- if got != want {
+- t.Errorf("unexpected formatting result:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-const disorganizedProgram = `
+--- main.go --
+-package main
+-
+-import (
+- "fmt"
+- "errors"
+-)
+-func main( ) {
+- fmt.Println(errors.New("bad"))
+-}
+--- main.go.organized --
+-package main
+-
+-import (
+- "errors"
+- "fmt"
+-)
+-func main( ) {
+- fmt.Println(errors.New("bad"))
+-}
+--- main.go.formatted --
+-package main
+-
+-import (
+- "errors"
+- "fmt"
+-)
+-
+-func main() {
+- fmt.Println(errors.New("bad"))
+-}
+-`
+-
+-func TestOrganizeImports(t *testing.T) {
+- Run(t, disorganizedProgram, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.OrganizeImports("main.go")
+- got := env.BufferText("main.go")
+- want := env.ReadWorkspaceFile("main.go.organized")
+- if got != want {
+- t.Errorf("unexpected formatting result:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-func TestFormattingOnSave(t *testing.T) {
+- Run(t, disorganizedProgram, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.SaveBuffer("main.go")
+- got := env.BufferText("main.go")
+- want := env.ReadWorkspaceFile("main.go.formatted")
+- if got != want {
+- t.Errorf("unexpected formatting result:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-// Tests various possibilities for comments in files with CRLF line endings.
+-// Import organization in these files has historically been a source of bugs.
+-func TestCRLFLineEndings(t *testing.T) {
+- for _, tt := range []struct {
+- issue, input, want string
+- }{
+- {
+- issue: "41057",
+- want: `package main
+-
+-/*
+-Hi description
+-*/
+-func Hi() {
+-}
+-`,
+- },
+- {
+- issue: "42646",
+- want: `package main
+-
+-import (
+- "fmt"
+-)
+-
+-/*
+-func upload(c echo.Context) error {
+- if err := r.ParseForm(); err != nil {
+- fmt.Fprintf(w, "ParseForm() err: %v", err)
+- return
+- }
+- fmt.Fprintf(w, "POST request successful")
+- path_ver := r.FormValue("path_ver")
+- ukclin_ver := r.FormValue("ukclin_ver")
+-
+- fmt.Fprintf(w, "Name = %s\n", path_ver)
+- fmt.Fprintf(w, "Address = %s\n", ukclin_ver)
+-}
+-*/
+-
+-func main() {
+- const server_port = 8080
+- fmt.Printf("port: %d\n", server_port)
+-}
+-`,
+- },
+- {
+- issue: "42923",
+- want: `package main
+-
+-// Line 1.
+-// aa
+-type Tree struct {
+- arr []string
+-}
+-`,
+- },
+- {
+- issue: "47200",
+- input: `package main
+-
+-import "fmt"
+-
+-func main() {
+- math.Sqrt(9)
+- fmt.Println("hello")
+-}
+-`,
+- want: `package main
+-
+-import (
+- "fmt"
+- "math"
+-)
+-
+-func main() {
+- math.Sqrt(9)
+- fmt.Println("hello")
+-}
+-`,
+- },
+- } {
+- t.Run(tt.issue, func(t *testing.T) {
+- Run(t, "-- main.go --", func(t *testing.T, env *Env) {
+- input := tt.input
+- if input == "" {
+- input = tt.want
+- }
+- crlf := strings.ReplaceAll(input, "\n", "\r\n")
+- env.CreateBuffer("main.go", crlf)
+- env.Await(env.DoneWithOpen())
+- env.OrganizeImports("main.go")
+- got := env.BufferText("main.go")
+- got = strings.ReplaceAll(got, "\r\n", "\n") // convert everything to LF for simplicity
+- if tt.want != got {
+- t.Errorf("unexpected content after save:\n%s", compare.Text(tt.want, got))
+- }
+- })
+- })
+- }
+-}
+-
+-func TestFormattingOfGeneratedFile_Issue49555(t *testing.T) {
+- const input = `
+--- main.go --
+-// Code generated by generator.go. DO NOT EDIT.
+-
+-package main
+-
+-import "fmt"
+-
+-func main() {
+-
+-
+-
+-
+- fmt.Print("hello")
+-}
+-`
+-
+- Run(t, input, func(t *testing.T, env *Env) {
+- wantErrSuffix := "file is generated"
+-
+- env.OpenFile("main.go")
+- err := env.Editor.FormatBuffer(env.Ctx, "main.go")
+- if err == nil {
+- t.Fatal("expected error, got nil")
+- }
+- // Check only the suffix because an error contains a dynamic path to main.go
+- if !strings.HasSuffix(err.Error(), wantErrSuffix) {
+- t.Fatalf("unexpected error %q, want suffix %q", err.Error(), wantErrSuffix)
+- }
+- })
+-}
+-
+-func TestGofumptFormatting(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+-
+- // Exercise some gofumpt formatting rules:
+- // - No empty lines following an assignment operator
+- // - Octal integer literals should use the 0o prefix on modules using Go
+- // 1.13 and later. Requires LangVersion to be correctly resolved.
+- // - std imports must be in a separate group at the top. Requires ModulePath
+- // to be correctly resolved.
+- const input = `
+--- go.mod --
+-module foo
+-
+-go 1.17
+--- foo.go --
+-package foo
+-
+-import (
+- "foo/bar"
+- "fmt"
+-)
+-
+-const perm = 0755
+-
+-func foo() {
+- foo :=
+- "bar"
+- fmt.Println(foo, bar.Bar)
+-}
+--- foo.go.formatted --
+-package foo
+-
+-import (
+- "fmt"
+-
+- "foo/bar"
+-)
+-
+-const perm = 0o755
+-
+-func foo() {
+- foo := "bar"
+- fmt.Println(foo, bar.Bar)
+-}
+--- bar/bar.go --
+-package bar
+-
+-const Bar = 42
+-`
+-
+- WithOptions(
+- Settings{
+- "gofumpt": true,
+- },
+- ).Run(t, input, func(t *testing.T, env *Env) {
+- env.OpenFile("foo.go")
+- env.FormatBuffer("foo.go")
+- got := env.BufferText("foo.go")
+- want := env.ReadWorkspaceFile("foo.go.formatted")
+- if got != want {
+- t.Errorf("unexpected formatting result:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/generate_test.go b/gopls/internal/regtest/misc/generate_test.go
+--- a/gopls/internal/regtest/misc/generate_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/generate_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,72 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// TODO(rfindley): figure out why go generate fails on android builders.
+-
+-//go:build !android
+-// +build !android
+-
+-package misc
+-
+-import (
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-func TestGenerateProgress(t *testing.T) {
+- const generatedWorkspace = `
+--- go.mod --
+-module fake.test
+-
+-go 1.14
+--- generate.go --
+-// +build ignore
+-
+-package main
+-
+-import (
+- "io/ioutil"
+- "os"
+-)
+-
+-func main() {
+- ioutil.WriteFile("generated.go", []byte("package " + os.Args[1] + "\n\nconst Answer = 21"), 0644)
+-}
+-
+--- lib1/lib.go --
+-package lib1
+-
+-//` + `go:generate go run ../generate.go lib1
+-
+--- lib2/lib.go --
+-package lib2
+-
+-//` + `go:generate go run ../generate.go lib2
+-
+--- main.go --
+-package main
+-
+-import (
+- "fake.test/lib1"
+- "fake.test/lib2"
+-)
+-
+-func main() {
+- println(lib1.Answer + lib2.Answer)
+-}
+-`
+-
+- Run(t, generatedWorkspace, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("main.go", "lib1.(Answer)")),
+- )
+- env.RunGenerate("./lib1")
+- env.RunGenerate("./lib2")
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- )
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/highlight_test.go b/gopls/internal/regtest/misc/highlight_test.go
+--- a/gopls/internal/regtest/misc/highlight_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/highlight_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,153 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "sort"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-func TestWorkspacePackageHighlight(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-func main() {
+- var A string = "A"
+- x := "x-" + A
+- println(A, x)
+-}`
+-
+- Run(t, mod, func(t *testing.T, env *Env) {
+- const file = "main.go"
+- env.OpenFile(file)
+- loc := env.GoToDefinition(env.RegexpSearch(file, `var (A) string`))
+-
+- checkHighlights(env, loc, 3)
+- })
+-}
+-
+-func TestStdPackageHighlight_Issue43511(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-import "fmt"
+-
+-func main() {
+- fmt.Printf()
+-}`
+-
+- Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- defLoc := env.GoToDefinition(env.RegexpSearch("main.go", `fmt\.(Printf)`))
+- file := env.Sandbox.Workdir.URIToPath(defLoc.URI)
+- loc := env.RegexpSearch(file, `func Printf\((format) string`)
+-
+- checkHighlights(env, loc, 2)
+- })
+-}
+-
+-func TestThirdPartyPackageHighlight_Issue43511(t *testing.T) {
+- const proxy = `
+--- example.com@v1.2.3/go.mod --
+-module example.com
+-
+-go 1.12
+--- example.com@v1.2.3/global/global.go --
+-package global
+-
+-const A = 1
+-
+-func foo() {
+- _ = A
+-}
+-
+-func bar() int {
+- return A + A
+-}
+--- example.com@v1.2.3/local/local.go --
+-package local
+-
+-func foo() int {
+- const b = 2
+-
+- return b * b * (b+1) + b
+-}`
+-
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+-
+-require example.com v1.2.3
+--- go.sum --
+-example.com v1.2.3 h1:WFzrgiQJwEDJNLDUOV1f9qlasQkvzXf2UNLaNIqbWsI=
+-example.com v1.2.3/go.mod h1:Y2Rc5rVWjWur0h3pd9aEvK5Pof8YKDANh9gHA2Maujo=
+--- main.go --
+-package main
+-
+-import (
+- _ "example.com/global"
+- _ "example.com/local"
+-)
+-
+-func main() {}`
+-
+- WithOptions(
+- ProxyFiles(proxy),
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+-
+- defLoc := env.GoToDefinition(env.RegexpSearch("main.go", `"example.com/global"`))
+- file := env.Sandbox.Workdir.URIToPath(defLoc.URI)
+- loc := env.RegexpSearch(file, `const (A)`)
+- checkHighlights(env, loc, 4)
+-
+- defLoc = env.GoToDefinition(env.RegexpSearch("main.go", `"example.com/local"`))
+- file = env.Sandbox.Workdir.URIToPath(defLoc.URI)
+- loc = env.RegexpSearch(file, `const (b)`)
+- checkHighlights(env, loc, 5)
+- })
+-}
+-
+-func checkHighlights(env *Env, loc protocol.Location, highlightCount int) {
+- t := env.T
+- t.Helper()
+-
+- highlights := env.DocumentHighlight(loc)
+- if len(highlights) != highlightCount {
+- t.Fatalf("expected %v highlight(s), got %v", highlightCount, len(highlights))
+- }
+-
+- references := env.References(loc)
+- if len(highlights) != len(references) {
+- t.Fatalf("number of highlights and references is expected to be equal: %v != %v", len(highlights), len(references))
+- }
+-
+- sort.Slice(highlights, func(i, j int) bool {
+- return protocol.CompareRange(highlights[i].Range, highlights[j].Range) < 0
+- })
+- sort.Slice(references, func(i, j int) bool {
+- return protocol.CompareRange(references[i].Range, references[j].Range) < 0
+- })
+- for i := range highlights {
+- if highlights[i].Range != references[i].Range {
+- t.Errorf("highlight and reference ranges are expected to be equal: %v != %v", highlights[i].Range, references[i].Range)
+- }
+- }
+-}
+diff -urN a/gopls/internal/regtest/misc/hover_test.go b/gopls/internal/regtest/misc/hover_test.go
+--- a/gopls/internal/regtest/misc/hover_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/hover_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,384 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "fmt"
+- "strings"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-func TestHoverUnexported(t *testing.T) {
+- const proxy = `
+--- golang.org/x/structs@v1.0.0/go.mod --
+-module golang.org/x/structs
+-
+-go 1.12
+-
+--- golang.org/x/structs@v1.0.0/types.go --
+-package structs
+-
+-type Mixed struct {
+- // Exported comment
+- Exported int
+- unexported string
+-}
+-
+-func printMixed(m Mixed) {
+- println(m)
+-}
+-`
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+-
+-require golang.org/x/structs v1.0.0
+--- go.sum --
+-golang.org/x/structs v1.0.0 h1:Ito/a7hBYZaNKShFrZKjfBA/SIPvmBrcPCBWPx5QeKk=
+-golang.org/x/structs v1.0.0/go.mod h1:47gkSIdo5AaQaWJS0upVORsxfEr1LL1MWv9dmYF3iq4=
+--- main.go --
+-package main
+-
+-import "golang.org/x/structs"
+-
+-func main() {
+- var m structs.Mixed
+- _ = m.Exported
+-}
+-`
+-
+- // TODO: use a nested workspace folder here.
+- WithOptions(
+- ProxyFiles(proxy),
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- mixedLoc := env.RegexpSearch("main.go", "Mixed")
+- got, _ := env.Hover(mixedLoc)
+- if !strings.Contains(got.Value, "unexported") {
+- t.Errorf("Workspace hover: missing expected field 'unexported'. Got:\n%q", got.Value)
+- }
+-
+- cacheLoc := env.GoToDefinition(mixedLoc)
+- cacheFile := env.Sandbox.Workdir.URIToPath(cacheLoc.URI)
+- argLoc := env.RegexpSearch(cacheFile, "printMixed.*(Mixed)")
+- got, _ = env.Hover(argLoc)
+- if !strings.Contains(got.Value, "unexported") {
+- t.Errorf("Non-workspace hover: missing expected field 'unexported'. Got:\n%q", got.Value)
+- }
+-
+- exportedFieldLoc := env.RegexpSearch("main.go", "Exported")
+- got, _ = env.Hover(exportedFieldLoc)
+- if !strings.Contains(got.Value, "comment") {
+- t.Errorf("Workspace hover: missing comment for field 'Exported'. Got:\n%q", got.Value)
+- }
+- })
+-}
+-
+-func TestHoverIntLiteral(t *testing.T) {
+- // TODO(rfindley): this behavior doesn't actually make sense for vars. It is
+- // misleading to format their value when it is (of course) variable.
+- //
+- // Instead, we should allow hovering on numeric literals.
+- t.Skip("golang/go#58220: broken due to new hover logic")
+-
+- const source = `
+--- main.go --
+-package main
+-
+-var (
+- bigBin = 0b1001001
+-)
+-
+-var hex = 0xe34e
+-
+-func main() {
+-}
+-`
+- Run(t, source, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- hexExpected := "58190"
+- got, _ := env.Hover(env.RegexpSearch("main.go", "hex"))
+- if got != nil && !strings.Contains(got.Value, hexExpected) {
+- t.Errorf("Hover: missing expected field '%s'. Got:\n%q", hexExpected, got.Value)
+- }
+-
+- binExpected := "73"
+- got, _ = env.Hover(env.RegexpSearch("main.go", "bigBin"))
+- if got != nil && !strings.Contains(got.Value, binExpected) {
+- t.Errorf("Hover: missing expected field '%s'. Got:\n%q", binExpected, got.Value)
+- }
+- })
+-}
+-
+-// Tests that hovering does not trigger the panic in golang/go#48249.
+-func TestPanicInHoverBrokenCode(t *testing.T) {
+- // Note: this test can not be expressed as a marker test, as it must use
+- // content without a trailing newline.
+- const source = `
+--- main.go --
+-package main
+-
+-type Example struct`
+- Run(t, source, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.Editor.Hover(env.Ctx, env.RegexpSearch("main.go", "Example"))
+- })
+-}
+-
+-func TestHoverRune_48492(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- main.go --
+-package main
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.EditBuffer("main.go", fake.NewEdit(0, 0, 1, 0, "package main\nfunc main() {\nconst x = `\nfoo\n`\n}"))
+- env.Editor.Hover(env.Ctx, env.RegexpSearch("main.go", "foo"))
+- })
+-}
+-
+-func TestHoverImport(t *testing.T) {
+- const packageDoc1 = "Package lib1 hover documentation"
+- const packageDoc2 = "Package lib2 hover documentation"
+- tests := []struct {
+- hoverPackage string
+- want string
+- wantError bool
+- }{
+- {
+- "mod.com/lib1",
+- packageDoc1,
+- false,
+- },
+- {
+- "mod.com/lib2",
+- packageDoc2,
+- false,
+- },
+- {
+- "mod.com/lib3",
+- "",
+- false,
+- },
+- {
+- "mod.com/lib4",
+- "",
+- true,
+- },
+- }
+- source := fmt.Sprintf(`
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- lib1/a.go --
+-// %s
+-package lib1
+-
+-const C = 1
+-
+--- lib1/b.go --
+-package lib1
+-
+-const D = 1
+-
+--- lib2/a.go --
+-// %s
+-package lib2
+-
+-const E = 1
+-
+--- lib3/a.go --
+-package lib3
+-
+-const F = 1
+-
+--- main.go --
+-package main
+-
+-import (
+- "mod.com/lib1"
+- "mod.com/lib2"
+- "mod.com/lib3"
+- "mod.com/lib4"
+-)
+-
+-func main() {
+- println("Hello")
+-}
+- `, packageDoc1, packageDoc2)
+- Run(t, source, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- for _, test := range tests {
+- got, _, err := env.Editor.Hover(env.Ctx, env.RegexpSearch("main.go", test.hoverPackage))
+- if test.wantError {
+- if err == nil {
+- t.Errorf("Hover(%q) succeeded unexpectedly", test.hoverPackage)
+- }
+- } else if !strings.Contains(got.Value, test.want) {
+- t.Errorf("Hover(%q): got:\n%q\nwant:\n%q", test.hoverPackage, got.Value, test.want)
+- }
+- }
+- })
+-}
+-
+-// for x/tools/gopls: unhandled named anchor on the hover #57048
+-func TestHoverTags(t *testing.T) {
+- const source = `
+--- go.mod --
+-module mod.com
+-
+-go 1.19
+-
+--- lib/a.go --
+-
+-// variety of execution modes.
+-//
+-// # Test package setup
+-//
+-// The regression test package uses a couple of uncommon patterns to reduce
+-package lib
+-
+--- a.go --
+- package main
+- import "mod.com/lib"
+-
+- const A = 1
+-
+-}
+-`
+- Run(t, source, func(t *testing.T, env *Env) {
+- t.Run("tags", func(t *testing.T) {
+- env.OpenFile("a.go")
+- z := env.RegexpSearch("a.go", "lib")
+- t.Logf("%#v", z)
+- got, _ := env.Hover(env.RegexpSearch("a.go", "lib"))
+- if strings.Contains(got.Value, "{#hdr-") {
+- t.Errorf("Hover: got {#hdr- tag:\n%q", got)
+- }
+- })
+- })
+-}
+-
+-// This is a regression test for Go issue #57625.
+-func TestHoverModMissingModuleStmt(t *testing.T) {
+- const source = `
+--- go.mod --
+-go 1.16
+-`
+- Run(t, source, func(t *testing.T, env *Env) {
+- env.OpenFile("go.mod")
+- env.Hover(env.RegexpSearch("go.mod", "go")) // no panic
+- })
+-}
+-
+-func TestHoverCompletionMarkdown(t *testing.T) {
+- testenv.NeedsGo1Point(t, 19)
+- const source = `
+--- go.mod --
+-module mod.com
+-go 1.19
+--- main.go --
+-package main
+-// Just says [hello].
+-//
+-// [hello]: https://en.wikipedia.org/wiki/Hello
+-func Hello() string {
+- Hello() //Here
+- return "hello"
+-}
+-`
+- Run(t, source, func(t *testing.T, env *Env) {
+- // Hover, Completion, and SignatureHelp should all produce markdown
+- // check that the markdown for SignatureHelp and Completion are
+- // the same, and contained in that for Hover (up to trailing \n)
+- env.OpenFile("main.go")
+- loc := env.RegexpSearch("main.go", "func (Hello)")
+- hover, _ := env.Hover(loc)
+- hoverContent := hover.Value
+-
+- loc = env.RegexpSearch("main.go", "//Here")
+- loc.Range.Start.Character -= 3 // Hello(_) //Here
+- completions := env.Completion(loc)
+- signatures := env.SignatureHelp(loc)
+-
+- if len(completions.Items) != 1 {
+- t.Errorf("got %d completions, expected 1", len(completions.Items))
+- }
+- if len(signatures.Signatures) != 1 {
+- t.Errorf("got %d signatures, expected 1", len(signatures.Signatures))
+- }
+- item := completions.Items[0].Documentation.Value
+- var itemContent string
+- if x, ok := item.(protocol.MarkupContent); !ok || x.Kind != protocol.Markdown {
+- t.Fatalf("%#v is not markdown", item)
+- } else {
+- itemContent = strings.Trim(x.Value, "\n")
+- }
+- sig := signatures.Signatures[0].Documentation.Value
+- var sigContent string
+- if x, ok := sig.(protocol.MarkupContent); !ok || x.Kind != protocol.Markdown {
+- t.Fatalf("%#v is not markdown", item)
+- } else {
+- sigContent = x.Value
+- }
+- if itemContent != sigContent {
+- t.Errorf("item:%q not sig:%q", itemContent, sigContent)
+- }
+- if !strings.Contains(hoverContent, itemContent) {
+- t.Errorf("hover:%q does not containt sig;%q", hoverContent, sigContent)
+- }
+- })
+-}
+-
+-// Test that the generated markdown contains links for Go references.
+-// https://github.com/golang/go/issues/58352
+-func TestHoverLinks(t *testing.T) {
+- testenv.NeedsGo1Point(t, 19)
+- const input = `
+--- go.mod --
+-go 1.19
+-module mod.com
+--- main.go --
+-package main
+-// [fmt]
+-var A int
+-// [fmt.Println]
+-var B int
+-// [golang.org/x/tools/go/packages.Package.String]
+-var C int
+-`
+- var tests = []struct {
+- pat string
+- ans string
+- }{
+- {"A", "fmt"},
+- {"B", "fmt#Println"},
+- {"C", "golang.org/x/tools/go/packages#Package.String"},
+- }
+- for _, test := range tests {
+- Run(t, input, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- loc := env.RegexpSearch("main.go", test.pat)
+- hover, _ := env.Hover(loc)
+- hoverContent := hover.Value
+- want := fmt.Sprintf("%s/%s", "https://pkg.go.dev", test.ans)
+- if !strings.Contains(hoverContent, want) {
+- t.Errorf("hover:%q does not contain link %q", hoverContent, want)
+- }
+- })
+- }
+-}
+diff -urN a/gopls/internal/regtest/misc/imports_test.go b/gopls/internal/regtest/misc/imports_test.go
+--- a/gopls/internal/regtest/misc/imports_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/imports_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,258 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "io/ioutil"
+- "os"
+- "path/filepath"
+- "strings"
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-// Tests golang/go#38815.
+-func TestIssue38815(t *testing.T) {
+- const needs = `
+--- go.mod --
+-module foo
+-
+-go 1.12
+--- a.go --
+-package main
+-func f() {}
+-`
+- const ntest = `package main
+-func TestZ(t *testing.T) {
+- f()
+-}
+-`
+- const want = `package main
+-
+-import "testing"
+-
+-func TestZ(t *testing.T) {
+- f()
+-}
+-`
+-
+- // it was returning
+- // "package main\nimport \"testing\"\npackage main..."
+- Run(t, needs, func(t *testing.T, env *Env) {
+- env.CreateBuffer("a_test.go", ntest)
+- env.SaveBuffer("a_test.go")
+- got := env.BufferText("a_test.go")
+- if want != got {
+- t.Errorf("got\n%q, wanted\n%q", got, want)
+- }
+- })
+-}
+-
+-func TestVim1(t *testing.T) {
+- const vim1 = `package main
+-
+-import "fmt"
+-
+-var foo = 1
+-var bar = 2
+-
+-func main() {
+- fmt.Printf("This is a test %v\n", foo)
+- fmt.Printf("This is another test %v\n", foo)
+- fmt.Printf("This is also a test %v\n", foo)
+-}
+-`
+-
+- // The file remains unchanged, but if there are any CodeActions returned, they confuse vim.
+- // Therefore check for no CodeActions
+- Run(t, "", func(t *testing.T, env *Env) {
+- env.CreateBuffer("main.go", vim1)
+- env.OrganizeImports("main.go")
+- actions := env.CodeAction("main.go", nil)
+- if len(actions) > 0 {
+- got := env.BufferText("main.go")
+- t.Errorf("unexpected actions %#v", actions)
+- if got == vim1 {
+- t.Errorf("no changes")
+- } else {
+- t.Errorf("got\n%q", got)
+- t.Errorf("was\n%q", vim1)
+- }
+- }
+- })
+-}
+-
+-func TestVim2(t *testing.T) {
+- const vim2 = `package main
+-
+-import (
+- "fmt"
+-
+- "example.com/blah"
+-
+- "rubbish.com/useless"
+-)
+-
+-func main() {
+- fmt.Println(blah.Name, useless.Name)
+-}
+-`
+-
+- Run(t, "", func(t *testing.T, env *Env) {
+- env.CreateBuffer("main.go", vim2)
+- env.OrganizeImports("main.go")
+- actions := env.CodeAction("main.go", nil)
+- if len(actions) > 0 {
+- t.Errorf("unexpected actions %#v", actions)
+- }
+- })
+-}
+-
+-func TestGOMODCACHE(t *testing.T) {
+- const proxy = `
+--- example.com@v1.2.3/go.mod --
+-module example.com
+-
+-go 1.12
+--- example.com@v1.2.3/x/x.go --
+-package x
+-
+-const X = 1
+--- example.com@v1.2.3/y/y.go --
+-package y
+-
+-const Y = 2
+-`
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+-
+-require example.com v1.2.3
+--- go.sum --
+-example.com v1.2.3 h1:6vTQqzX+pnwngZF1+5gcO3ZEWmix1jJ/h+pWS8wUxK0=
+-example.com v1.2.3/go.mod h1:Y2Rc5rVWjWur0h3pd9aEvK5Pof8YKDANh9gHA2Maujo=
+--- main.go --
+-package main
+-
+-import "example.com/x"
+-
+-var _, _ = x.X, y.Y
+-`
+- modcache, err := ioutil.TempDir("", "TestGOMODCACHE-modcache")
+- if err != nil {
+- t.Fatal(err)
+- }
+- defer os.RemoveAll(modcache)
+- WithOptions(
+- EnvVars{"GOMODCACHE": modcache},
+- ProxyFiles(proxy),
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.AfterChange(Diagnostics(env.AtRegexp("main.go", `y.Y`)))
+- env.SaveBuffer("main.go")
+- env.AfterChange(NoDiagnostics(ForFile("main.go")))
+- loc := env.GoToDefinition(env.RegexpSearch("main.go", `y.(Y)`))
+- path := env.Sandbox.Workdir.URIToPath(loc.URI)
+- if !strings.HasPrefix(path, filepath.ToSlash(modcache)) {
+- t.Errorf("found module dependency outside of GOMODCACHE: got %v, wanted subdir of %v", path, filepath.ToSlash(modcache))
+- }
+- })
+-}
+-
+-// Tests golang/go#40685.
+-func TestAcceptImportsQuickFixTestVariant(t *testing.T) {
+- const pkg = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- a/a.go --
+-package a
+-
+-import (
+- "fmt"
+-)
+-
+-func _() {
+- fmt.Println("")
+- os.Stat("")
+-}
+--- a/a_test.go --
+-package a
+-
+-import (
+- "os"
+- "testing"
+-)
+-
+-func TestA(t *testing.T) {
+- os.Stat("")
+-}
+-`
+- Run(t, pkg, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+- var d protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/a.go", "os.Stat")),
+- ReadDiagnostics("a/a.go", &d),
+- )
+- env.ApplyQuickFixes("a/a.go", d.Diagnostics)
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")),
+- )
+- })
+-}
+-
+-// Test for golang/go#52784
+-func TestGoWorkImports(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+- const pkg = `
+--- go.work --
+-go 1.19
+-
+-use (
+- ./caller
+- ./mod
+-)
+--- caller/go.mod --
+-module caller.com
+-
+-go 1.18
+-
+-require mod.com v0.0.0
+-
+-replace mod.com => ../mod
+--- caller/caller.go --
+-package main
+-
+-func main() {
+- a.Test()
+-}
+--- mod/go.mod --
+-module mod.com
+-
+-go 1.18
+--- mod/a/a.go --
+-package a
+-
+-func Test() {
+-}
+-`
+- Run(t, pkg, func(t *testing.T, env *Env) {
+- env.OpenFile("caller/caller.go")
+- env.AfterChange(Diagnostics(env.AtRegexp("caller/caller.go", "a.Test")))
+-
+- // Saving caller.go should trigger goimports, which should find a.Test in
+- // the mod.com module, thanks to the go.work file.
+- env.SaveBuffer("caller/caller.go")
+- env.AfterChange(NoDiagnostics(ForFile("caller/caller.go")))
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/import_test.go b/gopls/internal/regtest/misc/import_test.go
+--- a/gopls/internal/regtest/misc/import_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/import_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,133 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "testing"
+-
+- "github.com/google/go-cmp/cmp"
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+-)
+-
+-func TestAddImport(t *testing.T) {
+- const before = `package main
+-
+-import "fmt"
+-
+-func main() {
+- fmt.Println("hello world")
+-}
+-`
+-
+- const want = `package main
+-
+-import (
+- "bytes"
+- "fmt"
+-)
+-
+-func main() {
+- fmt.Println("hello world")
+-}
+-`
+-
+- Run(t, "", func(t *testing.T, env *Env) {
+- env.CreateBuffer("main.go", before)
+- cmd, err := command.NewAddImportCommand("Add Import", command.AddImportArgs{
+- URI: env.Sandbox.Workdir.URI("main.go"),
+- ImportPath: "bytes",
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- env.ExecuteCommand(&protocol.ExecuteCommandParams{
+- Command: "gopls.add_import",
+- Arguments: cmd.Arguments,
+- }, nil)
+- got := env.BufferText("main.go")
+- if got != want {
+- t.Fatalf("gopls.add_import failed\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-func TestListImports(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- foo.go --
+-package foo
+-const C = 1
+--- import_strings_test.go --
+-package foo
+-import (
+- x "strings"
+- "testing"
+-)
+-
+-func TestFoo(t *testing.T) {}
+--- import_testing_test.go --
+-package foo
+-
+-import "testing"
+-
+-func TestFoo2(t *testing.T) {}
+-`
+- tests := []struct {
+- filename string
+- want command.ListImportsResult
+- }{
+- {
+- filename: "import_strings_test.go",
+- want: command.ListImportsResult{
+- Imports: []command.FileImport{
+- {Name: "x", Path: "strings"},
+- {Path: "testing"},
+- },
+- PackageImports: []command.PackageImport{
+- {Path: "strings"},
+- {Path: "testing"},
+- },
+- },
+- },
+- {
+- filename: "import_testing_test.go",
+- want: command.ListImportsResult{
+- Imports: []command.FileImport{
+- {Path: "testing"},
+- },
+- PackageImports: []command.PackageImport{
+- {Path: "strings"},
+- {Path: "testing"},
+- },
+- },
+- },
+- }
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- for _, tt := range tests {
+- cmd, err := command.NewListImportsCommand("List Imports", command.URIArg{
+- URI: env.Sandbox.Workdir.URI(tt.filename),
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- var result command.ListImportsResult
+- env.ExecuteCommand(&protocol.ExecuteCommandParams{
+- Command: command.ListImports.ID(),
+- Arguments: cmd.Arguments,
+- }, &result)
+- if diff := cmp.Diff(tt.want, result); diff != "" {
+- t.Errorf("unexpected list imports result for %q (-want +got):\n%s", tt.filename, diff)
+- }
+- }
+-
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/leak_test.go b/gopls/internal/regtest/misc/leak_test.go
+--- a/gopls/internal/regtest/misc/leak_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/leak_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,89 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "context"
+- "testing"
+-
+- "github.com/google/go-cmp/cmp"
+- "golang.org/x/tools/gopls/internal/hooks"
+- "golang.org/x/tools/gopls/internal/lsp/cache"
+- "golang.org/x/tools/gopls/internal/lsp/debug"
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/lsprpc"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/internal/jsonrpc2"
+- "golang.org/x/tools/internal/jsonrpc2/servertest"
+-)
+-
+-// Test for golang/go#57222.
+-func TestCacheLeak(t *testing.T) {
+- // TODO(rfindley): either fix this test with additional instrumentation, or
+- // delete it.
+- t.Skip("This test races with cache eviction.")
+- const files = `-- a.go --
+-package a
+-
+-func _() {
+- println("1")
+-}
+-`
+- c := cache.New(nil)
+- env := setupEnv(t, files, c)
+- env.Await(InitialWorkspaceLoad)
+- env.OpenFile("a.go")
+-
+- // Make a couple edits to stabilize cache state.
+- //
+- // For some reason, after only one edit we're left with two parsed files
+- // (perhaps because something had to ParseHeader). If this test proves flaky,
+- // we'll need to investigate exactly what is causing various parse modes to
+- // be present (or rewrite the test to be more tolerant, for example make ~100
+- // modifications and assert that we're within a few of where we're started).
+- env.RegexpReplace("a.go", "1", "2")
+- env.RegexpReplace("a.go", "2", "3")
+- env.AfterChange()
+-
+- // Capture cache state, make an arbitrary change, and wait for gopls to do
+- // its work. Afterward, we should have the exact same number of parsed
+- before := c.MemStats()
+- env.RegexpReplace("a.go", "3", "4")
+- env.AfterChange()
+- after := c.MemStats()
+-
+- if diff := cmp.Diff(before, after); diff != "" {
+- t.Errorf("store objects differ after change (-before +after)\n%s", diff)
+- }
+-}
+-
+-// setupEnv creates a new sandbox environment for editing the txtar encoded
+-// content of files. It uses a new gopls instance backed by the Cache c.
+-func setupEnv(t *testing.T, files string, c *cache.Cache) *Env {
+- ctx := debug.WithInstance(context.Background(), "", "off")
+- server := lsprpc.NewStreamServer(c, false, hooks.Options)
+- ts := servertest.NewPipeServer(server, jsonrpc2.NewRawStream)
+- s, err := fake.NewSandbox(&fake.SandboxConfig{
+- Files: fake.UnpackTxt(files),
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- a := NewAwaiter(s.Workdir)
+- const skipApplyEdits = false
+- editor, err := fake.NewEditor(s, fake.EditorConfig{}).Connect(ctx, ts, a.Hooks(), skipApplyEdits)
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- return &Env{
+- T: t,
+- Ctx: ctx,
+- Editor: editor,
+- Sandbox: s,
+- Awaiter: a,
+- }
+-}
+diff -urN a/gopls/internal/regtest/misc/link_test.go b/gopls/internal/regtest/misc/link_test.go
+--- a/gopls/internal/regtest/misc/link_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/link_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,96 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "strings"
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-func TestHoverAndDocumentLink(t *testing.T) {
+- const program = `
+--- go.mod --
+-module mod.test
+-
+-go 1.12
+-
+-require import.test v1.2.3
+--- go.sum --
+-import.test v1.2.3 h1:Mu4N9BICLJFxwwn8YNg6T3frkFWW1O7evXvo0HiRjBc=
+-import.test v1.2.3/go.mod h1:KooCN1g237upRg7irU7F+3oADn5tVClU8YYW4I1xhMk=
+--- main.go --
+-package main
+-
+-import "import.test/pkg"
+-
+-func main() {
+- // Issue 43990: this is not a link that most users can open from an LSP
+- // client: mongodb://not.a.link.com
+- println(pkg.Hello)
+-}`
+-
+- const proxy = `
+--- import.test@v1.2.3/go.mod --
+-module import.test
+-
+-go 1.12
+--- import.test@v1.2.3/pkg/const.go --
+-package pkg
+-
+-const Hello = "Hello"
+-`
+- WithOptions(
+- ProxyFiles(proxy),
+- ).Run(t, program, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.OpenFile("go.mod")
+-
+- modLink := "https://pkg.go.dev/mod/import.test@v1.2.3"
+- pkgLink := "https://pkg.go.dev/import.test@v1.2.3/pkg"
+-
+- // First, check that we get the expected links via hover and documentLink.
+- content, _ := env.Hover(env.RegexpSearch("main.go", "pkg.Hello"))
+- if content == nil || !strings.Contains(content.Value, pkgLink) {
+- t.Errorf("hover: got %v in main.go, want contains %q", content, pkgLink)
+- }
+- content, _ = env.Hover(env.RegexpSearch("go.mod", "import.test"))
+- if content == nil || !strings.Contains(content.Value, pkgLink) {
+- t.Errorf("hover: got %v in go.mod, want contains %q", content, pkgLink)
+- }
+- links := env.DocumentLink("main.go")
+- if len(links) != 1 || links[0].Target != pkgLink {
+- t.Errorf("documentLink: got links %+v for main.go, want one link with target %q", links, pkgLink)
+- }
+- links = env.DocumentLink("go.mod")
+- if len(links) != 1 || links[0].Target != modLink {
+- t.Errorf("documentLink: got links %+v for go.mod, want one link with target %q", links, modLink)
+- }
+-
+- // Then change the environment to make these links private.
+- cfg := env.Editor.Config()
+- cfg.Env = map[string]string{"GOPRIVATE": "import.test"}
+- env.ChangeConfiguration(cfg)
+-
+- // Finally, verify that the links are gone.
+- content, _ = env.Hover(env.RegexpSearch("main.go", "pkg.Hello"))
+- if content == nil || strings.Contains(content.Value, pkgLink) {
+- t.Errorf("hover: got %v in main.go, want non-empty hover without %q", content, pkgLink)
+- }
+- content, _ = env.Hover(env.RegexpSearch("go.mod", "import.test"))
+- if content == nil || strings.Contains(content.Value, modLink) {
+- t.Errorf("hover: got %v in go.mod, want contains %q", content, modLink)
+- }
+- links = env.DocumentLink("main.go")
+- if len(links) != 0 {
+- t.Errorf("documentLink: got %d document links for main.go, want 0\nlinks: %v", len(links), links)
+- }
+- links = env.DocumentLink("go.mod")
+- if len(links) != 0 {
+- t.Errorf("documentLink: got %d document links for go.mod, want 0\nlinks: %v", len(links), links)
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/misc_test.go b/gopls/internal/regtest/misc/misc_test.go
+--- a/gopls/internal/regtest/misc/misc_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/misc_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,18 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/hooks"
+- "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/internal/bug"
+-)
+-
+-func TestMain(m *testing.M) {
+- bug.PanicOnBugs = true
+- regtest.Main(m, hooks.Options)
+-}
+diff -urN a/gopls/internal/regtest/misc/multiple_adhoc_test.go b/gopls/internal/regtest/misc/multiple_adhoc_test.go
+--- a/gopls/internal/regtest/misc/multiple_adhoc_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/multiple_adhoc_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,44 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-func TestMultipleAdHocPackages(t *testing.T) {
+- Run(t, `
+--- a/a.go --
+-package main
+-
+-import "fmt"
+-
+-func main() {
+- fmt.Println("")
+-}
+--- a/b.go --
+-package main
+-
+-import "fmt"
+-
+-func main() () {
+- fmt.Println("")
+-}
+-`, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+- if list := env.Completion(env.RegexpSearch("a/a.go", "Println")); list == nil || len(list.Items) == 0 {
+- t.Fatal("expected completions, got none")
+- }
+- env.OpenFile("a/b.go")
+- if list := env.Completion(env.RegexpSearch("a/b.go", "Println")); list == nil || len(list.Items) == 0 {
+- t.Fatal("expected completions, got none")
+- }
+- if list := env.Completion(env.RegexpSearch("a/a.go", "Println")); list == nil || len(list.Items) == 0 {
+- t.Fatal("expected completions, got none")
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/references_test.go b/gopls/internal/regtest/misc/references_test.go
+--- a/gopls/internal/regtest/misc/references_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/references_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,399 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "fmt"
+- "os"
+- "sort"
+- "strings"
+- "testing"
+-
+- "github.com/google/go-cmp/cmp"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-func TestStdlibReferences(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-import "fmt"
+-
+-func main() {
+- fmt.Print()
+-}
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- loc := env.GoToDefinition(env.RegexpSearch("main.go", `fmt.(Print)`))
+- refs, err := env.Editor.References(env.Ctx, loc)
+- if err != nil {
+- t.Fatal(err)
+- }
+- if len(refs) != 2 {
+- // TODO(adonovan): make this assertion less maintainer-hostile.
+- t.Fatalf("got %v reference(s), want 2", len(refs))
+- }
+- // The first reference is guaranteed to be the definition.
+- if got, want := refs[1].URI, env.Sandbox.Workdir.URI("main.go"); got != want {
+- t.Errorf("found reference in %v, wanted %v", got, want)
+- }
+- })
+-}
+-
+-// This is a regression test for golang/go#48400 (a panic).
+-func TestReferencesOnErrorMethod(t *testing.T) {
+- // Ideally this would actually return the correct answer,
+- // instead of merely failing gracefully.
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-type t interface {
+- error
+-}
+-
+-type s struct{}
+-
+-func (*s) Error() string {
+- return ""
+-}
+-
+-func _() {
+- var s s
+- _ = s.Error()
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- loc := env.GoToDefinition(env.RegexpSearch("main.go", `Error`))
+- refs, err := env.Editor.References(env.Ctx, loc)
+- if err != nil {
+- t.Fatalf("references on (*s).Error failed: %v", err)
+- }
+- // TODO(adonovan): this test is crying out for marker support in regtests.
+- var buf strings.Builder
+- for _, ref := range refs {
+- fmt.Fprintf(&buf, "%s %s\n", env.Sandbox.Workdir.URIToPath(ref.URI), ref.Range)
+- }
+- got := buf.String()
+- want := "main.go 8:10-8:15\n" + // (*s).Error decl
+- "main.go 14:7-14:12\n" // s.Error() call
+- if diff := cmp.Diff(want, got); diff != "" {
+- t.Errorf("unexpected references on (*s).Error (-want +got):\n%s", diff)
+- }
+- })
+-}
+-
+-func TestPackageReferences(t *testing.T) {
+- tests := []struct {
+- packageName string
+- wantRefCount int
+- wantFiles []string
+- }{
+- {
+- "lib1",
+- 3,
+- []string{
+- "main.go",
+- "lib1/a.go",
+- "lib1/b.go",
+- },
+- },
+- {
+- "lib2",
+- 2,
+- []string{
+- "main.go",
+- "lib2/a.go",
+- },
+- },
+- }
+-
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- lib1/a.go --
+-package lib1
+-
+-const A = 1
+-
+--- lib1/b.go --
+-package lib1
+-
+-const B = 1
+-
+--- lib2/a.go --
+-package lib2
+-
+-const C = 1
+-
+--- main.go --
+-package main
+-
+-import (
+- "mod.com/lib1"
+- "mod.com/lib2"
+-)
+-
+-func main() {
+- println("Hello")
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- for _, test := range tests {
+- file := fmt.Sprintf("%s/a.go", test.packageName)
+- env.OpenFile(file)
+- loc := env.RegexpSearch(file, test.packageName)
+- refs := env.References(loc)
+- if len(refs) != test.wantRefCount {
+- // TODO(adonovan): make this assertion less maintainer-hostile.
+- t.Fatalf("got %v reference(s), want %d", len(refs), test.wantRefCount)
+- }
+- var refURIs []string
+- for _, ref := range refs {
+- refURIs = append(refURIs, string(ref.URI))
+- }
+- for _, base := range test.wantFiles {
+- hasBase := false
+- for _, ref := range refURIs {
+- if strings.HasSuffix(ref, base) {
+- hasBase = true
+- break
+- }
+- }
+- if !hasBase {
+- t.Fatalf("got [%v], want reference ends with \"%v\"", strings.Join(refURIs, ","), base)
+- }
+- }
+- }
+- })
+-}
+-
+-// Test for golang/go#43144.
+-//
+-// Verify that we search for references and implementations in intermediate
+-// test variants.
+-func TestReferencesInTestVariants(t *testing.T) {
+- const files = `
+--- go.mod --
+-module foo.mod
+-
+-go 1.12
+--- foo/foo.go --
+-package foo
+-
+-import "foo.mod/bar"
+-
+-const Foo = 42
+-
+-type T int
+-type InterfaceM interface{ M() }
+-type InterfaceF interface{ F() }
+-
+-func _() {
+- _ = bar.Blah
+-}
+-
+--- foo/foo_test.go --
+-package foo
+-
+-type Fer struct{}
+-func (Fer) F() {}
+-
+--- bar/bar.go --
+-package bar
+-
+-var Blah = 123
+-
+--- bar/bar_test.go --
+-package bar
+-
+-type Mer struct{}
+-func (Mer) M() {}
+-
+-func TestBar() {
+- _ = Blah
+-}
+--- bar/bar_x_test.go --
+-package bar_test
+-
+-import (
+- "foo.mod/bar"
+- "foo.mod/foo"
+-)
+-
+-type Mer struct{}
+-func (Mer) M() {}
+-
+-func _() {
+- _ = bar.Blah
+- _ = foo.Foo
+-}
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("foo/foo.go")
+-
+- // Helper to map locations relative file paths.
+- fileLocations := func(locs []protocol.Location) []string {
+- var got []string
+- for _, loc := range locs {
+- got = append(got, env.Sandbox.Workdir.URIToPath(loc.URI))
+- }
+- sort.Strings(got)
+- return got
+- }
+-
+- refTests := []struct {
+- re string
+- wantRefs []string
+- }{
+- // Blah is referenced:
+- // - inside the foo.mod/bar (ordinary) package
+- // - inside the foo.mod/bar [foo.mod/bar.test] test variant package
+- // - from the foo.mod/bar_test [foo.mod/bar.test] x_test package
+- // - from the foo.mod/foo package
+- {"Blah", []string{"bar/bar.go", "bar/bar_test.go", "bar/bar_x_test.go", "foo/foo.go"}},
+-
+- // Foo is referenced in bar_x_test.go via the intermediate test variant
+- // foo.mod/foo [foo.mod/bar.test].
+- {"Foo", []string{"bar/bar_x_test.go", "foo/foo.go"}},
+- }
+-
+- for _, test := range refTests {
+- loc := env.RegexpSearch("foo/foo.go", test.re)
+- refs := env.References(loc)
+-
+- got := fileLocations(refs)
+- if diff := cmp.Diff(test.wantRefs, got); diff != "" {
+- t.Errorf("References(%q) returned unexpected diff (-want +got):\n%s", test.re, diff)
+- }
+- }
+-
+- implTests := []struct {
+- re string
+- wantImpls []string
+- }{
+- // InterfaceM is implemented both in foo.mod/bar [foo.mod/bar.test] (which
+- // doesn't import foo), and in foo.mod/bar_test [foo.mod/bar.test], which
+- // imports the test variant of foo.
+- {"InterfaceM", []string{"bar/bar_test.go", "bar/bar_x_test.go"}},
+-
+- // A search within the ordinary package to should find implementations
+- // (Fer) within the augmented test package.
+- {"InterfaceF", []string{"foo/foo_test.go"}},
+- }
+-
+- for _, test := range implTests {
+- loc := env.RegexpSearch("foo/foo.go", test.re)
+- impls := env.Implementations(loc)
+-
+- got := fileLocations(impls)
+- if diff := cmp.Diff(test.wantImpls, got); diff != "" {
+- t.Errorf("Implementations(%q) returned unexpected diff (-want +got):\n%s", test.re, diff)
+- }
+- }
+- })
+-}
+-
+-// This is a regression test for Issue #56169, in which interface
+-// implementations in vendored modules were not found. The actual fix
+-// was the same as for #55995; see TestVendoringInvalidatesMetadata.
+-func TestImplementationsInVendor(t *testing.T) {
+- t.Skip("golang/go#56169: file watching does not capture vendor dirs")
+-
+- const proxy = `
+--- other.com/b@v1.0.0/go.mod --
+-module other.com/b
+-go 1.14
+-
+--- other.com/b@v1.0.0/b.go --
+-package b
+-type B int
+-func (B) F() {}
+-`
+- const src = `
+--- go.mod --
+-module example.com/a
+-go 1.14
+-require other.com/b v1.0.0
+-
+--- go.sum --
+-other.com/b v1.0.0 h1:9WyCKS+BLAMRQM0CegP6zqP2beP+ShTbPaARpNY31II=
+-other.com/b v1.0.0/go.mod h1:TgHQFucl04oGT+vrUm/liAzukYHNxCwKNkQZEyn3m9g=
+-
+--- a.go --
+-package a
+-import "other.com/b"
+-type I interface { F() }
+-var _ b.B
+-
+-`
+- WithOptions(
+- ProxyFiles(proxy),
+- Modes(Default), // fails in 'experimental' mode
+- ).Run(t, src, func(t *testing.T, env *Env) {
+- // Enable to debug go.sum mismatch, which may appear as
+- // "module lookup disabled by GOPROXY=off", confusingly.
+- if false {
+- env.DumpGoSum(".")
+- }
+-
+- checkVendor := func(locs []protocol.Location, wantVendor bool) {
+- if len(locs) != 1 {
+- t.Errorf("got %d locations, want 1", len(locs))
+- } else if strings.Contains(string(locs[0].URI), "/vendor/") != wantVendor {
+- t.Errorf("got location %s, wantVendor=%t", locs[0], wantVendor)
+- }
+- }
+-
+- env.OpenFile("a.go")
+- refLoc := env.RegexpSearch("a.go", "I") // find "I" reference
+-
+- // Initially, a.I has one implementation b.B in
+- // the module cache, not the vendor tree.
+- checkVendor(env.Implementations(refLoc), false)
+-
+- // Run 'go mod vendor' outside the editor.
+- if err := env.Sandbox.RunGoCommand(env.Ctx, ".", "mod", []string{"vendor"}, true); err != nil {
+- t.Fatalf("go mod vendor: %v", err)
+- }
+-
+- // Synchronize changes to watched files.
+- env.Await(env.DoneWithChangeWatchedFiles())
+-
+- // Now, b.B is found in the vendor tree.
+- checkVendor(env.Implementations(refLoc), true)
+-
+- // Delete the vendor tree.
+- if err := os.RemoveAll(env.Sandbox.Workdir.AbsPath("vendor")); err != nil {
+- t.Fatal(err)
+- }
+- // Notify the server of the deletion.
+- if err := env.Sandbox.Workdir.CheckForFileChanges(env.Ctx); err != nil {
+- t.Fatal(err)
+- }
+-
+- // Synchronize again.
+- env.Await(env.DoneWithChangeWatchedFiles())
+-
+- // b.B is once again defined in the module cache.
+- checkVendor(env.Implementations(refLoc), false)
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/rename_test.go b/gopls/internal/regtest/misc/rename_test.go
+--- a/gopls/internal/regtest/misc/rename_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/rename_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,935 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "fmt"
+- "strings"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-func TestPrepareRenameMainPackage(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- main.go --
+-package main
+-
+-import (
+- "fmt"
+-)
+-
+-func main() {
+- fmt.Println(1)
+-}
+-`
+- const wantErr = "can't rename package \"main\""
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- loc := env.RegexpSearch("main.go", `main`)
+- params := &protocol.PrepareRenameParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+- _, err := env.Editor.Server.PrepareRename(env.Ctx, params)
+- if err == nil {
+- t.Errorf("missing can't rename package main error from PrepareRename")
+- }
+-
+- if err.Error() != wantErr {
+- t.Errorf("got %v, want %v", err.Error(), wantErr)
+- }
+- })
+-}
+-
+-// Test case for golang/go#56227
+-func TestRenameWithUnsafeSlice(t *testing.T) {
+- testenv.NeedsGo1Point(t, 17) // unsafe.Slice was added in Go 1.17
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- p.go --
+-package p
+-
+-import "unsafe"
+-
+-type T struct{}
+-
+-func (T) M() {}
+-
+-func _() {
+- x := [3]int{1, 2, 3}
+- ptr := unsafe.Pointer(&x)
+- _ = unsafe.Slice((*int)(ptr), 3)
+-}
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("p.go")
+- env.Rename(env.RegexpSearch("p.go", "M"), "N") // must not panic
+- })
+-}
+-
+-func TestPrepareRenameWithNoPackageDeclaration(t *testing.T) {
+- const files = `
+-go 1.14
+--- lib/a.go --
+-import "fmt"
+-
+-const A = 1
+-
+-func bar() {
+- fmt.Println("Bar")
+-}
+-
+--- main.go --
+-package main
+-
+-import "fmt"
+-
+-func main() {
+- fmt.Println("Hello")
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("lib/a.go")
+- err := env.Editor.Rename(env.Ctx, env.RegexpSearch("lib/a.go", "fmt"), "fmt1")
+- if got, want := fmt.Sprint(err), "no identifier found"; got != want {
+- t.Errorf("Rename: got error %v, want %v", got, want)
+- }
+- })
+-}
+-
+-func TestPrepareRenameFailWithUnknownModule(t *testing.T) {
+- testenv.NeedsGo1Point(t, 17)
+- const files = `
+-go 1.14
+--- lib/a.go --
+-package lib
+-
+-const A = 1
+-
+--- main.go --
+-package main
+-
+-import (
+- "mod.com/lib"
+-)
+-
+-func main() {
+- println("Hello")
+-}
+-`
+- const wantErr = "can't rename package: missing module information for package"
+- Run(t, files, func(t *testing.T, env *Env) {
+- loc := env.RegexpSearch("lib/a.go", "lib")
+- params := &protocol.PrepareRenameParams{
+- TextDocumentPositionParams: protocol.LocationTextDocumentPositionParams(loc),
+- }
+- _, err := env.Editor.Server.PrepareRename(env.Ctx, params)
+- if err == nil || !strings.Contains(err.Error(), wantErr) {
+- t.Errorf("missing cannot rename packages with unknown module from PrepareRename")
+- }
+- })
+-}
+-
+-// This test ensures that each import of a renamed package
+-// is also renamed if it would otherwise create a conflict.
+-func TestRenamePackageWithConflicts(t *testing.T) {
+- testenv.NeedsGo1Point(t, 17)
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- lib/a.go --
+-package lib
+-
+-const A = 1
+-
+--- lib/nested/a.go --
+-package nested
+-
+-const B = 1
+-
+--- lib/x/a.go --
+-package nested1
+-
+-const C = 1
+-
+--- main.go --
+-package main
+-
+-import (
+- "mod.com/lib"
+- "mod.com/lib/nested"
+- nested1 "mod.com/lib/x"
+-)
+-
+-func main() {
+- println("Hello")
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("lib/a.go")
+- env.Rename(env.RegexpSearch("lib/a.go", "lib"), "nested")
+-
+- // Check if the new package name exists.
+- env.RegexpSearch("nested/a.go", "package nested")
+- env.RegexpSearch("main.go", `nested2 "mod.com/nested"`)
+- env.RegexpSearch("main.go", "mod.com/nested/nested")
+- env.RegexpSearch("main.go", `nested1 "mod.com/nested/x"`)
+- })
+-}
+-
+-func TestRenamePackageWithAlias(t *testing.T) {
+- testenv.NeedsGo1Point(t, 17)
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- lib/a.go --
+-package lib
+-
+-const A = 1
+-
+--- lib/nested/a.go --
+-package nested
+-
+-const B = 1
+-
+--- main.go --
+-package main
+-
+-import (
+- "mod.com/lib"
+- lib1 "mod.com/lib/nested"
+-)
+-
+-func main() {
+- println("Hello")
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("lib/a.go")
+- env.Rename(env.RegexpSearch("lib/a.go", "lib"), "nested")
+-
+- // Check if the new package name exists.
+- env.RegexpSearch("nested/a.go", "package nested")
+- env.RegexpSearch("main.go", "mod.com/nested")
+- env.RegexpSearch("main.go", `lib1 "mod.com/nested/nested"`)
+- })
+-}
+-
+-func TestRenamePackageWithDifferentDirectoryPath(t *testing.T) {
+- testenv.NeedsGo1Point(t, 17)
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- lib/a.go --
+-package lib
+-
+-const A = 1
+-
+--- lib/nested/a.go --
+-package foo
+-
+-const B = 1
+-
+--- main.go --
+-package main
+-
+-import (
+- "mod.com/lib"
+- foo "mod.com/lib/nested"
+-)
+-
+-func main() {
+- println("Hello")
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("lib/a.go")
+- env.Rename(env.RegexpSearch("lib/a.go", "lib"), "nested")
+-
+- // Check if the new package name exists.
+- env.RegexpSearch("nested/a.go", "package nested")
+- env.RegexpSearch("main.go", "mod.com/nested")
+- env.RegexpSearch("main.go", `foo "mod.com/nested/nested"`)
+- })
+-}
+-
+-func TestRenamePackage(t *testing.T) {
+- testenv.NeedsGo1Point(t, 17)
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- lib/a.go --
+-package lib
+-
+-const A = 1
+-
+--- lib/b.go --
+-package lib
+-
+-const B = 1
+-
+--- lib/nested/a.go --
+-package nested
+-
+-const C = 1
+-
+--- main.go --
+-package main
+-
+-import (
+- "mod.com/lib"
+- "mod.com/lib/nested"
+-)
+-
+-func main() {
+- println("Hello")
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("lib/a.go")
+- env.Rename(env.RegexpSearch("lib/a.go", "lib"), "lib1")
+-
+- // Check if the new package name exists.
+- env.RegexpSearch("lib1/a.go", "package lib1")
+- env.RegexpSearch("lib1/b.go", "package lib1")
+- env.RegexpSearch("main.go", "mod.com/lib1")
+- env.RegexpSearch("main.go", "mod.com/lib1/nested")
+- })
+-}
+-
+-// Test for golang/go#47564.
+-func TestRenameInTestVariant(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- stringutil/stringutil.go --
+-package stringutil
+-
+-func Identity(s string) string {
+- return s
+-}
+--- stringutil/stringutil_test.go --
+-package stringutil
+-
+-func TestIdentity(t *testing.T) {
+- if got := Identity("foo"); got != "foo" {
+- t.Errorf("bad")
+- }
+-}
+--- main.go --
+-package main
+-
+-import (
+- "fmt"
+-
+- "mod.com/stringutil"
+-)
+-
+-func main() {
+- fmt.Println(stringutil.Identity("hello world"))
+-}
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.Rename(env.RegexpSearch("main.go", `stringutil\.(Identity)`), "Identityx")
+- env.OpenFile("stringutil/stringutil_test.go")
+- text := env.BufferText("stringutil/stringutil_test.go")
+- if !strings.Contains(text, "Identityx") {
+- t.Errorf("stringutil/stringutil_test.go: missing expected token `Identityx` after rename:\n%s", text)
+- }
+- })
+-}
+-
+-// This is a test that rename operation initiated by the editor function as expected.
+-func TestRenameFileFromEditor(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.16
+--- a/a.go --
+-package a
+-
+-const X = 1
+--- a/x.go --
+-package a
+-
+-const X = 2
+--- b/b.go --
+-package b
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- // Rename files and verify that diagnostics are affected accordingly.
+-
+- // Initially, we should have diagnostics on both X's, for their duplicate declaration.
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("a/a.go", "X")),
+- Diagnostics(env.AtRegexp("a/x.go", "X")),
+- )
+-
+- // Moving x.go should make the diagnostic go away.
+- env.RenameFile("a/x.go", "b/x.go")
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")), // no more duplicate declarations
+- Diagnostics(env.AtRegexp("b/b.go", "package")), // as package names mismatch
+- )
+-
+- // Renaming should also work on open buffers.
+- env.OpenFile("b/x.go")
+-
+- // Moving x.go back to a/ should cause the diagnostics to reappear.
+- env.RenameFile("b/x.go", "a/x.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/a.go", "X")),
+- Diagnostics(env.AtRegexp("a/x.go", "X")),
+- )
+-
+- // Renaming the entire directory should move both the open and closed file.
+- env.RenameFile("a", "x")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("x/a.go", "X")),
+- Diagnostics(env.AtRegexp("x/x.go", "X")),
+- )
+-
+- // As a sanity check, verify that x/x.go is open.
+- if text := env.BufferText("x/x.go"); text == "" {
+- t.Fatal("got empty buffer for x/x.go")
+- }
+- })
+-}
+-
+-func TestRenamePackage_Tests(t *testing.T) {
+- testenv.NeedsGo1Point(t, 17)
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- lib/a.go --
+-package lib
+-
+-const A = 1
+-
+--- lib/b.go --
+-package lib
+-
+-const B = 1
+-
+--- lib/a_test.go --
+-package lib_test
+-
+-import (
+- "mod.com/lib"
+- "fmt
+-)
+-
+-const C = 1
+-
+--- lib/b_test.go --
+-package lib
+-
+-import (
+- "fmt
+-)
+-
+-const D = 1
+-
+--- lib/nested/a.go --
+-package nested
+-
+-const D = 1
+-
+--- main.go --
+-package main
+-
+-import (
+- "mod.com/lib"
+- "mod.com/lib/nested"
+-)
+-
+-func main() {
+- println("Hello")
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("lib/a.go")
+- env.Rename(env.RegexpSearch("lib/a.go", "lib"), "lib1")
+-
+- // Check if the new package name exists.
+- env.RegexpSearch("lib1/a.go", "package lib1")
+- env.RegexpSearch("lib1/b.go", "package lib1")
+- env.RegexpSearch("main.go", "mod.com/lib1")
+- env.RegexpSearch("main.go", "mod.com/lib1/nested")
+-
+- // Check if the test package is renamed
+- env.RegexpSearch("lib1/a_test.go", "package lib1_test")
+- env.RegexpSearch("lib1/b_test.go", "package lib1")
+- })
+-}
+-
+-func TestRenamePackage_NestedModule(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+- const files = `
+--- go.work --
+-go 1.18
+-use (
+- .
+- ./foo/bar
+- ./foo/baz
+-)
+-
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+-
+-require (
+- mod.com/foo/bar v0.0.0
+-)
+-
+-replace (
+- mod.com/foo/bar => ./foo/bar
+- mod.com/foo/baz => ./foo/baz
+-)
+--- foo/foo.go --
+-package foo
+-
+-import "fmt"
+-
+-func Bar() {
+- fmt.Println("In foo before renamed to foox.")
+-}
+-
+--- foo/bar/go.mod --
+-module mod.com/foo/bar
+-
+--- foo/bar/bar.go --
+-package bar
+-
+-const Msg = "Hi from package bar"
+-
+--- foo/baz/go.mod --
+-module mod.com/foo/baz
+-
+--- foo/baz/baz.go --
+-package baz
+-
+-const Msg = "Hi from package baz"
+-
+--- main.go --
+-package main
+-
+-import (
+- "fmt"
+- "mod.com/foo/bar"
+- "mod.com/foo/baz"
+- "mod.com/foo"
+-)
+-
+-func main() {
+- foo.Bar()
+- fmt.Println(bar.Msg)
+- fmt.Println(baz.Msg)
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("foo/foo.go")
+- env.Rename(env.RegexpSearch("foo/foo.go", "foo"), "foox")
+-
+- env.RegexpSearch("foox/foo.go", "package foox")
+- env.OpenFile("foox/bar/bar.go")
+- env.OpenFile("foox/bar/go.mod")
+-
+- env.RegexpSearch("main.go", "mod.com/foo/bar")
+- env.RegexpSearch("main.go", "mod.com/foox")
+- env.RegexpSearch("main.go", "foox.Bar()")
+-
+- env.RegexpSearch("go.mod", "./foox/bar")
+- env.RegexpSearch("go.mod", "./foox/baz")
+- })
+-}
+-
+-func TestRenamePackage_DuplicateImport(t *testing.T) {
+- testenv.NeedsGo1Point(t, 17)
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- lib/a.go --
+-package lib
+-
+-const A = 1
+-
+--- lib/nested/a.go --
+-package nested
+-
+-const B = 1
+-
+--- main.go --
+-package main
+-
+-import (
+- "mod.com/lib"
+- lib1 "mod.com/lib"
+- lib2 "mod.com/lib/nested"
+-)
+-
+-func main() {
+- println("Hello")
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("lib/a.go")
+- env.Rename(env.RegexpSearch("lib/a.go", "lib"), "nested")
+-
+- // Check if the new package name exists.
+- env.RegexpSearch("nested/a.go", "package nested")
+- env.RegexpSearch("main.go", "mod.com/nested")
+- env.RegexpSearch("main.go", `lib1 "mod.com/nested"`)
+- env.RegexpSearch("main.go", `lib2 "mod.com/nested/nested"`)
+- })
+-}
+-
+-func TestRenamePackage_DuplicateBlankImport(t *testing.T) {
+- testenv.NeedsGo1Point(t, 17)
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- lib/a.go --
+-package lib
+-
+-const A = 1
+-
+--- lib/nested/a.go --
+-package nested
+-
+-const B = 1
+-
+--- main.go --
+-package main
+-
+-import (
+- "mod.com/lib"
+- _ "mod.com/lib"
+- lib1 "mod.com/lib/nested"
+-)
+-
+-func main() {
+- println("Hello")
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("lib/a.go")
+- env.Rename(env.RegexpSearch("lib/a.go", "lib"), "nested")
+-
+- // Check if the new package name exists.
+- env.RegexpSearch("nested/a.go", "package nested")
+- env.RegexpSearch("main.go", "mod.com/nested")
+- env.RegexpSearch("main.go", `_ "mod.com/nested"`)
+- env.RegexpSearch("main.go", `lib1 "mod.com/nested/nested"`)
+- })
+-}
+-
+-func TestRenamePackage_TestVariant(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- foo/foo.go --
+-package foo
+-
+-const Foo = 42
+--- bar/bar.go --
+-package bar
+-
+-import "mod.com/foo"
+-
+-const Bar = foo.Foo
+--- bar/bar_test.go --
+-package bar
+-
+-import "mod.com/foo"
+-
+-const Baz = foo.Foo
+--- testdata/bar/bar.go --
+-package bar
+-
+-import "mod.com/foox"
+-
+-const Bar = foox.Foo
+--- testdata/bar/bar_test.go --
+-package bar
+-
+-import "mod.com/foox"
+-
+-const Baz = foox.Foo
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("foo/foo.go")
+- env.Rename(env.RegexpSearch("foo/foo.go", "package (foo)"), "foox")
+-
+- checkTestdata(t, env)
+- })
+-}
+-
+-func TestRenamePackage_IntermediateTestVariant(t *testing.T) {
+- // In this test set up, we have the following import edges:
+- // bar_test -> baz -> foo -> bar
+- // bar_test -> foo -> bar
+- // bar_test -> bar
+- //
+- // As a consequence, bar_x_test.go is in the reverse closure of both
+- // `foo [bar.test]` and `baz [bar.test]`. This test confirms that we don't
+- // produce duplicate edits in this case.
+- const files = `
+--- go.mod --
+-module foo.mod
+-
+-go 1.12
+--- foo/foo.go --
+-package foo
+-
+-import "foo.mod/bar"
+-
+-const Foo = 42
+-
+-const _ = bar.Bar
+--- baz/baz.go --
+-package baz
+-
+-import "foo.mod/foo"
+-
+-const Baz = foo.Foo
+--- bar/bar.go --
+-package bar
+-
+-var Bar = 123
+--- bar/bar_test.go --
+-package bar
+-
+-const _ = Bar
+--- bar/bar_x_test.go --
+-package bar_test
+-
+-import (
+- "foo.mod/bar"
+- "foo.mod/baz"
+- "foo.mod/foo"
+-)
+-
+-const _ = bar.Bar + baz.Baz + foo.Foo
+--- testdata/foox/foo.go --
+-package foox
+-
+-import "foo.mod/bar"
+-
+-const Foo = 42
+-
+-const _ = bar.Bar
+--- testdata/baz/baz.go --
+-package baz
+-
+-import "foo.mod/foox"
+-
+-const Baz = foox.Foo
+--- testdata/bar/bar_x_test.go --
+-package bar_test
+-
+-import (
+- "foo.mod/bar"
+- "foo.mod/baz"
+- "foo.mod/foox"
+-)
+-
+-const _ = bar.Bar + baz.Baz + foox.Foo
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("foo/foo.go")
+- env.Rename(env.RegexpSearch("foo/foo.go", "package (foo)"), "foox")
+-
+- checkTestdata(t, env)
+- })
+-}
+-
+-func TestRenamePackage_Nesting(t *testing.T) {
+- testenv.NeedsGo1Point(t, 17)
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- lib/a.go --
+-package lib
+-
+-import "mod.com/lib/nested"
+-
+-const A = 1 + nested.B
+--- lib/nested/a.go --
+-package nested
+-
+-const B = 1
+--- other/other.go --
+-package other
+-
+-import (
+- "mod.com/lib"
+- "mod.com/lib/nested"
+-)
+-
+-const C = lib.A + nested.B
+--- testdata/libx/a.go --
+-package libx
+-
+-import "mod.com/libx/nested"
+-
+-const A = 1 + nested.B
+--- testdata/other/other.go --
+-package other
+-
+-import (
+- "mod.com/libx"
+- "mod.com/libx/nested"
+-)
+-
+-const C = libx.A + nested.B
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("lib/a.go")
+- env.Rename(env.RegexpSearch("lib/a.go", "package (lib)"), "libx")
+-
+- checkTestdata(t, env)
+- })
+-}
+-
+-func TestRenamePackage_InvalidName(t *testing.T) {
+- testenv.NeedsGo1Point(t, 17)
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- lib/a.go --
+-package lib
+-
+-import "mod.com/lib/nested"
+-
+-const A = 1 + nested.B
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("lib/a.go")
+- loc := env.RegexpSearch("lib/a.go", "package (lib)")
+-
+- for _, badName := range []string{"$$$", "lib_test"} {
+- if err := env.Editor.Rename(env.Ctx, loc, badName); err == nil {
+- t.Errorf("Rename(lib, libx) succeeded, want non-nil error")
+- }
+- }
+- })
+-}
+-
+-func TestRenamePackage_InternalPackage(t *testing.T) {
+- testenv.NeedsGo1Point(t, 17)
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- lib/a.go --
+-package lib
+-
+-import (
+- "fmt"
+- "mod.com/lib/internal/x"
+-)
+-
+-const A = 1
+-
+-func print() {
+- fmt.Println(x.B)
+-}
+-
+--- lib/internal/x/a.go --
+-package x
+-
+-const B = 1
+-
+--- main.go --
+-package main
+-
+-import "mod.com/lib"
+-
+-func main() {
+- lib.print()
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("lib/internal/x/a.go")
+- env.Rename(env.RegexpSearch("lib/internal/x/a.go", "x"), "utils")
+-
+- // Check if the new package name exists.
+- env.RegexpSearch("lib/a.go", "mod.com/lib/internal/utils")
+- env.RegexpSearch("lib/a.go", "utils.B")
+-
+- // Check if the test package is renamed
+- env.RegexpSearch("lib/internal/utils/a.go", "package utils")
+-
+- env.OpenFile("lib/a.go")
+- env.Rename(env.RegexpSearch("lib/a.go", "lib"), "lib1")
+-
+- // Check if the new package name exists.
+- env.RegexpSearch("lib1/a.go", "package lib1")
+- env.RegexpSearch("lib1/a.go", "mod.com/lib1/internal/utils")
+- env.RegexpSearch("main.go", `import "mod.com/lib1"`)
+- env.RegexpSearch("main.go", "lib1.print()")
+- })
+-}
+-
+-// checkTestdata checks that current buffer contents match their corresponding
+-// expected content in the testdata directory.
+-func checkTestdata(t *testing.T, env *Env) {
+- t.Helper()
+- files := env.ListFiles("testdata")
+- if len(files) == 0 {
+- t.Fatal("no files in testdata directory")
+- }
+- for _, file := range files {
+- suffix := strings.TrimPrefix(file, "testdata/")
+- got := env.BufferText(suffix)
+- want := env.ReadWorkspaceFile(file)
+- if diff := compare.Text(want, got); diff != "" {
+- t.Errorf("Rename: unexpected buffer content for %s (-want +got):\n%s", suffix, diff)
+- }
+- }
+-}
+diff -urN a/gopls/internal/regtest/misc/semantictokens_test.go b/gopls/internal/regtest/misc/semantictokens_test.go
+--- a/gopls/internal/regtest/misc/semantictokens_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/semantictokens_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,204 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "strings"
+- "testing"
+-
+- "github.com/google/go-cmp/cmp"
+- "golang.org/x/tools/gopls/internal/lsp"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/internal/typeparams"
+-)
+-
+-func TestBadURICrash_VSCodeIssue1498(t *testing.T) {
+- const src = `
+--- go.mod --
+-module example.com
+-
+-go 1.12
+-
+--- main.go --
+-package main
+-
+-func main() {}
+-
+-`
+- WithOptions(
+- Modes(Default),
+- Settings{"allExperiments": true},
+- ).Run(t, src, func(t *testing.T, env *Env) {
+- params := &protocol.SemanticTokensParams{}
+- const badURI = "http://foo"
+- params.TextDocument.URI = badURI
+- // This call panicked in the past: golang/vscode-go#1498.
+- if _, err := env.Editor.Server.SemanticTokensFull(env.Ctx, params); err != nil {
+- // Requests to an invalid URI scheme shouldn't result in an error, we
+- // simply don't support this so return empty result. This could be
+- // changed, but for now assert on the current behavior.
+- t.Errorf("SemanticTokensFull(%q): %v", badURI, err)
+- }
+- })
+-}
+-
+-// fix bug involving type parameters and regular parameters
+-// (golang/vscode-go#2527)
+-func TestSemantic_2527(t *testing.T) {
+- if !typeparams.Enabled {
+- t.Skip("type parameters are needed for this test")
+- }
+- // these are the expected types of identifiers in text order
+- want := []result{
+- {"package", "keyword", ""},
+- {"foo", "namespace", ""},
+- {"func", "keyword", ""},
+- {"Add", "function", "definition deprecated"},
+- {"T", "typeParameter", "definition"},
+- {"int", "type", "defaultLibrary"},
+- {"target", "parameter", "definition"},
+- {"T", "typeParameter", ""},
+- {"l", "parameter", "definition"},
+- {"T", "typeParameter", ""},
+- {"T", "typeParameter", ""},
+- {"return", "keyword", ""},
+- {"append", "function", "defaultLibrary"},
+- {"l", "parameter", ""},
+- {"target", "parameter", ""},
+- {"for", "keyword", ""},
+- {"range", "keyword", ""},
+- {"l", "parameter", ""},
+- {"return", "keyword", ""},
+- {"nil", "variable", "readonly defaultLibrary"},
+- }
+- src := `
+--- go.mod --
+-module example.com
+-
+-go 1.19
+--- main.go --
+-package foo
+-// Deprecated (for testing)
+-func Add[T int](target T, l []T) []T {
+- return append(l, target)
+- for range l {} // test coverage
+- return nil
+-}
+-`
+- WithOptions(
+- Modes(Default),
+- Settings{"semanticTokens": true},
+- ).Run(t, src, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("main.go", "for range")),
+- )
+- p := &protocol.SemanticTokensParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: env.Sandbox.Workdir.URI("main.go"),
+- },
+- }
+- v, err := env.Editor.Server.SemanticTokensFull(env.Ctx, p)
+- if err != nil {
+- t.Fatal(err)
+- }
+- seen := interpret(v.Data, env.BufferText("main.go"))
+- if x := cmp.Diff(want, seen); x != "" {
+- t.Errorf("Semantic tokens do not match (-want +got):\n%s", x)
+- }
+- })
+-
+-}
+-
+-// fix inconsistency in TypeParameters
+-// https://github.com/golang/go/issues/57619
+-func TestSemantic_57619(t *testing.T) {
+- if !typeparams.Enabled {
+- t.Skip("type parameters are needed for this test")
+- }
+- src := `
+--- go.mod --
+-module example.com
+-
+-go 1.19
+--- main.go --
+-package foo
+-type Smap[K int, V any] struct {
+- Store map[K]V
+-}
+-func (s *Smap[K, V]) Get(k K) (V, bool) {
+- v, ok := s.Store[k]
+- return v, ok
+-}
+-func New[K int, V any]() Smap[K, V] {
+- return Smap[K, V]{Store: make(map[K]V)}
+-}
+-`
+- WithOptions(
+- Modes(Default),
+- Settings{"semanticTokens": true},
+- ).Run(t, src, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- p := &protocol.SemanticTokensParams{
+- TextDocument: protocol.TextDocumentIdentifier{
+- URI: env.Sandbox.Workdir.URI("main.go"),
+- },
+- }
+- v, err := env.Editor.Server.SemanticTokensFull(env.Ctx, p)
+- if err != nil {
+- t.Fatal(err)
+- }
+- seen := interpret(v.Data, env.BufferText("main.go"))
+- for i, s := range seen {
+- if (s.Token == "K" || s.Token == "V") && s.TokenType != "typeParameter" {
+- t.Errorf("%d: expected K and V to be type parameters, but got %v", i, s)
+- }
+- }
+- })
+-}
+-
+-type result struct {
+- Token string
+- TokenType string
+- Mod string
+-}
+-
+-// human-readable version of the semantic tokens
+-// comment, string, number are elided
+-// (and in the future, maybe elide other things, like operators)
+-func interpret(x []uint32, contents string) []result {
+- lines := strings.Split(contents, "\n")
+- ans := []result{}
+- line, col := 1, 1
+- for i := 0; i < len(x); i += 5 {
+- line += int(x[i])
+- col += int(x[i+1])
+- if x[i] != 0 { // new line
+- col = int(x[i+1]) + 1 // 1-based column numbers
+- }
+- sz := x[i+2]
+- t := semanticTypes[x[i+3]]
+- if t == "comment" || t == "string" || t == "number" {
+- continue
+- }
+- l := x[i+4]
+- var mods []string
+- for i, mod := range semanticModifiers {
+- if l&(1<<i) != 0 {
+- mods = append(mods, mod)
+- }
+- }
+- // col is a utf-8 offset
+- tok := lines[line-1][col-1 : col-1+int(sz)]
+- ans = append(ans, result{tok, t, strings.Join(mods, " ")})
+- }
+- return ans
+-}
+-
+-var (
+- semanticTypes = lsp.SemanticTypes()
+- semanticModifiers = lsp.SemanticModifiers()
+-)
+diff -urN a/gopls/internal/regtest/misc/settings_test.go b/gopls/internal/regtest/misc/settings_test.go
+--- a/gopls/internal/regtest/misc/settings_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/settings_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,32 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-func TestEmptyDirectoryFilters_Issue51843(t *testing.T) {
+- const src = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-func main() {
+-}
+-`
+-
+- WithOptions(
+- Settings{"directoryFilters": []string{""}},
+- ).Run(t, src, func(t *testing.T, env *Env) {
+- // No need to do anything. Issue golang/go#51843 is triggered by the empty
+- // directory filter above.
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/shared_test.go b/gopls/internal/regtest/misc/shared_test.go
+--- a/gopls/internal/regtest/misc/shared_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/shared_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,72 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-// Smoke test that simultaneous editing sessions in the same workspace works.
+-func TestSimultaneousEdits(t *testing.T) {
+- const sharedProgram = `
+--- go.mod --
+-module mod
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-import "fmt"
+-
+-func main() {
+- fmt.Println("Hello World.")
+-}`
+-
+- WithOptions(
+- Modes(DefaultModes()&(Forwarded|SeparateProcess)),
+- ).Run(t, sharedProgram, func(t *testing.T, env1 *Env) {
+- // Create a second test session connected to the same workspace and server
+- // as the first.
+- awaiter := NewAwaiter(env1.Sandbox.Workdir)
+- const skipApplyEdits = false
+- editor, err := fake.NewEditor(env1.Sandbox, env1.Editor.Config()).Connect(env1.Ctx, env1.Server, awaiter.Hooks(), skipApplyEdits)
+- if err != nil {
+- t.Fatal(err)
+- }
+- env2 := &Env{
+- T: t,
+- Ctx: env1.Ctx,
+- Sandbox: env1.Sandbox,
+- Server: env1.Server,
+- Editor: editor,
+- Awaiter: awaiter,
+- }
+- env2.Await(InitialWorkspaceLoad)
+- // In editor #1, break fmt.Println as before.
+- env1.OpenFile("main.go")
+- env1.RegexpReplace("main.go", "Printl(n)", "")
+- // In editor #2 remove the closing brace.
+- env2.OpenFile("main.go")
+- env2.RegexpReplace("main.go", "\\)\n(})", "")
+-
+- // Now check that we got different diagnostics in each environment.
+- env1.AfterChange(Diagnostics(env1.AtRegexp("main.go", "Printl")))
+- env2.AfterChange(Diagnostics(env2.AtRegexp("main.go", "$")))
+-
+- // Now close editor #2, and verify that operation in editor #1 is
+- // unaffected.
+- if err := env2.Editor.Close(env2.Ctx); err != nil {
+- t.Errorf("closing second editor: %v", err)
+- }
+-
+- env1.RegexpReplace("main.go", "Printl", "Println")
+- env1.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- )
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/signature_help_test.go b/gopls/internal/regtest/misc/signature_help_test.go
+--- a/gopls/internal/regtest/misc/signature_help_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/signature_help_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,69 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "testing"
+-
+- "github.com/google/go-cmp/cmp"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-func TestSignatureHelpInNonWorkspacePackage(t *testing.T) {
+- const files = `
+--- a/go.mod --
+-module a.com
+-
+-go 1.18
+--- a/a/a.go --
+-package a
+-
+-func DoSomething(int) {}
+-
+-func _() {
+- DoSomething()
+-}
+--- b/go.mod --
+-module b.com
+-go 1.18
+-
+-require a.com v1.0.0
+-
+-replace a.com => ../a
+--- b/b/b.go --
+-package b
+-
+-import "a.com/a"
+-
+-func _() {
+- a.DoSomething()
+-}
+-`
+-
+- WithOptions(
+- WorkspaceFolders("a"),
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a/a.go")
+- env.OpenFile("b/b/b.go")
+- signatureHelp := func(filename string) *protocol.SignatureHelp {
+- loc := env.RegexpSearch(filename, `DoSomething\(()\)`)
+- var params protocol.SignatureHelpParams
+- params.TextDocument.URI = loc.URI
+- params.Position = loc.Range.Start
+- help, err := env.Editor.Server.SignatureHelp(env.Ctx, &params)
+- if err != nil {
+- t.Fatal(err)
+- }
+- return help
+- }
+- ahelp := signatureHelp("a/a/a.go")
+- bhelp := signatureHelp("b/b/b.go")
+-
+- if diff := cmp.Diff(ahelp, bhelp); diff != "" {
+- t.Fatal(diff)
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/staticcheck_test.go b/gopls/internal/regtest/misc/staticcheck_test.go
+--- a/gopls/internal/regtest/misc/staticcheck_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/staticcheck_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,110 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/internal/testenv"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-func TestStaticcheckGenerics(t *testing.T) {
+- testenv.NeedsGo1Point(t, 19) // generics were introduced in Go 1.18, staticcheck requires go1.19+
+-
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- a/a.go --
+-package a
+-
+-import (
+- "errors"
+- "sort"
+- "strings"
+-)
+-
+-func Zero[P any]() P {
+- var p P
+- return p
+-}
+-
+-type Inst[P any] struct {
+- Field P
+-}
+-
+-func testGenerics[P *T, T any](p P) {
+- // Calls to instantiated functions should not break checks.
+- slice := Zero[string]()
+- sort.Slice(slice, func(i, j int) bool {
+- return slice[i] < slice[j]
+- })
+-
+- // Usage of instantiated fields should not break checks.
+- g := Inst[string]{"hello"}
+- g.Field = strings.TrimLeft(g.Field, "12234")
+-
+- // Use of type parameters should not break checks.
+- var q P
+- p = q // SA4009: p is overwritten before its first use
+- q = &*p // SA4001: &* will be simplified
+-}
+-
+-
+-// FooErr should be called ErrFoo (ST1012)
+-var FooErr error = errors.New("foo")
+-`
+-
+- WithOptions(
+- Settings{"staticcheck": true},
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/a.go", "sort.Slice"), FromSource("sortslice")),
+- Diagnostics(env.AtRegexp("a/a.go", "sort.Slice.(slice)"), FromSource("SA1028")),
+- Diagnostics(env.AtRegexp("a/a.go", "var (FooErr)"), FromSource("ST1012")),
+- Diagnostics(env.AtRegexp("a/a.go", `"12234"`), FromSource("SA1024")),
+- Diagnostics(env.AtRegexp("a/a.go", "testGenerics.*(p P)"), FromSource("SA4009")),
+- Diagnostics(env.AtRegexp("a/a.go", "q = (&\\*p)"), FromSource("SA4001")),
+- )
+- })
+-}
+-
+-// Test for golang/go#56270: an analysis with related info should not panic if
+-// analysis.RelatedInformation.End is not set.
+-func TestStaticcheckRelatedInfo(t *testing.T) {
+- testenv.NeedsGo1Point(t, 19) // staticcheck is only supported at Go 1.19+
+- const files = `
+--- go.mod --
+-module mod.test
+-
+-go 1.18
+--- p.go --
+-package p
+-
+-import (
+- "fmt"
+-)
+-
+-func Foo(enabled interface{}) {
+- if enabled, ok := enabled.(bool); ok {
+- } else {
+- _ = fmt.Sprintf("invalid type %T", enabled) // enabled is always bool here
+- }
+-}
+-`
+-
+- WithOptions(
+- Settings{"staticcheck": true},
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("p.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("p.go", ", (enabled)"), FromSource("SA9008")),
+- )
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/vendor_test.go b/gopls/internal/regtest/misc/vendor_test.go
+--- a/gopls/internal/regtest/misc/vendor_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/vendor_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,65 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-const basicProxy = `
+--- golang.org/x/hello@v1.2.3/go.mod --
+-module golang.org/x/hello
+-
+-go 1.14
+--- golang.org/x/hello@v1.2.3/hi/hi.go --
+-package hi
+-
+-var Goodbye error
+-`
+-
+-func TestInconsistentVendoring(t *testing.T) {
+- const pkgThatUsesVendoring = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+-
+-require golang.org/x/hello v1.2.3
+--- go.sum --
+-golang.org/x/hello v1.2.3 h1:EcMp5gSkIhaTkPXp8/3+VH+IFqTpk3ZbpOhqk0Ncmho=
+-golang.org/x/hello v1.2.3/go.mod h1:WW7ER2MRNXWA6c8/4bDIek4Hc/+DofTrMaQQitGXcco=
+--- vendor/modules.txt --
+--- a/a1.go --
+-package a
+-
+-import "golang.org/x/hello/hi"
+-
+-func _() {
+- _ = hi.Goodbye
+- var q int // hardcode a diagnostic
+-}
+-`
+- WithOptions(
+- Modes(Default),
+- ProxyFiles(basicProxy),
+- ).Run(t, pkgThatUsesVendoring, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a1.go")
+- d := &protocol.PublishDiagnosticsParams{}
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("go.mod", "module mod.com"), WithMessage("Inconsistent vendoring")),
+- ReadDiagnostics("go.mod", d),
+- )
+- env.ApplyQuickFixes("go.mod", d.Diagnostics)
+-
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/a1.go", `q int`), WithMessage("not used")),
+- )
+- })
+-}
+diff -urN a/gopls/internal/regtest/misc/vuln_test.go b/gopls/internal/regtest/misc/vuln_test.go
+--- a/gopls/internal/regtest/misc/vuln_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/vuln_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,977 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package misc
+-
+-import (
+- "context"
+- "encoding/json"
+- "path/filepath"
+- "sort"
+- "strings"
+- "testing"
+-
+- "github.com/google/go-cmp/cmp"
+- "golang.org/x/tools/gopls/internal/govulncheck"
+- "golang.org/x/tools/gopls/internal/lsp/command"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+- "golang.org/x/tools/gopls/internal/vulncheck"
+- "golang.org/x/tools/gopls/internal/vulncheck/vulntest"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-func TestRunGovulncheckError(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- foo.go --
+-package foo
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- cmd, err := command.NewRunGovulncheckCommand("Run Vulncheck Exp", command.VulncheckArgs{
+- URI: "/invalid/file/url", // invalid arg
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+-
+- params := &protocol.ExecuteCommandParams{
+- Command: command.RunGovulncheck.ID(),
+- Arguments: cmd.Arguments,
+- }
+-
+- response, err := env.Editor.ExecuteCommand(env.Ctx, params)
+- // We want an error!
+- if err == nil {
+- t.Errorf("got success, want invalid file URL error: %v", response)
+- }
+- })
+-}
+-
+-func TestRunGovulncheckError2(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- foo.go --
+-package foo
+-
+-func F() { // build error incomplete
+-`
+- WithOptions(
+- EnvVars{
+- "_GOPLS_TEST_BINARY_RUN_AS_GOPLS": "true", // needed to run `gopls vulncheck`.
+- },
+- Settings{
+- "codelenses": map[string]bool{
+- "run_govulncheck": true,
+- },
+- },
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("go.mod")
+- var result command.RunVulncheckResult
+- env.ExecuteCodeLensCommand("go.mod", command.RunGovulncheck, &result)
+- var ws WorkStatus
+- env.Await(
+- CompletedProgress(result.Token, &ws),
+- )
+- wantEndMsg, wantMsgPart := "failed", "failed to load packages due to errors"
+- if ws.EndMsg != "failed" || !strings.Contains(ws.Msg, wantMsgPart) {
+- t.Errorf("work status = %+v, want {EndMessage: %q, Message: %q}", ws, wantEndMsg, wantMsgPart)
+- }
+- })
+-}
+-
+-const vulnsData = `
+--- GO-2022-01.yaml --
+-modules:
+- - module: golang.org/amod
+- versions:
+- - introduced: 1.0.0
+- - fixed: 1.0.4
+- - introduced: 1.1.2
+- packages:
+- - package: golang.org/amod/avuln
+- symbols:
+- - VulnData.Vuln1
+- - VulnData.Vuln2
+-description: >
+- vuln in amod
+-references:
+- - href: pkg.go.dev/vuln/GO-2022-01
+--- GO-2022-03.yaml --
+-modules:
+- - module: golang.org/amod
+- versions:
+- - introduced: 1.0.0
+- - fixed: 1.0.6
+- packages:
+- - package: golang.org/amod/avuln
+- symbols:
+- - nonExisting
+-description: >
+- unaffecting vulnerability
+--- GO-2022-02.yaml --
+-modules:
+- - module: golang.org/bmod
+- packages:
+- - package: golang.org/bmod/bvuln
+- symbols:
+- - Vuln
+-description: |
+- vuln in bmod
+-
+- This is a long description
+- of this vulnerability.
+-references:
+- - href: pkg.go.dev/vuln/GO-2022-03
+--- GO-2022-04.yaml --
+-modules:
+- - module: golang.org/bmod
+- packages:
+- - package: golang.org/bmod/unused
+- symbols:
+- - Vuln
+-description: |
+- vuln in bmod/somtrhingelse
+-references:
+- - href: pkg.go.dev/vuln/GO-2022-04
+--- GOSTDLIB.yaml --
+-modules:
+- - module: stdlib
+- versions:
+- - introduced: 1.18.0
+- packages:
+- - package: archive/zip
+- symbols:
+- - OpenReader
+-references:
+- - href: pkg.go.dev/vuln/GOSTDLIB
+-`
+-
+-func TestRunGovulncheckStd(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- main.go --
+-package main
+-
+-import (
+- "archive/zip"
+- "fmt"
+-)
+-
+-func main() {
+- _, err := zip.OpenReader("file.zip") // vulnerability id: GOSTDLIB
+- fmt.Println(err)
+-}
+-`
+-
+- db, err := vulntest.NewDatabase(context.Background(), []byte(vulnsData))
+- if err != nil {
+- t.Fatal(err)
+- }
+- defer db.Clean()
+- WithOptions(
+- EnvVars{
+- // Let the analyzer read vulnerabilities data from the testdata/vulndb.
+- "GOVULNDB": db.URI(),
+- // When fetchinging stdlib package vulnerability info,
+- // behave as if our go version is go1.18 for this testing.
+- // The default behavior is to run `go env GOVERSION` (which isn't mutable env var).
+- vulncheck.GoVersionForVulnTest: "go1.18",
+- "_GOPLS_TEST_BINARY_RUN_AS_GOPLS": "true", // needed to run `gopls vulncheck`.
+- },
+- Settings{
+- "codelenses": map[string]bool{
+- "run_govulncheck": true,
+- },
+- },
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("go.mod")
+-
+- // Test CodeLens is present.
+- lenses := env.CodeLens("go.mod")
+-
+- const wantCommand = "gopls." + string(command.RunGovulncheck)
+- var gotCodelens = false
+- var lens protocol.CodeLens
+- for _, l := range lenses {
+- if l.Command.Command == wantCommand {
+- gotCodelens = true
+- lens = l
+- break
+- }
+- }
+- if !gotCodelens {
+- t.Fatal("got no vulncheck codelens")
+- }
+- // Run Command included in the codelens.
+- var result command.RunVulncheckResult
+- env.ExecuteCommand(&protocol.ExecuteCommandParams{
+- Command: lens.Command.Command,
+- Arguments: lens.Command.Arguments,
+- }, &result)
+-
+- env.OnceMet(
+- CompletedProgress(result.Token, nil),
+- ShownMessage("Found GOSTDLIB"),
+- NoDiagnostics(ForFile("go.mod")),
+- )
+- testFetchVulncheckResult(t, env, map[string]fetchVulncheckResult{
+- "go.mod": {IDs: []string{"GOSTDLIB"}, Mode: govulncheck.ModeGovulncheck}})
+- })
+-}
+-
+-func TestFetchVulncheckResultStd(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.18
+--- main.go --
+-package main
+-
+-import (
+- "archive/zip"
+- "fmt"
+-)
+-
+-func main() {
+- _, err := zip.OpenReader("file.zip") // vulnerability id: GOSTDLIB
+- fmt.Println(err)
+-}
+-`
+-
+- db, err := vulntest.NewDatabase(context.Background(), []byte(vulnsData))
+- if err != nil {
+- t.Fatal(err)
+- }
+- defer db.Clean()
+- WithOptions(
+- EnvVars{
+- // Let the analyzer read vulnerabilities data from the testdata/vulndb.
+- "GOVULNDB": db.URI(),
+- // When fetchinging stdlib package vulnerability info,
+- // behave as if our go version is go1.18 for this testing.
+- vulncheck.GoVersionForVulnTest: "go1.18",
+- "_GOPLS_TEST_BINARY_RUN_AS_GOPLS": "true", // needed to run `gopls vulncheck`.
+- },
+- Settings{"ui.diagnostic.vulncheck": "Imports"},
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("go.mod")
+- env.AfterChange(
+- NoDiagnostics(ForFile("go.mod")),
+- // we don't publish diagnostics for standard library vulnerability yet.
+- )
+- testFetchVulncheckResult(t, env, map[string]fetchVulncheckResult{
+- "go.mod": {
+- IDs: []string{"GOSTDLIB"},
+- Mode: govulncheck.ModeImports,
+- },
+- })
+- })
+-}
+-
+-type fetchVulncheckResult struct {
+- IDs []string
+- Mode govulncheck.AnalysisMode
+-}
+-
+-func testFetchVulncheckResult(t *testing.T, env *Env, want map[string]fetchVulncheckResult) {
+- t.Helper()
+-
+- var result map[protocol.DocumentURI]*govulncheck.Result
+- fetchCmd, err := command.NewFetchVulncheckResultCommand("fetch", command.URIArg{
+- URI: env.Sandbox.Workdir.URI("go.mod"),
+- })
+- if err != nil {
+- t.Fatal(err)
+- }
+- env.ExecuteCommand(&protocol.ExecuteCommandParams{
+- Command: fetchCmd.Command,
+- Arguments: fetchCmd.Arguments,
+- }, &result)
+-
+- for _, v := range want {
+- sort.Strings(v.IDs)
+- }
+- got := map[string]fetchVulncheckResult{}
+- for k, r := range result {
+- var osv []string
+- for _, v := range r.Vulns {
+- osv = append(osv, v.OSV.ID)
+- }
+- sort.Strings(osv)
+- modfile := env.Sandbox.Workdir.RelPath(k.SpanURI().Filename())
+- got[modfile] = fetchVulncheckResult{
+- IDs: osv,
+- Mode: r.Mode,
+- }
+- }
+- if diff := cmp.Diff(want, got); diff != "" {
+- t.Errorf("fetch vulnchheck result = got %v, want %v: diff %v", got, want, diff)
+- }
+-}
+-
+-const workspace1 = `
+--- go.mod --
+-module golang.org/entry
+-
+-go 1.18
+-
+-require golang.org/cmod v1.1.3
+-
+-require (
+- golang.org/amod v1.0.0 // indirect
+- golang.org/bmod v0.5.0 // indirect
+-)
+--- go.sum --
+-golang.org/amod v1.0.0 h1:EUQOI2m5NhQZijXZf8WimSnnWubaFNrrKUH/PopTN8k=
+-golang.org/amod v1.0.0/go.mod h1:yvny5/2OtYFomKt8ax+WJGvN6pfN1pqjGnn7DQLUi6E=
+-golang.org/bmod v0.5.0 h1:KgvUulMyMiYRB7suKA0x+DfWRVdeyPgVJvcishTH+ng=
+-golang.org/bmod v0.5.0/go.mod h1:f6o+OhF66nz/0BBc/sbCsshyPRKMSxZIlG50B/bsM4c=
+-golang.org/cmod v1.1.3 h1:PJ7rZFTk7xGAunBRDa0wDe7rZjZ9R/vr1S2QkVVCngQ=
+-golang.org/cmod v1.1.3/go.mod h1:eCR8dnmvLYQomdeAZRCPgS5JJihXtqOQrpEkNj5feQA=
+--- x/x.go --
+-package x
+-
+-import (
+- "golang.org/cmod/c"
+- "golang.org/entry/y"
+-)
+-
+-func X() {
+- c.C1().Vuln1() // vuln use: X -> Vuln1
+-}
+-
+-func CallY() {
+- y.Y() // vuln use: CallY -> y.Y -> bvuln.Vuln
+-}
+-
+--- y/y.go --
+-package y
+-
+-import "golang.org/cmod/c"
+-
+-func Y() {
+- c.C2()() // vuln use: Y -> bvuln.Vuln
+-}
+-`
+-
+-// cmod/c imports amod/avuln and bmod/bvuln.
+-const proxy1 = `
+--- golang.org/cmod@v1.1.3/go.mod --
+-module golang.org/cmod
+-
+-go 1.12
+--- golang.org/cmod@v1.1.3/c/c.go --
+-package c
+-
+-import (
+- "golang.org/amod/avuln"
+- "golang.org/bmod/bvuln"
+-)
+-
+-type I interface {
+- Vuln1()
+-}
+-
+-func C1() I {
+- v := avuln.VulnData{}
+- v.Vuln2() // vuln use
+- return v
+-}
+-
+-func C2() func() {
+- return bvuln.Vuln
+-}
+--- golang.org/amod@v1.0.0/go.mod --
+-module golang.org/amod
+-
+-go 1.14
+--- golang.org/amod@v1.0.0/avuln/avuln.go --
+-package avuln
+-
+-type VulnData struct {}
+-func (v VulnData) Vuln1() {}
+-func (v VulnData) Vuln2() {}
+--- golang.org/amod@v1.0.4/go.mod --
+-module golang.org/amod
+-
+-go 1.14
+--- golang.org/amod@v1.0.4/avuln/avuln.go --
+-package avuln
+-
+-type VulnData struct {}
+-func (v VulnData) Vuln1() {}
+-func (v VulnData) Vuln2() {}
+-
+--- golang.org/bmod@v0.5.0/go.mod --
+-module golang.org/bmod
+-
+-go 1.14
+--- golang.org/bmod@v0.5.0/bvuln/bvuln.go --
+-package bvuln
+-
+-func Vuln() {
+- // something evil
+-}
+--- golang.org/bmod@v0.5.0/unused/unused.go --
+-package unused
+-
+-func Vuln() {
+- // something evil
+-}
+--- golang.org/amod@v1.0.6/go.mod --
+-module golang.org/amod
+-
+-go 1.14
+--- golang.org/amod@v1.0.6/avuln/avuln.go --
+-package avuln
+-
+-type VulnData struct {}
+-func (v VulnData) Vuln1() {}
+-func (v VulnData) Vuln2() {}
+-`
+-
+-func vulnTestEnv(vulnsDB, proxyData string) (*vulntest.DB, []RunOption, error) {
+- db, err := vulntest.NewDatabase(context.Background(), []byte(vulnsData))
+- if err != nil {
+- return nil, nil, nil
+- }
+- settings := Settings{
+- "codelenses": map[string]bool{
+- "run_govulncheck": true,
+- },
+- }
+- ev := EnvVars{
+- // Let the analyzer read vulnerabilities data from the testdata/vulndb.
+- "GOVULNDB": db.URI(),
+- // When fetching stdlib package vulnerability info,
+- // behave as if our go version is go1.18 for this testing.
+- // The default behavior is to run `go env GOVERSION` (which isn't mutable env var).
+- vulncheck.GoVersionForVulnTest: "go1.18",
+- "_GOPLS_TEST_BINARY_RUN_AS_GOPLS": "true", // needed to run `gopls vulncheck`.
+- "GOSUMDB": "off",
+- }
+- return db, []RunOption{ProxyFiles(proxyData), ev, settings}, nil
+-}
+-
+-func TestRunVulncheckPackageDiagnostics(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+-
+- db, opts0, err := vulnTestEnv(vulnsData, proxy1)
+- if err != nil {
+- t.Fatal(err)
+- }
+- defer db.Clean()
+-
+- checkVulncheckDiagnostics := func(env *Env, t *testing.T) {
+- env.OpenFile("go.mod")
+-
+- gotDiagnostics := &protocol.PublishDiagnosticsParams{}
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("go.mod", `golang.org/amod`)),
+- ReadDiagnostics("go.mod", gotDiagnostics),
+- )
+-
+- testFetchVulncheckResult(t, env, map[string]fetchVulncheckResult{
+- "go.mod": {
+- IDs: []string{"GO-2022-01", "GO-2022-02", "GO-2022-03"},
+- Mode: govulncheck.ModeImports,
+- },
+- })
+-
+- wantVulncheckDiagnostics := map[string]vulnDiagExpectation{
+- "golang.org/amod": {
+- diagnostics: []vulnDiag{
+- {
+- msg: "golang.org/amod has known vulnerabilities GO-2022-01, GO-2022-03.",
+- severity: protocol.SeverityInformation,
+- source: string(source.Vulncheck),
+- codeActions: []string{
+- "Run govulncheck to verify",
+- "Upgrade to v1.0.6",
+- "Upgrade to latest",
+- },
+- },
+- },
+- codeActions: []string{
+- "Run govulncheck to verify",
+- "Upgrade to v1.0.6",
+- "Upgrade to latest",
+- },
+- hover: []string{"GO-2022-01", "Fixed in v1.0.4.", "GO-2022-03"},
+- },
+- "golang.org/bmod": {
+- diagnostics: []vulnDiag{
+- {
+- msg: "golang.org/bmod has a vulnerability GO-2022-02.",
+- severity: protocol.SeverityInformation,
+- source: string(source.Vulncheck),
+- codeActions: []string{
+- "Run govulncheck to verify",
+- },
+- },
+- },
+- codeActions: []string{
+- "Run govulncheck to verify",
+- },
+- hover: []string{"GO-2022-02", "This is a long description of this vulnerability.", "No fix is available."},
+- },
+- }
+-
+- for pattern, want := range wantVulncheckDiagnostics {
+- modPathDiagnostics := testVulnDiagnostics(t, env, pattern, want, gotDiagnostics)
+-
+- gotActions := env.CodeAction("go.mod", modPathDiagnostics)
+- if diff := diffCodeActions(gotActions, want.codeActions); diff != "" {
+- t.Errorf("code actions for %q do not match, got %v, want %v\n%v\n", pattern, gotActions, want.codeActions, diff)
+- continue
+- }
+- }
+- }
+-
+- wantNoVulncheckDiagnostics := func(env *Env, t *testing.T) {
+- env.OpenFile("go.mod")
+-
+- gotDiagnostics := &protocol.PublishDiagnosticsParams{}
+- env.AfterChange(
+- ReadDiagnostics("go.mod", gotDiagnostics),
+- )
+-
+- if len(gotDiagnostics.Diagnostics) > 0 {
+- t.Errorf("Unexpected diagnostics: %v", stringify(gotDiagnostics))
+- }
+- testFetchVulncheckResult(t, env, map[string]fetchVulncheckResult{})
+- }
+-
+- for _, tc := range []struct {
+- name string
+- setting Settings
+- wantDiagnostics bool
+- }{
+- {"imports", Settings{"ui.diagnostic.vulncheck": "Imports"}, true},
+- {"default", Settings{}, false},
+- {"invalid", Settings{"ui.diagnostic.vulncheck": "invalid"}, false},
+- } {
+- t.Run(tc.name, func(t *testing.T) {
+- // override the settings options to enable diagnostics
+- opts := append(opts0, tc.setting)
+- WithOptions(opts...).Run(t, workspace1, func(t *testing.T, env *Env) {
+- // TODO(hyangah): implement it, so we see GO-2022-01, GO-2022-02, and GO-2022-03.
+- // Check that the actions we get when including all diagnostics at a location return the same result
+- if tc.wantDiagnostics {
+- checkVulncheckDiagnostics(env, t)
+- } else {
+- wantNoVulncheckDiagnostics(env, t)
+- }
+-
+- if tc.name == "imports" && tc.wantDiagnostics {
+- // test we get only govulncheck-based diagnostics after "run govulncheck".
+- var result command.RunVulncheckResult
+- env.ExecuteCodeLensCommand("go.mod", command.RunGovulncheck, &result)
+- gotDiagnostics := &protocol.PublishDiagnosticsParams{}
+- env.OnceMet(
+- CompletedProgress(result.Token, nil),
+- ShownMessage("Found"),
+- )
+- env.OnceMet(
+- Diagnostics(env.AtRegexp("go.mod", "golang.org/bmod")),
+- ReadDiagnostics("go.mod", gotDiagnostics),
+- )
+- // We expect only one diagnostic for GO-2022-02.
+- count := 0
+- for _, diag := range gotDiagnostics.Diagnostics {
+- if strings.Contains(diag.Message, "GO-2022-02") {
+- count++
+- if got, want := diag.Severity, protocol.SeverityWarning; got != want {
+- t.Errorf("Diagnostic for GO-2022-02 = %v, want %v", got, want)
+- }
+- }
+- }
+- if count != 1 {
+- t.Errorf("Unexpected number of diagnostics about GO-2022-02 = %v, want 1:\n%+v", count, stringify(gotDiagnostics))
+- }
+- }
+- })
+- })
+- }
+-}
+-
+-func stringify(a interface{}) string {
+- data, _ := json.Marshal(a)
+- return string(data)
+-}
+-
+-func TestRunVulncheckWarning(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+-
+- db, opts, err := vulnTestEnv(vulnsData, proxy1)
+- if err != nil {
+- t.Fatal(err)
+- }
+- defer db.Clean()
+- WithOptions(opts...).Run(t, workspace1, func(t *testing.T, env *Env) {
+- env.OpenFile("go.mod")
+-
+- var result command.RunVulncheckResult
+- env.ExecuteCodeLensCommand("go.mod", command.RunGovulncheck, &result)
+- gotDiagnostics := &protocol.PublishDiagnosticsParams{}
+- env.OnceMet(
+- CompletedProgress(result.Token, nil),
+- ShownMessage("Found"),
+- )
+- // Vulncheck diagnostics asynchronous to the vulncheck command.
+- env.OnceMet(
+- Diagnostics(env.AtRegexp("go.mod", `golang.org/amod`)),
+- ReadDiagnostics("go.mod", gotDiagnostics),
+- )
+-
+- testFetchVulncheckResult(t, env, map[string]fetchVulncheckResult{
+- "go.mod": {IDs: []string{"GO-2022-01", "GO-2022-02", "GO-2022-03"}, Mode: govulncheck.ModeGovulncheck},
+- })
+- env.OpenFile("x/x.go")
+- lineX := env.RegexpSearch("x/x.go", `c\.C1\(\)\.Vuln1\(\)`).Range.Start
+- env.OpenFile("y/y.go")
+- lineY := env.RegexpSearch("y/y.go", `c\.C2\(\)\(\)`).Range.Start
+- wantDiagnostics := map[string]vulnDiagExpectation{
+- "golang.org/amod": {
+- applyAction: "Upgrade to v1.0.6",
+- diagnostics: []vulnDiag{
+- {
+- msg: "golang.org/amod has a vulnerability used in the code: GO-2022-01.",
+- severity: protocol.SeverityWarning,
+- source: string(source.Govulncheck),
+- codeActions: []string{
+- "Upgrade to v1.0.4",
+- "Upgrade to latest",
+- "Reset govulncheck result",
+- },
+- relatedInfo: []vulnRelatedInfo{
+- {"x.go", uint32(lineX.Line), "[GO-2022-01]"}, // avuln.VulnData.Vuln1
+- {"x.go", uint32(lineX.Line), "[GO-2022-01]"}, // avuln.VulnData.Vuln2
+- },
+- },
+- {
+- msg: "golang.org/amod has a vulnerability GO-2022-03 that is not used in the code.",
+- severity: protocol.SeverityInformation,
+- source: string(source.Govulncheck),
+- codeActions: []string{
+- "Upgrade to v1.0.6",
+- "Upgrade to latest",
+- "Reset govulncheck result",
+- },
+- relatedInfo: []vulnRelatedInfo{
+- {"x.go", uint32(lineX.Line), "[GO-2022-01]"}, // avuln.VulnData.Vuln1
+- {"x.go", uint32(lineX.Line), "[GO-2022-01]"}, // avuln.VulnData.Vuln2
+- },
+- },
+- },
+- codeActions: []string{
+- "Upgrade to v1.0.6",
+- "Upgrade to latest",
+- "Reset govulncheck result",
+- },
+- hover: []string{"GO-2022-01", "Fixed in v1.0.4.", "GO-2022-03"},
+- },
+- "golang.org/bmod": {
+- diagnostics: []vulnDiag{
+- {
+- msg: "golang.org/bmod has a vulnerability used in the code: GO-2022-02.",
+- severity: protocol.SeverityWarning,
+- source: string(source.Govulncheck),
+- codeActions: []string{
+- "Reset govulncheck result", // no fix, but we should give an option to reset.
+- },
+- relatedInfo: []vulnRelatedInfo{
+- {"y.go", uint32(lineY.Line), "[GO-2022-02]"}, // bvuln.Vuln
+- },
+- },
+- },
+- codeActions: []string{
+- "Reset govulncheck result", // no fix, but we should give an option to reset.
+- },
+- hover: []string{"GO-2022-02", "This is a long description of this vulnerability.", "No fix is available."},
+- },
+- }
+-
+- for mod, want := range wantDiagnostics {
+- modPathDiagnostics := testVulnDiagnostics(t, env, mod, want, gotDiagnostics)
+-
+- // Check that the actions we get when including all diagnostics at a location return the same result
+- gotActions := env.CodeAction("go.mod", modPathDiagnostics)
+- if diff := diffCodeActions(gotActions, want.codeActions); diff != "" {
+- t.Errorf("code actions for %q do not match, expected %v, got %v\n%v\n", mod, want.codeActions, gotActions, diff)
+- continue
+- }
+-
+- // Apply the code action matching applyAction.
+- if want.applyAction == "" {
+- continue
+- }
+- for _, action := range gotActions {
+- if action.Title == want.applyAction {
+- env.ApplyCodeAction(action)
+- break
+- }
+- }
+- }
+-
+- env.Await(env.DoneWithChangeWatchedFiles())
+- wantGoMod := `module golang.org/entry
+-
+-go 1.18
+-
+-require golang.org/cmod v1.1.3
+-
+-require (
+- golang.org/amod v1.0.6 // indirect
+- golang.org/bmod v0.5.0 // indirect
+-)
+-`
+- if got := env.BufferText("go.mod"); got != wantGoMod {
+- t.Fatalf("go.mod vulncheck fix failed:\n%s", compare.Text(wantGoMod, got))
+- }
+- })
+-}
+-
+-func diffCodeActions(gotActions []protocol.CodeAction, want []string) string {
+- var gotTitles []string
+- for _, ca := range gotActions {
+- gotTitles = append(gotTitles, ca.Title)
+- }
+- return cmp.Diff(want, gotTitles)
+-}
+-
+-const workspace2 = `
+--- go.mod --
+-module golang.org/entry
+-
+-go 1.18
+-
+-require golang.org/bmod v0.5.0
+-
+--- go.sum --
+-golang.org/bmod v0.5.0 h1:MT/ysNRGbCiURc5qThRFWaZ5+rK3pQRPo9w7dYZfMDk=
+-golang.org/bmod v0.5.0/go.mod h1:k+zl+Ucu4yLIjndMIuWzD/MnOHy06wqr3rD++y0abVs=
+--- x/x.go --
+-package x
+-
+-import "golang.org/bmod/bvuln"
+-
+-func F() {
+- // Calls a benign func in bvuln.
+- bvuln.OK()
+-}
+-`
+-
+-const proxy2 = `
+--- golang.org/bmod@v0.5.0/bvuln/bvuln.go --
+-package bvuln
+-
+-func Vuln() {} // vulnerable.
+-func OK() {} // ok.
+-`
+-
+-func TestGovulncheckInfo(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+-
+- db, opts, err := vulnTestEnv(vulnsData, proxy2)
+- if err != nil {
+- t.Fatal(err)
+- }
+- defer db.Clean()
+- WithOptions(opts...).Run(t, workspace2, func(t *testing.T, env *Env) {
+- env.OpenFile("go.mod")
+- var result command.RunVulncheckResult
+- env.ExecuteCodeLensCommand("go.mod", command.RunGovulncheck, &result)
+- gotDiagnostics := &protocol.PublishDiagnosticsParams{}
+- env.OnceMet(
+- CompletedProgress(result.Token, nil),
+- ShownMessage("No vulnerabilities found"), // only count affecting vulnerabilities.
+- )
+-
+- // Vulncheck diagnostics asynchronous to the vulncheck command.
+- env.OnceMet(
+- Diagnostics(env.AtRegexp("go.mod", "golang.org/bmod")),
+- ReadDiagnostics("go.mod", gotDiagnostics),
+- )
+-
+- testFetchVulncheckResult(t, env, map[string]fetchVulncheckResult{"go.mod": {IDs: []string{"GO-2022-02"}, Mode: govulncheck.ModeGovulncheck}})
+- // wantDiagnostics maps a module path in the require
+- // section of a go.mod to diagnostics that will be returned
+- // when running vulncheck.
+- wantDiagnostics := map[string]vulnDiagExpectation{
+- "golang.org/bmod": {
+- diagnostics: []vulnDiag{
+- {
+- msg: "golang.org/bmod has a vulnerability GO-2022-02 that is not used in the code.",
+- severity: protocol.SeverityInformation,
+- source: string(source.Govulncheck),
+- codeActions: []string{
+- "Reset govulncheck result",
+- },
+- },
+- },
+- codeActions: []string{
+- "Reset govulncheck result",
+- },
+- hover: []string{"GO-2022-02", "This is a long description of this vulnerability.", "No fix is available."},
+- },
+- }
+-
+- var allActions []protocol.CodeAction
+- for mod, want := range wantDiagnostics {
+- modPathDiagnostics := testVulnDiagnostics(t, env, mod, want, gotDiagnostics)
+- // Check that the actions we get when including all diagnostics at a location return the same result
+- gotActions := env.CodeAction("go.mod", modPathDiagnostics)
+- allActions = append(allActions, gotActions...)
+- if diff := diffCodeActions(gotActions, want.codeActions); diff != "" {
+- t.Errorf("code actions for %q do not match, expected %v, got %v\n%v\n", mod, want.codeActions, gotActions, diff)
+- continue
+- }
+- }
+-
+- // Clear Diagnostics by using one of the reset code actions.
+- var reset protocol.CodeAction
+- for _, a := range allActions {
+- if a.Title == "Reset govulncheck result" {
+- reset = a
+- break
+- }
+- }
+- if reset.Title != "Reset govulncheck result" {
+- t.Errorf("failed to find a 'Reset govulncheck result' code action, got %v", allActions)
+- }
+- env.ApplyCodeAction(reset)
+-
+- env.Await(NoDiagnostics(ForFile("go.mod")))
+- })
+-}
+-
+-// testVulnDiagnostics finds the require or module statement line for the requireMod in go.mod file
+-// and runs checks if diagnostics and code actions associated with the line match expectation.
+-func testVulnDiagnostics(t *testing.T, env *Env, pattern string, want vulnDiagExpectation, got *protocol.PublishDiagnosticsParams) []protocol.Diagnostic {
+- t.Helper()
+- loc := env.RegexpSearch("go.mod", pattern)
+- var modPathDiagnostics []protocol.Diagnostic
+- for _, w := range want.diagnostics {
+- // Find the diagnostics at loc.start.
+- var diag *protocol.Diagnostic
+- for _, g := range got.Diagnostics {
+- g := g
+- if g.Range.Start == loc.Range.Start && w.msg == g.Message {
+- modPathDiagnostics = append(modPathDiagnostics, g)
+- diag = &g
+- break
+- }
+- }
+- if diag == nil {
+- t.Errorf("no diagnostic at %q matching %q found\n", pattern, w.msg)
+- continue
+- }
+- if diag.Severity != w.severity || diag.Source != w.source {
+- t.Errorf("incorrect (severity, source) for %q, want (%s, %s) got (%s, %s)\n", w.msg, w.severity, w.source, diag.Severity, diag.Source)
+- }
+- sort.Slice(w.relatedInfo, func(i, j int) bool { return w.relatedInfo[i].less(w.relatedInfo[j]) })
+- if got, want := summarizeRelatedInfo(diag.RelatedInformation), w.relatedInfo; !cmp.Equal(got, want) {
+- t.Errorf("related info for %q do not match, want %v, got %v\n", w.msg, want, got)
+- }
+- // Check expected code actions appear.
+- gotActions := env.CodeAction("go.mod", []protocol.Diagnostic{*diag})
+- if diff := diffCodeActions(gotActions, w.codeActions); diff != "" {
+- t.Errorf("code actions for %q do not match, want %v, got %v\n%v\n", w.msg, w.codeActions, gotActions, diff)
+- continue
+- }
+- }
+- // Check that useful info is supplemented as hover.
+- if len(want.hover) > 0 {
+- hover, _ := env.Hover(loc)
+- for _, part := range want.hover {
+- if !strings.Contains(hover.Value, part) {
+- t.Errorf("hover contents for %q do not match, want %v, got %v\n", pattern, strings.Join(want.hover, ","), hover.Value)
+- break
+- }
+- }
+- }
+- return modPathDiagnostics
+-}
+-
+-// summarizeRelatedInfo converts protocol.DiagnosticRelatedInformation to vulnRelatedInfo
+-// that captures only the part that we want to test.
+-func summarizeRelatedInfo(rinfo []protocol.DiagnosticRelatedInformation) []vulnRelatedInfo {
+- var res []vulnRelatedInfo
+- for _, r := range rinfo {
+- filename := filepath.Base(r.Location.URI.SpanURI().Filename())
+- message, _, _ := strings.Cut(r.Message, " ")
+- line := r.Location.Range.Start.Line
+- res = append(res, vulnRelatedInfo{filename, line, message})
+- }
+- sort.Slice(res, func(i, j int) bool {
+- return res[i].less(res[j])
+- })
+- return res
+-}
+-
+-type vulnRelatedInfo struct {
+- Filename string
+- Line uint32
+- Message string
+-}
+-
+-type vulnDiag struct {
+- msg string
+- severity protocol.DiagnosticSeverity
+- // codeActions is a list titles of code actions that we get with this
+- // diagnostics as the context.
+- codeActions []string
+- // relatedInfo is related info message prefixed by the file base.
+- // See summarizeRelatedInfo.
+- relatedInfo []vulnRelatedInfo
+- // diagnostic source.
+- source string
+-}
+-
+-func (i vulnRelatedInfo) less(j vulnRelatedInfo) bool {
+- if i.Filename != j.Filename {
+- return i.Filename < j.Filename
+- }
+- if i.Line != j.Line {
+- return i.Line < j.Line
+- }
+- return i.Message < j.Message
+-}
+-
+-// vulnDiagExpectation maps a module path in the require
+-// section of a go.mod to diagnostics that will be returned
+-// when running vulncheck.
+-type vulnDiagExpectation struct {
+- // applyAction is the title of the code action to run for this module.
+- // If empty, no code actions will be executed.
+- applyAction string
+- // diagnostics is the list of diagnostics we expect at the require line for
+- // the module path.
+- diagnostics []vulnDiag
+- // codeActions is a list titles of code actions that we get with context
+- // diagnostics.
+- codeActions []string
+- // hover message is the list of expected hover message parts for this go.mod require line.
+- // all parts must appear in the hover message.
+- hover []string
+-}
+diff -urN a/gopls/internal/regtest/misc/workspace_symbol_test.go b/gopls/internal/regtest/misc/workspace_symbol_test.go
+--- a/gopls/internal/regtest/misc/workspace_symbol_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/misc/workspace_symbol_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,124 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package misc
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-func TestWorkspaceSymbolMissingMetadata(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.17
+--- a.go --
+-package p
+-
+-const C1 = "a.go"
+--- exclude.go --
+-
+-//go:build exclude
+-// +build exclude
+-
+-package exclude
+-
+-const C2 = "exclude.go"
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("a.go")
+- syms := env.Symbol("C")
+- if got, want := len(syms), 1; got != want {
+- t.Errorf("got %d symbols, want %d", got, want)
+- }
+-
+- // Opening up an ignored file will result in an overlay with missing
+- // metadata, but this shouldn't break workspace symbols requests.
+- env.OpenFile("exclude.go")
+- syms = env.Symbol("C")
+- if got, want := len(syms), 1; got != want {
+- t.Errorf("got %d symbols, want %d", got, want)
+- }
+- })
+-}
+-
+-func TestWorkspaceSymbolSorting(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.17
+--- a/a.go --
+-package a
+-
+-const (
+- Foo = iota
+- FooBar
+- Fooey
+- Fooex
+- Fooest
+-)
+-`
+-
+- var symbolMatcher = string(source.SymbolFastFuzzy)
+- WithOptions(
+- Settings{"symbolMatcher": symbolMatcher},
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- want := []string{
+- "Foo", // prefer exact segment matches first
+- "FooBar", // ...followed by exact word matches
+- "Fooex", // shorter than Fooest, FooBar, lexically before Fooey
+- "Fooey", // shorter than Fooest, Foobar
+- "Fooest",
+- }
+- got := env.Symbol("Foo")
+- compareSymbols(t, got, want...)
+- })
+-}
+-
+-func TestWorkspaceSymbolSpecialPatterns(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.17
+--- a/a.go --
+-package a
+-
+-const (
+- AxxBxxCxx
+- ABC
+-)
+-`
+-
+- var symbolMatcher = string(source.SymbolFastFuzzy)
+- WithOptions(
+- Settings{"symbolMatcher": symbolMatcher},
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- compareSymbols(t, env.Symbol("ABC"), "ABC", "AxxBxxCxx")
+- compareSymbols(t, env.Symbol("'ABC"), "ABC")
+- compareSymbols(t, env.Symbol("^mod.com"), "mod.com/a.ABC", "mod.com/a.AxxBxxCxx")
+- compareSymbols(t, env.Symbol("^mod.com Axx"), "mod.com/a.AxxBxxCxx")
+- compareSymbols(t, env.Symbol("C$"), "ABC")
+- })
+-}
+-
+-func compareSymbols(t *testing.T, got []protocol.SymbolInformation, want ...string) {
+- t.Helper()
+- if len(got) != len(want) {
+- t.Errorf("got %d symbols, want %d", len(got), len(want))
+- }
+-
+- for i := range got {
+- if got[i].Name != want[i] {
+- t.Errorf("got[%d] = %q, want %q", i, got[i].Name, want[i])
+- }
+- }
+-}
+diff -urN a/gopls/internal/regtest/modfile/modfile_test.go b/gopls/internal/regtest/modfile/modfile_test.go
+--- a/gopls/internal/regtest/modfile/modfile_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/modfile/modfile_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1188 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package modfile
+-
+-import (
+- "path/filepath"
+- "runtime"
+- "strings"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/hooks"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+- "golang.org/x/tools/internal/bug"
+-
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-func TestMain(m *testing.M) {
+- bug.PanicOnBugs = true
+- Main(m, hooks.Options)
+-}
+-
+-const workspaceProxy = `
+--- example.com@v1.2.3/go.mod --
+-module example.com
+-
+-go 1.12
+--- example.com@v1.2.3/blah/blah.go --
+-package blah
+-
+-func SaySomething() {
+- fmt.Println("something")
+-}
+--- random.org@v1.2.3/go.mod --
+-module random.org
+-
+-go 1.12
+--- random.org@v1.2.3/bye/bye.go --
+-package bye
+-
+-func Goodbye() {
+- println("Bye")
+-}
+-`
+-
+-const proxy = `
+--- example.com@v1.2.3/go.mod --
+-module example.com
+-
+-go 1.12
+--- example.com@v1.2.3/blah/blah.go --
+-package blah
+-
+-const Name = "Blah"
+--- random.org@v1.2.3/go.mod --
+-module random.org
+-
+-go 1.12
+--- random.org@v1.2.3/blah/blah.go --
+-package hello
+-
+-const Name = "Hello"
+-`
+-
+-func TestModFileModification(t *testing.T) {
+- const untidyModule = `
+--- a/go.mod --
+-module mod.com
+-
+--- a/main.go --
+-package main
+-
+-import "example.com/blah"
+-
+-func main() {
+- println(blah.Name)
+-}
+-`
+-
+- runner := RunMultiple{
+- {"default", WithOptions(ProxyFiles(proxy), WorkspaceFolders("a"))},
+- {"nested", WithOptions(ProxyFiles(proxy))},
+- }
+-
+- t.Run("basic", func(t *testing.T) {
+- runner.Run(t, untidyModule, func(t *testing.T, env *Env) {
+- // Open the file and make sure that the initial workspace load does not
+- // modify the go.mod file.
+- goModContent := env.ReadWorkspaceFile("a/go.mod")
+- env.OpenFile("a/main.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/main.go", "\"example.com/blah\"")),
+- )
+- if got := env.ReadWorkspaceFile("a/go.mod"); got != goModContent {
+- t.Fatalf("go.mod changed on disk:\n%s", compare.Text(goModContent, got))
+- }
+- // Save the buffer, which will format and organize imports.
+- // Confirm that the go.mod file still does not change.
+- env.SaveBuffer("a/main.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/main.go", "\"example.com/blah\"")),
+- )
+- if got := env.ReadWorkspaceFile("a/go.mod"); got != goModContent {
+- t.Fatalf("go.mod changed on disk:\n%s", compare.Text(goModContent, got))
+- }
+- })
+- })
+-
+- // Reproduce golang/go#40269 by deleting and recreating main.go.
+- t.Run("delete main.go", func(t *testing.T) {
+- runner.Run(t, untidyModule, func(t *testing.T, env *Env) {
+- goModContent := env.ReadWorkspaceFile("a/go.mod")
+- mainContent := env.ReadWorkspaceFile("a/main.go")
+- env.OpenFile("a/main.go")
+- env.SaveBuffer("a/main.go")
+-
+- // Ensure that we're done processing all the changes caused by opening
+- // and saving above. If not, we may run into a file locking issue on
+- // windows.
+- //
+- // If this proves insufficient, env.RemoveWorkspaceFile can be updated to
+- // retry file lock errors on windows.
+- env.AfterChange()
+- env.RemoveWorkspaceFile("a/main.go")
+-
+- // TODO(rfindley): awaiting here shouldn't really be necessary. We should
+- // be consistent eventually.
+- //
+- // Probably this was meant to exercise a race with the change below.
+- env.AfterChange()
+-
+- env.WriteWorkspaceFile("a/main.go", mainContent)
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/main.go", "\"example.com/blah\"")),
+- )
+- if got := env.ReadWorkspaceFile("a/go.mod"); got != goModContent {
+- t.Fatalf("go.mod changed on disk:\n%s", compare.Text(goModContent, got))
+- }
+- })
+- })
+-}
+-
+-func TestGoGetFix(t *testing.T) {
+- const mod = `
+--- a/go.mod --
+-module mod.com
+-
+-go 1.12
+-
+--- a/main.go --
+-package main
+-
+-import "example.com/blah"
+-
+-var _ = blah.Name
+-`
+-
+- const want = `module mod.com
+-
+-go 1.12
+-
+-require example.com v1.2.3
+-`
+-
+- RunMultiple{
+- {"default", WithOptions(ProxyFiles(proxy), WorkspaceFolders("a"))},
+- {"nested", WithOptions(ProxyFiles(proxy))},
+- }.Run(t, mod, func(t *testing.T, env *Env) {
+- if strings.Contains(t.Name(), "workspace_module") {
+- t.Skip("workspace module mode doesn't set -mod=readonly")
+- }
+- env.OpenFile("a/main.go")
+- var d protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/main.go", `"example.com/blah"`)),
+- ReadDiagnostics("a/main.go", &d),
+- )
+- var goGetDiag protocol.Diagnostic
+- for _, diag := range d.Diagnostics {
+- if strings.Contains(diag.Message, "could not import") {
+- goGetDiag = diag
+- }
+- }
+- env.ApplyQuickFixes("a/main.go", []protocol.Diagnostic{goGetDiag})
+- if got := env.ReadWorkspaceFile("a/go.mod"); got != want {
+- t.Fatalf("unexpected go.mod content:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-// Tests that multiple missing dependencies gives good single fixes.
+-func TestMissingDependencyFixes(t *testing.T) {
+- const mod = `
+--- a/go.mod --
+-module mod.com
+-
+-go 1.12
+-
+--- a/main.go --
+-package main
+-
+-import "example.com/blah"
+-import "random.org/blah"
+-
+-var _, _ = blah.Name, hello.Name
+-`
+-
+- const want = `module mod.com
+-
+-go 1.12
+-
+-require random.org v1.2.3
+-`
+-
+- RunMultiple{
+- {"default", WithOptions(ProxyFiles(proxy), WorkspaceFolders("a"))},
+- {"nested", WithOptions(ProxyFiles(proxy))},
+- }.Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("a/main.go")
+- var d protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/main.go", `"random.org/blah"`)),
+- ReadDiagnostics("a/main.go", &d),
+- )
+- var randomDiag protocol.Diagnostic
+- for _, diag := range d.Diagnostics {
+- if strings.Contains(diag.Message, "random.org") {
+- randomDiag = diag
+- }
+- }
+- env.ApplyQuickFixes("a/main.go", []protocol.Diagnostic{randomDiag})
+- if got := env.ReadWorkspaceFile("a/go.mod"); got != want {
+- t.Fatalf("unexpected go.mod content:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-// Tests that multiple missing dependencies gives good single fixes.
+-func TestMissingDependencyFixesWithGoWork(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+- const mod = `
+--- go.work --
+-go 1.18
+-
+-use (
+- ./a
+-)
+--- a/go.mod --
+-module mod.com
+-
+-go 1.12
+-
+--- a/main.go --
+-package main
+-
+-import "example.com/blah"
+-import "random.org/blah"
+-
+-var _, _ = blah.Name, hello.Name
+-`
+-
+- const want = `module mod.com
+-
+-go 1.12
+-
+-require random.org v1.2.3
+-`
+-
+- RunMultiple{
+- {"default", WithOptions(ProxyFiles(proxy), WorkspaceFolders("a"))},
+- {"nested", WithOptions(ProxyFiles(proxy))},
+- }.Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("a/main.go")
+- var d protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/main.go", `"random.org/blah"`)),
+- ReadDiagnostics("a/main.go", &d),
+- )
+- var randomDiag protocol.Diagnostic
+- for _, diag := range d.Diagnostics {
+- if strings.Contains(diag.Message, "random.org") {
+- randomDiag = diag
+- }
+- }
+- env.ApplyQuickFixes("a/main.go", []protocol.Diagnostic{randomDiag})
+- if got := env.ReadWorkspaceFile("a/go.mod"); got != want {
+- t.Fatalf("unexpected go.mod content:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-func TestIndirectDependencyFix(t *testing.T) {
+- const mod = `
+--- a/go.mod --
+-module mod.com
+-
+-go 1.12
+-
+-require example.com v1.2.3 // indirect
+--- a/go.sum --
+-example.com v1.2.3 h1:ihBTGWGjTU3V4ZJ9OmHITkU9WQ4lGdQkMjgyLFk0FaY=
+-example.com v1.2.3/go.mod h1:Y2Rc5rVWjWur0h3pd9aEvK5Pof8YKDANh9gHA2Maujo=
+--- a/main.go --
+-package main
+-
+-import "example.com/blah"
+-
+-func main() {
+- fmt.Println(blah.Name)
+-`
+- const want = `module mod.com
+-
+-go 1.12
+-
+-require example.com v1.2.3
+-`
+-
+- RunMultiple{
+- {"default", WithOptions(ProxyFiles(proxy), WorkspaceFolders("a"))},
+- {"nested", WithOptions(ProxyFiles(proxy))},
+- }.Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("a/go.mod")
+- var d protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/go.mod", "// indirect")),
+- ReadDiagnostics("a/go.mod", &d),
+- )
+- env.ApplyQuickFixes("a/go.mod", d.Diagnostics)
+- if got := env.BufferText("a/go.mod"); got != want {
+- t.Fatalf("unexpected go.mod content:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-func TestUnusedDiag(t *testing.T) {
+-
+- const proxy = `
+--- example.com@v1.0.0/x.go --
+-package pkg
+-const X = 1
+-`
+- const files = `
+--- a/go.mod --
+-module mod.com
+-go 1.14
+-require example.com v1.0.0
+--- a/go.sum --
+-example.com v1.0.0 h1:38O7j5rEBajXk+Q5wzLbRN7KqMkSgEiN9NqcM1O2bBM=
+-example.com v1.0.0/go.mod h1:vUsPMGpx9ZXXzECCOsOmYCW7npJTwuA16yl89n3Mgls=
+--- a/main.go --
+-package main
+-func main() {}
+-`
+-
+- const want = `module mod.com
+-
+-go 1.14
+-`
+-
+- RunMultiple{
+- {"default", WithOptions(ProxyFiles(proxy), WorkspaceFolders("a"))},
+- {"nested", WithOptions(ProxyFiles(proxy))},
+- }.Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("a/go.mod")
+- var d protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/go.mod", `require example.com`)),
+- ReadDiagnostics("a/go.mod", &d),
+- )
+- env.ApplyQuickFixes("a/go.mod", d.Diagnostics)
+- if got := env.BufferText("a/go.mod"); got != want {
+- t.Fatalf("unexpected go.mod content:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-// Test to reproduce golang/go#39041. It adds a new require to a go.mod file
+-// that already has an unused require.
+-func TestNewDepWithUnusedDep(t *testing.T) {
+-
+- const proxy = `
+--- github.com/esimov/caire@v1.2.5/go.mod --
+-module github.com/esimov/caire
+-
+-go 1.12
+--- github.com/esimov/caire@v1.2.5/caire.go --
+-package caire
+-
+-func RemoveTempImage() {}
+--- google.golang.org/protobuf@v1.20.0/go.mod --
+-module google.golang.org/protobuf
+-
+-go 1.12
+--- google.golang.org/protobuf@v1.20.0/hello/hello.go --
+-package hello
+-`
+- const repro = `
+--- a/go.mod --
+-module mod.com
+-
+-go 1.14
+-
+-require google.golang.org/protobuf v1.20.0
+--- a/go.sum --
+-github.com/esimov/caire v1.2.5 h1:OcqDII/BYxcBYj3DuwDKjd+ANhRxRqLa2n69EGje7qw=
+-github.com/esimov/caire v1.2.5/go.mod h1:mXnjRjg3+WUtuhfSC1rKRmdZU9vJZyS1ZWU0qSvJhK8=
+-google.golang.org/protobuf v1.20.0 h1:y9T1vAtFKQg0faFNMOxJU7WuEqPWolVkjIkU6aI8qCY=
+-google.golang.org/protobuf v1.20.0/go.mod h1:FcqsytGClbtLv1ot8NvsJHjBi0h22StKVP+K/j2liKA=
+--- a/main.go --
+-package main
+-
+-import (
+- "github.com/esimov/caire"
+-)
+-
+-func _() {
+- caire.RemoveTempImage()
+-}`
+-
+- RunMultiple{
+- {"default", WithOptions(ProxyFiles(proxy), WorkspaceFolders("a"))},
+- {"nested", WithOptions(ProxyFiles(proxy))},
+- }.Run(t, repro, func(t *testing.T, env *Env) {
+- env.OpenFile("a/main.go")
+- var d protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/main.go", `"github.com/esimov/caire"`)),
+- ReadDiagnostics("a/main.go", &d),
+- )
+- env.ApplyQuickFixes("a/main.go", d.Diagnostics)
+- want := `module mod.com
+-
+-go 1.14
+-
+-require (
+- github.com/esimov/caire v1.2.5
+- google.golang.org/protobuf v1.20.0
+-)
+-`
+- if got := env.ReadWorkspaceFile("a/go.mod"); got != want {
+- t.Fatalf("TestNewDepWithUnusedDep failed:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-// TODO: For this test to be effective, the sandbox's file watcher must respect
+-// the file watching GlobPattern in the capability registration. See
+-// golang/go#39384.
+-func TestModuleChangesOnDisk(t *testing.T) {
+- const mod = `
+--- a/go.mod --
+-module mod.com
+-
+-go 1.12
+-
+-require example.com v1.2.3
+--- a/go.sum --
+-example.com v1.2.3 h1:ihBTGWGjTU3V4ZJ9OmHITkU9WQ4lGdQkMjgyLFk0FaY=
+-example.com v1.2.3/go.mod h1:Y2Rc5rVWjWur0h3pd9aEvK5Pof8YKDANh9gHA2Maujo=
+--- a/main.go --
+-package main
+-
+-func main() {
+- fmt.Println(blah.Name)
+-`
+- RunMultiple{
+- {"default", WithOptions(ProxyFiles(proxy), WorkspaceFolders("a"))},
+- {"nested", WithOptions(ProxyFiles(proxy))},
+- }.Run(t, mod, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("a/go.mod", "require")),
+- )
+- env.RunGoCommandInDir("a", "mod", "tidy")
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/go.mod")),
+- )
+- })
+-}
+-
+-// Tests golang/go#39784: a missing indirect dependency, necessary
+-// due to blah@v2.0.0's incomplete go.mod file.
+-func TestBadlyVersionedModule(t *testing.T) {
+- const proxy = `
+--- example.com/blah/@v/v1.0.0.mod --
+-module example.com
+-
+-go 1.12
+--- example.com/blah@v1.0.0/blah.go --
+-package blah
+-
+-const Name = "Blah"
+--- example.com/blah/v2/@v/v2.0.0.mod --
+-module example.com
+-
+-go 1.12
+--- example.com/blah/v2@v2.0.0/blah.go --
+-package blah
+-
+-import "example.com/blah"
+-
+-var V1Name = blah.Name
+-const Name = "Blah"
+-`
+- const files = `
+--- a/go.mod --
+-module mod.com
+-
+-go 1.12
+-
+-require example.com/blah/v2 v2.0.0
+--- a/go.sum --
+-example.com/blah v1.0.0 h1:kGPlWJbMsn1P31H9xp/q2mYI32cxLnCvauHN0AVaHnc=
+-example.com/blah v1.0.0/go.mod h1:PZUQaGFeVjyDmAE8ywmLbmDn3fj4Ws8epg4oLuDzW3M=
+-example.com/blah/v2 v2.0.0 h1:DNPsFPkKtTdxclRheaMCiYAoYizp6PuBzO0OmLOO0pY=
+-example.com/blah/v2 v2.0.0/go.mod h1:UZiKbTwobERo/hrqFLvIQlJwQZQGxWMVY4xere8mj7w=
+--- a/main.go --
+-package main
+-
+-import "example.com/blah/v2"
+-
+-var _ = blah.Name
+-`
+- RunMultiple{
+- {"default", WithOptions(ProxyFiles(proxy), WorkspaceFolders("a"))},
+- {"nested", WithOptions(ProxyFiles(proxy))},
+- }.Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("a/main.go")
+- env.OpenFile("a/go.mod")
+- var modDiags protocol.PublishDiagnosticsParams
+- env.AfterChange(
+- // We would like for the error to appear in the v2 module, but
+- // as of writing non-workspace packages are not diagnosed.
+- Diagnostics(env.AtRegexp("a/main.go", `"example.com/blah/v2"`), WithMessage("cannot find module providing")),
+- Diagnostics(env.AtRegexp("a/go.mod", `require example.com/blah/v2`), WithMessage("cannot find module providing")),
+- ReadDiagnostics("a/go.mod", &modDiags),
+- )
+- env.ApplyQuickFixes("a/go.mod", modDiags.Diagnostics)
+- const want = `module mod.com
+-
+-go 1.12
+-
+-require (
+- example.com/blah v1.0.0 // indirect
+- example.com/blah/v2 v2.0.0
+-)
+-`
+- env.SaveBuffer("a/go.mod")
+- env.AfterChange(NoDiagnostics(ForFile("a/main.go")))
+- if got := env.BufferText("a/go.mod"); got != want {
+- t.Fatalf("suggested fixes failed:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-// Reproduces golang/go#38232.
+-func TestUnknownRevision(t *testing.T) {
+- if runtime.GOOS == "plan9" {
+- t.Skipf("skipping test that fails for unknown reasons on plan9; see https://go.dev/issue/50477")
+- }
+- const unknown = `
+--- a/go.mod --
+-module mod.com
+-
+-require (
+- example.com v1.2.2
+-)
+--- a/main.go --
+-package main
+-
+-import "example.com/blah"
+-
+-func main() {
+- var x = blah.Name
+-}
+-`
+-
+- runner := RunMultiple{
+- {"default", WithOptions(ProxyFiles(proxy), WorkspaceFolders("a"))},
+- {"nested", WithOptions(ProxyFiles(proxy))},
+- }
+- // Start from a bad state/bad IWL, and confirm that we recover.
+- t.Run("bad", func(t *testing.T) {
+- runner.Run(t, unknown, func(t *testing.T, env *Env) {
+- env.OpenFile("a/go.mod")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/go.mod", "example.com v1.2.2")),
+- )
+- env.RegexpReplace("a/go.mod", "v1.2.2", "v1.2.3")
+- env.SaveBuffer("a/go.mod") // Save to trigger diagnostics.
+-
+- d := protocol.PublishDiagnosticsParams{}
+- env.AfterChange(
+- // Make sure the diagnostic mentions the new version -- the old diagnostic is in the same place.
+- Diagnostics(env.AtRegexp("a/go.mod", "example.com v1.2.3"), WithMessage("example.com@v1.2.3")),
+- ReadDiagnostics("a/go.mod", &d),
+- )
+- qfs := env.GetQuickFixes("a/go.mod", d.Diagnostics)
+- if len(qfs) == 0 {
+- t.Fatalf("got 0 code actions to fix %v, wanted at least 1", d.Diagnostics)
+- }
+- env.ApplyCodeAction(qfs[0]) // Arbitrarily pick a single fix to apply. Applying all of them seems to cause trouble in this particular test.
+- env.SaveBuffer("a/go.mod") // Save to trigger diagnostics.
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/go.mod")),
+- Diagnostics(env.AtRegexp("a/main.go", "x = ")),
+- )
+- })
+- })
+-
+- const known = `
+--- a/go.mod --
+-module mod.com
+-
+-require (
+- example.com v1.2.3
+-)
+--- a/go.sum --
+-example.com v1.2.3 h1:ihBTGWGjTU3V4ZJ9OmHITkU9WQ4lGdQkMjgyLFk0FaY=
+-example.com v1.2.3/go.mod h1:Y2Rc5rVWjWur0h3pd9aEvK5Pof8YKDANh9gHA2Maujo=
+--- a/main.go --
+-package main
+-
+-import "example.com/blah"
+-
+-func main() {
+- var x = blah.Name
+-}
+-`
+- // Start from a good state, transform to a bad state, and confirm that we
+- // still recover.
+- t.Run("good", func(t *testing.T) {
+- runner.Run(t, known, func(t *testing.T, env *Env) {
+- env.OpenFile("a/go.mod")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/main.go", "x = ")),
+- )
+- env.RegexpReplace("a/go.mod", "v1.2.3", "v1.2.2")
+- env.Editor.SaveBuffer(env.Ctx, "a/go.mod") // go.mod changes must be on disk
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/go.mod", "example.com v1.2.2")),
+- )
+- env.RegexpReplace("a/go.mod", "v1.2.2", "v1.2.3")
+- env.Editor.SaveBuffer(env.Ctx, "a/go.mod") // go.mod changes must be on disk
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/main.go", "x = ")),
+- )
+- })
+- })
+-}
+-
+-// Confirm that an error in an indirect dependency of a requirement is surfaced
+-// as a diagnostic in the go.mod file.
+-func TestErrorInIndirectDependency(t *testing.T) {
+- const badProxy = `
+--- example.com@v1.2.3/go.mod --
+-module example.com
+-
+-go 1.12
+-
+-require random.org v1.2.3 // indirect
+--- example.com@v1.2.3/blah/blah.go --
+-package blah
+-
+-const Name = "Blah"
+--- random.org@v1.2.3/go.mod --
+-module bob.org
+-
+-go 1.12
+--- random.org@v1.2.3/blah/blah.go --
+-package hello
+-
+-const Name = "Hello"
+-`
+- const module = `
+--- a/go.mod --
+-module mod.com
+-
+-go 1.14
+-
+-require example.com v1.2.3
+--- a/main.go --
+-package main
+-
+-import "example.com/blah"
+-
+-func main() {
+- println(blah.Name)
+-}
+-`
+- RunMultiple{
+- {"default", WithOptions(ProxyFiles(badProxy), WorkspaceFolders("a"))},
+- {"nested", WithOptions(ProxyFiles(badProxy))},
+- }.Run(t, module, func(t *testing.T, env *Env) {
+- env.OpenFile("a/go.mod")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/go.mod", "require example.com v1.2.3")),
+- )
+- })
+-}
+-
+-// A copy of govim's config_set_env_goflags_mod_readonly test.
+-func TestGovimModReadonly(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.13
+--- main.go --
+-package main
+-
+-import "example.com/blah"
+-
+-func main() {
+- println(blah.Name)
+-}
+-`
+- WithOptions(
+- EnvVars{"GOFLAGS": "-mod=readonly"},
+- ProxyFiles(proxy),
+- Modes(Default),
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- original := env.ReadWorkspaceFile("go.mod")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("main.go", `"example.com/blah"`)),
+- )
+- got := env.ReadWorkspaceFile("go.mod")
+- if got != original {
+- t.Fatalf("go.mod file modified:\n%s", compare.Text(original, got))
+- }
+- env.RunGoCommand("get", "example.com/blah@v1.2.3")
+- env.RunGoCommand("mod", "tidy")
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- )
+- })
+-}
+-
+-func TestMultiModuleModDiagnostics(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18) // uses go.work
+- const mod = `
+--- go.work --
+-go 1.18
+-
+-use (
+- a
+- b
+-)
+--- a/go.mod --
+-module moda.com
+-
+-go 1.14
+-
+-require (
+- example.com v1.2.3
+-)
+--- a/go.sum --
+-example.com v1.2.3 h1:Yryq11hF02fEf2JlOS2eph+ICE2/ceevGV3C9dl5V/c=
+-example.com v1.2.3/go.mod h1:Y2Rc5rVWjWur0h3pd9aEvK5Pof8YKDANh9gHA2Maujo=
+--- a/main.go --
+-package main
+-
+-func main() {}
+--- b/go.mod --
+-module modb.com
+-
+-require example.com v1.2.3
+-
+-go 1.14
+--- b/main.go --
+-package main
+-
+-import "example.com/blah"
+-
+-func main() {
+- blah.SaySomething()
+-}
+-`
+- WithOptions(
+- ProxyFiles(workspaceProxy),
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.AfterChange(
+- Diagnostics(
+- env.AtRegexp("a/go.mod", "example.com v1.2.3"),
+- WithMessage("is not used"),
+- ),
+- )
+- })
+-}
+-
+-func TestModTidyWithBuildTags(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- main.go --
+-// +build bob
+-
+-package main
+-
+-import "example.com/blah"
+-
+-func main() {
+- blah.SaySomething()
+-}
+-`
+- WithOptions(
+- ProxyFiles(workspaceProxy),
+- Settings{"buildFlags": []string{"-tags", "bob"}},
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("main.go", `"example.com/blah"`)),
+- )
+- })
+-}
+-
+-func TestModTypoDiagnostic(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-func main() {}
+-`
+- Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("go.mod")
+- env.RegexpReplace("go.mod", "module", "modul")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("go.mod", "modul")),
+- )
+- })
+-}
+-
+-func TestSumUpdateFixesDiagnostics(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+-
+-require (
+- example.com v1.2.3
+-)
+--- go.sum --
+--- main.go --
+-package main
+-
+-import (
+- "example.com/blah"
+-)
+-
+-func main() {
+- println(blah.Name)
+-}
+-`
+- WithOptions(
+- ProxyFiles(workspaceProxy),
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- d := &protocol.PublishDiagnosticsParams{}
+- env.OpenFile("go.mod")
+- env.AfterChange(
+- Diagnostics(
+- env.AtRegexp("go.mod", `example.com v1.2.3`),
+- WithMessage("go.sum is out of sync"),
+- ),
+- ReadDiagnostics("go.mod", d),
+- )
+- env.ApplyQuickFixes("go.mod", d.Diagnostics)
+- env.SaveBuffer("go.mod") // Save to trigger diagnostics.
+- env.AfterChange(
+- NoDiagnostics(ForFile("go.mod")),
+- )
+- })
+-}
+-
+-// This test confirms that editing a go.mod file only causes metadata
+-// to be invalidated when it's saved.
+-func TestGoModInvalidatesOnSave(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-func main() {
+- hello()
+-}
+--- hello.go --
+-package main
+-
+-func hello() {}
+-`
+- WithOptions(
+- // TODO(rFindley) this doesn't work in multi-module workspace mode, because
+- // it keeps around the last parsing modfile. Update this test to also
+- // exercise the workspace module.
+- Modes(Default),
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("go.mod")
+- env.Await(env.DoneWithOpen())
+- env.RegexpReplace("go.mod", "module", "modul")
+- // Confirm that we still have metadata with only on-disk edits.
+- env.OpenFile("main.go")
+- loc := env.GoToDefinition(env.RegexpSearch("main.go", "hello"))
+- if filepath.Base(string(loc.URI)) != "hello.go" {
+- t.Fatalf("expected definition in hello.go, got %s", loc.URI)
+- }
+- // Confirm that we no longer have metadata when the file is saved.
+- env.SaveBufferWithoutActions("go.mod")
+- _, err := env.Editor.GoToDefinition(env.Ctx, env.RegexpSearch("main.go", "hello"))
+- if err == nil {
+- t.Fatalf("expected error, got none")
+- }
+- })
+-}
+-
+-func TestRemoveUnusedDependency(t *testing.T) {
+- const proxy = `
+--- hasdep.com@v1.2.3/go.mod --
+-module hasdep.com
+-
+-go 1.12
+-
+-require example.com v1.2.3
+--- hasdep.com@v1.2.3/a/a.go --
+-package a
+--- example.com@v1.2.3/go.mod --
+-module example.com
+-
+-go 1.12
+--- example.com@v1.2.3/blah/blah.go --
+-package blah
+-
+-const Name = "Blah"
+--- random.com@v1.2.3/go.mod --
+-module random.com
+-
+-go 1.12
+--- random.com@v1.2.3/blah/blah.go --
+-package blah
+-
+-const Name = "Blah"
+-`
+- t.Run("almost tidied", func(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+-
+-require hasdep.com v1.2.3
+--- go.sum --
+-example.com v1.2.3 h1:ihBTGWGjTU3V4ZJ9OmHITkU9WQ4lGdQkMjgyLFk0FaY=
+-example.com v1.2.3/go.mod h1:Y2Rc5rVWjWur0h3pd9aEvK5Pof8YKDANh9gHA2Maujo=
+-hasdep.com v1.2.3 h1:00y+N5oD+SpKoqV1zP2VOPawcW65Zb9NebANY3GSzGI=
+-hasdep.com v1.2.3/go.mod h1:ePVZOlez+KZEOejfLPGL2n4i8qiAjrkhQZ4wcImqAes=
+--- main.go --
+-package main
+-
+-func main() {}
+-`
+- WithOptions(
+- ProxyFiles(proxy),
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("go.mod")
+- d := &protocol.PublishDiagnosticsParams{}
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("go.mod", "require hasdep.com v1.2.3")),
+- ReadDiagnostics("go.mod", d),
+- )
+- const want = `module mod.com
+-
+-go 1.12
+-`
+- env.ApplyQuickFixes("go.mod", d.Diagnostics)
+- if got := env.BufferText("go.mod"); got != want {
+- t.Fatalf("unexpected content in go.mod:\n%s", compare.Text(want, got))
+- }
+- })
+- })
+-
+- t.Run("not tidied", func(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+-
+-require hasdep.com v1.2.3
+-require random.com v1.2.3
+--- go.sum --
+-example.com v1.2.3 h1:ihBTGWGjTU3V4ZJ9OmHITkU9WQ4lGdQkMjgyLFk0FaY=
+-example.com v1.2.3/go.mod h1:Y2Rc5rVWjWur0h3pd9aEvK5Pof8YKDANh9gHA2Maujo=
+-hasdep.com v1.2.3 h1:00y+N5oD+SpKoqV1zP2VOPawcW65Zb9NebANY3GSzGI=
+-hasdep.com v1.2.3/go.mod h1:ePVZOlez+KZEOejfLPGL2n4i8qiAjrkhQZ4wcImqAes=
+-random.com v1.2.3 h1:PzYTykzqqH6+qU0dIgh9iPFbfb4Mm8zNBjWWreRKtx0=
+-random.com v1.2.3/go.mod h1:8EGj+8a4Hw1clAp8vbaeHAsKE4sbm536FP7nKyXO+qQ=
+--- main.go --
+-package main
+-
+-func main() {}
+-`
+- WithOptions(
+- ProxyFiles(proxy),
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- d := &protocol.PublishDiagnosticsParams{}
+- env.OpenFile("go.mod")
+- pos := env.RegexpSearch("go.mod", "require hasdep.com v1.2.3").Range.Start
+- env.AfterChange(
+- Diagnostics(AtPosition("go.mod", pos.Line, pos.Character)),
+- ReadDiagnostics("go.mod", d),
+- )
+- const want = `module mod.com
+-
+-go 1.12
+-
+-require random.com v1.2.3
+-`
+- var diagnostics []protocol.Diagnostic
+- for _, d := range d.Diagnostics {
+- if d.Range.Start.Line != uint32(pos.Line) {
+- continue
+- }
+- diagnostics = append(diagnostics, d)
+- }
+- env.ApplyQuickFixes("go.mod", diagnostics)
+- if got := env.BufferText("go.mod"); got != want {
+- t.Fatalf("unexpected content in go.mod:\n%s", compare.Text(want, got))
+- }
+- })
+- })
+-}
+-
+-func TestSumUpdateQuickFix(t *testing.T) {
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+-
+-require (
+- example.com v1.2.3
+-)
+--- go.sum --
+--- main.go --
+-package main
+-
+-import (
+- "example.com/blah"
+-)
+-
+-func main() {
+- blah.Hello()
+-}
+-`
+- WithOptions(
+- ProxyFiles(workspaceProxy),
+- Modes(Default),
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("go.mod")
+- params := &protocol.PublishDiagnosticsParams{}
+- env.AfterChange(
+- Diagnostics(
+- env.AtRegexp("go.mod", `example.com`),
+- WithMessage("go.sum is out of sync"),
+- ),
+- ReadDiagnostics("go.mod", params),
+- )
+- env.ApplyQuickFixes("go.mod", params.Diagnostics)
+- const want = `example.com v1.2.3 h1:Yryq11hF02fEf2JlOS2eph+ICE2/ceevGV3C9dl5V/c=
+-example.com v1.2.3/go.mod h1:Y2Rc5rVWjWur0h3pd9aEvK5Pof8YKDANh9gHA2Maujo=
+-`
+- if got := env.ReadWorkspaceFile("go.sum"); got != want {
+- t.Fatalf("unexpected go.sum contents:\n%s", compare.Text(want, got))
+- }
+- })
+-}
+-
+-func TestDownloadDeps(t *testing.T) {
+- const proxy = `
+--- example.com@v1.2.3/go.mod --
+-module example.com
+-
+-go 1.12
+-
+-require random.org v1.2.3
+--- example.com@v1.2.3/blah/blah.go --
+-package blah
+-
+-import "random.org/bye"
+-
+-func SaySomething() {
+- bye.Goodbye()
+-}
+--- random.org@v1.2.3/go.mod --
+-module random.org
+-
+-go 1.12
+--- random.org@v1.2.3/bye/bye.go --
+-package bye
+-
+-func Goodbye() {
+- println("Bye")
+-}
+-`
+-
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- go.sum --
+--- main.go --
+-package main
+-
+-import (
+- "example.com/blah"
+-)
+-
+-func main() {
+- blah.SaySomething()
+-}
+-`
+- WithOptions(
+- ProxyFiles(proxy),
+- Modes(Default),
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- d := &protocol.PublishDiagnosticsParams{}
+- env.AfterChange(
+- Diagnostics(
+- env.AtRegexp("main.go", `"example.com/blah"`),
+- WithMessage(`could not import example.com/blah (no required module provides package "example.com/blah")`),
+- ),
+- ReadDiagnostics("main.go", d),
+- )
+- env.ApplyQuickFixes("main.go", d.Diagnostics)
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- NoDiagnostics(ForFile("go.mod")),
+- )
+- })
+-}
+-
+-func TestInvalidGoVersion(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go foo
+--- main.go --
+-package main
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("go.mod", `go foo`), WithMessage("invalid go version")),
+- )
+- env.WriteWorkspaceFile("go.mod", "module mod.com \n\ngo 1.12\n")
+- env.AfterChange(NoDiagnostics(ForFile("go.mod")))
+- })
+-}
+-
+-// This is a regression test for a bug in the line-oriented implementation
+-// of the "apply diffs" operation used by the fake editor.
+-func TestIssue57627(t *testing.T) {
+- const files = `
+--- go.work --
+-package main
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("go.work")
+- env.SetBufferContent("go.work", "go 1.18\nuse moda/a")
+- env.SaveBuffer("go.work") // doesn't fail
+- })
+-}
+diff -urN a/gopls/internal/regtest/template/template_test.go b/gopls/internal/regtest/template/template_test.go
+--- a/gopls/internal/regtest/template/template_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/template/template_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,231 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package template
+-
+-import (
+- "strings"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/hooks"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/internal/bug"
+-)
+-
+-func TestMain(m *testing.M) {
+- bug.PanicOnBugs = true
+- Main(m, hooks.Options)
+-}
+-
+-func TestMultilineTokens(t *testing.T) {
+- // 51731: panic: runtime error: slice bounds out of range [38:3]
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.17
+--- hi.tmpl --
+-{{if (foÜx .X.Y)}}😀{{$A :=
+- "hi"
+- }}{{.Z $A}}{{else}}
+-{{$A.X 12}}
+-{{foo (.X.Y) 23 ($A.Z)}}
+-{{end}}
+-`
+- WithOptions(
+- Settings{
+- "templateExtensions": []string{"tmpl"},
+- "semanticTokens": true,
+- },
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- var p protocol.SemanticTokensParams
+- p.TextDocument.URI = env.Sandbox.Workdir.URI("hi.tmpl")
+- toks, err := env.Editor.Server.SemanticTokensFull(env.Ctx, &p)
+- if err != nil {
+- t.Errorf("semantic token failed: %v", err)
+- }
+- if toks == nil || len(toks.Data) == 0 {
+- t.Errorf("got no semantic tokens")
+- }
+- })
+-}
+-
+-func TestTemplatesFromExtensions(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- hello.tmpl --
+-{{range .Planets}}
+-Hello {{}} <-- missing body
+-{{end}}
+-`
+- WithOptions(
+- Settings{
+- "templateExtensions": []string{"tmpl"},
+- "semanticTokens": true,
+- },
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- // TODO: can we move this diagnostic onto {{}}?
+- var diags protocol.PublishDiagnosticsParams
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("hello.tmpl", "()Hello {{}}")),
+- ReadDiagnostics("hello.tmpl", &diags),
+- )
+- d := diags.Diagnostics // issue 50786: check for Source
+- if len(d) != 1 {
+- t.Errorf("expected 1 diagnostic, got %d", len(d))
+- return
+- }
+- if d[0].Source != "template" {
+- t.Errorf("expected Source 'template', got %q", d[0].Source)
+- }
+- // issue 50801 (even broken templates could return some semantic tokens)
+- var p protocol.SemanticTokensParams
+- p.TextDocument.URI = env.Sandbox.Workdir.URI("hello.tmpl")
+- toks, err := env.Editor.Server.SemanticTokensFull(env.Ctx, &p)
+- if err != nil {
+- t.Errorf("semantic token failed: %v", err)
+- }
+- if toks == nil || len(toks.Data) == 0 {
+- t.Errorf("got no semantic tokens")
+- }
+-
+- env.WriteWorkspaceFile("hello.tmpl", "{{range .Planets}}\nHello {{.}}\n{{end}}")
+- env.AfterChange(NoDiagnostics(ForFile("hello.tmpl")))
+- })
+-}
+-
+-func TestTemplatesObserveDirectoryFilters(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- a/a.tmpl --
+-A {{}} <-- missing body
+--- b/b.tmpl --
+-B {{}} <-- missing body
+-`
+-
+- WithOptions(
+- Settings{
+- "directoryFilters": []string{"-b"},
+- "templateExtensions": []string{"tmpl"},
+- },
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("a/a.tmpl", "()A")),
+- NoDiagnostics(ForFile("b/b.tmpl")),
+- )
+- })
+-}
+-
+-func TestTemplatesFromLangID(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.CreateBuffer("hello.tmpl", "")
+- env.AfterChange(
+- NoDiagnostics(ForFile("hello.tmpl")), // Don't get spurious errors for empty templates.
+- )
+- env.SetBufferContent("hello.tmpl", "{{range .Planets}}\nHello {{}}\n{{end}}")
+- env.Await(Diagnostics(env.AtRegexp("hello.tmpl", "()Hello {{}}")))
+- env.RegexpReplace("hello.tmpl", "{{}}", "{{.}}")
+- env.Await(NoDiagnostics(ForFile("hello.tmpl")))
+- })
+-}
+-
+-func TestClosingTemplatesMakesDiagnosticsDisappear(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- hello.tmpl --
+-{{range .Planets}}
+-Hello {{}} <-- missing body
+-{{end}}
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("hello.tmpl")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("hello.tmpl", "()Hello {{}}")),
+- )
+- // Since we don't have templateExtensions configured, closing hello.tmpl
+- // should make its diagnostics disappear.
+- env.CloseBuffer("hello.tmpl")
+- env.AfterChange(
+- NoDiagnostics(ForFile("hello.tmpl")),
+- )
+- })
+-}
+-
+-func TestMultipleSuffixes(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- b.gotmpl --
+-{{define "A"}}goo{{end}}
+--- a.tmpl --
+-{{template "A"}}
+-`
+-
+- WithOptions(
+- Settings{
+- "templateExtensions": []string{"tmpl", "gotmpl"},
+- },
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("a.tmpl")
+- x := env.RegexpSearch("a.tmpl", `A`)
+- loc := env.GoToDefinition(x)
+- refs := env.References(loc)
+- if len(refs) != 2 {
+- t.Fatalf("got %v reference(s), want 2", len(refs))
+- }
+- // make sure we got one from b.gotmpl
+- want := env.Sandbox.Workdir.URI("b.gotmpl")
+- if refs[0].URI != want && refs[1].URI != want {
+- t.Errorf("failed to find reference to %s", shorten(want))
+- for i, r := range refs {
+- t.Logf("%d: URI:%s %v", i, shorten(r.URI), r.Range)
+- }
+- }
+-
+- content, nloc := env.Hover(loc)
+- if loc != nloc {
+- t.Errorf("loc? got %v, wanted %v", nloc, loc)
+- }
+- if content.Value != "template A defined" {
+- t.Errorf("got %s, wanted 'template A defined", content.Value)
+- }
+- })
+-}
+-
+-// shorten long URIs
+-func shorten(fn protocol.DocumentURI) string {
+- if len(fn) <= 20 {
+- return string(fn)
+- }
+- pieces := strings.Split(string(fn), "/")
+- if len(pieces) < 2 {
+- return string(fn)
+- }
+- j := len(pieces)
+- return pieces[j-2] + "/" + pieces[j-1]
+-}
+-
+-// Hover needs tests
+diff -urN a/gopls/internal/regtest/watch/watch_test.go b/gopls/internal/regtest/watch/watch_test.go
+--- a/gopls/internal/regtest/watch/watch_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/watch/watch_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,702 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package regtest
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/hooks"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/internal/bug"
+-
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-func TestMain(m *testing.M) {
+- bug.PanicOnBugs = true
+- Main(m, hooks.Options)
+-}
+-
+-func TestEditFile(t *testing.T) {
+- const pkg = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- a/a.go --
+-package a
+-
+-func _() {
+- var x int
+-}
+-`
+- // Edit the file when it's *not open* in the workspace, and check that
+- // diagnostics are updated.
+- t.Run("unopened", func(t *testing.T) {
+- Run(t, pkg, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("a/a.go", "x")),
+- )
+- env.WriteWorkspaceFile("a/a.go", `package a; func _() {};`)
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")),
+- )
+- })
+- })
+-
+- // Edit the file when it *is open* in the workspace, and check that
+- // diagnostics are *not* updated.
+- t.Run("opened", func(t *testing.T) {
+- Run(t, pkg, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+- // Insert a trivial edit so that we don't automatically update the buffer
+- // (see CL 267577).
+- env.EditBuffer("a/a.go", fake.NewEdit(0, 0, 0, 0, " "))
+- env.AfterChange()
+- env.WriteWorkspaceFile("a/a.go", `package a; func _() {};`)
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/a.go", "x")),
+- )
+- })
+- })
+-}
+-
+-// Edit a dependency on disk and expect a new diagnostic.
+-func TestEditDependency(t *testing.T) {
+- const pkg = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- b/b.go --
+-package b
+-
+-func B() int { return 0 }
+--- a/a.go --
+-package a
+-
+-import (
+- "mod.com/b"
+-)
+-
+-func _() {
+- _ = b.B()
+-}
+-`
+- Run(t, pkg, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+- env.AfterChange()
+- env.WriteWorkspaceFile("b/b.go", `package b; func B() {};`)
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/a.go", "b.B")),
+- )
+- })
+-}
+-
+-// Edit both the current file and one of its dependencies on disk and
+-// expect diagnostic changes.
+-func TestEditFileAndDependency(t *testing.T) {
+- const pkg = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- b/b.go --
+-package b
+-
+-func B() int { return 0 }
+--- a/a.go --
+-package a
+-
+-import (
+- "mod.com/b"
+-)
+-
+-func _() {
+- var x int
+- _ = b.B()
+-}
+-`
+- Run(t, pkg, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("a/a.go", "x")),
+- )
+- env.WriteWorkspaceFiles(map[string]string{
+- "b/b.go": `package b; func B() {};`,
+- "a/a.go": `package a
+-
+-import "mod.com/b"
+-
+-func _() {
+- b.B()
+-}`,
+- })
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")),
+- NoDiagnostics(ForFile("b/b.go")),
+- )
+- })
+-}
+-
+-// Delete a dependency and expect a new diagnostic.
+-func TestDeleteDependency(t *testing.T) {
+- const pkg = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- b/b.go --
+-package b
+-
+-func B() int { return 0 }
+--- a/a.go --
+-package a
+-
+-import (
+- "mod.com/b"
+-)
+-
+-func _() {
+- _ = b.B()
+-}
+-`
+- Run(t, pkg, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+- env.AfterChange()
+- env.RemoveWorkspaceFile("b/b.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/a.go", "\"mod.com/b\"")),
+- )
+- })
+-}
+-
+-// Create a dependency on disk and expect the diagnostic to go away.
+-func TestCreateDependency(t *testing.T) {
+- const missing = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- b/b.go --
+-package b
+-
+-func B() int { return 0 }
+--- a/a.go --
+-package a
+-
+-import (
+- "mod.com/c"
+-)
+-
+-func _() {
+- c.C()
+-}
+-`
+- Run(t, missing, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("a/a.go", "\"mod.com/c\"")),
+- )
+- env.WriteWorkspaceFile("c/c.go", `package c; func C() {};`)
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")),
+- )
+- })
+-}
+-
+-// Create a new dependency and add it to the file on disk.
+-// This is similar to what might happen if you switch branches.
+-func TestCreateAndAddDependency(t *testing.T) {
+- const original = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- a/a.go --
+-package a
+-
+-func _() {}
+-`
+- Run(t, original, func(t *testing.T, env *Env) {
+- env.WriteWorkspaceFile("c/c.go", `package c; func C() {};`)
+- env.WriteWorkspaceFile("a/a.go", `package a; import "mod.com/c"; func _() { c.C() }`)
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")),
+- )
+- })
+-}
+-
+-// Create a new file that defines a new symbol, in the same package.
+-func TestCreateFile(t *testing.T) {
+- const pkg = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- a/a.go --
+-package a
+-
+-func _() {
+- hello()
+-}
+-`
+- Run(t, pkg, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("a/a.go", "hello")),
+- )
+- env.WriteWorkspaceFile("a/a2.go", `package a; func hello() {};`)
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")),
+- )
+- })
+-}
+-
+-// Add a new method to an interface and implement it.
+-// Inspired by the structure of internal/lsp/source and internal/lsp/cache.
+-func TestCreateImplementation(t *testing.T) {
+- const pkg = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- b/b.go --
+-package b
+-
+-type B interface{
+- Hello() string
+-}
+-
+-func SayHello(bee B) {
+- println(bee.Hello())
+-}
+--- a/a.go --
+-package a
+-
+-import "mod.com/b"
+-
+-type X struct {}
+-
+-func (_ X) Hello() string {
+- return ""
+-}
+-
+-func _() {
+- x := X{}
+- b.SayHello(x)
+-}
+-`
+- const newMethod = `package b
+-type B interface{
+- Hello() string
+- Bye() string
+-}
+-
+-func SayHello(bee B) {
+- println(bee.Hello())
+-}`
+- const implementation = `package a
+-
+-import "mod.com/b"
+-
+-type X struct {}
+-
+-func (_ X) Hello() string {
+- return ""
+-}
+-
+-func (_ X) Bye() string {
+- return ""
+-}
+-
+-func _() {
+- x := X{}
+- b.SayHello(x)
+-}`
+-
+- // Add the new method before the implementation. Expect diagnostics.
+- t.Run("method before implementation", func(t *testing.T) {
+- Run(t, pkg, func(t *testing.T, env *Env) {
+- env.WriteWorkspaceFile("b/b.go", newMethod)
+- env.AfterChange(
+- Diagnostics(AtPosition("a/a.go", 12, 12)),
+- )
+- env.WriteWorkspaceFile("a/a.go", implementation)
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")),
+- )
+- })
+- })
+- // Add the new implementation before the new method. Expect no diagnostics.
+- t.Run("implementation before method", func(t *testing.T) {
+- Run(t, pkg, func(t *testing.T, env *Env) {
+- env.WriteWorkspaceFile("a/a.go", implementation)
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")),
+- )
+- env.WriteWorkspaceFile("b/b.go", newMethod)
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")),
+- )
+- })
+- })
+- // Add both simultaneously. Expect no diagnostics.
+- t.Run("implementation and method simultaneously", func(t *testing.T) {
+- Run(t, pkg, func(t *testing.T, env *Env) {
+- env.WriteWorkspaceFiles(map[string]string{
+- "a/a.go": implementation,
+- "b/b.go": newMethod,
+- })
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")),
+- NoDiagnostics(ForFile("b/b.go")),
+- )
+- })
+- })
+-}
+-
+-// Tests golang/go#38498. Delete a file and then force a reload.
+-// Assert that we no longer try to load the file.
+-func TestDeleteFiles(t *testing.T) {
+- const pkg = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- a/a.go --
+-package a
+-
+-func _() {
+- var _ int
+-}
+--- a/a_unneeded.go --
+-package a
+-`
+- t.Run("close then delete", func(t *testing.T) {
+- WithOptions(
+- Settings{"verboseOutput": true},
+- ).Run(t, pkg, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+- env.OpenFile("a/a_unneeded.go")
+- env.AfterChange(
+- LogMatching(protocol.Info, "a_unneeded.go", 1, false),
+- )
+-
+- // Close and delete the open file, mimicking what an editor would do.
+- env.CloseBuffer("a/a_unneeded.go")
+- env.RemoveWorkspaceFile("a/a_unneeded.go")
+- env.RegexpReplace("a/a.go", "var _ int", "fmt.Println(\"\")")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/a.go", "fmt")),
+- )
+- env.SaveBuffer("a/a.go")
+- env.AfterChange(
+- // There should only be one log message containing
+- // a_unneeded.go, from the initial workspace load, which we
+- // check for earlier. If there are more, there's a bug.
+- LogMatching(protocol.Info, "a_unneeded.go", 1, false),
+- NoDiagnostics(ForFile("a/a.go")),
+- )
+- })
+- })
+-
+- t.Run("delete then close", func(t *testing.T) {
+- WithOptions(
+- Settings{"verboseOutput": true},
+- ).Run(t, pkg, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+- env.OpenFile("a/a_unneeded.go")
+- env.AfterChange(
+- LogMatching(protocol.Info, "a_unneeded.go", 1, false),
+- )
+-
+- // Delete and then close the file.
+- env.RemoveWorkspaceFile("a/a_unneeded.go")
+- env.CloseBuffer("a/a_unneeded.go")
+- env.RegexpReplace("a/a.go", "var _ int", "fmt.Println(\"\")")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/a.go", "fmt")),
+- )
+- env.SaveBuffer("a/a.go")
+- env.AfterChange(
+- // There should only be one log message containing
+- // a_unneeded.go, from the initial workspace load, which we
+- // check for earlier. If there are more, there's a bug.
+- LogMatching(protocol.Info, "a_unneeded.go", 1, false),
+- NoDiagnostics(ForFile("a/a.go")),
+- )
+- })
+- })
+-}
+-
+-// This change reproduces the behavior of switching branches, with multiple
+-// files being created and deleted. The key change here is the movement of a
+-// symbol from one file to another in a given package through a deletion and
+-// creation. To reproduce an issue with metadata invalidation in batched
+-// changes, the last change in the batch is an on-disk file change that doesn't
+-// require metadata invalidation.
+-func TestMoveSymbol(t *testing.T) {
+- const pkg = `
+--- go.mod --
+-module mod.com
+-
+-go 1.14
+--- main.go --
+-package main
+-
+-import "mod.com/a"
+-
+-func main() {
+- var x int
+- x = a.Hello
+- println(x)
+-}
+--- a/a1.go --
+-package a
+-
+-var Hello int
+--- a/a2.go --
+-package a
+-
+-func _() {}
+-`
+- Run(t, pkg, func(t *testing.T, env *Env) {
+- env.WriteWorkspaceFile("a/a3.go", "package a\n\nvar Hello int\n")
+- env.RemoveWorkspaceFile("a/a1.go")
+- env.WriteWorkspaceFile("a/a2.go", "package a; func _() {};")
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- )
+- })
+-}
+-
+-// Reproduce golang/go#40456.
+-func TestChangeVersion(t *testing.T) {
+- const proxy = `
+--- example.com@v1.2.3/go.mod --
+-module example.com
+-
+-go 1.12
+--- example.com@v1.2.3/blah/blah.go --
+-package blah
+-
+-const Name = "Blah"
+-
+-func X(x int) {}
+--- example.com@v1.2.2/go.mod --
+-module example.com
+-
+-go 1.12
+--- example.com@v1.2.2/blah/blah.go --
+-package blah
+-
+-const Name = "Blah"
+-
+-func X() {}
+--- random.org@v1.2.3/go.mod --
+-module random.org
+-
+-go 1.12
+--- random.org@v1.2.3/blah/blah.go --
+-package hello
+-
+-const Name = "Hello"
+-`
+- const mod = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+-
+-require example.com v1.2.2
+--- go.sum --
+-example.com v1.2.3 h1:OnPPkx+rW63kj9pgILsu12MORKhSlnFa3DVRJq1HZ7g=
+-example.com v1.2.3/go.mod h1:Y2Rc5rVWjWur0h3pd9aEvK5Pof8YKDANh9gHA2Maujo=
+--- main.go --
+-package main
+-
+-import "example.com/blah"
+-
+-func main() {
+- blah.X()
+-}
+-`
+- WithOptions(ProxyFiles(proxy)).Run(t, mod, func(t *testing.T, env *Env) {
+- env.WriteWorkspaceFiles(map[string]string{
+- "go.mod": `module mod.com
+-
+-go 1.12
+-
+-require example.com v1.2.3
+-`,
+- "main.go": `package main
+-
+-import (
+- "example.com/blah"
+-)
+-
+-func main() {
+- blah.X(1)
+-}
+-`,
+- })
+- env.AfterChange(
+- env.DoneWithChangeWatchedFiles(),
+- NoDiagnostics(ForFile("main.go")),
+- )
+- })
+-}
+-
+-// Reproduces golang/go#40340.
+-func TestSwitchFromGOPATHToModuleMode(t *testing.T) {
+- const files = `
+--- foo/blah/blah.go --
+-package blah
+-
+-const Name = ""
+--- main.go --
+-package main
+-
+-import "foo/blah"
+-
+-func main() {
+- _ = blah.Name
+-}
+-`
+- WithOptions(
+- InGOPATH(),
+- Modes(Default), // golang/go#57521: this test is temporarily failing in 'experimental' mode
+- EnvVars{"GO111MODULE": "auto"},
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- )
+- if err := env.Sandbox.RunGoCommand(env.Ctx, "", "mod", []string{"init", "mod.com"}, true); err != nil {
+- t.Fatal(err)
+- }
+-
+- // TODO(golang/go#57558, golang/go#57512): file watching is asynchronous,
+- // and we must wait for the view to be reconstructed before touching
+- // main.go, so that the new view "knows" about main.go. This is a bug, but
+- // awaiting the change here avoids it.
+- env.AfterChange()
+-
+- env.RegexpReplace("main.go", `"foo/blah"`, `"mod.com/foo/blah"`)
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- )
+- })
+-}
+-
+-// Reproduces golang/go#40487.
+-func TestSwitchFromModulesToGOPATH(t *testing.T) {
+- const files = `
+--- foo/go.mod --
+-module mod.com
+-
+-go 1.14
+--- foo/blah/blah.go --
+-package blah
+-
+-const Name = ""
+--- foo/main.go --
+-package main
+-
+-import "mod.com/blah"
+-
+-func main() {
+- _ = blah.Name
+-}
+-`
+- WithOptions(
+- InGOPATH(),
+- EnvVars{"GO111MODULE": "auto"},
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("foo/main.go")
+- env.RemoveWorkspaceFile("foo/go.mod")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("foo/main.go", `"mod.com/blah"`)),
+- )
+- env.RegexpReplace("foo/main.go", `"mod.com/blah"`, `"foo/blah"`)
+- env.AfterChange(
+- NoDiagnostics(ForFile("foo/main.go")),
+- )
+- })
+-}
+-
+-func TestNewSymbolInTestVariant(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.com
+-
+-go 1.12
+--- a/a.go --
+-package a
+-
+-func bob() {}
+--- a/a_test.go --
+-package a
+-
+-import "testing"
+-
+-func TestBob(t *testing.T) {
+- bob()
+-}
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- // Add a new symbol to the package under test and use it in the test
+- // variant. Expect no diagnostics.
+- env.WriteWorkspaceFiles(map[string]string{
+- "a/a.go": `package a
+-
+-func bob() {}
+-func george() {}
+-`,
+- "a/a_test.go": `package a
+-
+-import "testing"
+-
+-func TestAll(t *testing.T) {
+- bob()
+- george()
+-}
+-`,
+- })
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")),
+- NoDiagnostics(ForFile("a/a_test.go")),
+- )
+- // Now, add a new file to the test variant and use its symbol in the
+- // original test file. Expect no diagnostics.
+- env.WriteWorkspaceFiles(map[string]string{
+- "a/a_test.go": `package a
+-
+-import "testing"
+-
+-func TestAll(t *testing.T) {
+- bob()
+- george()
+- hi()
+-}
+-`,
+- "a/a2_test.go": `package a
+-
+-import "testing"
+-
+-func hi() {}
+-
+-func TestSomething(t *testing.T) {}
+-`,
+- })
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a_test.go")),
+- NoDiagnostics(ForFile("a/a2_test.go")),
+- )
+- })
+-}
+diff -urN a/gopls/internal/regtest/workspace/broken_test.go b/gopls/internal/regtest/workspace/broken_test.go
+--- a/gopls/internal/regtest/workspace/broken_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/workspace/broken_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,264 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package workspace
+-
+-import (
+- "strings"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/lsp"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-// This file holds various tests for UX with respect to broken workspaces.
+-//
+-// TODO: consolidate other tests here.
+-//
+-// TODO: write more tests:
+-// - an explicit GOWORK value that doesn't exist
+-// - using modules and/or GOWORK inside of GOPATH?
+-
+-// Test for golang/go#53933
+-func TestBrokenWorkspace_DuplicateModules(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+-
+- // TODO(golang/go#57650): fix this feature.
+- t.Skip("we no longer detect duplicate modules")
+-
+- // This proxy module content is replaced by the workspace, but is still
+- // required for module resolution to function in the Go command.
+- const proxy = `
+--- example.com/foo@v0.0.1/go.mod --
+-module example.com/foo
+-
+-go 1.12
+-`
+-
+- const src = `
+--- go.work --
+-go 1.18
+-
+-use (
+- ./package1
+- ./package1/vendor/example.com/foo
+- ./package2
+- ./package2/vendor/example.com/foo
+-)
+-
+--- package1/go.mod --
+-module mod.test
+-
+-go 1.18
+-
+-require example.com/foo v0.0.1
+--- package1/main.go --
+-package main
+-
+-import "example.com/foo"
+-
+-func main() {
+- _ = foo.CompleteMe
+-}
+--- package1/vendor/example.com/foo/go.mod --
+-module example.com/foo
+-
+-go 1.18
+--- package1/vendor/example.com/foo/foo.go --
+-package foo
+-
+-const CompleteMe = 111
+--- package2/go.mod --
+-module mod2.test
+-
+-go 1.18
+-
+-require example.com/foo v0.0.1
+--- package2/main.go --
+-package main
+-
+-import "example.com/foo"
+-
+-func main() {
+- _ = foo.CompleteMe
+-}
+--- package2/vendor/example.com/foo/go.mod --
+-module example.com/foo
+-
+-go 1.18
+--- package2/vendor/example.com/foo/foo.go --
+-package foo
+-
+-const CompleteMe = 222
+-`
+-
+- WithOptions(
+- ProxyFiles(proxy),
+- ).Run(t, src, func(t *testing.T, env *Env) {
+- env.OpenFile("package1/main.go")
+- env.Await(
+- OutstandingWork(lsp.WorkspaceLoadFailure, `found module "example.com/foo" multiple times in the workspace`),
+- )
+-
+- // Remove the redundant vendored copy of example.com.
+- env.WriteWorkspaceFile("go.work", `go 1.18
+- use (
+- ./package1
+- ./package2
+- ./package2/vendor/example.com/foo
+- )
+- `)
+- env.Await(NoOutstandingWork())
+-
+- // Check that definitions in package1 go to the copy vendored in package2.
+- location := env.GoToDefinition(env.RegexpSearch("package1/main.go", "CompleteMe")).URI.SpanURI().Filename()
+- const wantLocation = "package2/vendor/example.com/foo/foo.go"
+- if !strings.HasSuffix(location, wantLocation) {
+- t.Errorf("got definition of CompleteMe at %q, want %q", location, wantLocation)
+- }
+- })
+-}
+-
+-// Test for golang/go#43186: correcting the module path should fix errors
+-// without restarting gopls.
+-func TestBrokenWorkspace_WrongModulePath(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.testx
+-
+-go 1.18
+--- p/internal/foo/foo.go --
+-package foo
+-
+-const C = 1
+--- p/internal/bar/bar.go --
+-package bar
+-
+-import "mod.test/p/internal/foo"
+-
+-const D = foo.C + 1
+--- p/internal/bar/bar_test.go --
+-package bar_test
+-
+-import (
+- "mod.test/p/internal/foo"
+- . "mod.test/p/internal/bar"
+-)
+-
+-const E = D + foo.C
+--- p/internal/baz/baz_test.go --
+-package baz_test
+-
+-import (
+- named "mod.test/p/internal/bar"
+-)
+-
+-const F = named.D - 3
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("p/internal/bar/bar.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("p/internal/bar/bar.go", "\"mod.test/p/internal/foo\"")),
+- )
+- env.OpenFile("go.mod")
+- env.RegexpReplace("go.mod", "mod.testx", "mod.test")
+- env.SaveBuffer("go.mod") // saving triggers a reload
+- env.AfterChange(NoDiagnostics())
+- })
+-}
+-
+-func TestMultipleModules_Warning(t *testing.T) {
+- msgForVersion := func(ver int) string {
+- if ver >= 18 {
+- return `gopls was not able to find modules in your workspace.`
+- } else {
+- return `gopls requires a module at the root of your workspace.`
+- }
+- }
+-
+- const modules = `
+--- a/go.mod --
+-module a.com
+-
+-go 1.12
+--- a/a.go --
+-package a
+--- a/empty.go --
+-// an empty file
+--- b/go.mod --
+-module b.com
+-
+-go 1.12
+--- b/b.go --
+-package b
+-`
+- for _, go111module := range []string{"on", "auto"} {
+- t.Run("GO111MODULE="+go111module, func(t *testing.T) {
+- WithOptions(
+- Modes(Default),
+- EnvVars{"GO111MODULE": go111module},
+- ).Run(t, modules, func(t *testing.T, env *Env) {
+- ver := env.GoVersion()
+- msg := msgForVersion(ver)
+- env.OpenFile("a/a.go")
+- env.OpenFile("a/empty.go")
+- env.OpenFile("b/go.mod")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/a.go", "package a")),
+- Diagnostics(env.AtRegexp("b/go.mod", "module b.com")),
+- OutstandingWork(lsp.WorkspaceLoadFailure, msg),
+- )
+-
+- // Changing the workspace folders to the valid modules should resolve
+- // the workspace errors and diagnostics.
+- //
+- // TODO(rfindley): verbose work tracking doesn't follow changing the
+- // workspace folder, therefore we can't invoke AfterChange here.
+- env.ChangeWorkspaceFolders("a", "b")
+- env.Await(
+- NoDiagnostics(ForFile("a/a.go")),
+- NoDiagnostics(ForFile("b/go.mod")),
+- NoOutstandingWork(),
+- )
+-
+- env.ChangeWorkspaceFolders(".")
+-
+- // TODO(rfindley): when GO111MODULE=auto, we need to open or change a
+- // file here in order to detect a critical error. This is because gopls
+- // has forgotten about a/a.go, and therefore doesn't hit the heuristic
+- // "all packages are command-line-arguments".
+- //
+- // This is broken, and could be fixed by adjusting the heuristic to
+- // account for the scenario where there are *no* workspace packages, or
+- // (better) trying to get workspace packages for each open file. See
+- // also golang/go#54261.
+- env.OpenFile("b/b.go")
+- env.AfterChange(
+- // TODO(rfindley): fix these missing diagnostics.
+- // Diagnostics(env.AtRegexp("a/a.go", "package a")),
+- // Diagnostics(env.AtRegexp("b/go.mod", "module b.com")),
+- Diagnostics(env.AtRegexp("b/b.go", "package b")),
+- OutstandingWork(lsp.WorkspaceLoadFailure, msg),
+- )
+- })
+- })
+- }
+-
+- // Expect no warning if GO111MODULE=auto in a directory in GOPATH.
+- t.Run("GOPATH_GO111MODULE_auto", func(t *testing.T) {
+- WithOptions(
+- Modes(Default),
+- EnvVars{"GO111MODULE": "auto"},
+- InGOPATH(),
+- ).Run(t, modules, func(t *testing.T, env *Env) {
+- env.OpenFile("a/a.go")
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/a.go")),
+- NoOutstandingWork(),
+- )
+- })
+- })
+-}
+diff -urN a/gopls/internal/regtest/workspace/directoryfilters_test.go b/gopls/internal/regtest/workspace/directoryfilters_test.go
+--- a/gopls/internal/regtest/workspace/directoryfilters_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/workspace/directoryfilters_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,259 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package workspace
+-
+-import (
+- "sort"
+- "strings"
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-// This file contains regression tests for the directoryFilters setting.
+-//
+-// TODO:
+-// - consolidate some of these tests into a single test
+-// - add more tests for changing directory filters
+-
+-func TestDirectoryFilters(t *testing.T) {
+- WithOptions(
+- ProxyFiles(workspaceProxy),
+- WorkspaceFolders("pkg"),
+- Settings{
+- "directoryFilters": []string{"-inner"},
+- },
+- ).Run(t, workspaceModule, func(t *testing.T, env *Env) {
+- syms := env.Symbol("Hi")
+- sort.Slice(syms, func(i, j int) bool { return syms[i].ContainerName < syms[j].ContainerName })
+- for _, s := range syms {
+- if strings.Contains(s.ContainerName, "inner") {
+- t.Errorf("WorkspaceSymbol: found symbol %q with container %q, want \"inner\" excluded", s.Name, s.ContainerName)
+- }
+- }
+- })
+-}
+-
+-func TestDirectoryFiltersLoads(t *testing.T) {
+- // exclude, and its error, should be excluded from the workspace.
+- const files = `
+--- go.mod --
+-module example.com
+-
+-go 1.12
+--- exclude/exclude.go --
+-package exclude
+-
+-const _ = Nonexistant
+-`
+-
+- WithOptions(
+- Settings{"directoryFilters": []string{"-exclude"}},
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- NoDiagnostics(ForFile("exclude/x.go")),
+- )
+- })
+-}
+-
+-func TestDirectoryFiltersTransitiveDep(t *testing.T) {
+- // Even though exclude is excluded from the workspace, it should
+- // still be importable as a non-workspace package.
+- const files = `
+--- go.mod --
+-module example.com
+-
+-go 1.12
+--- include/include.go --
+-package include
+-import "example.com/exclude"
+-
+-const _ = exclude.X
+--- exclude/exclude.go --
+-package exclude
+-
+-const _ = Nonexistant // should be ignored, since this is a non-workspace package
+-const X = 1
+-`
+-
+- WithOptions(
+- Settings{"directoryFilters": []string{"-exclude"}},
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- NoDiagnostics(ForFile("exclude/exclude.go")), // filtered out
+- NoDiagnostics(ForFile("include/include.go")), // successfully builds
+- )
+- })
+-}
+-
+-func TestDirectoryFiltersWorkspaceModules(t *testing.T) {
+- // Define a module include.com which should be in the workspace, plus a
+- // module exclude.com which should be excluded and therefore come from
+- // the proxy.
+- const files = `
+--- include/go.mod --
+-module include.com
+-
+-go 1.12
+-
+-require exclude.com v1.0.0
+-
+--- include/go.sum --
+-exclude.com v1.0.0 h1:Q5QSfDXY5qyNCBeUiWovUGqcLCRZKoTs9XdBeVz+w1I=
+-exclude.com v1.0.0/go.mod h1:hFox2uDlNB2s2Jfd9tHlQVfgqUiLVTmh6ZKat4cvnj4=
+-
+--- include/include.go --
+-package include
+-
+-import "exclude.com"
+-
+-var _ = exclude.X // satisfied only by the workspace version
+--- exclude/go.mod --
+-module exclude.com
+-
+-go 1.12
+--- exclude/exclude.go --
+-package exclude
+-
+-const X = 1
+-`
+- const proxy = `
+--- exclude.com@v1.0.0/go.mod --
+-module exclude.com
+-
+-go 1.12
+--- exclude.com@v1.0.0/exclude.go --
+-package exclude
+-`
+- WithOptions(
+- Modes(Experimental),
+- ProxyFiles(proxy),
+- Settings{"directoryFilters": []string{"-exclude"}},
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.Await(Diagnostics(env.AtRegexp("include/include.go", `exclude.(X)`)))
+- })
+-}
+-
+-// Test for golang/go#46438: support for '**' in directory filters.
+-func TestDirectoryFilters_Wildcard(t *testing.T) {
+- filters := []string{"-**/bye"}
+- WithOptions(
+- ProxyFiles(workspaceProxy),
+- WorkspaceFolders("pkg"),
+- Settings{
+- "directoryFilters": filters,
+- },
+- ).Run(t, workspaceModule, func(t *testing.T, env *Env) {
+- syms := env.Symbol("Bye")
+- sort.Slice(syms, func(i, j int) bool { return syms[i].ContainerName < syms[j].ContainerName })
+- for _, s := range syms {
+- if strings.Contains(s.ContainerName, "bye") {
+- t.Errorf("WorkspaceSymbol: found symbol %q with container %q with filters %v", s.Name, s.ContainerName, filters)
+- }
+- }
+- })
+-}
+-
+-// Test for golang/go#52993: wildcard directoryFilters should apply to
+-// goimports scanning as well.
+-func TestDirectoryFilters_ImportScanning(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.test
+-
+-go 1.12
+--- main.go --
+-package main
+-
+-func main() {
+- bye.Goodbye()
+-}
+--- p/bye/bye.go --
+-package bye
+-
+-func Goodbye() {}
+-`
+-
+- WithOptions(
+- Settings{
+- "directoryFilters": []string{"-**/bye"},
+- },
+- // This test breaks in 'Experimental' mode, because with
+- // experimentalWorkspaceModule set we the goimports scan behaves
+- // differently.
+- //
+- // Since this feature is going away (golang/go#52897), don't investigate.
+- Modes(Default),
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- beforeSave := env.BufferText("main.go")
+- env.OrganizeImports("main.go")
+- got := env.BufferText("main.go")
+- if got != beforeSave {
+- t.Errorf("after organizeImports code action, got modified buffer:\n%s", got)
+- }
+- })
+-}
+-
+-// Test for golang/go#52993: non-wildcard directoryFilters should still be
+-// applied relative to the workspace folder, not the module root.
+-func TestDirectoryFilters_MultiRootImportScanning(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18) // uses go.work
+-
+- const files = `
+--- go.work --
+-go 1.18
+-
+-use (
+- a
+- b
+-)
+--- a/go.mod --
+-module mod1.test
+-
+-go 1.18
+--- a/main.go --
+-package main
+-
+-func main() {
+- hi.Hi()
+-}
+--- a/hi/hi.go --
+-package hi
+-
+-func Hi() {}
+--- b/go.mod --
+-module mod2.test
+-
+-go 1.18
+--- b/main.go --
+-package main
+-
+-func main() {
+- hi.Hi()
+-}
+--- b/hi/hi.go --
+-package hi
+-
+-func Hi() {}
+-`
+-
+- WithOptions(
+- Settings{
+- "directoryFilters": []string{"-hi"}, // this test fails with -**/hi
+- },
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("a/main.go")
+- beforeSave := env.BufferText("a/main.go")
+- env.OrganizeImports("a/main.go")
+- got := env.BufferText("a/main.go")
+- if got == beforeSave {
+- t.Errorf("after organizeImports code action, got identical buffer:\n%s", got)
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/workspace/fromenv_test.go b/gopls/internal/regtest/workspace/fromenv_test.go
+--- a/gopls/internal/regtest/workspace/fromenv_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/workspace/fromenv_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,68 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package workspace
+-
+-import (
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-// Test that setting go.work via environment variables or settings works.
+-func TestUseGoWorkOutsideTheWorkspace(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+- const files = `
+--- work/a/go.mod --
+-module a.com
+-
+-go 1.12
+--- work/a/a.go --
+-package a
+--- work/b/go.mod --
+-module b.com
+-
+-go 1.12
+--- work/b/b.go --
+-package b
+-
+-func _() {
+- x := 1 // unused
+-}
+--- other/c/go.mod --
+-module c.com
+-
+-go 1.18
+--- other/c/c.go --
+-package c
+--- config/go.work --
+-go 1.18
+-
+-use (
+- $SANDBOX_WORKDIR/work/a
+- $SANDBOX_WORKDIR/work/b
+- $SANDBOX_WORKDIR/other/c
+-)
+-`
+-
+- WithOptions(
+- WorkspaceFolders("work"), // use a nested workspace dir, so that GOWORK is outside the workspace
+- EnvVars{"GOWORK": "$SANDBOX_WORKDIR/config/go.work"},
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- // When we have an explicit GOWORK set, we should get a file watch request.
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- FileWatchMatching(`other`),
+- FileWatchMatching(`config.go\.work`),
+- )
+- env.Await(FileWatchMatching(`config.go\.work`))
+- // Even though work/b is not open, we should get its diagnostics as it is
+- // included in the workspace.
+- env.OpenFile("work/a/a.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("work/b/b.go", "x := 1"), WithMessage("not used")),
+- )
+- })
+-}
+diff -urN a/gopls/internal/regtest/workspace/metadata_test.go b/gopls/internal/regtest/workspace/metadata_test.go
+--- a/gopls/internal/regtest/workspace/metadata_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/workspace/metadata_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,181 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package workspace
+-
+-import (
+- "strings"
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/internal/testenv"
+-)
+-
+-// TODO(rfindley): move workspace tests related to metadata bugs into this
+-// file.
+-
+-func TestFixImportDecl(t *testing.T) {
+- const src = `
+--- go.mod --
+-module mod.test
+-
+-go 1.12
+--- p.go --
+-package p
+-
+-import (
+- _ "fmt"
+-
+-const C = 42
+-`
+-
+- Run(t, src, func(t *testing.T, env *Env) {
+- env.OpenFile("p.go")
+- env.RegexpReplace("p.go", "\"fmt\"", "\"fmt\"\n)")
+- env.AfterChange(
+- NoDiagnostics(ForFile("p.go")),
+- )
+- })
+-}
+-
+-// Test that moving ignoring a file via build constraints causes diagnostics to
+-// be resolved.
+-func TestIgnoreFile(t *testing.T) {
+- testenv.NeedsGo1Point(t, 17) // needs native overlays and support for go:build directives
+-
+- const src = `
+--- go.mod --
+-module mod.test
+-
+-go 1.12
+--- foo.go --
+-package main
+-
+-func main() {}
+--- bar.go --
+-package main
+-
+-func main() {}
+- `
+-
+- WithOptions(
+- // TODO(golang/go#54180): we don't run in 'experimental' mode here, because
+- // with "experimentalUseInvalidMetadata", this test fails because the
+- // orphaned bar.go is diagnosed using stale metadata, and then not
+- // re-diagnosed when new metadata arrives.
+- //
+- // We could fix this by re-running diagnostics after a load, but should
+- // consider whether that is worthwhile.
+- Modes(Default),
+- ).Run(t, src, func(t *testing.T, env *Env) {
+- env.OpenFile("foo.go")
+- env.OpenFile("bar.go")
+- env.OnceMet(
+- env.DoneWithOpen(),
+- Diagnostics(env.AtRegexp("foo.go", "func (main)")),
+- Diagnostics(env.AtRegexp("bar.go", "func (main)")),
+- )
+-
+- // Ignore bar.go. This should resolve diagnostics.
+- env.RegexpReplace("bar.go", "package main", "//go:build ignore\n\npackage main")
+-
+- // To make this test pass with experimentalUseInvalidMetadata, we could make
+- // an arbitrary edit that invalidates the snapshot, at which point the
+- // orphaned diagnostics will be invalidated.
+- //
+- // But of course, this should not be necessary: we should invalidate stale
+- // information when fresh metadata arrives.
+- // env.RegexpReplace("foo.go", "package main", "package main // test")
+- env.AfterChange(
+- NoDiagnostics(ForFile("foo.go")),
+- NoDiagnostics(ForFile("bar.go")),
+- )
+-
+- // If instead of 'ignore' (which gopls treats as a standalone package) we
+- // used a different build tag, we should get a warning about having no
+- // packages for bar.go
+- env.RegexpReplace("bar.go", "ignore", "excluded")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("bar.go", "package (main)"), WithMessage("No packages")),
+- )
+- })
+-}
+-
+-func TestReinitializeRepeatedly(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18) // uses go.work
+-
+- const multiModule = `
+--- go.work --
+-go 1.18
+-
+-use (
+- moda/a
+- modb
+-)
+--- moda/a/go.mod --
+-module a.com
+-
+-require b.com v1.2.3
+--- moda/a/go.sum --
+-b.com v1.2.3 h1:tXrlXP0rnjRpKNmkbLYoWBdq0ikb3C3bKK9//moAWBI=
+-b.com v1.2.3/go.mod h1:D+J7pfFBZK5vdIdZEFquR586vKKIkqG7Qjw9AxG5BQ8=
+--- moda/a/a.go --
+-package a
+-
+-import (
+- "b.com/b"
+-)
+-
+-func main() {
+- var x int
+- _ = b.Hello()
+- // AAA
+-}
+--- modb/go.mod --
+-module b.com
+-
+--- modb/b/b.go --
+-package b
+-
+-func Hello() int {
+- var x int
+-}
+-`
+- WithOptions(
+- ProxyFiles(workspaceModuleProxy),
+- Settings{
+- // For this test, we want workspace diagnostics to start immediately
+- // during change processing.
+- "diagnosticsDelay": "0",
+- },
+- ).Run(t, multiModule, func(t *testing.T, env *Env) {
+- env.OpenFile("moda/a/a.go")
+- env.AfterChange()
+-
+- // This test verifies that we fully process workspace reinitialization
+- // (which allows GOPROXY), even when the reinitialized snapshot is
+- // invalidated by subsequent changes.
+- //
+- // First, update go.work to remove modb. This will cause reinitialization
+- // to fetch b.com from the proxy.
+- env.WriteWorkspaceFile("go.work", "go 1.18\nuse moda/a")
+- // Next, wait for gopls to start processing the change. Because we've set
+- // diagnosticsDelay to zero, this will start diagnosing the workspace (and
+- // try to reinitialize on the snapshot context).
+- env.Await(env.StartedChangeWatchedFiles())
+- // Finally, immediately make a file change to cancel the previous
+- // operation. This is racy, but will usually cause initialization to be
+- // canceled.
+- env.RegexpReplace("moda/a/a.go", "AAA", "BBB")
+- env.AfterChange()
+- // Now, to satisfy a definition request, gopls will try to reload moda. But
+- // without access to the proxy (because this is no longer a
+- // reinitialization), this loading will fail.
+- loc := env.GoToDefinition(env.RegexpSearch("moda/a/a.go", "Hello"))
+- got := env.Sandbox.Workdir.URIToPath(loc.URI)
+- if want := "b.com@v1.2.3/b/b.go"; !strings.HasSuffix(got, want) {
+- t.Errorf("expected %s, got %v", want, got)
+- }
+- })
+-}
+diff -urN a/gopls/internal/regtest/workspace/misspelling_test.go b/gopls/internal/regtest/workspace/misspelling_test.go
+--- a/gopls/internal/regtest/workspace/misspelling_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/workspace/misspelling_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,80 +0,0 @@
+-// Copyright 2023 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package workspace
+-
+-import (
+- "runtime"
+- "testing"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+- "golang.org/x/tools/gopls/internal/lsp/tests/compare"
+-)
+-
+-// Test for golang/go#57081.
+-func TestFormattingMisspelledURI(t *testing.T) {
+- if runtime.GOOS != "windows" && runtime.GOOS != "darwin" {
+- t.Skip("golang/go#57081 only reproduces on case-insensitive filesystems.")
+- }
+- const files = `
+--- go.mod --
+-module mod.test
+-
+-go 1.19
+--- foo.go --
+-package foo
+-
+-const C = 2 // extra space is intentional
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("Foo.go")
+- env.FormatBuffer("Foo.go")
+- want := env.BufferText("Foo.go")
+-
+- if want == "" {
+- t.Fatalf("Foo.go is empty")
+- }
+-
+- // In golang/go#57081, we observed that if overlay cases don't match, gopls
+- // will find (and format) the on-disk contents rather than the overlay,
+- // resulting in invalid edits.
+- //
+- // Verify that this doesn't happen, by confirming that formatting is
+- // idempotent.
+- env.FormatBuffer("Foo.go")
+- got := env.BufferText("Foo.go")
+- if diff := compare.Text(want, got); diff != "" {
+- t.Errorf("invalid content after second formatting:\n%s", diff)
+- }
+- })
+-}
+-
+-// Test that we can find packages for open files with different spelling on
+-// case-insensitive file systems.
+-func TestPackageForMisspelledURI(t *testing.T) {
+- t.Skip("golang/go#57081: this test fails because the Go command does not load Foo.go correctly")
+- if runtime.GOOS != "windows" && runtime.GOOS != "darwin" {
+- t.Skip("golang/go#57081 only reproduces on case-insensitive filesystems.")
+- }
+- const files = `
+--- go.mod --
+-module mod.test
+-
+-go 1.19
+--- foo.go --
+-package foo
+-
+-const C = D
+--- bar.go --
+-package foo
+-
+-const D = 2
+-`
+-
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("Foo.go")
+- env.AfterChange(NoDiagnostics())
+- })
+-}
+diff -urN a/gopls/internal/regtest/workspace/standalone_test.go b/gopls/internal/regtest/workspace/standalone_test.go
+--- a/gopls/internal/regtest/workspace/standalone_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/workspace/standalone_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,206 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package workspace
+-
+-import (
+- "sort"
+- "testing"
+-
+- "github.com/google/go-cmp/cmp"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-func TestStandaloneFiles(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.test
+-
+-go 1.16
+--- lib/lib.go --
+-package lib
+-
+-const C = 0
+-
+-type I interface {
+- M()
+-}
+--- lib/ignore.go --
+-//go:build ignore
+-// +build ignore
+-
+-package main
+-
+-import (
+- "mod.test/lib"
+-)
+-
+-const C = 1
+-
+-type Mer struct{}
+-func (Mer) M()
+-
+-func main() {
+- println(lib.C + C)
+-}
+-`
+- WithOptions(
+- // On Go 1.17 and earlier, this test fails with
+- // experimentalWorkspaceModule. Not investigated, as
+- // experimentalWorkspaceModule will be removed.
+- Modes(Default),
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- // Initially, gopls should not know about the standalone file as it hasn't
+- // been opened. Therefore, we should only find one symbol 'C'.
+- syms := env.Symbol("C")
+- if got, want := len(syms), 1; got != want {
+- t.Errorf("got %d symbols, want %d", got, want)
+- }
+-
+- // Similarly, we should only find one reference to "C", and no
+- // implementations of I.
+- checkLocations := func(method string, gotLocations []protocol.Location, wantFiles ...string) {
+- var gotFiles []string
+- for _, l := range gotLocations {
+- gotFiles = append(gotFiles, env.Sandbox.Workdir.URIToPath(l.URI))
+- }
+- sort.Strings(gotFiles)
+- sort.Strings(wantFiles)
+- if diff := cmp.Diff(wantFiles, gotFiles); diff != "" {
+- t.Errorf("%s(...): unexpected locations (-want +got):\n%s", method, diff)
+- }
+- }
+-
+- env.OpenFile("lib/lib.go")
+- env.AfterChange(NoDiagnostics())
+-
+- // Replacing C with D should not cause any workspace diagnostics, since we
+- // haven't yet opened the standalone file.
+- env.RegexpReplace("lib/lib.go", "C", "D")
+- env.AfterChange(NoDiagnostics())
+- env.RegexpReplace("lib/lib.go", "D", "C")
+- env.AfterChange(NoDiagnostics())
+-
+- refs := env.References(env.RegexpSearch("lib/lib.go", "C"))
+- checkLocations("References", refs, "lib/lib.go")
+-
+- impls := env.Implementations(env.RegexpSearch("lib/lib.go", "I"))
+- checkLocations("Implementations", impls) // no implementations
+-
+- // Opening the standalone file should not result in any diagnostics.
+- env.OpenFile("lib/ignore.go")
+- env.AfterChange(NoDiagnostics())
+-
+- // Having opened the standalone file, we should find its symbols in the
+- // workspace.
+- syms = env.Symbol("C")
+- if got, want := len(syms), 2; got != want {
+- t.Fatalf("got %d symbols, want %d", got, want)
+- }
+-
+- foundMainC := false
+- var symNames []string
+- for _, sym := range syms {
+- symNames = append(symNames, sym.Name)
+- if sym.Name == "main.C" {
+- foundMainC = true
+- }
+- }
+- if !foundMainC {
+- t.Errorf("WorkspaceSymbol(\"C\") = %v, want containing main.C", symNames)
+- }
+-
+- // We should resolve workspace definitions in the standalone file.
+- fileLoc := env.GoToDefinition(env.RegexpSearch("lib/ignore.go", "lib.(C)"))
+- file := env.Sandbox.Workdir.URIToPath(fileLoc.URI)
+- if got, want := file, "lib/lib.go"; got != want {
+- t.Errorf("GoToDefinition(lib.C) = %v, want %v", got, want)
+- }
+-
+- // ...as well as intra-file definitions
+- loc := env.GoToDefinition(env.RegexpSearch("lib/ignore.go", "\\+ (C)"))
+- wantLoc := env.RegexpSearch("lib/ignore.go", "const (C)")
+- if loc != wantLoc {
+- t.Errorf("GoToDefinition(C) = %v, want %v", loc, wantLoc)
+- }
+-
+- // Renaming "lib.C" to "lib.D" should cause a diagnostic in the standalone
+- // file.
+- env.RegexpReplace("lib/lib.go", "C", "D")
+- env.AfterChange(Diagnostics(env.AtRegexp("lib/ignore.go", "lib.(C)")))
+-
+- // Undoing the replacement should fix diagnostics
+- env.RegexpReplace("lib/lib.go", "D", "C")
+- env.AfterChange(NoDiagnostics())
+-
+- // Now that our workspace has no errors, we should be able to find
+- // references and rename.
+- refs = env.References(env.RegexpSearch("lib/lib.go", "C"))
+- checkLocations("References", refs, "lib/lib.go", "lib/ignore.go")
+-
+- impls = env.Implementations(env.RegexpSearch("lib/lib.go", "I"))
+- checkLocations("Implementations", impls, "lib/ignore.go")
+-
+- // Renaming should rename in the standalone package.
+- env.Rename(env.RegexpSearch("lib/lib.go", "C"), "D")
+- env.RegexpSearch("lib/ignore.go", "lib.D")
+- })
+-}
+-
+-func TestStandaloneFiles_Configuration(t *testing.T) {
+- const files = `
+--- go.mod --
+-module mod.test
+-
+-go 1.18
+--- lib.go --
+-package lib // without this package, files are loaded as command-line-arguments
+--- ignore.go --
+-//go:build ignore
+-// +build ignore
+-
+-package main
+-
+-// An arbitrary comment.
+-
+-func main() {}
+--- standalone.go --
+-//go:build standalone
+-// +build standalone
+-
+-package main
+-
+-func main() {}
+-`
+-
+- WithOptions(
+- Settings{
+- "standaloneTags": []string{"standalone", "script"},
+- },
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("ignore.go")
+- env.OpenFile("standalone.go")
+-
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("ignore.go", "package (main)")),
+- NoDiagnostics(ForFile("standalone.go")),
+- )
+-
+- cfg := env.Editor.Config()
+- cfg.Settings = map[string]interface{}{
+- "standaloneTags": []string{"ignore"},
+- }
+- env.ChangeConfiguration(cfg)
+-
+- // TODO(golang/go#56158): gopls does not purge previously published
+- // diagnostice when configuration changes.
+- env.RegexpReplace("ignore.go", "arbitrary", "meaningless")
+-
+- env.AfterChange(
+- NoDiagnostics(ForFile("ignore.go")),
+- Diagnostics(env.AtRegexp("standalone.go", "package (main)")),
+- )
+- })
+-}
+diff -urN a/gopls/internal/regtest/workspace/workspace_test.go b/gopls/internal/regtest/workspace/workspace_test.go
+--- a/gopls/internal/regtest/workspace/workspace_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/regtest/workspace/workspace_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,1263 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package workspace
+-
+-import (
+- "context"
+- "fmt"
+- "path/filepath"
+- "strings"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/hooks"
+- "golang.org/x/tools/gopls/internal/lsp"
+- "golang.org/x/tools/gopls/internal/lsp/fake"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+- "golang.org/x/tools/internal/bug"
+- "golang.org/x/tools/internal/gocommand"
+- "golang.org/x/tools/internal/testenv"
+-
+- . "golang.org/x/tools/gopls/internal/lsp/regtest"
+-)
+-
+-func TestMain(m *testing.M) {
+- bug.PanicOnBugs = true
+- Main(m, hooks.Options)
+-}
+-
+-const workspaceProxy = `
+--- example.com@v1.2.3/go.mod --
+-module example.com
+-
+-go 1.12
+--- example.com@v1.2.3/blah/blah.go --
+-package blah
+-
+-import "fmt"
+-
+-func SaySomething() {
+- fmt.Println("something")
+-}
+--- random.org@v1.2.3/go.mod --
+-module random.org
+-
+-go 1.12
+--- random.org@v1.2.3/bye/bye.go --
+-package bye
+-
+-func Goodbye() {
+- println("Bye")
+-}
+-`
+-
+-// TODO: Add a replace directive.
+-const workspaceModule = `
+--- pkg/go.mod --
+-module mod.com
+-
+-go 1.14
+-
+-require (
+- example.com v1.2.3
+- random.org v1.2.3
+-)
+--- pkg/go.sum --
+-example.com v1.2.3 h1:veRD4tUnatQRgsULqULZPjeoBGFr2qBhevSCZllD2Ds=
+-example.com v1.2.3/go.mod h1:Y2Rc5rVWjWur0h3pd9aEvK5Pof8YKDANh9gHA2Maujo=
+-random.org v1.2.3 h1:+JE2Fkp7gS0zsHXGEQJ7hraom3pNTlkxC4b2qPfA+/Q=
+-random.org v1.2.3/go.mod h1:E9KM6+bBX2g5ykHZ9H27w16sWo3QwgonyjM44Dnej3I=
+--- pkg/main.go --
+-package main
+-
+-import (
+- "example.com/blah"
+- "mod.com/inner"
+- "random.org/bye"
+-)
+-
+-func main() {
+- blah.SaySomething()
+- inner.Hi()
+- bye.Goodbye()
+-}
+--- pkg/main2.go --
+-package main
+-
+-import "fmt"
+-
+-func _() {
+- fmt.Print("%s")
+-}
+--- pkg/inner/inner.go --
+-package inner
+-
+-import "example.com/blah"
+-
+-func Hi() {
+- blah.SaySomething()
+-}
+--- goodbye/bye/bye.go --
+-package bye
+-
+-func Bye() {}
+--- goodbye/go.mod --
+-module random.org
+-
+-go 1.12
+-`
+-
+-// Confirm that find references returns all of the references in the module,
+-// regardless of what the workspace root is.
+-func TestReferences(t *testing.T) {
+- for _, tt := range []struct {
+- name, rootPath string
+- }{
+- {
+- name: "module root",
+- rootPath: "pkg",
+- },
+- {
+- name: "subdirectory",
+- rootPath: "pkg/inner",
+- },
+- } {
+- t.Run(tt.name, func(t *testing.T) {
+- opts := []RunOption{ProxyFiles(workspaceProxy)}
+- if tt.rootPath != "" {
+- opts = append(opts, WorkspaceFolders(tt.rootPath))
+- }
+- WithOptions(opts...).Run(t, workspaceModule, func(t *testing.T, env *Env) {
+- f := "pkg/inner/inner.go"
+- env.OpenFile(f)
+- locations := env.References(env.RegexpSearch(f, `SaySomething`))
+- want := 3
+- if got := len(locations); got != want {
+- t.Fatalf("expected %v locations, got %v", want, got)
+- }
+- })
+- })
+- }
+-}
+-
+-// Make sure that analysis diagnostics are cleared for the whole package when
+-// the only opened file is closed. This test was inspired by the experience in
+-// VS Code, where clicking on a reference result triggers a
+-// textDocument/didOpen without a corresponding textDocument/didClose.
+-func TestClearAnalysisDiagnostics(t *testing.T) {
+- WithOptions(
+- ProxyFiles(workspaceProxy),
+- WorkspaceFolders("pkg/inner"),
+- ).Run(t, workspaceModule, func(t *testing.T, env *Env) {
+- env.OpenFile("pkg/main.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("pkg/main2.go", "fmt.Print")),
+- )
+- env.CloseBuffer("pkg/main.go")
+- env.AfterChange(
+- NoDiagnostics(ForFile("pkg/main2.go")),
+- )
+- })
+-}
+-
+-// TestReloadOnlyOnce checks that changes to the go.mod file do not result in
+-// redundant package loads (golang/go#54473).
+-//
+-// Note that this test may be fragile, as it depends on specific structure to
+-// log messages around reinitialization. Nevertheless, it is important for
+-// guarding against accidentally duplicate reloading.
+-func TestReloadOnlyOnce(t *testing.T) {
+- WithOptions(
+- ProxyFiles(workspaceProxy),
+- WorkspaceFolders("pkg"),
+- ).Run(t, workspaceModule, func(t *testing.T, env *Env) {
+- dir := env.Sandbox.Workdir.URI("goodbye").SpanURI().Filename()
+- goModWithReplace := fmt.Sprintf(`%s
+-replace random.org => %s
+-`, env.ReadWorkspaceFile("pkg/go.mod"), dir)
+- env.WriteWorkspaceFile("pkg/go.mod", goModWithReplace)
+- env.AfterChange(
+- LogMatching(protocol.Info, `packages\.Load #\d+\n`, 2, false),
+- )
+- })
+-}
+-
+-// This test checks that gopls updates the set of files it watches when a
+-// replace target is added to the go.mod.
+-func TestWatchReplaceTargets(t *testing.T) {
+- t.Skipf("skipping known-flaky test: see https://go.dev/issue/50748")
+-
+- WithOptions(
+- ProxyFiles(workspaceProxy),
+- WorkspaceFolders("pkg"),
+- ).Run(t, workspaceModule, func(t *testing.T, env *Env) {
+- // Add a replace directive and expect the files that gopls is watching
+- // to change.
+- dir := env.Sandbox.Workdir.URI("goodbye").SpanURI().Filename()
+- goModWithReplace := fmt.Sprintf(`%s
+-replace random.org => %s
+-`, env.ReadWorkspaceFile("pkg/go.mod"), dir)
+- env.WriteWorkspaceFile("pkg/go.mod", goModWithReplace)
+- env.AfterChange(
+- UnregistrationMatching("didChangeWatchedFiles"),
+- RegistrationMatching("didChangeWatchedFiles"),
+- )
+- })
+-}
+-
+-const workspaceModuleProxy = `
+--- example.com@v1.2.3/go.mod --
+-module example.com
+-
+-go 1.12
+--- example.com@v1.2.3/blah/blah.go --
+-package blah
+-
+-import "fmt"
+-
+-func SaySomething() {
+- fmt.Println("something")
+-}
+--- b.com@v1.2.3/go.mod --
+-module b.com
+-
+-go 1.12
+--- b.com@v1.2.3/b/b.go --
+-package b
+-
+-func Hello() {}
+-`
+-
+-func TestAutomaticWorkspaceModule_Interdependent(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18) // uses go.work
+- const multiModule = `
+--- moda/a/go.mod --
+-module a.com
+-
+-require b.com v1.2.3
+--- moda/a/go.sum --
+-b.com v1.2.3 h1:tXrlXP0rnjRpKNmkbLYoWBdq0ikb3C3bKK9//moAWBI=
+-b.com v1.2.3/go.mod h1:D+J7pfFBZK5vdIdZEFquR586vKKIkqG7Qjw9AxG5BQ8=
+--- moda/a/a.go --
+-package a
+-
+-import (
+- "b.com/b"
+-)
+-
+-func main() {
+- var x int
+- _ = b.Hello()
+-}
+--- modb/go.mod --
+-module b.com
+-
+--- modb/b/b.go --
+-package b
+-
+-func Hello() int {
+- var x int
+-}
+-`
+- WithOptions(
+- ProxyFiles(workspaceModuleProxy),
+- ).Run(t, multiModule, func(t *testing.T, env *Env) {
+- env.RunGoCommand("work", "init")
+- env.RunGoCommand("work", "use", "-r", ".")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("moda/a/a.go", "x")),
+- Diagnostics(env.AtRegexp("modb/b/b.go", "x")),
+- NoDiagnostics(env.AtRegexp("moda/a/a.go", `"b.com/b"`)),
+- )
+- })
+-}
+-
+-func TestModuleWithExclude(t *testing.T) {
+- const proxy = `
+--- c.com@v1.2.3/go.mod --
+-module c.com
+-
+-go 1.12
+-
+-require b.com v1.2.3
+--- c.com@v1.2.3/blah/blah.go --
+-package blah
+-
+-import "fmt"
+-
+-func SaySomething() {
+- fmt.Println("something")
+-}
+--- b.com@v1.2.3/go.mod --
+-module b.com
+-
+-go 1.12
+--- b.com@v1.2.4/b/b.go --
+-package b
+-
+-func Hello() {}
+--- b.com@v1.2.4/go.mod --
+-module b.com
+-
+-go 1.12
+-`
+- const multiModule = `
+--- go.mod --
+-module a.com
+-
+-require c.com v1.2.3
+-
+-exclude b.com v1.2.3
+--- go.sum --
+-c.com v1.2.3 h1:n07Dz9fYmpNqvZMwZi5NEqFcSHbvLa9lacMX+/g25tw=
+-c.com v1.2.3/go.mod h1:/4TyYgU9Nu5tA4NymP5xyqE8R2VMzGD3TbJCwCOvHAg=
+--- main.go --
+-package a
+-
+-func main() {
+- var x int
+-}
+-`
+- WithOptions(
+- ProxyFiles(proxy),
+- ).Run(t, multiModule, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- Diagnostics(env.AtRegexp("main.go", "x")),
+- )
+- })
+-}
+-
+-// This change tests that the version of the module used changes after it has
+-// been deleted from the workspace.
+-//
+-// TODO(golang/go#55331): delete this placeholder along with experimental
+-// workspace module.
+-func TestDeleteModule_Interdependent(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18) // uses go.work
+- const multiModule = `
+--- go.work --
+-go 1.18
+-
+-use (
+- moda/a
+- modb
+-)
+--- moda/a/go.mod --
+-module a.com
+-
+-require b.com v1.2.3
+--- moda/a/go.sum --
+-b.com v1.2.3 h1:tXrlXP0rnjRpKNmkbLYoWBdq0ikb3C3bKK9//moAWBI=
+-b.com v1.2.3/go.mod h1:D+J7pfFBZK5vdIdZEFquR586vKKIkqG7Qjw9AxG5BQ8=
+--- moda/a/a.go --
+-package a
+-
+-import (
+- "b.com/b"
+-)
+-
+-func main() {
+- var x int
+- _ = b.Hello()
+-}
+--- modb/go.mod --
+-module b.com
+-
+--- modb/b/b.go --
+-package b
+-
+-func Hello() int {
+- var x int
+-}
+-`
+- WithOptions(
+- ProxyFiles(workspaceModuleProxy),
+- ).Run(t, multiModule, func(t *testing.T, env *Env) {
+- env.OpenFile("moda/a/a.go")
+- env.Await(env.DoneWithOpen())
+-
+- originalLoc := env.GoToDefinition(env.RegexpSearch("moda/a/a.go", "Hello"))
+- original := env.Sandbox.Workdir.URIToPath(originalLoc.URI)
+- if want := "modb/b/b.go"; !strings.HasSuffix(original, want) {
+- t.Errorf("expected %s, got %v", want, original)
+- }
+- env.CloseBuffer(original)
+- env.AfterChange()
+-
+- env.RemoveWorkspaceFile("modb/b/b.go")
+- env.RemoveWorkspaceFile("modb/go.mod")
+- env.WriteWorkspaceFile("go.work", "go 1.18\nuse moda/a")
+- env.AfterChange()
+-
+- gotLoc := env.GoToDefinition(env.RegexpSearch("moda/a/a.go", "Hello"))
+- got := env.Sandbox.Workdir.URIToPath(gotLoc.URI)
+- if want := "b.com@v1.2.3/b/b.go"; !strings.HasSuffix(got, want) {
+- t.Errorf("expected %s, got %v", want, got)
+- }
+- })
+-}
+-
+-// Tests that the version of the module used changes after it has been added
+-// to the workspace.
+-func TestCreateModule_Interdependent(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18) // uses go.work
+- const multiModule = `
+--- go.work --
+-go 1.18
+-
+-use (
+- moda/a
+-)
+--- moda/a/go.mod --
+-module a.com
+-
+-require b.com v1.2.3
+--- moda/a/go.sum --
+-b.com v1.2.3 h1:tXrlXP0rnjRpKNmkbLYoWBdq0ikb3C3bKK9//moAWBI=
+-b.com v1.2.3/go.mod h1:D+J7pfFBZK5vdIdZEFquR586vKKIkqG7Qjw9AxG5BQ8=
+--- moda/a/a.go --
+-package a
+-
+-import (
+- "b.com/b"
+-)
+-
+-func main() {
+- var x int
+- _ = b.Hello()
+-}
+-`
+- WithOptions(
+- ProxyFiles(workspaceModuleProxy),
+- ).Run(t, multiModule, func(t *testing.T, env *Env) {
+- env.OpenFile("moda/a/a.go")
+- loc := env.GoToDefinition(env.RegexpSearch("moda/a/a.go", "Hello"))
+- original := env.Sandbox.Workdir.URIToPath(loc.URI)
+- if want := "b.com@v1.2.3/b/b.go"; !strings.HasSuffix(original, want) {
+- t.Errorf("expected %s, got %v", want, original)
+- }
+- env.CloseBuffer(original)
+- env.WriteWorkspaceFiles(map[string]string{
+- "go.work": `go 1.18
+-
+-use (
+- moda/a
+- modb
+-)
+-`,
+- "modb/go.mod": "module b.com",
+- "modb/b/b.go": `package b
+-
+-func Hello() int {
+- var x int
+-}
+-`,
+- })
+- env.AfterChange(Diagnostics(env.AtRegexp("modb/b/b.go", "x")))
+- gotLoc := env.GoToDefinition(env.RegexpSearch("moda/a/a.go", "Hello"))
+- got := env.Sandbox.Workdir.URIToPath(gotLoc.URI)
+- if want := "modb/b/b.go"; !strings.HasSuffix(got, want) {
+- t.Errorf("expected %s, got %v", want, original)
+- }
+- })
+-}
+-
+-// This test confirms that a gopls workspace can recover from initialization
+-// with one invalid module.
+-func TestOneBrokenModule(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18) // uses go.work
+- const multiModule = `
+--- go.work --
+-go 1.18
+-
+-use (
+- moda/a
+- modb
+-)
+--- moda/a/go.mod --
+-module a.com
+-
+-require b.com v1.2.3
+-
+--- moda/a/a.go --
+-package a
+-
+-import (
+- "b.com/b"
+-)
+-
+-func main() {
+- var x int
+- _ = b.Hello()
+-}
+--- modb/go.mod --
+-modul b.com // typo here
+-
+--- modb/b/b.go --
+-package b
+-
+-func Hello() int {
+- var x int
+-}
+-`
+- WithOptions(
+- ProxyFiles(workspaceModuleProxy),
+- ).Run(t, multiModule, func(t *testing.T, env *Env) {
+- env.OpenFile("modb/go.mod")
+- env.AfterChange(
+- Diagnostics(AtPosition("modb/go.mod", 0, 0)),
+- )
+- env.RegexpReplace("modb/go.mod", "modul", "module")
+- env.SaveBufferWithoutActions("modb/go.mod")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("modb/b/b.go", "x")),
+- )
+- })
+-}
+-
+-// TestBadGoWork exercises the panic from golang/vscode-go#2121.
+-func TestBadGoWork(t *testing.T) {
+- const files = `
+--- go.work --
+-use ./bar
+--- bar/go.mod --
+-module example.com/bar
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("go.work")
+- })
+-}
+-
+-func TestUseGoWork(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18) // uses go.work
+- // This test validates certain functionality related to using a go.work
+- // file to specify workspace modules.
+- const multiModule = `
+--- moda/a/go.mod --
+-module a.com
+-
+-require b.com v1.2.3
+--- moda/a/go.sum --
+-b.com v1.2.3 h1:tXrlXP0rnjRpKNmkbLYoWBdq0ikb3C3bKK9//moAWBI=
+-b.com v1.2.3/go.mod h1:D+J7pfFBZK5vdIdZEFquR586vKKIkqG7Qjw9AxG5BQ8=
+--- moda/a/a.go --
+-package a
+-
+-import (
+- "b.com/b"
+-)
+-
+-func main() {
+- var x int
+- _ = b.Hello()
+-}
+--- modb/go.mod --
+-module b.com
+-
+-require example.com v1.2.3
+--- modb/go.sum --
+-example.com v1.2.3 h1:Yryq11hF02fEf2JlOS2eph+ICE2/ceevGV3C9dl5V/c=
+-example.com v1.2.3/go.mod h1:Y2Rc5rVWjWur0h3pd9aEvK5Pof8YKDANh9gHA2Maujo=
+--- modb/b/b.go --
+-package b
+-
+-func Hello() int {
+- var x int
+-}
+--- go.work --
+-go 1.17
+-
+-use (
+- ./moda/a
+-)
+-`
+- WithOptions(
+- ProxyFiles(workspaceModuleProxy),
+- ).Run(t, multiModule, func(t *testing.T, env *Env) {
+- // Initially, the go.work should cause only the a.com module to be
+- // loaded. Validate this by jumping to a definition in b.com and ensuring
+- // that we go to the module cache.
+- env.OpenFile("moda/a/a.go")
+- env.Await(env.DoneWithOpen())
+-
+- // To verify which modules are loaded, we'll jump to the definition of
+- // b.Hello.
+- checkHelloLocation := func(want string) error {
+- loc := env.GoToDefinition(env.RegexpSearch("moda/a/a.go", "Hello"))
+- file := env.Sandbox.Workdir.URIToPath(loc.URI)
+- if !strings.HasSuffix(file, want) {
+- return fmt.Errorf("expected %s, got %v", want, file)
+- }
+- return nil
+- }
+-
+- // Initially this should be in the module cache, as b.com is not replaced.
+- if err := checkHelloLocation("b.com@v1.2.3/b/b.go"); err != nil {
+- t.Fatal(err)
+- }
+-
+- // Now, modify the go.work file on disk to activate the b.com module in
+- // the workspace.
+- env.WriteWorkspaceFile("go.work", `
+-go 1.17
+-
+-use (
+- ./moda/a
+- ./modb
+-)
+-`)
+-
+- // As of golang/go#54069, writing go.work to the workspace triggers a
+- // workspace reload.
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("modb/b/b.go", "x")),
+- )
+-
+- // Jumping to definition should now go to b.com in the workspace.
+- if err := checkHelloLocation("modb/b/b.go"); err != nil {
+- t.Fatal(err)
+- }
+-
+- // Now, let's modify the go.work *overlay* (not on disk), and verify that
+- // this change is only picked up once it is saved.
+- env.OpenFile("go.work")
+- env.AfterChange()
+- env.SetBufferContent("go.work", `go 1.17
+-
+-use (
+- ./moda/a
+-)`)
+-
+- // Simply modifying the go.work file does not cause a reload, so we should
+- // still jump within the workspace.
+- //
+- // TODO: should editing the go.work above cause modb diagnostics to be
+- // suppressed?
+- env.Await(env.DoneWithChange())
+- if err := checkHelloLocation("modb/b/b.go"); err != nil {
+- t.Fatal(err)
+- }
+-
+- // Saving should reload the workspace.
+- env.SaveBufferWithoutActions("go.work")
+- if err := checkHelloLocation("b.com@v1.2.3/b/b.go"); err != nil {
+- t.Fatal(err)
+- }
+-
+- // This fails if guarded with a OnceMet(DoneWithSave(), ...), because it is
+- // debounced (and therefore not synchronous with the change).
+- env.Await(NoDiagnostics(ForFile("modb/go.mod")))
+-
+- // Test Formatting.
+- env.SetBufferContent("go.work", `go 1.18
+- use (
+-
+-
+-
+- ./moda/a
+-)
+-`) // TODO(matloob): For some reason there's a "start position 7:0 is out of bounds" error when the ")" is on the last character/line in the file. Rob probably knows what's going on.
+- env.SaveBuffer("go.work")
+- env.Await(env.DoneWithSave())
+- gotWorkContents := env.ReadWorkspaceFile("go.work")
+- wantWorkContents := `go 1.18
+-
+-use (
+- ./moda/a
+-)
+-`
+- if gotWorkContents != wantWorkContents {
+- t.Fatalf("formatted contents of workspace: got %q; want %q", gotWorkContents, wantWorkContents)
+- }
+- })
+-}
+-
+-func TestUseGoWorkDiagnosticMissingModule(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18) // uses go.work
+-
+- const files = `
+--- go.work --
+-go 1.18
+-
+-use ./foo
+--- bar/go.mod --
+-module example.com/bar
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("go.work")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("go.work", "use"), WithMessage("directory ./foo does not contain a module")),
+- )
+- // The following tests is a regression test against an issue where we weren't
+- // copying the workFile struct field on workspace when a new one was created in
+- // (*workspace).invalidate. Set the buffer content to a working file so that
+- // invalidate recognizes the workspace to be change and copies over the workspace
+- // struct, and then set the content back to the old contents to make sure
+- // the diagnostic still shows up.
+- env.SetBufferContent("go.work", "go 1.18 \n\n use ./bar\n")
+- env.AfterChange(
+- NoDiagnostics(env.AtRegexp("go.work", "use")),
+- )
+- env.SetBufferContent("go.work", "go 1.18 \n\n use ./foo\n")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("go.work", "use"), WithMessage("directory ./foo does not contain a module")),
+- )
+- })
+-}
+-
+-func TestUseGoWorkDiagnosticSyntaxError(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+- const files = `
+--- go.work --
+-go 1.18
+-
+-usa ./foo
+-replace
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("go.work")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("go.work", "usa"), WithMessage("unknown directive: usa")),
+- Diagnostics(env.AtRegexp("go.work", "replace"), WithMessage("usage: replace")),
+- )
+- })
+-}
+-
+-func TestUseGoWorkHover(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+-
+- const files = `
+--- go.work --
+-go 1.18
+-
+-use ./foo
+-use (
+- ./bar
+- ./bar/baz
+-)
+--- foo/go.mod --
+-module example.com/foo
+--- bar/go.mod --
+-module example.com/bar
+--- bar/baz/go.mod --
+-module example.com/bar/baz
+-`
+- Run(t, files, func(t *testing.T, env *Env) {
+- env.OpenFile("go.work")
+-
+- tcs := map[string]string{
+- `\./foo`: "example.com/foo",
+- `(?m)\./bar$`: "example.com/bar",
+- `\./bar/baz`: "example.com/bar/baz",
+- }
+-
+- for hoverRE, want := range tcs {
+- got, _ := env.Hover(env.RegexpSearch("go.work", hoverRE))
+- if got.Value != want {
+- t.Errorf(`hover on %q: got %q, want %q`, hoverRE, got, want)
+- }
+- }
+- })
+-}
+-
+-func TestExpandToGoWork(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+- const workspace = `
+--- moda/a/go.mod --
+-module a.com
+-
+-require b.com v1.2.3
+--- moda/a/a.go --
+-package a
+-
+-import (
+- "b.com/b"
+-)
+-
+-func main() {
+- var x int
+- _ = b.Hello()
+-}
+--- modb/go.mod --
+-module b.com
+-
+-require example.com v1.2.3
+--- modb/b/b.go --
+-package b
+-
+-func Hello() int {
+- var x int
+-}
+--- go.work --
+-go 1.17
+-
+-use (
+- ./moda/a
+- ./modb
+-)
+-`
+- WithOptions(
+- WorkspaceFolders("moda/a"),
+- ).Run(t, workspace, func(t *testing.T, env *Env) {
+- env.OpenFile("moda/a/a.go")
+- env.Await(env.DoneWithOpen())
+- loc := env.GoToDefinition(env.RegexpSearch("moda/a/a.go", "Hello"))
+- file := env.Sandbox.Workdir.URIToPath(loc.URI)
+- want := "modb/b/b.go"
+- if !strings.HasSuffix(file, want) {
+- t.Errorf("expected %s, got %v", want, file)
+- }
+- })
+-}
+-
+-func TestNonWorkspaceFileCreation(t *testing.T) {
+- const files = `
+--- work/go.mod --
+-module mod.com
+-
+-go 1.12
+--- work/x.go --
+-package x
+-`
+-
+- const code = `
+-package foo
+-import "fmt"
+-var _ = fmt.Printf
+-`
+- WithOptions(
+- WorkspaceFolders("work"), // so that outside/... is outside the workspace
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- env.CreateBuffer("outside/foo.go", "")
+- env.EditBuffer("outside/foo.go", fake.NewEdit(0, 0, 0, 0, code))
+- env.GoToDefinition(env.RegexpSearch("outside/foo.go", `Printf`))
+- })
+-}
+-
+-func TestGoWork_V2Module(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18) // uses go.work
+- // When using a go.work, we must have proxy content even if it is replaced.
+- const proxy = `
+--- b.com/v2@v2.1.9/go.mod --
+-module b.com/v2
+-
+-go 1.12
+--- b.com/v2@v2.1.9/b/b.go --
+-package b
+-
+-func Ciao()() int {
+- return 0
+-}
+-`
+-
+- const multiModule = `
+--- go.work --
+-go 1.18
+-
+-use (
+- moda/a
+- modb
+- modb/v2
+- modc
+-)
+--- moda/a/go.mod --
+-module a.com
+-
+-require b.com/v2 v2.1.9
+--- moda/a/a.go --
+-package a
+-
+-import (
+- "b.com/v2/b"
+-)
+-
+-func main() {
+- var x int
+- _ = b.Hi()
+-}
+--- modb/go.mod --
+-module b.com
+-
+--- modb/b/b.go --
+-package b
+-
+-func Hello() int {
+- var x int
+-}
+--- modb/v2/go.mod --
+-module b.com/v2
+-
+--- modb/v2/b/b.go --
+-package b
+-
+-func Hi() int {
+- var x int
+-}
+--- modc/go.mod --
+-module gopkg.in/yaml.v1 // test gopkg.in versions
+--- modc/main.go --
+-package main
+-
+-func main() {
+- var x int
+-}
+-`
+-
+- WithOptions(
+- ProxyFiles(proxy),
+- ).Run(t, multiModule, func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- // TODO(rfindley): assert on the full set of diagnostics here. We
+- // should ensure that we don't have a diagnostic at b.Hi in a.go.
+- Diagnostics(env.AtRegexp("moda/a/a.go", "x")),
+- Diagnostics(env.AtRegexp("modb/b/b.go", "x")),
+- Diagnostics(env.AtRegexp("modb/v2/b/b.go", "x")),
+- Diagnostics(env.AtRegexp("modc/main.go", "x")),
+- )
+- })
+-}
+-
+-// Confirm that a fix for a tidy module will correct all modules in the
+-// workspace.
+-func TestMultiModule_OneBrokenModule(t *testing.T) {
+- // In the earlier 'experimental workspace mode', gopls would aggregate go.sum
+- // entries for the workspace module, allowing it to correctly associate
+- // missing go.sum with diagnostics. With go.work files, this doesn't work:
+- // the go.command will happily write go.work.sum.
+- t.Skip("golang/go#57509: go.mod diagnostics do not work in go.work mode")
+- testenv.NeedsGo1Point(t, 18) // uses go.work
+- const files = `
+--- go.work --
+-go 1.18
+-
+-use (
+- a
+- b
+-)
+--- go.work.sum --
+--- a/go.mod --
+-module a.com
+-
+-go 1.12
+--- a/main.go --
+-package main
+--- b/go.mod --
+-module b.com
+-
+-go 1.12
+-
+-require (
+- example.com v1.2.3
+-)
+--- b/go.sum --
+--- b/main.go --
+-package b
+-
+-import "example.com/blah"
+-
+-func main() {
+- blah.Hello()
+-}
+-`
+- WithOptions(
+- ProxyFiles(workspaceProxy),
+- ).Run(t, files, func(t *testing.T, env *Env) {
+- params := &protocol.PublishDiagnosticsParams{}
+- env.OpenFile("b/go.mod")
+- env.AfterChange(
+- Diagnostics(
+- env.AtRegexp("go.mod", `example.com v1.2.3`),
+- WithMessage("go.sum is out of sync"),
+- ),
+- ReadDiagnostics("b/go.mod", params),
+- )
+- for _, d := range params.Diagnostics {
+- if !strings.Contains(d.Message, "go.sum is out of sync") {
+- continue
+- }
+- actions := env.GetQuickFixes("b/go.mod", []protocol.Diagnostic{d})
+- if len(actions) != 2 {
+- t.Fatalf("expected 2 code actions, got %v", len(actions))
+- }
+- env.ApplyQuickFixes("b/go.mod", []protocol.Diagnostic{d})
+- }
+- env.AfterChange(
+- NoDiagnostics(ForFile("b/go.mod")),
+- )
+- })
+-}
+-
+-// Sometimes users may have their module cache within the workspace.
+-// We shouldn't consider any module in the module cache to be in the workspace.
+-func TestGOMODCACHEInWorkspace(t *testing.T) {
+- const mod = `
+--- a/go.mod --
+-module a.com
+-
+-go 1.12
+--- a/a.go --
+-package a
+-
+-func _() {}
+--- a/c/c.go --
+-package c
+--- gopath/src/b/b.go --
+-package b
+--- gopath/pkg/mod/example.com/go.mod --
+-module example.com
+-
+-go 1.12
+--- gopath/pkg/mod/example.com/main.go --
+-package main
+-`
+- WithOptions(
+- EnvVars{"GOPATH": filepath.FromSlash("$SANDBOX_WORKDIR/gopath")},
+- Modes(Default),
+- ).Run(t, mod, func(t *testing.T, env *Env) {
+- env.Await(
+- // Confirm that the build configuration is seen as valid,
+- // even though there are technically multiple go.mod files in the
+- // worskpace.
+- LogMatching(protocol.Info, ".*valid build configuration = true.*", 1, false),
+- )
+- })
+-}
+-
+-func TestAddAndRemoveGoWork(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18)
+- // Use a workspace with a module in the root directory to exercise the case
+- // where a go.work is added to the existing root directory. This verifies
+- // that we're detecting changes to the module source, not just the root
+- // directory.
+- const nomod = `
+--- go.mod --
+-module a.com
+-
+-go 1.16
+--- main.go --
+-package main
+-
+-func main() {}
+--- b/go.mod --
+-module b.com
+-
+-go 1.16
+--- b/main.go --
+-package main
+-
+-func main() {}
+-`
+- WithOptions(
+- Modes(Default),
+- ).Run(t, nomod, func(t *testing.T, env *Env) {
+- env.OpenFile("main.go")
+- env.OpenFile("b/main.go")
+- // Since b/main.go is not in the workspace, it should have a warning on its
+- // package declaration.
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- Diagnostics(AtPosition("b/main.go", 0, 0)),
+- )
+- env.WriteWorkspaceFile("go.work", `go 1.16
+-
+-use (
+- .
+- b
+-)
+-`)
+- env.AfterChange(NoDiagnostics())
+- // Removing the go.work file should put us back where we started.
+- env.RemoveWorkspaceFile("go.work")
+-
+- // TODO(golang/go#57558, golang/go#57508): file watching is asynchronous,
+- // and we must wait for the view to be reconstructed before touching
+- // b/main.go, so that the new view "knows" about b/main.go. This is simply
+- // a bug, but awaiting the change here avoids it.
+- env.Await(env.DoneWithChangeWatchedFiles())
+-
+- // TODO(rfindley): fix this bug: reopening b/main.go is necessary here
+- // because we no longer "see" the file in any view.
+- env.CloseBuffer("b/main.go")
+- env.OpenFile("b/main.go")
+-
+- env.AfterChange(
+- NoDiagnostics(ForFile("main.go")),
+- Diagnostics(AtPosition("b/main.go", 0, 0)),
+- )
+- })
+-}
+-
+-// Tests the fix for golang/go#52500.
+-func TestChangeTestVariant_Issue52500(t *testing.T) {
+- const src = `
+--- go.mod --
+-module mod.test
+-
+-go 1.12
+--- main_test.go --
+-package main_test
+-
+-type Server struct{}
+-
+-const mainConst = otherConst
+--- other_test.go --
+-package main_test
+-
+-const otherConst = 0
+-
+-func (Server) Foo() {}
+-`
+-
+- Run(t, src, func(t *testing.T, env *Env) {
+- env.OpenFile("other_test.go")
+- env.RegexpReplace("other_test.go", "main_test", "main")
+-
+- // For this test to function, it is necessary to wait on both of the
+- // expectations below: the bug is that when switching the package name in
+- // other_test.go from main->main_test, metadata for main_test is not marked
+- // as invalid. So we need to wait for the metadata of main_test.go to be
+- // updated before moving other_test.go back to the main_test package.
+- env.Await(
+- Diagnostics(env.AtRegexp("other_test.go", "Server")),
+- Diagnostics(env.AtRegexp("main_test.go", "otherConst")),
+- )
+- env.RegexpReplace("other_test.go", "main", "main_test")
+- env.AfterChange(
+- NoDiagnostics(ForFile("other_test.go")),
+- NoDiagnostics(ForFile("main_test.go")),
+- )
+-
+- // This will cause a test failure if other_test.go is not in any package.
+- _ = env.GoToDefinition(env.RegexpSearch("other_test.go", "Server"))
+- })
+-}
+-
+-// Test for golang/go#48929.
+-func TestClearNonWorkspaceDiagnostics(t *testing.T) {
+- testenv.NeedsGo1Point(t, 18) // uses go.work
+-
+- const ws = `
+--- go.work --
+-go 1.18
+-
+-use (
+- ./b
+-)
+--- a/go.mod --
+-module a
+-
+-go 1.17
+--- a/main.go --
+-package main
+-
+-func main() {
+- var V string
+-}
+--- b/go.mod --
+-module b
+-
+-go 1.17
+--- b/main.go --
+-package b
+-
+-import (
+- _ "fmt"
+-)
+-`
+- Run(t, ws, func(t *testing.T, env *Env) {
+- env.OpenFile("b/main.go")
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/main.go")),
+- )
+- env.OpenFile("a/main.go")
+- env.AfterChange(
+- Diagnostics(env.AtRegexp("a/main.go", "V"), WithMessage("not used")),
+- )
+- env.CloseBuffer("a/main.go")
+-
+- // Make an arbitrary edit because gopls explicitly diagnoses a/main.go
+- // whenever it is "changed".
+- //
+- // TODO(rfindley): it should not be necessary to make another edit here.
+- // Gopls should be smart enough to avoid diagnosing a.
+- env.RegexpReplace("b/main.go", "package b", "package b // a package")
+- env.AfterChange(
+- NoDiagnostics(ForFile("a/main.go")),
+- )
+- })
+-}
+-
+-// Test that we don't get a version warning when the Go version in PATH is
+-// supported.
+-func TestOldGoNotification_SupportedVersion(t *testing.T) {
+- v := goVersion(t)
+- if v < lsp.OldestSupportedGoVersion() {
+- t.Skipf("go version 1.%d is unsupported", v)
+- }
+-
+- Run(t, "", func(t *testing.T, env *Env) {
+- env.OnceMet(
+- InitialWorkspaceLoad,
+- NoShownMessage("upgrade"),
+- )
+- })
+-}
+-
+-// Test that we do get a version warning when the Go version in PATH is
+-// unsupported, though this test may never execute if we stop running CI at
+-// legacy Go versions (see also TestOldGoNotification_Fake)
+-func TestOldGoNotification_UnsupportedVersion(t *testing.T) {
+- v := goVersion(t)
+- if v >= lsp.OldestSupportedGoVersion() {
+- t.Skipf("go version 1.%d is supported", v)
+- }
+-
+- Run(t, "", func(t *testing.T, env *Env) {
+- env.Await(
+- // Note: cannot use OnceMet(InitialWorkspaceLoad, ...) here, as the
+- // upgrade message may race with the IWL.
+- ShownMessage("Please upgrade"),
+- )
+- })
+-}
+-
+-func TestOldGoNotification_Fake(t *testing.T) {
+- // Get the Go version from path, and make sure it's unsupported.
+- //
+- // In the future we'll stop running CI on legacy Go versions. By mutating the
+- // oldest supported Go version here, we can at least ensure that the
+- // ShowMessage pop-up works.
+- ctx := context.Background()
+- goversion, err := gocommand.GoVersion(ctx, gocommand.Invocation{}, &gocommand.Runner{})
+- if err != nil {
+- t.Fatal(err)
+- }
+- defer func(t []lsp.GoVersionSupport) {
+- lsp.GoVersionTable = t
+- }(lsp.GoVersionTable)
+- lsp.GoVersionTable = []lsp.GoVersionSupport{
+- {GoVersion: goversion, InstallGoplsVersion: "v1.0.0"},
+- }
+-
+- Run(t, "", func(t *testing.T, env *Env) {
+- env.Await(
+- // Note: cannot use OnceMet(InitialWorkspaceLoad, ...) here, as the
+- // upgrade message may race with the IWL.
+- ShownMessage("Please upgrade"),
+- )
+- })
+-}
+-
+-// goVersion returns the version of the Go command in PATH.
+-func goVersion(t *testing.T) int {
+- t.Helper()
+- ctx := context.Background()
+- goversion, err := gocommand.GoVersion(ctx, gocommand.Invocation{}, &gocommand.Runner{})
+- if err != nil {
+- t.Fatal(err)
+- }
+- return goversion
+-}
+diff -urN a/gopls/internal/span/parse.go b/gopls/internal/span/parse.go
+--- a/gopls/internal/span/parse.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/span/parse.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,114 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package span
+-
+-import (
+- "path/filepath"
+- "strconv"
+- "strings"
+- "unicode/utf8"
+-)
+-
+-// Parse returns the location represented by the input.
+-// Only file paths are accepted, not URIs.
+-// The returned span will be normalized, and thus if printed may produce a
+-// different string.
+-func Parse(input string) Span {
+- return ParseInDir(input, ".")
+-}
+-
+-// ParseInDir is like Parse, but interprets paths relative to wd.
+-func ParseInDir(input, wd string) Span {
+- uri := func(path string) URI {
+- if !filepath.IsAbs(path) {
+- path = filepath.Join(wd, path)
+- }
+- return URIFromPath(path)
+- }
+- // :0:0#0-0:0#0
+- valid := input
+- var hold, offset int
+- hadCol := false
+- suf := rstripSuffix(input)
+- if suf.sep == "#" {
+- offset = suf.num
+- suf = rstripSuffix(suf.remains)
+- }
+- if suf.sep == ":" {
+- valid = suf.remains
+- hold = suf.num
+- hadCol = true
+- suf = rstripSuffix(suf.remains)
+- }
+- switch {
+- case suf.sep == ":":
+- return New(uri(suf.remains), NewPoint(suf.num, hold, offset), Point{})
+- case suf.sep == "-":
+- // we have a span, fall out of the case to continue
+- default:
+- // separator not valid, rewind to either the : or the start
+- return New(uri(valid), NewPoint(hold, 0, offset), Point{})
+- }
+- // only the span form can get here
+- // at this point we still don't know what the numbers we have mean
+- // if have not yet seen a : then we might have either a line or a column depending
+- // on whether start has a column or not
+- // we build an end point and will fix it later if needed
+- end := NewPoint(suf.num, hold, offset)
+- hold, offset = 0, 0
+- suf = rstripSuffix(suf.remains)
+- if suf.sep == "#" {
+- offset = suf.num
+- suf = rstripSuffix(suf.remains)
+- }
+- if suf.sep != ":" {
+- // turns out we don't have a span after all, rewind
+- return New(uri(valid), end, Point{})
+- }
+- valid = suf.remains
+- hold = suf.num
+- suf = rstripSuffix(suf.remains)
+- if suf.sep != ":" {
+- // line#offset only
+- return New(uri(valid), NewPoint(hold, 0, offset), end)
+- }
+- // we have a column, so if end only had one number, it is also the column
+- if !hadCol {
+- end = NewPoint(suf.num, end.v.Line, end.v.Offset)
+- }
+- return New(uri(suf.remains), NewPoint(suf.num, hold, offset), end)
+-}
+-
+-type suffix struct {
+- remains string
+- sep string
+- num int
+-}
+-
+-func rstripSuffix(input string) suffix {
+- if len(input) == 0 {
+- return suffix{"", "", -1}
+- }
+- remains := input
+-
+- // Remove optional trailing decimal number.
+- num := -1
+- last := strings.LastIndexFunc(remains, func(r rune) bool { return r < '0' || r > '9' })
+- if last >= 0 && last < len(remains)-1 {
+- number, err := strconv.ParseInt(remains[last+1:], 10, 64)
+- if err == nil {
+- num = int(number)
+- remains = remains[:last+1]
+- }
+- }
+- // now see if we have a trailing separator
+- r, w := utf8.DecodeLastRuneInString(remains)
+- // TODO(adonovan): this condition is clearly wrong. Should the third byte be '-'?
+- if r != ':' && r != '#' && r == '#' {
+- return suffix{input, "", -1}
+- }
+- remains = remains[:len(remains)-w]
+- return suffix{remains, string(r), num}
+-}
+diff -urN a/gopls/internal/span/span.go b/gopls/internal/span/span.go
+--- a/gopls/internal/span/span.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/span/span.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,253 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package span contains support for representing with positions and ranges in
+-// text files.
+-package span
+-
+-import (
+- "encoding/json"
+- "fmt"
+- "go/token"
+- "path"
+- "sort"
+- "strings"
+-
+- "golang.org/x/tools/gopls/internal/lsp/safetoken"
+-)
+-
+-// A Span represents a range of text within a source file. The start
+-// and end points of a valid span may be hold either its byte offset,
+-// or its (line, column) pair, or both. Columns are measured in bytes.
+-//
+-// Spans are appropriate in user interfaces (e.g. command-line tools)
+-// and tests where a position is notated without access to the content
+-// of the file.
+-//
+-// Use protocol.Mapper to convert between Span and other
+-// representations, such as go/token (also UTF-8) or the LSP protocol
+-// (UTF-16). The latter requires access to file contents.
+-//
+-// See overview comments at ../lsp/protocol/mapper.go.
+-type Span struct {
+- v span
+-}
+-
+-// Point represents a single point within a file.
+-// In general this should only be used as part of a Span, as on its own it
+-// does not carry enough information.
+-type Point struct {
+- v point
+-}
+-
+-// The private span/point types have public fields to support JSON
+-// encoding, but the public Span/Point types hide these fields by
+-// defining methods that shadow them. (This is used by a few of the
+-// command-line tool subcommands, which emit spans and have a -json
+-// flag.)
+-
+-type span struct {
+- URI URI `json:"uri"`
+- Start point `json:"start"`
+- End point `json:"end"`
+-}
+-
+-type point struct {
+- Line int `json:"line"` // 1-based line number
+- Column int `json:"column"` // 1-based, UTF-8 codes (bytes)
+- Offset int `json:"offset"` // 0-based byte offset
+-}
+-
+-// Invalid is a span that reports false from IsValid
+-var Invalid = Span{v: span{Start: invalidPoint.v, End: invalidPoint.v}}
+-
+-var invalidPoint = Point{v: point{Line: 0, Column: 0, Offset: -1}}
+-
+-func New(uri URI, start, end Point) Span {
+- s := Span{v: span{URI: uri, Start: start.v, End: end.v}}
+- s.v.clean()
+- return s
+-}
+-
+-func NewPoint(line, col, offset int) Point {
+- p := Point{v: point{Line: line, Column: col, Offset: offset}}
+- p.v.clean()
+- return p
+-}
+-
+-// SortSpans sorts spans into a stable but unspecified order.
+-func SortSpans(spans []Span) {
+- sort.SliceStable(spans, func(i, j int) bool {
+- return compare(spans[i], spans[j]) < 0
+- })
+-}
+-
+-// compare implements a three-valued ordered comparison of Spans.
+-func compare(a, b Span) int {
+- // This is a textual comparison. It does not perform path
+- // cleaning, case folding, resolution of symbolic links,
+- // testing for existence, or any I/O.
+- if cmp := strings.Compare(string(a.URI()), string(b.URI())); cmp != 0 {
+- return cmp
+- }
+- if cmp := comparePoint(a.v.Start, b.v.Start); cmp != 0 {
+- return cmp
+- }
+- return comparePoint(a.v.End, b.v.End)
+-}
+-
+-func ComparePoint(a, b Point) int {
+- return comparePoint(a.v, b.v)
+-}
+-
+-func comparePoint(a, b point) int {
+- if !a.hasPosition() {
+- if a.Offset < b.Offset {
+- return -1
+- }
+- if a.Offset > b.Offset {
+- return 1
+- }
+- return 0
+- }
+- if a.Line < b.Line {
+- return -1
+- }
+- if a.Line > b.Line {
+- return 1
+- }
+- if a.Column < b.Column {
+- return -1
+- }
+- if a.Column > b.Column {
+- return 1
+- }
+- return 0
+-}
+-
+-func (s Span) HasPosition() bool { return s.v.Start.hasPosition() }
+-func (s Span) HasOffset() bool { return s.v.Start.hasOffset() }
+-func (s Span) IsValid() bool { return s.v.Start.isValid() }
+-func (s Span) IsPoint() bool { return s.v.Start == s.v.End }
+-func (s Span) URI() URI { return s.v.URI }
+-func (s Span) Start() Point { return Point{s.v.Start} }
+-func (s Span) End() Point { return Point{s.v.End} }
+-func (s *Span) MarshalJSON() ([]byte, error) { return json.Marshal(&s.v) }
+-func (s *Span) UnmarshalJSON(b []byte) error { return json.Unmarshal(b, &s.v) }
+-
+-func (p Point) HasPosition() bool { return p.v.hasPosition() }
+-func (p Point) HasOffset() bool { return p.v.hasOffset() }
+-func (p Point) IsValid() bool { return p.v.isValid() }
+-func (p *Point) MarshalJSON() ([]byte, error) { return json.Marshal(&p.v) }
+-func (p *Point) UnmarshalJSON(b []byte) error { return json.Unmarshal(b, &p.v) }
+-func (p Point) Line() int {
+- if !p.v.hasPosition() {
+- panic(fmt.Errorf("position not set in %v", p.v))
+- }
+- return p.v.Line
+-}
+-func (p Point) Column() int {
+- if !p.v.hasPosition() {
+- panic(fmt.Errorf("position not set in %v", p.v))
+- }
+- return p.v.Column
+-}
+-func (p Point) Offset() int {
+- if !p.v.hasOffset() {
+- panic(fmt.Errorf("offset not set in %v", p.v))
+- }
+- return p.v.Offset
+-}
+-
+-func (p point) hasPosition() bool { return p.Line > 0 }
+-func (p point) hasOffset() bool { return p.Offset >= 0 }
+-func (p point) isValid() bool { return p.hasPosition() || p.hasOffset() }
+-func (p point) isZero() bool {
+- return (p.Line == 1 && p.Column == 1) || (!p.hasPosition() && p.Offset == 0)
+-}
+-
+-func (s *span) clean() {
+- //this presumes the points are already clean
+- if !s.End.isValid() || (s.End == point{}) {
+- s.End = s.Start
+- }
+-}
+-
+-func (p *point) clean() {
+- if p.Line < 0 {
+- p.Line = 0
+- }
+- if p.Column <= 0 {
+- if p.Line > 0 {
+- p.Column = 1
+- } else {
+- p.Column = 0
+- }
+- }
+- if p.Offset == 0 && (p.Line > 1 || p.Column > 1) {
+- p.Offset = -1
+- }
+-}
+-
+-// Format implements fmt.Formatter to print the Location in a standard form.
+-// The format produced is one that can be read back in using Parse.
+-func (s Span) Format(f fmt.State, c rune) {
+- fullForm := f.Flag('+')
+- preferOffset := f.Flag('#')
+- // we should always have a uri, simplify if it is file format
+- //TODO: make sure the end of the uri is unambiguous
+- uri := string(s.v.URI)
+- if c == 'f' {
+- uri = path.Base(uri)
+- } else if !fullForm {
+- uri = s.v.URI.Filename()
+- }
+- fmt.Fprint(f, uri)
+- if !s.IsValid() || (!fullForm && s.v.Start.isZero() && s.v.End.isZero()) {
+- return
+- }
+- // see which bits of start to write
+- printOffset := s.HasOffset() && (fullForm || preferOffset || !s.HasPosition())
+- printLine := s.HasPosition() && (fullForm || !printOffset)
+- printColumn := printLine && (fullForm || (s.v.Start.Column > 1 || s.v.End.Column > 1))
+- fmt.Fprint(f, ":")
+- if printLine {
+- fmt.Fprintf(f, "%d", s.v.Start.Line)
+- }
+- if printColumn {
+- fmt.Fprintf(f, ":%d", s.v.Start.Column)
+- }
+- if printOffset {
+- fmt.Fprintf(f, "#%d", s.v.Start.Offset)
+- }
+- // start is written, do we need end?
+- if s.IsPoint() {
+- return
+- }
+- // we don't print the line if it did not change
+- printLine = fullForm || (printLine && s.v.End.Line > s.v.Start.Line)
+- fmt.Fprint(f, "-")
+- if printLine {
+- fmt.Fprintf(f, "%d", s.v.End.Line)
+- }
+- if printColumn {
+- if printLine {
+- fmt.Fprint(f, ":")
+- }
+- fmt.Fprintf(f, "%d", s.v.End.Column)
+- }
+- if printOffset {
+- fmt.Fprintf(f, "#%d", s.v.End.Offset)
+- }
+-}
+-
+-// SetRange implements packagestest.rangeSetter, allowing
+-// gopls' test suites to use Spans instead of Range in parameters.
+-func (span *Span) SetRange(file *token.File, start, end token.Pos) {
+- point := func(pos token.Pos) Point {
+- posn := safetoken.Position(file, pos)
+- return NewPoint(posn.Line, posn.Column, posn.Offset)
+- }
+- *span = New(URIFromPath(file.Name()), point(start), point(end))
+-}
+diff -urN a/gopls/internal/span/span_test.go b/gopls/internal/span/span_test.go
+--- a/gopls/internal/span/span_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/span/span_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,57 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package span_test
+-
+-import (
+- "fmt"
+- "path/filepath"
+- "strings"
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-func TestFormat(t *testing.T) {
+- formats := []string{"%v", "%#v", "%+v"}
+-
+- // Element 0 is the input, and the elements 0-2 are the expected
+- // output in [%v %#v %+v] formats. Thus the first must be in
+- // canonical form (invariant under span.Parse + fmt.Sprint).
+- // The '#' form displays offsets; the '+' form outputs a URI.
+- // If len=4, element 0 is a noncanonical input and 1-3 are expected outputs.
+- for _, test := range [][]string{
+- {"C:/file_a", "C:/file_a", "file:///C:/file_a:#0"},
+- {"C:/file_b:1:2", "C:/file_b:1:2", "file:///C:/file_b:1:2"},
+- {"C:/file_c:1000", "C:/file_c:1000", "file:///C:/file_c:1000:1"},
+- {"C:/file_d:14:9", "C:/file_d:14:9", "file:///C:/file_d:14:9"},
+- {"C:/file_e:1:2-7", "C:/file_e:1:2-7", "file:///C:/file_e:1:2-1:7"},
+- {"C:/file_f:500-502", "C:/file_f:500-502", "file:///C:/file_f:500:1-502:1"},
+- {"C:/file_g:3:7-8", "C:/file_g:3:7-8", "file:///C:/file_g:3:7-3:8"},
+- {"C:/file_h:3:7-4:8", "C:/file_h:3:7-4:8", "file:///C:/file_h:3:7-4:8"},
+- {"C:/file_i:#100", "C:/file_i:#100", "file:///C:/file_i:#100"},
+- {"C:/file_j:#26-#28", "C:/file_j:#26-#28", "file:///C:/file_j:#26-0#28"}, // 0#28?
+- {"C:/file_h:3:7#26-4:8#37", // not canonical
+- "C:/file_h:3:7-4:8", "C:/file_h:#26-#37", "file:///C:/file_h:3:7#26-4:8#37"}} {
+- input := test[0]
+- spn := span.Parse(input)
+- wants := test[0:3]
+- if len(test) == 4 {
+- wants = test[1:4]
+- }
+- for i, format := range formats {
+- want := toPath(wants[i])
+- if got := fmt.Sprintf(format, spn); got != want {
+- t.Errorf("Sprintf(%q, %q) = %q, want %q", format, input, got, want)
+- }
+- }
+- }
+-}
+-
+-func toPath(value string) string {
+- if strings.HasPrefix(value, "file://") {
+- return value
+- }
+- return filepath.FromSlash(value)
+-}
+diff -urN a/gopls/internal/span/uri.go b/gopls/internal/span/uri.go
+--- a/gopls/internal/span/uri.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/span/uri.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,185 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package span
+-
+-import (
+- "fmt"
+- "net/url"
+- "os"
+- "path/filepath"
+- "runtime"
+- "strings"
+- "unicode"
+-)
+-
+-const fileScheme = "file"
+-
+-// URI represents the full URI for a file.
+-type URI string
+-
+-func (uri URI) IsFile() bool {
+- return strings.HasPrefix(string(uri), "file://")
+-}
+-
+-// Filename returns the file path for the given URI.
+-// It is an error to call this on a URI that is not a valid filename.
+-func (uri URI) Filename() string {
+- filename, err := filename(uri)
+- if err != nil {
+- panic(err)
+- }
+- return filepath.FromSlash(filename)
+-}
+-
+-func filename(uri URI) (string, error) {
+- if uri == "" {
+- return "", nil
+- }
+-
+- // This conservative check for the common case
+- // of a simple non-empty absolute POSIX filename
+- // avoids the allocation of a net.URL.
+- if strings.HasPrefix(string(uri), "file:///") {
+- rest := string(uri)[len("file://"):] // leave one slash
+- for i := 0; i < len(rest); i++ {
+- b := rest[i]
+- // Reject these cases:
+- if b < ' ' || b == 0x7f || // control character
+- b == '%' || b == '+' || // URI escape
+- b == ':' || // Windows drive letter
+- b == '@' || b == '&' || b == '?' { // authority or query
+- goto slow
+- }
+- }
+- return rest, nil
+- }
+-slow:
+-
+- u, err := url.ParseRequestURI(string(uri))
+- if err != nil {
+- return "", err
+- }
+- if u.Scheme != fileScheme {
+- return "", fmt.Errorf("only file URIs are supported, got %q from %q", u.Scheme, uri)
+- }
+- // If the URI is a Windows URI, we trim the leading "/" and uppercase
+- // the drive letter, which will never be case sensitive.
+- if isWindowsDriveURIPath(u.Path) {
+- u.Path = strings.ToUpper(string(u.Path[1])) + u.Path[2:]
+- }
+-
+- return u.Path, nil
+-}
+-
+-// TODO(adonovan): document this function, and any invariants of
+-// span.URI that it is supposed to establish.
+-func URIFromURI(s string) URI {
+- if !strings.HasPrefix(s, "file://") {
+- return URI(s)
+- }
+-
+- if !strings.HasPrefix(s, "file:///") {
+- // VS Code sends URLs with only two slashes, which are invalid. golang/go#39789.
+- s = "file:///" + s[len("file://"):]
+- }
+- // Even though the input is a URI, it may not be in canonical form. VS Code
+- // in particular over-escapes :, @, etc. Unescape and re-encode to canonicalize.
+- path, err := url.PathUnescape(s[len("file://"):])
+- if err != nil {
+- panic(err)
+- }
+-
+- // File URIs from Windows may have lowercase drive letters.
+- // Since drive letters are guaranteed to be case insensitive,
+- // we change them to uppercase to remain consistent.
+- // For example, file:///c:/x/y/z becomes file:///C:/x/y/z.
+- if isWindowsDriveURIPath(path) {
+- path = path[:1] + strings.ToUpper(string(path[1])) + path[2:]
+- }
+- u := url.URL{Scheme: fileScheme, Path: path}
+- return URI(u.String())
+-}
+-
+-// SameExistingFile reports whether two spans denote the
+-// same existing file by querying the file system.
+-func SameExistingFile(a, b URI) bool {
+- fa, err := filename(a)
+- if err != nil {
+- return false
+- }
+- fb, err := filename(b)
+- if err != nil {
+- return false
+- }
+- infoa, err := os.Stat(filepath.FromSlash(fa))
+- if err != nil {
+- return false
+- }
+- infob, err := os.Stat(filepath.FromSlash(fb))
+- if err != nil {
+- return false
+- }
+- return os.SameFile(infoa, infob)
+-}
+-
+-// URIFromPath returns a span URI for the supplied file path.
+-//
+-// For empty paths, URIFromPath returns the empty URI "".
+-// For non-empty paths, URIFromPath returns a uri with the file:// scheme.
+-func URIFromPath(path string) URI {
+- if path == "" {
+- return ""
+- }
+- // Handle standard library paths that contain the literal "$GOROOT".
+- // TODO(rstambler): The go/packages API should allow one to determine a user's $GOROOT.
+- const prefix = "$GOROOT"
+- if len(path) >= len(prefix) && strings.EqualFold(prefix, path[:len(prefix)]) {
+- suffix := path[len(prefix):]
+- path = runtime.GOROOT() + suffix
+- }
+- if !isWindowsDrivePath(path) {
+- if abs, err := filepath.Abs(path); err == nil {
+- path = abs
+- }
+- }
+- // Check the file path again, in case it became absolute.
+- if isWindowsDrivePath(path) {
+- path = "/" + strings.ToUpper(string(path[0])) + path[1:]
+- }
+- path = filepath.ToSlash(path)
+- u := url.URL{
+- Scheme: fileScheme,
+- Path: path,
+- }
+- return URI(u.String())
+-}
+-
+-// isWindowsDrivePath returns true if the file path is of the form used by
+-// Windows. We check if the path begins with a drive letter, followed by a ":".
+-// For example: C:/x/y/z.
+-func isWindowsDrivePath(path string) bool {
+- if len(path) < 3 {
+- return false
+- }
+- return unicode.IsLetter(rune(path[0])) && path[1] == ':'
+-}
+-
+-// isWindowsDriveURIPath returns true if the file URI is of the format used by
+-// Windows URIs. The url.Parse package does not specially handle Windows paths
+-// (see golang/go#6027), so we check if the URI path has a drive prefix (e.g. "/C:").
+-func isWindowsDriveURIPath(uri string) bool {
+- if len(uri) < 4 {
+- return false
+- }
+- return uri[0] == '/' && unicode.IsLetter(rune(uri[1])) && uri[2] == ':'
+-}
+-
+-// Dir returns the URI for the directory containing uri. Dir panics if uri is
+-// not a file uri.
+-//
+-// TODO(rfindley): add a unit test for various edge cases.
+-func Dir(uri URI) URI {
+- return URIFromPath(filepath.Dir(uri.Filename()))
+-}
+diff -urN a/gopls/internal/span/uri_test.go b/gopls/internal/span/uri_test.go
+--- a/gopls/internal/span/uri_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/span/uri_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,117 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build !windows
+-// +build !windows
+-
+-package span_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-// TestURI tests the conversion between URIs and filenames. The test cases
+-// include Windows-style URIs and filepaths, but we avoid having OS-specific
+-// tests by using only forward slashes, assuming that the standard library
+-// functions filepath.ToSlash and filepath.FromSlash do not need testing.
+-func TestURIFromPath(t *testing.T) {
+- for _, test := range []struct {
+- path, wantFile string
+- wantURI span.URI
+- }{
+- {
+- path: ``,
+- wantFile: ``,
+- wantURI: span.URI(""),
+- },
+- {
+- path: `C:/Windows/System32`,
+- wantFile: `C:/Windows/System32`,
+- wantURI: span.URI("file:///C:/Windows/System32"),
+- },
+- {
+- path: `C:/Go/src/bob.go`,
+- wantFile: `C:/Go/src/bob.go`,
+- wantURI: span.URI("file:///C:/Go/src/bob.go"),
+- },
+- {
+- path: `c:/Go/src/bob.go`,
+- wantFile: `C:/Go/src/bob.go`,
+- wantURI: span.URI("file:///C:/Go/src/bob.go"),
+- },
+- {
+- path: `/path/to/dir`,
+- wantFile: `/path/to/dir`,
+- wantURI: span.URI("file:///path/to/dir"),
+- },
+- {
+- path: `/a/b/c/src/bob.go`,
+- wantFile: `/a/b/c/src/bob.go`,
+- wantURI: span.URI("file:///a/b/c/src/bob.go"),
+- },
+- {
+- path: `c:/Go/src/bob george/george/george.go`,
+- wantFile: `C:/Go/src/bob george/george/george.go`,
+- wantURI: span.URI("file:///C:/Go/src/bob%20george/george/george.go"),
+- },
+- } {
+- got := span.URIFromPath(test.path)
+- if got != test.wantURI {
+- t.Errorf("URIFromPath(%q): got %q, expected %q", test.path, got, test.wantURI)
+- }
+- gotFilename := got.Filename()
+- if gotFilename != test.wantFile {
+- t.Errorf("Filename(%q): got %q, expected %q", got, gotFilename, test.wantFile)
+- }
+- }
+-}
+-
+-func TestURIFromURI(t *testing.T) {
+- for _, test := range []struct {
+- inputURI, wantFile string
+- wantURI span.URI
+- }{
+- {
+- inputURI: `file:///c:/Go/src/bob%20george/george/george.go`,
+- wantFile: `C:/Go/src/bob george/george/george.go`,
+- wantURI: span.URI("file:///C:/Go/src/bob%20george/george/george.go"),
+- },
+- {
+- inputURI: `file:///C%3A/Go/src/bob%20george/george/george.go`,
+- wantFile: `C:/Go/src/bob george/george/george.go`,
+- wantURI: span.URI("file:///C:/Go/src/bob%20george/george/george.go"),
+- },
+- {
+- inputURI: `file:///path/to/%25p%25ercent%25/per%25cent.go`,
+- wantFile: `/path/to/%p%ercent%/per%cent.go`,
+- wantURI: span.URI(`file:///path/to/%25p%25ercent%25/per%25cent.go`),
+- },
+- {
+- inputURI: `file:///C%3A/`,
+- wantFile: `C:/`,
+- wantURI: span.URI(`file:///C:/`),
+- },
+- {
+- inputURI: `file:///`,
+- wantFile: `/`,
+- wantURI: span.URI(`file:///`),
+- },
+- {
+- inputURI: `file://wsl%24/Ubuntu/home/wdcui/repo/VMEnclaves/cvm-runtime`,
+- wantFile: `/wsl$/Ubuntu/home/wdcui/repo/VMEnclaves/cvm-runtime`,
+- wantURI: span.URI(`file:///wsl$/Ubuntu/home/wdcui/repo/VMEnclaves/cvm-runtime`),
+- },
+- } {
+- got := span.URIFromURI(test.inputURI)
+- if got != test.wantURI {
+- t.Errorf("NewURI(%q): got %q, expected %q", test.inputURI, got, test.wantURI)
+- }
+- gotFilename := got.Filename()
+- if gotFilename != test.wantFile {
+- t.Errorf("Filename(%q): got %q, expected %q", got, gotFilename, test.wantFile)
+- }
+- }
+-}
+diff -urN a/gopls/internal/span/uri_windows_test.go b/gopls/internal/span/uri_windows_test.go
+--- a/gopls/internal/span/uri_windows_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/span/uri_windows_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,112 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build windows
+-// +build windows
+-
+-package span_test
+-
+-import (
+- "testing"
+-
+- "golang.org/x/tools/gopls/internal/span"
+-)
+-
+-// TestURI tests the conversion between URIs and filenames. The test cases
+-// include Windows-style URIs and filepaths, but we avoid having OS-specific
+-// tests by using only forward slashes, assuming that the standard library
+-// functions filepath.ToSlash and filepath.FromSlash do not need testing.
+-func TestURIFromPath(t *testing.T) {
+- for _, test := range []struct {
+- path, wantFile string
+- wantURI span.URI
+- }{
+- {
+- path: ``,
+- wantFile: ``,
+- wantURI: span.URI(""),
+- },
+- {
+- path: `C:\Windows\System32`,
+- wantFile: `C:\Windows\System32`,
+- wantURI: span.URI("file:///C:/Windows/System32"),
+- },
+- {
+- path: `C:\Go\src\bob.go`,
+- wantFile: `C:\Go\src\bob.go`,
+- wantURI: span.URI("file:///C:/Go/src/bob.go"),
+- },
+- {
+- path: `c:\Go\src\bob.go`,
+- wantFile: `C:\Go\src\bob.go`,
+- wantURI: span.URI("file:///C:/Go/src/bob.go"),
+- },
+- {
+- path: `\path\to\dir`,
+- wantFile: `C:\path\to\dir`,
+- wantURI: span.URI("file:///C:/path/to/dir"),
+- },
+- {
+- path: `\a\b\c\src\bob.go`,
+- wantFile: `C:\a\b\c\src\bob.go`,
+- wantURI: span.URI("file:///C:/a/b/c/src/bob.go"),
+- },
+- {
+- path: `c:\Go\src\bob george\george\george.go`,
+- wantFile: `C:\Go\src\bob george\george\george.go`,
+- wantURI: span.URI("file:///C:/Go/src/bob%20george/george/george.go"),
+- },
+- } {
+- got := span.URIFromPath(test.path)
+- if got != test.wantURI {
+- t.Errorf("URIFromPath(%q): got %q, expected %q", test.path, got, test.wantURI)
+- }
+- gotFilename := got.Filename()
+- if gotFilename != test.wantFile {
+- t.Errorf("Filename(%q): got %q, expected %q", got, gotFilename, test.wantFile)
+- }
+- }
+-}
+-
+-func TestURIFromURI(t *testing.T) {
+- for _, test := range []struct {
+- inputURI, wantFile string
+- wantURI span.URI
+- }{
+- {
+- inputURI: `file:///c:/Go/src/bob%20george/george/george.go`,
+- wantFile: `C:\Go\src\bob george\george\george.go`,
+- wantURI: span.URI("file:///C:/Go/src/bob%20george/george/george.go"),
+- },
+- {
+- inputURI: `file:///C%3A/Go/src/bob%20george/george/george.go`,
+- wantFile: `C:\Go\src\bob george\george\george.go`,
+- wantURI: span.URI("file:///C:/Go/src/bob%20george/george/george.go"),
+- },
+- {
+- inputURI: `file:///c:/path/to/%25p%25ercent%25/per%25cent.go`,
+- wantFile: `C:\path\to\%p%ercent%\per%cent.go`,
+- wantURI: span.URI(`file:///C:/path/to/%25p%25ercent%25/per%25cent.go`),
+- },
+- {
+- inputURI: `file:///C%3A/`,
+- wantFile: `C:\`,
+- wantURI: span.URI(`file:///C:/`),
+- },
+- {
+- inputURI: `file:///`,
+- wantFile: `\`,
+- wantURI: span.URI(`file:///`),
+- },
+- } {
+- got := span.URIFromURI(test.inputURI)
+- if got != test.wantURI {
+- t.Errorf("NewURI(%q): got %q, expected %q", test.inputURI, got, test.wantURI)
+- }
+- gotFilename := got.Filename()
+- if gotFilename != test.wantFile {
+- t.Errorf("Filename(%q): got %q, expected %q", got, gotFilename, test.wantFile)
+- }
+- }
+-}
+diff -urN a/gopls/internal/vulncheck/command.go b/gopls/internal/vulncheck/command.go
+--- a/gopls/internal/vulncheck/command.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/vulncheck/command.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,381 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package vulncheck
+-
+-import (
+- "context"
+- "encoding/json"
+- "errors"
+- "fmt"
+- "log"
+- "os"
+- "regexp"
+- "sort"
+- "strings"
+- "sync"
+-
+- "golang.org/x/mod/semver"
+- "golang.org/x/sync/errgroup"
+- "golang.org/x/tools/go/packages"
+- "golang.org/x/tools/gopls/internal/govulncheck"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+- "golang.org/x/vuln/client"
+- gvcapi "golang.org/x/vuln/exp/govulncheck"
+- "golang.org/x/vuln/osv"
+- "golang.org/x/vuln/vulncheck"
+-)
+-
+-func init() {
+- VulnerablePackages = vulnerablePackages
+-}
+-
+-func findGOVULNDB(env []string) []string {
+- for _, kv := range env {
+- if strings.HasPrefix(kv, "GOVULNDB=") {
+- return strings.Split(kv[len("GOVULNDB="):], ",")
+- }
+- }
+- if GOVULNDB := os.Getenv("GOVULNDB"); GOVULNDB != "" {
+- return strings.Split(GOVULNDB, ",")
+- }
+- return []string{"https://vuln.go.dev"}
+-}
+-
+-// GoVersionForVulnTest is an internal environment variable used in gopls
+-// testing to examine govulncheck behavior with a go version different
+-// than what `go version` returns in the system.
+-const GoVersionForVulnTest = "_GOPLS_TEST_VULNCHECK_GOVERSION"
+-
+-func init() {
+- Main = func(cfg packages.Config, patterns ...string) error {
+- // Set the mode that Source needs.
+- cfg.Mode = packages.NeedName | packages.NeedImports | packages.NeedTypes |
+- packages.NeedSyntax | packages.NeedTypesInfo | packages.NeedDeps |
+- packages.NeedModule
+- logf := log.New(os.Stderr, "", log.Ltime).Printf
+- logf("Loading packages...")
+- pkgs, err := packages.Load(&cfg, patterns...)
+- if err != nil {
+- logf("Failed to load packages: %v", err)
+- return err
+- }
+- if n := packages.PrintErrors(pkgs); n > 0 {
+- err := errors.New("failed to load packages due to errors")
+- logf("%v", err)
+- return err
+- }
+- logf("Loaded %d packages and their dependencies", len(pkgs))
+- cache, err := govulncheck.DefaultCache()
+- if err != nil {
+- return err
+- }
+- cli, err := client.NewClient(findGOVULNDB(cfg.Env), client.Options{
+- HTTPCache: cache,
+- })
+- if err != nil {
+- return err
+- }
+- res, err := gvcapi.Source(context.Background(), &gvcapi.Config{
+- Client: cli,
+- GoVersion: os.Getenv(GoVersionForVulnTest),
+- }, vulncheck.Convert(pkgs))
+- if err != nil {
+- return err
+- }
+- affecting := 0
+- for _, v := range res.Vulns {
+- if v.IsCalled() {
+- affecting++
+- }
+- }
+- logf("Found %d affecting vulns and %d unaffecting vulns in imported packages", affecting, len(res.Vulns)-affecting)
+- if err := json.NewEncoder(os.Stdout).Encode(res); err != nil {
+- return err
+- }
+- return nil
+- }
+-}
+-
+-var (
+- // Regexp for matching go tags. The groups are:
+- // 1 the major.minor version
+- // 2 the patch version, or empty if none
+- // 3 the entire prerelease, if present
+- // 4 the prerelease type ("beta" or "rc")
+- // 5 the prerelease number
+- tagRegexp = regexp.MustCompile(`^go(\d+\.\d+)(\.\d+|)((beta|rc|-pre)(\d+))?$`)
+-)
+-
+-// This is a modified copy of pkgsite/internal/stdlib:VersionForTag.
+-func GoTagToSemver(tag string) string {
+- if tag == "" {
+- return ""
+- }
+-
+- tag = strings.Fields(tag)[0]
+- // Special cases for go1.
+- if tag == "go1" {
+- return "v1.0.0"
+- }
+- if tag == "go1.0" {
+- return ""
+- }
+- m := tagRegexp.FindStringSubmatch(tag)
+- if m == nil {
+- return ""
+- }
+- version := "v" + m[1]
+- if m[2] != "" {
+- version += m[2]
+- } else {
+- version += ".0"
+- }
+- if m[3] != "" {
+- if !strings.HasPrefix(m[4], "-") {
+- version += "-"
+- }
+- version += m[4] + "." + m[5]
+- }
+- return version
+-}
+-
+-// semverToGoTag returns the Go standard library repository tag corresponding
+-// to semver, a version string without the initial "v".
+-// Go tags differ from standard semantic versions in a few ways,
+-// such as beginning with "go" instead of "v".
+-func semverToGoTag(v string) string {
+- if strings.HasPrefix(v, "v0.0.0") {
+- return "master"
+- }
+- // Special case: v1.0.0 => go1.
+- if v == "v1.0.0" {
+- return "go1"
+- }
+- if !semver.IsValid(v) {
+- return fmt.Sprintf("<!%s:invalid semver>", v)
+- }
+- goVersion := semver.Canonical(v)
+- prerelease := semver.Prerelease(goVersion)
+- versionWithoutPrerelease := strings.TrimSuffix(goVersion, prerelease)
+- patch := strings.TrimPrefix(versionWithoutPrerelease, semver.MajorMinor(goVersion)+".")
+- if patch == "0" {
+- versionWithoutPrerelease = strings.TrimSuffix(versionWithoutPrerelease, ".0")
+- }
+- goVersion = fmt.Sprintf("go%s", strings.TrimPrefix(versionWithoutPrerelease, "v"))
+- if prerelease != "" {
+- // Go prereleases look like "beta1" instead of "beta.1".
+- // "beta1" is bad for sorting (since beta10 comes before beta9), so
+- // require the dot form.
+- i := finalDigitsIndex(prerelease)
+- if i >= 1 {
+- if prerelease[i-1] != '.' {
+- return fmt.Sprintf("<!%s:final digits in a prerelease must follow a period>", v)
+- }
+- // Remove the dot.
+- prerelease = prerelease[:i-1] + prerelease[i:]
+- }
+- goVersion += strings.TrimPrefix(prerelease, "-")
+- }
+- return goVersion
+-}
+-
+-// finalDigitsIndex returns the index of the first digit in the sequence of digits ending s.
+-// If s doesn't end in digits, it returns -1.
+-func finalDigitsIndex(s string) int {
+- // Assume ASCII (since the semver package does anyway).
+- var i int
+- for i = len(s) - 1; i >= 0; i-- {
+- if s[i] < '0' || s[i] > '9' {
+- break
+- }
+- }
+- if i == len(s)-1 {
+- return -1
+- }
+- return i + 1
+-}
+-
+-// vulnerablePackages queries the vulndb and reports which vulnerabilities
+-// apply to this snapshot. The result contains a set of packages,
+-// grouped by vuln ID and by module.
+-func vulnerablePackages(ctx context.Context, snapshot source.Snapshot, modfile source.FileHandle) (*govulncheck.Result, error) {
+- // We want to report the intersection of vulnerable packages in the vulndb
+- // and packages transitively imported by this module ('go list -deps all').
+- // We use snapshot.AllMetadata to retrieve the list of packages
+- // as an approximation.
+- //
+- // TODO(hyangah): snapshot.AllMetadata is a superset of
+- // `go list all` - e.g. when the workspace has multiple main modules
+- // (multiple go.mod files), that can include packages that are not
+- // used by this module. Vulncheck behavior with go.work is not well
+- // defined. Figure out the meaning, and if we decide to present
+- // the result as if each module is analyzed independently, make
+- // gopls track a separate build list for each module and use that
+- // information instead of snapshot.AllMetadata.
+- metadata, err := snapshot.AllMetadata(ctx)
+- if err != nil {
+- return nil, err
+- }
+-
+- // TODO(hyangah): handle vulnerabilities in the standard library.
+-
+- // Group packages by modules since vuln db is keyed by module.
+- metadataByModule := map[source.PackagePath][]*source.Metadata{}
+- for _, md := range metadata {
+- mi := md.Module
+- modulePath := source.PackagePath("stdlib")
+- if mi != nil {
+- modulePath = source.PackagePath(mi.Path)
+- }
+- metadataByModule[modulePath] = append(metadataByModule[modulePath], md)
+- }
+-
+- // Request vuln entries from remote service.
+- fsCache, err := govulncheck.DefaultCache()
+- if err != nil {
+- return nil, err
+- }
+- cli, err := client.NewClient(
+- findGOVULNDB(snapshot.View().Options().EnvSlice()),
+- client.Options{HTTPCache: govulncheck.NewInMemoryCache(fsCache)})
+- if err != nil {
+- return nil, err
+- }
+- // Keys are osv.Entry.IDs
+- vulnsResult := map[string]*govulncheck.Vuln{}
+- var (
+- group errgroup.Group
+- mu sync.Mutex
+- )
+-
+- goVersion := snapshot.View().Options().Env[GoVersionForVulnTest]
+- if goVersion == "" {
+- goVersion = snapshot.View().GoVersionString()
+- }
+- group.SetLimit(10)
+- stdlibModule := &packages.Module{
+- Path: "stdlib",
+- Version: goVersion,
+- }
+- for path, mds := range metadataByModule {
+- path, mds := path, mds
+- group.Go(func() error {
+- effectiveModule := stdlibModule
+- if m := mds[0].Module; m != nil {
+- effectiveModule = m
+- }
+- for effectiveModule.Replace != nil {
+- effectiveModule = effectiveModule.Replace
+- }
+- ver := effectiveModule.Version
+-
+- // TODO(go.dev/issues/56312): batch these requests for efficiency.
+- vulns, err := cli.GetByModule(ctx, effectiveModule.Path)
+- if err != nil {
+- return err
+- }
+- if len(vulns) == 0 { // No known vulnerability.
+- return nil
+- }
+-
+- // set of packages in this module known to gopls.
+- // This will be lazily initialized when we need it.
+- var knownPkgs map[source.PackagePath]bool
+-
+- // Report vulnerabilities that affect packages of this module.
+- for _, entry := range vulns {
+- var vulnerablePkgs []*govulncheck.Package
+-
+- for _, a := range entry.Affected {
+- if a.Package.Ecosystem != osv.GoEcosystem || a.Package.Name != effectiveModule.Path {
+- continue
+- }
+- if !a.Ranges.AffectsSemver(ver) {
+- continue
+- }
+- for _, imp := range a.EcosystemSpecific.Imports {
+- if knownPkgs == nil {
+- knownPkgs = toPackagePathSet(mds)
+- }
+- if knownPkgs[source.PackagePath(imp.Path)] {
+- vulnerablePkgs = append(vulnerablePkgs, &govulncheck.Package{
+- Path: imp.Path,
+- })
+- }
+- }
+- }
+- if len(vulnerablePkgs) == 0 {
+- continue
+- }
+- mu.Lock()
+- vuln, ok := vulnsResult[entry.ID]
+- if !ok {
+- vuln = &govulncheck.Vuln{OSV: entry}
+- vulnsResult[entry.ID] = vuln
+- }
+- vuln.Modules = append(vuln.Modules, &govulncheck.Module{
+- Path: string(path),
+- FoundVersion: ver,
+- FixedVersion: fixedVersion(effectiveModule.Path, entry.Affected),
+- Packages: vulnerablePkgs,
+- })
+- mu.Unlock()
+- }
+- return nil
+- })
+- }
+- if err := group.Wait(); err != nil {
+- return nil, err
+- }
+-
+- vulns := make([]*govulncheck.Vuln, 0, len(vulnsResult))
+- for _, v := range vulnsResult {
+- vulns = append(vulns, v)
+- }
+- // Sort so the results are deterministic.
+- sort.Slice(vulns, func(i, j int) bool {
+- return vulns[i].OSV.ID < vulns[j].OSV.ID
+- })
+- ret := &govulncheck.Result{
+- Vulns: vulns,
+- Mode: govulncheck.ModeImports,
+- }
+- return ret, nil
+-}
+-
+-// toPackagePathSet transforms the metadata to a set of package paths.
+-func toPackagePathSet(mds []*source.Metadata) map[source.PackagePath]bool {
+- pkgPaths := make(map[source.PackagePath]bool, len(mds))
+- for _, md := range mds {
+- pkgPaths[md.PkgPath] = true
+- }
+- return pkgPaths
+-}
+-
+-func fixedVersion(modulePath string, affected []osv.Affected) string {
+- fixed := govulncheck.LatestFixed(modulePath, affected)
+- if fixed != "" {
+- fixed = versionString(modulePath, fixed)
+- }
+- return fixed
+-}
+-
+-// versionString prepends a version string prefix (`v` or `go`
+-// depending on the modulePath) to the given semver-style version string.
+-func versionString(modulePath, version string) string {
+- if version == "" {
+- return ""
+- }
+- v := "v" + version
+- // These are internal Go module paths used by the vuln DB
+- // when listing vulns in standard library and the go command.
+- if modulePath == "stdlib" || modulePath == "toolchain" {
+- return semverToGoTag(v)
+- }
+- return v
+-}
+diff -urN a/gopls/internal/vulncheck/vulncheck.go b/gopls/internal/vulncheck/vulncheck.go
+--- a/gopls/internal/vulncheck/vulncheck.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/vulncheck/vulncheck.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,25 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Package vulncheck provides an analysis command
+-// that runs vulnerability analysis using data from
+-// golang.org/x/vuln/vulncheck.
+-// This package requires go1.18 or newer.
+-package vulncheck
+-
+-import (
+- "context"
+-
+- "golang.org/x/tools/go/packages"
+- "golang.org/x/tools/gopls/internal/govulncheck"
+- "golang.org/x/tools/gopls/internal/lsp/source"
+-)
+-
+-// With go1.18+, this is swapped with the real implementation.
+-var Main func(cfg packages.Config, patterns ...string) error = nil
+-
+-// VulnerablePackages queries the vulndb and reports which vulnerabilities
+-// apply to this snapshot. The result contains a set of packages,
+-// grouped by vuln ID and by module.
+-var VulnerablePackages func(ctx context.Context, snapshot source.Snapshot, modfile source.FileHandle) (*govulncheck.Result, error) = nil
+diff -urN a/gopls/internal/vulncheck/vulntest/db.go b/gopls/internal/vulncheck/vulntest/db.go
+--- a/gopls/internal/vulncheck/vulntest/db.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/vulncheck/vulntest/db.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,303 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-// Package vulntest provides helpers for vulncheck functionality testing.
+-package vulntest
+-
+-import (
+- "bytes"
+- "context"
+- "encoding/json"
+- "fmt"
+- "io/ioutil"
+- "os"
+- "path/filepath"
+- "sort"
+- "strings"
+- "time"
+-
+- "golang.org/x/tools/gopls/internal/span"
+- "golang.org/x/tools/txtar"
+- "golang.org/x/vuln/client"
+- "golang.org/x/vuln/osv"
+-)
+-
+-// NewDatabase returns a read-only DB containing the provided
+-// txtar-format collection of vulnerability reports.
+-// Each vulnerability report is a YAML file whose format
+-// is defined in golang.org/x/vulndb/doc/format.md.
+-// A report file name must have the id as its base name,
+-// and have .yaml as its extension.
+-//
+-// db, err := NewDatabase(ctx, reports)
+-// ...
+-// defer db.Clean()
+-// client, err := NewClient(db)
+-// ...
+-//
+-// The returned DB's Clean method must be called to clean up the
+-// generated database.
+-func NewDatabase(ctx context.Context, txtarReports []byte) (*DB, error) {
+- disk, err := ioutil.TempDir("", "vulndb-test")
+- if err != nil {
+- return nil, err
+- }
+- if err := generateDB(ctx, txtarReports, disk, false); err != nil {
+- os.RemoveAll(disk)
+- return nil, err
+- }
+-
+- return &DB{disk: disk}, nil
+-}
+-
+-// DB is a read-only vulnerability database on disk.
+-// Users can use this database with golang.org/x/vuln APIs
+-// by setting the `VULNDB“ environment variable.
+-type DB struct {
+- disk string
+-}
+-
+-// URI returns the file URI that can be used for VULNDB environment
+-// variable.
+-func (db *DB) URI() string {
+- u := span.URIFromPath(db.disk)
+- return string(u)
+-}
+-
+-// Clean deletes the database.
+-func (db *DB) Clean() error {
+- return os.RemoveAll(db.disk)
+-}
+-
+-// NewClient returns a vuln DB client that works with the given DB.
+-func NewClient(db *DB) (client.Client, error) {
+- return client.NewClient([]string{db.URI()}, client.Options{})
+-}
+-
+-//
+-// The following was selectively copied from golang.org/x/vulndb/internal/database
+-//
+-
+-const (
+- dbURL = "https://pkg.go.dev/vuln/"
+-
+- // idDirectory is the name of the directory that contains entries
+- // listed by their IDs.
+- idDirectory = "ID"
+-
+- // stdFileName is the name of the .json file in the vulndb repo
+- // that will contain info on standard library vulnerabilities.
+- stdFileName = "stdlib"
+-
+- // toolchainFileName is the name of the .json file in the vulndb repo
+- // that will contain info on toolchain (cmd/...) vulnerabilities.
+- toolchainFileName = "toolchain"
+-
+- // cmdModule is the name of the module containing Go toolchain
+- // binaries.
+- cmdModule = "cmd"
+-
+- // stdModule is the name of the module containing Go std packages.
+- stdModule = "std"
+-)
+-
+-// generateDB generates the file-based vuln DB in the directory jsonDir.
+-func generateDB(ctx context.Context, txtarData []byte, jsonDir string, indent bool) error {
+- archive := txtar.Parse(txtarData)
+-
+- jsonVulns, entries, err := generateEntries(ctx, archive)
+- if err != nil {
+- return err
+- }
+-
+- index := make(client.DBIndex, len(jsonVulns))
+- for modulePath, vulns := range jsonVulns {
+- epath, err := client.EscapeModulePath(modulePath)
+- if err != nil {
+- return err
+- }
+- if err := writeVulns(filepath.Join(jsonDir, epath), vulns, indent); err != nil {
+- return err
+- }
+- for _, v := range vulns {
+- if v.Modified.After(index[modulePath]) {
+- index[modulePath] = v.Modified
+- }
+- }
+- }
+- if err := writeJSON(filepath.Join(jsonDir, "index.json"), index, indent); err != nil {
+- return err
+- }
+- if err := writeAliasIndex(jsonDir, entries, indent); err != nil {
+- return err
+- }
+- return writeEntriesByID(filepath.Join(jsonDir, idDirectory), entries, indent)
+-}
+-
+-func generateEntries(_ context.Context, archive *txtar.Archive) (map[string][]osv.Entry, []osv.Entry, error) {
+- now := time.Now()
+- jsonVulns := map[string][]osv.Entry{}
+- var entries []osv.Entry
+- for _, f := range archive.Files {
+- if !strings.HasSuffix(f.Name, ".yaml") {
+- continue
+- }
+- r, err := readReport(bytes.NewReader(f.Data))
+- if err != nil {
+- return nil, nil, err
+- }
+- name := strings.TrimSuffix(filepath.Base(f.Name), filepath.Ext(f.Name))
+- linkName := fmt.Sprintf("%s%s", dbURL, name)
+- entry, modulePaths := generateOSVEntry(name, linkName, now, *r)
+- for _, modulePath := range modulePaths {
+- jsonVulns[modulePath] = append(jsonVulns[modulePath], entry)
+- }
+- entries = append(entries, entry)
+- }
+- return jsonVulns, entries, nil
+-}
+-
+-func writeVulns(outPath string, vulns []osv.Entry, indent bool) error {
+- if err := os.MkdirAll(filepath.Dir(outPath), 0755); err != nil {
+- return fmt.Errorf("failed to create directory %q: %s", filepath.Dir(outPath), err)
+- }
+- return writeJSON(outPath+".json", vulns, indent)
+-}
+-
+-func writeEntriesByID(idDir string, entries []osv.Entry, indent bool) error {
+- // Write a directory containing entries by ID.
+- if err := os.MkdirAll(idDir, 0755); err != nil {
+- return fmt.Errorf("failed to create directory %q: %v", idDir, err)
+- }
+- var idIndex []string
+- for _, e := range entries {
+- outPath := filepath.Join(idDir, e.ID+".json")
+- if err := writeJSON(outPath, e, indent); err != nil {
+- return err
+- }
+- idIndex = append(idIndex, e.ID)
+- }
+- // Write an index.json in the ID directory with a list of all the IDs.
+- return writeJSON(filepath.Join(idDir, "index.json"), idIndex, indent)
+-}
+-
+-// Write a JSON file containing a map from alias to GO IDs.
+-func writeAliasIndex(dir string, entries []osv.Entry, indent bool) error {
+- aliasToGoIDs := map[string][]string{}
+- for _, e := range entries {
+- for _, a := range e.Aliases {
+- aliasToGoIDs[a] = append(aliasToGoIDs[a], e.ID)
+- }
+- }
+- return writeJSON(filepath.Join(dir, "aliases.json"), aliasToGoIDs, indent)
+-}
+-
+-func writeJSON(filename string, value any, indent bool) (err error) {
+- j, err := jsonMarshal(value, indent)
+- if err != nil {
+- return err
+- }
+- return os.WriteFile(filename, j, 0644)
+-}
+-
+-func jsonMarshal(v any, indent bool) ([]byte, error) {
+- if indent {
+- return json.MarshalIndent(v, "", " ")
+- }
+- return json.Marshal(v)
+-}
+-
+-// generateOSVEntry create an osv.Entry for a report. In addition to the report, it
+-// takes the ID for the vuln and a URL that will point to the entry in the vuln DB.
+-// It returns the osv.Entry and a list of module paths that the vuln affects.
+-func generateOSVEntry(id, url string, lastModified time.Time, r Report) (osv.Entry, []string) {
+- entry := osv.Entry{
+- ID: id,
+- Published: r.Published,
+- Modified: lastModified,
+- Withdrawn: r.Withdrawn,
+- Details: r.Description,
+- }
+-
+- moduleMap := make(map[string]bool)
+- for _, m := range r.Modules {
+- switch m.Module {
+- case stdModule:
+- moduleMap[stdFileName] = true
+- case cmdModule:
+- moduleMap[toolchainFileName] = true
+- default:
+- moduleMap[m.Module] = true
+- }
+- entry.Affected = append(entry.Affected, generateAffected(m, url))
+- }
+- for _, ref := range r.References {
+- entry.References = append(entry.References, osv.Reference{
+- Type: string(ref.Type),
+- URL: ref.URL,
+- })
+- }
+-
+- var modulePaths []string
+- for module := range moduleMap {
+- modulePaths = append(modulePaths, module)
+- }
+- // TODO: handle missing fields - Aliases
+-
+- return entry, modulePaths
+-}
+-
+-func generateAffectedRanges(versions []VersionRange) osv.Affects {
+- a := osv.AffectsRange{Type: osv.TypeSemver}
+- if len(versions) == 0 || versions[0].Introduced == "" {
+- a.Events = append(a.Events, osv.RangeEvent{Introduced: "0"})
+- }
+- for _, v := range versions {
+- if v.Introduced != "" {
+- a.Events = append(a.Events, osv.RangeEvent{Introduced: v.Introduced.Canonical()})
+- }
+- if v.Fixed != "" {
+- a.Events = append(a.Events, osv.RangeEvent{Fixed: v.Fixed.Canonical()})
+- }
+- }
+- return osv.Affects{a}
+-}
+-
+-func generateImports(m *Module) (imps []osv.EcosystemSpecificImport) {
+- for _, p := range m.Packages {
+- syms := append([]string{}, p.Symbols...)
+- syms = append(syms, p.DerivedSymbols...)
+- sort.Strings(syms)
+- imps = append(imps, osv.EcosystemSpecificImport{
+- Path: p.Package,
+- GOOS: p.GOOS,
+- GOARCH: p.GOARCH,
+- Symbols: syms,
+- })
+- }
+- return imps
+-}
+-func generateAffected(m *Module, url string) osv.Affected {
+- name := m.Module
+- switch name {
+- case stdModule:
+- name = "stdlib"
+- case cmdModule:
+- name = "toolchain"
+- }
+- return osv.Affected{
+- Package: osv.Package{
+- Name: name,
+- Ecosystem: osv.GoEcosystem,
+- },
+- Ranges: generateAffectedRanges(m.Versions),
+- DatabaseSpecific: osv.DatabaseSpecific{URL: url},
+- EcosystemSpecific: osv.EcosystemSpecific{
+- Imports: generateImports(m),
+- },
+- }
+-}
+diff -urN a/gopls/internal/vulncheck/vulntest/db_test.go b/gopls/internal/vulncheck/vulntest/db_test.go
+--- a/gopls/internal/vulncheck/vulntest/db_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/vulncheck/vulntest/db_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,61 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package vulntest
+-
+-import (
+- "context"
+- "encoding/json"
+- "testing"
+-)
+-
+-func TestNewDatabase(t *testing.T) {
+- ctx := context.Background()
+- in := []byte(`
+--- GO-2020-0001.yaml --
+-modules:
+- - module: github.com/gin-gonic/gin
+- versions:
+- - fixed: 1.6.0
+- packages:
+- - package: github.com/gin-gonic/gin
+- symbols:
+- - defaultLogFormatter
+-description: |
+- Something.
+-published: 2021-04-14T20:04:52Z
+-references:
+- - fix: https://github.com/gin-gonic/gin/pull/2237
+-`)
+-
+- db, err := NewDatabase(ctx, in)
+- if err != nil {
+- t.Fatal(err)
+- }
+- defer db.Clean()
+-
+- cli, err := NewClient(db)
+- if err != nil {
+- t.Fatal(err)
+- }
+- got, err := cli.GetByID(ctx, "GO-2020-0001")
+- if err != nil {
+- t.Fatal(err)
+- }
+- if got.ID != "GO-2020-0001" {
+- m, _ := json.Marshal(got)
+- t.Errorf("got %s\nwant GO-2020-0001 entry", m)
+- }
+- gotAll, err := cli.GetByModule(ctx, "github.com/gin-gonic/gin")
+- if err != nil {
+- t.Fatal(err)
+- }
+- if len(gotAll) != 1 || gotAll[0].ID != "GO-2020-0001" {
+- m, _ := json.Marshal(got)
+- t.Errorf("got %s\nwant GO-2020-0001 entry", m)
+- }
+-}
+diff -urN a/gopls/internal/vulncheck/vulntest/report.go b/gopls/internal/vulncheck/vulntest/report.go
+--- a/gopls/internal/vulncheck/vulntest/report.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/vulncheck/vulntest/report.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,176 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package vulntest
+-
+-import (
+- "fmt"
+- "io"
+- "os"
+- "strings"
+- "time"
+-
+- "golang.org/x/mod/semver"
+- "gopkg.in/yaml.v3"
+-)
+-
+-//
+-// The following was selectively copied from golang.org/x/vulndb/internal/report
+-//
+-
+-// readReport reads a Report in YAML format.
+-func readReport(in io.Reader) (*Report, error) {
+- d := yaml.NewDecoder(in)
+- // Require that all fields in the file are in the struct.
+- // This corresponds to v2's UnmarshalStrict.
+- d.KnownFields(true)
+- var r Report
+- if err := d.Decode(&r); err != nil {
+- return nil, fmt.Errorf("yaml.Decode: %v", err)
+- }
+- return &r, nil
+-}
+-
+-// Report represents a vulnerability report in the vulndb.
+-// Remember to update doc/format.md when this structure changes.
+-type Report struct {
+- Modules []*Module `yaml:",omitempty"`
+-
+- // Description is the CVE description from an existing CVE. If we are
+- // assigning a CVE ID ourselves, use CVEMetadata.Description instead.
+- Description string `yaml:",omitempty"`
+- Published time.Time `yaml:",omitempty"`
+- Withdrawn *time.Time `yaml:",omitempty"`
+-
+- References []*Reference `yaml:",omitempty"`
+-}
+-
+-// Write writes r to filename in YAML format.
+-func (r *Report) Write(filename string) (err error) {
+- f, err := os.Create(filename)
+- if err != nil {
+- return err
+- }
+- err = r.encode(f)
+- err2 := f.Close()
+- if err == nil {
+- err = err2
+- }
+- return err
+-}
+-
+-// ToString encodes r to a YAML string.
+-func (r *Report) ToString() (string, error) {
+- var b strings.Builder
+- if err := r.encode(&b); err != nil {
+- return "", err
+- }
+- return b.String(), nil
+-}
+-
+-func (r *Report) encode(w io.Writer) error {
+- e := yaml.NewEncoder(w)
+- defer e.Close()
+- e.SetIndent(4)
+- return e.Encode(r)
+-}
+-
+-type VersionRange struct {
+- Introduced Version `yaml:"introduced,omitempty"`
+- Fixed Version `yaml:"fixed,omitempty"`
+-}
+-
+-type Module struct {
+- Module string `yaml:",omitempty"`
+- Versions []VersionRange `yaml:",omitempty"`
+- Packages []*Package `yaml:",omitempty"`
+-}
+-
+-type Package struct {
+- Package string `yaml:",omitempty"`
+- GOOS []string `yaml:"goos,omitempty"`
+- GOARCH []string `yaml:"goarch,omitempty"`
+- // Symbols originally identified as vulnerable.
+- Symbols []string `yaml:",omitempty"`
+- // Additional vulnerable symbols, computed from Symbols via static analysis
+- // or other technique.
+- DerivedSymbols []string `yaml:"derived_symbols,omitempty"`
+-}
+-
+-// Version is an SemVer 2.0.0 semantic version with no leading "v" prefix,
+-// as used by OSV.
+-type Version string
+-
+-// V returns the version with a "v" prefix.
+-func (v Version) V() string {
+- return "v" + string(v)
+-}
+-
+-// IsValid reports whether v is a valid semantic version string.
+-func (v Version) IsValid() bool {
+- return semver.IsValid(v.V())
+-}
+-
+-// Before reports whether v < v2.
+-func (v Version) Before(v2 Version) bool {
+- return semver.Compare(v.V(), v2.V()) < 0
+-}
+-
+-// Canonical returns the canonical formatting of the version.
+-func (v Version) Canonical() string {
+- return strings.TrimPrefix(semver.Canonical(v.V()), "v")
+-}
+-
+-// Reference type is a reference (link) type.
+-type ReferenceType string
+-
+-const (
+- ReferenceTypeAdvisory = ReferenceType("ADVISORY")
+- ReferenceTypeArticle = ReferenceType("ARTICLE")
+- ReferenceTypeReport = ReferenceType("REPORT")
+- ReferenceTypeFix = ReferenceType("FIX")
+- ReferenceTypePackage = ReferenceType("PACKAGE")
+- ReferenceTypeEvidence = ReferenceType("EVIDENCE")
+- ReferenceTypeWeb = ReferenceType("WEB")
+-)
+-
+-// ReferenceTypes is the set of reference types defined in OSV.
+-var ReferenceTypes = []ReferenceType{
+- ReferenceTypeAdvisory,
+- ReferenceTypeArticle,
+- ReferenceTypeReport,
+- ReferenceTypeFix,
+- ReferenceTypePackage,
+- ReferenceTypeEvidence,
+- ReferenceTypeWeb,
+-}
+-
+-// A Reference is a link to some external resource.
+-//
+-// For ease of typing, References are represented in the YAML as a
+-// single-element mapping of type to URL.
+-type Reference struct {
+- Type ReferenceType `json:"type,omitempty"`
+- URL string `json:"url,omitempty"`
+-}
+-
+-func (r *Reference) MarshalYAML() (interface{}, error) {
+- return map[string]string{
+- strings.ToLower(string(r.Type)): r.URL,
+- }, nil
+-}
+-
+-func (r *Reference) UnmarshalYAML(n *yaml.Node) (err error) {
+- if n.Kind != yaml.MappingNode || len(n.Content) != 2 || n.Content[0].Kind != yaml.ScalarNode || n.Content[1].Kind != yaml.ScalarNode {
+- return &yaml.TypeError{Errors: []string{
+- fmt.Sprintf("line %d: report.Reference must contain a mapping with one value", n.Line),
+- }}
+- }
+- r.Type = ReferenceType(strings.ToUpper(n.Content[0].Value))
+- r.URL = n.Content[1].Value
+- return nil
+-}
+diff -urN a/gopls/internal/vulncheck/vulntest/report_test.go b/gopls/internal/vulncheck/vulntest/report_test.go
+--- a/gopls/internal/vulncheck/vulntest/report_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/vulncheck/vulntest/report_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,52 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package vulntest
+-
+-import (
+- "bytes"
+- "io"
+- "io/ioutil"
+- "os"
+- "path/filepath"
+- "testing"
+-
+- "github.com/google/go-cmp/cmp"
+-)
+-
+-func readAll(t *testing.T, filename string) io.Reader {
+- d, err := ioutil.ReadFile(filename)
+- if err != nil {
+- t.Fatal(err)
+- }
+- return bytes.NewReader(d)
+-}
+-
+-func TestRoundTrip(t *testing.T) {
+- // A report shouldn't change after being read and then written.
+- in := filepath.Join("testdata", "report.yaml")
+- r, err := readReport(readAll(t, in))
+- if err != nil {
+- t.Fatal(err)
+- }
+- out := filepath.Join(t.TempDir(), "report.yaml")
+- if err := r.Write(out); err != nil {
+- t.Fatal(err)
+- }
+-
+- want, err := os.ReadFile(in)
+- if err != nil {
+- t.Fatal(err)
+- }
+- got, err := os.ReadFile(out)
+- if err != nil {
+- t.Fatal(err)
+- }
+- if diff := cmp.Diff(want, got); diff != "" {
+- t.Errorf("mismatch (-want, +got):\n%s", diff)
+- }
+-}
+diff -urN a/gopls/internal/vulncheck/vulntest/stdlib.go b/gopls/internal/vulncheck/vulntest/stdlib.go
+--- a/gopls/internal/vulncheck/vulntest/stdlib.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/vulncheck/vulntest/stdlib.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,26 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package vulntest
+-
+-import (
+- "strings"
+-
+- "golang.org/x/mod/module"
+-)
+-
+-// maybeStdlib reports whether the given import path could be part of the Go
+-// standard library, by reporting whether the first component lacks a '.'.
+-func maybeStdlib(path string) bool {
+- if err := module.CheckImportPath(path); err != nil {
+- return false
+- }
+- if i := strings.IndexByte(path, '/'); i != -1 {
+- path = path[:i]
+- }
+- return !strings.Contains(path, ".")
+-}
+diff -urN a/gopls/internal/vulncheck/vulntest/stdlib_test.go b/gopls/internal/vulncheck/vulntest/stdlib_test.go
+--- a/gopls/internal/vulncheck/vulntest/stdlib_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/vulncheck/vulntest/stdlib_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,27 +0,0 @@
+-// Copyright 2022 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-//go:build go1.18
+-// +build go1.18
+-
+-package vulntest
+-
+-import "testing"
+-
+-func TestMaybeStdlib(t *testing.T) {
+- for _, test := range []struct {
+- in string
+- want bool
+- }{
+- {"", false},
+- {"math/crypto", true},
+- {"github.com/pkg/errors", false},
+- {"Path is unknown", false},
+- } {
+- got := maybeStdlib(test.in)
+- if got != test.want {
+- t.Errorf("%q: got %t, want %t", test.in, got, test.want)
+- }
+- }
+-}
+diff -urN a/gopls/internal/vulncheck/vulntest/testdata/report.yaml b/gopls/internal/vulncheck/vulntest/testdata/report.yaml
+--- a/gopls/internal/vulncheck/vulntest/testdata/report.yaml 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/internal/vulncheck/vulntest/testdata/report.yaml 1970-01-01 00:00:00.000000000 +0000
+@@ -1,15 +0,0 @@
+-modules:
+- - module: github.com/gin-gonic/gin
+- versions:
+- - fixed: 1.6.0
+- packages:
+- - package: github.com/gin-gonic/gin
+- symbols:
+- - defaultLogFormatter
+-description: |
+- The default Formatter for the Logger middleware (LoggerConfig.Formatter),
+- which is included in the Default engine, allows attackers to inject arbitrary
+- log entries by manipulating the request path.
+-references:
+- - fix: https://github.com/gin-gonic/gin/pull/1234
+- - fix: https://github.com/gin-gonic/gin/commit/abcdefg
+diff -urN a/gopls/main.go b/gopls/main.go
+--- a/gopls/main.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/main.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,33 +0,0 @@
+-// Copyright 2019 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-// Gopls (pronounced “go please”) is an LSP server for Go.
+-// The Language Server Protocol allows any text editor
+-// to be extended with IDE-like features;
+-// see https://langserver.org/ for details.
+-//
+-// See https://github.com/golang/tools/blob/master/gopls/README.md
+-// for the most up-to-date documentation.
+-package main // import "golang.org/x/tools/gopls"
+-
+-//go:generate go run doc/generate.go
+-
+-import (
+- "context"
+- "golang.org/x/tools/internal/analysisinternal"
+- "os"
+-
+- "golang.org/x/tools/gopls/internal/hooks"
+- "golang.org/x/tools/gopls/internal/lsp/cmd"
+- "golang.org/x/tools/internal/tool"
+-)
+-
+-func main() {
+- // In 1.18, diagnostics for Fuzz tests must not be used by cmd/vet.
+- // So the code for Fuzz tests diagnostics is guarded behind flag analysisinternal.DiagnoseFuzzTests
+- // Turn on analysisinternal.DiagnoseFuzzTests for gopls
+- analysisinternal.DiagnoseFuzzTests = true
+- ctx := context.Background()
+- tool.Main(ctx, cmd.New("gopls", "", nil, hooks.Options), os.Args[1:])
+-}
+diff -urN a/gopls/README.md b/gopls/README.md
+--- a/gopls/README.md 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/README.md 1970-01-01 00:00:00.000000000 +0000
+@@ -1,131 +0,0 @@
+-# `gopls`, the Go language server
+-
+-[![PkgGoDev](https://pkg.go.dev/badge/golang.org/x/tools/gopls)](https://pkg.go.dev/golang.org/x/tools/gopls)
+-
+-`gopls` (pronounced "Go please") is the official Go [language server] developed
+-by the Go team. It provides IDE features to any [LSP]-compatible editor.
+-
+-<!--TODO(rfindley): Add gifs here.-->
+-
+-You should not need to interact with `gopls` directly--it will be automatically
+-integrated into your editor. The specific features and settings vary slightly
+-by editor, so we recommend that you proceed to the
+-[documentation for your editor](#editors) below.
+-
+-## Editors
+-
+-To get started with `gopls`, install an LSP plugin in your editor of choice.
+-
+-* [VS Code](https://github.com/golang/vscode-go/blob/master/README.md)
+-* [Vim / Neovim](doc/vim.md)
+-* [Emacs](doc/emacs.md)
+-* [Atom](https://github.com/MordFustang21/ide-gopls)
+-* [Sublime Text](doc/subl.md)
+-* [Acme](https://github.com/fhs/acme-lsp)
+-* [Lapce](https://github.com/lapce-community/lapce-go)
+-
+-If you use `gopls` with an editor that is not on this list, please send us a CL
+-[updating this documentation](doc/contributing.md).
+-
+-## Installation
+-
+-For the most part, you should not need to install or update `gopls`. Your
+-editor should handle that step for you.
+-
+-If you do want to get the latest stable version of `gopls`, run the following
+-command:
+-
+-```sh
+-go install golang.org/x/tools/gopls@latest
+-```
+-
+-Learn more in the
+-[advanced installation instructions](doc/advanced.md#installing-unreleased-versions).
+-
+-Learn more about gopls releases in the [release policy](doc/releases.md).
+-
+-## Setting up your workspace
+-
+-`gopls` supports both Go module, multi-module and GOPATH modes. See the
+-[workspace documentation](doc/workspace.md) for information on supported
+-workspace layouts.
+-
+-## Configuration
+-
+-You can configure `gopls` to change your editor experience or view additional
+-debugging information. Configuration options will be made available by your
+-editor, so see your [editor's instructions](#editors) for specific details. A
+-full list of `gopls` settings can be found in the [settings documentation](doc/settings.md).
+-
+-### Environment variables
+-
+-`gopls` inherits your editor's environment, so be aware of any environment
+-variables you configure. Some editors, such as VS Code, allow users to
+-selectively override the values of some environment variables.
+-
+-## Support Policy
+-
+-Gopls is maintained by engineers on the
+-[Go tools team](https://github.com/orgs/golang/teams/tools-team/members),
+-who actively monitor the
+-[Go](https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+label%3Agopls)
+-and
+-[VS Code Go](https://github.com/golang/vscode-go/issues) issue trackers.
+-
+-### Supported Go versions
+-
+-`gopls` follows the
+-[Go Release Policy](https://golang.org/doc/devel/release.html#policy),
+-meaning that it officially supports the last 2 major Go releases. Per
+-[issue #39146](https://go.dev/issues/39146), we attempt to maintain best-effort
+-support for the last 4 major Go releases, but this support extends only to not
+-breaking the build and avoiding easily fixable regressions.
+-
+-In the context of this discussion, gopls "supports" a Go version if it supports
+-being built with that Go version as well as integrating with the `go` command
+-of that Go version.
+-
+-The following table shows the final gopls version that supports a given Go
+-version. Go releases more recent than any in the table can be used with any
+-version of gopls.
+-
+-| Go Version | Final gopls version with support (without warnings) |
+-| ----------- | --------------------------------------------------- |
+-| Go 1.12 | [gopls@v0.7.5](https://github.com/golang/tools/releases/tag/gopls%2Fv0.7.5) |
+-| Go 1.15 | [gopls@v0.9.5](https://github.com/golang/tools/releases/tag/gopls%2Fv0.9.5) |
+-
+-Our extended support is enforced via [continuous integration with older Go
+-versions](doc/contributing.md#ci). This legacy Go CI may not block releases:
+-test failures may be skipped rather than fixed. Furthermore, if a regression in
+-an older Go version causes irreconcilable CI failures, we may drop support for
+-that Go version in CI if it is 3 or 4 Go versions old.
+-
+-### Supported build systems
+-
+-`gopls` currently only supports the `go` command, so if you are using
+-a different build system, `gopls` will not work well. Bazel is not officially
+-supported, but may be made to work with an appropriately configured
+-`go/packages` driver. See
+-[bazelbuild/rules_go#512](https://github.com/bazelbuild/rules_go/issues/512)
+-for more information.
+-You can follow [these instructions](https://github.com/bazelbuild/rules_go/wiki/Editor-setup)
+-to configure your `gopls` to work with Bazel.
+-
+-### Troubleshooting
+-
+-If you are having issues with `gopls`, please follow the steps described in the
+-[troubleshooting guide](doc/troubleshooting.md).
+-
+-## Additional information
+-
+-* [Features](doc/features.md)
+-* [Command-line interface](doc/command-line.md)
+-* [Advanced topics](doc/advanced.md)
+-* [Contributing to `gopls`](doc/contributing.md)
+-* [Integrating `gopls` with an editor](doc/design/integrating.md)
+-* [Design requirements and decisions](doc/design/design.md)
+-* [Implementation details](doc/design/implementation.md)
+-* [Open issues](https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+label%3Agopls)
+-
+-[language server]: https://langserver.org
+-[LSP]: https://microsoft.github.io/language-server-protocol/
+diff -urN a/gopls/release/release.go b/gopls/release/release.go
+--- a/gopls/release/release.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/release/release.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,156 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-//
+-// Package release checks that the a given version of gopls is ready for
+-// release. It can also tag and publish the release.
+-//
+-// To run:
+-//
+-// $ cd $GOPATH/src/golang.org/x/tools/gopls
+-// $ go run release/release.go -version=<version>
+-package main
+-
+-import (
+- "flag"
+- "fmt"
+- "go/types"
+- "io/ioutil"
+- "log"
+- "os"
+- "path/filepath"
+- "strconv"
+- "strings"
+-
+- exec "golang.org/x/sys/execabs"
+-
+- "golang.org/x/mod/modfile"
+- "golang.org/x/mod/semver"
+- "golang.org/x/tools/go/packages"
+-)
+-
+-var versionFlag = flag.String("version", "", "version to tag")
+-
+-func main() {
+- flag.Parse()
+-
+- if *versionFlag == "" {
+- log.Fatalf("must provide -version flag")
+- }
+- if !semver.IsValid(*versionFlag) {
+- log.Fatalf("invalid version %s", *versionFlag)
+- }
+- if semver.Major(*versionFlag) != "v0" {
+- log.Fatalf("expected major version v0, got %s", semver.Major(*versionFlag))
+- }
+- if semver.Build(*versionFlag) != "" {
+- log.Fatalf("unexpected build suffix: %s", *versionFlag)
+- }
+- // Validate that the user is running the program from the gopls module.
+- wd, err := os.Getwd()
+- if err != nil {
+- log.Fatal(err)
+- }
+- if filepath.Base(wd) != "gopls" {
+- log.Fatalf("must run from the gopls module")
+- }
+- // Confirm that they have updated the hardcoded version.
+- if err := validateHardcodedVersion(*versionFlag); err != nil {
+- log.Fatal(err)
+- }
+- // Confirm that the versions in the go.mod file are correct.
+- if err := validateGoModFile(wd); err != nil {
+- log.Fatal(err)
+- }
+- fmt.Println("Validated that the release is ready.")
+- os.Exit(0)
+-}
+-
+-// validateHardcodedVersion reports whether the version hardcoded in the gopls
+-// binary is equivalent to the version being published. It reports an error if
+-// not.
+-func validateHardcodedVersion(version string) error {
+- const debugPkg = "golang.org/x/tools/gopls/internal/lsp/debug"
+- pkgs, err := packages.Load(&packages.Config{
+- Mode: packages.NeedName | packages.NeedFiles |
+- packages.NeedCompiledGoFiles | packages.NeedImports |
+- packages.NeedTypes | packages.NeedTypesSizes,
+- }, debugPkg)
+- if err != nil {
+- return err
+- }
+- if len(pkgs) != 1 {
+- return fmt.Errorf("expected 1 package, got %v", len(pkgs))
+- }
+- pkg := pkgs[0]
+- if len(pkg.Errors) > 0 {
+- return fmt.Errorf("failed to load %q: first error: %w", debugPkg, pkg.Errors[0])
+- }
+- obj := pkg.Types.Scope().Lookup("Version")
+- c, ok := obj.(*types.Const)
+- if !ok {
+- return fmt.Errorf("no constant named Version")
+- }
+- hardcodedVersion, err := strconv.Unquote(c.Val().ExactString())
+- if err != nil {
+- return err
+- }
+- if semver.Prerelease(hardcodedVersion) != "" {
+- return fmt.Errorf("unexpected pre-release for hardcoded version: %s", hardcodedVersion)
+- }
+- // Don't worry about pre-release tags and expect that there is no build
+- // suffix.
+- version = strings.TrimSuffix(version, semver.Prerelease(version))
+- if hardcodedVersion != version {
+- return fmt.Errorf("expected version to be %s, got %s", *versionFlag, hardcodedVersion)
+- }
+- return nil
+-}
+-
+-func validateGoModFile(goplsDir string) error {
+- filename := filepath.Join(goplsDir, "go.mod")
+- data, err := ioutil.ReadFile(filename)
+- if err != nil {
+- return err
+- }
+- gomod, err := modfile.Parse(filename, data, nil)
+- if err != nil {
+- return err
+- }
+- // Confirm that there is no replace directive in the go.mod file.
+- if len(gomod.Replace) > 0 {
+- return fmt.Errorf("expected no replace directives, got %v", len(gomod.Replace))
+- }
+- // Confirm that the version of x/tools in the gopls/go.mod file points to
+- // the second-to-last commit. (The last commit will be the one to update the
+- // go.mod file.)
+- cmd := exec.Command("git", "rev-parse", "@~")
+- stdout, err := cmd.Output()
+- if err != nil {
+- return err
+- }
+- hash := string(stdout)
+- // Find the golang.org/x/tools require line and compare the versions.
+- var version string
+- for _, req := range gomod.Require {
+- if req.Mod.Path == "golang.org/x/tools" {
+- version = req.Mod.Version
+- break
+- }
+- }
+- if version == "" {
+- return fmt.Errorf("no require for golang.org/x/tools")
+- }
+- split := strings.Split(version, "-")
+- if len(split) != 3 {
+- return fmt.Errorf("unexpected pseudoversion format %s", version)
+- }
+- last := split[len(split)-1]
+- if last == "" {
+- return fmt.Errorf("unexpected pseudoversion format %s", version)
+- }
+- if !strings.HasPrefix(hash, last) {
+- return fmt.Errorf("golang.org/x/tools pseudoversion should be at commit %s, instead got %s", hash, last)
+- }
+- return nil
+-}
+diff -urN a/gopls/test/debug/debug_test.go b/gopls/test/debug/debug_test.go
+--- a/gopls/test/debug/debug_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/test/debug/debug_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,141 +0,0 @@
+-// Copyright 2020 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package debug_test
+-
+-// Provide 'static type checking' of the templates. This guards against changes is various
+-// gopls datastructures causing template execution to fail. The checking is done by
+-// the github.com/jba/templatecheck package. Before that is run, the test checks that
+-// its list of templates and their arguments corresponds to the arguments in
+-// calls to render(). The test assumes that all uses of templates are done through render().
+-
+-import (
+- "go/ast"
+- "html/template"
+- "runtime"
+- "sort"
+- "strings"
+- "testing"
+-
+- "github.com/jba/templatecheck"
+- "golang.org/x/tools/go/packages"
+- "golang.org/x/tools/gopls/internal/lsp/cache"
+- "golang.org/x/tools/gopls/internal/lsp/debug"
+-)
+-
+-var templates = map[string]struct {
+- tmpl *template.Template
+- data interface{} // a value of the needed type
+-}{
+- "MainTmpl": {debug.MainTmpl, &debug.Instance{}},
+- "DebugTmpl": {debug.DebugTmpl, nil},
+- "RPCTmpl": {debug.RPCTmpl, &debug.Rpcs{}},
+- "TraceTmpl": {debug.TraceTmpl, debug.TraceResults{}},
+- "CacheTmpl": {debug.CacheTmpl, &cache.Cache{}},
+- "SessionTmpl": {debug.SessionTmpl, &cache.Session{}},
+- "ViewTmpl": {debug.ViewTmpl, &cache.View{}},
+- "ClientTmpl": {debug.ClientTmpl, &debug.Client{}},
+- "ServerTmpl": {debug.ServerTmpl, &debug.Server{}},
+- "FileTmpl": {debug.FileTmpl, &cache.Overlay{}},
+- "InfoTmpl": {debug.InfoTmpl, "something"},
+- "MemoryTmpl": {debug.MemoryTmpl, runtime.MemStats{}},
+-}
+-
+-func TestTemplates(t *testing.T) {
+- if runtime.GOOS == "android" {
+- t.Skip("this test is not supported for Android")
+- }
+- cfg := &packages.Config{
+- Mode: packages.NeedTypesInfo | packages.LoadAllSyntax, // figure out what's necessary PJW
+- }
+- pkgs, err := packages.Load(cfg, "golang.org/x/tools/gopls/internal/lsp/debug")
+- if err != nil {
+- t.Fatal(err)
+- }
+- if len(pkgs) != 1 {
+- t.Fatalf("expected a single package, but got %d", len(pkgs))
+- }
+- p := pkgs[0]
+- if len(p.Errors) != 0 {
+- t.Fatalf("compiler error, e.g. %v", p.Errors[0])
+- }
+- // find the calls to render in serve.go
+- tree := treeOf(p, "serve.go")
+- if tree == nil {
+- t.Fatalf("found no syntax tree for %s", "serve.go")
+- }
+- renders := callsOf(p, tree, "render")
+- if len(renders) == 0 {
+- t.Fatalf("found no calls to render")
+- }
+- var found = make(map[string]bool)
+- for _, r := range renders {
+- if len(r.Args) != 2 {
+- // template, func
+- t.Fatalf("got %d args, expected 2", len(r.Args))
+- }
+- t0, ok := p.TypesInfo.Types[r.Args[0]]
+- if !ok || !t0.IsValue() || t0.Type.String() != "*html/template.Template" {
+- t.Fatalf("no type info for template")
+- }
+- if id, ok := r.Args[0].(*ast.Ident); !ok {
+- t.Errorf("expected *ast.Ident, got %T", r.Args[0])
+- } else {
+- found[id.Name] = true
+- }
+- }
+- // make sure found and templates have the same templates
+- for k := range found {
+- if _, ok := templates[k]; !ok {
+- t.Errorf("code has template %s, but test does not", k)
+- }
+- }
+- for k := range templates {
+- if _, ok := found[k]; !ok {
+- t.Errorf("test has template %s, code does not", k)
+- }
+- }
+- // now check all the known templates, in alphabetic order, for determinacy
+- keys := []string{}
+- for k := range templates {
+- keys = append(keys, k)
+- }
+- sort.Strings(keys)
+- for _, k := range keys {
+- v := templates[k]
+- // the FuncMap is an annoyance; should not be necessary
+- if err := templatecheck.CheckHTML(v.tmpl, v.data); err != nil {
+- t.Errorf("%s: %v", k, err)
+- }
+- }
+-}
+-
+-func callsOf(p *packages.Package, tree *ast.File, name string) []*ast.CallExpr {
+- var ans []*ast.CallExpr
+- f := func(n ast.Node) bool {
+- x, ok := n.(*ast.CallExpr)
+- if !ok {
+- return true
+- }
+- if y, ok := x.Fun.(*ast.Ident); ok {
+- if y.Name == name {
+- ans = append(ans, x)
+- }
+- }
+- return true
+- }
+- ast.Inspect(tree, f)
+- return ans
+-}
+-
+-func treeOf(p *packages.Package, fname string) *ast.File {
+- for _, tree := range p.Syntax {
+- loc := tree.Package
+- pos := p.Fset.PositionFor(loc, false)
+- if strings.HasSuffix(pos.Filename, fname) {
+- return tree
+- }
+- }
+- return nil
+-}
+diff -urN a/gopls/test/json_test.go b/gopls/test/json_test.go
+--- a/gopls/test/json_test.go 2000-01-01 00:00:00.000000000 -0000
++++ b/gopls/test/json_test.go 1970-01-01 00:00:00.000000000 +0000
+@@ -1,140 +0,0 @@
+-// Copyright 2021 The Go Authors. All rights reserved.
+-// Use of this source code is governed by a BSD-style
+-// license that can be found in the LICENSE file.
+-
+-package gopls_test
+-
+-import (
+- "encoding/json"
+- "fmt"
+- "regexp"
+- "strings"
+- "testing"
+-
+- "github.com/google/go-cmp/cmp"
+- "golang.org/x/tools/gopls/internal/lsp/protocol"
+-)
+-
+-// verify that type errors in Initialize lsp messages don't cause
+-// any other unmarshalling errors. The code looks at single values and the
+-// first component of array values. Each occurrence is replaced by something
+-// of a different type, the resulting string unmarshalled, and compared to
+-// the unmarshalling of the unchanged strings. The test passes if there is no
+-// more than a single difference reported. That is, if changing a single value
+-// in the message changes no more than a single value in the unmarshalled struct,
+-// it is safe to ignore *json.UnmarshalTypeError.
+-
+-// strings are changed to numbers or bools (true)
+-// bools are changed to numbers or strings
+-// numbers are changed to strings or bools
+-
+-// a recent Initialize message taken from a log (at some point
+-// some field incompatibly changed from bool to int32)
+-const input = `{"processId":46408,"clientInfo":{"name":"Visual Studio Code - Insiders","version":"1.76.0-insider"},"locale":"en-us","rootPath":"/Users/pjw/hakim","rootUri":"file:///Users/pjw/hakim","capabilities":{"workspace":{"applyEdit":true,"workspaceEdit":{"documentChanges":true,"resourceOperations":["create","rename","delete"],"failureHandling":"textOnlyTransactional","normalizesLineEndings":true,"changeAnnotationSupport":{"groupsOnLabel":true}},"configuration":true,"didChangeWatchedFiles":{"dynamicRegistration":true,"relativePatternSupport":true},"symbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"tagSupport":{"valueSet":[1]},"resolveSupport":{"properties":["location.range"]}},"codeLens":{"refreshSupport":true},"executeCommand":{"dynamicRegistration":true},"didChangeConfiguration":{"dynamicRegistration":true},"workspaceFolders":true,"semanticTokens":{"refreshSupport":true},"fileOperations":{"dynamicRegistration":true,"didCreate":true,"didRename":true,"didDelete":true,"willCreate":true,"willRename":true,"willDelete":true},"inlineValue":{"refreshSupport":true},"inlayHint":{"refreshSupport":true},"diagnostics":{"refreshSupport":true}},"textDocument":{"publishDiagnostics":{"relatedInformation":true,"versionSupport":false,"tagSupport":{"valueSet":[1,2]},"codeDescriptionSupport":true,"dataSupport":true},"synchronization":{"dynamicRegistration":true,"willSave":true,"willSaveWaitUntil":true,"didSave":true},"completion":{"dynamicRegistration":true,"contextSupport":true,"completionItem":{"snippetSupport":true,"commitCharactersSupport":true,"documentationFormat":["markdown","plaintext"],"deprecatedSupport":true,"preselectSupport":true,"tagSupport":{"valueSet":[1]},"insertReplaceSupport":true,"resolveSupport":{"properties":["documentation","detail","additionalTextEdits"]},"insertTextModeSupport":{"valueSet":[1,2]},"labelDetailsSupport":true},"insertTextMode":2,"completionItemKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25]},"completionList":{"itemDefaults":["commitCharacters","editRange","insertTextFormat","insertTextMode"]}},"hover":{"dynamicRegistration":true,"contentFormat":["markdown","plaintext"]},"signatureHelp":{"dynamicRegistration":true,"signatureInformation":{"documentationFormat":["markdown","plaintext"],"parameterInformation":{"labelOffsetSupport":true},"activeParameterSupport":true},"contextSupport":true},"definition":{"dynamicRegistration":true,"linkSupport":true},"references":{"dynamicRegistration":true},"documentHighlight":{"dynamicRegistration":true},"documentSymbol":{"dynamicRegistration":true,"symbolKind":{"valueSet":[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26]},"hierarchicalDocumentSymbolSupport":true,"tagSupport":{"valueSet":[1]},"labelSupport":true},"codeAction":{"dynamicRegistration":true,"isPreferredSupport":true,"disabledSupport":true,"dataSupport":true,"resolveSupport":{"properties":["edit"]},"codeActionLiteralSupport":{"codeActionKind":{"valueSet":["","quickfix","refactor","refactor.extract","refactor.inline","refactor.rewrite","source","source.organizeImports"]}},"honorsChangeAnnotations":false},"codeLens":{"dynamicRegistration":true},"formatting":{"dynamicRegistration":true},"rangeFormatting":{"dynamicRegistration":true},"onTypeFormatting":{"dynamicRegistration":true},"rename":{"dynamicRegistration":true,"prepareSupport":true,"prepareSupportDefaultBehavior":1,"honorsChangeAnnotations":true},"documentLink":{"dynamicRegistration":true,"tooltipSupport":true},"typeDefinition":{"dynamicRegistration":true,"linkSupport":true},"implementation":{"dynamicRegistration":true,"linkSupport":true},"colorProvider":{"dynamicRegistration":true},"foldingRange":{"dynamicRegistration":true,"rangeLimit":5000,"lineFoldingOnly":true,"foldingRangeKind":{"valueSet":["comment","imports","region"]},"foldingRange":{"collapsedText":false}},"declaration":{"dynamicRegistration":true,"linkSupport":true},"selectionRange":{"dynamicRegistration":true},"callHierarchy":{"dynamicRegistration":true},"semanticTokens":{"dynamicRegistration":true,"tokenTypes":["namespace","type","class","enum","interface","struct","typeParameter","parameter","variable","property","enumMember","event","function","method","macro","keyword","modifier","comment","string","number","regexp","operator","decorator"],"tokenModifiers":["declaration","definition","readonly","static","deprecated","abstract","async","modification","documentation","defaultLibrary"],"formats":["relative"],"requests":{"range":true,"full":{"delta":true}},"multilineTokenSupport":false,"overlappingTokenSupport":false,"serverCancelSupport":true,"augmentsSyntaxTokens":true},"linkedEditingRange":{"dynamicRegistration":true},"typeHierarchy":{"dynamicRegistration":true},"inlineValue":{"dynamicRegistration":true},"inlayHint":{"dynamicRegistration":true,"resolveSupport":{"properties":["tooltip","textEdits","label.tooltip","label.location","label.command"]}},"diagnostic":{"dynamicRegistration":true,"relatedDocumentSupport":false}},"window":{"showMessage":{"messageActionItem":{"additionalPropertiesSupport":true}},"showDocument":{"support":true},"workDoneProgress":true},"general":{"staleRequestSupport":{"cancel":true,"retryOnContentModified":["textDocument/semanticTokens/full","textDocument/semanticTokens/range","textDocument/semanticTokens/full/delta"]},"regularExpressions":{"engine":"ECMAScript","version":"ES2020"},"markdown":{"parser":"marked","version":"1.1.0"},"positionEncodings":["utf-16"]},"notebookDocument":{"synchronization":{"dynamicRegistration":true,"executionSummarySupport":true}}},"initializationOptions":{"usePlaceholders":true,"completionDocumentation":true,"verboseOutput":false,"build.directoryFilters":["-foof","-internal/lsp/protocol/typescript"],"codelenses":{"reference":true,"gc_details":true},"analyses":{"fillstruct":true,"staticcheck":true,"unusedparams":false,"composites":false},"semanticTokens":true,"noSemanticString":true,"noSemanticNumber":true,"templateExtensions":["tmpl","gotmpl"],"ui.completion.matcher":"Fuzzy","ui.inlayhint.hints":{"assignVariableTypes":false,"compositeLiteralFields":false,"compositeLiteralTypes":false,"constantValues":false,"functionTypeParameters":false,"parameterNames":false,"rangeVariableTypes":false},"ui.vulncheck":"Off","allExperiments":true},"trace":"off","workspaceFolders":[{"uri":"file:///Users/pjw/hakim","name":"hakim"}]}`
+-
+-type DiffReporter struct {
+- path cmp.Path
+- diffs []string
+-}
+-
+-func (r *DiffReporter) PushStep(ps cmp.PathStep) {
+- r.path = append(r.path, ps)
+-}
+-
+-func (r *DiffReporter) Report(rs cmp.Result) {
+- if !rs.Equal() {
+- vx, vy := r.path.Last().Values()
+- r.diffs = append(r.diffs, fmt.Sprintf("%#v:\n\t-: %+v\n\t+: %+v\n", r.path, vx, vy))
+- }
+-}
+-
+-func (r *DiffReporter) PopStep() {
+- r.path = r.path[:len(r.path)-1]
+-}
+-
+-func (r *DiffReporter) String() string {
+- return strings.Join(r.diffs, "\n")
+-}
+-
+-func TestStringChanges(t *testing.T) {
+- // string as value
+- stringLeaf := regexp.MustCompile(`:("[^"]*")`)
+- leafs := stringLeaf.FindAllStringSubmatchIndex(input, -1)
+- allDeltas(t, leafs, "23", "true")
+- // string as first element of array
+- stringArray := regexp.MustCompile(`[[]("[^"]*")`)
+- arrays := stringArray.FindAllStringSubmatchIndex(input, -1)
+- allDeltas(t, arrays, "23", "true")
+-}
+-
+-func TestBoolChanges(t *testing.T) {
+- boolLeaf := regexp.MustCompile(`:(true|false)(,|})`)
+- leafs := boolLeaf.FindAllStringSubmatchIndex(input, -1)
+- allDeltas(t, leafs, "23", `"xx"`)
+- boolArray := regexp.MustCompile(`:[[](true|false)(,|])`)
+- arrays := boolArray.FindAllStringSubmatchIndex(input, -1)
+- allDeltas(t, arrays, "23", `"xx"`)
+-}
+-
+-func TestNumberChanges(t *testing.T) {
+- numLeaf := regexp.MustCompile(`:(\d+)(,|})`)
+- leafs := numLeaf.FindAllStringSubmatchIndex(input, -1)
+- allDeltas(t, leafs, "true", `"xx"`)
+- numArray := regexp.MustCompile(`:[[](\d+)(,|])`)
+- arrays := numArray.FindAllStringSubmatchIndex(input, -1)
+- allDeltas(t, arrays, "true", `"xx"`)
+-}
+-
+-// v is a set of matches. check that substituting any repl never
+-// creates more than 1 unmarshaling error
+-func allDeltas(t *testing.T, v [][]int, repls ...string) {
+- t.Helper()
+- for _, repl := range repls {
+- for i, x := range v {
+- err := tryChange(x[2], x[3], repl)
+- if err != nil {
+- t.Errorf("%d:%q %v", i, input[x[2]:x[3]], err)
+- }
+- }
+- }
+-}
+-
+-func tryChange(start, end int, repl string) error {
+- var p, q protocol.ParamInitialize
+- mod := input[:start] + repl + input[end:]
+- excerpt := func() (string, string) {
+- a := start - 5
+- if a < 0 {
+- a = 0
+- }
+- b := end + 5
+- if b > len(input) {
+- // trusting repl to be no longer than what it replaces
+- b = len(input)
+- }
+- ma := input[a:b]
+- mb := mod[a:b]
+- return ma, mb
+- }
+-
+- if err := json.Unmarshal([]byte(input), &p); err != nil {
+- return fmt.Errorf("%s %v", repl, err)
+- }
+- switch err := json.Unmarshal([]byte(mod), &q).(type) {
+- case nil: //ok
+- case *json.UnmarshalTypeError:
+- break
+- case *protocol.UnmarshalError:
+- return nil // cmp.Diff produces several diffs for custom unmrshalers
+- default:
+- return fmt.Errorf("%T unexpected unmarshal error", err)
+- }
+-
+- var r DiffReporter
+- cmp.Diff(p, q, cmp.Reporter(&r))
+- if len(r.diffs) > 1 { // 0 is possible, e.g., for interface{}
+- ma, mb := excerpt()
+- return fmt.Errorf("got %d diffs for %q\n%s\n%s", len(r.diffs), repl, ma, mb)
+- }
+- return nil
+-}
diff --git a/third_party/org_golang_x_tools-gazelle.patch b/third_party/org_golang_x_tools-gazelle.patch
new file mode 100644
index 00000000..3cb5eb24
--- /dev/null
+++ b/third_party/org_golang_x_tools-gazelle.patch
@@ -0,0 +1,10622 @@
+diff -urN b/benchmark/parse/BUILD.bazel c/benchmark/parse/BUILD.bazel
+--- b/benchmark/parse/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/benchmark/parse/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "parse",
++ srcs = ["parse.go"],
++ importpath = "golang.org/x/tools/benchmark/parse",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":parse",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "parse_test",
++ srcs = ["parse_test.go"],
++ embed = [":parse"],
++)
+diff -urN b/blog/atom/BUILD.bazel c/blog/atom/BUILD.bazel
+--- b/blog/atom/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/blog/atom/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "atom",
++ srcs = ["atom.go"],
++ importpath = "golang.org/x/tools/blog/atom",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":atom",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/blog/BUILD.bazel c/blog/BUILD.bazel
+--- b/blog/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/blog/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "blog",
++ srcs = ["blog.go"],
++ importpath = "golang.org/x/tools/blog",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//blog/atom",
++ "//present",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":blog",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "blog_test",
++ srcs = ["blog_test.go"],
++ embed = [":blog"],
++)
+diff -urN b/cmd/auth/authtest/BUILD.bazel c/cmd/auth/authtest/BUILD.bazel
+--- b/cmd/auth/authtest/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/auth/authtest/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "authtest_lib",
++ srcs = ["authtest.go"],
++ importpath = "golang.org/x/tools/cmd/auth/authtest",
++ visibility = ["//visibility:private"],
++ deps = ["@org_golang_x_sys//execabs:go_default_library"],
++)
++
++go_binary(
++ name = "authtest",
++ embed = [":authtest_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/auth/cookieauth/BUILD.bazel c/cmd/auth/cookieauth/BUILD.bazel
+--- b/cmd/auth/cookieauth/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/auth/cookieauth/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "cookieauth_lib",
++ srcs = ["cookieauth.go"],
++ importpath = "golang.org/x/tools/cmd/auth/cookieauth",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "cookieauth",
++ embed = [":cookieauth_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/auth/gitauth/BUILD.bazel c/cmd/auth/gitauth/BUILD.bazel
+--- b/cmd/auth/gitauth/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/auth/gitauth/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "gitauth_lib",
++ srcs = ["gitauth.go"],
++ importpath = "golang.org/x/tools/cmd/auth/gitauth",
++ visibility = ["//visibility:private"],
++ deps = ["@org_golang_x_sys//execabs:go_default_library"],
++)
++
++go_binary(
++ name = "gitauth",
++ embed = [":gitauth_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/auth/netrcauth/BUILD.bazel c/cmd/auth/netrcauth/BUILD.bazel
+--- b/cmd/auth/netrcauth/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/auth/netrcauth/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "netrcauth_lib",
++ srcs = ["netrcauth.go"],
++ importpath = "golang.org/x/tools/cmd/auth/netrcauth",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "netrcauth",
++ embed = [":netrcauth_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/benchcmp/BUILD.bazel c/cmd/benchcmp/BUILD.bazel
+--- b/cmd/benchcmp/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/benchcmp/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "benchcmp_lib",
++ srcs = [
++ "benchcmp.go",
++ "compare.go",
++ "doc.go",
++ ],
++ importpath = "golang.org/x/tools/cmd/benchcmp",
++ visibility = ["//visibility:private"],
++ deps = ["//benchmark/parse"],
++)
++
++go_binary(
++ name = "benchcmp",
++ embed = [":benchcmp_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "benchcmp_test",
++ srcs = [
++ "benchcmp_test.go",
++ "compare_test.go",
++ ],
++ embed = [":benchcmp_lib"],
++ deps = ["//benchmark/parse"],
++)
+diff -urN b/cmd/bundle/BUILD.bazel c/cmd/bundle/BUILD.bazel
+--- b/cmd/bundle/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/bundle/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "bundle_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/bundle",
++ visibility = ["//visibility:private"],
++ deps = ["//go/packages"],
++)
++
++go_binary(
++ name = "bundle",
++ embed = [":bundle_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "bundle_test",
++ srcs = ["main_test.go"],
++ embed = [":bundle_lib"],
++ deps = ["//go/packages/packagestest"],
++)
+diff -urN b/cmd/bundle/testdata/src/domain.name/importdecl/BUILD.bazel c/cmd/bundle/testdata/src/domain.name/importdecl/BUILD.bazel
+--- b/cmd/bundle/testdata/src/domain.name/importdecl/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/bundle/testdata/src/domain.name/importdecl/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "importdecl",
++ srcs = ["p.go"],
++ importpath = "golang.org/x/tools/cmd/bundle/testdata/src/domain.name/importdecl",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":importdecl",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/bundle/testdata/src/initial/BUILD.bazel c/cmd/bundle/testdata/src/initial/BUILD.bazel
+--- b/cmd/bundle/testdata/src/initial/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/bundle/testdata/src/initial/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "initial",
++ srcs = [
++ "a.go",
++ "b.go",
++ "c.go",
++ ],
++ importpath = "golang.org/x/tools/cmd/bundle/testdata/src/initial",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":initial",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/callgraph/BUILD.bazel c/cmd/callgraph/BUILD.bazel
+--- b/cmd/callgraph/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/callgraph/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,74 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "callgraph_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/callgraph",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//go/buildutil",
++ "//go/callgraph",
++ "//go/callgraph/cha",
++ "//go/callgraph/rta",
++ "//go/callgraph/static",
++ "//go/callgraph/vta",
++ "//go/packages",
++ "//go/pointer",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ ],
++)
++
++go_binary(
++ name = "callgraph",
++ embed = [":callgraph_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "callgraph_test",
++ srcs = ["main_test.go"],
++ embed = [":callgraph_lib"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:js": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:plan9": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ "//internal/testenv",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN b/cmd/callgraph/testdata/src/pkg/BUILD.bazel c/cmd/callgraph/testdata/src/pkg/BUILD.bazel
+--- b/cmd/callgraph/testdata/src/pkg/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/callgraph/testdata/src/pkg/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "pkg_lib",
++ srcs = ["pkg.go"],
++ importpath = "golang.org/x/tools/cmd/callgraph/testdata/src/pkg",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "pkg",
++ embed = [":pkg_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "pkg_test",
++ srcs = ["pkg_test.go"],
++ embed = [":pkg_lib"],
++)
+diff -urN b/cmd/compilebench/BUILD.bazel c/cmd/compilebench/BUILD.bazel
+--- b/cmd/compilebench/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/compilebench/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "compilebench_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/compilebench",
++ visibility = ["//visibility:private"],
++ deps = ["@org_golang_x_sys//execabs:go_default_library"],
++)
++
++go_binary(
++ name = "compilebench",
++ embed = [":compilebench_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/digraph/BUILD.bazel c/cmd/digraph/BUILD.bazel
+--- b/cmd/digraph/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/digraph/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "digraph_lib",
++ srcs = ["digraph.go"],
++ importpath = "golang.org/x/tools/cmd/digraph",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "digraph",
++ embed = [":digraph_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "digraph_test",
++ srcs = ["digraph_test.go"],
++ embed = [":digraph_lib"],
++)
+diff -urN b/cmd/eg/BUILD.bazel c/cmd/eg/BUILD.bazel
+--- b/cmd/eg/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/eg/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "eg_lib",
++ srcs = ["eg.go"],
++ importpath = "golang.org/x/tools/cmd/eg",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//go/packages",
++ "//refactor/eg",
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++)
++
++go_binary(
++ name = "eg",
++ embed = [":eg_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/file2fuzz/BUILD.bazel c/cmd/file2fuzz/BUILD.bazel
+--- b/cmd/file2fuzz/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/file2fuzz/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "file2fuzz_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/file2fuzz",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "file2fuzz",
++ embed = [":file2fuzz_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "file2fuzz_test",
++ srcs = ["main_test.go"],
++ embed = [":file2fuzz_lib"],
++)
+diff -urN b/cmd/fiximports/BUILD.bazel c/cmd/fiximports/BUILD.bazel
+--- b/cmd/fiximports/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/fiximports/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,63 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "fiximports_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/fiximports",
++ visibility = ["//visibility:private"],
++ deps = ["@org_golang_x_sys//execabs:go_default_library"],
++)
++
++go_binary(
++ name = "fiximports",
++ embed = [":fiximports_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "fiximports_test",
++ srcs = ["main_test.go"],
++ embed = [":fiximports_lib"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:js": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:plan9": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ "//internal/testenv",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN b/cmd/fiximports/testdata/src/fruit.io/banana/BUILD.bazel c/cmd/fiximports/testdata/src/fruit.io/banana/BUILD.bazel
+--- b/cmd/fiximports/testdata/src/fruit.io/banana/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/fiximports/testdata/src/fruit.io/banana/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "banana",
++ srcs = ["banana.go"],
++ importpath = "golang.org/x/tools/cmd/fiximports/testdata/src/fruit.io/banana",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":banana",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/fiximports/testdata/src/fruit.io/orange/BUILD.bazel c/cmd/fiximports/testdata/src/fruit.io/orange/BUILD.bazel
+--- b/cmd/fiximports/testdata/src/fruit.io/orange/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/fiximports/testdata/src/fruit.io/orange/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "orange",
++ srcs = ["orange.go"],
++ importpath = "golang.org/x/tools/cmd/fiximports/testdata/src/fruit.io/orange",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":orange",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/fiximports/testdata/src/fruit.io/pear/BUILD.bazel c/cmd/fiximports/testdata/src/fruit.io/pear/BUILD.bazel
+--- b/cmd/fiximports/testdata/src/fruit.io/pear/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/fiximports/testdata/src/fruit.io/pear/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "pear",
++ srcs = ["pear.go"],
++ importpath = "golang.org/x/tools/cmd/fiximports/testdata/src/fruit.io/pear",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":pear",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/fiximports/testdata/src/new.com/one/BUILD.bazel c/cmd/fiximports/testdata/src/new.com/one/BUILD.bazel
+--- b/cmd/fiximports/testdata/src/new.com/one/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/fiximports/testdata/src/new.com/one/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "one",
++ srcs = ["one.go"],
++ importpath = "golang.org/x/tools/cmd/fiximports/testdata/src/new.com/one",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":one",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/fiximports/testdata/src/old.com/bad/BUILD.bazel c/cmd/fiximports/testdata/src/old.com/bad/BUILD.bazel
+--- b/cmd/fiximports/testdata/src/old.com/bad/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/fiximports/testdata/src/old.com/bad/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "bad",
++ srcs = ["bad.go"],
++ importpath = "golang.org/x/tools/cmd/fiximports/testdata/src/old.com/bad",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":bad",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/fiximports/testdata/src/old.com/one/BUILD.bazel c/cmd/fiximports/testdata/src/old.com/one/BUILD.bazel
+--- b/cmd/fiximports/testdata/src/old.com/one/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/fiximports/testdata/src/old.com/one/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "one",
++ srcs = ["one.go"],
++ importpath = "golang.org/x/tools/cmd/fiximports/testdata/src/old.com/one",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":one",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/fiximports/testdata/src/titanic.biz/bar/BUILD.bazel c/cmd/fiximports/testdata/src/titanic.biz/bar/BUILD.bazel
+--- b/cmd/fiximports/testdata/src/titanic.biz/bar/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/fiximports/testdata/src/titanic.biz/bar/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "bar",
++ srcs = ["bar.go"],
++ importpath = "golang.org/x/tools/cmd/fiximports/testdata/src/titanic.biz/bar",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":bar",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/fiximports/testdata/src/titanic.biz/foo/BUILD.bazel c/cmd/fiximports/testdata/src/titanic.biz/foo/BUILD.bazel
+--- b/cmd/fiximports/testdata/src/titanic.biz/foo/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/fiximports/testdata/src/titanic.biz/foo/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "foo",
++ srcs = ["foo.go"],
++ importpath = "golang.org/x/tools/cmd/fiximports/testdata/src/titanic.biz/foo",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":foo",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/getgo/BUILD.bazel c/cmd/getgo/BUILD.bazel
+--- b/cmd/getgo/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/getgo/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,74 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "getgo_lib",
++ srcs = [
++ "download.go",
++ "main.go",
++ "path.go",
++ "steps.go",
++ "system.go",
++ "system_unix.go",
++ "system_windows.go",
++ ],
++ importpath = "golang.org/x/tools/cmd/getgo",
++ visibility = ["//visibility:private"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:android": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:js": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "//conditions:default": [],
++ }),
++)
++
++go_binary(
++ name = "getgo",
++ embed = [":getgo_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "getgo_test",
++ srcs = [
++ "download_test.go",
++ "main_test.go",
++ "path_test.go",
++ ],
++ embed = [":getgo_lib"],
++)
+diff -urN b/cmd/getgo/server/BUILD.bazel c/cmd/getgo/server/BUILD.bazel
+--- b/cmd/getgo/server/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/getgo/server/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "server_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/getgo/server",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "server",
++ embed = [":server_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/go-contrib-init/BUILD.bazel c/cmd/go-contrib-init/BUILD.bazel
+--- b/cmd/go-contrib-init/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/go-contrib-init/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "go-contrib-init_lib",
++ srcs = ["contrib.go"],
++ importpath = "golang.org/x/tools/cmd/go-contrib-init",
++ visibility = ["//visibility:private"],
++ deps = ["@org_golang_x_sys//execabs:go_default_library"],
++)
++
++go_binary(
++ name = "go-contrib-init",
++ embed = [":go-contrib-init_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "go-contrib-init_test",
++ srcs = ["contrib_test.go"],
++ embed = [":go-contrib-init_lib"],
++)
+diff -urN b/cmd/godex/BUILD.bazel c/cmd/godex/BUILD.bazel
+--- b/cmd/godex/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/godex/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "godex_lib",
++ srcs = [
++ "doc.go",
++ "gc.go",
++ "gccgo.go",
++ "godex.go",
++ "isAlias18.go",
++ "isAlias19.go",
++ "print.go",
++ "source.go",
++ "writetype.go",
++ ],
++ importpath = "golang.org/x/tools/cmd/godex",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "godex",
++ embed = [":godex_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/godoc/BUILD.bazel c/cmd/godoc/BUILD.bazel
+--- b/cmd/godoc/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/godoc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,41 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "godoc_lib",
++ srcs = [
++ "doc.go",
++ "goroot.go",
++ "handlers.go",
++ "main.go",
++ ],
++ importpath = "golang.org/x/tools/cmd/godoc",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//godoc",
++ "//godoc/redirect",
++ "//godoc/static",
++ "//godoc/vfs",
++ "//godoc/vfs/gatefs",
++ "//godoc/vfs/mapfs",
++ "//godoc/vfs/zipfs",
++ "//internal/gocommand",
++ "//playground",
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++)
++
++go_binary(
++ name = "godoc",
++ embed = [":godoc_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "godoc_test",
++ srcs = ["godoc_test.go"],
++ embed = [":godoc_lib"],
++ deps = [
++ "//go/packages/packagestest",
++ "//internal/testenv",
++ ],
++)
+diff -urN b/cmd/goimports/BUILD.bazel c/cmd/goimports/BUILD.bazel
+--- b/cmd/goimports/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/goimports/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "goimports_lib",
++ srcs = [
++ "doc.go",
++ "goimports.go",
++ "goimports_gc.go",
++ ],
++ importpath = "golang.org/x/tools/cmd/goimports",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//internal/gocommand",
++ "//internal/imports",
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++)
++
++go_binary(
++ name = "goimports",
++ embed = [":goimports_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/gomvpkg/BUILD.bazel c/cmd/gomvpkg/BUILD.bazel
+--- b/cmd/gomvpkg/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/gomvpkg/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "gomvpkg_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/gomvpkg",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//go/buildutil",
++ "//refactor/rename",
++ ],
++)
++
++go_binary(
++ name = "gomvpkg",
++ embed = [":gomvpkg_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/gorename/BUILD.bazel c/cmd/gorename/BUILD.bazel
+--- b/cmd/gorename/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/gorename/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "gorename_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/gorename",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//go/buildutil",
++ "//refactor/rename",
++ ],
++)
++
++go_binary(
++ name = "gorename",
++ embed = [":gorename_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "gorename_test",
++ srcs = ["gorename_test.go"],
++ deps = ["//internal/testenv"],
++)
+diff -urN b/cmd/gotype/BUILD.bazel c/cmd/gotype/BUILD.bazel
+--- b/cmd/gotype/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/gotype/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "gotype_lib",
++ srcs = [
++ "gotype.go",
++ "sizesFor18.go",
++ "sizesFor19.go",
++ ],
++ importpath = "golang.org/x/tools/cmd/gotype",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "gotype",
++ embed = [":gotype_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/goyacc/BUILD.bazel c/cmd/goyacc/BUILD.bazel
+--- b/cmd/goyacc/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/goyacc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "goyacc_lib",
++ srcs = [
++ "doc.go",
++ "yacc.go",
++ ],
++ importpath = "golang.org/x/tools/cmd/goyacc",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "goyacc",
++ embed = [":goyacc_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/goyacc/testdata/expr/BUILD.bazel c/cmd/goyacc/testdata/expr/BUILD.bazel
+--- b/cmd/goyacc/testdata/expr/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/goyacc/testdata/expr/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "expr_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/goyacc/testdata/expr",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "expr",
++ embed = [":expr_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/BUILD.bazel c/cmd/guru/BUILD.bazel
+--- b/cmd/guru/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,56 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "guru_lib",
++ srcs = [
++ "callees.go",
++ "callers.go",
++ "callstack.go",
++ "definition.go",
++ "describe.go",
++ "freevars.go",
++ "guru.go",
++ "implements.go",
++ "isAlias18.go",
++ "isAlias19.go",
++ "main.go",
++ "peers.go",
++ "pointsto.go",
++ "pos.go",
++ "referrers.go",
++ "what.go",
++ "whicherrs.go",
++ ],
++ importpath = "golang.org/x/tools/cmd/guru",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//cmd/guru/serial",
++ "//go/ast/astutil",
++ "//go/buildutil",
++ "//go/callgraph",
++ "//go/callgraph/static",
++ "//go/loader",
++ "//go/pointer",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//go/types/typeutil",
++ "//imports",
++ "//refactor/importgraph",
++ ],
++)
++
++go_binary(
++ name = "guru",
++ embed = [":guru_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "guru_test",
++ srcs = [
++ "guru_test.go",
++ "unit_test.go",
++ ],
++ embed = [":guru_lib"],
++ deps = ["//internal/testenv"],
++)
+diff -urN b/cmd/guru/serial/BUILD.bazel c/cmd/guru/serial/BUILD.bazel
+--- b/cmd/guru/serial/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/serial/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "serial",
++ srcs = ["serial.go"],
++ importpath = "golang.org/x/tools/cmd/guru/serial",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":serial",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/alias/BUILD.bazel c/cmd/guru/testdata/src/alias/BUILD.bazel
+--- b/cmd/guru/testdata/src/alias/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/alias/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "alias",
++ srcs = ["alias.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/alias",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":alias",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/calls/BUILD.bazel c/cmd/guru/testdata/src/calls/BUILD.bazel
+--- b/cmd/guru/testdata/src/calls/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/calls/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "calls_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/calls",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "calls",
++ embed = [":calls_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/calls-json/BUILD.bazel c/cmd/guru/testdata/src/calls-json/BUILD.bazel
+--- b/cmd/guru/testdata/src/calls-json/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/calls-json/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "calls-json_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/calls-json",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "calls-json",
++ embed = [":calls-json_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/definition-json/BUILD.bazel c/cmd/guru/testdata/src/definition-json/BUILD.bazel
+--- b/cmd/guru/testdata/src/definition-json/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/definition-json/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "definition-json",
++ srcs = [
++ "main.go",
++ "type.go",
++ ],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/definition-json",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":definition-json",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/describe/BUILD.bazel c/cmd/guru/testdata/src/describe/BUILD.bazel
+--- b/cmd/guru/testdata/src/describe/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/describe/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "describe",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/describe",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":describe",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/describe-json/BUILD.bazel c/cmd/guru/testdata/src/describe-json/BUILD.bazel
+--- b/cmd/guru/testdata/src/describe-json/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/describe-json/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "describe-json",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/describe-json",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":describe-json",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/freevars/BUILD.bazel c/cmd/guru/testdata/src/freevars/BUILD.bazel
+--- b/cmd/guru/testdata/src/freevars/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/freevars/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "freevars_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/freevars",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "freevars",
++ embed = [":freevars_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/implements/BUILD.bazel c/cmd/guru/testdata/src/implements/BUILD.bazel
+--- b/cmd/guru/testdata/src/implements/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/implements/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "implements_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/implements",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "implements",
++ embed = [":implements_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/implements-json/BUILD.bazel c/cmd/guru/testdata/src/implements-json/BUILD.bazel
+--- b/cmd/guru/testdata/src/implements-json/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/implements-json/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "implements-json_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/implements-json",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "implements-json",
++ embed = [":implements-json_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/implements-methods/BUILD.bazel c/cmd/guru/testdata/src/implements-methods/BUILD.bazel
+--- b/cmd/guru/testdata/src/implements-methods/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/implements-methods/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "implements-methods_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/implements-methods",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "implements-methods",
++ embed = [":implements-methods_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/implements-methods-json/BUILD.bazel c/cmd/guru/testdata/src/implements-methods-json/BUILD.bazel
+--- b/cmd/guru/testdata/src/implements-methods-json/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/implements-methods-json/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "implements-methods-json_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/implements-methods-json",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "implements-methods-json",
++ embed = [":implements-methods-json_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/imports/BUILD.bazel c/cmd/guru/testdata/src/imports/BUILD.bazel
+--- b/cmd/guru/testdata/src/imports/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/imports/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "imports_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/imports",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "imports",
++ embed = [":imports_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/lib/BUILD.bazel c/cmd/guru/testdata/src/lib/BUILD.bazel
+--- b/cmd/guru/testdata/src/lib/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/lib/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "lib",
++ srcs = ["lib.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/lib",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":lib",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/lib/sublib/BUILD.bazel c/cmd/guru/testdata/src/lib/sublib/BUILD.bazel
+--- b/cmd/guru/testdata/src/lib/sublib/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/lib/sublib/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "sublib",
++ srcs = ["sublib.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/lib/sublib",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sublib",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/main/BUILD.bazel c/cmd/guru/testdata/src/main/BUILD.bazel
+--- b/cmd/guru/testdata/src/main/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/main/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "main_lib",
++ srcs = ["multi.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/main",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "main",
++ embed = [":main_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/peers/BUILD.bazel c/cmd/guru/testdata/src/peers/BUILD.bazel
+--- b/cmd/guru/testdata/src/peers/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/peers/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "peers_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/peers",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "peers",
++ embed = [":peers_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/peers-json/BUILD.bazel c/cmd/guru/testdata/src/peers-json/BUILD.bazel
+--- b/cmd/guru/testdata/src/peers-json/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/peers-json/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "peers-json_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/peers-json",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "peers-json",
++ embed = [":peers-json_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/pointsto/BUILD.bazel c/cmd/guru/testdata/src/pointsto/BUILD.bazel
+--- b/cmd/guru/testdata/src/pointsto/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/pointsto/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "pointsto_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/pointsto",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "pointsto",
++ embed = [":pointsto_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/pointsto-json/BUILD.bazel c/cmd/guru/testdata/src/pointsto-json/BUILD.bazel
+--- b/cmd/guru/testdata/src/pointsto-json/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/pointsto-json/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "pointsto-json_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/pointsto-json",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "pointsto-json",
++ embed = [":pointsto-json_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/referrers/BUILD.bazel c/cmd/guru/testdata/src/referrers/BUILD.bazel
+--- b/cmd/guru/testdata/src/referrers/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/referrers/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "referrers_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/referrers",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "referrers",
++ embed = [":referrers_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "referrers_test",
++ srcs = [
++ "ext_test.go",
++ "int_test.go",
++ ],
++ embed = [":referrers_lib"],
++)
+diff -urN b/cmd/guru/testdata/src/referrers-json/BUILD.bazel c/cmd/guru/testdata/src/referrers-json/BUILD.bazel
+--- b/cmd/guru/testdata/src/referrers-json/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/referrers-json/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "referrers-json_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/referrers-json",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "referrers-json",
++ embed = [":referrers-json_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/reflection/BUILD.bazel c/cmd/guru/testdata/src/reflection/BUILD.bazel
+--- b/cmd/guru/testdata/src/reflection/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/reflection/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "reflection_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/reflection",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "reflection",
++ embed = [":reflection_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/softerrs/BUILD.bazel c/cmd/guru/testdata/src/softerrs/BUILD.bazel
+--- b/cmd/guru/testdata/src/softerrs/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/softerrs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "softerrs_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/softerrs",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "softerrs",
++ embed = [":softerrs_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/what/BUILD.bazel c/cmd/guru/testdata/src/what/BUILD.bazel
+--- b/cmd/guru/testdata/src/what/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/what/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "what_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/what",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "what",
++ embed = [":what_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/what-json/BUILD.bazel c/cmd/guru/testdata/src/what-json/BUILD.bazel
+--- b/cmd/guru/testdata/src/what-json/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/what-json/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "what-json_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/what-json",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "what-json",
++ embed = [":what-json_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/guru/testdata/src/whicherrs/BUILD.bazel c/cmd/guru/testdata/src/whicherrs/BUILD.bazel
+--- b/cmd/guru/testdata/src/whicherrs/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/guru/testdata/src/whicherrs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "whicherrs_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/guru/testdata/src/whicherrs",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "whicherrs",
++ embed = [":whicherrs_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/html2article/BUILD.bazel c/cmd/html2article/BUILD.bazel
+--- b/cmd/html2article/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/html2article/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "html2article_lib",
++ srcs = ["conv.go"],
++ importpath = "golang.org/x/tools/cmd/html2article",
++ visibility = ["//visibility:private"],
++ deps = [
++ "@org_golang_x_net//html:go_default_library",
++ "@org_golang_x_net//html/atom:go_default_library",
++ ],
++)
++
++go_binary(
++ name = "html2article",
++ embed = [":html2article_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/present/BUILD.bazel c/cmd/present/BUILD.bazel
+--- b/cmd/present/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/present/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "present_lib",
++ srcs = [
++ "dir.go",
++ "doc.go",
++ "main.go",
++ "play.go",
++ ],
++ embedsrcs = [
++ "static/article.css",
++ "static/dir.css",
++ "static/dir.js",
++ "static/favicon.ico",
++ "static/jquery-ui.js",
++ "static/notes.css",
++ "static/notes.js",
++ "static/slides.js",
++ "static/styles.css",
++ "templates/action.tmpl",
++ "templates/article.tmpl",
++ "templates/dir.tmpl",
++ "templates/slides.tmpl",
++ ],
++ importpath = "golang.org/x/tools/cmd/present",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//godoc/static",
++ "//playground",
++ "//playground/socket",
++ "//present",
++ ],
++)
++
++go_binary(
++ name = "present",
++ embed = [":present_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/present2md/BUILD.bazel c/cmd/present2md/BUILD.bazel
+--- b/cmd/present2md/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/present2md/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "present2md_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/present2md",
++ visibility = ["//visibility:private"],
++ deps = ["//present"],
++)
++
++go_binary(
++ name = "present2md",
++ embed = [":present2md_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/signature-fuzzer/fuzz-driver/BUILD.bazel c/cmd/signature-fuzzer/fuzz-driver/BUILD.bazel
+--- b/cmd/signature-fuzzer/fuzz-driver/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/signature-fuzzer/fuzz-driver/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "fuzz-driver_lib",
++ srcs = ["driver.go"],
++ importpath = "golang.org/x/tools/cmd/signature-fuzzer/fuzz-driver",
++ visibility = ["//visibility:private"],
++ deps = ["//cmd/signature-fuzzer/internal/fuzz-generator"],
++)
++
++go_binary(
++ name = "fuzz-driver",
++ embed = [":fuzz-driver_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "fuzz-driver_test",
++ srcs = ["drv_test.go"],
++ embed = [":fuzz-driver_lib"],
++ deps = ["//internal/testenv"],
++)
+diff -urN b/cmd/signature-fuzzer/fuzz-runner/BUILD.bazel c/cmd/signature-fuzzer/fuzz-runner/BUILD.bazel
+--- b/cmd/signature-fuzzer/fuzz-runner/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/signature-fuzzer/fuzz-runner/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "fuzz-runner_lib",
++ srcs = ["runner.go"],
++ importpath = "golang.org/x/tools/cmd/signature-fuzzer/fuzz-runner",
++ visibility = ["//visibility:private"],
++ deps = ["//cmd/signature-fuzzer/internal/fuzz-generator"],
++)
++
++go_binary(
++ name = "fuzz-runner",
++ embed = [":fuzz-runner_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "fuzz-runner_test",
++ srcs = ["rnr_test.go"],
++ embed = [":fuzz-runner_lib"],
++ deps = ["//internal/testenv"],
++)
+diff -urN b/cmd/signature-fuzzer/fuzz-runner/testdata/BUILD.bazel c/cmd/signature-fuzzer/fuzz-runner/testdata/BUILD.bazel
+--- b/cmd/signature-fuzzer/fuzz-runner/testdata/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/signature-fuzzer/fuzz-runner/testdata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "testdata_lib",
++ srcs = ["himom.go"],
++ importpath = "golang.org/x/tools/cmd/signature-fuzzer/fuzz-runner/testdata",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "testdata",
++ embed = [":testdata_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/signature-fuzzer/internal/fuzz-generator/BUILD.bazel c/cmd/signature-fuzzer/internal/fuzz-generator/BUILD.bazel
+--- b/cmd/signature-fuzzer/internal/fuzz-generator/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/signature-fuzzer/internal/fuzz-generator/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "fuzz-generator",
++ srcs = [
++ "arrayparm.go",
++ "generator.go",
++ "mapparm.go",
++ "numparm.go",
++ "parm.go",
++ "pointerparm.go",
++ "stringparm.go",
++ "structparm.go",
++ "typedefparm.go",
++ "wraprand.go",
++ ],
++ importpath = "golang.org/x/tools/cmd/signature-fuzzer/internal/fuzz-generator",
++ visibility = ["//cmd/signature-fuzzer:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fuzz-generator",
++ visibility = ["//cmd/signature-fuzzer:__subpackages__"],
++)
++
++go_test(
++ name = "fuzz-generator_test",
++ srcs = ["gen_test.go"],
++ embed = [":fuzz-generator"],
++ deps = ["//internal/testenv"],
++)
+diff -urN b/cmd/splitdwarf/BUILD.bazel c/cmd/splitdwarf/BUILD.bazel
+--- b/cmd/splitdwarf/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/splitdwarf/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,47 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "splitdwarf_lib",
++ srcs = ["splitdwarf.go"],
++ importpath = "golang.org/x/tools/cmd/splitdwarf",
++ visibility = ["//visibility:private"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ "//cmd/splitdwarf/internal/macho",
++ ],
++ "@io_bazel_rules_go//go/platform:android": [
++ "//cmd/splitdwarf/internal/macho",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ "//cmd/splitdwarf/internal/macho",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ "//cmd/splitdwarf/internal/macho",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ "//cmd/splitdwarf/internal/macho",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ "//cmd/splitdwarf/internal/macho",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ "//cmd/splitdwarf/internal/macho",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ "//cmd/splitdwarf/internal/macho",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ "//cmd/splitdwarf/internal/macho",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ "//cmd/splitdwarf/internal/macho",
++ ],
++ "//conditions:default": [],
++ }),
++)
++
++go_binary(
++ name = "splitdwarf",
++ embed = [":splitdwarf_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/splitdwarf/internal/macho/BUILD.bazel c/cmd/splitdwarf/internal/macho/BUILD.bazel
+--- b/cmd/splitdwarf/internal/macho/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/splitdwarf/internal/macho/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "macho",
++ srcs = [
++ "fat.go",
++ "file.go",
++ "macho.go",
++ "reloctype.go",
++ "reloctype_string.go",
++ ],
++ importpath = "golang.org/x/tools/cmd/splitdwarf/internal/macho",
++ visibility = ["//cmd/splitdwarf:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":macho",
++ visibility = ["//cmd/splitdwarf:__subpackages__"],
++)
++
++go_test(
++ name = "macho_test",
++ srcs = ["file_test.go"],
++ data = glob(["testdata/**"]),
++ embed = [":macho"],
++)
+diff -urN b/cmd/ssadump/BUILD.bazel c/cmd/ssadump/BUILD.bazel
+--- b/cmd/ssadump/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/ssadump/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "ssadump_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/cmd/ssadump",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//go/buildutil",
++ "//go/packages",
++ "//go/ssa",
++ "//go/ssa/interp",
++ "//go/ssa/ssautil",
++ ],
++)
++
++go_binary(
++ name = "ssadump",
++ embed = [":ssadump_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/stress/BUILD.bazel c/cmd/stress/BUILD.bazel
+--- b/cmd/stress/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/stress/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,56 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "stress_lib",
++ srcs = ["stress.go"],
++ importpath = "golang.org/x/tools/cmd/stress",
++ visibility = ["//visibility:private"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:android": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:js": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++ "//conditions:default": [],
++ }),
++)
++
++go_binary(
++ name = "stress",
++ embed = [":stress_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/stringer/BUILD.bazel c/cmd/stringer/BUILD.bazel
+--- b/cmd/stringer/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/stringer/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,69 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library", "go_test")
++
++go_library(
++ name = "stringer_lib",
++ srcs = ["stringer.go"],
++ importpath = "golang.org/x/tools/cmd/stringer",
++ visibility = ["//visibility:private"],
++ deps = ["//go/packages"],
++)
++
++go_binary(
++ name = "stringer",
++ embed = [":stringer_lib"],
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "stringer_test",
++ srcs = [
++ "endtoend_test.go",
++ "golden_test.go",
++ "util_test.go",
++ ],
++ embed = [":stringer_lib"],
++ deps = [
++ "//internal/testenv",
++ ] + select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:js": [
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:plan9": [
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ "//internal/typeparams",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN b/cmd/stringer/testdata/BUILD.bazel c/cmd/stringer/testdata/BUILD.bazel
+--- b/cmd/stringer/testdata/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/stringer/testdata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "testdata_lib",
++ srcs = [
++ "cgo.go",
++ "conv.go",
++ "day.go",
++ "gap.go",
++ "num.go",
++ "number.go",
++ "prime.go",
++ "tag_main.go",
++ "unum.go",
++ "unum2.go",
++ "vary_day.go",
++ ],
++ cgo = True,
++ importpath = "golang.org/x/tools/cmd/stringer/testdata",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "testdata",
++ embed = [":testdata_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/stringer/testdata/typeparams/BUILD.bazel c/cmd/stringer/testdata/typeparams/BUILD.bazel
+--- b/cmd/stringer/testdata/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/stringer/testdata/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "typeparams_lib",
++ srcs = [
++ "conv2.go",
++ "prime2.go",
++ ],
++ importpath = "golang.org/x/tools/cmd/stringer/testdata/typeparams",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "typeparams",
++ embed = [":typeparams_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/cmd/toolstash/BUILD.bazel c/cmd/toolstash/BUILD.bazel
+--- b/cmd/toolstash/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cmd/toolstash/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "toolstash_lib",
++ srcs = [
++ "cmp.go",
++ "main.go",
++ ],
++ importpath = "golang.org/x/tools/cmd/toolstash",
++ visibility = ["//visibility:private"],
++ deps = ["@org_golang_x_sys//execabs:go_default_library"],
++)
++
++go_binary(
++ name = "toolstash",
++ embed = [":toolstash_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/container/intsets/BUILD.bazel c/container/intsets/BUILD.bazel
+--- b/container/intsets/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/container/intsets/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "intsets",
++ srcs = ["sparse.go"],
++ importpath = "golang.org/x/tools/container/intsets",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":intsets",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "intsets_test",
++ srcs = [
++ "export_test.go",
++ "sparse_test.go",
++ ],
++ embed = [":intsets"],
++)
+diff -urN b/copyright/BUILD.bazel c/copyright/BUILD.bazel
+--- b/copyright/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/copyright/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "copyright",
++ srcs = ["copyright.go"],
++ importpath = "golang.org/x/tools/copyright",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":copyright",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "copyright_test",
++ srcs = ["copyright_test.go"],
++ embed = [":copyright"],
++)
+diff -urN b/cover/BUILD.bazel c/cover/BUILD.bazel
+--- b/cover/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/cover/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "cover",
++ srcs = ["profile.go"],
++ importpath = "golang.org/x/tools/cover",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":cover",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "cover_test",
++ srcs = ["profile_test.go"],
++ embed = [":cover"],
++)
+diff -urN b/go/analysis/analysistest/BUILD.bazel c/go/analysis/analysistest/BUILD.bazel
+--- b/go/analysis/analysistest/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/analysistest/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "analysistest",
++ srcs = ["analysistest.go"],
++ importpath = "golang.org/x/tools/go/analysis/analysistest",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/internal/checker",
++ "//go/packages",
++ "//internal/diff",
++ "//internal/testenv",
++ "//txtar",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":analysistest",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "analysistest_test",
++ srcs = ["analysistest_test.go"],
++ deps = [
++ ":analysistest",
++ "//go/analysis/passes/findcall",
++ "//internal/testenv",
++ ],
++)
+diff -urN b/go/analysis/BUILD.bazel c/go/analysis/BUILD.bazel
+--- b/go/analysis/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "analysis",
++ srcs = [
++ "analysis.go",
++ "diagnostic.go",
++ "doc.go",
++ "validate.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":analysis",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "analysis_test",
++ srcs = ["validate_test.go"],
++ embed = [":analysis"],
++)
+diff -urN b/go/analysis/internal/analysisflags/BUILD.bazel c/go/analysis/internal/analysisflags/BUILD.bazel
+--- b/go/analysis/internal/analysisflags/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/internal/analysisflags/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "analysisflags",
++ srcs = [
++ "flags.go",
++ "help.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/internal/analysisflags",
++ visibility = ["//go/analysis:__subpackages__"],
++ deps = ["//go/analysis"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":analysisflags",
++ visibility = ["//go/analysis:__subpackages__"],
++)
++
++go_test(
++ name = "analysisflags_test",
++ srcs = ["flags_test.go"],
++ deps = [
++ ":analysisflags",
++ "//go/analysis",
++ ],
++)
+diff -urN b/go/analysis/internal/checker/BUILD.bazel c/go/analysis/internal/checker/BUILD.bazel
+--- b/go/analysis/internal/checker/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/internal/checker/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "checker",
++ srcs = ["checker.go"],
++ importpath = "golang.org/x/tools/go/analysis/internal/checker",
++ visibility = ["//go/analysis:__subpackages__"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/internal/analysisflags",
++ "//go/packages",
++ "//internal/diff",
++ "//internal/robustio",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":checker",
++ visibility = ["//go/analysis:__subpackages__"],
++)
++
++go_test(
++ name = "checker_test",
++ srcs = [
++ "checker_test.go",
++ "fix_test.go",
++ "start_test.go",
++ ],
++ deps = [
++ ":checker",
++ "//go/analysis",
++ "//go/analysis/analysistest",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ "//internal/testenv",
++ ],
++)
+diff -urN b/go/analysis/multichecker/BUILD.bazel c/go/analysis/multichecker/BUILD.bazel
+--- b/go/analysis/multichecker/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/multichecker/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "multichecker",
++ srcs = ["multichecker.go"],
++ importpath = "golang.org/x/tools/go/analysis/multichecker",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/internal/analysisflags",
++ "//go/analysis/internal/checker",
++ "//go/analysis/unitchecker",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":multichecker",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "multichecker_test",
++ srcs = ["multichecker_test.go"],
++ deps = [
++ ":multichecker",
++ "//go/analysis",
++ "//go/analysis/passes/findcall",
++ "//internal/testenv",
++ ],
++)
+diff -urN b/go/analysis/passes/asmdecl/BUILD.bazel c/go/analysis/passes/asmdecl/BUILD.bazel
+--- b/go/analysis/passes/asmdecl/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/asmdecl/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "asmdecl",
++ srcs = [
++ "arches_go118.go",
++ "arches_go119.go",
++ "asmdecl.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/asmdecl",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/internal/analysisutil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":asmdecl",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "asmdecl_test",
++ srcs = ["asmdecl_test.go"],
++ deps = [
++ ":asmdecl",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/asmdecl/testdata/src/a/BUILD.bazel c/go/analysis/passes/asmdecl/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/asmdecl/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/asmdecl/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = [
++ "asm.go",
++ "asm1.s",
++ "asm11.s",
++ "asm2.s",
++ "asm3.s",
++ "asm4.s",
++ "asm5.s",
++ "asm6.s",
++ "asm7.s",
++ "asm8.s",
++ "asm9.s",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/asmdecl/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/assign/BUILD.bazel c/go/analysis/passes/assign/BUILD.bazel
+--- b/go/analysis/passes/assign/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/assign/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "assign",
++ srcs = ["assign.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/assign",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/analysis/passes/internal/analysisutil",
++ "//go/ast/inspector",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":assign",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "assign_test",
++ srcs = ["assign_test.go"],
++ deps = [
++ ":assign",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/assign/testdata/src/a/BUILD.bazel c/go/analysis/passes/assign/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/assign/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/assign/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/assign/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/assign/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/assign/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/assign/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/assign/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/assign/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/atomic/BUILD.bazel c/go/analysis/passes/atomic/BUILD.bazel
+--- b/go/analysis/passes/atomic/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/atomic/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "atomic",
++ srcs = ["atomic.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/atomic",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/analysis/passes/internal/analysisutil",
++ "//go/ast/inspector",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":atomic",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "atomic_test",
++ srcs = ["atomic_test.go"],
++ deps = [
++ ":atomic",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/atomic/testdata/src/a/BUILD.bazel c/go/analysis/passes/atomic/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/atomic/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/atomic/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/atomic/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/atomic/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/atomic/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/atomic/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/atomic/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/atomic/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/atomicalign/BUILD.bazel c/go/analysis/passes/atomicalign/BUILD.bazel
+--- b/go/analysis/passes/atomicalign/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/atomicalign/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "atomicalign",
++ srcs = ["atomicalign.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/atomicalign",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/analysis/passes/internal/analysisutil",
++ "//go/ast/inspector",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":atomicalign",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "atomicalign_test",
++ srcs = ["atomicalign_test.go"],
++ deps = [
++ ":atomicalign",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/atomicalign/testdata/src/a/BUILD.bazel c/go/analysis/passes/atomicalign/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/atomicalign/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/atomicalign/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = [
++ "a.go",
++ "stub.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/atomicalign/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/atomicalign/testdata/src/b/BUILD.bazel c/go/analysis/passes/atomicalign/testdata/src/b/BUILD.bazel
+--- b/go/analysis/passes/atomicalign/testdata/src/b/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/atomicalign/testdata/src/b/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "b",
++ srcs = [
++ "b.go",
++ "stub.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/atomicalign/testdata/src/b",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":b",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/bools/BUILD.bazel c/go/analysis/passes/bools/BUILD.bazel
+--- b/go/analysis/passes/bools/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/bools/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "bools",
++ srcs = ["bools.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/bools",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/analysis/passes/internal/analysisutil",
++ "//go/ast/inspector",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":bools",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "bools_test",
++ srcs = ["bools_test.go"],
++ deps = [
++ ":bools",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/bools/testdata/src/a/BUILD.bazel c/go/analysis/passes/bools/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/bools/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/bools/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/bools/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/bools/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/bools/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/bools/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/bools/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/bools/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/buildssa/BUILD.bazel c/go/analysis/passes/buildssa/BUILD.bazel
+--- b/go/analysis/passes/buildssa/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/buildssa/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "buildssa",
++ srcs = ["buildssa.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/buildssa",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/ssa",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":buildssa",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "buildssa_test",
++ srcs = ["buildssa_test.go"],
++ deps = [
++ ":buildssa",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/buildssa/testdata/src/a/BUILD.bazel c/go/analysis/passes/buildssa/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/buildssa/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/buildssa/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/buildssa/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/buildssa/testdata/src/b/BUILD.bazel c/go/analysis/passes/buildssa/testdata/src/b/BUILD.bazel
+--- b/go/analysis/passes/buildssa/testdata/src/b/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/buildssa/testdata/src/b/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "b",
++ srcs = ["b.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/buildssa/testdata/src/b",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":b",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/buildssa/testdata/src/c/BUILD.bazel c/go/analysis/passes/buildssa/testdata/src/c/BUILD.bazel
+--- b/go/analysis/passes/buildssa/testdata/src/c/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/buildssa/testdata/src/c/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "c",
++ srcs = ["c.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/buildssa/testdata/src/c",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":c",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/buildtag/BUILD.bazel c/go/analysis/passes/buildtag/BUILD.bazel
+--- b/go/analysis/passes/buildtag/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/buildtag/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "buildtag",
++ srcs = [
++ "buildtag.go",
++ "buildtag_old.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/buildtag",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/internal/analysisutil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":buildtag",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "buildtag_test",
++ srcs = ["buildtag_test.go"],
++ deps = [
++ ":buildtag",
++ "//go/analysis",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/buildtag/testdata/src/a/BUILD.bazel c/go/analysis/passes/buildtag/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/buildtag/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/buildtag/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = [
++ "buildtag4.go",
++ "buildtag5.go",
++ "buildtag6.s",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/buildtag/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/cgocall/BUILD.bazel c/go/analysis/passes/cgocall/BUILD.bazel
+--- b/go/analysis/passes/cgocall/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/cgocall/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "cgocall",
++ srcs = ["cgocall.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/cgocall",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/internal/analysisutil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":cgocall",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "cgocall_test",
++ srcs = ["cgocall_test.go"],
++ deps = [
++ ":cgocall",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/cgocall/testdata/src/a/BUILD.bazel c/go/analysis/passes/cgocall/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/cgocall/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/cgocall/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = [
++ "cgo.go",
++ "cgo3.go",
++ ],
++ cgo = True,
++ importpath = "golang.org/x/tools/go/analysis/passes/cgocall/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/cgocall/testdata/src/b/BUILD.bazel c/go/analysis/passes/cgocall/testdata/src/b/BUILD.bazel
+--- b/go/analysis/passes/cgocall/testdata/src/b/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/cgocall/testdata/src/b/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "b",
++ srcs = ["b.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/cgocall/testdata/src/b",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":b",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/cgocall/testdata/src/c/BUILD.bazel c/go/analysis/passes/cgocall/testdata/src/c/BUILD.bazel
+--- b/go/analysis/passes/cgocall/testdata/src/c/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/cgocall/testdata/src/c/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "c",
++ srcs = ["c.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/cgocall/testdata/src/c",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":c",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/cgocall/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/cgocall/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/cgocall/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/cgocall/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ cgo = True,
++ importpath = "golang.org/x/tools/go/analysis/passes/cgocall/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/composite/BUILD.bazel c/go/analysis/passes/composite/BUILD.bazel
+--- b/go/analysis/passes/composite/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/composite/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "composite",
++ srcs = [
++ "composite.go",
++ "whitelist.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/composite",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":composite",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "composite_test",
++ srcs = ["composite_test.go"],
++ deps = [
++ ":composite",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/composite/testdata/src/a/BUILD.bazel c/go/analysis/passes/composite/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/composite/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/composite/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/composite/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "a_test",
++ srcs = ["a_fuzz_test.go"],
++ embed = [":a"],
++)
+diff -urN b/go/analysis/passes/composite/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/composite/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/composite/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/composite/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/composite/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/composite/testdata/src/typeparams/lib/BUILD.bazel c/go/analysis/passes/composite/testdata/src/typeparams/lib/BUILD.bazel
+--- b/go/analysis/passes/composite/testdata/src/typeparams/lib/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/composite/testdata/src/typeparams/lib/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "lib",
++ srcs = ["lib.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/composite/testdata/src/typeparams/lib",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":lib",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/copylock/BUILD.bazel c/go/analysis/passes/copylock/BUILD.bazel
+--- b/go/analysis/passes/copylock/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/copylock/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "copylock",
++ srcs = ["copylock.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/copylock",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/analysis/passes/internal/analysisutil",
++ "//go/ast/inspector",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":copylock",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "copylock_test",
++ srcs = ["copylock_test.go"],
++ deps = [
++ ":copylock",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/copylock/testdata/src/a/BUILD.bazel c/go/analysis/passes/copylock/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/copylock/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/copylock/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = [
++ "copylock.go",
++ "copylock_func.go",
++ "copylock_range.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/copylock/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/copylock/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/copylock/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/copylock/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/copylock/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/copylock/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/ctrlflow/BUILD.bazel c/go/analysis/passes/ctrlflow/BUILD.bazel
+--- b/go/analysis/passes/ctrlflow/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/ctrlflow/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "ctrlflow",
++ srcs = ["ctrlflow.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/ctrlflow",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ "//go/cfg",
++ "//go/types/typeutil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":ctrlflow",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "ctrlflow_test",
++ srcs = ["ctrlflow_test.go"],
++ deps = [
++ ":ctrlflow",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/ctrlflow/testdata/src/a/BUILD.bazel c/go/analysis/passes/ctrlflow/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/ctrlflow/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/ctrlflow/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/ctrlflow/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/ctrlflow/testdata/src/lib/BUILD.bazel c/go/analysis/passes/ctrlflow/testdata/src/lib/BUILD.bazel
+--- b/go/analysis/passes/ctrlflow/testdata/src/lib/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/ctrlflow/testdata/src/lib/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "lib",
++ srcs = ["lib.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/ctrlflow/testdata/src/lib",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":lib",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/ctrlflow/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/ctrlflow/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/ctrlflow/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/ctrlflow/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/ctrlflow/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/deepequalerrors/BUILD.bazel c/go/analysis/passes/deepequalerrors/BUILD.bazel
+--- b/go/analysis/passes/deepequalerrors/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/deepequalerrors/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "deepequalerrors",
++ srcs = ["deepequalerrors.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/deepequalerrors",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ "//go/types/typeutil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":deepequalerrors",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "deepequalerrors_test",
++ srcs = ["deepequalerrors_test.go"],
++ deps = [
++ ":deepequalerrors",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/deepequalerrors/testdata/src/a/BUILD.bazel c/go/analysis/passes/deepequalerrors/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/deepequalerrors/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/deepequalerrors/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/deepequalerrors/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/deepequalerrors/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/deepequalerrors/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/deepequalerrors/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/deepequalerrors/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/deepequalerrors/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/directive/BUILD.bazel c/go/analysis/passes/directive/BUILD.bazel
+--- b/go/analysis/passes/directive/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/directive/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "directive",
++ srcs = ["directive.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/directive",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/internal/analysisutil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":directive",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "directive_test",
++ srcs = ["directive_test.go"],
++ deps = [
++ ":directive",
++ "//go/analysis",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/directive/testdata/src/a/BUILD.bazel c/go/analysis/passes/directive/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/directive/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/directive/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "a",
++ srcs = [
++ "misplaced.s",
++ "p.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/directive/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "a_test",
++ srcs = ["misplaced_test.go"],
++)
+diff -urN b/go/analysis/passes/errorsas/BUILD.bazel c/go/analysis/passes/errorsas/BUILD.bazel
+--- b/go/analysis/passes/errorsas/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/errorsas/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "errorsas",
++ srcs = ["errorsas.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/errorsas",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ "//go/types/typeutil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":errorsas",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "errorsas_test",
++ srcs = ["errorsas_test.go"],
++ deps = [
++ ":errorsas",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/errorsas/testdata/src/a/BUILD.bazel c/go/analysis/passes/errorsas/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/errorsas/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/errorsas/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/errorsas/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/errorsas/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/errorsas/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/errorsas/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/errorsas/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/errorsas/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/fieldalignment/BUILD.bazel c/go/analysis/passes/fieldalignment/BUILD.bazel
+--- b/go/analysis/passes/fieldalignment/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/fieldalignment/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "fieldalignment",
++ srcs = ["fieldalignment.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/fieldalignment",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fieldalignment",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "fieldalignment_test",
++ srcs = ["fieldalignment_test.go"],
++ deps = [
++ ":fieldalignment",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/fieldalignment/cmd/fieldalignment/BUILD.bazel c/go/analysis/passes/fieldalignment/cmd/fieldalignment/BUILD.bazel
+--- b/go/analysis/passes/fieldalignment/cmd/fieldalignment/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/fieldalignment/cmd/fieldalignment/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "fieldalignment_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//go/analysis/passes/fieldalignment",
++ "//go/analysis/singlechecker",
++ ],
++)
++
++go_binary(
++ name = "fieldalignment",
++ embed = [":fieldalignment_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/fieldalignment/testdata/src/a/BUILD.bazel c/go/analysis/passes/fieldalignment/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/fieldalignment/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/fieldalignment/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = [
++ "a.go",
++ "a_386.go",
++ "a_amd64.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/fieldalignment/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/findcall/BUILD.bazel c/go/analysis/passes/findcall/BUILD.bazel
+--- b/go/analysis/passes/findcall/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/findcall/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "findcall",
++ srcs = ["findcall.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/findcall",
++ visibility = ["//visibility:public"],
++ deps = ["//go/analysis"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":findcall",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "findcall_test",
++ srcs = ["findcall_test.go"],
++ deps = [
++ ":findcall",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/findcall/cmd/findcall/BUILD.bazel c/go/analysis/passes/findcall/cmd/findcall/BUILD.bazel
+--- b/go/analysis/passes/findcall/cmd/findcall/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/findcall/cmd/findcall/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "findcall_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/findcall/cmd/findcall",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//go/analysis/passes/findcall",
++ "//go/analysis/singlechecker",
++ ],
++)
++
++go_binary(
++ name = "findcall",
++ embed = [":findcall_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/findcall/testdata/src/a/BUILD.bazel c/go/analysis/passes/findcall/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/findcall/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/findcall/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "a_lib",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/findcall/testdata/src/a",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "a",
++ embed = [":a_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/framepointer/BUILD.bazel c/go/analysis/passes/framepointer/BUILD.bazel
+--- b/go/analysis/passes/framepointer/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/framepointer/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "framepointer",
++ srcs = ["framepointer.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/framepointer",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/internal/analysisutil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":framepointer",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "framepointer_test",
++ srcs = ["framepointer_test.go"],
++ deps = [
++ ":framepointer",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/framepointer/testdata/src/a/BUILD.bazel c/go/analysis/passes/framepointer/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/framepointer/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/framepointer/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = [
++ "asm.go",
++ "asm_amd64.s",
++ "asm_darwin_amd64.s",
++ "asm_linux_amd64.s",
++ "asm_windows_amd64.s",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/framepointer/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/httpresponse/BUILD.bazel c/go/analysis/passes/httpresponse/BUILD.bazel
+--- b/go/analysis/passes/httpresponse/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/httpresponse/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "httpresponse",
++ srcs = ["httpresponse.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/httpresponse",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/analysis/passes/internal/analysisutil",
++ "//go/ast/inspector",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":httpresponse",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "httpresponse_test",
++ srcs = ["httpresponse_test.go"],
++ deps = [
++ ":httpresponse",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/httpresponse/testdata/src/a/BUILD.bazel c/go/analysis/passes/httpresponse/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/httpresponse/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/httpresponse/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/httpresponse/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/httpresponse/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/httpresponse/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/httpresponse/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/httpresponse/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/httpresponse/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/ifaceassert/BUILD.bazel c/go/analysis/passes/ifaceassert/BUILD.bazel
+--- b/go/analysis/passes/ifaceassert/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/ifaceassert/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "ifaceassert",
++ srcs = [
++ "ifaceassert.go",
++ "parameterized.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/ifaceassert",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":ifaceassert",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "ifaceassert_test",
++ srcs = ["ifaceassert_test.go"],
++ deps = [
++ ":ifaceassert",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/ifaceassert/cmd/ifaceassert/BUILD.bazel c/go/analysis/passes/ifaceassert/cmd/ifaceassert/BUILD.bazel
+--- b/go/analysis/passes/ifaceassert/cmd/ifaceassert/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/ifaceassert/cmd/ifaceassert/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "ifaceassert_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/ifaceassert/cmd/ifaceassert",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//go/analysis/passes/ifaceassert",
++ "//go/analysis/singlechecker",
++ ],
++)
++
++go_binary(
++ name = "ifaceassert",
++ embed = [":ifaceassert_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/ifaceassert/testdata/src/a/BUILD.bazel c/go/analysis/passes/ifaceassert/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/ifaceassert/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/ifaceassert/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/ifaceassert/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/ifaceassert/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/ifaceassert/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/ifaceassert/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/ifaceassert/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/ifaceassert/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/inspect/BUILD.bazel c/go/analysis/passes/inspect/BUILD.bazel
+--- b/go/analysis/passes/inspect/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/inspect/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "inspect",
++ srcs = ["inspect.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/inspect",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/ast/inspector",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":inspect",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/internal/analysisutil/BUILD.bazel c/go/analysis/passes/internal/analysisutil/BUILD.bazel
+--- b/go/analysis/passes/internal/analysisutil/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/internal/analysisutil/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "analysisutil",
++ srcs = ["util.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/internal/analysisutil",
++ visibility = ["//go/analysis/passes:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":analysisutil",
++ visibility = ["//go/analysis/passes:__subpackages__"],
++)
++
++go_test(
++ name = "analysisutil_test",
++ srcs = ["util_test.go"],
++ deps = [
++ ":analysisutil",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/loopclosure/BUILD.bazel c/go/analysis/passes/loopclosure/BUILD.bazel
+--- b/go/analysis/passes/loopclosure/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/loopclosure/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "loopclosure",
++ srcs = ["loopclosure.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/loopclosure",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ "//go/types/typeutil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":loopclosure",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "loopclosure_test",
++ srcs = ["loopclosure_test.go"],
++ deps = [
++ ":loopclosure",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/loopclosure/testdata/src/a/BUILD.bazel c/go/analysis/passes/loopclosure/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/loopclosure/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/loopclosure/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = [
++ "a.go",
++ "b.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/loopclosure/testdata/src/a",
++ visibility = ["//visibility:public"],
++ deps = ["@org_golang_x_sync//errgroup:go_default_library"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/loopclosure/testdata/src/golang.org/x/sync/errgroup/BUILD.bazel c/go/analysis/passes/loopclosure/testdata/src/golang.org/x/sync/errgroup/BUILD.bazel
+--- b/go/analysis/passes/loopclosure/testdata/src/golang.org/x/sync/errgroup/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/loopclosure/testdata/src/golang.org/x/sync/errgroup/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "errgroup",
++ srcs = ["errgroup.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/loopclosure/testdata/src/golang.org/x/sync/errgroup",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":errgroup",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/loopclosure/testdata/src/subtests/BUILD.bazel c/go/analysis/passes/loopclosure/testdata/src/subtests/BUILD.bazel
+--- b/go/analysis/passes/loopclosure/testdata/src/subtests/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/loopclosure/testdata/src/subtests/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "subtests",
++ srcs = ["subtest.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/loopclosure/testdata/src/subtests",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":subtests",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/loopclosure/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/loopclosure/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/loopclosure/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/loopclosure/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/loopclosure/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++ deps = ["@org_golang_x_sync//errgroup:go_default_library"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/lostcancel/BUILD.bazel c/go/analysis/passes/lostcancel/BUILD.bazel
+--- b/go/analysis/passes/lostcancel/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/lostcancel/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "lostcancel",
++ srcs = ["lostcancel.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/lostcancel",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/ctrlflow",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ "//go/cfg",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":lostcancel",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "lostcancel_test",
++ srcs = ["lostcancel_test.go"],
++ deps = [
++ ":lostcancel",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/lostcancel/cmd/lostcancel/BUILD.bazel c/go/analysis/passes/lostcancel/cmd/lostcancel/BUILD.bazel
+--- b/go/analysis/passes/lostcancel/cmd/lostcancel/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/lostcancel/cmd/lostcancel/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "lostcancel_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/lostcancel/cmd/lostcancel",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//go/analysis/passes/lostcancel",
++ "//go/analysis/singlechecker",
++ ],
++)
++
++go_binary(
++ name = "lostcancel",
++ embed = [":lostcancel_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/lostcancel/testdata/src/a/BUILD.bazel c/go/analysis/passes/lostcancel/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/lostcancel/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/lostcancel/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/lostcancel/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/lostcancel/testdata/src/b/BUILD.bazel c/go/analysis/passes/lostcancel/testdata/src/b/BUILD.bazel
+--- b/go/analysis/passes/lostcancel/testdata/src/b/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/lostcancel/testdata/src/b/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "b_lib",
++ srcs = ["b.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/lostcancel/testdata/src/b",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "b",
++ embed = [":b_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/lostcancel/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/lostcancel/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/lostcancel/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/lostcancel/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/lostcancel/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/nilfunc/BUILD.bazel c/go/analysis/passes/nilfunc/BUILD.bazel
+--- b/go/analysis/passes/nilfunc/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/nilfunc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "nilfunc",
++ srcs = ["nilfunc.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/nilfunc",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":nilfunc",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "nilfunc_test",
++ srcs = ["nilfunc_test.go"],
++ deps = [
++ ":nilfunc",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/nilfunc/testdata/src/a/BUILD.bazel c/go/analysis/passes/nilfunc/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/nilfunc/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/nilfunc/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/nilfunc/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/nilfunc/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/nilfunc/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/nilfunc/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/nilfunc/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/nilfunc/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/nilness/BUILD.bazel c/go/analysis/passes/nilness/BUILD.bazel
+--- b/go/analysis/passes/nilness/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/nilness/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,33 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "nilness",
++ srcs = ["nilness.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/nilness",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/buildssa",
++ "//go/ssa",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":nilness",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "nilness_test",
++ srcs = [
++ "nilness_go117_test.go",
++ "nilness_test.go",
++ ],
++ deps = [
++ ":nilness",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/nilness/cmd/nilness/BUILD.bazel c/go/analysis/passes/nilness/cmd/nilness/BUILD.bazel
+--- b/go/analysis/passes/nilness/cmd/nilness/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/nilness/cmd/nilness/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "nilness_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/nilness/cmd/nilness",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//go/analysis/passes/nilness",
++ "//go/analysis/singlechecker",
++ ],
++)
++
++go_binary(
++ name = "nilness",
++ embed = [":nilness_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/nilness/testdata/src/a/BUILD.bazel c/go/analysis/passes/nilness/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/nilness/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/nilness/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/nilness/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/nilness/testdata/src/b/BUILD.bazel c/go/analysis/passes/nilness/testdata/src/b/BUILD.bazel
+--- b/go/analysis/passes/nilness/testdata/src/b/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/nilness/testdata/src/b/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "b",
++ srcs = ["b.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/nilness/testdata/src/b",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":b",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/nilness/testdata/src/c/BUILD.bazel c/go/analysis/passes/nilness/testdata/src/c/BUILD.bazel
+--- b/go/analysis/passes/nilness/testdata/src/c/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/nilness/testdata/src/c/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "c",
++ srcs = ["c.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/nilness/testdata/src/c",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":c",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/nilness/testdata/src/d/BUILD.bazel c/go/analysis/passes/nilness/testdata/src/d/BUILD.bazel
+--- b/go/analysis/passes/nilness/testdata/src/d/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/nilness/testdata/src/d/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "d",
++ srcs = ["d.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/nilness/testdata/src/d",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":d",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/pkgfact/BUILD.bazel c/go/analysis/passes/pkgfact/BUILD.bazel
+--- b/go/analysis/passes/pkgfact/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/pkgfact/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "pkgfact",
++ srcs = ["pkgfact.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/pkgfact",
++ visibility = ["//visibility:public"],
++ deps = ["//go/analysis"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":pkgfact",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "pkgfact_test",
++ srcs = ["pkgfact_test.go"],
++ deps = [
++ ":pkgfact",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/pkgfact/testdata/src/a/BUILD.bazel c/go/analysis/passes/pkgfact/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/pkgfact/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/pkgfact/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/pkgfact/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/pkgfact/testdata/src/b/BUILD.bazel c/go/analysis/passes/pkgfact/testdata/src/b/BUILD.bazel
+--- b/go/analysis/passes/pkgfact/testdata/src/b/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/pkgfact/testdata/src/b/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "b",
++ srcs = ["b.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/pkgfact/testdata/src/b",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":b",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/pkgfact/testdata/src/c/BUILD.bazel c/go/analysis/passes/pkgfact/testdata/src/c/BUILD.bazel
+--- b/go/analysis/passes/pkgfact/testdata/src/c/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/pkgfact/testdata/src/c/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "c",
++ srcs = ["c.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/pkgfact/testdata/src/c",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":c",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/printf/BUILD.bazel c/go/analysis/passes/printf/BUILD.bazel
+--- b/go/analysis/passes/printf/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/printf/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "printf",
++ srcs = [
++ "printf.go",
++ "types.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/printf",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/analysis/passes/internal/analysisutil",
++ "//go/ast/inspector",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":printf",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "printf_test",
++ srcs = ["printf_test.go"],
++ deps = [
++ ":printf",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/printf/testdata/src/a/BUILD.bazel c/go/analysis/passes/printf/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/printf/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/printf/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/printf/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/printf/testdata/src/b/BUILD.bazel c/go/analysis/passes/printf/testdata/src/b/BUILD.bazel
+--- b/go/analysis/passes/printf/testdata/src/b/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/printf/testdata/src/b/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "b",
++ srcs = ["b.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/printf/testdata/src/b",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":b",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/printf/testdata/src/nofmt/BUILD.bazel c/go/analysis/passes/printf/testdata/src/nofmt/BUILD.bazel
+--- b/go/analysis/passes/printf/testdata/src/nofmt/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/printf/testdata/src/nofmt/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "nofmt",
++ srcs = ["nofmt.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/printf/testdata/src/nofmt",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":nofmt",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/printf/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/printf/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/printf/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/printf/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = [
++ "diagnostics.go",
++ "wrappers.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/printf/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/reflectvaluecompare/BUILD.bazel c/go/analysis/passes/reflectvaluecompare/BUILD.bazel
+--- b/go/analysis/passes/reflectvaluecompare/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/reflectvaluecompare/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "reflectvaluecompare",
++ srcs = ["reflectvaluecompare.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/reflectvaluecompare",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ "//go/types/typeutil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":reflectvaluecompare",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "reflectvaluecompare_test",
++ srcs = ["reflectvaluecompare_test.go"],
++ deps = [
++ ":reflectvaluecompare",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/reflectvaluecompare/testdata/src/a/BUILD.bazel c/go/analysis/passes/reflectvaluecompare/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/reflectvaluecompare/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/reflectvaluecompare/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/reflectvaluecompare/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/shadow/BUILD.bazel c/go/analysis/passes/shadow/BUILD.bazel
+--- b/go/analysis/passes/shadow/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/shadow/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "shadow",
++ srcs = ["shadow.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/shadow",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":shadow",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "shadow_test",
++ srcs = ["shadow_test.go"],
++ deps = [
++ ":shadow",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/shadow/cmd/shadow/BUILD.bazel c/go/analysis/passes/shadow/cmd/shadow/BUILD.bazel
+--- b/go/analysis/passes/shadow/cmd/shadow/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/shadow/cmd/shadow/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "shadow_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/shadow/cmd/shadow",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//go/analysis/passes/shadow",
++ "//go/analysis/singlechecker",
++ ],
++)
++
++go_binary(
++ name = "shadow",
++ embed = [":shadow_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/shadow/testdata/src/a/BUILD.bazel c/go/analysis/passes/shadow/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/shadow/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/shadow/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/shadow/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/shift/BUILD.bazel c/go/analysis/passes/shift/BUILD.bazel
+--- b/go/analysis/passes/shift/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/shift/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "shift",
++ srcs = [
++ "dead.go",
++ "shift.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/shift",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/analysis/passes/internal/analysisutil",
++ "//go/ast/inspector",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":shift",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "shift_test",
++ srcs = ["shift_test.go"],
++ deps = [
++ ":shift",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/shift/testdata/src/a/BUILD.bazel c/go/analysis/passes/shift/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/shift/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/shift/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/shift/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/shift/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/shift/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/shift/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/shift/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/shift/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/sigchanyzer/BUILD.bazel c/go/analysis/passes/sigchanyzer/BUILD.bazel
+--- b/go/analysis/passes/sigchanyzer/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/sigchanyzer/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "sigchanyzer",
++ srcs = ["sigchanyzer.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/sigchanyzer",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sigchanyzer",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "sigchanyzer_test",
++ srcs = ["sigchanyzer_test.go"],
++ deps = [
++ ":sigchanyzer",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/sigchanyzer/testdata/src/a/BUILD.bazel c/go/analysis/passes/sigchanyzer/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/sigchanyzer/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/sigchanyzer/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/sigchanyzer/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/sortslice/BUILD.bazel c/go/analysis/passes/sortslice/BUILD.bazel
+--- b/go/analysis/passes/sortslice/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/sortslice/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "sortslice",
++ srcs = ["analyzer.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/sortslice",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ "//go/types/typeutil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sortslice",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "sortslice_test",
++ srcs = ["analyzer_test.go"],
++ deps = [
++ ":sortslice",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/sortslice/testdata/src/a/BUILD.bazel c/go/analysis/passes/sortslice/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/sortslice/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/sortslice/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/sortslice/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/stdmethods/BUILD.bazel c/go/analysis/passes/stdmethods/BUILD.bazel
+--- b/go/analysis/passes/stdmethods/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/stdmethods/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "stdmethods",
++ srcs = ["stdmethods.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/stdmethods",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":stdmethods",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "stdmethods_test",
++ srcs = ["stdmethods_test.go"],
++ deps = [
++ ":stdmethods",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/stdmethods/testdata/src/a/BUILD.bazel c/go/analysis/passes/stdmethods/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/stdmethods/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/stdmethods/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = [
++ "a.go",
++ "b.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/stdmethods/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/stdmethods/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/stdmethods/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/stdmethods/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/stdmethods/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/stdmethods/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/stringintconv/BUILD.bazel c/go/analysis/passes/stringintconv/BUILD.bazel
+--- b/go/analysis/passes/stringintconv/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/stringintconv/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "stringintconv",
++ srcs = ["string.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/stringintconv",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":stringintconv",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "stringintconv_test",
++ srcs = ["string_test.go"],
++ deps = [
++ ":stringintconv",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/stringintconv/cmd/stringintconv/BUILD.bazel c/go/analysis/passes/stringintconv/cmd/stringintconv/BUILD.bazel
+--- b/go/analysis/passes/stringintconv/cmd/stringintconv/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/stringintconv/cmd/stringintconv/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "stringintconv_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/stringintconv/cmd/stringintconv",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//go/analysis/passes/stringintconv",
++ "//go/analysis/singlechecker",
++ ],
++)
++
++go_binary(
++ name = "stringintconv",
++ embed = [":stringintconv_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/stringintconv/testdata/src/a/BUILD.bazel c/go/analysis/passes/stringintconv/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/stringintconv/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/stringintconv/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/stringintconv/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/stringintconv/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/stringintconv/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/stringintconv/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/stringintconv/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/stringintconv/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/structtag/BUILD.bazel c/go/analysis/passes/structtag/BUILD.bazel
+--- b/go/analysis/passes/structtag/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/structtag/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "structtag",
++ srcs = ["structtag.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/structtag",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":structtag",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "structtag_test",
++ srcs = ["structtag_test.go"],
++ deps = [
++ ":structtag",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/structtag/testdata/src/a/b/BUILD.bazel c/go/analysis/passes/structtag/testdata/src/a/b/BUILD.bazel
+--- b/go/analysis/passes/structtag/testdata/src/a/b/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/structtag/testdata/src/a/b/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "b",
++ srcs = ["b.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/structtag/testdata/src/a/b",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":b",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/structtag/testdata/src/a/BUILD.bazel c/go/analysis/passes/structtag/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/structtag/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/structtag/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/structtag/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/testinggoroutine/BUILD.bazel c/go/analysis/passes/testinggoroutine/BUILD.bazel
+--- b/go/analysis/passes/testinggoroutine/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/testinggoroutine/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "testinggoroutine",
++ srcs = ["testinggoroutine.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/testinggoroutine",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/analysis/passes/internal/analysisutil",
++ "//go/ast/inspector",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":testinggoroutine",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "testinggoroutine_test",
++ srcs = ["testinggoroutine_test.go"],
++ deps = [
++ ":testinggoroutine",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/testinggoroutine/testdata/src/a/BUILD.bazel c/go/analysis/passes/testinggoroutine/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/testinggoroutine/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/testinggoroutine/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = [
++ "a.go",
++ "b.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/testinggoroutine/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/testinggoroutine/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/testinggoroutine/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/testinggoroutine/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/testinggoroutine/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/testinggoroutine/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/tests/BUILD.bazel c/go/analysis/passes/tests/BUILD.bazel
+--- b/go/analysis/passes/tests/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/tests/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "tests",
++ srcs = ["tests.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/tests",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//internal/analysisinternal",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":tests",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "tests_test",
++ srcs = ["tests_test.go"],
++ deps = [
++ ":tests",
++ "//go/analysis/analysistest",
++ "//internal/analysisinternal",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/tests/testdata/src/a/BUILD.bazel c/go/analysis/passes/tests/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/tests/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/tests/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/tests/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "a_test",
++ srcs = [
++ "a_test.go",
++ "ax_test.go",
++ "go118_test.go",
++ ],
++ embed = [":a"],
++)
+diff -urN b/go/analysis/passes/tests/testdata/src/b/BUILD.bazel c/go/analysis/passes/tests/testdata/src/b/BUILD.bazel
+--- b/go/analysis/passes/tests/testdata/src/b/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/tests/testdata/src/b/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "b",
++ srcs = ["b.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/tests/testdata/src/b",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":b",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/tests/testdata/src/b_x_test/BUILD.bazel c/go/analysis/passes/tests/testdata/src/b_x_test/BUILD.bazel
+--- b/go/analysis/passes/tests/testdata/src/b_x_test/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/tests/testdata/src/b_x_test/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,6 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_test")
++
++go_test(
++ name = "b_x_test_test",
++ srcs = ["b_test.go"],
++)
+diff -urN b/go/analysis/passes/tests/testdata/src/divergent/BUILD.bazel c/go/analysis/passes/tests/testdata/src/divergent/BUILD.bazel
+--- b/go/analysis/passes/tests/testdata/src/divergent/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/tests/testdata/src/divergent/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "divergent",
++ srcs = ["buf.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/tests/testdata/src/divergent",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":divergent",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "divergent_test",
++ srcs = ["buf_test.go"],
++ embed = [":divergent"],
++)
+diff -urN b/go/analysis/passes/tests/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/tests/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/tests/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/tests/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/tests/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "typeparams_test",
++ srcs = ["typeparams_test.go"],
++ embed = [":typeparams"],
++)
+diff -urN b/go/analysis/passes/timeformat/BUILD.bazel c/go/analysis/passes/timeformat/BUILD.bazel
+--- b/go/analysis/passes/timeformat/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/timeformat/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "timeformat",
++ srcs = ["timeformat.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/timeformat",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ "//go/types/typeutil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":timeformat",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "timeformat_test",
++ srcs = ["timeformat_test.go"],
++ deps = [
++ ":timeformat",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/timeformat/testdata/src/a/BUILD.bazel c/go/analysis/passes/timeformat/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/timeformat/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/timeformat/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/timeformat/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/timeformat/testdata/src/b/BUILD.bazel c/go/analysis/passes/timeformat/testdata/src/b/BUILD.bazel
+--- b/go/analysis/passes/timeformat/testdata/src/b/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/timeformat/testdata/src/b/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "b",
++ srcs = ["b.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/timeformat/testdata/src/b",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":b",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/unmarshal/BUILD.bazel c/go/analysis/passes/unmarshal/BUILD.bazel
+--- b/go/analysis/passes/unmarshal/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/unmarshal/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "unmarshal",
++ srcs = ["unmarshal.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/unmarshal",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unmarshal",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unmarshal_test",
++ srcs = ["unmarshal_test.go"],
++ deps = [
++ ":unmarshal",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/unmarshal/cmd/unmarshal/BUILD.bazel c/go/analysis/passes/unmarshal/cmd/unmarshal/BUILD.bazel
+--- b/go/analysis/passes/unmarshal/cmd/unmarshal/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/unmarshal/cmd/unmarshal/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "unmarshal_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/unmarshal/cmd/unmarshal",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//go/analysis/passes/unmarshal",
++ "//go/analysis/singlechecker",
++ ],
++)
++
++go_binary(
++ name = "unmarshal",
++ embed = [":unmarshal_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/unmarshal/testdata/src/a/BUILD.bazel c/go/analysis/passes/unmarshal/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/unmarshal/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/unmarshal/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/unmarshal/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/unmarshal/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/unmarshal/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/unmarshal/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/unmarshal/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/unmarshal/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/unreachable/BUILD.bazel c/go/analysis/passes/unreachable/BUILD.bazel
+--- b/go/analysis/passes/unreachable/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/unreachable/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "unreachable",
++ srcs = ["unreachable.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/unreachable",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unreachable",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unreachable_test",
++ srcs = ["unreachable_test.go"],
++ deps = [
++ ":unreachable",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/unreachable/testdata/src/a/BUILD.bazel c/go/analysis/passes/unreachable/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/unreachable/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/unreachable/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/unreachable/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/unsafeptr/BUILD.bazel c/go/analysis/passes/unsafeptr/BUILD.bazel
+--- b/go/analysis/passes/unsafeptr/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/unsafeptr/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "unsafeptr",
++ srcs = ["unsafeptr.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/unsafeptr",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/analysis/passes/internal/analysisutil",
++ "//go/ast/inspector",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unsafeptr",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unsafeptr_test",
++ srcs = ["unsafeptr_test.go"],
++ deps = [
++ ":unsafeptr",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/unsafeptr/testdata/src/a/BUILD.bazel c/go/analysis/passes/unsafeptr/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/unsafeptr/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/unsafeptr/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = [
++ "a.go",
++ "issue40701.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/passes/unsafeptr/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/unsafeptr/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/unsafeptr/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/unsafeptr/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/unsafeptr/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/unsafeptr/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/unusedresult/BUILD.bazel c/go/analysis/passes/unusedresult/BUILD.bazel
+--- b/go/analysis/passes/unusedresult/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/unusedresult/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "unusedresult",
++ srcs = ["unusedresult.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/unusedresult",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/analysis/passes/internal/analysisutil",
++ "//go/ast/inspector",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unusedresult",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unusedresult_test",
++ srcs = ["unusedresult_test.go"],
++ deps = [
++ ":unusedresult",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/unusedresult/testdata/src/a/BUILD.bazel c/go/analysis/passes/unusedresult/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/unusedresult/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/unusedresult/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/unusedresult/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/unusedresult/testdata/src/typeparams/BUILD.bazel c/go/analysis/passes/unusedresult/testdata/src/typeparams/BUILD.bazel
+--- b/go/analysis/passes/unusedresult/testdata/src/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/unusedresult/testdata/src/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "typeparams",
++ srcs = ["typeparams.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/unusedresult/testdata/src/typeparams",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/unusedresult/testdata/src/typeparams/userdefs/BUILD.bazel c/go/analysis/passes/unusedresult/testdata/src/typeparams/userdefs/BUILD.bazel
+--- b/go/analysis/passes/unusedresult/testdata/src/typeparams/userdefs/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/unusedresult/testdata/src/typeparams/userdefs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "userdefs",
++ srcs = ["userdefs.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/unusedresult/testdata/src/typeparams/userdefs",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":userdefs",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/unusedwrite/BUILD.bazel c/go/analysis/passes/unusedwrite/BUILD.bazel
+--- b/go/analysis/passes/unusedwrite/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/unusedwrite/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "unusedwrite",
++ srcs = ["unusedwrite.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/unusedwrite",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/buildssa",
++ "//go/ssa",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unusedwrite",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unusedwrite_test",
++ srcs = ["unusedwrite_test.go"],
++ deps = [
++ ":unusedwrite",
++ "//go/analysis/analysistest",
++ ],
++)
+diff -urN b/go/analysis/passes/unusedwrite/testdata/src/a/BUILD.bazel c/go/analysis/passes/unusedwrite/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/unusedwrite/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/unusedwrite/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["unusedwrite.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/unusedwrite/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/usesgenerics/BUILD.bazel c/go/analysis/passes/usesgenerics/BUILD.bazel
+--- b/go/analysis/passes/usesgenerics/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/usesgenerics/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "usesgenerics",
++ srcs = ["usesgenerics.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/usesgenerics",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/passes/inspect",
++ "//go/ast/inspector",
++ "//internal/typeparams/genericfeatures",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":usesgenerics",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "usesgenerics_test",
++ srcs = ["usesgenerics_test.go"],
++ deps = [
++ ":usesgenerics",
++ "//go/analysis/analysistest",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/analysis/passes/usesgenerics/testdata/src/a/BUILD.bazel c/go/analysis/passes/usesgenerics/testdata/src/a/BUILD.bazel
+--- b/go/analysis/passes/usesgenerics/testdata/src/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/usesgenerics/testdata/src/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/usesgenerics/testdata/src/a",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/usesgenerics/testdata/src/b/BUILD.bazel c/go/analysis/passes/usesgenerics/testdata/src/b/BUILD.bazel
+--- b/go/analysis/passes/usesgenerics/testdata/src/b/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/usesgenerics/testdata/src/b/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "b",
++ srcs = ["b.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/usesgenerics/testdata/src/b",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":b",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/usesgenerics/testdata/src/c/BUILD.bazel c/go/analysis/passes/usesgenerics/testdata/src/c/BUILD.bazel
+--- b/go/analysis/passes/usesgenerics/testdata/src/c/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/usesgenerics/testdata/src/c/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "c",
++ srcs = ["c.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/usesgenerics/testdata/src/c",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":c",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/passes/usesgenerics/testdata/src/d/BUILD.bazel c/go/analysis/passes/usesgenerics/testdata/src/d/BUILD.bazel
+--- b/go/analysis/passes/usesgenerics/testdata/src/d/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/passes/usesgenerics/testdata/src/d/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "d",
++ srcs = ["d.go"],
++ importpath = "golang.org/x/tools/go/analysis/passes/usesgenerics/testdata/src/d",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":d",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/singlechecker/BUILD.bazel c/go/analysis/singlechecker/BUILD.bazel
+--- b/go/analysis/singlechecker/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/singlechecker/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "singlechecker",
++ srcs = ["singlechecker.go"],
++ importpath = "golang.org/x/tools/go/analysis/singlechecker",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/internal/analysisflags",
++ "//go/analysis/internal/checker",
++ "//go/analysis/unitchecker",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":singlechecker",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/analysis/unitchecker/BUILD.bazel c/go/analysis/unitchecker/BUILD.bazel
+--- b/go/analysis/unitchecker/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/analysis/unitchecker/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "unitchecker",
++ srcs = [
++ "unitchecker.go",
++ "unitchecker112.go",
++ ],
++ importpath = "golang.org/x/tools/go/analysis/unitchecker",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/internal/analysisflags",
++ "//internal/facts",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unitchecker",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "unitchecker_test",
++ srcs = ["unitchecker_test.go"],
++ deps = [
++ ":unitchecker",
++ "//go/analysis/passes/assign",
++ "//go/analysis/passes/findcall",
++ "//go/analysis/passes/printf",
++ "//go/packages/packagestest",
++ ],
++)
+diff -urN b/go/ast/astutil/BUILD.bazel c/go/ast/astutil/BUILD.bazel
+--- b/go/ast/astutil/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ast/astutil/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,31 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "astutil",
++ srcs = [
++ "enclosing.go",
++ "imports.go",
++ "rewrite.go",
++ "util.go",
++ ],
++ importpath = "golang.org/x/tools/go/ast/astutil",
++ visibility = ["//visibility:public"],
++ deps = ["//internal/typeparams"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":astutil",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "astutil_test",
++ srcs = [
++ "enclosing_test.go",
++ "imports_test.go",
++ "rewrite_test.go",
++ ],
++ embed = [":astutil"],
++ deps = ["//internal/typeparams"],
++)
+diff -urN b/go/ast/inspector/BUILD.bazel c/go/ast/inspector/BUILD.bazel
+--- b/go/ast/inspector/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ast/inspector/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,27 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "inspector",
++ srcs = [
++ "inspector.go",
++ "typeof.go",
++ ],
++ importpath = "golang.org/x/tools/go/ast/inspector",
++ visibility = ["//visibility:public"],
++ deps = ["//internal/typeparams"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":inspector",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "inspector_test",
++ srcs = ["inspector_test.go"],
++ deps = [
++ ":inspector",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/buildutil/BUILD.bazel c/go/buildutil/BUILD.bazel
+--- b/go/buildutil/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/buildutil/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "buildutil",
++ srcs = [
++ "allpackages.go",
++ "fakecontext.go",
++ "overlay.go",
++ "tags.go",
++ "util.go",
++ ],
++ importpath = "golang.org/x/tools/go/buildutil",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":buildutil",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "buildutil_test",
++ srcs = [
++ "allpackages_test.go",
++ "overlay_test.go",
++ "tags_test.go",
++ "util_test.go",
++ "util_windows_test.go",
++ ],
++ deps = [
++ ":buildutil",
++ "//go/packages/packagestest",
++ ],
++)
+diff -urN b/go/callgraph/BUILD.bazel c/go/callgraph/BUILD.bazel
+--- b/go/callgraph/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/callgraph/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "callgraph",
++ srcs = [
++ "callgraph.go",
++ "util.go",
++ ],
++ importpath = "golang.org/x/tools/go/callgraph",
++ visibility = ["//visibility:public"],
++ deps = ["//go/ssa"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":callgraph",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "callgraph_test",
++ srcs = ["callgraph_test.go"],
++ deps = [
++ ":callgraph",
++ "//go/callgraph/cha",
++ "//go/callgraph/rta",
++ "//go/callgraph/static",
++ "//go/callgraph/vta",
++ "//go/loader",
++ "//go/pointer",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ ],
++)
+diff -urN b/go/callgraph/cha/BUILD.bazel c/go/callgraph/cha/BUILD.bazel
+--- b/go/callgraph/cha/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/callgraph/cha/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,132 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "cha",
++ srcs = ["cha.go"],
++ importpath = "golang.org/x/tools/go/callgraph/cha",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/callgraph",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//go/types/typeutil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":cha",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "cha_test",
++ srcs = ["cha_test.go"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ ":cha",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ ":cha",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ ":cha",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ ":cha",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ ":cha",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ ":cha",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:js": [
++ ":cha",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ ":cha",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ ":cha",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ ":cha",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:plan9": [
++ ":cha",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ ":cha",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ ":cha",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN b/go/callgraph/cha/testdata/BUILD.bazel c/go/callgraph/cha/testdata/BUILD.bazel
+--- b/go/callgraph/cha/testdata/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/callgraph/cha/testdata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "testdata_lib",
++ srcs = ["issue23925.go"],
++ importpath = "golang.org/x/tools/go/callgraph/cha/testdata",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "testdata",
++ embed = [":testdata_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/callgraph/rta/BUILD.bazel c/go/callgraph/rta/BUILD.bazel
+--- b/go/callgraph/rta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/callgraph/rta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,132 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "rta",
++ srcs = ["rta.go"],
++ importpath = "golang.org/x/tools/go/callgraph/rta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/callgraph",
++ "//go/ssa",
++ "//go/types/typeutil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":rta",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "rta_test",
++ srcs = ["rta_test.go"],
++ data = glob(["testdata/**"]),
++ deps = select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ ":rta",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ ":rta",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ ":rta",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ ":rta",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ ":rta",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ ":rta",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:js": [
++ ":rta",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ ":rta",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ ":rta",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ ":rta",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:plan9": [
++ ":rta",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ ":rta",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ ":rta",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN b/go/callgraph/static/BUILD.bazel c/go/callgraph/static/BUILD.bazel
+--- b/go/callgraph/static/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/callgraph/static/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "static",
++ srcs = ["static.go"],
++ importpath = "golang.org/x/tools/go/callgraph/static",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/callgraph",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":static",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "static_test",
++ srcs = ["static_test.go"],
++ deps = [
++ ":static",
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/callgraph/vta/BUILD.bazel c/go/callgraph/vta/BUILD.bazel
+--- b/go/callgraph/vta/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/callgraph/vta/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,50 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "vta",
++ srcs = [
++ "graph.go",
++ "propagation.go",
++ "utils.go",
++ "vta.go",
++ ],
++ importpath = "golang.org/x/tools/go/callgraph/vta",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/callgraph",
++ "//go/callgraph/vta/internal/trie",
++ "//go/ssa",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":vta",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "vta_test",
++ srcs = [
++ "graph_test.go",
++ "helpers_test.go",
++ "propagation_test.go",
++ "vta_go117_test.go",
++ "vta_test.go",
++ ],
++ embed = [":vta"],
++ deps = [
++ "//go/analysis",
++ "//go/analysis/analysistest",
++ "//go/analysis/passes/buildssa",
++ "//go/callgraph",
++ "//go/callgraph/cha",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/callgraph/vta/internal/trie/BUILD.bazel c/go/callgraph/vta/internal/trie/BUILD.bazel
+--- b/go/callgraph/vta/internal/trie/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/callgraph/vta/internal/trie/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "trie",
++ srcs = [
++ "bits.go",
++ "builder.go",
++ "scope.go",
++ "trie.go",
++ ],
++ importpath = "golang.org/x/tools/go/callgraph/vta/internal/trie",
++ visibility = ["//go/callgraph/vta:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":trie",
++ visibility = ["//go/callgraph/vta:__subpackages__"],
++)
++
++go_test(
++ name = "trie_test",
++ srcs = [
++ "bits_test.go",
++ "op_test.go",
++ "trie_test.go",
++ ],
++ embed = [":trie"],
++)
+diff -urN b/go/callgraph/vta/testdata/src/BUILD.bazel c/go/callgraph/vta/testdata/src/BUILD.bazel
+--- b/go/callgraph/vta/testdata/src/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/callgraph/vta/testdata/src/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,47 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "src",
++ srcs = [
++ "callgraph_collections.go",
++ "callgraph_field_funcs.go",
++ "callgraph_fields.go",
++ "callgraph_generics.go",
++ "callgraph_ho.go",
++ "callgraph_interfaces.go",
++ "callgraph_issue_57756.go",
++ "callgraph_nested_ptr.go",
++ "callgraph_pointers.go",
++ "callgraph_recursive_types.go",
++ "callgraph_static.go",
++ "channels.go",
++ "closures.go",
++ "dynamic_calls.go",
++ "fields.go",
++ "function_alias.go",
++ "go117.go",
++ "maps.go",
++ "node_uniqueness.go",
++ "panic.go",
++ "phi.go",
++ "phi_alias.go",
++ "ranges.go",
++ "returns.go",
++ "select.go",
++ "simple.go",
++ "static_calls.go",
++ "store.go",
++ "store_load_alias.go",
++ "stores_arrays.go",
++ "type_assertions.go",
++ "type_conversions.go",
++ ],
++ importpath = "golang.org/x/tools/go/callgraph/vta/testdata/src",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":src",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/callgraph/vta/testdata/src/d/BUILD.bazel c/go/callgraph/vta/testdata/src/d/BUILD.bazel
+--- b/go/callgraph/vta/testdata/src/d/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/callgraph/vta/testdata/src/d/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "d",
++ srcs = ["d.go"],
++ importpath = "golang.org/x/tools/go/callgraph/vta/testdata/src/d",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":d",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/callgraph/vta/testdata/src/t/BUILD.bazel c/go/callgraph/vta/testdata/src/t/BUILD.bazel
+--- b/go/callgraph/vta/testdata/src/t/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/callgraph/vta/testdata/src/t/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "t",
++ srcs = ["t.go"],
++ importpath = "golang.org/x/tools/go/callgraph/vta/testdata/src/t",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":t",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/cfg/BUILD.bazel c/go/cfg/BUILD.bazel
+--- b/go/cfg/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/cfg/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "cfg",
++ srcs = [
++ "builder.go",
++ "cfg.go",
++ ],
++ importpath = "golang.org/x/tools/go/cfg",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":cfg",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "cfg_test",
++ srcs = ["cfg_test.go"],
++ embed = [":cfg"],
++)
+diff -urN b/go/expect/BUILD.bazel c/go/expect/BUILD.bazel
+--- b/go/expect/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/expect/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "expect",
++ srcs = [
++ "expect.go",
++ "extract.go",
++ ],
++ importpath = "golang.org/x/tools/go/expect",
++ visibility = ["//visibility:public"],
++ deps = ["@org_golang_x_mod//modfile:go_default_library"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":expect",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "expect_test",
++ srcs = ["expect_test.go"],
++ deps = [":expect"],
++)
+diff -urN b/go/expect/testdata/BUILD.bazel c/go/expect/testdata/BUILD.bazel
+--- b/go/expect/testdata/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/expect/testdata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "testdata",
++ srcs = ["test.go"],
++ importpath = "golang.org/x/tools/go/expect/testdata",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":testdata",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/gccgoexportdata/BUILD.bazel c/go/gccgoexportdata/BUILD.bazel
+--- b/go/gccgoexportdata/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/gccgoexportdata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "gccgoexportdata",
++ srcs = ["gccgoexportdata.go"],
++ importpath = "golang.org/x/tools/go/gccgoexportdata",
++ visibility = ["//visibility:public"],
++ deps = ["//go/internal/gccgoimporter"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gccgoexportdata",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "gccgoexportdata_test",
++ srcs = ["gccgoexportdata_test.go"],
++ data = glob(["testdata/**"]),
++ deps = [":gccgoexportdata"],
++)
+diff -urN b/go/gcexportdata/BUILD.bazel c/go/gcexportdata/BUILD.bazel
+--- b/go/gcexportdata/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/gcexportdata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,59 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "gcexportdata",
++ srcs = [
++ "gcexportdata.go",
++ "importer.go",
++ ],
++ importpath = "golang.org/x/tools/go/gcexportdata",
++ visibility = ["//visibility:public"],
++ deps = ["//internal/gcimporter"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gcexportdata",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "gcexportdata_test",
++ srcs = ["example_test.go"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ ":gcexportdata",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ ":gcexportdata",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ ":gcexportdata",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ ":gcexportdata",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ ":gcexportdata",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ ":gcexportdata",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ ":gcexportdata",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ ":gcexportdata",
++ ],
++ "@io_bazel_rules_go//go/platform:plan9": [
++ ":gcexportdata",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ ":gcexportdata",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ ":gcexportdata",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN b/go/internal/cgo/BUILD.bazel c/go/internal/cgo/BUILD.bazel
+--- b/go/internal/cgo/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/internal/cgo/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "cgo",
++ srcs = [
++ "cgo.go",
++ "cgo_pkgconfig.go",
++ ],
++ importpath = "golang.org/x/tools/go/internal/cgo",
++ visibility = ["//go:__subpackages__"],
++ deps = ["@org_golang_x_sys//execabs:go_default_library"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":cgo",
++ visibility = ["//go:__subpackages__"],
++)
+diff -urN b/go/internal/gccgoimporter/BUILD.bazel c/go/internal/gccgoimporter/BUILD.bazel
+--- b/go/internal/gccgoimporter/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/internal/gccgoimporter/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,35 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "gccgoimporter",
++ srcs = [
++ "ar.go",
++ "backdoor.go",
++ "gccgoinstallation.go",
++ "importer.go",
++ "newInterface10.go",
++ "newInterface11.go",
++ "parser.go",
++ ],
++ importpath = "golang.org/x/tools/go/internal/gccgoimporter",
++ visibility = ["//go:__subpackages__"],
++ deps = ["@org_golang_x_sys//execabs:go_default_library"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gccgoimporter",
++ visibility = ["//go:__subpackages__"],
++)
++
++go_test(
++ name = "gccgoimporter_test",
++ srcs = [
++ "gccgoinstallation_test.go",
++ "importer_test.go",
++ "parser_test.go",
++ "testenv_test.go",
++ ],
++ data = glob(["testdata/**"]),
++ embed = [":gccgoimporter"],
++)
+diff -urN b/go/internal/packagesdriver/BUILD.bazel c/go/internal/packagesdriver/BUILD.bazel
+--- b/go/internal/packagesdriver/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/internal/packagesdriver/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "packagesdriver",
++ srcs = ["sizes.go"],
++ importpath = "golang.org/x/tools/go/internal/packagesdriver",
++ visibility = ["//go:__subpackages__"],
++ deps = ["//internal/gocommand"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":packagesdriver",
++ visibility = ["//go:__subpackages__"],
++)
+diff -urN b/go/loader/BUILD.bazel c/go/loader/BUILD.bazel
+--- b/go/loader/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/loader/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,37 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "loader",
++ srcs = [
++ "doc.go",
++ "loader.go",
++ "util.go",
++ ],
++ importpath = "golang.org/x/tools/go/loader",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/ast/astutil",
++ "//go/buildutil",
++ "//go/internal/cgo",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":loader",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "loader_test",
++ srcs = [
++ "loader_test.go",
++ "stdlib_test.go",
++ ],
++ deps = [
++ ":loader",
++ "//go/buildutil",
++ "//internal/testenv",
++ ],
++)
+diff -urN b/go/loader/testdata/BUILD.bazel c/go/loader/testdata/BUILD.bazel
+--- b/go/loader/testdata/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/loader/testdata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "testdata",
++ srcs = [
++ "a.go",
++ "b.go",
++ "badpkgdecl.go",
++ ],
++ importpath = "golang.org/x/tools/go/loader/testdata",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":testdata",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/loader/testdata/issue46877/BUILD.bazel c/go/loader/testdata/issue46877/BUILD.bazel
+--- b/go/loader/testdata/issue46877/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/loader/testdata/issue46877/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "issue46877",
++ srcs = [
++ "x.go",
++ "x.h",
++ ],
++ cgo = True,
++ importpath = "golang.org/x/tools/go/loader/testdata/issue46877",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue46877",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/packages/BUILD.bazel c/go/packages/BUILD.bazel
+--- b/go/packages/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/packages/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,47 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "packages",
++ srcs = [
++ "doc.go",
++ "external.go",
++ "golist.go",
++ "golist_overlay.go",
++ "loadmode_string.go",
++ "packages.go",
++ "visit.go",
++ ],
++ importpath = "golang.org/x/tools/go/packages",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/gcexportdata",
++ "//go/internal/packagesdriver",
++ "//internal/gocommand",
++ "//internal/packagesinternal",
++ "//internal/typeparams",
++ "//internal/typesinternal",
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":packages",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "packages_test",
++ srcs = [
++ "example_test.go",
++ "overlay_test.go",
++ "packages_test.go",
++ "stdlib_test.go",
++ ],
++ deps = [
++ ":packages",
++ "//go/packages/packagestest",
++ "//internal/packagesinternal",
++ "//internal/testenv",
++ ],
++)
+diff -urN b/go/packages/gopackages/BUILD.bazel c/go/packages/gopackages/BUILD.bazel
+--- b/go/packages/gopackages/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/packages/gopackages/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "gopackages_lib",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/go/packages/gopackages",
++ visibility = ["//visibility:private"],
++ deps = [
++ "//go/packages",
++ "//go/types/typeutil",
++ "//internal/tool",
++ ],
++)
++
++go_binary(
++ name = "gopackages",
++ embed = [":gopackages_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/packages/packagestest/BUILD.bazel c/go/packages/packagestest/BUILD.bazel
+--- b/go/packages/packagestest/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/packages/packagestest/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,42 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "packagestest",
++ srcs = [
++ "expect.go",
++ "export.go",
++ "gopath.go",
++ "modules.go",
++ "modules_111.go",
++ ],
++ importpath = "golang.org/x/tools/go/packages/packagestest",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/expect",
++ "//go/packages",
++ "//internal/gocommand",
++ "//internal/packagesinternal",
++ "//internal/proxydir",
++ "//internal/testenv",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":packagestest",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "packagestest_test",
++ srcs = [
++ "expect_test.go",
++ "export_test.go",
++ "gopath_test.go",
++ "modules_test.go",
++ ],
++ deps = [
++ ":packagestest",
++ "//go/expect",
++ ],
++)
+diff -urN b/go/packages/packagestest/testdata/BUILD.bazel c/go/packages/packagestest/testdata/BUILD.bazel
+--- b/go/packages/packagestest/testdata/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/packages/packagestest/testdata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "testdata",
++ srcs = ["test.go"],
++ importpath = "golang.org/x/tools/go/packages/packagestest/testdata",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":testdata",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "testdata_test",
++ srcs = [
++ "test_test.go",
++ "x_test.go",
++ ],
++ embed = [":testdata"],
++)
+diff -urN b/go/packages/packagestest/testdata/groups/one/modules/example.com/extra/BUILD.bazel c/go/packages/packagestest/testdata/groups/one/modules/example.com/extra/BUILD.bazel
+--- b/go/packages/packagestest/testdata/groups/one/modules/example.com/extra/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/packages/packagestest/testdata/groups/one/modules/example.com/extra/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "extra",
++ srcs = ["help.go"],
++ importpath = "golang.org/x/tools/go/packages/packagestest/testdata/groups/one/modules/example.com/extra",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":extra",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/packages/packagestest/testdata/groups/one/primarymod/BUILD.bazel c/go/packages/packagestest/testdata/groups/one/primarymod/BUILD.bazel
+--- b/go/packages/packagestest/testdata/groups/one/primarymod/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/packages/packagestest/testdata/groups/one/primarymod/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "primarymod",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/go/packages/packagestest/testdata/groups/one/primarymod",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":primarymod",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/BUILD.bazel c/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/BUILD.bazel
+--- b/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "extra",
++ srcs = ["yo.go"],
++ importpath = "golang.org/x/tools/go/packages/packagestest/testdata/groups/two/modules/example.com/extra",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":extra",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/geez/BUILD.bazel c/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/geez/BUILD.bazel
+--- b/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/geez/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/geez/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "geez",
++ srcs = ["help.go"],
++ importpath = "golang.org/x/tools/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/geez",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":geez",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/v2/BUILD.bazel c/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/v2/BUILD.bazel
+--- b/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "extra",
++ srcs = ["me.go"],
++ importpath = "golang.org/x/tools/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/v2",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":extra",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/v2/geez/BUILD.bazel c/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/v2/geez/BUILD.bazel
+--- b/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/v2/geez/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/v2/geez/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "geez",
++ srcs = ["help.go"],
++ importpath = "golang.org/x/tools/go/packages/packagestest/testdata/groups/two/modules/example.com/extra/v2/geez",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":geez",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/packages/packagestest/testdata/groups/two/modules/example.com/tempmod/BUILD.bazel c/go/packages/packagestest/testdata/groups/two/modules/example.com/tempmod/BUILD.bazel
+--- b/go/packages/packagestest/testdata/groups/two/modules/example.com/tempmod/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/packages/packagestest/testdata/groups/two/modules/example.com/tempmod/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "tempmod",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/go/packages/packagestest/testdata/groups/two/modules/example.com/tempmod",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":tempmod",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/packages/packagestest/testdata/groups/two/modules/example.com/what@v1.0.0/BUILD.bazel c/go/packages/packagestest/testdata/groups/two/modules/example.com/what@v1.0.0/BUILD.bazel
+--- b/go/packages/packagestest/testdata/groups/two/modules/example.com/what@v1.0.0/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/packages/packagestest/testdata/groups/two/modules/example.com/what@v1.0.0/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "what@v1_0_0",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/go/packages/packagestest/testdata/groups/two/modules/example.com/what@v1.0.0",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":what@v1_0_0",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/packages/packagestest/testdata/groups/two/modules/example.com/what@v1.1.0/BUILD.bazel c/go/packages/packagestest/testdata/groups/two/modules/example.com/what@v1.1.0/BUILD.bazel
+--- b/go/packages/packagestest/testdata/groups/two/modules/example.com/what@v1.1.0/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/packages/packagestest/testdata/groups/two/modules/example.com/what@v1.1.0/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "what@v1_1_0",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/go/packages/packagestest/testdata/groups/two/modules/example.com/what@v1.1.0",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":what@v1_1_0",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/packages/packagestest/testdata/groups/two/primarymod/BUILD.bazel c/go/packages/packagestest/testdata/groups/two/primarymod/BUILD.bazel
+--- b/go/packages/packagestest/testdata/groups/two/primarymod/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/packages/packagestest/testdata/groups/two/primarymod/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "primarymod",
++ srcs = ["main.go"],
++ importpath = "golang.org/x/tools/go/packages/packagestest/testdata/groups/two/primarymod",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":primarymod",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/packages/packagestest/testdata/groups/two/primarymod/expect/BUILD.bazel c/go/packages/packagestest/testdata/groups/two/primarymod/expect/BUILD.bazel
+--- b/go/packages/packagestest/testdata/groups/two/primarymod/expect/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/packages/packagestest/testdata/groups/two/primarymod/expect/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,19 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "expect",
++ srcs = ["yo.go"],
++ importpath = "golang.org/x/tools/go/packages/packagestest/testdata/groups/two/primarymod/expect",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":expect",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "expect_test",
++ srcs = ["yo_test.go"],
++)
+diff -urN b/go/pointer/BUILD.bazel c/go/pointer/BUILD.bazel
+--- b/go/pointer/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/pointer/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,124 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "pointer",
++ srcs = [
++ "analysis.go",
++ "api.go",
++ "callgraph.go",
++ "constraint.go",
++ "doc.go",
++ "gen.go",
++ "hvn.go",
++ "intrinsics.go",
++ "labels.go",
++ "opt.go",
++ "print.go",
++ "query.go",
++ "reflect.go",
++ "solve.go",
++ "util.go",
++ ],
++ importpath = "golang.org/x/tools/go/pointer",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//container/intsets",
++ "//go/callgraph",
++ "//go/ssa",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":pointer",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "pointer_test",
++ srcs = [
++ "example_test.go",
++ "pointer_go117_test.go",
++ "pointer_race_test.go",
++ "pointer_test.go",
++ "query_test.go",
++ "stdlib_test.go",
++ ],
++ embed = [":pointer"],
++ deps = [
++ "//go/callgraph",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ ] + select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ "//go/packages",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ "//go/packages",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ "//go/packages",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ "//go/packages",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ "//go/packages",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ "//go/packages",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:js": [
++ "//go/packages",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ "//go/packages",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ "//go/packages",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ "//go/packages",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:plan9": [
++ "//go/packages",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ "//go/packages",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ "//go/packages",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN b/go/pointer/testdata/BUILD.bazel c/go/pointer/testdata/BUILD.bazel
+--- b/go/pointer/testdata/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/pointer/testdata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "testdata_lib",
++ srcs = [
++ "finalizer.go",
++ "issue9002.go",
++ "rtti.go",
++ ],
++ importpath = "golang.org/x/tools/go/pointer/testdata",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "testdata",
++ embed = [":testdata_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/BUILD.bazel c/go/ssa/BUILD.bazel
+--- b/go/ssa/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,117 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "ssa",
++ srcs = [
++ "block.go",
++ "blockopt.go",
++ "builder.go",
++ "const.go",
++ "coretype.go",
++ "create.go",
++ "doc.go",
++ "dom.go",
++ "emit.go",
++ "func.go",
++ "identical.go",
++ "identical_17.go",
++ "instantiate.go",
++ "lift.go",
++ "lvalue.go",
++ "methods.go",
++ "mode.go",
++ "parameterized.go",
++ "print.go",
++ "sanity.go",
++ "source.go",
++ "ssa.go",
++ "subst.go",
++ "util.go",
++ "wrappers.go",
++ ],
++ importpath = "golang.org/x/tools/go/ssa",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/ast/astutil",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":ssa",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "ssa_test",
++ srcs = [
++ "builder_generic_test.go",
++ "builder_go117_test.go",
++ "builder_go120_test.go",
++ "builder_test.go",
++ "const_test.go",
++ "coretype_test.go",
++ "example_test.go",
++ "identical_test.go",
++ "instantiate_test.go",
++ "methods_test.go",
++ "parameterized_test.go",
++ "source_test.go",
++ "stdlib_test.go",
++ "subst_test.go",
++ "testhelper_test.go",
++ ],
++ embed = [":ssa"],
++ deps = [
++ "//go/ast/astutil",
++ "//go/buildutil",
++ "//go/expect",
++ "//go/loader",
++ "//go/ssa/ssautil",
++ "//internal/testenv",
++ "//internal/typeparams",
++ ] + select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ "//go/packages",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ "//go/packages",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ "//go/packages",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ "//go/packages",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ "//go/packages",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ "//go/packages",
++ ],
++ "@io_bazel_rules_go//go/platform:js": [
++ "//go/packages",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ "//go/packages",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ "//go/packages",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ "//go/packages",
++ ],
++ "@io_bazel_rules_go//go/platform:plan9": [
++ "//go/packages",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ "//go/packages",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ "//go/packages",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN b/go/ssa/interp/BUILD.bazel c/go/ssa/interp/BUILD.bazel
+--- b/go/ssa/interp/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,41 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "interp",
++ srcs = [
++ "external.go",
++ "interp.go",
++ "map.go",
++ "ops.go",
++ "reflect.go",
++ "value.go",
++ ],
++ importpath = "golang.org/x/tools/go/ssa/interp",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/ssa",
++ "//go/types/typeutil",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":interp",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "interp_test",
++ srcs = [
++ "interp_go117_test.go",
++ "interp_go120_test.go",
++ "interp_test.go",
++ ],
++ deps = [
++ ":interp",
++ "//go/loader",
++ "//go/ssa",
++ "//go/ssa/ssautil",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/ssa/interp/testdata/fixedbugs/BUILD.bazel c/go/ssa/interp/testdata/fixedbugs/BUILD.bazel
+--- b/go/ssa/interp/testdata/fixedbugs/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/fixedbugs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "fixedbugs_lib",
++ srcs = [
++ "issue52342.go",
++ "issue52835.go",
++ "issue55086.go",
++ ],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/fixedbugs",
++ visibility = ["//visibility:private"],
++)
++
++go_binary(
++ name = "fixedbugs",
++ embed = [":fixedbugs_lib"],
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/encoding/BUILD.bazel c/go/ssa/interp/testdata/src/encoding/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/encoding/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/encoding/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "encoding",
++ srcs = ["encoding.go"],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/encoding",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":encoding",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/errors/BUILD.bazel c/go/ssa/interp/testdata/src/errors/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/errors/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/errors/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "errors",
++ srcs = ["errors.go"],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/errors",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":errors",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/fmt/BUILD.bazel c/go/ssa/interp/testdata/src/fmt/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/fmt/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/fmt/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "fmt",
++ srcs = ["fmt.go"],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/fmt",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fmt",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/io/BUILD.bazel c/go/ssa/interp/testdata/src/io/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/io/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/io/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "io",
++ srcs = ["io.go"],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/io",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":io",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/log/BUILD.bazel c/go/ssa/interp/testdata/src/log/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/log/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/log/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "log",
++ srcs = ["log.go"],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/log",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":log",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/math/BUILD.bazel c/go/ssa/interp/testdata/src/math/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/math/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/math/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "math",
++ srcs = ["math.go"],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/math",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":math",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/os/BUILD.bazel c/go/ssa/interp/testdata/src/os/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/os/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/os/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "os",
++ srcs = ["os.go"],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/os",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":os",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/reflect/BUILD.bazel c/go/ssa/interp/testdata/src/reflect/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/reflect/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/reflect/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "reflect",
++ srcs = [
++ "deepequal.go",
++ "reflect.go",
++ ],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/reflect",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":reflect",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/runtime/BUILD.bazel c/go/ssa/interp/testdata/src/runtime/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/runtime/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/runtime/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "runtime",
++ srcs = ["runtime.go"],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/runtime",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":runtime",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/sort/BUILD.bazel c/go/ssa/interp/testdata/src/sort/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/sort/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/sort/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "sort",
++ srcs = ["sort.go"],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/sort",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sort",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/strconv/BUILD.bazel c/go/ssa/interp/testdata/src/strconv/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/strconv/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/strconv/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "strconv",
++ srcs = ["strconv.go"],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/strconv",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":strconv",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/strings/BUILD.bazel c/go/ssa/interp/testdata/src/strings/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/strings/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/strings/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "strings",
++ srcs = ["strings.go"],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/strings",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":strings",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/sync/BUILD.bazel c/go/ssa/interp/testdata/src/sync/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/sync/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/sync/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "sync",
++ srcs = ["sync.go"],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/sync",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sync",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/time/BUILD.bazel c/go/ssa/interp/testdata/src/time/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/time/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/time/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "time",
++ srcs = ["time.go"],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/time",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":time",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/unicode/utf8/BUILD.bazel c/go/ssa/interp/testdata/src/unicode/utf8/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/unicode/utf8/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/unicode/utf8/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "utf8",
++ srcs = ["utf8.go"],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/unicode/utf8",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":utf8",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/interp/testdata/src/unsafe/BUILD.bazel c/go/ssa/interp/testdata/src/unsafe/BUILD.bazel
+--- b/go/ssa/interp/testdata/src/unsafe/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/interp/testdata/src/unsafe/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "unsafe",
++ srcs = ["unsafe.go"],
++ importpath = "golang.org/x/tools/go/ssa/interp/testdata/src/unsafe",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unsafe",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/ssautil/BUILD.bazel c/go/ssa/ssautil/BUILD.bazel
+--- b/go/ssa/ssautil/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/ssautil/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,81 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "ssautil",
++ srcs = [
++ "load.go",
++ "switch.go",
++ "visit.go",
++ ],
++ importpath = "golang.org/x/tools/go/ssa/ssautil",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/loader",
++ "//go/packages",
++ "//go/ssa",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":ssautil",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "ssautil_test",
++ srcs = [
++ "load_test.go",
++ "switch_test.go",
++ ],
++ data = glob(["testdata/**"]),
++ deps = [
++ ":ssautil",
++ "//go/packages",
++ "//go/packages/packagestest",
++ "//go/ssa",
++ "//internal/testenv",
++ ] + select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ "//go/loader",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ "//go/loader",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ "//go/loader",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ "//go/loader",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ "//go/loader",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ "//go/loader",
++ ],
++ "@io_bazel_rules_go//go/platform:js": [
++ "//go/loader",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ "//go/loader",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ "//go/loader",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ "//go/loader",
++ ],
++ "@io_bazel_rules_go//go/platform:plan9": [
++ "//go/loader",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ "//go/loader",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ "//go/loader",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN b/go/ssa/testdata/src/bytes/BUILD.bazel c/go/ssa/testdata/src/bytes/BUILD.bazel
+--- b/go/ssa/testdata/src/bytes/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/bytes/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "bytes",
++ srcs = ["bytes.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/bytes",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":bytes",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/context/BUILD.bazel c/go/ssa/testdata/src/context/BUILD.bazel
+--- b/go/ssa/testdata/src/context/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/context/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "context",
++ srcs = ["context.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/context",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":context",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/encoding/BUILD.bazel c/go/ssa/testdata/src/encoding/BUILD.bazel
+--- b/go/ssa/testdata/src/encoding/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/encoding/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "encoding",
++ srcs = ["encoding.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/encoding",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":encoding",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/encoding/json/BUILD.bazel c/go/ssa/testdata/src/encoding/json/BUILD.bazel
+--- b/go/ssa/testdata/src/encoding/json/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/encoding/json/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "json",
++ srcs = ["json.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/encoding/json",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":json",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/encoding/xml/BUILD.bazel c/go/ssa/testdata/src/encoding/xml/BUILD.bazel
+--- b/go/ssa/testdata/src/encoding/xml/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/encoding/xml/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "xml",
++ srcs = ["xml.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/encoding/xml",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":xml",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/errors/BUILD.bazel c/go/ssa/testdata/src/errors/BUILD.bazel
+--- b/go/ssa/testdata/src/errors/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/errors/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "errors",
++ srcs = ["errors.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/errors",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":errors",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/fmt/BUILD.bazel c/go/ssa/testdata/src/fmt/BUILD.bazel
+--- b/go/ssa/testdata/src/fmt/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/fmt/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "fmt",
++ srcs = ["fmt.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/fmt",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fmt",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/io/BUILD.bazel c/go/ssa/testdata/src/io/BUILD.bazel
+--- b/go/ssa/testdata/src/io/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/io/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "io",
++ srcs = ["io.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/io",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":io",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/log/BUILD.bazel c/go/ssa/testdata/src/log/BUILD.bazel
+--- b/go/ssa/testdata/src/log/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/log/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "log",
++ srcs = ["log.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/log",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":log",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/math/BUILD.bazel c/go/ssa/testdata/src/math/BUILD.bazel
+--- b/go/ssa/testdata/src/math/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/math/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "math",
++ srcs = ["math.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/math",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":math",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/os/BUILD.bazel c/go/ssa/testdata/src/os/BUILD.bazel
+--- b/go/ssa/testdata/src/os/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/os/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "os",
++ srcs = ["os.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/os",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":os",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/reflect/BUILD.bazel c/go/ssa/testdata/src/reflect/BUILD.bazel
+--- b/go/ssa/testdata/src/reflect/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/reflect/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "reflect",
++ srcs = ["reflect.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/reflect",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":reflect",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/runtime/BUILD.bazel c/go/ssa/testdata/src/runtime/BUILD.bazel
+--- b/go/ssa/testdata/src/runtime/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/runtime/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "runtime",
++ srcs = ["runtime.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/runtime",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":runtime",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/sort/BUILD.bazel c/go/ssa/testdata/src/sort/BUILD.bazel
+--- b/go/ssa/testdata/src/sort/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/sort/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "sort",
++ srcs = ["sort.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/sort",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sort",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/strconv/BUILD.bazel c/go/ssa/testdata/src/strconv/BUILD.bazel
+--- b/go/ssa/testdata/src/strconv/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/strconv/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "strconv",
++ srcs = ["strconv.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/strconv",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":strconv",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/strings/BUILD.bazel c/go/ssa/testdata/src/strings/BUILD.bazel
+--- b/go/ssa/testdata/src/strings/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/strings/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "strings",
++ srcs = ["strings.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/strings",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":strings",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/sync/atomic/BUILD.bazel c/go/ssa/testdata/src/sync/atomic/BUILD.bazel
+--- b/go/ssa/testdata/src/sync/atomic/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/sync/atomic/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "atomic",
++ srcs = ["atomic.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/sync/atomic",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":atomic",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/sync/BUILD.bazel c/go/ssa/testdata/src/sync/BUILD.bazel
+--- b/go/ssa/testdata/src/sync/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/sync/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "sync",
++ srcs = ["sync.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/sync",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":sync",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/time/BUILD.bazel c/go/ssa/testdata/src/time/BUILD.bazel
+--- b/go/ssa/testdata/src/time/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/time/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "time",
++ srcs = ["time.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/time",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":time",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/ssa/testdata/src/unsafe/BUILD.bazel c/go/ssa/testdata/src/unsafe/BUILD.bazel
+--- b/go/ssa/testdata/src/unsafe/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/ssa/testdata/src/unsafe/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "unsafe",
++ srcs = ["unsafe.go"],
++ importpath = "golang.org/x/tools/go/ssa/testdata/src/unsafe",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":unsafe",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/go/types/objectpath/BUILD.bazel c/go/types/objectpath/BUILD.bazel
+--- b/go/types/objectpath/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/types/objectpath/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "objectpath",
++ srcs = ["objectpath.go"],
++ importpath = "golang.org/x/tools/go/types/objectpath",
++ visibility = ["//visibility:public"],
++ deps = ["//internal/typeparams"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":objectpath",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "objectpath_test",
++ srcs = [
++ "objectpath_go118_test.go",
++ "objectpath_test.go",
++ ],
++ deps = [
++ ":objectpath",
++ "//go/buildutil",
++ "//go/gcexportdata",
++ "//go/loader",
++ ],
++)
+diff -urN b/go/types/typeutil/BUILD.bazel c/go/types/typeutil/BUILD.bazel
+--- b/go/types/typeutil/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/types/typeutil/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,39 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "typeutil",
++ srcs = [
++ "callee.go",
++ "imports.go",
++ "map.go",
++ "methodsetcache.go",
++ "ui.go",
++ ],
++ importpath = "golang.org/x/tools/go/types/typeutil",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/ast/astutil",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeutil",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "typeutil_test",
++ srcs = [
++ "callee_test.go",
++ "example_test.go",
++ "imports_test.go",
++ "map_test.go",
++ "ui_test.go",
++ ],
++ deps = [
++ ":typeutil",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/go/vcs/BUILD.bazel c/go/vcs/BUILD.bazel
+--- b/go/vcs/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/go/vcs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "vcs",
++ srcs = [
++ "discovery.go",
++ "env.go",
++ "http.go",
++ "vcs.go",
++ ],
++ importpath = "golang.org/x/tools/go/vcs",
++ visibility = ["//visibility:public"],
++ deps = ["@org_golang_x_sys//execabs:go_default_library"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":vcs",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "vcs_test",
++ srcs = ["vcs_test.go"],
++ embed = [":vcs"],
++)
+diff -urN b/godoc/analysis/BUILD.bazel c/godoc/analysis/BUILD.bazel
+--- b/godoc/analysis/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/godoc/analysis/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,17 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "analysis",
++ srcs = [
++ "analysis.go",
++ "json.go",
++ ],
++ importpath = "golang.org/x/tools/godoc/analysis",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":analysis",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/godoc/BUILD.bazel c/godoc/BUILD.bazel
+--- b/godoc/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/godoc/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,66 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "godoc",
++ srcs = [
++ "corpus.go",
++ "dirtrees.go",
++ "format.go",
++ "godoc.go",
++ "index.go",
++ "linkify.go",
++ "markdown.go",
++ "meta.go",
++ "page.go",
++ "parser.go",
++ "pres.go",
++ "search.go",
++ "server.go",
++ "snippet.go",
++ "spec.go",
++ "spot.go",
++ "tab.go",
++ "template.go",
++ "tohtml_go119.go",
++ "tohtml_other.go",
++ "versions.go",
++ ],
++ importpath = "golang.org/x/tools/godoc",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//godoc/analysis",
++ "//godoc/util",
++ "//godoc/vfs",
++ "//godoc/vfs/httpfs",
++ "//internal/typeparams",
++ "@com_github_yuin_goldmark//:go_default_library",
++ "@com_github_yuin_goldmark//parser:go_default_library",
++ "@com_github_yuin_goldmark//renderer/html:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":godoc",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "godoc_test",
++ srcs = [
++ "dirtrees_test.go",
++ "godoc17_test.go",
++ "godoc_test.go",
++ "index_test.go",
++ "server_test.go",
++ "spec_test.go",
++ "versions_test.go",
++ ],
++ embed = [":godoc"],
++ deps = [
++ "//godoc/vfs",
++ "//godoc/vfs/gatefs",
++ "//godoc/vfs/mapfs",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/godoc/redirect/BUILD.bazel c/godoc/redirect/BUILD.bazel
+--- b/godoc/redirect/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/godoc/redirect/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "redirect",
++ srcs = ["redirect.go"],
++ importpath = "golang.org/x/tools/godoc/redirect",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":redirect",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "redirect_test",
++ srcs = ["redirect_test.go"],
++ embed = [":redirect"],
++)
+diff -urN b/godoc/static/BUILD.bazel c/godoc/static/BUILD.bazel
+--- b/godoc/static/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/godoc/static/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "static",
++ srcs = [
++ "doc.go",
++ "gen.go",
++ "static.go",
++ ],
++ importpath = "golang.org/x/tools/godoc/static",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":static",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "static_test",
++ srcs = ["gen_test.go"],
++ embed = [":static"],
++)
+diff -urN b/godoc/util/BUILD.bazel c/godoc/util/BUILD.bazel
+--- b/godoc/util/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/godoc/util/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "util",
++ srcs = [
++ "throttle.go",
++ "util.go",
++ ],
++ importpath = "golang.org/x/tools/godoc/util",
++ visibility = ["//visibility:public"],
++ deps = ["//godoc/vfs"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":util",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/godoc/vfs/BUILD.bazel c/godoc/vfs/BUILD.bazel
+--- b/godoc/vfs/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/godoc/vfs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "vfs",
++ srcs = [
++ "emptyvfs.go",
++ "fs.go",
++ "namespace.go",
++ "os.go",
++ "vfs.go",
++ ],
++ importpath = "golang.org/x/tools/godoc/vfs",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":vfs",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "vfs_test",
++ srcs = [
++ "namespace_test.go",
++ "os_test.go",
++ ],
++ deps = [
++ ":vfs",
++ "//godoc/vfs/mapfs",
++ ],
++)
+diff -urN b/godoc/vfs/gatefs/BUILD.bazel c/godoc/vfs/gatefs/BUILD.bazel
+--- b/godoc/vfs/gatefs/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/godoc/vfs/gatefs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "gatefs",
++ srcs = ["gatefs.go"],
++ importpath = "golang.org/x/tools/godoc/vfs/gatefs",
++ visibility = ["//visibility:public"],
++ deps = ["//godoc/vfs"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gatefs",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "gatefs_test",
++ srcs = ["gatefs_test.go"],
++ deps = [
++ ":gatefs",
++ "//godoc/vfs",
++ ],
++)
+diff -urN b/godoc/vfs/httpfs/BUILD.bazel c/godoc/vfs/httpfs/BUILD.bazel
+--- b/godoc/vfs/httpfs/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/godoc/vfs/httpfs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "httpfs",
++ srcs = ["httpfs.go"],
++ importpath = "golang.org/x/tools/godoc/vfs/httpfs",
++ visibility = ["//visibility:public"],
++ deps = ["//godoc/vfs"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":httpfs",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/godoc/vfs/mapfs/BUILD.bazel c/godoc/vfs/mapfs/BUILD.bazel
+--- b/godoc/vfs/mapfs/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/godoc/vfs/mapfs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "mapfs",
++ srcs = ["mapfs.go"],
++ importpath = "golang.org/x/tools/godoc/vfs/mapfs",
++ visibility = ["//visibility:public"],
++ deps = ["//godoc/vfs"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":mapfs",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "mapfs_test",
++ srcs = ["mapfs_test.go"],
++ embed = [":mapfs"],
++)
+diff -urN b/godoc/vfs/zipfs/BUILD.bazel c/godoc/vfs/zipfs/BUILD.bazel
+--- b/godoc/vfs/zipfs/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/godoc/vfs/zipfs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "zipfs",
++ srcs = ["zipfs.go"],
++ importpath = "golang.org/x/tools/godoc/vfs/zipfs",
++ visibility = ["//visibility:public"],
++ deps = ["//godoc/vfs"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":zipfs",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "zipfs_test",
++ srcs = ["zipfs_test.go"],
++ embed = [":zipfs"],
++ deps = ["//godoc/vfs"],
++)
+diff -urN b/imports/BUILD.bazel c/imports/BUILD.bazel
+--- b/imports/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/imports/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "imports",
++ srcs = ["forward.go"],
++ importpath = "golang.org/x/tools/imports",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//internal/gocommand",
++ "//internal/imports",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":imports",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/internal/analysisinternal/BUILD.bazel c/internal/analysisinternal/BUILD.bazel
+--- b/internal/analysisinternal/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/analysisinternal/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "analysisinternal",
++ srcs = ["analysis.go"],
++ importpath = "golang.org/x/tools/internal/analysisinternal",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":analysisinternal",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/apidiff/BUILD.bazel c/internal/apidiff/BUILD.bazel
+--- b/internal/apidiff/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/apidiff/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "apidiff",
++ srcs = [
++ "apidiff.go",
++ "compatibility.go",
++ "correspondence.go",
++ "messageset.go",
++ "report.go",
++ ],
++ importpath = "golang.org/x/tools/internal/apidiff",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":apidiff",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "apidiff_test",
++ srcs = ["apidiff_test.go"],
++ embed = [":apidiff"],
++ deps = [
++ "//go/packages",
++ "//internal/testenv",
++ ],
++)
+diff -urN b/internal/apidiff/testdata/BUILD.bazel c/internal/apidiff/testdata/BUILD.bazel
+--- b/internal/apidiff/testdata/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/apidiff/testdata/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "testdata",
++ srcs = ["tests.go"],
++ importpath = "golang.org/x/tools/internal/apidiff/testdata",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":testdata",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/apidiff/testdata/exported_fields/BUILD.bazel c/internal/apidiff/testdata/exported_fields/BUILD.bazel
+--- b/internal/apidiff/testdata/exported_fields/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/apidiff/testdata/exported_fields/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "exported_fields",
++ srcs = ["ef.go"],
++ importpath = "golang.org/x/tools/internal/apidiff/testdata/exported_fields",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":exported_fields",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/bug/BUILD.bazel c/internal/bug/BUILD.bazel
+--- b/internal/bug/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/bug/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "bug",
++ srcs = ["bug.go"],
++ importpath = "golang.org/x/tools/internal/bug",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":bug",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "bug_test",
++ srcs = ["bug_test.go"],
++ embed = [":bug"],
++)
+diff -urN b/internal/diff/BUILD.bazel c/internal/diff/BUILD.bazel
+--- b/internal/diff/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/diff/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "diff",
++ srcs = [
++ "diff.go",
++ "ndiff.go",
++ "unified.go",
++ ],
++ importpath = "golang.org/x/tools/internal/diff",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/diff/lcs"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":diff",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "diff_test",
++ srcs = [
++ "diff_test.go",
++ "export_test.go",
++ ],
++ embed = [":diff"],
++ deps = [
++ "//internal/diff/difftest",
++ "//internal/testenv",
++ ],
++)
+diff -urN b/internal/diff/difftest/BUILD.bazel c/internal/diff/difftest/BUILD.bazel
+--- b/internal/diff/difftest/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/diff/difftest/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "difftest",
++ srcs = ["difftest.go"],
++ importpath = "golang.org/x/tools/internal/diff/difftest",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/diff"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":difftest",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "difftest_test",
++ srcs = ["difftest_test.go"],
++ deps = [
++ ":difftest",
++ "//internal/testenv",
++ ],
++)
+diff -urN b/internal/diff/lcs/BUILD.bazel c/internal/diff/lcs/BUILD.bazel
+--- b/internal/diff/lcs/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/diff/lcs/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "lcs",
++ srcs = [
++ "common.go",
++ "doc.go",
++ "labels.go",
++ "old.go",
++ "sequence.go",
++ ],
++ importpath = "golang.org/x/tools/internal/diff/lcs",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":lcs",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "lcs_test",
++ srcs = [
++ "common_test.go",
++ "old_test.go",
++ ],
++ embed = [":lcs"],
++)
+diff -urN b/internal/diff/myers/BUILD.bazel c/internal/diff/myers/BUILD.bazel
+--- b/internal/diff/myers/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/diff/myers/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "myers",
++ srcs = ["diff.go"],
++ importpath = "golang.org/x/tools/internal/diff/myers",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/diff"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":myers",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "myers_test",
++ srcs = ["diff_test.go"],
++ deps = [
++ ":myers",
++ "//internal/diff/difftest",
++ ],
++)
+diff -urN b/internal/event/BUILD.bazel c/internal/event/BUILD.bazel
+--- b/internal/event/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/event/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "event",
++ srcs = [
++ "doc.go",
++ "event.go",
++ ],
++ importpath = "golang.org/x/tools/internal/event",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/event/core",
++ "//internal/event/keys",
++ "//internal/event/label",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":event",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "event_test",
++ srcs = ["bench_test.go"],
++ deps = [
++ ":event",
++ "//internal/event/core",
++ "//internal/event/export",
++ "//internal/event/keys",
++ "//internal/event/label",
++ ],
++)
+diff -urN b/internal/event/core/BUILD.bazel c/internal/event/core/BUILD.bazel
+--- b/internal/event/core/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/event/core/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "core",
++ srcs = [
++ "event.go",
++ "export.go",
++ "fast.go",
++ ],
++ importpath = "golang.org/x/tools/internal/event/core",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/event/keys",
++ "//internal/event/label",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":core",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/event/export/BUILD.bazel c/internal/event/export/BUILD.bazel
+--- b/internal/event/export/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/event/export/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,38 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "export",
++ srcs = [
++ "id.go",
++ "log.go",
++ "printer.go",
++ "tag.go",
++ "trace.go",
++ ],
++ importpath = "golang.org/x/tools/internal/event/export",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/event",
++ "//internal/event/core",
++ "//internal/event/keys",
++ "//internal/event/label",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":export",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "export_test",
++ srcs = ["log_test.go"],
++ deps = [
++ ":export",
++ "//internal/event",
++ "//internal/event/core",
++ "//internal/event/keys",
++ "//internal/event/label",
++ ],
++)
+diff -urN b/internal/event/export/eventtest/BUILD.bazel c/internal/event/export/eventtest/BUILD.bazel
+--- b/internal/event/export/eventtest/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/event/export/eventtest/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "eventtest",
++ srcs = ["eventtest.go"],
++ importpath = "golang.org/x/tools/internal/event/export/eventtest",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/event",
++ "//internal/event/core",
++ "//internal/event/export",
++ "//internal/event/label",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":eventtest",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/event/export/metric/BUILD.bazel c/internal/event/export/metric/BUILD.bazel
+--- b/internal/event/export/metric/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/event/export/metric/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "metric",
++ srcs = [
++ "data.go",
++ "exporter.go",
++ "info.go",
++ ],
++ importpath = "golang.org/x/tools/internal/event/export/metric",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/event",
++ "//internal/event/core",
++ "//internal/event/keys",
++ "//internal/event/label",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":metric",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/event/export/ocagent/BUILD.bazel c/internal/event/export/ocagent/BUILD.bazel
+--- b/internal/event/export/ocagent/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/event/export/ocagent/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,44 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "ocagent",
++ srcs = [
++ "metrics.go",
++ "ocagent.go",
++ ],
++ importpath = "golang.org/x/tools/internal/event/export/ocagent",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/event",
++ "//internal/event/core",
++ "//internal/event/export",
++ "//internal/event/export/metric",
++ "//internal/event/export/ocagent/wire",
++ "//internal/event/keys",
++ "//internal/event/label",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":ocagent",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "ocagent_test",
++ srcs = [
++ "metrics_test.go",
++ "ocagent_test.go",
++ "trace_test.go",
++ ],
++ deps = [
++ ":ocagent",
++ "//internal/event",
++ "//internal/event/core",
++ "//internal/event/export",
++ "//internal/event/export/metric",
++ "//internal/event/keys",
++ "//internal/event/label",
++ ],
++)
+diff -urN b/internal/event/export/ocagent/wire/BUILD.bazel c/internal/event/export/ocagent/wire/BUILD.bazel
+--- b/internal/event/export/ocagent/wire/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/event/export/ocagent/wire/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "wire",
++ srcs = [
++ "common.go",
++ "core.go",
++ "metrics.go",
++ "trace.go",
++ ],
++ importpath = "golang.org/x/tools/internal/event/export/ocagent/wire",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":wire",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "wire_test",
++ srcs = ["metrics_test.go"],
++ embed = [":wire"],
++)
+diff -urN b/internal/event/export/prometheus/BUILD.bazel c/internal/event/export/prometheus/BUILD.bazel
+--- b/internal/event/export/prometheus/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/event/export/prometheus/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "prometheus",
++ srcs = ["prometheus.go"],
++ importpath = "golang.org/x/tools/internal/event/export/prometheus",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/event",
++ "//internal/event/core",
++ "//internal/event/export/metric",
++ "//internal/event/label",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":prometheus",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/event/keys/BUILD.bazel c/internal/event/keys/BUILD.bazel
+--- b/internal/event/keys/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/event/keys/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "keys",
++ srcs = [
++ "keys.go",
++ "standard.go",
++ ],
++ importpath = "golang.org/x/tools/internal/event/keys",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/event/label"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":keys",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/event/label/BUILD.bazel c/internal/event/label/BUILD.bazel
+--- b/internal/event/label/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/event/label/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "label",
++ srcs = ["label.go"],
++ importpath = "golang.org/x/tools/internal/event/label",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":label",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "label_test",
++ srcs = ["label_test.go"],
++ deps = [
++ ":label",
++ "//internal/event/keys",
++ ],
++)
+diff -urN b/internal/event/tag/BUILD.bazel c/internal/event/tag/BUILD.bazel
+--- b/internal/event/tag/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/event/tag/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "tag",
++ srcs = ["tag.go"],
++ importpath = "golang.org/x/tools/internal/event/tag",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/event/keys"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":tag",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/facts/BUILD.bazel c/internal/facts/BUILD.bazel
+--- b/internal/facts/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/facts/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,34 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "facts",
++ srcs = [
++ "facts.go",
++ "imports.go",
++ ],
++ importpath = "golang.org/x/tools/internal/facts",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/analysis",
++ "//go/types/objectpath",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":facts",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "facts_test",
++ srcs = ["facts_test.go"],
++ deps = [
++ ":facts",
++ "//go/analysis/analysistest",
++ "//go/packages",
++ "//internal/testenv",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/internal/fakenet/BUILD.bazel c/internal/fakenet/BUILD.bazel
+--- b/internal/fakenet/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/fakenet/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "fakenet",
++ srcs = ["conn.go"],
++ importpath = "golang.org/x/tools/internal/fakenet",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fakenet",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/fastwalk/BUILD.bazel c/internal/fastwalk/BUILD.bazel
+--- b/internal/fastwalk/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/fastwalk/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,30 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "fastwalk",
++ srcs = [
++ "fastwalk.go",
++ "fastwalk_darwin.go",
++ "fastwalk_dirent_fileno.go",
++ "fastwalk_dirent_ino.go",
++ "fastwalk_dirent_namlen_bsd.go",
++ "fastwalk_dirent_namlen_linux.go",
++ "fastwalk_portable.go",
++ "fastwalk_unix.go",
++ ],
++ cgo = True,
++ importpath = "golang.org/x/tools/internal/fastwalk",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fastwalk",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "fastwalk_test",
++ srcs = ["fastwalk_test.go"],
++ deps = [":fastwalk"],
++)
+diff -urN b/internal/fuzzy/BUILD.bazel c/internal/fuzzy/BUILD.bazel
+--- b/internal/fuzzy/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/fuzzy/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "fuzzy",
++ srcs = [
++ "input.go",
++ "matcher.go",
++ "symbol.go",
++ ],
++ importpath = "golang.org/x/tools/internal/fuzzy",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":fuzzy",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "fuzzy_test",
++ srcs = [
++ "input_test.go",
++ "matcher_test.go",
++ "symbol_test.go",
++ ],
++ deps = [":fuzzy"],
++)
+diff -urN b/internal/gcimporter/BUILD.bazel c/internal/gcimporter/BUILD.bazel
+--- b/internal/gcimporter/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/gcimporter/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,60 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "gcimporter",
++ srcs = [
++ "bexport.go",
++ "bimport.go",
++ "exportdata.go",
++ "gcimporter.go",
++ "iexport.go",
++ "iimport.go",
++ "newInterface10.go",
++ "newInterface11.go",
++ "support_go117.go",
++ "support_go118.go",
++ "unified_no.go",
++ "ureader_no.go",
++ "ureader_yes.go",
++ ],
++ importpath = "golang.org/x/tools/internal/gcimporter",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/pkgbits",
++ "//internal/tokeninternal",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gcimporter",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "gcimporter_test",
++ srcs = [
++ "bexport_test.go",
++ "gcimporter_test.go",
++ "iexport_common_test.go",
++ "iexport_go118_test.go",
++ "iexport_test.go",
++ "israce_test.go",
++ "shallow_test.go",
++ "stdlib_test.go",
++ ],
++ embed = [":gcimporter"],
++ deps = [
++ "//go/ast/inspector",
++ "//go/buildutil",
++ "//go/gcexportdata",
++ "//go/loader",
++ "//go/packages",
++ "//internal/goroot",
++ "//internal/testenv",
++ "//internal/typeparams",
++ "//internal/typeparams/genericfeatures",
++ "@org_golang_x_sync//errgroup:go_default_library",
++ ],
++)
+diff -urN b/internal/gcimporter/testdata/a/BUILD.bazel c/internal/gcimporter/testdata/a/BUILD.bazel
+--- b/internal/gcimporter/testdata/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/gcimporter/testdata/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/internal/gcimporter/testdata/a",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/gcimporter/testdata/issue51836/a/BUILD.bazel c/internal/gcimporter/testdata/issue51836/a/BUILD.bazel
+--- b/internal/gcimporter/testdata/issue51836/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/gcimporter/testdata/issue51836/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/internal/gcimporter/testdata/issue51836/a",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/gcimporter/testdata/issue51836/BUILD.bazel c/internal/gcimporter/testdata/issue51836/BUILD.bazel
+--- b/internal/gcimporter/testdata/issue51836/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/gcimporter/testdata/issue51836/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "issue51836",
++ srcs = [
++ "a.go",
++ "aa.go",
++ ],
++ importpath = "golang.org/x/tools/internal/gcimporter/testdata/issue51836",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/gcimporter/testdata/issue51836/a"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":issue51836",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/gcimporter/testdata/issue58296/a/BUILD.bazel c/internal/gcimporter/testdata/issue58296/a/BUILD.bazel
+--- b/internal/gcimporter/testdata/issue58296/a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/gcimporter/testdata/issue58296/a/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "a",
++ srcs = ["a.go"],
++ importpath = "golang.org/x/tools/internal/gcimporter/testdata/issue58296/a",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":a",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/gcimporter/testdata/issue58296/b/BUILD.bazel c/internal/gcimporter/testdata/issue58296/b/BUILD.bazel
+--- b/internal/gcimporter/testdata/issue58296/b/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/gcimporter/testdata/issue58296/b/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "b",
++ srcs = ["b.go"],
++ importpath = "golang.org/x/tools/internal/gcimporter/testdata/issue58296/b",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":b",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/gcimporter/testdata/issue58296/c/BUILD.bazel c/internal/gcimporter/testdata/issue58296/c/BUILD.bazel
+--- b/internal/gcimporter/testdata/issue58296/c/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/gcimporter/testdata/issue58296/c/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "c",
++ srcs = ["c.go"],
++ importpath = "golang.org/x/tools/internal/gcimporter/testdata/issue58296/c",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":c",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/gcimporter/testdata/versions/BUILD.bazel c/internal/gcimporter/testdata/versions/BUILD.bazel
+--- b/internal/gcimporter/testdata/versions/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/gcimporter/testdata/versions/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "versions",
++ srcs = ["test.go"],
++ importpath = "golang.org/x/tools/internal/gcimporter/testdata/versions",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":versions",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/gocommand/BUILD.bazel c/internal/gocommand/BUILD.bazel
+--- b/internal/gocommand/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/gocommand/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,32 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "gocommand",
++ srcs = [
++ "invoke.go",
++ "vendor.go",
++ "version.go",
++ ],
++ importpath = "golang.org/x/tools/internal/gocommand",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/event",
++ "@org_golang_x_mod//semver:go_default_library",
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gocommand",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "gocommand_test",
++ srcs = [
++ "invoke_test.go",
++ "version_test.go",
++ ],
++ embed = [":gocommand"],
++)
+diff -urN b/internal/gopathwalk/BUILD.bazel c/internal/gopathwalk/BUILD.bazel
+--- b/internal/gopathwalk/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/gopathwalk/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "gopathwalk",
++ srcs = ["walk.go"],
++ importpath = "golang.org/x/tools/internal/gopathwalk",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/fastwalk"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":gopathwalk",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "gopathwalk_test",
++ srcs = ["walk_test.go"],
++ embed = [":gopathwalk"],
++)
+diff -urN b/internal/goroot/BUILD.bazel c/internal/goroot/BUILD.bazel
+--- b/internal/goroot/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/goroot/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "goroot",
++ srcs = ["importcfg.go"],
++ importpath = "golang.org/x/tools/internal/goroot",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":goroot",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/imports/BUILD.bazel c/internal/imports/BUILD.bazel
+--- b/internal/imports/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/imports/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,48 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "imports",
++ srcs = [
++ "fix.go",
++ "imports.go",
++ "mod.go",
++ "mod_cache.go",
++ "sortimports.go",
++ "zstdlib.go",
++ ],
++ importpath = "golang.org/x/tools/internal/imports",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//go/ast/astutil",
++ "//internal/gocommand",
++ "//internal/gopathwalk",
++ "@org_golang_x_mod//module:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":imports",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "imports_test",
++ srcs = [
++ "fix_test.go",
++ "imports_test.go",
++ "mod_cache_test.go",
++ "mod_test.go",
++ ],
++ data = glob(["testdata/**"]),
++ embed = [":imports"],
++ deps = [
++ "//go/packages/packagestest",
++ "//internal/gocommand",
++ "//internal/gopathwalk",
++ "//internal/proxydir",
++ "//internal/testenv",
++ "//txtar",
++ "@org_golang_x_mod//module:go_default_library",
++ ],
++)
+diff -urN b/internal/jsonrpc2/BUILD.bazel c/internal/jsonrpc2/BUILD.bazel
+--- b/internal/jsonrpc2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/jsonrpc2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,41 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "jsonrpc2",
++ srcs = [
++ "conn.go",
++ "handler.go",
++ "jsonrpc2.go",
++ "messages.go",
++ "serve.go",
++ "stream.go",
++ "wire.go",
++ ],
++ importpath = "golang.org/x/tools/internal/jsonrpc2",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/event",
++ "//internal/event/label",
++ "//internal/event/tag",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":jsonrpc2",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "jsonrpc2_test",
++ srcs = [
++ "jsonrpc2_test.go",
++ "serve_test.go",
++ "wire_test.go",
++ ],
++ embed = [":jsonrpc2"],
++ deps = [
++ "//internal/event/export/eventtest",
++ "//internal/stack/stacktest",
++ ],
++)
+diff -urN b/internal/jsonrpc2/servertest/BUILD.bazel c/internal/jsonrpc2/servertest/BUILD.bazel
+--- b/internal/jsonrpc2/servertest/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/jsonrpc2/servertest/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,22 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "servertest",
++ srcs = ["servertest.go"],
++ importpath = "golang.org/x/tools/internal/jsonrpc2/servertest",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/jsonrpc2"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":servertest",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "servertest_test",
++ srcs = ["servertest_test.go"],
++ embed = [":servertest"],
++ deps = ["//internal/jsonrpc2"],
++)
+diff -urN b/internal/jsonrpc2_v2/BUILD.bazel c/internal/jsonrpc2_v2/BUILD.bazel
+--- b/internal/jsonrpc2_v2/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/jsonrpc2_v2/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,44 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "jsonrpc2_v2",
++ srcs = [
++ "conn.go",
++ "frame.go",
++ "jsonrpc2.go",
++ "messages.go",
++ "net.go",
++ "serve.go",
++ "serve_go116.go",
++ "serve_pre116.go",
++ "wire.go",
++ ],
++ importpath = "golang.org/x/tools/internal/jsonrpc2_v2",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/event",
++ "//internal/event/keys",
++ "//internal/event/label",
++ "//internal/event/tag",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":jsonrpc2_v2",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "jsonrpc2_v2_test",
++ srcs = [
++ "jsonrpc2_test.go",
++ "serve_test.go",
++ "wire_test.go",
++ ],
++ deps = [
++ ":jsonrpc2_v2",
++ "//internal/event/export/eventtest",
++ "//internal/stack/stacktest",
++ ],
++)
+diff -urN b/internal/lockedfile/BUILD.bazel c/internal/lockedfile/BUILD.bazel
+--- b/internal/lockedfile/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/lockedfile/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,111 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "lockedfile",
++ srcs = [
++ "lockedfile.go",
++ "lockedfile_filelock.go",
++ "lockedfile_plan9.go",
++ "mutex.go",
++ ],
++ importpath = "golang.org/x/tools/internal/lockedfile",
++ visibility = ["//:__subpackages__"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ "//internal/lockedfile/internal/filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:android": [
++ "//internal/lockedfile/internal/filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ "//internal/lockedfile/internal/filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ "//internal/lockedfile/internal/filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ "//internal/lockedfile/internal/filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ "//internal/lockedfile/internal/filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ "//internal/lockedfile/internal/filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:js": [
++ "//internal/lockedfile/internal/filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ "//internal/lockedfile/internal/filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ "//internal/lockedfile/internal/filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ "//internal/lockedfile/internal/filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ "//internal/lockedfile/internal/filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ "//internal/lockedfile/internal/filelock",
++ ],
++ "//conditions:default": [],
++ }),
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":lockedfile",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "lockedfile_test",
++ srcs = [
++ "lockedfile_test.go",
++ "transform_test.go",
++ ],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ ":lockedfile",
++ ],
++ "@io_bazel_rules_go//go/platform:android": [
++ ":lockedfile",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ ":lockedfile",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ ":lockedfile",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ ":lockedfile",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ ":lockedfile",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ ":lockedfile",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ ":lockedfile",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ ":lockedfile",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ ":lockedfile",
++ ],
++ "@io_bazel_rules_go//go/platform:plan9": [
++ ":lockedfile",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ ":lockedfile",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ ":lockedfile",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN b/internal/lockedfile/internal/filelock/BUILD.bazel c/internal/lockedfile/internal/filelock/BUILD.bazel
+--- b/internal/lockedfile/internal/filelock/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/lockedfile/internal/filelock/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,65 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "filelock",
++ srcs = [
++ "filelock.go",
++ "filelock_fcntl.go",
++ "filelock_other.go",
++ "filelock_plan9.go",
++ "filelock_unix.go",
++ "filelock_windows.go",
++ ],
++ importpath = "golang.org/x/tools/internal/lockedfile/internal/filelock",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":filelock",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "filelock_test",
++ srcs = ["filelock_test.go"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ ":filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:android": [
++ ":filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ ":filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ ":filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ ":filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ ":filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ ":filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ ":filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ ":filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ ":filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ ":filelock",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ ":filelock",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN b/internal/memoize/BUILD.bazel c/internal/memoize/BUILD.bazel
+--- b/internal/memoize/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/memoize/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "memoize",
++ srcs = ["memoize.go"],
++ importpath = "golang.org/x/tools/internal/memoize",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/xcontext"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":memoize",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "memoize_test",
++ srcs = ["memoize_test.go"],
++ deps = [":memoize"],
++)
+diff -urN b/internal/packagesinternal/BUILD.bazel c/internal/packagesinternal/BUILD.bazel
+--- b/internal/packagesinternal/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/packagesinternal/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "packagesinternal",
++ srcs = ["packages.go"],
++ importpath = "golang.org/x/tools/internal/packagesinternal",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/gocommand"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":packagesinternal",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/persistent/BUILD.bazel c/internal/persistent/BUILD.bazel
+--- b/internal/persistent/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/persistent/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "persistent",
++ srcs = ["map.go"],
++ importpath = "golang.org/x/tools/internal/persistent",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":persistent",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "persistent_test",
++ srcs = ["map_test.go"],
++ embed = [":persistent"],
++)
+diff -urN b/internal/pkgbits/BUILD.bazel c/internal/pkgbits/BUILD.bazel
+--- b/internal/pkgbits/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/pkgbits/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,26 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "pkgbits",
++ srcs = [
++ "codes.go",
++ "decoder.go",
++ "doc.go",
++ "encoder.go",
++ "flags.go",
++ "frames_go1.go",
++ "frames_go17.go",
++ "reloc.go",
++ "support.go",
++ "sync.go",
++ "syncmarker_string.go",
++ ],
++ importpath = "golang.org/x/tools/internal/pkgbits",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":pkgbits",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/proxydir/BUILD.bazel c/internal/proxydir/BUILD.bazel
+--- b/internal/proxydir/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/proxydir/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,21 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "proxydir",
++ srcs = ["proxydir.go"],
++ importpath = "golang.org/x/tools/internal/proxydir",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/testenv"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":proxydir",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "proxydir_test",
++ srcs = ["proxydir_test.go"],
++ embed = [":proxydir"],
++)
+diff -urN b/internal/robustio/BUILD.bazel c/internal/robustio/BUILD.bazel
+--- b/internal/robustio/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/robustio/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,29 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "robustio",
++ srcs = [
++ "gopls_windows.go",
++ "robustio.go",
++ "robustio_darwin.go",
++ "robustio_flaky.go",
++ "robustio_other.go",
++ "robustio_plan9.go",
++ "robustio_posix.go",
++ "robustio_windows.go",
++ ],
++ importpath = "golang.org/x/tools/internal/robustio",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":robustio",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "robustio_test",
++ srcs = ["robustio_test.go"],
++ deps = [":robustio"],
++)
+diff -urN b/internal/stack/BUILD.bazel c/internal/stack/BUILD.bazel
+--- b/internal/stack/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/stack/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,24 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "stack",
++ srcs = [
++ "parse.go",
++ "process.go",
++ "stack.go",
++ ],
++ importpath = "golang.org/x/tools/internal/stack",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":stack",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "stack_test",
++ srcs = ["stack_test.go"],
++ deps = [":stack"],
++)
+diff -urN b/internal/stack/gostacks/BUILD.bazel c/internal/stack/gostacks/BUILD.bazel
+--- b/internal/stack/gostacks/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/stack/gostacks/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library")
++
++go_library(
++ name = "gostacks_lib",
++ srcs = ["gostacks.go"],
++ importpath = "golang.org/x/tools/internal/stack/gostacks",
++ visibility = ["//visibility:private"],
++ deps = ["//internal/stack"],
++)
++
++go_binary(
++ name = "gostacks",
++ embed = [":gostacks_lib"],
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/stack/stacktest/BUILD.bazel c/internal/stack/stacktest/BUILD.bazel
+--- b/internal/stack/stacktest/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/stack/stacktest/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,15 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "stacktest",
++ srcs = ["stacktest.go"],
++ importpath = "golang.org/x/tools/internal/stack/stacktest",
++ visibility = ["//:__subpackages__"],
++ deps = ["//internal/stack"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":stacktest",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/testenv/BUILD.bazel c/internal/testenv/BUILD.bazel
+--- b/internal/testenv/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/testenv/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,23 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "testenv",
++ srcs = [
++ "exec.go",
++ "testenv.go",
++ "testenv_notunix.go",
++ "testenv_unix.go",
++ ],
++ importpath = "golang.org/x/tools/internal/testenv",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//internal/goroot",
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":testenv",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/tokeninternal/BUILD.bazel c/internal/tokeninternal/BUILD.bazel
+--- b/internal/tokeninternal/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/tokeninternal/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "tokeninternal",
++ srcs = ["tokeninternal.go"],
++ importpath = "golang.org/x/tools/internal/tokeninternal",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":tokeninternal",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/tool/BUILD.bazel c/internal/tool/BUILD.bazel
+--- b/internal/tool/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/tool/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "tool",
++ srcs = ["tool.go"],
++ importpath = "golang.org/x/tools/internal/tool",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":tool",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/typeparams/BUILD.bazel c/internal/typeparams/BUILD.bazel
+--- b/internal/typeparams/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/typeparams/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,39 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "typeparams",
++ srcs = [
++ "common.go",
++ "coretype.go",
++ "enabled_go117.go",
++ "enabled_go118.go",
++ "normalize.go",
++ "termlist.go",
++ "typeparams_go117.go",
++ "typeparams_go118.go",
++ "typeterm.go",
++ ],
++ importpath = "golang.org/x/tools/internal/typeparams",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typeparams",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "typeparams_test",
++ srcs = [
++ "common_test.go",
++ "coretype_test.go",
++ "normalize_test.go",
++ "typeparams_test.go",
++ ],
++ deps = [
++ ":typeparams",
++ "//internal/apidiff",
++ "//internal/testenv",
++ ],
++)
+diff -urN b/internal/typeparams/genericfeatures/BUILD.bazel c/internal/typeparams/genericfeatures/BUILD.bazel
+--- b/internal/typeparams/genericfeatures/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/typeparams/genericfeatures/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,18 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "genericfeatures",
++ srcs = ["features.go"],
++ importpath = "golang.org/x/tools/internal/typeparams/genericfeatures",
++ visibility = ["//:__subpackages__"],
++ deps = [
++ "//go/ast/inspector",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":genericfeatures",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/internal/typesinternal/BUILD.bazel c/internal/typesinternal/BUILD.bazel
+--- b/internal/typesinternal/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/typesinternal/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "typesinternal",
++ srcs = [
++ "errorcode.go",
++ "errorcode_string.go",
++ "types.go",
++ "types_118.go",
++ ],
++ importpath = "golang.org/x/tools/internal/typesinternal",
++ visibility = ["//:__subpackages__"],
++ deps = ["//go/types/objectpath"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":typesinternal",
++ visibility = ["//:__subpackages__"],
++)
++
++go_test(
++ name = "typesinternal_test",
++ srcs = ["errorcode_test.go"],
++)
+diff -urN b/internal/xcontext/BUILD.bazel c/internal/xcontext/BUILD.bazel
+--- b/internal/xcontext/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/internal/xcontext/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "xcontext",
++ srcs = ["xcontext.go"],
++ importpath = "golang.org/x/tools/internal/xcontext",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":xcontext",
++ visibility = ["//:__subpackages__"],
++)
+diff -urN b/playground/BUILD.bazel c/playground/BUILD.bazel
+--- b/playground/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/playground/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "playground",
++ srcs = ["playground.go"],
++ importpath = "golang.org/x/tools/playground",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":playground",
++ visibility = ["//visibility:public"],
++)
+diff -urN b/playground/socket/BUILD.bazel c/playground/socket/BUILD.bazel
+--- b/playground/socket/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/playground/socket/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,25 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "socket",
++ srcs = ["socket.go"],
++ importpath = "golang.org/x/tools/playground/socket",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//txtar",
++ "@org_golang_x_net//websocket:go_default_library",
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":socket",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "socket_test",
++ srcs = ["socket_test.go"],
++ embed = [":socket"],
++)
+diff -urN b/present/BUILD.bazel c/present/BUILD.bazel
+--- b/present/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/present/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,44 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "present",
++ srcs = [
++ "args.go",
++ "caption.go",
++ "code.go",
++ "doc.go",
++ "html.go",
++ "iframe.go",
++ "image.go",
++ "link.go",
++ "parse.go",
++ "style.go",
++ "video.go",
++ ],
++ importpath = "golang.org/x/tools/present",
++ visibility = ["//visibility:public"],
++ deps = [
++ "@com_github_yuin_goldmark//:go_default_library",
++ "@com_github_yuin_goldmark//ast:go_default_library",
++ "@com_github_yuin_goldmark//renderer/html:go_default_library",
++ "@com_github_yuin_goldmark//text:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":present",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "present_test",
++ srcs = [
++ "code_test.go",
++ "link_test.go",
++ "parse_test.go",
++ "style_test.go",
++ ],
++ data = glob(["testdata/**"]),
++ embed = [":present"],
++)
+diff -urN b/refactor/eg/BUILD.bazel c/refactor/eg/BUILD.bazel
+--- b/refactor/eg/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/refactor/eg/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,93 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "eg",
++ srcs = [
++ "eg.go",
++ "match.go",
++ "rewrite.go",
++ ],
++ importpath = "golang.org/x/tools/refactor/eg",
++ visibility = ["//visibility:public"],
++ deps = ["//go/ast/astutil"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":eg",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "eg_test",
++ srcs = ["eg_test.go"],
++ data = glob(["testdata/**"]),
++ deps = select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ ":eg",
++ "//go/loader",
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ ":eg",
++ "//go/loader",
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ ":eg",
++ "//go/loader",
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ ":eg",
++ "//go/loader",
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ ":eg",
++ "//go/loader",
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ ":eg",
++ "//go/loader",
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:js": [
++ ":eg",
++ "//go/loader",
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ ":eg",
++ "//go/loader",
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ ":eg",
++ "//go/loader",
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ ":eg",
++ "//go/loader",
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:plan9": [
++ ":eg",
++ "//go/loader",
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ ":eg",
++ "//go/loader",
++ "//internal/testenv",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ ":eg",
++ "//go/loader",
++ "//internal/testenv",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN b/refactor/importgraph/BUILD.bazel c/refactor/importgraph/BUILD.bazel
+--- b/refactor/importgraph/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/refactor/importgraph/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,75 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "importgraph",
++ srcs = ["graph.go"],
++ importpath = "golang.org/x/tools/refactor/importgraph",
++ visibility = ["//visibility:public"],
++ deps = ["//go/buildutil"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":importgraph",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "importgraph_test",
++ srcs = ["graph_test.go"],
++ deps = select({
++ "@io_bazel_rules_go//go/platform:aix": [
++ ":importgraph",
++ "//go/packages/packagestest",
++ ],
++ "@io_bazel_rules_go//go/platform:darwin": [
++ ":importgraph",
++ "//go/packages/packagestest",
++ ],
++ "@io_bazel_rules_go//go/platform:dragonfly": [
++ ":importgraph",
++ "//go/packages/packagestest",
++ ],
++ "@io_bazel_rules_go//go/platform:freebsd": [
++ ":importgraph",
++ "//go/packages/packagestest",
++ ],
++ "@io_bazel_rules_go//go/platform:illumos": [
++ ":importgraph",
++ "//go/packages/packagestest",
++ ],
++ "@io_bazel_rules_go//go/platform:ios": [
++ ":importgraph",
++ "//go/packages/packagestest",
++ ],
++ "@io_bazel_rules_go//go/platform:js": [
++ ":importgraph",
++ "//go/packages/packagestest",
++ ],
++ "@io_bazel_rules_go//go/platform:linux": [
++ ":importgraph",
++ "//go/packages/packagestest",
++ ],
++ "@io_bazel_rules_go//go/platform:netbsd": [
++ ":importgraph",
++ "//go/packages/packagestest",
++ ],
++ "@io_bazel_rules_go//go/platform:openbsd": [
++ ":importgraph",
++ "//go/packages/packagestest",
++ ],
++ "@io_bazel_rules_go//go/platform:plan9": [
++ ":importgraph",
++ "//go/packages/packagestest",
++ ],
++ "@io_bazel_rules_go//go/platform:solaris": [
++ ":importgraph",
++ "//go/packages/packagestest",
++ ],
++ "@io_bazel_rules_go//go/platform:windows": [
++ ":importgraph",
++ "//go/packages/packagestest",
++ ],
++ "//conditions:default": [],
++ }),
++)
+diff -urN b/refactor/rename/BUILD.bazel c/refactor/rename/BUILD.bazel
+--- b/refactor/rename/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/refactor/rename/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,42 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "rename",
++ srcs = [
++ "check.go",
++ "mvpkg.go",
++ "rename.go",
++ "spec.go",
++ "util.go",
++ ],
++ importpath = "golang.org/x/tools/refactor/rename",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/ast/astutil",
++ "//go/buildutil",
++ "//go/loader",
++ "//go/types/typeutil",
++ "//refactor/importgraph",
++ "//refactor/satisfy",
++ "@org_golang_x_sys//execabs:go_default_library",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":rename",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "rename_test",
++ srcs = [
++ "mvpkg_test.go",
++ "rename_test.go",
++ ],
++ embed = [":rename"],
++ deps = [
++ "//go/buildutil",
++ "//internal/testenv",
++ ],
++)
+diff -urN b/refactor/satisfy/BUILD.bazel c/refactor/satisfy/BUILD.bazel
+--- b/refactor/satisfy/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/refactor/satisfy/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,28 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "satisfy",
++ srcs = ["find.go"],
++ importpath = "golang.org/x/tools/refactor/satisfy",
++ visibility = ["//visibility:public"],
++ deps = [
++ "//go/ast/astutil",
++ "//go/types/typeutil",
++ "//internal/typeparams",
++ ],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":satisfy",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "satisfy_test",
++ srcs = ["find_test.go"],
++ deps = [
++ ":satisfy",
++ "//internal/typeparams",
++ ],
++)
+diff -urN b/txtar/BUILD.bazel c/txtar/BUILD.bazel
+--- b/txtar/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ c/txtar/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,20 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "txtar",
++ srcs = ["archive.go"],
++ importpath = "golang.org/x/tools/txtar",
++ visibility = ["//visibility:public"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":txtar",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "txtar_test",
++ srcs = ["archive_test.go"],
++ embed = [":txtar"],
++)
diff --git a/third_party/org_golang_x_xerrors-gazelle.patch b/third_party/org_golang_x_xerrors-gazelle.patch
new file mode 100644
index 00000000..07d0c733
--- /dev/null
+++ b/third_party/org_golang_x_xerrors-gazelle.patch
@@ -0,0 +1,62 @@
+diff -urN a/BUILD.bazel b/BUILD.bazel
+--- a/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,40 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")
++
++go_library(
++ name = "xerrors",
++ srcs = [
++ "adaptor.go",
++ "doc.go",
++ "errors.go",
++ "fmt.go",
++ "format.go",
++ "frame.go",
++ "wrap.go",
++ ],
++ importpath = "golang.org/x/xerrors",
++ visibility = ["//visibility:public"],
++ deps = ["//internal"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":xerrors",
++ visibility = ["//visibility:public"],
++)
++
++go_test(
++ name = "xerrors_test",
++ srcs = [
++ "errors_test.go",
++ "example_As_test.go",
++ "example_FormatError_test.go",
++ "example_test.go",
++ "fmt_test.go",
++ "fmt_unexported_test.go",
++ "stack_test.go",
++ "wrap_113_test.go",
++ "wrap_test.go",
++ ],
++ embed = [":xerrors"],
++ deps = ["//internal"],
++)
+diff -urN a/internal/BUILD.bazel b/internal/BUILD.bazel
+--- a/internal/BUILD.bazel 1970-01-01 00:00:00.000000000 +0000
++++ b/internal/BUILD.bazel 2000-01-01 00:00:00.000000000 -0000
+@@ -0,0 +1,14 @@
++load("@io_bazel_rules_go//go:def.bzl", "go_library")
++
++go_library(
++ name = "internal",
++ srcs = ["internal.go"],
++ importpath = "golang.org/x/xerrors/internal",
++ visibility = ["//:__subpackages__"],
++)
++
++alias(
++ name = "go_default_library",
++ actual = ":internal",
++ visibility = ["//:__subpackages__"],
++)
diff --git a/third_party/sanitize_patch_dates.go b/third_party/sanitize_patch_dates.go
new file mode 100644
index 00000000..712fb7f4
--- /dev/null
+++ b/third_party/sanitize_patch_dates.go
@@ -0,0 +1,84 @@
+// Copyright 2019 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package main
+
+import (
+ "bufio"
+ "fmt"
+ "log"
+ "os"
+ "regexp"
+ "strings"
+)
+
+func main() {
+ log.SetFlags(0)
+ log.SetPrefix("sanitize_patch_dates: ")
+ if len(os.Args) == 1 {
+ log.Fatalf("usage: sanitize_patch_dates *.patch")
+ }
+ for _, arg := range os.Args[1:] {
+ if err := sanitize(arg); err != nil {
+ log.Fatal(err)
+ }
+ }
+}
+
+var dateRegexp = regexp.MustCompile("20..-..-.. .*")
+
+func sanitize(filename string) (err error) {
+ r, err := os.Open(filename)
+ if err != nil {
+ return err
+ }
+ defer r.Close()
+
+ tempFilename := filename + "~"
+ w, err := os.Create(tempFilename)
+ if err != nil {
+ return err
+ }
+ defer func() {
+ if w == nil {
+ return
+ }
+ if cerr := w.Close(); err == nil && cerr != nil {
+ err = cerr
+ }
+ }()
+
+ s := bufio.NewScanner(r)
+ for s.Scan() {
+ line := s.Text()
+ if strings.HasPrefix(line, "+++") || strings.HasPrefix(line, "---") {
+ line = dateRegexp.ReplaceAllLiteralString(line, "2000-01-01 00:00:00.000000000 -0000")
+ }
+ if _, err := fmt.Fprintln(w, line); err != nil {
+ return err
+ }
+ }
+ if err := s.Err(); err != nil {
+ return err
+ }
+
+ if err := w.Close(); err != nil {
+ return err
+ }
+ w = nil
+ if err := os.Rename(tempFilename, filename); err != nil {
+ return err
+ }
+ return nil
+}
diff --git a/tools/gopackagesdriver.sh b/tools/gopackagesdriver.sh
new file mode 100755
index 00000000..4f84de41
--- /dev/null
+++ b/tools/gopackagesdriver.sh
@@ -0,0 +1,2 @@
+#!/usr/bin/env bash
+exec bazel run --tool_tag=gopackagesdriver -- //go/tools/gopackagesdriver "${@}"
diff --git a/windows.rst b/windows.rst
new file mode 100644
index 00000000..ea6608fe
--- /dev/null
+++ b/windows.rst
@@ -0,0 +1,136 @@
+Using rules_go on Windows
+=========================
+
+.. _--incompatible_enable_cc_toolchain_resolution: https://github.com/bazelbuild/bazel/issues/7260
+.. _Installing Bazel on Windows: https://docs.bazel.build/versions/master/install-windows.html
+
+This document provides a list of instructions for setting up Bazel to build
+Go code on a Windows computer.
+
+Most of the difficulty here is installing a compatible C/C++ toolchain. Cgo
+only works with GCC and clang toolchains, so MSVC cannot be used. This is a
+Go limitation, not a Bazel or rules_go problem: cgo determines types of
+definitions by parsing error messages that GCC emits when compiling generated
+files.
+
+See also `Installing Bazel on Windows`_, the official instructions for
+installing Bazel.
+
+Install and configure dependencies
+----------------------------------
+
+* Install msys2 from https://www.msys2.org/. This is needed to provide a bash
+ environment for Bazel.
+
+ * Follow the installation directions to the end, including
+ running ``pacman -Syu`` and ``pacman -Su`` in the msys2 shell.
+
+* Install additional msys2 tools.
+
+ * Run ``pacman -S mingw-w64-x86_64-gcc``. GCC is needed if you plan to build
+ any cgo code. MSVC will not work with cgo. This is a Go limitation, not a
+ Bazel limitation. cgo determines types of definitions by compiling specially
+ crafted C files and parsing error messages. GCC or clang are specifically
+ needed for this.
+ * Run ``pacman -S patch``. ``patch`` is needed by ``git_repository`` and
+ ``http_archive`` dependencies declared by rules_go. We use it to add
+ and modify build files.
+
+* Add ``C:\msys64\usr\bin`` to ``PATH`` in order to locate ``patch`` and
+ other DLLs.
+* Add ``C:\msys64\mingw64\bin`` to ``PATH`` in order to locate mingw DLLs.
+ ``protoc`` and other host binaries will not run without these.
+* Set the environment variable ``BAZEL_SH`` to ``C:\msys64\usr\bin\bash.exe``.
+ Bazel needs this to run shell scripts.
+* Set the environment variable ``CC`` to ``C:\msys64\mingw64\bin\gcc.exe``.
+ Bazel uses this to configure the C/C++ toolchain.
+* Install the MSVC++ redistributable from
+ https://www.microsoft.com/en-us/download/details.aspx?id=48145.
+ Bazel itself depends on this.
+* Install Git from https://git-scm.com/download/win. The Git install should
+ add the installed directory to your ``PATH`` automatically.
+
+Install bazel
+-------------
+
+* Download Bazel from https://github.com/bazelbuild/bazel/releases.
+* Move the binary to ``%APPDATA%\bin\bazel.exe``.
+* Add that directory to ``PATH``.
+* Confirm ``bazel version`` works.
+
+Confirm C/C++ works
+-------------------
+
+Create a workspace with a simple ``cc_binary`` target.
+
+.. code::
+
+ -- WORKSPACE --
+
+ -- BUILD.bazel --
+ cc_binary(
+ name = "hello",
+ srcs = ["hello.c"],
+ )
+
+ -- hello.c --
+ #include <stdio.h>
+
+ int main() {
+ printf("hello\n");
+ return 0;
+ }
+
+To build with MinGW, run the command below. Add the ``-s`` flag to print
+commands executed by Bazel to confirm MinGW is actually used.
+
+.. code::
+
+ bazel build --cpu=x64_windows --compiler=mingw-gcc //:hello
+
+Future versions of Bazel will select a C/C++ toolchain using the same platform
+and toolchain system used by other rules. This will be the default after the
+`--incompatible_enable_cc_toolchain_resolution`_ flag is flipped. To ensure
+that the MinGW toolchain is registered, either build against a ``platform``
+target with the ``@bazel_tools//tools/cpp:mingw`` constraint such as
+``@io_bazel_rules_go//go/toolchain:windows_amd64_cgo``, or define your own
+target explicitly, as below:
+
+.. code::
+
+ platform(
+ name = "windows_amd64_mingw",
+ constraint_values = [
+ "@bazel_tools//tools/cpp:mingw",
+ "@platforms//cpu:x86_64",
+ "@platforms//os:windows",
+ ],
+ )
+
+You can build with the command below. This also ensures the MinGW toolchain is
+registered (it is not, by default).
+
+.. code::
+
+ bazel build --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows_mingw --host_platform=//:windows_amd64_mingw --platforms=//:windows_amd64_mingw --incompatible_enable_cc_toolchain_resolution //:hello
+
+You may want to add these flags to a ``.bazelrc`` file in your project root
+directory or in your home directory.
+
+.. code::
+
+ build --cpu=x64_windows
+ build --compiler=mingw-gcc
+ build --extra_toolchains=@local_config_cc//:cc-toolchain-x64_windows_mingw
+ build --host_platform=//:windows_amd64_mingw
+ build --platforms=//:windows_amd64_mingw
+ build --incompatible_enable_cc_toolchain_resolution
+
+Confirm Go works
+----------------
+
+* Copy boilerplate from rules_go.
+* Confirm that you can run a pure Go "hello world" binary with
+ ``bazel run //:target``
+* Confirm you can run a cgo binary with the same set of flags and platforms
+ used to build a C target above.